commit f8eb3da04d9c38db18fcf92f8d0e4d11a8e87f31 Author: Irina Levit Date: Tue Dec 23 15:47:09 2025 -0500 Initial commit diff --git a/.history/eohi1/BS_means_20250922131352.vb b/.history/eohi1/BS_means_20250922131352.vb new file mode 100644 index 0000000..3bd8303 --- /dev/null +++ b/.history/eohi1/BS_means_20250922131352.vb @@ -0,0 +1,118 @@ +Option Explicit + +Private Function GetColIndex(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + If IsError(m) Then + GetColIndex = 0 + Else + GetColIndex = CLng(m) + End If +End Function + +Private Function BuildPresentColArray(ByVal headers As Variant, ByVal ws As Worksheet) As Variant + Dim tmp() As Long + ReDim tmp(0 To UBound(headers)) + Dim i As Long, c As Long + c = 0 + For i = LBound(headers) To UBound(headers) + Dim colIdx As Long + colIdx = GetColIndex(CStr(headers(i)), ws) + If colIdx > 0 Then + tmp(c) = colIdx + c = c + 1 + End If + Next i + If c = 0 Then + BuildPresentColArray = Array() + Else + Dim outArr() As Long + ReDim outArr(0 To c - 1) + For i = 0 To c - 1 + outArr(i) = tmp(i) + Next i + BuildPresentColArray = outArr + End If +End Function + +Private Function MeanOfRow(ByVal ws As Worksheet, ByVal rowIndex As Long, ByVal colIndexes As Variant) As Variant + Dim i As Long + Dim sumVals As Double + Dim countVals As Long + sumVals = 0 + countVals = 0 + If IsArray(colIndexes) Then + For i = LBound(colIndexes) To UBound(colIndexes) + Dim v As Variant + v = ws.Cells(rowIndex, CLng(colIndexes(i))).Value + If Not IsError(v) Then + If IsNumeric(v) Then + sumVals = sumVals + CDbl(v) + countVals = countVals + 1 + End If + End If + Next i + End If + If countVals = 0 Then + MeanOfRow = CVErr(xlErrNA) + Else + MeanOfRow = sumVals / countVals + End If +End Function + +Private Function EnsureOutputColumn(ByVal ws As Worksheet, ByVal headerName As String) As Long + Dim c As Long + c = GetColIndex(headerName, ws) + If c = 0 Then + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + c = lastCol + 1 + ws.Cells(1, c).Value = headerName + End If + EnsureOutputColumn = c +End Function + +Sub BS_Means() + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + + Dim all28 As Variant + all28 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim easy14 As Variant + easy14 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy" _ + ) + + Dim hard14 As Variant + hard14 = Array( _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim colsAll As Variant, colsEasy As Variant, colsHard As Variant + colsAll = BuildPresentColArray(all28, ws) + colsEasy = BuildPresentColArray(easy14, ws) + colsHard = BuildPresentColArray(hard14, ws) + + Dim colBS28 As Long, colBSEasy As Long, colBSHard As Long + colBS28 = EnsureOutputColumn(ws, "bs_28") + colBSEasy = EnsureOutputColumn(ws, "bs_easy") + colBSHard = EnsureOutputColumn(ws, "bs_hard") + + Dim lastRow As Long + lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + + Dim r As Long + For r = 2 To lastRow + ws.Cells(r, colBS28).Value = MeanOfRow(ws, r, colsAll) + ws.Cells(r, colBSEasy).Value = MeanOfRow(ws, r, colsEasy) + ws.Cells(r, colBSHard).Value = MeanOfRow(ws, r, colsHard) + Next r +End Sub + + diff --git a/.history/eohi1/BS_means_20250922131356.vb b/.history/eohi1/BS_means_20250922131356.vb new file mode 100644 index 0000000..3bd8303 --- /dev/null +++ b/.history/eohi1/BS_means_20250922131356.vb @@ -0,0 +1,118 @@ +Option Explicit + +Private Function GetColIndex(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + If IsError(m) Then + GetColIndex = 0 + Else + GetColIndex = CLng(m) + End If +End Function + +Private Function BuildPresentColArray(ByVal headers As Variant, ByVal ws As Worksheet) As Variant + Dim tmp() As Long + ReDim tmp(0 To UBound(headers)) + Dim i As Long, c As Long + c = 0 + For i = LBound(headers) To UBound(headers) + Dim colIdx As Long + colIdx = GetColIndex(CStr(headers(i)), ws) + If colIdx > 0 Then + tmp(c) = colIdx + c = c + 1 + End If + Next i + If c = 0 Then + BuildPresentColArray = Array() + Else + Dim outArr() As Long + ReDim outArr(0 To c - 1) + For i = 0 To c - 1 + outArr(i) = tmp(i) + Next i + BuildPresentColArray = outArr + End If +End Function + +Private Function MeanOfRow(ByVal ws As Worksheet, ByVal rowIndex As Long, ByVal colIndexes As Variant) As Variant + Dim i As Long + Dim sumVals As Double + Dim countVals As Long + sumVals = 0 + countVals = 0 + If IsArray(colIndexes) Then + For i = LBound(colIndexes) To UBound(colIndexes) + Dim v As Variant + v = ws.Cells(rowIndex, CLng(colIndexes(i))).Value + If Not IsError(v) Then + If IsNumeric(v) Then + sumVals = sumVals + CDbl(v) + countVals = countVals + 1 + End If + End If + Next i + End If + If countVals = 0 Then + MeanOfRow = CVErr(xlErrNA) + Else + MeanOfRow = sumVals / countVals + End If +End Function + +Private Function EnsureOutputColumn(ByVal ws As Worksheet, ByVal headerName As String) As Long + Dim c As Long + c = GetColIndex(headerName, ws) + If c = 0 Then + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + c = lastCol + 1 + ws.Cells(1, c).Value = headerName + End If + EnsureOutputColumn = c +End Function + +Sub BS_Means() + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + + Dim all28 As Variant + all28 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim easy14 As Variant + easy14 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy" _ + ) + + Dim hard14 As Variant + hard14 = Array( _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim colsAll As Variant, colsEasy As Variant, colsHard As Variant + colsAll = BuildPresentColArray(all28, ws) + colsEasy = BuildPresentColArray(easy14, ws) + colsHard = BuildPresentColArray(hard14, ws) + + Dim colBS28 As Long, colBSEasy As Long, colBSHard As Long + colBS28 = EnsureOutputColumn(ws, "bs_28") + colBSEasy = EnsureOutputColumn(ws, "bs_easy") + colBSHard = EnsureOutputColumn(ws, "bs_hard") + + Dim lastRow As Long + lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + + Dim r As Long + For r = 2 To lastRow + ws.Cells(r, colBS28).Value = MeanOfRow(ws, r, colsAll) + ws.Cells(r, colBSEasy).Value = MeanOfRow(ws, r, colsEasy) + ws.Cells(r, colBSHard).Value = MeanOfRow(ws, r, colsHard) + Next r +End Sub + + diff --git a/.history/eohi1/BS_means_20250922131406.vb b/.history/eohi1/BS_means_20250922131406.vb new file mode 100644 index 0000000..3bd8303 --- /dev/null +++ b/.history/eohi1/BS_means_20250922131406.vb @@ -0,0 +1,118 @@ +Option Explicit + +Private Function GetColIndex(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + If IsError(m) Then + GetColIndex = 0 + Else + GetColIndex = CLng(m) + End If +End Function + +Private Function BuildPresentColArray(ByVal headers As Variant, ByVal ws As Worksheet) As Variant + Dim tmp() As Long + ReDim tmp(0 To UBound(headers)) + Dim i As Long, c As Long + c = 0 + For i = LBound(headers) To UBound(headers) + Dim colIdx As Long + colIdx = GetColIndex(CStr(headers(i)), ws) + If colIdx > 0 Then + tmp(c) = colIdx + c = c + 1 + End If + Next i + If c = 0 Then + BuildPresentColArray = Array() + Else + Dim outArr() As Long + ReDim outArr(0 To c - 1) + For i = 0 To c - 1 + outArr(i) = tmp(i) + Next i + BuildPresentColArray = outArr + End If +End Function + +Private Function MeanOfRow(ByVal ws As Worksheet, ByVal rowIndex As Long, ByVal colIndexes As Variant) As Variant + Dim i As Long + Dim sumVals As Double + Dim countVals As Long + sumVals = 0 + countVals = 0 + If IsArray(colIndexes) Then + For i = LBound(colIndexes) To UBound(colIndexes) + Dim v As Variant + v = ws.Cells(rowIndex, CLng(colIndexes(i))).Value + If Not IsError(v) Then + If IsNumeric(v) Then + sumVals = sumVals + CDbl(v) + countVals = countVals + 1 + End If + End If + Next i + End If + If countVals = 0 Then + MeanOfRow = CVErr(xlErrNA) + Else + MeanOfRow = sumVals / countVals + End If +End Function + +Private Function EnsureOutputColumn(ByVal ws As Worksheet, ByVal headerName As String) As Long + Dim c As Long + c = GetColIndex(headerName, ws) + If c = 0 Then + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + c = lastCol + 1 + ws.Cells(1, c).Value = headerName + End If + EnsureOutputColumn = c +End Function + +Sub BS_Means() + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + + Dim all28 As Variant + all28 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim easy14 As Variant + easy14 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy" _ + ) + + Dim hard14 As Variant + hard14 = Array( _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim colsAll As Variant, colsEasy As Variant, colsHard As Variant + colsAll = BuildPresentColArray(all28, ws) + colsEasy = BuildPresentColArray(easy14, ws) + colsHard = BuildPresentColArray(hard14, ws) + + Dim colBS28 As Long, colBSEasy As Long, colBSHard As Long + colBS28 = EnsureOutputColumn(ws, "bs_28") + colBSEasy = EnsureOutputColumn(ws, "bs_easy") + colBSHard = EnsureOutputColumn(ws, "bs_hard") + + Dim lastRow As Long + lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + + Dim r As Long + For r = 2 To lastRow + ws.Cells(r, colBS28).Value = MeanOfRow(ws, r, colsAll) + ws.Cells(r, colBSEasy).Value = MeanOfRow(ws, r, colsEasy) + ws.Cells(r, colBSHard).Value = MeanOfRow(ws, r, colsHard) + Next r +End Sub + + diff --git a/.history/eohi1/DataP 01 - domain mean totals _20251007232436.r b/.history/eohi1/DataP 01 - domain mean totals _20251007232436.r new file mode 100644 index 0000000..f4da6af --- /dev/null +++ b/.history/eohi1/DataP 01 - domain mean totals _20251007232436.r @@ -0,0 +1,25 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Calculate NPast_mean_total as average of NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +exp1_data$NPast_mean_total <- rowMeans(exp1_data[, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life")], na.rm = TRUE) + +# Calculate NFut_mean_total as average of NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life +exp1_data$NFut_mean_total <- rowMeans(exp1_data[, c("NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life")], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated totals +cat("NPast_mean_total summary:\n") +summary(exp1_data$NPast_mean_total) +cat("\nNFut_mean_total summary:\n") +summary(exp1_data$NFut_mean_total) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated totals:\n") +print(exp1_data[1:5, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", "NPast_mean_total", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life", "NFut_mean_total")]) diff --git a/.history/eohi1/DataP 01 - domain mean totals _20251007232440.r b/.history/eohi1/DataP 01 - domain mean totals _20251007232440.r new file mode 100644 index 0000000..f4da6af --- /dev/null +++ b/.history/eohi1/DataP 01 - domain mean totals _20251007232440.r @@ -0,0 +1,25 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Calculate NPast_mean_total as average of NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +exp1_data$NPast_mean_total <- rowMeans(exp1_data[, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life")], na.rm = TRUE) + +# Calculate NFut_mean_total as average of NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life +exp1_data$NFut_mean_total <- rowMeans(exp1_data[, c("NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life")], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated totals +cat("NPast_mean_total summary:\n") +summary(exp1_data$NPast_mean_total) +cat("\nNFut_mean_total summary:\n") +summary(exp1_data$NFut_mean_total) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated totals:\n") +print(exp1_data[1:5, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", "NPast_mean_total", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life", "NFut_mean_total")]) diff --git a/.history/eohi1/DataP 01 - domain mean totals _20251007232447.r b/.history/eohi1/DataP 01 - domain mean totals _20251007232447.r new file mode 100644 index 0000000..f4da6af --- /dev/null +++ b/.history/eohi1/DataP 01 - domain mean totals _20251007232447.r @@ -0,0 +1,25 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Calculate NPast_mean_total as average of NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +exp1_data$NPast_mean_total <- rowMeans(exp1_data[, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life")], na.rm = TRUE) + +# Calculate NFut_mean_total as average of NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life +exp1_data$NFut_mean_total <- rowMeans(exp1_data[, c("NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life")], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated totals +cat("NPast_mean_total summary:\n") +summary(exp1_data$NPast_mean_total) +cat("\nNFut_mean_total summary:\n") +summary(exp1_data$NFut_mean_total) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated totals:\n") +print(exp1_data[1:5, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", "NPast_mean_total", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life", "NFut_mean_total")]) diff --git a/.history/eohi1/DataP 01 - domain mean totals _20251007232757.r b/.history/eohi1/DataP 01 - domain mean totals _20251007232757.r new file mode 100644 index 0000000..f4da6af --- /dev/null +++ b/.history/eohi1/DataP 01 - domain mean totals _20251007232757.r @@ -0,0 +1,25 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Calculate NPast_mean_total as average of NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +exp1_data$NPast_mean_total <- rowMeans(exp1_data[, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life")], na.rm = TRUE) + +# Calculate NFut_mean_total as average of NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life +exp1_data$NFut_mean_total <- rowMeans(exp1_data[, c("NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life")], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated totals +cat("NPast_mean_total summary:\n") +summary(exp1_data$NPast_mean_total) +cat("\nNFut_mean_total summary:\n") +summary(exp1_data$NFut_mean_total) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated totals:\n") +print(exp1_data[1:5, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", "NPast_mean_total", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life", "NFut_mean_total")]) diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193424.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193424.rmd new file mode 100644 index 0000000..5bb88d4 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193424.rmd @@ -0,0 +1,82 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193431.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193431.rmd new file mode 100644 index 0000000..648a864 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193431.rmd @@ -0,0 +1,121 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193438.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193438.rmd new file mode 100644 index 0000000..a30a9ee --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193438.rmd @@ -0,0 +1,175 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193443.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193443.rmd new file mode 100644 index 0000000..8e6fd70 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193443.rmd @@ -0,0 +1,205 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193454.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193454.rmd new file mode 100644 index 0000000..c1a144f --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193454.rmd @@ -0,0 +1,310 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193500.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193500.rmd new file mode 100644 index 0000000..e94b186 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193500.rmd @@ -0,0 +1,348 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193511.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193511.rmd new file mode 100644 index 0000000..713ff88 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193511.rmd @@ -0,0 +1,430 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193523.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193523.rmd new file mode 100644 index 0000000..a4886c1 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193523.rmd @@ -0,0 +1,497 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + +# Effect Sizes (Cohen's d) + +## Main Effects + +```{r cohens-d-main} +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} +``` + +```{r cohens-d-domain} +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193543.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193543.rmd new file mode 100644 index 0000000..167e90e --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193543.rmd @@ -0,0 +1,573 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + +# Effect Sizes (Cohen's d) + +## Main Effects + +```{r cohens-d-main} +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} +``` + +```{r cohens-d-domain} +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} +``` + +## Two-Way Interactions + +```{r cohens-d-function} +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} +``` + +```{r interaction-effects} +# Note: These sections would need the actual simple effects results from your analysis +# The original script references undefined variables: temporal_time_simple and time_domain_simple +# These would need to be calculated using emmeans for simple effects + +# 1. TEMPORAL_DO × TIME INTERACTION +# temporal_time_simple <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +# temporal_time_simple_df <- as.data.frame(pairs(temporal_time_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION +# time_domain_simple <- emmeans(aov_model, ~ DOMAIN | TIME) +# time_domain_simple_df <- as.data.frame(pairs(time_domain_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193554.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193554.rmd new file mode 100644 index 0000000..b5c49d3 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193554.rmd @@ -0,0 +1,660 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + +# Effect Sizes (Cohen's d) + +## Main Effects + +```{r cohens-d-main} +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} +``` + +```{r cohens-d-domain} +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} +``` + +## Two-Way Interactions + +```{r cohens-d-function} +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} +``` + +```{r interaction-effects} +# Note: These sections would need the actual simple effects results from your analysis +# The original script references undefined variables: temporal_time_simple and time_domain_simple +# These would need to be calculated using emmeans for simple effects + +# 1. TEMPORAL_DO × TIME INTERACTION +# temporal_time_simple <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +# temporal_time_simple_df <- as.data.frame(pairs(temporal_time_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION +# time_domain_simple <- emmeans(aov_model, ~ DOMAIN | TIME) +# time_domain_simple_df <- as.data.frame(pairs(time_domain_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") +``` + +# Interaction Plot + +```{r interaction-plot} +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Create estimated marginal means for DOMAIN x TIME +emm_full <- emmeans(aov_model, ~ DOMAIN * TIME) + +# Prepare emmeans data frame +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Plot without TEMPORAL_DO facet +interaction_plot2 <- ggplot() + + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193559.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193559.rmd new file mode 100644 index 0000000..b5c49d3 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193559.rmd @@ -0,0 +1,660 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + +# Effect Sizes (Cohen's d) + +## Main Effects + +```{r cohens-d-main} +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} +``` + +```{r cohens-d-domain} +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} +``` + +## Two-Way Interactions + +```{r cohens-d-function} +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} +``` + +```{r interaction-effects} +# Note: These sections would need the actual simple effects results from your analysis +# The original script references undefined variables: temporal_time_simple and time_domain_simple +# These would need to be calculated using emmeans for simple effects + +# 1. TEMPORAL_DO × TIME INTERACTION +# temporal_time_simple <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +# temporal_time_simple_df <- as.data.frame(pairs(temporal_time_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION +# time_domain_simple <- emmeans(aov_model, ~ DOMAIN | TIME) +# time_domain_simple_df <- as.data.frame(pairs(time_domain_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") +``` + +# Interaction Plot + +```{r interaction-plot} +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Create estimated marginal means for DOMAIN x TIME +emm_full <- emmeans(aov_model, ~ DOMAIN * TIME) + +# Prepare emmeans data frame +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Plot without TEMPORAL_DO facet +interaction_plot2 <- ggplot() + + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193613.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193613.rmd new file mode 100644 index 0000000..b5c49d3 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193613.rmd @@ -0,0 +1,660 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + +# Effect Sizes (Cohen's d) + +## Main Effects + +```{r cohens-d-main} +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} +``` + +```{r cohens-d-domain} +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} +``` + +## Two-Way Interactions + +```{r cohens-d-function} +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} +``` + +```{r interaction-effects} +# Note: These sections would need the actual simple effects results from your analysis +# The original script references undefined variables: temporal_time_simple and time_domain_simple +# These would need to be calculated using emmeans for simple effects + +# 1. TEMPORAL_DO × TIME INTERACTION +# temporal_time_simple <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +# temporal_time_simple_df <- as.data.frame(pairs(temporal_time_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION +# time_domain_simple <- emmeans(aov_model, ~ DOMAIN | TIME) +# time_domain_simple_df <- as.data.frame(pairs(time_domain_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") +``` + +# Interaction Plot + +```{r interaction-plot} +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Create estimated marginal means for DOMAIN x TIME +emm_full <- emmeans(aov_model, ~ DOMAIN * TIME) + +# Prepare emmeans data frame +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Plot without TEMPORAL_DO facet +interaction_plot2 <- ggplot() + + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) +``` + diff --git a/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193658.rmd b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193658.rmd new file mode 100644 index 0000000..b5c49d3 --- /dev/null +++ b/.history/eohi1/RMD exp1 - mixed anova domain means_20251004193658.rmd @@ -0,0 +1,660 @@ +--- +title: "Mixed ANOVA Analysis for Domain Means" +author: "Irina" +date: "`r Sys.Date()`" +output: + html_document: + toc: true + toc_float: true + code_folding: hide + theme: flatly + highlight: tango + fig_width: 10 + fig_height: 6 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Introduction + +This analysis examines domain-level differences in mean scores across time periods using a mixed ANOVA design. The analysis focuses on four domains (Preferences, Personality, Values, Life) across two time periods (Past, Future) with a between-subjects factor (TEMPORAL_DO). + +# Data Preparation and Setup + +```{r libraries} +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(ggplot2) # For plotting + +options(scipen = 999) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +``` + +```{r data-loading} +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) +``` + +```{r data-reshaping} +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Create clean dataset for analysis (fixing the reference issue) +long_data_clean <- long_data +``` + +# Descriptive Statistics + +## Overall Descriptive Statistics by TIME and DOMAIN + +```{r descriptive-stats} +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) +``` + +## Descriptive Statistics by Between-Subjects Factors + +```{r descriptive-stats-temporal} +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) +``` + +# Assumption Testing + +## Missing Values Check + +```{r missing-values} +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) +``` + +## Outlier Detection + +```{r outlier-detection} +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) +``` + +## Anderson-Darling Normality Test + +```{r normality-test} +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) +``` + +## Homogeneity of Variance (Levene's Test) + +### Test homogeneity across TIME within each DOMAIN + +```{r homogeneity-time} +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) +``` + +### Test homogeneity across DOMAIN within each TIME + +```{r homogeneity-domain} +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) +``` + +## Hartley's F-Max Test with Bootstrap Critical Values + +```{r hartley-function} +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} +``` + +```{r hartley-results} +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) +``` + +# Mixed ANOVA Analysis + +## Design Balance Check + +```{r design-check} +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} +``` + +## Mixed ANOVA with Sphericity Corrections + +```{r mixed-anova} +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) +``` + +## Mauchly's Test for Sphericity + +```{r mauchly-test} +print(mixed_anova_model$Mauchly) +``` + +## Sphericity-Corrected Results + +```{r sphericity-corrections} +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} +``` + +# Effect Sizes (Cohen's d) + +## Main Effects + +```{r cohens-d-main} +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} +``` + +```{r cohens-d-domain} +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} +``` + +## Two-Way Interactions + +```{r cohens-d-function} +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} +``` + +```{r interaction-effects} +# Note: These sections would need the actual simple effects results from your analysis +# The original script references undefined variables: temporal_time_simple and time_domain_simple +# These would need to be calculated using emmeans for simple effects + +# 1. TEMPORAL_DO × TIME INTERACTION +# temporal_time_simple <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +# temporal_time_simple_df <- as.data.frame(pairs(temporal_time_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION +# time_domain_simple <- emmeans(aov_model, ~ DOMAIN | TIME) +# time_domain_simple_df <- as.data.frame(pairs(time_domain_simple, adjust = "bonferroni")) +# calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") +``` + +# Interaction Plot + +```{r interaction-plot} +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Create estimated marginal means for DOMAIN x TIME +emm_full <- emmeans(aov_model, ~ DOMAIN * TIME) + +# Prepare emmeans data frame +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Plot without TEMPORAL_DO facet +interaction_plot2 <- ggplot() + + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) +``` + diff --git a/.history/eohi1/Untitled-1_20251020173338.r b/.history/eohi1/Untitled-1_20251020173338.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/Untitled-1_20251020173353.r b/.history/eohi1/Untitled-1_20251020173353.r new file mode 100644 index 0000000..8b82aee --- /dev/null +++ b/.history/eohi1/Untitled-1_20251020173353.r @@ -0,0 +1,15 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) \ No newline at end of file diff --git a/.history/eohi1/assumption_checks_before_cronbach_20250917154857.r b/.history/eohi1/assumption_checks_before_cronbach_20250917154857.r new file mode 100644 index 0000000..5dde602 --- /dev/null +++ b/.history/eohi1/assumption_checks_before_cronbach_20250917154857.r @@ -0,0 +1,162 @@ +# Assumption Checks Before Cronbach's Alpha Analysis +# Run this BEFORE the main reliability analysis + +library(psych) +library(corrplot) +library(ggplot2) + +# Read the data +data <- read.csv("exp1.csv") + +# Define scale variables +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Function to check assumptions for a scale +check_assumptions <- function(data, var_names, scale_name) { + cat("\n", "="*60, "\n") + cat("ASSUMPTION CHECKS FOR:", scale_name, "\n") + cat("="*60, "\n") + + # Get scale data + scale_data <- data[, var_names] + + # 1. Sample size check + complete_cases <- sum(complete.cases(scale_data)) + cat("1. SAMPLE SIZE CHECK:\n") + cat(" Total participants:", nrow(data), "\n") + cat(" Complete cases:", complete_cases, "\n") + cat(" Adequate (≥30)?", ifelse(complete_cases >= 30, "✓ YES", "✗ NO"), "\n") + + if(complete_cases < 30) { + cat(" WARNING: Sample size too small for reliable alpha estimates\n") + return(FALSE) + } + + # 2. Missing data check + cat("\n2. MISSING DATA CHECK:\n") + missing_counts <- colSums(is.na(scale_data)) + missing_pct <- round(missing_counts / nrow(data) * 100, 2) + cat(" Missing data by item:\n") + for(i in 1:length(var_names)) { + cat(" ", var_names[i], ":", missing_counts[i], "(", missing_pct[i], "%)\n") + } + + max_missing <- max(missing_pct) + cat(" Maximum missing:", max_missing, "%\n") + cat(" Acceptable (<20%)?", ifelse(max_missing < 20, "✓ YES", "✗ NO"), "\n") + + # 3. Use only complete cases for remaining checks + complete_data <- scale_data[complete.cases(scale_data), ] + + # 4. Normality check (Shapiro-Wilk test on first item as example) + cat("\n3. NORMALITY CHECK (Shapiro-Wilk test on first item):\n") + if(nrow(complete_data) <= 5000) { # Shapiro-Wilk has sample size limit + shapiro_result <- shapiro.test(complete_data[, 1]) + cat(" p-value:", round(shapiro_result$p.value, 4), "\n") + cat(" Normal?", ifelse(shapiro_result$p.value > 0.05, "✓ YES", "✗ NO (but alpha is robust)"), "\n") + } else { + cat(" Sample too large for Shapiro-Wilk test (alpha is robust to non-normality)\n") + } + + # 5. Inter-item correlations check + cat("\n4. INTER-ITEM CORRELATIONS CHECK:\n") + cor_matrix <- cor(complete_data) + + # Get off-diagonal correlations + cor_matrix[lower.tri(cor_matrix)] <- NA + diag(cor_matrix) <- NA + cors <- as.vector(cor_matrix) + cors <- cors[!is.na(cors)] + + positive_cors <- sum(cors > 0) + strong_cors <- sum(cors > 0.30) + negative_cors <- sum(cors < 0) + + cat(" Total correlations:", length(cors), "\n") + cat(" Positive correlations:", positive_cors, "\n") + cat(" Strong correlations (>0.30):", strong_cors, "\n") + cat(" Negative correlations:", negative_cors, "\n") + cat(" Mean correlation:", round(mean(cors), 4), "\n") + cat(" Range:", round(min(cors), 4), "to", round(max(cors), 4), "\n") + + if(negative_cors > 0) { + cat(" ⚠️ WARNING: Negative correlations suggest potential issues\n") + } + if(strong_cors / length(cors) < 0.5) { + cat(" ⚠️ WARNING: Many weak correlations may indicate poor scale coherence\n") + } + + # 6. Item variance check + cat("\n5. ITEM VARIANCE CHECK:\n") + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat(" Item variances:", round(item_vars, 4), "\n") + cat(" Variance ratio (max/min):", round(var_ratio, 4), "\n") + cat(" Acceptable (<4:1)?", ifelse(var_ratio < 4, "✓ YES", "✗ NO"), "\n") + + # 7. Outlier check + cat("\n6. OUTLIER CHECK:\n") + # Check for multivariate outliers using Mahalanobis distance + if(nrow(complete_data) > ncol(complete_data)) { + mahal_dist <- mahalanobis(complete_data, colMeans(complete_data), cov(complete_data)) + outlier_threshold <- qchisq(0.999, df = ncol(complete_data)) + outliers <- sum(mahal_dist > outlier_threshold) + cat(" Multivariate outliers (p<0.001):", outliers, "\n") + cat(" Acceptable (<5%)?", ifelse(outliers/nrow(complete_data) < 0.05, "✓ YES", "✗ NO"), "\n") + } + + # 8. Summary recommendation + cat("\n7. OVERALL RECOMMENDATION:\n") + issues <- 0 + if(complete_cases < 30) issues <- issues + 1 + if(max_missing >= 20) issues <- issues + 1 + if(negative_cors > 0) issues <- issues + 1 + if(var_ratio >= 4) issues <- issues + 1 + + if(issues == 0) { + cat(" ✓ PROCEED with Cronbach's alpha analysis\n") + } else if(issues <= 2) { + cat(" ⚠️ PROCEED with CAUTION - some assumptions violated\n") + } else { + cat(" ✗ CONSIDER alternatives or data cleaning before proceeding\n") + } + + return(TRUE) +} + +# Check assumptions for all past scales +cat("CRONBACH'S ALPHA ASSUMPTION CHECKS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +check_assumptions(data, past_pref_vars, "Past Preferences") +check_assumptions(data, past_pers_vars, "Past Personality") +check_assumptions(data, past_val_vars, "Past Values") +check_assumptions(data, past_life_vars, "Past Life Satisfaction") + +# Quick check of future scales (you can expand this) +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +check_assumptions(data, fut_pref_vars, "Future Preferences") + +cat("\n", "="*60, "\n") +cat("GENERAL GUIDELINES:\n") +cat("="*60, "\n") +cat("✓ If most assumptions are met, Cronbach's alpha is appropriate\n") +cat("⚠️ If some assumptions are violated, interpret with caution\n") +cat("✗ If many assumptions are violated, consider alternative approaches:\n") +cat(" - Omega coefficient (more robust to violations)\n") +cat(" - Split-half reliability\n") +cat(" - Test-retest reliability\n") +cat(" - Factor analysis to check dimensionality\n") diff --git a/.history/eohi1/assumption_checks_before_cronbach_20250917154901.r b/.history/eohi1/assumption_checks_before_cronbach_20250917154901.r new file mode 100644 index 0000000..5dde602 --- /dev/null +++ b/.history/eohi1/assumption_checks_before_cronbach_20250917154901.r @@ -0,0 +1,162 @@ +# Assumption Checks Before Cronbach's Alpha Analysis +# Run this BEFORE the main reliability analysis + +library(psych) +library(corrplot) +library(ggplot2) + +# Read the data +data <- read.csv("exp1.csv") + +# Define scale variables +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Function to check assumptions for a scale +check_assumptions <- function(data, var_names, scale_name) { + cat("\n", "="*60, "\n") + cat("ASSUMPTION CHECKS FOR:", scale_name, "\n") + cat("="*60, "\n") + + # Get scale data + scale_data <- data[, var_names] + + # 1. Sample size check + complete_cases <- sum(complete.cases(scale_data)) + cat("1. SAMPLE SIZE CHECK:\n") + cat(" Total participants:", nrow(data), "\n") + cat(" Complete cases:", complete_cases, "\n") + cat(" Adequate (≥30)?", ifelse(complete_cases >= 30, "✓ YES", "✗ NO"), "\n") + + if(complete_cases < 30) { + cat(" WARNING: Sample size too small for reliable alpha estimates\n") + return(FALSE) + } + + # 2. Missing data check + cat("\n2. MISSING DATA CHECK:\n") + missing_counts <- colSums(is.na(scale_data)) + missing_pct <- round(missing_counts / nrow(data) * 100, 2) + cat(" Missing data by item:\n") + for(i in 1:length(var_names)) { + cat(" ", var_names[i], ":", missing_counts[i], "(", missing_pct[i], "%)\n") + } + + max_missing <- max(missing_pct) + cat(" Maximum missing:", max_missing, "%\n") + cat(" Acceptable (<20%)?", ifelse(max_missing < 20, "✓ YES", "✗ NO"), "\n") + + # 3. Use only complete cases for remaining checks + complete_data <- scale_data[complete.cases(scale_data), ] + + # 4. Normality check (Shapiro-Wilk test on first item as example) + cat("\n3. NORMALITY CHECK (Shapiro-Wilk test on first item):\n") + if(nrow(complete_data) <= 5000) { # Shapiro-Wilk has sample size limit + shapiro_result <- shapiro.test(complete_data[, 1]) + cat(" p-value:", round(shapiro_result$p.value, 4), "\n") + cat(" Normal?", ifelse(shapiro_result$p.value > 0.05, "✓ YES", "✗ NO (but alpha is robust)"), "\n") + } else { + cat(" Sample too large for Shapiro-Wilk test (alpha is robust to non-normality)\n") + } + + # 5. Inter-item correlations check + cat("\n4. INTER-ITEM CORRELATIONS CHECK:\n") + cor_matrix <- cor(complete_data) + + # Get off-diagonal correlations + cor_matrix[lower.tri(cor_matrix)] <- NA + diag(cor_matrix) <- NA + cors <- as.vector(cor_matrix) + cors <- cors[!is.na(cors)] + + positive_cors <- sum(cors > 0) + strong_cors <- sum(cors > 0.30) + negative_cors <- sum(cors < 0) + + cat(" Total correlations:", length(cors), "\n") + cat(" Positive correlations:", positive_cors, "\n") + cat(" Strong correlations (>0.30):", strong_cors, "\n") + cat(" Negative correlations:", negative_cors, "\n") + cat(" Mean correlation:", round(mean(cors), 4), "\n") + cat(" Range:", round(min(cors), 4), "to", round(max(cors), 4), "\n") + + if(negative_cors > 0) { + cat(" ⚠️ WARNING: Negative correlations suggest potential issues\n") + } + if(strong_cors / length(cors) < 0.5) { + cat(" ⚠️ WARNING: Many weak correlations may indicate poor scale coherence\n") + } + + # 6. Item variance check + cat("\n5. ITEM VARIANCE CHECK:\n") + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat(" Item variances:", round(item_vars, 4), "\n") + cat(" Variance ratio (max/min):", round(var_ratio, 4), "\n") + cat(" Acceptable (<4:1)?", ifelse(var_ratio < 4, "✓ YES", "✗ NO"), "\n") + + # 7. Outlier check + cat("\n6. OUTLIER CHECK:\n") + # Check for multivariate outliers using Mahalanobis distance + if(nrow(complete_data) > ncol(complete_data)) { + mahal_dist <- mahalanobis(complete_data, colMeans(complete_data), cov(complete_data)) + outlier_threshold <- qchisq(0.999, df = ncol(complete_data)) + outliers <- sum(mahal_dist > outlier_threshold) + cat(" Multivariate outliers (p<0.001):", outliers, "\n") + cat(" Acceptable (<5%)?", ifelse(outliers/nrow(complete_data) < 0.05, "✓ YES", "✗ NO"), "\n") + } + + # 8. Summary recommendation + cat("\n7. OVERALL RECOMMENDATION:\n") + issues <- 0 + if(complete_cases < 30) issues <- issues + 1 + if(max_missing >= 20) issues <- issues + 1 + if(negative_cors > 0) issues <- issues + 1 + if(var_ratio >= 4) issues <- issues + 1 + + if(issues == 0) { + cat(" ✓ PROCEED with Cronbach's alpha analysis\n") + } else if(issues <= 2) { + cat(" ⚠️ PROCEED with CAUTION - some assumptions violated\n") + } else { + cat(" ✗ CONSIDER alternatives or data cleaning before proceeding\n") + } + + return(TRUE) +} + +# Check assumptions for all past scales +cat("CRONBACH'S ALPHA ASSUMPTION CHECKS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +check_assumptions(data, past_pref_vars, "Past Preferences") +check_assumptions(data, past_pers_vars, "Past Personality") +check_assumptions(data, past_val_vars, "Past Values") +check_assumptions(data, past_life_vars, "Past Life Satisfaction") + +# Quick check of future scales (you can expand this) +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +check_assumptions(data, fut_pref_vars, "Future Preferences") + +cat("\n", "="*60, "\n") +cat("GENERAL GUIDELINES:\n") +cat("="*60, "\n") +cat("✓ If most assumptions are met, Cronbach's alpha is appropriate\n") +cat("⚠️ If some assumptions are violated, interpret with caution\n") +cat("✗ If many assumptions are violated, consider alternative approaches:\n") +cat(" - Omega coefficient (more robust to violations)\n") +cat(" - Split-half reliability\n") +cat(" - Test-retest reliability\n") +cat(" - Factor analysis to check dimensionality\n") diff --git a/.history/eohi1/assumption_checks_before_cronbach_20250918115459.r b/.history/eohi1/assumption_checks_before_cronbach_20250918115459.r new file mode 100644 index 0000000..3de74a7 --- /dev/null +++ b/.history/eohi1/assumption_checks_before_cronbach_20250918115459.r @@ -0,0 +1,164 @@ +# Assumption Checks Before Cronbach's Alpha Analysis +# Run this BEFORE the main reliability analysis + +library(psych) +library(corrplot) +library(ggplot2) + +# Read the data +data <- read.csv("exp1.csv") + +# Define scale variables +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Function to check assumptions for a scale +check_assumptions <- function(data, var_names, scale_name) { + cat("\n", "="*60, "\n") + cat("ASSUMPTION CHECKS FOR:", scale_name, "\n") + cat("="*60, "\n") + + # Get scale data + scale_data <- data[, var_names] + + # 1. Sample size check + complete_cases <- sum(complete.cases(scale_data)) + cat("1. SAMPLE SIZE CHECK:\n") + cat(" Total participants:", nrow(data), "\n") + cat(" Complete cases:", complete_cases, "\n") + cat(" Adequate (≥30)?", ifelse(complete_cases >= 30, "✓ YES", "✗ NO"), "\n") + + if(complete_cases < 30) { + cat(" WARNING: Sample size too small for reliable alpha estimates\n") + return(FALSE) + } + + # 2. Missing data check + cat("\n2. MISSING DATA CHECK:\n") + missing_counts <- colSums(is.na(scale_data)) + missing_pct <- round(missing_counts / nrow(data) * 100, 2) + cat(" Missing data by item:\n") + for(i in 1:length(var_names)) { + cat(" ", var_names[i], ":", missing_counts[i], "(", missing_pct[i], "%)\n") + } + + max_missing <- max(missing_pct) + cat(" Maximum missing:", max_missing, "%\n") + cat(" Acceptable (<20%)?", ifelse(max_missing < 20, "✓ YES", "✗ NO"), "\n") + + # 3. Use only complete cases for remaining checks + complete_data <- scale_data[complete.cases(scale_data), ] + + # 4. Normality check (Shapiro-Wilk test on first item as example) + cat("\n3. NORMALITY CHECK (Shapiro-Wilk test on first item):\n") + if(nrow(complete_data) <= 5000) { # Shapiro-Wilk has sample size limit + shapiro_result <- shapiro.test(complete_data[, 1]) + cat(" p-value:", round(shapiro_result$p.value, 4), "\n") + cat(" Normal?", ifelse(shapiro_result$p.value > 0.05, "✓ YES", "✗ NO (but alpha is robust)"), "\n") + } else { + cat(" Sample too large for Shapiro-Wilk test (alpha is robust to non-normality)\n") + } + + # 5. Inter-item correlations check + cat("\n4. INTER-ITEM CORRELATIONS CHECK:\n") + cor_matrix <- cor(complete_data) + + # Get off-diagonal correlations + cor_matrix[lower.tri(cor_matrix)] <- NA + diag(cor_matrix) <- NA + cors <- as.vector(cor_matrix) + cors <- cors[!is.na(cors)] + + positive_cors <- sum(cors > 0) + strong_cors <- sum(cors > 0.30) + negative_cors <- sum(cors < 0) + + cat(" Total correlations:", length(cors), "\n") + cat(" Positive correlations:", positive_cors, "\n") + cat(" Strong correlations (>0.30):", strong_cors, "\n") + cat(" Negative correlations:", negative_cors, "\n") + cat(" Mean correlation:", round(mean(cors), 4), "\n") + cat(" Range:", round(min(cors), 4), "to", round(max(cors), 4), "\n") + + if(negative_cors > 0) { + cat(" ⚠️ WARNING: Negative correlations suggest potential issues\n") + } + if(strong_cors / length(cors) < 0.5) { + cat(" ⚠️ WARNING: Many weak correlations may indicate poor scale coherence\n") + } + + # 6. Item variance check + cat("\n5. ITEM VARIANCE CHECK:\n") + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat(" Item variances:", round(item_vars, 4), "\n") + cat(" Variance ratio (max/min):", round(var_ratio, 4), "\n") + cat(" Acceptable (<4:1)?", ifelse(var_ratio < 4, "✓ YES", "✗ NO"), "\n") + + # 7. Outlier check + cat("\n6. OUTLIER CHECK:\n") + # Check for multivariate outliers using Mahalanobis distance + if(nrow(complete_data) > ncol(complete_data)) { + mahal_dist <- mahalanobis(complete_data, colMeans(complete_data), cov(complete_data)) + outlier_threshold <- qchisq(0.999, df = ncol(complete_data)) + outliers <- sum(mahal_dist > outlier_threshold) + cat(" Multivariate outliers (p<0.001):", outliers, "\n") + cat(" Acceptable (<5%)?", ifelse(outliers/nrow(complete_data) < 0.05, "✓ YES", "✗ NO"), "\n") + } + + # 8. Summary recommendation + cat("\n7. OVERALL RECOMMENDATION:\n") + issues <- 0 + if(complete_cases < 30) issues <- issues + 1 + if(max_missing >= 20) issues <- issues + 1 + if(negative_cors > 0) issues <- issues + 1 + if(var_ratio >= 4) issues <- issues + 1 + + if(issues == 0) { + cat(" ✓ PROCEED with Cronbach's alpha analysis\n") + } else if(issues <= 2) { + cat(" ⚠️ PROCEED with CAUTION - some assumptions violated\n") + } else { + cat(" ✗ CONSIDER alternatives or data cleaning before proceeding\n") + } + + return(TRUE) +} + +# Check assumptions for all past scales +cat("CRONBACH'S ALPHA ASSUMPTION CHECKS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +check_assumptions(data, past_pref_vars, "Past Preferences") +check_assumptions(data, past_pers_vars, "Past Personality") +check_assumptions(data, past_val_vars, "Past Values") +check_assumptions(data, past_life_vars, "Past Life Satisfaction") + +# Quick check of future scales (you can expand this) +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +check_assumptions(data, fut_pref_vars, "Future Preferences") + +cat("\n", "="*60, "\n") +cat("GENERAL GUIDELINES:\n") +cat("="*60, "\n") +cat("✓ If most assumptions are met, Cronbach's alpha is appropriate\n") +cat("⚠️ If some assumptions are violated, interpret with caution\n") +cat("✗ If many assumptions are violated, consider alternative approaches:\n") +cat(" - Omega coefficient (more robust to violations)\n") +cat(" - Split-half reliability\n") +cat(" - Test-retest reliability\n") +cat(" - Factor analysis to check dimensionality\n") + + diff --git a/.history/eohi1/brierVARS_20250922124859.vb b/.history/eohi1/brierVARS_20250922124859.vb new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/brierVARS_20250922124900.vb b/.history/eohi1/brierVARS_20250922124900.vb new file mode 100644 index 0000000..6f430be --- /dev/null +++ b/.history/eohi1/brierVARS_20250922124900.vb @@ -0,0 +1,82 @@ +Function GetCol(headerName As String, ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + GetCol = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + If IsError(GetCol) Then GetCol = 0 + On Error GoTo 0 +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922125338.vb b/.history/eohi1/brierVARS_20250922125338.vb new file mode 100644 index 0000000..1ae6638 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922125338.vb @@ -0,0 +1,87 @@ +Function GetCol(headerName As String, ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922125353.vb b/.history/eohi1/brierVARS_20250922125353.vb new file mode 100644 index 0000000..1ae6638 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922125353.vb @@ -0,0 +1,87 @@ +Function GetCol(headerName As String, ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922125648.vb b/.history/eohi1/brierVARS_20250922125648.vb new file mode 100644 index 0000000..1ae6638 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922125648.vb @@ -0,0 +1,87 @@ +Function GetCol(headerName As String, ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922125759.vb b/.history/eohi1/brierVARS_20250922125759.vb new file mode 100644 index 0000000..e39d631 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922125759.vb @@ -0,0 +1,87 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922125807.vb b/.history/eohi1/brierVARS_20250922125807.vb new file mode 100644 index 0000000..e39d631 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922125807.vb @@ -0,0 +1,87 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922125821.vb b/.history/eohi1/brierVARS_20250922125821.vb new file mode 100644 index 0000000..e39d631 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922125821.vb @@ -0,0 +1,87 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 0) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 0) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = ws.Cells(r, colSourceCON).Value + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + If checkVal = "TRUE" Then + result = ((val / 100) - 1) ^ 2 + ElseIf checkVal = "FALSE" Then + result = ((1 - (val / 100)) - 1) ^ 2 + Else + result = CVErr(xlErrNA) + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922130226.vb b/.history/eohi1/brierVARS_20250922130226.vb new file mode 100644 index 0000000..1192e2f --- /dev/null +++ b/.history/eohi1/brierVARS_20250922130226.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922130242.vb b/.history/eohi1/brierVARS_20250922130242.vb new file mode 100644 index 0000000..1192e2f --- /dev/null +++ b/.history/eohi1/brierVARS_20250922130242.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922130423.vb b/.history/eohi1/brierVARS_20250922130423.vb new file mode 100644 index 0000000..ab96160 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922130423.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON", "croc_75_F_1", "croc_75_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922130433.vb b/.history/eohi1/brierVARS_20250922130433.vb new file mode 100644 index 0000000..ab96160 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922130433.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON", "croc_75_F_1", "croc_75_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922130435.vb b/.history/eohi1/brierVARS_20250922130435.vb new file mode 100644 index 0000000..ab96160 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922130435.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON", "croc_75_F_1", "croc_75_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/brierVARS_20250922131020.vb b/.history/eohi1/brierVARS_20250922131020.vb new file mode 100644 index 0000000..ab96160 --- /dev/null +++ b/.history/eohi1/brierVARS_20250922131020.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON", "croc_75_F_1", "croc_75_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/.history/eohi1/correlation matrix_20251027115053.r b/.history/eohi1/correlation matrix_20251027115053.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/correlation matrix_20251027115054.r b/.history/eohi1/correlation matrix_20251027115054.r new file mode 100644 index 0000000..52ea22d --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027115054.r @@ -0,0 +1,40 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027115900.r b/.history/eohi1/correlation matrix_20251027115900.r new file mode 100644 index 0000000..9b89a6a --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027115900.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027115902.r b/.history/eohi1/correlation matrix_20251027115902.r new file mode 100644 index 0000000..9b89a6a --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027115902.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027115905.r b/.history/eohi1/correlation matrix_20251027115905.r new file mode 100644 index 0000000..9b89a6a --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027115905.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120022.r b/.history/eohi1/correlation matrix_20251027120022.r new file mode 100644 index 0000000..9b89a6a --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120022.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120056.r b/.history/eohi1/correlation matrix_20251027120056.r new file mode 100644 index 0000000..1843a3d --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120056.r @@ -0,0 +1,67 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, age_centered, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_matrix, 3)) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120100.r b/.history/eohi1/correlation matrix_20251027120100.r new file mode 100644 index 0000000..1843a3d --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120100.r @@ -0,0 +1,67 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, age_centered, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_matrix, 3)) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120122.r b/.history/eohi1/correlation matrix_20251027120122.r new file mode 100644 index 0000000..1843a3d --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120122.r @@ -0,0 +1,67 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, age_centered, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_matrix, 3)) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120345.r b/.history/eohi1/correlation matrix_20251027120345.r new file mode 100644 index 0000000..18da719 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120345.r @@ -0,0 +1,67 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_matrix, 3)) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120348.r b/.history/eohi1/correlation matrix_20251027120348.r new file mode 100644 index 0000000..18da719 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120348.r @@ -0,0 +1,67 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_matrix, 3)) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120351.r b/.history/eohi1/correlation matrix_20251027120351.r new file mode 100644 index 0000000..18da719 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120351.r @@ -0,0 +1,67 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_matrix, 3)) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120448.r b/.history/eohi1/correlation matrix_20251027120448.r new file mode 100644 index 0000000..7389450 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120448.r @@ -0,0 +1,76 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations +library(Hmisc) +cor_test <- rcorr(as.matrix(numeric_vars), type = "spearman") + +# Print correlation matrix with significance +print("Correlation Matrix with Significance:") +print(cor_test$r) +print("\nP-values:") +print(cor_test$P) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120450.r b/.history/eohi1/correlation matrix_20251027120450.r new file mode 100644 index 0000000..7389450 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120450.r @@ -0,0 +1,76 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations +library(Hmisc) +cor_test <- rcorr(as.matrix(numeric_vars), type = "spearman") + +# Print correlation matrix with significance +print("Correlation Matrix with Significance:") +print(cor_test$r) +print("\nP-values:") +print(cor_test$P) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120505.r b/.history/eohi1/correlation matrix_20251027120505.r new file mode 100644 index 0000000..7389450 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120505.r @@ -0,0 +1,76 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations +library(Hmisc) +cor_test <- rcorr(as.matrix(numeric_vars), type = "spearman") + +# Print correlation matrix with significance +print("Correlation Matrix with Significance:") +print(cor_test$r) +print("\nP-values:") +print(cor_test$P) + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120720.r b/.history/eohi1/correlation matrix_20251027120720.r new file mode 100644 index 0000000..e097850 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120720.r @@ -0,0 +1,97 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values:") +print(round(cor_test$p, 3)) + +# Print significant correlations (p < 0.05) +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120722.r b/.history/eohi1/correlation matrix_20251027120722.r new file mode 100644 index 0000000..e097850 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120722.r @@ -0,0 +1,97 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values:") +print(round(cor_test$p, 3)) + +# Print significant correlations (p < 0.05) +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix to CSV +write.csv(cor_matrix, "correlation_matrix.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120752.r b/.history/eohi1/correlation matrix_20251027120752.r new file mode 100644 index 0000000..97c8ede --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120752.r @@ -0,0 +1,99 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values:") +print(round(cor_test$p, 3)) + +# Print significant correlations (p < 0.05) +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120754.r b/.history/eohi1/correlation matrix_20251027120754.r new file mode 100644 index 0000000..97c8ede --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120754.r @@ -0,0 +1,99 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values:") +print(round(cor_test$p, 3)) + +# Print significant correlations (p < 0.05) +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120804.r b/.history/eohi1/correlation matrix_20251027120804.r new file mode 100644 index 0000000..97c8ede --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120804.r @@ -0,0 +1,99 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix:") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values:") +print(round(cor_test$p, 3)) + +# Print significant correlations (p < 0.05) +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120919.r b/.history/eohi1/correlation matrix_20251027120919.r new file mode 100644 index 0000000..156c379 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120919.r @@ -0,0 +1,111 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix (Spearman r values):") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values Matrix:") +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +print("\nAll correlations with r and p values:") +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120930.r b/.history/eohi1/correlation matrix_20251027120930.r new file mode 100644 index 0000000..156c379 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120930.r @@ -0,0 +1,111 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix (Spearman r values):") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values Matrix:") +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +print("\nAll correlations with r and p values:") +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120933.r b/.history/eohi1/correlation matrix_20251027120933.r new file mode 100644 index 0000000..156c379 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120933.r @@ -0,0 +1,111 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print("Correlation Matrix (Spearman r values):") +print(round(cor_test$r, 3)) + +# Print p-values +print("\nP-values Matrix:") +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +print("\nAll correlations with r and p values:") +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +print("\nSignificant correlations (p < 0.05):") +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} else { + print("No significant correlations found.") +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120955.r b/.history/eohi1/correlation matrix_20251027120955.r new file mode 100644 index 0000000..4b1a8a7 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120955.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027120958.r b/.history/eohi1/correlation matrix_20251027120958.r new file mode 100644 index 0000000..4b1a8a7 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027120958.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027121016.r b/.history/eohi1/correlation matrix_20251027121016.r new file mode 100644 index 0000000..4b1a8a7 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027121016.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251027134544.r b/.history/eohi1/correlation matrix_20251027134544.r new file mode 100644 index 0000000..4b1a8a7 --- /dev/null +++ b/.history/eohi1/correlation matrix_20251027134544.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi1/correlation matrix_20251029115844.r b/.history/eohi1/correlation matrix_20251029115844.r new file mode 100644 index 0000000..d19a28e --- /dev/null +++ b/.history/eohi1/correlation matrix_20251029115844.r @@ -0,0 +1,103 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922132833.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922132833.r new file mode 100644 index 0000000..deade33 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922132833.r @@ -0,0 +1,67 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# If you want to export CSVs, uncomment: +# write.csv(corr_bs_eohi, "corr_bs_eohi.csv", row.names = FALSE) +# write.csv(corr_bs_cal, "corr_bs_cal.csv", row.names = FALSE) +# write.csv(wide_bs_eohi, "corr_bs_eohi_wide.csv", row.names = FALSE) +# write.csv(wide_bs_cal, "corr_bs_cal_wide.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922132837.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922132837.r new file mode 100644 index 0000000..deade33 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922132837.r @@ -0,0 +1,67 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# If you want to export CSVs, uncomment: +# write.csv(corr_bs_eohi, "corr_bs_eohi.csv", row.names = FALSE) +# write.csv(corr_bs_cal, "corr_bs_cal.csv", row.names = FALSE) +# write.csv(wide_bs_eohi, "corr_bs_eohi_wide.csv", row.names = FALSE) +# write.csv(wide_bs_cal, "corr_bs_cal_wide.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922132923.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922132923.r new file mode 100644 index 0000000..6132380 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922132923.r @@ -0,0 +1,74 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# If you want to export CSVs, uncomment: +# write.csv(corr_bs_eohi, "corr_bs_eohi.csv", row.names = FALSE) +# write.csv(corr_bs_cal, "corr_bs_cal.csv", row.names = FALSE) +# write.csv(wide_bs_eohi, "corr_bs_eohi_wide.csv", row.names = FALSE) +# write.csv(wide_bs_cal, "corr_bs_cal_wide.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922132932.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922132932.r new file mode 100644 index 0000000..6132380 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922132932.r @@ -0,0 +1,74 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# If you want to export CSVs, uncomment: +# write.csv(corr_bs_eohi, "corr_bs_eohi.csv", row.names = FALSE) +# write.csv(corr_bs_cal, "corr_bs_cal.csv", row.names = FALSE) +# write.csv(wide_bs_eohi, "corr_bs_eohi_wide.csv", row.names = FALSE) +# write.csv(wide_bs_cal, "corr_bs_cal_wide.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922132938.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922132938.r new file mode 100644 index 0000000..6132380 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922132938.r @@ -0,0 +1,74 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# If you want to export CSVs, uncomment: +# write.csv(corr_bs_eohi, "corr_bs_eohi.csv", row.names = FALSE) +# write.csv(corr_bs_cal, "corr_bs_cal.csv", row.names = FALSE) +# write.csv(wide_bs_eohi, "corr_bs_eohi_wide.csv", row.names = FALSE) +# write.csv(wide_bs_cal, "corr_bs_cal_wide.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922133020.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922133020.r new file mode 100644 index 0000000..13dfc16 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922133020.r @@ -0,0 +1,75 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922133026.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922133026.r new file mode 100644 index 0000000..13dfc16 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922133026.r @@ -0,0 +1,75 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922133028.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922133028.r new file mode 100644 index 0000000..13dfc16 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922133028.r @@ -0,0 +1,75 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (Pearson), pairwise complete +corr_tidy <- function(df, x_vars, y_vars) { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = "pearson")) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars) +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars) + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (r, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922133336.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922133336.r new file mode 100644 index 0000000..9f32ebe --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922133336.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922133339.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922133339.r new file mode 100644 index 0000000..9f32ebe --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922133339.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922133341.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922133341.r new file mode 100644 index 0000000..9f32ebe --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922133341.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922134044.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922134044.r new file mode 100644 index 0000000..9f32ebe --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922134044.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20250922135638.r b/.history/eohi1/correlations - brier score x eohi and cal_20250922135638.r new file mode 100644 index 0000000..9f32ebe --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20250922135638.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160336.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160336.r new file mode 100644 index 0000000..9591a6f --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160336.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160455.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160455.r new file mode 100644 index 0000000..f471649 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160455.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohi_pref","eohi_pers","eohi_val","eohi_life","eohi_mean", + "eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160500.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160500.r new file mode 100644 index 0000000..cb2b33f --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160500.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160505.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160505.r new file mode 100644 index 0000000..cb2b33f --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160505.r @@ -0,0 +1,86 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Pearson) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "pearson") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "pearson") + +# Compute correlations (Spearman) +corr_s_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_s_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Pearson r, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Pearson r, p, n)") +print(corr_bs_cal) +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_s_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_s_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" +corr_s_bs_eohi$group <- "EOHI" +corr_s_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_s_bs_eohi, corr_s_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160539.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160539.r new file mode 100644 index 0000000..73f0756 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160539.r @@ -0,0 +1,76 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160544.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160544.r new file mode 100644 index 0000000..73f0756 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160544.r @@ -0,0 +1,76 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008160550.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008160550.r new file mode 100644 index 0000000..73f0756 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008160550.r @@ -0,0 +1,76 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008162952.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008162952.r new file mode 100644 index 0000000..73f0756 --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008162952.r @@ -0,0 +1,76 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) + +# Export a single CSV combining both sets +corr_bs_eohi$group <- "EOHI" +corr_bs_cal$group <- "Calibration" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008185636.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008185636.r new file mode 100644 index 0000000..b2dfd5d --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008185636.r @@ -0,0 +1,81 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") +corr_cal_eohi <- corr_tidy(df1, cal_vars, eohi_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) +wide_cal_eohi <- to_wide(corr_cal_eohi) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) +print("Correlations: Calibration vs EOHIs (Spearman rho, p, n)") +print(corr_cal_eohi) + +# Export a single CSV combining all sets +corr_bs_eohi$group <- "BS_vs_EOHI" +corr_bs_cal$group <- "BS_vs_Cal" +corr_cal_eohi$group <- "Cal_vs_EOHI" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_cal_eohi) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008185645.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008185645.r new file mode 100644 index 0000000..b2dfd5d --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008185645.r @@ -0,0 +1,81 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") +corr_cal_eohi <- corr_tidy(df1, cal_vars, eohi_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) +wide_cal_eohi <- to_wide(corr_cal_eohi) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) +print("Correlations: Calibration vs EOHIs (Spearman rho, p, n)") +print(corr_cal_eohi) + +# Export a single CSV combining all sets +corr_bs_eohi$group <- "BS_vs_EOHI" +corr_bs_cal$group <- "BS_vs_Cal" +corr_cal_eohi$group <- "Cal_vs_EOHI" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_cal_eohi) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - brier score x eohi and cal_20251008185658.r b/.history/eohi1/correlations - brier score x eohi and cal_20251008185658.r new file mode 100644 index 0000000..b2dfd5d --- /dev/null +++ b/.history/eohi1/correlations - brier score x eohi and cal_20251008185658.r @@ -0,0 +1,81 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") +corr_cal_eohi <- corr_tidy(df1, cal_vars, eohi_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) +wide_cal_eohi <- to_wide(corr_cal_eohi) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) +print("Correlations: Calibration vs EOHIs (Spearman rho, p, n)") +print(corr_cal_eohi) + +# Export a single CSV combining all sets +corr_bs_eohi$group <- "BS_vs_EOHI" +corr_bs_cal$group <- "BS_vs_Cal" +corr_cal_eohi$group <- "Cal_vs_EOHI" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_cal_eohi) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - eohi x calibration_20250915134710.r b/.history/eohi1/correlations - eohi x calibration_20250915134710.r new file mode 100644 index 0000000..afe6d33 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915134710.r @@ -0,0 +1,304 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915134720.r b/.history/eohi1/correlations - eohi x calibration_20250915134720.r new file mode 100644 index 0000000..afe6d33 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915134720.r @@ -0,0 +1,304 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915134733.r b/.history/eohi1/correlations - eohi x calibration_20250915134733.r new file mode 100644 index 0000000..afe6d33 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915134733.r @@ -0,0 +1,304 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915134827.r b/.history/eohi1/correlations - eohi x calibration_20250915134827.r new file mode 100644 index 0000000..8b475bc --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915134827.r @@ -0,0 +1,306 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915134916.r b/.history/eohi1/correlations - eohi x calibration_20250915134916.r new file mode 100644 index 0000000..f8011c9 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915134916.r @@ -0,0 +1,307 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915142201.r b/.history/eohi1/correlations - eohi x calibration_20250915142201.r new file mode 100644 index 0000000..f8011c9 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915142201.r @@ -0,0 +1,307 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915142559.r b/.history/eohi1/correlations - eohi x calibration_20250915142559.r new file mode 100644 index 0000000..4a8461b --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915142559.r @@ -0,0 +1,307 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250915142603.r b/.history/eohi1/correlations - eohi x calibration_20250915142603.r new file mode 100644 index 0000000..4a8461b --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250915142603.r @@ -0,0 +1,307 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") + +####==== EFFECT SIZES (Cohen's conventions) ==== + +cat("\n=== EFFECT SIZE INTERPRETATION (Cohen's conventions) ===\n") +cat("Small effect: |r| = 0.10\n") +cat("Medium effect: |r| = 0.30\n") +cat("Large effect: |r| = 0.50\n") + +# Categorize effect sizes +summary_table_with_effects <- summary_table %>% + mutate( + pearson_effect_size = case_when( + abs(pearson_r) >= 0.50 ~ "Large", + abs(pearson_r) >= 0.30 ~ "Medium", + abs(pearson_r) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ), + spearman_effect_size = case_when( + abs(spearman_rho) >= 0.50 ~ "Large", + abs(spearman_rho) >= 0.30 ~ "Medium", + abs(spearman_rho) >= 0.10 ~ "Small", + TRUE ~ "Negligible" + ) + ) + +cat("\n=== EFFECT SIZE CATEGORIZATION ===\n") +print(summary_table_with_effects %>% select(eohi_var, cal_var, pearson_r, pearson_effect_size, spearman_rho, spearman_effect_size)) diff --git a/.history/eohi1/correlations - eohi x calibration_20250916091406.r b/.history/eohi1/correlations - eohi x calibration_20250916091406.r new file mode 100644 index 0000000..cc41f25 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916091406.r @@ -0,0 +1,280 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916091630.r b/.history/eohi1/correlations - eohi x calibration_20250916091630.r new file mode 100644 index 0000000..4f04efd --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916091630.r @@ -0,0 +1,280 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916092909.r b/.history/eohi1/correlations - eohi x calibration_20250916092909.r new file mode 100644 index 0000000..ee0dfa3 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916092909.r @@ -0,0 +1,307 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Debug mode - check distributions and outliers +browser() # This will pause execution and enter debug mode + +# Check for bimodal or unusual distributions +hist(df$eohi_pref, main = "EOHI Preference Distribution", xlab = "EOHI Preference") +hist(df$eohi_pers, main = "EOHI Personal Distribution", xlab = "EOHI Personal") +hist(df$eohi_val, main = "EOHI Value Distribution", xlab = "EOHI Value") +hist(df$eohi_life, main = "EOHI Life Distribution", xlab = "EOHI Life") + +# Check for extreme values +boxplot(df$eohi_pref, main = "EOHI Preference Boxplot") +boxplot(df$eohi_pers, main = "EOHI Personal Boxplot") +boxplot(df$eohi_val, main = "EOHI Value Boxplot") +boxplot(df$eohi_life, main = "EOHI Life Boxplot") + +# Check calibration variables +hist(df$cal_selfActual, main = "Calibration Self-Actual Distribution", xlab = "Calibration Self-Actual") +boxplot(df$cal_selfActual, main = "Calibration Self-Actual Boxplot") + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +boxplot(df$eohi_pref) +boxplot(df$cal_selfActual) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916092913.r b/.history/eohi1/correlations - eohi x calibration_20250916092913.r new file mode 100644 index 0000000..ff153e7 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916092913.r @@ -0,0 +1,303 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Debug mode - check distributions and outliers +browser() # This will pause execution and enter debug mode + +# Check for bimodal or unusual distributions +hist(df$eohi_pref, main = "EOHI Preference Distribution", xlab = "EOHI Preference") +hist(df$eohi_pers, main = "EOHI Personal Distribution", xlab = "EOHI Personal") +hist(df$eohi_val, main = "EOHI Value Distribution", xlab = "EOHI Value") +hist(df$eohi_life, main = "EOHI Life Distribution", xlab = "EOHI Life") + +# Check for extreme values +boxplot(df$eohi_pref, main = "EOHI Preference Boxplot") +boxplot(df$eohi_pers, main = "EOHI Personal Boxplot") +boxplot(df$eohi_val, main = "EOHI Value Boxplot") +boxplot(df$eohi_life, main = "EOHI Life Boxplot") + +# Check calibration variables +hist(df$cal_selfActual, main = "Calibration Self-Actual Distribution", xlab = "Calibration Self-Actual") +boxplot(df$cal_selfActual, main = "Calibration Self-Actual Boxplot") + +# Look for extreme values +boxplot(df$eohi_pref) +boxplot(df$cal_selfActual) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916092918.r b/.history/eohi1/correlations - eohi x calibration_20250916092918.r new file mode 100644 index 0000000..c15d5da --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916092918.r @@ -0,0 +1,299 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Debug mode - check distributions and outliers +browser() # This will pause execution and enter debug mode + +# Check for bimodal or unusual distributions +hist(df$eohi_pref, main = "EOHI Preference Distribution", xlab = "EOHI Preference") +hist(df$eohi_pers, main = "EOHI Personal Distribution", xlab = "EOHI Personal") +hist(df$eohi_val, main = "EOHI Value Distribution", xlab = "EOHI Value") +hist(df$eohi_life, main = "EOHI Life Distribution", xlab = "EOHI Life") + +# Check for extreme values +boxplot(df$eohi_pref, main = "EOHI Preference Boxplot") +boxplot(df$eohi_pers, main = "EOHI Personal Boxplot") +boxplot(df$eohi_val, main = "EOHI Value Boxplot") +boxplot(df$eohi_life, main = "EOHI Life Boxplot") + +# Check calibration variables +hist(df$cal_selfActual, main = "Calibration Self-Actual Distribution", xlab = "Calibration Self-Actual") +boxplot(df$cal_selfActual, main = "Calibration Self-Actual Boxplot") + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916092925.r b/.history/eohi1/correlations - eohi x calibration_20250916092925.r new file mode 100644 index 0000000..c15d5da --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916092925.r @@ -0,0 +1,299 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Debug mode - check distributions and outliers +browser() # This will pause execution and enter debug mode + +# Check for bimodal or unusual distributions +hist(df$eohi_pref, main = "EOHI Preference Distribution", xlab = "EOHI Preference") +hist(df$eohi_pers, main = "EOHI Personal Distribution", xlab = "EOHI Personal") +hist(df$eohi_val, main = "EOHI Value Distribution", xlab = "EOHI Value") +hist(df$eohi_life, main = "EOHI Life Distribution", xlab = "EOHI Life") + +# Check for extreme values +boxplot(df$eohi_pref, main = "EOHI Preference Boxplot") +boxplot(df$eohi_pers, main = "EOHI Personal Boxplot") +boxplot(df$eohi_val, main = "EOHI Value Boxplot") +boxplot(df$eohi_life, main = "EOHI Life Boxplot") + +# Check calibration variables +hist(df$cal_selfActual, main = "Calibration Self-Actual Distribution", xlab = "Calibration Self-Actual") +boxplot(df$cal_selfActual, main = "Calibration Self-Actual Boxplot") + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916092959.r b/.history/eohi1/correlations - eohi x calibration_20250916092959.r new file mode 100644 index 0000000..0aa75f4 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916092959.r @@ -0,0 +1,288 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +boxplot(df$eohi_pref) +boxplot(df$cal_selfActual) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916093530.r b/.history/eohi1/correlations - eohi x calibration_20250916093530.r new file mode 100644 index 0000000..095291b --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916093530.r @@ -0,0 +1,288 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916095303.r b/.history/eohi1/correlations - eohi x calibration_20250916095303.r new file mode 100644 index 0000000..095291b --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916095303.r @@ -0,0 +1,288 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916112614.r b/.history/eohi1/correlations - eohi x calibration_20250916112614.r new file mode 100644 index 0000000..1cf4f42 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916112614.r @@ -0,0 +1,303 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +# Test normality for each variable +library(nortest) + +# Test EOHI variables +for(var in eohi_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +# Test calibration variables +for(var in cal_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916112923.r b/.history/eohi1/correlations - eohi x calibration_20250916112923.r new file mode 100644 index 0000000..1cf4f42 --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916112923.r @@ -0,0 +1,303 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +# Test normality for each variable +library(nortest) + +# Test EOHI variables +for(var in eohi_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +# Test calibration variables +for(var in cal_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250916113008.r b/.history/eohi1/correlations - eohi x calibration_20250916113008.r new file mode 100644 index 0000000..a99d62f --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250916113008.r @@ -0,0 +1,303 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +# Test normality for each variable - probably unnecessary +library(nortest) + +# Test EOHI variables +for(var in eohi_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +# Test calibration variables +for(var in cal_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - eohi x calibration_20250929153154.r b/.history/eohi1/correlations - eohi x calibration_20250929153154.r new file mode 100644 index 0000000..a99d62f --- /dev/null +++ b/.history/eohi1/correlations - eohi x calibration_20250929153154.r @@ -0,0 +1,303 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +# Test normality for each variable - probably unnecessary +library(nortest) + +# Test EOHI variables +for(var in eohi_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +# Test calibration variables +for(var in cal_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/.history/eohi1/correlations - scales_20251007231341.r b/.history/eohi1/correlations - scales_20251007231341.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/correlations - scales_20251007232519.r b/.history/eohi1/correlations - scales_20251007232519.r new file mode 100644 index 0000000..4923146 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007232519.r @@ -0,0 +1,4 @@ + + +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007232812.r b/.history/eohi1/correlations - scales_20251007232812.r new file mode 100644 index 0000000..08bcbc3 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007232812.r @@ -0,0 +1,2 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233020.r b/.history/eohi1/correlations - scales_20251007233020.r new file mode 100644 index 0000000..2b573bf --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233020.r @@ -0,0 +1,74 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# Remove rows with any missing values +correlation_data <- na.omit(correlation_data) + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrix +cor_matrix <- cor(correlation_data, use = "complete.obs") + +# Print correlation matrix with 5 decimal places +cat("Correlation Matrix:\n") +print(round(cor_matrix, 5)) + +# Separate correlations between the two sets +set1_set2_cor <- cor_matrix[set1_vars, set2_vars] + +cat("\nCorrelations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive):\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set +set1_within_cor <- cor_matrix[set1_vars, set1_vars] +set2_within_cor <- cor_matrix[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233026.r b/.history/eohi1/correlations - scales_20251007233026.r new file mode 100644 index 0000000..2b573bf --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233026.r @@ -0,0 +1,74 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# Remove rows with any missing values +correlation_data <- na.omit(correlation_data) + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrix +cor_matrix <- cor(correlation_data, use = "complete.obs") + +# Print correlation matrix with 5 decimal places +cat("Correlation Matrix:\n") +print(round(cor_matrix, 5)) + +# Separate correlations between the two sets +set1_set2_cor <- cor_matrix[set1_vars, set2_vars] + +cat("\nCorrelations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive):\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set +set1_within_cor <- cor_matrix[set1_vars, set1_vars] +set2_within_cor <- cor_matrix[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233050.r b/.history/eohi1/correlations - scales_20251007233050.r new file mode 100644 index 0000000..213f481 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233050.r @@ -0,0 +1,71 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrix +cor_matrix <- cor(correlation_data) + +# Print correlation matrix with 5 decimal places +cat("Correlation Matrix:\n") +print(round(cor_matrix, 5)) + +# Separate correlations between the two sets +set1_set2_cor <- cor_matrix[set1_vars, set2_vars] + +cat("\nCorrelations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive):\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set +set1_within_cor <- cor_matrix[set1_vars, set1_vars] +set2_within_cor <- cor_matrix[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233059.r b/.history/eohi1/correlations - scales_20251007233059.r new file mode 100644 index 0000000..213f481 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233059.r @@ -0,0 +1,71 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrix +cor_matrix <- cor(correlation_data) + +# Print correlation matrix with 5 decimal places +cat("Correlation Matrix:\n") +print(round(cor_matrix, 5)) + +# Separate correlations between the two sets +set1_set2_cor <- cor_matrix[set1_vars, set2_vars] + +cat("\nCorrelations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive):\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set +set1_within_cor <- cor_matrix[set1_vars, set1_vars] +set2_within_cor <- cor_matrix[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233106.r b/.history/eohi1/correlations - scales_20251007233106.r new file mode 100644 index 0000000..213f481 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233106.r @@ -0,0 +1,71 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrix +cor_matrix <- cor(correlation_data) + +# Print correlation matrix with 5 decimal places +cat("Correlation Matrix:\n") +print(round(cor_matrix, 5)) + +# Separate correlations between the two sets +set1_set2_cor <- cor_matrix[set1_vars, set2_vars] + +cat("\nCorrelations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive):\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set +set1_within_cor <- cor_matrix[set1_vars, set1_vars] +set2_within_cor <- cor_matrix[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233151.r b/.history/eohi1/correlations - scales_20251007233151.r new file mode 100644 index 0000000..7691c31 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233151.r @@ -0,0 +1,72 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +cat("Correlation Matrix:\n") +print(round(cor_matrix, 5)) + +# Separate correlations between the two sets +set1_set2_cor <- cor_matrix[set1_vars, set2_vars] + +cat("\nCorrelations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive):\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set +set1_within_cor <- cor_matrix[set1_vars, set1_vars] +set2_within_cor <- cor_matrix[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233159.r b/.history/eohi1/correlations - scales_20251007233159.r new file mode 100644 index 0000000..40a2b40 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233159.r @@ -0,0 +1,80 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method (more robust for cognitive data) +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +cat("=== SPEARMAN CORRELATIONS (Primary Analysis) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_spearman, 5)) + +cat("\n=== PEARSON CORRELATIONS (Comparison) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_pearson, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] + +cat("\n=== SPEARMAN: Correlations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive) ===\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests +cat("\nStatistical significance tests (p-values):\n") +cor_test_results <- rcorr(as.matrix(correlation_data)) + +cat("\nP-values for Set 1 vs Set 2 correlations:\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot +pdf("correlation_plot_scales.pdf", width = 10, height = 8) +corrplot(cor_matrix, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233210.r b/.history/eohi1/correlations - scales_20251007233210.r new file mode 100644 index 0000000..96e6a92 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233210.r @@ -0,0 +1,87 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method (more robust for cognitive data) +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +cat("=== SPEARMAN CORRELATIONS (Primary Analysis) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_spearman, 5)) + +cat("\n=== PEARSON CORRELATIONS (Comparison) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_pearson, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] + +cat("\n=== SPEARMAN: Correlations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive) ===\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests (Spearman) +cat("\n=== SPEARMAN: Statistical significance tests (p-values) ===\n") +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +cat("\nP-values for Set 1 vs Set 2 correlations (Spearman):\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\nAnalysis completed. Correlation plot saved as 'correlation_plot_scales.pdf'\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233219.r b/.history/eohi1/correlations - scales_20251007233219.r new file mode 100644 index 0000000..2731c68 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233219.r @@ -0,0 +1,95 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method (more robust for cognitive data) +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +cat("=== SPEARMAN CORRELATIONS (Primary Analysis) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_spearman, 5)) + +cat("\n=== PEARSON CORRELATIONS (Comparison) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_pearson, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] + +cat("\n=== SPEARMAN: Correlations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive) ===\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests (Spearman) +cat("\n=== SPEARMAN: Statistical significance tests (p-values) ===\n") +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +cat("\nP-values for Set 1 vs Set 2 correlations (Spearman):\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\n=== ANALYSIS COMPLETED ===\n") +cat("Spearman correlations are recommended for this analysis due to:\n") +cat("- Non-parametric nature (no distribution assumptions)\n") +cat("- Robustness to outliers and non-linear relationships\n") +cat("- Better suitability for cognitive measures\n\n") +cat("Output files created:\n") +cat("- correlation_plot_scales_spearman.pdf (primary analysis)\n") +cat("- correlation_plot_scales_pearson.pdf (comparison)\n") +cat("\nSpearman correlations are reported as the primary analysis.\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233224.r b/.history/eohi1/correlations - scales_20251007233224.r new file mode 100644 index 0000000..2731c68 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233224.r @@ -0,0 +1,95 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +cat("Sample size for correlations:", nrow(correlation_data), "\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method (more robust for cognitive data) +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +cat("=== SPEARMAN CORRELATIONS (Primary Analysis) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_spearman, 5)) + +cat("\n=== PEARSON CORRELATIONS (Comparison) ===\n") +cat("Correlation Matrix:\n") +print(round(cor_matrix_pearson, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] + +cat("\n=== SPEARMAN: Correlations between Set 1 (EOHI/DGEN) and Set 2 (Cognitive) ===\n") +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +cat("\nWithin Set 1 correlations (EOHI/DGEN):\n") +print(round(set1_within_cor, 5)) + +cat("\nWithin Set 2 correlations (Cognitive):\n") +print(round(set2_within_cor, 5)) + +# Statistical significance tests (Spearman) +cat("\n=== SPEARMAN: Statistical significance tests (p-values) ===\n") +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +cat("\nP-values for Set 1 vs Set 2 correlations (Spearman):\n") +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\n=== ANALYSIS COMPLETED ===\n") +cat("Spearman correlations are recommended for this analysis due to:\n") +cat("- Non-parametric nature (no distribution assumptions)\n") +cat("- Robustness to outliers and non-linear relationships\n") +cat("- Better suitability for cognitive measures\n\n") +cat("Output files created:\n") +cat("- correlation_plot_scales_spearman.pdf (primary analysis)\n") +cat("- correlation_plot_scales_pearson.pdf (comparison)\n") +cat("\nSpearman correlations are reported as the primary analysis.\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233307.r b/.history/eohi1/correlations - scales_20251007233307.r new file mode 100644 index 0000000..7c17c5e --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233307.r @@ -0,0 +1,77 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +cat("\nDescriptive Statistics:\n") +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +cat("\n=== ANALYSIS COMPLETED ===\n") +cat("Spearman correlations are recommended for this analysis due to:\n") +cat("- Non-parametric nature (no distribution assumptions)\n") +cat("- Robustness to outliers and non-linear relationships\n") +cat("- Better suitability for cognitive measures\n\n") +cat("Output files created:\n") +cat("- correlation_plot_scales_spearman.pdf (primary analysis)\n") +cat("- correlation_plot_scales_pearson.pdf (comparison)\n") +cat("\nSpearman correlations are reported as the primary analysis.\n") \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233311.r b/.history/eohi1/correlations - scales_20251007233311.r new file mode 100644 index 0000000..42f68c2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233311.r @@ -0,0 +1,66 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233319.r b/.history/eohi1/correlations - scales_20251007233319.r new file mode 100644 index 0000000..42f68c2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233319.r @@ -0,0 +1,66 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233424.r b/.history/eohi1/correlations - scales_20251007233424.r new file mode 100644 index 0000000..42f68c2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233424.r @@ -0,0 +1,66 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233541.r b/.history/eohi1/correlations - scales_20251007233541.r new file mode 100644 index 0000000..c4f764e --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233541.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +cat("=== NORMALITY DIAGNOSTICS ===\n") +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } else { + cat(sprintf("%s: Sample too large for Shapiro-Wilk test\n", var)) + } +} + +# Kolmogorov-Smirnov test for normality +cat("\nKolmogorov-Smirnov tests:\n") +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +cat("\n=== LINEARITY DIAGNOSTICS ===\n") +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +cat("\nResidual Analysis (checking for non-linear patterns):\n") +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + +cat("\n=== INTERPRETATION GUIDE ===\n") +cat("NORMALITY: p < 0.05 = NOT normal (use Spearman)\n") +cat("LINEARITY: R² < 0.7 = weak linear relationship (consider Spearman)\n") +cat("Check plots for: curved patterns, outliers, non-normal distributions\n") +cat("Files created: normality_plots.pdf, linearity_plots.pdf, residual_plots.pdf\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233548.r b/.history/eohi1/correlations - scales_20251007233548.r new file mode 100644 index 0000000..c4f764e --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233548.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +cat("=== NORMALITY DIAGNOSTICS ===\n") +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } else { + cat(sprintf("%s: Sample too large for Shapiro-Wilk test\n", var)) + } +} + +# Kolmogorov-Smirnov test for normality +cat("\nKolmogorov-Smirnov tests:\n") +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +cat("\n=== LINEARITY DIAGNOSTICS ===\n") +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +cat("\nResidual Analysis (checking for non-linear patterns):\n") +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + +cat("\n=== INTERPRETATION GUIDE ===\n") +cat("NORMALITY: p < 0.05 = NOT normal (use Spearman)\n") +cat("LINEARITY: R² < 0.7 = weak linear relationship (consider Spearman)\n") +cat("Check plots for: curved patterns, outliers, non-normal distributions\n") +cat("Files created: normality_plots.pdf, linearity_plots.pdf, residual_plots.pdf\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233652.r b/.history/eohi1/correlations - scales_20251007233652.r new file mode 100644 index 0000000..c4f764e --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233652.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +cat("=== NORMALITY DIAGNOSTICS ===\n") +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } else { + cat(sprintf("%s: Sample too large for Shapiro-Wilk test\n", var)) + } +} + +# Kolmogorov-Smirnov test for normality +cat("\nKolmogorov-Smirnov tests:\n") +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +cat("\n=== LINEARITY DIAGNOSTICS ===\n") +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +cat("\nResidual Analysis (checking for non-linear patterns):\n") +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + +cat("\n=== INTERPRETATION GUIDE ===\n") +cat("NORMALITY: p < 0.05 = NOT normal (use Spearman)\n") +cat("LINEARITY: R² < 0.7 = weak linear relationship (consider Spearman)\n") +cat("Check plots for: curved patterns, outliers, non-normal distributions\n") +cat("Files created: normality_plots.pdf, linearity_plots.pdf, residual_plots.pdf\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233731.r b/.history/eohi1/correlations - scales_20251007233731.r new file mode 100644 index 0000000..6df4dcf --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233731.r @@ -0,0 +1,167 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +cat("\n=== LINEARITY DIAGNOSTICS ===\n") +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +cat("\nResidual Analysis (checking for non-linear patterns):\n") +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + +cat("\n=== INTERPRETATION GUIDE ===\n") +cat("NORMALITY: p < 0.05 = NOT normal (use Spearman)\n") +cat("LINEARITY: R² < 0.7 = weak linear relationship (consider Spearman)\n") +cat("Check plots for: curved patterns, outliers, non-normal distributions\n") +cat("Files created: normality_plots.pdf, linearity_plots.pdf, residual_plots.pdf\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233734.r b/.history/eohi1/correlations - scales_20251007233734.r new file mode 100644 index 0000000..c8c34ea --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233734.r @@ -0,0 +1,166 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +cat("\nResidual Analysis (checking for non-linear patterns):\n") +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + +cat("\n=== INTERPRETATION GUIDE ===\n") +cat("NORMALITY: p < 0.05 = NOT normal (use Spearman)\n") +cat("LINEARITY: R² < 0.7 = weak linear relationship (consider Spearman)\n") +cat("Check plots for: curved patterns, outliers, non-normal distributions\n") +cat("Files created: normality_plots.pdf, linearity_plots.pdf, residual_plots.pdf\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233736.r b/.history/eohi1/correlations - scales_20251007233736.r new file mode 100644 index 0000000..c47abbd --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233736.r @@ -0,0 +1,165 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + +cat("\n=== INTERPRETATION GUIDE ===\n") +cat("NORMALITY: p < 0.05 = NOT normal (use Spearman)\n") +cat("LINEARITY: R² < 0.7 = weak linear relationship (consider Spearman)\n") +cat("Check plots for: curved patterns, outliers, non-normal distributions\n") +cat("Files created: normality_plots.pdf, linearity_plots.pdf, residual_plots.pdf\n\n") + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233739.r b/.history/eohi1/correlations - scales_20251007233739.r new file mode 100644 index 0000000..7e178c8 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233739.r @@ -0,0 +1,160 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233744.r b/.history/eohi1/correlations - scales_20251007233744.r new file mode 100644 index 0000000..7e178c8 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233744.r @@ -0,0 +1,160 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007233749.r b/.history/eohi1/correlations - scales_20251007233749.r new file mode 100644 index 0000000..7e178c8 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007233749.r @@ -0,0 +1,160 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007234152.r b/.history/eohi1/correlations - scales_20251007234152.r new file mode 100644 index 0000000..a158a21 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007234152.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_results_formatted.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007234202.r b/.history/eohi1/correlations - scales_20251007234202.r new file mode 100644 index 0000000..a158a21 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007234202.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_results_formatted.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007234339.r b/.history/eohi1/correlations - scales_20251007234339.r new file mode 100644 index 0000000..a158a21 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007234339.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_results_formatted.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251007234406.r b/.history/eohi1/correlations - scales_20251007234406.r new file mode 100644 index 0000000..5c44871 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251007234406.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008001047.r b/.history/eohi1/correlations - scales_20251008001047.r new file mode 100644 index 0000000..d8606fe --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008001047.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean", "domain_mean", "DGEN_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008001054.r b/.history/eohi1/correlations - scales_20251008001054.r new file mode 100644 index 0000000..d8606fe --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008001054.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean", "domain_mean", "DGEN_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008001102.r b/.history/eohi1/correlations - scales_20251008001102.r new file mode 100644 index 0000000..d8606fe --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008001102.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean", "domain_mean", "DGEN_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008005438.r b/.history/eohi1/correlations - scales_20251008005438.r new file mode 100644 index 0000000..d8606fe --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008005438.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean", "domain_mean", "DGEN_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008154804.r b/.history/eohi1/correlations - scales_20251008154804.r new file mode 100644 index 0000000..d8606fe --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008154804.r @@ -0,0 +1,194 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_mean_total", "NFut_mean_total", "DGEN_past_mean", "DGEN_fut_mean", "domain_mean", "DGEN_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008154934.r b/.history/eohi1/correlations - scales_20251008154934.r new file mode 100644 index 0000000..e034766 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008154934.r @@ -0,0 +1,195 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008154940.r b/.history/eohi1/correlations - scales_20251008154940.r new file mode 100644 index 0000000..96f47d2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008154940.r @@ -0,0 +1,191 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_scales_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008154947.r b/.history/eohi1/correlations - scales_20251008154947.r new file mode 100644 index 0000000..7678af9 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008154947.r @@ -0,0 +1,184 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008154952.r b/.history/eohi1/correlations - scales_20251008154952.r new file mode 100644 index 0000000..31a10e3 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008154952.r @@ -0,0 +1,183 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155000.r b/.history/eohi1/correlations - scales_20251008155000.r new file mode 100644 index 0000000..31a10e3 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155000.r @@ -0,0 +1,183 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155103.r b/.history/eohi1/correlations - scales_20251008155103.r new file mode 100644 index 0000000..31a10e3 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155103.r @@ -0,0 +1,183 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155139.r b/.history/eohi1/correlations - scales_20251008155139.r new file mode 100644 index 0000000..8a936df --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155139.r @@ -0,0 +1,183 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155218.r b/.history/eohi1/correlations - scales_20251008155218.r new file mode 100644 index 0000000..048bbb2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155218.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155221.r b/.history/eohi1/correlations - scales_20251008155221.r new file mode 100644 index 0000000..048bbb2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155221.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155223.r b/.history/eohi1/correlations - scales_20251008155223.r new file mode 100644 index 0000000..048bbb2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155223.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008155225.r b/.history/eohi1/correlations - scales_20251008155225.r new file mode 100644 index 0000000..048bbb2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008155225.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/correlations - scales_20251008171710.r b/.history/eohi1/correlations - scales_20251008171710.r new file mode 100644 index 0000000..048bbb2 --- /dev/null +++ b/.history/eohi1/correlations - scales_20251008171710.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000048.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000048.r new file mode 100644 index 0000000..490ab62 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000048.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the NPastDiff variables by domain +nPastDiff_pref <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel") +nPastDiff_pers <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex") +nPastDiff_val <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice") +nPastDiff_life <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change") + +# Define the NFutDiff variables by domain +nFutDiff_pref <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") +nFutDiff_pers <- c("NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") +nFutDiff_val <- c("NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice") +nFutDiff_life <- c("NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change") + +# Calculate domain means for NPastDiff +exp1_data$NPastDiff_pref_mean <- rowMeans(exp1_data[, nPastDiff_pref], na.rm = TRUE) +exp1_data$NPastDiff_pers_mean <- rowMeans(exp1_data[, nPastDiff_pers], na.rm = TRUE) +exp1_data$NPastDiff_val_mean <- rowMeans(exp1_data[, nPastDiff_val], na.rm = TRUE) +exp1_data$NPastDiff_life_mean <- rowMeans(exp1_data[, nPastDiff_life], na.rm = TRUE) + +# Calculate domain means for NFutDiff +exp1_data$NFutDiff_pref_mean <- rowMeans(exp1_data[, nFutDiff_pref], na.rm = TRUE) +exp1_data$NFutDiff_pers_mean <- rowMeans(exp1_data[, nFutDiff_pers], na.rm = TRUE) +exp1_data$NFutDiff_val_mean <- rowMeans(exp1_data[, nFutDiff_val], na.rm = TRUE) +exp1_data$NFutDiff_life_mean <- rowMeans(exp1_data[, nFutDiff_life], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain means +cat("NPastDiff domain means summary:\n") +summary(exp1_data[, c("NPastDiff_pref_mean", "NPastDiff_pers_mean", "NPastDiff_val_mean", "NPastDiff_life_mean")]) + +cat("\nNFutDiff domain means summary:\n") +summary(exp1_data[, c("NFutDiff_pref_mean", "NFutDiff_pers_mean", "NFutDiff_val_mean", "NFutDiff_life_mean")]) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain means:\n") +domain_means_cols <- c("NPastDiff_pref_mean", "NPastDiff_pers_mean", "NPastDiff_val_mean", "NPastDiff_life_mean", + "NFutDiff_pref_mean", "NFutDiff_pers_mean", "NFutDiff_val_mean", "NFutDiff_life_mean") +print(exp1_data[1:5, domain_means_cols]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000055.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000055.r new file mode 100644 index 0000000..490ab62 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000055.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define the NPastDiff variables by domain +nPastDiff_pref <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel") +nPastDiff_pers <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex") +nPastDiff_val <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice") +nPastDiff_life <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change") + +# Define the NFutDiff variables by domain +nFutDiff_pref <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") +nFutDiff_pers <- c("NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") +nFutDiff_val <- c("NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice") +nFutDiff_life <- c("NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change") + +# Calculate domain means for NPastDiff +exp1_data$NPastDiff_pref_mean <- rowMeans(exp1_data[, nPastDiff_pref], na.rm = TRUE) +exp1_data$NPastDiff_pers_mean <- rowMeans(exp1_data[, nPastDiff_pers], na.rm = TRUE) +exp1_data$NPastDiff_val_mean <- rowMeans(exp1_data[, nPastDiff_val], na.rm = TRUE) +exp1_data$NPastDiff_life_mean <- rowMeans(exp1_data[, nPastDiff_life], na.rm = TRUE) + +# Calculate domain means for NFutDiff +exp1_data$NFutDiff_pref_mean <- rowMeans(exp1_data[, nFutDiff_pref], na.rm = TRUE) +exp1_data$NFutDiff_pers_mean <- rowMeans(exp1_data[, nFutDiff_pers], na.rm = TRUE) +exp1_data$NFutDiff_val_mean <- rowMeans(exp1_data[, nFutDiff_val], na.rm = TRUE) +exp1_data$NFutDiff_life_mean <- rowMeans(exp1_data[, nFutDiff_life], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain means +cat("NPastDiff domain means summary:\n") +summary(exp1_data[, c("NPastDiff_pref_mean", "NPastDiff_pers_mean", "NPastDiff_val_mean", "NPastDiff_life_mean")]) + +cat("\nNFutDiff domain means summary:\n") +summary(exp1_data[, c("NFutDiff_pref_mean", "NFutDiff_pers_mean", "NFutDiff_val_mean", "NFutDiff_life_mean")]) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain means:\n") +domain_means_cols <- c("NPastDiff_pref_mean", "NPastDiff_pers_mean", "NPastDiff_val_mean", "NPastDiff_life_mean", + "NFutDiff_pref_mean", "NFutDiff_pers_mean", "NFutDiff_val_mean", "NFutDiff_life_mean") +print(exp1_data[1:5, domain_means_cols]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000150.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000150.r new file mode 100644 index 0000000..4fb2e07 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000150.r @@ -0,0 +1,36 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain means +cat("NPastDiff domain means summary:\n") +summary(exp1_data[, c("NPastDiff_pref_mean", "NPastDiff_pers_mean", "NPastDiff_val_mean", "NPastDiff_life_mean")]) + +cat("\nNFutDiff domain means summary:\n") +summary(exp1_data[, c("NFutDiff_pref_mean", "NFutDiff_pers_mean", "NFutDiff_val_mean", "NFutDiff_life_mean")]) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain means:\n") +domain_means_cols <- c("NPastDiff_pref_mean", "NPastDiff_pers_mean", "NPastDiff_val_mean", "NPastDiff_life_mean", + "NFutDiff_pref_mean", "NFutDiff_pers_mean", "NFutDiff_val_mean", "NFutDiff_life_mean") +print(exp1_data[1:5, domain_means_cols]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000158.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000158.r new file mode 100644 index 0000000..e310370 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000158.r @@ -0,0 +1,31 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain_mean +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain_mean:\n") +print(exp1_data[1:5, "domain_mean"]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000203.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000203.r new file mode 100644 index 0000000..e310370 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000203.r @@ -0,0 +1,31 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain_mean +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain_mean:\n") +print(exp1_data[1:5, "domain_mean"]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000212.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000212.r new file mode 100644 index 0000000..e310370 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000212.r @@ -0,0 +1,31 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain_mean +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain_mean:\n") +print(exp1_data[1:5, "domain_mean"]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000542.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000542.r new file mode 100644 index 0000000..8049c0a --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000542.r @@ -0,0 +1,38 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Define DGEN variables to average +dgen_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Calculate DGEN_mean as average of all 8 DGEN variables +exp1_data$DGEN_mean <- rowMeans(exp1_data[, dgen_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated domain_mean +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated domain_mean:\n") +print(exp1_data[1:5, "domain_mean"]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000547.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000547.r new file mode 100644 index 0000000..5a65108 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000547.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Define DGEN variables to average +dgen_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Calculate DGEN_mean as average of all 8 DGEN variables +exp1_data$DGEN_mean <- rowMeans(exp1_data[, dgen_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated means +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +cat("\nDGEN mean summary (average of all 8 DGEN variables):\n") +summary(exp1_data$DGEN_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated means:\n") +print(exp1_data[1:5, c("domain_mean", "DGEN_mean")]) + +# Show the individual DGEN values for first 5 rows to verify math +cat("\nFirst 5 rows of individual DGEN values for verification:\n") +print(exp1_data[1:5, dgen_vars]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000552.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000552.r new file mode 100644 index 0000000..5a65108 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000552.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Define DGEN variables to average +dgen_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Calculate DGEN_mean as average of all 8 DGEN variables +exp1_data$DGEN_mean <- rowMeans(exp1_data[, dgen_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated means +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +cat("\nDGEN mean summary (average of all 8 DGEN variables):\n") +summary(exp1_data$DGEN_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated means:\n") +print(exp1_data[1:5, c("domain_mean", "DGEN_mean")]) + +# Show the individual DGEN values for first 5 rows to verify math +cat("\nFirst 5 rows of individual DGEN values for verification:\n") +print(exp1_data[1:5, dgen_vars]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000600.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000600.r new file mode 100644 index 0000000..5a65108 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000600.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Define DGEN variables to average +dgen_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Calculate DGEN_mean as average of all 8 DGEN variables +exp1_data$DGEN_mean <- rowMeans(exp1_data[, dgen_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated means +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +cat("\nDGEN mean summary (average of all 8 DGEN variables):\n") +summary(exp1_data$DGEN_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated means:\n") +print(exp1_data[1:5, c("domain_mean", "DGEN_mean")]) + +# Show the individual DGEN values for first 5 rows to verify math +cat("\nFirst 5 rows of individual DGEN values for verification:\n") +print(exp1_data[1:5, dgen_vars]) diff --git a/.history/eohi1/dataP 02 - cor means average over time frames_20251008000956.r b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000956.r new file mode 100644 index 0000000..5a65108 --- /dev/null +++ b/.history/eohi1/dataP 02 - cor means average over time frames_20251008000956.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Define DGEN variables to average +dgen_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Calculate DGEN_mean as average of all 8 DGEN variables +exp1_data$DGEN_mean <- rowMeans(exp1_data[, dgen_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated means +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +cat("\nDGEN mean summary (average of all 8 DGEN variables):\n") +summary(exp1_data$DGEN_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated means:\n") +print(exp1_data[1:5, c("domain_mean", "DGEN_mean")]) + +# Show the individual DGEN values for first 5 rows to verify math +cat("\nFirst 5 rows of individual DGEN values for verification:\n") +print(exp1_data[1:5, dgen_vars]) diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008152448.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008152448.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008152542.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008152542.r new file mode 100644 index 0000000..08bcbc3 --- /dev/null +++ b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008152542.r @@ -0,0 +1,2 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") \ No newline at end of file diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153309.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153309.r new file mode 100644 index 0000000..8980819 --- /dev/null +++ b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153309.r @@ -0,0 +1,104 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Create EHI difference variables (NPast - NFut) +# Preferences +ehi1$ehi_pref_read <- ehi1$NPastDiff_pref_read - ehi1$NFutDiff_pref_read +ehi1$ehi_pref_music <- ehi1$NPastDiff_pref_music - ehi1$NFutDiff_pref_music +ehi1$ehi_pref_tv <- ehi1$NPastDiff_pref_tv - ehi1$NFutDiff_pref_tv +ehi1$ehi_pref_nap <- ehi1$NPastDiff_pref_nap - ehi1$NFutDiff_pref_nap +ehi1$ehi_pref_travel <- ehi1$NPastDiff_pref_travel - ehi1$NFutDiff_pref_travel + +# Personality +ehi1$ehi_pers_extravert <- ehi1$NPastDiff_pers_extravert - ehi1$NFutDiff_pers_extravert +ehi1$ehi_pers_critical <- ehi1$NPastDiff_pers_critical - ehi1$NFutDiff_pers_critical +ehi1$ehi_pers_dependable <- ehi1$NPastDiff_pers_dependable - ehi1$NFutDiff_pers_dependable +ehi1$ehi_pers_anxious <- ehi1$NPastDiff_pers_anxious - ehi1$NFutDiff_pers_anxious +ehi1$ehi_pers_complex <- ehi1$NPastDiff_pers_complex - ehi1$NFutDiff_pers_complex + +# Values +ehi1$ehi_val_obey <- ehi1$NPastDiff_val_obey - ehi1$NFutDiff_val_obey +ehi1$ehi_val_trad <- ehi1$NPastDiff_val_trad - ehi1$NFutDiff_val_trad +ehi1$ehi_val_opinion <- ehi1$NPastDiff_val_opinion - ehi1$NFutDiff_val_opinion +ehi1$ehi_val_performance <- ehi1$NPastDiff_val_performance - ehi1$NFutDiff_val_performance +ehi1$ehi_val_justice <- ehi1$NPastDiff_val_justice - ehi1$NFutDiff_val_justice + +# Life satisfaction +ehi1$ehi_life_ideal <- ehi1$NPastDiff_life_ideal - ehi1$NFutDiff_life_ideal +ehi1$ehi_life_excellent <- ehi1$NPastDiff_life_excellent - ehi1$NFutDiff_life_excellent +ehi1$ehi_life_satisfied <- ehi1$NPastDiff_life_satisfied - ehi1$NFutDiff_life_satisfied +ehi1$ehi_life_important <- ehi1$NPastDiff_life_important - ehi1$NFutDiff_life_important +ehi1$ehi_life_change <- ehi1$NPastDiff_life_change - ehi1$NFutDiff_life_change + +# QA: Verify calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI difference calculations (NPast - NFut)\n\n") + +qa_pairs <- list( + list(npast = "NPastDiff_pref_read", nfut = "NFutDiff_pref_read", target = "ehi_pref_read"), + list(npast = "NPastDiff_pref_music", nfut = "NFutDiff_pref_music", target = "ehi_pref_music"), + list(npast = "NPastDiff_pref_tv", nfut = "NFutDiff_pref_tv", target = "ehi_pref_tv"), + list(npast = "NPastDiff_pref_nap", nfut = "NFutDiff_pref_nap", target = "ehi_pref_nap"), + list(npast = "NPastDiff_pref_travel", nfut = "NFutDiff_pref_travel", target = "ehi_pref_travel"), + list(npast = "NPastDiff_pers_extravert", nfut = "NFutDiff_pers_extravert", target = "ehi_pers_extravert"), + list(npast = "NPastDiff_pers_critical", nfut = "NFutDiff_pers_critical", target = "ehi_pers_critical"), + list(npast = "NPastDiff_pers_dependable", nfut = "NFutDiff_pers_dependable", target = "ehi_pers_dependable"), + list(npast = "NPastDiff_pers_anxious", nfut = "NFutDiff_pers_anxious", target = "ehi_pers_anxious"), + list(npast = "NPastDiff_pers_complex", nfut = "NFutDiff_pers_complex", target = "ehi_pers_complex"), + list(npast = "NPastDiff_val_obey", nfut = "NFutDiff_val_obey", target = "ehi_val_obey"), + list(npast = "NPastDiff_val_trad", nfut = "NFutDiff_val_trad", target = "ehi_val_trad"), + list(npast = "NPastDiff_val_opinion", nfut = "NFutDiff_val_opinion", target = "ehi_val_opinion"), + list(npast = "NPastDiff_val_performance", nfut = "NFutDiff_val_performance", target = "ehi_val_performance"), + list(npast = "NPastDiff_val_justice", nfut = "NFutDiff_val_justice", target = "ehi_val_justice"), + list(npast = "NPastDiff_life_ideal", nfut = "NFutDiff_life_ideal", target = "ehi_life_ideal"), + list(npast = "NPastDiff_life_excellent", nfut = "NFutDiff_life_excellent", target = "ehi_life_excellent"), + list(npast = "NPastDiff_life_satisfied", nfut = "NFutDiff_life_satisfied", target = "ehi_life_satisfied"), + list(npast = "NPastDiff_life_important", nfut = "NFutDiff_life_important", target = "ehi_life_important"), + list(npast = "NPastDiff_life_change", nfut = "NFutDiff_life_change", target = "ehi_life_change") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- ehi1[[pair$npast]] - ehi1[[pair$nfut]] + + # Get actual value in target variable + actual_value <- ehi1[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, ehi1[[pair$npast]][row_num], + pair$nfut, ehi1[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153323.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153323.r new file mode 100644 index 0000000..8980819 --- /dev/null +++ b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153323.r @@ -0,0 +1,104 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Create EHI difference variables (NPast - NFut) +# Preferences +ehi1$ehi_pref_read <- ehi1$NPastDiff_pref_read - ehi1$NFutDiff_pref_read +ehi1$ehi_pref_music <- ehi1$NPastDiff_pref_music - ehi1$NFutDiff_pref_music +ehi1$ehi_pref_tv <- ehi1$NPastDiff_pref_tv - ehi1$NFutDiff_pref_tv +ehi1$ehi_pref_nap <- ehi1$NPastDiff_pref_nap - ehi1$NFutDiff_pref_nap +ehi1$ehi_pref_travel <- ehi1$NPastDiff_pref_travel - ehi1$NFutDiff_pref_travel + +# Personality +ehi1$ehi_pers_extravert <- ehi1$NPastDiff_pers_extravert - ehi1$NFutDiff_pers_extravert +ehi1$ehi_pers_critical <- ehi1$NPastDiff_pers_critical - ehi1$NFutDiff_pers_critical +ehi1$ehi_pers_dependable <- ehi1$NPastDiff_pers_dependable - ehi1$NFutDiff_pers_dependable +ehi1$ehi_pers_anxious <- ehi1$NPastDiff_pers_anxious - ehi1$NFutDiff_pers_anxious +ehi1$ehi_pers_complex <- ehi1$NPastDiff_pers_complex - ehi1$NFutDiff_pers_complex + +# Values +ehi1$ehi_val_obey <- ehi1$NPastDiff_val_obey - ehi1$NFutDiff_val_obey +ehi1$ehi_val_trad <- ehi1$NPastDiff_val_trad - ehi1$NFutDiff_val_trad +ehi1$ehi_val_opinion <- ehi1$NPastDiff_val_opinion - ehi1$NFutDiff_val_opinion +ehi1$ehi_val_performance <- ehi1$NPastDiff_val_performance - ehi1$NFutDiff_val_performance +ehi1$ehi_val_justice <- ehi1$NPastDiff_val_justice - ehi1$NFutDiff_val_justice + +# Life satisfaction +ehi1$ehi_life_ideal <- ehi1$NPastDiff_life_ideal - ehi1$NFutDiff_life_ideal +ehi1$ehi_life_excellent <- ehi1$NPastDiff_life_excellent - ehi1$NFutDiff_life_excellent +ehi1$ehi_life_satisfied <- ehi1$NPastDiff_life_satisfied - ehi1$NFutDiff_life_satisfied +ehi1$ehi_life_important <- ehi1$NPastDiff_life_important - ehi1$NFutDiff_life_important +ehi1$ehi_life_change <- ehi1$NPastDiff_life_change - ehi1$NFutDiff_life_change + +# QA: Verify calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI difference calculations (NPast - NFut)\n\n") + +qa_pairs <- list( + list(npast = "NPastDiff_pref_read", nfut = "NFutDiff_pref_read", target = "ehi_pref_read"), + list(npast = "NPastDiff_pref_music", nfut = "NFutDiff_pref_music", target = "ehi_pref_music"), + list(npast = "NPastDiff_pref_tv", nfut = "NFutDiff_pref_tv", target = "ehi_pref_tv"), + list(npast = "NPastDiff_pref_nap", nfut = "NFutDiff_pref_nap", target = "ehi_pref_nap"), + list(npast = "NPastDiff_pref_travel", nfut = "NFutDiff_pref_travel", target = "ehi_pref_travel"), + list(npast = "NPastDiff_pers_extravert", nfut = "NFutDiff_pers_extravert", target = "ehi_pers_extravert"), + list(npast = "NPastDiff_pers_critical", nfut = "NFutDiff_pers_critical", target = "ehi_pers_critical"), + list(npast = "NPastDiff_pers_dependable", nfut = "NFutDiff_pers_dependable", target = "ehi_pers_dependable"), + list(npast = "NPastDiff_pers_anxious", nfut = "NFutDiff_pers_anxious", target = "ehi_pers_anxious"), + list(npast = "NPastDiff_pers_complex", nfut = "NFutDiff_pers_complex", target = "ehi_pers_complex"), + list(npast = "NPastDiff_val_obey", nfut = "NFutDiff_val_obey", target = "ehi_val_obey"), + list(npast = "NPastDiff_val_trad", nfut = "NFutDiff_val_trad", target = "ehi_val_trad"), + list(npast = "NPastDiff_val_opinion", nfut = "NFutDiff_val_opinion", target = "ehi_val_opinion"), + list(npast = "NPastDiff_val_performance", nfut = "NFutDiff_val_performance", target = "ehi_val_performance"), + list(npast = "NPastDiff_val_justice", nfut = "NFutDiff_val_justice", target = "ehi_val_justice"), + list(npast = "NPastDiff_life_ideal", nfut = "NFutDiff_life_ideal", target = "ehi_life_ideal"), + list(npast = "NPastDiff_life_excellent", nfut = "NFutDiff_life_excellent", target = "ehi_life_excellent"), + list(npast = "NPastDiff_life_satisfied", nfut = "NFutDiff_life_satisfied", target = "ehi_life_satisfied"), + list(npast = "NPastDiff_life_important", nfut = "NFutDiff_life_important", target = "ehi_life_important"), + list(npast = "NPastDiff_life_change", nfut = "NFutDiff_life_change", target = "ehi_life_change") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- ehi1[[pair$npast]] - ehi1[[pair$nfut]] + + # Get actual value in target variable + actual_value <- ehi1[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, ehi1[[pair$npast]][row_num], + pair$nfut, ehi1[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153333.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153333.r new file mode 100644 index 0000000..8980819 --- /dev/null +++ b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153333.r @@ -0,0 +1,104 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Create EHI difference variables (NPast - NFut) +# Preferences +ehi1$ehi_pref_read <- ehi1$NPastDiff_pref_read - ehi1$NFutDiff_pref_read +ehi1$ehi_pref_music <- ehi1$NPastDiff_pref_music - ehi1$NFutDiff_pref_music +ehi1$ehi_pref_tv <- ehi1$NPastDiff_pref_tv - ehi1$NFutDiff_pref_tv +ehi1$ehi_pref_nap <- ehi1$NPastDiff_pref_nap - ehi1$NFutDiff_pref_nap +ehi1$ehi_pref_travel <- ehi1$NPastDiff_pref_travel - ehi1$NFutDiff_pref_travel + +# Personality +ehi1$ehi_pers_extravert <- ehi1$NPastDiff_pers_extravert - ehi1$NFutDiff_pers_extravert +ehi1$ehi_pers_critical <- ehi1$NPastDiff_pers_critical - ehi1$NFutDiff_pers_critical +ehi1$ehi_pers_dependable <- ehi1$NPastDiff_pers_dependable - ehi1$NFutDiff_pers_dependable +ehi1$ehi_pers_anxious <- ehi1$NPastDiff_pers_anxious - ehi1$NFutDiff_pers_anxious +ehi1$ehi_pers_complex <- ehi1$NPastDiff_pers_complex - ehi1$NFutDiff_pers_complex + +# Values +ehi1$ehi_val_obey <- ehi1$NPastDiff_val_obey - ehi1$NFutDiff_val_obey +ehi1$ehi_val_trad <- ehi1$NPastDiff_val_trad - ehi1$NFutDiff_val_trad +ehi1$ehi_val_opinion <- ehi1$NPastDiff_val_opinion - ehi1$NFutDiff_val_opinion +ehi1$ehi_val_performance <- ehi1$NPastDiff_val_performance - ehi1$NFutDiff_val_performance +ehi1$ehi_val_justice <- ehi1$NPastDiff_val_justice - ehi1$NFutDiff_val_justice + +# Life satisfaction +ehi1$ehi_life_ideal <- ehi1$NPastDiff_life_ideal - ehi1$NFutDiff_life_ideal +ehi1$ehi_life_excellent <- ehi1$NPastDiff_life_excellent - ehi1$NFutDiff_life_excellent +ehi1$ehi_life_satisfied <- ehi1$NPastDiff_life_satisfied - ehi1$NFutDiff_life_satisfied +ehi1$ehi_life_important <- ehi1$NPastDiff_life_important - ehi1$NFutDiff_life_important +ehi1$ehi_life_change <- ehi1$NPastDiff_life_change - ehi1$NFutDiff_life_change + +# QA: Verify calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI difference calculations (NPast - NFut)\n\n") + +qa_pairs <- list( + list(npast = "NPastDiff_pref_read", nfut = "NFutDiff_pref_read", target = "ehi_pref_read"), + list(npast = "NPastDiff_pref_music", nfut = "NFutDiff_pref_music", target = "ehi_pref_music"), + list(npast = "NPastDiff_pref_tv", nfut = "NFutDiff_pref_tv", target = "ehi_pref_tv"), + list(npast = "NPastDiff_pref_nap", nfut = "NFutDiff_pref_nap", target = "ehi_pref_nap"), + list(npast = "NPastDiff_pref_travel", nfut = "NFutDiff_pref_travel", target = "ehi_pref_travel"), + list(npast = "NPastDiff_pers_extravert", nfut = "NFutDiff_pers_extravert", target = "ehi_pers_extravert"), + list(npast = "NPastDiff_pers_critical", nfut = "NFutDiff_pers_critical", target = "ehi_pers_critical"), + list(npast = "NPastDiff_pers_dependable", nfut = "NFutDiff_pers_dependable", target = "ehi_pers_dependable"), + list(npast = "NPastDiff_pers_anxious", nfut = "NFutDiff_pers_anxious", target = "ehi_pers_anxious"), + list(npast = "NPastDiff_pers_complex", nfut = "NFutDiff_pers_complex", target = "ehi_pers_complex"), + list(npast = "NPastDiff_val_obey", nfut = "NFutDiff_val_obey", target = "ehi_val_obey"), + list(npast = "NPastDiff_val_trad", nfut = "NFutDiff_val_trad", target = "ehi_val_trad"), + list(npast = "NPastDiff_val_opinion", nfut = "NFutDiff_val_opinion", target = "ehi_val_opinion"), + list(npast = "NPastDiff_val_performance", nfut = "NFutDiff_val_performance", target = "ehi_val_performance"), + list(npast = "NPastDiff_val_justice", nfut = "NFutDiff_val_justice", target = "ehi_val_justice"), + list(npast = "NPastDiff_life_ideal", nfut = "NFutDiff_life_ideal", target = "ehi_life_ideal"), + list(npast = "NPastDiff_life_excellent", nfut = "NFutDiff_life_excellent", target = "ehi_life_excellent"), + list(npast = "NPastDiff_life_satisfied", nfut = "NFutDiff_life_satisfied", target = "ehi_life_satisfied"), + list(npast = "NPastDiff_life_important", nfut = "NFutDiff_life_important", target = "ehi_life_important"), + list(npast = "NPastDiff_life_change", nfut = "NFutDiff_life_change", target = "ehi_life_change") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- ehi1[[pair$npast]] - ehi1[[pair$nfut]] + + # Get actual value in target variable + actual_value <- ehi1[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, ehi1[[pair$npast]][row_num], + pair$nfut, ehi1[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153816.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153816.r new file mode 100644 index 0000000..8980819 --- /dev/null +++ b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008153816.r @@ -0,0 +1,104 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Create EHI difference variables (NPast - NFut) +# Preferences +ehi1$ehi_pref_read <- ehi1$NPastDiff_pref_read - ehi1$NFutDiff_pref_read +ehi1$ehi_pref_music <- ehi1$NPastDiff_pref_music - ehi1$NFutDiff_pref_music +ehi1$ehi_pref_tv <- ehi1$NPastDiff_pref_tv - ehi1$NFutDiff_pref_tv +ehi1$ehi_pref_nap <- ehi1$NPastDiff_pref_nap - ehi1$NFutDiff_pref_nap +ehi1$ehi_pref_travel <- ehi1$NPastDiff_pref_travel - ehi1$NFutDiff_pref_travel + +# Personality +ehi1$ehi_pers_extravert <- ehi1$NPastDiff_pers_extravert - ehi1$NFutDiff_pers_extravert +ehi1$ehi_pers_critical <- ehi1$NPastDiff_pers_critical - ehi1$NFutDiff_pers_critical +ehi1$ehi_pers_dependable <- ehi1$NPastDiff_pers_dependable - ehi1$NFutDiff_pers_dependable +ehi1$ehi_pers_anxious <- ehi1$NPastDiff_pers_anxious - ehi1$NFutDiff_pers_anxious +ehi1$ehi_pers_complex <- ehi1$NPastDiff_pers_complex - ehi1$NFutDiff_pers_complex + +# Values +ehi1$ehi_val_obey <- ehi1$NPastDiff_val_obey - ehi1$NFutDiff_val_obey +ehi1$ehi_val_trad <- ehi1$NPastDiff_val_trad - ehi1$NFutDiff_val_trad +ehi1$ehi_val_opinion <- ehi1$NPastDiff_val_opinion - ehi1$NFutDiff_val_opinion +ehi1$ehi_val_performance <- ehi1$NPastDiff_val_performance - ehi1$NFutDiff_val_performance +ehi1$ehi_val_justice <- ehi1$NPastDiff_val_justice - ehi1$NFutDiff_val_justice + +# Life satisfaction +ehi1$ehi_life_ideal <- ehi1$NPastDiff_life_ideal - ehi1$NFutDiff_life_ideal +ehi1$ehi_life_excellent <- ehi1$NPastDiff_life_excellent - ehi1$NFutDiff_life_excellent +ehi1$ehi_life_satisfied <- ehi1$NPastDiff_life_satisfied - ehi1$NFutDiff_life_satisfied +ehi1$ehi_life_important <- ehi1$NPastDiff_life_important - ehi1$NFutDiff_life_important +ehi1$ehi_life_change <- ehi1$NPastDiff_life_change - ehi1$NFutDiff_life_change + +# QA: Verify calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI difference calculations (NPast - NFut)\n\n") + +qa_pairs <- list( + list(npast = "NPastDiff_pref_read", nfut = "NFutDiff_pref_read", target = "ehi_pref_read"), + list(npast = "NPastDiff_pref_music", nfut = "NFutDiff_pref_music", target = "ehi_pref_music"), + list(npast = "NPastDiff_pref_tv", nfut = "NFutDiff_pref_tv", target = "ehi_pref_tv"), + list(npast = "NPastDiff_pref_nap", nfut = "NFutDiff_pref_nap", target = "ehi_pref_nap"), + list(npast = "NPastDiff_pref_travel", nfut = "NFutDiff_pref_travel", target = "ehi_pref_travel"), + list(npast = "NPastDiff_pers_extravert", nfut = "NFutDiff_pers_extravert", target = "ehi_pers_extravert"), + list(npast = "NPastDiff_pers_critical", nfut = "NFutDiff_pers_critical", target = "ehi_pers_critical"), + list(npast = "NPastDiff_pers_dependable", nfut = "NFutDiff_pers_dependable", target = "ehi_pers_dependable"), + list(npast = "NPastDiff_pers_anxious", nfut = "NFutDiff_pers_anxious", target = "ehi_pers_anxious"), + list(npast = "NPastDiff_pers_complex", nfut = "NFutDiff_pers_complex", target = "ehi_pers_complex"), + list(npast = "NPastDiff_val_obey", nfut = "NFutDiff_val_obey", target = "ehi_val_obey"), + list(npast = "NPastDiff_val_trad", nfut = "NFutDiff_val_trad", target = "ehi_val_trad"), + list(npast = "NPastDiff_val_opinion", nfut = "NFutDiff_val_opinion", target = "ehi_val_opinion"), + list(npast = "NPastDiff_val_performance", nfut = "NFutDiff_val_performance", target = "ehi_val_performance"), + list(npast = "NPastDiff_val_justice", nfut = "NFutDiff_val_justice", target = "ehi_val_justice"), + list(npast = "NPastDiff_life_ideal", nfut = "NFutDiff_life_ideal", target = "ehi_life_ideal"), + list(npast = "NPastDiff_life_excellent", nfut = "NFutDiff_life_excellent", target = "ehi_life_excellent"), + list(npast = "NPastDiff_life_satisfied", nfut = "NFutDiff_life_satisfied", target = "ehi_life_satisfied"), + list(npast = "NPastDiff_life_important", nfut = "NFutDiff_life_important", target = "ehi_life_important"), + list(npast = "NPastDiff_life_change", nfut = "NFutDiff_life_change", target = "ehi_life_change") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- ehi1[[pair$npast]] - ehi1[[pair$nfut]] + + # Get actual value in target variable + actual_value <- ehi1[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, ehi1[[pair$npast]][row_num], + pair$nfut, ehi1[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008162958.r b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008162958.r new file mode 100644 index 0000000..8980819 --- /dev/null +++ b/.history/eohi1/datap 03 - CORRECT domain specific EHI vars_20251008162958.r @@ -0,0 +1,104 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Create EHI difference variables (NPast - NFut) +# Preferences +ehi1$ehi_pref_read <- ehi1$NPastDiff_pref_read - ehi1$NFutDiff_pref_read +ehi1$ehi_pref_music <- ehi1$NPastDiff_pref_music - ehi1$NFutDiff_pref_music +ehi1$ehi_pref_tv <- ehi1$NPastDiff_pref_tv - ehi1$NFutDiff_pref_tv +ehi1$ehi_pref_nap <- ehi1$NPastDiff_pref_nap - ehi1$NFutDiff_pref_nap +ehi1$ehi_pref_travel <- ehi1$NPastDiff_pref_travel - ehi1$NFutDiff_pref_travel + +# Personality +ehi1$ehi_pers_extravert <- ehi1$NPastDiff_pers_extravert - ehi1$NFutDiff_pers_extravert +ehi1$ehi_pers_critical <- ehi1$NPastDiff_pers_critical - ehi1$NFutDiff_pers_critical +ehi1$ehi_pers_dependable <- ehi1$NPastDiff_pers_dependable - ehi1$NFutDiff_pers_dependable +ehi1$ehi_pers_anxious <- ehi1$NPastDiff_pers_anxious - ehi1$NFutDiff_pers_anxious +ehi1$ehi_pers_complex <- ehi1$NPastDiff_pers_complex - ehi1$NFutDiff_pers_complex + +# Values +ehi1$ehi_val_obey <- ehi1$NPastDiff_val_obey - ehi1$NFutDiff_val_obey +ehi1$ehi_val_trad <- ehi1$NPastDiff_val_trad - ehi1$NFutDiff_val_trad +ehi1$ehi_val_opinion <- ehi1$NPastDiff_val_opinion - ehi1$NFutDiff_val_opinion +ehi1$ehi_val_performance <- ehi1$NPastDiff_val_performance - ehi1$NFutDiff_val_performance +ehi1$ehi_val_justice <- ehi1$NPastDiff_val_justice - ehi1$NFutDiff_val_justice + +# Life satisfaction +ehi1$ehi_life_ideal <- ehi1$NPastDiff_life_ideal - ehi1$NFutDiff_life_ideal +ehi1$ehi_life_excellent <- ehi1$NPastDiff_life_excellent - ehi1$NFutDiff_life_excellent +ehi1$ehi_life_satisfied <- ehi1$NPastDiff_life_satisfied - ehi1$NFutDiff_life_satisfied +ehi1$ehi_life_important <- ehi1$NPastDiff_life_important - ehi1$NFutDiff_life_important +ehi1$ehi_life_change <- ehi1$NPastDiff_life_change - ehi1$NFutDiff_life_change + +# QA: Verify calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI difference calculations (NPast - NFut)\n\n") + +qa_pairs <- list( + list(npast = "NPastDiff_pref_read", nfut = "NFutDiff_pref_read", target = "ehi_pref_read"), + list(npast = "NPastDiff_pref_music", nfut = "NFutDiff_pref_music", target = "ehi_pref_music"), + list(npast = "NPastDiff_pref_tv", nfut = "NFutDiff_pref_tv", target = "ehi_pref_tv"), + list(npast = "NPastDiff_pref_nap", nfut = "NFutDiff_pref_nap", target = "ehi_pref_nap"), + list(npast = "NPastDiff_pref_travel", nfut = "NFutDiff_pref_travel", target = "ehi_pref_travel"), + list(npast = "NPastDiff_pers_extravert", nfut = "NFutDiff_pers_extravert", target = "ehi_pers_extravert"), + list(npast = "NPastDiff_pers_critical", nfut = "NFutDiff_pers_critical", target = "ehi_pers_critical"), + list(npast = "NPastDiff_pers_dependable", nfut = "NFutDiff_pers_dependable", target = "ehi_pers_dependable"), + list(npast = "NPastDiff_pers_anxious", nfut = "NFutDiff_pers_anxious", target = "ehi_pers_anxious"), + list(npast = "NPastDiff_pers_complex", nfut = "NFutDiff_pers_complex", target = "ehi_pers_complex"), + list(npast = "NPastDiff_val_obey", nfut = "NFutDiff_val_obey", target = "ehi_val_obey"), + list(npast = "NPastDiff_val_trad", nfut = "NFutDiff_val_trad", target = "ehi_val_trad"), + list(npast = "NPastDiff_val_opinion", nfut = "NFutDiff_val_opinion", target = "ehi_val_opinion"), + list(npast = "NPastDiff_val_performance", nfut = "NFutDiff_val_performance", target = "ehi_val_performance"), + list(npast = "NPastDiff_val_justice", nfut = "NFutDiff_val_justice", target = "ehi_val_justice"), + list(npast = "NPastDiff_life_ideal", nfut = "NFutDiff_life_ideal", target = "ehi_life_ideal"), + list(npast = "NPastDiff_life_excellent", nfut = "NFutDiff_life_excellent", target = "ehi_life_excellent"), + list(npast = "NPastDiff_life_satisfied", nfut = "NFutDiff_life_satisfied", target = "ehi_life_satisfied"), + list(npast = "NPastDiff_life_important", nfut = "NFutDiff_life_important", target = "ehi_life_important"), + list(npast = "NPastDiff_life_change", nfut = "NFutDiff_life_change", target = "ehi_life_change") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- ehi1[[pair$npast]] - ehi1[[pair$nfut]] + + # Get actual value in target variable + actual_value <- ehi1[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, ehi1[[pair$npast]][row_num], + pair$nfut, ehi1[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153939.txt b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153939.txt new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153946.txt b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153946.txt new file mode 100644 index 0000000..931ce4f --- /dev/null +++ b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153946.txt @@ -0,0 +1,5 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") \ No newline at end of file diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153958.r b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153958.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153959.r b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153959.r new file mode 100644 index 0000000..931ce4f --- /dev/null +++ b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008153959.r @@ -0,0 +1,5 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") \ No newline at end of file diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154513.r b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154513.r new file mode 100644 index 0000000..bcce600 --- /dev/null +++ b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154513.r @@ -0,0 +1,167 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Calculate mean scores for EHI variables + +# 1. Preferences mean +ehi1$ehi_pref_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel")], na.rm = TRUE) + +# 2. Personality mean +ehi1$ehi_pers_mean <- rowMeans(ehi1[, c("ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex")], na.rm = TRUE) + +# 3. Values mean +ehi1$ehi_val_mean <- rowMeans(ehi1[, c("ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice")], na.rm = TRUE) + +# 4. Life satisfaction mean +ehi1$ehi_life_mean <- rowMeans(ehi1[, c("ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# 5. Global mean (all 20 variables) +ehi1$ehi_global_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI mean calculations\n\n") + +cat("--- FIRST 5 ROWS: PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pref_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pers_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: VALUES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_val_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: LIFE SATISFACTION MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_life_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: GLOBAL MEAN (20 variables) ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i], + ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i], + ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i], + ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: 20 values → Calculated: %.5f | Actual: %.5f %s\n", + i, calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel"), + target = "ehi_pref_mean", name = "Preferences"), + list(vars = c("ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex"), + target = "ehi_pers_mean", name = "Personality"), + list(vars = c("ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice"), + target = "ehi_val_mean", name = "Values"), + list(vars = c("ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_life_mean", name = "Life Satisfaction"), + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_global_mean", name = "Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(ehi1[, check$vars], na.rm = TRUE) + actual_mean <- ehi1[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154517.r b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154517.r new file mode 100644 index 0000000..bcce600 --- /dev/null +++ b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154517.r @@ -0,0 +1,167 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Calculate mean scores for EHI variables + +# 1. Preferences mean +ehi1$ehi_pref_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel")], na.rm = TRUE) + +# 2. Personality mean +ehi1$ehi_pers_mean <- rowMeans(ehi1[, c("ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex")], na.rm = TRUE) + +# 3. Values mean +ehi1$ehi_val_mean <- rowMeans(ehi1[, c("ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice")], na.rm = TRUE) + +# 4. Life satisfaction mean +ehi1$ehi_life_mean <- rowMeans(ehi1[, c("ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# 5. Global mean (all 20 variables) +ehi1$ehi_global_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI mean calculations\n\n") + +cat("--- FIRST 5 ROWS: PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pref_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pers_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: VALUES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_val_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: LIFE SATISFACTION MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_life_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: GLOBAL MEAN (20 variables) ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i], + ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i], + ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i], + ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: 20 values → Calculated: %.5f | Actual: %.5f %s\n", + i, calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel"), + target = "ehi_pref_mean", name = "Preferences"), + list(vars = c("ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex"), + target = "ehi_pers_mean", name = "Personality"), + list(vars = c("ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice"), + target = "ehi_val_mean", name = "Values"), + list(vars = c("ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_life_mean", name = "Life Satisfaction"), + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_global_mean", name = "Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(ehi1[, check$vars], na.rm = TRUE) + actual_mean <- ehi1[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154531.r b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154531.r new file mode 100644 index 0000000..bcce600 --- /dev/null +++ b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008154531.r @@ -0,0 +1,167 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Calculate mean scores for EHI variables + +# 1. Preferences mean +ehi1$ehi_pref_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel")], na.rm = TRUE) + +# 2. Personality mean +ehi1$ehi_pers_mean <- rowMeans(ehi1[, c("ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex")], na.rm = TRUE) + +# 3. Values mean +ehi1$ehi_val_mean <- rowMeans(ehi1[, c("ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice")], na.rm = TRUE) + +# 4. Life satisfaction mean +ehi1$ehi_life_mean <- rowMeans(ehi1[, c("ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# 5. Global mean (all 20 variables) +ehi1$ehi_global_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI mean calculations\n\n") + +cat("--- FIRST 5 ROWS: PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pref_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pers_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: VALUES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_val_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: LIFE SATISFACTION MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_life_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: GLOBAL MEAN (20 variables) ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i], + ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i], + ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i], + ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: 20 values → Calculated: %.5f | Actual: %.5f %s\n", + i, calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel"), + target = "ehi_pref_mean", name = "Preferences"), + list(vars = c("ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex"), + target = "ehi_pers_mean", name = "Personality"), + list(vars = c("ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice"), + target = "ehi_val_mean", name = "Values"), + list(vars = c("ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_life_mean", name = "Life Satisfaction"), + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_global_mean", name = "Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(ehi1[, check$vars], na.rm = TRUE) + actual_mean <- ehi1[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 04 - CORRECT ehi var means_20251008162957.r b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008162957.r new file mode 100644 index 0000000..bcce600 --- /dev/null +++ b/.history/eohi1/datap 04 - CORRECT ehi var means_20251008162957.r @@ -0,0 +1,167 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Calculate mean scores for EHI variables + +# 1. Preferences mean +ehi1$ehi_pref_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel")], na.rm = TRUE) + +# 2. Personality mean +ehi1$ehi_pers_mean <- rowMeans(ehi1[, c("ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex")], na.rm = TRUE) + +# 3. Values mean +ehi1$ehi_val_mean <- rowMeans(ehi1[, c("ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice")], na.rm = TRUE) + +# 4. Life satisfaction mean +ehi1$ehi_life_mean <- rowMeans(ehi1[, c("ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# 5. Global mean (all 20 variables) +ehi1$ehi_global_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI mean calculations\n\n") + +cat("--- FIRST 5 ROWS: PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pref_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pers_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: VALUES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_val_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: LIFE SATISFACTION MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_life_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: GLOBAL MEAN (20 variables) ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i], + ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i], + ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i], + ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: 20 values → Calculated: %.5f | Actual: %.5f %s\n", + i, calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel"), + target = "ehi_pref_mean", name = "Preferences"), + list(vars = c("ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex"), + target = "ehi_pers_mean", name = "Personality"), + list(vars = c("ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice"), + target = "ehi_val_mean", name = "Values"), + list(vars = c("ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_life_mean", name = "Life Satisfaction"), + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_global_mean", name = "Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(ehi1[, check$vars], na.rm = TRUE) + actual_mean <- ehi1[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113023.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113023.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113024.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113024.r new file mode 100644 index 0000000..d3699f5 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113024.r @@ -0,0 +1,5 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113338.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113338.r new file mode 100644 index 0000000..8db7693 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113338.r @@ -0,0 +1,13 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print("Current levels of demo_edu variable:") +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113347.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113347.r new file mode 100644 index 0000000..8db7693 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113347.r @@ -0,0 +1,13 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print("Current levels of demo_edu variable:") +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113517.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113517.r new file mode 100644 index 0000000..e9de5fa --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113517.r @@ -0,0 +1,12 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113654.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113654.r new file mode 100644 index 0000000..5949cfd --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113654.r @@ -0,0 +1,37 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$demo_edu_3level <- NA + +# HS_TS: High School and Trade School +data$demo_edu_3level[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$demo_edu_3level[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$demo_edu_3level[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$demo_edu_3level <- factor(data$demo_edu_3level, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print("\nRecoded education levels:") +print(table(data$demo_edu_3level, useNA = "ifany")) + +# Verify the recoding +print("\nCross-tabulation of original vs recoded:") +print(table(data$demo_edu, data$demo_edu_3level, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113658.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113658.r new file mode 100644 index 0000000..5949cfd --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113658.r @@ -0,0 +1,37 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$demo_edu_3level <- NA + +# HS_TS: High School and Trade School +data$demo_edu_3level[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$demo_edu_3level[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$demo_edu_3level[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$demo_edu_3level <- factor(data$demo_edu_3level, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print("\nRecoded education levels:") +print(table(data$demo_edu_3level, useNA = "ifany")) + +# Verify the recoding +print("\nCross-tabulation of original vs recoded:") +print(table(data$demo_edu, data$demo_edu_3level, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113726.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113726.r new file mode 100644 index 0000000..1ee26e7 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113726.r @@ -0,0 +1,37 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print("\nRecoded education levels:") +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print("\nCross-tabulation of original vs recoded:") +print(table(data$demo_edu, data$edu3, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113730.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113730.r new file mode 100644 index 0000000..1ee26e7 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113730.r @@ -0,0 +1,37 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print("\nRecoded education levels:") +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print("\nCross-tabulation of original vs recoded:") +print(table(data$demo_edu, data$edu3, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113735.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113735.r new file mode 100644 index 0000000..1ee26e7 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113735.r @@ -0,0 +1,37 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print("\nRecoded education levels:") +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print("\nCross-tabulation of original vs recoded:") +print(table(data$demo_edu, data$edu3, useNA = "ifany")) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113937.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113937.r new file mode 100644 index 0000000..4649b36 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113937.r @@ -0,0 +1,39 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) +print("\nDataset saved to ehi1.csv with new edu3 variable") \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113941.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113941.r new file mode 100644 index 0000000..4649b36 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113941.r @@ -0,0 +1,39 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) +print("\nDataset saved to ehi1.csv with new edu3 variable") \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113947.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113947.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027113947.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027114131.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027114131.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027114131.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115643.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115643.r new file mode 100644 index 0000000..22663f5 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115643.r @@ -0,0 +1,49 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +data$edu3_numeric <- as.numeric(data$edu3) + +# Check the numeric conversion +print("\nNumeric education levels:") +print(table(data$edu3_numeric, useNA = "ifany")) + +# Verify the conversion +print("\nCross-tabulation of factor vs numeric:") +print(table(data$edu3, data$edu3_numeric, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115647.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115647.r new file mode 100644 index 0000000..7f5a917 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115647.r @@ -0,0 +1,49 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +data$edu3_numeric <- as.numeric(data$edu3) + +# Check the numeric conversion +print("\nNumeric education levels:") +print(table(data$edu3_numeric, useNA = "ifany")) + +# Verify the conversion +print("\nCross-tabulation of factor vs numeric:") +print(table(data$edu3, data$edu3_numeric, useNA = "ifany")) + +# Note: To save the dataset, close any programs that have ehi1.csv open, then run: +# write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115649.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115649.r new file mode 100644 index 0000000..7f5a917 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115649.r @@ -0,0 +1,49 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +data$edu3_numeric <- as.numeric(data$edu3) + +# Check the numeric conversion +print("\nNumeric education levels:") +print(table(data$edu3_numeric, useNA = "ifany")) + +# Verify the conversion +print("\nCross-tabulation of factor vs numeric:") +print(table(data$edu3, data$edu3_numeric, useNA = "ifany")) + +# Note: To save the dataset, close any programs that have ehi1.csv open, then run: +# write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115718.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115718.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115718.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115829.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115829.r new file mode 100644 index 0000000..a826447 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115829.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print("\nCross-tabulation of factor vs numeric:") +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115832.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115832.r new file mode 100644 index 0000000..f2938a7 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115832.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print("\nCross-tabulation of factor vs numeric:") +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +# Note: To save the dataset, close any programs that have ehi1.csv open, then run: +# write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115834.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115834.r new file mode 100644 index 0000000..f2938a7 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115834.r @@ -0,0 +1,50 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print("\nCross-tabulation of factor vs numeric:") +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +# Note: To save the dataset, close any programs that have ehi1.csv open, then run: +# write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115845.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115845.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027115845.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027134607.r b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027134607.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/.history/eohi1/datap 15 - education recoded 3 ordinal levels_20251027134607.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918115552.r b/.history/eohi1/descriptives - gen knowledge questions_20250918115552.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918115553.r b/.history/eohi1/descriptives - gen knowledge questions_20250918115553.r new file mode 100644 index 0000000..1fcac3c --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918115553.r @@ -0,0 +1,32 @@ +library(tidyverse) + +# Read data +df <- readr::read_csv("exp1.csv", show_col_types = FALSE) + +# Select variables ending exactly with _T or _F +df_tf <- df %>% select(matches("(_T|_F)$")) + +# Coerce to numeric where possible (without breaking non-numeric) +df_tf_num <- df_tf %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute descriptives per variable +descriptives <- df_tf_num %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + summarise( + n = sum(!is.na(value)), + missing = sum(is.na(value)), + mean = mean(value, na.rm = TRUE), + sd = sd(value, na.rm = TRUE), + median = median(value, na.rm = TRUE), + min = suppressWarnings(min(value, na.rm = TRUE)), + max = suppressWarnings(max(value, na.rm = TRUE)), + .by = "variable" + ) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918115703.r b/.history/eohi1/descriptives - gen knowledge questions_20250918115703.r new file mode 100644 index 0000000..3bc0a8a --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918115703.r @@ -0,0 +1,34 @@ +library(tidyverse) + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_tf_num <- df_tf %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute descriptives per variable +descriptives <- df_tf_num %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + summarise( + n = sum(!is.na(value)), + missing = sum(is.na(value)), + mean = mean(value, na.rm = TRUE), + sd = sd(value, na.rm = TRUE), + median = median(value, na.rm = TRUE), + min = suppressWarnings(min(value, na.rm = TRUE)), + max = suppressWarnings(max(value, na.rm = TRUE)), + .by = "variable" + ) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120055.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120055.r new file mode 100644 index 0000000..a280963 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120055.r @@ -0,0 +1,39 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable +df <- df %>% select(-demo_f) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_tf_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute descriptives per variable +descriptives <- df_tf_num %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + summarise( + n = sum(!is.na(value)), + missing = sum(is.na(value)), + mean = mean(value, na.rm = TRUE), + sd = sd(value, na.rm = TRUE), + median = median(value, na.rm = TRUE), + min = suppressWarnings(min(value, na.rm = TRUE)), + max = suppressWarnings(max(value, na.rm = TRUE)), + .by = "variable" + ) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120100.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120100.r new file mode 100644 index 0000000..a280963 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120100.r @@ -0,0 +1,39 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable +df <- df %>% select(-demo_f) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_tf_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute descriptives per variable +descriptives <- df_tf_num %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + summarise( + n = sum(!is.na(value)), + missing = sum(is.na(value)), + mean = mean(value, na.rm = TRUE), + sd = sd(value, na.rm = TRUE), + median = median(value, na.rm = TRUE), + min = suppressWarnings(min(value, na.rm = TRUE)), + max = suppressWarnings(max(value, na.rm = TRUE)), + .by = "variable" + ) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120102.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120102.r new file mode 100644 index 0000000..a280963 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120102.r @@ -0,0 +1,39 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable +df <- df %>% select(-demo_f) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_tf_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute descriptives per variable +descriptives <- df_tf_num %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + summarise( + n = sum(!is.na(value)), + missing = sum(is.na(value)), + mean = mean(value, na.rm = TRUE), + sd = sd(value, na.rm = TRUE), + median = median(value, na.rm = TRUE), + min = suppressWarnings(min(value, na.rm = TRUE)), + max = suppressWarnings(max(value, na.rm = TRUE)), + .by = "variable" + ) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120515.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120515.r new file mode 100644 index 0000000..4886004 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120515.r @@ -0,0 +1,35 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct (value == 1) per variable +descriptives <- df_num %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + summarise( + n_total = sum(!is.na(value)), + n_correct = sum(value == 1, na.rm = TRUE), + prop_correct = ifelse(n_total > 0, n_correct / n_total, NA_real_), + .by = "variable" + ) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120600.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120600.r new file mode 100644 index 0000000..35bfda1 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120600.r @@ -0,0 +1,64 @@ +library(tidyverse) +if (!requireNamespace("boot", quietly = TRUE)) install.packages("boot") +library(boot) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Helper: bootstrap BCA CI for proportion correct +compute_prop_ci <- function(x, R = 1000, conf = 0.95) { + x <- suppressWarnings(as.numeric(x)) + x <- x[!is.na(x)] + n_total <- length(x) + if (n_total == 0) { + return(list(n_total = 0L, n_correct = NA_integer_, prop = NA_real_, ci_lower = NA_real_, ci_upper = NA_real_)) + } + x01 <- ifelse(x == 1, 1, 0) + n_correct <- sum(x01) + prop <- n_correct / n_total + stat <- function(data, indices) mean(data[indices]) + b <- boot::boot(data = x01, statistic = stat, R = R) + ci <- tryCatch(boot::boot.ci(b, conf = conf, type = "bca"), error = function(e) NULL) + if (is.null(ci) || is.null(ci$bca)) { + lower <- NA_real_ + upper <- NA_real_ + } else { + lower <- ci$bca[4] + upper <- ci$bca[5] + } + list(n_total = n_total, n_correct = n_correct, prop = prop, ci_lower = lower, ci_upper = upper) +} + +# Compute count, proportion correct, and 95% BCA CI per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + res <- compute_prop_ci(col, R = 1000, conf = 0.95) + tibble( + variable = name, + n_total = res$n_total, + n_correct = res$n_correct, + prop_correct = round(res$prop, 5), + ci_lower = round(res$ci_lower, 5), + ci_upper = round(res$ci_upper, 5) + ) +}) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120656.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120656.r new file mode 100644 index 0000000..35bfda1 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120656.r @@ -0,0 +1,64 @@ +library(tidyverse) +if (!requireNamespace("boot", quietly = TRUE)) install.packages("boot") +library(boot) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Helper: bootstrap BCA CI for proportion correct +compute_prop_ci <- function(x, R = 1000, conf = 0.95) { + x <- suppressWarnings(as.numeric(x)) + x <- x[!is.na(x)] + n_total <- length(x) + if (n_total == 0) { + return(list(n_total = 0L, n_correct = NA_integer_, prop = NA_real_, ci_lower = NA_real_, ci_upper = NA_real_)) + } + x01 <- ifelse(x == 1, 1, 0) + n_correct <- sum(x01) + prop <- n_correct / n_total + stat <- function(data, indices) mean(data[indices]) + b <- boot::boot(data = x01, statistic = stat, R = R) + ci <- tryCatch(boot::boot.ci(b, conf = conf, type = "bca"), error = function(e) NULL) + if (is.null(ci) || is.null(ci$bca)) { + lower <- NA_real_ + upper <- NA_real_ + } else { + lower <- ci$bca[4] + upper <- ci$bca[5] + } + list(n_total = n_total, n_correct = n_correct, prop = prop, ci_lower = lower, ci_upper = upper) +} + +# Compute count, proportion correct, and 95% BCA CI per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + res <- compute_prop_ci(col, R = 1000, conf = 0.95) + tibble( + variable = name, + n_total = res$n_total, + n_correct = res$n_correct, + prop_correct = round(res$prop, 5), + ci_lower = round(res$ci_lower, 5), + ci_upper = round(res$ci_upper, 5) + ) +}) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918120727.r b/.history/eohi1/descriptives - gen knowledge questions_20250918120727.r new file mode 100644 index 0000000..4c3cd5d --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918120727.r @@ -0,0 +1,63 @@ +library(tidyverse) +library(boot) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Helper: bootstrap BCA CI for proportion correct +compute_prop_ci <- function(x, R = 1000, conf = 0.95) { + x <- suppressWarnings(as.numeric(x)) + x <- x[!is.na(x)] + n_total <- length(x) + if (n_total == 0) { + return(list(n_total = 0L, n_correct = NA_integer_, prop = NA_real_, ci_lower = NA_real_, ci_upper = NA_real_)) + } + x01 <- ifelse(x == 1, 1, 0) + n_correct <- sum(x01) + prop <- n_correct / n_total + stat <- function(data, indices) mean(data[indices]) + b <- boot::boot(data = x01, statistic = stat, R = R) + ci <- tryCatch(boot::boot.ci(b, conf = conf, type = "bca"), error = function(e) NULL) + if (is.null(ci) || is.null(ci$bca)) { + lower <- NA_real_ + upper <- NA_real_ + } else { + lower <- ci$bca[4] + upper <- ci$bca[5] + } + list(n_total = n_total, n_correct = n_correct, prop = prop, ci_lower = lower, ci_upper = upper) +} + +# Compute count, proportion correct, and 95% BCA CI per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + res <- compute_prop_ci(col, R = 1000, conf = 0.95) + tibble( + variable = name, + n_total = res$n_total, + n_correct = res$n_correct, + prop_correct = round(res$prop, 5), + ci_lower = round(res$ci_lower, 5), + ci_upper = round(res$ci_upper, 5) + ) +}) %>% + arrange(variable) + +# View +print(descriptives, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918122358.r b/.history/eohi1/descriptives - gen knowledge questions_20250918122358.r new file mode 100644 index 0000000..6995cb1 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918122358.r @@ -0,0 +1,55 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5) + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918122401.r b/.history/eohi1/descriptives - gen knowledge questions_20250918122401.r new file mode 100644 index 0000000..6995cb1 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918122401.r @@ -0,0 +1,55 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5) + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918122413.r b/.history/eohi1/descriptives - gen knowledge questions_20250918122413.r new file mode 100644 index 0000000..6995cb1 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918122413.r @@ -0,0 +1,55 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5) + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918122634.r b/.history/eohi1/descriptives - gen knowledge questions_20250918122634.r new file mode 100644 index 0000000..5368928 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918122634.r @@ -0,0 +1,70 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5) + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918122637.r b/.history/eohi1/descriptives - gen knowledge questions_20250918122637.r new file mode 100644 index 0000000..5368928 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918122637.r @@ -0,0 +1,70 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5) + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918122638.r b/.history/eohi1/descriptives - gen knowledge questions_20250918122638.r new file mode 100644 index 0000000..5368928 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918122638.r @@ -0,0 +1,70 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5) + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918123114.r b/.history/eohi1/descriptives - gen knowledge questions_20250918123114.r new file mode 100644 index 0000000..25de7e7 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918123114.r @@ -0,0 +1,88 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918123117.r b/.history/eohi1/descriptives - gen knowledge questions_20250918123117.r new file mode 100644 index 0000000..25de7e7 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918123117.r @@ -0,0 +1,88 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918123133.r b/.history/eohi1/descriptives - gen knowledge questions_20250918123133.r new file mode 100644 index 0000000..25de7e7 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918123133.r @@ -0,0 +1,88 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918124915.r b/.history/eohi1/descriptives - gen knowledge questions_20250918124915.r new file mode 100644 index 0000000..25de7e7 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918124915.r @@ -0,0 +1,88 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918145603.r b/.history/eohi1/descriptives - gen knowledge questions_20250918145603.r new file mode 100644 index 0000000..16f3295 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918145603.r @@ -0,0 +1,101 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram(binwidth = 0.05, fill = "lightblue", color = "black", alpha = 0.7) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0, 1, 0.1)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918145606.r b/.history/eohi1/descriptives - gen knowledge questions_20250918145606.r new file mode 100644 index 0000000..16f3295 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918145606.r @@ -0,0 +1,101 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram(binwidth = 0.05, fill = "lightblue", color = "black", alpha = 0.7) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0, 1, 0.1)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918145728.r b/.history/eohi1/descriptives - gen knowledge questions_20250918145728.r new file mode 100644 index 0000000..16f3295 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918145728.r @@ -0,0 +1,101 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram(binwidth = 0.05, fill = "lightblue", color = "black", alpha = 0.7) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0, 1, 0.1)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918155602.r b/.history/eohi1/descriptives - gen knowledge questions_20250918155602.r new file mode 100644 index 0000000..6d7be10 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918155602.r @@ -0,0 +1,106 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct with custom bins +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram( + breaks = seq(0.15, 0.95, by = 0.10), + fill = "lightblue", + color = "black", + alpha = 0.7 + ) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0.15, 0.95, by = 0.10)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918155604.r b/.history/eohi1/descriptives - gen knowledge questions_20250918155604.r new file mode 100644 index 0000000..6d7be10 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918155604.r @@ -0,0 +1,106 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct with custom bins +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram( + breaks = seq(0.15, 0.95, by = 0.10), + fill = "lightblue", + color = "black", + alpha = 0.7 + ) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0.15, 0.95, by = 0.10)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918155605.r b/.history/eohi1/descriptives - gen knowledge questions_20250918155605.r new file mode 100644 index 0000000..6d7be10 --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918155605.r @@ -0,0 +1,106 @@ +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct with custom bins +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram( + breaks = seq(0.15, 0.95, by = 0.10), + fill = "lightblue", + color = "black", + alpha = 0.7 + ) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0.15, 0.95, by = 0.10)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/descriptives - gen knowledge questions_20250918155636.r b/.history/eohi1/descriptives - gen knowledge questions_20250918155636.r new file mode 100644 index 0000000..2932a3b --- /dev/null +++ b/.history/eohi1/descriptives - gen knowledge questions_20250918155636.r @@ -0,0 +1,107 @@ +library(tidyverse) +library(ggplot2) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct with custom bins +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram( + breaks = seq(0.15, 0.95, by = 0.10), + fill = "lightblue", + color = "black", + alpha = 0.7 + ) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0.15, 0.95, by = 0.10)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029093310.r b/.history/eohi1/e1 - reliability ehi_20251029093310.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/e1 - reliability ehi_20251029093311.r b/.history/eohi1/e1 - reliability ehi_20251029093311.r new file mode 100644 index 0000000..d059220 --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029093311.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029093545.r b/.history/eohi1/e1 - reliability ehi_20251029093545.r new file mode 100644 index 0000000..e9a46df --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029093545.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029094220.r b/.history/eohi1/e1 - reliability ehi_20251029094220.r new file mode 100644 index 0000000..cae6d8c --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029094220.r @@ -0,0 +1,80 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# fixed-decimal formatter (five decimals) +fmt5 <- function(x) formatC(x, format = "f", digits = 5) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Two-item reliability summary (if applicable) +two_item_section <- "" +if (ncol(reliability_data) == 2) { + n_complete <- sum(complete.cases(reliability_data)) + r_pearson <- cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "pearson") + # Fisher z CI for r + fisher_z <- atanh(r_pearson) + se_z <- 1 / sqrt(n_complete - 3) + z_crit <- qnorm(0.975) + ci_z_lower <- fisher_z - z_crit * se_z + ci_z_upper <- fisher_z + z_crit * se_z + ci_r_lower <- tanh(ci_z_lower) + ci_r_upper <- tanh(ci_z_upper) + # Spearman–Brown/Cronbach's alpha for k = 2 + alpha_sb <- (2 * r_pearson) / (1 + r_pearson) + alpha_lower <- (2 * ci_r_lower) / (1 + ci_r_lower) + alpha_upper <- (2 * ci_r_upper) / (1 + ci_r_upper) + + two_item_section <- paste0( + "

Two-Item Reliability Summary

", + "

Pearson r: ", fmt5(r_pearson), " (95% CI: [", fmt5(ci_r_lower), ", ", fmt5(ci_r_upper), "])

", + "

Spearman–Brown / Cronbach's ", intToUtf8(945), ": ", fmt5(alpha_sb), + " (95% CI: [", fmt5(alpha_lower), ", ", fmt5(alpha_upper), "])

" + ) +} + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + two_item_section, + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", fmt5(split_half$maxrb), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029094235.r b/.history/eohi1/e1 - reliability ehi_20251029094235.r new file mode 100644 index 0000000..cae6d8c --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029094235.r @@ -0,0 +1,80 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# fixed-decimal formatter (five decimals) +fmt5 <- function(x) formatC(x, format = "f", digits = 5) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Two-item reliability summary (if applicable) +two_item_section <- "" +if (ncol(reliability_data) == 2) { + n_complete <- sum(complete.cases(reliability_data)) + r_pearson <- cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "pearson") + # Fisher z CI for r + fisher_z <- atanh(r_pearson) + se_z <- 1 / sqrt(n_complete - 3) + z_crit <- qnorm(0.975) + ci_z_lower <- fisher_z - z_crit * se_z + ci_z_upper <- fisher_z + z_crit * se_z + ci_r_lower <- tanh(ci_z_lower) + ci_r_upper <- tanh(ci_z_upper) + # Spearman–Brown/Cronbach's alpha for k = 2 + alpha_sb <- (2 * r_pearson) / (1 + r_pearson) + alpha_lower <- (2 * ci_r_lower) / (1 + ci_r_lower) + alpha_upper <- (2 * ci_r_upper) / (1 + ci_r_upper) + + two_item_section <- paste0( + "

Two-Item Reliability Summary

", + "

Pearson r: ", fmt5(r_pearson), " (95% CI: [", fmt5(ci_r_lower), ", ", fmt5(ci_r_upper), "])

", + "

Spearman–Brown / Cronbach's ", intToUtf8(945), ": ", fmt5(alpha_sb), + " (95% CI: [", fmt5(alpha_lower), ", ", fmt5(alpha_upper), "])

" + ) +} + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + two_item_section, + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", fmt5(split_half$maxrb), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029094336.r b/.history/eohi1/e1 - reliability ehi_20251029094336.r new file mode 100644 index 0000000..adbc326 --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029094336.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# fixed-decimal formatter (five decimals) +fmt5 <- function(x) formatC(x, format = "f", digits = 5) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Two-item reliability summary (if applicable) +two_item_section <- "" +if (ncol(reliability_data) == 2) { + n_complete <- sum(complete.cases(reliability_data)) + r_pearson <- cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "pearson") + r_spearman <- suppressWarnings(cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "spearman")) + # Fisher z CI for r + fisher_z <- atanh(r_pearson) + se_z <- 1 / sqrt(n_complete - 3) + z_crit <- qnorm(0.975) + ci_z_lower <- fisher_z - z_crit * se_z + ci_z_upper <- fisher_z + z_crit * se_z + ci_r_lower <- tanh(ci_z_lower) + ci_r_upper <- tanh(ci_z_upper) + # Approximate Fisher z CI for Spearman rho (large-sample approximation) + fisher_z_s <- atanh(r_spearman) + ci_zs_lower <- fisher_z_s - z_crit * se_z + ci_zs_upper <- fisher_z_s + z_crit * se_z + ci_s_lower <- tanh(ci_zs_lower) + ci_s_upper <- tanh(ci_zs_upper) + # Spearman–Brown/Cronbach's alpha for k = 2 + alpha_sb <- (2 * r_pearson) / (1 + r_pearson) + alpha_lower <- (2 * ci_r_lower) / (1 + ci_r_lower) + alpha_upper <- (2 * ci_r_upper) / (1 + ci_r_upper) + + two_item_section <- paste0( + "

Two-Item Reliability Summary

", + "

Pearson r: ", fmt5(r_pearson), " (95% CI: [", fmt5(ci_r_lower), ", ", fmt5(ci_r_upper), "])

", + "

Spearman r: ", fmt5(r_spearman), " (95% CI: [", fmt5(ci_s_lower), ", ", fmt5(ci_s_upper), "])

", + "

Spearman–Brown / Cronbach's ", intToUtf8(945), ": ", fmt5(alpha_sb), + " (95% CI: [", fmt5(alpha_lower), ", ", fmt5(alpha_upper), "])

" + ) +} + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + two_item_section, + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", fmt5(split_half$maxrb), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029094344.r b/.history/eohi1/e1 - reliability ehi_20251029094344.r new file mode 100644 index 0000000..adbc326 --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029094344.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# fixed-decimal formatter (five decimals) +fmt5 <- function(x) formatC(x, format = "f", digits = 5) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Two-item reliability summary (if applicable) +two_item_section <- "" +if (ncol(reliability_data) == 2) { + n_complete <- sum(complete.cases(reliability_data)) + r_pearson <- cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "pearson") + r_spearman <- suppressWarnings(cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "spearman")) + # Fisher z CI for r + fisher_z <- atanh(r_pearson) + se_z <- 1 / sqrt(n_complete - 3) + z_crit <- qnorm(0.975) + ci_z_lower <- fisher_z - z_crit * se_z + ci_z_upper <- fisher_z + z_crit * se_z + ci_r_lower <- tanh(ci_z_lower) + ci_r_upper <- tanh(ci_z_upper) + # Approximate Fisher z CI for Spearman rho (large-sample approximation) + fisher_z_s <- atanh(r_spearman) + ci_zs_lower <- fisher_z_s - z_crit * se_z + ci_zs_upper <- fisher_z_s + z_crit * se_z + ci_s_lower <- tanh(ci_zs_lower) + ci_s_upper <- tanh(ci_zs_upper) + # Spearman–Brown/Cronbach's alpha for k = 2 + alpha_sb <- (2 * r_pearson) / (1 + r_pearson) + alpha_lower <- (2 * ci_r_lower) / (1 + ci_r_lower) + alpha_upper <- (2 * ci_r_upper) / (1 + ci_r_upper) + + two_item_section <- paste0( + "

Two-Item Reliability Summary

", + "

Pearson r: ", fmt5(r_pearson), " (95% CI: [", fmt5(ci_r_lower), ", ", fmt5(ci_r_upper), "])

", + "

Spearman r: ", fmt5(r_spearman), " (95% CI: [", fmt5(ci_s_lower), ", ", fmt5(ci_s_upper), "])

", + "

Spearman–Brown / Cronbach's ", intToUtf8(945), ": ", fmt5(alpha_sb), + " (95% CI: [", fmt5(alpha_lower), ", ", fmt5(alpha_upper), "])

" + ) +} + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + two_item_section, + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", fmt5(split_half$maxrb), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/e1 - reliability ehi_20251029094408.r b/.history/eohi1/e1 - reliability ehi_20251029094408.r new file mode 100644 index 0000000..adbc326 --- /dev/null +++ b/.history/eohi1/e1 - reliability ehi_20251029094408.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# fixed-decimal formatter (five decimals) +fmt5 <- function(x) formatC(x, format = "f", digits = 5) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Two-item reliability summary (if applicable) +two_item_section <- "" +if (ncol(reliability_data) == 2) { + n_complete <- sum(complete.cases(reliability_data)) + r_pearson <- cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "pearson") + r_spearman <- suppressWarnings(cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "spearman")) + # Fisher z CI for r + fisher_z <- atanh(r_pearson) + se_z <- 1 / sqrt(n_complete - 3) + z_crit <- qnorm(0.975) + ci_z_lower <- fisher_z - z_crit * se_z + ci_z_upper <- fisher_z + z_crit * se_z + ci_r_lower <- tanh(ci_z_lower) + ci_r_upper <- tanh(ci_z_upper) + # Approximate Fisher z CI for Spearman rho (large-sample approximation) + fisher_z_s <- atanh(r_spearman) + ci_zs_lower <- fisher_z_s - z_crit * se_z + ci_zs_upper <- fisher_z_s + z_crit * se_z + ci_s_lower <- tanh(ci_zs_lower) + ci_s_upper <- tanh(ci_zs_upper) + # Spearman–Brown/Cronbach's alpha for k = 2 + alpha_sb <- (2 * r_pearson) / (1 + r_pearson) + alpha_lower <- (2 * ci_r_lower) / (1 + ci_r_lower) + alpha_upper <- (2 * ci_r_upper) / (1 + ci_r_upper) + + two_item_section <- paste0( + "

Two-Item Reliability Summary

", + "

Pearson r: ", fmt5(r_pearson), " (95% CI: [", fmt5(ci_r_lower), ", ", fmt5(ci_r_upper), "])

", + "

Spearman r: ", fmt5(r_spearman), " (95% CI: [", fmt5(ci_s_lower), ", ", fmt5(ci_s_upper), "])

", + "

Spearman–Brown / Cronbach's ", intToUtf8(945), ": ", fmt5(alpha_sb), + " (95% CI: [", fmt5(alpha_lower), ", ", fmt5(alpha_upper), "])

" + ) +} + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + two_item_section, + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", fmt5(split_half$maxrb), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi1/minimal_test_20251004194428.rmd b/.history/eohi1/minimal_test_20251004194428.rmd new file mode 100644 index 0000000..5a984d7 --- /dev/null +++ b/.history/eohi1/minimal_test_20251004194428.rmd @@ -0,0 +1,16 @@ +--- +title: "Minimal Test" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Test + +```{r} +library(tidyverse) +data <- read.csv("exp1.csv") +print("Success!") +``` diff --git a/.history/eohi1/minimal_test_20251004194431.rmd b/.history/eohi1/minimal_test_20251004194431.rmd new file mode 100644 index 0000000..5a984d7 --- /dev/null +++ b/.history/eohi1/minimal_test_20251004194431.rmd @@ -0,0 +1,16 @@ +--- +title: "Minimal Test" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Test + +```{r} +library(tidyverse) +data <- read.csv("exp1.csv") +print("Success!") +``` diff --git a/.history/eohi1/minimal_test_20251004194608.rmd b/.history/eohi1/minimal_test_20251004194608.rmd new file mode 100644 index 0000000..98fc5a2 --- /dev/null +++ b/.history/eohi1/minimal_test_20251004194608.rmd @@ -0,0 +1,17 @@ +--- +title: "Minimal Test" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) +``` + +# Test + +```{r} +library(tidyverse) +data <- read.csv("exp1.csv") +print("Success!") +``` + diff --git a/.history/eohi1/minimal_test_20251004194638.rmd b/.history/eohi1/minimal_test_20251004194638.rmd new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/.history/eohi1/minimal_test_20251004194638.rmd @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251003132154.r b/.history/eohi1/mixed anova - DGEN_20251003132154.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/mixed anova - DGEN_20251003132235.r b/.history/eohi1/mixed anova - DGEN_20251003132235.r new file mode 100644 index 0000000..f497db6 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251003132235.r @@ -0,0 +1,21 @@ +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251003132528.r b/.history/eohi1/mixed anova - DGEN_20251003132528.r new file mode 100644 index 0000000..4a07dbe --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251003132528.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251003132534.r b/.history/eohi1/mixed anova - DGEN_20251003132534.r new file mode 100644 index 0000000..4a07dbe --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251003132534.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251003132751.r b/.history/eohi1/mixed anova - DGEN_20251003132751.r new file mode 100644 index 0000000..4a07dbe --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251003132751.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006125959.r b/.history/eohi1/mixed anova - DGEN_20251006125959.r new file mode 100644 index 0000000..4a07dbe --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006125959.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150203.r b/.history/eohi1/mixed anova - DGEN_20251006150203.r new file mode 100644 index 0000000..2fa76d8 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150203.r @@ -0,0 +1,673 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150325.r b/.history/eohi1/mixed anova - DGEN_20251006150325.r new file mode 100644 index 0000000..ac79773 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150325.r @@ -0,0 +1,667 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150338.r b/.history/eohi1/mixed anova - DGEN_20251006150338.r new file mode 100644 index 0000000..e4c5f8c --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150338.r @@ -0,0 +1,662 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150343.r b/.history/eohi1/mixed anova - DGEN_20251006150343.r new file mode 100644 index 0000000..04f6eff --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150343.r @@ -0,0 +1,661 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150351.r b/.history/eohi1/mixed anova - DGEN_20251006150351.r new file mode 100644 index 0000000..7576ff2 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150351.r @@ -0,0 +1,654 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150356.r b/.history/eohi1/mixed anova - DGEN_20251006150356.r new file mode 100644 index 0000000..773c842 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150356.r @@ -0,0 +1,654 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150414.r b/.history/eohi1/mixed anova - DGEN_20251006150414.r new file mode 100644 index 0000000..f7944d0 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150414.r @@ -0,0 +1,642 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# interaction plots \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150433.r b/.history/eohi1/mixed anova - DGEN_20251006150433.r new file mode 100644 index 0000000..21803bb --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150433.r @@ -0,0 +1,725 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot +interaction_plot_temporal_domain <- ggplot() + + geom_point( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_domain, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150451.r b/.history/eohi1/mixed anova - DGEN_20251006150451.r new file mode 100644 index 0000000..21803bb --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150451.r @@ -0,0 +1,725 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot +interaction_plot_temporal_domain <- ggplot() + + geom_point( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_domain, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006150515.r b/.history/eohi1/mixed anova - DGEN_20251006150515.r new file mode 100644 index 0000000..21803bb --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006150515.r @@ -0,0 +1,725 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot +interaction_plot_temporal_domain <- ggplot() + + geom_point( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_domain, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006151447.r b/.history/eohi1/mixed anova - DGEN_20251006151447.r new file mode 100644 index 0000000..3e4c20e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006151447.r @@ -0,0 +1,774 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + alpha = 0.4, + color = "black", + trim = FALSE + ) + + # Add boxplot for quartiles + geom_boxplot( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + width = 0.2, + alpha = 0.6, + outlier.shape = NA, + color = "black" + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + ymin = ci_lower, + ymax = ci_upper, + color = DOMAIN + ), + width = 0.15, + linewidth = 1.2, + position = position_dodge(width = 0) + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + y = plot_mean, + shape = DOMAIN + ), + size = 3.5, + fill = "white", + stroke = 1.5, + color = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right" + ) + +print(interaction_plot_temporal_domain) + +# Alternative: Faceted version for even clearer visualization +interaction_plot_faceted <- ggplot(iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN, color = DOMAIN)) + + geom_violin(alpha = 0.4, color = "black", trim = FALSE) + + geom_boxplot(width = 0.3, alpha = 0.6, color = "black", outlier.shape = NA) + + geom_point( + data = emmeans_temporal_domain, + aes(x = TEMPORAL_DO, y = plot_mean), + shape = 23, + size = 4, + fill = "white", + color = "black", + stroke = 1.5 + ) + + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = TEMPORAL_DO, ymin = ci_lower, ymax = ci_upper), + width = 0.2, + linewidth = 1, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction (Faceted)" + ) + + scale_fill_manual(values = domain_colors) + + scale_color_manual(values = domain_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "none", + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_faceted) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006151454.r b/.history/eohi1/mixed anova - DGEN_20251006151454.r new file mode 100644 index 0000000..3e4c20e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006151454.r @@ -0,0 +1,774 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + alpha = 0.4, + color = "black", + trim = FALSE + ) + + # Add boxplot for quartiles + geom_boxplot( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + width = 0.2, + alpha = 0.6, + outlier.shape = NA, + color = "black" + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + ymin = ci_lower, + ymax = ci_upper, + color = DOMAIN + ), + width = 0.15, + linewidth = 1.2, + position = position_dodge(width = 0) + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + y = plot_mean, + shape = DOMAIN + ), + size = 3.5, + fill = "white", + stroke = 1.5, + color = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right" + ) + +print(interaction_plot_temporal_domain) + +# Alternative: Faceted version for even clearer visualization +interaction_plot_faceted <- ggplot(iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN, color = DOMAIN)) + + geom_violin(alpha = 0.4, color = "black", trim = FALSE) + + geom_boxplot(width = 0.3, alpha = 0.6, color = "black", outlier.shape = NA) + + geom_point( + data = emmeans_temporal_domain, + aes(x = TEMPORAL_DO, y = plot_mean), + shape = 23, + size = 4, + fill = "white", + color = "black", + stroke = 1.5 + ) + + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = TEMPORAL_DO, ymin = ci_lower, ymax = ci_upper), + width = 0.2, + linewidth = 1, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction (Faceted)" + ) + + scale_fill_manual(values = domain_colors) + + scale_color_manual(values = domain_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "none", + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_faceted) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006151507.r b/.history/eohi1/mixed anova - DGEN_20251006151507.r new file mode 100644 index 0000000..1611a9a --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006151507.r @@ -0,0 +1,736 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + alpha = 0.4, + color = "black", + trim = FALSE + ) + + # Add boxplot for quartiles + geom_boxplot( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + width = 0.2, + alpha = 0.6, + outlier.shape = NA, + color = "black" + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + ymin = ci_lower, + ymax = ci_upper, + color = DOMAIN + ), + width = 0.15, + linewidth = 1.2, + position = position_dodge(width = 0) + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + y = plot_mean, + shape = DOMAIN + ), + size = 3.5, + fill = "white", + stroke = 1.5, + color = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right" + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006151514.r b/.history/eohi1/mixed anova - DGEN_20251006151514.r new file mode 100644 index 0000000..1611a9a --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006151514.r @@ -0,0 +1,736 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + alpha = 0.4, + color = "black", + trim = FALSE + ) + + # Add boxplot for quartiles + geom_boxplot( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + width = 0.2, + alpha = 0.6, + outlier.shape = NA, + color = "black" + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + ymin = ci_lower, + ymax = ci_upper, + color = DOMAIN + ), + width = 0.15, + linewidth = 1.2, + position = position_dodge(width = 0) + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + y = plot_mean, + shape = DOMAIN + ), + size = 3.5, + fill = "white", + stroke = 1.5, + color = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right" + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006151518.r b/.history/eohi1/mixed anova - DGEN_20251006151518.r new file mode 100644 index 0000000..1611a9a --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006151518.r @@ -0,0 +1,736 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + alpha = 0.4, + color = "black", + trim = FALSE + ) + + # Add boxplot for quartiles + geom_boxplot( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.8), + width = 0.2, + alpha = 0.6, + outlier.shape = NA, + color = "black" + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + ymin = ci_lower, + ymax = ci_upper, + color = DOMAIN + ), + width = 0.15, + linewidth = 1.2, + position = position_dodge(width = 0) + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.2, + y = plot_mean, + shape = DOMAIN + ), + size = 3.5, + fill = "white", + stroke = 1.5, + color = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_color_manual(name = "DOMAIN", values = domain_colors) + + scale_fill_manual(name = "DOMAIN", values = domain_colors) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right" + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006152215.r b/.history/eohi1/mixed anova - DGEN_20251006152215.r new file mode 100644 index 0000000..a180eb5 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006152215.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.9), + alpha = 0.5, + color = "black", + trim = FALSE, + linewidth = 0.5 + ) + + # Add subtle median line + stat_summary( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, group = DOMAIN), + fun = median, + geom = "crossbar", + width = 0.15, + position = position_dodge(width = 0.9), + color = "gray30", + linewidth = 0.3, + fatten = 0 + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.225, + ymin = ci_lower, + ymax = ci_upper + ), + width = 0, + linewidth = 1.2, + color = "black" + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.225, + y = plot_mean, + shape = DOMAIN + ), + size = 4, + fill = "white", + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Distance Orientation", + y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 12) + + theme( + axis.text.x = element_text(size = 11), + axis.text.y = element_text(size = 10), + axis.title = element_text(size = 12, face = "bold"), + plot.title = element_text(size = 13, hjust = 0.5, face = "bold"), + legend.position = "right", + legend.title = element_text(size = 11, face = "bold"), + legend.text = element_text(size = 10), + panel.grid.minor = element_blank() + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006152226.r b/.history/eohi1/mixed anova - DGEN_20251006152226.r new file mode 100644 index 0000000..a180eb5 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006152226.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.9), + alpha = 0.5, + color = "black", + trim = FALSE, + linewidth = 0.5 + ) + + # Add subtle median line + stat_summary( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, group = DOMAIN), + fun = median, + geom = "crossbar", + width = 0.15, + position = position_dodge(width = 0.9), + color = "gray30", + linewidth = 0.3, + fatten = 0 + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.225, + ymin = ci_lower, + ymax = ci_upper + ), + width = 0, + linewidth = 1.2, + color = "black" + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.225, + y = plot_mean, + shape = DOMAIN + ), + size = 4, + fill = "white", + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Distance Orientation", + y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 12) + + theme( + axis.text.x = element_text(size = 11), + axis.text.y = element_text(size = 10), + axis.title = element_text(size = 12, face = "bold"), + plot.title = element_text(size = 13, hjust = 0.5, face = "bold"), + legend.position = "right", + legend.title = element_text(size = 11, face = "bold"), + legend.text = element_text(size = 10), + panel.grid.minor = element_blank() + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006152312.r b/.history/eohi1/mixed anova - DGEN_20251006152312.r new file mode 100644 index 0000000..a180eb5 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006152312.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot using violin plots +interaction_plot_temporal_domain <- ggplot() + + # Violin plots to show distribution + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN), + position = position_dodge(width = 0.9), + alpha = 0.5, + color = "black", + trim = FALSE, + linewidth = 0.5 + ) + + # Add subtle median line + stat_summary( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, group = DOMAIN), + fun = median, + geom = "crossbar", + width = 0.15, + position = position_dodge(width = 0.9), + color = "gray30", + linewidth = 0.3, + fatten = 0 + ) + + # Add emmeans with error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.225, + ymin = ci_lower, + ymax = ci_upper + ), + width = 0, + linewidth = 1.2, + color = "black" + ) + + # Add emmeans points + geom_point( + data = emmeans_temporal_domain, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(DOMAIN) - 2.5) * 0.225, + y = plot_mean, + shape = DOMAIN + ), + size = 4, + fill = "white", + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Distance Orientation", + y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 12) + + theme( + axis.text.x = element_text(size = 11), + axis.text.y = element_text(size = 10), + axis.title = element_text(size = 12, face = "bold"), + plot.title = element_text(size = 13, hjust = 0.5, face = "bold"), + legend.position = "right", + legend.title = element_text(size = 11, face = "bold"), + legend.text = element_text(size = 10), + panel.grid.minor = element_blank() + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006152851.r b/.history/eohi1/mixed anova - DGEN_20251006152851.r new file mode 100644 index 0000000..f27ad7f --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006152851.r @@ -0,0 +1,738 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Add x position for plotting +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - half violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN, group = interaction(TEMPORAL_DO, DOMAIN)), + position = position_dodge(width = 0.8), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Temporal Distance Orientation", + y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("01PAST", "02FUT") + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006152926.r b/.history/eohi1/mixed anova - DGEN_20251006152926.r new file mode 100644 index 0000000..f27ad7f --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006152926.r @@ -0,0 +1,738 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Add x position for plotting +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - half violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN, group = interaction(TEMPORAL_DO, DOMAIN)), + position = position_dodge(width = 0.8), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Temporal Distance Orientation", + y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("01PAST", "02FUT") + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006152934.r b/.history/eohi1/mixed anova - DGEN_20251006152934.r new file mode 100644 index 0000000..f27ad7f --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006152934.r @@ -0,0 +1,738 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Add x position for plotting +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - half violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO, y = DGEN_SCORE, fill = DOMAIN, group = interaction(TEMPORAL_DO, DOMAIN)), + position = position_dodge(width = 0.8), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Temporal Distance Orientation", + y = "DGEN Score", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("01PAST", "02FUT") + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006153823.r b/.history/eohi1/mixed anova - DGEN_20251006153823.r new file mode 100644 index 0000000..7a04c62 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006153823.r @@ -0,0 +1,752 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Recode labels for plotting +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate(TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + )) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + ), + x_pos = as.numeric(TEMPORAL_DO) + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - half violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO_label, y = DGEN_SCORE, fill = DOMAIN, group = interaction(TEMPORAL_DO_label, DOMAIN)), + position = position_dodge(width = 0.8), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First") + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006153831.r b/.history/eohi1/mixed anova - DGEN_20251006153831.r new file mode 100644 index 0000000..7a04c62 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006153831.r @@ -0,0 +1,752 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Recode labels for plotting +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate(TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + )) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + ), + x_pos = as.numeric(TEMPORAL_DO) + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - half violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO_label, y = DGEN_SCORE, fill = DOMAIN, group = interaction(TEMPORAL_DO_label, DOMAIN)), + position = position_dodge(width = 0.8), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First") + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006153845.r b/.history/eohi1/mixed anova - DGEN_20251006153845.r new file mode 100644 index 0000000..7a04c62 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006153845.r @@ -0,0 +1,752 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Recode labels for plotting +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate(TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + )) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + ), + x_pos = as.numeric(TEMPORAL_DO) + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - half violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = TEMPORAL_DO_label, y = DGEN_SCORE, fill = DOMAIN, group = interaction(TEMPORAL_DO_label, DOMAIN)), + position = position_dodge(width = 0.8), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First") + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006154345.r b/.history/eohi1/mixed anova - DGEN_20251006154345.r new file mode 100644 index 0000000..8d31c47 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006154345.r @@ -0,0 +1,742 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis for all layers +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_pos, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + position = position_dodge(width = 0.15), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006154352.r b/.history/eohi1/mixed anova - DGEN_20251006154352.r new file mode 100644 index 0000000..8d31c47 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006154352.r @@ -0,0 +1,742 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis for all layers +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_pos, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + position = position_dodge(width = 0.15), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006154403.r b/.history/eohi1/mixed anova - DGEN_20251006154403.r new file mode 100644 index 0000000..8d31c47 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006154403.r @@ -0,0 +1,742 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis for all layers +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate(x_pos = as.numeric(TEMPORAL_DO)) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_pos, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + position = position_dodge(width = 0.15), + alpha = 0.3, + color = NA, + trim = FALSE, + scale = "width" + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_pos, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_pos, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155006.r b/.history/eohi1/mixed anova - DGEN_20251006155006.r new file mode 100644 index 0000000..1a260ef --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155006.r @@ -0,0 +1,756 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.3, + color = "black", + linewidth = 0.3, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155018.r b/.history/eohi1/mixed anova - DGEN_20251006155018.r new file mode 100644 index 0000000..1a260ef --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155018.r @@ -0,0 +1,756 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.3, + color = "black", + linewidth = 0.3, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155049.r b/.history/eohi1/mixed anova - DGEN_20251006155049.r new file mode 100644 index 0000000..1a260ef --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155049.r @@ -0,0 +1,756 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.3, + color = "black", + linewidth = 0.3, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Connect emmeans with lines to show interaction + geom_line( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, color = DOMAIN, group = DOMAIN), + linewidth = 1, + alpha = 0.8 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155243.r b/.history/eohi1/mixed anova - DGEN_20251006155243.r new file mode 100644 index 0000000..e1bc255 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155243.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155250.r b/.history/eohi1/mixed anova - DGEN_20251006155250.r new file mode 100644 index 0000000..e1bc255 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155250.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155253.r b/.history/eohi1/mixed anova - DGEN_20251006155253.r new file mode 100644 index 0000000..e1bc255 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155253.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Confidence interval ribbons + geom_ribbon( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, fill = DOMAIN, group = DOMAIN), + alpha = 0.2, + color = NA + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155346.r b/.history/eohi1/mixed anova - DGEN_20251006155346.r new file mode 100644 index 0000000..628d1d4 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155346.r @@ -0,0 +1,749 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155349.r b/.history/eohi1/mixed anova - DGEN_20251006155349.r new file mode 100644 index 0000000..628d1d4 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155349.r @@ -0,0 +1,749 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155353.r b/.history/eohi1/mixed anova - DGEN_20251006155353.r new file mode 100644 index 0000000..628d1d4 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155353.r @@ -0,0 +1,749 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006155709.r b/.history/eohi1/mixed anova - DGEN_20251006155709.r new file mode 100644 index 0000000..628d1d4 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006155709.r @@ -0,0 +1,749 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006172448.r b/.history/eohi1/mixed anova - DGEN_20251006172448.r new file mode 100644 index 0000000..a719016 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006172448.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006172451.r b/.history/eohi1/mixed anova - DGEN_20251006172451.r new file mode 100644 index 0000000..a719016 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006172451.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006172503.r b/.history/eohi1/mixed anova - DGEN_20251006172503.r new file mode 100644 index 0000000..a719016 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006172503.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006172600.r b/.history/eohi1/mixed anova - DGEN_20251006172600.r new file mode 100644 index 0000000..15f16ea --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006172600.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006172604.r b/.history/eohi1/mixed anova - DGEN_20251006172604.r new file mode 100644 index 0000000..15f16ea --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006172604.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006172636.r b/.history/eohi1/mixed anova - DGEN_20251006172636.r new file mode 100644 index 0000000..a719016 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006172636.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006181939.r b/.history/eohi1/mixed anova - DGEN_20251006181939.r new file mode 100644 index 0000000..83e455e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006181939.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(2, 6), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006191125.r b/.history/eohi1/mixed anova - DGEN_20251006191125.r new file mode 100644 index 0000000..faa9bbc --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006191125.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006200121.r b/.history/eohi1/mixed anova - DGEN_20251006200121.r new file mode 100644 index 0000000..5d999c0 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006200121.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# 3-WAY INTERACTION PLOT: TEMPORAL_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × DOMAIN +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006200138.r b/.history/eohi1/mixed anova - DGEN_20251006200138.r new file mode 100644 index 0000000..5d999c0 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006200138.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# 3-WAY INTERACTION PLOT: TEMPORAL_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × DOMAIN +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006200320.r b/.history/eohi1/mixed anova - DGEN_20251006200320.r new file mode 100644 index 0000000..faa9bbc --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006200320.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006201108.r b/.history/eohi1/mixed anova - DGEN_20251006201108.r new file mode 100644 index 0000000..faa9bbc --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006201108.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251006201257.r b/.history/eohi1/mixed anova - DGEN_20251006201257.r new file mode 100644 index 0000000..291c500 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251006201257.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251007162848.r b/.history/eohi1/mixed anova - DGEN_20251007162848.r new file mode 100644 index 0000000..291c500 --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251007162848.r @@ -0,0 +1,818 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251007162926.r b/.history/eohi1/mixed anova - DGEN_20251007162926.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251007162926.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251007162939.r b/.history/eohi1/mixed anova - DGEN_20251007162939.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251007162939.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251007162949.r b/.history/eohi1/mixed anova - DGEN_20251007162949.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251007162949.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251007162951.r b/.history/eohi1/mixed anova - DGEN_20251007162951.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251007162951.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251007180951.r b/.history/eohi1/mixed anova - DGEN_20251007180951.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251007180951.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251010152730.r b/.history/eohi1/mixed anova - DGEN_20251010152730.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251010152730.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - DGEN_20251010165036.r b/.history/eohi1/mixed anova - DGEN_20251010165036.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/.history/eohi1/mixed anova - DGEN_20251010165036.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means SIMPLE_20251003125947.r b/.history/eohi1/mixed anova - domain means SIMPLE_20251003125947.r new file mode 100644 index 0000000..4d85d77 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means SIMPLE_20251003125947.r @@ -0,0 +1,320 @@ +# Mixed ANOVA Analysis for Domain Means - SIMPLIFIED VERSION +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +print("\n=== ANALYSIS COMPLETE ===") +print("This simplified version includes all essential results without computationally intensive post-hoc comparisons.") +print("The main ANOVA results show all significant effects with proper sphericity corrections.") diff --git a/.history/eohi1/mixed anova - domain means SIMPLE_20251003130013.r b/.history/eohi1/mixed anova - domain means SIMPLE_20251003130013.r new file mode 100644 index 0000000..4d85d77 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means SIMPLE_20251003130013.r @@ -0,0 +1,320 @@ +# Mixed ANOVA Analysis for Domain Means - SIMPLIFIED VERSION +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +print("\n=== ANALYSIS COMPLETE ===") +print("This simplified version includes all essential results without computationally intensive post-hoc comparisons.") +print("The main ANOVA results show all significant effects with proper sphericity corrections.") diff --git a/.history/eohi1/mixed anova - domain means_20250912153102.r b/.history/eohi1/mixed anova - domain means_20250912153102.r new file mode 100644 index 0000000..36c68c0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153102.r @@ -0,0 +1,272 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153232.r b/.history/eohi1/mixed anova - domain means_20250912153232.r new file mode 100644 index 0000000..d8ee82f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153232.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:\Users\irina\Documents\DND\EOHI\eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153241.r b/.history/eohi1/mixed anova - domain means_20250912153241.r new file mode 100644 index 0000000..d8ee82f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153241.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:\Users\irina\Documents\DND\EOHI\eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153323.r b/.history/eohi1/mixed anova - domain means_20250912153323.r new file mode 100644 index 0000000..2e14e93 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153323.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153326.r b/.history/eohi1/mixed anova - domain means_20250912153326.r new file mode 100644 index 0000000..2e14e93 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153326.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153327.r b/.history/eohi1/mixed anova - domain means_20250912153327.r new file mode 100644 index 0000000..2e14e93 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153327.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153352.r b/.history/eohi1/mixed anova - domain means_20250912153352.r new file mode 100644 index 0000000..a44f1b6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153352.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153354.r b/.history/eohi1/mixed anova - domain means_20250912153354.r new file mode 100644 index 0000000..a44f1b6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153354.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912153402.r b/.history/eohi1/mixed anova - domain means_20250912153402.r new file mode 100644 index 0000000..a44f1b6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912153402.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154157.r b/.history/eohi1/mixed anova - domain means_20250912154157.r new file mode 100644 index 0000000..2bcbe1a --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154157.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154200.r b/.history/eohi1/mixed anova - domain means_20250912154200.r new file mode 100644 index 0000000..2bcbe1a --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154200.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154202.r b/.history/eohi1/mixed anova - domain means_20250912154202.r new file mode 100644 index 0000000..2bcbe1a --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154202.r @@ -0,0 +1,274 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154303.r b/.history/eohi1/mixed anova - domain means_20250912154303.r new file mode 100644 index 0000000..3d5f420 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154303.r @@ -0,0 +1,247 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154304.r b/.history/eohi1/mixed anova - domain means_20250912154304.r new file mode 100644 index 0000000..3d5f420 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154304.r @@ -0,0 +1,247 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154305.r b/.history/eohi1/mixed anova - domain means_20250912154305.r new file mode 100644 index 0000000..3d5f420 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154305.r @@ -0,0 +1,247 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154904.r b/.history/eohi1/mixed anova - domain means_20250912154904.r new file mode 100644 index 0000000..4c9cfa3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154904.r @@ -0,0 +1,247 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912154909.r b/.history/eohi1/mixed anova - domain means_20250912154909.r new file mode 100644 index 0000000..4c9cfa3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912154909.r @@ -0,0 +1,247 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155010.r b/.history/eohi1/mixed anova - domain means_20250912155010.r new file mode 100644 index 0000000..019c325 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155010.r @@ -0,0 +1,246 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155017.r b/.history/eohi1/mixed anova - domain means_20250912155017.r new file mode 100644 index 0000000..019c325 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155017.r @@ -0,0 +1,246 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155100.r b/.history/eohi1/mixed anova - domain means_20250912155100.r new file mode 100644 index 0000000..019c325 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155100.r @@ -0,0 +1,246 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155158.r b/.history/eohi1/mixed anova - domain means_20250912155158.r new file mode 100644 index 0000000..49e13c0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155158.r @@ -0,0 +1,246 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155205.r b/.history/eohi1/mixed anova - domain means_20250912155205.r new file mode 100644 index 0000000..49e13c0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155205.r @@ -0,0 +1,246 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155217.r b/.history/eohi1/mixed anova - domain means_20250912155217.r new file mode 100644 index 0000000..067fbb0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155217.r @@ -0,0 +1,263 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") +debug_ad <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_test = list(ad.test(MEAN_DIFFERENCE)), + .groups = 'drop' + ) + +# Extract individual test results +for(i in 1:nrow(debug_ad)) { + cat("TIME:", debug_ad$TIME[i], "DOMAIN:", debug_ad$DOMAIN[i], "\n") + print(debug_ad$ad_test[[i]]) + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155223.r b/.history/eohi1/mixed anova - domain means_20250912155223.r new file mode 100644 index 0000000..067fbb0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155223.r @@ -0,0 +1,263 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") +debug_ad <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_test = list(ad.test(MEAN_DIFFERENCE)), + .groups = 'drop' + ) + +# Extract individual test results +for(i in 1:nrow(debug_ad)) { + cat("TIME:", debug_ad$TIME[i], "DOMAIN:", debug_ad$DOMAIN[i], "\n") + print(debug_ad$ad_test[[i]]) + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155224.r b/.history/eohi1/mixed anova - domain means_20250912155224.r new file mode 100644 index 0000000..067fbb0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155224.r @@ -0,0 +1,263 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") +debug_ad <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_test = list(ad.test(MEAN_DIFFERENCE)), + .groups = 'drop' + ) + +# Extract individual test results +for(i in 1:nrow(debug_ad)) { + cat("TIME:", debug_ad$TIME[i], "DOMAIN:", debug_ad$DOMAIN[i], "\n") + print(debug_ad$ad_test[[i]]) + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155246.r b/.history/eohi1/mixed anova - domain means_20250912155246.r new file mode 100644 index 0000000..7a33961 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155246.r @@ -0,0 +1,275 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155247.r b/.history/eohi1/mixed anova - domain means_20250912155247.r new file mode 100644 index 0000000..7a33961 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155247.r @@ -0,0 +1,275 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155253.r b/.history/eohi1/mixed anova - domain means_20250912155253.r new file mode 100644 index 0000000..7a33961 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155253.r @@ -0,0 +1,275 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + round(ad.test(MEAN_DIFFERENCE)$p.value, 20), + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155329.r b/.history/eohi1/mixed anova - domain means_20250912155329.r new file mode 100644 index 0000000..4c7c829 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155329.r @@ -0,0 +1,275 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155333.r b/.history/eohi1/mixed anova - domain means_20250912155333.r new file mode 100644 index 0000000..5a459a3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155333.r @@ -0,0 +1,279 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155338.r b/.history/eohi1/mixed anova - domain means_20250912155338.r new file mode 100644 index 0000000..5a459a3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155338.r @@ -0,0 +1,279 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155352.r b/.history/eohi1/mixed anova - domain means_20250912155352.r new file mode 100644 index 0000000..5a459a3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155352.r @@ -0,0 +1,279 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155830.r b/.history/eohi1/mixed anova - domain means_20250912155830.r new file mode 100644 index 0000000..454c709 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155830.r @@ -0,0 +1,367 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + critical_95 <- quantile(bootstrap_ratios, 0.95) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155832.r b/.history/eohi1/mixed anova - domain means_20250912155832.r new file mode 100644 index 0000000..454c709 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155832.r @@ -0,0 +1,367 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + critical_95 <- quantile(bootstrap_ratios, 0.95) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155837.r b/.history/eohi1/mixed anova - domain means_20250912155837.r new file mode 100644 index 0000000..454c709 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155837.r @@ -0,0 +1,367 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + critical_95 <- quantile(bootstrap_ratios, 0.95) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155915.r b/.history/eohi1/mixed anova - domain means_20250912155915.r new file mode 100644 index 0000000..bbb4b9d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155915.r @@ -0,0 +1,374 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155919.r b/.history/eohi1/mixed anova - domain means_20250912155919.r new file mode 100644 index 0000000..bbb4b9d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155919.r @@ -0,0 +1,374 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155922.r b/.history/eohi1/mixed anova - domain means_20250912155922.r new file mode 100644 index 0000000..bbb4b9d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155922.r @@ -0,0 +1,374 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155944.r b/.history/eohi1/mixed anova - domain means_20250912155944.r new file mode 100644 index 0000000..5c9b71c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155944.r @@ -0,0 +1,378 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Ensure we have a valid variance (avoid zero variance) + sample_var <- var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + # If variance is zero or very small, add small epsilon + if(sample_var <= 0) sample_var <- 1e-10 + sample_var + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155948.r b/.history/eohi1/mixed anova - domain means_20250912155948.r new file mode 100644 index 0000000..a26930b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155948.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Ensure we have a valid variance (avoid zero variance) + sample_var <- var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + # If variance is zero or very small, add small epsilon + if(sample_var <= 0) sample_var <- 1e-10 + sample_var + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912155953.r b/.history/eohi1/mixed anova - domain means_20250912155953.r new file mode 100644 index 0000000..a26930b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912155953.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Pool all data and resample to create equal variance scenario + pooled_data <- data[[response_var]] + pooled_mean <- mean(pooled_data, na.rm = TRUE) + pooled_var <- var(pooled_data, na.rm = TRUE) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Generate samples from normal distribution with pooled variance + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Ensure we have a valid variance (avoid zero variance) + sample_var <- var(rnorm(n = n_group, mean = pooled_mean, sd = sqrt(pooled_var))) + # If variance is zero or very small, add small epsilon + if(sample_var <= 0) sample_var <- 1e-10 + sample_var + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160029.r b/.history/eohi1/mixed anova - domain means_20250912160029.r new file mode 100644 index 0000000..df6b53c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160029.r @@ -0,0 +1,380 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160033.r b/.history/eohi1/mixed anova - domain means_20250912160033.r new file mode 100644 index 0000000..df6b53c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160033.r @@ -0,0 +1,380 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160053.r b/.history/eohi1/mixed anova - domain means_20250912160053.r new file mode 100644 index 0000000..df6b53c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160053.r @@ -0,0 +1,380 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160118.r b/.history/eohi1/mixed anova - domain means_20250912160118.r new file mode 100644 index 0000000..42e21be --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160118.r @@ -0,0 +1,387 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160125.r b/.history/eohi1/mixed anova - domain means_20250912160125.r new file mode 100644 index 0000000..4cfd45f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160125.r @@ -0,0 +1,398 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance + if(sample_var == 0) { + cat("Warning: Zero variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160131.r b/.history/eohi1/mixed anova - domain means_20250912160131.r new file mode 100644 index 0000000..4cfd45f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160131.r @@ -0,0 +1,398 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance + if(sample_var == 0) { + cat("Warning: Zero variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160133.r b/.history/eohi1/mixed anova - domain means_20250912160133.r new file mode 100644 index 0000000..4cfd45f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160133.r @@ -0,0 +1,398 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance + if(sample_var == 0) { + cat("Warning: Zero variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160206.r b/.history/eohi1/mixed anova - domain means_20250912160206.r new file mode 100644 index 0000000..db23141 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160206.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance + if(sample_var == 0) { + cat("Warning: Zero variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160213.r b/.history/eohi1/mixed anova - domain means_20250912160213.r new file mode 100644 index 0000000..db23141 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160213.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance + if(sample_var == 0) { + cat("Warning: Zero variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160217.r b/.history/eohi1/mixed anova - domain means_20250912160217.r new file mode 100644 index 0000000..db23141 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160217.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance + if(sample_var == 0) { + cat("Warning: Zero variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160416.r b/.history/eohi1/mixed anova - domain means_20250912160416.r new file mode 100644 index 0000000..c46be07 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160416.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160420.r b/.history/eohi1/mixed anova - domain means_20250912160420.r new file mode 100644 index 0000000..c46be07 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160420.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160432.r b/.history/eohi1/mixed anova - domain means_20250912160432.r new file mode 100644 index 0000000..c46be07 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160432.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160551.r b/.history/eohi1/mixed anova - domain means_20250912160551.r new file mode 100644 index 0000000..eb14a7a --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160551.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(cur_data(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160604.r b/.history/eohi1/mixed anova - domain means_20250912160604.r new file mode 100644 index 0000000..862c149 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160604.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160607.r b/.history/eohi1/mixed anova - domain means_20250912160607.r new file mode 100644 index 0000000..862c149 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160607.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160610.r b/.history/eohi1/mixed anova - domain means_20250912160610.r new file mode 100644 index 0000000..862c149 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160610.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160644.r b/.history/eohi1/mixed anova - domain means_20250912160644.r new file mode 100644 index 0000000..e1dbbde --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160644.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160648.r b/.history/eohi1/mixed anova - domain means_20250912160648.r new file mode 100644 index 0000000..d7bf658 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160648.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160652.r b/.history/eohi1/mixed anova - domain means_20250912160652.r new file mode 100644 index 0000000..d7bf658 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160652.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912160655.r b/.history/eohi1/mixed anova - domain means_20250912160655.r new file mode 100644 index 0000000..d7bf658 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912160655.r @@ -0,0 +1,438 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Resample from actual data to create equal variance scenario + pooled_data <- data[[response_var]] + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Resample from pooled data for each group + sample_vars <- map_dbl(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + n_group <- length(group_data) + # Bootstrap sample from pooled data + bootstrap_sample <- sample(pooled_data, size = n_group, replace = TRUE) + sample_var <- var(bootstrap_sample, na.rm = TRUE) + # Debug: Check for zero variance or NA + if(is.na(sample_var) || sample_var == 0) { + cat("Warning: Zero or NA variance detected in bootstrap sample\n") + sample_var <- 1e-10 + } + sample_var + }) + hartley_ratio <- calculate_hartley_ratio(sample_vars) + # Debug: Check for invalid ratios + if(!is.finite(hartley_ratio)) { + cat("Warning: Invalid Hartley ratio:", hartley_ratio, "Sample vars:", sample_vars, "\n") + } + hartley_ratio + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161036.r b/.history/eohi1/mixed anova - domain means_20250912161036.r new file mode 100644 index 0000000..ecaa427 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161036.r @@ -0,0 +1,427 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161041.r b/.history/eohi1/mixed anova - domain means_20250912161041.r new file mode 100644 index 0000000..ecaa427 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161041.r @@ -0,0 +1,427 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161046.r b/.history/eohi1/mixed anova - domain means_20250912161046.r new file mode 100644 index 0000000..ecaa427 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161046.r @@ -0,0 +1,427 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS +# ============================================================================= + +# Test 1: Observed F-max across TIME within each DOMAIN +print("=== OBSERVED F-MAX RATIOS: TIME within each DOMAIN ===") + +observed_time_ratios <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + # Calculate variances for each TIME level within this domain + past_var = var(MEAN_DIFFERENCE[TIME == "Past"], na.rm = TRUE), + future_var = var(MEAN_DIFFERENCE[TIME == "Future"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, future_var) / min(past_var, future_var), + .groups = 'drop' + ) %>% + select(DOMAIN, past_var, future_var, f_max_ratio) + +print(observed_time_ratios) + +# Test 2: Observed F-max across DOMAIN within each TIME +print("\n=== OBSERVED F-MAX RATIOS: DOMAIN within each TIME ===") + +observed_domain_ratios <- long_data_clean %>% + group_by(TIME) %>% + summarise( + # Calculate variances for each DOMAIN level within this time + pref_var = var(MEAN_DIFFERENCE[DOMAIN == "Preferences"], na.rm = TRUE), + pers_var = var(MEAN_DIFFERENCE[DOMAIN == "Personality"], na.rm = TRUE), + val_var = var(MEAN_DIFFERENCE[DOMAIN == "Values"], na.rm = TRUE), + life_var = var(MEAN_DIFFERENCE[DOMAIN == "Life"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(pref_var, pers_var, val_var, life_var) / min(pref_var, pers_var, val_var, life_var), + .groups = 'drop' + ) %>% + select(TIME, pref_var, pers_var, val_var, life_var, f_max_ratio) + +print(observed_domain_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161558.r b/.history/eohi1/mixed anova - domain means_20250912161558.r new file mode 100644 index 0000000..ebe4e46 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161558.r @@ -0,0 +1,410 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + temporal_1_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 1], na.rm = TRUE), + temporal_2_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 2], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(temporal_1_var, temporal_2_var) / min(temporal_1_var, temporal_2_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, temporal_1_var, temporal_2_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Test 1: Hartley's F-max across TIME within each DOMAIN +print("\n=== HARTLEY'S F-MAX TEST: TIME within each DOMAIN ===") +set.seed(123) # For reproducibility + +hartley_time_results <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TIME, MEAN_DIFFERENCE), "TIME", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_time_results) + +# Test 2: Hartley's F-max across DOMAIN within each TIME +print("\n=== HARTLEY'S F-MAX TEST: DOMAIN within each TIME ===") + +hartley_domain_results <- long_data_clean %>% + group_by(TIME) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(DOMAIN, MEAN_DIFFERENCE), "DOMAIN", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, observed_ratio, critical_95, significant) + +print(hartley_domain_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161610.r b/.history/eohi1/mixed anova - domain means_20250912161610.r new file mode 100644 index 0000000..9b93e4f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161610.r @@ -0,0 +1,392 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + temporal_1_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 1], na.rm = TRUE), + temporal_2_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 2], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(temporal_1_var, temporal_2_var) / min(temporal_1_var, temporal_2_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, temporal_1_var, temporal_2_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161617.r b/.history/eohi1/mixed anova - domain means_20250912161617.r new file mode 100644 index 0000000..9b93e4f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161617.r @@ -0,0 +1,392 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + temporal_1_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 1], na.rm = TRUE), + temporal_2_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 2], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(temporal_1_var, temporal_2_var) / min(temporal_1_var, temporal_2_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, temporal_1_var, temporal_2_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161619.r b/.history/eohi1/mixed anova - domain means_20250912161619.r new file mode 100644 index 0000000..9b93e4f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161619.r @@ -0,0 +1,392 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + temporal_1_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 1], na.rm = TRUE), + temporal_2_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == 2], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(temporal_1_var, temporal_2_var) / min(temporal_1_var, temporal_2_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, temporal_1_var, temporal_2_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161932.r b/.history/eohi1/mixed anova - domain means_20250912161932.r new file mode 100644 index 0000000..f1106bd --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161932.r @@ -0,0 +1,403 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + temporal_var_1 = var(MEAN_DIFFERENCE[TEMPORAL_DO == temporal_levels[1]], na.rm = TRUE), + temporal_var_2 = var(MEAN_DIFFERENCE[TEMPORAL_DO == temporal_levels[2]], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(temporal_var_1, temporal_var_2) / min(temporal_var_1, temporal_var_2), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, temporal_var_1, temporal_var_2, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912161937.r b/.history/eohi1/mixed anova - domain means_20250912161937.r new file mode 100644 index 0000000..f1106bd --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912161937.r @@ -0,0 +1,403 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + temporal_var_1 = var(MEAN_DIFFERENCE[TEMPORAL_DO == temporal_levels[1]], na.rm = TRUE), + temporal_var_2 = var(MEAN_DIFFERENCE[TEMPORAL_DO == temporal_levels[2]], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(temporal_var_1, temporal_var_2) / min(temporal_var_1, temporal_var_2), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, temporal_var_1, temporal_var_2, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162001.r b/.history/eohi1/mixed anova - domain means_20250912162001.r new file mode 100644 index 0000000..2ab7f7c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162001.r @@ -0,0 +1,403 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162009.r b/.history/eohi1/mixed anova - domain means_20250912162009.r new file mode 100644 index 0000000..2ab7f7c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162009.r @@ -0,0 +1,403 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162037.r b/.history/eohi1/mixed anova - domain means_20250912162037.r new file mode 100644 index 0000000..2ab7f7c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162037.r @@ -0,0 +1,403 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162116.r b/.history/eohi1/mixed anova - domain means_20250912162116.r new file mode 100644 index 0000000..2ab7f7c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162116.r @@ -0,0 +1,403 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162139.r b/.history/eohi1/mixed anova - domain means_20250912162139.r new file mode 100644 index 0000000..92adae3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162139.r @@ -0,0 +1,479 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +print("\n=== MIXED ANOVA: TEMPORAL_DO (between) × TIME × DOMAIN (within) ===") + +# Mixed ANOVA using ezANOVA +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_results <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + return_aov = TRUE +) + +print("Mixed ANOVA Results:") +print(mixed_anova_results$ANOVA) + +# Extract effect sizes (partial eta squared) +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + partial_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Partial Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, partial_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162145.r b/.history/eohi1/mixed anova - domain means_20250912162145.r new file mode 100644 index 0000000..92adae3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162145.r @@ -0,0 +1,479 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +print("\n=== MIXED ANOVA: TEMPORAL_DO (between) × TIME × DOMAIN (within) ===") + +# Mixed ANOVA using ezANOVA +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_results <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + return_aov = TRUE +) + +print("Mixed ANOVA Results:") +print(mixed_anova_results$ANOVA) + +# Extract effect sizes (partial eta squared) +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + partial_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Partial Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, partial_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162151.r b/.history/eohi1/mixed anova - domain means_20250912162151.r new file mode 100644 index 0000000..92adae3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162151.r @@ -0,0 +1,479 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +print("\n=== MIXED ANOVA: TEMPORAL_DO (between) × TIME × DOMAIN (within) ===") + +# Mixed ANOVA using ezANOVA +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_results <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + return_aov = TRUE +) + +print("Mixed ANOVA Results:") +print(mixed_anova_results$ANOVA) + +# Extract effect sizes (partial eta squared) +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + partial_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Partial Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, partial_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162247.r b/.history/eohi1/mixed anova - domain means_20250912162247.r new file mode 100644 index 0000000..986e63b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162247.r @@ -0,0 +1,484 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using ezANOVA +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_results <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + return_aov = TRUE +) + +print("Mixed ANOVA Results:") +print(mixed_anova_results$ANOVA) + +# Extract effect sizes (generalized eta squared) +# Generalized eta squared = SS_effect / (SS_effect + SS_error + SS_subjects) +# For mixed designs, this provides consistent effect size estimates + +# Calculate generalized eta squared +total_ss <- sum(mixed_anova_results$ANOVA$SSn, na.rm = TRUE) +ss_error <- sum(mixed_anova_results$ANOVA$SSd, na.rm = TRUE) + +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + generalized_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Generalized Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, generalized_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162250.r b/.history/eohi1/mixed anova - domain means_20250912162250.r new file mode 100644 index 0000000..986e63b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162250.r @@ -0,0 +1,484 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using ezANOVA +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_results <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + return_aov = TRUE +) + +print("Mixed ANOVA Results:") +print(mixed_anova_results$ANOVA) + +# Extract effect sizes (generalized eta squared) +# Generalized eta squared = SS_effect / (SS_effect + SS_error + SS_subjects) +# For mixed designs, this provides consistent effect size estimates + +# Calculate generalized eta squared +total_ss <- sum(mixed_anova_results$ANOVA$SSn, na.rm = TRUE) +ss_error <- sum(mixed_anova_results$ANOVA$SSd, na.rm = TRUE) + +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + generalized_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Generalized Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, generalized_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162255.r b/.history/eohi1/mixed anova - domain means_20250912162255.r new file mode 100644 index 0000000..986e63b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162255.r @@ -0,0 +1,484 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using ezANOVA +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_results <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + return_aov = TRUE +) + +print("Mixed ANOVA Results:") +print(mixed_anova_results$ANOVA) + +# Extract effect sizes (generalized eta squared) +# Generalized eta squared = SS_effect / (SS_effect + SS_error + SS_subjects) +# For mixed designs, this provides consistent effect size estimates + +# Calculate generalized eta squared +total_ss <- sum(mixed_anova_results$ANOVA$SSn, na.rm = TRUE) +ss_error <- sum(mixed_anova_results$ANOVA$SSd, na.rm = TRUE) + +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + generalized_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Generalized Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, generalized_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162832.r b/.history/eohi1/mixed anova - domain means_20250912162832.r new file mode 100644 index 0000000..a287515 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162832.r @@ -0,0 +1,477 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# Generalized eta squared = SS_effect / (SS_effect + SS_error + SS_subjects) +# For mixed designs, this provides consistent effect size estimates + +# Calculate generalized eta squared +total_ss <- sum(mixed_anova_results$ANOVA$SSn, na.rm = TRUE) +ss_error <- sum(mixed_anova_results$ANOVA$SSd, na.rm = TRUE) + +effect_sizes <- mixed_anova_results$ANOVA %>% + mutate( + generalized_eta_squared = round(SSn / (SSn + SSd), 5), + .after = p + ) + +print("\nEffect Sizes (Generalized Eta Squared):") +print(effect_sizes %>% select(Effect, F, p, generalized_eta_squared)) + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162837.r b/.history/eohi1/mixed anova - domain means_20250912162837.r new file mode 100644 index 0000000..d7dea47 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162837.r @@ -0,0 +1,467 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_results$aov, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_results$aov, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162851.r b/.history/eohi1/mixed anova - domain means_20250912162851.r new file mode 100644 index 0000000..4b3b99e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162851.r @@ -0,0 +1,467 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912162858.r b/.history/eohi1/mixed anova - domain means_20250912162858.r new file mode 100644 index 0000000..4b3b99e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912162858.r @@ -0,0 +1,467 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912163014.r b/.history/eohi1/mixed anova - domain means_20250912163014.r new file mode 100644 index 0000000..4b3b99e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912163014.r @@ -0,0 +1,467 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250912164147.r b/.history/eohi1/mixed anova - domain means_20250912164147.r new file mode 100644 index 0000000..4faa42e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250912164147.r @@ -0,0 +1,471 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110342.r b/.history/eohi1/mixed anova - domain means_20250915110342.r new file mode 100644 index 0000000..635147d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110342.r @@ -0,0 +1,460 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_W = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$statistic, + NA), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_A = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$statistic, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) + +print("Normality test results:") +print(normality_results) + +# Note: Anderson-Darling p-values may appear identical due to machine precision limits +# All p-values are extremely small (< 2.2e-16) indicating strong non-normality +# The test statistics (A values) are actually different across conditions + +# Debug: Check if Anderson-Darling test is working properly +print("\n=== DEBUG: Anderson-Darling Test Details ===") + +# Get unique combinations of TIME and DOMAIN +unique_combos <- long_data_clean %>% + select(TIME, DOMAIN) %>% + distinct() + +# Run Anderson-Darling test for each combination +for(i in 1:nrow(unique_combos)) { + time_val <- unique_combos$TIME[i] + domain_val <- unique_combos$DOMAIN[i] + + # Subset data for this combination + subset_data <- long_data_clean %>% + filter(TIME == time_val, DOMAIN == domain_val) + + cat("TIME:", time_val, "DOMAIN:", domain_val, "n =", nrow(subset_data), "\n") + + # Run Anderson-Darling test + if(nrow(subset_data) >= 7) { + ad_result <- ad.test(subset_data$MEAN_DIFFERENCE) + print(ad_result) + } else { + cat("Sample size too small for Anderson-Darling test\n") + } + cat("\n") +} + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110402.r b/.history/eohi1/mixed anova - domain means_20250915110402.r new file mode 100644 index 0000000..24f5e51 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110402.r @@ -0,0 +1,417 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Function to bootstrap critical values for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Debug: Check for zero or invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + cat("Warning: Invalid observed variances detected:", observed_vars, "\n") + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- calculate_hartley_ratio(observed_vars) + + # Bootstrap under null hypothesis (equal variances) + # Bootstrap from each group independently to create natural variation + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] # Remove any NA values + }) + + # Bootstrap F-max ratios under null hypothesis + bootstrap_ratios <- replicate(n_iter, { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + calculate_hartley_ratio(sample_vars) + }) + + # Calculate critical value (95th percentile) + # Remove any NaN or infinite values + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + # Debug: Check what's happening + cat("Total bootstrap ratios:", length(bootstrap_ratios), "\n") + cat("Valid bootstrap ratios:", length(valid_ratios), "\n") + cat("Sample of bootstrap ratios:", head(bootstrap_ratios, 5), "\n") + cat("Sample of valid ratios:", head(valid_ratios, 5), "\n") + + if(length(valid_ratios) == 0) { + cat("All bootstrap ratios were invalid. Sample ratios:", head(bootstrap_ratios, 10), "\n") + stop("No valid bootstrap ratios generated") + } + + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + bootstrap_ratios = bootstrap_ratios + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110435.r b/.history/eohi1/mixed anova - domain means_20250915110435.r new file mode 100644 index 0000000..f3d3f29 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110435.r @@ -0,0 +1,412 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110448.r b/.history/eohi1/mixed anova - domain means_20250915110448.r new file mode 100644 index 0000000..059442a --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110448.r @@ -0,0 +1,405 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110457.r b/.history/eohi1/mixed anova - domain means_20250915110457.r new file mode 100644 index 0000000..1fc775c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110457.r @@ -0,0 +1,405 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110504.r b/.history/eohi1/mixed anova - domain means_20250915110504.r new file mode 100644 index 0000000..990fdcc --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110504.r @@ -0,0 +1,385 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110508.r b/.history/eohi1/mixed anova - domain means_20250915110508.r new file mode 100644 index 0000000..b5d40f5 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110508.r @@ -0,0 +1,385 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +# Get the actual TEMPORAL_DO levels +temporal_levels <- sort(unique(long_data_clean$TEMPORAL_DO)) +print(paste("TEMPORAL_DO levels:", paste(temporal_levels, collapse = ", "))) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110512.r b/.history/eohi1/mixed anova - domain means_20250915110512.r new file mode 100644 index 0000000..10a03bb --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110512.r @@ -0,0 +1,381 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN combination ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110518.r b/.history/eohi1/mixed anova - domain means_20250915110518.r new file mode 100644 index 0000000..ec24da1 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110518.r @@ -0,0 +1,381 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +print("\nEffect Sizes (Generalized Eta Squared):") +print("Note: Effect sizes will be calculated from the ANOVA summary") + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110521.r b/.history/eohi1/mixed anova - domain means_20250915110521.r new file mode 100644 index 0000000..b6661b8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110521.r @@ -0,0 +1,380 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110535.r b/.history/eohi1/mixed anova - domain means_20250915110535.r new file mode 100644 index 0000000..41072de --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110535.r @@ -0,0 +1,381 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + n_groups <- length(groups) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110539.r b/.history/eohi1/mixed anova - domain means_20250915110539.r new file mode 100644 index 0000000..b70cdbd --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110539.r @@ -0,0 +1,380 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915110547.r b/.history/eohi1/mixed anova - domain means_20250915110547.r new file mode 100644 index 0000000..b70cdbd --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915110547.r @@ -0,0 +1,380 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915111101.r b/.history/eohi1/mixed anova - domain means_20250915111101.r new file mode 100644 index 0000000..3104b92 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915111101.r @@ -0,0 +1,383 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915111110.r b/.history/eohi1/mixed anova - domain means_20250915111110.r new file mode 100644 index 0000000..3104b92 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915111110.r @@ -0,0 +1,383 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915111114.r b/.history/eohi1/mixed anova - domain means_20250915111114.r new file mode 100644 index 0000000..3104b92 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915111114.r @@ -0,0 +1,383 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Use pivot_longer for efficient reshaping + long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(domain_mapping$variable)) %>% + pivot_longer( + cols = all_of(domain_mapping$variable), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(-variable) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915111252.r b/.history/eohi1/mixed anova - domain means_20250915111252.r new file mode 100644 index 0000000..d39dd78 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915111252.r @@ -0,0 +1,395 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting using tidyr +pivot_domain_means <- function(data, domain_mapping) { + # Create long data frame more efficiently + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915111308.r b/.history/eohi1/mixed anova - domain means_20250915111308.r new file mode 100644 index 0000000..8e19166 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915111308.r @@ -0,0 +1,409 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915111314.r b/.history/eohi1/mixed anova - domain means_20250915111314.r new file mode 100644 index 0000000..8e19166 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915111314.r @@ -0,0 +1,409 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112435.r b/.history/eohi1/mixed anova - domain means_20250915112435.r new file mode 100644 index 0000000..8e19166 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112435.r @@ -0,0 +1,409 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112521.r b/.history/eohi1/mixed anova - domain means_20250915112521.r new file mode 100644 index 0000000..ca257a2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112521.r @@ -0,0 +1,409 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112528.r b/.history/eohi1/mixed anova - domain means_20250915112528.r new file mode 100644 index 0000000..ca257a2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112528.r @@ -0,0 +1,409 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112533.r b/.history/eohi1/mixed anova - domain means_20250915112533.r new file mode 100644 index 0000000..ca257a2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112533.r @@ -0,0 +1,409 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +print(round(normality_results, 5)) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112607.r b/.history/eohi1/mixed anova - domain means_20250915112607.r new file mode 100644 index 0000000..99233f6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112607.r @@ -0,0 +1,412 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112612.r b/.history/eohi1/mixed anova - domain means_20250915112612.r new file mode 100644 index 0000000..99233f6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112612.r @@ -0,0 +1,412 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915112617.r b/.history/eohi1/mixed anova - domain means_20250915112617.r new file mode 100644 index 0000000..99233f6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915112617.r @@ -0,0 +1,412 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915113543.r b/.history/eohi1/mixed anova - domain means_20250915113543.r new file mode 100644 index 0000000..ee2fa41 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915113543.r @@ -0,0 +1,447 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915113742.r b/.history/eohi1/mixed anova - domain means_20250915113742.r new file mode 100644 index 0000000..fa3699f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915113742.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915113749.r b/.history/eohi1/mixed anova - domain means_20250915113749.r new file mode 100644 index 0000000..fa3699f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915113749.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915114518.r b/.history/eohi1/mixed anova - domain means_20250915114518.r new file mode 100644 index 0000000..fa3699f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915114518.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915114619.r b/.history/eohi1/mixed anova - domain means_20250915114619.r new file mode 100644 index 0000000..b54e0f7 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915114619.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +# mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# print("Mixed ANOVA Results:") +# print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915114727.r b/.history/eohi1/mixed anova - domain means_20250915114727.r new file mode 100644 index 0000000..737ad9c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915114727.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +# mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), +# data = long_data_clean) + +# print("Mixed ANOVA Results:") +# print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915114729.r b/.history/eohi1/mixed anova - domain means_20250915114729.r new file mode 100644 index 0000000..737ad9c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915114729.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +# mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), +# data = long_data_clean) + +# print("Mixed ANOVA Results:") +# print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915114731.r b/.history/eohi1/mixed anova - domain means_20250915114731.r new file mode 100644 index 0000000..737ad9c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915114731.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +# mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), +# data = long_data_clean) + +# print("Mixed ANOVA Results:") +# print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915114817.r b/.history/eohi1/mixed anova - domain means_20250915114817.r new file mode 100644 index 0000000..4f6be66 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915114817.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +# mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), +# data = long_data_clean) + +# print("Mixed ANOVA Results:") +# print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +# anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915115032.r b/.history/eohi1/mixed anova - domain means_20250915115032.r new file mode 100644 index 0000000..fa3699f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915115032.r @@ -0,0 +1,477 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120001.r b/.history/eohi1/mixed anova - domain means_20250915120001.r new file mode 100644 index 0000000..a6a73cc --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120001.r @@ -0,0 +1,544 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120010.r b/.history/eohi1/mixed anova - domain means_20250915120010.r new file mode 100644 index 0000000..a6a73cc --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120010.r @@ -0,0 +1,544 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120029.r b/.history/eohi1/mixed anova - domain means_20250915120029.r new file mode 100644 index 0000000..928f4b9 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120029.r @@ -0,0 +1,612 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120039.r b/.history/eohi1/mixed anova - domain means_20250915120039.r new file mode 100644 index 0000000..928f4b9 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120039.r @@ -0,0 +1,612 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120050.r b/.history/eohi1/mixed anova - domain means_20250915120050.r new file mode 100644 index 0000000..928f4b9 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120050.r @@ -0,0 +1,612 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# Effect sizes will be calculated separately + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120848.r b/.history/eohi1/mixed anova - domain means_20250915120848.r new file mode 100644 index 0000000..8dd7462 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120848.r @@ -0,0 +1,659 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120855.r b/.history/eohi1/mixed anova - domain means_20250915120855.r new file mode 100644 index 0000000..8dd7462 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120855.r @@ -0,0 +1,659 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915120900.r b/.history/eohi1/mixed anova - domain means_20250915120900.r new file mode 100644 index 0000000..8dd7462 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915120900.r @@ -0,0 +1,659 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121033.r b/.history/eohi1/mixed anova - domain means_20250915121033.r new file mode 100644 index 0000000..c872f59 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121033.r @@ -0,0 +1,685 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections available - checking if sphericity is met") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121043.r b/.history/eohi1/mixed anova - domain means_20250915121043.r new file mode 100644 index 0000000..35fe930 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121043.r @@ -0,0 +1,736 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections available - checking if sphericity is met") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: MANUAL EPSILON CALCULATIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== MANUAL EPSILON CALCULATIONS ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121049.r b/.history/eohi1/mixed anova - domain means_20250915121049.r new file mode 100644 index 0000000..35fe930 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121049.r @@ -0,0 +1,736 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections available - checking if sphericity is met") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: MANUAL EPSILON CALCULATIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== MANUAL EPSILON CALCULATIONS ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121051.r b/.history/eohi1/mixed anova - domain means_20250915121051.r new file mode 100644 index 0000000..35fe930 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121051.r @@ -0,0 +1,736 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections available - checking if sphericity is met") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: MANUAL EPSILON CALCULATIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== MANUAL EPSILON CALCULATIONS ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121136.r b/.history/eohi1/mixed anova - domain means_20250915121136.r new file mode 100644 index 0000000..4c43b96 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121136.r @@ -0,0 +1,745 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: MANUAL EPSILON CALCULATIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== MANUAL EPSILON CALCULATIONS ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121141.r b/.history/eohi1/mixed anova - domain means_20250915121141.r new file mode 100644 index 0000000..2c498e6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121141.r @@ -0,0 +1,745 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121152.r b/.history/eohi1/mixed anova - domain means_20250915121152.r new file mode 100644 index 0000000..60fdf68 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121152.r @@ -0,0 +1,774 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121201.r b/.history/eohi1/mixed anova - domain means_20250915121201.r new file mode 100644 index 0000000..60fdf68 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121201.r @@ -0,0 +1,774 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121212.r b/.history/eohi1/mixed anova - domain means_20250915121212.r new file mode 100644 index 0000000..60fdf68 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121212.r @@ -0,0 +1,774 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915121317.r b/.history/eohi1/mixed anova - domain means_20250915121317.r new file mode 100644 index 0000000..60fdf68 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915121317.r @@ -0,0 +1,774 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# More efficient data pivoting (avoiding pivot_longer issues) +pivot_domain_means <- function(data, domain_mapping) { + # Pre-allocate the result data frame for better performance + n_rows <- nrow(data) * nrow(domain_mapping) + long_data <- data.frame( + pID = character(n_rows), + ResponseId = character(n_rows), + TEMPORAL_DO = character(n_rows), + TIME = character(n_rows), + DOMAIN = character(n_rows), + MEAN_DIFFERENCE = numeric(n_rows), + stringsAsFactors = FALSE + ) + + row_idx <- 1 + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Get the number of rows for this variable + n_data_rows <- nrow(data) + + # Fill in the data for this variable + long_data$pID[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$pID) + long_data$ResponseId[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$ResponseId) + long_data$TEMPORAL_DO[row_idx:(row_idx + n_data_rows - 1)] <- as.character(data$TEMPORAL_DO) + long_data$TIME[row_idx:(row_idx + n_data_rows - 1)] <- time_level + long_data$DOMAIN[row_idx:(row_idx + n_data_rows - 1)] <- domain_level + long_data$MEAN_DIFFERENCE[row_idx:(row_idx + n_data_rows - 1)] <- data[[var_name]] + + row_idx <- row_idx + n_data_rows + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915122220.r b/.history/eohi1/mixed anova - domain means_20250915122220.r new file mode 100644 index 0000000..0162fb8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122220.r @@ -0,0 +1,736 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Try different ways to access sphericity corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print(ez_corrected$`Sphericity Corrections`) +} else { + print("No sphericity corrections found in standard ezANOVA output") + print("This may be because ezANOVA doesn't always display corrections") +} + +# Alternative: Get detailed sphericity information +print("\nDetailed Sphericity Information:") +print("Mauchly's Test Results:") +print(ez_corrected$Mauchly) + +# Check if we need to manually apply corrections +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915122231.r b/.history/eohi1/mixed anova - domain means_20250915122231.r new file mode 100644 index 0000000..88698a6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122231.r @@ -0,0 +1,719 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Two-way interactions +print("\nTIME × DOMAIN Interaction:") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +time_domain_contrasts <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_contrasts) + +print("\nTEMPORAL_DO × TIME Interaction:") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +temporal_time_contrasts <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_contrasts) + +print("\nTEMPORAL_DO × DOMAIN Interaction:") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +temporal_domain_contrasts <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_contrasts) + +# Three-way interaction +print("\nTEMPORAL_DO × TIME × DOMAIN Interaction:") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915122243.r b/.history/eohi1/mixed anova - domain means_20250915122243.r new file mode 100644 index 0000000..1c32062 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122243.r @@ -0,0 +1,691 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + diff --git a/.history/eohi1/mixed anova - domain means_20250915122255.r b/.history/eohi1/mixed anova - domain means_20250915122255.r new file mode 100644 index 0000000..834ff6c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122255.r @@ -0,0 +1,750 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Load effsize package for Cohen's d calculations +library(effsize) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122301.r b/.history/eohi1/mixed anova - domain means_20250915122301.r new file mode 100644 index 0000000..094308f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122301.r @@ -0,0 +1,754 @@ +# mixed anova not working +# 12/09/2025 +# add sum contrasts + +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Load required library for sphericity tests +library(ez) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Load effsize package for Cohen's d calculations +library(effsize) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122305.r b/.history/eohi1/mixed anova - domain means_20250915122305.r new file mode 100644 index 0000000..edfb5c8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122305.r @@ -0,0 +1,749 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package +library(car) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Load effsize package for Cohen's d calculations +library(effsize) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122307.r b/.history/eohi1/mixed anova - domain means_20250915122307.r new file mode 100644 index 0000000..914f788 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122307.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Load effectsize package for proper effect size calculations +library(effectsize) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Load effsize package for Cohen's d calculations +library(effsize) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122312.r b/.history/eohi1/mixed anova - domain means_20250915122312.r new file mode 100644 index 0000000..02e6f43 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122312.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Load required libraries for mixed models +library(lme4) +library(lmerTest) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Load effsize package for Cohen's d calculations +library(effsize) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122315.r b/.history/eohi1/mixed anova - domain means_20250915122315.r new file mode 100644 index 0000000..b6eca40 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122315.r @@ -0,0 +1,745 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Mixed models (libraries already loaded) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Load effsize package for Cohen's d calculations +library(effsize) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122318.r b/.history/eohi1/mixed anova - domain means_20250915122318.r new file mode 100644 index 0000000..bebe7e3 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122318.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + group_by(!!sym(group_var)) %>% + summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Mixed models (libraries already loaded) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122328.r b/.history/eohi1/mixed anova - domain means_20250915122328.r new file mode 100644 index 0000000..d3eac74 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122328.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Mixed models (libraries already loaded) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122355.r b/.history/eohi1/mixed anova - domain means_20250915122355.r new file mode 100644 index 0000000..d3eac74 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122355.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Mixed models (libraries already loaded) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122357.r b/.history/eohi1/mixed anova - domain means_20250915122357.r new file mode 100644 index 0000000..d3eac74 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122357.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# ALTERNATIVE: MIXED MODEL USING LMER (FASTER) +# ============================================================================= + +# Mixed models (libraries already loaded) + +print("Running alternative mixed model using lmer()...") +start_time_lmer <- Sys.time() + +# Mixed model approach (much faster than aov with complex error structures) +mixed_lmer_model <- lmer(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + + (1|pID) + (1|pID:TIME) + (1|pID:DOMAIN), + data = long_data_clean) + +end_time_lmer <- Sys.time() +print(paste("lmer model completed in:", round(end_time_lmer - start_time_lmer, 2), "seconds")) + +print("Mixed Model Results (lmer):") +print(summary(mixed_lmer_model)) + +# ANOVA table for lmer model +print("ANOVA Table for Mixed Model:") +print(anova(mixed_lmer_model)) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122438.r b/.history/eohi1/mixed anova - domain means_20250915122438.r new file mode 100644 index 0000000..16cf8fe --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122438.r @@ -0,0 +1,734 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(lme4) # For mixed models +library(lmerTest) # For mixed model significance tests + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122442.r b/.history/eohi1/mixed anova - domain means_20250915122442.r new file mode 100644 index 0000000..1110c1a --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122442.r @@ -0,0 +1,732 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122447.r b/.history/eohi1/mixed anova - domain means_20250915122447.r new file mode 100644 index 0000000..8e18845 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122447.r @@ -0,0 +1,733 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results:") +print(summary(mixed_anova_model)) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122455.r b/.history/eohi1/mixed anova - domain means_20250915122455.r new file mode 100644 index 0000000..2228623 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122455.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122501.r b/.history/eohi1/mixed anova - domain means_20250915122501.r new file mode 100644 index 0000000..2228623 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122501.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122534.r b/.history/eohi1/mixed anova - domain means_20250915122534.r new file mode 100644 index 0000000..e505219 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122534.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122540.r b/.history/eohi1/mixed anova - domain means_20250915122540.r new file mode 100644 index 0000000..e505219 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122540.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122551.r b/.history/eohi1/mixed anova - domain means_20250915122551.r new file mode 100644 index 0000000..e505219 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122551.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Remove any rows with missing values + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122806.r b/.history/eohi1/mixed anova - domain means_20250915122806.r new file mode 100644 index 0000000..a7196b2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122806.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122811.r b/.history/eohi1/mixed anova - domain means_20250915122811.r new file mode 100644 index 0000000..a7196b2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122811.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122819.r b/.history/eohi1/mixed anova - domain means_20250915122819.r new file mode 100644 index 0000000..a7196b2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122819.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122909.r b/.history/eohi1/mixed anova - domain means_20250915122909.r new file mode 100644 index 0000000..c010c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122909.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122915.r b/.history/eohi1/mixed anova - domain means_20250915122915.r new file mode 100644 index 0000000..c010c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122915.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915122919.r b/.history/eohi1/mixed anova - domain means_20250915122919.r new file mode 100644 index 0000000..c010c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915122919.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915132646.r b/.history/eohi1/mixed anova - domain means_20250915132646.r new file mode 100644 index 0000000..c010c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915132646.r @@ -0,0 +1,743 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT PAIRWISE COMPARISONS ===") + +# Extract significant comparisons from three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_pairs <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + temporal_do <- as.character(comparison$TEMPORAL_DO) + time <- as.character(comparison$TIME) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + domain1 <- trimws(contrast_parts[1]) + domain2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + data1 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain1] + + data2 <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do & + long_data_clean$TIME == time & + long_data_clean$DOMAIN == domain2] + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s | %s, %s\n", contrast_name, temporal_do, time)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } +} else { + cat("No significant pairwise comparisons found in three-way interaction.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20250915133137.r b/.history/eohi1/mixed anova - domain means_20250915133137.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915133137.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250915133143.r b/.history/eohi1/mixed anova - domain means_20250915133143.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915133143.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250915133150.r b/.history/eohi1/mixed anova - domain means_20250915133150.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915133150.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250915133657.r b/.history/eohi1/mixed anova - domain means_20250915133657.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915133657.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250915133739.r b/.history/eohi1/mixed anova - domain means_20250915133739.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915133739.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250915133916.r b/.history/eohi1/mixed anova - domain means_20250915133916.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250915133916.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916095306.r b/.history/eohi1/mixed anova - domain means_20250916095306.r new file mode 100644 index 0000000..22df503 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916095306.r @@ -0,0 +1,791 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916100623.r b/.history/eohi1/mixed anova - domain means_20250916100623.r new file mode 100644 index 0000000..a5cb647 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916100623.r @@ -0,0 +1,830 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916100629.r b/.history/eohi1/mixed anova - domain means_20250916100629.r new file mode 100644 index 0000000..a5cb647 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916100629.r @@ -0,0 +1,830 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916100739.r b/.history/eohi1/mixed anova - domain means_20250916100739.r new file mode 100644 index 0000000..a5cb647 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916100739.r @@ -0,0 +1,830 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916104746.r b/.history/eohi1/mixed anova - domain means_20250916104746.r new file mode 100644 index 0000000..851d5c4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916104746.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916104757.r b/.history/eohi1/mixed anova - domain means_20250916104757.r new file mode 100644 index 0000000..851d5c4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916104757.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250916104830.r b/.history/eohi1/mixed anova - domain means_20250916104830.r new file mode 100644 index 0000000..851d5c4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250916104830.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20250917120959.r b/.history/eohi1/mixed anova - domain means_20250917120959.r new file mode 100644 index 0000000..851d5c4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20250917120959.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001163157.r b/.history/eohi1/mixed anova - domain means_20251001163157.r new file mode 100644 index 0000000..851d5c4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001163157.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171405.r b/.history/eohi1/mixed anova - domain means_20251001171405.r new file mode 100644 index 0000000..c290278 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171405.r @@ -0,0 +1,800 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171456.r b/.history/eohi1/mixed anova - domain means_20251001171456.r new file mode 100644 index 0000000..55b5c9f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171456.r @@ -0,0 +1,645 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171513.r b/.history/eohi1/mixed anova - domain means_20251001171513.r new file mode 100644 index 0000000..9cd02f6 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171513.r @@ -0,0 +1,610 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +print("Generalized Eta Squared:") +print(round(effect_sizes, 5)) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171529.r b/.history/eohi1/mixed anova - domain means_20251001171529.r new file mode 100644 index 0000000..ab9719e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171529.r @@ -0,0 +1,614 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +print("Generalized Eta Squared:") +print(round(effect_sizes, 5)) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171548.r b/.history/eohi1/mixed anova - domain means_20251001171548.r new file mode 100644 index 0000000..b2c4c25 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171548.r @@ -0,0 +1,614 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +print("Generalized Eta Squared:") +print(round(effect_sizes, 5)) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171605.r b/.history/eohi1/mixed anova - domain means_20251001171605.r new file mode 100644 index 0000000..4512c36 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171605.r @@ -0,0 +1,614 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +print("Generalized Eta Squared:") +print(round(effect_sizes, 5)) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171616.r b/.history/eohi1/mixed anova - domain means_20251001171616.r new file mode 100644 index 0000000..ce86031 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171616.r @@ -0,0 +1,614 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +print("Generalized Eta Squared:") +print(round(effect_sizes, 5)) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171654.r b/.history/eohi1/mixed anova - domain means_20251001171654.r new file mode 100644 index 0000000..ce86031 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171654.r @@ -0,0 +1,614 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +print("Generalized Eta Squared:") +print(round(effect_sizes, 5)) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171824.r b/.history/eohi1/mixed anova - domain means_20251001171824.r new file mode 100644 index 0000000..ac148bb --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171824.r @@ -0,0 +1,615 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001171840.r b/.history/eohi1/mixed anova - domain means_20251001171840.r new file mode 100644 index 0000000..ac148bb --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001171840.r @@ -0,0 +1,615 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001172039.r b/.history/eohi1/mixed anova - domain means_20251001172039.r new file mode 100644 index 0000000..ac148bb --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001172039.r @@ -0,0 +1,615 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001174736.r b/.history/eohi1/mixed anova - domain means_20251001174736.r new file mode 100644 index 0000000..4c4b463 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001174736.r @@ -0,0 +1,615 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001174748.r b/.history/eohi1/mixed anova - domain means_20251001174748.r new file mode 100644 index 0000000..4c4b463 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001174748.r @@ -0,0 +1,615 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251001174749.r b/.history/eohi1/mixed anova - domain means_20251001174749.r new file mode 100644 index 0000000..4c4b463 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251001174749.r @@ -0,0 +1,615 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +print(mixed_anova_model$ANOVA) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122510.r b/.history/eohi1/mixed anova - domain means_20251003122510.r new file mode 100644 index 0000000..07396db --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122510.r @@ -0,0 +1,617 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122522.r b/.history/eohi1/mixed anova - domain means_20251003122522.r new file mode 100644 index 0000000..613ce86 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122522.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G < 0.001\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G < 0.001\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122534.r b/.history/eohi1/mixed anova - domain means_20251003122534.r new file mode 100644 index 0000000..613ce86 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122534.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G < 0.001\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G < 0.001\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122601.r b/.history/eohi1/mixed anova - domain means_20251003122601.r new file mode 100644 index 0000000..58552be --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122601.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122606.r b/.history/eohi1/mixed anova - domain means_20251003122606.r new file mode 100644 index 0000000..58552be --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122606.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122621.r b/.history/eohi1/mixed anova - domain means_20251003122621.r new file mode 100644 index 0000000..b76a792 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122621.r @@ -0,0 +1,648 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +calculate_cohens_d_for_pairs(three_way_contrasts_df, long_data_clean, "TIME", c("TEMPORAL_DO", "DOMAIN"), "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122630.r b/.history/eohi1/mixed anova - domain means_20251003122630.r new file mode 100644 index 0000000..b76a792 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122630.r @@ -0,0 +1,648 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +calculate_cohens_d_for_pairs(three_way_contrasts_df, long_data_clean, "TIME", c("TEMPORAL_DO", "DOMAIN"), "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003122640.r b/.history/eohi1/mixed anova - domain means_20251003122640.r new file mode 100644 index 0000000..b76a792 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003122640.r @@ -0,0 +1,648 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +calculate_cohens_d_for_pairs(three_way_contrasts_df, long_data_clean, "TIME", c("TEMPORAL_DO", "DOMAIN"), "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - domain means_20251003123628.r b/.history/eohi1/mixed anova - domain means_20251003123628.r new file mode 100644 index 0000000..f1bdf09 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003123628.r @@ -0,0 +1,652 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003123637.r b/.history/eohi1/mixed anova - domain means_20251003123637.r new file mode 100644 index 0000000..f1bdf09 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003123637.r @@ -0,0 +1,652 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124045.r b/.history/eohi1/mixed anova - domain means_20251003124045.r new file mode 100644 index 0000000..f1bdf09 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124045.r @@ -0,0 +1,652 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# Note: Type III ANOVA with sphericity corrections is appropriate for this balanced design. + +# ============================================================================= +# SUMMARY OF KEY FINDINGS +# ============================================================================= + +print("\n=== SUMMARY OF KEY FINDINGS ===") +cat("SIGNIFICANT EFFECTS (p < 0.05):\n") +cat("• TIME main effect: F(1,1061) = 78.80, p < 0.001, η²G = 0.008\n") +cat("• DOMAIN main effect: F(3,3183) = 206.90, p < 0.001, η²G = 0.059\n") +cat("• TEMPORAL_DO × TIME interaction: F(1,1061) = 10.97, p = 0.001, η²G = 0.001\n") +cat("• TIME × DOMAIN interaction: F(3,3183) = 3.65, p = 0.012, η²G = 0.001\n") +cat("\nMARGINAL EFFECTS (p < 0.10):\n") +cat("• TEMPORAL_DO × DOMAIN interaction: F(3,3183) = 2.50, p = 0.058, η²G = 0.001\n") +cat("\nNON-SIGNIFICANT EFFECTS:\n") +cat("• TEMPORAL_DO main effect: F(1,1061) = 0.41, p = 0.524, η²G = 0.00015\n") +cat("• Three-way interaction: F(3,3183) = 0.77, p = 0.511, η²G = 0.00013\n") +cat("\nEFFECT SIZE INTERPRETATION (η²G):\n") +cat("• Large: η²G > 0.14\n") +cat("• Medium: η²G > 0.06\n") +cat("• Small: η²G > 0.01\n") +cat("• Negligible: η²G ≤ 0.01\n") + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124352.r b/.history/eohi1/mixed anova - domain means_20251003124352.r new file mode 100644 index 0000000..b7fee9d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124352.r @@ -0,0 +1,631 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124400.r b/.history/eohi1/mixed anova - domain means_20251003124400.r new file mode 100644 index 0000000..dbacb25 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124400.r @@ -0,0 +1,631 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# Main effect of TIME +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124418.r b/.history/eohi1/mixed anova - domain means_20251003124418.r new file mode 100644 index 0000000..9cee5f0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124418.r @@ -0,0 +1,634 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# Main effect of TIME +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124429.r b/.history/eohi1/mixed anova - domain means_20251003124429.r new file mode 100644 index 0000000..7b657fb --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124429.r @@ -0,0 +1,635 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# Main effect of TIME +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +print("Calculating three-way interaction...") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124453.r b/.history/eohi1/mixed anova - domain means_20251003124453.r new file mode 100644 index 0000000..df84668 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124453.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +print("Calculating three-way interaction...") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124504.r b/.history/eohi1/mixed anova - domain means_20251003124504.r new file mode 100644 index 0000000..bd36651 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124504.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME (FAST: only 2 levels) +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(time_contrasts) + +# Main effect of DOMAIN (FAST: only 4 levels) +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "tukey") # Faster than Bonferroni +print(domain_contrasts) + +# Main effect of TEMPORAL_DO (FAST: only 2 levels) +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +print("Calculating three-way interaction...") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124512.r b/.history/eohi1/mixed anova - domain means_20251003124512.r new file mode 100644 index 0000000..a13fba4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124512.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME (FAST: only 2 levels) +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(time_contrasts) + +# Main effect of DOMAIN (FAST: only 4 levels) +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "tukey") # Faster than Bonferroni +print(domain_contrasts) + +# Main effect of TEMPORAL_DO (FAST: only 2 levels) +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS (OPTIMIZED) +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (FAST: 2×2 = 4 combinations) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "none") # Only 2 levels each +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "none") # Only 2 levels each +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +print("Calculating three-way interaction...") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124527.r b/.history/eohi1/mixed anova - domain means_20251003124527.r new file mode 100644 index 0000000..a5d08d4 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124527.r @@ -0,0 +1,638 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME (FAST: only 2 levels) +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(time_contrasts) + +# Main effect of DOMAIN (FAST: only 4 levels) +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "tukey") # Faster than Bonferroni +print(domain_contrasts) + +# Main effect of TEMPORAL_DO (FAST: only 2 levels) +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS (OPTIMIZED) +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (FAST: 2×2 = 4 combinations) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "none") # Only 2 levels each +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "none") # Only 2 levels each +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "tukey") # Faster than Bonferroni +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "tukey") # Faster than Bonferroni +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +print("Calculating three-way interaction...") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124539.r b/.history/eohi1/mixed anova - domain means_20251003124539.r new file mode 100644 index 0000000..3f04409 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124539.r @@ -0,0 +1,632 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME (FAST: only 2 levels) +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(time_contrasts) + +# Main effect of DOMAIN (FAST: only 4 levels) +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "tukey") # Faster than Bonferroni +print(domain_contrasts) + +# Main effect of TEMPORAL_DO (FAST: only 2 levels) +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS (OPTIMIZED) +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (FAST: 2×2 = 4 combinations) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "none") # Only 2 levels each +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "none") # Only 2 levels each +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "tukey") # Faster than Bonferroni +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "tukey") # Faster than Bonferroni +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SKIP - TOO SLOW) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("SKIPPING three-way interaction calculations due to computational intensity") +print("(2×2×4 = 16 combinations with 8504 observations)") +print("The three-way interaction was non-significant (p = 0.511) anyway") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124544.r b/.history/eohi1/mixed anova - domain means_20251003124544.r new file mode 100644 index 0000000..3f04409 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124544.r @@ -0,0 +1,632 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME (FAST: only 2 levels) +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(time_contrasts) + +# Main effect of DOMAIN (FAST: only 4 levels) +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "tukey") # Faster than Bonferroni +print(domain_contrasts) + +# Main effect of TEMPORAL_DO (FAST: only 2 levels) +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS (OPTIMIZED) +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (FAST: 2×2 = 4 combinations) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "none") # Only 2 levels each +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "none") # Only 2 levels each +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "tukey") # Faster than Bonferroni +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "tukey") # Faster than Bonferroni +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SKIP - TOO SLOW) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("SKIPPING three-way interaction calculations due to computational intensity") +print("(2×2×4 = 16 combinations with 8504 observations)") +print("The three-way interaction was non-significant (p = 0.511) anyway") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124545.r b/.history/eohi1/mixed anova - domain means_20251003124545.r new file mode 100644 index 0000000..3f04409 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124545.r @@ -0,0 +1,632 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS (OPTIMIZED) +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +print("Creating ANOVA model for post-hoc comparisons...") +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) +print("ANOVA model created successfully.") + +# OPTIMIZATION: Use faster adjustment methods and limit calculations +print("Note: Using faster adjustment methods for large dataset...") + +# Main effect of TIME (FAST: only 2 levels) +print("Calculating TIME main effect...") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(time_contrasts) + +# Main effect of DOMAIN (FAST: only 4 levels) +print("\nCalculating DOMAIN main effect...") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "tukey") # Faster than Bonferroni +print(domain_contrasts) + +# Main effect of TEMPORAL_DO (FAST: only 2 levels) +print("\nCalculating TEMPORAL_DO main effect...") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "none") # No adjustment needed for 2 levels +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS (OPTIMIZED) +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (FAST: 2×2 = 4 combinations) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "none") # Only 2 levels each +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "none") # Only 2 levels each +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "tukey") # Faster than Bonferroni +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "tukey") # Faster than Bonferroni +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SKIP - TOO SLOW) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("SKIPPING three-way interaction calculations due to computational intensity") +print("(2×2×4 = 16 combinations with 8504 observations)") +print("The three-way interaction was non-significant (p = 0.511) anyway") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124614.r b/.history/eohi1/mixed anova - domain means_20251003124614.r new file mode 100644 index 0000000..f023c9d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124614.r @@ -0,0 +1,627 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS (OPTIMIZED) +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (FAST: 2×2 = 4 combinations) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +print("Calculating TEMPORAL_DO × TIME interaction...") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "none") # Only 2 levels each +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "none") # Only 2 levels each +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TIME × DOMAIN INTERACTION ===") +print("Calculating TIME × DOMAIN interaction...") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "tukey") # Faster than Bonferroni +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (SLOWER: 2×4 = 8 combinations) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +print("Calculating TEMPORAL_DO × DOMAIN interaction...") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "tukey") # Faster than Bonferroni +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "none") # Only 2 levels each +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SKIP - TOO SLOW) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("SKIPPING three-way interaction calculations due to computational intensity") +print("(2×2×4 = 16 combinations with 8504 observations)") +print("The three-way interaction was non-significant (p = 0.511) anyway") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124632.r b/.history/eohi1/mixed anova - domain means_20251003124632.r new file mode 100644 index 0000000..bf4bf61 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124632.r @@ -0,0 +1,624 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SKIP - TOO SLOW) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("SKIPPING three-way interaction calculations due to computational intensity") +print("(2×2×4 = 16 combinations with 8504 observations)") +print("The three-way interaction was non-significant (p = 0.511) anyway") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124639.r b/.history/eohi1/mixed anova - domain means_20251003124639.r new file mode 100644 index 0000000..409f80b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124639.r @@ -0,0 +1,629 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124643.r b/.history/eohi1/mixed anova - domain means_20251003124643.r new file mode 100644 index 0000000..409f80b --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124643.r @@ -0,0 +1,629 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# For three-way interaction, we need to handle the multiple grouping variables differently +print("Three-way interaction Cohen's d calculations:") +print("Note: Cohen's d for three-way interactions requires more complex calculations") +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + diff --git a/.history/eohi1/mixed anova - domain means_20251003124942.r b/.history/eohi1/mixed anova - domain means_20251003124942.r new file mode 100644 index 0000000..b848014 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124942.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003124948.r b/.history/eohi1/mixed anova - domain means_20251003124948.r new file mode 100644 index 0000000..b848014 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124948.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003124952.r b/.history/eohi1/mixed anova - domain means_20251003124952.r new file mode 100644 index 0000000..b848014 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003124952.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons of TIME (Past vs Future) within each TEMPORAL_DO × DOMAIN combination +print("\nPairwise comparisons of TIME (Past - Future) within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003125302.r b/.history/eohi1/mixed anova - domain means_20251003125302.r new file mode 100644 index 0000000..e26328d --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003125302.r @@ -0,0 +1,665 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003125335.r b/.history/eohi1/mixed anova - domain means_20251003125335.r new file mode 100644 index 0000000..c079049 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003125335.r @@ -0,0 +1,668 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003130013.r b/.history/eohi1/mixed anova - domain means_20251003130013.r new file mode 100644 index 0000000..c079049 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003130013.r @@ -0,0 +1,668 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003130111.r b/.history/eohi1/mixed anova - domain means_20251003130111.r new file mode 100644 index 0000000..c079049 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003130111.r @@ -0,0 +1,668 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134651.r b/.history/eohi1/mixed anova - domain means_20251003134651.r new file mode 100644 index 0000000..8b09bf7 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134651.r @@ -0,0 +1,728 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134713.r b/.history/eohi1/mixed anova - domain means_20251003134713.r new file mode 100644 index 0000000..8b09bf7 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134713.r @@ -0,0 +1,728 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134732.r b/.history/eohi1/mixed anova - domain means_20251003134732.r new file mode 100644 index 0000000..fa78b47 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134732.r @@ -0,0 +1,744 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # First, show main effects (no sphericity corrections needed) + main_effects <- c("TIME", "DOMAIN", "TEMPORAL_DO") + for(effect in main_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + } + + # Then show within-subjects effects with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134803.r b/.history/eohi1/mixed anova - domain means_20251003134803.r new file mode 100644 index 0000000..cf25c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134803.r @@ -0,0 +1,766 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134813.r b/.history/eohi1/mixed anova - domain means_20251003134813.r new file mode 100644 index 0000000..cf25c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134813.r @@ -0,0 +1,766 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134814.r b/.history/eohi1/mixed anova - domain means_20251003134814.r new file mode 100644 index 0000000..cf25c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134814.r @@ -0,0 +1,766 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003134857.r b/.history/eohi1/mixed anova - domain means_20251003134857.r new file mode 100644 index 0000000..cf25c5e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003134857.r @@ -0,0 +1,766 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003135506.r b/.history/eohi1/mixed anova - domain means_20251003135506.r new file mode 100644 index 0000000..34a6b8c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003135506.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003135510.r b/.history/eohi1/mixed anova - domain means_20251003135510.r new file mode 100644 index 0000000..dc9d744 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003135510.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003135514.r b/.history/eohi1/mixed anova - domain means_20251003135514.r new file mode 100644 index 0000000..0e59b24 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003135514.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003140001.r b/.history/eohi1/mixed anova - domain means_20251003140001.r new file mode 100644 index 0000000..0e59b24 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003140001.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003140127.r b/.history/eohi1/mixed anova - domain means_20251003140127.r new file mode 100644 index 0000000..0e59b24 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003140127.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003140135.r b/.history/eohi1/mixed anova - domain means_20251003140135.r new file mode 100644 index 0000000..0e59b24 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003140135.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003140812.r b/.history/eohi1/mixed anova - domain means_20251003140812.r new file mode 100644 index 0000000..c588532 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003140812.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define reversed levels for TIME +reversed_levels <- rev(sort(unique(long_data_clean$TIME))) + +# Prepare raw data with reversed TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + xmax = as.numeric(TIME) + 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 3, stroke = 1, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003140821.r b/.history/eohi1/mixed anova - domain means_20251003140821.r new file mode 100644 index 0000000..c588532 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003140821.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define reversed levels for TIME +reversed_levels <- rev(sort(unique(long_data_clean$TIME))) + +# Prepare raw data with reversed TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + xmax = as.numeric(TIME) + 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 3, stroke = 1, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003141902.r b/.history/eohi1/mixed anova - domain means_20251003141902.r new file mode 100644 index 0000000..0e59b24 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003141902.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003141926.r b/.history/eohi1/mixed anova - domain means_20251003141926.r new file mode 100644 index 0000000..c588532 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003141926.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define reversed levels for TIME +reversed_levels <- rev(sort(unique(long_data_clean$TIME))) + +# Prepare raw data with reversed TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + xmax = as.numeric(TIME) + 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 3, stroke = 1, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142537.r b/.history/eohi1/mixed anova - domain means_20251003142537.r new file mode 100644 index 0000000..55f6424 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142537.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (no reversal) +time_levels <- sort(unique(long_data_clean$TIME)) + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = reversed_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + xmax = as.numeric(TIME) + 0.1 + (as.numeric(DOMAIN) - 2.5) * 0.3, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.3, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 3, stroke = 1, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142630.r b/.history/eohi1/mixed anova - domain means_20251003142630.r new file mode 100644 index 0000000..03b5050 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142630.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TIME) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 1.5, stroke = 0.5, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142635.r b/.history/eohi1/mixed anova - domain means_20251003142635.r new file mode 100644 index 0000000..03b5050 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142635.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TIME) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 1.5, stroke = 0.5, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142645.r b/.history/eohi1/mixed anova - domain means_20251003142645.r new file mode 100644 index 0000000..03b5050 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142645.r @@ -0,0 +1,865 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +print("\n=== CREATING INTERACTION PLOT ===") + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TIME) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 1.5, stroke = 0.5, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142752.r b/.history/eohi1/mixed anova - domain means_20251003142752.r new file mode 100644 index 0000000..36ef388 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142752.r @@ -0,0 +1,863 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + xmax = as.numeric(TIME) + 0.15 + (as.numeric(DOMAIN) - 2.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.25, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 1.5, stroke = 0.5, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142806.r b/.history/eohi1/mixed anova - domain means_20251003142806.r new file mode 100644 index 0000000..492ef88 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142806.r @@ -0,0 +1,863 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003142812.r b/.history/eohi1/mixed anova - domain means_20251003142812.r new file mode 100644 index 0000000..492ef88 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003142812.r @@ -0,0 +1,863 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251003143103.r b/.history/eohi1/mixed anova - domain means_20251003143103.r new file mode 100644 index 0000000..492ef88 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251003143103.r @@ -0,0 +1,863 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Domain mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS (SIMPLIFIED) +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +print("Note: Three-way interaction was non-significant (p = 0.511)") +print("Skipping detailed three-way comparisons due to computational intensity") +print("Focus on the significant two-way interactions above.") + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (significant: p < 0.001) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION PLOT +# ============================================================================= + +# Load ggplot2 for plotting (if not already loaded) +library(ggplot2) + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# Prepare raw data with standard TIME levels +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, TEMPORAL_DO, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create estimated marginal means for the interaction plot +emm_full <- emmeans(aov_model, ~ DOMAIN | TIME * TEMPORAL_DO) + +# Convert EMMs to data frame and prepare for plotting +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + TEMPORAL_DO = factor(TEMPORAL_DO) + ) + +# Create the interaction plot +interaction_plot2 <- ggplot() + + # Raw data: regular circles, color only + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + # EMMs: bold points, distinctive by color and shape + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + facet_wrap(~ TEMPORAL_DO, ncol = 2) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction by TEMPORAL_DO", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +# three_way_contrasts_df <- as.data.frame(three_way_contrasts) +# print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +# print(three_way_contrasts_df) +print("Note: Three-way interaction was non-significant (p = 0.511), so detailed comparisons were not performed.") + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +# significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(FALSE) { # Three-way interaction was non-significant, so skip this section + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + diff --git a/.history/eohi1/mixed anova - domain means_20251004194541.r b/.history/eohi1/mixed anova - domain means_20251004194541.r new file mode 100644 index 0000000..ec09360 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251004194541.r @@ -0,0 +1,578 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOT + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") +# Create estimated marginal means for DOMAIN x TIME +emm_full <- emmeans(aov_model, ~ DOMAIN * TIME) + +# Prepare emmeans data frame as before +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Plot without TEMPORAL_DO facet +interaction_plot2 <- ggplot() + + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) diff --git a/.history/eohi1/mixed anova - domain means_20251006125951.r b/.history/eohi1/mixed anova - domain means_20251006125951.r new file mode 100644 index 0000000..ec09360 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006125951.r @@ -0,0 +1,578 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOT + +# Define color palette for DOMAIN (4 levels) +cbp1 <- c("#648FFF", "#DC267F", "#FFB000", "#FE6100", "#785EF0") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") +# Create estimated marginal means for DOMAIN x TIME +emm_full <- emmeans(aov_model, ~ DOMAIN * TIME) + +# Prepare emmeans data frame as before +emmeans_data2 <- emm_full %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +iPlot <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Plot without TEMPORAL_DO facet +interaction_plot2 <- ggplot() + + geom_point( + data = iPlot, + aes(x = TIME, y = MEAN_DIFFERENCE, color = DOMAIN), + position = position_jitterdodge(dodge.width = 0.75, jitter.width = 0.2), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_data2, + aes( + xmin = as.numeric(TIME) - 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + xmax = as.numeric(TIME) + 0.08 + (as.numeric(DOMAIN) - 2.5) * 0.15, + ymin = ci_lower, ymax = ci_upper, + fill = DOMAIN + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + xend = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_data2, + aes( + x = as.numeric(TIME) + (as.numeric(DOMAIN) - 2.5) * 0.15, + y = plot_mean, + color = DOMAIN, + shape = DOMAIN + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TIME", y = "Mean Difference", + title = "DOMAIN × TIME Interaction", subtitle = "" + ) + + scale_color_manual(name = "DOMAIN", values = cbp1) + + scale_fill_manual(name = "DOMAIN", values = cbp1) + + scale_shape_manual(name = "DOMAIN", values = c(21, 22, 23, 24)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5), + plot.subtitle = element_text(size = 12, hjust = 0.5) + ) + +print(interaction_plot2) diff --git a/.history/eohi1/mixed anova - domain means_20251006131233.r b/.history/eohi1/mixed anova - domain means_20251006131233.r new file mode 100644 index 0000000..0232633 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006131233.r @@ -0,0 +1,666 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006131245.r b/.history/eohi1/mixed anova - domain means_20251006131245.r new file mode 100644 index 0000000..0232633 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006131245.r @@ -0,0 +1,666 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006142529.r b/.history/eohi1/mixed anova - domain means_20251006142529.r new file mode 100644 index 0000000..0232633 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006142529.r @@ -0,0 +1,666 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006142637.r b/.history/eohi1/mixed anova - domain means_20251006142637.r new file mode 100644 index 0000000..e840311 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006142637.r @@ -0,0 +1,669 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006142646.r b/.history/eohi1/mixed anova - domain means_20251006142646.r new file mode 100644 index 0000000..6011f6e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006142646.r @@ -0,0 +1,681 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006142658.r b/.history/eohi1/mixed anova - domain means_20251006142658.r new file mode 100644 index 0000000..6011f6e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006142658.r @@ -0,0 +1,681 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006142703.r b/.history/eohi1/mixed anova - domain means_20251006142703.r new file mode 100644 index 0000000..6011f6e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006142703.r @@ -0,0 +1,681 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006145249.r b/.history/eohi1/mixed anova - domain means_20251006145249.r new file mode 100644 index 0000000..6011f6e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006145249.r @@ -0,0 +1,681 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_point( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_temporal_time, + aes( + xmin = as.numeric(TEMPORAL_DO) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(TEMPORAL_DO) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006152026.r b/.history/eohi1/mixed anova - domain means_20251006152026.r new file mode 100644 index 0000000..4eb3a79 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006152026.r @@ -0,0 +1,671 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_point( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, color = TIME), + position = position_jitterdodge(dodge.width = 0.5, jitter.width = 0.15), + alpha = 0.3, shape = 16 + ) + + geom_rect( + data = emmeans_time_domain, + aes( + xmin = as.numeric(DOMAIN) - 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + xmax = as.numeric(DOMAIN) + 0.15 + (as.numeric(TIME) - 1.5) * 0.25, + ymin = ci_lower, ymax = ci_upper, + fill = TIME + ), + color = "black", alpha = 0.5 + ) + + geom_segment( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + xend = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = ci_lower, yend = ci_upper + ), + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.25, + y = plot_mean, + color = TIME, + shape = TIME + ), + size = 2.5, stroke = 0.8, fill = "black" + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006152038.r b/.history/eohi1/mixed anova - domain means_20251006152038.r new file mode 100644 index 0000000..0dcf572 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006152038.r @@ -0,0 +1,661 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006152054.r b/.history/eohi1/mixed anova - domain means_20251006152054.r new file mode 100644 index 0000000..0dcf572 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006152054.r @@ -0,0 +1,661 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006153456.r b/.history/eohi1/mixed anova - domain means_20251006153456.r new file mode 100644 index 0000000..0dcf572 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006153456.r @@ -0,0 +1,661 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = TEMPORAL_DO, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes( + x = as.numeric(TEMPORAL_DO) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "TEMPORAL_DO", y = "Mean Difference", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006155838.r b/.history/eohi1/mixed anova - domain means_20251006155838.r new file mode 100644 index 0000000..856ed60 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006155838.r @@ -0,0 +1,682 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = DOMAIN, y = MEAN_DIFFERENCE, fill = TIME), + position = position_dodge(width = 0.7), + alpha = 0.5, + color = "black", + trim = FALSE + ) + + geom_point( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + y = plot_mean, + color = TIME + ), + size = 3, shape = 18 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes( + x = as.numeric(DOMAIN) + (as.numeric(TIME) - 1.5) * 0.35, + ymin = ci_lower, ymax = ci_upper, + color = TIME + ), + width = 0.1, linewidth = 0.8 + ) + + labs( + x = "DOMAIN", y = "Mean Difference", + title = "TIME × DOMAIN Interaction" + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, hjust = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006155859.r b/.history/eohi1/mixed anova - domain means_20251006155859.r new file mode 100644 index 0000000..c4ac77e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006155859.r @@ -0,0 +1,704 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006155915.r b/.history/eohi1/mixed anova - domain means_20251006155915.r new file mode 100644 index 0000000..c4ac77e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006155915.r @@ -0,0 +1,704 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006155938.r b/.history/eohi1/mixed anova - domain means_20251006155938.r new file mode 100644 index 0000000..c4ac77e --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006155938.r @@ -0,0 +1,704 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) diff --git a/.history/eohi1/mixed anova - domain means_20251006162736.r b/.history/eohi1/mixed anova - domain means_20251006162736.r new file mode 100644 index 0000000..7305661 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006162736.r @@ -0,0 +1,763 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Reuse emmeans data from Plot 1 +emmeans_temporal_time_simple <- emmeans_temporal_time %>% + mutate( + TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + ), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006162743.r b/.history/eohi1/mixed anova - domain means_20251006162743.r new file mode 100644 index 0000000..7305661 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006162743.r @@ -0,0 +1,763 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Reuse emmeans data from Plot 1 +emmeans_temporal_time_simple <- emmeans_temporal_time %>% + mutate( + TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + ), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006162748.r b/.history/eohi1/mixed anova - domain means_20251006162748.r new file mode 100644 index 0000000..7305661 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006162748.r @@ -0,0 +1,763 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Reuse emmeans data from Plot 1 +emmeans_temporal_time_simple <- emmeans_temporal_time %>% + mutate( + TEMPORAL_DO_label = factor( + TEMPORAL_DO, + levels = c("01PAST", "02FUT"), + labels = c("Past First", "Future First") + ), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006162833.r b/.history/eohi1/mixed anova - domain means_20251006162833.r new file mode 100644 index 0000000..da083dc --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006162833.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006162839.r b/.history/eohi1/mixed anova - domain means_20251006162839.r new file mode 100644 index 0000000..da083dc --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006162839.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006162940.r b/.history/eohi1/mixed anova - domain means_20251006162940.r new file mode 100644 index 0000000..da083dc --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006162940.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006181905.r b/.history/eohi1/mixed anova - domain means_20251006181905.r new file mode 100644 index 0000000..faf5d80 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006181905.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006181908.r b/.history/eohi1/mixed anova - domain means_20251006181908.r new file mode 100644 index 0000000..faf5d80 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006181908.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006181914.r b/.history/eohi1/mixed anova - domain means_20251006181914.r new file mode 100644 index 0000000..b31d839 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006181914.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "TIME", values = time_colors) + + scale_fill_manual(name = "TIME", values = time_colors) + + scale_shape_manual(name = "TIME", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006181923.r b/.history/eohi1/mixed anova - domain means_20251006181923.r new file mode 100644 index 0000000..214d37f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006181923.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006181934.r b/.history/eohi1/mixed anova - domain means_20251006181934.r new file mode 100644 index 0000000..214d37f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006181934.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006181935.r b/.history/eohi1/mixed anova - domain means_20251006181935.r new file mode 100644 index 0000000..214d37f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006181935.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006183415.r b/.history/eohi1/mixed anova - domain means_20251006183415.r new file mode 100644 index 0000000..214d37f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006183415.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006223538.r b/.history/eohi1/mixed anova - domain means_20251006223538.r new file mode 100644 index 0000000..214d37f --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006223538.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) diff --git a/.history/eohi1/mixed anova - domain means_20251006225002.r b/.history/eohi1/mixed anova - domain means_20251006225002.r new file mode 100644 index 0000000..795012c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225002.r @@ -0,0 +1,864 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) +interaction_plot_time_domain_plot4 <- ggplot() + + geom_violin( + data = iPlot_plot4, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_plot4 / 2 + ) + + geom_errorbar( + data = emmeans_time_domain_plot4, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain_plot4, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis)", + fill = "Temporal Direction", + shape = "Temporal Direction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225006.r b/.history/eohi1/mixed anova - domain means_20251006225006.r new file mode 100644 index 0000000..795012c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225006.r @@ -0,0 +1,864 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) +interaction_plot_time_domain_plot4 <- ggplot() + + geom_violin( + data = iPlot_plot4, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_plot4 / 2 + ) + + geom_errorbar( + data = emmeans_time_domain_plot4, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain_plot4, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis)", + fill = "Temporal Direction", + shape = "Temporal Direction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225025.r b/.history/eohi1/mixed anova - domain means_20251006225025.r new file mode 100644 index 0000000..795012c --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225025.r @@ -0,0 +1,864 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) +interaction_plot_time_domain_plot4 <- ggplot() + + geom_violin( + data = iPlot_plot4, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_plot4 / 2 + ) + + geom_errorbar( + data = emmeans_time_domain_plot4, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain_plot4, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis)", + fill = "Temporal Direction", + shape = "Temporal Direction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225127.r b/.history/eohi1/mixed anova - domain means_20251006225127.r new file mode 100644 index 0000000..850f677 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225127.r @@ -0,0 +1,853 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis)", + fill = "Temporal Direction", + shape = "Temporal Direction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225134.r b/.history/eohi1/mixed anova - domain means_20251006225134.r new file mode 100644 index 0000000..85ad0c2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225134.r @@ -0,0 +1,852 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225138.r b/.history/eohi1/mixed anova - domain means_20251006225138.r new file mode 100644 index 0000000..85ad0c2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225138.r @@ -0,0 +1,852 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225148.r b/.history/eohi1/mixed anova - domain means_20251006225148.r new file mode 100644 index 0000000..85ad0c2 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225148.r @@ -0,0 +1,852 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.5 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251006225428.r b/.history/eohi1/mixed anova - domain means_20251006225428.r new file mode 100644 index 0000000..ae360b0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251006225428.r @@ -0,0 +1,852 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007155303.r b/.history/eohi1/mixed anova - domain means_20251007155303.r new file mode 100644 index 0000000..ae360b0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007155303.r @@ -0,0 +1,852 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + +# ============================================================ +# PLOT 1: TEMPORAL_DO × TIME INTERACTION +# ============================================================ + +# Create estimated marginal means for TEMPORAL_DO × TIME +emm_temporal_time <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +# Prepare emmeans data frame +emmeans_temporal_time <- emm_temporal_time %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_temporal <- 0.5 +iPlot_temporal <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, TIME, MEAN_DIFFERENCE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +emmeans_temporal_time <- emmeans_temporal_time %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_temporal, + x_dodged = x_pos + time_offset + ) + +# Create TEMPORAL_DO × TIME interaction plot +interaction_plot_temporal <- ggplot() + + geom_violin( + data = iPlot_temporal, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_temporal / 2 + ) + + geom_errorbar( + data = emmeans_temporal_time, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_temporal_time, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal) + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162057.r b/.history/eohi1/mixed anova - domain means_20251007162057.r new file mode 100644 index 0000000..5e40915 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162057.r @@ -0,0 +1,761 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162101.r b/.history/eohi1/mixed anova - domain means_20251007162101.r new file mode 100644 index 0000000..5e40915 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162101.r @@ -0,0 +1,761 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + +# ============================================================ +# PLOT 2: TIME × DOMAIN INTERACTION (DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN +emm_time_domain <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_time_domain <- emm_time_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_domain <- 0.5 +iPlot_domain <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain <- emmeans_time_domain %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_domain, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot +interaction_plot_domain <- ggplot() + + geom_violin( + data = iPlot_domain, + aes(x = x_dodged, y = MEAN_DIFFERENCE, fill = TIME, group = interaction(x_pos, TIME)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width_domain / 2 + ) + + geom_errorbar( + data = emmeans_time_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + geom_point( + data = emmeans_time_domain, + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_domain) + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162111.r b/.history/eohi1/mixed anova - domain means_20251007162111.r new file mode 100644 index 0000000..6e5cdc0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162111.r @@ -0,0 +1,669 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162115.r b/.history/eohi1/mixed anova - domain means_20251007162115.r new file mode 100644 index 0000000..6e5cdc0 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162115.r @@ -0,0 +1,669 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162122.r b/.history/eohi1/mixed anova - domain means_20251007162122.r new file mode 100644 index 0000000..d3d6957 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162122.r @@ -0,0 +1,723 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162130.r b/.history/eohi1/mixed anova - domain means_20251007162130.r new file mode 100644 index 0000000..d3d6957 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162130.r @@ -0,0 +1,723 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162138.r b/.history/eohi1/mixed anova - domain means_20251007162138.r new file mode 100644 index 0000000..d3d6957 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162138.r @@ -0,0 +1,723 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007162843.r b/.history/eohi1/mixed anova - domain means_20251007162843.r new file mode 100644 index 0000000..d3d6957 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007162843.r @@ -0,0 +1,723 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007182023.r b/.history/eohi1/mixed anova - domain means_20251007182023.r new file mode 100644 index 0000000..80640de --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007182023.r @@ -0,0 +1,768 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple2_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple2_df[time_domain_simple2_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple2_df))) { + comparison <- time_domain_simple2_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007182033.r b/.history/eohi1/mixed anova - domain means_20251007182033.r new file mode 100644 index 0000000..80640de --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007182033.r @@ -0,0 +1,768 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple2_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple2_df[time_domain_simple2_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple2_df))) { + comparison <- time_domain_simple2_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007182343.r b/.history/eohi1/mixed anova - domain means_20251007182343.r new file mode 100644 index 0000000..80640de --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007182343.r @@ -0,0 +1,768 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple2_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple2_df[time_domain_simple2_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple2_df))) { + comparison <- time_domain_simple2_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007182949.r b/.history/eohi1/mixed anova - domain means_20251007182949.r new file mode 100644 index 0000000..8d5ac17 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007182949.r @@ -0,0 +1,768 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_df <- as.data.frame(time_domain_simple) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007182951.r b/.history/eohi1/mixed anova - domain means_20251007182951.r new file mode 100644 index 0000000..8d5ac17 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007182951.r @@ -0,0 +1,768 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_df <- as.data.frame(time_domain_simple) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007182953.r b/.history/eohi1/mixed anova - domain means_20251007182953.r new file mode 100644 index 0000000..8d5ac17 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007182953.r @@ -0,0 +1,768 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_df <- as.data.frame(time_domain_simple) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007183630.r b/.history/eohi1/mixed anova - domain means_20251007183630.r new file mode 100644 index 0000000..db70ef8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007183630.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_by_domain <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +time_domain_simple_df <- as.data.frame(time_domain_simple_by_domain) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007183634.r b/.history/eohi1/mixed anova - domain means_20251007183634.r new file mode 100644 index 0000000..db70ef8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007183634.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_by_domain <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +time_domain_simple_df <- as.data.frame(time_domain_simple_by_domain) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007183638.r b/.history/eohi1/mixed anova - domain means_20251007183638.r new file mode 100644 index 0000000..db70ef8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007183638.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_by_domain <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +time_domain_simple_df <- as.data.frame(time_domain_simple_by_domain) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251007183824.r b/.history/eohi1/mixed anova - domain means_20251007183824.r new file mode 100644 index 0000000..db70ef8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251007183824.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_by_domain <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +time_domain_simple_df <- as.data.frame(time_domain_simple_by_domain) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - domain means_20251010145938.r b/.history/eohi1/mixed anova - domain means_20251010145938.r new file mode 100644 index 0000000..db70ef8 --- /dev/null +++ b/.history/eohi1/mixed anova - domain means_20251010145938.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_by_domain <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +time_domain_simple_df <- as.data.frame(time_domain_simple_by_domain) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi1/mixed anova - personality_20250916123628.r b/.history/eohi1/mixed anova - personality_20250916123628.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - personality_20250916123628.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - personality_20250916123639.r b/.history/eohi1/mixed anova - personality_20250916123639.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - personality_20250916123639.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - personality_20250916123640.r b/.history/eohi1/mixed anova - personality_20250916123640.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - personality_20250916123640.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - personality_20250916125522.r b/.history/eohi1/mixed anova - personality_20250916125522.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - personality_20250916125522.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - personality_20250916130413.r b/.history/eohi1/mixed anova - personality_20250916130413.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - personality_20250916130413.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - personality_20250917121011.r b/.history/eohi1/mixed anova - personality_20250917121011.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - personality_20250917121011.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916113624.r b/.history/eohi1/mixed anova - preferences_20250916113624.r new file mode 100644 index 0000000..8832371 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113624.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113646.r b/.history/eohi1/mixed anova - preferences_20250916113646.r new file mode 100644 index 0000000..f44be6b --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113646.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + DOMAIN, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of DOMAIN levels:", length(levels(long_data_clean$DOMAIN)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 8, # 2 TIME × 4 DOMAIN = 8 + missing_combinations = 8 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113702.r b/.history/eohi1/mixed anova - preferences_20250916113702.r new file mode 100644 index 0000000..8f0c8d8 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113702.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "DOMAIN")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for DOMAIN (4 levels - within-subjects) +print("Mauchly's Test of Sphericity for DOMAIN:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_domain <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = DOMAIN, + type = 3, + detailed = TRUE) + + print("DOMAIN Sphericity Test:") + print(ez_domain$Mauchly) + +}, error = function(e) { + print(paste("Error in DOMAIN sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × DOMAIN interaction +print("\nMauchly's Test of Sphericity for TIME × DOMAIN Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + + print("TIME × DOMAIN Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × DOMAIN sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113720.r b/.history/eohi1/mixed anova - preferences_20250916113720.r new file mode 100644 index 0000000..1b494b0 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113720.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, DOMAIN), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to DOMAIN effects:") + + # DOMAIN main effect (DFn = 3, DFd = 3183) + domain_df_corrected_gg <- 3 * epsilon_gg + domain_df_corrected_hf <- 3 * epsilon_hf + + print(paste("DOMAIN: Original df = 3, 3183")) + print(paste("DOMAIN: GG corrected df =", round(domain_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("DOMAIN: HF corrected df =", round(domain_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # TIME × DOMAIN interaction (DFn = 3, DFd = 3183) + interaction_df_corrected_gg <- 3 * epsilon_gg + interaction_df_corrected_hf <- 3 * epsilon_hf + + print(paste("TIME × DOMAIN: Original df = 3, 3183")) + print(paste("TIME × DOMAIN: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(3183 * epsilon_gg, 2))) + print(paste("TIME × DOMAIN: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(3183 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(mixed_anova_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction (Significant: p = 0.012) +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(mixed_anova_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction (Marginal: p = 0.058) +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113743.r b/.history/eohi1/mixed anova - preferences_20250916113743.r new file mode 100644 index 0000000..9acfb2a --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113743.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + +# TEMPORAL_DO × ITEM Interaction +print("\n=== TEMPORAL_DO × ITEM INTERACTION ===") +temporal_item_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * ITEM) +print("Estimated Marginal Means:") +print(temporal_item_emmeans) + +print("\nSimple Effects of ITEM within each TEMPORAL_DO:") +temporal_item_simple <- pairs(temporal_item_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_item_simple) + +print("\nSimple Effects of TEMPORAL_DO within each ITEM:") +temporal_item_simple2 <- pairs(temporal_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(temporal_item_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of DOMAIN within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113752.r b/.history/eohi1/mixed anova - preferences_20250916113752.r new file mode 100644 index 0000000..3bed516 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113752.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + +# TEMPORAL_DO × ITEM Interaction +print("\n=== TEMPORAL_DO × ITEM INTERACTION ===") +temporal_item_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * ITEM) +print("Estimated Marginal Means:") +print(temporal_item_emmeans) + +print("\nSimple Effects of ITEM within each TEMPORAL_DO:") +temporal_item_simple <- pairs(temporal_item_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_item_simple) + +print("\nSimple Effects of TEMPORAL_DO within each ITEM:") +temporal_item_simple2 <- pairs(temporal_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(temporal_item_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * ITEM) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of ITEM within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113803.r b/.history/eohi1/mixed anova - preferences_20250916113803.r new file mode 100644 index 0000000..3bed516 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113803.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + +# TEMPORAL_DO × ITEM Interaction +print("\n=== TEMPORAL_DO × ITEM INTERACTION ===") +temporal_item_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * ITEM) +print("Estimated Marginal Means:") +print(temporal_item_emmeans) + +print("\nSimple Effects of ITEM within each TEMPORAL_DO:") +temporal_item_simple <- pairs(temporal_item_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_item_simple) + +print("\nSimple Effects of TEMPORAL_DO within each ITEM:") +temporal_item_simple2 <- pairs(temporal_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(temporal_item_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * ITEM) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of ITEM within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916113806.r b/.history/eohi1/mixed anova - preferences_20250916113806.r new file mode 100644 index 0000000..3bed516 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916113806.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + +# TEMPORAL_DO × ITEM Interaction +print("\n=== TEMPORAL_DO × ITEM INTERACTION ===") +temporal_item_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * ITEM) +print("Estimated Marginal Means:") +print(temporal_item_emmeans) + +print("\nSimple Effects of ITEM within each TEMPORAL_DO:") +temporal_item_simple <- pairs(temporal_item_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_item_simple) + +print("\nSimple Effects of TEMPORAL_DO within each ITEM:") +temporal_item_simple2 <- pairs(temporal_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(temporal_item_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * ITEM) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of ITEM within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "MEAN_DIFFERENCE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916120325.r b/.history/eohi1/mixed anova - preferences_20250916120325.r new file mode 100644 index 0000000..63ad1f1 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120325.r @@ -0,0 +1,836 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction (Significant: p = 0.001) +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + +# TEMPORAL_DO × ITEM Interaction +print("\n=== TEMPORAL_DO × ITEM INTERACTION ===") +temporal_item_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * ITEM) +print("Estimated Marginal Means:") +print(temporal_item_emmeans) + +print("\nSimple Effects of ITEM within each TEMPORAL_DO:") +temporal_item_simple <- pairs(temporal_item_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_item_simple) + +print("\nSimple Effects of TEMPORAL_DO within each ITEM:") +temporal_item_simple2 <- pairs(temporal_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(temporal_item_simple2) + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +# All pairwise comparisons for the three-way interaction +print("\n=== COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(mixed_anova_model, ~ TEMPORAL_DO * TIME * ITEM) +print("Estimated Marginal Means for all combinations:") +print(three_way_emmeans) + +# Pairwise comparisons within each TEMPORAL_DO × TIME combination +print("\nPairwise comparisons of ITEM within each TEMPORAL_DO × TIME combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "TIME"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each ITEM +temporal_item_simple2_df <- as.data.frame(temporal_item_simple2) +calculate_cohens_d_for_pairs(temporal_item_simple2_df, long_data_clean, "TEMPORAL_DO", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TEMPORAL_DO +temporal_item_simple_df <- as.data.frame(temporal_item_simple) +calculate_cohens_d_for_pairs(temporal_item_simple_df, long_data_clean, "ITEM", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916120409.r b/.history/eohi1/mixed anova - preferences_20250916120409.r new file mode 100644 index 0000000..832ad6c --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120409.r @@ -0,0 +1,795 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT: p = 0.001) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION (MARGINAL: p = 0.058) +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each ITEM +temporal_item_simple2_df <- as.data.frame(temporal_item_simple2) +calculate_cohens_d_for_pairs(temporal_item_simple2_df, long_data_clean, "TEMPORAL_DO", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TEMPORAL_DO +temporal_item_simple_df <- as.data.frame(temporal_item_simple) +calculate_cohens_d_for_pairs(temporal_item_simple_df, long_data_clean, "ITEM", "TEMPORAL_DO", "MEAN_DIFFERENCE") + diff --git a/.history/eohi1/mixed anova - preferences_20250916120419.r b/.history/eohi1/mixed anova - preferences_20250916120419.r new file mode 100644 index 0000000..34d2b75 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120419.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916120427.r b/.history/eohi1/mixed anova - preferences_20250916120427.r new file mode 100644 index 0000000..f440f30 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120427.r @@ -0,0 +1,767 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Repeated Measures ANOVA using aov() - Traditional approach +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916120436.r b/.history/eohi1/mixed anova - preferences_20250916120436.r new file mode 100644 index 0000000..406272e --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120436.r @@ -0,0 +1,763 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Repeated Measures ANOVA using aov() - Traditional approach +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916120437.r b/.history/eohi1/mixed anova - preferences_20250916120437.r new file mode 100644 index 0000000..406272e --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120437.r @@ -0,0 +1,763 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Repeated Measures ANOVA using aov() - Traditional approach +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916120515.r b/.history/eohi1/mixed anova - preferences_20250916120515.r new file mode 100644 index 0000000..57d9e96 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120515.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916120522.r b/.history/eohi1/mixed anova - preferences_20250916120522.r new file mode 100644 index 0000000..57d9e96 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120522.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - preferences_20250916120534.r b/.history/eohi1/mixed anova - preferences_20250916120534.r new file mode 100644 index 0000000..57d9e96 --- /dev/null +++ b/.history/eohi1/mixed anova - preferences_20250916120534.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - values_20250916125551.r b/.history/eohi1/mixed anova - values_20250916125551.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi1/mixed anova - values_20250916125552.r b/.history/eohi1/mixed anova - values_20250916125552.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/.history/eohi1/mixed anova - values_20250916125552.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - values_20250916125857.r b/.history/eohi1/mixed anova - values_20250916125857.r new file mode 100644 index 0000000..84de04b --- /dev/null +++ b/.history/eohi1/mixed anova - values_20250916125857.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Values Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_val_obey, NPastDiff_val_trad, NPastDiff_val_opinion, NPastDiff_val_performance, NPastDiff_val_justice +# NFutDiff_val_obey, NFutDiff_val_trad, NFutDiff_val_opinion, NFutDiff_val_performance, NFutDiff_val_justice + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required values item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("obey", "trad", "opinion", "performance", "justice"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("obey", "trad", "opinion", "performance", "justice")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - values_20250916125907.r b/.history/eohi1/mixed anova - values_20250916125907.r new file mode 100644 index 0000000..84de04b --- /dev/null +++ b/.history/eohi1/mixed anova - values_20250916125907.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Values Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_val_obey, NPastDiff_val_trad, NPastDiff_val_opinion, NPastDiff_val_performance, NPastDiff_val_justice +# NFutDiff_val_obey, NFutDiff_val_trad, NFutDiff_val_opinion, NFutDiff_val_performance, NFutDiff_val_justice + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required values item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("obey", "trad", "opinion", "performance", "justice"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("obey", "trad", "opinion", "performance", "justice")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/mixed anova - values_20250916125940.r b/.history/eohi1/mixed anova - values_20250916125940.r new file mode 100644 index 0000000..84de04b --- /dev/null +++ b/.history/eohi1/mixed anova - values_20250916125940.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Values Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_val_obey, NPastDiff_val_trad, NPastDiff_val_opinion, NPastDiff_val_performance, NPastDiff_val_justice +# NFutDiff_val_obey, NFutDiff_val_trad, NFutDiff_val_opinion, NFutDiff_val_performance, NFutDiff_val_justice + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required values item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("obey", "trad", "opinion", "performance", "justice"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("obey", "trad", "opinion", "performance", "justice")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/.history/eohi1/readme_domain_mixed_anova_20251002121520.txt b/.history/eohi1/readme_domain_mixed_anova_20251002121520.txt new file mode 100644 index 0000000..071e72c Binary files /dev/null and b/.history/eohi1/readme_domain_mixed_anova_20251002121520.txt differ diff --git a/.history/eohi1/readme_domain_mixed_anova_20251002121755.txt b/.history/eohi1/readme_domain_mixed_anova_20251002121755.txt new file mode 100644 index 0000000..071e72c Binary files /dev/null and b/.history/eohi1/readme_domain_mixed_anova_20251002121755.txt differ diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020100405.r b/.history/eohi1/regression e1 - edu x ehi_20251020100405.r new file mode 100644 index 0000000..ebf62fe --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020100405.r @@ -0,0 +1,10 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020100412.r b/.history/eohi1/regression e1 - edu x ehi_20251020100412.r new file mode 100644 index 0000000..ebf62fe --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020100412.r @@ -0,0 +1,10 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020100550.r b/.history/eohi1/regression e1 - edu x ehi_20251020100550.r new file mode 100644 index 0000000..d2ef1cb --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020100550.r @@ -0,0 +1,11 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) + diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020100952.r b/.history/eohi1/regression e1 - edu x ehi_20251020100952.r new file mode 100644 index 0000000..1f95024 --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020100952.r @@ -0,0 +1,16 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020101841.r b/.history/eohi1/regression e1 - edu x ehi_20251020101841.r new file mode 100644 index 0000000..84762dd --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020101841.r @@ -0,0 +1,35 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) + +# Add to your data +data <- cbind(data, dummy_df) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020103253.r b/.history/eohi1/regression e1 - edu x ehi_20251020103253.r new file mode 100644 index 0000000..d7ad239 --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020103253.r @@ -0,0 +1,45 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020103850.r b/.history/eohi1/regression e1 - edu x ehi_20251020103850.r new file mode 100644 index 0000000..4fa8314 --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020103850.r @@ -0,0 +1,47 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020113946.r b/.history/eohi1/regression e1 - edu x ehi_20251020113946.r new file mode 100644 index 0000000..39dd98c --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020113946.r @@ -0,0 +1,118 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +summary(model_DGEN) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") # This shows coefficients, SEs, and p-values + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +par(mfrow = c(2, 2)) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Reset plotting +par(mfrow = c(1, 1)) + +summary(model_domain) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020133831.r b/.history/eohi1/regression e1 - edu x ehi_20251020133831.r new file mode 100644 index 0000000..fbfc999 --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020133831.r @@ -0,0 +1,159 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +summary(model_DGEN) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp"), + add.lines = list(c("AIC", round(AIC(model_DGEN), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDGEN_robust <- coeftest(model_DGEN, vcov = vcovHC(model_DGEN, type = "HC3")) + +stargazer(modelDGEN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Check if the autocorrelation is real or artifactual +# Plot residuals against observation order +plot(residuals(model_domain), type = "l") +abline(h = 0, col = "red") + + +# 6 outliers: acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# auto correlation is significant, may be due to aggregated measure of multiple repeated measures + +# Reset plotting to 1x1 +# par(mfrow = c(1, 1)) + +summary(model_domain) + +stargazer(model_domain, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp"), # This shows coefficients, SEs, and p-values + add.lines = list(c("AIC", round(AIC(model_DGEN), 2), round(AIC(model_domain), 2))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDOMAIN_robust <- coeftest(model_domain, vcov = vcovHC(model_domain, type = "HC3")) + +stargazer(modelDOMAIN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020134231.r b/.history/eohi1/regression e1 - edu x ehi_20251020134231.r new file mode 100644 index 0000000..35fb5df --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020134231.r @@ -0,0 +1,159 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +summary(model_DGEN) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", + add.lines = list(c("AIC", round(AIC(model_DGEN), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDGEN_robust <- coeftest(model_DGEN, vcov = vcovHC(model_DGEN, type = "HC3")) + +stargazer(modelDGEN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Check if the autocorrelation is real or artifactual +# Plot residuals against observation order +plot(residuals(model_domain), type = "l") +abline(h = 0, col = "red") + + +# 6 outliers: acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# auto correlation is significant, may be due to aggregated measure of multiple repeated measures + +# Reset plotting to 1x1 +# par(mfrow = c(1, 1)) + +summary(model_domain) + +stargazer(model_domain, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", # This shows coefficients, SEs, and p-values + add.lines = list(c("AIC", round(AIC(model_DGEN), 2), round(AIC(model_domain), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDOMAIN_robust <- coeftest(model_domain, vcov = vcovHC(model_domain, type = "HC3")) + +stargazer(modelDOMAIN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020173226.r b/.history/eohi1/regression e1 - edu x ehi_20251020173226.r new file mode 100644 index 0000000..1df9492 --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020173226.r @@ -0,0 +1,161 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +print(summary(model_DGEN)) +print(AIC(model_DGEN)) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", + add.lines = list(c("AIC", round(AIC(model_DGEN), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDGEN_robust <- coeftest(model_DGEN, vcov = vcovHC(model_DGEN, type = "HC3")) + +stargazer(modelDGEN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Check if the autocorrelation is real or artifactual +# Plot residuals against observation order +plot(residuals(model_domain), type = "l") +abline(h = 0, col = "red") + + +# 6 outliers: acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# auto correlation is significant, may be due to aggregated measure of multiple repeated measures + +# Reset plotting to 1x1 +# par(mfrow = c(1, 1)) + +print(summary(model_domain)) +print(AIC(model_domain)) + +stargazer(model_domain, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", # This shows coefficients, SEs, and p-values + add.lines = list(c("AIC", round(AIC(model_domain), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDOMAIN_robust <- coeftest(model_domain, vcov = vcovHC(model_domain, type = "HC3")) + +stargazer(modelDOMAIN_robust, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") diff --git a/.history/eohi1/regression e1 - edu x ehi_20251020173252.r b/.history/eohi1/regression e1 - edu x ehi_20251020173252.r new file mode 100644 index 0000000..1df9492 --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251020173252.r @@ -0,0 +1,161 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +print(summary(model_DGEN)) +print(AIC(model_DGEN)) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", + add.lines = list(c("AIC", round(AIC(model_DGEN), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDGEN_robust <- coeftest(model_DGEN, vcov = vcovHC(model_DGEN, type = "HC3")) + +stargazer(modelDGEN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Check if the autocorrelation is real or artifactual +# Plot residuals against observation order +plot(residuals(model_domain), type = "l") +abline(h = 0, col = "red") + + +# 6 outliers: acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# auto correlation is significant, may be due to aggregated measure of multiple repeated measures + +# Reset plotting to 1x1 +# par(mfrow = c(1, 1)) + +print(summary(model_domain)) +print(AIC(model_domain)) + +stargazer(model_domain, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", # This shows coefficients, SEs, and p-values + add.lines = list(c("AIC", round(AIC(model_domain), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDOMAIN_robust <- coeftest(model_domain, vcov = vcovHC(model_domain, type = "HC3")) + +stargazer(modelDOMAIN_robust, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") diff --git a/.history/eohi1/regression e1 - edu x ehi_20251023140538.r b/.history/eohi1/regression e1 - edu x ehi_20251023140538.r new file mode 100644 index 0000000..bcd295f --- /dev/null +++ b/.history/eohi1/regression e1 - edu x ehi_20251023140538.r @@ -0,0 +1,232 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +print(summary(model_DGEN)) +print(AIC(model_DGEN)) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", + add.lines = list(c("AIC", round(AIC(model_DGEN), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDGEN_robust <- coeftest(model_DGEN, vcov = vcovHC(model_DGEN, type = "HC3")) + +stargazer(modelDGEN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Check if the autocorrelation is real or artifactual +# Plot residuals against observation order +plot(residuals(model_domain), type = "l") +abline(h = 0, col = "red") + + +# 6 outliers: acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# auto correlation is significant, may be due to aggregated measure of multiple repeated measures + +# Reset plotting to 1x1 +# par(mfrow = c(1, 1)) + +print(summary(model_domain)) +print(AIC(model_domain)) + +stargazer(model_domain, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", # This shows coefficients, SEs, and p-values + add.lines = list(c("AIC", round(AIC(model_domain), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDOMAIN_robust <- coeftest(model_domain, vcov = vcovHC(model_domain, type = "HC3")) + +stargazer(modelDOMAIN_robust, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + +#### PLOTS #### + +library(ggplot2) +library(dplyr) + +# Calculate means and confidence intervals for EOHI-DGEN +edu_summary_DGEN <- data %>% + group_by(demo_edu) %>% + summarise( + mean_DGEN = mean(eohiDGEN_mean, na.rm = TRUE), + n = n(), + se_DGEN = sd(eohiDGEN_mean, na.rm = TRUE) / sqrt(n()), + ci_lower_DGEN = mean_DGEN - 1.96 * se_DGEN, + ci_upper_DGEN = mean_DGEN + 1.96 * se_DGEN + ) + +# Calculate means and confidence intervals for EHI Domain +edu_summary_domain <- data %>% + group_by(demo_edu) %>% + summarise( + mean_domain = mean(ehi_global_mean, na.rm = TRUE), + n = n(), + se_domain = sd(ehi_global_mean, na.rm = TRUE) / sqrt(n()), + ci_lower_domain = mean_domain - 1.96 * se_domain, + ci_upper_domain = mean_domain + 1.96 * se_domain + ) + +# Plot 1: EOHI-DGEN means with confidence intervals +p1 <- ggplot(edu_summary_DGEN, aes(x = demo_edu, y = mean_DGEN)) + + geom_point(size = 3, color = "steelblue") + + geom_errorbar(aes(ymin = ci_lower_DGEN, ymax = ci_upper_DGEN), + width = 0.1, color = "steelblue", linewidth = 1) + + labs( + title = "Mean EOHI-DGEN by Education Level", + subtitle = "Error bars show 95% confidence intervals", + x = "Education Level", + y = "Mean EOHI-DGEN Score" + ) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, face = "bold"), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Plot 2: EHI Domain means with confidence intervals +p2 <- ggplot(edu_summary_domain, aes(x = demo_edu, y = mean_domain)) + + geom_point(size = 3, color = "darkgreen") + + geom_errorbar(aes(ymin = ci_lower_domain, ymax = ci_upper_domain), + width = 0.1, color = "darkgreen", linewidth = 1) + + labs( + title = "Mean EHI Domain by Education Level", + subtitle = "Error bars show 95% confidence intervals", + x = "Education Level", + y = "Mean EHI Domain Score" + ) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, face = "bold"), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Display the plots +print(p1) +print(p2) + +# Save the plots +ggsave("education_DGEN_means.png", p1, width = 10, height = 6, dpi = 300) +ggsave("education_domain_means.png", p2, width = 10, height = 6, dpi = 300) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251020173352.r b/.history/eohi1/regression e1 - ehi x sex x age_20251020173352.r new file mode 100644 index 0000000..8b82aee --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251020173352.r @@ -0,0 +1,15 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251020173438.r b/.history/eohi1/regression e1 - ehi x sex x age_20251020173438.r new file mode 100644 index 0000000..998a8f6 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251020173438.r @@ -0,0 +1,16 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) + diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251020174241.r b/.history/eohi1/regression e1 - ehi x sex x age_20251020174241.r new file mode 100644 index 0000000..b93f9b5 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251020174241.r @@ -0,0 +1,26 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251020174522.r b/.history/eohi1/regression e1 - ehi x sex x age_20251020174522.r new file mode 100644 index 0000000..1555c12 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251020174522.r @@ -0,0 +1,39 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +sd(data$demo_age_1, na.rm = TRUE) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251020175347.r b/.history/eohi1/regression e1 - ehi x sex x age_20251020175347.r new file mode 100644 index 0000000..0463ae9 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251020175347.r @@ -0,0 +1,96 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +shapiro.test(residuals(age_DGEN)) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +shapiro.test(residuals(age_domain)) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +shapiro.test(residuals(sex_DGEN)) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +shapiro.test(residuals(sex_domain)) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +shapiro.test(residuals(interaction_DGEN)) +vif(interaction_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +shapiro.test(residuals(interaction_domain)) +vif(interaction_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251020180330.r b/.history/eohi1/regression e1 - ehi x sex x age_20251020180330.r new file mode 100644 index 0000000..f060580 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251020180330.r @@ -0,0 +1,96 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +vif(interaction_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif(interaction_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251021102925.r b/.history/eohi1/regression e1 - ehi x sex x age_20251021102925.r new file mode 100644 index 0000000..62a3f43 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251021102925.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) +# P1 (res vs fitted) + P3 (scale location): test for homoscedasticity. relatively flat red line = homoscedasticity. relatively scattered points = homoscedasticity. this assumption is met. +# P2 (qq plot): test for normality. points scattered around a relatively straight line = normality. this assumption is violated but large sample is robust. +# P4 (residuals vs leverage): test for outliers. high leverage points = outliers. leverage > 2p/n. + # p = parameters; for this model p = 2 (intercept + sex_dummy). n = 1061 (removed prefer not to say). threshold = 2*2/1061 = 0.00377. maximum leverage in plot is ~ 0.002 therefore no points have concerning leverage. +# across the plots, there are 3 outliers: 258, 670, 872. this represents 0.28% of the data (much less than the acceptable threshold of 5%). therefore, analysis can proceed. +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +vif(interaction_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif(interaction_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251021104421.r b/.history/eohi1/regression e1 - ehi x sex x age_20251021104421.r new file mode 100644 index 0000000..29c9873 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251021104421.r @@ -0,0 +1,101 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) +# P1 (res vs fitted) + P3 (scale location): test for homoscedasticity. relatively flat red line = homoscedasticity. relatively scattered points = homoscedasticity. this assumption is met. +# P2 (qq plot): test for normality. points scattered around a relatively straight line = normality. this assumption is violated but large sample is robust. +# P4 (residuals vs leverage): test for outliers. high leverage points = outliers. leverage > 2p/n. + # p = parameters; for this model p = 2 (intercept + sex_dummy). n = 1061 (removed prefer not to say). threshold = 2*2/1061 = 0.00377. maximum leverage in plot is ~ 0.002 therefore no points have concerning leverage. +# across the plots, there are 3 outliers: 258, 670, 872. this represents 0.28% of the data (much less than the acceptable threshold of 5%). therefore, analysis can proceed. + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +vif(interaction_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif(interaction_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251021111526.r b/.history/eohi1/regression e1 - ehi x sex x age_20251021111526.r new file mode 100644 index 0000000..52fd677 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251021111526.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) +# P1 (res vs fitted) + P3 (scale location): test for homoscedasticity. relatively flat red line = homoscedasticity. relatively scattered points = homoscedasticity. this assumption is met. +# P2 (qq plot): test for normality. points scattered around a relatively straight line = normality. this assumption is violated but large sample is robust. +# P4 (residuals vs leverage): test for outliers. high leverage points = outliers. leverage > 2p/n. + # p = parameters; for this model p = 2 (intercept + sex_dummy). n = 1061 (removed prefer not to say). threshold = 2*2/1061 = 0.00377. maximum leverage in plot is ~ 0.002 therefore no points have concerning leverage. +# across the plots, there are 3 outliers: 258, 670, 872. this represents 0.28% of the data (much less than the acceptable threshold of 5%). therefore, analysis can proceed. + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +print(vif(interaction_DGEN)) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif(interaction_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) + +#### troubleshooting #### +# Clear any existing plots +dev.off() \ No newline at end of file diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251021120315.r b/.history/eohi1/regression e1 - ehi x sex x age_20251021120315.r new file mode 100644 index 0000000..e93fea0 --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251021120315.r @@ -0,0 +1,151 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) +# P1 (res vs fitted) + P3 (scale location): test for homoscedasticity. relatively flat red line = homoscedasticity. relatively scattered points = homoscedasticity. this assumption is met. +# P2 (qq plot): test for normality. points scattered around a relatively straight line = normality. this assumption is violated but large sample is robust. +# P4 (residuals vs leverage): test for outliers. high leverage points = outliers. leverage > 2p/n. + # p = parameters; for this model p = 2 (intercept + sex_dummy). n = 1061 (removed prefer not to say). threshold = 2*2/1061 = 0.00377. maximum leverage in plot is ~ 0.002 therefore no points have concerning leverage. +# across the plots, there are 3 outliers: 258, 670, 872. this represents 0.28% of the data (much less than the acceptable threshold of 5%). therefore, analysis can proceed. + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +vif_DGEN <- vif(interaction_DGEN) +print(vif_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif_domain <- vif(interaction_domain) +print(vif_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) + +#### troubleshooting #### +# Clear any existing plots +# dev.off() + +#### printing to HTML #### + +# Create an HTML table for your model results +max_vif_DGEN <- round(max(vif_DGEN), 2) + +stargazer( + age_DGEN, sex_DGEN, interaction_DGEN, + type = "html", + out = "regression_DGEN_models.html", + title = "Regression Models: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Age (centered)", "Sex (dummy)", "Age x Sex"), + report = "vcsp*", + add.lines = list( + c("AIC", + round(AIC(age_DGEN), 2), + round(AIC(sex_DGEN), 2), + round(AIC(interaction_DGEN), 2)), + c("Max VIF", "N/A", "N/A", max_vif_DGEN) + ) +) + +max_vif_domain <- round(max(vif_domain), 2) + +stargazer( + age_domain, sex_domain, interaction_domain, + type = "html", + out = "regression_EHI_domain_models.html", + title = "Regression Models: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Age (centered)", "Sex (dummy)", "Age x Sex"), + report = "vcsp*", + add.lines = list( + c("AIC", + round(AIC(age_domain), 2), + round(AIC(sex_domain), 2), + round(AIC(interaction_domain), 2)), + c("Max VIF", + "NA", + "NA", + max_vif_domain) + ) +) diff --git a/.history/eohi1/regression e1 - ehi x sex x age_20251023105759.r b/.history/eohi1/regression e1 - ehi x sex x age_20251023105759.r new file mode 100644 index 0000000..e7db6aa --- /dev/null +++ b/.history/eohi1/regression e1 - ehi x sex x age_20251023105759.r @@ -0,0 +1,320 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) +# P1 (res vs fitted) + P3 (scale location): test for homoscedasticity. relatively flat red line = homoscedasticity. relatively scattered points = homoscedasticity. this assumption is met. +# P2 (qq plot): test for normality. points scattered around a relatively straight line = normality. this assumption is violated but large sample is robust. +# P4 (residuals vs leverage): test for outliers. high leverage points = outliers. leverage > 2p/n. + # p = parameters; for this model p = 2 (intercept + sex_dummy). n = 1061 (removed prefer not to say). threshold = 2*2/1061 = 0.00377. maximum leverage in plot is ~ 0.002 therefore no points have concerning leverage. +# across the plots, there are 3 outliers: 258, 670, 872. this represents 0.28% of the data (much less than the acceptable threshold of 5%). therefore, analysis can proceed. + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +vif_DGEN <- vif(interaction_DGEN) +print(vif_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif_domain <- vif(interaction_domain) +print(vif_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) + +#### troubleshooting #### +# Clear any existing plots +# dev.off() + + +#### PLOTS #### + +# Create visual figures for age models +library(ggplot2) + +# Figure 1: age_DGEN model +p1 <- ggplot(data, aes(x = age_centered, y = eohiDGEN_mean)) + + geom_point(alpha = 0.6, color = "steelblue") + + geom_smooth(method = "lm", se = TRUE, color = "red", linewidth = 1) + + labs( + title = "Age and EOHI-DGEN Relationship", + x = "Age (centered)", + y = "EOHI-DGEN Mean", + subtitle = paste("R² =", round(summary(age_DGEN)$r.squared, 3), + ", p < 0.001") + ) + + theme_minimal() + + theme( + plot.title = element_text(size = 14, face = "bold"), + axis.title = element_text(size = 12), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Figure 2: age_domain model +p2 <- ggplot(data, aes(x = age_centered, y = ehi_global_mean)) + + geom_point(alpha = 0.6, color = "darkgreen") + + geom_smooth(method = "lm", se = TRUE, color = "red", linewidth = 1) + + labs( + title = "Age and EHI Domain Relationship", + x = "Age (centered)", + y = "EHI Domain Mean", + subtitle = paste("R² =", round(summary(age_domain)$r.squared, 3), + ", p < 0.001") + ) + + theme_minimal() + + theme( + plot.title = element_text(size = 14, face = "bold"), + axis.title = element_text(size = 12), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Save the plots +ggsave("age_DGEN_plot.png", p1, width = 8, height = 6, dpi = 300) +ggsave("age_domain_plot.png", p2, width = 8, height = 6, dpi = 300) + +# Display the plots +print(p1) +print(p2) + +#### HTML file #### + +# Create comprehensive HTML report grouped by model +library(htmltools) + +# Start HTML document +html_content <- htmltools::div( + htmltools::h1("Regression Analysis: Age and Sex Effects on EOHI-DGEN and EHI Domain"), + + # EOHI-DGEN Models Section + htmltools::h2("EOHI-DGEN Models"), + + # Age Model + htmltools::h3("1. Age Model (age_DGEN)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + age_DGEN, + type = "html", + title = "Age Model: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Age (centered)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(age_DGEN), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "age_DGEN_assumptions.png", style = "width: 100%; max-width: 800px;"), + htmltools::h4("Model Visualization"), + htmltools::img(src = "age_DGEN_plot.png", style = "width: 100%; max-width: 800px;") + ), + + # Sex Model + htmltools::h3("2. Sex Model (sex_DGEN)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + sex_DGEN, + type = "html", + title = "Sex Model: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Sex (dummy)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(sex_DGEN), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "sex_DGEN_assumptions.png", style = "width: 100%; max-width: 800px;") + ), + + # Interaction Model + htmltools::h3("3. Interaction Model (interaction_DGEN)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + interaction_DGEN, + type = "html", + title = "Interaction Model: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Age (centered)", "Sex (dummy)", "Age x Sex"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(interaction_DGEN), 2)), + c("Max VIF", max_vif_DGEN) + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "interaction_DGEN_assumptions.png", style = "width: 100%; max-width: 800px;") + ), + + # EHI Domain Models Section + htmltools::h2("EHI Domain Models"), + + # Age Model + htmltools::h3("1. Age Model (age_domain)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + age_domain, + type = "html", + title = "Age Model: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Age (centered)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(age_domain), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "age_domain_assumptions.png", style = "width: 100%; max-width: 800px;"), + htmltools::h4("Model Visualization"), + htmltools::img(src = "age_domain_plot.png", style = "width: 100%; max-width: 800px;") + ), + + # Sex Model + htmltools::h3("2. Sex Model (sex_domain)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + sex_domain, + type = "html", + title = "Sex Model: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Sex (dummy)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(sex_domain), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "sex_domain_assumptions.png", style = "width: 100%; max-width: 800px;") + ), + + # Interaction Model + htmltools::h3("3. Interaction Model (interaction_domain)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + interaction_domain, + type = "html", + title = "Interaction Model: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Age (centered)", "Sex (dummy)", "Age x Sex"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(interaction_domain), 2)), + c("Max VIF", max_vif_domain) + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "interaction_domain_assumptions.png", style = "width: 100%; max-width: 800px;") + ) +) + +# Save HTML content +htmltools::save_html(html_content, "regression_analysis_report.html") + +print("HTML report created: regression_analysis_report.html") \ No newline at end of file diff --git a/.history/eohi1/regressions e1 - assumptions_20251015154931.r b/.history/eohi1/regressions e1 - assumptions_20251015154931.r new file mode 100644 index 0000000..036e881 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251015154931.r @@ -0,0 +1,3 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016134509.r b/.history/eohi1/regressions e1 - assumptions_20251016134509.r new file mode 100644 index 0000000..a72cede --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016134509.r @@ -0,0 +1,4 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142437.r b/.history/eohi1/regressions e1 - assumptions_20251016142437.r new file mode 100644 index 0000000..ecc6191 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142437.r @@ -0,0 +1,55 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean +# Total: 6 regression models + +options(scipen = 999) + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check data structure +cat("Data dimensions:", dim(data), "\n") +cat("Variables of interest:\n") +cat("IVs: demo_sex, demo_age, demo_edu\n") +cat("DVs: eohiDGEN_mean, ehi_global_mean\n\n") + +# Check for missing values +cat("Missing values check:\n") +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +cat("\nClean data dimensions:", dim(data_clean), "\n") + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +cat("\nEducation levels:\n") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +cat("\nSex recoding (0=Female, 1=Male):\n") +print(table(data_clean$demo_sex_numeric)) +cat("\nEducation recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):\n") +print(table(data_clean$demo_edu_numeric)) diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142502.r b/.history/eohi1/regressions e1 - assumptions_20251016142502.r new file mode 100644 index 0000000..1030c19 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142502.r @@ -0,0 +1,235 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean +# Total: 6 regression models + +options(scipen = 999) + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check data structure +cat("Data dimensions:", dim(data), "\n") +cat("Variables of interest:\n") +cat("IVs: demo_sex, demo_age, demo_edu\n") +cat("DVs: eohiDGEN_mean, ehi_global_mean\n\n") + +# Check for missing values +cat("Missing values check:\n") +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +cat("\nClean data dimensions:", dim(data_clean), "\n") + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +cat("\nEducation levels:\n") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +cat("\nSex recoding (0=Female, 1=Male):\n") +print(table(data_clean$demo_sex_numeric)) +cat("\nEducation recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):\n") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + cat("\n=== LINEARITY CHECK:", model_name, "===\n") + + # Residuals vs Fitted plot + residuals_vs_fitted <- plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + cr_plot <- crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + # Return plots for later use + return(list(residuals_vs_fitted = residuals_vs_fitted, cr_plot = cr_plot)) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + cat("\n=== NORMALITY CHECK:", model_name, "===\n") + + # Q-Q plot + qq_plot <- plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + cat("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5), "\n") + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + cat("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5), "\n") + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + + return(list(qq_plot = qq_plot, hist_plot = hist_plot, + shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + cat("\n=== HOMOSCEDASTICITY CHECK:", model_name, "===\n") + + # Scale-Location plot + scale_location_plot <- plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + cat("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5), "\n") + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + cat("White test p-value:", format(white_test$p.value, digits = 5), "\n") + }, error = function(e) { + cat("White test not available for this model\n") + }) + + return(list(scale_location_plot = scale_location_plot, bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + cat("\n=== INDEPENDENCE CHECK:", model_name, "===\n") + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + cat("Durbin-Watson statistic:", format(dw_test$dw, digits = 5), "\n") + cat("Durbin-Watson p-value:", format(dw_test$p, digits = 5), "\n") + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = 1:length(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + + return(list(residuals_vs_order = residuals_vs_order, dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + cat("\n=== INFLUENCE CHECK:", model_name, "===\n") + + # Cook's Distance plot + cooks_plot <- plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + influence_measures <- influence.measures(model) + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + cat("Cook's Distance threshold:", format(cooks_threshold, digits = 5), "\n") + cat("Influential observations (Cook's D):", length(influential_cooks), "\n") + cat("Leverage threshold:", format(leverage_threshold, digits = 5), "\n") + cat("High leverage observations:", length(influential_leverage), "\n") + cat("DFFITS threshold:", format(dffits_threshold, digits = 5), "\n") + cat("Influential observations (DFFITS):", length(influential_dffits), "\n") + + if (length(influential_cooks) > 0) { + cat("Cook's D influential cases:", influential_cooks, "\n") + } + if (length(influential_leverage) > 0) { + cat("High leverage cases:", influential_leverage, "\n") + } + if (length(influential_dffits) > 0) { + cat("DFFITS influential cases:", influential_dffits, "\n") + } + + return(list(cooks_plot = cooks_plot, + influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + cat("\n=== MODEL SUMMARY:", model_name, "===\n") + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + cat("\nR-squared:", format(summary_model$r.squared, digits = 5), "\n") + cat("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5), "\n") + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + cat("AIC:", format(aic_val, digits = 5), "\n") + cat("BIC:", format(bic_val, digits = 5), "\n") + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142529.r b/.history/eohi1/regressions e1 - assumptions_20251016142529.r new file mode 100644 index 0000000..77efdb7 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142529.r @@ -0,0 +1,401 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean +# Total: 6 regression models + +options(scipen = 999) + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check data structure +cat("Data dimensions:", dim(data), "\n") +cat("Variables of interest:\n") +cat("IVs: demo_sex, demo_age, demo_edu\n") +cat("DVs: eohiDGEN_mean, ehi_global_mean\n\n") + +# Check for missing values +cat("Missing values check:\n") +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +cat("\nClean data dimensions:", dim(data_clean), "\n") + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +cat("\nEducation levels:\n") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +cat("\nSex recoding (0=Female, 1=Male):\n") +print(table(data_clean$demo_sex_numeric)) +cat("\nEducation recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):\n") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + cat("\n=== LINEARITY CHECK:", model_name, "===\n") + + # Residuals vs Fitted plot + residuals_vs_fitted <- plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + cr_plot <- crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + # Return plots for later use + return(list(residuals_vs_fitted = residuals_vs_fitted, cr_plot = cr_plot)) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + cat("\n=== NORMALITY CHECK:", model_name, "===\n") + + # Q-Q plot + qq_plot <- plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + cat("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5), "\n") + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + cat("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5), "\n") + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + + return(list(qq_plot = qq_plot, hist_plot = hist_plot, + shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + cat("\n=== HOMOSCEDASTICITY CHECK:", model_name, "===\n") + + # Scale-Location plot + scale_location_plot <- plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + cat("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5), "\n") + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + cat("White test p-value:", format(white_test$p.value, digits = 5), "\n") + }, error = function(e) { + cat("White test not available for this model\n") + }) + + return(list(scale_location_plot = scale_location_plot, bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + cat("\n=== INDEPENDENCE CHECK:", model_name, "===\n") + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + cat("Durbin-Watson statistic:", format(dw_test$dw, digits = 5), "\n") + cat("Durbin-Watson p-value:", format(dw_test$p, digits = 5), "\n") + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = 1:length(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + + return(list(residuals_vs_order = residuals_vs_order, dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + cat("\n=== INFLUENCE CHECK:", model_name, "===\n") + + # Cook's Distance plot + cooks_plot <- plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + influence_measures <- influence.measures(model) + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + cat("Cook's Distance threshold:", format(cooks_threshold, digits = 5), "\n") + cat("Influential observations (Cook's D):", length(influential_cooks), "\n") + cat("Leverage threshold:", format(leverage_threshold, digits = 5), "\n") + cat("High leverage observations:", length(influential_leverage), "\n") + cat("DFFITS threshold:", format(dffits_threshold, digits = 5), "\n") + cat("Influential observations (DFFITS):", length(influential_dffits), "\n") + + if (length(influential_cooks) > 0) { + cat("Cook's D influential cases:", influential_cooks, "\n") + } + if (length(influential_leverage) > 0) { + cat("High leverage cases:", influential_leverage, "\n") + } + if (length(influential_dffits) > 0) { + cat("DFFITS influential cases:", influential_dffits, "\n") + } + + return(list(cooks_plot = cooks_plot, + influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + cat("\n=== MODEL SUMMARY:", model_name, "===\n") + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + cat("\nR-squared:", format(summary_model$r.squared, digits = 5), "\n") + cat("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5), "\n") + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + cat("AIC:", format(aic_val, digits = 5), "\n") + cat("BIC:", format(bic_val, digits = 5), "\n") + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS FOR ALL MODELS +# ============================================================================= + +# Create results storage +assumption_results <- list() +model_summaries <- list() + +# Model names for reference +model_names <- c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global") + +cat("\n", rep("=", 80), "\n") +cat("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS\n") +cat(rep("=", 80), "\n") + +# Run assumption checks for each model +for (i in 1:length(models)) { + model_name <- model_names[i] + model <- models[[i]] + + cat("\n", rep("-", 60), "\n") + cat("ANALYZING MODEL", i, ":", model_name, "\n") + cat(rep("-", 60), "\n") + + # Store results + assumption_results[[i]] <- list() + assumption_results[[i]]$model_name <- model_name + + # 1. Model Summary + model_summaries[[i]] <- get_model_summary(model, model_name) + assumption_results[[i]]$summary <- model_summaries[[i]] + + # 2. Linearity Check + assumption_results[[i]]$linearity <- check_linearity(model, model_name) + + # 3. Normality Check + assumption_results[[i]]$normality <- check_normality(model, model_name) + + # 4. Homoscedasticity Check + assumption_results[[i]]$homoscedasticity <- check_homoscedasticity(model, model_name) + + # 5. Independence Check + assumption_results[[i]]$independence <- check_independence(model, model_name) + + # 6. Influence Check + assumption_results[[i]]$influence <- check_influence(model, model_name) +} + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("ASSUMPTION VIOLATION SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create summary table +violation_summary <- data.frame( + Model = character(), + Linearity = character(), + Normality = character(), + Homoscedasticity = character(), + Independence = character(), + Influential_Obs = character(), + stringsAsFactors = FALSE +) + +# Populate summary table +for (i in 1:length(models)) { + model_name <- model_names[i] + + # Check normality (Shapiro-Wilk p < 0.05 indicates violation) + normality_violation <- ifelse(assumption_results[[i]]$normality$shapiro_p < 0.05, "VIOLATED", "OK") + + # Check homoscedasticity (Breusch-Pagan p < 0.05 indicates violation) + homosced_violation <- ifelse(assumption_results[[i]]$homoscedasticity$bp_p < 0.05, "VIOLATED", "OK") + + # Check independence (Durbin-Watson p < 0.05 indicates violation) + independence_violation <- ifelse(assumption_results[[i]]$independence$dw_p < 0.05, "VIOLATED", "OK") + + # Check for influential observations + influential_count <- length(assumption_results[[i]]$influence$influential_cooks) + influential_status <- ifelse(influential_count > 0, paste("YES (", influential_count, ")", sep = ""), "NO") + + # Linearity is assessed visually, so we'll mark as "CHECK VISUALLY" + linearity_status <- "CHECK VISUALLY" + + violation_summary <- rbind(violation_summary, data.frame( + Model = model_name, + Linearity = linearity_status, + Normality = normality_violation, + Homoscedasticity = homosced_violation, + Independence = independence_violation, + Influential_Obs = influential_status + )) +} + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("MODEL COMPARISON SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create model comparison table +comparison_table <- data.frame( + Model = model_names, + R_Squared = numeric(length(models)), + Adj_R_Squared = numeric(length(models)), + AIC = numeric(length(models)), + BIC = numeric(length(models)), + Significant = character(length(models)), + stringsAsFactors = FALSE +) + +for (i in 1:length(models)) { + summary_model <- model_summaries[[i]]$summary + comparison_table$R_Squared[i] <- summary_model$r.squared + comparison_table$Adj_R_Squared[i] <- summary_model$adj.r.squared + comparison_table$AIC[i] <- model_summaries[[i]]$aic + comparison_table$BIC[i] <- model_summaries[[i]]$bic + + # Check if predictor is significant (p < 0.05) + p_value <- summary_model$coefficients[2, 4] + comparison_table$Significant[i] <- ifelse(p_value < 0.05, "YES", "NO") +} + +print(comparison_table) + +# ============================================================================= +# RECOMMENDATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("RECOMMENDATIONS FOR ASSUMPTION VIOLATIONS\n") +cat(rep("=", 80), "\n") + +cat("\n1. NORMALITY VIOLATIONS:\n") +cat(" - If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox)\n") +cat(" - Alternative: Use robust regression methods or bootstrapping\n") + +cat("\n2. HOMOSCEDASTICITY VIOLATIONS:\n") +cat(" - If violated: Use weighted least squares or robust standard errors\n") +cat(" - Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors\n") + +cat("\n3. INDEPENDENCE VIOLATIONS:\n") +cat(" - If violated: Check for clustering or repeated measures structure\n") +cat(" - Alternative: Use mixed-effects models or clustered standard errors\n") + +cat("\n4. INFLUENTIAL OBSERVATIONS:\n") +cat(" - If present: Examine these cases for data entry errors\n") +cat(" - Consider: Running analysis with and without influential cases\n") +cat(" - Alternative: Use robust regression methods\n") + +cat("\n5. LINEARITY VIOLATIONS:\n") +cat(" - If violated: Add polynomial terms or use splines\n") +cat(" - Alternative: Transform predictors or use non-parametric methods\n") + +cat("\n", rep("=", 80), "\n") +cat("ANALYSIS COMPLETE\n") +cat(rep("=", 80), "\n") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142552.r b/.history/eohi1/regressions e1 - assumptions_20251016142552.r new file mode 100644 index 0000000..759d18b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142552.r @@ -0,0 +1,401 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean +# Total: 6 regression models + +options(scipen = 999) + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check data structure +cat("Data dimensions:", dim(data), "\n") +cat("Variables of interest:\n") +cat("IVs: demo_sex, demo_age, demo_edu\n") +cat("DVs: eohiDGEN_mean, ehi_global_mean\n\n") + +# Check for missing values +cat("Missing values check:\n") +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +cat("\nClean data dimensions:", dim(data_clean), "\n") + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +cat("\nEducation levels:\n") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +cat("\nSex recoding (0=Female, 1=Male):\n") +print(table(data_clean$demo_sex_numeric)) +cat("\nEducation recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):\n") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + cat("\n=== LINEARITY CHECK:", model_name, "===\n") + + # Residuals vs Fitted plot + residuals_vs_fitted <- plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + cr_plot <- crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + # Return plots for later use + return(list(residuals_vs_fitted = residuals_vs_fitted, cr_plot = cr_plot)) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + cat("\n=== NORMALITY CHECK:", model_name, "===\n") + + # Q-Q plot + qq_plot <- plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + cat("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5), "\n") + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + cat("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5), "\n") + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + + return(list(qq_plot = qq_plot, hist_plot = hist_plot, + shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + cat("\n=== HOMOSCEDASTICITY CHECK:", model_name, "===\n") + + # Scale-Location plot + scale_location_plot <- plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + cat("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5), "\n") + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + cat("White test p-value:", format(white_test$p.value, digits = 5), "\n") + }, error = function(e) { + cat("White test not available for this model\n") + }) + + return(list(scale_location_plot = scale_location_plot, bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + cat("\n=== INDEPENDENCE CHECK:", model_name, "===\n") + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + cat("Durbin-Watson statistic:", format(dw_test$dw, digits = 5), "\n") + cat("Durbin-Watson p-value:", format(dw_test$p, digits = 5), "\n") + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + + return(list(residuals_vs_order = residuals_vs_order, dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + cat("\n=== INFLUENCE CHECK:", model_name, "===\n") + + # Cook's Distance plot + cooks_plot <- plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + cat("Cook's Distance threshold:", format(cooks_threshold, digits = 5), "\n") + cat("Influential observations (Cook's D):", length(influential_cooks), "\n") + cat("Leverage threshold:", format(leverage_threshold, digits = 5), "\n") + cat("High leverage observations:", length(influential_leverage), "\n") + cat("DFFITS threshold:", format(dffits_threshold, digits = 5), "\n") + cat("Influential observations (DFFITS):", length(influential_dffits), "\n") + + if (length(influential_cooks) > 0) { + cat("Cook's D influential cases:", influential_cooks, "\n") + } + if (length(influential_leverage) > 0) { + cat("High leverage cases:", influential_leverage, "\n") + } + if (length(influential_dffits) > 0) { + cat("DFFITS influential cases:", influential_dffits, "\n") + } + + return(list(cooks_plot = cooks_plot, + influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + cat("\n=== MODEL SUMMARY:", model_name, "===\n") + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + cat("\nR-squared:", format(summary_model$r.squared, digits = 5), "\n") + cat("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5), "\n") + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + cat("AIC:", format(aic_val, digits = 5), "\n") + cat("BIC:", format(bic_val, digits = 5), "\n") + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS FOR ALL MODELS +# ============================================================================= + +# Create results storage +assumption_results <- list() +model_summaries <- list() + +# Model names for reference +model_names <- c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global") + +cat("\n", rep("=", 80), "\n") +cat("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS\n") +cat(rep("=", 80), "\n") + +# Run assumption checks for each model +for (i in seq_along(models)) { + model_name <- model_names[i] + model <- models[[i]] + + cat("\n", rep("-", 60), "\n") + cat("ANALYZING MODEL", i, ":", model_name, "\n") + cat(rep("-", 60), "\n") + + # Store results + assumption_results[[i]] <- list() + assumption_results[[i]]$model_name <- model_name + + # 1. Model Summary + model_summaries[[i]] <- get_model_summary(model, model_name) + assumption_results[[i]]$summary <- model_summaries[[i]] + + # 2. Linearity Check + assumption_results[[i]]$linearity <- check_linearity(model, model_name) + + # 3. Normality Check + assumption_results[[i]]$normality <- check_normality(model, model_name) + + # 4. Homoscedasticity Check + assumption_results[[i]]$homoscedasticity <- check_homoscedasticity(model, model_name) + + # 5. Independence Check + assumption_results[[i]]$independence <- check_independence(model, model_name) + + # 6. Influence Check + assumption_results[[i]]$influence <- check_influence(model, model_name) +} + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("ASSUMPTION VIOLATION SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create summary table +violation_summary <- data.frame( + Model = character(), + Linearity = character(), + Normality = character(), + Homoscedasticity = character(), + Independence = character(), + Influential_Obs = character(), + stringsAsFactors = FALSE +) + +# Populate summary table +for (i in seq_along(models)) { + model_name <- model_names[i] + + # Check normality (Shapiro-Wilk p < 0.05 indicates violation) + normality_violation <- ifelse(assumption_results[[i]]$normality$shapiro_p < 0.05, "VIOLATED", "OK") + + # Check homoscedasticity (Breusch-Pagan p < 0.05 indicates violation) + homosced_violation <- ifelse(assumption_results[[i]]$homoscedasticity$bp_p < 0.05, "VIOLATED", "OK") + + # Check independence (Durbin-Watson p < 0.05 indicates violation) + independence_violation <- ifelse(assumption_results[[i]]$independence$dw_p < 0.05, "VIOLATED", "OK") + + # Check for influential observations + influential_count <- length(assumption_results[[i]]$influence$influential_cooks) + influential_status <- ifelse(influential_count > 0, paste("YES (", influential_count, ")", sep = ""), "NO") + + # Linearity is assessed visually, so we'll mark as "CHECK VISUALLY" + linearity_status <- "CHECK VISUALLY" + + violation_summary <- rbind(violation_summary, data.frame( + Model = model_name, + Linearity = linearity_status, + Normality = normality_violation, + Homoscedasticity = homosced_violation, + Independence = independence_violation, + Influential_Obs = influential_status + )) +} + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("MODEL COMPARISON SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create model comparison table +comparison_table <- data.frame( + Model = model_names, + R_Squared = numeric(length(models)), + Adj_R_Squared = numeric(length(models)), + AIC = numeric(length(models)), + BIC = numeric(length(models)), + Significant = character(length(models)), + stringsAsFactors = FALSE +) + +for (i in seq_along(models)) { + summary_model <- model_summaries[[i]]$summary + comparison_table$R_Squared[i] <- summary_model$r.squared + comparison_table$Adj_R_Squared[i] <- summary_model$adj.r.squared + comparison_table$AIC[i] <- model_summaries[[i]]$aic + comparison_table$BIC[i] <- model_summaries[[i]]$bic + + # Check if predictor is significant (p < 0.05) + p_value <- summary_model$coefficients[2, 4] + comparison_table$Significant[i] <- ifelse(p_value < 0.05, "YES", "NO") +} + +print(comparison_table) + +# ============================================================================= +# RECOMMENDATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("RECOMMENDATIONS FOR ASSUMPTION VIOLATIONS\n") +cat(rep("=", 80), "\n") + +cat("\n1. NORMALITY VIOLATIONS:\n") +cat(" - If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox)\n") +cat(" - Alternative: Use robust regression methods or bootstrapping\n") + +cat("\n2. HOMOSCEDASTICITY VIOLATIONS:\n") +cat(" - If violated: Use weighted least squares or robust standard errors\n") +cat(" - Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors\n") + +cat("\n3. INDEPENDENCE VIOLATIONS:\n") +cat(" - If violated: Check for clustering or repeated measures structure\n") +cat(" - Alternative: Use mixed-effects models or clustered standard errors\n") + +cat("\n4. INFLUENTIAL OBSERVATIONS:\n") +cat(" - If present: Examine these cases for data entry errors\n") +cat(" - Consider: Running analysis with and without influential cases\n") +cat(" - Alternative: Use robust regression methods\n") + +cat("\n5. LINEARITY VIOLATIONS:\n") +cat(" - If violated: Add polynomial terms or use splines\n") +cat(" - Alternative: Transform predictors or use non-parametric methods\n") + +cat("\n", rep("=", 80), "\n") +cat("ANALYSIS COMPLETE\n") +cat(rep("=", 80), "\n") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142605.r b/.history/eohi1/regressions e1 - assumptions_20251016142605.r new file mode 100644 index 0000000..759d18b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142605.r @@ -0,0 +1,401 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean +# Total: 6 regression models + +options(scipen = 999) + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check data structure +cat("Data dimensions:", dim(data), "\n") +cat("Variables of interest:\n") +cat("IVs: demo_sex, demo_age, demo_edu\n") +cat("DVs: eohiDGEN_mean, ehi_global_mean\n\n") + +# Check for missing values +cat("Missing values check:\n") +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +cat("\nClean data dimensions:", dim(data_clean), "\n") + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +cat("\nEducation levels:\n") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +cat("\nSex recoding (0=Female, 1=Male):\n") +print(table(data_clean$demo_sex_numeric)) +cat("\nEducation recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):\n") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + cat("\n=== LINEARITY CHECK:", model_name, "===\n") + + # Residuals vs Fitted plot + residuals_vs_fitted <- plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + cr_plot <- crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + # Return plots for later use + return(list(residuals_vs_fitted = residuals_vs_fitted, cr_plot = cr_plot)) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + cat("\n=== NORMALITY CHECK:", model_name, "===\n") + + # Q-Q plot + qq_plot <- plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + cat("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5), "\n") + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + cat("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5), "\n") + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + + return(list(qq_plot = qq_plot, hist_plot = hist_plot, + shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + cat("\n=== HOMOSCEDASTICITY CHECK:", model_name, "===\n") + + # Scale-Location plot + scale_location_plot <- plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + cat("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5), "\n") + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + cat("White test p-value:", format(white_test$p.value, digits = 5), "\n") + }, error = function(e) { + cat("White test not available for this model\n") + }) + + return(list(scale_location_plot = scale_location_plot, bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + cat("\n=== INDEPENDENCE CHECK:", model_name, "===\n") + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + cat("Durbin-Watson statistic:", format(dw_test$dw, digits = 5), "\n") + cat("Durbin-Watson p-value:", format(dw_test$p, digits = 5), "\n") + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + + return(list(residuals_vs_order = residuals_vs_order, dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + cat("\n=== INFLUENCE CHECK:", model_name, "===\n") + + # Cook's Distance plot + cooks_plot <- plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + cat("Cook's Distance threshold:", format(cooks_threshold, digits = 5), "\n") + cat("Influential observations (Cook's D):", length(influential_cooks), "\n") + cat("Leverage threshold:", format(leverage_threshold, digits = 5), "\n") + cat("High leverage observations:", length(influential_leverage), "\n") + cat("DFFITS threshold:", format(dffits_threshold, digits = 5), "\n") + cat("Influential observations (DFFITS):", length(influential_dffits), "\n") + + if (length(influential_cooks) > 0) { + cat("Cook's D influential cases:", influential_cooks, "\n") + } + if (length(influential_leverage) > 0) { + cat("High leverage cases:", influential_leverage, "\n") + } + if (length(influential_dffits) > 0) { + cat("DFFITS influential cases:", influential_dffits, "\n") + } + + return(list(cooks_plot = cooks_plot, + influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + cat("\n=== MODEL SUMMARY:", model_name, "===\n") + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + cat("\nR-squared:", format(summary_model$r.squared, digits = 5), "\n") + cat("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5), "\n") + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + cat("AIC:", format(aic_val, digits = 5), "\n") + cat("BIC:", format(bic_val, digits = 5), "\n") + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS FOR ALL MODELS +# ============================================================================= + +# Create results storage +assumption_results <- list() +model_summaries <- list() + +# Model names for reference +model_names <- c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global") + +cat("\n", rep("=", 80), "\n") +cat("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS\n") +cat(rep("=", 80), "\n") + +# Run assumption checks for each model +for (i in seq_along(models)) { + model_name <- model_names[i] + model <- models[[i]] + + cat("\n", rep("-", 60), "\n") + cat("ANALYZING MODEL", i, ":", model_name, "\n") + cat(rep("-", 60), "\n") + + # Store results + assumption_results[[i]] <- list() + assumption_results[[i]]$model_name <- model_name + + # 1. Model Summary + model_summaries[[i]] <- get_model_summary(model, model_name) + assumption_results[[i]]$summary <- model_summaries[[i]] + + # 2. Linearity Check + assumption_results[[i]]$linearity <- check_linearity(model, model_name) + + # 3. Normality Check + assumption_results[[i]]$normality <- check_normality(model, model_name) + + # 4. Homoscedasticity Check + assumption_results[[i]]$homoscedasticity <- check_homoscedasticity(model, model_name) + + # 5. Independence Check + assumption_results[[i]]$independence <- check_independence(model, model_name) + + # 6. Influence Check + assumption_results[[i]]$influence <- check_influence(model, model_name) +} + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("ASSUMPTION VIOLATION SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create summary table +violation_summary <- data.frame( + Model = character(), + Linearity = character(), + Normality = character(), + Homoscedasticity = character(), + Independence = character(), + Influential_Obs = character(), + stringsAsFactors = FALSE +) + +# Populate summary table +for (i in seq_along(models)) { + model_name <- model_names[i] + + # Check normality (Shapiro-Wilk p < 0.05 indicates violation) + normality_violation <- ifelse(assumption_results[[i]]$normality$shapiro_p < 0.05, "VIOLATED", "OK") + + # Check homoscedasticity (Breusch-Pagan p < 0.05 indicates violation) + homosced_violation <- ifelse(assumption_results[[i]]$homoscedasticity$bp_p < 0.05, "VIOLATED", "OK") + + # Check independence (Durbin-Watson p < 0.05 indicates violation) + independence_violation <- ifelse(assumption_results[[i]]$independence$dw_p < 0.05, "VIOLATED", "OK") + + # Check for influential observations + influential_count <- length(assumption_results[[i]]$influence$influential_cooks) + influential_status <- ifelse(influential_count > 0, paste("YES (", influential_count, ")", sep = ""), "NO") + + # Linearity is assessed visually, so we'll mark as "CHECK VISUALLY" + linearity_status <- "CHECK VISUALLY" + + violation_summary <- rbind(violation_summary, data.frame( + Model = model_name, + Linearity = linearity_status, + Normality = normality_violation, + Homoscedasticity = homosced_violation, + Independence = independence_violation, + Influential_Obs = influential_status + )) +} + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("MODEL COMPARISON SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create model comparison table +comparison_table <- data.frame( + Model = model_names, + R_Squared = numeric(length(models)), + Adj_R_Squared = numeric(length(models)), + AIC = numeric(length(models)), + BIC = numeric(length(models)), + Significant = character(length(models)), + stringsAsFactors = FALSE +) + +for (i in seq_along(models)) { + summary_model <- model_summaries[[i]]$summary + comparison_table$R_Squared[i] <- summary_model$r.squared + comparison_table$Adj_R_Squared[i] <- summary_model$adj.r.squared + comparison_table$AIC[i] <- model_summaries[[i]]$aic + comparison_table$BIC[i] <- model_summaries[[i]]$bic + + # Check if predictor is significant (p < 0.05) + p_value <- summary_model$coefficients[2, 4] + comparison_table$Significant[i] <- ifelse(p_value < 0.05, "YES", "NO") +} + +print(comparison_table) + +# ============================================================================= +# RECOMMENDATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("RECOMMENDATIONS FOR ASSUMPTION VIOLATIONS\n") +cat(rep("=", 80), "\n") + +cat("\n1. NORMALITY VIOLATIONS:\n") +cat(" - If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox)\n") +cat(" - Alternative: Use robust regression methods or bootstrapping\n") + +cat("\n2. HOMOSCEDASTICITY VIOLATIONS:\n") +cat(" - If violated: Use weighted least squares or robust standard errors\n") +cat(" - Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors\n") + +cat("\n3. INDEPENDENCE VIOLATIONS:\n") +cat(" - If violated: Check for clustering or repeated measures structure\n") +cat(" - Alternative: Use mixed-effects models or clustered standard errors\n") + +cat("\n4. INFLUENTIAL OBSERVATIONS:\n") +cat(" - If present: Examine these cases for data entry errors\n") +cat(" - Consider: Running analysis with and without influential cases\n") +cat(" - Alternative: Use robust regression methods\n") + +cat("\n5. LINEARITY VIOLATIONS:\n") +cat(" - If violated: Add polynomial terms or use splines\n") +cat(" - Alternative: Transform predictors or use non-parametric methods\n") + +cat("\n", rep("=", 80), "\n") +cat("ANALYSIS COMPLETE\n") +cat(rep("=", 80), "\n") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142612.r b/.history/eohi1/regressions e1 - assumptions_20251016142612.r new file mode 100644 index 0000000..759d18b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142612.r @@ -0,0 +1,401 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean +# Total: 6 regression models + +options(scipen = 999) + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check data structure +cat("Data dimensions:", dim(data), "\n") +cat("Variables of interest:\n") +cat("IVs: demo_sex, demo_age, demo_edu\n") +cat("DVs: eohiDGEN_mean, ehi_global_mean\n\n") + +# Check for missing values +cat("Missing values check:\n") +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +cat("\nClean data dimensions:", dim(data_clean), "\n") + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +cat("\nEducation levels:\n") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +cat("\nSex recoding (0=Female, 1=Male):\n") +print(table(data_clean$demo_sex_numeric)) +cat("\nEducation recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):\n") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + cat("\n=== LINEARITY CHECK:", model_name, "===\n") + + # Residuals vs Fitted plot + residuals_vs_fitted <- plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + cr_plot <- crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + # Return plots for later use + return(list(residuals_vs_fitted = residuals_vs_fitted, cr_plot = cr_plot)) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + cat("\n=== NORMALITY CHECK:", model_name, "===\n") + + # Q-Q plot + qq_plot <- plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + cat("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5), "\n") + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + cat("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5), "\n") + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + + return(list(qq_plot = qq_plot, hist_plot = hist_plot, + shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + cat("\n=== HOMOSCEDASTICITY CHECK:", model_name, "===\n") + + # Scale-Location plot + scale_location_plot <- plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + cat("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5), "\n") + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + cat("White test p-value:", format(white_test$p.value, digits = 5), "\n") + }, error = function(e) { + cat("White test not available for this model\n") + }) + + return(list(scale_location_plot = scale_location_plot, bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + cat("\n=== INDEPENDENCE CHECK:", model_name, "===\n") + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + cat("Durbin-Watson statistic:", format(dw_test$dw, digits = 5), "\n") + cat("Durbin-Watson p-value:", format(dw_test$p, digits = 5), "\n") + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + + return(list(residuals_vs_order = residuals_vs_order, dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + cat("\n=== INFLUENCE CHECK:", model_name, "===\n") + + # Cook's Distance plot + cooks_plot <- plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + cat("Cook's Distance threshold:", format(cooks_threshold, digits = 5), "\n") + cat("Influential observations (Cook's D):", length(influential_cooks), "\n") + cat("Leverage threshold:", format(leverage_threshold, digits = 5), "\n") + cat("High leverage observations:", length(influential_leverage), "\n") + cat("DFFITS threshold:", format(dffits_threshold, digits = 5), "\n") + cat("Influential observations (DFFITS):", length(influential_dffits), "\n") + + if (length(influential_cooks) > 0) { + cat("Cook's D influential cases:", influential_cooks, "\n") + } + if (length(influential_leverage) > 0) { + cat("High leverage cases:", influential_leverage, "\n") + } + if (length(influential_dffits) > 0) { + cat("DFFITS influential cases:", influential_dffits, "\n") + } + + return(list(cooks_plot = cooks_plot, + influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + cat("\n=== MODEL SUMMARY:", model_name, "===\n") + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + cat("\nR-squared:", format(summary_model$r.squared, digits = 5), "\n") + cat("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5), "\n") + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + cat("AIC:", format(aic_val, digits = 5), "\n") + cat("BIC:", format(bic_val, digits = 5), "\n") + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS FOR ALL MODELS +# ============================================================================= + +# Create results storage +assumption_results <- list() +model_summaries <- list() + +# Model names for reference +model_names <- c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global") + +cat("\n", rep("=", 80), "\n") +cat("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS\n") +cat(rep("=", 80), "\n") + +# Run assumption checks for each model +for (i in seq_along(models)) { + model_name <- model_names[i] + model <- models[[i]] + + cat("\n", rep("-", 60), "\n") + cat("ANALYZING MODEL", i, ":", model_name, "\n") + cat(rep("-", 60), "\n") + + # Store results + assumption_results[[i]] <- list() + assumption_results[[i]]$model_name <- model_name + + # 1. Model Summary + model_summaries[[i]] <- get_model_summary(model, model_name) + assumption_results[[i]]$summary <- model_summaries[[i]] + + # 2. Linearity Check + assumption_results[[i]]$linearity <- check_linearity(model, model_name) + + # 3. Normality Check + assumption_results[[i]]$normality <- check_normality(model, model_name) + + # 4. Homoscedasticity Check + assumption_results[[i]]$homoscedasticity <- check_homoscedasticity(model, model_name) + + # 5. Independence Check + assumption_results[[i]]$independence <- check_independence(model, model_name) + + # 6. Influence Check + assumption_results[[i]]$influence <- check_influence(model, model_name) +} + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("ASSUMPTION VIOLATION SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create summary table +violation_summary <- data.frame( + Model = character(), + Linearity = character(), + Normality = character(), + Homoscedasticity = character(), + Independence = character(), + Influential_Obs = character(), + stringsAsFactors = FALSE +) + +# Populate summary table +for (i in seq_along(models)) { + model_name <- model_names[i] + + # Check normality (Shapiro-Wilk p < 0.05 indicates violation) + normality_violation <- ifelse(assumption_results[[i]]$normality$shapiro_p < 0.05, "VIOLATED", "OK") + + # Check homoscedasticity (Breusch-Pagan p < 0.05 indicates violation) + homosced_violation <- ifelse(assumption_results[[i]]$homoscedasticity$bp_p < 0.05, "VIOLATED", "OK") + + # Check independence (Durbin-Watson p < 0.05 indicates violation) + independence_violation <- ifelse(assumption_results[[i]]$independence$dw_p < 0.05, "VIOLATED", "OK") + + # Check for influential observations + influential_count <- length(assumption_results[[i]]$influence$influential_cooks) + influential_status <- ifelse(influential_count > 0, paste("YES (", influential_count, ")", sep = ""), "NO") + + # Linearity is assessed visually, so we'll mark as "CHECK VISUALLY" + linearity_status <- "CHECK VISUALLY" + + violation_summary <- rbind(violation_summary, data.frame( + Model = model_name, + Linearity = linearity_status, + Normality = normality_violation, + Homoscedasticity = homosced_violation, + Independence = independence_violation, + Influential_Obs = influential_status + )) +} + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("MODEL COMPARISON SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create model comparison table +comparison_table <- data.frame( + Model = model_names, + R_Squared = numeric(length(models)), + Adj_R_Squared = numeric(length(models)), + AIC = numeric(length(models)), + BIC = numeric(length(models)), + Significant = character(length(models)), + stringsAsFactors = FALSE +) + +for (i in seq_along(models)) { + summary_model <- model_summaries[[i]]$summary + comparison_table$R_Squared[i] <- summary_model$r.squared + comparison_table$Adj_R_Squared[i] <- summary_model$adj.r.squared + comparison_table$AIC[i] <- model_summaries[[i]]$aic + comparison_table$BIC[i] <- model_summaries[[i]]$bic + + # Check if predictor is significant (p < 0.05) + p_value <- summary_model$coefficients[2, 4] + comparison_table$Significant[i] <- ifelse(p_value < 0.05, "YES", "NO") +} + +print(comparison_table) + +# ============================================================================= +# RECOMMENDATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("RECOMMENDATIONS FOR ASSUMPTION VIOLATIONS\n") +cat(rep("=", 80), "\n") + +cat("\n1. NORMALITY VIOLATIONS:\n") +cat(" - If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox)\n") +cat(" - Alternative: Use robust regression methods or bootstrapping\n") + +cat("\n2. HOMOSCEDASTICITY VIOLATIONS:\n") +cat(" - If violated: Use weighted least squares or robust standard errors\n") +cat(" - Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors\n") + +cat("\n3. INDEPENDENCE VIOLATIONS:\n") +cat(" - If violated: Check for clustering or repeated measures structure\n") +cat(" - Alternative: Use mixed-effects models or clustered standard errors\n") + +cat("\n4. INFLUENTIAL OBSERVATIONS:\n") +cat(" - If present: Examine these cases for data entry errors\n") +cat(" - Consider: Running analysis with and without influential cases\n") +cat(" - Alternative: Use robust regression methods\n") + +cat("\n5. LINEARITY VIOLATIONS:\n") +cat(" - If violated: Add polynomial terms or use splines\n") +cat(" - Alternative: Transform predictors or use non-parametric methods\n") + +cat("\n", rep("=", 80), "\n") +cat("ANALYSIS COMPLETE\n") +cat(rep("=", 80), "\n") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142849.r b/.history/eohi1/regressions e1 - assumptions_20251016142849.r new file mode 100644 index 0000000..563f458 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142849.r @@ -0,0 +1,393 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + cat("\n=== LINEARITY CHECK:", model_name, "===\n") + + # Residuals vs Fitted plot + residuals_vs_fitted <- plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + cr_plot <- crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + # Return plots for later use + return(list(residuals_vs_fitted = residuals_vs_fitted, cr_plot = cr_plot)) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + cat("\n=== NORMALITY CHECK:", model_name, "===\n") + + # Q-Q plot + qq_plot <- plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + cat("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5), "\n") + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + cat("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5), "\n") + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + + return(list(qq_plot = qq_plot, hist_plot = hist_plot, + shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + cat("\n=== HOMOSCEDASTICITY CHECK:", model_name, "===\n") + + # Scale-Location plot + scale_location_plot <- plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + cat("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5), "\n") + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + cat("White test p-value:", format(white_test$p.value, digits = 5), "\n") + }, error = function(e) { + cat("White test not available for this model\n") + }) + + return(list(scale_location_plot = scale_location_plot, bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + cat("\n=== INDEPENDENCE CHECK:", model_name, "===\n") + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + cat("Durbin-Watson statistic:", format(dw_test$dw, digits = 5), "\n") + cat("Durbin-Watson p-value:", format(dw_test$p, digits = 5), "\n") + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + + return(list(residuals_vs_order = residuals_vs_order, dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + cat("\n=== INFLUENCE CHECK:", model_name, "===\n") + + # Cook's Distance plot + cooks_plot <- plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + cat("Cook's Distance threshold:", format(cooks_threshold, digits = 5), "\n") + cat("Influential observations (Cook's D):", length(influential_cooks), "\n") + cat("Leverage threshold:", format(leverage_threshold, digits = 5), "\n") + cat("High leverage observations:", length(influential_leverage), "\n") + cat("DFFITS threshold:", format(dffits_threshold, digits = 5), "\n") + cat("Influential observations (DFFITS):", length(influential_dffits), "\n") + + if (length(influential_cooks) > 0) { + cat("Cook's D influential cases:", influential_cooks, "\n") + } + if (length(influential_leverage) > 0) { + cat("High leverage cases:", influential_leverage, "\n") + } + if (length(influential_dffits) > 0) { + cat("DFFITS influential cases:", influential_dffits, "\n") + } + + return(list(cooks_plot = cooks_plot, + influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + cat("\n=== MODEL SUMMARY:", model_name, "===\n") + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + cat("\nR-squared:", format(summary_model$r.squared, digits = 5), "\n") + cat("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5), "\n") + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + cat("AIC:", format(aic_val, digits = 5), "\n") + cat("BIC:", format(bic_val, digits = 5), "\n") + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS FOR ALL MODELS +# ============================================================================= + +# Create results storage +assumption_results <- list() +model_summaries <- list() + +# Model names for reference +model_names <- c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global") + +cat("\n", rep("=", 80), "\n") +cat("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS\n") +cat(rep("=", 80), "\n") + +# Run assumption checks for each model +for (i in seq_along(models)) { + model_name <- model_names[i] + model <- models[[i]] + + cat("\n", rep("-", 60), "\n") + cat("ANALYZING MODEL", i, ":", model_name, "\n") + cat(rep("-", 60), "\n") + + # Store results + assumption_results[[i]] <- list() + assumption_results[[i]]$model_name <- model_name + + # 1. Model Summary + model_summaries[[i]] <- get_model_summary(model, model_name) + assumption_results[[i]]$summary <- model_summaries[[i]] + + # 2. Linearity Check + assumption_results[[i]]$linearity <- check_linearity(model, model_name) + + # 3. Normality Check + assumption_results[[i]]$normality <- check_normality(model, model_name) + + # 4. Homoscedasticity Check + assumption_results[[i]]$homoscedasticity <- check_homoscedasticity(model, model_name) + + # 5. Independence Check + assumption_results[[i]]$independence <- check_independence(model, model_name) + + # 6. Influence Check + assumption_results[[i]]$influence <- check_influence(model, model_name) +} + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("ASSUMPTION VIOLATION SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create summary table +violation_summary <- data.frame( + Model = character(), + Linearity = character(), + Normality = character(), + Homoscedasticity = character(), + Independence = character(), + Influential_Obs = character(), + stringsAsFactors = FALSE +) + +# Populate summary table +for (i in seq_along(models)) { + model_name <- model_names[i] + + # Check normality (Shapiro-Wilk p < 0.05 indicates violation) + normality_violation <- ifelse(assumption_results[[i]]$normality$shapiro_p < 0.05, "VIOLATED", "OK") + + # Check homoscedasticity (Breusch-Pagan p < 0.05 indicates violation) + homosced_violation <- ifelse(assumption_results[[i]]$homoscedasticity$bp_p < 0.05, "VIOLATED", "OK") + + # Check independence (Durbin-Watson p < 0.05 indicates violation) + independence_violation <- ifelse(assumption_results[[i]]$independence$dw_p < 0.05, "VIOLATED", "OK") + + # Check for influential observations + influential_count <- length(assumption_results[[i]]$influence$influential_cooks) + influential_status <- ifelse(influential_count > 0, paste("YES (", influential_count, ")", sep = ""), "NO") + + # Linearity is assessed visually, so we'll mark as "CHECK VISUALLY" + linearity_status <- "CHECK VISUALLY" + + violation_summary <- rbind(violation_summary, data.frame( + Model = model_name, + Linearity = linearity_status, + Normality = normality_violation, + Homoscedasticity = homosced_violation, + Independence = independence_violation, + Influential_Obs = influential_status + )) +} + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("MODEL COMPARISON SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create model comparison table +comparison_table <- data.frame( + Model = model_names, + R_Squared = numeric(length(models)), + Adj_R_Squared = numeric(length(models)), + AIC = numeric(length(models)), + BIC = numeric(length(models)), + Significant = character(length(models)), + stringsAsFactors = FALSE +) + +for (i in seq_along(models)) { + summary_model <- model_summaries[[i]]$summary + comparison_table$R_Squared[i] <- summary_model$r.squared + comparison_table$Adj_R_Squared[i] <- summary_model$adj.r.squared + comparison_table$AIC[i] <- model_summaries[[i]]$aic + comparison_table$BIC[i] <- model_summaries[[i]]$bic + + # Check if predictor is significant (p < 0.05) + p_value <- summary_model$coefficients[2, 4] + comparison_table$Significant[i] <- ifelse(p_value < 0.05, "YES", "NO") +} + +print(comparison_table) + +# ============================================================================= +# RECOMMENDATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("RECOMMENDATIONS FOR ASSUMPTION VIOLATIONS\n") +cat(rep("=", 80), "\n") + +cat("\n1. NORMALITY VIOLATIONS:\n") +cat(" - If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox)\n") +cat(" - Alternative: Use robust regression methods or bootstrapping\n") + +cat("\n2. HOMOSCEDASTICITY VIOLATIONS:\n") +cat(" - If violated: Use weighted least squares or robust standard errors\n") +cat(" - Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors\n") + +cat("\n3. INDEPENDENCE VIOLATIONS:\n") +cat(" - If violated: Check for clustering or repeated measures structure\n") +cat(" - Alternative: Use mixed-effects models or clustered standard errors\n") + +cat("\n4. INFLUENTIAL OBSERVATIONS:\n") +cat(" - If present: Examine these cases for data entry errors\n") +cat(" - Consider: Running analysis with and without influential cases\n") +cat(" - Alternative: Use robust regression methods\n") + +cat("\n5. LINEARITY VIOLATIONS:\n") +cat(" - If violated: Add polynomial terms or use splines\n") +cat(" - Alternative: Transform predictors or use non-parametric methods\n") + +cat("\n", rep("=", 80), "\n") +cat("ANALYSIS COMPLETE\n") +cat(rep("=", 80), "\n") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016142956.r b/.history/eohi1/regressions e1 - assumptions_20251016142956.r new file mode 100644 index 0000000..3c99586 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016142956.r @@ -0,0 +1,392 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS FOR ALL MODELS +# ============================================================================= + +# Create results storage +assumption_results <- list() +model_summaries <- list() + +# Model names for reference +model_names <- c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global") + +cat("\n", rep("=", 80), "\n") +cat("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS\n") +cat(rep("=", 80), "\n") + +# Run assumption checks for each model +for (i in seq_along(models)) { + model_name <- model_names[i] + model <- models[[i]] + + cat("\n", rep("-", 60), "\n") + cat("ANALYZING MODEL", i, ":", model_name, "\n") + cat(rep("-", 60), "\n") + + # Store results + assumption_results[[i]] <- list() + assumption_results[[i]]$model_name <- model_name + + # 1. Model Summary + model_summaries[[i]] <- get_model_summary(model, model_name) + assumption_results[[i]]$summary <- model_summaries[[i]] + + # 2. Linearity Check + assumption_results[[i]]$linearity <- check_linearity(model, model_name) + + # 3. Normality Check + assumption_results[[i]]$normality <- check_normality(model, model_name) + + # 4. Homoscedasticity Check + assumption_results[[i]]$homoscedasticity <- check_homoscedasticity(model, model_name) + + # 5. Independence Check + assumption_results[[i]]$independence <- check_independence(model, model_name) + + # 6. Influence Check + assumption_results[[i]]$influence <- check_influence(model, model_name) +} + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("ASSUMPTION VIOLATION SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create summary table +violation_summary <- data.frame( + Model = character(), + Linearity = character(), + Normality = character(), + Homoscedasticity = character(), + Independence = character(), + Influential_Obs = character(), + stringsAsFactors = FALSE +) + +# Populate summary table +for (i in seq_along(models)) { + model_name <- model_names[i] + + # Check normality (Shapiro-Wilk p < 0.05 indicates violation) + normality_violation <- ifelse(assumption_results[[i]]$normality$shapiro_p < 0.05, "VIOLATED", "OK") + + # Check homoscedasticity (Breusch-Pagan p < 0.05 indicates violation) + homosced_violation <- ifelse(assumption_results[[i]]$homoscedasticity$bp_p < 0.05, "VIOLATED", "OK") + + # Check independence (Durbin-Watson p < 0.05 indicates violation) + independence_violation <- ifelse(assumption_results[[i]]$independence$dw_p < 0.05, "VIOLATED", "OK") + + # Check for influential observations + influential_count <- length(assumption_results[[i]]$influence$influential_cooks) + influential_status <- ifelse(influential_count > 0, paste("YES (", influential_count, ")", sep = ""), "NO") + + # Linearity is assessed visually, so we'll mark as "CHECK VISUALLY" + linearity_status <- "CHECK VISUALLY" + + violation_summary <- rbind(violation_summary, data.frame( + Model = model_name, + Linearity = linearity_status, + Normality = normality_violation, + Homoscedasticity = homosced_violation, + Independence = independence_violation, + Influential_Obs = influential_status + )) +} + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("MODEL COMPARISON SUMMARY\n") +cat(rep("=", 80), "\n") + +# Create model comparison table +comparison_table <- data.frame( + Model = model_names, + R_Squared = numeric(length(models)), + Adj_R_Squared = numeric(length(models)), + AIC = numeric(length(models)), + BIC = numeric(length(models)), + Significant = character(length(models)), + stringsAsFactors = FALSE +) + +for (i in seq_along(models)) { + summary_model <- model_summaries[[i]]$summary + comparison_table$R_Squared[i] <- summary_model$r.squared + comparison_table$Adj_R_Squared[i] <- summary_model$adj.r.squared + comparison_table$AIC[i] <- model_summaries[[i]]$aic + comparison_table$BIC[i] <- model_summaries[[i]]$bic + + # Check if predictor is significant (p < 0.05) + p_value <- summary_model$coefficients[2, 4] + comparison_table$Significant[i] <- ifelse(p_value < 0.05, "YES", "NO") +} + +print(comparison_table) + +# ============================================================================= +# RECOMMENDATIONS +# ============================================================================= + +cat("\n", rep("=", 80), "\n") +cat("RECOMMENDATIONS FOR ASSUMPTION VIOLATIONS\n") +cat(rep("=", 80), "\n") + +cat("\n1. NORMALITY VIOLATIONS:\n") +cat(" - If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox)\n") +cat(" - Alternative: Use robust regression methods or bootstrapping\n") + +cat("\n2. HOMOSCEDASTICITY VIOLATIONS:\n") +cat(" - If violated: Use weighted least squares or robust standard errors\n") +cat(" - Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors\n") + +cat("\n3. INDEPENDENCE VIOLATIONS:\n") +cat(" - If violated: Check for clustering or repeated measures structure\n") +cat(" - Alternative: Use mixed-effects models or clustered standard errors\n") + +cat("\n4. INFLUENTIAL OBSERVATIONS:\n") +cat(" - If present: Examine these cases for data entry errors\n") +cat(" - Consider: Running analysis with and without influential cases\n") +cat(" - Alternative: Use robust regression methods\n") + +cat("\n5. LINEARITY VIOLATIONS:\n") +cat(" - If violated: Add polynomial terms or use splines\n") +cat(" - Alternative: Transform predictors or use non-parametric methods\n") + +cat("\n", rep("=", 80), "\n") +cat("ANALYSIS COMPLETE\n") +cat(rep("=", 80), "\n") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016143059.r b/.history/eohi1/regressions e1 - assumptions_20251016143059.r new file mode 100644 index 0000000..63e1b1c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016143059.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016143109.r b/.history/eohi1/regressions e1 - assumptions_20251016143109.r new file mode 100644 index 0000000..63e1b1c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016143109.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016143341.r b/.history/eohi1/regressions e1 - assumptions_20251016143341.r new file mode 100644 index 0000000..63e1b1c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016143341.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016143415.r b/.history/eohi1/regressions e1 - assumptions_20251016143415.r new file mode 100644 index 0000000..63e1b1c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016143415.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016143441.r b/.history/eohi1/regressions e1 - assumptions_20251016143441.r new file mode 100644 index 0000000..63e1b1c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016143441.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016144540.qmd b/.history/eohi1/regressions e1 - assumptions_20251016144540.qmd new file mode 100644 index 0000000..2b9244f --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016144540.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016144554.qmd b/.history/eohi1/regressions e1 - assumptions_20251016144554.qmd new file mode 100644 index 0000000..2b9244f --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016144554.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016144652.qmd b/.history/eohi1/regressions e1 - assumptions_20251016144652.qmd new file mode 100644 index 0000000..2b9244f --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016144652.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016145531.qmd b/.history/eohi1/regressions e1 - assumptions_20251016145531.qmd new file mode 100644 index 0000000..f5e7a0b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016145531.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016145539.qmd b/.history/eohi1/regressions e1 - assumptions_20251016145539.qmd new file mode 100644 index 0000000..f5e7a0b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016145539.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016145845.qmd b/.history/eohi1/regressions e1 - assumptions_20251016145845.qmd new file mode 100644 index 0000000..f5e7a0b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016145845.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150135.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150135.qmd new file mode 100644 index 0000000..3d30af9 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150135.qmd @@ -0,0 +1,463 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150355.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150355.qmd new file mode 100644 index 0000000..f098c5b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150355.qmd @@ -0,0 +1,467 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Create dummy variables for education (6 levels) +data_clean$edu_hs <- ifelse(data_clean$demo_edu == "High School (or equivalent)", 1, 0) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables:") +print("High School:", sum(data_clean$edu_hs)) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150436.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150436.qmd new file mode 100644 index 0000000..f098c5b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150436.qmd @@ -0,0 +1,467 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Create dummy variables for education (6 levels) +data_clean$edu_hs <- ifelse(data_clean$demo_edu == "High School (or equivalent)", 1, 0) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables:") +print("High School:", sum(data_clean$edu_hs)) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150455.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150455.qmd new file mode 100644 index 0000000..89e657f --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150455.qmd @@ -0,0 +1,479 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check if there are other education levels +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables if needed (adjust based on your actual data) +# Add more dummy variables for any additional education levels beyond the 4 we've coded + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150502.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150502.qmd new file mode 100644 index 0000000..335fb8a --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150502.qmd @@ -0,0 +1,479 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check if there are other education levels +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables if needed (adjust based on your actual data) +# Add more dummy variables for any additional education levels beyond the 4 we've coded + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150507.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150507.qmd new file mode 100644 index 0000000..16f8f4c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150507.qmd @@ -0,0 +1,479 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check if there are other education levels +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables if needed (adjust based on your actual data) +# Add more dummy variables for any additional education levels beyond the 4 we've coded + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150527.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150527.qmd new file mode 100644 index 0000000..67eccf0 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150527.qmd @@ -0,0 +1,485 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150545.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150545.qmd new file mode 100644 index 0000000..67eccf0 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150545.qmd @@ -0,0 +1,485 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016150558.qmd b/.history/eohi1/regressions e1 - assumptions_20251016150558.qmd new file mode 100644 index 0000000..67eccf0 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016150558.qmd @@ -0,0 +1,485 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true +execute: + echo: true + warning: false + message: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154019.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154019.qmd new file mode 100644 index 0000000..ef9b009 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154019.qmd @@ -0,0 +1,489 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154024.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154024.qmd new file mode 100644 index 0000000..b8362ec --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154024.qmd @@ -0,0 +1,490 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154032.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154032.qmd new file mode 100644 index 0000000..b19fd37 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154032.qmd @@ -0,0 +1,491 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154037.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154037.qmd new file mode 100644 index 0000000..ff233ba --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154037.qmd @@ -0,0 +1,492 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154047.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154047.qmd new file mode 100644 index 0000000..ff233ba --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154047.qmd @@ -0,0 +1,492 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154106.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154106.qmd new file mode 100644 index 0000000..ff233ba --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154106.qmd @@ -0,0 +1,492 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154110.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154110.qmd new file mode 100644 index 0000000..ff233ba --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154110.qmd @@ -0,0 +1,492 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154202.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154202.qmd new file mode 100644 index 0000000..40dfbcd --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154202.qmd @@ -0,0 +1,494 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154210.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154210.qmd new file mode 100644 index 0000000..a8af071 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154210.qmd @@ -0,0 +1,495 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154217.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154217.qmd new file mode 100644 index 0000000..a8af071 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154217.qmd @@ -0,0 +1,495 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154250.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154250.qmd new file mode 100644 index 0000000..a8af071 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154250.qmd @@ -0,0 +1,495 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(car) +library(performance) +library(see) +library(ggplot2) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154501.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154501.qmd new file mode 100644 index 0000000..6811562 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154501.qmd @@ -0,0 +1,497 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +library(see) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154514.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154514.qmd new file mode 100644 index 0000000..6811562 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154514.qmd @@ -0,0 +1,497 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +library(see) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154524.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154524.qmd new file mode 100644 index 0000000..6811562 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154524.qmd @@ -0,0 +1,497 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +library(see) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154558.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154558.qmd new file mode 100644 index 0000000..253c964 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154558.qmd @@ -0,0 +1,502 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +library(see) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154609.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154609.qmd new file mode 100644 index 0000000..253c964 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154609.qmd @@ -0,0 +1,502 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +library(see) +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154622.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154622.qmd new file mode 100644 index 0000000..597b24d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154622.qmd @@ -0,0 +1,502 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154628.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154628.qmd new file mode 100644 index 0000000..597b24d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154628.qmd @@ -0,0 +1,502 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154636.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154636.qmd new file mode 100644 index 0000000..597b24d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154636.qmd @@ -0,0 +1,502 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154647.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154647.qmd new file mode 100644 index 0000000..597b24d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154647.qmd @@ -0,0 +1,502 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154910.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154910.qmd new file mode 100644 index 0000000..ab9db88 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154910.qmd @@ -0,0 +1,504 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154925.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154925.qmd new file mode 100644 index 0000000..3735fd4 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154925.qmd @@ -0,0 +1,516 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016154946.qmd b/.history/eohi1/regressions e1 - assumptions_20251016154946.qmd new file mode 100644 index 0000000..3735fd4 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016154946.qmd @@ -0,0 +1,516 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016155002.qmd b/.history/eohi1/regressions e1 - assumptions_20251016155002.qmd new file mode 100644 index 0000000..3735fd4 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016155002.qmd @@ -0,0 +1,516 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016155036.qmd b/.history/eohi1/regressions e1 - assumptions_20251016155036.qmd new file mode 100644 index 0000000..768a4ae --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016155036.qmd @@ -0,0 +1,518 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true +#| include: true + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016155057.qmd b/.history/eohi1/regressions e1 - assumptions_20251016155057.qmd new file mode 100644 index 0000000..768a4ae --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016155057.qmd @@ -0,0 +1,518 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true +#| include: true + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016155747.qmd b/.history/eohi1/regressions e1 - assumptions_20251016155747.qmd new file mode 100644 index 0000000..768a4ae --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016155747.qmd @@ -0,0 +1,518 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true +#| include: true + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016161118.qmd b/.history/eohi1/regressions e1 - assumptions_20251016161118.qmd new file mode 100644 index 0000000..7ef393f --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016161118.qmd @@ -0,0 +1,519 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false + freeze: false +--- + +## Setup and Data Preparation + +```{r simple-test} +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true +#| include: true + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016161133.qmd b/.history/eohi1/regressions e1 - assumptions_20251016161133.qmd new file mode 100644 index 0000000..438c056 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016161133.qmd @@ -0,0 +1,517 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false + freeze: false +--- + +## Setup and Data Preparation + +```{r} +#| label: simple-test +#| echo: true +#| output: true + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016161154.qmd b/.history/eohi1/regressions e1 - assumptions_20251016161154.qmd new file mode 100644 index 0000000..438c056 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016161154.qmd @@ -0,0 +1,517 @@ +--- +title: "Regression Analysis - Assumption Checking" +subtitle: "IVs: demo_sex, demo_age, demo_edu | DVs: eohiDGEN_mean, ehi_global_mean" +author: "Irina" +date: today +format: + html: + theme: cosmo + toc: true + toc-depth: 3 + code-fold: false + code-tools: true + fig-width: 8 + fig-height: 6 +execute: + echo: true + warning: false + message: false + eval: true + output: true + results: 'markup' + cache: false + freeze: false +--- + +## Setup and Data Preparation + +```{r} +#| label: simple-test +#| echo: true +#| output: true + +# Simple test to verify Quarto is working +cat("=== QUARTO TEST ===\n") +print("If you see this, Quarto is working!") +2 + 2 +cat("=== END TEST ===\n") +``` + +```{r setup} +#| label: setup +#| echo: true +#| output: true +#| results: 'markup' +#| eval: true + +# Load required libraries +library(dplyr) # Must load first for %>% operator +library(ggplot2) # Load ggplot2 first to avoid version conflicts +library(car) +library(performance) +# library(see) # Temporarily commented out due to version conflict +library(gridExtra) +library(lmtest) # For bptest and durbinWatsonTest + +# Set options +options(scipen = 999) + +# Set working directory and load data +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +print("test message") + +# Test chunk execution +cat("This should appear when you run this chunk\n") +print(paste("Current time:", Sys.time())) +cat("If you see this output below this chunk, Quarto is working correctly!\n") +``` + +```{r data-prep} +#| label: data-prep +#| echo: true +#| output: true + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) + +cat("Missing values check:\n") +print(missing_summary) +cat("\n") + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and create dummy variables +print("Education levels:") +edu_table <- table(data_clean$demo_edu) +print(edu_table) +print(paste("Number of education levels:", length(unique(data_clean$demo_edu)))) + +# Create dummy variables for education (k-1 coding: 7 levels = 6 dummy variables) +# Using High School as reference category (excluded dummy) +data_clean$edu_college <- ifelse(data_clean$demo_edu == "College Diploma/Certificate", 1, 0) +data_clean$edu_undergrad <- ifelse(data_clean$demo_edu == "University - Undergraduate", 1, 0) +data_clean$edu_grad <- ifelse(data_clean$demo_edu == "University - Graduate", 1, 0) + +# Check what other education levels exist and create additional dummies +edu_levels <- unique(data_clean$demo_edu) +print("All education levels found:") +for(i in 1:length(edu_levels)) { + print(paste(i, ":", edu_levels[i])) +} + +# Create additional dummy variables for other education levels +# (You'll need to adjust these based on your actual data) +# Example for additional levels - adjust names and conditions as needed: +# data_clean$edu_other1 <- ifelse(data_clean$demo_edu == "Other Level 1", 1, 0) +# data_clean$edu_other2 <- ifelse(data_clean$demo_edu == "Other Level 2", 1, 0) +# data_clean$edu_other3 <- ifelse(data_clean$demo_edu == "Other Level 3", 1, 0) + +# Note: Once you identify all 7 levels, create 6 dummy variables total (k-1) + +# Verify dummy coding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables (k-1 coding with High School as reference):") +print("High School (reference):", sum(data_clean$demo_edu == "High School (or equivalent)")) +print("College:", sum(data_clean$edu_college)) +print("Undergraduate:", sum(data_clean$edu_undergrad)) +print("Graduate:", sum(data_clean$edu_grad)) +``` + +## Regression Models + +```{r models} +#| label: models +#| echo: true +#| output: true + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: education dummies → eohiDGEN_mean (k-1 coding, HS as reference) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: education dummies → ehi_global_mean (k-1 coding, HS as reference) +models$edu_ehi_global <- lm(ehi_global_mean ~ edu_college + edu_undergrad + edu_grad, data = data_clean) +``` + +## Assumption Checking Functions + +```{r functions} +#| label: functions +#| echo: true + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} +``` + +## Model 1: Sex → EOHI-DGEN Mean + +```{r model1} +#| label: model1 +#| echo: true + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +``` + +## Model 2: Age → EOHI-DGEN Mean + +```{r model2} +#| label: model2 +#| echo: true + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") +``` + +## Model 3: Education → EOHI-DGEN Mean + +```{r model3} +#| label: model3 +#| echo: true + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +``` + +## Model 4: Sex → EHI-Global Mean + +```{r model4} +#| label: model4 +#| echo: true + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") +``` + +## Model 5: Age → EHI-Global Mean + +```{r model5} +#| label: model5 +#| echo: true + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") +``` + +## Model 6: Education → EHI-Global Mean + +```{r model6} +#| label: model6 +#| echo: true + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") +``` + +## Summary Tables + +### Assumption Violation Summary + +```{r violation-summary} +#| label: violation-summary +#| echo: true + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) +``` + +### Model Comparison Summary + +```{r comparison-summary} +#| label: comparison-summary +#| echo: true + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) +``` + +## Recommendations + +### For Assumption Violations: + +**1. Normality Violations:** +- If violated: Consider transforming the dependent variable (log, sqrt, Box-Cox) +- Alternative: Use robust regression methods or bootstrapping + +**2. Homoscedasticity Violations:** +- If violated: Use weighted least squares or robust standard errors +- Alternative: Transform the dependent variable or use heteroscedasticity-consistent standard errors + +**3. Independence Violations:** +- If violated: Check for clustering or repeated measures structure +- Alternative: Use mixed-effects models or clustered standard errors + +**4. Influential Observations:** +- If present: Examine these cases for data entry errors +- Consider: Running analysis with and without influential cases +- Alternative: Use robust regression methods + +**5. Linearity Violations:** +- If violated: Add polynomial terms or use splines +- Alternative: Transform predictors or use non-parametric methods + +--- + +*Analysis completed for 6 regression models examining the relationship between demographic variables (sex, age, education) and EOHI measures.* diff --git a/.history/eohi1/regressions e1 - assumptions_20251016173803.r b/.history/eohi1/regressions e1 - assumptions_20251016173803.r new file mode 100644 index 0000000..f647e9c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016173803.r @@ -0,0 +1,398 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest +library(rmarkdown) # For HTML rendering + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016173806.r b/.history/eohi1/regressions e1 - assumptions_20251016173806.r new file mode 100644 index 0000000..b1c6d34 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016173806.r @@ -0,0 +1,411 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest +library(rmarkdown) # For HTML rendering + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") + +# ============================================================================= +# RENDER TO HTML +# ============================================================================= + +# Method 1: Render the current R script to HTML +# This will create an HTML file with all outputs, plots, and results +rmarkdown::render("regressions e1 - assumptions.r", + output_format = "html_document", + output_file = "regressions_e1_assumptions.html", + output_dir = ".") + +print("HTML file created: regressions_e1_assumptions.html") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016173814.r b/.history/eohi1/regressions e1 - assumptions_20251016173814.r new file mode 100644 index 0000000..b1c6d34 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016173814.r @@ -0,0 +1,411 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest +library(rmarkdown) # For HTML rendering + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") + +# ============================================================================= +# RENDER TO HTML +# ============================================================================= + +# Method 1: Render the current R script to HTML +# This will create an HTML file with all outputs, plots, and results +rmarkdown::render("regressions e1 - assumptions.r", + output_format = "html_document", + output_file = "regressions_e1_assumptions.html", + output_dir = ".") + +print("HTML file created: regressions_e1_assumptions.html") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016173817.r b/.history/eohi1/regressions e1 - assumptions_20251016173817.r new file mode 100644 index 0000000..be00f2a --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016173817.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174209.r b/.history/eohi1/regressions e1 - assumptions_20251016174209.r new file mode 100644 index 0000000..4dcb7e9 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174209.r @@ -0,0 +1,397 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174256.r b/.history/eohi1/regressions e1 - assumptions_20251016174256.r new file mode 100644 index 0000000..bf40217 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174256.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age → eohiDGEN_mean +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174304.r b/.history/eohi1/regressions e1 - assumptions_20251016174304.r new file mode 100644 index 0000000..b829ba1 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174304.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age → ehi_global_mean +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174308.r b/.history/eohi1/regressions e1 - assumptions_20251016174308.r new file mode 100644 index 0000000..b28df06 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174308.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174332.r b/.history/eohi1/regressions e1 - assumptions_20251016174332.r new file mode 100644 index 0000000..6055151 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174332.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174341.r b/.history/eohi1/regressions e1 - assumptions_20251016174341.r new file mode 100644 index 0000000..bc8b49d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174341.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174344.r b/.history/eohi1/regressions e1 - assumptions_20251016174344.r new file mode 100644 index 0000000..21858aa --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174344.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174349.r b/.history/eohi1/regressions e1 - assumptions_20251016174349.r new file mode 100644 index 0000000..35e8c92 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174349.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174357.r b/.history/eohi1/regressions e1 - assumptions_20251016174357.r new file mode 100644 index 0000000..35e8c92 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174357.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174402.r b/.history/eohi1/regressions e1 - assumptions_20251016174402.r new file mode 100644 index 0000000..35e8c92 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174402.r @@ -0,0 +1,403 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print("Missing values check:") +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174430.r b/.history/eohi1/regressions e1 - assumptions_20251016174430.r new file mode 100644 index 0000000..f8d6f2e --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174430.r @@ -0,0 +1,402 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Education levels:") +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174433.r b/.history/eohi1/regressions e1 - assumptions_20251016174433.r new file mode 100644 index 0000000..ce6ea8d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174433.r @@ -0,0 +1,401 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education recoding (1=HS, 2=College, 3=Undergrad, 4=Grad):") +print(table(data_clean$demo_edu_numeric)) +print("Age variable centered:") +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174436.r b/.history/eohi1/regressions e1 - assumptions_20251016174436.r new file mode 100644 index 0000000..b5bbe19 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174436.r @@ -0,0 +1,398 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + print(paste("=== LINEARITY CHECK:", model_name, "===")) + + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174439.r b/.history/eohi1/regressions e1 - assumptions_20251016174439.r new file mode 100644 index 0000000..dbd7c99 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174439.r @@ -0,0 +1,396 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + print(paste("=== NORMALITY CHECK:", model_name, "===")) + + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174444.r b/.history/eohi1/regressions e1 - assumptions_20251016174444.r new file mode 100644 index 0000000..213953d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174444.r @@ -0,0 +1,394 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + print(paste("=== HOMOSCEDASTICITY CHECK:", model_name, "===")) + + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174451.r b/.history/eohi1/regressions e1 - assumptions_20251016174451.r new file mode 100644 index 0000000..f2b56f2 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174451.r @@ -0,0 +1,392 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + print(paste("=== INDEPENDENCE CHECK:", model_name, "===")) + + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174501.r b/.history/eohi1/regressions e1 - assumptions_20251016174501.r new file mode 100644 index 0000000..31166d8 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174501.r @@ -0,0 +1,390 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + print(paste("=== INFLUENCE CHECK:", model_name, "===")) + + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174512.r b/.history/eohi1/regressions e1 - assumptions_20251016174512.r new file mode 100644 index 0000000..8ef951b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174512.r @@ -0,0 +1,388 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + print(paste("=== MODEL SUMMARY:", model_name, "===")) + + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174519.r b/.history/eohi1/regressions e1 - assumptions_20251016174519.r new file mode 100644 index 0000000..647e123 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174519.r @@ -0,0 +1,386 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + +print("COMPREHENSIVE REGRESSION ASSUMPTION ANALYSIS") +print("=============================================") + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174521.r b/.history/eohi1/regressions e1 - assumptions_20251016174521.r new file mode 100644 index 0000000..bf8aa83 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174521.r @@ -0,0 +1,384 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 1: Sex → EOHI-DGEN Mean") +print("=============================================") + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174524.r b/.history/eohi1/regressions e1 - assumptions_20251016174524.r new file mode 100644 index 0000000..e60d7c3 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174524.r @@ -0,0 +1,381 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 2: Age (centered) → EOHI-DGEN Mean") +print("=============================================") + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174526.r b/.history/eohi1/regressions e1 - assumptions_20251016174526.r new file mode 100644 index 0000000..aa497c4 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174526.r @@ -0,0 +1,378 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean +print("\n=============================================") +print("MODEL 3: Education → EOHI-DGEN Mean") +print("=============================================") + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174528.r b/.history/eohi1/regressions e1 - assumptions_20251016174528.r new file mode 100644 index 0000000..7dc7139 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174528.r @@ -0,0 +1,375 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean +print("\n=============================================") +print("MODEL 4: Sex → EHI-Global Mean") +print("=============================================") + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174532.r b/.history/eohi1/regressions e1 - assumptions_20251016174532.r new file mode 100644 index 0000000..b7bfa0b --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174532.r @@ -0,0 +1,372 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean +print("\n=============================================") +print("MODEL 5: Age (centered) → EHI-Global Mean") +print("=============================================") + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174537.r b/.history/eohi1/regressions e1 - assumptions_20251016174537.r new file mode 100644 index 0000000..b1ec821 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174537.r @@ -0,0 +1,369 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean +print("\n=============================================") +print("MODEL 6: Education → EHI-Global Mean") +print("=============================================") + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174542.r b/.history/eohi1/regressions e1 - assumptions_20251016174542.r new file mode 100644 index 0000000..0be2cb7 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174542.r @@ -0,0 +1,366 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + +print("\n=============================================") +print("ASSUMPTION VIOLATION SUMMARY") +print("=============================================") + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174545.r b/.history/eohi1/regressions e1 - assumptions_20251016174545.r new file mode 100644 index 0000000..3d8ebf2 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174545.r @@ -0,0 +1,363 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + +print("\n=============================================") +print("MODEL COMPARISON SUMMARY") +print("=============================================") + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174548.r b/.history/eohi1/regressions e1 - assumptions_20251016174548.r new file mode 100644 index 0000000..1ade369 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174548.r @@ -0,0 +1,360 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + +print("\n=============================================") +print("ANALYSIS COMPLETE") +print("=============================================") diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174550.r b/.history/eohi1/regressions e1 - assumptions_20251016174550.r new file mode 100644 index 0000000..d61d94c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174550.r @@ -0,0 +1,357 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174557.r b/.history/eohi1/regressions e1 - assumptions_20251016174557.r new file mode 100644 index 0000000..d61d94c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174557.r @@ -0,0 +1,357 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016174601.r b/.history/eohi1/regressions e1 - assumptions_20251016174601.r new file mode 100644 index 0000000..d61d94c --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016174601.r @@ -0,0 +1,357 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print(table(data_clean$demo_edu)) + +# Recode education as ordinal (assuming higher values = more education) +edu_levels <- c("High School (or equivalent)", "College Diploma/Certificate", + "University - Undergraduate", "University - Graduate") +data_clean$demo_edu_numeric <- match(data_clean$demo_edu, edu_levels) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175238.r b/.history/eohi1/regressions e1 - assumptions_20251016175238.r new file mode 100644 index 0000000..090886f --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175238.r @@ -0,0 +1,367 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print(table(data_clean$demo_sex_numeric)) +print(table(data_clean$demo_edu_numeric)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175247.r b/.history/eohi1/regressions e1 - assumptions_20251016175247.r new file mode 100644 index 0000000..6e3b04d --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175247.r @@ -0,0 +1,373 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ demo_edu_numeric, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175258.r b/.history/eohi1/regressions e1 - assumptions_20251016175258.r new file mode 100644 index 0000000..a5bb837 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175258.r @@ -0,0 +1,373 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ ., data = data_clean[, c("eohiDGEN_mean", colnames(edu_dummies))]) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean +models$edu_ehi_global <- lm(ehi_global_mean ~ demo_edu_numeric, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175309.r b/.history/eohi1/regressions e1 - assumptions_20251016175309.r new file mode 100644 index 0000000..051b1ca --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175309.r @@ -0,0 +1,373 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +models$edu_eohiDGEN <- lm(eohiDGEN_mean ~ ., data = data_clean[, c("eohiDGEN_mean", colnames(edu_dummies))]) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +models$edu_ehi_global <- lm(ehi_global_mean ~ ., data = data_clean[, c("ehi_global_mean", colnames(edu_dummies))]) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175319.r b/.history/eohi1/regressions e1 - assumptions_20251016175319.r new file mode 100644 index 0000000..6815bf0 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175319.r @@ -0,0 +1,374 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +models$edu_ehi_global <- lm(ehi_global_mean ~ ., data = data_clean[, c("ehi_global_mean", colnames(edu_dummies))]) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175325.r b/.history/eohi1/regressions e1 - assumptions_20251016175325.r new file mode 100644 index 0000000..47b31ac --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175325.r @@ -0,0 +1,375 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175340.r b/.history/eohi1/regressions e1 - assumptions_20251016175340.r new file mode 100644 index 0000000..47b31ac --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175340.r @@ -0,0 +1,375 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175550.r b/.history/eohi1/regressions e1 - assumptions_20251016175550.r new file mode 100644 index 0000000..47b31ac --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175550.r @@ -0,0 +1,375 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175653.r b/.history/eohi1/regressions e1 - assumptions_20251016175653.r new file mode 100644 index 0000000..4472b84 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175653.r @@ -0,0 +1,383 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Show which education level each dummy variable represents +print("Education level mapping:") +edu_levels_actual <- levels(data_clean$demo_edu_factor) +print(paste("Reference category (edu_0):", edu_levels_actual[1])) +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " represents:", edu_levels_actual[i+1])) +} + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175707.r b/.history/eohi1/regressions e1 - assumptions_20251016175707.r new file mode 100644 index 0000000..4472b84 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175707.r @@ -0,0 +1,383 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Show which education level each dummy variable represents +print("Education level mapping:") +edu_levels_actual <- levels(data_clean$demo_edu_factor) +print(paste("Reference category (edu_0):", edu_levels_actual[1])) +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " represents:", edu_levels_actual[i+1])) +} + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175808.r b/.history/eohi1/regressions e1 - assumptions_20251016175808.r new file mode 100644 index 0000000..4472b84 --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175808.r @@ -0,0 +1,383 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Show which education level each dummy variable represents +print("Education level mapping:") +edu_levels_actual <- levels(data_clean$demo_edu_factor) +print(paste("Reference category (edu_0):", edu_levels_actual[1])) +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " represents:", edu_levels_actual[i+1])) +} + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175912.r b/.history/eohi1/regressions e1 - assumptions_20251016175912.r new file mode 100644 index 0000000..3c3aacc --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175912.r @@ -0,0 +1,390 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Show which education level each dummy variable represents +print("Education level mapping:") +edu_levels_actual <- levels(data_clean$demo_edu_factor) +print(paste("Reference category (edu_0):", edu_levels_actual[1])) +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " represents:", edu_levels_actual[i+1])) +} + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) + +# Show distribution (counts) for each dummy variable +print("Dummy variable distributions (counts):") +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " distribution:")) + print(table(edu_dummies[,i])) +} +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175924.r b/.history/eohi1/regressions e1 - assumptions_20251016175924.r new file mode 100644 index 0000000..3c3aacc --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175924.r @@ -0,0 +1,390 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Show which education level each dummy variable represents +print("Education level mapping:") +edu_levels_actual <- levels(data_clean$demo_edu_factor) +print(paste("Reference category (edu_0):", edu_levels_actual[1])) +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " represents:", edu_levels_actual[i+1])) +} + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) + +# Show distribution (counts) for each dummy variable +print("Dummy variable distributions (counts):") +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " distribution:")) + print(table(edu_dummies[,i])) +} +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/regressions e1 - assumptions_20251016175945.r b/.history/eohi1/regressions e1 - assumptions_20251016175945.r new file mode 100644 index 0000000..3c3aacc --- /dev/null +++ b/.history/eohi1/regressions e1 - assumptions_20251016175945.r @@ -0,0 +1,390 @@ +# Regression Analysis - Assumption Checking +# IVs: demo_sex, demo_age, demo_edu +# DVs: eohiDGEN_mean, ehi_global_mean + +options(scipen = 999) + +library(car) +library(performance) +#library(see) +library(ggplot2) +library(gridExtra) +library(dplyr) +library(lmtest) # For bptest and durbinWatsonTest + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +data <- read.csv("ehi1.csv") + +# Check for missing values +missing_summary <- data %>% + select(demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + summarise_all(~sum(is.na(.))) +print(missing_summary) + +# Remove rows with missing values +data_clean <- data %>% + select(pID, demo_sex, demo_age_1, demo_edu, eohiDGEN_mean, ehi_global_mean) %>% + filter(complete.cases(.)) + +print(paste("Clean data dimensions:", paste(dim(data_clean), collapse = " x "))) + +# Recode demo_sex as numeric for regression (0 = Female, 1 = Male) +data_clean$demo_sex_numeric <- ifelse(data_clean$demo_sex == "Male", 1, 0) + +# Check demo_edu levels and recode if needed +print("Original education levels:") +print(table(data_clean$demo_edu)) +print("Education levels:") +print(levels(factor(data_clean$demo_edu))) + +# Create dummy variables for education (k-1 dummy variables) +# First, convert to factor to ensure proper level ordering +data_clean$demo_edu_factor <- factor(data_clean$demo_edu) + +# Create dummy variables (k-1), using the first level as reference +edu_dummies <- model.matrix(~ demo_edu_factor, data = data_clean) +edu_dummies <- edu_dummies[, -1] # Remove intercept column + +# Add dummy variables to dataset +colnames(edu_dummies) <- paste0("edu_", 1:ncol(edu_dummies)) +data_clean <- cbind(data_clean, edu_dummies) + +# Show which education level each dummy variable represents +print("Education level mapping:") +edu_levels_actual <- levels(data_clean$demo_edu_factor) +print(paste("Reference category (edu_0):", edu_levels_actual[1])) +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " represents:", edu_levels_actual[i+1])) +} + +# Center the age variable for regression analysis +data_clean$demo_age_1_centered <- scale(data_clean$demo_age_1, center = TRUE, scale = FALSE)[,1] + +# Verify recoding +print("Sex recoding (0=Female, 1=Male):") +print(table(data_clean$demo_sex_numeric)) +print("Education dummy variables created:") +print(paste("Number of dummy variables:", ncol(edu_dummies))) +print("Dummy variable names:") +print(colnames(edu_dummies)) +print("Dummy variable summary:") +print(summary(edu_dummies)) + +# Show distribution (counts) for each dummy variable +print("Dummy variable distributions (counts):") +for(i in 1:ncol(edu_dummies)) { + print(paste("edu_", i, " distribution:")) + print(table(edu_dummies[,i])) +} +print(paste("Original age mean:", round(mean(data_clean$demo_age_1), 2))) +print(paste("Centered age mean:", round(mean(data_clean$demo_age_1_centered), 2))) + +# ============================================================================= +# REGRESSION MODELS +# ============================================================================= + +# Define the 6 regression models +models <- list() + +# Model 1: demo_sex → eohiDGEN_mean +models$sex_eohiDGEN <- lm(eohiDGEN_mean ~ demo_sex_numeric, data = data_clean) + +# Model 2: demo_age_1 → eohiDGEN_mean (centered) +models$age_eohiDGEN <- lm(eohiDGEN_mean ~ demo_age_1_centered, data = data_clean) + +# Model 3: demo_edu → eohiDGEN_mean (using dummy variables) +edu_formula <- as.formula(paste("eohiDGEN_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_eohiDGEN <- lm(edu_formula, data = data_clean) + +# Model 4: demo_sex → ehi_global_mean +models$sex_ehi_global <- lm(ehi_global_mean ~ demo_sex_numeric, data = data_clean) + +# Model 5: demo_age_1 → ehi_global_mean (centered) +models$age_ehi_global <- lm(ehi_global_mean ~ demo_age_1_centered, data = data_clean) + +# Model 6: demo_edu → ehi_global_mean (using dummy variables) +edu_formula_global <- as.formula(paste("ehi_global_mean ~", paste(colnames(edu_dummies), collapse = " + "))) +models$edu_ehi_global <- lm(edu_formula_global, data = data_clean) + +# ============================================================================= +# ASSUMPTION CHECKING FUNCTIONS +# ============================================================================= + +# Function to check linearity assumption +check_linearity <- function(model, model_name) { + # Residuals vs Fitted plot + plot(model, which = 1, main = paste("Linearity:", model_name)) + + # Component + residual plot (partial residual plot) + crPlots(model, main = paste("Component+Residual Plot:", model_name)) + + return(NULL) +} + +# Function to check normality of residuals +check_normality <- function(model, model_name) { + # Q-Q plot + plot(model, which = 2, main = paste("Q-Q Plot:", model_name)) + + # Shapiro-Wilk test + residuals <- residuals(model) + shapiro_test <- shapiro.test(residuals) + print(paste("Shapiro-Wilk test p-value:", format(shapiro_test$p.value, digits = 5))) + + # Kolmogorov-Smirnov test + ks_test <- ks.test(residuals, "pnorm", mean(residuals), sd(residuals)) + print(paste("Kolmogorov-Smirnov test p-value:", format(ks_test$p.value, digits = 5))) + + # Histogram of residuals + hist_plot <- ggplot(data.frame(residuals = residuals), aes(x = residuals)) + + geom_histogram(bins = 30, fill = "lightblue", color = "black") + + ggtitle(paste("Residuals Histogram:", model_name)) + + theme_minimal() + print(hist_plot) + + return(list(shapiro_p = shapiro_test$p.value, ks_p = ks_test$p.value)) +} + +# Function to check homoscedasticity (constant variance) +check_homoscedasticity <- function(model, model_name) { + # Scale-Location plot + plot(model, which = 3, main = paste("Scale-Location Plot:", model_name)) + + # Breusch-Pagan test + bp_test <- bptest(model) + print(paste("Breusch-Pagan test p-value:", format(bp_test$p.value, digits = 5))) + + # White test (if available) + tryCatch({ + white_test <- bptest(model, ~ fitted(model) + I(fitted(model)^2)) + print(paste("White test p-value:", format(white_test$p.value, digits = 5))) + }, error = function(e) { + print("White test not available for this model") + }) + + return(list(bp_p = bp_test$p.value)) +} + +# Function to check independence (no autocorrelation) +check_independence <- function(model, model_name) { + # Durbin-Watson test + dw_test <- durbinWatsonTest(model) + print(paste("Durbin-Watson statistic:", format(dw_test$dw, digits = 5))) + print(paste("Durbin-Watson p-value:", format(dw_test$p, digits = 5))) + + # Residuals vs Order plot + residuals_vs_order <- ggplot(data.frame( + residuals = residuals(model), + order = seq_along(residuals(model)) + ), aes(x = order, y = residuals)) + + geom_point(color = "black") + + geom_hline(yintercept = 0, linetype = "dashed", color = "red") + + ggtitle(paste("Residuals vs Order:", model_name)) + + theme_minimal() + print(residuals_vs_order) + + return(list(dw_stat = dw_test$dw, dw_p = dw_test$p)) +} + +# Function to check for influential observations +check_influence <- function(model, model_name) { + # Cook's Distance plot + plot(model, which = 4, main = paste("Cook's Distance:", model_name)) + + # Calculate influence measures + cooks_d <- cooks.distance(model) + leverage <- hatvalues(model) + dffits_val <- dffits(model) + + # Identify influential observations + cooks_threshold <- 4/length(cooks_d) # Cook's D threshold + leverage_threshold <- 2 * (length(coef(model))/nobs(model)) # Leverage threshold + dffits_threshold <- 2 * sqrt(length(coef(model))/nobs(model)) # DFFITS threshold + + influential_cooks <- which(cooks_d > cooks_threshold) + influential_leverage <- which(leverage > leverage_threshold) + influential_dffits <- which(abs(dffits_val) > dffits_threshold) + + print(paste("Cook's Distance threshold:", format(cooks_threshold, digits = 5))) + print(paste("Influential observations (Cook's D):", length(influential_cooks))) + print(paste("Leverage threshold:", format(leverage_threshold, digits = 5))) + print(paste("High leverage observations:", length(influential_leverage))) + print(paste("DFFITS threshold:", format(dffits_threshold, digits = 5))) + print(paste("Influential observations (DFFITS):", length(influential_dffits))) + + if (length(influential_cooks) > 0) { + print(paste("Cook's D influential cases:", paste(influential_cooks, collapse = ", "))) + } + if (length(influential_leverage) > 0) { + print(paste("High leverage cases:", paste(influential_leverage, collapse = ", "))) + } + if (length(influential_dffits) > 0) { + print(paste("DFFITS influential cases:", paste(influential_dffits, collapse = ", "))) + } + + return(list(influential_cooks = influential_cooks, + influential_leverage = influential_leverage, + influential_dffits = influential_dffits)) +} + +# Function to get comprehensive model summary +get_model_summary <- function(model, model_name) { + # Basic model summary + summary_model <- summary(model) + print(summary_model) + + # R-squared and adjusted R-squared + print(paste("R-squared:", format(summary_model$r.squared, digits = 5))) + print(paste("Adjusted R-squared:", format(summary_model$adj.r.squared, digits = 5))) + + # AIC and BIC + aic_val <- AIC(model) + bic_val <- BIC(model) + print(paste("AIC:", format(aic_val, digits = 5))) + print(paste("BIC:", format(bic_val, digits = 5))) + + return(list(summary = summary_model, r_squared = summary_model$r.squared, + adj_r_squared = summary_model$adj.r.squared, aic = aic_val, bic = bic_val)) +} + +# ============================================================================= +# RUN ASSUMPTION CHECKS - MODEL BY MODEL +# ============================================================================= + + +# Model 1: Sex → EOHI-DGEN Mean + +model1_summary <- get_model_summary(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_normality <- check_normality(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_homosced <- check_homoscedasticity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_independence <- check_independence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_influence <- check_influence(models$sex_eohiDGEN, "Sex → EOHI-DGEN") +model1_linearity <- check_linearity(models$sex_eohiDGEN, "Sex → EOHI-DGEN") + +# Model 2: Age (centered) → EOHI-DGEN Mean + +model2_summary <- get_model_summary(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_normality <- check_normality(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_homosced <- check_homoscedasticity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_independence <- check_independence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_influence <- check_influence(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") +model2_linearity <- check_linearity(models$age_eohiDGEN, "Age (centered) → EOHI-DGEN") + +# Model 3: Education → EOHI-DGEN Mean + +model3_summary <- get_model_summary(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_normality <- check_normality(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_homosced <- check_homoscedasticity(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_independence <- check_independence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_influence <- check_influence(models$edu_eohiDGEN, "Education → EOHI-DGEN") +model3_linearity <- check_linearity(models$edu_eohiDGEN, "Education → EOHI-DGEN") + +# Model 4: Sex → EHI-Global Mean + +model4_summary <- get_model_summary(models$sex_ehi_global, "Sex → EHI-Global") +model4_normality <- check_normality(models$sex_ehi_global, "Sex → EHI-Global") +model4_homosced <- check_homoscedasticity(models$sex_ehi_global, "Sex → EHI-Global") +model4_independence <- check_independence(models$sex_ehi_global, "Sex → EHI-Global") +model4_influence <- check_influence(models$sex_ehi_global, "Sex → EHI-Global") +model4_linearity <- check_linearity(models$sex_ehi_global, "Sex → EHI-Global") + +# Model 5: Age (centered) → EHI-Global Mean + +model5_summary <- get_model_summary(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_normality <- check_normality(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_homosced <- check_homoscedasticity(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_independence <- check_independence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_influence <- check_influence(models$age_ehi_global, "Age (centered) → EHI-Global") +model5_linearity <- check_linearity(models$age_ehi_global, "Age (centered) → EHI-Global") + +# Model 6: Education → EHI-Global Mean + +model6_summary <- get_model_summary(models$edu_ehi_global, "Education → EHI-Global") +model6_normality <- check_normality(models$edu_ehi_global, "Education → EHI-Global") +model6_homosced <- check_homoscedasticity(models$edu_ehi_global, "Education → EHI-Global") +model6_independence <- check_independence(models$edu_ehi_global, "Education → EHI-Global") +model6_influence <- check_influence(models$edu_ehi_global, "Education → EHI-Global") +model6_linearity <- check_linearity(models$edu_ehi_global, "Education → EHI-Global") + +# ============================================================================= +# SUMMARY TABLE OF ASSUMPTION VIOLATIONS +# ============================================================================= + + +# Create summary table +violation_summary <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + Normality = c( + ifelse(model1_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_normality$shapiro_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_normality$shapiro_p < 0.05, "VIOLATED", "OK") + ), + Homoscedasticity = c( + ifelse(model1_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_homosced$bp_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_homosced$bp_p < 0.05, "VIOLATED", "OK") + ), + Independence = c( + ifelse(model1_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model2_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model3_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model4_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model5_independence$dw_p < 0.05, "VIOLATED", "OK"), + ifelse(model6_independence$dw_p < 0.05, "VIOLATED", "OK") + ), + Influential_Obs = c( + ifelse(length(model1_influence$influential_cooks) > 0, + paste("YES (", length(model1_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model2_influence$influential_cooks) > 0, + paste("YES (", length(model2_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model3_influence$influential_cooks) > 0, + paste("YES (", length(model3_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model4_influence$influential_cooks) > 0, + paste("YES (", length(model4_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model5_influence$influential_cooks) > 0, + paste("YES (", length(model5_influence$influential_cooks), ")", sep = ""), "NO"), + ifelse(length(model6_influence$influential_cooks) > 0, + paste("YES (", length(model6_influence$influential_cooks), ")", sep = ""), "NO") + ), + stringsAsFactors = FALSE +) + +print(violation_summary) + +# ============================================================================= +# MODEL COMPARISON TABLE +# ============================================================================= + + +# Create model comparison table +comparison_table <- data.frame( + Model = c("Sex → EOHI-DGEN", "Age (centered) → EOHI-DGEN", "Education → EOHI-DGEN", + "Sex → EHI-Global", "Age (centered) → EHI-Global", "Education → EHI-Global"), + R_Squared = c(model1_summary$r_squared, model2_summary$r_squared, model3_summary$r_squared, + model4_summary$r_squared, model5_summary$r_squared, model6_summary$r_squared), + Adj_R_Squared = c(model1_summary$adj_r_squared, model2_summary$adj_r_squared, model3_summary$adj_r_squared, + model4_summary$adj_r_squared, model5_summary$adj_r_squared, model6_summary$adj_r_squared), + AIC = c(model1_summary$aic, model2_summary$aic, model3_summary$aic, + model4_summary$aic, model5_summary$aic, model6_summary$aic), + BIC = c(model1_summary$bic, model2_summary$bic, model3_summary$bic, + model4_summary$bic, model5_summary$bic, model6_summary$bic), + Significant = c( + ifelse(model1_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model2_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model3_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model4_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model5_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO"), + ifelse(model6_summary$summary$coefficients[2, 4] < 0.05, "YES", "NO") + ), + stringsAsFactors = FALSE +) + +print(comparison_table) + diff --git a/.history/eohi1/reliability_analysis_cronbach_alpha_20250917154720.r b/.history/eohi1/reliability_analysis_cronbach_alpha_20250917154720.r new file mode 100644 index 0000000..a12e156 --- /dev/null +++ b/.history/eohi1/reliability_analysis_cronbach_alpha_20250917154720.r @@ -0,0 +1,202 @@ +# Cronbach's Alpha Reliability Analysis +# For 4 domains (preferences, personality, values, life satisfaction) at 2 time points +# 5 items per domain per time point + +# Load required libraries +library(psych) +library(dplyr) +library(tidyr) + +# Read the data +data <- read.csv("exp1.csv") + +# Define the scale variables for each domain and time point +# Past time point scales +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Future time point scales +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +fut_pers_vars <- c("NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", + "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +fut_val_vars <- c("NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", + "NFutDiff_val_performance", "NFutDiff_val_justice") + +fut_life_vars <- c("NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", + "NFutDiff_life_important", "NFutDiff_life_change") + +# Function to calculate Cronbach's alpha and return detailed results +calc_cronbach_alpha <- function(data, var_names, scale_name) { + # Check for missing values + scale_data <- data[, var_names] + missing_info <- data.frame( + Variable = var_names, + Missing_Count = colSums(is.na(scale_data)), + Missing_Percent = round(colSums(is.na(scale_data)) / nrow(scale_data) * 100, 2) + ) + + # Remove rows with any missing values for reliability analysis + complete_data <- scale_data[complete.cases(scale_data), ] + + cat("\n", "="*60, "\n") + cat("SCALE:", scale_name, "\n") + cat("="*60, "\n") + + cat("Sample size for reliability analysis:", nrow(complete_data), "\n") + cat("Original sample size:", nrow(data), "\n") + cat("Cases removed due to missing data:", nrow(data) - nrow(complete_data), "\n\n") + + cat("Missing data summary:\n") + print(missing_info) + + if(nrow(complete_data) < 3) { + cat("\nWARNING: Insufficient complete cases for reliability analysis\n") + return(NULL) + } + + # Calculate Cronbach's alpha + alpha_result <- alpha(complete_data, check.keys = TRUE) + + cat("\nCronbach's Alpha Results:\n") + cat("Raw alpha:", round(alpha_result$total$raw_alpha, 4), "\n") + cat("Standardized alpha:", round(alpha_result$total$std.alpha, 4), "\n") + cat("Average inter-item correlation:", round(alpha_result$total$average_r, 4), "\n") + cat("Number of items:", alpha_result$total$nvar, "\n") + + # Item statistics + cat("\nItem Statistics:\n") + item_stats <- data.frame( + Item = var_names, + Alpha_if_deleted = round(alpha_result$alpha.drop$raw_alpha, 4), + Item_total_correlation = round(alpha_result$item.stats$r.drop, 4), + Mean = round(alpha_result$item.stats$mean, 4), + SD = round(alpha_result$item.stats$sd, 4) + ) + print(item_stats) + + # Check assumptions + cat("\nAssumption Checks:\n") + + # 1. Check for sufficient sample size (minimum 30 recommended) + sample_size_ok <- nrow(complete_data) >= 30 + cat("Sample size adequate (≥30):", sample_size_ok, "\n") + + # 2. Check for adequate inter-item correlations (should be > 0.30) + inter_item_cors <- cor(complete_data) + inter_item_cors[lower.tri(inter_item_cors)] <- NA + diag(inter_item_cors) <- NA + inter_item_cors_flat <- as.vector(inter_item_cors) + inter_item_cors_flat <- inter_item_cors_flat[!is.na(inter_item_cors_flat)] + adequate_cors <- sum(inter_item_cors_flat > 0.30) / length(inter_item_cors_flat) + cat("Proportion of inter-item correlations > 0.30:", round(adequate_cors, 4), "\n") + + # 3. Check for negative correlations (concerning for unidimensionality) + negative_cors <- sum(inter_item_cors_flat < 0, na.rm = TRUE) + cat("Number of negative inter-item correlations:", negative_cors, "\n") + + # 4. Check item variances (should be roughly similar) + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat("Ratio of highest to lowest item variance:", round(var_ratio, 4), "\n") + + return(alpha_result) +} + +# Calculate Cronbach's alpha for all scales +cat("CRONBACH'S ALPHA RELIABILITY ANALYSIS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +# Past time point analyses +past_pref_alpha <- calc_cronbach_alpha(data, past_pref_vars, "Past Preferences") +past_pers_alpha <- calc_cronbach_alpha(data, past_pers_vars, "Past Personality") +past_val_alpha <- calc_cronbach_alpha(data, past_val_vars, "Past Values") +past_life_alpha <- calc_cronbach_alpha(data, past_life_vars, "Past Life Satisfaction") + +# Future time point analyses +fut_pref_alpha <- calc_cronbach_alpha(data, fut_pref_vars, "Future Preferences") +fut_pers_alpha <- calc_cronbach_alpha(data, fut_pers_vars, "Future Personality") +fut_val_alpha <- calc_cronbach_alpha(data, fut_val_vars, "Future Values") +fut_life_alpha <- calc_cronbach_alpha(data, fut_life_vars, "Future Life Satisfaction") + +# Summary table +cat("\n", "="*80, "\n") +cat("SUMMARY OF CRONBACH'S ALPHA COEFFICIENTS") +cat("\n", "="*80, "\n") + +summary_results <- data.frame( + Scale = c("Past Preferences", "Past Personality", "Past Values", "Past Life Satisfaction", + "Future Preferences", "Future Personality", "Future Values", "Future Life Satisfaction"), + Alpha = c( + if(!is.null(past_pref_alpha)) round(past_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_pers_alpha)) round(past_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_val_alpha)) round(past_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_life_alpha)) round(past_life_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pref_alpha)) round(fut_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pers_alpha)) round(fut_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_val_alpha)) round(fut_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_life_alpha)) round(fut_life_alpha$total$raw_alpha, 4) else NA + ), + Items = rep(5, 8), + Interpretation = c( + if(!is.null(past_pref_alpha)) { + alpha_val <- past_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_pers_alpha)) { + alpha_val <- past_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_val_alpha)) { + alpha_val <- past_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_life_alpha)) { + alpha_val <- past_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pref_alpha)) { + alpha_val <- fut_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pers_alpha)) { + alpha_val <- fut_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_val_alpha)) { + alpha_val <- fut_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_life_alpha)) { + alpha_val <- fut_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data" + ) +) + +print(summary_results) + +# Save results to CSV +write.csv(summary_results, "cronbach_alpha_summary.csv", row.names = FALSE) +cat("\nSummary results saved to: cronbach_alpha_summary.csv\n") + +cat("\n", "="*80, "\n") +cat("INTERPRETATION GUIDE FOR CRONBACH'S ALPHA") +cat("\n", "="*80, "\n") +cat("α ≥ 0.90: Excellent reliability\n") +cat("α ≥ 0.80: Good reliability\n") +cat("α ≥ 0.70: Acceptable reliability\n") +cat("α ≥ 0.60: Questionable reliability\n") +cat("α < 0.60: Poor reliability\n") diff --git a/.history/eohi1/reliability_analysis_cronbach_alpha_20250917154729.r b/.history/eohi1/reliability_analysis_cronbach_alpha_20250917154729.r new file mode 100644 index 0000000..a12e156 --- /dev/null +++ b/.history/eohi1/reliability_analysis_cronbach_alpha_20250917154729.r @@ -0,0 +1,202 @@ +# Cronbach's Alpha Reliability Analysis +# For 4 domains (preferences, personality, values, life satisfaction) at 2 time points +# 5 items per domain per time point + +# Load required libraries +library(psych) +library(dplyr) +library(tidyr) + +# Read the data +data <- read.csv("exp1.csv") + +# Define the scale variables for each domain and time point +# Past time point scales +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Future time point scales +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +fut_pers_vars <- c("NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", + "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +fut_val_vars <- c("NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", + "NFutDiff_val_performance", "NFutDiff_val_justice") + +fut_life_vars <- c("NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", + "NFutDiff_life_important", "NFutDiff_life_change") + +# Function to calculate Cronbach's alpha and return detailed results +calc_cronbach_alpha <- function(data, var_names, scale_name) { + # Check for missing values + scale_data <- data[, var_names] + missing_info <- data.frame( + Variable = var_names, + Missing_Count = colSums(is.na(scale_data)), + Missing_Percent = round(colSums(is.na(scale_data)) / nrow(scale_data) * 100, 2) + ) + + # Remove rows with any missing values for reliability analysis + complete_data <- scale_data[complete.cases(scale_data), ] + + cat("\n", "="*60, "\n") + cat("SCALE:", scale_name, "\n") + cat("="*60, "\n") + + cat("Sample size for reliability analysis:", nrow(complete_data), "\n") + cat("Original sample size:", nrow(data), "\n") + cat("Cases removed due to missing data:", nrow(data) - nrow(complete_data), "\n\n") + + cat("Missing data summary:\n") + print(missing_info) + + if(nrow(complete_data) < 3) { + cat("\nWARNING: Insufficient complete cases for reliability analysis\n") + return(NULL) + } + + # Calculate Cronbach's alpha + alpha_result <- alpha(complete_data, check.keys = TRUE) + + cat("\nCronbach's Alpha Results:\n") + cat("Raw alpha:", round(alpha_result$total$raw_alpha, 4), "\n") + cat("Standardized alpha:", round(alpha_result$total$std.alpha, 4), "\n") + cat("Average inter-item correlation:", round(alpha_result$total$average_r, 4), "\n") + cat("Number of items:", alpha_result$total$nvar, "\n") + + # Item statistics + cat("\nItem Statistics:\n") + item_stats <- data.frame( + Item = var_names, + Alpha_if_deleted = round(alpha_result$alpha.drop$raw_alpha, 4), + Item_total_correlation = round(alpha_result$item.stats$r.drop, 4), + Mean = round(alpha_result$item.stats$mean, 4), + SD = round(alpha_result$item.stats$sd, 4) + ) + print(item_stats) + + # Check assumptions + cat("\nAssumption Checks:\n") + + # 1. Check for sufficient sample size (minimum 30 recommended) + sample_size_ok <- nrow(complete_data) >= 30 + cat("Sample size adequate (≥30):", sample_size_ok, "\n") + + # 2. Check for adequate inter-item correlations (should be > 0.30) + inter_item_cors <- cor(complete_data) + inter_item_cors[lower.tri(inter_item_cors)] <- NA + diag(inter_item_cors) <- NA + inter_item_cors_flat <- as.vector(inter_item_cors) + inter_item_cors_flat <- inter_item_cors_flat[!is.na(inter_item_cors_flat)] + adequate_cors <- sum(inter_item_cors_flat > 0.30) / length(inter_item_cors_flat) + cat("Proportion of inter-item correlations > 0.30:", round(adequate_cors, 4), "\n") + + # 3. Check for negative correlations (concerning for unidimensionality) + negative_cors <- sum(inter_item_cors_flat < 0, na.rm = TRUE) + cat("Number of negative inter-item correlations:", negative_cors, "\n") + + # 4. Check item variances (should be roughly similar) + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat("Ratio of highest to lowest item variance:", round(var_ratio, 4), "\n") + + return(alpha_result) +} + +# Calculate Cronbach's alpha for all scales +cat("CRONBACH'S ALPHA RELIABILITY ANALYSIS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +# Past time point analyses +past_pref_alpha <- calc_cronbach_alpha(data, past_pref_vars, "Past Preferences") +past_pers_alpha <- calc_cronbach_alpha(data, past_pers_vars, "Past Personality") +past_val_alpha <- calc_cronbach_alpha(data, past_val_vars, "Past Values") +past_life_alpha <- calc_cronbach_alpha(data, past_life_vars, "Past Life Satisfaction") + +# Future time point analyses +fut_pref_alpha <- calc_cronbach_alpha(data, fut_pref_vars, "Future Preferences") +fut_pers_alpha <- calc_cronbach_alpha(data, fut_pers_vars, "Future Personality") +fut_val_alpha <- calc_cronbach_alpha(data, fut_val_vars, "Future Values") +fut_life_alpha <- calc_cronbach_alpha(data, fut_life_vars, "Future Life Satisfaction") + +# Summary table +cat("\n", "="*80, "\n") +cat("SUMMARY OF CRONBACH'S ALPHA COEFFICIENTS") +cat("\n", "="*80, "\n") + +summary_results <- data.frame( + Scale = c("Past Preferences", "Past Personality", "Past Values", "Past Life Satisfaction", + "Future Preferences", "Future Personality", "Future Values", "Future Life Satisfaction"), + Alpha = c( + if(!is.null(past_pref_alpha)) round(past_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_pers_alpha)) round(past_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_val_alpha)) round(past_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_life_alpha)) round(past_life_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pref_alpha)) round(fut_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pers_alpha)) round(fut_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_val_alpha)) round(fut_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_life_alpha)) round(fut_life_alpha$total$raw_alpha, 4) else NA + ), + Items = rep(5, 8), + Interpretation = c( + if(!is.null(past_pref_alpha)) { + alpha_val <- past_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_pers_alpha)) { + alpha_val <- past_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_val_alpha)) { + alpha_val <- past_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_life_alpha)) { + alpha_val <- past_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pref_alpha)) { + alpha_val <- fut_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pers_alpha)) { + alpha_val <- fut_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_val_alpha)) { + alpha_val <- fut_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_life_alpha)) { + alpha_val <- fut_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data" + ) +) + +print(summary_results) + +# Save results to CSV +write.csv(summary_results, "cronbach_alpha_summary.csv", row.names = FALSE) +cat("\nSummary results saved to: cronbach_alpha_summary.csv\n") + +cat("\n", "="*80, "\n") +cat("INTERPRETATION GUIDE FOR CRONBACH'S ALPHA") +cat("\n", "="*80, "\n") +cat("α ≥ 0.90: Excellent reliability\n") +cat("α ≥ 0.80: Good reliability\n") +cat("α ≥ 0.70: Acceptable reliability\n") +cat("α ≥ 0.60: Questionable reliability\n") +cat("α < 0.60: Poor reliability\n") diff --git a/.history/eohi1/reliability_analysis_cronbach_alpha_20250918120701.r b/.history/eohi1/reliability_analysis_cronbach_alpha_20250918120701.r new file mode 100644 index 0000000..f3fa96f --- /dev/null +++ b/.history/eohi1/reliability_analysis_cronbach_alpha_20250918120701.r @@ -0,0 +1,204 @@ +# Cronbach's Alpha Reliability Analysis +# For 4 domains (preferences, personality, values, life satisfaction) at 2 time points +# 5 items per domain per time point + +# Load required libraries +library(psych) +library(dplyr) +library(tidyr) + +# Read the data +data <- read.csv("exp1.csv") + +# Define the scale variables for each domain and time point +# Past time point scales +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Future time point scales +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +fut_pers_vars <- c("NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", + "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +fut_val_vars <- c("NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", + "NFutDiff_val_performance", "NFutDiff_val_justice") + +fut_life_vars <- c("NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", + "NFutDiff_life_important", "NFutDiff_life_change") + +# Function to calculate Cronbach's alpha and return detailed results +calc_cronbach_alpha <- function(data, var_names, scale_name) { + # Check for missing values + scale_data <- data[, var_names] + missing_info <- data.frame( + Variable = var_names, + Missing_Count = colSums(is.na(scale_data)), + Missing_Percent = round(colSums(is.na(scale_data)) / nrow(scale_data) * 100, 2) + ) + + # Remove rows with any missing values for reliability analysis + complete_data <- scale_data[complete.cases(scale_data), ] + + cat("\n", "="*60, "\n") + cat("SCALE:", scale_name, "\n") + cat("="*60, "\n") + + cat("Sample size for reliability analysis:", nrow(complete_data), "\n") + cat("Original sample size:", nrow(data), "\n") + cat("Cases removed due to missing data:", nrow(data) - nrow(complete_data), "\n\n") + + cat("Missing data summary:\n") + print(missing_info) + + if(nrow(complete_data) < 3) { + cat("\nWARNING: Insufficient complete cases for reliability analysis\n") + return(NULL) + } + + # Calculate Cronbach's alpha + alpha_result <- alpha(complete_data, check.keys = TRUE) + + cat("\nCronbach's Alpha Results:\n") + cat("Raw alpha:", round(alpha_result$total$raw_alpha, 4), "\n") + cat("Standardized alpha:", round(alpha_result$total$std.alpha, 4), "\n") + cat("Average inter-item correlation:", round(alpha_result$total$average_r, 4), "\n") + cat("Number of items:", alpha_result$total$nvar, "\n") + + # Item statistics + cat("\nItem Statistics:\n") + item_stats <- data.frame( + Item = var_names, + Alpha_if_deleted = round(alpha_result$alpha.drop$raw_alpha, 4), + Item_total_correlation = round(alpha_result$item.stats$r.drop, 4), + Mean = round(alpha_result$item.stats$mean, 4), + SD = round(alpha_result$item.stats$sd, 4) + ) + print(item_stats) + + # Check assumptions + cat("\nAssumption Checks:\n") + + # 1. Check for sufficient sample size (minimum 30 recommended) + sample_size_ok <- nrow(complete_data) >= 30 + cat("Sample size adequate (≥30):", sample_size_ok, "\n") + + # 2. Check for adequate inter-item correlations (should be > 0.30) + inter_item_cors <- cor(complete_data) + inter_item_cors[lower.tri(inter_item_cors)] <- NA + diag(inter_item_cors) <- NA + inter_item_cors_flat <- as.vector(inter_item_cors) + inter_item_cors_flat <- inter_item_cors_flat[!is.na(inter_item_cors_flat)] + adequate_cors <- sum(inter_item_cors_flat > 0.30) / length(inter_item_cors_flat) + cat("Proportion of inter-item correlations > 0.30:", round(adequate_cors, 4), "\n") + + # 3. Check for negative correlations (concerning for unidimensionality) + negative_cors <- sum(inter_item_cors_flat < 0, na.rm = TRUE) + cat("Number of negative inter-item correlations:", negative_cors, "\n") + + # 4. Check item variances (should be roughly similar) + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat("Ratio of highest to lowest item variance:", round(var_ratio, 4), "\n") + + return(alpha_result) +} + +# Calculate Cronbach's alpha for all scales +cat("CRONBACH'S ALPHA RELIABILITY ANALYSIS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +# Past time point analyses +past_pref_alpha <- calc_cronbach_alpha(data, past_pref_vars, "Past Preferences") +past_pers_alpha <- calc_cronbach_alpha(data, past_pers_vars, "Past Personality") +past_val_alpha <- calc_cronbach_alpha(data, past_val_vars, "Past Values") +past_life_alpha <- calc_cronbach_alpha(data, past_life_vars, "Past Life Satisfaction") + +# Future time point analyses +fut_pref_alpha <- calc_cronbach_alpha(data, fut_pref_vars, "Future Preferences") +fut_pers_alpha <- calc_cronbach_alpha(data, fut_pers_vars, "Future Personality") +fut_val_alpha <- calc_cronbach_alpha(data, fut_val_vars, "Future Values") +fut_life_alpha <- calc_cronbach_alpha(data, fut_life_vars, "Future Life Satisfaction") + +# Summary table +cat("\n", "="*80, "\n") +cat("SUMMARY OF CRONBACH'S ALPHA COEFFICIENTS") +cat("\n", "="*80, "\n") + +summary_results <- data.frame( + Scale = c("Past Preferences", "Past Personality", "Past Values", "Past Life Satisfaction", + "Future Preferences", "Future Personality", "Future Values", "Future Life Satisfaction"), + Alpha = c( + if(!is.null(past_pref_alpha)) round(past_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_pers_alpha)) round(past_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_val_alpha)) round(past_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_life_alpha)) round(past_life_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pref_alpha)) round(fut_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pers_alpha)) round(fut_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_val_alpha)) round(fut_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_life_alpha)) round(fut_life_alpha$total$raw_alpha, 4) else NA + ), + Items = rep(5, 8), + Interpretation = c( + if(!is.null(past_pref_alpha)) { + alpha_val <- past_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_pers_alpha)) { + alpha_val <- past_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_val_alpha)) { + alpha_val <- past_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_life_alpha)) { + alpha_val <- past_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pref_alpha)) { + alpha_val <- fut_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pers_alpha)) { + alpha_val <- fut_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_val_alpha)) { + alpha_val <- fut_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_life_alpha)) { + alpha_val <- fut_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data" + ) +) + +print(summary_results) + +# Save results to CSV +write.csv(summary_results, "cronbach_alpha_summary.csv", row.names = FALSE) +cat("\nSummary results saved to: cronbach_alpha_summary.csv\n") + +cat("\n", "="*80, "\n") +cat("INTERPRETATION GUIDE FOR CRONBACH'S ALPHA") +cat("\n", "="*80, "\n") +cat("α ≥ 0.90: Excellent reliability\n") +cat("α ≥ 0.80: Good reliability\n") +cat("α ≥ 0.70: Acceptable reliability\n") +cat("α ≥ 0.60: Questionable reliability\n") +cat("α < 0.60: Poor reliability\n") + + diff --git a/.history/eohi1/test_knit_20251004194422.rmd b/.history/eohi1/test_knit_20251004194422.rmd new file mode 100644 index 0000000..3f9d533 --- /dev/null +++ b/.history/eohi1/test_knit_20251004194422.rmd @@ -0,0 +1,22 @@ +--- +title: "Test Knit" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Test + +This is a test to see if knitting works. + +```{r test} +library(tidyverse) +print("Libraries loaded successfully") +``` + +```{r test-data} +data <- read.csv("exp1.csv") +print(paste("Data loaded:", nrow(data), "rows")) +``` diff --git a/.history/eohi1/test_knit_20251004194431.rmd b/.history/eohi1/test_knit_20251004194431.rmd new file mode 100644 index 0000000..3f9d533 --- /dev/null +++ b/.history/eohi1/test_knit_20251004194431.rmd @@ -0,0 +1,22 @@ +--- +title: "Test Knit" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Test + +This is a test to see if knitting works. + +```{r test} +library(tidyverse) +print("Libraries loaded successfully") +``` + +```{r test-data} +data <- read.csv("exp1.csv") +print(paste("Data loaded:", nrow(data), "rows")) +``` diff --git a/.history/eohi1/test_knit_20251004194642.rmd b/.history/eohi1/test_knit_20251004194642.rmd new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/.history/eohi1/test_knit_20251004194642.rmd @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.history/eohi2/README_Variable_Creation_20251001133606.txt b/.history/eohi2/README_Variable_Creation_20251001133606.txt new file mode 100644 index 0000000..4029a3e --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001133606.txt @@ -0,0 +1,425 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 06 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 184 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001133614.txt b/.history/eohi2/README_Variable_Creation_20251001133614.txt new file mode 100644 index 0000000..4029a3e --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001133614.txt @@ -0,0 +1,425 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 06 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 184 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001133615.txt b/.history/eohi2/README_Variable_Creation_20251001133615.txt new file mode 100644 index 0000000..4029a3e --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001133615.txt @@ -0,0 +1,425 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 06 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 184 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001133634.txt b/.history/eohi2/README_Variable_Creation_20251001133634.txt new file mode 100644 index 0000000..4029a3e --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001133634.txt @@ -0,0 +1,425 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 06 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 184 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154337.txt b/.history/eohi2/README_Variable_Creation_20251001154337.txt new file mode 100644 index 0000000..81ff966 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154337.txt @@ -0,0 +1,425 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 184 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154405.txt b/.history/eohi2/README_Variable_Creation_20251001154405.txt new file mode 100644 index 0000000..097b4d1 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154405.txt @@ -0,0 +1,503 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 184 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154412.txt b/.history/eohi2/README_Variable_Creation_20251001154412.txt new file mode 100644 index 0000000..6499977 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154412.txt @@ -0,0 +1,504 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154419.txt b/.history/eohi2/README_Variable_Creation_20251001154419.txt new file mode 100644 index 0000000..236fe07 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154419.txt @@ -0,0 +1,512 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 06) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154424.txt b/.history/eohi2/README_Variable_Creation_20251001154424.txt new file mode 100644 index 0000000..43bd090 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154424.txt @@ -0,0 +1,512 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04 and 06 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154430.txt b/.history/eohi2/README_Variable_Creation_20251001154430.txt new file mode 100644 index 0000000..1cc72e7 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154430.txt @@ -0,0 +1,512 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001154444.txt b/.history/eohi2/README_Variable_Creation_20251001154444.txt new file mode 100644 index 0000000..1cc72e7 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001154444.txt @@ -0,0 +1,512 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001155104.txt b/.history/eohi2/README_Variable_Creation_20251001155104.txt new file mode 100644 index 0000000..1cc72e7 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001155104.txt @@ -0,0 +1,512 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251001155126.txt b/.history/eohi2/README_Variable_Creation_20251001155126.txt new file mode 100644 index 0000000..1cc72e7 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251001155126.txt @@ -0,0 +1,512 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114335.txt b/.history/eohi2/README_Variable_Creation_20251008114335.txt new file mode 100644 index 0000000..e6fee3a --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114335.txt @@ -0,0 +1,650 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 202 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (16 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114354.txt b/.history/eohi2/README_Variable_Creation_20251008114354.txt new file mode 100644 index 0000000..bd54bb7 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114354.txt @@ -0,0 +1,659 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 07) as later scripts depend + on variables created by earlier scripts. + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114414.txt b/.history/eohi2/README_Variable_Creation_20251008114414.txt new file mode 100644 index 0000000..9062b01 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114414.txt @@ -0,0 +1,670 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 1, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114419.txt b/.history/eohi2/README_Variable_Creation_20251008114419.txt new file mode 100644 index 0000000..fba6b31 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114419.txt @@ -0,0 +1,670 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 07 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114428.txt b/.history/eohi2/README_Variable_Creation_20251008114428.txt new file mode 100644 index 0000000..fc57604 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114428.txt @@ -0,0 +1,670 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114444.txt b/.history/eohi2/README_Variable_Creation_20251008114444.txt new file mode 100644 index 0000000..fc57604 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114444.txt @@ -0,0 +1,670 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114508.txt b/.history/eohi2/README_Variable_Creation_20251008114508.txt new file mode 100644 index 0000000..fc57604 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114508.txt @@ -0,0 +1,670 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008114531.txt b/.history/eohi2/README_Variable_Creation_20251008114531.txt new file mode 100644 index 0000000..fc57604 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008114531.txt @@ -0,0 +1,670 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 219 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171443.txt b/.history/eohi2/README_Variable_Creation_20251008171443.txt new file mode 100644 index 0000000..e3d8555 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171443.txt @@ -0,0 +1,921 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171453.txt b/.history/eohi2/README_Variable_Creation_20251008171453.txt new file mode 100644 index 0000000..b056cf2 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171453.txt @@ -0,0 +1,926 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (22 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Mean scores: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171510.txt b/.history/eohi2/README_Variable_Creation_20251008171510.txt new file mode 100644 index 0000000..954a538 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171510.txt @@ -0,0 +1,933 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 09) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04 (DGEN means need DGEN scores) + - Script 03 required before Script 08 (DGEN 5-vs-10 need DGEN scores) + - Script 06 required before Script 07 (domain means need differences) + - Script 06 required before Script 09 (interval × direction means need + differences) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171520.txt b/.history/eohi2/README_Variable_Creation_20251008171520.txt new file mode 100644 index 0000000..756cdf7 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171520.txt @@ -0,0 +1,934 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with random row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Script 09 includes comprehensive QA with first 5 rows for all 11 variables + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171528.txt b/.history/eohi2/README_Variable_Creation_20251008171528.txt new file mode 100644 index 0000000..1655c07 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171528.txt @@ -0,0 +1,936 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-14 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171541.txt b/.history/eohi2/README_Variable_Creation_20251008171541.txt new file mode 100644 index 0000000..da6d9d1 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171541.txt @@ -0,0 +1,971 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-14 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 +Processing Pipeline: Scripts 01-14 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171604.txt b/.history/eohi2/README_Variable_Creation_20251008171604.txt new file mode 100644 index 0000000..da6d9d1 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171604.txt @@ -0,0 +1,971 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-14 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 +Processing Pipeline: Scripts 01-14 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171626.txt b/.history/eohi2/README_Variable_Creation_20251008171626.txt new file mode 100644 index 0000000..da6d9d1 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171626.txt @@ -0,0 +1,971 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-14 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 +Processing Pipeline: Scripts 01-14 + diff --git a/.history/eohi2/README_Variable_Creation_20251008171628.txt b/.history/eohi2/README_Variable_Creation_20251008171628.txt new file mode 100644 index 0000000..da6d9d1 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251008171628.txt @@ -0,0 +1,971 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 285 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-14 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 +Processing Pipeline: Scripts 01-14 + diff --git a/.history/eohi2/README_Variable_Creation_20251029133334.txt b/.history/eohi2/README_Variable_Creation_20251029133334.txt new file mode 100644 index 0000000..7fb45fb --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251029133334.txt @@ -0,0 +1,1044 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 14) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-14 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 +Processing Pipeline: Scripts 01-14 + diff --git a/.history/eohi2/README_Variable_Creation_20251029133342.txt b/.history/eohi2/README_Variable_Creation_20251029133342.txt new file mode 100644 index 0000000..2f3d00b --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251029133342.txt @@ -0,0 +1,1047 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 16) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + - Script 14 required before Script 16 (uses ehiDGEN_5/10_mean, ehi5/10_global_mean) + - Script 15 can run anytime after raw `demo_edu` is present; run before + analyses needing `edu3` + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-16 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14, 16) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 8, 2025 +Processing Pipeline: Scripts 01-14 + diff --git a/.history/eohi2/README_Variable_Creation_20251029133348.txt b/.history/eohi2/README_Variable_Creation_20251029133348.txt new file mode 100644 index 0000000..971bcf1 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251029133348.txt @@ -0,0 +1,1047 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through dataP 09 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 16) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + - Script 14 required before Script 16 (uses ehiDGEN_5/10_mean, ehi5/10_global_mean) + - Script 15 can run anytime after raw `demo_edu` is present; run before + analyses needing `edu3` + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-16 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14, 16) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 29, 2025 +Processing Pipeline: Scripts 01-16 + diff --git a/.history/eohi2/README_Variable_Creation_20251029133355.txt b/.history/eohi2/README_Variable_Creation_20251029133355.txt new file mode 100644 index 0000000..e5821a2 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251029133355.txt @@ -0,0 +1,1047 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through datap 16 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 16) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + - Script 14 required before Script 16 (uses ehiDGEN_5/10_mean, ehi5/10_global_mean) + - Script 15 can run anytime after raw `demo_edu` is present; run before + analyses needing `edu3` + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-16 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14, 16) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 29, 2025 +Processing Pipeline: Scripts 01-16 + diff --git a/.history/eohi2/README_Variable_Creation_20251029133422.txt b/.history/eohi2/README_Variable_Creation_20251029133422.txt new file mode 100644 index 0000000..e5821a2 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251029133422.txt @@ -0,0 +1,1047 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through datap 16 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 16) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + - Script 14 required before Script 16 (uses ehiDGEN_5/10_mean, ehi5/10_global_mean) + - Script 15 can run anytime after raw `demo_edu` is present; run before + analyses needing `edu3` + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-16 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14, 16) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 29, 2025 +Processing Pipeline: Scripts 01-16 + diff --git a/.history/eohi2/README_Variable_Creation_20251029133433.txt b/.history/eohi2/README_Variable_Creation_20251029133433.txt new file mode 100644 index 0000000..e5821a2 --- /dev/null +++ b/.history/eohi2/README_Variable_Creation_20251029133433.txt @@ -0,0 +1,1047 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through datap 16 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 16) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + - Script 14 required before Script 16 (uses ehiDGEN_5/10_mean, ehi5/10_global_mean) + - Script 15 can run anytime after raw `demo_edu` is present; run before + analyses needing `edu3` + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-16 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14, 16) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 29, 2025 +Processing Pipeline: Scripts 01-16 + diff --git a/.history/eohi2/RMD - mixed anova DGEN_20251003190744.rmd b/.history/eohi2/RMD - mixed anova DGEN_20251003190744.rmd new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/RMD - mixed anova DGEN_20251006125956.rmd b/.history/eohi2/RMD - mixed anova DGEN_20251006125956.rmd new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/correlation matrix 2 - std ehi_20251029124228.r b/.history/eohi2/correlation matrix 2 - std ehi_20251029124228.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/correlation matrix 2 - std ehi_20251029124229.r b/.history/eohi2/correlation matrix 2 - std ehi_20251029124229.r new file mode 100644 index 0000000..755cd29 --- /dev/null +++ b/.history/eohi2/correlation matrix 2 - std ehi_20251029124229.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/correlation matrix 2 - std ehi_20251029124329.r b/.history/eohi2/correlation matrix 2 - std ehi_20251029124329.r new file mode 100644 index 0000000..4e5e2c6 --- /dev/null +++ b/.history/eohi2/correlation matrix 2 - std ehi_20251029124329.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(stdEHI_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(stdEHI_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "STD_EHI_correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "STD_EHI_correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to STD_EHI_correlation_matrix.csv") +print("P-values saved to STD_EHI_correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/correlations - domain general vars_20251008122234.r b/.history/eohi2/correlations - domain general vars_20251008122234.r new file mode 100644 index 0000000..37bfde1 --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122234.r @@ -0,0 +1,184 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain general vars_20251008122239.r b/.history/eohi2/correlations - domain general vars_20251008122239.r new file mode 100644 index 0000000..37bfde1 --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122239.r @@ -0,0 +1,184 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain general vars_20251008122254.r b/.history/eohi2/correlations - domain general vars_20251008122254.r new file mode 100644 index 0000000..37bfde1 --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122254.r @@ -0,0 +1,184 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain general vars_20251008122540.r b/.history/eohi2/correlations - domain general vars_20251008122540.r new file mode 100644 index 0000000..e56d8aa --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122540.r @@ -0,0 +1,175 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain general vars_20251008122543.r b/.history/eohi2/correlations - domain general vars_20251008122543.r new file mode 100644 index 0000000..e56d8aa --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122543.r @@ -0,0 +1,175 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain general vars_20251008122553.r b/.history/eohi2/correlations - domain general vars_20251008122553.r new file mode 100644 index 0000000..e56d8aa --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122553.r @@ -0,0 +1,175 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain general vars_20251008122555.r b/.history/eohi2/correlations - domain general vars_20251008122555.r new file mode 100644 index 0000000..e56d8aa --- /dev/null +++ b/.history/eohi2/correlations - domain general vars_20251008122555.r @@ -0,0 +1,175 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/.history/eohi2/correlations - domain specific vars_20251008115022.r b/.history/eohi2/correlations - domain specific vars_20251008115022.r new file mode 100644 index 0000000..545e8f3 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008115022.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "Nfut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations - domain specific vars_20251008115035.r b/.history/eohi2/correlations - domain specific vars_20251008115035.r new file mode 100644 index 0000000..545e8f3 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008115035.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "Nfut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations - domain specific vars_20251008115036.r b/.history/eohi2/correlations - domain specific vars_20251008115036.r new file mode 100644 index 0000000..545e8f3 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008115036.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "Nfut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations - domain specific vars_20251008115149.r b/.history/eohi2/correlations - domain specific vars_20251008115149.r new file mode 100644 index 0000000..cf25054 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008115149.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "NFut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations - domain specific vars_20251008115152.r b/.history/eohi2/correlations - domain specific vars_20251008115152.r new file mode 100644 index 0000000..cf25054 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008115152.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "NFut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations - domain specific vars_20251008115154.r b/.history/eohi2/correlations - domain specific vars_20251008115154.r new file mode 100644 index 0000000..cf25054 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008115154.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "NFut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations - domain specific vars_20251008121216.r b/.history/eohi2/correlations - domain specific vars_20251008121216.r new file mode 100644 index 0000000..cf25054 --- /dev/null +++ b/.history/eohi2/correlations - domain specific vars_20251008121216.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "NFut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171931.r b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171931.r new file mode 100644 index 0000000..4e31353 --- /dev/null +++ b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171931.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171942.r b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171942.r new file mode 100644 index 0000000..4e31353 --- /dev/null +++ b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171942.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171945.r b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171945.r new file mode 100644 index 0000000..4e31353 --- /dev/null +++ b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008171945.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008172011.r b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008172011.r new file mode 100644 index 0000000..9a71216 --- /dev/null +++ b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008172011.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlationCORRECT_exp2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008172056.r b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008172056.r new file mode 100644 index 0000000..2c5729e --- /dev/null +++ b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008172056.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlationCORRECT_exp2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008185510.r b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008185510.r new file mode 100644 index 0000000..2c5729e --- /dev/null +++ b/.history/eohi2/correlations CORRECT - ehi + DGEN x scales_20251008185510.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlationCORRECT_exp2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/dataP - DGEN means_20251001122522.r b/.history/eohi2/dataP - DGEN means_20251001122522.r new file mode 100644 index 0000000..3d454c8 --- /dev/null +++ b/.history/eohi2/dataP - DGEN means_20251001122522.r @@ -0,0 +1,183 @@ +# Script to calculate DGEN means by time period in eohi2.csv +# Averages the 3 domain scores (Pref, Pers, Val) for each time period + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns (12 total) +source_cols <- c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +) + +# Define target columns (4 total) +target_cols <- c( + "DGEN_past_5_mean", + "DGEN_past_10_mean", + "DGEN_fut_5_mean", + "DGEN_fut_10_mean" +) + +# Define groupings: each target gets 3 source columns +source_groups <- list( + DGEN_past_5_mean = c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val"), + DGEN_past_10_mean = c("DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val"), + DGEN_fut_5_mean = c("DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val"), + DGEN_fut_10_mean = c("DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 4 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 6) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE MEANS ============= +cat("Calculating DGEN means by time period...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate each target as the mean of its 3 source columns +for (target in target_cols) { + source_group <- source_groups[[target]] + + # Get the columns that exist + existing_cols <- source_group[source_group %in% names(df)] + + if (length(existing_cols) > 0) { + # Calculate row means across the 3 domain columns + df[[target]] <- rowMeans(df[, existing_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", target, "\n") + } else { + cat(" WARNING: No source columns found for", target, "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 4 target columns + for (target in target_cols) { + source_group <- source_groups[[target]] + + cat(sprintf("Target: %s\n", target)) + cat(" Source columns:\n") + + # Get values from source columns + values <- numeric(3) + for (i in 1:3) { + col <- source_group[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target] + + cat(sprintf("\n Calculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", paste(valid_values, collapse = " + "), sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target value: %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 163 to save changes.\n") +cat("\nProcessing complete! 4 DGEN mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - DGEN means_20251001122534.r b/.history/eohi2/dataP - DGEN means_20251001122534.r new file mode 100644 index 0000000..3d454c8 --- /dev/null +++ b/.history/eohi2/dataP - DGEN means_20251001122534.r @@ -0,0 +1,183 @@ +# Script to calculate DGEN means by time period in eohi2.csv +# Averages the 3 domain scores (Pref, Pers, Val) for each time period + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns (12 total) +source_cols <- c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +) + +# Define target columns (4 total) +target_cols <- c( + "DGEN_past_5_mean", + "DGEN_past_10_mean", + "DGEN_fut_5_mean", + "DGEN_fut_10_mean" +) + +# Define groupings: each target gets 3 source columns +source_groups <- list( + DGEN_past_5_mean = c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val"), + DGEN_past_10_mean = c("DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val"), + DGEN_fut_5_mean = c("DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val"), + DGEN_fut_10_mean = c("DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 4 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 6) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE MEANS ============= +cat("Calculating DGEN means by time period...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate each target as the mean of its 3 source columns +for (target in target_cols) { + source_group <- source_groups[[target]] + + # Get the columns that exist + existing_cols <- source_group[source_group %in% names(df)] + + if (length(existing_cols) > 0) { + # Calculate row means across the 3 domain columns + df[[target]] <- rowMeans(df[, existing_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", target, "\n") + } else { + cat(" WARNING: No source columns found for", target, "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 4 target columns + for (target in target_cols) { + source_group <- source_groups[[target]] + + cat(sprintf("Target: %s\n", target)) + cat(" Source columns:\n") + + # Get values from source columns + values <- numeric(3) + for (i in 1:3) { + col <- source_group[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target] + + cat(sprintf("\n Calculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", paste(valid_values, collapse = " + "), sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target value: %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 163 to save changes.\n") +cat("\nProcessing complete! 4 DGEN mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - DGEN means_20251001122539.r b/.history/eohi2/dataP - DGEN means_20251001122539.r new file mode 100644 index 0000000..3d454c8 --- /dev/null +++ b/.history/eohi2/dataP - DGEN means_20251001122539.r @@ -0,0 +1,183 @@ +# Script to calculate DGEN means by time period in eohi2.csv +# Averages the 3 domain scores (Pref, Pers, Val) for each time period + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns (12 total) +source_cols <- c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +) + +# Define target columns (4 total) +target_cols <- c( + "DGEN_past_5_mean", + "DGEN_past_10_mean", + "DGEN_fut_5_mean", + "DGEN_fut_10_mean" +) + +# Define groupings: each target gets 3 source columns +source_groups <- list( + DGEN_past_5_mean = c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val"), + DGEN_past_10_mean = c("DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val"), + DGEN_fut_5_mean = c("DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val"), + DGEN_fut_10_mean = c("DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 4 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 6) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE MEANS ============= +cat("Calculating DGEN means by time period...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate each target as the mean of its 3 source columns +for (target in target_cols) { + source_group <- source_groups[[target]] + + # Get the columns that exist + existing_cols <- source_group[source_group %in% names(df)] + + if (length(existing_cols) > 0) { + # Calculate row means across the 3 domain columns + df[[target]] <- rowMeans(df[, existing_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", target, "\n") + } else { + cat(" WARNING: No source columns found for", target, "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 4 target columns + for (target in target_cols) { + source_group <- source_groups[[target]] + + cat(sprintf("Target: %s\n", target)) + cat(" Source columns:\n") + + # Get values from source columns + values <- numeric(3) + for (i in 1:3) { + col <- source_group[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target] + + cat(sprintf("\n Calculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", paste(valid_values, collapse = " + "), sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target value: %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 163 to save changes.\n") +cat("\nProcessing complete! 4 DGEN mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - DGEN means_20251001124312.r b/.history/eohi2/dataP - DGEN means_20251001124312.r new file mode 100644 index 0000000..d72f308 --- /dev/null +++ b/.history/eohi2/dataP - DGEN means_20251001124312.r @@ -0,0 +1,183 @@ +# Script to calculate DGEN means by time period in eohi2.csv +# Averages the 3 domain scores (Pref, Pers, Val) for each time period + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns (12 total) +source_cols <- c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +) + +# Define target columns (4 total) +target_cols <- c( + "DGEN_past_5_mean", + "DGEN_past_10_mean", + "DGEN_fut_5_mean", + "DGEN_fut_10_mean" +) + +# Define groupings: each target gets 3 source columns +source_groups <- list( + DGEN_past_5_mean = c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val"), + DGEN_past_10_mean = c("DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val"), + DGEN_fut_5_mean = c("DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val"), + DGEN_fut_10_mean = c("DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 4 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 6) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE MEANS ============= +cat("Calculating DGEN means by time period...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate each target as the mean of its 3 source columns +for (target in target_cols) { + source_group <- source_groups[[target]] + + # Get the columns that exist + existing_cols <- source_group[source_group %in% names(df)] + + if (length(existing_cols) > 0) { + # Calculate row means across the 3 domain columns + df[[target]] <- rowMeans(df[, existing_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", target, "\n") + } else { + cat(" WARNING: No source columns found for", target, "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 4 target columns + for (target in target_cols) { + source_group <- source_groups[[target]] + + cat(sprintf("Target: %s\n", target)) + cat(" Source columns:\n") + + # Get values from source columns + values <- numeric(3) + for (i in 1:3) { + col <- source_group[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target] + + cat(sprintf("\n Calculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", paste(valid_values, collapse = " + "), sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target value: %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 163 to save changes.\n") +cat("\nProcessing complete! 4 DGEN mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - DGEN means_20251001130521.r b/.history/eohi2/dataP - DGEN means_20251001130521.r new file mode 100644 index 0000000..3d454c8 --- /dev/null +++ b/.history/eohi2/dataP - DGEN means_20251001130521.r @@ -0,0 +1,183 @@ +# Script to calculate DGEN means by time period in eohi2.csv +# Averages the 3 domain scores (Pref, Pers, Val) for each time period + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns (12 total) +source_cols <- c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +) + +# Define target columns (4 total) +target_cols <- c( + "DGEN_past_5_mean", + "DGEN_past_10_mean", + "DGEN_fut_5_mean", + "DGEN_fut_10_mean" +) + +# Define groupings: each target gets 3 source columns +source_groups <- list( + DGEN_past_5_mean = c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val"), + DGEN_past_10_mean = c("DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val"), + DGEN_fut_5_mean = c("DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val"), + DGEN_fut_10_mean = c("DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 4 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 6) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE MEANS ============= +cat("Calculating DGEN means by time period...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate each target as the mean of its 3 source columns +for (target in target_cols) { + source_group <- source_groups[[target]] + + # Get the columns that exist + existing_cols <- source_group[source_group %in% names(df)] + + if (length(existing_cols) > 0) { + # Calculate row means across the 3 domain columns + df[[target]] <- rowMeans(df[, existing_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", target, "\n") + } else { + cat(" WARNING: No source columns found for", target, "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 4 target columns + for (target in target_cols) { + source_group <- source_groups[[target]] + + cat(sprintf("Target: %s\n", target)) + cat(" Source columns:\n") + + # Get values from source columns + values <- numeric(3) + for (i in 1:3) { + col <- source_group[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target] + + cat(sprintf("\n Calculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", paste(valid_values, collapse = " + "), sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target value: %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 163 to save changes.\n") +cat("\nProcessing complete! 4 DGEN mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100032.r b/.history/eohi2/dataP - recode DGEN vars_20251001100032.r new file mode 100644 index 0000000..82e358a --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100032.r @@ -0,0 +1,255 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100044.r b/.history/eohi2/dataP - recode DGEN vars_20251001100044.r new file mode 100644 index 0000000..9dc2e59 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100044.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100055.r b/.history/eohi2/dataP - recode DGEN vars_20251001100055.r new file mode 100644 index 0000000..9dc2e59 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100055.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100142.r b/.history/eohi2/dataP - recode DGEN vars_20251001100142.r new file mode 100644 index 0000000..9dc2e59 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100142.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100344.r b/.history/eohi2/dataP - recode DGEN vars_20251001100344.r new file mode 100644 index 0000000..29ed2af --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100344.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK - CHECKING ROW #", random_row, " (out of ", nrow(df), " total rows)\n", sep = "") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100345.r b/.history/eohi2/dataP - recode DGEN vars_20251001100345.r new file mode 100644 index 0000000..29ed2af --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100345.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK - CHECKING ROW #", random_row, " (out of ", nrow(df), " total rows)\n", sep = "") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100404.r b/.history/eohi2/dataP - recode DGEN vars_20251001100404.r new file mode 100644 index 0000000..9dc2e59 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100404.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100408.r b/.history/eohi2/dataP - recode DGEN vars_20251001100408.r new file mode 100644 index 0000000..9dc2e59 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100408.r @@ -0,0 +1,256 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100532.r b/.history/eohi2/dataP - recode DGEN vars_20251001100532.r new file mode 100644 index 0000000..66f25ab --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100532.r @@ -0,0 +1,255 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100534.r b/.history/eohi2/dataP - recode DGEN vars_20251001100534.r new file mode 100644 index 0000000..66f25ab --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100534.r @@ -0,0 +1,255 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 267 to save changes.\n") +cat("\nProcessing complete! 12 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100537.r b/.history/eohi2/dataP - recode DGEN vars_20251001100537.r new file mode 100644 index 0000000..abcc128 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100537.r @@ -0,0 +1,253 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 12 new columns added to eohi2.csv\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100544.r b/.history/eohi2/dataP - recode DGEN vars_20251001100544.r new file mode 100644 index 0000000..abcc128 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100544.r @@ -0,0 +1,253 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 12 new columns added to eohi2.csv\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100547.r b/.history/eohi2/dataP - recode DGEN vars_20251001100547.r new file mode 100644 index 0000000..abcc128 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100547.r @@ -0,0 +1,253 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 12 new columns added to eohi2.csv\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001100624.r b/.history/eohi2/dataP - recode DGEN vars_20251001100624.r new file mode 100644 index 0000000..abcc128 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001100624.r @@ -0,0 +1,253 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 12 new columns added to eohi2.csv\n") diff --git a/.history/eohi2/dataP - recode DGEN vars_20251001105736.r b/.history/eohi2/dataP - recode DGEN vars_20251001105736.r new file mode 100644 index 0000000..abcc128 --- /dev/null +++ b/.history/eohi2/dataP - recode DGEN vars_20251001105736.r @@ -0,0 +1,253 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 12 new columns added to eohi2.csv\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001110617.r b/.history/eohi2/dataP - recode present VARS_20251001110617.r new file mode 100644 index 0000000..da4221c --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001110617.r @@ -0,0 +1,197 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each column +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 15 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001110629.r b/.history/eohi2/dataP - recode present VARS_20251001110629.r new file mode 100644 index 0000000..da4221c --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001110629.r @@ -0,0 +1,197 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each column +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 15 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001110731.r b/.history/eohi2/dataP - recode present VARS_20251001110731.r new file mode 100644 index 0000000..da4221c --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001110731.r @@ -0,0 +1,197 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each column +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 15 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001110926.r b/.history/eohi2/dataP - recode present VARS_20251001110926.r new file mode 100644 index 0000000..02a4b9d --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001110926.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check that target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns (should already exist):\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns do NOT exist:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Target columns missing! Cannot overwrite.") +} + +cat(" All target columns found. Will overwrite with recoded values.\n\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001110934.r b/.history/eohi2/dataP - recode present VARS_20251001110934.r new file mode 100644 index 0000000..02a4b9d --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001110934.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check that target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns (should already exist):\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns do NOT exist:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Target columns missing! Cannot overwrite.") +} + +cat(" All target columns found. Will overwrite with recoded values.\n\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001110936.r b/.history/eohi2/dataP - recode present VARS_20251001110936.r new file mode 100644 index 0000000..02a4b9d --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001110936.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check that target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns (should already exist):\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns do NOT exist:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Target columns missing! Cannot overwrite.") +} + +cat(" All target columns found. Will overwrite with recoded values.\n\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001111008.r b/.history/eohi2/dataP - recode present VARS_20251001111008.r new file mode 100644 index 0000000..2ee7d61 --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001111008.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check if target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with recoded values.\n") +} +cat("\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001111014.r b/.history/eohi2/dataP - recode present VARS_20251001111014.r new file mode 100644 index 0000000..2ee7d61 --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001111014.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check if target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with recoded values.\n") +} +cat("\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001111106.r b/.history/eohi2/dataP - recode present VARS_20251001111106.r new file mode 100644 index 0000000..2ee7d61 --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001111106.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check if target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with recoded values.\n") +} +cat("\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode present VARS_20251001112101.r b/.history/eohi2/dataP - recode present VARS_20251001112101.r new file mode 100644 index 0000000..6adcf6d --- /dev/null +++ b/.history/eohi2/dataP - recode present VARS_20251001112101.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check if target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with recoded values.\n") +} +cat("\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001113407.r b/.history/eohi2/dataP - recode scales VARS_20251001113407.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/dataP - recode scales VARS_20251001113436.r b/.history/eohi2/dataP - recode scales VARS_20251001113436.r new file mode 100644 index 0000000..979b420 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001113436.r @@ -0,0 +1,4 @@ +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") \ No newline at end of file diff --git a/.history/eohi2/dataP - recode scales VARS_20251001114903.r b/.history/eohi2/dataP - recode scales VARS_20251001114903.r new file mode 100644 index 0000000..d2611e3 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001114903.r @@ -0,0 +1,281 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Reverse code items 4, 5, 6, 7 (multiply by -1) +reverse_items <- c("aot_4", "aot_5", "aot_6", "aot_7") +for (col in reverse_items) { + if (col %in% names(df)) { + df[[col]] <- df[[col]] * -1 + } +} + +# Calculate average of all 8 AOT items +df$aot_total <- rowMeans(df[, aot_cols[aot_cols %in% names(df)]], na.rm = TRUE) + +cat(" AOT total scores calculated (items 4-7 reverse coded).\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values:\n") + aot_values <- numeric(8) + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_values[i] <- val + reverse_note <- if (i %in% 4:7) " (REVERSED)" else "" + cat(sprintf(" %s: %s%s\n", col, ifelse(is.na(val), "NA", as.character(val)), reverse_note)) + } + + # Manual calculation check + valid_aot <- aot_values[!is.na(aot_values)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001114914.r b/.history/eohi2/dataP - recode scales VARS_20251001114914.r new file mode 100644 index 0000000..d2611e3 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001114914.r @@ -0,0 +1,281 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Reverse code items 4, 5, 6, 7 (multiply by -1) +reverse_items <- c("aot_4", "aot_5", "aot_6", "aot_7") +for (col in reverse_items) { + if (col %in% names(df)) { + df[[col]] <- df[[col]] * -1 + } +} + +# Calculate average of all 8 AOT items +df$aot_total <- rowMeans(df[, aot_cols[aot_cols %in% names(df)]], na.rm = TRUE) + +cat(" AOT total scores calculated (items 4-7 reverse coded).\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values:\n") + aot_values <- numeric(8) + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_values[i] <- val + reverse_note <- if (i %in% 4:7) " (REVERSED)" else "" + cat(sprintf(" %s: %s%s\n", col, ifelse(is.na(val), "NA", as.character(val)), reverse_note)) + } + + # Manual calculation check + valid_aot <- aot_values[!is.na(aot_values)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001115233.r b/.history/eohi2/dataP - recode scales VARS_20251001115233.r new file mode 100644 index 0000000..d2611e3 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001115233.r @@ -0,0 +1,281 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Reverse code items 4, 5, 6, 7 (multiply by -1) +reverse_items <- c("aot_4", "aot_5", "aot_6", "aot_7") +for (col in reverse_items) { + if (col %in% names(df)) { + df[[col]] <- df[[col]] * -1 + } +} + +# Calculate average of all 8 AOT items +df$aot_total <- rowMeans(df[, aot_cols[aot_cols %in% names(df)]], na.rm = TRUE) + +cat(" AOT total scores calculated (items 4-7 reverse coded).\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values:\n") + aot_values <- numeric(8) + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_values[i] <- val + reverse_note <- if (i %in% 4:7) " (REVERSED)" else "" + cat(sprintf(" %s: %s%s\n", col, ifelse(is.na(val), "NA", as.character(val)), reverse_note)) + } + + # Manual calculation check + valid_aot <- aot_values[!is.na(aot_values)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001120138.r b/.history/eohi2/dataP - recode scales VARS_20251001120138.r new file mode 100644 index 0000000..b2bc32f --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001120138.r @@ -0,0 +1,285 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values:\n") + aot_values <- numeric(8) + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_values[i] <- val + reverse_note <- if (i %in% 4:7) " (REVERSED)" else "" + cat(sprintf(" %s: %s%s\n", col, ifelse(is.na(val), "NA", as.character(val)), reverse_note)) + } + + # Manual calculation check + valid_aot <- aot_values[!is.na(aot_values)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001120154.r b/.history/eohi2/dataP - recode scales VARS_20251001120154.r new file mode 100644 index 0000000..2861737 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001120154.r @@ -0,0 +1,298 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values (original in CSV):\n") + aot_original <- numeric(8) + aot_for_calc <- numeric(8) + + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_original[i] <- val + + # Apply reversal for items 4-7 + if (i %in% 4:7) { + aot_for_calc[i] <- val * -1 + cat(sprintf(" %s: %s (reversed to %s for calculation)\n", + col, + ifelse(is.na(val), "NA", as.character(val)), + ifelse(is.na(val), "NA", as.character(val * -1)))) + } else { + aot_for_calc[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + } + + # Manual calculation check + valid_aot <- aot_for_calc[!is.na(aot_for_calc)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Sum of reversed values: %s\n", paste(valid_aot, collapse = " + "))) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001120204.r b/.history/eohi2/dataP - recode scales VARS_20251001120204.r new file mode 100644 index 0000000..2861737 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001120204.r @@ -0,0 +1,298 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values (original in CSV):\n") + aot_original <- numeric(8) + aot_for_calc <- numeric(8) + + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_original[i] <- val + + # Apply reversal for items 4-7 + if (i %in% 4:7) { + aot_for_calc[i] <- val * -1 + cat(sprintf(" %s: %s (reversed to %s for calculation)\n", + col, + ifelse(is.na(val), "NA", as.character(val)), + ifelse(is.na(val), "NA", as.character(val * -1)))) + } else { + aot_for_calc[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + } + + # Manual calculation check + valid_aot <- aot_for_calc[!is.na(aot_for_calc)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Sum of reversed values: %s\n", paste(valid_aot, collapse = " + "))) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001120217.r b/.history/eohi2/dataP - recode scales VARS_20251001120217.r new file mode 100644 index 0000000..2861737 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001120217.r @@ -0,0 +1,298 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values (original in CSV):\n") + aot_original <- numeric(8) + aot_for_calc <- numeric(8) + + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_original[i] <- val + + # Apply reversal for items 4-7 + if (i %in% 4:7) { + aot_for_calc[i] <- val * -1 + cat(sprintf(" %s: %s (reversed to %s for calculation)\n", + col, + ifelse(is.na(val), "NA", as.character(val)), + ifelse(is.na(val), "NA", as.character(val * -1)))) + } else { + aot_for_calc[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + } + + # Manual calculation check + valid_aot <- aot_for_calc[!is.na(aot_for_calc)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Sum of reversed values: %s\n", paste(valid_aot, collapse = " + "))) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001120228.r b/.history/eohi2/dataP - recode scales VARS_20251001120228.r new file mode 100644 index 0000000..3eb817b --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001120228.r @@ -0,0 +1,298 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values (original in CSV):\n") + aot_original <- numeric(8) + aot_for_calc <- numeric(8) + + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_original[i] <- val + + # Apply reversal for items 4-7 + if (i %in% 4:7) { + aot_for_calc[i] <- val * -1 + cat(sprintf(" %s: %s (reversed to %s for calculation)\n", + col, + ifelse(is.na(val), "NA", as.character(val)), + ifelse(is.na(val), "NA", as.character(val * -1)))) + } else { + aot_for_calc[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + } + + # Manual calculation check + valid_aot <- aot_for_calc[!is.na(aot_for_calc)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Sum of reversed values: %s\n", paste(valid_aot, collapse = " + "))) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - recode scales VARS_20251001121501.r b/.history/eohi2/dataP - recode scales VARS_20251001121501.r new file mode 100644 index 0000000..2861737 --- /dev/null +++ b/.history/eohi2/dataP - recode scales VARS_20251001121501.r @@ -0,0 +1,298 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values (original in CSV):\n") + aot_original <- numeric(8) + aot_for_calc <- numeric(8) + + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_original[i] <- val + + # Apply reversal for items 4-7 + if (i %in% 4:7) { + aot_for_calc[i] <- val * -1 + cat(sprintf(" %s: %s (reversed to %s for calculation)\n", + col, + ifelse(is.na(val), "NA", as.character(val)), + ifelse(is.na(val), "NA", as.character(val * -1)))) + } else { + aot_for_calc[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + } + + # Manual calculation check + valid_aot <- aot_for_calc[!is.na(aot_for_calc)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Sum of reversed values: %s\n", paste(valid_aot, collapse = " + "))) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001130451.r b/.history/eohi2/dataP - time interval differences_20251001130451.r new file mode 100644 index 0000000..0fc36d3 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001130451.r @@ -0,0 +1,250 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001130503.r b/.history/eohi2/dataP - time interval differences_20251001130503.r new file mode 100644 index 0000000..0fc36d3 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001130503.r @@ -0,0 +1,250 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001130516.r b/.history/eohi2/dataP - time interval differences_20251001130516.r new file mode 100644 index 0000000..0fc36d3 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001130516.r @@ -0,0 +1,250 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001130613.r b/.history/eohi2/dataP - time interval differences_20251001130613.r new file mode 100644 index 0000000..b359aa9 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001130613.r @@ -0,0 +1,268 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001130619.r b/.history/eohi2/dataP - time interval differences_20251001130619.r new file mode 100644 index 0000000..b359aa9 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001130619.r @@ -0,0 +1,268 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001130649.r b/.history/eohi2/dataP - time interval differences_20251001130649.r new file mode 100644 index 0000000..b359aa9 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001130649.r @@ -0,0 +1,268 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131102.r b/.history/eohi2/dataP - time interval differences_20251001131102.r new file mode 100644 index 0000000..6ed17f4 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131102.r @@ -0,0 +1,278 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131108.r b/.history/eohi2/dataP - time interval differences_20251001131108.r new file mode 100644 index 0000000..9a3c70d --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131108.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131115.r b/.history/eohi2/dataP - time interval differences_20251001131115.r new file mode 100644 index 0000000..9a3c70d --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131115.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131121.r b/.history/eohi2/dataP - time interval differences_20251001131121.r new file mode 100644 index 0000000..9a3c70d --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131121.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131239.r b/.history/eohi2/dataP - time interval differences_20251001131239.r new file mode 100644 index 0000000..cc0e2e4 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131239.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row(8) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131304.r b/.history/eohi2/dataP - time interval differences_20251001131304.r new file mode 100644 index 0000000..cc0e2e4 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131304.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row(8) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131331.r b/.history/eohi2/dataP - time interval differences_20251001131331.r new file mode 100644 index 0000000..303801e --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131331.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP - time interval differences_20251001131423.r b/.history/eohi2/dataP - time interval differences_20251001131423.r new file mode 100644 index 0000000..05dd5a6 --- /dev/null +++ b/.history/eohi2/dataP - time interval differences_20251001131423.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001131422.r b/.history/eohi2/dataP 06 - time interval differences_20251001131422.r new file mode 100644 index 0000000..05dd5a6 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001131422.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132410.r b/.history/eohi2/dataP 06 - time interval differences_20251001132410.r new file mode 100644 index 0000000..05dd5a6 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132410.r @@ -0,0 +1,280 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + cat("========================================\n\n") + } + + # Sample one calculation from each type (item 1: pref_read) + test_item_idx <- 1 + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132459.r b/.history/eohi2/dataP 06 - time interval differences_20251001132459.r new file mode 100644 index 0000000..7c6be10 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132459.r @@ -0,0 +1,290 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + cat("Checking sample item: pref_read\n\n") + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132504.r b/.history/eohi2/dataP 06 - time interval differences_20251001132504.r new file mode 100644 index 0000000..cb2b78c --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132504.r @@ -0,0 +1,288 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW ***\n") +cat("For random row, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118), run:\n") +cat(" qa_check_random_row(118)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132511.r b/.history/eohi2/dataP 06 - time interval differences_20251001132511.r new file mode 100644 index 0000000..941dc4b --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132511.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() #leave blank for random row; specify row number for specific row ex (qa_check_random_row(118)) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132516.r b/.history/eohi2/dataP 06 - time interval differences_20251001132516.r new file mode 100644 index 0000000..5954703 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132516.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132521.r b/.history/eohi2/dataP 06 - time interval differences_20251001132521.r new file mode 100644 index 0000000..4e7649e --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132521.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(1:nrow(df), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132530.r b/.history/eohi2/dataP 06 - time interval differences_20251001132530.r new file mode 100644 index 0000000..a4565c2 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132530.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132540.r b/.history/eohi2/dataP 06 - time interval differences_20251001132540.r new file mode 100644 index 0000000..a4565c2 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132540.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132559.r b/.history/eohi2/dataP 06 - time interval differences_20251001132559.r new file mode 100644 index 0000000..a4565c2 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132559.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132623.r b/.history/eohi2/dataP 06 - time interval differences_20251001132623.r new file mode 100644 index 0000000..16b6670 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132623.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 06 - time interval differences_20251001132907.r b/.history/eohi2/dataP 06 - time interval differences_20251001132907.r new file mode 100644 index 0000000..16b6670 --- /dev/null +++ b/.history/eohi2/dataP 06 - time interval differences_20251001132907.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251001152954.r b/.history/eohi2/dataP 07 - domain means_20251001152954.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/dataP 07 - domain means_20251001153004.r b/.history/eohi2/dataP 07 - domain means_20251001153004.r new file mode 100644 index 0000000..979b420 --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251001153004.r @@ -0,0 +1,4 @@ +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") \ No newline at end of file diff --git a/.history/eohi2/dataP 07 - domain means_20251001154326.r b/.history/eohi2/dataP 07 - domain means_20251001154326.r new file mode 100644 index 0000000..5d887a9 --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251001154326.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "5.10past", "5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("5.10past_", items), + paste0("5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251001154444.r b/.history/eohi2/dataP 07 - domain means_20251001154444.r new file mode 100644 index 0000000..5d887a9 --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251001154444.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "5.10past", "5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("5.10past_", items), + paste0("5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251001155057.r b/.history/eohi2/dataP 07 - domain means_20251001155057.r new file mode 100644 index 0000000..5d887a9 --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251001155057.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "5.10past", "5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("5.10past_", items), + paste0("5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251001162547.r b/.history/eohi2/dataP 07 - domain means_20251001162547.r new file mode 100644 index 0000000..7f3c43d --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251001162547.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "5.10past", "5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("5.10past_", items), + paste0("5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251001163148.r b/.history/eohi2/dataP 07 - domain means_20251001163148.r new file mode 100644 index 0000000..7f3c43d --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251001163148.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "5.10past", "5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("5.10past_", items), + paste0("5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193329.r b/.history/eohi2/dataP 07 - domain means_20251008193329.r new file mode 100644 index 0000000..74f4b7d --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193329.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("5.10past_", items), + paste0("5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193335.r b/.history/eohi2/dataP 07 - domain means_20251008193335.r new file mode 100644 index 0000000..d7e861c --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193335.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("5.10past_", domain_names, "_MEAN"), + paste0("5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193341.r b/.history/eohi2/dataP 07 - domain means_20251008193341.r new file mode 100644 index 0000000..e08d460 --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193341.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("X5.10past_", domain_names, "_MEAN"), + paste0("X5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193347.r b/.history/eohi2/dataP 07 - domain means_20251008193347.r new file mode 100644 index 0000000..0cf8049 --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193347.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("X5.10past_", domain_names, "_MEAN"), + paste0("X5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = 5.10past, 6 = 5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193352.r b/.history/eohi2/dataP 07 - domain means_20251008193352.r new file mode 100644 index 0000000..eead82b --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193352.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("X5.10past_", domain_names, "_MEAN"), + paste0("X5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193557.r b/.history/eohi2/dataP 07 - domain means_20251008193557.r new file mode 100644 index 0000000..eead82b --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193557.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("X5.10past_", domain_names, "_MEAN"), + paste0("X5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 07 - domain means_20251008193600.r b/.history/eohi2/dataP 07 - domain means_20251008193600.r new file mode 100644 index 0000000..eead82b --- /dev/null +++ b/.history/eohi2/dataP 07 - domain means_20251008193600.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("X5.10past_", domain_names, "_MEAN"), + paste0("X5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194349.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194349.r new file mode 100644 index 0000000..a9815f3 --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194349.r @@ -0,0 +1,94 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| + +# PAST direction +data$`5_10DGEN_past_pref` <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$`5_10DGEN_past_pers` <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$`5_10DGEN_past_val` <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$`5_10DGEN_fut_pref` <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$`5_10DGEN_fut_pers` <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$`5_10DGEN_fut_val` <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("5_10DGEN_past_pref", "5_10DGEN_past_pers", "5_10DGEN_past_val", + "5_10DGEN_fut_pref", "5_10DGEN_fut_pers", "5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → 5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$`5_10DGEN_past_pref`[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → 5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$`5_10DGEN_fut_pers`[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194411.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194411.r new file mode 100644 index 0000000..a9815f3 --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194411.r @@ -0,0 +1,94 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| + +# PAST direction +data$`5_10DGEN_past_pref` <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$`5_10DGEN_past_pers` <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$`5_10DGEN_past_val` <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$`5_10DGEN_fut_pref` <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$`5_10DGEN_fut_pers` <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$`5_10DGEN_fut_val` <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("5_10DGEN_past_pref", "5_10DGEN_past_pers", "5_10DGEN_past_val", + "5_10DGEN_fut_pref", "5_10DGEN_fut_pers", "5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → 5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$`5_10DGEN_past_pref`[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → 5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$`5_10DGEN_fut_pers`[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194451.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194451.r new file mode 100644 index 0000000..a9815f3 --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006194451.r @@ -0,0 +1,94 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| + +# PAST direction +data$`5_10DGEN_past_pref` <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$`5_10DGEN_past_pers` <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$`5_10DGEN_past_val` <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$`5_10DGEN_fut_pref` <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$`5_10DGEN_fut_pers` <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$`5_10DGEN_fut_val` <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("5_10DGEN_past_pref", "5_10DGEN_past_pers", "5_10DGEN_past_val", + "5_10DGEN_fut_pref", "5_10DGEN_fut_pers", "5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → 5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$`5_10DGEN_past_pref`[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → 5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$`5_10DGEN_fut_pers`[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195055.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195055.r new file mode 100644 index 0000000..ce186a2 --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195055.r @@ -0,0 +1,95 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| +# NOTE: Using X prefix because R adds it to column names starting with numbers + +# PAST direction +data$X5_10DGEN_past_pref <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$X5_10DGEN_past_pers <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$X5_10DGEN_past_val <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$X5_10DGEN_fut_pref <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$X5_10DGEN_fut_pers <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$X5_10DGEN_fut_val <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → 5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$`5_10DGEN_past_pref`[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → 5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$`5_10DGEN_fut_pers`[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195109.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195109.r new file mode 100644 index 0000000..d50239d --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195109.r @@ -0,0 +1,95 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| +# NOTE: Using X prefix because R adds it to column names starting with numbers + +# PAST direction +data$X5_10DGEN_past_pref <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$X5_10DGEN_past_pers <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$X5_10DGEN_past_val <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$X5_10DGEN_fut_pref <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$X5_10DGEN_fut_pers <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$X5_10DGEN_fut_val <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → X5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$X5_10DGEN_past_pref[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → X5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$X5_10DGEN_fut_pers[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195118.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195118.r new file mode 100644 index 0000000..d50239d --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195118.r @@ -0,0 +1,95 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| +# NOTE: Using X prefix because R adds it to column names starting with numbers + +# PAST direction +data$X5_10DGEN_past_pref <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$X5_10DGEN_past_pers <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$X5_10DGEN_past_val <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$X5_10DGEN_fut_pref <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$X5_10DGEN_fut_pers <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$X5_10DGEN_fut_val <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → X5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$X5_10DGEN_past_pref[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → X5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$X5_10DGEN_fut_pers[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195128.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195128.r new file mode 100644 index 0000000..d50239d --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195128.r @@ -0,0 +1,95 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| +# NOTE: Using X prefix because R adds it to column names starting with numbers + +# PAST direction +data$X5_10DGEN_past_pref <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$X5_10DGEN_past_pers <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$X5_10DGEN_past_val <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$X5_10DGEN_fut_pref <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$X5_10DGEN_fut_pers <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$X5_10DGEN_fut_val <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → X5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$X5_10DGEN_past_pref[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → X5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$X5_10DGEN_fut_pers[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195318.r b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195318.r new file mode 100644 index 0000000..d50239d --- /dev/null +++ b/.history/eohi2/dataP 08 - DGEN 510 vars_20251006195318.r @@ -0,0 +1,95 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| +# NOTE: Using X prefix because R adds it to column names starting with numbers + +# PAST direction +data$X5_10DGEN_past_pref <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$X5_10DGEN_past_pers <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$X5_10DGEN_past_val <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$X5_10DGEN_fut_pref <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$X5_10DGEN_fut_pers <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$X5_10DGEN_fut_val <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → X5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$X5_10DGEN_past_pref[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → X5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$X5_10DGEN_fut_pers[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/.history/eohi2/dataP 09 - interval x direction means_20251008113501.r b/.history/eohi2/dataP 09 - interval x direction means_20251008113501.r new file mode 100644 index 0000000..6bd02b7 --- /dev/null +++ b/.history/eohi2/dataP 09 - interval x direction means_20251008113501.r @@ -0,0 +1,223 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: NPast_5_mean (15 variables) +data$NPast_5_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" +)], na.rm = TRUE) + +# Set 2: NPast_10_mean (15 variables) +data$NPast_10_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 3: NFut_5_mean (15 variables) +data$NFut_5_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 4: NFut_10_mean (15 variables) +data$NFut_10_mean <- rowMeans(data[, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 5: X5.10past_mean (15 variables) +data$X5.10past_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" +)], na.rm = TRUE) + +# Set 6: X5.10fut_mean (15 variables) +data$X5.10fut_mean <- rowMeans(data[, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 7: NPast_global_mean (30 variables - NPast_5 + NPast_10) +data$NPast_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 8: NFut_global_mean (30 variables - NFut_5 + NFut_10) +data$NFut_global_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 9: X5.10_global_mean (30 variables - X5.10past + X5.10fut) +data$X5.10_global_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 10: N5_global_mean (30 variables - NPast_5 + NFut_5) +data$N5_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 11: N10_global_mean (30 variables - NPast_10 + NFut_10) +data$N10_global_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: NPast_5_mean + calc1 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" + )]), na.rm = TRUE) + cat("NPast_5_mean: Calculated =", calc1, "| Stored =", data$NPast_5_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$NPast_5_mean[i])), "\n") + + # Set 2: NPast_10_mean + calc2 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_10_mean: Calculated =", calc2, "| Stored =", data$NPast_10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$NPast_10_mean[i])), "\n") + + # Set 3: NFut_5_mean + calc3 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("NFut_5_mean: Calculated =", calc3, "| Stored =", data$NFut_5_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$NFut_5_mean[i])), "\n") + + # Set 4: NFut_10_mean + calc4 <- mean(as.numeric(data[i, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_10_mean: Calculated =", calc4, "| Stored =", data$NFut_10_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$NFut_10_mean[i])), "\n") + + # Set 5: X5.10past_mean + calc5 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" + )]), na.rm = TRUE) + cat("X5.10past_mean: Calculated =", calc5, "| Stored =", data$X5.10past_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$X5.10past_mean[i])), "\n") + + # Set 6: X5.10fut_mean + calc6 <- mean(as.numeric(data[i, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10fut_mean: Calculated =", calc6, "| Stored =", data$X5.10fut_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$X5.10fut_mean[i])), "\n") + + # Set 7: NPast_global_mean + calc7 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_global_mean: Calculated =", calc7, "| Stored =", data$NPast_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$NPast_global_mean[i])), "\n") + + # Set 8: NFut_global_mean + calc8 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_global_mean: Calculated =", calc8, "| Stored =", data$NFut_global_mean[i], + "| Match:", isTRUE(all.equal(calc8, data$NFut_global_mean[i])), "\n") + + # Set 9: X5.10_global_mean + calc9 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10_global_mean: Calculated =", calc9, "| Stored =", data$X5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc9, data$X5.10_global_mean[i])), "\n") + + # Set 10: N5_global_mean + calc10 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("N5_global_mean: Calculated =", calc10, "| Stored =", data$N5_global_mean[i], + "| Match:", isTRUE(all.equal(calc10, data$N5_global_mean[i])), "\n") + + # Set 11: N10_global_mean + calc11 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("N10_global_mean: Calculated =", calc11, "| Stored =", data$N10_global_mean[i], + "| Match:", isTRUE(all.equal(calc11, data$N10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/.history/eohi2/dataP 09 - interval x direction means_20251008113518.r b/.history/eohi2/dataP 09 - interval x direction means_20251008113518.r new file mode 100644 index 0000000..6bd02b7 --- /dev/null +++ b/.history/eohi2/dataP 09 - interval x direction means_20251008113518.r @@ -0,0 +1,223 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: NPast_5_mean (15 variables) +data$NPast_5_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" +)], na.rm = TRUE) + +# Set 2: NPast_10_mean (15 variables) +data$NPast_10_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 3: NFut_5_mean (15 variables) +data$NFut_5_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 4: NFut_10_mean (15 variables) +data$NFut_10_mean <- rowMeans(data[, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 5: X5.10past_mean (15 variables) +data$X5.10past_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" +)], na.rm = TRUE) + +# Set 6: X5.10fut_mean (15 variables) +data$X5.10fut_mean <- rowMeans(data[, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 7: NPast_global_mean (30 variables - NPast_5 + NPast_10) +data$NPast_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 8: NFut_global_mean (30 variables - NFut_5 + NFut_10) +data$NFut_global_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 9: X5.10_global_mean (30 variables - X5.10past + X5.10fut) +data$X5.10_global_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 10: N5_global_mean (30 variables - NPast_5 + NFut_5) +data$N5_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 11: N10_global_mean (30 variables - NPast_10 + NFut_10) +data$N10_global_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: NPast_5_mean + calc1 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" + )]), na.rm = TRUE) + cat("NPast_5_mean: Calculated =", calc1, "| Stored =", data$NPast_5_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$NPast_5_mean[i])), "\n") + + # Set 2: NPast_10_mean + calc2 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_10_mean: Calculated =", calc2, "| Stored =", data$NPast_10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$NPast_10_mean[i])), "\n") + + # Set 3: NFut_5_mean + calc3 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("NFut_5_mean: Calculated =", calc3, "| Stored =", data$NFut_5_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$NFut_5_mean[i])), "\n") + + # Set 4: NFut_10_mean + calc4 <- mean(as.numeric(data[i, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_10_mean: Calculated =", calc4, "| Stored =", data$NFut_10_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$NFut_10_mean[i])), "\n") + + # Set 5: X5.10past_mean + calc5 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" + )]), na.rm = TRUE) + cat("X5.10past_mean: Calculated =", calc5, "| Stored =", data$X5.10past_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$X5.10past_mean[i])), "\n") + + # Set 6: X5.10fut_mean + calc6 <- mean(as.numeric(data[i, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10fut_mean: Calculated =", calc6, "| Stored =", data$X5.10fut_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$X5.10fut_mean[i])), "\n") + + # Set 7: NPast_global_mean + calc7 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_global_mean: Calculated =", calc7, "| Stored =", data$NPast_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$NPast_global_mean[i])), "\n") + + # Set 8: NFut_global_mean + calc8 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_global_mean: Calculated =", calc8, "| Stored =", data$NFut_global_mean[i], + "| Match:", isTRUE(all.equal(calc8, data$NFut_global_mean[i])), "\n") + + # Set 9: X5.10_global_mean + calc9 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10_global_mean: Calculated =", calc9, "| Stored =", data$X5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc9, data$X5.10_global_mean[i])), "\n") + + # Set 10: N5_global_mean + calc10 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("N5_global_mean: Calculated =", calc10, "| Stored =", data$N5_global_mean[i], + "| Match:", isTRUE(all.equal(calc10, data$N5_global_mean[i])), "\n") + + # Set 11: N10_global_mean + calc11 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("N10_global_mean: Calculated =", calc11, "| Stored =", data$N10_global_mean[i], + "| Match:", isTRUE(all.equal(calc11, data$N10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/.history/eohi2/dataP 09 - interval x direction means_20251008113613.r b/.history/eohi2/dataP 09 - interval x direction means_20251008113613.r new file mode 100644 index 0000000..6bd02b7 --- /dev/null +++ b/.history/eohi2/dataP 09 - interval x direction means_20251008113613.r @@ -0,0 +1,223 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: NPast_5_mean (15 variables) +data$NPast_5_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" +)], na.rm = TRUE) + +# Set 2: NPast_10_mean (15 variables) +data$NPast_10_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 3: NFut_5_mean (15 variables) +data$NFut_5_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 4: NFut_10_mean (15 variables) +data$NFut_10_mean <- rowMeans(data[, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 5: X5.10past_mean (15 variables) +data$X5.10past_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" +)], na.rm = TRUE) + +# Set 6: X5.10fut_mean (15 variables) +data$X5.10fut_mean <- rowMeans(data[, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 7: NPast_global_mean (30 variables - NPast_5 + NPast_10) +data$NPast_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 8: NFut_global_mean (30 variables - NFut_5 + NFut_10) +data$NFut_global_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 9: X5.10_global_mean (30 variables - X5.10past + X5.10fut) +data$X5.10_global_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 10: N5_global_mean (30 variables - NPast_5 + NFut_5) +data$N5_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 11: N10_global_mean (30 variables - NPast_10 + NFut_10) +data$N10_global_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: NPast_5_mean + calc1 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" + )]), na.rm = TRUE) + cat("NPast_5_mean: Calculated =", calc1, "| Stored =", data$NPast_5_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$NPast_5_mean[i])), "\n") + + # Set 2: NPast_10_mean + calc2 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_10_mean: Calculated =", calc2, "| Stored =", data$NPast_10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$NPast_10_mean[i])), "\n") + + # Set 3: NFut_5_mean + calc3 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("NFut_5_mean: Calculated =", calc3, "| Stored =", data$NFut_5_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$NFut_5_mean[i])), "\n") + + # Set 4: NFut_10_mean + calc4 <- mean(as.numeric(data[i, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_10_mean: Calculated =", calc4, "| Stored =", data$NFut_10_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$NFut_10_mean[i])), "\n") + + # Set 5: X5.10past_mean + calc5 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" + )]), na.rm = TRUE) + cat("X5.10past_mean: Calculated =", calc5, "| Stored =", data$X5.10past_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$X5.10past_mean[i])), "\n") + + # Set 6: X5.10fut_mean + calc6 <- mean(as.numeric(data[i, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10fut_mean: Calculated =", calc6, "| Stored =", data$X5.10fut_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$X5.10fut_mean[i])), "\n") + + # Set 7: NPast_global_mean + calc7 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_global_mean: Calculated =", calc7, "| Stored =", data$NPast_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$NPast_global_mean[i])), "\n") + + # Set 8: NFut_global_mean + calc8 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_global_mean: Calculated =", calc8, "| Stored =", data$NFut_global_mean[i], + "| Match:", isTRUE(all.equal(calc8, data$NFut_global_mean[i])), "\n") + + # Set 9: X5.10_global_mean + calc9 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10_global_mean: Calculated =", calc9, "| Stored =", data$X5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc9, data$X5.10_global_mean[i])), "\n") + + # Set 10: N5_global_mean + calc10 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("N5_global_mean: Calculated =", calc10, "| Stored =", data$N5_global_mean[i], + "| Match:", isTRUE(all.equal(calc10, data$N5_global_mean[i])), "\n") + + # Set 11: N10_global_mean + calc11 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("N10_global_mean: Calculated =", calc11, "| Stored =", data$N10_global_mean[i], + "| Match:", isTRUE(all.equal(calc11, data$N10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/.history/eohi2/dataP 10 - DGEN mean vars_20251008121818.r b/.history/eohi2/dataP 10 - DGEN mean vars_20251008121818.r new file mode 100644 index 0000000..2e5647b --- /dev/null +++ b/.history/eohi2/dataP 10 - DGEN mean vars_20251008121818.r @@ -0,0 +1,115 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: DGEN_past_5.10_mean (3 variables) +data$DGEN_past_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 2: DGEN_fut_5.10_mean (3 variables) +data$DGEN_fut_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 3: DGENpast_global_mean (9 variables) +data$DGENpast_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 4: DGENfut_global_mean (9 variables) +data$DGENfut_global_mean <- rowMeans(data[, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 5: DGEN_5_global_mean (6 variables) +data$DGEN_5_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" +)], na.rm = TRUE) + +# Set 6: DGEN_10_global_mean (6 variables) +data$DGEN_10_global_mean <- rowMeans(data[, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +)], na.rm = TRUE) + +# Set 7: DGEN_5.10_global_mean (6 variables) +data$DGEN_5.10_global_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: DGEN_past_5.10_mean + calc1 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGEN_past_5.10_mean: Calculated =", calc1, "| Stored =", data$DGEN_past_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$DGEN_past_5.10_mean[i])), "\n") + + # Set 2: DGEN_fut_5.10_mean + calc2 <- mean(as.numeric(data[i, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_fut_5.10_mean: Calculated =", calc2, "| Stored =", data$DGEN_fut_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$DGEN_fut_5.10_mean[i])), "\n") + + # Set 3: DGENpast_global_mean + calc3 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGENpast_global_mean: Calculated =", calc3, "| Stored =", data$DGENpast_global_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$DGENpast_global_mean[i])), "\n") + + # Set 4: DGENfut_global_mean + calc4 <- mean(as.numeric(data[i, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGENfut_global_mean: Calculated =", calc4, "| Stored =", data$DGENfut_global_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$DGENfut_global_mean[i])), "\n") + + # Set 5: DGEN_5_global_mean + calc5 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" + )]), na.rm = TRUE) + cat("DGEN_5_global_mean: Calculated =", calc5, "| Stored =", data$DGEN_5_global_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$DGEN_5_global_mean[i])), "\n") + + # Set 6: DGEN_10_global_mean + calc6 <- mean(as.numeric(data[i, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" + )]), na.rm = TRUE) + cat("DGEN_10_global_mean: Calculated =", calc6, "| Stored =", data$DGEN_10_global_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$DGEN_10_global_mean[i])), "\n") + + # Set 7: DGEN_5.10_global_mean + calc7 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_5.10_global_mean: Calculated =", calc7, "| Stored =", data$DGEN_5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$DGEN_5.10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/.history/eohi2/dataP 10 - DGEN mean vars_20251008121822.r b/.history/eohi2/dataP 10 - DGEN mean vars_20251008121822.r new file mode 100644 index 0000000..2e5647b --- /dev/null +++ b/.history/eohi2/dataP 10 - DGEN mean vars_20251008121822.r @@ -0,0 +1,115 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: DGEN_past_5.10_mean (3 variables) +data$DGEN_past_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 2: DGEN_fut_5.10_mean (3 variables) +data$DGEN_fut_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 3: DGENpast_global_mean (9 variables) +data$DGENpast_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 4: DGENfut_global_mean (9 variables) +data$DGENfut_global_mean <- rowMeans(data[, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 5: DGEN_5_global_mean (6 variables) +data$DGEN_5_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" +)], na.rm = TRUE) + +# Set 6: DGEN_10_global_mean (6 variables) +data$DGEN_10_global_mean <- rowMeans(data[, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +)], na.rm = TRUE) + +# Set 7: DGEN_5.10_global_mean (6 variables) +data$DGEN_5.10_global_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: DGEN_past_5.10_mean + calc1 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGEN_past_5.10_mean: Calculated =", calc1, "| Stored =", data$DGEN_past_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$DGEN_past_5.10_mean[i])), "\n") + + # Set 2: DGEN_fut_5.10_mean + calc2 <- mean(as.numeric(data[i, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_fut_5.10_mean: Calculated =", calc2, "| Stored =", data$DGEN_fut_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$DGEN_fut_5.10_mean[i])), "\n") + + # Set 3: DGENpast_global_mean + calc3 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGENpast_global_mean: Calculated =", calc3, "| Stored =", data$DGENpast_global_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$DGENpast_global_mean[i])), "\n") + + # Set 4: DGENfut_global_mean + calc4 <- mean(as.numeric(data[i, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGENfut_global_mean: Calculated =", calc4, "| Stored =", data$DGENfut_global_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$DGENfut_global_mean[i])), "\n") + + # Set 5: DGEN_5_global_mean + calc5 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" + )]), na.rm = TRUE) + cat("DGEN_5_global_mean: Calculated =", calc5, "| Stored =", data$DGEN_5_global_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$DGEN_5_global_mean[i])), "\n") + + # Set 6: DGEN_10_global_mean + calc6 <- mean(as.numeric(data[i, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" + )]), na.rm = TRUE) + cat("DGEN_10_global_mean: Calculated =", calc6, "| Stored =", data$DGEN_10_global_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$DGEN_10_global_mean[i])), "\n") + + # Set 7: DGEN_5.10_global_mean + calc7 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_5.10_global_mean: Calculated =", calc7, "| Stored =", data$DGEN_5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$DGEN_5.10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/.history/eohi2/dataP 10 - DGEN mean vars_20251008121849.r b/.history/eohi2/dataP 10 - DGEN mean vars_20251008121849.r new file mode 100644 index 0000000..2e5647b --- /dev/null +++ b/.history/eohi2/dataP 10 - DGEN mean vars_20251008121849.r @@ -0,0 +1,115 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: DGEN_past_5.10_mean (3 variables) +data$DGEN_past_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 2: DGEN_fut_5.10_mean (3 variables) +data$DGEN_fut_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 3: DGENpast_global_mean (9 variables) +data$DGENpast_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 4: DGENfut_global_mean (9 variables) +data$DGENfut_global_mean <- rowMeans(data[, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 5: DGEN_5_global_mean (6 variables) +data$DGEN_5_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" +)], na.rm = TRUE) + +# Set 6: DGEN_10_global_mean (6 variables) +data$DGEN_10_global_mean <- rowMeans(data[, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +)], na.rm = TRUE) + +# Set 7: DGEN_5.10_global_mean (6 variables) +data$DGEN_5.10_global_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: DGEN_past_5.10_mean + calc1 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGEN_past_5.10_mean: Calculated =", calc1, "| Stored =", data$DGEN_past_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$DGEN_past_5.10_mean[i])), "\n") + + # Set 2: DGEN_fut_5.10_mean + calc2 <- mean(as.numeric(data[i, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_fut_5.10_mean: Calculated =", calc2, "| Stored =", data$DGEN_fut_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$DGEN_fut_5.10_mean[i])), "\n") + + # Set 3: DGENpast_global_mean + calc3 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGENpast_global_mean: Calculated =", calc3, "| Stored =", data$DGENpast_global_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$DGENpast_global_mean[i])), "\n") + + # Set 4: DGENfut_global_mean + calc4 <- mean(as.numeric(data[i, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGENfut_global_mean: Calculated =", calc4, "| Stored =", data$DGENfut_global_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$DGENfut_global_mean[i])), "\n") + + # Set 5: DGEN_5_global_mean + calc5 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" + )]), na.rm = TRUE) + cat("DGEN_5_global_mean: Calculated =", calc5, "| Stored =", data$DGEN_5_global_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$DGEN_5_global_mean[i])), "\n") + + # Set 6: DGEN_10_global_mean + calc6 <- mean(as.numeric(data[i, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" + )]), na.rm = TRUE) + cat("DGEN_10_global_mean: Calculated =", calc6, "| Stored =", data$DGEN_10_global_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$DGEN_10_global_mean[i])), "\n") + + # Set 7: DGEN_5.10_global_mean + calc7 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_5.10_global_mean: Calculated =", calc7, "| Stored =", data$DGEN_5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$DGEN_5.10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008152253.r b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008152253.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163033.r b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163033.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163045.r b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163045.r new file mode 100644 index 0000000..4e6df17 --- /dev/null +++ b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163045.r @@ -0,0 +1,5 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") \ No newline at end of file diff --git a/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163815.r b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163815.r new file mode 100644 index 0000000..96e4994 --- /dev/null +++ b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163815.r @@ -0,0 +1,235 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create EHI difference variables (NPast - NFut) for different time intervals + +# === 5-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi5_pref_read <- data$NPast_5_pref_read - data$NFut_5_pref_read +data$ehi5_pref_music <- data$NPast_5_pref_music - data$NFut_5_pref_music +data$ehi5_pref_TV <- data$NPast_5_pref_TV - data$NFut_5_pref_TV +data$ehi5_pref_nap <- data$NPast_5_pref_nap - data$NFut_5_pref_nap +data$ehi5_pref_travel <- data$NPast_5_pref_travel - data$NFut_5_pref_travel + +# Personality +data$ehi5_pers_extravert <- data$NPast_5_pers_extravert - data$NFut_5_pers_extravert +data$ehi5_pers_critical <- data$NPast_5_pers_critical - data$NFut_5_pers_critical +data$ehi5_pers_dependable <- data$NPast_5_pers_dependable - data$NFut_5_pers_dependable +data$ehi5_pers_anxious <- data$NPast_5_pers_anxious - data$NFut_5_pers_anxious +data$ehi5_pers_complex <- data$NPast_5_pers_complex - data$NFut_5_pers_complex + +# Values +data$ehi5_val_obey <- data$NPast_5_val_obey - data$NFut_5_val_obey +data$ehi5_val_trad <- data$NPast_5_val_trad - data$NFut_5_val_trad +data$ehi5_val_opinion <- data$NPast_5_val_opinion - data$NFut_5_val_opinion +data$ehi5_val_performance <- data$NPast_5_val_performance - data$NFut_5_val_performance +data$ehi5_val_justice <- data$NPast_5_val_justice - data$NFut_5_val_justice + +# === 10-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi10_pref_read <- data$NPast_10_pref_read - data$NFut_10_pref_read +data$ehi10_pref_music <- data$NPast_10_pref_music - data$NFut_10_pref_music +data$ehi10_pref_TV <- data$NPast_10_pref_TV - data$NFut_10_pref_TV +data$ehi10_pref_nap <- data$NPast_10_pref_nap - data$NFut_10_pref_nap +data$ehi10_pref_travel <- data$NPast_10_pref_travel - data$NFut_10_pref_travel + +# Personality +data$ehi10_pers_extravert <- data$NPast_10_pers_extravert - data$NFut_10_pers_extravert +data$ehi10_pers_critical <- data$NPast_10_pers_critical - data$NFut_10_pers_critical +data$ehi10_pers_dependable <- data$NPast_10_pers_dependable - data$NFut_10_pers_dependable +data$ehi10_pers_anxious <- data$NPast_10_pers_anxious - data$NFut_10_pers_anxious +data$ehi10_pers_complex <- data$NPast_10_pers_complex - data$NFut_10_pers_complex + +# Values +data$ehi10_val_obey <- data$NPast_10_val_obey - data$NFut_10_val_obey +data$ehi10_val_trad <- data$NPast_10_val_trad - data$NFut_10_val_trad +data$ehi10_val_opinion <- data$NPast_10_val_opinion - data$NFut_10_val_opinion +data$ehi10_val_performance <- data$NPast_10_val_performance - data$NFut_10_val_performance +data$ehi10_val_justice <- data$NPast_10_val_justice - data$NFut_10_val_justice + +# === 5-10 YEAR CHANGE VARIABLES === +# Preferences +data$ehi5.10_pref_read <- data$X5.10past_pref_read - data$X5.10fut_pref_read +data$ehi5.10_pref_music <- data$X5.10past_pref_music - data$X5.10fut_pref_music +data$ehi5.10_pref_TV <- data$X5.10past_pref_TV - data$X5.10fut_pref_TV +data$ehi5.10_pref_nap <- data$X5.10past_pref_nap - data$X5.10fut_pref_nap +data$ehi5.10_pref_travel <- data$X5.10past_pref_travel - data$X5.10fut_pref_travel + +# Personality +data$ehi5.10_pers_extravert <- data$X5.10past_pers_extravert - data$X5.10fut_pers_extravert +data$ehi5.10_pers_critical <- data$X5.10past_pers_critical - data$X5.10fut_pers_critical +data$ehi5.10_pers_dependable <- data$X5.10past_pers_dependable - data$X5.10fut_pers_dependable +data$ehi5.10_pers_anxious <- data$X5.10past_pers_anxious - data$X5.10fut_pers_anxious +data$ehi5.10_pers_complex <- data$X5.10past_pers_complex - data$X5.10fut_pers_complex + +# Values +data$ehi5.10_val_obey <- data$X5.10past_val_obey - data$X5.10fut_val_obey +data$ehi5.10_val_trad <- data$X5.10past_val_trad - data$X5.10fut_val_trad +data$ehi5.10_val_opinion <- data$X5.10past_val_opinion - data$X5.10fut_val_opinion +data$ehi5.10_val_performance <- data$X5.10past_val_performance - data$X5.10fut_val_performance +data$ehi5.10_val_justice <- data$X5.10past_val_justice - data$X5.10fut_val_justice + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5_pref_read = %g %s\n", + data$NPast_5_pref_read[i], data$NFut_5_pref_read[i], + data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i], + data$ehi5_pref_read[i], + ifelse(abs((data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i]) - data$ehi5_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5_pref_music = %g %s\n", + data$NPast_5_pref_music[i], data$NFut_5_pref_music[i], + data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i], + data$ehi5_pref_music[i], + ifelse(abs((data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i]) - data$ehi5_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5_pers_extravert = %g %s\n", + data$NPast_5_pers_extravert[i], data$NFut_5_pers_extravert[i], + data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i], + data$ehi5_pers_extravert[i], + ifelse(abs((data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i]) - data$ehi5_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi10_pref_read = %g %s\n", + data$NPast_10_pref_read[i], data$NFut_10_pref_read[i], + data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i], + data$ehi10_pref_read[i], + ifelse(abs((data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i]) - data$ehi10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi10_pref_music = %g %s\n", + data$NPast_10_pref_music[i], data$NFut_10_pref_music[i], + data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i], + data$ehi10_pref_music[i], + ifelse(abs((data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i]) - data$ehi10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi10_pers_extravert = %g %s\n", + data$NPast_10_pers_extravert[i], data$NFut_10_pers_extravert[i], + data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i], + data$ehi10_pers_extravert[i], + ifelse(abs((data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i]) - data$ehi10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 5-10 YEAR CHANGE VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5.10_pref_read = %g %s\n", + data$X5.10past_pref_read[i], data$X5.10fut_pref_read[i], + data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i], + data$ehi5.10_pref_read[i], + ifelse(abs((data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i]) - data$ehi5.10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5.10_pref_music = %g %s\n", + data$X5.10past_pref_music[i], data$X5.10fut_pref_music[i], + data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i], + data$ehi5.10_pref_music[i], + ifelse(abs((data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i]) - data$ehi5.10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5.10_pers_extravert = %g %s\n", + data$X5.10past_pers_extravert[i], data$X5.10fut_pers_extravert[i], + data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i], + data$ehi5.10_pers_extravert[i], + ifelse(abs((data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i]) - data$ehi5.10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year pairs + list(npast = "NPast_5_pref_read", nfut = "NFut_5_pref_read", target = "ehi5_pref_read"), + list(npast = "NPast_5_pref_music", nfut = "NFut_5_pref_music", target = "ehi5_pref_music"), + list(npast = "NPast_5_pref_TV", nfut = "NFut_5_pref_TV", target = "ehi5_pref_TV"), + list(npast = "NPast_5_pref_nap", nfut = "NFut_5_pref_nap", target = "ehi5_pref_nap"), + list(npast = "NPast_5_pref_travel", nfut = "NFut_5_pref_travel", target = "ehi5_pref_travel"), + list(npast = "NPast_5_pers_extravert", nfut = "NFut_5_pers_extravert", target = "ehi5_pers_extravert"), + list(npast = "NPast_5_pers_critical", nfut = "NFut_5_pers_critical", target = "ehi5_pers_critical"), + list(npast = "NPast_5_pers_dependable", nfut = "NFut_5_pers_dependable", target = "ehi5_pers_dependable"), + list(npast = "NPast_5_pers_anxious", nfut = "NFut_5_pers_anxious", target = "ehi5_pers_anxious"), + list(npast = "NPast_5_pers_complex", nfut = "NFut_5_pers_complex", target = "ehi5_pers_complex"), + list(npast = "NPast_5_val_obey", nfut = "NFut_5_val_obey", target = "ehi5_val_obey"), + list(npast = "NPast_5_val_trad", nfut = "NFut_5_val_trad", target = "ehi5_val_trad"), + list(npast = "NPast_5_val_opinion", nfut = "NFut_5_val_opinion", target = "ehi5_val_opinion"), + list(npast = "NPast_5_val_performance", nfut = "NFut_5_val_performance", target = "ehi5_val_performance"), + list(npast = "NPast_5_val_justice", nfut = "NFut_5_val_justice", target = "ehi5_val_justice"), + + # 10-year pairs + list(npast = "NPast_10_pref_read", nfut = "NFut_10_pref_read", target = "ehi10_pref_read"), + list(npast = "NPast_10_pref_music", nfut = "NFut_10_pref_music", target = "ehi10_pref_music"), + list(npast = "NPast_10_pref_TV", nfut = "NFut_10_pref_TV", target = "ehi10_pref_TV"), + list(npast = "NPast_10_pref_nap", nfut = "NFut_10_pref_nap", target = "ehi10_pref_nap"), + list(npast = "NPast_10_pref_travel", nfut = "NFut_10_pref_travel", target = "ehi10_pref_travel"), + list(npast = "NPast_10_pers_extravert", nfut = "NFut_10_pers_extravert", target = "ehi10_pers_extravert"), + list(npast = "NPast_10_pers_critical", nfut = "NFut_10_pers_critical", target = "ehi10_pers_critical"), + list(npast = "NPast_10_pers_dependable", nfut = "NFut_10_pers_dependable", target = "ehi10_pers_dependable"), + list(npast = "NPast_10_pers_anxious", nfut = "NFut_10_pers_anxious", target = "ehi10_pers_anxious"), + list(npast = "NPast_10_pers_complex", nfut = "NFut_10_pers_complex", target = "ehi10_pers_complex"), + list(npast = "NPast_10_val_obey", nfut = "NFut_10_val_obey", target = "ehi10_val_obey"), + list(npast = "NPast_10_val_trad", nfut = "NFut_10_val_trad", target = "ehi10_val_trad"), + list(npast = "NPast_10_val_opinion", nfut = "NFut_10_val_opinion", target = "ehi10_val_opinion"), + list(npast = "NPast_10_val_performance", nfut = "NFut_10_val_performance", target = "ehi10_val_performance"), + list(npast = "NPast_10_val_justice", nfut = "NFut_10_val_justice", target = "ehi10_val_justice"), + + # 5-10 year change pairs + list(npast = "X5.10past_pref_read", nfut = "X5.10fut_pref_read", target = "ehi5.10_pref_read"), + list(npast = "X5.10past_pref_music", nfut = "X5.10fut_pref_music", target = "ehi5.10_pref_music"), + list(npast = "X5.10past_pref_TV", nfut = "X5.10fut_pref_TV", target = "ehi5.10_pref_TV"), + list(npast = "X5.10past_pref_nap", nfut = "X5.10fut_pref_nap", target = "ehi5.10_pref_nap"), + list(npast = "X5.10past_pref_travel", nfut = "X5.10fut_pref_travel", target = "ehi5.10_pref_travel"), + list(npast = "X5.10past_pers_extravert", nfut = "X5.10fut_pers_extravert", target = "ehi5.10_pers_extravert"), + list(npast = "X5.10past_pers_critical", nfut = "X5.10fut_pers_critical", target = "ehi5.10_pers_critical"), + list(npast = "X5.10past_pers_dependable", nfut = "X5.10fut_pers_dependable", target = "ehi5.10_pers_dependable"), + list(npast = "X5.10past_pers_anxious", nfut = "X5.10fut_pers_anxious", target = "ehi5.10_pers_anxious"), + list(npast = "X5.10past_pers_complex", nfut = "X5.10fut_pers_complex", target = "ehi5.10_pers_complex"), + list(npast = "X5.10past_val_obey", nfut = "X5.10fut_val_obey", target = "ehi5.10_val_obey"), + list(npast = "X5.10past_val_trad", nfut = "X5.10fut_val_trad", target = "ehi5.10_val_trad"), + list(npast = "X5.10past_val_opinion", nfut = "X5.10fut_val_opinion", target = "ehi5.10_val_opinion"), + list(npast = "X5.10past_val_performance", nfut = "X5.10fut_val_performance", target = "ehi5.10_val_performance"), + list(npast = "X5.10past_val_justice", nfut = "X5.10fut_val_justice", target = "ehi5.10_val_justice") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163817.r b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163817.r new file mode 100644 index 0000000..96e4994 --- /dev/null +++ b/.history/eohi2/dataP 11 - CORRECT ehi vars_20251008163817.r @@ -0,0 +1,235 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create EHI difference variables (NPast - NFut) for different time intervals + +# === 5-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi5_pref_read <- data$NPast_5_pref_read - data$NFut_5_pref_read +data$ehi5_pref_music <- data$NPast_5_pref_music - data$NFut_5_pref_music +data$ehi5_pref_TV <- data$NPast_5_pref_TV - data$NFut_5_pref_TV +data$ehi5_pref_nap <- data$NPast_5_pref_nap - data$NFut_5_pref_nap +data$ehi5_pref_travel <- data$NPast_5_pref_travel - data$NFut_5_pref_travel + +# Personality +data$ehi5_pers_extravert <- data$NPast_5_pers_extravert - data$NFut_5_pers_extravert +data$ehi5_pers_critical <- data$NPast_5_pers_critical - data$NFut_5_pers_critical +data$ehi5_pers_dependable <- data$NPast_5_pers_dependable - data$NFut_5_pers_dependable +data$ehi5_pers_anxious <- data$NPast_5_pers_anxious - data$NFut_5_pers_anxious +data$ehi5_pers_complex <- data$NPast_5_pers_complex - data$NFut_5_pers_complex + +# Values +data$ehi5_val_obey <- data$NPast_5_val_obey - data$NFut_5_val_obey +data$ehi5_val_trad <- data$NPast_5_val_trad - data$NFut_5_val_trad +data$ehi5_val_opinion <- data$NPast_5_val_opinion - data$NFut_5_val_opinion +data$ehi5_val_performance <- data$NPast_5_val_performance - data$NFut_5_val_performance +data$ehi5_val_justice <- data$NPast_5_val_justice - data$NFut_5_val_justice + +# === 10-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi10_pref_read <- data$NPast_10_pref_read - data$NFut_10_pref_read +data$ehi10_pref_music <- data$NPast_10_pref_music - data$NFut_10_pref_music +data$ehi10_pref_TV <- data$NPast_10_pref_TV - data$NFut_10_pref_TV +data$ehi10_pref_nap <- data$NPast_10_pref_nap - data$NFut_10_pref_nap +data$ehi10_pref_travel <- data$NPast_10_pref_travel - data$NFut_10_pref_travel + +# Personality +data$ehi10_pers_extravert <- data$NPast_10_pers_extravert - data$NFut_10_pers_extravert +data$ehi10_pers_critical <- data$NPast_10_pers_critical - data$NFut_10_pers_critical +data$ehi10_pers_dependable <- data$NPast_10_pers_dependable - data$NFut_10_pers_dependable +data$ehi10_pers_anxious <- data$NPast_10_pers_anxious - data$NFut_10_pers_anxious +data$ehi10_pers_complex <- data$NPast_10_pers_complex - data$NFut_10_pers_complex + +# Values +data$ehi10_val_obey <- data$NPast_10_val_obey - data$NFut_10_val_obey +data$ehi10_val_trad <- data$NPast_10_val_trad - data$NFut_10_val_trad +data$ehi10_val_opinion <- data$NPast_10_val_opinion - data$NFut_10_val_opinion +data$ehi10_val_performance <- data$NPast_10_val_performance - data$NFut_10_val_performance +data$ehi10_val_justice <- data$NPast_10_val_justice - data$NFut_10_val_justice + +# === 5-10 YEAR CHANGE VARIABLES === +# Preferences +data$ehi5.10_pref_read <- data$X5.10past_pref_read - data$X5.10fut_pref_read +data$ehi5.10_pref_music <- data$X5.10past_pref_music - data$X5.10fut_pref_music +data$ehi5.10_pref_TV <- data$X5.10past_pref_TV - data$X5.10fut_pref_TV +data$ehi5.10_pref_nap <- data$X5.10past_pref_nap - data$X5.10fut_pref_nap +data$ehi5.10_pref_travel <- data$X5.10past_pref_travel - data$X5.10fut_pref_travel + +# Personality +data$ehi5.10_pers_extravert <- data$X5.10past_pers_extravert - data$X5.10fut_pers_extravert +data$ehi5.10_pers_critical <- data$X5.10past_pers_critical - data$X5.10fut_pers_critical +data$ehi5.10_pers_dependable <- data$X5.10past_pers_dependable - data$X5.10fut_pers_dependable +data$ehi5.10_pers_anxious <- data$X5.10past_pers_anxious - data$X5.10fut_pers_anxious +data$ehi5.10_pers_complex <- data$X5.10past_pers_complex - data$X5.10fut_pers_complex + +# Values +data$ehi5.10_val_obey <- data$X5.10past_val_obey - data$X5.10fut_val_obey +data$ehi5.10_val_trad <- data$X5.10past_val_trad - data$X5.10fut_val_trad +data$ehi5.10_val_opinion <- data$X5.10past_val_opinion - data$X5.10fut_val_opinion +data$ehi5.10_val_performance <- data$X5.10past_val_performance - data$X5.10fut_val_performance +data$ehi5.10_val_justice <- data$X5.10past_val_justice - data$X5.10fut_val_justice + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5_pref_read = %g %s\n", + data$NPast_5_pref_read[i], data$NFut_5_pref_read[i], + data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i], + data$ehi5_pref_read[i], + ifelse(abs((data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i]) - data$ehi5_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5_pref_music = %g %s\n", + data$NPast_5_pref_music[i], data$NFut_5_pref_music[i], + data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i], + data$ehi5_pref_music[i], + ifelse(abs((data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i]) - data$ehi5_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5_pers_extravert = %g %s\n", + data$NPast_5_pers_extravert[i], data$NFut_5_pers_extravert[i], + data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i], + data$ehi5_pers_extravert[i], + ifelse(abs((data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i]) - data$ehi5_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi10_pref_read = %g %s\n", + data$NPast_10_pref_read[i], data$NFut_10_pref_read[i], + data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i], + data$ehi10_pref_read[i], + ifelse(abs((data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i]) - data$ehi10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi10_pref_music = %g %s\n", + data$NPast_10_pref_music[i], data$NFut_10_pref_music[i], + data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i], + data$ehi10_pref_music[i], + ifelse(abs((data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i]) - data$ehi10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi10_pers_extravert = %g %s\n", + data$NPast_10_pers_extravert[i], data$NFut_10_pers_extravert[i], + data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i], + data$ehi10_pers_extravert[i], + ifelse(abs((data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i]) - data$ehi10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 5-10 YEAR CHANGE VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5.10_pref_read = %g %s\n", + data$X5.10past_pref_read[i], data$X5.10fut_pref_read[i], + data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i], + data$ehi5.10_pref_read[i], + ifelse(abs((data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i]) - data$ehi5.10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5.10_pref_music = %g %s\n", + data$X5.10past_pref_music[i], data$X5.10fut_pref_music[i], + data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i], + data$ehi5.10_pref_music[i], + ifelse(abs((data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i]) - data$ehi5.10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5.10_pers_extravert = %g %s\n", + data$X5.10past_pers_extravert[i], data$X5.10fut_pers_extravert[i], + data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i], + data$ehi5.10_pers_extravert[i], + ifelse(abs((data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i]) - data$ehi5.10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year pairs + list(npast = "NPast_5_pref_read", nfut = "NFut_5_pref_read", target = "ehi5_pref_read"), + list(npast = "NPast_5_pref_music", nfut = "NFut_5_pref_music", target = "ehi5_pref_music"), + list(npast = "NPast_5_pref_TV", nfut = "NFut_5_pref_TV", target = "ehi5_pref_TV"), + list(npast = "NPast_5_pref_nap", nfut = "NFut_5_pref_nap", target = "ehi5_pref_nap"), + list(npast = "NPast_5_pref_travel", nfut = "NFut_5_pref_travel", target = "ehi5_pref_travel"), + list(npast = "NPast_5_pers_extravert", nfut = "NFut_5_pers_extravert", target = "ehi5_pers_extravert"), + list(npast = "NPast_5_pers_critical", nfut = "NFut_5_pers_critical", target = "ehi5_pers_critical"), + list(npast = "NPast_5_pers_dependable", nfut = "NFut_5_pers_dependable", target = "ehi5_pers_dependable"), + list(npast = "NPast_5_pers_anxious", nfut = "NFut_5_pers_anxious", target = "ehi5_pers_anxious"), + list(npast = "NPast_5_pers_complex", nfut = "NFut_5_pers_complex", target = "ehi5_pers_complex"), + list(npast = "NPast_5_val_obey", nfut = "NFut_5_val_obey", target = "ehi5_val_obey"), + list(npast = "NPast_5_val_trad", nfut = "NFut_5_val_trad", target = "ehi5_val_trad"), + list(npast = "NPast_5_val_opinion", nfut = "NFut_5_val_opinion", target = "ehi5_val_opinion"), + list(npast = "NPast_5_val_performance", nfut = "NFut_5_val_performance", target = "ehi5_val_performance"), + list(npast = "NPast_5_val_justice", nfut = "NFut_5_val_justice", target = "ehi5_val_justice"), + + # 10-year pairs + list(npast = "NPast_10_pref_read", nfut = "NFut_10_pref_read", target = "ehi10_pref_read"), + list(npast = "NPast_10_pref_music", nfut = "NFut_10_pref_music", target = "ehi10_pref_music"), + list(npast = "NPast_10_pref_TV", nfut = "NFut_10_pref_TV", target = "ehi10_pref_TV"), + list(npast = "NPast_10_pref_nap", nfut = "NFut_10_pref_nap", target = "ehi10_pref_nap"), + list(npast = "NPast_10_pref_travel", nfut = "NFut_10_pref_travel", target = "ehi10_pref_travel"), + list(npast = "NPast_10_pers_extravert", nfut = "NFut_10_pers_extravert", target = "ehi10_pers_extravert"), + list(npast = "NPast_10_pers_critical", nfut = "NFut_10_pers_critical", target = "ehi10_pers_critical"), + list(npast = "NPast_10_pers_dependable", nfut = "NFut_10_pers_dependable", target = "ehi10_pers_dependable"), + list(npast = "NPast_10_pers_anxious", nfut = "NFut_10_pers_anxious", target = "ehi10_pers_anxious"), + list(npast = "NPast_10_pers_complex", nfut = "NFut_10_pers_complex", target = "ehi10_pers_complex"), + list(npast = "NPast_10_val_obey", nfut = "NFut_10_val_obey", target = "ehi10_val_obey"), + list(npast = "NPast_10_val_trad", nfut = "NFut_10_val_trad", target = "ehi10_val_trad"), + list(npast = "NPast_10_val_opinion", nfut = "NFut_10_val_opinion", target = "ehi10_val_opinion"), + list(npast = "NPast_10_val_performance", nfut = "NFut_10_val_performance", target = "ehi10_val_performance"), + list(npast = "NPast_10_val_justice", nfut = "NFut_10_val_justice", target = "ehi10_val_justice"), + + # 5-10 year change pairs + list(npast = "X5.10past_pref_read", nfut = "X5.10fut_pref_read", target = "ehi5.10_pref_read"), + list(npast = "X5.10past_pref_music", nfut = "X5.10fut_pref_music", target = "ehi5.10_pref_music"), + list(npast = "X5.10past_pref_TV", nfut = "X5.10fut_pref_TV", target = "ehi5.10_pref_TV"), + list(npast = "X5.10past_pref_nap", nfut = "X5.10fut_pref_nap", target = "ehi5.10_pref_nap"), + list(npast = "X5.10past_pref_travel", nfut = "X5.10fut_pref_travel", target = "ehi5.10_pref_travel"), + list(npast = "X5.10past_pers_extravert", nfut = "X5.10fut_pers_extravert", target = "ehi5.10_pers_extravert"), + list(npast = "X5.10past_pers_critical", nfut = "X5.10fut_pers_critical", target = "ehi5.10_pers_critical"), + list(npast = "X5.10past_pers_dependable", nfut = "X5.10fut_pers_dependable", target = "ehi5.10_pers_dependable"), + list(npast = "X5.10past_pers_anxious", nfut = "X5.10fut_pers_anxious", target = "ehi5.10_pers_anxious"), + list(npast = "X5.10past_pers_complex", nfut = "X5.10fut_pers_complex", target = "ehi5.10_pers_complex"), + list(npast = "X5.10past_val_obey", nfut = "X5.10fut_val_obey", target = "ehi5.10_val_obey"), + list(npast = "X5.10past_val_trad", nfut = "X5.10fut_val_trad", target = "ehi5.10_val_trad"), + list(npast = "X5.10past_val_opinion", nfut = "X5.10fut_val_opinion", target = "ehi5.10_val_opinion"), + list(npast = "X5.10past_val_performance", nfut = "X5.10fut_val_performance", target = "ehi5.10_val_performance"), + list(npast = "X5.10past_val_justice", nfut = "X5.10fut_val_justice", target = "ehi5.10_val_justice") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164446.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164446.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164447.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164447.r new file mode 100644 index 0000000..96e4994 --- /dev/null +++ b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164447.r @@ -0,0 +1,235 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create EHI difference variables (NPast - NFut) for different time intervals + +# === 5-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi5_pref_read <- data$NPast_5_pref_read - data$NFut_5_pref_read +data$ehi5_pref_music <- data$NPast_5_pref_music - data$NFut_5_pref_music +data$ehi5_pref_TV <- data$NPast_5_pref_TV - data$NFut_5_pref_TV +data$ehi5_pref_nap <- data$NPast_5_pref_nap - data$NFut_5_pref_nap +data$ehi5_pref_travel <- data$NPast_5_pref_travel - data$NFut_5_pref_travel + +# Personality +data$ehi5_pers_extravert <- data$NPast_5_pers_extravert - data$NFut_5_pers_extravert +data$ehi5_pers_critical <- data$NPast_5_pers_critical - data$NFut_5_pers_critical +data$ehi5_pers_dependable <- data$NPast_5_pers_dependable - data$NFut_5_pers_dependable +data$ehi5_pers_anxious <- data$NPast_5_pers_anxious - data$NFut_5_pers_anxious +data$ehi5_pers_complex <- data$NPast_5_pers_complex - data$NFut_5_pers_complex + +# Values +data$ehi5_val_obey <- data$NPast_5_val_obey - data$NFut_5_val_obey +data$ehi5_val_trad <- data$NPast_5_val_trad - data$NFut_5_val_trad +data$ehi5_val_opinion <- data$NPast_5_val_opinion - data$NFut_5_val_opinion +data$ehi5_val_performance <- data$NPast_5_val_performance - data$NFut_5_val_performance +data$ehi5_val_justice <- data$NPast_5_val_justice - data$NFut_5_val_justice + +# === 10-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi10_pref_read <- data$NPast_10_pref_read - data$NFut_10_pref_read +data$ehi10_pref_music <- data$NPast_10_pref_music - data$NFut_10_pref_music +data$ehi10_pref_TV <- data$NPast_10_pref_TV - data$NFut_10_pref_TV +data$ehi10_pref_nap <- data$NPast_10_pref_nap - data$NFut_10_pref_nap +data$ehi10_pref_travel <- data$NPast_10_pref_travel - data$NFut_10_pref_travel + +# Personality +data$ehi10_pers_extravert <- data$NPast_10_pers_extravert - data$NFut_10_pers_extravert +data$ehi10_pers_critical <- data$NPast_10_pers_critical - data$NFut_10_pers_critical +data$ehi10_pers_dependable <- data$NPast_10_pers_dependable - data$NFut_10_pers_dependable +data$ehi10_pers_anxious <- data$NPast_10_pers_anxious - data$NFut_10_pers_anxious +data$ehi10_pers_complex <- data$NPast_10_pers_complex - data$NFut_10_pers_complex + +# Values +data$ehi10_val_obey <- data$NPast_10_val_obey - data$NFut_10_val_obey +data$ehi10_val_trad <- data$NPast_10_val_trad - data$NFut_10_val_trad +data$ehi10_val_opinion <- data$NPast_10_val_opinion - data$NFut_10_val_opinion +data$ehi10_val_performance <- data$NPast_10_val_performance - data$NFut_10_val_performance +data$ehi10_val_justice <- data$NPast_10_val_justice - data$NFut_10_val_justice + +# === 5-10 YEAR CHANGE VARIABLES === +# Preferences +data$ehi5.10_pref_read <- data$X5.10past_pref_read - data$X5.10fut_pref_read +data$ehi5.10_pref_music <- data$X5.10past_pref_music - data$X5.10fut_pref_music +data$ehi5.10_pref_TV <- data$X5.10past_pref_TV - data$X5.10fut_pref_TV +data$ehi5.10_pref_nap <- data$X5.10past_pref_nap - data$X5.10fut_pref_nap +data$ehi5.10_pref_travel <- data$X5.10past_pref_travel - data$X5.10fut_pref_travel + +# Personality +data$ehi5.10_pers_extravert <- data$X5.10past_pers_extravert - data$X5.10fut_pers_extravert +data$ehi5.10_pers_critical <- data$X5.10past_pers_critical - data$X5.10fut_pers_critical +data$ehi5.10_pers_dependable <- data$X5.10past_pers_dependable - data$X5.10fut_pers_dependable +data$ehi5.10_pers_anxious <- data$X5.10past_pers_anxious - data$X5.10fut_pers_anxious +data$ehi5.10_pers_complex <- data$X5.10past_pers_complex - data$X5.10fut_pers_complex + +# Values +data$ehi5.10_val_obey <- data$X5.10past_val_obey - data$X5.10fut_val_obey +data$ehi5.10_val_trad <- data$X5.10past_val_trad - data$X5.10fut_val_trad +data$ehi5.10_val_opinion <- data$X5.10past_val_opinion - data$X5.10fut_val_opinion +data$ehi5.10_val_performance <- data$X5.10past_val_performance - data$X5.10fut_val_performance +data$ehi5.10_val_justice <- data$X5.10past_val_justice - data$X5.10fut_val_justice + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5_pref_read = %g %s\n", + data$NPast_5_pref_read[i], data$NFut_5_pref_read[i], + data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i], + data$ehi5_pref_read[i], + ifelse(abs((data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i]) - data$ehi5_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5_pref_music = %g %s\n", + data$NPast_5_pref_music[i], data$NFut_5_pref_music[i], + data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i], + data$ehi5_pref_music[i], + ifelse(abs((data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i]) - data$ehi5_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5_pers_extravert = %g %s\n", + data$NPast_5_pers_extravert[i], data$NFut_5_pers_extravert[i], + data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i], + data$ehi5_pers_extravert[i], + ifelse(abs((data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i]) - data$ehi5_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi10_pref_read = %g %s\n", + data$NPast_10_pref_read[i], data$NFut_10_pref_read[i], + data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i], + data$ehi10_pref_read[i], + ifelse(abs((data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i]) - data$ehi10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi10_pref_music = %g %s\n", + data$NPast_10_pref_music[i], data$NFut_10_pref_music[i], + data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i], + data$ehi10_pref_music[i], + ifelse(abs((data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i]) - data$ehi10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi10_pers_extravert = %g %s\n", + data$NPast_10_pers_extravert[i], data$NFut_10_pers_extravert[i], + data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i], + data$ehi10_pers_extravert[i], + ifelse(abs((data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i]) - data$ehi10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 5-10 YEAR CHANGE VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5.10_pref_read = %g %s\n", + data$X5.10past_pref_read[i], data$X5.10fut_pref_read[i], + data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i], + data$ehi5.10_pref_read[i], + ifelse(abs((data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i]) - data$ehi5.10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5.10_pref_music = %g %s\n", + data$X5.10past_pref_music[i], data$X5.10fut_pref_music[i], + data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i], + data$ehi5.10_pref_music[i], + ifelse(abs((data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i]) - data$ehi5.10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5.10_pers_extravert = %g %s\n", + data$X5.10past_pers_extravert[i], data$X5.10fut_pers_extravert[i], + data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i], + data$ehi5.10_pers_extravert[i], + ifelse(abs((data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i]) - data$ehi5.10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year pairs + list(npast = "NPast_5_pref_read", nfut = "NFut_5_pref_read", target = "ehi5_pref_read"), + list(npast = "NPast_5_pref_music", nfut = "NFut_5_pref_music", target = "ehi5_pref_music"), + list(npast = "NPast_5_pref_TV", nfut = "NFut_5_pref_TV", target = "ehi5_pref_TV"), + list(npast = "NPast_5_pref_nap", nfut = "NFut_5_pref_nap", target = "ehi5_pref_nap"), + list(npast = "NPast_5_pref_travel", nfut = "NFut_5_pref_travel", target = "ehi5_pref_travel"), + list(npast = "NPast_5_pers_extravert", nfut = "NFut_5_pers_extravert", target = "ehi5_pers_extravert"), + list(npast = "NPast_5_pers_critical", nfut = "NFut_5_pers_critical", target = "ehi5_pers_critical"), + list(npast = "NPast_5_pers_dependable", nfut = "NFut_5_pers_dependable", target = "ehi5_pers_dependable"), + list(npast = "NPast_5_pers_anxious", nfut = "NFut_5_pers_anxious", target = "ehi5_pers_anxious"), + list(npast = "NPast_5_pers_complex", nfut = "NFut_5_pers_complex", target = "ehi5_pers_complex"), + list(npast = "NPast_5_val_obey", nfut = "NFut_5_val_obey", target = "ehi5_val_obey"), + list(npast = "NPast_5_val_trad", nfut = "NFut_5_val_trad", target = "ehi5_val_trad"), + list(npast = "NPast_5_val_opinion", nfut = "NFut_5_val_opinion", target = "ehi5_val_opinion"), + list(npast = "NPast_5_val_performance", nfut = "NFut_5_val_performance", target = "ehi5_val_performance"), + list(npast = "NPast_5_val_justice", nfut = "NFut_5_val_justice", target = "ehi5_val_justice"), + + # 10-year pairs + list(npast = "NPast_10_pref_read", nfut = "NFut_10_pref_read", target = "ehi10_pref_read"), + list(npast = "NPast_10_pref_music", nfut = "NFut_10_pref_music", target = "ehi10_pref_music"), + list(npast = "NPast_10_pref_TV", nfut = "NFut_10_pref_TV", target = "ehi10_pref_TV"), + list(npast = "NPast_10_pref_nap", nfut = "NFut_10_pref_nap", target = "ehi10_pref_nap"), + list(npast = "NPast_10_pref_travel", nfut = "NFut_10_pref_travel", target = "ehi10_pref_travel"), + list(npast = "NPast_10_pers_extravert", nfut = "NFut_10_pers_extravert", target = "ehi10_pers_extravert"), + list(npast = "NPast_10_pers_critical", nfut = "NFut_10_pers_critical", target = "ehi10_pers_critical"), + list(npast = "NPast_10_pers_dependable", nfut = "NFut_10_pers_dependable", target = "ehi10_pers_dependable"), + list(npast = "NPast_10_pers_anxious", nfut = "NFut_10_pers_anxious", target = "ehi10_pers_anxious"), + list(npast = "NPast_10_pers_complex", nfut = "NFut_10_pers_complex", target = "ehi10_pers_complex"), + list(npast = "NPast_10_val_obey", nfut = "NFut_10_val_obey", target = "ehi10_val_obey"), + list(npast = "NPast_10_val_trad", nfut = "NFut_10_val_trad", target = "ehi10_val_trad"), + list(npast = "NPast_10_val_opinion", nfut = "NFut_10_val_opinion", target = "ehi10_val_opinion"), + list(npast = "NPast_10_val_performance", nfut = "NFut_10_val_performance", target = "ehi10_val_performance"), + list(npast = "NPast_10_val_justice", nfut = "NFut_10_val_justice", target = "ehi10_val_justice"), + + # 5-10 year change pairs + list(npast = "X5.10past_pref_read", nfut = "X5.10fut_pref_read", target = "ehi5.10_pref_read"), + list(npast = "X5.10past_pref_music", nfut = "X5.10fut_pref_music", target = "ehi5.10_pref_music"), + list(npast = "X5.10past_pref_TV", nfut = "X5.10fut_pref_TV", target = "ehi5.10_pref_TV"), + list(npast = "X5.10past_pref_nap", nfut = "X5.10fut_pref_nap", target = "ehi5.10_pref_nap"), + list(npast = "X5.10past_pref_travel", nfut = "X5.10fut_pref_travel", target = "ehi5.10_pref_travel"), + list(npast = "X5.10past_pers_extravert", nfut = "X5.10fut_pers_extravert", target = "ehi5.10_pers_extravert"), + list(npast = "X5.10past_pers_critical", nfut = "X5.10fut_pers_critical", target = "ehi5.10_pers_critical"), + list(npast = "X5.10past_pers_dependable", nfut = "X5.10fut_pers_dependable", target = "ehi5.10_pers_dependable"), + list(npast = "X5.10past_pers_anxious", nfut = "X5.10fut_pers_anxious", target = "ehi5.10_pers_anxious"), + list(npast = "X5.10past_pers_complex", nfut = "X5.10fut_pers_complex", target = "ehi5.10_pers_complex"), + list(npast = "X5.10past_val_obey", nfut = "X5.10fut_val_obey", target = "ehi5.10_val_obey"), + list(npast = "X5.10past_val_trad", nfut = "X5.10fut_val_trad", target = "ehi5.10_val_trad"), + list(npast = "X5.10past_val_opinion", nfut = "X5.10fut_val_opinion", target = "ehi5.10_val_opinion"), + list(npast = "X5.10past_val_performance", nfut = "X5.10fut_val_performance", target = "ehi5.10_val_performance"), + list(npast = "X5.10past_val_justice", nfut = "X5.10fut_val_justice", target = "ehi5.10_val_justice") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164616.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164616.r new file mode 100644 index 0000000..921f701 --- /dev/null +++ b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164616.r @@ -0,0 +1,179 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create DGEN EHI difference variables (Past - Future) for different time intervals + +# === 5-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_5_Pref <- data$DGEN_past_5_Pref - data$DGEN_fut_5_Pref +data$ehiDGEN_5_Pers <- data$DGEN_past_5_Pers - data$DGEN_fut_5_Pers +data$ehiDGEN_5_Val <- data$DGEN_past_5_Val - data$DGEN_fut_5_Val + +# === 10-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_10_Pref <- data$DGEN_past_10_Pref - data$DGEN_fut_10_Pref +data$ehiDGEN_10_Pers <- data$DGEN_past_10_Pers - data$DGEN_fut_10_Pers +data$ehiDGEN_10_Val <- data$DGEN_past_10_Val - data$DGEN_fut_10_Val + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5_pref_read = %g %s\n", + data$NPast_5_pref_read[i], data$NFut_5_pref_read[i], + data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i], + data$ehi5_pref_read[i], + ifelse(abs((data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i]) - data$ehi5_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5_pref_music = %g %s\n", + data$NPast_5_pref_music[i], data$NFut_5_pref_music[i], + data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i], + data$ehi5_pref_music[i], + ifelse(abs((data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i]) - data$ehi5_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5_pers_extravert = %g %s\n", + data$NPast_5_pers_extravert[i], data$NFut_5_pers_extravert[i], + data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i], + data$ehi5_pers_extravert[i], + ifelse(abs((data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i]) - data$ehi5_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi10_pref_read = %g %s\n", + data$NPast_10_pref_read[i], data$NFut_10_pref_read[i], + data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i], + data$ehi10_pref_read[i], + ifelse(abs((data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i]) - data$ehi10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi10_pref_music = %g %s\n", + data$NPast_10_pref_music[i], data$NFut_10_pref_music[i], + data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i], + data$ehi10_pref_music[i], + ifelse(abs((data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i]) - data$ehi10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi10_pers_extravert = %g %s\n", + data$NPast_10_pers_extravert[i], data$NFut_10_pers_extravert[i], + data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i], + data$ehi10_pers_extravert[i], + ifelse(abs((data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i]) - data$ehi10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 5-10 YEAR CHANGE VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5.10_pref_read = %g %s\n", + data$X5.10past_pref_read[i], data$X5.10fut_pref_read[i], + data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i], + data$ehi5.10_pref_read[i], + ifelse(abs((data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i]) - data$ehi5.10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5.10_pref_music = %g %s\n", + data$X5.10past_pref_music[i], data$X5.10fut_pref_music[i], + data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i], + data$ehi5.10_pref_music[i], + ifelse(abs((data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i]) - data$ehi5.10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5.10_pers_extravert = %g %s\n", + data$X5.10past_pers_extravert[i], data$X5.10fut_pers_extravert[i], + data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i], + data$ehi5.10_pers_extravert[i], + ifelse(abs((data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i]) - data$ehi5.10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year pairs + list(npast = "NPast_5_pref_read", nfut = "NFut_5_pref_read", target = "ehi5_pref_read"), + list(npast = "NPast_5_pref_music", nfut = "NFut_5_pref_music", target = "ehi5_pref_music"), + list(npast = "NPast_5_pref_TV", nfut = "NFut_5_pref_TV", target = "ehi5_pref_TV"), + list(npast = "NPast_5_pref_nap", nfut = "NFut_5_pref_nap", target = "ehi5_pref_nap"), + list(npast = "NPast_5_pref_travel", nfut = "NFut_5_pref_travel", target = "ehi5_pref_travel"), + list(npast = "NPast_5_pers_extravert", nfut = "NFut_5_pers_extravert", target = "ehi5_pers_extravert"), + list(npast = "NPast_5_pers_critical", nfut = "NFut_5_pers_critical", target = "ehi5_pers_critical"), + list(npast = "NPast_5_pers_dependable", nfut = "NFut_5_pers_dependable", target = "ehi5_pers_dependable"), + list(npast = "NPast_5_pers_anxious", nfut = "NFut_5_pers_anxious", target = "ehi5_pers_anxious"), + list(npast = "NPast_5_pers_complex", nfut = "NFut_5_pers_complex", target = "ehi5_pers_complex"), + list(npast = "NPast_5_val_obey", nfut = "NFut_5_val_obey", target = "ehi5_val_obey"), + list(npast = "NPast_5_val_trad", nfut = "NFut_5_val_trad", target = "ehi5_val_trad"), + list(npast = "NPast_5_val_opinion", nfut = "NFut_5_val_opinion", target = "ehi5_val_opinion"), + list(npast = "NPast_5_val_performance", nfut = "NFut_5_val_performance", target = "ehi5_val_performance"), + list(npast = "NPast_5_val_justice", nfut = "NFut_5_val_justice", target = "ehi5_val_justice"), + + # 10-year pairs + list(npast = "NPast_10_pref_read", nfut = "NFut_10_pref_read", target = "ehi10_pref_read"), + list(npast = "NPast_10_pref_music", nfut = "NFut_10_pref_music", target = "ehi10_pref_music"), + list(npast = "NPast_10_pref_TV", nfut = "NFut_10_pref_TV", target = "ehi10_pref_TV"), + list(npast = "NPast_10_pref_nap", nfut = "NFut_10_pref_nap", target = "ehi10_pref_nap"), + list(npast = "NPast_10_pref_travel", nfut = "NFut_10_pref_travel", target = "ehi10_pref_travel"), + list(npast = "NPast_10_pers_extravert", nfut = "NFut_10_pers_extravert", target = "ehi10_pers_extravert"), + list(npast = "NPast_10_pers_critical", nfut = "NFut_10_pers_critical", target = "ehi10_pers_critical"), + list(npast = "NPast_10_pers_dependable", nfut = "NFut_10_pers_dependable", target = "ehi10_pers_dependable"), + list(npast = "NPast_10_pers_anxious", nfut = "NFut_10_pers_anxious", target = "ehi10_pers_anxious"), + list(npast = "NPast_10_pers_complex", nfut = "NFut_10_pers_complex", target = "ehi10_pers_complex"), + list(npast = "NPast_10_val_obey", nfut = "NFut_10_val_obey", target = "ehi10_val_obey"), + list(npast = "NPast_10_val_trad", nfut = "NFut_10_val_trad", target = "ehi10_val_trad"), + list(npast = "NPast_10_val_opinion", nfut = "NFut_10_val_opinion", target = "ehi10_val_opinion"), + list(npast = "NPast_10_val_performance", nfut = "NFut_10_val_performance", target = "ehi10_val_performance"), + list(npast = "NPast_10_val_justice", nfut = "NFut_10_val_justice", target = "ehi10_val_justice"), + + # 5-10 year change pairs + list(npast = "X5.10past_pref_read", nfut = "X5.10fut_pref_read", target = "ehi5.10_pref_read"), + list(npast = "X5.10past_pref_music", nfut = "X5.10fut_pref_music", target = "ehi5.10_pref_music"), + list(npast = "X5.10past_pref_TV", nfut = "X5.10fut_pref_TV", target = "ehi5.10_pref_TV"), + list(npast = "X5.10past_pref_nap", nfut = "X5.10fut_pref_nap", target = "ehi5.10_pref_nap"), + list(npast = "X5.10past_pref_travel", nfut = "X5.10fut_pref_travel", target = "ehi5.10_pref_travel"), + list(npast = "X5.10past_pers_extravert", nfut = "X5.10fut_pers_extravert", target = "ehi5.10_pers_extravert"), + list(npast = "X5.10past_pers_critical", nfut = "X5.10fut_pers_critical", target = "ehi5.10_pers_critical"), + list(npast = "X5.10past_pers_dependable", nfut = "X5.10fut_pers_dependable", target = "ehi5.10_pers_dependable"), + list(npast = "X5.10past_pers_anxious", nfut = "X5.10fut_pers_anxious", target = "ehi5.10_pers_anxious"), + list(npast = "X5.10past_pers_complex", nfut = "X5.10fut_pers_complex", target = "ehi5.10_pers_complex"), + list(npast = "X5.10past_val_obey", nfut = "X5.10fut_val_obey", target = "ehi5.10_val_obey"), + list(npast = "X5.10past_val_trad", nfut = "X5.10fut_val_trad", target = "ehi5.10_val_trad"), + list(npast = "X5.10past_val_opinion", nfut = "X5.10fut_val_opinion", target = "ehi5.10_val_opinion"), + list(npast = "X5.10past_val_performance", nfut = "X5.10fut_val_performance", target = "ehi5.10_val_performance"), + list(npast = "X5.10past_val_justice", nfut = "X5.10fut_val_justice", target = "ehi5.10_val_justice") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164646.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164646.r new file mode 100644 index 0000000..e569dee --- /dev/null +++ b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164646.r @@ -0,0 +1,159 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create DGEN EHI difference variables (Past - Future) for different time intervals + +# === 5-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_5_Pref <- data$DGEN_past_5_Pref - data$DGEN_fut_5_Pref +data$ehiDGEN_5_Pers <- data$DGEN_past_5_Pers - data$DGEN_fut_5_Pers +data$ehiDGEN_5_Val <- data$DGEN_past_5_Val - data$DGEN_fut_5_Val + +# === 10-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_10_Pref <- data$DGEN_past_10_Pref - data$DGEN_fut_10_Pref +data$ehiDGEN_10_Pers <- data$DGEN_past_10_Pers - data$DGEN_fut_10_Pers +data$ehiDGEN_10_Val <- data$DGEN_past_10_Val - data$DGEN_fut_10_Val + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_5_Pref = %g %s\n", + data$DGEN_past_5_Pref[i], data$DGEN_fut_5_Pref[i], + data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i], + data$ehiDGEN_5_Pref[i], + ifelse(abs((data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i]) - data$ehiDGEN_5_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_5_Pers = %g %s\n", + data$DGEN_past_5_Pers[i], data$DGEN_fut_5_Pers[i], + data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i], + data$ehiDGEN_5_Pers[i], + ifelse(abs((data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i]) - data$ehiDGEN_5_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_5_Val = %g %s\n", + data$DGEN_past_5_Val[i], data$DGEN_fut_5_Val[i], + data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i], + data$ehiDGEN_5_Val[i], + ifelse(abs((data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i]) - data$ehiDGEN_5_Val[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_10_Pref = %g %s\n", + data$DGEN_past_10_Pref[i], data$DGEN_fut_10_Pref[i], + data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i], + data$ehiDGEN_10_Pref[i], + ifelse(abs((data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i]) - data$ehiDGEN_10_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_10_Pers = %g %s\n", + data$DGEN_past_10_Pers[i], data$DGEN_fut_10_Pers[i], + data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i], + data$ehiDGEN_10_Pers[i], + ifelse(abs((data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i]) - data$ehiDGEN_10_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_10_Val = %g %s\n", + data$DGEN_past_10_Val[i], data$DGEN_fut_10_Val[i], + data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i], + data$ehiDGEN_10_Val[i], + ifelse(abs((data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i]) - data$ehiDGEN_10_Val[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year pairs + list(npast = "NPast_5_pref_read", nfut = "NFut_5_pref_read", target = "ehi5_pref_read"), + list(npast = "NPast_5_pref_music", nfut = "NFut_5_pref_music", target = "ehi5_pref_music"), + list(npast = "NPast_5_pref_TV", nfut = "NFut_5_pref_TV", target = "ehi5_pref_TV"), + list(npast = "NPast_5_pref_nap", nfut = "NFut_5_pref_nap", target = "ehi5_pref_nap"), + list(npast = "NPast_5_pref_travel", nfut = "NFut_5_pref_travel", target = "ehi5_pref_travel"), + list(npast = "NPast_5_pers_extravert", nfut = "NFut_5_pers_extravert", target = "ehi5_pers_extravert"), + list(npast = "NPast_5_pers_critical", nfut = "NFut_5_pers_critical", target = "ehi5_pers_critical"), + list(npast = "NPast_5_pers_dependable", nfut = "NFut_5_pers_dependable", target = "ehi5_pers_dependable"), + list(npast = "NPast_5_pers_anxious", nfut = "NFut_5_pers_anxious", target = "ehi5_pers_anxious"), + list(npast = "NPast_5_pers_complex", nfut = "NFut_5_pers_complex", target = "ehi5_pers_complex"), + list(npast = "NPast_5_val_obey", nfut = "NFut_5_val_obey", target = "ehi5_val_obey"), + list(npast = "NPast_5_val_trad", nfut = "NFut_5_val_trad", target = "ehi5_val_trad"), + list(npast = "NPast_5_val_opinion", nfut = "NFut_5_val_opinion", target = "ehi5_val_opinion"), + list(npast = "NPast_5_val_performance", nfut = "NFut_5_val_performance", target = "ehi5_val_performance"), + list(npast = "NPast_5_val_justice", nfut = "NFut_5_val_justice", target = "ehi5_val_justice"), + + # 10-year pairs + list(npast = "NPast_10_pref_read", nfut = "NFut_10_pref_read", target = "ehi10_pref_read"), + list(npast = "NPast_10_pref_music", nfut = "NFut_10_pref_music", target = "ehi10_pref_music"), + list(npast = "NPast_10_pref_TV", nfut = "NFut_10_pref_TV", target = "ehi10_pref_TV"), + list(npast = "NPast_10_pref_nap", nfut = "NFut_10_pref_nap", target = "ehi10_pref_nap"), + list(npast = "NPast_10_pref_travel", nfut = "NFut_10_pref_travel", target = "ehi10_pref_travel"), + list(npast = "NPast_10_pers_extravert", nfut = "NFut_10_pers_extravert", target = "ehi10_pers_extravert"), + list(npast = "NPast_10_pers_critical", nfut = "NFut_10_pers_critical", target = "ehi10_pers_critical"), + list(npast = "NPast_10_pers_dependable", nfut = "NFut_10_pers_dependable", target = "ehi10_pers_dependable"), + list(npast = "NPast_10_pers_anxious", nfut = "NFut_10_pers_anxious", target = "ehi10_pers_anxious"), + list(npast = "NPast_10_pers_complex", nfut = "NFut_10_pers_complex", target = "ehi10_pers_complex"), + list(npast = "NPast_10_val_obey", nfut = "NFut_10_val_obey", target = "ehi10_val_obey"), + list(npast = "NPast_10_val_trad", nfut = "NFut_10_val_trad", target = "ehi10_val_trad"), + list(npast = "NPast_10_val_opinion", nfut = "NFut_10_val_opinion", target = "ehi10_val_opinion"), + list(npast = "NPast_10_val_performance", nfut = "NFut_10_val_performance", target = "ehi10_val_performance"), + list(npast = "NPast_10_val_justice", nfut = "NFut_10_val_justice", target = "ehi10_val_justice"), + + # 5-10 year change pairs + list(npast = "X5.10past_pref_read", nfut = "X5.10fut_pref_read", target = "ehi5.10_pref_read"), + list(npast = "X5.10past_pref_music", nfut = "X5.10fut_pref_music", target = "ehi5.10_pref_music"), + list(npast = "X5.10past_pref_TV", nfut = "X5.10fut_pref_TV", target = "ehi5.10_pref_TV"), + list(npast = "X5.10past_pref_nap", nfut = "X5.10fut_pref_nap", target = "ehi5.10_pref_nap"), + list(npast = "X5.10past_pref_travel", nfut = "X5.10fut_pref_travel", target = "ehi5.10_pref_travel"), + list(npast = "X5.10past_pers_extravert", nfut = "X5.10fut_pers_extravert", target = "ehi5.10_pers_extravert"), + list(npast = "X5.10past_pers_critical", nfut = "X5.10fut_pers_critical", target = "ehi5.10_pers_critical"), + list(npast = "X5.10past_pers_dependable", nfut = "X5.10fut_pers_dependable", target = "ehi5.10_pers_dependable"), + list(npast = "X5.10past_pers_anxious", nfut = "X5.10fut_pers_anxious", target = "ehi5.10_pers_anxious"), + list(npast = "X5.10past_pers_complex", nfut = "X5.10fut_pers_complex", target = "ehi5.10_pers_complex"), + list(npast = "X5.10past_val_obey", nfut = "X5.10fut_val_obey", target = "ehi5.10_val_obey"), + list(npast = "X5.10past_val_trad", nfut = "X5.10fut_val_trad", target = "ehi5.10_val_trad"), + list(npast = "X5.10past_val_opinion", nfut = "X5.10fut_val_opinion", target = "ehi5.10_val_opinion"), + list(npast = "X5.10past_val_performance", nfut = "X5.10fut_val_performance", target = "ehi5.10_val_performance"), + list(npast = "X5.10past_val_justice", nfut = "X5.10fut_val_justice", target = "ehi5.10_val_justice") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164712.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164712.r new file mode 100644 index 0000000..5274cdd --- /dev/null +++ b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164712.r @@ -0,0 +1,118 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create DGEN EHI difference variables (Past - Future) for different time intervals + +# === 5-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_5_Pref <- data$DGEN_past_5_Pref - data$DGEN_fut_5_Pref +data$ehiDGEN_5_Pers <- data$DGEN_past_5_Pers - data$DGEN_fut_5_Pers +data$ehiDGEN_5_Val <- data$DGEN_past_5_Val - data$DGEN_fut_5_Val + +# === 10-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_10_Pref <- data$DGEN_past_10_Pref - data$DGEN_fut_10_Pref +data$ehiDGEN_10_Pers <- data$DGEN_past_10_Pers - data$DGEN_fut_10_Pers +data$ehiDGEN_10_Val <- data$DGEN_past_10_Val - data$DGEN_fut_10_Val + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_5_Pref = %g %s\n", + data$DGEN_past_5_Pref[i], data$DGEN_fut_5_Pref[i], + data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i], + data$ehiDGEN_5_Pref[i], + ifelse(abs((data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i]) - data$ehiDGEN_5_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_5_Pers = %g %s\n", + data$DGEN_past_5_Pers[i], data$DGEN_fut_5_Pers[i], + data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i], + data$ehiDGEN_5_Pers[i], + ifelse(abs((data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i]) - data$ehiDGEN_5_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_5_Val = %g %s\n", + data$DGEN_past_5_Val[i], data$DGEN_fut_5_Val[i], + data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i], + data$ehiDGEN_5_Val[i], + ifelse(abs((data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i]) - data$ehiDGEN_5_Val[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_10_Pref = %g %s\n", + data$DGEN_past_10_Pref[i], data$DGEN_fut_10_Pref[i], + data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i], + data$ehiDGEN_10_Pref[i], + ifelse(abs((data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i]) - data$ehiDGEN_10_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_10_Pers = %g %s\n", + data$DGEN_past_10_Pers[i], data$DGEN_fut_10_Pers[i], + data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i], + data$ehiDGEN_10_Pers[i], + ifelse(abs((data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i]) - data$ehiDGEN_10_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_10_Val = %g %s\n", + data$DGEN_past_10_Val[i], data$DGEN_fut_10_Val[i], + data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i], + data$ehiDGEN_10_Val[i], + ifelse(abs((data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i]) - data$ehiDGEN_10_Val[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year DGEN pairs + list(npast = "DGEN_past_5_Pref", nfut = "DGEN_fut_5_Pref", target = "ehiDGEN_5_Pref"), + list(npast = "DGEN_past_5_Pers", nfut = "DGEN_fut_5_Pers", target = "ehiDGEN_5_Pers"), + list(npast = "DGEN_past_5_Val", nfut = "DGEN_fut_5_Val", target = "ehiDGEN_5_Val"), + + # 10-year DGEN pairs + list(npast = "DGEN_past_10_Pref", nfut = "DGEN_fut_10_Pref", target = "ehiDGEN_10_Pref"), + list(npast = "DGEN_past_10_Pers", nfut = "DGEN_fut_10_Pers", target = "ehiDGEN_10_Pers"), + list(npast = "DGEN_past_10_Val", nfut = "DGEN_fut_10_Val", target = "ehiDGEN_10_Val") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164735.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164735.r new file mode 100644 index 0000000..5274cdd --- /dev/null +++ b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164735.r @@ -0,0 +1,118 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create DGEN EHI difference variables (Past - Future) for different time intervals + +# === 5-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_5_Pref <- data$DGEN_past_5_Pref - data$DGEN_fut_5_Pref +data$ehiDGEN_5_Pers <- data$DGEN_past_5_Pers - data$DGEN_fut_5_Pers +data$ehiDGEN_5_Val <- data$DGEN_past_5_Val - data$DGEN_fut_5_Val + +# === 10-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_10_Pref <- data$DGEN_past_10_Pref - data$DGEN_fut_10_Pref +data$ehiDGEN_10_Pers <- data$DGEN_past_10_Pers - data$DGEN_fut_10_Pers +data$ehiDGEN_10_Val <- data$DGEN_past_10_Val - data$DGEN_fut_10_Val + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_5_Pref = %g %s\n", + data$DGEN_past_5_Pref[i], data$DGEN_fut_5_Pref[i], + data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i], + data$ehiDGEN_5_Pref[i], + ifelse(abs((data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i]) - data$ehiDGEN_5_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_5_Pers = %g %s\n", + data$DGEN_past_5_Pers[i], data$DGEN_fut_5_Pers[i], + data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i], + data$ehiDGEN_5_Pers[i], + ifelse(abs((data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i]) - data$ehiDGEN_5_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_5_Val = %g %s\n", + data$DGEN_past_5_Val[i], data$DGEN_fut_5_Val[i], + data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i], + data$ehiDGEN_5_Val[i], + ifelse(abs((data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i]) - data$ehiDGEN_5_Val[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_10_Pref = %g %s\n", + data$DGEN_past_10_Pref[i], data$DGEN_fut_10_Pref[i], + data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i], + data$ehiDGEN_10_Pref[i], + ifelse(abs((data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i]) - data$ehiDGEN_10_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_10_Pers = %g %s\n", + data$DGEN_past_10_Pers[i], data$DGEN_fut_10_Pers[i], + data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i], + data$ehiDGEN_10_Pers[i], + ifelse(abs((data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i]) - data$ehiDGEN_10_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_10_Val = %g %s\n", + data$DGEN_past_10_Val[i], data$DGEN_fut_10_Val[i], + data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i], + data$ehiDGEN_10_Val[i], + ifelse(abs((data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i]) - data$ehiDGEN_10_Val[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year DGEN pairs + list(npast = "DGEN_past_5_Pref", nfut = "DGEN_fut_5_Pref", target = "ehiDGEN_5_Pref"), + list(npast = "DGEN_past_5_Pers", nfut = "DGEN_fut_5_Pers", target = "ehiDGEN_5_Pers"), + list(npast = "DGEN_past_5_Val", nfut = "DGEN_fut_5_Val", target = "ehiDGEN_5_Val"), + + # 10-year DGEN pairs + list(npast = "DGEN_past_10_Pref", nfut = "DGEN_fut_10_Pref", target = "ehiDGEN_10_Pref"), + list(npast = "DGEN_past_10_Pers", nfut = "DGEN_fut_10_Pers", target = "ehiDGEN_10_Pers"), + list(npast = "DGEN_past_10_Val", nfut = "DGEN_fut_10_Val", target = "ehiDGEN_10_Val") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164934.r b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164934.r new file mode 100644 index 0000000..5274cdd --- /dev/null +++ b/.history/eohi2/datap 12 - CORRECT DGEN ehi vars_20251008164934.r @@ -0,0 +1,118 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create DGEN EHI difference variables (Past - Future) for different time intervals + +# === 5-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_5_Pref <- data$DGEN_past_5_Pref - data$DGEN_fut_5_Pref +data$ehiDGEN_5_Pers <- data$DGEN_past_5_Pers - data$DGEN_fut_5_Pers +data$ehiDGEN_5_Val <- data$DGEN_past_5_Val - data$DGEN_fut_5_Val + +# === 10-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_10_Pref <- data$DGEN_past_10_Pref - data$DGEN_fut_10_Pref +data$ehiDGEN_10_Pers <- data$DGEN_past_10_Pers - data$DGEN_fut_10_Pers +data$ehiDGEN_10_Val <- data$DGEN_past_10_Val - data$DGEN_fut_10_Val + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_5_Pref = %g %s\n", + data$DGEN_past_5_Pref[i], data$DGEN_fut_5_Pref[i], + data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i], + data$ehiDGEN_5_Pref[i], + ifelse(abs((data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i]) - data$ehiDGEN_5_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_5_Pers = %g %s\n", + data$DGEN_past_5_Pers[i], data$DGEN_fut_5_Pers[i], + data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i], + data$ehiDGEN_5_Pers[i], + ifelse(abs((data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i]) - data$ehiDGEN_5_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_5_Val = %g %s\n", + data$DGEN_past_5_Val[i], data$DGEN_fut_5_Val[i], + data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i], + data$ehiDGEN_5_Val[i], + ifelse(abs((data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i]) - data$ehiDGEN_5_Val[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_10_Pref = %g %s\n", + data$DGEN_past_10_Pref[i], data$DGEN_fut_10_Pref[i], + data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i], + data$ehiDGEN_10_Pref[i], + ifelse(abs((data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i]) - data$ehiDGEN_10_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_10_Pers = %g %s\n", + data$DGEN_past_10_Pers[i], data$DGEN_fut_10_Pers[i], + data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i], + data$ehiDGEN_10_Pers[i], + ifelse(abs((data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i]) - data$ehiDGEN_10_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_10_Val = %g %s\n", + data$DGEN_past_10_Val[i], data$DGEN_fut_10_Val[i], + data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i], + data$ehiDGEN_10_Val[i], + ifelse(abs((data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i]) - data$ehiDGEN_10_Val[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year DGEN pairs + list(npast = "DGEN_past_5_Pref", nfut = "DGEN_fut_5_Pref", target = "ehiDGEN_5_Pref"), + list(npast = "DGEN_past_5_Pers", nfut = "DGEN_fut_5_Pers", target = "ehiDGEN_5_Pers"), + list(npast = "DGEN_past_5_Val", nfut = "DGEN_fut_5_Val", target = "ehiDGEN_5_Val"), + + # 10-year DGEN pairs + list(npast = "DGEN_past_10_Pref", nfut = "DGEN_fut_10_Pref", target = "ehiDGEN_10_Pref"), + list(npast = "DGEN_past_10_Pers", nfut = "DGEN_fut_10_Pers", target = "ehiDGEN_10_Pers"), + list(npast = "DGEN_past_10_Val", nfut = "DGEN_fut_10_Val", target = "ehiDGEN_10_Val") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 13 - ehi domain specific means_20251008165421.r b/.history/eohi2/datap 13 - ehi domain specific means_20251008165421.r new file mode 100644 index 0000000..e655492 --- /dev/null +++ b/.history/eohi2/datap 13 - ehi domain specific means_20251008165421.r @@ -0,0 +1,161 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate domain-specific mean scores for EHI variables across time intervals + +# === 5-YEAR MEANS === +data$ehi5_pref_MEAN <- rowMeans(data[, c("ehi5_pref_read", "ehi5_pref_music", + "ehi5_pref_TV", "ehi5_pref_nap", + "ehi5_pref_travel")], na.rm = TRUE) + +data$ehi5_pers_MEAN <- rowMeans(data[, c("ehi5_pers_extravert", "ehi5_pers_critical", + "ehi5_pers_dependable", "ehi5_pers_anxious", + "ehi5_pers_complex")], na.rm = TRUE) + +data$ehi5_val_MEAN <- rowMeans(data[, c("ehi5_val_obey", "ehi5_val_trad", + "ehi5_val_opinion", "ehi5_val_performance", + "ehi5_val_justice")], na.rm = TRUE) + +# === 10-YEAR MEANS === +data$ehi10_pref_MEAN <- rowMeans(data[, c("ehi10_pref_read", "ehi10_pref_music", + "ehi10_pref_TV", "ehi10_pref_nap", + "ehi10_pref_travel")], na.rm = TRUE) + +data$ehi10_pers_MEAN <- rowMeans(data[, c("ehi10_pers_extravert", "ehi10_pers_critical", + "ehi10_pers_dependable", "ehi10_pers_anxious", + "ehi10_pers_complex")], na.rm = TRUE) + +data$ehi10_val_MEAN <- rowMeans(data[, c("ehi10_val_obey", "ehi10_val_trad", + "ehi10_val_opinion", "ehi10_val_performance", + "ehi10_val_justice")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE MEANS === +data$ehi5.10_pref_MEAN <- rowMeans(data[, c("ehi5.10_pref_read", "ehi5.10_pref_music", + "ehi5.10_pref_TV", "ehi5.10_pref_nap", + "ehi5.10_pref_travel")], na.rm = TRUE) + +data$ehi5.10_pers_MEAN <- rowMeans(data[, c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", + "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", + "ehi5.10_pers_complex")], na.rm = TRUE) + +data$ehi5.10_val_MEAN <- rowMeans(data[, c("ehi5.10_val_obey", "ehi5.10_val_trad", + "ehi5.10_val_opinion", "ehi5.10_val_performance", + "ehi5.10_val_justice")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 13 - ehi domain specific means_20251008165443.r b/.history/eohi2/datap 13 - ehi domain specific means_20251008165443.r new file mode 100644 index 0000000..e655492 --- /dev/null +++ b/.history/eohi2/datap 13 - ehi domain specific means_20251008165443.r @@ -0,0 +1,161 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate domain-specific mean scores for EHI variables across time intervals + +# === 5-YEAR MEANS === +data$ehi5_pref_MEAN <- rowMeans(data[, c("ehi5_pref_read", "ehi5_pref_music", + "ehi5_pref_TV", "ehi5_pref_nap", + "ehi5_pref_travel")], na.rm = TRUE) + +data$ehi5_pers_MEAN <- rowMeans(data[, c("ehi5_pers_extravert", "ehi5_pers_critical", + "ehi5_pers_dependable", "ehi5_pers_anxious", + "ehi5_pers_complex")], na.rm = TRUE) + +data$ehi5_val_MEAN <- rowMeans(data[, c("ehi5_val_obey", "ehi5_val_trad", + "ehi5_val_opinion", "ehi5_val_performance", + "ehi5_val_justice")], na.rm = TRUE) + +# === 10-YEAR MEANS === +data$ehi10_pref_MEAN <- rowMeans(data[, c("ehi10_pref_read", "ehi10_pref_music", + "ehi10_pref_TV", "ehi10_pref_nap", + "ehi10_pref_travel")], na.rm = TRUE) + +data$ehi10_pers_MEAN <- rowMeans(data[, c("ehi10_pers_extravert", "ehi10_pers_critical", + "ehi10_pers_dependable", "ehi10_pers_anxious", + "ehi10_pers_complex")], na.rm = TRUE) + +data$ehi10_val_MEAN <- rowMeans(data[, c("ehi10_val_obey", "ehi10_val_trad", + "ehi10_val_opinion", "ehi10_val_performance", + "ehi10_val_justice")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE MEANS === +data$ehi5.10_pref_MEAN <- rowMeans(data[, c("ehi5.10_pref_read", "ehi5.10_pref_music", + "ehi5.10_pref_TV", "ehi5.10_pref_nap", + "ehi5.10_pref_travel")], na.rm = TRUE) + +data$ehi5.10_pers_MEAN <- rowMeans(data[, c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", + "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", + "ehi5.10_pers_complex")], na.rm = TRUE) + +data$ehi5.10_val_MEAN <- rowMeans(data[, c("ehi5.10_val_obey", "ehi5.10_val_trad", + "ehi5.10_val_opinion", "ehi5.10_val_performance", + "ehi5.10_val_justice")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 13 - ehi domain specific means_20251008165448.r b/.history/eohi2/datap 13 - ehi domain specific means_20251008165448.r new file mode 100644 index 0000000..e655492 --- /dev/null +++ b/.history/eohi2/datap 13 - ehi domain specific means_20251008165448.r @@ -0,0 +1,161 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate domain-specific mean scores for EHI variables across time intervals + +# === 5-YEAR MEANS === +data$ehi5_pref_MEAN <- rowMeans(data[, c("ehi5_pref_read", "ehi5_pref_music", + "ehi5_pref_TV", "ehi5_pref_nap", + "ehi5_pref_travel")], na.rm = TRUE) + +data$ehi5_pers_MEAN <- rowMeans(data[, c("ehi5_pers_extravert", "ehi5_pers_critical", + "ehi5_pers_dependable", "ehi5_pers_anxious", + "ehi5_pers_complex")], na.rm = TRUE) + +data$ehi5_val_MEAN <- rowMeans(data[, c("ehi5_val_obey", "ehi5_val_trad", + "ehi5_val_opinion", "ehi5_val_performance", + "ehi5_val_justice")], na.rm = TRUE) + +# === 10-YEAR MEANS === +data$ehi10_pref_MEAN <- rowMeans(data[, c("ehi10_pref_read", "ehi10_pref_music", + "ehi10_pref_TV", "ehi10_pref_nap", + "ehi10_pref_travel")], na.rm = TRUE) + +data$ehi10_pers_MEAN <- rowMeans(data[, c("ehi10_pers_extravert", "ehi10_pers_critical", + "ehi10_pers_dependable", "ehi10_pers_anxious", + "ehi10_pers_complex")], na.rm = TRUE) + +data$ehi10_val_MEAN <- rowMeans(data[, c("ehi10_val_obey", "ehi10_val_trad", + "ehi10_val_opinion", "ehi10_val_performance", + "ehi10_val_justice")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE MEANS === +data$ehi5.10_pref_MEAN <- rowMeans(data[, c("ehi5.10_pref_read", "ehi5.10_pref_music", + "ehi5.10_pref_TV", "ehi5.10_pref_nap", + "ehi5.10_pref_travel")], na.rm = TRUE) + +data$ehi5.10_pers_MEAN <- rowMeans(data[, c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", + "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", + "ehi5.10_pers_complex")], na.rm = TRUE) + +data$ehi5.10_val_MEAN <- rowMeans(data[, c("ehi5.10_val_obey", "ehi5.10_val_trad", + "ehi5.10_val_opinion", "ehi5.10_val_performance", + "ehi5.10_val_justice")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 13 - ehi domain specific means_20251008165551.r b/.history/eohi2/datap 13 - ehi domain specific means_20251008165551.r new file mode 100644 index 0000000..e655492 --- /dev/null +++ b/.history/eohi2/datap 13 - ehi domain specific means_20251008165551.r @@ -0,0 +1,161 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate domain-specific mean scores for EHI variables across time intervals + +# === 5-YEAR MEANS === +data$ehi5_pref_MEAN <- rowMeans(data[, c("ehi5_pref_read", "ehi5_pref_music", + "ehi5_pref_TV", "ehi5_pref_nap", + "ehi5_pref_travel")], na.rm = TRUE) + +data$ehi5_pers_MEAN <- rowMeans(data[, c("ehi5_pers_extravert", "ehi5_pers_critical", + "ehi5_pers_dependable", "ehi5_pers_anxious", + "ehi5_pers_complex")], na.rm = TRUE) + +data$ehi5_val_MEAN <- rowMeans(data[, c("ehi5_val_obey", "ehi5_val_trad", + "ehi5_val_opinion", "ehi5_val_performance", + "ehi5_val_justice")], na.rm = TRUE) + +# === 10-YEAR MEANS === +data$ehi10_pref_MEAN <- rowMeans(data[, c("ehi10_pref_read", "ehi10_pref_music", + "ehi10_pref_TV", "ehi10_pref_nap", + "ehi10_pref_travel")], na.rm = TRUE) + +data$ehi10_pers_MEAN <- rowMeans(data[, c("ehi10_pers_extravert", "ehi10_pers_critical", + "ehi10_pers_dependable", "ehi10_pers_anxious", + "ehi10_pers_complex")], na.rm = TRUE) + +data$ehi10_val_MEAN <- rowMeans(data[, c("ehi10_val_obey", "ehi10_val_trad", + "ehi10_val_opinion", "ehi10_val_performance", + "ehi10_val_justice")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE MEANS === +data$ehi5.10_pref_MEAN <- rowMeans(data[, c("ehi5.10_pref_read", "ehi5.10_pref_music", + "ehi5.10_pref_TV", "ehi5.10_pref_nap", + "ehi5.10_pref_travel")], na.rm = TRUE) + +data$ehi5.10_pers_MEAN <- rowMeans(data[, c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", + "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", + "ehi5.10_pers_complex")], na.rm = TRUE) + +data$ehi5.10_val_MEAN <- rowMeans(data[, c("ehi5.10_val_obey", "ehi5.10_val_trad", + "ehi5.10_val_opinion", "ehi5.10_val_performance", + "ehi5.10_val_justice")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 13 - ehi domain specific means_20251008170838.r b/.history/eohi2/datap 13 - ehi domain specific means_20251008170838.r new file mode 100644 index 0000000..e655492 --- /dev/null +++ b/.history/eohi2/datap 13 - ehi domain specific means_20251008170838.r @@ -0,0 +1,161 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate domain-specific mean scores for EHI variables across time intervals + +# === 5-YEAR MEANS === +data$ehi5_pref_MEAN <- rowMeans(data[, c("ehi5_pref_read", "ehi5_pref_music", + "ehi5_pref_TV", "ehi5_pref_nap", + "ehi5_pref_travel")], na.rm = TRUE) + +data$ehi5_pers_MEAN <- rowMeans(data[, c("ehi5_pers_extravert", "ehi5_pers_critical", + "ehi5_pers_dependable", "ehi5_pers_anxious", + "ehi5_pers_complex")], na.rm = TRUE) + +data$ehi5_val_MEAN <- rowMeans(data[, c("ehi5_val_obey", "ehi5_val_trad", + "ehi5_val_opinion", "ehi5_val_performance", + "ehi5_val_justice")], na.rm = TRUE) + +# === 10-YEAR MEANS === +data$ehi10_pref_MEAN <- rowMeans(data[, c("ehi10_pref_read", "ehi10_pref_music", + "ehi10_pref_TV", "ehi10_pref_nap", + "ehi10_pref_travel")], na.rm = TRUE) + +data$ehi10_pers_MEAN <- rowMeans(data[, c("ehi10_pers_extravert", "ehi10_pers_critical", + "ehi10_pers_dependable", "ehi10_pers_anxious", + "ehi10_pers_complex")], na.rm = TRUE) + +data$ehi10_val_MEAN <- rowMeans(data[, c("ehi10_val_obey", "ehi10_val_trad", + "ehi10_val_opinion", "ehi10_val_performance", + "ehi10_val_justice")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE MEANS === +data$ehi5.10_pref_MEAN <- rowMeans(data[, c("ehi5.10_pref_read", "ehi5.10_pref_music", + "ehi5.10_pref_TV", "ehi5.10_pref_nap", + "ehi5.10_pref_travel")], na.rm = TRUE) + +data$ehi5.10_pers_MEAN <- rowMeans(data[, c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", + "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", + "ehi5.10_pers_complex")], na.rm = TRUE) + +data$ehi5.10_val_MEAN <- rowMeans(data[, c("ehi5.10_val_obey", "ehi5.10_val_trad", + "ehi5.10_val_opinion", "ehi5.10_val_performance", + "ehi5.10_val_justice")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 14 - all ehi global means_20251008171057.r b/.history/eohi2/datap 14 - all ehi global means_20251008171057.r new file mode 100644 index 0000000..4dae188 --- /dev/null +++ b/.history/eohi2/datap 14 - all ehi global means_20251008171057.r @@ -0,0 +1,142 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate global mean scores for EHI variables across time intervals + +# === DGEN 5-YEAR GLOBAL MEAN === +data$ehiDGEN_5_mean <- rowMeans(data[, c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", + "ehiDGEN_5_Val")], na.rm = TRUE) + +# === DGEN 10-YEAR GLOBAL MEAN === +data$ehiDGEN_10_mean <- rowMeans(data[, c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", + "ehiDGEN_10_Val")], na.rm = TRUE) + +# === 5-YEAR GLOBAL MEAN === +data$ehi5_global_mean <- rowMeans(data[, c("ehi5_pref_MEAN", "ehi5_pers_MEAN", + "ehi5_val_MEAN")], na.rm = TRUE) + +# === 10-YEAR GLOBAL MEAN === +data$ehi10_global_mean <- rowMeans(data[, c("ehi10_pref_MEAN", "ehi10_pers_MEAN", + "ehi10_val_MEAN")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE GLOBAL MEAN === +data$ehi5.10_global_mean <- rowMeans(data[, c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", + "ehi5.10_val_MEAN")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 14 - all ehi global means_20251008171120.r b/.history/eohi2/datap 14 - all ehi global means_20251008171120.r new file mode 100644 index 0000000..ee10ed8 --- /dev/null +++ b/.history/eohi2/datap 14 - all ehi global means_20251008171120.r @@ -0,0 +1,150 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate global mean scores for EHI variables across time intervals + +# === DGEN 5-YEAR GLOBAL MEAN === +data$ehiDGEN_5_mean <- rowMeans(data[, c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", + "ehiDGEN_5_Val")], na.rm = TRUE) + +# === DGEN 10-YEAR GLOBAL MEAN === +data$ehiDGEN_10_mean <- rowMeans(data[, c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", + "ehiDGEN_10_Val")], na.rm = TRUE) + +# === 5-YEAR GLOBAL MEAN === +data$ehi5_global_mean <- rowMeans(data[, c("ehi5_pref_MEAN", "ehi5_pers_MEAN", + "ehi5_val_MEAN")], na.rm = TRUE) + +# === 10-YEAR GLOBAL MEAN === +data$ehi10_global_mean <- rowMeans(data[, c("ehi10_pref_MEAN", "ehi10_pers_MEAN", + "ehi10_val_MEAN")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE GLOBAL MEAN === +data$ehi5.10_global_mean <- rowMeans(data[, c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", + "ehi5.10_val_MEAN")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI global mean calculations\n\n") + +cat("--- FIRST 5 ROWS: DGEN 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_5_Pref[i], data$ehiDGEN_5_Pers[i], + data$ehiDGEN_5_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_5_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: DGEN 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_10_Pref[i], data$ehiDGEN_10_Pers[i], + data$ehiDGEN_10_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_10_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_MEAN[i], data$ehi5_pers_MEAN[i], + data$ehi5_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_MEAN[i], data$ehi10_pers_MEAN[i], + data$ehi10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_MEAN[i], data$ehi5.10_pers_MEAN[i], + data$ehi5.10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 14 - all ehi global means_20251008171136.r b/.history/eohi2/datap 14 - all ehi global means_20251008171136.r new file mode 100644 index 0000000..d1fa875 --- /dev/null +++ b/.history/eohi2/datap 14 - all ehi global means_20251008171136.r @@ -0,0 +1,140 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate global mean scores for EHI variables across time intervals + +# === DGEN 5-YEAR GLOBAL MEAN === +data$ehiDGEN_5_mean <- rowMeans(data[, c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", + "ehiDGEN_5_Val")], na.rm = TRUE) + +# === DGEN 10-YEAR GLOBAL MEAN === +data$ehiDGEN_10_mean <- rowMeans(data[, c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", + "ehiDGEN_10_Val")], na.rm = TRUE) + +# === 5-YEAR GLOBAL MEAN === +data$ehi5_global_mean <- rowMeans(data[, c("ehi5_pref_MEAN", "ehi5_pers_MEAN", + "ehi5_val_MEAN")], na.rm = TRUE) + +# === 10-YEAR GLOBAL MEAN === +data$ehi10_global_mean <- rowMeans(data[, c("ehi10_pref_MEAN", "ehi10_pers_MEAN", + "ehi10_val_MEAN")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE GLOBAL MEAN === +data$ehi5.10_global_mean <- rowMeans(data[, c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", + "ehi5.10_val_MEAN")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI global mean calculations\n\n") + +cat("--- FIRST 5 ROWS: DGEN 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_5_Pref[i], data$ehiDGEN_5_Pers[i], + data$ehiDGEN_5_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_5_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: DGEN 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_10_Pref[i], data$ehiDGEN_10_Pers[i], + data$ehiDGEN_10_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_10_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_MEAN[i], data$ehi5_pers_MEAN[i], + data$ehi5_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_MEAN[i], data$ehi10_pers_MEAN[i], + data$ehi10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_MEAN[i], data$ehi5.10_pers_MEAN[i], + data$ehi5.10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # DGEN global means + list(vars = c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val"), + target = "ehiDGEN_5_mean", name = "DGEN 5-Year Global"), + list(vars = c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val"), + target = "ehiDGEN_10_mean", name = "DGEN 10-Year Global"), + + # Domain-specific global means + list(vars = c("ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN"), + target = "ehi5_global_mean", name = "5-Year Global"), + list(vars = c("ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN"), + target = "ehi10_global_mean", name = "10-Year Global"), + list(vars = c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN"), + target = "ehi5.10_global_mean", name = "5-10 Year Change Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 14 - all ehi global means_20251008171157.r b/.history/eohi2/datap 14 - all ehi global means_20251008171157.r new file mode 100644 index 0000000..d1fa875 --- /dev/null +++ b/.history/eohi2/datap 14 - all ehi global means_20251008171157.r @@ -0,0 +1,140 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate global mean scores for EHI variables across time intervals + +# === DGEN 5-YEAR GLOBAL MEAN === +data$ehiDGEN_5_mean <- rowMeans(data[, c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", + "ehiDGEN_5_Val")], na.rm = TRUE) + +# === DGEN 10-YEAR GLOBAL MEAN === +data$ehiDGEN_10_mean <- rowMeans(data[, c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", + "ehiDGEN_10_Val")], na.rm = TRUE) + +# === 5-YEAR GLOBAL MEAN === +data$ehi5_global_mean <- rowMeans(data[, c("ehi5_pref_MEAN", "ehi5_pers_MEAN", + "ehi5_val_MEAN")], na.rm = TRUE) + +# === 10-YEAR GLOBAL MEAN === +data$ehi10_global_mean <- rowMeans(data[, c("ehi10_pref_MEAN", "ehi10_pers_MEAN", + "ehi10_val_MEAN")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE GLOBAL MEAN === +data$ehi5.10_global_mean <- rowMeans(data[, c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", + "ehi5.10_val_MEAN")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI global mean calculations\n\n") + +cat("--- FIRST 5 ROWS: DGEN 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_5_Pref[i], data$ehiDGEN_5_Pers[i], + data$ehiDGEN_5_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_5_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: DGEN 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_10_Pref[i], data$ehiDGEN_10_Pers[i], + data$ehiDGEN_10_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_10_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_MEAN[i], data$ehi5_pers_MEAN[i], + data$ehi5_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_MEAN[i], data$ehi10_pers_MEAN[i], + data$ehi10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_MEAN[i], data$ehi5.10_pers_MEAN[i], + data$ehi5.10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # DGEN global means + list(vars = c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val"), + target = "ehiDGEN_5_mean", name = "DGEN 5-Year Global"), + list(vars = c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val"), + target = "ehiDGEN_10_mean", name = "DGEN 10-Year Global"), + + # Domain-specific global means + list(vars = c("ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN"), + target = "ehi5_global_mean", name = "5-Year Global"), + list(vars = c("ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN"), + target = "ehi10_global_mean", name = "10-Year Global"), + list(vars = c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN"), + target = "ehi5.10_global_mean", name = "5-10 Year Change Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 14 - all ehi global means_20251008171250.r b/.history/eohi2/datap 14 - all ehi global means_20251008171250.r new file mode 100644 index 0000000..d1fa875 --- /dev/null +++ b/.history/eohi2/datap 14 - all ehi global means_20251008171250.r @@ -0,0 +1,140 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate global mean scores for EHI variables across time intervals + +# === DGEN 5-YEAR GLOBAL MEAN === +data$ehiDGEN_5_mean <- rowMeans(data[, c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", + "ehiDGEN_5_Val")], na.rm = TRUE) + +# === DGEN 10-YEAR GLOBAL MEAN === +data$ehiDGEN_10_mean <- rowMeans(data[, c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", + "ehiDGEN_10_Val")], na.rm = TRUE) + +# === 5-YEAR GLOBAL MEAN === +data$ehi5_global_mean <- rowMeans(data[, c("ehi5_pref_MEAN", "ehi5_pers_MEAN", + "ehi5_val_MEAN")], na.rm = TRUE) + +# === 10-YEAR GLOBAL MEAN === +data$ehi10_global_mean <- rowMeans(data[, c("ehi10_pref_MEAN", "ehi10_pers_MEAN", + "ehi10_val_MEAN")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE GLOBAL MEAN === +data$ehi5.10_global_mean <- rowMeans(data[, c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", + "ehi5.10_val_MEAN")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI global mean calculations\n\n") + +cat("--- FIRST 5 ROWS: DGEN 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_5_Pref[i], data$ehiDGEN_5_Pers[i], + data$ehiDGEN_5_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_5_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: DGEN 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_10_Pref[i], data$ehiDGEN_10_Pers[i], + data$ehiDGEN_10_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_10_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_MEAN[i], data$ehi5_pers_MEAN[i], + data$ehi5_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_MEAN[i], data$ehi10_pers_MEAN[i], + data$ehi10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_MEAN[i], data$ehi5.10_pers_MEAN[i], + data$ehi5.10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # DGEN global means + list(vars = c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val"), + target = "ehiDGEN_5_mean", name = "DGEN 5-Year Global"), + list(vars = c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val"), + target = "ehiDGEN_10_mean", name = "DGEN 10-Year Global"), + + # Domain-specific global means + list(vars = c("ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN"), + target = "ehi5_global_mean", name = "5-Year Global"), + list(vars = c("ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN"), + target = "ehi10_global_mean", name = "10-Year Global"), + list(vars = c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN"), + target = "ehi5.10_global_mean", name = "5-10 Year Change Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/.history/eohi2/datap 15 - education recoded ordinal 3_20251027135156.r b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027135156.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/datap 15 - education recoded ordinal 3_20251027135157.r b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027135157.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027135157.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/datap 15 - education recoded ordinal 3_20251027141418.r b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027141418.r new file mode 100644 index 0000000..3b820ba --- /dev/null +++ b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027141418.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +data <- read.csv("eohi2.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +# write.csv(data, "eohi2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/datap 15 - education recoded ordinal 3_20251027143845.r b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027143845.r new file mode 100644 index 0000000..33ae8e7 --- /dev/null +++ b/.history/eohi2/datap 15 - education recoded ordinal 3_20251027143845.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +data <- read.csv("eohi2.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "eohi2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/datap 16 - ehi vars standardized _20251029120227.r b/.history/eohi2/datap 16 - ehi vars standardized _20251029120227.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/datap 16 - ehi vars standardized _20251029120228.r b/.history/eohi2/datap 16 - ehi vars standardized _20251029120228.r new file mode 100644 index 0000000..51562a9 --- /dev/null +++ b/.history/eohi2/datap 16 - ehi vars standardized _20251029120228.r @@ -0,0 +1,7 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") \ No newline at end of file diff --git a/.history/eohi2/datap 16 - ehi vars standardized _20251029120234.r b/.history/eohi2/datap 16 - ehi vars standardized _20251029120234.r new file mode 100644 index 0000000..51562a9 --- /dev/null +++ b/.history/eohi2/datap 16 - ehi vars standardized _20251029120234.r @@ -0,0 +1,7 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") \ No newline at end of file diff --git a/.history/eohi2/datap 16 - ehi vars standardized _20251029121728.r b/.history/eohi2/datap 16 - ehi vars standardized _20251029121728.r new file mode 100644 index 0000000..b4ba92f --- /dev/null +++ b/.history/eohi2/datap 16 - ehi vars standardized _20251029121728.r @@ -0,0 +1,49 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +# Display means and standard deviations of non-standardized variables for manual checking +print(round(mean(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi10_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi10_global_mean, na.rm = TRUE), 5)) + +# Calculate means and standard deviations for standardization +mean_DGEN_5 <- mean(df$ehiDGEN_5_mean, na.rm = TRUE) +sd_DGEN_5 <- sd(df$ehiDGEN_5_mean, na.rm = TRUE) + +mean_DGEN_10 <- mean(df$ehiDGEN_10_mean, na.rm = TRUE) +sd_DGEN_10 <- sd(df$ehiDGEN_10_mean, na.rm = TRUE) + +mean_DS_5 <- mean(df$ehi5_global_mean, na.rm = TRUE) +sd_DS_5 <- sd(df$ehi5_global_mean, na.rm = TRUE) + +mean_DS_10 <- mean(df$ehi10_global_mean, na.rm = TRUE) +sd_DS_10 <- sd(df$ehi10_global_mean, na.rm = TRUE) + +# Create standardized variables +df$stdDGEN_5 <- (df$ehiDGEN_5_mean - mean_DGEN_5) / sd_DGEN_5 +df$stdDGEN_10 <- (df$ehiDGEN_10_mean - mean_DGEN_10) / sd_DGEN_10 +df$stdDS_5 <- (df$ehi5_global_mean - mean_DS_5) / sd_DS_5 +df$stdDS_10 <- (df$ehi10_global_mean - mean_DS_10) / sd_DS_10 + +# Check that variables have been standardized +print(round(mean(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_10, na.rm = TRUE), 5)) + +# Calculate mean of standardized variables +df$stdEHI_mean <- rowMeans(df[, c("stdDGEN_5", "stdDGEN_10", "stdDS_5", "stdDS_10")], na.rm = TRUE) \ No newline at end of file diff --git a/.history/eohi2/datap 16 - ehi vars standardized _20251029122336.r b/.history/eohi2/datap 16 - ehi vars standardized _20251029122336.r new file mode 100644 index 0000000..2cb7082 --- /dev/null +++ b/.history/eohi2/datap 16 - ehi vars standardized _20251029122336.r @@ -0,0 +1,99 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +# Display means and standard deviations of non-standardized variables for manual checking +print(round(mean(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi10_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi10_global_mean, na.rm = TRUE), 5)) + +# Calculate means and standard deviations for standardization +mean_DGEN_5 <- mean(df$ehiDGEN_5_mean, na.rm = TRUE) +sd_DGEN_5 <- sd(df$ehiDGEN_5_mean, na.rm = TRUE) + +mean_DGEN_10 <- mean(df$ehiDGEN_10_mean, na.rm = TRUE) +sd_DGEN_10 <- sd(df$ehiDGEN_10_mean, na.rm = TRUE) + +mean_DS_5 <- mean(df$ehi5_global_mean, na.rm = TRUE) +sd_DS_5 <- sd(df$ehi5_global_mean, na.rm = TRUE) + +mean_DS_10 <- mean(df$ehi10_global_mean, na.rm = TRUE) +sd_DS_10 <- sd(df$ehi10_global_mean, na.rm = TRUE) + +# Create standardized variables +df$stdDGEN_5 <- (df$ehiDGEN_5_mean - mean_DGEN_5) / sd_DGEN_5 +df$stdDGEN_10 <- (df$ehiDGEN_10_mean - mean_DGEN_10) / sd_DGEN_10 +df$stdDS_5 <- (df$ehi5_global_mean - mean_DS_5) / sd_DS_5 +df$stdDS_10 <- (df$ehi10_global_mean - mean_DS_10) / sd_DS_10 + +# Check that variables have been standardized +print(round(mean(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_10, na.rm = TRUE), 5)) + +# Calculate mean of standardized variables +df$stdEHI_mean <- rowMeans(df[, c("stdDGEN_5", "stdDGEN_10", "stdDS_5", "stdDS_10")], na.rm = TRUE) + +#### check random 10 rows + +# Check 10 random rows to verify calculations +set.seed(123) # For reproducible random selection +random_rows <- sample(nrow(df), 10) + +cat("Checking 10 random rows:\n") +cat("Row | ehiDGEN_5_mean | stdDGEN_5 | Calculation | ehiDGEN_10_mean | stdDGEN_10 | Calculation\n") +cat("----|----------------|-----------|-------------|-----------------|------------|------------\n") + +for(i in random_rows) { + orig_5 <- df$ehiDGEN_5_mean[i] + std_5 <- df$stdDGEN_5[i] + calc_5 <- (orig_5 - mean_DGEN_5) / sd_DGEN_5 + + orig_10 <- df$ehiDGEN_10_mean[i] + std_10 <- df$stdDGEN_10[i] + calc_10 <- (orig_10 - mean_DGEN_10) / sd_DGEN_10 + + cat(sprintf("%3d | %13.5f | %9.5f | %11.5f | %15.5f | %10.5f | %11.5f\n", + i, orig_5, std_5, calc_5, orig_10, std_10, calc_10)) +} + +cat("\nRow | ehi5_global_mean | stdDS_5 | Calculation | ehi10_global_mean | stdDS_10 | Calculation\n") +cat("----|------------------|---------|-------------|-------------------|----------|------------\n") + +for(i in random_rows) { + orig_5 <- df$ehi5_global_mean[i] + std_5 <- df$stdDS_5[i] + calc_5 <- (orig_5 - mean_DS_5) / sd_DS_5 + + orig_10 <- df$ehi10_global_mean[i] + std_10 <- df$stdDS_10[i] + calc_10 <- (orig_10 - mean_DS_10) / sd_DS_10 + + cat(sprintf("%3d | %16.5f | %8.5f | %11.5f | %17.5f | %9.5f | %11.5f\n", + i, orig_5, std_5, calc_5, orig_10, std_10, calc_10)) +} + +# Show the final stdEHI_mean for these rows +cat("\nRow | stdEHI_mean | Manual calc\n") +cat("----|-------------|------------\n") +for(i in random_rows) { + manual_mean <- mean(c(df$stdDGEN_5[i], df$stdDGEN_10[i], df$stdDS_5[i], df$stdDS_10[i]), na.rm = TRUE) + cat(sprintf("%3d | %11.5f | %11.5f\n", i, df$stdEHI_mean[i], manual_mean)) +} + +# Write to CSV +write.csv(df, "eohi2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/datap 16 - ehi vars standardized _20251029124145.r b/.history/eohi2/datap 16 - ehi vars standardized _20251029124145.r new file mode 100644 index 0000000..01e0592 --- /dev/null +++ b/.history/eohi2/datap 16 - ehi vars standardized _20251029124145.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +# Display means and standard deviations of non-standardized variables for manual checking +print(round(mean(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi10_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi10_global_mean, na.rm = TRUE), 5)) + +# Calculate means and standard deviations for standardization +mean_DGEN_5 <- mean(df$ehiDGEN_5_mean, na.rm = TRUE) +sd_DGEN_5 <- sd(df$ehiDGEN_5_mean, na.rm = TRUE) + +mean_DGEN_10 <- mean(df$ehiDGEN_10_mean, na.rm = TRUE) +sd_DGEN_10 <- sd(df$ehiDGEN_10_mean, na.rm = TRUE) + +mean_DS_5 <- mean(df$ehi5_global_mean, na.rm = TRUE) +sd_DS_5 <- sd(df$ehi5_global_mean, na.rm = TRUE) + +mean_DS_10 <- mean(df$ehi10_global_mean, na.rm = TRUE) +sd_DS_10 <- sd(df$ehi10_global_mean, na.rm = TRUE) + +# Create standardized variables +df$stdDGEN_5 <- (df$ehiDGEN_5_mean - mean_DGEN_5) / sd_DGEN_5 +df$stdDGEN_10 <- (df$ehiDGEN_10_mean - mean_DGEN_10) / sd_DGEN_10 +df$stdDS_5 <- (df$ehi5_global_mean - mean_DS_5) / sd_DS_5 +df$stdDS_10 <- (df$ehi10_global_mean - mean_DS_10) / sd_DS_10 + +# Check that variables have been standardized +print(round(mean(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_10, na.rm = TRUE), 5)) + +# Calculate mean of standardized variables +df$stdEHI_mean <- rowMeans(df[, c("stdDGEN_5", "stdDGEN_10", "stdDS_5", "stdDS_10")], na.rm = TRUE) + +#### check random 10 rows + +# Check 10 random rows to verify calculations +set.seed(123) # For reproducible random selection +random_rows <- sample(nrow(df), 10) + +cat("Checking 10 random rows:\n") +cat("Row | ehiDGEN_5_mean | stdDGEN_5 | Calculation | ehiDGEN_10_mean | stdDGEN_10 | Calculation\n") +cat("----|----------------|-----------|-------------|-----------------|------------|------------\n") + +for(i in random_rows) { + orig_5 <- df$ehiDGEN_5_mean[i] + std_5 <- df$stdDGEN_5[i] + calc_5 <- (orig_5 - mean_DGEN_5) / sd_DGEN_5 + + orig_10 <- df$ehiDGEN_10_mean[i] + std_10 <- df$stdDGEN_10[i] + calc_10 <- (orig_10 - mean_DGEN_10) / sd_DGEN_10 + + cat(sprintf("%3d | %13.5f | %9.5f | %11.5f | %15.5f | %10.5f | %11.5f\n", + i, orig_5, std_5, calc_5, orig_10, std_10, calc_10)) +} + +cat("\nRow | ehi5_global_mean | stdDS_5 | Calculation | ehi10_global_mean | stdDS_10 | Calculation\n") +cat("----|------------------|---------|-------------|-------------------|----------|------------\n") + +for(i in random_rows) { + orig_5 <- df$ehi5_global_mean[i] + std_5 <- df$stdDS_5[i] + calc_5 <- (orig_5 - mean_DS_5) / sd_DS_5 + + orig_10 <- df$ehi10_global_mean[i] + std_10 <- df$stdDS_10[i] + calc_10 <- (orig_10 - mean_DS_10) / sd_DS_10 + + cat(sprintf("%3d | %16.5f | %8.5f | %11.5f | %17.5f | %9.5f | %11.5f\n", + i, orig_5, std_5, calc_5, orig_10, std_10, calc_10)) +} + +# Show the final stdEHI_mean for these rows +cat("\nRow | stdEHI_mean | Manual calc\n") +cat("----|-------------|------------\n") +for(i in random_rows) { + manual_mean <- -0.042564413 -0.158849227 -1.444812436 -0.23426232 -0.470122099 +mean(c(df$stdDGEN_5[i], df$stdDGEN_10[i], df$stdDS_5[i], df$stdDS_10[i]), na.rm = TRUE) + cat(sprintf("%3d | %11.5f | %11.5f\n", i, df$stdEHI_mean[i], manual_mean)) +} + +# Write to CSV +write.csv(df, "eohi2.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/e2 - correlation matrix_20251027143921.r b/.history/eohi2/e2 - correlation matrix_20251027143921.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/e2 - correlation matrix_20251027143922.r b/.history/eohi2/e2 - correlation matrix_20251027143922.r new file mode 100644 index 0000000..4b1a8a7 --- /dev/null +++ b/.history/eohi2/e2 - correlation matrix_20251027143922.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/e2 - correlation matrix_20251027144718.r b/.history/eohi2/e2 - correlation matrix_20251027144718.r new file mode 100644 index 0000000..a9995fe --- /dev/null +++ b/.history/eohi2/e2 - correlation matrix_20251027144718.r @@ -0,0 +1,105 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/e2 - correlation matrix_20251027145122.r b/.history/eohi2/e2 - correlation matrix_20251027145122.r new file mode 100644 index 0000000..755cd29 --- /dev/null +++ b/.history/eohi2/e2 - correlation matrix_20251027145122.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/e2 - correlation matrix_20251027145125.r b/.history/eohi2/e2 - correlation matrix_20251027145125.r new file mode 100644 index 0000000..755cd29 --- /dev/null +++ b/.history/eohi2/e2 - correlation matrix_20251027145125.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/e2 - correlation matrix_20251027145133.r b/.history/eohi2/e2 - correlation matrix_20251027145133.r new file mode 100644 index 0000000..755cd29 --- /dev/null +++ b/.history/eohi2/e2 - correlation matrix_20251027145133.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003144019.r b/.history/eohi2/mixed anova - DGEN_20251003144019.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/mixed anova - DGEN_20251003144020.r b/.history/eohi2/mixed anova - DGEN_20251003144020.r new file mode 100644 index 0000000..cf12456 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003144020.r @@ -0,0 +1,21 @@ +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150009.r b/.history/eohi2/mixed anova - DGEN_20251003150009.r new file mode 100644 index 0000000..c8fa38b --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150009.r @@ -0,0 +1,169 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150038.r b/.history/eohi2/mixed anova - DGEN_20251003150038.r new file mode 100644 index 0000000..396cca4 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150038.r @@ -0,0 +1,360 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150047.r b/.history/eohi2/mixed anova - DGEN_20251003150047.r new file mode 100644 index 0000000..396cca4 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150047.r @@ -0,0 +1,360 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150106.r b/.history/eohi2/mixed anova - DGEN_20251003150106.r new file mode 100644 index 0000000..472bcca --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150106.r @@ -0,0 +1,466 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150128.r b/.history/eohi2/mixed anova - DGEN_20251003150128.r new file mode 100644 index 0000000..30f04f6 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150128.r @@ -0,0 +1,466 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150130.r b/.history/eohi2/mixed anova - DGEN_20251003150130.r new file mode 100644 index 0000000..8eab899 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150130.r @@ -0,0 +1,466 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150137.r b/.history/eohi2/mixed anova - DGEN_20251003150137.r new file mode 100644 index 0000000..9d3b58d --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150137.r @@ -0,0 +1,466 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150143.r b/.history/eohi2/mixed anova - DGEN_20251003150143.r new file mode 100644 index 0000000..9d34a95 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150143.r @@ -0,0 +1,735 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("DOMAIN = %s, INTERVAL = %s:\n", domain_level, interval_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") +print("The analysis includes:") +print("- Descriptive statistics by all factor combinations") +print("- Comprehensive assumption testing (normality, homogeneity of variance, Hartley's F-max)") +print("- Mixed ANOVA with sphericity corrections") +print("- Effect sizes (generalized eta squared)") +print("- Post-hoc comparisons with Bonferroni correction") +print("- Cohen's d calculations for significant effects") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150144.r b/.history/eohi2/mixed anova - DGEN_20251003150144.r new file mode 100644 index 0000000..9d34a95 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150144.r @@ -0,0 +1,735 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("DOMAIN = %s, INTERVAL = %s:\n", domain_level, interval_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") +print("The analysis includes:") +print("- Descriptive statistics by all factor combinations") +print("- Comprehensive assumption testing (normality, homogeneity of variance, Hartley's F-max)") +print("- Mixed ANOVA with sphericity corrections") +print("- Effect sizes (generalized eta squared)") +print("- Post-hoc comparisons with Bonferroni correction") +print("- Cohen's d calculations for significant effects") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150214.r b/.history/eohi2/mixed anova - DGEN_20251003150214.r new file mode 100644 index 0000000..9d34a95 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150214.r @@ -0,0 +1,735 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("DOMAIN = %s, INTERVAL = %s:\n", domain_level, interval_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") +print("The analysis includes:") +print("- Descriptive statistics by all factor combinations") +print("- Comprehensive assumption testing (normality, homogeneity of variance, Hartley's F-max)") +print("- Mixed ANOVA with sphericity corrections") +print("- Effect sizes (generalized eta squared)") +print("- Post-hoc comparisons with Bonferroni correction") +print("- Cohen's d calculations for significant effects") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150251.r b/.history/eohi2/mixed anova - DGEN_20251003150251.r new file mode 100644 index 0000000..b56557e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150251.r @@ -0,0 +1,736 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("DOMAIN = %s, INTERVAL = %s:\n", domain_level, interval_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") +print("The analysis includes:") +print("- Descriptive statistics by all factor combinations") +print("- Comprehensive assumption testing (normality, homogeneity of variance, Hartley's F-max)") +print("- Mixed ANOVA with sphericity corrections") +print("- Effect sizes (generalized eta squared)") +print("- Post-hoc comparisons with Bonferroni correction") +print("- Cohen's d calculations for significant effects") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150313.r b/.history/eohi2/mixed anova - DGEN_20251003150313.r new file mode 100644 index 0000000..883b33b --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150313.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("DOMAIN = %s, INTERVAL = %s:\n", domain_level, interval_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") +print("The analysis includes:") +print("- Descriptive statistics by all factor combinations") +print("- Comprehensive assumption testing (normality, homogeneity of variance, Hartley's F-max)") +print("- Mixed ANOVA with sphericity corrections") +print("- Effect sizes (generalized eta squared)") +print("- Post-hoc comparisons with Bonferroni correction") +print("- Cohen's d calculations for significant effects") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150330.r b/.history/eohi2/mixed anova - DGEN_20251003150330.r new file mode 100644 index 0000000..f117c81 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150330.r @@ -0,0 +1,759 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("\n=== ANALYSIS COMPLETE ===") +print("All significant and marginal effects have been analyzed with Cohen's d calculations.") +print("The analysis includes:") +print("- Descriptive statistics by all factor combinations") +print("- Comprehensive assumption testing (normality, homogeneity of variance, Hartley's F-max)") +print("- Mixed ANOVA with sphericity corrections") +print("- Effect sizes (generalized eta squared)") +print("- Post-hoc comparisons with Bonferroni correction") +print("- Cohen's d calculations for significant effects") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150337.r b/.history/eohi2/mixed anova - DGEN_20251003150337.r new file mode 100644 index 0000000..6b53f74 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150337.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003150346.r b/.history/eohi2/mixed anova - DGEN_20251003150346.r new file mode 100644 index 0000000..6b53f74 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003150346.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003152314.r b/.history/eohi2/mixed anova - DGEN_20251003152314.r new file mode 100644 index 0000000..6b53f74 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003152314.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, temporal_DO, interval_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(pID), + temporal_DO = as.factor(temporal_DO), + interval_DO = as.factor(interval_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003170643.r b/.history/eohi2/mixed anova - DGEN_20251003170643.r new file mode 100644 index 0000000..86b9512 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003170643.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003170646.r b/.history/eohi2/mixed anova - DGEN_20251003170646.r new file mode 100644 index 0000000..7ea184c --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003170646.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003170651.r b/.history/eohi2/mixed anova - DGEN_20251003170651.r new file mode 100644 index 0000000..7ea184c --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003170651.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003170811.r b/.history/eohi2/mixed anova - DGEN_20251003170811.r new file mode 100644 index 0000000..7ea184c --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003170811.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003171114.r b/.history/eohi2/mixed anova - DGEN_20251003171114.r new file mode 100644 index 0000000..04b5eb1 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003171114.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003171117.r b/.history/eohi2/mixed anova - DGEN_20251003171117.r new file mode 100644 index 0000000..d83e68e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003171117.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003171121.r b/.history/eohi2/mixed anova - DGEN_20251003171121.r new file mode 100644 index 0000000..d83e68e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003171121.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251003171149.r b/.history/eohi2/mixed anova - DGEN_20251003171149.r new file mode 100644 index 0000000..d83e68e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251003171149.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006125954.r b/.history/eohi2/mixed anova - DGEN_20251006125954.r new file mode 100644 index 0000000..d83e68e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006125954.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006191142.r b/.history/eohi2/mixed anova - DGEN_20251006191142.r new file mode 100644 index 0000000..d83e68e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006191142.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required DGEN variables found!") +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values", "Preferences", "Personality", "Values"), 2), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +# Variable mapping created +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192531.r b/.history/eohi2/mixed anova - DGEN_20251006192531.r new file mode 100644 index 0000000..203e8dc --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192531.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192540.r b/.history/eohi2/mixed anova - DGEN_20251006192540.r new file mode 100644 index 0000000..8ad4b4b --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192540.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) +print("Factor levels:") +print(paste("TIME:", paste(levels(long_data$TIME), collapse = ", "))) +print(paste("DOMAIN:", paste(levels(long_data$DOMAIN), collapse = ", "))) +print(paste("INTERVAL:", paste(levels(long_data$INTERVAL), collapse = ", "))) +print(paste("temporal_DO:", paste(levels(long_data$temporal_DO), collapse = ", "))) +print(paste("interval_DO:", paste(levels(long_data$interval_DO), collapse = ", "))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192548.r b/.history/eohi2/mixed anova - DGEN_20251006192548.r new file mode 100644 index 0000000..262803e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192548.r @@ -0,0 +1,740 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192554.r b/.history/eohi2/mixed anova - DGEN_20251006192554.r new file mode 100644 index 0000000..c1af0c3 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192554.r @@ -0,0 +1,739 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), temporal_DO (", + length(levels(long_data_clean$temporal_DO)), "), interval_DO (", + length(levels(long_data_clean$interval_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192606.r b/.history/eohi2/mixed anova - DGEN_20251006192606.r new file mode 100644 index 0000000..0d91911 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192606.r @@ -0,0 +1,726 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192619.r b/.history/eohi2/mixed anova - DGEN_20251006192619.r new file mode 100644 index 0000000..0569e40 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192619.r @@ -0,0 +1,724 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192629.r b/.history/eohi2/mixed anova - DGEN_20251006192629.r new file mode 100644 index 0000000..d77b2a9 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192629.r @@ -0,0 +1,723 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192639.r b/.history/eohi2/mixed anova - DGEN_20251006192639.r new file mode 100644 index 0000000..825435e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192639.r @@ -0,0 +1,719 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("\nMain Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("\nMain Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192701.r b/.history/eohi2/mixed anova - DGEN_20251006192701.r new file mode 100644 index 0000000..3eb8e1b --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192701.r @@ -0,0 +1,713 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("\n=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print("Estimated Marginal Means:") +print(time_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each TIME:") +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) + +print("\nSimple Effects of TIME within each INTERVAL:") +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("\n=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(domain_interval_emmeans) + +print("\nSimple Effects of INTERVAL within each DOMAIN:") +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) + +print("\nSimple Effects of DOMAIN within each INTERVAL:") +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192716.r b/.history/eohi2/mixed anova - DGEN_20251006192716.r new file mode 100644 index 0000000..41f6a3a --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192716.r @@ -0,0 +1,698 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("\n=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print("Estimated Marginal Means:") +print(temporal_interval_do_emmeans) + +print("\nSimple Effects of interval_DO within each temporal_DO:") +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) + +print("\nSimple Effects of temporal_DO within each interval_DO:") +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("\n=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each DOMAIN × INTERVAL combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("\n=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each temporal_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of temporal_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192735.r b/.history/eohi2/mixed anova - DGEN_20251006192735.r new file mode 100644 index 0000000..2d69e65 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192735.r @@ -0,0 +1,685 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print("Significant pairwise comparisons (p < 0.05):") + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192745.r b/.history/eohi2/mixed anova - DGEN_20251006192745.r new file mode 100644 index 0000000..e06ac4c --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192745.r @@ -0,0 +1,684 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print("Cohen's d results:") + print(cohens_d_results) + } + } else { + print("No significant pairwise comparisons found.") + } +} + +# Calculate Cohen's d for main effects +print("Cohen's d for significant main effects:") +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +print("\nCohen's d for significant two-way interactions:") +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +print("\nCohen's d for significant three-way interaction effects:") +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192802.r b/.history/eohi2/mixed anova - DGEN_20251006192802.r new file mode 100644 index 0000000..249e41e --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192802.r @@ -0,0 +1,680 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print("Three-way interaction Cohen's d results:") + print(three_way_cohens_d) + } +} else { + print("No significant TIME effects found within any DOMAIN × INTERVAL combination.") +} + +print("=== ANALYSIS COMPLETE ===") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192817.r b/.history/eohi2/mixed anova - DGEN_20251006192817.r new file mode 100644 index 0000000..43d0610 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192817.r @@ -0,0 +1,677 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192843.r b/.history/eohi2/mixed anova - DGEN_20251006192843.r new file mode 100644 index 0000000..a76ed71 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192843.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192917.r b/.history/eohi2/mixed anova - DGEN_20251006192917.r new file mode 100644 index 0000000..a76ed71 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192917.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006192940.r b/.history/eohi2/mixed anova - DGEN_20251006192940.r new file mode 100644 index 0000000..a76ed71 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006192940.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "DGEN_5.10past_Pref", "DGEN_5.10past_Pers", "DGEN_5.10past_Val", + "DGEN_5.10fut_Pref", "DGEN_5.10fut_Pers", "DGEN_5.10fut_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193221.r b/.history/eohi2/mixed anova - DGEN_20251006193221.r new file mode 100644 index 0000000..5006e8f --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193221.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193234.r b/.history/eohi2/mixed anova - DGEN_20251006193234.r new file mode 100644 index 0000000..d71b975 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193234.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193243.r b/.history/eohi2/mixed anova - DGEN_20251006193243.r new file mode 100644 index 0000000..0e107cd --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193243.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193252.r b/.history/eohi2/mixed anova - DGEN_20251006193252.r new file mode 100644 index 0000000..e780b11 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193252.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193310.r b/.history/eohi2/mixed anova - DGEN_20251006193310.r new file mode 100644 index 0000000..e780b11 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193310.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193311.r b/.history/eohi2/mixed anova - DGEN_20251006193311.r new file mode 100644 index 0000000..e780b11 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193311.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193509.r b/.history/eohi2/mixed anova - DGEN_20251006193509.r new file mode 100644 index 0000000..e780b11 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193509.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193537.r b/.history/eohi2/mixed anova - DGEN_20251006193537.r new file mode 100644 index 0000000..94424de --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193537.r @@ -0,0 +1,771 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# EXPLICIT CONTRASTS FOR TIME × INTERVAL +print("=== EXPLICIT TIME × INTERVAL CONTRASTS ===") + +# 1. 5past vs 5future +print("1. Interval 5: Past vs Future") +contrast_5past_5future <- contrast(time_interval_emmeans, + list("5: Past vs Future" = c(1, 0, -1, 0)), + adjust = "none") +print(contrast_5past_5future) + +# 2. 10past vs 10future +print("2. Interval 10: Past vs Future") +contrast_10past_10future <- contrast(time_interval_emmeans, + list("10: Past vs Future" = c(0, 1, 0, -1)), + adjust = "none") +print(contrast_10past_10future) + +# 3. (5-10)past vs (5-10)future - tests if the interval effect differs by time +print("3. Interaction contrast: (5-10)Past vs (5-10)Future") +contrast_interaction <- contrast(time_interval_emmeans, + list("(5-10)Past vs (5-10)Future" = c(1, -1, -1, 1)), + adjust = "none") +print(contrast_interaction) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006193540.r b/.history/eohi2/mixed anova - DGEN_20251006193540.r new file mode 100644 index 0000000..e780b11 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006193540.r @@ -0,0 +1,747 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 6), rep("Future", 6)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 4), + INTERVAL = rep(c("5", "5", "5", "10", "10", "10"), 2), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195204.r b/.history/eohi2/mixed anova - DGEN_20251006195204.r new file mode 100644 index 0000000..afe67a5 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195204.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195215.r b/.history/eohi2/mixed anova - DGEN_20251006195215.r new file mode 100644 index 0000000..6ccf702 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195215.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (2 levels: 5, 10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195225.r b/.history/eohi2/mixed anova - DGEN_20251006195225.r new file mode 100644 index 0000000..98db425 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195225.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195236.r b/.history/eohi2/mixed anova - DGEN_20251006195236.r new file mode 100644 index 0000000..de27f62 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195236.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195256.r b/.history/eohi2/mixed anova - DGEN_20251006195256.r new file mode 100644 index 0000000..de27f62 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195256.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195344.r b/.history/eohi2/mixed anova - DGEN_20251006195344.r new file mode 100644 index 0000000..de27f62 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195344.r @@ -0,0 +1,751 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195408.r b/.history/eohi2/mixed anova - DGEN_20251006195408.r new file mode 100644 index 0000000..4f657eb --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195408.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195422.r b/.history/eohi2/mixed anova - DGEN_20251006195422.r new file mode 100644 index 0000000..4f657eb --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195422.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006195559.r b/.history/eohi2/mixed anova - DGEN_20251006195559.r new file mode 100644 index 0000000..4f657eb --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006195559.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006200505.r b/.history/eohi2/mixed anova - DGEN_20251006200505.r new file mode 100644 index 0000000..9ff5786 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006200505.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "DGEN Score", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006200514.r b/.history/eohi2/mixed anova - DGEN_20251006200514.r new file mode 100644 index 0000000..9ff5786 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006200514.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "DGEN Score", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006200516.r b/.history/eohi2/mixed anova - DGEN_20251006200516.r new file mode 100644 index 0000000..9ff5786 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006200516.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "DGEN Score", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006201016.r b/.history/eohi2/mixed anova - DGEN_20251006201016.r new file mode 100644 index 0000000..da25662 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006201016.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006201021.r b/.history/eohi2/mixed anova - DGEN_20251006201021.r new file mode 100644 index 0000000..da25662 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006201021.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006201023.r b/.history/eohi2/mixed anova - DGEN_20251006201023.r new file mode 100644 index 0000000..da25662 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006201023.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006201057.r b/.history/eohi2/mixed anova - DGEN_20251006201057.r new file mode 100644 index 0000000..da25662 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006201057.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006230411.r b/.history/eohi2/mixed anova - DGEN_20251006230411.r new file mode 100644 index 0000000..da25662 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006230411.r @@ -0,0 +1,755 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006231257.r b/.history/eohi2/mixed anova - DGEN_20251006231257.r new file mode 100644 index 0000000..1eba15c --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006231257.r @@ -0,0 +1,775 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006231308.r b/.history/eohi2/mixed anova - DGEN_20251006231308.r new file mode 100644 index 0000000..af178eb --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006231308.r @@ -0,0 +1,830 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006231314.r b/.history/eohi2/mixed anova - DGEN_20251006231314.r new file mode 100644 index 0000000..af178eb --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006231314.r @@ -0,0 +1,830 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006231325.r b/.history/eohi2/mixed anova - DGEN_20251006231325.r new file mode 100644 index 0000000..af178eb --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006231325.r @@ -0,0 +1,830 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006231533.r b/.history/eohi2/mixed anova - DGEN_20251006231533.r new file mode 100644 index 0000000..4b83e72 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006231533.r @@ -0,0 +1,899 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006231538.r b/.history/eohi2/mixed anova - DGEN_20251006231538.r new file mode 100644 index 0000000..4b83e72 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006231538.r @@ -0,0 +1,899 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006232531.r b/.history/eohi2/mixed anova - DGEN_20251006232531.r new file mode 100644 index 0000000..26bd1f4 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006232531.r @@ -0,0 +1,1035 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# ============================================================================= +# TWO-WAY INTERACTION PLOTS +# ============================================================================= + +# ============================================================================= +# PLOT 1: TIME × INTERVAL INTERACTION (INTERVAL on x-axis) +# ============================================================================= + +# Create emmeans for TIME × INTERVAL +emm_time_interval_plot <- emmeans(aov_model, ~ TIME * INTERVAL) + +# Prepare emmeans data frame for TIME × INTERVAL plot +emmeans_time_interval_plot <- emm_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(INTERVAL), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × INTERVAL interaction plot +interaction_plot_time_interval <- ggplot(emmeans_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Interval", + y = "Absolute difference from the present", + title = "TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2, 3), + labels = c("5", "10", "5_10"), + limits = c(0.5, 3.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_interval) + +# ============================================================================= +# PLOT 2: TIME × temporal_DO INTERACTION (temporal_DO on x-axis) +# ============================================================================= + +# Create emmeans for TIME × temporal_DO +emm_time_temporal_plot <- emmeans(aov_model, ~ TIME * temporal_DO) + +# Prepare emmeans data frame for TIME × temporal_DO plot +emmeans_time_temporal_plot <- emm_time_temporal_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × temporal_DO interaction plot +interaction_plot_time_temporal <- ggplot(emmeans_time_temporal_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TIME × temporal_DO Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_temporal) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006232538.r b/.history/eohi2/mixed anova - DGEN_20251006232538.r new file mode 100644 index 0000000..26bd1f4 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006232538.r @@ -0,0 +1,1035 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# ============================================================================= +# TWO-WAY INTERACTION PLOTS +# ============================================================================= + +# ============================================================================= +# PLOT 1: TIME × INTERVAL INTERACTION (INTERVAL on x-axis) +# ============================================================================= + +# Create emmeans for TIME × INTERVAL +emm_time_interval_plot <- emmeans(aov_model, ~ TIME * INTERVAL) + +# Prepare emmeans data frame for TIME × INTERVAL plot +emmeans_time_interval_plot <- emm_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(INTERVAL), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × INTERVAL interaction plot +interaction_plot_time_interval <- ggplot(emmeans_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Interval", + y = "Absolute difference from the present", + title = "TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2, 3), + labels = c("5", "10", "5_10"), + limits = c(0.5, 3.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_interval) + +# ============================================================================= +# PLOT 2: TIME × temporal_DO INTERACTION (temporal_DO on x-axis) +# ============================================================================= + +# Create emmeans for TIME × temporal_DO +emm_time_temporal_plot <- emmeans(aov_model, ~ TIME * temporal_DO) + +# Prepare emmeans data frame for TIME × temporal_DO plot +emmeans_time_temporal_plot <- emm_time_temporal_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × temporal_DO interaction plot +interaction_plot_time_temporal <- ggplot(emmeans_time_temporal_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TIME × temporal_DO Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_temporal) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251006232540.r b/.history/eohi2/mixed anova - DGEN_20251006232540.r new file mode 100644 index 0000000..26bd1f4 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251006232540.r @@ -0,0 +1,1035 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# ============================================================================= +# TWO-WAY INTERACTION PLOTS +# ============================================================================= + +# ============================================================================= +# PLOT 1: TIME × INTERVAL INTERACTION (INTERVAL on x-axis) +# ============================================================================= + +# Create emmeans for TIME × INTERVAL +emm_time_interval_plot <- emmeans(aov_model, ~ TIME * INTERVAL) + +# Prepare emmeans data frame for TIME × INTERVAL plot +emmeans_time_interval_plot <- emm_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(INTERVAL), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × INTERVAL interaction plot +interaction_plot_time_interval <- ggplot(emmeans_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Interval", + y = "Absolute difference from the present", + title = "TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2, 3), + labels = c("5", "10", "5_10"), + limits = c(0.5, 3.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_interval) + +# ============================================================================= +# PLOT 2: TIME × temporal_DO INTERACTION (temporal_DO on x-axis) +# ============================================================================= + +# Create emmeans for TIME × temporal_DO +emm_time_temporal_plot <- emmeans(aov_model, ~ TIME * temporal_DO) + +# Prepare emmeans data frame for TIME × temporal_DO plot +emmeans_time_temporal_plot <- emm_time_temporal_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × temporal_DO interaction plot +interaction_plot_time_temporal <- ggplot(emmeans_time_temporal_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TIME × temporal_DO Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_temporal) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007103206.r b/.history/eohi2/mixed anova - DGEN_20251007103206.r new file mode 100644 index 0000000..6d3ddcd --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007103206.r @@ -0,0 +1,1093 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# ============================================================================= +# TWO-WAY INTERACTION PLOTS +# ============================================================================= + +# ============================================================================= +# PLOT 1: TIME × INTERVAL INTERACTION (INTERVAL on x-axis) +# ============================================================================= + +# Create emmeans for TIME × INTERVAL +emm_time_interval_plot <- emmeans(aov_model, ~ TIME * INTERVAL) + +# Prepare emmeans data frame for TIME × INTERVAL plot +emmeans_time_interval_plot <- emm_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(INTERVAL), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × INTERVAL interaction plot +interaction_plot_time_interval <- ggplot(emmeans_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Interval", + y = "Absolute difference from the present", + title = "TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2, 3), + labels = c("5", "10", "5_10"), + limits = c(0.5, 3.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_interval) + +# ============================================================================= +# PLOT 2: TIME × temporal_DO INTERACTION (temporal_DO on x-axis) +# ============================================================================= + +# Create emmeans for TIME × temporal_DO +emm_time_temporal_plot <- emmeans(aov_model, ~ TIME * temporal_DO) + +# Prepare emmeans data frame for TIME × temporal_DO plot +emmeans_time_temporal_plot <- emm_time_temporal_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × temporal_DO interaction plot +interaction_plot_time_temporal <- ggplot(emmeans_time_temporal_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TIME × temporal_DO Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_temporal) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007103213.r b/.history/eohi2/mixed anova - DGEN_20251007103213.r new file mode 100644 index 0000000..6d3ddcd --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007103213.r @@ -0,0 +1,1093 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# ============================================================================= +# TWO-WAY INTERACTION PLOTS +# ============================================================================= + +# ============================================================================= +# PLOT 1: TIME × INTERVAL INTERACTION (INTERVAL on x-axis) +# ============================================================================= + +# Create emmeans for TIME × INTERVAL +emm_time_interval_plot <- emmeans(aov_model, ~ TIME * INTERVAL) + +# Prepare emmeans data frame for TIME × INTERVAL plot +emmeans_time_interval_plot <- emm_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(INTERVAL), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × INTERVAL interaction plot +interaction_plot_time_interval <- ggplot(emmeans_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Interval", + y = "Absolute difference from the present", + title = "TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2, 3), + labels = c("5", "10", "5_10"), + limits = c(0.5, 3.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_interval) + +# ============================================================================= +# PLOT 2: TIME × temporal_DO INTERACTION (temporal_DO on x-axis) +# ============================================================================= + +# Create emmeans for TIME × temporal_DO +emm_time_temporal_plot <- emmeans(aov_model, ~ TIME * temporal_DO) + +# Prepare emmeans data frame for TIME × temporal_DO plot +emmeans_time_temporal_plot <- emm_time_temporal_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × temporal_DO interaction plot +interaction_plot_time_temporal <- ggplot(emmeans_time_temporal_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TIME × temporal_DO Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_temporal) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007103739.r b/.history/eohi2/mixed anova - DGEN_20251007103739.r new file mode 100644 index 0000000..6d3ddcd --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007103739.r @@ -0,0 +1,1093 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × DOMAIN (Emmeans only) +# ============================================================================= + +print("=== INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for temporal_DO × TIME × DOMAIN +emm_3way_plot <- emmeans(aov_model, ~ temporal_DO * TIME * DOMAIN) + +# Prepare emmeans data frame +emmeans_3way_plot <- emm_3way_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~DOMAIN, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# ============================================================================= +# TWO-WAY INTERACTION PLOTS +# ============================================================================= + +# ============================================================================= +# PLOT 1: TIME × INTERVAL INTERACTION (INTERVAL on x-axis) +# ============================================================================= + +# Create emmeans for TIME × INTERVAL +emm_time_interval_plot <- emmeans(aov_model, ~ TIME * INTERVAL) + +# Prepare emmeans data frame for TIME × INTERVAL plot +emmeans_time_interval_plot <- emm_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(INTERVAL), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × INTERVAL interaction plot +interaction_plot_time_interval <- ggplot(emmeans_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Interval", + y = "Absolute difference from the present", + title = "TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2, 3), + labels = c("5", "10", "5_10"), + limits = c(0.5, 3.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_interval) + +# ============================================================================= +# PLOT 2: TIME × temporal_DO INTERACTION (temporal_DO on x-axis) +# ============================================================================= + +# Create emmeans for TIME × temporal_DO +emm_time_temporal_plot <- emmeans(aov_model, ~ TIME * temporal_DO) + +# Prepare emmeans data frame for TIME × temporal_DO plot +emmeans_time_temporal_plot <- emm_time_temporal_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create TIME × temporal_DO interaction plot +interaction_plot_time_temporal <- ggplot(emmeans_time_temporal_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TIME × temporal_DO Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_temporal) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007104105.r b/.history/eohi2/mixed anova - DGEN_20251007104105.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007104105.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007104111.r b/.history/eohi2/mixed anova - DGEN_20251007104111.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007104111.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007104119.r b/.history/eohi2/mixed anova - DGEN_20251007104119.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007104119.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007105736.r b/.history/eohi2/mixed anova - DGEN_20251007105736.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007105736.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007185029.r b/.history/eohi2/mixed anova - DGEN_20251007185029.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007185029.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007185541.r b/.history/eohi2/mixed anova - DGEN_20251007185541.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007185541.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251007192720.r b/.history/eohi2/mixed anova - DGEN_20251007192720.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251007192720.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251008190007.r b/.history/eohi2/mixed anova - DGEN_20251008190007.r new file mode 100644 index 0000000..5bbbeda --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251008190007.r @@ -0,0 +1,892 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251008190301.r b/.history/eohi2/mixed anova - DGEN_20251008190301.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251008190301.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251008190307.r b/.history/eohi2/mixed anova - DGEN_20251008190307.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251008190307.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251010141129.r b/.history/eohi2/mixed anova - DGEN_20251010141129.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251010141129.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251010160100.r b/.history/eohi2/mixed anova - DGEN_20251010160100.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251010160100.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251010165028.r b/.history/eohi2/mixed anova - DGEN_20251010165028.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251010165028.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - DGEN_20251010165032.r b/.history/eohi2/mixed anova - DGEN_20251010165032.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/.history/eohi2/mixed anova - DGEN_20251010165032.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003143914.r b/.history/eohi2/mixed anova - domain means_20251003143914.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/mixed anova - domain means_20251003143942.r b/.history/eohi2/mixed anova - domain means_20251003143942.r new file mode 100644 index 0000000..cf12456 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003143942.r @@ -0,0 +1,21 @@ +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003145806.r b/.history/eohi2/mixed anova - domain means_20251003145806.r new file mode 100644 index 0000000..6096dab --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003145806.r @@ -0,0 +1,88 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003145820.r b/.history/eohi2/mixed anova - domain means_20251003145820.r new file mode 100644 index 0000000..f17da36 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003145820.r @@ -0,0 +1,139 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003145845.r b/.history/eohi2/mixed anova - domain means_20251003145845.r new file mode 100644 index 0000000..9f268b0 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003145845.r @@ -0,0 +1,280 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003145918.r b/.history/eohi2/mixed anova - domain means_20251003145918.r new file mode 100644 index 0000000..159f53f --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003145918.r @@ -0,0 +1,434 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003145949.r b/.history/eohi2/mixed anova - domain means_20251003145949.r new file mode 100644 index 0000000..2155e21 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003145949.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003145955.r b/.history/eohi2/mixed anova - domain means_20251003145955.r new file mode 100644 index 0000000..2155e21 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003145955.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150004.r b/.history/eohi2/mixed anova - domain means_20251003150004.r new file mode 100644 index 0000000..2155e21 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150004.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150017.r b/.history/eohi2/mixed anova - domain means_20251003150017.r new file mode 100644 index 0000000..33a17bb --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150017.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + + # Between-subjects effects (no sphericity corrections needed) + cat("\nBETWEEN-SUBJECTS EFFECTS:\n") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150021.r b/.history/eohi2/mixed anova - domain means_20251003150021.r new file mode 100644 index 0000000..e9b5cf7 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150021.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + cat("\nWITHIN-SUBJECTS EFFECTS:\n") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150023.r b/.history/eohi2/mixed anova - domain means_20251003150023.r new file mode 100644 index 0000000..40596e5 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150023.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + cat("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150026.r b/.history/eohi2/mixed anova - domain means_20251003150026.r new file mode 100644 index 0000000..463142f --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150026.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150029.r b/.history/eohi2/mixed anova - domain means_20251003150029.r new file mode 100644 index 0000000..4990d92 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150029.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150032.r b/.history/eohi2/mixed anova - domain means_20251003150032.r new file mode 100644 index 0000000..0128155 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150032.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150034.r b/.history/eohi2/mixed anova - domain means_20251003150034.r new file mode 100644 index 0000000..0cfef52 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150034.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + cat(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150037.r b/.history/eohi2/mixed anova - domain means_20251003150037.r new file mode 100644 index 0000000..7c21993 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150037.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150049.r b/.history/eohi2/mixed anova - domain means_20251003150049.r new file mode 100644 index 0000000..c455a75 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150049.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150056.r b/.history/eohi2/mixed anova - domain means_20251003150056.r new file mode 100644 index 0000000..a87c5df --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150056.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150107.r b/.history/eohi2/mixed anova - domain means_20251003150107.r new file mode 100644 index 0000000..241abc1 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150107.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + cat("\nCohen's d for significant INTERVAL contrasts:\n") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", interval_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", interval_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_interval$p.value[i])) + cat("\n") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150118.r b/.history/eohi2/mixed anova - domain means_20251003150118.r new file mode 100644 index 0000000..69ab2d6 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150118.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150155.r b/.history/eohi2/mixed anova - domain means_20251003150155.r new file mode 100644 index 0000000..69ab2d6 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150155.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "5.10past_pref_MEAN", "5.10past_pers_MEAN", "5.10past_val_MEAN", + "5.10fut_pref_MEAN", "5.10fut_pers_MEAN", "5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150222.r b/.history/eohi2/mixed anova - domain means_20251003150222.r new file mode 100644 index 0000000..1b34616 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150222.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150238.r b/.history/eohi2/mixed anova - domain means_20251003150238.r new file mode 100644 index 0000000..1b34616 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150238.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003150306.r b/.history/eohi2/mixed anova - domain means_20251003150306.r new file mode 100644 index 0000000..1b34616 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003150306.r @@ -0,0 +1,611 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +# Note: Detailed interaction analyses would be added here if significant interactions are found +# For now, we'll provide a framework for the most common interactions + +print("\n=== INTERACTION EXPLORATIONS ===") +print("Note: Detailed interaction analyses will be performed for significant interactions") +print("Check the ANOVA results above to identify which interactions are significant") + +# Example framework for TIME × DOMAIN interaction (if significant) +# if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { +# print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") +# time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +# print("Estimated Marginal Means:") +# print(time_domain_emmeans) +# +# print("\nSimple Effects of DOMAIN within each TIME:") +# time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +# print(time_domain_simple) +# +# print("\nSimple Effects of TIME within each DOMAIN:") +# time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +# print(time_domain_simple2) +# } + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003152345.r b/.history/eohi2/mixed anova - domain means_20251003152345.r new file mode 100644 index 0000000..ad91f38 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003152345.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003152354.r b/.history/eohi2/mixed anova - domain means_20251003152354.r new file mode 100644 index 0000000..ad91f38 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003152354.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003152532.r b/.history/eohi2/mixed anova - domain means_20251003152532.r new file mode 100644 index 0000000..ad91f38 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003152532.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251003170438.r b/.history/eohi2/mixed anova - domain means_20251003170438.r new file mode 100644 index 0000000..ad91f38 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251003170438.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251006191145.r b/.history/eohi2/mixed anova - domain means_20251006191145.r new file mode 100644 index 0000000..ad91f38 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251006191145.r @@ -0,0 +1,748 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251006191927.r b/.history/eohi2/mixed anova - domain means_20251006191927.r new file mode 100644 index 0000000..64ce2dc --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251006191927.r @@ -0,0 +1,822 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251006191941.r b/.history/eohi2/mixed anova - domain means_20251006191941.r new file mode 100644 index 0000000..64ce2dc --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251006191941.r @@ -0,0 +1,822 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251006191952.r b/.history/eohi2/mixed anova - domain means_20251006191952.r new file mode 100644 index 0000000..64ce2dc --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251006191952.r @@ -0,0 +1,822 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251006192942.r b/.history/eohi2/mixed anova - domain means_20251006192942.r new file mode 100644 index 0000000..376274d --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251006192942.r @@ -0,0 +1,822 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251006225442.r b/.history/eohi2/mixed anova - domain means_20251006225442.r new file mode 100644 index 0000000..376274d --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251006225442.r @@ -0,0 +1,822 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007105958.r b/.history/eohi2/mixed anova - domain means_20251007105958.r new file mode 100644 index 0000000..3521624 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007105958.r @@ -0,0 +1,878 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +print("\n=== CREATING MAIN-EFFECT PLOT FOR TIME ===") + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007110011.r b/.history/eohi2/mixed anova - domain means_20251007110011.r new file mode 100644 index 0000000..3521624 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007110011.r @@ -0,0 +1,878 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +print("\n=== CREATING MAIN-EFFECT PLOT FOR TIME ===") + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007110320.r b/.history/eohi2/mixed anova - domain means_20251007110320.r new file mode 100644 index 0000000..3521624 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007110320.r @@ -0,0 +1,878 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +print("\n=== CREATING MAIN-EFFECT PLOT FOR TIME ===") + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007110333.r b/.history/eohi2/mixed anova - domain means_20251007110333.r new file mode 100644 index 0000000..049cfb4 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007110333.r @@ -0,0 +1,876 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Domain mapping created:") +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors only:") +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL combination:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL combination:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN combination:") +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors +print("\n=== HARTLEY'S F-MAX TEST FOR BETWEEN-SUBJECTS FACTORS ===") + +# Check what values the between-subjects factors actually have +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("Unique INTERVAL_DO values:") +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination +print("\n=== HARTLEY'S F-MAX TEST: TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination +print("\n=== HARTLEY'S F-MAX TEST: INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination ===") + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +print("ANOVA Results:") +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("\nMauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL +print("\nMain Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print("Estimated Marginal Means:") +print(interval_emmeans) +print("\nPairwise Contrasts:") +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO +print("\nMain Effect of INTERVAL_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + +print("\n=== COHEN'S D FOR MAIN EFFECTS ===") + +# Main Effect of TIME (if significant) +print("\n=== COHEN'S D FOR TIME MAIN EFFECT ===") +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) +print("TIME main effect contrast:") +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) +print("\n=== COHEN'S D FOR DOMAIN MAIN EFFECT ===") +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print("DOMAIN main effect contrasts:") +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) +print("\n=== COHEN'S D FOR INTERVAL MAIN EFFECT ===") +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) +print("INTERVAL main effect contrasts:") +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + +print("\n=== INTERACTION EXPLORATIONS ===") + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + +print("\n=== ANALYSIS COMPLETE ===") +print("Mixed ANOVA analysis with three within-subjects factors (TIME, DOMAIN, INTERVAL)") +print("and two between-subjects factors (TEMPORAL_DO, INTERVAL_DO) completed.") +print("Check the results above for significant effects and perform additional") +print("interaction analyses as needed based on the significance patterns.") + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + +print("\n=== CREATING 3-WAY INTERACTION PLOT ===") + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007110641.r b/.history/eohi2/mixed anova - domain means_20251007110641.r new file mode 100644 index 0000000..059ac51 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007110641.r @@ -0,0 +1,872 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007110654.r b/.history/eohi2/mixed anova - domain means_20251007110654.r new file mode 100644 index 0000000..059ac51 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007110654.r @@ -0,0 +1,872 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007111158.r b/.history/eohi2/mixed anova - domain means_20251007111158.r new file mode 100644 index 0000000..059ac51 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007111158.r @@ -0,0 +1,872 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007155225.r b/.history/eohi2/mixed anova - domain means_20251007155225.r new file mode 100644 index 0000000..059ac51 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007155225.r @@ -0,0 +1,872 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184341.r b/.history/eohi2/mixed anova - domain means_20251007184341.r new file mode 100644 index 0000000..059ac51 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184341.r @@ -0,0 +1,872 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184520.r b/.history/eohi2/mixed anova - domain means_20251007184520.r new file mode 100644 index 0000000..455fe84 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184520.r @@ -0,0 +1,941 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + if("TIME:INTERVAL:TEMPORAL_DO" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL:TEMPORAL_DO"] < 0.05) { + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION (SIGNIFICANT) ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for significant Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + + if(nrow(significant_three_way) > 0) { + print("\n=== COHEN'S D FOR SIGNIFICANT TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Significant Past vs Future contrasts (p < 0.05):") + print(significant_three_way) + + print("\nCohen's d calculations for significant Past vs Future contrasts:") + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + } else { + cat("No significant Past vs Future contrasts found within any INTERVAL × TEMPORAL_DO combination.\n") + } + } else { + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + if("TIME:INTERVAL:TEMPORAL_DO" %in% anova_output$Effect) { + p_value <- anova_output$p[anova_output$Effect == "TIME:INTERVAL:TEMPORAL_DO"] + print(sprintf("Three-way interaction not significant: p = %.6f", p_value)) + } else { + print("Three-way interaction not found in ANOVA results") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184536.r b/.history/eohi2/mixed anova - domain means_20251007184536.r new file mode 100644 index 0000000..455fe84 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184536.r @@ -0,0 +1,941 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + if("TIME:INTERVAL:TEMPORAL_DO" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL:TEMPORAL_DO"] < 0.05) { + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION (SIGNIFICANT) ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for significant Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + + if(nrow(significant_three_way) > 0) { + print("\n=== COHEN'S D FOR SIGNIFICANT TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Significant Past vs Future contrasts (p < 0.05):") + print(significant_three_way) + + print("\nCohen's d calculations for significant Past vs Future contrasts:") + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + } else { + cat("No significant Past vs Future contrasts found within any INTERVAL × TEMPORAL_DO combination.\n") + } + } else { + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + if("TIME:INTERVAL:TEMPORAL_DO" %in% anova_output$Effect) { + p_value <- anova_output$p[anova_output$Effect == "TIME:INTERVAL:TEMPORAL_DO"] + print(sprintf("Three-way interaction not significant: p = %.6f", p_value)) + } else { + print("Three-way interaction not found in ANOVA results") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184540.r b/.history/eohi2/mixed anova - domain means_20251007184540.r new file mode 100644 index 0000000..455fe84 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184540.r @@ -0,0 +1,941 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + if("TIME:INTERVAL:TEMPORAL_DO" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL:TEMPORAL_DO"] < 0.05) { + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION (SIGNIFICANT) ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for significant Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + + if(nrow(significant_three_way) > 0) { + print("\n=== COHEN'S D FOR SIGNIFICANT TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Significant Past vs Future contrasts (p < 0.05):") + print(significant_three_way) + + print("\nCohen's d calculations for significant Past vs Future contrasts:") + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + } else { + cat("No significant Past vs Future contrasts found within any INTERVAL × TEMPORAL_DO combination.\n") + } + } else { + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + if("TIME:INTERVAL:TEMPORAL_DO" %in% anova_output$Effect) { + p_value <- anova_output$p[anova_output$Effect == "TIME:INTERVAL:TEMPORAL_DO"] + print(sprintf("Three-way interaction not significant: p = %.6f", p_value)) + } else { + print("Three-way interaction not found in ANOVA results") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184820.r b/.history/eohi2/mixed anova - domain means_20251007184820.r new file mode 100644 index 0000000..d25c210 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184820.r @@ -0,0 +1,923 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184823.r b/.history/eohi2/mixed anova - domain means_20251007184823.r new file mode 100644 index 0000000..d25c210 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184823.r @@ -0,0 +1,923 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007184824.r b/.history/eohi2/mixed anova - domain means_20251007184824.r new file mode 100644 index 0000000..d25c210 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007184824.r @@ -0,0 +1,923 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007185023.r b/.history/eohi2/mixed anova - domain means_20251007185023.r new file mode 100644 index 0000000..d25c210 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007185023.r @@ -0,0 +1,923 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251007185544.r b/.history/eohi2/mixed anova - domain means_20251007185544.r new file mode 100644 index 0000000..d25c210 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251007185544.r @@ -0,0 +1,923 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251008192902.r b/.history/eohi2/mixed anova - domain means_20251008192902.r new file mode 100644 index 0000000..d25c210 --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251008192902.r @@ -0,0 +1,923 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251008192910.r b/.history/eohi2/mixed anova - domain means_20251008192910.r new file mode 100644 index 0000000..91f7c4a --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251008192910.r @@ -0,0 +1,927 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251008192916.r b/.history/eohi2/mixed anova - domain means_20251008192916.r new file mode 100644 index 0000000..91f7c4a --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251008192916.r @@ -0,0 +1,927 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251008192921.r b/.history/eohi2/mixed anova - domain means_20251008192921.r new file mode 100644 index 0000000..91f7c4a --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251008192921.r @@ -0,0 +1,927 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/mixed anova - domain means_20251008192926.r b/.history/eohi2/mixed anova - domain means_20251008192926.r new file mode 100644 index 0000000..91f7c4a --- /dev/null +++ b/.history/eohi2/mixed anova - domain means_20251008192926.r @@ -0,0 +1,927 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/.history/eohi2/recode_likert_items_20251001085552.r b/.history/eohi2/recode_likert_items_20251001085552.r new file mode 100644 index 0000000..ea1e3ca --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001085552.r @@ -0,0 +1,93 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +# Read the data +df <- read.csv("eohi2/eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Coalesce: take value from col_A if present, otherwise from col_B + combined <- ifelse(!is.na(df[[col_A]]) & df[[col_A]] != "", + df[[col_A]], + df[[col_B]]) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi2/eohi2.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi2/eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001085616.r b/.history/eohi2/recode_likert_items_20251001085616.r new file mode 100644 index 0000000..ea1e3ca --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001085616.r @@ -0,0 +1,93 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +# Read the data +df <- read.csv("eohi2/eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Coalesce: take value from col_A if present, otherwise from col_B + combined <- ifelse(!is.na(df[[col_A]]) & df[[col_A]] != "", + df[[col_A]], + df[[col_B]]) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi2/eohi2.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi2/eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001085904.r b/.history/eohi2/recode_likert_items_20251001085904.r new file mode 100644 index 0000000..adc1262 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001085904.r @@ -0,0 +1,95 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Coalesce: take value from col_A if present, otherwise from col_B + combined <- ifelse(!is.na(df[[col_A]]) & df[[col_A]] != "", + df[[col_A]], + df[[col_B]]) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi2/eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi2/eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001085909.r b/.history/eohi2/recode_likert_items_20251001085909.r new file mode 100644 index 0000000..8a9a5a9 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001085909.r @@ -0,0 +1,95 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Coalesce: take value from col_A if present, otherwise from col_B + combined <- ifelse(!is.na(df[[col_A]]) & df[[col_A]] != "", + df[[col_A]], + df[[col_B]]) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001085917.r b/.history/eohi2/recode_likert_items_20251001085917.r new file mode 100644 index 0000000..8a9a5a9 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001085917.r @@ -0,0 +1,95 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Coalesce: take value from col_A if present, otherwise from col_B + combined <- ifelse(!is.na(df[[col_A]]) & df[[col_A]] != "", + df[[col_A]], + df[[col_B]]) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001090003.r b/.history/eohi2/recode_likert_items_20251001090003.r new file mode 100644 index 0000000..8a9a5a9 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001090003.r @@ -0,0 +1,95 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Coalesce: take value from col_A if present, otherwise from col_B + combined <- ifelse(!is.na(df[[col_A]]) & df[[col_A]] != "", + df[[col_A]], + df[[col_B]]) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001090613.r b/.history/eohi2/recode_likert_items_20251001090613.r new file mode 100644 index 0000000..40a0bd3 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001090613.r @@ -0,0 +1,99 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001090620.r b/.history/eohi2/recode_likert_items_20251001090620.r new file mode 100644 index 0000000..40a0bd3 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001090620.r @@ -0,0 +1,99 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001090829.r b/.history/eohi2/recode_likert_items_20251001090829.r new file mode 100644 index 0000000..3a1025b --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001090829.r @@ -0,0 +1,164 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001090840.r b/.history/eohi2/recode_likert_items_20251001090840.r new file mode 100644 index 0000000..3a1025b --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001090840.r @@ -0,0 +1,164 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001090919.r b/.history/eohi2/recode_likert_items_20251001090919.r new file mode 100644 index 0000000..3a1025b --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001090919.r @@ -0,0 +1,164 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091002.r b/.history/eohi2/recode_likert_items_20251001091002.r new file mode 100644 index 0000000..1818b13 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091002.r @@ -0,0 +1,191 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091011.r b/.history/eohi2/recode_likert_items_20251001091011.r new file mode 100644 index 0000000..1818b13 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091011.r @@ -0,0 +1,191 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091016.r b/.history/eohi2/recode_likert_items_20251001091016.r new file mode 100644 index 0000000..1818b13 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091016.r @@ -0,0 +1,191 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091544.r b/.history/eohi2/recode_likert_items_20251001091544.r new file mode 100644 index 0000000..bae773a --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091544.r @@ -0,0 +1,191 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091551.r b/.history/eohi2/recode_likert_items_20251001091551.r new file mode 100644 index 0000000..015fe05 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091551.r @@ -0,0 +1,198 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091602.r b/.history/eohi2/recode_likert_items_20251001091602.r new file mode 100644 index 0000000..015fe05 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091602.r @@ -0,0 +1,198 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091838.r b/.history/eohi2/recode_likert_items_20251001091838.r new file mode 100644 index 0000000..f08c3c8 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091838.r @@ -0,0 +1,199 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +write.csv(df, "eohi3.csv", row.names = FALSE) + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091844.r b/.history/eohi2/recode_likert_items_20251001091844.r new file mode 100644 index 0000000..f9c5975 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091844.r @@ -0,0 +1,200 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi3.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091846.r b/.history/eohi2/recode_likert_items_20251001091846.r new file mode 100644 index 0000000..f9c5975 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091846.r @@ -0,0 +1,200 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi3.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001091852.r b/.history/eohi2/recode_likert_items_20251001091852.r new file mode 100644 index 0000000..f9c5975 --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001091852.r @@ -0,0 +1,200 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi3.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi3.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001092353.r b/.history/eohi2/recode_likert_items_20251001092353.r new file mode 100644 index 0000000..1e2ccca --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001092353.r @@ -0,0 +1,200 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001092409.r b/.history/eohi2/recode_likert_items_20251001092409.r new file mode 100644 index 0000000..de1332d --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001092409.r @@ -0,0 +1,266 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 60 pairs + for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_text <- val_A + } else if (has_val_B) { + source_used <- "B" + original_text <- val_B + } else { + source_used <- "NONE" + original_text <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001092420.r b/.history/eohi2/recode_likert_items_20251001092420.r new file mode 100644 index 0000000..de1332d --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001092420.r @@ -0,0 +1,266 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 60 pairs + for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_text <- val_A + } else if (has_val_B) { + source_used <- "B" + original_text <- val_B + } else { + source_used <- "NONE" + original_text <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001092430.r b/.history/eohi2/recode_likert_items_20251001092430.r new file mode 100644 index 0000000..de1332d --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001092430.r @@ -0,0 +1,266 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 60 pairs + for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_text <- val_A + } else if (has_val_B) { + source_used <- "B" + original_text <- val_B + } else { + source_used <- "NONE" + original_text <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001094502.r b/.history/eohi2/recode_likert_items_20251001094502.r new file mode 100644 index 0000000..de1332d --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001094502.r @@ -0,0 +1,266 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 60 pairs + for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_text <- val_A + } else if (has_val_B) { + source_used <- "B" + original_text <- val_B + } else { + source_used <- "NONE" + original_text <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/.history/eohi2/recode_likert_items_20251001105906.r b/.history/eohi2/recode_likert_items_20251001105906.r new file mode 100644 index 0000000..de1332d --- /dev/null +++ b/.history/eohi2/recode_likert_items_20251001105906.r @@ -0,0 +1,266 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 60 pairs + for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_text <- val_A + } else if (has_val_B) { + source_used <- "B" + original_text <- val_B + } else { + source_used <- "NONE" + original_text <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/.history/eohi2/reliability - ehi_20251028173023.r b/.history/eohi2/reliability - ehi_20251028173023.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/reliability - ehi_20251028173024.r b/.history/eohi2/reliability - ehi_20251028173024.r new file mode 100644 index 0000000..dbb1cb8 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173024.r @@ -0,0 +1,9 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173102.r b/.history/eohi2/reliability - ehi_20251028173102.r new file mode 100644 index 0000000..7873ec3 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173102.r @@ -0,0 +1,67 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +cat("Missing values per variable:\n") +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +cat("\nSample size for reliability analysis:", nrow(reliability_data), "\n") + +# Cronbach's Alpha +cat("\n=== CRONBACH'S ALPHA ===\n") +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Alternative reliability measures +cat("\n=== ADDITIONAL RELIABILITY MEASURES ===\n") + +# Split-half reliability +split_half <- splitHalf(reliability_data) +cat("Split-half reliability:\n") +print(split_half) + +# McDonald's Omega +omega_result <- omega(reliability_data) +cat("\nMcDonald's Omega:\n") +print(omega_result) + +# Inter-item correlations +cat("\n=== INTER-ITEM CORRELATIONS ===\n") +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +cat("\n=== DESCRIPTIVE STATISTICS ===\n") +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +cat("\n=== SUMMARY TABLE ===\n") +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) +cat("\nResults saved to 'reliability_summary_ehi.csv'\n") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173106.r b/.history/eohi2/reliability - ehi_20251028173106.r new file mode 100644 index 0000000..7873ec3 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173106.r @@ -0,0 +1,67 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +cat("Missing values per variable:\n") +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +cat("\nSample size for reliability analysis:", nrow(reliability_data), "\n") + +# Cronbach's Alpha +cat("\n=== CRONBACH'S ALPHA ===\n") +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Alternative reliability measures +cat("\n=== ADDITIONAL RELIABILITY MEASURES ===\n") + +# Split-half reliability +split_half <- splitHalf(reliability_data) +cat("Split-half reliability:\n") +print(split_half) + +# McDonald's Omega +omega_result <- omega(reliability_data) +cat("\nMcDonald's Omega:\n") +print(omega_result) + +# Inter-item correlations +cat("\n=== INTER-ITEM CORRELATIONS ===\n") +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +cat("\n=== DESCRIPTIVE STATISTICS ===\n") +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +cat("\n=== SUMMARY TABLE ===\n") +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) +cat("\nResults saved to 'reliability_summary_ehi.csv'\n") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173223.r b/.history/eohi2/reliability - ehi_20251028173223.r new file mode 100644 index 0000000..5960a75 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173223.r @@ -0,0 +1,67 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +cat("Missing values per variable:\n") +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +cat("\nSample size for reliability analysis:", nrow(reliability_data), "\n") + +# Cronbach's Alpha +cat("\n=== CRONBACH'S ALPHA ===\n") +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Alternative reliability measures +cat("\n=== ADDITIONAL RELIABILITY MEASURES ===\n") + +# Split-half reliability +split_half <- splitHalf(reliability_data) +cat("Split-half reliability:\n") +print(split_half) + +# Alpha if item dropped +cat("\nAlpha if item dropped:\n") +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cat("\n=== INTER-ITEM CORRELATIONS ===\n") +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +cat("\n=== DESCRIPTIVE STATISTICS ===\n") +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +cat("\n=== SUMMARY TABLE ===\n") +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) +cat("\nResults saved to 'reliability_summary_ehi.csv'\n") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173226.r b/.history/eohi2/reliability - ehi_20251028173226.r new file mode 100644 index 0000000..5960a75 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173226.r @@ -0,0 +1,67 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +cat("Missing values per variable:\n") +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +cat("\nSample size for reliability analysis:", nrow(reliability_data), "\n") + +# Cronbach's Alpha +cat("\n=== CRONBACH'S ALPHA ===\n") +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Alternative reliability measures +cat("\n=== ADDITIONAL RELIABILITY MEASURES ===\n") + +# Split-half reliability +split_half <- splitHalf(reliability_data) +cat("Split-half reliability:\n") +print(split_half) + +# Alpha if item dropped +cat("\nAlpha if item dropped:\n") +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cat("\n=== INTER-ITEM CORRELATIONS ===\n") +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +cat("\n=== DESCRIPTIVE STATISTICS ===\n") +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +cat("\n=== SUMMARY TABLE ===\n") +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) +cat("\nResults saved to 'reliability_summary_ehi.csv'\n") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173245.r b/.history/eohi2/reliability - ehi_20251028173245.r new file mode 100644 index 0000000..b2ec649 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173245.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173247.r b/.history/eohi2/reliability - ehi_20251028173247.r new file mode 100644 index 0000000..b2ec649 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173247.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028173249.r b/.history/eohi2/reliability - ehi_20251028173249.r new file mode 100644 index 0000000..b2ec649 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028173249.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174139.r b/.history/eohi2/reliability - ehi_20251028174139.r new file mode 100644 index 0000000..80cce25 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174139.r @@ -0,0 +1,84 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + "
", capture.output(print(alpha_result)), "
", + + "

Split-Half Reliability

", + "
", capture.output(print(split_half)), "
", + + "

Alpha if Item Dropped

", + "
", capture.output(print(alpha_dropped$alpha.drop)), "
", + + "

Inter-Item Correlations

", + "
", capture.output(print(round(cor_matrix, 5))), "
", + + "

Descriptive Statistics

", + "
", capture.output(print(desc_stats)), "
", + + "

Summary Table

", + "
", capture.output(print(summary_table)), "
", + + "" +) + +writeLines(html_output, "reliability_analysis_ehi.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174146.r b/.history/eohi2/reliability - ehi_20251028174146.r new file mode 100644 index 0000000..80cce25 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174146.r @@ -0,0 +1,84 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + "
", capture.output(print(alpha_result)), "
", + + "

Split-Half Reliability

", + "
", capture.output(print(split_half)), "
", + + "

Alpha if Item Dropped

", + "
", capture.output(print(alpha_dropped$alpha.drop)), "
", + + "

Inter-Item Correlations

", + "
", capture.output(print(round(cor_matrix, 5))), "
", + + "

Descriptive Statistics

", + "
", capture.output(print(desc_stats)), "
", + + "

Summary Table

", + "
", capture.output(print(summary_table)), "
", + + "" +) + +writeLines(html_output, "reliability_analysis_ehi.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174151.r b/.history/eohi2/reliability - ehi_20251028174151.r new file mode 100644 index 0000000..41bcaf7 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174151.r @@ -0,0 +1,84 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + "
", capture.output(print(alpha_result)), "
", + + "

Split-Half Reliability

", + "
", capture.output(print(split_half)), "
", + + "

Alpha if Item Dropped

", + "
", capture.output(print(alpha_dropped$alpha.drop)), "
", + + "

Inter-Item Correlations

", + "
", capture.output(print(round(cor_matrix, 5))), "
", + + "

Descriptive Statistics

", + "
", capture.output(print(desc_stats)), "
", + + "

Summary Table

", + "
", capture.output(print(summary_table)), "
", + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174152.r b/.history/eohi2/reliability - ehi_20251028174152.r new file mode 100644 index 0000000..41bcaf7 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174152.r @@ -0,0 +1,84 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + "
", capture.output(print(alpha_result)), "
", + + "

Split-Half Reliability

", + "
", capture.output(print(split_half)), "
", + + "

Alpha if Item Dropped

", + "
", capture.output(print(alpha_dropped$alpha.drop)), "
", + + "

Inter-Item Correlations

", + "
", capture.output(print(round(cor_matrix, 5))), "
", + + "

Descriptive Statistics

", + "
", capture.output(print(desc_stats)), "
", + + "

Summary Table

", + "
", capture.output(print(summary_table)), "
", + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174209.r b/.history/eohi2/reliability - ehi_20251028174209.r new file mode 100644 index 0000000..41bcaf7 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174209.r @@ -0,0 +1,84 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + "
", capture.output(print(alpha_result)), "
", + + "

Split-Half Reliability

", + "
", capture.output(print(split_half)), "
", + + "

Alpha if Item Dropped

", + "
", capture.output(print(alpha_dropped$alpha.drop)), "
", + + "

Inter-Item Correlations

", + "
", capture.output(print(round(cor_matrix, 5))), "
", + + "

Descriptive Statistics

", + "
", capture.output(print(desc_stats)), "
", + + "

Summary Table

", + "
", capture.output(print(summary_table)), "
", + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174329.r b/.history/eohi2/reliability - ehi_20251028174329.r new file mode 100644 index 0000000..7906277 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174329.r @@ -0,0 +1,90 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- sprintf( + "EHI Reliability Analysis +

EHI Reliability Analysis

+ +

Cronbach's Alpha

+
%s
+ +

Split-Half Reliability

+
%s
+ +

Alpha if Item Dropped

+
%s
+ +

Inter-Item Correlations

+
%s
+ +

Descriptive Statistics

+
%s
+ +

Summary Table

+
%s
+ + ", + paste(capture.output(print(alpha_result)), collapse = "\n"), + paste(capture.output(print(split_half)), collapse = "\n"), + paste(capture.output(print(alpha_dropped$alpha.drop)), collapse = "\n"), + paste(capture.output(print(round(cor_matrix, 5))), collapse = "\n"), + paste(capture.output(print(desc_stats)), collapse = "\n"), + paste(capture.output(print(summary_table)), collapse = "\n") +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174333.r b/.history/eohi2/reliability - ehi_20251028174333.r new file mode 100644 index 0000000..7906277 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174333.r @@ -0,0 +1,90 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output +html_output <- sprintf( + "EHI Reliability Analysis +

EHI Reliability Analysis

+ +

Cronbach's Alpha

+
%s
+ +

Split-Half Reliability

+
%s
+ +

Alpha if Item Dropped

+
%s
+ +

Inter-Item Correlations

+
%s
+ +

Descriptive Statistics

+
%s
+ +

Summary Table

+
%s
+ + ", + paste(capture.output(print(alpha_result)), collapse = "\n"), + paste(capture.output(print(split_half)), collapse = "\n"), + paste(capture.output(print(alpha_dropped$alpha.drop)), collapse = "\n"), + paste(capture.output(print(round(cor_matrix, 5))), collapse = "\n"), + paste(capture.output(print(desc_stats)), collapse = "\n"), + paste(capture.output(print(summary_table)), collapse = "\n") +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174401.r b/.history/eohi2/reliability - ehi_20251028174401.r new file mode 100644 index 0000000..b057e40 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174401.r @@ -0,0 +1,80 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using sink() +sink("temp_output.txt") +print(alpha_result) +print(split_half) +print(alpha_dropped$alpha.drop) +print(round(cor_matrix, 5)) +print(desc_stats) +print(summary_table) +sink() + +# Read the captured output +captured_output <- readLines("temp_output.txt") +file.remove("temp_output.txt") + +html_output <- sprintf( + "EHI Reliability Analysis +

EHI Reliability Analysis

+
%s
+ ", + paste(captured_output, collapse = "\n") +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174407.r b/.history/eohi2/reliability - ehi_20251028174407.r new file mode 100644 index 0000000..b057e40 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174407.r @@ -0,0 +1,80 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using sink() +sink("temp_output.txt") +print(alpha_result) +print(split_half) +print(alpha_dropped$alpha.drop) +print(round(cor_matrix, 5)) +print(desc_stats) +print(summary_table) +sink() + +# Read the captured output +captured_output <- readLines("temp_output.txt") +file.remove("temp_output.txt") + +html_output <- sprintf( + "EHI Reliability Analysis +

EHI Reliability Analysis

+
%s
+ ", + paste(captured_output, collapse = "\n") +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174412.r b/.history/eohi2/reliability - ehi_20251028174412.r new file mode 100644 index 0000000..b057e40 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174412.r @@ -0,0 +1,80 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using sink() +sink("temp_output.txt") +print(alpha_result) +print(split_half) +print(alpha_dropped$alpha.drop) +print(round(cor_matrix, 5)) +print(desc_stats) +print(summary_table) +sink() + +# Read the captured output +captured_output <- readLines("temp_output.txt") +file.remove("temp_output.txt") + +html_output <- sprintf( + "EHI Reliability Analysis +

EHI Reliability Analysis

+
%s
+ ", + paste(captured_output, collapse = "\n") +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174501.r b/.history/eohi2/reliability - ehi_20251028174501.r new file mode 100644 index 0000000..abebca4 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174501.r @@ -0,0 +1,87 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", split_half$maxrb, "

", + "

Average split half reliability: ", split_half$avrb, "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174503.r b/.history/eohi2/reliability - ehi_20251028174503.r new file mode 100644 index 0000000..abebca4 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174503.r @@ -0,0 +1,87 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", split_half$maxrb, "

", + "

Average split half reliability: ", split_half$avrb, "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174701.r b/.history/eohi2/reliability - ehi_20251028174701.r new file mode 100644 index 0000000..abebca4 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174701.r @@ -0,0 +1,87 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", split_half$maxrb, "

", + "

Average split half reliability: ", split_half$avrb, "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174922.r b/.history/eohi2/reliability - ehi_20251028174922.r new file mode 100644 index 0000000..a59e403 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174922.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(split_half$avrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174926.r b/.history/eohi2/reliability - ehi_20251028174926.r new file mode 100644 index 0000000..a59e403 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174926.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Skewness = round(apply(reliability_data, 2, skew, na.rm = TRUE), 5), + Kurtosis = round(apply(reliability_data, 2, kurtosi, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(split_half$avrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028174958.r b/.history/eohi2/reliability - ehi_20251028174958.r new file mode 100644 index 0000000..e4001fa --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028174958.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(split_half$avrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175001.r b/.history/eohi2/reliability - ehi_20251028175001.r new file mode 100644 index 0000000..e4001fa --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175001.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(split_half$avrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175110.r b/.history/eohi2/reliability - ehi_20251028175110.r new file mode 100644 index 0000000..e4001fa --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175110.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(split_half$avrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175138.r b/.history/eohi2/reliability - ehi_20251028175138.r new file mode 100644 index 0000000..091959a --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175138.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(as.numeric(split_half$avrb), 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175140.r b/.history/eohi2/reliability - ehi_20251028175140.r new file mode 100644 index 0000000..091959a --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175140.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Average split half reliability: ", round(as.numeric(split_half$avrb), 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175150.r b/.history/eohi2/reliability - ehi_20251028175150.r new file mode 100644 index 0000000..2fa62e7 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175150.r @@ -0,0 +1,87 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175152.r b/.history/eohi2/reliability - ehi_20251028175152.r new file mode 100644 index 0000000..2fa62e7 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175152.r @@ -0,0 +1,87 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + "

Minimum split half reliability: ", round(split_half$minrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175211.r b/.history/eohi2/reliability - ehi_20251028175211.r new file mode 100644 index 0000000..9ba5348 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175211.r @@ -0,0 +1,86 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175214.r b/.history/eohi2/reliability - ehi_20251028175214.r new file mode 100644 index 0000000..9ba5348 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175214.r @@ -0,0 +1,86 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Select the 4 variables for reliability analysis +reliability_vars <- df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Check for missing values +print(colSums(is.na(reliability_vars))) + +# Remove rows with any missing values for reliability analysis +reliability_data <- reliability_vars[complete.cases(reliability_vars), ] + +print(nrow(reliability_data)) + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) +print(alpha_result) + +# Split-half reliability +split_half <- splitHalf(reliability_data) +print(split_half) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) +print(alpha_dropped$alpha.drop) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") +print(round(cor_matrix, 5)) + +# Descriptive statistics +desc_stats <- describe(reliability_data) +print(desc_stats) + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +print(summary_table) + +# Save results +write.csv(summary_table, "reliability_summary_ehi.csv", row.names = FALSE) + +# Create HTML output using knitr +library(knitr) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175223.r b/.history/eohi2/reliability - ehi_20251028175223.r new file mode 100644 index 0000000..80cb31d --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175223.r @@ -0,0 +1,61 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Descriptive Statistics

", + kable(desc_stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175227.r b/.history/eohi2/reliability - ehi_20251028175227.r new file mode 100644 index 0000000..22e1ff0 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175227.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175230.r b/.history/eohi2/reliability - ehi_20251028175230.r new file mode 100644 index 0000000..22e1ff0 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175230.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175322.r b/.history/eohi2/reliability - ehi_20251028175322.r new file mode 100644 index 0000000..22e1ff0 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175322.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175530.r b/.history/eohi2/reliability - ehi_20251028175530.r new file mode 100644 index 0000000..6e64796 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175530.r @@ -0,0 +1,61 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Corrected Item-Total Correlations

", + kable(alpha_result$item.stats, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175535.r b/.history/eohi2/reliability - ehi_20251028175535.r new file mode 100644 index 0000000..6e64796 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175535.r @@ -0,0 +1,61 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Corrected Item-Total Correlations

", + kable(alpha_result$item.stats, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175559.r b/.history/eohi2/reliability - ehi_20251028175559.r new file mode 100644 index 0000000..6e64796 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175559.r @@ -0,0 +1,61 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Corrected Item-Total Correlations

", + kable(alpha_result$item.stats, format = "html"), + + "

Inter-Item Correlations

", + kable(round(cor_matrix, 5), format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175617.r b/.history/eohi2/reliability - ehi_20251028175617.r new file mode 100644 index 0000000..c731daa --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175617.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Corrected Item-Total Correlations

", + kable(alpha_result$item.stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175618.r b/.history/eohi2/reliability - ehi_20251028175618.r new file mode 100644 index 0000000..c731daa --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175618.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Corrected Item-Total Correlations

", + kable(alpha_result$item.stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175644.r b/.history/eohi2/reliability - ehi_20251028175644.r new file mode 100644 index 0000000..36d75a8 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175644.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175648.r b/.history/eohi2/reliability - ehi_20251028175648.r new file mode 100644 index 0000000..36d75a8 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175648.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028175651.r b/.history/eohi2/reliability - ehi_20251028175651.r new file mode 100644 index 0000000..36d75a8 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028175651.r @@ -0,0 +1,58 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Summary Table

", + kable(summary_table, format = "html"), + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180009.r b/.history/eohi2/reliability - ehi_20251028180009.r new file mode 100644 index 0000000..84c0c15 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180009.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_dropped$alpha.drop, format = "html"), + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180012.r b/.history/eohi2/reliability - ehi_20251028180012.r new file mode 100644 index 0000000..6ee7cdf --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180012.r @@ -0,0 +1,53 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180015.r b/.history/eohi2/reliability - ehi_20251028180015.r new file mode 100644 index 0000000..6ee7cdf --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180015.r @@ -0,0 +1,53 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180017.r b/.history/eohi2/reliability - ehi_20251028180017.r new file mode 100644 index 0000000..6ee7cdf --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180017.r @@ -0,0 +1,53 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180125.r b/.history/eohi2/reliability - ehi_20251028180125.r new file mode 100644 index 0000000..d059220 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180125.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180127.r b/.history/eohi2/reliability - ehi_20251028180127.r new file mode 100644 index 0000000..d059220 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180127.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability - ehi_20251028180136.r b/.history/eohi2/reliability - ehi_20251028180136.r new file mode 100644 index 0000000..d059220 --- /dev/null +++ b/.history/eohi2/reliability - ehi_20251028180136.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/.history/eohi2/reliability analysis_20251027165337.r b/.history/eohi2/reliability analysis_20251027165337.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/eohi2/reliability analysis_20251027165338.r b/.history/eohi2/reliability analysis_20251027165338.r new file mode 100644 index 0000000..51562a9 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251027165338.r @@ -0,0 +1,7 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") \ No newline at end of file diff --git a/.history/eohi2/reliability analysis_20251028141004.r b/.history/eohi2/reliability analysis_20251028141004.r new file mode 100644 index 0000000..a47b227 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028141004.r @@ -0,0 +1,90 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") + +library(psych) +library(dplyr) +library(knitr) + +# variable sets +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_tv", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_tv", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_tv", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_tv", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# reliability +reliability_results <- data.frame(Scale=character(), Alpha=double(), Omega=double(), stringsAsFactors=FALSE) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + if(!all(vars %in% names(df))) next + dat <- df[, vars] + alpha_val <- tryCatch({psych::alpha(dat)$total$raw_alpha}, error=function(e) NA) + omega_val <- tryCatch({psych::omega(dat, nfactors=1)$omega.tot}, error=function(e) NA) + reliability_results <- rbind(reliability_results, data.frame(Scale=scale_name, Alpha=alpha_val, Omega=omega_val)) +} + +print(kable(reliability_results, digits=3, caption="Internal Consistency (Alpha & Omega)")) + +# ICC test-retest +df$pref_present <- rowMeans(df[, present_pref_vars], na.rm=TRUE) +df$pref_past5 <- rowMeans(df[, past_5_pref_vars], na.rm=TRUE) +df$pref_past10 <- rowMeans(df[, past_10_pref_vars], na.rm=TRUE) +df$pref_fut5 <- rowMeans(df[, fut_5_pref_vars], na.rm=TRUE) +df$pref_fut10 <- rowMeans(df[, fut_10_pref_vars], na.rm=TRUE) +pref_mat <- df[, c("pref_present","pref_past5","pref_past10","pref_fut5","pref_fut10")] + +df$pers_present <- rowMeans(df[, present_pers_vars], na.rm=TRUE) +df$pers_past5 <- rowMeans(df[, past_5_pers_vars], na.rm=TRUE) +df$pers_past10 <- rowMeans(df[, past_10_pers_vars], na.rm=TRUE) +df$pers_fut5 <- rowMeans(df[, fut_5_pers_vars], na.rm=TRUE) +df$pers_fut10 <- rowMeans(df[, fut_10_pers_vars], na.rm=TRUE) +pers_mat <- df[, c("pers_present","pers_past5","pers_past10","pers_fut5","pers_fut10")] + +df$val_present <- rowMeans(df[, present_val_vars], na.rm=TRUE) +df$val_past5 <- rowMeans(df[, past_5_val_vars], na.rm=TRUE) +df$val_past10 <- rowMeans(df[, past_10_val_vars], na.rm=TRUE) +df$val_fut5 <- rowMeans(df[, fut_5_val_vars], na.rm=TRUE) +df$val_fut10 <- rowMeans(df[, fut_10_val_vars], na.rm=TRUE) +val_mat <- df[, c("val_present","val_past5","val_past10","val_fut5","val_fut10")] + +icc_pref <- psych::ICC(pref_mat) +icc_pers <- psych::ICC(pers_mat) +icc_val <- psych::ICC(val_mat) + +print(kable(icc_pref$results["Single_raters_absolute", , drop=FALSE], caption="Test–Retest ICC: Preferences")) +print(kable(icc_pers$results["Single_raters_absolute", , drop=FALSE], caption="Test–Retest ICC: Personality")) +print(kable(icc_val$results["Single_raters_absolute", , drop=FALSE], caption="Test–Retest ICC: Values")) diff --git a/.history/eohi2/reliability analysis_20251028141504.r b/.history/eohi2/reliability analysis_20251028141504.r new file mode 100644 index 0000000..3b7fa32 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028141504.r @@ -0,0 +1,130 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") + +library(psych) +library(dplyr) +library(knitr) + +# CORRECTED variable sets with exact names from your data +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Verify all variables exist in dataset +cat("Checking variable availability:\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + missing_vars <- vars[!vars %in% names(df)] + if(length(missing_vars) > 0) { + cat("MISSING in", scale_name, ":", paste(missing_vars, collapse=", "), "\n") + } else { + cat("✓ All variables found for", scale_name, "\n") + } +} + +# Reliability analysis +reliability_results <- data.frame(Scale=character(), Alpha=double(), Omega=double(), stringsAsFactors=FALSE) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + + # Check if all variables exist + missing_vars <- vars[!vars %in% names(df)] + if(length(missing_vars) > 0) { + cat("Skipping", scale_name, "- missing variables:", paste(missing_vars, collapse=", "), "\n") + next + } + + dat <- df[, vars] + + # Calculate Alpha + alpha_val <- tryCatch({ + alpha_result <- psych::alpha(dat, check.keys = TRUE) + alpha_result$total$raw_alpha + }, error = function(e) { + cat("Alpha calculation failed for", scale_name, ":", e$message, "\n") + NA + }) + + # Calculate Omega with proper settings + omega_val <- tryCatch({ + omega_result <- psych::omega(dat, nfactors = 1, check.keys = TRUE) + omega_result$omega.tot + }, error = function(e) { + cat("Omega calculation failed for", scale_name, ":", e$message, "\n") + NA + }) + + reliability_results <- rbind(reliability_results, + data.frame(Scale = scale_name, + Alpha = alpha_val, + Omega = omega_val)) +} + +print(kable(reliability_results, digits = 3, caption = "Internal Consistency (Alpha & Omega)")) + +# Test-retest reliability +df$pref_present <- rowMeans(df[, present_pref_vars], na.rm = TRUE) +df$pref_past5 <- rowMeans(df[, past_5_pref_vars], na.rm = TRUE) +df$pref_past10 <- rowMeans(df[, past_10_pref_vars], na.rm = TRUE) +df$pref_fut5 <- rowMeans(df[, fut_5_pref_vars], na.rm = TRUE) +df$pref_fut10 <- rowMeans(df[, fut_10_pref_vars], na.rm = TRUE) +pref_mat <- df[, c("pref_present", "pref_past5", "pref_past10", "pref_fut5", "pref_fut10")] + +df$pers_present <- rowMeans(df[, present_pers_vars], na.rm = TRUE) +df$pers_past5 <- rowMeans(df[, past_5_pers_vars], na.rm = TRUE) +df$pers_past10 <- rowMeans(df[, past_10_pers_vars], na.rm = TRUE) +df$pers_fut5 <- rowMeans(df[, fut_5_pers_vars], na.rm = TRUE) +df$pers_fut10 <- rowMeans(df[, fut_10_pers_vars], na.rm = TRUE) +pers_mat <- df[, c("pers_present", "pers_past5", "pers_past10", "pers_fut5", "pers_fut10")] + +df$val_present <- rowMeans(df[, present_val_vars], na.rm = TRUE) +df$val_past5 <- rowMeans(df[, past_5_val_vars], na.rm = TRUE) +df$val_past10 <- rowMeans(df[, past_10_val_vars], na.rm = TRUE) +df$val_fut5 <- rowMeans(df[, fut_5_val_vars], na.rm = TRUE) +df$val_fut10 <- rowMeans(df[, fut_10_val_vars], na.rm = TRUE) +val_mat <- df[, c("val_present", "val_past5", "val_past10", "val_fut5", "val_fut10")] + +# Calculate ICC +icc_pref <- psych::ICC(pref_mat) +icc_pers <- psych::ICC(pers_mat) +icc_val <- psych::ICC(val_mat) + +print(kable(icc_pref$results["Single_raters_absolute", , drop = FALSE], caption = "Test–Retest ICC: Preferences")) +print(kable(icc_pers$results["Single_raters_absolute", , drop = FALSE], caption = "Test–Retest ICC: Personality")) +print(kable(icc_val$results["Single_raters_absolute", , drop = FALSE], caption = "Test–Retest ICC: Values")) \ No newline at end of file diff --git a/.history/eohi2/reliability analysis_20251028144222.r b/.history/eohi2/reliability analysis_20251028144222.r new file mode 100644 index 0000000..cbbe5d9 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028144222.r @@ -0,0 +1,87 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics (can be suppressed) + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } else { + cat("\n", scale_name, ": Not enough items for alpha analysis.\n") + } +} + +# Summary table for reporting +knitr::kable(summary_tbl) diff --git a/.history/eohi2/reliability analysis_20251028151252.r b/.history/eohi2/reliability analysis_20251028151252.r new file mode 100644 index 0000000..32ec68b --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151252.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics (can be suppressed) + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } else { + cat("\n", scale_name, ": Not enough items for alpha analysis.\n") + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +knitr::kable(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +knitr::kable(alpha_dropped_tbl) diff --git a/.history/eohi2/reliability analysis_20251028151259.r b/.history/eohi2/reliability analysis_20251028151259.r new file mode 100644 index 0000000..3191324 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151259.r @@ -0,0 +1,129 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics (can be suppressed) + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } else { + cat("\n", scale_name, ": Not enough items for alpha analysis.\n") + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +knitr::kable(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) + +cat("\nTables exported to CSV files:\n") +cat("- reliability_summary_table.csv\n") +cat("- alpha_if_dropped_table.csv\n") diff --git a/.history/eohi2/reliability analysis_20251028151305.r b/.history/eohi2/reliability analysis_20251028151305.r new file mode 100644 index 0000000..3191324 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151305.r @@ -0,0 +1,129 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics (can be suppressed) + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } else { + cat("\n", scale_name, ": Not enough items for alpha analysis.\n") + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +knitr::kable(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) + +cat("\nTables exported to CSV files:\n") +cat("- reliability_summary_table.csv\n") +cat("- alpha_if_dropped_table.csv\n") diff --git a/.history/eohi2/reliability analysis_20251028151323.r b/.history/eohi2/reliability analysis_20251028151323.r new file mode 100644 index 0000000..63088e9 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151323.r @@ -0,0 +1,129 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } else { + cat("\n", scale_name, ": Not enough items for alpha analysis.\n") + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +knitr::kable(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) + +cat("\nTables exported to CSV files:\n") +cat("- reliability_summary_table.csv\n") +cat("- alpha_if_dropped_table.csv\n") diff --git a/.history/eohi2/reliability analysis_20251028151326.r b/.history/eohi2/reliability analysis_20251028151326.r new file mode 100644 index 0000000..8eb5f45 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151326.r @@ -0,0 +1,127 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +knitr::kable(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) + +cat("\nTables exported to CSV files:\n") +cat("- reliability_summary_table.csv\n") +cat("- alpha_if_dropped_table.csv\n") diff --git a/.history/eohi2/reliability analysis_20251028151330.r b/.history/eohi2/reliability analysis_20251028151330.r new file mode 100644 index 0000000..3596b78 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151330.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +knitr::kable(summary_tbl) + +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151333.r b/.history/eohi2/reliability analysis_20251028151333.r new file mode 100644 index 0000000..3596b78 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151333.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +knitr::kable(summary_tbl) + +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151339.r b/.history/eohi2/reliability analysis_20251028151339.r new file mode 100644 index 0000000..3596b78 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151339.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +knitr::kable(summary_tbl) + +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151358.r b/.history/eohi2/reliability analysis_20251028151358.r new file mode 100644 index 0000000..4ec8bc2 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151358.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +knitr::kable(summary_tbl) + +knitr::kable(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151540.r b/.history/eohi2/reliability analysis_20251028151540.r new file mode 100644 index 0000000..e052909 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151540.r @@ -0,0 +1,123 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +print(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151544.r b/.history/eohi2/reliability analysis_20251028151544.r new file mode 100644 index 0000000..e052909 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151544.r @@ -0,0 +1,123 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +print(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151808.r b/.history/eohi2/reliability analysis_20251028151808.r new file mode 100644 index 0000000..a003e09 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151808.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151819.r b/.history/eohi2/reliability analysis_20251028151819.r new file mode 100644 index 0000000..a003e09 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151819.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151900.r b/.history/eohi2/reliability analysis_20251028151900.r new file mode 100644 index 0000000..a003e09 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151900.r @@ -0,0 +1,121 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151917.r b/.history/eohi2/reliability analysis_20251028151917.r new file mode 100644 index 0000000..a7303b3 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151917.r @@ -0,0 +1,140 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed (indicated by negative signs in keys) + reversed_items <- names(alpha_out$keys)[alpha_out$keys < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151922.r b/.history/eohi2/reliability analysis_20251028151922.r new file mode 100644 index 0000000..a7303b3 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151922.r @@ -0,0 +1,140 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed (indicated by negative signs in keys) + reversed_items <- names(alpha_out$keys)[alpha_out$keys < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028151925.r b/.history/eohi2/reliability analysis_20251028151925.r new file mode 100644 index 0000000..a7303b3 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028151925.r @@ -0,0 +1,140 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed (indicated by negative signs in keys) + reversed_items <- names(alpha_out$keys)[alpha_out$keys < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152017.r b/.history/eohi2/reliability analysis_20251028152017.r new file mode 100644 index 0000000..c6660b5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152017.r @@ -0,0 +1,141 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed (indicated by negative signs in keys) + keys_vector <- as.numeric(alpha_out$keys) + reversed_items <- names(alpha_out$keys)[keys_vector < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152020.r b/.history/eohi2/reliability analysis_20251028152020.r new file mode 100644 index 0000000..c6660b5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152020.r @@ -0,0 +1,141 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed (indicated by negative signs in keys) + keys_vector <- as.numeric(alpha_out$keys) + reversed_items <- names(alpha_out$keys)[keys_vector < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152033.r b/.history/eohi2/reliability analysis_20251028152033.r new file mode 100644 index 0000000..c6660b5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152033.r @@ -0,0 +1,141 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed (indicated by negative signs in keys) + keys_vector <- as.numeric(alpha_out$keys) + reversed_items <- names(alpha_out$keys)[keys_vector < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152127.r b/.history/eohi2/reliability analysis_20251028152127.r new file mode 100644 index 0000000..7bb25dc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152127.r @@ -0,0 +1,145 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Summary table for reporting +print(summary_tbl) + +print(alpha_dropped_tbl) + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152132.r b/.history/eohi2/reliability analysis_20251028152132.r new file mode 100644 index 0000000..b32a37f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152132.r @@ -0,0 +1,148 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +print(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +print(alpha_dropped_tbl) +cat("Alpha dropped table has", nrow(alpha_dropped_tbl), "rows\n") + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152134.r b/.history/eohi2/reliability analysis_20251028152134.r new file mode 100644 index 0000000..b32a37f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152134.r @@ -0,0 +1,148 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +print(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +print(alpha_dropped_tbl) +cat("Alpha dropped table has", nrow(alpha_dropped_tbl), "rows\n") + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028152156.r b/.history/eohi2/reliability analysis_20251028152156.r new file mode 100644 index 0000000..b32a37f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028152156.r @@ -0,0 +1,148 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Summary table for reporting +cat("\n=== SUMMARY TABLE ===\n") +print(summary_tbl) + +cat("\n=== ALPHA IF DROPPED TABLE ===\n") +print(alpha_dropped_tbl) +cat("Alpha dropped table has", nrow(alpha_dropped_tbl), "rows\n") + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028161222.r b/.history/eohi2/reliability analysis_20251028161222.r new file mode 100644 index 0000000..1ad0cc7 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161222.r @@ -0,0 +1,140 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_tbl <- data.frame( + Scale = character(), + RawAlpha = numeric(), + StdAlpha = numeric(), + AvgItemRestCor = numeric() +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028161229.r b/.history/eohi2/reliability analysis_20251028161229.r new file mode 100644 index 0000000..34352f7 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161229.r @@ -0,0 +1,134 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary stats for table + raw_alpha <- round(alpha_out$total$raw_alpha, 3) + std_alpha <- round(alpha_out$total$std.alpha, 3) + avg_ir <- round(mean(alpha_out$item.stats$r.drop, na.rm=TRUE), 3) + summary_tbl <- rbind(summary_tbl, data.frame( + Scale = scale_name, + RawAlpha = raw_alpha, + StdAlpha = std_alpha, + AvgItemRestCor = avg_ir + )) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028161236.r b/.history/eohi2/reliability analysis_20251028161236.r new file mode 100644 index 0000000..3679439 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161236.r @@ -0,0 +1,123 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + } +} + +# Create detailed alpha if dropped table +alpha_dropped_tbl <- data.frame( + Scale = character(), + Item = character(), + AlphaIfDropped = numeric(), + stringsAsFactors = FALSE +) + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Extract alpha if dropped for each item + for(i in 1:length(vars)) { + item_name <- vars[i] + alpha_dropped <- alpha_out$alpha.drop$raw_alpha[i] + + alpha_dropped_tbl <- rbind(alpha_dropped_tbl, data.frame( + Scale = scale_name, + Item = item_name, + AlphaIfDropped = round(alpha_dropped, 4), + stringsAsFactors = FALSE + )) + } + } +} + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028161240.r b/.history/eohi2/reliability analysis_20251028161240.r new file mode 100644 index 0000000..62366f2 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161240.r @@ -0,0 +1,94 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + } +} + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + +# Export tables to CSV +#write.csv(summary_tbl, "reliability_summary_table.csv", row.names = FALSE) +#write.csv(alpha_dropped_tbl, "alpha_if_dropped_table.csv", row.names = FALSE) diff --git a/.history/eohi2/reliability analysis_20251028161242.r b/.history/eohi2/reliability analysis_20251028161242.r new file mode 100644 index 0000000..0da2aba --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161242.r @@ -0,0 +1,91 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + } +} + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028161247.r b/.history/eohi2/reliability analysis_20251028161247.r new file mode 100644 index 0000000..0da2aba --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161247.r @@ -0,0 +1,91 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + } +} + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028161950.r b/.history/eohi2/reliability analysis_20251028161950.r new file mode 100644 index 0000000..0da2aba --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028161950.r @@ -0,0 +1,91 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + } +} + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162118.r b/.history/eohi2/reliability analysis_20251028162118.r new file mode 100644 index 0000000..c09b4e9 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162118.r @@ -0,0 +1,110 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +all_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Combine results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Add row type identifier + scale_total$Output_Type <- "Total" + scale_items$Output_Type <- "Item_Stats" + scale_alpha_drop$Output_Type <- "Alpha_Drop" + + # Combine all results + all_results <- rbind(all_results, scale_total, scale_items, scale_alpha_drop) + } +} + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162136.r b/.history/eohi2/reliability analysis_20251028162136.r new file mode 100644 index 0000000..594eb57 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162136.r @@ -0,0 +1,113 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +all_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Combine results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Add row type identifier + scale_total$Output_Type <- "Total" + scale_items$Output_Type <- "Item_Stats" + scale_alpha_drop$Output_Type <- "Alpha_Drop" + + # Combine all results + all_results <- rbind(all_results, scale_total, scale_items, scale_alpha_drop) + } +} + +# Export results to CSV +write.csv(all_results, "reliability_analysis_results.csv", row.names = TRUE) +cat("\nResults exported to: reliability_analysis_results.csv\n") + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162145.r b/.history/eohi2/reliability analysis_20251028162145.r new file mode 100644 index 0000000..594eb57 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162145.r @@ -0,0 +1,113 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +all_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Combine results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Add row type identifier + scale_total$Output_Type <- "Total" + scale_items$Output_Type <- "Item_Stats" + scale_alpha_drop$Output_Type <- "Alpha_Drop" + + # Combine all results + all_results <- rbind(all_results, scale_total, scale_items, scale_alpha_drop) + } +} + +# Export results to CSV +write.csv(all_results, "reliability_analysis_results.csv", row.names = TRUE) +cat("\nResults exported to: reliability_analysis_results.csv\n") + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162201.r b/.history/eohi2/reliability analysis_20251028162201.r new file mode 100644 index 0000000..d8a7b60 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162201.r @@ -0,0 +1,113 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +all_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Combine results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Add row type identifier + scale_total$Output_Type <- "Total" + scale_items$Output_Type <- "Item_Stats" + scale_alpha_drop$Output_Type <- "Alpha_Drop" + + # Combine all results + all_results <- rbind(all_results, scale_total, scale_items, scale_alpha_drop) + } +} + +# Export results to CSV +write.csv(all_results, "reliability_analysis_results.csv", row.names = TRUE) + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162240.r b/.history/eohi2/reliability analysis_20251028162240.r new file mode 100644 index 0000000..67eed4a --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162240.r @@ -0,0 +1,114 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Export results to separate CSV files +write.csv(total_results, "reliability_total_stats.csv", row.names = TRUE) +write.csv(item_stats_results, "reliability_item_stats.csv", row.names = TRUE) +write.csv(alpha_drop_results, "reliability_alpha_drop.csv", row.names = TRUE) + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162243.r b/.history/eohi2/reliability analysis_20251028162243.r new file mode 100644 index 0000000..67eed4a --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162243.r @@ -0,0 +1,114 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Export results to separate CSV files +write.csv(total_results, "reliability_total_stats.csv", row.names = TRUE) +write.csv(item_stats_results, "reliability_item_stats.csv", row.names = TRUE) +write.csv(alpha_drop_results, "reliability_alpha_drop.csv", row.names = TRUE) + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162251.r b/.history/eohi2/reliability analysis_20251028162251.r new file mode 100644 index 0000000..67eed4a --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162251.r @@ -0,0 +1,114 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Export results to separate CSV files +write.csv(total_results, "reliability_total_stats.csv", row.names = TRUE) +write.csv(item_stats_results, "reliability_item_stats.csv", row.names = TRUE) +write.csv(alpha_drop_results, "reliability_alpha_drop.csv", row.names = TRUE) + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162450.r b/.history/eohi2/reliability analysis_20251028162450.r new file mode 100644 index 0000000..02e2aa3 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162450.r @@ -0,0 +1,175 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Create HTML report +html_content <- " + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: " %+% Sys.time() %+% "

" + +# Add total statistics +html_content <- html_content %+% "

Overall Scale Statistics

+
+ + " + +for(i in 1:nrow(total_results)) { + row <- total_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r) +} + +html_content <- html_content %+% "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
" + +# Add item statistics +html_content <- html_content %+% "

Item Statistics

+ + " + +for(i in 1:nrow(item_stats_results)) { + row <- item_stats_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd) +} + +html_content <- html_content %+% "
ScaleItemnRaw rStd rr.corr.dropMeanSD
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f
" + +# Add alpha if dropped +html_content <- html_content %+% "

Alpha If Item Dropped

+ + " + +for(i in 1:nrow(alpha_drop_results)) { + row <- alpha_drop_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, rownames(row), row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$alpha.se, row$var.r, row$med.r) +} + +html_content <- html_content %+% "
ScaleItemRaw AlphaStd AlphaG6(SMC)Average rS/NAlpha SEVar rMed r
%s%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +" + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162455.r b/.history/eohi2/reliability analysis_20251028162455.r new file mode 100644 index 0000000..02e2aa3 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162455.r @@ -0,0 +1,175 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Create HTML report +html_content <- " + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: " %+% Sys.time() %+% "

" + +# Add total statistics +html_content <- html_content %+% "

Overall Scale Statistics

+
+ + " + +for(i in 1:nrow(total_results)) { + row <- total_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r) +} + +html_content <- html_content %+% "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
" + +# Add item statistics +html_content <- html_content %+% "

Item Statistics

+ + " + +for(i in 1:nrow(item_stats_results)) { + row <- item_stats_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd) +} + +html_content <- html_content %+% "
ScaleItemnRaw rStd rr.corr.dropMeanSD
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f
" + +# Add alpha if dropped +html_content <- html_content %+% "

Alpha If Item Dropped

+ + " + +for(i in 1:nrow(alpha_drop_results)) { + row <- alpha_drop_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, rownames(row), row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$alpha.se, row$var.r, row$med.r) +} + +html_content <- html_content %+% "
ScaleItemRaw AlphaStd AlphaG6(SMC)Average rS/NAlpha SEVar rMed r
%s%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +" + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162504.r b/.history/eohi2/reliability analysis_20251028162504.r new file mode 100644 index 0000000..02e2aa3 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162504.r @@ -0,0 +1,175 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Create HTML report +html_content <- " + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: " %+% Sys.time() %+% "

" + +# Add total statistics +html_content <- html_content %+% "

Overall Scale Statistics

+
+ + " + +for(i in 1:nrow(total_results)) { + row <- total_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r) +} + +html_content <- html_content %+% "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
" + +# Add item statistics +html_content <- html_content %+% "

Item Statistics

+ + " + +for(i in 1:nrow(item_stats_results)) { + row <- item_stats_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd) +} + +html_content <- html_content %+% "
ScaleItemnRaw rStd rr.corr.dropMeanSD
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f
" + +# Add alpha if dropped +html_content <- html_content %+% "

Alpha If Item Dropped

+ + " + +for(i in 1:nrow(alpha_drop_results)) { + row <- alpha_drop_results[i,] + html_content <- html_content %+% sprintf("", + row$Scale, rownames(row), row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$alpha.se, row$var.r, row$med.r) +} + +html_content <- html_content %+% "
ScaleItemRaw AlphaStd AlphaG6(SMC)Average rS/NAlpha SEVar rMed r
%s%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +" + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162602.r b/.history/eohi2/reliability analysis_20251028162602.r new file mode 100644 index 0000000..32fbc51 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162602.r @@ -0,0 +1,175 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Create HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

") + +# Add total statistics +html_content <- paste0(html_content, "

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(total_results)) { + row <- total_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_stats_results)) { + row <- item_stats_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSD
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add alpha if dropped +html_content <- paste0(html_content, "

Alpha If Item Dropped

+ + ") + +for(i in 1:nrow(alpha_drop_results)) { + row <- alpha_drop_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$alpha.se, row$var.r, row$med.r)) +} + +html_content <- paste0(html_content, "
ScaleItemRaw AlphaStd AlphaG6(SMC)Average rS/NAlpha SEVar rMed r
%s%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162606.r b/.history/eohi2/reliability analysis_20251028162606.r new file mode 100644 index 0000000..32fbc51 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162606.r @@ -0,0 +1,175 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Create HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

") + +# Add total statistics +html_content <- paste0(html_content, "

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(total_results)) { + row <- total_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_stats_results)) { + row <- item_stats_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSD
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add alpha if dropped +html_content <- paste0(html_content, "

Alpha If Item Dropped

+ + ") + +for(i in 1:nrow(alpha_drop_results)) { + row <- alpha_drop_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$alpha.se, row$var.r, row$med.r)) +} + +html_content <- paste0(html_content, "
ScaleItemRaw AlphaStd AlphaG6(SMC)Average rS/NAlpha SEVar rMed r
%s%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162608.r b/.history/eohi2/reliability analysis_20251028162608.r new file mode 100644 index 0000000..32fbc51 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162608.r @@ -0,0 +1,175 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +total_results <- data.frame() +item_stats_results <- data.frame() +alpha_drop_results <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Prepare results for CSV export + scale_total <- alpha_out$total + scale_items <- alpha_out$item.stats + scale_alpha_drop <- alpha_out$alpha.drop + + # Add scale name to each row + scale_total$Scale <- scale_name + scale_items$Scale <- scale_name + scale_alpha_drop$Scale <- scale_name + + # Combine results by type + total_results <- rbind(total_results, scale_total) + item_stats_results <- rbind(item_stats_results, scale_items) + alpha_drop_results <- rbind(alpha_drop_results, scale_alpha_drop) + } +} + +# Create HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

") + +# Add total statistics +html_content <- paste0(html_content, "

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(total_results)) { + row <- total_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_stats_results)) { + row <- item_stats_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSD
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add alpha if dropped +html_content <- paste0(html_content, "

Alpha If Item Dropped

+ + ") + +for(i in 1:nrow(alpha_drop_results)) { + row <- alpha_drop_results[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$alpha.se, row$var.r, row$med.r)) +} + +html_content <- paste0(html_content, "
ScaleItemRaw AlphaStd AlphaG6(SMC)Average rS/NAlpha SEVar rMed r
%s%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162820.r b/.history/eohi2/reliability analysis_20251028162820.r new file mode 100644 index 0000000..6a63d2f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162820.r @@ -0,0 +1,134 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162852.r b/.history/eohi2/reliability analysis_20251028162852.r new file mode 100644 index 0000000..6a63d2f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162852.r @@ -0,0 +1,134 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162935.r b/.history/eohi2/reliability analysis_20251028162935.r new file mode 100644 index 0000000..f1c45d1 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162935.r @@ -0,0 +1,142 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162951.r b/.history/eohi2/reliability analysis_20251028162951.r new file mode 100644 index 0000000..f5f7c39 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162951.r @@ -0,0 +1,155 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028162955.r b/.history/eohi2/reliability analysis_20251028162955.r new file mode 100644 index 0000000..f5f7c39 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028162955.r @@ -0,0 +1,155 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163006.r b/.history/eohi2/reliability analysis_20251028163006.r new file mode 100644 index 0000000..f5f7c39 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163006.r @@ -0,0 +1,155 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163158.r b/.history/eohi2/reliability analysis_20251028163158.r new file mode 100644 index 0000000..51f7cf5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163158.r @@ -0,0 +1,158 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163211.r b/.history/eohi2/reliability analysis_20251028163211.r new file mode 100644 index 0000000..9877efc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163211.r @@ -0,0 +1,164 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163215.r b/.history/eohi2/reliability analysis_20251028163215.r new file mode 100644 index 0000000..9877efc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163215.r @@ -0,0 +1,164 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163222.r b/.history/eohi2/reliability analysis_20251028163222.r new file mode 100644 index 0000000..9877efc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163222.r @@ -0,0 +1,164 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163310.r b/.history/eohi2/reliability analysis_20251028163310.r new file mode 100644 index 0000000..bb2754d --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163310.r @@ -0,0 +1,165 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163331.r b/.history/eohi2/reliability analysis_20251028163331.r new file mode 100644 index 0000000..7f2abb0 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163331.r @@ -0,0 +1,186 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() +icc_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Calculate ICC(2,1) + tryCatch({ + icc_result <- icc(scale_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", scale_name, ":", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Scale = scale_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", scale_name, ":", e$message, "\n") + }) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
+ +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163339.r b/.history/eohi2/reliability analysis_20251028163339.r new file mode 100644 index 0000000..ebaa792 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163339.r @@ -0,0 +1,203 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() +icc_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Calculate ICC(2,1) + tryCatch({ + icc_result <- icc(scale_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", scale_name, ":", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Scale = scale_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", scale_name, ":", e$message, "\n") + }) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ScaleICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163348.r b/.history/eohi2/reliability analysis_20251028163348.r new file mode 100644 index 0000000..ebaa792 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163348.r @@ -0,0 +1,203 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() +icc_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Calculate ICC(2,1) + tryCatch({ + icc_result <- icc(scale_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", scale_name, ":", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Scale = scale_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", scale_name, ":", e$message, "\n") + }) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ScaleICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028163622.r b/.history/eohi2/reliability analysis_20251028163622.r new file mode 100644 index 0000000..ebaa792 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028163622.r @@ -0,0 +1,203 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() +icc_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Calculate ICC(2,1) + tryCatch({ + icc_result <- icc(scale_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", scale_name, ":", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Scale = scale_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", scale_name, ":", e$message, "\n") + }) + + # Collect summary data for HTML + total_row <- alpha_out$total + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- rows in summary_data:", nrow(summary_data), "\n") + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ScaleICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164143.r b/.history/eohi2/reliability analysis_20251028164143.r new file mode 100644 index 0000000..cbf7b12 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164143.r @@ -0,0 +1,231 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ScaleICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164153.r b/.history/eohi2/reliability analysis_20251028164153.r new file mode 100644 index 0000000..2e1611f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164153.r @@ -0,0 +1,231 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164158.r b/.history/eohi2/reliability analysis_20251028164158.r new file mode 100644 index 0000000..2e1611f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164158.r @@ -0,0 +1,231 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164324.r b/.history/eohi2/reliability analysis_20251028164324.r new file mode 100644 index 0000000..2e1611f --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164324.r @@ -0,0 +1,231 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + summary_data <- rbind(summary_data, total_row) + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164342.r b/.history/eohi2/reliability analysis_20251028164342.r new file mode 100644 index 0000000..bcad1c5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164342.r @@ -0,0 +1,235 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164345.r b/.history/eohi2/reliability analysis_20251028164345.r new file mode 100644 index 0000000..4f834cc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164345.r @@ -0,0 +1,239 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + if(nrow(item_data) == 0) { + item_data <- item_row + } else { + item_data <- rbind(item_data, item_row) + } + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164350.r b/.history/eohi2/reliability analysis_20251028164350.r new file mode 100644 index 0000000..4f834cc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164350.r @@ -0,0 +1,239 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + if(nrow(item_data) == 0) { + item_data <- item_row + } else { + item_data <- rbind(item_data, item_row) + } + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164357.r b/.history/eohi2/reliability analysis_20251028164357.r new file mode 100644 index 0000000..4f834cc --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164357.r @@ -0,0 +1,239 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + if(nrow(item_data) == 0) { + item_data <- item_row + } else { + item_data <- rbind(item_data, item_row) + } + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + icc_data <- rbind(icc_data, icc_row) + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164422.r b/.history/eohi2/reliability analysis_20251028164422.r new file mode 100644 index 0000000..0e6545e --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164422.r @@ -0,0 +1,243 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + if(nrow(item_data) == 0) { + item_data <- item_row + } else { + item_data <- rbind(item_data, item_row) + } + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164426.r b/.history/eohi2/reliability analysis_20251028164426.r new file mode 100644 index 0000000..0e6545e --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164426.r @@ -0,0 +1,243 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + if(nrow(item_data) == 0) { + item_data <- item_row + } else { + item_data <- rbind(item_data, item_row) + } + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164514.r b/.history/eohi2/reliability analysis_20251028164514.r new file mode 100644 index 0000000..0e6545e --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164514.r @@ -0,0 +1,243 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + if(nrow(item_data) == 0) { + item_data <- item_row + } else { + item_data <- rbind(item_data, item_row) + } + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164546.r b/.history/eohi2/reliability analysis_20251028164546.r new file mode 100644 index 0000000..d8d4d29 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164546.r @@ -0,0 +1,239 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164551.r b/.history/eohi2/reliability analysis_20251028164551.r new file mode 100644 index 0000000..d8d4d29 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164551.r @@ -0,0 +1,239 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164558.r b/.history/eohi2/reliability analysis_20251028164558.r new file mode 100644 index 0000000..d8d4d29 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164558.r @@ -0,0 +1,239 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164641.r b/.history/eohi2/reliability analysis_20251028164641.r new file mode 100644 index 0000000..8f85e3d --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164641.r @@ -0,0 +1,244 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164650.r b/.history/eohi2/reliability analysis_20251028164650.r new file mode 100644 index 0000000..8f85e3d --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164650.r @@ -0,0 +1,244 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164657.r b/.history/eohi2/reliability analysis_20251028164657.r new file mode 100644 index 0000000..8f85e3d --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164657.r @@ -0,0 +1,244 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164813.r b/.history/eohi2/reliability analysis_20251028164813.r new file mode 100644 index 0000000..1eec1a6 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164813.r @@ -0,0 +1,248 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164819.r b/.history/eohi2/reliability analysis_20251028164819.r new file mode 100644 index 0000000..8c25f77 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164819.r @@ -0,0 +1,253 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028164821.r b/.history/eohi2/reliability analysis_20251028164821.r new file mode 100644 index 0000000..8c25f77 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028164821.r @@ -0,0 +1,253 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165006.r b/.history/eohi2/reliability analysis_20251028165006.r new file mode 100644 index 0000000..8c25f77 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165006.r @@ -0,0 +1,253 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165109.r b/.history/eohi2/reliability analysis_20251028165109.r new file mode 100644 index 0000000..db0a695 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165109.r @@ -0,0 +1,257 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165118.r b/.history/eohi2/reliability analysis_20251028165118.r new file mode 100644 index 0000000..b51c3f6 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165118.r @@ -0,0 +1,262 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165120.r b/.history/eohi2/reliability analysis_20251028165120.r new file mode 100644 index 0000000..b51c3f6 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165120.r @@ -0,0 +1,262 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165128.r b/.history/eohi2/reliability analysis_20251028165128.r new file mode 100644 index 0000000..b51c3f6 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165128.r @@ -0,0 +1,262 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row$Scale, row$raw_alpha, row$std.alpha, row$G6.smc, row$average_r, row$S.N, row$ase, row$mean, row$sd, row$median_r)) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165402.r b/.history/eohi2/reliability analysis_20251028165402.r new file mode 100644 index 0000000..ca9dccb --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165402.r @@ -0,0 +1,262 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165410.r b/.history/eohi2/reliability analysis_20251028165410.r new file mode 100644 index 0000000..ca9dccb --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165410.r @@ -0,0 +1,262 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028165435.r b/.history/eohi2/reliability analysis_20251028165435.r new file mode 100644 index 0000000..ca9dccb --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028165435.r @@ -0,0 +1,262 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170716.r b/.history/eohi2/reliability analysis_20251028170716.r new file mode 100644 index 0000000..6041ff6 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170716.r @@ -0,0 +1,265 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, row$p_Value)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%.4f
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170719.r b/.history/eohi2/reliability analysis_20251028170719.r new file mode 100644 index 0000000..0b8583e --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170719.r @@ -0,0 +1,274 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation for very small values + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places for larger values + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170725.r b/.history/eohi2/reliability analysis_20251028170725.r new file mode 100644 index 0000000..0b8583e --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170725.r @@ -0,0 +1,274 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation for very small values + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places for larger values + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170741.r b/.history/eohi2/reliability analysis_20251028170741.r new file mode 100644 index 0000000..0b8583e --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170741.r @@ -0,0 +1,274 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation for very small values + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places for larger values + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170822.r b/.history/eohi2/reliability analysis_20251028170822.r new file mode 100644 index 0000000..dcad3f5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170822.r @@ -0,0 +1,280 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170831.r b/.history/eohi2/reliability analysis_20251028170831.r new file mode 100644 index 0000000..dcad3f5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170831.r @@ -0,0 +1,280 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170832.r b/.history/eohi2/reliability analysis_20251028170832.r new file mode 100644 index 0000000..dcad3f5 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170832.r @@ -0,0 +1,280 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value + cat("Actual p-value for", construct_name, ":", icc_result$p.value, "\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170921.r b/.history/eohi2/reliability analysis_20251028170921.r new file mode 100644 index 0000000..f62ee62 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170921.r @@ -0,0 +1,289 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value and all ICC results + cat("ICC results for", construct_name, ":\n") + cat(" ICC value:", icc_result$value, "\n") + cat(" F value:", icc_result$Fvalue, "\n") + cat(" p-value:", icc_result$p.value, "\n") + cat(" p-value class:", class(icc_result$p.value), "\n") + cat(" p-value length:", length(icc_result$p.value), "\n") + cat(" p-value is.na:", is.na(icc_result$p.value), "\n") + cat(" p-value is.null:", is.null(icc_result$p.value), "\n") + cat(" p-value == 0:", icc_result$p.value == 0, "\n") + cat("\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170923.r b/.history/eohi2/reliability analysis_20251028170923.r new file mode 100644 index 0000000..f62ee62 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170923.r @@ -0,0 +1,289 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value and all ICC results + cat("ICC results for", construct_name, ":\n") + cat(" ICC value:", icc_result$value, "\n") + cat(" F value:", icc_result$Fvalue, "\n") + cat(" p-value:", icc_result$p.value, "\n") + cat(" p-value class:", class(icc_result$p.value), "\n") + cat(" p-value length:", length(icc_result$p.value), "\n") + cat(" p-value is.na:", is.na(icc_result$p.value), "\n") + cat(" p-value is.null:", is.null(icc_result$p.value), "\n") + cat(" p-value == 0:", icc_result$p.value == 0, "\n") + cat("\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028170935.r b/.history/eohi2/reliability analysis_20251028170935.r new file mode 100644 index 0000000..f62ee62 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028170935.r @@ -0,0 +1,289 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value and all ICC results + cat("ICC results for", construct_name, ":\n") + cat(" ICC value:", icc_result$value, "\n") + cat(" F value:", icc_result$Fvalue, "\n") + cat(" p-value:", icc_result$p.value, "\n") + cat(" p-value class:", class(icc_result$p.value), "\n") + cat(" p-value length:", length(icc_result$p.value), "\n") + cat(" p-value is.na:", is.na(icc_result$p.value), "\n") + cat(" p-value is.null:", is.null(icc_result$p.value), "\n") + cat(" p-value == 0:", icc_result$p.value == 0, "\n") + cat("\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability analysis_20251028171635.r b/.history/eohi2/reliability analysis_20251028171635.r new file mode 100644 index 0000000..f62ee62 --- /dev/null +++ b/.history/eohi2/reliability analysis_20251028171635.r @@ -0,0 +1,289 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value and all ICC results + cat("ICC results for", construct_name, ":\n") + cat(" ICC value:", icc_result$value, "\n") + cat(" F value:", icc_result$Fvalue, "\n") + cat(" p-value:", icc_result$p.value, "\n") + cat(" p-value class:", class(icc_result$p.value), "\n") + cat(" p-value length:", length(icc_result$p.value), "\n") + cat(" p-value is.na:", is.na(icc_result$p.value), "\n") + cat(" p-value is.null:", is.null(icc_result$p.value), "\n") + cat(" p-value == 0:", icc_result$p.value == 0, "\n") + cat("\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/.history/eohi2/reliability_summary_table_20251028144409.csv b/.history/eohi2/reliability_summary_table_20251028144409.csv new file mode 100644 index 0000000..7aaaece --- /dev/null +++ b/.history/eohi2/reliability_summary_table_20251028144409.csv @@ -0,0 +1,16 @@ +Scale,Time_Frame,Domain,Raw_Alpha,Std_Alpha,G6_SMC,Average_r,S_N,ASE,Mean,SD,Median_r +Present_Preferences,Present,Preferences,0.5248372,0.5538292,0.5041749,0.1988841,1.241294,0.0336335,1.582004,0.8713115,0.1965662 +Past5_Preferences,Past5,Preferences,0.5649127,0.5893789,0.5467387,0.2230397,1.435335,0.03089417,1.410634,0.9559399,0.2104482 +Past10_Preferences,Past10,Preferences,0.488938,0.523742,0.4772804,0.1802878,1.099702,0.03649826,1.397546,0.9004519,0.1690398 +Fut5_Preferences,Fut5,Preferences,0.5692099,0.587553,0.5414701,0.2217358,1.424554,0.03082567,1.587321,0.9036826,0.2250345 +Fut10_Preferences,Fut10,Preferences,0.5698939,0.5847131,0.5479539,0.2197222,1.407974,0.03076925,1.58773,0.8931506,0.2489621 +Present_Personality,Present,Personality,0.5150363,0.5266182,0.5589141,0.1819987,1.11246,0.0351599,0.6861963,0.9615554,0.2041057 +Past5_Personality,Past5,Personality,0.6124713,0.619984,0.6719927,0.2460191,1.631468,0.0287073,0.5308793,1.114899,0.2033224 +Past10_Personality,Past10,Personality,0.5912415,0.6040201,0.6557158,0.2337612,1.525381,0.03034508,0.5083845,1.11603,0.2218243 +Fut5_Personality,Fut5,Personality,0.5110326,0.5338022,0.5987905,0.186332,1.145012,0.03652723,0.8159509,0.9646153,0.1559173 +Fut10_Personality,Fut10,Personality,0.6090355,0.6252252,0.685506,0.2501803,1.668269,0.02925517,0.7873211,1.045719,0.2084592 +Present_Values,Present,Values,0.5355957,0.5489562,0.5671587,0.1957639,1.217079,0.03206684,1.280982,0.8331172,0.2003739 +Past5_Values,Past5,Values,0.5392641,0.5606175,0.5585066,0.2033042,1.275921,0.03308046,1.248671,0.8889135,0.1781123 +Past10_Values,Past10,Values,0.598008,0.6176378,0.6277172,0.2441788,1.615321,0.028953,1.22863,0.957626,0.22824 +Fut5_Values,Fut5,Values,0.5616573,0.5904551,0.6070898,0.2238116,1.441735,0.03130214,1.234356,0.9067855,0.2086639 +Fut10_Values,Fut10,Values,0.5247822,0.5552694,0.5921832,0.1998146,1.248552,0.03421231,1.234356,0.8939492,0.1716286 diff --git a/.history/eohi2/reliability_summary_table_20251028144438.csv b/.history/eohi2/reliability_summary_table_20251028144438.csv new file mode 100644 index 0000000..7aaaece --- /dev/null +++ b/.history/eohi2/reliability_summary_table_20251028144438.csv @@ -0,0 +1,16 @@ +Scale,Time_Frame,Domain,Raw_Alpha,Std_Alpha,G6_SMC,Average_r,S_N,ASE,Mean,SD,Median_r +Present_Preferences,Present,Preferences,0.5248372,0.5538292,0.5041749,0.1988841,1.241294,0.0336335,1.582004,0.8713115,0.1965662 +Past5_Preferences,Past5,Preferences,0.5649127,0.5893789,0.5467387,0.2230397,1.435335,0.03089417,1.410634,0.9559399,0.2104482 +Past10_Preferences,Past10,Preferences,0.488938,0.523742,0.4772804,0.1802878,1.099702,0.03649826,1.397546,0.9004519,0.1690398 +Fut5_Preferences,Fut5,Preferences,0.5692099,0.587553,0.5414701,0.2217358,1.424554,0.03082567,1.587321,0.9036826,0.2250345 +Fut10_Preferences,Fut10,Preferences,0.5698939,0.5847131,0.5479539,0.2197222,1.407974,0.03076925,1.58773,0.8931506,0.2489621 +Present_Personality,Present,Personality,0.5150363,0.5266182,0.5589141,0.1819987,1.11246,0.0351599,0.6861963,0.9615554,0.2041057 +Past5_Personality,Past5,Personality,0.6124713,0.619984,0.6719927,0.2460191,1.631468,0.0287073,0.5308793,1.114899,0.2033224 +Past10_Personality,Past10,Personality,0.5912415,0.6040201,0.6557158,0.2337612,1.525381,0.03034508,0.5083845,1.11603,0.2218243 +Fut5_Personality,Fut5,Personality,0.5110326,0.5338022,0.5987905,0.186332,1.145012,0.03652723,0.8159509,0.9646153,0.1559173 +Fut10_Personality,Fut10,Personality,0.6090355,0.6252252,0.685506,0.2501803,1.668269,0.02925517,0.7873211,1.045719,0.2084592 +Present_Values,Present,Values,0.5355957,0.5489562,0.5671587,0.1957639,1.217079,0.03206684,1.280982,0.8331172,0.2003739 +Past5_Values,Past5,Values,0.5392641,0.5606175,0.5585066,0.2033042,1.275921,0.03308046,1.248671,0.8889135,0.1781123 +Past10_Values,Past10,Values,0.598008,0.6176378,0.6277172,0.2441788,1.615321,0.028953,1.22863,0.957626,0.22824 +Fut5_Values,Fut5,Values,0.5616573,0.5904551,0.6070898,0.2238116,1.441735,0.03130214,1.234356,0.9067855,0.2086639 +Fut10_Values,Fut10,Values,0.5247822,0.5552694,0.5921832,0.1998146,1.248552,0.03421231,1.234356,0.8939492,0.1716286 diff --git a/.history/eohi2/reliability_summary_table_20251028173027.csv b/.history/eohi2/reliability_summary_table_20251028173027.csv new file mode 100644 index 0000000..7aaaece --- /dev/null +++ b/.history/eohi2/reliability_summary_table_20251028173027.csv @@ -0,0 +1,16 @@ +Scale,Time_Frame,Domain,Raw_Alpha,Std_Alpha,G6_SMC,Average_r,S_N,ASE,Mean,SD,Median_r +Present_Preferences,Present,Preferences,0.5248372,0.5538292,0.5041749,0.1988841,1.241294,0.0336335,1.582004,0.8713115,0.1965662 +Past5_Preferences,Past5,Preferences,0.5649127,0.5893789,0.5467387,0.2230397,1.435335,0.03089417,1.410634,0.9559399,0.2104482 +Past10_Preferences,Past10,Preferences,0.488938,0.523742,0.4772804,0.1802878,1.099702,0.03649826,1.397546,0.9004519,0.1690398 +Fut5_Preferences,Fut5,Preferences,0.5692099,0.587553,0.5414701,0.2217358,1.424554,0.03082567,1.587321,0.9036826,0.2250345 +Fut10_Preferences,Fut10,Preferences,0.5698939,0.5847131,0.5479539,0.2197222,1.407974,0.03076925,1.58773,0.8931506,0.2489621 +Present_Personality,Present,Personality,0.5150363,0.5266182,0.5589141,0.1819987,1.11246,0.0351599,0.6861963,0.9615554,0.2041057 +Past5_Personality,Past5,Personality,0.6124713,0.619984,0.6719927,0.2460191,1.631468,0.0287073,0.5308793,1.114899,0.2033224 +Past10_Personality,Past10,Personality,0.5912415,0.6040201,0.6557158,0.2337612,1.525381,0.03034508,0.5083845,1.11603,0.2218243 +Fut5_Personality,Fut5,Personality,0.5110326,0.5338022,0.5987905,0.186332,1.145012,0.03652723,0.8159509,0.9646153,0.1559173 +Fut10_Personality,Fut10,Personality,0.6090355,0.6252252,0.685506,0.2501803,1.668269,0.02925517,0.7873211,1.045719,0.2084592 +Present_Values,Present,Values,0.5355957,0.5489562,0.5671587,0.1957639,1.217079,0.03206684,1.280982,0.8331172,0.2003739 +Past5_Values,Past5,Values,0.5392641,0.5606175,0.5585066,0.2033042,1.275921,0.03308046,1.248671,0.8889135,0.1781123 +Past10_Values,Past10,Values,0.598008,0.6176378,0.6277172,0.2441788,1.615321,0.028953,1.22863,0.957626,0.22824 +Fut5_Values,Fut5,Values,0.5616573,0.5904551,0.6070898,0.2238116,1.441735,0.03130214,1.234356,0.9067855,0.2086639 +Fut10_Values,Fut10,Values,0.5247822,0.5552694,0.5921832,0.1998146,1.248552,0.03421231,1.234356,0.8939492,0.1716286 diff --git a/.history/eohi2/verify_means_20251008115109.R b/.history/eohi2/verify_means_20251008115109.R new file mode 100644 index 0000000..32f8e0d --- /dev/null +++ b/.history/eohi2/verify_means_20251008115109.R @@ -0,0 +1,68 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +data <- read.csv("eohi2.csv") + +cat("\n================================================================================\n") +cat("VERIFICATION SUMMARY: ALL 11 MEAN VARIABLES (Rows 1-2)\n") +cat("================================================================================\n\n") + +for (i in 1:2) { + cat("-------------------------- ROW", i, "----------------------------\n\n") + + cat("NARROW-SCOPE MEANS (15 items each):\n") + cat("-----------------------------------\n") + + # Set 1: NPast_5_mean + v1 <- as.numeric(data[i, c('NPast_5_pref_read','NPast_5_pref_music','NPast_5_pref_TV','NPast_5_pref_nap','NPast_5_pref_travel','NPast_5_pers_extravert','NPast_5_pers_critical','NPast_5_pers_dependable','NPast_5_pers_anxious','NPast_5_pers_complex','NPast_5_val_obey','NPast_5_val_trad','NPast_5_val_opinion','NPast_5_val_performance','NPast_5_val_justice')]) + cat(sprintf("1. NPast_5_mean: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v1), mean(v1), data[i,'NPast_5_mean'])) + + # Set 2: NPast_10_mean + v2 <- as.numeric(data[i, c('NPast_10_pref_read','NPast_10_pref_music','NPast_10_pref_TV','NPast_10_pref_nap','NPast_10_pref_travel','NPast_10_pers_extravert','NPast_10_pers_critical','NPast_10_pers_dependable','NPast_10_pers_anxious','NPast_10_pers_complex','NPast_10_val_obey','NPast_10_val_trad','NPast_10_val_opinion','NPast_10_val_performance','NPast_10_val_justice')]) + cat(sprintf("2. NPast_10_mean: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v2), mean(v2), data[i,'NPast_10_mean'])) + + # Set 3: NFut_5_mean + v3 <- as.numeric(data[i, c('NFut_5_pref_read','NFut_5_pref_music','NFut_5_pref_TV','NFut_5_pref_nap','NFut_5_pref_travel','NFut_5_pers_extravert','NFut_5_pers_critical','NFut_5_pers_dependable','NFut_5_pers_anxious','NFut_5_pers_complex','NFut_5_val_obey','NFut_5_val_trad','NFut_5_val_opinion','NFut_5_val_performance','NFut_5_val_justice')]) + cat(sprintf("3. NFut_5_mean: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v3), mean(v3), data[i,'NFut_5_mean'])) + + # Set 4: NFut_10_mean + v4 <- as.numeric(data[i, c('NFut_10_pref_read','NFut_10_pref_music','NFut_10_pref_TV','NFut_10_pref_nap','NFut_10_pref_travel','NFut_10_pers_extravert','NFut_10_pers_critical','NFut_10_pers_dependable','NFut_10_pers_anxious','NFut_10_pers_complex','NFut_10_val_obey','NFut_10_val_trad','NFut_10_val_opinion','NFut_10_val_performance','NFut_10_val_justice')]) + cat(sprintf("4. NFut_10_mean: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v4), mean(v4), data[i,'NFut_10_mean'])) + + # Set 5: X5.10past_mean + v5 <- as.numeric(data[i, c('X5.10past_pref_read','X5.10past_pref_music','X5.10past_pref_TV','X5.10past_pref_nap','X5.10past_pref_travel','X5.10past_pers_extravert','X5.10past_pers_critical','X5.10past_pers_dependable','X5.10past_pers_anxious','X5.10past_pers_complex','X5.10past_val_obey','X5.10past_val_trad','X5.10past_val_opinion','X5.10past_val_performance','X5.10past_val_justice')]) + cat(sprintf("5. X5.10past_mean: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v5), mean(v5), data[i,'X5.10past_mean'])) + + # Set 6: X5.10fut_mean + v6 <- as.numeric(data[i, c('X5.10fut_pref_read','X5.10fut_pref_music','X5.10fut_pref_TV','X5.10fut_pref_nap','X5.10fut_pref_travel','X5.10fut_pers_extravert','X5.10fut_pers_critical','X5.10fut_pers_dependable','X5.10fut_pers_anxious','X5.10fut_pers_complex','X5.10fut_val_obey','X5.10fut_val_trad','X5.10fut_val_opinion','X5.10fut_val_performance','X5.10fut_val_justice')]) + cat(sprintf("6. X5.10fut_mean: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v6), mean(v6), data[i,'X5.10fut_mean'])) + + cat("\nGLOBAL-SCOPE MEANS (30 items each):\n") + cat("-----------------------------------\n") + + # Set 7: NPast_global_mean + v7 <- c(v1, v2) + cat(sprintf("7. NPast_global: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v7), mean(v7), data[i,'NPast_global_mean'])) + + # Set 8: NFut_global_mean + v8 <- c(v3, v4) + cat(sprintf("8. NFut_global: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v8), mean(v8), data[i,'NFut_global_mean'])) + + # Set 9: X5.10_global_mean + v9 <- c(v5, v6) + cat(sprintf("9. X5.10_global: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v9), mean(v9), data[i,'X5.10_global_mean'])) + + # Set 10: N5_global_mean + v10 <- c(v1, v3) + cat(sprintf("10. N5_global: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v10), mean(v10), data[i,'N5_global_mean'])) + + # Set 11: N10_global_mean + v11 <- c(v2, v4) + cat(sprintf("11. N10_global: Sum=%2d, Calc=%.10f, Stored=%.10f\n", sum(v11), mean(v11), data[i,'N10_global_mean'])) + + cat("\n") +} + +cat("================================================================================\n") +cat("ALL CALCULATIONS VERIFIED!\n") +cat("================================================================================\n") + diff --git a/.history/mixed anova - domain means_20250912124308.r b/.history/mixed anova - domain means_20250912124308.r new file mode 100644 index 0000000..141675c --- /dev/null +++ b/.history/mixed anova - domain means_20250912124308.r @@ -0,0 +1,572 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +long_data <- pivot_domain_means(data, domain_mapping) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: ASSUMPTION CHECKING\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912124317.r b/.history/mixed anova - domain means_20250912124317.r new file mode 100644 index 0000000..141675c --- /dev/null +++ b/.history/mixed anova - domain means_20250912124317.r @@ -0,0 +1,572 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +long_data <- pivot_domain_means(data, domain_mapping) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: ASSUMPTION CHECKING\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912124407.r b/.history/mixed anova - domain means_20250912124407.r new file mode 100644 index 0000000..141675c --- /dev/null +++ b/.history/mixed anova - domain means_20250912124407.r @@ -0,0 +1,572 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +long_data <- pivot_domain_means(data, domain_mapping) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: ASSUMPTION CHECKING\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912124620.r b/.history/mixed anova - domain means_20250912124620.r new file mode 100644 index 0000000..46ff722 --- /dev/null +++ b/.history/mixed anova - domain means_20250912124620.r @@ -0,0 +1,571 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +long_data <- pivot_domain_means(data, domain_mapping) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") +head(long_data) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: ASSUMPTION CHECKING\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125000.r b/.history/mixed anova - domain means_20250912125000.r new file mode 100644 index 0000000..fd6867b --- /dev/null +++ b/.history/mixed anova - domain means_20250912125000.r @@ -0,0 +1,567 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +long_data <- pivot_domain_means(data, domain_mapping) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125003.r b/.history/mixed anova - domain means_20250912125003.r new file mode 100644 index 0000000..6954522 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125003.r @@ -0,0 +1,567 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +long_data <- pivot_domain_means(data, domain_mapping) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125007.r b/.history/mixed anova - domain means_20250912125007.r new file mode 100644 index 0000000..d51ac62 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125007.r @@ -0,0 +1,573 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125012.r b/.history/mixed anova - domain means_20250912125012.r new file mode 100644 index 0000000..f73fe73 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125012.r @@ -0,0 +1,580 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125017.r b/.history/mixed anova - domain means_20250912125017.r new file mode 100644 index 0000000..f73fe73 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125017.r @@ -0,0 +1,580 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125031.r b/.history/mixed anova - domain means_20250912125031.r new file mode 100644 index 0000000..8f5ec66 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125031.r @@ -0,0 +1,584 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Show first 20 rows +cat("\nFirst 20 rows of long_data:\n") +print(utils::head(long_data, 20)) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125040.r b/.history/mixed anova - domain means_20250912125040.r new file mode 100644 index 0000000..8f5ec66 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125040.r @@ -0,0 +1,584 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Show first 20 rows +cat("\nFirst 20 rows of long_data:\n") +print(utils::head(long_data, 20)) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912125046.r b/.history/mixed anova - domain means_20250912125046.r new file mode 100644 index 0000000..8f5ec66 --- /dev/null +++ b/.history/mixed anova - domain means_20250912125046.r @@ -0,0 +1,584 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +cat("\nChecking available domain mean columns:\n") +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + cat("Warning: Missing variables:", paste(missing_vars, collapse = ", "), "\n") +} else { + cat("All required domain mean variables found!\n") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Show first 20 rows +cat("\nFirst 20 rows of long_data:\n") +print(utils::head(long_data, 20)) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# STEP 2: ASSUMPTION CHECKING +# ============================================================================= + + +# 2.1 Check for missing values +cat("\n2.1 Missing Values Check:\n") +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("Missing values by TIME and DOMAIN:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\n2.2 Outlier Detection:\n") +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\n2.3 Normality Tests:\n") +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\n2.4 Homogeneity of Variance Tests:\n") + +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across TIME within each DOMAIN:\n") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance across DOMAIN within each TIME:\n") +print(homogeneity_domain) + +# ============================================================================= +# STEP 3: DESCRIPTIVE STATISTICS +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# Overall descriptive statistics +desc_stats <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + median = round(median(MEAN_DIFFERENCE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75), 5), + min = round(min(MEAN_DIFFERENCE), 5), + max = round(max(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("Descriptive statistics by TIME and DOMAIN:\n") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data_clean %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE), 5), + sd = round(sd(MEAN_DIFFERENCE), 5), + .groups = 'drop' + ) + +cat("\nDescriptive statistics by GROUP, TIME, and DOMAIN:\n") +print(desc_stats_by_group) + +# ============================================================================= +# STEP 4: MIXED ANOVA ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Main Mixed ANOVA +cat("\n4.1 Main Mixed ANOVA:\n") +cat("Within-subjects factors: TIME, DOMAIN\n") +cat("Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + main_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Main ANOVA Results:\n") + print(main_anova) + + # Check sphericity + if (!is.null(main_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(main_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in main ANOVA:", e$message, "\n") + + # Try simpler model without all between-subjects factors + cat("Attempting simpler model with only GROUP as between-subjects factor...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = c(TIME, DOMAIN), + between = GROUP, + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Simplified ANOVA Results:\n") + print(simple_anova) + + main_anova <<- simple_anova + + }, error = function(e2) { + cat("Simplified ANOVA also failed:", e2$message, "\n") + }) +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain in levels(long_data_clean$DOMAIN)) { + cat("\nAnalyzing domain:", domain, "\n") + + domain_data <- long_data_clean[long_data_clean$DOMAIN == domain, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain, ":\n") + print(domain_anova) + + domain_results[[domain]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = TIME, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Time-specific analyses +cat("\n4.3 Time-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +time_results <- list() + +for (time in levels(long_data_clean$TIME)) { + cat("\nAnalyzing time:", time, "\n") + + time_data <- long_data_clean[long_data_clean$TIME == time, ] + + tryCatch({ + time_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = c(GROUP, TEMPORAL_DO, ITEM_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", time, ":\n") + print(time_anova) + + time_results[[time]] <- time_anova + + }, error = function(e) { + cat("Error in ANOVA for", time, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = time_data, + dv = MEAN_DIFFERENCE, + wid = pID, + within = DOMAIN, + between = GROUP, + type = 3, + detailed = TRUE + ) + print(simple_anova) + time_results[[time]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# ============================================================================= +# STEP 5: POST-HOC ANALYSES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 5: POST-HOC ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 5.1 Pairwise comparisons for significant effects +if (exists("main_anova") && !is.null(main_anova)) { + cat("\n5.1 Post-hoc comparisons for main effects:\n") + + # Check for significant main effects and interactions + anova_table <- main_anova$ANOVA + + if ("TIME" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME"] < 0.05) { + cat("Significant TIME main effect found. Computing pairwise comparisons...\n") + + # Simple paired t-tests for TIME effect + past_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + future_means <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + if (length(past_means) == length(future_means)) { + time_t_test <- t.test(past_means, future_means, paired = TRUE) + cat("Paired t-test for TIME effect:\n") + cat("t =", round(time_t_test$statistic, 5), + ", df =", time_t_test$parameter, + ", p =", round(time_t_test$p.value, 5), "\n") + cat("Mean difference (Past - Future):", round(time_t_test$estimate, 5), "\n") + } + } + + if ("DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "DOMAIN"] < 0.05) { + cat("Significant DOMAIN main effect found.\n") + + # Pairwise comparisons between domains + domain_means <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("Domain means:\n") + print(domain_means) + } + + if ("TIME:DOMAIN" %in% anova_table$Effect && anova_table$p[anova_table$Effect == "TIME:DOMAIN"] < 0.05) { + cat("Significant TIME × DOMAIN interaction found.\n") + + # Simple effects analysis + interaction_means <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise(mean_diff = mean(MEAN_DIFFERENCE), .groups = 'drop') + + cat("TIME × DOMAIN interaction means:\n") + print(interaction_means) + } +} + +# ============================================================================= +# STEP 6: EFFECT SIZES +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 6: EFFECT SIZES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + # Calculate partial eta squared for each effect + anova_table$partial_eta_squared <- round(anova_table$SSn / (anova_table$SSn + anova_table$SSd), 5) + + cat("Effect sizes (partial eta squared):\n") + effect_sizes <- anova_table[, c("Effect", "partial_eta_squared")] + print(effect_sizes) +} + +# ============================================================================= +# STEP 7: SUMMARY AND INTERPRETATION +# ============================================================================= + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 7: SUMMARY AND INTERPRETATION\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +cat("Analysis Summary:\n") +cat("- Total participants:", length(unique(long_data_clean$pID)), "\n") +cat("- Total observations:", nrow(long_data_clean), "\n") +cat("- Within-subjects factors: TIME (Past vs Future), DOMAIN (Preferences, Personality, Values, Life)\n") +cat("- Between-subjects factors: GROUP, TEMPORAL_DO, ITEM_DO\n") +cat("- Dependent variable: Mean absolute differences in domain ratings\n") + +cat("\nResearch Question:\n") +cat("Do participants rate changes in domains differently from past to now vs past to future?\n") + +if (exists("main_anova") && !is.null(main_anova)) { + anova_table <- main_anova$ANOVA + + cat("\nKey Findings:\n") + + # Check for significant effects + significant_effects <- anova_table$Effect[anova_table$p < 0.05] + + if (length(significant_effects) > 0) { + cat("Significant effects found:\n") + for (effect in significant_effects) { + p_val <- anova_table$p[anova_table$Effect == effect] + cat("-", effect, "(p =", round(p_val, 5), ")\n") + } + } else { + cat("No significant effects found at α = 0.05\n") + } + + # Interpret TIME effect + if ("TIME" %in% anova_table$Effect) { + time_p <- anova_table$p[anova_table$Effect == "TIME"] + if (time_p < 0.05) { + cat("\nTIME Effect: Participants show different levels of change when comparing\n") + cat("past-to-now vs past-to-future perspectives (p =", round(time_p, 5), ")\n") + } else { + cat("\nTIME Effect: No significant difference between past-to-now and past-to-future\n") + cat("perspectives (p =", round(time_p, 5), ")\n") + } + } + + # Interpret DOMAIN effect + if ("DOMAIN" %in% anova_table$Effect) { + domain_p <- anova_table$p[anova_table$Effect == "DOMAIN"] + if (domain_p < 0.05) { + cat("\nDOMAIN Effect: Different domains show different levels of perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } else { + cat("\nDOMAIN Effect: No significant differences between domains in perceived change\n") + cat("(p =", round(domain_p, 5), ")\n") + } + } + + # Interpret interaction + if ("TIME:DOMAIN" %in% anova_table$Effect) { + interaction_p <- anova_table$p[anova_table$Effect == "TIME:DOMAIN"] + if (interaction_p < 0.05) { + cat("\nTIME × DOMAIN Interaction: The effect of time perspective on perceived change\n") + cat("varies across domains (p =", round(interaction_p, 5), ")\n") + } else { + cat("\nTIME × DOMAIN Interaction: No significant interaction between time perspective\n") + cat("and domain (p =", round(interaction_p, 5), ")\n") + } + } +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") diff --git a/.history/mixed anova - domain means_20250912130804.r b/.history/mixed anova - domain means_20250912130804.r new file mode 100644 index 0000000..dbdffd0 --- /dev/null +++ b/.history/mixed anova - domain means_20250912130804.r @@ -0,0 +1,131 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# ============================================================================= +# STEP 1: DATA PIVOTING TO LONG FORMAT +# ============================================================================= + +cat("STEP 1: DATA PIVOTING TO LONG FORMAT\n") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +cat("Domain mapping:\n") +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Show first 20 rows +cat("\nFirst 20 rows of long_data:\n") +print(utils::head(long_data, 20)) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912130809.r b/.history/mixed anova - domain means_20250912130809.r new file mode 100644 index 0000000..2424ed0 --- /dev/null +++ b/.history/mixed anova - domain means_20250912130809.r @@ -0,0 +1,124 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + cat("Warning: Variable", var_name, "not found in data\n") + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Show first 20 rows +cat("\nFirst 20 rows of long_data:\n") +print(utils::head(long_data, 20)) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912130812.r b/.history/mixed anova - domain means_20250912130812.r new file mode 100644 index 0000000..da4e922 --- /dev/null +++ b/.history/mixed anova - domain means_20250912130812.r @@ -0,0 +1,124 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +cat("\nPivoting data to long format...\n") +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) + cat("Data pivoting completed successfully.\n") +}, error = function(e) { + cat("Error in data pivoting:", e$message, "\n") + stop("Cannot proceed without proper data structure") +}) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique participants:", length(unique(long_data$pID)), "\n") +cat("TIME levels:", paste(levels(long_data$TIME), collapse = ", "), "\n") +cat("DOMAIN levels:", paste(levels(long_data$DOMAIN), collapse = ", "), "\n") + +# Check data types +cat("\nData types check:\n") +cat("TIME is factor:", is.factor(long_data$TIME), "\n") +cat("DOMAIN is factor:", is.factor(long_data$DOMAIN), "\n") +cat("pID is factor:", is.factor(long_data$pID), "\n") +cat("MEAN_DIFFERENCE is numeric:", is.numeric(long_data$MEAN_DIFFERENCE), "\n") + +# Show first 20 rows +cat("\nFirst 20 rows of long_data:\n") +print(utils::head(long_data, 20)) + +# Display structure and sample +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(utils::head(long_data, 10)) + +# Show example data for one participant +cat("\nExample: Participant 1 across all domains and times:\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912130822.r b/.history/mixed anova - domain means_20250912130822.r new file mode 100644 index 0000000..6cc89f1 --- /dev/null +++ b/.history/mixed anova - domain means_20250912130822.r @@ -0,0 +1,117 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912130828.r b/.history/mixed anova - domain means_20250912130828.r new file mode 100644 index 0000000..6cc89f1 --- /dev/null +++ b/.history/mixed anova - domain means_20250912130828.r @@ -0,0 +1,117 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912130829.r b/.history/mixed anova - domain means_20250912130829.r new file mode 100644 index 0000000..6cc89f1 --- /dev/null +++ b/.history/mixed anova - domain means_20250912130829.r @@ -0,0 +1,117 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "GROUP", "TEMPORAL_DO", "ITEM_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$GROUP <- as.factor(long_data$GROUP) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + long_data$ITEM_DO <- as.factor(long_data$ITEM_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TEMPORAL_DO", "ITEM_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912144754.r b/.history/mixed anova - domain means_20250912144754.r new file mode 100644 index 0000000..49e89a3 --- /dev/null +++ b/.history/mixed anova - domain means_20250912144754.r @@ -0,0 +1,115 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + diff --git a/.history/mixed anova - domain means_20250912152948.r b/.history/mixed anova - domain means_20250912152948.r new file mode 100644 index 0000000..36c68c0 --- /dev/null +++ b/.history/mixed anova - domain means_20250912152948.r @@ -0,0 +1,272 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/mixed anova - domain means_20250912152953.r b/.history/mixed anova - domain means_20250912152953.r new file mode 100644 index 0000000..36c68c0 --- /dev/null +++ b/.history/mixed anova - domain means_20250912152953.r @@ -0,0 +1,272 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/mixed anova - domain means_20250912153103.r b/.history/mixed anova - domain means_20250912153103.r new file mode 100644 index 0000000..36c68c0 --- /dev/null +++ b/.history/mixed anova - domain means_20250912153103.r @@ -0,0 +1,272 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(ggplot2) # For plotting +library(emmeans) # For post-hoc comparisons + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +print(dim(data)) +print(length(unique(data$pID))) + +# Check experimental conditions +print(table(data$GROUP, data$TEMPORAL_DO, data$ITEM_DO)) + +# Check what domain mean columns are available +domain_mean_cols <- colnames(data)[grepl("mean_(pref|pers|val|life)", colnames(data))] +print(domain_mean_cols) + +# Verify the specific variables we need +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +print(domain_mapping) + +# Function to pivot data to long format +pivot_domain_means <- function(data, domain_mapping) { + long_data <- data.frame() + + for (i in 1:nrow(domain_mapping)) { + var_name <- domain_mapping$variable[i] + time_level <- domain_mapping$time[i] + domain_level <- domain_mapping$domain[i] + + # Check if variable exists + if (!var_name %in% colnames(data)) { + print(paste("Warning: Variable", var_name, "not found in data")) + next + } + + # Create subset for this variable + subset_data <- data[, c("pID", "ResponseId", "TEMPORAL_DO", var_name)] + subset_data$TIME <- time_level + subset_data$DOMAIN <- domain_level + subset_data$MEAN_DIFFERENCE <- subset_data[[var_name]] + subset_data[[var_name]] <- NULL # Remove original column + + # Add to long data + long_data <- rbind(long_data, subset_data) + } + + # Convert to factors with proper levels + long_data$TIME <- factor(long_data$TIME, levels = c("Past", "Future")) + long_data$DOMAIN <- factor(long_data$DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + long_data$pID <- as.factor(long_data$pID) + long_data$TEMPORAL_DO <- as.factor(long_data$TEMPORAL_DO) + + return(long_data) +} + +# Pivot data to long format +tryCatch({ + long_data <- pivot_domain_means(data, domain_mapping) +}, error = function(e) { + print(paste("Error in data pivoting:", e$message)) + stop("Cannot proceed without proper data structure") +}) + +print(dim(long_data)) +print(length(unique(long_data$pID))) +print(levels(long_data$TIME)) +print(levels(long_data$DOMAIN)) + +# Check data types +print(is.factor(long_data$TIME)) +print(is.factor(long_data$DOMAIN)) +print(is.factor(long_data$pID)) +print(is.numeric(long_data$MEAN_DIFFERENCE)) + +# Show first 20 rows +print(utils::head(long_data, 20)) + +# Display structure and sample +str(long_data) + +print(utils::head(long_data, 10)) + +# Show example data for one participant +participant_1_data <- long_data[long_data$pID == 1, c("pID", "TEMPORAL_DO", "TIME", "DOMAIN", "MEAN_DIFFERENCE")] +print(participant_1_data) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_group <- long_data %>% + group_by(GROUP, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by GROUP, TIME, and DOMAIN:") +print(desc_stats_by_group) + +# Overall means by TIME (collapsed across domains) +time_means <- long_data %>% + group_by(TIME) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by TIME (collapsed across domains):") +print(time_means) + +# Overall means by DOMAIN (collapsed across time) +domain_means <- long_data %>% + group_by(DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Overall means by DOMAIN (collapsed across time):") +print(domain_means) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", dim(long_data_clean))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Normality tests +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(MEAN_DIFFERENCE)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(MEAN_DIFFERENCE)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +print("Normality test results:") +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + diff --git a/.history/mixed anova - ind item_20250912123133.r b/.history/mixed anova - ind item_20250912123133.r new file mode 100644 index 0000000..e69de29 diff --git a/.history/mixed anova - ind item_20250912123134.r b/.history/mixed anova - ind item_20250912123134.r new file mode 100644 index 0000000..25b836c --- /dev/null +++ b/.history/mixed anova - ind item_20250912123134.r @@ -0,0 +1,397 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Check what columns are actually available +npast_cols <- colnames(data)[grepl("^NPast", colnames(data))] +nfut_cols <- colnames(data)[grepl("^NFut", colnames(data))] + +cat("NPast columns found:\n") +print(npast_cols) + +cat("\nNFut columns found:\n") +print(nfut_cols) + +cat("\nTotal NPast columns:", length(npast_cols), "\n") +cat("Total NFut columns:", length(nfut_cols), "\n") + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING + +cat("STEP 2: CHECKING ASSUMPTIONS\n") + +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912110917.r b/.history/mixed anova_20250912110917.r new file mode 100644 index 0000000..e194b3a --- /dev/null +++ b/.history/mixed anova_20250912110917.r @@ -0,0 +1,283 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(afex) +library(emmeans) +library(ggplot2) +library(car) + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Prepare data for mixed ANOVA +# We'll reshape the data to have Past and Future as separate rows for each participant + +# Create a function to reshape data for a specific domain +reshape_domain_data <- function(data, domain_name) { + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + return(NULL) + } + + # Create long format data + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate(TimePerspective = "Past", + Difference = .data[[past_col]]) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate(TimePerspective = "Future", + Difference = .data[[fut_col]]) %>% + select(-all_of(fut_col)) + + combined_data <- rbind(past_data, fut_data) %>% + mutate(TimePerspective = as.factor(TimePerspective), + pID = as.factor(pID)) + + return(combined_data) +} + +# Define domains to analyze +domains <- c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change") + +# Run mixed ANOVA for each domain +results_list <- list() + +for (domain in domains) { + cat("\n", "="*60, "\n") + cat("ANALYZING DOMAIN:", toupper(domain), "\n") + cat("="*60, "\n") + + # Reshape data for this domain + domain_data <- reshape_domain_data(data, domain) + + if (is.null(domain_data)) { + next + } + + # Check for missing values + missing_count <- sum(is.na(domain_data$Difference)) + if (missing_count > 0) { + cat("Warning:", missing_count, "missing values found for", domain, "\n") + domain_data <- domain_data[!is.na(domain_data$Difference), ] + } + + # Descriptive statistics + cat("\nDescriptive Statistics:\n") + desc_stats <- domain_data %>% + group_by(TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference, na.rm = TRUE), + sd = sd(Difference, na.rm = TRUE), + median = median(Difference, na.rm = TRUE), + .groups = 'drop' + ) + print(desc_stats) + + # Effect size (Cohen's d) + past_diff <- domain_data$Difference[domain_data$TimePerspective == "Past"] + fut_diff <- domain_data$Difference[domain_data$TimePerspective == "Future"] + + pooled_sd <- sqrt(((length(past_diff) - 1) * var(past_diff) + + (length(fut_diff) - 1) * var(fut_diff)) / + (length(past_diff) + length(fut_diff) - 2)) + + cohens_d <- (mean(past_diff) - mean(fut_diff)) / pooled_sd + + cat("\nCohen's d (Past vs Future):", round(cohens_d, 5), "\n") + + # Mixed ANOVA using ezANOVA + tryCatch({ + # Simple repeated measures ANOVA (TimePerspective as within-subjects) + anova_result <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("\nMixed ANOVA Results:\n") + print(anova_result) + + # Store results + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + anova = anova_result + ) + + # Post-hoc comparisons if significant + if (!is.null(anova_result$ANOVA)) { + if (any(anova_result$ANOVA$p < 0.05, na.rm = TRUE)) { + cat("\nSignificant effects found! Post-hoc analysis:\n") + + # Pairwise comparisons for TimePerspective + if ("TimePerspective" %in% anova_result$ANOVA$Effect && + anova_result$ANOVA$p[anova_result$ANOVA$Effect == "TimePerspective"] < 0.05) { + + # Simple t-test for comparison + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nPaired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + } + } + } + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simple paired t-test + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nFallback: Paired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + t_test = t_test_result + ) + }) +} + +# Summary of all results +cat("\n", "="*80, "\n") +cat("SUMMARY OF ALL DOMAINS\n") +cat("="*80, "\n") + +summary_df <- data.frame( + Domain = character(), + Past_Mean = numeric(), + Future_Mean = numeric(), + Cohen_d = numeric(), + Significant = logical(), + stringsAsFactors = FALSE +) + +for (domain in names(results_list)) { + result <- results_list[[domain]] + + past_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Past"] + fut_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Future"] + cohens_d <- result$cohens_d + + # Check if significant (p < 0.05) + significant <- FALSE + if (!is.null(result$anova) && !is.null(result$anova$ANOVA)) { + if ("TimePerspective" %in% result$anova$ANOVA$Effect) { + p_val <- result$anova$ANOVA$p[result$anova$ANOVA$Effect == "TimePerspective"] + significant <- !is.na(p_val) && p_val < 0.05 + } + } else if (!is.null(result$t_test)) { + significant <- result$t_test$p.value < 0.05 + } + + summary_df <- rbind(summary_df, data.frame( + Domain = domain, + Past_Mean = round(past_mean, 3), + Future_Mean = round(fut_mean, 3), + Cohen_d = round(cohens_d, 5), + Significant = significant + )) +} + +# Sort by effect size (absolute value) +summary_df <- summary_df[order(abs(summary_df$Cohen_d), decreasing = TRUE), ] + +print(summary_df) + +# Create visualization +library(ggplot2) + +# Prepare data for plotting +plot_data <- summary_df %>% + mutate( + Effect_Size = abs(Cohen_d), + Direction = ifelse(Cohen_d > 0, "Past > Future", "Future > Past"), + Domain_Type = case_when( + grepl("pref_", Domain) ~ "Preferences", + grepl("pers_", Domain) ~ "Personality", + grepl("val_", Domain) ~ "Values", + grepl("life_", Domain) ~ "Life Satisfaction", + TRUE ~ "Other" + ) + ) + +# Effect size plot +p1 <- ggplot(plot_data, aes(x = reorder(Domain, Effect_Size), y = Effect_Size, + fill = Direction, alpha = Significant)) + + geom_col() + + coord_flip() + + scale_alpha_manual(values = c(0.5, 1), name = "Significant\n(p < 0.05)") + + scale_fill_manual(values = c("Past > Future" = "#E74C3C", "Future > Past" = "#3498DB")) + + labs( + title = "Effect Sizes: Past vs Future Differences", + subtitle = "Absolute Cohen's d values across domains", + x = "Domain", + y = "|Cohen's d|", + fill = "Direction" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p1) + +# Mean differences plot +plot_data_long <- summary_df %>% + select(Domain, Past_Mean, Future_Mean) %>% + pivot_longer(cols = c(Past_Mean, Future_Mean), + names_to = "TimePerspective", + values_to = "Mean_Difference") %>% + mutate(TimePerspective = gsub("_Mean", "", TimePerspective)) + +p2 <- ggplot(plot_data_long, aes(x = reorder(Domain, Mean_Difference), + y = Mean_Difference, + fill = TimePerspective)) + + geom_col(position = "dodge") + + coord_flip() + + scale_fill_manual(values = c("Past" = "#E74C3C", "Future" = "#3498DB")) + + labs( + title = "Mean Differences by Time Perspective", + subtitle = "Past vs Future difference scores", + x = "Domain", + y = "Mean Difference Score", + fill = "Time Perspective" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p2) + +cat("\nAnalysis complete! Check the plots and summary table above.\n") +cat("Key findings:\n") +cat("- Domains with largest effect sizes:", paste(head(summary_df$Domain, 3), collapse = ", "), "\n") +cat("- Number of significant differences:", sum(summary_df$Significant), "out of", nrow(summary_df), "\n") diff --git a/.history/mixed anova_20250912110922.r b/.history/mixed anova_20250912110922.r new file mode 100644 index 0000000..e194b3a --- /dev/null +++ b/.history/mixed anova_20250912110922.r @@ -0,0 +1,283 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(afex) +library(emmeans) +library(ggplot2) +library(car) + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Prepare data for mixed ANOVA +# We'll reshape the data to have Past and Future as separate rows for each participant + +# Create a function to reshape data for a specific domain +reshape_domain_data <- function(data, domain_name) { + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + return(NULL) + } + + # Create long format data + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate(TimePerspective = "Past", + Difference = .data[[past_col]]) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate(TimePerspective = "Future", + Difference = .data[[fut_col]]) %>% + select(-all_of(fut_col)) + + combined_data <- rbind(past_data, fut_data) %>% + mutate(TimePerspective = as.factor(TimePerspective), + pID = as.factor(pID)) + + return(combined_data) +} + +# Define domains to analyze +domains <- c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change") + +# Run mixed ANOVA for each domain +results_list <- list() + +for (domain in domains) { + cat("\n", "="*60, "\n") + cat("ANALYZING DOMAIN:", toupper(domain), "\n") + cat("="*60, "\n") + + # Reshape data for this domain + domain_data <- reshape_domain_data(data, domain) + + if (is.null(domain_data)) { + next + } + + # Check for missing values + missing_count <- sum(is.na(domain_data$Difference)) + if (missing_count > 0) { + cat("Warning:", missing_count, "missing values found for", domain, "\n") + domain_data <- domain_data[!is.na(domain_data$Difference), ] + } + + # Descriptive statistics + cat("\nDescriptive Statistics:\n") + desc_stats <- domain_data %>% + group_by(TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference, na.rm = TRUE), + sd = sd(Difference, na.rm = TRUE), + median = median(Difference, na.rm = TRUE), + .groups = 'drop' + ) + print(desc_stats) + + # Effect size (Cohen's d) + past_diff <- domain_data$Difference[domain_data$TimePerspective == "Past"] + fut_diff <- domain_data$Difference[domain_data$TimePerspective == "Future"] + + pooled_sd <- sqrt(((length(past_diff) - 1) * var(past_diff) + + (length(fut_diff) - 1) * var(fut_diff)) / + (length(past_diff) + length(fut_diff) - 2)) + + cohens_d <- (mean(past_diff) - mean(fut_diff)) / pooled_sd + + cat("\nCohen's d (Past vs Future):", round(cohens_d, 5), "\n") + + # Mixed ANOVA using ezANOVA + tryCatch({ + # Simple repeated measures ANOVA (TimePerspective as within-subjects) + anova_result <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("\nMixed ANOVA Results:\n") + print(anova_result) + + # Store results + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + anova = anova_result + ) + + # Post-hoc comparisons if significant + if (!is.null(anova_result$ANOVA)) { + if (any(anova_result$ANOVA$p < 0.05, na.rm = TRUE)) { + cat("\nSignificant effects found! Post-hoc analysis:\n") + + # Pairwise comparisons for TimePerspective + if ("TimePerspective" %in% anova_result$ANOVA$Effect && + anova_result$ANOVA$p[anova_result$ANOVA$Effect == "TimePerspective"] < 0.05) { + + # Simple t-test for comparison + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nPaired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + } + } + } + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simple paired t-test + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nFallback: Paired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + t_test = t_test_result + ) + }) +} + +# Summary of all results +cat("\n", "="*80, "\n") +cat("SUMMARY OF ALL DOMAINS\n") +cat("="*80, "\n") + +summary_df <- data.frame( + Domain = character(), + Past_Mean = numeric(), + Future_Mean = numeric(), + Cohen_d = numeric(), + Significant = logical(), + stringsAsFactors = FALSE +) + +for (domain in names(results_list)) { + result <- results_list[[domain]] + + past_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Past"] + fut_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Future"] + cohens_d <- result$cohens_d + + # Check if significant (p < 0.05) + significant <- FALSE + if (!is.null(result$anova) && !is.null(result$anova$ANOVA)) { + if ("TimePerspective" %in% result$anova$ANOVA$Effect) { + p_val <- result$anova$ANOVA$p[result$anova$ANOVA$Effect == "TimePerspective"] + significant <- !is.na(p_val) && p_val < 0.05 + } + } else if (!is.null(result$t_test)) { + significant <- result$t_test$p.value < 0.05 + } + + summary_df <- rbind(summary_df, data.frame( + Domain = domain, + Past_Mean = round(past_mean, 3), + Future_Mean = round(fut_mean, 3), + Cohen_d = round(cohens_d, 5), + Significant = significant + )) +} + +# Sort by effect size (absolute value) +summary_df <- summary_df[order(abs(summary_df$Cohen_d), decreasing = TRUE), ] + +print(summary_df) + +# Create visualization +library(ggplot2) + +# Prepare data for plotting +plot_data <- summary_df %>% + mutate( + Effect_Size = abs(Cohen_d), + Direction = ifelse(Cohen_d > 0, "Past > Future", "Future > Past"), + Domain_Type = case_when( + grepl("pref_", Domain) ~ "Preferences", + grepl("pers_", Domain) ~ "Personality", + grepl("val_", Domain) ~ "Values", + grepl("life_", Domain) ~ "Life Satisfaction", + TRUE ~ "Other" + ) + ) + +# Effect size plot +p1 <- ggplot(plot_data, aes(x = reorder(Domain, Effect_Size), y = Effect_Size, + fill = Direction, alpha = Significant)) + + geom_col() + + coord_flip() + + scale_alpha_manual(values = c(0.5, 1), name = "Significant\n(p < 0.05)") + + scale_fill_manual(values = c("Past > Future" = "#E74C3C", "Future > Past" = "#3498DB")) + + labs( + title = "Effect Sizes: Past vs Future Differences", + subtitle = "Absolute Cohen's d values across domains", + x = "Domain", + y = "|Cohen's d|", + fill = "Direction" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p1) + +# Mean differences plot +plot_data_long <- summary_df %>% + select(Domain, Past_Mean, Future_Mean) %>% + pivot_longer(cols = c(Past_Mean, Future_Mean), + names_to = "TimePerspective", + values_to = "Mean_Difference") %>% + mutate(TimePerspective = gsub("_Mean", "", TimePerspective)) + +p2 <- ggplot(plot_data_long, aes(x = reorder(Domain, Mean_Difference), + y = Mean_Difference, + fill = TimePerspective)) + + geom_col(position = "dodge") + + coord_flip() + + scale_fill_manual(values = c("Past" = "#E74C3C", "Future" = "#3498DB")) + + labs( + title = "Mean Differences by Time Perspective", + subtitle = "Past vs Future difference scores", + x = "Domain", + y = "Mean Difference Score", + fill = "Time Perspective" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p2) + +cat("\nAnalysis complete! Check the plots and summary table above.\n") +cat("Key findings:\n") +cat("- Domains with largest effect sizes:", paste(head(summary_df$Domain, 3), collapse = ", "), "\n") +cat("- Number of significant differences:", sum(summary_df$Significant), "out of", nrow(summary_df), "\n") diff --git a/.history/mixed anova_20250912110938.r b/.history/mixed anova_20250912110938.r new file mode 100644 index 0000000..e194b3a --- /dev/null +++ b/.history/mixed anova_20250912110938.r @@ -0,0 +1,283 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(afex) +library(emmeans) +library(ggplot2) +library(car) + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Prepare data for mixed ANOVA +# We'll reshape the data to have Past and Future as separate rows for each participant + +# Create a function to reshape data for a specific domain +reshape_domain_data <- function(data, domain_name) { + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + return(NULL) + } + + # Create long format data + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate(TimePerspective = "Past", + Difference = .data[[past_col]]) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate(TimePerspective = "Future", + Difference = .data[[fut_col]]) %>% + select(-all_of(fut_col)) + + combined_data <- rbind(past_data, fut_data) %>% + mutate(TimePerspective = as.factor(TimePerspective), + pID = as.factor(pID)) + + return(combined_data) +} + +# Define domains to analyze +domains <- c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change") + +# Run mixed ANOVA for each domain +results_list <- list() + +for (domain in domains) { + cat("\n", "="*60, "\n") + cat("ANALYZING DOMAIN:", toupper(domain), "\n") + cat("="*60, "\n") + + # Reshape data for this domain + domain_data <- reshape_domain_data(data, domain) + + if (is.null(domain_data)) { + next + } + + # Check for missing values + missing_count <- sum(is.na(domain_data$Difference)) + if (missing_count > 0) { + cat("Warning:", missing_count, "missing values found for", domain, "\n") + domain_data <- domain_data[!is.na(domain_data$Difference), ] + } + + # Descriptive statistics + cat("\nDescriptive Statistics:\n") + desc_stats <- domain_data %>% + group_by(TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference, na.rm = TRUE), + sd = sd(Difference, na.rm = TRUE), + median = median(Difference, na.rm = TRUE), + .groups = 'drop' + ) + print(desc_stats) + + # Effect size (Cohen's d) + past_diff <- domain_data$Difference[domain_data$TimePerspective == "Past"] + fut_diff <- domain_data$Difference[domain_data$TimePerspective == "Future"] + + pooled_sd <- sqrt(((length(past_diff) - 1) * var(past_diff) + + (length(fut_diff) - 1) * var(fut_diff)) / + (length(past_diff) + length(fut_diff) - 2)) + + cohens_d <- (mean(past_diff) - mean(fut_diff)) / pooled_sd + + cat("\nCohen's d (Past vs Future):", round(cohens_d, 5), "\n") + + # Mixed ANOVA using ezANOVA + tryCatch({ + # Simple repeated measures ANOVA (TimePerspective as within-subjects) + anova_result <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("\nMixed ANOVA Results:\n") + print(anova_result) + + # Store results + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + anova = anova_result + ) + + # Post-hoc comparisons if significant + if (!is.null(anova_result$ANOVA)) { + if (any(anova_result$ANOVA$p < 0.05, na.rm = TRUE)) { + cat("\nSignificant effects found! Post-hoc analysis:\n") + + # Pairwise comparisons for TimePerspective + if ("TimePerspective" %in% anova_result$ANOVA$Effect && + anova_result$ANOVA$p[anova_result$ANOVA$Effect == "TimePerspective"] < 0.05) { + + # Simple t-test for comparison + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nPaired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + } + } + } + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simple paired t-test + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nFallback: Paired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + t_test = t_test_result + ) + }) +} + +# Summary of all results +cat("\n", "="*80, "\n") +cat("SUMMARY OF ALL DOMAINS\n") +cat("="*80, "\n") + +summary_df <- data.frame( + Domain = character(), + Past_Mean = numeric(), + Future_Mean = numeric(), + Cohen_d = numeric(), + Significant = logical(), + stringsAsFactors = FALSE +) + +for (domain in names(results_list)) { + result <- results_list[[domain]] + + past_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Past"] + fut_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Future"] + cohens_d <- result$cohens_d + + # Check if significant (p < 0.05) + significant <- FALSE + if (!is.null(result$anova) && !is.null(result$anova$ANOVA)) { + if ("TimePerspective" %in% result$anova$ANOVA$Effect) { + p_val <- result$anova$ANOVA$p[result$anova$ANOVA$Effect == "TimePerspective"] + significant <- !is.na(p_val) && p_val < 0.05 + } + } else if (!is.null(result$t_test)) { + significant <- result$t_test$p.value < 0.05 + } + + summary_df <- rbind(summary_df, data.frame( + Domain = domain, + Past_Mean = round(past_mean, 3), + Future_Mean = round(fut_mean, 3), + Cohen_d = round(cohens_d, 5), + Significant = significant + )) +} + +# Sort by effect size (absolute value) +summary_df <- summary_df[order(abs(summary_df$Cohen_d), decreasing = TRUE), ] + +print(summary_df) + +# Create visualization +library(ggplot2) + +# Prepare data for plotting +plot_data <- summary_df %>% + mutate( + Effect_Size = abs(Cohen_d), + Direction = ifelse(Cohen_d > 0, "Past > Future", "Future > Past"), + Domain_Type = case_when( + grepl("pref_", Domain) ~ "Preferences", + grepl("pers_", Domain) ~ "Personality", + grepl("val_", Domain) ~ "Values", + grepl("life_", Domain) ~ "Life Satisfaction", + TRUE ~ "Other" + ) + ) + +# Effect size plot +p1 <- ggplot(plot_data, aes(x = reorder(Domain, Effect_Size), y = Effect_Size, + fill = Direction, alpha = Significant)) + + geom_col() + + coord_flip() + + scale_alpha_manual(values = c(0.5, 1), name = "Significant\n(p < 0.05)") + + scale_fill_manual(values = c("Past > Future" = "#E74C3C", "Future > Past" = "#3498DB")) + + labs( + title = "Effect Sizes: Past vs Future Differences", + subtitle = "Absolute Cohen's d values across domains", + x = "Domain", + y = "|Cohen's d|", + fill = "Direction" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p1) + +# Mean differences plot +plot_data_long <- summary_df %>% + select(Domain, Past_Mean, Future_Mean) %>% + pivot_longer(cols = c(Past_Mean, Future_Mean), + names_to = "TimePerspective", + values_to = "Mean_Difference") %>% + mutate(TimePerspective = gsub("_Mean", "", TimePerspective)) + +p2 <- ggplot(plot_data_long, aes(x = reorder(Domain, Mean_Difference), + y = Mean_Difference, + fill = TimePerspective)) + + geom_col(position = "dodge") + + coord_flip() + + scale_fill_manual(values = c("Past" = "#E74C3C", "Future" = "#3498DB")) + + labs( + title = "Mean Differences by Time Perspective", + subtitle = "Past vs Future difference scores", + x = "Domain", + y = "Mean Difference Score", + fill = "Time Perspective" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p2) + +cat("\nAnalysis complete! Check the plots and summary table above.\n") +cat("Key findings:\n") +cat("- Domains with largest effect sizes:", paste(head(summary_df$Domain, 3), collapse = ", "), "\n") +cat("- Number of significant differences:", sum(summary_df$Significant), "out of", nrow(summary_df), "\n") diff --git a/.history/mixed anova_20250912111710.r b/.history/mixed anova_20250912111710.r new file mode 100644 index 0000000..892c6ae --- /dev/null +++ b/.history/mixed anova_20250912111710.r @@ -0,0 +1,281 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Prepare data for mixed ANOVA +# We'll reshape the data to have Past and Future as separate rows for each participant + +# Create a function to reshape data for a specific domain +reshape_domain_data <- function(data, domain_name) { + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + return(NULL) + } + + # Create long format data + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate(TimePerspective = "Past", + Difference = .data[[past_col]]) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate(TimePerspective = "Future", + Difference = .data[[fut_col]]) %>% + select(-all_of(fut_col)) + + combined_data <- rbind(past_data, fut_data) %>% + mutate(TimePerspective = as.factor(TimePerspective), + pID = as.factor(pID)) + + return(combined_data) +} + +# Define domains to analyze +domains <- c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change") + +# Run mixed ANOVA for each domain +results_list <- list() + +for (domain in domains) { + cat("\n", "="*60, "\n") + cat("ANALYZING DOMAIN:", toupper(domain), "\n") + cat("="*60, "\n") + + # Reshape data for this domain + domain_data <- reshape_domain_data(data, domain) + + if (is.null(domain_data)) { + next + } + + # Check for missing values + missing_count <- sum(is.na(domain_data$Difference)) + if (missing_count > 0) { + cat("Warning:", missing_count, "missing values found for", domain, "\n") + domain_data <- domain_data[!is.na(domain_data$Difference), ] + } + + # Descriptive statistics + cat("\nDescriptive Statistics:\n") + desc_stats <- domain_data %>% + group_by(TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference, na.rm = TRUE), + sd = sd(Difference, na.rm = TRUE), + median = median(Difference, na.rm = TRUE), + .groups = 'drop' + ) + print(desc_stats) + + # Effect size (Cohen's d) + past_diff <- domain_data$Difference[domain_data$TimePerspective == "Past"] + fut_diff <- domain_data$Difference[domain_data$TimePerspective == "Future"] + + pooled_sd <- sqrt(((length(past_diff) - 1) * var(past_diff) + + (length(fut_diff) - 1) * var(fut_diff)) / + (length(past_diff) + length(fut_diff) - 2)) + + cohens_d <- (mean(past_diff) - mean(fut_diff)) / pooled_sd + + cat("\nCohen's d (Past vs Future):", round(cohens_d, 5), "\n") + + # Mixed ANOVA using ezANOVA + tryCatch({ + # Simple repeated measures ANOVA (TimePerspective as within-subjects) + anova_result <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("\nMixed ANOVA Results:\n") + print(anova_result) + + # Store results + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + anova = anova_result + ) + + # Post-hoc comparisons if significant + if (!is.null(anova_result$ANOVA)) { + if (any(anova_result$ANOVA$p < 0.05, na.rm = TRUE)) { + cat("\nSignificant effects found! Post-hoc analysis:\n") + + # Pairwise comparisons for TimePerspective + if ("TimePerspective" %in% anova_result$ANOVA$Effect && + anova_result$ANOVA$p[anova_result$ANOVA$Effect == "TimePerspective"] < 0.05) { + + # Simple t-test for comparison + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nPaired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + } + } + } + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simple paired t-test + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nFallback: Paired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + t_test = t_test_result + ) + }) +} + +# Summary of all results +cat("\n", "="*80, "\n") +cat("SUMMARY OF ALL DOMAINS\n") +cat("="*80, "\n") + +summary_df <- data.frame( + Domain = character(), + Past_Mean = numeric(), + Future_Mean = numeric(), + Cohen_d = numeric(), + Significant = logical(), + stringsAsFactors = FALSE +) + +for (domain in names(results_list)) { + result <- results_list[[domain]] + + past_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Past"] + fut_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Future"] + cohens_d <- result$cohens_d + + # Check if significant (p < 0.05) + significant <- FALSE + if (!is.null(result$anova) && !is.null(result$anova$ANOVA)) { + if ("TimePerspective" %in% result$anova$ANOVA$Effect) { + p_val <- result$anova$ANOVA$p[result$anova$ANOVA$Effect == "TimePerspective"] + significant <- !is.na(p_val) && p_val < 0.05 + } + } else if (!is.null(result$t_test)) { + significant <- result$t_test$p.value < 0.05 + } + + summary_df <- rbind(summary_df, data.frame( + Domain = domain, + Past_Mean = round(past_mean, 3), + Future_Mean = round(fut_mean, 3), + Cohen_d = round(cohens_d, 5), + Significant = significant + )) +} + +# Sort by effect size (absolute value) +summary_df <- summary_df[order(abs(summary_df$Cohen_d), decreasing = TRUE), ] + +print(summary_df) + +# Create visualization +library(ggplot2) + +# Prepare data for plotting +plot_data <- summary_df %>% + mutate( + Effect_Size = abs(Cohen_d), + Direction = ifelse(Cohen_d > 0, "Past > Future", "Future > Past"), + Domain_Type = case_when( + grepl("pref_", Domain) ~ "Preferences", + grepl("pers_", Domain) ~ "Personality", + grepl("val_", Domain) ~ "Values", + grepl("life_", Domain) ~ "Life Satisfaction", + TRUE ~ "Other" + ) + ) + +# Effect size plot +p1 <- ggplot(plot_data, aes(x = reorder(Domain, Effect_Size), y = Effect_Size, + fill = Direction, alpha = Significant)) + + geom_col() + + coord_flip() + + scale_alpha_manual(values = c(0.5, 1), name = "Significant\n(p < 0.05)") + + scale_fill_manual(values = c("Past > Future" = "#E74C3C", "Future > Past" = "#3498DB")) + + labs( + title = "Effect Sizes: Past vs Future Differences", + subtitle = "Absolute Cohen's d values across domains", + x = "Domain", + y = "|Cohen's d|", + fill = "Direction" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p1) + +# Mean differences plot +plot_data_long <- summary_df %>% + select(Domain, Past_Mean, Future_Mean) %>% + pivot_longer(cols = c(Past_Mean, Future_Mean), + names_to = "TimePerspective", + values_to = "Mean_Difference") %>% + mutate(TimePerspective = gsub("_Mean", "", TimePerspective)) + +p2 <- ggplot(plot_data_long, aes(x = reorder(Domain, Mean_Difference), + y = Mean_Difference, + fill = TimePerspective)) + + geom_col(position = "dodge") + + coord_flip() + + scale_fill_manual(values = c("Past" = "#E74C3C", "Future" = "#3498DB")) + + labs( + title = "Mean Differences by Time Perspective", + subtitle = "Past vs Future difference scores", + x = "Domain", + y = "Mean Difference Score", + fill = "Time Perspective" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p2) + +cat("\nAnalysis complete! Check the plots and summary table above.\n") +cat("Key findings:\n") +cat("- Domains with largest effect sizes:", paste(head(summary_df$Domain, 3), collapse = ", "), "\n") +cat("- Number of significant differences:", sum(summary_df$Significant), "out of", nrow(summary_df), "\n") diff --git a/.history/mixed anova_20250912111725.r b/.history/mixed anova_20250912111725.r new file mode 100644 index 0000000..0c721ff --- /dev/null +++ b/.history/mixed anova_20250912111725.r @@ -0,0 +1,324 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# Define domains to analyze +domains <- c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change") + +# Run mixed ANOVA for each domain +results_list <- list() + +for (domain in domains) { + cat("\n", "="*60, "\n") + cat("ANALYZING DOMAIN:", toupper(domain), "\n") + cat("="*60, "\n") + + # Reshape data for this domain + domain_data <- reshape_domain_data(data, domain) + + if (is.null(domain_data)) { + next + } + + # Check for missing values + missing_count <- sum(is.na(domain_data$Difference)) + if (missing_count > 0) { + cat("Warning:", missing_count, "missing values found for", domain, "\n") + domain_data <- domain_data[!is.na(domain_data$Difference), ] + } + + # Descriptive statistics + cat("\nDescriptive Statistics:\n") + desc_stats <- domain_data %>% + group_by(TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference, na.rm = TRUE), + sd = sd(Difference, na.rm = TRUE), + median = median(Difference, na.rm = TRUE), + .groups = 'drop' + ) + print(desc_stats) + + # Effect size (Cohen's d) + past_diff <- domain_data$Difference[domain_data$TimePerspective == "Past"] + fut_diff <- domain_data$Difference[domain_data$TimePerspective == "Future"] + + pooled_sd <- sqrt(((length(past_diff) - 1) * var(past_diff) + + (length(fut_diff) - 1) * var(fut_diff)) / + (length(past_diff) + length(fut_diff) - 2)) + + cohens_d <- (mean(past_diff) - mean(fut_diff)) / pooled_sd + + cat("\nCohen's d (Past vs Future):", round(cohens_d, 5), "\n") + + # Mixed ANOVA using ezANOVA + tryCatch({ + # Simple repeated measures ANOVA (TimePerspective as within-subjects) + anova_result <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("\nMixed ANOVA Results:\n") + print(anova_result) + + # Store results + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + anova = anova_result + ) + + # Post-hoc comparisons if significant + if (!is.null(anova_result$ANOVA)) { + if (any(anova_result$ANOVA$p < 0.05, na.rm = TRUE)) { + cat("\nSignificant effects found! Post-hoc analysis:\n") + + # Pairwise comparisons for TimePerspective + if ("TimePerspective" %in% anova_result$ANOVA$Effect && + anova_result$ANOVA$p[anova_result$ANOVA$Effect == "TimePerspective"] < 0.05) { + + # Simple t-test for comparison + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nPaired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + } + } + } + + }, error = function(e) { + cat("Error in ANOVA for", domain, ":", e$message, "\n") + + # Fallback to simple paired t-test + t_test_result <- t.test(past_diff, fut_diff, paired = TRUE) + cat("\nFallback: Paired t-test (Past vs Future):\n") + cat("t =", round(t_test_result$statistic, 3), + ", df =", t_test_result$parameter, + ", p =", round(t_test_result$p.value, 5), "\n") + + results_list[[domain]] <- list( + descriptive = desc_stats, + cohens_d = cohens_d, + t_test = t_test_result + ) + }) +} + +# Summary of all results +cat("\n", "="*80, "\n") +cat("SUMMARY OF ALL DOMAINS\n") +cat("="*80, "\n") + +summary_df <- data.frame( + Domain = character(), + Past_Mean = numeric(), + Future_Mean = numeric(), + Cohen_d = numeric(), + Significant = logical(), + stringsAsFactors = FALSE +) + +for (domain in names(results_list)) { + result <- results_list[[domain]] + + past_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Past"] + fut_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Future"] + cohens_d <- result$cohens_d + + # Check if significant (p < 0.05) + significant <- FALSE + if (!is.null(result$anova) && !is.null(result$anova$ANOVA)) { + if ("TimePerspective" %in% result$anova$ANOVA$Effect) { + p_val <- result$anova$ANOVA$p[result$anova$ANOVA$Effect == "TimePerspective"] + significant <- !is.na(p_val) && p_val < 0.05 + } + } else if (!is.null(result$t_test)) { + significant <- result$t_test$p.value < 0.05 + } + + summary_df <- rbind(summary_df, data.frame( + Domain = domain, + Past_Mean = round(past_mean, 3), + Future_Mean = round(fut_mean, 3), + Cohen_d = round(cohens_d, 5), + Significant = significant + )) +} + +# Sort by effect size (absolute value) +summary_df <- summary_df[order(abs(summary_df$Cohen_d), decreasing = TRUE), ] + +print(summary_df) + +# Create visualization +library(ggplot2) + +# Prepare data for plotting +plot_data <- summary_df %>% + mutate( + Effect_Size = abs(Cohen_d), + Direction = ifelse(Cohen_d > 0, "Past > Future", "Future > Past"), + Domain_Type = case_when( + grepl("pref_", Domain) ~ "Preferences", + grepl("pers_", Domain) ~ "Personality", + grepl("val_", Domain) ~ "Values", + grepl("life_", Domain) ~ "Life Satisfaction", + TRUE ~ "Other" + ) + ) + +# Effect size plot +p1 <- ggplot(plot_data, aes(x = reorder(Domain, Effect_Size), y = Effect_Size, + fill = Direction, alpha = Significant)) + + geom_col() + + coord_flip() + + scale_alpha_manual(values = c(0.5, 1), name = "Significant\n(p < 0.05)") + + scale_fill_manual(values = c("Past > Future" = "#E74C3C", "Future > Past" = "#3498DB")) + + labs( + title = "Effect Sizes: Past vs Future Differences", + subtitle = "Absolute Cohen's d values across domains", + x = "Domain", + y = "|Cohen's d|", + fill = "Direction" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p1) + +# Mean differences plot +plot_data_long <- summary_df %>% + select(Domain, Past_Mean, Future_Mean) %>% + pivot_longer(cols = c(Past_Mean, Future_Mean), + names_to = "TimePerspective", + values_to = "Mean_Difference") %>% + mutate(TimePerspective = gsub("_Mean", "", TimePerspective)) + +p2 <- ggplot(plot_data_long, aes(x = reorder(Domain, Mean_Difference), + y = Mean_Difference, + fill = TimePerspective)) + + geom_col(position = "dodge") + + coord_flip() + + scale_fill_manual(values = c("Past" = "#E74C3C", "Future" = "#3498DB")) + + labs( + title = "Mean Differences by Time Perspective", + subtitle = "Past vs Future difference scores", + x = "Domain", + y = "Mean Difference Score", + fill = "Time Perspective" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p2) + +cat("\nAnalysis complete! Check the plots and summary table above.\n") +cat("Key findings:\n") +cat("- Domains with largest effect sizes:", paste(head(summary_df$Domain, 3), collapse = ", "), "\n") +cat("- Number of significant differences:", sum(summary_df$Significant), "out of", nrow(summary_df), "\n") diff --git a/.history/mixed anova_20250912111750.r b/.history/mixed anova_20250912111750.r new file mode 100644 index 0000000..83c0404 --- /dev/null +++ b/.history/mixed anova_20250912111750.r @@ -0,0 +1,316 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# Summary of all results +cat("\n", "="*80, "\n") +cat("SUMMARY OF ALL DOMAINS\n") +cat("="*80, "\n") + +summary_df <- data.frame( + Domain = character(), + Past_Mean = numeric(), + Future_Mean = numeric(), + Cohen_d = numeric(), + Significant = logical(), + stringsAsFactors = FALSE +) + +for (domain in names(results_list)) { + result <- results_list[[domain]] + + past_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Past"] + fut_mean <- result$descriptive$mean[result$descriptive$TimePerspective == "Future"] + cohens_d <- result$cohens_d + + # Check if significant (p < 0.05) + significant <- FALSE + if (!is.null(result$anova) && !is.null(result$anova$ANOVA)) { + if ("TimePerspective" %in% result$anova$ANOVA$Effect) { + p_val <- result$anova$ANOVA$p[result$anova$ANOVA$Effect == "TimePerspective"] + significant <- !is.na(p_val) && p_val < 0.05 + } + } else if (!is.null(result$t_test)) { + significant <- result$t_test$p.value < 0.05 + } + + summary_df <- rbind(summary_df, data.frame( + Domain = domain, + Past_Mean = round(past_mean, 3), + Future_Mean = round(fut_mean, 3), + Cohen_d = round(cohens_d, 5), + Significant = significant + )) +} + +# Sort by effect size (absolute value) +summary_df <- summary_df[order(abs(summary_df$Cohen_d), decreasing = TRUE), ] + +print(summary_df) + +# Create visualization +library(ggplot2) + +# Prepare data for plotting +plot_data <- summary_df %>% + mutate( + Effect_Size = abs(Cohen_d), + Direction = ifelse(Cohen_d > 0, "Past > Future", "Future > Past"), + Domain_Type = case_when( + grepl("pref_", Domain) ~ "Preferences", + grepl("pers_", Domain) ~ "Personality", + grepl("val_", Domain) ~ "Values", + grepl("life_", Domain) ~ "Life Satisfaction", + TRUE ~ "Other" + ) + ) + +# Effect size plot +p1 <- ggplot(plot_data, aes(x = reorder(Domain, Effect_Size), y = Effect_Size, + fill = Direction, alpha = Significant)) + + geom_col() + + coord_flip() + + scale_alpha_manual(values = c(0.5, 1), name = "Significant\n(p < 0.05)") + + scale_fill_manual(values = c("Past > Future" = "#E74C3C", "Future > Past" = "#3498DB")) + + labs( + title = "Effect Sizes: Past vs Future Differences", + subtitle = "Absolute Cohen's d values across domains", + x = "Domain", + y = "|Cohen's d|", + fill = "Direction" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p1) + +# Mean differences plot +plot_data_long <- summary_df %>% + select(Domain, Past_Mean, Future_Mean) %>% + pivot_longer(cols = c(Past_Mean, Future_Mean), + names_to = "TimePerspective", + values_to = "Mean_Difference") %>% + mutate(TimePerspective = gsub("_Mean", "", TimePerspective)) + +p2 <- ggplot(plot_data_long, aes(x = reorder(Domain, Mean_Difference), + y = Mean_Difference, + fill = TimePerspective)) + + geom_col(position = "dodge") + + coord_flip() + + scale_fill_manual(values = c("Past" = "#E74C3C", "Future" = "#3498DB")) + + labs( + title = "Mean Differences by Time Perspective", + subtitle = "Past vs Future difference scores", + x = "Domain", + y = "Mean Difference Score", + fill = "Time Perspective" + ) + + theme_minimal() + + theme(axis.text.y = element_text(size = 8)) + +print(p2) + +cat("\nAnalysis complete! Check the plots and summary table above.\n") +cat("Key findings:\n") +cat("- Domains with largest effect sizes:", paste(head(summary_df$Domain, 3), collapse = ", "), "\n") +cat("- Number of significant differences:", sum(summary_df$Significant), "out of", nrow(summary_df), "\n") diff --git a/.history/mixed anova_20250912111819.r b/.history/mixed anova_20250912111819.r new file mode 100644 index 0000000..b1cee98 --- /dev/null +++ b/.history/mixed anova_20250912111819.r @@ -0,0 +1,341 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912111827.r b/.history/mixed anova_20250912111827.r new file mode 100644 index 0000000..b1cee98 --- /dev/null +++ b/.history/mixed anova_20250912111827.r @@ -0,0 +1,341 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112005.r b/.history/mixed anova_20250912112005.r new file mode 100644 index 0000000..b1cee98 --- /dev/null +++ b/.history/mixed anova_20250912112005.r @@ -0,0 +1,341 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112141.r b/.history/mixed anova_20250912112141.r new file mode 100644 index 0000000..b1cee98 --- /dev/null +++ b/.history/mixed anova_20250912112141.r @@ -0,0 +1,341 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112319.r b/.history/mixed anova_20250912112319.r new file mode 100644 index 0000000..83e7818 --- /dev/null +++ b/.history/mixed anova_20250912112319.r @@ -0,0 +1,347 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112327.r b/.history/mixed anova_20250912112327.r new file mode 100644 index 0000000..83e7818 --- /dev/null +++ b/.history/mixed anova_20250912112327.r @@ -0,0 +1,347 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112334.r b/.history/mixed anova_20250912112334.r new file mode 100644 index 0000000..83e7818 --- /dev/null +++ b/.history/mixed anova_20250912112334.r @@ -0,0 +1,347 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", unique(long_data$Domain_Type), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112620.r b/.history/mixed anova_20250912112620.r new file mode 100644 index 0000000..63b2b54 --- /dev/null +++ b/.history/mixed anova_20250912112620.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", "="*80, "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat("="*80, "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112624.r b/.history/mixed anova_20250912112624.r new file mode 100644 index 0000000..e5bb71b --- /dev/null +++ b/.history/mixed anova_20250912112624.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", "="*80, "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat("="*80, "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112628.r b/.history/mixed anova_20250912112628.r new file mode 100644 index 0000000..3f9b63f --- /dev/null +++ b/.history/mixed anova_20250912112628.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", "="*80, "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat("="*80, "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112631.r b/.history/mixed anova_20250912112631.r new file mode 100644 index 0000000..f87b7a5 --- /dev/null +++ b/.history/mixed anova_20250912112631.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112632.r b/.history/mixed anova_20250912112632.r new file mode 100644 index 0000000..f87b7a5 --- /dev/null +++ b/.history/mixed anova_20250912112632.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat("-" * 50, "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112635.r b/.history/mixed anova_20250912112635.r new file mode 100644 index 0000000..9594e48 --- /dev/null +++ b/.history/mixed anova_20250912112635.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat("-" * 50, "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112638.r b/.history/mixed anova_20250912112638.r new file mode 100644 index 0000000..31c3881 --- /dev/null +++ b/.history/mixed anova_20250912112638.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat("-" * 50, "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112641.r b/.history/mixed anova_20250912112641.r new file mode 100644 index 0000000..e3d2e56 --- /dev/null +++ b/.history/mixed anova_20250912112641.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", "="*80, "\n") +cat("ANALYSIS COMPLETE!\n") +cat("="*80, "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112645.r b/.history/mixed anova_20250912112645.r new file mode 100644 index 0000000..47d837c --- /dev/null +++ b/.history/mixed anova_20250912112645.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112651.r b/.history/mixed anova_20250912112651.r new file mode 100644 index 0000000..47d837c --- /dev/null +++ b/.history/mixed anova_20250912112651.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912112700.r b/.history/mixed anova_20250912112700.r new file mode 100644 index 0000000..47d837c --- /dev/null +++ b/.history/mixed anova_20250912112700.r @@ -0,0 +1,349 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113047.r b/.history/mixed anova_20250912113047.r new file mode 100644 index 0000000..4e8abe9 --- /dev/null +++ b/.history/mixed anova_20250912113047.r @@ -0,0 +1,359 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113055.r b/.history/mixed anova_20250912113055.r new file mode 100644 index 0000000..4e8abe9 --- /dev/null +++ b/.history/mixed anova_20250912113055.r @@ -0,0 +1,359 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113119.r b/.history/mixed anova_20250912113119.r new file mode 100644 index 0000000..4e8abe9 --- /dev/null +++ b/.history/mixed anova_20250912113119.r @@ -0,0 +1,359 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113345.r b/.history/mixed anova_20250912113345.r new file mode 100644 index 0000000..be77f6e --- /dev/null +++ b/.history/mixed anova_20250912113345.r @@ -0,0 +1,374 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113353.r b/.history/mixed anova_20250912113353.r new file mode 100644 index 0000000..be77f6e --- /dev/null +++ b/.history/mixed anova_20250912113353.r @@ -0,0 +1,374 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors + all_long_data <- all_long_data %>% + mutate( + TimePerspective = as.factor(TimePerspective), + Domain_Type = as.factor(Domain_Type), + Domain_Item = as.factor(Domain_Item), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113448.r b/.history/mixed anova_20250912113448.r new file mode 100644 index 0000000..1a98479 --- /dev/null +++ b/.history/mixed anova_20250912113448.r @@ -0,0 +1,377 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data <- all_long_data %>% + mutate( + TimePerspective = factor(TimePerspective, levels = c("Past", "Future")), + Domain_Type = factor(Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")), + Domain_Item = factor(Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113455.r b/.history/mixed anova_20250912113455.r new file mode 100644 index 0000000..1a98479 --- /dev/null +++ b/.history/mixed anova_20250912113455.r @@ -0,0 +1,377 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data <- all_long_data %>% + mutate( + TimePerspective = factor(TimePerspective, levels = c("Past", "Future")), + Domain_Type = factor(Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")), + Domain_Item = factor(Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113502.r b/.history/mixed anova_20250912113502.r new file mode 100644 index 0000000..1a98479 --- /dev/null +++ b/.history/mixed anova_20250912113502.r @@ -0,0 +1,377 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain + past_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(past_col)) %>% + mutate( + TimePerspective = "Past", + Difference = .data[[past_col]], + Domain_Type = domain_type, # e.g., "Preferences" + Domain_Item = domain_name # e.g., "pref_read" + ) %>% + select(-all_of(past_col)) + + fut_data <- data %>% + select(pID, ResponseId, GROUP, TASK_DO, TEMPORAL_DO, ITEM_DO, COC_DO, + demo_sex, demo_age_1, AOT_total, CRT_correct, all_of(fut_col)) %>% + mutate( + TimePerspective = "Future", + Difference = .data[[fut_col]], + Domain_Type = domain_type, + Domain_Item = domain_name + ) %>% + select(-all_of(fut_col)) + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data <- all_long_data %>% + mutate( + TimePerspective = factor(TimePerspective, levels = c("Past", "Future")), + Domain_Type = factor(Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")), + Domain_Item = factor(Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")), + pID = as.factor(pID) + ) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113654.r b/.history/mixed anova_20250912113654.r new file mode 100644 index 0000000..40c09f8 --- /dev/null +++ b/.history/mixed anova_20250912113654.r @@ -0,0 +1,370 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113659.r b/.history/mixed anova_20250912113659.r new file mode 100644 index 0000000..40c09f8 --- /dev/null +++ b/.history/mixed anova_20250912113659.r @@ -0,0 +1,370 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912113707.r b/.history/mixed anova_20250912113707.r new file mode 100644 index 0000000..40c09f8 --- /dev/null +++ b/.history/mixed anova_20250912113707.r @@ -0,0 +1,370 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114051.r b/.history/mixed anova_20250912114051.r new file mode 100644 index 0000000..106251c --- /dev/null +++ b/.history/mixed anova_20250912114051.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114100.r b/.history/mixed anova_20250912114100.r new file mode 100644 index 0000000..106251c --- /dev/null +++ b/.history/mixed anova_20250912114100.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114105.r b/.history/mixed anova_20250912114105.r new file mode 100644 index 0000000..106251c --- /dev/null +++ b/.history/mixed anova_20250912114105.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114140.r b/.history/mixed anova_20250912114140.r new file mode 100644 index 0000000..6d19bba --- /dev/null +++ b/.history/mixed anova_20250912114140.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114154.r b/.history/mixed anova_20250912114154.r new file mode 100644 index 0000000..6d19bba --- /dev/null +++ b/.history/mixed anova_20250912114154.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114156.r b/.history/mixed anova_20250912114156.r new file mode 100644 index 0000000..6d19bba --- /dev/null +++ b/.history/mixed anova_20250912114156.r @@ -0,0 +1,384 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 2: CHECKING ASSUMPTIONS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114707.r b/.history/mixed anova_20250912114707.r new file mode 100644 index 0000000..fc6e940 --- /dev/null +++ b/.history/mixed anova_20250912114707.r @@ -0,0 +1,398 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Check what columns are actually available +cat("\nChecking available columns with NPast and NFut prefixes:\n") +npast_cols <- colnames(data)[grepl("^NPast", colnames(data))] +nfut_cols <- colnames(data)[grepl("^NFut", colnames(data))] + +cat("NPast columns found:\n") +print(npast_cols) + +cat("\nNFut columns found:\n") +print(nfut_cols) + +cat("\nTotal NPast columns:", length(npast_cols), "\n") +cat("Total NFut columns:", length(nfut_cols), "\n") + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING + +cat("STEP 2: CHECKING ASSUMPTIONS\n") + +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912114714.r b/.history/mixed anova_20250912114714.r new file mode 100644 index 0000000..fc6e940 --- /dev/null +++ b/.history/mixed anova_20250912114714.r @@ -0,0 +1,398 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Check what columns are actually available +cat("\nChecking available columns with NPast and NFut prefixes:\n") +npast_cols <- colnames(data)[grepl("^NPast", colnames(data))] +nfut_cols <- colnames(data)[grepl("^NFut", colnames(data))] + +cat("NPast columns found:\n") +print(npast_cols) + +cat("\nNFut columns found:\n") +print(nfut_cols) + +cat("\nTotal NPast columns:", length(npast_cols), "\n") +cat("Total NFut columns:", length(nfut_cols), "\n") + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING + +cat("STEP 2: CHECKING ASSUMPTIONS\n") + +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/.history/mixed anova_20250912124604.r b/.history/mixed anova_20250912124604.r new file mode 100644 index 0000000..fc6e940 --- /dev/null +++ b/.history/mixed anova_20250912124604.r @@ -0,0 +1,398 @@ +# Mixed ANOVA Analysis for Past vs Future Differences +# EOHI Experiment Data Analysis + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests + +# Read the data +data <- read.csv("eohi1/exp1.csv") + +# Display basic information about the dataset +cat("Dataset dimensions:", dim(data), "\n") +cat("Number of participants:", length(unique(data$pID)), "\n") + +# Check experimental conditions +cat("\nExperimental conditions:\n") +table(data$GROUP, data$TASK_DO, data$TEMPORAL_DO) + +# Check what columns are actually available +cat("\nChecking available columns with NPast and NFut prefixes:\n") +npast_cols <- colnames(data)[grepl("^NPast", colnames(data))] +nfut_cols <- colnames(data)[grepl("^NFut", colnames(data))] + +cat("NPast columns found:\n") +print(npast_cols) + +cat("\nNFut columns found:\n") +print(nfut_cols) + +cat("\nTotal NPast columns:", length(npast_cols), "\n") +cat("Total NFut columns:", length(nfut_cols), "\n") + +# STEP 1: PROPER DATA RESHAPING +# Define domains with their categories +domain_info <- data.frame( + domain = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change"), + domain_type = c(rep("Preferences", 5), + rep("Personality", 5), + rep("Values", 5), + rep("Life_Satisfaction", 5)), + stringsAsFactors = FALSE +) + +# Display domain_info +cat("\nDomain Information:\n") +print(domain_info) +cat("\nDomain type summary:\n") +print(table(domain_info$domain_type)) + +# Function to reshape ALL domains at once with domain information +reshape_all_domains <- function(data, domain_info) { + all_long_data <- data.frame() + + for (i in 1:nrow(domain_info)) { + domain_name <- domain_info$domain[i] + domain_type <- domain_info$domain_type[i] + + past_col <- paste0("NPastDiff_", domain_name) + fut_col <- paste0("NFutDiff_", domain_name) + + # Check if columns exist + if (!(past_col %in% colnames(data)) || !(fut_col %in% colnames(data))) { + cat("Warning: Columns", past_col, "or", fut_col, "not found\n") + next + } + + # Create long format data for this domain - using base R approach to avoid issues + # Past data + past_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", past_col)] + past_data$TimePerspective <- "Past" + past_data$Difference <- past_data[[past_col]] + past_data$Domain_Type <- domain_type + past_data$Domain_Item <- domain_name + past_data[[past_col]] <- NULL # Remove the original column + + # Future data + fut_data <- data[, c("pID", "ResponseId", "GROUP", "TASK_DO", "TEMPORAL_DO", "ITEM_DO", "COC_DO", + "demo_sex", "demo_age_1", "AOT_total", "CRT_correct", fut_col)] + fut_data$TimePerspective <- "Future" + fut_data$Difference <- fut_data[[fut_col]] + fut_data$Domain_Type <- domain_type + fut_data$Domain_Item <- domain_name + fut_data[[fut_col]] <- NULL # Remove the original column + + # Combine past and future data for this domain + domain_long_data <- rbind(past_data, fut_data) + all_long_data <- rbind(all_long_data, domain_long_data) + } + + # Convert to factors with proper levels + all_long_data$TimePerspective <- factor(all_long_data$TimePerspective, levels = c("Past", "Future")) + all_long_data$Domain_Type <- factor(all_long_data$Domain_Type, levels = c("Preferences", "Personality", "Values", "Life_Satisfaction")) + all_long_data$Domain_Item <- factor(all_long_data$Domain_Item, levels = c("pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice", + "life_ideal", "life_excellent", "life_satisfied", "life_important", "life_change")) + all_long_data$pID <- as.factor(all_long_data$pID) + + return(all_long_data) +} + +# Reshape all data to long format +cat("\nReshaping data to long format...\n") +long_data <- reshape_all_domains(data, domain_info) + +cat("Long format data dimensions:", dim(long_data), "\n") +cat("Unique domains:", length(unique(long_data$Domain_Item)), "\n") +cat("Domain types:", paste(unique(long_data$Domain_Type), collapse = ", "), "\n") +cat("Domain type counts:\n") +print(table(long_data$Domain_Type)) + +# Display structure and sample of long_data +cat("\nLong data structure:\n") +str(long_data) + +cat("\nFirst 10 rows of long_data:\n") +print(head(long_data, 10)) + +cat("\nColumn names:\n") +print(colnames(long_data)) + +# Show factor levels for domain variables +cat("\nDomain_Type factor levels:\n") +print(levels(long_data$Domain_Type)) + +cat("\nDomain_Item factor levels:\n") +print(levels(long_data$Domain_Item)) + +cat("\nTimePerspective factor levels:\n") +print(levels(long_data$TimePerspective)) + +# Show a sample with actual names instead of numbers +cat("\nSample data with actual names (first 6 rows):\n") +sample_data <- long_data[1:6, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(sample_data) + +# Show a better example - one participant across multiple domains +cat("\nExample: Participant 1 across multiple domains (first 10 rows):\n") +participant_1_data <- long_data[long_data$pID == 1, c("pID", "GROUP", "TASK_DO", "TEMPORAL_DO", "Domain_Type", "Domain_Item", "TimePerspective", "Difference")] +print(participant_1_data) + +# Show structure explanation +cat("\nLong format explanation:\n") +cat("- Each participant appears", length(unique(long_data$Domain_Item)) * 2, "times total\n") +cat("- (", length(unique(long_data$Domain_Item)), "domains × 2 time perspectives)\n") +cat("- Total rows per participant:", length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Total participants:", length(unique(long_data$pID)), "\n") +cat("- Expected total rows:", length(unique(long_data$pID)) * length(unique(long_data$Domain_Item)) * 2, "\n") +cat("- Actual total rows:", nrow(long_data), "\n") + +# STEP 2: ASSUMPTION CHECKING + +cat("STEP 2: CHECKING ASSUMPTIONS\n") + +head(long_data) +# 2.1 Check for missing values +missing_summary <- long_data %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(Difference)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +cat("\nMissing values by domain and time perspective:\n") +print(missing_summary) + +# Remove missing values +long_data_clean <- long_data[!is.na(long_data$Difference), ] +cat("\nData after removing missing values:", dim(long_data_clean), "\n") + +# 2.2 Outlier detection +cat("\nChecking for outliers...\n") +outlier_summary <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(Difference < lower_bound | Difference > upper_bound), + .groups = 'drop' + ) + +cat("Outlier summary (IQR method):\n") +print(outlier_summary) + +# 2.3 Normality tests +cat("\nTesting normality...\n") +normality_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + shapiro_p = ifelse(n >= 3 & n <= 5000, + shapiro.test(Difference)$p.value, + NA), + anderson_p = ifelse(n >= 7, + ad.test(Difference)$p.value, + NA), + .groups = 'drop' + ) %>% + mutate( + shapiro_normal = shapiro_p > 0.05, + anderson_normal = anderson_p > 0.05, + overall_normal = case_when( + !is.na(shapiro_p) & !is.na(anderson_p) ~ shapiro_normal & anderson_normal, + !is.na(shapiro_p) ~ shapiro_normal, + !is.na(anderson_p) ~ anderson_normal, + TRUE ~ NA + ) + ) + +cat("Normality test results:\n") +print(normality_results) + +# 2.4 Homogeneity of variance (Levene's test) +cat("\nTesting homogeneity of variance...\n") +homogeneity_results <- long_data_clean %>% + group_by(Domain_Type, Domain_Item) %>% + summarise( + levene_p = leveneTest(Difference ~ TimePerspective)$`Pr(>F)`[1], + homogeneous = levene_p > 0.05, + .groups = 'drop' + ) + +cat("Homogeneity of variance results:\n") +print(homogeneity_results) + +# STEP 3: DESCRIPTIVE STATISTICS +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 3: DESCRIPTIVE STATISTICS\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +desc_stats <- long_data_clean %>% + group_by(Domain_Type, Domain_Item, TimePerspective) %>% + summarise( + n = n(), + mean = mean(Difference), + sd = sd(Difference), + median = median(Difference), + q1 = quantile(Difference, 0.25), + q3 = quantile(Difference, 0.75), + min = min(Difference), + max = max(Difference), + .groups = 'drop' + ) + +cat("Descriptive statistics:\n") +print(desc_stats) + +# STEP 4: MIXED ANOVA ANALYSES +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("STEP 4: MIXED ANOVA ANALYSES\n") +cat(paste(rep("=", 80), collapse = ""), "\n") + +# 4.1 Overall analysis across all domains +cat("\n4.1 Overall Mixed ANOVA (all domains combined):\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +tryCatch({ + overall_anova <- ezANOVA( + data = long_data_clean, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Type), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE, + return_aov = TRUE + ) + + cat("Overall ANOVA Results:\n") + print(overall_anova) + + # Check sphericity + if (!is.null(overall_anova$`Mauchly's Test for Sphericity`)) { + cat("\nSphericity test results:\n") + print(overall_anova$`Mauchly's Test for Sphericity`) + } + +}, error = function(e) { + cat("Error in overall ANOVA:", e$message, "\n") +}) + +# 4.2 Domain-specific analyses +cat("\n4.2 Domain-specific Mixed ANOVAs:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +domain_results <- list() + +for (domain_type in unique(long_data_clean$Domain_Type)) { + cat("\nAnalyzing domain type:", domain_type, "\n") + + domain_data <- long_data_clean[long_data_clean$Domain_Type == domain_type, ] + + tryCatch({ + domain_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = c(TimePerspective, Domain_Item), + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_type, ":\n") + print(domain_anova) + + domain_results[[domain_type]] <- domain_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_type, ":", e$message, "\n") + + # Fallback to simpler analysis + cat("Attempting simpler repeated measures ANOVA...\n") + tryCatch({ + simple_anova <- ezANOVA( + data = domain_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + print(simple_anova) + domain_results[[domain_type]] <- simple_anova + }, error = function(e2) { + cat("Simple ANOVA also failed:", e2$message, "\n") + }) + }) +} + +# 4.3 Individual domain item analyses +cat("\n4.3 Individual Domain Item Analyses:\n") +cat(paste(rep("-", 50), collapse = ""), "\n") + +item_results <- list() + +for (domain_item in unique(long_data_clean$Domain_Item)) { + cat("\nAnalyzing individual item:", domain_item, "\n") + + item_data <- long_data_clean[long_data_clean$Domain_Item == domain_item, ] + + tryCatch({ + item_anova <- ezANOVA( + data = item_data, + dv = Difference, + wid = pID, + within = TimePerspective, + between = c(GROUP, TASK_DO), + type = 3, + detailed = TRUE + ) + + cat("ANOVA results for", domain_item, ":\n") + print(item_anova) + + item_results[[domain_item]] <- item_anova + + }, error = function(e) { + cat("Error in ANOVA for", domain_item, ":", e$message, "\n") + + # Fallback to paired t-test + past_vals <- item_data$Difference[item_data$TimePerspective == "Past"] + fut_vals <- item_data$Difference[item_data$TimePerspective == "Future"] + + if (length(past_vals) > 1 && length(fut_vals) > 1) { + t_test <- t.test(past_vals, fut_vals, paired = TRUE) + cat("Fallback paired t-test for", domain_item, ":\n") + cat("t =", round(t_test$statistic, 3), + ", df =", t_test$parameter, + ", p =", round(t_test$p.value, 5), "\n") + + item_results[[domain_item]] <- t_test + } + }) +} + +cat("\n", paste(rep("=", 80), collapse = ""), "\n") +cat("ANALYSIS COMPLETE!\n") +cat(paste(rep("=", 80), collapse = ""), "\n") +cat("Summary:\n") +cat("- Total domains analyzed:", length(unique(long_data_clean$Domain_Item)), "\n") +cat("- Domain types analyzed:", length(unique(long_data_clean$Domain_Type)), "\n") +cat("- Individual item analyses completed:", length(item_results), "\n") diff --git a/anova tables.pptx b/anova tables.pptx new file mode 100644 index 0000000..6c6857b Binary files /dev/null and b/anova tables.pptx differ diff --git a/correlation tables for presentation.docx b/correlation tables for presentation.docx new file mode 100644 index 0000000..7814535 Binary files /dev/null and b/correlation tables for presentation.docx differ diff --git a/eohi1/BS_means.vb b/eohi1/BS_means.vb new file mode 100644 index 0000000..3bd8303 --- /dev/null +++ b/eohi1/BS_means.vb @@ -0,0 +1,118 @@ +Option Explicit + +Private Function GetColIndex(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + If IsError(m) Then + GetColIndex = 0 + Else + GetColIndex = CLng(m) + End If +End Function + +Private Function BuildPresentColArray(ByVal headers As Variant, ByVal ws As Worksheet) As Variant + Dim tmp() As Long + ReDim tmp(0 To UBound(headers)) + Dim i As Long, c As Long + c = 0 + For i = LBound(headers) To UBound(headers) + Dim colIdx As Long + colIdx = GetColIndex(CStr(headers(i)), ws) + If colIdx > 0 Then + tmp(c) = colIdx + c = c + 1 + End If + Next i + If c = 0 Then + BuildPresentColArray = Array() + Else + Dim outArr() As Long + ReDim outArr(0 To c - 1) + For i = 0 To c - 1 + outArr(i) = tmp(i) + Next i + BuildPresentColArray = outArr + End If +End Function + +Private Function MeanOfRow(ByVal ws As Worksheet, ByVal rowIndex As Long, ByVal colIndexes As Variant) As Variant + Dim i As Long + Dim sumVals As Double + Dim countVals As Long + sumVals = 0 + countVals = 0 + If IsArray(colIndexes) Then + For i = LBound(colIndexes) To UBound(colIndexes) + Dim v As Variant + v = ws.Cells(rowIndex, CLng(colIndexes(i))).Value + If Not IsError(v) Then + If IsNumeric(v) Then + sumVals = sumVals + CDbl(v) + countVals = countVals + 1 + End If + End If + Next i + End If + If countVals = 0 Then + MeanOfRow = CVErr(xlErrNA) + Else + MeanOfRow = sumVals / countVals + End If +End Function + +Private Function EnsureOutputColumn(ByVal ws As Worksheet, ByVal headerName As String) As Long + Dim c As Long + c = GetColIndex(headerName, ws) + If c = 0 Then + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + c = lastCol + 1 + ws.Cells(1, c).Value = headerName + End If + EnsureOutputColumn = c +End Function + +Sub BS_Means() + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + + Dim all28 As Variant + all28 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim easy14 As Variant + easy14 = Array( _ + "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy" _ + ) + + Dim hard14 As Variant + hard14 = Array( _ + "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard" _ + ) + + Dim colsAll As Variant, colsEasy As Variant, colsHard As Variant + colsAll = BuildPresentColArray(all28, ws) + colsEasy = BuildPresentColArray(easy14, ws) + colsHard = BuildPresentColArray(hard14, ws) + + Dim colBS28 As Long, colBSEasy As Long, colBSHard As Long + colBS28 = EnsureOutputColumn(ws, "bs_28") + colBSEasy = EnsureOutputColumn(ws, "bs_easy") + colBSHard = EnsureOutputColumn(ws, "bs_hard") + + Dim lastRow As Long + lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + + Dim r As Long + For r = 2 To lastRow + ws.Cells(r, colBS28).Value = MeanOfRow(ws, r, colsAll) + ws.Cells(r, colBSEasy).Value = MeanOfRow(ws, r, colsEasy) + ws.Cells(r, colBSHard).Value = MeanOfRow(ws, r, colsHard) + Next r +End Sub + + diff --git a/eohi1/DataP 01 - domain mean totals .r b/eohi1/DataP 01 - domain mean totals .r new file mode 100644 index 0000000..f4da6af --- /dev/null +++ b/eohi1/DataP 01 - domain mean totals .r @@ -0,0 +1,25 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Calculate NPast_mean_total as average of NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +exp1_data$NPast_mean_total <- rowMeans(exp1_data[, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life")], na.rm = TRUE) + +# Calculate NFut_mean_total as average of NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life +exp1_data$NFut_mean_total <- rowMeans(exp1_data[, c("NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life")], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated totals +cat("NPast_mean_total summary:\n") +summary(exp1_data$NPast_mean_total) +cat("\nNFut_mean_total summary:\n") +summary(exp1_data$NFut_mean_total) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated totals:\n") +print(exp1_data[1:5, c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", "NPast_mean_total", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life", "NFut_mean_total")]) diff --git a/eohi1/E1 - correlation_matrix.csv b/eohi1/E1 - correlation_matrix.csv new file mode 100644 index 0000000..f87e26a --- /dev/null +++ b/eohi1/E1 - correlation_matrix.csv @@ -0,0 +1,17 @@ +,eohiDGEN_mean,ehi_global_mean,sex_dummy,demo_age_1,edu_num,AOT_total,CRT_correct,CRT_int,bs_28,bs_easy,bs_hard,cal_selfActual +ehi_global_mean,0.31***,,,,,,,,,,, +sex_dummy,0.0086,0.044,,,,,,,,,, +demo_age_1,-0.12***,-0.19***,0.0094,,,,,,,,, +edu_num,-0.0081,0.009,-0.062*,-0.023,,,,,,,, +AOT_total,0.11***,0.086***,-0.042,0.11,0.035,,,,,,, +CRT_correct,0.068*,0.051,-0.15***,-0.049,0.13***,0.26***,,,,,, +CRT_int,-0.058,-0.057,0.16***,0.071*,-0.12***,-0.21***,-0.87***,,,,, +bs_28,-0.01,-0.006803247,-0.0022,-0.071*,-0.065*,-0.27***,-0.25***,0.23***,,,, +bs_easy,-0.0088,0.014,-0.037,-0.30***,-0.009,-0.31***,-0.094***,0.047,0.61***,,, +bs_hard,-0.015,-0.024,0.022,0.095**,-0.085**,-0.15***,-0.24***,0.25***,0.87***,0.18***,, +cal_selfActual,0.015,-0.051,-0.15***,0.18***,0.12***,-0.041,0.047,-0.053,0.31***,0.05315529,0.35***, +cal_global,0.019,-0.0047,-0.078*,0.031,0.021,-0.16***,-0.15***,0.13***,0.76***,0.37***,0.72***,0.55*** +,,,,,,,,,,,, +*p<0.05,,,,,,,,,,,, +**p<0.01,,,,,,,,,,,, +***p<0.001,,,,,,,,,,,, diff --git a/eohi1/E1 - correlation_pvalues.csv b/eohi1/E1 - correlation_pvalues.csv new file mode 100644 index 0000000..6910080 --- /dev/null +++ b/eohi1/E1 - correlation_pvalues.csv @@ -0,0 +1,18 @@ +,eohiDGEN_mean,ehi_global_mean,sex_dummy,demo_age_1,edu_num,AOT_total,CRT_correct,CRT_int,bs_28,bs_easy,bs_hard,cal_selfActual +ehi_global_mean,3.36865E-25,,,,,,,,,,, +sex_dummy,0.778486413,0.154074007,,,,,,,,,, +demo_age_1,5.04502E-05,1.68576E-10,0.759436702,,,,,,,,, +edu_num,0.79326152,0.768960745,0.043945088,0.454222403,,,,,,,, +AOT_total,0.000229114,0.004867793,0.168503786,0.000314432,0.259313829,,,,,,, +CRT_correct,0.027291283,0.099344285,4.65922E-07,0.108342391,3.46509E-05,4.3812E-18,,,,,, +CRT_int,0.05842806,0.065472289,1.53701E-07,0.021280157,6.99182E-05,3.99893E-12,0,,,,, +bs_28,0.735913365,0.824825013,0.94333124,0.020232959,0.035132191,1.09048E-18,1.61283E-16,1.17159E-13,,,, +bs_easy,0.775943639,0.653590097,0.22951034,3.86076E-23,0.77008947,1.15661E-24,0.002210577,0.123278134,6.2215E-108,,, +bs_hard,0.622307404,0.443340859,0.469287124,0.001914319,0.005383608,7.67838E-07,9.71752E-16,2.00781E-16,0,2.79128E-09,, +cal_selfActual,0.623530057,0.098794041,8.23097E-07,2.62161E-09,0.000133768,0.183121705,0.125377421,0.088656149,2.63226E-25,0.083521419,5.04214E-32, +cal_global,0.543555525,0.879493859,0.011276459,0.318757547,0.487961367,3.0437E-07,8.00711E-07,1.20286E-05,1.4315E-202,3.1393E-35,1.2757E-171,4.92187E-86 +,,,,,,,,,,,, +,,,,,,,,,,,, +,p<0.05,,,,,,,,,,, +,p<0.01,,,,,,,,,,, +,p<0.001,,,,,,,,,,, diff --git a/eohi1/EHI reliability.html b/eohi1/EHI reliability.html new file mode 100644 index 0000000..9e5c8a2 --- /dev/null +++ b/eohi1/EHI reliability.html @@ -0,0 +1,65 @@ +EHI Reliability Analysis

EHI Reliability Analysis

Two-Item Reliability Summary

Pearson r: 0.34049 (95% CI: [0.28622, 0.39258])

Spearman r: 0.31052 (95% CI: [0.25516, 0.36386])

Spearman–Brown / Cronbach's α: 0.50801 (95% CI: [0.44506, 0.56382])

Cronbach's Alpha

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
0.3078741 0.5080098 0.3404914 0.3404914 1.032561 0.0216938 0.2755268 0.98504 0.3404914

Split-Half Reliability

Maximum split half reliability: 0.50801

Item-Level Statistics

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
n raw.r std.r r.cor r.drop mean sd
eohiDGEN_mean 1063 0.9706327 0.8186853 0.4777163 0.3404914 0.4148824 1.740598
ehi_global_mean 1063 0.5566839 0.8186853 0.4777163 0.3404914 0.1361712 0.504053
diff --git a/eohi1/Rplots.pdf b/eohi1/Rplots.pdf new file mode 100644 index 0000000..bdd4012 Binary files /dev/null and b/eohi1/Rplots.pdf differ diff --git a/eohi1/accuracy + calibration - 28 items.vb b/eohi1/accuracy + calibration - 28 items.vb new file mode 100644 index 0000000..e69de29 diff --git a/eohi1/age_DGEN_assumptions.png b/eohi1/age_DGEN_assumptions.png new file mode 100644 index 0000000..f7d02e5 Binary files /dev/null and b/eohi1/age_DGEN_assumptions.png differ diff --git a/eohi1/age_DGEN_plot.png b/eohi1/age_DGEN_plot.png new file mode 100644 index 0000000..081a2f1 Binary files /dev/null and b/eohi1/age_DGEN_plot.png differ diff --git a/eohi1/age_domain_assumptions.png b/eohi1/age_domain_assumptions.png new file mode 100644 index 0000000..dcb96ad Binary files /dev/null and b/eohi1/age_domain_assumptions.png differ diff --git a/eohi1/age_domain_plot.png b/eohi1/age_domain_plot.png new file mode 100644 index 0000000..0beb740 Binary files /dev/null and b/eohi1/age_domain_plot.png differ diff --git a/eohi1/assumption_checks_before_cronbach.r b/eohi1/assumption_checks_before_cronbach.r new file mode 100644 index 0000000..3de74a7 --- /dev/null +++ b/eohi1/assumption_checks_before_cronbach.r @@ -0,0 +1,164 @@ +# Assumption Checks Before Cronbach's Alpha Analysis +# Run this BEFORE the main reliability analysis + +library(psych) +library(corrplot) +library(ggplot2) + +# Read the data +data <- read.csv("exp1.csv") + +# Define scale variables +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Function to check assumptions for a scale +check_assumptions <- function(data, var_names, scale_name) { + cat("\n", "="*60, "\n") + cat("ASSUMPTION CHECKS FOR:", scale_name, "\n") + cat("="*60, "\n") + + # Get scale data + scale_data <- data[, var_names] + + # 1. Sample size check + complete_cases <- sum(complete.cases(scale_data)) + cat("1. SAMPLE SIZE CHECK:\n") + cat(" Total participants:", nrow(data), "\n") + cat(" Complete cases:", complete_cases, "\n") + cat(" Adequate (≥30)?", ifelse(complete_cases >= 30, "✓ YES", "✗ NO"), "\n") + + if(complete_cases < 30) { + cat(" WARNING: Sample size too small for reliable alpha estimates\n") + return(FALSE) + } + + # 2. Missing data check + cat("\n2. MISSING DATA CHECK:\n") + missing_counts <- colSums(is.na(scale_data)) + missing_pct <- round(missing_counts / nrow(data) * 100, 2) + cat(" Missing data by item:\n") + for(i in 1:length(var_names)) { + cat(" ", var_names[i], ":", missing_counts[i], "(", missing_pct[i], "%)\n") + } + + max_missing <- max(missing_pct) + cat(" Maximum missing:", max_missing, "%\n") + cat(" Acceptable (<20%)?", ifelse(max_missing < 20, "✓ YES", "✗ NO"), "\n") + + # 3. Use only complete cases for remaining checks + complete_data <- scale_data[complete.cases(scale_data), ] + + # 4. Normality check (Shapiro-Wilk test on first item as example) + cat("\n3. NORMALITY CHECK (Shapiro-Wilk test on first item):\n") + if(nrow(complete_data) <= 5000) { # Shapiro-Wilk has sample size limit + shapiro_result <- shapiro.test(complete_data[, 1]) + cat(" p-value:", round(shapiro_result$p.value, 4), "\n") + cat(" Normal?", ifelse(shapiro_result$p.value > 0.05, "✓ YES", "✗ NO (but alpha is robust)"), "\n") + } else { + cat(" Sample too large for Shapiro-Wilk test (alpha is robust to non-normality)\n") + } + + # 5. Inter-item correlations check + cat("\n4. INTER-ITEM CORRELATIONS CHECK:\n") + cor_matrix <- cor(complete_data) + + # Get off-diagonal correlations + cor_matrix[lower.tri(cor_matrix)] <- NA + diag(cor_matrix) <- NA + cors <- as.vector(cor_matrix) + cors <- cors[!is.na(cors)] + + positive_cors <- sum(cors > 0) + strong_cors <- sum(cors > 0.30) + negative_cors <- sum(cors < 0) + + cat(" Total correlations:", length(cors), "\n") + cat(" Positive correlations:", positive_cors, "\n") + cat(" Strong correlations (>0.30):", strong_cors, "\n") + cat(" Negative correlations:", negative_cors, "\n") + cat(" Mean correlation:", round(mean(cors), 4), "\n") + cat(" Range:", round(min(cors), 4), "to", round(max(cors), 4), "\n") + + if(negative_cors > 0) { + cat(" ⚠️ WARNING: Negative correlations suggest potential issues\n") + } + if(strong_cors / length(cors) < 0.5) { + cat(" ⚠️ WARNING: Many weak correlations may indicate poor scale coherence\n") + } + + # 6. Item variance check + cat("\n5. ITEM VARIANCE CHECK:\n") + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat(" Item variances:", round(item_vars, 4), "\n") + cat(" Variance ratio (max/min):", round(var_ratio, 4), "\n") + cat(" Acceptable (<4:1)?", ifelse(var_ratio < 4, "✓ YES", "✗ NO"), "\n") + + # 7. Outlier check + cat("\n6. OUTLIER CHECK:\n") + # Check for multivariate outliers using Mahalanobis distance + if(nrow(complete_data) > ncol(complete_data)) { + mahal_dist <- mahalanobis(complete_data, colMeans(complete_data), cov(complete_data)) + outlier_threshold <- qchisq(0.999, df = ncol(complete_data)) + outliers <- sum(mahal_dist > outlier_threshold) + cat(" Multivariate outliers (p<0.001):", outliers, "\n") + cat(" Acceptable (<5%)?", ifelse(outliers/nrow(complete_data) < 0.05, "✓ YES", "✗ NO"), "\n") + } + + # 8. Summary recommendation + cat("\n7. OVERALL RECOMMENDATION:\n") + issues <- 0 + if(complete_cases < 30) issues <- issues + 1 + if(max_missing >= 20) issues <- issues + 1 + if(negative_cors > 0) issues <- issues + 1 + if(var_ratio >= 4) issues <- issues + 1 + + if(issues == 0) { + cat(" ✓ PROCEED with Cronbach's alpha analysis\n") + } else if(issues <= 2) { + cat(" ⚠️ PROCEED with CAUTION - some assumptions violated\n") + } else { + cat(" ✗ CONSIDER alternatives or data cleaning before proceeding\n") + } + + return(TRUE) +} + +# Check assumptions for all past scales +cat("CRONBACH'S ALPHA ASSUMPTION CHECKS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +check_assumptions(data, past_pref_vars, "Past Preferences") +check_assumptions(data, past_pers_vars, "Past Personality") +check_assumptions(data, past_val_vars, "Past Values") +check_assumptions(data, past_life_vars, "Past Life Satisfaction") + +# Quick check of future scales (you can expand this) +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +check_assumptions(data, fut_pref_vars, "Future Preferences") + +cat("\n", "="*60, "\n") +cat("GENERAL GUIDELINES:\n") +cat("="*60, "\n") +cat("✓ If most assumptions are met, Cronbach's alpha is appropriate\n") +cat("⚠️ If some assumptions are violated, interpret with caution\n") +cat("✗ If many assumptions are violated, consider alternative approaches:\n") +cat(" - Omega coefficient (more robust to violations)\n") +cat(" - Split-half reliability\n") +cat(" - Test-retest reliability\n") +cat(" - Factor analysis to check dimensionality\n") + + diff --git a/eohi1/brierVARS.vb b/eohi1/brierVARS.vb new file mode 100644 index 0000000..ab96160 --- /dev/null +++ b/eohi1/brierVARS.vb @@ -0,0 +1,141 @@ +Function GetCol(ByVal headerName As String, ByVal ws As Worksheet) As Long + Dim lastCol As Long + lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + On Error Resume Next + Dim m As Variant + m = Application.Match(headerName, ws.Range(ws.Cells(1, 1), ws.Cells(1, lastCol)), 0) + On Error GoTo 0 + If IsError(m) Then + GetCol = 0 + Else + GetCol = CLng(m) + End If +End Function + +Private Function NormalizeTruth(ByVal v As Variant) As Variant + ' Returns True/False or Null if cannot determine + If VarType(v) = vbBoolean Then + NormalizeTruth = v + Exit Function + End If + If IsError(v) Or IsEmpty(v) Then + NormalizeTruth = Null + Exit Function + End If + Dim s As String + s = Trim$(UCase$(CStr(v))) + Select Case s + Case "TRUE", "T", "1", "YES", "Y" + NormalizeTruth = True + Case "FALSE", "F", "0", "NO", "N" + NormalizeTruth = False + Case Else + NormalizeTruth = Null + End Select +End Function + +Private Function NormalizeProb01(ByVal v As Variant) As Double + ' Converts confidence values to [0,1] + If IsError(v) Or IsEmpty(v) Then + NormalizeProb01 = -1 + Exit Function + End If + Dim s As String + s = CStr(v) + If InStr(s, "%") > 0 Then + s = Replace$(s, "%", "") + If IsNumeric(s) Then + NormalizeProb01 = CDbl(s) / 100# + Exit Function + End If + End If + If IsNumeric(v) Then + Dim d As Double + d = CDbl(v) + If d > 1# Then + NormalizeProb01 = d / 100# + Else + NormalizeProb01 = d + End If + Else + NormalizeProb01 = -1 + End If +End Function + +Sub brierVARS() + Dim false_vars As Variant + Dim true_vars As Variant + false_vars = Array("moza_55_F_1", "moza_55_CON", "demo_15_F_1", "demo_15_CON", "hume_35_F_1", "hume_35_CON", "gulf_15_F_1", "gulf_15_CON", "memo_75_F_1", "memo_75_CON", "vitc_55_F_1", "vitc_55_CON", "hert_35_F_1", "hert_35_CON", "gees_55_F_1", "gees_55_CON", "gang_15_F_1", "gang_15_CON", "list_75_F_1", "list_75_CON", "mont_35_F_1", "mont_35_CON", "dwar_55_F_1", "dwar_55_CON", "pucc_15_F_1", "pucc_15_CON", "spee_75_F_1", "spee_75_CON", "lute_35_F_1", "lute_35_CON", "croc_75_F_1", "croc_75_CON") + true_vars = Array("vaud_15_T_1", "vaud_15_CON", "oedi_35_T_1", "oedi_35_CON", "mons_55_T_1", "mons_55_CON", "gest_75_T_1", "gest_75_CON", "kabu_15_T_1", "kabu_15_CON", "sham_55_T_1", "sham_55_CON", "pana_35_T_1", "pana_35_CON", "bohr_15_T_1", "bohr_15_CON", "chur_75_T_1", "chur_75_CON", "carb_35_T_1", "carb_35_CON", "cons_55_T_1", "cons_55_CON", "papy_75_T_1", "papy_75_CON", "dors_55_T_1", "dors_55_CON", "tsun_75_T_1", "tsun_75_CON", "troy_15_T_1", "troy_15_CON", "lock_35_T_1", "lock_35_CON") + Dim target_headers As Variant + target_headers = Array("gest_T_ex", "dors_T_ex", "chur_T_ex", "mons_T_ex", "lock_T_easy", "hume_F_easy", "papy_T_easy", "sham_T_easy", "list_F_easy", "cons_T_easy", "tsun_T_easy", "pana_T_easy", "kabu_T_easy", "gulf_F_easy", "oedi_T_easy", "vaud_T_easy", "mont_F_easy", "demo_F_easy", "spee_F_hard", "dwar_F_hard", "carb_T_hard", "bohr_T_hard", "gang_F_hard", "vitc_F_hard", "hert_F_hard", "pucc_F_hard", "troy_T_hard", "moza_F_hard", "croc_F_hard", "gees_F_hard", "lute_F_hard", "memo_F_hard") + Dim ws As Worksheet + Set ws = ThisWorkbook.Sheets(1) + Dim i As Long, rowCount As Long, colSource1 As Long, colSourceCON As Long, colTarget As Long + Dim srcVar As String, matchPrefix As String, checkVal As String, val As Double + Dim result As Variant + Dim r As Long, j As Long + rowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + For i = 0 To UBound(false_vars) Step 2 + srcVar = false_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(false_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth As Variant + truth = NormalizeTruth(checkVal) + If IsNull(truth) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth = True Then + result = (val - 0#) ^ 2 + Else + result = ((1# - val) - 0#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i + For i = 0 To UBound(true_vars) Step 2 + srcVar = true_vars(i) + matchPrefix = Left(srcVar, InStrRev(srcVar, "_") - 1) + colSource1 = GetCol(srcVar, ws) + colSourceCON = GetCol(true_vars(i + 1), ws) + If colSource1 > 0 And colSourceCON > 0 Then + For r = 2 To rowCount + checkVal = ws.Cells(r, colSource1).Value + val = NormalizeProb01(ws.Cells(r, colSourceCON).Value) + colTarget = 0 + For j = 0 To UBound(target_headers) + If Left(target_headers(j), InStr(target_headers(j), "_") - 1) = Left(matchPrefix, InStr(matchPrefix, "_") - 1) Then + colTarget = GetCol(target_headers(j), ws) + Exit For + End If + Next j + If colTarget > 0 Then + Dim truth2 As Variant + truth2 = NormalizeTruth(checkVal) + If IsNull(truth2) Or val < 0 Then + result = CVErr(xlErrNA) + ElseIf truth2 = True Then + result = (val - 1#) ^ 2 + Else + result = ((1# - val) - 1#) ^ 2 + End If + ws.Cells(r, colTarget).Value = result + End If + Next r + End If + Next i +End Sub diff --git a/eohi1/corr_bs_all.csv b/eohi1/corr_bs_all.csv new file mode 100644 index 0000000..bff9dc1 --- /dev/null +++ b/eohi1/corr_bs_all.csv @@ -0,0 +1,57 @@ +group,var_x,var_y,n,r,p +BS_vs_Cal,bs_28,cal_global,1063,0.761895605,2.37E-202 +BS_vs_Cal,bs_easy,cal_global,1063,0.367329651,2.67E-35 +BS_vs_Cal,bs_hard,cal_global,1063,0.721638057,1.16E-171 +BS_vs_Cal,bs_28,cal_selfActual,1063,0.312906942,1.41E-25 +BS_vs_Cal,bs_easy,cal_selfActual,1063,0.054307733,0.07675131 +BS_vs_Cal,bs_hard,cal_selfActual,1063,0.351630149,2.70E-32 +BS_vs_EOHI,bs_28,ehi_global_mean,1063,-0.005868845,0.848429656 +BS_vs_EOHI,bs_easy,ehi_global_mean,1063,0.014251763,0.642549738 +BS_vs_EOHI,bs_hard,ehi_global_mean,1063,-0.022683413,0.460035927 +Cal_vs_EOHI,cal_global,ehi_global_mean,1063,-0.004912877,0.872888653 +Cal_vs_EOHI,cal_selfActual,ehi_global_mean,1063,-0.049727552,0.105147189 +BS_vs_EOHI,bs_28,ehi_life_mean,1063,-0.007684801,0.802384957 +BS_vs_EOHI,bs_easy,ehi_life_mean,1063,-0.024372981,0.427293321 +BS_vs_EOHI,bs_hard,ehi_life_mean,1063,-0.001049006,0.972748582 +Cal_vs_EOHI,cal_global,ehi_life_mean,1063,-0.002906394,0.924594545 +Cal_vs_EOHI,cal_selfActual,ehi_life_mean,1063,0.028247567,0.357533744 +BS_vs_EOHI,bs_28,ehi_pers_mean,1063,-0.00684928,0.823495332 +BS_vs_EOHI,bs_easy,ehi_pers_mean,1063,-0.009992311,0.744870091 +BS_vs_EOHI,bs_hard,ehi_pers_mean,1063,-0.013361509,0.663459912 +Cal_vs_EOHI,cal_global,ehi_pers_mean,1063,-0.009160631,0.765455012 +Cal_vs_EOHI,cal_selfActual,ehi_pers_mean,1063,-0.082807345,0.006907147 +BS_vs_EOHI,bs_28,ehi_pref_mean,1063,-0.009153426,0.765634093 +BS_vs_EOHI,bs_easy,ehi_pref_mean,1063,0.038767348,0.20660862 +BS_vs_EOHI,bs_hard,ehi_pref_mean,1063,-0.033018506,0.282127883 +Cal_vs_EOHI,cal_global,ehi_pref_mean,1063,0.009717642,0.751649131 +Cal_vs_EOHI,cal_selfActual,ehi_pref_mean,1063,-0.044228709,0.149576975 +BS_vs_EOHI,bs_28,ehi_val_mean,1063,0.011477853,0.708558862 +BS_vs_EOHI,bs_easy,ehi_val_mean,1063,0.048673437,0.11273791 +BS_vs_EOHI,bs_hard,ehi_val_mean,1063,-0.008316877,0.786509127 +Cal_vs_EOHI,cal_global,ehi_val_mean,1063,-0.024447239,0.425886059 +Cal_vs_EOHI,cal_selfActual,ehi_val_mean,1063,-0.099629152,0.001143742 +BS_vs_EOHI,bs_28,eohiDGEN_life,1063,-0.011893558,0.69851102 +BS_vs_EOHI,bs_easy,eohiDGEN_life,1063,-0.087676604,0.004226705 +BS_vs_EOHI,bs_hard,eohiDGEN_life,1063,0.036722132,0.231590633 +Cal_vs_EOHI,cal_global,eohiDGEN_life,1063,0.004140068,0.892751642 +Cal_vs_EOHI,cal_selfActual,eohiDGEN_life,1063,0.036877484,0.229620994 +BS_vs_EOHI,bs_28,eohiDGEN_mean,1063,-0.008492209,0.782120675 +BS_vs_EOHI,bs_easy,eohiDGEN_mean,1063,-0.007458252,0.808095459 +BS_vs_EOHI,bs_hard,eohiDGEN_mean,1063,-0.013570736,0.658521255 +Cal_vs_EOHI,cal_global,eohiDGEN_mean,1063,0.019739833,0.520291178 +Cal_vs_EOHI,cal_selfActual,eohiDGEN_mean,1063,0.016902147,0.582001734 +BS_vs_EOHI,bs_28,eohiDGEN_pers,1063,-0.013831247,0.652392826 +BS_vs_EOHI,bs_easy,eohiDGEN_pers,1063,-0.013771822,0.653788727 +BS_vs_EOHI,bs_hard,eohiDGEN_pers,1063,-0.013837654,0.652242395 +Cal_vs_EOHI,cal_global,eohiDGEN_pers,1063,-0.010393397,0.735006441 +Cal_vs_EOHI,cal_selfActual,eohiDGEN_pers,1063,-0.028354225,0.355720599 +BS_vs_EOHI,bs_28,eohiDGEN_pref,1063,0.002305478,0.940152072 +BS_vs_EOHI,bs_easy,eohiDGEN_pref,1063,0.014268945,0.642148877 +BS_vs_EOHI,bs_hard,eohiDGEN_pref,1063,-0.006108935,0.842308668 +Cal_vs_EOHI,cal_global,eohiDGEN_pref,1063,0.024379777,0.427164421 +Cal_vs_EOHI,cal_selfActual,eohiDGEN_pref,1063,0.008387657,0.784736723 +BS_vs_EOHI,bs_28,eohiDGEN_val,1063,-0.043411125,0.157255062 +BS_vs_EOHI,bs_easy,eohiDGEN_val,1063,-0.058087693,0.058325548 +BS_vs_EOHI,bs_hard,eohiDGEN_val,1063,-0.032241181,0.293618158 +Cal_vs_EOHI,cal_global,eohiDGEN_val,1063,-0.032038903,0.296658895 +Cal_vs_EOHI,cal_selfActual,eohiDGEN_val,1063,0.035471252,0.247887232 diff --git a/eohi1/correlation matrix.r b/eohi1/correlation matrix.r new file mode 100644 index 0000000..d19a28e --- /dev/null +++ b/eohi1/correlation matrix.r @@ -0,0 +1,103 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1, edu3, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(eohiDGEN_mean, ehi_global_mean, sex_dummy, demo_age_1, edu_num, AOT_total, CRT_correct, CRT_int, bs_28, bs_easy, bs_hard, cal_selfActual, cal_global) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) diff --git a/eohi1/correlation_exp1.csv b/eohi1/correlation_exp1.csv new file mode 100644 index 0000000..f9b30f1 --- /dev/null +++ b/eohi1/correlation_exp1.csv @@ -0,0 +1,31 @@ +Variable1,Variable2,Spearman_r,P_value +ehi_global_mean,AOT_total,0.084899905,0.005609163 +ehi_life_mean,AOT_total,0.072949943,0.017368706 +ehi_pref_mean,CRT_correct,0.068917794,0.024639893 +ehi_pref_mean,CRT_int,-0.064728497,0.034848248 +eohiDGEN_life,AOT_total,0.117946108,0.000116007 +eohiDGEN_mean,AOT_total,0.111022973,0.000287049 +eohiDGEN_mean,CRT_correct,0.066645932,0.029798224 +eohiDGEN_pers,AOT_total,0.091596281,0.002797567 +eohiDGEN_pref,AOT_total,0.068355715,0.025838342 +eohiDGEN_val,AOT_total,0.103955004,0.000687468 +eohiDGEN_val,CRT_correct,0.074789341,0.014729792 +eohiDGEN_val,CRT_int,-0.06044435,0.048816455 +eohiDGEN_pref,CRT_int,-0.058185337,0.057903079 +ehi_global_mean,CRT_int,-0.057457963,0.061112 +eohiDGEN_mean,CRT_int,-0.057307383,0.061794359 +eohiDGEN_pref,CRT_correct,0.053610168,0.080621938 +ehi_global_mean,CRT_correct,0.051329314,0.094394596 +ehi_pers_mean,CRT_correct,0.051328061,0.094402649 +ehi_pref_mean,AOT_total,0.05039887,0.100528033 +ehi_pers_mean,CRT_int,-0.049058279,0.109918146 +eohiDGEN_life,CRT_correct,0.039494214,0.198218491 +ehi_val_mean,CRT_int,-0.037910532,0.216825816 +ehi_pers_mean,AOT_total,0.031316388,0.307691267 +eohiDGEN_pers,CRT_correct,0.025658263,0.403319679 +eohiDGEN_pers,CRT_int,-0.017319242,0.572720797 +ehi_life_mean,CRT_correct,0.016392301,0.593440889 +ehi_val_mean,AOT_total,0.015193625,0.620731537 +ehi_val_mean,CRT_correct,0.00599121,0.845308845 +ehi_life_mean,CRT_int,-0.005811627,0.849889753 +eohiDGEN_life,CRT_int,-0.001303724,0.966135022 diff --git a/eohi1/correlation_plot_scales_pearson.pdf b/eohi1/correlation_plot_scales_pearson.pdf new file mode 100644 index 0000000..133db08 Binary files /dev/null and b/eohi1/correlation_plot_scales_pearson.pdf differ diff --git a/eohi1/correlation_plot_scales_spearman.pdf b/eohi1/correlation_plot_scales_spearman.pdf new file mode 100644 index 0000000..67889aa Binary files /dev/null and b/eohi1/correlation_plot_scales_spearman.pdf differ diff --git a/eohi1/correlations - brier score x eohi and cal.r b/eohi1/correlations - brier score x eohi and cal.r new file mode 100644 index 0000000..b2dfd5d --- /dev/null +++ b/eohi1/correlations - brier score x eohi and cal.r @@ -0,0 +1,81 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("ehi1.csv") + +# Keep only required columns for the analysis +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +df1 <- df1 %>% dplyr::select(dplyr::all_of(c(bs_vars, eohi_vars, cal_vars))) + +# --- Brier score correlations vs EOHIs and Calibration --- + +# Variables +bs_vars <- c("bs_28", "bs_easy", "bs_hard") +eohi_vars <- c( + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean" +) +cal_vars <- c("cal_selfActual","cal_global") + +# Helper: tidy correlation (method = "pearson" or "spearman"), pairwise complete +corr_tidy <- function(df, x_vars, y_vars, method = "pearson") { + grid <- expand.grid(x = x_vars, y = y_vars, stringsAsFactors = FALSE) + results <- purrr::pmap_dfr(grid, function(x, y) { + xv <- df[[x]]; yv <- df[[y]] + ok <- is.finite(xv) & is.finite(yv) + if (sum(ok) < 3) { + return(tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = NA_real_, p = NA_real_, method = method)) + } + ct <- suppressWarnings(cor.test(xv[ok], yv[ok], method = method)) + tibble::tibble(var_x = x, var_y = y, n = sum(ok), r = unname(ct$estimate), p = ct$p.value, method = method) + }) + dplyr::arrange(results, var_x, var_y) +} + +# Compute correlations (Spearman only) +corr_bs_eohi <- corr_tidy(df1, bs_vars, eohi_vars, method = "spearman") +corr_bs_cal <- corr_tidy(df1, bs_vars, cal_vars, method = "spearman") +corr_cal_eohi <- corr_tidy(df1, cal_vars, eohi_vars, method = "spearman") + +# Wide r-only tables (optional) +to_wide <- function(d) { + tidyr::pivot_wider(d, id_cols = var_x, names_from = var_y, values_from = r) +} +wide_bs_eohi <- to_wide(corr_bs_eohi) +wide_bs_cal <- to_wide(corr_bs_cal) +wide_cal_eohi <- to_wide(corr_cal_eohi) + +# Display +print("Correlations: Brier vs EOHIs (Spearman rho, p, n)") +print(corr_bs_eohi) +print("Correlations: Brier vs Calibration (Spearman rho, p, n)") +print(corr_bs_cal) +print("Correlations: Calibration vs EOHIs (Spearman rho, p, n)") +print(corr_cal_eohi) + +# Export a single CSV combining all sets +corr_bs_eohi$group <- "BS_vs_EOHI" +corr_bs_cal$group <- "BS_vs_Cal" +corr_cal_eohi$group <- "Cal_vs_EOHI" + +corr_all <- dplyr::bind_rows(corr_bs_eohi, corr_bs_cal, corr_cal_eohi) %>% + dplyr::relocate(group, .before = var_x) +write.csv(corr_all, "corr_bs_all.csv", row.names = FALSE) \ No newline at end of file diff --git a/eohi1/correlations - eohi x calibration.r b/eohi1/correlations - eohi x calibration.r new file mode 100644 index 0000000..a99d62f --- /dev/null +++ b/eohi1/correlations - eohi x calibration.r @@ -0,0 +1,303 @@ +# Load required libraries +library(Hmisc) +library(knitr) +library(dplyr) +library(corrr) +library(broom) +library(purrr) +library(tidyr) +library(tibble) +library(boot) + +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") +# Load data +df1 <- read.csv("exp1.csv") + +# Remove columns with all NA values +df1 <- df1 %>% select(where(~ !all(is.na(.)))) + +# Select variables of interest +eohi_vars <- c("eohi_pref", "eohi_pers", "eohi_val", "eohi_life", "eohi_mean", + "eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean") +cal_vars <- c("cal_selfActual", "cal_global", "cal_15", "cal_35", "cal_55", "cal_75", "cal_true", "cal_false") + +# Create dataset with selected variables +df <- df1[, c(eohi_vars, cal_vars)] + +# Ensure all selected variables are numeric +df <- df %>% + mutate(across(everything(), as.numeric)) + +# Remove rows with any missing values for correlation analysis +df_complete <- df[complete.cases(df), ] + +cat("Sample size for correlation analysis:", nrow(df_complete), "\n") +cat("Total sample size:", nrow(df), "\n") + +str(df) +summary(df) +####==== DESCRIPTIVE STATISTICS ==== + +# Function to compute descriptive statistics +get_descriptives <- function(data, vars) { + desc_stats <- data %>% + select(all_of(vars)) %>% + summarise(across(everything(), list( + n = ~sum(!is.na(.)), + mean = ~mean(., na.rm = TRUE), + sd = ~sd(., na.rm = TRUE), + min = ~min(., na.rm = TRUE), + max = ~max(., na.rm = TRUE), + median = ~median(., na.rm = TRUE), + q25 = ~quantile(., 0.25, na.rm = TRUE), + q75 = ~quantile(., 0.75, na.rm = TRUE) + ))) %>% + pivot_longer(everything(), names_to = "variable", values_to = "value") %>% + separate(variable, into = c("var", "stat"), sep = "_(?=[^_]+$)") %>% + pivot_wider(names_from = stat, values_from = value) %>% + mutate(across(c(mean, sd, min, max, median, q25, q75), ~round(., 5))) + + return(desc_stats) +} + +# Get descriptives for EOHI variables +eohi_descriptives <- get_descriptives(df, eohi_vars) +cat("\n=== EOHI Variables Descriptives ===\n") +print(eohi_descriptives) + +# Get descriptives for calibration variables +cal_descriptives <- get_descriptives(df, cal_vars) +cat("\n=== Calibration Variables Descriptives ===\n") +print(cal_descriptives) + +# Check for bimodal or unusual distributions +hist(df$eohi_pref) +hist(df$cal_selfActual) + +# Look for extreme values +# boxplot(df$eohi_pref) +# boxplot(df$cal_selfActual) + +# Test normality for each variable - probably unnecessary +library(nortest) + +# Test EOHI variables +for(var in eohi_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +# Test calibration variables +for(var in cal_vars) { + cat("\n", var, "normality test:\n") + print(shapiro.test(df_complete[[var]])) +} + +####==== PEARSON CORRELATIONS ==== + +# Compute correlation matrix with p-values +cor_results_pearson <- rcorr(as.matrix(df_complete), type = "pearson") + +# Extract correlation coefficients +cor_pearson <- cor_results_pearson$r + +# Extract p-values +p_matrix_pearson <- cor_results_pearson$P + +# Function to add significance stars +corstars <- function(cor_mat, p_mat) { + stars <- ifelse(p_mat < 0.001, "***", + ifelse(p_mat < 0.01, "**", + ifelse(p_mat < 0.05, "*", ""))) + + # Combine correlation values with stars, rounded to 5 decimal places + cor_with_stars <- matrix(paste0(format(round(cor_mat, 5), nsmall = 5), stars), + nrow = nrow(cor_mat)) + + # Set row and column names + rownames(cor_with_stars) <- rownames(cor_mat) + colnames(cor_with_stars) <- colnames(cor_mat) + + return(cor_with_stars) +} + +# Apply the function +cor_table_pearson <- corstars(cor_pearson, p_matrix_pearson) + +cat("\n=== PEARSON CORRELATIONS ===\n") +print(cor_table_pearson, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations <- cor_pearson[eohi_vars, cal_vars] +eohi_cal_pvalues <- p_matrix_pearson[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Pearson Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations)) { + for(j in 1:ncol(eohi_cal_correlations)) { + cor_val <- eohi_cal_correlations[i, j] + p_val <- eohi_cal_pvalues[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: r = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations)[i], + colnames(eohi_cal_correlations)[j], + cor_val, star, p_val)) + } +} + +####==== SPEARMAN CORRELATIONS ==== + +# Compute Spearman correlation matrix with p-values +cor_results_spearman <- rcorr(as.matrix(df_complete), type = "spearman") + +# Extract correlation coefficients +cor_spearman <- cor_results_spearman$r + +# Extract p-values +p_matrix_spearman <- cor_results_spearman$P + +# Apply the function +cor_table_spearman <- corstars(cor_spearman, p_matrix_spearman) + +cat("\n=== SPEARMAN CORRELATIONS ===\n") +print(cor_table_spearman, quote = FALSE) + +# Extract specific correlations between EOHI and calibration variables +eohi_cal_correlations_spearman <- cor_spearman[eohi_vars, cal_vars] +eohi_cal_pvalues_spearman <- p_matrix_spearman[eohi_vars, cal_vars] + +cat("\n=== EOHI x Calibration Spearman Correlations ===\n") +for(i in 1:nrow(eohi_cal_correlations_spearman)) { + for(j in 1:ncol(eohi_cal_correlations_spearman)) { + cor_val <- eohi_cal_correlations_spearman[i, j] + p_val <- eohi_cal_pvalues_spearman[i, j] + star <- ifelse(p_val < 0.001, "***", + ifelse(p_val < 0.01, "**", + ifelse(p_val < 0.05, "*", ""))) + cat(sprintf("%s x %s: rho = %.5f%s, p = %.5f\n", + rownames(eohi_cal_correlations_spearman)[i], + colnames(eohi_cal_correlations_spearman)[j], + cor_val, star, p_val)) + } +} + +####==== BOOTSTRAPPED 95% CONFIDENCE INTERVALS ==== + +# Function to compute correlation with bootstrap CI +bootstrap_correlation <- function(data, var1, var2, method = "pearson", R = 1000) { + # Remove missing values + complete_data <- data[complete.cases(data[, c(var1, var2)]), ] + + if(nrow(complete_data) < 3) { + return(data.frame( + correlation = NA, + ci_lower = NA, + ci_upper = NA, + n = nrow(complete_data) + )) + } + + # Bootstrap function + boot_fun <- function(data, indices) { + cor(data[indices, var1], data[indices, var2], method = method, use = "complete.obs") + } + + # Perform bootstrap + set.seed(123) # for reproducibility + boot_results <- boot(complete_data, boot_fun, R = R) + + # Calculate confidence interval + ci <- boot.ci(boot_results, type = "perc") + + return(data.frame( + correlation = boot_results$t0, + ci_lower = ci$perc[4], + ci_upper = ci$perc[5], + n = nrow(complete_data) + )) +} + +# Compute bootstrap CIs for all EOHI x Calibration correlations +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (PEARSON) ===\n") +bootstrap_results_pearson <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "pearson", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "pearson" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_pearson) + +cat("\n=== BOOTSTRAPPED 95% CONFIDENCE INTERVALS (SPEARMAN) ===\n") +bootstrap_results_spearman <- expand.grid( + eohi_var = eohi_vars, + cal_var = cal_vars, + stringsAsFactors = FALSE +) %>% + pmap_dfr(function(eohi_var, cal_var) { + result <- bootstrap_correlation(df, eohi_var, cal_var, method = "spearman", R = 1000) + result$eohi_var <- eohi_var + result$cal_var <- cal_var + result$method <- "spearman" + return(result) + }) %>% + mutate( + correlation = round(correlation, 5), + ci_lower = round(ci_lower, 5), + ci_upper = round(ci_upper, 5) + ) + +print(bootstrap_results_spearman) + +####==== SUMMARY TABLE ==== + +# Create comprehensive summary table +summary_table <- bootstrap_results_pearson %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper, n) %>% + rename(pearson_r = correlation, pearson_ci_lower = ci_lower, pearson_ci_upper = ci_upper) %>% + left_join( + bootstrap_results_spearman %>% + select(eohi_var, cal_var, correlation, ci_lower, ci_upper) %>% + rename(spearman_rho = correlation, spearman_ci_lower = ci_lower, spearman_ci_upper = ci_upper), + by = c("eohi_var", "cal_var") + ) %>% + # Add p-values + left_join( + expand.grid(eohi_var = eohi_vars, cal_var = cal_vars, stringsAsFactors = FALSE) %>% + pmap_dfr(function(eohi_var, cal_var) { + pearson_p <- p_matrix_pearson[eohi_var, cal_var] + spearman_p <- p_matrix_spearman[eohi_var, cal_var] + data.frame( + eohi_var = eohi_var, + cal_var = cal_var, + pearson_p = pearson_p, + spearman_p = spearman_p + ) + }), + by = c("eohi_var", "cal_var") + ) %>% + mutate( + pearson_p = round(pearson_p, 5), + spearman_p = round(spearman_p, 5) + ) + +cat("\n=== COMPREHENSIVE SUMMARY TABLE ===\n") +print(summary_table) + +# Save results to CSV +# write.csv(summary_table, "eohi_calibration_correlations_summary.csv", row.names = FALSE) +# cat("\nResults saved to: eohi_calibration_correlations_summary.csv\n") diff --git a/eohi1/correlations - scales.r b/eohi1/correlations - scales.r new file mode 100644 index 0000000..048bbb2 --- /dev/null +++ b/eohi1/correlations - scales.r @@ -0,0 +1,171 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("ehi1.csv") + +# Define the two sets of variables +set1_vars <- c("eohiDGEN_pref", "eohiDGEN_pers", "eohiDGEN_val", "eohiDGEN_life", "eohiDGEN_mean", + "ehi_pref_mean", "ehi_pers_mean", "ehi_val_mean", "ehi_life_mean", "ehi_global_mean") +set2_vars <- c("AOT_total", "CRT_correct", "CRT_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlation_exp1.csv", row.names = FALSE) \ No newline at end of file diff --git a/eohi1/dataP 02 - cor means average over time frames.r b/eohi1/dataP 02 - cor means average over time frames.r new file mode 100644 index 0000000..5a65108 --- /dev/null +++ b/eohi1/dataP 02 - cor means average over time frames.r @@ -0,0 +1,45 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load the data +exp1_data <- read.csv("exp1.csv") + +# Define all NPastDiff and NFutDiff variables +all_diff_vars <- c( + "NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", "NPastDiff_life_important", "NPastDiff_life_change", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice", + "NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", "NFutDiff_life_important", "NFutDiff_life_change" +) + +# Define DGEN variables to average +dgen_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +# Calculate domain_mean as average of all 40 variables +exp1_data$domain_mean <- rowMeans(exp1_data[, all_diff_vars], na.rm = TRUE) + +# Calculate DGEN_mean as average of all 8 DGEN variables +exp1_data$DGEN_mean <- rowMeans(exp1_data[, dgen_vars], na.rm = TRUE) + +# Save the updated data +write.csv(exp1_data, "exp1.csv", row.names = FALSE) + +# Display summary of the calculated means +cat("Domain mean summary (average of all 40 NPastDiff and NFutDiff variables):\n") +summary(exp1_data$domain_mean) + +cat("\nDGEN mean summary (average of all 8 DGEN variables):\n") +summary(exp1_data$DGEN_mean) + +# Show first few rows to verify calculations +cat("\nFirst 5 rows of calculated means:\n") +print(exp1_data[1:5, c("domain_mean", "DGEN_mean")]) + +# Show the individual DGEN values for first 5 rows to verify math +cat("\nFirst 5 rows of individual DGEN values for verification:\n") +print(exp1_data[1:5, dgen_vars]) diff --git a/eohi1/datap 03 - CORRECT domain specific EHI vars.r b/eohi1/datap 03 - CORRECT domain specific EHI vars.r new file mode 100644 index 0000000..8980819 --- /dev/null +++ b/eohi1/datap 03 - CORRECT domain specific EHI vars.r @@ -0,0 +1,104 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Create EHI difference variables (NPast - NFut) +# Preferences +ehi1$ehi_pref_read <- ehi1$NPastDiff_pref_read - ehi1$NFutDiff_pref_read +ehi1$ehi_pref_music <- ehi1$NPastDiff_pref_music - ehi1$NFutDiff_pref_music +ehi1$ehi_pref_tv <- ehi1$NPastDiff_pref_tv - ehi1$NFutDiff_pref_tv +ehi1$ehi_pref_nap <- ehi1$NPastDiff_pref_nap - ehi1$NFutDiff_pref_nap +ehi1$ehi_pref_travel <- ehi1$NPastDiff_pref_travel - ehi1$NFutDiff_pref_travel + +# Personality +ehi1$ehi_pers_extravert <- ehi1$NPastDiff_pers_extravert - ehi1$NFutDiff_pers_extravert +ehi1$ehi_pers_critical <- ehi1$NPastDiff_pers_critical - ehi1$NFutDiff_pers_critical +ehi1$ehi_pers_dependable <- ehi1$NPastDiff_pers_dependable - ehi1$NFutDiff_pers_dependable +ehi1$ehi_pers_anxious <- ehi1$NPastDiff_pers_anxious - ehi1$NFutDiff_pers_anxious +ehi1$ehi_pers_complex <- ehi1$NPastDiff_pers_complex - ehi1$NFutDiff_pers_complex + +# Values +ehi1$ehi_val_obey <- ehi1$NPastDiff_val_obey - ehi1$NFutDiff_val_obey +ehi1$ehi_val_trad <- ehi1$NPastDiff_val_trad - ehi1$NFutDiff_val_trad +ehi1$ehi_val_opinion <- ehi1$NPastDiff_val_opinion - ehi1$NFutDiff_val_opinion +ehi1$ehi_val_performance <- ehi1$NPastDiff_val_performance - ehi1$NFutDiff_val_performance +ehi1$ehi_val_justice <- ehi1$NPastDiff_val_justice - ehi1$NFutDiff_val_justice + +# Life satisfaction +ehi1$ehi_life_ideal <- ehi1$NPastDiff_life_ideal - ehi1$NFutDiff_life_ideal +ehi1$ehi_life_excellent <- ehi1$NPastDiff_life_excellent - ehi1$NFutDiff_life_excellent +ehi1$ehi_life_satisfied <- ehi1$NPastDiff_life_satisfied - ehi1$NFutDiff_life_satisfied +ehi1$ehi_life_important <- ehi1$NPastDiff_life_important - ehi1$NFutDiff_life_important +ehi1$ehi_life_change <- ehi1$NPastDiff_life_change - ehi1$NFutDiff_life_change + +# QA: Verify calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI difference calculations (NPast - NFut)\n\n") + +qa_pairs <- list( + list(npast = "NPastDiff_pref_read", nfut = "NFutDiff_pref_read", target = "ehi_pref_read"), + list(npast = "NPastDiff_pref_music", nfut = "NFutDiff_pref_music", target = "ehi_pref_music"), + list(npast = "NPastDiff_pref_tv", nfut = "NFutDiff_pref_tv", target = "ehi_pref_tv"), + list(npast = "NPastDiff_pref_nap", nfut = "NFutDiff_pref_nap", target = "ehi_pref_nap"), + list(npast = "NPastDiff_pref_travel", nfut = "NFutDiff_pref_travel", target = "ehi_pref_travel"), + list(npast = "NPastDiff_pers_extravert", nfut = "NFutDiff_pers_extravert", target = "ehi_pers_extravert"), + list(npast = "NPastDiff_pers_critical", nfut = "NFutDiff_pers_critical", target = "ehi_pers_critical"), + list(npast = "NPastDiff_pers_dependable", nfut = "NFutDiff_pers_dependable", target = "ehi_pers_dependable"), + list(npast = "NPastDiff_pers_anxious", nfut = "NFutDiff_pers_anxious", target = "ehi_pers_anxious"), + list(npast = "NPastDiff_pers_complex", nfut = "NFutDiff_pers_complex", target = "ehi_pers_complex"), + list(npast = "NPastDiff_val_obey", nfut = "NFutDiff_val_obey", target = "ehi_val_obey"), + list(npast = "NPastDiff_val_trad", nfut = "NFutDiff_val_trad", target = "ehi_val_trad"), + list(npast = "NPastDiff_val_opinion", nfut = "NFutDiff_val_opinion", target = "ehi_val_opinion"), + list(npast = "NPastDiff_val_performance", nfut = "NFutDiff_val_performance", target = "ehi_val_performance"), + list(npast = "NPastDiff_val_justice", nfut = "NFutDiff_val_justice", target = "ehi_val_justice"), + list(npast = "NPastDiff_life_ideal", nfut = "NFutDiff_life_ideal", target = "ehi_life_ideal"), + list(npast = "NPastDiff_life_excellent", nfut = "NFutDiff_life_excellent", target = "ehi_life_excellent"), + list(npast = "NPastDiff_life_satisfied", nfut = "NFutDiff_life_satisfied", target = "ehi_life_satisfied"), + list(npast = "NPastDiff_life_important", nfut = "NFutDiff_life_important", target = "ehi_life_important"), + list(npast = "NPastDiff_life_change", nfut = "NFutDiff_life_change", target = "ehi_life_change") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- ehi1[[pair$npast]] - ehi1[[pair$nfut]] + + # Get actual value in target variable + actual_value <- ehi1[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, ehi1[[pair$npast]][row_num], + pair$nfut, ehi1[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/eohi1/datap 04 - CORRECT ehi var means.r b/eohi1/datap 04 - CORRECT ehi var means.r new file mode 100644 index 0000000..bcce600 --- /dev/null +++ b/eohi1/datap 04 - CORRECT ehi var means.r @@ -0,0 +1,167 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Load data +ehi1 <- read.csv("ehi1.csv") + +# Calculate mean scores for EHI variables + +# 1. Preferences mean +ehi1$ehi_pref_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel")], na.rm = TRUE) + +# 2. Personality mean +ehi1$ehi_pers_mean <- rowMeans(ehi1[, c("ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex")], na.rm = TRUE) + +# 3. Values mean +ehi1$ehi_val_mean <- rowMeans(ehi1[, c("ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice")], na.rm = TRUE) + +# 4. Life satisfaction mean +ehi1$ehi_life_mean <- rowMeans(ehi1[, c("ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# 5. Global mean (all 20 variables) +ehi1$ehi_global_mean <- rowMeans(ehi1[, c("ehi_pref_read", "ehi_pref_music", + "ehi_pref_tv", "ehi_pref_nap", + "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", + "ehi_pers_dependable", "ehi_pers_anxious", + "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", + "ehi_val_opinion", "ehi_val_performance", + "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", + "ehi_life_satisfied", "ehi_life_important", + "ehi_life_change")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI mean calculations\n\n") + +cat("--- FIRST 5 ROWS: PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pref_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_pers_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: VALUES MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_val_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: LIFE SATISFACTION MEAN ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_life_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: GLOBAL MEAN (20 variables) ---\n") +for (i in 1:5) { + vals <- c(ehi1$ehi_pref_read[i], ehi1$ehi_pref_music[i], + ehi1$ehi_pref_tv[i], ehi1$ehi_pref_nap[i], + ehi1$ehi_pref_travel[i], + ehi1$ehi_pers_extravert[i], ehi1$ehi_pers_critical[i], + ehi1$ehi_pers_dependable[i], ehi1$ehi_pers_anxious[i], + ehi1$ehi_pers_complex[i], + ehi1$ehi_val_obey[i], ehi1$ehi_val_trad[i], + ehi1$ehi_val_opinion[i], ehi1$ehi_val_performance[i], + ehi1$ehi_val_justice[i], + ehi1$ehi_life_ideal[i], ehi1$ehi_life_excellent[i], + ehi1$ehi_life_satisfied[i], ehi1$ehi_life_important[i], + ehi1$ehi_life_change[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- ehi1$ehi_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: 20 values → Calculated: %.5f | Actual: %.5f %s\n", + i, calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel"), + target = "ehi_pref_mean", name = "Preferences"), + list(vars = c("ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex"), + target = "ehi_pers_mean", name = "Personality"), + list(vars = c("ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice"), + target = "ehi_val_mean", name = "Values"), + list(vars = c("ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_life_mean", name = "Life Satisfaction"), + list(vars = c("ehi_pref_read", "ehi_pref_music", "ehi_pref_tv", "ehi_pref_nap", "ehi_pref_travel", + "ehi_pers_extravert", "ehi_pers_critical", "ehi_pers_dependable", "ehi_pers_anxious", "ehi_pers_complex", + "ehi_val_obey", "ehi_val_trad", "ehi_val_opinion", "ehi_val_performance", "ehi_val_justice", + "ehi_life_ideal", "ehi_life_excellent", "ehi_life_satisfied", "ehi_life_important", "ehi_life_change"), + target = "ehi_global_mean", name = "Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(ehi1[, check$vars], na.rm = TRUE) + actual_mean <- ehi1[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(ehi1))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(ehi1, "ehi1.csv", row.names = FALSE) +cat("\nDataset saved to ehi1.csv\n") \ No newline at end of file diff --git a/eohi1/datap 15 - education recoded 3 ordinal levels.r b/eohi1/datap 15 - education recoded 3 ordinal levels.r new file mode 100644 index 0000000..7d647e3 --- /dev/null +++ b/eohi1/datap 15 - education recoded 3 ordinal levels.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +data <- read.csv("ehi1.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "ehi1.csv", row.names = FALSE) \ No newline at end of file diff --git a/eohi1/descriptive_statistics.csv b/eohi1/descriptive_statistics.csv new file mode 100644 index 0000000..d1c5084 --- /dev/null +++ b/eohi1/descriptive_statistics.csv @@ -0,0 +1,14 @@ +"","vars","n","mean","sd","median","trimmed","mad","min","max","range","skew","kurtosis","se" +"eohiDGEN_pref",1,1063,0.31138,2.29712,0,0.27497,1.4826,-10,10,20,0.16174,2.49869,0.07046 +"eohiDGEN_pers",2,1063,0.44309,2.40063,0,0.39365,1.4826,-10,10,20,0.04618,2.20622,0.07363 +"eohiDGEN_val",3,1063,0.49012,2.38159,0,0.3772,1.4826,-10,10,20,0.37348,2.6545,0.07305 +"eohiDGEN_life",4,1063,0.41016,2.72624,0,0.3866,1.4826,-10,10,20,0.06705,1.55144,0.08362 +"eohiDGEN_mean",5,1063,0.41488,1.7406,0,0.34323,0.99334,-9,9.33,18.33,0.43898,2.96172,0.05339 +"ehi_pref_mean",6,1063,0.13885,0.64266,0,0.09683,0.29652,-2.2,3.2,5.4,0.93756,3.43951,0.01971 +"ehi_pers_mean",7,1063,0.09614,0.71979,0,0.07027,0.59304,-3.6,3.8,7.4,0.53524,3.53968,0.02208 +"ehi_val_mean",8,1063,0.19699,0.72241,0,0.14266,0.29652,-3.4,4.4,7.8,1.17086,5.08196,0.02216 +"ehi_life_mean",9,1063,0.1127,1.12639,0,0.06792,0.59304,-4.8,6,10.8,0.45879,2.97822,0.03455 +"ehi_global_mean",10,1063,0.13617,0.50405,0.05,0.09871,0.37065,-1.65,2.65,4.3,1.09805,3.7645,0.01546 +"AOT_total",11,1063,0.6945,0.60845,0.75,0.69859,0.7413,-1.125,2,3.125,-0.09166,-0.61789,0.01866 +"CRT_correct",12,1063,0.3132,0.36479,0.33,0.26666,0.48926,0,1,1,0.79518,-0.77639,0.01119 +"CRT_int",13,1063,0.614,0.36086,0.67,0.6424,0.48926,0,1,1,-0.45012,-1.11195,0.01107 diff --git a/eohi1/descriptives - gen knowledge questions.r b/eohi1/descriptives - gen knowledge questions.r new file mode 100644 index 0000000..2932a3b --- /dev/null +++ b/eohi1/descriptives - gen knowledge questions.r @@ -0,0 +1,107 @@ +library(tidyverse) +library(ggplot2) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read data +data <- read.csv("exp1.csv") + +# Select variables ending exactly with _T or _F +df <- data %>% select(matches("(_T|_F)$")) + +# Remove demo_f variable (if present) +df <- df %>% select(-any_of("demo_f")) + +str(df) + +# Coerce to numeric where possible (without breaking non-numeric) +df_num <- df %>% + mutate(across(everything(), ~ suppressWarnings(as.numeric(.)))) + +# Compute count and proportion correct per variable +descriptives <- purrr::imap_dfr(df_num, function(col, name) { + x <- suppressWarnings(as.numeric(col)) + x <- x[!is.na(x)] + n_total <- length(x) + n_correct <- if (n_total == 0) NA_integer_ else sum(x == 1) + prop <- if (n_total == 0) NA_real_ else n_correct / n_total + + # Extract difficulty number from variable name and map to expected range + difficulty_num <- as.numeric(gsub(".*_([0-9]+)_[TF]$", "\\1", name)) + expected_ranges <- list( + "15" = c(0.15, 0.25), + "35" = c(0.35, 0.45), + "55" = c(0.55, 0.65), + "75" = c(0.75, 0.85) + ) + + if (as.character(difficulty_num) %in% names(expected_ranges)) { + expected_range <- expected_ranges[[as.character(difficulty_num)]] + match_difficulty <- if (prop >= expected_range[1] && prop <= expected_range[2]) "YES" else "NO" + } else { + match_difficulty <- "UNKNOWN" + } + + tibble( + variable = name, + n_total = n_total, + n_correct = n_correct, + prop_correct = round(prop, 5), + match_difficulty = match_difficulty + ) +}) %>% + arrange(variable) + +# Bin proportions into .10-.19, .20-.29, ..., .90-.99 and count variables per bin +bin_levels <- sapply(1:9, function(k) sprintf("%.2f-%.2f", k / 10, k / 10 + 0.09)) +bin_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.10, 1.00, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin_levels +) +bin_counts <- tibble(bin = factor(bin_factor, levels = bin_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# Additional bins: 0.15-0.24, 0.25-0.34, ..., 0.85-0.94 +bin15_levels <- sapply(seq(0.15, 0.85, by = 0.10), function(lo) sprintf("%.2f-%.2f", lo, lo + 0.09)) +bin15_factor <- cut( + descriptives$prop_correct, + breaks = seq(0.15, 0.95, by = 0.10), + right = FALSE, + include.lowest = FALSE, + labels = bin15_levels +) +bin15_counts <- tibble(bin = factor(bin15_factor, levels = bin15_levels)) %>% + group_by(bin) %>% + summarise(num_variables = n(), .groups = "drop") + +# View +print(descriptives, n = Inf) +cat("\nBin counts (.10-.19, .20-.29, ..., .90-.99):\n") +print(bin_counts, n = Inf) +cat("\nBin counts (0.15-0.24, 0.25-0.34, ..., 0.85-0.94):\n") +print(bin15_counts, n = Inf) + +# Histogram of proportion correct with custom bins +histogram <- ggplot(descriptives, aes(x = prop_correct)) + + geom_histogram( + breaks = seq(0.15, 0.95, by = 0.10), + fill = "lightblue", + color = "black", + alpha = 0.7 + ) + + labs( + title = "Distribution of Proportion Correct", + x = "Proportion Correct", + y = "Number of Variables" + ) + + theme_minimal() + + scale_x_continuous(breaks = seq(0.15, 0.95, by = 0.10)) + +print(histogram) + +# Optionally save +# readr::write_csv(descriptives, "exp1_TF_descriptives.csv") \ No newline at end of file diff --git a/eohi1/e1 - reliability ehi.r b/eohi1/e1 - reliability ehi.r new file mode 100644 index 0000000..adbc326 --- /dev/null +++ b/eohi1/e1 - reliability ehi.r @@ -0,0 +1,88 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +options(scipen = 999) + +df <- read.csv("ehi1.csv") +library(psych) +library(knitr) + +# fixed-decimal formatter (five decimals) +fmt5 <- function(x) formatC(x, format = "f", digits = 5) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("eohiDGEN_mean", "ehi_global_mean")]), + c("eohiDGEN_mean", "ehi_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Two-item reliability summary (if applicable) +two_item_section <- "" +if (ncol(reliability_data) == 2) { + n_complete <- sum(complete.cases(reliability_data)) + r_pearson <- cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "pearson") + r_spearman <- suppressWarnings(cor(reliability_data[, 1], reliability_data[, 2], use = "complete.obs", method = "spearman")) + # Fisher z CI for r + fisher_z <- atanh(r_pearson) + se_z <- 1 / sqrt(n_complete - 3) + z_crit <- qnorm(0.975) + ci_z_lower <- fisher_z - z_crit * se_z + ci_z_upper <- fisher_z + z_crit * se_z + ci_r_lower <- tanh(ci_z_lower) + ci_r_upper <- tanh(ci_z_upper) + # Approximate Fisher z CI for Spearman rho (large-sample approximation) + fisher_z_s <- atanh(r_spearman) + ci_zs_lower <- fisher_z_s - z_crit * se_z + ci_zs_upper <- fisher_z_s + z_crit * se_z + ci_s_lower <- tanh(ci_zs_lower) + ci_s_upper <- tanh(ci_zs_upper) + # Spearman–Brown/Cronbach's alpha for k = 2 + alpha_sb <- (2 * r_pearson) / (1 + r_pearson) + alpha_lower <- (2 * ci_r_lower) / (1 + ci_r_lower) + alpha_upper <- (2 * ci_r_upper) / (1 + ci_r_upper) + + two_item_section <- paste0( + "

Two-Item Reliability Summary

", + "

Pearson r: ", fmt5(r_pearson), " (95% CI: [", fmt5(ci_r_lower), ", ", fmt5(ci_r_upper), "])

", + "

Spearman r: ", fmt5(r_spearman), " (95% CI: [", fmt5(ci_s_lower), ", ", fmt5(ci_s_upper), "])

", + "

Spearman–Brown / Cronbach's ", intToUtf8(945), ": ", fmt5(alpha_sb), + " (95% CI: [", fmt5(alpha_lower), ", ", fmt5(alpha_upper), "])

" + ) +} + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + two_item_section, + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", fmt5(split_half$maxrb), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/eohi1/education_DGEN_means.png b/eohi1/education_DGEN_means.png new file mode 100644 index 0000000..b46d439 Binary files /dev/null and b/eohi1/education_DGEN_means.png differ diff --git a/eohi1/education_domain_means.png b/eohi1/education_domain_means.png new file mode 100644 index 0000000..1677cfe Binary files /dev/null and b/eohi1/education_domain_means.png differ diff --git a/eohi1/ehi1 - Copy.csv b/eohi1/ehi1 - Copy.csv new file mode 100644 index 0000000..250c08e --- /dev/null +++ b/eohi1/ehi1 - Copy.csv @@ -0,0 +1,1064 @@ +pID,ResponseId,taq_age,Citizenship,taq_sex,nowPref_read,nowPref_music,nowPref_tv,nowPref_nap,nowPref_travel,nowPers_extravert,nowPers_critical,nowPers_dependable,nowPers_anxious,nowPers_complex,nowVal_obey,nowVal_trad,nowVal_opinion,nowVal_performance,nowVal_justice,nowLife_ideal,nowLife_excellent,nowLife_satisfied,nowLife_important,nowLife_change,pastPref_read,pastPref_music,pastPref_tv,pastPref_nap,pastPref_travel,pastPref_DGEN,pastPers_extravert,pastPers_critical,pastPers_dependable,pastPers_anxious,pastPers_complex,pastPers_DGEN,pastVal_obey,pastVal_trad,pastVal_opinion,pastVal_performance,pastVal_justice,pastVal_DGEN,pastLife_ideal,pastLife_excellent,pastLife_satisfied,pastLife_important,pastLife_change,pastLife_DGEN,futPref_read,futPref_music,futPref_tv,futPref_nap,futPref_travel,futPref_DGEN,futPers_extravert,futPers_critical,futPers_dependable,futPers_anxious,futPers_complex,futPers_DGEN,futVal_obey,futVal_trad,futVal_opinion,futVal_performance,futVal_justice,futVal_DGEN,futLife_ideal,futLife_excellent,futLife_satisfied,futLife_important,futLife_change,futLife_DGEN,moza_55_F_1,moza_55_F,moza_55_CON,vaud_15_T_1,vaud_15_T,vaud_15_CON,croc_75_F_1,croc_75_F,croc_75_CON,demo_15_F_1,demo_15_F,demo_15_CON,oedi_35_T_1,oedi_35_T,oedi_35_CON,hume_35_F_1,hume_35_F,hume_35_CON,mons_55_T_1,mons_55_T,mons_55_CON,gest_75_T_1,gest_75_T,gest_75_CON,kabu_15_T_1,kabu_15_T,kabu_15_CON,sham_55_T_1,sham_55_T,sham_55_CON,gulf_15_F_1,gulf_15_F,gulf_15_CON,memo_75_F_1,memo_75_F,memo_75_CON,pana_35_T_1,pana_35_T,pana_35_CON,vitc_55_F_1,vitc_55_F,vitc_55_CON,bohr_15_T_1,bohr_15_T,bohr_15_CON,chur_75_T_1,chur_75_T,chur_75_CON,hert_35_F_1,hert_35_F,hert_35_CON,gees_55_F_1,gees_55_F,gees_55_CON,gang_15_F_1,gang_15_F,gang_15_CON,list_75_F_1,list_75_F,list_75_CON,carb_35_T_1,carb_35_T,carb_35_CON,cons_55_T_1,cons_55_T,cons_55_CON,mont_35_F_1,mont_35_F,mont_35_CON,papy_75_T_1,papy_75_T,papy_75_CON,dwar_55_F_1,dwar_55_F,dwar_55_CON,dors_55_T_1,dors_55_T,dors_55_CON,pucc_15_F_1,pucc_15_F,pucc_15_CON,spee_75_F_1,spee_75_F,spee_75_CON,lute_35_F_1,lute_35_F,lute_35_CON,tsun_75_T_1,tsun_75_T,tsun_75_CON,troy_15_T_1,troy_15_T,troy_15_CON,lock_35_T_1,lock_35_T,lock_35_CON,gest_T_ex,dors_T_ex,chur_T_ex,mons_T_ex,lock_T_easy,hume_F_easy,papy_T_easy,sham_T_easy,list_F_easy,cons_T_easy,tsun_T_easy,pana_T_easy,kabu_T_easy,gulf_F_easy,oedi_T_easy,vaud_T_easy,mont_F_easy,demo_F_easy,spee_F_hard,dwar_F_hard,carb_T_hard,bohr_T_hard,gang_F_hard,vitc_F_hard,hert_F_hard,pucc_F_hard,troy_T_hard,moza_F_hard,croc_F_hard,gees_F_hard,lute_F_hard,memo_F_hard,bs_28,bs_easy,bs_hard,COC_self_count,COC_self_acc,COC_actual_count,COC_actual_acc,COC_15count,COC_acc15,COC_35count,COC_acc35,COC_55count,COC_acc55,COC_75count,COC_acc75,COC_Tcount,COC_accT,COC_Fcount,COC_accF,COC_con_all,COC_con15,COC_con35,COC_con55,COC_con75,COC_conT,COC_conF,cal_selfActual,cal_global,cal_15,cal_35,cal_55,cal_75,cal_true,cal_false,NPastDiff_pref_read,NPastDiff_pref_music,NPastDiff_pref_tv,NPastDiff_pref_nap,NPastDiff_pref_travel,NPastDiff_pers_extravert,NPastDiff_pers_critical,NPastDiff_pers_dependable,NPastDiff_pers_anxious,NPastDiff_pers_complex,NPastDiff_val_obey,NPastDiff_val_trad,NPastDiff_val_opinion,NPastDiff_val_performance,NPastDiff_val_justice,NPastDiff_life_ideal,NPastDiff_life_excellent,NPastDiff_life_satisfied,NPastDiff_life_important,NPastDiff_life_change,NFutDiff_pref_read,NFutDiff_pref_music,NFutDiff_pref_tv,NFutDiff_pref_nap,NFutDiff_pref_travel,NFutDiff_pers_extravert,NFutDiff_pers_critical,NFutDiff_pers_dependable,NFutDiff_pers_anxious,NFutDiff_pers_complex,NFutDiff_val_obey,NFutDiff_val_trad,NFutDiff_val_opinion,NFutDiff_val_performance,NFutDiff_val_justice,NFutDiff_life_ideal,NFutDiff_life_excellent,NFutDiff_life_satisfied,NFutDiff_life_important,NFutDiff_life_change,NPast_mean_pref,NPast_mean_pers,NPast_mean_val,NPast_mean_life,NFut_mean_pref,NFut_mean_pers,NFut_mean_val,NFut_mean_life,NPast_mean_total,NFut_mean_total,DGEN_past_mean,DGEN_fut_mean,eohiDGEN_pref,eohiDGEN_pers,eohiDGEN_val,eohiDGEN_life,eohiDGEN_mean,CRT01,CRT02,CRT03,demo_sex,demo_edu,demo_age_1,AOT_total,CRT1_correct,CRT2_correct,CRT3_correct,CRT1_int,CRT2_int,CRT3_int,CRT_correct,CRT_int,GROUP,TASK_DO,TEMPORAL_DO,ITEM_DO,COC_DO,ehi_pref_read,ehi_pref_music,ehi_pref_tv,ehi_pref_nap,ehi_pref_travel,ehi_pers_extravert,ehi_pers_critical,ehi_pers_dependable,ehi_pers_anxious,ehi_pers_complex,ehi_val_obey,ehi_val_trad,ehi_val_opinion,ehi_val_performance,ehi_val_justice,ehi_life_ideal,ehi_life_excellent,ehi_life_satisfied,ehi_life_important,ehi_life_change,ehi_pref_mean,ehi_pers_mean,ehi_val_mean,ehi_life_mean,ehi_global_mean +1,R_7UW3QVlPbJl2GBF,18 - 24,Canadian,Female,-2,2,-2,-2,-3,-3,-2,0,3,1,0,0,0,-1,1,0,0,-2,-2,-2,-2,3,-2,-2,-3,1,-3,1,0,3,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,3,0,0,-2,2,-1,-2,0,1,0,2,0,1,1,1,2,1,0,0,0,0,0,2,TRUE,0,100,FALSE,0,53,FALSE,1,100,FALSE,1,55,FALSE,0,55,FALSE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,54,TRUE,1,100,FALSE,1,58,FALSE,1,61,TRUE,1,58,TRUE,0,95,TRUE,1,65,TRUE,1,55,FALSE,1,52,TRUE,0,100,FALSE,1,63,TRUE,0,62,FALSE,0,100,TRUE,1,59,TRUE,0,55,TRUE,1,100,TRUE,0,100,TRUE,1,86,TRUE,0,61,TRUE,0,75,FALSE,1,53,TRUE,1,80,FALSE,0,51,TRUE,1,64,0.0081,0.0196,0.2025,0,0.1296,0,0,0,0.3844,0.1681,0.04,0.1764,0.2916,0.1764,0.3025,0.2809,0.3025,0.2025,0.5625,1,1,0.1225,0.1369,0.9025,0.2304,0.3721,0.2601,1,0,1,0.2209,0.1521,0.336246429,0.17535,0.497142857,7,21.88,19,59.38,4,50,5,62.5,4,50,6,75,11,68.75,8,50,73.78,57.5,67.12,92.5,78,73.19,74.38,-37.5,14.4,7.5,4.62,42.5,3,4.44,24.38,0,1,0,0,0,0,3,0,0,1,0,0,0,1,0,0,0,2,2,2,2,1,2,2,1,2,0,0,2,1,0,1,1,2,1,0,0,2,2,2,0.2,0.8,0.2,1.2,1.6,1,1,1.2,0.6,1.2,1,1.67,-1,-1,0,-1,-0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,-2,0,-2,-2,-1,-2,3,0,-2,0,0,-1,-1,-1,-1,0,0,0,0,0,-1.4,-0.2,-0.8,0,-0.6 +2,R_5mra6gsZxI5JgBU,53 - 59,Canadian,Female,3,3,-1,-2,-1,0,-2,3,1,0,3,1,3,0,3,1,1,2,2,2,2,3,-2,-3,-1,8,1,-2,2,1,0,7,3,2,3,2,3,3,1,2,2,2,0,8,2,3,2,0,-3,7,0,0,0,0,0,2,0,0,0,0,0,8,0,0,0,0,0,7,FALSE,1,50,TRUE,1,85,TRUE,0,85,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,93,TRUE,1,97,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,0,50,FALSE,0,88,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,74,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0009,0,0.7744,0.0049,0,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.0225,0.25,0.25,0.5476,0.25,1,0.25,0.25,1,0.25,0.25,0.25,0.25,0.7225,1,0.25,1,0.349735714,0.180178571,0.519292857,16,50,17,53.13,4,50,5,62.5,5,62.5,3,37.5,9,56.25,8,50,69.44,54.38,62.5,80.38,80.5,75.81,63.06,-3.13,16.31,4.38,0,17.88,43,19.56,13.06,1,0,1,1,0,1,0,1,0,0,0,1,0,2,0,0,1,0,0,2,1,0,3,2,2,0,2,3,1,0,3,1,3,0,3,1,1,2,2,2,0.6,0.4,0.6,0.6,1.6,1.2,2,1.6,0.55,1.6,6,5.67,1,5,-5,1,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),58,1.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,-2,-1,-2,1,-2,-2,-1,0,-3,0,-3,2,-3,-1,0,-2,-2,0,-1,-0.8,-1.4,-1,-1.05 +3,R_7GwZPZK1uNHwyRZ,53 - 59,Canadian,Male,-1,2,0,1,3,-3,1,1,1,-1,1,3,2,1,2,1,-1,1,1,1,-1,3,0,2,3,7,1,1,1,0,0,7,2,1,2,1,3,7,1,2,1,2,2,7,-1,3,0,1,3,6,1,2,0,1,0,8,1,2,2,1,1,7,1,2,2,1,0,7,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,62,TRUE,1,100,TRUE,1,100,FALSE,1,78,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0.0625,0,0,1,0,0,0,0,0,1,0,1,0,0,0.1444,0.0484,0,0,0,1,1,0,1,0.259117857,0.147321429,0.370914286,29,90.63,25,78.13,7,87.5,7,87.5,7,87.5,4,50,14,87.5,11,68.75,97.34,100,97.25,92.12,100,98.44,96.25,12.5,19.21,12.5,9.75,4.62,50,10.94,27.5,0,1,0,1,0,4,0,0,1,1,1,2,0,0,1,0,3,0,1,1,0,1,0,0,0,4,1,1,0,1,0,1,0,0,1,0,3,1,0,1,0.4,1.2,0.8,1,0.2,1.4,0.4,1,0.85,0.75,7,7,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,58,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,0,0,-1,-1,1,0,1,1,0,0,0,0,0,-1,1,0,0.2,-0.2,0.4,0,0.1 +4,R_1nMWQYBUmr27PZ5,67 - 73,American,Female,-3,2,3,2,3,-3,-3,3,-3,0,3,3,3,-3,3,2,-2,1,2,-2,-3,3,3,3,3,0,-3,-3,3,-3,0,0,3,3,3,-3,0,0,2,1,3,3,-3,1,0,0,0,0,0,5,0,0,0,0,0,5,3,0,0,-3,0,4,0,0,2,2,-3,4,TRUE,0,54,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,53,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,60,TRUE,1,52,TRUE,0,51,FALSE,1,93,TRUE,0,93,TRUE,1,97,TRUE,1,73,TRUE,1,100,0,0.2304,0,0,0,0,0.0576,0,0,0,0.0009,0,0.2209,0,0.25,0,0,0.25,0.0049,0.36,1,0.25,0,1,0,0.2601,0.0729,0.2916,0,0,0.8649,1,0.210135714,0.055671429,0.3646,28,87.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,86,72.12,92.88,83.25,95.75,84.44,87.56,15.62,14.12,-2.88,30.38,20.75,8.25,3.19,25.06,0,1,0,1,0,0,0,0,0,0,0,0,0,0,3,0,3,2,1,1,3,2,3,2,3,3,3,3,3,0,0,3,3,0,3,2,2,1,0,1,0.4,0,0.6,1.4,2.6,2.4,1.8,1.2,0.6,2,0,4.67,-5,-5,-4,-3,-4.67,10 cents,5 minutes,47 days,Female,High School (or equivalent),71,0.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,-3,-1,-3,-1,-3,-3,-3,-3,-3,0,0,-3,-3,0,0,-2,1,1,1,0,-2.2,-2.4,-1.2,0.2,-1.4 +5,R_61dWTD6v8MMe6Hl,67 - 73,American,Female,3,3,3,2,3,3,3,3,3,3,1,2,3,-3,2,-3,-3,-3,-3,-3,3,3,3,2,3,0,3,0,3,3,3,1,1,3,3,-3,2,1,-1,-3,-3,-1,-3,9,3,3,3,2,2,1,3,0,3,0,3,4,1,3,3,-2,2,2,-2,-2,-2,-2,-2,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,87,TRUE,1,87,TRUE,0,89,TRUE,1,88,TRUE,1,88,TRUE,1,85,TRUE,1,100,FALSE,1,97,TRUE,0,94,TRUE,1,95,TRUE,0,100,TRUE,1,82,TRUE,1,100,FALSE,1,91,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,90,FALSE,0,84,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0144,0,0,0.0144,0,0.7921,0,0,0,0.7056,0,0.0025,0.0225,0.0009,0.0169,0,0,0.0169,0,0,0.81,0.0324,0,1,0.0081,0.5625,1,1,1,1,1,0.8836,0.351928571,0.111242857,0.592614286,22,68.75,21,65.63,6,75,5,62.5,4,50,6,75,13,81.25,8,50,94.75,90.75,94,96.5,97.75,93.69,95.81,3.12,29.12,15.75,31.5,46.5,22.75,12.44,45.81,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,2,0,0,2,0,0,0,0,0,1,0,3,0,3,0,0,1,0,1,0,1,1,1,1,1,0,0.6,0.2,0.8,0.2,1.2,0.4,1,0.4,0.7,0.67,2.33,-1,-3,-1,8,-1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),71,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,0,-3,0,0,0,0,-1,0,1,-1,-1,1,-1,-0.2,-0.6,-0.2,-0.2,-0.3 +6,R_6DndYBp6h4JJNOQ,53 - 59,Canadian,Female,3,2,3,-3,1,2,-2,3,0,1,2,-2,3,0,2,0,1,1,1,-2,3,2,3,-3,2,0,2,-2,3,0,1,1,3,-3,2,0,2,1,1,1,2,2,-2,3,3,2,3,1,1,4,2,1,2,0,1,4,2,-1,2,-1,2,1,1,1,1,2,0,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,1,96,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,59,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,96,FALSE,1,95,TRUE,0,81,TRUE,1,95,FALSE,0,76,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.1681,0.0025,0.0016,0.5776,0.0361,0.16,0,1,0.36,0.0025,1,0.25,0.25,0.25,1,0,0.0016,0.5776,1,1,0,0.6561,1,0.331917857,0.164707143,0.499128571,28,87.5,20,62.5,4,50,5,62.5,5,62.5,6,75,12,75,8,50,88.28,73.62,85.88,94.88,98.75,85.12,91.44,25,25.78,23.62,23.38,32.38,23.75,10.12,41.44,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,4,0,0,3,1,0,0,0,1,1,1,0,1,0,0,1,2,0.2,0,0.6,0.6,0.8,0.8,0.6,0.8,0.35,0.75,0.67,3,-4,-3,0,-1,-2.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,58,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,-4,1,0,-3,-1,0,0,1,0,0,-1,0,0,0,1,0,-2,-0.6,-0.8,0,-0.2,-0.4 +7,R_1PDDLmZmpxdk7BL,39 - 45,Canadian,Female,-1,1,1,1,1,0,-1,1,-1,1,1,0,0,0,0,-1,-1,-1,-1,-1,0,1,1,1,1,7,-1,-1,1,-1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,-1,-1,-1,1,-1,7,1,1,1,1,1,8,1,1,1,1,1,7,TRUE,0,94,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,66,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1156,0.25,0.25,0.25,0.25,0.25,0.5476,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.8836,0.25,0.25,0.25,1,0.332028571,0.2404,0.423657143,5,15.63,16,50,5,62.5,6,75,3,37.5,2,25,5,31.25,11,68.75,55.75,52,56.25,55.5,59.25,54.12,57.38,-34.37,5.75,-10.5,-18.75,18,34.25,22.87,-11.37,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,0,0,0,0,1,0,2,2,2,0,1,1,1,1,2,2,2,2,2,0.2,0.2,0.8,2,0.4,1.4,0.8,2,0.8,1.15,7,7.33,0,0,-1,0,-0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,45,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,0,0,0,0,0,0,-2,-2,-2,0,0,0,0,0,0,0,0,0,0,-0.2,-1.2,0,0,-0.35 +8,R_7ymc6kKk1g2zyfc,53 - 59,Canadian,Female,3,3,3,-2,2,-1,1,3,2,2,1,-2,1,0,3,-2,-1,-2,1,-2,3,3,2,2,3,4,0,1,3,1,2,4,1,-1,2,1,3,4,1,-1,0,2,0,5,3,3,3,0,1,4,-1,1,3,1,2,4,1,-2,2,0,3,3,-1,0,0,-1,-1,5,FALSE,1,100,TRUE,1,72,FALSE,1,92,FALSE,1,70,TRUE,1,89,FALSE,1,100,TRUE,1,95,TRUE,1,96,TRUE,1,100,TRUE,1,100,FALSE,1,59,TRUE,0,91,TRUE,1,76,FALSE,1,100,FALSE,0,58,TRUE,1,100,FALSE,1,59,TRUE,0,90,TRUE,0,83,FALSE,1,100,FALSE,0,83,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,77,FALSE,1,96,FALSE,1,100,TRUE,0,99,TRUE,1,87,FALSE,0,97,TRUE,1,100,0.0016,0.0529,0,0.0025,0,0,0,0,0,0,0.0169,0.0576,0,0.1681,0.0121,0.0784,0,0.09,0,0.01,0.6889,0.3364,0.6889,0,0.1681,0.0016,0.9409,0,0.0064,0.81,0.9801,0.8281,0.210089286,0.030221429,0.389957143,25,78.13,25,78.13,5,62.5,6,75,7,87.5,7,87.5,13,81.25,12,75,89.34,79.38,88.25,94,95.75,89.38,89.31,0,11.21,16.88,13.25,6.5,8.25,8.13,14.31,0,0,1,4,1,1,0,0,1,0,0,1,1,1,0,3,0,2,1,2,0,0,0,2,1,0,0,0,1,0,0,0,1,0,0,1,1,2,2,1,1.2,0.4,0.6,1.6,0.6,0.2,0.2,1.4,0.95,0.6,4,3.67,0,0,1,0,0.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,53,1.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,1,2,0,1,0,0,0,0,0,1,0,1,0,2,-1,0,-1,1,0.6,0.2,0.4,0.2,0.35 +9,R_7P6m5sDPPv0UQuJ,39 - 45,Canadian,Male,2,3,2,0,1,1,-3,2,-3,2,1,1,1,1,1,1,1,1,1,1,2,3,3,0,2,7,1,-3,2,-3,2,2,2,2,2,2,2,2,0,0,0,-2,-2,7,1,2,2,0,1,7,1,-3,2,-2,2,2,2,-1,-1,-1,-1,3,1,0,1,3,0,2,TRUE,0,95,FALSE,0,88,FALSE,1,58,FALSE,1,50,FALSE,0,50,TRUE,0,70,TRUE,1,81,FALSE,0,50,FALSE,0,50,TRUE,1,85,FALSE,1,50,FALSE,1,66,TRUE,1,78,TRUE,0,88,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,0,75,TRUE,0,59,FALSE,1,100,TRUE,1,100,FALSE,0,50,TRUE,0,50,FALSE,0,55,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,0,70,TRUE,0,75,TRUE,1,85,FALSE,0,61,TRUE,1,100,0.25,0.25,0.0025,0.0361,0,0.49,0.3025,0.0225,0,0.25,0.0225,0.0484,0.25,0.25,0.25,0.7744,0.25,0.25,0.49,1,0,0.25,0.3481,0.7744,0.25,0.25,0.3721,0.9025,0.1764,0.5625,0.5625,0.1156,0.329085714,0.225735714,0.432435714,16,50,13,40.63,3,37.5,3,37.5,2,25,5,62.5,7,43.75,6,37.5,69.81,57.25,71.62,78,72.38,70.5,69.12,9.37,29.18,19.75,34.12,53,9.88,26.75,31.62,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,3,3,1,1,0,0,0,0,0,0,1,0,1,2,2,2,2,0,1,0,2,1,0.4,0,1,1.8,0.4,0.2,1.8,0.8,0.8,0.8,3.67,4,0,0,-1,5,-0.33,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,40,1.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,-1,-1,1,0,1,0,0,0,-1,0,0,-1,-1,-1,-1,1,0,1,1,2,0,-0.2,-0.8,1,0 +10,R_5F5l8L8SX8iBoiH,60 - 66,Canadian,Female,3,2,3,0,2,1,-1,2,-3,0,0,0,1,0,1,2,2,2,3,-1,3,3,1,-2,3,7,1,0,2,-3,0,2,2,2,2,2,1,8,1,2,1,3,-1,7,3,1,2,1,-1,5,1,-1,2,-3,-1,2,1,1,2,-1,2,1,2,2,2,3,2,1,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,0,50,TRUE,1,93,FALSE,1,92,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,75,TRUE,0,71,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,TRUE,0,90,TRUE,0,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0064,0,0,0.5041,0,0,0,0.25,0.09,0.0049,0.04,0,0.25,0.81,0,0.09,0.25,0.0625,1,0.2916,0.5041,0,0,0,1,0.81,1,0.2487,0.081814286,0.415585714,27,84.38,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,87.69,68.25,87.38,100,95.12,90.19,85.19,12.5,15.81,-6.75,12.38,25,32.62,-9.81,41.44,0,1,2,2,1,0,1,0,0,0,2,2,1,2,0,1,0,1,0,0,0,1,1,1,3,0,0,0,0,1,1,1,1,1,1,0,0,0,0,3,1.2,0.2,1.4,0.4,1.2,0.2,1,0.6,0.8,0.75,5.67,2.67,2,0,7,6,3,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,1.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,1,1,-2,0,1,0,0,-1,1,1,0,1,-1,1,0,1,0,-3,0,0,0.4,-0.2,0.05 +11,R_3PvzFllH1poEz69,67 - 73,Canadian,Male,2,2,2,0,2,1,0,2,0,1,3,1,3,0,2,1,2,2,2,-1,2,2,2,0,2,6,0,0,0,0,0,6,3,1,3,0,2,6,2,2,2,2,-1,6,2,2,2,0,1,6,2,0,2,0,2,6,2,2,3,0,2,6,2,2,2,2,-1,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,0,0,0,0,0,0.25,0.25,0,0,0.25,0,0.25,0,0.25,1,1,0.25,1,0,0,1,1,1,1,0.3125,0.071428571,0.553571429,24,75,21,65.63,4,50,5,62.5,6,75,6,75,16,100,5,31.25,89.06,81.25,81.25,93.75,100,93.75,84.38,9.37,23.43,31.25,18.75,18.75,25,-6.25,53.13,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0.8,0,0.2,0.2,0.4,0.4,0.2,0.25,0.3,6,6,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,67,1.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,2,0,0,-1,-1,0,0,0,0,0,0,0,0,-0.2,0.4,-0.4,0,-0.05 +12,R_5L4NB0Flxbu1zDL,46 - 52,Canadian,Male,2,2,2,2,2,1,1,1,-2,1,2,-2,2,-2,2,-2,-2,-2,-2,2,2,2,2,2,2,5,2,2,2,-2,2,5,2,2,2,2,2,5,-2,-2,-2,-2,-2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,86,TRUE,1,89,FALSE,1,90,FALSE,1,88,TRUE,1,80,TRUE,0,79,TRUE,1,77,TRUE,1,84,TRUE,1,83,TRUE,1,79,FALSE,1,79,TRUE,0,92,TRUE,1,77,FALSE,1,75,TRUE,1,77,TRUE,1,95,TRUE,0,73,FALSE,1,68,TRUE,0,74,TRUE,0,69,TRUE,1,74,TRUE,1,76,FALSE,1,66,FALSE,0,79,FALSE,1,83,TRUE,1,81,FALSE,1,61,FALSE,1,62,FALSE,1,67,TRUE,1,71,FALSE,0,68,TRUE,1,89,0.0256,0.0361,0.0025,0.0529,0.0121,0.6241,0.6241,0.0441,0.4761,0.0576,0.0841,0.0529,0.0289,0.0441,0.04,0.0121,0.1156,0.0144,0.1444,0.0289,0.0676,0.0529,0.5476,0.0625,0.5329,0.1521,0.4624,0.7396,0.01,0.1024,0.1089,0.8464,0.217457143,0.1593,0.275614286,12,37.5,24,75,6,75,6,75,7,87.5,5,62.5,14,87.5,10,62.5,77.84,77.38,75.62,78.12,80.25,79.94,75.75,-37.5,2.84,2.38,0.62,-9.38,17.75,-7.56,13.25,0,0,0,0,0,1,1,1,0,1,0,4,0,4,0,0,0,0,0,4,2,2,2,2,2,1,1,1,2,1,2,2,2,2,2,2,2,2,2,2,0,0.8,1.6,0.8,2,1.2,2,2,0.8,1.8,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),46,0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,-2,-2,-2,-2,-2,0,0,0,-2,0,-2,2,-2,2,-2,-2,-2,-2,-2,2,-2,-0.4,-0.4,-1.2,-1 +13,R_5DNhjyQhmJfztEG,53 - 59,Canadian,Female,3,3,3,2,-2,-1,-3,1,0,-1,3,0,2,-2,3,1,1,2,1,1,3,3,3,3,-2,5,1,-3,2,-1,-1,3,3,2,2,0,3,2,2,2,2,1,1,8,3,3,3,3,-3,5,0,-3,0,-3,-3,3,3,2,2,-2,2,5,0,1,1,0,1,5,TRUE,0,100,TRUE,1,80,TRUE,0,68,FALSE,1,64,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,0,89,FALSE,0,66,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,61,FALSE,0,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,73,FALSE,1,74,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,1,0,0.4356,0,0.5329,0,0,0.7921,1,0,0.04,0.0676,0.1296,0.25,1,0,0.4225,0,0.1521,1,1,0.25,1,0.4624,1,1,1,0.447671429,0.285557143,0.609785714,17,53.13,17,53.13,3,37.5,5,62.5,3,37.5,6,75,11,68.75,6,37.5,88.75,81,96.75,87.5,89.75,88.94,88.56,0,35.62,43.5,34.25,50,14.75,20.19,51.06,0,0,0,1,0,2,0,1,1,0,0,2,0,2,0,1,1,0,0,0,0,0,0,1,1,1,0,1,3,2,0,2,0,0,1,1,0,1,1,0,0.2,0.8,0.8,0.4,0.4,1.4,0.6,0.6,0.55,0.75,3.33,4.33,0,0,-3,3,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,59,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,-1,1,0,0,-2,-2,0,0,0,2,-1,0,1,-1,-1,0,-0.2,-0.6,0.2,-0.2,-0.2 +14,R_1E0YgrofVrYuFKH,60 - 66,American,Female,3,2,2,2,2,-2,0,2,0,0,1,-1,2,0,2,-1,0,0,1,-1,3,2,2,0,1,4,-1,-1,1,-1,-1,7,1,-1,2,1,2,2,-1,0,0,1,-1,6,3,2,1,2,1,3,-2,-1,2,-1,0,2,1,-1,2,-1,2,2,0,0,0,0,-1,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,86,FALSE,1,96,TRUE,1,95,TRUE,0,97,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,72,FALSE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,92,FALSE,1,97,TRUE,0,80,TRUE,1,92,FALSE,0,74,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0064,0.0025,0,0.0196,0,0,0,0.2304,0.0009,0,0.0081,0.0625,0.5184,0.9409,0,0.8464,0.5476,0,0,1,0.64,0.0016,0.172332143,0.018492857,0.326171429,29,90.63,26,81.25,5,62.5,7,87.5,6,75,8,100,15,93.75,11,68.75,93.72,81.38,95.75,99.62,98.12,95.44,92,9.38,12.47,18.88,8.25,24.62,-1.88,1.69,23.25,0,0,0,2,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0.6,1,0.2,0,0.4,0.4,0.2,0.4,0.45,0.35,4.33,2.33,1,5,0,3,2,5 cents,5 minutes,24 days,Female,University - Undergraduate,62,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,-1,2,0,1,0,1,0,1,0,0,0,0,0,-1,0,0,-1,0,0.2,0.6,0,-0.4,0.1 +15,R_5RduTzrkolBe5dB,60 - 66,Canadian,Female,-1,1,2,-1,-1,-1,-1,1,0,0,1,1,1,0,1,-1,0,0,1,-1,0,1,1,-1,1,6,-1,0,1,-1,0,6,0,1,-1,0,0,6,1,1,1,1,1,6,0,0,1,-1,-1,5,-1,0,1,0,-1,5,0,1,1,1,0,5,-1,-1,0,0,0,5,TRUE,0,64,FALSE,0,62,FALSE,1,81,FALSE,1,78,TRUE,1,71,FALSE,1,82,TRUE,1,90,TRUE,1,78,FALSE,0,80,TRUE,1,79,FALSE,1,80,TRUE,0,80,TRUE,1,81,TRUE,0,90,FALSE,0,100,TRUE,1,89,TRUE,0,99,TRUE,0,88,TRUE,0,97,FALSE,1,86,FALSE,0,81,TRUE,1,90,FALSE,1,88,TRUE,1,93,FALSE,1,99,TRUE,1,100,FALSE,1,98,TRUE,0,87,FALSE,1,100,TRUE,1,100,FALSE,0,84,TRUE,1,93,0.0484,0,0.0121,0.01,0.0049,0.0324,0.0049,0.0441,0.0196,0.01,0,0.0361,0.64,0.04,0.0841,0.3844,0.0144,0.0484,0.7569,0.0001,0.6561,1,0.9409,0.81,0.9801,0.0004,0.7056,0.4096,0.0361,0.7744,0,0.64,0.324053571,0.097378571,0.550728571,19,59.38,20,62.5,3,37.5,6,75,5,62.5,6,75,11,68.75,9,56.25,86.5,84.88,86.88,87.5,86.75,85.69,87.31,-3.12,24,47.38,11.88,25,11.75,16.94,31.06,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,2,1,1,0,2,1,1,1,0,0,0,1,0,0,1,1,0,0,1,1,0,1,0,1,1,0.8,0.4,0.8,1.2,0.6,0.4,0.6,0.6,0.8,0.55,6,5,1,1,1,1,1,10 cents,100 minutes,36 days,Female,High School (or equivalent),62,-0.25,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,-1,0,0,2,0,0,0,1,-1,0,0,2,-1,0,2,0,1,-1,1,0.2,0,0.2,0.6,0.25 +16,R_7LW9FcFtqnMtwZj,67 - 73,Canadian,Male,3,2,2,0,0,1,-1,2,-1,0,3,1,1,0,1,0,1,1,1,-1,3,2,2,0,0,2,2,-1,2,-1,0,4,2,2,0,2,0,3,0,1,1,0,0,3,3,2,3,2,-2,7,1,0,0,0,-1,3,2,-2,0,-2,-2,5,0,0,1,1,0,7,TRUE,0,75,TRUE,1,60,TRUE,0,60,FALSE,1,50,TRUE,1,51,FALSE,1,100,TRUE,1,65,TRUE,1,90,TRUE,1,78,TRUE,1,64,FALSE,1,56,FALSE,1,53,TRUE,1,55,FALSE,1,100,TRUE,1,50,TRUE,1,61,FALSE,1,77,TRUE,0,98,TRUE,0,50,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,73,FALSE,1,83,FALSE,1,100,FALSE,1,53,TRUE,1,94,FALSE,0,50,TRUE,1,75,0.01,0.0729,0.1521,0.1225,0.0625,0,0.25,0.1296,0,0,0.0036,0.2025,0.0484,0.1936,0.2401,0.16,0,0.25,0,0.25,0.1225,0.25,0.25,0,0.0529,0.0289,0.25,0.5625,0.36,0.9604,0.2209,0.2209,0.181046429,0.110021429,0.252071429,23,71.88,26,81.25,6,75,8,100,6,75,6,75,14,87.5,12,75,71.44,59.62,72,78.12,76,67.56,75.31,-9.37,-9.81,-15.38,-28,3.12,1,-19.94,0.31,0,0,0,0,0,1,0,0,0,0,1,1,1,2,1,0,0,0,1,1,0,0,1,2,2,0,1,2,1,1,1,3,1,2,3,0,1,0,0,1,0,0.2,1.2,0.4,1,1,2,0.4,0.45,1.1,3,5,-5,1,-2,-4,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,68,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,-1,-2,-2,1,-1,-2,-1,-1,0,-2,0,0,-2,0,-1,0,1,0,-1,-0.8,-0.8,0,-0.65 +17,R_11ZL15wRsIhme41,67 - 73,American,Female,3,2,3,3,3,1,-2,2,1,1,3,1,1,-1,2,1,1,1,-1,-3,3,3,3,3,3,7,-2,1,3,2,1,8,3,3,1,-2,3,6,-3,-3,-3,-3,-3,9,2,2,2,2,2,7,-1,-2,1,-1,0,5,3,3,-1,-3,3,3,-1,-2,1,-2,-3,6,TRUE,0,78,TRUE,1,83,FALSE,1,86,FALSE,1,52,TRUE,1,54,FALSE,1,53,TRUE,1,77,TRUE,1,74,FALSE,0,56,TRUE,1,78,FALSE,1,78,TRUE,0,81,TRUE,1,77,TRUE,0,100,FALSE,0,53,TRUE,1,100,FALSE,1,53,TRUE,0,69,FALSE,1,61,FALSE,1,100,TRUE,1,79,TRUE,1,76,FALSE,1,92,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,91,FALSE,1,58,TRUE,1,100,TRUE,1,85,TRUE,1,100,0.0676,0,0,0.0529,0,0.2209,0.0625,0.0484,0,0.0576,0,0.0529,0.3136,0.0484,0.2116,0.0289,0.0064,0.2304,0.0081,0,0.0441,0.2809,0.1521,1,0.2209,1,0.0225,0.6084,0.0196,0.4761,0.1764,0.6561,0.212385714,0.091542857,0.333228571,19,59.38,25,78.13,5,62.5,8,100,5,62.5,7,87.5,14,87.5,11,68.75,78.72,71,70.75,84.75,88.38,79.19,78.25,-18.75,0.59,8.5,-29.25,22.25,0.88,-8.31,9.5,0,1,0,0,0,3,3,1,1,0,0,2,0,1,1,4,4,4,2,0,1,0,1,1,1,2,0,1,2,1,0,2,2,2,1,2,3,0,1,0,0.2,1.6,0.8,2.8,0.8,1.2,1.4,1.2,1.35,1.15,7,5,0,3,3,3,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,68,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,1,-1,-1,-1,1,3,0,-1,-1,0,0,-2,-1,0,2,1,4,1,0,-0.6,0.4,-0.6,1.6,0.2 +18,R_6uIjsIW8BBWcSri,67 - 73,Canadian,Male,-2,3,3,-3,2,-3,-3,3,-3,-1,2,2,2,-3,2,2,1,2,2,1,-2,3,1,-3,0,2,-3,-3,2,-2,-1,1,2,2,1,-3,2,2,-1,-1,-1,-2,-3,7,-2,3,3,2,1,2,-3,-2,2,-2,-2,2,2,2,1,-3,2,1,1,1,2,2,1,4,TRUE,0,75,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,86,FALSE,1,50,TRUE,0,100,TRUE,1,91,TRUE,0,50,FALSE,0,50,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,88,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,71,TRUE,1,100,0,0,0,0,0,0,0,0.0196,0,0,0,0.0081,0.25,0.25,0.25,0,0,0.25,1,0.7744,0.7056,0.25,1,0.25,0.7744,0.25,0.0841,0.5625,1,0,1,1,0.345667857,0.073407143,0.617928571,25,78.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,14,87.5,6,37.5,85.41,65.12,89.12,87.38,100,86.38,84.44,15.63,22.91,2.62,26.62,24.88,37.5,-1.12,46.94,0,0,2,0,2,0,0,1,1,0,0,0,1,0,0,3,2,3,4,4,0,0,0,5,1,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0.8,0.4,0.2,3.2,1.2,0.8,0.2,0.2,1.15,0.6,1.67,1.67,0,-1,1,3,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),70,0.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,2,-5,1,0,-1,0,0,-1,0,0,0,0,0,2,2,3,4,4,-0.4,-0.4,0,3,0.55 +19,R_3jIXWL517XN41G2,46 - 52,American,Male,-2,2,2,3,3,-2,-2,2,1,2,2,-2,3,-3,3,-3,-3,-3,-3,-3,-1,2,2,1,3,3,-2,-1,2,1,3,3,2,-2,3,-3,3,3,-3,-3,-3,-3,-3,3,2,1,2,3,3,3,-2,-1,2,1,3,3,2,-2,3,-3,3,3,-3,-3,-3,-2,-3,3,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,55,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,74,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,0,100,TRUE,1,51,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,69,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,87,TRUE,1,100,TRUE,0,50,TRUE,0,56,TRUE,0,61,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0064,0.0676,0,0.0064,0,0,0.2025,0.3136,0.0169,0,0.2401,0.0961,1,0.25,0.25,0,0,0.7396,0,0.3721,0,0.127189286,0.020207143,0.234171429,28,87.5,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,88.22,74.88,86.88,98.38,92.75,94.31,82.12,3.12,3.84,-12.62,-0.62,10.88,17.75,-5.69,13.37,1,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0.6,0.4,0,0,1,0.4,0,0.2,0.25,0.4,3,3,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,51,1.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-3,-1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-0.4,0,0,-0.2,-0.15 +20,R_72nDnI9zDRG0eCR,67 - 73,Canadian,Male,1,3,1,0,1,-1,1,2,0,0,1,2,3,1,1,-1,-2,0,1,-1,1,3,2,0,1,0,0,1,2,0,0,1,1,2,2,1,1,0,-1,-1,0,1,-1,0,1,3,2,0,1,0,-1,1,2,0,0,0,1,2,2,1,1,0,0,0,0,0,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,76,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,91,TRUE,0,100,FALSE,1,76,FALSE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0576,0.0081,0,0,0,0,0,0.01,0,0.25,0,0,0.25,0,0,0.0064,0.09,0.0576,0,0.8281,0,0,1,1,1,0,1,0.198492857,0.041121429,0.355864286,27,84.38,27,84.38,8,100,7,87.5,6,75,6,75,16,100,11,68.75,93.31,85.75,88.62,100,98.88,93.31,93.31,0,8.93,-14.25,1.12,25,23.88,-6.69,24.56,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,2,0,1,0,0.2,0.2,0.2,0.2,0.2,0,0.2,0.8,0.2,0.3,0.33,0,0,1,0,-2,0.33,10 cents,5 minutes,47 days,Male,Trade School (non-military),67,0.875,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,-1,-1,0,-1,0,0,0.2,0,-0.6,-0.1 +21,R_3xtXT1ced0XvMfT,60 - 66,Canadian,Female,2,1,0,0,1,-2,0,1,1,0,2,2,2,0,2,0,-1,-1,1,-1,2,1,0,1,1,4,-2,0,1,0,1,4,2,2,1,0,2,4,0,0,0,0,0,4,2,1,0,1,1,4,-2,0,1,1,0,4,1,2,1,0,1,4,0,0,1,1,0,4,FALSE,1,100,TRUE,1,89,TRUE,0,97,TRUE,0,50,TRUE,1,100,FALSE,1,99,TRUE,1,96,TRUE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,91,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,91,TRUE,0,50,TRUE,0,97,FALSE,1,65,FALSE,1,100,TRUE,1,86,TRUE,1,70,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,58,TRUE,0,50,FALSE,1,50,TRUE,0,77,FALSE,0,95,FALSE,0,50,TRUE,1,95,0,0.1764,0.0081,0.0016,0.0025,0.0001,0.04,0.25,0,0.09,0.9025,0,0.25,0.25,0,0.0121,0,0.25,0.25,0,0.0196,0.25,0.1225,0.25,0.25,0.25,0.25,0,0.9409,0.9409,0.5929,0.8281,0.249717857,0.146228571,0.353207143,21,65.63,21,65.63,5,62.5,6,75,5,62.5,5,62.5,13,81.25,8,50,77.69,56.75,88.38,77.62,88,78.75,76.62,0,12.06,-5.75,13.38,15.12,25.5,-2.5,26.62,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,2,0,1,0.2,0.4,0.2,0.8,0.2,0,0.6,0.8,0.4,0.4,4,4,0,0,0,0,0,10 cents,100 minutes,47 days,Female,University - Undergraduate,60,0.625,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,1,1,-1,0,0,0,-1,0,0,-1,1,0,0,0.4,-0.4,0,0 +22,R_6z03p5JYjs5B7kR,53 - 59,Canadian,Female,2,3,3,1,3,0,1,0,1,0,2,3,3,-1,1,-1,-3,-2,1,-2,2,3,3,1,2,2,2,2,2,1,1,3,1,3,3,0,1,2,2,1,2,1,-1,7,3,3,3,3,3,2,0,1,2,1,1,2,2,3,3,0,1,3,1,-1,-1,1,-2,5,TRUE,0,100,TRUE,1,100,TRUE,0,98,TRUE,0,78,FALSE,0,53,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,99,TRUE,0,67,TRUE,0,100,TRUE,1,99,TRUE,0,97,TRUE,1,79,TRUE,1,99,TRUE,0,85,TRUE,0,92,FALSE,1,55,FALSE,1,63,TRUE,1,94,FALSE,0,54,TRUE,0,66,TRUE,1,94,TRUE,0,98,TRUE,1,96,TRUE,0,55,TRUE,0,99,TRUE,0,87,TRUE,1,100,FALSE,0,61,TRUE,1,98,0,0.0016,0.0001,0,0.0004,0.2025,0.0036,0.0001,0.1369,0.2916,0,0.0001,0.0256,0.4489,0.2809,0,0.4356,0.6084,0.9801,0.9604,0.0036,0.0441,0.2025,0.9409,0.7225,0.3025,0.3721,1,0.9604,0.8464,0.7569,1,0.411678571,0.1739,0.649457143,27,84.38,16,50,4,50,4,50,3,37.5,5,62.5,13,81.25,3,18.75,84.53,72.38,79.62,92,94.12,88.12,80.94,34.38,34.53,22.38,29.62,54.5,31.62,6.87,62.19,0,0,0,0,1,2,1,2,0,1,1,0,0,1,0,3,4,4,0,1,1,0,0,2,0,0,0,2,0,1,0,0,0,1,0,2,2,1,0,0,0.2,1.2,0.4,2.4,0.6,0.6,0.2,1,1.05,0.6,2.33,2.33,0,1,-1,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),55,0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,-1,0,0,-2,1,2,1,0,0,0,1,0,0,0,0,1,2,3,0,1,-0.4,0.6,0.2,1.4,0.45 +23,R_34cU3jQU6zArgQN,60 - 66,Canadian,Male,-2,3,2,-2,2,3,-3,3,-3,1,2,2,3,1,2,2,2,3,3,2,-2,3,2,-2,2,1,3,-3,3,-3,1,1,2,2,3,1,2,1,2,2,2,2,2,1,-2,3,2,-2,1,1,3,-3,3,-3,1,1,2,2,3,1,2,1,2,1,2,2,2,1,TRUE,0,52,TRUE,1,60,TRUE,0,94,FALSE,1,50,TRUE,1,50,TRUE,0,52,TRUE,1,98,TRUE,1,93,TRUE,1,52,TRUE,1,70,TRUE,0,53,TRUE,0,95,TRUE,1,97,TRUE,0,78,TRUE,1,52,TRUE,1,94,TRUE,0,67,FALSE,1,60,TRUE,0,56,FALSE,1,90,TRUE,1,52,TRUE,1,56,TRUE,0,63,TRUE,1,84,TRUE,0,87,TRUE,1,95,TRUE,0,52,FALSE,1,84,TRUE,0,58,TRUE,1,86,TRUE,1,89,TRUE,1,91,0.0049,0.0025,0.0036,0.0004,0.0081,0.2704,0.0256,0.09,0.01,0.1936,0.0196,0.0009,0.2304,0.2809,0.25,0.16,0.3969,0.25,0.0256,0.7569,0.2304,0.2304,0.3136,0.6084,0.4489,0.2704,0.0121,0.2704,0.8836,0.16,0.3364,0.9025,0.272714286,0.156171429,0.389257143,21,65.63,20,62.5,5,62.5,4,50,5,62.5,6,75,16,100,4,25,72.19,58,66.25,74.5,90,76.19,68.19,3.13,9.69,-4.5,16.25,12,15,-23.81,43.19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0.4,0.2,0,0,0.6,0.1,0.2,1,1,0,0,0,0,0,10 cents,5 minutes,24 days,Male,Trade School (non-military),65,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-0.2,0,0,-0.2,-0.1 +24,R_1nLwqGeXAf3t7vb,53 - 59,Canadian,Male,0,1,0,1,3,-2,-2,2,1,1,1,-1,1,-3,3,1,2,2,2,1,2,3,3,1,3,5,1,0,3,1,-1,4,0,-2,2,1,3,4,-2,0,-1,-1,-1,7,1,2,2,2,0,3,0,-2,1,1,1,3,1,-2,1,-3,3,4,1,1,1,2,2,3,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,76,FALSE,1,100,TRUE,1,100,TRUE,1,76,TRUE,0,77,TRUE,1,95,FALSE,1,86,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0025,0,0,0.0576,0,0,0,0.09,0,0,0.5929,0.7396,0,0.0196,0,0.16,0.0576,1,0,1,0,0,1,0,0.64,1,0.227135714,0.1059,0.348371429,30,93.75,25,78.13,6,75,6,75,7,87.5,6,75,16,100,9,56.25,93.94,86.5,94.62,95.25,99.38,95.69,92.19,15.62,15.81,11.5,19.62,7.75,24.38,-4.31,35.94,2,2,3,0,0,3,2,1,0,2,1,1,1,4,0,3,2,3,3,2,1,1,2,1,3,2,0,1,0,0,0,1,0,0,0,0,1,1,0,1,1.4,1.6,1.4,2.6,1.6,0.6,0.2,0.6,1.75,0.75,4.33,3.33,2,1,0,4,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),56,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,1,1,1,-1,-3,1,2,0,0,2,1,0,1,4,0,3,1,2,3,1,-0.2,1,1.2,2,1 +25,R_3CJRdTKCSIpHtQF,60 - 66,American,Male,0,2,2,-1,1,-1,0,1,-1,-1,1,1,1,-1,1,0,-1,1,-1,1,-1,2,2,-2,0,7,-1,-1,1,-1,0,7,2,1,1,0,0,4,0,0,2,0,0,8,-1,1,1,-1,0,7,0,0,1,-1,-1,5,1,0,1,0,1,5,-1,-2,0,0,-1,8,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,90,FALSE,0,82,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,FALSE,1,66,FALSE,1,75,FALSE,0,91,FALSE,1,86,FALSE,0,63,TRUE,1,74,TRUE,0,70,FALSE,1,93,FALSE,1,88,FALSE,1,100,FALSE,0,83,FALSE,0,62,FALSE,1,61,TRUE,1,70,FALSE,1,89,TRUE,1,88,FALSE,1,86,FALSE,1,92,TRUE,0,76,TRUE,1,100,TRUE,1,95,TRUE,1,100,0,0.0144,0.0676,0,0,0,0.09,0.0064,0,0.3844,0,0.8281,0,0.1156,0.6724,0,0.1521,0.01,0.0064,0.0121,0.6889,0.3969,0.0144,0.0196,0.49,0.0196,0.0025,1,1,0.0049,0.5776,0.0625,0.234085714,0.161357143,0.306814286,23,71.88,23,71.88,7,87.5,3,37.5,6,75,7,87.5,11,68.75,12,75,86.62,86,82.88,88.75,88.88,87.5,85.75,0,14.74,-1.5,45.38,13.75,1.38,18.75,10.75,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,2,0.6,0.4,0.6,0.8,0.8,0.2,0.4,1.2,0.6,0.65,6,5.67,0,2,-1,0,0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,-1,-1,1,0,-1,1,0,0,1,1,-1,0,0,1,-1,0,0,0,-1,-0.2,0.2,0.2,-0.4,-0.05 +26,R_37BfDy3qhTKSOmA,39 - 45,Canadian,Female,2,1,3,3,-2,1,1,0,2,1,0,-3,3,0,3,1,2,1,-1,-2,2,1,3,2,-2,7,1,3,-3,2,2,3,0,-3,1,3,3,3,-2,0,-2,-2,-3,10,2,1,3,2,0,7,0,0,0,0,0,4,0,-3,3,1,3,1,0,0,0,0,0,9,FALSE,1,100,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,89,FALSE,0,100,FALSE,1,89,FALSE,1,74,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0,0,0,0.25,1,0.25,0.25,0,0,0.7921,0.0121,0.25,0.25,0.25,0.25,0,0,1,0.25,0,1,0,0.25,0.25,0,1,1,1,0.0676,0.334707143,0.253871429,0.415542857,21,65.63,16,50,3,37.5,4,50,4,50,5,62.5,7,43.75,9,56.25,81.31,66,87.5,93.75,78,77.44,85.19,15.63,31.31,28.5,37.5,43.75,15.5,33.69,28.94,0,0,0,1,0,0,2,3,0,1,0,0,2,3,0,3,2,3,1,1,0,0,0,1,2,1,1,0,2,1,0,0,0,1,0,1,2,1,1,2,0.2,1.2,1,2,0.6,1,0.2,1.4,1.1,0.8,4.33,4,0,-1,2,1,0.33,20 cents,100 minutes,24 days,Female,College Diploma/Certificate,42,1.625,0,0,0,0,1,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,0,0,-2,-1,1,3,-2,0,0,0,2,2,0,2,0,2,0,-1,-0.4,0.2,0.8,0.6,0.3 +27,R_32QFc83XaDmeEmn,67 - 73,Canadian,Male,1,1,1,1,1,1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,23,71.88,17,53.13,4,50,4,50,4,50,5,62.5,16,100,1,6.25,100,100,100,100,100,100,100,18.75,46.87,50,50,50,37.5,0,93.75,0,0,0,0,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0.25,0.25,0,0,0,0,0,0,0,5 cents,100 minutes,24 days,Male,University - Undergraduate,68,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +28,R_3WPuG2TB1D1M4wJ,67 - 73,Canadian,Male,0,1,1,0,2,1,-1,1,-2,1,2,2,2,2,2,1,1,2,1,1,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,5,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,TRUE,0,77,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,77,TRUE,1,76,TRUE,0,50,TRUE,1,50,TRUE,1,77,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,80,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,0.25,0.25,0.0529,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.0576,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.5929,0.25,0.25,0.25,0.5929,0.251192857,0.2184,0.283985714,8,25,16,50,4,50,4,50,4,50,4,50,16,100,0,0,55.84,50,57,59.62,56.75,58.31,53.38,-25,5.84,0,7,9.62,6.75,-41.69,53.38,2,1,1,2,0,1,3,1,4,1,0,0,0,0,0,1,1,0,1,1,2,1,1,2,0,1,3,1,4,1,0,0,0,0,0,1,1,0,1,1,1.2,2,0,0.8,1.2,2,0,0.8,1,1,7,8,0,0,-3,0,-1,10 cents,5 minutes,47 days,Male,Trade School (non-military),73,0.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +29,R_3TtmXVWvij8FtpT,46 - 52,Canadian,Male,0,3,3,-3,1,2,-2,3,-2,0,3,0,3,0,3,1,1,1,1,-2,0,3,3,-3,2,1,2,-2,3,-2,0,0,3,0,3,0,3,0,1,1,1,1,-2,5,0,3,3,-2,1,4,2,-2,3,-2,0,1,3,0,3,0,3,1,1,1,1,1,-2,6,FALSE,1,100,TRUE,1,50,TRUE,0,77,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,84,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,87,FALSE,0,100,TRUE,1,75,0,0,0,0,0.0625,0,0,0,0,0.0225,0.0169,1,1,0,0.01,0.25,0,0.25,0,1,0.7056,0,0,0,0.5625,0.25,1,0,0.5929,1,0.25,1,0.320460714,0.186564286,0.454357143,22,68.75,21,65.63,5,62.5,4,50,6,75,6,75,12,75,9,56.25,89.78,81.25,84.25,98.12,95.5,91.94,87.62,3.12,24.15,18.75,34.25,23.12,20.5,16.94,31.37,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.2,0,0,0,0.05,0.05,0.33,2,-3,-1,-1,-1,-1.67,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,1.75,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +30,R_14BsEKbGVp5mLSn,67 - 73,Canadian,Female,3,2,3,1,2,0,-3,1,-3,0,0,1,1,0,-1,-2,-1,0,-2,-2,3,3,3,1,3,5,0,0,2,-3,0,5,0,2,2,0,0,5,-2,0,0,-2,-3,5,2,3,3,3,0,5,0,-3,0,-2,0,5,0,2,0,-3,0,5,-3,-2,0,-3,-3,5,FALSE,1,98,TRUE,1,100,FALSE,1,100,FALSE,1,66,FALSE,0,53,FALSE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,TRUE,1,100,TRUE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,53,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,0,80,FALSE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,84,TRUE,0,59,FALSE,1,99,TRUE,0,100,TRUE,1,100,FALSE,0,54,TRUE,1,100,0.0289,0.0256,0,0,0,0,0,0,0,0,0,0,0,0.4096,0.2809,0,0.2025,0.1156,0.0001,0,0.36,0.2809,0.64,1,0.1089,0.3481,0.2916,0.0004,0,1,1,1,0.251378571,0.072042857,0.430714286,25,78.13,21,65.63,3,37.5,5,62.5,6,75,7,87.5,12,75,9,56.25,86.72,72,79.38,97.75,97.75,86.69,86.75,12.5,21.09,34.5,16.88,22.75,10.25,11.69,30.5,0,1,0,0,1,0,3,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,2,2,0,0,1,1,0,0,1,1,3,1,1,1,0,1,1,0.4,0.8,0.6,0.4,1.2,0.4,1.2,0.8,0.55,0.9,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,72,0.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,-1,0,0,-2,-1,0,3,0,-1,0,0,0,0,-3,0,-1,0,0,-1,0,-0.8,0.4,-0.6,-0.4,-0.35 +31,R_5vkfEv3GS4mgHJv,60 - 66,Canadian,Female,3,1,2,-2,2,1,-1,1,-1,1,1,-1,3,1,2,2,1,2,1,-1,2,1,2,-3,2,3,2,-1,2,1,2,5,1,-1,2,2,2,3,1,1,2,1,-1,5,2,1,2,-1,1,5,1,-1,1,-1,1,4,1,-1,0,0,2,4,1,1,2,2,1,6,TRUE,0,63,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,81,TRUE,1,100,FALSE,1,75,TRUE,0,96,FALSE,0,95,FALSE,1,92,TRUE,1,50,TRUE,1,100,FALSE,1,79,FALSE,1,100,TRUE,0,65,FALSE,1,100,TRUE,1,81,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,91,TRUE,0,70,FALSE,1,100,TRUE,0,75,TRUE,1,79,TRUE,1,66,TRUE,1,98,0,0.0081,0,0,0.0004,0,0,0,0,0,0.0441,0.9025,0.0361,0.0625,0,0,0,0.25,0,0,0.0361,0.25,0.4225,0.0064,0.0441,0.49,0.1156,0.3969,0,0,0.5625,0.9216,0.162189286,0.092542857,0.231835714,26,81.25,26,81.25,6,75,6,75,7,87.5,7,87.5,15,93.75,11,68.75,87.69,69.62,91,93.25,96.88,90.06,85.31,0,6.44,-5.38,16,5.75,9.38,-3.69,16.56,1,0,0,1,0,1,0,1,2,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,3,1,0,1,0,0,1,2,0.4,1,0.4,0.2,0.6,0,0.8,0.8,0.5,0.55,3.67,4.33,-2,1,-1,-1,-0.66,10 cents,5 minutes,15 days,Female,University - Undergraduate,64,1.125,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,1,0,1,2,1,0,0,-2,0,0,0,0,0,-1,-2,-0.2,1,-0.4,-0.6,-0.05 +32,R_7CUkaE56X55bl7d,67 - 73,American,Female,3,2,3,0,2,-1,-2,3,-1,0,3,2,2,1,2,1,0,0,1,-1,2,2,2,-2,2,5,1,-2,2,-1,1,4,2,2,2,2,2,6,0,0,-1,-1,-2,5,3,0,2,1,0,5,-2,0,0,0,0,5,0,1,0,0,2,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,83,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,89,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,77,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,90,FALSE,1,100,FALSE,0,100,FALSE,0,90,TRUE,0,100,TRUE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,96,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0.0025,0,0,0.81,0,0,0.0196,0.0121,0.0289,0,1,0.5625,1,1,1,0.0529,0.81,1,1,0.9216,0,1,1,1,1,1,0.543575,0.2454,0.84175,27,84.38,16,50,5,62.5,3,37.5,3,37.5,5,62.5,14,87.5,2,12.5,96.28,89.12,97.88,98.75,99.38,95.69,96.88,34.38,46.28,26.62,60.38,61.25,36.88,8.19,84.38,1,0,1,2,0,2,0,1,0,1,1,0,0,1,0,1,0,1,2,1,0,2,1,1,2,1,2,3,1,0,3,1,2,1,0,1,0,0,1,1,0.8,0.8,0.4,1,1.2,1.4,1.4,0.6,0.75,1.15,5,5,0,-1,1,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),69,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,-2,0,1,-2,1,-2,-2,-1,1,-2,-1,-2,0,0,0,0,1,1,0,-0.4,-0.6,-1,0.4,-0.4 +33,R_5dKGXxQBJH6raux,67 - 73,Canadian,Female,3,3,3,3,1,0,-1,3,-1,1,1,0,3,-3,3,-1,-1,-1,-1,-1,3,3,3,3,1,4,0,0,3,1,0,5,1,0,3,-3,3,5,-1,-1,-1,-1,-1,4,3,3,3,3,1,5,0,0,0,0,0,4,1,0,3,-3,3,5,-1,0,-1,-1,-1,3,TRUE,0,100,TRUE,1,100,FALSE,1,89,FALSE,1,51,TRUE,1,51,FALSE,1,53,TRUE,1,93,TRUE,1,91,TRUE,1,56,TRUE,1,52,FALSE,1,53,FALSE,1,94,TRUE,1,100,TRUE,0,89,TRUE,1,53,TRUE,1,100,FALSE,1,54,TRUE,0,93,FALSE,1,55,FALSE,1,76,TRUE,1,81,TRUE,1,68,FALSE,1,70,TRUE,1,70,TRUE,0,90,TRUE,1,81,TRUE,0,67,TRUE,0,99,FALSE,1,54,TRUE,1,100,FALSE,0,61,TRUE,1,100,0.0081,0.0361,0,0.0049,0,0.2209,0.09,0.2304,0.0576,0.1024,0,0,0.1936,0.2209,0.2401,0,0.09,0.2401,0.9801,0.81,0.0361,0.2209,0.2025,0.7921,0.2116,0.4489,0.3721,1,0.0121,0.8649,0.2116,0.0036,0.280446429,0.120428571,0.440464286,14,43.75,25,78.13,6,75,8,100,4,50,7,87.5,15,93.75,10,62.5,76.38,62,70.38,83.25,89.88,78.56,74.19,-34.38,-1.75,-13,-29.62,33.25,2.38,-15.19,11.69,0,0,0,0,0,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,1,1,0,0,0,0,0,0,1,0,0,0,0,0.8,0,0,0,1.2,0,0.2,0.2,0.35,4.67,4.67,-1,1,0,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),68,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,-3,1,0,0,0,0,0,0,0,-1,0,0,0,0,-0.4,0,-0.2,-0.15 +34,R_1qSBBGypd2Ecdjz,39 - 45,Canadian,Female,1,2,2,-2,2,-3,-2,-1,1,3,-2,-3,3,-3,3,1,1,2,2,1,2,2,2,-3,2,1,-2,-2,1,1,2,1,-2,-3,3,-3,3,1,2,2,2,2,2,1,2,2,2,-3,2,0,-3,-3,2,-1,2,3,-2,-2,2,-2,3,2,2,1,2,2,2,2,FALSE,1,86,FALSE,0,50,FALSE,1,67,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,90,TRUE,1,93,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,79,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,95,FALSE,1,50,FALSE,1,50,FALSE,0,81,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,97,FALSE,0,50,FALSE,0,50,0.0049,0,0.25,0.01,0.25,0,0.25,0,0.25,0.25,0.0009,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.6561,0.25,0.25,0.6241,0.25,0.25,0.25,0.0196,0.1089,0.9025,0.25,1,0.279003571,0.178635714,0.379371429,20,62.5,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,66.81,50,66.38,81.25,69.62,66.31,67.31,9.37,13.68,0,3.88,31.25,19.62,28.81,-1.44,1,0,0,1,0,1,0,2,0,1,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,1,3,2,1,0,1,1,1,0,1,0,0,0,1,0.4,0.8,0,0.6,0.4,1.4,0.6,0.4,0.45,0.7,1,1.67,1,-2,-1,-1,-0.67,5 cents,5 minutes,24 days,Female,University - Undergraduate,42,1.375,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,-2,0,0,-1,-1,-1,0,0,1,0,0,0,0,-0.6,-0.6,0.2,-0.25 +35,R_6sUdYaBray9ntlO,67 - 73,Canadian,Male,-2,2,-2,2,-2,-1,-3,2,-3,0,2,2,1,-2,1,1,1,2,2,1,-2,2,-2,2,-2,1,-1,-2,2,-2,1,1,2,2,1,-2,1,1,1,1,2,2,1,1,-2,2,-2,2,-2,8,-2,-2,2,-2,0,8,2,2,1,-2,1,1,1,1,2,2,1,2,TRUE,0,95,TRUE,1,95,TRUE,0,89,FALSE,1,50,FALSE,0,63,FALSE,1,59,TRUE,1,99,FALSE,0,100,TRUE,1,58,TRUE,1,93,TRUE,0,71,TRUE,0,98,TRUE,1,89,TRUE,0,100,TRUE,1,63,TRUE,1,100,TRUE,0,85,TRUE,0,98,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,1,90,FALSE,1,100,TRUE,1,90,TRUE,0,84,TRUE,1,98,TRUE,0,74,TRUE,0,100,TRUE,0,99,TRUE,1,98,TRUE,1,96,TRUE,1,100,1,0.0004,0,0.0001,0,0.1681,0.01,0.0049,0,0.01,0.0004,0.0121,0.1764,0.5041,0.3969,0.0025,0,0.25,1,0.7056,0.0064,0.1369,0,1,0.7225,0.5476,0.0016,0.9025,0.7921,0.9604,0.9801,0.9604,0.366125,0.109671429,0.622578571,31,96.88,19,59.38,6,75,5,62.5,4,50,4,50,14,87.5,5,31.25,88.31,75.88,85.88,94.62,96.88,89,87.62,37.5,28.93,0.88,23.38,44.62,46.88,1.5,56.37,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0.6,0,0,0.15,0.15,1,5.67,-7,-7,0,-1,-4.67,5 cents,5 minutes,24 days,Male,High School (or equivalent),68,0.5,1,1,0,0,0,1,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +36,R_6ZCBZC4aia4UBds,67 - 73,Canadian,Male,3,3,3,3,3,-1,-2,3,0,1,3,3,2,2,3,1,0,2,2,-1,2,2,1,0,1,2,-1,-1,3,1,1,4,3,3,3,3,3,1,2,1,1,2,0,2,3,3,3,3,3,1,1,-2,3,-1,3,2,3,3,3,3,3,1,2,2,2,2,2,1,TRUE,0,100,TRUE,1,100,FALSE,1,65,FALSE,1,81,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,97,TRUE,0,100,TRUE,1,100,TRUE,1,75,TRUE,1,50,0,0,0,0,0.25,0.0064,0,0,0,0,0,0,0,0.25,0,0,1,0.0361,0.9409,1,0,0,1,1,1,1,0.0625,1,0.1225,1,1,1,0.416728571,0.110178571,0.723278571,25,78.13,20,62.5,5,62.5,5,62.5,4,50,6,75,16,100,4,25,94.06,88.25,92.75,100,95.25,95.31,92.81,15.63,31.56,25.75,30.25,50,20.25,-4.69,67.81,1,1,2,3,2,0,1,0,1,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,2,0,0,1,2,0,0,1,1,0,1,2,0,0,3,1.8,0.4,0.4,0.8,0,1,0.4,1.2,0.85,0.65,2.33,1.33,1,2,0,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,1,2,3,2,-2,1,0,0,-2,0,0,0,0,0,0,-1,1,0,-2,1.8,-0.6,0,-0.4,0.2 +37,R_30eQfgyKVbfUNdN,25 - 31,Canadian,Female,3,3,2,3,3,1,1,2,2,3,0,1,3,1,2,0,2,1,1,2,2,3,1,2,1,6,2,2,3,2,1,7,2,1,3,2,3,7,2,1,1,2,0,5,2,3,2,2,3,2,2,2,1,2,3,2,3,1,2,3,2,3,1,1,2,2,2,5,FALSE,1,100,FALSE,0,50,TRUE,0,68,FALSE,1,50,TRUE,1,97,TRUE,0,53,TRUE,1,89,TRUE,1,86,TRUE,1,66,TRUE,1,90,TRUE,0,50,TRUE,0,80,TRUE,1,50,TRUE,0,58,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,87,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,55,TRUE,0,51,FALSE,0,53,FALSE,1,50,TRUE,1,80,TRUE,0,50,TRUE,0,78,FALSE,1,55,FALSE,0,83,FALSE,0,54,TRUE,1,66,0.0196,0.04,0.0576,0.0121,0.1156,0.2809,0.2809,0.01,0.25,0.2025,0.6889,0.25,0.1156,0.25,0.0009,0.25,0.2601,0.25,0.6084,0.25,0.25,0.25,0.25,0.3364,0.25,0.25,0.2916,0,0.4624,0.7569,0.2025,0.64,0.285842857,0.228957143,0.342728571,16,50,16,50,3,37.5,5,62.5,6,75,2,25,11,68.75,5,31.25,64.84,52.5,59,76.12,71.75,68.44,61.25,0,14.84,15,-3.5,1.12,46.75,-0.31,30,1,0,1,1,2,1,1,1,0,2,2,0,0,1,1,2,1,0,1,2,1,0,0,1,0,1,1,1,0,0,3,0,1,2,0,1,1,1,1,0,1,1,0.8,1.2,0.4,0.6,1.2,0.8,1,0.75,6.67,2.33,4,5,4,0,4.34,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,1.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,1,0,2,0,0,0,0,2,-1,0,-1,-1,1,1,0,-1,0,2,0.6,0.4,-0.4,0.4,0.25 +38,R_1RPnnJVgH73v1F0,67 - 73,Canadian,Male,-3,3,3,2,0,0,3,3,-3,-2,1,1,3,0,0,2,3,3,2,1,-3,2,2,0,2,5,2,-3,2,-3,-2,1,0,0,2,0,-2,2,0,-1,0,-1,0,10,-3,3,3,3,-3,4,0,-3,3,-3,-3,4,0,3,3,-3,0,3,2,3,3,3,0,2,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,89,TRUE,1,100,FALSE,0,100,FALSE,0,73,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,65,FALSE,1,100,TRUE,0,85,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,0,0,0,0.0121,0,0,1,0,0,0,0.5329,0,1,0,0.2025,1,0,0.16,0,0,1,0,0,0.1225,1,1,0,0,0.7225,1,0.312589286,0.267678571,0.3575,26,81.25,22,68.75,4,50,6,75,7,87.5,5,62.5,12,75,10,62.5,94.59,92.25,91.12,95,100,98.31,90.88,12.5,25.84,42.25,16.12,7.5,37.5,23.31,28.38,0,1,1,2,2,2,6,1,0,0,1,1,1,0,2,2,4,3,3,1,0,0,0,1,3,0,6,0,0,1,1,2,0,3,0,0,0,0,1,1,1.2,1.8,1,2.6,0.8,1.4,1.2,0.4,1.65,0.95,2.67,3.67,1,-3,-1,8,-1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,69,0.5,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,1,1,1,-1,2,0,1,0,-1,0,-1,1,-3,2,2,4,3,2,0,0.4,0.4,-0.2,2.2,0.7 +39,R_5VPHRV8vSdZKYg6,53 - 59,Canadian,Female,2,2,2,1,2,-2,-2,1,0,0,2,-1,2,0,2,2,2,2,2,-1,0,2,2,-2,2,10,-2,-2,1,1,1,2,2,1,0,2,2,4,-1,-1,0,0,-2,7,2,2,2,0,2,8,-2,-2,0,0,-1,0,2,-1,2,-2,2,8,-1,0,-1,1,-2,4,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,69,TRUE,1,51,FALSE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,FALSE,0,50,TRUE,1,100,0.0961,1,0,0.25,0,0,0,1,0,0.25,1,0.25,0.2401,0.25,0.25,0.25,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0,0.258575,0.285007143,0.232142857,16,50,22,68.75,6,75,6,75,3,37.5,7,87.5,11,68.75,11,68.75,70.94,50.12,62.5,75,96.12,70,71.88,-18.75,2.19,-24.88,-12.5,37.5,8.62,1.25,3.13,2,0,0,3,0,0,0,0,1,1,0,2,2,2,0,3,3,2,2,1,0,0,0,1,0,0,0,1,0,1,0,0,0,2,0,3,2,3,1,1,1,0.4,1.2,2.2,0.2,0.4,0.4,2,1.2,0.75,5.33,5.33,2,2,-4,3,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,59,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,2,0,0,2,0,0,0,-1,1,0,0,2,2,0,0,0,1,-1,1,0,0.8,0,0.8,0.2,0.45 +40,R_3OFt005YkPug1PP,67 - 73,Canadian,Male,3,3,3,1,3,2,-2,3,1,-2,3,3,3,2,3,2,1,2,2,-3,3,3,3,3,3,0,3,-3,3,3,3,0,3,3,3,3,3,8,2,2,2,2,-1,0,3,3,3,3,3,0,2,-2,2,2,2,1,3,3,3,3,3,1,3,3,3,3,3,0,TRUE,0,75,TRUE,1,94,TRUE,0,93,FALSE,1,51,FALSE,0,55,FALSE,1,55,TRUE,1,99,FALSE,0,56,TRUE,1,92,TRUE,1,100,TRUE,0,50,TRUE,0,95,TRUE,1,96,TRUE,0,70,FALSE,0,54,TRUE,1,100,FALSE,1,100,TRUE,0,57,TRUE,0,96,FALSE,1,91,TRUE,1,52,TRUE,1,100,FALSE,1,53,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,99,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,93,TRUE,1,99,0.3136,0.25,0,0.0001,0.0001,0.2025,0,0,0.0081,0,0,0.0016,0.0064,0.25,0.3025,0.0036,0.2209,0.2401,1,0,0.2304,0.2916,0.9216,0.49,0,0.9801,0.0049,0.5625,0.8649,0.3249,1,0.9025,0.314614286,0.088271429,0.540957143,23,71.88,18,56.25,4,50,6,75,4,50,4,50,12,75,6,37.5,82.03,78.62,76.25,81.38,91.88,83.75,80.31,15.63,25.78,28.62,1.25,31.38,41.88,8.75,42.81,0,0,0,2,0,1,1,0,2,5,0,0,0,1,0,0,1,0,0,2,0,0,0,2,0,0,0,1,1,4,0,0,0,1,0,1,2,1,1,6,0.4,1.8,0.2,0.6,0.4,1.2,0.2,2.2,0.75,1,2.67,0.67,0,-1,7,0,2,10 cents,25 minutes,24 days,Male,High School (or equivalent),68,-1.125,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,1,1,-1,1,1,0,0,0,0,0,-1,-1,-1,-1,-4,0,0.6,0,-1.6,-0.25 +41,R_5n247JOppS7EHxw,39 - 45,Canadian,Male,2,2,2,1,2,-2,-2,1,1,2,-1,-2,2,-2,2,-2,-1,-1,-1,-3,3,3,-2,3,3,7,-2,0,0,-2,-2,4,0,-2,1,-3,2,5,1,2,1,2,1,8,0,0,0,0,0,5,-2,-3,0,0,1,5,-2,-2,1,-3,0,3,2,2,2,2,2,9,FALSE,1,71,TRUE,1,91,TRUE,0,100,FALSE,1,50,TRUE,1,93,FALSE,1,86,TRUE,1,92,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,91,TRUE,1,75,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,87,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,0,50,FALSE,1,85,TRUE,0,83,FALSE,0,70,TRUE,1,81,TRUE,1,57,0.01,0,0,0.0064,0.1849,0.0196,0,0,0.0169,0,0.49,0.0576,0,0.25,0.0049,0.0081,0,0.25,0.0225,0.36,0.0081,0.0625,0.25,0.0081,0.25,0.25,0.0361,0.0841,1,1,0.6889,0,0.189367857,0.091571429,0.287164286,28,87.5,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,82.16,68.38,79.5,89.25,91.5,88.5,75.81,12.5,7.16,-6.62,4.5,14.25,16.5,-5.25,19.56,1,1,4,2,1,0,2,1,3,4,1,0,1,1,0,3,3,2,3,4,2,2,2,1,2,0,1,1,1,1,1,0,1,1,2,4,3,3,3,5,1.8,2,0.6,3,1.8,0.8,1,3.6,1.85,1.8,5.33,4.33,2,-1,2,-1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,41,1.5,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,-1,-1,2,1,-1,0,1,0,2,3,0,0,0,0,-2,-1,0,-1,0,-1,0,1.2,-0.4,-0.6,0.05 +42,R_5luzhX0pDEWLnPl,67 - 73,Canadian,Male,2,3,3,2,1,-3,0,2,1,1,1,1,1,-2,3,-1,0,-1,-2,-3,3,3,3,-2,2,4,-3,0,1,0,2,8,3,3,2,-2,3,4,-2,-2,-2,-2,-3,5,2,3,2,2,0,7,-3,1,2,0,2,3,3,2,1,-2,3,6,-2,-2,-2,-2,-3,7,FALSE,1,100,TRUE,1,80,TRUE,0,99,FALSE,1,73,TRUE,1,75,FALSE,1,98,TRUE,1,91,TRUE,1,95,TRUE,1,79,TRUE,1,95,FALSE,1,85,TRUE,0,100,FALSE,0,94,FALSE,1,90,FALSE,0,66,TRUE,1,97,FALSE,1,87,FALSE,1,99,FALSE,1,92,FALSE,1,100,TRUE,1,94,TRUE,1,93,FALSE,1,76,TRUE,1,85,FALSE,1,98,TRUE,1,93,FALSE,1,83,FALSE,1,90,TRUE,0,94,TRUE,1,99,TRUE,1,100,TRUE,1,100,0.0025,0.0049,0.0009,0.0081,0,0.0004,0.0225,0.0025,0,0.0049,0.0001,0.8836,0.0441,0.0225,0.0625,0.04,0.0576,0.0729,0.01,0.0004,0.0036,0.4356,0.0064,0.01,0.0169,0.0289,0,0,0.9801,0.0001,0.8836,1,0.1639,0.086685714,0.241114286,26,81.25,27,84.38,7,87.5,6,75,8,100,6,75,14,87.5,13,81.25,90.62,82.25,89.75,94.88,95.62,89.75,91.5,-3.13,6.24,-5.25,14.75,-5.12,20.62,2.25,10.25,1,0,0,4,1,0,0,1,1,1,2,2,1,0,0,1,2,1,0,0,0,0,1,0,1,0,1,0,1,1,2,1,0,0,0,1,2,1,0,0,1.2,0.6,1,0.8,0.4,0.6,0.6,0.8,0.9,0.6,5.33,5.33,-3,5,-2,-2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),68,1.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,1,0,-1,4,0,0,-1,1,0,0,0,1,1,0,0,0,0,0,0,0,0.8,0,0.4,0,0.3 +43,R_6PzcODVrTnHwgj7,60 - 66,American,Female,3,3,2,-1,3,2,-2,2,-2,1,3,2,0,-1,3,-1,1,2,1,2,3,3,3,1,3,1,2,-2,1,-2,2,1,2,2,2,-2,3,1,2,2,2,1,2,1,3,3,3,1,3,1,3,-3,1,-3,-2,1,3,3,2,-2,3,1,2,-1,1,1,2,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,66,FALSE,0,59,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,60,FALSE,1,100,FALSE,0,60,TRUE,1,82,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0324,0,0,0,0,0.3481,0,1,0.1156,0,0,0.36,0.0196,0.16,1,0,0.2304,0.36,0,0,0,1,0,0.165217857,0.106864286,0.223571429,24,75,26,81.25,7,87.5,4,50,7,87.5,8,100,13,81.25,13,81.25,91.41,78,89.88,97.75,100,90.44,92.38,-6.25,10.16,-9.5,39.88,10.25,0,9.19,11.13,0,0,1,2,0,0,0,1,0,1,1,0,2,1,0,3,1,0,0,0,0,0,1,2,0,1,1,1,1,3,0,1,2,1,0,3,2,1,0,0,0.6,0.4,0.8,0.8,0.6,1.4,0.8,1.2,0.65,1,1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,-1,-1,0,-1,-2,1,-1,0,0,0,0,-1,-1,0,0,0,-1,0,-0.4,-0.35 +44,R_7SdDoaxdAAkVHyl,25 - 31,Canadian,Male,1,2,1,-3,1,-2,1,-1,1,0,-1,0,2,0,2,-3,-3,-3,-3,-3,1,1,1,-2,2,4,1,-1,1,-1,2,8,-1,-2,1,0,0,3,-1,-1,1,-2,-3,10,1,2,0,-2,2,4,1,-2,2,-2,2,10,-1,-2,2,1,2,3,-2,1,1,0,0,10,TRUE,0,69,FALSE,0,50,TRUE,0,100,FALSE,1,53,TRUE,1,73,FALSE,1,50,TRUE,1,94,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,89,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,79,TRUE,0,91,FALSE,1,72,FALSE,1,100,TRUE,1,87,FALSE,0,57,FALSE,1,57,TRUE,1,79,TRUE,0,61,TRUE,1,87,FALSE,1,50,FALSE,1,100,TRUE,0,84,TRUE,1,100,TRUE,1,57,TRUE,1,58,0,0.0169,0,0.0036,0.1764,0.25,0.0441,0,0,0.3249,0,0.0121,0.25,0.64,0.0729,0.25,0.1849,0.2209,0,0.3721,0.0169,1,0.0784,0,0.6241,0.25,0.1849,0.4761,1,0.8281,0.7056,1,0.320085714,0.1733,0.466871429,15,46.88,20,62.5,4,50,6,75,4,50,6,75,12,75,8,50,78.97,64,72.12,82.38,97.38,80.06,77.88,-15.62,16.47,14,-2.88,32.38,22.38,5.06,27.88,0,1,0,1,1,3,2,2,2,2,0,2,1,0,2,2,2,4,1,0,0,0,1,1,1,3,3,3,3,2,0,2,0,1,0,1,4,4,3,3,0.6,2.2,1,1.8,0.6,2.8,0.6,3,1.4,1.75,5,5.67,0,-2,0,0,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,27,1.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,1,-1,0,0,0,-1,-1,-1,0,0,0,1,-1,2,1,-2,0,-2,-3,0,-0.6,0.4,-1.2,-0.35 +45,R_6aaknJPN9Yr00Yu,67 - 73,Canadian,Male,2,3,2,-3,2,2,-3,2,-3,1,1,2,3,3,3,0,1,1,2,1,2,3,2,-3,2,1,2,-3,2,-3,2,1,1,2,3,3,3,2,2,2,2,2,2,7,2,3,2,-1,-1,4,1,-2,2,0,0,6,2,2,2,1,2,6,-1,0,0,2,1,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,TRUE,0,100,FALSE,1,84,FALSE,1,100,FALSE,0,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,TRUE,0,50,FALSE,1,85,TRUE,0,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.25,0.0225,0.4096,0.8281,0.25,0.0256,1,0.0625,0.25,0.0081,0,0,1,1,1,0.227014286,0.035714286,0.418314286,28,87.5,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,90.31,78.12,89.5,95.5,98.12,92.62,88,12.5,15.31,3.12,14.5,33,10.62,-1.13,31.75,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,1,0,1,0,0,0,2,3,1,1,0,3,1,1,0,1,2,1,1,1,1,0,0,0,0.2,0,1,1,1.2,1,0.6,0.3,0.95,1.33,5.33,-3,-5,-4,0,-4,10 cents,100 minutes,24 days,Male,University - Undergraduate,70,1.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-2,-3,-1,-1,0,-3,0,-1,0,-1,-2,-1,1,0,0,0,1,-1,-1,-1,0.4,-0.65 +46,R_34faNNc4HIy8yfY,67 - 73,American,Female,3,2,3,2,2,-1,0,3,1,1,2,1,2,0,2,-2,-2,0,1,-1,3,3,3,2,2,7,0,-2,2,0,1,5,2,2,2,-1,2,7,0,-1,-1,0,-2,7,3,2,3,2,2,5,0,-2,2,-1,2,3,2,2,2,-1,2,2,1,0,1,1,0,9,TRUE,0,89,FALSE,0,50,TRUE,0,100,FALSE,1,69,TRUE,1,97,TRUE,0,62,TRUE,1,93,TRUE,1,76,TRUE,1,77,TRUE,1,90,TRUE,0,62,TRUE,0,95,FALSE,0,72,TRUE,0,99,FALSE,0,73,TRUE,1,57,TRUE,0,73,TRUE,0,100,TRUE,0,79,FALSE,1,100,FALSE,0,99,TRUE,1,70,FALSE,1,78,TRUE,1,75,TRUE,0,79,TRUE,1,94,FALSE,1,76,FALSE,1,100,FALSE,1,81,TRUE,1,100,FALSE,0,74,TRUE,1,100,0.0576,0.0036,0.1849,0.0049,0,0.3844,0.0625,0.01,0,0.09,0,0.5184,0.0529,0.3844,0.0009,0.25,0.0484,0.0961,0,0.6241,0.9801,0.5329,0.6241,0.9801,0.5329,0.0576,0.5476,0.7921,1,1,0.0361,0.9025,0.375289286,0.135571429,0.615007143,17,53.13,17,53.13,3,37.5,4,50,4,50,6,75,11,68.75,6,37.5,82.47,70,82.75,89.25,87.88,81.06,83.88,0,29.34,32.5,32.75,39.25,12.88,12.31,46.38,0,1,0,0,0,1,2,1,1,0,0,1,0,1,0,2,1,1,1,1,0,0,0,0,0,1,2,1,2,1,0,1,0,1,0,3,2,1,0,1,0.2,1,0.4,1.2,0,1.4,0.4,1.4,0.7,0.8,6.33,3.33,2,2,5,-2,3,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,70,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,0,0,0,0,0,0,-1,-1,0,0,0,0,0,-1,-1,0,1,0,0.2,-0.4,0,-0.2,-0.1 +47,R_1AYXGgvcxrcayA6,39 - 45,Canadian,Male,-3,3,-2,-3,0,-2,-2,1,-3,-1,-2,2,3,-1,3,-2,1,-2,-2,-3,-3,3,-3,-2,-2,0,-2,-2,1,-3,-2,0,-2,2,3,0,3,1,1,1,-2,-2,-3,0,-3,2,0,-3,-2,2,-2,-2,1,-3,-2,1,-2,2,3,-2,3,0,1,2,0,-2,-3,0,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,97,TRUE,0,50,TRUE,1,97,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,95,TRUE,1,50,FALSE,0,92,0,0,0,0,0.8464,0.25,0.0009,0,0.25,0.0009,0.0025,0,0.25,0,0.25,0.25,0.25,0.25,0,1,0,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,0.25,0.9409,0.331842857,0.185764286,0.477921429,8,25,18,56.25,5,62.5,4,50,4,50,5,62.5,15,93.75,3,18.75,77.44,56.25,67.75,93.38,92.38,83.19,71.69,-31.25,21.19,-6.25,17.75,43.38,29.88,-10.56,52.94,0,0,1,1,2,0,0,0,0,1,0,0,0,1,0,3,0,0,0,0,0,1,2,0,2,0,0,0,0,1,0,0,0,1,0,3,1,2,0,0,0.8,0.2,0.2,0.6,1,0.2,0.2,1.2,0.45,0.65,0.33,1,-2,-1,1,0,-0.67,10 cents,5 minutes,24 days,Male,Trade School (non-military),45,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,-1,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,-2,0,0,-0.2,0,0,-0.6,-0.2 +48,R_6Q47AqweUbtMBRT,67 - 73,Canadian,Female,3,3,3,2,3,3,-1,3,-1,3,3,3,3,3,3,2,1,2,2,-1,3,3,3,-2,3,8,3,-1,3,-1,3,8,3,3,3,2,3,0,1,-1,1,1,-1,5,3,3,3,3,3,3,3,-3,3,-3,2,5,3,3,3,2,3,3,1,0,0,1,-1,5,TRUE,0,100,FALSE,0,71,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,63,TRUE,1,100,TRUE,0,77,TRUE,0,100,TRUE,0,87,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,0,75,TRUE,1,90,TRUE,0,77,TRUE,1,70,TRUE,0,50,FALSE,1,60,TRUE,0,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.09,0,0,0,0,0.01,0,0.25,0.25,0.0625,0,0.25,0.25,0.25,0.5041,0.5625,0.25,0.16,0.5929,0,0.3969,0.7569,1,0.5929,0.25,0.25,1,1,1,1,1,0.415667857,0.188507143,0.642828571,23,71.88,16,50,3,37.5,4,50,3,37.5,6,75,11,68.75,5,31.25,79.53,58.88,87.75,87.12,84.38,79.31,79.75,21.88,29.53,21.38,37.75,49.62,9.38,10.56,48.5,0,0,0,4,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,0,0,0,0,1,0,0,2,0,2,1,0,0,0,1,0,1,1,2,1,0,0.8,0,0.2,1,0.2,1,0.2,1,0.5,0.6,5.33,3.67,5,3,-3,0,1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,69,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,3,0,0,-2,0,-2,-1,0,0,0,0,0,0,1,-1,0,0,0.6,-1,0,0,-0.1 +49,R_3z5vrZ4mxBm70tb,25 - 31,Canadian,Female,1,2,2,1,2,-1,0,1,2,2,1,-2,1,-1,2,1,1,1,2,1,1,2,2,-1,2,7,2,2,0,1,2,3,3,-1,1,1,1,2,-1,-1,-1,-1,0,9,2,2,3,3,2,6,1,1,2,1,2,5,2,-2,2,-1,2,1,2,2,2,2,2,3,FALSE,1,96,TRUE,1,65,FALSE,1,79,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,100,TRUE,1,80,TRUE,1,90,FALSE,1,70,FALSE,1,65,TRUE,1,90,FALSE,1,74,TRUE,1,91,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,75,FALSE,1,50,TRUE,1,100,TRUE,1,70,FALSE,1,90,TRUE,1,91,FALSE,1,96,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,95,FALSE,0,75,FALSE,0,54,TRUE,1,96,0,0.04,0,0.0625,0.0016,0,0.0081,0.01,0.25,0.09,0.5625,0.01,0.04,0.09,0.0625,0.1225,0.01,0.25,0.25,0.0016,0,0.0081,0.5625,0.0676,0.49,0.36,0.2916,0.0016,0.0441,1,0.9025,0.1225,0.200332143,0.107657143,0.293007143,24,75,25,78.13,5,62.5,6,75,7,87.5,7,87.5,14,87.5,11,68.75,79.75,68.12,89.5,85.12,76.25,83.25,76.25,-3.13,1.62,5.62,14.5,-2.38,-11.25,-4.25,7.5,0,0,0,2,0,3,2,1,1,0,2,1,0,2,1,2,2,2,3,1,1,0,1,2,0,2,1,1,1,0,1,0,1,0,0,1,1,1,0,1,0.4,1.4,1.2,2,0.8,1,0.4,0.8,1.25,0.75,4,4,1,-2,1,6,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,30,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,0,-1,0,0,1,1,0,0,0,1,1,-1,2,1,1,1,1,3,0,-0.4,0.4,0.8,1.2,0.5 +50,R_7u4PSg6FKCVx4Qx,53 - 59,Canadian,Male,1,3,1,2,2,-1,0,2,1,-1,2,1,2,-2,2,0,1,1,1,-1,-1,1,1,-2,-1,7,-2,1,2,1,-1,7,3,1,2,3,3,1,1,1,1,-1,-1,4,3,2,2,2,3,8,-1,1,1,2,0,5,3,3,3,-2,3,2,2,1,2,3,1,4,TRUE,0,77,TRUE,1,71,FALSE,1,67,FALSE,1,59,TRUE,1,58,FALSE,1,70,TRUE,1,76,TRUE,1,84,FALSE,0,53,TRUE,1,77,FALSE,1,74,FALSE,1,67,TRUE,1,65,TRUE,0,65,FALSE,0,59,TRUE,1,88,TRUE,0,60,FALSE,1,89,FALSE,1,89,FALSE,1,94,FALSE,0,70,TRUE,1,79,TRUE,0,66,TRUE,1,82,TRUE,0,62,TRUE,1,62,TRUE,0,64,FALSE,1,91,TRUE,0,71,TRUE,1,79,FALSE,0,89,TRUE,1,83,0.0256,0.1444,0.0144,0.0576,0.0289,0.09,0.0324,0.0529,0.0036,0.0441,0.0441,0.1225,0.2809,0.0676,0.1764,0.0841,0.4356,0.1681,0.0081,0.3844,0.49,0.3481,0.0121,0.4225,0.36,0.4096,0.7921,0.5929,0.1089,0.0121,0.5041,0.1089,0.220892857,0.116514286,0.325271429,22,68.75,21,65.63,4,50,4,50,5,62.5,8,100,12,75,9,56.25,73.12,69.75,67.88,73.38,81.5,73.44,72.81,3.12,7.49,19.75,17.88,10.88,-18.5,-1.56,16.56,2,2,0,4,3,1,1,0,0,0,1,0,0,5,1,1,0,0,2,0,2,1,1,0,1,0,1,1,1,1,1,2,1,0,1,2,0,1,2,2,2.2,0.4,1.4,0.6,1,0.8,1,1.4,1.15,1.05,5,5,-1,2,-1,0,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,54,0.5,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,1,-1,4,2,1,0,-1,-1,-1,0,-2,-1,5,0,-1,0,-1,0,-2,1.2,-0.4,0.4,-0.8,0.1 +51,R_7lyqTGSyYrIwngs,46 - 52,Canadian,Female,3,2,3,2,2,-2,0,-1,1,0,1,0,2,-3,3,-2,1,-1,-2,-1,3,2,3,-1,3,3,-3,0,0,-2,3,5,1,0,1,-3,3,6,3,3,3,3,3,8,3,2,3,3,-1,5,-3,0,-2,2,-2,5,-1,0,0,-3,3,5,-3,-3,-3,-3,-3,8,FALSE,1,75,TRUE,1,66,TRUE,0,55,FALSE,1,75,TRUE,1,88,FALSE,1,75,TRUE,1,50,TRUE,1,55,TRUE,1,50,TRUE,1,88,FALSE,1,55,TRUE,0,75,FALSE,0,55,FALSE,1,75,TRUE,1,50,TRUE,1,99,FALSE,1,55,FALSE,1,88,FALSE,1,55,FALSE,1,100,TRUE,1,55,TRUE,1,88,FALSE,1,99,TRUE,1,66,FALSE,1,99,TRUE,1,75,FALSE,1,66,FALSE,1,75,FALSE,1,55,TRUE,1,55,TRUE,1,55,TRUE,1,55,0.2025,0.0625,0.0001,0.25,0.2025,0.0625,0.1156,0.0144,0,0.0144,0.2025,0.3025,0.25,0.2025,0.0144,0.1156,0.0001,0.0625,0.0625,0.0001,0.2025,0.25,0.2025,0.0625,0.2025,0.1156,0.2025,0.0625,0.3025,0.0144,0.2025,0.5625,0.143021429,0.111392857,0.17465,24,75,29,90.63,8,100,7,87.5,8,100,6,75,15,93.75,14,87.5,69.59,59,67.12,79.75,72.5,65.62,73.56,-15.63,-21.04,-41,-20.38,-20.25,-2.5,-28.13,-13.94,0,0,0,3,1,1,0,1,3,3,0,0,1,0,0,5,2,4,5,4,0,0,0,1,3,1,0,1,1,2,2,0,2,0,0,1,4,2,1,2,0.8,1.6,0.2,4,0.8,1,0.8,2,1.65,1.15,4.67,5,-2,0,1,0,-0.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,46,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,2,-2,0,0,0,2,1,-2,0,-1,0,0,4,-2,2,4,2,0,0.6,-0.6,2,0.5 +52,R_7ilfgOcIomd4yMA,53 - 59,Canadian,Male,1,3,3,0,2,2,-2,3,-3,2,2,1,3,0,3,1,1,2,2,0,1,3,3,-1,2,7,2,-3,3,-3,2,9,3,2,3,1,3,7,2,3,3,2,0,9,3,3,3,1,2,8,2,-2,2,-3,1,8,3,2,3,0,2,8,2,1,2,2,0,9,FALSE,1,100,TRUE,1,58,TRUE,0,84,TRUE,0,63,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,86,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,86,TRUE,0,100,TRUE,1,50,TRUE,1,83,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,60,FALSE,1,100,FALSE,0,85,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0.0289,0.7225,1,0.0196,0,0.0625,0.1764,1,0.3969,0.36,0,0.25,0.25,0.0196,1,0.25,0.7569,0,0,0.7056,1,0,0.7396,0.347803571,0.314771429,0.380835714,24,75,20,62.5,6,75,5,62.5,6,75,3,37.5,14,87.5,6,37.5,87.59,78.75,84.38,97.88,89.38,86.69,88.5,12.5,25.09,3.75,21.88,22.88,51.88,-0.81,51,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,1,2,1,0,0,2,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0,0,0,0.2,0.2,0.6,0.8,0.6,0.4,0.6,0.2,0.45,0.45,7.67,8,-1,1,-1,0,-0.33,10 cents,100 minutes,15 days,Male,Trade School (non-military),57,0.875,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,-2,0,0,0,0,0,1,-1,0,-1,0,0,0,1,-1,0,2,1,0,0,-0.4,-0.2,0,0.6,0 +53,R_3CKH5nALclcXyCd,67 - 73,Canadian,Male,3,3,3,2,3,-1,-1,0,0,0,2,0,3,-3,3,1,1,1,1,-2,2,3,3,1,2,3,-1,-2,0,0,0,1,2,-2,3,-3,3,1,-1,0,-1,0,-2,2,2,3,3,3,2,1,-2,0,0,0,0,0,2,-3,2,-3,3,1,-1,0,0,0,-2,1,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,80,TRUE,1,80,FALSE,1,80,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,80,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,50,TRUE,0,90,TRUE,1,90,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.01,0.04,0,0.25,0,0,0,0.25,0.25,0,0,0.25,0,0.04,0,0.5625,0,0,0.64,0.64,0.81,0.64,0.156517857,0.039285714,0.27375,28,87.5,25,78.13,5,62.5,7,87.5,7,87.5,6,75,16,100,9,56.25,89.22,78.12,96.25,95,87.5,95,83.44,9.37,11.09,15.62,8.75,7.5,12.5,-5,27.19,1,0,0,1,1,0,1,0,0,0,0,2,0,0,0,2,1,2,1,0,1,0,0,1,1,1,1,0,0,0,0,3,1,0,0,2,1,1,1,0,0.6,0.2,0.4,1.2,0.6,0.4,0.8,1,0.6,0.7,1.67,0.67,2,1,0,1,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,69,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,-1,0,0,0,0,0,-1,-1,0,0,0,0,1,0,0,0,-0.2,-0.4,0.2,-0.1 +54,R_6J2a15FEPNrer3J,60 - 66,American,Female,3,2,3,1,-1,-2,-2,1,1,1,2,0,3,-1,2,-2,-1,0,-1,-1,2,2,2,-1,-2,5,1,-1,2,-1,1,6,2,2,2,2,2,2,1,1,1,2,1,8,2,2,2,3,-1,3,-1,-1,2,1,-1,4,2,1,1,-1,2,2,1,0,1,1,0,7,FALSE,1,50,TRUE,1,100,FALSE,1,86,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,83,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,91,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,82,FALSE,0,69,TRUE,1,100,0,0.8281,0.0361,0,0,0,0.25,0.01,0,0.25,0.0324,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0,0.25,0.25,0.25,1,0.25,0.25,0.4761,0.25,0.0196,0.6889,0.25,1,0.249178571,0.128028571,0.370328571,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,9,56.25,12,75,72.88,58.62,68.75,83,81.12,72.69,73.06,-3.13,7.25,-3.88,6.25,20.5,6.12,16.44,-1.94,1,0,1,2,1,3,1,1,2,0,0,2,1,3,0,3,2,1,3,2,1,0,1,2,0,1,1,1,0,2,0,1,2,0,0,3,1,1,2,1,1,1.4,1.2,2.2,0.8,1,0.6,1.6,1.45,1,4.33,3,2,2,0,1,1.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,61,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,1,2,0,0,2,-2,0,1,-1,3,0,0,1,0,1,1,0.2,0.4,0.6,0.6,0.45 +55,R_7p6hcM2Xv9ALWsn,53 - 59,Canadian,Male,0,0,2,0,2,-3,-2,2,-2,0,2,0,3,-3,3,0,1,2,1,0,0,-3,3,2,3,5,-3,-3,-1,-3,2,2,2,0,0,-3,3,2,-2,1,1,-2,0,5,0,0,3,3,3,1,0,0,0,0,0,1,2,0,0,-3,3,5,0,0,0,0,0,5,TRUE,0,94,FALSE,0,75,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,100,TRUE,1,50,FALSE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,0,96,TRUE,1,50,TRUE,1,100,TRUE,0,92,TRUE,0,97,TRUE,0,93,TRUE,0,50,FALSE,0,50,TRUE,1,88,TRUE,0,50,TRUE,1,93,TRUE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,100,1,0.25,0,0,0,0.25,0.0049,1,0.25,0.0144,0.25,0.0016,0.25,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.8649,0.9216,0.8464,0.25,0.25,0.8836,1,0.9409,0.25,0.25,0.394314286,0.255957143,0.532671429,23,71.88,14,43.75,6,75,3,37.5,2,25,3,37.5,9,56.25,5,31.25,71.06,58.5,67.25,84.38,74.12,75.12,67,28.13,27.31,-16.5,29.75,59.38,36.62,18.87,35.75,0,3,1,2,1,0,1,3,1,2,0,0,3,0,0,2,0,1,3,0,0,0,1,3,1,3,2,2,2,0,0,0,3,0,0,0,1,2,1,0,1.4,1.4,0.6,1.2,1,1.8,0.6,0.8,1.15,1.05,3,2.33,4,1,-3,0,0.67,5 cents,100 minutes,15 days,Male,High School (or equivalent),55,0.5,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,3,0,-1,0,-3,-1,1,-1,2,0,0,0,0,0,2,-1,-1,2,0,0.4,-0.4,0,0.4,0.1 +56,R_1TpH8LJdYVHcyHm,53 - 59,Canadian,Female,1,3,3,1,3,1,0,2,-1,1,1,1,3,1,3,2,2,2,2,2,1,3,3,1,3,1,1,0,3,1,1,1,1,1,3,2,3,4,1,1,1,1,1,7,1,3,3,1,3,4,2,1,2,1,0,1,1,1,3,0,3,1,2,2,2,2,2,4,TRUE,0,100,TRUE,1,75,TRUE,0,65,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,80,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,0,60,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,80,TRUE,1,60,TRUE,0,90,TRUE,1,100,TRUE,0,60,TRUE,0,80,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0.04,0,0.25,0.16,0.25,0.25,0.0225,0,0,0.25,0,0.25,0.0625,0.04,0.25,0.64,0.81,0.25,0.25,0.36,0,0,0.36,0.25,1,0.4225,1,1,1,0.325982143,0.1275,0.524464286,20,62.5,16,50,3,37.5,5,62.5,4,50,4,50,9,56.25,7,43.75,76.09,61.88,78.75,88.12,75.62,71.88,80.31,12.5,26.09,24.38,16.25,38.12,25.62,15.63,36.56,0,0,0,0,0,0,0,1,2,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,2,1,0,0,0,1,0,0,0,0,0,0,0,0.6,0.2,1,0,1,0.2,0,0.45,0.3,2,2,-3,0,3,3,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,58,0.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,-1,1,0,-1,0,0,0,0,0,1,1,1,1,1,0,-0.4,0,1,0.15 +57,R_6DRa1CrwESPCbtv,67 - 73,Canadian,Male,0,2,-1,0,2,1,-1,2,-3,1,3,-1,3,0,3,1,0,2,2,-1,0,2,-1,-1,3,8,1,0,1,-2,1,8,3,-1,2,0,3,8,0,1,1,0,0,7,0,2,0,1,2,8,1,0,2,0,1,8,3,2,2,0,3,7,2,1,2,2,2,7,FALSE,1,65,TRUE,1,74,TRUE,0,84,FALSE,1,60,TRUE,1,71,FALSE,1,81,TRUE,1,89,TRUE,1,81,TRUE,1,76,TRUE,1,90,FALSE,1,64,TRUE,0,73,TRUE,1,82,TRUE,0,50,TRUE,1,81,TRUE,1,100,FALSE,1,50,TRUE,0,73,TRUE,0,57,TRUE,0,100,TRUE,1,81,TRUE,1,64,FALSE,1,54,TRUE,1,77,FALSE,1,74,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,50,TRUE,1,58,TRUE,1,50,TRUE,1,63,0.0361,0.04,0,0.0121,0.1369,0.0361,0.0529,0.01,1,0.1296,0.1764,0.0324,0.0576,0.1296,0.0841,0.0676,0.2116,0.16,0.25,0.0676,0.0361,0.0361,0.3249,0.25,0.25,0.36,0.25,0.1225,0.7056,0.5329,0.25,0.5329,0.223335714,0.1632,0.283471429,25,78.13,24,75,6,75,7,87.5,6,75,5,62.5,16,100,8,50,70.69,65.25,66.5,73.12,77.88,76.06,65.31,3.13,-4.31,-9.75,-21,-1.88,15.38,-23.94,15.31,0,0,0,1,1,0,1,1,1,0,0,0,1,0,0,1,1,1,2,1,0,0,1,1,0,0,1,0,3,0,0,3,1,0,0,1,1,0,0,3,0.4,0.6,0.2,1.2,0.4,0.8,0.8,1,0.6,0.75,8,7.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,69,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,-1,0,1,0,0,1,-2,0,0,-3,0,0,0,0,0,1,2,-2,0,-0.2,-0.6,0.2,-0.15 +58,R_1CjweTLqC4QaUJP,39 - 45,Canadian,Female,3,3,3,0,3,2,-3,0,-3,-3,2,2,3,2,0,3,3,3,3,3,2,2,2,3,2,9,1,0,0,-2,2,9,0,1,0,2,1,9,2,2,2,3,2,10,2,2,2,0,2,9,2,2,2,2,2,10,3,3,2,3,2,10,2,2,2,2,2,10,TRUE,0,73,TRUE,1,84,FALSE,1,85,FALSE,1,71,FALSE,0,88,TRUE,0,85,TRUE,1,81,TRUE,1,76,TRUE,1,77,TRUE,1,78,FALSE,1,71,FALSE,1,81,TRUE,1,78,FALSE,1,77,TRUE,1,78,FALSE,0,82,TRUE,0,72,TRUE,0,82,FALSE,1,75,TRUE,0,76,TRUE,1,68,FALSE,0,83,TRUE,0,79,FALSE,0,77,TRUE,0,79,FALSE,0,80,TRUE,0,76,FALSE,1,76,TRUE,0,77,TRUE,1,79,FALSE,0,83,TRUE,1,75,0.0576,0.64,0.6724,0.0361,0.0625,0.7225,0.5929,0.0484,0.5776,0.6889,0.0441,0.0484,0.0529,0.0841,0.7744,0.0256,0.6241,0.0841,0.0576,0.6241,0.1024,0.0484,0.0625,0.0529,0.5184,0.5776,0.6889,0.5329,0.0225,0.6724,0.5929,0.0361,0.322146429,0.316464286,0.327828571,30,93.75,17,53.13,6,75,3,37.5,3,37.5,5,62.5,10,62.5,7,43.75,78.19,76.88,77.75,79.12,79,79.19,77.19,40.62,25.06,1.88,40.25,41.62,16.5,16.69,33.44,1,1,1,3,1,1,3,0,1,5,2,1,3,0,1,1,1,1,0,1,1,1,1,0,1,0,5,2,5,5,1,1,1,1,2,1,1,1,1,1,1.4,2,1.4,0.8,0.8,3.4,1.2,1,1.4,1.6,9,9.67,0,-1,-1,0,-0.67,10 cents,25 minutes,24 days,Female,University - Graduate (Masters),41,-0.125,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,3,0,1,-2,-2,-4,0,1,0,2,-1,-1,0,0,0,-1,0,0.6,-1.4,0.2,-0.2,-0.2 +59,R_5ddcGt1nU3rO4Rm,60 - 66,Canadian,Male,0,3,3,1,2,-2,-2,2,0,1,2,0,1,-2,2,0,0,0,1,-1,0,3,3,1,1,3,0,-1,1,1,1,7,1,0,0,1,0,3,-2,-1,-1,-1,-2,8,0,3,3,2,0,3,-2,-2,2,-2,1,1,2,0,1,-2,2,2,0,-1,0,0,-2,8,FALSE,1,95,TRUE,1,95,TRUE,0,91,FALSE,1,50,TRUE,1,93,FALSE,1,86,TRUE,1,97,TRUE,1,96,TRUE,1,77,TRUE,1,63,FALSE,1,96,TRUE,0,66,FALSE,0,50,FALSE,1,99,FALSE,0,50,TRUE,1,97,FALSE,1,50,FALSE,1,98,FALSE,1,50,FALSE,1,100,TRUE,1,96,TRUE,1,98,FALSE,1,50,TRUE,1,50,FALSE,1,62,TRUE,1,95,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,93,TRUE,1,74,TRUE,1,100,0.0016,0.0025,0.0009,0.0009,0,0.0196,0.25,0.1369,0,0.0004,0.0049,0.25,0.0529,0.0016,0.0049,0.0025,0.25,0.25,0,0.1444,0.0016,0.25,0.25,0.0001,0.25,0.25,0.0676,0.0025,0.8281,0.0004,1,0.4356,0.168,0.087407143,0.248592857,26,81.25,26,81.25,6,75,6,75,8,100,6,75,14,87.5,12,75,80.22,67.75,78.12,88.38,86.62,82.75,77.69,0,-1.03,-7.25,3.12,-11.62,11.62,-4.75,2.69,0,0,0,0,1,2,1,1,1,0,1,0,1,3,2,2,1,1,2,1,0,0,0,1,2,0,0,0,2,0,0,0,0,0,0,0,1,0,1,1,0.2,1,1.4,1.4,0.6,0.4,0,0.6,1,0.4,4.33,2,0,6,1,0,2.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),65,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-1,-1,2,1,1,-1,0,1,0,1,3,2,2,0,1,1,0,-0.4,0.6,1.4,0.8,0.6 +60,R_7P6o620cMbqo84U,60 - 66,Canadian,Female,3,0,2,2,-2,-2,-2,1,1,-1,2,1,2,-2,3,1,1,1,2,-1,3,1,2,2,0,5,-2,-3,2,-1,-1,7,2,2,2,-1,3,2,2,2,1,1,1,3,3,1,1,2,-3,6,-2,0,1,0,-1,5,2,2,2,-3,3,3,0,0,0,0,0,5,FALSE,1,90,TRUE,1,80,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,95,FALSE,1,90,TRUE,0,80,FALSE,1,100,TRUE,1,80,TRUE,1,90,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,0,75,TRUE,0,95,TRUE,1,70,FALSE,0,50,TRUE,1,95,0,0.0625,0,0.0025,0.0025,0.0025,0.04,0.01,0,0.01,0.09,0.01,0.01,0,0.0025,0.04,0,0.25,0.5625,0,0.04,0.0625,0.64,0,0.0025,0,0.25,0.01,0,0.01,0.9025,0,0.105267857,0.033392857,0.177142857,16,50,28,87.5,6,75,7,87.5,8,100,7,87.5,15,93.75,13,81.25,88.28,78.12,93.12,91.25,90.62,84.69,91.88,-37.5,0.78,3.12,5.62,-8.75,3.12,-9.06,10.63,0,1,0,0,2,0,1,1,2,0,0,1,0,1,0,1,1,0,1,2,0,1,1,0,1,0,2,0,1,0,0,1,0,1,0,1,1,1,2,1,0.6,0.8,0.4,1,0.6,0.6,0.4,1.2,0.7,0.7,4.67,4.67,-1,2,-1,-2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,-1,0,1,0,-1,1,1,0,0,0,0,0,0,0,0,-1,-1,1,0,0.2,0,-0.2,0 +61,R_3XNQMr9xxovT2eJ,60 - 66,Canadian,Male,0,3,1,1,2,3,-1,1,-2,2,2,-1,2,1,3,2,2,2,2,2,-1,3,2,-1,-1,2,3,1,2,1,3,4,2,1,2,3,2,2,1,0,1,1,2,5,1,3,3,2,1,1,2,-1,2,-2,1,1,2,0,2,2,2,1,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,50,TRUE,0,97,TRUE,1,100,FALSE,1,50,TRUE,1,93,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.0625,0.25,0,0,0,0,0.25,0,0,0.25,0.5625,0.8281,0.25,0,0.0049,0.25,0.25,0.25,1,0,1,1,1,1,0.9409,0.326746429,0.098214286,0.555278571,25,78.13,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,86.91,83.5,87.5,84.38,92.25,98,75.81,6.25,15.03,8.5,12.5,9.38,29.75,-2,32.06,1,0,1,2,3,0,2,1,3,1,0,2,0,2,1,1,2,1,1,0,1,0,2,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,0,1.4,1.4,1,1,1,0.6,0.6,0,1.2,0.55,2.67,1,1,3,1,3,1.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,64,1.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,-1,1,2,-1,2,0,3,0,0,1,0,1,0,1,2,1,1,0,0.4,0.8,0.4,1,0.65 +62,R_51AeU8rD9pFk6YR,67 - 73,Canadian,Male,-2,0,2,-2,1,-2,-1,2,-2,-1,2,3,3,1,0,-2,0,-1,-2,-3,-3,-2,3,0,1,6,-2,0,2,1,-2,4,1,3,3,1,0,3,-3,-3,-3,-3,-3,10,-3,1,2,1,-1,7,-2,-2,1,-3,-2,5,2,3,3,0,-1,6,1,0,1,1,-3,7,FALSE,1,92,TRUE,1,75,FALSE,1,76,FALSE,1,60,FALSE,0,55,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,97,FALSE,1,60,TRUE,0,83,TRUE,1,88,FALSE,1,94,TRUE,1,55,TRUE,1,100,FALSE,1,71,FALSE,1,88,FALSE,1,61,FALSE,1,100,FALSE,0,59,FALSE,0,57,FALSE,1,100,TRUE,1,100,FALSE,1,64,TRUE,1,95,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,87,TRUE,1,100,0,0.0025,0,0,0,0.0049,0,0.0009,0,0.3249,0,0.0144,0.0841,0.16,0.3025,0.0625,0,0.16,0,0.1296,0.3481,0.2025,0.1521,0.0036,0.0841,0.2304,0.0169,0.0064,0.0576,0.0144,1,0.6889,0.1446,0.079585714,0.209614286,23,71.88,27,84.38,8,100,5,62.5,7,87.5,7,87.5,13,81.25,14,87.5,82.28,65.12,83.25,85.88,94.88,83.69,80.88,-12.5,-2.1,-34.88,20.75,-1.62,7.38,2.44,-6.62,1,2,1,2,0,0,1,0,3,1,1,0,0,0,0,1,3,2,1,0,1,1,0,3,2,0,1,1,1,1,0,0,0,1,1,3,0,2,3,0,1.2,1,0.2,1.4,1.4,0.8,0.4,1.6,0.95,1.05,4.33,6,-1,-1,-3,3,-1.67,10 cents,5 minutes,24 days,Male,University - Undergraduate,68,-0.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,1,1,-1,-2,0,0,-1,2,0,1,0,0,-1,-1,-2,3,0,-2,0,-0.2,0.2,-0.2,-0.2,-0.1 +63,R_5Yuhp62PhCluVLy,67 - 73,Canadian,Female,2,1,3,-2,3,-1,-3,3,-3,0,3,0,3,-1,3,2,2,2,3,2,2,1,3,-3,3,1,-3,-3,3,-3,1,1,3,1,3,1,3,1,3,3,3,3,2,1,3,1,3,-3,3,1,-3,-3,3,-3,1,1,3,1,3,-2,3,1,3,3,3,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,62,FALSE,1,100,TRUE,0,75,FALSE,1,100,TRUE,1,77,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,80,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,1,0,0,0,0.5625,0,0,0,0,0,0,0,0.25,0,0,0,0.2916,0,0,0.0529,0.2401,0.5625,0,0.1444,0.64,0,1,1,0,0,0,0.169428571,0.078864286,0.259992857,29,90.63,25,78.13,5,62.5,7,87.5,6,75,7,87.5,15,93.75,10,62.5,91.38,76.25,89.25,100,100,95.5,87.25,12.5,13.25,13.75,1.75,25,12.5,1.75,24.75,0,0,0,1,0,2,0,0,0,1,0,1,0,2,0,1,1,1,0,0,1,0,0,1,0,2,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0.2,0.6,0.6,0.6,0.4,0.6,0.4,0.8,0.5,0.55,1,1,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),70,1,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,-1,-0.2,0,0.2,-0.2,-0.05 +64,R_1dMoiYjw25x8NIn,39 - 45,Canadian,Male,-3,3,-3,3,0,-3,2,3,3,2,3,1,3,3,3,1,1,-2,1,0,1,2,-3,1,0,6,-1,2,2,2,1,7,2,0,2,1,1,7,0,1,1,2,1,6,3,3,-1,3,2,7,-1,1,3,1,3,6,3,2,3,3,3,7,2,2,2,2,2,7,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,0,51,FALSE,0,51,FALSE,1,52,FALSE,0,52,TRUE,1,73,TRUE,1,68,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,0,54,FALSE,1,56,FALSE,0,52,FALSE,0,53,TRUE,0,53,TRUE,0,100,TRUE,0,53,TRUE,0,54,FALSE,0,100,TRUE,1,53,FALSE,1,53,FALSE,0,54,FALSE,1,100,TRUE,1,72,FALSE,1,100,FALSE,1,100,TRUE,0,54,TRUE,1,100,FALSE,0,69,TRUE,1,100,0.0729,0.0784,0.2809,0.2704,0,0.2304,0.2916,0,0.2916,0.2209,0,0.2916,0.1024,0.2916,0.2601,0.3025,0.2209,0.2601,0,0,1,0.2704,0.2809,0.1936,0.2809,0,0.4761,0,0,1,0.2916,1,0.2699,0.197407143,0.342392857,14,43.75,15,46.88,2,25,3,37.5,6,75,4,50,7,43.75,8,50,71.44,62.75,64.62,79.12,79.25,69.12,73.75,-3.13,24.56,37.75,27.12,4.12,29.25,25.37,23.75,4,1,0,2,0,2,0,1,1,1,1,1,1,2,2,1,0,3,1,1,6,0,2,0,2,2,1,0,2,1,0,1,0,0,0,1,1,4,1,2,1.4,1,1.4,1.2,2,1.2,0.2,1.8,1.25,1.3,6.67,6.67,-1,1,0,-1,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,42,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-2,1,-2,2,-2,0,-1,1,-1,0,1,0,1,2,2,0,-1,-1,0,-1,-0.6,-0.2,1.2,-0.6,-0.05 +65,R_737tNmqawo6NYoU,25 - 31,Canadian,Male,2,3,2,-3,3,-3,2,2,1,1,-1,-2,3,-3,2,-3,-2,-3,-3,-3,-2,2,2,-2,-1,8,-3,3,-3,3,-3,8,-3,-3,1,-3,2,6,-3,-2,-3,-3,-3,1,2,3,1,-3,3,3,1,-2,3,-2,2,8,-1,-2,3,-3,2,2,-1,-1,-1,-1,-3,6,FALSE,1,90,FALSE,0,50,FALSE,1,91,TRUE,0,55,TRUE,1,75,FALSE,1,100,TRUE,1,55,TRUE,1,70,TRUE,1,85,TRUE,1,70,TRUE,0,55,TRUE,0,65,TRUE,1,90,FALSE,1,55,TRUE,1,55,FALSE,0,55,TRUE,0,70,TRUE,0,80,FALSE,1,55,FALSE,1,55,TRUE,1,65,FALSE,0,55,TRUE,0,80,TRUE,1,60,TRUE,0,70,TRUE,1,60,FALSE,1,55,TRUE,0,55,TRUE,0,55,TRUE,1,80,TRUE,1,75,FALSE,0,55,0.09,0.16,0.3025,0.2025,0.3025,0,0.16,0.09,0.2025,0.3025,0.04,0.01,0.0225,0.3025,0.0625,0.25,0.64,0.3025,0.3025,0.49,0.1225,0.2025,0.2025,0.2025,0.49,0.2025,0.0625,0.01,0.0081,0.64,0.3025,0.4225,0.226717857,0.191964286,0.261471429,16,50,19,59.38,5,62.5,4,50,5,62.5,5,62.5,12,75,7,43.75,66.91,60.62,73.75,66.88,66.38,65.94,67.88,-9.38,7.53,-1.88,23.75,4.38,3.88,-9.06,24.13,4,1,0,1,4,0,1,5,2,4,2,1,2,0,0,0,0,0,0,0,0,0,1,0,0,4,4,1,3,1,0,0,0,0,0,2,1,2,2,0,2,2.4,1,0,0.2,2.6,0,1.4,1.35,1.05,7.33,4.33,5,0,4,-5,3,5 cents,5 minutes,47 days,Male,High School (or equivalent),26,1.625,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,4,1,-1,1,4,-4,-3,4,-1,3,2,1,2,0,0,-2,-1,-2,-2,0,1.8,-0.2,1,-1.4,0.3 +66,R_31aufd3cGtnHFI0,53 - 59,Canadian,Female,3,3,1,-3,-3,-1,0,2,-1,-1,2,3,1,-1,1,-3,-3,-3,0,-3,2,2,0,-3,-3,9,1,1,0,-1,1,5,2,2,2,-1,1,0,-3,0,-3,-3,-3,0,3,3,1,-3,-3,0,1,-1,2,0,-1,0,2,3,1,-1,1,0,-3,-3,-3,-3,-3,0,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,0,53,TRUE,1,56,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,55,TRUE,0,100,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,0,50,FALSE,1,74,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,70,FALSE,1,56,TRUE,1,87,FALSE,0,60,TRUE,1,50,0.1936,0,0.25,0.2809,0.25,0.25,0.25,0,0.25,0.25,0.0169,0.25,0.25,0.25,0.25,0.25,0.0676,0.25,0.49,1,0.25,0.25,0.25,0.25,0.2025,0.25,0.36,0.25,0,1,0.1936,1,0.30645,0.202464286,0.410435714,9,28.13,16,50,4,50,6,75,3,37.5,3,37.5,8,50,8,50,62.84,51.25,54.38,75.38,70.38,59.75,65.94,-21.87,12.84,1.25,-20.62,37.88,32.88,9.75,15.94,1,1,1,0,0,2,1,2,0,2,0,1,1,0,0,0,3,0,3,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,3,0,0.6,1.4,0.4,1.2,0,0.8,0,0.6,0.9,0.35,4.67,0,9,5,0,0,4.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),53,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,1,1,0,0,0,0,2,-1,2,0,1,1,0,0,0,3,0,0,0,0.6,0.6,0.4,0.6,0.55 +67,R_78rnoTc0MRM3n7X,53 - 59,Canadian,Female,3,3,3,2,0,-2,1,1,2,0,1,0,1,1,2,1,0,1,3,-2,2,3,2,2,1,1,1,0,0,3,0,3,0,1,0,1,1,3,-2,-3,-2,-2,-2,5,2,2,1,0,1,1,0,0,1,-1,1,6,1,0,1,1,2,1,1,1,2,2,0,3,TRUE,0,95,TRUE,1,80,TRUE,0,69,TRUE,0,63,TRUE,1,90,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,77,TRUE,1,74,TRUE,0,98,TRUE,1,50,TRUE,1,100,TRUE,0,58,TRUE,0,89,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,96,FALSE,1,76,TRUE,1,50,TRUE,0,64,FALSE,1,50,FALSE,1,58,TRUE,1,50,FALSE,0,50,TRUE,1,96,0,0.25,0,0,0.0016,0.2304,0.0016,0.0025,0.25,0.0025,0.25,0.0676,0.25,0.25,0.01,0.04,0,0.3969,0.25,0.0576,0.25,0.25,0.25,0.9604,0.3364,0.4096,0.25,0.9025,0.4761,0.7921,0.1764,0.0529,0.255967857,0.125221429,0.386714286,24,75,22,68.75,3,37.5,7,87.5,5,62.5,7,87.5,15,93.75,7,43.75,72.66,57.12,72.25,87.25,74,76.62,68.69,6.25,3.91,19.62,-15.25,24.75,-13.5,-17.13,24.94,1,0,1,0,1,3,1,1,1,0,1,1,1,0,1,3,3,3,5,0,1,1,2,2,1,2,1,0,3,1,0,0,0,0,0,0,1,1,1,2,0.6,1.2,0.8,2.8,1.4,1.4,0,1,1.35,0.95,2.33,2.67,0,-3,2,2,-0.34,10 cents,100 minutes,15 days,Female,University - Undergraduate,54,1.375,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,-1,-1,-2,0,1,0,1,-2,-1,1,1,1,0,1,3,2,2,4,-2,-0.8,-0.2,0.8,1.8,0.4 +68,R_1VmdyPIjBNvrern,60 - 66,American,Female,2,3,2,3,2,1,-2,1,-3,1,1,3,2,3,1,2,2,2,2,1,1,1,1,1,2,8,1,-2,1,0,0,8,0,1,0,1,0,8,3,2,2,2,1,8,2,2,1,1,1,8,1,-1,-1,-1,1,7,0,1,0,1,0,8,2,2,2,3,1,7,TRUE,0,100,FALSE,0,71,FALSE,1,96,TRUE,0,76,TRUE,1,86,FALSE,1,78,TRUE,1,87,TRUE,1,97,TRUE,1,84,TRUE,1,92,FALSE,1,74,TRUE,0,94,TRUE,1,76,FALSE,1,65,FALSE,0,74,FALSE,0,90,FALSE,1,69,FALSE,1,88,FALSE,1,72,FALSE,1,70,FALSE,0,79,FALSE,0,75,FALSE,1,73,TRUE,1,73,FALSE,1,91,TRUE,1,91,FALSE,1,74,FALSE,1,78,TRUE,0,82,TRUE,1,89,FALSE,0,71,TRUE,1,80,0.0009,0.0081,0.81,0.0169,0.04,0.0484,0.0729,0.0064,0.09,0.5625,0.0121,0.0576,0.0256,0.0676,0.0196,0.5041,0.0729,0.5776,0.0484,0.0081,0.6241,0.5476,0.0784,0.1225,0.0961,0.0676,0.5041,1,0.0016,0.0144,0.6724,0.8836,0.243792857,0.154092857,0.333492857,26,81.25,22,68.75,4,50,6,75,6,75,6,75,10,62.5,12,75,81.09,74.5,77.88,86.12,85.88,82.19,80,12.5,12.34,24.5,2.88,11.12,10.88,19.69,5,1,2,1,2,0,0,0,0,3,1,1,2,2,2,1,1,0,0,0,0,0,1,1,2,1,0,1,2,2,0,1,2,2,2,1,0,0,0,1,0,1.2,0.8,1.6,0.2,1,1,1.6,0.2,0.95,0.95,8,7.67,0,1,0,1,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),61,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,1,1,0,0,-1,0,-1,-2,1,1,0,0,0,0,0,1,0,0,-1,0,0.2,-0.2,0,0,0 +69,R_1xqCkBaPxJEbxrX,67 - 73,American,Female,2,2,1,0,0,-2,-3,2,-1,0,2,-3,3,-2,3,0,1,2,2,0,2,2,1,0,0,0,-2,-3,3,0,0,1,2,-3,3,-3,3,0,0,0,2,2,0,0,2,2,1,1,0,1,-3,-3,3,-1,-1,2,2,-3,3,-3,3,0,0,-1,1,1,0,2,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,96,FALSE,1,100,TRUE,0,90,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,80,TRUE,0,91,TRUE,1,90,FALSE,1,50,TRUE,0,81,FALSE,1,50,TRUE,1,91,TRUE,1,89,TRUE,1,100,0,0.01,0.0016,0.25,0,0,0.04,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0.25,0,0,0.25,0.6561,0.8281,0.25,0.25,0.25,0.25,0,0.25,0.0121,0.25,0,0.81,0.25,1,0.253728571,0.146292857,0.361164286,16,50,25,78.13,7,87.5,7,87.5,5,62.5,6,75,14,87.5,11,68.75,72.12,61.12,75,65.12,87.25,71.62,72.62,-28.13,-6.01,-26.38,-12.5,2.62,12.25,-15.88,3.87,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,2,1,1,0,0,0.4,0.2,0.2,0.2,0.6,0.2,0.8,0.2,0.45,0.33,1,-1,-1,0,-2,-0.67,10 cents,5 minutes,24 days,Female,Trade School (non-military),72,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,-1,0,-1,0,0,1,-1,0,0,0,0,0,0,-1,-1,-1,0,-0.2,-0.2,0,-0.6,-0.25 +70,R_3Pd9d7qCcQ4RYat,67 - 73,Canadian,Female,1,2,3,-2,-2,1,-3,3,-2,-3,2,1,3,-3,3,2,2,2,3,2,2,2,3,-3,-2,0,2,-3,3,-2,-3,0,2,2,3,-3,3,0,3,3,2,3,3,0,1,2,3,1,-3,0,1,-3,3,-2,-3,0,2,3,3,-3,3,0,3,2,3,3,3,0,TRUE,0,50,FALSE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,100,FALSE,1,56,FALSE,1,100,FALSE,0,59,TRUE,1,68,FALSE,1,93,FALSE,0,50,TRUE,0,95,TRUE,1,75,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,0,0.0625,0.09,0.0196,0,0,0.25,0,0,0.1024,0,1,0.25,0,0.25,1,0.0049,0.25,0,0.9025,0.3481,0.25,0.1936,0,0.25,0.25,0.0001,0.25,1,0,1,1,0.305414286,0.22195,0.388878571,24,75,19,59.38,4,50,4,50,6,75,5,62.5,9,56.25,10,62.5,81.28,69.38,81.5,84.25,90,78.56,84,15.62,21.9,19.38,31.5,9.25,27.5,22.31,21.5,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,3,1,0,0,0,0,0,0,2,0,0,0,1,0,1,0,1,0.4,0.2,0.2,0.6,0.8,0,0.4,0.6,0.35,0.45,0,0,0,0,0,0,0,10 cents,5 minutes,47 days,Female,High School (or equivalent),68,0.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,1,0,0,-2,-1,1,0,0,0,0,0,-1,0,0,0,0,1,-1,0,0,-0.4,0.2,-0.2,0,-0.1 +71,R_1OJKQA1K4pCkc37,67 - 73,Canadian,Female,2,3,3,-3,1,1,0,1,-2,-1,3,3,2,0,0,2,1,3,2,2,3,3,3,-3,2,8,1,-3,-1,-3,-3,6,3,3,2,2,-1,6,2,2,2,0,1,8,1,3,3,-3,-1,0,3,-3,3,-3,0,3,3,3,2,-1,1,2,3,3,3,3,2,1,FALSE,1,100,FALSE,0,80,TRUE,0,100,FALSE,1,64,FALSE,0,81,TRUE,0,77,TRUE,1,94,TRUE,1,100,TRUE,1,74,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,TRUE,0,89,FALSE,0,62,FALSE,0,100,FALSE,1,93,TRUE,0,100,FALSE,1,67,FALSE,1,74,FALSE,0,100,FALSE,0,63,FALSE,1,67,TRUE,1,70,FALSE,1,66,TRUE,1,100,TRUE,0,59,TRUE,0,98,FALSE,1,85,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,1,0.0036,0,0.5929,0.09,0,0.0676,0.3969,0,0,0.0676,0.64,0.6561,0.64,0.1089,0.1296,0.9604,0.1156,1,0.3844,0.1089,0.7921,0.0049,0.3481,0.3025,0,1,1,0.0225,1,0.372464286,0.242114286,0.502814286,27,84.38,17,53.13,3,37.5,5,62.5,5,62.5,4,50,9,56.25,8,50,84.31,67.62,87.88,89,92.75,86.19,82.44,31.25,31.18,30.12,25.38,26.5,42.75,29.94,32.44,1,0,0,0,1,0,3,2,1,2,0,0,0,2,1,0,1,1,2,1,1,0,0,0,2,2,3,2,1,1,0,0,0,1,1,1,2,0,1,0,0.4,1.6,0.6,1,0.6,1.8,0.4,0.8,0.9,0.9,6.67,1.67,8,3,4,7,5,10 cents,75 minutes,36 days,Female,High School (or equivalent),67,0.875,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,-1,-2,0,0,0,1,0,0,0,1,0,-1,-1,1,1,1,-0.2,-0.2,0.2,0.2,0 +72,R_6YJKAzC8xCjFbpC,67 - 73,Canadian,Male,3,3,-1,-1,2,-1,-2,3,-3,0,3,1,3,0,3,3,3,3,3,3,3,3,3,-2,3,3,0,-2,3,-3,1,2,3,1,3,-2,3,2,3,3,3,3,3,0,3,3,0,1,3,1,0,-1,3,-3,-1,2,3,2,3,-2,3,1,3,3,3,3,3,0,FALSE,1,100,FALSE,0,80,FALSE,1,100,FALSE,1,69,TRUE,1,68,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,75,FALSE,1,100,TRUE,1,88,TRUE,1,82,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0.0324,0,0,0,0.8281,0.1024,0.64,0,0.0961,0,0,0.0144,0.0625,0.5625,0,0,0.5776,0,0,0,0,1,1,0.211285714,0.192785714,0.229785714,30,93.75,25,78.13,4,50,6,75,8,100,7,87.5,15,93.75,10,62.5,93.88,83.25,94.5,97.75,100,93.31,94.44,15.62,15.75,33.25,19.5,-2.25,12.5,-0.44,31.94,0,0,4,1,1,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,1,2,1,1,1,0,0,1,0,1,0,2,0,0,0,0,0,0,1.2,0.4,0.4,0,0.8,0.6,0.6,0,0.5,0.5,2.33,1.33,2,0,1,0,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),68,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,3,-1,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0.4,-0.2,-0.2,0,0 +73,R_6Lo0CIpx8AJk2Yx,53 - 59,Canadian,Male,-1,2,2,2,2,1,1,2,2,2,1,1,2,2,2,-1,1,-1,1,-1,-1,2,2,2,2,8,2,-1,2,2,2,8,1,2,2,1,2,8,1,2,1,1,-1,7,-1,2,2,1,2,8,1,1,2,2,1,7,1,1,2,1,2,7,1,-1,1,1,-1,7,TRUE,0,92,TRUE,1,80,FALSE,1,65,TRUE,0,69,TRUE,1,73,FALSE,1,92,TRUE,1,82,TRUE,1,73,TRUE,1,74,TRUE,1,95,FALSE,1,77,TRUE,0,91,TRUE,1,88,TRUE,0,73,TRUE,1,76,TRUE,1,78,TRUE,0,74,TRUE,0,92,TRUE,0,73,FALSE,1,82,FALSE,0,87,FALSE,0,80,FALSE,1,87,TRUE,1,81,TRUE,0,87,TRUE,1,90,FALSE,1,83,TRUE,0,89,TRUE,0,87,TRUE,1,91,TRUE,1,86,TRUE,1,97,0.0729,0.01,0.0484,0.0324,0.0009,0.0064,0.0361,0.0025,0.0324,0.64,0.0081,0.0144,0.0676,0.0529,0.0729,0.04,0.0169,0.4761,0.7921,0.7569,0.7569,0.0576,0.5329,0.5329,0.5476,0.0289,0.0196,0.8464,0.1225,0.8464,0.7569,0.8281,0.317603571,0.1048,0.530407143,28,87.5,20,62.5,6,75,5,62.5,3,37.5,6,75,14,87.5,6,37.5,82.62,77.25,85.62,86.38,81.25,83.19,82.06,25,20.12,2.25,23.12,48.88,6.25,-4.31,44.56,0,0,0,0,0,1,2,0,0,0,0,1,0,1,0,2,1,2,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,2,2,0,0,0,0.6,0.4,1,0.2,0.2,0.2,1.2,0.5,0.45,8,7.33,0,1,1,0,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,-0.25,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,1,2,0,0,-1,0,1,0,0,0,0,-1,0,0,0,-0.2,0.4,0.2,-0.2,0.05 +74,R_6UarpWzGi9zvY9X,46 - 52,Canadian,Male,2,3,2,2,3,-1,-1,-1,-2,1,1,0,2,-1,1,2,2,3,0,2,3,3,3,0,1,7,-2,1,1,0,-1,3,0,-1,2,1,0,7,2,2,2,1,-1,9,1,3,0,3,2,5,-2,0,0,-2,-1,3,-1,0,1,-2,0,5,1,1,2,1,2,7,FALSE,1,100,FALSE,0,95,FALSE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,98,TRUE,1,96,TRUE,1,92,TRUE,1,85,FALSE,1,70,FALSE,1,70,TRUE,1,87,FALSE,1,100,FALSE,0,60,TRUE,1,95,FALSE,1,90,TRUE,0,100,TRUE,0,75,FALSE,1,100,FALSE,0,100,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,90,TRUE,1,100,FALSE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,64,TRUE,1,80,0.0016,0,0.0025,0.0004,0.04,0,0.01,0.0225,0,0.0225,0.01,0.0169,0.0064,0.09,0.01,0.9025,0,0.36,0,0.01,1,0.36,0.5625,0,0.01,0.01,0.1296,0,0,1,0,0.09,0.166532143,0.106485714,0.226578571,27,84.38,26,81.25,4,50,7,87.5,7,87.5,8,100,13,81.25,13,81.25,89.12,75.75,93.38,94.75,92.62,87.94,90.31,3.13,7.87,25.75,5.88,7.25,-7.38,6.69,9.06,1,0,1,2,2,1,2,2,2,2,1,1,0,2,1,0,0,1,1,3,1,0,2,1,1,1,1,1,0,2,2,0,1,1,1,1,1,1,1,0,1.2,1.8,1,1,1,1,1,0.8,1.25,0.95,5.67,4.33,2,0,2,2,1.34,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,46,0.625,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,-1,1,1,0,1,1,2,0,-1,1,-1,1,0,-1,-1,0,0,3,0.2,0.8,0,0.2,0.3 +75,R_3onatePMIchcixw,53 - 59,Canadian,Male,-2,2,1,1,3,3,-3,3,-3,2,2,-2,3,-2,2,2,2,2,3,2,-2,2,1,1,3,1,2,-3,2,-3,2,1,2,-2,3,-2,2,1,2,2,2,3,2,1,-2,2,1,1,3,1,2,-3,3,-3,2,1,2,-3,3,-3,3,1,2,2,2,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,91,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,73,FALSE,0,73,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,FALSE,1,84,FALSE,1,73,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,88,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0144,0.5329,0,0,0,0,0.5329,0,0,0,0,0.0625,0,0,1,0.09,0.0729,1,0,1,0,1,0.8281,0.0256,1,1,0.291403571,0.081621429,0.501185714,25,78.13,23,71.88,6,75,6,75,5,62.5,6,75,13,81.25,10,62.5,94.59,86.38,100,94.62,97.38,94,95.19,6.25,22.71,11.38,25,32.12,22.38,12.75,32.69,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0.4,0,0,0,0.2,0.6,0.2,0.1,0.25,1,1,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,58,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,1,0,0,0,-1,0,-1,-1,0,0,0,0,-1,0,0.2,-0.6,-0.2,-0.15 +76,R_7xSlTDefzznUrD7,67 - 73,Canadian,Female,2,1,2,-1,3,-2,-1,1,1,0,3,2,0,-3,1,0,0,2,2,-1,2,1,3,-3,3,2,-1,-1,1,-1,0,5,3,3,1,-3,1,1,2,2,2,2,1,7,1,1,2,1,1,6,2,0,0,1,-1,7,3,2,1,-3,2,2,-1,-1,0,1,-2,5,TRUE,0,80,TRUE,1,59,FALSE,1,75,FALSE,1,53,FALSE,0,59,FALSE,1,59,TRUE,1,85,TRUE,1,89,FALSE,0,50,TRUE,1,85,FALSE,1,54,TRUE,0,90,TRUE,1,87,TRUE,0,80,TRUE,1,57,TRUE,1,83,TRUE,0,84,TRUE,0,79,FALSE,1,54,FALSE,1,56,TRUE,1,50,FALSE,0,55,FALSE,1,52,TRUE,1,92,TRUE,0,84,TRUE,1,80,FALSE,1,50,FALSE,1,80,FALSE,1,53,TRUE,1,90,TRUE,1,50,TRUE,1,100,0.0121,0.04,0.0289,0.0225,0,0.1681,0.0064,0.0225,0.1936,0.3025,0.01,0.0169,0.25,0.2116,0.3481,0.1681,0.2304,0.2209,0.04,0.7056,0.25,0.1849,0.2116,0.64,0.7056,0.25,0.25,0.64,0.0625,0.6241,0.2209,0.81,0.276582143,0.153507143,0.399657143,19,59.38,23,71.88,7,87.5,6,75,3,37.5,7,87.5,13,81.25,10,62.5,70.44,53.38,68,78.5,81.88,73.19,67.69,-12.5,-1.44,-34.12,-7,41,-5.62,-8.06,5.19,0,0,1,2,0,1,0,0,2,0,0,1,1,0,0,2,2,0,0,2,1,0,0,2,2,4,1,1,0,1,0,0,1,0,1,1,1,2,1,1,0.6,0.6,0.4,1.2,1,1.4,0.4,1.2,0.7,1,2.67,5,-4,-2,-1,2,-2.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,0,1,0,-2,-3,-1,-1,2,-1,0,1,0,0,-1,1,1,-2,-1,1,-0.4,-0.8,0,0,-0.3 +77,R_7huVumcWu2J2f9D,67 - 73,American,Female,2,2,3,2,3,-2,-1,1,2,-1,1,-1,2,-3,1,-2,-2,-1,-1,-2,2,2,3,-1,2,8,-3,1,1,1,-1,8,1,1,2,-3,1,8,1,1,1,-1,1,5,2,2,3,2,2,10,-3,-2,1,1,-1,9,1,1,2,-3,2,9,0,-2,-1,-2,-2,8,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,86,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,65,TRUE,0,100,FALSE,0,50,TRUE,1,70,FALSE,1,90,FALSE,1,80,FALSE,1,50,FALSE,1,70,TRUE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,92,TRUE,0,83,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.0064,0.09,0,0,0.0016,0,0,0.09,0.25,0,0.1225,0.0064,0.25,0.0196,0,0,0.25,0.0064,0,0.25,0.25,0.25,1,0.01,0.25,0.25,0.2025,0,0.04,0.6889,1,0.185282143,0.070721429,0.299842857,22,68.75,27,84.38,6,75,7,87.5,7,87.5,7,87.5,15,93.75,12,75,80.34,61.5,83.75,84.62,91.5,81.56,79.12,-15.63,-4.04,-13.5,-3.75,-2.88,4,-12.19,4.12,0,0,0,3,1,1,2,0,1,0,0,2,0,0,0,3,3,2,0,3,0,0,0,0,1,1,1,0,1,0,0,2,0,0,1,2,0,0,1,0,0.8,0.8,0.4,2.2,0.2,0.6,0.6,0.6,1.05,0.5,8,9.33,-2,-1,-1,-3,-1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,70,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,3,0,0,1,0,0,0,0,0,0,0,-1,1,3,2,-1,3,0.6,0.2,-0.2,1.6,0.55 +78,R_7dLMCYItO3tbRjp,60 - 66,Canadian,Female,2,2,3,-1,0,-1,-1,1,1,-1,2,1,1,-2,1,0,2,2,1,-1,2,2,3,-1,0,0,-1,-1,2,1,-1,1,2,1,1,-2,1,1,1,1,2,1,-1,1,2,2,3,-1,0,1,1,-1,1,1,-1,1,2,1,1,-1,1,1,1,0,1,1,-1,1,TRUE,0,61,FALSE,0,50,FALSE,1,96,FALSE,1,50,FALSE,0,50,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,92,TRUE,1,84,FALSE,1,72,FALSE,0,50,TRUE,1,55,TRUE,0,50,TRUE,0,99,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,51,TRUE,0,50,TRUE,1,100,FALSE,1,79,TRUE,1,100,TRUE,0,53,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.2025,0,0,0.2304,0,0,0.25,0.2401,0,0.0256,0.25,0.25,0.25,0.25,0.25,0.25,1,0.0441,0.25,0.25,0.25,0.0784,0.25,0.2809,0.25,0.3721,0.0016,0.9801,1,0.8464,0.289275,0.160435714,0.418114286,26,81.25,18,56.25,3,37.5,3,37.5,6,75,6,75,11,68.75,7,43.75,71.69,50.38,67,82.75,86.62,74.38,69,25,15.44,12.88,29.5,7.75,11.62,5.63,25.25,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,1,2,1,0,0,0,0.2,0,0.4,0,0.4,0.2,0.8,0.15,0.35,0.67,1,-1,0,0,0,-0.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),62,0,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,-2,0,1,0,0,0,0,0,-1,0,0,-1,-1,0,0,0,-0.2,-0.2,-0.4,-0.2 +79,R_5e4W9ZBiMs9fFz2,67 - 73,American,Female,3,2,1,-2,3,2,-3,2,-1,2,1,-1,3,-2,3,-2,-2,1,0,-1,3,2,2,-3,3,7,2,-3,2,1,3,8,1,1,3,-2,3,9,-1,1,1,-1,-2,8,3,1,0,1,1,7,1,-3,2,-1,2,9,-1,-1,2,-3,2,8,1,0,2,2,1,7,TRUE,0,77,TRUE,1,100,TRUE,0,98,FALSE,1,60,TRUE,1,92,FALSE,1,90,TRUE,1,99,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,66,TRUE,1,100,TRUE,0,82,TRUE,0,100,FALSE,1,69,FALSE,1,100,TRUE,1,78,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,0,85,FALSE,1,90,TRUE,0,99,TRUE,1,92,TRUE,1,99,TRUE,1,100,0,0,0,0.0001,0,0.01,0.0081,0,0,0,0.0064,1,0.0256,0.0016,0.0064,0,0,0.16,0.01,0,0.0484,0.1156,0.0961,1,0.6724,0.7225,0.0001,0.5929,0.9604,1,0.9801,1,0.300592857,0.087007143,0.514178571,24,75,23,71.88,7,87.5,5,62.5,5,62.5,6,75,15,93.75,8,50,92.09,82.38,92.62,97,96.38,93.81,90.38,3.12,20.21,-5.12,30.12,34.5,21.38,0.06,40.38,0,0,1,1,0,0,0,0,2,1,0,2,0,0,0,1,3,0,1,1,0,1,1,3,2,1,0,0,0,0,2,0,1,1,1,3,2,1,2,2,0.4,0.6,0.4,1.2,1.4,0.2,1,2,0.65,1.15,8,8,0,-1,1,1,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,67,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,-1,0,-2,-2,-1,0,0,2,1,-2,2,-1,-1,-1,-2,1,-1,-1,-1,-1,0.4,-0.6,-0.8,-0.5 +80,R_51v3e3OUwwSDNlp,67 - 73,American,Female,3,3,0,0,0,-2,-2,2,-1,1,2,2,2,-2,3,-1,0,2,2,-2,3,3,0,-3,2,3,-3,-3,2,-3,2,1,2,2,2,-3,2,1,-3,0,-2,1,-3,7,2,2,0,0,0,2,-3,-3,2,-3,2,1,2,2,2,-3,3,0,1,0,2,2,-2,1,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,80,TRUE,1,100,FALSE,1,72,FALSE,1,92,TRUE,0,90,FALSE,1,100,FALSE,0,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0.0081,1,0,0,0,0.3025,0,0,0.5041,0.04,0.81,1,0.0784,1,0,1,0,0.0064,1,0,0.276767857,0.165042857,0.388492857,28,87.5,23,71.88,4,50,5,62.5,6,75,8,100,14,87.5,9,56.25,95.34,89.5,92.88,99,100,96.38,94.31,15.62,23.46,39.5,30.38,24,0,8.88,38.06,0,0,0,3,2,1,1,0,2,1,0,0,0,1,1,2,0,4,1,1,1,1,0,0,0,1,1,0,2,1,0,0,0,1,0,2,0,0,0,0,1,1,0.4,1.6,0.4,1,0.2,0.4,1,0.5,1.67,1,1,0,1,6,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,69,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,-1,0,3,2,0,0,0,0,0,0,0,0,0,1,0,0,4,1,1,0.6,0,0.2,1.2,0.5 +81,R_3NLRhLB8UD8d65b,67 - 73,American,Male,0,2,3,2,2,-3,-3,3,-3,-1,3,1,2,-2,1,2,1,2,2,-1,0,2,1,-1,2,3,-3,-3,3,-3,2,1,3,2,2,-2,2,1,2,2,2,2,-3,8,-1,1,3,3,-1,7,-3,-3,3,-2,-1,5,3,2,2,-3,1,4,-1,-1,1,2,-1,8,TRUE,0,81,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,62,FALSE,1,100,FALSE,1,100,TRUE,1,66,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,58,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,88,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,72,TRUE,1,100,0,0,0,0,0,0,0,0.3844,0,0,0,0.1156,0,0,0,0,0,0.25,0,0.0144,0,0.25,0.3364,0,0,0.25,0.0784,0.6561,1,1,1,0,0.190546429,0.053571429,0.327521429,28,87.5,25,78.13,6,75,7,87.5,5,62.5,7,87.5,15,93.75,10,62.5,89.91,72.5,95.75,91.38,100,90.62,89.19,9.37,11.78,-2.5,8.25,28.88,12.5,-3.13,26.69,0,0,2,3,0,0,0,0,0,3,0,1,0,0,1,0,1,0,0,2,1,1,0,1,3,0,0,0,1,0,0,1,0,1,0,3,2,1,0,0,1,0.6,0.4,0.6,1.2,0.2,0.4,1.2,0.65,0.75,1.67,5.33,-4,-4,-3,0,-3.66,10 cents,5 minutes,47 days,Male,High School (or equivalent),72,1.375,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,-1,-1,2,2,-3,0,0,0,-1,3,0,0,0,-1,1,-3,-1,-1,0,2,-0.2,0.4,0,-0.6,-0.1 +82,R_77kyIslwbC2FY80,60 - 66,Canadian,Male,3,3,3,1,3,-2,1,-1,2,1,2,1,1,-1,3,-1,-1,-1,1,0,3,3,3,1,3,6,0,1,-1,1,0,6,3,2,2,1,3,4,1,-1,0,2,1,8,3,3,3,1,3,6,1,-1,0,1,0,6,2,1,0,0,3,5,1,-1,1,-1,1,6,FALSE,1,95,TRUE,1,93,TRUE,0,100,FALSE,1,95,TRUE,1,95,FALSE,1,73,TRUE,1,89,TRUE,1,67,TRUE,1,67,TRUE,1,92,TRUE,0,90,TRUE,0,98,TRUE,1,100,TRUE,0,66,TRUE,1,94,TRUE,1,100,TRUE,0,93,TRUE,0,90,TRUE,0,97,TRUE,0,91,FALSE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,85,FALSE,0,68,TRUE,0,100,FALSE,1,77,TRUE,0,100,TRUE,1,97,FALSE,0,78,TRUE,1,95,0.1089,0.4624,0,0.0121,0.0025,0.0729,0,0.0064,0.8281,0,0.0009,0,0.1089,0.81,0.0025,0.0049,0,0.0025,0.0529,0.7225,0.4624,0.0036,0.9409,0.4356,0.8649,1,0.6084,0.0025,1,0.81,1,0.9604,0.382275,0.1314,0.63315,28,87.5,18,56.25,4,50,5,62.5,4,50,5,62.5,13,81.25,5,31.25,89.16,89.25,90.5,85.62,91.25,87.69,90.62,31.25,32.91,39.25,28,35.62,28.75,6.44,59.37,0,0,0,0,0,2,0,0,1,1,1,1,1,2,0,2,0,1,1,1,0,0,0,0,0,3,2,1,1,1,0,0,1,1,0,2,0,2,2,1,0,0.8,1,1,0,1.6,0.4,1.4,0.7,0.85,5.33,5.67,0,0,-1,2,-0.34,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),65,0,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,-2,-1,0,0,1,1,0,1,0,0,0,-1,-1,0,0,-0.8,0.6,-0.4,-0.15 +83,R_1jSRqk2G1NpcOcH,67 - 73,American,Female,-1,-1,1,1,2,0,-1,1,-1,0,2,2,2,1,2,1,1,1,1,-1,-1,0,1,1,2,5,1,-1,1,-1,1,2,2,1,1,0,1,4,0,1,1,1,-1,4,-1,-1,1,1,2,5,0,-1,1,-1,0,3,1,1,1,0,1,8,1,0,1,1,0,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,64,FALSE,0,100,FALSE,1,80,TRUE,0,100,TRUE,1,78,TRUE,0,100,TRUE,1,73,TRUE,1,89,FALSE,1,100,FALSE,1,100,FALSE,1,71,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,1,77,TRUE,0,100,TRUE,1,100,FALSE,0,74,TRUE,1,100,0,0,0.0121,0,0,0,0,1,0,0,0,0.0484,0.4096,0.04,0,0,0,0.3364,0.0529,0,1,0.0729,0.0841,1,0,0.0676,0.5476,0,0,0,1,1,0.237839286,0.131028571,0.34465,24,75,24,75,5,62.5,6,75,6,75,7,87.5,12,75,12,75,91.81,74.25,97.25,100,95.75,92.38,91.25,0,16.81,11.75,22.25,25,8.25,17.38,16.25,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,1,0.2,0.4,0.8,0.2,0,0,1,0.4,0.4,0.35,3.67,5.33,0,-1,-4,1,-1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,1,0,0,0,1,0,0,0,1,-1,0,0,0,0,1,-1,0,0,-1,0.2,0.4,-0.2,-0.2,0.05 +84,R_5TWlNmjz0LyQSvn,67 - 73,Canadian,Female,3,3,2,1,-2,1,-1,1,3,1,2,0,2,1,2,1,1,2,1,0,3,3,2,1,-1,6,0,1,3,3,1,5,2,0,2,3,2,5,-1,-1,-1,0,0,5,3,3,3,3,-3,3,0,1,0,3,0,4,2,-2,2,0,2,4,1,1,1,1,0,3,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,77,FALSE,0,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,81,FALSE,1,76,TRUE,1,76,TRUE,0,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,87,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,58,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0.0576,0,0.0361,0.5929,0.0225,0,0.0529,0.0025,0,0.04,0.3249,0.7569,1,0,0.3364,0.0196,0,0,1,1,0.0576,0.224996429,0.125857143,0.324135714,23,71.88,24,75,5,62.5,6,75,5,62.5,8,100,13,81.25,11,68.75,91.72,78.88,91.62,100,96.38,91.31,92.12,-3.12,16.72,16.38,16.62,37.5,-3.62,10.06,23.37,0,0,0,0,1,1,2,2,0,0,0,0,0,2,0,2,2,3,1,0,0,0,1,2,1,1,2,1,0,1,0,2,0,1,0,0,0,1,0,0,0.2,1,0.4,1.6,0.8,1,0.6,0.2,0.8,0.65,5.33,3.67,3,1,1,2,1.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),67,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,-1,-2,0,0,0,1,0,-1,0,-2,0,1,0,2,2,2,1,0,-0.6,0,-0.2,1.4,0.15 +85,R_5SB261mcsInzUna,67 - 73,Canadian,Female,-1,2,3,1,-2,-1,-1,1,1,-2,1,1,0,0,1,1,1,1,1,-1,0,1,1,1,1,1,-1,-1,1,1,0,4,1,1,1,1,1,1,-1,0,1,1,1,3,1,1,2,1,0,5,-1,0,1,1,0,5,1,1,1,0,1,5,0,0,0,1,-1,5,TRUE,0,78,TRUE,1,83,TRUE,0,100,TRUE,0,51,TRUE,1,56,FALSE,1,100,TRUE,1,77,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,57,TRUE,0,78,FALSE,0,74,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,55,TRUE,0,74,TRUE,0,76,FALSE,1,100,TRUE,1,69,TRUE,1,53,TRUE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,70,TRUE,0,100,TRUE,1,80,TRUE,1,51,TRUE,1,100,0,0,0,0.0529,0,0,0,0,0,0.2209,0.04,0.5476,0.0256,0.1849,0.1936,0.0289,0.4624,0.2601,0.09,0,0.0961,0.25,0.5776,1,0.3025,0.2809,0.2401,0.6084,1,0.5476,1,0.6084,0.305914286,0.140285714,0.471542857,16,50,20,62.5,5,62.5,4,50,5,62.5,6,75,15,93.75,5,31.25,79.28,63.12,77.75,85.25,91,79.81,78.75,-12.5,16.78,0.62,27.75,22.75,16,-13.94,47.5,1,1,2,0,3,0,0,0,0,2,0,0,1,1,0,2,1,0,0,2,2,1,1,0,2,0,1,0,0,2,0,0,1,0,0,1,1,1,0,0,1.4,0.4,0.4,1,1.2,0.6,0.2,0.6,0.8,0.65,2,5,-4,-1,-4,-2,-3,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,0.75,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,0,1,0,1,0,-1,0,0,0,0,0,0,1,0,1,0,-1,0,2,0.2,-0.2,0.2,0.4,0.15 +86,R_5sz5kJpCL0GuQui,67 - 73,American,Female,0,3,3,0,1,1,0,3,-3,1,3,3,0,0,0,-3,-3,-3,-3,-3,1,3,2,0,2,8,3,0,3,-3,2,3,3,3,3,0,1,4,3,3,1,1,-1,10,1,0,3,1,-1,6,-2,1,-1,1,-3,10,3,3,1,0,0,6,-3,-3,-3,-3,-3,10,TRUE,0,71,FALSE,0,63,TRUE,0,77,TRUE,0,55,FALSE,0,53,FALSE,1,61,TRUE,1,72,TRUE,1,87,TRUE,1,79,TRUE,1,95,FALSE,1,56,TRUE,0,85,FALSE,0,68,TRUE,0,80,FALSE,0,58,TRUE,1,61,FALSE,1,55,TRUE,0,95,TRUE,0,63,TRUE,0,62,FALSE,0,53,FALSE,0,54,FALSE,1,61,TRUE,1,54,TRUE,0,86,TRUE,1,74,TRUE,0,51,TRUE,0,70,TRUE,0,56,TRUE,1,100,TRUE,1,65,TRUE,1,92,0.0169,0.0676,0.1521,0.0784,0.0064,0.1521,0.2116,0.0025,0.3844,0.2916,0,0.4624,0.0441,0.1936,0.2809,0.3969,0.1521,0.3025,0.49,0.7396,0.2809,0.3364,0.3969,0.64,0.2025,0.2601,0.1225,0.5041,0.5929,0.9025,0.3136,0.7225,0.3352,0.205792857,0.464607143,22,68.75,14,43.75,3,37.5,4,50,3,37.5,4,50,10,62.5,4,25,69.12,61.25,62.38,78.38,74.5,70.5,67.75,25,25.37,23.75,12.38,40.88,24.5,8,42.75,1,0,1,0,1,2,0,0,0,1,0,0,3,0,1,6,6,4,4,2,1,3,0,1,2,3,1,4,4,4,0,0,1,0,0,0,0,0,0,0,0.6,0.6,0.8,4.4,1.4,3.2,0.2,0,1.6,1.2,5,7.33,2,-7,-2,0,-2.33,10 cents,100 minutes,24 days,Female,Trade School (non-military),69,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-3,1,-1,-1,-1,-1,-4,-4,-3,0,0,2,0,1,6,6,4,4,2,-0.8,-2.6,0.6,4.4,0.4 +87,R_7RrdYEClXXNwi3F,60 - 66,American,Female,2,2,3,-3,3,1,-3,2,-3,0,2,0,3,-2,3,2,2,2,2,-2,3,3,3,-3,3,1,1,-3,2,-3,0,2,2,0,3,0,2,1,2,2,2,3,-1,2,3,2,3,1,2,1,1,-3,1,-2,-1,1,2,0,3,-3,3,1,0,0,2,2,-1,3,TRUE,0,91,TRUE,1,92,FALSE,1,86,FALSE,1,50,TRUE,1,55,FALSE,1,85,TRUE,1,80,TRUE,1,90,TRUE,1,90,TRUE,1,71,FALSE,1,85,TRUE,0,86,FALSE,0,70,TRUE,0,86,FALSE,0,50,TRUE,1,95,FALSE,1,50,TRUE,0,71,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,100,TRUE,1,95,FALSE,1,60,TRUE,1,75,FALSE,1,50,FALSE,1,60,TRUE,0,90,FALSE,0,60,TRUE,1,60,TRUE,1,75,0.01,0.0625,0.0025,0.04,0.0625,0.0225,0.0025,0.0841,0,0.09,0.36,0.49,0.01,0.0225,0.2025,0.0064,0,0.25,0.16,0.16,0.25,0.25,0.25,0.7396,0.25,0.25,0.16,0.8281,0.0196,0.5041,0.81,0.7396,0.249071429,0.1145,0.383642857,18,56.25,22,68.75,6,75,5,62.5,5,62.5,6,75,12,75,10,62.5,74.31,65.88,71.88,75.5,84,73.62,75,-12.5,5.56,-9.12,9.38,13,9,-1.38,12.5,1,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,1,1,1,0,0,4,1,0,0,1,1,1,0,0,0,1,0,2,2,0,0,1,0.4,0,0.6,0.4,1.2,0.6,0.2,1,0.35,0.75,1.33,1,0,1,0,-1,0.33,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,0.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,1,0,-4,-1,0,0,-1,-1,-1,0,0,0,1,1,-2,-2,0,1,0,-0.8,-0.6,0.4,-0.6,-0.4 +88,R_698vEegpho6l6RH,67 - 73,Canadian,Female,2,3,2,3,0,-2,-2,2,-2,1,-1,0,1,-1,2,-1,0,0,2,2,2,3,2,1,1,3,-3,-2,2,-1,1,3,-1,1,2,1,2,1,-1,-1,-1,1,1,5,2,3,2,2,-1,3,-2,0,1,-2,-1,3,-1,1,1,1,2,2,0,0,1,2,2,4,FALSE,1,60,TRUE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,86,FALSE,1,65,TRUE,0,100,TRUE,1,100,FALSE,1,86,TRUE,1,75,TRUE,1,100,TRUE,0,65,FALSE,1,100,TRUE,0,86,FALSE,1,86,FALSE,0,65,TRUE,1,65,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,0,90,TRUE,1,81,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0.0196,0.0196,0.1225,0.0361,0,0.0625,0.1225,0.16,0,0.8281,0.2916,0.25,1,0.4225,0.0625,0.7396,0.0196,0.4225,0.25,0.25,0.16,1,0,0.81,1,0.287471429,0.11875,0.456192857,25,78.13,20,62.5,4,50,4,50,7,87.5,5,62.5,14,87.5,6,37.5,82.5,69.38,83.88,87.12,89.62,84.81,80.19,15.63,20,19.38,33.88,-0.38,27.12,-2.69,42.69,0,0,0,2,1,1,0,0,1,0,0,1,1,2,0,0,1,1,1,1,0,0,0,1,1,0,2,1,0,2,0,1,0,2,0,1,0,1,0,0,0.6,0.4,0.8,0.8,0.4,1,0.6,0.4,0.65,0.6,2.33,2.67,0,0,-1,1,-0.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,70,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,0,1,-2,-1,1,-2,0,0,1,0,0,-1,1,0,1,1,0.2,-0.6,0.2,0.4,0.05 +89,R_7t6d6cFSLKTLPTS,60 - 66,Canadian,Male,-1,0,2,2,0,-1,0,1,0,0,2,0,0,-2,-1,-1,-2,-2,0,-3,2,1,1,0,1,8,0,1,1,2,0,6,2,0,0,-1,0,3,0,-1,-2,0,-3,8,0,0,2,2,0,5,-2,2,2,-2,-2,0,2,-2,0,-3,0,5,0,-2,-2,0,-3,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,73,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,74,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,74,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,80,TRUE,0,59,TRUE,1,81,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.25,0,0.0676,0.0361,0,0.0729,0.25,0.25,0,0,0.25,0.04,0,0,0.25,0.25,0,0.0676,0.25,0,0,1,0,0.3481,0.25,0.129725,0.084042857,0.175407143,30,93.75,27,84.38,5,62.5,7,87.5,8,100,7,87.5,16,100,11,68.75,82.53,65.38,85.38,90.5,88.88,86.12,78.94,9.37,-1.85,2.88,-2.12,-9.5,1.38,-13.88,10.19,3,1,1,2,1,1,1,0,2,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,2,1,2,2,0,2,0,1,1,1,0,0,0,0,1.6,0.8,0.4,0.4,0.2,1.6,0.8,0.2,0.8,0.7,5.67,3.33,3,6,-2,6,2.34,20 cents,100 minutes,47 days,Male,University - Undergraduate,61,1.5,0,0,1,0,1,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,2,1,1,2,1,0,-1,-1,0,-2,0,-2,0,0,0,0,1,0,0,0,1.4,-0.8,-0.4,0.2,0.1 +90,R_3HuGQO7ogFJUBJZ,67 - 73,American,Female,-3,-2,2,-1,-2,0,-2,3,-2,1,3,0,2,-3,3,-3,-2,-1,2,-3,-3,-2,2,-1,0,1,1,-2,3,-2,2,1,3,1,2,-3,3,1,-1,2,1,1,-3,6,-3,-2,2,0,-3,1,-1,-2,1,0,0,2,3,0,2,-3,3,2,-2,-2,-2,2,-3,6,TRUE,0,87,TRUE,1,100,FALSE,1,81,FALSE,1,50,TRUE,1,95,FALSE,1,92,TRUE,1,81,TRUE,1,96,FALSE,0,50,FALSE,0,95,FALSE,1,76,TRUE,0,97,FALSE,0,50,TRUE,0,96,FALSE,0,50,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,76,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0016,0,0,0.0361,0,0.0064,0,0.9025,0,0.16,0,0.25,0.25,0.0576,0.0025,0,0,0.25,0.25,0,0.25,0.25,0.25,0.9216,0.0361,0.25,0.25,0.7569,0.0361,1,0.5776,0.9409,0.27315,0.134214286,0.412085714,22,68.75,21,65.63,4,50,6,75,4,50,7,87.5,11,68.75,10,62.5,80.09,59.5,80.5,89.88,90.5,79.81,80.38,3.12,14.46,9.5,5.5,39.88,3,11.06,17.88,0,0,0,0,2,1,0,0,0,1,0,1,0,0,0,2,4,2,1,0,0,0,0,1,1,1,0,2,2,1,0,0,0,0,0,1,0,1,0,0,0.4,0.4,0.2,1.8,0.4,1.2,0,0.4,0.7,0.5,1,1.67,0,-1,-1,0,-0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,1.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,-1,1,0,0,-2,-2,0,0,1,0,0,0,1,4,1,1,0,0,-0.8,0.2,1.4,0.2 +91,R_3zYM8IjnxrPy43Y,67 - 73,Canadian,Female,3,1,1,1,3,-1,1,1,-1,0,1,1,0,0,1,0,1,2,2,0,3,2,2,1,3,7,-1,0,0,1,-1,7,0,1,1,1,1,5,0,0,1,-1,1,5,3,2,1,1,3,4,0,0,1,-2,0,6,1,0,1,0,1,5,1,0,1,0,0,4,TRUE,0,85,TRUE,1,87,FALSE,1,100,FALSE,1,76,TRUE,1,65,FALSE,1,65,TRUE,1,90,TRUE,1,90,TRUE,1,73,TRUE,1,82,TRUE,0,65,TRUE,0,77,TRUE,1,92,TRUE,0,100,FALSE,0,50,FALSE,0,60,FALSE,1,50,TRUE,0,84,FALSE,1,60,FALSE,1,70,TRUE,1,74,TRUE,1,55,FALSE,1,72,TRUE,1,71,FALSE,1,70,TRUE,1,70,TRUE,0,50,FALSE,1,50,TRUE,0,73,TRUE,1,71,TRUE,1,50,TRUE,1,91,0.01,0.09,0.36,0.01,0.0081,0.1225,0.0841,0.0324,0.09,0.2025,0.0841,0.0064,0.0729,0.4225,0.1225,0.0169,0.0784,0.0576,0.25,0.09,0.0676,0.25,0.16,1,0.25,0.25,0.25,0.7225,0,0.7056,0.5329,0.5929,0.232942857,0.100064286,0.365821429,20,62.5,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,72.44,63.88,72.75,79.5,73.62,73.19,71.69,-9.38,0.56,1.38,-14.75,17,-1.38,-14.31,15.44,0,1,1,0,0,0,1,1,2,1,1,0,1,1,0,0,1,1,3,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,1,1,1,2,0,0.4,1,0.6,1.2,0.2,0.6,0.4,1,0.8,0.55,6.33,5,3,1,0,1,1.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,1,0,0,-1,0,1,1,1,1,-1,0,1,0,-1,0,0,1,1,0.2,0.4,0.2,0.2,0.25 +92,R_3GxmlipNoWtF7t7,67 - 73,American,Female,2,1,3,-2,-3,2,-3,3,-3,2,2,2,3,0,2,2,2,2,3,2,2,1,2,-2,-3,1,2,-3,3,-2,2,1,2,3,3,3,2,1,2,1,2,3,3,1,2,0,3,0,-3,2,1,-3,3,-3,2,2,3,3,3,2,3,1,2,2,2,3,3,3,TRUE,0,95,TRUE,1,99,FALSE,1,91,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,70,FALSE,1,80,FALSE,0,100,TRUE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,100,FALSE,0,85,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0.04,0.04,0.7225,0,0.0625,0,0.25,0.0001,0.25,0.25,0.25,0,1,0.25,0.09,0.36,0.25,0.25,0.25,0.9025,0.0081,0.25,1,1,0.266989286,0.115364286,0.418614286,25,78.13,22,68.75,6,75,5,62.5,5,62.5,6,75,11,68.75,11,68.75,80.78,68,81.25,85.62,88.25,86.81,74.75,9.38,12.03,-7,18.75,23.12,13.25,18.06,6,0,0,1,0,0,0,0,0,1,0,0,1,0,3,0,0,1,0,0,1,0,1,0,2,0,1,0,0,0,0,1,1,0,2,1,0,0,0,0,1,0.2,0.2,0.8,0.4,0.6,0.2,1,0.2,0.4,0.5,1,1.67,-1,-1,0,-2,-0.67,10 cents,100 minutes,47 days,Female,High School (or equivalent),71,-0.75,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,-1,1,-2,0,-1,0,0,1,0,-1,0,0,1,-1,0,1,0,0,0,-0.4,0,-0.2,0.2,-0.1 +93,R_7luEeVGChG2wXTP,53 - 59,Canadian,Female,1,3,3,1,1,-1,-2,2,-2,1,1,1,-1,-2,2,-1,1,1,1,-1,-1,3,3,-1,2,7,-1,-2,2,-2,1,1,2,2,1,-1,2,6,2,1,3,2,3,8,1,3,3,2,-1,3,0,-1,1,0,-1,2,2,1,-1,-3,2,4,-1,-1,1,1,1,6,TRUE,0,86,TRUE,1,86,TRUE,0,72,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,1,88,TRUE,1,100,TRUE,1,59,TRUE,1,88,FALSE,1,60,FALSE,1,89,TRUE,1,82,TRUE,0,90,TRUE,1,70,TRUE,1,84,TRUE,0,53,FALSE,1,76,FALSE,1,61,FALSE,1,89,TRUE,1,54,TRUE,1,63,FALSE,1,100,TRUE,1,68,TRUE,0,70,TRUE,1,73,TRUE,0,58,FALSE,1,69,TRUE,0,71,TRUE,1,78,FALSE,0,53,TRUE,1,96,0,0.0729,0.0256,0.0144,0.0016,0.25,0.1024,0.0144,0.0121,0.1369,0.0484,0.0324,0.1681,0.16,0.0361,0.0196,0,0.25,0.0961,0.49,0.2116,0.09,0.1521,0.81,0.2809,0.3364,0.2809,0.7396,0.5184,0.0576,0.5041,0.0121,0.207564286,0.088,0.327128571,24,75,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,73.97,62.12,73.38,79.25,81.12,76.44,71.5,0,-1.03,-12.88,-1.62,16.75,-6.38,-17.31,15.25,2,0,0,2,1,0,0,0,0,0,1,1,2,1,0,3,0,2,1,4,0,0,0,1,2,1,1,1,2,2,1,0,0,1,0,0,2,0,0,2,1,0,1,2,0.6,1.4,0.4,0.8,1,0.8,4.67,3,4,-1,2,2,1.67,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,0,0,1,-1,-1,-1,-1,-2,-2,0,1,2,0,0,3,-2,2,1,2,0.4,-1.4,0.6,1.2,0.2 +94,R_78PcOG5RrfRfqev,67 - 73,Canadian,Female,1,-2,2,-3,3,0,2,3,0,1,2,0,3,-3,3,1,1,1,2,1,1,-3,2,-3,3,1,1,1,3,0,3,1,3,2,3,-3,3,1,0,0,1,0,0,4,2,-2,2,0,3,1,0,1,3,0,2,1,3,2,3,-3,3,0,2,0,1,1,1,2,TRUE,0,86,TRUE,1,88,TRUE,0,96,FALSE,1,57,FALSE,0,56,FALSE,1,92,TRUE,1,94,TRUE,1,93,TRUE,1,58,TRUE,1,94,FALSE,1,86,TRUE,0,92,TRUE,1,93,TRUE,0,94,TRUE,1,58,TRUE,1,96,FALSE,1,57,FALSE,1,92,TRUE,0,81,FALSE,1,92,FALSE,0,86,TRUE,1,86,TRUE,0,76,TRUE,1,80,FALSE,1,90,TRUE,1,92,FALSE,1,78,FALSE,1,89,TRUE,0,89,TRUE,1,90,TRUE,1,87,TRUE,1,96,0.0049,0.0064,0.0016,0.0036,0.0016,0.0064,0.04,0.0036,0.0064,0.0196,0.01,0.0049,0.1764,0.0196,0.3136,0.0144,0.5776,0.1849,0.0121,0.01,0.7396,0.1764,0.6561,0.8836,0.1849,0.0484,0.0169,0.7396,0.9216,0.0064,0.7921,0.8464,0.264753571,0.0985,0.431007143,24,75,23,71.88,7,87.5,4,50,6,75,6,75,14,87.5,9,56.25,84.19,74.12,80.62,91,91,84.19,84.19,3.12,12.31,-13.38,30.62,16,16,-3.31,27.94,0,1,0,0,0,1,1,0,0,2,1,2,0,0,0,1,1,0,2,1,1,0,0,3,0,0,1,0,0,1,1,2,0,0,0,1,1,0,1,0,0.2,0.8,0.6,1,0.8,0.4,0.6,0.6,0.65,0.6,1,0.67,0,0,1,2,0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,73,1,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,-1,1,0,-3,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,-0.6,0.4,0,0.4,0.05 +95,R_5Q1aVF0TWRgy34Z,67 - 73,Both,Female,3,0,0,2,-2,-2,-2,2,-2,-1,2,0,2,-2,2,0,1,1,2,0,2,2,2,1,2,6,-2,0,2,-2,-1,6,2,1,2,0,2,4,2,2,2,1,1,5,2,2,2,3,0,7,-2,0,0,0,-2,8,2,0,-2,-3,0,9,-3,-3,-2,0,0,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,50,TRUE,1,85,FALSE,1,94,FALSE,1,85,TRUE,1,100,TRUE,0,90,FALSE,0,74,TRUE,1,100,FALSE,1,100,FALSE,1,91,FALSE,1,82,FALSE,1,100,TRUE,1,74,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,93,TRUE,1,85,TRUE,0,50,FALSE,1,98,TRUE,0,93,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.01,0.0225,0,0,0,0,0,0.0225,0,0.25,0,0,0.25,0.0036,0.25,0,0,0.2304,0.0004,0.8649,0.0676,0.5476,0.0324,0.81,0,0.25,0.0625,0,0,0.0081,0.8649,0.0225,0.16205,0.071892857,0.252207143,25,78.13,27,84.38,6,75,7,87.5,6,75,8,100,15,93.75,12,75,86.28,72.12,89.62,86.75,96.62,83.31,89.25,-6.25,1.9,-2.88,2.12,11.75,-3.38,-10.44,14.25,1,2,2,1,4,0,2,0,0,0,0,1,0,2,0,2,1,1,1,1,1,2,2,1,2,0,2,2,2,1,0,0,4,1,2,3,4,3,2,0,2,0.4,0.6,1.2,1.6,1.4,1.4,2.4,1.05,1.7,5.33,8,-1,-2,-5,-5,-2.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,70,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,2,0,0,-2,-2,-1,0,1,-4,1,-2,-1,-3,-2,-1,1,0.4,-1,-0.8,-1.2,-0.65 +96,R_5P1hksMwlBeyIeH,60 - 66,Canadian,Male,2,3,2,1,0,-3,0,1,0,1,-1,-3,3,-2,2,-3,-2,-3,-3,-3,2,3,2,1,0,0,-3,0,1,0,2,0,-1,-3,3,-3,2,0,-3,-3,-3,-3,-3,1,1,3,2,1,0,0,-3,0,1,0,1,1,-1,-3,3,-3,2,0,-3,-3,-3,-3,-3,0,FALSE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,0,75,TRUE,0,85,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,95,TRUE,1,100,TRUE,0,85,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,80,TRUE,1,100,0,0,0,0,0,0,0.04,0,0,0,1,0,0.0025,0.5625,0.0025,0,0,0.25,0,0.0025,0,0.25,0.25,0,0,0.7225,0.04,0.0025,0,0,1,0.7225,0.173125,0.132678571,0.213571429,31,96.88,26,81.25,5,62.5,7,87.5,8,100,6,75,15,93.75,11,68.75,91.72,73.12,99.38,98.75,95.62,93.75,89.69,15.63,10.47,10.62,11.88,-1.25,20.62,0,20.94,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0.2,0.2,0.2,0.2,0,0.2,0.2,0.15,0.15,0,0.33,0,-1,0,1,-0.33,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,63,1.25,1,1,0,0,0,1,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,-0.2,0.2,0,0,0 +97,R_5GlEaRuPX31tPTC,67 - 73,American,Male,2,2,-2,1,1,1,-2,3,-3,3,2,-1,3,1,3,1,1,2,2,-2,2,2,-2,0,1,4,1,-2,2,-2,2,6,2,-1,2,1,2,5,1,1,1,1,-2,5,2,2,-2,2,-1,4,1,-2,1,-2,1,3,2,0,3,0,3,3,1,2,2,2,-2,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0.107142857,0,0.214285714,31,96.88,29,90.63,7,87.5,7,87.5,8,100,7,87.5,15,93.75,14,87.5,100,100,100,100,100,100,100,6.25,9.37,12.5,12.5,0,12.5,6.25,12.5,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,2,0,0,2,1,2,0,1,0,1,0,0,1,0,0,0,0.2,0.6,0.4,0.4,0.6,1,0.4,0.2,0.4,0.55,5,3.33,0,3,2,-1,1.67,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),72,1.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,-2,0,0,-1,0,-1,0,-1,1,-1,1,0,-1,1,1,0,-0.4,-0.4,0,0.2,-0.15 +98,R_3ez3PwUo6gXjOzn,67 - 73,Canadian,Female,2,2,2,2,2,1,1,1,1,0,0,-1,1,-2,3,1,2,2,1,0,2,2,2,2,2,2,1,1,1,2,-1,1,-1,-1,2,-2,3,1,0,0,0,1,1,1,2,2,2,2,1,1,0,-1,1,0,-1,1,-1,-1,2,-2,3,2,1,2,1,1,1,1,FALSE,1,100,TRUE,1,87,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,85,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,50,TRUE,0,90,TRUE,0,76,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,1,0,0,0.0225,0.0196,0,0,0.0169,0,0.25,0,0,0,0.04,0.5776,0,0.25,0,1,0,0,0.81,0,1,0.187021429,0.111357143,0.262685714,26,81.25,24,75,5,62.5,6,75,7,87.5,6,75,15,93.75,9,56.25,92.31,84.88,85.62,98.75,100,96.12,88.5,6.25,17.31,22.38,10.62,11.25,25,2.37,32.25,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,2,2,0,1,0,0,0,0,1,1,2,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0.4,0.4,1.2,0.2,1,0.4,0.4,0.5,0.5,1.33,1.33,1,0,-1,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,72,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,0,-1,-1,-2,0,0,0,0,0,0,0,0,1,2,1,0,0,-0.2,-0.6,0,0.8,0 +99,R_76hSlL9MwQGDYBQ,67 - 73,American,Female,3,2,2,3,2,0,0,2,3,0,3,2,2,-1,2,-2,-1,-1,-1,-3,2,2,2,2,2,5,0,-1,2,2,1,6,3,2,1,-3,2,6,-3,-2,0,0,-3,5,2,2,2,2,2,7,-1,-1,2,2,-1,5,3,2,2,-3,2,6,-3,-3,-3,-3,-3,6,TRUE,0,61,TRUE,1,53,FALSE,1,55,TRUE,0,55,FALSE,0,53,FALSE,1,55,TRUE,1,73,TRUE,1,62,FALSE,0,51,TRUE,1,88,TRUE,0,51,TRUE,0,73,TRUE,1,63,TRUE,0,76,FALSE,0,55,TRUE,1,84,FALSE,1,51,TRUE,0,56,FALSE,1,53,FALSE,1,51,FALSE,0,52,TRUE,1,84,TRUE,0,55,TRUE,1,72,FALSE,1,55,TRUE,1,72,TRUE,0,63,FALSE,1,57,TRUE,0,72,TRUE,1,100,TRUE,1,72,TRUE,1,100,0.1444,0.0784,0.0256,0.0729,0,0.2025,0.0784,0.0144,0.2401,0.0256,0,0.1369,0.2601,0.2601,0.2809,0.2209,0.3025,0.3025,0.1849,0.2025,0.2704,0.3025,0.2209,0.5776,0.2401,0.3969,0.0784,0.3721,0.2025,0.3136,0.5184,0.5329,0.240664286,0.166064286,0.315264286,18,56.25,19,59.38,3,37.5,4,50,5,62.5,7,87.5,12,75,7,43.75,64.78,56.62,62.62,70.62,69.25,70.88,58.69,-3.13,5.4,19.12,12.62,8.12,-18.25,-4.12,14.94,1,0,0,1,0,0,1,0,1,1,0,0,1,2,0,1,1,1,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,2,0,1,2,2,2,0,0.4,0.6,0.6,0.8,0.4,0.8,0.4,1.4,0.6,0.75,5.67,6,-2,1,0,-1,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,-1,-1,-1,0,0,-0.2,0.2,-0.6,-0.15 +100,R_7MXrK9TJaqNt8nC,60 - 66,American,Female,1,2,2,0,0,1,-1,2,-2,1,1,-3,1,0,3,2,2,2,2,2,2,2,2,0,1,2,1,-2,2,-2,1,2,2,-2,1,1,2,3,2,2,2,2,2,3,2,2,2,0,0,2,1,-2,2,-2,2,2,2,-2,2,0,2,2,2,2,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,65,TRUE,0,64,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,93,TRUE,0,100,FALSE,0,86,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,82,TRUE,0,92,TRUE,1,92,TRUE,1,95,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0.0064,0.0049,0.0196,0,0,0,0,0.4096,0.0324,0,0,0.7396,0,1,0,0,0.0025,0,0.4225,1,0.8464,0,0.195853571,0.102892857,0.288814286,26,81.25,25,78.13,6,75,7,87.5,5,62.5,7,87.5,14,87.5,11,68.75,95.47,91.38,98.12,100,92.38,97,93.94,3.12,17.34,16.38,10.62,37.5,4.88,9.5,25.19,1,0,0,0,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,1,0,0,0,0,0,0.4,0.2,0.8,0,0.2,0.4,0.8,0,0.35,0.35,2.33,2,0,0,1,1,0.33,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,64,0.875,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,1,0,0,0,0,-1,0,0,-1,1,0,0,0,0,0,0,0.2,-0.2,0,0,0 +101,R_57D1Mby93xoTCpW,67 - 73,Canadian,Female,2,3,3,0,3,-1,-3,3,1,1,3,3,3,0,3,3,3,3,2,-3,3,3,3,2,3,3,-1,-3,3,2,1,3,3,1,3,1,3,3,1,0,0,1,1,8,3,3,3,3,0,3,-1,-3,3,-2,0,2,3,1,3,-2,3,2,2,0,3,3,-3,7,FALSE,1,60,TRUE,1,100,FALSE,1,60,FALSE,1,55,FALSE,0,60,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,55,TRUE,0,70,FALSE,1,55,TRUE,0,100,FALSE,0,100,FALSE,0,55,TRUE,0,55,TRUE,1,55,TRUE,0,100,TRUE,1,55,FALSE,1,55,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0.2025,0,0,0,0.2025,0.2025,0,1,0.3025,0,0,0.1225,1,0.36,0,0.3025,0.2025,1,1,1,0.3025,0.2025,1,0.2025,0.2025,0.3025,0.16,0.16,0.49,1,1,0.418482143,0.263928571,0.573035714,15,46.88,18,56.25,5,62.5,4,50,4,50,5,62.5,11,68.75,7,43.75,78.75,67.5,78.12,80,89.38,81.25,76.25,-9.37,22.5,5,28.12,30,26.88,12.5,32.5,1,0,0,2,0,0,0,0,1,0,0,2,0,1,0,2,3,3,1,4,1,0,0,3,3,0,0,0,3,1,0,2,0,2,0,1,3,0,1,0,0.6,0.2,0.6,2.6,1.4,0.8,0.8,1,1,1,3,2.33,0,1,1,1,0.67,10 cents,5 minutes,24 days,Female,High School (or equivalent),72,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,-3,0,0,0,-2,-1,0,0,0,-1,0,1,0,3,0,4,-0.8,-0.6,-0.2,1.6,0 +102,R_1oyJxsrxJj0tKUF,67 - 73,Canadian,Male,1,0,2,2,2,-2,1,3,-2,0,2,0,3,-1,3,0,1,1,1,-1,1,0,2,2,2,9,-2,1,3,-2,1,9,2,0,3,-2,3,9,0,-1,1,1,-2,7,1,1,3,3,-1,6,-3,1,2,-2,-2,7,2,0,3,-3,3,8,0,0,0,1,-1,5,TRUE,0,65,FALSE,0,50,TRUE,0,84,FALSE,1,50,TRUE,1,50,FALSE,1,54,TRUE,1,100,TRUE,1,100,TRUE,1,82,TRUE,1,66,TRUE,0,71,TRUE,0,99,TRUE,1,100,TRUE,0,91,FALSE,0,55,TRUE,1,100,FALSE,1,53,TRUE,0,92,TRUE,0,64,FALSE,1,100,TRUE,1,75,TRUE,1,77,TRUE,0,50,TRUE,1,98,TRUE,0,60,TRUE,1,93,FALSE,1,50,FALSE,1,56,FALSE,1,53,TRUE,1,80,TRUE,1,70,TRUE,1,96,0,0.0049,0,0,0.0016,0.2116,0.0004,0.1156,0,0.0529,0.04,0,0.0324,0.5041,0.25,0.25,0.25,0.25,0.1936,0.36,0.0625,0.3025,0.4096,0.8281,0.2209,0.25,0.09,0.4225,0.7056,0.8464,0.2209,0.9801,0.280403571,0.1399,0.420907143,20,62.5,21,65.63,4,50,7,87.5,4,50,6,75,14,87.5,7,43.75,74.5,61.5,66.38,80.5,89.62,80.75,68.25,-3.13,8.87,11.5,-21.12,30.5,14.62,-6.75,24.5,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,2,0,0,1,0,1,1,1,3,1,0,1,0,2,0,0,0,2,0,0,1,1,0,0,0,0.2,0.2,0.6,1.2,0.8,0.4,0.4,0.25,0.7,9,7,3,2,1,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,72,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,-1,-1,-1,-3,-1,0,-1,0,-1,0,0,0,-1,0,0,1,-1,0,1,-1.2,-0.6,-0.2,0.2,-0.45 +103,R_3cBpKskAvNb0wUN,67 - 73,American,Male,3,1,2,2,2,-2,0,3,1,-1,1,3,1,1,-2,2,1,2,2,1,3,2,2,2,1,7,1,1,-1,0,-1,6,1,-1,1,0,1,6,0,1,2,2,1,5,3,2,2,3,1,6,-3,1,2,1,-1,6,0,3,2,1,-2,3,1,2,0,0,1,8,FALSE,1,92,TRUE,1,100,TRUE,0,86,FALSE,1,87,FALSE,0,91,FALSE,1,97,TRUE,1,91,TRUE,1,100,TRUE,1,59,FALSE,0,100,FALSE,1,86,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,71,FALSE,1,92,TRUE,0,87,FALSE,1,100,TRUE,1,92,TRUE,1,76,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,69,FALSE,1,100,FALSE,1,82,TRUE,1,100,TRUE,1,65,TRUE,1,100,0,0,0,0.0081,0,0.0009,0,1,0,0.0576,0,1,0.1681,0.0196,0.8281,0,0,0.0169,0,1,0.0064,0.0576,0.7569,1,0.0841,0.4761,0.1225,0.0064,0.7396,0.0064,0.0324,0,0.263557143,0.2208,0.306314286,24,75,24,75,6,75,6,75,5,62.5,7,87.5,13,81.25,11,68.75,90.59,78.62,91.62,93.88,98.25,90.62,90.56,0,15.59,3.62,16.62,31.38,10.75,9.37,21.81,0,1,0,0,1,3,1,4,1,0,0,4,0,1,3,2,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,0,1,0,0,1,1,2,2,0,0.4,1.8,1.6,0.4,0.6,0.6,0.4,1.2,1.05,0.7,6.33,5,1,0,3,-3,1.33,10 cents,25 minutes,24 days,Male,University - Graduate (Masters),67,0.625,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,-1,0,2,0,3,1,0,-1,4,-1,1,3,1,-1,-2,-2,0,-0.2,1.2,1.2,-0.8,0.35 +104,R_35WTDTUYDDCHJhT,67 - 73,American,Male,3,3,0,3,2,2,1,3,-3,1,3,2,3,1,3,1,1,1,1,1,3,3,-2,3,2,2,2,1,3,-3,2,2,3,3,3,2,3,2,1,1,1,1,1,2,3,3,-2,3,2,1,1,1,3,-3,1,2,3,3,3,1,3,1,0,0,1,1,1,2,FALSE,1,64,TRUE,1,100,FALSE,1,100,FALSE,1,53,TRUE,1,52,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,66,FALSE,1,100,TRUE,1,62,TRUE,1,94,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,61,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0036,0,0,0,0,0.2304,0,0,0.2209,0,0,0.1444,0.2304,0.1156,0,0,0.1521,0,0.1296,0,0,1,0,0.079535714,0.032492857,0.126578571,29,90.63,31,96.88,8,100,7,87.5,8,100,8,100,16,100,15,93.75,90.75,79,89.25,94.75,100,91.25,90.25,-6.25,-6.13,-21,1.75,-5.25,0,-8.75,-3.5,0,0,2,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0.4,0.2,0.4,0,0.4,0.2,0.2,0.4,0.25,0.3,2,1.33,1,0,1,0,0.67,10 cents,100 minutes,24 days,Male,Trade School (non-military),71,0.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,-1,0,0,0,1,0,0,0,1,0,-1,-1,0,0,0,0,0,0.2,-0.4,-0.05 +105,R_6ZaZJqHovVAvk1r,60 - 66,Canadian,Male,2,1,2,-2,3,-2,-3,3,-2,1,3,3,2,0,1,2,2,3,2,1,0,3,2,-3,2,2,0,-2,3,-3,1,5,3,3,2,0,2,4,2,3,2,1,2,3,2,-1,2,2,0,3,-1,-2,2,-1,0,3,2,3,0,2,1,4,2,-1,2,3,2,4,TRUE,0,100,TRUE,1,86,TRUE,0,86,FALSE,1,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,96,FALSE,0,50,TRUE,1,92,FALSE,1,63,TRUE,0,81,FALSE,0,80,TRUE,0,100,FALSE,0,66,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,59,FALSE,1,100,FALSE,0,59,TRUE,1,91,FALSE,1,92,TRUE,1,60,FALSE,1,100,TRUE,1,85,FALSE,1,60,TRUE,0,88,FALSE,1,70,TRUE,1,87,TRUE,1,94,TRUE,1,100,0.0016,0.0225,0,0,0,0,0.16,0.0064,0,0.0081,0.0169,0.64,0.25,0.1369,0.0004,0.0196,0.0064,0.25,0.7744,0,0.3481,0.4356,0.1681,1,0.25,0.16,0.0036,1,0.7396,1,0.09,0.6561,0.290007143,0.106764286,0.47325,23,71.88,21,65.63,6,75,5,62.5,5,62.5,5,62.5,12,75,9,56.25,82.59,66,81.12,96,87.25,84,81.19,6.25,16.96,-9,18.62,33.5,24.75,9,24.94,2,2,0,1,1,2,1,0,1,0,0,0,0,0,1,0,1,1,1,1,0,2,0,4,3,1,1,1,1,1,1,0,2,2,0,0,3,1,1,1,1.2,0.8,0.2,0.8,1.8,1,1,1.2,0.75,1.25,3.67,3.33,-1,2,0,-1,0.34,10 cents,5 minutes,24 days,Male,University - Undergraduate,66,0.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,2,0,0,-3,-2,1,0,-1,0,-1,-1,0,-2,-2,1,0,-2,0,0,0,-0.6,-0.2,-0.8,-0.4,-0.5 +106,R_77lKBxK1DWYlmSQ,60 - 66,American,Female,3,2,2,-1,3,-1,-2,2,0,-1,3,2,2,-2,2,-3,0,0,1,-2,3,3,2,-2,3,1,-2,-2,1,0,-1,4,3,2,2,-2,2,1,-2,-1,-1,-1,-1,4,2,-1,3,2,-1,6,-2,-2,1,-1,-1,1,3,3,2,-2,2,3,-2,-2,-1,0,-2,3,TRUE,0,56,TRUE,1,100,FALSE,1,99,TRUE,0,52,TRUE,1,69,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,60,TRUE,1,71,FALSE,1,99,TRUE,0,100,TRUE,1,95,TRUE,0,96,FALSE,0,51,TRUE,1,99,FALSE,1,63,FALSE,1,100,TRUE,0,60,FALSE,1,100,TRUE,1,55,TRUE,1,92,FALSE,1,89,TRUE,1,100,FALSE,1,89,TRUE,1,96,TRUE,0,58,FALSE,1,99,TRUE,0,96,TRUE,1,93,TRUE,1,51,TRUE,1,100,0.0001,0.0016,0.0001,0,0,0,0,0.0841,0,0.0064,0.0049,0.0025,0.16,0.0001,0.0961,0,0.0121,0.2704,0.0001,0.0121,0.2025,0.2601,0.36,0.9216,0.1369,0.3364,0.2401,0.3136,0.0001,0,0.9216,1,0.190775,0.045471429,0.336078571,18,56.25,24,75,4,50,7,87.5,6,75,7,87.5,15,93.75,9,56.25,83.97,66.38,83.38,87.5,98.62,83.19,84.75,-18.75,8.97,16.38,-4.12,12.5,11.12,-10.56,28.5,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,1,1,2,1,1,3,1,3,4,1,0,1,1,0,0,1,0,0,0,1,2,1,1,0,0.4,0.4,0,1.2,2.4,0.6,0.2,1,0.5,1.05,2,3.33,-5,3,-2,1,-1.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,-1,-2,-1,-2,-4,0,0,0,-1,0,0,-1,0,0,0,0,-1,0,1,1,-2,-0.2,-0.2,0.2,-0.55 +107,R_3zM72bExBqJJK2n,60 - 66,American,Male,3,2,3,3,3,2,-2,2,-1,2,1,2,3,0,3,2,2,3,3,2,3,2,3,0,3,8,2,-2,2,-2,3,9,1,2,2,0,3,9,1,1,2,1,1,8,3,2,3,3,2,7,1,0,2,-1,1,9,1,3,3,0,3,9,1,2,2,2,2,9,TRUE,0,72,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,77,FALSE,1,100,TRUE,0,100,TRUE,1,98,TRUE,0,93,TRUE,1,68,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,82,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,98,TRUE,1,100,0,0,0,0,0,0,0.0009,0.0529,0,0,0,0.0004,0.01,0,0,0,0,0.1849,0,0,0,0.1024,0.6724,0.8649,0,0.7744,0.0004,0.5184,0,0,0.8649,1,0.180246429,0.017792857,0.3427,28,87.5,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,94.16,85.38,98.88,92.75,99.62,95.5,92.81,6.25,12.91,10.38,11.38,17.75,12.12,-4.5,30.31,0,0,0,3,0,0,0,0,1,1,0,0,1,0,0,1,1,1,2,1,0,0,0,0,1,1,2,0,0,1,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.2,1.2,0.2,0.8,0.2,0.6,0.6,0.45,8.67,8.33,1,0,0,-1,0.34,10 cents,5 minutes,24 days,Male,High School (or equivalent),66,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,3,-1,-1,-2,0,1,0,0,-1,1,0,0,0,1,0,1,1,0.4,-0.4,0,0.6,0.15 +108,R_6S66IPNS1Xsnw0d,67 - 73,Canadian,Male,1,1,1,-1,-1,-1,1,-1,0,-1,2,-1,2,-1,2,1,1,1,2,-1,1,2,1,-2,1,4,0,-1,1,-1,1,4,2,1,2,1,2,2,-1,-1,0,1,-1,6,1,1,1,0,-2,6,-2,2,-2,1,-2,6,2,-1,1,-2,2,3,-1,0,-1,1,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,76,FALSE,1,100,TRUE,1,78,TRUE,1,100,TRUE,1,76,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,55,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,72,FALSE,1,50,FALSE,1,64,FALSE,0,55,TRUE,1,66,TRUE,1,100,0,0,0,0.0484,0,0,0,0,0,0.2025,0.3025,0,0.0576,0.0625,0.0576,0,0,0.25,0.25,0,0,0.25,0.25,0,0,0.5184,0.1156,0,0,0,0.1296,0,0.087367857,0.066621429,0.108114286,24,75,29,90.63,6,75,8,100,8,100,7,87.5,15,93.75,14,87.5,84.91,67.38,92.5,91.62,88.12,84.75,85.06,-15.63,-5.72,-7.62,-7.5,-8.38,0.62,-9,-2.44,0,1,0,1,2,1,2,2,1,2,0,2,0,2,0,2,2,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,0,2,1,2,1,0,0.8,1.6,0.8,1.2,0.4,1,0.4,1.2,1.1,0.75,3.33,5,-2,-2,-1,1,-1.67,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),69,1.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,1,0,0,1,0,1,1,0,1,0,2,-1,1,0,0,1,-1,0,0,0.4,0.6,0.4,0,0.35 +109,R_7d3QuMhkCxFlQ42,60 - 66,Canadian,Female,2,1,1,-1,2,-1,1,0,2,-1,2,-2,2,1,3,1,0,0,2,0,1,1,0,-1,2,1,-1,0,0,2,-1,1,2,-1,1,1,3,1,0,0,0,1,0,2,1,1,1,1,0,2,-1,1,0,1,0,3,2,-1,2,1,3,2,0,0,1,1,0,2,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,0,59,TRUE,1,100,FALSE,1,82,TRUE,1,65,TRUE,1,73,TRUE,1,62,TRUE,1,100,FALSE,1,61,FALSE,1,94,TRUE,1,94,TRUE,0,92,FALSE,0,62,TRUE,1,99,FALSE,1,95,TRUE,0,97,FALSE,1,62,FALSE,1,71,TRUE,1,100,TRUE,1,98,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,92,TRUE,0,100,TRUE,1,91,FALSE,0,50,TRUE,1,100,0.0729,0,0.0001,0.1225,0,0.0324,0,0,0.0841,0.0004,0.0081,0.0036,0.1444,0.1521,0,0,0.01,0.3481,0.0064,0,0,0.3844,0.1444,0.8464,0.0025,0,0.25,0.01,0,0.9409,1,0.0036,0.156135714,0.055942857,0.256328571,26,81.25,26,81.25,5,62.5,7,87.5,6,75,8,100,14,87.5,12,75,86.84,69.5,95.12,92.75,90,87.12,86.56,0,5.59,7,7.62,17.75,-10,-0.38,11.56,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,0,0,2,2,0,0,0,1,1,0,1,0,0,0,1,0,1,1,0,0.4,0.2,0.4,0.4,1,0.4,0.2,0.6,0.35,0.55,1,2.33,-1,-2,-1,0,-1.33,10 cents,100 minutes,47 days,Female,University - Undergraduate,64,1.25,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,1,-2,-2,0,1,0,-1,-1,0,0,1,0,0,0,0,-1,0,0,-0.6,-0.2,0.2,-0.2,-0.2 +110,R_5purQVlYG87drpx,39 - 45,Canadian,Female,1,2,2,2,3,-2,-1,0,0,1,2,0,2,1,3,0,1,1,1,-1,0,2,2,1,3,2,-1,0,1,1,1,3,2,0,2,1,3,3,0,-1,1,1,-1,6,1,2,2,2,3,2,0,-1,1,0,2,3,2,1,2,0,3,3,2,1,2,2,-1,3,TRUE,0,90,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,70,TRUE,1,90,TRUE,1,95,TRUE,1,50,TRUE,1,95,FALSE,1,65,TRUE,0,90,TRUE,1,80,TRUE,0,50,TRUE,1,50,TRUE,1,85,TRUE,0,50,TRUE,0,100,TRUE,0,70,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,95,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.0025,0.0625,0.0225,0.01,0,0.09,0.25,0.0025,0.25,0.25,0.01,0.04,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.0025,1,0.25,0.49,0.25,0.25,0.25,0.25,0.81,1,1,0.25,0.81,0.325982143,0.161785714,0.490178571,16,50,17,53.13,5,62.5,4,50,4,50,4,50,12,75,5,31.25,70,54.38,68.75,80.62,76.25,72.5,67.5,-3.13,16.87,-8.12,18.75,30.62,26.25,-2.5,36.25,1,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,1,0,1,0,1,0,1,0,2,0,1,1,0,0.4,0.8,0,0.4,0,0.8,0.4,0.8,0.4,0.5,2.67,2.67,0,0,0,3,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),42,1.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,0,0,1,0,-1,1,0,1,-1,0,-1,0,-1,0,-2,2,-1,-1,0,0.4,0,-0.4,-0.4,-0.1 +111,R_6O7c3GMsV8YPQkI,67 - 73,Canadian,Male,-1,1,2,0,-2,-2,-1,3,-1,-1,2,-1,3,1,2,0,0,2,2,0,-2,0,2,0,-2,2,-2,-2,3,-1,-2,2,2,-2,3,2,2,1,-1,0,1,0,0,3,-1,1,3,1,-3,1,-2,-2,3,-2,-2,1,2,0,3,1,2,1,0,0,1,1,1,1,FALSE,1,100,TRUE,1,75,FALSE,1,55,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,50,TRUE,0,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.25,0.25,0.16,0,0.0625,0,0.2025,0.25,0,0,0.36,0.36,1,0,1,1,0,0.2025,1,0,0,0.217767857,0.066071429,0.369464286,26,81.25,26,81.25,4,50,8,100,6,75,8,100,14,87.5,12,75,87.97,70,93.75,100,88.12,89.69,86.25,0,6.72,20,-6.25,25,-11.88,2.19,11.25,1,1,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,2,0,0,0,1,1,1,0,1,0,1,1,0,1,0,0,0,0,0,1,1,1,0.4,0.4,0.4,0.8,0.6,0.6,0.2,0.6,0.5,0.5,1.67,1,1,1,0,2,0.67,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),70,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,01DIR,1,1,-1,-1,-1,0,0,0,-1,0,0,0,0,1,0,1,0,0,1,-1,-0.2,-0.2,0.2,0.2,0 +112,R_3paIdAavet2XfnF,46 - 52,American,Female,3,3,2,2,3,2,-1,2,-2,2,2,0,2,1,3,2,2,2,2,1,3,3,2,2,3,5,2,-2,2,-2,1,3,2,0,3,1,3,3,1,1,2,-1,1,8,3,3,3,3,3,2,2,-3,2,-2,3,1,2,0,2,-2,3,2,3,3,3,3,2,2,FALSE,1,71,TRUE,1,100,FALSE,1,100,TRUE,0,69,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,81,FALSE,0,100,FALSE,1,67,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,74,FALSE,1,77,TRUE,0,71,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,67,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,62,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,1,0,0,0,0,0.0361,0.1089,0,0,0.4489,0.4761,0,0,0.0841,0.0841,0.5041,0,0.5476,0.3844,0,0.0841,0,0.0529,1,1,0.207546429,0.147857143,0.267235714,26,81.25,23,71.88,5,62.5,5,62.5,6,75,7,87.5,14,87.5,9,56.25,90.03,77.62,89,93.5,100,95.19,84.88,9.37,18.15,15.12,26.5,18.5,12.5,7.69,28.63,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,3,0,0,0,1,1,0,0,2,0,0,1,0,0,0,3,0,1,1,1,1,1,0,0.4,0.2,1,0.4,0.6,0.6,1,0.4,0.65,3.67,1.67,3,2,1,6,2,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,48,1.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,-1,-1,0,0,-1,0,0,0,0,0,1,-3,0,0,0,-1,2,-1,-0.4,-0.2,-0.4,0,-0.25 +113,R_7LbZA9yEiDUHBsw,39 - 45,Canadian,Female,2,3,3,2,2,2,-1,3,-2,-2,3,3,3,-3,3,2,2,1,1,2,3,3,3,3,3,5,3,-3,3,-3,0,6,3,3,3,-3,3,5,2,1,0,1,3,6,3,3,3,3,3,4,3,-3,3,-2,3,4,3,3,3,-3,3,2,1,1,2,2,2,2,FALSE,1,50,TRUE,1,50,TRUE,0,57,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,86,TRUE,1,50,TRUE,1,50,TRUE,1,61,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,80,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,84,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.0256,0.25,0.0196,0,0,0.25,0.1521,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.64,0.25,1,0.24525,0.171578571,0.318921429,16,50,23,71.88,6,75,7,87.5,7,87.5,3,37.5,13,81.25,10,62.5,63.06,50,68.75,70.12,63.38,61.31,64.81,-21.88,-8.82,-25,-18.75,-17.38,25.88,-19.94,2.31,1,0,0,1,1,1,2,0,1,2,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,2,0,0,5,0,0,0,0,0,1,1,1,1,0,0.6,1.2,0,0.6,0.6,1.6,0,0.8,0.6,0.75,5.33,3.33,1,2,3,4,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),40,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,1,-3,0,0,0,0,0,-1,0,0,-1,1,0,-0.4,0,-0.2,-0.15 +114,R_3rqsHRxXmF3A9ah,60 - 66,Canadian,Female,2,2,2,2,2,-3,-1,1,2,0,1,2,3,-2,2,-1,-1,-1,1,-1,2,2,2,2,2,0,-2,-1,1,2,0,3,1,2,2,-1,2,1,-1,-1,-1,0,-1,2,2,2,2,2,2,0,-2,0,2,3,-1,1,1,2,2,-2,2,0,-2,-2,-2,-1,-2,1,TRUE,0,70,TRUE,1,62,FALSE,1,100,TRUE,0,50,TRUE,1,83,TRUE,0,73,TRUE,1,93,TRUE,1,94,TRUE,1,66,TRUE,1,88,TRUE,0,66,TRUE,0,84,TRUE,1,58,TRUE,0,91,TRUE,1,54,TRUE,1,91,FALSE,1,50,TRUE,0,81,TRUE,0,63,FALSE,1,50,FALSE,0,50,TRUE,1,80,FALSE,1,64,TRUE,1,73,TRUE,0,55,TRUE,1,72,FALSE,1,50,FALSE,1,50,TRUE,0,54,TRUE,1,65,FALSE,0,50,TRUE,1,100,0.0036,0.0784,0.0081,0.0049,0,0.5329,0.0729,0.0144,0.25,0.04,0.1225,0.1764,0.1156,0.4356,0.0289,0.1444,0.1296,0.25,0.25,0.3025,0.25,0.2116,0.3969,0.8281,0.25,0.25,0.25,0.49,0,0.6561,0.2916,0.7056,0.265914286,0.165228571,0.3666,16,50,20,62.5,4,50,5,62.5,4,50,7,87.5,14,87.5,6,37.5,69.69,57.62,66.5,78.75,75.88,73.69,65.69,-12.5,7.19,7.62,4,28.75,-11.62,-13.81,28.19,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,1,0,0,1,1,1,2,1,0,0.2,0.4,0.2,0,1,0.2,1.2,0.2,0.6,1.33,0.33,0,2,1,1,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,-1,-1,-1,-1,0,0,0,1,0,-1,-1,-1,-1,-1,0,-0.8,0.2,-1,-0.4 +115,R_77kGdbqP662k2Ou,53 - 59,Canadian,Female,3,3,1,-2,0,-2,-2,2,-2,-1,3,3,3,0,3,1,3,1,3,-1,3,3,1,-2,1,0,-3,-3,3,-3,-2,2,3,3,3,-2,3,0,1,3,3,3,-1,0,3,3,1,-2,0,0,-3,-3,3,-2,-3,1,3,3,3,-3,3,0,-1,0,1,2,-1,4,FALSE,1,100,FALSE,0,100,TRUE,0,92,FALSE,1,50,FALSE,0,50,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,85,FALSE,1,50,FALSE,1,91,FALSE,0,65,TRUE,0,76,FALSE,0,50,TRUE,1,100,FALSE,1,60,FALSE,1,92,TRUE,0,77,FALSE,1,83,TRUE,1,54,TRUE,1,92,FALSE,1,94,TRUE,1,50,TRUE,0,80,TRUE,1,75,FALSE,1,57,FALSE,1,94,TRUE,0,50,TRUE,1,92,FALSE,0,50,TRUE,1,73,0,0.0625,0,0,0.0729,0.0016,0.25,0.7225,0.0289,0.0064,0.0064,0.4225,0.25,0.25,0.25,1,0.0036,0.25,0.0036,0.64,0.2116,0.25,0.5929,0.5776,0.16,0.1849,0.25,0,0.8464,0.0064,0.25,0.0081,0.267725,0.251057143,0.284392857,22,68.75,21,65.63,4,50,5,62.5,5,62.5,7,87.5,10,62.5,11,68.75,75.88,60.5,67.75,87.5,87.75,74.12,77.62,3.12,10.25,10.5,5.25,25,0.25,11.62,8.87,0,0,0,0,1,1,1,1,1,1,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,1,1,1,0,2,0,0,0,3,0,2,3,0,1,0,0.2,1,0.4,0.4,0,1,0.6,1.2,0.5,0.7,0.67,0.33,0,1,0,-4,0.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,54,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,1,0,0,0,1,-1,0,0,0,-1,0,-2,-3,2,-1,0,0.2,0,-0.2,-0.8,-0.2 +116,R_32l0Zm7J87O1e4G,60 - 66,Canadian,Female,1,1,1,1,2,0,3,3,3,2,2,3,3,1,3,-3,-2,-3,-3,-1,2,1,-1,2,3,7,2,-1,3,0,3,10,3,3,2,3,3,4,-2,1,1,0,-2,8,2,1,2,3,-1,3,-2,0,0,1,0,5,1,2,0,-3,3,8,-3,-3,-3,-3,-3,1,TRUE,0,54,TRUE,1,53,FALSE,1,70,TRUE,0,54,FALSE,0,53,FALSE,1,54,TRUE,1,100,TRUE,1,99,TRUE,1,53,TRUE,1,99,FALSE,1,58,TRUE,0,97,TRUE,1,69,TRUE,0,96,TRUE,1,91,TRUE,1,96,TRUE,0,55,TRUE,0,100,FALSE,1,92,FALSE,1,56,TRUE,1,80,TRUE,1,51,TRUE,0,56,TRUE,1,97,TRUE,0,95,TRUE,1,80,TRUE,0,53,TRUE,0,67,FALSE,1,52,TRUE,1,58,FALSE,0,50,TRUE,1,53,0.0001,0.04,0.0016,0,0.2209,0.2116,0.0009,0.0001,0.1936,0.2401,0.1764,0.0961,0.2209,0.1764,0.2809,0.2209,0.3136,0.2916,0.4489,0.9025,0.04,0.0081,0.0064,0.9216,0.3025,0.2809,0.25,0.2916,0.09,1,0.2304,0.9409,0.298492857,0.188857143,0.408128571,12,37.5,20,62.5,5,62.5,5,62.5,4,50,6,75,14,87.5,6,37.5,71.59,63,59,84.38,80,73.88,69.31,-25,9.09,0.5,-3.5,34.38,5,-13.62,31.81,1,0,2,1,1,2,4,0,3,1,1,0,1,2,0,1,3,4,3,1,1,0,1,2,3,2,3,3,2,2,1,1,3,4,0,0,1,0,0,2,1,2,0.8,2.4,1.4,2.4,1.8,0.6,1.55,1.55,7,5.33,4,5,-4,7,1.67,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,66,0.75,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,1,-1,-2,0,1,-3,1,-1,0,-1,-2,-2,0,1,2,4,3,-1,-0.4,-0.4,-1,1.8,0 +117,R_3rJN39fpWBEuqvw,60 - 66,Canadian,Female,3,3,1,1,3,1,-3,1,-2,1,3,1,3,-3,0,1,1,1,1,-1,3,2,1,1,3,2,1,-3,1,-3,3,2,3,1,3,-3,0,2,1,1,1,1,-1,2,3,2,1,1,3,2,3,-3,1,-3,3,2,3,1,3,-3,0,2,1,1,1,1,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,75,FALSE,1,50,TRUE,1,65,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,0,80,TRUE,0,50,TRUE,0,98,TRUE,1,100,FALSE,0,50,TRUE,1,50,0,0.0001,0,0.0001,0.25,0.25,0,0.25,0.25,0,0,0,0.25,1,0,0,0.25,0.25,0.25,0.25,0.1225,0,0.5625,1,1,0.64,0.25,1,1,1,0.9604,1,0.420907143,0.196428571,0.645385714,22,68.75,17,53.13,2,25,6,75,4,50,5,62.5,13,81.25,4,25,81.75,75.62,76.62,87.25,87.5,85.19,78.31,15.62,28.62,50.62,1.62,37.25,25,3.94,53.31,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0.2,0.6,0,0,0.2,1,0,0,0.2,0.3,2,2,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,63,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.4,0,0,-0.1 +118,R_6CeWh0LbhPXXLzg,60 - 66,Canadian,Male,3,3,2,1,-2,-3,-2,2,2,2,2,-2,3,-2,3,2,2,3,3,-3,3,3,2,2,-1,2,-3,2,3,3,1,6,2,-2,3,-3,3,0,0,0,2,-2,2,4,3,3,2,2,-3,0,-3,-2,3,-1,1,2,2,-2,3,-2,3,0,2,3,3,2,-2,2,FALSE,1,70,TRUE,1,81,TRUE,0,83,TRUE,0,63,TRUE,1,78,FALSE,1,100,TRUE,1,94,TRUE,1,100,TRUE,1,84,FALSE,0,71,FALSE,1,60,TRUE,0,64,TRUE,1,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,84,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,72,TRUE,1,100,TRUE,1,100,0,0,0,0.0036,0,0,0,0.5041,0.04,0,0.0784,0,0.0256,0.16,0.0484,0.0361,0.25,0.3969,0,0,0,0.0625,0.0256,1,0,0.25,0,0.09,0.6889,1,1,0.4096,0.216646429,0.109964286,0.323328571,28,87.5,24,75,6,75,7,87.5,5,62.5,6,75,15,93.75,9,56.25,86.22,74.62,91,91.88,87.38,90.94,81.5,12.5,11.22,-0.38,3.5,29.38,12.38,-2.81,25.25,0,0,0,1,1,0,4,1,1,1,0,0,0,1,0,2,2,1,5,5,0,0,0,1,1,0,0,1,3,1,0,0,0,0,0,0,1,0,1,1,0.4,1.4,0.2,3,0.4,1,0,0.6,1.25,0.5,2.67,0.67,2,4,0,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,62,1.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,4,0,-2,0,0,0,0,1,0,2,1,1,4,4,0,0.4,0.2,2.4,0.75 +119,R_1OfCGJJDeaWfNGy,60 - 66,Canadian,Female,3,3,3,3,3,3,-3,3,0,3,2,2,3,2,3,-3,-3,-2,-3,-3,3,3,3,3,3,0,2,-3,3,2,2,1,2,2,3,2,3,1,-3,-3,-3,-3,-3,1,3,3,3,3,3,1,2,-3,3,2,2,0,2,3,3,2,3,1,-3,-3,-3,-3,-3,1,TRUE,0,90,TRUE,1,100,TRUE,0,87,FALSE,1,84,TRUE,1,73,FALSE,1,85,TRUE,1,98,TRUE,1,96,FALSE,0,60,TRUE,1,100,TRUE,0,97,TRUE,0,96,TRUE,1,91,TRUE,0,95,FALSE,0,52,TRUE,1,100,FALSE,1,53,TRUE,0,95,TRUE,0,61,FALSE,1,54,TRUE,1,93,TRUE,1,86,FALSE,1,86,FALSE,0,62,TRUE,0,94,TRUE,1,89,FALSE,1,60,TRUE,0,92,TRUE,0,85,TRUE,1,95,FALSE,0,60,TRUE,1,99,0.0016,0.0121,0,0.0004,0.0001,0.0225,0.3844,0,0.2116,0.0196,0.0025,0.0081,0.36,0.9409,0.0729,0,0.0196,0.0256,0.8464,0.8836,0.0049,0.2704,0.3721,0.9025,0.2209,0.16,0.36,0.81,0.7569,0.9025,0.7225,0.9216,0.364360714,0.1477,0.581021429,9,28.13,18,56.25,3,37.5,7,87.5,4,50,4,50,12,75,6,37.5,83.38,71.75,83.12,93.38,85.25,84.62,82.12,-28.12,27.13,34.25,-4.38,43.38,35.25,9.62,44.62,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,2,1,0,1,0,0,0,0,0,1,0,0,0,0.8,0,0.2,0,0.8,0.2,0.2,0.25,0.3,0.67,0.67,-1,1,0,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),65,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,-0.2,0,-0.05 +120,R_1BDXOvYr3SMssDf,60 - 66,Canadian,Female,1,2,3,1,2,0,0,1,-1,0,1,2,1,-2,1,0,0,1,1,0,1,2,3,0,2,5,-1,0,1,1,-1,3,1,1,0,-1,1,3,0,1,0,0,-1,3,2,2,2,1,2,5,0,0,0,0,0,1,1,2,0,-2,1,3,0,1,1,1,0,1,TRUE,0,79,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,78,TRUE,1,100,TRUE,1,100,TRUE,1,74,TRUE,1,74,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,0,50,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,69,FALSE,1,50,TRUE,1,100,FALSE,1,77,TRUE,1,76,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.0576,0,0,0,0.0484,0,0.0676,0,0.0961,0,0.25,0.0676,0.25,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.25,0.25,1,0.5625,0.25,0.25,0.6241,1,1,1,1,0.331042857,0.109264286,0.552821429,19,59.38,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,76.62,59.25,69.12,84.38,93.75,77.69,75.56,-6.25,10.99,-3.25,6.62,21.88,18.75,-9.81,31.81,0,0,0,1,0,1,0,0,2,1,0,1,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0.2,0.8,0.6,0.8,0.4,0.4,0.2,0.2,0.6,0.3,3.67,3,0,2,0,2,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,66,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,-1,0,-1,1,0,1,0,-1,1,1,0,1,0,1,0,0,0,1,1,1,-0.2,0.4,0.4,0.6,0.3 +121,R_7HCeHrTpMN1UNBZ,53 - 59,Canadian,Male,3,1,0,0,1,-2,-1,2,-2,1,1,-1,2,-2,1,-2,0,-2,-2,-2,2,1,1,-2,1,7,-2,-1,2,-1,1,6,1,1,1,1,0,5,-2,1,-1,-1,-2,7,3,1,0,0,2,3,-2,-2,1,-2,1,7,1,1,1,-3,1,3,1,1,1,1,-2,4,TRUE,0,50,TRUE,1,69,TRUE,0,80,FALSE,1,80,FALSE,0,65,TRUE,0,58,TRUE,1,90,TRUE,1,80,TRUE,1,86,FALSE,0,92,FALSE,1,85,TRUE,0,95,FALSE,0,86,TRUE,0,89,FALSE,0,87,TRUE,1,85,TRUE,0,50,FALSE,1,65,FALSE,1,59,FALSE,1,100,FALSE,0,59,TRUE,1,91,TRUE,0,81,TRUE,1,93,FALSE,1,96,TRUE,1,91,TRUE,0,61,FALSE,1,100,FALSE,1,70,TRUE,1,80,FALSE,0,90,TRUE,1,100,0.04,0.0081,0.0225,0.01,0,0.3364,0.0049,0.8464,0,0.0081,0.04,0.7396,0.0196,0.0225,0.4225,0.0961,0.6561,0.04,0,0.0016,0.3481,0.7569,0.1681,0.7921,0.25,0.3721,0.81,0.25,0.64,0.1225,0.09,0.9025,0.312003571,0.230871429,0.393135714,25,78.13,18,56.25,5,62.5,2,25,5,62.5,6,75,10,62.5,8,50,80.09,77.12,71.12,83,89.12,84,76.19,21.88,23.84,14.62,46.12,20.5,14.12,21.5,26.19,1,0,1,2,0,0,0,0,1,0,0,2,1,3,1,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,2,1,1,0,3,1,3,3,0,0.8,0.2,1.4,0.6,0.2,0.4,0.8,2,0.75,0.85,6,4.33,4,-1,2,3,1.67,5 cents,100 minutes,47 days,Male,University - Undergraduate,59,0.875,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,1,0,1,2,-1,0,-1,-1,1,0,0,0,0,2,1,-3,0,-2,-2,0,0.6,-0.2,0.6,-1.4,-0.1 +122,R_71oXpdwjBQQF0Hd,60 - 66,Canadian,Female,2,0,0,-3,2,-2,-3,3,-1,2,2,1,2,-2,3,-2,1,0,0,1,3,1,0,-3,2,6,-2,-2,3,0,3,5,2,1,1,0,3,7,-2,-1,-1,-1,-2,6,2,1,0,-3,2,1,-3,-3,2,-1,2,3,1,0,2,-3,3,5,-1,0,0,-1,0,5,FALSE,1,100,TRUE,1,96,FALSE,1,100,FALSE,1,50,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,91,FALSE,0,53,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,FALSE,1,60,TRUE,0,70,FALSE,1,58,TRUE,1,65,TRUE,1,91,FALSE,1,96,TRUE,1,97,FALSE,1,88,TRUE,1,95,FALSE,1,95,FALSE,1,98,FALSE,1,65,TRUE,1,90,FALSE,0,79,TRUE,1,100,0,0.0025,0,0,0,0,0.0009,0,0.1764,0.0081,0.01,0.2809,0.25,0,0.0081,0.0016,0.0016,0.25,0.0004,0.0144,0.1225,0.25,0.49,0,0.09,0.0025,0.6241,0,0,0.16,0.1225,0.8281,0.131860714,0.070542857,0.193178571,25,78.13,27,84.38,5,62.5,7,87.5,8,100,7,87.5,13,81.25,14,87.5,84.31,73.75,80,91.75,91.75,84.81,83.81,-6.25,-0.07,11.25,-7.5,-8.25,4.25,3.56,-3.69,1,1,0,0,0,0,1,0,1,1,0,0,1,2,0,0,2,1,1,3,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,0.4,0.6,0.6,1.4,0.2,0.4,0.6,0.8,0.75,0.5,6,3,5,2,2,1,3,10 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),64,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,1,0,0,0,0,-1,1,-1,1,1,-1,-1,1,1,0,-1,1,1,0,2,0.2,0.2,0,0.6,0.25 +123,R_7Va42f92krLujmc,53 - 59,Canadian,Female,2,2,3,-3,1,-3,-3,3,-1,-3,3,3,3,-3,3,2,2,2,2,-3,2,2,3,-1,1,1,-3,-3,3,-1,-3,1,3,3,3,-3,3,0,1,1,1,2,2,2,0,3,3,0,1,1,-3,-3,3,-2,-3,1,3,3,3,-3,3,0,2,2,2,3,2,1,TRUE,0,50,TRUE,1,70,TRUE,0,70,FALSE,1,50,FALSE,0,50,FALSE,1,70,TRUE,1,70,TRUE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,95,TRUE,1,100,FALSE,1,90,TRUE,1,85,TRUE,1,85,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,FALSE,0,50,TRUE,1,75,FALSE,1,80,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,0,50,FALSE,1,80,TRUE,0,85,TRUE,1,95,FALSE,0,50,TRUE,1,90,0.0025,0.0016,0.0225,0.09,0.01,0.09,0.0025,0,0.25,0.0625,0.0025,0,0.25,0.25,0.25,0.09,0.04,0.25,0.04,0,0.25,0.0225,0.81,0.01,0.25,0.25,0.25,0.25,0.49,1,0.7225,0.9025,0.242678571,0.110535714,0.374821429,22,68.75,22,68.75,5,62.5,5,62.5,6,75,6,75,13,81.25,9,56.25,75.5,61.88,71.88,85.12,83.12,78.5,72.5,0,6.75,-0.62,9.38,10.12,8.12,-2.75,16.25,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,5,2,1,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,5,0.4,0,0,1.6,1.2,0.2,0,1.2,0.5,0.65,0.67,0.67,0,0,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,59,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-2,-1,0,-1,0,0,0,0,-1,0,0,0,0,0,0,1,1,1,-1,0,-0.8,-0.2,0,0.4,-0.15 +124,R_3TE4Et8JPxD5E2d,53 - 59,Canadian,Female,0,0,3,0,3,2,-2,0,-3,3,0,3,3,-3,3,3,3,3,3,1,3,0,3,0,3,0,3,-2,2,-3,3,0,0,3,3,-3,3,0,-1,-1,-3,-3,-3,0,3,0,3,0,3,1,1,-1,0,-3,2,0,0,3,3,-3,3,5,3,3,3,3,1,0,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0,0,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,1,0.25,0.285714286,0.178571429,0.392857143,24,75,15,46.88,3,37.5,3,37.5,3,37.5,6,75,13,81.25,2,12.5,67.19,56.25,62.5,81.25,68.75,71.88,62.5,28.12,20.31,18.75,25,43.75,-6.25,-9.37,50,3,0,0,0,0,1,0,2,0,0,0,0,0,0,0,4,4,6,6,4,3,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0.6,0.6,0,4.8,0.6,0.6,0,0,1.5,0.3,0,2,-1,0,-5,0,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),56,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,-1,2,0,-1,0,0,0,0,0,4,4,6,6,4,0,0,0,4.8,1.2 +125,R_7Cg6cPOKf5R6mch,67 - 73,Canadian,Male,-1,3,1,2,1,-1,-2,3,-2,-1,2,1,2,-2,1,1,0,1,1,1,-2,3,1,-3,1,2,-1,1,2,1,1,3,1,1,2,-2,1,7,-3,-3,-3,-1,-2,7,-1,3,2,3,2,4,-1,-2,1,1,-3,2,1,1,2,-2,1,2,-1,-2,-2,1,-1,4,TRUE,0,54,TRUE,1,65,TRUE,0,70,TRUE,0,50,FALSE,0,50,FALSE,1,71,TRUE,1,62,TRUE,1,50,FALSE,0,50,FALSE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,69,FALSE,1,50,FALSE,0,50,TRUE,1,81,TRUE,0,50,TRUE,0,78,FALSE,1,50,FALSE,1,94,TRUE,1,89,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,59,TRUE,1,57,TRUE,0,50,TRUE,0,80,TRUE,0,50,TRUE,1,77,TRUE,1,73,TRUE,1,97,0.25,0.1849,0.0361,0.1444,0.0009,0.0841,0.25,0.5625,0.0036,0.25,0.0529,0.0961,0.25,0.25,0.25,0.1225,0.25,0.25,0.64,0.1681,0.0121,0.25,0.25,0.25,0.25,0.25,0.0729,0.2916,0.49,0.6084,0.25,0.25,0.239489286,0.1909,0.288078571,24,75,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,62.53,54.75,65.75,60.62,69,65.31,59.75,15.62,3.15,4.75,3.25,-1.88,6.5,-3.44,9.75,1,0,0,5,0,0,3,1,3,2,1,0,0,0,0,4,3,4,2,3,0,0,1,1,1,0,0,2,3,2,1,0,0,0,0,2,2,3,0,2,1.2,1.8,0.2,3.2,0.6,1.4,0.2,1.8,1.6,1,4,2.67,-2,1,5,3,1.33,10 cents,5 minutes,47 days,Male,University - Undergraduate,72,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,0,-1,4,-1,0,3,-1,0,0,0,0,0,0,0,2,1,1,2,1,0.6,0.4,0,1.4,0.6 +126,R_1EsdwdL2CMmGUmS,67 - 73,American,Male,2,2,-1,0,3,0,0,3,-1,0,3,3,1,2,0,3,1,2,0,3,2,3,1,0,3,9,1,-1,2,-1,1,9,0,1,1,2,1,9,1,0,1,0,1,9,2,2,1,2,3,9,2,-1,3,-1,3,9,3,3,0,3,1,9,2,3,3,1,2,9,TRUE,0,100,TRUE,1,100,FALSE,1,62,FALSE,1,59,TRUE,1,100,TRUE,0,90,FALSE,0,85,TRUE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,59,TRUE,0,100,FALSE,0,75,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,58,TRUE,0,100,TRUE,0,100,FALSE,1,66,TRUE,1,100,TRUE,1,100,TRUE,1,81,0,0.3364,0,0.7225,0.0361,0.81,0,0,1,0,0,0,0.01,1,0,0,1,0.1681,1,1,0.5625,0,0.1681,1,1,1,0,1,0.1444,1,0.1156,1,0.464814286,0.287442857,0.642185714,25,78.13,17,53.13,6,75,4,50,2,25,5,62.5,13,81.25,4,25,91.41,88.5,89,92.88,95.25,93.06,89.75,25,38.28,13.5,39,67.88,32.75,11.81,64.75,0,1,2,0,0,1,1,1,0,1,3,2,0,0,1,2,1,1,0,2,0,0,2,2,0,2,1,0,0,3,0,0,1,1,1,1,2,1,1,1,0.6,0.8,1.2,1.2,0.8,1.2,0.6,1.2,0.95,0.95,9,9,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - PhD,72,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,1,0,-2,0,-1,0,1,0,-2,3,2,-1,-1,0,1,-1,0,-1,1,-0.2,-0.4,0.6,0,0 +127,R_3flOdNLpKVbmtLi,67 - 73,American,Female,2,1,2,1,1,1,-2,2,-1,-1,3,3,3,-2,2,2,1,3,2,2,2,1,2,1,1,1,1,-2,2,-2,1,1,3,3,1,-2,2,1,1,1,1,2,2,1,2,1,2,1,1,2,1,-1,2,-1,-1,1,3,3,2,-2,2,1,2,2,2,1,2,2,TRUE,0,70,TRUE,1,80,FALSE,1,71,FALSE,1,50,TRUE,1,54,FALSE,1,55,TRUE,1,80,TRUE,1,90,TRUE,1,60,TRUE,1,70,FALSE,1,70,TRUE,0,91,TRUE,1,75,FALSE,1,50,TRUE,1,60,TRUE,1,92,FALSE,1,65,TRUE,0,91,FALSE,1,55,FALSE,1,90,TRUE,1,55,TRUE,1,55,FALSE,1,55,TRUE,1,60,FALSE,1,76,TRUE,1,71,FALSE,1,55,FALSE,1,76,TRUE,0,75,FALSE,0,75,FALSE,0,60,TRUE,1,100,0.01,0.0841,0.0064,0.04,0,0.2025,0.16,0.09,0.01,0.2025,0.5625,0.0625,0.16,0.09,0.2116,0.04,0.2025,0.25,0.0576,0.0576,0.2025,0.16,0.2025,0.25,0.1225,0.2025,0.36,0.49,0.0841,0.8281,0.5625,0.8281,0.237575,0.160292857,0.314857143,16,50,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,69.75,61.25,66.75,70.38,80.62,71.06,68.44,-31.25,-11.5,-26.25,-20.75,-4.62,5.62,-16.44,-6.56,0,0,0,0,0,0,0,0,1,2,0,0,2,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0.6,0.4,0.6,0,0.2,0.2,0.6,0.4,0.25,1,1.33,-1,0,0,-1,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,-1,0,1,2,0,0,1,0,0,1,-1,1,-1,0,0,0.4,0.2,0,0.15 +128,R_3YXRM924PtBf6ux,32 - 38,Canadian,Male,-1,3,2,-1,-3,-2,-1,-2,2,0,1,-1,3,-1,3,-3,-2,-1,-2,-3,1,3,3,0,-3,6,0,2,-3,3,1,5,0,-1,0,0,0,5,0,0,1,0,-1,4,0,2,2,0,2,5,0,0,0,0,0,5,0,-1,2,-1,3,4,0,0,0,0,-1,5,TRUE,0,60,FALSE,0,50,TRUE,0,60,FALSE,1,50,FALSE,0,60,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,60,FALSE,1,50,FALSE,0,70,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,50,FALSE,1,50,FALSE,0,100,TRUE,1,65,TRUE,0,95,TRUE,1,60,FALSE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,67,FALSE,0,91,FALSE,0,50,TRUE,1,71,0,0.0025,0,0.1225,0.0841,0,0.16,0.25,0.25,0.1225,0.8281,0.49,0.25,0.16,0.36,0.25,0.9025,0.25,0.25,0.25,1,0.25,0.25,0,0.25,0.25,0.25,0.36,0.36,0.49,0.4489,0.25,0.322003571,0.311228571,0.332778571,19,59.38,16,50,2,25,3,37.5,5,62.5,6,75,7,43.75,9,56.25,66.84,51.25,76.62,69.38,70.12,70.44,63.25,9.38,16.84,26.25,39.12,6.88,-4.88,26.69,7,2,0,1,1,0,2,3,1,1,1,1,0,3,1,3,3,2,2,2,2,1,1,0,1,5,2,1,2,2,0,1,0,1,0,0,3,2,1,2,2,0.8,1.6,1.6,2.2,1.6,1.4,0.4,2,1.55,1.35,5.33,4.67,1,0,1,-1,0.66,10 cents,5 minutes,24 days,Male,High School (or equivalent),32,0.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,01DIR,1,-1,1,0,-5,0,2,-1,-1,1,0,0,2,1,3,0,0,1,0,0,-0.8,0.2,1.2,0.2,0.2 +129,R_12AaJXOVHjAjKCq,60 - 66,Canadian,Male,0,3,3,1,3,2,-2,3,-1,3,1,2,3,0,1,2,2,3,2,0,0,3,2,-1,2,7,2,-1,2,0,2,4,0,2,2,1,0,2,-1,-2,-1,-1,-2,8,0,2,3,3,-1,7,-1,-3,-1,-3,-1,4,0,2,2,-3,0,2,-3,-2,1,2,1,8,TRUE,0,100,FALSE,0,64,TRUE,0,94,FALSE,1,51,FALSE,0,51,FALSE,1,69,TRUE,1,95,TRUE,1,87,TRUE,1,51,FALSE,0,96,FALSE,1,74,TRUE,0,91,TRUE,1,88,TRUE,0,55,FALSE,0,51,TRUE,1,96,TRUE,0,59,TRUE,0,65,TRUE,0,60,FALSE,1,76,FALSE,0,64,TRUE,1,81,TRUE,0,53,TRUE,1,71,FALSE,1,96,TRUE,1,92,TRUE,0,52,FALSE,1,99,TRUE,0,62,FALSE,0,86,TRUE,1,79,TRUE,1,100,0.0169,0.0064,0.0016,0.0025,0,0.0961,0.0841,0.9216,0.0576,0.0361,0.7396,0.0144,0.2401,0.0676,0.2601,0.4096,0.2809,0.2401,0.0001,0.0016,0.4096,0.2601,0.36,0.3025,0.3481,0.2704,0.0441,1,0.8836,0.4225,0.3844,0.8281,0.320107143,0.246278571,0.393935714,18,56.25,16,50,4,50,3,37.5,4,50,5,62.5,10,62.5,6,37.5,75.25,60.25,68.25,85,87.5,78.25,72.25,6.25,25.25,10.25,30.75,35,25,15.75,34.75,0,0,1,2,1,0,1,1,1,1,1,0,1,1,1,3,4,4,3,2,0,1,0,2,4,3,1,4,2,4,1,0,1,3,1,5,4,2,0,1,0.8,0.8,0.8,3.2,1.4,2.8,1.2,2.4,1.4,1.95,4.33,4.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),63,1.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,-1,1,0,-3,-3,0,-3,-1,-3,0,0,0,-2,0,-2,0,2,3,1,-0.6,-2,-0.4,0.8,-0.55 +130,R_6VkvM4RwzyqX4xX,25 - 31,Canadian,Female,2,1,2,1,2,-1,-2,-1,1,1,1,1,1,2,0,-1,-1,-3,-2,-2,-2,3,1,-2,2,5,2,-1,-2,-1,2,6,1,1,1,0,1,0,-2,-2,-1,-1,-2,10,1,1,2,2,2,6,1,-2,1,-2,1,6,1,1,1,1,1,1,1,1,0,0,0,4,TRUE,0,80,TRUE,1,50,TRUE,0,100,FALSE,1,52,TRUE,1,50,FALSE,1,53,TRUE,1,96,TRUE,1,75,FALSE,0,55,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,1,62,TRUE,0,55,FALSE,0,58,TRUE,1,76,TRUE,0,70,TRUE,0,80,FALSE,1,92,FALSE,1,67,FALSE,0,70,TRUE,1,83,TRUE,0,79,FALSE,0,82,FALSE,1,100,TRUE,1,80,FALSE,1,72,FALSE,1,79,FALSE,1,70,TRUE,1,81,TRUE,1,70,TRUE,1,71,0.0625,0.04,0.0576,0.0016,0.0841,0.2209,0.6724,0,0.1089,0.0289,0.0361,0.1444,0.3025,0.6561,0.25,0.25,0.6241,0.2304,0.0441,0,0.49,0.3364,0.0064,0.3025,0.49,0.0784,0.09,0.64,1,0.64,0.09,1,0.314878571,0.257771429,0.371985714,19,59.38,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,12,75,8,50,74.66,66.25,65.62,84.25,82.5,72.44,76.88,-3.12,12.16,3.75,3.12,21.75,20,-2.56,26.88,4,2,1,3,0,3,1,1,2,1,0,0,0,2,1,1,1,2,1,0,1,0,0,1,0,2,0,2,3,0,0,0,0,1,1,2,2,3,2,2,2,1.6,0.6,1,0.4,1.4,0.4,2.2,1.3,1.1,3.67,4.33,-1,0,-1,6,-0.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),29,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,3,2,1,2,0,1,1,-1,-1,1,0,0,0,1,0,-1,-1,-1,-1,-2,1.6,0.2,0.2,-1.2,0.2 +131,R_7dCk3EV35G3hOnf,60 - 66,Canadian,Male,2,2,2,2,1,1,0,3,1,2,3,2,3,3,2,1,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,0,0,0,1,1,2,3,3,2,3,3,3,2,2,2,2,2,3,2,3,2,3,3,3,2,1,2,1,1,3,TRUE,0,100,TRUE,1,99,TRUE,0,50,FALSE,1,68,FALSE,0,52,FALSE,1,50,TRUE,1,90,TRUE,1,89,TRUE,1,70,TRUE,1,64,TRUE,0,86,TRUE,0,82,TRUE,1,89,TRUE,0,87,FALSE,0,50,TRUE,1,96,FALSE,1,50,TRUE,0,90,FALSE,1,60,FALSE,1,98,FALSE,0,99,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,69,TRUE,1,86,TRUE,0,100,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,81,0.0121,0.0196,0.0016,0.01,0.0361,0.25,0.25,0.1296,0.0004,0.25,0,0.0121,0.09,0.7396,0.2704,0.0001,0.25,0.1024,0.25,0.4761,0.9801,0.25,0.16,0.7569,0.25,1,0.25,1,0.25,0.81,0.25,0.6724,0.347721429,0.17005,0.525392857,16,50,17,53.13,4,50,4,50,4,50,5,62.5,11,68.75,6,37.5,73.59,72.88,65.12,79.5,76.88,75.94,71.25,-3.13,20.46,22.88,15.12,29.5,14.38,7.19,33.75,0,0,0,0,1,1,2,1,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,1,2,1,2,1,1,0,1,1,1,0,1,1,1,1,0,0,0.2,1,0.6,0.4,1,1,0.8,0.6,0.55,0.85,2.33,3,-1,0,-1,-1,-0.67,10 cents,25 minutes,24 days,Male,High School (or equivalent),63,0.25,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,-1,-1,0,-1,-1,0,0,0,0,0,0,-1,0,1,-1,0,-1,0,0,0,-0.8,0,-0.2,-0.2,-0.3 +132,R_6fdhGMa008fFigW,67 - 73,American,Female,3,2,2,1,2,-1,-2,3,-2,0,2,2,2,-1,2,-1,0,1,1,0,2,2,2,2,2,7,-1,-2,2,-2,0,6,2,2,2,-1,2,7,0,-1,1,0,-1,5,2,2,2,2,2,5,-2,-2,2,-2,-2,7,2,2,2,0,2,8,0,0,0,0,0,5,TRUE,0,84,TRUE,1,100,FALSE,1,100,TRUE,0,60,TRUE,1,100,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,92,FALSE,0,100,TRUE,0,72,TRUE,0,100,TRUE,1,96,TRUE,0,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,TRUE,0,63,TRUE,0,78,FALSE,1,100,FALSE,0,84,TRUE,1,85,FALSE,1,100,TRUE,1,72,FALSE,1,100,TRUE,1,56,TRUE,0,68,TRUE,0,60,TRUE,0,95,TRUE,1,79,TRUE,1,100,TRUE,1,100,0,0.1936,0,0,0,0.0016,0.0784,1,0,0.0225,0.0441,0.0016,0.0064,0.5184,0,0,0,0.36,0.36,0,0.7056,0.1225,0.6084,1,0,0.4624,0,0.7056,0,0.3969,0.9025,1,0.296317857,0.145214286,0.447421429,23,71.88,20,62.5,4,50,6,75,4,50,6,75,14,87.5,6,37.5,87.66,79.38,96.38,86,88.88,89.31,86,9.38,25.16,29.38,21.38,36,13.88,1.81,48.5,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,1,0,2,0,0,0,1,0,1,0,1,1,0,0.4,0.2,0,0.8,0.4,0.8,0.2,0.6,0.35,0.5,6.67,6.67,2,-1,-1,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),69,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,-1,0,0,0,-2,0,0,0,-1,0,0,1,-1,0,1,0,-0.6,-0.2,0.2,-0.15 +133,R_1jiy35s47l7pFP2,60 - 66,Canadian,Male,-2,-2,-1,1,-2,0,0,1,1,1,1,0,1,1,0,1,1,1,0,1,-2,-2,-2,-1,-2,3,1,0,1,0,0,5,1,1,1,0,1,6,0,0,0,0,0,6,0,0,0,0,0,5,1,0,0,0,1,5,1,1,1,0,1,5,1,1,0,0,0,5,FALSE,1,64,TRUE,1,53,TRUE,0,91,TRUE,0,65,TRUE,1,53,TRUE,0,62,FALSE,0,62,TRUE,1,54,TRUE,1,69,TRUE,1,100,FALSE,1,65,TRUE,0,98,TRUE,1,57,FALSE,1,50,TRUE,1,50,TRUE,1,56,TRUE,0,61,TRUE,0,100,FALSE,1,54,TRUE,0,50,TRUE,1,56,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,89,TRUE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.2116,0.0121,0.1936,0.3844,0,0.3844,0.25,0,0.25,0.25,0,0.1849,0.0961,0.1225,0.2209,0.2209,0.25,0.4225,1,0.25,0.1936,0.25,0.2116,0.25,0.3721,0.25,0.25,0.1296,0.8281,1,0.25,0.9604,0.315985714,0.189442857,0.442528571,19,59.38,19,59.38,6,75,5,62.5,4,50,4,50,14,87.5,5,31.25,65.91,57,61.12,70.62,74.88,65.56,66.25,0,6.53,-18,-1.38,20.62,24.88,-21.94,35,0,0,1,2,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,2,2,1,1,2,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0.6,0.6,0.6,0.8,1.6,0.6,0.6,0.4,0.65,0.8,4.67,5,-2,0,1,1,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),60,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-2,-2,0,1,-2,0,0,-1,0,1,0,0,0,0,0,1,1,0,0,0,-1,0,0,0.4,-0.15 +134,R_52nkx602HV2MbSm,67 - 73,American,Female,2,2,2,2,2,1,0,1,0,1,2,2,2,0,1,0,1,1,1,0,1,1,0,-1,1,6,2,1,2,0,2,5,0,1,0,1,0,5,1,0,0,0,0,7,0,1,1,1,0,4,0,0,1,1,0,5,1,1,2,0,1,5,0,-1,0,0,0,5,TRUE,0,93,TRUE,1,92,FALSE,1,68,FALSE,1,55,FALSE,0,62,FALSE,1,100,FALSE,0,59,TRUE,1,83,TRUE,1,61,TRUE,1,62,TRUE,0,57,FALSE,1,90,FALSE,0,84,FALSE,1,92,TRUE,1,60,FALSE,0,52,FALSE,1,67,TRUE,0,91,TRUE,0,62,FALSE,1,100,FALSE,0,65,TRUE,1,62,TRUE,0,66,TRUE,1,85,FALSE,1,71,TRUE,1,66,TRUE,0,60,FALSE,1,68,TRUE,0,70,FALSE,0,65,FALSE,0,60,TRUE,1,100,0.0289,0.1156,0.2704,0.3481,0,0,0.0225,0.1444,0,0.1444,0.4225,0.7056,0.1521,0.3249,0.3844,0.0064,0.4356,0.2025,0.1024,0.0841,0.4225,0.16,0.3844,0.0064,0.1089,0.36,0.36,0.8649,0.1024,0.8281,0.49,0.01,0.258192857,0.210378571,0.306007143,13,40.63,18,56.25,4,50,3,37.5,5,62.5,6,75,9,56.25,9,56.25,72.75,63.38,76.75,74.5,76.38,69.88,75.62,-15.62,16.5,13.38,39.25,12,1.38,13.63,19.37,1,1,2,3,1,1,1,1,0,1,2,1,2,1,1,1,1,1,1,0,2,1,1,1,2,1,0,0,1,1,1,1,0,0,0,0,2,1,1,0,1.6,0.8,1.4,0.8,1.4,0.6,0.4,0.8,1.15,0.8,5.33,4.67,2,0,0,2,0.66,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,68,0.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,-1,0,1,2,-1,0,1,1,-1,0,1,0,2,1,1,1,-1,0,0,0,0.2,0.2,1,0,0.35 +135,R_7nejt6E4wnCP4L3,67 - 73,Canadian,Female,1,0,2,1,2,1,-1,1,-1,1,1,1,1,0,2,0,-1,1,0,0,0,0,2,1,2,7,0,-2,1,0,0,7,1,1,2,-1,1,8,1,1,1,1,-1,3,1,0,2,1,2,7,0,-2,1,-1,0,5,1,1,1,0,2,6,0,0,0,0,-1,6,FALSE,1,86,TRUE,1,100,TRUE,0,100,FALSE,1,82,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,78,FALSE,0,68,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,0,72,TRUE,0,100,TRUE,1,94,TRUE,1,61,TRUE,0,66,TRUE,1,72,TRUE,0,75,TRUE,1,80,TRUE,0,75,TRUE,0,87,TRUE,0,92,TRUE,1,97,TRUE,1,100,TRUE,1,100,0,0.04,0,0,0,0,0.0784,0,1,0.1521,0.0009,0.4624,0,1,0.0025,0,0.4356,0.0324,0.7569,0.5625,0.0036,0,0.5184,0,0.6561,0.5625,0,0.0196,1,1,0.8464,0.0484,0.326382143,0.226021429,0.426742857,24,75,20,62.5,5,62.5,4,50,6,75,5,62.5,15,93.75,5,31.25,89.41,91.12,87,87.75,91.75,91.69,87.12,12.5,26.91,28.62,37,12.75,29.25,-2.06,55.87,1,0,0,0,0,1,1,0,1,1,0,0,1,1,1,1,2,0,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,1,1,0,1,0.2,0.8,0.6,1,0,0.6,0,0.6,0.65,0.3,7.33,6,0,2,2,-3,1.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),73,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,-1,1,0,0.2,0.2,0.6,0.4,0.35 +136,R_6VvkzF78AK1eC8F,53 - 59,Canadian,Female,1,2,2,-2,0,-1,1,2,0,0,2,1,2,1,2,-1,1,1,1,2,2,2,2,-1,0,7,-1,-1,1,1,0,6,1,1,1,1,1,8,-1,-1,-1,-1,2,8,2,1,2,0,0,8,-1,0,2,0,0,6,2,2,2,0,2,8,1,1,1,1,2,7,FALSE,1,52,FALSE,0,51,FALSE,1,100,FALSE,1,53,FALSE,0,50,FALSE,1,100,TRUE,1,64,TRUE,1,74,FALSE,0,53,TRUE,1,55,TRUE,0,53,TRUE,0,62,TRUE,1,63,TRUE,0,90,TRUE,1,53,TRUE,1,68,TRUE,0,54,TRUE,0,79,FALSE,1,55,TRUE,0,51,TRUE,1,51,TRUE,1,58,TRUE,0,59,TRUE,1,82,FALSE,1,88,TRUE,1,77,TRUE,0,53,TRUE,0,54,TRUE,0,91,TRUE,1,87,TRUE,1,61,TRUE,1,100,0.0676,0.0529,0.1024,0.1296,0,0,0.0324,0.2025,0.2601,0.1764,0.0169,0.1369,0.2809,0.2809,0.25,0.2601,0.3481,0.2209,0.2916,0.0144,0.2401,0.2209,0.2025,0.81,0.2916,0.2809,0.1521,0.2304,0,0.6241,0.8281,0.3844,0.251328571,0.17615,0.326507143,18,56.25,19,59.38,4,50,4,50,6,75,5,62.5,13,81.25,6,37.5,66.91,54,71,70.38,72.25,65.44,68.38,-3.13,7.53,4,21,-4.62,9.75,-15.81,30.88,1,0,0,1,0,0,2,1,1,0,1,0,1,0,1,0,2,2,2,0,1,1,0,2,0,0,1,0,0,0,0,1,0,1,0,2,0,0,0,0,0.4,0.8,0.6,1.2,0.8,0.2,0.4,0.4,0.75,0.45,7,7.33,-1,0,0,1,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),54,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,-1,0,-1,0,0,1,1,1,0,1,-1,1,-1,1,-2,2,2,2,0,-0.4,0.6,0.2,0.8,0.3 +137,R_3SBOkbknaMoB7Mv,53 - 59,Canadian,Male,2,1,3,1,2,-2,0,3,-1,-1,2,2,2,-2,2,1,1,1,1,1,2,1,2,-2,2,3,-2,-2,2,-2,1,2,2,2,2,-2,2,4,1,2,1,1,2,2,2,1,2,2,2,2,-2,-1,2,-1,-1,2,2,2,1,-2,1,2,1,0,2,1,1,6,TRUE,0,76,TRUE,1,100,TRUE,0,100,FALSE,1,57,TRUE,1,67,FALSE,1,71,TRUE,1,100,TRUE,1,84,TRUE,1,53,FALSE,0,100,FALSE,1,54,TRUE,0,93,TRUE,1,96,FALSE,1,91,TRUE,1,63,FALSE,0,85,TRUE,0,83,TRUE,0,90,TRUE,0,58,TRUE,0,100,FALSE,0,55,TRUE,1,53,TRUE,0,53,FALSE,0,55,FALSE,1,66,TRUE,1,64,FALSE,1,51,TRUE,0,87,FALSE,1,54,TRUE,1,92,TRUE,1,60,TRUE,1,55,0.0256,0.1296,0.7225,0,0.2025,0.0841,0.3025,1,1,0.2209,0.0064,0.0016,0.2209,0.2116,0.1089,0,0.2809,0.1849,0.7569,0.1156,0.3025,0.1369,0.3364,0.0081,0.6889,0.2401,0.16,0.5776,1,0.81,0.2116,0.8649,0.358382143,0.273228571,0.443535714,23,71.88,19,59.38,7,87.5,5,62.5,5,62.5,2,25,12,75,7,43.75,73.94,62,66.75,80,87,73.88,74,12.5,14.56,-25.5,4.25,17.5,62,-1.12,30.25,0,0,1,3,0,0,2,1,1,2,0,0,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,1,1,0,0,0.8,1.2,0,0.4,0.4,0.4,0.4,0.4,0.6,0.4,3,2,1,0,2,-4,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,57,0,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,2,0,0,1,0,1,2,0,0,-1,0,-1,0,0,-1,0,1,0.4,0.8,-0.4,0,0.2 +138,R_5OACV3KWceUn6UF,39 - 45,American,Female,3,3,3,-2,3,-1,-2,3,0,3,3,0,3,-1,3,-1,1,2,0,-3,3,3,3,-3,-1,4,-3,1,-1,2,-2,5,2,0,0,0,1,3,-2,-2,-3,-2,-3,4,3,3,3,-2,3,2,-2,-2,3,-2,3,0,3,0,3,0,3,0,0,0,0,0,-2,3,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,92,TRUE,1,91,TRUE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,81,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,80,TRUE,0,50,TRUE,1,75,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,79,TRUE,1,50,TRUE,1,100,0,0.0625,0.25,0.0081,0,0.0064,0.04,0.25,0.25,0.25,0.0441,0,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.6561,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.214164286,0.149321429,0.279007143,6,18.75,18,56.25,3,37.5,6,75,4,50,5,62.5,14,87.5,4,25,62.44,50,74,62.12,63.62,67.19,57.69,-37.5,6.19,12.5,-1,12.12,1.12,-20.31,32.69,0,0,0,1,4,2,3,4,2,5,1,0,3,1,2,1,3,5,2,0,0,0,0,0,0,1,0,0,2,0,0,0,0,1,0,1,1,2,0,1,1,3.2,1.4,2.2,0,0.6,0.2,1,1.95,0.45,4,0.67,2,5,3,1,3.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,43,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,4,1,3,4,0,5,1,0,3,0,2,0,2,3,2,-1,1,2.6,1.2,1.2,1.5 +139,R_13Wi1nBilcnuUPc,67 - 73,Canadian,Female,3,1,3,-1,2,1,-2,-1,3,1,2,2,2,-1,3,1,2,1,3,1,3,2,1,-3,3,6,1,-2,2,2,2,7,1,3,3,2,3,6,1,2,2,3,1,8,3,-2,3,2,-3,9,-1,1,-3,3,-3,9,-2,2,-1,1,3,5,-2,-2,-2,0,1,9,TRUE,0,86,TRUE,1,92,FALSE,1,87,FALSE,1,73,FALSE,0,79,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,63,FALSE,0,100,TRUE,0,66,TRUE,0,99,TRUE,1,88,TRUE,0,92,TRUE,1,54,TRUE,1,100,FALSE,1,56,FALSE,1,93,FALSE,1,55,FALSE,1,99,FALSE,0,75,TRUE,1,91,FALSE,1,73,FALSE,0,53,FALSE,1,95,TRUE,1,96,FALSE,1,53,FALSE,1,100,FALSE,1,56,TRUE,1,65,TRUE,1,90,TRUE,1,100,0,0.0016,0,0.0001,0,0,0.2809,1,0.0001,0.0081,0.1225,0.0144,0.1369,0.4356,0.6241,0.0064,0.0729,0.0729,0,0.0025,0.5625,0.2116,0.2025,0.8464,0.1936,0.2209,0.01,0.7396,0.0169,0.0049,0.1936,0.9801,0.248567857,0.1982,0.298935714,19,59.38,24,75,7,87.5,6,75,5,62.5,6,75,12,75,12,75,82.12,68.25,78.38,94,87.88,84.06,80.19,-15.62,7.12,-19.25,3.38,31.5,12.88,9.06,5.19,0,1,2,2,1,0,0,3,1,1,1,1,1,3,0,0,0,1,0,0,0,3,0,3,5,2,3,2,0,4,4,0,3,2,0,3,4,3,3,0,1.2,1,1.2,0.2,2.2,2.2,1.8,2.6,0.9,2.2,6.33,7.67,-3,-2,1,-1,-1.34,10 cents,5 minutes,24 days,Female,High School (or equivalent),70,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,-2,2,-1,-4,-2,-3,1,1,-3,-3,1,-2,1,0,-3,-4,-2,-3,0,-1,-1.2,-0.6,-2.4,-1.3 +140,R_5OYQlm06tBC3oYW,67 - 73,Canadian,Male,3,0,0,1,-1,-2,0,1,-1,0,1,2,1,0,1,2,3,2,3,2,2,0,-2,0,-1,1,-1,-1,1,-1,-1,1,2,3,1,-1,2,2,1,2,2,2,2,2,2,1,-1,1,-1,3,0,-1,1,-1,-1,2,2,3,2,-1,2,1,2,1,3,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,FALSE,0,96,TRUE,0,100,TRUE,1,90,TRUE,1,100,TRUE,0,65,TRUE,0,100,TRUE,0,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,0,0,0,0,0.9216,0,0.5625,0,0,0.7225,0.25,0,1,0,0.01,0.9025,1,0.4225,0.36,0,1,1,1,0.7396,0,0.353257143,0.175471429,0.531042857,28,87.5,18,56.25,4,50,4,50,3,37.5,7,87.5,14,87.5,4,25,93.81,83.75,91.5,100,100,99.12,88.5,31.25,37.56,33.75,41.5,62.5,12.5,11.62,63.5,1,0,2,1,0,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,0,0,2,1,0,0,1,1,1,1,1,1,0,2,1,1,0,0.8,0.6,0.8,0.6,0.6,0.8,1,0.8,0.7,0.8,1.33,2,-2,-1,1,0,-0.67,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),73,-0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,-1,1,1,0,-1,0,0,0,0,0,0,-1,0,0,1,-1,-1,0,0,0.2,-0.2,-0.2,-0.2,-0.1 +141,R_6JgOAENdUiQE35f,67 - 73,American,Female,3,1,1,-1,3,-1,1,3,-1,-1,2,2,3,1,2,1,1,2,2,2,3,1,1,-1,3,6,-1,-1,3,1,0,2,2,3,3,1,2,4,1,1,1,1,1,5,3,1,1,1,2,6,-2,0,2,1,-1,5,2,3,3,1,2,6,1,-1,1,2,2,7,TRUE,0,96,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,96,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,FALSE,1,91,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,84,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,87,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.5776,1,0,0,0,0,0.0081,0.0016,0,0,0.25,0,0,0.0576,0.7056,0.7569,1,1,0.25,0,0.9216,0,0,1,1,0.304607143,0.131235714,0.477978571,30,93.75,22,68.75,5,62.5,6,75,5,62.5,6,75,14,87.5,8,50,93.94,82.75,96.5,96.5,100,95.75,92.12,25,25.19,20.25,21.5,34,25,8.25,42.12,0,0,0,0,0,0,2,0,2,1,0,1,0,0,0,0,0,1,1,1,0,0,0,2,1,1,1,1,2,0,0,1,0,0,0,0,2,1,0,0,0,1,0.2,0.6,0.6,1,0.2,0.6,0.45,0.6,4,5.67,0,-3,-2,-2,-1.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,-2,-1,-1,1,-1,0,1,0,0,0,0,0,0,-2,0,1,1,-0.6,0,0,0,-0.15 +142,R_7PFea8DfeKrRjGW,67 - 73,American,Male,1,3,2,1,0,0,-3,2,-2,1,3,2,2,-1,1,-1,1,2,2,-1,0,3,2,1,2,0,0,-2,2,-2,2,0,2,-1,2,1,2,3,2,2,1,2,1,1,1,2,2,1,-2,1,0,-2,2,-2,2,1,2,2,2,1,2,1,2,1,2,2,-1,4,TRUE,0,95,TRUE,1,100,TRUE,0,100,FALSE,1,57,FALSE,0,50,FALSE,1,74,TRUE,1,100,TRUE,1,85,TRUE,1,82,TRUE,1,93,FALSE,1,77,TRUE,0,84,TRUE,1,85,TRUE,0,73,FALSE,0,60,TRUE,1,100,FALSE,1,79,TRUE,0,86,TRUE,0,58,FALSE,1,100,TRUE,1,58,FALSE,0,57,FALSE,1,64,FALSE,0,61,TRUE,0,60,TRUE,1,98,FALSE,1,50,FALSE,1,74,TRUE,0,56,TRUE,1,95,TRUE,1,97,TRUE,1,81,0.0225,0.0004,0,0,0.0361,0.0676,0.3721,0.0049,0,0.3249,0.0025,0.0225,0.0324,0.0529,0.25,0,0.1296,0.1849,0.0676,0.36,0.1764,0.36,0.3364,0.5329,0.0441,0.25,0.0009,0.9025,1,0.7396,0.3136,0.7056,0.259642857,0.105742857,0.413542857,24,75,20,62.5,6,75,6,75,3,37.5,5,62.5,12,75,8,50,77.78,72.62,68.38,82.75,87.38,81.38,74.19,12.5,15.28,-2.38,-6.62,45.25,24.88,6.38,24.19,1,0,0,0,2,0,1,0,0,1,1,3,0,2,1,3,1,1,0,2,0,1,0,0,2,0,1,0,0,1,1,0,0,2,1,3,0,0,0,0,0.6,0.4,1.4,1.4,0.6,0.4,0.8,0.6,0.95,0.6,1,1,-1,-1,2,-3,0,10 cents,5 minutes,24 days,Male,Trade School (non-military),73,1,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,1,-1,0,0,0,0,0,0,0,0,0,3,0,0,0,0,1,1,0,2,0,0,0.6,0.8,0.35 +143,R_7w7DRq89EHLmPTW,67 - 73,American,Male,3,2,2,-2,0,-1,0,1,2,0,2,2,2,1,3,0,0,0,0,1,3,2,2,-2,1,2,0,0,0,1,-1,3,2,2,1,0,2,1,1,1,0,0,0,3,3,2,2,0,1,1,-1,-1,0,1,0,3,2,0,1,1,2,2,1,0,2,1,1,3,FALSE,1,97,TRUE,1,96,FALSE,1,65,FALSE,1,59,TRUE,1,64,FALSE,1,87,TRUE,1,90,TRUE,1,80,TRUE,1,74,TRUE,1,73,FALSE,1,70,TRUE,0,85,TRUE,1,61,TRUE,0,87,FALSE,0,57,TRUE,1,97,FALSE,1,58,TRUE,0,61,TRUE,0,76,FALSE,1,100,TRUE,1,77,TRUE,1,80,FALSE,1,83,TRUE,1,84,TRUE,0,79,TRUE,1,82,TRUE,0,53,FALSE,1,91,TRUE,0,83,TRUE,1,83,FALSE,0,65,TRUE,1,66,0.04,0.0324,0.0009,0.01,0.1156,0.0169,0.0256,0.0729,0,0.04,0.0289,0.1521,0.0676,0.09,0.1296,0.0016,0.0289,0.1681,0.0081,0.6241,0.0529,0.3249,0.5776,0.7569,0.1764,0.2809,0.4225,0.0009,0.1225,0.3721,0.6889,0.7225,0.21675,0.066985714,0.366514286,17,53.13,23,71.88,4,50,7,87.5,5,62.5,7,87.5,14,87.5,9,56.25,76.97,68.75,72.38,81.12,85.62,76.81,77.12,-18.75,5.09,18.75,-15.12,18.62,-1.88,-10.69,20.87,0,0,0,0,1,1,0,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,2,1,0,1,1,1,0,0,2,1,0,1,1,0,2,1,0,0.2,0.8,0.6,0.6,0.6,0.6,0.8,0.8,0.55,0.7,2,2,1,0,-1,0,0,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,71,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-2,0,1,-1,0,0,1,0,-2,0,1,0,0,1,-2,-1,1,-0.4,0.2,-0.2,-0.2,-0.15 +144,R_5guQAIjetvIDuH6,67 - 73,American,Male,-1,3,3,1,0,2,1,3,1,1,3,3,3,-3,0,2,1,2,3,1,0,3,3,1,0,2,3,1,3,1,-1,0,3,3,3,-3,0,0,2,2,2,2,2,0,2,3,2,3,-2,0,0,1,3,1,-2,7,3,3,1,-3,0,7,1,0,1,2,1,7,TRUE,0,97,FALSE,0,50,TRUE,0,98,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,97,FALSE,1,100,TRUE,0,92,TRUE,1,96,TRUE,0,50,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,98,TRUE,1,96,TRUE,1,100,TRUE,1,96,0,0,0.01,0,0.0016,0.25,0.25,0.0009,0.25,0.25,0.0016,0.0016,0.25,0,0.25,0.25,0.25,0.25,0,0.25,0.0016,0.25,0.25,0.25,0.25,0.25,0,0.9409,0.9604,1,0.9604,0.8464,0.302335714,0.161121429,0.44355,23,71.88,20,62.5,5,62.5,6,75,4,50,5,62.5,11,68.75,9,56.25,75.19,62.5,73.25,80.5,84.5,79.44,70.94,9.38,12.69,0,-1.75,30.5,22,10.69,14.69,1,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,1,1,3,0,1,2,2,2,0,0,0,3,0,0,2,0,0,1,1,1,1,0,0.2,0.6,0,0.6,1.6,1,0.4,0.8,0.35,0.95,0.67,4.67,2,-7,-7,-7,-4,10 cents,25 minutes,24 days,Male,High School (or equivalent),73,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,-2,0,-1,-2,-2,-1,0,0,0,-1,0,0,-2,0,0,-1,0,-1,0,1,-1.4,-0.4,-0.4,-0.2,-0.6 +145,R_1Yb2YCDG83IHgrM,53 - 59,Canadian,Female,2,1,0,2,2,-3,0,2,-2,1,2,-2,2,2,3,-2,-1,-1,-1,-3,2,2,1,-1,3,5,-3,0,1,-1,-2,4,1,-2,1,3,1,3,-2,-3,-2,-3,-3,5,0,0,0,1,0,4,-3,-2,3,-2,0,2,0,0,0,-1,1,3,-2,-1,0,0,-3,5,FALSE,1,85,TRUE,1,54,TRUE,0,54,TRUE,0,53,TRUE,1,71,TRUE,0,54,TRUE,1,95,TRUE,1,53,FALSE,0,55,FALSE,0,53,TRUE,0,53,TRUE,0,80,TRUE,1,86,TRUE,0,53,TRUE,1,53,TRUE,1,80,TRUE,0,70,TRUE,0,79,FALSE,1,55,TRUE,0,62,TRUE,1,65,TRUE,1,87,TRUE,0,54,TRUE,1,53,TRUE,0,54,TRUE,1,54,TRUE,0,54,TRUE,0,54,TRUE,0,56,TRUE,1,89,TRUE,1,53,FALSE,0,50,0.2209,0.2116,0.04,0.0025,0.25,0.2916,0.2209,0.2809,0.3844,0.0169,0.0121,0.0196,0.3025,0.2809,0.0841,0.2116,0.2916,0.2809,0.2916,0.2916,0.1225,0.2209,0.2025,0.2809,0.49,0.2916,0.2209,0.0225,0.2916,0.6241,0.3136,0.64,0.258296429,0.209142857,0.30745,5,15.63,15,46.88,4,50,3,37.5,4,50,4,50,13,81.25,2,12.5,63.16,53.75,63.25,70,65.62,65.69,60.62,-31.25,16.28,3.75,25.75,20,15.62,-15.56,48.12,0,1,1,3,1,0,0,1,1,3,1,0,1,1,2,0,2,1,2,0,2,1,0,1,2,0,2,1,0,1,2,2,2,3,2,0,0,1,1,0,1.2,1,1,1,1.2,0.8,2.2,0.4,1.05,1.15,4,3,1,2,0,0,1,5 cents,100 minutes,36 days,Female,High School (or equivalent),59,1.375,1,0,0,0,1,0,0.33,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,-2,0,1,2,-1,0,-2,0,1,2,-1,-2,-1,-2,0,0,2,0,1,0,0,0.2,-1.2,0.6,-0.1 +146,R_5OOEIEnQs4N8XqD,60 - 66,Canadian,Female,3,2,2,-1,3,1,1,3,-3,1,0,1,3,-3,3,0,0,0,3,3,3,2,2,-2,1,2,2,0,3,-3,3,0,1,2,3,-3,3,0,3,3,3,3,2,1,3,2,2,0,2,0,0,0,3,-3,0,5,0,2,3,-3,3,0,1,1,3,3,-2,3,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,1,91,TRUE,0,100,TRUE,1,77,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0081,0.0081,0.0361,0,0,0,0.04,0.25,0,0.25,0.0529,0.5776,1,0.8464,0.25,0.25,1,0,1,1,1,0.270328571,0.006592857,0.534064286,27,84.38,23,71.88,5,62.5,6,75,5,62.5,7,87.5,15,93.75,8,50,90.25,75.62,91.62,100,93.75,91.19,89.31,12.5,18.37,13.12,16.62,37.5,6.25,-2.56,39.31,0,0,0,1,2,1,1,0,0,2,1,1,0,0,0,3,3,3,0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,0,0,1,1,3,0,5,0.6,0.8,0.4,2,0.4,0.6,0.2,2,0.95,0.8,0.67,1.67,2,-5,0,-2,-1,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,2,2,0,0,-4,0.2,0.2,0.2,0,0.15 +147,R_6KAyi2mZ8RoW8oh,60 - 66,Canadian,Male,2,3,-1,-1,2,1,-2,1,-2,0,1,0,2,-1,1,1,1,2,1,1,2,3,-1,-1,2,7,1,-2,1,-2,1,8,1,-1,2,-1,1,8,1,1,1,1,1,8,2,3,-1,-1,2,9,1,-2,1,-2,0,8,1,-1,1,-2,2,8,1,1,2,1,1,8,FALSE,1,55,TRUE,1,64,TRUE,0,80,FALSE,1,50,TRUE,1,55,FALSE,1,85,TRUE,1,79,TRUE,1,76,TRUE,1,63,TRUE,1,69,FALSE,1,57,FALSE,1,91,FALSE,0,66,FALSE,1,61,FALSE,0,55,TRUE,1,100,FALSE,1,79,TRUE,0,73,TRUE,0,69,TRUE,0,100,FALSE,0,59,TRUE,1,61,TRUE,0,58,TRUE,1,100,FALSE,1,57,TRUE,1,75,TRUE,0,58,TRUE,0,70,TRUE,0,100,TRUE,1,100,FALSE,0,63,TRUE,1,89,0.0576,0.0625,0,0.0441,0.0121,0.0225,0,0.0961,1,0.1521,0,0.4356,0.1369,0.1849,0.2025,0.1296,0.3364,0.25,0.49,0.1849,0.3481,0.3025,0.4761,0.1521,0.0441,0.3364,0.3969,0.2025,0.64,0.5329,1,0.0081,0.288332143,0.211335714,0.365328571,20,62.5,20,62.5,4,50,4,50,7,87.5,5,62.5,12,75,8,50,72.41,59.88,73.88,66.25,89.62,73.38,71.44,0,9.91,9.88,23.88,-21.25,27.12,-1.62,21.44,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0.2,0.2,0.2,0,0,0.8,0,0.15,0.2,7.67,8.33,-2,0,0,0,-0.66,5 cents,5 minutes,47 days,Male,Trade School (non-military),62,0.625,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,1,0,0,-1,-1,-1,0,0,1,0,0,0,0.2,-0.6,0.2,-0.05 +148,R_19xzfsLiRU0FSEh,53 - 59,Canadian,Female,2,1,2,-3,0,1,-2,3,-2,1,3,-1,3,-1,3,2,2,2,3,3,2,2,1,-3,2,4,1,-2,3,-2,0,1,3,0,2,-1,3,1,2,2,2,2,2,3,2,1,2,-2,0,1,1,-2,3,-2,0,0,3,-1,3,-1,3,0,2,2,2,2,3,1,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,70,FALSE,1,63,TRUE,1,81,TRUE,1,97,TRUE,1,85,TRUE,1,81,FALSE,1,50,TRUE,0,55,TRUE,1,70,FALSE,1,76,FALSE,0,50,TRUE,1,86,FALSE,1,50,TRUE,0,92,FALSE,1,59,FALSE,1,50,FALSE,0,75,TRUE,1,81,FALSE,1,100,FALSE,0,82,TRUE,0,60,TRUE,1,87,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,92,FALSE,0,85,TRUE,1,100,0.0009,0.0169,0.0196,0.0361,0,0.1369,0.6724,0.0361,0.25,0.0361,0.0064,0.09,0.0225,0.25,0.09,0.25,0,0.25,0,0.36,0.5625,0.25,0.1681,0.0576,0.25,0.25,0.7225,0.25,0,0.8464,1,0.3025,0.253928571,0.149314286,0.358542857,17,53.13,23,71.88,5,62.5,6,75,6,75,6,75,11,68.75,12,75,74.28,59.88,78.5,76,82.75,79.5,69.06,-18.75,2.4,-2.62,3.5,1,7.75,10.75,-5.94,0,1,1,0,2,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0.8,0.2,0.4,0.4,0.2,0.2,0,0.2,0.45,0.15,2,0.33,3,1,1,2,1.67,10 cents,5 minutes,36 days,Female,University - Graduate (Masters),57,1,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,1,1,-1,2,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0.6,0,0.4,0.2,0.3 +149,R_3uTX9MGCaRJttCL,67 - 73,American,Male,3,0,-2,1,-1,-1,1,1,-1,1,1,0,2,-2,2,-1,0,1,1,-2,3,0,-1,2,0,2,-1,1,1,-1,2,3,1,0,2,-2,3,2,-2,-1,-1,0,-1,6,3,0,-2,2,-2,2,-2,0,1,-1,-1,2,1,-1,2,-2,3,2,-2,-2,0,2,-1,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,74,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,0,70,FALSE,1,100,TRUE,1,100,TRUE,1,82,FALSE,1,100,TRUE,1,87,FALSE,1,73,TRUE,1,100,FALSE,1,73,FALSE,1,65,TRUE,0,71,TRUE,1,82,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0169,0,0,0.0324,0.0324,1,0,0,0,0,0,0.25,0.1225,0.0729,0,0.5476,0.49,0,0,0.0729,0,0,1,0.7396,0.5041,0,0.174332143,0.095121429,0.253542857,24,75,26,81.25,6,75,6,75,7,87.5,7,87.5,14,87.5,12,75,91.03,83.38,96.38,92.62,91.75,95.31,86.75,-6.25,9.78,8.38,21.38,5.12,4.25,7.81,11.75,0,0,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,2,1,1,0,0,0,1,1,1,1,0,0,2,0,1,0,0,1,1,2,1,1,1,0.6,0.2,0.2,1.2,0.4,0.8,0.4,1.2,0.55,0.7,2.33,2,0,1,0,2,0.33,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),73,1.25,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,1,0,0,-1,-1,0,0,-1,0,-1,0,0,0,0,-1,1,0,0,0.2,-0.6,-0.2,0,-0.15 +150,R_11dUwtt1T1ylv5a,67 - 73,American,Male,1,2,2,1,2,0,-2,2,-2,-1,2,2,2,-3,2,1,1,1,2,-1,1,2,2,-1,2,1,-2,-2,1,-2,-1,3,2,2,2,-3,2,0,1,1,1,2,-1,3,0,2,1,2,2,2,-2,-1,1,0,-2,4,2,2,2,-3,2,1,2,1,2,2,1,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,90,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,96,TRUE,1,100,FALSE,1,91,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,80,FALSE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,0,0,0,0.0025,0,0.01,0,0,0,0.01,0,0,0,0,0,0,0,0.25,1,0.0081,0,0.25,0.64,0.0081,0.25,0.5625,0.0196,0,0,0.0625,1,0.9216,0.1783,0.019285714,0.337314286,25,78.13,26,81.25,6,75,6,75,8,100,6,75,16,100,10,62.5,91.22,80.12,92.5,92.75,99.5,95.06,87.38,-3.12,9.97,5.12,17.5,-7.25,24.5,-4.94,24.88,0,0,0,2,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,2,1,1,2,1,0,0,0,0,0,1,0,1,0,2,0.4,0.6,0,0,0.6,1.4,0,0.8,0.25,0.7,1.33,2.33,-1,-1,-1,0,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,0.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,0,-1,1,0,0,-1,0,-2,-1,0,0,0,0,0,-1,0,-1,0,-2,-0.2,-0.8,0,-0.8,-0.45 +151,R_3pRrDsIC7Uswrr8,67 - 73,Canadian,Female,3,2,2,0,3,2,-2,3,-3,1,0,1,3,0,2,-1,-1,1,1,-2,2,2,2,-1,2,5,2,-2,3,-3,1,2,0,1,2,2,2,4,0,1,1,-1,-1,7,2,2,2,2,1,3,2,-2,2,-2,0,2,0,2,3,0,2,5,-1,-3,-1,-1,-2,8,FALSE,1,86,TRUE,1,95,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,50,TRUE,1,86,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,59,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,77,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0081,0,0,0,0.0196,0,0,0,0.25,0.25,0.25,0.16,0.0025,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.3481,0.5929,0,0.0196,0,0.25,1,1,0.201525,0.102292857,0.300757143,22,68.75,26,81.25,7,87.5,5,62.5,7,87.5,7,87.5,15,93.75,11,68.75,79.81,65.25,71.12,82.88,100,83.25,76.38,-12.5,-1.44,-22.25,8.62,-4.62,12.5,-10.5,7.63,1,0,0,1,1,0,0,0,0,0,0,0,1,2,0,1,2,0,2,1,1,0,0,2,2,0,0,1,1,1,0,1,0,0,0,0,2,2,2,0,0.6,0,0.6,1.2,1,0.6,0.2,1.2,0.6,0.75,3.67,3.33,2,0,-1,-1,0.34,10 cents,5 minutes,24 days,Female,Trade School (non-military),72,-0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-1,-1,0,0,-1,-1,-1,0,-1,1,2,0,1,0,-2,0,1,-0.4,-0.6,0.4,0,-0.15 +152,R_5OlIcdJP5TxlpQW,67 - 73,American,Male,2,2,2,2,1,0,-3,3,-3,0,3,3,2,-2,3,2,2,2,2,1,2,2,2,0,1,0,0,-3,3,-3,2,5,3,3,2,0,3,5,2,2,2,2,2,0,2,2,2,2,1,0,0,-3,3,-3,0,0,3,3,2,0,3,0,2,2,2,2,2,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0.25,0.25,0.25,0,0,0.25,0.25,0.25,0,0.25,0.25,0,1,1,1,0,0.1875,0.053571429,0.321428571,16,50,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,85.94,68.75,87.5,93.75,93.75,90.62,81.25,-31.25,4.69,-6.25,0,18.75,6.25,-9.38,18.75,0,0,0,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0.4,0.4,0.4,0.2,0,0,0.4,0.2,0.35,0.15,3.33,0,0,5,5,0,3.33,10 cents,5 minutes,24 days,Male,Trade School (non-military),71,0.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0.4,0.4,0,0,0.2 +153,R_3gGBNDpfcFEgBvr,60 - 66,American,Female,2,1,3,3,3,1,-2,3,-3,2,3,3,3,2,3,0,2,2,2,-2,3,1,3,3,3,2,2,-3,2,0,2,6,3,3,3,3,3,6,-2,-2,1,0,-3,6,2,0,3,3,1,7,0,-3,2,-1,1,5,3,3,3,0,3,7,2,-2,3,2,-1,5,TRUE,0,76,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,64,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,99,TRUE,0,100,TRUE,1,68,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,76,FALSE,0,100,TRUE,1,100,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,56,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0,0,0,0,0,0,0,0.0576,0,0,0.1024,0.25,0.0001,0.1296,0.25,0.1681,0.25,0,0,1,0.25,0,1,0,0.1936,0.3364,0.5776,0,0,1,1,0.234478571,0.086271429,0.382685714,17,53.13,23,71.88,4,50,6,75,6,75,7,87.5,11,68.75,12,75,86.12,64.12,86.38,97,97,83.75,88.5,-18.75,14.24,14.12,11.38,22,9.5,15,13.5,1,0,0,0,0,1,1,1,3,0,0,0,0,1,0,2,4,1,2,1,0,1,0,0,2,1,1,1,2,1,0,0,0,2,0,2,4,1,0,1,0.2,1.2,0.2,2,0.6,1.2,0.4,1.6,0.9,0.95,4.67,6.33,-5,1,-1,1,-1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,1,-1,0,0,-2,0,0,0,1,-1,0,0,0,-1,0,0,0,0,2,0,-0.4,0,-0.2,0.4,-0.05 +154,R_7QVFkMHaSFHI6jL,67 - 73,Canadian,Male,-1,2,3,2,0,0,-1,2,-2,0,1,2,2,-1,1,1,1,1,1,1,1,2,1,0,2,1,0,-2,2,-2,1,1,1,2,2,0,1,1,1,1,1,1,1,1,-1,2,3,2,-2,3,-3,-1,1,0,-1,2,1,1,1,-3,1,3,0,-1,0,1,1,8,TRUE,0,83,TRUE,1,80,TRUE,0,99,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,76,TRUE,1,91,TRUE,1,50,TRUE,1,80,TRUE,0,75,TRUE,0,98,TRUE,1,98,TRUE,0,91,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,1,55,TRUE,0,50,TRUE,1,85,FALSE,1,80,TRUE,1,88,FALSE,1,50,FALSE,1,72,TRUE,0,75,TRUE,1,95,TRUE,1,95,TRUE,1,100,0.0081,0.0144,0,0.0576,0,0.25,0.0225,0.04,1,0.2025,0.0025,0.0004,0.25,0.5625,0.25,0.04,0.25,0.25,0.0784,0.04,0,0.25,0.25,0.8281,0.25,0.25,0.0025,0.6889,0.9801,0,0.5625,0.9604,0.295046429,0.222885714,0.367207143,25,78.13,20,62.5,4,50,5,62.5,6,75,5,62.5,15,93.75,5,31.25,77.06,62.5,71.62,81.62,92.5,80.81,73.31,15.63,14.56,12.5,9.12,6.62,30,-12.94,42.06,2,0,2,2,2,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,3,0,1,2,1,0,1,1,2,0,1,2,1,0,0,1.6,0.4,0.2,0,0.4,1.4,0.8,0.8,0.55,0.85,1,2.67,-2,-1,-2,-7,-1.67,10 cents,5 minutes,47 days,Male,Trade School (non-military),70,0.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,2,0,2,2,0,-3,1,-1,-2,0,0,-1,-1,-1,0,-1,-2,-1,0,0,1.2,-1,-0.6,-0.8,-0.3 +155,R_3907jAvTB0WHfsM,60 - 66,Canadian,Male,0,2,1,0,-3,0,-2,1,0,-1,2,1,1,0,1,-1,0,1,0,3,0,2,0,0,-3,8,0,1,0,1,1,8,1,1,1,1,1,8,0,0,0,1,3,5,0,1,1,1,-3,6,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,6,FALSE,1,50,FALSE,0,50,TRUE,0,60,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,64,TRUE,1,76,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,76,TRUE,1,65,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,76,FALSE,1,50,FALSE,1,75,FALSE,1,50,TRUE,1,85,FALSE,0,50,TRUE,1,70,0.0576,0.0576,0.25,0.1296,0.09,0.25,0.25,0.0625,0.25,0.25,0.0225,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.36,0.5625,0.25,0.5776,0.245003571,0.199821429,0.290185714,16,50,22,68.75,4,50,7,87.5,6,75,5,62.5,9,56.25,13,81.25,57.72,50,54.38,61.25,65.25,60.06,55.38,-18.75,-11.03,0,-33.12,-13.75,2.75,3.81,-25.87,0,0,1,0,0,0,3,1,1,2,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,2,1,0,1,2,1,1,0,1,1,0,1,0,3,0.2,1.4,0.4,0.6,0.4,0.8,1,1,0.65,0.8,8,5.67,2,3,2,-1,2.33,10 cents,25 minutes,47 days,Male,Trade School (non-military),60,0,0,0,1,1,0,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,-1,1,-1,0,0,1,0,1,1,-1,-1,-1,1,-1,0,0,0,1,-3,-0.2,0.6,-0.6,-0.4,-0.15 +156,R_5KpX417DipbCyIn,39 - 45,Canadian,Female,3,3,2,2,-2,-3,2,1,1,2,2,-3,3,-3,3,-2,-2,-2,1,-3,3,3,2,2,0,0,-2,2,2,0,3,0,2,-3,3,-3,3,0,-1,-2,-1,1,-3,4,3,3,2,3,-3,0,-3,2,1,2,2,0,2,-3,3,-3,3,0,-2,-3,-2,1,-3,2,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,0,70,TRUE,1,50,FALSE,1,55,FALSE,1,100,TRUE,1,65,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,98,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,0,70,TRUE,1,100,0,0.0064,0,0.25,0,0,0,0.25,0.25,0.0001,0.25,0.1225,0.49,0.2025,0.25,1,0,0.25,0.25,0,1,0.25,0.25,0,0.25,0.25,0.49,0,0,0.9604,1,0,0.277339286,0.218935714,0.335742857,24,75,25,78.13,4,50,6,75,7,87.5,8,100,11,68.75,14,87.5,78.09,61.88,83.12,86.12,81.25,77.88,78.31,-3.13,-0.04,11.88,8.12,-1.38,-18.75,9.13,-9.19,0,0,0,0,2,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0.4,0.8,0,0.4,0.4,0.2,0,0.2,0.4,0.2,0,0,0,0,0,2,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,42,1.75,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,1,1,0,1,0,1,0,0,0,0,0,1,-1,1,0,0,0,0.6,0,0.2,0.2 +157,R_6tyUS9LOzy8825t,67 - 73,American,Female,2,2,2,0,2,2,0,2,-1,2,2,1,2,1,2,1,0,1,1,0,2,2,2,0,2,2,2,-1,2,0,1,2,2,2,2,1,2,1,0,1,0,1,-1,2,2,2,2,0,2,2,2,0,1,0,2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,2,TRUE,0,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,85,FALSE,1,88,TRUE,1,88,TRUE,1,100,TRUE,1,92,TRUE,1,88,FALSE,1,55,FALSE,1,71,FALSE,0,66,TRUE,0,68,TRUE,1,63,TRUE,1,97,FALSE,1,97,TRUE,0,66,TRUE,0,72,FALSE,1,100,FALSE,0,65,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,70,TRUE,1,68,TRUE,0,70,FALSE,1,100,TRUE,0,94,TRUE,1,82,TRUE,1,83,TRUE,1,100,0,0.1024,0.0009,0.0144,0,0.0144,0.0225,0.0144,0,0.01,0.0324,0.4356,0.0064,0.2025,0.0225,0,0,0.25,0,0.09,0.4225,0.1369,0.5184,0.4624,0.0009,0.49,0.0289,0.9025,0,0.4356,0.8836,0.0841,0.195232143,0.072192857,0.318271429,24,75,24,75,6,75,5,62.5,5,62.5,8,100,14,87.5,10,62.5,82.75,73.12,86.88,79.12,91.88,84.5,81,0,7.75,-1.88,24.38,16.62,-8.12,-3,18.5,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,2,1,2,2,1,0,0.6,0.2,0.8,0,0.4,0.4,1.6,0.4,0.6,1.67,2,0,0,-1,0,-0.33,10 cents,100 minutes,24 days,Female,University - PhD,73,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,1,-1,0,1,0,0,0,-1,0,-1,0,-1,-2,0,0,0.2,-0.2,-0.8,-0.2 +158,R_5kGqpY0ZTnPPebw,25 - 31,Canadian,Female,3,3,1,3,3,3,-3,3,-3,3,2,3,3,0,3,3,3,3,3,3,3,3,1,3,3,9,0,-3,3,-3,3,10,2,1,1,0,3,10,1,3,0,3,3,5,3,3,1,3,3,10,0,-3,3,-3,3,3,2,2,2,0,3,5,3,3,3,3,1,10,FALSE,1,74,FALSE,0,82,TRUE,0,100,FALSE,1,88,TRUE,1,87,TRUE,0,71,FALSE,0,73,TRUE,1,86,TRUE,1,86,TRUE,1,65,FALSE,1,85,TRUE,0,100,TRUE,1,61,FALSE,1,91,TRUE,1,81,TRUE,1,70,TRUE,0,67,FALSE,1,99,FALSE,1,61,FALSE,1,54,FALSE,0,74,FALSE,0,100,FALSE,1,90,FALSE,0,89,FALSE,1,100,TRUE,1,81,FALSE,1,73,TRUE,0,100,FALSE,1,72,TRUE,1,62,TRUE,1,77,TRUE,1,94,0.0196,0.0361,0.09,0.5329,0.0036,0.5041,0.7921,0.1225,0.2116,1,0.1444,0.1521,0.0196,0.0225,0.0169,0.6724,0.01,0.0144,1,0,0.5476,0.0361,0.1521,0.0081,0.4489,0.0729,0.0529,0.0676,1,0.0001,0.0784,1,0.291103571,0.2633,0.318907143,17,53.13,22,68.75,7,87.5,5,62.5,6,75,4,50,11,68.75,11,68.75,81.03,79.12,77,85.38,82.62,79.25,82.81,-15.62,12.28,-8.38,14.5,10.38,32.62,10.5,14.06,0,0,0,0,0,3,0,0,0,0,0,2,2,0,0,2,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0.6,0.8,1,0,0.6,0.4,0.4,0.6,0.35,9.67,6,-1,7,5,-5,3.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,0.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,2,0,3,0,-2,0,0,0.4,0.6,0.25 +159,R_3qdPz2lU3zQiB3P,25 - 31,American,Male,3,1,3,2,1,3,1,2,2,2,2,1,1,2,2,3,3,3,2,1,1,3,2,0,2,8,1,1,0,2,1,8,1,1,0,1,2,8,2,2,2,1,1,9,1,-1,1,0,3,8,0,0,1,-1,1,7,1,0,0,2,1,8,-1,1,2,-1,1,5,TRUE,0,99,FALSE,0,97,TRUE,0,86,TRUE,0,78,FALSE,0,93,TRUE,0,94,FALSE,0,83,TRUE,1,71,TRUE,1,84,FALSE,0,90,FALSE,1,96,TRUE,0,86,TRUE,1,88,TRUE,0,82,TRUE,1,89,FALSE,0,91,TRUE,0,91,TRUE,0,94,FALSE,1,84,TRUE,0,95,FALSE,0,82,TRUE,1,85,TRUE,0,98,TRUE,1,80,FALSE,1,84,TRUE,1,85,TRUE,0,86,TRUE,0,97,TRUE,0,85,TRUE,1,77,TRUE,1,82,TRUE,1,63,0.0841,0.0225,0.8281,0.6889,0.1369,0.8836,0.04,0.81,0.9025,0.0225,0.0529,0.0144,0.0256,0.0016,0.8649,0.9409,0.9604,0.6084,0.9409,0.0256,0.6724,0.0121,0.0256,0.6724,0.8281,0.7396,0.0324,0.9801,0.7396,0.8836,0.7225,0.7396,0.509967857,0.447471429,0.572464286,23,71.88,13,40.63,5,62.5,2,25,3,37.5,3,37.5,10,62.5,3,18.75,86.72,87,86.75,87.75,85.38,83.75,89.69,31.25,46.09,24.5,61.75,50.25,47.88,21.25,70.94,2,2,1,2,1,2,0,2,0,1,1,0,1,1,0,1,1,1,1,0,2,2,2,2,2,3,1,1,3,1,1,1,1,0,1,4,2,1,3,0,1.6,1,0.6,0.8,2,1.8,0.8,2,1,1.65,8,7.67,0,1,0,4,0.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,27,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,-1,0,-1,-1,-1,1,-3,0,0,-1,0,1,-1,-3,-1,0,-2,0,-0.4,-0.8,-0.2,-1.2,-0.65 +160,R_7prnYqlq02LBnad,53 - 59,American,Female,3,2,3,-1,2,1,-3,3,-2,2,2,3,2,2,2,3,2,2,3,2,2,2,3,2,0,3,3,-3,3,-1,0,5,2,1,2,2,2,8,2,2,2,2,3,2,2,2,3,0,0,4,1,-3,0,1,0,5,2,0,2,1,2,3,0,2,2,2,2,5,FALSE,1,59,TRUE,1,100,TRUE,0,100,FALSE,1,87,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,79,TRUE,1,98,FALSE,1,95,TRUE,0,100,TRUE,1,94,TRUE,0,100,TRUE,1,96,TRUE,1,92,TRUE,0,93,TRUE,0,85,FALSE,1,67,TRUE,0,89,TRUE,1,76,TRUE,1,75,TRUE,0,74,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,80,TRUE,0,79,TRUE,0,78,TRUE,1,93,FALSE,0,75,TRUE,1,100,0,0,0.0064,0,0,0,0,0.0004,0.7921,0.0625,0.0049,0.0036,0.6241,0.0025,0.0225,0,0.5476,0.0169,0.6241,1,0.0576,0.0016,0.1089,1,0.8649,0.64,0.5625,0.1681,1,0.7225,0.6084,1,0.372703571,0.148364286,0.597042857,23,71.88,19,59.38,5,62.5,5,62.5,5,62.5,4,50,14,87.5,5,31.25,89.03,84.88,87.5,89.62,94.12,91.44,86.62,12.5,29.65,22.38,25,27.12,44.12,3.94,55.37,1,0,0,3,2,2,0,0,1,2,0,2,0,0,0,1,0,0,1,1,1,0,0,1,2,0,0,3,3,2,0,3,0,1,0,3,0,0,1,0,1.2,1,0.4,0.6,0.8,1.6,0.8,0.8,0.8,1,5.33,4,-1,0,5,-3,1.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),59,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,2,0,2,0,-3,-2,0,0,-1,0,-1,0,-2,0,0,0,1,0.4,-0.6,-0.4,-0.2,-0.2 +161,R_6Vt3d1FpDEYtCxH,67 - 73,American,Male,1,1,2,0,1,-1,0,2,-2,1,2,3,3,1,2,2,1,3,3,1,0,2,2,-2,1,3,-2,-2,2,-2,1,2,2,2,2,2,2,2,2,1,2,2,2,3,1,0,2,1,0,3,-2,0,1,-2,-1,3,2,2,2,-2,2,2,1,0,2,2,2,3,TRUE,0,100,TRUE,1,95,TRUE,0,100,FALSE,1,88,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,97,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,100,TRUE,1,61,TRUE,1,100,TRUE,0,91,FALSE,1,82,FALSE,1,88,FALSE,1,100,TRUE,1,99,TRUE,1,98,TRUE,0,62,TRUE,1,98,TRUE,0,72,TRUE,1,97,FALSE,1,50,FALSE,1,98,TRUE,0,97,TRUE,1,100,TRUE,1,93,TRUE,1,100,0,0.0009,0,0,0,0,0.0004,0.0009,0,0.0004,0,0,0.25,0,0.0004,0.0025,0.3844,0.0144,0.0004,0.5184,0.0001,0.1521,0.0144,1,0.8281,0.25,0.0049,1,1,0.0324,0.9409,0.9409,0.262,0.046671429,0.477328571,28,87.5,24,75,8,100,5,62.5,5,62.5,6,75,16,100,8,50,90.97,78.12,93.38,93.25,99.12,92.88,89.06,12.5,15.97,-21.88,30.88,30.75,24.12,-7.12,39.06,1,1,0,2,0,1,2,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0,2,0,1,1,3,0,1,1,1,1,1,0.8,0.6,0.6,0.6,0.6,0.8,1,1,0.65,0.85,2.33,2.67,0,-1,0,0,-0.34,10 cents,5 minutes,15 days,Male,University - Undergraduate,73,1.25,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,1,0,0,1,-1,0,2,-1,0,-2,0,0,0,-2,0,-1,-1,0,0,0,0.2,-0.2,-0.4,-0.4,-0.2 +162,R_1u9AK8gy2PrSuRz,60 - 66,Canadian,Female,2,2,2,0,2,-1,0,1,-1,1,2,2,1,0,2,-1,-1,0,0,-1,2,2,2,0,2,4,-1,-1,1,-1,1,4,2,2,2,0,2,4,-1,-1,0,-1,-1,5,2,2,2,0,1,4,-1,-1,1,-1,1,4,2,2,1,-1,2,4,-1,-1,0,-1,-1,5,FALSE,1,95,TRUE,1,99,TRUE,0,94,FALSE,1,50,TRUE,1,86,FALSE,1,95,TRUE,1,95,TRUE,1,97,TRUE,1,81,TRUE,1,98,TRUE,0,94,TRUE,0,86,TRUE,1,100,FALSE,1,94,TRUE,1,50,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,1,72,FALSE,1,100,FALSE,0,76,TRUE,1,97,FALSE,1,92,TRUE,1,96,FALSE,1,100,TRUE,1,93,TRUE,0,86,FALSE,1,96,TRUE,0,100,TRUE,1,100,TRUE,1,91,TRUE,1,80,0.0009,0.0049,0,0.0025,0.04,0.0025,0.0016,0.0004,0,0.0009,0,0,0.0361,0.8836,0.0196,0.0001,0.0064,0.25,0.0016,0,0.5776,0.25,0.0784,0.0036,0.0016,0.7396,0.0081,0.0025,0.8836,1,1,0.7396,0.233121429,0.088657143,0.377585714,17,53.13,25,78.13,6,75,6,75,7,87.5,6,75,15,93.75,10,62.5,90.28,77.88,90.62,96.5,96.12,89.94,90.62,-25,12.15,2.88,15.62,9,21.12,-3.81,28.12,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.15,0.2,4,4,0,0,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,64,0.875,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,-1,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,-0.2,0,0,0,-0.05 +163,R_7RvF7lBwedH2yB4,60 - 66,American,Male,1,2,2,-1,-2,0,-2,3,-2,0,1,2,3,1,1,2,2,2,3,1,0,2,2,-2,-2,0,0,-2,3,-2,0,0,1,2,3,1,1,0,2,2,2,2,1,0,0,2,2,-1,-2,0,0,-2,3,-2,0,0,1,2,3,1,1,0,2,2,3,3,1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,100,FALSE,0,99,TRUE,0,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,0,86,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.9801,0,0.36,0.25,0,0.5776,0.25,0,0,0,0.04,0.0625,1,0,0.5625,0,1,1,0.7396,0.6561,1,0.3028,0.172692857,0.432907143,24,75,22,68.75,6,75,5,62.5,5,62.5,6,75,15,93.75,7,43.75,91.62,80,88.25,98.25,100,95.56,87.69,6.25,22.87,5,25.75,35.75,25,1.81,43.94,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0,0.2,0.2,0,0,0.2,0.15,0.1,0,0,0,0,0,0,0,10 cents,25 minutes,36 days,Male,College Diploma/Certificate,61,-0.75,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0.2,0,0,0,0.05 +164,R_7EGL2cPMFfL1fUE,67 - 73,Canadian,Male,3,2,2,-1,2,2,-3,3,-3,3,2,1,2,1,3,2,2,2,2,3,3,1,2,-3,2,3,2,-3,2,-2,1,3,3,2,2,0,2,2,1,1,1,0,1,4,3,3,2,1,3,2,2,-3,2,-2,1,2,3,3,2,3,3,2,2,2,2,2,3,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,67,FALSE,0,74,FALSE,1,86,TRUE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,74,TRUE,1,100,FALSE,1,78,TRUE,0,100,TRUE,0,82,FALSE,1,100,TRUE,1,96,TRUE,1,88,FALSE,1,74,TRUE,1,100,TRUE,0,79,TRUE,1,100,TRUE,0,100,FALSE,1,99,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0016,0,0,0,0,0.0196,0,0,0,0.0144,0,0,0,0.0004,0.5476,0,0.0676,0.1089,0.0001,0.6241,0.0016,0.0676,0.6724,1,0.0484,1,0,1,1,1,0.0049,1,0.292057143,0.054178571,0.529935714,27,84.38,23,71.88,6,75,7,87.5,4,50,6,75,15,93.75,8,50,93.25,90.12,87.62,95.88,99.38,95.5,91,12.5,21.37,15.12,0.12,45.88,24.38,1.75,41,0,1,0,2,0,0,0,1,1,2,1,1,0,1,1,1,1,1,2,2,0,1,0,2,1,0,0,1,1,2,1,2,0,2,0,0,0,0,0,0,0.6,0.8,0.8,1.4,0.8,0.8,1,0,0.9,0.65,2.67,2,1,1,0,1,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,1.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,-1,0,0,0,0,0,0,-1,0,-1,1,1,1,1,2,2,-0.2,0,-0.2,1.4,0.25 +165,R_3aQuHaDKpIOZR30,67 - 73,American,Female,3,2,3,-2,2,1,-2,2,-2,-1,1,2,1,-1,3,1,2,2,2,-1,3,2,3,-2,2,1,1,-2,2,-1,-1,1,1,1,1,-1,3,1,1,1,2,1,-1,1,3,1,3,1,-1,2,0,-3,0,-2,-2,1,1,2,1,-2,3,0,1,-1,0,2,-1,1,TRUE,0,53,TRUE,1,71,TRUE,0,72,FALSE,1,52,TRUE,1,50,FALSE,1,100,TRUE,1,82,TRUE,1,86,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,73,TRUE,0,100,TRUE,1,50,TRUE,1,60,FALSE,1,50,FALSE,1,60,TRUE,0,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,63,TRUE,1,58,FALSE,1,50,FALSE,1,50,FALSE,1,60,TRUE,1,87,FALSE,0,50,TRUE,1,100,0.0196,0.1764,0.16,0.0324,0,0,0.25,0,0,0.25,0.0169,0.0729,0.25,0.25,0.25,0.0841,0.25,0.2304,0.25,0.3969,0.25,0.25,0.25,1,0.25,0.25,0.25,0.2809,0.5184,0.16,0.16,1,0.256089286,0.136021429,0.376157143,21,65.63,22,68.75,4,50,8,100,4,50,6,75,13,81.25,9,56.25,66.47,52.88,66.62,70.75,75.62,66.69,66.25,-3.12,-2.28,2.88,-33.38,20.75,0.62,-14.56,10,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,1,0,3,3,1,1,2,0,1,0,0,0,1,0,0,3,2,0,0,0,0.2,0.2,0.4,1.4,1,0.2,1,0.2,0.9,1,1,-1,0,1,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),73,0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,-3,-3,-1,-1,-2,1,-1,0,1,0,-1,0,0,-2,-2,1,0,-1.4,-0.8,0,-0.6,-0.7 +166,R_3b918O6l0IYvDd7,67 - 73,American,Female,3,3,1,3,3,-1,-3,3,-2,2,2,1,3,-2,3,2,2,2,3,1,3,3,1,-1,3,0,-2,-3,3,1,3,7,2,2,1,1,2,0,1,2,2,2,2,6,3,3,3,3,2,0,1,-3,2,-2,2,0,2,2,3,-2,2,0,0,0,2,3,0,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,51,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.2304,0,0,0,0.16,0,0,0,1,0.1849,0,0.2601,0,0,0.25,1,0.25,1,0,1,1,0,1,0.7396,0.288392857,0.112521429,0.464264286,25,78.13,23,71.88,6,75,6,75,5,62.5,6,75,16,100,7,43.75,90.81,83.38,93.75,93.88,92.25,97.5,84.12,6.25,18.93,8.38,18.75,31.38,17.25,-2.5,40.37,0,0,0,4,0,1,0,0,3,1,0,1,2,3,1,1,0,0,1,1,0,0,2,0,1,2,0,1,0,0,0,1,0,0,1,2,2,0,0,1,0.8,1,1.4,0.6,0.6,0.6,0.4,1,0.95,0.65,2.33,0,0,7,0,6,2.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,67,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,-2,4,-1,-1,0,-1,3,1,0,0,2,3,0,-1,-2,0,1,0,0.2,0.4,1,-0.4,0.3 +167,R_6aM6vvxGj0PaJKp,67 - 73,Canadian,Female,-2,2,3,0,3,0,1,3,-2,1,2,1,2,0,2,-2,1,-1,2,-3,-3,1,3,-3,3,1,1,0,3,-2,0,7,2,2,2,-1,2,2,-1,1,-1,0,-2,5,-1,1,3,1,3,2,-2,-2,2,-1,-1,1,2,2,2,-2,2,1,-1,0,-1,0,0,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,0,100,FALSE,1,75,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,92,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,1,0,0,0,0,0,0.25,0,0.25,0,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0,0,0.25,0.25,0,0,0,0.8464,1,0.193175,0.142857143,0.243492857,16,50,25,78.13,6,75,6,75,8,100,5,62.5,14,87.5,11,68.75,81.78,62.5,80.25,90.62,93.75,81.25,82.31,-28.13,3.65,-12.5,5.25,-9.38,31.25,-6.25,13.56,1,1,0,3,0,1,1,0,0,1,0,1,0,1,0,1,0,0,2,1,1,1,0,1,0,2,3,1,1,2,0,1,0,2,0,1,1,0,2,3,1,0.6,0.4,0.8,0.6,1.8,0.6,1.4,0.7,1.1,3.33,1.33,-1,6,1,-2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,2,0,-1,-2,-1,-1,-1,0,0,0,-1,0,0,-1,0,0,-2,0.4,-1.2,-0.2,-0.6,-0.4 +168,R_3wNRnLW5pNxtlMB,32 - 38,Canadian,Female,2,3,-3,1,1,-1,1,2,0,1,0,1,3,0,2,0,0,1,2,3,3,3,-3,1,2,8,0,2,2,2,1,7,1,1,3,0,2,6,-2,-2,-3,-2,0,9,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,73,TRUE,1,87,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,75,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,74,0.25,0.0625,0.0169,0.25,0.0676,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.0729,0.25,0.25,0.25,0.25,0.25,0,1,0.25,0.25,1,0.272875,0.236971429,0.308778571,9,28.13,20,62.5,5,62.5,6,75,5,62.5,4,50,8,50,12,75,59.66,52.88,53,65.62,67.12,56.81,62.5,-34.37,-2.84,-9.62,-22,3.12,17.12,6.81,-12.5,1,0,0,0,1,1,1,0,2,0,1,0,0,0,0,2,2,4,4,3,2,3,3,1,1,1,1,2,0,1,0,1,3,0,2,0,0,1,2,3,0.4,0.8,0.2,3,2,1,1.2,1.2,1.1,1.35,7,5,3,2,1,4,2,5 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,0.625,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,-3,-3,-1,0,0,0,-2,2,-1,1,-1,-3,0,-2,2,2,3,2,0,-1.6,-0.2,-1,1.8,-0.25 +169,R_3QnfACwTXTNSXlL,67 - 73,Canadian,Male,-1,2,1,-1,1,0,-1,2,-1,1,1,1,1,0,1,1,1,1,1,1,-1,2,1,-2,2,5,1,0,2,-2,1,2,1,1,1,-1,1,1,1,1,1,1,0,6,-2,2,1,0,2,0,0,-1,2,-1,-1,0,2,2,1,2,1,0,2,2,2,2,2,3,FALSE,1,97,TRUE,1,100,FALSE,1,84,FALSE,1,60,FALSE,0,56,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,92,TRUE,1,99,FALSE,1,99,TRUE,0,99,TRUE,1,95,FALSE,1,100,FALSE,0,73,TRUE,1,100,FALSE,1,94,TRUE,0,99,TRUE,0,58,FALSE,1,100,TRUE,1,100,FALSE,0,89,FALSE,1,50,FALSE,0,92,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,76,TRUE,1,92,TRUE,1,50,TRUE,1,100,0,0,0,0.0004,0,0,0.8464,0.0001,0,0.7921,0.0064,0.0025,0.0064,0.0001,0.3136,0,0.25,0.16,0,0,0,0.5329,0.3364,0,0.0036,0.25,0.25,0.0009,0.0256,0.9801,0.5776,0.9801,0.225528571,0.169828571,0.281228571,27,84.38,23,71.88,5,62.5,6,75,6,75,6,75,12,75,11,68.75,87.56,72.75,83.88,97.75,95.88,89.75,85.38,12.5,15.68,10.25,8.88,22.75,20.88,14.75,16.63,0,0,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,2,1,1,0,2,0,1,1,1,1,1,0.4,0.6,0.2,0.2,0.6,0.4,0.8,1,0.35,0.7,2.67,0,5,2,1,3,2.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,69,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,0,1,1,0,1,-2,-1,-1,0,-1,0,-1,-1,-1,-1,0,-0.2,0.2,-0.6,-0.8,-0.35 +170,R_32ilka2D1HBpF0Y,60 - 66,Canadian,Female,2,3,3,-1,3,0,1,1,1,1,2,2,2,0,3,1,2,1,2,2,3,3,3,-1,3,7,1,0,2,-1,1,8,1,1,1,1,1,7,1,1,1,2,1,8,3,3,3,1,2,8,1,1,1,1,1,8,1,1,1,1,1,8,1,0,2,0,-1,7,FALSE,1,76,TRUE,1,62,FALSE,1,100,FALSE,1,57,FALSE,0,55,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,50,TRUE,0,83,FALSE,0,50,FALSE,1,52,FALSE,0,54,TRUE,1,100,TRUE,0,54,FALSE,1,100,TRUE,0,54,FALSE,1,91,FALSE,0,56,TRUE,1,100,FALSE,1,61,TRUE,1,100,FALSE,1,75,TRUE,1,100,TRUE,0,60,FALSE,1,95,TRUE,0,56,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.04,0,0,0.0081,0,0,0.25,0.16,0.25,0.3025,0.1444,0.1521,0.1849,0.0025,0.0625,0.3136,0.2916,0.2916,0.2304,0.2916,0.36,0,0.0576,0,0,0.3136,0.6889,0.156996429,0.106571429,0.207421429,24,75,22,68.75,4,50,3,37.5,8,100,7,87.5,12,75,10,62.5,77.53,62.12,64,87.88,96.12,83.56,71.5,6.25,8.78,12.12,26.5,-12.12,8.62,8.56,9,1,0,0,0,0,1,1,1,2,0,1,1,1,1,2,0,1,0,0,1,1,0,0,2,1,1,0,0,0,0,1,1,1,1,2,0,2,1,2,3,0.2,1,1.2,0.4,0.8,0.2,1.2,1.6,0.7,0.95,7.33,8,-1,0,-1,1,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,-2,-1,0,1,1,2,0,0,0,0,0,0,0,-1,-1,-2,-2,-0.6,0.8,0,-1.2,-0.25 +171,R_3q3q3Q0nJoJN9XV,60 - 66,American,Male,0,2,2,2,1,2,-2,2,-2,3,3,2,3,-1,3,3,3,3,3,3,1,3,2,1,2,2,3,-1,3,-2,3,1,3,3,2,-1,3,1,3,2,2,2,3,1,1,3,2,3,0,1,2,-2,2,-2,3,1,3,3,3,-2,3,1,3,3,3,3,3,0,FALSE,1,54,TRUE,1,87,FALSE,1,55,FALSE,1,52,TRUE,1,54,FALSE,1,63,TRUE,1,83,TRUE,1,70,TRUE,1,76,FALSE,0,96,FALSE,1,67,TRUE,0,91,TRUE,1,91,TRUE,0,55,TRUE,1,78,FALSE,0,62,TRUE,0,91,TRUE,0,94,FALSE,1,59,TRUE,0,63,TRUE,1,89,FALSE,0,63,TRUE,0,64,TRUE,1,67,TRUE,0,92,TRUE,1,93,TRUE,0,64,TRUE,0,93,FALSE,1,59,TRUE,1,98,FALSE,0,73,TRUE,1,97,0.09,0.0049,0.3844,0.0289,0.0009,0.1369,0.1089,0.9216,0.3969,0.3969,0.0004,0.0081,0.0576,0.1089,0.2116,0.0169,0.4096,0.2304,0.8649,0.8464,0.0121,0.0484,0.1681,0.3025,0.8281,0.4096,0.5329,0.2116,0.2025,0.8836,0.1681,0.8281,0.332589286,0.214685714,0.450492857,11,34.38,19,59.38,6,75,6,75,3,37.5,4,50,12,75,7,43.75,74.78,69.5,76,78.75,74.88,79.81,69.75,-25,15.4,-5.5,1,41.25,24.88,4.81,26,1,1,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,0,1,1,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0.8,0.6,0.4,0.6,0.8,0,0.4,0,0.6,0.3,1.33,1,1,0,0,1,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,66,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,1,1,1,0,0,0,0,1,-1,0,0,1,1,1,0,0,0.6,0,0.6,0.3 +172,R_5aelI5mKEHjLTkn,53 - 59,Canadian,Male,2,2,2,0,2,1,0,2,0,2,2,2,2,2,0,0,0,0,0,-2,2,2,2,-2,2,5,0,-1,2,0,2,2,2,1,2,2,1,4,0,1,1,0,0,2,2,2,2,0,2,4,1,0,1,0,1,3,2,1,2,2,1,3,1,0,0,1,1,2,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,80,TRUE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.04,0,0.25,0,0,0,0,0.25,1,0,0.25,0.25,0,0.5625,0,0,1,0,0,0.25,0,0.25,1,1,1,1,0.289375,0.145714286,0.433035714,25,78.13,21,65.63,5,62.5,6,75,5,62.5,5,62.5,15,93.75,6,37.5,89.22,81.25,93.75,90.62,91.25,98.75,79.69,12.5,23.59,18.75,18.75,28.12,28.75,5,42.19,0,0,0,2,0,1,1,0,0,0,0,1,0,0,1,0,1,1,0,2,0,0,0,0,0,0,0,1,0,1,0,1,0,0,1,1,0,0,1,3,0.4,0.4,0.4,0.8,0,0.4,0.4,1,0.5,0.45,3.67,3.33,1,-1,1,0,0.34,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),58,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,2,0,1,1,-1,0,-1,0,0,0,0,0,-1,1,1,-1,-1,0.4,0,0,-0.2,0.05 +173,R_7j5jomYdBGGQDa9,25 - 31,American,Male,2,3,2,1,3,2,0,2,-2,2,3,2,3,2,3,2,2,2,2,1,2,2,3,1,2,10,1,1,0,2,1,9,2,1,1,1,1,6,-1,-1,0,-1,0,9,3,3,2,3,3,10,2,1,2,3,3,9,2,3,3,2,2,9,1,2,2,1,2,8,FALSE,1,100,TRUE,1,51,FALSE,1,52,FALSE,1,50,FALSE,0,50,TRUE,0,63,FALSE,0,57,TRUE,1,93,TRUE,1,70,TRUE,1,88,FALSE,1,71,TRUE,0,87,TRUE,1,70,FALSE,1,75,TRUE,1,55,TRUE,1,76,TRUE,0,51,TRUE,0,73,FALSE,1,70,FALSE,1,81,TRUE,1,88,TRUE,1,83,FALSE,1,89,TRUE,1,98,FALSE,1,83,TRUE,1,75,FALSE,1,52,FALSE,1,90,TRUE,0,81,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0049,0.0625,0.0576,0.3249,0,0.3969,0.0004,0.0144,0.0361,0.0289,0,0.09,0.09,0.0841,0.25,0.2401,0.0121,0.25,0.01,0.0289,0.0144,0.2025,0.09,0.0625,0.2601,0.2304,0,0,0.2304,0.5329,0.6561,0.7569,0.163146429,0.106642857,0.21965,25,78.13,25,78.13,8,100,4,50,6,75,7,87.5,14,87.5,11,68.75,75.69,64.88,74,79.25,84.62,78.38,73,0,-2.44,-35.12,24,4.25,-2.88,-9.12,4.25,0,1,1,0,1,1,1,2,4,1,1,1,2,1,2,3,3,2,3,1,1,0,0,2,0,0,1,0,5,1,1,1,0,0,1,1,0,0,1,1,0.6,1.8,1.4,2.4,0.6,1.4,0.6,0.6,1.55,0.8,8.33,9.33,0,0,-3,1,-1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),29,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,1,1,-2,1,1,0,2,-1,0,0,0,2,1,1,2,3,2,2,0,0,0.4,0.8,1.8,0.75 +174,R_3OpLNshcHuBpHF9,46 - 52,Canadian,Female,2,0,0,2,1,2,0,2,1,0,2,0,1,0,-1,2,0,1,0,-2,2,1,2,2,2,5,2,-1,2,-1,-1,5,2,2,2,0,-1,5,-1,-3,-2,-3,-2,5,1,1,0,2,1,5,0,0,0,0,0,5,1,1,1,0,-2,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,16,50,16,50,3,37.5,6,75,4,50,3,37.5,6,37.5,10,62.5,50,50,50,50,50,50,50,0,0,12.5,-25,0,12.5,12.5,-12.5,0,1,2,0,1,0,1,0,2,1,0,2,1,0,0,3,3,3,3,0,1,1,0,0,0,2,0,2,1,0,1,1,0,0,1,2,0,1,0,2,0.8,0.8,0.6,2.4,0.4,1,0.6,1,1.15,0.75,5,5,0,0,0,0,0,20 cents,100 minutes,24 days,Female,University - Undergraduate,49,-0.125,0,0,0,0,1,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,-1,0,2,0,1,-2,1,-2,1,1,-1,1,1,0,-1,1,3,2,3,-2,0.4,-0.2,0,1.4,0.4 +175,R_72tu5iEDLN846PN,60 - 66,American,Female,3,3,3,3,3,0,-1,2,1,1,3,3,2,-1,1,3,3,3,3,3,2,2,2,2,2,0,-1,-2,1,-1,0,2,2,2,-1,2,2,5,1,1,1,1,1,4,3,3,3,3,3,1,-1,-2,0,1,-1,1,1,2,1,0,2,1,2,2,2,2,2,1,TRUE,0,93,FALSE,0,78,FALSE,1,92,FALSE,1,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,99,FALSE,1,75,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,86,TRUE,1,100,TRUE,0,86,TRUE,0,94,TRUE,0,88,TRUE,0,78,TRUE,1,91,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,79,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,61,TRUE,1,100,0,0,0,0,0,0,0,0.0001,0.6084,0,0,0.0169,0.0289,0.0625,0,0.6084,0.8281,0.0841,1,1,0.0081,0.0196,0.7744,1,0.7396,0.6241,0.3721,0.8649,0.0064,0.8836,1,1,0.411792857,0.159814286,0.663771429,21,65.63,18,56.25,4,50,5,62.5,4,50,5,62.5,14,87.5,4,25,91.62,77.62,94.38,98.25,96.25,92.81,90.44,9.38,35.37,27.62,31.88,48.25,33.75,5.31,65.44,1,1,1,1,1,1,1,1,2,1,1,1,3,3,1,2,2,2,2,2,0,0,0,0,0,1,1,2,0,2,2,1,1,1,1,1,1,1,1,1,1,1.2,1.8,2,0,1.2,1.2,1,1.5,0.85,2.33,1,-1,1,4,3,1.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,1,1,1,1,0,0,-1,2,-1,-1,0,2,2,0,1,1,1,1,1,1,0,0.6,1,0.65 +176,R_7Hz5Ri71s7av0sI,46 - 52,Canadian,Female,3,1,1,3,2,-1,-2,-1,-1,1,0,-1,2,-3,2,2,2,2,3,2,3,1,1,3,2,1,-2,-2,-1,1,-1,1,0,-1,2,-3,2,1,-1,-1,-1,-1,0,4,3,1,1,3,2,1,-2,-2,-1,-1,1,1,0,-1,2,-3,2,1,2,2,2,2,2,1,FALSE,1,100,TRUE,1,69,FALSE,1,100,TRUE,0,51,TRUE,1,88,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,92,FALSE,0,63,FALSE,1,54,TRUE,0,91,TRUE,1,94,FALSE,1,96,TRUE,1,71,TRUE,1,96,TRUE,0,55,TRUE,0,96,TRUE,0,53,FALSE,1,51,TRUE,1,98,TRUE,1,100,FALSE,1,59,TRUE,1,52,FALSE,1,100,TRUE,1,58,FALSE,1,51,FALSE,1,100,TRUE,0,64,TRUE,1,91,TRUE,1,55,TRUE,1,100,0,0.1764,0.0016,0.0004,0,0,0.2304,0.3969,0.2401,0,0.0081,0.0036,0.0064,0.2116,0.0144,0.0961,0.1681,0.2601,0,0,0.0004,0.0841,0.2809,0.0016,0.3025,0.2401,0.2025,0,0,0.9216,0.4096,0.8281,0.175257143,0.116842857,0.233671429,20,62.5,25,78.13,6,75,6,75,6,75,7,87.5,15,93.75,10,62.5,79.56,62,82.25,88.88,85.12,82.81,76.31,-15.63,1.43,-13,7.25,13.88,-2.38,-10.94,13.81,0,0,0,0,0,1,0,0,2,2,0,0,0,0,0,3,3,3,4,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,3,0,0.2,0,0.2,1,0.1,1,1,0,0,0,3,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,52,1.375,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,3,3,3,3,2,0,0.8,0,2.8,0.9 +177,R_7KwWl3ph6J35kk1,32 - 38,Canadian,Female,3,3,3,3,3,0,-1,2,1,1,1,2,2,1,2,1,2,1,1,0,3,3,3,3,3,0,0,-1,2,-1,1,2,1,2,2,1,1,1,-2,0,-1,-2,-1,0,3,3,3,3,3,1,0,-2,2,-1,1,2,1,2,2,1,2,0,2,2,2,2,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,55,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,70,FALSE,1,100,FALSE,0,90,FALSE,0,95,TRUE,1,90,0,0,0,0,0.01,0,0,0,0,0,0.81,0,0,1,0,0,0,0.36,0.09,0,0.49,1,0,0,0.2025,1,0.9025,0,0.64,1,0,0,0.268035714,0.155714286,0.380357143,22,68.75,23,71.88,3,37.5,7,87.5,7,87.5,6,75,12,75,11,68.75,94.06,94.38,89.38,100,92.5,96.56,91.56,-3.13,22.18,56.88,1.88,12.5,17.5,21.56,22.81,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,3,2,2,3,1,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,1,1,1,0,0.4,0.2,2.2,0,0.6,0,0.8,0.7,0.35,1,1,-1,0,1,-2,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,37,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,2,2,1,2,0,0,-0.2,0.2,1.4,0.35 +178,R_6VOqOlFTMz7RiZR,67 - 73,Canadian,Male,1,3,3,2,-3,1,-1,2,2,3,2,2,3,1,3,0,-1,-1,1,-1,1,3,3,1,-3,2,1,-1,2,1,1,4,2,2,2,2,2,3,-1,-1,-2,1,-1,2,1,3,3,2,-3,2,-1,1,1,-1,-1,5,0,0,1,0,1,6,0,-1,-2,1,-1,5,TRUE,0,100,TRUE,1,100,FALSE,1,69,TRUE,0,100,TRUE,1,100,TRUE,0,72,TRUE,1,100,TRUE,1,100,FALSE,0,63,TRUE,1,83,TRUE,0,69,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,92,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,75,TRUE,1,76,TRUE,1,100,TRUE,0,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,79,FALSE,1,65,TRUE,0,82,TRUE,1,100,TRUE,1,68,TRUE,1,100,0,0,0,0,0,0.5184,0,0.0289,0.5625,0,0,0,0.3969,0.4761,0,0,0.3721,1,0.1225,0,0.0576,0.0064,1,1,1,0.6241,0.1024,1,0.0961,1,0.6724,1,0.394157143,0.239635714,0.548678571,16,50,18,56.25,3,37.5,4,50,5,62.5,6,75,15,93.75,3,18.75,89.19,83.88,86.38,97.88,88.62,92.62,85.75,-6.25,32.94,46.38,36.38,35.38,13.62,-1.13,67,0,0,0,1,0,0,0,0,1,2,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,2,2,1,3,4,2,2,2,1,2,0,0,1,0,0,0.2,0.6,0.6,0.4,0,2.4,1.8,0.2,0.45,1.1,3,4.33,0,-1,-3,-3,-1.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,72,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,0,1,0,-2,-2,-1,-2,-2,-2,-2,-1,0,-1,1,0,0,0,0,0.2,-1.8,-1.2,0.2,-0.65 +179,R_1nr8rXNvKWOPJUa,46 - 52,American,Female,3,2,1,2,3,-2,1,3,-1,2,2,3,1,0,2,1,2,2,1,3,3,3,0,0,1,9,3,-3,3,0,3,10,3,3,2,2,2,8,3,3,3,3,3,8,3,3,-3,2,3,9,2,-2,3,-3,1,9,3,3,0,0,2,10,2,2,2,2,3,10,FALSE,1,100,FALSE,0,79,TRUE,0,100,FALSE,1,77,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,1,73,FALSE,0,72,TRUE,1,100,TRUE,0,96,TRUE,0,100,TRUE,1,90,FALSE,1,67,TRUE,1,100,TRUE,1,100,TRUE,0,89,TRUE,0,100,FALSE,1,85,FALSE,1,59,FALSE,0,66,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,66,TRUE,0,100,TRUE,0,100,TRUE,1,91,FALSE,0,66,TRUE,1,89,0.0729,0.0064,0,0,0.0121,0.8281,0,0,0.1681,0,0.0081,0.01,0.5184,0.9216,0,0.6241,1,0.0529,1,0,0.4356,0,0.0225,0.1089,0.7921,0.1156,0.4356,0,1,1,1,1,0.394775,0.295957143,0.493592857,23,71.88,19,59.38,4,50,3,37.5,7,87.5,5,62.5,12,75,7,43.75,89,80.12,90.62,94.88,90.38,88.62,89.38,12.5,29.62,30.12,53.12,7.38,27.88,13.62,45.63,0,1,1,2,2,5,4,0,1,1,1,0,1,2,0,2,1,1,2,0,0,1,4,0,0,4,3,0,2,1,1,0,1,0,0,1,0,0,1,0,1.2,2.2,0.8,1.2,1,2,0.4,0.4,1.35,0.95,9,9.33,0,1,-2,-2,-0.33,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),51,0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,-3,2,2,1,1,0,-1,0,0,0,0,2,0,1,1,1,1,0,0.2,0.2,0.4,0.8,0.4 +180,R_1lavWYwMBcrhkBT,67 - 73,American,Male,2,1,2,-1,2,0,-2,2,-2,2,1,-1,2,0,2,1,2,2,2,0,3,2,2,-2,3,2,2,-2,2,-2,2,2,1,0,2,2,2,2,1,2,2,2,-1,2,2,2,2,1,2,1,0,-2,2,0,2,2,0,-2,2,-2,2,2,0,0,2,2,-1,3,TRUE,0,81,FALSE,0,80,TRUE,0,90,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,FALSE,0,50,FALSE,1,81,TRUE,0,81,TRUE,1,81,FALSE,1,100,FALSE,0,81,TRUE,1,81,FALSE,1,100,TRUE,0,80,FALSE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,91,FALSE,1,81,FALSE,0,91,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,50,TRUE,1,100,0,0,0.0361,0,0,0,0.8281,0.25,0,0.0081,1,0.0361,0.16,0.0361,0.0361,0.64,0.0361,0.25,0,0.25,0,0.6561,0.0196,0,0,0.25,0.25,0.6561,0.81,0.64,0,0.6561,0.266732143,0.234328571,0.299135714,25,78.13,22,68.75,5,62.5,8,100,5,62.5,4,50,11,68.75,11,68.75,83.62,67.25,92.88,81.5,92.88,84.12,83.12,9.38,14.87,4.75,-7.12,19,42.88,15.37,14.37,1,1,0,1,1,2,0,0,0,0,0,1,0,2,0,0,0,0,0,1,0,1,0,2,0,0,0,0,2,0,1,1,0,2,0,1,2,0,0,1,0.8,0.4,0.6,0.2,0.6,0.4,0.8,0.8,0.5,0.65,2,1.67,1,0,0,-1,0.33,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),70,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,0,-1,1,2,0,0,-2,0,-1,0,0,0,0,-1,-2,0,0,0,0.2,0,-0.2,-0.6,-0.15 +181,R_5hEr8txNV8G6XyV,67 - 73,Canadian,Female,-2,-2,2,-1,-3,-2,2,2,2,-1,1,2,2,1,0,1,-1,1,1,-1,-2,-2,1,-2,-3,2,-2,1,2,2,-2,1,-1,2,1,1,-1,1,-2,-2,-1,0,-2,1,-3,-2,1,1,-3,0,-3,1,0,0,-3,1,1,2,-1,-1,-1,1,1,-1,1,1,-1,0,TRUE,0,50,FALSE,0,50,FALSE,1,84,FALSE,1,50,FALSE,0,50,FALSE,1,76,TRUE,1,80,TRUE,1,90,FALSE,0,50,TRUE,1,62,TRUE,0,50,FALSE,1,65,TRUE,1,51,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,72,TRUE,1,91,FALSE,1,54,FALSE,1,75,TRUE,0,86,TRUE,1,85,FALSE,0,50,TRUE,1,97,0.01,0.0081,0.25,0.04,0.0009,0.0576,0.25,0.1444,0.25,0.25,0.0225,0.2401,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.5184,0.25,0.25,0.25,0.25,0.25,0.2116,0.25,0.25,0.0256,0.0625,0.7396,0.1225,0.221721429,0.193964286,0.249478571,15,46.88,19,59.38,3,37.5,5,62.5,5,62.5,6,75,8,50,11,68.75,62.28,50.5,63.75,66.25,68.62,62.88,61.69,-12.5,2.9,13,1.25,3.75,-6.38,12.88,-7.06,0,0,1,1,0,0,1,0,0,1,2,0,1,0,1,3,1,2,1,1,1,0,1,2,0,1,1,2,2,2,0,0,3,2,1,0,0,0,0,0,0.4,0.4,0.8,1.6,0.8,1.6,1.2,0,0.8,0.9,1.33,0.67,2,0,0,1,0.66,10 cents,100 minutes,47 days,Female,High School (or equivalent),69,0.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-1,0,0,-1,0,-1,0,-2,-2,-1,2,0,-2,-2,0,3,1,2,1,1,-0.4,-1.2,-0.4,1.6,-0.1 +182,R_3gOW8RvlAJODhim,67 - 73,Canadian,Male,-1,3,-1,1,2,0,0,2,-3,0,1,2,2,0,2,0,0,1,2,1,-1,3,-1,0,3,2,1,-2,2,-3,0,1,1,2,2,1,3,0,1,0,1,0,1,2,-1,3,-1,2,0,6,0,0,-1,-3,0,2,1,2,2,-3,3,1,0,-2,1,1,1,7,FALSE,1,53,TRUE,1,50,TRUE,0,62,TRUE,0,50,TRUE,1,53,FALSE,1,50,FALSE,0,64,TRUE,1,96,TRUE,1,50,TRUE,1,100,FALSE,1,68,FALSE,1,87,TRUE,1,100,FALSE,1,69,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,62,FALSE,1,100,TRUE,1,62,TRUE,1,85,FALSE,1,50,TRUE,1,63,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,71,FALSE,0,50,TRUE,1,50,TRUE,1,100,0.0016,0,0,0.4096,0,0.25,0.1369,0,0,0.0225,0.25,0,0.25,0.1024,0.2209,0.25,0.25,0.25,0,1,0.1444,0.25,0.1444,0.0961,0.25,0.25,0.25,0.2209,0.3844,0,0.5041,0.0169,0.196210714,0.141621429,0.2508,17,53.13,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,71.72,53.75,67,83.88,82.25,73.31,70.12,-21.87,-3.28,-21.25,-8,8.88,7.25,-14.19,7.62,0,0,0,1,1,1,2,0,0,0,0,0,0,1,1,1,0,0,2,0,0,0,0,1,2,0,0,3,0,0,0,0,0,3,1,0,2,0,1,0,0.4,0.6,0.4,0.6,0.6,0.6,0.8,0.6,0.5,0.65,1,3,-4,-1,-1,-5,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,71,0.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,-1,1,2,-3,0,0,0,0,0,-2,0,1,-2,0,1,0,-0.2,0,-0.4,0,-0.15 +183,R_6DOx4ZWfqkOgT71,53 - 59,American,Female,1,3,3,3,3,-1,0,1,1,2,0,-1,2,1,1,-2,-2,-2,-2,-3,3,3,3,1,3,7,0,1,-1,-2,3,5,-1,-1,3,3,3,3,-1,0,1,-2,-2,4,3,3,3,3,3,2,-2,1,-1,1,1,3,1,-2,2,-2,2,2,0,1,1,1,-2,6,FALSE,1,83,TRUE,1,100,TRUE,0,87,TRUE,0,52,TRUE,1,95,FALSE,1,98,TRUE,1,87,TRUE,1,95,TRUE,1,89,TRUE,1,83,TRUE,0,83,TRUE,0,98,TRUE,1,95,FALSE,1,82,TRUE,1,77,TRUE,1,89,FALSE,1,76,TRUE,0,93,FALSE,1,83,FALSE,1,100,FALSE,0,73,TRUE,1,90,FALSE,1,69,TRUE,1,83,TRUE,0,81,TRUE,1,63,TRUE,0,73,FALSE,1,71,TRUE,0,69,TRUE,1,76,FALSE,0,74,TRUE,1,100,0.0025,0.1369,0.0121,0.0169,0,0.0004,0.0289,0.0289,0,0.01,0.0576,0.0025,0.0121,0.6889,0.0025,0,0.0961,0.2704,0.0841,0.6561,0.5329,0.0529,0.0289,0.0324,0.0576,0.5329,0.5476,0.0289,0.7569,0.8649,0.4761,0.9604,0.243246429,0.085592857,0.4009,26,81.25,22,68.75,4,50,6,75,6,75,6,75,14,87.5,8,50,83.34,78.88,84.38,82.75,87.38,85.56,81.12,12.5,14.59,28.88,9.38,7.75,12.38,-1.94,31.12,2,0,0,2,0,1,1,2,3,1,1,0,1,2,2,1,2,3,0,1,2,0,0,0,0,1,1,2,0,1,1,1,0,3,1,2,3,3,3,1,0.8,1.6,1.2,1.4,0.4,1,1.2,2.4,1.25,1.25,5,2.33,5,2,1,-2,2.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,53,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,2,0,0,0,0,3,0,0,-1,1,-1,1,-1,-1,0,-3,0,0.4,0.6,0,-1,0 +184,R_1TooM3xgnfa4iAN,67 - 73,American,Female,1,0,1,1,3,-3,-2,2,1,0,3,3,3,-2,3,2,2,3,3,2,2,0,0,0,3,5,-3,-3,3,0,0,1,3,3,3,-2,3,0,2,2,2,2,2,2,0,-2,0,2,2,3,-3,-3,0,1,0,5,3,3,3,-3,3,1,2,2,3,3,2,1,TRUE,0,77,TRUE,1,100,FALSE,1,100,FALSE,1,56,FALSE,0,58,FALSE,1,85,TRUE,1,90,TRUE,1,96,TRUE,1,87,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,92,TRUE,1,57,TRUE,1,100,FALSE,1,75,FALSE,1,97,TRUE,0,71,FALSE,1,82,FALSE,0,61,TRUE,1,94,FALSE,1,98,TRUE,1,100,FALSE,1,99,TRUE,1,97,TRUE,0,67,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,68,TRUE,1,92,0.0016,0.0009,0,0.01,0.0064,0.0225,0,0,0.0324,0.0036,0,0,0.0169,0,0.3364,0,0.0004,0.1936,0.0025,0.0001,0.3721,0.1849,0.5041,0.8464,0.0625,0.4489,0.1024,0.5929,0,0.0009,1,1,0.204639286,0.043728571,0.36555,13,40.63,24,75,6,75,5,62.5,6,75,7,87.5,14,87.5,10,62.5,87.31,75.75,83.62,93.25,96.62,87.5,87.12,-34.37,12.31,0.75,21.12,18.25,9.12,0,24.62,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,0,1,2,1,1,1,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0.6,0.6,0,0.4,1.2,0.6,0.2,0,0.4,0.5,2,3,2,-4,-1,1,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,71,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,-2,0,0,-1,0,0,-1,1,0,0,0,0,-1,0,0,0,1,1,0,-0.6,0,-0.2,0.4,-0.1 +185,R_1EJn0lGnt7PpQmB,60 - 66,Canadian,Male,2,3,3,1,3,-1,-1,1,0,1,3,-3,3,1,3,-1,1,-1,-1,-3,2,3,3,3,3,2,-2,-1,1,2,1,3,3,-3,3,1,3,2,1,-3,1,0,3,9,2,3,3,1,2,2,-3,-3,1,-3,0,1,3,-3,3,1,2,2,-3,1,-1,-1,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,60,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,75,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,66,FALSE,1,80,TRUE,1,53,FALSE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,58,TRUE,1,50,TRUE,1,100,0,0.2209,0,0,0,0,0.1156,0,0,0.04,0.1764,0,0.25,0.25,0,0,0,0.25,0,0.04,0.25,0.25,0.25,0.25,0.25,0,0.25,0,0.36,0.25,0.25,0.0625,0.126589286,0.077285714,0.175892857,27,84.38,27,84.38,6,75,6,75,8,100,7,87.5,14,87.5,13,81.25,75.69,62.5,81.25,76.62,82.38,78.56,72.81,0,-8.69,-12.5,6.25,-23.38,-5.12,-8.94,-8.44,0,0,0,2,0,1,0,0,2,0,0,0,0,0,0,2,4,2,1,6,0,0,0,0,1,2,2,0,3,1,0,0,0,0,1,2,0,0,0,0,0.4,0.6,0,3,0.2,1.6,0.2,0.4,1,0.6,2.33,1.67,0,2,0,4,0.66,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,65,1,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,2,-1,-1,-2,0,-1,-1,0,0,0,0,-1,0,4,2,1,6,0.2,-1,-0.2,2.6,0.4 +186,R_5BP5IvVmlpPoyuR,60 - 66,American,Female,-2,0,3,3,2,-2,0,1,0,0,2,1,2,-1,1,1,1,2,2,1,-2,0,3,2,3,4,-2,0,1,0,0,4,2,1,2,-1,1,3,1,1,1,1,1,5,-2,0,3,3,2,2,-2,0,1,0,0,2,2,1,2,-1,1,2,1,1,1,2,1,3,TRUE,0,88,TRUE,1,81,TRUE,0,89,FALSE,1,50,TRUE,1,50,FALSE,1,91,TRUE,1,87,TRUE,1,96,TRUE,1,83,TRUE,1,50,FALSE,1,50,TRUE,0,82,TRUE,1,73,TRUE,0,97,TRUE,1,50,TRUE,1,98,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,81,FALSE,1,50,TRUE,1,50,FALSE,1,82,TRUE,1,84,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,80,FALSE,0,50,TRUE,1,83,0.0016,0.0256,0.0004,0.0169,0.0289,0.0081,0.25,0.25,0.25,0.0361,0.04,0.0729,0.0289,0.25,0.25,0.0361,0.25,0.25,0.25,0.0324,0.25,0.25,0.25,0.9409,0.25,0.25,0.25,0.7744,0.7921,0.25,0.25,0.6724,0.266542857,0.142928571,0.390157143,25,78.13,23,71.88,7,87.5,6,75,5,62.5,5,62.5,15,93.75,8,50,67.97,58,62.12,77.38,74.38,71.62,64.31,6.25,-3.91,-29.5,-12.88,14.88,11.88,-22.13,14.31,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0,0.4,0,0,0,0.2,0.2,0.05,3.67,2,2,2,1,2,1.67,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,0.75,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0.4,0,0,0.2,0.15 +187,R_3zDeRIbcpMwUQ13,67 - 73,Canadian,Male,1,1,3,-2,-2,-2,-1,2,3,-2,1,2,-1,1,1,-2,-2,-1,-1,-1,2,2,-1,-1,2,5,-2,0,-2,3,1,5,2,1,2,3,1,6,-1,-3,-2,-2,0,8,2,1,3,2,-2,4,-3,-3,-3,3,-1,4,1,2,-3,-3,1,4,-1,-2,-1,-1,-1,2,TRUE,0,82,TRUE,1,78,TRUE,0,100,FALSE,1,77,FALSE,0,69,TRUE,0,69,FALSE,0,100,TRUE,1,88,FALSE,0,58,TRUE,1,98,TRUE,0,82,FALSE,1,98,TRUE,1,100,TRUE,0,100,TRUE,1,71,TRUE,1,100,FALSE,1,61,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,80,TRUE,1,97,FALSE,1,76,TRUE,1,100,TRUE,0,67,TRUE,1,100,TRUE,0,72,FALSE,1,68,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0144,0,0,1,0,0.4761,0,0.0004,0,0.0009,0,0,0.3364,0.6724,0.4761,0.0484,0.0576,0.0529,0.1024,0.4489,0.04,0.0841,0.0081,1,0.1521,0.5184,0,0.6724,1,1,1,0.0004,0.291,0.151514286,0.430485714,14,43.75,20,62.5,5,62.5,5,62.5,3,37.5,7,87.5,13,81.25,7,43.75,86.94,78.62,81.88,93,94.25,89.94,83.94,-18.75,24.44,16.12,19.38,55.5,6.75,8.69,40.19,1,1,4,1,4,0,1,4,0,3,1,1,3,2,0,1,1,1,1,1,1,0,0,4,0,1,2,5,0,1,0,0,2,4,0,1,0,0,0,0,2.2,1.6,1.4,1,1,1.8,1.2,0.2,1.55,1.05,5.33,4,1,1,2,6,1.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,1.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,1,4,-3,4,-1,-1,-1,0,2,1,1,1,-2,0,0,1,1,1,1,1.2,-0.2,0.2,0.8,0.5 +188,R_6rrnCccLen5H6KZ,46 - 52,Canadian,Male,1,2,2,-3,3,1,0,1,-2,3,-1,0,3,1,1,-1,0,0,1,-3,2,3,3,-3,3,5,2,0,2,-2,3,1,-1,0,3,3,0,6,-2,0,0,-1,-2,6,1,3,3,0,3,2,2,-1,0,-1,3,3,-1,0,3,0,1,2,0,0,0,0,0,3,FALSE,1,100,TRUE,1,90,FALSE,1,50,FALSE,1,80,TRUE,1,100,FALSE,1,99,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,90,TRUE,1,95,TRUE,1,100,FALSE,1,80,FALSE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0001,0,0.0001,0,0.0025,0,0,1,1,0,0,0,0.01,0,0.04,1,0.04,0,0.0025,0,0.01,0.04,0,0,0,0.25,0.01,1,1,0.193039286,0.146614286,0.239464286,16,50,27,84.38,8,100,6,75,8,100,5,62.5,14,87.5,13,81.25,95.25,95.62,97.38,94.25,93.75,98.69,91.81,-34.38,10.87,-4.38,22.38,-5.75,31.25,11.19,10.56,1,1,1,0,0,1,0,1,0,0,0,0,0,2,1,1,0,0,2,1,0,1,1,3,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,3,0.6,0.4,0.6,0.8,1,0.8,0.2,1,0.6,0.75,4,2.33,3,-2,4,3,1.67,10 cents,5 minutes,47 days,Male,High School (or equivalent),49,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,0,0,-3,0,0,-1,0,-1,0,0,0,0,1,1,0,0,0,1,-2,-0.4,-0.4,0.4,-0.2,-0.15 +189,R_6S8ENIP57PJHIsp,60 - 66,Canadian,Male,1,1,3,0,2,-1,1,2,1,1,0,-1,1,0,2,-1,-1,1,-1,-3,3,2,3,2,2,2,-2,1,1,1,1,2,-1,-1,1,0,2,2,-1,0,-1,0,-3,3,2,2,3,2,1,3,-1,1,1,1,1,4,0,0,1,0,2,4,-3,-2,-2,-1,-3,7,TRUE,0,85,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,60,FALSE,1,50,TRUE,1,58,TRUE,1,62,FALSE,0,50,FALSE,0,50,FALSE,1,67,TRUE,0,50,TRUE,1,50,FALSE,1,90,TRUE,1,50,TRUE,1,91,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,89,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,86,TRUE,0,55,TRUE,1,74,TRUE,0,50,FALSE,1,70,TRUE,0,59,FALSE,0,66,FALSE,0,50,TRUE,1,96,0.1444,0.0676,0.0081,0.1764,0.0016,0.25,0.0196,0.25,0.0121,0.25,0.4356,0.25,0.25,0.1089,0.16,0.04,0.25,0.25,0.09,0.3025,0.25,0.25,0.25,0.01,0.25,0.25,0.25,0.7225,0.25,0.25,0.3481,0.25,0.223246429,0.180557143,0.265935714,23,71.88,19,59.38,5,62.5,5,62.5,3,37.5,6,75,10,62.5,9,56.25,62.12,55.88,58.12,64,70.5,63.94,60.31,12.5,2.74,-6.62,-4.38,26.5,-4.5,1.44,4.06,2,1,0,2,0,1,0,1,0,0,1,0,0,0,0,0,1,2,1,0,1,1,0,2,1,0,0,1,0,0,0,1,0,0,0,2,1,3,0,0,1,0.4,0.2,0.8,1,0.2,0.2,1.2,0.6,0.65,2,3.67,-1,-2,-2,-4,-1.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,61,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,1,0,0,0,-1,1,0,0,0,0,1,-1,0,0,0,-2,0,-1,1,0,0,0.2,0,-0.4,-0.05 +190,R_7KZu4HZPAvniCUw,60 - 66,American,Female,2,3,2,1,3,0,-2,2,-1,1,2,1,2,1,2,1,1,1,1,-1,2,3,2,1,3,4,0,-2,2,-1,1,4,2,2,2,2,1,6,0,1,1,1,-1,6,2,3,2,2,1,3,-1,-2,2,-1,0,5,1,1,1,0,2,2,1,2,1,1,1,5,TRUE,0,94,TRUE,1,100,TRUE,0,100,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,93,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,90,TRUE,1,97,FALSE,1,92,TRUE,0,100,TRUE,0,85,FALSE,1,100,TRUE,1,100,TRUE,1,96,TRUE,0,100,TRUE,1,100,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,0,0,0.0009,0,0,0,0,0,0,0.0016,0,0,0,0.0049,0,0,1,0.64,0.64,0.9216,0,0.01,0.7225,1,0.0064,1,0.0064,0.8836,1,1,1,1,0.387035714,0.117607143,0.656464286,25,78.13,20,62.5,5,62.5,6,75,4,50,5,62.5,16,100,4,25,96.72,92.5,99,98.25,97.12,98.44,95,15.63,34.22,30,24,48.25,34.62,-1.56,70,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,1,2,1,0,0,0,1,1,0,1,1,0,0,1,0,0,2,0,0,0.6,0.2,0.6,0.4,0.6,0.6,0.2,0.55,4.67,3.33,1,-1,4,1,1.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,0,-1,-2,-1,0,0,0,-1,-1,1,-1,0,1,1,-1,0,0,-2,-0.6,-0.4,0,-0.4,-0.35 +191,R_7uK8ncoM3QhZibI,60 - 66,American,Female,-3,-3,3,-3,2,3,-3,-3,-3,1,3,3,3,1,3,3,3,3,3,3,-3,-3,3,-3,3,0,3,-3,3,-3,3,0,3,3,3,3,3,2,3,3,3,3,3,0,-2,-2,3,1,-1,4,3,-3,3,-3,1,1,3,3,3,1,3,0,3,3,3,3,3,0,TRUE,0,60,TRUE,1,85,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,80,FALSE,1,85,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,60,FALSE,1,100,FALSE,1,55,FALSE,1,100,FALSE,0,100,TRUE,1,50,FALSE,1,100,TRUE,1,65,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,FALSE,0,70,FALSE,0,90,TRUE,1,100,0,0,0.25,0,0,0,0.1225,0.64,0,0.25,0.49,1,0.25,0.0225,0.25,0.0225,0,0.25,0,0,1,0.25,0.2025,1,0.16,0.25,0.81,0.36,1,0,0.5625,0,0.317589286,0.235535714,0.399642857,16,50,21,65.63,6,75,4,50,5,62.5,6,75,10,62.5,11,68.75,80.47,64.38,85.62,86.25,85.62,77.5,83.44,-15.63,14.84,-10.62,35.62,23.75,10.62,15,14.69,0,0,0,0,1,0,0,6,0,2,0,0,0,2,0,0,0,0,0,0,1,1,0,4,3,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0.2,1.6,0.4,0,1.8,1.2,0,0,0.55,0.75,0.67,1.67,-4,-1,2,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,60,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-1,-1,0,-4,-2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,-1.6,0.4,0.4,0,-0.2 +192,R_717Qrjqx0Ht7egx,60 - 66,Canadian,Female,3,2,2,2,-1,1,-3,2,-1,1,2,-1,2,-2,3,3,3,3,3,3,2,2,2,2,-1,1,1,-1,3,0,1,2,2,0,2,-3,3,2,1,1,1,1,1,6,2,2,2,2,-2,1,1,-3,3,-3,1,0,1,0,2,-3,3,0,3,2,3,2,2,1,FALSE,1,81,TRUE,1,93,FALSE,1,100,FALSE,1,50,TRUE,1,85,FALSE,1,93,TRUE,1,94,TRUE,1,94,TRUE,1,100,TRUE,1,100,FALSE,1,86,FALSE,1,70,TRUE,1,92,TRUE,0,92,FALSE,0,71,TRUE,1,89,TRUE,0,75,TRUE,0,90,FALSE,1,94,FALSE,1,94,TRUE,1,96,TRUE,1,79,TRUE,0,59,TRUE,1,91,FALSE,1,95,TRUE,1,91,FALSE,1,63,FALSE,1,96,TRUE,0,78,TRUE,1,90,FALSE,0,59,TRUE,1,95,0.0036,0.0081,0.0121,0.0036,0.0025,0.0049,0.0081,0,0.0036,0.0441,0.01,0.0064,0,0.0196,0.0225,0.0049,0.3481,0.25,0.0016,0.0025,0.0016,0.5041,0.0036,0.8464,0.5625,0.1369,0.3481,0.0361,0,0.81,0.6084,0.09,0.167017857,0.051764286,0.282271429,27,84.38,25,78.13,6,75,5,62.5,6,75,8,100,14,87.5,11,68.75,85.47,77,84.12,90.25,90.5,88.69,82.25,6.25,7.34,2,21.62,15.25,-9.5,1.19,13.5,1,0,0,0,0,0,2,1,1,0,0,1,0,1,0,2,2,2,2,2,1,0,0,0,1,0,0,1,2,0,1,1,0,1,0,0,1,0,1,1,0.2,0.8,0.4,2,0.4,0.6,0.6,0.6,0.85,0.55,1.67,0.33,0,2,2,5,1.34,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,-1,0,2,0,-1,0,-1,0,0,0,0,2,1,2,1,1,-0.2,0.2,-0.2,1.4,0.3 +193,R_32AbkEeLXpIYgdH,60 - 66,Canadian,Female,3,2,2,-2,1,-2,0,2,1,1,3,3,3,0,3,1,2,2,2,2,3,3,3,-1,0,3,-1,1,3,0,2,0,3,3,3,2,3,3,0,1,1,2,2,0,3,2,2,0,2,0,0,0,2,0,-1,0,3,3,3,-1,3,2,1,0,2,2,1,0,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,89,TRUE,1,100,FALSE,0,79,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,1,0.25,1,1,0,0.0625,1,1,0.81,0.25,0.6241,0.7225,1,1,0.7921,1,0.420042857,0.107142857,0.732942857,24,75,17,53.13,4,50,4,50,4,50,5,62.5,14,87.5,3,18.75,92.75,81.75,91.12,98.12,100,94,91.5,21.87,39.62,31.75,41.12,48.12,37.5,6.5,72.75,0,1,1,1,1,1,1,1,1,1,0,0,0,2,0,1,1,1,0,0,0,0,0,2,1,2,0,0,1,2,0,0,0,1,0,0,2,0,0,1,0.8,1,0.4,0.6,0.6,1,0.2,0.6,0.7,0.6,2,0.67,3,0,1,0,1.33,10 cents,5 minutes,24 days,Female,Trade School (non-military),65,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,1,1,-1,0,-1,1,1,0,-1,0,0,0,1,0,1,-1,1,0,-1,0.2,0,0.2,0,0.1 +194,R_7EpfyyIfd3kset4,18 - 24,Canadian,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,1,1,1,1,0.642857143,0.571428571,0.714285714,32,100,12,37.5,4,50,2,25,3,37.5,3,37.5,7,43.75,5,31.25,100,100,100,100,100,100,100,62.5,62.5,50,75,62.5,62.5,56.25,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,5 minutes,47 days,Female,University - PhD,23,0,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +195,R_5s1fW4qD4ZuXL1M,53 - 59,Canadian,Male,-2,3,2,1,3,0,2,1,0,1,0,0,0,0,0,1,0,0,0,0,-2,3,1,1,3,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,-2,3,0,1,3,1,0,1,1,1,1,1,0,0,0,0,0,2,1,0,0,0,0,2,TRUE,0,97,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0.25,1,0,0,0.25,0,0.25,1,0,0,0,0,0.25,0,0.25,0.25,0,0.25,0,0,1,0.25,0,1,0,0.25,0.25,0.9409,1,0,0.25,1,0.301460714,0.178571429,0.42435,24,75,16,50,3,37.5,5,62.5,4,50,4,50,5,31.25,11,68.75,82.72,62.5,81.25,99.62,87.5,75,90.44,25,32.72,25,18.75,49.62,37.5,43.75,21.69,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0.2,0.4,0.4,0,0,0.2,0.2,0.67,1.33,-1,0,-1,-1,-0.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,59,0.625,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-0.2,0,0,0.2,0 +196,R_7W6fO2X8ztw1fhv,60 - 66,American,Female,0,1,2,-2,3,1,0,2,-2,1,3,3,2,0,3,2,2,2,2,2,0,1,3,-2,3,8,2,0,3,-1,2,7,3,3,2,0,2,9,2,2,2,2,2,6,0,2,2,0,3,5,3,0,3,0,2,5,3,3,2,0,3,0,2,2,2,3,2,8,FALSE,1,79,FALSE,0,76,TRUE,0,100,FALSE,1,78,FALSE,0,73,FALSE,1,78,TRUE,1,100,TRUE,1,100,FALSE,0,82,TRUE,1,100,TRUE,0,71,TRUE,0,100,TRUE,1,100,FALSE,1,79,FALSE,0,74,TRUE,1,100,TRUE,0,83,TRUE,0,79,FALSE,1,76,FALSE,1,77,FALSE,0,78,TRUE,1,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,74,FALSE,1,100,FALSE,1,76,TRUE,1,100,FALSE,0,75,TRUE,1,100,0,0.0625,0,0,0,0.0484,0,0,0.0529,0,0,0,0.6724,0.5041,0.5329,0.5776,0.0576,0.0484,0,0,0.6084,0.5476,0.0576,0.0441,0.6889,0.5476,0.5625,0.0441,1,0.6241,0.0576,1,0.2956,0.178164286,0.413035714,16,50,20,62.5,2,25,5,62.5,7,87.5,6,75,10,62.5,10,62.5,86.22,75.75,83,89,97.12,89.56,82.88,-12.5,23.72,50.75,20.5,1.5,22.12,27.06,20.38,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,2,0,2,0,1,2,1,0,0,0,0,0,0,0,0,1,0,0.2,0.8,0.2,0,0.6,1.2,0,0.2,0.3,0.5,8,3.33,3,2,9,-2,4.67,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,61,0,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,-1,1,-2,0,-1,0,0,-1,0,0,0,0,0,1,0,0,0,-1,0,-0.4,-0.4,0.2,-0.2,-0.2 +197,R_7zUz2CkLTb6URq7,60 - 66,American,Female,3,3,2,-3,3,2,-3,2,-2,3,-2,-3,3,-3,3,0,-1,1,2,-2,3,3,1,-3,3,5,3,-3,3,-3,3,2,-2,-3,3,-3,3,1,3,2,3,2,2,10,3,3,1,-2,3,1,2,-3,2,-2,3,0,-2,-3,3,-3,3,0,2,3,3,3,-2,4,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,95,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,89,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,96,TRUE,1,100,1,0,0,1,0,0,0,1,0,0,0,1,0.0025,0,0,0.0009,0,0,0,1,1,0.7921,0,0,0,1,0.0016,0,0,0,1,0,0.242753571,0.1431,0.342407143,28,87.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,10,62.5,13,81.25,99.28,97.12,100,100,100,98.56,100,15.62,27.4,22.12,37.5,37.5,12.5,36.06,18.75,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,3,3,2,0,4,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,2,4,2,1,0,0.2,0.6,0,2.4,0.4,0,0,1.8,0.8,0.55,2.67,0.33,4,2,1,6,2.34,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,62,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,0,1,0,1,1,0,0,0,0,0,0,1,-1,0,-1,4,-0.2,0.6,0,0.6,0.25 +198,R_1ptXb6hcKwxf94N,67 - 73,American,Male,3,3,3,0,3,-2,-3,3,-3,1,1,1,1,-3,1,3,3,3,3,-1,3,3,3,-3,3,1,-2,-3,2,-3,1,0,1,1,2,-3,2,0,3,2,2,3,2,1,3,3,3,1,3,2,-2,-3,2,-3,1,1,2,1,2,-3,2,2,2,2,3,3,2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,65,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,61,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.25,0,0.3721,0,0.16,0.4225,1,0,1,0,0,1,1,1,0,0.257307143,0.089285714,0.425328571,30,93.75,24,75,6,75,7,87.5,4,50,7,87.5,15,93.75,9,56.25,94.88,84.38,100,95.12,100,97.5,92.25,18.75,19.88,9.38,12.5,45.12,12.5,3.75,36,0,0,0,3,0,0,0,1,0,0,0,0,1,0,1,0,1,1,0,3,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,1,1,0,0,3,0.6,0.2,0.4,1,0.2,0.2,0.6,1,0.55,0.5,0.33,1.67,-1,-1,-2,0,-1.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,2,0,0,0,0,0,0,-1,0,0,0,0,-1,0,1,0,0,0.4,0,-0.2,0,0.05 +199,R_7jdIJPh0nOHF8jT,60 - 66,Canadian,Male,-2,1,1,-1,2,1,-1,3,-1,0,1,2,3,2,1,1,1,1,1,0,-2,1,1,-1,1,5,1,-2,1,-2,1,5,2,2,3,2,2,5,1,1,1,1,1,5,-1,1,2,0,1,5,1,-3,1,-1,-2,1,2,2,2,0,1,5,1,1,1,1,1,5,TRUE,0,75,FALSE,0,80,FALSE,1,80,TRUE,0,90,FALSE,0,55,FALSE,1,90,TRUE,1,77,TRUE,1,95,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,100,TRUE,1,79,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,82,FALSE,1,74,TRUE,0,89,FALSE,1,97,FALSE,0,100,FALSE,0,79,FALSE,1,77,TRUE,1,76,TRUE,0,100,TRUE,1,83,FALSE,1,62,FALSE,1,62,TRUE,0,70,FALSE,0,100,TRUE,1,67,FALSE,0,79,0.0025,0.0289,0,0.0529,0.6241,0.01,0.0576,0.25,0.0009,0.6241,1,0.0441,0.25,0.25,0.3025,0.64,0.0529,0.81,0.1444,1,1,0.25,0.7921,0.25,0.6724,0.1444,0.1089,0.5625,0.04,0.0676,0.49,1,0.408517857,0.351157143,0.465878571,15,46.88,15,46.88,2,25,3,37.5,4,50,6,75,7,43.75,8,50,77.12,67.25,79,73.5,88.75,76.25,78,0,30.24,42.25,41.5,23.5,13.75,32.5,28,0,0,0,0,1,0,1,2,1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,2,2,0,2,1,0,1,2,0,0,0,0,0,1,0.2,1,0.4,0.2,0.8,1.2,0.8,0.2,0.45,0.75,5,3.67,0,4,0,0,1.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,0.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,-1,0,-1,-1,0,0,-1,0,1,-1,0,0,-1,-2,1,0,0,0,0,0,-0.6,-0.2,-0.4,0,-0.3 +200,R_1zTf0GDK4e5UVk5,53 - 59,American,Female,1,2,-1,0,2,-2,-2,2,-2,2,2,-2,3,-2,2,-1,0,-1,-1,2,0,2,1,2,2,1,-2,1,2,1,2,3,2,-2,3,-2,2,0,-1,-1,0,-1,2,1,1,2,-1,0,2,1,-2,-2,2,-2,2,0,2,-2,3,-2,2,0,2,2,2,2,2,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,51,TRUE,1,68,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,54,FALSE,0,100,TRUE,0,58,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,54,FALSE,0,100,TRUE,0,60,FALSE,1,100,FALSE,1,71,FALSE,1,65,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,55,TRUE,1,100,0,0,1,0,0,0,0,1,0.1225,0,0,1,0.2116,0.3364,0.1024,0,0,0.2401,0,0,1,0.2116,0.0841,1,0.36,0.25,0.2025,0,0,0,0.5625,1,0.274417857,0.215214286,0.333621429,16,50,23,71.88,7,87.5,4,50,6,75,6,75,12,75,11,68.75,86.28,61.62,87.88,100,95.62,89.44,83.12,-21.88,14.4,-25.88,37.88,25,20.62,14.44,14.37,1,0,2,2,0,0,3,0,3,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,3,3,0,1,1.2,0,0.4,0,0,0,2.2,0.65,0.55,1.33,0.33,0,3,0,-4,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,56,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,1,0,2,2,0,0,3,0,3,0,0,0,0,0,0,-3,-1,-2,-3,0,1,1.2,0,-1.8,0.1 +201,R_3pS9MbfPbpA5x10,60 - 66,American,Female,3,1,2,0,2,-1,-2,3,-2,1,2,2,2,-2,2,1,1,1,2,0,3,2,2,-1,2,2,-2,-2,3,-2,2,1,2,2,2,-2,2,1,1,1,1,1,0,7,2,1,2,2,0,7,-2,-2,3,-2,1,3,2,2,2,-2,2,0,0,0,1,1,0,6,TRUE,0,96,TRUE,1,99,FALSE,1,100,FALSE,1,62,TRUE,1,71,FALSE,1,100,TRUE,1,86,TRUE,1,100,TRUE,1,96,TRUE,1,100,FALSE,1,85,TRUE,0,92,TRUE,1,98,TRUE,0,100,TRUE,1,59,TRUE,1,97,FALSE,1,63,TRUE,0,100,TRUE,0,70,FALSE,1,55,FALSE,0,57,TRUE,1,56,FALSE,1,100,TRUE,1,97,FALSE,1,61,TRUE,1,99,TRUE,0,76,FALSE,1,74,TRUE,0,98,TRUE,1,97,TRUE,1,75,TRUE,1,100,0,0.0001,0.0009,0.0196,0,0,0.0009,0,0.2025,0.1936,0.0009,0.0004,0.0016,0.0225,0.0841,0.0001,0,0.1444,0.0676,0.1521,0.3249,0.1681,0.49,1,0.1369,0.5776,0.0625,0.9216,0,1,0.9604,0.8464,0.262825,0.0465,0.47915,25,78.13,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,84.97,77.75,85.88,87.25,89,86.69,83.25,3.13,9.97,2.75,10.88,24.75,1.5,-7.06,27,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,2,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0.4,0.4,0,0.2,1,0.2,0,0.6,0.25,0.45,1.33,3.33,-5,-2,1,1,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),65,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,-1,1,0,-1,-2,0,0,0,0,1,0,0,0,0,0,-1,-1,0,0,0,-0.6,0.2,0,-0.4,-0.2 +202,R_139l5pMR4M1ByHb,67 - 73,American,Female,2,1,3,1,3,1,-3,3,-3,1,2,-1,2,0,3,0,2,2,1,-1,3,2,3,0,3,6,2,-3,3,-3,3,2,2,1,2,0,3,1,-2,1,0,1,-2,6,3,2,3,3,1,2,0,-1,2,-1,-2,5,3,0,2,0,3,1,-1,0,2,1,0,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,54,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,82,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,75,0,0,0,0,0.0625,0.25,0,0,0,0,0,0,0,0,0.2116,0,0,0.25,0.01,0,0.0324,0.25,0.0625,1,0.0081,0.0016,0.0625,0,0,1,0,1,0.150042857,0.055292857,0.244792857,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,15,93.75,12,75,90.25,80.75,81.5,100,98.75,89.75,90.75,3.12,5.87,-6.75,-6,25,11.25,-4,15.75,1,1,0,1,0,1,0,0,0,2,0,2,0,0,0,2,1,2,0,1,1,1,0,2,2,1,2,1,2,3,1,1,0,0,0,1,2,0,0,1,0.6,0.6,0.4,1.2,1.2,1.8,0.4,0.8,0.7,1.05,3,2.67,4,-3,0,4,0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,69,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,-2,0,-2,-1,-2,-1,-1,1,0,0,0,1,-1,2,0,0,-0.6,-1.2,0,0.4,-0.35 +203,R_5Ebv5xofP7yfolg,67 - 73,Canadian,Female,1,3,1,-1,3,1,-1,2,-2,1,3,1,1,1,3,2,2,2,2,2,0,3,0,-1,3,2,1,-2,-2,-1,1,2,3,2,2,1,3,2,2,2,1,2,2,2,2,2,2,0,2,2,1,-1,0,-1,1,2,3,3,2,1,2,2,2,1,2,2,2,2,TRUE,0,81,FALSE,0,66,TRUE,0,100,FALSE,1,76,TRUE,1,66,TRUE,0,59,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,FALSE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,68,TRUE,1,95,TRUE,0,71,TRUE,0,89,TRUE,0,72,TRUE,0,71,FALSE,0,93,FALSE,0,72,FALSE,1,64,TRUE,1,67,TRUE,0,100,TRUE,1,63,FALSE,1,65,FALSE,1,90,TRUE,0,85,TRUE,1,100,FALSE,0,98,TRUE,1,100,0,0.1369,0.0025,0,0,0.3481,0.1089,0,0.5041,0.5184,0,0,0.0289,0.0256,0.1156,0.4356,0.1296,0.0576,0.01,1,0.8649,0.4624,0.5184,1,0.5041,0.1225,0.9604,0.6561,1,0.7921,0.7225,1,0.424492857,0.162314286,0.686671429,23,71.88,16,50,4,50,4,50,3,37.5,5,62.5,11,68.75,5,31.25,83.69,76.5,79.75,88.12,90.38,85.69,81.69,21.88,33.69,26.5,29.75,50.62,27.88,16.94,50.44,1,0,1,0,0,0,1,4,1,0,0,1,1,0,0,0,0,1,0,0,1,1,1,1,1,0,0,2,1,0,0,2,1,0,1,0,1,0,0,0,0.4,1.2,0.4,0.2,1,0.6,0.8,0.2,0.55,0.65,2,2,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,-1,0,-1,-1,0,1,2,0,0,0,-1,0,0,-1,0,-1,1,0,0,-0.6,0.6,-0.4,0,-0.1 +204,R_5C8AFC3Hsg4XcR3,39 - 45,American,Male,2,3,2,-3,1,0,-3,3,-3,1,2,-2,3,-3,3,3,2,2,3,0,2,3,3,0,1,7,0,-3,3,-3,2,8,2,-2,3,-3,2,7,1,1,1,3,0,8,2,2,2,-2,2,7,1,-3,3,-3,2,6,2,-3,3,-3,3,6,3,2,3,3,0,7,TRUE,0,90,TRUE,1,90,TRUE,0,80,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,55,FALSE,1,55,FALSE,1,70,TRUE,1,70,TRUE,0,100,TRUE,1,90,TRUE,1,100,TRUE,0,70,TRUE,0,70,TRUE,0,80,FALSE,1,60,TRUE,1,60,TRUE,1,90,TRUE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,90,TRUE,0,70,TRUE,0,100,TRUE,1,85,FALSE,0,75,TRUE,1,100,0,0,0,0,0,0,0,0.2025,0.16,0.01,0.0225,0.09,0.2025,0.2025,0,0.01,0.49,0.04,0.49,0,0.16,0.01,0.64,1,0.49,0.81,0.5625,0.81,0.64,0.49,1,0.09,0.307946429,0.102142857,0.51375,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,15,93.75,6,37.5,82.97,76.88,83.75,88.12,83.12,85.62,80.31,-3.13,17.34,14.38,21.25,25.62,8.12,-8.13,42.81,0,0,1,3,0,0,0,0,0,1,0,0,0,0,1,2,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0.8,0.2,0.2,0.8,0.6,0.4,0.2,0.2,0.5,0.35,7.33,6.33,0,2,1,1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),43,1.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,-1,1,2,-1,-1,0,0,0,0,0,-1,0,0,1,2,1,0,0,0,0.2,-0.2,0,0.6,0.15 +205,R_3Flzy7YelLpRL66,32 - 38,American,Female,3,1,-1,1,1,-3,2,2,3,1,2,-1,3,0,3,1,-1,0,0,0,3,1,0,2,-1,3,-3,2,3,2,0,2,3,-1,3,0,3,3,-2,-2,-2,-2,-2,5,3,1,-1,2,2,5,-3,2,3,3,1,3,3,-1,3,0,3,4,0,0,0,1,1,6,TRUE,0,53,TRUE,1,54,TRUE,0,72,FALSE,1,52,TRUE,1,53,FALSE,1,63,TRUE,1,87,TRUE,1,100,TRUE,1,56,TRUE,1,92,FALSE,1,100,TRUE,0,54,TRUE,1,78,FALSE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,50,TRUE,0,99,TRUE,0,54,FALSE,1,50,TRUE,1,89,TRUE,1,100,FALSE,1,74,TRUE,1,75,FALSE,1,94,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,61,TRUE,1,50,TRUE,1,88,0,0,0,0.0169,0.0144,0.1369,0.0625,0.0064,0.25,0,0.1521,0.0484,0.1936,0,0.2209,0.2116,0.0676,0.2304,0.25,0.0036,0.0121,0.2704,0.2916,0,0.25,0.25,0.25,0.2809,0.5184,0.9801,0.25,0.2916,0.196196429,0.113914286,0.278478571,16,50,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,71.88,58.5,68.12,90.62,70.25,77.19,66.56,-28.13,-6.25,-16.5,-19.38,15.62,-4.75,-16.56,4.06,0,0,1,1,2,0,0,1,1,1,1,0,0,0,0,3,1,2,2,2,0,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0.8,0.6,0.2,2,0.4,0.2,0.2,0.8,0.9,0.4,2.67,4,-2,-1,-1,-1,-1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,38,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,2,0,2,1,1,0.4,0.4,0,1.2,0.5 +206,R_7DBVC3WDgttHfaH,46 - 52,Canadian,Male,3,3,3,3,3,1,-1,3,-2,1,3,1,3,-2,3,0,0,3,-2,2,3,3,3,3,3,8,1,-2,1,-1,0,7,3,1,3,-1,3,7,-1,-1,-1,-1,-1,7,3,3,3,3,3,7,1,-3,3,-3,0,7,3,1,3,-3,3,6,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,85,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,1,87,FALSE,1,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0225,0,0,0.01,0,0,0,0,0.6561,0,0,0.0169,0,0.04,0,0,0,0,1,0,0,0.3249,1,0,0,1,0,0,0,0,1,1,0.215639286,0.050928571,0.38035,25,78.13,25,78.13,5,62.5,7,87.5,8,100,5,62.5,15,93.75,10,62.5,96.25,92.12,98.38,98.75,95.75,94.94,97.56,0,18.12,29.62,10.88,-1.25,33.25,1.19,35.06,0,0,0,0,0,0,1,2,1,1,0,0,0,1,0,1,1,4,1,3,0,0,0,0,0,0,2,0,1,1,0,0,0,1,0,3,3,0,5,1,0,1,0.2,2,0,0.8,0.2,2.4,0.8,0.85,7.33,6.67,1,0,1,2,0.66,10 cents,100 minutes,24 days,Male,High School (or equivalent),52,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,-1,2,0,0,0,0,0,0,0,-2,-2,4,-4,2,0,0.2,0,-0.4,-0.05 +207,R_3zhmgRSyA5EFlvz,67 - 73,American,Male,3,2,3,3,0,-1,1,2,1,0,2,2,2,-1,1,-2,-2,-2,0,-3,3,2,3,2,2,7,0,0,2,0,0,6,1,2,2,0,0,5,-2,0,-1,0,-3,8,3,3,3,3,0,5,-1,0,0,0,0,5,1,1,1,-1,0,5,-1,0,0,0,-3,7,TRUE,0,88,TRUE,1,99,FALSE,1,84,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,98,TRUE,1,96,FALSE,1,78,TRUE,0,50,FALSE,0,75,FALSE,1,76,FALSE,0,64,TRUE,1,100,FALSE,1,98,TRUE,0,96,TRUE,0,84,FALSE,1,100,FALSE,0,50,TRUE,1,96,TRUE,0,96,TRUE,1,100,TRUE,0,89,TRUE,1,99,TRUE,0,94,FALSE,1,71,FALSE,1,77,TRUE,1,100,TRUE,1,95,TRUE,1,100,0,0.0001,0,0.0001,0,0,0,0.0016,0,0.0016,0,0.5625,0.0004,0.0484,0.0025,0.0001,0.9216,0.25,0.0841,0.7921,0.25,0.4096,0.7056,0.0576,0.0004,0.8836,0.0025,0.7744,0.0256,0.9216,0.0529,0.25,0.249953571,0.127764286,0.372142857,27,84.38,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,13,81.25,9,56.25,87.41,82.75,86.38,92.38,88.12,91.62,83.19,15.63,18.66,20.25,23.88,29.88,0.62,10.37,26.94,0,0,0,1,2,1,1,0,1,0,1,0,0,1,1,0,2,1,0,0,0,1,0,0,0,0,1,2,1,0,1,1,1,0,1,1,2,2,0,0,0.6,0.6,0.6,0.6,0.2,0.8,0.8,1,0.6,0.7,6,5,2,1,0,1,1,5 cents,5 minutes,47 days,Male,Trade School (non-military),70,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,-1,0,1,2,1,0,-2,0,0,0,-1,-1,1,0,-1,0,-1,0,0,0.4,-0.2,-0.2,-0.4,-0.1 +208,R_6rGTb1zXAhIJ1wH,32 - 38,American,Female,3,3,3,-2,-1,-2,0,1,0,-2,2,-2,2,-2,2,-2,-1,-1,-1,-3,3,3,2,-1,-1,2,-2,1,1,0,-2,3,2,-2,2,-2,2,4,-2,-1,-1,-1,-3,2,3,3,2,0,-1,1,-2,0,1,0,-2,2,2,-2,2,-2,2,4,-1,0,0,0,-3,5,FALSE,1,50,FALSE,0,50,FALSE,1,73,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,55,TRUE,1,65,FALSE,0,50,FALSE,0,60,TRUE,0,50,TRUE,0,80,FALSE,0,65,TRUE,0,55,TRUE,1,50,TRUE,1,59,TRUE,0,50,TRUE,0,74,FALSE,1,55,FALSE,1,50,TRUE,1,65,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,65,FALSE,0,50,TRUE,1,55,0.1225,0.25,0.1681,0.2025,0.2025,0.25,0.25,0.36,0.25,0.25,0.1225,0.4225,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.1225,0.25,0.2025,0.3025,0.25,0.25,0.25,0.25,0.0729,0.5476,0.25,0.64,0.258767857,0.239821429,0.277714286,3,9.38,19,59.38,3,37.5,5,62.5,4,50,7,87.5,11,68.75,8,50,57.06,50.62,60.62,55.5,61.5,55.56,58.56,-50,-2.32,13.12,-1.88,5.5,-26,-13.19,8.56,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0.4,0.2,0,0,0.6,0,0,0.8,0.15,0.35,3,2.33,1,1,0,-3,0.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),36,0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,-1,-1,-1,-1,0,-0.2,0.2,0,-0.8,-0.2 +209,R_3FeZQo6wCs3ezdv,46 - 52,American,Female,-1,-1,1,2,-1,-2,1,1,1,-1,1,2,2,-1,2,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,6,-1,-1,-1,-1,-1,5,1,1,1,1,1,8,-1,-1,-1,-1,-1,5,-1,-1,-1,0,-1,5,-1,-1,-1,-1,-1,5,-1,-1,-1,-1,-1,5,-1,-1,-1,-1,-1,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,70,FALSE,1,81,FALSE,1,85,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.25,0,0.0361,1,0,0.25,0,1,1,0.49,0,1,0,0,0.0225,1,0.251735714,0.089285714,0.414185714,27,84.38,24,75,6,75,6,75,5,62.5,7,87.5,16,100,8,50,94.88,90,91.88,100,97.62,96.88,92.88,9.38,19.88,15,16.88,37.5,10.12,-3.12,42.88,0,0,2,3,0,1,2,2,2,0,0,1,1,2,1,0,0,1,0,0,0,0,2,2,0,1,2,2,2,0,2,3,3,0,3,0,0,1,0,0,1,1.4,1,0.2,0.8,1.4,2.2,0.2,0.9,1.15,6.33,5,1,0,3,0,1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,1,0,0,0,0,0,0,-2,-2,-2,2,-2,0,0,0,0,0,0.2,0,-1.2,0,-0.25 +210,R_31QKekQaep1x2GI,60 - 66,American,Female,2,3,1,1,-2,-1,-2,2,-3,1,3,3,1,-2,2,1,-1,-1,3,-1,3,3,2,1,-2,0,-2,-3,3,-3,1,2,3,3,1,-2,1,0,3,2,3,3,3,7,3,3,2,3,-1,1,1,-3,1,-3,1,1,3,3,1,-2,1,1,-1,-1,-1,-1,-1,1,TRUE,0,67,TRUE,1,98,FALSE,1,100,FALSE,1,61,TRUE,1,61,FALSE,1,99,TRUE,1,89,TRUE,1,99,TRUE,1,89,TRUE,1,94,FALSE,1,66,TRUE,0,99,FALSE,0,100,TRUE,0,98,FALSE,0,73,TRUE,1,69,TRUE,0,82,TRUE,0,100,TRUE,0,90,FALSE,1,85,TRUE,1,89,TRUE,1,80,FALSE,1,66,TRUE,1,64,FALSE,1,94,TRUE,1,85,TRUE,0,88,FALSE,1,92,TRUE,0,95,FALSE,0,87,FALSE,0,89,TRUE,1,100,0.0001,0.0225,0.0961,0.0121,0,0.0001,0.1296,0.0036,0.0225,0.04,0.7569,1,0.0121,0.1156,0.1521,0.0004,0.1156,0.1521,0.0064,0.0036,0.0121,0.5329,0.81,0.9604,0.6724,0.7744,0.7921,0.4489,0,1,0.9025,0.9801,0.3713,0.178614286,0.563985714,26,81.25,20,62.5,4,50,5,62.5,5,62.5,6,75,12,75,8,50,85.88,81.75,86.5,88.38,86.88,85.38,86.38,18.75,23.38,31.75,24,25.88,11.88,10.38,36.38,1,0,1,0,0,1,1,1,0,0,0,0,0,0,1,2,3,4,0,4,1,0,1,2,1,2,1,1,0,0,0,0,0,0,1,2,0,0,4,0,0.4,0.6,0.2,2.6,1,0.8,0.2,1.2,0.95,0.8,0.67,1,-1,1,-1,6,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,3,4,-4,4,-0.6,-0.2,0,1.4,0.15 +211,R_7xLsJucwczP9rR6,46 - 52,American,Female,1,1,1,1,1,2,-1,2,-1,0,2,2,1,0,2,0,-1,1,1,-1,2,2,2,2,2,1,2,-2,1,-2,2,1,2,2,2,0,2,1,0,0,0,0,0,5,2,2,2,2,2,1,0,-2,2,-2,2,1,2,2,0,0,2,1,2,2,2,2,2,1,TRUE,0,100,TRUE,1,59,TRUE,0,58,FALSE,1,66,TRUE,1,72,FALSE,1,100,TRUE,1,81,TRUE,1,86,TRUE,1,80,TRUE,1,65,FALSE,1,70,TRUE,0,100,TRUE,1,70,TRUE,0,71,TRUE,1,70,TRUE,1,76,TRUE,0,78,TRUE,0,68,FALSE,1,78,FALSE,1,72,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,75,FALSE,1,75,TRUE,1,76,FALSE,1,77,TRUE,0,78,TRUE,0,75,TRUE,1,81,FALSE,0,50,TRUE,1,75,0.0196,0.0576,0.0576,0.0361,0.0625,0,0.5625,0.1225,0.0784,0.25,0.0361,0.09,0.04,0.09,0.0784,0.1681,0.25,0.1156,0.6084,0.0625,0.25,0.09,0.0484,0.5041,0.6084,0.0529,0.25,1,0.3364,0.4624,0.5625,1,0.277860714,0.138864286,0.416857143,9,28.13,20,62.5,7,87.5,5,62.5,4,50,4,50,12,75,8,50,72.88,68.75,71.25,73.25,78.25,69.75,76,-34.37,10.38,-18.75,8.75,23.25,28.25,-5.25,26,1,1,1,1,1,0,1,1,1,2,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,2,1,0,1,2,0,0,1,0,0,2,3,1,1,3,1,1,0.2,0.8,1,1.2,0.2,2,0.75,1.1,1,1,0,0,0,4,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,-0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,-2,0,1,0,0,0,0,0,0,0,-2,-2,0,0,-2,0,-0.2,0,-1.2,-0.35 +212,R_3jD4zQ9K1au3W7Z,25 - 31,Canadian,Female,3,3,0,2,2,2,-1,3,-1,2,2,-3,3,1,2,2,3,2,3,1,3,3,2,-1,3,3,3,1,3,1,3,3,3,1,2,3,-1,4,-3,1,0,-3,-2,2,3,3,-1,1,2,2,1,-2,3,0,2,0,2,-3,3,-1,3,1,2,1,2,3,3,1,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,0,66,TRUE,0,83,TRUE,1,75,FALSE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,95,TRUE,0,100,FALSE,1,63,FALSE,1,77,FALSE,0,81,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,85,FALSE,1,75,FALSE,1,50,TRUE,0,70,TRUE,1,100,TRUE,1,72,TRUE,1,94,0,0.0225,0,0.0009,0.0036,0,0,0.0016,0.0529,0,0,0.0625,0,0.4356,0,0.25,0,0.25,0.25,0,0.6561,0.1156,0.1369,0,0.0025,0.0625,0.0784,0,0,1,0.49,0.6889,0.162039286,0.075442857,0.248635714,28,87.5,27,84.38,7,87.5,6,75,7,87.5,7,87.5,15,93.75,12,75,85.78,67.75,89.38,97.25,88.75,88.5,83.06,3.12,1.4,-19.75,14.38,9.75,1.25,-5.25,8.06,0,0,2,3,1,1,2,0,2,1,1,4,1,2,3,5,2,2,6,3,0,0,1,1,0,1,1,0,1,0,0,0,0,2,1,0,2,0,0,2,1.2,1.2,2.2,3.6,0.4,0.6,0.6,0.8,2.05,0.6,3.33,1,1,3,3,1,2.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,1,2,1,0,1,0,1,1,1,4,1,0,2,5,0,2,6,1,0.8,0.6,1.6,2.8,1.45 +213,R_7dT7VMMXH4xfwLX,67 - 73,American,Male,3,2,1,1,0,0,-3,2,-2,1,0,0,2,-2,2,-3,-3,-2,-2,-2,3,2,2,1,0,1,1,-3,1,-3,2,1,1,-2,2,-1,2,1,-3,-3,-3,-3,-3,5,3,2,2,1,0,1,0,-3,2,-3,1,2,0,-1,2,0,2,1,-2,-2,-2,-2,-2,1,FALSE,1,99,TRUE,1,100,TRUE,0,85,FALSE,1,54,TRUE,1,100,FALSE,1,84,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,97,FALSE,1,65,FALSE,1,100,FALSE,0,89,TRUE,0,86,FALSE,0,73,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,84,FALSE,1,100,TRUE,1,100,FALSE,1,91,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,68,TRUE,1,63,0,0,0,0,0.1369,0.0256,0.0256,0.0009,0,0,0,0.7921,0,0.1225,0,0,0,0.2116,0,0,0,0.5329,0.0225,0.7396,0.0036,0.0081,0.1024,0.0001,0.7225,1,0.0484,0,0.160546429,0.093942857,0.22715,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,90.47,79.5,88.5,97.75,96.12,92.12,88.81,3.12,6.09,-8,1,22.75,8.62,4.62,7.56,0,0,1,0,0,1,0,1,1,1,1,2,0,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,1,0,2,0,1,1,0,0,0,0.2,0.8,0.8,0.6,0.2,0.2,0.6,0.4,0.6,0.35,1,1.33,0,-1,0,4,-0.33,5 cents,5 minutes,47 days,Male,High School (or equivalent),67,1.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,1,0,1,0,1,1,1,0,-1,0,-1,-1,1,1,1,0,0.6,0.2,0.2,0.25 +214,R_3dH0X8NfSZ719Wz,60 - 66,American,Female,-1,2,1,-3,3,-1,1,2,1,0,1,3,2,-2,1,-2,-3,-2,-1,-2,0,3,1,-3,1,8,2,-1,3,-2,1,7,1,3,2,1,1,7,1,0,0,1,0,7,-2,2,2,0,2,3,-3,1,1,1,-1,3,2,2,0,-2,1,4,-2,-3,-2,-2,-2,4,TRUE,0,97,TRUE,1,81,FALSE,1,76,FALSE,1,61,FALSE,0,61,FALSE,1,59,TRUE,1,92,TRUE,1,90,FALSE,0,54,TRUE,1,97,TRUE,0,62,TRUE,0,89,TRUE,1,73,TRUE,0,88,FALSE,0,68,FALSE,0,81,TRUE,0,71,TRUE,0,92,FALSE,1,52,FALSE,1,66,FALSE,0,92,FALSE,0,54,FALSE,1,53,FALSE,0,61,FALSE,1,82,TRUE,1,92,FALSE,1,61,FALSE,1,81,FALSE,1,62,TRUE,1,83,FALSE,0,81,TRUE,1,99,0.01,0.0064,0.6561,0.0064,0.0001,0.1681,0.3721,0.0009,0.1156,0.2916,0.0289,0.0729,0.2916,0.3844,0.3721,0.0361,0.2209,0.1521,0.0361,0.0324,0.8464,0.4624,0.2304,0.7744,0.5041,0.1521,0.6561,0.9409,0.0576,0.8464,0.1444,0.7921,0.320828571,0.1791,0.462557143,20,62.5,18,56.25,4,50,5,62.5,4,50,5,62.5,8,50,10,62.5,75.34,65,71.25,86.75,78.38,78.69,72,6.25,19.09,15,8.75,36.75,15.88,28.69,9.5,1,1,0,0,2,3,2,1,3,1,0,0,0,3,0,3,3,2,2,2,1,0,1,3,1,2,0,1,0,1,1,1,2,0,0,0,0,0,1,0,0.8,2,0.6,2.4,1.2,0.8,0.8,0.2,1.45,0.75,7.33,3.33,5,4,3,3,4,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,61,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,1,-1,-3,1,1,2,0,3,0,-1,-1,-2,3,0,3,3,2,1,2,-0.4,1.2,-0.2,2.2,0.7 +215,R_74oY4mzWeayvNRg,67 - 73,American,Female,3,3,1,1,3,-2,-3,3,-2,1,2,-3,3,-2,3,3,3,3,3,-2,3,3,1,-2,3,4,-3,-3,3,-1,1,2,-2,-2,3,-3,3,3,1,1,-1,-2,2,3,3,3,2,3,2,1,-3,-3,1,-1,1,7,-2,-3,3,-3,3,2,3,2,3,3,0,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,89,FALSE,0,100,TRUE,1,50,TRUE,0,61,TRUE,1,79,TRUE,0,77,TRUE,1,71,FALSE,1,50,FALSE,1,76,TRUE,0,50,TRUE,1,60,TRUE,1,50,TRUE,1,100,0,0.0841,0,0.0625,0,0,0.0441,0.0576,0.0121,0.25,0.16,0,0.25,0.25,0,0,0.3721,0.25,0.0576,0.5929,1,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,0.25,1,0.323085714,0.117564286,0.528607143,26,81.25,18,56.25,4,50,4,50,4,50,6,75,14,87.5,4,25,75.44,56.25,82.62,74.88,88,78.81,72.06,25,19.19,6.25,32.62,24.88,13,-8.69,47.06,0,0,0,3,0,1,0,0,1,0,4,1,0,1,0,2,2,4,5,4,0,0,1,2,1,1,0,2,1,0,4,0,0,1,0,0,1,0,0,2,0.6,0.4,1.2,3.4,0.8,0.8,1,0.6,1.4,0.8,3,3.33,3,-5,1,1,-0.33,10 cents,100 minutes,15 days,Female,High School (or equivalent),68,1,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,-1,1,-1,0,0,-2,0,0,0,1,0,0,0,2,1,4,5,2,-0.2,-0.4,0.2,2.8,0.6 +216,R_6uRm1ocr1AINFPr,53 - 59,Canadian,Female,3,2,3,2,-3,-3,-1,2,2,1,0,-3,2,-2,2,1,1,1,1,-3,2,1,2,2,1,6,-3,1,-1,1,-2,7,1,-1,-1,-2,2,7,1,0,1,0,0,7,2,2,2,3,-1,3,-2,-1,1,0,1,7,-2,-3,2,-2,3,4,0,-1,0,0,0,7,TRUE,0,92,TRUE,1,79,FALSE,1,98,TRUE,0,54,TRUE,1,87,FALSE,1,86,TRUE,1,92,TRUE,1,92,TRUE,1,77,TRUE,1,77,FALSE,1,73,TRUE,0,72,TRUE,1,82,TRUE,0,77,TRUE,1,64,TRUE,1,91,TRUE,0,67,TRUE,0,86,TRUE,0,72,TRUE,0,70,FALSE,0,65,TRUE,1,77,TRUE,0,71,TRUE,1,83,FALSE,1,71,TRUE,1,80,TRUE,0,65,TRUE,0,77,TRUE,0,70,TRUE,1,91,TRUE,1,91,TRUE,1,69,0.0064,0.04,0.0081,0.0064,0.0961,0.0196,0.0289,0.0529,0.49,0.0529,0.0081,0.0324,0.0529,0.0729,0.0169,0.0441,0.5041,0.2916,0.5929,0.0841,0.4225,0.1296,0.5184,0.5929,0.4489,0.4225,0.0081,0.8464,0.0004,0.7396,0.49,0.5184,0.270646429,0.125957143,0.415335714,23,71.88,19,59.38,5,62.5,4,50,5,62.5,5,62.5,15,93.75,4,25,78.06,71.88,74.62,81.5,84.25,81.06,75.06,12.5,18.68,9.38,24.62,19,21.75,-12.69,50.06,1,1,1,0,4,0,2,3,1,3,1,2,3,0,0,0,1,0,1,3,1,0,1,1,2,1,0,1,2,0,2,0,0,0,1,1,2,1,1,3,1.4,1.8,1.2,1,1,0.8,0.6,1.6,1.35,1,6.67,4.67,3,0,3,0,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,58,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,1,0,-1,2,-1,2,2,-1,3,-1,2,3,0,-1,-1,-1,-1,0,0,0.4,1,0.6,-0.6,0.35 +217,R_6viaW1TKSDJLOgo,60 - 66,Canadian,Female,3,3,3,3,3,2,-2,1,-2,2,-2,-2,3,-2,3,2,2,2,2,3,3,3,3,3,3,1,3,-2,1,-1,3,0,-2,-2,2,-2,3,2,1,1,2,2,3,2,3,3,3,3,3,4,3,-2,1,-1,3,0,-2,-2,2,-2,3,1,1,1,1,3,1,2,TRUE,0,83,TRUE,1,100,FALSE,1,100,TRUE,0,54,TRUE,1,76,FALSE,1,100,TRUE,1,81,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,78,TRUE,0,96,FALSE,0,100,FALSE,1,83,FALSE,0,52,TRUE,1,82,FALSE,1,87,FALSE,1,97,TRUE,0,75,FALSE,1,100,FALSE,0,86,TRUE,1,70,FALSE,1,90,TRUE,1,79,FALSE,1,100,TRUE,1,96,TRUE,0,75,FALSE,1,86,TRUE,0,70,TRUE,1,92,FALSE,0,51,TRUE,1,100,0,0.0016,0.0324,0.0361,0,0,0.0441,0,0,0.09,0.0064,1,0.0625,0.0484,0.0576,0,0.01,0.2916,0.0196,0,0.7396,0.2704,0.5625,0.0289,0.0169,0.5625,0.2601,0.6889,0,0.0009,0.49,0.9216,0.220446429,0.115042857,0.32585,26,81.25,22,68.75,3,37.5,5,62.5,7,87.5,7,87.5,12,75,10,62.5,84.81,70,88.62,88.75,91.88,83.75,85.88,12.5,16.06,32.5,26.12,1.25,4.38,8.75,23.38,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,2,0,0.6,0.2,0.4,0,0.6,0.2,1.2,0.3,0.5,1,1.67,-3,0,1,0,-0.67,10 cents,100 minutes,15 days,Female,University - Graduate (Masters),63,0.875,0,0,0,1,1,0,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,-2,0,0,0,-0.8,-0.2 +218,R_310qWWe9FxZzRWc,60 - 66,American,Female,1,2,1,2,1,-3,-3,1,-3,-3,-1,-1,-1,-1,-1,1,1,1,1,1,1,0,1,1,1,7,1,0,1,1,1,5,1,1,0,1,1,6,1,0,1,1,1,5,0,0,1,0,1,7,0,0,1,0,-1,8,0,0,-1,0,0,7,0,1,1,1,1,6,TRUE,0,81,FALSE,0,85,TRUE,0,100,TRUE,0,53,TRUE,1,71,FALSE,1,62,FALSE,0,77,TRUE,1,61,TRUE,1,73,TRUE,1,96,TRUE,0,100,TRUE,0,100,FALSE,0,85,TRUE,0,100,FALSE,0,72,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,1,82,FALSE,1,94,FALSE,0,100,FALSE,0,96,TRUE,0,84,TRUE,1,100,TRUE,0,87,TRUE,1,85,FALSE,1,90,TRUE,0,90,TRUE,0,89,TRUE,1,100,TRUE,1,100,FALSE,0,84,0.1521,0.0225,0,0.5929,0.7056,0.1444,0,0.0016,0.0036,0.9216,0,0.7225,0.0729,1,0.0841,0.7225,0.7056,0.2809,0.81,0.7569,1,0.5184,0.0324,1,0.01,0.01,0,0.6561,1,1,0.7921,1,0.498257143,0.383235714,0.613278571,7,21.88,14,43.75,4,50,3,37.5,2,25,5,62.5,9,56.25,5,31.25,87.09,81.88,83.12,90.25,93.12,86.56,87.62,-21.87,43.34,31.88,45.62,65.25,30.62,30.31,56.37,0,2,0,1,0,4,3,0,4,4,2,2,1,2,2,0,1,0,0,0,1,2,0,2,0,3,3,0,3,2,1,1,0,1,1,1,0,0,0,0,0.6,3,1.8,0.2,1,2.2,0.8,0.2,1.4,1.05,6,7.33,0,-3,-1,-1,-1.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),60,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,-1,0,1,0,0,1,2,1,1,1,1,1,-1,1,0,0,0,-0.4,0.8,1,0,0.35 +219,R_3nMGogVXpl2Jq3x,25 - 31,American,Female,1,1,1,-2,1,-2,-2,2,-2,-2,1,1,2,0,1,1,0,1,1,0,0,0,0,-2,2,4,-1,-1,2,0,-1,5,0,0,0,0,0,5,0,0,1,0,0,4,2,2,2,0,1,2,-1,-1,2,0,0,3,1,1,0,0,0,2,1,0,1,0,0,5,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,60,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,76,TRUE,1,59,FALSE,1,50,TRUE,1,72,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,0,0.0784,0,0.16,0.25,0,0.1681,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.5776,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.285560714,0.213978571,0.357142857,10,31.25,21,65.63,4,50,5,62.5,6,75,6,75,8,50,13,81.25,63.03,50,65.75,66.5,69.88,65.06,61,-34.38,-2.6,0,3.25,-8.5,-5.12,15.06,-20.25,1,1,1,0,1,1,1,0,2,1,1,1,2,0,1,1,0,0,1,0,1,1,1,2,0,1,1,0,2,2,0,0,2,0,1,0,0,0,1,0,0.8,1,1,0.4,1,1.2,0.6,0.2,0.8,0.75,4.67,2.33,2,2,3,-1,2.34,10 cents,100 minutes,24 days,Female,Trade School (non-military),31,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-2,1,0,0,0,0,-1,1,1,0,0,0,1,0,0,0,0,-0.2,-0.2,0.4,0.2,0.05 +220,R_37at2W1uBdBvtUD,60 - 66,Canadian,Male,1,3,1,3,1,-1,-3,3,-3,1,1,1,2,-2,3,-2,0,1,3,2,1,3,1,0,3,2,-1,-3,3,-3,2,1,1,1,3,0,3,2,-2,0,-2,1,1,7,1,3,1,3,0,4,-3,-3,3,-2,1,3,1,1,2,-3,3,1,-2,-2,0,1,-1,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,95,TRUE,0,100,TRUE,1,100,TRUE,1,64,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0625,0,0,0.09,0,0.04,0,0.1225,0.25,0.9025,0,0,0.25,0,0,0,0.25,0.1296,1,1,0,1,0,0.182039286,0.040357143,0.323721429,29,90.63,26,81.25,6,75,7,87.5,7,87.5,6,75,15,93.75,11,68.75,90.59,73,93.12,96.88,99.38,89.94,91.25,9.38,9.34,-2,5.62,9.38,24.38,-3.81,22.5,0,0,0,3,2,0,0,0,0,1,0,0,1,2,0,0,0,3,2,1,0,0,0,0,1,2,0,0,1,0,0,0,0,1,0,0,2,1,2,3,1,0.2,0.6,1.2,0.2,0.6,0.2,1.6,0.75,0.65,1.67,2.67,-2,-2,1,2,-1,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,0.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,3,1,-2,0,0,-1,1,0,0,1,1,0,0,-2,2,0,-2,0.8,-0.4,0.4,-0.4,0.1 +221,R_7g6FXrNVvkYg5md,60 - 66,American,Female,0,2,2,0,0,-2,-1,1,-1,0,1,0,2,0,2,0,1,2,0,-1,0,2,2,0,0,5,-1,-1,1,-1,0,7,0,0,2,0,2,4,0,1,1,0,0,3,0,2,2,0,0,6,-1,-1,1,-1,0,7,0,0,2,0,2,3,0,0,1,0,0,6,TRUE,0,71,TRUE,1,89,FALSE,1,100,FALSE,1,51,TRUE,1,80,FALSE,1,100,TRUE,1,89,TRUE,1,93,TRUE,1,77,TRUE,1,55,FALSE,1,93,FALSE,1,88,TRUE,1,100,TRUE,0,65,TRUE,1,61,TRUE,1,100,FALSE,1,96,TRUE,0,92,FALSE,1,60,FALSE,1,100,FALSE,0,100,TRUE,1,83,FALSE,1,100,TRUE,1,86,FALSE,1,96,TRUE,1,90,TRUE,0,81,FALSE,1,95,TRUE,0,87,TRUE,1,96,TRUE,1,89,TRUE,1,100,0.0049,0.01,0,0.0121,0,0,0.0196,0.2025,0,0.0289,0.0016,0,0.0529,0.0049,0.04,0.0121,0,0.2401,0.0025,0.0016,1,0.1521,0.16,0.4225,0.0016,0.6561,0.0121,0.5041,0,0.8464,0.7569,0.0144,0.183317857,0.043042857,0.323592857,25,78.13,26,81.25,7,87.5,6,75,5,62.5,8,100,15,93.75,11,68.75,86.34,75.12,95.38,80.12,94.75,86.75,85.94,-3.12,5.09,-12.38,20.38,17.62,-5.25,-7,17.19,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0.2,0.2,0.4,0,0.2,0.2,0.6,0.2,0.25,5.33,5.33,-1,0,1,-3,0,10 cents,5 minutes,24 days,Female,Professional Degree (ex. JD/MD),62,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-0.2,-0.05 +222,R_3k0uiZGeVT6n0a1,46 - 52,American,Female,2,2,2,3,2,1,-1,1,-1,1,2,2,2,-1,2,1,0,1,1,0,2,2,2,2,2,6,2,-2,2,-2,2,7,2,2,2,2,2,6,1,-1,2,2,1,6,2,2,2,2,2,6,2,-2,2,-2,2,7,2,2,2,2,2,7,2,2,2,2,2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,79,TRUE,0,100,TRUE,1,99,TRUE,0,80,TRUE,1,86,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,79,FALSE,1,81,FALSE,0,100,TRUE,1,80,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,81,TRUE,0,79,TRUE,1,100,FALSE,0,85,TRUE,1,100,0,0,0,0,0,0,0,1,0.0361,0.04,0,0.0001,0,0.0441,0,0,0,0.0676,0.6561,0,1,0.0196,0.6241,0.64,0.81,0.25,0.7225,1,0,1,0.6241,1,0.340510714,0.08485,0.596171429,17,53.13,20,62.5,5,62.5,5,62.5,4,50,6,75,13,81.25,7,43.75,91.97,81.62,96,95,95.25,96.88,87.06,-9.37,29.47,19.12,33.5,45,20.25,15.63,43.31,0,0,0,1,0,1,1,1,1,1,0,0,0,3,0,0,1,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,0,3,0,1,2,1,1,2,0.2,1,0.6,0.8,0.2,1,0.6,1.4,0.65,0.8,6.33,6.67,0,0,-1,1,-0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,49,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,0,-1,0,0,0,-0.6,-0.15 +223,R_7ojPyhcZ9OXZ470,60 - 66,American,Female,2,0,2,2,-2,0,0,2,1,1,1,0,2,-2,2,1,0,1,1,1,1,1,1,-1,1,9,1,1,1,1,1,6,1,0,2,-2,2,5,0,-1,-1,1,2,8,1,0,2,2,-2,5,-1,0,0,2,0,6,1,0,2,-2,2,3,1,-1,1,2,2,2,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,75,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,TRUE,1,92,TRUE,0,100,TRUE,1,87,TRUE,1,100,TRUE,0,96,FALSE,1,93,FALSE,1,80,FALSE,1,64,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,95,TRUE,1,100,0,0,0,0,0,0,0,0,0.1296,0,0,0.0064,0.25,0.0081,0.25,0.0361,0,0.5625,0,1,1,0.0169,0.04,1,0.9216,0.0625,0.9025,0.25,0.25,0.0049,1,1,0.310396429,0.088764286,0.532028571,28,87.5,22,68.75,5,62.5,4,50,6,75,7,87.5,12,75,10,62.5,88.41,79.25,92.25,92.88,89.25,90.94,85.88,18.75,19.66,16.75,42.25,17.88,1.75,15.94,23.38,1,1,1,3,3,1,1,1,0,0,0,0,0,0,0,1,1,2,0,1,1,0,0,0,0,1,0,2,1,1,0,0,0,0,0,0,1,0,1,1,1.8,0.6,0,1,0.2,1,0,0.6,0.85,0.45,6.67,4.67,4,0,2,6,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,1,1,3,3,0,1,-1,-1,-1,0,0,0,0,0,1,0,2,-1,0,1.6,-0.4,0,0.4,0.4 +224,R_3XdEnFjaTRbjdzR,46 - 52,Canadian,Female,3,3,3,2,3,-2,-3,3,3,3,-1,1,3,1,3,-3,-2,-3,-3,-3,-3,-3,-3,-3,-3,8,-2,-2,3,3,3,8,1,1,3,-2,3,8,-2,-1,1,2,2,9,-3,-3,-3,-3,-3,10,-3,-3,-3,-3,-3,8,-3,-3,-3,-3,-3,3,-3,-3,-3,-3,-3,7,TRUE,0,82,TRUE,1,74,TRUE,0,81,TRUE,0,76,TRUE,1,87,TRUE,0,80,TRUE,1,86,TRUE,1,87,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,92,FALSE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,72,FALSE,1,90,FALSE,1,81,FALSE,1,85,FALSE,0,94,FALSE,0,83,FALSE,1,85,TRUE,1,100,FALSE,1,75,TRUE,1,79,FALSE,1,80,FALSE,1,91,TRUE,0,80,FALSE,0,89,TRUE,1,85,TRUE,1,100,0.0169,0.0441,0,0.0196,0,0.64,0,0,0.0225,0.6889,0.7921,0.8464,0.0081,0,0.0169,0.0676,0.0225,0.5776,0.0081,0.0625,0.8836,0.0081,0.0361,0,0.0784,0.04,0.0225,0.6724,0.6561,0.01,0.64,1,0.278585714,0.263042857,0.294128571,18,56.25,22,68.75,7,87.5,4,50,6,75,5,62.5,12,75,10,62.5,87.38,84.75,86.25,86.88,91.62,89.88,84.88,-12.5,18.63,-2.75,36.25,11.88,29.12,14.88,22.38,6,6,6,5,6,0,1,0,0,0,2,0,0,3,0,1,1,4,5,5,6,6,6,5,6,1,0,6,6,6,2,4,6,4,6,0,1,0,0,0,5.8,0.2,1,3.2,5.8,3.8,4.4,0.2,2.55,3.55,8,7,-2,0,5,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,51,1.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,-1,1,-6,-6,-6,0,-4,-6,-1,-6,1,0,4,5,5,0,-3.6,-3.4,3,-1 +225,R_3rCZdWPhxfYeoQI,60 - 66,American,Male,3,3,3,3,2,0,-2,2,1,1,1,3,3,2,3,-1,1,2,1,-2,3,3,3,2,2,6,0,-2,1,1,0,9,1,3,3,-1,3,1,-1,1,1,1,-2,5,3,3,3,3,3,1,0,-1,2,0,1,1,1,3,3,0,3,2,1,2,1,1,-2,1,TRUE,0,100,TRUE,1,100,FALSE,1,95,FALSE,1,50,TRUE,1,70,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,55,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,90,TRUE,1,50,TRUE,1,100,TRUE,0,65,TRUE,0,96,FALSE,1,70,FALSE,1,100,TRUE,1,65,TRUE,1,96,FALSE,1,75,TRUE,1,50,TRUE,0,80,FALSE,0,50,FALSE,1,60,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.25,0,0,0,0.0025,0.25,0.2025,0,0.0016,0,0,0.01,0.0025,0.09,0,0.0625,0.25,0.81,0.64,0.1225,0.25,0.09,0.81,0.4225,0.16,0.25,1,0.0025,0.9216,0.25,1,0.271453571,0.062257143,0.48065,24,75,24,75,8,100,7,87.5,3,37.5,6,75,15,93.75,9,56.25,80.84,70.62,77.5,83.38,91.88,79.75,81.94,0,5.84,-29.38,-10,45.88,16.88,-14,25.69,0,0,0,1,0,0,0,1,0,1,0,0,0,3,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,2,0,2,1,1,0,0,0.2,0.4,0.6,0.2,0.2,0.4,0.4,0.8,0.35,0.45,5.33,1.33,5,8,-1,4,4,10 cents,25 minutes,15 days,Male,University - Graduate (Masters),61,1.375,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,1,-1,0,-1,1,-1,1,0,0,0,1,0,-2,-1,0,0,0,0,0,0.2,-0.6,-0.1 +226,R_5rwEoL80JtdSsdX,60 - 66,American,Female,-2,3,2,-3,2,2,-1,2,1,0,3,2,2,2,3,-1,1,1,-1,-2,-2,3,0,-3,-1,4,2,-1,-1,1,-1,6,1,1,1,0,0,7,-2,0,-2,-2,-2,8,0,3,2,-2,2,2,2,-1,2,0,-1,2,3,2,3,-1,3,7,1,0,1,1,-2,4,TRUE,0,63,TRUE,1,75,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,59,TRUE,1,74,TRUE,1,59,FALSE,0,50,FALSE,0,60,FALSE,1,50,TRUE,0,86,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,76,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.1681,0,0.0576,0.0676,0,0.1681,0.25,0.36,0,0.25,0,0,0.25,0.25,0.25,0.0625,0,0.25,0,1,0.25,0.25,1,1,0.25,0.25,0.25,0.3969,0,0,1,0.7396,0.302753571,0.149328571,0.456178571,11,34.38,21,65.63,4,50,7,87.5,3,37.5,7,87.5,12,75,9,56.25,75.06,59.38,76.12,80.88,83.88,68.38,81.75,-31.25,9.43,9.38,-11.38,43.38,-3.62,-6.62,25.5,0,0,2,0,3,0,0,3,0,1,2,1,1,2,3,1,1,3,1,0,2,0,0,1,0,0,0,0,1,1,0,0,1,3,0,2,1,0,2,0,1,0.8,1.8,1.2,0.6,0.4,0.8,1,1.2,0.7,5.67,3.67,2,4,0,4,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,-2,0,2,-1,3,0,0,3,-1,0,2,1,0,-1,3,-1,0,3,-1,0,0.4,0.4,1,0.2,0.5 +227,R_6OVzbh3kj7EIBeq,53 - 59,Canadian,Female,3,0,0,1,3,-1,-1,2,-2,2,1,3,3,1,2,1,1,1,2,1,3,0,0,1,3,0,-1,-2,2,-2,2,0,2,2,3,2,2,1,1,1,1,1,1,1,3,0,0,1,3,1,-1,-2,2,-2,2,0,1,2,3,0,2,1,2,1,2,2,2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,92,FALSE,0,56,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,88,FALSE,1,75,TRUE,1,59,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,90,TRUE,1,97,TRUE,0,82,FALSE,1,70,FALSE,1,86,FALSE,0,81,FALSE,0,92,TRUE,1,100,0,0.0009,0,0,0,0,0,0,0.0625,0,0.6561,0,0,0,0.3136,0,0.04,0.0064,0.09,0.01,0.1681,0,0.7744,0,0.7569,0.6724,0.8464,0,1,1,0.0196,1,0.264871429,0.077042857,0.4527,28,87.5,23,71.88,5,62.5,6,75,7,87.5,5,62.5,13,81.25,10,62.5,91.72,94.25,83.5,98.38,90.75,92.81,90.62,15.62,19.84,31.75,8.5,10.88,28.25,11.56,28.12,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0.2,0.6,0.2,0,0.2,0.4,0.6,0.25,0.3,0.33,0.67,-1,0,0,0,-0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,-1,1,-1,0,0,0.2,-0.4,-0.05 +228,R_3CKv8BRmfzwHhXp,46 - 52,American,Female,3,3,3,3,1,0,2,1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,3,3,3,3,3,7,1,-2,1,-2,2,5,2,-1,1,-1,-2,6,2,2,2,2,2,4,3,3,3,3,2,5,-1,2,2,-2,1,6,2,2,2,-1,-1,5,2,2,2,2,2,5,FALSE,1,84,TRUE,1,87,TRUE,0,88,FALSE,1,62,TRUE,1,80,FALSE,1,55,TRUE,1,82,TRUE,1,87,TRUE,1,73,TRUE,1,80,FALSE,1,83,TRUE,0,78,TRUE,1,72,TRUE,0,80,TRUE,1,72,TRUE,1,86,TRUE,0,66,FALSE,1,59,TRUE,0,61,FALSE,1,58,FALSE,0,55,TRUE,1,65,FALSE,1,91,TRUE,1,89,TRUE,0,75,TRUE,1,90,TRUE,0,76,FALSE,1,100,TRUE,0,89,TRUE,1,87,FALSE,0,57,TRUE,1,95,0.0169,0.01,0.0196,0.0324,0.0025,0.2025,0.0121,0.04,0.1764,0.1225,0.0169,0.0784,0.0729,0.0289,0.04,0.0169,0.0081,0.1444,0,0.5625,0.3025,0.0784,0.3721,0.64,0.4356,0.5776,0.3249,0.0256,0.7744,0.1681,0.7921,0.6084,0.236596429,0.06875,0.404442857,16,50,22,68.75,5,62.5,5,62.5,6,75,6,75,14,87.5,8,50,76.94,71.38,75.38,76.88,84.12,78.56,75.31,-18.75,8.19,8.88,12.88,1.88,9.12,-8.94,25.31,0,0,0,0,2,1,4,0,3,1,1,2,0,2,1,3,3,1,3,1,0,0,0,0,1,1,0,1,3,0,1,1,1,2,0,3,3,1,3,1,0.4,1.8,1.2,2.2,0.2,1,1,2.2,1.4,1.1,6,5.33,2,-1,1,-1,0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),49,1.25,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,1,0,4,-1,0,1,0,1,-1,0,1,0,0,0,0,0,0.2,0.8,0.2,0,0.3 +229,R_3lnLirb7cmoNtqp,39 - 45,American,Female,3,2,1,-3,3,0,1,3,1,2,3,0,3,-2,3,-3,-3,-2,-2,0,0,2,1,-3,3,1,0,0,3,-1,2,7,3,0,3,-2,3,0,0,0,1,-2,0,7,3,2,1,-3,3,1,0,1,3,0,1,1,3,0,3,-3,3,1,0,0,0,0,0,3,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,0,50,TRUE,0,60,TRUE,0,75,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,0,70,FALSE,0,50,TRUE,0,70,TRUE,1,97,FALSE,1,50,TRUE,0,95,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,75,0,0.0009,0.0625,0,0.0625,0,0.25,0,0.25,0.25,0.0625,0,0.25,0,0.25,0.25,0.49,0.25,0.9025,0.49,0.0625,0.0625,0.5625,0.25,0.25,0.25,0.25,0.25,1,0.36,0.25,1,0.296607143,0.168928571,0.424285714,16,50,17,53.13,4,50,5,62.5,4,50,4,50,12,75,5,31.25,71.62,62.5,71.25,72.12,80.62,73.25,70,-3.13,18.49,12.5,8.75,22.12,30.62,-1.75,38.75,3,0,0,0,0,0,1,0,2,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,3,3,2,2,0,0.6,0.6,0,1.8,0,0.4,0.2,2,0.75,0.65,2.67,1,0,6,-1,4,1.67,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),39,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,02REV,3,0,0,0,0,0,1,0,1,-1,0,0,0,-1,0,0,0,1,-2,0,0.6,0.2,-0.2,-0.2,0.1 +230,R_54iwi18tDXM5uP4,46 - 52,Canadian,Male,2,3,3,3,1,-1,1,3,-1,1,2,2,2,1,2,-1,-1,1,1,-1,2,3,3,3,2,3,-2,-1,3,-1,1,2,3,3,3,2,3,2,1,1,1,1,-1,3,1,3,3,3,1,2,-1,1,3,0,1,2,3,3,3,-1,3,3,1,1,1,1,-1,3,TRUE,0,64,FALSE,0,63,TRUE,0,65,FALSE,1,61,FALSE,0,71,FALSE,1,100,TRUE,1,86,FALSE,0,55,FALSE,0,59,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,1,65,FALSE,1,54,FALSE,0,61,FALSE,0,59,TRUE,0,78,TRUE,0,64,FALSE,1,71,FALSE,1,65,FALSE,0,62,FALSE,0,63,FALSE,1,58,FALSE,0,54,TRUE,0,68,TRUE,1,100,FALSE,1,56,TRUE,0,60,TRUE,0,55,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.3025,0,0.3481,0.0196,0,0,0.2916,0,0.1225,0.3969,0.01,0.1225,0.3481,0.49,0.5041,0.3969,0.1764,0.1521,0.36,0.4624,0.3844,0.3721,0.0841,0.2116,0.6084,0.1936,0.25,0.4096,0.4225,0.4096,0.3025,1,0.302925,0.215078571,0.390771429,13,40.63,13,40.63,3,37.5,4,50,4,50,2,25,6,37.5,7,43.75,69.59,61.38,73.62,74.88,68.5,71.12,68.06,0,28.96,23.88,23.62,24.88,43.5,33.62,24.31,0,0,0,0,1,1,2,0,0,0,1,1,1,1,1,2,2,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,2,1,2,2,0,0,0,0.2,0.6,1,0.8,0.2,0.2,1.2,0.8,0.65,0.6,2.33,2.33,1,0,-1,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,50,1,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,-1,0,0,0,1,1,2,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0.4,-0.2,0,0.05 +231,R_7GqQFm5zoFfvVSt,60 - 66,American,Female,0,2,1,-2,2,2,-2,2,-1,0,2,1,1,1,2,1,2,2,1,1,0,2,2,-2,2,4,1,-3,2,-3,1,2,2,1,2,-2,2,2,1,1,2,1,1,4,0,2,1,-1,2,8,-2,-2,2,-2,1,2,2,1,1,-2,2,3,1,1,1,1,1,8,TRUE,0,98,TRUE,1,93,TRUE,0,94,FALSE,1,94,TRUE,1,96,FALSE,1,97,TRUE,1,96,TRUE,1,95,TRUE,1,96,TRUE,1,97,FALSE,1,83,TRUE,0,96,FALSE,0,91,TRUE,0,96,FALSE,0,91,TRUE,1,96,FALSE,1,95,FALSE,1,96,FALSE,1,98,FALSE,1,96,TRUE,1,96,TRUE,1,96,TRUE,0,83,TRUE,1,96,TRUE,0,97,TRUE,1,97,FALSE,1,94,TRUE,0,94,TRUE,0,98,TRUE,1,96,TRUE,1,96,TRUE,1,98,0.0025,0.0009,0.0016,0.0016,0.0004,0.0009,0.0016,0.0009,0.0016,0.0016,0.0016,0.8281,0.0016,0.0289,0.0016,0.0049,0.6889,0.0036,0.8836,0.9409,0.0016,0.8281,0.0004,0.9216,0.0025,0.0036,0.0016,0.9604,0.8836,0.0016,0.9604,0.9216,0.317060714,0.111871429,0.52225,30,93.75,22,68.75,7,87.5,5,62.5,5,62.5,5,62.5,14,87.5,8,50,94.84,93.12,94.25,96.62,95.38,95.38,94.31,25,26.09,5.62,31.75,34.12,32.88,7.88,44.31,0,0,1,0,0,1,1,0,2,1,0,0,1,3,0,0,1,0,0,0,0,0,0,1,0,4,0,0,1,1,0,0,0,3,0,0,1,1,0,0,0.2,1,0.8,0.2,0.2,1.2,0.6,0.4,0.55,0.6,2.67,4.33,-4,0,-1,-4,-1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,0.625,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,1,-1,0,-3,1,0,1,0,0,0,1,0,0,0,0,-1,0,0,0,-0.2,0.2,-0.2,-0.05 +232,R_6zUDlbxSGcq66dq,60 - 66,American,Female,1,2,2,-3,3,0,-2,2,3,0,-1,-1,2,0,1,-2,-1,0,0,-3,3,1,2,-3,3,7,1,-2,1,-1,1,7,1,-2,3,3,3,7,-2,1,1,-2,-3,5,2,2,2,1,2,4,1,-2,1,-2,-1,2,0,-2,1,-2,1,2,2,2,2,1,-3,8,FALSE,1,77,TRUE,1,88,FALSE,1,100,FALSE,1,54,FALSE,0,56,FALSE,1,100,TRUE,1,62,TRUE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,90,TRUE,1,53,TRUE,1,89,FALSE,1,57,TRUE,0,100,TRUE,0,54,FALSE,1,66,TRUE,1,59,TRUE,1,55,FALSE,1,53,TRUE,1,95,FALSE,1,100,TRUE,1,84,TRUE,0,53,FALSE,1,100,TRUE,0,90,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0.0256,0.0121,0.1444,0,0,0.0025,0,0.1156,0.2025,0,0,0.2401,0,0.3136,0.0144,0.2209,0.2116,0,0,0.1681,0.2209,0.2916,0.81,0.1849,0.2809,0.2809,0.0529,0,1,0.81,1,0.229335714,0.094371429,0.3643,21,65.63,24,75,5,62.5,6,75,6,75,7,87.5,14,87.5,10,62.5,79.34,63.25,76.88,83.5,93.75,77.81,80.88,-9.37,4.34,0.75,1.88,8.5,6.25,-9.69,18.38,2,1,0,0,0,1,0,1,4,1,2,1,1,3,2,0,2,1,2,0,1,0,0,4,1,1,0,1,5,1,1,1,1,2,0,4,3,2,1,0,0.6,1.4,1.8,1,1.2,1.6,1,2,1.2,1.45,7,2.67,3,5,5,-3,4.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,63,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,1,0,-4,-1,0,0,0,-1,0,1,0,0,1,2,-4,-1,-1,1,0,-0.6,-0.2,0.8,-1,-0.25 +233,R_5VLj8wSI5Etrp3X,53 - 59,American,Female,3,1,1,-3,-2,0,-3,1,-2,1,1,1,2,-2,1,-2,-2,1,1,-2,3,2,1,-2,-2,1,1,-2,1,-2,1,1,1,1,1,-3,1,1,0,-1,1,-1,-2,2,3,2,2,-2,-2,1,1,-2,1,-2,1,1,1,1,1,-2,1,1,-1,0,0,0,-1,1,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,77,TRUE,1,100,FALSE,1,78,TRUE,1,92,TRUE,1,100,TRUE,1,96,TRUE,1,76,FALSE,1,70,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,99,TRUE,0,64,TRUE,0,100,TRUE,0,91,TRUE,0,50,TRUE,1,91,TRUE,1,96,FALSE,1,100,TRUE,1,92,FALSE,1,67,TRUE,1,90,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,0,0.01,0.0001,0.0064,0.0081,0.0484,0.0064,0.0576,0.25,0.0016,0,0,0.0016,0.09,0,0.01,0,0.5929,0,0.1089,0.0081,0.09,0.8281,1,0.4096,0.25,0,0,0,1,1,0.25,0.214689286,0.076185714,0.353192857,28,87.5,23,71.88,5,62.5,6,75,6,75,6,75,16,100,7,43.75,86.88,80.5,90.5,90.12,86.38,92.69,81.06,15.62,15,18,15.5,15.12,11.38,-7.31,37.31,0,1,0,1,0,1,1,0,0,0,0,0,1,1,0,2,1,0,2,0,0,1,1,1,0,1,1,0,0,0,0,0,1,0,0,1,2,1,1,1,0.4,0.4,0.4,1,0.6,0.4,0.2,1.2,0.55,0.6,1,1,0,0,0,1,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,57,0.625,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,1,-1,-1,1,-1,-0.2,0,0.2,-0.2,-0.05 +234,R_5j7L6CmlWnkapAw,46 - 52,Canadian,Female,2,1,2,1,0,-1,-2,0,-2,1,0,0,2,0,0,-2,-1,-1,-1,-1,2,2,2,1,2,10,-1,-2,0,-2,1,0,0,0,1,-1,-3,1,1,2,2,2,-1,10,2,1,2,2,0,0,-1,-1,0,-2,1,1,1,0,1,0,0,5,-1,-1,-1,-1,-1,0,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,93,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,1,1,0.8649,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0.209460714,0.276064286,0.142857143,30,93.75,26,81.25,5,62.5,7,87.5,7,87.5,7,87.5,11,68.75,15,93.75,99.78,100,99.12,100,100,99.56,100,12.5,18.53,37.5,11.62,12.5,12.5,30.81,6.25,0,1,0,0,2,0,0,0,0,0,0,0,1,1,3,3,3,3,3,0,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0.6,0,1,2.4,0.2,0.2,0.4,0.2,1,0.25,3.67,2,10,-1,-4,10,1.67,5 cents,5 minutes,47 days,Female,University - Undergraduate,50,0.75,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,1,0,-1,2,0,-1,0,0,0,-1,0,0,1,3,2,3,3,3,0,0.4,-0.2,0.6,2.2,0.75 +235,R_1VKMbZSA4ZQ4nRL,60 - 66,American,Female,0,-1,2,3,3,-3,2,2,2,3,-1,-1,2,-3,3,-2,-3,-2,-2,-1,2,0,1,1,2,3,-1,3,1,2,2,3,-2,-1,2,-3,3,2,-3,-3,-2,-2,-1,4,1,1,1,3,2,2,-2,2,2,2,2,2,-1,1,3,-2,3,4,-2,-2,-2,-3,-1,2,TRUE,0,93,TRUE,1,100,TRUE,0,99,FALSE,1,50,TRUE,1,89,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,76,TRUE,1,87,FALSE,1,99,TRUE,0,82,TRUE,1,95,TRUE,0,79,TRUE,1,61,TRUE,1,100,FALSE,1,91,TRUE,0,87,TRUE,0,91,FALSE,1,100,TRUE,1,80,TRUE,1,86,FALSE,1,100,TRUE,1,98,FALSE,1,100,TRUE,1,96,TRUE,0,92,FALSE,1,76,TRUE,0,91,TRUE,1,94,FALSE,0,80,TRUE,1,94,0,0.0016,0,0.0001,0.0036,0,0.0004,0.0169,0,0.0196,0.0036,0.0025,0.0576,0.0001,0.0121,0,0,0.25,0.0576,0,0.04,0.1521,0.8281,0.6241,0.0081,0.8464,0.64,0.8649,0.9801,0.7569,0.8281,0.6724,0.273757143,0.026171429,0.521342857,26,81.25,23,71.88,5,62.5,7,87.5,5,62.5,6,75,15,93.75,8,50,89.53,81.12,92.5,90.88,93.62,89.69,89.38,9.37,17.65,18.62,5,28.38,18.62,-4.06,39.38,2,1,1,2,1,2,1,1,0,1,1,0,0,0,0,1,0,0,0,0,1,2,1,0,1,1,0,0,0,1,0,2,1,1,0,0,1,0,1,0,1.4,1,0.2,0.2,1,0.4,0.8,0.4,0.7,0.65,2.67,2.67,1,1,-2,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,63,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,-1,0,2,0,1,1,1,0,0,1,-2,-1,-1,0,1,-1,0,-1,0,0.4,0.6,-0.6,-0.2,0.05 +236,R_5qfba3NnReh8vR9,67 - 73,Canadian,Female,3,3,1,-3,3,0,-2,3,-3,3,2,-2,3,-3,3,3,3,3,3,3,3,3,1,-3,3,0,1,-2,3,-2,3,1,2,-3,3,-3,3,1,1,1,1,1,1,3,3,3,1,-3,3,0,1,-3,3,-3,3,0,2,-2,3,-3,3,0,3,3,2,3,2,1,TRUE,0,100,TRUE,1,91,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,80,TRUE,0,50,TRUE,0,64,TRUE,1,72,TRUE,0,89,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,91,TRUE,0,77,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,92,TRUE,0,76,TRUE,1,93,TRUE,0,75,TRUE,0,82,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.0049,0,0,0,0.25,0.0064,0.64,0,0.25,0,0.0784,0.0081,0.25,0,0.0081,0,0.25,0.6724,0.5776,0.25,0.25,0.5929,0.7921,0.25,0.5625,1,1,1,0.8281,1,0.4096,0.390221429,0.124357143,0.656085714,25,78.13,16,50,4,50,5,62.5,2,25,5,62.5,12,75,4,25,81.97,73,77.75,84.88,92.25,85.56,78.38,28.13,31.97,23,15.25,59.88,29.75,10.56,53.38,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,2,2,2,2,2,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0.4,0.2,2,0,0.4,0,0.4,0.65,0.2,0.67,0,0,1,1,2,0.67,10 cents,100 minutes,47 days,Female,Trade School (non-military),72,1.625,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,-1,0,1,0,0,1,0,0,0,2,2,1,2,1,0,0,0.2,1.6,0.45 +237,R_5ds5A7mqBfTU6tT,53 - 59,American,Female,3,3,1,3,1,1,-2,2,-2,1,-1,-2,3,0,3,1,0,1,3,2,2,2,-1,0,2,1,1,-2,1,-2,3,1,-2,-2,3,-1,3,0,1,0,2,1,1,5,3,3,2,3,-2,1,0,-3,-1,-2,1,1,-2,-2,2,-2,3,1,-2,-1,1,1,0,6,FALSE,1,91,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,85,FALSE,1,76,FALSE,1,78,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,57,TRUE,0,97,FALSE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,96,TRUE,1,99,FALSE,1,100,TRUE,1,88,TRUE,0,79,FALSE,1,60,FALSE,1,96,TRUE,1,100,TRUE,1,69,FALSE,0,100,0,0.0144,0,0,1,0,0.0001,0.7225,0,0,0,0,0.0225,0.0576,0.0529,0,0.0016,0.25,0.16,0,0.0009,0.25,0,1,0.3249,0.6241,0.0961,0.0081,0,0.9409,0.0016,0.0484,0.19865,0.150514286,0.246785714,25,78.13,26,81.25,7,87.5,6,75,5,62.5,8,100,14,87.5,12,75,88.44,76.12,90.38,95.12,92.12,90.62,86.25,-3.12,7.19,-11.38,15.38,32.62,-7.88,3.12,11.25,1,1,2,3,1,0,0,1,0,2,1,0,0,1,0,0,0,1,2,1,0,0,1,0,3,1,1,3,0,0,1,0,1,2,0,3,1,0,2,2,1.6,0.6,0.4,0.8,0.8,1,0.8,1.6,0.85,1.05,0.67,1,0,0,-1,-1,-0.33,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,59,0.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,1,1,3,-2,-1,-1,-2,0,2,0,0,-1,-1,0,-3,-1,1,0,-1,0.8,-0.4,-0.4,-0.8,-0.2 +238,R_6o4LQv42EL708UR,60 - 66,Canadian,Male,1,3,2,-1,3,-2,1,1,1,1,1,1,1,1,1,0,1,-1,1,-1,2,3,2,-1,3,4,0,0,1,1,0,5,2,1,0,2,1,4,1,1,0,1,1,5,1,2,2,-1,3,4,-2,1,1,1,1,6,2,1,1,0,1,7,-1,-2,-1,-1,0,4,FALSE,1,100,FALSE,0,59,FALSE,1,62,FALSE,1,59,TRUE,1,57,TRUE,0,73,TRUE,1,61,TRUE,1,74,TRUE,1,100,FALSE,0,67,FALSE,1,59,TRUE,0,100,FALSE,0,100,FALSE,1,70,TRUE,1,62,TRUE,1,100,TRUE,0,100,FALSE,1,81,FALSE,1,100,TRUE,0,58,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,67,TRUE,0,56,TRUE,1,79,TRUE,0,100,FALSE,1,54,TRUE,0,55,TRUE,1,100,FALSE,0,100,FALSE,0,69,0.0676,0.0441,0,0.1521,0.4761,0.5329,0.1089,0.4489,0.3364,0,0,1,0,0.1681,0.1849,0.3481,0,0.1681,0.2116,0.3136,1,0.1444,0,0.09,1,1,1,0,0.1444,0.0361,0.3025,1,0.357678571,0.269457143,0.4459,15,46.88,19,59.38,5,62.5,2,25,6,75,6,75,10,62.5,9,56.25,78.81,79.88,81.75,76.75,76.88,80.94,76.69,-12.5,19.43,17.38,56.75,1.75,1.88,18.44,20.44,1,0,0,0,0,2,1,0,0,1,1,0,1,1,0,1,0,1,0,2,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,3,0,2,1,0.2,0.8,0.6,0.8,0.2,0,0.4,1.4,0.6,0.5,4.33,5.67,0,-1,-3,1,-1.34,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),62,0.25,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,1,-1,0,0,0,2,1,0,0,1,0,0,1,0,0,0,-3,1,-2,1,0,0.8,0.2,-0.6,0.1 +239,R_5wvQyrUh6tDd2Fw,67 - 73,American,Male,1,2,3,2,1,1,-1,2,-1,1,2,2,2,1,2,1,-1,1,-2,-2,1,2,1,0,1,3,2,-1,2,-2,0,3,2,2,2,0,2,3,1,1,-1,-1,0,3,1,2,2,1,1,3,1,-1,1,0,1,3,2,1,2,1,2,3,0,-1,0,0,-1,4,FALSE,1,62,TRUE,1,75,FALSE,1,100,FALSE,1,98,FALSE,0,80,FALSE,1,86,TRUE,1,85,TRUE,1,73,FALSE,0,78,FALSE,0,84,FALSE,1,96,TRUE,0,96,TRUE,1,92,FALSE,1,89,FALSE,0,73,TRUE,1,98,TRUE,0,83,TRUE,0,97,FALSE,1,88,FALSE,1,100,FALSE,0,71,FALSE,0,83,TRUE,0,81,TRUE,1,91,TRUE,0,89,TRUE,1,94,FALSE,1,89,FALSE,1,84,FALSE,1,87,TRUE,1,91,TRUE,1,97,TRUE,1,92,0.0729,0.0036,0.0004,0.0225,0.0064,0.0196,0.0081,0.7056,0,0.6889,0.0081,0.0064,0.6084,0.0016,0.64,0.0625,0.6561,0.0004,0.0256,0.7921,0.5041,0.5329,0.0144,0.0121,0.6889,0.0121,0.0009,0.1444,0,0.9409,0.0169,0.9216,0.286392857,0.243721429,0.329064286,24,75,21,65.63,6,75,4,50,4,50,7,87.5,10,62.5,11,68.75,86.94,86.75,84,85.38,91.62,84.81,89.06,9.37,21.31,11.75,34,35.38,4.12,22.31,20.31,0,0,2,2,0,1,0,0,1,1,0,0,0,1,0,0,2,2,1,2,0,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,2,1,0.8,0.6,0.2,1.4,0.4,0.4,0.2,1,0.75,0.5,3,3,0,0,0,-1,0,10 cents,75 minutes,24 days,Male,University - Undergraduate,68,0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,1,1,0,1,0,-1,0,1,0,-1,0,1,0,-1,2,1,-1,1,0.4,0.2,0,0.4,0.25 +240,R_7trHlNVY8Ujs9mp,53 - 59,American,Female,2,2,2,3,3,1,0,2,1,2,2,1,2,0,3,1,1,1,2,-3,1,2,2,3,3,8,2,1,0,0,1,9,-1,1,-1,1,-1,9,1,-1,-2,-2,-3,9,3,2,2,3,3,9,2,-1,2,1,2,9,3,2,3,-3,3,9,2,2,2,2,1,9,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,FALSE,0,75,FALSE,1,75,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,75,TRUE,0,75,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,75,TRUE,1,75,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,FALSE,1,75,TRUE,0,65,FALSE,0,100,FALSE,0,75,TRUE,1,100,1,0,0.0625,0,0,0.0625,0,0.0625,0,0,1,0,1,0.5625,0.5625,0,0.5625,0.0625,0.0625,0,0,0.0625,1,0.5625,1,0.0625,0.5625,0,0,1,0.4225,1,0.343214286,0.276785714,0.409642857,16,50,19,59.38,4,50,4,50,6,75,5,62.5,11,68.75,8,50,89.53,84.38,86.25,93.75,93.75,92.19,86.88,-9.38,30.15,34.38,36.25,18.75,31.25,23.44,36.88,1,0,0,0,0,1,1,2,1,1,3,0,3,1,4,0,2,3,4,0,1,0,0,0,0,1,1,0,0,0,1,1,1,3,0,1,1,1,0,4,0.2,1.2,2.2,1.8,0.2,0.4,1.2,1.4,1.35,0.8,8.67,9,-1,0,0,0,-0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),58,0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,2,1,1,2,-1,2,-2,4,-1,1,2,4,-4,0,0.8,1,0.4,0.55 +241,R_32WfQVSCfaI1ZCN,67 - 73,American,Male,2,2,2,2,2,-1,1,0,-1,-1,1,-1,2,0,2,-1,0,0,-1,-1,2,2,2,2,2,1,-1,1,1,0,-1,3,-1,-1,0,-1,2,2,-1,-1,-1,-1,-1,3,2,2,2,2,2,0,-1,1,1,0,-1,2,-1,-1,1,0,2,2,0,0,0,0,-1,2,TRUE,0,90,TRUE,1,95,FALSE,1,93,FALSE,1,89,TRUE,1,90,FALSE,1,86,TRUE,1,98,TRUE,1,96,TRUE,1,82,TRUE,1,85,FALSE,1,88,TRUE,0,90,FALSE,0,88,TRUE,0,90,TRUE,1,74,TRUE,1,100,FALSE,1,94,TRUE,0,97,TRUE,0,90,FALSE,1,100,FALSE,0,88,TRUE,1,94,FALSE,1,94,TRUE,1,92,FALSE,1,96,TRUE,1,94,FALSE,1,72,FALSE,1,84,TRUE,0,76,TRUE,1,100,FALSE,0,50,TRUE,1,99,0.0016,0.0036,0,0.0004,0.0001,0.0196,0.0064,0.0225,0,0.0036,0,0.7744,0.0324,0.0144,0.01,0.0025,0.0036,0.0121,0.0256,0.0016,0.7744,0.0676,0.81,0.81,0.0036,0.0784,0.25,0.81,0.0049,0.9409,0.5776,0.81,0.245221429,0.0644,0.426042857,26,81.25,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,89.19,80,89.38,93,94.38,89.06,89.31,9.37,17.31,5,26.88,30.5,6.88,7.81,26.81,0,0,0,0,0,0,0,1,1,0,2,0,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,2,0,1,0,0,1,0,0,1,0,0,0.4,1,0.4,0,0.4,0.6,0.4,0.45,0.35,2,1.33,1,1,0,1,0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,72,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,-1,1,1,-1,0,0,0,0.4,0,0.1 +242,R_7NyRGAJKCMGNlQ2,60 - 66,American,Male,2,3,0,0,2,-1,1,1,1,0,3,0,3,3,-3,-3,-3,-3,-3,-3,3,3,1,0,0,10,-2,1,1,1,0,10,3,0,3,3,-3,10,-3,-3,-3,-3,-3,10,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,96,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,91,FALSE,0,100,TRUE,1,74,TRUE,1,55,FALSE,1,100,TRUE,0,54,TRUE,1,100,TRUE,0,100,TRUE,1,66,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,81,FALSE,1,100,FALSE,0,50,TRUE,1,81,FALSE,1,50,TRUE,1,89,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,80,TRUE,1,57,TRUE,1,100,1,0,0,0.0081,0,0,0.0121,0.2025,0,0.0361,0.04,0,0.0676,0,0.25,0.0016,0.25,0.25,1,0.25,0.25,0.1156,0.6561,1,0,0,0.1849,0,0,1,1,0.2916,0.244932143,0.079278571,0.410585714,23,71.88,22,68.75,6,75,6,75,5,62.5,5,62.5,14,87.5,8,50,83.56,78,81.25,84.62,90.38,80.56,86.56,3.13,14.81,3,6.25,22.12,27.88,-6.94,36.56,1,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,0,0,2,1,1,1,1,0,3,0,3,3,3,3,3,3,3,3,0.8,0.2,0,0,1.4,0.8,2.4,3,0.25,1.9,10,5,5,5,5,5,5,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),61,1.375,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-1,-3,1,0,0,0,-1,-1,-1,0,-3,0,-3,-3,-3,-3,-3,-3,-3,-3,-0.6,-0.6,-2.4,-3,-1.65 +243,R_3RlbqGMWL80DcgM,53 - 59,Canadian,Female,3,2,2,1,3,-1,-1,2,1,2,2,0,3,-2,2,-2,-1,1,-1,-1,2,2,2,0,2,1,-1,-1,2,1,1,2,2,0,2,0,2,3,-1,-1,0,-1,-1,3,3,2,2,1,2,1,-1,0,2,0,1,1,2,0,3,-2,2,1,-1,-1,0,0,0,1,TRUE,0,100,TRUE,1,100,FALSE,1,58,FALSE,1,57,FALSE,0,57,FALSE,1,88,FALSE,0,75,TRUE,1,92,TRUE,1,73,TRUE,1,86,FALSE,1,56,TRUE,0,87,TRUE,1,93,TRUE,0,58,FALSE,0,55,TRUE,1,100,FALSE,1,91,TRUE,0,98,FALSE,1,59,FALSE,1,88,FALSE,0,59,TRUE,1,97,FALSE,1,100,TRUE,1,97,FALSE,1,99,TRUE,1,98,FALSE,1,55,FALSE,1,78,TRUE,0,95,TRUE,1,90,FALSE,0,60,TRUE,1,95,0.0064,0.0004,0,0.5625,0.0025,0.0144,0.0009,0.0196,0.0144,0.0009,0.01,0.0049,0.0729,0.1936,0.3249,0,0,0.1849,0.0484,0.0001,0.3481,0.3025,0.1681,0.3364,0.0081,0.2025,0.36,1,0.1764,0.9604,0.9025,0.7569,0.229082143,0.060278571,0.397885714,16,50,22,68.75,6,75,5,62.5,4,50,7,87.5,11,68.75,11,68.75,81.06,64.38,84.75,88.88,86.25,82.94,79.19,-18.75,12.31,-10.62,22.25,38.88,-1.25,14.19,10.44,1,0,0,1,1,0,0,0,0,1,0,0,1,2,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,1,1,1,0.6,0.2,0.6,0.4,0.2,0.6,0,0.8,0.45,0.4,2,1,0,1,2,2,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,55,0.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,1,0,0,1,0,0,-1,0,-1,0,0,0,1,2,0,0,0,0,-1,-1,0.4,-0.4,0.6,-0.4,0.05 +244,R_3NP9W6V4IxAnjR7,60 - 66,American,Female,3,3,-3,0,0,-3,-3,2,-3,1,2,-2,2,-2,2,1,1,2,0,-2,3,3,-3,0,1,0,-3,-3,1,-3,2,0,2,-2,2,-2,3,0,-1,-1,-1,0,-1,3,3,3,-3,0,-1,0,-3,-3,1,-3,1,0,1,-3,2,-3,3,0,0,0,0,0,-2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,75,FALSE,1,75,TRUE,1,75,TRUE,1,75,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0.09,0.0625,0.0625,0.0625,0.5625,0.25,0,0.25,0,0.0625,0,0,0.25,0.0625,1,0.099196429,0.010892857,0.1875,28,87.5,29,90.63,7,87.5,7,87.5,8,100,7,87.5,15,93.75,14,87.5,88.91,83.75,87.5,90.62,93.75,93.75,84.06,-3.13,-1.72,-3.75,0,-9.38,6.25,0,-3.44,0,0,0,0,1,0,0,1,0,1,0,0,0,0,1,2,2,3,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,1,1,1,1,2,0,0,0.2,0.4,0.2,1.6,0.2,0.2,0.8,0.8,0.6,0.5,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,66,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,1,-1,-1,0,-1,0,1,1,1,0,1,0,0.2,-0.6,0.8,0.1 +245,R_3sjJd1nWoml3n0t,67 - 73,Canadian,Female,3,3,3,1,3,3,0,3,0,3,2,-1,3,0,3,-2,-1,1,-1,0,3,3,3,3,3,2,3,-2,3,-1,2,2,2,3,3,3,3,4,0,-1,-1,-1,-1,9,3,3,3,3,3,6,3,-2,2,-1,3,6,2,-1,3,0,3,7,0,0,1,1,-1,6,FALSE,1,55,TRUE,1,100,FALSE,1,76,TRUE,0,57,TRUE,1,85,TRUE,0,62,TRUE,1,100,TRUE,1,100,TRUE,1,68,TRUE,1,100,TRUE,0,96,TRUE,0,66,TRUE,1,79,TRUE,0,100,FALSE,0,65,TRUE,1,100,TRUE,0,60,FALSE,1,64,TRUE,0,78,FALSE,1,88,FALSE,0,61,TRUE,1,100,FALSE,1,82,TRUE,1,100,TRUE,0,62,TRUE,1,100,TRUE,0,65,FALSE,1,100,TRUE,0,100,TRUE,1,85,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.3844,0,0,0.0144,0,0.0225,0.0441,0.1024,0.9216,0.0225,0,0.0324,0.3249,0,0.3844,0.3721,0.4225,0.6084,1,0.36,0.4225,0,0.2025,0.0576,0.1296,1,0.4356,0.259442857,0.133514286,0.385371429,17,53.13,20,62.5,3,37.5,4,50,6,75,7,87.5,14,87.5,6,37.5,82.94,78.62,78.62,85.12,89.38,90.19,75.69,-9.37,20.44,41.12,28.62,10.12,1.88,2.69,38.19,0,0,0,2,0,0,2,0,1,1,0,4,0,3,0,2,0,2,0,1,0,0,0,2,0,0,2,1,1,0,0,0,0,0,0,2,1,0,2,1,0.4,0.8,1.4,1,0.4,0.8,0,1.2,0.9,0.6,2.67,6.33,-4,-4,-3,3,-3.66,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,2,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,-1,0,1,0,4,0,3,0,0,-1,2,-2,0,0,0,1.4,-0.2,0.3 +246,R_3WDVJ4iJx1Pk9SF,60 - 66,Canadian,Female,2,2,2,2,-1,-3,1,1,1,0,3,2,3,0,3,-2,-2,-2,0,-3,3,3,3,0,-2,4,-3,0,2,1,-1,7,3,3,3,1,3,5,-1,-1,1,1,-2,6,2,2,2,3,-3,4,-3,1,1,1,0,4,3,1,2,-3,3,4,-1,-1,-1,-1,1,3,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,64,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,100,FALSE,1,79,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,67,FALSE,1,100,TRUE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,68,FALSE,1,97,FALSE,1,93,TRUE,1,100,TRUE,1,77,TRUE,1,100,0,0,0,0,0,0,0,1,0,0.0009,0,0,0.25,0.0441,0.1296,0,0,0.25,0.0009,0,0,0.25,0.4489,0,0,0.4624,0.0529,0.0009,0,1,0.0049,1,0.174839286,0.119614286,0.230064286,30,93.75,25,78.13,4,50,8,100,6,75,7,87.5,14,87.5,11,68.75,90.28,67.62,94.62,99.25,99.62,89.88,90.69,15.62,12.15,17.62,-5.38,24.25,12.12,2.38,21.94,1,1,1,2,1,0,1,1,0,1,0,1,0,1,0,1,1,3,1,1,0,0,0,1,2,0,0,0,0,0,0,1,1,3,0,1,1,1,1,4,1.2,0.6,0.4,1.4,0.6,0,1,1.6,0.9,0.8,5.33,4,0,3,1,3,1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,64,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,1,1,1,1,-1,0,1,1,0,1,0,0,-1,-2,0,0,0,2,0,-3,0.6,0.6,-0.6,-0.2,0.1 +247,R_7k16stDRcdmYSEP,67 - 73,American,Female,0,0,1,0,0,0,0,-1,1,-1,0,-1,1,0,2,-3,-2,-2,-2,-3,2,2,2,1,2,7,1,0,1,0,1,5,0,0,0,0,0,5,0,0,1,-1,0,7,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,-3,-2,-1,-1,-2,5,FALSE,1,58,TRUE,1,77,TRUE,0,80,TRUE,0,50,TRUE,1,96,FALSE,1,88,TRUE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,89,FALSE,1,50,TRUE,1,90,TRUE,0,95,TRUE,1,91,TRUE,1,100,FALSE,1,50,TRUE,0,68,TRUE,0,50,FALSE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,72,TRUE,1,53,TRUE,0,68,FALSE,1,60,TRUE,0,78,TRUE,1,100,TRUE,1,67,TRUE,1,87,0,0.2209,0,0.0016,0.0169,0.0144,0,0.01,0.0025,0,0,0.01,0,0.0121,0.0016,0.0529,0,0.25,0.16,0.0784,0.25,0.0081,0.25,0.9025,0.25,0.4624,0.1089,0.1764,0.64,0.4624,0.6084,0.25,0.177782143,0.026457143,0.329107143,21,65.63,25,78.13,5,62.5,7,87.5,6,75,7,87.5,16,100,9,56.25,79.62,74,79.88,79,85.62,87.31,71.94,-12.5,1.49,11.5,-7.62,4,-1.88,-12.69,15.69,2,2,1,1,2,1,0,2,1,2,0,1,1,0,2,3,2,3,1,3,0,0,1,0,0,0,0,1,1,1,0,1,1,0,2,0,0,1,1,1,1.6,1.2,0.8,2.4,0.2,0.6,0.8,0.6,1.5,0.55,5.67,5,2,0,0,2,0.67,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,69,1,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,2,2,0,1,2,1,0,1,0,1,0,0,0,0,0,3,2,2,0,2,1.4,0.6,0,1.8,0.95 +248,R_60VP0Bh1vQF50Tn,46 - 52,Canadian,Female,1,2,2,1,3,-2,0,2,0,1,2,1,2,-1,2,1,1,2,1,-1,2,2,2,1,3,1,-2,-1,2,-1,1,1,2,1,2,0,2,1,1,1,1,1,-1,1,2,2,2,1,2,1,-2,0,2,-1,1,1,2,1,2,-1,2,1,0,1,1,1,-1,2,FALSE,1,50,TRUE,1,50,TRUE,0,90,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,80,TRUE,1,85,TRUE,1,50,TRUE,1,79,FALSE,1,50,TRUE,0,89,TRUE,1,90,FALSE,1,50,TRUE,1,50,TRUE,1,70,FALSE,1,50,TRUE,0,70,FALSE,1,50,FALSE,1,50,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,1,80,FALSE,1,70,TRUE,1,85,FALSE,1,80,TRUE,0,90,TRUE,0,80,TRUE,1,80,TRUE,1,50,TRUE,1,90,0.0225,0.0225,0.09,0.04,0.01,0.25,0.04,0.0441,0.25,0,0.04,0.01,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.09,0.0625,0.25,0.25,0.25,0.25,0.04,0.25,0.25,0.81,0.49,0.64,0.7921,0.263525,0.15315,0.3739,20,62.5,27,84.38,8,100,7,87.5,7,87.5,5,62.5,16,100,11,68.75,68.22,53.75,66.88,73,79.25,72.75,63.69,-21.88,-16.16,-46.25,-20.62,-14.5,16.75,-27.25,-5.06,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0.2,0.4,0.2,0.2,0.4,0.2,0,0.4,0.25,0.25,1,1,0,0,0,-1,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,51,0.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,-1,0,1,0,0,0,0,0,0,1,0,-1,0,0,0,0,-0.2,0.2,0.2,-0.2,0 +249,R_5QK8rCRX1n6Hy71,39 - 45,Canadian,Male,2,3,3,1,3,2,-3,3,-3,2,2,1,3,-1,3,1,1,2,-2,-1,2,3,3,0,3,2,3,-3,3,-3,2,1,2,1,3,0,3,1,1,0,1,-1,-1,3,2,3,3,2,3,1,2,-3,3,-3,3,2,2,1,3,-1,3,2,1,1,1,0,-1,3,FALSE,1,90,TRUE,1,94,FALSE,1,65,FALSE,1,75,FALSE,0,80,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,91,TRUE,1,95,FALSE,1,80,TRUE,0,90,TRUE,1,100,TRUE,0,94,FALSE,0,51,TRUE,1,100,FALSE,1,70,TRUE,0,96,TRUE,0,87,FALSE,1,100,FALSE,0,81,TRUE,1,90,FALSE,1,100,TRUE,1,70,TRUE,0,76,TRUE,1,94,FALSE,1,63,FALSE,1,100,FALSE,1,59,TRUE,1,91,TRUE,1,100,TRUE,1,100,0,0.0036,0,0.01,0,0,0.09,0.0025,0,0.01,0.0081,0,0.0081,0.04,0.64,0.0036,0,0.0625,0,0.5776,0.6561,0.2601,0.7569,0.8836,0.09,0.1369,0,0.01,0.1225,0.9216,0.1681,0.81,0.223507143,0.061771429,0.385242857,22,68.75,24,75,6,75,6,75,5,62.5,7,87.5,13,81.25,11,68.75,86.62,80.12,86.25,90.62,89.5,89.19,84.06,-6.25,11.62,5.12,11.25,28.12,2,7.94,15.31,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,2,0,0.2,0.2,0.2,0.6,0.2,0.2,0,0.6,0.3,0.25,1.33,1.67,1,-1,-1,0,-0.34,5 cents,100 minutes,24 days,Male,University - Undergraduate,45,1,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,0,0,-1,0,0,0,1,0,0,1,0,-1,0,0,0,0.2,0,0.05 +250,R_5duLDrZ0Xpzbyop,53 - 59,Canadian,Female,2,3,2,0,2,-2,-2,1,1,-1,1,0,2,0,1,1,-1,1,1,0,1,3,2,-2,2,5,0,-2,2,1,1,5,1,0,1,1,1,4,2,1,2,2,2,3,2,2,2,0,0,3,-3,-3,0,2,-2,4,1,1,1,0,1,2,1,0,1,1,0,1,TRUE,0,82,TRUE,1,97,FALSE,1,60,FALSE,1,58,TRUE,1,100,FALSE,1,55,TRUE,1,82,TRUE,1,76,TRUE,1,53,TRUE,1,95,FALSE,1,53,TRUE,0,89,FALSE,0,56,FALSE,1,94,TRUE,1,68,TRUE,1,100,TRUE,0,59,TRUE,0,89,TRUE,0,60,TRUE,0,59,TRUE,1,73,TRUE,1,96,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,1,97,FALSE,1,53,TRUE,0,71,TRUE,0,68,TRUE,1,76,FALSE,0,60,TRUE,1,100,0.0576,0.0009,0,0.0324,0,0.2025,0,0.0025,0.3481,0.0016,0.0576,0.3136,0.2209,0.2209,0,0.0009,0,0.1764,0.5041,0.8836,0.0729,0.1024,0.36,0.0036,0.3481,0.2209,0.36,0.6724,0.16,0.7921,0.4624,0.7921,0.259985714,0.110357143,0.409614286,22,68.75,21,65.63,6,75,5,62.5,5,62.5,5,62.5,14,87.5,7,43.75,77.28,62.75,76.38,91.12,78.88,83.06,71.5,3.12,11.65,-12.25,13.88,28.62,16.38,-4.44,27.75,1,0,0,2,0,2,0,1,0,2,0,0,1,1,0,1,2,1,1,2,0,1,0,0,2,1,1,1,1,1,0,1,1,0,0,0,1,0,0,0,0.6,1,0.4,1.4,0.6,1,0.4,0.2,0.85,0.55,4.67,3,2,1,2,2,1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,57,0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,-1,0,2,-2,1,-1,0,-1,1,0,-1,0,1,0,1,1,1,1,2,0,0,0,1.2,0.3 +251,R_1KwqwJDsh0DTUJ2,39 - 45,American,Female,3,3,2,1,3,-1,1,1,3,1,1,0,2,-1,3,-1,-1,-1,1,-3,3,3,2,2,3,10,0,1,3,2,0,10,2,0,0,0,2,0,0,0,0,0,0,2,3,2,2,1,3,5,-1,1,1,3,1,9,1,0,1,1,3,6,0,1,0,1,1,6,FALSE,1,100,FALSE,0,62,FALSE,1,65,FALSE,1,53,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,76,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,1,74,TRUE,1,89,TRUE,1,87,FALSE,1,74,TRUE,0,59,TRUE,0,89,FALSE,1,52,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,77,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.01,0.0169,0,0,0,0,0.5776,0.2304,0,0,0,1,0,0,0.3844,0,0.2209,0.0529,0,0.5625,0.0121,0.7921,0.0676,0.0676,1,1,0,0.1225,0.3481,1,0.09,0.268882143,0.172378571,0.365385714,28,87.5,23,71.88,3,37.5,6,75,6,75,8,100,11,68.75,12,75,87.25,86.62,93.62,87.38,81.38,92.44,82.06,15.62,15.37,49.12,18.62,12.38,-18.62,23.69,7.06,0,0,0,1,0,1,0,2,1,1,1,0,2,1,1,1,1,1,1,3,0,1,0,0,0,0,0,0,0,0,0,0,1,2,0,1,2,1,0,4,0.2,1,1,1.4,0.2,0,0.6,1.6,0.9,0.6,6.67,6.67,5,1,-6,-4,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),44,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,-1,0,1,0,1,0,2,1,1,1,0,1,-1,1,0,-1,0,1,-1,0,1,0.4,-0.2,0.3 +252,R_7pAnaXoEVkzxNb7,60 - 66,American,Male,3,2,1,1,0,0,-3,3,-3,0,2,0,2,-1,2,2,2,2,2,2,2,2,2,1,1,1,0,-3,2,-3,1,1,2,0,2,-2,2,6,1,0,2,2,2,1,3,2,2,2,2,2,-1,-3,2,-3,0,4,2,1,2,-1,2,3,3,2,3,2,2,4,TRUE,0,58,TRUE,1,84,TRUE,0,87,FALSE,1,56,FALSE,0,52,FALSE,1,50,TRUE,1,94,TRUE,1,57,TRUE,1,50,TRUE,1,83,FALSE,1,50,TRUE,0,95,TRUE,1,90,FALSE,1,50,TRUE,1,55,TRUE,1,90,FALSE,1,66,TRUE,0,100,FALSE,1,52,FALSE,1,56,TRUE,1,100,TRUE,1,93,FALSE,1,79,TRUE,1,65,FALSE,1,64,TRUE,1,96,TRUE,0,84,FALSE,1,100,TRUE,0,91,TRUE,1,100,TRUE,1,83,FALSE,0,50,0.1849,0.0016,0.01,0.0036,0.25,0.25,0.1225,0.0289,0.1936,0.0049,0,0.01,0.25,0.25,0.2704,0.0256,0.0441,0.1936,0,0.1296,0,0.2025,0.2304,0.25,0.1156,0.7056,0.0289,0.3364,0.7569,1,0.8281,0.9025,0.263575,0.135257143,0.391892857,18,56.25,24,75,7,87.5,5,62.5,6,75,6,75,14,87.5,10,62.5,74.38,64.25,72.25,79.75,81.25,77.62,71.12,-18.75,-0.62,-23.25,9.75,4.75,6.25,-9.88,8.62,1,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,2,0,0,0,0,0,1,1,2,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0.6,0.4,0.2,0.6,0.8,0.4,0.2,0.4,0.45,0.45,2.67,3,-1,-3,3,-3,-0.33,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),63,0.75,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,1,0,0,-1,-1,-1,0,0,0,1,0,-1,0,1,0,0,2,-1,0,0,-0.2,0,0,0.2,0 +253,R_3tAvwSUORjliA9U,53 - 59,Canadian,Male,-1,1,2,2,-2,-2,-2,1,0,-1,2,2,2,2,2,2,1,2,2,-1,-2,1,2,2,-2,4,-1,-1,2,1,-1,0,2,1,1,1,1,1,-1,1,1,1,-2,7,-1,1,2,2,-1,2,-2,-2,1,-2,-2,1,2,2,0,0,0,0,1,1,2,2,2,1,TRUE,0,82,FALSE,0,70,TRUE,0,89,FALSE,1,77,FALSE,0,85,FALSE,1,75,TRUE,1,100,TRUE,1,100,TRUE,1,84,FALSE,0,76,FALSE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,72,FALSE,0,79,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,72,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,100,FALSE,0,87,FALSE,1,90,TRUE,0,67,FALSE,1,96,TRUE,1,91,FALSE,0,100,FALSE,0,93,0,0.7569,0.6241,0,0.8649,0.0625,0.0025,0.5776,0.0784,0,0.0081,0,0.0256,0.0576,0.7225,0.49,0,0.0529,0.4489,1,1,0.5184,1,1,1,0.01,1,0.6724,0.7921,1,0.0016,1,0.478071429,0.210185714,0.745957143,24,75,14,43.75,4,50,4,50,2,25,4,50,7,43.75,7,43.75,89.25,83.62,93.62,93.12,86.62,89.5,89,31.25,45.5,33.62,43.62,68.12,36.62,45.75,45.25,1,0,0,0,0,1,1,1,1,0,0,1,1,1,1,3,0,1,1,1,0,0,0,0,1,0,0,0,2,1,0,0,2,2,2,1,0,0,0,3,0.2,0.8,0.8,1.2,0.2,0.6,1.2,0.8,0.75,0.7,1.67,1,2,-1,1,6,0.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,56,0.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,0,0,0,-1,1,1,1,-1,-1,0,1,-1,-1,-1,2,0,1,1,-2,0,0.2,-0.4,0.4,0.05 +254,R_5oSF57Z2IEBUbXS,60 - 66,Both,Female,3,3,3,-2,3,-1,1,3,-2,1,3,3,3,1,3,1,2,2,3,-1,3,3,3,-2,3,1,-2,-2,3,-2,1,4,3,3,3,2,3,0,3,3,3,1,-1,5,3,3,3,-2,3,0,-2,-3,3,-2,2,0,3,3,3,1,3,0,3,3,3,3,3,1,TRUE,0,67,TRUE,1,96,TRUE,0,100,TRUE,0,68,TRUE,1,100,TRUE,0,92,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,TRUE,0,88,TRUE,0,99,TRUE,1,90,FALSE,1,79,FALSE,0,76,TRUE,1,100,FALSE,1,75,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,0,74,TRUE,0,100,TRUE,1,96,FALSE,1,78,TRUE,0,78,TRUE,0,92,TRUE,1,96,FALSE,0,100,TRUE,1,100,0,0.0016,0,0,0,0.8464,0.5476,0,0,0,0.0016,0.01,0.0625,0.7744,0,0.0016,0,0.4624,0.6084,1,0.0049,0.5776,1,0.0441,0.0625,0.0484,1,0.4489,1,1,0.8464,0.9801,0.404564286,0.193321429,0.615807143,24,75,18,56.25,3,37.5,6,75,5,62.5,4,50,13,81.25,5,31.25,91,85.12,92.75,92.75,93.38,93.5,88.5,18.75,34.75,47.62,17.75,30.25,43.38,12.25,57.25,0,0,0,0,0,1,3,0,0,0,0,0,0,1,0,2,1,1,2,0,0,0,0,0,0,1,4,0,0,1,0,0,0,0,0,2,1,1,0,4,0,0.8,0.2,1.2,0,1.2,0,1.6,0.55,0.7,1.67,0,1,4,0,4,1.67,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,60,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,-1,0,0,-1,0,0,0,1,0,0,0,0,2,-4,0,-0.4,0.2,-0.4,-0.15 +255,R_3oS05I58MGLFdJc,60 - 66,American,Male,3,3,2,2,2,1,-3,2,-3,3,1,-2,3,-1,3,-2,-1,1,-2,-2,3,3,2,2,2,0,1,-3,2,-3,2,0,2,-2,3,2,3,1,-2,-2,-2,-2,-2,5,3,3,2,2,2,0,2,-3,2,-3,2,0,1,-2,3,-2,3,1,0,0,2,2,1,5,TRUE,0,100,TRUE,1,100,FALSE,1,80,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,75,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,1,0.0625,0,0,0.25,0,0,0,0.64,0,0,0.25,0.25,1,0.25,1,0.0625,0.25,0.0625,0.25,0.25,0.25,1,0.04,1,1,1,0.352410714,0.175178571,0.529642857,20,62.5,19,59.38,3,37.5,5,62.5,5,62.5,6,75,14,87.5,5,31.25,83.91,69.38,87.5,84.38,94.38,90.62,77.19,3.12,24.53,31.88,25,21.88,19.38,3.12,45.94,0,0,0,0,0,0,0,0,0,1,1,0,0,3,0,0,1,3,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,2,1,1,4,3,0,0.2,0.8,0.8,0,0.4,0.2,2.2,0.45,0.7,0.33,0.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,0,0,0,0,1,0,0,2,0,-2,0,2,-4,-3,0,-0.2,0.6,-1.4,-0.25 +256,R_3smjKTwBjkxUhgg,60 - 66,Canadian,Female,3,3,2,2,3,3,1,3,-2,2,3,-3,3,0,3,1,3,2,3,2,3,3,2,2,3,1,3,2,3,-2,2,1,3,-3,3,2,3,1,2,2,2,2,1,1,3,3,2,3,3,2,2,-2,2,-2,2,2,3,-3,3,-3,3,2,0,0,2,2,2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,FALSE,0,76,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,96,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,77,FALSE,1,98,FALSE,1,54,TRUE,0,53,FALSE,0,76,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,100,FALSE,1,57,TRUE,0,59,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,1,0,0,0,0.25,0,0.0016,0.2809,0.0009,0,0.25,0,0.25,0.5776,0,0,0.25,0.1849,0,0.5776,0.25,0.2116,0,0.5929,1,0.2809,0,0,0.0004,0.3481,1,0.225264286,0.132928571,0.3176,25,78.13,21,65.63,5,62.5,3,37.5,7,87.5,6,75,11,68.75,10,62.5,82.69,69.62,73.5,98.88,88.75,87.38,78,12.5,17.06,7.12,36,11.38,13.75,18.63,15.5,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,1,1,0,1,1,0,0,0,1,0,1,3,1,0,0,0,0,0,3,0,1,3,0,1,0,0,0.2,0.4,0.8,0.2,1,0.6,1,0.35,0.7,1,2,-1,-1,-1,-2,-1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,63,2,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-1,0,-1,-2,-1,0,0,0,0,0,-1,0,0,-2,0,0,1,-0.2,-0.8,-0.2,-0.2,-0.35 +257,R_3Ny3Vz7ahIARXLP,67 - 73,Canadian,Female,2,2,2,2,2,2,-2,2,-2,2,1,2,2,0,2,2,1,2,2,-1,2,2,2,2,2,0,2,-2,2,-2,2,0,1,2,2,-2,2,0,-2,-2,-2,-2,-2,10,2,2,2,2,2,0,2,-2,2,-2,2,0,1,2,2,2,2,0,2,2,2,2,-1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,51,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0.25,0,0.25,0,0,0,0.25,1,0,0,1,0.25,1,1,0,0.25,0.2601,0.25,0.25,0.25,0,1,1,1,1,1,0.411075,0.232142857,0.590007143,24,75,19,59.38,4,50,6,75,5,62.5,4,50,13,81.25,6,37.5,84.41,68.88,87.5,93.75,87.5,90.62,78.19,15.62,25.03,18.88,12.5,31.25,37.5,9.37,40.69,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,3,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0.4,3.2,0,0,0.4,0.2,0.9,0.15,0,0,0,0,0,10,0,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),71,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,2,4,4,1,0,0,0,3,0.75 +258,R_5QzhtHCfdj5aZJi,60 - 66,American,Female,3,3,3,3,3,-2,-2,3,-2,0,2,3,3,3,2,1,-1,2,1,-3,1,1,2,-2,-3,10,2,0,1,3,-3,10,-1,-2,-2,2,-1,10,-3,-3,0,-3,-3,7,3,3,3,3,3,1,0,0,0,0,0,1,3,3,3,3,2,0,-2,-2,1,1,-2,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,95,FALSE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,100,TRUE,1,85,TRUE,1,100,FALSE,1,95,FALSE,1,95,TRUE,0,85,FALSE,1,100,FALSE,0,55,TRUE,1,80,FALSE,1,100,TRUE,1,95,TRUE,0,60,TRUE,1,60,FALSE,1,100,FALSE,1,97,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.16,0,0.0025,0,0,0.0025,0.0025,0,0.04,0,0.0025,0.01,0,0,0,0,0.2025,0.0009,0.36,0.3025,0.0225,0.7225,1,0.0025,0,1,0,1,0.0025,1,0,0.202621429,0.018571429,0.386671429,28,87.5,25,78.13,6,75,6,75,6,75,7,87.5,14,87.5,11,68.75,91.78,89.38,93.12,85.62,99,90.62,92.94,9.37,13.65,14.38,18.12,10.62,11.5,3.12,24.19,2,2,1,5,6,4,2,2,5,3,3,5,5,1,3,4,2,2,4,0,0,0,0,0,0,2,2,3,2,0,1,0,0,0,0,3,1,1,0,1,3.2,3.2,3.4,2.4,0,1.8,0.2,1.2,3.05,0.8,10,0.67,9,9,10,2,9.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,1.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,2,2,1,5,6,2,0,-1,3,3,2,5,5,1,3,1,1,1,4,-1,3.2,1.4,3.2,1.2,2.25 +259,R_3ZZqKke6RXCTGTf,46 - 52,Canadian,Male,2,2,2,1,3,0,-3,2,-3,2,-2,-3,2,0,3,-3,-2,-2,-3,-3,2,2,2,1,3,0,0,-3,2,-3,3,0,-2,-3,2,0,3,0,-3,1,-3,-3,-3,7,2,2,2,1,3,0,0,-3,2,-3,2,0,-2,-3,2,-1,3,0,-2,-1,-1,-2,-3,2,TRUE,0,97,FALSE,0,60,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,56,FALSE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,85,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,60,TRUE,0,50,FALSE,1,50,TRUE,1,55,TRUE,1,90,FALSE,1,75,TRUE,1,50,FALSE,1,100,TRUE,1,60,FALSE,1,50,FALSE,1,100,TRUE,0,70,TRUE,1,55,TRUE,1,50,TRUE,1,100,0,0.16,0,0,0,0,0.25,0.1936,0.25,0.01,0.2025,0.0016,0.25,0,0.25,0.36,0.0625,0.25,0,0,0.2025,0.25,0.25,0.0225,0.25,0.25,0.25,0.9409,0.25,0.36,0.49,0,0.199860714,0.148585714,0.251135714,10,31.25,26,81.25,6,75,7,87.5,6,75,7,87.5,15,93.75,11,68.75,72.16,57.5,74.5,81,75.62,70.12,74.19,-50,-9.09,-17.5,-13,6,-11.88,-23.63,5.44,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0.2,0,0.8,0,0,0.2,0.8,0.25,0.25,0,0,0,0,0,5,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),49,1.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,-1,2,0,-1,0,0,0.2,-0.2,0,0 +260,R_3q7qGAiUw8YtYfI,67 - 73,American,Female,3,3,2,2,1,-1,-1,2,3,1,3,3,2,2,3,-3,-3,-1,-2,-3,2,3,2,2,3,2,1,-2,3,-1,2,8,3,3,3,3,3,7,1,2,1,-1,1,8,3,3,3,3,1,3,-1,-1,2,-1,0,7,3,3,3,3,3,3,-1,-2,-1,-1,-2,9,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,68,FALSE,0,74,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,93,FALSE,1,88,TRUE,0,100,TRUE,1,93,TRUE,0,93,TRUE,1,59,TRUE,1,90,FALSE,1,100,FALSE,1,100,FALSE,1,97,FALSE,1,100,FALSE,0,100,TRUE,1,56,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,0,93,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.01,0,0,0,0,0.0049,0,0.1936,0,0.0049,0.0016,0.0144,0.5476,0,0,0.1024,0.1849,1,1,0.1681,0.0009,0.8649,0,0,0,1,0.0625,0,0.8649,1,0.250557143,0.0621,0.439014286,27,84.38,25,78.13,8,100,5,62.5,5,62.5,7,87.5,14,87.5,11,68.75,91.62,88.5,95,92.75,90.25,91.31,91.94,6.25,13.49,-11.5,32.5,30.25,2.75,3.81,23.19,1,0,0,0,2,2,1,1,4,1,0,0,1,1,0,4,5,2,1,4,0,0,1,1,0,0,0,0,4,1,0,0,1,1,0,2,1,0,1,1,0.6,1.8,0.4,3.2,0.4,1,0.4,1,1.5,0.7,5.67,4.33,-1,1,4,-1,1.34,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,68,1,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,0,-1,-1,2,2,1,1,0,0,0,0,0,0,0,2,4,2,0,3,0.2,0.8,0,2.2,0.8 +261,R_5rNwdFvn0qIr1GV,46 - 52,American,Male,3,3,-3,3,0,-3,1,3,3,1,-2,-3,3,-3,3,-3,-3,-3,-3,-3,3,3,3,3,3,10,-3,2,2,2,-3,10,-3,-3,3,-3,3,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,10,-3,2,3,3,-3,10,-3,3,3,-3,3,10,3,3,3,3,-3,10,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,50,0,1,1,0,0.25,0.25,0.25,0,0,1,0,0,0.25,1,0,0.25,0.25,0,1,0,1,0.25,0.25,0.25,0,0,0.25,0.25,0,1,0.25,1,0.321428571,0.25,0.392857143,4,12.5,21,65.63,4,50,7,87.5,5,62.5,5,62.5,9,56.25,12,75,81.25,68.75,75,87.5,93.75,81.25,81.25,-53.13,15.62,18.75,-12.5,25,31.25,25,6.25,0,0,6,0,3,0,1,1,1,4,1,0,0,0,0,0,0,0,0,0,0,0,6,0,3,0,1,0,0,4,1,6,0,0,0,6,6,6,6,0,1.8,1.4,0.2,0,1.8,1,1.4,4.8,0.85,2.25,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),49,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,1,1,0,0,-6,0,0,0,-6,-6,-6,-6,0,0,0.4,-1.2,-4.8,-1.4 +262,R_7cTcJgRvQCfuUdj,60 - 66,Canadian,Male,1,3,2,1,2,-2,0,1,1,1,2,1,3,-2,2,0,0,0,1,-1,2,3,2,-2,2,6,-2,0,1,1,1,6,2,1,3,-2,2,6,0,1,0,0,-1,6,1,3,2,1,1,4,-2,1,1,1,1,4,2,1,3,-2,2,2,0,0,0,0,-1,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,50,FALSE,1,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.0016,0,0,0,0,0,0,0,0,0,1,0.0625,0,0.0196,0,0,0.25,0,0,0,0.25,0,0,0,0.25,0,0,1,1,0.1225,0,0.141235714,0.09515,0.187321429,30,93.75,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,92.88,78.12,93.88,99.5,100,94.19,91.56,6.25,5.38,-9.38,6.38,12,12.5,6.69,4.06,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0.8,0,0,0.4,0.2,0.2,0,0.2,0.3,0.15,6,3.33,2,2,4,0,2.67,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),61,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,1,0,0,3,-1,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.6,-0.2,0,0.2,0.15 +263,R_57ZgjQtLkHOY40x,67 - 73,American,Female,3,3,1,1,1,-1,1,2,1,1,1,1,0,1,2,-1,-1,1,1,-3,3,3,2,1,3,4,-2,2,2,1,0,5,1,1,1,1,2,3,-1,1,1,-1,-2,6,3,3,3,3,3,6,-1,-1,1,-2,0,2,1,1,3,1,3,3,-1,-1,1,-2,-2,5,TRUE,0,100,TRUE,1,95,FALSE,1,75,FALSE,1,55,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,98,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,94,FALSE,1,97,TRUE,0,80,FALSE,1,100,FALSE,0,55,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,55,TRUE,1,90,FALSE,1,60,TRUE,0,82,TRUE,0,85,TRUE,1,100,FALSE,0,60,TRUE,1,60,0,0.01,0,0,0.16,0.0025,0,0.0004,0,1,0,0,0.01,0,0,0.0025,0,0.2025,0.6724,0.3025,0.3025,0.0576,0.64,1,0.0036,0.16,0.36,1,0.0625,0.0009,0.7225,0,0.237942857,0.098421429,0.377464286,28,87.5,23,71.88,6,75,6,75,4,50,7,87.5,13,81.25,10,62.5,87.56,77,86.12,92.5,94.62,89,86.12,15.62,15.68,2,11.12,42.5,7.12,7.75,23.62,0,0,1,0,2,1,1,0,0,1,0,0,1,0,0,0,2,0,2,1,0,0,2,2,2,0,2,1,3,1,0,0,3,0,1,0,0,0,3,1,0.6,0.6,0.2,1,1.2,1.4,0.8,0.8,0.6,1.05,4,3.67,-2,3,0,1,0.33,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),72,0.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,-1,-2,0,1,-1,-1,-3,0,0,0,-2,0,-1,0,2,0,-1,0,-0.6,-0.8,-0.6,0.2,-0.45 +264,R_710J4BbVCOc2iEF,53 - 59,Canadian,Male,2,3,3,2,3,1,-2,2,-2,1,3,1,2,2,1,-3,-3,-3,-3,-3,2,2,2,2,3,5,1,0,1,0,1,3,0,0,1,1,0,5,0,0,1,1,0,4,1,3,1,1,3,6,2,0,3,-2,3,7,3,2,2,3,2,4,3,3,3,3,3,10,FALSE,1,53,TRUE,1,64,TRUE,0,80,FALSE,1,58,FALSE,0,55,FALSE,1,58,TRUE,1,68,FALSE,0,59,FALSE,0,60,FALSE,0,90,TRUE,0,75,TRUE,0,79,TRUE,1,70,FALSE,1,63,FALSE,0,66,TRUE,1,80,TRUE,0,76,TRUE,0,96,TRUE,0,75,FALSE,1,78,FALSE,0,93,FALSE,0,79,FALSE,1,76,FALSE,0,67,TRUE,0,79,TRUE,1,84,FALSE,1,76,TRUE,0,82,FALSE,1,73,TRUE,1,93,FALSE,0,90,TRUE,1,98,0.3481,0.0256,0.04,0.1024,0.0004,0.1764,0.4489,0.81,0.0484,0.6241,0.0049,0.09,0.36,0.5625,0.3025,0.1296,0.0576,0.1764,0.6724,0.6241,0.8649,0.4356,0.5625,0.1369,0.5776,0.0576,0.81,0.2209,0.64,0.9216,0.0729,0.6241,0.393314286,0.270835714,0.515792857,10,31.25,15,46.88,3,37.5,5,62.5,4,50,3,37.5,7,43.75,8,50,74.78,70.5,74.88,76.5,77.25,76,73.56,-15.63,27.9,33,12.38,26.5,39.75,32.25,23.56,0,1,1,0,0,0,2,1,2,0,3,1,1,1,1,3,3,4,4,3,1,0,2,1,0,1,2,1,0,2,0,1,0,1,1,6,6,6,6,6,0.4,1,1.4,3.4,0.8,1.2,0.6,6,1.55,2.15,4.33,5.67,-1,-4,1,-6,-1.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),53,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,-1,1,-1,-1,0,-1,0,0,2,-2,3,0,1,0,0,-3,-3,-2,-2,-3,-0.4,-0.2,0.8,-2.6,-0.6 +265,R_6FGX2RDKjKb8wzD,53 - 59,Canadian,Male,0,3,1,2,0,-1,1,3,-2,1,1,2,3,3,1,-3,-2,-2,0,-3,0,3,2,2,0,3,-1,1,3,-2,0,3,0,3,3,2,1,3,-3,-2,-2,-3,-2,3,0,3,2,2,0,2,-1,1,3,-2,0,2,0,3,3,3,1,2,-2,-3,-2,0,-3,2,TRUE,0,100,TRUE,1,71,TRUE,0,92,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,92,TRUE,1,61,TRUE,1,99,TRUE,1,62,FALSE,1,76,TRUE,0,99,FALSE,0,77,TRUE,0,96,TRUE,1,50,TRUE,1,100,FALSE,1,76,TRUE,0,83,TRUE,0,79,FALSE,1,100,FALSE,0,100,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,98,TRUE,1,100,0.1521,0,0,0.0064,0,0,0,0.1444,0,0.16,0.01,0.5929,0.0001,0.0576,0.25,0.0841,0,0.25,0,0,1,0.25,0.6241,0.9216,0.0576,0.25,0.0004,1,0.8464,0.6889,0,0.9801,0.291721429,0.11065,0.472792857,22,68.75,23,71.88,6,75,6,75,5,62.5,6,75,14,87.5,9,56.25,84.72,71.62,87.88,86.62,92.75,81.88,87.56,-3.13,12.84,-3.38,12.88,24.12,17.75,-5.62,31.31,0,0,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,3,1,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0.2,0.2,0.6,0.8,0.2,0.2,0.4,0.4,0.45,0.3,3,2,1,1,1,1,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),55,0.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,-1,-1,0,3,1,0,0,0.2,0.4,0.15 +266,R_5NnszuPXPUh3hpB,46 - 52,Canadian,Female,2,2,2,2,3,1,2,2,-1,2,1,2,0,2,1,1,1,2,1,2,1,2,1,1,0,7,2,1,2,2,1,6,0,0,1,1,1,6,1,2,2,0,1,7,2,1,2,2,1,8,1,2,0,1,1,7,2,0,1,1,2,7,1,2,0,1,0,7,TRUE,0,100,FALSE,0,67,TRUE,0,100,FALSE,1,84,FALSE,0,82,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,85,TRUE,1,100,TRUE,0,94,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,0,94,TRUE,1,89,TRUE,0,83,TRUE,1,85,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,52,FALSE,0,53,0,0.0225,0,0,0.2809,1,0.0121,0,0.25,0,0,0,0.16,0.25,0.6724,0.4489,0.8836,0.0256,0,0.6889,1,0.0225,1,1,0.8836,0.25,0.2304,1,1,1,0,1,0.466389286,0.284535714,0.648242857,32,100,18,56.25,6,75,2,25,4,50,6,75,12,75,6,37.5,86.81,68.5,90.38,96,92.38,85.81,87.81,43.75,30.56,-6.5,65.38,46,17.38,10.81,50.31,1,0,1,1,3,1,1,0,3,1,1,2,1,1,0,0,1,0,1,1,0,1,0,0,2,0,0,2,2,1,1,2,1,1,1,0,1,2,0,2,1.2,1.2,1,0.6,0.6,1,1.2,1,1,0.95,6.33,7.33,-1,-1,-1,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,-1,1,1,1,1,1,-2,1,0,0,0,0,0,-1,0,0,-2,1,-1,0.6,0.2,-0.2,-0.4,0.05 +267,R_17PQ70EjmFqYYx8,46 - 52,American,Female,1,1,2,0,3,-1,1,2,0,0,1,3,2,-2,2,0,-1,1,1,0,1,2,2,0,2,1,0,0,2,0,0,1,1,3,2,-2,2,0,0,-1,1,1,0,1,1,1,2,1,3,1,-1,0,2,0,0,5,1,3,2,-2,2,1,0,0,1,1,0,1,TRUE,0,75,FALSE,0,50,FALSE,1,90,FALSE,1,50,FALSE,0,50,FALSE,1,53,TRUE,1,75,TRUE,1,100,FALSE,0,51,TRUE,1,75,FALSE,1,52,TRUE,0,99,TRUE,1,68,TRUE,0,52,FALSE,0,51,TRUE,1,51,FALSE,1,52,TRUE,0,90,FALSE,1,51,FALSE,1,51,FALSE,0,100,FALSE,0,51,TRUE,0,52,TRUE,1,75,TRUE,0,70,TRUE,1,91,FALSE,1,50,TRUE,0,71,TRUE,0,66,TRUE,1,100,FALSE,0,52,TRUE,1,100,0,0.0081,0.2401,0.0625,0,0.2209,0.0625,0.0625,0.2401,0.2601,0,0.1024,0.2601,0.2304,0.25,0.25,0.2704,0.25,0.5041,0.49,1,0.2601,0.2401,0.2704,0.2304,0.25,0.2704,0.5625,0.01,0.81,0.4356,0.9801,0.313325,0.175671429,0.450978571,6,18.75,17,53.13,4,50,4,50,3,37.5,6,75,9,56.25,8,50,67.62,50.88,67.62,72.38,79.62,71.25,64,-34.38,14.49,0.88,17.62,34.88,4.62,15,14,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.4,0.4,0,0,0.2,0.2,0,0.2,0.2,0.15,0.67,2.33,0,-4,-1,0,-1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,1,0,-1,1,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0.2,0.2,0,-0.2,0.05 +268,R_5ocomYDlDwHAkjD,53 - 59,Canadian,Female,1,2,2,1,1,-1,-2,1,-1,0,-2,0,2,-2,1,1,0,1,1,-1,2,2,2,2,2,4,-1,-1,-1,-2,1,2,-1,0,2,1,1,3,-2,-2,-2,-2,-2,3,2,2,2,2,2,2,-1,-2,0,-2,-1,2,0,2,2,-2,2,2,0,0,1,0,0,2,TRUE,0,89,TRUE,1,85,TRUE,0,90,FALSE,1,54,FALSE,0,60,FALSE,1,68,TRUE,1,78,TRUE,1,84,TRUE,1,74,TRUE,1,78,TRUE,0,73,TRUE,0,85,FALSE,0,70,FALSE,1,64,FALSE,0,64,TRUE,1,91,TRUE,0,70,TRUE,0,82,FALSE,1,62,FALSE,1,76,FALSE,0,86,TRUE,1,71,TRUE,0,64,TRUE,1,71,FALSE,1,100,TRUE,1,72,TRUE,0,74,FALSE,1,76,TRUE,0,65,TRUE,1,100,FALSE,0,69,TRUE,1,100,0.0256,0.0784,0.0081,0.0484,0,0.1024,0.0841,0.0484,0.0576,0.0841,0,0.49,0.0676,0.5329,0.36,0.0225,0.4096,0.2116,0.0576,0,0.7396,0.4096,0.1444,0.1296,0.49,0.5476,0.4761,0.7921,0.81,0.6724,0.4225,0.7225,0.317314286,0.176485714,0.458142857,16,50,18,56.25,4,50,2,25,6,75,6,75,11,68.75,7,43.75,76.41,69.38,72.88,79.25,84.12,78.31,74.5,-6.25,20.16,19.38,47.88,4.25,9.12,9.56,30.75,1,0,0,1,1,0,1,2,1,1,1,0,0,3,0,3,2,3,3,1,1,0,0,1,1,0,0,1,1,1,2,2,0,0,1,1,0,0,1,1,0.6,1,0.8,2.4,0.6,0.6,1,0.6,1.2,0.7,3,2,2,0,1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),58,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,1,1,0,0,-1,-2,0,3,-1,2,2,3,2,0,0,0.4,-0.2,1.8,0.5 +269,R_6keDxtnLDMK2iGd,39 - 45,Canadian,Female,-1,3,2,3,2,-1,-2,1,-2,-1,3,1,2,-1,3,-2,-2,-2,1,-1,1,3,1,3,2,6,-3,-3,2,-2,-1,5,3,2,1,-3,3,5,2,2,3,3,3,8,2,3,2,3,3,10,-1,-3,1,-2,-1,5,3,2,3,-2,3,5,2,2,2,2,-2,10,FALSE,1,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,75,TRUE,1,100,TRUE,1,90,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,0,85,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,70,TRUE,0,50,TRUE,0,85,FALSE,1,50,TRUE,1,95,TRUE,1,50,TRUE,0,50,TRUE,1,70,TRUE,0,85,TRUE,1,70,FALSE,1,50,TRUE,0,70,TRUE,0,60,TRUE,1,100,FALSE,0,80,TRUE,1,50,0.01,0.09,0.0025,0,0.25,0.0625,0.09,0.09,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.49,0.7225,0.0025,0.25,0.7225,0,0.49,0.25,0.64,0,1,0.25,0.36,0.7225,0.335446429,0.249464286,0.421428571,13,40.63,20,62.5,5,62.5,4,50,6,75,5,62.5,13,81.25,7,43.75,71.88,58.12,68.75,78.12,82.5,73.12,70.62,-21.87,9.38,-4.38,18.75,3.12,20,-8.13,26.87,2,0,1,0,0,2,1,1,0,0,0,1,1,2,0,4,4,5,2,4,3,0,0,0,1,0,1,0,0,0,0,1,1,1,0,4,4,4,1,1,0.6,0.8,0.8,3.8,0.8,0.2,0.6,2.8,1.5,1.1,5.33,6.67,-4,0,0,-2,-1.34,5 cents,5 minutes,47 days,Female,University - PhD,41,0.75,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,0,1,0,-1,2,0,1,0,0,0,0,0,1,0,0,0,1,1,3,-0.2,0.6,0.2,1,0.4 +270,R_7TWnEr6dY4HbC2B,60 - 66,American,Female,3,2,2,-2,-2,2,-3,2,-1,-1,3,3,3,3,3,1,-3,-3,-2,-1,3,3,3,0,1,0,3,-2,1,3,1,2,3,3,3,3,3,8,1,0,1,1,-2,2,0,0,0,0,0,1,0,-3,0,0,0,1,3,3,3,3,3,5,0,0,0,0,0,10,FALSE,1,100,TRUE,1,84,TRUE,0,100,FALSE,1,50,FALSE,0,51,TRUE,0,64,TRUE,1,62,TRUE,1,100,TRUE,1,55,TRUE,1,74,TRUE,0,61,TRUE,0,100,TRUE,1,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,58,TRUE,0,100,TRUE,0,63,FALSE,1,57,TRUE,1,70,TRUE,1,58,FALSE,1,67,TRUE,1,59,TRUE,0,78,TRUE,1,65,TRUE,0,77,TRUE,0,75,TRUE,0,83,TRUE,1,100,FALSE,0,57,TRUE,1,100,0,0.1225,0.25,0.1444,0,0.4096,0.1681,0.0676,0.1849,0.1764,0,0.0676,0.2025,0.3721,0.2601,0.0256,0.1089,0.25,0.5625,0.6084,0.09,0.25,0.3969,0.25,0.3364,0.5929,0.3249,0,1,1,0.6889,1,0.335510714,0.163814286,0.507207143,23,71.88,17,53.13,3,37.5,4,50,6,75,4,50,12,75,5,31.25,71.62,62.12,70.88,73.38,80.12,69.31,73.94,18.75,18.49,24.62,20.88,-1.62,30.12,-5.69,42.69,0,1,1,2,3,1,1,1,4,2,0,0,0,0,0,0,3,4,3,1,3,2,2,2,2,2,0,2,1,1,0,0,0,0,0,1,3,3,2,1,1.4,1.8,0,2.2,2.2,1.2,0,2,1.35,1.35,3.33,2.33,-1,1,3,-8,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),62,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,-3,-1,-1,0,1,-1,1,-1,3,1,0,0,0,0,0,-1,0,1,1,0,-0.8,0.6,0,0.2,0 +271,R_5ksKzm2HPRTlWTu,67 - 73,American,Female,3,2,2,-3,-2,-3,-3,3,1,-1,3,3,2,-3,3,-1,1,2,2,-2,3,2,2,-3,-2,1,-3,-3,3,2,-1,1,3,3,3,2,3,1,2,1,2,2,2,1,3,2,2,-3,-2,1,-3,-3,3,1,-1,1,3,3,3,-3,3,0,2,1,2,2,-2,2,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,68,FALSE,1,96,FALSE,1,89,FALSE,1,83,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,57,TRUE,1,100,0,0,0,0,0,0,0,0,0.0289,0,0,0.25,0,0.25,0,0,0.25,0.25,0,0.8281,0.25,0.25,0.0121,1,0.1024,0.25,0.1849,0.25,0,0.0016,1,0,0.184214286,0.073492857,0.294935714,25,78.13,27,84.38,6,75,7,87.5,6,75,8,100,16,100,11,68.75,83.88,68.25,77.25,92.12,97.88,87.94,79.81,-6.25,-0.5,-6.75,-10.25,17.12,-2.12,-12.06,11.06,0,0,0,0,0,0,0,0,1,0,0,0,1,5,0,3,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0.2,1.2,1.4,0,0,0.2,0.6,0.7,0.2,1,0.67,0,0,1,-1,0.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),73,1.125,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,1,0,0,0,0,5,0,0,0,0,0,4,0,0.2,1,0.8,0.5 +272,R_1916rOSJUwEPADZ,46 - 52,Canadian,Male,-1,2,2,3,3,-1,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,6,0,0,0,-1,0,6,0,1,0,0,-1,6,0,0,0,0,1,8,-1,-1,-1,-2,-1,5,-1,-1,-1,-1,0,6,1,0,1,1,1,7,0,-1,0,0,1,5,TRUE,0,88,TRUE,1,81,TRUE,0,74,FALSE,1,65,FALSE,0,63,FALSE,1,69,TRUE,1,90,TRUE,1,85,TRUE,1,99,TRUE,1,75,FALSE,1,66,TRUE,0,83,TRUE,1,73,TRUE,0,100,TRUE,1,55,TRUE,1,86,TRUE,0,76,TRUE,0,100,TRUE,0,54,FALSE,1,94,TRUE,1,73,TRUE,1,77,TRUE,0,58,TRUE,1,56,TRUE,0,52,TRUE,1,59,TRUE,0,57,FALSE,1,53,TRUE,0,62,TRUE,1,73,TRUE,1,90,TRUE,1,93,0.0225,0.1681,0.0196,0.01,0.0049,0.0961,0.1936,0.0625,0.0036,0.0529,0.0729,0.0729,0.0001,0.1156,0.3969,0.0361,0.3364,0.1225,0.2209,0.2704,0.0729,0.2025,0.2916,1,0.5776,0.3249,0.01,0.7744,0.5476,1,0.3844,0.6889,0.283325,0.111928571,0.454721429,24,75,20,62.5,6,75,4,50,4,50,6,75,15,93.75,5,31.25,74.34,70.88,70.88,80.12,75.5,76.75,71.94,12.5,11.84,-4.12,20.88,30.12,0.5,-17,40.69,1,2,1,3,3,1,1,1,2,0,0,1,0,0,2,0,1,0,0,1,0,3,3,5,4,0,2,2,2,0,1,0,1,1,0,0,2,0,0,1,2,1,0.6,0.4,3,1.2,0.6,0.6,1,1.35,6,6,1,0,-1,3,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),48,0,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,02REV,1,-1,-2,-2,-1,1,-1,-1,0,0,-1,1,-1,-1,2,0,-1,0,0,0,-1,-0.2,0,-0.2,-0.35 +273,R_7K9iTpqYzeRz5ew,39 - 45,Canadian,Female,3,2,1,2,3,-2,-2,2,-2,2,2,1,1,-3,3,-3,-3,-3,-3,-3,3,2,2,-3,3,7,-3,-3,2,1,1,8,-1,-2,3,-2,2,5,-3,-3,-3,-3,-3,8,2,2,1,3,-1,5,-3,-3,1,-3,0,4,1,0,3,-3,2,3,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,96,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,89,FALSE,1,100,TRUE,1,100,FALSE,0,57,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,62,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,1,0,0,0.3249,0,0,0,0,0,0,0,0.1444,0,0,0,0.0016,0.0121,1,0,0.3844,0,0,0,0,1,1,0.173835714,0.10495,0.242721429,24,75,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,95.81,88.62,100,94.62,100,97.06,94.56,-6.25,14.56,1.12,12.5,19.62,25,9.56,19.56,0,0,1,5,0,1,1,0,3,1,3,3,2,1,1,0,0,0,0,0,1,0,0,1,4,1,1,1,1,2,1,1,2,0,1,0,0,0,0,0,1.2,1.2,2,0,1.2,1.2,1,0,1.1,0.85,6.67,4,2,4,2,3,2.67,15 cents,5 minutes,24 days,Female,University - Graduate (Masters),45,0.875,0,1,0,0,0,1,0.33,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,0,1,4,-4,0,0,-1,2,-1,2,2,0,1,0,0,0,0,0,0,0,0,1,0,0.25 +274,R_3PIfTQUOYJNg6P3,60 - 66,American,Male,-1,0,3,2,3,1,1,3,-2,3,1,3,2,0,1,2,2,2,2,2,1,2,2,2,2,2,2,1,3,1,2,1,1,2,2,2,2,0,2,2,2,3,2,2,-1,1,2,3,3,1,2,1,3,0,2,0,1,3,2,0,2,0,2,2,2,2,3,2,TRUE,0,91,TRUE,1,100,FALSE,1,100,FALSE,1,87,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,95,TRUE,1,98,0,0,0,0,0.0004,0,0,1,0,0,1,0,0,0,0.0064,0,0,0.0169,0,0,0,0.0049,1,0,0,0.1369,0.0025,0.8281,0,0,1,0,0.178432143,0.14455,0.212314286,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,97.47,92.25,98.75,98.88,100,98.62,96.31,3.12,13.09,4.75,11.25,23.88,12.5,11.12,15.06,2,2,1,0,1,1,0,0,3,1,0,1,0,2,1,0,0,0,1,0,0,1,1,1,0,1,0,0,2,1,0,0,0,0,1,0,0,0,0,1,1.2,1,0.8,0.2,0.6,0.8,0.2,0.2,0.8,0.45,1,0.33,1,1,0,0,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,66,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,2,1,0,-1,1,0,0,0,1,0,0,1,0,2,0,0,0,0,1,-1,0.6,0.2,0.6,0,0.35 +275,R_624VMp6OYkzBtLP,67 - 73,American,Female,3,1,3,1,3,-2,-2,3,-2,1,3,1,3,-2,3,0,1,1,1,-2,3,3,1,0,3,7,-3,-3,3,-3,2,7,2,3,3,0,3,7,-2,-2,-2,1,-2,7,3,3,3,3,1,6,-2,-3,3,0,1,5,2,2,3,-2,3,5,-1,0,0,1,-2,5,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,90,TRUE,1,90,TRUE,0,60,TRUE,0,75,TRUE,1,75,FALSE,1,75,TRUE,1,85,TRUE,1,100,FALSE,1,60,FALSE,1,75,FALSE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,85,FALSE,1,75,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.01,0,0,0,0.01,0,0,0,0.0625,0.01,0.36,0.01,0.01,0,0.36,0.0625,0,0.0625,0.0225,0.0625,0.0625,0.16,0.0225,0,0,0,0.0625,1,0.5625,0.103660714,0.05875,0.148571429,16,50,28,87.5,6,75,7,87.5,8,100,7,87.5,16,100,12,75,88.28,80.62,87.5,91.25,93.75,92.81,83.75,-37.5,0.78,5.62,0,-8.75,6.25,-7.19,8.75,0,2,2,1,0,1,1,0,1,1,1,2,0,2,0,2,3,3,0,0,0,2,0,2,2,0,1,0,2,0,1,1,0,0,0,1,1,1,0,0,1,0.8,1,1.6,1.2,0.6,0.4,0.6,1.1,0.7,7,5.33,1,2,2,2,1.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),69,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,2,-1,-2,1,0,0,-1,1,0,1,0,2,0,1,2,2,0,0,-0.2,0.2,0.6,1,0.4 +276,R_6Ec2nE6EMk7EaE9,32 - 38,American,Female,2,2,3,-1,2,-2,-2,2,1,1,1,0,0,-1,1,-1,1,0,-1,0,1,2,3,-1,2,1,-1,-2,1,1,1,1,1,1,0,0,1,1,0,1,1,-1,1,1,2,2,3,-1,2,2,-1,-2,2,-1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,TRUE,0,70,TRUE,1,88,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,90,TRUE,1,85,TRUE,1,100,FALSE,0,50,FALSE,0,95,FALSE,1,60,FALSE,1,92,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,0,86,FALSE,1,50,FALSE,1,50,FALSE,0,60,TRUE,1,50,FALSE,1,75,TRUE,1,77,FALSE,1,95,TRUE,1,87,TRUE,0,50,FALSE,1,60,TRUE,0,77,TRUE,1,86,FALSE,0,66,TRUE,1,100,0,0.0169,0.25,0.0225,0,0.01,0.0529,0.9025,0.25,0.25,0.0196,0.25,0.25,0.16,0.25,0.0144,0.0625,0.25,0.16,0.0025,0.36,0.25,0.25,0.25,0.25,0.25,0.4356,0.49,1,0.7396,0.5929,0.0064,0.277103571,0.194421429,0.359785714,12,37.5,20,62.5,5,62.5,4,50,5,62.5,6,75,10,62.5,10,62.5,70.28,58,69,77.25,76.88,71.5,69.06,-25,7.78,-4.5,19,14.75,1.88,9,6.56,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,2,0,0,0,1,1,0,2,0,1,2,1,0.2,0.4,0.4,0.6,0,0.6,0.4,1.2,0.4,0.55,1,1.33,-1,0,0,0,-0.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,37,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,0,0,0,0,0,0,1,-2,0,0,1,-1,0,0,-1,0,0,-2,0,0.2,-0.2,0,-0.6,-0.15 +277,R_13fH2HE7LMaeZmx,53 - 59,Canadian,Male,-2,2,2,-1,3,-1,1,1,0,1,0,1,1,1,0,-1,0,0,1,-1,-3,1,2,-3,1,6,0,1,0,1,0,5,0,0,0,1,0,5,-1,1,-1,0,-1,6,0,1,1,1,1,6,-1,0,0,0,0,5,2,0,0,-1,0,5,0,-1,0,1,-1,5,TRUE,0,57,FALSE,0,54,TRUE,0,94,FALSE,1,64,FALSE,0,54,FALSE,1,68,TRUE,1,94,TRUE,1,91,FALSE,0,56,TRUE,1,92,FALSE,1,97,TRUE,0,86,FALSE,0,75,TRUE,0,81,FALSE,0,60,TRUE,1,95,TRUE,0,65,TRUE,0,91,TRUE,0,85,FALSE,1,86,FALSE,0,85,TRUE,1,80,FALSE,1,56,FALSE,0,56,FALSE,1,61,TRUE,1,88,FALSE,1,55,TRUE,0,84,TRUE,0,55,TRUE,1,90,TRUE,1,63,FALSE,0,85,0.0081,0.0144,0.0025,0.0036,0.7225,0.1024,0.3136,0.0064,0.0196,0.04,0.01,0.5625,0.3136,0.0009,0.2916,0.2916,0.1936,0.1296,0.7056,0.1521,0.7225,0.36,0.7225,0.6561,0.4225,0.2025,0.1369,0.3249,0.8836,0.8281,0.3025,0.7396,0.362760714,0.214135714,0.511385714,12,37.5,15,46.88,4,50,2,25,5,62.5,4,50,8,50,7,43.75,75.09,66.75,67.88,80.5,85.25,76.12,74.06,-9.38,28.21,16.75,42.88,18,35.25,26.12,30.31,1,1,0,2,2,1,0,1,1,1,0,1,1,0,0,0,1,1,1,0,2,1,1,2,2,0,1,1,0,1,2,1,1,2,0,1,1,0,0,0,1.2,0.8,0.4,0.6,1.6,0.6,1.2,0.4,0.75,0.95,5.33,5.33,0,0,0,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),53,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,-1,0,-1,0,0,1,-1,0,1,0,-2,0,0,-2,0,-1,0,1,1,0,-0.4,0.2,-0.8,0.2,-0.2 +278,R_3JdXuxYOg4c8Y35,53 - 59,American,Female,0,-1,1,1,-3,0,0,1,1,0,-1,1,2,0,1,0,0,-3,0,-2,1,0,1,1,-2,5,0,1,1,0,0,5,-1,1,1,0,1,5,0,0,0,0,-2,6,2,0,1,2,-3,5,0,0,2,0,1,5,-2,1,2,0,2,6,0,1,0,1,0,5,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,0,53,TRUE,1,55,FALSE,1,53,TRUE,1,91,TRUE,1,100,FALSE,0,54,FALSE,0,54,FALSE,1,52,FALSE,1,52,FALSE,0,52,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,67,TRUE,0,100,FALSE,1,53,FALSE,1,68,FALSE,0,100,TRUE,1,75,FALSE,1,100,FALSE,0,51,FALSE,1,100,TRUE,1,79,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,0,0.0441,0,0.0081,0,0.2209,0.2601,0.2916,0.1024,0.0625,0,0.2704,0.2916,0.2304,0.2025,0,0,0.2809,0,0,1,0.25,0.2209,1,0.1089,0.2304,0.0064,0.2025,0,1,1,0.2304,0.266528571,0.158092857,0.374964286,17,53.13,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,10,62.5,12,75,76.81,63.25,78.38,81.75,83.88,78.31,75.31,-15.62,8.06,0.75,15.88,19.25,-3.62,15.81,0.31,1,1,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,3,0,0,2,1,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1,3,1,2,0.6,0.4,0.2,0.6,0.8,0.6,0.4,1.4,0.45,0.8,5,5.33,0,0,-1,1,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,0.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,-1,0,0,-1,1,0,1,-1,0,-1,-1,0,1,0,-1,0,-1,0,-1,-2,-0.2,-0.2,-0.2,-0.8,-0.35 +279,R_5NmG2cp8T5XW0u0,67 - 73,American,Female,1,1,2,0,2,1,-2,2,1,0,2,1,0,1,3,1,2,1,2,1,1,0,2,-2,0,6,1,0,3,2,1,6,2,3,1,-2,3,6,0,0,0,1,0,8,0,-1,3,1,0,5,0,-1,1,0,0,4,2,2,2,-2,3,6,0,0,0,2,0,1,TRUE,0,100,TRUE,1,100,TRUE,0,92,FALSE,1,65,TRUE,1,87,FALSE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,86,FALSE,0,100,TRUE,0,76,TRUE,0,100,TRUE,1,84,TRUE,0,90,TRUE,1,92,TRUE,1,100,TRUE,0,89,FALSE,1,100,TRUE,0,90,FALSE,1,81,TRUE,1,81,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,88,TRUE,0,80,FALSE,1,77,TRUE,0,99,TRUE,1,89,FALSE,0,58,TRUE,1,100,0,0.0144,0,0,0,0.0001,0,1,0.0361,0.0361,0.0121,0.0256,0.0196,0.5776,0.0169,0,0,0.1225,0.0529,1,0.0361,0.0064,0.81,0.81,0.7921,0.64,0.3364,1,0.8464,0,0.9801,1,0.36275,0.1319,0.5936,21,65.63,20,62.5,4,50,6,75,4,50,6,75,14,87.5,6,37.5,90.12,80.88,92.38,94.88,92.38,90.38,89.88,3.13,27.62,30.88,17.38,44.88,17.38,2.88,52.38,0,1,0,2,2,0,2,1,1,1,0,2,1,3,0,1,2,1,1,1,1,2,1,1,2,1,1,1,1,0,0,1,2,3,0,1,2,1,0,1,1,1,1.2,1.2,1.4,0.8,1.2,1,1.1,1.1,6,5,1,2,0,7,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,71,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,-1,-1,-1,1,0,-1,1,0,0,1,0,1,-1,0,0,0,0,0,1,0,-0.4,0.2,0,0.2,0 +280,R_30diGYhBfh1dGSd,60 - 66,Canadian,Female,1,1,3,-2,1,-2,-2,2,1,-2,1,1,1,-1,2,-1,-1,1,1,1,-1,-1,3,2,2,9,-1,1,1,-1,1,9,1,1,1,1,2,8,-1,-1,1,1,1,8,1,1,2,1,-1,9,-2,1,0,1,-2,9,-2,1,-2,-2,2,9,-2,-3,0,-1,-1,9,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,77,FALSE,0,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,80,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,77,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,72,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0,0,0,0,0,0,0,1,0.0529,0,0,0,1,1,0.5929,0,0,0.0529,0,1,1,0.64,1,1,0,0.0784,0.0324,1,1,1,0,1,0.444625,0.264192857,0.625057143,24,75,19,59.38,4,50,6,75,3,37.5,6,75,11,68.75,8,50,95.78,88.88,97.12,100,97.12,96.19,95.38,15.62,36.4,38.88,22.12,62.5,22.12,27.44,45.38,2,2,0,4,1,1,3,1,2,3,0,0,0,2,0,0,0,0,0,0,0,0,1,3,2,0,3,2,0,0,3,0,3,1,0,1,2,1,2,2,1.8,2,0.4,0,1.2,1,1.4,1.6,1.05,1.3,8.67,9,0,0,-1,-1,-0.33,5 cents,25 minutes,47 days,Female,University - Undergraduate,63,0.5,1,0,1,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,2,-1,1,-1,1,0,-1,2,3,-3,0,-3,1,0,-1,-2,-1,-2,-2,0.6,1,-1,-1.6,-0.25 +281,R_7YY9n2jk9GxsOtB,60 - 66,American,Female,2,2,3,2,2,3,-2,2,0,2,2,2,2,-2,1,1,1,1,-1,1,3,3,2,2,2,5,2,-2,2,-1,1,5,2,2,2,-2,2,5,2,-2,-1,-2,-2,4,2,2,3,2,2,3,2,-2,2,1,2,5,2,2,2,-2,2,5,1,1,1,-2,1,5,TRUE,0,59,TRUE,1,95,TRUE,0,86,FALSE,1,54,TRUE,1,53,FALSE,1,96,TRUE,1,100,TRUE,1,96,FALSE,0,57,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,84,TRUE,0,92,FALSE,0,82,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,0,95,FALSE,1,100,TRUE,1,97,TRUE,1,74,FALSE,1,67,TRUE,1,95,FALSE,1,66,TRUE,1,89,FALSE,1,65,FALSE,1,82,TRUE,0,79,TRUE,1,100,FALSE,0,57,TRUE,1,100,0.0016,0.0121,0,0,0,0.0016,0.0025,0,0,0.0676,0,0.0256,0.3249,0.1849,0.2209,0.0025,0.1089,0.2116,0.0324,0.1156,0.0009,0.6724,0.9025,0.8464,0.0784,0.1225,0.3249,0.3481,0.7396,1,0.6241,1,0.284242857,0.082214286,0.486271429,22,68.75,22,68.75,4,50,7,87.5,5,62.5,6,75,13,81.25,9,56.25,82.78,70.25,81,85,94.88,86.19,79.38,0,14.03,20.25,-6.5,22.5,19.88,4.94,23.13,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,3,2,1,3,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0.6,0.6,0.2,2,0,0.4,0.2,0.2,0.85,0.2,5,4.33,2,0,0,-1,0.67,10 cents,5 minutes,24 days,Female,High School (or equivalent),63,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,3,2,0,3,0.6,0.2,0,1.8,0.65 +282,R_3GfymnrK9od8RuX,53 - 59,American,Female,2,1,2,2,1,-3,-2,3,-3,-1,2,2,2,-2,2,1,1,2,2,2,3,-1,2,2,3,9,-3,-2,2,-3,1,8,2,2,2,-2,2,8,1,1,2,1,2,7,2,0,3,3,1,9,-3,-2,1,-3,-1,7,2,3,2,-3,2,8,1,1,2,2,2,8,TRUE,0,98,TRUE,1,96,FALSE,1,98,FALSE,1,50,TRUE,1,76,FALSE,1,100,TRUE,1,88,TRUE,1,100,TRUE,1,50,TRUE,1,97,FALSE,1,87,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,94,TRUE,0,50,TRUE,0,50,TRUE,1,90,TRUE,1,83,TRUE,0,91,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,87,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0.0144,0,0,0.0196,0.0009,0.25,0.0289,0,0,0.25,0.0169,0.0576,0.0016,0.8281,0.25,0,0,0.01,0.25,0.25,0,0.0625,0.25,0.25,0.9604,0.0004,0.0036,0.0169,1,0.169907143,0.121685714,0.218128571,26,81.25,25,78.13,5,62.5,7,87.5,7,87.5,6,75,15,93.75,10,62.5,84.25,60.38,89.88,95,91.75,85.38,83.12,3.12,6.12,-2.12,2.38,7.5,16.75,-8.37,20.62,1,2,0,0,2,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,1,0.6,0,0.2,0.6,0.4,0.4,0,0.45,0.35,8.33,8,0,1,0,-1,0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,59,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,1,1,-1,-1,2,0,0,-1,0,2,0,-1,0,-1,0,0,0,0,1,0,0.4,0.2,-0.4,0.2,0.1 +283,R_3ASUzEPdUYTIVmB,60 - 66,Canadian,Male,-2,2,2,0,1,0,-1,2,-1,1,1,1,2,0,2,-1,-1,1,1,-2,-2,2,2,-2,0,3,1,-2,2,-2,1,3,1,2,2,0,2,7,-1,-1,1,1,-2,7,0,2,2,1,0,4,0,-1,0,-1,0,5,1,1,1,-1,2,7,-1,-1,-1,0,-2,7,TRUE,0,100,FALSE,0,80,TRUE,0,100,FALSE,1,60,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,FALSE,0,70,FALSE,1,50,TRUE,1,100,FALSE,1,91,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,91,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.49,0.8281,0,0.25,0,0.25,0.64,0.25,0.16,0,0.0081,0,0.25,0.09,0.25,0,0.25,0,1,1,1,0.25,1,0.284507143,0.204864286,0.36415,24,75,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,10,62.5,12,75,84.75,70,81.25,88.88,98.88,86.94,82.56,6.25,16,7.5,-6.25,26.38,36.38,24.44,7.56,0,0,0,2,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,2,0,1,0,0,1,1,0,0,0,2,1,0,0.6,0.6,0.2,0,0.8,0.6,0.4,0.6,0.35,0.6,4.33,5.33,-1,-2,0,0,-1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,65,0.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-2,0,0,1,0,1,1,-2,1,-1,0,1,-1,-1,0,0,0,-2,-1,0,-0.2,0,-0.2,-0.6,-0.25 +284,R_6NZYksdGLAmX51p,67 - 73,Canadian,Female,3,3,2,2,1,1,0,1,0,1,2,1,3,0,3,-1,-1,1,1,-1,3,3,3,3,1,4,2,-1,3,-1,1,1,2,2,3,-1,3,2,2,2,2,1,2,6,3,3,3,3,-1,3,1,-1,2,0,1,8,2,2,2,-2,3,3,2,-1,0,2,2,3,FALSE,1,59,TRUE,1,100,TRUE,0,100,FALSE,1,57,FALSE,0,53,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,0,53,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,55,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0.04,0,0,0,0,0,0,0.2809,0,0.2809,0,0.36,0.1849,0.16,1,0.04,0.3025,1,1,0.64,0.3025,0.36,0.1681,1,1,1,1,0.361421429,0.081907143,0.640935714,20,62.5,18,56.25,3,37.5,4,50,5,62.5,6,75,12,75,6,37.5,86,72.5,81.62,94.88,95,87.56,84.44,6.25,29.75,35,31.62,32.38,20,12.56,46.94,0,0,1,1,0,1,1,2,1,0,0,1,0,1,0,3,3,1,0,3,0,0,1,1,2,0,1,1,0,0,0,1,1,2,0,3,0,1,1,3,0.4,1,0.4,2,0.8,0.4,0.8,1.6,0.95,0.9,2.33,4.67,1,-7,-1,3,-2.34,10 cents,100 minutes,24 days,Female,Trade School (non-military),68,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,0,-2,1,0,1,1,0,0,0,-1,-1,0,0,3,0,-1,0,-0.4,0.6,-0.4,0.4,0.05 +285,R_5mEnAkIrRgTZ6SP,60 - 66,Canadian,Female,0,1,3,-2,1,1,-2,1,-1,3,2,1,2,2,1,1,2,2,3,2,2,1,1,-1,1,7,3,-2,0,-3,3,8,2,2,1,-2,2,4,2,2,2,1,1,8,0,2,2,2,-2,8,2,1,1,1,0,7,-1,1,2,-2,1,7,2,-2,2,3,2,4,TRUE,0,92,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,86,FALSE,1,100,TRUE,1,100,TRUE,1,51,TRUE,1,90,TRUE,1,100,TRUE,0,91,TRUE,0,91,TRUE,1,70,FALSE,1,100,FALSE,0,52,TRUE,1,93,TRUE,0,87,FALSE,1,100,TRUE,0,98,TRUE,0,50,FALSE,0,100,TRUE,1,66,FALSE,1,100,TRUE,1,99,FALSE,1,100,TRUE,1,98,FALSE,1,62,FALSE,1,100,TRUE,0,95,FALSE,0,96,TRUE,1,100,TRUE,1,100,0.2401,0.0004,0.0049,0,0,0,0.0001,0,0.25,0.1156,0.9216,0.09,0.01,0.8281,0.7396,0,0,0.25,0,0,1,0.2704,0.9604,0,0.7569,0.1444,0,0.8464,0,0,0.9025,0.8281,0.318360714,0.228928571,0.407792857,27,84.38,21,65.63,5,62.5,4,50,7,87.5,5,62.5,12,75,9,56.25,88.03,80.38,92.25,94.5,85,87.56,88.5,18.75,22.4,17.88,42.25,7,22.5,12.56,32.25,2,0,2,1,0,2,0,1,2,0,0,1,1,4,1,1,0,0,2,1,0,1,1,4,3,1,3,0,2,3,3,0,0,4,0,1,4,0,0,0,1,1,1.4,0.8,1.8,1.8,1.4,1,1.05,1.5,6.33,7.33,-1,1,-3,4,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),60,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,2,-1,1,-3,-3,1,-3,1,0,-3,-3,1,1,0,1,0,-4,0,2,1,-0.8,-0.8,0,-0.2,-0.45 +286,R_3FhNNeBDsPUEbj5,53 - 59,American,Male,0,2,2,-2,2,-2,1,1,1,1,1,-2,2,-2,2,-2,-1,-1,-1,-2,-1,2,2,-2,2,4,-2,1,-1,1,2,3,1,-2,2,-1,2,4,-2,-2,-2,-2,-2,6,0,1,1,0,2,5,-2,-1,-1,-1,1,3,1,-2,2,-2,2,2,-1,-1,-1,1,-1,5,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,0,60,TRUE,1,60,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,1,0,0.09,0,0,0,0,0,0,0,0,0,0,0.16,0.0841,0.25,0.36,0,1,0,0.25,0.25,0,0.25,1,0.25,0,0,0,1,1,0.209075,0.061007143,0.357142857,25,78.13,22,68.75,3,37.5,6,75,6,75,7,87.5,13,81.25,9,56.25,87.84,72.62,82.5,96.25,100,87.56,88.12,9.38,19.09,35.12,7.5,21.25,12.5,6.31,31.87,1,0,0,0,0,0,0,2,0,1,0,0,0,1,0,0,1,1,1,0,0,1,1,2,0,0,2,2,2,0,0,0,0,0,0,1,0,0,2,1,0.2,0.6,0.2,0.6,0.8,1.2,0,0.8,0.4,0.7,3.67,3.33,-1,0,2,1,0.34,10 cents,5 minutes,15 days,Male,College Diploma/Certificate,55,1.5,0,1,0,1,0,0,0.33,0.33,03VLPfPs,02COC,02FUT,01ITEM,02REV,1,-1,-1,-2,0,0,-2,0,-2,1,0,0,0,1,0,-1,1,1,-1,-1,-0.6,-0.6,0.2,-0.2,-0.3 +287,R_7gdKYBE0dYWcE3j,60 - 66,American,Female,1,3,3,1,3,1,-1,2,1,3,2,0,3,1,3,-3,-3,-2,0,-3,3,3,3,1,-1,1,2,-2,3,0,3,5,2,2,2,1,3,4,-3,-3,-3,1,-3,5,3,3,3,3,0,0,0,-3,0,-3,1,7,3,3,3,3,3,7,-2,-2,0,-2,-3,2,FALSE,1,99,TRUE,1,62,FALSE,1,100,FALSE,1,64,TRUE,1,65,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,76,TRUE,1,95,FALSE,1,84,TRUE,0,89,TRUE,1,99,FALSE,1,100,TRUE,1,73,TRUE,1,100,FALSE,1,91,FALSE,1,100,TRUE,0,100,TRUE,0,66,FALSE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,92,FALSE,0,74,TRUE,0,88,TRUE,0,75,TRUE,0,100,FALSE,0,90,TRUE,1,97,TRUE,1,100,0,0.5476,0,0.0324,0,0,0,0.0025,0.4356,0,0.81,0.0001,0.0576,0.0256,0.1225,0.1444,1,0.1296,0.5625,0.0064,0.81,0.0729,1,0,0.0081,0.7744,0.0009,0.0001,0,0,1,0.7921,0.276975,0.19485,0.3591,16,50,22,68.75,6,75,5,62.5,7,87.5,4,50,13,81.25,9,56.25,89.09,80.5,93.12,92.75,90,87.69,90.5,-18.75,20.34,5.5,30.62,5.25,40,6.44,34.25,2,0,0,0,4,1,1,1,1,0,0,2,1,0,0,0,0,1,1,0,2,0,0,2,3,1,2,2,4,2,1,3,0,2,0,1,1,2,2,0,1.2,0.8,0.6,0.4,1.4,2.2,1.2,1.2,0.75,1.5,3.33,4.67,1,-2,-3,3,-1.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,66,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-2,1,0,-1,-1,-3,-2,-1,-1,1,-2,0,-1,-1,-1,-1,0,-0.2,-1.4,-0.6,-0.8,-0.75 +288,R_1aftuJyleCr7sbn,67 - 73,Canadian,Male,2,2,2,1,-1,-1,-2,0,1,0,1,1,1,-1,1,-3,-1,-2,-1,-2,1,1,2,0,-3,2,-1,1,-1,1,-1,4,2,2,1,-1,2,3,-2,-2,-2,-2,-2,5,1,1,1,1,-2,2,0,0,1,1,-1,5,1,1,2,-1,0,3,-2,-2,-2,-2,-2,3,TRUE,0,100,TRUE,1,66,FALSE,1,100,FALSE,1,100,TRUE,1,59,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,87,FALSE,0,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,FALSE,1,100,TRUE,0,82,TRUE,0,89,FALSE,1,91,FALSE,0,95,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,81,FALSE,0,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,1,0.0081,0,1,1,1,1,0.1681,0.1156,0.01,0,0,1,0.9025,0.1681,0.7921,0,0,0.7744,1,1,0,0.6724,0.6561,0.7569,0.465153571,0.3787,0.551607143,26,81.25,18,56.25,3,37.5,5,62.5,4,50,6,75,10,62.5,8,50,93.34,87.75,90.62,97.75,97.25,92.44,94.25,25,37.09,50.25,28.12,47.75,22.25,29.94,44.25,1,1,0,1,2,0,3,1,0,1,1,1,0,0,1,1,1,0,1,0,1,1,1,0,1,1,2,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0.6,0.6,0.8,1,0.4,0.6,0.8,0.7,3,3.33,0,-1,0,2,-0.33,10 cents,100 minutes,24 days,Male,Trade School (non-military),67,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,-1,1,1,-1,1,0,0,0,1,1,-1,0,0,0,0,0,0,0,0.2,0,0.2,0,0.1 +289,R_38UI4Nfo4ZxgWvT,60 - 66,Canadian,Male,3,3,3,-1,1,-2,0,2,-2,1,1,0,2,0,0,1,1,2,1,1,3,3,3,-2,1,6,-2,-2,2,-2,1,3,1,0,2,1,0,2,-1,-1,-1,-1,0,3,3,3,3,0,1,3,-2,0,2,-2,1,2,1,0,2,0,0,2,1,1,1,1,0,2,TRUE,0,85,TRUE,1,85,TRUE,0,59,TRUE,0,57,TRUE,1,62,FALSE,1,91,TRUE,1,77,TRUE,1,70,TRUE,1,94,TRUE,1,92,TRUE,0,59,FALSE,1,88,TRUE,1,90,FALSE,1,100,TRUE,1,59,TRUE,1,100,FALSE,1,100,FALSE,1,81,FALSE,1,73,FALSE,1,100,FALSE,0,85,TRUE,1,95,TRUE,0,86,TRUE,1,89,FALSE,1,88,TRUE,1,95,TRUE,0,79,FALSE,1,100,TRUE,0,100,FALSE,0,90,TRUE,1,87,TRUE,1,100,0.09,0.0025,0,0.0529,0,0.0081,0.0121,0.0064,0,0.0025,0.81,0.01,0.0036,0.3481,0.1444,0.0225,0.7396,0.3249,0,0.0144,0.7225,0.1681,0.0729,0,0,0.6241,0.0169,0.7225,0.3481,0.0361,1,0.0144,0.220435714,0.173728571,0.267142857,21,65.63,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,84.88,74.12,89.25,89.12,87,85.62,84.12,-6.25,13,11.62,26.75,1.62,12,-1.88,27.87,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,2,2,3,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0.2,0.4,0.2,2,0.2,0,0,0.4,0.7,0.15,3.67,2.33,3,1,0,1,1.34,5 cents,5 minutes,24 days,Male,University - Undergraduate,62,0.625,1,1,0,0,0,1,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,2,2,2,2,0,0,0.4,0.2,1.6,0.55 +290,R_5wjoMyBPGjBVmtp,53 - 59,American,Male,2,1,-1,0,3,2,-2,1,1,1,3,3,3,2,3,-2,-2,-2,-3,-3,3,1,2,-2,1,3,1,1,2,2,0,4,1,3,2,3,1,2,2,1,2,2,1,8,1,1,-3,2,2,4,-2,1,1,3,-1,6,1,2,2,-2,1,4,-3,-3,-3,-3,-3,9,TRUE,0,100,TRUE,1,85,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,85,TRUE,1,65,FALSE,1,80,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,TRUE,0,80,TRUE,0,50,FALSE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,70,TRUE,1,85,FALSE,1,90,TRUE,1,100,FALSE,1,50,TRUE,0,75,TRUE,0,70,TRUE,1,95,TRUE,1,75,TRUE,1,85,0,0,0,0,0.0225,0,0.0225,0.1225,0.01,0,0.0025,0,0.0225,0.04,0,0.0225,0.09,0.25,0.5625,0.01,0,0.25,0.25,0,0.09,0.25,0.0625,1,1,0.64,0.49,0.36,0.198928571,0.043214286,0.354642857,26,81.25,25,78.13,7,87.5,7,87.5,6,75,5,62.5,16,100,9,56.25,83.12,65.62,86.88,91.88,88.12,89.06,77.19,3.12,4.99,-21.88,-0.62,16.88,25.62,-10.94,20.94,1,0,3,2,2,1,3,1,1,1,2,0,1,1,2,4,3,4,5,4,1,0,2,2,1,4,3,0,2,2,2,1,1,4,2,1,1,1,0,0,1.6,1.4,1.2,4,1.2,2.2,2,0.6,2.05,1.5,3,4.67,-1,-2,-2,-1,-1.67,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),55,1.25,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,1,0,1,-3,0,1,-1,-1,0,-1,0,-3,0,3,2,3,5,4,0.4,-0.8,-0.8,3.4,0.55 +291,R_7Pmtr9gYRDIqooh,67 - 73,Canadian,Female,-3,1,3,-3,2,0,-3,2,-2,1,3,1,2,1,3,-2,-2,-1,-3,-3,-3,1,3,-3,2,2,0,-3,2,0,2,6,3,1,3,2,3,2,-2,-3,-2,-2,-3,2,-3,0,3,2,1,8,0,-2,2,0,1,8,3,1,2,1,3,1,-3,-2,-2,-3,-3,9,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,95,FALSE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,95,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,95,TRUE,1,50,TRUE,1,100,0.25,0.25,0,0.0025,0,0.25,0.25,0,0.25,0.25,0.0025,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9025,1,0.25,0.25,0.25,1,1,1,0.25,1,0.371607143,0.17875,0.564464286,25,78.13,16,50,5,62.5,4,50,4,50,3,37.5,12,75,4,25,68.28,55.62,62.5,80.62,74.38,68.12,68.44,28.13,18.28,-6.88,12.5,30.62,36.88,-6.88,43.44,0,0,0,0,0,0,0,0,2,1,0,0,1,1,0,0,1,1,1,0,0,1,0,5,1,0,1,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0.6,0.4,0.6,1.4,0.6,0,0.4,0.4,0.6,3.33,5.67,-6,-2,1,-7,-2.34,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,1.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,-5,-1,0,-1,0,0,1,0,0,1,1,0,-1,1,0,1,0,-1.4,0,0.4,0.2,-0.2 +292,R_7lWWWaqjZyxbpRv,53 - 59,American,Female,1,3,1,2,3,3,-3,3,-2,3,2,-1,2,1,3,3,3,3,2,-2,3,1,2,-3,1,7,1,1,3,1,-1,8,2,2,2,1,2,4,-2,-2,-2,-2,-2,9,2,3,1,0,3,2,3,-3,3,-3,3,1,3,-1,3,1,3,1,3,3,3,2,-1,1,TRUE,0,70,TRUE,1,93,FALSE,1,95,TRUE,0,65,FALSE,0,60,FALSE,1,99,TRUE,1,97,TRUE,1,96,FALSE,0,73,TRUE,1,98,TRUE,0,91,TRUE,0,96,TRUE,1,87,TRUE,0,97,TRUE,1,78,TRUE,1,79,FALSE,1,81,FALSE,1,94,TRUE,0,88,TRUE,0,73,FALSE,0,86,TRUE,1,91,FALSE,1,67,TRUE,1,92,TRUE,0,89,TRUE,1,96,FALSE,1,61,TRUE,0,83,FALSE,1,61,TRUE,1,89,FALSE,0,68,TRUE,1,98,0.0016,0.0016,0.0441,0.0009,0.0004,0.0001,0.0064,0.0004,0.5329,0.0081,0.0121,0.0169,0.5329,0.8281,0.36,0.0049,0.1089,0.4225,0.6889,0.7921,0.7396,0.0484,0.7744,0.9409,0.0361,0.1521,0.4624,0.49,0.0025,0.0036,0.1521,0.9216,0.322832143,0.202471429,0.443192857,18,56.25,19,59.38,3,37.5,6,75,5,62.5,5,62.5,12,75,7,43.75,84.09,77.12,79.88,91.5,87.88,86.31,81.88,-3.13,24.71,39.62,4.88,29,25.38,11.31,38.13,2,2,1,5,2,2,4,0,3,4,0,3,0,0,1,5,5,5,4,0,1,0,0,2,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,2.4,2.6,0.8,3.8,0.6,0.2,0.4,0.2,2.4,0.35,6.33,1.33,5,7,3,8,5,10 cents,5 minutes,24 days,Female,High School (or equivalent),57,1.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,2,1,3,2,2,4,0,2,4,-1,3,-1,0,1,5,5,5,4,-1,1.8,2.4,0.4,3.6,2.05 +293,R_63D332NuCPnFAOe,32 - 38,Canadian,Female,1,3,3,3,2,2,1,3,1,2,3,3,3,-1,3,2,1,-2,-2,-1,3,3,3,3,3,6,3,0,2,-3,2,3,2,3,3,-1,3,4,0,1,1,-3,1,5,3,3,3,3,3,0,2,2,3,2,2,0,2,3,2,-1,3,0,1,1,1,2,-3,0,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0.25,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0.25,1,0.232142857,0.160714286,0.303571429,32,100,25,78.13,8,100,4,50,7,87.5,6,75,15,93.75,10,62.5,96.88,93.75,93.75,100,100,96.88,96.88,21.87,18.75,-6.25,43.75,12.5,25,3.13,34.38,2,0,0,0,1,1,1,1,4,0,1,0,0,0,0,2,0,3,1,2,2,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,3,4,2,0.6,1.4,0.2,1.6,0.6,0.4,0.4,2,0.95,0.85,4.33,0,6,3,4,5,4.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),35,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,1,0,1,3,0,0,0,-1,0,0,1,0,0,-3,0,0,1,-0.2,-0.4,0.1 +294,R_3v32TkdVqdL7noW,53 - 59,Canadian,Female,0,1,2,1,1,-2,0,1,0,1,2,2,1,0,2,1,1,1,1,0,0,2,2,2,1,3,0,0,2,0,2,3,2,0,0,0,2,4,1,1,0,0,0,3,0,1,2,1,1,4,-2,-2,2,0,1,3,2,2,2,-1,2,3,2,1,1,1,2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0.178571429,0.071428571,0.285714286,32,100,27,84.38,8,100,5,62.5,8,100,6,75,15,93.75,12,75,100,100,100,100,100,100,100,15.62,15.62,0,37.5,0,25,6.25,25,0,1,0,1,0,2,0,1,0,1,0,2,1,0,0,0,0,1,1,0,0,0,0,0,0,0,2,1,0,0,0,0,1,1,0,1,0,0,0,2,0.4,0.8,0.6,0.4,0,0.6,0.4,0.6,0.55,0.4,3.33,3.33,-1,0,1,0,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,54,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,1,0,1,0,2,-2,0,0,1,0,2,0,-1,0,-1,0,1,1,-2,0.4,0.2,0.2,-0.2,0.15 +295,R_5J9jfdbOIc1QKDy,67 - 73,American,Female,1,-1,-1,-2,-1,-1,-1,2,-2,-1,3,3,2,2,2,-1,-2,-1,1,-2,2,0,2,-2,-2,1,0,0,3,-3,0,1,3,3,2,2,3,0,-2,-3,-2,-1,-3,6,0,0,0,-3,-3,1,0,-2,3,-2,0,1,3,3,3,2,3,1,-2,-3,-1,0,-3,1,FALSE,1,96,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,69,FALSE,1,100,FALSE,0,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,81,TRUE,0,90,TRUE,0,90,FALSE,1,90,FALSE,0,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,50,FALSE,1,80,FALSE,1,80,TRUE,1,100,FALSE,0,70,TRUE,1,100,0,1,0,0,0,0,0,0,0.01,0,0,1,0.16,0.4761,0.25,0,0,0.25,0.04,0,0.81,0.25,0.81,1,0.0361,0.25,0.49,0.0016,1,0.81,0.04,0,0.274421429,0.153292857,0.39555,25,78.13,21,65.63,3,37.5,6,75,5,62.5,7,87.5,11,68.75,10,62.5,87.38,67.38,87.62,98.25,96.25,88.75,86,12.5,21.75,29.88,12.62,35.75,8.75,20,23.5,1,1,3,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,2,1,1,1,1,1,2,1,1,1,0,1,0,0,1,0,1,1,1,0,1,1,1.2,1,0.2,1.2,1.2,0.8,0.4,0.8,0.9,0.8,0.67,1,0,0,-1,5,-0.33,10 cents,100 minutes,24 days,Female,Professional Degree (ex. JD/MD),68,0.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,2,-1,-1,0,0,0,1,0,0,0,-1,0,0,0,0,1,1,0,0,0.2,-0.2,0.4,0.1 +296,R_1rzHjl5vvoGnMI1,67 - 73,American,Male,-3,0,3,1,3,0,1,1,1,1,0,2,2,0,2,-1,-1,0,0,-3,-3,1,3,-1,3,6,1,1,1,1,1,5,0,2,2,0,2,5,-1,-1,1,-1,-2,6,-3,-2,3,1,3,6,0,1,1,1,1,6,0,3,1,0,2,5,0,0,0,0,-3,6,TRUE,0,70,TRUE,1,70,TRUE,0,100,TRUE,0,50,FALSE,0,50,TRUE,0,65,TRUE,1,100,TRUE,1,65,TRUE,1,50,TRUE,1,70,TRUE,0,70,TRUE,0,70,TRUE,1,70,TRUE,0,60,FALSE,0,50,TRUE,1,95,FALSE,1,90,FALSE,1,85,FALSE,1,71,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,65,FALSE,0,60,FALSE,1,100,TRUE,1,70,FALSE,1,51,FALSE,1,100,TRUE,0,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.1225,0.09,0.0025,0,0,0.4225,0.36,0.09,0,0,0,0.09,0.25,0.49,0.25,0.09,0.4225,0.25,0,0,0.25,0.25,0.0841,0.36,0.01,0.2401,0,0.49,1,0.0225,0.49,0.49,0.228632143,0.193928571,0.263335714,21,65.63,19,59.38,5,62.5,3,37.5,6,75,5,62.5,12,75,7,43.75,75.53,64,70,81.88,86.25,75,76.06,6.25,16.15,1.5,32.5,6.88,23.75,0,32.31,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,2,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0.6,0.2,0,0.6,0.4,0,0.4,0.4,0.35,0.3,5.33,5.67,0,-1,0,0,-0.34,10 cents,5 minutes,24 days,Male,High School (or equivalent),72,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,-1,0,2,0,1,0,0,0,0,0,-1,-1,0,0,-1,-1,1,1,1,0.2,0.2,-0.4,0.2,0.05 +297,R_6qkiecRf87DHC9F,67 - 73,American,Male,1,-2,2,-2,-2,-1,-1,1,1,-1,1,1,1,-1,0,2,1,2,2,2,2,0,2,-1,-1,2,-1,-1,1,-1,0,2,2,2,1,-1,0,3,1,1,1,1,1,4,1,-2,2,-2,-3,2,-1,-1,1,0,-1,1,1,1,1,-1,1,1,0,0,1,1,1,1,TRUE,0,100,TRUE,1,86,FALSE,1,100,FALSE,1,52,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,70,TRUE,0,79,TRUE,0,100,TRUE,1,90,TRUE,0,98,TRUE,1,50,TRUE,1,92,FALSE,1,50,TRUE,0,100,TRUE,0,53,TRUE,0,57,FALSE,0,90,FALSE,0,51,FALSE,1,100,TRUE,1,53,FALSE,1,100,TRUE,1,84,TRUE,0,52,TRUE,0,98,FALSE,1,50,TRUE,1,98,TRUE,1,51,TRUE,1,100,0,0.0256,0.0064,0,0,0.25,0.2209,0.09,0.3249,0.2601,0.0004,0.01,0.25,0.6241,0.25,0.0196,0,0.2304,0.9604,0,0.81,0.25,0.2809,0.9604,0.25,0.2704,0.2401,1,0,1,0.25,1,0.350092857,0.180742857,0.519442857,23,71.88,19,59.38,4,50,6,75,4,50,5,62.5,12,75,7,43.75,76.69,59.12,72.5,87.88,87.25,75.94,77.44,12.5,17.31,9.12,-2.5,37.88,24.75,0.94,33.69,1,2,0,1,1,0,0,0,2,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,2,1,1,1,1,1,0.6,0.4,0.8,0.2,0.2,0.2,1.2,0.7,0.45,2.33,1.33,0,1,2,3,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),69,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,1,2,0,1,0,0,0,0,1,1,1,1,0,0,-1,-1,-1,0,0,0,0.8,0.4,0.2,-0.4,0.25 +298,R_6HTUWXqRQKtiHdf,53 - 59,Canadian,Female,0,3,2,0,3,0,-3,2,2,2,1,2,3,0,3,-3,-2,-3,-2,-2,-2,3,3,-2,3,8,2,-3,2,0,3,9,-1,0,0,1,2,6,-2,-1,-2,-1,-3,9,0,3,3,2,3,8,0,-3,3,1,2,8,2,1,3,0,3,7,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,88,TRUE,0,100,FALSE,1,50,TRUE,1,91,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,97,TRUE,0,100,TRUE,1,80,TRUE,0,100,TRUE,1,87,TRUE,1,94,FALSE,1,76,TRUE,0,100,TRUE,0,95,TRUE,0,100,TRUE,1,98,TRUE,1,80,TRUE,0,82,TRUE,1,100,FALSE,1,86,TRUE,1,99,TRUE,0,100,TRUE,0,94,TRUE,0,90,FALSE,0,77,TRUE,1,100,TRUE,1,100,0,0.0001,0.0036,0.0004,0,0,0,0,1,0.04,0.5929,0.04,0,0.9409,0.0081,0.0144,0.6724,0.25,0.8836,0.0196,0.0004,0.0169,0.9025,1,0.0576,1,0,0,1,1,0.81,1,0.401760714,0.254192857,0.549328571,26,81.25,20,62.5,5,62.5,6,75,6,75,3,37.5,15,93.75,5,31.25,92.56,89.62,89.62,95.38,95.62,93.25,91.88,18.75,30.06,27.12,14.62,20.38,58.12,-0.5,60.63,2,0,1,2,0,2,0,0,2,1,2,2,3,1,1,1,1,1,1,1,0,0,1,2,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,1,1,1.8,1,0.6,0.4,0.4,0.6,1.2,0.5,7.67,7.67,0,1,-1,4,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,57,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,2,0,0,0,0,2,0,-1,1,1,1,1,3,1,1,1,0,1,0,0,0.4,0.6,1.4,0.4,0.7 +299,R_3q4JHgQQI86k13W,67 - 73,American,Male,1,-3,-2,2,-3,-2,-3,2,-2,-1,2,1,2,-2,-1,-1,-1,2,0,2,0,-1,-1,0,-1,10,-3,-3,3,-3,-2,10,2,1,2,-2,-1,8,-2,-2,0,-2,-2,10,2,0,0,2,-2,8,-3,-3,3,-3,-3,8,2,2,2,-2,-1,8,-3,-2,0,-2,-2,8,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,0,100,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0.464285714,0.642857143,0.285714286,32,100,19,59.38,4,50,4,50,5,62.5,6,75,4,25,15,93.75,100,100,100,100,100,100,100,40.62,40.62,50,50,37.5,25,75,6.25,1,2,1,2,2,1,0,1,1,1,0,0,0,0,0,1,1,2,2,4,1,3,2,0,1,1,0,1,1,2,0,1,0,0,0,2,1,2,2,4,1.6,0.8,0,2,1.4,1,0.2,2.2,1.1,1.2,9.33,8,2,2,0,2,1.33,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),71,-0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,-1,-1,2,1,0,0,0,0,-1,0,-1,0,0,0,-1,0,0,0,0,0.2,-0.2,-0.2,-0.2,-0.1 +300,R_17KcLcxoWWcjhtD,18 - 24,American,Male,-1,3,2,-2,3,3,-1,2,-2,3,1,0,3,2,3,1,2,3,2,3,2,1,1,-2,-1,4,-2,-2,3,-3,1,4,-1,1,2,3,1,0,2,3,-1,2,1,3,1,3,1,-1,2,7,-2,-1,1,-3,2,5,2,2,1,3,1,2,2,-1,3,1,2,3,FALSE,1,81,TRUE,1,73,FALSE,1,71,FALSE,1,80,TRUE,1,100,FALSE,1,100,FALSE,0,73,FALSE,0,62,TRUE,1,78,FALSE,0,80,FALSE,1,100,FALSE,1,88,TRUE,1,87,FALSE,1,82,FALSE,0,85,TRUE,1,77,FALSE,1,95,FALSE,1,61,TRUE,0,72,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,67,FALSE,0,86,FALSE,1,71,FALSE,0,57,FALSE,1,83,FALSE,1,100,FALSE,1,76,TRUE,1,81,TRUE,1,76,FALSE,0,90,0.3844,0.3249,0.0529,0.5329,0.81,0,0.7396,0.64,0,1,0.0361,0.0169,0.0484,0,0,0.0729,0.4489,0.04,0,0.0841,1,0.7225,0.5184,0.0324,0.0025,0.0289,0.0576,0.0361,0.0841,0.1521,0.0576,0.0144,0.237267857,0.2752,0.199335714,16,50,21,65.63,6,75,5,62.5,4,50,6,75,7,43.75,14,87.5,82.25,80.88,89.38,75.62,83.12,81.56,82.94,-15.63,16.62,5.88,26.88,25.62,8.12,37.81,-4.56,3,2,1,0,4,5,1,1,1,2,2,1,1,1,2,1,1,4,0,2,2,0,1,1,1,5,0,1,1,1,1,2,2,1,2,1,3,0,1,1,2,2,1.4,1.6,1,1.6,1.6,1.2,1.75,1.35,2.67,4.67,-3,-1,-2,0,-2,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),24,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,1,2,0,-1,3,0,1,0,0,1,1,-1,-1,0,0,0,-2,4,-1,1,1,0.4,-0.2,0.4,0.4 +301,R_6P0kamWHi489yyl,25 - 31,American,Female,3,2,2,3,3,-2,-1,2,-2,2,1,1,3,-1,2,2,3,3,1,2,2,2,2,3,2,3,0,0,1,1,1,4,2,3,1,-1,2,4,2,3,2,2,1,4,3,2,2,3,3,3,2,1,0,1,0,1,0,1,1,1,0,3,3,3,3,3,2,9,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,93,FALSE,0,90,FALSE,1,91,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,95,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,100,FALSE,0,82,TRUE,1,100,TRUE,1,95,0,0,0,0.0025,0.0025,0,0,0,1,0,0.6724,0.81,0,0,0.0036,0,0,1,0.0625,0,1,0,0.0025,0.0081,0,0,0,0,0.8836,0,1,0.0049,0.230360714,0.249178571,0.211542857,29,90.63,25,78.13,7,87.5,5,62.5,8,100,5,62.5,13,81.25,12,75,97,99.38,97.38,98.25,93,97.25,96.75,12.5,18.87,11.88,34.88,-1.75,30.5,16,21.75,1,0,0,0,1,2,1,1,3,1,1,2,2,0,0,0,0,1,1,1,0,0,0,0,0,4,2,2,3,2,1,0,2,2,2,1,0,0,2,0,0.4,1.6,1,0.6,0,2.6,1.4,0.6,0.9,1.15,3.67,2.33,0,3,1,-5,1.34,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),29,1.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,0,0,0,1,-2,-1,-1,0,-1,0,2,0,-2,-2,-1,0,1,-1,1,0.4,-1,-0.4,0,-0.25 +302,R_6hXuPjXu4GtwAxl,60 - 66,Canadian,Male,-3,3,3,3,3,-1,1,-1,1,3,1,1,3,0,2,3,3,3,3,3,-3,3,3,-2,3,5,2,1,2,0,2,5,1,2,2,0,2,7,-1,-1,0,-1,3,8,-3,3,3,3,3,1,2,0,3,0,3,8,2,1,2,0,2,7,3,3,3,3,3,1,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,1,0.535714286,0.428571429,0.642857143,25,78.13,16,50,2,25,4,50,5,62.5,5,62.5,10,62.5,6,37.5,100,100,100,100,100,100,100,28.13,50,75,50,37.5,37.5,37.5,62.5,0,0,0,5,0,3,0,3,1,1,0,1,1,0,0,4,4,3,4,0,0,0,0,0,0,3,1,4,1,0,1,0,1,0,0,0,0,0,0,0,1,1.6,0.4,3,0,1.8,0.4,0,1.5,0.55,5.67,5.33,4,-3,0,7,0.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),63,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,5,0,0,-1,-1,0,1,-1,1,0,0,0,4,4,3,4,0,1,-0.2,0,3,0.95 +303,R_7O3X2HkbSJtBspb,25 - 31,American,Male,2,1,0,-3,3,1,-3,1,-3,3,0,-3,3,-3,3,2,3,2,3,-3,2,-2,3,1,0,5,-3,0,-2,1,0,8,0,-3,3,-3,3,2,-1,-2,-3,-1,-3,8,2,1,0,-3,3,5,3,-3,1,-3,3,2,0,-3,3,-3,3,1,3,3,3,3,-3,3,TRUE,0,75,FALSE,0,52,TRUE,0,55,TRUE,0,75,TRUE,1,57,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,1,80,TRUE,1,70,FALSE,1,50,TRUE,0,90,TRUE,1,86,FALSE,1,100,FALSE,0,70,TRUE,1,100,TRUE,0,80,TRUE,0,76,TRUE,0,86,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,65,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,0,70,TRUE,1,50,FALSE,0,50,TRUE,1,80,0.0625,0.25,0,0.0625,0.04,0.25,0,0.09,0,0,0.25,0.0196,0.04,0.25,0.1849,0.2704,0.25,0.5625,0.25,0.4225,0.25,0.49,0.7396,0,0.64,0.36,0.25,0.5625,0.3025,0.5776,0.49,0.81,0.298289286,0.157671429,0.438907143,10,31.25,16,50,2,25,3,37.5,5,62.5,6,75,12,75,4,25,71.16,65.38,65.38,76.38,77.5,71.56,70.75,-18.75,21.16,40.38,27.88,13.88,2.5,-3.44,45.75,0,3,3,4,3,4,3,3,4,3,0,0,0,0,0,3,5,5,4,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2.6,3.4,0,3.4,0,0.4,0,0.4,2.35,0.2,5,2.67,0,6,1,5,2.33,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,30,1.5,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,3,3,4,3,2,3,3,4,3,0,0,0,0,0,2,5,4,4,0,2.6,3,0,3,2.15 +304,R_71qUGxUVNF7HhaF,46 - 52,American,Female,3,3,3,0,3,1,-3,3,-3,2,2,-3,3,0,3,0,2,2,2,0,3,3,3,0,3,2,1,-3,3,-3,3,3,2,-3,2,0,3,1,-1,1,0,-1,-1,5,3,3,3,1,3,2,1,-3,3,-3,2,1,2,-3,3,0,3,1,3,3,3,3,0,1,TRUE,0,82,TRUE,1,87,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,100,TRUE,0,50,TRUE,0,82,TRUE,1,81,FALSE,1,100,TRUE,1,50,TRUE,1,91,TRUE,0,76,TRUE,0,76,TRUE,0,53,FALSE,1,53,FALSE,0,50,TRUE,1,81,FALSE,1,100,TRUE,1,91,TRUE,0,100,TRUE,1,87,TRUE,0,54,FALSE,1,100,TRUE,0,81,TRUE,1,76,TRUE,1,50,TRUE,1,100,0,0.0169,0.0081,0,0,0,0.0081,1,0.2209,0.0361,0.0576,0.0361,0.0081,0.25,0,0.0169,0,0.25,0,1,0.25,0.25,0.2809,0,0.5776,0.2916,0.25,0.6724,0.25,0.5776,0.6561,0.6724,0.271871429,0.134557143,0.409185714,24,75,20,62.5,4,50,5,62.5,4,50,7,87.5,14,87.5,6,37.5,79.44,60.62,86,90.75,80.38,83.44,75.44,12.5,16.94,10.62,23.5,40.75,-7.12,-4.06,37.94,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,2,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,3,1,1,1,0,0,0.2,0.2,1.6,0.2,0,0,1.2,0.5,0.35,2,1.33,0,2,0,4,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,1.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,-1,0,0,0,0,0,1,0,0,1,0,0,-2,0,1,2,1,-0.2,0.2,0.2,0.4,0.15 +305,R_7nhQXDvCukJnMvT,53 - 59,Canadian,Female,3,3,2,2,3,2,-2,1,0,2,0,-3,3,1,3,2,2,2,2,0,2,3,-1,1,1,5,3,-1,1,1,1,3,2,-3,3,2,3,3,-1,0,-1,-1,-1,5,3,3,1,2,3,1,2,-3,2,0,3,1,1,-3,3,0,3,2,2,2,2,2,2,4,FALSE,1,100,FALSE,0,87,FALSE,1,100,TRUE,0,53,TRUE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,76,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,67,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,81,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,76,TRUE,1,100,0,0,0,0.0016,0,0,0,0,0,0,0,0.4489,0.0576,1,0,0.7569,0,0.2809,0,0,0,1,1,0,0.6561,1,0.5776,0,0,0,1,1,0.3135,0.181735714,0.445264286,28,87.5,21,65.63,1,12.5,5,62.5,8,100,7,87.5,12,75,9,56.25,94.88,86.5,93.5,99.5,100,93.88,95.88,21.87,29.25,74,31,-0.5,12.5,18.88,39.63,1,0,3,1,2,1,1,0,1,1,2,0,0,1,0,3,2,3,3,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,2,1.4,0.8,0.6,2.4,0.2,0.6,0.4,0.4,1.3,0.4,3.67,1.33,4,2,1,1,2.34,10 cents,5 minutes,15 days,Female,University - Undergraduate,53,1.625,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,1,0,2,1,2,1,0,-1,1,0,1,0,0,0,0,3,2,3,3,-1,1.2,0.2,0.2,2,0.9 +306,R_7pYaXLvoeSp5urG,39 - 45,Canadian,Female,3,3,2,0,2,1,-1,0,-1,3,0,0,3,0,3,0,1,1,0,-1,3,3,2,-1,2,2,2,1,0,0,3,1,-1,0,3,1,3,1,0,1,0,0,0,5,3,3,2,0,2,1,1,-2,2,-1,3,1,0,0,3,-2,3,0,2,2,2,1,1,2,FALSE,1,97,TRUE,1,96,FALSE,1,94,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,85,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,88,TRUE,0,60,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,50,TRUE,1,94,0,0,0,0,0.0036,0,0,0,0.25,0,0,0,0,0.0225,0.01,0.0016,0,0.25,0,0,0.25,0.25,0.36,0,0.25,0.25,0.25,0.0009,0.0036,0.7744,0.5625,0.25,0.133539286,0.038407143,0.228671429,22,68.75,24,75,6,75,5,62.5,7,87.5,6,75,15,93.75,9,56.25,83.72,67.62,82.38,98.12,86.75,89.38,78.06,-6.25,8.72,-7.38,19.88,10.62,11.75,-4.37,21.81,0,0,0,1,0,1,2,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,2,0,2,1,1,1,2,0.2,0.8,0.4,0.4,0,0.6,0.4,1.4,0.45,0.6,1.33,0.67,1,0,1,3,0.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),44,1.875,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,1,0,1,1,-2,1,0,1,0,0,-1,0,-2,-1,0,-1,-1,0.2,0.2,0,-1,-0.15 +307,R_3NxJttisIIAEUus,60 - 66,American,Female,3,2,2,-2,2,-2,-1,2,-2,2,2,1,2,1,2,1,2,3,2,-2,3,2,2,-3,2,2,0,0,3,0,1,3,1,1,2,3,2,1,0,0,0,1,-3,6,3,2,2,0,3,0,0,-2,3,-2,1,0,2,1,3,0,2,0,2,2,2,2,-1,1,FALSE,1,98,FALSE,0,91,FALSE,1,100,FALSE,1,93,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,100,FALSE,1,76,TRUE,1,90,TRUE,0,88,TRUE,1,81,TRUE,1,100,FALSE,1,100,FALSE,1,97,TRUE,0,88,FALSE,1,100,TRUE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,97,TRUE,0,90,TRUE,1,94,FALSE,1,86,TRUE,0,99,TRUE,0,98,TRUE,1,98,TRUE,1,99,TRUE,1,99,0,0.0036,0,0,0.0001,0,0.0009,0,0,0.0064,0.0004,0.01,0.0009,0,0.04,0.8281,0,0.0049,0.9801,0.81,0,0.0361,0.7744,0.7744,0,0.0196,0.0001,0.0004,0,0.0009,0.9604,0.0576,0.189489286,0.063692857,0.315285714,29,90.63,26,81.25,6,75,7,87.5,6,75,7,87.5,15,93.75,11,68.75,94.72,91.88,95.88,94.88,96.25,94.88,94.56,9.38,13.47,16.88,8.38,19.88,8.75,1.13,25.81,0,0,0,1,0,2,1,1,2,1,1,0,0,2,0,1,2,3,1,1,0,0,0,2,1,2,1,1,0,1,0,0,1,1,0,1,0,1,0,1,0.2,1.4,0.6,1.6,0.6,1,0.4,0.6,0.95,0.65,2,0,2,3,1,5,2,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,0,-1,-1,0,0,0,2,0,1,0,-1,1,0,0,2,2,1,0,-0.4,0.4,0.2,1,0.3 +308,R_3CEIGdrkYXHGlap,53 - 59,American,Female,3,-1,2,2,-3,0,-2,1,-2,0,1,-1,1,-1,1,1,0,1,2,1,3,-1,2,0,-1,2,-1,1,1,-1,1,5,1,-1,1,0,1,2,0,0,1,0,0,4,3,-1,2,2,-3,3,-2,-2,0,-2,-2,3,1,0,0,-1,0,2,-1,0,-1,1,0,3,FALSE,1,99,TRUE,1,99,FALSE,1,91,FALSE,1,54,TRUE,1,96,FALSE,1,54,TRUE,1,98,TRUE,1,99,TRUE,1,96,TRUE,1,97,FALSE,1,60,TRUE,0,93,TRUE,1,93,TRUE,0,100,TRUE,1,96,TRUE,1,99,FALSE,1,90,FALSE,1,96,TRUE,0,60,FALSE,1,100,FALSE,0,56,TRUE,1,87,FALSE,1,59,TRUE,1,86,TRUE,0,59,TRUE,1,60,FALSE,1,59,FALSE,1,87,TRUE,0,82,TRUE,1,85,TRUE,1,95,TRUE,1,96,0.0001,0.16,0.0001,0.0004,0.0016,0.2116,0.0196,0.0009,0,0.0169,0.0225,0.0049,0.0016,0.16,0.0016,0.0001,0.1681,0.2116,0.0169,0.3481,0.3136,0.0016,0.36,1,0.01,0.1681,0.0025,0.0001,0.0081,0.0016,0.6724,0.8649,0.163889286,0.058642857,0.269135714,16,50,26,81.25,7,87.5,6,75,6,75,7,87.5,15,93.75,11,68.75,83.78,77.38,78.25,87,92.5,89.88,77.69,-31.25,2.53,-10.12,3.25,12,5,-3.87,8.94,0,0,0,2,2,1,3,0,1,1,0,0,0,1,0,1,0,0,2,1,0,0,0,0,0,2,0,1,0,2,0,1,1,0,1,2,0,2,1,1,0.8,1.2,0.2,0.8,0,1,0.6,1.2,0.75,0.7,3,2.67,-1,2,0,1,0.33,20 cents,100 minutes,15 days,Female,University - Undergraduate,55,0.75,0,0,0,0,1,0,0,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,2,2,-1,3,-1,1,-1,0,-1,-1,1,-1,-1,0,-2,1,0,0.8,0.2,-0.4,-0.4,0.05 +309,R_3Vr7U3YMAjw2Ymt,25 - 31,Canadian,Female,-3,2,2,2,2,1,-2,2,1,1,2,-1,3,1,2,-3,-1,-2,-3,-3,-3,2,3,2,2,2,2,-2,3,1,2,0,3,2,-1,2,1,4,1,1,1,1,-2,3,-3,3,3,3,3,4,-1,-1,2,1,2,4,3,1,3,2,2,3,1,1,2,-1,-1,4,TRUE,0,66,FALSE,0,50,FALSE,1,62,TRUE,0,50,FALSE,0,50,FALSE,1,60,TRUE,1,89,TRUE,1,82,FALSE,0,50,FALSE,0,50,FALSE,1,51,TRUE,0,61,TRUE,1,54,TRUE,0,50,FALSE,0,50,TRUE,1,65,TRUE,0,50,TRUE,0,60,TRUE,0,52,FALSE,1,53,TRUE,1,70,FALSE,0,53,TRUE,0,56,FALSE,0,65,FALSE,1,79,TRUE,1,73,TRUE,0,58,TRUE,0,52,FALSE,1,57,FALSE,0,100,FALSE,0,54,FALSE,0,50,0.0324,0.0729,0.1225,0.0121,0.25,0.16,0.4225,0.25,0.2209,0.2809,1,0.2116,0.25,0.2401,0.25,0.25,0.3136,0.25,0.2704,0.0441,0.09,0.25,0.2704,0.25,0.25,0.3364,0.2916,0.4356,0.1444,0.36,0.1849,0.3721,0.282125,0.310685714,0.253564286,4,12.5,12,37.5,1,12.5,4,50,3,37.5,4,50,6,37.5,6,37.5,60.06,51.88,55.88,65,67.5,62.81,57.31,-25,22.56,39.38,5.88,27.5,17.5,25.31,19.81,0,0,1,0,0,1,0,1,0,1,1,3,4,1,1,4,2,3,4,1,0,1,1,1,1,2,1,0,0,1,1,2,0,1,0,4,2,4,2,2,0.2,0.6,2,2.8,0.8,0.8,0.8,2.8,1.4,1.3,2,3.67,-2,-4,1,-1,-1.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,-1,0,-1,-1,-1,-1,1,0,0,0,1,4,0,1,0,0,-1,2,-1,-0.6,-0.2,1.2,0,0.1 +310,R_2me4V9FQ08N57m5,46 - 52,American,Female,3,2,2,1,2,0,-3,3,-3,2,2,-3,3,-3,3,2,2,2,2,-1,3,2,2,1,2,0,0,-3,3,-3,2,0,2,-3,3,-3,3,0,2,2,2,2,-1,0,3,2,2,2,2,0,0,-3,3,-3,2,0,2,-3,3,-3,3,0,2,2,2,2,-1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,0,0,0.25,0,1,0,0,0,0,0,0,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,1,1,0.294642857,0.107142857,0.482142857,24,75,22,68.75,6,75,6,75,5,62.5,5,62.5,11,68.75,11,68.75,84.38,68.75,87.5,87.5,93.75,87.5,81.25,6.25,15.63,-6.25,12.5,25,31.25,18.75,12.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0.05,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,1.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.2,0,0,0,-0.05 +311,R_731h46kt2EWVDLY,67 - 73,American,Male,-2,2,2,0,3,0,-2,3,-2,1,2,1,3,0,3,1,1,2,1,-2,-1,1,1,-1,2,3,2,-2,3,-1,3,3,3,2,3,2,3,1,-1,0,-1,-1,-2,2,0,2,3,2,1,6,-1,-2,0,-1,-1,3,2,1,2,-1,3,5,2,0,2,1,-2,6,TRUE,0,70,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,50,TRUE,0,70,TRUE,1,95,TRUE,1,80,TRUE,1,86,FALSE,0,90,TRUE,0,75,TRUE,0,91,TRUE,1,90,TRUE,0,80,TRUE,1,75,FALSE,0,80,FALSE,1,95,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,50,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,70,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.04,0.09,0.64,0.0025,0,0.49,0.01,0.81,0,0.25,0,0.01,0.0196,0.5625,0.25,0,0.25,0.25,0,0,0.0625,0.0625,0.25,0.64,0.0025,0.25,0.25,0.49,0.04,1,0.25,0.8281,0.250989286,0.207292857,0.294685714,15,46.88,23,71.88,7,87.5,6,75,4,50,6,75,14,87.5,9,56.25,77.88,67,72.5,81.88,90.12,80.06,75.69,-25,6,-20.5,-2.5,31.88,15.12,-7.44,19.44,1,1,1,1,1,2,0,0,1,2,1,1,0,2,0,2,1,3,2,0,2,0,1,2,2,1,0,3,1,2,0,0,1,1,0,1,1,0,0,0,1,1,0.8,1.6,1.4,1.4,0.4,0.4,1.1,0.9,2.33,4.67,-3,0,-4,-4,-2.34,10 cents,25 minutes,36 days,Male,Trade School (non-military),67,1.25,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,-1,1,0,-1,-1,1,0,-3,0,0,1,1,-1,1,0,1,0,3,2,0,-0.4,-0.4,0.4,1.2,0.2 +312,R_7SoYnD9VhiT967v,39 - 45,American,Female,3,3,1,3,2,-2,-3,3,2,1,1,-2,2,2,3,-2,-1,-1,-2,-2,3,1,2,3,3,2,-2,-3,3,1,3,4,2,-2,2,3,3,3,-1,-1,-1,-1,-2,3,3,3,1,3,2,1,-2,-3,3,2,2,1,2,-2,3,2,3,2,-2,-2,-2,-2,-1,2,FALSE,1,96,TRUE,1,85,FALSE,1,100,TRUE,0,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,70,FALSE,0,65,TRUE,0,70,TRUE,0,66,TRUE,1,100,FALSE,1,60,TRUE,1,54,TRUE,1,100,FALSE,1,76,FALSE,1,97,FALSE,1,90,FALSE,1,100,TRUE,1,62,TRUE,1,85,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,100,FALSE,1,100,TRUE,0,83,TRUE,1,100,TRUE,1,84,TRUE,1,100,0,0.0016,0,0,0,0,0,0.4225,0,0.0225,0,0,0.09,0.49,0.16,0.0225,0,0.25,0,0,0.1444,0.2116,0.01,0.16,0.0576,0,0.0256,0.0016,0,0.0009,0.6889,0.4356,0.114060714,0.104107143,0.124014286,28,87.5,27,84.38,6,75,7,87.5,7,87.5,7,87.5,15,93.75,12,75,85.91,75.38,85.12,87.38,95.75,85.06,86.75,3.12,1.53,0.38,-2.38,-0.12,8.25,-8.69,11.75,0,2,1,0,1,0,0,0,1,2,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0.8,0.6,0.4,0.4,0,0.2,0.4,0.6,0.55,0.3,3,1.33,1,3,1,1,1.67,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,43,1.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,2,1,0,1,0,0,0,1,1,0,0,-1,1,0,1,-1,-1,1,-1,0.8,0.4,0,-0.2,0.25 +313,R_3h0yvrbnLX57zfm,67 - 73,Canadian,Male,3,3,3,2,3,3,3,3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,-3,3,-2,3,1,3,3,3,3,3,1,3,-2,-3,-3,3,1,3,3,3,3,3,2,3,3,3,3,3,10,3,3,3,3,3,1,1,3,3,2,3,10,FALSE,1,100,TRUE,1,100,FALSE,1,78,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,88,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,97,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,77,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.5929,0,0,0,0,0,0,0,0,0,0,0,0.04,0,0,0,0,0,0,0,0,0.0625,1,0,0,0,0,0.0484,0.0009,1,0.7744,0.104507143,0.002857143,0.206157143,31,96.88,28,87.5,8,100,7,87.5,6,75,7,87.5,15,93.75,13,81.25,96.72,94.38,100,96.75,95.75,98.56,94.88,9.38,9.22,-5.62,12.5,21.75,8.25,4.81,13.63,0,0,0,1,0,0,6,0,3,0,0,1,0,0,0,0,5,6,6,0,0,0,0,1,0,0,0,0,2,0,0,1,0,0,0,2,0,0,1,0,0.2,1.8,0.2,3.4,0.2,0.4,0.2,0.6,1.4,0.35,1,4.33,-1,-9,0,-9,-3.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,6,0,1,0,0,0,0,0,0,-2,5,6,5,0,0,1.4,0,2.8,1.05 +314,R_1rV4mMwVSaPgDhP,60 - 66,Canadian,Male,1,1,3,3,0,-3,1,1,3,-2,2,-2,3,-3,-1,-3,-1,0,0,-1,3,1,3,3,-3,0,-3,3,-3,3,-3,8,2,-3,3,-3,-1,5,-2,1,-1,0,-2,5,3,1,3,3,-3,0,-3,1,1,3,-3,0,2,-3,3,-3,-2,0,-1,-1,0,-1,-2,0,TRUE,0,72,TRUE,1,74,TRUE,0,76,TRUE,0,50,TRUE,1,75,FALSE,1,84,TRUE,1,98,TRUE,1,91,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,71,FALSE,0,50,TRUE,1,100,0.0081,0.0001,0,0.0004,0,0.0256,0,0.25,0,0.25,0.0841,0,0.25,0.25,0.0625,0.0676,0,0.25,0.25,0,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,0.5776,0.25,0.25,0.25,0.183867857,0.106414286,0.261321429,16,50,24,75,4,50,7,87.5,6,75,7,87.5,14,87.5,10,62.5,70.78,53,79.25,71.12,79.75,77.06,64.5,-25,-4.22,3,-8.25,-3.88,-7.75,-10.44,2,2,0,0,0,3,0,2,4,0,1,0,1,0,0,0,1,2,1,0,1,2,0,0,0,3,0,0,0,0,1,0,1,0,0,1,2,0,0,1,1,1,1.4,0.2,1,1,0.2,0.4,0.8,0.9,0.6,4.33,0,0,8,5,5,4.33,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,63,1,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,2,4,0,0,0,0,0,0,-1,-1,2,1,-1,0,0,1.2,-0.2,0.2,0.3 +315,R_52qO8tcxdz4rbj3,39 - 45,Canadian,Female,3,3,3,-3,0,-2,1,2,-2,0,1,0,0,-3,3,1,3,3,3,1,3,3,3,-3,0,1,-2,1,2,-2,0,1,1,0,-1,-3,3,1,1,3,3,1,0,0,3,3,3,-2,0,1,-2,0,2,-2,0,0,0,0,1,-3,3,2,1,1,1,1,0,2,FALSE,1,100,FALSE,0,77,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,65,FALSE,0,60,FALSE,1,50,TRUE,0,57,FALSE,0,50,TRUE,0,82,TRUE,1,55,TRUE,1,75,FALSE,1,56,FALSE,1,50,TRUE,0,59,FALSE,1,100,FALSE,0,81,TRUE,1,67,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,FALSE,1,84,FALSE,1,92,TRUE,1,85,FALSE,0,50,TRUE,1,100,0,0,0.0625,0.01,0,0,0,0.36,0,0.1089,0.0225,0.25,0.1225,0.25,0,0.5929,0,0.25,0.0256,0,0.6561,0.2025,0.3481,0.6724,0.1936,0.5041,0.25,0,0,0.25,0.0064,0.3249,0.192517857,0.139771429,0.245264286,20,62.5,23,71.88,4,50,6,75,6,75,7,87.5,11,68.75,12,75,78.31,59.62,84.88,81.12,87.62,78.44,78.19,-9.38,6.43,9.62,9.88,6.12,0.12,9.69,3.19,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,2,2,2,1,0,0,0.2,0.6,0.2,0.2,0.4,1.4,0.2,0.55,1,1,0,1,-1,-2,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),45,1.5,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,-1,0,0,-1,0,0,0,-1,0,0,0,0,0,-2,-2,0,0,-0.2,-0.2,-0.2,-0.8,-0.35 +316,R_7dgvydr6nSPUpWq,53 - 59,American,Female,3,2,0,-1,-1,0,-1,2,-1,0,3,2,2,0,3,0,1,1,2,-1,3,2,1,-1,-1,1,0,-2,2,-2,0,1,3,2,2,0,3,1,0,1,1,1,-1,2,3,2,0,-1,-1,1,0,-2,2,-1,0,1,3,2,2,0,3,1,0,0,1,1,-1,3,FALSE,1,50,TRUE,1,73,TRUE,0,98,FALSE,1,50,TRUE,1,60,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,0,60,FALSE,1,100,TRUE,1,80,TRUE,1,87,TRUE,0,75,TRUE,1,99,TRUE,0,90,TRUE,1,100,TRUE,0,75,TRUE,0,96,TRUE,0,100,TRUE,1,95,TRUE,1,72,TRUE,1,100,0,0,0,0,0,0.0016,0.0001,0,0,0.0169,0.0025,0,0,0.36,0.16,0.0729,0.5625,0.25,0.9216,0.81,0.04,0.25,0.36,1,0.16,0.5625,0.0784,0.25,0.9604,1,1,0.81,0.343907143,0.101892857,0.585921429,20,62.5,21,65.63,5,62.5,6,75,5,62.5,5,62.5,16,100,5,31.25,84.88,67.5,83.88,90.88,97.25,88.5,81.25,-3.13,19.25,5,8.88,28.38,34.75,-11.5,50,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0.2,0.4,0,0.2,0,0.2,0,0.4,0.2,0.15,1,1,0,0,0,-1,0,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,57,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0.2,0.2,0,-0.2,0.05 +317,R_3dcLGFPMgWZ26bY,53 - 59,Canadian,Female,2,2,3,1,2,1,-3,3,0,2,3,2,2,0,3,1,2,3,1,-2,3,2,3,1,0,8,0,-3,3,1,2,5,3,3,2,-1,3,4,-1,-2,-1,-1,-3,1,3,3,3,1,2,2,1,-3,3,-2,1,1,3,2,2,0,3,1,1,1,1,1,2,7,TRUE,0,50,TRUE,1,50,TRUE,0,83,TRUE,0,77,TRUE,1,80,TRUE,0,60,TRUE,1,100,FALSE,0,50,TRUE,1,66,TRUE,1,50,TRUE,0,50,TRUE,0,82,TRUE,1,50,TRUE,0,50,TRUE,1,54,TRUE,1,50,FALSE,1,50,TRUE,0,87,TRUE,0,82,TRUE,0,50,FALSE,0,56,TRUE,1,50,TRUE,0,72,FALSE,0,74,TRUE,0,85,TRUE,1,77,TRUE,0,55,TRUE,0,81,TRUE,0,50,TRUE,1,92,TRUE,1,82,TRUE,1,50,0.25,0.0529,0.25,0,0.25,0.36,0.5476,0.25,0.25,0.25,0.0064,0.25,0.1156,0.25,0.04,0.25,0.5184,0.5929,0.6561,0.7225,0.3136,0.2116,0.6724,0.25,0.25,0.3025,0.0324,0.25,0.6889,0.7569,0.25,0.6724,0.355721429,0.280778571,0.430664286,17,53.13,14,43.75,4,50,4,50,4,50,2,25,13,81.25,1,6.25,65.47,64.5,58.5,68.62,70.25,64.44,66.5,9.38,21.72,14.5,8.5,18.62,45.25,-16.81,60.25,1,0,0,0,2,1,0,0,1,0,0,1,0,1,0,2,4,4,2,1,1,1,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,2,0,4,0.6,0.4,0.4,2.6,0.4,0.6,0,1.4,1,0.6,5.67,1.33,6,4,3,-6,4.34,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),57,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,-1,0,0,2,1,0,0,-1,-1,0,1,0,1,0,2,3,2,2,-3,0.2,-0.2,0.4,1.2,0.4 +318,R_5qgj0pp3cfHpCQo,67 - 73,American,Female,2,1,3,-2,-3,-2,-1,3,-3,1,3,-2,3,-2,3,2,2,2,2,0,3,2,2,-2,-3,1,-2,-2,3,-2,2,1,3,-2,2,-2,3,1,2,1,2,2,0,1,2,1,3,-2,-3,1,-2,-2,2,-2,1,1,3,-1,2,-2,3,1,2,2,2,2,0,8,FALSE,1,90,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,90,FALSE,0,50,TRUE,1,100,FALSE,1,85,TRUE,0,90,FALSE,1,95,FALSE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,85,TRUE,0,60,FALSE,1,95,TRUE,0,75,TRUE,1,90,FALSE,0,70,TRUE,1,90,0,0.0225,0,0.0025,0.01,0,0,0,0,0.0025,0.01,1,0,0,0.01,0,0,0.25,0.0025,0.0025,0.25,0.25,0.0025,0.81,0.0225,0.36,0.49,0.01,0.25,0.81,0.5625,0,0.182321429,0.091607143,0.273035714,25,78.13,24,75,5,62.5,5,62.5,6,75,8,100,12,75,12,75,87.19,78.12,86.25,92.5,91.88,88.44,85.94,3.13,12.19,15.62,23.75,17.5,-8.12,13.44,10.94,1,1,1,0,0,0,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0.6,0.6,0.2,0.2,0,0.6,0.4,0,0.4,0.25,1,1,0,0,0,-7,0,10 cents,5 minutes,24 days,Female,University - PhD,68,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,1,1,1,0,0,0,0,-1,0,1,0,-1,0,0,0,0,1,0,0,0,0.6,0,-0.2,0.2,0.15 +319,R_7Damdpe88cGpgRz,53 - 59,Canadian,Female,2,3,2,0,2,-3,-3,3,-2,2,3,2,3,-3,2,2,2,2,2,2,2,3,3,2,2,2,-3,-3,3,-3,2,1,3,2,2,-3,3,1,2,1,2,2,2,1,3,3,3,2,3,1,-3,-3,3,-3,3,1,3,2,3,-3,3,1,2,2,2,2,2,1,TRUE,0,97,FALSE,0,100,FALSE,1,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,82,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0025,0,0,0,0,0,1,0,0.0576,1,0.0324,0,0,1,0,0,0,0,0.9409,0,1,0.0196,0.8281,0.210039286,0.075721429,0.344357143,24,75,26,81.25,6,75,8,100,6,75,6,75,15,93.75,11,68.75,97.72,97,98.25,96.75,98.88,99.69,95.75,-6.25,16.47,22,-1.75,21.75,23.88,5.94,27,0,0,1,2,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,2,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0.6,0.2,0.4,0.2,1,0.4,0.2,0,0.35,0.4,1.33,1,1,0,0,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,-1,0,0,0,-1,0,0,0,0,-1,0,0,1,0,0,0,1,0,0,0,-0.4,-0.2,0.2,0.2,-0.05 +320,R_7x2lXCwuRgtTlER,53 - 59,Canadian,Female,3,3,3,-1,2,-1,3,3,-2,-1,1,3,3,-3,2,1,1,1,-1,-2,3,2,3,1,2,2,0,3,3,-1,1,4,3,3,3,1,2,3,-2,1,1,1,-3,8,3,2,3,-1,2,2,-2,3,3,-1,-2,5,1,3,3,-3,0,6,0,0,1,1,1,3,TRUE,0,97,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,53,FALSE,1,100,TRUE,1,84,TRUE,1,96,TRUE,1,57,TRUE,1,93,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,0,81,TRUE,1,50,TRUE,1,81,TRUE,0,77,FALSE,1,100,TRUE,0,75,FALSE,1,100,FALSE,0,94,TRUE,1,55,TRUE,0,59,FALSE,0,60,FALSE,1,58,TRUE,1,93,TRUE,0,50,FALSE,1,100,TRUE,0,69,FALSE,0,91,FALSE,0,65,TRUE,1,85,0.0016,0.0049,0.0361,0.0256,0.0225,0,0.36,0.0049,0,0.2025,0.8281,0.0064,0.1849,0,0.2209,0,0.3481,0.25,0,0.1764,0.8836,0.25,0.5625,0.6561,0.5929,0.25,0.4225,0.9409,1,0,0.4761,0,0.308546429,0.17345,0.443642857,10,31.25,19,59.38,4,50,4,50,6,75,5,62.5,12,75,7,43.75,80.16,68.38,78.62,82.62,91,78.06,82.25,-28.13,20.78,18.38,28.62,7.62,28.5,3.06,38.5,0,1,0,2,0,1,0,0,1,2,2,0,0,4,0,3,0,0,2,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,2,1,1,0,2,3,0.6,0.8,1.2,1.2,0.2,0.6,0.4,1.4,0.95,0.65,3,4.33,0,-1,-3,5,-1.33,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,59,0.5,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,2,0,0,0,0,0,1,2,0,0,4,-2,2,-1,0,0,-2,0.4,0.2,0.8,-0.2,0.3 +321,R_7dS16cqOTMcqZNc,53 - 59,American,Female,3,2,3,-3,1,-2,1,3,-1,-1,2,-3,2,-3,3,-3,0,1,1,-2,3,2,3,-3,1,0,-3,1,3,1,-3,5,2,-3,2,-3,3,2,-3,-2,-3,-1,-2,7,3,2,2,0,0,5,-2,-1,2,0,0,5,2,-3,2,-3,3,0,-1,0,0,1,-2,3,FALSE,1,100,TRUE,1,82,TRUE,0,100,FALSE,1,50,TRUE,1,79,FALSE,1,100,TRUE,1,50,TRUE,1,69,TRUE,1,50,FALSE,0,87,FALSE,1,50,TRUE,0,98,TRUE,1,67,TRUE,0,100,TRUE,1,50,TRUE,1,72,FALSE,1,50,TRUE,0,72,FALSE,1,50,FALSE,1,71,FALSE,0,100,TRUE,1,50,FALSE,1,96,TRUE,1,80,TRUE,0,50,TRUE,1,91,FALSE,1,50,FALSE,1,50,TRUE,0,53,TRUE,1,61,FALSE,0,50,TRUE,1,91,0.0961,0.0081,0.0784,0.25,0.0081,0,0.04,0.7569,0.0841,0.25,0.1521,0.1089,0.25,0.25,0.0441,0.0324,0.0016,0.25,0.25,0.25,1,0.25,0.25,1,0.25,0.25,0.25,0,1,0.5184,0.2809,0.9604,0.312067857,0.159157143,0.464978571,21,65.63,23,71.88,7,87.5,6,75,4,50,6,75,13,81.25,10,62.5,70.91,54,79.5,75,75.12,70.56,71.25,-6.25,-0.97,-33.5,4.5,25,0.12,-10.69,8.75,0,0,0,0,0,1,0,0,2,2,0,0,0,0,0,0,2,4,2,0,0,0,1,3,1,0,2,1,1,1,0,0,0,0,0,2,0,1,0,0,0,1,0,1.6,1,1,0,0.6,0.65,0.65,2.33,3.33,-5,0,2,4,-1,5 cents,100 minutes,24 days,Female,University - Undergraduate,53,1.5,1,0,0,0,1,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,-1,-3,-1,1,-2,-1,1,1,0,0,0,0,0,-2,2,3,2,0,-1,0,0,1,0 +322,R_5INxtYR8BYWS99W,32 - 38,Canadian,Female,-2,1,1,-1,1,0,-1,-1,-1,2,1,2,1,1,1,1,-2,-1,-1,1,2,2,2,-1,2,6,1,0,-1,1,0,5,0,1,-1,-1,1,5,-2,-2,-2,-2,-2,10,0,2,2,2,2,8,0,0,2,0,0,7,2,2,2,2,1,7,0,0,1,1,0,7,TRUE,0,56,FALSE,0,55,FALSE,1,55,FALSE,1,55,TRUE,1,55,FALSE,1,55,TRUE,1,65,TRUE,1,55,FALSE,0,55,TRUE,1,55,TRUE,0,55,TRUE,0,55,TRUE,1,55,FALSE,1,55,FALSE,0,55,TRUE,1,70,FALSE,1,55,TRUE,0,70,TRUE,0,55,FALSE,1,55,TRUE,1,60,FALSE,0,55,FALSE,1,55,FALSE,0,55,TRUE,0,70,FALSE,0,55,FALSE,1,55,TRUE,0,80,TRUE,0,55,TRUE,1,56,FALSE,0,55,FALSE,0,55,0.2025,0.3025,0.09,0.1225,0.3025,0.2025,0.3025,0.2025,0.2025,0.3025,0.1936,0.2025,0.3025,0.3025,0.2025,0.3025,0.2025,0.2025,0.64,0.49,0.16,0.3025,0.3025,0.2025,0.2025,0.2025,0.3025,0.3136,0.2025,0.49,0.3025,0.3025,0.280078571,0.244721429,0.315435714,16,50,16,50,2,25,6,75,3,37.5,5,62.5,8,50,8,50,57.72,55,55.62,60.12,60.12,56.94,58.5,0,7.72,30,-19.38,22.62,-2.38,6.94,8.5,4,1,1,0,1,1,1,0,2,2,1,1,2,2,0,3,0,1,1,3,2,1,1,3,1,0,1,3,1,2,1,0,1,1,0,1,2,2,2,1,1.4,1.2,1.2,1.6,1.6,1.4,0.6,1.6,1.35,1.3,5.33,7.33,-2,-2,-2,3,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,35,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,0,0,-3,0,1,0,-3,1,0,0,1,1,1,0,2,-2,-1,-1,2,-0.2,-0.2,0.6,0,0.05 +323,R_5yfj8xtjmhQoJvW,60 - 66,Canadian,Female,2,1,2,1,1,0,-1,2,-1,-1,1,1,2,-1,1,-1,-1,0,-1,-1,2,2,2,1,1,5,0,-1,2,-1,0,5,1,2,2,-1,2,5,-1,-1,-1,0,-1,5,2,1,2,1,0,5,0,0,2,-1,0,5,1,1,1,-1,2,5,0,0,0,0,-1,5,TRUE,0,100,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,91,TRUE,1,100,TRUE,1,50,TRUE,1,82,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,80,TRUE,0,80,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,80,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.04,0.04,0.0081,0,0.25,0,0.0324,0,0.25,0,0.25,0.25,0.25,0.25,0.0081,0,0.25,0,0.0004,0.25,0.25,0.25,0,0.64,0.25,0.25,1,0,0.25,0.25,1,0.220746429,0.127892857,0.3136,25,78.13,23,71.88,4,50,6,75,6,75,7,87.5,14,87.5,9,56.25,75.06,55.12,66.25,81.38,97.5,73.38,76.75,6.25,3.18,5.12,-8.75,6.38,10,-14.12,20.5,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0.2,0.2,0.4,0.4,0.2,0.4,0.4,0.6,0.3,0.4,5,5,0,0,0,0,0,20 cents,75 minutes,36 days,Female,High School (or equivalent),62,0.25,0,0,0,0,0,0,0,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,1,0,0,-1,0,-1,0,0,0,0,1,-1,0,0,-1,-1,1,0,0,0,-0.2,0,-0.2,-0.1 +324,R_11QtYtoOyvRCpN0,53 - 59,Canadian,Male,3,0,2,0,2,-3,-1,2,-1,1,2,1,2,-3,2,0,1,2,1,-1,3,1,0,-2,3,4,-3,0,1,-1,1,3,2,-1,2,-3,3,2,-1,1,1,0,-1,3,3,1,2,1,1,3,-3,0,2,0,0,3,2,1,2,-3,2,2,0,-1,0,1,-1,4,TRUE,0,100,FALSE,0,50,TRUE,0,89,TRUE,0,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,70,TRUE,0,91,TRUE,1,90,FALSE,1,90,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,94,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,FALSE,1,74,TRUE,0,84,TRUE,1,100,TRUE,1,100,TRUE,1,96,0,0,0,0,0.0016,0,0,0,0.25,0,0,0.01,0,0.49,0.01,0.25,0,0.25,0.0676,0,0.25,0.25,0.0036,0.01,0.25,0.5041,0,1,0.7921,1,0.7056,0.8281,0.247239286,0.090114286,0.404364286,28,87.5,20,62.5,4,50,5,62.5,6,75,5,62.5,14,87.5,6,37.5,85.59,73.12,82.5,98.75,88,89.12,82.06,25,23.09,23.12,20,23.75,25.5,1.62,44.56,0,1,2,2,1,0,1,1,0,0,0,2,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,2,2,0,0,1.2,0.4,0.6,0.6,0.6,0.6,0,0.8,0.7,0.5,3,2.67,1,0,0,-1,0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,58,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,2,1,0,0,0,1,-1,-1,0,2,0,0,1,1,-2,-1,1,0,0.6,-0.2,0.6,-0.2,0.2 +325,R_1FQe71JwkCj1JCd,39 - 45,American,Female,3,-2,0,-1,-3,-3,1,2,0,-3,1,-1,0,-3,0,-2,-2,-1,-2,-3,3,-1,-2,-3,-3,2,-3,0,2,-1,-3,3,1,-3,0,0,-1,2,-1,0,0,0,-1,4,3,-2,-1,0,-3,1,-3,-1,1,0,-3,1,1,-3,0,-3,0,8,-1,0,0,-1,-2,5,TRUE,0,50,TRUE,1,85,TRUE,0,91,FALSE,1,50,TRUE,1,85,FALSE,1,100,TRUE,1,57,TRUE,1,87,FALSE,0,56,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,61,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,52,TRUE,0,63,TRUE,0,50,FALSE,1,50,TRUE,1,62,TRUE,1,54,FALSE,1,65,TRUE,1,76,FALSE,1,58,TRUE,1,71,FALSE,1,50,FALSE,1,96,TRUE,0,50,TRUE,1,81,FALSE,0,50,TRUE,1,89,0.0169,0.0841,0.25,0.1849,0.0121,0,0.0576,0.1225,0.25,0.2116,0.0361,0.1521,0.3136,0.25,0.0225,0.0225,0.1225,0.25,0.0016,0.1764,0.1444,0.25,0.25,0.25,0.2304,0.25,0.25,0.25,0.8281,0.3969,0.25,0.25,0.200032143,0.130221429,0.269842857,16,50,23,71.88,4,50,7,87.5,5,62.5,7,87.5,13,81.25,10,62.5,64.19,55.12,70.5,58.5,72.62,67.44,60.94,-21.88,-7.69,5.12,-17,-4,-14.88,-13.81,-1.56,0,1,2,2,0,0,1,0,1,0,0,2,0,3,1,1,2,1,2,2,0,0,1,1,0,0,2,1,0,0,0,2,0,0,0,1,2,1,1,1,1,0.4,1.2,1.6,0.4,0.6,0.4,1.2,1.05,0.65,2.33,3.33,1,2,-6,-1,-1,5 cents,5 minutes,47 days,Female,High School (or equivalent),42,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,1,1,1,0,0,-1,-1,1,0,0,0,0,3,1,0,0,0,1,1,0.6,-0.2,0.8,0.4,0.4 +326,R_1KGAKS6dO4f3c4e,53 - 59,Canadian,Male,2,3,1,1,1,-2,-2,2,-2,1,3,-3,3,-3,3,-2,-2,-1,-2,-2,2,3,2,1,2,1,-3,1,2,1,-1,5,2,1,3,0,1,7,-3,-2,-2,-2,-2,1,2,3,2,2,0,2,-3,-3,2,-3,1,0,3,-3,3,-3,3,0,0,0,0,0,0,0,TRUE,0,50,TRUE,1,60,TRUE,0,90,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,60,TRUE,1,80,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,85,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,85,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,75,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,100,TRUE,0,65,TRUE,1,100,FALSE,0,50,TRUE,1,60,0.04,0.25,0,0.16,0.16,0.25,0.0625,0,0,0,0,0.0225,0.25,0.25,0.25,0.16,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.7225,0.4225,1,0.245,0.136071429,0.353928571,16,50,20,62.5,4,50,4,50,6,75,6,75,13,81.25,7,43.75,69.06,51.25,57.5,74.38,93.12,70,68.12,-12.5,6.56,1.25,7.5,-0.62,18.12,-11.25,24.37,0,0,1,0,1,1,3,0,3,2,1,4,0,3,2,1,0,1,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,2,2,1,2,2,0.4,1.8,2,0.4,0.6,0.6,0,1.8,1.15,0.75,4.33,0.67,-1,5,7,1,3.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,57,1.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-1,0,0,2,0,2,2,1,4,0,3,2,-1,-2,0,-2,-2,-0.2,1.2,2,-1.4,0.4 +327,R_6c2i1T1GCjpPNC2,53 - 59,American,Male,2,3,2,2,2,0,0,1,1,1,1,-2,3,-2,3,2,2,2,2,1,3,2,3,1,2,2,-1,0,0,1,1,3,0,-2,2,-2,3,2,2,2,2,2,1,2,2,2,2,2,2,2,1,1,1,1,2,3,2,-2,2,2,2,2,2,2,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,1,88,TRUE,0,100,TRUE,1,95,TRUE,1,97,FALSE,1,100,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,100,FALSE,0,68,TRUE,0,95,TRUE,0,91,TRUE,0,86,TRUE,1,100,FALSE,0,74,TRUE,1,100,0,0.4624,0.0009,0,0,0,0.0025,0,0,0,0,0.0144,0,0,0,0,0,0.0676,0.8281,0,0,0.0025,0.0081,1,0,0.9025,0.5476,0,1,1,0.7396,0.7396,0.244732143,0.006035714,0.483428571,30,93.75,23,71.88,6,75,7,87.5,5,62.5,5,62.5,14,87.5,9,56.25,95,91.12,96.75,96,96.12,94.81,95.19,21.87,23.12,16.12,9.25,33.5,33.62,7.31,38.94,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,4,1,0,0,0,0,1,0.8,0.4,0.4,0,0.2,0.6,1.4,0.2,0.4,0.6,2.33,2.33,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,55,1.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,01DIR,1,0,1,1,0,0,-1,1,0,-1,0,0,0,-4,-1,0,0,0,0,-1,0.6,-0.2,-1,-0.2,-0.2 +328,R_3e2fo9qBxt2z05U,25 - 31,Canadian,Male,3,3,2,3,1,-1,3,3,-1,-1,1,1,3,3,2,1,0,-1,3,0,1,3,3,2,2,10,1,3,2,-1,0,10,1,0,3,2,1,8,1,3,1,-1,3,7,2,2,3,2,2,6,3,2,2,1,3,8,-2,1,1,0,3,7,2,-1,1,3,-1,8,FALSE,1,64,FALSE,0,65,FALSE,1,65,FALSE,1,60,FALSE,0,59,FALSE,1,65,TRUE,1,64,FALSE,0,65,FALSE,0,65,FALSE,0,57,FALSE,1,77,TRUE,0,63,FALSE,0,65,FALSE,1,70,FALSE,0,67,TRUE,1,59,TRUE,0,66,TRUE,0,77,FALSE,1,67,TRUE,0,64,FALSE,0,65,FALSE,0,59,FALSE,1,67,FALSE,0,59,FALSE,1,72,TRUE,1,62,TRUE,0,63,FALSE,1,57,TRUE,0,67,TRUE,1,83,FALSE,0,52,TRUE,1,70,0.4225,0.1444,0.1681,0.1296,0.09,0.1225,0.3481,0.3249,0.4096,0.3481,0.0289,0.4225,0.4225,0.0529,0.3481,0.4225,0.1089,0.16,0.1849,0.0784,0.4225,0.4489,0.1089,0.09,0.4356,0.3969,0.2704,0.1296,0.1225,0.5929,0.4489,0.3969,0.276314286,0.257821429,0.294807143,12,37.5,15,46.88,3,37.5,3,37.5,5,62.5,4,50,5,31.25,10,62.5,65,64.5,65.5,65.62,64.38,63.5,66.5,-9.38,18.12,27,28,3.12,14.38,32.25,4,2,0,1,1,1,2,0,1,0,1,0,1,0,1,1,0,3,2,4,3,1,1,1,1,1,4,1,1,2,4,3,0,2,3,1,1,1,2,0,1,1,0.8,0.6,2.4,1,2.4,1.8,1,1.2,1.55,9.33,7,4,2,1,-1,2.33,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,30,0.375,0,1,0,1,0,0,0.33,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,-1,0,0,0,-2,-1,0,-2,-3,-3,1,-2,-2,0,-1,2,0,4,2,0,-1.6,-1.2,1.4,-0.35 +329,R_6P5ndp1vUxA8rGX,67 - 73,Canadian,Male,-1,2,2,2,2,0,-2,2,-2,0,2,2,3,1,2,0,0,1,1,-1,-1,2,2,2,2,1,-1,-2,2,-1,0,3,1,1,2,0,1,3,1,1,2,2,1,2,-1,2,2,2,2,2,0,-1,1,-2,0,3,2,2,2,1,2,2,1,0,1,1,0,3,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,95,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.9025,0,0,0,0,0,0.01,1,0.0025,1,0,0,0,1,0,0.9025,1,0,1,0,1,0.279196429,0.065178571,0.493214286,28,87.5,24,75,7,87.5,5,62.5,6,75,6,75,13,81.25,11,68.75,99.22,98.12,99.38,99.38,100,99.38,99.06,12.5,24.22,10.62,36.88,24.38,25,18.13,30.31,0,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1,1,1,1,2,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0.4,1,1.2,0,0.4,0.2,0.4,0.65,0.25,2.33,2.33,-1,0,1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),69,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,1,0,1,1,0,1,1,0,1,1,1,1,0,0,0.8,0.8,0.4 +330,R_138QJj22J0zRWVj,67 - 73,Canadian,Male,1,2,1,1,1,1,1,0,0,2,1,-1,3,-1,3,0,0,1,1,-1,2,2,2,1,1,2,2,1,1,-2,2,1,1,-2,2,-1,3,1,0,-1,1,1,-1,6,2,2,2,2,0,6,1,0,-1,0,2,1,1,-1,2,-2,3,1,-1,-2,0,0,-2,6,TRUE,0,86,TRUE,1,70,TRUE,0,66,FALSE,1,54,TRUE,1,59,FALSE,1,100,TRUE,1,78,TRUE,1,100,TRUE,1,53,TRUE,1,71,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,64,TRUE,0,100,TRUE,0,63,FALSE,1,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,64,TRUE,1,100,FALSE,1,54,FALSE,1,100,TRUE,0,100,FALSE,0,58,TRUE,1,100,TRUE,1,100,0,0,0,0.0484,0,0,0,0.0841,0,0,0.3364,0,0.2209,0,0.1681,0.09,0,0.2116,0,0.1296,0.3249,0.2304,0.3969,0,0.1296,0.2116,0,0.7396,0.4356,1,1,1,0.239617857,0.079364286,0.399871429,23,71.88,24,75,7,87.5,6,75,6,75,5,62.5,14,87.5,10,62.5,82.78,68.25,85,87.38,90.5,81.12,84.44,-3.12,7.78,-19.25,10,12.38,28,-6.38,21.94,1,0,1,0,0,1,0,1,2,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0,1,1,0,1,2,1,1,1,0.4,0.8,0.4,0.2,0.8,0.4,0.4,1.2,0.45,0.7,1.33,2.67,-4,0,0,0,-1.34,10 cents,25 minutes,24 days,Male,High School (or equivalent),71,1.375,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,-1,-1,1,-1,0,2,0,0,1,0,-1,0,-1,-1,-1,-1,-1,-0.4,0.4,0,-1,-0.25 +331,R_1Cr08YEudxQc7a9,32 - 38,Canadian,Female,2,1,2,1,0,-1,-2,2,2,0,3,1,1,2,1,2,3,2,2,3,3,3,-2,3,3,6,3,1,1,-3,3,5,3,0,1,-1,2,2,3,0,2,0,1,5,3,3,-2,3,3,4,-3,-3,0,0,-1,5,3,1,1,-2,2,4,3,1,2,1,0,7,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,64,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,85,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0.0225,0,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.4096,0.25,0.25,0.25,0.25,1,1,0.25,1,0.327932143,0.23375,0.422114286,3,9.38,15,46.88,3,37.5,4,50,3,37.5,5,62.5,5,31.25,10,62.5,62.47,50,62.5,64.25,73.12,61.56,63.38,-37.5,15.59,12.5,12.5,26.75,10.62,30.31,0.88,1,2,4,2,3,4,3,1,5,3,0,1,0,3,1,1,3,0,2,2,1,2,4,2,3,2,1,2,2,1,0,0,0,4,1,1,2,0,1,3,2.4,3.2,1,1.6,2.4,1.6,1,1.4,2.05,1.6,4.33,4.33,2,0,-2,-2,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),33,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,2,2,-1,3,2,0,1,0,-1,0,0,1,0,1,-1,0,1.6,0,0.2,0.45 +332,R_1s6gTd5jGExqCag,39 - 45,Canadian,Female,2,2,2,2,2,0,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,8,1,1,1,1,1,8,2,2,2,2,2,10,0,0,1,-1,1,10,1,1,1,1,1,10,2,2,2,2,2,10,TRUE,0,79,TRUE,1,87,TRUE,0,76,TRUE,0,84,TRUE,1,72,TRUE,0,73,TRUE,1,80,TRUE,1,75,TRUE,1,88,TRUE,1,90,TRUE,0,81,TRUE,0,64,TRUE,1,85,TRUE,0,85,TRUE,1,79,TRUE,1,75,TRUE,0,79,TRUE,0,95,TRUE,0,65,TRUE,0,82,TRUE,1,81,TRUE,1,83,TRUE,0,79,TRUE,1,76,TRUE,0,79,TRUE,1,75,TRUE,0,81,TRUE,0,77,TRUE,0,84,TRUE,1,88,TRUE,1,78,TRUE,1,67,0.0625,0.0625,0.0625,0.04,0.1089,0.5329,0.0576,0.01,0.6724,0.0289,0.0144,0.0225,0.0144,0.6561,0.0784,0.0169,0.6241,0.7056,0.5929,0.6241,0.0361,0.0441,0.4225,0.7225,0.6241,0.6561,0.0484,0.6241,0.5776,0.9025,0.7056,0.4096,0.376189286,0.253078571,0.4993,16,50,16,50,4,50,4,50,4,50,4,50,16,100,0,0,79.44,80.38,77.5,83.25,76.62,79.94,78.94,0,29.44,30.38,27.5,33.25,26.62,-20.06,78.94,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0.8,0,1,0,1,1,0,0.45,0.5,8.67,10,-1,-1,-2,-2,-1.33,10 cents,25 minutes,24 days,Female,Trade School (non-military),40,0.125,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,2,-2,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,0,-0.2,-1,1,-0.05 +333,R_3GcvCyzqWXpEvn0,46 - 52,Canadian,Male,3,3,2,3,2,3,-2,3,-3,3,3,3,2,2,3,-1,-2,-1,-1,-3,3,3,3,3,3,7,3,-3,3,-3,2,6,3,3,2,3,3,9,3,3,3,3,3,10,3,3,3,3,3,10,2,-1,2,2,-1,10,3,3,3,3,3,4,-2,-2,-2,-2,-3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,96,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,66,TRUE,0,100,TRUE,0,94,TRUE,1,96,TRUE,1,76,TRUE,1,100,0,0.0025,0,0,0,0,0,0,1,0,0.0016,1,0,0.01,0,0,0.0004,0.9216,1,0,0,0.0225,0,0,0,0.1156,0.0576,0,1,0,0.8836,1,0.250460714,0.209542857,0.291378571,28,87.5,25,78.13,7,87.5,6,75,8,100,4,50,15,93.75,10,62.5,96.75,89.12,99,99.38,99.5,97,96.5,9.37,18.62,1.62,24,-0.62,49.5,3.25,34,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,4,5,4,4,6,0,0,1,0,1,1,1,1,5,4,0,0,1,1,0,1,0,1,1,0,0.4,0.4,0.2,4.6,0.4,2.4,0.4,0.6,1.4,0.95,7.33,8,-3,-4,5,0,-0.67,10 cents,100 minutes,24 days,Male,University - PhD,48,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,-1,0,-1,-5,-3,0,0,-1,0,0,3,5,3,3,6,0,-2,-0.2,4,0.45 +334,R_7PzgbNGfqCYPx9p,53 - 59,Canadian,Female,3,3,3,3,3,-3,-1,2,3,-1,2,1,1,-3,3,1,2,1,2,1,3,3,3,3,3,5,-3,-1,2,3,-1,0,2,1,1,-3,3,1,1,2,1,1,1,3,3,3,3,3,3,1,-3,-1,2,3,-1,0,2,1,1,-3,3,1,1,2,1,2,1,0,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,1,70,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,85,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,78,FALSE,0,89,TRUE,1,85,0,0.0225,0,0,0.0225,0,0,0,0,0,0.0484,0.0625,0.25,0.25,0,0,0,0.25,0,0.5625,0.25,0.25,0.25,0.09,0.25,0.25,0.7921,0,0,0.25,1,0.25,0.181357143,0.0631,0.299614286,16,50,26,81.25,5,62.5,6,75,7,87.5,8,100,14,87.5,12,75,79.91,61.12,82.5,85,91,85.12,74.69,-31.25,-1.34,-1.38,7.5,-2.5,-9,-2.38,-0.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0.05,0,2,0.67,4,0,0,3,1.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,57,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0.2,0.05 +335,R_3hEDoZrChL2qwgr,53 - 59,American,Female,0,2,1,2,3,-3,-2,2,-1,1,1,2,1,1,0,2,2,2,2,2,-2,2,1,2,3,1,-2,-2,2,-2,2,0,2,2,2,2,2,1,2,2,2,2,2,0,-2,1,1,2,2,1,-2,-2,3,-2,0,0,2,2,2,2,2,1,2,2,2,2,2,0,TRUE,0,100,TRUE,1,81,TRUE,0,91,FALSE,1,52,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,87,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,80,FALSE,1,54,FALSE,1,60,TRUE,1,74,FALSE,0,50,FALSE,1,50,TRUE,1,89,TRUE,0,85,TRUE,1,97,FALSE,1,59,FALSE,1,50,TRUE,0,54,TRUE,1,97,FALSE,0,82,TRUE,1,87,0,0.0009,0,0,0.0169,0.01,0.0121,0.7569,0.16,0.25,0.0009,0,0.25,0.25,0,0.0361,0.25,0.2304,0.25,0.7225,0.0676,0.25,0.2116,1,0.25,0.1681,0.6724,1,0.8281,0.64,0.2916,1,0.341971429,0.158807143,0.525135714,24,75,20,62.5,5,62.5,7,87.5,2,25,6,75,11,68.75,9,56.25,77.16,59.75,75.62,87.38,85.88,84,70.31,12.5,14.66,-2.75,-11.88,62.38,10.88,15.25,14.06,2,0,0,0,0,1,0,0,1,1,1,0,1,1,2,0,0,0,0,0,2,1,0,0,1,1,0,1,1,1,1,0,1,1,2,0,0,0,0,0,0.4,0.6,1,0,0.8,0.8,1,0,0.5,0.65,0.67,0.67,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,54,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,-1,0,0,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-0.4,-0.2,0,0,-0.15 +336,R_6JsgvtLboY690D4,53 - 59,Canadian,Female,2,2,3,2,-2,-1,-2,3,-2,1,2,-2,2,-2,3,-3,-2,-2,-2,-3,2,2,3,2,-2,3,1,-2,3,-2,2,4,2,-2,2,1,3,4,-1,1,1,2,-2,7,2,2,3,2,-2,2,-2,1,3,-2,-2,2,2,-2,2,-3,3,6,2,1,2,2,-2,7,TRUE,0,86,TRUE,1,62,TRUE,0,91,FALSE,1,56,FALSE,0,53,FALSE,1,56,TRUE,1,76,TRUE,1,72,TRUE,1,51,TRUE,1,87,TRUE,0,52,TRUE,0,90,TRUE,1,59,TRUE,0,51,FALSE,0,51,TRUE,1,73,FALSE,1,51,TRUE,0,91,FALSE,1,52,FALSE,1,93,TRUE,1,58,FALSE,0,51,FALSE,1,53,TRUE,1,59,FALSE,1,67,TRUE,1,91,FALSE,1,52,FALSE,1,53,TRUE,0,61,FALSE,0,82,TRUE,1,89,TRUE,1,96,0.0784,0.0081,0.0729,0.0576,0.0016,0.1936,0.1681,0.0169,0.0049,0.2601,0.6724,0.1681,0.2401,0.2704,0.2809,0.1444,0.2209,0.1936,0.2209,0.1089,0.1764,0.2601,0.2304,0.2601,0.2401,0.2304,0.0121,0.7396,0.8281,0.8281,0.3721,0.81,0.291189286,0.202571429,0.379807143,8,25,21,65.63,6,75,6,75,4,50,5,62.5,12,75,9,56.25,67.66,58.12,60.88,75,76.62,69.38,65.94,-40.63,2.03,-16.88,-14.12,25,14.12,-5.62,9.69,0,0,0,0,0,2,0,0,0,1,0,0,0,3,0,2,3,3,4,1,0,0,0,0,0,1,3,0,0,3,0,0,0,1,0,5,3,4,4,1,0,0.6,0.6,2.6,0,1.4,0.2,3.4,0.95,1.25,3.67,3.33,1,2,-2,0,0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,1,-3,0,0,-2,0,0,0,2,0,-3,0,-1,0,0,0,-0.8,0.4,-0.8,-0.3 +337,R_11XxjRTPru0bWxt,60 - 66,American,Male,-2,2,3,0,1,-2,1,-2,1,-2,0,1,2,0,1,-3,-3,-3,-3,-3,1,2,2,0,1,9,-1,1,1,1,0,8,0,1,2,1,0,10,-2,-1,-2,-2,-1,10,0,0,0,0,0,10,-3,-3,-3,-3,-3,10,0,0,0,0,0,5,1,1,1,-3,-3,10,TRUE,0,50,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,80,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,70,TRUE,0,91,TRUE,0,91,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,76,TRUE,1,100,TRUE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,60,TRUE,0,80,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.04,0.0576,0.09,0,0,0.25,0,0,0.25,0,0,0,0.25,0.25,0.25,0.25,0.5776,0.25,0.36,0.25,0.25,0.25,0.25,0.25,0.8281,0.25,0.0625,0.25,1,0.8281,0.64,1,0.314153571,0.166257143,0.46205,25,78.13,19,59.38,4,50,5,62.5,5,62.5,5,62.5,16,100,3,18.75,71.84,53.12,74.62,77.12,82.5,78.19,65.5,18.75,12.46,3.12,12.12,14.62,20,-21.81,46.75,3,0,1,0,0,1,0,3,0,2,0,0,0,1,1,1,2,1,1,2,2,2,3,0,1,1,4,1,4,1,0,1,2,0,1,4,4,4,0,0,0.8,1.2,0.4,1.4,1.6,2.2,0.8,2.4,0.95,1.75,9,8.33,-1,-2,5,0,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),61,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,1,-2,-2,0,-1,0,-4,2,-4,1,0,-1,-2,1,0,-3,-2,-3,1,2,-0.8,-1,-0.4,-1,-0.8 +338,R_6DTwiYnZ5g4Op84,46 - 52,Canadian,Female,3,3,3,1,3,-2,-2,3,-1,1,2,0,2,2,1,-3,-2,0,-3,-3,3,3,3,-2,3,1,-2,-2,3,0,2,1,2,0,2,2,1,1,-2,-2,0,-3,-3,3,3,2,3,2,2,1,-2,-1,2,0,2,1,2,0,2,2,1,1,-3,-3,-3,-3,-3,1,FALSE,1,100,TRUE,1,100,FALSE,1,95,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,99,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,96,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,0,100,TRUE,1,100,FALSE,0,86,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0001,0,0,0,0.0009,0.1444,0,0,0.9216,0,0,0,0,0.7396,0,0.0025,0,1,1,0.136039286,0.0000714,0.272007143,31,96.88,28,87.5,6,75,7,87.5,8,100,7,87.5,14,87.5,14,87.5,97.97,97.25,100,100,94.62,98.88,97.06,9.38,10.47,22.25,12.5,0,7.12,11.38,9.56,0,0,0,3,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,3,0,0,0.6,0.4,0,0.2,0.6,0.8,0,0.8,0.3,0.55,1,1,0,0,0,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,-1,0,2,-1,0,-1,-1,0,0,0,0,0,0,0,1,-1,-3,0,0,0,-0.4,0,-0.6,-0.25 +339,R_5jfujassAQJlmEo,46 - 52,American,Female,2,3,3,3,3,0,-3,-2,0,3,-2,-3,3,-3,3,0,1,1,-1,-3,2,3,3,3,3,7,1,1,-3,0,3,7,-3,-2,1,2,1,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,4,-1,-3,-3,-2,3,3,-3,-3,3,-3,3,0,2,2,2,2,0,10,FALSE,1,100,TRUE,1,74,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,0,91,TRUE,1,100,TRUE,1,76,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,0,60,FALSE,1,84,FALSE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,98,FALSE,0,75,TRUE,1,100,0,0,0,0.8281,0,0,0,1,0.0256,0.0036,0.0004,0,0.0576,0,0,0.0676,0,0.25,0,0,1,0.25,0.36,0,0,0.25,0.5625,0,0,0.25,1,1,0.217046429,0.100342857,0.33375,25,78.13,23,71.88,5,62.5,6,75,5,62.5,7,87.5,12,75,11,68.75,89.12,66.88,100,91.88,97.75,91.12,87.12,6.25,17.24,4.38,25,29.38,10.25,16.12,18.37,0,0,0,0,0,1,4,1,0,0,1,1,2,5,2,3,4,4,2,0,1,0,0,0,0,1,0,1,2,0,1,0,0,0,0,2,1,1,3,3,0,1.2,2.2,2.6,0.2,0.8,0.2,2,1.5,0.8,8,2.33,3,4,10,0,5.67,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,46,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,0,0,0,0,0,4,0,-2,0,0,1,2,5,2,1,3,3,-1,-3,-0.2,0.4,2,0.6,0.7 +340,R_7etxJyVTqqJqk6d,53 - 59,American,Male,1,2,2,2,1,-1,-2,2,-2,1,1,2,2,0,2,0,1,2,-1,1,0,2,2,0,2,5,-2,-2,2,-2,2,3,2,2,2,2,2,1,0,0,0,0,-1,5,-1,2,2,3,0,2,-1,0,1,-2,0,5,2,2,2,0,2,1,0,0,0,0,-1,5,FALSE,1,97,TRUE,1,94,TRUE,0,99,FALSE,1,50,FALSE,0,50,FALSE,1,85,TRUE,1,100,TRUE,1,97,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,99,TRUE,0,98,FALSE,1,100,FALSE,0,50,TRUE,1,98,TRUE,0,100,TRUE,1,76,TRUE,0,73,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,59,TRUE,1,100,FALSE,0,50,TRUE,1,75,0.0009,0,0,0,0.0625,0.0225,0.0576,0,0,0.0004,0,0,0.0081,0,0.25,0.0036,1,0.25,0,0.5329,0.25,0.25,0.9604,1,0.25,0.25,0.25,0.0009,0.9801,0.9801,0.3481,0.81,0.304185714,0.118192857,0.490178571,22,68.75,21,65.63,6,75,4,50,5,62.5,6,75,13,81.25,8,50,83.78,72.88,71.12,95.88,95.25,83.19,84.38,3.12,18.15,-2.12,21.12,33.38,20.25,1.94,34.38,1,0,0,2,1,1,0,0,0,1,1,0,0,2,0,0,1,2,1,2,2,0,0,1,1,0,2,1,0,1,1,0,0,0,0,0,1,2,1,2,0.8,0.4,0.6,1.2,0.8,0.8,0.2,1.2,0.75,0.75,3,2.67,3,-2,0,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,58,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,0,0,1,0,1,-2,-1,0,0,0,0,0,2,0,0,0,0,0,0,0,-0.4,0.4,0,0 +341,R_77D4w3eu85U5Wqu,60 - 66,Canadian,Female,0,2,2,2,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,0,0,0,0,2,6,0,0,0,0,0,5,1,1,1,1,1,6,1,1,1,1,1,5,0,0,0,0,0,7,0,0,0,0,0,5,0,1,0,1,1,6,2,2,2,2,2,6,TRUE,0,98,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,67,TRUE,1,62,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,53,TRUE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,53,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,52,FALSE,0,61,FALSE,1,75,FALSE,1,66,FALSE,1,64,TRUE,1,76,TRUE,1,50,FALSE,0,50,0.25,0.3721,0.25,0.25,0.25,0.25,0.25,0.25,0.2209,0.25,0.0576,0.1444,0.25,0.25,0.25,0.25,0.25,0.25,0.1156,0.2304,0.2209,0.25,0.2209,0.25,0.2209,0.0625,0.25,0.9604,0.25,0.2809,0.1296,0.4489,0.252282143,0.226635714,0.277928571,15,46.88,15,46.88,5,62.5,5,62.5,1,12.5,4,50,4,25,11,68.75,55.81,53.5,54,58,57.75,53.25,58.38,0,8.93,-9,-8.5,45.5,7.75,28.25,-10.37,0,2,2,2,0,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,0,2,2,2,2,1,1,1,2,1,1,0,1,0,1,1,1,1,1,1,1.2,1.2,0.2,0,1.6,1.2,0.6,1,0.65,1.1,5.67,6,-1,0,0,-1,-0.33,5 cents,5 minutes,24 days,Female,High School (or equivalent),63,0.25,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,-2,0,0,0,0,0,-1,0,-1,0,0,-1,-1,-1,-1,-1,-0.4,0,-0.4,-1,-0.45 +342,R_10Hwl0ASEOovzbj,53 - 59,Canadian,Male,3,3,2,1,-1,-3,0,2,0,1,2,-2,3,3,2,-3,-3,-3,-3,-3,3,3,1,1,-1,5,-3,1,2,2,2,3,2,-2,3,2,-1,8,-3,-3,-3,-3,-3,6,3,3,0,2,0,5,-3,-2,2,-1,0,3,3,-2,3,3,2,5,-2,-2,-2,-2,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,90,TRUE,1,100,FALSE,1,100,FALSE,0,80,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,90,TRUE,0,50,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,FALSE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,90,0.01,0.09,0,0,0.01,0.36,0,0,0.25,0,0,0,0,0.25,0,0,0,0.25,0.25,0,0.04,0.64,0.81,0,1,0,0.25,0,0.81,1,1,0.81,0.276071429,0.08,0.472142857,28,87.5,23,71.88,6,75,5,62.5,7,87.5,5,62.5,15,93.75,8,50,87.19,77.5,91.25,96.25,83.75,91.25,83.12,15.62,15.31,2.5,28.75,8.75,21.25,-2.5,33.12,0,0,1,0,0,0,1,0,2,1,0,0,0,1,3,0,0,0,0,0,0,0,2,1,1,0,2,0,1,1,1,0,0,0,0,1,1,1,1,0,0.2,0.8,0.8,0,0.8,0.8,0.2,0.8,0.45,0.65,5.33,4.33,0,0,3,1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,56,2,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,-1,-1,-1,0,-1,0,1,0,-1,0,0,1,3,-1,-1,-1,-1,0,-0.6,0,0.6,-0.8,-0.2 +343,R_51WXEtmjXUZBgzu,60 - 66,Canadian,Female,3,3,2,1,2,1,-2,2,-1,3,3,0,2,-1,3,2,1,2,3,3,3,3,2,1,3,2,3,-1,2,-1,2,2,3,1,2,0,3,2,3,2,3,2,2,2,3,3,0,2,2,2,3,-2,3,-1,2,2,3,0,2,-1,3,2,3,2,3,3,3,2,TRUE,0,63,TRUE,1,81,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,1,96,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,90,TRUE,0,90,FALSE,1,100,FALSE,0,100,FALSE,0,50,TRUE,0,52,TRUE,1,88,TRUE,0,90,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,70,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0,0.0144,0,0,0.25,0,0.0016,0.25,0.25,0.25,0.0361,0.2704,0.25,0,0.81,1,0.25,0.81,0,0.25,0.25,0.09,0.3969,0,0.01,0.49,0.25,0.220692857,0.112321429,0.329064286,17,53.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,79.38,61.38,77.25,86.62,92.25,83.44,75.31,-18.75,7.5,-13.62,14.75,24.12,4.75,2.19,12.81,0,0,0,0,1,2,1,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,2,1,0,2,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0.2,0.8,0.4,1,0.6,0.8,0,0.6,0.6,0.5,2,2,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,1.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,-2,-1,1,0,1,-1,0,0,0,1,0,1,0,0,0,0,1,1,-0.4,0,0.4,0.4,0.1 +344,R_7MFjmjTfEMufNe2,46 - 52,Canadian,Female,3,1,1,2,2,-3,0,2,-1,1,1,-3,3,-2,2,-3,-2,-2,-2,-1,3,2,2,1,2,0,-3,-2,2,-2,2,2,2,-3,3,-3,2,2,-2,-2,-2,-2,-2,2,3,2,2,2,1,9,-3,1,1,1,0,4,3,-3,3,-2,2,1,-3,-3,-2,-3,-2,3,FALSE,1,84,TRUE,1,90,FALSE,1,72,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,82,TRUE,1,92,TRUE,1,68,FALSE,0,55,FALSE,1,64,FALSE,1,86,FALSE,0,50,TRUE,0,83,FALSE,0,50,TRUE,1,87,FALSE,1,70,TRUE,0,66,TRUE,0,71,TRUE,0,50,TRUE,1,62,TRUE,1,96,FALSE,1,97,TRUE,1,68,FALSE,1,100,FALSE,0,50,TRUE,0,50,FALSE,1,83,FALSE,1,68,TRUE,1,63,TRUE,1,50,TRUE,1,75,0.0064,0.25,0.0169,0.0324,0.0625,0.25,0.1024,0.3025,0.25,0.0016,0.1369,0.25,0.1024,0.1296,0,0.01,0.0009,0.25,0.0289,0,0.1444,0.25,0.5041,0.6889,0.09,0.25,0.25,0.0256,0.0784,0.4356,0.1024,0.0196,0.168453571,0.132057143,0.20485,20,62.5,23,71.88,5,62.5,7,87.5,4,50,7,87.5,12,75,11,68.75,71.31,61.62,71.5,77,75.12,71.12,71.5,-9.38,-0.57,-0.88,-16,27,-12.38,-3.88,2.75,0,1,1,1,0,0,2,0,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,0,1,1,2,1,2,0,0,0,0,0,1,0,1,1,0.6,0.8,0.4,0.4,0.6,1,0.4,0.6,0.55,0.65,1.33,4.67,-9,-2,1,-1,-3.34,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),48,1.5,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,1,-1,0,1,-1,-1,0,-1,0,0,1,0,1,-1,0,-1,0,0,-0.2,0,-0.2,-0.1 +345,R_7g13iJm8PT5Lh2e,53 - 59,American,Female,2,2,1,-1,1,1,2,3,3,-1,1,1,3,2,1,-3,-1,-3,1,-3,3,3,2,1,3,7,1,1,3,1,1,7,-1,1,3,-2,1,8,-2,-2,-2,0,-2,6,3,2,3,2,0,6,1,-2,0,-1,1,6,1,3,3,2,1,5,0,1,1,2,-2,5,TRUE,0,90,FALSE,0,54,TRUE,0,87,FALSE,1,56,FALSE,0,50,FALSE,1,50,TRUE,1,96,TRUE,1,100,FALSE,0,54,TRUE,1,100,FALSE,1,53,TRUE,0,94,FALSE,0,54,TRUE,0,75,FALSE,0,63,FALSE,0,98,TRUE,0,76,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,72,FALSE,1,50,FALSE,0,50,TRUE,0,70,FALSE,0,65,FALSE,1,50,TRUE,0,94,TRUE,0,50,TRUE,1,91,FALSE,0,60,TRUE,1,100,0,0.4225,0.9604,0.0016,0,0.25,0.25,0,0.25,0.0784,0.0081,0.2916,0.2916,0.2209,0.25,0.2916,0.25,0.1936,0.8836,0.49,0.25,0.3969,0.25,0.5625,0.5776,0.25,0.36,0.81,0.7569,1,0.25,0.8836,0.369532143,0.187557143,0.551507143,16,50,14,43.75,4,50,4,50,3,37.5,3,37.5,7,43.75,7,43.75,70.38,55,60,83.5,83,72.31,68.44,6.25,26.63,5,10,46,45.5,28.56,24.69,1,1,1,2,2,0,1,0,2,2,2,0,0,4,0,1,1,1,1,1,1,0,2,3,1,0,4,3,4,2,0,2,0,0,0,3,2,4,1,1,1.4,1,1.2,1,1.4,2.6,0.4,2.2,1.15,1.65,7.33,5.67,1,1,3,1,1.66,10 cents,100 minutes,24 days,Female,Trade School (non-military),55,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,1,-1,-1,1,0,-3,-3,-2,0,2,-2,0,4,0,-2,-1,-3,0,0,0,-1.6,0.8,-1.2,-0.5 +346,R_3aK34IiIm2trdOD,60 - 66,American,Female,1,3,-2,0,0,-2,-3,1,-3,0,1,2,3,-2,3,-1,-1,1,-3,-3,1,3,1,1,2,8,0,-3,1,-3,-3,8,-1,3,3,-3,3,8,0,-3,0,0,-3,8,1,3,-1,1,1,6,0,-3,2,-3,0,8,1,3,3,-3,3,8,1,0,1,1,0,8,TRUE,0,85,FALSE,0,73,TRUE,0,73,FALSE,1,71,FALSE,0,70,FALSE,1,97,TRUE,1,84,TRUE,1,82,TRUE,1,63,TRUE,1,94,FALSE,1,60,TRUE,0,80,TRUE,1,89,TRUE,0,92,TRUE,1,94,TRUE,1,89,FALSE,1,57,TRUE,0,93,FALSE,1,58,FALSE,1,60,FALSE,0,64,FALSE,0,63,FALSE,1,62,TRUE,1,89,TRUE,0,92,TRUE,1,92,TRUE,0,61,TRUE,0,94,TRUE,0,89,FALSE,0,54,FALSE,0,63,TRUE,1,91,0.0324,0.0064,0.0121,0.0256,0.0081,0.0009,0.0121,0.0036,0.16,0.3969,0.2916,0.0121,0.1369,0.16,0.49,0.5329,0.1444,0.0841,0.8836,0.8464,0.4096,0.0036,0.1764,0.8464,0.1849,0.3721,0.3969,0.7225,0.5329,0.8649,0.7921,0.64,0.360925,0.173828571,0.548021429,17,53.13,17,53.13,5,62.5,5,62.5,3,37.5,4,50,10,62.5,7,43.75,77.44,67.88,77.38,86.88,77.62,78.38,76.5,0,24.31,5.38,14.88,49.38,27.62,15.88,32.75,0,0,3,1,2,2,0,0,0,3,2,1,0,1,0,1,2,1,3,0,0,0,1,1,1,2,0,1,0,0,0,1,0,1,0,2,1,0,4,3,1.2,1,0.8,1.4,0.6,0.6,0.4,2,1.1,0.9,8,7.33,2,0,0,0,0.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),61,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,2,0,1,0,0,-1,0,3,2,0,0,0,0,-1,1,1,-1,-3,0.6,0.4,0.4,-0.6,0.2 +347,R_6itlGcuLkBRlyOE,53 - 59,Canadian,Female,2,2,-3,3,0,2,0,0,3,0,0,3,3,0,0,2,0,0,2,3,2,2,-2,2,0,5,2,0,0,3,-2,2,0,2,2,0,0,5,0,-2,-2,2,2,5,2,2,-3,0,0,5,0,0,3,3,0,2,0,2,2,0,0,5,0,2,0,2,2,7,FALSE,1,61,TRUE,1,80,TRUE,0,100,FALSE,1,60,FALSE,0,65,FALSE,1,70,TRUE,1,100,TRUE,1,100,FALSE,0,60,TRUE,1,70,FALSE,1,60,TRUE,0,70,TRUE,1,95,TRUE,0,80,FALSE,0,60,TRUE,1,80,FALSE,1,60,TRUE,0,90,TRUE,0,80,TRUE,0,70,TRUE,1,80,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,59,TRUE,1,69,FALSE,1,55,TRUE,0,60,TRUE,0,80,TRUE,1,75,FALSE,0,54,TRUE,1,100,0,0.0961,0.04,0,0,0.09,0,0.09,0.49,0,0.0625,0.0025,0.36,0.16,0.4225,0.04,0.1936,0.16,0.36,0.1681,0.04,0.36,0.64,0.64,0.16,0.2025,0.2916,0.1521,1,0.81,0.64,0.49,0.286621429,0.147935714,0.425307143,16,50,20,62.5,4,50,6,75,6,75,4,50,12,75,8,50,74.97,63.62,75.75,78.62,81.88,80.5,69.44,-12.5,12.47,13.62,0.75,3.62,31.88,5.5,19.44,0,0,1,1,0,0,0,0,0,2,0,1,1,0,0,2,2,2,0,1,0,0,0,3,0,2,0,3,0,0,0,1,1,0,0,2,2,0,0,1,0.4,0.4,0.4,1.4,0.6,1,0.4,1,0.65,0.75,4,4,0,0,0,-2,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,53,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,1,-2,0,-2,0,-3,0,2,0,0,0,0,0,0,0,2,0,0,-0.2,-0.6,0,0.4,-0.1 +348,R_5DB7iEbTk4da9Pc,60 - 66,Canadian,Female,2,1,3,1,3,-2,-1,2,2,0,3,1,1,0,2,1,1,1,1,1,1,2,3,1,2,1,-2,-1,1,3,0,0,3,1,1,0,2,1,1,1,1,1,1,1,2,2,3,2,1,2,-1,0,1,1,-1,1,3,1,1,0,2,2,1,1,1,1,1,1,TRUE,0,100,TRUE,1,96,FALSE,1,85,FALSE,1,55,TRUE,1,76,FALSE,1,80,TRUE,1,91,TRUE,1,100,TRUE,1,95,TRUE,1,55,FALSE,1,54,FALSE,1,100,FALSE,0,55,TRUE,0,100,TRUE,1,58,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,57,FALSE,1,68,FALSE,0,57,TRUE,1,58,FALSE,1,100,TRUE,1,84,FALSE,1,99,TRUE,1,94,TRUE,0,65,FALSE,1,55,TRUE,0,76,FALSE,0,55,FALSE,0,58,TRUE,1,95,0,0.0036,0,0.0081,0.0025,0.04,0.0256,0.2025,0.1024,0.1764,0.3025,0.3025,0.0025,0.2116,0.0576,0.0016,0,0.2025,0.2025,0.0001,0.3249,0.1764,0.1849,1,0.2916,0.4225,0.3364,1,0.0225,1,0.5776,0,0.256057143,0.116442857,0.395671429,21,65.63,22,68.75,6,75,4,50,5,62.5,7,87.5,12,75,10,62.5,77.34,67.25,74.12,87.12,80.88,76.69,78,-3.12,8.59,-7.75,24.12,24.62,-6.62,1.69,15.5,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0.6,0.4,0,0,0.8,1,0,0,0.25,0.45,0.67,1.67,-1,-1,-1,0,-1,10 cents,5 minutes,24 days,Female,University - Undergraduate,62,1.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,1,0,0,-1,-1,-1,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,-0.2,-0.6,0,0,-0.2 +349,R_3HnBfY0lIp3qaUp,46 - 52,Canadian,Female,1,3,3,2,3,-1,-1,2,0,0,3,-1,2,0,2,-1,0,0,-1,-1,2,3,3,2,3,5,1,-2,2,-2,1,5,2,-3,2,0,3,4,0,1,1,0,0,7,2,3,3,3,2,8,-1,0,2,1,0,4,2,-2,3,-1,3,5,0,0,0,0,0,5,TRUE,0,97,TRUE,1,53,FALSE,1,69,FALSE,1,50,TRUE,1,85,FALSE,1,94,TRUE,1,90,TRUE,1,90,FALSE,0,50,TRUE,1,92,FALSE,1,50,TRUE,0,88,TRUE,1,66,FALSE,1,50,FALSE,0,50,TRUE,1,95,FALSE,1,50,TRUE,0,92,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,76,FALSE,0,50,TRUE,0,67,TRUE,1,71,FALSE,1,50,FALSE,1,55,TRUE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,61,0.01,0.0841,0.0025,0.01,0.1521,0.0036,0.25,0.0064,0.25,0.25,0.25,0.1156,0.25,0.25,0.0225,0.2209,0.5776,0.25,0.2025,0.4489,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9409,0.0961,0.8464,0.25,0.7744,0.291353571,0.203478571,0.379228571,14,43.75,20,62.5,5,62.5,6,75,4,50,5,62.5,10,62.5,10,62.5,65.34,50.38,66.5,76.12,68.38,65.81,64.88,-18.75,2.84,-12.12,-8.5,26.12,5.88,3.31,2.38,1,0,0,0,0,2,1,0,2,1,1,2,0,0,1,1,1,1,1,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,0,0,1,1,0.2,1.2,0.8,1,0.6,0.4,1,0.6,0.8,0.65,4.67,5.67,-3,1,-1,2,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,0.75,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,-1,2,0,0,1,1,0,1,-1,-1,0,0,1,1,0,0,-0.4,0.8,-0.2,0.4,0.15 +350,R_7mLb9cbulVDWv7c,60 - 66,Canadian,Male,1,1,1,-1,2,-1,0,2,0,0,0,-1,2,-2,-1,1,1,2,2,-1,2,1,2,-2,2,7,-1,1,2,0,0,3,-1,-1,2,1,-1,5,-1,-1,0,-1,-2,7,2,1,2,1,-2,7,-2,0,2,-1,1,6,-1,0,2,-2,1,7,2,1,2,2,-2,6,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,90,TRUE,1,100,TRUE,1,90,TRUE,0,65,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,60,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,80,TRUE,0,70,TRUE,1,100,FALSE,1,85,TRUE,1,100,TRUE,0,90,FALSE,1,100,TRUE,0,85,FALSE,0,81,TRUE,1,50,TRUE,1,100,0.01,0,0,0.0625,0,0,0,0.01,0,0.04,0.6561,1,0,0.4225,0.0625,0,0.49,0.25,0,0.0225,0,0.25,0.0625,0,0.36,0.81,0.25,0,0,1,0.7225,0,0.228878571,0.209364286,0.248392857,28,87.5,24,75,6,75,4,50,7,87.5,7,87.5,14,87.5,10,62.5,86.59,72.5,86.25,91.25,96.38,86.94,86.25,12.5,11.59,-2.5,36.25,3.75,8.88,-0.56,23.75,1,0,1,1,0,0,1,0,0,0,1,0,0,3,0,2,2,2,3,1,1,0,1,2,4,1,0,0,1,1,1,1,0,0,2,1,0,0,0,1,0.6,0.2,0.8,2,1.6,0.6,0.8,0.4,0.9,0.85,5,6.67,0,-3,-2,1,-1.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,62,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,-1,-4,-1,1,0,-1,-1,0,-1,0,3,-2,1,2,2,3,0,-1,-0.4,0,1.6,0.05 +351,R_6MIObewhpcim2EF,53 - 59,American,Male,3,2,1,2,1,-2,-1,1,1,1,0,-3,2,-3,3,-2,-1,-2,-2,-2,2,2,2,2,2,3,-1,-2,1,1,1,8,-1,-2,2,-2,3,6,-3,-2,-2,-2,-3,8,2,2,2,2,2,5,-1,-2,2,1,-1,5,-1,-2,2,-3,3,4,0,0,1,0,-1,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,58,TRUE,1,98,FALSE,1,100,TRUE,1,95,TRUE,1,86,TRUE,1,98,FALSE,0,94,TRUE,0,98,TRUE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,97,TRUE,1,99,TRUE,0,96,TRUE,0,94,FALSE,1,59,FALSE,1,100,TRUE,1,97,FALSE,0,96,TRUE,0,100,TRUE,1,100,TRUE,0,98,TRUE,1,100,TRUE,0,77,FALSE,1,77,TRUE,0,100,TRUE,1,99,TRUE,1,97,TRUE,1,100,0.0196,0,0.0001,0.0025,0,0,0,0.8836,0,0.9216,0.0001,0.0036,0.0004,0.9604,0.0004,0,1,0.1764,0.0529,0.9604,0.0009,0.0009,0.1681,0,0.9216,0.5929,0.0009,0,1,0.8836,1,1,0.376025,0.281892857,0.470157143,28,87.5,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,93.97,85.5,98.12,97.12,95.12,96.88,91.06,21.87,28.34,10.5,35.62,47.12,20.12,9.38,47.31,1,0,1,0,1,1,1,0,0,0,1,1,0,1,0,1,1,0,0,1,1,0,1,0,1,1,1,1,0,2,1,1,0,0,0,2,1,3,2,1,0.6,0.4,0.6,0.6,0.6,1,0.4,1.8,0.55,0.95,5.67,4.67,-2,3,2,-1,1,15 cents,25 minutes,24 days,Male,College Diploma/Certificate,54,0.625,0,0,0,0,0,1,0,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,-1,0,-2,0,0,0,1,0,-1,0,-3,-2,0,0,-0.6,0.2,-1.2,-0.4 +352,R_1BWY1jkuOwgS7iB,46 - 52,Canadian,Male,1,1,-2,1,3,-3,1,0,1,3,2,-3,3,1,3,-3,-3,-1,-3,-3,0,1,-3,-2,3,8,-3,1,1,1,3,7,2,-3,3,1,3,1,-3,-3,-3,-3,-3,6,0,1,-3,1,3,2,-3,2,1,2,3,2,2,-3,3,-3,3,2,-3,-3,-3,-3,-3,8,TRUE,0,100,TRUE,1,75,FALSE,1,75,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,90,FALSE,1,100,FALSE,1,90,TRUE,1,90,FALSE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,60,TRUE,1,90,0,0,0,0,0.01,0.25,0,0.81,0.25,0.01,1,0.01,0,0,0,0.0625,0,0.25,0,0,0,0.16,0.81,0,0.25,0.25,0.16,1,0.0625,1,0,0.01,0.226964286,0.189464286,0.264464286,20,62.5,26,81.25,6,75,8,100,5,62.5,7,87.5,14,87.5,12,75,86.25,73.12,85,97.5,89.38,90.94,81.56,-18.75,5,-1.88,-15,35,1.88,3.44,6.56,1,0,1,3,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0,4,0,0,0,2,0,0,1,0.2,0,0.4,0.4,0.6,0.8,0.4,0.4,0.55,5.33,2,6,5,-1,-2,3.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,0,3,0,0,-1,0,-1,0,0,0,0,-4,0,0,0,0,0,0,0.6,-0.4,-0.8,0,-0.15 +353,R_3Sfsbnd8gP6qoou,32 - 38,Canadian,Male,1,0,1,2,3,2,0,3,-2,3,0,2,3,3,1,1,2,2,2,1,0,3,3,2,3,7,2,2,2,-2,2,8,0,2,2,2,2,6,3,2,3,3,2,5,0,0,0,0,0,6,3,3,3,3,3,8,-1,0,2,0,2,5,3,3,3,3,3,10,FALSE,1,100,TRUE,1,60,FALSE,1,69,TRUE,0,87,TRUE,1,77,FALSE,1,71,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,73,FALSE,1,89,TRUE,1,100,TRUE,0,50,TRUE,1,88,TRUE,1,100,FALSE,1,80,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,57,FALSE,0,63,FALSE,1,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,FALSE,0,87,0,0,0,0,0.7569,0.0841,0.3969,0,0,0,0,0,0,0.0729,0.0529,0.16,0.1849,0.7569,0,0,0,0.0144,0.0081,0.25,0.04,0.36,1,0,0.0961,1,1,0.0121,0.223078571,0.176107143,0.27005,27,84.38,24,75,5,62.5,6,75,6,75,7,87.5,13,81.25,11,68.75,87.56,82.38,84,93.75,90.12,92.19,82.94,9.38,12.56,19.88,9,18.75,2.62,10.94,14.19,1,3,2,0,0,0,2,1,0,1,0,0,1,1,1,2,0,1,1,1,1,0,1,2,3,1,3,0,5,0,1,2,1,3,1,2,1,1,1,2,1.2,0.8,0.6,1,1.4,1.8,1.6,1.4,0.9,1.55,7,6.33,1,0,1,-5,0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,3,1,-2,-3,-1,-1,1,-5,1,-1,-2,0,-2,0,0,-1,0,0,-1,-0.2,-1,-1,-0.4,-0.65 +354,R_7qEzOyCILFOJjxu,53 - 59,Canadian,Female,0,1,3,2,0,1,-2,0,-3,-1,3,0,1,-2,3,2,0,1,0,-3,3,3,2,0,1,1,0,-3,0,-1,0,1,2,1,3,-2,2,1,-1,0,1,0,1,1,3,2,1,1,-1,1,0,-1,1,-1,-3,1,2,3,0,-3,3,1,0,-3,0,0,-2,5,FALSE,1,55,FALSE,0,54,TRUE,0,66,FALSE,1,54,FALSE,0,54,FALSE,1,53,FALSE,0,51,FALSE,0,52,FALSE,0,58,TRUE,1,53,FALSE,1,60,TRUE,0,85,TRUE,1,90,FALSE,1,54,TRUE,1,54,FALSE,0,50,FALSE,1,55,TRUE,0,80,FALSE,1,53,FALSE,1,75,TRUE,1,53,FALSE,0,51,FALSE,1,51,FALSE,0,51,FALSE,1,51,FALSE,0,51,FALSE,1,51,FALSE,1,58,FALSE,1,52,TRUE,1,52,FALSE,0,53,TRUE,1,73,0.2704,0.2601,0.25,0.2601,0.0729,0.2209,0.2601,0.2209,0.0625,0.2601,0.2304,0.01,0.3364,0.16,0.2916,0.2916,0.2401,0.2116,0.1764,0.2401,0.2209,0.2116,0.2209,0.2116,0.2025,0.2401,0.2809,0.2025,0.4356,0.64,0.2304,0.7225,0.253753571,0.204935714,0.302571429,17,53.13,19,59.38,5,62.5,7,87.5,4,50,3,37.5,6,37.5,13,81.25,57.91,54.62,60.12,55.75,61.12,56.25,59.56,-6.25,-1.47,-7.88,-27.38,5.75,23.62,18.75,-21.69,3,2,1,2,1,1,1,0,2,1,1,1,2,0,1,3,0,0,0,4,3,1,2,1,1,1,1,1,2,2,1,3,1,1,0,2,3,1,0,1,1.8,1,1,1.4,1.6,1.4,1.2,1.4,1.3,1.4,1,1,0,0,0,-4,0,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,53,-0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,1,-1,1,0,0,0,-1,0,-1,0,-2,1,-1,1,1,-3,-1,0,3,0.2,-0.4,-0.2,0,-0.1 +355,R_67NA8zgS1bPutTI,53 - 59,Canadian,Female,3,3,3,2,-1,-1,-3,3,1,-2,3,1,2,-3,3,-3,-2,1,1,-1,3,1,3,-2,1,4,1,2,1,3,-2,7,3,1,2,-1,3,5,-3,-3,-3,-2,-3,6,3,3,3,3,-2,0,-2,-2,3,-1,-3,3,3,1,2,-3,3,2,-1,-3,1,0,-1,4,FALSE,1,100,TRUE,1,90,FALSE,1,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,85,TRUE,1,85,TRUE,0,80,FALSE,1,100,FALSE,0,50,FALSE,1,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,90,TRUE,0,60,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,80,FALSE,1,55,TRUE,0,75,FALSE,0,70,FALSE,0,50,TRUE,1,100,0,0.09,0,0.01,0,0,0,0.0225,0,0,0.49,0.25,0.0225,0.64,0.0625,0.01,0,0.25,0.2025,0,0.1225,0.25,0.36,0.16,0.25,0.64,0.25,0,0,0.81,0.5625,0,0.19125,0.124821429,0.257678571,21,65.63,23,71.88,3,37.5,6,75,7,87.5,7,87.5,12,75,11,68.75,80.62,68.12,76.88,86.88,90.62,80,81.25,-6.25,8.74,30.62,1.88,-0.62,3.12,5,12.5,0,2,0,4,2,2,5,2,2,0,0,0,0,2,0,0,1,4,3,2,0,0,0,1,1,1,1,0,2,1,0,0,0,0,0,2,1,0,1,0,1.6,2.2,0.4,2,0.4,1,0,0.8,1.55,0.55,5.33,1.67,4,4,3,2,3.66,10 cents,100 minutes,15 days,Female,High School (or equivalent),55,0.375,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,2,0,3,1,1,4,2,0,-1,0,0,0,2,0,-2,0,4,2,2,1.2,1.2,0.4,1.2,1 +356,R_3wSrJ7Gl3snoC2d,60 - 66,Canadian,Female,2,2,2,0,3,0,0,2,-2,1,3,3,3,0,3,0,0,1,0,1,2,2,2,-2,3,5,0,-1,2,-2,0,5,3,3,3,0,3,5,0,-1,1,0,0,7,2,2,2,2,2,7,0,0,1,0,0,5,2,0,-2,-1,0,4,0,0,1,1,1,6,TRUE,0,82,TRUE,1,66,TRUE,0,98,FALSE,1,55,FALSE,0,55,TRUE,0,83,TRUE,1,86,TRUE,1,94,FALSE,0,68,TRUE,1,100,TRUE,0,71,TRUE,0,96,TRUE,1,60,FALSE,1,100,FALSE,0,67,TRUE,1,100,TRUE,0,90,TRUE,0,98,FALSE,1,57,TRUE,0,100,TRUE,1,91,FALSE,0,53,FALSE,1,79,TRUE,1,89,FALSE,1,100,TRUE,1,97,FALSE,1,57,TRUE,0,85,TRUE,0,86,TRUE,1,100,FALSE,0,59,TRUE,1,100,0.0036,0.0009,0,0.0196,0,0.6889,0.0121,0,1,0.2809,0,0.16,0.4624,0.5041,0.3025,0.1156,0.0441,0.2025,0.7225,0,0.0081,0.4489,0.1849,0,0.81,0.1849,0.3481,0.6724,0.9604,0.9604,0.7396,0.9216,0.383389286,0.269507143,0.497271429,19,59.38,17,53.13,4,50,4,50,5,62.5,4,50,11,68.75,6,37.5,81.94,62.5,80.5,89.5,95.25,80.31,83.56,6.25,28.81,12.5,30.5,27,45.25,11.56,46.06,0,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,1,2,1,1,3,5,1,3,0,0,0,1,0,0.4,0.4,0,0.4,0.6,0.8,2.6,0.2,0.3,1.05,5,5.33,-2,0,1,1,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),65,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,1,-1,-2,0,-1,-3,-5,-1,-3,0,1,0,-1,1,-0.2,-0.4,-2.6,0.2,-0.75 +357,R_7HiTKDTQv39yl5k,67 - 73,American,Male,-2,-1,-1,-2,1,0,-1,2,-2,-2,2,1,3,1,0,1,1,1,1,-3,-2,-1,0,-2,2,1,0,-2,2,-2,-2,1,2,1,3,1,0,0,-1,1,1,1,-3,9,-1,0,1,0,-1,1,0,0,0,0,-2,3,2,1,3,-1,0,1,0,0,0,1,-3,6,TRUE,0,100,TRUE,1,80,FALSE,1,100,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0.0625,0,0.04,0,0.2116,0,0,0,0.25,0,0,0,1,0,1,0,1,1,0.2116,0.172792857,0.0269,0.318685714,28,87.5,28,87.5,7,87.5,7,87.5,6,75,8,100,16,100,12,75,93.38,82.38,100,100,91.12,94.06,92.69,0,5.88,-5.12,12.5,25,-8.88,-5.94,17.69,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,2,2,2,0,1,2,2,0,0,0,0,2,0,1,1,1,0,0,0.4,0.2,0,0.4,1.6,1,0.4,0.6,0.25,0.9,0.67,1.67,0,-2,-1,3,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,69,-0.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,-1,-1,-2,-1,0,0,-2,-2,0,0,0,0,-2,0,1,-1,-1,0,0,-1.2,-0.8,-0.4,-0.2,-0.65 +358,R_7I9Od9hmN304V0k,39 - 45,Canadian,Male,1,2,1,-2,-3,-3,1,3,-3,-1,-2,3,3,-3,-1,3,0,3,3,3,-1,3,3,2,-3,7,-1,-3,0,-2,-2,5,-1,3,3,-3,-1,5,-1,-1,-2,1,3,5,1,-2,-2,-2,-3,7,-3,3,3,-3,-2,3,-2,3,3,-3,-1,3,3,-2,3,3,3,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,85,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0625,0,0.5625,1,0,1,0.64,0.04,0.7225,0,1,1,1,1,0,0.286696429,0.004464286,0.568928571,30,93.75,23,71.88,6,75,6,75,4,50,7,87.5,15,93.75,8,50,96.72,95,97.5,94.38,100,100,93.44,21.87,24.84,20,22.5,44.38,12.5,6.25,43.44,2,1,2,4,0,2,4,3,1,1,1,0,0,0,0,4,1,5,2,0,0,4,3,0,0,0,2,0,0,1,0,0,0,0,0,0,2,0,0,0,1.8,2.2,0.2,2.4,1.4,0.6,0,0.4,1.65,0.6,5.67,4.33,0,2,2,2,1.34,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,42,-0.375,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,2,-3,-1,4,0,2,2,3,1,0,1,0,0,0,0,4,-1,5,2,0,0.4,1.6,0.2,2,1.05 +359,R_74eXLz4khUCjBgq,39 - 45,Canadian,Female,0,3,2,2,3,0,-1,1,1,2,1,1,2,0,1,0,-1,-2,0,-2,2,3,1,2,3,7,3,2,3,1,3,8,1,-1,2,3,2,9,2,1,3,3,3,10,2,3,2,2,3,7,0,0,0,0,0,10,-1,0,2,0,1,9,2,2,2,2,2,10,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,1,55,TRUE,1,100,FALSE,1,70,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,TRUE,1,80,TRUE,0,100,FALSE,1,65,TRUE,0,70,TRUE,0,100,FALSE,0,55,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,90,TRUE,1,90,FALSE,0,60,TRUE,1,100,0,0.04,0.04,0,0,0.09,0,0,1,0.16,0.01,0,0.3025,0.16,0,0,0,0.2025,0.25,0,0.3025,0.16,0.49,0,1,0.36,0.36,1,0.5625,0.1225,0.81,1,0.297946429,0.1375,0.458392857,22,68.75,21,65.63,4,50,5,62.5,7,87.5,5,62.5,13,81.25,8,50,82.34,65,89.38,88.12,86.88,83.75,80.94,3.12,16.71,15,26.88,0.62,24.38,2.5,30.94,2,0,1,0,0,3,3,2,0,1,0,2,0,3,1,2,2,5,3,5,2,0,0,0,0,0,1,1,1,2,2,1,0,0,0,2,3,4,2,4,0.6,1.8,1.2,3.4,0.4,1,0.6,3,1.75,1.25,8,8.67,0,-2,0,0,-0.67,10 cents,5 minutes,24 days,Female,University - Undergraduate,45,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,1,0,0,3,2,1,-1,-1,-2,1,0,3,1,0,-1,1,1,1,0.2,0.8,0.6,0.4,0.5 +360,R_3e714bzOWPS2ZBT,39 - 45,Canadian,Female,-3,2,1,3,-2,-2,2,1,3,1,-1,-2,-2,-1,0,-2,-2,-1,-1,-2,-3,2,3,2,-2,6,1,2,1,3,2,7,-1,-2,-1,-1,0,6,-2,-1,-2,-2,-2,4,-3,1,2,3,0,6,-3,1,1,1,-2,6,-1,-2,-2,-3,-2,6,-1,-2,-1,-1,-2,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,80,TRUE,0,50,TRUE,1,59,TRUE,1,58,TRUE,1,50,TRUE,1,59,FALSE,1,50,TRUE,0,54,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,73,FALSE,1,50,TRUE,1,81,FALSE,1,50,FALSE,1,54,FALSE,1,50,FALSE,0,54,FALSE,0,54,TRUE,1,90,0.1764,0.0361,0.25,0.1681,0.01,0.25,0.0729,0.1681,0.25,0.25,0.2916,0.25,0.25,0.25,0.04,0.25,0.25,0.25,0.2116,0.25,0.25,0.25,0.25,0,0.25,0.25,0.2916,0.25,0.25,0.25,0.25,0.2916,0.218835714,0.202328571,0.235342857,8,25,22,68.75,5,62.5,4,50,7,87.5,6,75,9,56.25,13,81.25,56.75,50.5,58.75,62.38,55.38,59.88,53.62,-43.75,-12,-12,8.75,-25.12,-19.62,3.63,-27.63,0,0,2,1,0,3,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,2,1,1,0,2,3,0,0,0,2,2,1,0,0,0,0,0.6,0.8,0.2,0.6,0.8,1.4,0.8,0.2,0.55,0.8,6.33,6,0,1,0,-2,0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,43,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,-1,1,1,-2,2,-1,0,-2,-2,0,0,1,-2,-2,-1,1,1,1,0,-0.2,-0.6,-0.6,0.4,-0.25 +361,R_5EtClCm5PQEaGv1,53 - 59,American,Male,-3,3,3,-3,3,1,-3,3,-3,3,3,3,3,-1,3,3,3,3,3,3,-3,3,3,-3,3,0,-1,-3,3,-3,1,2,3,3,3,1,3,0,-1,-1,-1,-1,-1,10,-3,3,3,-3,3,0,1,-3,3,-3,3,0,3,3,3,1,3,0,3,0,3,3,3,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,61,FALSE,0,61,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,52,FALSE,1,100,TRUE,1,70,FALSE,0,78,FALSE,1,51,FALSE,0,52,TRUE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,54,FALSE,0,75,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.2704,0,0,0.6084,0.5625,1,0,0,0.0841,0,0.2401,0,0,0.5625,0.09,0.3721,0.2304,0.3721,0,0.25,0,1,1,1,0.2916,1,0.319078571,0.197535714,0.440621429,17,53.13,19,59.38,6,75,6,75,3,37.5,4,50,11,68.75,8,50,85.94,82.88,80.75,89.25,90.88,87.94,83.94,-6.25,26.56,7.88,5.75,51.75,40.88,19.19,33.94,0,0,0,0,0,2,0,0,0,2,0,0,0,2,0,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0.8,0.4,4,0,0,0.4,0.6,1.3,0.25,0.67,0,0,2,0,8,0.67,10 cents,5 minutes,24 days,Male,High School (or equivalent),57,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,4,1,4,4,4,0,0.8,0,3.4,1.05 +362,R_5KThwaDWZxRmrux,32 - 38,American,Female,0,-1,0,2,3,-1,-3,1,2,-1,3,1,-1,1,1,-1,0,0,1,-3,0,-1,3,3,2,6,-1,1,-1,0,1,6,1,1,-1,0,2,7,2,1,-1,-1,1,4,-3,0,1,-1,-1,6,0,-1,2,0,0,7,1,2,1,-1,2,8,2,0,-1,1,3,7,FALSE,1,85,TRUE,1,95,FALSE,1,54,FALSE,1,53,FALSE,0,53,TRUE,0,77,TRUE,1,98,TRUE,1,98,TRUE,1,90,FALSE,0,74,FALSE,1,59,TRUE,0,95,TRUE,1,91,TRUE,0,89,FALSE,0,50,TRUE,1,71,TRUE,0,86,TRUE,0,73,FALSE,1,64,FALSE,1,65,FALSE,0,74,TRUE,1,61,FALSE,1,100,TRUE,1,72,FALSE,1,99,FALSE,0,50,FALSE,1,50,TRUE,0,96,TRUE,0,86,TRUE,1,82,FALSE,0,50,TRUE,1,100,0.0004,0.25,0.0841,0.0004,0,0.5929,0.0784,0.5476,0.1225,0.1521,0.0324,0.0081,0.01,0.1681,0.2809,0.0025,0,0.2209,0.9216,0.0001,0.5476,0.25,0.1296,0.7921,0.7396,0.25,0.25,0.0225,0.2116,0.5329,0.7396,0.9025,0.303789286,0.158314286,0.449264286,12,37.5,19,59.38,6,75,3,37.5,4,50,6,75,10,62.5,9,56.25,76.25,63.88,83.38,78.62,79.12,75.56,76.94,-21.88,16.87,-11.12,45.88,28.62,4.12,13.06,20.69,0,0,3,1,1,0,4,2,2,2,2,0,0,1,1,3,1,1,2,4,3,1,1,3,4,1,2,1,2,1,2,1,2,2,1,3,0,1,0,6,1,2,0.8,2.2,2.4,1.4,1.6,2,1.5,1.85,6.33,7,0,-1,-1,-3,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,-3,-1,2,-2,-3,-1,2,1,0,1,0,-1,-2,-1,0,0,1,0,2,-2,-1.4,0.6,-0.8,0.2,-0.35 +363,R_12sc5rnLHC24OZS,46 - 52,Canadian,Male,2,0,2,0,2,-1,1,2,1,2,0,-2,2,1,0,2,2,2,2,1,2,2,1,-2,2,4,2,1,2,2,2,7,-1,-2,2,2,1,7,2,2,2,2,1,6,2,0,1,1,3,7,0,-1,2,-1,2,6,0,-2,2,-1,1,6,2,2,2,3,1,7,TRUE,0,54,TRUE,1,58,TRUE,0,63,FALSE,1,52,TRUE,1,68,FALSE,1,55,TRUE,1,61,TRUE,1,75,TRUE,1,58,FALSE,0,53,TRUE,0,53,TRUE,0,71,TRUE,1,59,TRUE,0,59,TRUE,1,56,TRUE,1,100,TRUE,0,54,TRUE,0,53,TRUE,0,77,FALSE,1,53,FALSE,0,54,FALSE,0,53,FALSE,1,53,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,52,FALSE,1,100,FALSE,1,55,TRUE,1,55,FALSE,0,55,TRUE,1,61,0.0625,0,0,0.1521,0.1521,0.2025,0.2116,0.2809,0.2209,0.2809,0.2025,0.1681,0.1764,0.2809,0.1024,0.1764,0.2209,0.2304,0,0,0.2916,0.1936,0.5929,0.3481,0.2916,0.2304,0.3025,0.2916,0.3969,0.2809,0.2025,0.5041,0.244057143,0.207635714,0.280478571,5,15.63,20,62.5,5,62.5,6,75,3,37.5,6,75,12,75,8,50,63.25,57.62,57.38,66.62,71.38,63.75,62.75,-46.87,0.75,-4.88,-17.62,29.12,-3.62,-11.25,12.75,0,2,1,2,0,3,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,2,0,2,0,0,0,0,2,1,0,0,0,1,0,1,0.8,0.6,0,0.6,1,0.6,0.2,0.6,0.6,6,6.33,-3,1,1,-1,-0.33,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,51,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,2,0,1,-1,2,-2,0,-1,0,1,0,0,-1,0,0,0,0,-1,0,0.4,-0.2,0,-0.2,0 +364,R_57kAOyXKZLlEKxT,53 - 59,American,Female,3,2,2,2,3,-3,-1,1,0,-1,2,1,2,-1,2,1,1,1,2,1,3,3,3,3,3,1,-3,-2,1,1,-2,0,1,1,-1,-1,1,2,1,1,1,1,1,2,2,2,2,2,2,2,-3,-1,1,1,-1,1,2,1,1,1,1,4,1,1,1,1,1,1,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,0,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.285714286,0.214285714,0.357142857,2,6.25,17,53.13,4,50,4,50,5,62.5,4,50,16,100,1,6.25,59.38,50,50,68.75,68.75,62.5,56.25,-46.88,6.25,0,0,6.25,18.75,-37.5,50,0,1,1,1,0,0,1,0,1,1,1,0,3,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,2,1,0,0,0,1,0,0.6,0.6,1,0.2,0.4,0.2,0.8,0.2,0.6,0.4,1,2.33,-1,-1,-2,1,-1.33,5 cents,100 minutes,15 days,Female,College Diploma/Certificate,53,0.625,1,0,0,0,1,0,0.33,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,1,1,1,-1,0,1,0,0,1,1,0,2,-2,0,0,0,0,0,0,0.2,0.4,0.2,0,0.2 +365,R_3PJEmvviwvNuAnL,32 - 38,Canadian,Female,1,0,-2,-3,1,-2,-2,1,0,3,0,0,1,-1,0,-1,-2,0,0,-1,2,3,2,-3,0,6,2,0,0,-2,3,10,-2,-2,3,3,-1,5,2,1,2,1,1,8,3,2,-2,-3,3,3,1,-3,2,-2,3,5,1,2,3,-2,0,4,2,3,3,3,1,7,FALSE,1,61,FALSE,0,54,FALSE,1,100,FALSE,1,69,TRUE,1,68,FALSE,1,94,TRUE,1,100,TRUE,1,100,FALSE,0,56,TRUE,1,91,TRUE,0,64,TRUE,0,100,TRUE,1,93,FALSE,1,58,FALSE,0,73,TRUE,1,65,TRUE,0,59,TRUE,0,62,FALSE,1,79,TRUE,0,61,FALSE,0,53,FALSE,0,59,TRUE,0,100,TRUE,1,60,TRUE,0,100,TRUE,1,55,FALSE,1,52,FALSE,1,51,FALSE,1,52,TRUE,1,59,FALSE,0,51,TRUE,1,100,0,0.2025,0.1225,0,0,0.0036,0.16,0.0081,0.3721,0.3481,0.1681,0.0049,0.3136,0.4096,0.1024,0.2916,1,0.0961,0.2401,1,0.2809,0.5329,0.0441,0.1764,0.3481,0.2304,0.2601,0.1521,0,0.3844,0.2304,1,0.291360714,0.234157143,0.348564286,16,50,19,59.38,3,37.5,5,62.5,5,62.5,6,75,10,62.5,9,56.25,71.84,62.25,77.38,73.25,74.5,71.06,72.62,-9.38,12.46,24.75,14.88,10.75,-0.5,8.56,16.37,1,3,4,0,1,4,2,1,2,0,2,2,2,4,1,3,3,2,1,2,2,2,0,0,2,3,1,1,2,0,1,2,2,1,0,3,5,3,3,2,1.8,1.8,2.2,2.2,1.2,1.4,1.2,3.2,2,1.75,7,4,3,5,1,1,3,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,37,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,1,4,0,-1,1,1,0,0,0,1,0,0,3,1,0,-2,-1,-2,0,0.6,0.4,1,-1,0.25 +366,R_5wvnZJXgfWFlJm5,39 - 45,American,Male,1,2,1,2,2,1,1,2,2,1,1,2,2,1,1,1,1,2,0,2,1,2,1,1,2,8,2,2,2,3,1,8,0,1,2,0,1,8,1,1,2,2,2,8,2,1,1,2,2,8,1,1,2,2,1,8,1,1,2,2,2,8,2,1,0,2,1,8,TRUE,0,88,TRUE,1,89,FALSE,1,76,FALSE,1,71,FALSE,0,76,FALSE,1,77,FALSE,0,82,FALSE,0,73,TRUE,1,84,FALSE,0,87,FALSE,1,98,TRUE,0,71,FALSE,0,75,TRUE,0,90,FALSE,0,72,TRUE,1,77,FALSE,1,75,TRUE,0,73,FALSE,1,75,FALSE,1,76,FALSE,0,88,FALSE,0,76,FALSE,1,85,FALSE,0,82,FALSE,1,87,FALSE,0,81,FALSE,1,85,FALSE,1,68,FALSE,1,80,TRUE,1,86,FALSE,0,80,FALSE,0,84,0.5329,0.6561,0.0529,0.6724,0.7056,0.0529,0.6724,0.7569,0.0576,0.5776,0.0196,0.5625,0.0256,0.0004,0.5776,0.0121,0.0225,0.0841,0.1024,0.0169,0.7744,0.5184,0.0625,0.81,0.0625,0.0225,0.64,0.7744,0.0576,0.5329,0.04,0.5041,0.323071429,0.294814286,0.351328571,18,56.25,16,50,6,75,4,50,1,12.5,5,62.5,4,25,12,75,80.22,81.75,80,83,76.12,80.75,79.69,6.25,30.22,6.75,30,70.5,13.62,55.75,4.69,0,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0,2,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,2,2,1,0.2,0.6,0.6,0.4,0.4,0,0.6,1.2,0.45,0.55,8,8,0,0,0,0,0,10 cents,5 minutes,36 days,Male,Trade School (non-military),41,0.125,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,-1,-1,0,1,0,1,1,0,1,0,1,0,0,0,-1,-1,0,-2,0,-1,-0.2,0.6,0,-0.8,-0.1 +367,R_78UHVzrSM2g903q,67 - 73,Canadian,Male,-2,1,2,-2,1,-2,-3,0,-1,-2,-1,1,1,0,2,-2,-2,-2,-2,-2,-3,2,2,-2,2,1,0,-2,0,-2,-1,1,-2,1,1,1,-1,2,-3,-3,-3,-2,-3,6,-2,2,2,-2,2,1,-1,-3,2,-3,1,2,0,2,2,-2,1,3,1,0,2,1,0,4,TRUE,0,96,TRUE,1,61,FALSE,1,96,FALSE,1,53,FALSE,0,53,FALSE,1,85,TRUE,1,91,TRUE,1,95,TRUE,1,54,TRUE,1,55,FALSE,1,56,FALSE,1,99,TRUE,1,96,TRUE,0,98,FALSE,0,60,FALSE,0,98,TRUE,0,54,TRUE,0,99,TRUE,0,80,TRUE,0,99,TRUE,1,100,FALSE,0,53,TRUE,0,53,TRUE,1,77,FALSE,1,55,TRUE,1,99,FALSE,1,53,FALSE,1,99,TRUE,0,52,TRUE,1,65,TRUE,1,68,TRUE,1,100,0.0025,0.0001,0.9604,0.0081,0,0.0225,0.0529,0.2025,0.9801,0.2809,0.1225,0.0016,0.2116,0.1936,0.2809,0.1521,0.2809,0.2209,0.0001,0.2025,0,0.36,0.64,0.9604,0.2916,0.2209,0.1024,0.9216,0.0016,0.9801,0.2704,0.0001,0.284096429,0.2145,0.353692857,28,87.5,20,62.5,6,75,4,50,4,50,6,75,12,75,8,50,76.62,60.62,74.12,80.75,91,76.56,76.69,25,14.12,-14.38,24.12,30.75,16,1.56,26.69,1,1,0,0,1,2,1,0,1,1,1,0,0,1,3,1,1,1,0,1,0,1,0,0,1,1,0,2,2,3,1,1,1,2,1,3,2,4,3,2,0.6,1,1,0.8,0.4,1.6,1.2,2.8,0.85,1.5,1.33,2,0,-1,-1,2,-0.67,10 cents,5 minutes,24 days,Male,High School (or equivalent),72,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,1,0,0,0,0,1,1,-2,-1,-2,0,-1,-1,-1,2,-2,-1,-3,-3,-1,0.2,-0.6,-0.2,-2,-0.65 +368,R_7HOCctrM57A9aW5,46 - 52,American,Female,1,2,2,0,1,-1,-1,2,-1,0,0,-1,2,2,2,1,2,1,2,-1,1,2,2,0,0,4,-1,-1,2,-1,1,3,1,-1,2,2,2,3,1,1,1,1,-1,3,1,2,2,1,1,2,-1,-1,2,1,-1,2,0,-1,2,2,2,2,0,1,1,0,-1,2,FALSE,1,100,FALSE,0,76,TRUE,0,98,FALSE,1,64,TRUE,1,99,FALSE,1,100,TRUE,1,97,TRUE,1,97,TRUE,1,97,FALSE,0,94,FALSE,1,93,TRUE,0,94,TRUE,1,98,TRUE,0,98,FALSE,0,64,TRUE,1,95,FALSE,1,91,TRUE,0,99,FALSE,1,65,FALSE,1,98,TRUE,1,96,TRUE,1,96,FALSE,1,96,TRUE,1,98,TRUE,0,99,TRUE,1,100,FALSE,1,64,FALSE,1,96,TRUE,0,92,TRUE,1,100,FALSE,0,91,TRUE,1,99,0.0009,0,0.0025,0.0009,0.0001,0,0.0004,0.8836,0.0004,0.0016,0,0.0004,0.0009,0.0049,0.0001,0.5776,0.0016,0.1296,0.0016,0.9801,0.0016,0.4096,0.1225,0.9604,0.0081,0.1296,0.8281,0,0.9604,0.9801,0.8464,0.8836,0.311189286,0.114371429,0.508007143,27,84.38,22,68.75,5,62.5,7,87.5,4,50,6,75,12,75,10,62.5,92,76.75,96.38,97.88,97,93.56,90.44,15.63,23.25,14.25,8.88,47.88,22,18.56,27.94,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,2,1,0,0,0,0,0,1,1,0,2,0,0.2,0.2,0.2,0.4,0.2,0.6,0,0.8,0.25,0.4,3.33,2,2,1,1,1,1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,47,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,-1,1,0,0,0,-2,0,1,0,0,0,0,-1,0,0,-1,0,0,-0.4,0.2,-0.4,-0.15 +369,R_3VJhpQnj11ZDfBI,67 - 73,American,Female,3,1,3,3,2,0,-2,2,-3,3,1,-2,3,-2,3,0,1,2,2,-2,3,2,-1,1,2,3,0,-2,-1,0,1,3,2,-1,2,-1,3,6,-3,-2,-3,-2,-3,4,3,2,3,3,2,2,-1,-2,2,-3,1,1,-3,-3,3,-3,3,1,-2,-1,2,2,-3,1,FALSE,1,76,FALSE,0,76,FALSE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,0,100,TRUE,1,75,FALSE,0,100,FALSE,1,100,FALSE,1,81,TRUE,1,76,TRUE,0,100,FALSE,0,54,TRUE,1,75,FALSE,1,100,FALSE,1,100,TRUE,0,63,FALSE,1,63,FALSE,0,100,TRUE,1,81,FALSE,1,100,TRUE,1,86,FALSE,1,100,TRUE,1,78,TRUE,0,55,FALSE,1,100,TRUE,0,100,FALSE,0,65,FALSE,0,56,FALSE,0,100,1,0.0484,0.0625,0.0625,1,0,0.0196,1,0.1369,0.0361,0.4225,0.0576,0.0625,0,0,0.5776,0,0.16,0,0,1,0.2916,0.3969,1,0,0.3025,0.3136,0.0576,0,0,1,0.0361,0.281110714,0.248057143,0.314164286,22,68.75,20,62.5,3,37.5,5,62.5,6,75,6,75,8,50,12,75,84.22,67.38,97,88.75,83.75,81.06,87.38,6.25,21.72,29.88,34.5,13.75,8.75,31.06,12.38,0,1,4,2,0,0,0,3,3,2,1,1,1,1,0,3,3,5,4,1,0,1,0,0,0,1,0,0,0,2,4,1,0,1,0,2,2,0,0,1,1.4,1.6,0.8,3.2,0.2,0.6,1.2,1,1.75,0.75,4,1.33,1,2,5,3,2.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,71,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,0,4,2,0,-1,0,3,3,0,-3,0,1,0,0,1,1,5,4,0,1.2,1,-0.4,2.2,1 +370,R_3fQMosAnclVpbrP,25 - 31,Canadian,Female,3,2,2,-1,3,-1,-1,1,-1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,6,1,1,1,1,1,6,1,1,1,1,1,6,0,0,1,-1,0,6,0,0,0,0,0,6,0,0,0,0,0,7,TRUE,0,64,TRUE,1,65,TRUE,0,88,TRUE,0,68,TRUE,1,70,TRUE,0,70,TRUE,1,76,TRUE,1,74,FALSE,0,77,TRUE,1,74,FALSE,1,92,TRUE,0,95,FALSE,0,58,FALSE,1,61,FALSE,0,70,TRUE,1,87,FALSE,1,62,TRUE,0,84,TRUE,0,54,TRUE,0,63,TRUE,1,77,FALSE,0,58,TRUE,0,85,TRUE,1,69,FALSE,1,79,TRUE,1,62,FALSE,1,78,TRUE,0,66,TRUE,0,69,TRUE,1,76,FALSE,0,73,TRUE,1,69,0.0676,0.1444,0.0169,0.0576,0.0961,0.49,0.0961,0.0676,0.3969,0.3364,0.0576,0.3364,0.5929,0.0064,0.09,0.1225,0.7225,0.4624,0.4356,0.0441,0.0529,0.49,0.2916,0.1521,0.1444,0.0484,0.5329,0.4096,0.7744,0.7056,0.4761,0.9025,0.333357143,0.2767,0.390014286,16,50,16,50,3,37.5,4,50,5,62.5,4,50,11,68.75,5,31.25,72.28,72.12,70,69.75,77.25,70.94,73.62,0,22.28,34.62,20,7.25,27.25,2.19,42.37,2,1,1,2,2,2,2,0,2,1,1,1,1,1,1,1,0,0,1,1,2,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1.6,1.4,1,0.6,1.6,0.4,0,0.4,1.15,0.6,6.67,6,1,1,0,-1,0.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,29,0,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,1,0,2,1,1,1,1,1,1,1,-1,-1,1,1,0,1,1,0.2,0.55 +371,R_3VKJ5OzEbyaKuO0,67 - 73,American,Female,3,3,3,2,0,2,-3,3,-3,2,2,-2,2,-2,2,1,0,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,1,2,-2,2,-2,2,1,1,1,1,1,1,2,2,2,2,2,2,1,3,-3,3,-3,3,0,3,0,2,0,3,1,2,2,2,2,2,0,FALSE,1,61,TRUE,1,100,TRUE,0,100,TRUE,0,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,83,TRUE,0,100,TRUE,1,100,TRUE,0,74,TRUE,1,58,TRUE,1,64,TRUE,0,64,TRUE,0,100,TRUE,0,62,FALSE,1,100,FALSE,0,75,TRUE,1,79,TRUE,0,75,TRUE,1,78,TRUE,0,77,TRUE,1,75,TRUE,0,81,TRUE,0,79,TRUE,0,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0,0.0625,0.1296,0,0,0,0.0484,0,0,0.0441,0,0,0,0.6889,0,0,0.5625,0.3721,0.6241,0.5929,0.5625,0.1764,0.3844,0.5476,0.4096,0.6561,0.0324,0.1521,1,1,1,1,0.351932143,0.122571429,0.581292857,27,84.38,18,56.25,4,50,4,50,5,62.5,5,62.5,15,93.75,3,18.75,85.25,78.38,89.25,83.25,90.12,88.19,82.31,28.13,29,28.38,39.25,20.75,27.62,-5.56,63.56,1,1,1,0,2,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,2,1,0,0,0,1,1,2,0,2,1,1,2,0,0,0,1,0.6,0,0.8,1,0.4,1.2,0.6,0.6,0.8,1.33,0.67,1,1,0,2,0.66,10 cents,100 minutes,24 days,Female,Trade School (non-military),70,1.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,1,1,1,-1,-1,-2,0,-2,-1,-1,-1,1,1,1,0,0.2,-1.2,0.2,-0.2 +372,R_715Q1qPVNnSgfuk,60 - 66,Canadian,Female,-3,1,-2,1,-2,-1,0,0,1,-3,3,3,2,0,2,0,0,1,0,1,-3,1,-3,-2,0,5,0,-1,0,1,-1,5,2,3,3,0,2,6,0,-1,0,0,2,5,-3,2,-1,-2,-2,5,0,0,0,1,1,5,3,3,2,0,2,5,0,0,1,1,2,5,FALSE,1,53,FALSE,0,55,TRUE,0,82,FALSE,1,53,FALSE,0,55,FALSE,1,81,FALSE,0,55,TRUE,1,77,TRUE,1,54,TRUE,1,85,FALSE,1,55,TRUE,0,100,TRUE,1,56,FALSE,1,54,FALSE,0,54,TRUE,1,55,FALSE,1,53,TRUE,0,95,FALSE,1,54,FALSE,1,55,FALSE,0,53,FALSE,0,54,FALSE,1,56,FALSE,0,54,FALSE,1,73,TRUE,1,65,FALSE,1,55,TRUE,0,87,FALSE,1,55,FALSE,0,54,FALSE,0,54,TRUE,1,73,0.0529,0.1225,0.2025,0.3025,0.0729,0.0361,0.2916,0.0225,0.2025,0.2916,0.2916,0.1936,0.2116,0.2025,0.3025,0.3025,0.1936,0.2209,0.7569,0.0729,0.2809,0.2916,0.2116,0.2116,0.2209,0.2025,0.2916,0.2209,0.6724,0.9025,0.2025,1,0.2991,0.202571429,0.395628571,9,28.13,19,59.38,5,62.5,6,75,5,62.5,3,37.5,7,43.75,12,75,62.94,54.25,60.25,66.75,70.5,59.56,66.31,-31.25,3.56,-8.25,-14.75,4.25,33,15.81,-8.69,0,0,1,3,2,1,1,0,0,2,1,0,1,0,0,0,1,1,0,1,0,1,1,3,0,1,0,0,0,4,0,0,0,0,0,0,0,0,1,1,1.2,0.8,0.4,0.6,1,1,0,0.4,0.75,0.6,5.33,5,0,0,1,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,0,2,0,1,0,0,-2,1,0,1,0,0,0,1,1,-1,0,0.2,-0.2,0.4,0.2,0.15 +373,R_3jy7lCRUyQvFSvx,53 - 59,American,Female,3,3,2,0,2,-3,-3,2,-2,1,2,0,3,-1,1,-2,-3,-3,-3,-3,3,3,3,-1,3,5,-3,-1,0,1,2,5,2,0,2,0,2,5,0,0,0,1,-1,10,3,3,2,2,2,5,-3,-2,2,-2,2,5,2,0,2,-3,2,5,2,2,2,2,-2,10,FALSE,1,100,TRUE,1,78,FALSE,1,100,FALSE,1,50,TRUE,1,97,FALSE,1,50,TRUE,1,88,TRUE,1,73,TRUE,1,70,TRUE,1,68,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,93,FALSE,0,50,TRUE,1,87,TRUE,0,68,FALSE,1,87,FALSE,1,73,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,75,TRUE,0,75,TRUE,1,93,TRUE,0,50,FALSE,1,50,TRUE,0,80,TRUE,1,67,FALSE,0,50,TRUE,1,100,0.0729,0.0049,0.0169,0.0144,0,0.25,0.0625,0.1024,0,0.25,0.1089,0.25,0.09,0.25,0.0009,0.0484,0,0.25,0.25,0.5625,0.25,0.25,0.0729,0.8649,0.4624,0.25,0.25,0,0,0.0169,0.64,0.25,0.206525,0.118792857,0.294257143,16,50,21,65.63,4,50,4,50,5,62.5,8,100,11,68.75,10,62.5,72.56,58.88,74.38,81.75,75.25,71.62,73.5,-15.63,6.93,8.88,24.38,19.25,-24.75,2.87,11,0,0,1,1,1,0,2,2,3,1,0,0,1,1,1,2,3,3,4,2,0,0,0,2,0,0,1,0,0,1,0,0,1,2,1,4,5,5,5,1,0.6,1.6,0.6,2.8,0.4,0.4,0.8,4,1.4,1.4,5,5,0,0,0,0,0,20 cents,5 minutes,47 days,Female,College Diploma/Certificate,55,-0.375,0,1,1,0,0,0,0.67,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,1,-1,1,0,1,2,3,0,0,0,0,-1,0,-2,-2,-2,-1,1,0.2,1.2,-0.2,-1.2,0 +374,R_5Cp3IxHCoFb1Vch,46 - 52,Canadian,Male,-2,2,2,2,2,-1,0,0,2,1,-1,3,2,0,0,-3,-3,-3,-3,-3,-2,2,2,2,2,10,2,0,2,0,2,10,-2,3,2,2,3,10,3,3,3,3,3,10,-2,2,2,2,2,7,0,0,0,1,0,7,-1,2,1,1,0,7,0,0,0,0,0,7,TRUE,0,100,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,81,FALSE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,59,TRUE,0,64,TRUE,0,100,TRUE,1,54,FALSE,1,50,FALSE,0,50,TRUE,1,70,TRUE,0,74,TRUE,0,95,FALSE,1,50,TRUE,0,60,TRUE,1,60,FALSE,0,50,TRUE,0,96,TRUE,1,54,FALSE,1,100,TRUE,1,100,TRUE,0,55,FALSE,1,100,TRUE,0,64,TRUE,1,100,FALSE,0,54,FALSE,0,50,0,0,0.09,0.25,0.25,0.0361,0.2116,0.1681,0.36,0.25,0,0.2116,0.25,0.4096,0.25,0.25,0.9216,0.25,0,0,0.16,0.25,0.25,0.25,0.5476,0.3025,0.2916,1,0,0.9025,0.4096,1,0.327942857,0.272757143,0.383128571,16,50,16,50,2,25,4,50,4,50,6,75,9,56.25,7,43.75,70,52.88,66.12,75.5,85.5,62.56,77.44,0,20,27.88,16.12,25.5,10.5,6.31,33.69,0,0,0,0,0,3,0,2,2,1,1,0,0,2,3,6,6,6,6,6,0,0,0,0,0,1,0,0,1,1,0,1,1,1,0,3,3,3,3,3,0,1.6,1.2,6,0,0.6,0.6,3,2.2,1.05,10,7,3,3,3,3,3,10 cents,100 minutes,24 days,Male,Trade School (non-military),48,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,2,0,2,1,0,1,-1,-1,1,3,3,3,3,3,3,0,1,0.6,3,1.15 +375,R_6ODCd9pDC2ACPRv,46 - 52,American,Female,3,3,0,0,2,1,2,2,2,2,-2,0,3,-1,3,-2,-2,-2,-3,-3,3,3,0,-2,2,2,2,1,3,2,3,4,-2,0,2,1,3,4,-3,-3,-3,-3,-3,7,3,3,0,0,2,1,0,2,2,2,2,2,-2,0,3,-2,3,2,0,0,0,-2,-3,5,FALSE,1,89,TRUE,1,86,FALSE,1,87,FALSE,1,66,TRUE,1,92,FALSE,1,88,TRUE,1,88,TRUE,1,86,TRUE,1,80,TRUE,1,91,FALSE,1,69,FALSE,1,64,TRUE,1,86,FALSE,1,90,TRUE,1,74,TRUE,1,97,TRUE,0,63,FALSE,1,62,FALSE,1,61,TRUE,0,59,FALSE,0,70,TRUE,1,92,FALSE,1,96,TRUE,1,86,TRUE,0,65,FALSE,0,71,TRUE,0,90,FALSE,1,75,TRUE,0,86,TRUE,1,81,TRUE,1,65,TRUE,1,91,0.0196,0.5041,0.0009,0.0144,0.0081,0.0144,0.0196,0.0081,0.3481,0.0064,0.0361,0.0196,0.04,0.0961,0.0064,0.0196,0.0016,0.1156,0.0625,0.4225,0.49,0.0676,0.1521,0.01,0.3969,0.81,0.1225,0.0121,0.0169,0.1444,0.7396,0.1296,0.154157143,0.052835714,0.255478571,22,68.75,25,78.13,7,87.5,5,62.5,6,75,7,87.5,14,87.5,11,68.75,79.56,73.88,84,81,79.38,83.5,75.62,-9.38,1.43,-13.62,21.5,6,-8.12,-4,6.87,0,0,0,2,0,1,1,1,0,1,0,0,1,2,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,2,2,1,0,0.4,0.8,0.6,0.6,0,0.2,0.2,1.4,0.6,0.45,3.33,1.67,1,2,2,2,1.66,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),46,1.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,2,0,0,1,1,0,1,0,0,1,1,0,-1,-1,-1,-1,0,0.4,0.6,0.4,-0.8,0.15 +376,R_6CIbrBjMX2IaGzx,32 - 38,Canadian,Male,0,3,2,2,3,3,2,2,1,2,2,2,3,3,0,1,2,2,2,2,1,2,2,2,1,8,1,2,0,3,2,8,3,2,1,2,1,8,2,1,1,2,2,7,0,3,1,3,3,8,3,2,3,0,1,8,2,2,2,2,3,8,2,2,2,2,0,8,TRUE,0,70,TRUE,1,66,TRUE,0,87,FALSE,1,88,TRUE,1,79,FALSE,1,82,FALSE,0,78,FALSE,0,87,TRUE,1,83,TRUE,1,84,FALSE,1,82,TRUE,0,96,TRUE,1,91,FALSE,1,89,FALSE,0,75,TRUE,1,97,TRUE,0,93,TRUE,0,91,FALSE,1,93,FALSE,1,95,FALSE,0,87,TRUE,1,97,FALSE,1,93,TRUE,1,98,TRUE,0,95,FALSE,0,90,TRUE,0,91,TRUE,0,90,FALSE,1,91,TRUE,1,90,FALSE,0,97,FALSE,0,90,0.7569,0.81,0.0009,0.6084,0.81,0.0324,0.0004,0.0256,0.0025,0.0009,0.01,0.0081,0.0289,0.0324,0.0441,0.1156,0.0049,0.0144,0.81,0.9025,0.7569,0.5625,0.0049,0.0121,0.8649,0.8281,0.9409,0.49,0.7569,0.8281,0.0081,0.9216,0.350632143,0.080728571,0.620535714,20,62.5,17,53.13,5,62.5,5,62.5,3,37.5,4,50,9,56.25,8,50,87.97,84.38,88.25,86.75,92.5,86.81,89.12,9.37,34.84,21.88,25.75,49.25,42.5,30.56,39.12,1,1,0,0,2,2,0,2,2,0,1,0,2,1,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,3,1,0,0,0,2,0.8,1.2,1,0.6,0.4,0.6,1,0.6,0.9,0.65,8,8,0,0,0,-1,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),36,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,1,1,-1,-1,2,2,0,1,1,-1,1,0,1,0,-2,0,1,1,0,-2,0.4,0.6,0,0,0.25 +377,R_3OAVX3Wn1zJHxFj,46 - 52,Canadian,Female,1,2,-2,0,2,1,-3,3,-2,-2,3,1,1,0,3,2,2,2,1,-2,0,2,-1,1,2,5,0,-2,2,-1,-2,6,2,2,2,-2,2,5,2,2,2,2,2,5,1,2,0,0,1,5,-1,-2,1,-1,1,5,2,2,1,2,2,5,2,2,2,2,0,5,FALSE,1,92,TRUE,1,70,TRUE,0,100,TRUE,0,74,FALSE,0,71,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,0,55,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,52,FALSE,0,100,TRUE,0,100,TRUE,0,90,FALSE,1,83,FALSE,1,72,TRUE,1,91,TRUE,1,53,TRUE,0,81,FALSE,0,93,TRUE,0,84,TRUE,1,100,TRUE,0,59,TRUE,0,100,TRUE,0,83,TRUE,1,81,FALSE,0,95,TRUE,1,94,0,0,1,0.0081,0.0036,0,0.8649,0,0.0784,0.2209,0.0361,0,0.0081,0.3025,0.5041,0.09,0.6561,0.5476,1,0.7056,0.0081,0.2304,0.0289,1,1,0.3481,0.9025,0.0064,1,0.81,0.6889,1,0.430042857,0.236592857,0.623492857,16,50,16,50,4,50,4,50,5,62.5,3,37.5,12,75,4,25,86.09,72.38,90,88.75,93.25,86.38,85.81,0,36.09,22.38,40,26.25,55.75,11.38,60.81,1,0,1,1,0,1,1,1,1,0,1,1,1,2,1,0,0,0,1,4,0,0,2,0,1,2,1,2,1,3,1,1,0,2,1,0,0,0,1,2,0.6,0.8,1.2,1,0.6,1.8,1,0.6,0.9,1,5.33,5,0,1,0,0,0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,1,0,-1,1,-1,-1,0,-1,0,-3,0,0,1,0,0,0,0,0,0,2,0,-1,0.2,0.4,-0.1 +378,R_7mdm9AY0zbSba49,18 - 24,American,Female,0,1,0,-1,1,-2,-1,1,2,2,2,-1,3,0,3,-3,-2,-2,-3,-3,3,2,0,1,0,5,-3,-2,-2,-1,0,5,2,-1,3,0,3,1,0,0,1,-3,1,8,1,1,1,-2,1,4,-1,-2,2,-1,1,4,2,-1,3,0,3,0,0,0,1,0,-1,8,FALSE,1,100,TRUE,1,52,FALSE,1,76,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,94,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,0,63,FALSE,0,67,TRUE,1,100,FALSE,1,52,FALSE,1,80,TRUE,0,68,FALSE,1,85,FALSE,0,64,FALSE,0,55,FALSE,1,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,TRUE,0,74,TRUE,0,62,TRUE,0,100,FALSE,0,74,FALSE,0,53,FALSE,0,100,0.0001,0,0,0,1,0,0.0001,0.04,0.0225,0.3025,0.5476,0.0016,0.0036,0.25,0,0.2304,0,0.2304,0.3844,0,0.4096,0.4489,0.4624,0.3969,0.2304,0.5476,0.2809,0,0.0576,0.04,1,0.25,0.254907143,0.187764286,0.32205,26,81.25,21,65.63,4,50,5,62.5,6,75,6,75,10,62.5,11,68.75,79.53,63.75,89,84.75,80.62,83.31,75.75,15.62,13.9,13.75,26.5,9.75,5.62,20.81,7,3,1,0,2,1,1,1,3,3,2,0,0,0,0,0,3,2,3,0,4,1,0,1,1,0,1,1,1,3,1,0,0,0,0,0,3,2,3,3,2,1.4,2,0,2.4,0.6,1.4,0,2.6,1.45,1.15,3.67,2.67,1,1,1,0,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,23,1.125,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,1,-1,1,1,0,0,2,0,1,0,0,0,0,0,0,0,0,-3,2,0.8,0.6,0,-0.2,0.3 +379,R_5KNnaSA3QeWeCr9,60 - 66,American,Female,3,3,3,3,3,-3,1,1,1,-2,2,3,3,1,3,2,1,2,2,0,3,3,3,3,3,0,-3,2,1,2,-3,2,3,3,3,0,3,1,0,-1,0,0,-1,6,3,3,3,3,-1,1,-3,2,1,2,-3,0,3,3,3,-2,3,0,0,0,0,1,1,5,FALSE,1,100,TRUE,1,90,TRUE,0,95,FALSE,1,67,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,TRUE,0,78,TRUE,1,73,TRUE,0,100,TRUE,1,74,TRUE,1,100,TRUE,0,83,TRUE,0,100,TRUE,0,84,FALSE,1,100,TRUE,1,85,TRUE,1,93,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,59,FALSE,1,57,TRUE,0,81,TRUE,1,100,FALSE,0,57,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0049,0,0.0729,0.0025,0,0,0.01,1,0.1089,0.1849,0,0.0225,0.0676,0.7056,1,0.6889,0.3481,0.3249,0,0.9025,1,0.6561,0.6084,0.275310714,0.085657143,0.464964286,27,84.38,22,68.75,5,62.5,5,62.5,6,75,6,75,15,93.75,7,43.75,89.72,78.25,90.25,99.12,91.25,91.69,87.75,15.63,20.97,15.75,27.75,24.12,16.25,-2.06,44,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,2,2,2,2,1,0,0,0,0,4,0,1,0,1,1,1,0,0,3,0,2,1,2,1,1,0,0.6,0.4,1.8,0.8,0.6,0.8,1.4,0.7,0.9,1,0.33,-1,2,1,1,0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),63,1.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,-4,0,0,0,0,0,0,0,0,-2,0,0,1,0,1,0,-0.8,0,-0.4,0.4,-0.2 +380,R_3QFOR6F1kwh7Qjv,46 - 52,Canadian,Female,3,1,3,2,2,-3,-3,2,-2,1,1,1,1,1,2,1,1,1,1,0,2,1,3,2,2,5,-3,-3,2,-2,1,5,1,1,2,2,2,2,1,1,1,1,0,3,3,1,3,2,2,4,-3,-3,2,-2,2,2,1,1,2,0,2,2,1,1,1,1,1,2,FALSE,1,95,TRUE,1,98,FALSE,1,98,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,97,TRUE,1,98,TRUE,1,92,FALSE,1,50,TRUE,0,100,TRUE,1,98,FALSE,1,54,FALSE,0,50,TRUE,1,100,FALSE,1,93,TRUE,0,100,FALSE,1,56,FALSE,1,50,TRUE,1,97,TRUE,1,96,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,95,FALSE,1,50,FALSE,1,50,TRUE,0,97,FALSE,0,50,FALSE,0,50,TRUE,1,97,0.0009,0.0025,0,0.0016,0.0009,0,0.0081,0.0064,0.25,0.0016,0.25,0.0004,0.0004,0.25,0,0.0004,0,0.25,0.25,0,0.0009,0.25,0.1936,0.2116,0.0049,0.25,0.25,0.0025,0.0004,1,0.9409,1,0.191892857,0.072728571,0.311057143,28,87.5,26,81.25,6,75,7,87.5,7,87.5,6,75,13,81.25,13,81.25,82.75,62.75,97.75,91,79.5,87.81,77.69,6.25,1.5,-12.25,10.25,3.5,4.5,6.56,-3.56,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0.2,0,0.4,0,0,0.2,0.4,0.2,0.15,0.2,4,2.67,1,3,0,1,1.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,48,0.125,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,0.2,-0.2,0,-0.2,-0.05 +381,R_5woH3iyCjf4hAY8,39 - 45,American,Female,3,-3,-3,-3,2,-1,-1,2,0,1,1,0,1,0,1,-2,-2,-2,-2,-1,3,1,1,-3,2,7,1,0,1,-1,1,7,2,1,0,-1,1,7,0,0,0,0,0,9,3,-2,-3,-3,3,2,2,-2,2,-2,1,3,1,-1,1,-1,0,2,1,0,1,1,1,8,TRUE,0,75,TRUE,1,94,FALSE,1,96,FALSE,1,80,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,0,93,FALSE,1,75,TRUE,0,100,FALSE,1,65,FALSE,1,63,FALSE,0,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,55,FALSE,1,83,FALSE,1,59,TRUE,1,99,TRUE,1,86,TRUE,1,100,0,0,0.8649,0,0,0,0,1,0.1369,0,0.0001,0,0,0,0.0225,0.0036,0,0.04,0.0289,0,0.4225,0.25,0.1225,0,0.0625,0.3025,0.0196,0.5625,0.0016,1,0.1681,1,0.183707143,0.085935714,0.281478571,20,62.5,24,75,6,75,7,87.5,5,62.5,6,75,12,75,12,75,88.22,78.75,85.5,96.88,91.75,92,84.44,-12.5,13.22,3.75,-2,34.38,16.75,17,9.44,0,4,4,0,0,2,1,1,1,0,1,1,1,1,0,2,2,2,2,1,0,1,0,0,1,3,1,0,2,0,0,1,0,1,1,3,2,3,3,2,1.6,1,0.8,1.8,0.4,1.2,0.6,2.6,1.3,1.2,7,2.33,5,4,5,1,4.67,10 cents,100 minutes,36 days,Female,High School (or equivalent),42,0.375,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,3,4,0,-1,-1,0,1,-1,0,1,0,1,0,-1,-1,0,-1,-1,-1,1.2,-0.2,0.2,-0.8,0.1 +382,R_7vJeWfEssRlpo9r,32 - 38,Canadian,Female,3,3,2,-2,1,3,1,1,2,1,3,1,2,1,0,-1,0,1,2,0,-2,3,3,-3,3,5,0,0,0,0,0,5,0,0,0,0,0,8,0,0,0,0,0,7,3,3,3,0,3,5,3,3,3,2,0,7,1,2,3,0,1,8,1,1,2,2,2,7,TRUE,0,90,TRUE,1,50,FALSE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,76,TRUE,1,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,83,FALSE,1,100,TRUE,0,89,TRUE,0,50,TRUE,1,78,TRUE,1,100,FALSE,1,65,TRUE,1,100,TRUE,0,69,TRUE,1,92,TRUE,0,67,FALSE,1,50,TRUE,0,63,FALSE,0,50,FALSE,0,50,TRUE,1,96,0,0.0064,0,0.0196,0.0016,0.0576,0,0,0.25,0,0.25,0,0,0.25,0,0.25,0.1225,0.2025,0.25,0.4761,0.0484,0,0.7921,1,0.0289,0.4489,0.25,0.81,0,0,0.3969,0,0.210196429,0.098871429,0.321521429,16,50,22,68.75,4,50,7,87.5,5,62.5,6,75,14,87.5,8,50,81.53,70.12,82.62,92.12,81.25,87.62,75.44,-18.75,12.78,20.12,-4.88,29.62,6.25,0.12,25.44,5,0,1,1,2,3,1,1,2,1,3,1,2,1,0,1,0,1,2,0,0,0,1,2,2,0,2,2,0,1,2,1,1,1,1,2,1,1,0,2,1.8,1.6,1.4,0.8,1,1,1.2,1.2,1.4,1.1,6,6.67,0,-2,0,0,-0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,33,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,0,0,-1,0,3,-1,-1,2,0,1,0,1,0,-1,-1,-1,0,2,-2,0.8,0.6,0.2,-0.4,0.3 +383,R_7cZeMbi0x1TzwVz,39 - 45,American,Male,0,3,2,0,3,0,-3,3,-3,1,3,2,2,1,0,2,2,3,2,-1,-2,3,3,-1,3,4,2,-3,2,-2,1,6,3,-1,3,3,-2,4,1,0,1,1,-1,7,2,3,2,2,3,1,1,-3,3,-3,1,0,3,3,3,-2,1,0,3,3,3,3,3,2,FALSE,1,100,TRUE,1,74,FALSE,1,70,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,78,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,87,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,0,0,0,0,0,0,0,0,0,1,0.0484,0,0,0.0676,0,0,0.0625,0,0,0,0,0.0169,0,0,1,0,0.09,0,1,0,0.117335714,0.079714286,0.154957143,31,96.88,28,87.5,7,87.5,6,75,8,100,7,87.5,13,81.25,15,93.75,96.38,94,100,98.38,93.12,97,95.75,9.38,8.88,6.5,25,-1.62,5.62,15.75,2,2,0,1,1,0,2,0,1,1,0,0,3,1,2,2,1,2,2,1,0,2,0,0,2,0,1,0,0,0,0,0,1,1,3,1,1,1,0,1,4,0.8,0.8,1.6,1.2,0.8,0.2,1.2,1.4,1.1,0.9,4.67,0.33,3,6,4,5,4.34,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),44,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,1,-1,0,1,0,1,1,0,0,2,0,-1,1,0,1,2,0,-4,0,0.6,0.4,-0.2,0.2 +384,R_37dqDNnecMDxKoa,25 - 31,Canadian,Male,2,3,1,-2,3,-1,-1,1,0,2,1,2,2,1,2,-3,2,0,-1,-1,2,2,2,0,3,4,-2,-2,1,1,2,5,2,1,1,1,3,7,0,2,1,1,0,4,2,3,1,0,2,2,1,-1,2,-2,2,6,1,2,2,2,2,3,2,2,2,2,0,8,FALSE,1,98,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,65,FALSE,1,98,TRUE,1,98,TRUE,1,98,TRUE,1,75,FALSE,0,75,FALSE,1,75,TRUE,0,99,TRUE,1,95,FALSE,1,95,FALSE,0,77,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,98,TRUE,0,55,TRUE,1,100,TRUE,0,50,FALSE,1,99,TRUE,0,76,FALSE,0,80,FALSE,0,60,TRUE,1,92,0.0004,0,0,0.0004,0.0064,0.0004,0.0004,0.5625,0.25,0,0.64,0.0025,0.0625,0.0625,0.1225,0.25,0,0.25,0.0001,0.3025,0.0009,0.5929,0.25,0.0025,0.25,0.25,0.36,0.0004,0.36,1,0.5776,0.9801,0.254882143,0.157835714,0.351928571,24,75,20,62.5,4,50,6,75,5,62.5,5,62.5,12,75,8,50,80.16,60.88,84.12,90.12,85.5,85,75.31,12.5,17.66,10.88,9.12,27.62,23,10,25.31,0,1,1,2,0,1,1,0,1,0,1,1,1,0,1,3,0,1,2,1,0,0,0,2,1,2,0,1,2,0,0,0,0,1,0,5,0,2,3,1,0.8,0.6,0.8,1.4,0.6,1,0.2,2.2,0.9,1,5.33,3.67,2,-1,4,-4,1.66,5 cents,5 minutes,47 days,Male,High School (or equivalent),26,0.5,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,1,1,0,-1,-1,1,-1,-1,0,1,1,1,-1,1,-2,0,-1,-1,0,0.2,-0.4,0.6,-0.8,-0.1 +385,R_7B3ymhEs2PX8Sys,46 - 52,American,Male,-1,3,1,1,1,-1,-2,1,0,2,3,-2,3,-2,3,1,1,2,2,3,0,3,0,0,-1,4,-2,2,2,1,0,6,3,2,3,-2,3,3,3,3,3,3,3,3,0,2,0,1,1,1,-2,-1,2,0,0,3,3,-2,3,-2,3,0,2,1,2,1,3,0,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,65,TRUE,1,90,TRUE,1,75,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,75,FALSE,0,75,TRUE,0,92,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,86,TRUE,0,76,FALSE,1,100,TRUE,1,100,TRUE,1,91,TRUE,0,50,TRUE,1,64,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,75,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,1,93,0.0625,0.25,0,0.01,0.0049,0.1225,0.1296,0.0625,0,0.0081,0.0625,0.5625,0.25,0.25,0.25,0,0.25,0.25,0.0625,0.25,0,0.25,0.5776,0.8464,0.25,0.25,0.0625,1,0.25,0.7396,0.25,0.5625,0.269775,0.157328571,0.382221429,18,56.25,21,65.63,5,62.5,5,62.5,4,50,7,87.5,14,87.5,7,43.75,71.31,62.62,66.62,79.25,76.75,75.81,66.81,-9.38,5.68,0.12,4.12,29.25,-10.75,-11.69,23.06,1,0,1,1,2,1,4,1,1,2,0,4,0,0,0,2,2,1,1,0,1,1,1,0,0,1,1,1,0,2,0,0,0,0,0,1,0,0,1,0,1,1.8,0.8,1.2,0.6,1,0,0.4,1.2,0.5,4.33,1.33,3,3,3,3,3,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,47,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,-1,0,1,2,0,3,0,1,0,0,4,0,0,0,1,2,1,0,0,0.4,0.8,0.8,0.8,0.7 +386,R_6TBfmZR2s5RGLyV,32 - 38,Canadian,Female,3,1,3,3,2,2,2,3,1,2,2,1,3,2,2,2,2,2,3,3,2,1,3,2,2,8,1,2,2,2,3,8,3,2,1,2,3,7,3,1,2,2,2,8,3,2,2,1,2,8,3,3,3,2,2,8,1,2,1,2,2,8,3,2,1,1,2,7,TRUE,0,85,TRUE,1,78,TRUE,0,74,TRUE,0,74,TRUE,1,62,TRUE,0,68,TRUE,1,77,TRUE,1,70,TRUE,1,81,TRUE,1,73,TRUE,0,74,TRUE,0,71,TRUE,1,68,TRUE,0,76,TRUE,1,83,TRUE,1,72,TRUE,0,67,TRUE,0,67,TRUE,0,70,TRUE,0,79,TRUE,1,69,FALSE,0,83,FALSE,1,77,TRUE,1,80,TRUE,0,74,TRUE,1,79,TRUE,0,66,TRUE,0,86,TRUE,0,69,TRUE,1,91,TRUE,1,79,TRUE,1,70,0.09,0.0441,0.0784,0.0529,0.09,0.4624,0.04,0.0729,0.6241,0.6889,0.0081,0.1024,0.0361,0.5476,0.1444,0.0484,0.0529,0.5476,0.7396,0.5476,0.0961,0.0289,0.49,0.5776,0.4489,0.4356,0.0441,0.7225,0.5476,0.4489,0.4761,0.5041,0.341907143,0.247557143,0.436257143,27,84.38,16,50,4,50,5,62.5,3,37.5,4,50,15,93.75,1,6.25,74.75,75.62,68.75,76.75,77.88,75.94,73.56,34.38,24.75,25.62,6.25,39.25,27.88,-17.81,67.31,1,0,0,1,0,1,0,1,1,1,1,1,2,0,1,1,1,0,1,1,0,1,1,2,0,1,1,0,1,0,1,1,2,0,0,1,0,1,2,1,0.4,0.8,1,0.8,0.8,0.6,0.8,1,0.75,0.8,7.67,8,0,0,-1,1,-0.33,10 cents,75 minutes,24 days,Female,College Diploma/Certificate,34,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,-1,-1,-1,0,0,-1,1,0,1,0,0,0,0,1,0,1,-1,-1,0,-0.4,0.2,0.2,-0.2,-0.05 +387,R_13pgamghMYPOZF4,67 - 73,American,Male,2,2,0,2,0,-1,-1,0,-1,1,-1,0,1,0,2,0,0,1,-1,1,2,2,0,2,0,6,-1,-1,1,-2,0,2,0,0,0,0,1,4,0,0,2,1,1,1,2,2,-1,2,-2,3,-2,-1,1,-1,0,5,0,1,1,0,1,5,0,0,2,1,1,5,TRUE,0,90,TRUE,1,92,TRUE,0,100,FALSE,1,59,TRUE,1,58,FALSE,1,95,TRUE,1,78,TRUE,1,95,TRUE,1,89,TRUE,1,82,FALSE,1,92,TRUE,0,96,FALSE,0,96,FALSE,1,94,FALSE,0,50,TRUE,1,94,FALSE,1,89,TRUE,0,98,FALSE,1,98,FALSE,1,98,TRUE,1,100,FALSE,0,90,TRUE,0,71,TRUE,1,69,FALSE,1,93,TRUE,1,100,TRUE,0,50,FALSE,1,88,TRUE,0,92,FALSE,0,97,FALSE,0,84,TRUE,1,90,0.0025,0,0.0036,0.0484,0.01,0.0025,0.0961,0.0324,0.0004,0.81,0.9409,0.9216,0.0121,0.0064,0.1764,0.0064,0.5041,0.1681,0.0144,0.0049,0,0.25,0.0004,0.0036,0.0121,0.25,0.7056,0.81,1,0.9604,0.8464,0.9216,0.3381,0.263385714,0.412814286,17,53.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,11,68.75,9,56.25,86.47,76.75,86.38,90.62,92.12,85.25,87.69,-9.37,23.97,14.25,23.88,28.12,29.62,16.5,31.44,0,0,0,0,0,0,0,1,1,1,1,0,1,0,1,0,0,1,2,0,0,0,1,0,2,1,0,1,0,1,1,1,0,0,1,0,0,1,2,0,0,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.45,0.6,4,4.33,3,-3,-1,-4,-0.33,5 cents,5 minutes,47 days,Male,Trade School (non-military),71,0.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,-2,-1,0,0,1,0,0,-1,1,0,0,0,0,0,0,0,-0.6,0,0,0,-0.15 +388,R_5VvG2RgUCE91pSh,32 - 38,American,Male,2,2,3,3,-1,2,0,1,-2,2,0,2,2,1,-1,1,2,2,3,1,2,1,1,2,2,6,2,2,1,1,2,2,3,1,2,2,1,8,3,2,0,1,2,3,2,2,2,3,-3,3,1,0,0,1,2,1,1,-1,0,2,1,2,2,2,2,2,1,3,TRUE,0,100,FALSE,0,76,FALSE,1,100,FALSE,1,100,FALSE,0,79,TRUE,0,85,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,83,TRUE,0,100,TRUE,1,85,FALSE,1,79,FALSE,0,84,FALSE,0,88,FALSE,1,78,TRUE,0,100,FALSE,1,80,TRUE,0,100,FALSE,0,79,FALSE,0,92,FALSE,1,67,TRUE,1,85,TRUE,0,78,TRUE,1,82,FALSE,1,91,TRUE,0,86,FALSE,1,78,TRUE,1,93,FALSE,0,81,FALSE,0,100,0,0.0324,0.7744,0,1,0.7225,0.0225,0,1,0.8464,0.0049,0.0225,0.0625,0.0289,0.6241,0.5776,0.1089,0,0.7396,0.6084,0.6241,0.7056,0.04,0.0441,0.0484,0.0081,0.6561,1,0,1,0.0484,1,0.412271429,0.358628571,0.465914286,24,75,17,53.13,5,62.5,4,50,4,50,4,50,8,50,9,56.25,87.62,83.75,81.38,91.38,94,87.44,87.81,21.87,34.49,21.25,31.38,41.38,44,37.44,31.56,0,1,2,1,3,0,2,0,3,0,3,1,0,1,2,2,0,2,2,1,0,0,1,0,2,1,0,1,3,0,1,3,2,1,2,1,0,0,1,0,1.4,1,1.4,1.4,0.6,1,1.8,0.4,1.3,0.95,5.33,2,3,1,6,0,3.33,10 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),36,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,1,1,1,1,-1,2,-1,0,0,2,-2,-2,0,0,1,0,2,1,1,0.8,0,-0.4,1,0.35 +389,R_6SITLWWJmtAriTQ,67 - 73,American,Female,2,2,2,-1,2,-2,-2,3,-2,1,2,2,2,-1,3,2,2,2,2,2,2,2,2,-2,2,0,-2,-1,2,-1,2,0,2,2,2,-1,2,0,2,2,2,2,2,0,2,2,2,-1,2,0,-2,-2,2,-2,2,0,2,2,2,-1,2,0,2,2,2,2,2,0,TRUE,0,98,TRUE,1,100,FALSE,1,100,FALSE,1,77,TRUE,1,76,FALSE,1,73,TRUE,1,100,FALSE,0,70,FALSE,0,78,TRUE,1,100,FALSE,1,73,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,82,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,84,FALSE,1,100,FALSE,0,100,FALSE,0,82,FALSE,1,92,TRUE,1,83,TRUE,0,100,TRUE,1,81,TRUE,0,81,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,52,TRUE,1,100,0.49,0.0361,0,0,0,0.0729,0.0289,0,0,0.6724,0,0,0.6084,0.0729,0.0576,0,0.0064,0.0529,1,1,1,0.6724,0.7056,1,0,0.6561,0.2704,0.9604,0,1,0,1,0.387046429,0.112314286,0.661778571,13,40.63,18,56.25,3,37.5,7,87.5,3,37.5,5,62.5,10,62.5,8,50,90.06,78.38,92.62,95.12,94.12,87.75,92.38,-15.62,33.81,40.88,5.12,57.62,31.62,25.25,42.38,0,0,0,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0.2,0.8,0.2,0,0,0.4,0.2,0,0.3,0.15,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0,0.15 +390,R_1L13XK3l1GnM7R3,60 - 66,Canadian,Female,0,0,0,-1,0,0,0,1,0,1,0,3,3,0,3,0,0,1,0,-1,1,0,1,1,1,6,0,0,0,0,0,5,0,3,3,0,3,5,0,1,0,0,-1,6,0,0,0,-2,-1,5,0,0,0,-1,0,4,0,3,3,0,3,5,0,-1,0,-1,-2,5,TRUE,0,67,FALSE,0,71,TRUE,0,95,FALSE,1,77,FALSE,0,67,FALSE,1,90,FALSE,0,55,TRUE,1,85,FALSE,0,66,TRUE,1,81,TRUE,0,69,TRUE,0,97,TRUE,1,67,FALSE,1,63,TRUE,1,77,TRUE,1,96,TRUE,0,91,TRUE,0,100,TRUE,0,75,TRUE,0,90,FALSE,0,100,TRUE,1,62,FALSE,1,56,TRUE,1,92,TRUE,0,86,TRUE,1,100,TRUE,0,63,TRUE,0,100,TRUE,0,86,TRUE,1,98,FALSE,0,51,TRUE,1,100,0.0225,0,0.0016,0.3025,0,0.01,0.0064,0.0361,0.81,0.1444,0.0004,0.1089,0.4356,0.4761,0.4489,0.5041,0.1936,0.0529,1,0.7396,1,0.0529,0.5625,0.1369,0.8281,0.3969,0.2601,0.4489,0.9025,1,0.7396,0.9409,0.437010714,0.230528571,0.643492857,18,56.25,14,43.75,2,25,4,50,4,50,4,50,10,62.5,4,25,80.41,68.62,82.12,76.75,94.12,79.25,81.56,12.5,36.66,43.62,32.12,26.75,44.12,16.75,56.56,1,0,1,2,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0.4,0,0.4,0.4,0.6,0,0.8,0.45,0.45,5.33,4.67,1,1,0,1,0.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),61,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,0,1,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,-1,0.6,-0.2,0,-0.4,0 +391,R_1JquTUde1fPhKN1,53 - 59,American,Female,2,3,3,2,2,-1,-1,-2,-3,1,-1,-3,3,-3,3,0,-1,1,0,1,3,3,3,3,3,1,-1,-1,-1,-3,0,4,0,-3,3,-3,3,3,0,1,0,0,0,5,3,3,3,3,3,7,-2,-1,-1,-3,2,5,-1,-3,3,-3,3,2,0,0,0,0,0,7,TRUE,0,80,TRUE,1,98,FALSE,1,100,TRUE,0,55,TRUE,1,98,FALSE,1,98,FALSE,0,83,TRUE,1,100,TRUE,1,84,TRUE,1,96,FALSE,1,100,TRUE,0,86,TRUE,1,87,FALSE,1,93,TRUE,1,74,TRUE,1,90,TRUE,0,87,TRUE,0,92,FALSE,1,78,FALSE,1,100,FALSE,0,92,TRUE,1,97,FALSE,1,100,TRUE,1,89,FALSE,1,100,TRUE,1,69,TRUE,0,77,FALSE,1,85,TRUE,0,95,TRUE,1,75,TRUE,1,99,TRUE,1,99,0,0.0961,0.01,0.6889,0.0001,0.0004,0.0121,0.0016,0,0.0009,0.0625,0.0169,0.0256,0,0.0004,0.0004,0,0.3025,0.0225,0,0.8464,0.0676,0.0484,0.0049,0.7569,0.5929,0.0001,0.64,0,0.8464,0.9025,0.7396,0.210414286,0.030242857,0.390585714,23,71.88,23,71.88,6,75,5,62.5,5,62.5,7,87.5,14,87.5,9,56.25,89.25,83.12,94.5,88.75,90.62,89.38,89.12,0,17.37,8.12,32,26.25,3.12,1.88,32.87,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,1,1,0,1,0.6,0.4,0.2,0.8,0.6,0.6,0,0.6,0.5,0.45,2.67,4.67,-6,-1,1,-2,-2,10 cents,100 minutes,15 days,Female,University - Graduate (Masters),53,1,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,-0.2,0.2,0.2,0.05 +392,R_5HoRkWGs8yCWtI1,53 - 59,American,Male,-2,3,3,2,3,1,0,3,-1,1,-2,3,3,3,2,0,0,2,0,2,-3,3,3,2,-2,10,-3,1,2,-3,-3,8,1,1,0,1,0,2,1,-1,0,0,1,5,-3,3,3,3,3,2,2,-1,2,0,0,10,0,2,2,2,2,4,3,3,3,3,3,9,TRUE,0,100,FALSE,0,71,FALSE,1,99,TRUE,0,69,FALSE,0,100,FALSE,1,99,FALSE,0,100,FALSE,0,82,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,98,FALSE,0,72,FALSE,1,100,FALSE,0,100,TRUE,1,91,FALSE,1,100,TRUE,0,100,TRUE,0,73,FALSE,1,100,FALSE,0,100,FALSE,0,66,FALSE,1,77,FALSE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,FALSE,1,86,FALSE,0,99,FALSE,0,100,TRUE,1,100,0.6724,0,0.0081,1,0,0.0001,0.4096,0,0,0.4356,0.9801,0.5184,0.0196,0,1,0.5041,0.0529,0.4761,1,1,1,1,0.5329,0,0,0.7569,1,1,0.0001,1,0.0196,0.9604,0.488085714,0.314035714,0.662135714,21,65.63,13,40.63,2,25,5,62.5,3,37.5,3,37.5,5,31.25,8,50,91.22,85.75,91.75,95.75,91.62,89.44,93,25,50.59,60.75,29.25,58.25,54.12,58.19,43,1,0,0,0,5,4,1,1,2,4,3,2,3,2,2,1,1,2,0,1,1,0,0,1,0,1,1,1,1,1,2,1,1,1,0,3,3,1,3,1,1.2,2.4,2.4,1,0.4,1,1,2.2,1.75,1.15,6.67,5.33,8,-2,-2,-4,1.34,10 cents,75 minutes,47 days,Male,High School (or equivalent),56,-0.625,0,0,1,1,0,0,0.33,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,-1,5,3,0,0,1,3,1,1,2,1,2,-2,-2,1,-3,0,0.8,1.4,1.4,-1.2,0.6 +393,R_5rNELR6ehTmOSux,39 - 45,American,Female,0,2,3,2,3,-2,2,0,2,2,-2,-3,2,0,2,-3,-3,-3,0,-3,2,2,2,2,3,5,-2,1,2,1,2,6,0,-3,3,0,0,5,-1,-1,0,1,-2,7,2,2,2,2,2,6,0,0,1,-1,1,6,0,-3,3,1,2,5,1,0,1,1,0,8,TRUE,0,90,TRUE,1,73,FALSE,1,100,FALSE,1,50,TRUE,1,99,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,91,TRUE,1,99,FALSE,1,50,TRUE,0,93,TRUE,1,97,TRUE,0,83,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,94,TRUE,0,82,FALSE,1,62,TRUE,1,76,TRUE,1,100,FALSE,1,100,FALSE,0,68,FALSE,1,100,TRUE,1,80,TRUE,0,59,FALSE,1,60,TRUE,0,72,TRUE,1,77,FALSE,0,58,TRUE,1,93,0,0.04,0,0.0016,0.0049,0,0.4624,0.0001,0.1444,0,0.0529,0.0009,0.0081,0.25,0.0001,0.0729,0,0.25,0.16,0,0.0576,0.25,0.6724,0.6889,0.25,0.3481,0.3364,0.81,0,0.8836,0.5184,0.8649,0.253107143,0.08905,0.417164286,23,71.88,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,81.31,64.12,85.88,92.75,82.5,84.81,77.81,0,9.43,1.62,-1.62,30.25,7.5,-2.69,21.56,2,0,1,0,0,0,1,2,1,0,2,0,1,0,2,2,2,3,1,1,2,0,1,0,1,2,2,1,3,1,2,0,1,1,0,4,3,4,1,3,0.6,0.8,1,1.8,0.8,1.8,0.8,3,1.05,1.6,5.33,5.67,-1,0,0,-1,-0.34,10 cents,5 minutes,47 days,Female,University - Undergraduate,39,0.75,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,-1,-2,-1,1,-2,-1,0,0,0,-1,2,-2,-1,-1,0,-2,-0.2,-1,0.2,-1.2,-0.55 +394,R_3stWU9kNbJvpNuW,39 - 45,American,Female,2,3,2,1,3,0,1,3,1,1,1,-1,2,-1,3,0,1,1,1,0,2,3,2,1,3,7,2,0,3,0,1,5,2,-1,3,-1,3,5,0,1,1,0,0,5,2,3,2,2,3,5,0,1,3,1,0,5,2,0,1,-3,3,5,0,1,0,1,-1,6,TRUE,0,100,TRUE,1,100,TRUE,0,96,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,TRUE,1,95,FALSE,1,50,TRUE,0,86,TRUE,1,67,FALSE,1,100,TRUE,1,98,TRUE,1,96,TRUE,0,81,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,77,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,87,TRUE,0,100,TRUE,1,98,FALSE,0,50,TRUE,1,100,0,0,0.0016,0,0,0,0.0529,0.0025,0.25,0,0.0004,0.1089,0.5776,0.25,0,0,0,0.25,0.7569,1,0.49,0.0004,0.25,0,0.6561,1,0.25,1,0.9216,1,1,0.7396,0.377032143,0.106592857,0.647471429,16,50,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,13,81.25,7,43.75,86.78,71.75,89.75,99.38,86.25,89.19,84.38,-12.5,24.28,9.25,27.25,36.88,23.75,7.94,40.63,0,0,0,0,0,2,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,2,0,0,0,1,0,1,0,0.8,0.4,0.2,0.2,0.2,1,0.4,0.35,0.45,5.67,5,2,0,0,-1,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,44,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,2,1,0,1,-1,0,-1,0,-2,0,0,0,-1,1,-1,-0.2,0.6,-0.6,-0.2,-0.1 +395,R_6ogKWHZARE6wFR9,53 - 59,American,Male,2,1,3,1,-1,-2,-2,2,1,-1,1,1,2,1,2,-1,-2,1,1,-1,2,1,2,1,-2,4,-2,-2,2,2,-1,8,2,2,2,1,2,3,-2,-1,-2,-2,-2,2,2,1,2,2,-1,2,-2,-2,2,1,1,2,1,-1,3,-1,2,2,-1,-1,1,-1,-2,7,TRUE,0,81,TRUE,1,92,TRUE,0,81,FALSE,1,65,TRUE,1,79,FALSE,1,82,TRUE,1,81,TRUE,1,79,TRUE,1,97,TRUE,1,92,FALSE,1,82,FALSE,1,93,FALSE,0,55,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,90,FALSE,1,87,TRUE,0,76,FALSE,1,100,TRUE,1,70,TRUE,1,85,FALSE,1,100,TRUE,1,92,FALSE,1,97,TRUE,1,96,TRUE,0,56,FALSE,1,99,TRUE,0,97,TRUE,1,100,FALSE,0,93,TRUE,1,100,0.0441,0.0016,0,0.0361,0,0.0324,0.0064,0.0064,0,0.0225,0,0.3025,0.0009,0.0324,0.0441,0.0064,0,0.1225,0.0001,0.0009,0.09,0.25,0.5776,0.36,0.01,0.3136,0.8649,0.6561,0.6561,0.0169,0.9409,0.0049,0.189946429,0.041178571,0.338714286,26,81.25,23,71.88,4,50,6,75,6,75,7,87.5,13,81.25,10,62.5,84.59,76.38,84.12,84.88,93,85.06,84.12,9.37,12.71,26.38,9.12,9.88,5.5,3.81,21.62,0,0,1,0,1,0,0,0,1,0,1,1,0,0,0,1,1,3,3,1,0,0,1,1,0,0,0,0,0,2,0,2,1,2,0,0,1,0,2,1,0.4,0.2,0.4,1.8,0.4,0.4,1,0.8,0.7,0.65,5,2,2,6,1,-5,3,5 cents,5 minutes,47 days,Male,Trade School (non-military),57,1.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,-1,1,0,0,0,1,-2,1,-1,-1,-2,0,1,0,3,1,0,0,-0.2,-0.6,1,0.05 +396,R_3FCIkOBSK5YMuPo,67 - 73,American,Female,3,3,3,1,-1,-3,-3,1,-3,-1,2,3,3,-2,3,-3,-2,-1,-1,-1,3,3,3,1,-1,0,-3,-3,1,-3,-3,1,2,3,3,-1,3,1,-3,-3,-3,-3,-3,1,3,3,3,1,-1,1,-3,-3,1,-3,0,2,2,3,3,-1,3,1,2,2,2,1,2,7,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,97,TRUE,1,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,FALSE,0,59,TRUE,1,100,FALSE,1,67,FALSE,1,78,TRUE,0,96,FALSE,1,100,TRUE,1,83,TRUE,1,95,TRUE,0,78,TRUE,1,100,FALSE,1,100,TRUE,1,79,FALSE,1,58,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0.0441,0,0,0,0.0009,0,0,0,0.0025,1,1,0.36,0,0,0,0.6084,0.16,0,0,0.0289,0.3481,0.9216,1,0.1089,0.1764,0,1,0,0.0484,1,1,0.313003571,0.2237,0.402307143,24,75,22,68.75,5,62.5,5,62.5,6,75,6,75,12,75,10,62.5,90.94,79.12,90.62,94,100,92.25,89.62,6.25,22.19,16.62,28.12,19,25,17.25,27.12,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,1,2,2,2,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,5,4,3,2,3,0,0.4,0.2,1.4,0,0.2,0.2,3.4,0.5,0.95,0.67,1.33,-1,-1,0,-6,-0.66,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,68,0.625,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,-5,-3,-1,0,-1,0,0.2,0,-2,-0.45 +397,R_35HGnysLLLV4m2Z,25 - 31,American,Male,1,1,1,1,1,2,-2,2,-2,2,1,1,2,2,2,0,1,1,1,1,-2,1,1,-1,2,7,2,1,-1,1,2,7,-2,-1,1,2,-1,8,0,1,1,1,1,5,0,1,1,1,1,4,0,0,2,0,0,5,2,2,1,2,2,3,0,0,0,0,1,5,FALSE,1,90,TRUE,1,92,TRUE,0,84,FALSE,1,78,TRUE,1,85,FALSE,1,98,TRUE,1,88,TRUE,1,93,TRUE,1,78,TRUE,1,83,FALSE,1,76,FALSE,1,67,FALSE,0,86,TRUE,0,88,TRUE,1,80,TRUE,1,82,FALSE,1,77,FALSE,1,56,FALSE,1,75,FALSE,1,66,FALSE,0,66,TRUE,1,77,TRUE,0,66,TRUE,1,85,TRUE,0,88,TRUE,1,90,FALSE,1,62,FALSE,1,81,TRUE,0,84,TRUE,1,86,FALSE,0,76,TRUE,1,87,0.0049,0.01,0.0324,0.0144,0.0169,0.0004,0.0225,0.0289,0.1156,0.0529,0.0196,0.7396,0.0484,0.0576,0.0225,0.0064,0.4356,0.0484,0.0361,0.7744,0.4356,0.04,0.0625,0.7744,0.0529,0.1444,0.5776,0.01,0.7056,0.1936,0.7056,0.1089,0.222746429,0.115378571,0.330114286,21,65.63,24,75,7,87.5,4,50,6,75,7,87.5,13,81.25,11,68.75,80.31,77.12,81.12,82.5,80.5,83.38,77.25,-9.37,5.31,-10.38,31.12,7.5,-7,2.13,8.5,3,0,0,2,1,0,3,3,3,0,3,2,1,0,3,0,0,0,0,0,1,0,0,0,0,2,2,0,2,2,1,1,1,0,0,0,1,1,1,0,1.2,1.8,1.8,0,0.2,1.6,0.6,0.6,1.2,0.75,7.33,4,3,2,5,0,3.33,10 cents,5 minutes,15 days,Male,University - Undergraduate,26,0.875,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,0,0,2,1,-2,1,3,1,-2,2,1,0,0,3,0,-1,-1,-1,0,1,0.2,1.2,-0.6,0.45 +398,R_3fkKyOckODVypDZ,53 - 59,American,Male,2,0,1,1,1,-3,1,2,-1,0,-1,0,2,-3,0,0,1,0,0,-1,2,-1,1,1,1,5,-3,2,2,-1,-2,5,0,2,1,2,-1,6,-1,-1,0,-1,0,8,2,2,2,2,2,5,-3,1,2,-2,-2,5,-1,0,2,-3,-2,6,0,0,1,0,0,8,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,83,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,57,TRUE,1,100,TRUE,0,50,TRUE,1,67,TRUE,0,50,TRUE,0,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.1089,0,0.2304,0,0.25,0,0,0,0,0,0,0,0,0.25,0.25,0.3249,0.25,0.3721,0.25,0.25,0.25,1,0,0,0.25,0,0.25,0,1,0,0.6889,0.201282143,0.094635714,0.307928571,13,40.63,22,68.75,5,62.5,6,75,5,62.5,6,75,14,87.5,8,50,80.31,75,75.88,77.38,93,82.44,78.19,-28.12,11.56,12.5,0.88,14.88,18,-5.06,28.19,0,1,0,0,0,0,1,0,0,2,1,2,1,5,1,1,2,0,1,1,0,2,1,1,1,0,0,0,1,2,0,0,0,0,2,0,1,1,0,1,0.2,0.6,2,1,1,0.6,0.4,0.6,0.95,0.65,5.33,5.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,-1,-1,-1,-1,0,1,0,-1,0,1,2,1,5,-1,1,1,-1,1,0,-0.8,0,1.6,0.4,0.3 +399,R_6jizLscD9XqNAo9,39 - 45,Canadian,Female,3,3,2,2,1,2,3,2,0,1,3,1,2,1,2,2,3,1,2,3,3,2,2,1,1,6,0,3,2,1,3,9,1,0,0,1,2,10,2,1,2,2,3,7,2,3,3,2,1,6,3,2,1,2,0,9,3,0,2,2,1,8,2,2,3,1,1,7,TRUE,0,93,FALSE,0,76,TRUE,0,100,TRUE,0,92,FALSE,0,71,FALSE,1,86,FALSE,0,69,TRUE,1,87,TRUE,1,69,FALSE,0,81,FALSE,1,72,TRUE,0,100,FALSE,0,65,FALSE,1,85,FALSE,0,80,FALSE,0,70,FALSE,1,72,TRUE,0,91,FALSE,1,72,TRUE,0,90,FALSE,0,68,FALSE,0,72,FALSE,1,80,FALSE,0,72,FALSE,1,86,TRUE,1,85,FALSE,1,79,TRUE,0,84,FALSE,1,63,TRUE,1,91,TRUE,1,83,TRUE,1,85,0.0169,0.0225,0.49,0.4761,0.0225,0.0196,0.5184,0.6561,0.81,0.5184,0.0081,0.4225,0.0961,0.0784,0.5041,0.5776,0.04,0.8464,0.7056,0.0196,0.4624,0.64,0.0784,0.0225,0.0784,0.0441,0.0289,0.8649,1,0.8281,0.1369,1,0.393857143,0.365585714,0.422128571,19,59.38,15,46.88,5,62.5,5,62.5,3,37.5,2,25,6,37.5,9,56.25,80.28,77.88,73.75,82.75,86.75,76.5,84.06,12.5,33.4,15.38,11.25,45.25,61.75,39,27.81,0,1,0,1,0,2,0,0,1,2,2,1,2,0,0,0,2,1,0,0,1,0,1,0,0,1,1,1,2,1,0,1,0,1,1,0,1,2,1,2,0.4,1,1,0.6,0.4,1.2,0.6,1.2,0.75,0.85,8.33,7.67,0,0,2,0,0.66,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),40,-0.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,-1,1,-1,1,0,1,-1,-1,-1,1,2,0,2,-1,-1,0,1,-1,-1,-2,0,-0.2,0.4,-0.6,-0.1 +400,R_7G0P5PING61jNop,32 - 38,Canadian,Male,2,0,1,-1,-1,-1,0,0,0,0,0,-1,0,-2,1,0,-1,-1,0,-1,2,0,2,-1,-1,3,0,0,0,0,0,5,0,-1,0,-1,2,2,0,0,0,0,0,7,2,0,2,-1,0,2,-1,0,0,0,0,5,0,-1,0,-2,2,2,0,0,0,0,-1,5,FALSE,1,78,FALSE,0,50,TRUE,0,65,FALSE,1,50,FALSE,0,50,FALSE,1,57,FALSE,0,50,TRUE,1,90,TRUE,1,80,TRUE,1,75,FALSE,1,50,TRUE,0,85,FALSE,0,50,FALSE,1,93,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,78,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,73,TRUE,1,77,FALSE,0,50,FALSE,0,50,0.01,0.25,0.25,0.25,0.25,0.1849,0.25,0.0625,0.25,0.25,0.0529,0.25,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.0049,0.25,0.25,0.25,0.0484,0.4225,0.6084,0.5329,0.7225,0.256425,0.202878571,0.309971429,16,50,16,50,5,62.5,3,37.5,4,50,4,50,4,25,12,75,59.41,53.75,53.75,65.5,64.62,57.62,61.19,0,9.41,-8.75,16.25,15.5,14.62,32.62,-13.81,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0.2,0.2,0.4,0.6,0.4,0,0.2,0.4,0.35,0.25,3.33,3,1,0,0,2,0.33,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,37,0.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,-1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,-0.2,0.2,0.2,0.2,0.1 +401,R_1QRtJlPZGiqAiX7,53 - 59,American,Male,1,2,2,2,1,-2,-2,1,-2,2,2,2,2,-3,3,1,1,2,2,1,1,2,2,2,2,1,1,1,-1,1,-1,9,1,1,1,-1,1,3,-2,-2,-2,-2,-2,9,1,2,2,2,2,8,-1,-2,2,-2,2,7,2,2,2,-3,3,1,1,-1,1,1,1,1,TRUE,0,100,TRUE,1,91,TRUE,0,91,FALSE,1,50,FALSE,0,50,FALSE,1,92,TRUE,1,91,TRUE,1,88,TRUE,1,61,TRUE,1,75,FALSE,1,94,FALSE,1,69,TRUE,1,58,TRUE,0,85,TRUE,1,50,TRUE,1,87,FALSE,1,50,TRUE,0,85,TRUE,0,83,FALSE,1,50,TRUE,1,59,TRUE,1,74,TRUE,0,65,TRUE,1,50,FALSE,1,61,TRUE,1,86,TRUE,0,50,FALSE,1,50,TRUE,0,71,TRUE,1,73,TRUE,1,84,TRUE,1,92,0.0144,0.0196,0.0169,0.0081,0.0064,0.0064,0.25,0.0625,0.25,0.0676,0.0729,0.1764,0.1521,0.0036,0.25,0.0081,0.4225,0.25,0.25,0.1521,0.1681,0.25,0.6889,0.7225,0.25,0.25,0.0256,1,0.8281,0.7225,0.5041,0.0961,0.281660714,0.141321429,0.422,25,78.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,15,93.75,8,50,72.34,70.38,67.12,82.12,69.75,73.06,71.62,6.25,0.46,-4.62,4.62,19.62,-17.75,-20.69,21.62,0,0,0,0,1,3,3,2,3,3,1,1,1,2,2,3,3,4,4,3,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,1,1,0,0.2,2.8,1.4,3.4,0.2,0.4,0,0.8,1.95,0.35,4.33,5.33,-7,2,2,8,-1,10 cents,100 minutes,36 days,Male,College Diploma/Certificate,58,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,2,3,1,3,3,1,1,1,2,2,3,1,3,3,3,0,2.4,1.4,2.6,1.6 +402,R_1GeNRkyQ5YVBNQQ,39 - 45,American,Male,2,3,3,1,2,2,-1,3,-1,1,1,2,1,-1,3,3,2,1,1,1,0,-2,-2,-3,-1,5,-1,2,-3,1,-1,6,-1,-2,-1,1,-3,6,0,-3,-2,-1,-1,7,1,3,1,2,2,9,1,-2,-1,-2,1,7,0,-1,-2,-2,-2,6,3,3,1,2,1,6,TRUE,0,63,TRUE,1,80,TRUE,0,68,TRUE,0,71,TRUE,1,77,TRUE,0,74,TRUE,1,69,TRUE,1,92,TRUE,1,79,TRUE,1,82,TRUE,0,82,TRUE,0,100,TRUE,1,65,TRUE,0,79,TRUE,1,74,TRUE,1,65,TRUE,0,100,FALSE,1,100,TRUE,0,66,TRUE,0,78,FALSE,0,74,TRUE,1,68,TRUE,0,66,TRUE,1,71,TRUE,0,61,TRUE,1,100,TRUE,0,77,TRUE,0,62,FALSE,1,71,TRUE,1,100,TRUE,1,64,TRUE,1,86,0.0064,0,0.1225,0.0961,0.0196,0.5476,0.0841,0.0324,0.6084,0.1024,0,0.1225,0.0441,0.6724,0.0529,0.04,0.4356,0.5041,0.3844,0.3721,0.5476,0.0676,0.4356,0.6241,1,0.5929,0.1296,0.3969,0.4624,0,0.0841,1,0.334407143,0.233292857,0.435521429,25,78.13,17,53.13,4,50,4,50,5,62.5,4,50,15,93.75,2,12.5,77,74.12,76.62,77.75,79.5,77.88,76.12,25,23.87,24.12,26.62,15.25,29.5,-15.87,63.62,2,5,5,4,3,3,3,6,2,2,2,4,2,2,6,3,5,3,2,2,1,0,2,1,0,1,1,4,1,0,1,3,3,1,5,0,1,0,1,0,3.8,3.2,3.2,3,0.8,1.4,2.6,0.4,3.3,1.3,5.67,7.33,-4,-1,0,1,-1.66,5 cents,100 minutes,24 days,Male,University - Undergraduate,43,0.375,1,0,0,0,1,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,1,5,3,3,3,2,2,2,1,2,1,1,-1,1,1,3,4,3,1,2,3,1.8,0.6,2.6,2 +403,R_5gP0vwAfPWywdOx,53 - 59,Canadian,Female,2,2,2,2,2,-2,-3,2,-2,-1,1,2,1,0,0,1,1,2,2,-2,2,2,2,2,2,0,-2,-2,2,-2,-1,0,1,2,1,0,0,0,1,1,2,2,-2,0,2,2,2,2,2,0,-2,-2,2,-2,-1,0,1,1,1,0,0,0,1,0,1,2,-1,1,FALSE,1,87,FALSE,0,50,FALSE,1,80,FALSE,1,50,TRUE,1,85,FALSE,1,94,TRUE,1,74,TRUE,1,92,FALSE,0,54,FALSE,0,50,TRUE,0,80,TRUE,0,55,TRUE,1,65,FALSE,1,92,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,53,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,FALSE,1,100,TRUE,1,71,FALSE,1,91,FALSE,1,86,TRUE,0,59,TRUE,1,100,FALSE,0,50,TRUE,1,80,0.0064,0.0841,0,0.0676,0.04,0.0036,0.16,0.25,0,0,0,0.1225,0.2916,0.64,0.0225,0.25,0,0.25,0.0196,0,1,0.25,0.2809,0.0064,0.25,0.0081,0.25,0.0169,0.04,0.25,0.3481,0.3025,0.180453571,0.145014286,0.215892857,22,68.75,22,68.75,2,25,6,75,7,87.5,7,87.5,10,62.5,12,75,75.25,59.75,79.12,78,84.12,73.81,76.69,0,6.5,34.75,4.12,-9.5,-3.38,11.31,1.69,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0.2,0,0,0,0.2,0.2,0.6,0.05,0.25,0,0,0,0,0,-1,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),59,0.875,1,1,0,0,0,1,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,-1,0,-1,0,0,-0.2,-0.6,-0.2 +404,R_32KQgZLqx87Bq3m,67 - 73,Canadian,Male,-2,1,3,0,1,1,1,3,1,1,0,3,3,3,1,2,2,2,2,1,-3,1,3,0,2,1,1,1,3,1,1,2,0,3,3,3,1,2,2,2,2,2,2,4,-3,1,3,1,0,2,1,1,3,1,1,2,0,3,3,2,1,2,1,1,2,2,2,5,FALSE,1,100,TRUE,1,100,TRUE,0,95,TRUE,0,50,TRUE,1,90,TRUE,0,75,TRUE,1,90,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,90,TRUE,1,50,FALSE,1,70,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,95,TRUE,1,100,TRUE,0,75,FALSE,1,60,TRUE,0,70,TRUE,1,90,TRUE,1,50,TRUE,1,100,0.01,0,0,0.01,0,0.5625,0.0625,0,0,0,0.01,0.25,0,0.36,0.01,0,0,0.25,0.16,0.0025,0.25,0.0625,0,0.09,0,0.5625,0.25,0,0.9025,0,0.49,0.81,0.181607143,0.1075,0.255714286,26,81.25,24,75,5,62.5,5,62.5,8,100,6,75,15,93.75,9,56.25,84.38,76.25,79.38,94.38,87.5,85,83.75,6.25,9.38,13.75,16.88,-5.62,12.5,-8.75,27.5,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0.4,0,0,0.2,0.6,0,0.2,0.6,0.15,0.35,1.67,2,-1,0,0,-1,-0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,68,0.625,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,0,-1,-1,0,0,0,-0.2,0,-0.2,-0.4,-0.2 +405,R_37ouadzHvN5P8U9,46 - 52,American,Female,-3,-2,0,-2,3,-3,-2,2,0,0,1,1,3,-3,2,2,2,2,3,3,-3,0,1,-3,3,5,-3,-3,2,0,-3,1,1,1,3,-3,2,6,0,0,0,0,0,6,-3,-2,0,-3,2,5,-3,0,0,0,-3,1,1,2,3,-3,0,5,0,0,0,0,0,5,TRUE,0,100,FALSE,0,50,FALSE,1,90,TRUE,0,90,TRUE,1,90,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,TRUE,0,100,FALSE,0,50,TRUE,1,80,TRUE,0,90,FALSE,1,100,FALSE,1,80,FALSE,1,100,FALSE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,80,TRUE,0,80,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.04,1,0,0,0.04,0,0,0.01,0,0.01,0,0.25,0.01,0.25,0,0.81,0,0.64,1,0.25,0.04,1,0.81,0.25,0,1,0.01,0,0.25,1,0.2725,0.098571429,0.446428571,22,68.75,21,65.63,5,62.5,5,62.5,4,50,7,87.5,12,75,9,56.25,87.81,71.25,90,96.25,93.75,89.38,86.25,3.12,22.18,8.75,27.5,46.25,6.25,14.38,30,0,2,1,1,0,0,1,0,0,3,0,0,0,0,0,2,2,2,3,3,0,0,0,1,1,0,2,2,0,3,0,1,0,0,2,2,2,2,3,3,0.8,0.8,0,2.4,0.4,1.4,0.6,2.4,1,1.2,4,3.67,0,0,1,1,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),50,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,2,1,0,-1,0,-1,-2,0,0,0,-1,0,0,-2,0,0,0,0,0,0.4,-0.6,-0.6,0,-0.2 +406,R_3e2Cal4Kzt5T3Tl,25 - 31,Canadian,Female,2,3,3,2,2,2,2,2,3,3,2,3,2,2,2,2,3,2,2,3,3,3,3,3,2,5,-1,2,2,3,0,3,3,2,3,2,3,3,2,0,1,2,1,8,2,3,2,2,3,6,0,-1,3,-1,2,3,3,3,2,3,3,2,3,2,3,3,3,7,FALSE,1,100,FALSE,0,57,FALSE,1,89,FALSE,1,58,TRUE,1,100,FALSE,1,83,TRUE,1,64,TRUE,1,68,TRUE,1,80,TRUE,1,78,TRUE,0,62,TRUE,0,77,TRUE,1,100,TRUE,0,85,TRUE,1,50,TRUE,1,100,TRUE,0,52,TRUE,0,100,FALSE,1,63,FALSE,1,77,TRUE,1,89,FALSE,0,100,TRUE,0,56,TRUE,1,100,TRUE,0,62,TRUE,1,55,FALSE,1,75,TRUE,0,55,TRUE,0,86,TRUE,1,100,TRUE,1,55,TRUE,1,73,0.1024,0.2025,0,0.1296,0.0729,0.0289,0,0.0484,0.0529,1,0,0,0.04,0.3844,0,0.3249,0.3136,0.1764,0.3025,0.3844,0.0121,0.25,0.1369,0.7225,0.2704,0.0625,0.2025,0,0.0121,1,0.7396,0.5929,0.254671429,0.174457143,0.334885714,25,78.13,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,76.53,62.5,79.88,80.5,83.25,79.31,73.75,12.5,10.9,-12.5,17.38,30.5,8.25,-8.19,30,1,0,0,1,0,3,0,0,0,3,1,1,1,0,1,0,3,1,0,2,0,0,1,0,1,2,3,1,4,1,1,0,0,1,1,1,1,1,1,0,0.4,1.2,0.8,1.2,0.4,2.2,0.6,0.8,0.9,1,3.67,3.67,-1,0,1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,28,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,0,-1,1,-1,1,-3,-1,-4,2,0,1,1,-1,0,-1,2,0,-1,2,0,-1,0.2,0.4,-0.1 +407,R_514Twbm6xuNkAVv,46 - 52,American,Female,3,3,1,-2,1,-3,0,3,-1,3,2,-2,3,0,3,-1,0,1,-1,-2,3,3,3,-3,2,1,-3,-2,2,0,2,3,2,-3,3,1,3,1,-1,0,-2,-1,-2,1,3,3,2,-2,2,3,-3,-1,2,-1,2,3,2,-2,3,0,3,1,-2,-2,-2,-2,-2,2,FALSE,1,74,FALSE,0,53,TRUE,0,91,FALSE,1,62,TRUE,1,94,FALSE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,52,TRUE,1,97,FALSE,1,92,TRUE,0,97,TRUE,1,92,FALSE,1,96,TRUE,1,53,TRUE,1,79,TRUE,0,83,TRUE,0,83,TRUE,0,54,FALSE,1,53,FALSE,0,52,TRUE,1,99,TRUE,0,65,TRUE,1,95,FALSE,1,98,TRUE,1,60,FALSE,1,52,TRUE,0,86,TRUE,0,94,TRUE,1,53,FALSE,0,55,TRUE,1,99,0.0016,0.16,0.0441,0,0.0001,0,0.0025,0.0009,0.2209,0.0001,0.2209,0.0064,0.2304,0.0064,0.0036,0.2809,0.4225,0.1444,0.7396,0.0004,0.2704,0.2209,0.2916,0.0016,0.6889,0.2304,0.3025,0.0676,0.8281,0.6889,0.8836,0.9409,0.274835714,0.11,0.439671429,18,56.25,21,65.63,5,62.5,4,50,7,87.5,5,62.5,13,81.25,8,50,78.41,59.12,84.88,88.38,81.25,76.81,80,-9.38,12.78,-3.38,34.88,0.88,18.75,-4.44,30,0,0,2,1,1,0,2,1,1,1,0,1,0,1,0,0,0,3,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,0,1,2,3,1,0,0.8,1,0.4,0.6,0.4,0.6,0,1.4,0.7,0.6,1.67,2.33,-2,0,0,-1,-0.66,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),48,0.5,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,1,1,0,0,1,0,1,0,0,1,0,1,0,-1,-2,0,-1,0,0.4,0.4,0.4,-0.8,0.1 +408,R_6bHNp7BbzF4X5fT,46 - 52,Canadian,Female,2,2,2,-2,2,-2,-2,2,-2,0,2,0,2,-2,2,-2,0,-2,0,-2,2,2,2,-2,2,2,-2,-2,2,-2,-1,3,2,1,2,-2,2,3,-2,0,0,-2,-2,4,2,2,2,-2,2,3,-2,-2,2,-2,-2,2,2,2,2,-2,2,2,-2,0,-2,-2,-2,4,TRUE,0,96,TRUE,1,91,FALSE,1,100,TRUE,0,61,TRUE,1,52,FALSE,1,92,TRUE,1,99,TRUE,1,100,FALSE,0,86,TRUE,1,64,TRUE,0,65,TRUE,0,85,TRUE,1,73,TRUE,0,64,TRUE,1,59,TRUE,1,83,TRUE,0,75,TRUE,0,100,TRUE,0,60,FALSE,1,69,FALSE,0,100,FALSE,0,71,FALSE,1,100,TRUE,1,79,TRUE,0,78,TRUE,1,96,FALSE,1,76,FALSE,1,100,TRUE,0,72,FALSE,0,91,TRUE,1,80,TRUE,1,100,0,0.0016,0.0289,0.0001,0,0.0064,0.0441,0.1296,0.0961,0.5041,0.8281,0.0729,0.7396,0.4225,0.2304,0.0081,0,0.3721,0,0.6084,1,0.1681,0.36,0.4096,0.5625,0.0576,0.04,0.9216,0,1,0.5184,0.7225,0.350810714,0.246714286,0.454907143,20,62.5,18,56.25,4,50,5,62.5,3,37.5,6,75,12,75,6,37.5,81.78,72.25,83,83.5,88.38,82.75,80.81,6.25,25.53,22.25,20.5,46,13.38,7.75,43.31,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,2,0,0,0.2,0.2,0.8,0,0.4,0.4,0.4,0.3,0.3,2.67,2.33,-1,1,1,0,0.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,52,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,2,0,0,0,-0.2,-0.2,0.4,0 +409,R_3805DpetJfO3EJz,53 - 59,Canadian,Male,2,3,3,3,3,-3,-2,1,-2,2,0,1,1,-2,1,-1,-1,-1,0,-3,0,3,3,3,3,8,-3,-3,1,-3,2,8,0,2,2,2,2,9,2,2,2,2,2,10,2,3,1,3,2,7,-3,-3,0,-3,1,2,1,1,2,-2,2,2,-1,1,1,1,-3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,51,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,52,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,94,FALSE,0,94,0,0,0,0,0.8836,0,0,1,0,0,0,0,0,0,0,0,0,0.2304,0,1,1,0.25,0.2304,0.2401,0,1,0.8836,1,1,1,1,1,0.418503571,0.151,0.686007143,22,68.75,20,62.5,5,62.5,5,62.5,4,50,6,75,11,68.75,9,56.25,93.53,81,99.25,93.88,100,96.12,90.94,6.25,31.03,18.5,36.75,43.88,25,27.37,34.69,2,0,0,0,0,0,1,0,1,0,0,1,1,4,1,3,3,3,2,5,0,0,2,0,1,0,1,1,1,1,1,0,1,0,1,0,2,2,1,0,0.4,0.4,1.4,3.2,0.6,0.8,0.6,1,1.35,0.75,8.33,3.67,1,6,7,6,4.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),59,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,2,0,-2,0,-1,0,0,-1,0,-1,-1,1,0,4,0,3,1,1,1,5,-0.2,-0.4,0.8,2.2,0.6 +410,R_5ezzYdogimJP8ky,53 - 59,American,Male,1,2,2,1,2,-2,-2,1,-2,-1,2,2,1,1,2,1,1,1,1,1,1,2,2,1,1,1,-2,-2,1,-1,-1,2,2,2,1,1,2,1,2,2,2,2,2,2,1,2,2,1,2,1,-2,-1,1,-1,-1,1,2,2,1,1,2,2,1,1,1,1,1,3,FALSE,1,100,TRUE,1,90,TRUE,0,80,TRUE,0,50,TRUE,1,60,FALSE,1,90,TRUE,1,90,TRUE,1,90,FALSE,0,70,TRUE,1,90,FALSE,1,60,FALSE,1,60,TRUE,1,70,TRUE,0,80,FALSE,0,60,TRUE,1,90,FALSE,1,90,TRUE,0,90,FALSE,1,70,FALSE,1,100,TRUE,1,60,TRUE,1,80,FALSE,1,60,TRUE,1,70,TRUE,0,60,TRUE,1,70,FALSE,1,60,FALSE,1,60,FALSE,1,60,TRUE,1,60,FALSE,0,60,TRUE,1,90,0.01,0.09,0.01,0.01,0.01,0.01,0.09,0.01,0,0.04,0.16,0.09,0.49,0.16,0.16,0.01,0.16,0.25,0.16,0.36,0.16,0.36,0.09,0.64,0.01,0.16,0.36,0,0.64,0.81,0.16,0.16,0.203928571,0.117142857,0.290714286,24,75,24,75,4,50,8,100,5,62.5,7,87.5,13,81.25,11,68.75,74.06,65,72.5,82.5,76.25,75,73.12,0,-0.94,15,-27.5,20,-11.25,-6.25,4.37,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,1,0,0.4,0,0,0.35,0.1,1.33,1.33,0,1,-1,-1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,58,0.625,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,0,1,0,-1,0,0,0,0,0,0,0,0,1,1,1,1,1,0.2,-0.2,0,1,0.25 +411,R_6Pp6q4gizO7hH7Q,46 - 52,Canadian,Male,0,2,2,2,-1,0,0,1,-1,-1,2,2,1,0,1,1,1,2,1,1,0,1,2,2,-1,7,0,0,1,0,0,7,2,0,1,0,0,7,0,0,1,0,1,7,-1,1,1,0,0,7,0,0,0,-1,0,7,0,1,1,0,1,7,0,0,0,0,1,7,TRUE,0,76,TRUE,1,69,TRUE,0,61,TRUE,0,60,FALSE,0,61,TRUE,0,58,TRUE,1,60,TRUE,1,64,TRUE,1,59,TRUE,1,59,TRUE,0,58,TRUE,0,61,FALSE,0,59,FALSE,1,58,TRUE,1,57,TRUE,1,57,FALSE,1,50,TRUE,0,62,FALSE,1,50,FALSE,1,92,TRUE,1,62,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,1,50,TRUE,0,59,FALSE,0,50,FALSE,0,50,TRUE,1,86,0.1296,0.25,0.1849,0.16,0.0196,0.3364,0.25,0.1681,0.0064,0.25,0.25,0.3481,0.1681,0.3364,0.3721,0.0961,0.25,0.36,0.25,0.25,0.1444,0.1849,0.25,0.1764,0.25,0.25,0.25,0.5776,0.3721,0.3844,0.3481,0.3721,0.259689286,0.229378571,0.29,16,50,17,53.13,4,50,4,50,5,62.5,4,50,10,62.5,7,43.75,59,56.62,60.62,58.12,60.62,58.94,59.06,-3.13,5.87,6.62,10.62,-4.38,10.62,-3.56,15.31,0,1,0,0,0,0,0,0,1,1,0,2,0,0,1,1,1,1,1,0,1,1,1,2,1,0,0,1,0,1,2,1,0,0,0,1,1,2,1,0,0.2,0.4,0.6,0.8,1.2,0.4,0.6,1,0.5,0.8,7,7,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),49,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,0,-1,-2,-1,0,0,-1,1,0,-2,1,0,0,1,0,0,-1,0,0,-1,0,0,-0.2,-0.3 +412,R_170Ug1Iq1gkth8K,46 - 52,American,Female,3,3,3,3,3,0,2,0,2,1,3,1,2,2,2,2,0,2,1,2,2,3,3,2,3,8,0,2,3,1,0,8,3,2,2,2,3,8,1,2,0,2,1,7,3,3,3,3,3,10,-1,1,2,2,1,6,3,3,2,3,2,8,3,3,2,2,2,6,FALSE,1,99,FALSE,0,50,FALSE,1,68,FALSE,1,58,TRUE,1,64,FALSE,1,73,TRUE,1,100,FALSE,0,55,TRUE,1,60,TRUE,1,98,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,54,TRUE,1,63,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,74,FALSE,0,60,FALSE,1,83,FALSE,0,60,FALSE,1,89,TRUE,1,70,FALSE,1,85,TRUE,0,100,FALSE,1,59,TRUE,1,100,TRUE,1,66,TRUE,1,100,0.3025,0.09,0,0,0,0.0729,0.36,0.0004,0,0.36,0,1,0.16,0,0.1296,0.25,0.0289,0.1764,1,0.0121,0.5476,0.1369,0,0.2116,1,0.0225,0.1156,0.0001,0.1024,1,0.1681,1,0.280539286,0.1813,0.379778571,16,50,22,68.75,7,87.5,5,62.5,6,75,4,50,10,62.5,12,75,80.88,72.75,81.62,83.75,85.38,76.25,85.5,-18.75,12.13,-14.75,19.12,8.75,35.38,13.75,10.5,1,0,0,1,0,0,0,3,1,1,0,1,0,0,1,1,2,2,1,1,0,0,0,0,0,1,1,2,0,0,0,2,0,1,0,1,3,0,1,0,0.4,1,0.4,1.4,0,0.8,0.6,1,0.8,0.6,8,8,-2,2,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,0,0,1,0,-1,-1,1,1,1,0,-1,0,-1,1,0,-1,2,0,1,0.4,0.2,-0.2,0.4,0.2 +413,R_1OrTLDR6rCD7Wpu,53 - 59,American,Female,3,0,1,0,3,-2,1,2,-2,3,2,-1,3,2,2,2,2,2,2,2,3,0,1,0,3,0,-2,1,3,-2,3,1,2,-2,3,2,2,1,2,2,2,2,2,1,3,-2,1,1,3,3,-2,1,2,-2,3,0,2,-1,3,3,3,1,0,0,0,0,1,3,FALSE,1,97,TRUE,1,97,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,85,TRUE,1,91,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,99,FALSE,0,50,TRUE,1,95,FALSE,1,50,FALSE,1,72,TRUE,0,55,FALSE,1,50,FALSE,0,50,TRUE,1,96,FALSE,1,99,TRUE,1,97,FALSE,1,100,TRUE,1,97,TRUE,0,57,FALSE,1,96,TRUE,0,63,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.0009,0.0025,0.0001,0,0,0.0009,0.0081,0.25,0.0016,0.0625,0,0.0225,0.25,0,0.0009,0.0001,0.25,0.0016,0,0.25,0.25,0.3025,0.0001,0.25,0.3249,0.25,0.0009,0,0.0784,0.3969,0,0.105425,0.060471429,0.150378571,27,84.38,26,81.25,4,50,6,75,8,100,8,100,13,81.25,13,81.25,81.88,61.75,82.75,93.88,89.12,86.38,77.38,3.13,0.63,11.75,7.75,-6.12,-10.88,5.13,-3.87,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,1,0,0.2,0.2,0,0.6,0,0.4,1.8,0.1,0.7,0.67,1.33,-3,1,0,-2,-0.66,5 cents,5 minutes,15 days,Female,University - PhD,56,1.375,1,1,0,0,0,0,0.67,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,-2,0,-1,0,0,0,1,0,0,0,1,0,-1,-1,-2,-2,-2,-2,-1,-0.6,0.2,-0.2,-1.8,-0.6 +414,R_3HuyZ0X8TIq41jw,53 - 59,Canadian,Male,-2,2,1,-2,1,1,1,-1,-1,1,2,2,2,2,2,-2,-2,-1,0,-1,-2,2,0,-3,-2,8,1,0,1,-2,1,1,2,2,2,2,2,8,1,1,0,1,-1,8,-3,2,1,-2,1,5,1,-1,1,-2,1,3,2,2,2,2,2,1,1,0,2,1,1,8,TRUE,0,100,TRUE,1,96,TRUE,0,86,TRUE,0,74,TRUE,1,83,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,85,TRUE,1,90,TRUE,0,86,TRUE,0,86,TRUE,1,74,TRUE,0,70,TRUE,1,80,TRUE,1,100,TRUE,0,87,TRUE,0,78,TRUE,0,60,FALSE,1,100,TRUE,1,79,TRUE,1,80,TRUE,0,84,TRUE,1,88,TRUE,0,72,TRUE,1,100,TRUE,0,74,FALSE,1,84,TRUE,0,94,FALSE,0,86,FALSE,0,55,TRUE,1,100,0,0,0,0,0,0.04,0.0144,0.01,0,0.04,0.7396,0.0676,0.0225,0.7396,0.0289,0.0016,0.7056,0.5476,0.0256,0.5184,0.0441,0.04,0.36,0.49,0.7569,0.5476,0.3025,1,0.7396,0.6084,0.8836,0.7396,0.357632143,0.211242857,0.504021429,9,28.13,17,53.13,3,37.5,5,62.5,4,50,5,62.5,14,87.5,3,18.75,84.72,76.25,85.12,86.25,91.25,87.25,82.19,-25,31.59,38.75,22.62,36.25,28.75,-0.25,63.44,0,0,1,1,3,0,1,2,1,0,0,0,0,0,0,3,3,1,1,0,1,0,0,0,0,0,2,2,1,0,0,0,0,0,0,3,2,3,1,2,1,0.8,0,1.6,0.2,1,0,2.2,0.85,0.85,5.67,3,3,-2,7,0,2.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,53,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,0,1,1,3,0,-1,0,0,0,0,0,0,0,0,0,1,-2,0,-2,0.8,-0.2,0,-0.6,0 +415,R_7HUEOPWFPRuB995,60 - 66,Canadian,Female,0,1,2,0,-1,-1,-1,1,-1,0,-1,1,2,-2,1,1,1,2,2,1,-2,1,2,-2,-2,2,-2,-2,2,-2,-2,2,-1,1,1,-2,1,2,1,1,1,1,1,2,-1,1,2,-1,-1,2,-2,0,2,-2,-1,2,-1,1,2,-2,2,2,2,1,1,1,1,2,FALSE,1,99,FALSE,0,60,TRUE,0,92,FALSE,1,51,TRUE,1,95,FALSE,1,63,TRUE,1,92,TRUE,1,98,FALSE,0,53,TRUE,1,95,FALSE,1,97,TRUE,0,100,TRUE,1,98,FALSE,1,88,TRUE,1,70,TRUE,1,96,TRUE,0,77,TRUE,0,80,TRUE,0,87,FALSE,1,78,TRUE,1,52,TRUE,1,96,TRUE,0,65,TRUE,1,98,FALSE,1,78,TRUE,1,79,FALSE,1,83,TRUE,0,91,FALSE,1,83,FALSE,0,95,TRUE,1,51,TRUE,1,95,0.0004,0.0441,0.0016,0.0064,0.0025,0.1369,0.0004,0.0025,0.0484,0.0016,0.9025,0.0004,0.2809,0.0009,0.0025,0.36,0.4225,0.2401,0.8281,0.0484,0.2304,0.09,0.7569,0.0144,0.5929,0.0289,0.2401,0.0001,0.8464,0.64,0.0289,1,0.2767,0.171578571,0.381821429,16,50,22,68.75,5,62.5,6,75,7,87.5,4,50,13,81.25,9,56.25,82.34,69,78.5,88.38,93.5,82.69,82,-18.75,13.59,6.5,3.5,0.88,43.5,1.44,25.75,2,0,0,2,1,1,1,1,1,2,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,0,1,1.2,0.2,0.4,0.4,1,0.2,0.6,0.7,0.55,2,2,0,0,0,0,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),61,0,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,1,0,0,1,1,0,0,0,0,1,0,0,1,0,-1,-1,0,0,0,0,0.6,0.2,0,-0.2,0.15 +416,R_1HkpOnFzZo2O7jl,46 - 52,Canadian,Male,1,3,3,2,3,1,-2,3,-2,2,2,2,2,-1,3,3,2,3,2,1,3,3,3,3,3,1,0,-3,0,-2,0,5,-2,-1,-2,1,2,6,-1,-1,-1,-1,-2,6,2,3,3,3,3,9,2,-2,3,-3,2,1,1,2,2,-2,3,1,3,3,3,3,3,1,FALSE,1,50,FALSE,0,50,TRUE,0,76,FALSE,1,50,FALSE,0,50,TRUE,0,66,TRUE,1,97,TRUE,1,97,TRUE,1,50,TRUE,1,97,TRUE,0,50,TRUE,0,77,FALSE,0,62,TRUE,0,73,TRUE,1,50,TRUE,1,95,TRUE,0,60,TRUE,0,78,FALSE,1,50,FALSE,1,98,TRUE,1,96,TRUE,1,97,FALSE,1,50,FALSE,0,50,TRUE,0,65,TRUE,1,76,TRUE,0,50,TRUE,0,66,FALSE,1,86,TRUE,1,91,FALSE,0,59,FALSE,0,95,0.0009,0.0576,0.0025,0.0009,0.9025,0.4356,0.25,0.0009,0.0004,0.0009,0.0081,0.3844,0.25,0.25,0.25,0.25,0.25,0.25,0.4356,0.4225,0.0016,0.25,0.25,0.5329,0.36,0.25,0.3481,0.25,0.5776,0.6084,0.0196,0.5929,0.299357143,0.248771429,0.349942857,20,62.5,16,50,4,50,3,37.5,5,62.5,4,50,10,62.5,6,37.5,70.53,51.12,70.62,79.12,81.25,75.75,65.31,12.5,20.53,1.12,33.12,16.62,31.25,13.25,27.81,2,0,0,1,0,1,1,3,0,2,4,3,4,2,1,4,3,4,3,3,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,2,0.6,1.4,2.8,3.4,0.4,0.4,0.4,0.8,2.05,0.5,4,3.67,-8,4,5,5,0.33,5 cents,5 minutes,24 days,Male,University - PhD,46,1,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,1,0,0,0,0,0,1,3,-1,2,3,3,4,1,1,4,2,4,2,1,0.2,1,2.4,2.6,1.55 +417,R_3qkqjzWRZrcoqIx,39 - 45,American,Female,0,2,2,2,0,-1,-1,3,1,0,3,2,1,-1,3,2,1,2,2,2,0,2,2,2,1,2,-1,-1,3,1,0,2,3,2,1,-1,3,2,2,2,2,2,2,2,0,2,2,2,0,2,-1,-1,3,1,0,2,3,2,2,-1,3,3,2,2,2,2,2,3,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,FALSE,0,74,TRUE,0,100,TRUE,0,100,TRUE,1,98,TRUE,0,91,TRUE,1,96,TRUE,1,96,TRUE,0,100,TRUE,0,99,TRUE,0,88,TRUE,0,88,TRUE,1,88,TRUE,1,91,TRUE,0,94,TRUE,1,77,FALSE,1,77,TRUE,1,97,TRUE,0,80,TRUE,0,93,FALSE,1,89,TRUE,1,97,FALSE,0,88,TRUE,1,91,0,0.0009,0.0016,0,0.0081,0,0.0529,0.5476,0.7744,0.0081,0.0009,0.0004,0.0025,1,0.0001,0,0.8836,1,0.8649,0.0529,0.0144,0.0016,0.7744,0.8281,1,0.64,0.7744,0.9216,1,0.9801,0.0121,1,0.469396429,0.305614286,0.633178571,20,62.5,17,53.13,3,37.5,6,75,4,50,4,50,14,87.5,3,18.75,93.19,93.38,94.88,90.62,93.88,92.94,93.44,9.37,40.06,55.88,19.88,40.62,43.88,5.44,74.69,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.2,0,0,0.2,0,0,0.2,0.2,0.1,0.1,2,2.33,0,0,-1,-1,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,41,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0.2,0,-0.2,0,0 +418,R_5qrd0tdCp9EcqTV,32 - 38,Both,Female,1,1,2,-2,-2,-2,1,1,2,-1,1,-1,1,1,1,-2,-1,-1,0,-1,2,2,2,-2,-2,3,-2,1,2,2,-2,4,1,-1,2,1,1,3,-2,-2,-2,-2,-2,4,2,1,2,-1,-2,3,-2,1,2,2,-2,3,1,-2,1,1,1,2,-1,-1,-2,-2,-2,7,FALSE,1,100,TRUE,1,76,FALSE,1,89,TRUE,0,50,TRUE,1,89,FALSE,1,50,TRUE,1,91,TRUE,1,92,TRUE,1,94,TRUE,1,100,FALSE,1,50,TRUE,0,92,TRUE,1,95,TRUE,0,82,TRUE,1,51,TRUE,1,100,FALSE,1,50,FALSE,1,93,FALSE,1,50,FALSE,1,98,FALSE,0,51,TRUE,1,78,FALSE,1,50,TRUE,1,81,TRUE,0,88,TRUE,1,91,TRUE,0,88,TRUE,0,50,TRUE,0,94,TRUE,1,75,TRUE,1,84,TRUE,1,80,0.0064,0.0081,0,0.0081,0.04,0.25,0.0361,0,0.0004,0.0484,0.0625,0.0025,0.0036,0.25,0.0121,0.0576,0.25,0.25,0.25,0.7744,0.2601,0.2401,0.25,0.6724,0.25,0.7744,0.0256,0,0.0121,0.0049,0.8836,0.8464,0.2324,0.090228571,0.374571429,8,25,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,78.19,67.88,69.88,90.38,84.62,83,73.38,-50,3.19,-7.12,-5.12,15.38,9.62,-10.75,17.13,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,2,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,2,1,0.4,0.4,0.2,1,0.4,0.4,0.2,1,0.5,0.5,3.33,2.67,0,1,1,-3,0.66,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),36,0.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,1,0,-1,0,0,0,0,0,0,0,-1,1,0,0,-1,1,0,0,0,0,0,0,0,0 +419,R_1LzFombgHpQ84me,46 - 52,American,Male,2,3,3,2,3,1,-2,2,-2,2,3,2,2,2,3,1,1,3,2,1,1,1,2,2,2,7,1,1,1,0,0,7,-1,0,0,0,1,0,2,2,3,2,2,8,2,2,2,1,2,8,0,0,1,1,0,7,0,0,2,1,0,8,1,2,1,1,1,8,FALSE,1,96,TRUE,1,98,FALSE,1,85,FALSE,1,70,TRUE,1,95,FALSE,1,95,TRUE,1,98,TRUE,1,100,TRUE,1,95,TRUE,1,98,FALSE,1,97,FALSE,1,85,FALSE,0,90,FALSE,1,95,TRUE,1,90,TRUE,1,100,FALSE,1,90,TRUE,0,95,FALSE,1,85,FALSE,1,95,TRUE,1,100,TRUE,1,99,FALSE,1,96,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,1,95,TRUE,0,90,FALSE,1,90,FALSE,0,95,TRUE,1,95,TRUE,1,95,0,0,0,0.0004,0.0025,0.0025,0,0.0004,0.0025,0.0001,0.9025,0.81,0.0025,0.0009,0.0025,0.0004,0.0016,0.09,0.81,0.0225,0,0.01,0.0225,0.0025,0.01,0.0025,0.0025,0.0016,0.0225,0.9025,0.01,0.0225,0.130714286,0.129885714,0.131542857,32,100,28,87.5,8,100,7,87.5,7,87.5,6,75,14,87.5,14,87.5,93.5,90.62,93.88,95.75,93.75,96.75,90.25,12.5,6,-9.38,6.38,8.25,18.75,9.25,2.75,1,2,1,0,1,0,3,1,2,2,4,2,2,2,2,1,1,0,0,1,0,1,1,1,1,1,2,1,3,2,3,2,0,1,3,0,1,2,1,0,1,1.6,2.4,0.6,0.8,1.8,1.8,0.8,1.4,1.3,4.67,7.67,-1,0,-8,0,-3,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),47,1.875,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,1,0,-1,0,-1,1,0,-1,0,1,0,2,1,-1,1,0,-2,-1,1,0.2,-0.2,0.6,-0.2,0.1 +420,R_1SojIeCCuVQciPw,53 - 59,American,Female,0,0,3,-3,-3,-1,-3,1,-1,-1,3,1,2,0,3,-2,-3,-2,-2,-2,0,0,3,-3,-3,1,-1,-3,3,0,-1,2,2,2,2,-1,3,1,0,-2,0,0,-2,5,0,0,3,0,-3,1,-2,-3,2,-1,-1,1,2,1,0,-1,2,1,-1,-1,-1,-1,-1,2,TRUE,0,50,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,75,TRUE,1,85,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,75,TRUE,1,75,TRUE,0,75,TRUE,0,75,TRUE,0,75,TRUE,1,75,TRUE,1,50,TRUE,1,100,0.0225,0.0625,0.25,0.0625,0,0.25,0.25,0,0.25,0.25,0.0625,0.25,0.0625,0.25,0.25,0.0625,0.25,0.25,0.5625,0.5625,0.25,0.25,0.25,1,0.25,0.5625,0.25,0.25,0.25,0.5625,0.5625,1,0.321428571,0.174107143,0.46875,23,71.88,22,68.75,7,87.5,5,62.5,4,50,6,75,16,100,6,37.5,65.16,59.38,59.38,75,66.88,66.25,64.06,3.13,-3.59,-28.12,-3.12,25,-8.12,-33.75,26.56,0,0,0,0,0,0,0,2,1,0,1,1,0,1,0,2,1,2,2,0,0,0,0,3,0,1,0,1,0,0,1,0,2,1,1,1,2,1,1,1,0,0.6,0.6,1.4,0.6,0.4,1,1.2,0.65,0.8,1.33,1,0,1,0,3,0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),57,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-3,0,-1,0,1,1,0,0,1,-2,0,-1,1,-1,1,1,-1,-0.6,0.2,-0.4,0.2,-0.15 +421,R_6YlMdPmRSe9svO9,53 - 59,American,Male,2,3,3,-3,3,-3,-3,3,-3,3,3,0,3,-3,3,-3,-3,-3,0,-3,3,3,3,-3,3,6,3,-3,3,-3,3,0,3,0,3,-3,3,0,-3,-3,-3,-3,-3,0,0,3,3,-3,3,9,0,-3,3,-3,3,8,3,0,3,-3,3,0,0,0,3,1,-3,3,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,99,TRUE,1,96,FALSE,1,50,TRUE,1,50,TRUE,1,96,FALSE,1,71,FALSE,1,71,FALSE,1,61,FALSE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,54,FALSE,0,55,FALSE,1,59,FALSE,1,100,TRUE,0,50,TRUE,1,96,FALSE,0,100,TRUE,1,100,0,0.3025,0.0016,0,0,0,0.25,0.25,0,0,0.0016,0.0016,0.25,0,0.25,0,0,0.25,0,0.2916,0.0064,0.25,0.1521,0.25,0.0841,0.1681,1,1,0.5625,0.0841,0.25,0.9801,0.22615,0.089514286,0.362785714,16,50,21,65.63,6,75,6,75,4,50,5,62.5,10,62.5,11,68.75,78.91,71.25,82.38,72.5,89.5,80.31,77.5,-15.63,13.28,-3.75,7.38,22.5,27,17.81,8.75,1,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,6,1,0,0.2,1.2,0,0.6,0.4,0.6,0,2.6,0.5,0.9,2,5.67,-3,-8,0,-3,-3.67,10 cents,100 minutes,24 days,Male,Trade School (non-military),53,1.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,0,0,0,0,3,0,0,0,0,0,0,0,0,0,-3,-3,-6,2,0,-0.2,0.6,0,-2,-0.4 +422,R_5QLUC9EzFyEQGLZ,67 - 73,Canadian,Female,3,0,3,2,3,-1,-1,2,0,-1,2,2,3,0,2,2,2,3,2,2,1,0,3,-2,3,6,-1,-1,3,0,0,3,2,2,2,-2,2,2,1,1,2,-1,2,7,3,0,2,3,0,9,-2,0,2,0,-3,5,2,2,2,0,2,1,1,0,2,3,2,8,TRUE,0,88,TRUE,1,100,TRUE,0,100,FALSE,1,58,TRUE,1,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,66,TRUE,1,95,FALSE,1,100,FALSE,1,93,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,56,TRUE,0,100,FALSE,1,84,FALSE,1,100,TRUE,1,70,TRUE,1,89,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,0,98,FALSE,1,78,TRUE,0,97,TRUE,1,100,FALSE,0,64,TRUE,1,100,0,0.0001,0,0,0,0,0,0.0025,0,0.0121,0,0,0.4356,0,0.1521,0,0.0009,0.1764,0.0484,0,0.09,0.3025,0.0256,1,0.1936,0.9604,0.4096,0.7744,1,1,0.9409,0.0049,0.268925,0.055685714,0.482164286,24,75,23,71.88,4,50,7,87.5,5,62.5,7,87.5,13,81.25,10,62.5,89,78.12,85.12,96.38,96.38,87.44,90.56,3.12,17.12,28.12,-2.38,33.88,8.88,6.19,28.06,2,0,0,4,0,0,0,1,0,1,0,0,1,2,0,1,1,1,3,0,0,0,1,1,3,1,1,0,0,2,0,0,1,0,0,1,2,1,1,0,1.2,0.4,0.6,1.2,1,0.8,0.2,1,0.85,0.75,3.67,5,-3,-2,1,-1,-1.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,72,-0.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,0,-1,3,-3,-1,-1,1,0,-1,0,0,0,2,0,0,-1,0,2,0,0.2,-0.4,0.4,0.2,0.1 +423,R_5rpijjmze8smW8X,53 - 59,American,Male,3,3,-3,-3,-3,-3,3,3,-1,-3,-3,3,3,-3,-3,-3,0,-3,-3,-3,3,3,-3,-3,-3,1,-3,2,3,2,-3,1,-3,3,3,-3,-3,1,-3,-3,-3,-3,-3,0,3,3,-3,-3,-3,0,-3,3,3,3,-3,0,-3,3,3,-3,-3,0,-3,-3,-3,-3,-3,0,FALSE,1,52,TRUE,1,56,TRUE,0,100,FALSE,1,50,FALSE,0,53,FALSE,1,54,TRUE,1,100,TRUE,1,73,TRUE,1,94,FALSE,0,76,FALSE,1,50,FALSE,1,53,FALSE,0,54,FALSE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,95,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,55,FALSE,1,51,FALSE,0,53,FALSE,1,52,TRUE,1,100,FALSE,1,51,FALSE,1,100,FALSE,1,51,FALSE,0,52,FALSE,0,51,FALSE,0,53,0.0729,0,0,0,0.2809,0.2116,0.2809,0.5776,0,0.3025,0.2704,0.2916,0.0036,0.25,0.2809,0.1936,0.2401,0.25,0,0.2304,0,0.36,0.25,0,0,0.2401,0.2601,0.2304,1,0.9025,0.2401,0.2209,0.26315,0.245264286,0.281035714,13,40.63,21,65.63,6,75,5,62.5,5,62.5,5,62.5,7,43.75,14,87.5,69.97,57.75,64.5,78.75,78.88,70.62,69.31,-25,4.34,-17.25,2,16.25,16.38,26.87,-18.19,0,0,0,0,0,0,1,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,3,0,0,0,0,0.8,0,0.6,0,0.8,0,0.6,0.35,0.35,1,0,1,1,1,0,1,10 cents,25 minutes,24 days,Male,High School (or equivalent),54,-1.125,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +424,R_3zqBtM41MgTa0Ok,67 - 73,American,Female,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,-1,2,0,2,-2,3,3,3,3,3,10,2,-2,3,-2,0,0,2,2,2,2,2,10,3,3,3,3,3,10,3,3,3,3,3,10,3,0,0,-3,0,5,3,3,3,3,3,2,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0001,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0.571428571,0.357142857,0.785714286,32,100,16,50,3,37.5,5,62.5,4,50,4,50,15,93.75,1,6.25,99.97,100,100,99.88,100,99.94,100,50,49.97,62.5,37.5,49.88,50,6.19,93.75,0,0,0,0,0,2,2,3,2,0,2,2,2,2,2,4,1,3,1,5,0,0,0,0,0,3,0,0,3,0,3,3,3,3,3,4,1,3,1,5,0,1.8,2,2.8,0,1.2,3,2.8,1.65,1.75,6.67,5.67,0,-5,8,0,1,5 cents,100 minutes,47 days,Female,College Diploma/Certificate,73,0,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,-1,2,3,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0,0.6,-1,0,-0.1 +425,R_5kWmAe2xL3wBJpn,53 - 59,American,Male,2,1,2,0,3,-2,-3,3,-3,1,2,0,1,-2,2,0,0,1,1,3,2,-1,3,1,3,5,1,-3,3,-3,1,5,2,1,1,-1,3,5,0,0,0,0,0,5,2,0,2,2,3,5,-3,-3,3,-3,0,8,1,0,1,0,3,7,3,3,3,3,3,5,FALSE,1,81,TRUE,1,57,TRUE,0,53,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,72,TRUE,1,71,TRUE,1,66,TRUE,1,100,FALSE,1,55,TRUE,0,78,TRUE,1,97,TRUE,0,97,FALSE,0,54,TRUE,1,100,FALSE,1,90,TRUE,0,86,FALSE,1,55,FALSE,1,100,TRUE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,77,FALSE,1,100,TRUE,1,87,TRUE,0,50,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,0.0841,0.0169,0,0.0784,0,0,0.0529,0,0,0.16,0,0.0009,0.1156,0.2025,0,0.1849,0,0.25,0.09,0,0.1444,0.2916,0.2025,0.9409,0.01,0.25,0.1225,0.0361,0.2809,0.7396,1,0.6084,0.202989286,0.069057143,0.336921429,26,81.25,24,75,5,62.5,7,87.5,6,75,6,75,15,93.75,9,56.25,79.16,56.5,93.62,85.38,81.12,79.25,79.06,6.25,4.16,-6,6.12,10.38,6.12,-14.5,22.81,0,2,1,1,0,3,0,0,0,0,0,1,0,1,1,0,0,1,1,3,0,1,0,2,0,1,0,0,0,1,1,0,0,2,1,3,3,2,2,0,0.8,0.6,0.6,1,0.6,0.4,0.8,2,0.75,0.95,5,6.67,0,-3,-2,0,-1.67,5 cents,5 minutes,47 days,Male,University - Undergraduate,58,0.875,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,1,1,-1,0,2,0,0,0,-1,-1,1,0,-1,0,-3,-3,-1,-1,3,0.2,0.2,-0.2,-1,-0.2 +426,R_7Y1IbOapKud15Hb,67 - 73,Canadian,Male,3,2,2,0,2,-3,1,2,-1,0,2,0,3,-2,3,3,2,3,3,3,3,2,2,-2,2,2,-3,1,2,1,1,2,2,0,3,0,3,2,2,2,3,2,3,2,3,2,2,-2,2,2,-3,2,2,0,0,2,2,0,3,-2,3,2,2,0,2,2,3,2,FALSE,1,94,TRUE,1,76,TRUE,0,96,FALSE,1,50,FALSE,0,92,FALSE,1,93,TRUE,1,50,TRUE,1,95,TRUE,1,50,TRUE,1,93,TRUE,0,50,FALSE,1,71,TRUE,1,93,FALSE,1,50,TRUE,1,50,TRUE,1,97,TRUE,0,50,FALSE,1,50,TRUE,0,61,FALSE,1,96,TRUE,1,69,TRUE,1,91,FALSE,1,50,TRUE,1,90,FALSE,1,50,TRUE,1,91,TRUE,0,59,FALSE,1,50,FALSE,1,50,TRUE,1,91,FALSE,0,50,TRUE,1,50,0.0025,0.0081,0.0009,0.25,0.25,0.0049,0.01,0.0049,0.0016,0.0081,0.0081,0.0049,0.25,0.25,0.8464,0.0576,0.25,0.25,0.25,0.25,0.0961,0.25,0.3721,0.25,0.25,0.3481,0.25,0.0036,0.9216,0.25,0.25,0.0841,0.215075,0.156892857,0.273257143,25,78.13,25,78.13,4,50,6,75,8,100,7,87.5,14,87.5,11,68.75,70.25,55.75,68.38,71.12,85.75,76.75,63.75,0,-7.88,5.75,-6.62,-28.88,-1.75,-10.75,-5,0,0,0,2,0,0,0,0,2,1,0,0,0,2,0,1,0,0,1,0,0,0,0,2,0,0,1,0,1,0,0,0,0,0,0,1,2,1,1,0,0.4,0.6,0.4,0.4,0.4,0.4,0,1,0.45,0.45,2,2,0,0,0,0,0,10 cents,25 minutes,15 days,Male,High School (or equivalent),70,1.125,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,-1,0,1,1,0,0,0,2,0,0,-2,-1,0,0,0,0.2,0.4,-0.6,0 +427,R_6PLPYhC0VFT9Oz7,39 - 45,Canadian,Male,1,3,1,0,-3,-3,0,1,-3,0,2,-3,1,0,3,2,2,2,1,1,1,3,1,0,-3,1,-3,0,1,0,0,1,2,-3,1,1,3,1,0,1,0,1,-1,3,1,3,1,0,-3,0,-3,0,1,0,0,1,2,-3,1,0,3,0,1,1,1,1,1,1,FALSE,1,100,TRUE,1,75,TRUE,0,75,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,90,TRUE,1,90,TRUE,1,90,TRUE,1,90,FALSE,1,75,TRUE,0,90,TRUE,1,95,TRUE,0,90,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,75,TRUE,0,50,FALSE,1,90,TRUE,1,75,TRUE,1,90,FALSE,1,100,TRUE,1,90,FALSE,1,50,TRUE,1,60,FALSE,1,100,FALSE,1,60,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,60,0.01,0.16,0,0.01,0.16,0,0.01,0.01,0.01,0.01,0.25,0.0025,0.01,0.0625,0.0625,0.0625,0,0.25,0.16,0.25,0.0625,0.25,0.25,0.81,0.25,0,0.25,0,0.5625,0.5625,0.25,0.81,0.191696429,0.064285714,0.319107143,24,75,23,71.88,6,75,6,75,6,75,5,62.5,14,87.5,9,56.25,76.09,67.5,75.62,80.62,80.62,76.88,75.31,3.12,4.21,-7.5,0.62,5.62,18.12,-10.62,19.06,0,0,0,0,0,0,0,0,3,0,0,0,0,1,0,2,1,2,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,1,1,0,0,0,0.6,0.2,1.4,0,0.6,0,0.6,0.55,0.3,1,0.33,1,0,1,2,0.67,5 cents,5 minutes,47 days,Male,University - Undergraduate,45,1.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,2,0,0,0.2,0.8,0.25 +428,R_7XgJIuD2YuirCqG,46 - 52,Canadian,Male,2,3,2,-1,3,1,-3,2,-3,1,0,1,3,-1,3,0,0,0,0,0,2,2,2,-1,2,5,1,-3,1,-3,1,5,1,1,1,1,1,5,1,1,1,1,1,5,2,3,2,-2,3,5,0,-3,2,-3,1,5,1,1,1,1,1,2,1,1,1,1,1,4,TRUE,0,100,FALSE,0,54,TRUE,0,100,FALSE,1,62,FALSE,0,54,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,1,100,FALSE,1,70,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,0,0,0,1,0,0,0.1225,0,0,0,0,0.1089,0.2916,0.2916,1,0.1444,1,1,0,0,1,0.09,1,1,0.3025,1,1,1,1,1,0.476839286,0.211357143,0.742321429,22,68.75,17,53.13,4,50,3,37.5,5,62.5,5,62.5,13,81.25,4,25,91.47,79.75,94.25,96.25,95.62,91.44,91.5,15.62,38.34,29.75,56.75,33.75,33.12,10.19,66.5,0,1,0,0,1,0,0,1,0,0,1,0,2,2,2,1,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,0,2,2,2,1,1,1,1,1,0.4,0.2,1.4,1,0.2,0.2,1.4,1,0.75,0.7,5,4,0,0,3,1,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,49,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,1,0,-1,1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05 +429,R_16XZ1yejBSDUIG5,60 - 66,American,Female,3,3,3,-2,1,1,-3,3,-2,2,3,3,2,-3,3,2,-1,3,3,2,-2,3,3,-3,2,4,2,-2,3,1,2,4,1,2,2,-3,2,2,2,-2,2,2,2,2,3,3,3,-3,-1,1,1,-3,3,-2,1,1,3,3,3,-2,3,3,2,-1,2,2,2,2,TRUE,0,87,FALSE,0,55,FALSE,1,100,FALSE,1,52,TRUE,1,56,FALSE,1,68,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,100,FALSE,1,54,TRUE,0,100,TRUE,1,63,TRUE,0,91,TRUE,1,53,TRUE,1,59,TRUE,0,57,TRUE,0,100,TRUE,0,56,FALSE,1,56,TRUE,1,78,FALSE,0,52,TRUE,0,57,FALSE,0,84,FALSE,1,61,TRUE,1,71,FALSE,1,51,TRUE,0,67,TRUE,0,54,TRUE,1,99,FALSE,0,52,TRUE,1,65,0,0.0841,0.1681,0,0.1225,0.1024,0.7056,0,0.1936,0.2704,0.0001,0.1369,0.2025,0.2116,0.1936,0.3025,0.3249,0.2304,0.4489,0.1521,0.0484,0.2209,0.3136,0.8281,0.3249,0.2401,0.2704,0.7569,0,1,0.2916,1,0.317603571,0.214071429,0.421135714,16,50,19,59.38,5,62.5,5,62.5,4,50,5,62.5,12,75,7,43.75,70.41,53.5,62.25,82.75,83.12,71.38,69.44,-9.38,11.03,-9,-0.25,32.75,20.62,-3.62,25.69,5,0,0,1,1,1,1,0,3,0,2,1,0,0,1,0,1,1,1,0,0,0,0,1,2,0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,1.4,1,0.8,0.6,0.6,0.2,0.4,0.4,0.95,0.4,3.33,1.67,3,3,-1,0,1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),65,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,5,0,0,0,-1,1,1,0,3,-1,2,1,-1,-1,1,0,1,0,0,0,0.8,0.8,0.4,0.2,0.55 +430,R_7W3Jss5Qy6jeZl7,60 - 66,American,Female,-1,2,0,-2,-2,-3,-2,3,3,-2,2,2,0,-2,0,1,0,2,2,-2,2,2,-2,2,-1,5,-3,-1,2,3,-3,7,3,2,0,-3,-2,4,-1,-2,-1,-1,-2,8,2,2,1,-1,0,5,-3,0,3,3,-3,3,3,3,0,-2,1,7,0,-1,0,1,-2,5,FALSE,1,100,TRUE,1,100,FALSE,1,55,TRUE,0,54,TRUE,1,54,FALSE,1,100,TRUE,1,81,TRUE,1,100,TRUE,1,100,FALSE,0,53,FALSE,1,58,FALSE,1,53,FALSE,0,54,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,53,TRUE,0,53,FALSE,1,55,FALSE,1,100,FALSE,0,53,TRUE,1,58,FALSE,1,100,TRUE,1,66,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,51,TRUE,0,53,TRUE,1,70,FALSE,0,62,TRUE,1,100,0,0.25,0,0.0361,0,0,0.1156,0.2809,0,0.1764,0.09,0.2916,0,0.1764,0.2116,0,0,0.2916,0.2601,0.25,0.2809,0.3025,0.2025,1,0.2209,0.25,0.3844,0,0.2025,0.2809,0.2809,0.2209,0.206092857,0.116721429,0.295464286,14,43.75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,11,68.75,11,68.75,70.03,66.75,70.88,68.12,74.38,72.25,67.81,-25,1.28,4.25,8.38,5.62,-13.12,3.5,-0.94,3,0,2,4,1,0,1,1,0,1,1,0,0,1,2,2,2,3,3,0,3,0,1,1,2,0,2,0,0,1,1,1,0,0,1,1,1,2,1,0,2,0.6,0.8,2,1.4,0.6,0.6,1,1.35,0.9,5.33,5,0,4,-3,3,0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,61,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,1,3,-1,0,-1,1,0,0,0,-1,0,1,1,1,1,1,2,0,0.6,0,0.2,1,0.45 +431,R_1TAWadiw4jlO7Gg,67 - 73,American,Female,3,2,-2,-1,1,0,-3,2,-2,2,3,-3,3,1,3,-2,-1,-2,1,0,3,2,0,-2,1,1,0,-3,2,-2,1,1,3,-3,3,1,3,1,1,1,1,2,0,9,3,3,-2,-2,0,1,0,-3,2,-3,0,1,3,-3,3,1,3,1,0,0,0,0,0,5,TRUE,0,92,TRUE,1,86,FALSE,1,100,TRUE,0,50,TRUE,1,85,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,0,92,TRUE,1,60,TRUE,0,67,TRUE,0,97,TRUE,1,77,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,78,TRUE,0,50,TRUE,0,66,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,57,TRUE,1,98,TRUE,0,50,TRUE,0,50,TRUE,0,90,TRUE,1,93,TRUE,1,50,TRUE,1,100,0,0.0004,0,0.1225,0,0,0.0025,0.16,0,0,0.0049,0.0529,0.8464,0.4489,0.0225,0.0196,0,0.25,0.25,0.3249,0.25,0.25,0.4356,1,0.6084,0.25,0.25,0.8464,0,0.25,0.81,0.9409,0.295496429,0.129121429,0.461871429,24,75,19,59.38,3,37.5,6,75,4,50,6,75,15,93.75,4,25,79.62,63.88,85,77.75,91.88,81.31,77.94,15.62,20.24,26.38,10,27.75,16.88,-12.44,52.94,0,0,2,1,0,0,0,0,0,1,0,0,0,0,0,3,2,3,1,0,0,1,0,1,1,0,0,0,1,2,0,0,0,0,0,2,1,2,1,0,0.6,0.2,0,1.8,0.6,0.6,0,1.2,0.65,0.6,1,1,0,0,0,4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,70,1.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,-1,2,0,-1,0,0,0,-1,-1,0,0,0,0,0,1,1,1,0,0,0,-0.4,0,0.6,0.05 +432,R_5meluxYLoVHhaVj,60 - 66,American,Male,2,3,2,-3,3,2,-2,1,-1,2,2,1,2,2,2,0,1,1,3,2,2,3,1,-3,3,2,3,-2,3,-2,3,2,2,2,3,3,3,2,3,3,3,3,3,7,1,3,2,0,1,2,2,-2,1,-2,1,2,2,2,2,2,2,2,2,0,0,3,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,68,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,100,FALSE,1,79,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,67,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0.1024,0,0,0,0,0,0,0.0016,0.0441,0,0,0,0.25,0,0.1089,0,0.0841,0.0529,0,0,0.36,0.09,0,0.25,0,1,0.8649,0.114603571,0.028435714,0.200771429,25,78.13,27,84.38,6,75,7,87.5,8,100,6,75,16,100,11,68.75,90.03,75.38,96,95.88,92.88,96.06,84,-6.25,5.65,0.38,8.5,-4.12,17.88,-3.94,15.25,0,0,1,0,0,1,0,2,1,1,0,1,1,1,1,3,2,2,0,1,1,0,0,3,2,0,0,0,1,1,0,1,0,0,0,2,1,1,0,0,0.2,1,0.8,1.6,1.2,0.4,0.2,0.8,0.9,0.65,2,2,0,0,0,5,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),64,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,-1,0,1,-3,-2,1,0,2,0,0,0,0,1,1,1,1,1,1,0,1,-1,0.6,0.6,0.8,0.25 +433,R_52QubOgVKMWofAS,60 - 66,Canadian,Male,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,6,1,0,1,1,1,5,0,1,1,1,1,5,1,0,1,1,0,5,1,1,1,1,0,5,1,1,1,0,1,5,0,0,0,0,0,5,1,1,1,1,0,5,TRUE,0,100,FALSE,0,56,FALSE,1,56,FALSE,1,59,FALSE,0,60,FALSE,1,64,FALSE,0,63,TRUE,1,86,TRUE,1,67,FALSE,0,56,FALSE,1,59,TRUE,0,100,TRUE,1,76,FALSE,1,56,FALSE,0,61,TRUE,1,100,TRUE,0,82,FALSE,1,61,FALSE,1,69,FALSE,1,100,TRUE,1,72,FALSE,0,63,FALSE,1,65,FALSE,0,64,FALSE,1,66,FALSE,0,64,FALSE,1,66,FALSE,1,66,FALSE,1,66,FALSE,0,69,TRUE,1,74,FALSE,0,81,0.0196,0.4096,0,0.3969,0.6561,0.1296,0.4096,0.3136,0,0.3969,0.4761,0.0576,0.1089,0.1681,0.36,0.3136,0.1225,0.1681,0.1156,0.1156,0.0784,0.3721,0.0961,0.1936,0.6724,0.1156,0.0676,1,0.1936,0.1521,0.1156,1,0.284607143,0.262907143,0.306307143,11,34.38,19,59.38,6,75,5,62.5,3,37.5,5,62.5,6,37.5,13,81.25,70.22,63.88,70.75,66.12,80.12,69.5,70.94,-25,10.84,-11.12,8.25,28.62,17.62,32,-10.31,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,0.2,0.2,0.2,0.2,0.4,0.2,1,0.4,0.2,0.5,5.33,5,1,0,0,0,0.33,10 cents,100 minutes,24 days,Male,Trade School (non-military),62,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,1,0,0,-1,-1,0,1,0,-1,0,0,-1,-1,-1,-1,0,-1,0,0,0,-0.2,0,-0.8,-0.2,-0.3 +434,R_3bU9o5xihZILjB9,67 - 73,American,Male,2,2,2,-1,2,1,-1,2,-1,0,1,2,1,1,1,0,2,2,2,1,2,2,2,-2,2,2,2,-1,2,-2,1,2,1,2,2,2,2,2,1,2,1,1,1,2,2,1,1,0,0,2,1,-2,1,-2,-1,2,1,1,1,0,1,2,0,0,1,1,0,2,FALSE,1,71,FALSE,0,73,FALSE,1,76,FALSE,1,55,TRUE,1,75,FALSE,1,100,TRUE,1,70,TRUE,1,75,TRUE,1,68,TRUE,1,64,FALSE,1,75,FALSE,1,91,TRUE,1,65,FALSE,1,75,FALSE,0,57,TRUE,1,96,FALSE,1,70,FALSE,1,80,FALSE,1,75,FALSE,1,100,TRUE,1,76,TRUE,1,75,FALSE,1,95,TRUE,1,76,FALSE,1,91,TRUE,1,89,FALSE,1,56,FALSE,1,92,TRUE,0,60,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.0625,0.0121,0.0016,0.09,0,0,0.0576,0.1296,0,0.0625,0,0.1225,0.1024,0.0625,0.0625,0.5329,0.0025,0.2025,0.0064,0.0081,0.0576,0.3249,0.0625,0.0625,0.09,0.1936,0.0625,0.0841,0.0576,0.04,0.36,0.0081,0.098407143,0.095535714,0.101278571,22,68.75,29,90.63,6,75,7,87.5,8,100,8,100,14,87.5,15,93.75,78,66.75,80.12,76.88,88.25,77.12,78.88,-21.88,-12.63,-8.25,-7.38,-23.12,-11.75,-10.38,-14.87,0,0,0,1,0,1,0,0,1,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,2,0,1,1,1,1,0,1,0,1,0,0,2,1,1,1,0.2,0.6,0.6,0.6,1,0.8,0.4,1,0.5,0.8,2,2,0,0,0,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),71,1,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,-1,-1,0,-2,1,-1,-1,0,0,0,-1,1,0,1,1,-2,0,0,-1,-0.8,-0.2,0.2,-0.4,-0.3 +435,R_1RXvoqs6mVtuc0x,32 - 38,American,Male,2,3,3,3,1,3,1,3,1,2,3,2,3,1,3,-1,-1,1,0,-2,2,3,3,3,1,1,3,2,3,2,1,2,3,2,3,1,3,8,-1,0,0,1,-2,2,2,3,3,3,1,1,3,2,3,1,2,1,3,3,3,2,3,0,1,1,1,2,-2,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,75,FALSE,0,100,TRUE,0,75,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,100,FALSE,0,75,FALSE,0,75,TRUE,1,75,0,0,0,0,0.0625,0.25,0,1,0,0,0.5625,1,0.0625,0.5625,0,0,0,0.25,0,0,1,0.0625,1,1,0.5625,0.5625,0.5625,1,1,1,1,1,0.482142857,0.267857143,0.696428571,25,78.13,17,53.13,4,50,4,50,4,50,5,62.5,11,68.75,6,37.5,90.62,78.12,87.5,100,96.88,92.19,89.06,25,37.49,28.12,37.5,50,34.38,23.44,51.56,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,2,2,0,2,0,0,0.6,0,0.6,0,0.2,0.4,1.2,0.3,0.45,3.67,0.67,0,1,8,-1,3,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,1,1,0,-1,0,-1,0,-2,-1,1,-1,0,0,0.4,-0.4,-0.6,-0.15 +436,R_5L68C81K8u8zCKJ,46 - 52,American,Male,-1,3,2,3,1,1,-3,3,-1,2,3,3,3,1,2,3,2,2,2,3,-1,3,3,3,1,4,2,-3,3,-1,3,2,3,3,3,2,2,2,1,2,2,3,3,4,-1,3,3,3,1,2,3,-3,3,-2,1,1,3,3,3,2,2,5,2,1,2,3,3,4,FALSE,1,70,TRUE,1,65,FALSE,1,94,TRUE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,84,TRUE,1,80,TRUE,1,55,TRUE,1,60,FALSE,1,50,FALSE,1,95,FALSE,0,68,FALSE,1,90,TRUE,1,75,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,1,58,FALSE,1,100,TRUE,1,100,TRUE,1,55,FALSE,1,90,TRUE,1,81,FALSE,1,100,TRUE,1,100,FALSE,1,92,FALSE,1,95,FALSE,1,100,FALSE,0,74,TRUE,1,91,TRUE,1,96,0.04,0,0,0.0256,0.0016,0,0.0361,0.16,0,0.2025,0.5476,0.4624,0.2025,0.25,0.04,0.1225,0.01,0.25,0.0025,0,0,0.0625,0.1764,0.01,0.01,0.0064,0.0081,0.09,0.0036,1,0,0.0025,0.130614286,0.163228571,0.098,20,62.5,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,82.44,67,90.5,82.38,89.88,79,85.88,-25,-5.06,-20.5,3,-5.12,2.38,-8.5,-1.62,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,1,0,0,2,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0.2,0.4,0.2,0.6,0.2,0.8,0.2,0.6,0.35,0.45,2.67,2.67,2,1,-3,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),51,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,-1,0,0,-1,0,0,0,0,0,0,1,-1,0,0,0,0,-0.4,0,0,-0.1 +437,R_3ZF1F4uNVZMZuwx,46 - 52,American,Female,3,2,1,0,2,-3,0,1,2,-1,1,-1,3,0,2,-1,0,0,-1,-1,2,2,1,0,3,2,-2,0,2,2,0,1,1,0,2,1,2,2,0,0,0,0,0,4,2,1,0,0,1,2,-3,0,1,2,0,2,1,0,3,0,2,2,-2,-2,0,-2,-2,5,FALSE,1,50,TRUE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,65,FALSE,1,50,TRUE,1,70,TRUE,1,65,TRUE,1,70,TRUE,1,70,FALSE,1,50,TRUE,0,64,TRUE,1,64,FALSE,1,50,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,70,TRUE,1,70,FALSE,1,70,TRUE,1,65,TRUE,0,60,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,70,TRUE,1,60,FALSE,0,50,TRUE,1,50,0.1225,0.09,0.09,0.09,0.25,0.25,0.1225,0.09,0.25,0.09,0.16,0.1296,0.09,0.25,0.1225,0.25,0.09,0.25,0.25,0.36,0.49,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5625,0.25,0.49,0.4096,0.248453571,0.171042857,0.325864286,10,31.25,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,59.31,52.5,61.12,61.25,62.38,63.06,55.56,-43.75,-15.69,-10,-13.88,-26.25,-12.62,-18.19,-13.19,1,0,0,0,1,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,2,0,1,1,0.4,0.6,0.6,0.6,0.8,0.2,0.2,1,0.55,0.55,1.67,2,0,-1,0,-1,-0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,-1,-1,0,0,1,0,1,0,0,0,0,1,1,0,0,-2,0,0,0,-0.4,0.4,0.4,-0.4,0 +438,R_7Ztgepj79DndxxD,46 - 52,Canadian,Female,3,2,2,2,3,-3,-1,1,-1,2,3,0,2,2,3,-3,-2,-2,-1,-3,3,3,2,-1,3,3,-3,0,1,1,2,2,3,2,2,1,2,4,-2,0,0,-2,-2,6,3,2,2,2,3,1,-3,-1,2,-1,1,2,3,-1,3,0,3,3,-2,-1,0,0,-1,2,FALSE,1,70,TRUE,1,92,FALSE,1,94,TRUE,0,50,TRUE,1,81,FALSE,1,100,TRUE,1,87,TRUE,1,85,TRUE,1,75,TRUE,1,92,FALSE,1,60,TRUE,0,99,TRUE,1,90,FALSE,1,76,TRUE,1,71,TRUE,1,100,TRUE,0,50,TRUE,0,75,FALSE,1,60,FALSE,1,70,FALSE,0,50,TRUE,1,98,FALSE,1,100,TRUE,1,75,FALSE,1,80,TRUE,1,80,TRUE,0,70,FALSE,1,80,FALSE,1,79,FALSE,0,60,FALSE,0,60,TRUE,1,82,0.0225,0.04,0,0.0169,0.0324,0,0.0625,0.0064,0.09,0.0004,0.36,0.01,0.0625,0.16,0.0361,0.0064,0,0.25,0.04,0.04,0.25,0.0841,0.16,0.0576,0.25,0.49,0.36,0.09,0.0036,0.5625,0.0441,0.9801,0.160310714,0.076907143,0.243714286,20,62.5,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,77.84,67.25,79,82.25,82.88,79.88,75.81,-12.5,2.84,4.75,4,-5.25,7.88,-1.37,7.06,0,1,0,3,0,0,1,0,2,0,0,2,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,2,0,1,1,2,1,2,0.8,0.6,0.8,1.4,0,0.4,0.8,1.4,0.9,0.65,3,2,2,0,1,4,1,5 cents,25 minutes,36 days,Female,College Diploma/Certificate,48,1.5,1,0,0,0,0,0,0.33,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,1,0,3,0,0,1,-1,2,-1,0,1,-1,-1,1,0,1,0,0,-1,0.8,0.2,0,0,0.25 +439,R_3Jg6vBxakqFpzJ8,25 - 31,Canadian,Female,1,3,1,-2,2,-3,1,1,-2,-1,-2,0,1,0,0,-2,-3,-3,-2,-3,-1,2,1,-3,2,1,-3,0,0,-2,0,1,-2,-2,2,-2,-1,0,-3,-2,-2,-2,-2,1,1,3,0,-1,2,2,-3,2,1,-2,0,1,-3,-2,2,0,-1,1,-2,0,-2,-2,-3,1,FALSE,1,77,FALSE,0,57,TRUE,0,83,FALSE,1,54,TRUE,1,87,FALSE,1,61,TRUE,1,60,FALSE,0,54,TRUE,1,58,TRUE,1,95,FALSE,1,60,TRUE,0,91,FALSE,0,63,FALSE,1,60,FALSE,0,58,FALSE,0,57,TRUE,0,60,TRUE,0,98,FALSE,1,55,FALSE,1,56,FALSE,0,99,FALSE,0,52,TRUE,0,64,FALSE,0,53,FALSE,1,100,TRUE,1,84,FALSE,1,60,FALSE,1,62,FALSE,1,58,TRUE,1,69,FALSE,0,61,TRUE,1,94,0.2916,0.0256,0.3249,0.16,0.0036,0.1521,0.2809,0.0025,0.1936,0.2704,0.0961,0.3969,0.1764,0.16,0.0169,0.3249,0.4096,0.2116,0.1444,0,0.9801,0.3364,0.2025,0.16,0.36,0.16,0.3721,0.0529,0.6889,0.9604,0.1764,0.8281,0.289917857,0.192535714,0.3873,5,15.63,18,56.25,5,62.5,4,50,6,75,3,37.5,7,43.75,11,68.75,68.75,57.88,73.25,78.25,65.62,68.81,68.69,-40.62,12.5,-4.62,23.25,3.25,28.12,25.06,-0.06,2,1,0,1,0,0,1,1,0,1,0,2,1,2,1,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,2,1,0,1,0,3,1,0,0,0.8,0.6,1.2,0.8,0.4,0.4,1,0.8,0.85,0.65,0.67,1.33,-1,0,-1,0,-0.66,10 cents,75 minutes,36 days,Female,High School (or equivalent),31,-0.25,0,0,0,1,0,0,0,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,2,1,-1,0,0,0,0,1,0,0,-1,0,0,2,0,1,-2,0,0,1,0.4,0.2,0.2,0,0.2 +440,R_3QD3B1WiwQy6b3X,25 - 31,Canadian,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,10,TRUE,0,82,TRUE,1,79,TRUE,0,78,TRUE,0,85,TRUE,1,84,TRUE,0,80,TRUE,1,85,TRUE,1,75,TRUE,1,90,TRUE,1,87,TRUE,0,75,TRUE,0,86,TRUE,1,72,TRUE,0,75,TRUE,1,68,TRUE,1,68,TRUE,0,79,TRUE,0,69,TRUE,0,75,TRUE,0,76,TRUE,1,78,TRUE,1,82,TRUE,0,86,TRUE,1,82,TRUE,0,82,TRUE,1,86,TRUE,0,100,TRUE,0,96,TRUE,0,97,TRUE,1,86,TRUE,1,72,TRUE,1,81,0.0625,0.0196,0.1024,0.0225,0.0361,0.64,0.0324,0.0169,0.5776,0.0324,0.0196,0.0784,0.01,0.5625,0.0256,0.0441,0.7396,0.7225,0.9216,0.6724,0.0484,0.1024,0.5625,0.5625,0.6241,1,0.0784,0.6724,0.6084,0.4761,0.9409,0.7396,0.412407143,0.252692857,0.572121429,21,65.63,16,50,4,50,4,50,4,50,4,50,16,100,0,0,81.12,80.5,82.12,81,80.88,79.69,82.56,15.63,31.12,30.5,32.12,31,30.88,-20.31,82.56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9.33,-1,0,0,0,-0.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +441,R_3geIBUArUehfBct,60 - 66,Canadian,Female,3,3,3,3,3,1,3,2,1,0,0,1,1,0,1,3,2,1,1,1,2,3,2,2,3,8,2,0,1,1,1,5,1,0,2,1,2,8,1,2,1,1,1,3,3,3,3,3,3,1,3,3,3,3,3,0,1,1,2,3,2,8,3,2,2,2,2,9,TRUE,0,85,FALSE,0,90,TRUE,0,85,TRUE,0,80,FALSE,0,82,TRUE,0,80,FALSE,0,84,TRUE,1,90,TRUE,1,73,TRUE,1,98,TRUE,0,91,TRUE,0,85,TRUE,1,82,TRUE,0,76,FALSE,0,84,TRUE,1,87,TRUE,0,79,TRUE,0,79,FALSE,1,87,TRUE,0,82,TRUE,1,72,FALSE,0,73,TRUE,0,75,FALSE,0,78,FALSE,1,100,TRUE,1,77,TRUE,0,75,TRUE,0,80,TRUE,0,81,TRUE,1,82,FALSE,0,82,FALSE,0,86,0.01,0.0529,0.0169,0.7056,0.7396,0.64,0.6084,0.0004,0.6724,0.5329,0.0324,0.0324,0.0729,0.8281,0.6724,0.81,0.5625,0.64,0.64,0,0.0784,0.7056,0.0169,0.5776,0.6241,0.5625,0.6724,0.7225,0.7225,0.6241,0.6561,0.7225,0.506057143,0.488885714,0.523228571,13,40.63,10,31.25,2,25,2,25,3,37.5,3,37.5,8,50,2,12.5,82.5,82.75,79.62,84,83.62,82.5,82.5,9.38,51.25,57.75,54.62,46.5,46.12,32.5,70,1,0,1,1,0,1,3,1,0,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,2,0,1,2,3,1,0,1,3,1,0,0,1,1,1,0.6,1.2,1,0.4,0,1.6,1.2,0.6,0.8,0.85,7,3,7,5,0,-6,4,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,63,0.375,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,1,0,1,1,0,-1,3,0,-2,-2,0,1,0,-2,0,2,0,-1,-1,-1,0.6,-0.4,-0.2,-0.2,-0.05 +442,R_57B2rYAOs6YLNGp,46 - 52,Canadian,Female,2,1,0,-2,1,0,1,1,-2,1,1,-1,3,-1,3,-2,-2,-1,-3,-1,3,2,2,-2,2,3,2,2,1,-1,2,1,1,-2,2,-1,3,2,2,2,2,2,0,7,2,2,1,-2,1,1,0,1,2,-2,2,1,1,-2,3,-2,3,1,0,0,0,-1,0,1,FALSE,1,100,TRUE,1,80,TRUE,0,95,TRUE,0,50,TRUE,1,76,FALSE,1,91,TRUE,1,76,TRUE,1,95,TRUE,1,85,FALSE,0,65,FALSE,1,55,FALSE,1,50,TRUE,1,70,TRUE,0,70,TRUE,1,62,TRUE,1,90,FALSE,1,50,TRUE,0,80,TRUE,0,70,FALSE,1,60,TRUE,1,95,TRUE,1,75,FALSE,1,60,FALSE,0,65,FALSE,1,95,TRUE,1,65,TRUE,0,50,TRUE,0,65,TRUE,0,70,FALSE,0,65,FALSE,0,50,TRUE,1,85,0.0025,0.1225,0.01,0.0576,0.0225,0.0081,0.4225,0.4225,0.16,0.0625,0.4225,0.09,0.0225,0.2025,0.0576,0.04,0.16,0.25,0.4225,0.0025,0.0025,0.1444,0.49,0.49,0.25,0.25,0.25,0,0.9025,0.64,0.49,0.25,0.247414286,0.167371429,0.327457143,21,65.63,20,62.5,4,50,7,87.5,5,62.5,4,50,12,75,8,50,72.19,62.75,74.62,78.25,73.12,74.94,69.44,3.13,9.69,12.75,-12.88,15.75,23.12,-0.06,19.44,1,1,2,0,1,2,1,0,1,1,0,1,1,0,0,4,4,3,5,1,0,1,1,0,0,0,0,1,0,1,0,1,0,1,0,2,2,1,2,1,1,1,0.4,3.4,0.4,0.4,0.4,1.6,1.45,0.7,2,1,2,0,1,6,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),51,1.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,1,0,1,0,1,2,1,-1,1,0,0,0,1,-1,0,2,2,2,3,0,0.6,0.6,0,1.8,0.75 +443,R_6cOXunV51Bjkbjr,60 - 66,American,Male,-1,2,1,0,1,-1,0,0,-1,0,0,-1,2,-1,2,-2,-1,0,0,-1,-1,2,1,-1,1,6,-1,-1,0,-1,1,5,0,-1,1,-1,2,5,-1,-2,-2,-1,-1,4,-1,2,1,1,1,6,-1,-1,1,-1,1,5,0,-1,2,-1,2,5,-2,-2,-1,-1,-1,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,97,FALSE,1,98,TRUE,1,99,TRUE,1,100,TRUE,1,61,TRUE,1,75,TRUE,0,68,FALSE,1,94,FALSE,0,100,FALSE,1,97,FALSE,0,94,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,99,FALSE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,94,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,84,FALSE,1,100,TRUE,0,99,TRUE,1,100,TRUE,1,90,TRUE,1,100,0,0,0,0.0001,0,0.0004,0,0.0625,0,0.0036,0,1,0.1521,0.4624,0.0009,0,0.0036,0.25,0,0,0,0.8836,0.0001,0.0009,0,0.7056,0.01,0,1,0,0.9801,0.0036,0.197121429,0.13825,0.255992857,28,87.5,26,81.25,5,62.5,6,75,8,100,7,87.5,14,87.5,12,75,93.53,80.75,98.5,95.62,99.25,94.38,92.69,6.25,12.28,18.25,23.5,-4.38,11.75,6.88,17.69,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,2,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,1,1,0,0.2,0.4,0.2,1,0.2,0.6,0,0.6,0.45,0.35,5.33,5.33,0,0,0,-1,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),63,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,0,1,0,1,0,0,0,-0.2,0.2,0.4,0.1 +444,R_37Yheba8jAG5I0F,46 - 52,Canadian,Male,2,1,-2,-2,0,-1,-2,2,-1,1,1,0,0,-1,1,1,2,2,1,0,2,2,-2,-2,-1,2,-1,-2,2,-2,1,2,0,0,0,-2,1,2,1,2,1,2,1,3,2,2,-2,-2,0,2,-1,-1,2,-2,0,2,1,0,0,-2,1,2,1,2,2,2,1,1,FALSE,1,100,TRUE,1,100,FALSE,1,81,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,94,TRUE,1,76,TRUE,1,100,FALSE,0,100,TRUE,0,53,TRUE,0,55,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,52,TRUE,0,100,TRUE,0,65,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,51,TRUE,0,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0.0576,0,0,0.0036,0,0,0.3025,1,0,0,1,0,0,0.2809,0,0,0,0.1681,0.2401,0,0,1,0.4225,0,0.2304,0.2401,1,0,0.0361,1,1,0.3025,0.293685714,0.196535714,0.390835714,25,78.13,22,68.75,4,50,7,87.5,6,75,5,62.5,11,68.75,11,68.75,87.25,78.5,94,99.25,77.25,95.31,79.19,9.38,18.5,28.5,6.5,24.25,14.75,26.56,10.44,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,1,0.4,0.2,0.4,0.6,0.2,0.6,0.2,0.4,0.4,0.35,2,2,0,0,0,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,47,0.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,1,0,-1,0,0,-1,1,0,0,0,0,0,0,1,0,0,0.2,-0.4,0.2,0.2,0.05 +445,R_5qQWvPnKhFCaiNv,60 - 66,American,Female,3,3,3,3,-3,-3,-1,-3,1,-1,2,-1,2,0,2,-1,-1,0,-1,-1,3,2,2,3,-3,2,-3,-2,-3,1,-3,2,2,-1,2,0,2,2,1,1,1,0,-1,7,3,2,2,3,-3,2,-3,0,-3,1,-3,5,2,-2,2,-2,2,2,-1,-1,-1,-1,-1,5,TRUE,0,100,TRUE,1,75,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,75,FALSE,1,50,TRUE,1,75,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,0,75,TRUE,0,50,FALSE,1,100,TRUE,1,75,TRUE,1,75,FALSE,1,100,TRUE,1,50,FALSE,1,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,75,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0.0625,0,0,0.25,0,0,0.0625,0,0.0625,0.0625,0.0625,0,0.0625,0,0.25,0,0.0625,0.0625,0.25,0.25,0.25,0.0625,0.25,0.25,1,0,0.5625,0.0625,0.25,0.147321429,0.058035714,0.236607143,8,25,27,84.38,5,62.5,8,100,6,75,8,100,15,93.75,12,75,78.91,59.38,87.5,81.25,87.5,81.25,76.56,-59.38,-5.47,-3.12,-12.5,6.25,-12.5,-12.5,1.56,0,1,1,0,0,0,1,0,0,2,0,0,0,0,0,2,2,1,1,0,0,1,1,0,0,0,1,0,0,2,0,1,0,2,0,0,0,1,0,0,0.4,0.6,0,1.2,0.4,0.6,0.6,0.2,0.55,0.45,2,3,0,-3,0,2,-1,5 cents,5 minutes,47 days,Female,Trade School (non-military),66,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,-1,0,-2,0,2,2,0,1,0,0,0,-0.6,1,0.1 +446,R_1EYu8MtTbarT1nO,46 - 52,American,Female,3,3,3,1,2,3,2,3,3,2,3,3,3,0,3,-3,0,0,0,-3,3,3,3,3,3,2,3,3,3,2,3,1,3,1,3,1,1,6,2,2,2,2,0,10,3,3,3,2,1,4,2,2,3,3,0,4,3,3,3,-1,3,2,-3,-2,-3,-2,-3,10,TRUE,0,100,TRUE,1,100,TRUE,0,93,FALSE,1,57,TRUE,1,100,TRUE,0,85,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,79,TRUE,1,65,TRUE,1,97,FALSE,1,64,TRUE,0,100,TRUE,0,74,FALSE,1,87,TRUE,1,74,TRUE,1,66,FALSE,1,100,FALSE,0,72,FALSE,1,100,FALSE,0,59,FALSE,1,61,FALSE,1,65,TRUE,0,93,TRUE,1,99,FALSE,0,57,TRUE,1,100,0,0.3481,0.0009,0,0,0.7225,0.5184,0,0.0169,0.1156,0.0001,0,0.0064,0.0576,0,0,0,0.1849,0.1225,0,0.0676,0.1225,0.5476,0.6241,0.1296,0.1521,0.3249,1,0.8649,1,0.8649,1,0.301539286,0.115885714,0.487192857,23,71.88,21,65.63,6,75,6,75,4,50,5,62.5,13,81.25,8,50,84.84,72.75,89.5,88,89.12,86.31,83.38,6.25,19.21,-2.25,14.5,38,26.62,5.06,33.38,0,0,0,2,1,0,1,0,1,1,0,2,0,1,2,5,2,2,2,3,0,0,0,1,1,1,0,0,0,2,0,0,0,1,0,0,2,3,2,0,0.6,0.6,1,2.8,0.4,0.6,0.2,1.4,1.25,0.65,3,3.33,-2,-3,4,0,-0.33,10 cents,75 minutes,24 days,Female,University - Undergraduate,52,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,0,-1,1,0,1,-1,0,2,0,0,2,5,0,-1,0,3,0.2,0,0.8,1.4,0.6 +447,R_1FVW9WLvMYgNwug,46 - 52,Canadian,Male,2,2,2,-1,2,2,1,3,-2,2,3,2,2,2,3,1,1,1,1,-1,3,2,1,-1,2,4,3,-1,2,-3,3,4,3,2,2,2,3,1,0,1,1,1,-1,4,2,2,2,1,2,3,2,2,3,3,3,4,2,3,3,2,2,4,-1,0,1,2,0,6,FALSE,1,60,FALSE,0,50,FALSE,1,57,FALSE,1,50,TRUE,1,97,FALSE,1,100,TRUE,1,97,TRUE,1,97,FALSE,0,54,FALSE,0,62,TRUE,0,90,TRUE,0,98,TRUE,1,92,FALSE,1,98,TRUE,1,73,TRUE,1,98,FALSE,1,56,TRUE,0,100,FALSE,1,54,FALSE,1,50,FALSE,0,55,TRUE,1,88,FALSE,1,50,TRUE,1,64,TRUE,0,72,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,85,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0009,0,0.0004,0.0009,0,0,0.1296,0.3844,0.25,0.0144,0,0.0064,0.2916,0.81,0.0009,0.25,0.25,0.25,0.49,0.5184,0.3025,0.0729,0.2116,0.0004,0.1936,0.25,0.25,0.16,0.1849,1,0.7225,0.9604,0.284089286,0.188378571,0.3798,27,84.38,21,65.63,4,50,6,75,5,62.5,6,75,11,68.75,10,62.5,75.53,58.88,79.38,84.62,79.25,79.81,71.25,18.75,9.9,8.88,4.38,22.12,4.25,11.06,8.75,1,0,1,0,0,1,2,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,1,0,5,1,1,1,1,0,1,2,1,0,1,1,0.4,1.2,0,0.2,0.4,1.4,0.8,1,0.45,0.9,3,3.67,1,0,-3,-2,-0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,52,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,0,1,-2,0,1,1,1,-4,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,0,-0.2,-0.8,-0.8,-0.45 +448,R_7GHD4KYhAazV2oh,46 - 52,American,Female,3,3,3,2,3,-2,-2,1,-1,1,2,-1,3,-2,3,2,2,2,2,-1,3,3,3,2,3,4,-1,-2,1,-2,1,3,2,-1,2,-2,3,2,1,2,1,1,1,3,3,3,3,3,3,2,-2,-2,2,-2,1,2,2,-1,3,-2,3,2,2,2,2,2,1,1,TRUE,0,81,TRUE,1,96,TRUE,0,91,FALSE,1,50,TRUE,1,96,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,87,TRUE,1,93,FALSE,1,50,TRUE,0,50,TRUE,1,70,TRUE,0,60,TRUE,1,50,TRUE,1,92,TRUE,0,59,TRUE,0,92,FALSE,1,50,FALSE,1,96,TRUE,1,86,TRUE,1,77,FALSE,1,100,TRUE,1,75,FALSE,1,99,TRUE,1,81,TRUE,0,50,FALSE,1,61,TRUE,0,65,TRUE,1,96,FALSE,0,50,TRUE,1,51,0,0.0361,0.0064,0.0009,0.2401,0,0.0625,0.0049,0.0016,0.0529,0.0016,0.09,0.0169,0.25,0.0016,0.0016,0,0.25,0.1521,0.0001,0.0196,0.25,0.25,0.36,0.3481,0.25,0.25,0.6561,0.8281,0.8464,0.4225,0.25,0.209167857,0.06955,0.348785714,23,71.88,23,71.88,6,75,6,75,5,62.5,6,75,15,93.75,8,50,76.59,60.38,78.38,85,82.62,81.06,72.12,0,4.71,-14.62,3.38,22.5,7.62,-12.69,22.12,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,2,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,0,0.4,0.2,1,0.2,0.4,0,0.4,0.4,0.25,3,2,2,1,0,2,1,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),51,1,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,1,0,-1,0,0,0,0,1,0,0,1,0,1,1,0,-0.2,0,0.2,0.6,0.15 +449,R_5hhEfortNPO7U2k,46 - 52,Canadian,Female,3,1,3,3,3,-2,1,3,0,1,3,0,2,-1,2,-2,0,0,0,-2,3,1,3,3,3,1,1,1,3,1,1,1,3,1,2,1,2,1,-2,-2,-2,-2,-2,4,3,1,3,3,3,1,0,0,2,0,0,1,3,1,2,-2,3,1,1,1,0,-2,-2,1,FALSE,1,55,TRUE,1,77,FALSE,1,81,FALSE,1,51,TRUE,1,59,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,84,TRUE,1,87,FALSE,1,68,TRUE,0,55,TRUE,1,77,FALSE,1,88,FALSE,0,55,TRUE,1,67,FALSE,1,52,TRUE,0,81,TRUE,0,64,FALSE,1,61,FALSE,0,59,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,60,FALSE,1,100,TRUE,0,95,TRUE,1,65,FALSE,0,51,TRUE,1,97,0,0.0625,0.1089,0.0324,0.0009,0,0,0.0169,0.1521,0.0625,0.1225,0.0529,0.0256,0.1024,0.1681,0.0529,0,0.2401,0,0,0.3481,0.3025,0.4096,0.0144,0.2304,0.36,0.2601,0.2025,0.0361,0.6561,0.9025,0.3025,0.179346429,0.071207143,0.287485714,16,50,24,75,4,50,6,75,7,87.5,7,87.5,13,81.25,11,68.75,75.66,63.75,79.88,80.38,78.62,75.62,75.69,-25,0.66,13.75,4.88,-7.12,-8.88,-5.63,6.94,0,0,0,0,0,3,0,0,1,0,0,1,0,2,0,0,2,2,2,0,0,0,0,0,0,2,1,1,0,1,0,1,0,1,1,3,1,0,2,0,0,0.8,0.6,1.2,0,1,0.6,1.2,0.65,0.7,1,1,0,0,0,3,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,46,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,1,-1,0,0,0,1,-1,-3,1,2,0,0,0,-0.2,0,0,-0.05 +450,R_17rJWLnwTMigMBt,60 - 66,Canadian,Male,-2,1,2,-2,-1,-3,-2,1,1,0,1,-1,2,0,3,-2,-1,-1,0,0,-1,1,2,-2,-2,6,-3,-2,1,1,-1,7,1,-1,2,0,3,7,-1,-1,-1,0,0,6,-1,1,2,0,-1,7,-3,-1,1,1,0,8,1,-1,2,-2,3,7,-2,-1,-1,0,-1,6,FALSE,1,95,TRUE,1,69,TRUE,0,61,FALSE,1,72,TRUE,1,58,FALSE,1,58,TRUE,1,66,TRUE,1,75,TRUE,1,67,FALSE,0,69,FALSE,1,54,TRUE,0,64,FALSE,0,50,TRUE,0,96,TRUE,1,62,TRUE,1,100,FALSE,1,95,FALSE,1,85,FALSE,1,55,FALSE,1,57,TRUE,1,98,TRUE,1,67,FALSE,1,60,TRUE,1,92,FALSE,1,76,TRUE,1,98,FALSE,1,84,FALSE,1,86,TRUE,0,96,TRUE,1,100,FALSE,0,60,TRUE,1,96,0.0625,0.0004,0,0.1156,0.0016,0.1764,0.0064,0.4761,0.1849,0.1089,0,0.25,0.1089,0.2116,0.1764,0.0961,0.16,0.0784,0.0196,0.0576,0.0004,0.1444,0.2025,0.9216,0.0025,0.0256,0.36,0.0025,0.3721,0.0225,0.9216,0.4096,0.196364286,0.145407143,0.247321429,25,78.13,25,78.13,7,87.5,6,75,6,75,6,75,13,81.25,12,75,75.66,65.38,76.38,81.5,79.38,76.69,74.62,0,-2.47,-22.12,1.38,6.5,4.38,-4.56,-0.38,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,1,0.4,0.2,0,0.2,0.6,0.2,0.4,0.2,0.2,0.35,6.67,7.33,-1,-1,0,0,-0.66,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),66,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,0,-2,1,0,-1,0,0,1,0,0,0,-2,0,1,0,0,0,-1,-0.2,0,-0.4,0,-0.15 +451,R_7hbkyFIQJB8GlLb,67 - 73,American,Male,2,2,2,-2,2,0,-2,2,-3,-1,2,-2,3,-2,2,0,0,1,1,2,2,2,2,-2,2,0,0,-3,2,-3,-1,0,2,-2,3,-2,2,0,0,0,2,0,2,5,2,2,2,-2,2,0,0,-2,2,-3,-1,0,2,-2,3,-2,2,0,-2,-2,0,2,2,3,FALSE,1,75,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0625,0,0,0.25,0.25,0.0625,0,0,0.25,0,0,0,0.25,0.25,1,0.0625,0.25,0,0.0625,1,0,1,1,0.205357143,0.0625,0.348214286,24,75,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,87.5,62.5,93.75,93.75,100,90.62,84.38,-9.38,3.12,-25,6.25,6.25,25,-9.38,15.63,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,1,0,0,0.2,0,0.4,0,0,0,1.2,0.15,0.3,0,0,0,0,0,2,0,5 cents,5 minutes,47 days,Male,Trade School (non-military),71,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,-2,-2,0,0,0,0,0.2,0,-0.8,-0.15 +452,R_7dENSqRpiTdY0TI,67 - 73,American,Female,2,0,2,0,-2,-1,0,3,-1,2,3,0,3,-3,3,1,1,1,1,-2,3,2,-1,-3,-2,5,-1,-3,3,-3,2,4,3,1,3,2,3,6,-1,1,1,1,-2,5,3,-2,0,3,-3,8,-3,2,0,1,-3,9,3,0,3,-3,3,6,-1,-2,-1,2,-2,8,TRUE,0,90,TRUE,1,100,TRUE,0,64,FALSE,1,52,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,94,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0,0.0064,0,0.0064,0,0,0.2304,0,0,0,0,0,0.0036,0,0,0,0.81,0.4096,0,0.0225,0,0.088889286,0.0888,0.088978571,30,93.75,29,90.63,8,100,8,100,7,87.5,6,75,15,93.75,14,87.5,95.91,93,97.12,98,95.5,99,92.81,3.12,5.28,-7,-2.88,10.5,20.5,5.25,5.31,1,2,3,3,0,0,3,0,2,0,0,1,0,5,0,2,0,0,0,0,1,2,2,3,1,2,2,3,2,5,0,0,0,0,0,2,3,2,1,0,1.8,1,1.2,0.4,1.8,2.8,0,1.6,1.1,1.55,5,7.67,-3,-5,0,-3,-2.67,5 cents,5 minutes,47 days,Female,University - PhD,72,2,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,1,0,-1,-2,1,-3,0,-5,0,1,0,5,0,0,-3,-2,-1,0,0,-1.8,1.2,-1.2,-0.45 +453,R_6lRKWj5nin6dJbr,67 - 73,American,Male,2,2,2,1,0,-2,-1,0,-2,2,1,-1,2,-2,2,0,-1,0,1,-1,2,2,2,-1,0,3,-2,-1,0,-2,1,2,1,0,2,-1,2,3,-1,-1,-1,-1,-1,3,2,2,2,1,0,2,-2,-2,0,-2,1,3,1,-1,2,-1,2,1,0,0,0,0,-1,5,FALSE,1,100,TRUE,1,74,TRUE,0,67,FALSE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,72,TRUE,1,68,TRUE,1,61,TRUE,1,76,FALSE,1,68,FALSE,1,89,FALSE,0,73,FALSE,1,100,FALSE,0,62,TRUE,1,77,FALSE,1,95,FALSE,1,84,TRUE,0,57,FALSE,1,74,TRUE,1,87,TRUE,1,58,FALSE,1,100,TRUE,1,92,FALSE,1,92,TRUE,1,100,TRUE,0,74,TRUE,0,69,TRUE,0,77,TRUE,1,82,TRUE,1,78,TRUE,1,100,0.1024,0,0.0529,0.0784,0,0,0.0064,0.0576,0.0676,0.1764,0.0324,0.5329,0.1521,0.1024,0.16,0.0676,0,0.1444,0.4761,0.0064,0.0169,0.3844,0.3249,0,0.0025,0.5476,0.0484,0,0.4489,0.0256,0.5929,0.0121,0.156660714,0.107128571,0.206192857,20,62.5,25,78.13,5,62.5,6,75,8,100,6,75,14,87.5,11,68.75,79,67,86.5,85.25,77.25,76.25,81.75,-15.63,0.87,4.5,11.5,-14.75,2.25,-11.25,13,0,0,0,2,0,0,0,0,0,1,0,1,0,1,0,1,0,1,2,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0.4,0.2,0.4,0.8,0,0.4,0.2,0.4,0.45,0.25,2.67,2,1,-1,2,-2,0.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,73,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,2,0,0,-1,0,0,0,0,1,0,0,0,1,-1,1,1,0,0.4,-0.2,0.2,0.4,0.2 +454,R_5CBR3UkagBtfDFr,39 - 45,American,Female,3,3,3,1,-1,1,2,3,2,0,3,1,3,3,3,0,0,0,1,-3,2,3,3,3,1,10,-1,3,1,3,-1,4,3,3,-1,-1,2,8,-2,-2,-2,1,-2,8,3,1,3,2,-1,5,-1,0,1,0,-1,7,1,0,1,0,1,4,-1,-1,-1,2,-3,5,TRUE,0,55,TRUE,1,55,TRUE,0,94,FALSE,1,56,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,FALSE,1,54,TRUE,0,100,TRUE,1,64,TRUE,0,84,TRUE,1,54,TRUE,1,53,TRUE,0,65,TRUE,0,100,FALSE,1,53,FALSE,1,53,FALSE,0,54,TRUE,1,54,FALSE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,85,TRUE,0,53,FALSE,1,59,TRUE,0,81,TRUE,1,90,FALSE,0,54,TRUE,1,100,0,0.0225,0.2209,0,0,0,0,0,0.2209,0.2116,0.01,0.1296,0.3025,0.2116,0.0064,0.2025,0.2401,0.1936,0.1681,0,0.2916,0.2116,0.2209,0.7056,0.4225,0.2809,0.2916,0.3025,0.8836,1,0.6561,1,0.291564286,0.123485714,0.459642857,16,50,21,65.63,5,62.5,5,62.5,5,62.5,6,75,13,81.25,8,50,74,54.25,75.88,84.75,81.12,75.62,72.38,-15.63,8.37,-8.25,13.38,22.25,6.12,-5.63,22.38,1,0,0,2,2,2,1,2,1,1,0,2,4,4,1,2,2,2,0,1,0,2,0,1,0,2,2,2,2,1,2,1,2,3,2,1,1,1,1,0,1,1.4,2.2,1.4,0.6,1.8,2,0.8,1.5,1.3,7.33,5.33,5,-3,4,3,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),43,1.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,-2,0,1,2,0,-1,0,-1,0,-2,1,2,1,-1,1,1,1,-1,1,0.4,-0.4,0.2,0.6,0.2 +455,R_5HnHpmaeIsczeAQ,25 - 31,Canadian,Male,1,3,2,3,1,-2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,1,1,1,3,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,6,FALSE,1,68,FALSE,0,51,TRUE,0,51,TRUE,0,50,FALSE,0,51,TRUE,0,51,TRUE,1,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2601,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1024,0.2601,0.25,0.25,0.25,0.246171429,0.252164286,0.240178571,9,28.13,18,56.25,4,50,4,50,7,87.5,3,37.5,8,50,10,62.5,50.69,50.12,50.25,52.25,50.12,50.12,51.25,-28.12,-5.56,0.12,0.25,-35.25,12.62,0.12,-11.25,0,2,1,0,1,2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,1,3,2,3,1,2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,0.8,0.4,1,1.2,2,0.4,1,1.2,0.85,1.15,6.33,7,0,-1,-1,1,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,26,0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,-1,-1,-1,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1.2,0,0,0,-0.3 +456,R_7zLQPsiyRE1oW26,32 - 38,Canadian,Male,2,2,0,2,1,-1,0,1,0,1,0,0,1,0,2,1,1,1,0,1,-2,1,-2,-2,-3,7,-1,2,0,2,0,8,1,1,1,3,-2,7,0,1,1,-1,2,8,2,3,0,3,2,7,1,-2,1,-1,1,8,0,0,2,1,1,7,2,2,3,1,3,8,FALSE,1,100,FALSE,0,70,TRUE,0,89,TRUE,0,65,TRUE,1,100,TRUE,0,67,TRUE,1,74,TRUE,1,85,FALSE,0,63,TRUE,1,71,FALSE,1,58,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,57,TRUE,1,100,TRUE,0,82,TRUE,0,63,TRUE,0,67,FALSE,1,100,TRUE,1,65,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,63,TRUE,0,100,FALSE,1,61,TRUE,0,100,TRUE,1,81,FALSE,0,64,TRUE,1,76,0.0225,0.1369,0,0.0676,0.0576,0.4489,0.0225,0.0841,0,0.01,0.0361,0,0.3969,0.1764,0,0.49,0,0.4225,0.1521,0,0.1225,0.1849,0.4489,0.5625,0.6724,1,0.4096,0,0.7921,0.3969,1,1,0.317389286,0.153214286,0.481564286,16,50,19,59.38,2,25,5,62.5,6,75,6,75,13,81.25,6,37.5,80.34,68,86.25,79.5,87.62,77.75,82.94,-9.38,20.96,43,23.75,4.5,12.62,-3.5,45.44,4,1,2,4,4,0,2,1,2,1,1,1,0,3,4,1,0,0,1,1,0,1,0,1,1,2,2,0,1,0,0,0,1,1,1,1,1,2,1,2,3,1.2,1.8,0.6,0.6,1,0.6,1.4,1.65,0.9,7.33,7.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,38,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,4,0,2,3,3,-2,0,1,1,1,1,1,-1,2,3,0,-1,-2,0,-1,2.4,0.2,1.2,-0.8,0.75 +457,R_3F5r2fdtLitN8uk,53 - 59,American,Male,3,2,2,0,-1,-1,1,2,1,1,2,0,3,-1,3,-3,-3,-2,-2,-3,3,2,2,0,-1,1,-2,3,0,3,0,5,2,0,3,-2,3,3,-3,-3,-2,-3,-3,7,3,1,2,0,-1,2,-2,1,2,2,0,3,2,0,3,-3,3,6,-2,-2,-1,-2,-3,8,TRUE,0,100,TRUE,1,95,FALSE,1,100,FALSE,1,75,FALSE,0,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,1,90,FALSE,1,90,TRUE,1,55,TRUE,1,100,FALSE,1,85,FALSE,1,90,FALSE,1,85,FALSE,1,100,FALSE,0,98,TRUE,1,100,FALSE,1,75,TRUE,1,98,TRUE,0,75,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,95,TRUE,1,90,TRUE,1,85,FALSE,0,85,0,0,0,0,0.7225,0,0.0004,0,0,0,0.01,0.01,0.4225,0.0625,0.7225,0.0025,0.0625,0.0625,0,0.5625,0.9604,0.2025,0.0225,0.01,0.0225,0.5625,0.0225,1,0,0.01,0.9025,0,0.226992857,0.148421429,0.305564286,25,78.13,24,75,6,75,4,50,6,75,8,100,12,75,12,75,89.56,76.25,89.12,94.38,98.5,90.38,88.75,3.13,14.56,1.25,39.12,19.38,-1.5,15.38,13.75,0,0,0,0,0,1,2,2,2,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,0,0,0,2,0,1,1,1,0,0,0,1.6,0.2,0.2,0.2,0.6,0.4,0.6,0.5,0.45,3,3.67,-1,2,-3,-1,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,1.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,-1,0,0,0,0,2,2,1,0,0,0,0,-1,0,-1,-1,-1,1,0,-0.2,1,-0.2,-0.4,0.05 +458,R_1DP6m7WlbOvFoup,60 - 66,Canadian,Female,1,1,2,-2,2,-1,0,2,0,1,1,0,2,-2,3,-2,-1,0,-1,-2,2,2,2,0,2,5,0,1,2,1,0,4,2,-2,2,0,3,5,-3,-2,-2,-2,-2,3,2,2,2,1,2,6,0,1,1,0,1,4,2,-2,2,-2,3,4,-2,-1,0,0,-2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,84,FALSE,1,87,FALSE,0,50,TRUE,1,100,TRUE,1,85,TRUE,1,71,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,58,TRUE,1,81,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,91,TRUE,1,79,TRUE,1,100,0,0,0,0.25,0,0.0169,0,0.0841,0.25,0.0361,0.0081,0,0.0225,0.25,0.0256,0,0,0.25,0,0,0.1764,0.25,0.25,1,0.25,0.25,0.0441,0,1,0.25,1,0.25,0.202278571,0.067378571,0.337178571,25,78.13,22,68.75,4,50,7,87.5,5,62.5,6,75,14,87.5,8,50,79.25,64.25,84.88,81.5,86.38,84.31,74.19,9.38,10.5,14.25,-2.62,19,11.38,-3.19,24.19,1,1,0,2,0,1,1,0,1,1,1,2,0,2,0,1,1,2,1,0,1,1,0,3,0,1,1,1,0,0,1,2,0,0,0,0,0,0,1,0,0.8,0.8,1,1,1,0.6,0.6,0.2,0.9,0.6,4.67,4.67,-1,0,1,2,0,10 cents,25 minutes,15 days,Female,College Diploma/Certificate,61,1.5,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,-1,0,0,0,-1,1,1,0,0,0,2,0,1,1,2,0,0,-0.2,0.2,0.4,0.8,0.3 +459,R_1ar5XFCcTOQEkYV,32 - 38,American,Male,2,3,3,1,2,1,-1,2,-1,0,3,1,1,2,2,2,1,2,3,1,2,1,3,1,2,8,1,0,2,0,2,8,3,2,1,2,1,6,-1,1,1,1,0,9,2,1,2,2,3,5,0,2,1,-1,1,5,1,1,3,2,2,8,3,1,0,1,2,8,TRUE,0,100,FALSE,0,77,TRUE,0,87,FALSE,1,59,TRUE,1,100,TRUE,0,92,TRUE,1,62,FALSE,0,61,TRUE,1,65,FALSE,0,58,TRUE,0,69,TRUE,0,69,FALSE,0,71,TRUE,0,67,FALSE,0,59,TRUE,1,100,TRUE,0,77,FALSE,1,98,FALSE,1,71,FALSE,1,65,TRUE,1,86,FALSE,0,83,FALSE,1,73,TRUE,1,96,FALSE,1,75,TRUE,1,83,FALSE,1,88,TRUE,0,90,FALSE,1,83,TRUE,1,100,FALSE,0,70,TRUE,1,90,0.3721,0.0289,0,0.1444,0.01,0.8464,0.0016,0.3364,0.1225,0.6889,0,0.5041,0.1225,0.4761,0,0.5929,0.0729,0.1681,0.81,0.0625,0.0196,0.3481,0.0841,0.4489,0.5929,0.0144,0.49,1,0.7569,0.0004,0.0289,0.4761,0.324114286,0.2816,0.366628571,16,50,17,53.13,4,50,5,62.5,4,50,4,50,9,56.25,8,50,78.88,69.75,84,78.25,83.5,78.81,78.94,-3.13,25.75,19.75,21.5,28.25,33.5,22.56,28.94,0,2,0,0,0,0,1,0,1,2,0,1,0,0,1,3,0,1,2,1,0,2,1,1,1,1,3,1,0,1,2,0,2,0,0,1,0,2,2,1,0.4,0.8,0.4,1.4,1,1.2,0.8,1.2,0.75,1.05,7.33,6,3,3,-2,1,1.33,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),36,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,-1,-1,-1,-1,-2,-1,1,1,-2,1,-2,0,1,2,0,-1,0,0,-0.6,-0.4,-0.4,0.2,-0.3 +460,R_3ALShty7HyVU7Cj,18 - 24,American,Male,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,1,1,1,1,1,8,1,1,0,1,0,8,1,1,1,1,1,8,0,0,0,0,0,9,1,1,0,0,1,8,0,0,1,1,0,8,TRUE,0,74,TRUE,1,81,TRUE,0,93,TRUE,0,85,TRUE,1,84,TRUE,0,78,TRUE,1,94,TRUE,1,82,FALSE,0,59,FALSE,0,71,FALSE,1,67,TRUE,0,80,FALSE,0,70,TRUE,0,74,FALSE,0,76,TRUE,1,73,TRUE,0,71,FALSE,1,86,TRUE,0,70,TRUE,0,83,TRUE,1,69,TRUE,1,69,TRUE,0,69,TRUE,1,68,TRUE,0,81,TRUE,1,69,TRUE,0,67,TRUE,0,76,TRUE,0,68,TRUE,1,72,TRUE,1,75,TRUE,1,80,0.0324,0.0961,0.0729,0.0036,0.04,0.6084,0.1024,0.5041,0.6889,0.0961,0.0784,0.49,0.3481,0.1089,0.0256,0.0361,0.4761,0.7225,0.5776,0.6561,0.0961,0.5776,0.49,0.5476,0.5041,0.4489,0.0625,0.5476,0.8649,0.0196,0.4624,0.64,0.38645,0.308971429,0.463928571,18,56.25,14,43.75,3,37.5,3,37.5,4,50,4,50,12,75,2,12.5,75.44,72.5,73.62,77.25,78.38,74.5,76.38,12.5,31.69,35,36.12,27.25,28.38,-0.5,63.88,0,0,0,0,1,0,0,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0.2,0.2,1,0.6,0.8,0.2,0.6,0.4,0.5,0.5,8.33,8.33,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,22,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-1,-1,-1,-1,1,0,0,0,0,0,0,0,1,1,0,1,1,-1,0,0,-0.6,0,0.4,0.2,0 +461,R_5RHvl8v1OXQu9uV,46 - 52,Canadian,Male,2,3,3,-1,1,1,-2,2,-1,2,1,-2,2,-2,2,2,1,2,2,2,1,3,2,-3,1,3,2,-2,2,-1,2,3,1,1,2,-2,3,0,2,2,1,2,2,4,2,3,2,2,-1,5,0,0,1,-1,0,4,1,-1,2,-2,2,4,2,2,2,2,2,0,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,0,1,1,1,0.285714286,0,0.571428571,28,87.5,24,75,5,62.5,7,87.5,6,75,6,75,15,93.75,9,56.25,100,100,100,100,100,100,100,12.5,25,37.5,12.5,25,25,6.25,43.75,1,0,1,2,0,1,0,0,0,0,0,3,0,0,1,0,1,1,0,0,0,0,1,3,2,1,2,1,0,2,0,1,0,0,0,0,1,0,0,0,0.8,0.2,0.8,0.4,1.2,1.2,0.2,0.2,0.55,0.7,2,4.33,-2,-1,-4,4,-2.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,48,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,1,0,0,-1,-2,0,-2,-1,0,-2,0,2,0,0,1,0,0,1,0,0,-0.4,-1,0.6,0.2,-0.15 +462,R_1cs6UyRYsp5Jla9,46 - 52,American,Female,0,2,2,1,2,1,-3,3,-2,2,2,2,2,0,3,2,2,2,1,2,-2,2,2,2,2,0,1,-2,2,1,2,0,2,1,3,0,3,0,3,3,3,3,1,10,-1,2,2,2,2,0,2,-2,3,1,2,1,2,2,2,3,3,0,2,2,2,2,2,1,TRUE,0,75,TRUE,1,74,TRUE,0,71,FALSE,1,72,TRUE,1,67,TRUE,0,70,TRUE,1,98,TRUE,1,95,TRUE,1,62,TRUE,1,100,FALSE,1,52,TRUE,0,100,TRUE,1,89,TRUE,0,100,TRUE,1,57,TRUE,1,52,FALSE,1,59,TRUE,0,55,FALSE,1,54,FALSE,1,53,FALSE,0,54,FALSE,0,54,FALSE,1,51,FALSE,0,53,FALSE,1,51,TRUE,1,59,FALSE,1,82,FALSE,1,76,TRUE,0,51,TRUE,1,87,TRUE,1,74,TRUE,1,100,0.0025,0.1681,0.2304,0.0004,0,0.49,0.2809,0,0.2209,0.2916,0.0169,0.0121,0.1444,0.2304,0.1089,0.0676,0.2401,0.0784,0.0576,0.2401,0.2916,0.1849,0.2116,1,0.1681,0.0324,0.0676,0.5625,0.5041,0.3025,0.2601,1,0.252332143,0.155871429,0.348792857,16,50,22,68.75,8,100,5,62.5,4,50,5,62.5,13,81.25,9,56.25,70.22,65.88,67.62,74,73.38,73.44,67,-18.75,1.47,-34.12,5.12,24,10.88,-7.81,10.75,2,0,0,1,0,0,1,1,3,0,0,1,1,0,0,1,1,1,2,1,1,0,0,1,0,1,1,0,3,0,0,0,0,3,0,0,0,0,1,0,0.6,1,0.4,1.2,0.4,1,0.6,0.2,0.8,0.55,0,0.33,0,-1,0,9,-0.33,10 cents,5 minutes,47 days,Female,University - Undergraduate,50,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,1,0,0,0,0,-1,0,1,0,0,0,1,1,-3,0,1,1,1,1,1,0.2,0,-0.2,1,0.25 +463,R_7EhzEr2Y4MmMbh1,18 - 24,Canadian,Male,-2,0,3,1,-3,3,-2,2,-1,0,1,-3,2,2,-2,-2,0,2,-3,1,-3,-1,-1,3,2,6,-2,1,-2,1,3,3,-2,0,3,-2,2,3,-2,2,0,3,0,4,3,-1,1,-2,1,10,0,-2,3,1,2,4,-3,3,2,-1,-2,8,-2,2,3,0,1,5,FALSE,1,65,TRUE,1,87,FALSE,1,70,TRUE,0,93,FALSE,0,83,TRUE,0,70,FALSE,0,91,TRUE,1,69,FALSE,0,80,TRUE,1,60,TRUE,0,91,FALSE,1,69,TRUE,1,80,FALSE,1,65,TRUE,1,60,TRUE,1,80,FALSE,1,84,TRUE,0,93,TRUE,0,71,TRUE,0,87,FALSE,0,64,TRUE,1,90,FALSE,1,82,TRUE,1,64,FALSE,1,63,TRUE,1,87,TRUE,0,54,TRUE,0,91,FALSE,1,57,TRUE,1,82,TRUE,1,64,FALSE,0,58,0.0961,0.0169,0.04,0.8281,0.3364,0.49,0.1296,0.16,0.7569,0.01,0.0324,0.04,0.64,0.8281,0.6889,0.0169,0.0324,0.8649,0.8281,0.1369,0.4096,0.16,0.5041,0.1225,0.0256,0.2916,0.1296,0.1225,0.09,0.8649,0.1849,0.0961,0.321175,0.359035714,0.283314286,26,81.25,19,59.38,3,37.5,4,50,6,75,6,75,11,68.75,8,50,75.12,75,72.25,76.75,76.5,74.94,75.31,21.87,15.74,37.5,22.25,1.75,1.5,6.19,25.31,1,1,4,2,5,5,3,4,2,3,3,3,1,4,4,0,2,2,6,1,5,1,2,3,4,3,0,1,2,2,4,6,0,3,0,0,2,1,3,0,2.6,3.4,3,2.2,3,1.6,2.6,1.2,2.8,2.1,4,7.33,-4,-1,-5,-1,-3.33,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,22,0.5,0,0,0,1,0,0,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-4,0,2,-1,1,2,3,3,0,1,-1,-3,1,1,4,0,0,1,3,1,-0.4,1.8,0.4,1,0.7 +464,R_572QfiahRx8w0ez,46 - 52,American,Male,-2,1,1,-2,1,1,1,2,1,1,-1,-2,3,-2,1,1,1,2,1,1,-2,2,-1,-2,-1,3,2,1,1,1,-1,2,0,-1,3,-2,0,4,-3,-1,-1,1,-2,8,-2,1,-1,-1,2,1,2,-1,2,-1,0,1,-1,0,3,-3,1,2,1,1,1,2,2,3,FALSE,1,50,TRUE,1,60,TRUE,0,60,FALSE,1,50,FALSE,0,50,FALSE,1,65,TRUE,1,80,TRUE,1,85,FALSE,0,50,TRUE,1,55,FALSE,1,75,FALSE,1,65,TRUE,1,90,FALSE,1,65,FALSE,0,50,TRUE,1,100,FALSE,1,59,FALSE,1,50,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,65,FALSE,1,50,TRUE,1,65,FALSE,1,50,TRUE,1,75,TRUE,0,50,FALSE,1,80,TRUE,0,50,TRUE,1,85,TRUE,1,96,TRUE,1,90,0.0225,0.0625,0,0.04,0.01,0.1225,0.1225,0.2025,0,0.1225,0.0225,0.01,0.25,0.0625,0.25,0.16,0.25,0.25,0.04,0.25,0.25,0.25,0.25,0.1225,0.1681,0.25,0.0016,0.25,0.36,0.25,0.25,0.1225,0.166060714,0.131071429,0.20105,20,62.5,24,75,4,50,5,62.5,8,100,7,87.5,12,75,12,75,66.09,60.12,63,61.25,80,71.62,60.56,-12.5,-8.91,10.12,0.5,-38.75,-7.5,-3.38,-14.44,0,1,2,0,2,1,0,1,0,2,1,1,0,0,1,4,2,3,0,3,0,0,2,1,1,1,2,0,2,1,0,2,0,1,0,0,0,1,1,1,1,0.8,0.6,2.4,0.8,1.2,0.6,0.6,1.2,0.8,3,1.33,2,1,2,5,1.67,5 cents,5 minutes,47 days,Male,Trade School (non-military),52,1.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,1,0,-1,1,0,-2,1,-2,1,1,-1,0,-1,1,4,2,2,-1,2,0.2,-0.4,0,1.8,0.4 +465,R_7KvDmDr5mNTxPd2,60 - 66,Canadian,Female,3,2,1,1,1,-1,-1,1,0,1,0,0,2,-2,1,-1,0,-1,-1,-2,1,2,1,0,-2,8,0,0,1,2,-1,4,1,2,-1,0,2,6,-2,-2,-2,-2,0,8,2,3,0,1,2,4,0,-2,2,-1,0,5,0,0,2,-3,2,3,0,0,1,0,0,6,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,71,FALSE,1,93,TRUE,1,82,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,80,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,50,FALSE,1,82,TRUE,0,89,TRUE,1,86,TRUE,1,50,TRUE,1,100,0,0.0625,0,0.0081,0,0,0,0,0,0,0.0196,0.0324,0,0.0841,0,0.0225,0.25,0.25,0.0324,0,0.64,0.25,0.25,1,0.25,0.25,0.25,0,0,1,0.7921,0.0049,0.192071429,0.047042857,0.3371,22,68.75,26,81.25,7,87.5,5,62.5,6,75,8,100,15,93.75,11,68.75,83.88,63.25,81.38,95.75,95.12,87.44,80.31,-12.5,2.63,-24.25,18.88,20.75,-4.88,-6.31,11.56,2,0,0,1,3,1,1,0,2,2,1,2,3,2,1,1,2,1,1,2,1,1,1,0,1,1,1,1,1,1,0,0,0,1,1,1,0,2,1,2,1.2,1.2,1.8,1.4,0.8,1,0.4,1.2,1.4,0.85,6,4,4,-1,3,2,2,5 cents,5 minutes,24 days,Female,University - Undergraduate,66,0.875,1,1,0,0,0,1,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,1,-1,-1,1,2,0,0,-1,1,1,1,2,3,1,0,0,2,-1,0,0,0.4,0.2,1.4,0.2,0.55 +466,R_5MFNOcgzXAWhKb2,32 - 38,American,Female,3,3,3,3,2,0,0,2,1,1,2,3,3,2,3,1,1,1,0,0,2,3,3,3,2,7,0,0,3,3,1,5,3,2,3,3,3,5,1,0,1,0,0,5,3,3,3,3,3,5,1,2,3,1,3,9,3,3,3,2,3,6,3,2,2,2,2,9,TRUE,0,92,FALSE,0,50,FALSE,1,97,TRUE,0,65,TRUE,1,56,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,TRUE,1,76,TRUE,0,86,TRUE,1,50,FALSE,0,50,TRUE,0,81,TRUE,0,55,FALSE,1,50,FALSE,1,50,TRUE,1,57,FALSE,0,50,TRUE,0,84,TRUE,1,66,TRUE,0,50,FALSE,0,50,TRUE,0,69,TRUE,0,63,TRUE,0,55,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.25,0.25,0.25,0,0.25,0.1156,0,0.25,0.25,0,0.0576,0.25,0.0081,0.1936,0.25,0.7056,0.4225,0.3969,0.25,0.1849,0.25,0.25,0.7396,0.6561,0.4761,0.25,0.8464,0.0009,0.3025,0.3025,1,0.309246429,0.196642857,0.42185,7,21.88,14,43.75,3,37.5,5,62.5,1,12.5,5,62.5,9,56.25,5,31.25,66.97,59.38,69.88,66.62,72,62.81,71.12,-21.87,23.22,21.88,7.38,54.12,9.5,6.56,39.87,1,0,0,0,0,0,0,1,2,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,1,2,1,0,2,1,0,0,0,0,2,1,1,2,2,0.2,0.6,0.6,0.2,0.2,1.2,0.2,1.6,0.4,0.8,5.67,6.67,2,-4,-1,-4,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),36,0.5,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,1,0,0,0,-1,-1,-2,0,2,-2,0,1,0,1,0,-2,0,-1,-2,-2,0,-0.6,0.4,-1.4,-0.4 +467,R_1nSHXHHFpEvrozL,25 - 31,Canadian,Female,1,2,0,1,0,-1,0,0,1,0,1,0,2,1,2,-1,-1,-3,-2,-3,-1,2,1,2,3,3,-1,0,0,2,1,3,1,0,0,2,2,3,-1,-1,-2,-1,-3,4,2,2,0,1,1,0,-2,0,0,2,1,2,0,0,2,1,1,0,-1,-1,-2,-1,-3,5,TRUE,0,50,TRUE,1,50,TRUE,0,69,FALSE,1,74,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,1,99,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,76,TRUE,1,73,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,79,FALSE,1,50,TRUE,0,50,FALSE,0,95,TRUE,1,69,FALSE,1,98,TRUE,1,92,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,0,59,FALSE,0,75,FALSE,0,50,FALSE,0,74,0.0001,0,0,0.0001,0.5476,0.25,0.0064,0.25,0.25,0.0961,0.5625,0.0729,0.25,0.25,0,0.25,0.0004,0.0676,0.25,0,0.9025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.4761,0.6241,0.3481,0.5776,0.277925,0.203821429,0.352028571,16,50,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,10,62.5,8,50,69.72,53,74.88,74.62,76.38,76.62,62.81,-6.25,13.47,-9.5,12.38,12.12,38.88,14.12,12.81,2,0,1,1,3,0,0,0,1,1,0,0,2,1,0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,1,1,0,1.4,0.4,0.6,0.4,0.4,0.6,0.4,0.4,0.7,0.45,3,0.67,3,1,3,-1,2.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),29,0.125,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,0,1,1,2,-1,0,0,0,0,-1,0,2,1,-1,0,0,0,0,0,1,-0.2,0.2,0,0.25 +468,R_7mnrQ0GlaUV2Mkj,53 - 59,Canadian,Male,1,1,3,1,2,1,-3,1,-1,1,1,1,1,0,2,1,1,1,1,1,2,1,3,1,3,4,1,-2,1,-2,1,2,1,1,2,0,2,1,-1,-1,-1,-1,-1,9,1,1,3,1,1,2,1,-3,1,-2,1,2,1,1,2,0,2,2,1,3,3,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,52,FALSE,0,56,FALSE,1,60,TRUE,1,76,TRUE,1,88,FALSE,0,61,FALSE,0,58,FALSE,1,58,TRUE,0,100,TRUE,1,83,FALSE,1,64,FALSE,0,63,TRUE,1,56,TRUE,0,60,FALSE,1,59,TRUE,0,85,TRUE,0,85,FALSE,0,64,TRUE,1,87,TRUE,0,64,TRUE,1,87,TRUE,0,65,TRUE,1,72,TRUE,0,76,TRUE,0,73,TRUE,0,75,TRUE,1,92,TRUE,1,57,TRUE,1,90,0.0144,0.0784,0.1936,0.0576,0.01,0.16,0.0169,0.3364,0.7225,0.0169,0.0064,0.0289,0.3721,0.1764,0.3136,0,0.4096,0.2304,0.5329,0.4225,0.4096,0.3969,0.7225,0.1296,0.36,0.5776,0.1849,1,1,0.1681,0.5625,1,0.366685714,0.200007143,0.533364286,25,78.13,16,50,4,50,3,37.5,5,62.5,4,50,11,68.75,5,31.25,73.94,69,69,72.62,85.12,74.38,73.5,28.13,23.94,19,31.5,10.12,35.12,5.63,42.25,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,2,2,2,2,2,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,2,1,1,0.4,0.4,0.2,2,0.2,0.2,0.2,1.2,0.75,0.45,2.33,2,2,0,-1,7,0.33,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,57,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0.2,0.2,0,0.8,0.3 +469,R_11PSrb2DfJaoQKt,46 - 52,Canadian,Female,3,3,0,-2,2,-1,1,2,3,1,3,1,3,0,3,-3,-3,-3,-3,-3,3,3,0,-1,2,5,1,0,0,0,0,5,3,0,3,0,3,5,1,1,1,-3,1,9,3,3,0,0,2,5,0,0,3,0,0,5,3,0,3,0,3,5,0,0,-1,0,-3,5,FALSE,1,69,TRUE,1,100,FALSE,1,50,FALSE,1,80,FALSE,0,78,FALSE,1,89,TRUE,1,97,TRUE,1,100,FALSE,0,79,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,94,TRUE,0,98,FALSE,0,77,TRUE,1,96,TRUE,0,78,FALSE,1,84,TRUE,0,78,TRUE,0,71,FALSE,0,71,TRUE,1,82,TRUE,0,79,FALSE,0,75,TRUE,0,100,TRUE,1,82,FALSE,1,66,FALSE,1,94,TRUE,0,85,TRUE,1,83,FALSE,0,77,TRUE,1,98,0,0.0324,0.0016,0.0009,0.0004,0.0121,0.5625,0,0.5041,0.0324,0.0289,0.0036,0.6241,0.0324,0.6084,0,0.6241,0.04,0.0036,1,0.5041,0.5929,0.6084,0.9604,0.6084,0.1156,0.5929,0.0961,0.25,0.0256,0.7225,1,0.362625,0.2195,0.50575,17,53.13,18,56.25,4,50,3,37.5,6,75,5,62.5,10,62.5,8,50,84.12,79.88,84,89,83.62,86.81,81.44,-3.12,27.87,29.88,46.5,14,21.12,24.31,31.44,0,0,0,1,0,2,1,2,3,1,0,1,0,0,0,4,4,4,0,4,0,0,0,2,0,1,1,1,3,1,0,1,0,0,0,3,3,2,3,0,0.2,1.8,0.2,3.2,0.4,1.4,0.2,2.2,1.35,1.05,5,5,0,0,0,4,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,46,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,-1,0,1,0,1,0,0,0,0,0,0,0,1,1,2,-3,4,-0.2,0.4,0,1,0.3 +470,R_3LimH14pa2AtjvZ,46 - 52,Canadian,Female,3,3,-3,-2,3,1,-1,2,-2,2,3,1,3,-1,3,2,2,3,2,3,3,3,-3,-3,3,2,1,-1,2,-2,3,2,3,2,3,-1,3,2,2,2,3,2,3,2,3,3,-3,-1,3,2,1,-1,2,-2,2,2,3,2,3,-3,3,2,2,0,3,2,3,2,FALSE,1,100,TRUE,1,54,FALSE,1,100,FALSE,1,50,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,54,TRUE,1,75,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,58,FALSE,0,74,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,52,TRUE,1,100,TRUE,1,57,FALSE,1,54,TRUE,1,100,FALSE,1,54,TRUE,1,82,TRUE,0,58,FALSE,1,64,TRUE,0,54,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.0324,0.5476,0,0,0,0,0.0625,0.2304,0.1849,0,1,0.2916,0,0.0169,0.2116,0.2116,0.25,0.1296,0.2116,0,0.1764,1,1,0,0.3364,1,0,0,1,0.2916,1,0.307325,0.175678571,0.438971429,20,62.5,22,68.75,4,50,6,75,6,75,6,75,12,75,10,62.5,82.09,71.75,86.88,83.5,86.25,83.81,80.38,-6.25,13.34,21.75,11.88,8.5,11.25,8.81,17.88,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,2,0,0,0,0.2,0.2,0.2,0,0.2,0,0.6,0.4,0.15,0.3,2,2,0,0,0,0,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,49,0.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,1,0,0,0,-2,0,0,-2,0,0,0,0,0.2,-0.4,-0.4,-0.15 +471,R_3N3mzNU5d4yDSl5,32 - 38,Canadian,Female,3,3,3,3,3,3,-3,3,-3,3,1,3,2,2,3,3,3,3,3,2,1,3,2,-2,-1,9,2,-3,0,-3,3,8,1,-2,1,2,0,8,-3,-1,-1,-3,2,8,1,2,2,2,1,5,3,-3,3,-3,3,4,1,2,3,3,2,0,3,2,3,1,3,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.142857143,0.142857143,0.142857143,32,100,28,87.5,8,100,7,87.5,8,100,5,62.5,15,93.75,13,81.25,100,100,100,100,100,100,100,12.5,12.5,0,12.5,0,37.5,6.25,18.75,2,0,1,5,4,1,0,3,0,0,0,5,1,0,3,6,4,4,6,0,2,1,1,1,2,0,0,0,0,0,0,1,1,1,1,0,1,0,2,1,2.4,0.8,1.8,4,1.4,0,0.8,0.8,2.25,0.75,8.33,3,4,4,8,4,5.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,32,1.25,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,-1,0,4,2,1,0,3,0,0,0,4,0,-1,2,6,3,4,4,-1,1,0.8,1,3.2,1.5 +472,R_1lFXPYGgftyjMmR,46 - 52,Canadian,Male,1,2,2,-2,2,0,0,3,-3,1,0,-3,3,0,3,2,2,2,2,2,0,2,2,-3,2,3,0,1,3,-3,2,4,0,-3,3,1,3,2,2,2,2,2,2,2,1,2,2,0,3,2,0,0,3,-3,1,2,0,-3,3,1,3,2,2,2,2,2,2,2,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,54,TRUE,1,100,TRUE,1,84,FALSE,0,61,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,71,TRUE,1,78,TRUE,1,100,TRUE,0,91,TRUE,0,100,FALSE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,79,TRUE,1,87,TRUE,0,84,FALSE,1,96,TRUE,0,86,TRUE,1,100,TRUE,1,100,TRUE,1,86,0.0256,0.0169,0,0,0.0196,0.2116,0,0,0,0,0,0,0.3721,0,0.25,0.25,0.5625,0.25,0.0016,0.6241,0,0.0484,0.0025,0.0841,0.8281,0.7056,0,1,1,1,0.7396,1,0.319635714,0.136842857,0.502428571,25,78.13,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,86.78,77.25,80.25,92.12,97.5,87.25,86.31,12.5,21.15,14.75,17.75,29.62,22.5,-0.25,42.56,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.4,0.4,0.2,0,0.6,0,0.2,0,0.25,0.2,3,2,1,2,0,0,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,1.75,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,0,0,-1,-1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,-0.2,0.4,0,0,0.05 +473,R_6zcFZItVldhRnQz,32 - 38,American,Male,-1,0,1,1,-1,0,0,2,0,1,2,3,1,0,0,-3,-2,-2,-3,-3,-1,0,1,1,0,0,0,0,-1,1,1,5,2,3,1,0,0,2,-3,-3,-3,-3,-3,4,-1,0,1,1,-1,0,0,0,2,0,1,0,2,3,1,0,0,0,0,0,0,0,0,5,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,75,TRUE,1,50,TRUE,1,50,TRUE,1,95,FALSE,1,75,FALSE,1,50,TRUE,1,60,FALSE,1,75,TRUE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,60,TRUE,0,60,TRUE,1,60,FALSE,1,75,TRUE,1,95,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,1,95,0.25,0.0025,0.0025,0.0625,0.0025,0.25,0.16,0.0025,0.25,0.16,0.0625,0.16,0.25,0.0625,0.25,0.25,0.36,0.25,0.25,0.0625,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.199821429,0.176428571,0.223214286,16,50,24,75,6,75,4,50,7,87.5,7,87.5,13,81.25,11,68.75,60.78,53.12,58.12,71.88,60,66.25,55.31,-25,-14.22,-21.88,8.12,-15.62,-27.5,-15,-13.44,0,0,0,0,1,0,0,3,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,2,3,3,0.2,0.8,0,0.4,0,0,0,2.6,0.35,0.65,2.33,0,0,5,2,-1,2.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,1,0,0,3,1,0,0,0,0,0,0,-3,-1,-1,-3,-3,0.2,0.8,0,-2.2,-0.3 +474,R_6KL8A5jQBqTMmlP,46 - 52,American,Female,2,1,2,0,1,-2,0,1,0,0,0,0,2,-1,-2,-2,0,1,0,-2,2,2,2,0,2,5,-3,-2,0,-1,0,5,-1,0,0,0,-3,5,0,0,-2,0,0,5,2,1,2,0,0,5,-3,-2,0,-2,0,5,-2,-1,2,-2,0,5,0,0,0,0,-2,5,TRUE,0,98,FALSE,0,66,FALSE,1,91,FALSE,1,55,TRUE,1,95,FALSE,1,98,TRUE,1,94,TRUE,1,97,FALSE,0,58,TRUE,1,96,FALSE,1,54,TRUE,0,93,TRUE,1,88,TRUE,0,98,FALSE,0,69,TRUE,1,77,FALSE,1,66,FALSE,1,75,FALSE,1,82,FALSE,1,50,FALSE,0,90,FALSE,0,86,FALSE,1,100,TRUE,1,96,FALSE,1,50,TRUE,1,97,FALSE,1,50,FALSE,1,50,TRUE,0,94,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0009,0.0009,0.0529,0.0036,0,0.0004,0.0016,0.0016,0.25,0.7396,0.25,0.0144,0.3364,0.2116,0.0025,0.4356,0,0.2025,0.25,0.25,0.81,0.4761,0.0324,0.9604,0.1156,0.25,0.25,0.9604,0.0081,0.0625,0.8836,0.8649,0.307864286,0.174728571,0.441,25,78.13,21,65.63,4,50,6,75,5,62.5,6,75,9,56.25,12,75,78.53,60.5,91.38,86.75,75.5,81.81,75.25,12.5,12.9,10.5,16.38,24.25,0.5,25.56,0.25,0,1,0,0,1,1,2,1,1,0,1,0,2,1,1,2,0,3,0,2,0,0,0,0,1,1,2,1,2,0,2,1,0,1,2,2,0,1,0,0,0.4,1,1,1.4,0.2,1.2,1.2,0.6,0.95,0.8,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,51,0.875,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,1,0,0,0,0,0,0,-1,0,-1,-1,2,0,-1,0,0,2,0,2,0.2,-0.2,-0.2,0.8,0.15 +475,R_6KUCD6O2Ur15fd7,46 - 52,American,Female,3,2,2,-1,3,1,-2,2,2,1,3,3,2,-2,3,2,2,2,3,2,2,2,1,-3,3,4,1,-3,3,2,2,5,3,3,2,-2,3,0,2,2,2,2,2,5,2,2,2,1,3,5,2,-3,2,1,2,5,3,3,3,-2,3,3,2,2,2,3,2,5,FALSE,1,82,TRUE,1,98,FALSE,1,84,TRUE,0,58,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,1,87,FALSE,0,77,TRUE,1,100,FALSE,1,75,TRUE,0,97,FALSE,0,70,FALSE,1,88,TRUE,1,91,TRUE,1,93,FALSE,1,75,TRUE,0,93,FALSE,1,96,FALSE,1,88,FALSE,0,82,TRUE,1,96,TRUE,0,80,TRUE,1,86,FALSE,1,78,TRUE,1,82,FALSE,1,89,FALSE,1,78,TRUE,0,94,TRUE,1,95,TRUE,1,90,TRUE,1,84,0.0169,0.0324,0.0049,0.0016,0.0256,0,0.0196,0,0.0144,0.0016,0.0025,0.49,0.5929,0.0625,0.0025,0.0004,0.64,0.3364,0.0484,0.0484,0.6724,0.0081,0.0016,0.0144,0.0625,0.0121,0.01,0.0324,0.0256,0.8649,0.8836,0.9409,0.207632143,0.156314286,0.25895,21,65.63,24,75,6,75,4,50,7,87.5,7,87.5,13,81.25,11,68.75,86.78,84.25,85,89.38,88.5,88.88,84.69,-9.37,11.78,9.25,35,1.88,1,7.63,15.94,1,0,1,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0.8,0.6,0,0.2,0.6,0.8,0.2,0,0.4,0.4,3,4.33,-1,0,-3,0,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,1,0,0,-1,0,1,-1,0,0,0,-1,0,0,0,0,0,1,0,0.2,-0.2,-0.2,0.2,0 +476,R_6NTYh5c7onoo8gK,60 - 66,American,Female,3,2,-2,0,-2,-1,-1,1,1,0,1,-2,3,-3,3,-1,1,1,-2,-2,3,2,-2,0,-3,2,-3,-3,0,2,0,1,1,-2,3,-3,3,1,-1,1,1,-2,-2,1,3,2,-2,0,-1,2,-2,-2,0,2,0,2,1,-2,3,-3,3,2,-1,-1,0,-2,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,90,TRUE,1,100,TRUE,1,50,TRUE,1,90,FALSE,1,75,TRUE,0,75,FALSE,0,75,FALSE,1,95,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,0,75,TRUE,0,50,FALSE,1,75,FALSE,0,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,FALSE,1,50,FALSE,0,50,TRUE,0,75,FALSE,1,75,TRUE,0,75,TRUE,1,50,TRUE,1,75,FALSE,0,90,0,0.25,0,0.01,0.81,0.25,0.0625,0.01,0.0625,0.0625,0.25,0.5625,0.25,0.0625,0,0,0,0.25,0.0625,0.25,0.25,0.25,0.25,0.0025,0.0625,0.5625,0.0625,0,0,0.5625,0.5625,0.5625,0.216875,0.188035714,0.245714286,16,50,21,65.63,4,50,4,50,6,75,7,87.5,11,68.75,10,62.5,75.47,65.62,76.88,78.12,81.25,76.25,74.69,-15.63,9.84,15.62,26.88,3.12,-6.25,7.5,12.19,0,0,0,0,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,2,1,0,1,0.2,1.2,0,0,0.2,0.8,0,0.8,0.35,0.45,1.33,2,0,-1,-1,-4,-0.67,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),61,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,-2,-1,0,-1,0,0.4,0,-0.8,-0.1 +477,R_6zAqowkNLFILVl3,67 - 73,American,Female,3,2,1,3,3,1,-3,1,-3,1,1,2,3,-2,2,-2,-2,-2,1,-2,3,3,3,3,3,5,2,-3,1,-3,2,5,1,3,2,-1,3,5,-2,-2,-2,-2,-2,5,3,3,0,3,3,5,2,-3,1,-3,2,5,1,3,3,-2,2,5,0,0,0,0,0,5,TRUE,0,80,TRUE,1,85,FALSE,1,100,TRUE,0,50,TRUE,1,80,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,80,FALSE,1,50,FALSE,0,100,TRUE,0,81,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,80,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,1,90,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,80,TRUE,1,100,0,0.01,0,0,0,0.25,0,0.25,0,0.25,0,1,0.25,0.64,0.04,0.0225,0,0.25,0,0.64,0.25,0.25,0.64,0.6561,0.25,0.25,0.04,0.64,0,1,0,0.25,0.279235714,0.210892857,0.347578571,25,78.13,21,65.63,5,62.5,6,75,2,25,8,100,12,75,9,56.25,79.25,65.62,78.75,78.88,93.75,80.31,78.19,12.5,13.62,3.12,3.75,53.88,-6.25,5.31,21.94,0,1,2,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,3,0,0,1,1,0,0,1,0,0,0,1,0,1,0,0,0,2,2,2,1,2,0.6,0.4,0.8,0.6,0.4,0.4,0.2,1.8,0.6,0.7,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,71,1.125,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,-2,-2,-2,2,-2,0.2,0,0.6,-1.2,-0.1 +478,R_6QFnQ6N0jk3RNgP,60 - 66,Canadian,Male,-3,3,2,1,3,2,-2,3,-2,3,1,2,2,1,0,2,3,3,2,0,-3,3,1,-2,3,7,2,-2,2,-2,2,5,1,-2,2,1,1,6,1,2,2,2,2,7,-3,3,2,2,3,7,0,0,1,2,0,5,1,2,1,1,0,6,2,2,2,1,2,8,TRUE,0,92,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,82,FALSE,1,78,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,79,FALSE,0,78,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,FALSE,1,62,FALSE,0,94,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0,0,0,0.25,0.0484,0.25,0,0.1444,0,0,0,0.3025,1,0.0324,0,0.25,0.5625,1,1,0.8836,0.6084,1,0.0441,0.25,0.25,0.25,0.8464,1,1,0.25,1,0.436525,0.202871429,0.670178571,23,71.88,17,53.13,2,25,6,75,5,62.5,4,50,10,62.5,7,43.75,82.66,76,69.25,96.38,89,84.94,80.38,18.75,29.53,51,-5.75,33.88,39,22.44,36.63,0,0,1,3,0,0,0,1,0,1,0,4,0,0,1,1,1,1,0,2,0,0,0,1,0,2,2,2,4,3,0,0,1,0,0,0,1,1,1,2,0.8,0.4,1,1,0.2,2.6,0.2,1,0.8,1,6,6,0,0,0,-1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,63,0.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,1,2,0,-2,-2,-1,-4,-2,0,4,-1,0,1,1,0,0,-1,0,0.6,-2.2,0.8,0,-0.2 +479,R_6c2EeRUiwhKfUjU,60 - 66,Canadian,Male,2,2,2,-1,1,-1,-1,1,1,-2,1,1,3,1,2,1,1,2,2,0,2,1,3,2,-2,9,2,2,2,1,1,9,2,1,1,2,1,9,1,1,2,1,2,9,2,1,2,2,3,9,2,1,1,2,1,9,2,1,1,1,2,8,2,2,2,3,1,9,TRUE,0,91,FALSE,0,94,TRUE,0,98,FALSE,1,88,FALSE,0,61,FALSE,1,97,TRUE,1,96,TRUE,1,97,FALSE,0,58,FALSE,0,62,FALSE,1,61,TRUE,0,95,TRUE,1,94,FALSE,1,66,FALSE,0,62,TRUE,1,97,TRUE,0,94,TRUE,0,97,FALSE,1,67,FALSE,1,92,FALSE,0,64,FALSE,0,64,FALSE,1,61,TRUE,1,81,TRUE,0,94,TRUE,1,66,FALSE,1,64,TRUE,0,95,TRUE,0,91,TRUE,1,95,FALSE,0,63,FALSE,0,67,0.0009,0.1156,0.0009,0.0016,0.4489,0.0009,0.0361,0.3844,0.0064,0.4096,0.0025,0.0036,0.3364,0.1521,0.3721,0.8836,0.1521,0.0144,0.9025,0.8836,0.4096,0.3844,0.1089,0.1156,0.8836,0.1296,0.3969,0.8281,0.9604,0.9409,0.8281,0.9025,0.424207143,0.228792857,0.619621429,25,78.13,15,46.88,4,50,3,37.5,3,37.5,5,62.5,7,43.75,8,50,80.38,69.62,78.62,79.5,93.75,76.31,84.44,31.25,33.5,19.62,41.12,42,31.25,32.56,34.44,0,1,1,3,3,3,3,1,0,3,1,0,2,1,1,0,0,0,1,2,0,1,0,3,2,3,2,0,1,3,1,0,2,0,0,1,1,0,1,1,1.6,2,1,0.6,1.2,1.8,0.6,0.8,1.3,1.1,9,8.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,62,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,1,0,1,0,1,1,-1,0,0,0,0,1,1,-1,-1,0,0,1,0.4,0.2,0.4,-0.2,0.2 +480,R_1iR7JvUF5ip9eOn,60 - 66,Canadian,Male,3,1,3,1,3,0,0,1,0,0,0,0,0,0,0,-3,-2,-2,-1,-3,1,1,1,-1,1,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,0,TRUE,0,99,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0.25,1,1,1,0.5776,1,0.9801,1,1,1,1,0.493132143,0.285714286,0.70055,30,93.75,18,56.25,3,37.5,5,62.5,5,62.5,5,62.5,15,93.75,3,18.75,97.66,90.75,100,99.88,100,96.88,98.44,37.5,41.41,53.25,37.5,37.38,37.5,3.13,79.69,2,0,2,2,2,0,0,1,0,0,0,0,0,0,0,3,2,2,1,3,3,1,3,1,3,0,0,1,0,0,0,0,0,0,0,3,2,2,1,3,1.6,0.2,0,2.2,2.2,0.2,0,2.2,1,1.15,5,5.33,0,-1,0,5,-0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,60,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-1,-1,-1,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.6,0,0,0,-0.15 +481,R_38Sz1L5x6DzjiHA,60 - 66,American,Male,2,2,2,1,0,1,1,2,1,1,0,1,2,-1,2,-2,-2,-2,3,-2,2,2,2,1,1,2,-2,1,2,1,0,4,-1,2,2,-2,2,2,-2,-2,-2,3,-2,2,2,2,2,1,0,2,1,1,2,1,1,2,-1,1,2,-2,2,2,-2,0,0,2,-2,2,FALSE,1,50,TRUE,1,90,TRUE,0,98,FALSE,1,77,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,93,TRUE,1,76,TRUE,1,100,TRUE,0,97,TRUE,0,100,TRUE,1,99,TRUE,0,98,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,96,FALSE,1,76,TRUE,1,100,TRUE,1,100,FALSE,1,97,TRUE,1,92,TRUE,0,75,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0.0049,0,0,0,0,0,0.0064,0,0.0576,0,0,0.0001,0.0576,0.9409,0.0064,0.01,0.0009,0.0529,1,0.5625,0,0.0576,0.9216,0.9604,0,0.5625,0.0324,0.25,0.9604,1,1,1,0.33715,0.080914286,0.593385714,24,75,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,16,100,6,37.5,91.84,83.62,98.5,90.38,94.88,93.75,89.94,6.25,23.09,21.12,11,27.88,32.38,-6.25,52.44,0,0,0,0,1,3,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,2,2,1,0,0.2,0.8,0.6,0,0,0,0.4,1,0.4,0.35,2.67,2,0,2,0,0,0.67,10 cents,5 minutes,24 days,Male,High School (or equivalent),66,0.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,1,3,0,0,0,1,0,1,0,0,0,0,-2,-2,-1,0,0.2,0.8,0.2,-1,0.05 +482,R_3wEUroxBZQ4qxNG,53 - 59,Canadian,Male,1,1,1,1,1,-1,1,2,2,0,2,1,2,2,0,1,1,1,1,1,1,1,1,1,1,5,-1,1,2,2,1,5,1,1,1,0,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,69,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,80,TRUE,1,100,0,0,0,0,0,0,0,0,0,1,0,0,0.0625,1,0,1,0,0.5476,0,0,1,0,0.4761,0,0,0.25,0.04,1,1,0,0.8649,1,0.330039286,0.257864286,0.402214286,26,81.25,21,65.63,3,37.5,6,75,6,75,6,75,13,81.25,8,50,95.03,81,99.12,100,100,97.19,92.88,15.62,29.4,43.5,24.12,25,25,15.94,42.88,0,0,0,0,0,0,0,0,0,1,1,0,1,2,1,0,0,0,0,0,0,0,0,0,0,2,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0.2,1,0,0,1,0.8,0,0.3,0.45,5,5,0,0,0,0,0,15 cents,100 minutes,36 days,Male,University - Undergraduate,55,0.125,0,0,0,0,1,0,0,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,-2,0,-1,-1,0,0,0,0,1,0,0,0,0,0,0,0,-0.8,0.2,0,-0.15 +483,R_7GUCMjzxXfZ7UvT,60 - 66,Canadian,Male,-3,2,3,-3,1,-1,-3,3,-2,-1,2,-2,3,-3,3,1,2,3,2,-1,-3,3,2,-3,1,3,1,-1,3,-1,1,2,1,-2,1,-1,3,2,1,1,1,1,-1,4,-2,2,2,-2,2,1,-1,-2,2,-2,1,3,2,-2,2,-3,3,1,1,1,2,2,-1,3,TRUE,0,76,TRUE,1,97,TRUE,0,96,TRUE,0,50,TRUE,1,86,FALSE,1,64,TRUE,1,97,TRUE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,59,TRUE,0,100,TRUE,1,98,TRUE,0,100,TRUE,1,60,TRUE,1,98,TRUE,0,50,TRUE,0,59,TRUE,0,60,FALSE,1,50,TRUE,1,55,TRUE,1,93,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,59,FALSE,1,50,TRUE,1,91,TRUE,1,92,TRUE,1,100,0,0,0.0004,0.0009,0,0.1296,0,0,0.25,0.0049,0.0081,0.0004,0.0081,0.1681,0.0196,0.0009,0.25,0.25,0.1681,0,0.2025,0.16,0.36,1,0.25,0.25,0.0064,0.5776,0.9216,0.3481,0.25,1,0.235142857,0.077835714,0.39245,26,81.25,22,68.75,5,62.5,6,75,5,62.5,6,75,16,100,6,37.5,79.09,69.88,69.12,90.62,86.75,91.12,67.06,12.5,10.34,7.38,-5.88,28.12,11.75,-8.88,29.56,0,1,1,0,0,2,2,0,1,2,1,0,2,2,0,0,1,2,1,0,1,0,1,1,1,0,1,1,0,2,0,0,1,0,0,0,1,1,0,0,0.4,1.4,1,0.8,0.8,0.8,0.2,0.4,0.9,0.55,2.33,1.67,2,-1,1,1,0.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,62,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,1,0,-1,-1,2,1,-1,1,0,1,0,1,2,0,0,0,1,1,0,-0.4,0.6,0.8,0.4,0.35 +484,R_5bx13hGQXN0QbyF,60 - 66,Canadian,Female,2,3,2,-1,1,-2,-2,2,0,-1,1,1,0,-2,1,2,2,2,3,1,2,3,2,-1,1,3,-2,-2,2,0,0,2,2,1,0,1,1,4,1,1,0,1,1,3,3,3,2,-1,-1,3,-3,-2,2,-1,-2,1,2,1,0,-2,1,1,1,1,2,2,2,3,FALSE,1,69,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,88,FALSE,1,89,TRUE,1,95,TRUE,1,98,TRUE,1,59,TRUE,1,88,FALSE,1,58,FALSE,1,59,FALSE,0,67,TRUE,0,90,TRUE,1,50,TRUE,1,99,FALSE,1,61,TRUE,0,88,FALSE,1,61,FALSE,1,71,FALSE,0,94,TRUE,1,69,FALSE,1,87,TRUE,1,87,TRUE,0,62,TRUE,1,66,TRUE,0,64,FALSE,1,89,TRUE,0,70,FALSE,0,71,TRUE,1,82,TRUE,1,100,0.0004,0.1156,0.0001,0.0025,0,0.0121,0.0169,0.0144,0.0841,0.0961,0.5041,0.4489,0.1681,0.1764,0.0144,0.0081,0.0169,0.25,0.0121,0.3844,0.8836,0.25,0.1521,0.81,0.1521,0.4096,0.0324,0.0961,0,0.7744,0.49,0.1681,0.229478571,0.129321429,0.329635714,25,78.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,77.25,64.38,82,78.38,84.25,81.5,73,6.25,5.37,-10.62,19.5,15.88,-3.25,0.25,10.5,0,0,0,0,0,0,0,0,0,1,1,0,0,3,0,1,1,2,2,0,1,0,0,0,2,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,0,0.2,0.8,1.2,0.6,0.6,0.2,0.8,0.55,0.55,3,1.67,0,1,3,0,1.33,10 cents,5 minutes,36 days,Female,High School (or equivalent),66,0.875,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,-1,0,0,0,-2,-1,0,0,-1,0,0,0,0,3,0,0,0,2,1,-1,-0.6,-0.4,0.6,0.4,0 +485,R_7rr9Lf4jp0qsiBP,60 - 66,American,Female,1,1,3,2,0,-2,0,2,0,1,3,1,2,-2,2,1,-1,2,2,-1,0,1,2,2,-3,7,-2,-1,1,0,1,6,2,1,1,1,1,7,1,1,2,0,2,6,2,2,3,3,-2,7,1,-1,1,-2,0,7,3,0,3,0,2,8,1,1,2,2,-1,5,FALSE,1,93,TRUE,1,92,TRUE,0,79,FALSE,1,51,TRUE,1,53,TRUE,0,52,FALSE,0,70,TRUE,1,52,TRUE,1,51,TRUE,1,72,FALSE,1,53,FALSE,1,70,TRUE,1,74,FALSE,1,51,TRUE,1,50,TRUE,1,73,FALSE,1,53,TRUE,0,58,TRUE,0,57,TRUE,0,82,TRUE,1,57,TRUE,1,61,FALSE,1,76,FALSE,0,52,TRUE,0,51,TRUE,1,57,TRUE,0,71,FALSE,1,70,FALSE,1,51,TRUE,1,93,FALSE,0,50,TRUE,1,100,0.2304,0.1849,0.0729,0.49,0,0.2704,0.2704,0.0784,0.6724,0.1521,0.0049,0.0676,0.2401,0.2209,0.2209,0.0064,0.0576,0.2401,0.09,0.2601,0.1849,0.25,0.3249,0.2401,0.2209,0.5041,0.25,0.0049,0.6241,0.3364,0.2401,0.09,0.218667857,0.178728571,0.258607143,21,65.63,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,13,81.25,9,56.25,64.84,59.38,64.5,64.12,71.38,66.06,63.62,-3.12,-3.91,-3.12,-23,1.62,8.88,-15.19,7.37,1,0,1,0,3,0,1,1,0,0,1,0,1,3,1,0,2,0,2,3,1,1,0,1,2,3,1,1,2,1,0,1,1,2,0,0,2,0,0,0,1,0.4,1.2,1.4,1,1.6,0.8,0.4,1,0.95,6.67,7.33,0,-1,-1,1,-0.66,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,1,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,-1,1,-1,1,-3,0,0,-2,-1,1,-1,0,1,1,0,0,0,2,3,0,-1.2,0.4,1,0.05 +486,R_7rvHiXsBZBwFJzB,67 - 73,Canadian,Male,1,2,3,3,1,0,-2,2,-2,1,3,0,1,0,1,-1,-1,0,1,-1,2,2,3,3,1,6,-2,-2,2,-2,0,7,3,-1,1,1,1,7,1,1,1,1,-1,7,2,2,3,2,1,8,-2,-2,1,-2,-2,7,3,-1,2,0,2,7,-1,-1,-1,-1,-1,7,TRUE,0,100,FALSE,0,51,TRUE,0,100,TRUE,0,54,FALSE,0,53,FALSE,1,75,TRUE,1,80,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,80,TRUE,0,94,TRUE,1,95,TRUE,0,76,TRUE,1,62,TRUE,1,100,FALSE,1,100,TRUE,0,99,FALSE,1,75,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,98,FALSE,1,53,FALSE,1,87,TRUE,0,99,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0.0004,0,0.04,0,0.0625,0,0,1,0,0,0.0025,0.25,0.04,0.2809,0.2601,0.2304,0.2916,0.0169,0,0,0.1444,0.0625,0.5776,0,0.2209,0.2809,1,1,0.9801,0.9801,0.8836,0.305892857,0.172714286,0.439071429,26,81.25,21,65.63,5,62.5,6,75,5,62.5,5,62.5,13,81.25,8,50,83.94,59.75,84.25,94.12,97.62,83.88,84,15.62,18.31,-2.75,9.25,31.62,35.12,2.63,34,1,0,0,0,0,2,0,0,0,1,0,1,0,1,0,2,2,1,0,0,1,0,0,1,0,2,0,1,0,3,0,1,1,0,1,0,0,1,2,0,0.2,0.6,0.4,1,0.4,1.2,0.6,0.6,0.55,0.7,6.67,7.33,-2,0,0,0,-0.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,1.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,0,0,-1,0,-2,0,0,-1,1,-1,2,2,0,-2,0,-0.2,-0.6,-0.2,0.4,-0.15 +487,R_3cvFlRg40Ei120A,39 - 45,Canadian,Male,2,3,2,1,3,-3,-1,2,-1,3,2,-2,1,1,3,0,0,0,-1,-1,2,3,2,0,3,2,-3,0,-2,0,2,6,3,-2,1,2,3,7,0,0,0,-2,-1,4,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,FALSE,0,75,FALSE,1,75,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,70,TRUE,1,50,TRUE,1,75,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,50,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,75,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.09,0,0,0.5625,0,0,0,0.0625,0.25,0,0.25,0,0.25,0,0.25,0.5625,0,0.25,0.0625,1,0.0625,0.25,1,0.0625,0.25,0.25,0.25,0,0.0625,1,0.5625,0,0.238839286,0.133928571,0.34375,20,62.5,21,65.63,3,37.5,6,75,5,62.5,7,87.5,11,68.75,10,62.5,78.75,65.62,81.25,90.62,77.5,76.25,81.25,-3.13,13.12,28.12,6.25,28.12,-10,7.5,18.75,0,0,0,1,0,0,1,4,1,1,1,0,0,1,0,0,0,0,1,0,2,3,2,1,3,3,1,2,1,3,2,2,1,1,3,0,0,0,1,1,0.2,1.4,0.4,0.2,2.2,2,1.8,0.4,0.55,1.6,5,5,-3,1,2,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-2,-3,-2,0,-3,-3,0,2,0,-2,-1,-2,-1,0,-3,0,0,0,0,-1,-2,-0.6,-1.4,-0.2,-1.05 +488,R_5WNi0HR9SkD0VYR,60 - 66,American,Female,2,2,2,0,1,-1,-1,2,-2,0,3,3,1,-1,2,1,1,1,1,-2,2,2,2,2,2,2,-1,-2,2,0,-1,1,2,3,2,-3,2,1,-2,-1,1,0,-2,1,2,2,2,0,2,4,0,-3,2,-3,0,1,2,2,1,-3,2,3,-1,-1,0,0,-3,1,TRUE,0,91,FALSE,0,56,FALSE,1,100,FALSE,1,50,TRUE,1,58,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,53,TRUE,0,99,TRUE,1,75,TRUE,0,59,TRUE,1,50,TRUE,1,71,FALSE,1,56,TRUE,0,70,FALSE,1,50,FALSE,1,53,TRUE,1,57,TRUE,1,55,FALSE,1,78,TRUE,1,74,FALSE,1,69,TRUE,1,97,FALSE,1,56,FALSE,1,55,TRUE,0,100,TRUE,1,81,FALSE,0,54,TRUE,1,79,0,0.0009,0.0841,0.0576,0.0441,0,0.0676,0,0.2209,0.2025,0.0361,0.0625,0.1225,0.2209,0.1764,0.3136,0.0484,0.25,0.2025,0.0961,0.1849,0.25,0.25,0.3481,0.1936,0.1936,0.2916,0.8281,0,0.49,1,0.9801,0.252646429,0.126107143,0.379185714,16,50,25,78.13,6,75,7,87.5,5,62.5,7,87.5,14,87.5,11,68.75,71.47,54.25,75.38,77.12,79.12,71.75,71.19,-28.13,-6.66,-20.75,-12.12,14.62,-8.38,-15.75,2.44,0,0,0,2,1,0,1,0,2,1,1,0,1,2,0,3,2,0,1,0,0,0,0,0,1,1,2,0,1,0,1,1,0,2,0,2,2,1,1,1,0.6,0.8,0.8,1.2,0.2,0.8,0.8,1.4,0.85,0.8,1.33,2.67,-2,0,-2,0,-1.34,10 cents,100 minutes,24 days,Female,University - Undergraduate,63,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,2,0,-1,-1,0,1,1,0,-1,1,0,0,1,0,-1,0,-1,0.4,0,0,-0.2,0.05 +489,R_6MhAwx12zO2geZ5,53 - 59,American,Male,3,3,3,0,-3,0,3,-3,3,-3,-3,-3,3,-3,0,-3,-3,-3,-3,-3,3,3,3,0,-3,0,0,3,-3,3,-3,0,-3,-3,3,0,0,0,-3,-3,-3,-3,-3,0,3,3,3,0,-3,0,0,3,-3,3,-3,0,-3,-3,3,-3,0,0,-3,-3,-3,-3,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,1,1,1,1,0.223214286,0.035714286,0.410714286,24,75,24,75,4,50,7,87.5,7,87.5,6,75,15,93.75,9,56.25,85.94,62.5,87.5,93.75,100,90.62,81.25,0,10.94,12.5,0,6.25,25,-3.13,25,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0,0,0.15,0,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),59,0,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0.6,0,0.15 +490,R_7g8xvezOordk4nv,60 - 66,American,Female,2,3,3,2,3,-2,-3,3,-2,2,3,3,2,-3,2,2,2,3,3,2,2,3,3,2,3,2,-2,-3,3,-3,2,2,3,3,3,-3,2,1,2,2,3,2,3,6,2,3,3,3,-1,1,-3,-2,3,-2,2,1,3,3,1,-3,2,1,-1,1,0,1,1,1,FALSE,1,82,TRUE,1,93,FALSE,1,100,FALSE,1,55,TRUE,1,71,FALSE,1,100,TRUE,1,61,TRUE,1,100,TRUE,1,82,TRUE,1,81,FALSE,1,50,FALSE,1,63,TRUE,1,62,TRUE,0,100,TRUE,1,50,TRUE,1,57,FALSE,1,74,FALSE,1,100,TRUE,0,55,FALSE,1,98,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,100,TRUE,1,80,TRUE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,81,FALSE,0,50,TRUE,1,90,0,0.04,0.1849,0.1521,0.01,0,0.0576,0.0361,0.0004,0.25,0.0361,0.1444,0.0324,0.25,0.0841,0.0049,0,0.2025,0,0,0.25,0.25,0.3025,1,0.0676,0.25,0.25,0.0324,0,0,0.25,0.1369,0.139210714,0.079178571,0.199242857,25,78.13,26,81.25,5,62.5,7,87.5,6,75,8,100,13,81.25,13,81.25,75.34,60.62,74.62,81.75,84.38,70.88,79.81,-3.12,-5.91,-1.88,-12.88,6.75,-15.62,-10.37,-1.44,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,4,1,1,0,0,0,0,0,1,0,0,3,1,3,2,1,0,0.2,0.2,0.4,1,0.4,0.2,2,0.2,0.9,1.67,1,1,1,0,5,0.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,63,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-1,-4,-1,-1,0,1,0,0,0,0,0,0,-3,-1,-3,-1,0,-1,-0.2,0,-1.6,-0.7 +491,R_3dFIVMPBxdyXYss,60 - 66,Canadian,Female,2,0,2,0,3,-1,-1,2,-3,1,2,-2,2,-2,3,2,2,2,2,2,2,0,2,1,2,4,-1,1,2,1,1,7,2,-2,-1,2,2,6,-1,0,1,-1,1,6,2,0,2,2,2,1,-2,0,2,-3,-1,2,2,-2,2,-3,3,1,1,1,2,2,2,2,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,65,FALSE,1,100,TRUE,1,60,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,FALSE,0,100,TRUE,1,50,TRUE,1,100,0,0,0,0.16,0,0,0,0,0.25,0.04,1,0,0.25,0.0625,0.1225,0,0,0.25,0,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.16,0,1,0.5625,0.0625,0.187857143,0.141071429,0.234642857,25,78.13,24,75,5,62.5,5,62.5,7,87.5,7,87.5,14,87.5,10,62.5,79.38,59.38,80,87.5,90.62,81.56,77.19,3.13,4.38,-3.12,17.5,0,3.12,-5.94,14.69,0,0,0,1,1,0,2,0,4,0,0,0,3,4,1,3,2,1,3,1,0,0,0,2,1,1,1,0,0,2,0,0,0,1,0,1,1,0,0,0,0.4,1.2,1.6,2,0.6,0.8,0.2,0.4,1.3,0.5,5.67,1.33,3,5,5,4,4.34,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,1.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,0,-1,1,0,4,-2,0,0,3,3,1,2,1,1,3,1,-0.2,0.4,1.4,1.6,0.8 +492,R_1AFJJE4jeOYAfJc,53 - 59,American,Male,3,3,3,3,3,2,2,3,0,3,2,3,3,3,3,-3,0,-3,0,-3,3,3,3,3,3,3,1,3,3,3,3,2,3,3,3,3,3,3,-3,-3,-3,-3,-3,0,3,3,3,3,3,0,3,2,3,3,3,4,-2,3,3,3,-1,5,-1,0,0,0,-3,6,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.25,0.01,0,0,0,0,0,0,0.25,0,0,0,0,0,0,0.25,1,0.0576,1,0.25,0,0,1,1,0,0,1,0,1,1,1,1,0.350271429,0.111257143,0.589285714,28,87.5,20,62.5,5,62.5,6,75,6,75,3,37.5,13,81.25,7,43.75,92.69,90.75,100,92.5,87.5,93.12,92.25,25,30.19,28.25,25,17.5,50,11.87,48.5,0,0,0,0,0,1,1,0,3,0,1,0,0,0,0,0,3,0,3,0,0,0,0,0,0,1,0,0,3,0,4,0,0,0,4,2,0,3,0,0,0,1,0.2,1.2,0,0.8,1.6,1,0.6,0.85,2.67,3,3,-2,-2,-6,-0.33,10 cents,25 minutes,15 days,Male,High School (or equivalent),53,1.375,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,1,0,0,0,-3,0,0,0,-4,-2,3,-3,3,0,0,0.2,-1.4,0.2,-0.25 +493,R_6DPoGEOTRfRezWV,53 - 59,Canadian,Female,3,-3,3,0,3,-3,1,3,3,-1,3,-1,1,1,3,-1,0,0,2,2,3,-3,2,-3,3,0,1,0,3,2,1,1,3,-2,0,1,1,1,2,2,2,2,1,10,3,-3,3,2,3,3,-2,0,3,2,-1,1,3,-2,0,-3,3,1,0,0,0,2,2,8,TRUE,0,85,FALSE,0,66,FALSE,1,68,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,87,TRUE,1,95,TRUE,1,50,FALSE,1,50,TRUE,0,66,TRUE,1,75,TRUE,0,100,TRUE,1,74,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,1,97,TRUE,0,75,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0169,0.25,0,0,0,0,0.01,0.25,0,0,0,0.0625,0.0025,0.25,0.04,0.4356,0,0.25,0.0009,0.25,0,0.0676,0.25,1,0.25,0.25,1,0.7225,0.1024,0.25,0.5625,0.4356,0.230075,0.0929,0.36725,23,71.88,21,65.63,4,50,6,75,4,50,7,87.5,14,87.5,7,43.75,78.38,66.88,85,73.12,88.5,85.44,71.31,6.25,12.75,16.88,10,23.12,1,-2.06,27.56,0,0,1,3,0,4,1,0,1,2,0,1,1,0,2,3,2,2,0,1,0,0,0,2,0,1,1,0,1,0,0,1,1,4,0,1,0,0,0,0,0.8,1.6,0.8,1.6,0.4,0.6,1.2,0.2,1.2,0.6,0.67,1.67,-3,0,0,2,-1,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),53,1.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,1,1,0,3,0,0,0,2,0,0,0,-4,2,2,2,2,0,1,0.4,1,-0.4,1.4,0.6 +494,R_3F3tIXBjwMQ5kZi,53 - 59,Canadian,Male,3,3,3,3,3,1,0,1,-2,2,2,1,3,1,3,2,3,3,3,3,3,3,3,2,3,2,3,0,1,-1,3,1,2,2,3,2,3,1,3,3,3,3,3,3,3,3,3,3,3,0,1,0,1,-2,2,8,2,1,3,2,3,9,3,3,3,3,3,9,TRUE,0,100,TRUE,1,100,TRUE,0,96,FALSE,1,80,FALSE,0,64,FALSE,1,63,TRUE,1,60,TRUE,1,100,TRUE,1,70,FALSE,0,65,TRUE,0,77,TRUE,0,100,TRUE,1,97,TRUE,0,87,FALSE,0,65,TRUE,1,100,FALSE,1,87,FALSE,1,73,TRUE,0,86,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,66,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,79,FALSE,1,100,TRUE,0,87,TRUE,1,100,FALSE,0,96,TRUE,1,96,0,0.0025,0,0.16,0.0016,0.1369,0,0.4225,0,0,0,0.0009,0.09,0.5929,0.4096,0,0.1156,0.04,0,0,0.0225,0.4225,0.7396,0.7569,0.0169,0.0441,0.9216,1,0.9216,0.0729,0.7569,1,0.303053571,0.129285714,0.476821429,20,62.5,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,86.69,81.62,80.62,85,99.5,87.06,86.31,-3.13,21.06,31.62,5.62,22.5,24.5,12.06,30.06,0,0,0,1,0,2,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.2,0.8,0.4,0.2,0,0,0.2,0.2,0.4,0.1,1.33,5.67,2,-7,-8,-6,-4.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,1,0,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0.2,0.8,0.2,0,0.3 +495,R_12Y2xhiqWBwP4Mi,60 - 66,American,Male,1,1,1,-2,-3,-2,-3,2,-2,-2,3,1,-2,-3,1,2,3,2,3,0,0,-1,2,-3,0,1,-3,-3,2,-3,-2,1,3,2,0,-2,2,1,2,2,3,2,-1,1,1,0,1,-2,-3,0,-3,-1,2,-3,-2,1,3,2,0,-3,1,1,3,3,3,3,0,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,54,FALSE,0,70,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,51,TRUE,1,96,FALSE,1,100,TRUE,0,98,FALSE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,51,TRUE,0,100,TRUE,0,90,TRUE,1,100,FALSE,0,75,TRUE,1,100,0,0,0,0,0,0,0,0.0016,0,0,0,1,0.2601,0,0.49,0,0,0.2116,1,0,0,0,0,1,0.7744,0.2601,0.5625,0,0,0,0.81,0.9604,0.261810714,0.140235714,0.383385714,21,65.63,22,68.75,5,62.5,4,50,7,87.5,6,75,12,75,10,62.5,92.91,78.88,93.5,99.5,99.75,93.25,92.56,-3.12,24.16,16.38,43.5,12,24.75,18.25,30.06,1,2,1,1,3,1,0,0,1,0,0,1,2,1,1,0,1,1,1,1,0,1,0,0,0,1,2,0,1,0,0,1,2,0,0,1,0,1,0,0,1.6,0.4,1,0.8,0.2,0.8,0.6,0.4,0.95,0.5,1,0.67,1,0,0,0,0.33,5 cents,5 minutes,24 days,Male,University - Undergraduate,66,0.125,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,1,1,1,3,0,-2,0,0,0,0,0,0,1,1,-1,1,0,1,1,1.4,-0.4,0.4,0.4,0.45 +496,R_7eLg2r874DaAHXS,46 - 52,American,Male,2,1,1,1,2,0,0,1,-1,1,1,1,2,1,1,0,1,2,1,-1,1,1,1,1,1,4,1,1,1,0,1,4,1,1,1,1,1,6,0,0,0,0,-1,7,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,TRUE,0,97,TRUE,1,75,TRUE,0,95,TRUE,0,50,TRUE,1,50,TRUE,0,59,TRUE,1,90,TRUE,1,96,TRUE,1,50,TRUE,1,95,FALSE,1,57,TRUE,0,70,TRUE,1,94,TRUE,0,85,TRUE,1,50,TRUE,1,94,TRUE,0,50,FALSE,1,76,TRUE,0,60,TRUE,0,95,TRUE,1,90,TRUE,1,95,TRUE,0,60,TRUE,1,87,TRUE,0,60,TRUE,1,95,TRUE,0,60,FALSE,1,54,TRUE,0,52,TRUE,1,90,TRUE,1,90,TRUE,1,93,0.0016,0.0025,0.0036,0.01,0.0049,0.3481,0.0169,0.0025,0.9025,0.0025,0.01,0.0036,0.25,0.1849,0.25,0.0625,0.36,0.25,0.2116,0.36,0.01,0.25,0.36,0.7225,0.25,0.36,0.01,0.9409,0.9025,0.0576,0.2704,0.49,0.280139286,0.189171429,0.371107143,25,78.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,16,100,3,18.75,75.44,61.5,68.5,86.62,85.12,83.38,67.5,18.75,16.06,-1,18.5,24.12,22.62,-16.62,48.75,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,0,1,2,1,0,1,0,0,0,1,1,1,0,2,0,0,0,1,0,0,1,0,1,0,2,0.4,0.6,0.2,0.8,0.4,0.8,0.2,0.8,0.5,0.55,4.67,5,-1,-1,1,2,-0.33,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),50,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,1,1,1,-2,0,-0.2,0,0,-0.05 +497,R_51EwmmhPhkag5zR,60 - 66,American,Female,3,2,2,1,1,-3,-2,2,-2,2,1,-1,3,-3,3,2,-1,2,2,-1,1,3,1,-1,3,7,1,1,1,1,2,8,0,-1,3,-3,3,2,-2,-1,-2,-1,0,3,2,2,2,2,-2,3,1,-2,2,-2,2,4,0,-2,3,-3,3,4,0,0,2,1,-1,4,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,0,50,TRUE,1,95,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,50,TRUE,1,95,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,75,TRUE,1,65,TRUE,1,100,FALSE,1,70,TRUE,0,85,TRUE,0,85,FALSE,1,95,FALSE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,85,FALSE,1,80,TRUE,1,95,TRUE,0,70,FALSE,1,90,TRUE,0,85,TRUE,1,80,FALSE,0,70,TRUE,1,95,0,0.0025,0,0.01,0.0025,0,0.0225,0.0025,0.0025,0.81,0.04,0.25,0.25,0.25,0.0025,0,0,0.25,0.01,0.04,1,0.1225,0.7225,0.0625,0.09,0.49,0.49,0,0.01,0.7225,0.7225,1,0.263035714,0.134464286,0.391607143,25,78.13,23,71.88,4,50,6,75,6,75,7,87.5,13,81.25,10,62.5,83.91,67.5,86.88,88.75,92.5,85,82.81,6.25,12.03,17.5,11.88,13.75,5,3.75,20.31,2,1,1,2,2,4,3,1,3,0,1,0,0,0,0,4,0,4,3,1,1,0,0,1,3,4,0,0,0,0,1,1,0,0,0,2,1,0,1,0,1.6,2.2,0.2,2.4,1,0.8,0.4,0.8,1.6,0.75,5.67,3.67,4,4,-2,-1,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,1,1,1,-1,0,3,1,3,0,0,-1,0,0,0,2,-1,4,2,1,0.6,1.4,-0.2,1.6,0.85 +498,R_3hVZbhbk0TiHbhX,46 - 52,Canadian,Male,1,3,2,-1,3,1,-3,3,-3,-1,3,1,2,-2,1,-1,1,1,2,-1,1,3,2,-1,3,8,1,-2,3,-3,-2,8,3,1,2,-1,3,8,-1,-1,0,-1,-2,8,1,2,2,0,2,8,1,-3,2,-3,1,8,3,2,3,-2,2,8,-1,-1,1,1,-2,7,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,53,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,52,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,65,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0.2704,0,0.2809,0,0,0,1,1,0,1,1,0,1,1,0,1,0,1,0.4225,1,0.356207143,0.039378571,0.673035714,25,78.13,20,62.5,4,50,5,62.5,5,62.5,6,75,13,81.25,7,43.75,95.94,94,89.75,100,100,94.06,97.81,15.63,33.44,44,27.25,37.5,25,12.81,54.06,0,0,0,0,0,0,1,0,0,1,0,0,0,1,2,0,2,1,3,1,0,1,0,1,1,0,0,1,0,2,0,1,1,0,1,0,2,0,1,1,0,0.4,0.6,1.4,0.6,0.6,0.6,0.8,0.6,0.65,8,8,0,0,0,1,0,10 cents,100 minutes,15 days,Male,High School (or equivalent),51,1.875,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-1,0,-1,-1,0,1,-1,0,-1,0,-1,-1,1,1,0,0,1,2,0,-0.6,-0.2,0,0.6,-0.05 +499,R_5PdYf6o5pPhwHuN,60 - 66,American,Female,2,3,3,3,3,2,-3,3,-1,2,3,3,3,0,3,2,2,3,3,1,2,3,3,3,3,1,2,-3,3,1,2,1,3,3,3,0,3,1,-1,1,-1,-1,-1,1,2,3,3,3,3,2,1,-3,3,-2,1,2,3,3,3,0,3,0,2,2,2,2,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,68,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0.1024,0,0,1,1,1,1,0.253657143,0.142857143,0.364457143,28,87.5,25,78.13,8,100,6,75,6,75,5,62.5,14,87.5,11,68.75,99,96,100,100,100,100,98,9.37,20.87,-4,25,25,37.5,12.5,29.25,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,4,4,2,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0.4,0,2.8,0,0.6,0,0.4,0.8,0.25,1,1.33,-1,-1,1,-1,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,1.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,-1,0,0,1,-1,0,0,0,0,0,3,1,3,3,2,0,-0.2,0,2.4,0.55 +500,R_7CVPG5Jkd2rRrts,39 - 45,Canadian,Female,1,3,3,-1,3,2,-2,1,1,1,0,1,1,1,2,-1,-2,1,1,-3,3,3,3,1,3,4,2,-2,2,2,1,1,0,2,1,2,2,3,-1,1,1,1,-1,7,2,3,3,1,3,3,3,-3,2,-1,2,6,0,1,2,-1,2,2,1,1,2,2,-2,5,FALSE,1,84,TRUE,1,77,TRUE,0,97,FALSE,1,50,TRUE,1,90,FALSE,1,81,TRUE,1,100,TRUE,1,96,TRUE,1,96,TRUE,1,90,FALSE,1,86,TRUE,0,87,TRUE,1,100,FALSE,1,87,FALSE,0,57,TRUE,1,90,TRUE,0,91,FALSE,1,75,FALSE,1,81,FALSE,1,64,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,93,TRUE,1,74,FALSE,1,85,FALSE,1,100,FALSE,1,80,TRUE,1,92,TRUE,1,75,TRUE,1,83,0.0016,0.0676,0.01,0,0.0289,0.0361,0.0064,0.01,0.1296,0,0.0064,0,0.0016,0.0196,0.01,0.0529,0,0.25,0,0.0049,0.04,0.3249,0.0361,0.0169,0.8281,0.0225,0.0625,0.0256,0.9409,0.0625,0.04,0.7569,0.132617857,0.039392857,0.225842857,16,50,28,87.5,7,87.5,7,87.5,8,100,6,75,15,93.75,13,81.25,85.41,75.88,88.12,87.88,89.75,87,83.81,-37.5,-2.09,-11.62,0.62,-12.12,14.75,-6.75,2.56,2,0,0,2,0,0,0,1,1,0,0,1,0,1,0,0,3,0,0,2,1,0,0,2,0,1,1,1,2,1,0,0,1,2,0,2,3,1,1,1,0.8,0.4,0.4,1,0.6,1.2,0.6,1.6,0.65,1,2.67,3.67,1,-5,1,2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),45,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,1,0,0,0,0,-1,-1,0,-1,-1,0,1,-1,-1,0,-2,0,-1,-1,1,0.2,-0.8,-0.2,-0.6,-0.35 +501,R_57s4MotjUN6HqHz,60 - 66,American,Female,-1,3,2,0,-2,1,0,3,0,0,2,1,2,0,1,-2,0,0,0,-3,-1,3,1,0,-1,5,0,1,3,0,1,7,2,2,2,2,2,6,0,0,0,0,-1,6,-1,2,0,0,-1,6,0,0,0,0,-1,7,2,3,2,0,2,4,1,0,0,1,-1,6,TRUE,0,96,TRUE,1,100,TRUE,0,81,FALSE,1,50,FALSE,0,51,FALSE,1,51,TRUE,1,71,TRUE,1,84,FALSE,0,51,TRUE,1,82,FALSE,1,51,TRUE,0,76,FALSE,0,71,FALSE,1,50,FALSE,0,51,FALSE,0,60,TRUE,0,60,TRUE,0,60,FALSE,1,54,FALSE,1,53,TRUE,1,60,FALSE,0,51,FALSE,1,50,FALSE,0,52,FALSE,1,100,TRUE,1,60,FALSE,1,50,FALSE,1,66,FALSE,1,53,TRUE,1,100,FALSE,0,51,TRUE,1,100,0.0256,0.16,0.36,0.0841,0,0.2401,0.2704,0.0324,0.2209,0.2601,0,0.5041,0.2601,0.2401,0.2601,0,0.25,0.25,0.1156,0,0.16,0.2601,0.2116,0.25,0.36,0.25,0.2601,0.9216,0.6561,0.36,0.2209,0.5776,0.263996429,0.199164286,0.328828571,17,53.13,19,59.38,5,62.5,5,62.5,5,62.5,4,50,8,50,11,68.75,65.5,57.25,62,71.25,71.5,68.44,62.56,-6.25,6.12,-5.25,-0.5,8.75,21.5,18.44,-6.19,0,0,1,0,1,1,1,0,0,1,0,1,0,2,1,2,0,0,0,2,0,1,2,0,1,1,0,3,0,1,0,2,0,0,1,3,0,0,1,2,0.4,0.6,0.8,0.8,0.8,1,0.6,1.2,0.65,0.9,6,5.67,-1,0,2,0,0.33,10 cents,25 minutes,15 days,Female,High School (or equivalent),65,0.5,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,-1,-1,0,0,0,1,-3,0,0,0,-1,0,2,0,-1,0,0,-1,0,-0.4,-0.4,0.2,-0.4,-0.25 +502,R_6EhRcpqkjSAlOt7,60 - 66,American,Male,2,2,0,2,2,-1,-2,2,-2,0,1,1,0,1,1,2,1,2,2,1,1,0,0,-1,-1,0,2,-1,0,1,-2,0,1,-1,0,-1,0,0,0,-1,1,0,-1,0,1,-1,1,0,0,0,-1,0,0,-1,1,0,1,1,1,1,1,0,0,-1,0,1,0,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.25,0,0,0,0,0,1,0,0.25,0,0,1,0,1,1,0.169642857,0.035714286,0.303571429,32,100,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,95.31,87.5,93.75,100,100,96.88,93.75,15.62,10.93,0,6.25,12.5,25,-3.12,25,1,2,0,3,3,3,1,2,3,2,0,2,0,2,1,2,2,1,2,2,1,3,1,2,2,0,2,2,1,1,0,0,1,0,0,2,2,2,1,1,1.8,2.2,1,1.8,1.8,1.2,0.2,1.6,1.7,1.2,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,65,0,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,-1,-1,1,1,3,-1,0,2,1,0,2,-1,2,1,0,0,-1,1,1,0,1,0.8,0.2,0.5 +503,R_6Iu7tgW5S1KMdS6,39 - 45,Canadian,Female,0,3,1,0,0,-2,1,1,1,1,0,0,2,1,2,-2,-2,-2,-3,-3,0,3,1,0,0,3,-2,1,1,1,1,2,0,-1,1,1,2,2,-2,-2,-2,-3,-3,2,1,3,1,0,1,4,-1,1,2,0,2,2,0,0,2,1,2,3,-1,-1,-1,-2,-3,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,55,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.2025,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.232142857,0.232142857,0.232142857,8,25,17,53.13,4,50,4,50,5,62.5,4,50,6,37.5,11,68.75,53.28,50,56.25,56.25,50.62,50.31,56.25,-28.13,0.15,0,6.25,-6.25,0.62,12.81,-12.5,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0.4,0,0.4,0.8,0,0.8,0.1,0.5,2.33,3,-1,0,-1,-4,-0.67,10 cents,5 minutes,47 days,Female,University - Undergraduate,41,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,0,0,0,-1,-1,0,-1,-1,-1,0,1,1,0,0,-1,-1,-1,-1,0,-0.4,-0.8,0.4,-0.8,-0.4 +504,R_67rL8jAOKD0ykKU,46 - 52,Canadian,Female,1,2,3,3,3,-3,0,2,0,-1,2,-1,2,0,1,2,2,2,2,2,2,2,3,3,3,0,1,0,3,1,0,2,3,0,2,0,1,1,2,2,2,2,2,0,1,2,3,3,3,0,-3,0,3,-1,0,1,3,0,3,1,2,1,2,2,2,2,2,0,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,75,TRUE,1,75,TRUE,1,75,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,91,TRUE,1,90,TRUE,0,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,1,100,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,100,0.0625,0,0.25,0.0625,0,0.0625,0,0.01,0.25,0.25,0.0625,0.01,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,1,0,0.25,0.8281,0.249039286,0.153214286,0.344864286,16,50,20,62.5,6,75,3,37.5,6,75,5,62.5,11,68.75,9,56.25,69.41,50,64.38,83.12,80.12,69.06,69.75,-12.5,6.91,-25,26.88,8.12,17.62,0.31,13.5,1,0,0,0,0,4,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0.2,1.4,0.4,0,0,0.6,1,0,0.5,0.4,1,0.67,0,1,0,0,0.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,46,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,1,0,0,0,0,4,0,0,0,0,0,0,-1,-1,-1,0,0,0,0,0,0.2,0.8,-0.6,0,0.1 +505,R_32DPnRQOpw7JI2X,60 - 66,American,Male,0,2,2,1,1,0,0,1,1,0,2,1,1,0,1,0,-1,-1,0,0,0,2,2,1,2,5,1,-1,1,0,1,8,2,1,1,0,1,5,1,0,1,0,1,8,0,2,2,1,2,6,0,0,1,0,0,7,2,2,1,0,2,6,1,0,1,0,0,7,FALSE,1,68,TRUE,1,68,TRUE,0,81,TRUE,0,59,TRUE,1,57,FALSE,1,64,TRUE,1,68,TRUE,1,63,FALSE,0,61,FALSE,0,71,FALSE,1,60,TRUE,0,68,TRUE,1,65,TRUE,0,72,FALSE,0,58,FALSE,0,68,TRUE,0,63,FALSE,1,69,FALSE,1,65,FALSE,1,86,FALSE,0,65,TRUE,1,62,FALSE,1,64,TRUE,1,60,TRUE,0,67,TRUE,1,65,FALSE,1,60,TRUE,0,72,FALSE,1,62,TRUE,1,64,FALSE,0,60,TRUE,1,77,0.1369,0.1225,0.4624,0.1024,0.0529,0.1296,0.16,0.5041,0.0196,0.1444,0.1296,0.1225,0.3721,0.16,0.1849,0.1024,0.1296,0.3481,0.5184,0.4489,0.4225,0.3364,0.1225,0.5184,0.3969,0.16,0.36,0.1024,0.6561,0.0961,0.1444,0.4624,0.2609,0.182842857,0.338957143,12,37.5,19,59.38,4,50,6,75,5,62.5,4,50,10,62.5,9,56.25,66,61.38,64.62,67.75,70.25,64.5,67.5,-21.88,6.62,11.38,-10.38,5.25,20.25,2,11.25,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,1,1,2,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,2,0,0,0.2,0.8,0,1,0.2,0.2,0.4,0.8,0.5,0.4,6,6.33,-1,1,-1,1,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),62,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,1,1,0,0,1,0,-1,0,0,-1,0,0,0,0,1,0,0.6,-0.4,0.2,0.1 +506,R_3rrxpCpwguuOENK,53 - 59,Canadian,Male,3,3,3,3,-3,3,-3,3,-3,-3,3,3,0,0,2,3,3,3,3,3,3,3,3,3,-3,0,3,-3,3,-3,0,10,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,-3,0,3,-3,3,-3,-3,0,3,3,3,3,3,0,3,3,3,3,3,0,FALSE,1,100,FALSE,0,76,TRUE,0,100,TRUE,0,50,TRUE,1,80,FALSE,1,54,TRUE,1,100,TRUE,1,100,FALSE,0,58,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,1,87,TRUE,0,100,TRUE,1,91,TRUE,0,100,FALSE,1,100,TRUE,0,90,TRUE,1,100,TRUE,1,93,TRUE,1,100,0,0.0081,0,0,0,0.2116,0.0169,0,0,0,0,0,0.3364,0.8464,0.04,0.5776,0.8281,0.25,0,1,0,0,1,1,0.2401,1,0.0049,0,1,0,0.81,1,0.362928571,0.221928571,0.503928571,27,84.38,20,62.5,2,25,6,75,6,75,6,75,14,87.5,6,37.5,91.03,83.62,83.25,98.88,98.38,92.81,89.25,21.88,28.53,58.62,8.25,23.88,23.38,5.31,51.75,0,0,0,0,0,0,0,0,0,3,0,0,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,1,0,0,0,0,0,0,0.6,1.4,0,0,0,1.4,0,0.5,0.35,3.33,0,0,10,0,0,3.33,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,58,1.375,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0.15 +507,R_5p5z6fZrDuttTgw,53 - 59,Canadian,Male,1,1,2,2,1,1,-2,3,-2,1,2,1,2,1,2,1,-1,1,1,-1,2,2,2,2,2,8,1,-1,0,1,2,3,2,2,2,1,2,7,1,-1,1,-2,-2,7,2,2,2,2,2,8,1,-3,2,-3,2,8,2,2,3,1,3,8,2,1,2,2,-2,8,FALSE,1,52,FALSE,0,50,TRUE,0,87,FALSE,1,66,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,98,TRUE,0,100,TRUE,0,80,TRUE,1,77,TRUE,0,90,TRUE,1,88,TRUE,1,100,TRUE,0,85,FALSE,1,89,FALSE,1,87,FALSE,1,98,TRUE,1,93,TRUE,1,100,FALSE,1,97,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,0,50,TRUE,0,100,TRUE,0,90,TRUE,1,98,TRUE,1,65,FALSE,0,75,0.0001,0.0025,0,0,0.5625,0,0.0025,0.0004,0.0004,0,0.0004,0.0529,0,1,0.0004,0.25,0.0009,0.1156,1,0.0025,0.0049,0.0144,0.0169,0.81,0.7225,0.25,0.1225,0.2304,0.7569,0.0121,0.81,0.64,0.263539286,0.141857143,0.385221429,25,78.13,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,14,87.5,8,50,87.41,75.75,89.38,89.88,94.62,89.44,85.38,9.38,18.66,13.25,26.88,2.38,32.12,1.94,35.38,1,1,0,0,1,0,1,3,3,1,0,1,0,0,0,0,0,0,3,1,1,1,0,0,1,0,1,1,1,1,0,1,1,0,1,1,2,1,1,1,0.6,1.6,0.2,0.8,0.6,0.8,0.6,1.2,0.8,0.8,6,8,0,-5,-1,-1,-2,10 cents,100 minutes,24 days,Male,University - Undergraduate,53,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,2,2,0,0,0,-1,0,-1,-1,-2,-1,2,0,0,0.8,-0.4,-0.4,0 +508,R_1fdOXGrZjaVCOrT,53 - 59,Canadian,Male,1,2,2,-1,3,3,-2,1,0,2,2,-2,0,3,2,1,1,2,2,2,1,2,2,-2,3,2,3,-2,1,2,2,4,1,-2,1,3,2,2,1,1,1,-1,2,6,1,2,2,-1,3,2,2,-1,1,-2,1,3,1,-1,-1,2,2,4,2,2,2,2,2,2,FALSE,1,96,TRUE,1,92,TRUE,0,94,FALSE,1,50,TRUE,1,62,TRUE,0,82,TRUE,1,100,TRUE,1,85,FALSE,0,50,TRUE,1,100,FALSE,1,57,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,95,TRUE,0,96,FALSE,1,90,FALSE,1,100,FALSE,0,50,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,0,50,FALSE,1,100,TRUE,0,91,TRUE,1,90,TRUE,1,100,TRUE,1,100,0.0225,0.25,0,0,0,0.6724,0,0,0,0.0196,0.01,0,0.25,0.1849,0.1444,0.0064,0,0.25,0,1,0.25,0.25,0.01,0,0.0025,0.25,0,0.0016,0.8836,0.9216,0.8281,0.25,0.220896429,0.109835714,0.331957143,21,65.63,23,71.88,6,75,5,62.5,6,75,6,75,14,87.5,9,56.25,83.31,67.38,85,91,89.88,82.19,84.44,-6.25,11.43,-7.62,22.5,16,14.88,-5.31,28.19,0,0,0,1,0,0,0,0,2,0,1,0,1,0,0,0,0,1,3,0,0,0,0,0,0,1,1,0,2,1,1,1,1,1,0,1,1,0,0,0,0.2,0.4,0.4,0.8,0,1,0.8,0.4,0.45,0.55,2.67,3,0,1,-2,4,-0.33,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),58,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,1,0,-1,-1,0,0,-1,0,-1,0,-1,0,-1,-1,1,3,0,0.2,-0.6,-0.4,0.4,-0.1 +509,R_5pmS9Q29astWndN,39 - 45,Canadian,Male,1,3,3,1,3,0,0,2,1,1,1,1,3,1,2,1,2,2,3,1,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,5,1,1,1,1,1,7,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,6,FALSE,1,92,TRUE,1,100,TRUE,0,98,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,97,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,55,FALSE,0,50,TRUE,1,57,FALSE,1,50,FALSE,1,60,TRUE,0,60,FALSE,1,100,FALSE,0,60,TRUE,1,50,FALSE,1,100,TRUE,1,52,TRUE,0,63,TRUE,1,95,TRUE,0,53,FALSE,1,93,TRUE,0,92,TRUE,1,100,TRUE,1,89,TRUE,1,96,0,0.0025,0.1849,0,0.0016,0,0.2304,0.0009,0,0.25,0,0,0.2304,0.25,0,0,0,0.25,0.0049,0.3969,0.36,0.25,0.36,0.2025,0.25,0.2809,0.0121,0.0064,0.9604,0.16,0.8464,1,0.225135714,0.086664286,0.363607143,28,87.5,22,68.75,3,37.5,6,75,7,87.5,6,75,14,87.5,8,50,78.56,63,87.25,76.5,87.5,81.12,76,18.75,9.81,25.5,12.25,-11,12.5,-6.38,26,0,2,2,0,2,1,1,1,0,0,0,0,2,0,1,0,1,1,2,0,0,2,2,0,2,1,1,1,0,0,1,1,1,1,0,0,1,1,2,0,1.2,0.6,0.6,0.8,1.2,0.6,0.8,0.8,0.8,0.85,3,3.33,-4,2,1,-1,-0.33,10 cents,100 minutes,47 days,Male,University - Undergraduate,44,0.625,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,-1,-1,1,-1,1,0,0,0,0,0,0,0,-0.2,0,-0.05 +510,R_5pASad3k0CB72dF,53 - 59,Canadian,Male,0,1,1,1,3,0,-2,1,0,2,1,-2,2,-1,0,-2,-2,-2,-1,-1,1,1,2,1,2,3,0,-1,2,0,2,6,1,-1,2,-1,0,4,-2,-2,-2,-2,-3,8,1,1,1,1,2,3,0,-1,1,0,1,3,1,-1,2,-1,0,3,-1,-2,-1,-2,-1,4,TRUE,0,70,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,85,TRUE,1,100,TRUE,1,75,TRUE,1,90,FALSE,1,50,TRUE,0,75,TRUE,1,70,TRUE,0,100,TRUE,1,50,TRUE,1,90,TRUE,0,70,TRUE,0,75,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,75,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,90,TRUE,1,80,TRUE,1,100,0,0,0.01,0.0225,0,0,0.0025,0.01,0.25,0.0625,0.81,0.09,0.0625,0.25,0.0625,0.25,0.25,0.25,0.25,0,0,0.25,0.25,1,0.49,0.25,0.04,0.49,0.36,0.5625,0.25,0.5625,0.25375,0.167857143,0.339642857,18,56.25,22,68.75,6,75,7,87.5,5,62.5,4,50,15,93.75,7,43.75,74.22,56.88,76.88,86.88,76.25,82.81,65.62,-12.5,5.47,-18.12,-10.62,24.38,26.25,-10.94,21.87,1,0,1,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,1,2,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.2,0.6,0.4,0.4,0.2,0.6,0.45,0.4,4.33,3,0,3,1,4,1.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,53,1.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,1,0,0,0,0,1,0,-1,0,0,0,0,0,-1,0,-1,0,2,0.2,0,0,0,0.05 +511,R_3f1Xozb2iQRXGhm,39 - 45,Canadian,Female,2,3,2,0,3,2,0,2,2,2,2,-1,3,3,3,-1,1,2,1,-1,3,1,2,-3,3,6,0,-1,1,-2,3,9,2,0,3,2,2,8,-3,-3,-3,-3,-3,8,3,3,3,0,3,4,1,0,2,0,3,4,0,0,3,0,2,4,2,2,2,2,2,7,TRUE,0,91,FALSE,0,62,FALSE,1,77,TRUE,0,72,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,1,97,FALSE,0,57,FALSE,0,93,FALSE,1,56,TRUE,0,81,TRUE,1,86,FALSE,1,97,FALSE,0,56,TRUE,1,95,TRUE,0,61,TRUE,0,96,TRUE,0,88,FALSE,1,100,FALSE,0,50,TRUE,1,94,FALSE,1,97,TRUE,1,86,TRUE,0,54,TRUE,1,73,FALSE,1,50,FALSE,1,51,TRUE,0,89,FALSE,0,53,FALSE,0,58,TRUE,1,100,0.0009,0.0729,0.0025,0,0,0,0.0196,0.8649,0,0.0036,0.2809,0.0196,0.3249,0.1936,0.0169,0.3844,0.0009,0.5184,0.2401,0.2916,0.25,0.3136,0.7744,0.0009,0.3721,0.25,0.3364,0.8281,0.0529,0.9216,0.7921,0.6561,0.310985714,0.187692857,0.434278571,24,75,17,53.13,2,25,5,62.5,4,50,6,75,9,56.25,8,50,78.34,62.38,83.75,87.25,80,77.94,78.75,21.87,25.21,37.38,21.25,37.25,5,21.69,28.75,1,2,0,3,0,2,1,1,4,1,0,1,0,1,1,2,4,5,4,2,1,0,1,0,0,1,0,0,2,1,2,1,0,3,1,3,1,0,1,3,1.2,1.8,0.6,3.4,0.4,0.8,1.4,1.6,1.75,1.05,7.67,4,2,5,4,1,3.67,5 cents,5 minutes,24 days,Female,High School (or equivalent),42,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,2,-1,3,0,1,1,1,2,0,-2,0,0,-2,0,-1,3,5,3,-1,0.8,1,-0.8,1.8,0.7 +512,R_6mgx9iUVweotOgY,39 - 45,Canadian,Male,2,3,2,1,1,-1,-3,1,-3,1,3,2,3,0,3,1,1,2,2,-1,-1,2,2,-1,-1,1,-3,-3,-1,-3,-2,4,3,3,3,3,3,1,-1,-1,-1,-1,-1,8,2,3,3,1,2,1,0,-3,3,-3,3,1,3,3,3,3,3,1,3,3,3,3,3,5,TRUE,0,96,TRUE,1,96,FALSE,1,93,TRUE,0,74,TRUE,1,94,TRUE,0,90,TRUE,1,100,TRUE,1,57,TRUE,1,85,TRUE,1,75,FALSE,1,87,TRUE,0,93,FALSE,0,83,TRUE,0,70,TRUE,1,50,TRUE,1,98,FALSE,1,64,TRUE,0,98,TRUE,0,50,FALSE,1,93,TRUE,1,62,TRUE,1,93,TRUE,0,50,TRUE,1,100,FALSE,1,88,TRUE,1,50,FALSE,1,69,TRUE,0,63,TRUE,0,81,TRUE,1,100,FALSE,0,56,TRUE,1,92,0.1849,0.25,0.0004,0,0.0064,0.81,0,0.0625,0.0049,0.0049,0,0.6889,0.0225,0.0169,0.0036,0.0016,0.25,0.5476,0.3969,0.0144,0.1444,0.25,0.25,0.49,0.1296,0.0961,0.3136,0.9216,0.0049,0.9604,0.6561,0.8649,0.282596429,0.172842857,0.39235,25,78.13,20,62.5,5,62.5,4,50,5,62.5,6,75,14,87.5,6,37.5,79.69,70.88,77,83.75,87.12,80.69,78.69,15.63,17.19,8.38,27,21.25,12.12,-6.81,41.19,3,1,0,2,2,2,0,2,0,3,0,1,0,3,0,2,2,3,3,0,0,0,1,0,1,1,0,2,0,2,0,1,0,3,0,2,2,1,1,4,1.6,1.4,0.8,2,0.4,1,0.8,2,1.45,1.05,2,1,0,3,0,3,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,45,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,3,1,-1,2,1,1,0,0,0,1,0,0,0,0,0,0,0,2,2,-4,1.2,0.4,0,0,0.4 +513,R_5Eff3JIxO7fBkqd,32 - 38,Canadian,Female,3,3,-1,3,1,-3,1,1,-1,0,2,3,3,-2,3,2,2,2,2,0,3,3,1,3,0,2,1,3,-1,3,0,7,-1,-1,2,1,0,5,-3,1,-3,-2,-1,7,3,3,-2,3,2,1,-3,-1,2,-1,0,5,3,3,3,-1,3,3,2,3,2,3,0,4,TRUE,0,74,FALSE,0,50,TRUE,0,69,FALSE,1,50,TRUE,1,69,FALSE,1,50,TRUE,1,50,TRUE,1,77,FALSE,0,50,TRUE,1,59,FALSE,1,50,TRUE,0,83,TRUE,1,78,FALSE,1,50,FALSE,0,53,TRUE,1,85,TRUE,0,50,TRUE,0,76,FALSE,1,80,FALSE,1,62,FALSE,0,76,TRUE,1,74,FALSE,1,100,TRUE,1,78,FALSE,1,97,TRUE,1,50,FALSE,1,50,FALSE,1,95,TRUE,0,83,TRUE,1,51,FALSE,0,66,TRUE,1,92,0.0529,0.25,0.0225,0.25,0.0064,0.25,0.0484,0.1681,0.1444,0.0676,0.2401,0.0484,0.25,0.25,0.0961,0.25,0,0.25,0.0025,0.0009,0.5776,0.2809,0.04,0.25,0.25,0.25,0.4356,0.5476,0.4761,0.5776,0.6889,0.6889,0.254860714,0.147821429,0.3619,21,65.63,21,65.63,4,50,5,62.5,6,75,6,75,11,68.75,10,62.5,68.03,56.12,74.75,66.25,75,66.12,69.94,0,2.4,6.12,12.25,-8.75,0,-2.63,7.44,0,0,2,0,1,4,2,2,4,0,3,4,1,3,3,5,1,5,4,1,0,0,1,0,1,0,2,1,0,0,1,0,0,1,0,0,1,0,1,0,0.6,2.4,2.8,3.2,0.4,0.6,0.4,0.4,2.25,0.45,4.67,3,1,2,2,3,1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,32,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,1,0,0,4,0,1,4,0,2,4,1,2,3,5,0,5,3,1,0.2,1.8,2.4,2.8,1.8 +514,R_6M0eRrQkHoeb5OD,39 - 45,Canadian,Male,3,2,2,-2,3,-2,-1,-1,-1,3,1,-3,3,-3,3,-3,-3,-3,-3,-3,3,0,-2,-2,3,5,-2,-3,-1,-2,3,4,1,-3,3,-2,3,4,-3,-2,-1,-3,-1,3,3,2,0,1,3,3,-1,-2,1,-2,3,3,0,-3,3,-3,3,1,-1,1,2,1,-3,4,TRUE,0,74,TRUE,1,83,TRUE,0,74,FALSE,1,50,FALSE,0,50,TRUE,0,57,TRUE,1,72,TRUE,1,58,TRUE,1,65,TRUE,1,70,TRUE,0,59,TRUE,0,76,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,61,TRUE,0,91,TRUE,0,100,TRUE,0,55,TRUE,1,73,FALSE,0,62,TRUE,0,54,TRUE,1,80,FALSE,1,56,TRUE,1,73,FALSE,1,52,FALSE,1,100,TRUE,0,59,FALSE,0,72,FALSE,0,68,FALSE,0,62,0.1764,0.0729,0,0.0784,0.3844,0.3249,0.04,0.09,0.3025,0.3844,0.5184,1,0.1225,0.3481,0.25,0.0289,0.2916,0.25,0,0.1936,0.0729,0.25,1,0,0.1521,0.2304,0.4624,0.5476,0.5476,0.8281,0.3481,0.5776,0.340932143,0.309692857,0.372171429,16,50,16,50,5,62.5,2,25,5,62.5,4,50,10,62.5,6,37.5,70.5,65.88,64.5,74.75,76.88,71.12,69.88,0,20.5,3.38,39.5,12.25,26.88,8.62,32.38,0,2,4,0,0,0,2,0,1,0,0,0,0,1,0,0,1,2,0,2,0,0,2,3,0,1,1,2,1,0,1,0,0,0,0,2,4,5,4,0,1.2,0.6,0.2,1,1,1,0.2,3,0.75,1.3,4.33,2.33,2,1,3,-1,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,43,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,2,2,-3,0,-1,1,-2,0,0,-1,0,0,1,0,-2,-3,-3,-4,2,0.2,-0.4,0,-2,-0.55 +515,R_34vzQKoASOHHcL9,32 - 38,Canadian,Female,1,2,3,3,2,0,1,1,-2,3,-1,-2,3,-2,1,3,-2,-1,2,3,-2,3,3,3,3,2,-3,3,-2,3,-1,10,3,-2,3,1,3,5,-2,0,-3,-3,-3,7,-2,3,3,3,1,4,3,1,3,-3,3,7,-3,-1,1,-3,1,5,3,3,3,3,3,7,FALSE,1,70,TRUE,1,51,FALSE,1,92,TRUE,0,51,TRUE,1,90,FALSE,1,100,TRUE,1,78,TRUE,1,90,FALSE,0,50,TRUE,1,81,FALSE,1,52,TRUE,0,92,TRUE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,95,FALSE,1,58,TRUE,0,76,FALSE,1,66,FALSE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,67,TRUE,1,100,TRUE,0,50,TRUE,1,93,FALSE,1,55,FALSE,1,82,TRUE,0,85,TRUE,1,70,FALSE,0,81,TRUE,1,96,0.01,0.0049,0.0025,0.0484,0.0016,0,0,0.0361,0,0.0036,0.09,0.25,0.25,0.2304,0.01,0.2401,0.1089,0.2601,0.0324,0.25,0,0.5625,0.1156,0,0.1764,0.2025,0.6561,0.09,0.0064,0.5776,0.7225,0.8464,0.204257143,0.105771429,0.302742857,20,62.5,24,75,4,50,7,87.5,6,75,7,87.5,13,81.25,11,68.75,77.81,60.12,80.75,80.25,90.12,80.88,74.75,-12.5,2.81,10.12,-6.75,5.25,2.62,-0.37,6,3,1,0,0,1,3,2,3,5,4,4,0,0,3,2,5,2,2,5,6,3,1,0,0,1,3,0,2,1,0,2,1,2,1,0,0,5,4,1,0,1,3.4,1.8,4,1,1.2,1.2,2,2.55,1.35,5.67,5.33,-2,3,0,0,0.34,10 cents,5 minutes,47 days,Female,University - Undergraduate,34,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,2,1,4,4,2,-1,-2,2,2,5,-3,-2,4,6,0,2.2,0.6,2,1.2 +516,R_7lbgMntFFRBybCp,46 - 52,Canadian,Male,2,3,1,1,3,-2,3,2,0,2,1,0,3,-3,3,1,1,2,2,-3,3,3,2,0,1,2,-3,2,0,3,1,2,-3,0,3,-3,2,3,1,2,2,1,-3,7,2,3,1,2,3,0,-2,1,1,0,3,2,2,0,3,-2,3,8,1,1,1,0,-3,5,TRUE,0,100,TRUE,1,100,TRUE,0,85,TRUE,0,50,TRUE,1,92,FALSE,1,100,TRUE,1,85,TRUE,1,95,TRUE,1,96,TRUE,1,100,FALSE,1,80,TRUE,0,90,TRUE,1,98,TRUE,0,100,TRUE,1,50,TRUE,1,80,FALSE,1,50,TRUE,0,70,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,90,FALSE,1,89,TRUE,0,100,TRUE,1,91,TRUE,1,99,TRUE,1,100,0.0025,0,0.04,0.0225,0,0,0,0,0,0.0009,0.0081,0.0004,0.0016,0.04,0.0064,0,0,0.25,0.0121,0,1,0.25,0.25,1,0.25,0.81,0.0001,1,0.7225,0.49,1,0.81,0.282217857,0.021957143,0.542478571,28,87.5,23,71.88,6,75,6,75,5,62.5,6,75,15,93.75,8,50,88.66,76.88,92.5,94,91.25,92.69,84.62,15.62,16.78,1.88,17.5,31.5,16.25,-1.06,34.62,1,0,1,1,2,1,1,2,3,1,4,0,0,0,1,0,1,0,1,0,0,0,0,1,0,0,2,1,0,1,1,0,0,1,0,0,0,1,2,0,1,1.6,1,0.4,0.2,0.8,0.4,0.6,1,0.5,2.33,3.33,2,0,-5,2,-1,5 cents,5 minutes,47 days,Male,High School (or equivalent),51,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,1,0,1,0,2,1,-1,1,3,0,3,0,0,-1,1,0,1,-1,-1,0,0.8,0.8,0.6,-0.2,0.5 +517,R_31Mug8JPXfCCLlL,32 - 38,Canadian,Female,2,2,2,1,3,1,2,2,1,2,3,1,2,2,2,2,3,1,2,2,1,2,1,2,2,8,2,2,1,3,2,9,1,2,2,3,2,8,2,2,1,3,2,9,1,2,1,2,1,8,1,3,2,1,2,8,2,1,1,1,2,6,2,3,2,2,3,7,FALSE,1,51,FALSE,0,53,TRUE,0,92,FALSE,1,55,FALSE,0,53,FALSE,1,59,TRUE,1,100,TRUE,1,100,FALSE,0,54,TRUE,1,90,TRUE,0,69,TRUE,0,100,TRUE,1,81,FALSE,1,54,TRUE,1,63,TRUE,1,97,TRUE,0,95,TRUE,0,99,TRUE,0,86,TRUE,0,91,TRUE,1,86,FALSE,0,54,FALSE,1,53,TRUE,1,100,FALSE,1,100,TRUE,1,78,TRUE,0,63,TRUE,0,94,TRUE,0,88,FALSE,0,60,TRUE,1,94,TRUE,1,66,0,0.0484,0.0009,0,0.1156,0.1681,0,0.01,0.8281,0.2916,0.36,0.0361,0.2916,0.4761,0.2809,0.2809,0.2209,0.2025,0.8836,0,0.0196,0.1369,0.7396,0.2116,0.9025,0.3969,0.0036,0.2401,0.8464,0.9801,0.7744,1,0.382060714,0.254457143,0.509664286,25,78.13,17,53.13,3,37.5,5,62.5,6,75,3,37.5,11,68.75,6,37.5,77.44,67.12,72.62,78.25,91.75,76.81,78.06,25,24.31,29.62,10.12,3.25,54.25,8.06,40.56,1,0,1,1,1,1,0,1,2,0,2,1,0,1,0,0,1,0,1,0,1,0,1,1,2,0,1,0,0,0,1,0,1,1,0,0,0,1,0,1,0.8,0.8,0.8,0.4,1,0.2,0.6,0.4,0.7,0.55,8.33,7.33,0,1,2,2,1,10 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),38,0,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,-1,1,-1,1,2,0,1,1,-1,0,0,0,1,-1,1,-1,-0.2,0.6,0.2,0,0.15 +518,R_5nBn9uQByRCQc9N,46 - 52,Canadian,Female,3,3,-1,-1,2,-2,-1,2,-1,1,2,-1,3,1,3,1,1,2,1,0,3,3,2,-1,3,3,-3,-2,2,-2,2,2,2,-1,3,2,3,1,-1,-1,-1,-2,1,7,3,3,1,2,2,4,-3,-1,2,-2,-1,1,2,-1,3,1,3,1,2,2,2,2,1,3,FALSE,1,99,TRUE,1,65,FALSE,1,97,FALSE,1,80,TRUE,1,80,FALSE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,60,FALSE,0,90,FALSE,1,60,TRUE,0,60,TRUE,1,60,FALSE,1,98,FALSE,0,85,TRUE,1,98,FALSE,1,60,FALSE,1,75,FALSE,1,60,FALSE,1,58,TRUE,1,98,TRUE,1,85,FALSE,1,100,TRUE,1,85,TRUE,0,60,TRUE,1,75,FALSE,1,96,FALSE,1,85,TRUE,0,90,TRUE,1,76,TRUE,1,70,TRUE,1,90,0.01,0.0625,0.0004,0,0.01,0.0025,0.0225,0.81,0.1764,0.0225,0.0576,0.16,0.16,0.16,0.04,0.1225,0,0.04,0.0225,0.36,0.0004,0.7225,0.16,0.0004,0.16,0.0016,0.09,0.0001,0.0009,0.0625,0.81,0.36,0.161960714,0.127428571,0.196492857,21,65.63,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,80.62,72,84.12,85.25,81.12,81.69,79.56,-18.75,-3.76,-15.5,-3.38,10.25,-6.38,-5.81,-1.69,0,0,3,0,1,1,1,0,1,1,0,0,0,1,0,2,2,3,3,1,0,0,2,3,0,1,0,0,1,2,0,0,0,0,0,1,1,0,1,1,0.8,0.8,0.2,2.2,1,0.8,0,0.8,1,0.65,2,2,-1,1,0,4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,47,1.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,1,-3,1,0,1,0,0,-1,0,0,0,1,0,1,1,3,2,0,-0.2,0,0.2,1.4,0.35 +519,R_7D6WMp7DnNOxRaD,46 - 52,American,Female,2,3,3,3,3,3,-3,3,-3,3,3,3,3,-3,3,3,1,2,3,2,3,3,3,3,3,5,3,-3,3,-3,3,5,3,3,3,-3,3,5,3,2,3,3,3,5,2,3,3,3,3,5,3,-3,3,-3,3,5,3,3,3,-3,3,5,3,2,3,2,2,5,TRUE,0,73,FALSE,0,80,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,100,TRUE,0,96,FALSE,0,82,TRUE,1,98,TRUE,0,89,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,94,TRUE,1,96,FALSE,0,100,0,0,0.0004,0,1,0,0.0025,1,1,0,0.0036,1,1,0,0,0.64,1,1,1,1,0,0.6724,1,0.9216,0.7921,1,0.0016,0.5329,1,1,1,0.0025,0.627471429,0.54615,0.708792857,10,31.25,13,40.63,2,25,3,37.5,3,37.5,5,62.5,10,62.5,3,18.75,96.81,94.75,98.62,96.12,97.75,96.56,97.06,-9.38,56.18,69.75,61.12,58.62,35.25,34.06,78.31,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0.2,0,0,0.6,0,0,0,0.6,0.2,0.15,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),51,0.5,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0.2,0,0,0,0.05 +520,R_1oMu1lsMXM4KW0p,32 - 38,Canadian,Female,3,3,2,-1,-1,1,2,2,3,2,2,-1,2,1,2,1,1,1,1,-1,2,2,2,-2,-1,2,1,3,1,3,-1,4,1,1,-1,0,-1,5,1,1,1,0,1,2,3,3,3,-1,1,4,2,1,1,1,2,4,3,-1,2,2,2,3,2,2,2,3,2,6,FALSE,1,54,TRUE,1,71,FALSE,1,88,FALSE,1,65,TRUE,1,84,FALSE,1,76,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,67,TRUE,0,87,TRUE,1,79,TRUE,0,82,TRUE,1,70,TRUE,1,91,TRUE,0,70,TRUE,0,70,TRUE,0,92,FALSE,1,68,TRUE,1,74,TRUE,1,99,FALSE,1,100,TRUE,1,86,FALSE,1,100,TRUE,1,96,TRUE,0,86,FALSE,1,79,FALSE,1,100,TRUE,1,98,FALSE,0,67,TRUE,1,71,0,0.0016,0.0081,0,0.0841,0.0576,0.0196,0,0.1024,0.0001,0.0004,0.0441,0,0.1089,0.0256,0.0841,0,0.1225,0.0441,0,0.0676,0.09,0.8464,0.6724,0.49,0.7396,0.4489,0.2116,0.0144,0.49,0,0.7569,0.197189286,0.046385714,0.347992857,17,53.13,25,78.13,5,62.5,7,87.5,6,75,7,87.5,15,93.75,10,62.5,83.44,77.25,81.75,87.62,87.12,86.62,80.25,-25,5.31,14.75,-5.75,12.62,-0.38,-7.13,17.75,1,1,0,1,0,0,1,1,0,3,1,2,3,1,3,0,0,0,1,2,0,0,1,0,2,1,1,1,2,0,1,0,0,1,0,1,1,1,2,3,0.6,1,2,0.6,0.6,1,0.4,1.6,1.05,0.9,3.67,3.67,-2,0,2,-4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,34,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,1,1,-1,1,-2,-1,0,0,-2,3,0,2,3,0,3,-1,-1,-1,-1,-1,0,0,1.6,-1,0.15 +521,R_5OuF4lYJjPeZ2yf,46 - 52,Canadian,Female,2,3,3,1,1,-3,-3,2,-2,-3,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,5,1,1,2,1,1,6,-2,-3,-2,-2,-2,6,2,2,2,2,2,5,1,1,1,1,1,5,-1,-1,-1,-1,-1,10,-1,-1,-1,-2,2,7,1,1,1,1,1,6,TRUE,0,78,TRUE,1,71,TRUE,0,82,TRUE,0,84,FALSE,0,80,TRUE,0,90,TRUE,1,78,TRUE,1,85,FALSE,0,82,TRUE,1,85,TRUE,0,76,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,74,TRUE,1,73,FALSE,1,98,TRUE,0,74,FALSE,1,86,FALSE,1,84,TRUE,1,100,FALSE,0,65,TRUE,0,100,TRUE,1,83,TRUE,0,100,TRUE,1,100,FALSE,1,78,TRUE,0,79,FALSE,1,86,TRUE,1,88,FALSE,0,78,TRUE,1,100,0.0225,0,0.0729,0.0484,0,0.81,0.0289,0.0225,0.0256,0.4225,0.0144,0,0.6724,0.5776,0.64,0.0841,1,0.7056,0.6241,1,0,0.5476,0.0196,1,0.0004,0.0484,0.6084,0.6084,0.6724,0.5476,0.0196,1,0.417860714,0.3574,0.478321429,19,59.38,16,50,3,37.5,5,62.5,3,37.5,5,62.5,11,68.75,5,31.25,85.53,78.62,94.25,85,84.25,83.88,87.19,9.38,35.53,41.12,31.75,47.5,21.75,15.13,55.94,1,2,2,0,0,4,4,0,3,4,4,5,4,4,4,0,0,0,0,0,1,2,2,0,0,2,2,3,1,2,3,3,3,4,0,1,1,1,1,1,1,3,4.2,0,1,2,2.6,1,2.05,1.65,5.67,7.33,0,-4,-1,-1,-1.66,10 cents,100 minutes,24 days,Female,University - Undergraduate,47,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,2,2,-3,2,2,1,2,1,0,4,-1,-1,-1,-1,-1,0,1,1.6,-1,0.4 +522,R_3cx1Ajq8O3TIchj,39 - 45,American,Female,3,3,1,3,3,3,-2,3,-3,-1,3,-2,3,-2,3,1,-3,-2,-1,-3,3,3,1,3,2,1,3,-3,3,-2,0,7,3,1,1,1,3,4,2,-3,-1,1,-3,10,3,3,3,3,3,6,3,-1,3,-3,3,7,3,0,3,-3,3,4,3,3,3,3,-3,10,TRUE,0,57,FALSE,0,57,FALSE,1,100,FALSE,1,54,FALSE,0,59,FALSE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,80,TRUE,1,99,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,91,TRUE,1,85,TRUE,1,100,TRUE,0,100,TRUE,0,76,TRUE,0,100,FALSE,1,100,TRUE,1,88,TRUE,1,80,FALSE,1,69,FALSE,0,60,TRUE,0,100,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,0,55,TRUE,1,100,0.0009,0,0,0,0,0,0.36,0.0001,0,0.04,0,0,0.04,0.09,0.3481,0.3249,0.0961,0.2116,0,1,0.0144,0.0225,1,0.8281,1,0.1369,0.3025,0.3249,0,0.5776,0.3364,1,0.287646429,0.107914286,0.467378571,3,9.38,20,62.5,5,62.5,5,62.5,4,50,6,75,12,75,8,50,84.31,70.5,84.25,87.88,94.62,85,83.62,-53.12,21.81,8,21.75,37.88,19.62,10,33.62,0,0,0,0,1,0,1,0,1,1,0,3,2,3,0,1,0,1,2,0,0,0,2,0,0,0,1,0,0,4,0,2,0,1,0,2,6,5,4,0,0.2,0.6,1.6,0.8,0.4,1,0.6,3.4,0.8,1.35,4,5.67,-5,0,0,0,-1.67,20 cents,25 minutes,24 days,Female,High School (or equivalent),40,1,0,0,0,0,0,1,0,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,-2,0,1,0,0,0,1,-3,0,1,2,2,0,-1,-6,-4,-2,0,-0.2,-0.4,1,-2.6,-0.55 +523,R_1pzBtlBUOMIdBlS,53 - 59,American,Female,3,3,3,0,2,2,3,3,1,2,2,2,3,1,3,1,2,1,3,-1,1,2,3,-1,3,7,3,-1,3,-2,2,9,2,1,1,3,0,10,2,1,1,2,2,8,2,1,1,2,2,9,2,2,0,2,2,8,1,2,2,3,1,9,2,3,2,3,2,8,FALSE,1,73,TRUE,1,89,FALSE,1,100,TRUE,0,70,TRUE,1,91,FALSE,1,72,TRUE,1,100,TRUE,1,91,TRUE,1,93,TRUE,1,100,FALSE,1,88,TRUE,0,100,TRUE,1,100,FALSE,1,99,TRUE,1,85,TRUE,1,88,TRUE,0,97,TRUE,0,100,FALSE,1,90,FALSE,1,71,TRUE,1,97,TRUE,1,80,FALSE,1,61,TRUE,1,96,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,57,TRUE,0,67,TRUE,1,98,TRUE,1,80,TRUE,1,100,0.0081,0.0009,0.0144,0,0,0.0784,0.0016,0,0.0841,0.04,0.0004,0,0.0049,0.0144,0.0081,0.0121,0.1521,0.49,0.1849,0,0.0009,0.0225,0.01,0.0001,0.9409,0,0.04,0.0729,0,1,0.4489,1,0.164542857,0.063292857,0.265792857,16,50,27,84.38,7,87.5,6,75,7,87.5,7,87.5,16,100,11,68.75,88.44,86.88,85.62,93.62,87.62,92.81,84.06,-34.38,4.06,-0.62,10.62,6.12,0.12,-7.19,15.31,2,1,0,1,1,1,4,0,3,0,0,1,2,2,3,1,1,0,1,3,1,2,2,2,0,0,1,3,1,0,1,0,1,2,2,1,1,1,0,3,1,1.6,1.6,1.2,1.4,1,1.2,1.2,1.35,1.2,8.67,8.67,-2,1,1,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,56,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,1,-1,-2,-1,1,1,3,-3,2,0,-1,1,1,0,1,0,0,-1,1,0,-0.4,0.6,0.4,0,0.15 +524,R_5uxDugtohnaFA38,32 - 38,Canadian,Female,0,2,2,3,1,-1,1,2,3,0,1,0,1,0,1,-3,-2,-3,-3,-3,2,2,2,2,3,5,-1,1,0,2,1,7,1,1,1,1,1,3,1,0,1,1,0,9,2,2,2,2,2,6,-1,0,1,0,1,6,1,1,1,0,1,6,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,90,FALSE,1,50,FALSE,0,50,FALSE,1,95,TRUE,1,62,TRUE,1,67,TRUE,1,71,FALSE,0,50,FALSE,1,50,FALSE,1,52,TRUE,1,50,FALSE,1,71,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,72,FALSE,1,97,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,52,TRUE,1,77,FALSE,1,100,TRUE,1,88,TRUE,0,52,FALSE,1,54,TRUE,0,55,TRUE,1,75,FALSE,0,64,FALSE,0,53,0.1089,0.0144,0.25,0.1444,0.2809,0.0025,0.0529,0.25,0.25,0.25,0.0625,0.25,0.0841,0.25,0.25,0.25,0.2304,0.25,0.2116,0,0.25,0.25,0.0009,0.0841,0.25,0.2704,0.4096,0.25,0.81,0.5184,0.3025,0.2304,0.233971429,0.193807143,0.274135714,8,25,19,59.38,4,50,5,62.5,4,50,6,75,8,50,11,68.75,62.41,60.5,56.88,67.88,64.38,59.81,65,-34.38,3.03,10.5,-5.62,17.88,-10.62,9.81,-3.75,2,0,0,1,2,0,0,2,1,1,0,1,0,1,0,4,2,4,4,3,2,0,0,1,1,0,1,1,3,1,0,1,0,0,0,3,2,3,3,3,1,0.8,0.4,3.4,0.8,1.2,0.2,2.8,1.4,1.25,5,6,-1,1,-3,4,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,32,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,1,0,-1,1,-2,0,0,0,0,1,0,1,0,1,1,0,0.2,-0.4,0.2,0.6,0.15 +525,R_3LigOeEx4VwTQXD,39 - 45,Canadian,Female,0,2,-2,2,3,2,0,2,0,-1,1,-2,0,1,1,1,0,1,1,0,0,2,-1,1,3,3,1,-1,2,-2,0,1,2,-2,1,0,2,2,-1,0,-1,-1,-1,2,0,3,-2,2,3,3,3,1,2,-2,0,2,1,-1,1,1,1,2,0,1,1,1,0,2,TRUE,0,70,FALSE,0,72,FALSE,1,96,TRUE,0,56,FALSE,0,55,FALSE,1,63,FALSE,0,65,TRUE,1,61,FALSE,0,55,TRUE,1,59,FALSE,1,54,TRUE,0,87,TRUE,1,86,FALSE,1,60,FALSE,0,61,TRUE,1,90,FALSE,1,60,TRUE,0,83,FALSE,1,54,FALSE,1,56,FALSE,0,58,FALSE,0,57,FALSE,1,60,FALSE,0,55,TRUE,0,75,TRUE,1,69,FALSE,1,57,FALSE,1,56,FALSE,1,57,TRUE,1,54,FALSE,0,51,FALSE,0,71,0.1521,0.0961,0.01,0.4225,0.5041,0.1369,0.3025,0.1681,0.1936,0.3249,0.2116,0.0196,0.3025,0.2116,0.3025,0.5184,0.16,0.3136,0.1936,0.5625,0.3364,0.3721,0.2116,0.16,0.16,0.1849,0.2601,0.49,0.0016,0.6889,0.1849,0.7569,0.29405,0.262135714,0.325964286,12,37.5,17,53.13,3,37.5,5,62.5,3,37.5,6,75,6,37.5,11,68.75,64.47,57.5,63.75,67.25,69.38,63.69,65.25,-15.63,11.34,20,1.25,29.75,-5.62,26.19,-3.5,0,0,1,1,0,1,1,0,2,1,1,0,1,1,1,2,0,2,2,1,0,1,0,0,0,1,1,0,2,1,0,1,1,0,0,1,1,0,0,0,0.4,1,0.8,1.4,0.2,1,0.4,0.4,0.9,0.5,2,2.33,0,-1,0,0,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,40,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,-1,1,1,0,0,0,0,0,0,1,-1,0,1,1,1,-1,2,2,1,0.2,0,0.4,1,0.4 +526,R_6K8v1R7OK8j51Mo,53 - 59,Canadian,Female,-1,3,3,2,1,2,2,3,3,3,3,3,3,0,3,2,-1,1,1,3,-3,3,3,-2,3,1,3,3,3,3,3,1,3,3,3,1,3,1,1,-1,1,1,2,3,-3,3,3,3,2,0,1,2,3,1,2,0,3,3,3,-2,3,0,1,-2,1,1,2,7,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,73,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.0484,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.5329,0,0,0,0,1,1,1,1,0.235046429,0.074885714,0.395207143,27,84.38,25,78.13,8,100,6,75,6,75,5,62.5,16,100,9,56.25,98.47,100,100,96.62,97.25,100,96.94,6.25,20.34,0,25,21.62,34.75,0,40.69,2,0,0,4,2,1,1,0,0,0,0,0,0,1,0,1,0,0,0,1,2,0,0,1,1,1,0,0,2,1,0,0,0,2,0,1,1,0,0,1,1.6,0.4,0.2,0.4,0.8,0.8,0.4,0.6,0.65,0.65,1,0,1,1,1,-4,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,2,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,3,1,0,1,0,-2,-1,0,0,0,-1,0,0,-1,0,0,0,0.8,-0.4,-0.2,-0.2,0 +527,R_3GOWhHu6d27W8q6,53 - 59,Canadian,Male,2,3,2,3,2,2,-2,2,-2,1,2,1,2,2,2,2,2,2,1,2,3,2,2,2,3,2,1,-2,1,-2,1,2,2,2,2,2,1,1,1,1,1,1,2,1,1,1,2,2,1,2,1,-3,1,-2,1,1,2,1,1,2,2,1,2,2,2,2,1,7,FALSE,1,84,TRUE,1,79,TRUE,0,76,FALSE,1,76,TRUE,1,76,FALSE,1,77,TRUE,1,87,TRUE,1,92,TRUE,1,82,FALSE,0,78,FALSE,1,85,TRUE,0,87,FALSE,0,82,TRUE,0,82,FALSE,0,81,TRUE,1,86,TRUE,0,84,TRUE,0,87,FALSE,1,88,FALSE,1,87,FALSE,0,87,FALSE,0,87,FALSE,1,83,TRUE,1,87,FALSE,1,82,TRUE,1,86,FALSE,1,88,TRUE,0,83,FALSE,1,83,TRUE,1,86,FALSE,0,87,FALSE,0,91,0.0064,0.0196,0.0196,0.0169,0.8281,0.0529,0.0169,0.6084,0.0169,0.7569,0.0196,0.6724,0.0324,0.0225,0.0576,0.0441,0.0289,0.0576,0.6889,0.0324,0.7569,0.6561,0.0144,0.6724,0.7056,0.0144,0.7569,0.0256,0.5776,0.7569,0.0289,0.7569,0.344967857,0.229657143,0.460278571,26,81.25,19,59.38,6,75,4,50,4,50,5,62.5,9,56.25,10,62.5,83.94,83.25,82.88,84.12,85.5,84.62,83.25,21.87,24.56,8.25,32.88,34.12,23,28.37,20.75,1,1,0,1,1,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,1,2,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0.8,0.4,0.4,0.6,1,0.6,0.2,0.4,0.55,0.55,1.67,1.33,0,1,0,-6,0.34,10 cents,100 minutes,24 days,Male,University - Undergraduate,58,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,-1,0,0,0,0,-1,0,0,0,0,1,-1,0,1,1,1,1,-1,-1,-0.2,-0.2,0.2,0.2,0 +528,R_16gYUufnZvp69ln,39 - 45,Canadian,Female,1,2,1,0,-1,-2,-2,1,1,1,1,1,2,-1,0,-1,0,-1,-2,-2,2,2,1,-1,0,3,-1,-2,1,2,1,2,1,0,2,1,1,3,0,1,-1,1,-1,2,2,2,2,-1,0,1,-2,-2,2,1,1,1,1,2,2,-1,0,2,0,0,0,-1,-2,3,TRUE,0,80,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,70,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,50,TRUE,0,95,TRUE,1,65,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,65,TRUE,0,90,TRUE,0,70,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,75,TRUE,1,75,TRUE,0,70,TRUE,1,65,FALSE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,85,0,0.1225,0,0,0.0225,0,0.0625,0,0.25,0.25,0.01,0.1225,0.1225,0.25,0.09,0.1225,0.0625,0.25,0.5625,0.49,0.25,0.25,0.49,0.25,0.4225,0.25,0.25,0.64,0.25,0.81,0.25,0.9025,0.274375,0.115357143,0.433392857,18,56.25,22,68.75,5,62.5,6,75,5,62.5,6,75,13,81.25,9,56.25,70.31,56.25,70,75.62,79.38,73.75,66.88,-12.5,1.56,-6.25,-5,13.12,4.38,-7.5,10.63,1,0,0,1,1,1,0,0,1,0,0,1,0,2,1,1,1,0,3,1,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.8,1.2,0.8,0.2,0.2,0.6,0.75,0.45,2.67,1.33,2,1,1,-1,1.34,10 cents,25 minutes,24 days,Female,University - Undergraduate,42,0.875,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,-1,0,0,1,0,-1,1,0,0,0,0,2,1,0,1,-1,2,1,-0.2,0.2,0.6,0.6,0.3 +529,R_7JFQ49rioJVFELu,46 - 52,Canadian,Female,1,0,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,6,0,1,-1,0,0,6,-1,1,0,1,0,6,0,1,0,-1,1,6,0,0,1,1,1,6,0,-1,1,0,1,6,0,1,1,0,-1,6,0,-1,1,1,2,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,62,TRUE,0,80,TRUE,1,88,FALSE,0,57,TRUE,1,91,0.25,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0.25,0.25,0.0144,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1444,0,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.25,0.25,0.25,0.64,0.25,0.23685,0.215892857,0.257807143,13,40.63,17,53.13,4,50,4,50,4,50,5,62.5,2,12.5,15,93.75,55.56,50.88,58.88,56.25,56.25,55.38,55.75,-12.5,2.43,0.88,8.88,6.25,-6.25,42.88,-38,1,0,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,0,1,0,1,0,0,0,1,1,2,1,0,1,0,1,0,0,2,0,2,1,1,1,0.4,0.4,1,0.2,0.4,1,0.6,1,0.5,0.75,6,6,0,0,0,0,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,47,0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,1,0,-1,0,-2,0,0,-1,1,0,1,1,-1,0,-2,-1,0,-1,0,-0.6,0.4,-0.8,-0.25 +530,R_3DqhW2ozlQPLiUG,39 - 45,Canadian,Male,2,2,2,2,2,0,-2,2,0,0,1,2,1,0,1,0,-1,-2,0,0,1,1,1,1,1,5,2,1,1,1,1,6,-1,1,1,0,0,5,0,1,1,0,0,5,1,2,2,1,1,6,1,1,1,1,1,6,0,2,0,-1,-2,6,0,0,0,-1,0,6,FALSE,1,91,TRUE,1,65,TRUE,0,60,FALSE,1,62,TRUE,1,100,FALSE,1,73,FALSE,0,78,FALSE,0,81,TRUE,1,93,TRUE,1,83,FALSE,1,94,TRUE,0,85,TRUE,1,82,TRUE,0,62,TRUE,1,61,TRUE,1,100,TRUE,0,73,FALSE,1,62,FALSE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,1,76,TRUE,1,81,FALSE,1,77,FALSE,0,77,TRUE,0,79,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,1,85,TRUE,1,75,0.6561,0.5929,0,0.6084,0.0625,0.0729,0.0361,0.0289,0.04,0,0,0.0324,0.0049,0.0036,0,0.1225,0.0576,0.1444,0,0.0529,0,0.1521,0,0.3844,0.5329,0.6241,0.0225,0.0081,0.36,0.1444,0.9409,0.7225,0.162521429,0.043271429,0.281771429,16,50,23,71.88,7,87.5,6,75,5,62.5,5,62.5,13,81.25,10,62.5,82.25,79.88,84.5,78.75,85.88,85.06,79.44,-21.88,10.37,-7.62,9.5,16.25,23.38,3.81,16.94,1,1,1,1,1,2,3,1,1,1,2,1,0,0,1,0,2,3,0,0,1,0,0,1,1,1,3,1,1,1,1,0,1,1,3,0,1,2,1,0,1,1.6,0.8,1,0.6,1.4,1.2,0.8,1.1,1,5.33,6,-1,0,-1,-1,-0.67,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),42,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,1,1,0,0,1,0,0,0,0,1,1,-1,-1,-2,0,1,1,-1,0,0.4,0.2,-0.4,0.2,0.1 +531,R_601MBPZ8B6KePPS,53 - 59,Canadian,Female,2,2,2,2,1,-2,-2,2,2,-1,2,1,2,-1,2,0,-1,1,-1,-1,2,2,2,2,1,2,-3,-2,1,1,-2,4,2,1,2,-1,1,5,-1,-2,0,-1,-1,7,2,2,2,2,1,3,-2,-2,2,1,-2,6,2,1,2,0,2,2,1,0,2,1,-1,5,FALSE,1,60,FALSE,0,50,TRUE,0,80,FALSE,1,50,FALSE,0,95,FALSE,1,50,TRUE,1,85,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,60,TRUE,0,100,TRUE,1,70,TRUE,0,85,TRUE,1,60,FALSE,0,65,FALSE,1,60,TRUE,0,100,TRUE,0,60,FALSE,1,70,TRUE,1,70,TRUE,1,55,FALSE,1,60,TRUE,1,70,TRUE,0,80,TRUE,1,60,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,60,TRUE,1,90,0,0.16,0.4225,0.0225,0.01,0.25,0.09,0,0.09,0.2025,0,0.09,0.16,0.36,0.9025,0.25,0.16,0.25,0.25,0.64,0.09,0.16,0.36,0.7225,0.16,0.25,0.16,0.16,0.64,1,0.25,1,0.309196429,0.201071429,0.417321429,23,71.88,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,13,81.25,9,56.25,70.47,56.25,68.12,78.12,79.38,74.38,66.56,3.13,1.72,-6.25,-19.38,15.62,16.88,-6.87,10.31,0,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,1,1,2,0,0,0.8,0.2,0.6,0,0.4,0.2,1,0.4,0.4,3.67,3.67,-1,-2,3,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,56,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,1,0,0,0,0,0,-1,1,0,0,0,-2,0,0,0.4,0,-0.4,0 +532,R_3PCAiCZh86iZFZL,67 - 73,Canadian,Male,2,1,2,1,3,-1,1,2,-3,1,1,2,2,-1,1,1,-1,2,1,-2,1,2,1,0,3,3,-2,1,2,-3,2,6,1,2,3,-1,1,4,0,1,1,1,-1,4,0,1,2,3,-1,6,-1,2,0,1,-1,7,-1,1,1,-2,1,8,-1,-2,-1,2,-2,4,TRUE,0,76,TRUE,1,100,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,58,TRUE,1,100,FALSE,1,100,FALSE,1,91,FALSE,0,98,TRUE,0,97,FALSE,0,60,TRUE,1,100,FALSE,1,57,TRUE,0,74,TRUE,0,95,FALSE,1,50,FALSE,0,62,TRUE,1,95,FALSE,1,87,TRUE,1,75,FALSE,1,90,TRUE,1,74,TRUE,0,71,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,0,100,TRUE,1,92,0,0.0676,0,0,0.0064,0,0.0625,0,0.25,0.0025,1,0.9604,0.1764,0,0,0,0.0169,0.0576,1,0.01,0.3844,0.36,0.9025,0.9409,0.1849,0.5041,1,0.5776,1,0.5476,1,0.0081,0.391171429,0.180907143,0.601435714,22,68.75,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,86.81,82.5,87,88.25,89.5,88.38,85.25,9.37,27.43,32.5,24.5,25.75,27,19.63,35.25,1,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,2,1,0,1,2,0,0,2,4,0,1,2,4,2,2,1,1,1,0,2,1,3,1,0,0.8,0.4,0.2,1,1.6,1.8,1,1.4,0.6,1.45,4.33,7,-3,-1,-4,0,-2.67,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),69,0.875,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,1,1,-1,-4,1,-1,-2,-4,-1,-2,-1,0,-1,0,-1,1,-2,-1,1,-0.8,-1.4,-0.8,-0.4,-0.85 +533,R_6khUynIGgapHzgG,46 - 52,American,Male,3,3,3,3,0,-1,-2,0,0,2,0,-3,2,-1,3,-1,-1,0,0,-2,3,3,3,3,2,2,-1,-2,0,-1,2,1,0,-3,2,-1,3,2,0,0,0,0,-2,2,3,3,3,3,2,1,0,-2,0,-1,2,4,0,-3,2,-1,3,1,0,0,0,0,-1,2,FALSE,1,100,FALSE,0,82,FALSE,1,68,FALSE,1,69,FALSE,0,72,FALSE,1,80,TRUE,1,84,TRUE,1,83,TRUE,1,77,TRUE,1,91,FALSE,1,78,TRUE,0,83,TRUE,1,77,TRUE,0,59,FALSE,0,62,TRUE,1,85,FALSE,1,56,TRUE,0,86,TRUE,0,62,FALSE,1,100,FALSE,0,78,TRUE,1,74,FALSE,1,100,TRUE,1,79,FALSE,1,50,TRUE,1,85,FALSE,1,52,FALSE,1,54,TRUE,0,70,TRUE,1,84,TRUE,1,61,TRUE,1,91,0.0289,0.0225,0.0225,0.0256,0.0081,0.04,0.0441,0.0081,0,0.0676,0.0256,0.0529,0.0529,0.0484,0.5184,0.6724,0,0.0961,0.2116,0.25,0.6084,0.3844,0.3844,0.3481,0.1936,0.2304,0.1521,0,0.1024,0.7396,0.49,0.6889,0.229232143,0.116757143,0.341707143,14,43.75,23,71.88,5,62.5,5,62.5,6,75,7,87.5,12,75,11,68.75,76,67.88,78,78.62,79.5,79.06,72.94,-28.13,4.12,5.38,15.5,3.62,-8,4.06,4.19,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0.4,0.2,0,0.4,0.4,0.4,0,0.6,0.25,0.35,1.67,2,1,-3,1,0,-0.33,15 cents,25 minutes,24 days,Male,High School (or equivalent),46,1.5,0,0,0,0,0,1,0,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-0.2,0,-0.2,-0.1 +534,R_3wafSDodTn91koj,39 - 45,Canadian,Male,2,3,3,2,2,1,-1,1,-3,-2,3,1,2,1,1,2,1,2,1,-1,2,3,3,2,2,7,1,-2,1,-2,-3,7,3,1,2,0,1,3,0,1,0,0,0,7,2,3,3,2,2,3,1,-2,3,-3,-2,3,3,1,2,0,1,3,2,2,2,2,1,7,TRUE,0,85,FALSE,0,75,TRUE,0,91,FALSE,1,100,TRUE,1,79,FALSE,1,92,TRUE,1,88,FALSE,0,76,FALSE,0,92,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,84,FALSE,1,87,FALSE,0,66,TRUE,1,92,TRUE,0,71,FALSE,1,91,FALSE,1,94,FALSE,1,100,TRUE,1,83,TRUE,1,89,FALSE,1,74,TRUE,1,93,FALSE,1,92,FALSE,0,77,FALSE,1,91,FALSE,1,76,TRUE,0,85,TRUE,1,100,FALSE,0,77,TRUE,1,80,0.5776,0.5929,0.0064,0.0144,0.04,0.0064,0.0049,0,0,0.0121,0,0.0256,0.8464,0.0324,0.0441,0.5625,0.0676,0,0.0576,0.0064,0.0289,0.4356,0.0036,0.0169,0.5041,0.0081,0.5929,0.7225,0.8281,0.0081,0.7225,1,0.234903571,0.117285714,0.352521429,16,50,21,65.63,4,50,6,75,6,75,5,62.5,10,62.5,11,68.75,86.31,84.62,81,88.62,91,84.44,88.19,-15.63,20.68,34.62,6,13.62,28.5,21.94,19.44,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,2,0,2,1,1,0,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,1,0,1,2,0,0.6,0.2,1.2,0,0.6,0.2,0.8,0.5,0.4,5.67,3,4,4,0,0,2.67,5 cents,100 minutes,24 days,Male,University - Undergraduate,42,0.75,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,-2,1,1,0,0,0,0,0,2,-1,2,0,-1,0,0,0,0.4,0.1 +535,R_5RsJ6LV9TQfp9At,60 - 66,American,Female,3,2,3,1,0,2,1,-1,-1,3,3,0,2,2,1,1,2,0,1,-2,1,3,3,-1,1,5,1,-1,2,0,2,5,2,-1,1,3,0,5,-1,0,-1,-2,-2,7,2,2,2,-2,1,7,1,-3,2,-3,-2,6,-2,-2,2,0,2,5,1,-1,0,-2,-2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,1,80,FALSE,1,87,TRUE,1,88,TRUE,1,91,TRUE,1,79,FALSE,0,86,FALSE,1,83,TRUE,0,69,TRUE,1,99,TRUE,0,100,TRUE,1,61,TRUE,1,95,FALSE,1,87,FALSE,1,96,TRUE,0,93,FALSE,1,70,TRUE,1,82,TRUE,1,95,FALSE,1,85,TRUE,1,92,TRUE,0,87,TRUE,1,97,TRUE,0,76,FALSE,1,82,TRUE,0,89,TRUE,1,92,FALSE,0,70,TRUE,1,100,0.0081,0.0009,0.0025,0.0144,0,0.0169,0.0064,0.7396,0.09,0.0025,0.0064,0.0001,0.0441,0.0289,0.04,0,0.0225,0.1444,0.0324,0.7569,0.0324,0.1521,0.8649,1,0.0169,0.5776,0.49,1,0,0.0016,0.7921,0.4761,0.261957143,0.081557143,0.442357143,24,75,23,71.88,5,62.5,7,87.5,4,50,7,87.5,14,87.5,9,56.25,86.66,78,88.62,93.62,86.38,87.94,85.38,3.12,14.78,15.5,1.12,43.62,-1.12,0.44,29.13,2,1,0,2,1,1,2,3,1,1,1,1,1,1,1,2,2,1,3,0,1,0,1,3,1,1,4,3,2,5,5,2,0,2,1,0,3,0,3,0,1.2,1.6,1,1.6,1.2,3,2,1.2,1.35,1.85,5,6,-2,-1,0,2,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,1,1,-1,-1,0,0,-2,0,-1,-4,-4,-1,1,-1,0,2,-1,1,0,0,0,-1.4,-1,0.4,-0.5 +536,R_52aH641n3e20uMV,39 - 45,American,Female,3,2,1,1,2,-1,-3,2,-3,0,2,2,3,-1,1,2,2,2,2,1,3,3,2,-1,3,5,-1,-3,2,-2,-1,7,1,0,1,-1,0,5,1,0,1,0,1,5,3,3,2,0,3,5,0,-3,1,-2,0,6,1,0,2,-1,0,5,2,2,2,2,2,5,FALSE,1,81,TRUE,1,96,FALSE,1,63,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,91,TRUE,1,97,FALSE,0,54,FALSE,0,58,FALSE,1,73,TRUE,0,93,FALSE,0,89,TRUE,0,93,TRUE,1,87,TRUE,1,85,TRUE,0,94,TRUE,0,99,FALSE,1,50,FALSE,1,100,TRUE,1,92,TRUE,1,93,FALSE,1,92,FALSE,0,50,FALSE,1,94,TRUE,1,81,FALSE,1,63,FALSE,1,68,TRUE,0,89,TRUE,1,86,FALSE,0,50,TRUE,1,86,0.0009,0.0361,0.0225,0.0081,0.0196,0,0.25,0.3364,0,0.0049,0.0196,0.7921,0.2916,0.0729,0.25,0.0016,0.0064,0.25,0.1024,0.0036,0.0064,0.0169,0.25,0.8649,0.8836,0.1369,0.25,0.0361,0.1369,0.9801,0.7921,0.8649,0.272139286,0.163935714,0.380342857,17,53.13,21,65.63,6,75,4,50,5,62.5,6,75,10,62.5,11,68.75,79.59,65.38,86.5,86.25,80.25,77.81,81.38,-12.5,13.96,-9.62,36.5,23.75,5.25,15.31,12.63,0,1,1,2,1,0,0,0,1,1,1,2,2,0,1,1,2,1,2,0,0,1,1,1,1,1,0,1,1,0,1,2,1,0,1,0,0,0,0,1,1,0.4,1.2,1.2,0.8,0.6,1,0.2,0.95,0.65,5.67,5.33,0,1,0,0,0.34,10 cents,75 minutes,47 days,Female,College Diploma/Certificate,42,0.375,0,0,1,1,0,0,0.33,0.33,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,1,0,-1,0,-1,0,1,0,0,1,0,0,1,2,1,2,-1,0.2,-0.2,0.2,1,0.3 +537,R_6A8dwSRHTK7fgo9,46 - 52,American,Female,3,3,3,3,1,0,-1,3,0,1,1,1,3,-1,3,-1,-3,-2,1,-1,3,3,3,3,0,10,0,-1,3,0,0,10,3,3,3,-3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,0,-1,3,-1,1,10,3,3,3,-1,3,10,3,3,3,3,3,10,TRUE,0,81,TRUE,1,70,TRUE,0,100,TRUE,0,77,TRUE,1,66,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,66,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,95,TRUE,1,90,TRUE,0,85,TRUE,0,100,TRUE,0,99,TRUE,0,75,TRUE,1,96,TRUE,1,99,TRUE,0,72,TRUE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,66,FALSE,1,63,TRUE,0,67,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0,0.01,0,0,1,0.0576,0,0.5625,0.0001,0,0,0.1156,0.8464,0.1156,0.09,0.5184,0.5929,0.1369,1,0.0016,0.0025,0.9801,1,0.7225,0.4356,0.3364,0.6561,1,1,0.4489,1,0.450703571,0.278507143,0.6229,28,87.5,16,50,3,37.5,4,50,4,50,5,62.5,15,93.75,1,6.25,87.28,77.88,85.75,97.5,88,88.5,86.06,37.5,37.28,40.38,35.75,47.5,25.5,-5.25,79.81,0,0,0,0,1,0,0,0,0,1,2,2,0,2,0,4,6,5,2,4,0,0,0,0,2,0,0,0,1,0,2,2,0,0,0,4,6,5,2,4,0.2,0.2,1.2,4.2,0.4,0.2,0.8,4.2,1.45,1.4,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),47,0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,0,-1,1,0,0,0,2,0,0,0,0,0,0,-0.2,0,0.4,0,0.05 +538,R_3wme3XCgzo0jj81,53 - 59,Canadian,Female,3,3,0,0,3,2,-2,3,-2,2,1,1,2,-2,3,0,0,1,2,-1,3,3,1,-2,3,3,2,-3,3,0,2,2,2,1,1,0,3,3,-2,-2,-1,1,-2,8,3,3,1,1,3,2,1,-2,2,0,1,2,1,0,3,-2,3,1,0,0,0,1,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,84,FALSE,1,100,TRUE,0,83,FALSE,1,50,FALSE,0,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,71,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0.81,0.0064,0,0,0.25,0,0,0.7396,0.25,0.6889,1,0.7056,0,0.0841,0,0,0,1,1,0.251235714,0.111885714,0.390585714,26,81.25,25,78.13,6,75,5,62.5,7,87.5,7,87.5,15,93.75,10,62.5,90.81,74.25,95.25,100,93.75,90.56,91.06,3.12,12.68,-0.75,32.75,12.5,6.25,-3.19,28.56,0,0,1,2,0,0,1,0,2,0,1,0,1,2,0,2,2,2,1,1,0,0,1,1,0,1,0,1,2,1,0,1,1,0,0,0,0,1,1,0,0.6,0.6,0.8,1.6,0.4,1,0.4,0.4,0.9,0.55,2.67,1.67,1,0,2,3,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,58,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,1,0,-1,1,-1,0,-1,1,-1,0,2,0,2,2,1,0,1,0.2,-0.4,0.4,1.2,0.35 +539,R_1lLGG34Y7Qr2q1x,53 - 59,Canadian,Female,3,3,3,2,1,3,-2,3,-2,-1,-1,1,3,-3,1,-1,0,1,0,1,3,3,2,2,2,2,3,1,3,1,2,4,-2,1,3,-3,1,3,-2,3,3,-3,0,10,3,3,3,3,2,0,3,-2,3,-2,0,0,-1,1,3,-3,1,8,2,0,2,2,-1,10,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,78,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,52,TRUE,0,86,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0.25,0.25,0,0,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.7396,1,0.0484,0.25,0.25,0.25,0.25,0.2304,0.25,1,1,1,0.25,1,0.384585714,0.232142857,0.537028571,10,31.25,18,56.25,4,50,6,75,4,50,4,50,8,50,10,62.5,73.94,50.25,66,87.5,92,76.75,71.12,-25,17.69,0.25,-9,37.5,42,26.75,8.62,0,0,1,0,1,0,3,0,3,3,1,0,0,0,0,1,3,2,3,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,3,0,1,2,2,0.4,1.8,0.2,2,0.4,0.2,0,1.6,1.1,0.55,3,2.67,2,4,-5,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,0,1,-1,0,0,3,0,3,2,1,0,0,0,0,-2,3,1,1,-1,0,1.6,0.2,0.4,0.55 +540,R_7bejcOOpN7kMZ8d,46 - 52,American,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,10,2,2,2,2,2,9,2,2,2,2,2,7,0,0,0,0,0,8,0,0,0,0,0,7,3,3,3,3,3,10,FALSE,1,58,TRUE,1,55,TRUE,0,100,TRUE,0,89,FALSE,0,53,TRUE,0,57,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,53,FALSE,1,52,TRUE,0,100,TRUE,1,100,FALSE,1,52,TRUE,1,51,FALSE,0,50,FALSE,1,52,TRUE,0,100,TRUE,0,52,TRUE,0,52,TRUE,1,53,FALSE,0,52,FALSE,1,51,TRUE,1,51,TRUE,0,52,TRUE,1,52,FALSE,1,52,FALSE,1,55,TRUE,0,53,TRUE,1,54,FALSE,0,52,TRUE,1,51,0,0.2304,0.25,0,0.2401,0.3249,0.2401,0.2209,0.2704,0.2704,0.2116,0,0.2304,0.2304,0.2809,0.2025,0.2401,0.7921,0.2025,0.2704,0.2209,0.2401,0.2704,0.2304,0.2304,0.2304,0.2704,0.1764,1,1,0.2809,1,0.334928571,0.2682,0.401657143,25,78.13,19,59.38,5,62.5,5,62.5,5,62.5,4,50,12,75,7,43.75,62.69,56.88,58.75,64.88,70.25,61.19,64.19,18.75,3.31,-5.62,-3.75,2.38,20.25,-13.81,20.44,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,2,2,2,2,2,0,0,3,2,1.25,9,7.33,1,1,3,-1,1.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,49,0,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,0,2,2,-1,0.75 +541,R_5uZJkBhivI2UNcp,46 - 52,Canadian,Male,3,3,1,-2,2,-2,-3,2,-1,2,2,0,1,-1,2,0,1,2,1,2,3,3,1,-2,2,4,-3,-3,2,-2,2,4,2,1,1,-2,1,4,-1,1,1,1,2,8,3,3,-2,0,2,7,-2,-1,2,0,1,7,2,0,0,-2,2,7,2,2,2,2,2,6,FALSE,1,100,TRUE,1,59,TRUE,0,66,TRUE,0,56,TRUE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,77,TRUE,0,55,FALSE,1,58,TRUE,1,75,FALSE,1,100,TRUE,1,69,TRUE,1,100,TRUE,0,57,FALSE,1,100,FALSE,1,57,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,0,90,TRUE,1,80,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0.64,0,0.0529,0,0,0.04,0.0625,0,0.3025,0,0.1681,0,0.3136,0.5625,0,1,0.0961,0.1849,0,0.3249,1,0.09,0,0.4356,0,0.81,0.1764,0.223571429,0.112828571,0.334314286,26,81.25,23,71.88,5,62.5,4,50,8,100,6,75,15,93.75,8,50,85.12,70.75,87.75,97.12,84.88,89.38,80.88,9.37,13.24,8.25,37.75,-2.88,9.88,-4.37,30.88,0,0,0,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,3,2,0,0,2,0,1,1,0,0,1,1,0,2,1,0,1,0,0,0.4,0.6,0.4,1,0.8,0.4,0.8,0.35,0.75,4,7,-3,-3,-3,2,-3,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),48,0.875,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,-3,-2,0,1,-2,0,0,-1,0,1,-1,0,1,-1,-1,1,-1,0,-1,-0.4,0.2,-0.4,-0.4 +542,R_7JJSpreMxXWxp8d,60 - 66,American,Female,1,1,1,0,1,1,-3,3,1,1,3,3,2,0,3,-2,-2,-2,0,-1,0,3,0,-1,3,5,1,-3,3,-2,2,1,3,3,3,0,3,3,0,2,2,0,-2,10,2,2,2,1,0,5,2,-3,3,0,2,7,3,3,3,0,3,6,0,0,0,0,0,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,50,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,89,FALSE,1,100,FALSE,1,86,TRUE,1,100,TRUE,1,60,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0.25,0,0.25,0.25,0,0.25,0,0.25,0.25,0,0.5625,0.25,0.25,0.5625,0.36,0.25,0.7921,0.16,1,0,0,0.0196,1,0.248453571,0.125,0.371907143,24,75,19,59.38,4,50,5,62.5,4,50,6,75,10,62.5,9,56.25,79.53,71.75,67,85.62,93.75,78.75,80.31,15.62,20.15,21.75,4.5,35.62,18.75,16.25,24.06,1,2,1,1,2,0,0,0,3,1,0,0,1,0,0,2,4,4,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,0,0,2,2,2,0,1,1.4,0.8,0.2,2.2,1,0.6,0.2,1.4,1.15,0.8,3,6,0,-6,-3,5,-3,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,1,0,0,1,-1,0,0,2,0,0,0,0,0,0,0,2,2,0,0,0.4,0.2,0,0.8,0.35 +543,R_1TcIkOx0f3EjeRX,46 - 52,Canadian,Male,1,2,2,-2,2,0,0,2,0,2,0,0,0,0,0,-2,-1,-2,-3,0,3,3,3,0,3,1,1,1,1,0,1,2,-3,-3,-3,-3,-3,9,-3,-3,-3,-3,-3,2,3,3,1,3,3,3,0,0,3,0,3,2,0,0,0,0,0,2,1,-1,1,-2,-3,1,TRUE,0,93,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,58,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,57,FALSE,0,50,TRUE,1,57,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,66,TRUE,0,71,FALSE,0,60,FALSE,0,57,TRUE,1,100,0,0,0.1849,0,0,0,0,0,0,0.0025,0.36,1,0.25,0,0.1764,0.25,0,0.25,0.4356,0,0,0.25,0,0.3249,0,0.25,0.3249,0.8649,1,0,0.5041,1,0.258689286,0.163492857,0.353885714,25,78.13,22,68.75,6,75,6,75,6,75,4,50,12,75,10,62.5,83.25,63.38,91.12,93.12,85.38,79.81,86.69,9.38,14.5,-11.62,16.12,18.12,35.38,4.81,24.19,2,1,1,2,1,1,1,1,0,1,3,3,3,3,3,1,2,1,0,3,2,1,1,5,1,0,0,1,0,1,0,0,0,0,0,3,0,3,1,3,1.4,0.8,3,1.4,2,0.4,0,2,1.65,1.1,4,2.33,-2,0,7,1,1.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,46,1.375,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-3,0,1,1,0,0,0,3,3,3,3,3,-2,2,-2,-1,0,-0.6,0.4,3,-0.6,0.55 +544,R_1NWsBClOlYG35WF,39 - 45,Canadian,Male,3,3,2,-1,2,0,2,3,0,2,0,0,1,3,1,1,0,1,0,0,0,1,1,1,0,8,1,0,0,0,1,8,1,0,0,-1,1,7,-1,1,0,2,2,5,1,3,2,2,3,7,3,2,1,3,2,8,0,-1,3,3,0,8,-1,0,3,3,3,8,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,64,FALSE,0,94,TRUE,0,97,TRUE,1,85,TRUE,1,50,TRUE,1,55,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,0,66,FALSE,1,100,TRUE,0,97,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0,0,0.0225,0,0.9409,0,0,1,0,0,0,0.2025,0.0036,0.8836,0,0,0.1296,0.25,1,0.25,0,0.9409,0.0025,0.4356,0.25,0.25,1,0.25,0,1,1,0.349614286,0.225728571,0.4735,22,68.75,20,62.5,6,75,3,37.5,6,75,5,62.5,13,81.25,7,43.75,85.84,76.25,88.38,97.5,81.25,86.5,85.19,6.25,23.34,1.25,50.88,22.5,18.75,5.25,41.44,3,2,1,2,2,1,2,3,0,1,1,0,1,4,0,2,1,1,2,2,2,0,0,3,1,3,0,2,3,0,0,1,2,0,1,2,0,2,3,3,2,1.4,1.2,1.6,1.2,1.6,0.8,2,1.55,1.4,7.67,7.67,1,0,-1,-3,0,10 cents,100 minutes,36 days,Male,University - Graduate (Masters),43,1,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,2,1,-1,1,-2,2,1,-3,1,1,-1,-1,4,-1,0,1,-1,-1,-1,0.8,-0.2,0.4,-0.4,0.15 +545,R_5TmIC9FlspsxFG1,46 - 52,American,Female,1,3,3,0,3,2,-1,2,-2,0,-1,2,2,0,2,-3,0,-1,0,1,2,2,2,0,3,6,2,-1,2,-2,2,4,-1,2,2,0,2,6,-2,1,2,-1,2,5,3,2,2,0,2,4,2,-2,2,-2,2,6,0,2,2,2,2,2,-2,-2,0,-1,2,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,95,TRUE,1,96,TRUE,1,95,TRUE,1,95,TRUE,1,91,FALSE,1,100,TRUE,0,100,FALSE,0,92,TRUE,0,100,TRUE,1,97,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,95,FALSE,1,100,TRUE,1,92,TRUE,0,50,TRUE,1,92,FALSE,1,95,FALSE,1,91,FALSE,1,91,FALSE,0,90,TRUE,1,100,TRUE,1,95,0.0025,0.0064,0,0.0016,0.0025,0.0025,0.0064,0.0081,0,0.0025,0.81,0.8464,0.0025,0,0,0,0,0.01,0.0081,0.25,0.0016,0.0009,0,1,1,0.0025,0,0,0,0,0.0081,1,0.177217857,0.120778571,0.233657143,25,78.13,26,81.25,8,100,6,75,6,75,6,75,14,87.5,12,75,94.94,97.12,96.12,90.5,96,95.38,94.5,-3.12,13.69,-2.88,21.12,15.5,21,7.88,19.5,1,1,1,0,0,0,0,0,0,2,0,0,0,0,0,1,1,3,1,1,2,1,1,0,1,0,1,0,0,2,1,0,0,2,0,1,2,1,1,1,0.6,0.4,0,1.4,1,0.6,0.6,1.2,0.6,0.85,5.33,4,2,-2,4,3,1.33,10 cents,25 minutes,24 days,Female,University - Undergraduate,52,-0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,0,0,0,-1,0,-1,0,0,0,-1,0,0,-2,0,0,-1,2,0,0,-0.4,-0.2,-0.6,0.2,-0.25 +546,R_5C7I2Ai9dXQSlDi,25 - 31,Canadian,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,99,TRUE,1,100,TRUE,1,100,TRUE,1,99,0,0,0,0.0001,0.0001,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,0.9801,1,0.9801,1,0.570010714,0.35715,0.782871429,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,99.88,100,99.75,99.88,99.88,99.88,99.88,50,49.88,50,49.75,49.88,49.88,-0.12,99.88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,29,0,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +547,R_7dzuwtiPAfCbbt7,60 - 66,American,Female,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,2,2,1,1,1,1,1,1,8,1,1,1,1,1,8,0,0,0,0,0,8,1,1,1,1,1,9,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,91,TRUE,1,100,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,89,TRUE,0,100,TRUE,0,96,TRUE,0,92,FALSE,0,94,TRUE,1,98,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,96,0,0,0,0,0.0016,0.0049,0,0,0.8464,0.0004,0,0,0.0064,1,0,0,0.9604,0.8281,0,0,0.8836,0,0.9216,1,0.0121,0.8281,0.0025,0.9216,1,1,0,1,0.400632143,0.260585714,0.540678571,25,78.13,20,62.5,4,50,6,75,5,62.5,5,62.5,15,93.75,5,31.25,97.53,95.62,96.25,99.25,99,98.44,96.62,15.63,35.03,45.62,21.25,36.75,36.5,4.69,65.37,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0.2,0,0,0.4,0.2,0,1,0.4,0.15,0.4,8,8,0,0,0,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),63,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-1,0,-0.25 +548,R_5KGw8CVCkXeVwY0,60 - 66,American,Female,2,1,2,2,2,1,-2,3,-2,-2,2,0,1,-2,2,0,1,1,1,-2,2,2,2,1,2,6,2,-2,2,1,-2,4,2,0,2,-2,2,4,0,0,0,0,-2,5,2,1,2,2,2,2,1,0,1,0,-3,2,1,1,1,-2,2,3,-1,-1,0,-1,-2,3,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,55,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,98,FALSE,1,80,TRUE,0,100,FALSE,0,100,TRUE,0,98,TRUE,1,95,TRUE,1,100,FALSE,1,85,FALSE,1,100,TRUE,0,90,FALSE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,90,TRUE,1,90,TRUE,0,85,TRUE,1,85,FALSE,1,65,FALSE,1,90,TRUE,0,90,TRUE,1,100,FALSE,0,70,TRUE,1,100,0,0.0225,0,0,0,0,0.01,0.0004,0,0.01,0,1,0.0001,0.04,1,0,0.01,0.2025,0.01,0.7225,0.01,0.0025,0.81,0.9604,0.0225,0.1225,0.49,0,1,0,0.81,1,0.29405,0.162357143,0.425742857,25,78.13,23,71.88,6,75,5,62.5,6,75,6,75,13,81.25,10,62.5,92.03,81.75,94.38,94.5,97.5,94.81,89.25,6.25,20.15,6.75,31.88,19.5,22.5,13.56,26.75,0,1,0,1,0,1,0,1,3,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,2,2,2,1,1,1,0,0,0,1,2,1,2,0,0.4,1,0.2,0.6,0,1.4,0.4,1.2,0.55,0.75,4.67,2.33,4,2,1,2,2.34,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),65,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,1,0,1,0,1,-2,-1,1,-1,-1,-1,1,0,0,-1,-1,0,-1,0,0.4,-0.4,-0.2,-0.6,-0.2 +549,R_5qZ4y6NaJUrH4kh,53 - 59,American,Male,3,3,3,3,3,-3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,-3,-3,3,-3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,-3,-3,3,-3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,0.535714286,0.357142857,0.714285714,16,50,17,53.13,3,37.5,4,50,4,50,6,75,12,75,5,31.25,100,100,100,100,100,100,100,-3.13,46.87,62.5,50,50,25,25,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),58,-0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +550,R_7KkIoV41qxnDucT,46 - 52,American,Male,2,1,-1,2,-1,-2,0,1,1,-1,2,1,2,1,1,-1,-1,-1,1,-2,2,2,2,2,-2,3,-2,0,2,2,1,3,2,1,2,1,1,1,-1,-2,-1,-2,-2,1,2,2,1,2,0,2,-2,0,2,-1,-2,3,2,1,1,-1,1,2,-1,-1,0,-2,-2,2,TRUE,0,97,TRUE,1,92,TRUE,0,91,TRUE,0,50,TRUE,1,60,FALSE,1,98,TRUE,1,93,TRUE,1,92,TRUE,1,50,TRUE,1,60,FALSE,1,72,TRUE,0,100,FALSE,0,77,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,0,67,TRUE,0,92,TRUE,0,72,FALSE,1,100,TRUE,1,76,TRUE,1,96,TRUE,0,70,TRUE,1,90,TRUE,0,80,TRUE,1,70,TRUE,0,50,FALSE,1,96,TRUE,0,60,TRUE,1,91,TRUE,1,94,TRUE,1,52,0.0064,0.09,0,0.0049,0.2304,0.0004,0.01,0.16,0,0.0016,0.0081,0.5929,0.25,0.0784,0.16,0.0064,0.49,0.25,0.0016,0.64,0.0576,0.0324,0.5184,0,0.4489,0.25,0.0036,0.9409,0.8281,0.8464,0.36,1,0.291646429,0.159871429,0.423421429,19,59.38,20,62.5,5,62.5,4,50,5,62.5,6,75,15,93.75,5,31.25,80.31,70.25,70,86,95,79.69,80.94,-3.12,17.81,7.75,20,23.5,20,-14.06,49.69,0,1,3,0,1,0,0,1,1,2,0,0,0,0,0,0,1,0,3,0,0,1,2,0,1,0,0,1,2,1,0,0,1,2,0,0,0,1,3,0,1,0.8,0,0.8,0.8,0.8,0.6,0.8,0.65,0.75,2.33,2.33,1,0,-1,-1,0,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,52,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,1,0,0,0,0,0,-1,1,0,0,-1,-2,0,0,1,-1,0,0,0.2,0,-0.6,0,-0.1 +551,R_7HfprOKQHqsNliF,60 - 66,American,Male,3,3,1,2,3,-1,0,2,-1,1,-1,-2,3,-1,2,-2,-2,-2,1,-2,2,2,2,2,2,3,-1,-2,1,-1,1,0,1,-2,2,-1,2,0,-2,-1,-1,-1,-1,4,3,3,0,2,1,0,-1,0,1,0,1,1,-2,-2,2,-3,3,1,-2,-2,-1,-1,-2,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2304,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0.079657143,0.016457143,0.142857143,31,96.88,30,93.75,7,87.5,8,100,7,87.5,8,100,15,93.75,15,93.75,98.5,94,100,100,100,100,97,3.13,4.75,6.5,0,12.5,0,6.25,3.25,1,1,1,0,1,0,2,1,0,0,2,0,1,0,0,0,1,1,2,1,0,0,1,0,2,0,0,1,1,0,1,0,1,2,1,0,0,1,2,0,0.8,0.6,0.6,1,0.6,0.4,1,0.6,0.75,0.65,1,0.67,3,-1,-1,3,0.33,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,66,1.5,1,1,0,0,0,1,0.67,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,1,1,0,0,-1,0,2,0,-1,0,1,0,0,-2,-1,0,1,0,0,1,0.2,0.2,-0.4,0.4,0.1 +552,R_12AnLzAROw0zlWt,25 - 31,Canadian,Female,2,2,2,2,0,1,-2,2,0,2,0,1,2,-2,2,2,2,2,2,3,2,2,2,2,0,5,-1,1,-1,1,2,8,-1,1,2,0,1,5,2,2,2,2,2,5,2,2,1,2,0,5,1,-2,2,0,2,5,0,1,2,0,2,5,2,2,2,2,2,5,TRUE,0,50,FALSE,0,50,TRUE,0,80,TRUE,0,50,FALSE,0,50,FALSE,1,85,TRUE,1,87,TRUE,1,100,FALSE,0,50,TRUE,1,91,FALSE,1,50,TRUE,0,100,TRUE,1,74,FALSE,1,88,TRUE,1,77,TRUE,1,73,TRUE,0,71,TRUE,0,91,FALSE,1,50,TRUE,0,59,TRUE,1,78,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,87,TRUE,1,100,FALSE,1,50,FALSE,1,88,FALSE,1,50,TRUE,1,88,TRUE,1,50,TRUE,1,98,0,0,0.0729,0.0169,0.0004,0.0225,0.25,0.0081,0.3481,0.25,0.0144,0.0676,0.25,0.25,0.25,0.25,0.25,0.25,0.0144,0.7569,0.0484,0.0529,0.25,0.0144,0.5041,0.25,0.25,0.25,0.64,0.8281,0.25,1,0.270367857,0.175792857,0.364942857,16,50,18,56.25,5,62.5,5,62.5,4,50,4,50,11,68.75,7,43.75,70.78,53.38,69.5,80.5,79.75,72.88,68.69,-6.25,14.53,-9.12,7,30.5,29.75,4.13,24.94,0,0,0,0,0,2,3,3,1,0,1,0,0,2,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,1.8,0.8,0.2,0.2,0,0.4,0.2,0.7,0.2,6,5,0,3,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),30,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,0,2,3,3,1,0,1,0,0,0,1,0,0,0,0,0,-0.2,1.8,0.4,0,0.5 +553,R_55HIwZfhomcRWEx,53 - 59,Canadian,Female,3,-2,3,0,3,-2,-1,0,-1,0,2,2,0,-1,1,1,1,2,1,2,3,-2,3,0,3,8,-1,-1,0,-1,-1,3,3,1,0,-1,1,3,0,1,-1,-1,0,7,3,-2,3,0,3,4,-1,-1,0,-1,-1,4,3,2,1,-2,2,3,1,1,1,1,1,3,TRUE,0,100,FALSE,0,79,TRUE,0,95,FALSE,1,58,TRUE,1,92,FALSE,1,100,FALSE,0,50,TRUE,1,99,TRUE,1,96,TRUE,1,68,FALSE,1,58,TRUE,0,78,TRUE,1,95,TRUE,0,59,FALSE,0,57,TRUE,1,88,TRUE,0,87,FALSE,1,54,FALSE,1,96,FALSE,1,57,FALSE,0,87,TRUE,1,92,TRUE,0,82,TRUE,1,100,TRUE,0,97,FALSE,0,92,TRUE,0,90,FALSE,1,97,TRUE,0,96,TRUE,1,94,FALSE,0,54,TRUE,1,53,0.0001,0.8464,0.0144,0.25,0.2209,0,0,0.1024,0.1849,0.0064,0.0036,0.0025,0.0016,0.1764,0.0064,0.6241,0.6724,0.1764,0.0009,0.9409,0.7569,0.3249,0.0016,0.3481,0.7569,0.81,0.2916,1,0.9025,0.2116,0.9216,0.6084,0.359067857,0.155571429,0.562564286,26,81.25,17,53.13,4,50,4,50,3,37.5,6,75,10,62.5,7,43.75,81.25,73.5,86.5,76.5,88.5,81,81.5,28.12,28.12,23.5,36.5,39,13.5,18.5,37.75,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,3,2,2,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,0.4,0.4,1.6,0,0.4,0.8,0.4,0.6,0.4,4.67,3.67,4,-1,0,4,1,10 cents,25 minutes,24 days,Female,University - Undergraduate,57,0.375,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,1,-1,-1,-1,1,0,2,2,1,0,0,-0.4,1.2,0.2 +554,R_6HYbTSeN4jWBDWB,46 - 52,Canadian,Male,1,3,3,2,1,1,-3,-1,-2,-1,0,3,2,0,0,0,-1,-1,0,2,2,3,3,1,1,2,3,-3,-1,-2,0,2,0,3,3,1,1,2,0,0,1,0,2,2,2,3,3,3,1,1,2,-3,0,-2,-2,2,0,3,2,0,1,2,0,-1,-1,0,2,2,TRUE,0,86,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,64,TRUE,1,99,TRUE,1,75,FALSE,0,50,TRUE,1,77,TRUE,0,69,TRUE,0,78,TRUE,1,70,TRUE,0,71,FALSE,0,62,TRUE,1,100,FALSE,1,57,FALSE,1,93,FALSE,1,59,FALSE,1,100,FALSE,0,57,TRUE,1,86,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,73,FALSE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,88,0.0625,0,0,0.0001,0.0144,0.1296,0.25,0.0529,0,0.0196,0.01,0.09,0.25,0.4761,0.25,0.25,0,0.25,0.0729,0,0.3249,0.3844,0.1681,0.5041,0.1849,0.25,0.25,0.7396,1,0.0049,0.25,0.6084,0.242314286,0.1459,0.338728571,25,78.13,20,62.5,3,37.5,6,75,6,75,5,62.5,9,56.25,11,68.75,73.56,55,67,89,83.25,72.12,75,15.63,11.06,17.5,-8,14,20.75,15.87,6.25,1,0,0,1,0,2,0,0,0,1,0,0,1,1,1,0,1,2,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0.4,0.6,0.6,0.6,0.4,0.6,0.2,0,0.55,0.3,2,1.67,1,0,0,0,0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),51,-1.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,-1,0,0,0,0,1,1,0,0,1,2,0,0,0,0,0.4,0.6,0.25 +555,R_7rPxckCG4wznxO3,53 - 59,American,Male,0,-1,-1,0,3,3,1,-1,-3,-2,-2,-1,0,1,1,-1,1,0,2,0,-2,-1,-1,-3,3,5,3,-2,0,-3,1,4,-2,1,0,-1,0,6,-1,-2,1,1,0,4,-2,0,1,1,-1,4,0,-1,2,1,0,5,-1,0,-1,1,-2,4,-1,0,-1,2,-1,10,FALSE,1,100,TRUE,1,99,TRUE,0,97,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,FALSE,1,100,FALSE,1,93,TRUE,1,83,FALSE,1,91,TRUE,1,93,TRUE,1,100,FALSE,1,99,FALSE,1,86,FALSE,1,99,FALSE,1,100,TRUE,1,64,TRUE,1,99,FALSE,1,100,TRUE,1,94,FALSE,1,100,TRUE,1,91,FALSE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,74,0,0.0081,0,0,0.0676,0,0.0036,0,0,0.0001,0,0.0289,0.0036,0,0,0.0001,0,0.25,0.25,0,0.1296,0.0049,0.0001,0.0081,0.0001,0,0,0,0.9409,0.0196,1,0.0049,0.096860714,0.025278571,0.168442857,31,96.88,30,93.75,8,100,7,87.5,8,100,7,87.5,16,100,14,87.5,92.38,91.88,90,95.88,91.75,93.19,91.56,3.13,-1.37,-8.12,2.5,-4.12,4.25,-6.81,4.06,2,0,0,3,0,0,3,1,0,3,0,2,0,2,1,0,3,1,1,0,2,1,2,1,4,3,2,3,4,2,1,1,1,0,3,0,1,1,0,1,1,1.4,1,1,2,2.8,1.2,0.6,1.1,1.65,5,4.33,1,-1,2,-6,0.67,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),57,1.375,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,-1,-2,2,-4,-3,1,-2,-4,1,-1,1,-1,2,-2,0,2,0,1,-1,-1,-1.4,-0.2,0.4,-0.55 +556,R_77jW0e7TZUzEM31,46 - 52,Canadian,Female,3,3,3,3,3,0,1,0,1,1,3,2,1,-2,2,0,1,1,1,-2,3,3,3,3,3,5,1,1,2,-2,2,1,2,2,1,-1,3,4,0,0,0,0,0,4,3,3,3,3,3,4,1,0,0,0,1,4,3,3,0,-3,3,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,55,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,57,TRUE,1,100,FALSE,1,56,TRUE,0,100,TRUE,1,75,TRUE,0,81,TRUE,1,60,TRUE,1,100,TRUE,0,55,TRUE,0,100,FALSE,1,54,FALSE,1,100,TRUE,1,96,TRUE,1,75,FALSE,1,92,TRUE,1,81,FALSE,1,100,TRUE,1,85,FALSE,1,54,FALSE,1,54,TRUE,0,54,TRUE,1,75,FALSE,0,52,TRUE,1,100,0,0.0225,0,0.0324,0,0,0.0361,0,0,0.0625,0.0625,0.0625,0.1849,0.1936,0.2025,0,0.0064,0.36,0.2116,0,0.0016,0.16,0.2116,0.6561,0.3025,0.2116,0.2704,0,1,1,0.2916,1,0.231714286,0.083642857,0.379785714,14,43.75,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,79.78,61.62,78.38,90.38,88.75,80.81,78.75,-31.25,4.78,-13.38,3.38,15.38,13.75,-12.94,22.5,0,0,0,0,0,1,0,2,3,1,1,0,0,1,1,0,1,1,1,2,0,0,0,0,0,1,1,0,1,0,0,1,1,1,1,0,1,1,1,2,0,1.4,0.6,1,0,0.6,0.8,1,0.75,0.6,3.33,4.33,1,-3,-1,-1,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,1.25,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,-1,2,2,1,1,-1,-1,0,0,0,0,0,0,0,0,0.8,-0.2,0,0.15 +557,R_17yp9IsUhb29vup,39 - 45,Canadian,Male,-1,3,3,1,3,1,0,2,1,3,0,-2,3,2,3,-1,0,-1,0,1,0,3,2,1,3,2,2,0,3,-1,3,7,0,-2,3,2,3,0,1,1,2,1,3,6,1,3,1,2,3,4,1,-1,3,-1,1,5,0,-2,3,2,3,0,2,2,2,2,3,8,TRUE,0,60,FALSE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,70,TRUE,1,80,TRUE,1,50,TRUE,1,50,TRUE,1,70,FALSE,1,75,FALSE,1,90,TRUE,1,90,TRUE,0,60,TRUE,1,55,TRUE,1,100,FALSE,1,60,FALSE,1,60,TRUE,0,50,TRUE,0,50,FALSE,0,70,TRUE,1,50,FALSE,1,50,FALSE,0,70,TRUE,0,60,TRUE,1,65,TRUE,0,50,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,85,0.25,0.1225,0,0.04,0.0225,0.09,0.49,0.09,0.25,0.25,0,0.01,0.25,0.0625,0.25,0.25,0.25,0.25,0.04,0.36,0.49,0.2025,0.25,0.36,0.16,0.25,0.25,0.36,1,0.16,0.25,0.01,0.237767857,0.179642857,0.295892857,20,62.5,20,62.5,3,37.5,7,87.5,5,62.5,5,62.5,12,75,8,50,65.62,53.75,65.62,63.12,80,67.81,63.44,0,3.12,16.25,-21.88,0.62,17.5,-7.19,13.44,1,0,1,0,0,1,0,1,2,0,0,0,0,0,0,2,1,3,1,2,2,0,2,1,0,0,1,1,2,2,0,0,0,0,0,3,2,3,2,2,0.4,0.8,0,1.8,1,1.2,0,2.4,0.75,1.15,3,3,-2,2,0,-2,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,39,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-1,0,-1,-1,0,1,-1,0,0,-2,0,0,0,0,0,-1,-1,0,-1,0,-0.6,-0.4,0,-0.6,-0.4 +558,R_7M6xdAfF4VEibhK,53 - 59,American,Female,1,3,3,-3,3,1,-1,2,-2,1,2,2,1,-1,2,1,1,1,1,1,3,3,3,-2,3,1,1,-2,2,-3,1,1,2,2,1,1,2,1,0,-1,-1,1,0,4,3,3,3,1,3,1,2,-3,3,-2,1,3,2,3,2,0,3,1,2,2,2,3,2,1,TRUE,0,93,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,86,TRUE,1,100,TRUE,1,50,FALSE,0,75,FALSE,1,77,TRUE,0,82,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,75,TRUE,0,60,TRUE,0,80,TRUE,0,61,FALSE,1,50,TRUE,1,95,TRUE,1,63,TRUE,0,50,TRUE,1,75,FALSE,1,92,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,96,0,0,0.0625,0.0196,0.0016,0,0.0625,0.5625,0.25,0.1369,0,0,0.25,0.0529,0.16,0,0.25,0.25,0,0.0064,0.0025,0.25,0.3721,1,0.36,0.25,0.25,0.8649,1,0.64,0.25,0.6724,0.281953571,0.141171429,0.422735714,20,62.5,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,77.19,61,76.38,86.12,85.25,79.69,74.69,-3.13,11.56,-14,13.88,36.12,10.25,-7.81,30.94,2,0,0,1,0,0,1,0,1,0,0,0,0,2,0,1,2,2,0,1,2,0,0,4,0,1,2,1,0,0,0,1,1,1,1,1,1,1,2,1,0.6,0.4,0.4,1.2,1.2,0.8,0.8,1.2,0.65,1,1,1.67,0,-2,0,3,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,54,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,-3,0,-1,-1,-1,1,0,0,-1,-1,1,-1,0,1,1,-2,0,-0.6,-0.4,-0.4,0,-0.35 +559,R_11l5p9v4Gsca74d,46 - 52,Canadian,Female,2,3,3,0,1,1,0,1,-1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,6,0,1,1,1,0,7,0,-1,1,1,0,7,0,1,1,0,0,6,1,1,1,1,0,7,1,1,0,0,1,4,0,1,0,1,1,3,1,0,0,1,0,6,FALSE,1,88,TRUE,1,63,FALSE,1,65,TRUE,0,57,FALSE,0,58,FALSE,1,60,FALSE,0,62,TRUE,1,71,FALSE,0,67,TRUE,1,71,FALSE,1,62,TRUE,0,64,TRUE,1,66,FALSE,1,58,TRUE,1,69,TRUE,1,72,TRUE,0,66,TRUE,0,71,FALSE,1,62,FALSE,1,75,FALSE,0,73,FALSE,0,76,TRUE,0,61,FALSE,0,67,FALSE,1,100,TRUE,1,82,TRUE,0,61,FALSE,1,100,TRUE,0,79,TRUE,1,84,FALSE,0,69,TRUE,1,83,0.0841,0.0324,0.0784,0.3844,0.0289,0.16,0.4489,0.0841,0.0625,0.5776,0.0256,0.1156,0.4489,0.1444,0.3364,0.1369,0.3721,0.3249,0,0,0.5329,0.0961,0.1444,0.1764,0.4356,0.3721,0.4761,0.0144,0.1225,0.5041,0.6241,0.4096,0.256253571,0.233342857,0.279164286,16,50,18,56.25,4,50,3,37.5,5,62.5,6,75,9,56.25,9,56.25,70.69,63.75,68.25,76,74.75,70.81,70.56,-6.25,14.44,13.75,30.75,13.5,-0.25,14.56,14.31,1,3,3,1,0,1,1,0,2,0,0,2,1,0,1,0,1,0,0,1,1,2,2,1,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1.6,0.8,0.8,0.4,1.4,0.8,0,0.8,0.9,0.75,6.67,4.67,-1,3,4,0,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),47,0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,1,0,-1,1,0,-1,1,-1,0,2,1,0,1,-1,1,-1,-1,0,0.2,0,0.8,-0.4,0.15 +560,R_7kch5BE6iz8any9,53 - 59,American,Female,-2,2,3,1,2,-2,-3,2,-1,-1,2,1,2,-2,2,2,1,2,2,1,-3,2,3,-1,1,4,-2,-3,3,-1,-2,4,2,1,2,-2,2,3,1,2,2,1,1,4,-1,2,3,1,1,3,-2,-3,2,-2,-1,3,3,1,2,-2,3,3,2,2,2,1,1,4,TRUE,0,82,TRUE,1,100,TRUE,0,92,FALSE,1,60,FALSE,0,61,FALSE,1,66,TRUE,1,85,TRUE,1,79,TRUE,1,76,TRUE,1,89,FALSE,1,58,TRUE,0,84,TRUE,1,74,FALSE,1,56,FALSE,0,61,TRUE,1,81,FALSE,1,61,TRUE,0,91,FALSE,1,61,FALSE,1,65,TRUE,1,84,FALSE,0,76,FALSE,1,76,FALSE,0,71,TRUE,0,85,TRUE,1,70,FALSE,1,56,FALSE,1,70,FALSE,1,60,TRUE,1,90,FALSE,0,65,TRUE,1,85,0.0441,0.09,0.0361,0.0225,0.0225,0.1156,0.5041,0.0121,0.1225,0.5776,0.01,0.0676,0.0576,0.1764,0.3721,0,0.0576,0.16,0.09,0.7225,0.0256,0.3721,0.1521,0.1936,0.1521,0.1936,0.4225,0.6724,0.8464,0.8281,0.16,0.7056,0.278296429,0.161121429,0.395471429,17,53.13,22,68.75,6,75,7,87.5,4,50,5,62.5,11,68.75,11,68.75,74.06,67.12,70.88,79.25,79,77.94,70.19,-15.62,5.31,-7.88,-16.62,29.25,16.5,9.19,1.44,1,0,0,2,1,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0.8,0.4,0,0.6,0.4,0.2,0.4,0.4,0.45,0.35,3.67,3,1,1,0,0,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,53,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,2,0,0,0,1,-1,1,-1,0,0,0,-1,1,0,0,0,0,0.4,0.2,-0.4,0.2,0.1 +561,R_3sXwUwOwBrTijxx,39 - 45,Canadian,Female,3,2,2,-1,2,-2,-1,1,-2,0,1,0,1,-1,1,-1,0,1,0,0,3,2,2,-2,2,5,-2,-2,2,-2,0,5,0,0,1,-2,1,5,-1,-1,0,-1,0,5,3,2,2,0,2,5,-2,-2,2,-2,0,5,0,0,1,-2,2,5,0,0,0,0,0,5,TRUE,0,66,TRUE,1,59,TRUE,0,61,FALSE,1,54,FALSE,0,54,FALSE,1,65,TRUE,1,71,TRUE,1,71,TRUE,1,59,TRUE,1,81,FALSE,1,57,FALSE,1,59,TRUE,1,61,FALSE,1,57,FALSE,0,53,FALSE,0,58,FALSE,1,56,FALSE,1,100,TRUE,0,57,FALSE,1,59,FALSE,0,60,TRUE,1,60,FALSE,1,76,TRUE,1,70,FALSE,1,81,TRUE,1,86,TRUE,0,60,TRUE,0,71,TRUE,0,76,TRUE,1,100,TRUE,1,59,TRUE,1,100,0.0841,0.0196,0.3364,0.0841,0,0.1225,0.09,0.0361,0.1681,0.16,0,0.1521,0.1681,0.1849,0.2916,0.1681,0.0576,0.2116,0.5041,0.0361,0.36,0.2809,0.3249,0.1849,0.1936,0.36,0.1681,0.4356,0.3721,0,0.5776,0.1681,0.206310714,0.129335714,0.283285714,16,50,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,12,75,10,62.5,67.41,57.25,68.5,75.25,68.62,68.88,65.94,-18.75,-1.34,-5.25,6,-12.25,6.12,-6.12,3.44,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0.2,0.4,0.4,0.6,0.2,0.4,0.6,0.4,0.4,0.4,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,45,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,1,0,1,0,0,0,-0.2,0.2,0 +562,R_73CmFL4triVTvWN,53 - 59,American,Female,0,1,1,1,1,-1,-2,1,-2,-1,1,1,1,-1,1,0,0,1,1,1,1,1,1,1,1,8,-1,-2,1,-2,-1,3,1,1,0,-1,1,2,0,0,0,1,1,3,0,1,1,1,-1,2,0,-2,1,-1,-2,2,1,1,1,-1,1,2,0,0,0,0,1,2,TRUE,0,93,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,91,TRUE,1,50,TRUE,1,50,TRUE,1,93,FALSE,1,83,TRUE,0,94,TRUE,1,96,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,98,FALSE,1,63,FALSE,1,50,TRUE,1,89,TRUE,1,73,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,76,TRUE,1,89,FALSE,0,58,FALSE,0,50,0.25,0.25,0,0.0081,0.25,0.25,0.25,0.0049,0.25,0.0729,0.0121,0.0016,0.25,0.0289,0.25,0.25,0.25,0.25,0.25,0.25,0.0121,0.25,0.1369,0.25,0.25,0.25,0.3364,0.8649,1,0.9604,0.5776,0.8836,0.308653571,0.169314286,0.447992857,12,37.5,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,10,62.5,8,50,67.06,56.75,63.88,74.75,72.88,68.06,66.06,-18.75,10.81,-5.75,26.38,12.25,10.38,5.56,16.06,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0.2,0,0.2,0.2,0.4,0.6,0,0.4,0.15,0.35,4.33,2,6,1,0,1,2.33,5 cents,5 minutes,24 days,Female,High School (or equivalent),56,1,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,1,0,0,0,-2,-1,0,0,-1,-1,0,0,1,0,0,0,0,0,-1,0,-0.2,-0.6,0.2,-0.2,-0.2 +563,R_7KJYqqIU2QGldUt,53 - 59,American,Female,2,2,1,-2,3,-2,-2,2,3,0,2,-3,3,-3,3,-1,1,1,1,-3,-1,2,1,-3,3,1,-2,-1,2,3,0,0,2,-3,3,-3,3,2,-1,-1,-1,-1,-3,4,1,2,1,1,3,8,-2,-1,2,2,0,1,2,-3,3,-3,3,0,0,0,0,-1,-3,5,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,63,TRUE,1,80,TRUE,1,100,FALSE,0,50,TRUE,1,57,TRUE,0,50,TRUE,0,100,TRUE,1,71,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,56,FALSE,1,50,FALSE,1,50,TRUE,1,68,FALSE,0,50,FALSE,1,50,TRUE,1,57,FALSE,1,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,62,FALSE,0,50,TRUE,1,100,0,0.09,0,0.04,0,0.3969,0.1849,0.1849,0.25,0.25,0.1444,0.0841,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.1024,0.25,0.25,1,0.25,0.25,0.25,0.25,0,0.1936,0.25,1,0.251471429,0.178228571,0.324714286,15,46.88,23,71.88,5,62.5,5,62.5,6,75,7,87.5,13,81.25,10,62.5,66.69,56.25,69,64.12,77.38,72.81,60.56,-25,-5.19,-6.25,6.5,-10.88,-10.12,-8.44,-1.94,3,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,2,2,0,1,0,0,3,0,0,1,0,1,0,0,0,0,0,0,1,1,1,2,0,0.8,0.2,0,1.2,0.8,0.4,0,1,0.55,0.55,1,3,-7,-1,2,-1,-2,10 cents,100 minutes,24 days,Female,University - PhD,54,1.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,2,0,0,-2,0,0,0,0,-1,0,0,0,0,0,0,-1,1,1,0,0,0,-0.2,0,0.2,0 +564,R_5DuA1HvIy5gY2vK,32 - 38,American,Female,1,1,1,0,0,-3,-1,0,1,0,0,-1,2,-2,1,0,0,0,0,0,2,2,2,0,0,6,-3,0,0,2,0,6,0,-1,2,-2,2,5,-1,-1,-2,0,-2,5,1,1,1,0,0,6,-2,0,0,1,1,5,0,-1,2,-2,1,5,0,0,0,0,-1,5,TRUE,0,76,TRUE,1,85,TRUE,0,97,FALSE,1,51,TRUE,1,64,FALSE,1,83,FALSE,0,53,TRUE,1,62,TRUE,1,71,TRUE,1,81,FALSE,1,50,TRUE,0,57,FALSE,0,51,FALSE,1,61,FALSE,0,50,TRUE,1,68,FALSE,1,50,TRUE,0,72,TRUE,0,54,FALSE,1,50,TRUE,1,82,TRUE,1,64,FALSE,1,67,TRUE,1,56,FALSE,1,84,TRUE,1,54,TRUE,0,50,FALSE,1,61,TRUE,0,50,FALSE,0,65,FALSE,0,52,TRUE,1,52,0.1444,0.2116,0.1024,0.2809,0.2304,0.0289,0.1936,0.0361,0.25,0.1296,0.4225,0.2601,0.0841,0.25,0.1296,0.0225,0.1089,0.2401,0.1521,0.0256,0.0324,0.25,0.2916,0.1521,0.25,0.25,0.2704,0.5776,0.9409,0.5184,0.25,0.3249,0.2383,0.170457143,0.306142857,17,53.13,20,62.5,4,50,6,75,5,62.5,5,62.5,11,68.75,9,56.25,63.22,57.88,62.38,68.12,64.5,63.12,63.31,-9.37,0.72,7.88,-12.62,5.62,2,-5.63,7.06,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,2,0,2,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0.6,0.4,0.2,1.2,0,0.6,0,0.2,0.6,0.2,5.67,5.33,0,1,0,0,0.34,5 cents,5 minutes,47 days,Female,University - Undergraduate,34,0.5,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,1,1,1,0,0,-1,0,0,1,-1,0,0,0,0,1,1,1,2,0,1,0.6,-0.2,0.2,1,0.4 +565,R_1rTcNI0ME0EkqHe,53 - 59,American,Female,2,2,3,-2,1,-1,-1,2,-2,-2,1,2,1,0,1,2,2,2,2,2,2,2,3,-1,2,1,-2,-2,2,-1,-2,1,1,2,-1,-1,1,1,2,2,2,2,2,1,2,2,3,1,1,1,-2,-2,2,-2,-2,1,1,2,1,0,2,1,2,2,2,2,2,0,FALSE,1,51,FALSE,0,50,FALSE,1,51,FALSE,1,50,FALSE,0,52,FALSE,1,89,TRUE,1,81,TRUE,1,89,FALSE,0,53,FALSE,0,50,FALSE,1,84,FALSE,1,51,TRUE,1,74,TRUE,0,75,FALSE,0,53,TRUE,1,77,FALSE,1,54,TRUE,0,84,TRUE,0,63,FALSE,1,83,TRUE,1,63,FALSE,0,58,FALSE,1,96,TRUE,1,82,FALSE,1,90,TRUE,1,87,TRUE,0,69,FALSE,1,89,TRUE,0,67,TRUE,1,78,FALSE,0,68,TRUE,1,67,0.0121,0.0169,0.0529,0.0361,0.1089,0.0121,0.0324,0.25,0.0289,0.3364,0.0484,0.0676,0.2809,0.0256,0.2704,0.25,0.0016,0.25,0.0121,0.01,0.1369,0.2809,0.3969,0.5625,0.2116,0.4761,0.4624,0.2401,0.2401,0.7056,0.4489,0.2401,0.228121429,0.140228571,0.316014286,16,50,20,62.5,2,25,6,75,4,50,8,100,9,56.25,11,68.75,69.62,61.25,70.25,72,75,67.62,71.62,-12.5,7.12,36.25,-4.75,22,-25,11.37,2.87,0,0,0,1,1,1,1,0,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0.4,0.6,0.6,0,0.6,0.4,0.2,0,0.4,0.3,1,1,0,0,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,57,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,-2,1,0,0,0,1,0,0,0,2,1,-1,0,0,0,0,0,-0.2,0.2,0.4,0,0.1 +566,R_6afONHtpQoqqCjf,53 - 59,American,Female,-1,2,2,1,1,-3,-2,2,-2,1,2,1,2,-2,2,0,1,1,1,-1,-1,2,2,-3,1,6,-3,-2,1,-1,1,5,2,2,2,1,2,4,-1,-1,-1,-1,-1,5,-1,2,2,-1,2,7,-3,-2,2,-2,0,4,2,2,2,-1,2,4,1,1,2,2,2,6,FALSE,1,50,TRUE,1,70,FALSE,1,88,TRUE,0,50,TRUE,1,60,FALSE,1,100,TRUE,1,76,TRUE,1,94,FALSE,0,50,TRUE,1,63,FALSE,1,66,TRUE,0,64,TRUE,1,82,TRUE,0,59,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,64,FALSE,1,50,FALSE,1,100,FALSE,0,64,TRUE,1,71,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,50,TRUE,0,50,TRUE,0,80,TRUE,1,71,FALSE,0,59,TRUE,1,100,0.0036,0.0576,0.0625,0.0576,0,0,0,0.1369,0,0.0841,0.0841,0.0324,0.25,0.1156,0.16,0.09,0.25,0.25,0.25,0,0.4096,0.25,0.25,0.3481,0.25,0.25,0.3481,0.25,0.0144,0.4096,0.64,0.4096,0.197589286,0.103792857,0.291385714,16,50,21,65.63,3,37.5,6,75,6,75,6,75,12,75,9,56.25,69.75,55.62,73.25,69.88,80.25,72.56,66.94,-15.63,4.12,18.12,-1.75,-5.12,5.25,-2.44,10.69,0,0,0,4,0,0,0,1,1,0,0,1,0,3,0,1,2,2,2,0,0,0,0,2,1,0,0,0,0,1,0,1,0,1,0,1,0,1,1,3,0.8,0.4,0.8,1.4,0.6,0.2,0.4,1.2,0.85,0.6,5,5,-1,1,0,-1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),55,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,2,-1,0,0,1,1,-1,0,0,0,2,0,0,2,1,1,-3,0.2,0.2,0.4,0.2,0.25 +567,R_3LYIwChxV19BDIp,53 - 59,Canadian,Female,3,2,1,3,0,-2,-2,1,-2,-1,2,1,2,-3,2,0,0,2,3,2,3,2,1,2,0,2,-2,-2,2,-2,0,3,2,2,2,-2,2,2,0,1,1,2,2,3,3,2,1,3,-1,6,-2,-2,2,-2,-1,2,2,1,2,-2,2,0,0,0,1,3,2,3,FALSE,1,100,TRUE,1,88,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,65,TRUE,1,87,TRUE,1,100,TRUE,1,84,TRUE,1,82,TRUE,0,52,TRUE,0,76,TRUE,1,77,FALSE,1,86,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,75,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,84,TRUE,1,92,FALSE,1,100,TRUE,1,88,TRUE,0,77,FALSE,1,56,TRUE,0,88,TRUE,1,100,TRUE,1,88,TRUE,1,100,0,0.0144,0,0.0169,0,0.1225,0.0064,0.0324,0.25,0.0225,0,0.0529,0.0256,0.2704,0.25,0.0144,0.0256,0.25,0.1936,0,0.25,0.25,0.5625,0.0196,0.25,0.5929,0.0144,0,1,1,0.7744,0.5776,0.243132143,0.094478571,0.391785714,24,75,22,68.75,4,50,5,62.5,7,87.5,6,75,14,87.5,8,50,79.06,70.5,70.5,91,84.25,82.56,75.56,6.25,10.31,20.5,8,3.5,9.25,-4.94,25.56,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0.2,0.4,0.4,0.6,0.2,0.2,0.2,0.2,0.4,0.2,2.33,2.67,-4,1,2,0,-0.34,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,1,-1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0.2,0.2,0.4,0.2 +568,R_3tth360TgaYpm1b,32 - 38,American,Female,-3,2,2,-1,2,0,-1,2,1,0,0,1,1,2,1,1,1,1,2,1,-2,2,2,0,1,5,1,0,2,1,-1,6,1,1,1,1,0,4,-1,0,0,1,-1,5,-2,2,2,0,2,4,1,0,1,-1,1,7,1,2,2,2,2,7,2,2,2,2,0,7,TRUE,0,100,TRUE,1,55,TRUE,0,100,FALSE,1,66,TRUE,1,65,FALSE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,56,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,79,TRUE,1,100,TRUE,0,82,FALSE,1,100,TRUE,0,81,FALSE,1,74,FALSE,0,78,TRUE,1,90,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,TRUE,0,80,TRUE,0,85,TRUE,0,65,TRUE,1,81,TRUE,1,63,TRUE,1,99,0.0225,0.0169,0,0,0.0001,0,0,0,0.0676,0.01,0.0361,0,0.3136,0,0.1225,0.2025,1,0.1156,0.7225,0,0.6084,0.0441,0.6561,0.0625,0.6724,0.64,0.1369,1,1,0,0.4225,1,0.315478571,0.133428571,0.497528571,21,65.63,21,65.63,5,62.5,4,50,7,87.5,5,62.5,14,87.5,7,43.75,85.81,72.5,86.12,94,90.62,83.62,88,0,20.18,10,36.12,6.5,28.12,-3.88,44.25,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,2,1,1,1,2,1,0,0,1,0,1,1,1,2,1,1,1,1,0,1,1,1,1,0,1,0.6,0.6,0.6,1.4,0.4,1.2,0.8,0.8,0.8,0.8,5,6,1,-1,-3,-2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),34,1.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,1,0,0,-1,-2,0,0,-1,-1,1,0,1,0,0,1,1,0.2,-0.6,-0.2,0.6,0 +569,R_7i3mDGkJaiIUWAN,39 - 45,Canadian,Female,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,0,1,-1,-1,1,1,1,1,1,1,1,1,-1,1,4,-2,1,1,1,1,1,-1,2,-1,-1,-1,6,1,2,2,1,2,4,0,0,1,0,1,4,-3,1,3,1,2,2,1,1,3,1,-1,2,FALSE,1,70,TRUE,1,51,TRUE,0,100,TRUE,0,55,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,62,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,89,TRUE,0,67,TRUE,0,100,TRUE,0,81,FALSE,1,66,TRUE,1,59,TRUE,1,71,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,58,FALSE,1,100,FALSE,1,61,TRUE,1,91,FALSE,0,58,TRUE,1,100,0,0,0.0121,0,0,0,0,0,0.1156,0.0841,0.0081,0,1,0.3844,0.2025,0.2401,1,0.3025,0,0,0.1681,0,0.6561,0,0.4489,0.1764,0.3364,0.09,1,1,0.1521,1,0.298760714,0.238378571,0.359142857,22,68.75,22,68.75,3,37.5,6,75,7,87.5,6,75,14,87.5,8,50,84.19,70.62,80.25,92.62,93.25,85.88,82.5,0,15.44,33.12,5.25,5.12,18.25,-1.62,32.5,0,0,0,0,0,2,0,0,2,0,1,0,0,0,0,0,1,1,2,0,2,1,1,0,1,1,1,0,1,0,2,0,2,0,1,2,0,3,0,0,0,0.8,0.2,0.8,1,0.6,1,1,0.45,0.9,2,3.33,-3,0,-1,4,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,41,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,-2,-1,-1,0,-1,1,-1,0,1,0,-1,0,-2,0,-1,-2,1,-2,2,0,-1,0.2,-0.8,-0.2,-0.45 +570,R_6O1tML60LtMQHqe,25 - 31,Canadian,Female,2,2,2,2,2,0,-1,2,2,3,0,-2,2,1,3,0,1,0,0,0,2,2,2,3,2,6,1,0,1,0,2,7,1,-1,1,2,1,6,1,1,0,1,0,6,3,2,2,3,2,7,2,-2,2,0,2,6,1,-2,2,2,3,5,2,2,2,2,2,8,TRUE,0,75,TRUE,1,54,FALSE,1,100,FALSE,1,61,TRUE,1,75,FALSE,1,94,TRUE,1,95,TRUE,1,76,FALSE,0,60,TRUE,1,59,FALSE,1,56,TRUE,0,100,TRUE,1,75,FALSE,1,90,TRUE,1,72,TRUE,1,97,TRUE,0,83,TRUE,0,100,TRUE,0,88,FALSE,1,56,FALSE,0,92,TRUE,1,86,FALSE,1,91,TRUE,1,100,FALSE,1,96,TRUE,1,94,TRUE,0,88,FALSE,1,70,FALSE,1,82,FALSE,0,100,FALSE,0,50,TRUE,1,100,0.0576,0.0036,0.0009,0.0025,0,0.0036,0,0.1681,0.1936,0.0196,1,0.0625,0.36,0.1936,0.0625,0.2116,0.0081,0.1521,0.09,0.0016,0.8464,0.0784,0.7744,0.01,0.6889,0.7744,0.25,0.5625,0,1,0.0324,1,0.305153571,0.17395,0.436357143,20,62.5,22,68.75,4,50,6,75,6,75,6,75,12,75,10,62.5,81.72,66.12,86.5,86.88,87.38,80.31,83.12,-6.25,12.97,16.12,11.5,11.88,12.38,5.31,20.62,0,0,0,1,0,1,1,1,2,1,1,1,1,1,2,1,0,0,1,0,1,0,0,1,0,2,1,0,2,1,1,0,0,1,0,2,1,2,2,2,0.2,1.2,1.2,0.4,0.4,1.2,0.4,1.8,0.75,0.95,6.33,6,-1,1,1,-2,0.33,10 cents,5 minutes,47 days,Female,University - Undergraduate,25,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,0,-1,0,1,0,0,0,1,1,0,2,-1,-1,-2,-1,-2,-0.2,0,0.8,-1.4,-0.2 +571,R_7jWcITvDBLPvHQR,32 - 38,Canadian,Female,3,1,3,0,2,-3,-1,0,0,2,3,0,1,0,0,-3,-1,-1,-1,-3,-3,0,0,0,0,5,-3,0,0,0,0,5,3,0,3,3,3,4,-1,0,0,-3,-3,2,3,0,3,0,3,5,-1,0,0,-3,3,8,3,-1,2,0,3,5,2,0,3,0,3,5,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,54,TRUE,1,50,FALSE,1,100,TRUE,1,73,TRUE,0,50,TRUE,0,50,TRUE,0,50,FALSE,0,76,TRUE,1,50,TRUE,1,100,0.25,0.0729,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.25,0.25,0.25,0.25,0.2116,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,1,1,0.25,1,0.3139,0.2528,0.375,8,25,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,62.59,50,56.75,77.88,65.75,59.31,65.88,-34.38,3.21,-12.5,6.75,2.88,15.75,-15.69,22.13,6,1,3,0,2,0,1,0,0,2,0,0,2,3,3,2,1,1,2,0,0,1,0,0,1,2,1,0,3,1,0,1,1,0,3,5,1,4,1,6,2.4,0.6,1.6,1.2,0.4,1.4,1,3.4,1.45,1.55,4.67,6,0,-3,-1,-3,-1.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,33,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,6,0,3,0,1,-2,0,0,-3,1,0,-1,1,3,0,-3,0,-3,1,-6,2,-0.8,0.6,-2.2,-0.1 +572,R_3du9twEcINOyPCq,32 - 38,American,Female,1,3,3,3,-3,2,2,0,0,2,2,2,3,1,3,-3,-2,-1,-3,-3,3,2,3,3,0,5,3,2,2,0,2,7,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,58,TRUE,1,100,FALSE,1,62,TRUE,0,100,TRUE,1,61,TRUE,0,77,TRUE,1,72,FALSE,0,54,TRUE,0,87,TRUE,0,100,TRUE,0,56,FALSE,1,95,TRUE,1,62,TRUE,1,53,FALSE,1,56,TRUE,1,54,TRUE,0,54,TRUE,1,60,TRUE,0,50,TRUE,0,100,TRUE,0,65,TRUE,1,100,TRUE,1,75,TRUE,1,100,0,0.16,0.2916,0,0,0,0.2116,0,0.0025,0.2209,0,0.1521,0.1764,0.1444,0,0,0.1936,0,1,0.2916,0.1444,0.0784,0.3136,0.5929,0.7569,0.25,0.0625,0,1,1,0.4225,1,0.286225,0.078678571,0.493771429,17,53.13,21,65.63,6,75,6,75,5,62.5,4,50,15,93.75,6,37.5,79.72,71.62,78.88,80.5,87.88,78.06,81.38,-12.5,14.09,-3.38,3.88,18,37.88,-15.69,43.88,2,1,0,0,3,1,0,2,0,0,1,1,0,2,0,6,5,4,6,6,2,0,0,0,6,1,1,3,3,1,1,1,0,2,0,6,5,4,6,6,1.2,0.6,0.8,5.4,1.6,1.8,0.8,5.4,2,2.4,7.33,10,-5,-3,0,0,-2.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),36,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,1,0,0,-3,0,-1,-1,-3,-1,0,0,0,0,0,0,0,0,0,0,-0.4,-1.2,0,0,-0.4 +573,R_5Gompk2q3VXsckp,25 - 31,Canadian,Female,1,1,3,2,3,2,-1,1,1,2,2,3,3,1,3,1,1,1,1,-1,2,2,3,2,3,9,2,2,2,0,3,9,2,2,2,3,2,9,2,2,2,2,2,8,1,1,3,2,3,8,2,0,2,0,2,8,3,3,2,2,2,8,1,2,2,2,1,7,TRUE,0,80,TRUE,1,75,FALSE,1,75,FALSE,1,70,TRUE,1,75,TRUE,0,90,TRUE,1,100,TRUE,1,90,TRUE,1,80,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,80,FALSE,1,60,TRUE,1,80,TRUE,1,100,TRUE,0,80,TRUE,0,90,FALSE,1,80,TRUE,0,90,TRUE,1,90,TRUE,1,90,FALSE,1,75,TRUE,1,85,FALSE,1,80,FALSE,0,75,TRUE,0,85,TRUE,0,80,TRUE,0,85,TRUE,1,85,TRUE,1,85,FALSE,0,80,0.01,0.5625,0,0,0.64,0.81,0.0225,0,0.81,0.01,0.0225,0.04,0.04,0.64,0.0625,0.0625,0.0625,0.09,0.64,0.04,0.01,0.04,0.04,0.16,0.64,0.7225,0.0225,0.64,0.0625,0.81,0.7225,1,0.316517857,0.236607143,0.396428571,25,78.13,20,62.5,6,75,4,50,5,62.5,5,62.5,14,87.5,6,37.5,83.44,79.38,81.88,84.38,88.12,85.62,81.25,15.63,20.94,4.38,31.88,21.88,25.62,-1.88,43.75,1,1,0,0,0,0,3,1,1,1,0,1,1,2,1,1,1,1,1,3,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1,0,1,1,1,2,0.4,1.2,1,1.4,0,0.6,0.8,1,1,0.6,9,8,1,1,1,1,1,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,27,0.25,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,1,1,0,0,0,0,2,0,0,1,-1,1,0,1,0,1,0,0,0,1,0.4,0.6,0.2,0.4,0.4 +574,R_5Y9q0BIpJ1p8sOl,46 - 52,Canadian,Female,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,5,0,0,0,0,0,7,0,0,0,1,1,7,1,1,1,1,1,7,1,1,1,1,1,6,0,0,0,0,0,7,1,1,1,1,2,7,0,0,0,0,0,8,TRUE,0,100,TRUE,1,100,FALSE,1,64,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,73,FALSE,0,75,FALSE,1,90,TRUE,0,87,TRUE,1,61,FALSE,1,100,FALSE,0,51,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,77,TRUE,1,62,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,70,0,0.1444,0.25,0,0.09,0,0.25,0.5625,0.25,0.25,0.25,0.1521,0.0729,0.01,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.2601,0.25,0,0.25,0.25,0.25,1,0.1296,0.25,0.25,0.7569,0.244178571,0.188392857,0.299964286,16,50,22,68.75,6,75,6,75,5,62.5,5,62.5,8,50,14,87.5,65.94,64.25,60.12,76.75,62.62,65.12,66.75,-18.75,-2.81,-10.75,-14.88,14.25,0.12,15.12,-20.75,2,2,1,0,2,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,2,0,0,0,0,0,1.4,0,0.4,1,0.8,0,1.2,0,0.7,0.5,6.33,6.67,-1,0,0,-1,-0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,47,-0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,1,1,-1,1,0,0,0,0,0,-1,-1,-1,0,-1,1,1,1,1,1,0.6,0,-0.8,1,0.2 +575,R_5l6J18fCm9PC8y4,39 - 45,American,Male,0,0,2,3,-3,-3,-1,0,0,0,1,0,2,-3,1,-3,-3,-3,-3,-3,3,3,3,0,-3,8,0,0,-3,0,-3,9,2,0,2,-3,-3,6,-3,-3,-3,-3,-3,7,0,1,3,3,-3,7,-3,-1,-2,0,-3,3,2,0,1,-3,2,5,-3,-3,-3,-3,-3,7,FALSE,1,50,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,77,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.225103571,0.178571429,0.271635714,5,15.63,24,75,5,62.5,8,100,4,50,7,87.5,10,62.5,14,87.5,61.78,56.25,62.5,65.88,62.5,62.5,61.06,-59.37,-13.22,-6.25,-37.5,15.88,-25,0,-26.44,3,3,1,3,0,3,1,3,0,3,1,0,0,0,4,0,0,0,0,0,0,1,1,0,0,0,0,2,0,3,1,0,1,0,1,0,0,0,0,0,2,2,1,0,0.4,1,0.6,0,1.25,0.5,7.67,5,1,6,1,0,2.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),45,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,3,2,0,3,0,3,1,1,0,0,0,0,-1,0,3,0,0,0,0,0,1.6,1,0.4,0,0.75 +576,R_7jNc3fMFTZ2N9kN,25 - 31,Canadian,Female,2,3,3,2,3,-2,-3,3,-3,-2,3,2,2,-2,3,-2,-2,2,-1,-2,3,3,3,2,3,1,-3,-3,3,-3,-3,1,3,3,3,-3,3,1,1,1,1,1,1,5,3,3,3,2,3,1,-3,-3,3,-3,-3,1,3,3,3,3,3,1,3,3,3,3,3,6,TRUE,0,100,TRUE,1,74,TRUE,0,72,TRUE,0,50,TRUE,1,50,FALSE,1,82,TRUE,1,60,TRUE,1,100,TRUE,1,66,TRUE,1,70,TRUE,0,72,TRUE,0,100,TRUE,1,71,FALSE,1,84,FALSE,0,72,FALSE,0,57,TRUE,0,59,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,79,TRUE,0,81,TRUE,1,75,TRUE,0,67,TRUE,0,50,TRUE,0,64,TRUE,1,64,TRUE,1,98,TRUE,1,100,0,0.0625,0.3249,0.16,0,0.0324,0.0441,0.09,0,0,0.1296,0.0841,0.1156,0.5184,0.25,0.0676,0.25,0.25,0.25,0.6561,0,0.5184,0,0.0256,0.3481,0.4489,0.0004,1,0.5184,0,0.4096,1,0.250260714,0.130842857,0.369678571,15,46.88,20,62.5,4,50,6,75,6,75,4,50,14,87.5,6,37.5,77.09,74.88,72,83.75,77.75,77.25,76.94,-15.62,14.59,24.88,-3,8.75,27.75,-10.25,39.44,1,0,0,0,0,1,0,0,0,1,0,1,1,1,0,3,3,1,2,3,1,0,0,0,0,1,0,0,0,1,0,1,1,5,0,5,5,1,4,5,0.2,0.4,0.6,2.4,0.2,0.4,1.4,4,0.9,1.5,1,1,0,0,0,-1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,30,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,0,-2,-2,0,-2,-2,0,0,-0.8,-1.6,-0.6 +577,R_7E5JIhztzOZfm1J,53 - 59,American,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,32,100,17,53.13,5,62.5,4,50,4,50,4,50,15,93.75,2,12.5,100,100,100,100,100,100,100,46.87,46.87,37.5,50,50,50,6.25,87.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,3,0,0,0,3,0.75,0.75,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),54,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +578,R_32JklZgbFSYGk4g,25 - 31,Canadian,Male,3,3,1,2,3,1,1,2,1,2,2,3,1,3,3,-1,1,-3,1,-2,2,3,0,2,3,5,-3,3,2,3,-2,8,3,3,-3,3,0,10,1,1,2,3,-2,10,2,3,0,2,3,2,0,-3,3,-3,1,10,3,3,2,-1,3,4,3,3,3,1,1,5,TRUE,0,84,FALSE,0,70,TRUE,0,100,TRUE,0,100,FALSE,0,61,TRUE,0,59,FALSE,0,63,TRUE,1,100,FALSE,0,59,FALSE,0,53,TRUE,0,93,TRUE,0,100,TRUE,1,98,FALSE,1,55,FALSE,0,54,FALSE,0,52,TRUE,0,64,TRUE,0,90,FALSE,1,61,FALSE,1,59,FALSE,0,75,TRUE,1,100,FALSE,1,62,TRUE,1,100,TRUE,0,78,TRUE,1,100,TRUE,0,100,TRUE,0,69,TRUE,0,100,TRUE,1,78,FALSE,0,55,TRUE,1,100,0,0,0.2704,0.3969,0,0.3481,0,0.2809,0.1681,0,0.0484,0.0004,0.3481,0.8649,0.3721,0.49,0.1444,1,0.4761,0.6084,0.5625,0.2916,0.1521,0.2025,0.4096,1,0.3025,0.7056,1,0.81,1,1,0.449510714,0.290385714,0.608635714,12,37.5,11,34.38,1,12.5,3,37.5,3,37.5,4,50,7,43.75,4,25,77.88,74,77.38,77.88,82.25,76.12,79.62,3.12,43.5,61.5,39.88,40.38,32.25,32.37,54.62,1,0,1,0,0,4,2,0,2,4,1,0,4,0,3,2,0,5,2,0,1,0,1,0,0,1,4,1,4,1,1,0,1,4,0,4,2,6,0,3,0.4,2.4,1.6,1.8,0.4,2.2,1.2,3,1.55,1.7,7.67,5.33,3,-2,6,5,2.34,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),29,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,3,-2,-1,-2,3,0,0,3,-4,3,-2,-2,-1,2,-3,0,0.2,0.4,-1.2,-0.15 +579,R_6Bxhobb9ECeIrNB,39 - 45,American,Female,3,1,3,0,3,-3,1,3,1,-1,1,2,2,2,-3,2,1,2,2,2,-1,2,3,2,3,5,-3,1,2,1,-3,2,1,2,2,2,-3,0,0,0,-1,-1,0,8,1,1,2,1,3,2,-3,1,2,1,-2,4,1,2,2,2,-3,5,-1,0,0,0,0,4,TRUE,0,52,TRUE,1,81,TRUE,0,83,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,79,TRUE,1,89,TRUE,1,50,TRUE,1,55,TRUE,0,52,TRUE,0,67,TRUE,1,68,TRUE,0,100,TRUE,1,85,FALSE,0,65,FALSE,1,65,TRUE,0,81,TRUE,0,82,FALSE,1,61,TRUE,1,50,TRUE,1,54,TRUE,0,60,TRUE,1,88,TRUE,0,56,TRUE,1,60,TRUE,0,50,FALSE,1,79,TRUE,0,56,TRUE,1,67,FALSE,0,51,TRUE,1,81,0.0121,0.16,0.4225,0.0441,0.0361,0,0.0144,0.2025,0.1521,0.2116,0.1089,0.1024,0.25,0.2704,0.25,0.0361,0.36,0.25,0.0441,0.3136,0.25,0.0225,0.6724,1,0.1225,0.25,0.2601,0.2704,0.6889,0.6561,0.3136,0.4489,0.269914286,0.160321429,0.379507143,21,65.63,17,53.13,3,37.5,5,62.5,4,50,5,62.5,13,81.25,4,25,67.72,62.62,66.25,67.12,74.88,67.06,68.38,12.5,14.59,25.12,3.75,17.12,12.38,-14.19,43.38,4,1,0,2,0,0,0,1,0,2,0,0,0,0,0,2,1,3,3,2,2,0,1,1,0,0,0,1,0,1,0,0,0,0,0,3,1,2,2,2,1.4,0.6,0,2.2,0.8,0.4,0,2,1.05,0.8,2.33,3.67,3,-2,-5,4,-1.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,45,1,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,2,1,-1,1,0,0,0,0,0,1,0,0,0,0,0,-1,0,1,1,0,0.6,0.2,0,0.2,0.25 +580,R_3yONc4fAkV08keZ,60 - 66,American,Female,2,2,2,1,1,1,0,2,-1,1,2,1,3,-3,2,1,1,1,-1,-1,2,2,2,-1,1,0,2,2,2,1,1,1,2,1,3,-3,2,0,1,1,1,1,-1,0,2,2,2,2,0,0,0,1,2,0,1,1,2,1,3,-3,2,0,1,1,1,0,-1,0,TRUE,0,92,TRUE,1,100,FALSE,1,93,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,92,TRUE,1,100,TRUE,1,50,TRUE,1,85,TRUE,0,70,FALSE,1,65,FALSE,0,90,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,FALSE,1,50,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,1,90,FALSE,0,50,TRUE,1,100,0,0.0225,0,0.0064,0,0,0.01,0.0225,0.25,0,0.01,0.81,0.25,0.49,0.04,0,0,0.25,0,0,0.5625,0.25,0.5625,1,0.25,0.25,0.25,0.8464,0.0049,0,0.5625,0.1225,0.242635714,0.152321429,0.33295,16,50,23,71.88,4,50,5,62.5,6,75,8,100,12,75,11,68.75,81.47,61.88,83.75,94.25,86,83.56,79.38,-21.88,9.59,11.88,21.25,19.25,-14,8.56,10.63,0,0,0,2,0,1,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0.4,1,0,0.4,0.4,0.6,0,0.2,0.45,0.3,0.33,0.33,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,1,-1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0.2,0.15 +581,R_6sWLSoBqWdsAvER,46 - 52,Canadian,Female,3,3,2,1,3,1,-1,3,-2,3,1,-1,3,-3,3,1,2,2,2,1,3,3,2,1,3,3,1,-2,3,-3,2,3,2,-1,3,-3,3,2,1,1,2,1,1,2,3,3,2,2,3,3,1,-3,3,-3,3,2,2,-2,3,-3,3,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,55,TRUE,1,99,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,TRUE,0,57,TRUE,0,100,TRUE,1,69,TRUE,0,100,TRUE,1,73,TRUE,1,100,TRUE,0,70,FALSE,1,75,TRUE,0,96,FALSE,1,100,FALSE,0,98,TRUE,1,94,FALSE,1,100,TRUE,1,100,TRUE,0,87,TRUE,1,80,TRUE,0,100,FALSE,1,99,TRUE,0,99,TRUE,1,100,TRUE,1,65,TRUE,1,100,0,0.04,0,0,0,0.2025,0,0,0,0.0036,0,0.0961,0.0004,0.3249,0.0001,0,0,0.2025,0.0001,0.7569,0.9604,0.0729,0.9216,1,0.49,1,0.1225,1,0,0.0625,0.9801,1,0.328467857,0.059292857,0.597642857,25,78.13,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,15,93.75,7,43.75,89.66,80.5,86.25,92,99.88,92.25,87.06,9.38,20.91,18,23.75,29.5,12.38,-1.5,43.31,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,2,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0.6,0.2,0.4,0.2,0.6,0.4,0.4,0.3,0.4,2.67,2.33,0,1,0,0,0.34,10 cents,100 minutes,24 days,Female,University - Undergraduate,48,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,0,-1,0,0,1,0,-1,0,0,0,-1,1,0,1,-1,-0.2,0,-0.2,0,-0.1 +582,R_5P7eU8tKjWbiexA,39 - 45,Canadian,Female,3,2,2,0,1,2,-3,3,-3,1,2,0,2,0,3,2,2,3,2,2,3,2,2,-1,0,7,3,-3,3,-3,1,6,3,1,3,1,3,7,1,-1,2,-1,3,5,3,2,3,0,0,5,2,-3,3,-3,1,5,3,0,3,0,3,2,1,1,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,73,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,98,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,61,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.25,0,0.0729,0,0,1,0,0,0,0,0,1,0.25,0,0,0,0.25,0,0,0.25,0.25,0.1521,1,0,0.25,0,0,1,0,1,0.9604,0.262946429,0.178571429,0.347321429,16,50,24,75,6,75,6,75,7,87.5,5,62.5,12,75,12,75,88.5,70.12,93.75,90.38,99.75,88.94,88.06,-25,13.5,-4.88,18.75,2.88,37.25,13.94,13.06,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1,3,1,3,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,0.4,0.2,0.8,1.8,0.4,0,0.4,0.6,0.8,0.35,6.67,4,2,1,5,3,2.67,10 cents,5 minutes,15 days,Female,University - Undergraduate,41,1.25,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,-1,1,0,1,0,0,0,0,0,1,0,1,0,0,2,0,3,1,0,0.2,0.4,1.2,0.45 +583,R_3cjduHlfZVXi9FU,39 - 45,Canadian,Male,2,2,1,2,3,-1,-2,3,-2,3,3,-1,3,0,2,0,1,1,1,-1,-1,2,3,-1,0,8,-1,0,1,1,1,8,3,0,2,1,2,8,0,1,1,0,1,7,2,3,1,2,3,7,-2,-3,3,-3,3,6,3,-1,3,-2,3,8,0,0,1,1,-1,6,TRUE,0,99,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,86,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,88,FALSE,0,98,FALSE,1,79,FALSE,1,75,FALSE,0,87,FALSE,1,100,TRUE,1,87,TRUE,1,100,FALSE,1,50,FALSE,1,73,TRUE,0,65,FALSE,1,76,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,88,FALSE,1,74,TRUE,0,89,FALSE,0,50,TRUE,1,100,TRUE,1,100,0,0.25,0,0,0,0.0016,0,0.9604,0.0576,0,0.25,0.7569,0.0144,0.0441,0.0196,0,0,0.25,0.0676,0,0,0.0169,0.4225,0,0.25,0.7744,0,0.9801,1,0.0729,0.7921,0.0625,0.242628571,0.168185714,0.317071429,23,71.88,22,68.75,5,62.5,6,75,5,62.5,6,75,12,75,10,62.5,86.25,82.12,88.5,90,84.38,90.38,82.12,3.13,17.5,19.62,13.5,27.5,9.38,15.38,19.62,3,0,2,3,3,0,2,2,3,2,0,1,1,1,0,0,0,0,1,2,0,1,0,0,0,1,1,0,1,0,0,0,0,2,1,0,1,0,0,0,2.2,1.8,0.6,0.6,0.2,0.6,0.6,0.2,1.3,0.4,8,7,1,2,0,1,1,5 cents,100 minutes,47 days,Male,University - Undergraduate,40,1.5,1,0,1,0,1,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,3,-1,2,3,3,-1,1,2,2,2,0,1,1,-1,-1,0,-1,0,1,2,2,1.2,0,0.4,0.9 +584,R_37Hk3LKZJ0Cghx7,39 - 45,American,Male,3,3,2,0,1,-1,-3,3,-3,2,0,-1,3,-2,3,-2,1,0,1,0,3,3,1,0,0,3,-3,-3,0,3,-2,6,0,0,2,-1,3,4,-2,-2,-3,-3,-2,8,3,3,1,0,3,3,1,-3,3,-3,3,0,-2,-2,3,-3,3,0,3,1,3,2,3,1,TRUE,0,97,TRUE,1,100,TRUE,0,99,FALSE,1,50,TRUE,1,83,FALSE,1,82,FALSE,0,50,TRUE,1,100,TRUE,1,89,TRUE,1,100,TRUE,0,52,TRUE,0,50,TRUE,1,92,FALSE,1,94,FALSE,0,50,TRUE,1,96,FALSE,1,50,TRUE,0,97,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,65,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,50,FALSE,1,50,TRUE,0,57,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.0576,0.0016,0.25,0,0.0324,0,0,0.25,0.1225,0,0.0064,0.0121,0.2704,0.0289,0,0,0.25,0.25,0,0.25,0.25,0.25,0.0036,0.25,0.25,0.25,0.9409,0.9801,0.9409,0.3249,0.25,0.220110714,0.069478571,0.370742857,20,62.5,21,65.63,4,50,7,87.5,5,62.5,5,62.5,13,81.25,8,50,75.91,61.38,76.75,84.88,80.62,81.31,70.5,-3.13,10.28,11.38,-10.75,22.38,18.12,0.06,20.5,0,0,1,0,1,2,0,3,6,4,0,1,1,1,0,0,3,3,4,2,0,0,1,0,2,2,0,0,0,1,2,1,0,1,0,5,0,3,1,3,0.4,3,0.6,2.4,0.6,0.6,0.8,2.4,1.6,1.1,4.33,1,0,6,4,7,3.33,5 cents,100 minutes,24 days,Male,University - Undergraduate,42,1,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,-1,0,0,3,6,3,-2,0,1,0,0,-5,3,0,3,-1,-0.2,2.4,-0.2,0,0.5 +585,R_5O8gYBMH1PFssNw,46 - 52,Canadian,Female,3,2,3,3,-1,-3,-2,3,-3,0,0,-3,3,-2,3,3,3,3,3,2,3,2,3,1,1,3,-3,-3,3,-3,1,3,0,-3,2,-2,3,1,0,0,1,1,1,7,2,2,3,2,0,2,-3,-3,2,-2,0,1,0,-3,2,-2,3,1,0,0,0,2,2,0,FALSE,1,95,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,92,FALSE,1,51,TRUE,0,100,TRUE,1,61,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,56,FALSE,1,60,TRUE,0,90,TRUE,0,57,FALSE,0,85,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,1,88,TRUE,0,75,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.0144,0,0,0,0,0,0.0064,0.3249,0.0049,0,0.1521,0.0841,0.2401,0,0,0,0.25,0.25,0.8836,0.7225,0.25,0.81,1,0.1936,0.5625,0.25,0.0025,1,0.16,1,1,0.326685714,0.075892857,0.577478571,27,84.38,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,83.38,67.12,87.75,90.25,88.38,86.88,79.88,15.63,14.63,4.62,12.75,15.25,25.88,-0.62,29.88,0,0,0,2,2,0,1,0,0,1,0,0,1,0,0,3,3,2,2,1,1,0,0,1,1,0,1,1,1,0,0,0,1,0,0,3,3,3,1,0,0.8,0.4,0.2,2.2,0.6,0.6,0.2,2,0.9,0.85,2.33,1.33,1,2,0,7,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,1.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,0,0,1,1,0,0,-1,-1,1,0,0,0,0,0,0,0,-1,1,1,0.2,-0.2,0,0.2,0.05 +586,R_6P5D4RUzUfkrJ9g,25 - 31,Canadian,Female,2,2,3,1,2,-2,-2,1,-2,1,3,2,3,-2,3,-1,-1,1,1,-1,3,3,3,1,3,6,-2,-3,3,-3,1,7,3,1,2,-3,3,7,1,1,1,-1,1,6,2,3,3,1,3,6,0,-3,3,-3,1,7,3,2,3,-3,3,6,1,1,1,1,-1,6,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0.107142857,0.071428571,0.142857143,32,100,29,90.63,8,100,6,75,8,100,7,87.5,15,93.75,14,87.5,100,100,100,100,100,100,100,9.37,9.37,0,25,0,12.5,6.25,12.5,1,1,0,0,1,0,1,2,1,0,0,1,1,1,0,2,2,0,2,2,0,1,0,0,1,2,1,2,1,0,0,0,0,1,0,2,2,0,0,0,0.6,0.8,0.6,1.6,0.4,1.2,0.2,0.8,0.9,0.65,6.67,6.33,0,0,1,0,0.34,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,1,0,0,0,0,-2,0,0,0,0,0,1,1,0,0,0,0,0,2,2,0.2,-0.4,0.4,0.8,0.25 +587,R_1wQsp7UmZK6dseF,39 - 45,Canadian,Female,2,3,2,1,2,-2,-2,3,3,1,1,3,3,2,0,-3,-1,-2,-3,-3,2,3,2,1,2,2,-2,-2,3,3,1,2,1,3,3,2,0,2,-3,-1,-3,-3,-3,2,2,3,2,1,2,2,-2,-2,3,3,1,2,1,3,3,2,0,1,-1,0,0,0,-2,6,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,79,TRUE,1,71,FALSE,1,100,FALSE,0,51,TRUE,1,100,TRUE,1,53,FALSE,0,69,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,76,TRUE,0,100,FALSE,1,59,FALSE,1,56,FALSE,0,100,FALSE,0,60,TRUE,0,59,TRUE,1,100,FALSE,1,55,TRUE,1,63,TRUE,0,56,FALSE,1,82,TRUE,0,100,TRUE,1,87,TRUE,1,69,TRUE,1,100,0,0.1369,0,0.2601,0,0,0,0.4761,0.1936,0.36,0.0169,0,0.2209,0,0.0841,1,0.3481,0.6241,0.0324,0.2025,1,0.04,0.1681,0,0.5776,0.3136,0.0961,0,1,1,1,1,0.348360714,0.237414286,0.459307143,16,50,19,59.38,5,62.5,4,50,4,50,6,75,11,68.75,8,50,82.03,74.5,88.25,74.75,90.62,81.44,82.62,-9.38,22.65,12,38.25,24.75,15.62,12.69,32.62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,3,1,0,0,0,0.2,0,0,0,1.8,0.05,0.45,2,1.67,0,0,1,-4,0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,44,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,-1,-3,-1,0,0,0,-1.6,-0.4 +588,R_5fYQJRqkZWFGWR4,18 - 24,Canadian,Female,1,2,0,2,2,1,1,1,1,-2,1,1,2,0,1,1,2,1,1,1,2,-2,0,3,3,6,-1,0,1,1,-1,9,1,-1,1,1,0,7,3,3,3,-3,3,6,2,3,0,3,-2,6,1,1,1,0,1,6,0,1,0,1,-1,6,2,2,3,3,3,7,FALSE,1,68,TRUE,1,60,TRUE,0,100,FALSE,1,63,TRUE,1,81,FALSE,1,67,TRUE,1,65,FALSE,0,100,TRUE,1,65,TRUE,1,81,TRUE,0,72,TRUE,0,100,FALSE,0,73,FALSE,1,100,TRUE,1,65,TRUE,1,97,TRUE,0,100,TRUE,0,84,TRUE,0,86,FALSE,1,92,TRUE,1,93,TRUE,1,100,TRUE,0,92,TRUE,1,100,TRUE,0,72,TRUE,1,100,TRUE,0,85,FALSE,1,89,TRUE,0,93,FALSE,0,86,TRUE,1,86,FALSE,0,93,1,0,0.0009,0.1225,0.8649,0.1089,0,0.0361,0.0064,0,0.7396,0.5329,0.1225,0.5184,0.0361,0.16,0.8464,0.1369,0.0121,0.5184,0.0049,0.1225,0.7396,0,1,0.7225,0.0196,0.1024,1,0.7056,0.8649,1,0.390057143,0.293507143,0.486607143,32,100,18,56.25,5,62.5,3,37.5,6,75,4,50,12,75,6,37.5,84.62,72.75,86.5,83.75,95.5,84.06,85.19,43.75,28.37,10.25,49,8.75,45.5,9.06,47.69,1,4,0,1,1,2,1,0,0,1,0,2,1,1,1,2,1,2,4,2,1,1,0,1,4,0,0,0,1,3,1,0,2,1,2,1,0,2,2,2,1.4,0.8,1,2.2,1.4,0.8,1.2,1.4,1.35,1.2,7.33,6,0,3,1,-1,1.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),20,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,3,0,0,-3,2,1,0,-1,-2,-1,2,-1,0,-1,1,1,0,2,0,0,0,-0.2,0.8,0.15 +589,R_1H2iF1BXiFFOtRi,32 - 38,Canadian,Male,2,3,2,-2,3,2,-2,-2,-2,2,2,2,2,1,3,-1,-2,1,-1,-2,2,3,2,-2,3,3,2,-2,2,-2,2,4,2,2,2,1,3,3,-2,-3,-2,-2,-2,7,2,3,2,-2,3,7,2,-2,-2,-2,2,7,2,2,2,1,3,7,2,2,2,2,-2,7,FALSE,1,99,TRUE,1,98,FALSE,1,96,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,97,TRUE,1,100,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,0,97,FALSE,1,98,TRUE,1,97,TRUE,1,100,FALSE,1,97,TRUE,0,100,FALSE,1,94,FALSE,1,96,TRUE,1,92,TRUE,1,91,FALSE,1,93,TRUE,1,92,FALSE,1,91,TRUE,1,92,FALSE,1,91,FALSE,1,89,FALSE,1,92,FALSE,0,87,TRUE,1,89,TRUE,1,73,0.0009,0.0064,0,0.0025,0.0729,0,0.0064,0,0.0016,0.0081,0.7569,0.9409,0,0.0016,0,0.0004,0.0049,0.9604,0.0121,0.0081,0.0064,0.0009,0.0036,0.0004,0.0009,0.0081,0.0121,0.0001,0.0016,1,0.0064,1,0.171957143,0.196721429,0.147192857,26,81.25,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,94.69,95.38,93,95.75,94.62,93.75,95.62,-3.13,10.31,7.88,5.5,8.25,19.62,6.25,14.37,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,1,3,0,0,0.8,0,1.2,0,0,0,2.2,0.5,0.55,3.33,7,-4,-3,-4,0,-3.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),33,0.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,-2,-3,2,-2,0,0,0.8,0,-1,-0.05 +590,R_1VyXet4YO7WSVtn,32 - 38,Canadian,Female,-2,3,2,-2,0,0,0,0,0,-1,0,0,2,-2,3,-1,0,0,-1,-2,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,4,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,76,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,94,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,68,0.25,0,0.25,0.25,0.1024,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.8836,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.314771429,0.245,0.384542857,4,12.5,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,8,50,10,62.5,60.56,50,55.5,75,61.75,57.38,63.75,-43.75,4.31,-12.5,-7,12.5,24.25,7.38,1.25,2,3,2,2,0,0,0,0,0,1,0,0,2,2,3,1,0,0,1,2,2,3,2,2,0,0,0,0,0,1,0,0,2,2,3,1,0,0,1,2,1.8,0.2,1.4,0.8,1.8,0.2,1.4,0.8,1.05,1.05,4.67,5,0,0,-1,0,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),38,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +591,R_5I5irZ0eBE0gODo,46 - 52,American,Male,2,-3,3,2,-2,-3,-2,2,1,1,2,3,2,-2,2,-3,-3,-3,1,-3,2,-2,2,2,-2,0,-3,2,1,3,2,0,2,3,3,-3,2,0,-3,-3,-3,1,-3,6,2,-3,3,2,-2,0,-3,0,2,2,2,1,2,2,2,-3,2,10,-3,-3,-3,2,-3,0,TRUE,0,100,TRUE,1,52,TRUE,0,100,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,FALSE,0,100,FALSE,1,87,FALSE,1,70,TRUE,1,94,FALSE,1,59,TRUE,1,100,TRUE,1,100,TRUE,0,98,TRUE,0,100,FALSE,1,53,FALSE,1,74,TRUE,1,98,TRUE,1,70,FALSE,1,59,TRUE,1,81,TRUE,0,84,TRUE,1,85,FALSE,1,55,FALSE,1,57,TRUE,0,88,TRUE,1,79,TRUE,1,100,TRUE,1,100,0,0.0225,0,0,0,0,0.0361,1,0.0676,0.09,0.0441,0.0036,0.0841,0.0169,0.0361,0.2304,0.1681,0.25,0.1849,0.7056,0.0004,0,0.2209,0.1681,0.9604,0.2025,0,1,1,1,0.7744,0.09,0.29765,0.144785714,0.450514286,17,53.13,25,78.13,8,100,6,75,4,50,7,87.5,15,93.75,10,62.5,82.66,71,89.75,87.25,82.62,88.19,77.12,-25,4.53,-29,14.75,37.25,-4.88,-5.56,14.62,0,1,1,0,0,0,4,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,1,0,1,0,1,0,0,0,0,1,0,0.4,1.6,0.4,0,0,0.8,0.4,0.2,0.6,0.35,0,3.67,0,-1,-10,6,-3.67,10 cents,75 minutes,24 days,Male,High School (or equivalent),48,0.25,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,1,1,0,0,0,2,1,1,0,0,-1,1,0,0,0,0,0,-1,0,0.4,0.8,0,-0.2,0.25 +592,R_6qy0KJnYzppG2b4,46 - 52,Canadian,Male,0,0,3,0,0,-3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,FALSE,1,100,FALSE,1,79,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,1,100,FALSE,1,83,TRUE,1,50,TRUE,0,50,FALSE,1,84,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.25,0.25,0,0,0,0.25,0,0,0.0441,0,0,0,0.25,0.25,0.25,0.25,0.8281,0.25,0.0256,0.0289,0,0,0,1,0.25,0.25,0.25,1,0.25,0.25,0.25,1,0.247382143,0.169442857,0.325321429,16,50,20,62.5,5,62.5,4,50,5,62.5,6,75,16,100,4,25,76.16,62.5,73.88,85.38,82.88,81.25,71.06,-12.5,13.66,0,23.88,22.88,7.88,-18.75,46.06,0,0,3,0,0,3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0.6,1,0.2,0,0.6,1,0.2,0,0.45,0.45,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,51,0,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +593,R_7tCl8IW1fbG8MeJ,39 - 45,Canadian,Male,0,1,2,1,1,-1,-1,1,-2,1,1,-2,2,1,3,-3,-3,-3,-2,-3,0,2,2,1,2,4,-2,1,2,0,0,5,3,0,2,0,2,4,-1,1,2,0,-2,8,0,2,2,2,2,2,0,0,0,0,0,6,2,2,2,0,0,5,0,0,0,0,-3,5,TRUE,0,72,FALSE,0,56,FALSE,1,59,FALSE,1,57,TRUE,1,87,FALSE,1,59,TRUE,1,70,TRUE,1,100,TRUE,1,62,TRUE,1,100,FALSE,1,57,TRUE,0,58,TRUE,1,86,TRUE,0,68,TRUE,1,95,TRUE,1,100,TRUE,0,68,TRUE,0,96,TRUE,0,83,TRUE,0,100,TRUE,1,65,FALSE,0,54,FALSE,1,62,FALSE,0,54,TRUE,0,65,TRUE,1,65,FALSE,1,53,TRUE,0,59,FALSE,1,53,TRUE,1,64,FALSE,0,50,TRUE,1,100,0,0.1225,0,0.09,0,0.1681,0.2916,0,1,0.2916,0.1296,0.0196,0.1444,0.1849,0.0169,0.3136,0.1444,0.1849,0.3481,0.4225,0.1225,0.0025,0.6889,0.4624,0.4624,0.2209,0.25,0.5184,0.1681,0.9216,0.2209,0.3364,0.286971429,0.2064,0.367542857,19,59.38,19,59.38,5,62.5,7,87.5,3,37.5,4,50,12,75,7,43.75,71.16,64.12,72.5,73.75,74.25,75.5,66.81,0,11.78,1.62,-15,36.25,24.25,0.5,23.06,0,1,0,0,1,1,2,1,2,1,2,2,0,1,1,2,4,5,2,1,0,1,0,1,1,1,1,1,2,1,1,4,0,1,3,3,3,3,2,0,0.4,1.4,1.2,2.8,0.6,1.2,1.8,2.2,1.45,1.45,4.33,4.33,2,-1,-1,3,0,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),43,1.5,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,-1,0,0,1,0,0,0,1,-2,0,0,-2,-1,1,2,0,1,-0.2,0.2,-0.6,0.6,0 +594,R_3vaz9NIWdwJZZHb,39 - 45,Canadian,Male,0,2,1,0,1,-2,1,0,-2,0,1,0,1,0,1,-2,0,0,-1,-3,1,2,1,0,1,6,-2,1,0,-2,0,3,1,0,1,0,1,6,-2,0,-1,-2,-3,3,1,2,1,0,1,3,0,1,0,-2,0,5,1,0,1,0,1,5,2,2,2,2,-2,8,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,85,TRUE,1,91,TRUE,1,80,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,90,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,100,FALSE,1,80,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0225,0.25,0.01,0.25,0,0.25,0.04,0.04,0.25,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.04,0.25,0.183146429,0.167007143,0.199285714,11,34.38,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,6,37.5,16,100,62.69,55.12,66.25,60,69.38,64.12,61.25,-34.37,-6.06,-7.38,3.75,-2.5,-18.12,26.62,-38.75,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,4,2,2,3,1,0.2,0,0,0.4,0.2,0.4,0,2.4,0.15,0.75,5,4.33,3,-2,1,-5,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,-4,-2,-1,-2,-1,0,-0.4,0,-2,-0.6 +595,R_1R1uDnYCf5JJcuL,46 - 52,Canadian,Male,2,3,2,3,3,-2,-3,3,-3,3,-1,2,3,2,3,-1,-1,-1,-2,-1,1,3,3,3,3,1,1,2,1,3,-2,8,3,3,-2,3,3,8,-3,1,-1,-3,1,8,2,3,-1,3,3,3,-3,-3,3,-3,2,3,3,3,3,3,3,5,2,1,3,2,-1,8,FALSE,1,100,FALSE,0,95,FALSE,1,93,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,95,FALSE,0,100,FALSE,1,99,FALSE,0,94,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0.01,1,0,0.0001,0,0,1,0,0,1,1,1,0,0,0,0.9025,0,0.64,0,0,1,0.8836,0,0.0001,0,0,1,0,0.0049,0,0,0.0025,0.3012,0.395892857,0.206507143,25,78.13,22,68.75,4,50,6,75,6,75,6,75,7,43.75,15,93.75,98.28,96.12,100,99.75,97.25,98.62,97.94,9.38,29.53,46.12,25,24.75,22.25,54.87,4.19,1,0,1,0,0,3,5,2,6,5,4,1,5,1,0,2,2,0,1,2,0,0,3,0,0,1,0,0,0,1,4,1,0,1,0,3,2,4,4,0,0.4,4.2,2.2,1.4,0.6,0.4,1.2,2.6,2.05,1.2,5.67,3.67,-2,5,3,0,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,47,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,0,-2,0,0,2,5,2,6,4,0,0,5,0,0,-1,0,-4,-3,2,-0.2,3.8,1,-1.2,0.85 +596,R_5jVXDLirMWeFO7r,32 - 38,Canadian,Male,2,3,2,2,3,1,3,3,2,3,3,2,2,2,3,3,2,3,3,-1,3,3,2,0,2,9,1,3,2,-1,2,8,3,3,2,2,0,9,1,3,2,2,0,9,2,2,3,1,2,9,2,2,2,-1,1,8,2,3,2,2,3,8,2,3,2,3,3,8,TRUE,0,73,TRUE,1,89,FALSE,1,73,FALSE,1,91,TRUE,1,90,TRUE,0,94,FALSE,0,90,TRUE,1,87,TRUE,1,85,FALSE,0,89,TRUE,0,87,TRUE,0,78,TRUE,1,100,TRUE,0,74,TRUE,1,71,TRUE,1,76,TRUE,0,88,TRUE,0,79,FALSE,1,91,TRUE,0,79,FALSE,0,82,TRUE,1,95,FALSE,1,83,TRUE,1,84,FALSE,1,50,TRUE,1,79,TRUE,0,71,TRUE,0,68,TRUE,0,85,TRUE,1,58,FALSE,0,66,FALSE,0,79,0.0169,0.0441,0.0576,0.81,0.6241,0.8836,0.0256,0.7921,0.6241,0.0025,0.1764,0,0.0225,0.7569,0.01,0.0121,0.0289,0.0081,0.4624,0.25,0.6724,0.0841,0.0081,0.5476,0.7744,0.5041,0.4356,0.5329,0.0729,0.6241,0.7225,0.6084,0.366657143,0.28335,0.449964286,11,34.38,16,50,5,62.5,3,37.5,3,37.5,5,62.5,11,68.75,5,31.25,80.75,81.38,87.62,78.62,75.38,82.5,79,-15.62,30.75,18.88,50.12,41.12,12.88,13.75,47.75,1,0,0,2,1,0,0,1,3,1,0,1,0,0,3,2,1,1,1,1,0,1,1,1,1,1,1,1,3,2,1,1,0,0,0,1,1,1,0,4,0.8,1,0.8,1.2,0.8,1.6,0.4,1.4,0.95,1.05,8.67,8.33,0,0,1,1,0.34,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),37,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,-1,-1,1,0,-1,-1,0,0,-1,-1,0,0,0,3,1,0,0,1,-3,0,-0.6,0.4,-0.2,-0.1 +597,R_5d2frsq8ebtA2fn,53 - 59,American,Male,2,2,2,2,-2,-2,-2,2,-2,2,-2,-2,2,-2,2,-2,-2,-2,-2,-2,2,2,2,2,-2,0,-2,-2,2,-2,2,0,-2,-2,2,-2,2,0,-2,-2,-2,-2,-2,1,2,2,2,2,-2,1,-2,-2,2,-2,2,1,-2,-2,2,-2,2,1,-2,-2,-2,-2,-2,1,FALSE,1,94,TRUE,1,100,FALSE,1,98,FALSE,1,79,TRUE,1,100,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,0,95,FALSE,0,100,FALSE,1,84,FALSE,1,100,FALSE,0,86,FALSE,1,100,FALSE,0,74,FALSE,0,90,TRUE,0,77,TRUE,0,100,FALSE,1,77,FALSE,1,100,FALSE,0,83,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,63,TRUE,0,93,TRUE,1,98,TRUE,1,72,TRUE,1,100,0,0.0009,0.81,0.0196,0,0,0,1,0,0.0001,0.0004,0.7396,0.9025,0.0256,0,0,0,0.0441,0.1369,0,0.6889,0.5476,0.0529,0,0.5929,0,0.0784,0.0036,0.0004,1,0.8649,0,0.238528571,0.193735714,0.283321429,24,75,23,71.88,6,75,4,50,6,75,7,87.5,10,62.5,13,81.25,92.03,85.12,92.38,97,93.62,92.5,91.56,3.12,20.15,10.12,42.38,22,6.12,30,10.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,-1,-1,0,-1,20 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,1.125,0,0,0,0,1,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +598,R_7oA5PsZawq3t9en,25 - 31,Canadian,Female,2,2,1,-1,0,0,-2,2,0,2,1,-2,3,-1,2,-2,-2,-2,-2,-3,3,3,3,-2,-2,3,-3,-2,-1,1,-2,6,-1,-2,1,-1,1,5,-3,-3,-3,-3,-3,8,2,2,2,1,0,3,0,-2,3,-1,2,2,2,-2,3,-1,3,1,-2,-1,0,0,-1,8,TRUE,0,81,FALSE,0,50,TRUE,0,94,FALSE,1,50,TRUE,1,71,FALSE,1,85,TRUE,1,55,TRUE,1,86,TRUE,1,75,TRUE,1,90,FALSE,1,50,TRUE,0,83,TRUE,1,53,FALSE,1,52,FALSE,0,52,FALSE,0,53,FALSE,1,53,TRUE,0,72,FALSE,1,51,FALSE,1,52,FALSE,0,94,FALSE,0,51,FALSE,1,50,TRUE,1,92,FALSE,1,51,TRUE,1,95,FALSE,1,51,FALSE,1,52,TRUE,0,95,FALSE,0,52,FALSE,0,70,TRUE,1,98,0.0196,0.0025,0.2809,0.2025,0.0004,0.0225,0.0064,0.01,0.2304,0.2601,0.2704,0.2209,0.0625,0.25,0.0841,0.25,0.25,0.25,0.2304,0.2401,0.8836,0.2704,0.2401,0.2304,0.2209,0.2401,0.49,0.6561,0.8836,0.5184,0.9025,0.6889,0.316542857,0.154835714,0.47825,20,62.5,20,62.5,5,62.5,6,75,5,62.5,4,50,9,56.25,11,68.75,67.47,56.12,74.88,68.38,70.5,71.06,63.88,0,4.97,-6.38,-0.12,5.88,20.5,14.81,-4.87,1,1,2,1,2,3,0,3,1,4,2,0,2,0,1,1,1,1,1,0,0,0,1,2,0,0,0,1,1,0,1,0,0,0,1,0,1,2,2,2,1.4,2.2,1,0.8,0.6,0.4,0.4,1.4,1.35,0.7,4.67,2,0,4,4,0,2.67,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,30,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,1,1,-1,2,3,0,2,0,4,1,0,2,0,0,1,0,-1,-1,-2,0.8,1.8,0.6,-0.6,0.65 +599,R_7B3gNZyQnJYWSeO,39 - 45,Canadian,Male,0,0,2,-2,1,0,0,1,0,2,1,0,1,1,0,-3,-2,-2,-2,-1,-1,-1,2,-1,2,5,1,0,0,0,1,5,1,1,1,1,1,5,-1,0,0,0,0,5,0,0,2,0,2,5,0,0,0,0,0,5,1,0,1,0,0,5,0,0,0,0,0,8,FALSE,1,82,TRUE,1,90,FALSE,1,78,FALSE,1,50,TRUE,1,74,FALSE,1,57,TRUE,1,87,TRUE,1,93,TRUE,1,59,TRUE,1,70,FALSE,1,50,TRUE,0,77,TRUE,1,81,FALSE,1,83,FALSE,0,50,TRUE,1,87,FALSE,1,54,TRUE,0,88,FALSE,1,50,FALSE,1,87,FALSE,0,83,FALSE,0,50,TRUE,0,66,FALSE,0,50,FALSE,1,90,TRUE,1,78,FALSE,1,55,TRUE,0,65,TRUE,0,94,TRUE,1,96,FALSE,0,56,TRUE,1,100,0.0049,0.0484,0.0169,0.0169,0,0.1849,0.25,0.09,0.0169,0.25,0.0016,0.0361,0.1681,0.25,0.0676,0.01,0.4356,0.25,0.4225,0.01,0.6889,0.25,0.25,0.0289,0.2116,0.2025,0.3136,0.0324,0.0484,0.7744,0.8836,0.5929,0.240017857,0.143628571,0.336407143,25,78.13,22,68.75,6,75,5,62.5,6,75,5,62.5,11,68.75,11,68.75,72.81,57.5,76.12,78.5,79.12,75.25,70.38,9.38,4.06,-17.5,13.62,3.5,16.62,6.5,1.63,1,1,0,1,1,1,0,1,0,1,0,1,0,0,1,2,2,2,2,1,0,0,0,2,1,0,0,1,0,2,0,0,0,1,0,3,2,2,2,1,0.8,0.6,0.4,1.8,0.6,0.6,0.2,2,0.9,0.85,5,5,0,0,0,-3,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,41,0.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,02REV,1,1,0,-1,0,1,0,0,0,-1,0,1,0,-1,1,-1,0,0,0,0,0.2,0,0.2,-0.2,0.05 +600,R_6tldWtJsPKe7ccx,32 - 38,American,Female,3,3,3,2,3,3,-1,3,3,3,2,0,3,3,3,2,-1,-2,3,3,3,3,3,2,3,10,1,0,1,2,3,10,0,3,3,-1,3,5,3,2,3,0,3,10,3,3,3,1,3,10,0,-1,2,2,2,3,1,3,3,3,3,10,3,3,3,3,-3,10,TRUE,0,100,TRUE,1,98,TRUE,0,87,TRUE,0,79,TRUE,1,81,TRUE,0,69,TRUE,1,74,TRUE,1,75,TRUE,1,83,TRUE,1,65,TRUE,0,76,TRUE,0,100,FALSE,0,99,TRUE,0,70,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,94,TRUE,1,99,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,88,TRUE,0,100,TRUE,1,99,FALSE,0,99,TRUE,1,100,0.0625,0,0,0.0676,0,0.4761,0.0001,0.1225,0,0,0.0001,0.9801,0.0289,0.5776,0.0361,0.0004,0.8836,0.6241,0.7744,1,1,0.0625,0,0.49,0,0,0.9801,1,0.7569,0,1,1,0.421196429,0.2664,0.575992857,16,50,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,13,81.25,5,31.25,90.94,88.75,92.88,88.62,93.5,90.44,91.44,-6.25,34.69,26.25,55.38,26.12,31,9.19,60.19,0,0,0,0,0,2,1,2,1,0,2,3,0,4,0,1,3,5,3,0,0,0,0,1,0,3,0,1,1,1,1,3,0,0,0,1,4,5,0,6,0,1.2,1.8,2.4,0.2,1.2,0.8,3.2,1.35,1.35,8.33,7.67,0,7,-5,0,0.66,10 cents,25 minutes,36 days,Female,College Diploma/Certificate,38,0.125,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,0,-1,1,1,0,-1,1,0,0,4,0,0,-1,0,3,-6,-0.2,0,1,-0.8,0 +601,R_1Kf4u6wyxvfsiK5,32 - 38,Canadian,Female,0,1,1,3,3,0,-2,2,1,1,2,2,2,2,2,1,1,2,1,2,0,1,1,1,1,7,0,0,0,0,0,5,3,2,2,2,2,7,2,2,2,2,2,7,0,0,2,3,3,7,0,-3,2,0,1,7,2,2,2,-1,2,8,3,3,3,3,3,8,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,70,TRUE,0,70,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,75,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,0,80,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0225,0.25,0.09,0,0,0,0.25,0.25,0.25,0.5625,0.25,0.09,0.25,0.25,0.25,0.25,0.25,0.25,0.64,1,0.0625,0.25,0.25,0.49,0.25,0.25,0.25,0.25,0,0,0.25,0,0.253392857,0.225178571,0.281607143,16,50,19,59.38,4,50,7,87.5,3,37.5,5,62.5,6,37.5,13,81.25,66.41,50,68.12,74.38,73.12,64.06,68.75,-9.38,7.03,0,-19.38,36.88,10.62,26.56,-12.5,0,0,0,2,2,0,2,2,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,3,0,2,2,1,2,1,0.8,1.2,0.2,0.6,0.4,0.4,0.6,1.6,0.7,0.75,6.33,7.33,0,-2,-1,-1,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,37,0,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,-1,-1,2,2,0,1,2,0,1,1,0,0,-3,0,-1,-1,-1,-1,-1,0.4,0.8,-0.4,-1,-0.05 +602,R_3dgnEiy0SXxuaGA,25 - 31,Canadian,Male,2,2,-1,2,3,2,-3,2,-3,3,-2,-3,2,-2,3,2,3,2,2,2,2,2,-1,1,3,0,2,-3,2,-3,3,0,-2,-3,2,-2,3,0,2,1,2,2,1,1,1,2,-2,1,3,0,2,-3,2,-3,3,1,-2,-3,2,2,3,0,2,1,2,2,2,0,FALSE,1,95,TRUE,1,90,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,0,50,FALSE,0,100,TRUE,1,50,TRUE,1,50,0,0.25,0,0,0.25,0.25,0.25,0,0,0,1,0,0,0,0,0.01,0,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,1,0.25,0.0025,0.25,0.25,0.25,1,0.232589286,0.143571429,0.321607143,20,62.5,24,75,6,75,6,75,7,87.5,5,62.5,12,75,12,75,76.09,73.75,68.75,80.62,81.25,80.62,71.56,-12.5,1.09,-1.25,-6.25,-6.88,18.75,5.62,-3.44,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,4,0,0,2,0,0,0,0.2,0,0,0.6,0.6,0,0.8,0.4,0.2,0.45,0,0.33,0,-1,0,1,-0.33,10 cents,5 minutes,24 days,Male,University - Undergraduate,30,1.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,-1,0,-1,0,0,0,0,0,0,0,0,0,0,-4,0,0,0,0,0,1,-0.4,0,-0.8,0.2,-0.25 +603,R_1NayeAJIS2Angtt,25 - 31,American,Male,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,0,3,6,3,3,3,3,3,7,3,3,3,3,3,7,3,3,3,3,3,6,3,3,3,3,3,6,3,3,3,3,3,8,3,3,3,3,3,7,TRUE,0,75,TRUE,1,80,TRUE,0,77,TRUE,0,75,TRUE,1,76,TRUE,0,75,TRUE,1,79,TRUE,1,74,TRUE,1,72,TRUE,1,66,TRUE,0,81,TRUE,0,88,TRUE,1,78,TRUE,0,70,TRUE,1,78,TRUE,1,82,TRUE,0,88,TRUE,0,78,TRUE,0,88,TRUE,0,91,TRUE,1,78,TRUE,1,85,TRUE,0,79,TRUE,1,80,TRUE,0,85,TRUE,1,79,TRUE,0,89,TRUE,0,79,TRUE,0,71,TRUE,1,72,TRUE,1,77,TRUE,1,85,0.0676,0.0441,0.0324,0.0441,0.0225,0.5625,0.04,0.1156,0.8281,0.0225,0.0784,0.0484,0.0784,0.6561,0.0576,0.04,0.6241,0.5625,0.6241,0.7225,0.0484,0.0484,0.7744,0.49,0.7744,0.7921,0.0529,0.5625,0.5929,0.6084,0.5041,0.7744,0.39665,0.266907143,0.526392857,27,84.38,16,50,4,50,4,50,4,50,4,50,16,100,0,0,79.06,80,78.75,77.12,80.38,77.56,80.56,34.38,29.06,30,28.75,27.12,30.38,-22.44,80.56,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0,0,0,0,0.3,0,5,6.67,-4,0,-1,0,-1.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,30,0,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0.3 +604,R_5cAaW06IpPj9KAZ,46 - 52,Canadian,Female,2,3,2,-2,3,0,2,1,0,3,0,0,3,0,3,-2,-1,0,-1,-2,2,3,2,-2,3,2,0,0,1,-1,3,2,0,0,3,0,3,2,1,1,1,0,-2,9,2,3,2,0,3,2,0,0,0,0,2,1,0,3,3,0,3,1,0,0,0,0,0,3,FALSE,1,50,TRUE,1,59,FALSE,1,75,TRUE,0,50,TRUE,1,50,FALSE,1,97,TRUE,1,75,TRUE,1,81,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,97,TRUE,1,97,TRUE,0,50,TRUE,1,50,TRUE,1,90,TRUE,0,50,FALSE,1,86,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,50,TRUE,1,70,FALSE,1,50,TRUE,1,99,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,FALSE,0,50,TRUE,1,91,0.0361,0.0001,0.01,0.0625,0.0081,0.0009,0.09,0.25,0.25,0.0225,0.09,0.0009,0.25,0.25,0.25,0.1681,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.0196,0.25,0.0009,0.177267857,0.152178571,0.202357143,26,81.25,23,71.88,4,50,5,62.5,6,75,8,100,13,81.25,10,62.5,64.75,51.12,66.88,68.12,72.88,69.81,59.69,9.37,-7.13,1.12,4.38,-6.88,-27.12,-11.44,-2.81,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,3,2,1,1,0,0,0,0,2,0,0,2,1,0,1,0,3,0,0,0,2,1,0,1,2,0,0.6,0,1.4,0.4,0.8,0.6,1.2,0.5,0.75,2,1.33,0,1,1,6,0.67,5 cents,5 minutes,47 days,Female,University - Undergraduate,48,1.375,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,-2,0,0,0,-1,1,-1,0,-3,0,0,0,1,1,1,0,-2,-0.4,-0.2,-0.6,0.2,-0.25 +605,R_5Hk8AWYo2ec0omN,53 - 59,American,Female,2,2,2,2,1,1,-3,2,-2,2,2,-3,2,-2,2,2,2,2,2,-2,2,2,1,-2,1,10,1,-3,2,-3,-1,9,2,-3,3,1,1,6,-3,-2,-3,-1,-3,10,2,2,3,2,3,3,2,-3,2,-3,3,1,2,-3,2,-3,2,2,2,1,2,2,-3,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,77,TRUE,1,84,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,88,TRUE,1,99,FALSE,1,72,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,60,TRUE,1,98,FALSE,1,54,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0.0004,0.0004,0,0,0,0.0001,0,0,0,0,0.0144,0.0784,0.0256,0,0,0.5929,0,0,0.1156,0.36,0.5776,0,0.2116,1,1,1,1,1,1,1,0.320578571,0.050814286,0.590342857,24,75,22,68.75,3,37.5,7,87.5,6,75,6,75,14,87.5,8,50,92.88,84.12,88,99.62,99.75,93.31,92.44,6.25,24.13,46.62,0.5,24.62,24.75,5.81,42.44,0,0,1,4,0,0,0,0,1,3,0,0,1,3,1,5,4,5,3,1,0,0,1,0,2,1,0,0,1,1,0,0,0,1,0,0,1,0,0,1,1,0.8,1,3.6,0.6,0.6,0.2,0.4,1.6,0.45,8.33,2,7,8,4,8,6.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,56,1,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,4,-2,-1,0,0,0,2,0,0,1,2,1,5,3,5,3,0,0.4,0.2,0.8,3.2,1.15 +606,R_7JXftDKPzQjEhGI,39 - 45,American,Male,-3,3,3,0,-3,1,0,1,1,2,2,2,3,1,-1,2,2,0,3,2,-3,3,3,0,-3,4,3,2,2,2,2,6,1,1,1,2,1,5,2,3,1,1,1,5,-3,3,3,2,-3,7,3,0,2,2,2,7,2,3,2,1,2,8,2,2,2,3,2,5,TRUE,0,100,TRUE,1,55,TRUE,0,100,FALSE,1,50,TRUE,1,55,FALSE,1,94,FALSE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,86,FALSE,1,100,FALSE,1,95,FALSE,0,55,TRUE,0,100,FALSE,0,50,TRUE,1,50,FALSE,1,53,FALSE,1,50,TRUE,0,50,TRUE,0,56,FALSE,0,52,FALSE,0,50,FALSE,1,67,TRUE,1,62,FALSE,1,100,TRUE,1,71,FALSE,1,50,TRUE,0,53,FALSE,1,53,TRUE,1,64,TRUE,1,50,TRUE,1,100,0.25,0.0841,0.25,0.25,0,0.0036,0.1444,0.0196,0.3136,0.25,0.1296,0.3025,0.25,0,0.2025,0.2025,0.1089,0.25,0.2809,0,0.2704,0.25,0.25,1,0.2209,0.25,0.25,1,1,0.25,0.2209,0.0025,0.2651,0.155514286,0.374685714,7,21.88,20,62.5,6,75,6,75,4,50,4,50,10,62.5,10,62.5,66.28,56.88,66.12,75.88,66.25,59.38,73.19,-40.62,3.78,-18.12,-8.88,25.88,16.25,-3.12,10.69,0,0,0,0,0,2,2,1,1,0,1,1,2,1,2,0,1,1,2,1,0,0,0,2,0,2,0,1,1,0,0,1,1,0,3,0,0,2,0,0,0,1.2,1.4,1,0.4,0.8,1,0.4,0.9,0.65,5,7.33,-3,-1,-3,0,-2.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),43,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-2,0,0,2,0,0,0,1,0,1,1,-1,0,1,-1,2,1,-0.4,0.4,0.4,0.6,0.25 +607,R_5ckmxcbDinSRtHz,46 - 52,American,Male,3,1,1,1,3,0,-3,3,-3,3,2,0,-3,-3,2,2,2,2,2,2,3,2,1,1,3,1,1,-3,3,-3,3,1,3,0,3,-3,3,1,2,2,2,1,2,1,3,3,1,1,3,1,1,-3,3,-3,3,1,3,0,3,-3,2,1,2,2,2,2,2,1,FALSE,1,58,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,1,56,FALSE,1,100,TRUE,1,100,TRUE,1,99,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,58,TRUE,1,100,FALSE,1,100,FALSE,1,82,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,99,TRUE,0,83,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0001,0,0,0,0,0,0,1,0,0,0,0,1,0,0.1936,0,0.1936,0.1849,0.0001,0,0,0.3364,1,1,0,0.2809,1,0.1764,0,0.0324,0.6889,1,0.288828571,0.183721429,0.393935714,23,71.88,23,71.88,3,37.5,7,87.5,6,75,7,87.5,12,75,11,68.75,90.66,83.5,86.88,92.5,99.75,94.56,86.75,0,18.78,46,-0.62,17.5,12.25,19.56,18,0,1,0,0,0,1,0,0,0,0,1,0,6,0,1,0,0,0,1,0,0,2,0,0,0,1,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0.2,0.2,1.6,0.2,0.4,0.2,1.4,0,0.55,0.5,1,1,0,0,0,0,0,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),50,0.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,-0.2,0,0.2,0.2,0.05 +608,R_6nacRReK5I8yOn7,46 - 52,Canadian,Female,2,2,2,2,2,-1,-2,2,-1,1,2,-2,2,-1,2,2,2,2,2,2,2,2,2,2,2,5,-1,-2,2,-1,1,6,2,-2,2,-2,2,5,1,1,1,1,2,6,2,2,2,2,2,5,-1,-2,2,-1,0,5,2,-2,2,-1,2,6,2,2,2,2,2,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,0,1,1,1,1,1,0.464285714,0.142857143,0.785714286,30,93.75,19,59.38,5,62.5,4,50,5,62.5,5,62.5,14,87.5,5,31.25,100,100,100,100,100,100,100,34.37,40.62,37.5,50,37.5,37.5,12.5,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.8,0,0.2,0,0,0.25,0.05,5.33,5.33,0,1,-1,1,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,52,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,1,1,1,1,0,0,-0.2,0.2,0.8,0.2 +609,R_51j4STDFM37GFno,32 - 38,American,Female,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,-3,-3,-3,-3,-3,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,75,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,76,TRUE,1,76,TRUE,1,73,TRUE,1,100,TRUE,0,73,TRUE,0,100,TRUE,1,100,FALSE,1,74,FALSE,0,78,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,75,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,78,FALSE,1,50,TRUE,0,72,FALSE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0576,0.0484,0,0.5776,0,0,0.25,0,0.25,0.25,0,0,0.0729,0.5329,0.25,0.0625,0.25,0.25,0.5184,0,0,0.6084,0.0625,0.0676,0,0.25,0.25,1,1,1,0.0625,1,0.285275,0.154878571,0.415671429,16,50,20,62.5,4,50,8,100,4,50,4,50,11,68.75,9,56.25,78.91,65.5,84.38,84.75,81,78.5,79.31,-12.5,16.41,15.5,-15.62,34.75,31,9.75,23.06,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,2.4,0,0,3,2.4,0,0,3,1.35,1.35,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +610,R_1Ez47sYA4mD0iDD,46 - 52,American,Female,3,3,-1,3,0,-3,-1,2,-2,-2,1,3,2,-2,1,3,3,3,3,3,3,3,1,3,-1,1,-3,-2,3,-2,-2,2,1,3,2,-2,1,2,3,3,3,3,3,1,3,3,-1,3,-2,1,-3,-1,2,-2,-2,1,1,3,2,-2,1,1,3,3,3,3,3,1,TRUE,0,91,TRUE,1,83,FALSE,1,100,TRUE,0,57,TRUE,1,62,FALSE,1,95,TRUE,1,85,TRUE,1,92,TRUE,1,76,TRUE,1,94,FALSE,1,75,FALSE,1,85,TRUE,1,73,TRUE,0,81,TRUE,1,85,TRUE,1,85,TRUE,0,82,FALSE,1,97,FALSE,1,87,TRUE,0,73,TRUE,1,90,TRUE,1,90,FALSE,1,76,TRUE,1,93,FALSE,1,98,TRUE,1,97,TRUE,0,59,FALSE,1,87,TRUE,0,98,FALSE,0,71,FALSE,0,95,FALSE,0,74,0.0064,0.0009,0.0225,0.0225,0.5476,0.0025,0.0049,0.0036,0.5329,0.01,0.5041,0.0729,0.0576,0.0625,0.1444,0.0289,0.0576,0.3249,0.0169,0.0004,0.01,0.0225,0.0169,0.6561,0.6724,0.3481,0.9025,0.8281,0,0.0009,0.9604,0.0225,0.243289286,0.168171429,0.318407143,14,43.75,22,68.75,5,62.5,5,62.5,6,75,6,75,13,81.25,9,56.25,83.94,77.12,81.25,91.62,85.75,84.06,83.81,-25,15.19,14.62,18.75,16.62,10.75,2.81,27.56,0,0,2,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0.4,0,0,0.4,0,0,0,0.25,0.1,1.67,1,0,1,1,0,0.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,0.375,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,2,0,-1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0,0.15 +611,R_1dMxnugtrZ4FKc4,32 - 38,American,Male,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,3,2,3,2,3,3,3,9,2,3,3,3,3,7,1,3,3,3,3,10,2,3,2,3,3,10,3,3,3,2,2,8,3,3,3,3,3,10,3,3,3,3,3,10,3,3,2,1,2,8,TRUE,0,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,81,TRUE,0,78,TRUE,0,80,TRUE,1,92,TRUE,0,100,TRUE,1,83,TRUE,1,81,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,0,63,TRUE,1,50,TRUE,1,50,TRUE,0,51,TRUE,1,50,TRUE,0,50,TRUE,1,68,TRUE,0,89,TRUE,0,94,TRUE,0,81,TRUE,1,100,TRUE,1,85,TRUE,1,96,0.25,0.1024,0.0361,0,0.0016,0.25,0.25,0.0361,0.3969,0.25,0,0.0064,0.25,0.6084,0,0.25,0.2601,1,0.8836,0.25,0.25,0.0289,0.25,1,1,0.7921,0.0225,0.25,1,0.25,0.6561,0.64,0.386882143,0.25425,0.519514286,29,90.63,15,46.88,3,37.5,4,50,4,50,4,50,15,93.75,0,0,74.12,73.12,77.5,68.62,77.25,74.12,74.12,43.75,27.24,35.62,27.5,18.62,27.25,-19.63,74.12,0,1,0,0,0,1,0,0,1,0,2,0,0,0,1,1,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,2,0,0.2,0.4,0.6,0.6,0.4,0.2,0.2,0.6,0.45,0.35,8.67,9.33,1,-3,0,2,-0.66,5 cents,100 minutes,36 days,Male,College Diploma/Certificate,35,0,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,1,0,-1,-1,1,0,0,0,0,2,0,0,0,0,1,0,0,-2,1,-0.2,0.2,0.4,0,0.1 +612,R_5fASb8KCbKFlqxD,46 - 52,American,Female,2,3,3,-1,2,-2,-1,1,1,1,1,-2,2,-2,2,1,1,-1,-1,-2,3,3,3,-2,1,7,-2,-2,-2,1,1,5,1,-2,2,-2,3,5,1,1,1,1,-1,6,3,3,3,-1,2,5,-1,-1,2,-1,1,5,3,-1,2,-2,3,5,1,1,1,-1,-1,5,FALSE,1,100,TRUE,1,63,TRUE,0,81,TRUE,0,55,TRUE,1,55,FALSE,1,100,TRUE,1,80,FALSE,0,65,TRUE,1,62,TRUE,1,96,FALSE,1,100,TRUE,0,71,TRUE,1,76,TRUE,0,77,FALSE,0,50,TRUE,1,61,TRUE,0,57,FALSE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,77,FALSE,1,100,TRUE,1,61,TRUE,0,58,TRUE,1,100,TRUE,0,50,FALSE,1,69,TRUE,0,50,TRUE,1,82,TRUE,1,50,TRUE,1,100,0.4225,0,0.1521,0.04,0,0,0.1521,0.0016,0.25,0.0529,0.0324,0.0576,0.1444,0,0.2025,0.1369,0,0.3025,0.0961,0.3364,0,0.25,0,0.5929,0.3249,0.25,0.25,0,0.6561,0,0.25,0.5041,0.172978571,0.095207143,0.25075,20,62.5,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,74.88,66.25,79.75,86,67.5,73.62,76.12,-6.25,6.13,3.75,4.75,11,5,-13.88,26.12,1,0,0,1,1,0,1,3,0,0,0,0,0,0,1,0,0,2,2,1,1,0,0,0,0,1,0,1,2,0,2,1,0,0,1,0,0,2,0,1,0.6,0.8,0.2,1,0.2,0.8,0.8,0.6,0.65,0.6,5.67,5,2,0,0,1,0.67,10 cents,25 minutes,24 days,Female,High School (or equivalent),50,0.25,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,1,1,-1,1,2,-2,0,-2,-1,0,0,0,0,0,0,2,0,0.4,0,-0.6,0.4,0.05 +613,R_7D7xN24lmXDg2r9,46 - 52,American,Male,0,2,3,2,2,2,3,2,3,2,0,1,1,2,1,1,-1,0,1,-2,0,2,3,3,2,5,1,2,2,2,2,6,-3,0,0,1,0,6,2,3,2,2,0,9,1,1,0,1,0,6,1,0,1,0,1,6,1,1,1,1,1,6,1,1,0,1,1,6,TRUE,0,98,FALSE,0,77,TRUE,0,100,FALSE,1,86,FALSE,0,72,FALSE,1,86,TRUE,1,100,TRUE,1,79,TRUE,1,83,FALSE,0,82,TRUE,0,77,FALSE,1,76,TRUE,1,70,TRUE,0,90,TRUE,1,68,TRUE,1,58,TRUE,0,69,FALSE,1,100,TRUE,0,84,FALSE,1,97,TRUE,1,74,TRUE,1,80,FALSE,1,100,FALSE,0,72,TRUE,0,78,TRUE,1,98,TRUE,0,94,FALSE,1,90,TRUE,0,61,TRUE,1,100,FALSE,0,63,TRUE,1,88,0.0441,0.0004,0.1764,0,0.0144,0.0196,0.5184,0.6724,0.0009,0.04,0,0.09,0.0289,0.5929,0.5184,0.5929,0,0.0196,0.01,0.6084,0.0676,0.1024,0.7056,0.81,0.4761,0.8836,0.3969,0.9604,1,0,0.3721,0.0576,0.341396429,0.222028571,0.460764286,24,75,18,56.25,3,37.5,5,62.5,4,50,6,75,11,68.75,7,43.75,82.81,79,77.5,90.75,84,79,86.62,18.75,26.56,41.5,15,40.75,9,10.25,42.87,0,0,0,1,0,1,1,0,1,0,3,1,1,1,1,1,4,2,1,2,1,1,3,1,2,1,3,1,3,1,1,0,0,1,0,0,2,0,0,3,0.2,0.6,1.4,2,1.6,1.8,0.4,1,1.05,1.2,5.67,6,-1,0,0,3,-0.33,10 cents,5 minutes,24 days,Male,University - PhD,46,0,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,-1,-3,0,-2,0,-2,-1,-2,-1,2,1,1,0,1,1,2,2,1,-1,-1.4,-1.2,1,1,-0.15 +614,R_3CUEy5WMiVcl5hL,46 - 52,American,Female,3,3,3,3,3,-3,-1,1,-1,3,1,-1,2,-1,3,2,2,2,3,2,3,3,3,3,3,0,-3,-1,2,-1,3,1,1,-2,3,-1,3,1,2,1,2,3,2,4,2,3,3,3,2,1,-3,-2,2,-2,3,1,1,-2,3,-2,3,1,2,1,2,3,2,4,FALSE,1,100,TRUE,1,76,FALSE,1,75,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,98,FALSE,1,94,TRUE,0,86,TRUE,1,98,FALSE,1,95,TRUE,1,88,TRUE,1,92,FALSE,1,92,TRUE,0,100,TRUE,0,71,FALSE,1,100,TRUE,1,100,TRUE,1,98,FALSE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,0,70,FALSE,1,94,TRUE,0,100,TRUE,1,90,TRUE,1,74,TRUE,1,100,0,0,0.0064,0,0,0,0.0064,0.0004,0,0.0004,0.01,0.0004,0.0004,0.0036,0,0.0576,0,0.25,0.0036,0,0,0.0144,0.5041,0.0025,0.0064,0.49,0.0676,0,0.0625,1,1,0.7396,0.150710714,0.023514286,0.277907143,27,84.38,26,81.25,5,62.5,7,87.5,7,87.5,7,87.5,16,100,10,62.5,91.59,77.62,98.75,98.88,91.12,94,89.19,3.13,10.34,15.12,11.25,11.38,3.62,-6,26.69,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,0,0.2,0.4,0.2,0.4,0.6,0.6,0.2,0.2,0.45,0.67,1,-1,0,0,0,-0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,51,1.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,0,0,0,-1,0,-1,0,-1,0,0,0,0,-1,0,0,0,0,0,0,-0.4,-0.4,-0.2,0,-0.25 +615,R_7DA0CusRVJLhNBr,39 - 45,American,Female,1,1,1,1,-3,-2,0,1,0,1,0,-1,1,-1,1,-3,-3,-3,-3,-3,2,2,1,1,-3,5,-3,0,0,0,1,5,0,-3,1,-2,1,5,-3,-3,-3,-3,-3,5,1,1,1,1,1,5,-2,0,0,0,1,5,-1,-1,1,-1,0,5,0,0,0,0,0,5,TRUE,0,52,TRUE,1,52,FALSE,1,50,FALSE,1,50,TRUE,1,53,TRUE,0,51,TRUE,1,51,TRUE,1,78,TRUE,1,50,TRUE,1,50,TRUE,0,51,TRUE,0,54,TRUE,1,50,TRUE,0,53,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,52,TRUE,1,50,0.0484,0.25,0.25,0.2401,0.25,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2601,0.2209,0.2304,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.25,0.25,0.2304,0.2704,0.25,0.25,0.25,0.2916,0.2516,0.247964286,0.255235714,6,18.75,22,68.75,6,75,5,62.5,5,62.5,6,75,16,100,6,37.5,51.47,50.62,50.5,50.75,54,52.25,50.69,-50,-17.28,-24.38,-12,-11.75,-21,-47.75,13.19,1,1,0,0,0,1,0,1,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,4,0,0,1,0,0,1,0,0,0,1,3,3,3,3,3,0.4,0.4,0.6,0,0.8,0.2,0.4,3,0.35,1.1,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),39,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,1,1,0,0,-4,1,0,0,0,0,-1,2,0,1,-1,-3,-3,-3,-3,-3,-0.4,0.2,0.2,-3,-0.75 +616,R_5OjN5p4s72spH8M,39 - 45,Canadian,Male,2,2,1,-2,1,1,-2,2,-2,2,-2,-2,2,-2,1,1,1,2,1,-1,2,2,2,-2,2,1,1,-2,2,-2,2,2,-1,-1,2,-1,1,2,0,2,1,0,-1,2,2,2,2,-1,1,2,2,-2,2,-2,2,2,-1,-1,2,-3,1,2,1,1,1,1,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,91,TRUE,0,89,TRUE,1,100,TRUE,0,100,FALSE,0,62,TRUE,1,100,TRUE,0,97,FALSE,1,89,FALSE,1,84,FALSE,1,96,TRUE,1,90,TRUE,1,100,FALSE,1,98,FALSE,0,95,FALSE,1,100,TRUE,1,95,TRUE,0,93,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,85,TRUE,1,100,0,0.0025,0,0,0,0,0.9025,0,0.0016,0,0,0,0,0.0081,0,0,0.0004,0.7056,0.0025,0,0.01,0.3844,0.0256,1,0.9409,0.8649,0.0225,1,1,0.0121,1,0.7921,0.309757143,0.115585714,0.503928571,29,90.63,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,95.09,87.38,98.12,98,96.88,95.44,94.75,21.88,26.34,24.88,23.12,23,34.38,7.94,44.75,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,0.4,0,0.6,0.8,0.4,0.2,0.6,0.2,0.45,0.35,1.67,2,-1,0,0,0,-0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),42,1.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,1,-1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,-0.2,0,0.6,0.1 +617,R_3KZ8crIbT1lOYdB,32 - 38,American,Female,3,3,3,2,3,1,0,1,1,1,1,2,2,1,1,1,3,2,2,0,3,2,2,2,3,10,0,2,1,1,2,9,1,3,1,2,1,8,2,1,3,2,1,8,3,2,3,3,3,9,3,-3,3,-3,3,10,1,2,2,2,3,10,3,3,3,3,3,10,TRUE,0,100,FALSE,0,60,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,51,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,69,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,99,FALSE,0,93,TRUE,1,100,0,0,0,0,0,0.2401,1,1,0,0,0.0001,0,0,0,0,0.36,0,1,1,0,1,0,0,0.0961,0,0,0.8649,1,1,1,1,1,0.4129,0.257157143,0.568642857,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,96,94.12,93.88,96.12,99.88,97,95,-12.5,33.5,31.62,18.88,33.62,49.88,28.25,38.75,0,1,1,0,0,1,2,0,0,1,0,1,1,1,0,1,2,1,0,1,0,1,0,1,0,2,3,2,4,2,0,0,0,1,2,2,0,1,1,3,0.4,0.8,0.6,1,0.4,2.6,0.6,1.4,0.7,1.25,9,9.67,1,-1,-2,-2,-0.67,15 cents,100 minutes,24 days,Female,University - Undergraduate,34,0.375,0,0,0,0,1,1,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,1,-1,0,-1,-1,-2,-4,-1,0,1,1,0,-2,-1,2,0,-1,-2,0,-1.8,0,-0.4,-0.55 +618,R_1Gic3Mg1IiLYIzn,39 - 45,American,Male,-1,2,3,2,1,1,-2,1,0,0,2,0,3,-1,3,-1,-1,-1,0,-2,0,3,3,2,0,2,2,-2,1,-1,0,5,2,2,3,-1,3,4,-1,0,0,0,-2,6,0,3,3,3,2,7,2,-1,1,1,0,6,3,3,3,-2,3,4,1,1,0,1,-1,7,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,72,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,0,50,FALSE,1,100,FALSE,1,100,TRUE,1,63,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,0.25,0.0784,0,0,0.1369,0,0,0.25,0,0,0,0.25,0,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0,0.25,0.150546429,0.06895,0.232142857,16,50,24,75,4,50,8,100,6,75,6,75,13,81.25,11,68.75,77.66,62.5,93.75,71.5,82.88,83.44,71.88,-25,2.66,12.5,-6.25,-3.5,7.88,2.19,3.13,1,1,0,0,1,1,0,0,1,0,0,2,0,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,1,0,1,3,0,1,0,2,2,1,1,1,0.6,0.4,0.4,0.4,0.8,0.6,1,1.4,0.45,0.95,3.67,5.67,-5,-1,0,-1,-2,5 cents,5 minutes,24 days,Male,High School (or equivalent),42,1.375,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,0,0,-1,0,0,0,-1,-1,0,-1,0,-2,-1,0,-1,-1,-0.2,-0.2,-0.6,-1,-0.5 +619,R_74ocXQ0S1nX87vz,46 - 52,American,Male,3,3,3,2,3,3,3,3,2,3,2,2,3,3,3,2,3,3,3,3,3,3,2,3,3,10,3,3,3,2,3,9,3,2,3,3,3,10,3,3,3,3,2,10,3,2,3,3,3,10,3,3,3,2,3,9,3,2,3,3,3,10,2,3,3,3,3,10,TRUE,0,74,TRUE,1,70,TRUE,0,83,TRUE,0,69,TRUE,1,74,FALSE,1,66,FALSE,0,70,TRUE,1,66,FALSE,0,69,TRUE,1,69,FALSE,1,67,FALSE,1,73,FALSE,0,87,TRUE,0,79,FALSE,0,67,TRUE,1,100,TRUE,0,96,TRUE,0,100,FALSE,1,60,FALSE,1,59,FALSE,0,60,TRUE,1,67,FALSE,1,69,FALSE,0,58,FALSE,1,64,FALSE,0,69,TRUE,0,70,TRUE,0,100,FALSE,1,96,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.1156,0.4761,0,0.49,0,0.1156,0.3364,0.0961,0.1681,0.1089,0,0.7569,0.4761,0.1089,0.0676,0.09,0.0961,0.4761,1,0.1296,0.36,0.4489,0.16,0.6241,0.9216,0.49,1,0.5476,0.6889,1,0.0016,0.0729,0.369357143,0.206914286,0.5318,30,93.75,16,50,3,37.5,5,62.5,3,37.5,5,62.5,8,50,8,50,76.59,71.5,81,74,79.88,76.62,76.56,43.75,26.59,34,18.5,36.5,17.38,26.62,26.56,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.4,0,0.2,0.4,0.4,0,0.2,0,0.25,0.15,9.67,9.67,0,0,0,0,0,10 cents,75 minutes,15 days,Male,High School (or equivalent),46,-0.125,0,0,0,1,0,0,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.4,0.1 +620,R_7V9lOXSXlzNyyzL,46 - 52,American,Male,1,0,-3,1,1,-3,0,2,1,0,2,3,3,0,2,-3,-3,-3,-3,-3,-1,2,1,1,1,4,-3,-3,2,3,0,5,3,1,3,2,3,5,-3,-3,-3,-3,-3,2,1,0,-3,3,1,4,-3,-3,2,2,0,3,3,3,3,-2,2,2,-3,-3,-3,-3,-3,3,TRUE,0,80,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,77,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0.01,0,0,0.25,0.81,0,0,0,0.64,1,0,0.5929,0,0.64,0,1,1,0,0.221175,0.036428571,0.405921429,25,78.13,25,78.13,6,75,7,87.5,5,62.5,7,87.5,16,100,9,56.25,94.28,82.12,98.75,97.5,98.75,99.38,89.19,0,16.15,7.12,11.25,35,11.25,-0.62,32.94,2,2,4,0,0,0,3,0,2,0,1,2,0,2,1,0,0,0,0,0,0,0,0,2,0,0,3,0,1,0,1,0,0,2,0,0,0,0,0,0,1.6,1,1.2,0,0.4,0.8,0.6,0,0.95,0.45,4.67,3,0,2,3,-1,1.67,10 cents,5 minutes,24 days,Male,University - Undergraduate,50,0.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,2,2,4,-2,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,1.2,0.2,0.6,0,0.5 +621,R_6oB9NiPV5S5aljA,32 - 38,American,Male,3,2,0,1,0,1,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,-1,2,-1,0,7,1,2,0,0,0,7,0,0,2,0,2,9,1,0,0,3,2,7,0,2,2,3,0,8,1,0,2,0,2,7,3,1,0,0,3,8,1,2,2,1,0,7,TRUE,0,91,TRUE,1,79,TRUE,0,80,TRUE,0,83,FALSE,0,87,TRUE,0,80,TRUE,1,85,TRUE,1,68,TRUE,1,72,FALSE,0,78,TRUE,0,72,FALSE,1,73,TRUE,1,75,TRUE,0,78,TRUE,1,77,TRUE,1,76,TRUE,0,78,FALSE,1,77,TRUE,0,75,TRUE,0,81,TRUE,1,88,TRUE,1,71,FALSE,1,75,TRUE,1,88,TRUE,0,72,FALSE,0,76,TRUE,0,76,TRUE,0,74,FALSE,1,69,TRUE,1,73,TRUE,1,67,FALSE,0,88,0.1024,0.5776,0.0576,0.0225,0.7744,0.64,0.0144,0.6084,0.6561,0.0841,0.0729,0.0625,0.0784,0.5184,0.7569,0.0441,0.0625,0.6889,0.5476,0.5184,0.0144,0.0529,0.5625,0.6084,0.6084,0.5776,0.1089,0.8281,0.64,0.0529,0.0961,0.0729,0.369682143,0.361571429,0.377792857,17,53.13,16,50,4,50,4,50,3,37.5,5,62.5,12,75,4,25,77.56,75.12,80,78.5,76.62,78,77.12,3.13,27.56,25.12,30,41,14.12,3,52.12,2,3,2,2,0,0,2,1,0,1,0,0,2,1,0,0,1,0,3,0,3,0,2,2,0,0,0,1,0,1,3,1,0,1,1,0,1,2,1,2,1.8,0.8,0.6,0.8,1.4,0.4,1.2,1.2,1,1.05,7.67,7.67,-1,0,1,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,34,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-1,3,0,0,0,0,2,0,0,0,-3,-1,2,0,-1,0,0,-2,2,-2,0.4,0.4,-0.6,-0.4,-0.05 +622,R_1ovEWvomQ23gvPv,53 - 59,American,Female,2,2,1,1,1,1,-2,2,1,1,2,1,2,0,2,0,-1,1,-1,-2,2,2,1,1,2,5,1,0,2,1,1,6,2,2,2,1,2,6,-1,-1,1,0,-2,6,2,2,1,2,2,6,1,-1,1,1,1,6,2,2,2,1,2,6,1,1,0,1,-1,6,FALSE,1,87,TRUE,1,65,FALSE,1,58,FALSE,1,57,FALSE,0,55,FALSE,1,79,TRUE,1,80,TRUE,1,83,TRUE,1,78,FALSE,0,73,TRUE,0,71,TRUE,0,77,TRUE,1,73,TRUE,0,85,TRUE,1,57,TRUE,1,89,FALSE,1,82,FALSE,1,91,TRUE,0,86,FALSE,1,90,FALSE,0,69,FALSE,0,87,FALSE,1,89,TRUE,1,92,FALSE,1,95,TRUE,1,91,FALSE,1,91,FALSE,1,80,TRUE,0,91,TRUE,1,86,TRUE,1,73,TRUE,1,76,0.0289,0.0081,0.0121,0.04,0.0576,0.0441,0.0064,0.5329,0.01,0.7569,0.0196,0.0729,0.0484,0.5041,0.3025,0.1225,0.0121,0.1849,0.04,0.0025,0.4761,0.1849,0.7396,0.7225,0.0324,0.0081,0.0729,0.0169,0.1764,0.0081,0.8281,0.5929,0.234867857,0.191064286,0.278671429,20,62.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,12,75,11,68.75,79.25,72.25,76.75,86.12,81.88,76.69,81.81,-9.38,7.37,-2.75,14.25,23.62,-5.62,1.69,13.06,0,0,0,0,1,0,2,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,0,1,2,1,2,1,0.2,0.4,0.4,0.4,0.4,0.4,0.4,1.4,0.35,0.65,5.67,6,-1,0,0,0,-0.33,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,54,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,0,0,1,-1,0,0,0,0,0,0,0,0,-2,-1,-1,-1,-0.2,0,0,-1,-0.3 +623,R_6NUiy7iyoMSnmYM,53 - 59,American,Female,-2,1,2,3,-1,-1,1,2,0,-1,2,2,2,-1,3,1,1,2,1,1,-3,0,3,-2,2,7,1,1,2,1,1,2,1,1,3,1,2,3,-2,-3,-2,-1,-1,8,-2,1,2,3,-1,2,-2,-1,2,0,-1,2,2,2,2,-1,3,2,2,1,2,1,1,3,FALSE,1,88,TRUE,1,71,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,98,TRUE,1,95,TRUE,1,100,TRUE,1,81,TRUE,1,90,FALSE,1,61,TRUE,0,96,TRUE,1,94,TRUE,0,98,TRUE,1,50,TRUE,1,81,FALSE,1,73,FALSE,1,100,FALSE,1,74,FALSE,1,57,TRUE,1,88,TRUE,1,95,TRUE,0,91,TRUE,1,87,TRUE,0,66,TRUE,1,96,FALSE,1,50,TRUE,0,56,TRUE,0,93,TRUE,1,92,TRUE,1,52,TRUE,1,98,0,0.0016,0.0361,0.0025,0.0004,0.0004,0.0169,0.01,0.1849,0.0025,0.0064,0.0036,0.0361,0.1521,0.25,0.0841,0.8281,0.25,0.3136,0.4356,0.0144,0.25,0.0676,0.9604,0.0729,0.25,0.2304,0.0144,0,0,0.8649,0.9216,0.222189286,0.130392857,0.313985714,20,62.5,25,78.13,7,87.5,6,75,6,75,6,75,16,100,9,56.25,80.34,61.12,85.62,91,83.62,82.5,78.19,-15.63,2.21,-26.38,10.62,16,8.62,-17.5,21.94,1,1,1,5,3,2,0,0,1,2,1,1,1,2,1,3,4,4,2,2,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,2.2,1,1.2,3,0,0.6,0,0.2,1.85,0.2,4,2,5,0,1,5,2,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,1,1,1,5,3,1,-2,0,1,2,1,1,1,2,1,2,4,4,2,2,2.2,0.4,1.2,2.8,1.65 +624,R_1TsHqwdlsg8NyRI,60 - 66,American,Female,3,2,2,1,0,-2,0,2,0,-2,3,2,3,-2,3,0,-2,0,0,-2,3,2,2,0,-2,1,-3,1,1,1,-3,1,3,2,3,-2,3,1,-3,-3,-3,-2,-2,1,3,2,2,1,-1,1,-2,-1,1,-1,-2,2,3,2,3,-2,3,1,0,0,0,0,-2,1,TRUE,0,65,TRUE,1,70,FALSE,1,95,FALSE,1,52,TRUE,1,53,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,98,TRUE,0,100,FALSE,0,99,TRUE,0,95,TRUE,1,55,TRUE,1,91,TRUE,0,95,TRUE,0,99,TRUE,0,97,FALSE,1,100,FALSE,0,75,TRUE,1,85,FALSE,1,54,TRUE,1,90,FALSE,1,100,TRUE,1,97,TRUE,0,58,FALSE,1,95,TRUE,0,90,TRUE,1,98,FALSE,0,70,TRUE,1,97,0,0.0009,0.0081,0.0009,0.0009,0,0.01,0,0,0.0225,0.0004,0.9801,0.16,0.0004,0.2209,0.09,0.2116,0.2304,0.0025,0,0.5625,0.2025,0.9409,0.9025,0.9025,0.3364,0.49,0.4225,0.0025,0.9801,0.81,1,0.338646429,0.137657143,0.539635714,18,56.25,21,65.63,5,62.5,4,50,5,62.5,7,87.5,13,81.25,8,50,85.31,70,82.88,92.25,96.12,83.56,87.06,-9.38,19.68,7.5,32.88,29.75,8.62,2.31,37.06,0,0,0,1,2,1,1,1,1,1,0,0,0,0,0,3,1,3,2,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0.6,1,0,1.8,0.2,0.6,0,0.4,0.85,0.3,1,1.33,0,-1,0,0,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,-0.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,3,-1,3,2,0,0.4,0.4,0,1.4,0.55 +625,R_1scbTlFE5WDcKLq,53 - 59,American,Female,3,3,3,2,3,1,-2,3,-2,2,3,1,3,3,3,2,2,2,2,-1,3,3,3,2,3,1,3,-2,3,-3,3,1,3,2,3,3,3,1,2,3,2,2,-2,1,3,3,3,2,3,1,2,-2,3,-2,3,1,3,2,3,2,3,2,2,2,2,2,-1,9,FALSE,1,90,TRUE,1,79,FALSE,1,77,FALSE,1,61,TRUE,1,78,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,92,TRUE,0,81,FALSE,0,76,FALSE,1,92,TRUE,1,70,TRUE,1,86,FALSE,1,82,TRUE,0,92,FALSE,1,50,FALSE,1,100,TRUE,1,90,TRUE,1,73,FALSE,1,69,TRUE,1,85,FALSE,1,84,TRUE,1,68,FALSE,1,54,FALSE,1,63,FALSE,1,51,FALSE,0,86,FALSE,0,53,TRUE,1,100,0,0.1024,0.0196,0,0,0,0.0225,0,0,0.0729,0.7396,0.5776,0.0625,0.0064,0.0484,0.0441,0.0961,0.1521,0.1369,0.0256,0.01,0.09,0.25,0.0064,0.0324,0.2116,0.2809,0.01,0.0529,0.8464,0.2401,0.6561,0.166839286,0.130157143,0.203521429,25,78.13,27,84.38,7,87.5,7,87.5,7,87.5,6,75,13,81.25,14,87.5,79.91,66.75,80.75,87.38,84.75,82.44,77.38,-6.25,-4.47,-20.75,-6.75,-0.12,9.75,1.19,-10.12,0,0,0,0,0,2,0,0,1,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0.8,0.2,0.4,0,0.4,0.4,0,0.35,0.2,1,1.33,0,0,-1,-8,-0.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,58,0.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,0,1,0,0,0,0,-1,0,0,1,0,0,1,0,0.4,-0.2,0.4,0.15 +626,R_37pd9qapjRdtkJa,46 - 52,American,Female,0,2,2,0,0,-2,-2,2,-2,0,0,1,1,-2,2,0,0,2,0,0,0,0,0,0,0,5,-2,-2,2,-2,0,3,0,1,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,5,-2,-2,2,-2,0,2,-2,2,2,-2,2,1,0,0,0,0,0,2,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,80,TRUE,0,60,TRUE,0,100,TRUE,1,80,TRUE,0,100,FALSE,0,74,TRUE,1,80,TRUE,0,76,FALSE,1,100,TRUE,0,90,FALSE,1,90,TRUE,1,80,TRUE,1,80,FALSE,1,76,TRUE,1,91,TRUE,0,92,TRUE,1,84,FALSE,1,100,TRUE,0,82,TRUE,0,75,FALSE,0,90,FALSE,0,77,TRUE,1,100,0,0.0256,0.04,0,0,0,0.0081,0.04,0.01,0.04,0.81,0.04,0.01,0.36,0.25,0.25,0.0576,0.25,0.6724,0.8464,0.04,0.5476,0.81,1,0.5776,0,0.5929,1,1,0,0.5625,1,0.384825,0.151835714,0.617814286,16,50,18,56.25,3,37.5,6,75,5,62.5,4,50,12,75,6,37.5,84.28,73.88,79.62,92,91.62,81.62,86.94,-6.25,28.03,36.38,4.62,29.5,41.62,6.62,49.44,0,2,2,0,0,0,0,0,0,0,0,0,1,2,2,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,2,1,1,0,0,0,0,2,0,0,0.8,0,1,0.4,0.8,0,0.8,0.4,0.55,0.5,3.67,2.67,0,1,2,3,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),50,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,-2,-1,0,2,2,0,0,0,0,0,0,0,0.2,0,0.05 +627,R_6RYM8XZDS6nkhGh,46 - 52,Canadian,Male,-3,2,0,0,2,0,0,0,0,0,0,2,0,0,0,-3,-3,-3,-3,-3,0,2,2,0,0,5,0,2,0,0,0,5,-3,0,0,0,0,5,-3,-3,-3,-3,-3,5,-3,0,0,0,2,5,0,0,0,2,0,5,0,2,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,FALSE,0,50,TRUE,0,66,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,81,TRUE,1,95,TRUE,0,50,TRUE,0,100,TRUE,1,66,TRUE,0,50,TRUE,1,50,FALSE,0,50,TRUE,0,76,TRUE,0,80,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,81,FALSE,1,73,TRUE,1,100,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,70,TRUE,0,100,TRUE,1,100,TRUE,1,55,TRUE,1,84,0.25,0.0361,0.25,0,0.0256,0.25,0,0.0025,0.25,0.0361,0,0.1156,0.0361,0.25,0.25,0.25,0.0729,0.25,0.49,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.2025,1,0.4356,0.64,1,1,0.308375,0.127771429,0.488978571,5,15.63,18,56.25,6,75,4,50,5,62.5,3,37.5,11,68.75,7,43.75,69,54.5,68.62,79.62,73.25,71.44,66.56,-40.62,12.75,-20.5,18.62,17.12,35.75,2.69,22.81,3,0,2,0,2,0,2,0,0,0,3,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,3,3,3,3,3,1.4,0.4,1,0,0.4,0.4,0,3,0.7,0.95,5,5,0,0,0,0,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,47,0.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,3,-2,2,0,2,0,2,0,-2,0,3,2,0,0,0,-3,-3,-3,-3,-3,1,0,1,-3,-0.25 +628,R_3r97C10hrmEY6lU,39 - 45,American,Female,0,3,-3,3,-3,-3,3,-3,3,-2,-1,-1,1,1,1,-3,-3,-3,-3,-3,2,2,2,-3,-3,10,2,-2,2,2,2,9,-3,-3,2,2,2,2,2,2,-1,2,-1,9,3,3,3,3,-3,10,-3,-3,-3,-3,-3,10,-3,-3,2,2,2,1,2,2,2,2,2,9,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,1,51,TRUE,1,50,FALSE,1,75,TRUE,1,99,FALSE,0,51,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,0,54,FALSE,1,100,TRUE,1,60,FALSE,0,80,FALSE,1,53,TRUE,0,100,FALSE,1,52,FALSE,1,54,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,92,FALSE,1,61,FALSE,0,98,FALSE,1,51,FALSE,1,100,TRUE,0,98,FALSE,0,100,FALSE,0,100,TRUE,1,96,0.2601,0.9604,0.64,0.0001,0.0016,0.0625,0.0064,0,0.2116,0,1,0.2916,0,0.0036,0.25,0.25,0.0256,0.2401,0,0.1521,0,0.16,0.2304,0,0.2209,0.2401,1,1,0.25,1,0.9604,1,0.305603571,0.167357143,0.44385,16,50,21,65.63,6,75,6,75,5,62.5,4,50,9,56.25,12,75,79.78,69.75,76.25,94.75,78.38,83.12,76.44,-15.63,14.15,-5.25,1.25,32.25,28.38,26.87,1.44,2,1,5,6,0,5,5,5,1,4,2,2,1,1,1,5,5,2,5,2,3,0,6,0,0,0,6,0,6,1,2,2,1,1,1,5,5,5,5,5,2.8,4,1.4,3.8,1.8,2.6,1.4,5,3,2.7,7,7,0,-1,1,0,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,45,1.375,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,-1,1,-1,6,0,5,-1,5,-5,3,0,0,0,0,0,0,0,-3,0,-3,1,1.4,0,-1.2,0.3 +629,R_3x3YdUaKFiS8CEF,46 - 52,Canadian,Female,2,1,1,-1,2,1,-1,1,-1,2,2,-1,3,-2,1,0,-1,0,1,-2,2,1,1,-2,2,3,1,-1,1,-1,2,2,2,-1,3,-2,0,2,-1,-1,-1,0,-2,6,2,1,1,-2,2,4,0,-2,1,-1,1,5,2,-1,3,-2,0,5,1,1,1,1,-2,7,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,95,FALSE,1,100,FALSE,0,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,75,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,1,0,0.81,0,0,0,0,0,0,1,0.81,0,0,0.9025,1,0,0,0,0,0,0.04,0,0,0,0.5625,0,0,0,0,0,1,0.189821429,0.265178571,0.114464286,20,62.5,24,75,6,75,6,75,6,75,6,75,10,62.5,14,87.5,97.81,94.38,98.12,98.75,100,97.19,98.44,-12.5,22.81,19.38,23.12,23.75,25,34.69,10.94,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,2,1,0,0,0.2,0,0.2,0.6,0.2,0.6,0.2,0.8,0.25,0.45,2.33,4.67,-1,-3,-3,-1,-2.34,5 cents,5 minutes,47 days,Female,University - Undergraduate,49,1.5,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,-1,-1,0,0,-1,0,0,0,0,0,0,-2,0,1,0,0,-0.6,0,-0.2,-0.2 +630,R_5yNgKYnVHrBUF21,39 - 45,Canadian,Male,3,0,2,0,3,0,0,0,0,0,3,0,0,0,0,2,2,3,2,0,3,1,3,0,3,5,0,0,0,0,0,6,3,0,0,0,0,5,0,0,0,0,0,5,2,0,0,0,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,2,0,0,5,FALSE,1,53,FALSE,0,52,FALSE,1,54,FALSE,1,52,FALSE,0,56,FALSE,1,51,FALSE,0,53,FALSE,0,52,FALSE,0,52,FALSE,0,52,FALSE,1,53,FALSE,1,50,FALSE,0,51,FALSE,1,52,FALSE,0,53,FALSE,0,52,FALSE,1,51,FALSE,1,51,FALSE,1,51,FALSE,1,51,FALSE,0,51,FALSE,0,51,FALSE,1,51,FALSE,0,53,FALSE,1,52,FALSE,0,53,FALSE,1,52,FALSE,1,52,FALSE,1,51,FALSE,0,52,FALSE,0,51,FALSE,0,52,0.2704,0.2809,0.2704,0.2809,0.2704,0.2401,0.2809,0.2704,0.2401,0.2601,0.2704,0.2601,0.2704,0.2209,0.3136,0.2704,0.2401,0.2304,0.2304,0.2304,0.2601,0.2809,0.2401,0.2304,0.2401,0.2304,0.2601,0.2209,0.2116,0.2401,0.2401,0.25,0.250139286,0.259878571,0.2404,16,50,16,50,4,50,4,50,4,50,4,50,0,0,16,100,51.97,52,51.75,52.12,52,52.25,51.69,0,1.97,2,1.75,2.12,2,52.25,-48.31,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,2,3,2,0,1,0,2,0,1,0,0,0,0,0,3,0,0,0,0,2,2,1,2,0,0.4,0,0,1.8,0.8,0,0.6,1.4,0.55,0.7,5.33,5,0,1,0,0,0.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,40,0,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,1,-1,0,-1,0,0,0,0,0,-3,0,0,0,0,0,0,2,0,0,-0.4,0,-0.6,0.4,-0.15 +631,R_71n1inSBq85hYMV,32 - 38,Canadian,Male,2,3,2,0,1,1,-1,2,-1,1,2,1,2,0,3,1,1,1,1,-1,2,3,2,0,1,6,2,-1,2,-1,1,7,3,1,3,2,1,7,0,0,0,-1,-1,7,1,3,2,0,3,9,0,-1,2,0,1,7,2,0,2,0,3,7,0,0,0,-1,-1,8,FALSE,1,71,TRUE,1,64,FALSE,1,65,TRUE,0,74,TRUE,1,67,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,58,FALSE,0,68,FALSE,1,68,TRUE,0,83,TRUE,1,88,TRUE,0,95,FALSE,0,68,TRUE,1,82,FALSE,1,67,TRUE,0,66,FALSE,1,68,TRUE,0,66,FALSE,0,92,FALSE,0,60,TRUE,0,85,FALSE,0,75,FALSE,1,61,TRUE,1,84,FALSE,1,67,TRUE,0,75,FALSE,1,71,TRUE,1,85,FALSE,0,70,FALSE,0,91,0,0.0256,0.0324,0.09,0.8281,0,0.5625,0.4624,0.4356,0.36,0.0225,0.0144,0.1764,0.1024,0.1089,0.1296,0.7225,0.5476,0.5625,0.1521,0.8464,0.4624,0.1024,0.9025,0.1089,0.1089,0.49,0.0841,0.1225,0.4356,0.0841,0.6889,0.343721429,0.319492857,0.36795,22,68.75,18,56.25,5,62.5,5,62.5,4,50,4,50,9,56.25,9,56.25,75.12,67.12,82.62,71.88,78.88,76.38,73.88,12.5,18.87,4.62,20.12,21.88,28.88,20.13,17.63,0,0,0,0,0,1,0,0,0,0,1,0,1,2,2,1,1,1,2,0,1,0,0,0,2,1,0,0,1,0,0,1,0,0,0,1,1,1,2,0,0,0.2,1.2,1,0.6,0.4,0.2,1,0.6,0.55,6.67,7.67,-3,0,0,-1,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,34,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,-2,0,0,0,-1,0,1,-1,1,2,2,0,0,0,0,0,-0.6,-0.2,1,0,0.05 +632,R_5MXNHq2DCzPe2cS,46 - 52,Canadian,Male,2,2,3,1,3,2,1,2,-2,3,2,1,1,2,1,-2,0,-2,2,-3,-1,3,3,3,3,7,3,-3,0,0,1,8,0,0,-2,-2,0,7,-3,-2,1,-3,-3,8,1,3,3,1,3,7,2,0,2,-3,1,7,1,0,0,0,0,6,1,2,2,3,1,5,FALSE,1,100,FALSE,0,59,FALSE,1,58,FALSE,1,74,FALSE,0,80,FALSE,1,100,TRUE,1,86,FALSE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,89,FALSE,1,100,FALSE,0,86,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,72,TRUE,0,100,FALSE,1,100,FALSE,1,72,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,54,TRUE,0,86,FALSE,1,64,TRUE,1,100,TRUE,1,74,FALSE,0,86,1,0,0,0.0196,0.7396,0,0,0,0.0784,0,0,0.7396,1,0.0121,0.64,0.3481,0,0.0676,0.7396,0,0,1,0,0,0.5184,0.2116,0.0676,0,0.1764,1,0.1296,0,0.266735714,0.258957143,0.274514286,22,68.75,22,68.75,5,62.5,4,50,7,87.5,6,75,9,56.25,13,81.25,88.75,81.25,86,98.25,89.5,91.94,85.56,0,20,18.75,36,10.75,14.5,35.69,4.31,3,1,0,2,0,1,4,2,2,2,2,1,3,4,1,1,2,3,5,0,1,1,0,0,0,0,1,0,1,2,1,1,1,2,1,3,2,4,1,4,1.2,2.2,2.2,2.2,0.4,0.8,1.2,2.8,1.95,1.3,7.33,6.67,0,1,1,3,0.66,10 cents,5 minutes,47 days,Male,Professional Degree (ex. JD/MD),49,1.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,2,0,0,2,0,1,3,2,1,0,1,0,2,2,0,-2,0,-1,4,-4,0.8,1.4,1,-0.6,0.65 +633,R_7ZEzyZBvyiJaXvH,32 - 38,American,Male,3,2,3,2,2,2,1,1,-1,2,2,2,1,2,2,2,2,2,2,2,2,2,2,1,1,6,2,1,2,1,1,6,2,1,1,1,2,7,1,2,2,1,2,6,1,1,2,2,1,6,1,1,1,-2,1,6,1,1,1,1,1,6,1,2,2,1,2,6,TRUE,0,87,TRUE,1,50,TRUE,0,54,FALSE,1,57,FALSE,0,54,FALSE,1,52,FALSE,0,52,TRUE,1,53,FALSE,0,57,TRUE,1,56,FALSE,1,53,TRUE,0,75,TRUE,1,83,FALSE,1,52,TRUE,1,86,TRUE,1,73,TRUE,0,60,TRUE,0,60,TRUE,0,61,TRUE,0,54,TRUE,1,60,TRUE,1,79,TRUE,0,54,FALSE,0,55,TRUE,0,67,FALSE,0,50,FALSE,1,53,TRUE,0,88,FALSE,1,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,0.2209,0.25,0.0729,0.2704,0.25,0.2304,0.3025,0.1936,0.2916,0.0441,0.25,0.0289,0.3249,0.2209,0.2916,0.25,0.2916,0.1849,0.7744,0.4489,0.16,0.0196,0.3721,0.2304,0.36,0.2209,0.25,0.7569,0.2916,0.36,0.25,0.5625,0.293296429,0.225357143,0.361235714,17,53.13,16,50,6,75,5,62.5,3,37.5,2,25,10,62.5,6,37.5,60.47,58.38,57.88,62.88,62.75,59.88,61.06,3.13,10.47,-16.62,-4.62,25.38,37.75,-2.62,23.56,1,0,1,1,1,0,0,1,2,1,0,1,0,1,0,1,0,0,1,0,2,1,1,0,1,1,0,0,1,1,1,1,0,1,1,1,0,0,1,0,0.8,0.8,0.4,0.4,1,0.6,0.8,0.4,0.6,0.7,6.33,6,0,0,1,0,0.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),34,0,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-1,-1,0,1,0,-1,0,1,1,0,-1,0,0,0,-1,0,0,0,0,0,-0.2,0.2,-0.4,0,-0.1 +634,R_3KkEy6EPkKoHwd3,53 - 59,American,Male,-2,3,3,3,3,0,2,3,2,2,3,0,3,3,3,-2,0,-2,0,-2,-1,3,3,3,3,3,-1,1,3,1,3,4,3,0,3,3,3,2,-2,-2,-2,-2,-2,2,0,3,3,3,3,3,0,2,3,2,2,3,3,1,3,3,3,2,-2,-2,0,-2,-2,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0.0625,0,0.04,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0,1,0,1,0.077321429,0.007321429,0.147321429,30,93.75,30,93.75,8,100,8,100,7,87.5,7,87.5,16,100,14,87.5,97.81,93.75,97.5,100,100,95.62,100,0,4.06,-6.25,-2.5,12.5,12.5,-4.38,12.5,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,2,2,0,0.2,0.8,0,0.8,0.4,0,0.2,1.2,0.45,0.45,3,2.67,0,1,0,0,0.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),59,1.5,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,-1,0,0,0,0,1,1,0,1,1,0,-1,0,0,0,0,0,-2,0,0,-0.2,0.8,-0.2,-0.4,0 +635,R_79j5xsAlxQdKxqx,25 - 31,American,Male,2,2,0,0,2,3,-3,3,-1,3,3,0,1,3,3,0,0,0,-2,-3,3,3,3,0,3,3,-2,-3,2,-3,0,8,3,0,0,3,3,3,0,-3,1,-3,-3,8,3,3,0,0,2,3,2,-3,3,-3,3,3,3,0,2,3,3,3,2,1,2,1,-3,3,TRUE,0,60,FALSE,0,59,TRUE,0,71,TRUE,0,62,TRUE,1,62,FALSE,1,57,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,60,TRUE,0,72,FALSE,1,100,FALSE,0,81,FALSE,1,100,TRUE,1,67,TRUE,1,100,TRUE,0,71,TRUE,0,77,FALSE,1,63,FALSE,1,56,TRUE,1,100,FALSE,0,61,FALSE,1,56,TRUE,1,74,FALSE,1,65,TRUE,1,100,TRUE,0,68,TRUE,0,100,FALSE,1,60,TRUE,1,71,TRUE,1,55,TRUE,1,100,0,0,0,0,0,0.1849,0.0676,0.16,0.1936,0.3721,0.0841,0.6561,0.1225,0.5184,0.1444,0.3481,0.1936,0.3844,1,0.1225,0,0.1089,0.1369,0,0.5041,0.4624,0.2025,0.36,0.5041,0.5929,0.16,0,0.270860714,0.244985714,0.296735714,16,50,21,65.63,4,50,6,75,5,62.5,6,75,13,81.25,8,50,74.78,63.88,73.38,77.88,84,78.44,71.12,-15.63,9.15,13.88,-1.62,15.38,9,-2.81,21.12,1,1,3,0,1,5,0,1,2,3,0,0,1,0,0,0,3,1,1,0,1,1,0,0,0,1,0,0,2,0,0,0,1,0,0,2,1,2,3,0,1.2,2.2,0.2,1,0.4,0.6,0.2,1.6,1.15,0.7,4.67,3,0,5,0,5,1.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,30,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,3,0,1,4,0,1,0,3,0,0,0,0,0,-2,2,-1,-2,0,0.8,1.6,0,-0.6,0.45 +636,R_60MjAJsX7YGSw6k,32 - 38,American,Male,2,2,3,2,3,1,-1,1,-2,2,3,2,2,1,1,1,2,2,3,1,2,2,1,3,1,9,1,2,2,3,1,8,1,2,2,1,1,5,2,1,3,1,2,9,1,3,2,2,1,9,2,2,2,1,1,7,2,2,2,1,2,9,3,3,1,2,1,8,TRUE,0,89,FALSE,0,95,TRUE,0,90,FALSE,1,95,FALSE,0,88,TRUE,0,69,FALSE,0,92,FALSE,0,68,TRUE,1,94,FALSE,0,72,TRUE,0,96,FALSE,1,67,TRUE,1,91,TRUE,0,89,TRUE,1,96,TRUE,1,85,FALSE,1,67,TRUE,0,93,TRUE,0,88,TRUE,0,92,TRUE,1,93,TRUE,1,89,TRUE,0,86,TRUE,1,95,TRUE,0,94,TRUE,1,90,FALSE,1,66,TRUE,0,88,TRUE,0,93,TRUE,1,92,TRUE,1,93,TRUE,1,92,0.4624,0.01,0.0225,0.8464,0.0064,0.4761,0.0025,0.5184,0.8464,0.0121,0.0064,0.0081,0.0036,0.9216,0.7744,0.9025,0.7396,0.0025,0.7744,0.8836,0.0049,0.0016,0.7744,0.7921,0.1089,0.1156,0.0049,0.7921,0.81,0.8649,0.8649,0.1089,0.432921429,0.3729,0.492942857,22,68.75,15,46.88,5,62.5,4,50,2,25,4,50,11,68.75,4,25,87.09,90.38,84.88,88.5,84.62,89.06,85.12,21.87,40.21,27.88,34.88,63.5,34.62,20.31,60.12,0,0,2,1,2,0,3,1,5,1,2,0,0,0,0,1,1,1,2,1,1,1,1,0,2,1,3,1,3,1,1,0,0,0,1,2,1,1,1,0,1,2,0.4,1.2,1,1.8,0.4,1,1.15,1.05,7.33,8.33,0,1,-4,1,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,-1,1,1,0,-1,0,0,2,0,1,0,0,0,-1,-1,0,0,1,1,0,0.2,0,0.2,0.1 +637,R_5YEzxFVFQAp2Krn,32 - 38,Canadian,Female,-3,3,3,3,1,-3,-1,1,2,-1,2,2,3,1,3,1,1,1,-1,-3,-1,3,3,3,2,5,-3,-2,3,2,1,5,2,2,3,-1,3,4,-1,1,1,1,-2,4,-3,-3,3,3,3,7,1,-2,3,-2,2,9,2,1,3,3,3,5,-1,1,2,1,-1,6,FALSE,1,100,TRUE,1,91,TRUE,0,86,TRUE,0,75,TRUE,1,64,FALSE,1,80,TRUE,1,86,TRUE,1,100,TRUE,1,86,TRUE,1,91,FALSE,1,69,TRUE,0,91,FALSE,0,75,FALSE,1,86,TRUE,1,86,TRUE,1,70,FALSE,1,65,TRUE,0,100,FALSE,1,70,FALSE,1,80,TRUE,1,86,FALSE,0,71,TRUE,0,75,TRUE,1,65,TRUE,0,91,TRUE,1,100,FALSE,1,65,TRUE,0,71,TRUE,0,81,TRUE,1,97,FALSE,0,60,TRUE,1,91,0,0,0.09,0.0196,0.0081,0.04,0.1225,0.0081,0.04,0.5041,0.0009,0.5625,0.0196,0.0961,0.1296,0.0081,0.5625,0.5625,0.5041,0.8281,0.0196,0.0196,0.09,0.0196,0.1225,0.1225,0.36,0,0.7396,1,0.6561,0.8281,0.2848,0.190328571,0.379271429,16,50,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,81.38,75.25,77.12,90.62,82.5,82.44,80.31,-15.63,15.75,0.25,14.62,28.12,20,1.19,30.31,2,0,0,0,1,0,1,2,0,2,0,0,0,2,0,2,0,0,2,1,0,6,0,0,2,4,1,2,4,3,0,1,0,2,0,2,0,1,2,2,0.6,1,0.4,1,1.6,2.8,0.6,1.4,0.75,1.6,4.67,7,-2,-4,-1,-2,-2.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,-6,0,0,-1,-4,0,0,-4,-1,0,-1,0,0,0,0,0,-1,0,-1,-1,-1.8,-0.2,-0.4,-0.85 +638,R_1JvZO0PUMVo7krx,39 - 45,Canadian,Female,-1,3,0,0,-1,-2,0,-1,3,0,2,1,1,1,1,-2,-1,-1,1,-2,-1,3,2,1,1,3,-2,1,-1,3,1,7,3,1,1,1,1,6,-1,-1,-1,0,0,3,1,3,0,1,-2,2,-3,0,1,3,-2,2,3,1,2,1,1,4,-1,-1,0,1,0,5,TRUE,0,100,TRUE,1,62,TRUE,0,100,FALSE,1,51,TRUE,1,100,FALSE,1,64,TRUE,1,89,TRUE,1,100,TRUE,1,70,TRUE,1,79,FALSE,1,86,FALSE,1,76,TRUE,1,82,TRUE,0,51,TRUE,1,51,TRUE,1,78,TRUE,0,50,TRUE,0,100,TRUE,0,51,TRUE,0,51,TRUE,1,50,TRUE,1,51,TRUE,0,86,TRUE,1,51,TRUE,0,100,TRUE,1,100,TRUE,0,51,FALSE,1,54,FALSE,1,57,TRUE,1,100,FALSE,0,66,TRUE,1,100,0,0,0.0484,0.0121,0,0.1296,0.2401,0.0441,0.2601,0.2401,0,0.0324,0.09,0.0196,0,0.1444,0.7396,0.2401,0.2116,1,0.25,0.2401,0.2601,0.2601,0.25,0.2601,0.4356,1,1,1,0.1849,0.0576,0.306792857,0.155721429,0.457864286,18,56.25,21,65.63,5,62.5,6,75,4,50,6,75,15,93.75,6,37.5,73.66,61,73.62,83.75,76.25,76.81,70.5,-9.38,8.03,-1.5,-1.38,33.75,1.25,-16.94,33,0,0,2,1,2,0,1,0,0,1,1,0,0,0,0,1,0,0,1,2,2,0,0,1,1,1,0,2,0,2,1,0,1,0,0,1,0,1,0,2,1,0.4,0.2,0.8,0.8,1,0.4,0.8,0.6,0.75,5.33,2.67,1,5,2,-2,2.66,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,39,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,-2,0,2,0,1,-1,1,-2,0,-1,0,0,-1,0,0,0,0,-1,1,0,0.2,-0.6,-0.2,0,-0.15 +639,R_7pWJcjCxgY1ukTe,46 - 52,Canadian,Male,2,1,1,2,0,0,-1,2,-1,1,0,0,2,0,2,0,2,2,2,1,2,2,1,2,0,1,0,-1,2,-2,2,1,0,-2,2,1,2,1,1,2,2,1,1,1,2,1,1,2,1,1,1,-1,1,-1,1,1,0,0,2,0,3,1,1,1,1,1,1,1,TRUE,0,66,TRUE,1,58,FALSE,1,70,TRUE,0,50,TRUE,1,90,TRUE,0,86,TRUE,1,98,TRUE,1,89,TRUE,1,79,TRUE,1,82,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,76,TRUE,0,50,FALSE,1,100,TRUE,0,89,TRUE,1,75,FALSE,0,57,TRUE,1,92,0.0121,0.0576,0,0.0004,0.0064,0.7396,0.25,0.0324,0.25,0.25,0.0625,0,0.0441,0.25,0.01,0.1764,0.25,0.25,0,0,0,0,0.25,1,1,0.25,0.3249,0.4356,0.09,1,0.7921,1,0.311214286,0.183671429,0.438757143,18,56.25,18,56.25,3,37.5,5,62.5,4,50,6,75,14,87.5,4,25,78.34,61.75,88.38,84,79.25,81,75.69,0,22.09,24.25,25.88,34,4.25,-6.5,50.69,0,1,0,0,0,0,0,0,1,1,0,2,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0.2,0.4,0.6,0.4,0.2,0.4,0.2,0.8,0.4,0.4,1,1,0,0,0,0,0,10 cents,5 minutes,15 days,Male,University - Undergraduate,50,1.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,1,0,0,-1,-1,0,-1,1,1,0,2,0,1,-1,0,-1,-1,0,0,0,0,0.4,-0.4,0 +640,R_6CsOtPiUGljnF6x,46 - 52,Canadian,Male,3,3,3,1,-2,-3,0,2,-2,1,3,-1,3,1,-1,0,0,-1,-1,0,3,3,3,0,-2,10,1,0,3,-3,1,7,3,0,3,3,1,8,0,1,1,1,-2,10,3,3,3,2,0,10,-2,-2,3,-3,0,9,3,0,3,3,3,7,1,1,0,3,-1,10,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,59,TRUE,1,86,FALSE,1,65,TRUE,1,100,TRUE,1,91,TRUE,1,86,TRUE,1,100,TRUE,0,76,TRUE,0,100,FALSE,0,85,TRUE,0,100,TRUE,1,59,TRUE,1,100,FALSE,1,75,TRUE,0,100,FALSE,1,70,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,84,TRUE,1,100,TRUE,0,77,TRUE,0,94,TRUE,0,95,TRUE,1,85,TRUE,1,75,TRUE,1,100,0.0081,0,0,0,0,0.1225,0,0,0,0,0.0225,0.7225,0.0196,0.5776,0.0196,0,1,0.1681,0.8836,0.7056,0.01,0.1681,0.09,1,0.0625,0.5929,0.0625,0,0.7396,1,0.9025,1,0.352489286,0.189457143,0.515521429,23,71.88,21,65.63,6,75,5,62.5,5,62.5,5,62.5,15,93.75,6,37.5,88.69,75.25,87,98,94.5,91.06,86.31,6.25,23.06,0.25,24.5,35.5,32,-2.69,48.81,0,0,0,1,0,4,0,1,1,0,0,1,0,2,2,0,1,2,2,2,0,0,0,1,2,1,2,1,1,1,0,1,0,2,4,1,1,1,4,1,0.2,1.2,1,1.4,0.6,1.2,1.4,1.6,0.95,1.2,8.33,8.67,0,-2,1,0,-0.34,10 cents,100 minutes,47 days,Male,High School (or equivalent),46,1.625,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,-2,3,-2,0,0,-1,0,0,0,0,-2,-1,0,1,-2,1,-0.4,0,-0.4,-0.2,-0.25 +641,R_5JPSmdojOMKyeDn,46 - 52,American,Male,2,2,2,-2,2,2,-2,2,-2,2,2,0,2,2,2,1,0,0,1,-1,0,2,2,-2,-1,8,2,-2,2,-2,2,0,2,1,2,1,2,6,-1,-1,1,-1,-2,7,2,2,2,-2,2,3,2,-2,2,-2,2,3,2,0,2,0,2,1,0,0,1,1,-2,5,TRUE,0,100,TRUE,1,97,TRUE,0,100,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0.0361,0.0009,0.25,0.25,0,1,0,0.25,1,1,0.25,1,0,1,1,1,1,0,0.331678571,0.056214286,0.607142857,29,90.63,22,68.75,6,75,5,62.5,4,50,7,87.5,16,100,6,37.5,91.5,80.88,85.12,100,100,95.5,87.5,21.88,22.75,5.88,22.62,50,12.5,-4.5,50,2,0,0,0,3,0,0,0,0,0,0,1,0,1,0,2,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,1,0,1,1,0,0.4,1.4,0,0,0.4,0.6,0.7,0.25,4.67,2.33,5,-3,5,2,2.34,10 cents,25 minutes,24 days,Male,University - Undergraduate,46,0.75,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,0,0,0,3,0,0,0,0,0,0,1,0,-1,0,1,1,0,2,0,1,0,0,0.8,0.45 +642,R_66fHMN8Wm3HAbGa,39 - 45,Canadian,Male,3,1,2,-2,0,-2,0,2,1,1,1,-2,2,0,2,-2,0,-2,-2,-2,2,1,2,-2,0,1,-2,-2,2,1,1,1,1,-2,2,0,2,2,-2,0,-2,-2,-2,2,2,2,2,-2,-1,2,-2,-1,2,1,1,2,1,-2,2,0,2,2,-2,-1,-2,-2,-2,2,FALSE,1,95,TRUE,1,60,TRUE,0,90,FALSE,1,60,TRUE,1,95,FALSE,1,100,TRUE,1,95,TRUE,1,95,TRUE,1,55,TRUE,1,95,FALSE,1,50,TRUE,0,56,FALSE,0,65,FALSE,1,100,FALSE,0,56,TRUE,1,95,FALSE,1,65,TRUE,0,100,FALSE,1,56,FALSE,1,50,TRUE,1,100,TRUE,1,92,FALSE,1,92,TRUE,1,94,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,1,80,FALSE,1,75,TRUE,1,85,TRUE,1,74,TRUE,1,100,0.0025,0.04,0.0025,0.0025,0,0,0.0036,0.0025,0.25,0.0064,0.0225,0.4225,0.2025,0.25,0.0025,0.16,0.0064,0.16,0.04,0,0,0.3136,0.1936,0,0.1225,0.25,0.0676,0.0025,0.81,1,0.0625,0.3136,0.1666,0.10635,0.22685,23,71.88,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,79.84,57.62,86.5,94.62,80.62,83.5,76.19,-12.5,-4.54,-29.88,-1,7.12,5.62,-4,-5.06,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.2,0.4,0,0,0.6,0.2,0,0.2,0.15,0.25,1.33,2,-1,-1,0,0,-0.67,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,42,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,-1,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,-1,0,0,0,-0.4,0.2,0,-0.2,-0.1 +643,R_731ZPU2UTKGHQaQ,39 - 45,Canadian,Male,0,2,1,0,2,1,-1,1,-1,3,0,-1,1,1,1,0,1,1,1,0,-1,1,-1,0,0,8,2,0,2,0,3,8,0,0,1,1,1,7,1,1,2,2,1,7,0,1,0,0,1,7,1,-1,1,-1,3,6,0,-1,1,1,1,8,1,1,2,2,1,6,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,84,FALSE,0,50,TRUE,1,50,TRUE,1,71,TRUE,0,50,TRUE,0,50,TRUE,1,82,TRUE,0,89,TRUE,1,88,TRUE,1,83,FALSE,1,58,FALSE,1,69,TRUE,0,62,TRUE,0,50,TRUE,1,80,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,58,FALSE,1,50,FALSE,1,100,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,1,50,0.25,0.1764,0.0289,0.0256,0.25,0,0,0.0841,0.25,0,1,0.0324,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.04,0.0144,0.3844,0.7921,0.1764,0.25,0.25,0,0.25,0.0961,0.25,0.25,0.218567857,0.222607143,0.214528571,17,53.13,19,59.38,4,50,6,75,6,75,3,37.5,12,75,7,43.75,67.94,56.25,65,77.62,72.88,71.62,64.25,-6.25,8.56,6.25,-10,2.62,35.38,-3.38,20.5,1,1,2,0,2,1,1,1,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1.2,0.8,0.2,0.8,0.6,0,0,0.8,0.75,0.35,7.67,7,1,2,-1,1,0.67,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),43,1.75,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,1,0,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0.6,0.8,0.2,0,0.4 +644,R_1dDRjpFlZ4n0twm,46 - 52,Canadian,Male,-3,2,2,2,-2,-2,1,2,2,-3,2,2,2,2,-3,-3,-1,-2,-1,-2,-2,0,2,-1,0,4,-2,1,2,1,-2,4,1,1,1,1,0,4,-2,-2,-2,0,-3,2,-2,2,2,2,-1,1,-3,2,0,2,-3,1,2,3,2,2,-2,2,-3,-2,-2,-2,-2,1,FALSE,1,80,FALSE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,60,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,TRUE,0,60,FALSE,1,60,TRUE,1,85,FALSE,1,100,TRUE,1,95,TRUE,1,85,TRUE,0,60,FALSE,1,100,TRUE,0,65,FALSE,1,50,TRUE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,60,TRUE,0,95,TRUE,1,90,FALSE,0,90,TRUE,1,100,0,0,0.0225,0,0,0.1225,0.01,0,0.25,0.0225,0.01,0.0225,0.3025,0.36,0.36,0.25,0,0.25,0.16,0,0,0.0025,0.4225,0,0.36,0.25,0.81,0.04,0,0,0.9025,0.16,0.180982143,0.14,0.221964286,20,62.5,24,75,3,37.5,5,62.5,8,100,8,100,12,75,12,75,80.62,64.38,83.12,95.62,79.38,86.56,74.69,-12.5,5.62,26.88,20.62,-4.38,-20.62,11.56,-0.31,1,2,0,3,2,0,0,0,1,1,1,1,1,1,3,1,1,0,1,1,1,0,0,0,1,1,1,2,0,0,0,1,0,0,1,0,1,0,1,0,1.6,0.4,1.4,0.8,0.4,0.8,0.4,0.4,1.05,0.5,4,1.33,3,3,2,1,2.67,10 cents,25 minutes,24 days,Male,University - Undergraduate,48,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,2,0,3,1,-1,-1,-2,1,1,1,0,1,1,2,1,0,0,0,1,1.2,-0.4,1,0.4,0.55 +645,R_6I70FHN36RzXTsR,46 - 52,American,Male,0,3,-2,0,0,-3,0,0,0,-2,1,0,2,0,2,-1,-1,0,-1,-1,1,3,1,-1,0,3,-3,0,0,0,0,0,1,0,2,2,2,2,0,0,1,0,-1,7,0,3,-2,1,0,1,-3,0,0,0,0,1,1,0,2,0,3,1,-1,0,0,-1,-1,5,TRUE,0,60,TRUE,1,80,TRUE,0,70,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,70,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,FALSE,1,75,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,1,75,FALSE,1,90,TRUE,1,75,TRUE,0,50,FALSE,1,75,TRUE,0,75,FALSE,0,50,FALSE,0,50,TRUE,1,75,0,0.0625,0,0.09,0.0625,0,0.0625,0.25,0.25,0,0.25,0,0.09,0.25,0.0625,0.04,0.0625,0.25,0.0625,0.01,0.25,0.25,0.25,0.25,0.0625,0.25,0.25,0.36,0.49,0.0625,0.5625,0,0.169285714,0.116428571,0.222142857,16,50,21,65.63,5,62.5,6,75,5,62.5,5,62.5,11,68.75,10,62.5,70.78,56.25,78.12,71.25,77.5,73.12,68.44,-15.63,5.15,-6.25,3.12,8.75,15,4.37,5.94,1,0,3,1,0,0,0,0,0,2,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,1,0,1,0,0,0,1,0.4,0.4,0.8,0.2,0.4,0.2,0.2,0.65,0.25,1.67,1,2,-1,1,2,0.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,49,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,0,3,0,0,0,0,0,0,0,0,0,0,2,-1,1,0,1,1,0,0.8,0,0.2,0.6,0.4 +646,R_7KrrcA7c2ET46vs,46 - 52,Canadian,Male,3,3,3,1,2,-2,2,-2,3,1,3,3,3,-2,3,-3,-3,-3,-1,-3,3,3,3,0,2,5,2,-1,3,2,3,3,3,3,3,1,3,7,-1,-1,-1,-2,-1,7,3,3,3,3,3,3,2,-1,2,-1,3,6,3,3,3,-3,3,7,-2,-1,0,0,-3,7,TRUE,0,100,FALSE,0,100,TRUE,0,84,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,64,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,59,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,0,0,0,0,0,1,0,1,0,0.25,0,0.5625,0,0.1296,1,1,0.1849,0.3481,0,1,0.7056,1,1,0,0.336810714,0.178571429,0.49505,25,78.13,22,68.75,4,50,7,87.5,4,50,7,87.5,15,93.75,7,43.75,91.84,84.12,88.38,96.88,98,97.75,85.94,9.38,23.09,34.12,0.88,46.88,10.5,4,42.19,0,0,0,1,0,4,3,5,1,2,0,0,0,3,0,2,2,2,1,2,0,0,0,2,1,4,3,4,4,2,0,0,0,1,0,1,2,3,1,0,0.2,3,0.6,1.8,0.6,3.4,0.2,1.4,1.4,1.4,5,5.33,2,-3,0,0,-0.33,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),51,1.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,-1,0,0,1,-3,0,0,0,0,2,0,1,0,-1,0,2,-0.4,-0.4,0.4,0.4,0 +647,R_7BW7avPLZO34zke,32 - 38,Canadian,Male,1,0,-2,1,-2,-3,0,0,0,-1,-1,1,1,0,1,1,1,1,0,0,0,1,2,-2,-1,6,-2,0,-1,0,0,5,0,-2,1,1,1,4,-2,1,0,-1,0,6,0,0,-2,0,-2,4,-2,0,0,0,-1,5,0,1,1,0,1,6,0,0,0,0,0,5,FALSE,1,85,TRUE,1,65,TRUE,0,55,TRUE,0,55,TRUE,1,65,TRUE,0,65,TRUE,1,70,TRUE,1,75,TRUE,1,60,TRUE,1,65,TRUE,0,60,FALSE,1,60,TRUE,1,60,TRUE,0,55,TRUE,1,55,TRUE,1,75,TRUE,0,55,TRUE,0,75,FALSE,1,65,FALSE,1,70,FALSE,0,70,TRUE,1,90,FALSE,1,75,TRUE,1,65,FALSE,1,60,TRUE,1,60,TRUE,0,55,TRUE,0,55,TRUE,0,59,TRUE,1,80,FALSE,0,70,TRUE,1,85,0.0625,0.16,0.0625,0.09,0.0225,0.4225,0.1225,0.1225,0.09,0.01,0.04,0.16,0.16,0.36,0.1225,0.1225,0.0625,0.3025,0.3025,0.16,0.49,0.2025,0.1225,0.3025,0.3025,0.3025,0.49,0.0225,0.3025,0.5625,0.3481,0.16,0.221092857,0.151428571,0.290757143,8,25,20,62.5,4,50,4,50,6,75,6,75,14,87.5,6,37.5,66.06,60.62,66.75,70,66.88,69.38,62.75,-37.5,3.56,10.62,16.75,-5,-8.12,-18.12,25.25,1,1,4,3,1,1,0,1,0,1,1,3,0,1,0,3,0,1,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,1,1,0,0,2,0.6,1,1,0.4,0.2,0.2,0.6,1.15,0.35,5,5,2,0,-2,1,0,5 cents,5 minutes,24 days,Male,University - Undergraduate,35,0.25,1,1,0,0,0,1,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,1,4,2,1,0,0,1,0,1,0,3,0,1,0,2,-1,0,1,0,1.6,0.4,0.8,0.4,0.8 +648,R_6P05gacJmqYglwn,32 - 38,Canadian,Male,3,3,3,2,2,0,-2,2,-1,2,3,3,2,0,2,3,2,2,2,2,2,3,2,3,2,8,1,-2,1,-3,2,8,2,3,2,0,2,8,2,1,2,2,3,8,2,3,2,2,3,8,2,1,2,-3,1,8,2,2,1,2,2,8,2,2,2,3,2,8,TRUE,0,76,TRUE,1,66,TRUE,0,64,FALSE,1,83,TRUE,1,98,FALSE,1,95,TRUE,1,67,TRUE,1,96,TRUE,1,74,TRUE,1,96,FALSE,1,100,TRUE,0,92,FALSE,0,92,FALSE,1,88,FALSE,0,87,TRUE,1,96,TRUE,0,93,FALSE,1,86,TRUE,0,93,FALSE,1,91,FALSE,0,96,FALSE,0,88,FALSE,1,97,FALSE,0,92,FALSE,1,81,TRUE,1,91,FALSE,1,95,FALSE,1,96,TRUE,0,85,FALSE,0,84,FALSE,0,86,FALSE,0,87,0.0016,0.0081,0.0016,0.1089,0.7569,0.0025,0.8464,0.0016,0.0081,0.7744,0.7056,0.8464,0.0676,0,0.0004,0.1156,0.0009,0.0289,0.0016,0.0361,0.9216,0.7569,0.8649,0.0144,0.8649,0.0025,0.7396,0.5776,0.4096,0.0196,0.7225,0.8464,0.390482143,0.296807143,0.484157143,23,71.88,18,56.25,5,62.5,3,37.5,6,75,4,50,8,50,10,62.5,87.84,85.5,92.88,84.12,88.88,87.25,88.44,15.63,31.59,23,55.38,9.12,38.88,37.25,25.94,1,0,1,1,0,1,0,1,2,0,1,0,0,0,0,1,1,0,0,1,1,0,1,0,1,2,3,0,2,1,1,1,1,2,0,1,0,0,1,0,0.6,0.8,0.2,0.6,0.6,1.6,1,0.4,0.55,0.9,8,8,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),37,0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,1,-1,-1,-3,1,0,-1,0,-1,-1,-2,0,0,1,0,-1,1,0,-0.8,-0.8,0.2,-0.35 +649,R_7XuMXfNpMkp9lJf,32 - 38,Canadian,Male,1,3,2,-2,0,3,-3,2,-3,0,3,2,3,2,3,1,3,1,1,1,3,3,3,-3,-2,0,3,3,3,3,0,0,3,3,3,3,3,0,3,2,1,1,3,0,1,3,3,-3,-3,0,0,0,0,-1,-1,0,2,3,0,-3,3,0,2,-2,3,3,2,8,FALSE,1,100,TRUE,1,52,TRUE,0,50,FALSE,1,86,FALSE,0,54,FALSE,1,95,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,91,FALSE,1,50,FALSE,1,97,TRUE,1,64,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,51,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,93,0.25,0.25,0.25,0.25,0.0049,0.0025,0.25,0.0081,0.25,0.25,0.25,0.1296,0.25,0.25,0.2916,0.2304,0,0.0196,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.2601,0.25,0.0009,0.185632143,0.156192857,0.215071429,28,87.5,16,50,5,62.5,6,75,3,37.5,2,25,4,25,12,75,60.41,54.75,69.5,61.5,55.88,56.5,64.31,37.5,10.41,-7.75,-5.5,24,30.88,31.5,-10.69,2,0,1,1,2,0,6,1,6,0,0,1,0,1,0,2,1,0,0,2,0,0,1,1,3,3,3,2,2,1,1,1,3,5,0,1,5,2,2,1,1.2,2.6,0.4,1,1,2.2,2,2.2,1.3,1.85,0,0,0,0,0,-8,0,5 cents,100 minutes,47 days,Male,High School (or equivalent),35,1,1,0,1,0,1,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,2,0,0,0,-1,-3,3,-1,4,-1,-1,0,-3,-4,0,1,-4,-2,-2,1,0.2,0.4,-1.6,-1.2,-0.55 +650,R_7BbvZqPsCnAtPHL,53 - 59,American,Male,0,0,3,2,1,2,-3,2,-3,3,1,-3,2,-3,3,-3,-3,-3,-3,-3,2,1,1,-1,-1,7,3,2,2,1,3,7,-2,-3,2,-2,3,7,1,1,1,1,-2,8,3,1,3,3,-3,7,-1,-2,2,-2,2,4,2,-3,2,-3,3,7,-3,-3,0,-3,-3,9,TRUE,0,100,TRUE,1,100,TRUE,0,88,FALSE,1,60,FALSE,0,93,FALSE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,90,TRUE,1,100,FALSE,1,99,FALSE,0,58,TRUE,1,100,FALSE,1,95,FALSE,1,100,TRUE,0,97,FALSE,1,91,FALSE,0,100,TRUE,1,100,FALSE,1,55,TRUE,1,75,TRUE,0,89,TRUE,1,100,FALSE,1,55,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,0,0,0,0.0081,0.0625,0,0.0081,0,0,0,0,0.5625,0.8649,0,0.2025,0.16,0,0.7921,1,0.3364,0.9409,0.0001,0.0025,0.2025,0.3025,1,0.7744,0,1,0.81,0.3225,0.133471429,0.511528571,24,75,21,65.63,4,50,5,62.5,6,75,6,75,12,75,9,56.25,89.56,75,91.75,98.5,93,92.56,86.56,9.37,23.93,25,29.25,23.5,18,17.56,30.31,2,1,2,3,2,1,5,0,4,0,3,0,0,1,0,4,4,4,4,1,3,1,0,1,4,3,1,0,1,1,1,0,0,0,0,0,0,3,0,0,2,2,0.8,3.4,1.8,1.2,0.2,0.6,2.05,0.95,7,6,0,3,0,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),59,2,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-1,0,2,2,-2,-2,4,0,3,-1,2,0,0,1,0,4,4,1,4,1,0.2,0.8,0.6,2.8,1.1 +651,R_3ClE7IcIuk4W5XQ,53 - 59,American,Male,3,3,2,0,2,-1,-2,1,-1,1,0,1,2,0,2,0,0,1,1,-3,3,3,1,-2,3,7,-2,0,1,-2,0,3,2,1,2,1,2,5,1,2,1,1,2,8,3,3,0,1,0,5,-1,-1,1,-2,0,3,0,0,2,0,2,5,-1,-1,-1,-1,-3,8,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,54,TRUE,1,100,FALSE,1,76,TRUE,1,94,TRUE,1,98,TRUE,1,87,TRUE,1,98,FALSE,1,95,TRUE,0,98,FALSE,0,79,TRUE,0,79,TRUE,1,77,TRUE,1,99,TRUE,0,69,FALSE,1,85,FALSE,1,92,FALSE,1,99,FALSE,0,73,TRUE,1,84,FALSE,1,98,TRUE,1,92,FALSE,1,60,TRUE,1,98,FALSE,1,94,FALSE,1,93,TRUE,0,86,TRUE,1,92,FALSE,0,50,TRUE,1,98,0.0004,0.0004,0.0001,0.0036,0.0004,0.0576,0.0064,0.0004,0.0001,0.0256,0.0064,0.6241,0.0169,0.0025,0,0.01,0.0004,0.2116,0.0049,0.16,0.5329,0.0529,0.0064,0.6241,0.4761,0.0036,0.25,0,1,0.0225,0.7396,0.9604,0.206992857,0.068742857,0.345242857,24,75,24,75,7,87.5,4,50,7,87.5,6,75,13,81.25,11,68.75,87.09,79.88,84.88,87.25,96.38,88.06,86.12,0,12.09,-7.62,34.88,-0.25,21.38,6.81,17.37,0,0,1,2,1,1,2,0,1,1,2,0,0,1,0,1,2,0,0,5,0,0,2,1,2,0,1,0,1,1,0,1,0,0,0,1,1,2,2,0,0.8,1,0.6,1.6,1,0.6,0.2,1.2,1,0.75,5,4.33,2,0,0,0,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),57,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,0,-1,1,-1,1,1,0,0,0,2,-1,0,1,0,0,1,-2,-2,5,-0.2,0.4,0.4,0.4,0.25 +652,R_7vk59A621u2tiiO,46 - 52,American,Male,1,0,-1,-2,2,-2,0,3,1,-1,3,0,1,1,0,-1,-1,1,1,-1,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,6,0,-1,0,-2,1,6,0,0,0,0,0,6,0,0,0,0,1,6,0,0,0,0,0,5,FALSE,1,77,FALSE,0,54,TRUE,0,72,FALSE,1,78,FALSE,0,52,FALSE,1,57,TRUE,1,52,FALSE,0,54,FALSE,0,53,TRUE,1,97,FALSE,1,55,TRUE,0,87,TRUE,1,73,TRUE,0,52,FALSE,0,53,FALSE,0,56,TRUE,0,71,TRUE,0,85,FALSE,1,54,FALSE,1,87,FALSE,0,81,TRUE,1,65,FALSE,1,77,FALSE,0,56,FALSE,1,55,FALSE,0,55,FALSE,1,57,FALSE,1,50,FALSE,1,54,FALSE,0,68,TRUE,1,56,FALSE,0,55,0.2916,0.3025,0.3136,0.2304,0.3025,0.1849,0.3136,0.0009,0.0169,0.1225,0.4624,0.0729,0.2809,0.2025,0.2704,0.2916,0.0529,0.0484,0.25,0.2025,0.6561,0.2809,0.2116,0.2704,0.5041,0.1849,0.1936,0.0529,0.5184,0.7225,0.2116,0.7569,0.272846429,0.187378571,0.358314286,10,31.25,16,50,5,62.5,4,50,5,62.5,2,25,5,31.25,11,68.75,64,57.5,65,67.25,66.25,61.25,66.75,-18.75,14,-5,15,4.75,41.25,30,-2,1,0,1,2,2,2,0,3,1,1,3,0,1,1,0,1,1,1,1,1,1,1,1,0,1,2,0,3,1,1,3,0,1,1,1,1,1,1,1,1,1.2,1.4,1,1,0.8,1.4,1.2,1,1.15,1.1,5.33,6,0,-1,-1,1,-0.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,51,0.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,-1,0,2,1,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0.4,0,-0.2,0,0.05 +653,R_5AqyTyOrKkGLL4R,53 - 59,American,Male,3,3,3,3,3,1,-2,3,1,0,3,3,2,1,3,1,0,2,2,2,3,3,3,3,3,2,-1,-2,3,-3,0,3,3,3,2,-1,1,5,1,1,1,1,0,3,3,3,3,3,3,5,0,-2,3,0,2,6,3,3,2,0,3,6,1,1,2,1,1,5,TRUE,0,73,TRUE,1,70,TRUE,0,61,FALSE,1,76,FALSE,0,53,TRUE,0,57,TRUE,1,90,TRUE,1,78,FALSE,0,53,TRUE,1,82,FALSE,1,82,FALSE,1,77,FALSE,0,80,TRUE,0,61,FALSE,0,58,TRUE,1,62,FALSE,1,77,FALSE,1,74,FALSE,1,54,FALSE,1,62,FALSE,0,100,TRUE,1,60,FALSE,1,59,TRUE,1,59,TRUE,0,65,TRUE,1,80,TRUE,0,68,FALSE,1,70,TRUE,0,62,TRUE,1,100,TRUE,1,70,FALSE,0,76,0.0484,0.04,0.1444,0.01,0.5776,0.3249,0.1681,0.0324,0.1444,0.16,0,0.64,0.2809,0.0324,0.2809,0.09,0.1681,0.0576,0.09,0.4225,1,0.3364,0.2116,0.3721,0.0529,0.4624,0.09,0.5329,0.3721,0.0676,0.3844,0.0529,0.264467857,0.211235714,0.3177,15,46.88,19,59.38,5,62.5,2,25,5,62.5,7,87.5,10,62.5,9,56.25,70.28,66.38,70.5,73.12,71.12,73.19,67.38,-12.5,10.9,3.88,45.5,10.62,-16.38,10.69,11.13,0,0,0,0,0,2,0,0,4,0,0,0,0,2,2,0,1,1,1,2,0,0,0,0,0,1,0,0,1,2,0,0,0,1,0,0,1,0,1,1,0,1.2,0.8,1,0,0.8,0.2,0.6,0.75,0.4,3.33,5.67,-3,-3,-1,-2,-2.34,10 cents,75 minutes,24 days,Male,Trade School (non-military),55,0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,1,0,0,3,-2,0,0,0,1,2,0,0,1,0,1,0,0.4,0.6,0.4,0.35 +654,R_7uOZIAqY9LEalrz,39 - 45,Canadian,Male,0,0,0,0,2,-1,-1,1,-1,-1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,8,-1,-1,-1,-1,-1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,FALSE,1,69,TRUE,1,76,TRUE,0,74,TRUE,0,77,TRUE,1,73,FALSE,1,73,FALSE,0,70,FALSE,0,66,FALSE,0,67,TRUE,1,72,FALSE,1,69,TRUE,0,72,TRUE,1,73,TRUE,0,76,FALSE,0,65,TRUE,1,78,TRUE,0,69,FALSE,1,67,FALSE,1,64,TRUE,0,71,FALSE,0,79,TRUE,1,74,FALSE,1,67,TRUE,1,65,FALSE,1,68,FALSE,0,69,FALSE,1,69,TRUE,0,91,FALSE,1,70,TRUE,1,91,TRUE,1,70,FALSE,0,70,0.4356,0.4761,0.0484,0.49,0.49,0.0729,0.1225,0.0784,0.5041,0.0676,0.0081,0.0729,0.4489,0.0961,0.0729,0.0576,0.1089,0.5929,0.8281,0.1024,0.6241,0.4225,0.1296,0.5776,0.4761,0.0961,0.09,0.0961,0.5476,0.1089,0.09,0.5184,0.267903571,0.199557143,0.33625,20,62.5,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,9,56.25,9,56.25,72,69.62,71.75,70.62,76,72.38,71.62,6.25,15.75,7.12,9.25,8.12,38.5,16.13,15.37,1,1,1,1,1,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,2,2,0,2,2,0,0,0,0,1,0,0,0,0,0,1,0.4,0.2,0,1,1.6,0.2,0,0.4,0.7,8,8,0,0,0,0,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,40,0,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,-2,-2,2,-2,-2,0,0,0,0,0,0,0,0,0,0,0,-1.2,0,0,-0.3 +655,R_1w66l8DC239XPIO,39 - 45,Canadian,Male,-3,1,0,3,2,0,-3,2,-3,1,3,0,2,-3,2,-1,1,1,0,-3,-3,1,-2,3,3,8,0,-3,1,-3,2,8,3,1,0,-3,2,7,1,1,2,2,-2,8,-3,2,0,3,2,5,0,-3,2,-3,1,8,3,0,0,-3,2,7,1,1,2,2,-2,9,FALSE,1,80,TRUE,1,97,TRUE,0,96,FALSE,1,65,TRUE,1,91,TRUE,0,87,TRUE,1,93,FALSE,0,59,TRUE,1,84,TRUE,1,92,FALSE,1,57,TRUE,0,100,TRUE,1,86,FALSE,1,59,TRUE,1,76,TRUE,1,100,FALSE,1,69,TRUE,0,100,FALSE,1,92,FALSE,1,74,FALSE,0,63,TRUE,1,94,TRUE,0,69,FALSE,0,53,TRUE,0,91,TRUE,1,82,FALSE,1,53,FALSE,1,93,FALSE,1,50,TRUE,1,75,TRUE,1,54,TRUE,1,53,0.3481,0.0324,0,0.0049,0.2209,0.7569,0.2809,0.0064,0.0676,0.0036,0.0625,0.0196,0.0256,0.1849,0.0081,0.0009,0.4761,0.1225,0.0049,0.8281,0.3969,0.0576,0.0064,0.1681,0.0961,0.2209,0.2116,0.04,0.9216,1,0.25,1,0.265667857,0.15975,0.371585714,9,28.13,23,71.88,8,100,5,62.5,6,75,4,50,13,81.25,10,62.5,77.72,72.25,71,86.38,81.25,78.25,77.19,-43.75,5.84,-27.75,8.5,11.38,31.25,-3,14.69,0,0,2,0,1,0,0,1,0,1,0,1,2,0,0,2,0,1,2,1,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,1,2,1,0.6,0.4,0.6,1.2,0.2,0,0.4,1.2,0.7,0.45,7.67,6.67,3,0,0,-1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,45,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,-1,2,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0.4,0.4,0.2,0,0.25 +656,R_6nUsAJTWZgp44VO,25 - 31,Canadian,Male,1,3,3,2,3,1,-2,3,-1,3,0,1,3,0,2,0,1,1,2,-1,-2,3,3,1,-1,8,-2,-2,1,-2,2,7,-2,-2,2,2,2,7,3,2,2,2,3,8,2,2,2,1,1,4,2,-2,2,-2,2,7,1,1,2,1,2,8,2,1,2,2,2,8,FALSE,1,69,TRUE,1,60,FALSE,1,76,TRUE,0,80,FALSE,0,54,TRUE,0,82,TRUE,1,86,FALSE,0,56,TRUE,1,62,TRUE,1,84,FALSE,1,82,TRUE,0,85,FALSE,0,81,FALSE,1,85,TRUE,1,88,TRUE,1,74,FALSE,1,79,TRUE,0,72,TRUE,0,85,FALSE,1,89,TRUE,1,79,TRUE,1,84,FALSE,1,77,TRUE,1,81,FALSE,1,74,TRUE,1,79,TRUE,0,78,TRUE,0,100,FALSE,1,86,TRUE,1,92,FALSE,0,64,TRUE,1,93,0.3136,0.0441,0.0676,0.0196,0.0049,0.6724,0.0361,0.0256,0.0121,0.0256,0.0064,0.6561,0.1444,0.0324,0.2916,0.16,0.0529,0.64,1,0.0676,0.0441,0.0144,0.7225,0.0225,0.0441,0.6084,0.4096,0.0961,0.0576,0.5184,0.0196,0.7225,0.253853571,0.197178571,0.310528571,15,46.88,21,65.63,4,50,5,62.5,7,87.5,5,62.5,12,75,9,56.25,78.62,74.88,78.88,79.12,81.62,76.06,81.19,-18.75,12.99,24.88,16.38,-8.38,19.12,1.06,24.94,3,0,0,1,4,3,0,2,1,1,2,3,1,2,0,3,1,1,0,4,1,1,1,1,2,1,0,1,1,1,1,0,1,1,0,2,0,1,0,3,1.6,1.4,1.6,1.8,1.2,0.8,0.6,1.2,1.6,0.95,7.33,6.33,4,0,-1,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,2,-1,-1,0,2,2,0,1,0,0,1,3,0,1,0,1,1,0,0,1,0.4,0.6,1,0.6,0.65 +657,R_8yfGtl8dxbEotbe,39 - 45,American,Male,-1,3,3,0,1,1,0,1,-2,0,2,0,-2,2,-1,-1,0,-1,2,-2,2,-2,2,0,2,3,1,-2,-1,-1,3,5,-2,-3,1,1,-2,8,-2,2,0,2,-2,6,2,1,-2,0,-3,4,0,-1,-1,-2,0,7,0,-3,2,2,0,8,1,1,2,-1,2,3,FALSE,1,66,FALSE,0,83,TRUE,0,96,TRUE,0,57,FALSE,0,64,FALSE,1,78,TRUE,1,62,TRUE,1,66,TRUE,1,66,TRUE,1,88,TRUE,0,77,FALSE,1,59,FALSE,0,61,TRUE,0,92,FALSE,0,77,TRUE,1,88,TRUE,0,90,FALSE,1,83,TRUE,0,75,FALSE,1,67,TRUE,1,89,TRUE,1,76,TRUE,0,83,FALSE,0,57,FALSE,1,88,FALSE,0,73,FALSE,1,61,TRUE,0,86,FALSE,1,60,TRUE,1,84,TRUE,1,65,FALSE,0,56,0.1156,0.5329,0.0144,0.1444,0.3136,0.0484,0.3249,0.0144,0.1089,0.0576,0.0256,0.3721,0.1156,0.5929,0.4096,0.6889,0.6889,0.3249,0.7396,0.0144,0.0121,0.5929,0.5625,0.8464,0.81,0.1521,0.1225,0.1156,0.9216,0.0289,0.16,0.1681,0.333321429,0.291878571,0.374764286,13,40.63,17,53.13,3,37.5,3,37.5,6,75,5,62.5,9,56.25,8,50,74.16,70.12,72.62,78.5,75.38,72.19,76.12,-12.5,21.03,32.62,35.12,3.5,12.88,15.94,26.12,3,5,1,0,1,0,2,2,1,3,4,3,3,1,1,1,2,1,0,0,3,2,5,0,4,1,1,2,0,0,2,3,4,0,1,2,1,3,3,4,2,1.6,2.4,0.8,2.8,0.8,2,2.6,1.7,2.05,5.33,6.33,-1,-2,0,3,-1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),44,-0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,3,-4,0,-3,-1,1,0,1,3,2,0,-1,1,0,-1,1,-2,-3,-4,-0.8,0.8,0.4,-1.8,-0.35 +658,R_64RW0hFTd5hbqhP,32 - 38,Canadian,Male,2,1,2,1,2,2,1,1,-2,2,-3,-3,3,-1,3,0,0,1,-1,-1,2,1,2,0,2,1,3,-1,0,-1,3,1,-3,-3,3,-1,3,1,0,-1,0,-1,-1,4,2,2,2,1,2,1,3,-2,1,-1,3,1,-3,-3,3,-1,3,1,0,-1,1,1,-1,2,FALSE,1,60,TRUE,1,55,TRUE,0,66,FALSE,1,70,TRUE,1,90,FALSE,1,93,TRUE,1,74,TRUE,1,54,TRUE,1,78,FALSE,0,51,FALSE,1,71,TRUE,0,62,TRUE,1,72,FALSE,1,89,TRUE,1,53,TRUE,1,97,FALSE,1,59,TRUE,0,85,FALSE,1,51,FALSE,1,99,TRUE,1,51,FALSE,0,51,FALSE,1,71,TRUE,1,78,FALSE,1,97,FALSE,0,59,FALSE,1,51,FALSE,1,52,FALSE,1,51,FALSE,0,52,FALSE,0,52,FALSE,0,58,0.2116,0.3481,0.0009,0.0676,0.3364,0.0049,0.0484,0.2601,0.0001,0.2601,0.2704,0.0784,0.0484,0.0841,0.01,0.2025,0.0841,0.09,0.2304,0.0009,0.2401,0.2209,0.2401,0.0121,0.1681,0.2401,0.2704,0.16,0.4356,0.7225,0.2401,0.3844,0.190842857,0.126992857,0.254692857,25,78.13,23,71.88,7,87.5,7,87.5,4,50,5,62.5,10,62.5,13,81.25,67.25,60.12,68.12,70.75,70,64.06,70.44,6.25,-4.63,-27.38,-19.38,20.75,7.5,1.56,-10.81,0,0,0,1,0,1,2,1,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,1,3,0,1,1,0,0,0,0,0,0,1,0,2,0,0.2,1.2,0,0.4,0.2,1.2,0,0.6,0.45,0.5,1,1,0,0,0,2,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,1.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,-1,0,1,0,0,-1,1,0,0,0,0,0,0,0,0,0,1,-2,0,0,0,0,-0.2,-0.05 +659,R_5lGxOvHem88IAP7,18 - 24,Canadian,Male,3,2,1,0,2,1,0,2,-2,2,2,0,2,1,3,2,2,2,2,2,3,-2,3,-3,2,8,-2,1,-1,-2,-2,8,2,2,-1,0,2,7,2,2,2,2,2,1,3,2,1,1,2,3,1,-2,3,-3,2,3,2,-1,2,0,3,2,2,2,2,2,2,1,FALSE,1,100,FALSE,0,60,TRUE,0,100,TRUE,0,60,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,80,TRUE,0,86,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,60,TRUE,1,100,TRUE,0,60,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0,1,0,0.7396,0,1,0,0.1225,1,0.25,0.36,0,0.36,1,0.16,0,0,0.64,1,1,0.36,0.36,0,1,1,1,1,0.476860714,0.34515,0.608571429,24,75,16,50,2,25,6,75,6,75,2,25,12,75,4,25,90.03,73.12,93.75,95,98.25,89.69,90.38,25,40.03,48.12,18.75,20,73.25,14.69,65.38,0,4,2,3,0,3,1,3,0,4,0,2,3,1,1,0,0,0,0,0,0,0,0,1,0,0,2,1,1,0,0,1,0,1,0,0,0,0,0,0,1.8,2.2,1.4,0,0.2,0.8,0.4,0,1.35,0.35,7.67,2.67,5,5,5,0,5,10 cents,5 minutes,47 days,Male,High School (or equivalent),18,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,4,2,2,0,3,-1,2,-1,4,0,1,3,0,1,0,0,0,0,0,1.6,1.4,1,0,1 +660,R_5WZnCnA5ZMfjqh1,32 - 38,Canadian,Male,2,2,1,2,3,1,2,2,1,2,1,2,3,2,2,1,1,1,2,0,2,3,2,2,3,8,2,3,3,3,3,5,0,0,2,1,2,8,2,2,3,1,1,8,2,2,1,2,3,7,1,2,3,1,2,7,1,2,3,3,2,6,1,1,1,2,0,7,FALSE,1,100,TRUE,1,70,FALSE,1,90,FALSE,1,64,TRUE,1,90,FALSE,1,100,TRUE,1,80,TRUE,1,81,TRUE,1,82,TRUE,1,81,FALSE,1,85,TRUE,0,85,FALSE,0,100,FALSE,1,75,TRUE,1,88,TRUE,1,100,TRUE,0,85,TRUE,0,85,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,61,TRUE,0,70,FALSE,0,50,TRUE,1,100,TRUE,1,100,0.0361,0,0,0.04,0,0,0,0.0361,0,0,0.25,1,0.0324,0.0225,0.01,0.09,0,0.1296,0.3721,0,0,0.0144,0,0.0625,0.7225,0,0,0,0.01,0.7225,0.49,0.7225,0.167396429,0.112185714,0.222607143,18,56.25,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,88.19,86.12,93.12,90.12,83.38,88.88,87.5,-21.88,10.06,-13.88,30.62,2.62,20.88,1.38,18.75,0,1,1,0,0,1,1,1,2,1,1,2,1,1,0,1,1,2,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0.4,1.2,1,1.2,0,0.2,0.2,0,0.95,0.1,7,6.67,1,-2,2,1,0.33,5 cents,5 minutes,47 days,Male,University - PhD,35,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,1,1,0,0,1,1,0,2,1,1,2,1,0,0,1,1,2,1,1,0.4,1,0.8,1.2,0.85 +661,R_7hYZBL2Y9z6VkLq,18 - 24,Canadian,Male,1,3,0,2,2,3,1,2,1,2,1,1,2,1,2,0,1,1,3,2,1,3,2,1,2,6,2,3,1,0,1,6,0,2,2,1,1,7,3,1,1,2,2,7,2,2,0,1,2,8,2,2,2,3,0,8,2,2,1,1,-1,8,1,2,1,-1,2,8,TRUE,0,100,FALSE,0,53,TRUE,0,71,FALSE,1,53,FALSE,0,50,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,0,53,TRUE,1,60,TRUE,0,83,TRUE,0,100,TRUE,1,75,FALSE,1,54,FALSE,0,57,TRUE,1,88,TRUE,0,75,TRUE,0,91,FALSE,1,56,TRUE,0,53,FALSE,0,90,TRUE,1,100,TRUE,0,64,TRUE,1,92,TRUE,0,75,TRUE,1,74,FALSE,1,80,FALSE,1,76,FALSE,1,59,FALSE,0,76,FALSE,0,52,FALSE,0,52,0.25,0.0676,0.0144,0.1764,0.2704,0.25,0.0064,0.16,0.2809,0,0.5776,0.0625,0.2809,0.6889,0.25,0.2809,0.4096,0.2209,0.0576,0.5625,0.81,0.3249,0.1936,0.2116,0.5625,0.04,0.2704,1,0.5041,0.8281,0.1681,1,0.366871429,0.267071429,0.466671429,25,78.13,14,43.75,3,37.5,3,37.5,5,62.5,3,37.5,7,43.75,7,43.75,69.38,60.88,64.38,76.5,75.75,67.5,71.25,34.38,25.63,23.38,26.88,14,38.25,23.75,27.5,0,0,2,1,0,1,2,1,1,1,1,1,0,0,1,3,0,0,1,0,1,1,0,1,0,1,1,0,2,2,1,1,1,0,3,1,1,0,4,0,0.6,1.2,0.6,0.8,0.6,1.2,1.2,1.2,0.8,1.05,6.33,8,-2,-2,-1,-1,-1.67,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),23,0.375,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,-1,-1,2,0,0,0,1,1,-1,-1,0,0,-1,0,-2,2,-1,0,-3,0,0,0,-0.6,-0.4,-0.25 +662,R_6e4P4G7XkW3QdTX,25 - 31,Canadian,Male,1,1,1,-1,-1,-1,-1,0,1,0,0,-1,1,1,1,1,0,1,1,1,1,1,1,-1,1,0,0,0,0,0,0,10,0,0,1,1,1,6,1,1,1,1,1,5,1,1,1,-1,-1,0,0,0,0,0,0,5,0,-1,1,1,1,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,75,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,76,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,0,71,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,1,0,0.0625,0,0,0.5041,0,0,0,0,0.0576,0,0,0,0.0576,0,1,0.0625,1,1,0,0.5625,0.0625,1,0,1,1,1,0,0.298903571,0.0487,0.549107143,16,50,22,68.75,5,62.5,6,75,5,62.5,6,75,13,81.25,9,56.25,94.47,90.88,90.62,100,96.38,98.44,90.5,-18.75,25.72,28.38,15.62,37.5,21.38,17.19,34.25,0,0,0,0,2,1,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,1,1,0.4,0.6,0.2,0.2,0,0.6,0,0.8,0.35,0.35,5.33,3.33,0,5,1,0,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),27,0.875,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,-1,1,-1,-1,-1,0.4,0,0.2,-0.6,0 +663,R_3cAmHE8UALSr7bz,18 - 24,Canadian,Male,3,3,-2,2,-1,1,-3,1,-2,3,2,-1,3,-2,3,2,2,2,1,-3,3,3,-2,-2,-1,2,-3,-1,-3,2,2,2,3,1,-2,2,2,7,1,1,-3,-1,-3,3,3,3,-2,2,1,4,-1,-3,1,-3,2,3,3,-1,3,-3,3,6,1,2,1,1,-2,8,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,80,TRUE,1,100,TRUE,1,95,TRUE,1,50,TRUE,1,80,FALSE,1,80,TRUE,0,100,TRUE,1,70,FALSE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,96,FALSE,1,95,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,50,FALSE,0,70,0.0025,0,0,0,0.49,0.04,0.0016,0.04,0.25,0.25,0,0.09,0.25,0.04,0.25,0.25,1,0.25,0,0.0025,0,0.16,0.25,0,1,0.25,0.25,1,1,0,0.01,1,0.290146429,0.228685714,0.351607143,26,81.25,25,78.13,7,87.5,5,62.5,7,87.5,6,75,15,93.75,10,62.5,80.19,55,82.5,90.62,92.62,76.31,84.06,3.12,2.06,-32.5,20,3.12,17.62,-17.44,21.56,0,0,0,4,0,4,2,4,4,1,1,2,5,4,1,1,1,5,2,0,0,0,0,0,2,2,0,0,1,1,1,0,0,1,0,1,0,1,0,1,0.8,3,2.6,1.8,0.4,0.8,0.4,0.6,2.05,0.55,3.67,4.33,-2,-1,1,-5,-0.66,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,22,1.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,4,-2,2,2,4,3,0,0,2,5,3,1,0,1,4,2,-1,0.4,2.2,2.2,1.2,1.5 +664,R_6G9EWfU6MX8l8ZE,32 - 38,Canadian,Male,-1,1,2,1,0,-3,-3,3,-3,-2,-1,0,2,0,3,0,1,2,2,0,-2,3,3,3,0,2,-1,-3,3,-3,0,4,-1,-2,3,0,3,2,-2,0,-2,-2,-2,7,0,1,3,3,2,2,-3,-2,2,-3,0,1,-1,-2,3,-2,3,1,0,0,1,1,-1,4,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,80,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,0,100,TRUE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,TRUE,1,70,TRUE,1,50,0,1,0.25,0,0.25,0,0,0,0.25,0,1,0.64,0.25,0,0.25,0.25,0,0.25,0,0.25,0,0.25,0,1,0.25,0.25,0.09,0.25,1,0,0.25,1,0.276071429,0.224285714,0.327857143,12,37.5,22,68.75,6,75,6,75,5,62.5,5,62.5,11,68.75,11,68.75,78.12,65,72.5,87.5,87.5,78.12,78.12,-31.25,9.37,-10,-2.5,25,25,9.37,9.37,1,2,1,2,0,2,0,0,0,2,0,2,1,0,0,2,1,4,4,2,1,0,1,2,2,0,1,1,0,2,0,2,1,2,0,0,1,1,1,1,1.2,0.8,0.6,2.6,1.2,0.8,1,0.8,1.3,0.95,2.67,1.33,0,3,1,3,1.34,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,36,1.125,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,2,0,0,-2,2,-1,-1,0,0,0,0,0,-2,0,2,0,3,3,1,0,0,-0.4,1.8,0.35 +665,R_5mC07SFhmdZHbH7,39 - 45,American,Male,2,3,3,2,1,-1,-1,-1,-2,1,0,-2,1,0,1,-1,-2,-1,-2,-2,2,3,3,2,2,1,-1,-2,0,-2,1,2,0,-2,1,-1,1,2,-1,-2,-1,-1,-1,3,2,3,3,2,2,2,-1,-2,1,-2,1,2,0,-2,1,0,1,2,1,1,1,1,0,5,FALSE,1,100,FALSE,0,56,TRUE,0,76,FALSE,1,58,FALSE,0,56,FALSE,1,55,TRUE,1,76,TRUE,1,77,FALSE,0,63,TRUE,1,81,FALSE,1,58,TRUE,0,100,TRUE,1,57,FALSE,1,57,FALSE,0,59,TRUE,1,88,TRUE,0,65,TRUE,0,82,FALSE,1,61,FALSE,1,85,FALSE,0,87,FALSE,0,65,FALSE,1,60,FALSE,0,54,FALSE,1,100,TRUE,1,85,FALSE,1,57,TRUE,0,71,FALSE,1,53,TRUE,1,80,FALSE,0,58,TRUE,1,85,0.0529,0.0225,0.0144,0.0576,0.0225,0.2025,0.2916,0.0361,0.0225,0.4225,0.04,0.1849,0.3969,0.1764,0.3136,0.3136,0.16,0.1764,0.5041,0,0.7569,0.3481,0.1521,0.1849,0.4225,0.1849,0.3364,0,0.5776,0.6724,0.2209,1,0.290010714,0.197107143,0.382914286,16,50,19,59.38,4,50,5,62.5,6,75,4,50,8,50,11,68.75,70.78,58.75,64.75,80.75,78.88,70.44,71.12,-9.38,11.4,8.75,2.25,5.75,28.88,20.44,2.37,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,2,0,0,0,0,0,0,0,2,3,2,3,2,0.2,0.4,0.2,0.4,0.2,0.6,0,2.4,0.3,0.8,1.67,2,-1,0,0,-2,-0.33,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,45,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,-1,0,0,0,0,0,1,0,-2,-3,-2,-2,-1,0,-0.2,0.2,-2,-0.5 +666,R_1yl8kaxHTWxt6lM,53 - 59,American,Male,3,2,3,-1,-1,-3,-1,3,1,-3,2,1,2,0,3,-3,0,-2,-2,-3,1,2,3,-2,-1,1,-3,1,3,2,-2,6,2,2,0,1,3,1,-2,-2,-2,-2,-3,2,3,2,3,-2,-1,2,-2,-1,3,0,-1,3,2,2,2,-1,3,3,-1,-1,-1,-1,-2,4,TRUE,0,91,TRUE,1,98,TRUE,0,96,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,1,60,TRUE,1,90,TRUE,1,96,FALSE,1,56,TRUE,0,60,TRUE,1,75,FALSE,1,62,TRUE,1,88,TRUE,1,82,FALSE,1,77,FALSE,1,100,TRUE,0,55,FALSE,1,100,FALSE,0,82,TRUE,1,76,FALSE,1,100,FALSE,0,56,FALSE,1,91,TRUE,1,92,TRUE,0,56,FALSE,1,54,TRUE,0,81,TRUE,1,70,FALSE,0,51,TRUE,1,97,0.16,0.0064,0.0324,0.0576,0.0009,0,0.3136,0.0016,0,0.0576,0.09,0.0625,0.01,0.1936,0,0.0004,0,0.2304,0.2116,0.0081,0.6724,0.0144,0.3025,0.1444,0.0529,0.3136,0.2601,0.8281,0.9216,0,0.6561,0.36,0.2038,0.068614286,0.338985714,24,75,23,71.88,5,62.5,6,75,7,87.5,5,62.5,13,81.25,10,62.5,78.75,68.25,89,85.5,72.25,80.56,76.94,3.12,6.87,5.75,14,-2,9.75,-0.69,14.44,2,0,0,1,0,0,2,0,1,1,0,1,2,1,0,1,2,0,0,0,0,0,0,1,0,1,0,0,1,2,0,1,0,1,0,2,1,1,1,1,0.6,0.8,0.8,0.6,0.2,0.8,0.4,1.2,0.7,0.65,2.67,2.67,-1,3,-2,-2,0,5 cents,100 minutes,15 days,Male,High School (or equivalent),53,0.875,1,0,0,0,1,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,2,0,0,0,0,-1,2,0,0,-1,0,0,2,0,0,-1,1,-1,-1,-1,0.4,0,0.4,-0.6,0.05 +667,R_3HvAsPu6RolGbO9,46 - 52,Canadian,Male,-2,1,0,-1,1,-2,1,1,-1,0,-1,1,2,-1,-1,-2,-2,-2,-2,-2,-2,2,1,-2,2,3,-2,1,1,-1,1,4,-1,1,0,-1,-1,3,-2,-2,-2,-2,-2,6,-2,1,0,1,2,3,-1,-1,-1,-1,-1,4,-1,-1,-1,0,-1,3,-2,-2,-2,-2,-3,3,TRUE,0,90,TRUE,1,100,TRUE,0,59,TRUE,0,50,TRUE,1,50,FALSE,1,86,TRUE,1,100,TRUE,1,92,FALSE,0,60,TRUE,1,98,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,90,FALSE,1,50,FALSE,1,81,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,55,TRUE,1,54,FALSE,1,50,FALSE,1,100,TRUE,0,83,TRUE,1,69,FALSE,0,50,TRUE,1,80,0.0064,0.2116,0.01,0,0.04,0.0196,0.0081,0.0004,0,0,0.0961,0,0.36,0.25,0.25,0,0,0.25,0,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.3481,0.0361,0.6889,0.25,0.191421429,0.091014286,0.291828571,28,87.5,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,73.06,57.5,74.88,78.5,81.38,77.12,69,12.5,-1.94,-5,-0.12,-9,6.38,-4.13,0.25,0,1,1,1,1,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,2,1,1,2,2,0,1,0,2,3,1,0,0,0,0,0,1,0.8,0.2,0.4,0,0.6,1.2,1.2,0.2,0.35,0.8,3.33,3.33,0,0,0,3,0,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,1,-1,0,-1,-2,-2,0,0,0,-2,-1,-1,0,0,0,0,0,-1,0.2,-1,-0.8,-0.2,-0.45 +668,R_16arDcHSBUmfHjw,25 - 31,Canadian,Male,2,3,1,1,2,0,-2,3,-1,1,2,-1,2,0,3,3,3,3,2,2,2,3,2,3,2,9,-1,-2,2,3,3,9,3,-3,2,0,3,7,1,1,1,3,0,9,2,3,1,-2,2,8,-2,-2,3,0,2,8,3,-1,3,-1,2,6,3,3,3,2,0,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,88,TRUE,1,100,FALSE,1,61,TRUE,0,88,FALSE,0,96,TRUE,0,87,TRUE,1,100,TRUE,1,100,TRUE,0,94,FALSE,1,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,100,FALSE,1,71,TRUE,1,100,TRUE,0,96,TRUE,0,100,FALSE,1,74,FALSE,0,85,FALSE,0,100,FALSE,0,88,0,0,0,0,0.7744,0,0,0,0,0,0.7225,0.9216,0.0144,0.1521,0,0,0.0256,0,1,0.0841,0,0,0.0081,0.7569,0.8836,0.9216,1,0,1,0,0.0676,0.7744,0.325246429,0.186471429,0.464021429,27,84.38,22,68.75,6,75,5,62.5,7,87.5,4,50,12,75,10,62.5,93.84,92,92,94.75,96.62,97.31,90.38,15.63,25.09,17,29.5,7.25,46.62,22.31,27.88,0,0,1,2,0,1,0,1,4,2,1,2,0,0,0,2,2,2,1,2,0,0,0,3,0,2,0,0,1,1,1,0,1,1,1,0,0,0,0,2,0.6,1.6,0.6,1.8,0.6,0.8,0.8,0.4,1.15,0.65,8.33,7.33,1,1,1,1,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,30,-0.25,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,1,-1,0,-1,0,1,3,1,0,2,-1,-1,-1,2,2,2,1,0,0,0.8,-0.2,1.4,0.5 +669,R_7mOk6ToUgjkheRH,46 - 52,Canadian,Male,-1,2,0,1,0,0,0,1,0,0,0,0,1,0,0,-1,-3,-2,-2,-3,-3,2,1,1,0,5,-1,0,0,0,0,5,0,0,0,1,1,5,-3,-3,-3,-3,-3,5,-3,2,2,2,0,5,-2,0,-1,1,0,5,0,0,0,-1,0,5,-2,-3,-3,-3,-3,5,TRUE,0,50,FALSE,0,53,TRUE,0,54,TRUE,0,51,TRUE,1,51,FALSE,1,50,TRUE,1,56,TRUE,1,52,TRUE,1,55,TRUE,1,61,FALSE,1,50,TRUE,0,65,TRUE,1,52,TRUE,0,51,TRUE,1,54,TRUE,1,52,TRUE,0,52,TRUE,0,67,FALSE,1,51,TRUE,0,50,TRUE,1,51,TRUE,1,50,TRUE,0,51,TRUE,1,70,TRUE,0,53,TRUE,1,51,TRUE,0,54,TRUE,0,52,TRUE,0,50,TRUE,1,70,TRUE,1,50,TRUE,1,55,0.2304,0.2401,0.2304,0.1936,0.2025,0.25,0.09,0.1521,0.25,0.25,0.09,0.2304,0.2025,0.25,0.2401,0.2809,0.2601,0.2601,0.2704,0.2809,0.2401,0.2116,0.2401,0.2601,0.2704,0.2916,0.25,0.25,0.2916,0.4489,0.25,0.4225,0.249532143,0.214907143,0.284157143,8,25,18,56.25,5,62.5,5,62.5,4,50,4,50,15,93.75,3,18.75,54.19,52.25,51.5,54.88,58.12,55.19,53.19,-31.25,-2.06,-10.25,-11,4.88,8.12,-38.56,34.44,2,0,1,0,0,1,0,1,0,0,0,0,1,1,1,2,0,1,1,0,2,0,2,1,0,2,0,2,1,0,0,0,1,1,0,1,0,1,1,0,0.6,0.4,0.6,0.8,1,1,0.4,0.6,0.6,0.75,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),50,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,-1,-1,0,-1,0,-1,-1,0,0,0,0,0,1,1,0,0,0,0,-0.4,-0.6,0.2,0.2,-0.15 +670,R_5mnUZGp5jKWAttn,25 - 31,American,Male,3,3,1,2,3,3,-3,3,-1,1,3,2,2,1,3,0,0,0,-1,-1,3,2,2,2,3,1,1,-3,1,-3,2,1,3,3,1,-1,2,1,-2,-2,-3,-2,-1,5,3,3,2,3,3,10,1,-3,3,-3,1,10,2,3,3,-1,3,10,3,3,1,3,-1,9,FALSE,1,79,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,95,TRUE,1,97,TRUE,1,98,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,98,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,0,0,0.0004,0,0,0.01,1,0,0,1,0,1,0,0,0,0,0.0004,0,0,0,0,0.0009,0,0.0025,1,0.0016,0.0001,0.0441,1,0,0,1,0.216414286,0.215028571,0.2178,16,50,26,81.25,8,100,6,75,7,87.5,5,62.5,13,81.25,13,81.25,98.5,99,98.5,96.75,99.75,99.62,97.38,-31.25,17.25,-1,23.5,9.25,37.25,18.37,16.13,0,1,1,0,0,2,0,2,2,1,0,1,1,2,1,2,2,3,1,0,0,0,1,1,0,2,0,0,2,0,1,1,1,2,0,3,3,1,4,0,0.4,1.4,1,1.6,0.4,0.8,1,2.2,1.1,1.1,1,10,-9,-9,-9,-4,-9,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),30,0.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,1,0,-1,0,0,0,2,0,1,-1,0,0,0,1,-1,-1,2,-3,0,0,0.6,0,-0.6,0 +671,R_5gUeZWBb9NLCH7P,46 - 52,Canadian,Male,2,3,1,-3,1,2,-2,3,-3,2,0,0,2,-3,3,1,2,2,0,3,3,3,1,-3,1,1,2,-2,2,-3,3,2,0,1,2,-3,3,1,-2,0,-2,-1,3,7,1,3,1,0,0,2,2,-2,2,-3,0,1,0,0,2,-3,3,1,0,0,2,0,3,5,FALSE,1,100,FALSE,0,50,FALSE,1,60,FALSE,1,50,TRUE,1,50,FALSE,1,60,TRUE,1,85,TRUE,1,65,TRUE,1,55,TRUE,1,52,FALSE,1,50,TRUE,0,65,FALSE,0,55,FALSE,1,80,TRUE,1,90,TRUE,1,100,TRUE,0,69,TRUE,0,58,TRUE,0,65,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,1,95,TRUE,0,60,TRUE,1,50,FALSE,1,50,FALSE,1,70,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.1225,0.25,0,0.0225,0.25,0.16,0.0025,0.2304,0,0.09,0.25,0.3025,0.2025,0.25,0.25,0.25,0.25,0.25,0.09,0.36,0.25,0.01,0.4225,0.04,0.4761,0.25,0.25,0,0.16,0.3364,0.25,0.4225,0.216264286,0.195564286,0.236964286,12,37.5,21,65.63,5,62.5,4,50,6,75,6,75,10,62.5,11,68.75,64.19,57.5,54.25,69.38,75.62,63.56,64.81,-28.13,-1.44,-5,4.25,-5.62,0.62,1.06,-3.94,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,3,2,4,1,0,1,0,0,3,1,0,0,1,0,2,0,0,0,0,0,1,2,0,0,0,0.2,0.4,0.2,2,1,0.6,0,0.6,0.7,0.55,1.33,1.33,-1,1,0,2,0,5 cents,5 minutes,15 days,Male,College Diploma/Certificate,50,1.75,1,1,0,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,-3,-1,0,0,0,0,-1,0,1,0,0,0,2,0,4,1,0,-0.8,-0.2,0.2,1.4,0.15 +672,R_3mihKaMDHI1tKwN,53 - 59,American,Male,1,1,2,1,1,-1,0,1,-1,0,1,1,1,0,2,-1,0,0,0,-1,1,1,2,1,2,3,0,0,1,0,1,3,2,2,1,0,2,1,0,0,-1,0,-1,4,1,1,2,1,1,1,0,-1,1,-1,1,3,1,2,1,-1,1,2,0,-1,0,0,-1,2,TRUE,0,96,TRUE,1,89,TRUE,0,88,FALSE,1,54,TRUE,1,60,FALSE,1,81,TRUE,1,81,TRUE,1,74,TRUE,1,80,TRUE,1,89,TRUE,0,60,FALSE,1,97,FALSE,0,89,FALSE,1,100,TRUE,1,66,TRUE,1,80,FALSE,1,60,FALSE,1,85,FALSE,1,55,FALSE,1,100,TRUE,1,66,TRUE,1,70,FALSE,1,100,TRUE,1,72,TRUE,0,63,TRUE,1,66,TRUE,0,70,FALSE,1,76,TRUE,0,78,TRUE,1,67,TRUE,1,69,TRUE,1,83,0.0676,0.1156,0.04,0.0361,0.0289,0.0361,0.0784,0.0121,0,0.09,0.1089,0.7921,0.04,0.36,0.16,0.0121,0,0.2116,0.0576,0.3969,0.1156,0.1156,0.2025,0,0.16,0.49,0.0961,0.9216,0.7744,0.0225,0.6084,0.0009,0.210439286,0.137871429,0.283007143,22,68.75,25,78.13,6,75,6,75,6,75,7,87.5,15,93.75,10,62.5,77,67.88,77.12,81.25,81.75,75.06,78.94,-9.38,-1.13,-7.12,2.12,6.25,-5.75,-18.69,16.44,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,1,1,0,0,0,0.2,0.6,0.4,0.4,0,0.6,0.6,0.4,0.4,0.4,2.33,2,2,0,-1,2,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,55,0.875,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,1,0,-1,0,1,0,1,0,0,-1,-1,0,-1,1,0,0,0.2,0,-0.2,0,0 +673,R_5OPaqVxNTufwlYx,46 - 52,Canadian,Male,-2,-3,-3,0,-3,-3,-1,1,2,-1,3,-1,0,-3,2,-3,-3,-3,-3,-3,-2,-2,-2,0,-3,3,-3,-1,1,1,-1,3,3,-1,0,-3,2,3,-2,-1,-1,-1,-1,8,-2,-3,-3,0,-3,2,-3,-1,1,1,-2,3,3,-1,0,-3,2,3,-3,-3,-3,-3,-3,1,TRUE,0,69,TRUE,1,54,FALSE,1,60,TRUE,0,50,TRUE,1,57,FALSE,1,79,TRUE,1,82,TRUE,1,90,TRUE,1,50,TRUE,1,60,FALSE,1,50,TRUE,0,59,FALSE,0,100,FALSE,1,91,TRUE,1,58,TRUE,1,78,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,57,TRUE,1,82,TRUE,1,66,FALSE,1,99,TRUE,1,69,FALSE,1,83,TRUE,1,61,TRUE,0,51,FALSE,1,89,TRUE,0,68,FALSE,0,55,TRUE,1,59,TRUE,1,88,0.01,0.1521,0.0484,0.0324,0.0144,0.0441,0.0961,0.16,0.1849,0.1156,0.3025,1,0.25,0.25,0.1849,0.2116,0.0001,0.25,0.0121,0.0289,0.0324,0.1764,0.25,0.0081,0.25,0.2601,0.1681,0.4761,0.16,0.25,0.4624,0.3481,0.212389286,0.218871429,0.205907143,8,25,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,67.62,52.75,77.88,70.25,69.62,69.31,65.94,-50,-7.38,-22.25,2.88,-4.75,-5.38,-18.19,3.44,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,2,2,2,2,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0.4,0.2,0,1.8,0,0.4,0,0,0.6,0.1,3,2.67,1,0,0,7,0.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,48,1.375,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,1,1,0,0,0,0,0,0,-1,0,0,0,0,0,1,2,2,2,2,0.4,-0.2,0,1.8,0.5 +674,R_7Kd549Jv3m2lNUW,46 - 52,American,Male,2,3,3,2,3,-3,1,1,-3,2,2,-3,3,1,3,-3,-3,-2,-3,-2,2,3,3,3,3,1,-2,2,1,-3,2,1,2,-2,3,-2,3,4,-2,-2,-2,-2,-2,9,2,3,3,3,3,1,1,2,2,-3,2,1,2,-2,2,-2,3,1,-2,-2,-2,-2,-2,1,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,74,TRUE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,78,TRUE,1,89,TRUE,0,88,TRUE,0,100,TRUE,0,77,TRUE,0,92,FALSE,0,50,TRUE,1,83,FALSE,1,73,TRUE,1,79,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,72,TRUE,1,85,FALSE,0,50,TRUE,1,98,0,0,0.0121,0,0.0004,0.5476,0.0441,0,0.8464,0.0289,0.0225,0,0.0256,0,0.25,0.25,0.0729,0.25,0,1,0.25,0.0484,0.5929,0.25,0.7744,0.25,0.25,0.25,1,1,0.5184,1,0.340089286,0.167028571,0.51315,24,75,19,59.38,6,75,3,37.5,5,62.5,5,62.5,13,81.25,6,37.5,80.38,67.38,75.62,85.38,93.12,81,79.75,15.62,21,-7.62,38.12,22.88,30.62,-0.25,42.25,0,0,0,1,0,1,1,0,0,0,0,1,0,3,0,1,1,0,1,0,0,0,0,1,0,4,1,1,0,0,0,1,1,3,0,1,1,0,1,0,0.2,0.4,0.8,0.6,0.2,1.2,1,0.6,0.5,0.75,2,1,0,0,3,8,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),47,1.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,-3,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,-0.8,-0.2,0,-0.25 +675,R_3Of8EufxfaIEqoV,46 - 52,Canadian,Male,1,0,1,0,-1,1,1,2,0,2,2,1,1,1,2,-1,-2,-1,-1,-1,1,0,0,2,1,8,0,1,1,1,0,6,1,0,-1,0,1,7,0,2,1,2,1,7,1,1,1,2,2,7,1,1,2,0,0,8,-1,0,0,2,1,8,1,1,2,1,2,7,FALSE,1,100,FALSE,0,64,TRUE,0,100,FALSE,1,68,TRUE,1,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,93,TRUE,0,74,TRUE,1,74,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,88,TRUE,1,100,TRUE,0,70,TRUE,1,100,TRUE,0,100,FALSE,0,65,TRUE,0,100,FALSE,1,100,TRUE,0,62,FALSE,0,59,TRUE,1,79,TRUE,1,74,0,0.4225,0,0,0.0676,0,0,0,0,0,0.3481,0.0049,0.0289,0,0.1521,0.4096,0.49,0.1024,0,1,0.0144,0.0676,0.0625,0.5476,1,1,0.0441,0,1,1,0.3844,1,0.311578571,0.114542857,0.508614286,16,50,20,62.5,6,75,5,62.5,4,50,5,62.5,13,81.25,7,43.75,87.16,80.38,81,92.38,94.88,83.75,90.56,-12.5,24.66,5.38,18.5,42.38,32.38,2.5,46.81,0,0,1,2,2,1,0,1,1,2,1,1,2,1,1,1,4,2,3,2,0,1,0,2,3,0,0,0,0,2,3,1,1,1,1,2,3,3,2,3,1,1,1.2,2.4,1.2,0.4,1.4,2.6,1.4,1.4,7,7.67,1,-2,-1,0,-0.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,47,-0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,-1,1,0,-1,1,0,1,1,0,-2,0,1,0,0,-1,1,-1,1,-1,-0.2,0.6,-0.2,-0.2,0 +676,R_73q19pg52KZaZZn,39 - 45,American,Male,2,-2,2,0,1,-2,-2,2,0,2,3,-1,1,1,-2,1,-1,2,0,-3,-1,0,3,-2,2,7,-1,1,3,1,-2,4,1,1,-3,-1,3,1,-2,2,0,-1,-1,5,2,-2,-2,1,1,2,0,-2,0,2,-2,3,2,0,2,-2,1,2,-2,-1,-2,2,1,8,FALSE,1,82,TRUE,1,64,TRUE,0,100,FALSE,1,84,TRUE,1,62,FALSE,1,84,FALSE,0,60,TRUE,1,88,TRUE,1,87,TRUE,1,95,FALSE,1,85,TRUE,0,61,FALSE,0,62,TRUE,0,85,FALSE,0,53,TRUE,1,52,TRUE,0,93,FALSE,1,56,FALSE,1,52,TRUE,0,85,FALSE,0,56,TRUE,1,73,TRUE,0,81,FALSE,0,57,FALSE,1,63,FALSE,0,56,TRUE,0,63,TRUE,0,58,FALSE,1,88,TRUE,1,54,TRUE,1,86,FALSE,0,75,0.0144,0.3136,0.2304,0.36,0.5625,0.0256,0.3249,0.0025,0.7225,0.0729,0.2116,0.3844,0.0169,0.0225,0.1444,0.1296,0.6561,0.0256,0.3364,0.1369,0.3136,0.2809,0.2304,0.7225,0.8649,0.3969,0.0196,0.0324,1,0.1936,0.0144,0.3721,0.29345,0.235857143,0.351042857,19,59.38,17,53.13,6,75,3,37.5,5,62.5,3,37.5,9,56.25,8,50,71.88,71.75,75.12,71.25,69.38,67.5,76.25,6.25,18.75,-3.25,37.62,8.75,31.88,11.25,26.25,3,2,1,2,1,1,3,1,1,4,2,2,4,2,5,3,3,2,1,2,0,0,4,1,0,2,0,2,2,4,1,1,1,3,3,3,0,4,2,4,1.8,2,3,2.2,1,2,1.8,2.6,2.25,1.85,4,2.33,5,1,-1,-3,1.67,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),41,0.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,3,2,-3,1,1,-1,3,-1,-1,0,1,1,3,-1,2,0,3,-2,-1,-2,0.8,0,1.2,-0.4,0.4 +677,R_7ISuO9yeWcD34BP,25 - 31,Canadian,Male,-2,3,0,-2,3,1,1,1,1,2,1,1,2,1,1,-1,0,1,1,0,-1,1,1,-1,0,3,0,-1,1,1,-1,7,1,0,1,2,1,7,1,1,2,-1,1,6,-2,3,-2,-2,3,7,0,-1,1,0,1,2,1,1,1,1,1,6,2,2,2,2,1,5,TRUE,0,70,TRUE,1,75,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,80,FALSE,0,60,TRUE,1,50,TRUE,1,95,FALSE,1,60,TRUE,0,80,TRUE,1,80,TRUE,0,60,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,60,FALSE,1,75,FALSE,1,100,FALSE,0,100,TRUE,1,60,FALSE,1,100,TRUE,1,60,TRUE,0,80,FALSE,0,50,FALSE,1,50,FALSE,1,90,FALSE,1,50,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.36,0.25,0,0.04,0,0.25,0.16,0.0025,0,0.16,0,0.04,0.25,0.16,0.25,0.0625,0,0.25,0.01,0.64,1,0.25,0.0625,0.36,0.25,0.25,0.01,0.49,0.25,0.16,0.25,0.64,0.221696429,0.113214286,0.330178571,20,62.5,22,68.75,7,87.5,5,62.5,4,50,6,75,13,81.25,9,56.25,71.09,62.5,72.5,69.38,80,75,67.19,-6.25,2.34,-25,10,19.38,5,-6.25,10.94,1,2,1,1,3,1,2,0,0,3,0,1,1,1,0,2,1,1,2,1,0,0,2,0,0,1,2,0,1,1,0,0,1,0,0,3,2,1,1,1,1.6,1.2,0.6,1.4,0.4,1,0.2,1.6,1.2,0.8,5.67,5,-4,5,1,1,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,27,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,2,-1,1,3,0,0,0,-1,2,0,1,0,1,0,-1,-1,0,1,0,1.2,0.2,0.4,-0.2,0.4 +678,R_7z6DP671COc8ph6,53 - 59,American,Male,-1,2,3,3,-1,2,0,1,-3,0,3,0,2,-1,1,0,1,1,1,0,2,2,2,2,1,5,1,1,-1,-1,0,5,0,0,-1,1,1,5,1,0,1,-1,-2,6,-1,2,2,2,-1,6,1,-3,0,-2,-1,7,1,2,3,-2,0,7,0,0,0,1,1,6,TRUE,0,92,TRUE,1,95,TRUE,0,97,FALSE,1,67,TRUE,1,62,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,100,FALSE,1,100,FALSE,1,57,TRUE,1,99,FALSE,1,65,TRUE,1,55,TRUE,1,100,FALSE,1,56,TRUE,0,100,FALSE,1,58,TRUE,0,91,TRUE,1,99,TRUE,1,100,FALSE,1,100,FALSE,0,52,FALSE,1,100,TRUE,1,99,FALSE,1,55,FALSE,1,100,TRUE,0,58,TRUE,1,86,FALSE,0,57,TRUE,1,100,0,0.0001,0,0,0,0,0.2704,1,0.8281,0,0.0196,0.0001,0.25,0,0.1444,0.0025,0,0.1089,0,0,0.0001,0.2025,0.1764,0.1225,0.1936,0.2025,0.3249,0.8464,0.9409,1,0.3364,0.1849,0.255539286,0.187428571,0.32365,24,75,23,71.88,6,75,7,87.5,5,62.5,5,62.5,12,75,11,68.75,82.81,67.12,84.25,94.5,85.38,84.62,81,3.12,10.93,-7.88,-3.25,32,22.88,9.62,12.25,3,0,1,1,2,1,1,2,2,0,3,0,3,2,0,1,1,0,2,2,0,0,1,1,0,1,3,1,1,1,2,2,1,1,1,0,1,1,0,1,1.4,1.2,1.6,1.2,0.4,1.4,1.4,0.6,1.35,0.95,5,6.67,-1,-2,-2,0,-1.67,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,53,-0.5,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,0,0,0,2,0,-2,1,1,-1,1,-2,2,1,-1,1,0,-1,2,1,1,-0.2,0.2,0.6,0.4 +679,R_1JgWJdUQWW0nn6V,39 - 45,American,Male,2,3,3,2,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,2,2,2,10,3,3,3,3,3,10,2,2,2,2,2,9,1,1,1,0,1,8,3,3,3,3,3,10,3,3,3,3,3,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,1,0,1,0,0,0,0.0036,0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,1,1,1,0.500128571,0.3574,0.642857143,32,100,18,56.25,5,62.5,3,37.5,6,75,4,50,14,87.5,4,25,99.81,99.25,100,100,100,99.62,100,43.75,43.56,36.75,62.5,25,50,12.12,75,1,0,0,1,0,0,6,0,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,1,2,4,2,3,2,0,0,0,0,0,0,0,0,0,0,0.4,2.4,0.6,0,0.6,2.6,0,0,0.85,0.8,10,9,1,2,0,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,43,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,1,-1,-1,1,-1,-2,2,-2,3,-2,0,0,1,1,1,0,0,0,0,0,-0.2,-0.2,0.6,0,0.05 +680,R_5LtUa8bqZ8QlyAI,25 - 31,American,Male,1,3,3,3,3,1,1,1,-2,1,1,1,1,1,0,2,2,1,2,1,1,3,3,3,3,9,1,0,-1,-1,1,9,0,0,-1,-1,0,9,2,2,3,1,2,9,0,3,3,-3,3,9,0,-2,0,-2,0,8,0,0,0,0,0,9,-1,0,0,-2,-2,9,TRUE,0,100,FALSE,0,88,FALSE,1,94,FALSE,1,93,TRUE,1,93,TRUE,0,86,TRUE,1,88,TRUE,1,89,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,97,FALSE,1,99,TRUE,0,98,TRUE,1,100,TRUE,1,87,TRUE,1,100,0.0121,0,0,0.0144,0,0.7396,0,0,0,0,0,0,0,1,0.0049,0.7744,1,0.0049,0.0001,1,1,0,0,1,1,0.9409,0.0169,1,0.0036,1,0.9604,1,0.444489286,0.2517,0.637278571,16,50,19,59.38,5,62.5,3,37.5,4,50,7,87.5,14,87.5,5,31.25,97.25,95.62,97.12,98.5,97.75,96.56,97.94,-9.38,37.87,33.12,59.62,48.5,10.25,9.06,66.69,0,0,0,0,0,0,1,2,1,0,1,1,2,2,0,0,0,2,1,1,1,0,0,6,0,1,3,1,0,1,1,1,1,1,0,3,2,1,4,3,0,0.8,1.2,0.8,1.4,1.2,0.8,2.6,0.7,1.5,9,8.67,0,1,0,0,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,25,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,-1,0,0,-6,0,-1,-2,1,1,-1,0,0,1,1,0,-3,-2,1,-3,-2,-1.4,-0.4,0.4,-1.8,-0.8 +681,R_1me0UE09DCXstD6,39 - 45,Canadian,Male,-1,-1,1,2,1,-2,-2,-1,-2,1,1,1,1,1,2,-3,-3,-3,-3,-3,1,-1,2,1,2,2,-2,-2,1,-2,1,1,1,1,1,1,2,1,-2,0,-1,-1,1,6,-1,-1,-1,2,2,2,-2,-2,1,-2,1,1,2,2,1,2,2,2,0,0,0,0,-2,7,TRUE,0,70,TRUE,1,60,TRUE,0,60,FALSE,1,95,TRUE,1,65,FALSE,1,99,FALSE,0,55,TRUE,1,75,TRUE,1,90,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,1,99,FALSE,0,50,TRUE,1,99,FALSE,1,60,FALSE,1,85,TRUE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,60,FALSE,1,100,TRUE,1,99,TRUE,0,50,FALSE,1,80,FALSE,1,60,FALSE,0,70,FALSE,0,50,TRUE,1,99,0.0625,0.0001,0.0001,0.3025,0.0001,0.0001,0.36,0.04,0.25,0,0.49,0.0625,0.01,0.25,0.1225,0.16,0,0.0025,0.04,0,0,0.25,0.25,0.0001,0.16,0.25,0.25,0.49,0.36,0.0225,0.16,0.25,0.151082143,0.124835714,0.177328571,24,75,23,71.88,4,50,8,100,6,75,5,62.5,11,68.75,12,75,74.53,61.88,82.25,86,68,76.69,72.38,3.12,2.65,11.88,-17.75,11,5.5,7.94,-2.62,2,0,1,1,1,0,0,2,0,0,0,0,0,0,0,1,3,2,2,4,0,0,2,0,1,0,0,2,0,0,1,1,0,1,0,3,3,3,3,1,1,0.4,0,2.4,0.6,0.4,0.6,2.6,0.95,1.05,1.33,1.67,0,0,-1,-1,-0.34,5 cents,5 minutes,47 days,Male,University - Undergraduate,42,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,2,0,-1,1,0,0,0,0,0,0,-1,-1,0,-1,0,-2,0,-1,-1,3,0.4,0,-0.6,-0.2,-0.1 +682,R_1N9ylwpvLg7lFLl,18 - 24,Canadian,Male,1,3,2,2,3,2,-2,1,-2,2,2,2,1,-1,-1,0,1,-1,2,-1,-1,1,1,-1,1,8,2,-2,1,-1,-1,8,2,1,-1,-2,1,5,-1,1,-1,2,-1,8,1,3,2,2,3,8,2,-1,2,-2,1,8,-1,-1,-1,2,2,5,2,-1,2,2,-1,8,FALSE,1,74,FALSE,0,66,TRUE,0,71,FALSE,1,93,FALSE,0,59,FALSE,1,54,FALSE,0,64,FALSE,0,56,TRUE,1,80,TRUE,1,90,TRUE,0,70,TRUE,0,90,TRUE,1,90,FALSE,1,70,FALSE,0,80,TRUE,1,90,FALSE,1,57,TRUE,0,100,FALSE,1,72,FALSE,1,52,FALSE,0,60,FALSE,0,70,FALSE,1,70,FALSE,0,80,TRUE,0,70,TRUE,1,90,FALSE,1,70,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,0,62,FALSE,0,54,0.3136,0.01,0.01,0.4096,0.2916,0.2116,0.64,0.01,0.2304,0.49,0,0.01,0.04,0.49,0.3481,0.4356,0.09,0.0049,0,0.49,0.36,0.64,0.0784,0.09,0.1849,0.09,0.3844,0.0676,0.5041,1,0.09,0.81,0.288628571,0.235157143,0.3421,20,62.5,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,74.19,74.12,64.25,78.5,79.88,74.44,73.94,9.37,21.06,24.12,1.75,28.5,29.88,36.94,5.19,2,2,1,3,2,0,0,0,1,3,0,1,2,1,2,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,3,3,2,3,3,2,2,3,0,0,2,0.8,1.2,0.2,0,0.6,2.8,1.4,1.05,1.2,7,7,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,21,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,2,2,1,3,2,0,-1,-1,1,2,-3,-2,0,-2,-1,-1,-2,-3,0,0,2,0.2,-1.6,-1.2,-0.15 +683,R_5wcNlag6ceIUjS7,25 - 31,American,Male,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,9,2,2,2,2,2,9,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,TRUE,0,88,TRUE,1,87,TRUE,0,87,TRUE,0,84,TRUE,1,81,TRUE,0,86,TRUE,1,83,TRUE,1,86,TRUE,1,85,TRUE,1,88,TRUE,0,88,TRUE,0,100,TRUE,1,85,TRUE,0,89,TRUE,1,81,TRUE,1,82,TRUE,0,82,TRUE,0,86,TRUE,0,82,TRUE,0,83,TRUE,1,80,TRUE,1,77,TRUE,0,81,TRUE,1,82,FALSE,1,89,TRUE,1,83,TRUE,0,89,TRUE,0,91,TRUE,0,90,TRUE,1,93,TRUE,1,92,TRUE,1,93,0.0196,0.0289,0.0324,0.0289,0.0049,0.7396,0.0324,0.0144,0.6889,0.0529,0.0049,0.0225,0.0225,0.7744,0.0361,0.0169,0.6561,0.7056,0.8281,0.0121,0.04,0.0361,0.6724,0.7921,0.6724,0.7921,0.0064,0.7744,0.7569,0.7396,0.81,1,0.418025,0.269435714,0.566614286,23,71.88,17,53.13,4,50,4,50,5,62.5,4,50,16,100,1,6.25,86.03,86,84.75,85.38,88,84.88,87.19,18.75,32.9,36,34.75,22.88,38,-15.12,80.94,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0,0,0.05,0,8.67,9,0,0,-1,0,-0.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,27,0.25,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05 +684,R_3GOLclcTglSIaGV,39 - 45,Canadian,Male,1,3,2,2,1,-2,1,2,1,0,2,0,1,1,2,0,1,1,0,-2,0,1,3,0,0,4,-2,0,1,1,0,3,2,1,1,2,2,3,-1,0,-1,-2,-2,1,3,3,2,3,2,3,-2,0,2,1,0,2,2,-1,1,1,2,2,-1,0,0,0,-1,5,TRUE,0,61,FALSE,0,57,TRUE,0,91,FALSE,1,53,FALSE,0,79,FALSE,1,100,TRUE,1,98,FALSE,0,50,TRUE,1,50,FALSE,0,90,FALSE,1,99,TRUE,0,97,TRUE,1,99,FALSE,1,98,FALSE,0,53,TRUE,1,74,FALSE,1,54,FALSE,1,80,TRUE,0,90,FALSE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,70,TRUE,1,52,FALSE,1,91,TRUE,1,64,FALSE,1,50,FALSE,1,95,TRUE,0,96,TRUE,1,100,FALSE,0,86,TRUE,1,70,0.25,0.1296,0.0676,0.0004,0.09,0,0.2304,0.81,0,0.25,0,0.0001,0.25,0.0001,0.6241,0.3249,0.49,0.2209,0.0025,0.0081,0.25,0.2809,0.81,0.0004,0.2116,0.25,0.7396,0.3721,0.8281,0.04,0.9216,0.9409,0.319510714,0.235035714,0.403985714,23,71.88,18,56.25,4,50,4,50,5,62.5,5,62.5,8,50,10,62.5,76.47,67.25,77.25,79,82.38,70.12,82.81,15.63,20.22,17.25,27.25,16.5,19.88,20.12,20.31,1,2,1,2,1,0,1,1,0,0,0,1,0,1,0,1,1,2,2,0,2,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,1,1,0,1,1.4,0.4,0.4,1.2,0.8,0.2,0.2,0.8,0.85,0.5,3.33,2.33,1,1,1,-4,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,43,1.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,-1,2,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,2,-1,0.6,0.2,0.2,0.4,0.35 +685,R_78Gq86eg0MMuGTO,25 - 31,Canadian,Male,-3,2,3,-2,3,2,2,0,2,2,1,1,3,3,2,2,2,2,1,-1,-3,3,3,-3,3,1,-1,3,-1,3,0,8,0,-1,0,3,0,9,-1,-2,-2,0,-3,10,-1,3,3,0,3,2,2,2,0,-1,2,2,1,2,3,2,2,2,2,1,2,3,2,2,TRUE,0,100,FALSE,0,50,TRUE,0,83,FALSE,1,50,FALSE,0,50,FALSE,1,87,FALSE,0,50,TRUE,1,64,TRUE,1,60,TRUE,1,90,FALSE,1,70,TRUE,0,94,TRUE,1,98,TRUE,0,73,FALSE,0,55,TRUE,1,80,TRUE,0,90,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,80,FALSE,1,50,TRUE,1,75,FALSE,1,50,TRUE,1,90,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,61,0.1296,0.01,0.04,0.25,0.1521,0.0169,0.0625,0.01,0,0.04,0,0.0004,0.16,0.09,0.25,0.25,0.25,0.25,0,0.25,1,0.3025,0.25,0.5329,0.81,0.25,1,1,0.6889,1,1,0.8836,0.374992857,0.109421429,0.640564286,17,53.13,19,59.38,5,62.5,4,50,4,50,6,75,10,62.5,9,56.25,76.56,60.62,79.5,79.12,87,75.19,77.94,-6.25,17.18,-1.88,29.5,29.12,12,12.69,21.69,0,1,0,1,0,3,1,1,1,2,1,2,3,0,2,3,4,4,1,2,2,1,0,2,0,0,0,0,3,0,0,1,0,1,0,0,1,0,2,3,0.4,1.6,1.6,2.8,1,0.6,0.4,1.2,1.6,0.8,6,2,-1,6,7,8,4,10 cents,5 minutes,47 days,Male,University - Undergraduate,30,0.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-2,0,0,-1,0,3,1,1,-2,2,1,1,3,-1,2,3,3,4,-1,-1,-0.6,1,1.2,1.6,0.8 +686,R_1LMC5Teu1zXZQGs,39 - 45,Canadian,Male,0,0,1,1,2,0,1,1,-1,0,1,2,3,0,0,-1,-1,-2,0,-2,1,1,1,1,2,0,0,0,0,0,0,8,2,2,2,2,3,0,0,-1,0,0,0,10,0,0,0,0,0,0,1,1,1,1,1,8,2,1,1,1,1,0,-1,-1,-1,-1,-1,0,TRUE,0,80,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,95,FALSE,0,100,0.25,0,0,0.25,1,0,0,0,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,1,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.0025,0.64,0.25,1,1,0.25,0.32875,0.214285714,0.443214286,16,50,20,62.5,6,75,5,62.5,3,37.5,6,75,9,56.25,11,68.75,70.31,55.62,75,75.62,75,74.69,65.94,-12.5,7.81,-19.38,12.5,38.12,0,18.44,-2.81,1,1,0,0,0,0,1,1,1,0,1,0,1,2,3,1,0,2,0,2,0,0,1,1,2,1,0,0,2,1,1,1,2,1,1,0,0,1,1,1,0.4,0.6,1.4,1,0.8,0.8,1.2,0.6,0.85,0.85,2.67,2.67,0,0,0,10,0,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),44,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,1,-1,-1,-2,-1,1,1,-1,-1,0,-1,-1,1,2,1,0,1,-1,1,-0.4,-0.2,0.2,0.4,0 +687,R_3rGc9083GRoB6jR,46 - 52,American,Male,1,3,3,-1,3,1,-1,-1,-1,1,-1,-1,1,-3,3,1,1,2,2,2,1,3,3,1,3,1,1,1,-1,-1,1,1,-1,0,1,-3,3,1,2,2,2,2,2,1,2,3,3,2,2,1,1,-1,1,1,1,1,1,1,1,-3,3,1,1,1,1,2,1,1,FALSE,1,76,TRUE,1,73,FALSE,1,78,FALSE,1,52,TRUE,1,89,FALSE,1,80,TRUE,1,91,TRUE,1,66,FALSE,0,52,TRUE,1,80,FALSE,1,93,FALSE,1,97,TRUE,1,90,FALSE,1,97,FALSE,0,50,TRUE,1,89,TRUE,0,57,FALSE,1,93,TRUE,0,53,FALSE,1,89,FALSE,0,53,TRUE,1,52,FALSE,1,70,TRUE,1,77,TRUE,0,86,TRUE,1,92,TRUE,0,50,FALSE,1,93,TRUE,0,88,TRUE,1,100,TRUE,1,84,TRUE,1,100,0.1156,0.0064,0.0121,0.0081,0,0.04,0.0529,0.04,0.0121,0.2304,0,0.01,0.2704,0.0049,0.0121,0.0729,0.09,0.2304,0.0049,0.7396,0.2809,0.25,0.2809,0.0009,0.3249,0.25,0.0256,0.0576,0.0484,0.0049,0.7744,0.0009,0.146785714,0.07615,0.217421429,25,78.13,24,75,4,50,5,62.5,7,87.5,8,100,13,81.25,11,68.75,77.81,63.38,78.38,83.38,86.12,77.38,78.25,3.13,2.81,13.38,15.88,-4.12,-13.88,-3.87,9.5,0,0,0,2,0,0,2,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,3,1,0,0,2,2,0,2,2,0,0,0,0,0,1,0,1,0.4,0.4,0.2,0.4,1,0.8,0.8,0.4,0.35,0.75,1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,52,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-1,0,0,-1,-1,0,2,-2,-2,0,-2,-1,0,0,0,1,1,-1,0,-1,-0.6,-0.4,-0.6,0,-0.4 +688,R_7YS8TYsC6D8Qr2F,53 - 59,American,Male,2,2,2,1,1,0,-2,2,-1,1,2,2,2,-1,3,-1,-1,1,0,-1,2,2,2,2,2,0,1,-2,2,-1,1,2,2,2,2,-1,3,2,0,0,0,0,-1,3,2,2,2,2,2,0,0,0,0,0,0,3,2,2,2,-1,3,1,0,0,0,0,-1,4,TRUE,0,50,TRUE,1,65,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,81,TRUE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,72,TRUE,0,50,TRUE,1,50,TRUE,1,87,TRUE,0,50,TRUE,0,72,TRUE,0,50,FALSE,1,79,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,75,TRUE,0,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,0.25,0.0625,0.0169,0.0361,0.25,0.25,0.25,0.25,0.0441,0.25,0.25,0.0784,0.25,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,0.25,0.25,0.24155,0.213928571,0.269171429,23,71.88,19,59.38,5,62.5,5,62.5,4,50,5,62.5,14,87.5,5,31.25,55.66,51.88,52.75,59.75,58.25,58.12,53.19,12.5,-3.72,-10.62,-9.75,9.75,-4.25,-29.38,21.94,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,2,2,1,1,0,0,0,0,0,1,1,1,0,0,0.4,0.2,0,0.6,0.4,1.2,0,0.6,0.3,0.55,1.33,1.33,0,-1,1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,1.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-2,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-0.25 +689,R_5ctjaI2kk0V2XEM,53 - 59,American,Male,3,3,3,3,-1,1,-1,2,-2,1,2,-2,2,1,3,2,1,2,1,1,2,3,2,1,-1,2,-1,1,1,-1,-1,4,1,-2,2,1,3,3,0,1,2,1,1,3,3,3,3,3,-1,2,-1,-1,2,-1,1,2,2,-1,3,0,3,2,2,1,2,1,1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,70,TRUE,1,100,FALSE,1,64,TRUE,1,75,TRUE,1,87,TRUE,1,93,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,58,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,90,FALSE,1,100,FALSE,0,85,TRUE,1,62,FALSE,1,97,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,0,76,FALSE,1,77,TRUE,0,92,FALSE,0,71,FALSE,0,60,TRUE,1,100,0.0169,0,0,0.0625,0,0.1296,0,0,0,0.1444,0.5041,0.0169,0.0049,0.0324,0,0,0.0009,0.09,0.0529,0.0064,0.7225,0.1764,0.81,1,0.7569,0.5776,0.36,1,1,1,0.8464,1,0.365439286,0.065942857,0.664935714,23,71.88,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,13,81.25,7,43.75,87.66,78.62,89,91.12,91.88,86.12,89.19,9.38,25.16,16.12,26.5,28.62,29.38,4.87,45.44,1,0,1,2,0,2,2,1,1,2,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0.8,1.6,0.2,0.4,0,0.6,0.6,0,0.75,0.3,3,2,0,2,1,1,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,56,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,0,1,2,0,0,2,1,0,2,1,-1,-1,-1,0,2,0,0,0,0,0.8,1,-0.4,0.4,0.45 +690,R_1IJDBdArUJMY0PT,32 - 38,Canadian,Male,-3,3,0,-3,-3,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,-3,3,3,0,-3,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,-3,3,0,0,-3,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,82,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.6724,0.25,0.25,0.318657143,0.25,0.387314286,15,46.88,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,54.12,50,50,54,62.5,50,58.25,-6.25,0.99,0,-12.5,4,12.5,12.5,-10.5,0,0,3,3,0,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,1.2,0,1.6,0,0.6,0,1.6,0,0.7,0.55,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),38,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0.15 +691,R_7NJaYdxng6i1y05,53 - 59,American,Male,1,1,2,1,0,-2,0,3,1,0,0,0,3,0,2,-1,-3,-2,0,-2,1,2,2,2,0,0,-1,0,2,1,0,0,0,0,2,-2,2,3,0,-1,-1,0,-2,2,1,1,2,2,2,2,0,0,2,0,0,1,0,0,2,0,2,0,0,0,0,0,0,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0.25,0,0,0,0,0,1,0,0.25,0,0,1,1,1,1,0.232142857,0.089285714,0.375,28,87.5,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,96.88,87.5,100,100,100,100,93.75,9.37,18.75,12.5,12.5,25,25,6.25,31.25,0,1,0,1,0,1,0,1,0,0,0,0,1,2,0,1,2,1,0,0,0,0,0,1,2,2,0,1,1,0,0,0,1,0,0,1,3,2,0,2,0.4,0.4,0.6,0.8,0.6,0.8,0.2,1.6,0.55,0.8,1,1,-2,-1,3,2,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),54,1,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,1,0,0,-2,-1,0,0,-1,0,0,0,0,2,0,0,-1,-1,0,-2,-0.2,-0.4,0.4,-0.8,-0.25 +692,R_5oyuDdGaXGNSoGB,39 - 45,Canadian,Male,2,-2,3,2,-3,-3,-2,1,2,-2,2,1,1,-3,3,2,2,2,2,2,2,-2,3,2,-3,0,-3,-2,2,2,-2,0,2,1,1,-3,3,0,2,2,2,2,2,0,2,-2,3,2,-3,0,-3,-2,2,2,-2,0,2,1,1,-3,3,0,2,2,2,2,2,0,TRUE,0,99,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,1,95,TRUE,1,90,TRUE,1,50,FALSE,1,50,TRUE,0,99,TRUE,1,99,FALSE,1,100,TRUE,1,50,TRUE,1,95,FALSE,1,50,TRUE,0,95,TRUE,0,50,FALSE,1,50,TRUE,1,95,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0025,0,0.0025,0.0025,0,0.0025,0,0.25,0.25,0,0,0.0001,0.01,0.25,0.0025,0,0.5625,0.25,0,0,0.0025,0.25,0.25,0,0.25,0.25,1,0.9801,1,0.9025,0,0.9801,0.265814286,0.112685714,0.418942857,25,78.13,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,85.22,67.5,88.62,92.38,92.38,91.5,78.94,0,7.09,-7.5,1.12,17.38,17.38,-2.25,16.44,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.2,0,0,0.05,0.05,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),44,1.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +693,R_6pMPYhEviIc7du6,32 - 38,Canadian,Male,2,3,2,-2,2,-2,1,0,1,3,-2,-3,2,0,3,-3,-2,-3,-3,-3,2,3,2,-2,1,2,-2,0,3,-1,3,4,-2,-3,3,0,3,1,-3,-3,-3,-3,-3,5,3,3,2,-2,2,3,-1,-3,3,0,3,2,-2,-3,3,0,3,1,0,1,0,0,0,5,FALSE,1,100,TRUE,1,86,TRUE,0,90,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,75,TRUE,1,90,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,60,FALSE,1,100,FALSE,1,100,FALSE,0,70,FALSE,0,75,TRUE,1,70,0.0625,0.0025,0,0.25,0.09,0,0,0,0,0.01,0.49,0.25,0.01,0.25,0,0.0196,0,0.25,0,0,0,0.04,0.09,0,0,0.36,0.5625,0,0.81,0,0,0.25,0.124360714,0.097828571,0.150892857,24,75,27,84.38,6,75,7,87.5,8,100,6,75,13,81.25,14,87.5,84.41,70.12,90,91.88,85.62,83.19,85.62,-9.38,0.03,-4.88,2.5,-8.12,10.62,1.94,-1.88,0,0,0,0,1,0,1,3,2,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,4,3,1,0,0,0,1,0,0,3,3,3,3,3,0.2,1.2,0.2,0.2,0.2,1.8,0.2,3,0.45,1.3,2.33,2,-1,2,0,0,0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,33,1.25,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-1,0,0,0,1,-1,-3,0,1,0,0,0,0,0,0,-3,-2,-3,-3,-3,0,-0.6,0,-2.8,-0.85 +694,R_77cXVuCUiJzau8Z,39 - 45,Canadian,Male,-1,2,3,1,3,1,-3,3,-3,0,1,0,2,1,3,-1,-1,0,1,0,0,2,2,1,3,7,1,-3,2,-2,2,7,1,-1,2,1,2,5,1,1,1,1,0,7,-2,2,2,3,3,7,0,2,0,1,-1,7,1,1,2,2,3,7,-1,0,0,0,-2,7,FALSE,1,91,FALSE,0,52,TRUE,0,87,FALSE,1,54,TRUE,1,97,FALSE,1,51,TRUE,1,98,TRUE,1,56,TRUE,1,53,TRUE,1,99,FALSE,1,51,TRUE,0,96,TRUE,1,99,FALSE,1,52,TRUE,1,50,TRUE,1,100,FALSE,1,51,TRUE,0,53,TRUE,0,83,FALSE,1,55,TRUE,1,53,TRUE,1,100,TRUE,0,75,TRUE,1,96,FALSE,1,91,TRUE,1,51,FALSE,1,51,TRUE,0,50,TRUE,0,79,TRUE,1,71,FALSE,0,50,TRUE,1,74,0.1936,0.2401,0,0.0004,0.0676,0.2401,0.0016,0.0001,0.2025,0,0.0841,0.0001,0.2209,0.2401,0.0009,0.2704,0.5625,0.2116,0.25,0.0081,0.2209,0.25,0.6889,0.2304,0.2401,0.2401,0.25,0.0081,0.7569,0.2809,0.6241,0.9216,0.252592857,0.150178571,0.355007143,24,75,23,71.88,5,62.5,6,75,7,87.5,5,62.5,14,87.5,9,56.25,70.91,55.5,72.38,79.38,76.38,74.94,66.88,3.12,-0.97,-7,-2.62,-8.12,13.88,-12.56,10.63,1,0,1,0,0,0,0,1,1,2,0,1,0,0,1,2,2,1,0,0,1,0,1,2,0,1,5,3,4,1,0,1,0,1,0,0,1,0,1,2,0.4,0.8,0.4,1,0.8,2.8,0.4,0.8,0.65,1.2,6.33,7,0,0,-2,0,-0.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,42,0.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,0,-2,0,-1,-5,-2,-3,1,0,0,0,-1,1,2,1,1,-1,-2,-0.4,-2,0,0.2,-0.55 +695,R_1uZoR76C6abtr4B,32 - 38,Canadian,Prefer not to say,0,2,1,0,-1,-2,1,-1,2,-1,1,-3,3,-1,2,-2,-1,-1,-3,-1,-1,3,3,1,-1,4,-1,2,-1,2,0,5,1,-3,3,-2,2,2,0,-1,-2,-2,-2,5,1,3,0,0,-1,7,-1,2,-1,1,0,6,1,-3,3,-2,3,1,-1,-1,-1,0,-1,3,TRUE,0,93,FALSE,0,70,FALSE,1,100,TRUE,0,60,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,70,FALSE,1,60,TRUE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,59,FALSE,0,55,TRUE,0,70,FALSE,1,100,FALSE,1,56,FALSE,1,53,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,88,FALSE,1,100,TRUE,1,93,FALSE,1,51,FALSE,1,57,FALSE,1,95,TRUE,1,80,FALSE,0,62,TRUE,1,90,0,0.0049,0.3025,0,0.01,0,0.0144,0.09,0.2209,0,0.04,0.01,0.01,0.16,0.0025,0.49,0,0.36,0.1849,0,0.0576,0.1681,0.1936,0,0.49,0.2401,0.3844,0.8649,0,0,0.0025,1,0.178353571,0.100557143,0.25615,17,53.13,25,78.13,5,62.5,7,87.5,7,87.5,6,75,13,81.25,12,75,81.66,63.5,89.5,94.5,79.12,82.38,80.94,-25,3.53,1,2,7,4.12,1.13,5.94,1,1,2,1,0,1,1,0,0,1,0,0,0,1,0,2,0,1,1,1,1,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,3,0,1,0.6,0.2,1,0.6,0.8,0.4,0.8,0.7,0.65,3.67,4.67,-3,-1,1,2,-1,10 cents,5 minutes,47 days,Prefer not to say,University - Undergraduate,35,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,1,1,0,0,0,0,-1,0,0,0,0,0,-1,1,0,1,-2,1,0.4,-0.2,-0.2,0.2,0.05 +696,R_59nVyrToJ79uzG8,32 - 38,Canadian,Male,1,2,0,0,1,0,-1,0,0,0,0,0,0,0,0,-1,-1,0,0,-1,2,2,2,2,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,2,3,2,2,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,3,FALSE,1,100,TRUE,1,95,FALSE,1,75,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,95,TRUE,1,50,TRUE,1,95,TRUE,0,50,TRUE,0,95,TRUE,1,75,TRUE,0,95,TRUE,1,70,TRUE,1,75,TRUE,0,50,TRUE,0,75,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,FALSE,1,95,TRUE,1,50,TRUE,0,50,FALSE,1,75,TRUE,0,95,TRUE,1,95,FALSE,0,90,TRUE,1,85,0.0025,0.25,0.0625,0.0025,0.0225,0,0.25,0.0025,0.25,0.25,0.0025,0.0625,0.25,0.25,0,0.0025,0,0.25,0.0625,0.0025,0.25,0.09,0.25,0.9025,0.25,0.25,0.81,0,0.0625,0.5625,0.9025,0.9025,0.246071429,0.11375,0.378392857,20,62.5,21,65.63,3,37.5,5,62.5,6,75,7,87.5,14,87.5,7,43.75,75.78,63.12,81.88,81.88,76.25,76.25,75.31,-3.13,10.15,25.62,19.38,6.88,-11.25,-11.25,31.56,1,0,2,2,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,2,2,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1.2,0.2,0,0.6,1.4,0.2,0,0.6,0.5,0.55,5,5,0,0,0,2,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),33,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.2,0,0,0,-0.05 +697,R_7gXzr1kaUlmsUSt,46 - 52,American,Male,2,2,2,1,1,-1,1,1,-1,1,1,1,2,1,1,-1,-1,-1,1,-1,2,2,2,1,2,1,-1,0,1,-1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,2,2,2,2,1,0,-2,1,0,1,0,6,1,1,1,1,1,1,-2,-2,-2,-2,2,9,FALSE,1,100,TRUE,1,83,TRUE,0,84,FALSE,1,59,TRUE,1,80,FALSE,1,77,TRUE,1,91,TRUE,1,91,TRUE,1,91,FALSE,0,100,FALSE,1,87,TRUE,0,93,TRUE,1,100,FALSE,1,74,TRUE,1,83,TRUE,1,100,FALSE,1,96,FALSE,1,100,FALSE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,88,TRUE,1,100,FALSE,1,76,FALSE,1,100,TRUE,0,94,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.0081,0,0,0.0081,0,0.0529,0,1,0,0,0,0,0.0081,0.0169,0.04,0.0289,0,0.1681,0,0.7744,0,0.0289,0.0196,0.0676,0.0016,0.0576,0.01,0,0.7056,0,0.8836,0.8649,0.168882143,0.093921429,0.243842857,27,84.38,27,84.38,8,100,7,87.5,6,75,6,75,15,93.75,12,75,91.34,81.88,93.38,94.12,96,94.31,88.38,0,6.96,-18.12,5.88,19.12,21,0.56,13.38,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,2,2,2,0,2,0,0,0,1,0,1,0,1,2,1,0,0,1,0,0,1,1,1,3,3,0.2,0.4,0.2,1.6,0.2,1,0.2,1.8,0.6,0.8,0.67,2.33,1,-5,-1,-9,-1.66,10 cents,100 minutes,24 days,Male,Trade School (non-military),51,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,1,-1,1,-1,-2,0,0,0,0,0,0,1,1,1,-3,-1,0,-0.6,0,-0.2,-0.2 +698,R_5IXegawSCFWVBBL,53 - 59,American,Male,-1,2,3,0,1,2,-2,-2,-2,2,1,0,2,0,1,2,2,2,2,1,0,2,2,0,1,7,1,0,1,-1,2,7,1,0,1,1,0,4,1,1,1,1,1,6,-1,2,2,1,1,5,1,-1,0,-1,1,5,1,-1,1,0,1,5,1,1,1,1,1,5,TRUE,0,100,TRUE,1,100,TRUE,0,54,TRUE,0,50,TRUE,1,52,FALSE,1,58,TRUE,1,100,TRUE,1,100,TRUE,1,57,TRUE,1,57,FALSE,1,100,TRUE,0,68,FALSE,0,100,TRUE,0,79,TRUE,1,58,TRUE,1,100,TRUE,0,58,TRUE,0,100,TRUE,0,54,FALSE,1,100,FALSE,0,57,TRUE,1,50,TRUE,0,54,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.1764,0.25,0.1849,0,0.25,0,1,0.1849,0,0.2304,0,0.2916,0.25,0,0,0.3249,0.1764,0.2916,0.6241,0.3364,0.7396,0,1,0.2916,1,1,0.4624,0.323757143,0.2013,0.446214286,21,65.63,19,59.38,5,62.5,3,37.5,5,62.5,6,75,14,87.5,5,31.25,79.44,75.62,72.38,85.75,84,80.06,78.81,6.25,20.06,13.12,34.88,23.25,9,-7.44,47.56,1,0,1,0,0,1,2,3,1,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,1,1,2,1,1,0,1,1,0,0,1,1,1,1,0,0.4,1.4,0.6,0.8,0.4,1.2,0.4,0.8,0.8,0.7,6,5,2,2,-1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,57,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,1,0,0,-1,0,0,1,1,0,-1,0,-1,0,1,1,0,0,0,0,0,0,0.2,0.2,0,0.1 +699,R_3ozIW9Bv45r1Lyh,32 - 38,Canadian,Male,-1,2,1,0,3,-1,0,2,1,1,1,1,1,0,1,1,1,1,1,-1,-2,1,1,0,2,5,-1,1,1,0,2,4,0,-1,2,2,0,7,0,0,0,-1,1,6,0,3,2,1,2,2,0,1,1,1,0,3,1,1,1,0,1,2,1,1,1,2,0,3,FALSE,1,64,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,75,FALSE,1,54,FALSE,1,73,FALSE,1,81,FALSE,1,50,FALSE,0,86,TRUE,1,75,FALSE,1,50,TRUE,1,68,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,68,FALSE,0,50,FALSE,0,50,0.25,0.25,0.0625,0.25,0.25,0.25,0.1024,0.1225,0.25,0.0625,0.1024,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.7396,0.25,0.0361,0.25,0.2116,0.25,0.25,0.1296,0.25,0.0729,0.25,0.25,0.218557143,0.191414286,0.2457,3,9.38,22,68.75,4,50,5,62.5,6,75,7,87.5,6,37.5,16,100,57.47,53.88,58.75,59.62,57.62,60.44,54.5,-59.37,-11.28,3.88,-3.75,-15.38,-29.88,22.94,-45.5,1,1,0,0,1,0,1,1,1,1,1,2,1,2,1,1,1,1,2,2,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,1,1,0.6,0.8,1.4,1.4,1,0.8,0,0.4,1.05,0.55,5.33,2.33,3,1,5,3,3,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,-1,-1,0,-1,0,0,1,0,1,2,1,2,1,1,1,1,1,1,-0.4,0,1.4,1,0.5 +700,R_6YX2sTgwzQSA3lu,53 - 59,American,Male,-2,3,3,2,2,-3,-3,3,-3,-1,3,-2,3,-3,3,-3,-3,-3,-3,-3,3,3,3,-3,3,0,-3,-3,3,-3,-3,0,3,-3,3,-3,3,0,1,1,1,1,-3,7,-3,3,3,3,-3,0,-3,-3,3,-3,-3,0,3,-3,3,-3,3,0,-3,-3,-3,-3,-3,5,TRUE,0,70,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,1,70,FALSE,0,50,TRUE,0,100,FALSE,1,100,TRUE,0,99,TRUE,0,61,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.25,0,0,0.25,0,0,0.3721,0,0,0.01,0.25,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.09,0.9801,1,1,0.25,0,0.49,1,0,1,1,0.364007143,0.188007143,0.540007143,20,62.5,18,56.25,5,62.5,3,37.5,6,75,4,50,12,75,6,37.5,80.94,71.12,80,90,82.62,85,76.88,6.25,24.69,8.62,42.5,15,32.62,10,39.38,5,0,0,5,1,0,0,0,0,2,0,1,0,0,0,4,4,4,4,0,1,0,0,1,5,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,2.2,0.4,0.2,3.2,1.4,0.4,0.2,0,1.5,0.5,0,0,0,0,0,2,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),57,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,4,0,0,4,-4,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0.8,0,0,3.2,1 +701,R_7tx5RrfukbAwIJr,46 - 52,American,Male,0,2,1,1,-3,1,0,2,0,1,3,3,3,3,3,2,2,2,2,2,-2,2,2,0,-2,0,0,0,2,0,0,0,2,2,1,2,1,0,2,2,2,2,0,0,0,0,0,0,-1,0,2,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,0,50,FALSE,0,100,FALSE,1,56,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,1,51,TRUE,0,75,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,0,100,TRUE,1,100,1,1,1,0,0,1,0.2401,0,0.25,0.25,1,0,0,0.25,0.25,0,1,1,1,0.5625,0.25,0.25,0,0.25,0.1936,0.25,1,1,1,1,0.25,1,0.473078571,0.374292857,0.571864286,13,40.63,12,37.5,4,50,4,50,2,25,2,25,7,43.75,5,31.25,82.25,81.25,75.75,84.38,87.62,84.44,80.06,3.13,44.75,31.25,25.75,59.38,62.62,40.69,48.81,2,0,1,1,1,1,0,0,0,1,1,1,2,1,2,0,0,0,0,2,0,2,1,1,2,1,0,2,0,1,1,1,1,1,3,2,2,2,2,2,1,0.4,1.4,0.4,1.2,0.8,1.4,2,0.8,1.35,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),48,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,2,-2,0,0,-1,0,0,-2,0,0,0,0,1,0,-1,-2,-2,-2,-2,0,-0.2,-0.4,0,-1.6,-0.55 +702,R_5sGDbJBH9foLL7X,39 - 45,Canadian,Male,3,3,3,3,3,0,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,2,3,3,3,0,3,5,1,-3,3,-3,3,5,3,-3,3,-3,3,5,1,1,-2,-2,2,2,3,3,3,3,3,0,0,-3,3,-3,3,0,3,-3,3,-3,3,0,3,3,3,3,-3,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,73,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,91,FALSE,1,73,TRUE,1,100,TRUE,0,50,FALSE,1,90,TRUE,0,100,TRUE,1,100,TRUE,1,73,TRUE,1,100,0,0,0,0,0,0,0.0081,0,1,0,0,0,0,1,0,0,1,1,0.01,0.0729,0,0.0729,1,1,1,0.25,0.0729,1,1,1,1,1,0.445957143,0.286292857,0.605621429,25,78.13,19,59.38,4,50,5,62.5,5,62.5,5,62.5,16,100,3,18.75,95.31,87,100,96.62,97.62,96.06,94.56,18.75,35.93,37,37.5,34.12,35.12,-3.94,75.81,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,2,2,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0.6,0.2,0,2.8,0,0,0,1,0.9,0.25,5,0,5,5,5,2,5,5 cents,5 minutes,24 days,Male,High School (or equivalent),44,2,1,1,0,0,0,1,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,2,2,5,5,-5,0.6,0.2,0,1.8,0.65 +703,R_1rpsJJpEBZlalKj,39 - 45,American,Male,3,3,3,1,3,2,2,3,-3,3,2,3,3,3,2,2,3,3,2,2,3,3,3,2,3,9,2,1,3,-3,3,10,3,2,3,2,3,10,2,3,3,2,-1,10,3,3,3,2,3,10,3,3,2,-3,2,10,3,3,3,2,2,9,2,3,2,3,2,10,TRUE,0,83,FALSE,0,50,TRUE,0,100,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,51,FALSE,1,51,FALSE,0,50,FALSE,1,51,TRUE,1,94,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,86,FALSE,1,75,TRUE,1,98,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,1,97,FALSE,1,96,FALSE,1,94,FALSE,1,97,FALSE,0,96,FALSE,0,99,TRUE,1,97,0,0.0009,0,0,0.0009,0.25,0,0.0036,0.0625,0.0025,0.9216,0.25,0,0.2401,0.25,0.25,0,1,0.0036,0.0081,0.0004,0.0036,0.0196,0.2401,0.25,0.0016,0.9801,0.6889,1,0,0.0009,0.2401,0.23815,0.2308,0.2455,28,87.5,24,75,5,62.5,6,75,7,87.5,6,75,11,68.75,13,81.25,84.22,84.5,74,88.88,89.5,88.75,79.69,12.5,9.22,22,-1,1.38,14.5,20,-1.56,0,0,0,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,0,3,0,0,0,1,0,1,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0.2,0.2,0.8,0.6,0.2,0.8,0.4,0.4,0.45,0.45,9.67,9.67,-1,0,1,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),42,1.875,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,0,-1,0,-1,0,1,0,0,1,0,0,-1,-1,3,0,-0.6,0.4,0.2,0 +704,R_1L0iPBv1CXiyvPF,53 - 59,American,Male,2,2,2,2,-2,-1,-1,1,-2,-2,1,1,1,0,1,-2,-1,-1,-1,-3,2,2,2,2,-1,3,-2,-2,1,-2,0,3,1,1,1,1,1,3,-2,-2,-2,-2,-2,3,2,2,2,2,0,3,0,-2,2,-2,0,3,2,2,2,-1,2,2,1,1,1,1,0,3,FALSE,1,81,TRUE,1,97,TRUE,0,99,TRUE,0,73,TRUE,1,71,FALSE,1,77,TRUE,1,98,TRUE,1,93,TRUE,1,91,TRUE,1,65,FALSE,1,76,FALSE,1,100,TRUE,1,90,FALSE,1,77,FALSE,0,62,TRUE,1,99,TRUE,0,90,TRUE,0,99,FALSE,1,57,FALSE,1,83,FALSE,0,62,TRUE,1,97,TRUE,0,79,TRUE,1,95,FALSE,1,95,TRUE,1,100,FALSE,1,57,FALSE,1,89,TRUE,0,89,TRUE,1,96,FALSE,0,55,TRUE,1,100,0.0049,0,0.0001,0.0004,0,0.0529,0.0025,0.1225,0.0289,0.0009,0.0016,0.01,0.0081,0.0576,0.0841,0.0009,0.6241,0.5329,0.0121,0.0025,0.3844,0.3844,0.1849,0.0529,0.81,0.1849,0.3025,0.0361,0.9801,0.9801,0.7921,0,0.236928571,0.109071429,0.364785714,25,78.13,23,71.88,5,62.5,4,50,7,87.5,7,87.5,13,81.25,10,62.5,84.12,71,82.25,89,94.25,85.69,82.56,6.25,12.24,8.5,32.25,1.5,6.75,4.44,20.06,0,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,1,1,1,1,0,0,0,0,2,1,1,1,0,2,1,1,1,1,1,3,2,2,2,3,0.2,0.8,0.2,0.8,0.4,1,1,2.4,0.5,1.2,3,2.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,-1,0,0,-1,0,0,-1,-1,-1,0,-1,-3,-1,-1,-1,-2,-0.2,-0.2,-0.8,-1.6,-0.7 +705,R_1ILfv5LW2t6taE3,32 - 38,Canadian,Male,1,2,2,2,-3,-3,-3,0,-1,0,1,2,2,0,1,-2,0,-1,-2,1,1,1,1,1,-3,7,0,0,0,0,0,6,1,1,1,1,1,6,1,0,1,0,0,7,1,3,2,1,-3,7,-3,-3,0,0,0,1,1,1,2,0,0,9,0,0,0,0,0,7,FALSE,1,95,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,91,TRUE,1,100,TRUE,0,93,TRUE,0,94,TRUE,1,91,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,90,TRUE,0,100,TRUE,1,94,TRUE,1,63,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,88,TRUE,0,57,FALSE,1,100,TRUE,0,90,TRUE,1,90,TRUE,1,90,TRUE,1,100,0.0025,0.0144,0,0,0,0,0,0,1,0.1369,0.01,0.0081,0.0081,0.8649,0,0,0.25,0.25,0,0.5625,0.0036,0.25,0.81,1,0.25,0.3249,0.01,0.0025,1,1,0.81,0.8836,0.336967857,0.180571429,0.493364286,22,68.75,20,62.5,4,50,6,75,5,62.5,5,62.5,16,100,4,25,87.38,77.62,84.38,90.12,97.38,90.75,84,6.25,24.88,27.62,9.38,27.62,34.88,-9.25,59,0,1,1,1,0,3,3,0,1,0,0,1,1,1,0,3,0,2,2,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,1,2,0,1,2,1,0.6,1.4,0.6,1.6,0.4,0.2,0.4,1.2,1.05,0.55,6.33,5.67,0,5,-3,0,0.66,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,37,0.875,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,1,0,0,3,3,0,0,0,0,0,1,1,-1,1,0,1,0,0,0.2,1.2,0.2,0.4,0.5 +706,R_1xKnFWKG19g38RR,25 - 31,Canadian,Male,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,32,100,17,53.13,4,50,5,62.5,4,50,4,50,16,100,1,6.25,100,100,100,100,100,100,100,46.87,46.87,50,37.5,50,50,0,93.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,28,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +707,R_6CUhgLMp2tRMApz,32 - 38,Canadian,Male,2,3,3,3,-2,-1,0,0,1,1,3,1,2,3,3,-2,-2,-2,-1,-3,-2,3,3,3,-2,2,-2,-2,-2,-2,-2,3,0,-3,0,0,0,2,2,3,2,2,3,3,1,3,2,3,-2,2,0,1,2,1,-2,4,3,0,2,3,3,7,-2,-2,-2,-2,-3,2,TRUE,0,81,TRUE,1,56,FALSE,1,64,TRUE,0,52,TRUE,1,52,TRUE,0,55,TRUE,1,51,TRUE,1,74,TRUE,1,54,TRUE,1,55,TRUE,0,51,TRUE,0,100,TRUE,1,100,FALSE,1,51,TRUE,1,70,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,60,FALSE,1,50,TRUE,1,100,TRUE,1,76,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,61,TRUE,0,50,TRUE,0,100,TRUE,0,71,TRUE,1,81,FALSE,0,66,TRUE,1,100,0.0676,0.1521,0,0.2401,0,0.3025,0,0.2025,0.25,0.0576,0.0361,0,0.2116,0.2601,0.2304,0.1936,0.25,0.2704,1,0,0,0.09,0.36,0.2401,0.25,0.25,0.4356,0.6561,0.1296,1,0.5041,1,0.292153571,0.161771429,0.422535714,10,31.25,19,59.38,3,37.5,4,50,6,75,6,75,15,93.75,4,25,71.28,57.38,72.25,71.88,83.62,74.75,67.81,-28.13,11.9,19.88,22.25,-3.12,8.62,-19,42.81,4,0,0,0,0,1,2,2,3,3,3,4,2,3,3,4,5,4,3,6,1,0,1,0,0,1,1,2,0,3,0,1,0,0,0,0,0,0,1,0,0.8,2.2,3,4.4,0.4,1.4,0.2,0.2,2.6,0.55,2.33,4.33,0,-1,-5,1,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,32,1.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,3,0,-1,0,0,0,1,0,3,0,3,3,2,3,3,4,5,4,2,6,0.4,0.8,2.8,4.2,2.05 +708,R_1o6n2BEn75fNXkS,53 - 59,American,Male,0,3,3,0,2,3,-2,3,-2,3,3,2,1,0,2,2,3,3,3,2,1,3,3,-3,0,7,2,0,2,-1,2,6,2,2,2,1,1,6,-1,1,1,1,-1,7,2,3,3,2,3,5,3,-3,3,-3,3,2,3,1,2,2,2,2,3,3,3,3,3,3,TRUE,0,56,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,63,FALSE,1,96,TRUE,1,91,TRUE,1,100,TRUE,1,96,FALSE,0,77,FALSE,1,96,TRUE,0,97,TRUE,1,50,TRUE,0,80,FALSE,0,54,TRUE,1,90,FALSE,1,59,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,77,FALSE,1,100,FALSE,0,71,TRUE,0,91,TRUE,1,100,FALSE,1,62,FALSE,1,70,FALSE,1,55,TRUE,1,98,FALSE,0,58,TRUE,1,99,0,0,0.01,0.0081,0.0001,0.0016,0.5041,0.5929,0,0.5929,0.0004,0.25,0.0016,0.0016,0.1369,0.25,0,0.25,0.09,0.8281,0,0.2916,0.25,0.64,0.1681,0.1444,0.3364,0.3136,1,0,0.2025,0.9409,0.278132143,0.184435714,0.371828571,23,71.88,21,65.63,5,62.5,8,100,3,37.5,5,62.5,10,62.5,11,68.75,79.25,64.5,77.75,84,90.75,79.62,78.88,6.25,13.62,2,-22.25,46.5,28.25,17.12,10.13,1,0,0,3,2,1,2,1,1,1,1,0,1,1,1,3,2,2,2,3,2,0,0,2,1,0,1,0,1,0,0,1,1,2,0,1,0,0,0,1,1.2,1.2,0.8,2.4,1,0.4,0.8,0.4,1.4,0.65,6.33,3,2,4,4,4,3.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,-1,0,0,1,1,1,1,1,0,1,1,-1,0,-1,1,2,2,2,2,2,0.2,0.8,0,2,0.75 +709,R_5M02t0GA7k6Eymg,39 - 45,Canadian,Male,3,3,3,3,3,1,0,1,-2,1,1,3,3,1,1,2,1,2,1,-2,3,3,3,3,3,2,1,1,1,1,1,6,1,1,1,1,1,7,1,1,2,2,1,3,3,3,3,3,3,5,2,0,3,0,3,5,3,3,3,3,3,8,2,2,2,2,2,5,TRUE,0,81,FALSE,0,82,FALSE,1,80,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,82,FALSE,0,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,79,TRUE,1,81,FALSE,0,100,FALSE,1,73,TRUE,0,100,FALSE,1,71,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,79,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,1,0,0,0,0,1,0,0,0,0,0.0324,0.25,0.25,0.6724,0,0.25,1,0.04,1,0.0361,0.0841,0.0441,0.0729,0.25,0,0.6561,0.04,1,0.6241,1,0.296507143,0.175342857,0.417671429,26,81.25,22,68.75,6,75,6,75,5,62.5,5,62.5,12,75,10,62.5,87.12,70.75,87.75,92.5,97.5,93.44,80.81,12.5,18.37,-4.25,12.75,30,35,18.44,18.31,0,0,0,0,0,0,1,0,3,0,0,2,2,0,0,1,0,0,1,3,0,0,0,0,0,1,0,2,2,2,2,0,0,2,2,0,1,0,1,4,0,0.8,0.8,1,0,1.4,1.2,1.2,0.65,0.95,5,6,-3,1,-1,-2,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,43,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,1,-2,1,-2,-2,2,2,-2,-2,1,-1,0,0,-1,0,-0.6,-0.4,-0.2,-0.3 +710,R_1xwnkrmdgUDTVa9,39 - 45,American,Male,3,2,3,1,3,-1,3,3,1,-1,1,-1,3,3,3,1,1,3,1,2,0,2,3,3,2,4,3,2,1,2,2,8,2,1,3,0,2,8,2,2,2,3,2,7,2,2,3,3,1,7,2,1,1,2,3,8,3,2,1,2,3,9,3,2,1,3,2,8,FALSE,1,100,TRUE,1,98,FALSE,1,100,FALSE,1,79,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,93,TRUE,1,100,FALSE,1,90,FALSE,1,84,FALSE,0,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,70,TRUE,0,89,FALSE,1,98,FALSE,0,91,TRUE,1,80,TRUE,0,86,TRUE,1,100,TRUE,0,86,FALSE,0,80,TRUE,0,100,FALSE,1,72,TRUE,0,86,FALSE,0,93,TRUE,1,82,TRUE,1,100,0,0.64,0,0,0,0,0,0,0.0004,0.04,0.8649,0.6561,0.8649,0.01,0.0025,0.0004,0.7396,0.0441,0.0784,0.7396,0.8281,0,0.7921,0,0.25,1,0.0324,0,0,0.09,0.7396,0.0256,0.278525,0.230207143,0.326842857,23,71.88,21,65.63,5,62.5,3,37.5,6,75,7,87.5,11,68.75,10,62.5,90.09,91.38,86.12,89.5,93.38,93.31,86.88,6.25,24.46,28.88,48.62,14.5,5.88,24.56,24.38,3,0,0,2,1,4,1,2,1,3,1,2,0,3,1,1,1,1,2,0,1,0,0,2,2,3,2,2,1,4,2,3,2,1,0,2,1,2,2,0,1.2,2.2,1.4,1,1,2.4,1.6,1.4,1.45,1.6,6.67,8,-3,0,-1,-1,-1.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,0.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,0,0,0,-1,1,-1,0,0,-1,-1,-1,-2,2,1,-1,0,-1,0,0,0.2,-0.2,-0.2,-0.4,-0.15 +711,R_7YzQfRm2q7nhZW9,39 - 45,Canadian,Male,3,3,3,-3,3,-2,1,2,0,1,1,-3,1,-1,3,2,2,3,3,2,3,3,3,-3,3,3,-3,1,-1,-2,2,3,2,-1,-1,-1,2,6,2,3,3,2,3,3,3,3,3,-3,3,2,-3,1,2,0,2,3,1,-3,2,-2,3,3,3,2,3,3,2,2,FALSE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,0,62,TRUE,1,99,TRUE,1,91,TRUE,1,96,FALSE,1,60,TRUE,0,89,TRUE,1,100,FALSE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,96,TRUE,0,98,TRUE,0,65,FALSE,1,100,FALSE,0,78,TRUE,1,94,FALSE,1,100,TRUE,1,93,TRUE,0,75,TRUE,1,81,TRUE,0,63,FALSE,1,54,TRUE,0,93,TRUE,1,74,FALSE,0,50,TRUE,1,95,0.0001,0.0361,0,0.3844,0.0025,0,0.0049,0.0016,0,0.0036,0.0676,0,0.0081,0.16,0,0,0,0.25,0.2116,0.5625,0.6084,0.4225,0.4225,0,0.0016,0.3969,0.25,0.0025,0,0.9604,0.8649,0.7921,0.214078571,0.035592857,0.392564286,24,75,22,68.75,4,50,6,75,5,62.5,7,87.5,12,75,10,62.5,84.88,68,95.25,87.62,88.62,86.12,83.62,6.25,16.13,18,20.25,25.12,1.12,11.12,21.12,0,0,0,0,0,1,0,3,2,1,1,2,2,0,1,0,1,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1.4,1.2,0.6,0,0.4,0.4,0.2,0.8,0.25,4,2.67,1,0,3,1,1.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),39,1.625,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,3,2,0,1,2,1,-1,1,-1,1,0,1,1,0,1,0.8,0.4,0.55 +712,R_5obSekahAU98dbX,25 - 31,Canadian,Male,2,2,-1,1,2,2,1,2,-2,1,-2,3,2,1,-2,-2,-2,-1,-2,-2,3,1,1,1,2,5,2,-1,-2,1,1,4,2,-1,1,1,1,3,2,1,1,-2,2,7,2,1,-1,1,2,2,3,-1,2,-3,-1,1,1,3,1,2,-3,0,1,1,2,2,-1,5,TRUE,0,89,TRUE,1,90,TRUE,0,100,FALSE,1,85,TRUE,1,84,FALSE,1,76,TRUE,1,100,TRUE,1,86,TRUE,1,66,TRUE,1,71,FALSE,1,80,FALSE,1,75,TRUE,1,96,FALSE,1,96,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,66,FALSE,1,88,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,85,FALSE,1,90,TRUE,1,86,TRUE,0,50,FALSE,1,91,FALSE,1,90,FALSE,0,80,FALSE,0,91,TRUE,1,80,0.0196,0.0196,0,0,0.04,0.0576,0.0225,0.0841,0.0144,0,0.64,0.0016,0.1156,0.04,0.0256,0.01,0,0.0225,0.0081,0.01,0.5625,1,0.4356,0.0016,0.25,0.25,0.8281,0.7921,1,1,0.01,0.0625,0.260157143,0.076707143,0.443607143,25,78.13,23,71.88,4,50,7,87.5,6,75,6,75,12,75,11,68.75,84.88,78.5,81.38,91.5,88.12,86.88,82.88,6.25,13,28.5,-6.12,16.5,13.12,11.88,14.13,1,1,2,0,0,0,2,4,3,0,4,4,1,0,3,4,3,2,0,4,0,1,0,0,0,1,2,0,1,2,3,0,1,1,1,3,3,3,4,1,0.8,1.8,2.4,2.6,0.2,1.2,1.2,2.8,1.9,1.35,4,1,3,3,3,2,3,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),28,-0.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,01DIR,1,0,2,0,0,-1,0,4,2,-2,1,4,0,-1,2,1,0,-1,-4,3,0.6,0.6,1.2,-0.2,0.55 +713,R_7Z0VCH5qavegU2R,25 - 31,Canadian,Male,-1,3,1,-1,2,-1,1,-2,2,1,-3,-2,3,2,2,0,-1,-2,-1,-3,-3,3,-3,-3,-2,9,-3,3,-3,3,-3,7,1,-3,-2,2,-3,8,-3,-1,-3,-2,-3,8,1,3,0,2,2,8,-2,-1,1,-1,0,4,-1,-3,2,-2,1,6,1,2,2,1,-2,7,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,54,FALSE,0,56,TRUE,0,74,TRUE,1,100,TRUE,1,91,FALSE,0,65,TRUE,1,76,TRUE,0,70,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,TRUE,0,53,TRUE,0,97,TRUE,0,86,FALSE,1,53,TRUE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,82,TRUE,0,54,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,87,TRUE,1,100,FALSE,0,52,TRUE,1,100,0.0081,0,0,0,0,0.5476,0.0324,0.0576,0.2209,0,0,0,0.4225,0.49,0.3136,0,0,0.2916,0,0.2916,0.2304,0.1681,0.7396,0,0.2809,0.2401,0.2704,1,1,0.9409,0.7569,1,0.331967857,0.169728571,0.494207143,25,78.13,18,56.25,3,37.5,4,50,5,62.5,6,75,13,81.25,5,31.25,81.62,67.12,77.75,90.88,90.75,83.31,79.94,21.88,25.37,29.62,27.75,28.38,15.75,2.06,48.69,2,0,4,2,4,2,2,1,1,4,4,1,5,0,5,3,0,1,1,0,2,0,1,3,0,1,2,3,3,1,2,1,1,4,1,1,3,4,2,1,2.4,2,3,1,1.2,2,1.8,2.2,2.1,1.8,8,6,1,3,2,1,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,28,1,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,3,-1,4,1,0,-2,-2,3,2,0,4,-4,4,2,-3,-3,-1,-1,1.2,0,1.2,-1.2,0.3 +714,R_1OTP4KVeTkcmHWa,32 - 38,Canadian,Male,2,2,3,2,0,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,1,2,1,1,2,7,2,1,1,-1,2,6,1,2,1,1,1,7,1,1,1,2,2,7,1,2,2,2,2,7,1,1,2,1,1,7,2,2,1,2,2,7,2,1,2,2,2,7,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,TRUE,1,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,TRUE,0,81,TRUE,1,77,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,78,FALSE,1,67,TRUE,1,85,TRUE,1,98,FALSE,1,100,TRUE,1,67,FALSE,1,72,TRUE,1,73,TRUE,0,78,FALSE,1,80,TRUE,0,77,TRUE,1,83,FALSE,0,83,TRUE,1,83,0.0256,0.0729,0,0,0.0289,0,0.1089,0,0.1089,0.0004,0.0289,0,0,0.09,0,0.25,0,0.25,0.04,0.0784,0.0225,0.0529,0.0484,0.6561,0,0.6084,0.6889,1,1,1,0.5929,0,0.237660714,0.061857143,0.413464286,23,71.88,24,75,5,62.5,7,87.5,5,62.5,7,87.5,15,93.75,9,56.25,85.5,73.25,93.12,90.5,85.12,86.44,84.56,-3.12,10.5,10.75,5.62,28,-2.38,-7.31,28.31,1,0,2,1,2,0,0,1,3,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,2,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1.2,0.8,0.8,0.4,0.8,0.6,0.2,0,0.8,0.4,6.67,7,0,-1,0,0,-0.33,10 cents,5 minutes,24 days,Male,University - Undergraduate,38,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,1,1,0,-1,0,1,2,-1,1,0,0,1,1,1,0,1,0,0,0.4,0.2,0.6,0.4,0.4 +715,R_7qg4gPN4iucazxe,53 - 59,American,Male,1,3,3,3,3,0,3,3,3,3,3,3,3,3,3,-3,-3,-3,-3,-3,3,3,3,3,3,1,3,3,3,3,3,4,3,3,3,3,3,1,0,0,0,0,-3,10,1,3,3,3,1,1,1,-3,3,1,2,1,3,3,3,3,3,1,3,3,3,3,-3,8,FALSE,1,68,TRUE,1,100,TRUE,0,100,FALSE,1,59,FALSE,0,61,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,91,TRUE,0,100,TRUE,1,100,FALSE,1,91,FALSE,0,76,TRUE,1,100,FALSE,1,76,TRUE,0,100,FALSE,1,92,FALSE,1,67,FALSE,0,87,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,85,TRUE,1,100,0,0,0,0,0,0.0036,0,1,0.1089,0,0,0,0,0.0081,0.3721,0,0,0.1681,0,0,0.7569,0.5776,0.0064,0.0081,0.0576,0.01,0.7225,0.1024,1,1,1,1,0.282225,0.118628571,0.445821429,25,78.13,23,71.88,6,75,5,62.5,6,75,6,75,11,68.75,12,75,91.78,86.62,89.75,94.88,95.88,94.31,89.25,6.25,19.9,11.62,27.25,19.88,20.88,25.56,14.25,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,2,1,6,0,2,1,0,0,0,0,0,6,6,6,6,0,0.4,0.6,0,2.4,0.4,2,0,4.8,0.85,1.8,2,1,0,3,0,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,0.875,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,2,0,0,0,-2,2,-6,0,-2,-1,0,0,0,0,0,-3,-3,-3,-3,0,0,-1.4,0,-2.4,-0.95 +716,R_6cjwQtHPkI4LZLd,25 - 31,Canadian,Male,1,3,2,2,3,1,3,2,2,1,2,3,2,3,1,3,1,2,2,2,1,2,1,2,2,7,1,1,1,2,2,8,1,1,3,3,2,8,1,3,2,3,2,7,1,2,3,3,1,8,2,2,1,3,1,8,1,1,2,1,3,8,3,1,2,2,1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,74,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.25,0,0.25,0,0,0.0676,0,0,0,0,0,0,0,1,0.25,0,0,0,0,1,0,1,1,0,0,1,1,1,1,0.305985714,0.111971429,0.5,27,84.38,23,71.88,6,75,5,62.5,6,75,6,75,15,93.75,8,50,94.5,93.75,93.75,93.75,96.75,96.88,92.12,12.5,22.62,18.75,31.25,18.75,21.75,3.13,42.12,0,1,1,0,1,0,2,1,0,1,1,2,1,0,1,2,2,0,1,0,0,1,1,1,2,1,1,1,1,0,1,2,0,2,2,0,0,0,0,1,0.6,0.8,1,1,1,0.8,1.4,0.2,0.85,0.85,7.67,8,-1,0,0,-1,-0.33,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,29,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-1,-1,-1,1,0,-1,1,0,0,1,-2,-1,2,2,0,1,-1,-0.4,0,-0.4,0.8,0 +717,R_65ZVP5XDElZvCWG,25 - 31,Canadian,Male,2,2,1,1,2,2,2,1,1,2,1,1,2,1,1,2,2,2,2,1,2,2,1,3,1,8,1,1,1,2,0,8,1,1,2,2,1,8,1,1,1,2,2,8,1,2,3,0,2,7,1,1,1,0,1,8,1,1,2,2,1,8,2,1,1,1,2,8,FALSE,1,90,FALSE,0,74,TRUE,0,89,FALSE,1,93,FALSE,0,81,TRUE,0,79,FALSE,0,76,TRUE,1,81,TRUE,1,83,FALSE,0,83,FALSE,1,88,FALSE,1,83,TRUE,1,86,TRUE,0,90,FALSE,0,73,TRUE,1,91,TRUE,0,85,TRUE,0,89,TRUE,0,93,FALSE,1,74,TRUE,1,78,FALSE,0,73,TRUE,0,85,FALSE,0,80,FALSE,1,84,TRUE,1,76,FALSE,1,84,TRUE,0,85,TRUE,0,67,TRUE,1,73,TRUE,1,83,FALSE,0,71,0.0361,0.0576,0.0081,0.5776,0.5041,0.6241,0.64,0.6889,0.0676,0.5329,0.0729,0.0196,0.0289,0.0144,0.6561,0.5476,0.7225,0.0049,0.7225,0.0256,0.0484,0.5329,0.8649,0.81,0.7225,0.0256,0.0289,0.01,0.7921,0.7921,0.4489,0.0289,0.392064286,0.366035714,0.418092857,16,50,15,46.88,5,62.5,2,25,3,37.5,5,62.5,8,50,7,43.75,81.88,83.88,79,82.62,82,78.88,84.88,3.12,35,21.38,54,45.12,19.5,28.88,41.13,0,0,0,2,1,1,1,0,1,2,0,0,0,1,0,1,1,1,0,1,1,0,2,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,1,0.6,1,0.2,0.8,0.8,0.8,0.2,0.8,0.65,0.65,8,7.67,1,0,0,0,0.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),27,0,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-1,0,-2,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,-1,0,-0.2,0.2,0,0,0 +718,R_5RG0avAu55kmmoV,32 - 38,Canadian,Male,2,2,2,2,3,0,-2,3,-2,2,2,-1,3,2,1,3,3,3,1,1,2,3,0,3,2,7,2,0,-1,2,3,7,-1,-3,0,-2,3,5,-2,-2,-2,-2,-2,10,3,3,3,3,3,6,0,-3,3,-3,1,5,2,0,3,2,2,5,3,3,3,3,3,5,TRUE,0,75,FALSE,0,58,TRUE,0,97,TRUE,0,56,FALSE,0,57,TRUE,0,82,TRUE,1,93,TRUE,1,98,FALSE,0,98,TRUE,1,99,FALSE,1,96,TRUE,0,100,TRUE,1,83,TRUE,0,85,TRUE,1,80,TRUE,1,92,FALSE,1,92,TRUE,0,95,TRUE,0,90,FALSE,1,92,FALSE,0,91,FALSE,0,76,FALSE,1,71,TRUE,1,72,FALSE,1,65,FALSE,0,63,FALSE,1,68,FALSE,1,76,FALSE,1,54,TRUE,1,58,TRUE,1,56,TRUE,1,91,0.0004,0.3969,0.0064,0.0049,0.0081,0.6724,0.0784,0.0001,0.0064,0.5776,0.1764,0.0289,0.9604,0.0016,0.3249,0.3364,0.0841,0.3136,0.0576,0.1225,0.8281,0.04,0.81,0.7225,0.0064,0.1024,0.1936,0.5625,0.9409,0.9025,0.2116,1,0.359639286,0.25495,0.464328571,11,34.38,18,56.25,4,50,5,62.5,3,37.5,6,75,10,62.5,8,50,79.97,75.25,77.62,81.38,85.62,79.06,80.88,-21.87,23.72,25.25,15.12,43.88,10.62,16.56,30.88,0,1,2,1,1,2,2,4,4,1,3,2,3,4,2,5,5,5,3,3,1,1,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,2,2,1,2.6,2.8,4.2,0.8,0.6,0.4,0.8,2.65,0.65,6.33,5.33,1,2,0,5,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,1,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,0,1,0,1,2,1,4,3,0,3,1,3,4,1,5,5,5,1,1,0.2,2,2.4,3.4,2 +719,R_7fek83LkP4smdCV,32 - 38,American,Male,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,7,2,2,2,2,2,8,2,2,2,1,1,9,1,2,2,2,1,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,8,TRUE,0,74,TRUE,1,75,TRUE,0,87,TRUE,0,79,TRUE,1,84,TRUE,0,76,TRUE,1,81,TRUE,1,79,TRUE,1,81,TRUE,1,80,TRUE,0,79,TRUE,0,77,TRUE,1,80,TRUE,0,77,TRUE,1,79,TRUE,1,80,TRUE,0,74,TRUE,0,81,TRUE,0,92,TRUE,0,70,TRUE,1,83,TRUE,1,75,TRUE,0,89,TRUE,1,72,TRUE,0,81,TRUE,1,78,FALSE,1,70,TRUE,0,65,FALSE,1,78,TRUE,1,71,TRUE,1,74,TRUE,1,82,0.0441,0.0484,0.04,0.0361,0.0324,0.5776,0.0784,0.04,0.49,0.0625,0.0841,0.04,0.0361,0.6241,0.0256,0.0625,0.7921,0.6241,0.4225,0.6561,0.0289,0.0441,0.8464,0.5929,0.5476,0.09,0.0676,0.5476,0.7569,0.6561,0.0484,0.5929,0.338125,0.254964286,0.421285714,19,59.38,18,56.25,5,62.5,5,62.5,4,50,4,50,16,100,2,12.5,78.22,78.62,80.75,78.38,75.12,78.38,78.06,3.13,21.97,16.12,18.25,28.38,25.12,-21.62,65.56,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.4,0,0.4,0.4,0,0,0,0,0.3,0,8,8.33,-1,0,0,0,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),34,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0.4,0,0.4,0.4,0.3 +720,R_7wlVNalzLhBlkyZ,18 - 24,American,Male,2,3,2,-2,2,1,0,1,1,1,2,1,2,-1,2,1,2,3,1,2,-2,3,2,-2,2,6,2,-2,2,-2,2,3,2,2,2,-2,2,3,2,2,2,2,2,5,2,2,2,0,2,4,2,-2,2,-2,1,5,2,1,1,-2,1,5,2,2,2,2,2,3,FALSE,1,98,FALSE,0,50,FALSE,1,94,TRUE,0,88,FALSE,0,50,FALSE,1,71,FALSE,0,50,TRUE,1,78,FALSE,0,64,TRUE,1,100,FALSE,1,100,TRUE,0,76,TRUE,1,97,TRUE,0,64,FALSE,0,70,TRUE,1,76,TRUE,0,80,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,75,FALSE,0,50,TRUE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,86,TRUE,0,83,FALSE,0,76,FALSE,0,76,TRUE,1,90,0.0484,0,0.0576,0.25,0.01,0.0841,0.01,0,0,0.25,0.5776,0.0009,0.4096,0,0.25,0.25,1,0.7744,0.7396,0,0.0625,0.49,0.25,0.4096,0.64,0.5625,0.5776,0.0004,0.0036,1,0.6889,0.5776,0.343532143,0.258328571,0.428735714,12,37.5,15,46.88,2,25,4,50,4,50,5,62.5,8,50,7,43.75,79.91,71.62,80.75,82.75,84.5,74.5,85.31,-9.38,33.03,46.62,30.75,32.75,22,24.5,41.56,4,0,0,0,0,1,2,1,3,1,0,1,0,1,0,1,0,1,1,0,0,1,0,2,0,1,2,1,3,0,0,0,1,1,1,1,0,1,1,0,0.8,1.6,0.4,0.6,0.6,1.4,0.6,0.6,0.85,0.8,4,4.67,2,-2,-2,2,-0.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),23,1.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,4,-1,0,-2,0,0,0,0,0,1,0,1,-1,0,-1,0,0,0,0,0,0.2,0.2,-0.2,0,0.05 +721,R_3U1U4COkEtoP4Kl,25 - 31,Canadian,Female,3,3,3,0,0,-2,-3,1,-2,-1,1,-3,3,0,2,0,0,0,0,0,3,3,3,0,0,5,-3,-3,0,-3,0,5,2,-3,3,0,2,5,0,0,0,0,0,5,3,3,3,0,0,5,-3,-3,1,-2,0,5,2,0,3,0,2,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,73,TRUE,0,100,FALSE,1,87,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,68,TRUE,0,90,TRUE,1,73,FALSE,1,69,TRUE,1,73,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,0,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,100,TRUE,1,82,FALSE,0,66,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0324,0.0729,0,0.4624,0,0.0729,0.5041,0.0169,1,0,0.0576,0.0729,0.5776,0.0961,1,0.49,0.4356,1,1,1,1,0.81,0.346478571,0.082971429,0.609985714,16,50,20,62.5,4,50,5,62.5,6,75,5,62.5,15,93.75,5,31.25,89.81,76.62,90,96.12,96.5,90.19,89.44,-12.5,27.31,26.62,27.5,21.12,34,-3.56,58.19,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,3,0,0,0,0,0,0,0,0,0,0.8,0.2,0,0,0.4,0.8,0,0.25,0.3,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),25,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,1,1,0,0,-3,0,0,0,0,0,0,0,0,0,0.4,-0.6,0,-0.05 +722,R_1qvUo44vR7P53GI,53 - 59,American,Male,-1,2,2,1,2,-1,-2,1,-1,1,2,2,2,0,2,-1,-2,-1,-1,-1,-2,1,1,1,1,3,-2,-2,1,-2,0,3,2,2,1,-1,1,2,-1,-1,-1,-1,0,6,-2,1,1,1,1,5,-1,-1,2,0,0,2,2,2,2,0,2,5,0,0,0,0,-1,5,TRUE,0,96,TRUE,1,97,TRUE,0,99,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,97,TRUE,1,97,TRUE,1,50,FALSE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,62,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,99,TRUE,0,50,FALSE,1,100,TRUE,1,62,TRUE,1,50,FALSE,1,97,FALSE,0,50,TRUE,0,92,TRUE,1,77,FALSE,1,50,FALSE,1,72,TRUE,0,50,TRUE,1,62,FALSE,0,50,TRUE,1,98,0.0009,0.0529,0.25,0.0009,0.0004,0,0.25,1,0,0.25,0.1444,0.25,0.25,0.25,0.25,0.0009,0.0009,0.25,0.0784,0.8464,0.1444,0.25,0.25,0.3844,0.25,0.25,0.25,0.9216,0.9801,0.0001,0.25,0.25,0.285785714,0.2069,0.364671429,17,53.13,21,65.63,4,50,7,87.5,4,50,6,75,13,81.25,8,50,70.53,55.88,69.62,84.12,72.5,68.12,72.94,-12.5,4.9,5.88,-17.88,34.12,-2.5,-13.13,22.94,1,1,1,0,1,1,0,0,1,1,0,0,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,1,1,1,0,0,0,0,0,1,2,1,1,0,0.8,0.6,0.6,0.4,0.8,0.8,0,1,0.6,0.65,2.67,4,-2,1,-3,1,-1.33,10 cents,100 minutes,15 days,Male,High School (or equivalent),59,1.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,0,0,0,0,1,1,1,-1,-1,-1,-1,1,0,-0.2,0.6,-0.6,-0.05 +723,R_7wH4KDYIOiyWbXS,32 - 38,American,Male,0,2,2,1,1,0,0,1,-1,2,0,0,1,-2,1,1,1,1,1,0,0,1,1,-2,0,8,0,0,0,0,-1,5,1,1,0,-2,1,5,0,0,0,-1,0,7,0,1,1,1,0,5,0,-1,0,-1,1,3,1,1,1,-1,0,5,1,0,1,1,0,5,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,75,FALSE,0,50,FALSE,1,50,FALSE,0,100,FALSE,0,75,FALSE,0,75,FALSE,0,100,FALSE,1,75,TRUE,0,75,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,FALSE,1,75,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,75,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.5625,0,0,1,0,0.25,0.25,1,0.25,0,0,0.0625,0.5625,0.0625,0.25,0,0.25,0.0625,0,0,1,0,0.0625,0,0.5625,0.25,0.01,0,0.25,0,0.0625,0.5625,0.205714286,0.214285714,0.197142857,24,75,23,71.88,7,87.5,5,62.5,6,75,5,62.5,9,56.25,14,87.5,81.72,80,71.88,100,75,88.44,75,3.12,9.84,-7.5,9.38,25,12.5,32.19,-12.5,0,1,1,3,1,0,0,1,1,3,1,1,1,0,0,1,1,1,2,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,1,0,0,0,1.2,1,0.6,1,0.6,0.6,0.8,0.2,0.95,0.55,6,4.33,3,2,0,2,1.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,36,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,3,0,0,-1,0,1,2,0,0,1,-1,-1,1,0,1,2,0,0.6,0.4,-0.2,0.8,0.4 +724,R_52DoAZyuOZpaNXC,46 - 52,American,Male,-1,3,0,2,0,-2,-3,1,-2,3,0,0,3,-3,3,-2,-1,-2,0,-3,-2,3,0,3,2,0,-3,-3,1,-3,3,4,-1,1,3,-3,3,1,-3,-1,-2,-2,-3,1,1,3,0,2,0,3,-3,-3,2,-3,2,2,-1,-2,3,-3,3,0,-1,0,0,-1,-3,6,FALSE,1,100,TRUE,1,84,FALSE,1,99,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,100,FALSE,0,61,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,86,FALSE,1,100,FALSE,0,100,TRUE,1,91,TRUE,0,50,FALSE,0,59,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,79,TRUE,1,100,0,0,0,0,0,0,0.3481,0,0,0.0081,0,0,0.25,0,0.25,0.0256,0.25,0.25,1,1,1,0.3721,0.7396,0,0.49,0.25,0.0441,0,0.0001,1,1,0.7225,0.321435714,0.0987,0.544171429,25,78.13,20,62.5,6,75,3,37.5,6,75,5,62.5,12,75,8,50,86.38,70,83.75,98.88,92.88,85.88,86.88,15.63,23.88,-5,46.25,23.88,30.38,10.88,36.88,1,0,0,1,2,1,0,0,1,0,1,1,0,0,0,1,0,0,2,0,2,0,0,0,0,1,0,1,1,1,1,2,0,0,0,1,1,2,1,0,0.8,0.4,0.4,0.6,0.4,0.8,0.6,1,0.55,0.7,1.67,1.67,-3,2,1,-5,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,52,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,1,2,0,0,-1,0,-1,0,-1,0,0,0,0,-1,-2,1,0,0.4,-0.4,-0.2,-0.4,-0.15 +725,R_3EGhMJk2zWyGk3T,32 - 38,American,Male,2,2,3,-2,-1,1,1,2,-2,2,1,3,2,1,0,2,2,3,1,2,2,3,3,-3,-3,10,1,1,1,1,2,5,-2,3,3,1,0,5,-1,-3,-2,-1,-1,8,2,3,3,0,-1,1,2,2,3,-1,2,1,3,3,3,2,0,2,3,3,3,3,3,1,TRUE,0,54,FALSE,0,72,TRUE,0,73,FALSE,1,85,TRUE,1,84,FALSE,1,100,TRUE,1,67,TRUE,1,73,FALSE,0,67,TRUE,1,68,TRUE,0,71,FALSE,1,79,TRUE,1,65,TRUE,0,71,FALSE,0,76,TRUE,1,60,FALSE,1,78,TRUE,0,71,FALSE,1,66,FALSE,1,100,FALSE,0,80,TRUE,1,76,TRUE,0,73,FALSE,0,73,FALSE,1,100,TRUE,1,100,FALSE,1,71,FALSE,1,80,TRUE,0,91,FALSE,0,77,FALSE,0,83,TRUE,1,100,0.0729,0,0.16,0.1089,0,0,0.5329,0.1024,0,0.0576,0.5929,0.1225,0.4489,0.5041,0.0256,0.5184,0.5329,0.0225,0.04,0,0.64,0.5776,0.1156,0.5041,0.0484,0.0841,0.6889,0.2916,0.5329,0.5041,0.8281,0.0441,0.298578571,0.247192857,0.349964286,22,68.75,18,56.25,3,37.5,5,62.5,5,62.5,5,62.5,9,56.25,9,56.25,77.62,73.88,83.88,75.88,76.88,76.31,78.94,12.5,21.37,36.38,21.38,13.38,14.38,20.06,22.69,0,1,0,1,2,0,0,1,3,0,3,0,1,0,0,3,5,5,2,3,0,1,0,2,0,1,1,1,1,0,2,0,1,1,0,1,1,0,2,1,0.8,0.8,0.8,3.6,0.6,0.8,0.8,1,1.5,0.8,6.67,1.33,9,4,3,7,5.34,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,2,-1,-1,0,2,0,1,0,0,-1,0,2,4,5,0,2,0.2,0,0,2.6,0.7 +726,R_11zHvASS8qAPqBa,32 - 38,American,Male,0,3,3,2,-3,0,1,0,0,0,1,1,0,1,0,1,1,0,0,1,0,0,0,0,0,5,0,0,0,1,-1,5,1,1,0,1,0,5,1,0,0,1,0,5,0,1,1,0,-1,5,1,0,1,0,1,5,0,1,1,0,0,5,1,1,0,0,2,5,TRUE,0,80,FALSE,0,77,TRUE,0,74,TRUE,0,76,FALSE,0,75,TRUE,0,88,TRUE,1,82,FALSE,0,77,TRUE,1,77,TRUE,1,100,FALSE,1,81,TRUE,0,80,TRUE,1,79,FALSE,1,80,FALSE,0,76,TRUE,1,76,TRUE,0,80,TRUE,0,100,FALSE,1,80,TRUE,0,50,FALSE,0,50,TRUE,1,88,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,TRUE,0,100,FALSE,1,90,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.5929,0.25,0.0576,0.0324,0,0.7744,0.25,0,0.25,0.0144,0,0.0441,0.0529,0.0361,0.5625,0.5929,0.25,0.5776,1,1,0.25,0.5776,0.04,0.04,0.64,0.25,0.25,0.64,0.5476,1,0.01,0.64,0.367503571,0.243207143,0.4918,18,56.25,13,40.63,3,37.5,3,37.5,4,50,3,37.5,9,56.25,4,25,77.06,70.88,76.5,85,75.88,75.44,78.69,15.62,36.43,33.38,39,35,38.38,19.19,53.69,0,3,3,2,3,0,1,0,1,1,0,0,0,0,0,0,1,0,1,1,0,2,2,2,2,1,1,1,0,1,1,0,1,1,0,0,0,0,0,1,2.2,0.6,0,0.6,1.6,0.8,0.6,0.2,0.85,0.8,5,5,0,0,0,0,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,33,0.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,1,1,0,1,-1,0,-1,1,0,-1,0,-1,-1,0,0,1,0,1,0,0.6,-0.2,-0.6,0.4,0.05 +727,R_31SgCoAYXD3306B,32 - 38,American,Male,3,3,3,3,3,2,-2,3,-2,2,2,2,2,2,3,0,-1,-1,-1,-1,-2,2,2,2,2,8,-2,-1,-2,2,-2,9,-2,-1,0,1,-2,9,-3,-3,-3,-3,-3,9,3,3,3,3,3,7,2,-3,3,-3,2,3,2,3,2,1,3,5,2,3,2,2,2,10,FALSE,1,100,FALSE,0,53,TRUE,0,64,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,58,TRUE,1,83,TRUE,0,60,TRUE,1,100,TRUE,0,60,TRUE,1,52,TRUE,0,50,TRUE,0,100,TRUE,0,75,TRUE,1,96,FALSE,0,72,FALSE,0,100,0,0.2304,0,0,1,0,0,0,0,0.0289,0.0016,1,0,0,0,0.2809,0.36,0,1,0.36,0.3364,1,0,0,0,0.25,0.5184,0,0.4096,0,0.5625,1,0.289582143,0.190814286,0.38835,21,65.63,19,59.38,4,50,3,37.5,7,87.5,5,62.5,10,62.5,9,56.25,88.22,84.38,86.62,86.88,95,88.38,88.06,6.25,28.84,34.38,49.12,-0.62,32.5,25.88,31.81,5,1,1,1,1,4,1,5,4,4,4,3,2,1,5,3,2,2,2,2,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,2,4,3,3,3,1.8,3.6,3,2.2,0,0.4,0.4,3,2.65,0.95,8.67,5,1,6,4,-1,3.67,5 cents,100 minutes,24 days,Male,University - Undergraduate,36,1.375,1,0,0,0,1,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,1,1,1,1,4,0,5,3,4,4,2,2,0,5,1,-2,-1,-1,-1,1.8,3.2,2.6,-0.8,1.7 +728,R_3k196ZmlVAouPwp,53 - 59,American,Male,-1,3,1,3,1,-2,-2,1,1,0,0,3,3,0,2,0,1,1,2,-1,-1,3,2,-2,0,5,-2,1,0,-1,-1,6,1,0,1,2,0,6,-1,-1,1,-2,0,5,1,2,-1,3,2,3,-1,0,1,1,-1,1,1,3,3,-2,2,1,0,2,2,1,0,2,FALSE,1,91,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,0,91,TRUE,1,100,FALSE,1,70,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,95,FALSE,1,60,FALSE,1,100,FALSE,0,65,TRUE,1,85,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,92,TRUE,0,50,FALSE,1,75,FALSE,1,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.0064,0,0.04,0,0,0.04,0,0,0.0225,0.0625,0.25,0.8281,0.09,0,0,0,0.25,0.0625,0,0.4225,0.25,0.16,1,0.25,0.25,0.25,0.0081,0.04,0.9025,0,0,0.183525,0.110221429,0.256828571,20,62.5,24,75,4,50,6,75,6,75,8,100,11,68.75,13,81.25,82.47,65.12,83.12,92.88,88.75,82.38,82.56,-12.5,7.47,15.12,8.12,17.88,-11.25,13.63,1.31,0,0,1,5,1,0,3,1,2,1,1,3,2,2,2,1,2,0,4,1,2,1,2,0,1,1,2,0,0,1,1,0,0,2,0,0,1,1,1,1,1.4,1.4,2,1.6,1.2,0.8,0.6,0.8,1.6,0.85,5.67,1.67,2,5,5,3,4,15 cents,5 minutes,36 days,Male,College Diploma/Certificate,54,1.25,0,1,0,0,0,0,0.33,0,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-2,-1,-1,5,0,-1,1,1,2,0,0,3,2,0,2,1,1,-1,3,0,0.2,0.6,1.4,0.8,0.75 +729,R_3cTHsSlgIh4LWv9,25 - 31,Canadian,Male,2,-3,1,2,-1,-2,-1,-1,1,1,1,1,3,1,3,-1,1,2,-1,-1,1,-3,2,1,-3,6,-3,1,1,1,-3,6,2,-3,1,3,3,6,-1,-1,1,-2,1,4,2,-3,-2,2,2,6,1,-2,1,-1,1,6,2,1,3,2,3,6,2,1,2,2,2,5,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,FALSE,1,87,TRUE,1,87,TRUE,0,87,FALSE,1,87,FALSE,1,87,TRUE,1,87,TRUE,1,87,FALSE,0,87,0,0.0169,0,0,0.7569,0,0.0169,0,0,0,0.0169,0,1,0,0.25,0,0,0.25,0.0169,0.0169,0,1,0,0,0,0.7569,0.0169,0.25,1,1,0.0169,1,0.263042857,0.163621429,0.362464286,24,75,23,71.88,4,50,6,75,7,87.5,6,75,12,75,11,68.75,91.66,90.5,90.5,90.5,95.12,92.81,90.5,3.12,19.78,40.5,15.5,3,20.12,17.81,21.75,1,0,1,1,2,1,2,2,0,4,1,4,2,2,0,0,2,1,1,2,0,0,3,0,3,3,1,2,2,0,1,0,0,1,0,3,0,0,3,3,1,1.8,1.8,1.2,1.2,1.6,0.4,1.8,1.45,1.25,6,6,0,0,0,-1,0,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),28,1,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,0,-2,1,-1,-2,1,0,-2,4,0,4,2,1,0,-3,2,1,-2,-1,-0.2,0.2,1.4,-0.6,0.2 +730,R_5Hod50BeirlFVba,53 - 59,American,Male,2,3,3,1,0,-3,1,-2,3,2,3,-3,2,-2,3,-1,-1,-2,-2,-3,3,3,3,3,0,3,-3,2,-3,3,-1,8,3,-3,1,-3,3,6,-3,-3,-3,-3,-3,3,3,3,3,3,0,5,-1,1,0,1,1,5,3,-3,3,-3,3,5,0,0,-2,0,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,1,0,0,0.25,0.25,1,0,0,0,0,1,1,1,0.25,0.214285714,0.017857143,0.410714286,28,87.5,26,81.25,8,100,7,87.5,6,75,5,62.5,16,100,10,62.5,93.75,81.25,100,100,93.75,96.88,90.62,6.25,12.5,-18.75,12.5,25,31.25,-3.12,28.12,1,0,0,2,0,0,1,1,0,3,0,0,1,1,0,2,2,1,1,0,1,0,0,2,0,2,0,2,2,1,0,0,1,1,0,1,1,0,2,0,0.6,1,0.4,1.2,0.6,1.4,0.4,0.8,0.8,0.8,5.67,5,-2,3,1,-2,0.67,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),55,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,-2,1,-1,-2,2,0,0,0,0,0,1,1,1,-1,0,0,-0.4,0,0.4,0 +731,R_7rP0sO1BbSPkG9A,18 - 24,Canadian,Female,3,3,3,-2,3,-3,2,-1,3,1,2,-2,0,1,1,-2,1,-1,1,-3,3,3,3,-3,3,3,-1,0,2,3,2,4,2,-3,0,3,2,8,-1,0,0,2,-1,7,3,3,3,0,3,2,0,1,2,2,2,6,3,-1,0,2,2,3,1,1,2,2,-3,8,TRUE,0,90,FALSE,0,50,FALSE,1,89,FALSE,1,50,TRUE,1,95,FALSE,1,91,TRUE,1,50,TRUE,1,92,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,FALSE,1,80,FALSE,0,50,TRUE,1,52,FALSE,1,55,TRUE,0,80,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,60,FALSE,1,60,TRUE,1,88,FALSE,1,90,TRUE,1,87,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,64,FALSE,0,50,FALSE,0,60,0.0064,0.0169,0.2304,0.25,0.36,0.0081,0.0144,0.25,0.25,0.16,0.4096,0.09,0.25,0.25,0.0025,0.25,0.16,0.25,0.25,0.01,0.25,0.25,0.25,0.04,0.2025,0.25,0.25,0.81,0.0121,0.64,0.25,0.25,0.229257143,0.193185714,0.265328571,14,43.75,22,68.75,4,50,7,87.5,6,75,5,62.5,11,68.75,11,68.75,64.16,50,66.38,73.38,66.88,63.62,64.69,-25,-4.59,0,-21.12,-1.62,4.38,-5.13,-4.06,0,0,0,1,0,2,2,3,0,1,0,1,0,2,1,1,1,1,1,2,0,0,0,2,0,3,1,3,1,1,1,1,0,1,1,3,0,3,1,0,0.2,1.6,0.8,1.2,0.4,1.8,0.8,1.4,0.95,1.1,5,3.67,1,-2,5,-1,1.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),21,1.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,-1,1,0,-1,0,-1,0,0,1,0,-2,1,-2,0,2,-0.2,-0.2,0,-0.2,-0.15 +732,R_1cRGwOJjIklBBmb,46 - 52,American,Male,-2,3,3,3,3,-2,0,1,2,1,1,3,3,2,3,1,2,3,3,0,-2,3,3,3,3,0,-1,0,1,2,2,1,1,3,3,2,3,0,3,3,3,3,2,3,-2,3,3,3,3,0,-1,0,1,1,1,1,1,3,3,2,3,0,3,3,3,3,2,2,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,55,FALSE,1,90,TRUE,1,100,FALSE,1,50,FALSE,0,70,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,54,TRUE,1,96,FALSE,1,100,FALSE,0,67,FALSE,1,56,FALSE,1,100,FALSE,1,53,TRUE,1,100,FALSE,0,100,FALSE,0,58,0,0.4489,0,0,0.3364,1,0.0016,0,0,0,0,0,0,0.2025,0,0.25,0.2916,0.25,0,0,1,0.49,1,0.25,0,0.1936,1,1,1,0.1849,0.2209,0.01,0.310053571,0.166578571,0.453528571,25,78.13,22,68.75,5,62.5,4,50,6,75,7,87.5,11,68.75,11,68.75,84.56,72.62,83.12,84.25,98.25,90.06,79.06,9.38,15.81,10.12,33.12,9.25,10.75,21.31,10.31,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,2,1,0,0,2,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,2,1,0,0,2,0,0.4,0,1,0,0.4,0,1,0.35,0.35,0.33,0.33,0,0,0,1,0,10 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),47,-0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +733,R_3NywKajIQG0QJbF,32 - 38,American,Male,1,1,1,1,2,0,0,1,0,1,1,-2,1,-1,1,1,1,1,1,2,-2,0,2,2,1,10,1,1,-1,0,0,9,-1,0,0,0,0,5,0,0,0,1,2,10,1,1,1,1,1,7,0,0,0,0,0,7,2,0,2,0,2,6,0,2,2,2,0,6,TRUE,0,100,FALSE,0,60,FALSE,1,100,FALSE,1,79,FALSE,0,79,FALSE,1,100,TRUE,1,100,TRUE,1,68,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,55,FALSE,0,54,FALSE,1,52,TRUE,0,100,TRUE,0,77,FALSE,1,100,TRUE,1,64,TRUE,1,72,TRUE,0,67,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,78,FALSE,1,51,TRUE,1,85,FALSE,0,51,TRUE,1,77,0.1024,0,0.2916,0,0.0529,0,0.25,0,0,0.0784,0.0225,0,0.04,0,0.6241,0.36,0.4489,0.0441,0.0484,0,0.1296,0.3025,0.5929,0,0.2304,0.5625,0.2601,1,0,1,0.2401,0,0.22455,0.137207143,0.311892857,16,50,21,65.63,3,37.5,6,75,6,75,6,75,10,62.5,11,68.75,80.44,72.12,73.75,96.5,79.38,74.69,86.19,-15.63,14.81,34.62,-1.25,21.5,4.38,12.19,17.44,3,1,1,1,1,1,1,2,0,1,2,2,1,1,1,1,1,1,0,0,0,0,0,0,1,0,0,1,0,1,1,2,1,1,1,1,1,1,1,2,1.4,1,1.4,0.6,0.2,0.4,1.2,1.2,1.1,0.75,8,6.67,3,2,-1,4,1.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,1.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,3,1,1,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,-1,-2,1.2,0.6,0.2,-0.6,0.35 +734,R_192GcY4ARIi5d6N,46 - 52,American,Male,0,3,2,-3,-1,-2,-2,3,-2,2,2,0,3,1,3,-2,-1,-3,-2,-3,-1,3,3,-3,-2,4,-1,-2,2,-2,2,5,3,3,3,1,3,5,-3,0,0,-3,-3,6,-1,2,2,-3,-2,5,-1,-3,3,-2,1,4,3,0,3,2,3,3,-1,0,0,0,0,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,51,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,100,FALSE,1,51,TRUE,1,96,FALSE,0,50,TRUE,1,100,1,0,0,0,0,0,0,0,0,0,0.0016,1,0,0.2209,0,0,0.25,0.2401,0,0,0,0.2601,0.25,0,0,0.2401,0.25,1,1,1,0.2401,0,0.212603571,0.122328571,0.302878571,26,81.25,25,78.13,6,75,7,87.5,6,75,6,75,12,75,13,81.25,87.59,63.25,87.62,100,99.5,93.56,81.62,3.12,9.46,-11.75,0.12,25,24.5,18.56,0.37,1,0,1,0,1,1,0,1,0,0,1,3,0,0,0,1,1,3,1,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,1,1,3,2,3,0.6,0.4,0.8,1.2,0.6,0.6,0.4,2,0.75,0.9,4.67,4,-1,1,2,1,0.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,51,1.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,-1,1,0,0,0,-1,1,0,-1,0,3,0,-1,0,0,0,0,-1,-3,0,-0.2,0.4,-0.8,-0.15 +735,R_63xcflDzFQ1r20D,25 - 31,American,Male,2,3,-1,0,2,0,0,0,0,2,0,0,0,-1,3,-3,-2,-1,-1,-3,3,3,0,1,0,7,1,2,-1,2,-1,8,-1,1,2,2,0,7,0,0,-1,-1,-1,6,3,2,1,2,3,6,1,-1,2,-1,1,6,1,0,0,-1,3,6,1,1,1,1,1,8,TRUE,0,59,TRUE,1,50,TRUE,0,67,FALSE,1,52,TRUE,1,100,FALSE,1,57,FALSE,0,54,TRUE,1,65,TRUE,1,52,FALSE,0,84,FALSE,1,52,TRUE,0,57,TRUE,1,83,FALSE,1,68,TRUE,1,71,TRUE,1,84,FALSE,1,56,TRUE,0,67,FALSE,1,68,TRUE,0,65,TRUE,1,81,TRUE,1,82,FALSE,1,100,FALSE,0,63,FALSE,1,57,FALSE,0,58,TRUE,0,64,FALSE,1,76,TRUE,0,78,TRUE,1,73,FALSE,0,55,TRUE,1,92,0.1225,0.3364,0.0256,0.2916,0.0064,0.1849,0.3969,0.7056,0.4225,0.0324,0.0729,0.0289,0.2304,0.2304,0,0.25,0,0.2304,0.0576,0.1849,0.0361,0.0841,0.1024,0.1024,0.1936,0.4096,0.3025,0.3481,0.4489,0.4489,0.6084,0.3249,0.230146429,0.199407143,0.260885714,14,43.75,20,62.5,6,75,7,87.5,3,37.5,4,50,11,68.75,9,56.25,68.44,58,80.88,66.12,68.75,71.69,65.19,-18.75,5.94,-17,-6.62,28.62,18.75,2.94,8.94,1,0,1,1,2,1,2,1,2,3,1,1,2,3,3,3,2,0,0,2,1,1,2,2,1,1,1,2,1,1,1,0,0,0,0,4,3,2,2,4,1,1.8,2,1.4,1.4,1.2,0.2,3,1.55,1.45,7.33,6,1,2,1,-2,1.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,31,1.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,-1,-1,-1,1,0,1,-1,1,2,0,1,2,3,3,-1,-1,-2,-2,-2,-0.4,0.6,1.8,-1.6,0.1 +736,R_1Yg2RfkDojgKcX1,18 - 24,Canadian,Female,3,1,1,-3,3,-2,-1,-1,-2,-1,2,-3,3,2,0,-1,-3,1,1,-2,3,2,1,-1,1,2,2,1,0,-3,-2,6,3,1,-1,-1,3,6,2,2,3,2,2,7,3,2,0,-1,3,5,1,-1,2,-2,1,6,2,-3,2,-1,2,6,1,-1,1,1,-1,7,TRUE,0,61,TRUE,1,50,FALSE,1,100,FALSE,1,53,TRUE,1,99,FALSE,1,58,TRUE,1,89,TRUE,1,100,TRUE,1,52,TRUE,1,97,FALSE,1,61,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,1,52,TRUE,1,100,TRUE,0,56,TRUE,0,100,FALSE,1,100,FALSE,1,52,TRUE,1,63,TRUE,1,98,TRUE,0,50,TRUE,1,62,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,87,TRUE,0,100,TRUE,1,89,FALSE,0,87,FALSE,0,81,0,0,0,0.0121,0.6561,0.1764,0.1444,0.0009,0.2304,0.0004,0.0121,0,0.2304,0.1521,0.0001,0.25,0.25,0.2209,0.7569,0,0.1369,0.2304,0,0.25,0.3136,0.25,0.7569,0.3721,0,1,1,0.5625,0.284053571,0.166014286,0.402092857,6,18.75,23,71.88,7,87.5,4,50,6,75,6,75,14,87.5,9,56.25,77.25,63.12,75.88,86.88,83.12,82.44,72.06,-53.13,5.37,-24.38,25.88,11.88,8.12,-5.06,15.81,0,1,0,2,2,4,2,1,1,1,1,4,4,3,3,3,5,2,1,4,0,1,1,2,0,3,0,3,0,2,0,0,1,3,2,2,2,0,0,1,1,1.8,3,3,0.8,1.6,1.2,1,2.2,1.15,4.67,5.67,-3,0,0,0,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),18,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,-1,0,2,1,2,-2,1,-1,1,4,3,0,1,1,3,2,1,3,0.2,0.2,1.8,2,1.05 +737,R_3eWO2HE3Av3N3e0,46 - 52,American,Male,3,3,2,1,3,3,1,3,2,3,2,3,2,2,3,3,2,3,3,1,-1,-1,2,-3,3,5,1,2,-1,-1,1,8,-1,2,-2,2,-2,7,0,-3,2,-1,2,6,3,2,3,2,3,6,2,3,3,1,1,6,3,0,2,1,3,6,2,2,3,1,0,9,TRUE,0,72,FALSE,0,95,TRUE,0,77,TRUE,0,78,FALSE,0,57,TRUE,0,69,TRUE,1,65,FALSE,0,51,FALSE,0,53,TRUE,1,67,FALSE,1,60,TRUE,0,54,TRUE,1,61,FALSE,1,57,TRUE,1,62,FALSE,0,100,FALSE,1,60,TRUE,0,63,FALSE,1,60,TRUE,0,63,TRUE,1,73,TRUE,1,63,FALSE,1,64,TRUE,1,100,TRUE,0,57,FALSE,0,71,TRUE,0,66,FALSE,1,100,TRUE,0,71,FALSE,0,72,TRUE,1,100,TRUE,1,79,0.2601,0.5041,1,0.1225,0.0441,0.4761,0,0.1089,0.3969,0.1369,0.5184,0.1521,0.2809,0.16,0.3249,0.9025,0.1296,0.6084,0,0.3249,0.0729,0.1444,0.16,0.1849,0.16,0.4356,0,0.5184,0.5929,0.3969,0.5041,0.2916,0.286653571,0.302835714,0.270471429,10,31.25,15,46.88,4,50,5,62.5,4,50,2,25,9,56.25,6,37.5,70,71.75,66.75,64.38,77.12,73.06,66.94,-15.63,23.12,21.75,4.25,14.38,52.12,16.81,29.44,4,4,0,4,0,2,1,4,3,2,3,1,4,0,5,3,5,1,4,1,0,1,1,1,0,1,2,0,1,2,1,3,0,1,0,1,0,0,2,1,2.4,2.4,2.6,2.8,0.6,1.2,1,0.8,2.55,0.9,6.67,6,-1,2,1,-3,0.67,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),49,0.125,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,4,3,-1,3,0,1,-1,4,2,0,2,-2,4,-1,5,2,5,1,2,0,1.8,1.2,1.6,2,1.65 +738,R_5q9yojkPnsuJB2B,32 - 38,American,Male,3,3,3,-2,-2,-3,-3,3,-3,1,-1,-2,3,-3,3,-1,-1,-1,0,-2,3,3,3,-2,-1,1,1,-3,3,-3,1,3,-1,-2,3,-3,3,2,0,1,1,0,1,6,3,3,3,-2,-1,1,0,-3,3,-3,0,1,-1,-2,3,-2,3,1,0,1,1,1,1,7,TRUE,0,96,TRUE,1,65,FALSE,1,74,TRUE,0,79,TRUE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,94,TRUE,1,94,TRUE,1,86,FALSE,1,88,FALSE,1,97,TRUE,1,88,TRUE,0,90,TRUE,1,71,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,86,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,85,TRUE,1,100,0.0036,0,0,0,0,0.04,0,0.0196,0,0,0.25,0.0144,0.0036,0.0144,0,0.1225,0,0.6241,0,0,0.25,0.0841,0.7396,0.81,0.25,1,0.0225,0.9216,0.0676,1,1,0.0009,0.258389286,0.077757143,0.439021429,24,75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,14,87.5,8,50,88.22,83.5,83.5,96.5,89.38,86.44,90,6.25,19.47,21,21,34,1.88,-1.06,40,0,0,0,0,1,4,0,0,0,0,0,0,0,0,0,1,2,2,0,3,0,0,0,0,1,3,0,0,0,1,0,0,0,1,0,1,2,2,1,3,0.2,0.8,0,1.6,0.2,0.8,0.2,1.8,0.65,0.75,2,1,0,2,1,-1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,1,0,0,0,-1,0,0,0,-1,0,0,0,0,-1,0,0,0,-0.2,-0.2,-0.1 +739,R_7JR3NaQJDhjIYbS,39 - 45,American,Male,2,3,3,1,0,2,1,3,0,0,2,1,2,3,3,-2,-1,1,3,-3,2,0,3,-2,0,8,2,-3,2,0,0,5,1,0,2,2,1,7,1,0,2,2,1,7,1,3,2,-3,0,6,2,-3,1,0,1,6,2,2,1,-2,2,7,1,-1,2,2,1,7,FALSE,1,57,FALSE,0,84,FALSE,1,64,FALSE,1,55,FALSE,0,58,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,88,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,79,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,55,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,0,83,FALSE,0,69,0,0,0,0,0.4761,1,0,0,0,0,0,0.0144,0,0.9801,0.3364,0.7056,0.1936,0.2025,1,0,1,0,0.0441,1,1,0.2025,0.6889,0.1849,0.1296,1,0.1849,1,0.405128571,0.279192857,0.531064286,11,34.38,20,62.5,5,62.5,3,37.5,6,75,6,75,11,68.75,9,56.25,87.62,81.88,78.5,94.62,95.5,92.62,82.62,-28.12,25.12,19.38,41,19.62,20.5,23.87,26.37,0,3,0,3,0,0,4,1,0,0,1,1,0,1,2,3,1,1,1,4,1,0,1,4,0,0,4,2,0,1,0,1,1,5,1,3,0,1,1,4,1.2,1,1,2,1.2,1.4,1.6,1.8,1.3,1.5,6.67,6.33,2,-1,0,0,0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,44,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,-1,3,-1,-1,0,0,0,-1,0,-1,1,0,-1,-4,1,0,1,0,0,0,0,-0.4,-0.6,0.2,-0.2 +740,R_7tjJuhM7HFKgeVb,25 - 31,American,Male,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.571428571,0.357142857,0.785714286,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,100,100,100,100,100,100,100,50,50,50,50,50,50,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),30,0,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +741,R_7u1VMhlvNjxgYrD,18 - 24,Canadian,Male,3,3,1,2,2,2,0,2,-1,2,1,0,3,1,3,0,0,0,3,-1,1,1,2,2,2,7,2,0,2,2,1,8,3,2,3,1,3,7,1,2,1,2,1,8,3,3,-2,1,3,5,1,0,3,0,3,8,2,2,1,1,3,3,3,3,3,3,1,10,TRUE,0,90,FALSE,0,81,TRUE,0,100,FALSE,1,100,TRUE,1,76,FALSE,1,80,TRUE,1,79,TRUE,1,89,TRUE,1,90,FALSE,0,68,FALSE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,74,TRUE,1,86,TRUE,1,81,TRUE,0,93,FALSE,1,89,TRUE,0,92,FALSE,1,82,FALSE,0,89,TRUE,1,89,FALSE,1,85,TRUE,1,80,FALSE,1,84,TRUE,1,85,FALSE,1,95,TRUE,0,82,TRUE,0,71,TRUE,1,78,FALSE,0,79,TRUE,1,79,0.0121,0.0225,0.0361,0.0441,0.0441,0.04,0.04,0.4624,0.0324,0.0121,0.0484,0,0.01,0.0256,0.0576,0.6561,0.0225,0,0.6724,0.0256,0.7921,0.0196,0.8464,0.5476,0.8649,0.0025,0.6241,0.81,1,0.0121,0.5041,1,0.327592857,0.103657143,0.551528571,25,78.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,12,75,8,50,85.31,88.38,84.12,82.25,86.5,83.06,87.56,15.63,22.81,25.88,21.62,19.75,24,8.06,37.56,2,2,1,0,0,0,0,0,3,1,2,2,0,0,0,1,2,1,1,2,0,0,3,1,1,1,0,1,1,1,1,2,2,0,0,3,3,3,0,2,1,0.8,0.8,1.4,1,0.8,1,2.2,1,1.25,7.33,5.33,2,0,4,-2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,24,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,2,-2,-1,-1,-1,0,-1,2,0,1,0,-2,0,0,-2,-1,-2,1,0,0,0,-0.2,-0.8,-0.25 +742,R_3zUtl7DoAFOU12F,25 - 31,Canadian,Female,3,2,2,3,2,1,2,1,2,1,2,2,1,1,3,-2,-3,-3,-1,-2,2,2,2,2,2,6,1,-1,-2,3,-1,7,1,2,2,1,2,8,-3,-3,-3,-1,-2,9,3,2,3,3,3,8,1,-1,3,-2,3,8,3,3,3,3,3,8,3,3,3,3,1,7,TRUE,0,72,TRUE,1,50,TRUE,0,100,TRUE,0,53,FALSE,0,50,FALSE,1,50,TRUE,1,55,TRUE,1,100,FALSE,0,50,TRUE,1,93,TRUE,0,50,TRUE,0,88,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,54,TRUE,0,50,TRUE,0,56,FALSE,0,53,TRUE,1,50,TRUE,0,50,TRUE,1,83,FALSE,1,97,TRUE,1,55,TRUE,0,50,TRUE,0,97,TRUE,0,54,TRUE,1,69,FALSE,0,50,TRUE,1,73,0,0.2025,0.25,0.2025,0.0729,0.25,0.0289,0.0049,0.3136,0.25,0.0961,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.9409,0.0009,0.2809,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,1,0.2116,0.2916,0.7744,0.297,0.199807143,0.394192857,16,50,15,46.88,1,12.5,4,50,6,75,4,50,11,68.75,4,25,62.56,50.38,53.75,65.75,80.38,61.31,63.81,3.12,15.68,37.88,3.75,-9.25,30.38,-7.44,38.81,1,0,0,1,0,0,3,3,1,2,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1,0,3,2,4,2,1,1,2,2,0,5,6,6,4,3,0.4,1.8,0.6,0.2,0.4,2.2,1.2,4.8,0.75,2.15,7,8,-2,-1,0,2,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,25,-1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,1,0,-1,1,-1,0,0,1,-3,0,0,-1,-1,-2,1,-4,-6,-6,-4,-3,0,-0.4,-0.6,-4.6,-1.4 +743,R_6lQW45S27ysSd3j,46 - 52,American,Male,3,3,3,1,1,2,-1,1,0,1,-1,-1,3,1,0,1,1,2,0,-2,3,3,3,-1,1,7,3,-3,3,-1,1,4,1,2,1,2,1,6,-3,-2,-3,-2,-3,9,3,3,2,2,2,4,3,-2,2,-2,1,4,1,2,3,2,1,2,2,3,3,3,-3,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,60,TRUE,1,84,FALSE,1,100,TRUE,1,89,TRUE,1,100,TRUE,1,97,TRUE,1,93,FALSE,1,100,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,62,TRUE,0,100,TRUE,0,77,FALSE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,94,FALSE,0,75,TRUE,0,91,FALSE,1,100,TRUE,0,84,FALSE,0,70,TRUE,1,89,TRUE,1,100,0,0.5625,0,0.0121,0,0,0,0.0049,0,0,0.49,0,0.0009,0,0.0256,0,0,0.16,0,0.8836,0.09,0.0009,0.5929,0,0.1444,0.8281,0.0121,0,1,1,0.7056,0.8649,0.242996429,0.048671429,0.437321429,27,84.38,23,71.88,6,75,7,87.5,5,62.5,5,62.5,14,87.5,9,56.25,91.41,88.88,87.5,93.88,95.38,91.5,91.31,12.5,19.53,13.88,0,31.38,32.88,4,35.06,0,0,0,2,0,1,2,2,1,0,2,3,2,1,1,4,3,5,2,1,0,0,1,1,1,1,1,1,2,0,2,3,0,1,1,1,2,1,3,1,0.4,1.2,1.8,3,0.6,1,1.4,1.6,1.6,1.15,5.67,3.33,3,0,4,0,2.34,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),49,0.375,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,-1,1,-1,0,1,1,-1,0,0,0,2,0,0,3,1,4,-1,0,-0.2,0.2,0.4,1.4,0.45 +744,R_7FwXOfwfi0MRCgW,25 - 31,Canadian,Male,3,0,-1,0,0,1,-2,1,-1,0,0,-3,3,-3,1,-2,-2,0,1,-2,2,2,2,-3,2,7,1,-2,1,-3,1,6,3,-3,1,-2,0,6,-2,-2,-2,-2,1,6,2,1,0,0,2,4,0,-2,2,-3,2,3,3,-3,2,-3,3,3,1,1,2,1,-3,5,TRUE,0,89,TRUE,1,93,TRUE,0,92,FALSE,1,74,TRUE,1,93,FALSE,1,94,TRUE,1,98,TRUE,1,85,TRUE,1,76,TRUE,1,84,FALSE,1,95,TRUE,0,95,FALSE,0,91,FALSE,1,65,TRUE,1,90,TRUE,1,86,FALSE,1,94,FALSE,1,83,FALSE,1,95,FALSE,1,69,TRUE,1,96,TRUE,1,78,FALSE,1,82,TRUE,1,96,FALSE,1,98,TRUE,1,91,FALSE,1,63,FALSE,1,97,FALSE,1,78,TRUE,1,84,FALSE,0,83,TRUE,1,94,0.0225,0.0081,0.0196,0.0004,0.0036,0.0036,0.0016,0.0256,0.0961,0.0484,0.0256,0.8281,0.0576,0.0025,0.0049,0.0049,0.0324,0.0676,0.0009,0.0004,0.0016,0.01,0.0025,0.1225,0.0036,0.1369,0.6889,0.7921,0.8464,0.0289,0.0484,0.9025,0.171003571,0.085892857,0.256114286,21,65.63,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,86.91,83.62,90.25,85.75,88,88.62,85.19,-18.75,2.53,-3.88,2.75,-1.75,13,1.12,3.94,1,2,3,3,2,0,0,0,2,1,3,0,2,1,1,0,0,2,3,3,1,1,1,0,2,1,0,1,2,2,3,0,1,0,2,3,3,2,0,1,2.2,0.6,1.4,1.6,1,1.2,1.2,1.8,1.45,1.3,6.33,3.33,3,3,3,1,3,10 cents,100 minutes,24 days,Male,University - Undergraduate,26,-0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,1,2,3,0,-1,0,-1,0,-1,0,0,1,1,-1,-3,-3,0,3,2,1.2,-0.6,0.2,-0.2,0.15 +745,R_73fMUnCCOSljM6A,46 - 52,American,Male,2,2,1,1,2,-2,1,0,0,1,2,0,2,0,3,-3,-3,-3,-3,-3,2,2,1,1,3,10,0,2,2,-3,2,6,1,0,1,2,1,5,1,1,1,2,0,9,0,0,0,0,1,5,-1,0,1,1,0,5,0,0,0,0,0,5,-3,-3,-2,-3,-3,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,85,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,TRUE,1,100,FALSE,1,100,TRUE,0,79,FALSE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,0,74,TRUE,1,100,FALSE,0,100,FALSE,0,100,0,0,0,0,1,0,0,0,0.0025,0,0,0,0,0,0,0,0.4096,0.7225,0.25,0,0,0.0169,0,0,0,1,1,0,1,0.6241,0.5476,1,0.270471429,0.152471429,0.388471429,27,84.38,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,14,87.5,8,50,94.81,96.5,92.25,97.38,93.12,99.19,90.44,15.63,26.06,34,29.75,9.88,30.62,11.69,40.44,0,0,0,0,1,2,1,2,3,1,1,0,1,2,2,4,4,4,5,3,2,2,1,1,1,1,1,1,1,1,2,0,2,0,3,0,0,1,0,0,0.2,1.8,1.2,4,1.4,1,1.4,0.2,1.8,1,7,5,5,1,0,5,2,5 cents,5 minutes,47 days,Male,University - PhD,48,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,-2,-2,-1,-1,0,1,0,1,2,0,-1,0,-1,2,-1,4,4,3,5,3,-1.2,0.8,-0.2,3.8,0.8 +746,R_3awXX1EJ7go8pt7,25 - 31,Canadian,Male,0,-3,-2,-2,0,-1,-1,1,-2,-3,1,-2,-1,1,-2,1,0,1,1,-1,-1,-3,1,2,0,8,-1,-2,3,-2,-2,2,-2,-2,-3,-2,-2,5,-1,-1,-1,-1,-2,3,-3,-2,0,-2,-2,5,-1,-3,0,-2,-1,3,-3,-3,-1,-1,-1,3,-1,0,-2,-2,-2,8,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,61,TRUE,1,87,FALSE,1,56,TRUE,0,100,FALSE,0,58,TRUE,0,50,TRUE,1,89,TRUE,1,57,FALSE,1,50,FALSE,1,50,TRUE,0,67,FALSE,1,100,TRUE,1,62,FALSE,0,68,TRUE,0,58,FALSE,0,57,FALSE,1,61,FALSE,0,57,FALSE,1,52,FALSE,1,89,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,0,50,0.25,0.3249,0.1849,0.25,0.25,0.25,0.3249,0.0169,0,0.4624,0.1764,0.3364,0.1521,0.1936,0.25,0.25,0.3364,0.25,0.0121,0.1521,0.1444,0.0121,0.4489,0.25,0.25,0.2304,0.25,0.25,0.25,0.25,0.25,1,0.249967857,0.232078571,0.267857143,4,12.5,18,56.25,5,62.5,4,50,4,50,5,62.5,6,37.5,12,75,60.53,59.38,53.5,59.12,70.12,59.62,61.44,-43.75,4.28,-3.12,3.5,9.12,7.62,22.12,-13.56,1,0,3,4,0,0,1,2,0,1,3,0,2,3,0,2,1,2,2,1,3,1,2,0,2,0,2,1,0,2,4,1,0,2,1,2,0,3,3,1,1.6,0.8,1.6,1.6,1.6,1,1.6,1.8,1.4,1.5,5,3.67,3,-1,2,-5,1.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,25,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,-2,-1,1,4,-2,0,-1,1,0,-1,-1,-1,2,1,-1,0,1,-1,-1,0,0,-0.2,0,-0.2,-0.1 +747,R_7oBG7d9UTEDu1Fa,18 - 24,Canadian,Female,1,3,3,2,2,-1,1,1,1,1,2,-1,2,0,2,-1,-1,1,1,-1,0,0,3,-1,1,6,-1,-1,-1,1,-1,4,2,-1,0,1,0,5,1,2,1,1,1,7,2,2,2,2,2,2,1,1,2,-1,2,4,2,-1,2,-2,2,3,2,1,2,2,0,7,FALSE,1,97,FALSE,0,59,TRUE,0,67,FALSE,1,50,TRUE,1,73,FALSE,1,99,FALSE,0,50,FALSE,0,61,FALSE,0,50,TRUE,1,54,FALSE,1,52,TRUE,0,65,FALSE,0,52,FALSE,1,60,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,0,53,FALSE,1,87,FALSE,1,50,TRUE,1,57,TRUE,1,68,FALSE,1,58,TRUE,1,60,FALSE,1,92,TRUE,1,60,FALSE,1,50,FALSE,1,83,TRUE,0,50,FALSE,0,53,FALSE,0,52,TRUE,1,59,0.3721,0.16,0.0025,0.25,0.1681,0.0001,0.16,0.2116,0.25,0.1024,0.2809,0.2704,0.25,0.2304,0.0729,0.3481,0.1764,0.25,0.0289,0.0064,0.1849,0.25,0.0169,0.16,0.25,0.25,0.2704,0.0009,0.4489,0.2809,0.25,0.4225,0.199714286,0.19795,0.201478571,6,18.75,19,59.38,4,50,5,62.5,6,75,4,50,8,50,11,68.75,63,56.25,62.25,66.75,66.75,59.56,66.44,-40.63,3.62,6.25,-0.25,-8.25,16.75,9.56,-2.31,1,3,0,3,1,0,2,2,0,2,0,0,2,1,2,2,3,0,0,2,1,1,1,0,0,2,0,1,2,1,0,0,0,2,0,3,2,1,1,1,1.6,1.2,1,1.4,0.6,1.2,0.4,1.6,1.3,0.95,5,3,4,0,2,0,2,10 cents,25 minutes,24 days,Female,High School (or equivalent),21,0.5,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,2,-1,3,1,-2,2,1,-2,1,0,0,2,-1,2,-1,1,-1,-1,1,1,0,0.6,-0.2,0.35 +748,R_1mjyLE3w9JQjVyd,46 - 52,American,Male,1,2,1,2,2,1,0,1,-1,1,1,1,2,0,2,0,0,1,1,0,0,2,1,2,2,6,1,-1,1,-1,1,5,1,1,2,0,1,5,1,0,1,1,1,6,0,2,0,2,2,5,1,-1,1,-1,1,6,1,1,1,0,2,6,0,1,1,0,0,6,TRUE,0,94,TRUE,1,86,TRUE,0,85,FALSE,1,65,TRUE,1,100,FALSE,1,86,TRUE,1,97,TRUE,1,91,TRUE,1,85,TRUE,1,86,FALSE,1,63,TRUE,0,74,FALSE,0,80,TRUE,0,86,TRUE,1,84,TRUE,1,97,TRUE,0,75,TRUE,0,87,TRUE,0,74,FALSE,1,87,TRUE,1,64,TRUE,1,89,FALSE,1,79,TRUE,1,75,FALSE,1,76,TRUE,1,82,TRUE,0,72,FALSE,1,74,TRUE,0,81,TRUE,1,81,FALSE,0,61,TRUE,1,89,0.0081,0.0324,0.0009,0.0009,0.0121,0.0196,0.0625,0.0196,0.0169,0.0121,0.0361,0.64,0.0225,0.1369,0,0.0196,0.0441,0.1225,0.0676,0.0576,0.1296,0.0256,0.5476,0.7396,0.5625,0.5184,0.3721,0.8836,0.7225,0.7569,0.6561,0.5476,0.27685,0.083178571,0.470521429,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,81.41,73.75,81.75,87.12,83,84.19,78.62,-3.13,15.78,11.25,19.25,24.62,8,-3.31,34.87,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0.2,0.2,0.2,0.4,0.4,0.2,0.2,0.4,0.25,0.3,5.33,5.67,1,-1,-1,0,-0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,49,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,0,0,0,0,0,0,0,0,-1,0,1,1,-1,0,-1,1,-0.2,0,0,0,-0.05 +749,R_5QL9v7f7GSirI4c,32 - 38,American,Male,-1,2,2,-1,1,-2,-2,2,-2,0,2,1,2,0,2,1,-1,0,1,-1,-1,2,2,-2,2,2,-1,-2,2,-2,1,1,2,2,2,-2,2,2,-1,-1,1,0,-2,5,0,2,2,-1,2,7,-2,-2,2,-2,0,3,2,2,1,-1,2,2,-1,0,-1,0,-1,1,TRUE,0,100,TRUE,1,94,TRUE,0,100,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,1,73,TRUE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,76,TRUE,1,100,FALSE,1,65,TRUE,0,100,FALSE,1,72,FALSE,1,100,TRUE,1,81,FALSE,0,86,FALSE,1,100,FALSE,0,84,TRUE,0,100,TRUE,1,92,TRUE,0,78,FALSE,1,100,TRUE,0,69,FALSE,0,76,TRUE,1,100,TRUE,1,100,0,0.0064,0,0.0729,0,0,0.7056,0,0,0.7396,0.5776,0,0.0049,0,0,0.0036,0,0.16,0,1,0.0361,0.5776,0.0784,0,0.1225,0.6084,0,1,1,1,0.4761,0,0.288942857,0.156521429,0.421364286,21,65.63,22,68.75,6,75,7,87.5,4,50,5,62.5,12,75,10,62.5,90.59,84.12,89.38,93.88,95,90.94,90.25,-3.12,21.84,9.12,1.88,43.88,32.5,15.94,27.75,0,0,0,1,1,1,0,0,0,1,0,1,0,2,0,2,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,1,1,0,2,1,1,1,0,0.4,0.4,0.6,1,0.4,0,0.6,1,0.6,0.5,1.67,4,-5,-2,0,4,-2.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,0,0,1,0,1,0,0,0,1,0,0,-1,1,0,0,-1,0,0,1,0,0.4,0,0,0.1 +750,R_1Y5HzVbWajCz5o8,18 - 24,Canadian,Female,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,7,0,1,-1,0,1,8,1,1,1,1,1,8,2,1,1,2,0,7,1,1,1,0,1,7,1,-1,1,1,0,8,1,1,1,1,0,8,3,2,1,3,2,8,FALSE,1,89,TRUE,1,68,TRUE,0,79,FALSE,1,58,FALSE,0,59,FALSE,1,58,TRUE,1,77,FALSE,0,55,TRUE,1,85,TRUE,1,70,FALSE,1,81,TRUE,0,76,TRUE,1,71,FALSE,1,63,TRUE,1,67,TRUE,1,57,FALSE,1,59,TRUE,0,59,FALSE,1,56,FALSE,1,56,TRUE,1,60,TRUE,1,62,FALSE,1,58,TRUE,1,60,FALSE,1,56,TRUE,1,64,FALSE,1,58,TRUE,0,57,FALSE,1,56,TRUE,1,65,FALSE,0,58,TRUE,1,60,0.3025,0.1296,0.1849,0.0529,0.16,0.1764,0.16,0.09,0.1936,0.1444,0.1225,0.0841,0.0225,0.0361,0.3481,0.1024,0.1764,0.1764,0.3249,0.1936,0.16,0.1089,0.1936,0.1369,0.1681,0.1764,0.3364,0.0121,0.6241,0.3481,0.1936,0.5776,0.198114286,0.14235,0.253878571,16,50,25,78.13,7,87.5,7,87.5,7,87.5,4,50,13,81.25,12,75,64.28,66.38,60.12,67.5,63.12,64.88,63.69,-28.13,-13.85,-21.12,-27.38,-20,13.12,-16.37,-11.31,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,0,2,1,0,0,0,0,1,2,0,1,2,1,0,1.2,0,1,0.2,0.6,0.2,1.2,0.55,0.55,7.67,7.67,0,0,0,-1,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),22,0.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,0,1,2,2,-1,-1,0,0,0,0,-1,-1,1,0,-1,0,-0.2,0.6,-0.2,-0.2,0 +751,R_5tDmr9134UaAzgP,18 - 24,Canadian,Female,2,3,-1,1,-1,-2,-1,-1,1,1,1,-2,2,1,1,-1,-1,0,-1,-2,3,2,2,-2,1,6,0,0,2,1,1,6,2,-2,1,3,1,4,1,1,0,1,1,7,2,3,1,-1,1,4,-1,-2,1,0,2,4,1,-2,1,0,1,3,1,1,2,2,-1,4,TRUE,0,66,TRUE,1,50,FALSE,1,88,TRUE,0,50,FALSE,0,50,FALSE,1,60,TRUE,1,50,TRUE,1,60,TRUE,1,65,TRUE,1,87,TRUE,0,60,TRUE,0,75,FALSE,0,70,FALSE,1,81,TRUE,1,50,TRUE,1,50,FALSE,1,56,TRUE,0,80,FALSE,1,54,FALSE,1,53,TRUE,1,65,TRUE,1,95,FALSE,1,87,TRUE,1,82,FALSE,1,96,TRUE,1,70,TRUE,0,50,FALSE,1,96,TRUE,0,81,TRUE,1,65,FALSE,0,71,TRUE,1,70,0.16,0.09,0.25,0.25,0.09,0.16,0.0324,0.0169,0.2209,0.0025,0.1225,0.49,0.1225,0.36,0.25,0.25,0.0169,0.25,0.0016,0.0016,0.1225,0.25,0.2116,0.0361,0.1936,0.25,0.5041,0.4356,0.0144,0.64,0.6561,0.5625,0.223725,0.170328571,0.277121429,16,50,22,68.75,4,50,5,62.5,6,75,7,87.5,13,81.25,9,56.25,68.22,56.25,67.38,78.12,71.12,65.62,70.81,-18.75,-0.53,6.25,4.88,3.12,-16.38,-15.63,14.56,1,1,3,3,2,2,1,3,0,0,1,0,1,2,0,2,2,0,2,3,0,0,2,2,2,1,1,2,1,1,0,0,1,1,0,2,2,2,3,1,2,1.2,0.8,1.8,1.2,1.2,0.4,2,1.45,1.2,5.33,3.67,2,2,1,3,1.66,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,1.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,1,1,1,1,0,1,0,1,-1,-1,1,0,0,1,0,0,0,-2,-1,2,0.8,0,0.4,-0.2,0.25 +752,R_5WnDdxhOf2TFPpf,39 - 45,American,Male,3,3,3,3,1,3,1,2,1,3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,10,2,3,1,3,2,10,3,3,3,3,3,10,2,2,1,2,2,9,2,2,2,2,2,8,3,1,3,2,2,9,3,3,3,3,3,9,3,3,3,3,3,10,TRUE,0,88,TRUE,1,84,TRUE,0,100,FALSE,1,70,TRUE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,77,TRUE,1,97,TRUE,1,95,FALSE,1,76,TRUE,0,97,TRUE,1,92,TRUE,0,76,TRUE,1,100,FALSE,0,88,TRUE,0,80,TRUE,0,100,FALSE,1,90,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,97,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,0,91,TRUE,1,100,FALSE,0,92,TRUE,1,100,0.0529,0,0.7744,0,0,0,0,0.0025,0,1,0,0.0064,0.0009,0.0576,0.0529,0.0256,0,0.09,1,0.9409,1,0,0.01,0.5776,0.64,0.04,0.8464,0.7744,1,1,0.8281,0.9409,0.386935714,0.088278571,0.685592857,24,75,19,59.38,7,87.5,5,62.5,3,37.5,4,50,12,75,7,43.75,92.09,86.12,92.5,94.5,95.25,93.88,90.31,15.62,32.71,-1.38,30,57,45.25,18.88,46.56,1,1,1,1,1,1,2,1,2,1,0,0,0,1,1,1,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,1,1,1,1,1.4,0.4,0.4,1,0.6,0.4,0.8,0.8,0.7,10,8.67,2,1,1,-1,1.33,10 cents,75 minutes,36 days,Male,University - Undergraduate,43,0.375,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,0,1,2,0,1,0,0,0,0,0,0,1,-1,0,-1,-1,0,0.8,0,-0.4,0.1 +753,R_5oFdNv3wDUJVbDH,25 - 31,Canadian,Female,1,1,1,1,2,0,0,0,-1,1,0,1,0,-1,1,-1,0,0,0,-1,0,1,0,1,2,5,1,-1,0,0,1,5,-1,0,0,-1,-1,5,0,1,0,1,0,5,1,1,0,1,2,5,1,-1,0,0,1,5,0,1,0,-1,0,5,0,1,1,1,0,5,FALSE,1,81,TRUE,1,75,FALSE,1,79,TRUE,0,57,TRUE,1,73,FALSE,1,71,FALSE,0,57,TRUE,1,75,TRUE,1,57,TRUE,1,55,FALSE,1,59,TRUE,0,51,FALSE,0,73,FALSE,1,77,FALSE,0,53,TRUE,1,57,FALSE,1,53,FALSE,1,51,TRUE,0,54,TRUE,0,61,TRUE,1,55,TRUE,1,61,TRUE,0,53,TRUE,1,73,FALSE,1,74,TRUE,1,72,TRUE,0,55,TRUE,0,55,TRUE,0,57,FALSE,0,57,TRUE,1,55,TRUE,1,91,0.0625,0.0784,0.1849,0.3249,0.0081,0.0841,0.0729,0.2025,0.3721,0.1521,0.3249,0.5329,0.1849,0.1681,0.0729,0.0625,0.2809,0.3249,0.3025,0.0676,0.2025,0.2809,0.2916,0.0529,0.2209,0.3025,0.2025,0.0361,0.0441,0.2401,0.3249,0.2601,0.202607143,0.203128571,0.202085714,17,53.13,20,62.5,4,50,5,62.5,7,87.5,4,50,12,75,8,50,63.34,58.12,65.75,66,63.5,64.94,61.75,-9.37,0.84,8.12,3.25,-21.5,13.5,-10.06,11.75,1,0,1,0,0,1,1,0,1,0,1,1,0,0,2,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,1,1,0.4,0.6,0.8,0.8,0.2,0.6,0.2,1,0.65,0.5,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,-1,0,0,0.2,0,0.6,-0.2,0.15 +754,R_7d0MjTxC7gmGqE1,39 - 45,American,Male,1,2,3,2,3,1,1,3,3,1,3,2,1,3,2,2,1,2,3,1,3,2,3,2,1,10,2,1,3,3,2,10,2,2,3,3,1,10,2,2,3,3,1,10,3,2,1,3,2,10,2,3,3,2,1,10,2,2,1,3,3,9,3,2,3,1,2,9,FALSE,1,100,TRUE,1,94,FALSE,1,95,TRUE,0,74,TRUE,1,97,FALSE,1,99,TRUE,1,100,TRUE,1,95,TRUE,1,94,TRUE,1,98,FALSE,1,100,TRUE,0,85,TRUE,1,95,FALSE,1,100,FALSE,0,87,TRUE,1,100,TRUE,0,89,TRUE,0,90,FALSE,1,96,FALSE,1,86,TRUE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,0,99,FALSE,1,99,FALSE,1,94,FALSE,1,96,FALSE,0,93,TRUE,1,95,TRUE,1,91,0.0025,0.9801,0,0,0.0081,0.0001,0,0.0004,0.0196,0.0064,0.8649,0.0025,0.0036,0,0.0009,0.0036,0,0.5476,0.0036,0.0016,0,0.7569,0.0016,0,0.7921,0.0001,0.0025,0,0.0025,0.81,0.0016,0.7225,0.162596429,0.104121429,0.221071429,32,100,25,78.13,6,75,7,87.5,6,75,6,75,13,81.25,12,75,94.66,92.38,95.88,96.88,93.5,95.62,93.69,21.87,16.53,17.38,8.38,21.88,18.5,14.37,18.69,2,0,0,0,2,1,0,0,0,1,1,0,2,0,1,0,1,1,0,0,2,0,2,1,1,1,2,0,1,0,1,0,0,0,1,1,1,1,2,1,0.8,0.4,0.8,0.4,1.2,0.8,0.4,1.2,0.6,0.9,10,9.67,0,0,1,1,0.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,41,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,0,-2,-1,1,0,-2,0,-1,1,0,0,2,0,0,-1,0,0,-2,-1,-0.4,-0.4,0.4,-0.8,-0.3 +755,R_30cvYfnM8L8PEKS,18 - 24,Canadian,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,FALSE,1,68,TRUE,1,89,TRUE,0,79,FALSE,1,72,FALSE,0,83,FALSE,1,92,TRUE,1,74,TRUE,1,84,TRUE,1,94,TRUE,1,82,FALSE,1,64,TRUE,0,92,TRUE,1,85,TRUE,0,85,FALSE,0,84,TRUE,1,76,TRUE,0,87,FALSE,1,85,TRUE,0,88,FALSE,1,79,TRUE,1,91,FALSE,0,74,TRUE,0,75,TRUE,1,76,FALSE,1,88,TRUE,1,96,FALSE,1,69,TRUE,0,95,TRUE,0,87,TRUE,1,95,FALSE,0,63,FALSE,0,85,0.0256,0.0016,0.0576,0.0676,0.7225,0.0064,0.0576,0.0324,0.0441,0.5476,0.0025,0.0225,0.0036,0.1296,0.6889,0.0121,0.5625,0.0784,0.9025,0.0144,0.0081,0.7056,0.7744,0.7225,0.7569,0.0961,0.3969,0.1024,0.6241,0.0225,0.7569,0.8464,0.3443,0.207907143,0.480692857,26,81.25,19,59.38,5,62.5,3,37.5,6,75,5,62.5,11,68.75,8,50,82.38,77.88,85.62,81.5,84.5,83.19,81.56,21.87,23,15.38,48.12,6.5,22,14.44,31.56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6.33,-1,0,0,-1,-0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,23,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +756,R_5hWQ8LJnGFnQkcP,18 - 24,Canadian,Female,2,3,3,3,3,0,-2,1,2,2,2,-1,3,2,3,-1,2,-1,1,-1,-3,1,3,-3,0,5,-3,1,-3,3,2,2,1,0,2,0,1,6,1,-1,2,-2,1,10,2,3,3,3,3,8,1,-2,3,-1,3,8,2,-2,3,2,3,2,2,2,2,2,0,10,FALSE,1,85,FALSE,0,50,TRUE,0,70,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,96,TRUE,1,50,TRUE,1,100,FALSE,1,60,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,65,FALSE,1,50,TRUE,0,92,TRUE,0,50,FALSE,1,50,FALSE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,0,63,FALSE,0,62,TRUE,1,50,0.0016,0.25,0.1225,0.25,0.25,0,0.25,0,0.25,0.25,0.3969,0,0.25,0.16,0.25,0.25,1,0.25,0.25,0.25,1,0.25,0.25,0,0.25,0.25,0.3844,0.0225,0.49,0.8464,0.25,0.25,0.296435714,0.254064286,0.338807143,13,40.63,19,59.38,4,50,6,75,5,62.5,4,50,11,68.75,8,50,65.41,52.75,75,72.12,61.75,64.75,66.06,-18.75,6.03,2.75,0,9.62,11.75,-4,16.06,5,2,0,6,3,3,3,4,1,0,1,1,1,2,2,2,3,3,3,2,0,0,0,0,0,1,0,2,3,1,0,1,0,0,0,3,0,3,1,1,3.2,2.2,1.4,2.6,0,1.4,0.2,1.6,2.35,0.8,4.33,6,-3,-6,4,0,-1.67,15 cents,5 minutes,15 days,Female,High School (or equivalent),18,0.625,0,1,0,0,0,0,0.33,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,5,2,0,6,3,2,3,2,-2,-1,1,0,1,2,2,-1,3,0,2,1,3.2,0.8,1.2,1,1.55 +757,R_52VDrdvaO5dhjEE,18 - 24,Canadian,Female,3,3,3,3,1,0,2,2,2,1,2,-1,3,1,1,-2,0,-1,1,0,3,3,3,3,2,1,0,-1,0,-1,3,3,2,3,2,-1,2,5,-1,2,2,0,2,7,2,3,2,3,3,1,3,2,3,-1,3,8,3,-1,3,0,2,6,3,3,3,3,2,10,FALSE,1,92,TRUE,1,75,FALSE,1,100,TRUE,0,51,TRUE,1,72,FALSE,1,100,TRUE,1,83,TRUE,1,85,TRUE,1,57,TRUE,1,62,FALSE,1,62,FALSE,1,92,FALSE,0,76,FALSE,1,54,TRUE,1,75,TRUE,1,59,FALSE,1,56,TRUE,0,65,FALSE,1,51,FALSE,1,52,TRUE,1,60,TRUE,1,52,TRUE,0,61,TRUE,1,52,FALSE,1,99,TRUE,1,90,TRUE,0,58,FALSE,1,58,FALSE,1,51,TRUE,1,100,TRUE,1,55,TRUE,1,79,0.0225,0.01,0.1681,0.0289,0.0441,0,0.2304,0.1444,0.2304,0.2304,0,0.5776,0.1849,0.1444,0.0784,0.0625,0.3721,0.2601,0.1764,0.0001,0.16,0.0625,0.2401,0.2116,0.1936,0.3364,0.2025,0.0064,0,0.4225,0.2401,0.0064,0.172082143,0.182835714,0.161328571,16,50,27,84.38,6,75,6,75,7,87.5,8,100,15,93.75,12,75,69.81,60.5,69.38,74.62,74.75,70.75,68.88,-34.38,-14.57,-14.5,-5.62,-12.88,-25.25,-23,-6.12,0,0,0,0,1,0,3,2,3,2,0,4,1,2,1,1,2,3,1,2,1,0,1,0,2,3,0,1,3,2,1,0,0,1,1,5,3,4,2,2,0.2,2,1.6,1.8,0.8,1.8,0.6,3.2,1.4,1.6,3,5,0,-5,-1,-3,-2,10 cents,25 minutes,15 days,Female,High School (or equivalent),19,0.875,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,0,-1,0,-1,-3,3,1,0,0,-1,4,1,1,0,-4,-1,-1,-1,0,-0.6,0.2,1,-1.4,-0.2 +758,R_3OeHvPqMYqgioPE,25 - 31,Canadian,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,59,FALSE,0,57,TRUE,0,58,FALSE,1,57,TRUE,1,54,TRUE,0,55,FALSE,0,55,FALSE,0,54,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,71,FALSE,1,50,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,1,76,TRUE,1,70,FALSE,1,50,TRUE,1,84,FALSE,1,50,TRUE,0,63,FALSE,1,50,TRUE,1,58,TRUE,1,50,TRUE,1,76,0.2916,0.0256,0.25,0.3025,0.0576,0.3025,0.09,0.25,0.25,0.25,0.1764,0.25,0.25,0.25,0.2116,0.3249,0.0576,0.1849,0.3969,0.25,0.1764,0.25,0.25,0.25,0.25,0.25,0.25,0.1681,0.3364,0.5041,0.25,0.25,0.240621429,0.207535714,0.273707143,11,34.38,19,59.38,5,62.5,6,75,4,50,4,50,7,43.75,12,75,56.41,51.75,58.62,58.62,56.62,57.25,55.56,-25,-2.97,-10.75,-16.38,8.62,6.62,13.5,-19.44,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0,0,0.05,0,5,5,0,0,0,0,0,5 cents,100 minutes,24 days,Female,High School (or equivalent),26,0,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05 +759,R_1B3q9bSFF0Y7SCZ,18 - 24,Canadian,Female,0,3,1,3,2,-3,1,1,3,1,1,0,2,0,0,-3,-3,-3,-3,-2,0,3,3,3,0,5,1,-1,0,1,-2,8,2,3,1,3,1,5,-3,-3,-3,-3,-2,2,1,3,3,3,3,3,-2,2,2,3,2,7,0,0,1,1,1,3,2,0,1,0,0,4,TRUE,0,70,TRUE,1,50,FALSE,1,68,FALSE,1,63,TRUE,1,60,FALSE,1,63,TRUE,1,83,FALSE,0,60,FALSE,0,62,TRUE,1,70,FALSE,1,71,TRUE,0,60,TRUE,1,71,FALSE,1,64,FALSE,0,81,TRUE,1,92,FALSE,1,76,TRUE,0,67,FALSE,1,62,FALSE,1,59,TRUE,1,64,TRUE,1,64,TRUE,0,50,TRUE,1,74,FALSE,1,68,TRUE,1,66,FALSE,1,63,FALSE,1,59,FALSE,1,58,TRUE,1,67,FALSE,0,68,FALSE,0,64,0.36,0.1156,0.0064,0.0289,0.4096,0.1369,0.0676,0.09,0.1681,0.1296,0.1089,0.0841,0.3844,0.0841,0.16,0.25,0.25,0.1369,0.1681,0.1024,0.1296,0.6561,0.1444,0.1296,0.0576,0.1369,0.4624,0.49,0.1024,0.4489,0.1764,0.36,0.215178571,0.175728571,0.254628571,32,100,23,71.88,5,62.5,6,75,6,75,6,75,11,68.75,12,75,66.16,65,63.25,69,67.38,68.5,63.81,28.12,-5.72,2.5,-11.75,-6,-7.62,-0.25,-11.19,0,0,2,0,2,4,2,1,2,3,1,3,1,3,1,0,0,0,0,0,1,0,2,0,1,1,1,1,0,1,1,0,1,1,1,5,3,4,3,2,0.8,2.4,1.8,0,0.8,0.8,0.8,3.4,1.25,1.45,6,4.33,2,1,2,-2,1.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),20,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-1,0,0,0,1,3,1,0,2,2,0,3,0,2,0,-5,-3,-4,-3,-2,0,1.6,1,-3.4,-0.2 +760,R_7dfOXQgqKbzUjGY,25 - 31,Canadian,Female,1,3,2,-1,3,0,-2,2,-1,0,2,2,2,1,2,1,-2,2,2,-2,2,3,3,-2,3,7,-2,-2,2,-2,1,8,2,2,2,2,2,8,-1,0,1,1,0,0,2,1,1,1,2,4,1,0,0,1,0,4,1,0,2,1,0,5,2,1,0,0,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,FALSE,1,80,TRUE,0,80,FALSE,1,100,FALSE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,80,FALSE,1,80,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0.25,0,0,0,0,0.25,0,0,0,0,1,0.04,1,0.64,0.25,0.64,1,1,0.64,1,0,1,0.04,1,1,0.383928571,0.107142857,0.660714286,25,78.13,18,56.25,2,25,5,62.5,5,62.5,6,75,11,68.75,7,43.75,92.19,82.5,97.5,91.25,97.5,89.38,95,21.88,35.94,57.5,35,28.75,22.5,20.63,51.25,1,0,1,1,0,2,0,0,1,1,0,0,0,1,0,2,2,1,1,2,1,2,1,2,1,1,2,2,2,0,1,2,0,0,2,1,3,2,2,3,0.6,0.8,0.2,1.6,1.4,1.4,1,2.2,0.8,1.5,7.67,4.33,3,4,3,-2,3.34,10 cents,100 minutes,36 days,Female,Professional Degree (ex. JD/MD),25,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,-2,0,-1,-1,1,-2,-2,-1,1,-1,-2,0,1,-2,1,-1,-1,-1,-1,-0.8,-0.6,-0.8,-0.6,-0.7 +761,R_5lF9fKPJczQMLnL,39 - 45,American,Male,2,3,1,1,0,1,0,2,0,1,0,0,3,1,1,0,0,1,1,0,3,2,2,1,0,5,0,0,1,0,1,4,0,-1,3,0,1,2,1,1,0,0,0,4,1,3,1,2,0,3,0,0,2,0,1,2,0,-1,3,2,1,1,0,0,1,1,0,4,FALSE,1,96,FALSE,0,81,FALSE,1,95,TRUE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,94,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,88,TRUE,0,94,FALSE,0,100,FALSE,1,96,FALSE,0,87,TRUE,1,100,TRUE,0,75,TRUE,0,93,TRUE,0,80,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,90,TRUE,1,72,FALSE,1,100,TRUE,1,94,TRUE,0,73,FALSE,1,80,TRUE,0,91,FALSE,0,76,FALSE,0,52,TRUE,1,100,0,0.0036,0,0.0036,0,0,0.0784,1,0,0,0.5776,1,0,0.0144,0,0.6561,0.01,0.4624,0.04,0,0.0025,0.7569,0.64,0.0016,0.5625,0.5329,0.2704,0.0016,0.0025,0.8649,0.8281,0.8836,0.328085714,0.27135,0.384821429,28,87.5,19,59.38,2,25,5,62.5,6,75,6,75,10,62.5,9,56.25,89.69,78.62,93.88,96.62,89.62,90.69,88.69,28.12,30.31,53.62,31.38,21.62,14.62,28.19,32.44,1,1,1,0,0,1,0,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0.6,0.4,0.4,0.8,0.4,0.2,0.4,0,0.55,0.25,3.67,2,2,2,1,0,1.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,44,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,1,1,-1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0.2,0.2,0,0.8,0.3 +762,R_5Mz0tsSQPdptHFL,46 - 52,American,Male,-1,1,3,3,1,-3,1,3,2,0,1,1,2,-1,0,0,0,1,0,3,-3,1,3,-1,1,6,1,1,2,3,-1,3,3,2,2,0,1,5,-1,-3,0,-3,3,6,-1,1,3,3,2,4,2,3,3,3,-1,2,3,3,3,2,1,6,1,0,2,2,3,4,TRUE,0,100,TRUE,1,52,TRUE,0,76,TRUE,0,61,FALSE,0,63,FALSE,1,64,TRUE,1,100,TRUE,1,78,TRUE,1,63,FALSE,0,53,FALSE,1,60,TRUE,0,75,TRUE,1,64,TRUE,0,80,FALSE,0,54,TRUE,1,65,FALSE,1,65,TRUE,0,79,FALSE,1,69,FALSE,1,73,TRUE,1,75,FALSE,0,56,FALSE,1,72,TRUE,1,69,TRUE,0,75,TRUE,1,72,TRUE,0,66,TRUE,0,60,TRUE,0,65,TRUE,1,66,TRUE,1,70,TRUE,1,100,0.0484,0.0784,0.1225,0,0,0.1296,0.0961,0.2809,0.0729,0.3136,0.1156,0.1296,0.1369,0.16,0.3969,0.2304,0.0784,0.3721,0.36,0.5625,0.0625,0.2916,0.0961,0.64,0.1225,0.4356,0.09,1,0.5776,0.6241,0.4225,0.5625,0.298589286,0.1795,0.417678571,10,31.25,18,56.25,5,62.5,6,75,2,25,5,62.5,12,75,6,37.5,70,61.88,71,76.88,70.25,68.75,71.25,-25,13.75,-0.62,-4,51.88,7.75,-6.25,33.75,2,0,0,4,0,4,0,1,1,1,2,1,0,1,1,1,3,1,3,0,0,0,0,0,1,5,2,0,1,1,2,2,1,3,1,1,0,1,2,0,1.2,1.4,1,1.6,0.2,1.8,1.8,0.8,1.3,1.15,4.67,4,2,1,-1,2,0.67,10 cents,25 minutes,24 days,Male,High School (or equivalent),51,-0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,2,0,0,4,-1,-1,-2,1,0,0,0,-1,-1,-2,0,0,3,0,1,0,1,-0.4,-0.8,0.8,0.15 +763,R_6ixPXVWXRaYMHnt,39 - 45,American,Male,3,3,3,3,3,1,1,3,-2,1,1,3,3,3,3,3,3,3,3,3,3,3,2,2,3,6,1,3,3,3,3,10,3,3,3,1,1,10,3,3,2,3,2,7,3,3,3,3,3,10,2,3,3,1,3,10,2,2,3,3,2,8,3,1,2,3,-2,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.071428571,0.071428571,0.071428571,32,100,30,93.75,8,100,7,87.5,7,87.5,8,100,15,93.75,15,93.75,100,100,100,100,100,100,100,6.25,6.25,0,12.5,12.5,0,6.25,6.25,0,0,1,1,0,0,2,0,5,2,2,0,0,2,2,0,0,1,0,1,0,0,0,0,0,1,2,0,3,2,1,1,0,0,1,0,2,1,0,5,0.4,1.8,1.2,0.4,0,1.6,0.6,1.6,0.95,0.95,8.67,9.33,-4,0,2,-3,-0.66,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),39,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,1,1,0,-1,0,0,2,0,1,-1,0,2,1,0,-2,0,0,-4,0.4,0.2,0.6,-1.2,0 +764,R_32E5t5jnIUY070h,39 - 45,American,Male,3,3,3,2,3,2,2,3,2,1,3,1,3,-1,3,2,3,3,1,-2,2,3,3,2,2,10,3,3,2,1,2,9,1,-1,1,2,3,9,-1,1,1,-3,-1,9,3,3,3,-2,3,8,-1,-2,3,-3,2,8,3,3,3,-2,3,8,3,3,3,2,-1,2,FALSE,1,80,TRUE,1,97,TRUE,0,96,FALSE,1,96,FALSE,0,91,FALSE,1,89,TRUE,1,92,TRUE,1,96,FALSE,0,77,TRUE,1,91,FALSE,1,80,TRUE,0,86,FALSE,0,96,FALSE,1,93,FALSE,0,76,TRUE,1,98,FALSE,1,100,FALSE,1,100,FALSE,1,91,FALSE,1,92,TRUE,1,100,TRUE,1,70,FALSE,1,51,FALSE,0,100,FALSE,1,92,TRUE,1,93,FALSE,1,92,FALSE,1,91,FALSE,1,89,FALSE,0,100,FALSE,0,55,FALSE,0,100,0.0016,0.0049,0.0004,0.0064,1,0.0121,1,0.0081,0.0064,0.09,1,0.9216,0.5929,0.04,0.8281,0.0009,0.2401,0.0016,0.0081,0.0064,0,0.5776,0.0081,0.0049,0,0.0064,0.3025,0.04,0.9216,0,0.0121,0.7396,0.298896429,0.410128571,0.187664286,17,53.13,22,68.75,5,62.5,5,62.5,8,100,4,50,8,50,14,87.5,89.06,83,89.5,88.88,94.88,89.5,88.62,-15.62,20.31,20.5,27,-11.12,44.88,39.5,1.12,1,0,0,0,1,1,1,1,1,1,2,2,2,3,0,3,2,2,4,1,0,0,0,4,0,3,4,0,5,1,0,2,0,1,0,1,0,0,1,1,0.4,1,1.8,2.4,0.8,2.6,0.6,0.6,1.4,1.15,9.33,8,2,1,1,7,1.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,41,0.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,1,0,0,-4,1,-2,-3,1,-4,0,2,0,2,2,0,2,2,2,3,0,-0.4,-1.6,1.2,1.8,0.25 +765,R_3g2bx0A4YCg9BM7,25 - 31,Canadian,Male,-2,3,2,3,1,1,0,2,1,1,2,2,3,-1,2,-1,-1,-1,-1,0,-2,3,0,2,-1,3,-1,-1,-2,2,-1,9,-2,-2,-2,-2,-2,10,2,2,2,2,2,8,-2,3,2,3,3,4,3,3,3,-1,2,5,2,2,2,2,2,2,2,3,3,2,-2,2,TRUE,0,92,TRUE,1,68,FALSE,1,50,FALSE,1,50,TRUE,1,72,FALSE,1,89,TRUE,1,95,TRUE,1,90,FALSE,0,50,FALSE,0,50,TRUE,0,83,TRUE,0,100,TRUE,1,95,FALSE,1,50,FALSE,0,50,TRUE,1,77,FALSE,1,50,FALSE,1,50,TRUE,0,95,FALSE,1,50,FALSE,0,92,FALSE,0,50,TRUE,0,83,TRUE,1,70,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,0,95,TRUE,1,100,FALSE,0,90,FALSE,0,50,0.01,0.25,0.0529,0.0025,0.25,0.0121,0.09,0.25,0.25,0.25,0,0.0025,0.25,0.6889,0.0784,0.1024,0.6889,0.25,1,0.25,0.8464,0.25,0.9025,0.25,0.25,0.25,0.81,0.8464,0.25,0.25,0.9025,1,0.40075,0.225942857,0.575557143,16,50,17,53.13,3,37.5,4,50,4,50,6,75,8,50,9,56.25,71.44,67,78.25,60.88,79.62,71.81,71.06,-3.13,18.31,29.5,28.25,10.88,4.62,21.81,14.81,0,0,2,1,2,2,1,4,1,2,4,4,5,1,4,3,3,3,3,2,0,0,0,0,2,2,3,1,2,1,0,0,1,3,0,3,4,4,3,2,1,2,3.6,2.8,0.4,1.8,0.8,3.2,2.35,1.55,7.33,3.67,-1,4,8,6,3.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),28,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,2,1,0,0,-2,3,-1,1,4,4,4,-2,4,0,-1,-1,0,0,0.6,0.2,2.8,-0.4,0.8 +766,R_70ZQmEKkRKoUQPk,46 - 52,American,Male,3,2,2,2,2,2,2,2,2,1,2,3,2,2,2,2,1,2,2,2,3,2,2,2,1,7,-2,-2,1,-2,1,7,1,2,2,2,3,5,3,2,2,2,2,6,2,2,1,2,1,7,2,-2,1,1,1,8,2,2,1,2,2,7,2,2,2,1,2,3,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,0,100,TRUE,1,80,TRUE,0,100,TRUE,1,100,TRUE,1,90,TRUE,1,85,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,90,TRUE,0,90,TRUE,0,90,FALSE,0,95,TRUE,1,100,TRUE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.01,0,1,0,0,1,0.81,0,0.81,0,0,0,0.0225,1,0.04,0.01,1,1,1,0,0.9025,0,0.81,0.0225,1,1,1,1,1,0.81,1,1,0.579910714,0.406607143,0.753214286,16,50,14,43.75,3,37.5,3,37.5,6,75,2,25,12,75,2,12.5,96.41,95.62,96.88,96.88,96.25,95.62,97.19,6.25,52.66,58.12,59.38,21.88,71.25,20.62,84.69,0,0,0,0,1,4,4,1,4,0,1,1,0,0,1,1,1,0,0,0,1,0,1,0,1,0,4,1,1,0,0,1,1,0,0,0,1,0,1,0,0.2,2.6,0.6,0.4,0.6,1.2,0.4,0.4,0.95,0.65,6.33,7.33,0,-1,-2,3,-1,5 cents,25 minutes,47 days,Male,High School (or equivalent),49,0,1,0,1,0,0,0,0.67,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,-1,0,-1,0,0,4,0,0,3,0,1,0,-1,0,1,1,0,0,-1,0,-0.4,1.4,0.2,0,0.3 +767,R_3aXLDtWCm56JVH5,46 - 52,American,Male,1,3,1,2,2,0,-2,3,-2,3,2,0,1,0,2,3,3,3,3,2,2,3,2,2,3,9,2,-1,3,-3,3,9,2,-1,1,2,2,9,-1,1,1,0,-1,10,2,2,2,2,2,3,2,-3,2,-3,2,6,2,1,0,3,3,2,2,2,3,3,3,3,TRUE,0,96,TRUE,1,50,FALSE,1,97,FALSE,1,96,FALSE,0,50,FALSE,1,97,TRUE,1,55,TRUE,1,73,FALSE,0,50,FALSE,0,100,FALSE,1,66,TRUE,0,84,FALSE,0,74,FALSE,1,50,FALSE,0,50,TRUE,1,98,FALSE,1,50,FALSE,1,50,FALSE,1,82,FALSE,1,100,FALSE,0,50,TRUE,1,75,TRUE,0,75,TRUE,1,94,FALSE,1,97,TRUE,1,94,FALSE,1,50,FALSE,1,98,FALSE,1,97,FALSE,0,96,FALSE,0,50,FALSE,0,50,0.0729,0.0036,0.0004,0.2025,0.25,0.0009,0.0036,1,0,0.0625,0.9216,0.5476,0.25,0.1156,0.25,0.25,0.5625,0.0016,0.0004,0.0009,0.25,0.25,0.0324,0.25,0.25,0.25,0.25,0.9216,0.0009,0.25,0.0009,0.7056,0.27245,0.301135714,0.243764286,8,25,20,62.5,5,62.5,3,37.5,6,75,6,75,7,43.75,13,81.25,74.81,61.75,67.88,77.12,92.5,69.31,80.31,-37.5,12.31,-0.75,30.38,2.12,17.5,25.56,-0.94,1,0,1,0,1,2,1,0,1,0,0,1,0,2,0,4,2,2,3,3,1,1,1,0,0,2,1,1,1,1,0,1,1,3,1,1,1,0,0,1,0.6,0.8,0.6,2.8,0.6,1.2,1.2,0.6,1.2,0.9,9,3.67,6,3,7,7,5.33,10 cents,100 minutes,47 days,Male,University - Undergraduate,48,0.375,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,-1,0,0,1,0,0,-1,0,-1,0,0,-1,-1,-1,3,1,2,3,2,0,-0.4,-0.6,2.2,0.3 +768,R_79TkYrC8fTkZ9hn,39 - 45,American,Male,1,2,2,1,1,0,-1,1,-1,1,1,0,1,0,1,-1,0,0,0,-1,1,1,1,1,1,3,-1,-1,1,-1,1,3,1,0,1,0,1,3,-1,-1,0,0,0,3,1,1,1,1,1,3,0,0,1,0,1,3,1,0,2,0,1,3,0,0,0,0,0,3,TRUE,0,90,TRUE,1,97,TRUE,0,94,FALSE,1,64,TRUE,1,100,FALSE,1,87,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,98,FALSE,1,56,TRUE,0,100,TRUE,1,87,FALSE,1,56,TRUE,1,81,TRUE,1,99,FALSE,1,66,TRUE,0,93,FALSE,1,76,FALSE,1,88,FALSE,0,97,TRUE,1,83,TRUE,0,93,TRUE,1,91,TRUE,0,72,TRUE,1,90,FALSE,1,53,FALSE,1,100,FALSE,1,55,FALSE,0,64,FALSE,0,96,FALSE,0,68,0,0.01,0.0001,0,0.4624,0.0169,0.0081,0.0004,0.0144,0.0289,0.4096,0.0169,0.0064,0.1936,0,0.0009,0.8649,0.1296,0,0.5184,0.9409,0.0361,0.0576,0.1936,0.1156,0.2209,0.9216,0.81,0.8836,0.8649,0.2025,1,0.318525,0.153785714,0.483264286,25,78.13,22,68.75,7,87.5,5,62.5,5,62.5,5,62.5,12,75,10,62.5,83.94,76.88,81.62,85.25,92,90.19,77.69,9.38,15.19,-10.62,19.12,22.75,29.5,15.19,15.19,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0.4,0.2,0,0.4,0.4,0.4,0.2,0.4,0.25,0.35,3,3,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,39,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,1,-1,0,-1,0,0,0,-1,0,0,-1,1,0,0,0,0,-0.2,-0.2,0,-0.1 +769,R_6QE36qxNx5mVK4C,18 - 24,Canadian,Female,1,3,3,3,1,2,-1,3,0,2,2,3,3,-3,3,1,1,1,1,3,-1,-1,-1,-1,-1,10,-1,-1,-1,-1,-1,5,0,-3,-1,3,-2,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,6,3,0,3,-3,3,5,3,3,3,-3,3,6,3,3,3,3,3,7,TRUE,0,83,TRUE,1,96,TRUE,0,91,TRUE,0,83,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,FALSE,1,83,TRUE,0,100,TRUE,1,92,TRUE,0,90,TRUE,1,82,TRUE,1,63,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,92,TRUE,1,100,TRUE,1,82,TRUE,0,68,TRUE,1,70,FALSE,1,65,TRUE,1,100,TRUE,0,77,TRUE,0,75,TRUE,0,81,TRUE,1,100,TRUE,1,73,FALSE,0,100,0,0,0.1369,0,1,1,0.09,0.0289,0.0064,0.0324,0,0.0064,0,0.0289,0,0.0016,0.4624,0.6889,0.5625,0.1225,0,0.0324,1,0.81,1,0.5929,0.0729,0.6889,0.8281,1,0.6561,1,0.418292857,0.238992857,0.597592857,26,81.25,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,15,93.75,3,18.75,88.41,86.75,92.62,87.88,86.38,90.06,86.75,25,32.16,24.25,55.12,25.38,23.88,-3.69,68,2,4,4,4,2,3,0,4,1,3,2,6,4,6,5,4,4,4,4,6,2,0,0,0,2,1,1,0,3,1,1,0,0,0,0,2,2,2,2,0,3.2,2.2,4.6,4.4,0.8,1.2,0.2,1.6,3.6,0.95,8.33,5.67,4,0,4,3,2.66,10 cents,100 minutes,24 days,Female,University - Undergraduate,24,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,4,4,4,0,2,-1,4,-2,2,1,6,4,6,5,2,2,2,2,6,2.4,1,4.4,2.8,2.65 +770,R_3ozpWk0WXkPDv2J,25 - 31,Canadian,Female,2,2,2,2,2,0,0,1,1,0,2,1,3,2,1,0,3,2,2,-3,3,3,3,3,3,5,-1,0,-1,-2,3,7,2,3,2,1,2,4,1,-1,-1,-2,-2,8,3,3,3,3,3,3,2,2,2,-2,2,5,3,2,3,3,3,9,3,3,3,3,1,4,FALSE,1,65,TRUE,1,83,TRUE,0,100,FALSE,1,50,FALSE,0,85,TRUE,0,68,TRUE,1,89,TRUE,1,67,TRUE,1,82,TRUE,1,100,FALSE,1,64,TRUE,0,89,TRUE,1,69,TRUE,0,73,FALSE,0,68,FALSE,0,64,FALSE,1,58,TRUE,0,94,FALSE,1,71,FALSE,1,53,TRUE,1,71,FALSE,0,54,TRUE,0,86,TRUE,1,93,FALSE,1,68,TRUE,1,67,TRUE,0,64,FALSE,1,63,TRUE,0,93,TRUE,1,90,FALSE,0,74,TRUE,1,100,0.1089,0.1089,0.4096,0.0121,0,0.4624,0.0049,0,0.2209,0.2916,0.01,0.0961,0.0324,0.1296,0.7225,0.0289,0.7396,0.25,0.1369,0.1024,0.0841,0.4624,0.0841,0.5329,0.1764,0.4096,0.5476,0.1225,1,0.8836,0.8649,0.7921,0.328157143,0.213492857,0.442821429,9,28.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,11,68.75,8,50,75.47,69.5,78.75,76.25,77.38,78.5,72.44,-31.25,16.09,7,28.75,13.75,14.88,9.75,22.44,1,1,1,1,1,1,0,2,3,3,0,2,1,1,1,1,4,3,4,1,1,1,1,1,1,2,2,1,3,2,1,1,0,1,2,3,0,1,1,4,1,1.8,1,2.6,1,2,1,1.8,1.6,1.45,5.33,5.67,2,2,-5,4,-0.34,10 cents,25 minutes,24 days,Female,High School (or equivalent),27,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,-1,-2,1,0,1,-1,1,1,0,-1,-2,4,2,3,-3,0,-0.2,0,0.8,0.15 +771,R_6qCttAVyouSxM4S,25 - 31,Canadian,Female,3,3,3,-1,3,1,-1,0,1,3,-1,-3,3,-2,3,0,1,2,0,-2,-1,3,3,3,3,1,1,-2,-2,1,3,1,-2,-3,3,-2,3,1,-1,-1,-1,-1,-2,1,3,3,3,-2,3,1,1,-2,2,1,3,1,-1,-3,3,-1,3,0,1,3,2,2,1,6,FALSE,1,75,FALSE,0,50,TRUE,0,96,FALSE,1,50,TRUE,1,80,FALSE,1,55,TRUE,1,91,TRUE,1,60,TRUE,1,55,TRUE,1,93,FALSE,1,50,TRUE,0,55,TRUE,1,70,FALSE,1,50,FALSE,0,50,TRUE,1,57,TRUE,0,54,TRUE,0,56,FALSE,1,50,TRUE,0,50,TRUE,1,52,TRUE,1,71,FALSE,1,100,TRUE,1,50,FALSE,1,95,TRUE,1,60,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,85,0.16,0.16,0.1849,0.0081,0.0225,0.2025,0.25,0.0049,0.25,0.0841,0.25,0.09,0.2025,0.25,0.04,0.25,0,0.25,0.25,0.0025,0.2304,0.25,0.25,0.25,0.2916,0.25,0.25,0.0625,0.9216,0.3136,0.25,0.3025,0.215042857,0.153321429,0.276764286,14,43.75,23,71.88,5,62.5,7,87.5,7,87.5,4,50,12,75,11,68.75,62.81,50.62,68.25,73.88,58.5,64,61.62,-28.13,-9.07,-11.88,-19.25,-13.62,8.5,-11,-7.13,4,0,0,4,0,0,1,2,0,0,1,0,0,0,0,1,2,3,1,0,0,0,0,1,0,0,1,2,0,0,0,0,0,1,0,1,2,0,2,3,1.6,0.6,0.2,1.4,0.2,0.6,0.2,1.6,0.95,0.65,1,0.67,0,0,1,-5,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),28,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,4,0,0,3,0,0,0,0,0,0,1,0,0,-1,0,0,0,3,-1,-3,1.4,0,0,-0.2,0.3 +772,R_3KUgGNSeDtsAYzX,18 - 24,Canadian,Female,2,2,2,2,2,0,0,1,0,1,0,0,1,1,1,-2,1,-1,0,-3,2,2,2,2,2,0,-2,0,1,2,0,3,1,1,0,1,1,3,-2,1,-2,-2,-2,2,2,2,1,2,2,1,0,-2,3,-2,2,7,0,0,2,1,2,6,3,3,3,3,2,9,TRUE,0,90,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,75,TRUE,0,50,TRUE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,80,FALSE,1,85,TRUE,1,75,TRUE,1,50,TRUE,0,50,TRUE,0,80,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,90,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,75,TRUE,1,50,TRUE,1,50,0.01,0.01,0.25,0.25,0.25,0.25,0.04,0.0625,0.25,0.25,0.0625,0.04,0.25,0.25,0.0625,0.25,0,0.25,0.25,0,0.25,0.0625,0.25,0.0225,0.25,0.25,0.25,0.81,0.25,0.64,0.25,0.25,0.216160714,0.161964286,0.270357143,16,50,22,68.75,6,75,5,62.5,5,62.5,6,75,13,81.25,9,56.25,63.91,53.12,63.12,77.5,61.88,65,62.81,-18.75,-4.84,-21.88,0.62,15,-13.12,-16.25,6.56,0,0,0,0,0,2,0,0,2,1,1,1,1,0,0,0,0,1,2,1,0,0,1,0,0,0,2,2,2,1,0,0,1,0,1,5,2,4,3,5,0,1,0.6,0.8,0.2,1.4,0.4,3.8,0.6,1.45,2,4.67,-1,-4,-3,-7,-2.67,10 cents,100 minutes,47 days,Female,University - Undergraduate,23,0.5,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,-1,0,0,2,-2,-2,0,0,1,1,0,0,-1,-5,-2,-3,-1,-4,-0.2,-0.4,0.2,-3,-0.85 +773,R_5jZ4qTpkKjrfANY,25 - 31,Canadian,Female,3,3,1,-2,2,-3,1,1,3,3,0,-2,3,0,3,-2,-2,-3,-2,-3,3,3,1,3,2,3,-3,3,-2,3,2,2,-2,-3,2,-1,2,1,-3,-3,-3,-3,-3,5,3,3,0,-1,3,2,0,-1,2,-1,3,3,0,-2,3,0,3,2,0,0,0,1,-2,7,FALSE,1,75,TRUE,1,75,FALSE,1,82,TRUE,0,50,TRUE,1,91,FALSE,1,70,TRUE,1,91,TRUE,1,79,TRUE,1,95,TRUE,1,96,FALSE,1,61,TRUE,0,100,TRUE,1,61,FALSE,1,75,FALSE,0,50,FALSE,0,55,TRUE,0,58,FALSE,1,92,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,55,FALSE,1,64,TRUE,1,75,TRUE,0,64,TRUE,1,71,TRUE,0,50,FALSE,1,59,TRUE,0,59,FALSE,0,62,FALSE,0,50,TRUE,1,75,0.0441,0.0841,0.3025,0.0081,0.0625,0.09,0.0625,0.0016,0.25,0.3025,0.3844,0.1521,0.0025,0.1521,0.0081,0.0625,0.1296,0.25,0.1681,0.4096,0.25,0.25,0.25,0.0625,0.3364,0.25,0.25,0.0625,0.0324,0.0064,0.3481,1,0.199514286,0.136457143,0.262571429,17,53.13,20,62.5,3,37.5,6,75,6,75,5,62.5,11,68.75,9,56.25,68.44,60.12,66,77.38,70.25,70.69,66.19,-9.37,5.94,22.62,-9,2.38,7.75,1.94,9.94,0,0,0,5,0,0,2,3,0,1,2,1,1,1,1,1,1,0,1,0,0,0,1,1,1,3,2,1,4,0,0,0,0,0,0,2,2,3,3,1,1,1.2,1.2,0.6,0.6,2,0,2.2,1,1.2,2,2.33,1,-1,-1,-2,-0.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),29,1.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,-1,4,-1,-3,0,2,-4,1,2,1,1,1,1,-1,-1,-3,-2,-1,0.4,-0.8,1.2,-1.6,-0.2 +774,R_76PXZknRmvT7F2p,18 - 24,Canadian,Female,-3,1,-3,3,3,-1,-3,3,0,0,2,1,3,2,3,-2,-2,-1,-2,-3,-3,-3,0,0,-3,6,1,1,1,1,-1,4,0,1,1,3,0,3,0,0,2,1,-1,5,3,1,3,-1,3,9,3,-2,3,-2,0,9,3,1,3,-1,3,6,2,2,2,2,1,8,FALSE,1,100,FALSE,0,62,TRUE,0,85,TRUE,0,74,TRUE,1,90,TRUE,0,76,TRUE,1,70,FALSE,0,55,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,75,FALSE,1,53,TRUE,1,100,TRUE,0,100,TRUE,1,57,FALSE,1,61,FALSE,1,58,TRUE,0,80,TRUE,1,84,FALSE,0,66,FALSE,0,75,0.3025,0.1849,0,0.09,0.5625,0.5776,0,0,0,0.5625,0.0256,1,0,0,0.01,0.3844,0.2209,0.5476,0.1764,1,0,0,0,0,1,0.1521,0.4356,0,0.7225,1,0.64,0,0.322060714,0.277935714,0.366185714,12,37.5,19,59.38,5,62.5,3,37.5,5,62.5,6,75,10,62.5,9,56.25,85.03,82.88,84.25,87.75,85.25,83.38,86.69,-21.88,25.65,20.38,46.75,25.25,10.25,20.88,30.44,0,4,3,3,6,2,4,2,1,1,2,0,2,1,3,2,2,3,3,2,6,0,6,4,0,4,1,0,2,0,1,0,0,3,0,4,4,3,4,4,3.2,2,1.6,2.4,3.2,1.4,0.8,3.8,2.3,2.3,4.33,8,-3,-5,-3,-3,-3.67,5 cents,5 minutes,47 days,Female,University - Undergraduate,20,1,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,-6,4,-3,-1,6,-2,3,2,-1,1,1,0,2,-2,3,-2,-2,0,-1,-2,0,0.6,0.8,-1.4,0 +775,R_5rBPsTH1rZzRdio,25 - 31,Canadian,Female,2,3,2,2,3,2,2,2,1,3,2,-2,3,-2,3,2,2,2,2,1,2,3,2,-1,2,5,-1,1,2,3,2,6,3,-2,2,-1,3,2,-2,1,-1,-1,-1,9,2,3,2,2,3,2,3,3,3,-2,3,2,2,-3,3,-2,3,3,2,2,2,2,2,5,TRUE,0,80,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,100,TRUE,1,50,TRUE,1,75,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,FALSE,0,60,FALSE,0,100,TRUE,0,65,TRUE,0,90,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,65,TRUE,1,50,TRUE,0,50,FALSE,1,70,TRUE,0,50,FALSE,0,75,TRUE,1,50,TRUE,1,60,1,0.25,1,0.25,0.16,0.25,0.25,0.0625,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.09,0.4225,0.25,0.36,0.25,0.25,0.4225,0.25,0.25,0.64,0,0.81,0.25,1,0.313571429,0.2525,0.374642857,13,40.63,16,50,4,50,5,62.5,4,50,3,37.5,10,62.5,6,37.5,62.19,51.25,53.12,63.75,80.62,60.62,63.75,-9.37,12.19,1.25,-9.38,13.75,43.12,-1.88,26.25,0,0,0,3,1,3,1,0,2,1,1,0,1,1,0,4,1,3,3,2,0,0,0,0,0,1,1,1,3,0,0,1,0,0,0,0,0,0,0,1,0.8,1.4,0.6,2.6,0,1.2,0.2,0.2,1.35,0.4,4.33,2.33,3,4,-1,4,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,3,1,2,0,-1,-1,1,1,-1,1,1,0,4,1,3,3,1,0.8,0.2,0.4,2.4,0.95 +776,R_3exVCA64WEpktJn,18 - 24,Canadian,Female,3,3,1,1,2,-2,1,0,-1,2,0,0,2,1,3,-1,1,-1,-1,-1,3,0,3,-2,3,4,-1,3,1,-2,1,4,2,-2,2,3,2,1,1,3,0,2,2,5,3,3,0,3,3,4,-2,1,2,-2,2,3,0,-1,2,1,3,2,1,2,2,1,0,8,TRUE,0,97,TRUE,1,54,FALSE,1,98,FALSE,1,52,TRUE,1,54,FALSE,1,89,TRUE,1,99,TRUE,1,100,TRUE,1,83,TRUE,1,98,FALSE,1,91,FALSE,1,90,TRUE,1,59,TRUE,0,92,TRUE,1,95,TRUE,1,95,FALSE,1,93,TRUE,0,95,FALSE,1,94,FALSE,1,93,TRUE,1,75,TRUE,1,99,FALSE,1,99,TRUE,1,64,FALSE,1,100,TRUE,1,69,FALSE,1,84,TRUE,0,68,TRUE,0,74,FALSE,0,64,TRUE,1,100,TRUE,1,90,0,0.0961,0.0025,0.0001,0.01,0.0121,0.1296,0.0004,0.0049,0.0001,0.4096,0.1681,0.0289,0.0081,0.2116,0.2116,0.0001,0.2304,0.4624,0,0.0625,0.0025,0.0036,0.8464,0.0049,0.0256,0,0.9409,0.0004,0.9025,0.5476,0.01,0.186957143,0.101821429,0.272092857,15,46.88,26,81.25,8,100,7,87.5,5,62.5,6,75,15,93.75,11,68.75,84.59,81.62,79.12,93.62,84,81.12,88.06,-34.37,3.34,-18.38,-8.38,31.12,9,-12.63,19.31,0,3,2,3,1,1,2,1,1,1,2,2,0,2,1,2,2,1,3,3,0,0,1,2,1,0,0,2,1,0,0,1,0,0,0,2,1,3,2,1,1.8,1.2,1.4,2.2,0.8,0.6,0.2,1.8,1.65,0.85,3,3,0,1,-1,-3,0,5 cents,100 minutes,47 days,Female,High School (or equivalent),18,0.375,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,3,1,1,0,1,2,-1,0,1,2,1,0,2,1,0,1,-2,1,2,1,0.6,1.2,0.4,0.8 +777,R_7Ecs2WhisNDf65d,39 - 45,American,Male,1,2,-1,2,3,0,0,2,0,1,2,2,3,2,2,0,0,0,0,-1,2,2,0,2,3,9,0,-1,0,0,1,5,2,3,2,2,2,4,0,-1,-1,-1,-1,4,1,2,0,2,3,8,0,-1,1,-2,2,4,2,2,2,2,2,3,1,1,1,1,0,5,TRUE,0,53,FALSE,0,100,FALSE,1,100,FALSE,1,78,TRUE,1,54,FALSE,1,99,TRUE,1,97,TRUE,1,92,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,83,TRUE,1,78,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,81,TRUE,1,100,FALSE,1,90,FALSE,1,100,FALSE,1,54,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.0064,0,0,0.0009,0,0.0001,0,0,0,0.2116,0,0.0484,0,0.04,0.2116,1,0,0.0484,0,0.0361,0,1,0.2025,1,0,0.01,0.0625,0.2809,0,0,0.2116,0.6889,0.18045,0.111435714,0.249464286,27,84.38,27,84.38,6,75,8,100,6,75,7,87.5,14,87.5,13,81.25,88.22,84.75,85.62,85.62,96.88,90.62,85.81,0,3.84,9.75,-14.38,10.62,9.38,3.12,4.56,1,0,1,0,0,0,1,2,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,1,1,2,1,0,0,1,0,0,1,1,1,1,1,0.4,0.6,0.4,0.6,0.2,1,0.2,1,0.5,0.6,6,5,1,1,1,-1,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),42,0,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,0,0,0,0,0,0,1,-2,-1,0,1,0,0,0,-1,0,0,0,-1,0.2,-0.4,0.2,-0.4,-0.1 +778,R_5H1xr9LBPdaX84h,18 - 24,Canadian,Male,1,-3,2,1,0,-2,-3,2,1,2,1,-1,3,-3,2,1,-1,-1,-2,3,2,3,3,3,2,5,3,3,-3,3,3,10,-3,2,-2,1,-3,10,2,-2,2,2,-3,10,1,-3,2,2,2,2,1,-3,3,-3,1,2,2,-1,1,-3,1,2,2,1,2,2,3,10,TRUE,0,100,TRUE,1,80,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,80,TRUE,1,95,TRUE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,50,TRUE,0,90,FALSE,0,95,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,92,TRUE,0,90,FALSE,1,62,FALSE,1,75,TRUE,1,90,TRUE,1,100,TRUE,0,50,TRUE,1,99,TRUE,0,90,TRUE,1,85,TRUE,0,50,FALSE,1,100,FALSE,1,95,TRUE,1,85,TRUE,1,65,TRUE,1,100,0,0.0225,0,0.0025,0,0.04,0.0001,0.0025,0.0625,0,0.0225,0.9025,0.25,0.25,0.25,0.04,0.25,0.25,0,0.81,0.01,0.25,0.1444,0,0.8464,0.25,0.1225,1,0,0.81,0.0025,0.81,0.263425,0.165721429,0.361128571,22,68.75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,15,93.75,7,43.75,81.66,57.12,81.5,94.38,93.62,83.69,79.62,0,12.91,-5.38,19,31.88,6.12,-10.06,35.87,1,6,1,2,2,5,6,5,2,1,4,3,5,4,5,1,1,3,4,6,0,0,0,1,2,3,0,1,4,1,1,0,2,0,1,1,2,3,4,0,2.4,3.8,4.2,3,0.6,1.8,0.8,2,3.35,1.3,8.33,2,3,8,8,0,6.33,10 cents,100 minutes,47 days,Male,High School (or equivalent),21,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,1,6,1,1,0,2,6,4,-2,0,3,3,3,4,4,0,-1,0,0,6,1.8,2,3.4,1,2.05 +779,R_5mkDxdKw1vi4gyK,39 - 45,American,Male,2,1,2,0,1,-2,-2,0,1,-1,2,3,1,0,2,1,1,-1,1,-1,2,1,2,-2,-1,4,-3,-2,-1,1,-2,5,2,3,0,0,0,2,1,-1,-2,-2,-3,5,2,1,2,2,1,2,-2,-2,1,0,-1,2,2,3,2,0,2,2,2,2,1,1,-1,3,FALSE,1,100,TRUE,1,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,75,FALSE,1,100,TRUE,1,72,TRUE,1,100,FALSE,1,51,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,FALSE,1,66,TRUE,1,100,TRUE,1,95,TRUE,1,97,0,0,0,0,0.0009,0,0.0064,0,0,0,0,0,0,0.2209,0,0.0081,0.2401,0,0,0,0.0784,0,0.5625,0,0.81,0.7744,0.0025,0,0,1,0.1156,0,0.136421429,0.034028571,0.238814286,27,84.38,28,87.5,6,75,7,87.5,7,87.5,8,100,16,100,12,75,92.81,87.75,84.5,100,99,96.69,88.94,-3.12,5.31,12.75,-3,12.5,-1,-3.31,13.94,0,0,0,2,2,1,0,1,0,1,0,0,1,0,2,0,2,1,3,2,0,0,0,2,0,0,0,1,1,0,0,0,1,0,0,1,1,2,0,0,0.8,0.6,0.6,1.6,0.4,0.4,0.2,0.8,0.9,0.45,3.67,2,2,3,0,2,1.67,10 cents,5 minutes,15 days,Male,University - Undergraduate,44,0.875,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,2,1,0,0,-1,1,0,0,0,0,2,-1,1,-1,3,2,0.4,0.2,0.4,0.8,0.45 +780,R_3uOaBsaam5UC3KN,25 - 31,Canadian,Male,2,-3,-1,0,2,0,-3,2,-3,1,2,2,2,1,1,0,1,2,1,0,2,2,-1,-1,2,8,0,-3,1,-2,0,9,2,2,2,1,1,7,1,1,1,2,-1,7,2,-3,1,0,1,7,1,-1,2,-1,0,6,2,2,0,0,1,6,1,1,1,1,1,8,TRUE,0,100,TRUE,1,64,TRUE,0,100,FALSE,1,61,FALSE,0,66,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,69,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,66,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,59,FALSE,0,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,65,TRUE,0,100,TRUE,0,90,FALSE,0,100,FALSE,0,61,TRUE,1,100,0,0,0,0,0,0,0,0,0.1681,0,1,0,0.4761,0.1849,0.4356,0.1296,0,0.1521,1,1,0.5776,0.1156,1,0.0625,1,0.1225,0.3721,1,1,1,0.81,1,0.450239286,0.181885714,0.718592857,26,81.25,18,56.25,5,62.5,4,50,5,62.5,4,50,11,68.75,7,43.75,87.78,67.88,91.5,96.88,94.88,87.62,87.94,25,31.53,5.38,41.5,34.38,44.88,18.87,44.19,0,5,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,1,0,0,2,0,1,1,2,0,2,1,0,0,2,1,0,1,0,1,0,1,1.2,0.6,0,0.8,0.6,1.2,0.6,0.6,0.65,0.75,8,6.33,1,3,1,-1,1.67,5 cents,25 minutes,36 days,Male,University - Graduate (Masters),29,0,1,0,0,0,0,0,0.33,0,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,5,-2,1,-1,-1,-2,1,-1,0,0,0,-2,-1,0,0,0,0,1,0,0.6,-0.6,-0.6,0.2,-0.1 +781,R_6cUDOClbgaba5re,39 - 45,American,Male,3,3,1,-1,2,0,-1,3,0,3,-3,-3,3,-2,3,-2,-2,-2,-2,-3,0,3,2,2,1,5,2,-1,3,-3,0,9,1,-2,1,1,3,8,-1,-1,0,-3,-1,5,3,3,-2,1,-2,5,-3,0,3,0,1,5,-3,-2,-1,0,3,5,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,74,FALSE,1,100,FALSE,0,86,TRUE,1,83,TRUE,1,100,TRUE,1,70,FALSE,1,100,TRUE,0,75,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,88,FALSE,1,100,FALSE,1,76,TRUE,0,87,FALSE,1,100,TRUE,1,100,TRUE,1,83,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,76,TRUE,0,76,FALSE,1,100,FALSE,1,100,TRUE,1,87,FALSE,0,100,TRUE,1,100,0.0289,0.5776,0.0144,0.7396,0,0,1,0.09,0,0.0289,0.0169,0.0081,0,0,0.0676,0,0,0.25,0,0,0,0,0.7569,0,0,0.5776,1,0,1,0.0576,0,0.5625,0.193432143,0.104392857,0.282471429,22,68.75,24,75,5,62.5,8,100,6,75,5,62.5,12,75,12,75,90.69,89.12,95.62,86.38,91.62,89.88,91.5,-6.25,15.69,26.62,-4.38,11.38,29.12,14.88,16.5,3,0,1,3,1,2,0,0,3,3,4,1,2,3,0,1,1,2,1,2,0,0,3,2,4,3,1,0,0,2,0,1,4,2,0,1,1,1,1,0,1.6,1.6,2,1.4,1.8,1.2,1.4,0.8,1.65,1.3,7.33,5,0,4,3,0,2.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,45,1.625,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,3,0,-2,1,-3,-1,-1,0,3,1,4,0,-2,1,0,0,0,1,0,2,-0.2,0.4,0.6,0.6,0.35 +782,R_3xs0n15eFOtlXix,25 - 31,Canadian,Male,1,3,-2,3,3,-1,1,-1,1,2,1,-3,3,-1,2,-2,1,0,-1,-3,1,3,1,3,3,3,0,2,-3,3,3,5,-1,0,3,2,-1,3,3,3,2,2,-2,6,0,3,-2,3,3,2,1,-1,1,-1,3,4,1,-3,3,-2,3,4,2,2,2,3,-2,6,TRUE,0,70,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,54,TRUE,1,55,TRUE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,86,TRUE,0,70,TRUE,1,64,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,57,TRUE,0,100,TRUE,0,79,FALSE,1,50,TRUE,1,90,TRUE,1,90,FALSE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,0,50,FALSE,1,100,FALSE,1,82,TRUE,1,60,TRUE,1,100,TRUE,1,63,0,0.0049,0,0.2025,0.1369,0.2116,0,0.01,0.25,0.01,0.16,0.1296,0.01,0.0196,0,0,0.09,0.25,0,0,0.01,0.09,0.6241,0,0.3249,0.25,0,0.49,0.04,1,0.0324,0.49,0.165325,0.091264286,0.239385714,17,53.13,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,80.09,78.12,72.5,87.25,82.5,85.31,74.88,-28.12,-1.16,3.12,-15,12.25,-5,-14.69,12.38,0,0,3,0,0,1,1,2,2,1,2,3,0,3,3,5,2,2,3,1,1,0,0,0,0,2,2,2,2,1,0,0,0,1,1,4,1,2,4,1,0.6,1.4,2.2,2.6,0.2,1.8,0.4,2.4,1.7,1.2,3.67,3.33,1,1,-1,0,0.34,5 cents,5 minutes,47 days,Male,High School (or equivalent),27,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,-1,0,3,0,0,-1,-1,0,0,0,2,3,0,2,2,1,1,0,-1,0,0.4,-0.4,1.8,0.2,0.5 +783,R_7c7xaPs4lZKH7zH,32 - 38,American,Male,2,3,3,2,3,2,-1,-2,-2,2,1,2,2,1,3,1,1,1,2,-1,2,3,3,2,3,5,1,-1,1,-1,2,5,1,2,2,1,2,5,0,1,1,2,1,5,2,2,3,2,3,5,2,-1,2,-1,2,5,1,2,2,1,2,5,1,2,2,2,1,5,FALSE,1,88,FALSE,0,76,TRUE,0,89,FALSE,1,61,TRUE,1,87,FALSE,1,64,FALSE,0,73,TRUE,1,99,TRUE,1,75,TRUE,1,73,FALSE,1,80,FALSE,1,80,TRUE,1,71,TRUE,0,84,FALSE,0,69,TRUE,1,95,TRUE,0,67,TRUE,0,93,FALSE,1,82,FALSE,1,88,FALSE,0,84,TRUE,1,82,FALSE,1,71,TRUE,1,97,FALSE,1,97,TRUE,1,89,FALSE,1,57,TRUE,0,62,TRUE,0,94,TRUE,1,69,FALSE,0,94,TRUE,1,80,0.0001,0.0121,0.0025,0.5329,0.04,0.1296,0.0009,0.0729,0.0144,0.0324,0.0961,0.0841,0.0625,0.04,0.0169,0.5776,0.0841,0.1521,0.3844,0.0009,0.7056,0.4761,0.0324,0.7056,0.4489,0.1849,0.8836,0.0144,0.7921,0.8649,0.8836,0.04,0.279321429,0.100257143,0.458385714,23,71.88,21,65.63,5,62.5,5,62.5,5,62.5,6,75,11,68.75,10,62.5,80.31,74.25,77.25,84.88,84.88,82.06,78.56,6.25,14.68,11.75,14.75,22.38,9.88,13.31,16.06,0,0,0,0,0,1,0,3,1,0,0,0,0,0,1,1,0,0,0,2,0,1,0,0,0,0,0,4,1,0,0,0,0,0,1,0,1,1,0,2,0,1,0.2,0.6,0.2,1,0.2,0.8,0.45,0.55,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,32,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-1,0,0,0,1,0,-1,0,0,0,0,0,0,0,1,-1,-1,0,0,-0.2,0,0,-0.2,-0.1 +784,R_3opUSXehbAHNJwG,18 - 24,Canadian,Male,-2,3,0,2,2,2,1,2,0,1,0,0,2,1,1,-1,-1,-2,1,0,-3,2,2,0,1,6,2,1,0,1,2,6,0,0,1,-1,1,6,-3,0,0,-2,-3,8,0,3,0,0,3,5,3,0,3,-1,3,5,1,1,1,1,2,6,1,2,1,3,0,6,FALSE,1,63,FALSE,0,67,TRUE,0,96,FALSE,1,63,TRUE,1,77,TRUE,0,75,TRUE,1,100,TRUE,1,100,FALSE,0,62,FALSE,0,60,FALSE,1,64,TRUE,0,100,TRUE,1,72,FALSE,1,56,TRUE,1,60,FALSE,0,60,TRUE,0,94,TRUE,0,73,FALSE,1,57,FALSE,1,55,FALSE,0,58,TRUE,1,78,FALSE,1,53,TRUE,1,88,FALSE,1,54,TRUE,1,61,TRUE,0,69,TRUE,0,100,TRUE,0,60,TRUE,1,74,FALSE,0,53,FALSE,0,53,0,0.1521,0.36,0,0.2809,0.5625,0.0144,0.36,0.2025,0.0484,0.0676,0.0784,0.3844,0.1296,0.0529,0.4489,0.2209,0.1369,1,0.2116,0.3364,0.16,0.1849,0.1936,0.8836,0.4761,0.2809,0.1369,0.9216,0.5329,0.36,1,0.345242857,0.21345,0.477035714,5,15.63,17,53.13,4,50,3,37.5,6,75,4,50,9,56.25,8,50,70.47,61.88,67.75,68.12,84.12,70.19,70.75,-37.5,17.34,11.88,30.25,-6.88,34.12,13.94,20.75,1,1,2,2,1,0,0,2,1,1,0,0,1,2,0,2,1,2,3,3,2,0,0,2,1,1,1,1,1,2,1,1,1,0,1,2,3,3,2,0,1.4,0.8,0.6,2.2,1,1.2,0.8,2,1.25,1.25,6,5.33,1,1,0,2,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),22,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,1,2,0,0,-1,-1,1,0,-1,-1,-1,0,2,-1,0,-2,-1,1,3,0.4,-0.4,-0.2,0.2,0 +785,R_6GITWb0bS6KmYsZ,18 - 24,Canadian,Male,-1,3,1,1,3,-1,-3,1,0,3,-3,-3,3,-1,2,-1,1,1,-1,1,-3,2,3,1,2,7,-1,-1,-2,1,-1,9,3,-3,0,-2,3,10,3,3,3,3,3,10,1,3,1,1,3,1,-1,-3,2,-2,3,3,-2,-3,3,-2,3,3,1,1,1,0,2,6,FALSE,1,96,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,63,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,60,FALSE,1,59,FALSE,1,75,TRUE,1,100,TRUE,0,100,TRUE,1,87,TRUE,1,100,FALSE,1,76,FALSE,1,94,FALSE,1,91,FALSE,1,50,TRUE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,90,FALSE,1,95,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,97,FALSE,0,55,FALSE,0,50,TRUE,1,90,0,0,0,0,0.01,0.1369,0.01,0.16,0.25,0.0081,0.3025,0,0.0196,0.1681,0,0.0081,0,0.25,0,0.0025,0,0.0169,0.0081,1,0.0576,0.25,0.25,0.0016,0,0.0036,0.9409,0.0625,0.139892857,0.094521429,0.185264286,25,78.13,27,84.38,6,75,7,87.5,7,87.5,7,87.5,14,87.5,13,81.25,84.25,70.5,90.75,92,83.75,87.5,81,-6.25,-0.13,-4.5,3.25,4.5,-3.75,0,-0.25,2,1,2,0,1,0,2,3,1,4,6,0,3,1,1,4,2,2,4,2,2,0,0,0,0,0,0,1,2,0,1,0,0,1,1,2,0,0,1,1,1.2,2,2.2,2.8,0.4,0.6,0.6,0.8,2.05,0.6,8.67,2.33,6,6,7,4,6.34,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,1,2,0,1,0,2,2,-1,4,5,0,3,0,0,2,2,2,3,1,0.8,1.4,1.6,2,1.45 +786,R_5DO6PvIpItaY44V,18 - 24,Canadian,Female,1,3,3,3,2,1,1,-1,3,1,0,-1,1,1,2,-3,-1,-3,-2,-3,3,2,2,1,-1,4,1,-1,1,1,-1,5,1,1,-1,2,1,4,0,1,1,2,1,4,2,3,3,3,2,3,1,0,1,0,1,3,0,-2,2,1,3,3,2,1,2,1,-1,6,TRUE,0,57,TRUE,1,69,TRUE,0,72,FALSE,1,50,TRUE,1,50,FALSE,1,81,TRUE,1,100,TRUE,1,100,TRUE,1,62,TRUE,1,87,FALSE,1,50,TRUE,0,74,TRUE,1,98,FALSE,1,50,TRUE,1,75,TRUE,1,81,TRUE,0,59,TRUE,0,96,TRUE,0,50,TRUE,0,50,TRUE,1,84,TRUE,1,72,FALSE,1,67,TRUE,1,65,TRUE,0,50,TRUE,1,92,TRUE,0,50,FALSE,1,58,TRUE,0,50,TRUE,1,76,TRUE,1,50,TRUE,1,82,0,0.0064,0.0361,0,0.0324,0.0361,0.1225,0.0169,0.25,0.0784,0.0576,0.0004,0.1444,0.25,0.25,0.0961,0.1089,0.25,0.1764,0.25,0.0256,0.0625,0.25,0.25,0.3481,0.25,0.25,0.3249,0.5184,0.9216,0.25,0.5476,0.218528571,0.120978571,0.316078571,13,40.63,22,68.75,6,75,6,75,5,62.5,5,62.5,16,100,6,37.5,68.97,57,71.38,75.5,72,77.69,60.25,-28.12,0.22,-18,-3.62,13,9.5,-22.31,22.75,2,1,1,2,3,0,2,2,2,2,1,2,2,1,1,3,2,4,4,4,1,0,0,0,0,0,1,2,3,0,0,1,1,0,1,5,2,5,3,2,1.8,1.6,1.4,3.4,0.2,1.2,0.6,3.4,2.05,1.35,4.33,3,1,2,1,-2,1.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),21,1.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,1,1,2,3,0,1,0,-1,2,1,1,1,1,0,-2,0,-1,1,2,1.6,0.4,0.8,0,0.7 +787,R_1mb2WqGSgK3tz69,39 - 45,American,Male,2,2,2,-2,2,0,0,2,-1,2,1,0,2,-2,3,2,1,2,2,-1,2,2,2,-2,2,2,0,0,2,-1,2,2,0,0,2,-2,3,3,1,-1,1,0,-2,5,2,2,2,-2,2,1,0,0,2,-2,0,3,0,-1,2,-3,3,4,2,2,2,2,2,2,FALSE,1,70,TRUE,1,96,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,82,TRUE,1,58,TRUE,1,91,TRUE,1,82,FALSE,1,50,TRUE,0,71,TRUE,1,100,TRUE,0,60,TRUE,1,50,TRUE,1,60,TRUE,0,60,TRUE,0,91,TRUE,0,50,FALSE,1,92,FALSE,0,50,TRUE,1,71,FALSE,1,91,TRUE,1,82,TRUE,0,60,TRUE,1,60,TRUE,0,50,FALSE,1,81,FALSE,1,60,TRUE,1,60,FALSE,0,50,TRUE,1,100,0.1764,0.16,0.16,0.0324,0,0.25,0.0324,0.0324,0.0064,0.0841,0.16,0,0.0081,0.25,0.25,0.0016,0.0081,0.25,0.0361,0.36,0.25,0.25,0.25,0.36,0.36,0.25,0.25,0.09,0.25,0.8281,0.16,0.5041,0.19755,0.095221429,0.299878571,22,68.75,23,71.88,5,62.5,6,75,5,62.5,7,87.5,14,87.5,9,56.25,68.06,60.88,70.12,72,69.25,71.38,64.75,-3.13,-3.82,-1.62,-4.88,9.5,-18.25,-16.12,8.5,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,2,1,2,1,0,0,0,0,0,0,0,0,1,2,1,1,0,1,0,0,1,0,0,3,0,0,0.2,1.4,0,0.6,0.6,0.8,0.4,0.5,2.33,2.67,1,-1,-1,3,-0.34,5 cents,5 minutes,47 days,Male,University - Undergraduate,41,1.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,-1,-2,0,-1,0,-1,0,1,1,1,2,-2,0,-0.6,-0.4,0.6,-0.1 +788,R_7LtcDJJsu3A12Iz,32 - 38,American,Male,3,3,2,3,2,2,3,3,3,2,2,3,3,3,2,2,3,3,3,2,3,2,3,3,2,10,3,3,3,2,2,9,3,3,3,2,2,9,3,2,3,3,2,9,3,3,3,2,2,9,3,2,2,3,3,9,3,3,2,2,3,9,3,3,2,2,3,9,TRUE,0,83,FALSE,0,91,TRUE,0,72,TRUE,0,89,TRUE,1,95,TRUE,0,88,TRUE,1,91,TRUE,1,99,TRUE,1,92,FALSE,0,81,TRUE,0,89,TRUE,0,78,TRUE,1,96,TRUE,0,83,FALSE,0,86,TRUE,1,95,TRUE,0,85,TRUE,0,94,TRUE,0,81,FALSE,1,88,TRUE,1,97,TRUE,1,93,FALSE,1,81,FALSE,0,90,FALSE,1,90,TRUE,1,95,TRUE,0,92,TRUE,0,89,TRUE,0,89,TRUE,1,97,TRUE,1,87,TRUE,1,88,0.0001,0.0025,0.0025,0.0081,0.0144,0.7744,0.81,0.6561,0.0144,0.0049,0.0009,0.0016,0.0064,0.7921,0.0025,0.8281,0.0361,0.7921,0.7921,0.01,0.0009,0.7396,0.6561,0.6889,0.7225,0.8464,0.0169,0.6889,0.5184,0.8836,0.7921,0.6084,0.453528571,0.338142857,0.568914286,27,84.38,15,46.88,2,25,5,62.5,4,50,4,50,12,75,3,18.75,88.88,88.38,89.88,88.75,88.5,92.06,85.69,37.5,42,63.38,27.38,38.75,38.5,17.06,66.94,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,1,0.4,0.4,0.4,0.4,0.4,0.8,0.8,0.8,0.4,0.7,9.33,9,1,0,0,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,1,0,-1,0,0,-1,-1,1,-1,0,0,-1,0,-1,0,1,-1,-1,-1,0,-0.4,-0.4,-0.4,-0.3 +789,R_1qvpvPkUq3A7QHL,25 - 31,American,Male,2,2,3,-3,0,-3,-2,2,-2,1,2,1,3,-2,3,-2,1,2,1,1,1,2,3,-3,0,5,-3,-3,1,-1,2,3,3,2,3,-3,3,0,-3,-3,-3,-3,-3,10,2,2,3,-3,0,2,-3,-3,3,-3,3,0,3,3,3,-2,3,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,89,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,68,FALSE,1,50,FALSE,1,100,TRUE,1,77,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,88,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,1,76,0,0,0,0,0.0576,0.0121,0,0.1024,0,0.0144,1,0.0529,0.25,0.25,0.25,0.25,0,0.25,0,0,0.5625,0.25,0.25,0,0.25,0.25,0,1,1,1,0.25,0,0.260782143,0.177814286,0.34375,20,62.5,24,75,6,75,6,75,6,75,6,75,11,68.75,13,81.25,80.41,56.25,70.88,94.5,100,80.25,80.56,-12.5,5.41,-18.75,-4.12,19.5,25,11.5,-0.69,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,4,5,4,4,0,0,0,0,0,0,1,1,1,2,1,2,0,0,0,4,1,0,1,1,0.2,0.8,0.6,3.6,0,1,0.6,1.4,1.3,0.75,2.67,1.33,3,3,-2,8,1.34,10 cents,5 minutes,24 days,Male,High School (or equivalent),30,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,0,0,0,0,0,0,0,0,-1,0,-1,0,1,0,-3,3,5,3,3,0.2,-0.2,0,2.2,0.55 +790,R_1LHZwuv3ArwDt97,18 - 24,American,Male,-3,3,-3,0,-3,-3,0,0,1,0,-1,-1,3,0,3,0,0,0,-1,-3,0,3,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,5,TRUE,0,50,TRUE,1,50,TRUE,0,70,FALSE,1,55,TRUE,1,68,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,75,FALSE,1,84,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,55,FALSE,1,50,FALSE,1,65,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,64,FALSE,0,50,TRUE,1,56,0.25,0.25,0.25,0.25,0.1936,0.25,0.0841,0.5625,0.1225,0.25,0.1296,0.25,0.25,0.0256,0.1024,0.25,0,0.2025,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.49,0.3025,0.25,1,0.248760714,0.190914286,0.306607143,2,6.25,20,62.5,6,75,4,50,5,62.5,5,62.5,10,62.5,10,62.5,59.78,54.88,59.25,60,65,55.25,64.31,-56.25,-2.72,-20.12,9.25,-2.5,2.5,-7.25,1.81,3,0,3,0,3,3,0,0,1,0,1,1,3,0,3,0,0,0,1,3,3,3,3,0,3,3,0,0,1,0,1,1,3,0,3,0,0,0,1,3,1.8,0.8,1.6,0.8,2.4,0.8,1.6,0.8,1.25,1.4,4.33,4.67,0,0,-1,0,-0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,19,0.75,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.6,0,0,0,-0.15 +791,R_3O3zMA225SHV2Kb,32 - 38,American,Male,1,-2,0,-2,-3,-2,-1,1,-2,-1,-1,1,0,-2,2,0,-1,1,1,-2,2,-2,1,-2,-3,2,-2,-2,-1,-2,-2,2,-1,2,0,-2,1,2,-2,-2,-2,-2,-2,5,1,-1,1,-2,-3,2,-3,-2,2,-2,-2,2,-1,2,1,-2,2,2,-1,-1,-1,-1,-2,2,FALSE,1,91,FALSE,0,70,FALSE,1,65,FALSE,1,52,TRUE,1,51,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,80,FALSE,1,76,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,52,TRUE,0,90,FALSE,1,82,FALSE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,80,TRUE,1,75,TRUE,1,76,TRUE,1,100,0,0,0,0,0,0,0,0.04,0,0,0.0625,0,0.0841,0.0576,0.2401,0.49,0,0.2304,0,0,0.09,0.25,0.0324,0,0.2704,0.25,0.0576,0.0081,0.1225,0.81,0.64,0,0.133417857,0.08605,0.180785714,20,62.5,27,84.38,6,75,6,75,7,87.5,8,100,15,93.75,12,75,83.78,65.88,81.62,95.12,92.5,83.94,83.62,-21.88,-0.6,-9.12,6.62,7.62,-7.5,-9.81,8.62,1,0,1,0,0,0,1,2,0,1,0,1,0,0,1,2,1,3,3,0,0,1,1,0,0,1,1,1,0,1,0,1,1,0,0,1,0,2,2,0,0.4,0.8,0.4,1.8,0.4,0.8,0.4,1,0.85,0.65,2,2,0,0,0,3,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),38,0.75,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,-1,0,0,0,-1,0,1,0,0,0,0,-1,0,1,1,1,1,1,0,0,0,0,0.8,0.2 +792,R_1ZO4Z0bMP1CCwKt,18 - 24,Canadian,Female,-1,2,1,-1,1,2,0,1,-2,3,2,1,2,2,3,0,2,1,1,0,1,1,0,1,1,6,0,0,-1,-1,-2,8,0,0,0,-1,1,6,-1,1,1,1,1,6,1,1,1,1,1,7,1,0,1,1,1,7,1,1,1,0,0,5,2,1,2,1,2,7,TRUE,0,64,FALSE,0,59,TRUE,0,100,TRUE,0,75,TRUE,1,75,FALSE,1,56,TRUE,1,76,FALSE,0,56,FALSE,0,59,TRUE,1,78,FALSE,1,62,TRUE,0,100,FALSE,0,61,FALSE,1,64,TRUE,1,100,FALSE,0,57,TRUE,0,60,TRUE,0,80,FALSE,1,60,FALSE,1,70,FALSE,0,100,FALSE,0,60,TRUE,0,55,TRUE,1,59,TRUE,0,82,TRUE,1,90,FALSE,1,59,TRUE,0,93,TRUE,0,80,TRUE,1,100,FALSE,0,53,FALSE,0,53,0.3136,0.01,0.3249,0.0576,0.2809,0.1936,0.1681,0.0484,0.09,0.36,0,0.3721,0.3481,0.1444,0.0625,0.3481,0.3025,0.5625,0.8649,0.6724,1,0,0.16,0.1296,0.36,0.1681,0.2809,0.4096,1,0.64,0.64,1,0.378810714,0.234371429,0.52325,16,50,13,40.63,4,50,2,25,4,50,3,37.5,7,43.75,6,37.5,71.75,65.88,67.5,74.25,79.38,71,72.5,9.37,31.12,15.88,42.5,24.25,41.88,27.25,35,2,1,1,2,0,2,0,2,1,5,2,1,2,3,2,1,1,0,0,1,2,1,0,2,0,1,0,0,3,2,1,0,1,2,3,2,1,1,0,2,1.2,2,2,0.6,1,1.2,1.4,1.2,1.45,1.2,6.67,6.33,-1,1,1,-1,0.34,10 cents,75 minutes,47 days,Female,University - Undergraduate,20,0,0,0,1,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,1,0,0,1,0,2,-2,3,1,1,1,1,-1,-1,0,-1,0,-1,0.2,0.8,0.6,-0.6,0.25 +793,R_3ht32nKfhP8a70Z,39 - 45,American,Male,2,2,2,2,2,2,0,3,-3,2,2,0,0,0,2,1,2,2,2,0,2,2,2,2,2,1,2,0,2,-2,2,5,2,2,0,0,2,0,2,0,2,2,2,5,2,2,2,2,2,2,2,0,2,-2,2,2,2,2,0,0,2,2,2,2,2,1,0,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,81,FALSE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0.0361,1,1,1,0.0676,0.09,1,1,0,0.0484,1,0.330075,0.142857143,0.517292857,26,81.25,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,96.97,90.62,97.25,100,100,96.94,97,12.5,28.22,28.12,22.25,25,37.5,9.44,47,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,1,2,0,0,2,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,1,0,0,1,0,0,0.4,0.4,1,0,0.4,0.4,0.4,0.45,0.3,2,2,-1,3,-2,3,0,10 cents,5 minutes,15 days,Male,High School (or equivalent),43,1.25,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,-1,2,0,0,0,0.6,0.15 +794,R_6KvJr2tX3MpsurF,39 - 45,American,Male,1,3,3,3,3,2,-2,2,-2,2,2,2,2,2,2,3,3,3,3,3,1,3,3,3,3,5,2,-1,2,-2,2,5,2,2,1,2,2,5,3,3,2,3,3,5,1,3,3,3,3,3,2,-2,2,-2,2,5,2,2,2,2,2,5,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.6561,0,1,1,0,0,0,0,0.0256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.095775,0.19155,0,29,90.63,29,90.63,8,100,7,87.5,8,100,6,75,14,87.5,15,93.75,98.91,100,98,100,97.62,100,97.81,0,8.28,0,10.5,0,22.62,12.5,4.06,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0.2,0,0,0,0,0.15,0,5,4.33,2,0,0,0,0.67,5 cents,5 minutes,47 days,Male,University - PhD,39,0,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0.2,0.2,0.2,0.15 +795,R_1CTlUoqH71ssoqs,32 - 38,American,Male,3,3,2,3,2,3,2,3,3,3,2,3,2,3,3,2,3,3,3,3,2,2,3,3,3,9,2,2,3,3,3,10,3,3,3,2,3,10,2,3,3,2,3,10,2,3,2,2,2,10,3,3,2,2,2,8,2,2,3,3,3,10,2,3,2,3,3,10,TRUE,0,100,TRUE,1,91,FALSE,1,94,FALSE,1,89,FALSE,0,82,TRUE,0,98,FALSE,0,98,TRUE,1,91,TRUE,1,92,TRUE,1,92,FALSE,1,100,FALSE,1,96,FALSE,0,82,TRUE,0,84,TRUE,1,100,TRUE,1,82,TRUE,0,100,TRUE,0,87,TRUE,0,92,FALSE,1,82,FALSE,0,80,FALSE,0,92,FALSE,1,100,TRUE,1,83,TRUE,0,87,FALSE,0,92,FALSE,1,97,FALSE,1,88,TRUE,0,81,TRUE,1,81,TRUE,1,81,TRUE,1,100,0.0081,0.8464,0.0324,0.9604,0,0.9604,0.0289,0.0064,0.0324,0.8464,0.0361,0.6724,0.0064,0,0.6724,0.0081,0,0.0121,0.0144,0.7569,0.64,0,0.8464,0.7056,1,0.0009,0.0361,1,0.0036,0.7569,0.6561,0.0016,0.346446429,0.234428571,0.458464286,18,56.25,18,56.25,7,87.5,2,25,1,12.5,8,100,10,62.5,8,50,90.44,92.75,90.38,91.5,87.12,88.69,92.19,0,34.19,5.25,65.38,79,-12.88,26.19,42.19,1,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,1,0,0,0,0,1,0,0,0.8,0.2,0.6,0.2,0.4,0.8,0.4,0.2,0.45,0.45,9.67,9.33,-1,2,0,0,0.34,10 cents,100 minutes,24 days,Male,University - PhD,35,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,1,1,-1,1,1,-1,-1,-1,-1,1,-1,0,1,0,0,0,-1,1,0,0.4,-0.6,0.2,0,0 +796,R_3rTYmI54D4bgnwY,25 - 31,Canadian,Female,-1,2,1,0,2,1,0,-2,2,1,0,1,0,1,1,0,1,1,1,-1,2,1,0,3,1,7,1,2,3,1,1,7,0,-2,1,0,-1,6,0,1,1,0,2,6,2,1,2,1,2,7,1,2,1,2,0,7,-1,2,0,0,1,7,1,1,1,0,1,7,TRUE,0,87,FALSE,0,73,TRUE,0,87,FALSE,1,75,FALSE,0,78,FALSE,1,79,FALSE,0,73,TRUE,1,76,FALSE,0,72,TRUE,1,82,FALSE,1,78,TRUE,0,100,FALSE,0,73,FALSE,1,84,TRUE,1,90,FALSE,0,86,FALSE,1,65,TRUE,0,81,FALSE,1,84,FALSE,1,86,TRUE,1,100,FALSE,0,82,TRUE,0,79,FALSE,0,94,FALSE,1,72,FALSE,0,85,FALSE,1,85,FALSE,1,79,FALSE,1,78,TRUE,1,83,FALSE,0,78,FALSE,0,64,0.0576,0.7225,0.7396,0.5329,0.4096,0.0441,0.8836,0.0324,0.0196,0.6724,0.0289,0.5329,0.5184,0.0484,0.6084,0.5329,0.6241,0.0625,0.0441,0.0784,0,0.01,0.0256,0.0256,0.1225,0.0225,0.6084,0.7569,0.7569,0.6561,0.0484,1,0.327628571,0.358442857,0.296814286,20,62.5,16,50,5,62.5,4,50,3,37.5,4,50,5,31.25,11,68.75,80.88,79.38,77,80.75,86.38,80.56,81.19,12.5,30.88,16.88,27,43.25,36.38,49.31,12.44,3,1,1,3,1,0,2,5,1,0,0,3,1,1,2,0,0,0,1,3,3,1,1,1,0,0,2,3,0,1,1,1,0,1,0,1,0,0,1,2,1.8,1.6,1.4,0.8,1.2,1.2,0.6,0.8,1.4,0.95,6.67,7,0,0,-1,-1,-0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,26,-0.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,2,1,0,0,2,1,-1,-1,2,1,0,2,-1,0,0,0,1,0.6,0.4,0.8,0,0.45 +797,R_5Bo1X3nIGzcQF1q,25 - 31,Canadian,Female,2,3,3,1,2,-3,-2,3,0,0,2,-2,2,-2,3,-1,-1,0,0,-2,1,3,3,-1,1,6,-3,-3,3,0,-2,1,2,-3,2,-2,3,2,-1,1,1,0,1,7,3,3,3,2,2,3,-2,-2,3,0,-1,4,2,-3,3,-3,3,3,-2,-2,0,0,-2,7,TRUE,0,79,FALSE,0,50,TRUE,0,62,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,93,TRUE,1,50,TRUE,1,63,FALSE,1,50,FALSE,1,57,TRUE,1,55,FALSE,1,50,TRUE,1,62,TRUE,1,59,TRUE,0,66,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,56,TRUE,1,69,FALSE,1,50,TRUE,1,92,TRUE,0,59,TRUE,1,80,FALSE,1,50,FALSE,1,74,TRUE,0,50,TRUE,1,80,TRUE,1,50,TRUE,1,51,0.0049,0.04,0.1681,0.25,0.2401,0.25,0.0064,0.1369,0.25,0.0961,0.04,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.0676,0.3481,0.1936,0.1444,0.25,0.25,0.4356,0.25,0.25,0.6241,0.3844,0.25,0.25,0.1849,0.235882143,0.194428571,0.277335714,9,28.13,22,68.75,5,62.5,6,75,4,50,7,87.5,14,87.5,8,50,59.59,51.5,53.5,62.5,70.88,63.12,56.06,-40.62,-9.16,-11,-21.5,12.5,-16.62,-24.38,6.06,1,0,0,2,1,0,1,0,0,2,0,1,0,0,0,0,2,1,0,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0.8,0.6,0.2,1.2,0.4,0.4,0.6,0.4,0.7,0.45,3,3.33,3,-3,-1,0,-0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,0,1,1,-1,1,0,0,1,0,0,-1,-1,0,-1,1,1,0,3,0.4,0.2,-0.4,0.8,0.25 +798,R_7E6OiTDqe7hlo19,18 - 24,Canadian,Female,2,3,3,0,3,2,0,2,1,2,2,0,3,0,3,0,1,2,1,0,2,3,3,-1,3,7,0,-1,2,1,2,4,2,0,2,1,2,2,0,1,1,-1,0,2,2,3,3,0,3,7,2,-1,3,0,3,3,2,-1,3,0,3,3,1,3,1,1,0,6,TRUE,0,85,TRUE,1,90,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,90,FALSE,1,100,TRUE,0,70,TRUE,1,100,FALSE,1,75,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,80,TRUE,0,75,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,98,TRUE,1,100,TRUE,0,70,FALSE,1,50,TRUE,0,85,FALSE,0,65,FALSE,0,100,TRUE,1,96,0,0,0,0,0.0016,0,0.0025,0.01,0.25,0,0.4225,0,0.0025,0,0,0.01,0,0.25,0.25,0.0004,0,0.16,0.5625,0.0625,0.25,0.49,1,0.7225,0,0.64,0.7225,0.49,0.224982143,0.067792857,0.382171429,26,81.25,24,75,5,62.5,7,87.5,6,75,6,75,14,87.5,10,62.5,85.28,80,91.38,91,78.75,93.19,77.38,6.25,10.28,17.5,3.88,16,3.75,5.69,14.88,0,0,0,1,0,2,1,0,0,0,0,0,1,1,1,0,0,1,2,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,2,1,0,0,0.2,0.6,0.6,0.6,0,0.8,0.2,0.8,0.5,0.45,4.33,4.33,0,1,-1,-4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,1,0,2,0,-1,-1,-1,0,-1,1,1,1,-1,-2,0,2,0,0.2,-0.2,0.4,-0.2,0.05 +799,R_3mhdoEs0UVczlc4,18 - 24,Canadian,Female,-3,3,3,3,2,3,3,2,2,1,2,3,2,3,-1,-2,2,-1,2,0,1,-1,-1,0,-3,8,1,-2,-2,2,0,10,-1,-1,2,-2,1,9,2,2,-1,2,1,9,-1,0,2,-2,1,8,-2,1,2,1,-1,10,3,3,-1,2,3,5,-2,0,-1,1,2,9,FALSE,1,100,FALSE,0,55,TRUE,0,55,FALSE,1,68,FALSE,0,57,TRUE,0,59,TRUE,1,58,FALSE,0,56,FALSE,0,55,TRUE,1,55,FALSE,1,55,TRUE,0,76,FALSE,0,59,TRUE,0,68,FALSE,0,66,TRUE,1,64,FALSE,1,55,FALSE,1,100,FALSE,1,55,FALSE,1,100,FALSE,0,54,FALSE,0,54,FALSE,1,100,TRUE,1,54,FALSE,1,55,TRUE,1,86,FALSE,1,60,FALSE,1,59,TRUE,0,74,TRUE,1,100,FALSE,0,83,TRUE,1,100,0.3136,0.0196,0.1296,0.1764,0,0.3481,0.2116,0.2025,0,0.2916,0,0.3481,0.3025,0.2025,0.3249,0.3025,0,0.1024,0.1681,0.2025,0.2916,0.4356,0.2025,0.4624,0.2025,0.16,0.6889,0,0.3025,0,0.5476,0.5776,0.245660714,0.188335714,0.302985714,4,12.5,18,56.25,4,50,3,37.5,6,75,5,62.5,7,43.75,11,68.75,68.59,62.12,69.75,72,70.5,66,71.19,-43.75,12.34,12.12,32.25,-3,8,22.25,2.44,4,4,4,3,5,2,5,4,0,1,3,4,0,5,2,4,0,0,0,1,2,3,1,5,1,5,2,0,1,2,1,0,3,1,4,0,2,0,1,2,4,2.4,2.8,1,2.4,2,1.8,1,2.55,1.8,9,7.67,0,0,4,0,1.33,15 cents,100 minutes,15 days,Female,College Diploma/Certificate,24,0.375,0,0,0,0,1,0,0,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,1,3,-2,4,-3,3,4,-1,-1,2,4,-3,4,-2,4,-2,0,-1,-1,1.6,0.4,1,0,0.75 +800,R_5KOpAvIfnlnAQTG,25 - 31,Canadian,Female,2,2,2,-1,2,-1,-2,3,-1,1,1,-3,2,3,2,1,1,1,1,0,2,2,2,3,0,4,-1,-1,-1,3,0,5,1,-3,-1,-1,1,6,-2,-2,-2,-2,-2,7,3,2,2,-1,3,0,-1,-2,2,-2,2,2,0,-3,3,3,2,1,2,3,2,2,0,4,TRUE,0,70,FALSE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,63,FALSE,1,100,TRUE,1,85,TRUE,1,79,FALSE,0,50,TRUE,1,62,FALSE,1,52,TRUE,0,52,TRUE,1,77,FALSE,1,100,FALSE,0,61,TRUE,1,90,TRUE,0,65,TRUE,0,65,TRUE,0,50,FALSE,1,50,TRUE,1,70,TRUE,1,72,TRUE,0,50,TRUE,1,77,FALSE,1,89,TRUE,1,100,FALSE,1,50,FALSE,1,68,TRUE,0,50,FALSE,0,65,FALSE,0,60,TRUE,1,84,0.0441,0,0.01,0.0225,0.0256,0,0.0529,0.1444,0.25,0.0784,0.4225,0.0529,0.25,0.2304,0.1369,0.25,0.25,0.25,0.1024,0.0121,0.09,0.3721,0.25,0,0.4225,0.25,0.36,0.49,0,0.4225,0.25,0.2704,0.203071429,0.171,0.235142857,12,37.5,19,59.38,2,25,5,62.5,6,75,6,75,11,68.75,8,50,68.94,52.88,69.88,80.38,72.62,71.56,66.31,-21.88,9.56,27.88,7.38,5.38,-2.38,2.81,16.31,0,0,0,4,2,0,1,4,4,1,0,0,3,4,1,3,3,3,3,2,1,0,0,0,1,0,0,1,1,1,1,0,1,0,0,1,2,1,1,0,1.2,2,1.6,2.8,0.4,0.6,0.4,1,1.9,0.6,5,1,4,3,5,3,4,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),31,1.875,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-1,0,0,4,1,0,1,3,3,0,-1,0,2,4,1,2,1,2,2,2,0.8,1.4,1.2,1.8,1.3 +801,R_7DOLfyoA3NG45QB,18 - 24,Canadian,Female,-2,2,-1,2,-1,-3,2,-3,3,1,1,1,2,1,3,-2,1,-3,-3,-3,-1,2,2,-1,1,4,-1,1,-3,3,1,6,-1,-1,1,3,2,5,1,2,-2,1,-3,8,-1,2,1,3,0,4,-1,1,1,2,-1,3,1,2,2,1,2,3,-2,-2,-2,-2,-3,8,TRUE,0,97,FALSE,0,65,FALSE,1,70,FALSE,1,60,TRUE,1,76,FALSE,1,53,FALSE,0,98,FALSE,0,65,TRUE,1,53,TRUE,1,60,FALSE,1,50,TRUE,0,99,TRUE,1,51,FALSE,1,100,FALSE,0,52,TRUE,1,60,FALSE,1,50,TRUE,0,52,TRUE,0,55,FALSE,1,53,FALSE,0,50,TRUE,1,100,TRUE,0,81,FALSE,0,65,TRUE,0,85,TRUE,1,98,FALSE,1,50,FALSE,1,57,TRUE,0,51,FALSE,0,57,TRUE,1,50,FALSE,0,59,0.4225,0.0004,0.16,0.9604,0.3481,0.2209,0.4225,0.16,0.2209,0,0.3249,0.2401,0.2209,0.25,0.0576,0.4225,0.6561,0.16,0.1849,0.7225,0.25,0.2704,0.3025,0,0.25,0.25,0.25,0.9409,0.09,0.2704,0.2601,0.9801,0.311653571,0.264607143,0.3587,20,62.5,17,53.13,5,62.5,4,50,4,50,4,50,8,50,9,56.25,66.31,54.38,58.88,86.25,65.75,66.19,66.44,9.37,13.18,-8.12,8.88,36.25,15.75,16.19,10.19,1,0,3,3,2,2,1,0,0,0,2,2,1,2,1,3,1,1,4,0,1,0,2,1,1,2,1,4,1,2,0,1,0,0,1,0,3,1,1,0,1.8,0.6,1.6,1.8,1,2,0.4,1,1.45,1.1,5,3.33,0,3,2,0,1.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),21,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,1,2,1,0,0,-4,-1,-2,2,1,1,2,0,3,-2,0,3,0,0.8,-1.4,1.2,0.8,0.35 +802,R_7rS7ENCwiu74QgF,32 - 38,American,Male,0,2,2,1,2,-3,-1,0,1,1,1,2,3,3,3,-1,1,1,1,-3,-2,2,2,1,2,3,-1,-1,1,2,2,3,2,2,3,3,3,2,-3,-2,-2,-3,-2,9,1,3,2,2,3,2,-2,-2,0,-2,2,6,1,1,3,-1,3,5,2,3,1,3,1,8,TRUE,0,50,FALSE,0,50,TRUE,0,88,FALSE,1,94,TRUE,1,98,FALSE,1,93,TRUE,1,78,TRUE,1,86,TRUE,1,50,TRUE,1,93,TRUE,0,69,TRUE,0,65,TRUE,1,66,FALSE,1,76,TRUE,1,87,TRUE,1,99,FALSE,1,50,FALSE,1,91,FALSE,1,91,FALSE,1,99,FALSE,0,50,TRUE,1,96,FALSE,1,83,TRUE,1,93,TRUE,0,50,TRUE,1,96,FALSE,1,50,FALSE,1,88,TRUE,0,91,TRUE,1,94,TRUE,1,91,TRUE,1,99,0.0196,0.0016,0.0001,0.0484,0.0001,0.0049,0.0049,0.0049,0.0001,0.0016,0.0036,0.1156,0.25,0.4761,0.0004,0.25,0.0289,0.0036,0.0144,0.25,0.25,0.0169,0.0081,0.0576,0.25,0.25,0.0081,0.25,0.7744,0.0081,0.8281,0.4225,0.161889286,0.081764286,0.242014286,28,87.5,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,79.81,72.75,78.75,78.75,89,82.88,76.75,12.5,4.81,-2.25,3.75,3.75,14,-4.62,14.25,2,0,0,0,0,2,0,1,1,1,1,0,0,0,0,2,3,3,4,1,1,1,0,1,1,1,1,0,3,1,0,1,0,4,0,3,2,0,2,4,0.4,1,0.2,2.6,0.8,1.2,1,2.2,1.05,1.3,2.67,4.33,1,-3,-3,1,-1.66,5 cents,100 minutes,24 days,Male,University - Undergraduate,32,0.5,1,0,0,0,1,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,1,-1,0,-1,-1,1,-1,1,-2,0,1,-1,0,-4,0,-1,1,3,2,-3,-0.4,-0.2,-0.8,0.4,-0.25 +803,R_5poqvhw8eRGOHLk,32 - 38,American,Male,3,3,3,3,3,3,0,3,-1,2,3,3,3,0,3,2,3,2,2,1,3,3,3,3,3,2,1,-1,2,0,2,2,3,3,3,3,3,2,3,3,2,3,1,2,3,3,3,3,3,1,1,-1,3,-1,3,3,3,3,3,0,3,2,3,3,3,3,3,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,97,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,97,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0.9409,0,0,0,1,1,0.0009,1,0.283635714,0.214285714,0.352985714,31,96.88,23,71.88,8,100,5,62.5,6,75,4,50,12,75,11,68.75,99.81,100,99.25,100,100,100,99.62,25,27.93,0,36.75,25,50,25,30.87,0,0,0,0,0,2,1,1,1,0,0,0,0,3,0,1,0,0,1,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,1,0,1,1,2,0,1,0.6,0.4,0,0.8,0,1,0.5,0.45,2,2,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,1,1,-1,0,0,0,3,0,0,0,-1,0,-2,0,0.2,0.6,-0.6,0.05 +804,R_1OSX13Su1EVLJut,32 - 38,American,Male,2,2,3,1,1,1,1,1,0,2,1,1,2,2,1,3,2,1,2,1,2,1,2,3,1,8,3,2,1,1,1,7,2,1,3,2,1,8,3,1,2,1,2,7,3,0,2,1,2,6,2,0,2,1,1,4,2,3,1,3,2,8,2,1,2,1,1,9,TRUE,0,76,FALSE,0,75,TRUE,0,63,TRUE,0,77,FALSE,0,66,TRUE,0,71,TRUE,1,55,TRUE,1,64,FALSE,0,66,TRUE,1,74,TRUE,0,64,FALSE,1,64,TRUE,1,65,TRUE,0,83,FALSE,0,61,TRUE,1,70,TRUE,0,67,FALSE,1,71,TRUE,0,80,FALSE,1,92,TRUE,1,81,TRUE,1,61,TRUE,0,73,TRUE,1,65,TRUE,0,62,TRUE,1,66,FALSE,1,57,TRUE,0,92,TRUE,0,80,FALSE,0,62,TRUE,1,78,TRUE,1,75,0.1296,0.1156,0.09,0.2025,0.0625,0.5041,0.1225,0.0676,0.0064,0.1521,0.3844,0.1225,0.4356,0.4096,0.4356,0.5625,0.5329,0.5929,0.8464,0.3844,0.0361,0.3721,0.64,0.6889,0.4489,0.1849,0.0484,0.5776,0.3969,0.0841,0.64,0.1296,0.352482143,0.313657143,0.391307143,21,65.63,15,46.88,2,25,3,37.5,5,62.5,5,62.5,11,68.75,4,25,70.5,69.75,72.25,68.5,71.5,67.75,73.25,18.75,23.62,44.75,34.75,6,9,-1,48.25,0,1,1,2,0,2,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,2,1,0,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,0,0.8,1,0.4,0.8,1,1,1.2,0.8,0.75,1,7.67,6,2,3,0,-2,1.67,10 cents,25 minutes,24 days,Male,University - Undergraduate,34,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,-1,-1,0,2,-1,1,0,-1,0,0,0,-2,0,-1,-1,-1,0,0,0,1,-0.2,0,-0.8,0,-0.25 +805,R_7I3ZKe8VLaN9gvc,39 - 45,American,Male,3,3,2,3,3,2,2,2,1,1,2,1,2,2,1,1,2,2,1,3,2,2,1,2,1,7,0,1,2,1,1,6,1,-2,2,-1,1,7,1,1,1,0,0,8,1,1,0,2,1,5,0,1,0,1,1,8,1,0,0,2,1,9,2,1,1,2,1,8,TRUE,0,98,FALSE,0,55,FALSE,1,100,FALSE,1,60,TRUE,1,84,FALSE,1,100,FALSE,0,83,TRUE,1,100,FALSE,0,72,FALSE,0,75,FALSE,1,75,TRUE,0,64,TRUE,1,92,FALSE,1,91,TRUE,1,67,TRUE,1,89,TRUE,0,61,FALSE,1,79,TRUE,0,58,TRUE,0,70,FALSE,0,62,TRUE,1,64,TRUE,0,65,TRUE,1,79,TRUE,0,65,TRUE,1,100,TRUE,0,67,TRUE,0,57,FALSE,1,73,TRUE,1,50,FALSE,0,78,TRUE,1,100,0,0,0.0121,0.6889,0,0,0.0441,0.5625,0.49,0.1296,0.25,0.0064,0.5184,0.0625,0.0256,0.3025,0.4225,0.16,0.3249,0.4225,0.3844,0.1089,0.3364,0.0081,0.3721,0.4489,0.6084,0.9604,0,0.0441,0.0729,0.4096,0.266989286,0.212435714,0.321542857,12,37.5,17,53.13,3,37.5,5,62.5,4,50,5,62.5,10,62.5,7,43.75,76.03,66.5,79.62,81.88,76.12,78.12,73.94,-15.63,22.9,29,17.12,31.88,13.62,15.62,30.19,1,1,1,1,2,2,1,0,0,0,1,3,0,3,0,0,1,1,1,3,2,2,2,1,2,2,1,2,0,0,1,1,2,0,0,1,1,1,1,2,1.2,0.6,1.4,1.2,1.8,1,0.8,1.2,1.1,1.2,6.67,7.33,2,-2,-2,0,-0.66,10 cents,25 minutes,36 days,Male,University - Undergraduate,39,0,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,-1,-1,-1,0,0,0,0,-2,0,0,0,2,-2,3,0,-1,0,0,0,1,-0.6,-0.4,0.6,0,-0.1 +806,R_7RQGYuJcznE1sTy,25 - 31,Canadian,Female,2,3,3,1,0,0,0,1,-1,0,1,-1,0,0,1,0,0,1,1,0,3,3,3,1,0,5,-1,-2,1,-1,0,2,1,-1,0,0,1,5,0,0,1,0,0,5,2,3,3,2,0,5,1,-2,2,-1,1,2,2,-2,0,-1,0,4,0,0,1,0,0,5,TRUE,0,70,FALSE,0,65,TRUE,0,73,FALSE,1,64,FALSE,0,72,FALSE,1,65,TRUE,1,75,TRUE,1,71,FALSE,0,69,TRUE,1,83,FALSE,1,74,FALSE,1,61,FALSE,0,65,FALSE,1,64,FALSE,0,63,TRUE,1,77,FALSE,1,60,TRUE,0,76,FALSE,1,69,FALSE,1,61,TRUE,1,83,TRUE,1,82,FALSE,1,96,TRUE,1,89,FALSE,1,85,TRUE,1,84,FALSE,1,75,FALSE,1,76,TRUE,0,81,FALSE,0,85,TRUE,1,69,TRUE,1,96,0.0841,0.0256,0.0529,0.0625,0.0016,0.1225,0.0121,0.0289,0.1521,0.0324,0.7225,0.4225,0.4761,0.0676,0.5184,0.4225,0.0016,0.1296,0.0576,0.0225,0.0289,0.3969,0.0961,0.1296,0.16,0.0625,0.0961,0.49,0.5329,0.5776,0.6561,0.1521,0.234617857,0.222171429,0.247064286,13,40.63,22,68.75,5,62.5,5,62.5,6,75,6,75,10,62.5,12,75,74.31,68.5,77.25,77.38,74.12,76.75,71.88,-28.12,5.56,6,14.75,2.38,-0.88,14.25,-3.12,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,2,1,0,1,1,1,0,1,1,0,0,0,1,0,0.2,0.6,0,0.2,0.2,1,0.8,0.2,0.25,0.55,4,3.67,0,0,1,0,0.33,15 cents,100 minutes,47 days,Female,College Diploma/Certificate,31,0.125,0,0,1,0,1,0,0.33,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,0,0,-1,0,0,0,-1,0,-1,-1,-1,0,-1,-1,0,0,0,0,0,0,-0.4,-0.8,0,-0.3 +807,R_6uDtRv1gSz16lK6,25 - 31,American,Male,-1,3,-3,3,-3,1,0,1,3,3,-3,-3,-2,-3,3,-2,-2,-3,-3,-3,3,1,-3,-3,-3,5,3,-3,3,3,3,10,3,3,-3,0,-3,10,1,-3,1,1,-3,10,3,3,-3,0,3,6,3,-3,3,-3,3,9,-3,-3,3,-1,3,3,-1,-2,3,3,1,10,TRUE,0,95,FALSE,0,57,TRUE,0,91,FALSE,1,56,TRUE,1,82,TRUE,0,71,TRUE,1,69,TRUE,1,68,TRUE,1,71,TRUE,1,100,TRUE,0,73,TRUE,0,96,TRUE,1,75,TRUE,0,66,FALSE,0,55,FALSE,0,60,TRUE,0,93,TRUE,0,99,TRUE,0,57,TRUE,0,63,FALSE,0,57,TRUE,1,60,TRUE,0,74,TRUE,1,100,TRUE,0,57,TRUE,1,63,FALSE,1,51,TRUE,0,82,TRUE,0,93,FALSE,0,60,FALSE,0,61,TRUE,1,100,0.1024,0.1369,0.36,0.0961,0,0.5041,0,0,0.3969,0.16,0.36,0.0625,0.0841,0.5329,0.0324,0.3249,0.5476,0.1936,0.6724,0.3249,0.3249,0.3025,0.3249,0.4356,0.8649,0.2401,0.3721,0.9025,0.8281,0.9801,0.8649,0.9216,0.412803571,0.2285,0.597107143,23,71.88,12,37.5,3,37.5,3,37.5,4,50,2,25,10,62.5,2,12.5,73.59,60.12,80.62,76.12,77.5,71.12,76.06,34.38,36.09,22.62,43.12,26.12,52.5,8.62,63.56,4,2,0,6,0,2,3,2,0,0,6,6,1,3,6,3,1,4,4,0,4,0,0,3,6,2,3,2,6,0,0,0,5,2,0,1,0,6,6,4,2.4,1.4,4.4,2.4,2.6,2.6,1.4,3.4,2.65,2.5,8.33,6,-1,1,7,0,2.33,5 cents,100 minutes,47 days,Male,High School (or equivalent),25,1.25,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,2,0,3,-6,0,0,0,-6,0,6,6,-4,1,6,2,1,-2,-2,-4,-0.2,-1.2,3,-1,0.15 +808,R_37uBEKEHZ4l6BaN,25 - 31,Canadian,Female,2,2,1,1,1,0,1,0,0,2,1,1,1,0,1,0,1,1,2,2,0,0,1,1,1,8,0,1,0,1,1,8,1,1,0,1,1,7,1,1,1,0,2,6,1,1,0,0,-1,8,1,1,0,0,1,7,1,0,1,0,0,7,0,0,1,1,0,6,TRUE,0,82,FALSE,0,77,FALSE,1,75,FALSE,1,74,FALSE,0,74,FALSE,1,82,FALSE,0,100,FALSE,0,77,TRUE,1,84,FALSE,0,81,TRUE,0,81,FALSE,1,80,TRUE,1,87,TRUE,0,76,FALSE,0,75,FALSE,0,85,TRUE,0,79,TRUE,0,71,TRUE,0,86,FALSE,1,78,TRUE,1,82,FALSE,0,82,FALSE,1,76,FALSE,0,79,TRUE,0,74,TRUE,1,80,FALSE,1,77,TRUE,0,68,FALSE,1,87,TRUE,1,86,TRUE,1,80,FALSE,0,91,0.5929,0.04,0.7225,1,0.8281,0.0324,0.6241,0.6561,0.0484,0.6724,0.0196,0.0169,0.0256,0.6561,0.5476,0.5929,0.0576,0.0676,0.4624,0.5476,0.0324,0.5625,0.7396,0.5776,0.6241,0.0529,0.04,0.6724,0.0625,0.5041,0.0169,0.04,0.3493,0.3461,0.3525,16,50,14,43.75,4,50,5,62.5,1,12.5,4,50,6,37.5,8,50,80.19,79.25,82.25,80.75,78.5,82.5,77.88,6.25,36.44,29.25,19.75,68.25,28.5,45,27.88,2,2,0,0,0,0,0,0,1,1,0,0,1,1,0,1,0,0,2,0,1,1,1,1,2,1,0,0,0,1,0,1,0,0,1,0,1,0,1,2,0.8,0.4,0.4,0.6,1.2,0.4,0.4,0.8,0.55,0.7,7.67,7.33,0,1,0,0,0.34,10 cents,75 minutes,24 days,Female,University - Undergraduate,31,0.375,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,02DGEN,02REV,1,1,-1,-1,-2,-1,0,0,1,0,0,-1,1,1,-1,1,-1,0,1,-2,-0.4,0,0,-0.2,-0.15 +809,R_5PgAbxytNTVLYM9,25 - 31,Canadian,Female,-2,3,3,-1,3,3,-1,2,1,1,1,0,2,-2,2,2,1,1,1,-2,-1,-1,-1,1,1,5,1,-1,1,1,1,3,-2,-1,1,1,-1,5,1,1,1,-1,1,6,-2,-1,1,1,1,2,-2,-2,1,-1,1,4,1,1,-1,2,1,5,1,1,1,2,-1,6,TRUE,0,86,FALSE,0,50,TRUE,0,100,TRUE,0,67,FALSE,0,53,FALSE,1,100,TRUE,1,96,TRUE,1,83,FALSE,0,54,FALSE,0,81,FALSE,1,59,TRUE,0,98,FALSE,0,61,TRUE,0,58,FALSE,0,56,TRUE,1,87,TRUE,0,81,TRUE,0,83,FALSE,1,50,FALSE,1,52,TRUE,1,66,FALSE,0,62,FALSE,1,100,TRUE,1,61,TRUE,0,76,FALSE,0,56,FALSE,1,58,TRUE,0,73,TRUE,0,75,FALSE,0,69,TRUE,1,69,TRUE,1,100,0.0289,0.3136,0.0169,0.0016,0,0,0.1521,0.6561,0.2304,0.3844,0.4761,0.3721,0.2916,0.1681,0.2809,0.25,0,0.4489,0.5329,0.5776,0.1156,0.3136,0.25,0.3364,0.6561,0.1764,0.0961,0.7396,1,0.6889,0.5625,0.9604,0.382742857,0.26505,0.500435714,16,50,13,40.63,4,50,4,50,1,12.5,4,50,7,43.75,6,37.5,72.5,57.88,79.5,74.75,77.88,69,76,9.37,31.87,7.88,29.5,62.25,27.88,25.25,38.5,1,4,4,2,2,2,0,1,0,0,3,1,1,3,3,1,0,0,2,3,0,4,2,2,2,5,1,1,2,0,0,1,3,4,1,1,0,0,1,1,2.6,0.6,2.2,1.2,2,1.8,1.8,0.6,1.65,1.55,4.33,3.67,3,-1,0,0,0.66,10 cents,100 minutes,24 days,Female,University - Undergraduate,26,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,0,2,0,0,-3,-1,0,-2,0,3,0,-2,-1,2,0,0,0,1,2,0.6,-1.2,0.4,0.6,0.1 +810,R_3pQtt2jkjulJS6g,32 - 38,American,Male,3,3,3,3,3,2,0,0,-1,3,3,0,2,0,2,1,2,2,2,0,3,3,0,3,1,5,2,3,1,1,3,5,1,2,1,1,0,5,0,0,1,1,2,4,3,3,3,3,3,6,3,3,0,1,1,5,0,2,2,1,2,5,1,1,0,0,0,6,TRUE,0,81,TRUE,1,62,TRUE,0,76,TRUE,0,59,TRUE,1,68,TRUE,0,67,TRUE,1,65,TRUE,1,67,TRUE,1,63,TRUE,1,57,TRUE,0,60,TRUE,0,64,TRUE,1,65,TRUE,0,59,TRUE,1,59,TRUE,1,69,TRUE,0,59,TRUE,0,65,TRUE,0,67,TRUE,0,65,TRUE,1,68,TRUE,1,78,TRUE,0,72,TRUE,1,74,TRUE,0,66,TRUE,1,70,TRUE,0,81,TRUE,0,77,TRUE,0,72,TRUE,1,76,TRUE,1,70,TRUE,1,65,0.1089,0.09,0.0961,0.1225,0.1225,0.4489,0.0676,0.1849,0.4225,0.0484,0.0576,0.1225,0.1369,0.36,0.1024,0.1444,0.5184,0.3481,0.5929,0.4356,0.1024,0.1681,0.4489,0.3481,0.3481,0.6561,0.09,0.6561,0.5776,0.4225,0.5184,0.4096,0.316410714,0.220364286,0.412457143,29,90.63,16,50,4,50,4,50,4,50,4,50,16,100,0,0,67.69,65.12,67,67.62,71,67.25,68.12,40.63,17.69,15.12,17,17.62,21,-32.75,68.12,0,0,3,0,2,0,3,1,2,0,2,2,1,1,2,1,2,1,1,2,0,0,0,0,0,1,3,0,2,2,3,2,0,1,0,0,1,2,2,0,1,1.2,1.6,1.4,0,1.6,1.2,1,1.3,0.95,5,5.33,-1,0,0,-2,-0.33,10 cents,25 minutes,24 days,Male,Professional Degree (ex. JD/MD),34,0.125,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,3,0,2,-1,0,1,0,-2,-1,0,1,0,2,1,1,-1,-1,2,1,-0.4,0.4,0.4,0.35 +811,R_123oEnenHpDVSrq,25 - 31,Canadian,Female,3,3,3,-1,3,2,0,3,1,1,2,-3,1,1,2,0,1,2,2,-2,3,3,3,-3,-2,6,3,-3,-3,1,0,9,3,-2,-3,-3,1,8,-3,0,1,0,0,5,3,3,3,1,3,6,0,2,1,1,1,8,3,0,2,-2,3,4,2,1,1,2,-1,6,TRUE,0,91,TRUE,1,50,TRUE,0,98,FALSE,1,50,TRUE,1,100,FALSE,1,85,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,73,TRUE,0,51,TRUE,0,80,TRUE,1,50,FALSE,1,87,FALSE,0,50,FALSE,0,50,FALSE,1,64,TRUE,0,75,TRUE,0,50,FALSE,1,50,FALSE,0,88,FALSE,0,50,FALSE,1,66,FALSE,0,50,TRUE,0,96,TRUE,1,58,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,94,FALSE,0,51,TRUE,1,100,0.25,0.1764,0.25,0.25,0,0.0225,0.25,0.0729,0.25,0.25,0.8836,0.25,0.25,0.2601,0,0.25,0.1156,0.25,0.25,0.9216,0.7744,0.25,0.25,0.0169,0.1296,0.25,0.2601,0.8281,0.9604,0.5625,0.25,0.64,0.337439286,0.221764286,0.453114286,14,43.75,18,56.25,4,50,7,87.5,4,50,3,37.5,9,56.25,9,56.25,65.84,50.25,75.38,72.5,65.25,63.38,68.31,-12.5,9.59,0.25,-12.12,22.5,27.75,7.13,12.06,0,0,0,2,5,1,3,6,0,1,1,1,4,4,1,3,1,1,2,2,0,0,0,2,0,2,2,2,0,0,1,3,1,3,1,2,0,1,0,1,1.4,2.2,2.2,1.8,0.4,1.2,1.8,0.8,1.9,1.05,7.67,6,0,1,4,-1,1.67,10 cents,25 minutes,15 days,Female,University - Graduate (Masters),27,0.875,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,5,-1,1,4,0,1,0,-2,3,1,0,1,1,0,2,1,1,1,0.4,1,0.85 +812,R_5G30NJQga0bbt5f,18 - 24,American,Male,3,2,2,2,2,3,1,2,1,2,3,2,3,3,3,2,1,2,2,2,1,2,1,2,1,3,-1,1,1,1,1,3,2,1,2,1,2,3,1,1,1,2,2,8,3,3,2,2,2,2,2,1,3,1,3,4,3,2,3,2,3,4,2,3,2,2,2,6,TRUE,0,100,TRUE,1,71,TRUE,0,89,FALSE,1,86,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,98,TRUE,0,88,TRUE,0,79,TRUE,1,92,FALSE,1,70,TRUE,1,84,TRUE,1,87,FALSE,1,80,TRUE,0,100,FALSE,1,94,FALSE,1,98,TRUE,1,95,TRUE,1,96,TRUE,0,93,TRUE,1,99,FALSE,1,93,TRUE,1,91,FALSE,1,65,TRUE,0,88,TRUE,0,90,TRUE,1,90,TRUE,1,66,TRUE,1,95,0.0009,0.0081,0.0169,0,0.0025,0,0.0001,0.0004,0.0004,0.0016,0.01,0.0064,0,0.7744,0.0004,0.0841,0.8649,0.0196,0.7744,0.0049,0.0025,0.0256,0.0036,0.09,0.04,0.1225,0.1156,1,0.7921,1,0.81,0.6241,0.256075,0.126057143,0.386092857,25,78.13,24,75,7,87.5,6,75,6,75,5,62.5,16,100,8,50,89.75,81.75,92.88,93.5,90.88,91.19,88.31,3.13,14.75,-5.75,17.88,18.5,28.38,-8.81,38.31,2,0,1,0,1,4,0,1,0,1,1,1,1,2,1,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,2,0,0,0,0.8,1.2,1.2,0.4,0.2,0.6,0.2,0.4,0.9,0.35,3,3.33,1,-1,-1,2,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),19,1.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,-1,1,0,1,3,0,0,0,0,1,1,1,1,1,1,-2,1,0,0,0.6,0.6,1,0,0.55 +813,R_7N4mmETX5ChvFfP,25 - 31,Canadian,Male,2,2,2,2,-1,0,0,1,1,1,1,1,1,2,1,1,1,1,1,1,-1,0,1,1,-1,5,-1,-1,-2,0,-1,7,-1,0,-1,1,1,7,-1,-1,-1,-1,-1,8,2,3,3,3,1,6,0,1,2,1,1,6,2,2,2,2,2,6,2,2,2,2,3,6,FALSE,1,100,TRUE,1,100,TRUE,0,94,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,0,100,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,64,FALSE,0,100,TRUE,0,55,FALSE,1,54,TRUE,0,92,TRUE,1,92,TRUE,1,80,TRUE,1,100,0,1,0,0,0,0,0,0,0.0225,0.2116,0.0064,1,0,0,0,0,0,0.04,0.2116,0.1296,1,0,0,0,0,0.3025,0.04,0,0.8836,0,0.8464,0,0.16765,0.091464286,0.243835714,26,81.25,26,81.25,7,87.5,5,62.5,7,87.5,7,87.5,13,81.25,13,81.25,92.19,89.38,99,89.75,90.62,95.38,89,0,10.94,1.88,36.5,2.25,3.12,14.13,7.75,3,2,1,1,0,1,1,3,1,2,2,1,2,1,0,2,2,2,2,2,0,1,1,1,2,0,1,1,0,0,1,1,1,0,1,1,1,1,1,2,1.4,1.6,1.2,2,1,0.4,0.8,1.2,1.55,0.85,6.33,6,-1,1,1,2,0.33,10 cents,5 minutes,47 days,Male,High School (or equivalent),29,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,3,1,0,0,-2,1,0,2,1,2,1,0,1,1,-1,1,1,1,1,0,0.4,1.2,0.4,0.8,0.7 +814,R_5EXqrTpgDzX2xJk,25 - 31,Canadian,Female,-1,0,1,1,0,1,0,0,1,1,0,0,1,-1,1,1,0,0,1,0,1,1,1,0,0,6,1,1,0,1,0,6,1,0,-1,0,1,6,1,1,0,0,1,6,0,1,0,-1,1,6,0,0,0,1,1,6,0,1,1,0,1,6,0,1,1,1,0,6,TRUE,0,57,TRUE,1,56,TRUE,0,58,FALSE,1,61,TRUE,1,67,TRUE,0,63,TRUE,1,63,TRUE,1,64,FALSE,0,65,TRUE,1,68,FALSE,1,69,TRUE,0,69,FALSE,0,69,FALSE,1,61,FALSE,0,65,FALSE,0,67,FALSE,1,67,TRUE,0,68,FALSE,1,63,FALSE,1,52,FALSE,0,65,FALSE,0,67,FALSE,1,84,FALSE,0,77,FALSE,1,87,TRUE,1,89,FALSE,1,55,FALSE,1,68,TRUE,0,64,TRUE,1,90,FALSE,0,74,TRUE,1,94,0.1296,0.0121,0.4489,0.1369,0.0036,0.3969,0.5929,0.1024,0.2304,0.4489,0.01,0.4761,0.4225,0.0961,0.1089,0.1936,0.0256,0.1521,0.1024,0.0169,0.4225,0.4225,0.1369,0.1521,0.1089,0.2025,0.5476,0.3249,0.3364,0.4624,0.4096,0.4761,0.263632143,0.232857143,0.294407143,16,50,18,56.25,5,62.5,4,50,5,62.5,4,50,8,50,10,62.5,68.31,63.5,71.62,70,68.12,71.25,65.38,-6.25,12.06,1,21.62,7.5,18.12,21.25,2.88,2,1,0,1,0,0,1,0,0,1,1,0,2,1,0,0,1,0,1,1,1,1,1,2,1,1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0.8,0.4,0.8,0.6,1.2,0.2,0.4,0.6,0.65,0.6,6,6,0,0,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,30,0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,1,0,-1,-1,-1,-1,1,0,0,1,1,-1,2,0,0,-1,0,-1,1,1,-0.4,0.2,0.4,0,0.05 +815,R_5RrN123xKRLl9vD,18 - 24,Canadian,Female,-1,3,2,3,2,3,2,3,1,1,3,-1,3,1,3,-1,1,1,1,-2,2,1,3,-1,1,4,1,-1,1,3,1,7,3,1,3,2,3,6,-1,1,-2,1,0,7,1,3,2,3,2,3,3,2,3,1,3,4,3,-1,3,0,3,5,2,3,2,3,0,6,TRUE,0,79,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,84,TRUE,1,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,87,TRUE,0,50,TRUE,1,79,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,56,TRUE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,62,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,0,74,TRUE,1,100,TRUE,0,50,TRUE,0,86,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,1,73,0,0,1,0.25,0.0729,0.0256,0.25,0,0.25,0.25,1,0.0441,0.25,0.0169,0.25,0.25,0,0.25,0.7396,0.5476,0.1444,1,0.25,0,0.3136,0.25,0.25,0.6241,1,1,0.25,0.25,0.340314286,0.207821429,0.472807143,13,40.63,14,43.75,3,37.5,5,62.5,4,50,2,25,8,50,6,37.5,72.81,60.88,69.25,81.62,79.5,72.75,72.88,-3.12,29.06,23.38,6.75,31.62,54.5,22.75,35.38,3,2,1,4,1,2,3,2,2,0,0,2,0,1,0,0,0,3,0,2,2,0,0,0,0,0,0,0,0,2,0,0,0,1,0,3,2,1,2,2,2.2,1.8,0.6,1,0.4,0.4,0.2,2,1.4,0.75,5.67,4,1,3,1,1,1.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,1,2,1,4,1,2,3,2,2,-2,0,2,0,0,0,-3,-2,2,-2,0,1.8,1.4,0.4,-1,0.65 +816,R_62lx4D4mSWS2N0p,39 - 45,American,Male,2,3,2,2,3,2,1,3,-1,3,2,0,2,2,2,2,2,1,2,0,3,2,2,-1,0,8,1,0,2,2,1,9,2,1,1,1,2,9,0,2,1,2,-1,9,2,3,2,2,2,8,1,0,2,0,2,9,2,2,2,2,1,8,3,2,2,2,3,9,TRUE,0,100,FALSE,0,58,TRUE,0,58,TRUE,0,58,FALSE,0,58,TRUE,0,69,FALSE,0,60,TRUE,1,58,TRUE,1,56,TRUE,1,61,TRUE,0,60,TRUE,0,91,TRUE,1,77,TRUE,0,61,TRUE,1,76,TRUE,1,60,TRUE,0,80,TRUE,0,57,FALSE,1,57,FALSE,1,59,TRUE,1,63,FALSE,0,60,FALSE,1,57,FALSE,0,60,TRUE,0,63,TRUE,1,72,FALSE,1,57,TRUE,0,77,FALSE,1,58,TRUE,1,73,TRUE,1,96,TRUE,1,87,0.1764,0.0784,0.16,0.36,0.0169,0.4761,0.36,0.1521,0.1681,0.36,0.0729,0.0529,0.1936,0.36,0.3364,0.3364,0.1849,0.3364,0.5929,0.3969,0.1369,0.0576,0.1849,0.3721,0.64,0.1849,0.0016,1,0.3364,0.3249,0.1764,0.8281,0.308582143,0.243335714,0.373828571,16,50,16,50,5,62.5,5,62.5,2,25,4,50,11,68.75,5,31.25,66.78,64.75,68.62,66.75,67,67.19,66.38,0,16.78,2.25,6.12,41.75,17,-1.56,35.13,1,1,0,3,3,1,1,1,3,2,0,1,1,1,0,2,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,2,0,0,1,1,0,1,0,3,1.6,1.6,0.6,0.6,0.2,1,0.6,1,1.1,0.7,8.67,8.33,0,0,1,0,0.34,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),41,0,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,1,0,3,2,0,0,0,2,1,0,-1,1,1,-1,1,0,-1,0,-2,1.4,0.6,0,-0.4,0.4 +817,R_7dLFcejCIvzD4qy,32 - 38,American,Male,1,3,3,2,2,2,0,2,0,2,2,2,2,2,2,2,2,2,2,2,1,3,3,2,3,7,2,2,2,0,2,8,3,2,2,2,0,6,2,2,2,2,2,8,1,3,3,3,3,7,2,2,2,0,2,6,2,2,2,2,2,7,2,2,2,2,2,6,TRUE,0,100,FALSE,0,98,TRUE,0,82,FALSE,1,70,TRUE,1,78,FALSE,1,85,TRUE,1,100,FALSE,0,93,TRUE,1,90,FALSE,0,79,TRUE,0,92,TRUE,0,87,TRUE,1,86,FALSE,1,83,FALSE,0,86,TRUE,1,91,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,93,FALSE,0,60,FALSE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,77,TRUE,0,76,TRUE,0,92,FALSE,0,95,FALSE,0,100,TRUE,1,96,0.8649,0,0.0081,0,0.0016,0.0225,0.0009,0.6241,0.0025,0.36,0.9025,0.0196,0.01,0.8464,0.0484,0.9604,0,0.09,0.5776,0,0.8649,0.7396,0,0.0289,0,0.0529,1,1,0.6724,1,0.8464,0.7569,0.408160714,0.277778571,0.538542857,16,50,17,53.13,4,50,6,75,4,50,3,37.5,8,50,9,56.25,90.03,89.12,91.25,90.25,89.5,90.12,89.94,-3.13,36.9,39.12,16.25,40.25,52,40.12,33.69,0,0,0,0,1,0,2,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,1,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0.6,0,0.4,0.4,0,0,0.3,0.2,7,6.67,0,2,-1,2,0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,-0.2,0,0.6,0,0.1 +818,R_6w6U2sqxn4Hih1I,39 - 45,American,Male,2,2,2,0,2,1,-1,2,0,2,2,2,3,-1,2,1,2,2,1,3,1,3,3,1,2,6,2,2,2,3,2,7,2,2,0,3,2,7,1,1,2,2,3,8,2,3,2,2,3,8,-2,-2,2,0,2,7,3,-1,0,-1,1,8,1,2,3,2,3,6,FALSE,1,93,TRUE,1,88,FALSE,1,93,TRUE,0,86,TRUE,1,62,FALSE,1,87,TRUE,1,87,TRUE,1,83,TRUE,1,88,TRUE,1,87,FALSE,1,89,FALSE,1,90,FALSE,0,92,FALSE,1,82,FALSE,0,90,TRUE,1,87,FALSE,1,92,TRUE,0,90,FALSE,1,84,FALSE,1,88,TRUE,1,91,TRUE,1,96,FALSE,1,94,TRUE,1,89,FALSE,1,88,TRUE,1,93,FALSE,1,87,FALSE,1,92,FALSE,1,87,TRUE,1,87,TRUE,1,87,TRUE,1,89,0.0289,0.0049,0.0169,0.0169,0.0121,0.0169,0.0121,0.0169,0.0144,0.0016,0.0169,0.8464,0.0144,0.0121,0.1444,0.0144,0.0036,0.7396,0.0064,0.0144,0.0081,0.81,0.0256,0.0324,0.0064,0.0169,0.0169,0.0049,0.0049,0.81,0.0169,0.01,0.130342857,0.133271429,0.127414286,29,90.63,28,87.5,6,75,7,87.5,7,87.5,8,100,14,87.5,14,87.5,88.06,87.38,86.75,89.5,88.62,87.25,88.88,3.13,0.56,12.38,-0.75,2,-11.38,-0.25,1.38,1,1,1,1,0,1,3,0,3,0,0,0,3,4,0,0,1,0,1,0,0,1,0,2,1,3,1,0,0,0,1,3,3,0,1,0,0,1,1,0,0.8,1.4,1.4,0.4,0.8,0.8,1.6,0.4,1,0.9,6.67,7.67,-2,0,-1,2,-1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),44,0.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,1,-1,-1,-2,2,0,3,0,-1,-3,0,4,-1,0,1,-1,0,0,0,0.6,-0.2,0,0.1 +819,R_6nQ22abOSqXFXJk,18 - 24,Canadian,Female,3,3,1,1,2,2,1,1,-2,2,3,2,3,2,3,-3,-3,-3,-3,-3,1,3,3,-1,2,4,0,-1,-2,-2,0,7,0,-1,1,0,0,7,0,-3,-3,-3,-3,8,3,3,3,2,3,7,3,-1,3,-3,3,5,3,3,3,2,3,9,2,1,2,1,-3,9,FALSE,1,71,TRUE,1,63,TRUE,0,95,FALSE,1,57,TRUE,1,100,FALSE,1,75,TRUE,1,97,TRUE,1,81,TRUE,1,55,TRUE,1,94,TRUE,0,59,TRUE,0,87,FALSE,0,71,TRUE,0,69,TRUE,1,65,FALSE,0,84,FALSE,1,80,TRUE,0,89,TRUE,0,94,TRUE,0,94,TRUE,1,79,TRUE,1,60,FALSE,1,62,TRUE,1,100,TRUE,0,88,TRUE,1,91,FALSE,1,55,TRUE,0,67,TRUE,0,100,TRUE,1,80,TRUE,1,71,FALSE,0,59,0.0361,0.0081,0.7056,0.0009,0.3481,0.0625,0,0.0036,0.8836,0.16,0.04,0.5041,0.2025,0.3481,0,0.1369,0.1444,0.1849,0.4489,0.7744,0.0441,0.1225,0.8836,0.4761,0.04,0.2025,0.0841,0.0841,0.9025,0.7921,1,0.7569,0.343946429,0.215621429,0.472271429,15,46.88,19,59.38,6,75,5,62.5,5,62.5,3,37.5,13,81.25,6,37.5,77.88,64.88,78.25,82.38,86,78.12,77.62,-12.5,18.5,-10.12,15.75,19.88,48.5,-3.13,40.12,2,0,2,2,0,2,2,3,0,2,3,3,2,2,3,3,0,0,0,0,0,0,2,1,1,1,2,2,1,1,0,1,0,0,0,5,4,5,4,0,1.2,1.8,2.6,0.6,0.8,1.4,0.2,3.6,1.55,1.5,6,7,-3,2,-2,-1,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),19,0.125,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,2,0,0,1,-1,1,0,1,-1,1,3,2,2,2,3,-2,-4,-5,-4,0,0.4,0.4,2.4,-3,0.05 +820,R_5jiUES1850eL6yD,39 - 45,American,Male,2,3,3,1,2,0,-3,2,-1,2,3,2,3,0,3,-3,-2,-1,-3,-3,2,3,3,2,2,6,0,-2,3,-2,2,5,3,1,2,0,3,7,-2,1,0,-2,-3,8,3,3,3,1,3,7,0,-2,1,-2,2,5,3,2,3,0,3,8,0,0,0,0,-3,9,FALSE,1,78,FALSE,0,59,TRUE,0,90,TRUE,0,73,FALSE,0,50,TRUE,0,66,TRUE,1,93,FALSE,0,52,FALSE,0,50,TRUE,1,55,FALSE,1,80,TRUE,0,100,TRUE,1,50,FALSE,1,58,FALSE,0,70,TRUE,1,76,FALSE,1,51,TRUE,0,98,FALSE,1,54,FALSE,1,93,TRUE,1,86,TRUE,1,74,FALSE,1,59,TRUE,1,69,FALSE,1,50,FALSE,0,53,FALSE,1,56,FALSE,1,70,FALSE,1,67,TRUE,1,68,TRUE,1,65,FALSE,0,90,0.2704,0.2809,0.0576,0.0049,0.81,0.4356,0.0961,0.2025,0.0049,0.0676,0.1024,0.25,0.25,0.04,0.25,0.3481,0.1681,0.5329,0.09,0.25,0.0196,0.49,0.2116,0.1764,0.2401,0.1936,0.1225,0.0484,0.81,0.9604,0.1089,1,0.295703571,0.254157143,0.33725,11,34.38,20,62.5,4,50,5,62.5,6,75,5,62.5,9,56.25,11,68.75,68.84,63.38,64.88,69.88,77.25,66.25,71.44,-28.12,6.34,13.38,2.38,-5.12,14.75,10,2.69,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,3,1,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,3,2,1,3,0,0.2,0.6,0.4,1.2,0.4,0.6,0,1.8,0.6,0.7,6,6.67,-1,0,-1,-1,-0.67,10 cents,25 minutes,36 days,Male,High School (or equivalent),43,0.75,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,-1,0,0,1,-1,0,0,0,0,0,0,1,1,0,0,-2,1,0,-2,0,-0.2,0,0.4,-0.6,-0.1 +821,R_50JdB3gPcLim8aj,18 - 24,Canadian,Female,3,3,-2,-1,1,-1,1,3,1,2,2,3,3,-1,3,0,0,0,0,-3,3,3,2,2,3,3,-3,-3,1,3,1,5,3,0,3,2,3,3,-1,-3,-3,-3,-3,10,2,2,0,0,2,3,-1,1,2,-1,1,2,2,1,3,0,3,4,1,1,1,1,-3,10,TRUE,0,70,FALSE,0,53,TRUE,0,65,TRUE,0,70,TRUE,1,80,FALSE,1,90,TRUE,1,93,TRUE,1,87,FALSE,0,52,TRUE,1,72,TRUE,0,60,TRUE,0,64,TRUE,1,63,FALSE,1,73,TRUE,1,72,FALSE,0,62,TRUE,0,73,FALSE,1,100,TRUE,0,52,TRUE,0,51,FALSE,0,52,FALSE,0,52,TRUE,0,52,TRUE,1,64,FALSE,1,96,TRUE,1,98,TRUE,0,51,FALSE,1,67,TRUE,0,68,TRUE,1,70,FALSE,0,51,TRUE,1,51,0.0169,0.0004,0.3844,0.0049,0.2401,0.01,0.1296,0.0784,0.2601,0.2704,0.09,0.1369,0.2704,0.36,0.04,0.2809,0.2704,0.49,0.1089,0.0016,0.2704,0.0784,0.2704,0.0729,0.5329,0.2601,0.2601,0.49,0.4225,0,0.4624,0.4096,0.23455,0.209085714,0.260014286,5,15.63,15,46.88,1,12.5,4,50,6,75,4,50,10,62.5,5,31.25,67.94,57.62,66.12,81.75,66.25,67,68.88,-31.25,21.06,45.12,16.12,6.75,16.25,4.5,37.63,0,0,4,3,2,2,4,2,2,1,1,3,0,3,0,1,3,3,3,0,1,1,2,1,1,0,0,1,2,1,0,2,0,1,0,1,1,1,1,0,1.8,2.2,1.4,2,1.2,0.8,0.6,0.8,1.85,0.85,3.67,3,0,3,-1,0,0.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,-1,2,2,1,2,4,1,0,0,1,1,0,2,0,0,2,2,2,0,0.6,1.4,0.8,1.2,1 +822,R_6LsULTfUjm0kP9T,18 - 24,Canadian,Male,1,3,1,2,3,1,0,2,-1,3,1,0,3,0,2,2,2,1,2,2,-3,1,3,3,3,7,3,-3,-1,1,0,4,2,-3,3,3,-2,3,2,2,3,3,3,4,2,3,2,3,3,4,2,3,3,-1,3,3,1,-1,3,1,0,3,1,1,2,2,2,2,FALSE,1,50,TRUE,1,50,TRUE,0,98,TRUE,0,54,FALSE,0,50,TRUE,0,70,TRUE,1,88,FALSE,0,50,TRUE,1,65,FALSE,0,59,TRUE,0,52,TRUE,0,99,FALSE,0,100,FALSE,1,86,FALSE,0,50,TRUE,1,58,TRUE,0,63,TRUE,0,100,TRUE,0,53,TRUE,0,83,TRUE,1,100,TRUE,1,91,FALSE,1,77,TRUE,1,50,FALSE,1,50,TRUE,1,76,FALSE,1,51,FALSE,1,100,TRUE,0,54,TRUE,1,100,FALSE,0,50,FALSE,0,68,0.25,0.0576,0.1764,0.0144,0.4624,0.49,0.25,0.3481,0.6889,0.0081,0,1,0.1225,0.2704,0.25,0.25,0.0529,0.2916,0,0.25,0,0.25,0.2809,0.0196,0.3969,0.2401,0.25,0.25,0.9604,1,0.2916,0.9801,0.344803571,0.32035,0.369257143,12,37.5,15,46.88,3,37.5,2,25,6,75,4,50,9,56.25,6,37.5,70.16,53.12,72.75,75,79.75,69.06,71.25,-9.38,23.28,15.62,47.75,0,29.75,12.81,33.75,4,2,2,1,0,2,3,3,2,3,1,3,0,3,4,0,0,2,1,1,1,0,1,1,0,1,3,1,0,0,0,1,0,1,2,1,1,1,0,0,1.8,2.6,2.2,0.8,0.6,1,0.8,0.6,1.85,0.75,4.67,3.33,3,1,0,2,1.34,5 cents,100 minutes,36 days,Male,University - Undergraduate,23,1.375,1,0,0,0,1,0,0.33,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,3,2,1,0,0,1,0,2,2,3,1,2,0,2,2,-1,-1,1,1,1,1.2,1.6,1.4,0.2,1.1 +823,R_3L1API9vGOPA5Md,18 - 24,Canadian,Female,1,3,-1,1,1,-2,1,1,3,1,3,1,2,1,3,-2,-1,1,1,0,2,2,2,3,3,4,-3,2,-1,3,-2,6,3,3,-1,0,2,7,1,0,2,1,2,5,2,3,1,0,3,7,2,1,2,-1,3,7,3,1,3,2,3,3,3,3,3,3,3,8,TRUE,0,76,FALSE,0,54,TRUE,0,100,FALSE,1,52,FALSE,0,52,FALSE,1,100,TRUE,1,52,FALSE,0,60,FALSE,0,59,TRUE,1,85,FALSE,1,51,TRUE,0,90,TRUE,1,51,FALSE,1,55,FALSE,0,51,FALSE,0,52,FALSE,1,52,TRUE,0,85,FALSE,1,51,FALSE,1,51,TRUE,1,79,FALSE,0,54,FALSE,1,65,TRUE,1,81,FALSE,1,100,TRUE,1,83,FALSE,1,55,FALSE,1,87,TRUE,0,54,FALSE,0,74,FALSE,0,57,TRUE,1,65,0.36,0.0289,0.2704,0.2304,0.1225,0,0.0361,0.0225,0.2401,0.2916,0.5476,0.2401,0.3481,0.2401,0.2704,0.2916,0.1225,0.2304,0.0169,0,0.0441,0.2601,0.2401,0.2025,0.2304,0.2025,0.3249,0.5776,1,0.7225,0.2916,0.81,0.2831,0.214542857,0.351657143,8,25,18,56.25,4,50,6,75,5,62.5,3,37.5,7,43.75,11,68.75,66.66,53.75,64.75,73.75,74.38,63.06,70.25,-31.25,10.41,3.75,-10.25,11.25,36.88,19.31,1.5,1,1,3,2,2,1,1,2,0,3,0,2,3,1,1,3,1,1,0,2,1,0,2,1,2,4,0,1,4,2,0,0,1,1,0,5,4,2,2,3,1.8,1.4,1.4,1.4,1.2,2.2,0.4,3.2,1.5,1.75,5.67,5.67,-3,-1,4,-3,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),18,0.625,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,1,1,1,0,-3,1,1,-4,1,0,2,2,0,1,-2,-3,-1,-2,-1,0.6,-0.8,1,-1.8,-0.25 +824,R_1lDrQCEn5qubXel,32 - 38,American,Male,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,-3,3,-3,3,5,3,3,3,3,3,0,-3,-3,-3,-3,-3,10,3,3,3,3,3,10,3,-3,3,3,3,10,3,3,3,3,3,0,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,0,100,0,1,0,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0.214285714,0.357142857,0.071428571,32,100,25,78.13,8,100,5,62.5,6,75,6,75,10,62.5,15,93.75,100,100,100,100,100,100,100,21.87,21.87,0,37.5,25,25,37.5,6.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,1.2,0,0,1.5,0.3,1.67,6.67,-10,-5,0,5,-5,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),38,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,-6,0,0,0,0,0,0,6,6,6,6,6,0,-1.2,0,6,1.2 +825,R_7CPiwAiwByBo9QO,39 - 45,American,Male,1,3,2,3,2,3,1,2,3,2,3,2,2,1,1,3,2,3,2,1,2,2,1,3,3,10,2,3,2,3,1,10,1,2,3,3,2,10,3,1,2,2,3,10,3,2,3,2,1,10,3,2,2,3,1,10,2,1,3,2,3,10,3,2,3,2,1,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,99,TRUE,1,97,FALSE,1,99,TRUE,1,99,TRUE,1,98,TRUE,1,96,TRUE,1,97,FALSE,1,98,TRUE,0,100,FALSE,0,100,FALSE,1,93,TRUE,1,95,TRUE,1,99,FALSE,1,97,TRUE,0,99,FALSE,1,98,FALSE,1,100,TRUE,1,99,TRUE,1,99,FALSE,1,100,TRUE,1,97,FALSE,1,97,TRUE,1,99,FALSE,1,100,FALSE,1,94,FALSE,1,95,TRUE,1,96,TRUE,1,93,TRUE,1,100,0.0004,0.0001,0.0001,0.0001,0,0.0001,0.0009,0.0009,0,0.0001,0.0016,1,0.0016,0.0004,0.0009,0,0,0.9801,0.0036,0.0009,0.0001,0.0025,0.0004,0.0049,0.0009,0,0.0049,0,0,0.9801,0.0025,1,0.142407143,0.1419,0.142914286,32,100,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,15,93.75,13,81.25,97.91,97.38,98.38,97.88,98,97.75,98.06,12.5,10.41,9.88,10.88,10.38,10.5,4,16.81,1,1,1,0,1,1,2,0,0,1,2,0,1,2,1,0,1,1,0,2,2,1,1,1,1,0,1,0,0,1,1,1,1,1,2,0,0,0,0,0,0.8,0.8,1.2,0.8,1.2,0.4,1.2,0,0.9,0.7,10,10,0,0,0,0,0,15 cents,25 minutes,24 days,Male,University - Graduate (Masters),43,0,0,0,0,0,0,1,0,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-1,0,0,-1,0,1,1,0,0,0,1,-1,0,1,-1,0,1,1,0,2,-0.4,0.4,0,0.8,0.2 +826,R_5FWZQLK0B9joAw1,25 - 31,Canadian,Male,1,2,1,0,1,0,1,0,-1,0,-1,-1,2,1,0,0,-1,1,0,0,0,1,0,1,-1,3,-2,-1,-1,1,-1,5,0,-1,0,1,0,6,-1,-1,-1,-1,-1,4,1,2,0,1,1,5,1,0,1,-1,1,6,0,0,1,1,1,6,1,1,1,1,0,5,FALSE,1,87,FALSE,0,67,FALSE,1,73,TRUE,0,100,FALSE,0,50,TRUE,0,67,TRUE,1,64,FALSE,0,63,TRUE,1,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,82,FALSE,0,50,TRUE,1,100,TRUE,0,78,TRUE,0,92,FALSE,1,67,FALSE,1,100,FALSE,0,67,FALSE,0,58,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,64,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,89,FALSE,0,50,FALSE,0,58,0.3969,0.4096,0,0.1296,0.3364,0.4489,0.25,0.25,0,0.3364,0.7921,0,0.25,1,0.25,0.4489,0.25,1,0,0.25,0.4489,0.25,0.1089,0.0324,0.6084,0.25,0.25,0.0169,0.0729,0.8464,0.25,1,0.357053571,0.400907143,0.3132,15,46.88,14,43.75,3,37.5,3,37.5,4,50,4,50,4,25,10,62.5,71.12,66.75,65,68.38,84.38,64.38,77.88,3.13,27.37,29.25,27.5,18.38,34.38,39.38,15.38,1,1,1,1,2,2,2,1,2,1,1,0,2,0,0,1,0,2,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,0,1,1,2,0,1,0,1.2,1.6,0.6,1,0.4,0.8,0.8,0.8,1.1,0.7,4.67,5.67,-2,-1,0,-1,-1,10 cents,25 minutes,24 days,Male,University - Undergraduate,27,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,1,0,0,2,1,1,0,2,0,0,-1,1,0,-1,0,-2,2,0,1,0.8,0.8,-0.2,0.2,0.4 +827,R_3PdTdTVt4EZ5LdO,25 - 31,American,Male,1,3,2,0,1,1,-1,2,-1,2,2,2,2,3,3,1,1,1,1,0,-1,3,0,-3,3,5,0,-3,2,0,3,4,3,3,3,3,2,6,-1,2,1,0,0,8,2,3,1,0,1,3,1,-3,3,-3,2,0,3,3,3,-1,3,5,3,3,3,3,3,8,TRUE,0,67,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,58,FALSE,1,100,TRUE,1,83,FALSE,0,66,TRUE,1,59,TRUE,1,71,TRUE,0,64,TRUE,0,76,TRUE,1,84,TRUE,0,69,TRUE,1,57,TRUE,1,68,TRUE,0,69,TRUE,0,95,TRUE,0,91,TRUE,0,64,TRUE,1,80,FALSE,0,50,TRUE,0,75,FALSE,0,50,TRUE,0,75,TRUE,1,80,FALSE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,63,TRUE,1,80,FALSE,0,50,0.4356,0.04,0.1024,0.0289,0.25,0,0.25,0.0841,0.4096,0.25,0.1369,0.0256,0.1681,0.4096,0.3364,0.25,0.5625,0.25,0.36,0.5625,0.04,0.1849,0.8281,0.4761,0.4761,0.25,0.04,0.4489,1,0.9025,0.25,0.5776,0.349267857,0.241628571,0.456907143,19,59.38,13,40.63,4,50,4,50,3,37.5,2,25,10,62.5,3,18.75,68.88,62.62,70.75,73.75,68.38,65.56,72.19,18.75,28.25,12.62,20.75,36.25,43.38,3.06,53.44,2,0,2,3,2,1,2,0,1,1,1,1,1,0,1,2,1,0,1,0,1,0,1,0,0,0,2,1,2,0,1,1,1,4,0,2,2,2,2,3,1.8,1,0.8,0.8,0.4,1,1.4,2.2,1.1,1.25,5,2.67,2,4,1,0,2.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,30,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,1,0,1,3,2,1,0,-1,-1,1,0,0,0,-4,1,0,-1,-2,-1,-3,1.4,0,-0.6,-1.4,-0.15 +828,R_5aS6ebRQYuxR6vz,25 - 31,American,Male,-1,1,0,-1,-1,0,-1,1,1,1,-1,0,1,-1,1,-1,-1,0,0,-1,-2,3,0,-2,-1,5,1,0,1,1,1,6,1,0,1,0,0,8,1,1,-1,-1,1,7,-1,1,-1,-1,-2,7,0,0,1,0,1,5,-1,1,1,0,2,6,1,1,1,1,-2,9,TRUE,0,88,FALSE,0,82,TRUE,0,88,FALSE,1,75,FALSE,0,88,FALSE,1,88,TRUE,1,90,TRUE,1,86,FALSE,0,87,FALSE,0,85,FALSE,1,86,TRUE,0,89,TRUE,1,86,TRUE,0,90,TRUE,1,89,TRUE,1,88,FALSE,1,84,TRUE,0,88,TRUE,0,90,FALSE,1,70,FALSE,0,90,TRUE,1,59,FALSE,1,59,FALSE,0,57,FALSE,1,56,TRUE,1,96,TRUE,0,57,TRUE,0,51,FALSE,1,56,TRUE,1,87,FALSE,0,61,TRUE,1,76,0.0196,0.0016,0.0144,0.01,0.0576,0.0144,0.3249,0.7225,0.09,0.1681,0.0169,0.0196,0.7569,0.0196,0.7744,0.6724,0.1681,0.0625,0.2601,0.1936,0.81,0.0121,0.81,0.81,0.0256,0.3249,0.3721,0.7744,0.7744,0.7744,0.1936,0.7921,0.385542857,0.276278571,0.494807143,16,50,17,53.13,3,37.5,6,75,4,50,4,50,9,56.25,8,50,78.81,78.38,78.38,81.5,77,81.69,75.94,-3.13,25.68,40.88,3.38,31.5,27,25.44,25.94,1,2,0,1,0,1,1,0,0,0,2,0,0,1,1,2,2,1,1,2,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,2,2,1,1,1,0.8,0.4,0.8,1.6,0.4,0.4,0.6,1.4,0.9,0.7,6.33,6,-2,1,2,-2,0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),29,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,2,-1,1,-1,1,0,0,-1,0,2,-1,0,0,0,0,0,0,0,1,0.4,0,0.2,0.2,0.2 +829,R_7jU8vCajvbsV8BA,18 - 24,Canadian,Male,2,3,2,2,2,0,0,1,-3,2,2,2,2,0,1,1,2,2,2,1,2,2,2,2,2,3,-1,0,1,-1,1,5,2,2,2,1,2,7,3,2,2,2,2,3,2,3,2,2,2,4,0,0,2,-3,2,2,2,2,2,0,2,4,2,2,2,2,2,5,FALSE,1,90,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,55,TRUE,1,50,TRUE,1,55,FALSE,0,55,TRUE,1,60,FALSE,1,65,TRUE,0,70,TRUE,1,75,TRUE,0,65,FALSE,0,55,TRUE,1,90,TRUE,0,70,TRUE,0,75,TRUE,0,65,FALSE,1,60,FALSE,0,95,TRUE,1,65,TRUE,0,60,FALSE,0,50,TRUE,0,60,TRUE,1,55,TRUE,0,55,TRUE,0,70,TRUE,0,65,TRUE,1,75,FALSE,0,55,FALSE,0,60,0.2025,0.2025,0.01,0.25,0.36,0.3025,0.25,0.16,0.16,0.1225,0.0625,0.0625,0.3025,0.1225,0.25,0.25,0.36,0.25,0.49,0.36,0.9025,0.3025,0.4225,0.4225,0.49,0.3025,0.3025,0.01,0.25,0.5625,0.4225,0.49,0.312321429,0.215357143,0.409285714,12,37.5,14,43.75,3,37.5,1,12.5,5,62.5,5,62.5,9,56.25,5,31.25,63.12,56.25,66.25,65,65,62.19,64.06,-6.25,19.37,18.75,53.75,2.5,2.5,5.94,32.81,0,1,0,0,0,1,0,0,2,1,0,0,0,1,1,2,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0.2,0.8,0.4,0.6,0,0.2,0.2,0.4,0.5,0.2,5,3.33,-1,3,3,-2,1.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,20,0.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,1,0,0,0,1,0,-1,2,1,0,0,0,1,0,1,0,0,0,0,0.2,0.6,0.2,0.2,0.3 +830,R_6JRPravQkDHvdZn,32 - 38,American,Male,2,2,2,3,2,-3,-1,-2,1,-2,0,0,2,-2,1,-3,-1,-1,0,-2,3,2,3,2,2,9,-2,0,-2,1,1,9,0,0,3,0,1,9,-2,-2,0,-2,-2,10,3,3,3,3,3,7,0,-2,2,-2,0,7,0,0,3,0,2,7,1,3,2,2,0,10,TRUE,0,50,TRUE,1,60,FALSE,1,50,TRUE,0,60,TRUE,1,60,TRUE,0,70,TRUE,1,90,TRUE,1,90,TRUE,1,60,TRUE,1,90,FALSE,1,50,TRUE,0,80,TRUE,1,90,FALSE,1,60,TRUE,1,60,TRUE,1,100,TRUE,0,55,TRUE,0,70,TRUE,0,70,FALSE,1,50,TRUE,1,60,TRUE,1,100,FALSE,1,90,TRUE,1,55,TRUE,0,90,TRUE,1,55,TRUE,0,75,TRUE,0,60,TRUE,0,90,TRUE,1,90,TRUE,1,55,TRUE,1,90,0.01,0.2025,0,0.01,0.01,0.49,0.2025,0.01,0.25,0,0.01,0.01,0.16,0.25,0.16,0.16,0.01,0.36,0.36,0.81,0.16,0.16,0.49,0.16,0.3025,0.5625,0.2025,0.25,0.25,0.49,0.81,0.64,0.276071429,0.14875,0.403392857,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,16,100,5,31.25,71.09,61.25,75.62,75.62,71.88,75.31,66.88,-3.13,5.46,-1.25,13.12,13.12,-3.12,-24.69,35.63,1,0,1,1,0,1,1,0,0,3,0,0,1,2,0,1,1,1,2,0,1,1,1,0,1,3,1,4,3,2,0,0,1,2,1,4,4,3,2,2,0.6,1,0.6,1,0.8,2.6,0.8,3,0.8,1.8,9,7,2,2,2,0,2,10 cents,100 minutes,47 days,Male,High School (or equivalent),38,1.25,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,-1,0,1,-1,-2,0,-4,-3,1,0,0,0,0,-1,-3,-3,-2,0,-2,-0.2,-1.6,-0.2,-2,-1 +831,R_37aADac832DvBND,32 - 38,American,Male,2,2,2,2,2,-1,-1,1,-1,3,2,2,2,2,2,-1,0,0,2,-1,2,2,2,2,2,7,0,1,1,1,0,9,1,1,1,1,1,9,-1,0,0,0,-1,8,2,2,2,2,2,8,0,0,2,0,1,4,2,1,2,0,1,4,2,2,2,2,1,5,FALSE,1,95,TRUE,1,79,FALSE,1,74,FALSE,1,75,TRUE,1,100,FALSE,1,75,TRUE,1,90,TRUE,1,94,TRUE,1,92,TRUE,1,96,FALSE,1,92,TRUE,0,86,FALSE,0,81,FALSE,1,86,TRUE,1,86,TRUE,1,85,TRUE,0,93,TRUE,0,71,FALSE,1,69,TRUE,0,73,TRUE,1,100,TRUE,1,100,FALSE,1,85,TRUE,1,87,FALSE,1,87,TRUE,1,90,FALSE,1,89,FALSE,1,83,TRUE,0,72,FALSE,0,85,TRUE,1,81,TRUE,1,83,0.0036,0.01,0.0225,0.01,0.0289,0.0625,0.0169,0.0016,0.5329,0,0.7225,0.6561,0.0064,0.0064,0,0.0441,0.0225,0.0625,0.0289,0.0169,0,0.0196,0.0961,0.0196,0.8649,0.0121,0.0361,0.0025,0.0676,0.5041,0.5184,0.7396,0.181775,0.154521429,0.209028571,26,81.25,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,85.44,82.88,86.12,89.38,83.38,89.31,81.56,3.12,7.31,-17.12,23.62,1.88,20.88,1.81,12.81,0,0,0,0,0,1,2,0,2,3,1,1,1,1,1,0,0,0,2,0,0,0,0,0,0,1,1,1,1,2,0,1,0,2,1,3,2,2,0,2,0,1.6,1,0.4,0,1.2,0.8,1.8,0.75,0.95,8.33,5.33,-1,5,5,3,3,10 cents,100 minutes,24 days,Male,University - Undergraduate,32,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,0,1,-1,1,1,1,0,1,-1,0,-3,-2,-2,2,-2,0,0.4,0.2,-1.4,-0.2 +832,R_1GQif6oeHhhHPwm,39 - 45,Canadian,Male,-3,0,3,1,3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,10,TRUE,0,85,TRUE,1,100,FALSE,1,56,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.7225,0.1936,0.25,0.25,0.25,0.255932143,0.232142857,0.279721429,5,15.63,17,53.13,6,75,5,62.5,3,37.5,3,37.5,6,37.5,11,68.75,52.84,56.25,50,54.38,50.75,53.12,52.56,-37.5,-0.29,-18.75,-12.5,16.88,13.25,15.62,-16.19,0,3,6,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.8,0,0,0,3.8,0,0,0,0.95,0.95,0,0,0,0,0,-10,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),40,0,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +833,R_1uJQeGZjWt5MvwB,25 - 31,American,Male,1,2,1,0,1,1,2,1,0,1,2,1,1,2,1,2,2,1,1,1,1,1,2,2,2,7,2,1,1,2,1,8,1,2,1,2,1,7,1,2,1,1,2,6,1,2,1,1,2,7,1,1,1,2,2,8,1,2,1,2,1,6,1,2,2,1,1,5,TRUE,0,79,TRUE,1,69,TRUE,0,78,TRUE,0,74,TRUE,1,79,TRUE,0,75,TRUE,1,76,TRUE,1,72,TRUE,1,85,TRUE,1,80,TRUE,0,64,TRUE,0,79,TRUE,1,76,TRUE,0,75,TRUE,1,84,TRUE,1,73,TRUE,0,79,TRUE,0,77,FALSE,1,60,TRUE,0,80,TRUE,1,83,TRUE,1,84,TRUE,0,80,TRUE,1,76,TRUE,0,86,TRUE,1,78,TRUE,0,87,TRUE,0,78,FALSE,1,72,TRUE,1,74,TRUE,1,66,TRUE,1,76,0.0784,0.0484,0.0729,0.0576,0.0576,0.5625,0.0576,0.04,0.64,0.0256,0.0676,0.0576,0.0225,0.4096,0.0441,0.0961,0.64,0.5476,0.6084,0.7396,0.0289,0.0256,0.16,0.5625,0.6241,0.7569,0.1156,0.6241,0.6084,0.5929,0.0784,0.6241,0.336353571,0.233457143,0.43925,29,90.63,18,56.25,5,62.5,5,62.5,4,50,4,50,16,100,2,12.5,76.69,73.62,77.5,79.38,76.25,76.94,76.44,34.38,20.44,11.12,15,29.38,26.25,-23.06,63.94,0,1,1,2,1,1,1,0,2,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,1,0,2,1,1,1,0,0,0,1,0,1,0,0,1,0.8,0.4,0.4,0.4,0.8,0.4,0.4,0.65,0.5,7.33,7,0,0,1,1,0.33,10 cents,100 minutes,15 days,Male,University - PhD,30,0,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,1,1,1,0,1,0,0,0,-1,0,0,0,0,0,0,0,-1,0,1,0.6,0,0,0,0.15 +834,R_3dG7OKXUX6VUzWF,25 - 31,American,Male,-1,2,3,3,2,3,2,2,-2,3,1,3,3,3,2,2,2,3,3,1,0,2,3,2,3,4,3,2,3,-3,2,8,3,1,3,2,2,7,2,3,3,3,2,6,0,2,3,3,2,7,3,3,2,-3,2,5,3,2,3,3,2,7,3,3,3,2,1,8,TRUE,0,76,FALSE,0,87,FALSE,1,84,FALSE,1,70,FALSE,0,100,FALSE,1,85,TRUE,1,86,TRUE,1,79,FALSE,0,76,FALSE,0,66,FALSE,1,86,FALSE,1,70,TRUE,1,80,TRUE,0,90,FALSE,0,68,TRUE,1,100,FALSE,1,77,TRUE,0,100,FALSE,1,76,FALSE,1,88,FALSE,0,100,TRUE,1,95,FALSE,1,80,TRUE,1,95,FALSE,1,77,FALSE,0,100,FALSE,1,81,FALSE,1,70,TRUE,0,100,FALSE,0,85,FALSE,0,65,FALSE,0,79,0.0441,1,0,0.0196,0.6241,0.0225,0.0025,0.4356,0.0144,0.0025,0.7225,0.04,0.5776,0.0196,1,0.7569,0.04,0.09,0.09,0.0529,1,0.4624,0.0576,0.81,0.0529,0.0361,0.4225,0.5776,0.0256,1,1,0.09,0.358064286,0.310585714,0.405542857,15,46.88,18,56.25,4,50,4,50,3,37.5,7,87.5,6,37.5,12,75,83.47,76.12,87.62,86.25,83.88,85.06,81.88,-9.37,27.22,26.12,37.62,48.75,-3.62,47.56,6.88,1,0,0,1,1,0,0,1,1,1,2,2,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,2,1,0,0,0,1,1,0,1,0,0.6,0.6,1,0.4,0.2,0.6,0.6,0.6,0.65,0.5,6.33,6.33,-3,3,0,-2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,26,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,1,1,0,-1,1,0,0,0,1,0,1,0,-1,0,0,-1,1,0.4,0,0.4,-0.2,0.15 +835,R_1GU2LMYusQivyVR,39 - 45,American,Male,2,2,1,1,2,1,2,3,0,2,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,9,2,1,2,1,1,10,2,2,1,1,1,10,2,1,1,2,2,10,2,1,1,1,2,9,1,1,1,0,1,8,1,1,1,2,1,9,1,2,1,2,1,10,FALSE,1,100,TRUE,1,95,FALSE,1,95,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,95,FALSE,0,90,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,95,TRUE,0,90,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,85,TRUE,1,87,FALSE,1,96,TRUE,0,77,TRUE,0,96,TRUE,1,100,TRUE,1,76,TRUE,1,75,0,0.0169,0,0,0.0625,0,0,0,0,0,0,0.81,0.0025,0,0,0.0025,0,0.01,0.5929,0.7225,0,0.0025,0,0,0.0025,0.0016,0.0576,0,0.0025,0.81,0.9216,0.0025,0.142989286,0.063392857,0.222585714,32,100,27,84.38,8,100,6,75,6,75,7,87.5,15,93.75,12,75,94.75,93.38,94.5,95.25,95.88,94.56,94.94,15.62,10.37,-6.62,19.5,20.25,8.38,0.81,19.94,1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,2,0,1,0,0,1,1,1,0,1,0,1,0,0.6,1,0.8,0.6,0.2,0.8,0.6,0.4,0.75,0.5,9.67,8.67,0,2,1,0,1,5 cents,5 minutes,47 days,Male,University - PhD,44,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,1,0,0,0,1,1,0,-1,1,0,1,1,0,-1,0,1,-1,0,0,1,0.4,0.2,0.2,0.2,0.25 +836,R_19om6KG1zhLsRrh,39 - 45,American,Male,0,-1,3,-1,2,1,1,0,0,1,1,3,2,2,3,1,1,1,2,0,2,2,2,1,0,8,2,2,2,1,3,9,-1,-1,0,1,1,8,2,1,2,2,0,10,2,3,2,1,2,9,3,2,2,1,3,10,0,2,1,1,-1,9,2,1,2,2,3,9,FALSE,1,70,TRUE,1,70,TRUE,0,100,FALSE,1,59,FALSE,0,73,FALSE,1,60,FALSE,0,68,TRUE,1,57,TRUE,1,62,TRUE,1,69,FALSE,1,64,TRUE,0,100,FALSE,0,63,FALSE,1,62,FALSE,0,68,FALSE,0,69,FALSE,1,67,TRUE,0,72,FALSE,1,78,FALSE,1,81,TRUE,1,73,FALSE,0,79,FALSE,1,68,TRUE,1,65,TRUE,0,69,TRUE,1,70,FALSE,1,76,TRUE,0,75,FALSE,1,87,TRUE,1,93,FALSE,0,77,TRUE,1,75,0.1849,0.09,0.4761,0.4624,0.0625,0.16,0.1225,0.0961,0.0361,0.6241,0.0049,0.3969,0.1444,0.1296,0.5329,0.09,0.1024,0.1681,0.5625,0.4761,0.0729,0.4624,0.0484,0.1444,0.1089,0.0576,0.5929,0.09,1,0.5184,0.0169,1,0.279353571,0.19075,0.367957143,19,59.38,20,62.5,6,75,6,75,4,50,4,50,9,56.25,11,68.75,72.47,69.25,70.75,69.88,80,70.69,74.25,-3.12,9.97,-5.75,-4.25,19.88,30,14.44,5.5,2,3,1,2,2,1,1,2,1,2,2,4,2,1,2,1,0,1,0,0,2,4,1,2,0,2,1,2,1,2,1,1,1,1,4,1,0,1,0,3,2,1.4,2.2,0.4,1.8,1.6,1.6,1,1.5,1.5,8.33,9.33,-1,-1,-1,1,-1,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,0,2,-1,0,0,0,0,1,3,1,0,-2,0,0,0,0,-3,0.2,-0.2,0.6,-0.6,0 +837,R_6sKu4twJjm42oXT,39 - 45,American,Male,3,-1,1,-1,3,0,2,3,1,0,-1,-1,3,-2,3,-1,-1,0,-1,-1,3,-2,2,-1,3,1,0,3,3,3,0,10,-1,-1,3,3,3,10,2,-3,-3,-3,-3,10,3,-1,-1,-1,2,6,0,2,3,-1,0,5,-1,-1,3,-2,3,5,1,0,-1,0,-2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,99,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0.81,0,0,0,0,0,0.25,0.9801,0,0,0,0,0,1,0.25,0,1,0,1,0,0,0.224646429,0.147142857,0.30215,31,96.88,25,78.13,7,87.5,6,75,6,75,6,75,14,87.5,11,68.75,96.53,87.5,98.75,100,99.88,99.38,93.69,18.75,18.4,0,23.75,25,24.88,11.88,24.94,0,1,1,0,0,0,1,0,2,0,0,0,0,5,0,3,2,3,2,2,0,0,2,0,1,0,0,0,2,0,0,0,0,0,0,2,1,1,1,1,0.4,0.6,1,2.4,0.6,0.4,0,1.2,1.1,0.55,7,5.33,-5,5,5,5,1.67,5 cents,5 minutes,47 days,Male,University - Undergraduate,42,2,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,1,-1,0,-1,0,1,0,0,0,0,0,0,5,0,1,1,2,1,1,-0.2,0.2,1,1.2,0.55 +838,R_1LUz4Ap00xqEBFe,39 - 45,American,Female,3,3,-2,2,3,1,-3,2,-3,3,2,0,3,-2,3,-2,-2,1,0,-2,-2,3,3,-3,2,8,2,2,-2,1,3,8,-3,-2,2,2,2,9,-2,-2,-2,-3,-3,8,3,3,0,3,3,2,-2,-3,3,-3,3,0,3,3,-2,-3,3,1,2,2,3,2,3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,95,TRUE,0,96,TRUE,0,97,FALSE,0,98,TRUE,1,100,TRUE,0,100,TRUE,1,99,FALSE,1,96,TRUE,1,100,TRUE,0,97,TRUE,0,99,TRUE,0,99,TRUE,1,96,FALSE,0,90,TRUE,1,99,0,0,0,0,0.0001,1,0.0001,0,0.9409,0,0.0016,0,0,0.9801,0,0,1,1,0.9801,0.0016,0.9604,0,0.9216,1,0.9801,0.9409,0.81,0,1,0.9025,0.9801,1,0.550003571,0.351628571,0.748378571,32,100,16,50,3,37.5,3,37.5,6,75,4,50,14,87.5,2,12.5,98.72,97.75,99.38,98.88,98.88,98.88,98.56,50,48.72,60.25,61.88,23.88,48.88,11.38,86.06,5,0,5,5,1,1,5,4,4,0,5,2,1,4,1,0,0,3,3,1,0,0,2,1,0,3,0,1,0,0,1,3,5,1,0,4,4,2,2,5,3.2,2.8,2.6,1.4,0.6,0.8,2,3.4,2.5,1.7,8.33,1,6,8,8,8,7.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,45,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,5,0,3,4,1,-2,5,3,4,0,4,-1,-4,3,1,-4,-4,1,1,-4,2.6,2,0.6,-2,0.8 +839,R_5FROcjSqTWns2vu,25 - 31,American,Male,2,3,2,2,2,2,2,2,3,3,3,2,2,3,2,2,3,2,2,3,2,2,2,2,2,6,2,1,1,2,2,4,2,1,2,2,2,6,1,2,2,2,2,2,3,3,1,3,2,2,3,3,2,3,2,8,2,2,1,2,2,6,2,3,3,3,3,10,TRUE,0,83,TRUE,1,82,FALSE,1,63,TRUE,0,83,TRUE,1,80,TRUE,0,93,TRUE,1,78,TRUE,1,85,FALSE,0,58,TRUE,1,64,TRUE,0,55,TRUE,0,78,FALSE,0,56,TRUE,0,59,TRUE,1,61,TRUE,1,59,TRUE,0,55,FALSE,1,76,TRUE,0,54,TRUE,0,58,TRUE,1,57,TRUE,1,59,TRUE,0,57,TRUE,1,61,FALSE,1,85,FALSE,0,65,TRUE,0,55,TRUE,0,73,FALSE,1,83,FALSE,0,70,TRUE,1,68,TRUE,1,62,0.0225,0.4225,0.1681,0.0484,0.1444,0.8649,0.1521,0.1296,0.3364,0.1681,0.49,0.3136,0.3364,0.3025,0.04,0.0324,0.3249,0.6889,0.5329,0.0225,0.1849,0.1521,0.2916,0.3481,0.3025,0.3025,0.1024,0.6889,0.1369,0.0576,0.0289,0.6084,0.288728571,0.308871429,0.268585714,20,62.5,16,50,3,37.5,4,50,5,62.5,4,50,12,75,4,25,67.97,64.5,67.88,71.12,68.38,66.56,69.38,12.5,17.97,27,17.88,8.62,18.38,-8.44,44.38,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0.2,0.8,0.6,0.6,0.6,0.6,0.6,0.4,0.55,0.55,5.33,5.33,4,-4,0,-8,0,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),30,0.125,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,1,-1,-1,0,-1,0,1,1,0,0,1,-1,0,0,1,1,-1,-1,1,-0.4,0.2,0,0.2,0 +840,R_3QilYYtmKHDOMlb,32 - 38,American,Male,2,3,2,3,2,3,1,3,0,0,3,3,3,2,3,2,1,2,1,3,-1,2,2,3,1,5,1,3,1,0,0,8,-1,1,-1,0,-1,10,1,3,2,3,3,8,3,3,3,3,1,7,3,0,3,0,2,5,3,2,3,2,3,5,2,2,3,2,3,8,TRUE,0,76,TRUE,1,100,TRUE,0,77,FALSE,1,84,TRUE,1,100,FALSE,1,95,FALSE,0,89,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,79,TRUE,0,87,TRUE,1,100,FALSE,1,79,TRUE,1,82,TRUE,1,100,TRUE,0,100,TRUE,0,88,FALSE,1,96,FALSE,1,100,FALSE,0,88,FALSE,0,93,FALSE,1,81,TRUE,1,65,FALSE,1,100,TRUE,1,90,FALSE,1,76,TRUE,0,100,TRUE,0,97,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.01,0,0.7921,0,0.0025,0.1225,0,0,0.8649,0,0,0,0.0441,0,0,0.0361,0.0256,1,0,0.7744,0.0324,0.0016,0.0441,1,0.0576,1,0.5776,0.5929,0.7744,0.9409,0.7569,0.308875,0.078264286,0.539485714,28,87.5,21,65.63,7,87.5,5,62.5,4,50,5,62.5,12,75,9,56.25,91.31,89.62,95.12,89.38,91.12,94.19,88.44,21.87,25.68,2.12,32.62,39.38,28.62,19.19,32.19,3,1,0,0,1,2,2,2,0,0,4,2,4,2,4,1,2,0,2,0,1,0,1,0,1,0,1,0,0,2,0,1,0,0,0,0,1,1,1,0,1,1.2,3.2,1,0.6,0.6,0.2,0.6,1.6,0.5,7.67,5.67,-2,3,5,0,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,1,-1,0,0,2,1,2,0,-2,4,1,4,2,4,1,1,-1,1,0,0.4,0.6,3,0.4,1.1 +841,R_5ZIfIu4LYO9gDKY,39 - 45,American,Male,2,2,2,2,2,1,3,1,1,1,3,2,3,3,2,2,2,1,1,2,3,2,2,3,2,8,1,1,1,1,1,9,1,1,2,3,1,8,3,3,3,3,3,8,1,1,1,3,3,7,1,1,1,1,1,7,1,1,1,1,1,9,3,3,0,3,2,8,TRUE,0,86,TRUE,1,87,TRUE,0,82,TRUE,0,87,TRUE,1,78,TRUE,0,78,TRUE,1,88,TRUE,1,86,TRUE,1,85,TRUE,1,81,TRUE,0,78,TRUE,0,80,TRUE,1,85,TRUE,0,82,TRUE,1,78,TRUE,1,87,TRUE,0,81,TRUE,0,80,TRUE,0,85,TRUE,0,81,TRUE,1,84,TRUE,1,88,TRUE,0,78,TRUE,1,75,TRUE,0,90,TRUE,1,74,TRUE,0,71,TRUE,0,83,TRUE,0,87,TRUE,1,87,TRUE,1,87,TRUE,1,82,0.0196,0.0676,0.0169,0.0144,0.0324,0.6084,0.0625,0.0361,0.6561,0.0144,0.0169,0.0225,0.0225,0.6084,0.0484,0.0169,0.6084,0.7569,0.6889,0.81,0.0256,0.0484,0.7225,0.6724,0.6561,0.5041,0.0169,0.7396,0.6724,0.64,0.7569,0.64,0.396592857,0.250771429,0.542414286,28,87.5,16,50,4,50,4,50,4,50,4,50,16,100,0,0,82.53,82.25,81.62,83.62,82.62,83.25,81.81,37.5,32.53,32.25,31.62,33.62,32.62,-16.75,81.81,1,0,0,1,0,0,2,0,0,0,2,1,1,0,1,1,1,2,2,1,1,1,1,1,1,0,2,0,0,0,2,1,2,2,1,1,1,1,2,0,0.4,0.4,1,1.4,1,0.4,1.6,1,0.8,1,8.33,7.67,1,2,-1,0,0.66,5 cents,25 minutes,15 days,Male,University - Graduate (Masters),42,0.25,1,0,0,0,0,0,0.33,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,-1,-1,0,-1,0,0,0,0,0,0,0,-1,-2,0,0,0,1,0,1,-0.6,0,-0.6,0.4,-0.2 +842,R_1UbbhiHgu7q1d7S,25 - 31,American,Male,-1,2,2,1,1,0,-1,1,0,1,2,0,2,0,2,1,0,3,0,2,2,2,2,-2,2,8,2,0,-2,-1,-2,8,2,1,1,1,2,8,0,-1,2,1,0,8,-1,1,1,-1,2,7,2,-2,1,-1,2,9,2,2,1,2,2,8,1,1,2,2,2,8,FALSE,1,87,TRUE,1,73,TRUE,0,75,FALSE,1,98,TRUE,1,98,FALSE,1,99,TRUE,1,69,TRUE,1,100,TRUE,1,98,TRUE,1,99,FALSE,1,75,TRUE,0,67,TRUE,1,92,FALSE,1,74,TRUE,1,87,TRUE,1,95,FALSE,1,81,FALSE,1,91,FALSE,1,91,FALSE,1,65,TRUE,1,81,TRUE,1,87,FALSE,1,91,FALSE,0,73,FALSE,1,92,TRUE,1,86,FALSE,1,89,FALSE,1,91,FALSE,1,61,TRUE,1,85,TRUE,1,75,TRUE,1,91,0,0.0196,0.0025,0.0961,0.0081,0.0001,0.5329,0.0001,0.1225,0.0169,0.0225,0.0064,0.0004,0.0625,0.0004,0.0729,0.0081,0.0004,0.0081,0.0064,0.0361,0.0169,0.0081,0.0676,0.0361,0.0121,0.0625,0.0169,0.5625,0.0081,0.1521,0.4489,0.082021429,0.061014286,0.103028571,24,75,29,90.63,8,100,8,100,8,100,5,62.5,15,93.75,14,87.5,84.88,85.75,86.75,85.62,81.38,86.81,82.94,-15.63,-5.75,-14.25,-13.25,-14.38,18.88,-6.94,-4.56,3,0,0,3,1,2,1,3,1,3,0,1,1,1,0,1,1,1,1,2,0,1,1,2,1,2,1,0,1,1,0,2,1,2,0,0,1,1,2,0,1.4,2,0.6,1.2,1,1,1,0.8,1.3,0.95,8,8,1,-1,0,0,0,5 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),27,0.875,1,0,0,0,1,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,3,-1,-1,1,0,0,0,3,0,2,0,-1,0,-1,0,1,0,0,-1,2,0.4,1,-0.4,0.4,0.35 +843,R_1hG7SPwTVGonzr7,32 - 38,American,Male,3,3,3,3,3,3,0,3,1,3,2,-3,3,0,3,-1,1,-1,1,0,3,3,3,3,3,3,3,0,3,2,3,1,2,-3,3,0,3,2,1,1,2,3,2,8,3,3,3,3,3,3,3,0,3,3,3,3,2,-3,3,0,3,2,-3,-3,-3,-3,-3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,81,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,97,FALSE,1,100,TRUE,1,93,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,78,FALSE,1,96,TRUE,0,100,FALSE,0,100,TRUE,1,97,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0.0009,0,0,0.0081,0,0,0.0361,0.0016,0,0,0.0049,0,0,1,0.6084,0.0009,0,1,1,1,1,0.237889286,0.07465,0.401128571,29,90.63,25,78.13,7,87.5,6,75,7,87.5,5,62.5,15,93.75,10,62.5,97.91,93.62,98.5,100,99.5,98.62,97.19,12.5,19.78,6.12,23.5,12.5,37,4.87,34.69,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,3,2,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,4,2,4,3,0,0.2,0,1.8,0,0.4,0,3,0.5,0.85,2,2.67,0,-2,0,-2,-0.67,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,34,1.375,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-4,1,-2,-1,0,-0.2,0,-1.2,-0.35 +844,R_7VC9MkNQAU53tAJ,25 - 31,Canadian,Male,2,3,2,3,0,2,0,3,-2,3,0,0,3,0,3,2,3,3,3,3,-3,3,3,-3,-3,9,-3,0,-3,1,-3,9,3,-3,3,-3,3,8,-2,-3,-1,-3,3,10,0,3,0,3,1,4,3,-3,3,-3,3,5,0,3,3,1,3,4,3,3,3,3,3,4,FALSE,1,90,TRUE,1,95,TRUE,0,100,FALSE,1,52,FALSE,0,52,FALSE,1,100,TRUE,1,100,FALSE,0,61,TRUE,1,55,TRUE,1,96,FALSE,1,52,TRUE,0,100,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,1,69,FALSE,1,50,TRUE,1,100,TRUE,0,73,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,79,TRUE,1,100,0.3721,0,0.25,0,0,0,0,0.0016,0.25,0.0961,0.25,0.04,0.2025,0.2304,0.2704,0.0025,0.25,0.2304,0.25,0.5329,0.25,0.25,1,0.25,0.25,0.25,0.0441,0.01,1,1,0.25,1,0.291460714,0.130278571,0.452642857,16,50,22,68.75,6,75,6,75,6,75,4,50,11,68.75,11,68.75,72,66.62,66.5,84.75,70.12,74.19,69.81,-18.75,3.25,-8.38,-8.5,9.75,20.12,5.44,1.06,5,0,1,6,3,5,0,6,3,6,3,3,0,3,0,4,6,4,6,0,2,0,2,0,1,1,3,0,1,0,0,3,0,1,0,1,0,0,0,0,3,4,1.8,4,1,1,0.8,0.2,3.2,0.75,8.67,4.33,5,4,4,6,4.34,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,3,0,-1,6,2,4,-3,6,2,6,3,0,0,2,0,3,6,4,6,0,2,3,1,3.8,2.45 +845,R_5lPlbGTB3MWad44,18 - 24,Canadian,Male,2,3,3,-1,2,2,-2,1,-2,3,1,-2,2,1,3,-1,-1,1,1,2,2,3,3,-3,2,0,2,-3,2,-3,3,1,2,1,1,0,3,2,3,3,3,1,3,3,2,3,3,1,3,1,2,-2,2,-3,3,2,1,-1,2,2,3,2,2,2,2,2,1,8,TRUE,0,100,FALSE,0,80,TRUE,0,75,FALSE,1,58,TRUE,1,100,FALSE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,0,90,TRUE,0,95,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,0,95,FALSE,1,100,TRUE,0,65,FALSE,1,60,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,90,FALSE,0,95,FALSE,0,67,TRUE,1,99,0,0,0,0,0.0001,0.0009,0,0.0001,0.16,0,0.9025,0.0025,0,0.81,0,0.64,0,0.1764,0,0,0,0.0016,0.4225,0,0.9025,0.25,0.4489,1,0.5625,0,0.81,0.9025,0.285464286,0.192321429,0.378607143,25,78.13,21,65.63,3,37.5,6,75,7,87.5,5,62.5,13,81.25,8,50,90.81,75.75,97,99.88,90.62,95.69,85.94,12.5,25.18,38.25,22,12.38,28.12,14.44,35.94,0,0,0,2,0,0,1,1,1,0,1,3,1,1,0,4,4,2,0,1,0,0,0,2,1,0,0,1,1,0,0,1,0,1,0,3,3,1,1,1,0.4,0.6,1.2,2.2,0.6,0.4,0.4,1.8,1.1,0.8,1,1.67,-1,-1,0,-5,-0.67,10 cents,100 minutes,47 days,Male,University - Undergraduate,24,1,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,-1,0,1,0,0,0,1,2,1,0,0,1,1,1,-1,0,-0.2,0.2,0.8,0.4,0.3 +846,R_12KBIr7QMRhgQ9J,18 - 24,American,Male,3,2,0,1,2,2,1,-2,-1,0,2,3,1,-1,0,-1,2,-2,1,0,1,-2,0,-3,-1,4,2,0,2,0,-1,8,-1,-1,-2,-2,1,3,0,-1,-2,1,2,3,-1,0,1,-2,2,6,-1,1,0,-1,2,4,2,-1,1,3,1,5,2,3,3,2,1,6,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,52,TRUE,1,79,FALSE,1,54,TRUE,1,90,TRUE,1,77,TRUE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,52,TRUE,1,100,FALSE,1,100,FALSE,0,59,TRUE,1,100,FALSE,1,58,TRUE,0,100,TRUE,0,100,FALSE,1,55,FALSE,0,54,FALSE,0,54,FALSE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,FALSE,1,62,FALSE,1,59,TRUE,0,100,FALSE,0,100,FALSE,0,63,TRUE,1,100,0.0529,0,0,0.01,0,0.2116,0,0,0.2025,0.2916,1,0,0,0.64,0.0441,1,0,0.2704,0.1681,0.4096,0.2916,0.3481,1,0,0.1764,0.1444,0.3969,1,0,1,1,0.2704,0.352346429,0.261442857,0.44325,22,68.75,18,56.25,2,25,6,75,4,50,6,75,10,62.5,8,50,81.62,77,80.62,88.5,80.38,86,77.25,12.5,25.37,52,5.62,38.5,5.38,23.5,27.25,2,4,0,4,3,0,1,4,1,1,3,4,3,1,1,1,3,0,0,2,4,2,1,3,0,3,0,2,0,2,0,4,0,4,1,3,1,5,1,1,2.6,1.4,2.4,1.2,2,1.4,1.8,2.2,1.9,1.85,5,5,-2,4,-2,-3,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,-0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-2,2,-1,1,3,-3,1,2,1,-1,3,0,3,-3,0,-2,2,-5,-1,1,0.6,0,0.6,-1,0.05 +847,R_3O6paGKu9Eu6TGz,18 - 24,American,Male,1,2,0,0,3,-1,-1,-1,-1,3,-2,-3,3,-2,3,-2,0,3,-1,-1,-1,1,1,0,2,2,0,-2,-1,1,2,1,-2,-3,2,-2,3,1,-1,1,3,1,-2,3,1,2,0,0,3,1,0,-1,-1,0,3,1,-3,-3,3,-3,3,1,0,1,2,1,-1,5,FALSE,1,60,TRUE,1,50,TRUE,0,60,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,75,TRUE,1,55,TRUE,1,90,TRUE,1,60,FALSE,1,50,TRUE,0,90,FALSE,0,70,TRUE,0,55,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,60,TRUE,0,75,FALSE,1,50,TRUE,1,95,TRUE,1,50,TRUE,0,50,TRUE,1,75,FALSE,1,90,TRUE,1,60,TRUE,0,50,TRUE,0,90,FALSE,1,60,FALSE,0,80,FALSE,0,90,TRUE,1,55,0.2025,0.16,0.25,0.0625,0.2025,0.25,0.0625,0.16,0.25,0.25,0.64,0.49,0.01,0.25,0.25,0.25,0.25,0.25,0.81,0.01,0.0025,0.25,0.5625,0.3025,0.25,0.25,0.81,0.16,0.36,0.36,0.16,0.81,0.309375,0.254642857,0.364107143,24,75,18,56.25,4,50,4,50,6,75,4,50,13,81.25,5,31.25,63.91,63.12,60,63.75,68.75,65.94,61.88,18.75,7.66,13.12,10,-11.25,18.75,-15.31,30.63,2,1,1,0,1,1,1,0,2,1,0,0,1,0,0,1,1,0,2,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,2,1,1,2,0,1,1,0.2,1,0,0.4,0.4,1.2,0.8,0.5,1.33,1,1,0,0,-2,0.33,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,0.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,2,1,1,0,1,0,1,0,1,1,-1,0,1,-1,0,-1,0,-1,0,1,1,0.6,-0.2,-0.2,0.3 +848,R_19b31cGhKIE1KVF,25 - 31,American,Male,3,3,3,2,2,1,2,3,-2,3,3,1,2,-1,3,2,1,0,0,-2,3,3,3,3,3,0,3,-3,1,-2,3,2,3,1,2,0,3,0,-1,1,-1,-1,2,2,3,2,3,3,3,1,3,-3,3,-3,3,0,3,0,2,1,3,7,2,3,0,3,-1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,0,50,TRUE,0,94,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,0,100,FALSE,0,50,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0.25,0.25,0.25,0.01,0.01,0,0,0.25,0.0025,0.25,0,0,0,0.25,0.8836,0,0,0.25,0,1,0,1,1,0.210932143,0.090892857,0.330971429,28,87.5,23,71.88,7,87.5,6,75,6,75,4,50,13,81.25,10,62.5,86.53,84.38,87.5,93,81.25,86.88,86.19,15.62,14.65,-3.12,12.5,18,31.25,5.63,23.69,0,0,0,1,1,2,5,2,0,0,0,0,0,1,0,3,0,1,1,4,0,1,0,1,1,2,5,0,1,0,0,1,0,2,0,0,2,0,3,1,0.4,1.8,0.2,1.8,0.6,1.6,0.6,1.2,1.05,1,0.67,2.67,-1,2,-7,-6,-2,10 cents,5 minutes,24 days,Male,University - Undergraduate,30,0.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,-1,0,0,0,0,0,2,-1,0,0,-1,0,-1,0,3,-2,1,-2,3,-0.2,0.2,-0.4,0.6,0.05 +849,R_3BAOztTRoiGCqad,39 - 45,American,Male,3,3,3,3,3,3,-3,3,-3,3,3,2,3,3,2,3,3,3,3,-1,2,2,2,2,2,6,1,1,3,-2,2,9,1,1,1,1,0,8,2,3,3,1,2,9,3,3,3,3,3,9,1,-3,2,-3,3,9,3,3,3,3,3,10,0,3,3,2,-2,8,TRUE,0,100,TRUE,1,100,TRUE,0,82,TRUE,0,82,TRUE,1,80,FALSE,1,88,TRUE,1,100,TRUE,1,64,TRUE,1,82,TRUE,1,76,TRUE,0,80,TRUE,0,76,TRUE,1,74,TRUE,0,99,TRUE,1,71,FALSE,0,100,TRUE,0,87,TRUE,0,82,FALSE,1,92,FALSE,1,86,TRUE,1,83,TRUE,1,87,FALSE,1,92,TRUE,1,85,TRUE,0,99,FALSE,0,82,TRUE,0,78,FALSE,1,94,TRUE,0,86,TRUE,1,86,TRUE,1,86,TRUE,1,86,0.1296,0.6724,1,0,0.0196,0.0144,0.0225,0.0576,0.0196,0.0169,0.0196,0.0676,0.0324,0.64,0.04,0,0.0064,0.6724,0.0036,0.9801,0.0289,0.0841,0.0064,0.9801,0.7569,0.6084,0.0196,1,0.6724,0.6724,0.7396,0.5776,0.312825,0.116357143,0.509292857,17,53.13,19,59.38,5,62.5,6,75,3,37.5,5,62.5,14,87.5,5,31.25,85.78,83.88,84.5,90.62,84.12,83.88,87.69,-6.25,26.4,21.38,9.5,53.12,21.62,-3.62,56.44,1,1,1,1,1,2,4,0,1,1,2,1,2,2,2,1,0,0,2,3,0,0,0,0,0,2,0,1,0,0,0,1,0,0,1,3,0,0,1,1,1,1.6,1.8,1.2,0,0.6,0.4,1,1.4,0.5,7.67,9.33,-3,0,-2,1,-1.66,5 cents,100 minutes,24 days,Male,University - Undergraduate,40,-0.375,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,1,1,1,1,1,0,4,-1,1,1,2,0,2,2,1,-2,0,0,1,2,1,1,1.4,0.2,0.9 +850,R_1vL5akX2XeXP55L,25 - 31,Canadian,Female,3,3,1,1,2,-2,1,1,3,2,2,-2,3,1,3,-2,2,-2,-2,-1,2,3,2,-1,2,9,-2,-1,0,2,0,9,2,-2,2,2,3,9,-2,2,-2,-1,-1,7,3,3,2,2,2,7,-2,1,2,2,3,7,2,-2,3,2,3,3,-1,-1,0,1,1,8,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,51,TRUE,1,100,TRUE,0,52,TRUE,0,100,TRUE,0,88,FALSE,1,50,TRUE,1,61,TRUE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,97,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,1,54,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0.25,0,0.01,0.9409,0.1936,0.81,0.5625,0.1521,0.2601,0.7744,0,0.2704,0.9409,0.2116,0,1,1,1,1,0.352732143,0.135321429,0.570142857,28,87.5,21,65.63,5,62.5,5,62.5,6,75,5,62.5,15,93.75,6,37.5,86.28,67,88.75,96.88,92.5,87.88,84.69,21.87,20.65,4.5,26.25,21.88,30,-5.87,47.19,1,0,1,2,0,0,2,1,1,2,0,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,3,2,3,2,0.8,1.2,0.4,0.2,0.4,0.6,0.2,2.2,0.65,0.85,9,5.67,2,2,6,-1,3.33,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,31,1.375,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,0,0,1,0,0,2,0,0,1,0,0,1,0,0,-1,-3,-2,-2,-2,0.4,0.6,0.2,-2,-0.2 +851,R_51dYvxwyn1qXXSF,25 - 31,Canadian,Female,2,3,2,-3,0,-3,-1,2,2,1,2,-2,2,-2,3,0,1,-3,-3,0,3,3,2,-3,0,7,-3,-3,1,3,-3,6,3,-3,-3,-2,3,3,-3,-3,-3,-3,-3,8,1,2,2,-3,1,3,-3,-1,2,1,2,5,2,-3,3,-3,3,3,1,1,1,1,1,7,TRUE,0,82,FALSE,0,50,TRUE,0,63,FALSE,1,50,TRUE,1,56,FALSE,1,56,TRUE,1,58,TRUE,1,76,FALSE,0,72,TRUE,1,57,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,57,FALSE,0,50,FALSE,1,74,TRUE,1,69,FALSE,1,50,TRUE,1,64,FALSE,1,50,FALSE,1,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,59,0.0576,0.1296,0.25,0.1764,0.3481,0.1936,0.0961,0.1849,0.25,0.25,0.25,0.25,0.5184,0.25,0.1936,0.25,0.0676,0.25,0.0676,0.25,0.3249,0.25,0.25,0.25,0.25,0.25,0.25,0.6724,0.3969,0.25,0.25,0.25,0.261217857,0.23945,0.282985714,5,15.63,20,62.5,4,50,5,62.5,6,75,5,62.5,6,37.5,14,87.5,56.78,52.75,56.5,57.62,60.25,57.38,56.19,-46.87,-5.72,2.75,-6,-17.38,-2.25,19.88,-31.31,1,0,0,0,0,0,2,1,1,4,1,1,5,0,0,3,4,0,0,3,1,1,0,0,1,0,0,0,1,1,0,1,1,1,0,1,0,4,4,1,0.2,1.6,1.4,2,0.6,0.4,0.6,2,1.3,0.9,5.33,3.67,4,1,0,1,1.66,5 cents,5 minutes,47 days,Female,University - Undergraduate,25,1.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,-1,0,0,-1,0,2,1,0,3,1,0,4,-1,0,2,4,-4,-4,2,-0.4,1.2,0.8,0,0.4 +852,R_1guzVEXB7Tff2yU,18 - 24,Canadian,Female,3,3,-1,1,3,1,2,3,2,3,3,-2,3,3,3,1,3,2,2,-1,3,3,2,2,3,7,-2,3,-1,3,-2,8,3,3,-1,3,3,7,-3,-1,-3,-3,-3,9,3,3,-1,-1,3,2,2,-2,3,1,3,2,3,-2,3,-1,3,1,3,3,3,3,3,4,FALSE,1,64,TRUE,1,50,TRUE,0,100,TRUE,0,58,TRUE,1,100,FALSE,1,58,TRUE,1,90,TRUE,1,90,TRUE,1,50,TRUE,1,96,TRUE,0,51,TRUE,0,64,TRUE,1,68,FALSE,1,71,FALSE,0,51,TRUE,1,100,TRUE,0,70,TRUE,0,74,TRUE,0,50,FALSE,1,51,TRUE,1,64,TRUE,1,54,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,81,TRUE,0,50,TRUE,0,63,TRUE,0,100,TRUE,1,87,FALSE,0,50,TRUE,1,100,0.01,0.0361,0,0.01,0,0.1764,0,0.0016,0.2401,0.2116,0.0169,0.1024,0.25,0.2601,0,0.25,0.36,0.3364,0.3969,0,0.1296,0.2601,0.25,0.0841,0.49,0.25,0.25,0.1296,1,0.5476,1,0.4096,0.264392857,0.157535714,0.37125,16,50,19,59.38,2,25,5,62.5,7,87.5,5,62.5,14,87.5,5,31.25,72.34,51.25,77.5,78.75,81.88,76.94,67.75,-9.38,12.96,26.25,15,-8.75,19.38,-10.56,36.5,0,0,3,1,0,3,1,4,1,5,0,5,4,0,0,4,4,5,5,2,0,0,0,2,0,1,4,0,1,0,0,0,0,4,0,2,0,1,1,4,0.8,2.8,1.8,4,0.4,1.2,0.8,1.6,2.35,1,7.33,1.67,5,6,6,5,5.66,5 cents,5 minutes,47 days,Female,High School (or equivalent),18,1.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,3,-1,0,2,-3,4,0,5,0,5,4,-4,0,2,4,4,4,-2,0.4,1.6,1,2.4,1.35 +853,R_7rTUGoYyHM1m3DX,25 - 31,American,Female,2,3,3,2,2,2,-2,2,-2,2,3,3,3,2,2,2,3,3,2,3,-1,3,2,2,2,7,1,-2,1,-2,1,8,2,3,3,-2,3,7,1,-1,1,-1,-1,8,3,3,3,3,3,7,3,0,3,-3,2,4,2,3,3,1,3,6,2,2,2,3,3,8,TRUE,0,83,TRUE,1,74,TRUE,0,100,TRUE,0,77,FALSE,0,98,FALSE,1,100,TRUE,1,65,TRUE,1,100,TRUE,1,73,FALSE,0,100,FALSE,1,83,TRUE,0,100,TRUE,1,72,FALSE,1,63,TRUE,1,62,TRUE,1,100,TRUE,0,86,TRUE,0,100,FALSE,1,89,TRUE,0,71,TRUE,1,100,TRUE,1,100,TRUE,0,57,TRUE,1,66,TRUE,0,79,FALSE,0,55,TRUE,0,68,TRUE,0,100,TRUE,0,76,TRUE,1,53,FALSE,0,66,TRUE,1,76,0,0.3025,0,0.1225,0.0576,0,0.1156,1,0.5041,0,0.2209,0.0784,0.0729,0.0289,0.9604,0.0676,0.3249,0.5929,1,0.6241,0,0.1444,0.0121,0.1369,0.7396,0.4624,0.4356,0.6889,1,1,0.5776,1,0.423064286,0.287442857,0.558685714,18,56.25,16,50,5,62.5,4,50,3,37.5,4,50,12,75,4,25,81,74,83.12,80.62,86.25,78.75,83.25,6.25,31,11.5,33.12,43.12,36.25,3.75,58.25,3,0,1,0,0,1,0,1,0,1,1,0,0,4,1,1,4,2,3,4,1,0,0,1,1,1,2,1,1,0,1,0,0,1,1,0,1,1,1,0,0.8,0.6,1.2,2.8,0.6,1,0.6,0.6,1.35,0.7,7.33,5.67,0,4,1,0,1.66,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,31,0.375,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,2,0,1,-1,-1,0,-2,0,-1,1,0,0,0,3,0,1,3,1,2,4,0.2,-0.4,0.6,2.2,0.65 +854,R_7OTvOoQC0biSLms,18 - 24,American,Female,3,3,2,1,3,2,0,2,1,3,0,2,2,3,1,0,1,1,3,3,0,1,3,2,2,7,2,1,0,2,3,9,1,3,2,0,1,7,2,1,3,2,1,5,2,3,3,1,0,7,2,1,1,3,2,7,3,2,2,0,1,7,2,3,1,0,1,10,FALSE,1,100,TRUE,1,100,TRUE,0,79,TRUE,0,59,TRUE,1,100,FALSE,1,70,TRUE,1,66,FALSE,0,69,TRUE,1,64,FALSE,0,55,TRUE,0,65,FALSE,1,64,FALSE,0,62,TRUE,0,84,FALSE,0,63,TRUE,1,86,TRUE,0,60,FALSE,1,75,FALSE,1,56,TRUE,0,82,TRUE,1,70,TRUE,1,63,TRUE,0,92,TRUE,1,66,FALSE,1,100,TRUE,1,90,FALSE,1,63,TRUE,0,80,TRUE,0,66,TRUE,1,100,TRUE,1,65,TRUE,1,100,0.4761,0.01,0.0196,0.1156,0,0.09,0.1156,0.3025,0.6724,0.1369,0,0.3844,0.1296,0.4225,0,0,0.8464,0.3481,0.64,0,0.09,0.3969,0.1936,0.7056,0.36,0.1369,0.1225,0,0.6241,0.0625,0.4356,0.1296,0.262346429,0.246314286,0.278378571,24,75,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,75.44,66.88,77.5,79.12,78.25,76.19,74.69,15.62,16.06,4.38,27.5,4.12,28.25,1.19,30.94,3,2,1,1,1,0,1,2,1,0,1,1,0,3,0,2,0,2,1,2,1,0,1,0,3,0,1,1,2,1,3,0,0,3,0,2,2,0,3,2,1.6,0.8,1,1.4,1,1,1.2,1.8,1.2,1.25,7.67,7,0,2,0,-5,0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,2,2,0,1,-2,0,0,1,-1,-1,-2,1,0,0,0,0,-2,2,-2,0,0.6,-0.2,-0.2,-0.4,-0.05 +855,R_551EH1NZAgKO3YJ,18 - 24,Canadian,Female,2,3,3,3,3,-1,0,2,1,3,1,0,3,0,3,1,1,2,1,1,3,3,3,3,0,9,1,3,1,3,0,7,2,0,3,2,3,8,2,1,3,1,2,7,3,3,3,3,3,0,-2,-3,3,1,2,0,-1,-3,3,-2,3,2,3,3,3,3,0,4,TRUE,0,63,TRUE,1,64,TRUE,0,86,FALSE,1,63,TRUE,1,92,FALSE,1,96,TRUE,1,86,TRUE,1,82,TRUE,1,100,TRUE,1,100,FALSE,1,58,TRUE,0,72,TRUE,1,61,FALSE,1,100,TRUE,1,56,TRUE,1,65,FALSE,1,59,TRUE,0,74,TRUE,0,76,FALSE,1,66,TRUE,1,79,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,64,TRUE,0,79,FALSE,1,62,FALSE,1,60,FALSE,0,55,FALSE,0,62,TRUE,1,100,0.0324,0.1296,0.1225,0.0196,0,0.0016,0,0,0.1156,0,0.3025,0.1521,0,0.1764,0.0064,0.1296,0,0.1369,0.1444,0,0.0441,0.1936,0.5776,0,0.1681,0.6241,0.3844,0.3969,0.7396,0.5476,0.16,0.5184,0.197139286,0.072935714,0.321342857,19,59.38,24,75,5,62.5,8,100,6,75,5,62.5,14,87.5,10,62.5,77.5,69.75,80.88,85.88,73.5,79.12,75.88,-15.62,2.5,7.25,-19.12,10.88,11,-8.38,13.38,1,0,0,0,3,2,3,1,2,3,1,0,0,2,0,1,0,1,0,1,1,0,0,0,0,1,3,1,0,1,2,3,0,2,0,2,2,1,2,1,0.8,2.2,0.6,0.6,0.2,1.2,1.4,1.6,1.05,1.1,8,0.67,9,7,6,3,7.33,10 cents,5 minutes,36 days,Female,College Diploma/Certificate,21,0.875,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,3,1,0,0,2,2,-1,-3,0,0,0,-1,-2,0,-2,0,0.6,1,-0.8,-1,-0.05 +856,R_7Ofyp1ai5hRQU7L,25 - 31,American,Male,1,2,2,1,2,1,-1,1,-1,1,1,1,1,0,1,0,0,2,1,1,1,2,2,2,1,2,1,-1,1,-1,1,2,1,0,1,1,1,2,1,1,0,1,1,5,1,2,2,1,2,2,1,-1,1,-1,1,2,1,1,1,0,1,2,1,1,2,1,1,6,FALSE,1,100,TRUE,1,89,TRUE,0,100,FALSE,1,56,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,68,FALSE,0,72,FALSE,1,65,FALSE,1,95,TRUE,1,100,TRUE,0,83,TRUE,1,60,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,85,FALSE,1,68,TRUE,1,68,TRUE,1,94,FALSE,1,63,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,78,FALSE,1,89,TRUE,0,88,FALSE,0,79,TRUE,1,86,TRUE,1,91,0,0,0,0,0.0081,0,0,0.5184,0.1024,0.0036,0.6241,0,0.1024,0.1225,0.2025,0.0121,0.1369,0.1936,0.0121,0,0.1024,0.16,0.7225,0.6889,0.1369,0.0484,0.0196,0,1,0,0.7744,0.0025,0.203367857,0.144757143,0.261978571,13,40.63,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,84.22,73.38,78.5,93.62,91.38,85.12,83.31,-40.62,2.97,-14.12,-9,18.62,16.38,-2.38,8.31,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0.4,0,0.4,0.8,0,0,0,0.4,0.4,0.1,2,2,0,0,0,-1,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),27,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,2,0,0,0.4,0,0.4,0.4,0.3 +857,R_3k7yDhUCnYMqSNm,18 - 24,American,Female,3,3,3,3,3,3,3,3,-3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,2,2,10,2,3,3,2,3,10,3,3,2,3,2,10,3,3,2,3,2,10,3,3,2,3,2,10,3,3,3,3,2,10,3,3,2,2,3,10,3,2,3,3,2,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,84,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0004,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.0004,0,0,0.0256,0,0,0,0,1,0,0,0.072371429,0.071457143,0.073285714,32,100,30,93.75,8,100,7,87.5,7,87.5,8,100,15,93.75,15,93.75,99.38,99.75,97.75,100,100,99.88,98.88,6.25,5.63,-0.25,10.25,12.5,0,6.13,5.13,0,0,0,1,1,1,0,0,5,0,0,0,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,6,1,0,0,1,0,0,1,1,0,0,1,0.4,1.2,0.6,0.6,0.4,1.4,0.2,0.6,0.7,0.65,10,10,0,0,0,0,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,24,0,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,-1,1,0,1,0,0,-1,-1,0,0,0,1,1,0,-1,1,0,0,0,-0.2,0.4,0,0.05 +858,R_1WuuZPODn5sL2k0,18 - 24,American,Male,1,3,3,2,3,-2,0,2,-2,-3,3,3,2,2,1,0,0,1,1,0,0,3,1,2,1,8,1,0,0,-2,-3,7,0,0,-2,0,-2,6,0,0,1,2,0,6,0,3,1,1,0,5,0,0,1,0,0,5,0,0,0,1,1,4,1,0,0,1,0,7,TRUE,0,90,TRUE,1,84,TRUE,0,94,TRUE,0,86,FALSE,0,83,TRUE,0,78,TRUE,1,85,TRUE,1,85,TRUE,1,88,TRUE,1,87,TRUE,0,88,TRUE,0,89,TRUE,1,92,TRUE,0,89,FALSE,0,88,TRUE,1,86,FALSE,1,100,TRUE,0,84,TRUE,0,77,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,89,TRUE,0,86,TRUE,0,76,FALSE,0,73,TRUE,1,84,TRUE,1,84,0.0225,0,0.0196,0.0225,0.0256,0.6084,0,0.0169,1,0,0.5329,0.0064,0.0144,0.7744,0.6889,0.0256,0.9025,0.7396,0.7396,0,0,0.7744,0.5929,0.7921,0,0.7921,0.0256,0.81,0.8836,0.7056,0.5776,0.7921,0.4579,0.381114286,0.534685714,17,53.13,15,46.88,3,37.5,4,50,5,62.5,3,37.5,13,81.25,2,12.5,88.75,85.5,88.5,91.88,89.12,88.69,88.81,6.25,41.87,48,38.5,29.38,51.62,7.44,76.31,1,0,2,0,2,3,0,2,0,0,3,3,4,2,3,0,0,0,1,0,1,0,2,1,3,2,0,1,2,3,3,3,2,1,0,1,0,1,0,0,1,1,3,0.2,1.4,1.6,1.8,0.4,1.3,1.3,7,4.67,3,2,2,-1,2.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,-1,1,0,1,-2,-3,0,0,2,1,3,-1,0,-1,1,0,-0.4,-0.6,1.2,-0.2,0 +859,R_3OJ91rDlvOTOUrH,18 - 24,American,Female,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,TRUE,0,100,TRUE,1,76,TRUE,0,100,FALSE,1,50,FALSE,0,82,FALSE,1,92,FALSE,0,93,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,64,TRUE,0,100,FALSE,0,82,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,68,TRUE,0,95,TRUE,1,64,FALSE,0,50,TRUE,0,90,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,1,60,TRUE,0,75,TRUE,0,90,TRUE,1,100,FALSE,0,50,TRUE,1,60,0.25,0,0,0.8649,0.16,0.0064,0,0,0.9025,0.25,0,0.6724,0.25,0.1296,0.6724,0.0576,0.81,0.25,0.5625,0.0225,0.1296,0.25,0.1024,0,1,0.16,0.25,1,1,1,0.81,1,0.408853571,0.297207143,0.5205,16,50,16,50,5,62.5,3,37.5,4,50,4,50,9,56.25,7,43.75,80.5,58.5,82.5,91,90,75.44,85.56,0,30.5,-4,45,41,40,19.19,41.81,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,2,0,1,0,2,0,1,0,0.75,0.75,0,0,0,0,0,0,0,15 cents,100 minutes,24 days,Female,College Diploma/Certificate,22,-0.25,0,0,0,0,1,1,0,0.67,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +860,R_6Y9x4iu9imBy3ct,18 - 24,American,Female,2,3,1,2,2,3,-1,-2,-3,2,-1,-2,2,2,1,0,1,2,2,-2,2,3,3,3,1,6,-3,-3,1,-2,2,8,3,1,-2,2,2,8,-2,1,2,1,3,6,2,3,-1,3,2,2,3,0,0,-2,2,1,-1,-2,2,0,2,1,2,-2,0,1,-2,8,TRUE,0,100,TRUE,1,50,TRUE,0,65,FALSE,1,50,TRUE,1,70,FALSE,1,100,TRUE,1,90,TRUE,1,90,TRUE,1,100,FALSE,0,100,FALSE,1,54,TRUE,0,94,TRUE,1,60,TRUE,0,73,FALSE,0,52,TRUE,1,53,TRUE,0,50,TRUE,0,76,FALSE,1,67,FALSE,1,50,TRUE,1,64,TRUE,1,59,TRUE,0,80,TRUE,1,95,TRUE,0,63,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,60,FALSE,0,69,FALSE,0,75,TRUE,1,95,0.01,0.0025,0.2209,0.01,0.0025,0,0.0025,1,0.25,0.1681,0.4761,0.16,0,0.2116,0.09,0.25,0.64,0.25,0.25,0.3969,0.1296,0.2704,0.1089,0.5329,0.25,0.25,0.5625,1,0.4225,0.5776,0.36,0.8836,0.339132143,0.250057143,0.428207143,13,40.63,18,56.25,5,62.5,5,62.5,3,37.5,5,62.5,12,75,6,37.5,71.84,62.25,72.38,82,70.75,76.06,67.62,-15.62,15.59,-0.25,9.88,44.5,8.25,1.06,30.12,0,0,2,1,1,6,2,3,1,0,4,3,4,0,1,2,0,0,1,5,0,0,2,1,0,0,1,2,1,0,0,0,0,2,1,2,3,2,1,0,0.8,2.4,2.4,1.6,0.6,0.8,0.6,1.6,1.8,0.9,7.33,1.33,4,7,7,-2,6,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,1,6,1,1,0,0,4,3,4,-2,0,0,-3,-2,0,5,0.2,1.6,1.8,0,0.9 +861,R_3O2lLNh3P30DMHf,18 - 24,American,Female,3,3,2,3,2,2,1,3,3,2,2,2,1,0,2,2,2,1,2,2,2,1,1,1,2,5,1,1,2,2,1,3,2,3,1,3,2,7,1,1,1,2,2,5,2,1,2,2,1,3,2,2,3,2,3,6,1,2,3,2,1,8,2,1,1,0,3,7,FALSE,1,65,FALSE,0,67,FALSE,1,71,TRUE,0,57,FALSE,0,54,FALSE,1,68,FALSE,0,69,FALSE,0,68,FALSE,0,61,FALSE,0,66,FALSE,1,71,FALSE,1,72,FALSE,0,69,FALSE,1,65,FALSE,0,64,FALSE,0,61,FALSE,1,61,FALSE,1,57,TRUE,0,71,FALSE,1,71,FALSE,0,63,TRUE,1,63,TRUE,0,59,FALSE,0,53,TRUE,0,66,TRUE,1,66,FALSE,1,61,FALSE,1,62,FALSE,1,58,FALSE,0,74,FALSE,0,75,TRUE,1,61,0.4624,0.1156,0.3721,0.4761,0.1521,0.1024,0.2809,0.4356,0.0841,0.1369,0.5476,0.4761,0.3721,0.0841,0.2916,0.4489,0.3481,0.3249,0.1444,0.4356,0.3969,0.4096,0.5041,0.1225,0.1521,0.1521,0.5625,0.1225,0.0841,0.1849,0.1764,0.0784,0.271839286,0.291814286,0.251864286,18,56.25,15,46.88,2,25,4,50,5,62.5,4,50,3,18.75,12,75,64.66,65.88,61.62,64.62,66.5,64.62,64.69,9.37,17.78,40.88,11.62,2.12,16.5,45.87,-10.31,1,2,1,2,0,1,0,1,1,1,0,1,0,3,0,1,1,0,0,0,1,2,0,1,1,0,1,0,1,1,1,0,2,2,1,0,1,0,2,1,1.2,0.8,0.8,0.4,1,0.6,1.2,0.8,0.8,0.9,5,5.67,2,-3,-1,-2,-0.67,5 cents,100 minutes,47 days,Female,High School (or equivalent),21,-0.25,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,1,1,-1,1,-1,1,0,0,-1,1,-2,1,-1,1,0,0,-2,-1,0.2,0.2,-0.4,-0.4,-0.1 +862,R_3costSOlw5ZSWJj,18 - 24,American,Female,2,3,-3,0,1,0,0,1,0,0,3,1,3,2,2,1,1,1,1,-3,1,3,0,-3,3,3,-2,3,1,3,1,9,3,1,3,1,1,9,-3,-1,-3,-3,-3,10,3,3,-2,1,3,2,1,0,3,0,1,4,3,1,3,2,2,7,3,3,3,3,-1,10,FALSE,1,100,TRUE,1,58,TRUE,0,100,FALSE,1,60,TRUE,1,100,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,67,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,64,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,0,52,TRUE,1,83,TRUE,0,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,FALSE,0,52,TRUE,1,100,0,0.0289,0,0,0,0.2025,0.0841,0,0.1225,0,1,0,0,0.2209,0,0.1764,0,0.16,0.25,0.2704,0,0.1089,0.4096,0.25,1,1,0.2704,0,1,0,1,0.25,0.277703571,0.140457143,0.41495,16,50,23,71.88,5,62.5,6,75,7,87.5,5,62.5,14,87.5,9,56.25,82.19,69.25,94.38,85.62,79.5,89.44,74.94,-21.88,10.31,6.75,19.38,-1.88,17,1.94,18.69,1,0,3,3,2,2,3,0,3,1,0,0,0,1,1,4,2,4,4,0,1,0,1,1,2,1,0,2,0,1,0,0,0,0,0,2,2,2,2,2,1.8,1.8,0.4,2.8,1,0.8,0,2,1.7,0.95,7,4.33,1,5,2,0,2.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,2,2,0,1,3,-2,3,0,0,0,0,1,1,2,0,2,2,-2,0.8,1,0.4,0.8,0.75 +863,R_5dYvNycLhDsBzDo,25 - 31,American,Female,3,3,2,0,3,0,1,2,0,0,2,1,3,0,3,2,0,0,1,-1,1,3,3,3,1,2,1,-1,2,1,0,2,3,2,3,0,3,3,-1,0,-1,0,-1,3,3,3,2,-1,3,3,0,-1,3,-1,2,2,3,2,3,-1,3,2,2,2,2,2,2,2,FALSE,1,98,TRUE,1,58,TRUE,0,100,FALSE,1,60,TRUE,1,65,FALSE,1,100,TRUE,1,65,TRUE,1,92,TRUE,1,75,TRUE,1,97,FALSE,1,70,TRUE,0,87,TRUE,1,87,TRUE,0,61,TRUE,1,59,FALSE,0,70,TRUE,0,70,TRUE,0,87,TRUE,0,81,TRUE,0,54,FALSE,0,64,TRUE,1,91,FALSE,1,100,TRUE,1,75,TRUE,0,86,TRUE,1,81,TRUE,0,50,TRUE,0,97,TRUE,0,54,TRUE,1,86,FALSE,0,58,TRUE,1,96,0.0064,0.0361,0.49,0.1225,0.0016,0,0.0625,0.0009,0.2916,0.0081,0.0196,0.0169,0.0625,0.09,0.1225,0.1764,0,0.16,0.9409,0.7396,0.4096,0.1681,0.6561,0.3721,0.49,0.25,0.3364,0.0004,1,0.7569,0.2916,0.7569,0.292185714,0.072328571,0.512042857,16,50,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,13,81.25,5,31.25,77.31,63.88,79.5,83.25,82.62,76.19,78.44,-6.25,21.06,1.38,17,20.75,45.12,-5.06,47.19,2,0,1,3,2,1,2,0,1,0,1,1,0,0,0,3,0,1,1,0,0,0,0,1,0,0,2,1,1,2,1,1,0,1,0,0,2,2,1,3,1.6,0.8,0.4,1,0.2,1.2,0.6,1.6,0.95,0.9,2.33,2.33,-1,0,1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,28,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,0,1,2,2,1,0,-1,0,-2,0,0,0,-1,0,3,-2,-1,0,-3,1.4,-0.4,-0.2,-0.6,0.05 +864,R_3r4jCd87S8QXS9z,18 - 24,American,Male,-3,-2,3,-2,-3,-3,-2,1,3,-3,2,2,2,-2,3,2,3,3,1,-3,-3,2,2,-3,-3,0,-3,-2,-2,-2,-2,1,-1,2,-1,-2,-1,10,2,2,2,2,-3,5,-2,0,-2,-2,-3,0,-2,-2,1,0,-3,2,-2,2,2,2,2,0,2,2,2,2,-2,0,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,60,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.36,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.253928571,0.25,0.257857143,2,6.25,19,59.38,4,50,4,50,5,62.5,6,75,3,18.75,16,100,50.78,50,51.25,50,51.88,51.56,50,-53.13,-8.6,0,1.25,-12.5,-23.12,32.81,-50,0,4,1,1,0,0,0,3,5,1,3,0,3,0,4,0,1,1,1,0,1,2,5,0,0,1,0,0,3,0,4,0,0,4,1,0,1,1,1,1,1.2,1.8,2,0.6,1.6,0.8,1.8,0.8,1.4,1.25,3.67,0.67,0,-1,10,5,3,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,23,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-1,2,-4,1,0,-1,0,3,2,1,-1,0,3,-4,3,0,0,0,0,-1,-0.4,1,0.2,-0.2,0.15 +865,R_1X5UXxlbHryt7c7,25 - 31,American,Female,2,3,3,3,2,-3,3,2,2,1,3,3,3,2,3,0,2,1,1,-1,0,3,2,2,3,8,2,2,3,1,3,8,3,3,2,3,3,1,1,2,3,2,3,9,2,3,3,3,1,6,0,1,3,1,3,4,3,3,3,2,3,5,1,1,2,2,2,5,TRUE,0,64,TRUE,1,89,FALSE,1,74,FALSE,1,87,TRUE,1,79,FALSE,1,98,TRUE,1,88,TRUE,1,78,TRUE,1,94,TRUE,1,88,FALSE,1,66,TRUE,0,97,TRUE,1,82,FALSE,1,70,TRUE,1,85,TRUE,1,92,FALSE,1,83,FALSE,1,100,FALSE,1,90,FALSE,1,86,TRUE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,93,FALSE,1,84,TRUE,1,86,FALSE,1,70,TRUE,0,94,FALSE,1,78,TRUE,1,85,FALSE,0,72,FALSE,0,67,0.0484,0.0196,0.0064,0.0144,0.4489,0.0004,0.0049,0.0144,0.0196,0.04,0.0225,0.0324,0.0036,0.1156,0.0441,0.0121,0,0.0169,0.8836,0.0256,0,0.0225,0.01,0.09,0.0289,0.09,0.5184,0.4096,0.0676,0,0.0484,0.9409,0.139675,0.055385714,0.223964286,11,34.38,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,84.34,81.62,85.88,82.5,87.38,84.88,83.81,-50,-0.04,-5.88,-1.62,-5,12.38,-2.62,2.56,2,0,1,1,1,5,1,1,1,2,0,0,1,1,0,1,0,2,1,4,0,0,0,0,1,3,2,1,1,2,0,0,0,0,0,1,1,1,1,3,1,2,0.4,1.6,0.2,1.8,0,1.4,1.25,0.85,5.67,5,2,4,-4,4,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,28,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,0,1,1,0,2,-1,0,0,0,0,0,1,1,0,0,-1,1,0,1,0.8,0.2,0.4,0.2,0.4 +866,R_6e5t08ZY1L6J1vb,18 - 24,American,Female,-2,2,2,2,-2,0,0,0,2,2,3,3,3,0,2,3,3,3,3,3,3,3,3,3,3,0,2,-2,0,-2,-2,4,3,0,2,0,0,4,3,3,3,3,3,3,0,0,0,0,0,5,0,-2,0,-2,2,5,2,2,2,0,0,5,2,2,3,2,3,6,FALSE,1,62,FALSE,0,67,TRUE,0,90,FALSE,1,82,FALSE,0,87,TRUE,0,80,FALSE,0,76,TRUE,1,67,FALSE,0,70,TRUE,1,86,TRUE,0,81,TRUE,0,83,TRUE,1,84,FALSE,1,67,FALSE,0,71,FALSE,0,63,FALSE,1,69,TRUE,0,80,FALSE,1,86,FALSE,1,78,FALSE,0,78,FALSE,0,76,FALSE,1,83,FALSE,0,68,FALSE,1,79,TRUE,1,76,FALSE,1,74,TRUE,0,88,FALSE,1,86,TRUE,1,92,FALSE,0,87,FALSE,0,72,0.1089,0.0576,0.3969,0.5776,0.5184,0.64,0.4624,0.0196,0.0484,0.5776,0.0064,0.0256,0.49,0.6561,0.7569,0.4489,0.0289,0.0324,0.7744,0.0441,0.6084,0.5041,0.0196,0.1089,0.0961,0.0676,0.7569,0.1444,0.81,0.64,0.0196,0.6889,0.35695,0.336542857,0.377357143,16,50,15,46.88,3,37.5,4,50,5,62.5,3,37.5,5,31.25,10,62.5,77.75,77.25,79.88,75.25,78.62,76.25,79.25,3.12,30.87,39.75,29.88,12.75,41.12,45,16.75,5,1,1,1,5,2,2,0,4,4,0,3,1,0,2,0,0,0,0,0,2,2,2,2,2,0,2,0,4,0,1,1,1,0,2,1,1,0,1,0,2.6,2.4,1.2,0,2,1.2,1,0.6,1.55,1.2,2.67,5,-5,-1,-1,-3,-2.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),23,0.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,3,-1,-1,-1,3,2,0,0,0,4,-1,2,0,0,0,-1,-1,0,-1,0,0.6,1.2,0.2,-0.6,0.35 +867,R_3IRFJSyzunHLkEK,25 - 31,American,Female,2,2,1,2,1,2,-1,3,1,3,2,2,2,1,3,-1,1,1,1,-1,0,-1,3,3,1,7,1,2,-1,2,1,8,1,0,1,1,3,6,-1,0,-2,-2,1,9,1,1,0,2,2,8,3,-3,2,-1,3,8,3,3,2,2,3,9,2,3,1,3,-1,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0.25,0.142857143,0.357142857,32,100,25,78.13,6,75,6,75,8,100,5,62.5,15,93.75,10,62.5,100,100,100,100,100,100,100,21.87,21.87,25,25,0,37.5,6.25,37.5,2,3,2,1,0,1,3,4,1,2,1,2,1,0,0,0,1,3,3,2,1,1,1,0,1,1,2,1,2,0,1,1,0,1,0,3,2,0,2,0,1.6,2.2,0.8,1.8,0.8,1.2,0.6,1.4,1.6,1,7,8.33,-1,0,-3,-1,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,30,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,2,1,1,-1,0,1,3,-1,2,0,1,1,-1,0,-3,-1,3,1,2,0.8,1,0.2,0.4,0.6 +868,R_7aOhb3G82QkZXON,25 - 31,American,Male,1,3,3,-2,2,2,1,3,2,1,-1,-2,3,-2,3,-1,1,-1,0,-1,1,3,3,-1,2,2,2,1,-1,2,-1,4,-2,-2,2,-2,3,4,-3,-2,-3,-3,-2,8,2,3,3,-1,3,8,3,-2,3,-3,3,7,-2,-2,3,-2,3,8,3,3,3,3,3,7,TRUE,0,90,TRUE,1,60,TRUE,0,85,FALSE,1,65,TRUE,1,70,FALSE,1,55,TRUE,1,80,FALSE,0,60,TRUE,1,50,TRUE,1,80,FALSE,1,90,TRUE,0,90,TRUE,1,80,FALSE,1,50,TRUE,1,55,TRUE,1,70,TRUE,0,50,TRUE,0,70,FALSE,1,50,TRUE,0,60,FALSE,0,50,TRUE,1,50,FALSE,1,75,TRUE,1,70,FALSE,1,75,TRUE,1,80,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,90,0.36,0.04,0.09,0.04,0.01,0.2025,0.09,0.04,0.36,0.25,0.0625,0.04,0.25,0.01,0.09,0.16,0.0625,0.1225,0.25,0.0625,0.25,0.2025,0.25,0.25,0.25,0.25,0.25,0.81,0.7225,0.49,0.25,0.81,0.244553571,0.125,0.364107143,15,46.88,21,65.63,6,75,5,62.5,6,75,4,50,13,81.25,8,50,66.41,58.75,65,71.88,70,66.88,65.94,-18.75,0.78,-16.25,2.5,-3.12,20,-14.37,15.94,0,0,0,1,0,0,0,4,0,2,1,0,1,0,0,2,3,2,3,1,1,0,0,1,1,1,3,0,5,2,1,0,0,0,0,4,2,4,3,4,0.2,1.2,0.4,2.2,0.6,2.2,0.2,3.4,1,1.6,3.33,7.67,-6,-3,-4,1,-4.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),29,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,-1,0,0,0,-1,-1,-3,4,-5,0,0,0,1,0,0,-2,1,-2,0,-3,-0.4,-1,0.2,-1.2,-0.6 +869,R_5SfD2exjwMqMkgW,25 - 31,American,Female,-3,3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,10,3,3,3,3,3,0,3,3,3,3,3,0,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,50,50,50,50,50,50,50,50,0,0,0,0,0,-50,50,6,0,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2.4,0,0,0,1.6,0,0,0,0.6,0.4,0,3.33,0,-10,0,0,-3.33,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),27,0,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.8,0,0,0,0.2 +870,R_3ErRfDkZXc00MMA,25 - 31,American,Female,3,3,2,1,3,-1,1,2,-1,3,2,2,3,3,3,1,2,2,2,1,3,3,2,2,3,2,1,1,1,3,2,7,2,2,3,3,3,3,-1,2,-2,2,-2,8,3,3,2,2,3,1,1,1,2,-3,3,4,2,2,3,3,3,2,3,3,2,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,51,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,0,54,TRUE,1,100,TRUE,0,51,TRUE,0,100,FALSE,1,52,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,52,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,65,FALSE,0,100,FALSE,0,59,TRUE,1,55,0,0,0,0,0.2025,0,0.09,0,0,0,1,0,0.2601,0,0,0,0,0.2025,0,0.2704,0,0.2916,0.2304,0.5625,0.2601,0.2401,0.3481,0,0,1,0.4225,0,0.192171429,0.125364286,0.258978571,12,37.5,23,71.88,5,62.5,6,75,5,62.5,7,87.5,12,75,11,68.75,84.06,65.25,83.88,90.88,96.25,86.81,81.31,-34.38,12.18,2.75,8.88,28.38,8.75,11.81,12.56,0,0,0,1,0,2,0,1,4,1,0,0,0,0,0,2,0,4,0,3,0,0,0,1,0,2,0,0,2,0,0,0,0,0,0,2,1,0,1,2,0.2,1.6,0,1.8,0.2,0.8,0,1.2,0.9,0.55,4,2.33,1,3,1,3,1.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),31,1.875,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0,-1,4,-1,1,0,0.8,0,0.6,0.35 +871,R_5oQGSysi5uvMM2w,25 - 31,American,Female,0,2,2,3,3,-1,-2,3,-1,1,3,3,3,1,3,2,1,3,3,1,1,3,3,3,3,4,-2,0,3,1,3,4,2,2,2,1,2,8,1,3,3,1,2,2,0,2,2,2,3,3,0,-2,2,0,2,4,3,3,3,-1,2,4,3,0,2,2,2,3,TRUE,0,88,FALSE,0,55,TRUE,0,100,TRUE,0,56,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,87,FALSE,0,55,TRUE,1,100,TRUE,0,70,TRUE,0,95,TRUE,1,71,TRUE,0,52,TRUE,1,59,TRUE,1,69,FALSE,1,59,TRUE,0,99,TRUE,0,65,TRUE,0,90,TRUE,1,80,FALSE,0,52,TRUE,0,70,TRUE,1,95,TRUE,0,95,TRUE,1,95,FALSE,1,50,FALSE,1,55,TRUE,0,65,TRUE,1,79,FALSE,0,50,TRUE,1,75,0.0169,0.0025,0.0961,0,0.0625,0,0.0025,0,0.81,0.2704,0.0441,0.0841,0.3025,0.49,0.2025,0.3025,0.49,0.3136,0.2025,0.9025,0.04,0.1681,0.4225,0.2704,0.1681,0.25,0.25,0.7744,1,0.9801,0.4225,0.9025,0.361725,0.24105,0.4824,14,43.75,16,50,2,25,6,75,3,37.5,5,62.5,12,75,4,25,74.56,57.5,71.88,85.12,83.75,73.56,75.56,-6.25,24.56,32.5,-3.12,47.62,21.25,-1.44,50.56,1,1,1,0,0,1,2,0,2,2,1,1,1,0,1,1,2,0,2,1,0,0,0,1,0,1,0,1,1,1,0,0,0,2,1,1,1,1,1,1,0.6,1.4,0.8,1.2,0.2,0.8,0.6,1,1,0.65,5.33,3.67,1,0,4,-1,1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,1,1,1,-1,0,0,2,-1,1,1,1,1,1,-2,0,0,1,-1,1,0,0.4,0.6,0.2,0.2,0.35 +872,R_3qVx10RPM0TI7Du,18 - 24,American,Female,3,3,3,3,3,1,3,2,3,2,2,1,0,3,1,2,0,1,3,1,0,1,0,1,2,7,3,1,2,1,2,8,2,1,3,3,2,8,0,1,0,1,2,7,3,3,2,1,2,9,-1,0,2,1,3,6,1,1,2,2,3,10,2,0,3,-1,1,7,FALSE,1,65,TRUE,1,65,FALSE,1,64,TRUE,0,68,FALSE,0,62,TRUE,0,72,FALSE,0,80,TRUE,1,66,FALSE,0,67,TRUE,1,71,FALSE,1,79,TRUE,0,64,FALSE,0,72,FALSE,1,65,TRUE,1,63,TRUE,1,59,TRUE,0,63,TRUE,0,79,FALSE,1,69,FALSE,1,58,FALSE,0,65,FALSE,0,72,TRUE,0,79,TRUE,1,68,TRUE,0,59,FALSE,0,62,TRUE,0,66,FALSE,1,60,FALSE,1,62,TRUE,1,59,FALSE,0,55,TRUE,1,66,0.1156,0.3844,0.1681,0.64,0.1156,0.5184,0.1024,0.0841,0.1764,0.5184,0.1681,0.5184,0.4489,0.0441,0.3844,0.1225,0.6241,0.4624,0.16,0.3481,0.4225,0.1369,0.0961,0.1225,0.3969,0.4356,0.3025,0.1225,0.1296,0.6241,0.1444,0.4096,0.290696429,0.3063,0.275092857,24,75,16,50,4,50,2,25,3,37.5,7,87.5,8,50,8,50,66.38,66.5,67.62,69.12,62.25,65.75,67,25,16.38,16.5,42.62,31.62,-25.25,15.75,17,3,2,3,2,1,2,2,0,2,0,0,0,3,0,1,2,1,1,2,1,0,0,1,2,1,2,3,0,2,1,1,0,2,1,2,0,0,2,4,0,2.2,1.2,0.8,1.4,0.8,1.6,1.2,1.2,1.4,1.2,7.67,8.33,-2,2,-2,0,-0.66,10 cents,100 minutes,24 days,Female,University - PhD,24,-1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,3,2,2,0,0,0,-1,0,0,-1,-1,0,1,-1,-1,2,1,-1,-2,1,1.4,-0.4,-0.4,0.2,0.2 +873,R_7HCrIcsRpIc8QZX,18 - 24,American,Male,0,1,-3,3,3,-3,0,2,-3,3,-2,-1,3,0,3,0,0,-1,2,3,2,-1,1,3,-1,10,-3,3,-3,3,-3,10,-3,3,-3,-3,-3,10,0,-3,-3,2,-3,10,-1,3,-3,3,3,3,-3,-3,0,-3,0,2,-3,-1,3,-3,3,2,-3,-3,-3,-3,-3,4,TRUE,0,70,TRUE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,70,TRUE,1,90,TRUE,1,54,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,55,FALSE,0,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,FALSE,1,53,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,56,FALSE,1,82,FALSE,1,75,FALSE,0,100,FALSE,0,100,FALSE,0,100,0.09,0,0,1,1,0,0,0.2116,0,0.0625,1,0,0.01,0,0,0.25,0,0,0.0324,0.16,0,1,0.2209,0.2025,0.36,0.1936,1,0.49,0,0,0.0625,0,0.223428571,0.181007143,0.26585,22,68.75,25,78.13,6,75,6,75,6,75,7,87.5,11,68.75,14,87.5,85.94,81.12,91.88,76.75,94,89.94,81.94,-9.38,7.81,6.12,16.88,1.75,6.5,21.19,-5.56,2,2,4,0,4,0,3,5,6,6,1,4,6,3,6,0,3,2,0,6,1,2,0,0,0,0,3,2,0,3,1,0,0,3,0,3,3,2,5,6,2.4,4,4,2.2,0.6,1.6,0.8,3.8,3.15,1.7,10,2.33,7,8,8,6,7.67,5 cents,100 minutes,47 days,Male,High School (or equivalent),20,1.125,1,0,1,0,1,0,0.67,0.33,03VLPfPs,02COC,02FUT,01ITEM,01DIR,1,0,4,0,4,0,0,3,6,3,0,4,6,0,6,-3,0,0,-5,0,1.8,2.4,3.2,-1.6,1.45 +874,R_6VPc11udpjyq5Td,18 - 24,Canadian,Female,0,2,2,3,0,-1,-1,1,0,0,1,1,1,1,-2,2,1,2,1,0,0,2,1,3,-1,5,1,0,2,2,0,5,0,-1,2,1,-3,4,1,2,1,0,1,6,2,3,3,3,1,6,2,1,0,-1,1,6,1,1,0,0,-3,6,3,3,2,2,1,5,TRUE,0,70,FALSE,0,92,TRUE,0,100,FALSE,1,93,TRUE,1,63,FALSE,1,77,TRUE,1,97,FALSE,0,75,TRUE,1,66,FALSE,0,82,FALSE,1,75,TRUE,0,95,TRUE,1,86,FALSE,1,100,TRUE,1,86,FALSE,0,59,TRUE,0,82,FALSE,1,95,FALSE,1,85,TRUE,0,65,TRUE,1,78,FALSE,0,67,TRUE,0,73,TRUE,1,66,TRUE,0,66,TRUE,1,67,FALSE,1,67,FALSE,1,92,TRUE,0,71,TRUE,1,93,FALSE,0,74,FALSE,0,87,0.5625,0.1089,0.3481,0.0009,0.7569,0.0529,0.1156,0.6724,0.4225,0.4489,0.0049,0.0196,0.1156,0.0625,0.1369,0.8464,0.5329,0.0049,0.0064,0.4356,0.0484,0.0196,0.0225,0,0.6724,0.1089,0.5476,0.49,1,0.0025,0.5041,0.9025,0.319764286,0.299492857,0.340035714,17,53.13,17,53.13,6,75,4,50,4,50,3,37.5,9,56.25,8,50,79.5,79.75,77.12,80.5,80.62,77.38,81.62,0,26.37,4.75,27.12,30.5,43.12,21.13,31.62,0,0,1,0,1,2,1,1,2,0,1,2,1,0,1,1,1,1,1,1,2,1,1,0,1,3,2,1,1,1,0,0,1,1,1,1,2,0,1,1,0.4,1.2,1,1,1,1.6,0.6,1,0.9,1.05,4.67,6,-1,-1,-2,1,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,19,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,-2,-1,0,0,0,-1,-1,0,1,-1,1,2,0,-1,0,0,-1,1,0,0,-0.6,-0.4,0.4,0,-0.15 +875,R_1VL3zORMuDfKsNo,25 - 31,American,Female,1,3,0,-1,-1,-1,-2,2,0,-1,3,3,1,1,3,0,0,1,1,-2,3,3,-3,1,-3,5,-2,2,-1,2,-1,5,-1,2,3,3,-1,9,1,3,2,2,1,10,1,3,1,2,-3,5,-3,0,1,2,0,7,3,3,1,-1,3,4,-1,0,0,1,-3,9,FALSE,1,100,TRUE,1,97,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,94,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,72,TRUE,0,74,TRUE,1,79,TRUE,0,70,FALSE,0,50,TRUE,1,68,TRUE,0,54,TRUE,0,81,FALSE,1,55,FALSE,1,100,TRUE,1,89,TRUE,1,50,FALSE,1,50,TRUE,1,93,FALSE,1,84,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,68,FALSE,0,50,TRUE,1,50,TRUE,1,100,0.25,0,0.1024,0.0036,0,0,0.0049,0,0,0.25,0.25,0.0441,0.25,0.0784,0.25,0.0009,0.25,0.25,0.0625,0.0256,0.0121,0.25,0.2025,0.49,0.2916,0,0.25,0,1,0.6561,0.4624,0.5476,0.209953571,0.116307143,0.3036,15,46.88,23,71.88,7,87.5,5,62.5,6,75,5,62.5,13,81.25,10,62.5,75.09,65.5,73.75,84.88,76.25,73.12,77.06,-25,3.21,-22,11.25,9.88,13.75,-8.13,14.56,2,0,3,2,2,1,4,3,2,0,4,1,2,2,4,1,3,1,1,3,0,0,1,3,2,2,2,1,2,1,0,0,0,2,0,1,0,1,0,1,1.8,2,2.6,1.8,1.2,1.6,0.4,0.6,2.05,0.95,6.33,5.33,0,-2,5,1,1,10 cents,100 minutes,15 days,Female,High School (or equivalent),28,1,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,02REV,2,0,2,-1,0,-1,2,2,0,-1,4,1,2,0,4,0,3,0,1,2,0.6,0.4,2.2,1.2,1.1 +876,R_5zc474LXAVKaI4f,25 - 31,American,Female,-3,-3,-3,-3,-3,2,2,2,3,3,1,2,2,2,1,-3,-2,-3,-1,-2,2,2,3,1,1,5,-2,2,2,-2,2,7,2,3,3,0,3,7,3,-3,2,2,1,6,0,3,3,2,3,8,1,3,3,2,1,9,2,-1,2,3,-1,1,1,2,3,1,0,7,FALSE,1,54,TRUE,1,56,TRUE,0,91,FALSE,1,56,TRUE,1,55,FALSE,1,54,TRUE,1,76,FALSE,0,54,TRUE,1,56,TRUE,1,54,TRUE,0,58,FALSE,1,55,FALSE,0,55,FALSE,1,100,FALSE,0,66,TRUE,1,71,TRUE,0,54,TRUE,0,99,FALSE,1,53,FALSE,1,53,FALSE,0,100,TRUE,1,54,FALSE,1,55,FALSE,0,64,TRUE,0,71,TRUE,1,100,TRUE,0,65,FALSE,1,72,TRUE,0,67,TRUE,1,100,TRUE,1,53,TRUE,1,100,0.2916,0,0.0841,0.0576,0,0.2116,0.4096,0.2116,0.2209,0.2116,0,0.3025,0.1936,0.3364,0.2025,0.1936,0.2025,0.1936,0.0784,0.5041,1,0.4356,0.2209,0,0.2916,0.4225,0.2209,0.2116,0.8281,0.9801,0.4489,0.2025,0.311971429,0.206428571,0.417514286,5,15.63,20,62.5,5,62.5,4,50,6,75,5,62.5,11,68.75,9,56.25,67.84,57.88,67.5,76,70,69.62,66.06,-46.87,5.34,-4.62,17.5,1,7.5,0.87,9.81,5,5,6,4,4,4,0,0,5,1,1,1,1,2,2,6,1,5,3,3,3,6,6,5,6,1,1,1,1,2,1,3,0,1,2,4,4,6,2,2,4.8,2,1.4,3.6,5.2,1.2,1.4,3.6,2.95,2.85,6.33,6,-3,-2,6,-1,0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,-1,0,-1,-2,3,-1,-1,4,-1,0,-2,1,1,0,2,-3,-1,1,1,-0.4,0.8,0,0,0.1 +877,R_3LXMNqKDKNC3lNT,25 - 31,American,Female,2,2,0,2,0,0,2,2,2,0,3,1,3,1,2,0,0,0,0,-2,3,3,2,0,1,7,-3,0,1,0,-2,9,2,0,0,0,0,8,0,1,1,0,-3,9,3,3,0,-2,2,10,3,-2,3,-2,1,10,3,2,3,2,1,10,3,3,3,3,2,10,TRUE,0,95,FALSE,0,50,TRUE,0,77,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,55,FALSE,0,50,TRUE,1,80,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,57,FALSE,1,50,TRUE,0,91,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,89,TRUE,1,75,FALSE,0,50,TRUE,1,93,0.2025,0,0.1849,0.25,0.0049,0.25,0.25,0.04,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9025,0.5929,0.8281,0.7921,1,0.311535714,0.186242857,0.436828571,16,50,17,53.13,4,50,4,50,4,50,5,62.5,6,37.5,11,68.75,64.44,50,66.5,77,64.25,60,68.88,-3.13,11.31,0,16.5,27,1.75,22.5,0.13,1,1,2,2,1,3,2,1,2,2,1,1,3,1,2,0,1,1,0,1,1,1,0,4,2,3,4,1,4,1,0,1,0,1,1,3,3,3,3,4,1.4,2,1.6,0.6,1.6,2.6,0.6,3.2,1.4,2,8,10,-3,-1,-2,-1,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),31,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,2,-2,-1,0,-2,0,-2,1,1,0,3,0,1,-3,-2,-2,-3,-3,-0.2,-0.6,1,-2.6,-0.6 +878,R_5Hqcf3bOOCH1Sq5,18 - 24,Canadian,Male,1,1,1,1,1,0,3,-1,0,0,-3,-2,2,0,2,-1,0,-1,0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,-3,0,0,0,5,TRUE,0,75,FALSE,0,50,TRUE,0,62,FALSE,1,60,FALSE,0,56,FALSE,1,60,TRUE,1,66,TRUE,1,70,FALSE,0,50,TRUE,1,84,FALSE,1,67,FALSE,1,70,FALSE,0,67,FALSE,1,57,FALSE,0,59,TRUE,1,100,FALSE,1,55,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,68,TRUE,1,74,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,60,TRUE,1,66,TRUE,1,50,TRUE,1,100,0.09,0.25,0,0.1156,0,0.16,0.25,0.0256,0.25,0.0676,0.1156,0.4489,0.25,0.1089,0.3136,0.25,0,0.16,0.25,0,0.1024,0.3481,0.25,0.1849,0.2025,0.25,0.25,0.5625,0.3844,0.25,0.36,0.09,0.210178571,0.171442857,0.248914286,8,25,22,68.75,5,62.5,5,62.5,6,75,6,75,9,56.25,13,81.25,64.88,54.5,70.75,69.5,64.75,66.25,63.5,-43.75,-3.87,-8,8.25,-5.5,-10.25,10,-17.75,1,1,1,1,1,0,3,1,0,0,3,2,2,0,2,1,0,1,0,0,1,1,1,1,1,0,3,1,0,0,3,2,2,0,2,1,3,1,0,0,1,0.8,1.8,0.4,1,0.8,1.8,1,1,1.15,6,5,0,1,2,0,1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,20,0.875,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,-0.6,-0.15 +879,R_5JyjqEE5uYRgVqe,18 - 24,Canadian,Female,2,2,2,2,3,1,-2,2,1,1,1,-2,2,-2,1,1,1,1,2,2,1,2,2,-2,-1,6,3,-1,2,-3,-1,4,3,-2,-2,1,-2,7,2,2,2,2,2,3,3,2,2,1,3,2,2,-3,3,-2,2,4,2,-1,3,-1,2,2,2,2,3,2,3,5,TRUE,0,91,FALSE,0,54,TRUE,0,91,TRUE,0,59,TRUE,1,85,FALSE,1,100,TRUE,1,70,TRUE,1,70,FALSE,0,51,TRUE,1,97,FALSE,1,76,TRUE,0,60,TRUE,1,96,FALSE,1,100,TRUE,1,86,TRUE,1,75,TRUE,0,65,FALSE,1,100,FALSE,1,54,FALSE,1,81,FALSE,0,97,FALSE,0,50,FALSE,1,92,TRUE,1,92,FALSE,1,92,TRUE,1,99,TRUE,0,55,FALSE,1,74,FALSE,1,65,FALSE,0,59,FALSE,0,50,TRUE,1,99,0.09,0.0001,0.0625,0.09,0.0001,0,0.0064,0.0009,0.0361,0.25,0.3481,0.0016,0.2601,0.0576,0.0225,0.2916,0.0064,0.3481,0.0676,0.0064,0.9409,0.0196,0.2116,0,0.4225,0.3025,0.25,0.8281,0.8281,0,0.1225,0.36,0.213903571,0.116392857,0.311414286,21,65.63,20,62.5,3,37.5,6,75,6,75,5,62.5,10,62.5,10,62.5,77.66,60.62,87.38,87.38,75.25,76.88,78.44,3.13,15.16,23.12,12.38,12.38,12.75,14.38,15.94,1,0,0,4,4,2,1,0,4,2,2,0,4,3,3,1,1,1,0,0,1,0,0,1,0,1,1,1,3,1,1,1,1,1,1,1,1,2,0,1,1.8,1.8,2.4,0.6,0.4,1.4,1,1,1.65,0.95,5.67,2.67,4,0,5,-2,3,10 cents,5 minutes,15 days,Female,University - Undergraduate,21,1.625,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,3,4,1,0,-1,1,1,1,-1,3,2,2,0,0,-1,0,-1,1.4,0.4,1.4,-0.4,0.7 +880,R_7XiaGit9PpgYp8Y,25 - 31,American,Male,3,2,2,2,3,-1,0,1,2,-1,2,1,1,3,2,2,1,2,3,2,1,3,2,3,1,9,1,2,1,2,3,8,2,2,1,1,3,9,2,1,2,0,2,8,2,1,3,2,2,9,1,3,2,3,2,9,3,2,1,2,1,9,1,3,1,3,2,9,TRUE,0,84,TRUE,1,85,TRUE,0,91,TRUE,0,76,TRUE,1,64,TRUE,0,71,TRUE,1,71,TRUE,1,70,FALSE,0,93,TRUE,1,100,TRUE,0,85,FALSE,1,89,TRUE,1,76,TRUE,0,92,TRUE,1,87,TRUE,1,79,FALSE,1,96,TRUE,0,81,FALSE,1,74,TRUE,0,90,FALSE,0,82,TRUE,1,79,TRUE,0,82,FALSE,0,90,TRUE,0,88,TRUE,1,81,FALSE,1,92,TRUE,0,87,TRUE,0,92,FALSE,0,87,TRUE,1,83,FALSE,0,89,0.09,0.0361,0.0441,0.0841,0.7921,0.5041,0.81,0,0.81,0.0441,0.7569,0.0576,0.8649,0.7225,0.1296,0.0225,0.6724,0.5776,0.7569,0.7744,0.6724,0.0169,0.0676,0.8464,0.0016,0.0064,0.0289,0.7056,0.8281,0.6561,0.8464,0.0121,0.463717857,0.483164286,0.444271429,27,84.38,15,46.88,5,62.5,3,37.5,4,50,3,37.5,11,68.75,4,25,83.94,84.38,81.5,84.5,85.38,82.25,85.62,37.5,37.06,21.88,44,34.5,47.88,13.5,60.62,2,1,0,1,2,2,2,0,0,4,0,1,0,2,1,0,0,0,3,0,1,1,1,0,1,2,3,1,1,3,1,1,0,1,1,1,2,1,0,0,1.2,1.6,0.8,0.6,0.8,2,0.8,0.8,1.05,1.1,8.67,9,0,-1,0,-1,-0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),26,0.125,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,1,0,-1,1,1,0,-1,-1,-1,1,-1,0,0,1,0,-1,-2,-1,3,0,0.4,-0.4,0,-0.2,-0.05 +881,R_3T8yCDUypN1CDZL,25 - 31,American,Male,3,3,3,3,3,3,-3,3,-3,3,3,2,3,3,3,3,2,2,3,3,3,3,3,3,3,10,3,-3,3,-3,3,9,3,2,3,3,3,10,2,3,3,3,2,9,2,2,3,3,3,9,3,-3,3,-3,3,10,3,3,2,2,3,7,3,2,3,2,1,9,FALSE,1,97,TRUE,1,100,TRUE,0,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0256,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0.0009,0.9801,0,0,0,0.106464286,0.071428571,0.1415,32,100,29,90.63,8,100,7,87.5,8,100,6,75,15,93.75,14,87.5,99.38,100,100,99.62,97.88,99,99.75,9.37,8.75,0,12.5,-0.38,22.88,5.25,12.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,2,0,0,0,0.8,0.4,0,0.6,0.8,0.2,0.45,9.67,8.67,1,-1,3,0,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),25,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,-1,-1,0,0,0,0,0,0,0,0,0,-1,-1,-1,0,1,1,0,-1,-1,-0.4,0,-0.6,0,-0.25 +882,R_1mfxtXmWuzrRwfr,25 - 31,Canadian,Female,2,2,2,-2,2,3,1,2,1,1,0,3,3,3,2,0,0,-1,0,1,-3,-1,3,-3,3,7,-1,-2,2,3,3,5,3,0,-2,3,-3,7,0,3,0,-3,-2,6,2,0,2,1,0,3,3,1,3,0,-1,2,0,3,3,3,1,4,2,0,2,2,3,7,FALSE,1,60,TRUE,1,50,FALSE,1,100,TRUE,0,50,FALSE,0,75,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,1,80,FALSE,0,75,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,85,TRUE,0,96,FALSE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,70,FALSE,1,100,FALSE,0,50,TRUE,0,50,TRUE,0,85,TRUE,0,75,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0.25,0,0.25,0.25,0,0.09,0.5625,0.25,0,0,0,0.04,0.25,0.5625,0.25,0.04,0.25,0.7225,0,0,0.25,0.25,0,0.7225,0.25,0.25,0.16,0,0.9216,0.5625,1,0.272646429,0.181785714,0.363507143,10,31.25,17,53.13,3,37.5,4,50,5,62.5,5,62.5,10,62.5,7,43.75,75.97,53.75,83.12,78.88,88.12,75,76.94,-21.88,22.84,16.25,33.12,16.38,25.62,12.5,33.19,5,3,1,1,1,4,3,0,2,2,3,3,5,0,5,0,3,1,3,3,0,2,0,3,2,0,0,1,1,2,0,0,0,0,1,2,0,3,2,2,2.2,2.2,3.2,2,1.4,0.8,0.2,1.8,2.4,1.05,6.33,3,4,3,3,-1,3.33,10 cents,100 minutes,47 days,Female,University - Undergraduate,25,0.25,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,5,1,1,-2,-1,4,3,-1,1,0,3,3,5,0,4,-2,3,-2,1,1,0.8,1.4,3,0.2,1.35 +883,R_35WM3rWzxA5ZeWL,18 - 24,Canadian,Female,2,2,-1,3,3,2,3,3,-1,1,3,-3,2,3,-1,3,1,3,3,0,3,2,3,3,-3,5,-2,3,-1,3,-3,10,1,3,1,-3,-3,7,-3,1,-3,3,-3,5,2,3,-2,1,3,3,2,0,3,-1,3,3,3,-3,3,3,-2,1,3,3,3,2,1,4,TRUE,0,78,FALSE,0,50,TRUE,0,54,TRUE,0,50,TRUE,1,70,TRUE,0,53,FALSE,0,50,TRUE,1,57,TRUE,1,81,TRUE,1,66,FALSE,1,53,TRUE,0,84,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,64,TRUE,0,50,TRUE,0,100,TRUE,0,55,FALSE,1,50,TRUE,1,51,FALSE,0,50,FALSE,1,50,TRUE,1,65,FALSE,1,100,TRUE,1,80,TRUE,0,50,TRUE,0,50,TRUE,0,100,TRUE,1,53,FALSE,0,50,TRUE,1,60,0.1849,0.04,0.1296,0.25,0.16,0.2809,0.1225,0.1156,0.25,0.25,0.2209,0.25,0.0361,0.2209,0.09,0.25,0.25,0.25,0.25,0,0.2401,0.25,0.3025,0.25,0.25,0.25,0.25,0.6084,0.2916,1,1,0.7056,0.299825,0.196207143,0.403442857,9,28.13,16,50,3,37.5,4,50,4,50,5,62.5,11,68.75,5,31.25,61.69,54.88,60.5,71.75,59.62,59.19,64.19,-21.87,11.69,17.38,10.5,21.75,-2.88,-9.56,32.94,1,0,4,0,6,4,0,4,4,4,2,6,1,6,2,6,0,6,0,3,0,1,1,2,0,0,3,0,0,2,0,0,1,0,1,0,2,0,1,1,2.2,3.2,3.4,3,0.8,1,0.4,0.8,2.95,0.75,7.33,2.33,2,7,6,1,5,10 cents,5 minutes,47 days,Female,University - Undergraduate,21,0.125,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,1,-1,3,-2,6,4,-3,4,4,2,2,6,0,6,1,6,-2,6,-1,2,1.4,2.2,3,2.2,2.2 +884,R_7ReKyF7BtGzjQc0,25 - 31,American,Female,3,3,2,-1,0,0,-3,1,3,1,1,1,1,-3,1,-3,-2,-2,-3,-1,3,2,1,1,0,3,-1,-3,-1,1,0,1,1,1,1,-3,1,2,-2,-2,-2,-2,-2,1,2,3,2,0,0,2,0,-3,0,1,1,3,2,2,2,-3,2,3,-2,-2,-2,-2,-2,0,TRUE,0,93,FALSE,0,63,TRUE,0,72,FALSE,1,89,TRUE,1,87,FALSE,1,100,TRUE,1,85,TRUE,1,98,FALSE,0,89,TRUE,1,100,FALSE,1,93,TRUE,0,94,TRUE,1,89,FALSE,1,86,FALSE,0,91,TRUE,1,91,TRUE,0,92,TRUE,0,83,FALSE,1,59,FALSE,1,80,FALSE,0,100,FALSE,0,60,FALSE,1,100,TRUE,1,82,FALSE,1,93,TRUE,1,66,FALSE,1,50,FALSE,1,94,TRUE,0,97,TRUE,1,94,FALSE,0,89,TRUE,1,100,0.0004,0.1156,0.0081,0.0225,0,0,0.0324,0,0.04,0.36,0.0036,0.0121,0.7921,0.0049,0.0169,0.3969,0,0.0121,0.0036,0.0049,1,0.8281,0.1681,0.0196,0.8464,0.25,0.7921,0.8649,0.5184,0.6889,0.9409,0.8836,0.338589286,0.119357143,0.557821429,8,25,20,62.5,4,50,5,62.5,5,62.5,6,75,10,62.5,10,62.5,86.22,77.88,95.62,83.25,88.12,86.5,85.94,-37.5,23.72,27.88,33.12,20.75,13.12,24,23.44,0,1,1,2,0,1,0,2,2,1,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0,0,0,1,2,0,1,1,1,0,1,1,0,0,1,1,0.8,1.2,0,0.6,0.4,0.6,0.8,0.6,0.65,0.6,2,2.67,1,-2,-1,1,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,1,1,1,0,1,0,1,0,1,-1,-1,-1,0,-1,0,0,0,0,0,0.4,0.6,-0.8,0,0.05 +885,R_1zSef5kmP9u9TPo,25 - 31,American,Prefer not to say,2,2,2,2,2,0,0,2,0,2,0,0,2,0,2,0,0,0,0,0,3,3,3,3,3,1,0,0,2,1,2,3,0,0,2,2,2,1,0,0,0,0,0,1,3,3,3,3,3,3,0,0,2,0,2,1,0,0,2,1,2,1,-1,-1,-1,-1,-1,1,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,0,53,TRUE,1,100,FALSE,1,100,TRUE,1,53,TRUE,1,100,TRUE,1,100,FALSE,0,71,TRUE,0,53,TRUE,0,100,TRUE,1,100,TRUE,0,69,TRUE,1,65,TRUE,1,100,TRUE,0,63,FALSE,1,100,FALSE,1,100,TRUE,0,57,TRUE,1,60,TRUE,1,64,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,65,FALSE,1,61,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0.2209,0,0,0,0.5041,0.3249,0.1296,0,0,0,0.2809,0,0.3025,0,0.2809,0.1521,0,0.16,0.1225,0,0.4761,0.3969,0.4225,0.36,0,0,0,1,1,0.211178571,0.130207143,0.29215,16,50,21,65.63,3,37.5,6,75,6,75,6,75,13,81.25,8,50,82.78,68.88,90.38,82.12,89.75,83,82.56,-15.63,17.15,31.38,15.38,7.12,14.75,1.75,32.56,1,1,1,1,1,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0.2,0.4,0,1,0,0.2,1,0.4,0.55,1.67,1.67,-2,2,0,0,0,10 cents,100 minutes,24 days,Prefer not to say,University - Graduate (Masters),31,1.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,-1,-1,-1,-1,-1,0,0.2,0.2,-1,-0.15 +886,R_5yaxFqyivv3pIQM,18 - 24,American,Female,2,3,3,-3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,-3,5,0,0,0,0,0,6,2,1,3,3,3,5,3,3,3,3,3,4,3,3,3,-3,-3,3,3,3,3,3,3,4,3,2,2,3,3,4,0,0,3,0,0,3,FALSE,1,61,TRUE,1,100,TRUE,0,72,FALSE,1,85,FALSE,0,73,TRUE,0,80,TRUE,1,68,FALSE,0,72,TRUE,1,83,TRUE,1,76,FALSE,1,79,TRUE,0,89,FALSE,0,72,FALSE,1,58,FALSE,0,75,FALSE,0,76,FALSE,1,79,TRUE,0,77,FALSE,1,68,FALSE,1,65,TRUE,1,82,FALSE,0,83,FALSE,1,89,TRUE,1,86,TRUE,0,74,TRUE,1,81,TRUE,0,67,TRUE,0,79,TRUE,0,83,TRUE,1,84,TRUE,1,61,TRUE,1,100,0.5184,0.0361,0.5776,0.1024,0,0.64,0.0196,0.0576,0.1225,0.6889,0.0256,0.5184,0.0289,0.0441,0.5329,0,0.0121,0.0225,0.6241,0.5476,0.0324,0.5625,0.1024,0.1764,0.0441,0.4489,0.1521,0.1521,0.5184,0.5929,0.6889,0.7921,0.291,0.193792857,0.388207143,24,75,18,56.25,6,75,4,50,5,62.5,3,37.5,10,62.5,8,50,77.41,77.25,82.25,72.25,77.88,79.5,75.31,18.75,21.16,2.25,32.25,9.75,40.38,17,25.31,0,0,0,6,0,3,3,3,3,3,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,3,3,0,3,3,1.2,3,0.6,0,0.2,0,0.4,2.4,1.2,0.75,5.33,3.67,2,2,1,1,1.66,20 cents,100 minutes,36 days,Female,High School (or equivalent),23,-0.625,0,0,0,0,1,0,0,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,0,0,6,0,3,3,3,3,3,1,1,-1,0,0,-3,-3,0,-3,-3,1,3,0.2,-2.4,0.45 +887,R_6UVBLYH5Wp8n5Ci,32 - 38,American,Female,2,3,2,2,3,2,-1,2,-1,2,3,2,3,0,3,2,2,2,2,2,2,2,2,1,2,1,1,0,1,-1,-1,1,3,1,2,0,2,1,-1,0,0,1,-1,1,2,2,2,2,2,1,2,-1,2,-1,1,1,3,1,2,0,2,1,1,1,1,1,1,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0.25,0.142857143,0.357142857,27,84.38,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,100,100,100,100,100,100,100,6.25,21.87,0,37.5,12.5,37.5,12.5,31.25,0,1,0,1,1,1,1,1,0,3,0,1,1,0,1,3,2,2,1,3,0,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0.6,1.2,0.6,2.2,0.4,0.2,0.6,1,1.15,0.55,1,1,0,0,0,0,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),32,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,0,0,1,0,1,1,1,0,2,0,0,0,0,0,2,1,1,0,2,0.2,1,0,1.2,0.6 +888,R_7gbZbs5pz5pzmpN,18 - 24,American,Male,-1,3,1,2,0,2,-2,3,-2,1,1,0,2,2,2,1,1,-2,-2,-2,0,1,3,-1,0,8,-2,-1,-3,2,2,8,1,2,0,-1,2,7,-3,-1,-3,-3,0,7,1,3,1,2,1,10,3,-2,2,-3,2,3,1,0,2,2,3,7,2,2,2,3,0,7,FALSE,1,100,TRUE,1,75,FALSE,1,80,FALSE,1,50,TRUE,1,91,FALSE,1,50,TRUE,1,55,FALSE,0,80,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,75,FALSE,1,70,TRUE,1,50,TRUE,1,100,TRUE,0,70,TRUE,0,75,TRUE,0,50,FALSE,1,70,TRUE,1,75,TRUE,1,100,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,0,50,FALSE,1,50,TRUE,0,75,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.64,0.04,0,0.2025,0,0.25,0,0,0.09,0,0.01,0.0625,0.25,0.25,0.0081,0.0625,0.64,0.25,0.25,0,0.0625,0.25,0.25,0.09,0.49,0.25,0.25,0,0.04,0.5625,0.5625,1,0.211807143,0.133792857,0.289821429,16,50,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,74.72,53.12,77,85,83.75,79.44,70,-21.88,2.84,-9.38,14.5,-2.5,8.75,-8.06,13.75,1,2,2,3,0,4,1,6,4,1,0,2,2,3,0,4,2,1,1,2,2,0,0,0,1,1,0,1,1,1,0,0,0,0,1,1,1,4,5,2,1.6,3.2,1.4,2,0.6,0.8,0.2,2.6,2.05,1.05,7.67,6.67,-2,5,0,0,1,10 cents,100 minutes,36 days,Male,High School (or equivalent),21,1.5,0,0,0,1,1,0,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,2,2,3,-1,3,1,5,3,0,0,2,2,3,-1,3,1,-3,-4,0,1,2.4,1.2,-0.6,1 +889,R_6VmrmE3nt3lx2jj,25 - 31,American,Female,2,3,2,3,-3,-3,-2,1,2,-2,2,1,2,0,2,-2,-2,-2,-2,-2,3,3,3,3,-3,1,-3,-3,-2,3,-3,1,2,2,2,-1,2,1,-2,-2,-2,-2,-2,1,3,2,2,3,-3,1,-2,-3,1,2,-2,1,2,2,2,0,2,1,1,0,1,1,-2,8,TRUE,0,100,FALSE,0,53,TRUE,0,94,FALSE,1,56,TRUE,1,96,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,1,70,TRUE,0,54,FALSE,0,50,TRUE,1,95,TRUE,0,53,TRUE,0,100,TRUE,0,70,FALSE,1,55,TRUE,1,97,FALSE,0,56,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,90,TRUE,0,100,TRUE,1,95,FALSE,0,82,TRUE,1,95,0,0,0.0025,0,0.0025,0.0036,0,0,0.2025,0.3136,0.0025,0.09,0.09,0.49,0.0016,0.2809,0.2116,0.1936,0.01,0,0.0009,0.25,0.49,0.2916,0.2809,0.25,0.6724,1,0.8836,1,1,1,0.32185,0.134457143,0.509242857,25,78.13,18,56.25,2,25,6,75,4,50,6,75,12,75,6,37.5,81.22,62.62,82.38,88.75,91.12,84.94,77.5,21.88,24.97,37.62,7.38,38.75,16.12,9.94,40,1,0,1,0,0,0,1,3,1,1,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,3,2,3,3,0,0.4,1.2,0.4,0,0.4,0.4,0.2,2.2,0.5,0.8,1,1,0,0,0,-7,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),27,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,-1,1,0,0,-1,0,3,1,1,0,0,0,1,0,-3,-2,-3,-3,0,0,0.8,0.2,-2.2,-0.3 +890,R_1j8rDeHXUGqOs1B,25 - 31,American,Female,2,2,2,2,3,1,1,0,2,2,3,2,3,1,2,-1,-1,-3,-2,-2,0,2,2,-1,1,4,2,2,3,2,1,4,3,3,0,3,3,5,2,2,3,2,1,6,2,2,2,2,3,0,2,0,2,0,2,4,2,2,3,1,2,0,2,2,2,2,0,4,FALSE,1,50,FALSE,0,50,FALSE,1,65,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,60,FALSE,0,60,TRUE,1,50,TRUE,1,85,FALSE,1,50,TRUE,0,60,TRUE,1,50,TRUE,0,50,TRUE,1,60,FALSE,0,50,FALSE,1,50,TRUE,0,60,TRUE,0,50,FALSE,1,60,FALSE,0,70,TRUE,1,60,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,60,TRUE,0,50,FALSE,1,60,TRUE,0,55,FALSE,0,85,FALSE,0,50,TRUE,1,60,0.36,0.16,0.25,0.16,0.16,0,0.0625,0.0225,0.16,0.16,0.7225,0.25,0.25,0.25,0.25,0.25,0,0.25,0.16,0,0.49,0.16,0.25,0.25,0.25,0.25,0.25,0.25,0.1225,0.36,0.3025,0.36,0.222946429,0.199107143,0.246785714,16,50,20,62.5,4,50,6,75,6,75,4,50,10,62.5,10,62.5,62.03,51.25,66.88,65.62,64.38,60.94,63.12,-12.5,-0.47,1.25,-8.12,-9.38,14.38,-1.56,0.62,2,0,0,3,2,1,1,3,0,1,0,1,3,2,1,3,3,6,4,3,0,0,0,0,0,1,1,2,2,0,1,0,0,0,0,3,3,5,4,2,1.4,1.2,1.4,3.8,0,1.2,0.2,3.4,1.95,1.2,4.33,1.33,4,0,5,2,3,10 cents,100 minutes,47 days,Female,University - Undergraduate,27,0.375,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,0,0,3,2,0,0,1,-2,1,-1,1,3,2,1,0,0,1,0,1,1.4,0,1.2,0.4,0.75 +891,R_3Jq5MA8WvQoLH6T,25 - 31,American,Female,3,3,0,1,3,-2,1,2,0,2,2,-1,3,1,2,-1,1,-1,-1,-2,3,3,3,3,1,4,-3,2,0,2,0,7,-1,-2,1,2,2,4,0,-2,-1,-2,-1,7,3,3,1,2,3,1,-2,0,1,-1,2,4,2,-1,3,0,2,2,2,1,2,1,1,7,FALSE,1,73,FALSE,0,52,TRUE,0,100,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,75,FALSE,1,62,TRUE,1,100,FALSE,1,92,TRUE,1,63,FALSE,0,93,TRUE,0,83,TRUE,0,81,TRUE,0,60,FALSE,1,58,TRUE,1,53,TRUE,1,57,FALSE,1,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,93,TRUE,0,100,FALSE,0,91,FALSE,0,50,FALSE,0,100,0,0,0.8649,0.0049,1,0,0,0,0.1764,0.1849,0.8281,0,0.1156,0.0625,0,0.2704,0.0196,0.1681,0.8649,0,0.2209,0.1369,0.36,0.0064,0.6889,0.25,0.25,0.0729,1,0.6561,1,0.1444,0.30275,0.201828571,0.403671429,21,65.63,21,65.63,5,62.5,5,62.5,7,87.5,4,50,11,68.75,10,62.5,80.94,59.38,90.25,87,87.12,82.38,79.5,0,15.31,-3.12,27.75,-0.5,37.12,13.63,17,0,0,3,2,2,1,1,2,2,2,3,1,2,1,0,1,3,0,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0,3,0,3,2,3,1.4,1.6,1.4,1.2,0.4,0.6,0.2,2.2,1.4,0.85,5,2.33,3,3,2,0,2.67,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),25,1.25,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,2,1,2,1,0,1,1,2,3,1,2,0,0,-2,3,-3,-1,-2,1,1,1.2,-1,0.55 +892,R_77OGSdkLT2ZcOzu,25 - 31,American,Male,1,3,1,2,-1,-2,2,-1,2,-1,1,-3,3,0,3,-1,-1,-1,-1,-2,-1,2,3,2,-1,6,-2,-1,-3,1,-1,5,3,1,-1,2,3,7,-1,-2,-2,1,-2,5,3,3,1,1,3,6,1,-1,1,1,1,6,0,-3,3,-1,3,6,2,2,2,3,1,7,FALSE,1,100,TRUE,1,100,TRUE,0,80,FALSE,1,76,TRUE,1,95,FALSE,1,75,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,60,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,55,FALSE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,0,75,FALSE,1,75,TRUE,1,65,TRUE,0,65,FALSE,1,50,TRUE,0,80,FALSE,0,90,TRUE,1,50,TRUE,1,100,0,0.1225,0,0,0,0.0625,0.5625,0.01,0,0,0.81,0.01,0,0.16,0.0025,0,0,0.0576,0.25,0.0625,0.04,0.0625,0.16,0,0.2025,0.4225,0.25,0,0.64,0,0.64,0,0.157325,0.11965,0.195,16,50,27,84.38,7,87.5,7,87.5,8,100,5,62.5,14,87.5,13,81.25,83.94,73.25,84.38,91.25,86.88,88.12,79.75,-34.38,-0.44,-14.25,-3.12,-8.75,24.38,0.62,-1.5,2,1,2,0,0,0,3,2,1,0,2,4,4,2,0,0,1,1,2,0,2,0,0,1,4,3,3,2,1,2,1,0,0,1,0,3,3,3,4,3,1,1.2,2.4,0.8,1.4,2.2,0.4,3.2,1.35,1.8,6,6,0,-1,1,-2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,26,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,1,2,-1,-4,-3,0,0,0,-2,1,4,4,1,0,-3,-2,-2,-2,-3,-0.4,-1,2,-2.4,-0.45 +893,R_5nUWBF6DV3W816R,25 - 31,American,Female,1,2,2,2,3,-1,1,-1,2,2,0,1,0,1,3,0,-3,-2,0,-3,-2,-1,2,1,-1,7,0,-2,1,-3,-3,7,1,-1,-1,-1,1,6,-3,-3,-3,-3,-3,5,2,2,-1,0,3,7,2,-2,3,-3,3,8,2,2,3,0,3,8,3,3,2,3,2,8,FALSE,1,83,TRUE,1,94,TRUE,0,99,FALSE,1,95,TRUE,1,96,FALSE,1,73,TRUE,1,55,TRUE,1,98,TRUE,1,94,TRUE,1,99,FALSE,1,90,TRUE,0,98,TRUE,1,93,FALSE,1,56,TRUE,1,81,TRUE,1,98,TRUE,0,80,TRUE,0,96,TRUE,0,79,FALSE,1,89,TRUE,1,64,FALSE,0,50,TRUE,0,82,TRUE,1,53,FALSE,1,93,TRUE,1,98,TRUE,0,99,TRUE,0,98,TRUE,0,97,FALSE,0,86,FALSE,0,66,FALSE,0,99,0.0004,0.0004,0.0004,0.2025,0.9801,0.0729,0.2209,0.0001,0.0121,0.25,0.7396,0.0049,0.0036,0.01,0.0016,0.0036,0.6724,0.0025,0.9604,0.0049,0.1296,0.0361,0.6241,0.1936,0.64,0.9801,0.4356,0.0289,0.9801,0.9216,0.9409,0.9604,0.386092857,0.21245,0.559735714,21,65.63,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,85.34,87.25,85.5,78.75,89.88,82.75,87.94,6.25,25.96,24.75,35.5,3.75,39.88,7.75,44.19,3,3,0,1,4,1,3,2,5,5,1,2,1,2,2,3,0,1,3,0,1,0,3,2,0,3,3,4,5,1,2,1,3,1,0,3,6,4,3,5,2.2,3.2,1.6,1.4,1.2,3.2,1.4,4.2,2.1,2.5,6.67,7.67,0,-1,-2,-3,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),29,0.75,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,2,3,-3,-1,4,-2,0,-2,0,4,-1,1,-2,1,2,0,-6,-3,0,-5,1,0,0.2,-2.8,-0.4 +894,R_7rq1ZFhgbVbpRQm,25 - 31,American,Male,1,3,2,1,3,1,-1,2,-2,2,-1,1,2,-1,1,-1,1,2,2,1,3,3,3,2,3,10,-2,-2,-2,-2,-2,4,-3,-3,-3,-3,-3,10,0,0,0,0,0,10,3,3,-1,3,3,9,3,-2,3,-3,3,8,3,3,3,-2,3,10,3,3,3,3,3,10,TRUE,0,100,FALSE,0,58,TRUE,0,99,TRUE,0,72,FALSE,0,56,TRUE,0,62,TRUE,1,100,FALSE,0,57,TRUE,1,85,TRUE,1,91,FALSE,1,82,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,FALSE,0,52,FALSE,1,54,TRUE,0,100,FALSE,1,57,FALSE,1,53,TRUE,1,100,FALSE,0,59,FALSE,1,51,FALSE,0,51,TRUE,0,71,TRUE,1,100,FALSE,1,52,TRUE,0,100,FALSE,1,63,TRUE,1,100,FALSE,0,51,TRUE,1,100,0.3249,0,0.2704,0,0,0.3844,0.2601,0.0081,0.2209,0.3481,0,0,0.0225,0.0324,0.3136,0.3364,0.2401,0.5184,1,0.5041,0,0.2304,0.1849,0,0.2116,0.2304,0.2601,1,0.9801,1,0.1369,1,0.336553571,0.191785714,0.481321429,21,65.63,17,53.13,5,62.5,6,75,4,50,2,25,9,56.25,8,50,75.88,63.62,73.25,90.12,76.5,75.75,76,12.5,22.75,1.12,-1.75,40.12,51.5,19.5,26,2,0,1,1,0,3,1,4,0,4,2,4,5,2,4,1,1,2,2,1,2,0,3,2,0,2,1,1,1,1,4,2,1,1,2,4,2,1,1,2,0.8,2.4,3.4,1.4,1.4,1.2,2,2,2,1.65,8,9,1,-4,0,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),26,-0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,-2,-1,0,1,0,3,-1,3,-2,2,4,1,2,-3,-1,1,1,-1,-0.6,1.2,1.4,-0.6,0.35 +895,R_1duwX3m2RzUdeij,18 - 24,Canadian,Female,2,3,3,-3,2,-1,1,0,2,1,0,-3,3,-1,3,-1,1,0,-1,-3,1,3,3,-3,-1,4,-2,3,-2,2,-1,6,1,-3,3,1,3,7,1,2,2,1,-1,6,2,3,3,-3,1,6,-2,1,1,0,3,6,0,-3,3,1,3,5,0,0,0,0,0,5,TRUE,0,85,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,96,FALSE,1,100,TRUE,1,50,TRUE,1,96,TRUE,1,70,TRUE,1,50,FALSE,1,70,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,1,59,TRUE,0,50,TRUE,1,96,FALSE,1,50,FALSE,1,60,TRUE,0,100,FALSE,0,100,FALSE,0,50,TRUE,1,86,0.0016,0.0016,0,0.25,0.0196,0,0.1681,0.25,0.25,0.0025,1,0,0.09,0.09,0.0016,0.25,0.25,0.25,0.16,0.25,0.25,0.25,0,0,0.25,0.25,0.25,0.7225,1,1,1,0.25,0.294796429,0.187271429,0.402321429,22,68.75,22,68.75,6,75,5,62.5,5,62.5,6,75,13,81.25,9,56.25,73.84,61.25,79,78.25,76.88,74.88,72.81,0,5.09,-13.75,16.5,15.75,1.88,-6.37,16.56,1,0,0,0,3,1,2,2,0,2,1,0,0,2,0,2,1,2,2,2,0,0,0,0,1,1,0,1,2,2,0,0,0,2,0,1,1,0,1,3,0.8,1.4,0.6,1.8,0.2,1.2,0.4,1.2,1.15,0.75,5.67,5.67,-2,0,2,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,22,1.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,1,0,0,0,2,0,2,1,-2,0,1,0,0,0,0,1,0,2,1,-1,0.6,0.2,0.2,0.6,0.4 +896,R_7CEILV5bRV86Hvl,18 - 24,American,Female,2,3,2,1,2,2,-1,3,1,2,-1,2,2,2,1,3,2,3,3,2,3,3,2,2,3,4,1,1,3,2,2,4,1,2,-1,2,2,4,-1,1,-1,-1,-2,5,3,3,1,2,2,3,2,-1,3,1,1,1,-1,1,2,2,1,4,3,3,3,3,2,1,TRUE,0,74,FALSE,0,60,TRUE,0,86,TRUE,0,61,TRUE,1,91,FALSE,1,95,TRUE,1,87,TRUE,1,92,TRUE,1,51,FALSE,0,100,FALSE,1,65,FALSE,1,70,TRUE,1,75,FALSE,1,70,TRUE,1,70,TRUE,1,91,FALSE,1,55,TRUE,0,58,FALSE,1,56,FALSE,1,57,TRUE,1,70,TRUE,1,71,TRUE,0,69,FALSE,0,58,FALSE,1,97,TRUE,1,75,TRUE,0,68,FALSE,1,64,TRUE,0,82,TRUE,1,67,FALSE,0,64,TRUE,1,92,0.0064,0.0625,0.0081,0.0169,0.0064,0.0025,0.3364,1,0.1849,0.0841,0.1089,0.0625,0.2401,0.1225,0.0081,0.36,0.4761,0.3721,0.1296,0.0009,0.09,0.09,0.1936,0.09,0.2025,0.4624,0.4096,0.5476,0.7396,0.3364,0.6724,0.09,0.264971429,0.240328571,0.289614286,20,62.5,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,73.16,61.88,78.62,79,73.12,75.88,70.44,-3.13,7.53,11.88,3.62,16.5,-1.88,0.88,14.19,1,0,0,1,1,1,2,0,1,0,2,0,3,0,1,4,1,4,4,4,1,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0.6,0.8,1.2,3.4,0.6,0.2,0.2,0.2,1.5,0.3,4,2.67,1,3,0,4,1.33,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,-1,0,1,1,2,0,1,-1,2,-1,3,0,1,4,0,4,4,4,0,0.6,1,3.2,1.2 +897,R_6IB94fVqlSmayPv,18 - 24,Canadian,Female,2,3,3,1,3,2,1,2,2,3,3,-1,3,1,3,1,1,2,3,3,3,3,2,-2,2,5,2,1,1,2,1,2,1,1,2,3,3,4,-1,-1,-2,1,-1,7,3,3,3,2,3,1,2,2,2,2,3,1,3,-2,3,-1,3,2,3,3,3,3,3,4,TRUE,0,59,TRUE,1,90,TRUE,0,85,FALSE,1,51,TRUE,1,100,FALSE,1,70,TRUE,1,60,TRUE,1,64,TRUE,1,51,TRUE,1,91,TRUE,0,54,TRUE,0,75,TRUE,1,55,FALSE,1,60,TRUE,1,52,TRUE,1,70,TRUE,0,59,TRUE,0,100,FALSE,1,51,TRUE,0,95,TRUE,1,73,TRUE,1,83,TRUE,0,51,TRUE,1,87,FALSE,1,63,TRUE,1,96,TRUE,0,51,FALSE,1,52,TRUE,0,57,TRUE,1,100,TRUE,1,56,TRUE,1,100,0.1296,0.0016,0.09,0.16,0,0.09,0.0169,0.0081,0.9025,0.0289,0,0.2025,0.2401,0.2916,0,0.01,0.2601,0.2401,0.2304,0.1369,0.0729,0.2304,0.2401,0.16,0.3481,0.2601,0.1936,0.3481,0.7225,1,0.3249,0.5625,0.254332143,0.163628571,0.345035714,17,53.13,22,68.75,6,75,5,62.5,6,75,5,62.5,16,100,6,37.5,70.66,57,70.62,76.5,78.5,76.75,64.56,-15.62,1.91,-18,8.12,1.5,16,-23.25,27.06,1,0,1,3,1,0,0,1,0,2,2,2,1,2,0,2,2,4,2,4,1,0,0,1,0,0,1,0,0,0,0,1,0,2,0,2,2,1,0,0,1.2,0.6,1.4,2.8,0.4,0.2,0.6,1,1.5,0.55,3.67,1.33,4,1,2,3,2.34,10 cents,5 minutes,24 days,Female,High School (or equivalent),20,0.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,1,2,1,0,-1,1,0,2,2,1,1,0,0,0,0,3,2,4,0.8,0.4,0.8,1.8,0.95 +898,R_16eDFK5gNmiumwF,18 - 24,American,Female,2,3,3,3,3,-1,1,1,1,-1,1,0,2,2,3,0,-1,-1,2,0,2,3,3,3,3,1,0,2,1,2,-2,7,2,2,2,-2,3,5,3,3,3,3,3,8,3,3,3,3,3,1,0,0,3,-2,2,4,3,3,3,3,3,6,2,2,2,2,2,5,FALSE,1,59,FALSE,0,62,TRUE,0,100,TRUE,0,67,TRUE,1,70,FALSE,1,100,FALSE,0,65,FALSE,0,97,TRUE,1,58,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,55,TRUE,0,77,FALSE,0,66,TRUE,1,76,FALSE,1,59,TRUE,0,100,TRUE,0,60,FALSE,1,63,FALSE,0,100,FALSE,0,62,TRUE,0,67,FALSE,0,53,FALSE,1,90,TRUE,1,81,TRUE,0,60,TRUE,0,67,FALSE,1,78,TRUE,1,100,FALSE,0,72,TRUE,1,100,0.9409,0.0361,0.0576,0.4225,0,0,0.2809,1,0.1369,0.3844,0,0.2025,0.1764,0,0.09,0.3844,0.4489,0.4489,0.4489,0.01,1,0.4356,0.36,0.5929,0.1681,0.36,0.5184,0.1681,1,1,0.0484,1,0.380846429,0.253807143,0.507885714,10,31.25,14,43.75,2,25,6,75,3,37.5,3,37.5,7,43.75,7,43.75,77,68.12,78.62,79.25,82,76.06,77.94,-12.5,33.25,43.12,3.62,41.75,44.5,32.31,34.19,0,0,0,0,0,1,1,0,1,1,1,2,0,4,0,3,4,4,1,3,1,0,0,0,0,1,1,2,3,3,2,3,1,1,0,2,3,3,0,2,0,0.8,1.4,3,0.2,2,1.4,2,1.3,1.4,4.33,3.67,0,3,-1,3,0.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,-1,0,0,0,0,0,0,-2,-2,-2,-1,-1,-1,3,0,1,1,1,1,1,-0.2,-1.2,0,1,-0.1 +899,R_5YRfud4tR7Cg3Kq,25 - 31,American,Male,2,3,3,3,2,1,-3,3,-3,3,1,2,3,-3,3,3,2,2,2,0,3,3,3,0,3,0,1,-3,3,-3,3,3,3,1,3,-3,3,1,-1,-3,-3,-3,-3,0,3,3,3,2,3,1,1,-3,3,-3,3,2,-1,-3,3,1,3,1,-3,-3,3,-3,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,88,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.8649,0.25,0,0,0,0,0.7744,1,0,1,0.25,0,1,0,1,1,0.263903571,0.097492857,0.430314286,27,84.38,24,75,5,62.5,6,75,7,87.5,6,75,15,93.75,9,56.25,94.72,79.75,99.12,100,100,96.88,92.56,9.38,19.72,17.25,24.12,12.5,25,3.13,36.31,1,0,0,3,1,0,0,0,0,0,2,1,0,0,0,4,5,5,5,3,1,0,0,1,1,0,0,0,0,0,2,5,0,4,0,6,5,1,5,3,1,0,0.6,4.4,0.6,0,2.2,4,1.5,1.7,1.33,1.33,-1,1,0,0,0,20 cents,5 minutes,47 days,Male,University - PhD,29,1.375,0,1,1,0,0,0,0.67,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,2,0,0,0,0,0,0,0,-4,0,-4,0,-2,0,4,0,0,0.4,0,-1.6,0.4,-0.2 +900,R_1nOdNjrTBRvM0PV,18 - 24,American,Female,3,3,2,3,1,3,1,3,2,0,2,1,3,1,3,1,-1,1,0,-1,3,3,2,2,-1,4,3,3,-2,3,-1,3,0,1,1,2,2,3,0,-1,0,-2,-2,3,3,3,2,2,2,1,2,1,1,0,2,3,1,0,3,2,1,3,0,1,2,0,1,6,TRUE,0,97,FALSE,0,58,TRUE,0,75,FALSE,1,56,FALSE,0,58,FALSE,1,56,TRUE,1,55,TRUE,1,89,TRUE,1,67,TRUE,1,95,FALSE,1,64,FALSE,1,90,FALSE,0,54,TRUE,0,90,TRUE,1,91,FALSE,0,58,TRUE,0,100,TRUE,0,96,FALSE,1,53,FALSE,1,54,TRUE,1,58,TRUE,1,90,TRUE,0,78,FALSE,0,65,FALSE,1,94,TRUE,1,87,FALSE,1,55,FALSE,1,65,FALSE,1,54,TRUE,1,91,FALSE,0,98,TRUE,1,100,0.0121,0.0169,0.3364,0.2025,0,0.1936,0.4225,0.0025,0.2116,0.01,0.0081,0.2916,0.1089,0.1296,0.3364,0.3364,0.6084,0.1936,0.1225,0.0036,0.1764,0.0081,0.2209,0.81,1,0.2025,0.9604,0.9409,0.5625,0.9216,0.2116,0.01,0.321578571,0.2038,0.439357143,22,68.75,20,62.5,6,75,4,50,5,62.5,5,62.5,10,62.5,10,62.5,74.72,67.75,69.75,88,73.38,75.88,73.56,6.25,12.22,-7.25,19.75,25.5,10.88,13.38,11.06,0,0,0,1,2,0,2,5,1,1,2,0,2,1,1,1,0,1,2,1,0,0,0,1,1,1,0,2,2,2,1,1,0,1,2,1,2,1,0,2,0.6,1.8,1.2,1,0.4,1.4,1,1.2,1.15,1,3.33,2.33,3,0,0,-3,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,19,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,1,-1,2,3,-1,-1,1,-1,2,0,-1,0,-2,0,2,-1,0.2,0.4,0.2,-0.2,0.15 +901,R_7TvfjtO0ztEIfay,18 - 24,Canadian,Male,1,1,-1,1,3,-1,2,0,2,1,0,0,1,2,1,-3,0,-3,-3,-3,-1,1,-1,-1,2,4,0,0,0,0,0,5,-1,0,0,0,0,5,-2,-1,-1,-2,-2,3,0,1,0,1,3,5,0,1,0,1,1,5,1,0,0,0,1,5,0,-1,0,1,0,5,FALSE,1,59,FALSE,0,50,TRUE,0,89,FALSE,1,50,TRUE,1,72,FALSE,1,95,TRUE,1,92,TRUE,1,71,TRUE,1,54,TRUE,1,82,FALSE,1,100,FALSE,1,58,TRUE,1,100,FALSE,1,100,TRUE,1,64,TRUE,1,57,TRUE,0,73,TRUE,0,78,FALSE,1,55,FALSE,1,57,FALSE,0,68,TRUE,1,76,FALSE,1,62,FALSE,0,61,FALSE,1,50,TRUE,1,58,FALSE,1,57,TRUE,0,74,TRUE,0,57,TRUE,1,67,TRUE,1,78,FALSE,0,52,0.0841,0.1764,0.1849,0.0064,0.2704,0.0025,0.3721,0.0324,0.1849,0.0576,0.1089,0,0.2116,0,0.0784,0.25,0.1444,0.25,0.5476,0.25,0.4624,0.1296,0.2025,0,0.5329,0.1849,0.0484,0.1681,0.7921,0.6084,0.3249,0.1764,0.228264286,0.140228571,0.3163,12,37.5,23,71.88,7,87.5,4,50,7,87.5,5,62.5,12,75,11,68.75,69.25,63.5,72.38,74.38,66.75,68.88,69.62,-34.38,-2.63,-24,22.38,-13.12,4.25,-6.12,0.87,2,0,0,2,1,1,2,0,2,1,1,0,1,2,1,1,1,2,1,1,1,0,1,0,0,1,1,0,1,0,1,0,1,2,0,3,1,3,4,3,1,1.2,1,1.2,0.4,0.6,0.8,2.8,1.1,1.15,4.67,5,-1,0,0,-2,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,1,0,-1,2,1,0,1,0,1,1,0,0,0,0,1,-2,0,-1,-3,-2,0.6,0.6,0.2,-1.6,-0.05 +902,R_1k7msazkdMzLZEI,18 - 24,Canadian,Female,1,3,-1,1,2,-1,1,1,0,3,-1,1,3,0,3,0,1,1,-1,-2,2,-2,2,-3,0,5,1,1,-1,-1,1,7,1,1,2,1,2,5,3,2,3,0,3,7,1,3,-2,1,2,3,1,2,2,-1,2,3,-2,1,3,-1,3,4,2,2,2,3,2,8,FALSE,1,100,TRUE,1,50,FALSE,1,74,FALSE,1,58,TRUE,1,74,FALSE,1,56,TRUE,1,62,TRUE,1,50,TRUE,1,100,TRUE,1,80,TRUE,0,89,TRUE,0,53,FALSE,0,50,TRUE,0,53,TRUE,1,64,TRUE,1,100,FALSE,1,56,TRUE,0,81,FALSE,1,50,FALSE,1,67,TRUE,1,64,TRUE,1,50,FALSE,1,81,TRUE,1,59,FALSE,1,100,TRUE,1,64,FALSE,1,100,FALSE,1,50,TRUE,0,86,TRUE,1,58,TRUE,1,54,FALSE,0,60,0.25,0.1296,0,0.1444,0.36,0.1936,0.1681,0.04,0.1089,0.25,0.1764,0.25,0,0.7921,0.0676,0.25,0.0361,0.1764,0.25,0,0.1296,0.1296,0.25,0.2809,0.1936,0,0.2116,0,0.0676,0.6561,0.7396,0.2809,0.216382143,0.204942857,0.227821429,10,31.25,25,78.13,7,87.5,5,62.5,6,75,7,87.5,14,87.5,11,68.75,68.53,70.62,65.88,73.75,63.88,64.94,72.12,-46.88,-9.6,-16.88,3.38,-1.25,-23.62,-22.56,3.37,1,5,3,4,2,2,0,2,1,2,2,0,1,1,1,3,1,2,1,5,0,0,1,0,0,2,1,1,1,1,1,0,0,1,0,2,1,1,4,4,3,1.4,1,2.4,0.2,1.2,0.4,2.4,1.95,1.05,5.67,3.33,2,4,1,-1,2.34,10 cents,100 minutes,47 days,Female,High School (or equivalent),18,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,5,2,4,2,0,-1,1,0,1,1,0,1,0,1,1,0,1,-3,1,2.8,0.2,0.6,0,0.9 +903,R_6U3KmYdeqoSlheG,18 - 24,Canadian,Female,-2,3,0,3,2,-2,0,0,1,0,0,-3,2,1,0,0,2,-1,0,-3,2,1,2,-2,0,4,-3,0,0,2,-3,10,0,0,0,1,0,7,1,0,1,-2,0,2,2,3,1,3,3,2,-2,-2,2,0,2,3,0,-3,3,1,0,2,3,3,3,3,1,1,TRUE,0,67,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,60,TRUE,1,59,FALSE,0,69,FALSE,0,85,TRUE,1,100,TRUE,0,95,TRUE,0,91,TRUE,1,87,FALSE,1,91,FALSE,0,77,TRUE,1,69,TRUE,0,78,TRUE,0,93,TRUE,0,50,FALSE,1,50,TRUE,1,79,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,1,72,TRUE,1,100,FALSE,1,50,TRUE,0,59,TRUE,0,62,FALSE,0,80,FALSE,0,59,TRUE,1,96,0.4761,0,0.0961,0.1681,0.0016,0.16,0,0,0.25,0.25,0.64,0.0169,0.7225,0.9025,0,0.25,0.25,0.25,0.3481,0.0784,0.0441,0.5929,0.25,0.0081,0.6084,0.25,0.3481,0.4489,0,0.8649,0.3844,0.8281,0.312425,0.263821429,0.361028571,20,62.5,18,56.25,3,37.5,6,75,5,62.5,4,50,10,62.5,8,50,74.31,64.5,76.5,79,77.25,78.75,69.88,6.25,18.06,27,1.5,16.5,27.25,16.25,19.88,4,2,2,5,2,1,0,0,1,3,0,3,2,0,0,1,2,2,2,3,4,0,1,0,1,0,2,2,1,2,0,0,1,0,0,3,1,4,3,4,3,1,1,2,1.2,1.4,0.2,3,1.75,1.45,7,2.33,2,7,5,1,4.67,10 cents,5 minutes,24 days,Female,University - Undergraduate,24,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,2,1,5,1,1,-2,-2,0,1,0,3,1,0,0,-2,1,-2,-1,-1,1.8,-0.4,0.8,-1,0.3 +904,R_3fJEhsjBdt5E5AT,18 - 24,American,Male,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0.321428571,0.142857143,0.5,30,93.75,23,71.88,5,62.5,7,87.5,8,100,3,37.5,14,87.5,9,56.25,100,100,100,100,100,100,100,21.87,28.12,37.5,12.5,0,62.5,12.5,43.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,22,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +905,R_5jTF8jxiUSm42md,18 - 24,American,Female,-3,3,-3,3,3,3,1,3,1,3,3,2,3,1,3,0,2,2,1,-3,-3,3,3,-1,3,8,-3,-2,0,3,-2,9,3,1,0,3,3,10,-3,-1,0,-3,-3,10,-3,3,-3,3,3,5,3,3,2,3,3,10,3,3,3,3,3,10,2,2,1,1,0,10,FALSE,1,60,TRUE,1,96,TRUE,0,100,TRUE,0,100,TRUE,1,55,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,78,TRUE,1,89,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,57,FALSE,1,58,TRUE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,69,TRUE,0,76,TRUE,1,100,TRUE,1,57,TRUE,1,52,0,0,0,0,0.2304,1,0.0256,0,1,0.3249,0,0,0,1,0.2025,0.0016,0.1764,1,0.4761,1,0,0.0121,1,0.0484,1,0.25,0.1849,0.16,1,1,0.5776,1,0.452517857,0.354385714,0.55065,16,50,18,56.25,4,50,5,62.5,5,62.5,4,50,15,93.75,3,18.75,86.91,86.5,80.12,86.88,94.12,86.88,86.94,-6.25,30.66,36.5,17.62,24.38,44.12,-6.87,68.19,0,0,6,4,0,6,3,3,2,5,0,1,3,2,0,3,3,2,4,0,0,0,0,0,0,0,2,1,2,0,0,1,0,2,0,2,0,1,0,3,2,3.8,1.2,2.4,0,1,0.6,1.2,2.35,0.7,9,8.33,3,-1,0,0,0.67,10 cents,100 minutes,24 days,Female,Trade School (non-military),20,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,6,4,0,6,1,2,0,5,0,0,3,0,0,1,3,1,4,-3,2,2.8,0.6,1.2,1.65 +906,R_7wGM92UfF3Vd7Rk,18 - 24,American,Male,1,3,2,3,-3,2,2,2,1,2,-1,3,3,-2,3,3,-2,1,-1,2,2,3,3,-1,-3,7,2,-2,2,2,-1,10,3,-3,-1,2,3,7,0,2,2,-1,2,6,3,3,3,3,-2,1,3,3,2,-1,2,8,-1,3,3,-1,3,3,1,1,1,1,2,7,TRUE,0,99,TRUE,1,60,TRUE,0,95,TRUE,0,70,TRUE,1,57,TRUE,0,75,TRUE,1,60,TRUE,1,80,FALSE,0,65,TRUE,1,60,FALSE,1,65,TRUE,0,95,TRUE,1,95,TRUE,0,70,TRUE,1,58,TRUE,1,90,TRUE,0,80,TRUE,0,70,FALSE,1,53,FALSE,1,80,TRUE,1,99,FALSE,0,80,TRUE,0,54,FALSE,0,65,FALSE,1,80,TRUE,1,60,TRUE,0,55,TRUE,0,75,TRUE,0,51,TRUE,1,95,TRUE,1,55,TRUE,1,99,0.04,0.16,0.01,0.16,0.0001,0.5625,0.4225,0.16,0.04,0.64,0.0025,0.0025,0.4225,0.1225,0.1849,0.16,0.2916,0.49,0.5625,0.04,0.0001,0.1764,0.2209,0.49,0.64,0.3025,0.2025,0.9801,0.9025,0.49,0.2601,0.9025,0.345417857,0.250114286,0.440721429,7,21.88,17,53.13,5,62.5,4,50,4,50,4,50,13,81.25,4,25,73.28,60.12,76.25,72.38,84.38,73.62,72.94,-31.25,20.15,-2.38,26.25,22.38,34.38,-7.63,47.94,1,0,1,4,0,0,4,0,1,3,4,6,4,4,0,3,4,1,0,0,2,0,1,0,1,1,1,0,2,0,0,0,0,1,0,2,3,0,2,0,1.2,1.6,3.6,1.6,0.8,0.8,0.2,1.4,2,0.8,8,4,6,2,4,-1,4,5 cents,5 minutes,47 days,Male,University - Undergraduate,22,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-1,0,0,4,-1,-1,3,0,-1,3,4,6,4,3,0,1,1,1,-2,0,0.4,0.8,3.4,0.2,1.2 +907,R_3l4abEHSRGvw1GI,18 - 24,Canadian,Male,0,0,0,0,0,-1,0,-1,0,1,1,-2,0,-1,1,0,0,0,0,1,1,0,1,0,-2,6,-2,1,3,-1,0,7,0,0,0,2,2,8,0,0,1,0,-1,5,-2,1,2,0,-1,5,1,2,2,0,1,8,0,0,0,0,0,6,0,0,0,0,0,5,TRUE,0,60,TRUE,1,50,FALSE,1,50,TRUE,0,89,FALSE,0,57,TRUE,0,61,FALSE,0,61,TRUE,1,72,TRUE,1,72,TRUE,1,89,FALSE,1,77,TRUE,0,90,TRUE,1,63,FALSE,1,50,TRUE,1,64,TRUE,1,82,FALSE,1,50,TRUE,0,81,TRUE,0,85,TRUE,0,77,FALSE,0,59,TRUE,1,50,FALSE,1,50,TRUE,1,95,TRUE,0,55,TRUE,1,50,FALSE,1,61,TRUE,0,59,FALSE,1,63,TRUE,1,93,FALSE,0,79,FALSE,0,100,0.0784,0.25,0.0324,0.3721,1,0.3721,0.0025,0.0121,0.5929,0.25,0.0049,0.1369,0.0784,0.0529,0.3249,0.25,0.25,0.7921,0.3481,0.3025,0.3481,0.1296,0.7225,0.25,0.25,0.1521,0.6241,0.36,0.25,0.6561,0.1369,0.81,0.337846429,0.294264286,0.381428571,24,75,18,56.25,5,62.5,4,50,4,50,5,62.5,11,68.75,7,43.75,68.56,72.12,62.88,62,77.25,71,66.12,18.75,12.31,9.62,12.88,12,14.75,2.25,22.37,1,0,1,0,2,1,1,4,1,1,1,2,0,3,1,0,0,1,0,2,2,1,2,0,1,2,2,3,0,0,1,2,0,1,1,0,0,0,0,1,0.8,1.6,1.4,0.6,1.2,1.4,1,0.2,1.1,0.95,7,6.33,1,-1,2,0,0.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,-1,-1,0,1,-1,-1,1,1,1,0,0,0,2,0,0,0,1,0,1,-0.4,0.2,0.4,0.4,0.15 +908,R_3bE5SzkOxAqHxRL,18 - 24,American,Male,0,3,3,0,3,-3,-3,-3,-3,3,1,3,2,3,-3,2,1,3,3,0,1,1,3,-3,3,8,-3,-3,-3,-3,3,7,0,3,2,2,-3,9,0,0,0,3,-3,6,0,3,3,-3,3,10,-3,-3,-3,-3,3,5,-3,3,0,0,-3,5,3,3,3,3,0,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,100,FALSE,1,90,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0.0081,0,0,0,0,0.25,0,0,0.25,0,1,0,0,0.01,0,0,0,0.25,1,0,0,0,0,0,1,0,0,0,0,1,0,0.25,0.178928571,0.125714286,0.232142857,25,78.13,28,87.5,8,100,7,87.5,7,87.5,6,75,15,93.75,13,81.25,93.16,92.5,93.75,100,86.38,99.44,86.88,-9.37,5.66,-7.5,6.25,12.5,11.38,5.69,5.63,1,2,0,3,0,0,0,0,0,0,1,0,0,1,0,2,1,3,0,3,0,0,0,3,0,0,0,0,0,0,4,0,2,3,0,1,2,0,0,0,1.2,0,0.4,1.8,0.6,0,1.8,0.6,0.85,0.75,8,6.67,-2,2,4,-4,1.33,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),19,0.5,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,2,0,0,0,0,0,0,0,0,-3,0,-2,-2,0,1,-1,3,0,3,0.6,0,-1.4,1.2,0.1 +909,R_3eIQtfq2u3vKgHa,18 - 24,Canadian,Female,2,3,2,2,3,-1,1,2,3,1,2,2,2,2,2,2,2,2,2,-1,1,3,3,1,3,5,1,1,1,2,1,2,1,1,1,1,1,2,2,2,2,2,2,4,3,3,3,2,2,6,2,2,1,3,1,2,2,2,2,2,2,3,2,2,1,1,1,3,TRUE,0,59,TRUE,1,60,TRUE,0,65,FALSE,1,59,FALSE,0,62,TRUE,0,63,TRUE,1,64,TRUE,1,65,TRUE,1,63,TRUE,1,58,TRUE,0,57,TRUE,0,81,TRUE,1,62,TRUE,0,67,TRUE,1,66,FALSE,0,63,FALSE,1,59,TRUE,0,81,FALSE,1,67,TRUE,0,63,TRUE,1,63,TRUE,1,62,FALSE,1,66,TRUE,1,62,TRUE,0,65,TRUE,1,63,TRUE,0,71,TRUE,0,66,TRUE,0,67,TRUE,1,60,FALSE,0,59,TRUE,1,62,0.1225,0.1369,0.3969,0.1296,0.1444,0.3969,0.1444,0.1764,0.3969,0.1444,0.16,0.1444,0.1369,0.3249,0.3844,0.16,0.1156,0.1681,0.4356,0.4225,0.1369,0.1156,0.1089,0.4489,0.1681,0.5041,0.3481,0.3481,0.4225,0.6561,0.4489,0.6561,0.293503571,0.214121429,0.372885714,11,34.38,17,53.13,5,62.5,5,62.5,4,50,3,37.5,13,81.25,4,25,64.06,62.75,63,64.88,65.62,62.12,66,-18.75,10.93,0.25,0.5,14.88,28.12,-19.13,41,1,0,1,1,0,2,0,1,1,0,1,1,1,1,1,0,0,0,0,3,1,0,1,0,1,3,1,1,0,0,0,0,0,0,0,0,0,1,1,2,0.6,0.8,1,0.6,0.6,1,0,0.8,0.75,0.6,3,3.67,-1,0,-1,1,-0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,-1,-1,-1,0,1,0,1,1,1,1,1,0,0,-1,-1,1,0,-0.2,1,-0.2,0.15 +910,R_5Id4nGbfP5nTMTD,18 - 24,Canadian,Female,2,2,-1,-3,2,2,1,3,-1,3,0,-3,3,2,3,2,1,2,2,-3,3,3,3,-2,3,4,-2,3,-3,3,-3,8,3,3,-1,3,0,9,-3,-3,-3,-3,-3,10,3,3,-3,2,3,8,0,-2,3,-3,3,5,-2,-3,3,-2,3,7,3,3,3,3,3,7,FALSE,1,60,TRUE,1,50,FALSE,1,80,FALSE,1,51,TRUE,1,85,FALSE,1,92,TRUE,1,65,TRUE,1,95,TRUE,1,51,TRUE,1,65,FALSE,1,51,TRUE,0,60,TRUE,1,53,FALSE,1,93,TRUE,1,52,TRUE,1,51,TRUE,0,51,TRUE,0,87,TRUE,0,51,TRUE,0,51,TRUE,1,51,TRUE,1,87,TRUE,0,65,TRUE,1,77,TRUE,0,76,TRUE,1,92,TRUE,0,51,FALSE,1,60,TRUE,0,52,TRUE,1,81,FALSE,0,52,TRUE,1,91,0.0025,0.0064,0.2401,0.1225,0.0081,0.0064,0.0529,0.1225,0.2601,0.0169,0.0361,0.2209,0.2401,0.2401,0.0225,0.25,0.4225,0.2401,0.16,0.5776,0.2401,0.2304,0.2601,0.0049,0.2601,0.2601,0.2704,0.16,0.04,0.7569,0.2704,0.36,0.213935714,0.1528,0.275071429,8,25,22,68.75,5,62.5,5,62.5,6,75,6,75,15,93.75,7,43.75,66.53,51.12,67.5,78.12,69.38,68.62,64.44,-43.75,-2.22,-11.38,5,3.12,-5.62,-25.13,20.69,1,1,4,1,1,4,2,6,4,6,3,6,4,1,3,5,4,5,5,0,1,1,2,5,1,2,3,0,2,0,2,0,0,4,0,1,2,1,1,6,1.6,4.4,3.4,3.8,2,1.4,1.2,2.2,3.3,1.7,7,6.67,-4,3,2,3,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,2,-4,0,2,-1,6,2,6,1,6,4,-3,3,4,2,4,4,-6,-0.4,3,2.2,1.6,1.6 +911,R_3GdmyJ2yUqxO7YT,18 - 24,American,Female,-2,2,1,3,2,1,1,3,1,2,1,1,2,2,2,2,1,2,2,2,-2,3,1,3,-1,4,1,1,2,1,-1,8,3,3,-1,3,1,8,2,-1,1,1,1,7,-1,3,2,3,3,7,1,1,3,-1,2,6,2,2,1,3,2,6,3,3,3,3,3,8,TRUE,0,80,FALSE,0,54,TRUE,0,100,FALSE,1,59,TRUE,1,69,FALSE,1,100,TRUE,1,84,TRUE,1,66,TRUE,1,77,FALSE,0,79,FALSE,1,56,TRUE,0,68,FALSE,0,66,FALSE,1,59,TRUE,1,80,TRUE,1,94,TRUE,0,62,FALSE,1,88,FALSE,1,65,FALSE,1,55,FALSE,0,71,TRUE,1,93,FALSE,1,87,TRUE,1,78,FALSE,1,100,TRUE,1,84,FALSE,1,58,FALSE,1,97,TRUE,0,67,TRUE,1,65,FALSE,0,59,TRUE,1,86,0.1156,0.0256,0.0036,0.0256,0.0196,0,0.0484,0.6241,0.2025,0.0049,0.1225,0.4356,0.0529,0.1936,0.0961,0.2916,0.0169,0.1681,0.0009,0,0.5041,0.04,0.1225,0.1681,0.3844,0.1764,0.3481,0.64,1,0.0144,0.4489,0.4624,0.23525,0.162628571,0.307871429,24,75,22,68.75,6,75,4,50,6,75,6,75,11,68.75,11,68.75,75.19,63.5,76,83.38,77.88,75.31,75.06,6.25,6.44,-11.5,26,8.38,2.88,6.56,6.31,0,1,0,0,3,0,0,1,0,3,2,2,3,1,1,0,2,1,1,1,1,1,1,0,1,0,0,0,2,0,1,1,1,1,0,1,2,1,1,1,0.8,0.8,1.8,1,0.8,0.4,0.8,1.2,1.1,0.8,6.67,6.33,-3,2,2,-1,0.34,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),24,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,-1,0,-1,0,2,0,0,1,-2,3,1,1,2,0,1,-1,0,0,0,0,0,0.4,1,-0.2,0.3 +912,R_7oYZmtoO8ONj4I1,18 - 24,American,Male,2,3,3,1,3,2,1,3,1,2,2,1,2,1,2,2,2,1,2,1,3,2,3,2,3,8,3,2,2,3,2,8,2,3,3,2,2,8,2,3,2,2,2,8,2,3,3,2,3,7,2,2,3,3,2,7,2,1,2,2,1,7,2,1,1,2,2,7,TRUE,0,81,TRUE,1,81,TRUE,0,81,FALSE,1,84,TRUE,1,86,FALSE,1,82,TRUE,1,88,FALSE,0,88,FALSE,0,90,TRUE,1,78,FALSE,1,75,TRUE,0,86,TRUE,1,85,TRUE,0,80,FALSE,0,87,TRUE,1,81,FALSE,1,84,TRUE,0,100,TRUE,0,95,FALSE,1,88,TRUE,1,83,TRUE,1,85,FALSE,1,84,TRUE,1,79,TRUE,0,77,FALSE,0,98,TRUE,0,86,FALSE,1,66,TRUE,0,85,TRUE,1,89,TRUE,1,76,FALSE,0,80,0.7744,0.9604,0.0361,0.0144,0.64,0.0324,0.0441,0.0484,0.0144,0.0225,0.0121,0.0225,0.81,0.0625,0.0196,0.0361,0.0256,0.0256,0.1156,0.5929,0.0289,0.7569,0.9025,0.64,0.0256,0.7396,0.0576,0.6561,0.6561,1,0.7225,0.7396,0.337489286,0.1297,0.545278571,23,71.88,18,56.25,4,50,6,75,3,37.5,5,62.5,11,68.75,7,43.75,84,84.25,83.62,85.88,82.25,84.62,83.38,15.63,27.75,34.25,8.62,48.38,19.75,15.87,39.63,1,1,0,1,0,1,1,1,2,0,0,2,1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,2,0,0,0,0,1,1,0,1,0,0,1,0.6,1,0.8,0.6,0.2,0.6,0.4,0.4,0.75,0.4,8,7,1,1,1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),22,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,1,1,0,0,0,1,0,1,0,0,0,2,1,0,-1,0,0,1,0,0,0.4,0.4,0.4,0.2,0.35 +913,R_1DooZXB2EuSAKJu,18 - 24,Canadian,Male,-3,3,-1,-2,2,-3,2,-2,0,3,2,1,2,-2,0,-3,-2,-3,-3,-3,1,0,2,0,3,10,3,0,0,-1,1,10,2,0,0,1,0,10,3,3,3,3,3,10,0,3,0,0,0,8,0,0,0,0,0,8,2,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,65,FALSE,0,50,TRUE,0,62,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,78,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,79,TRUE,1,100,FALSE,1,100,TRUE,1,57,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,83,TRUE,0,100,TRUE,1,90,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,75,FALSE,0,50,FALSE,0,50,0.0484,0.01,0,0.25,0.25,0,0.0289,0,0.25,0.25,0.5625,0,0.25,0.25,0.25,0.25,0,0.25,0.25,1,0.25,0.1849,0.81,0,0.25,0.25,0.25,0.1225,0.3844,1,0.25,0.6241,0.293475,0.1851,0.40185,16,50,19,59.38,4,50,5,62.5,5,62.5,5,62.5,8,50,11,68.75,69.66,55.88,68.75,81.88,72.12,67.69,71.62,-9.38,10.28,5.88,6.25,19.38,9.62,17.69,2.87,4,3,3,2,1,6,2,2,1,2,0,1,2,3,0,6,5,6,6,6,3,0,1,2,2,3,2,2,0,3,0,1,2,2,0,3,2,3,3,3,2.6,2.6,1.2,5.8,1.6,2,1,2.8,3.05,1.85,10,7,2,2,5,5,3,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,3,2,0,-1,3,0,0,1,-1,0,0,0,1,0,3,3,3,3,3,1,0.6,0.2,3,1.2 +914,R_3ASFLRx5pg2eAMM,18 - 24,Canadian,Female,1,3,2,-2,0,-2,1,1,1,1,1,-3,2,-1,3,1,1,1,0,-2,3,2,3,-3,1,2,1,3,-1,-2,1,3,-1,-2,3,2,2,3,2,3,3,2,3,1,2,3,2,0,1,0,-1,0,2,0,0,1,1,-3,2,-2,3,1,0,0,1,0,-2,3,FALSE,1,96,TRUE,1,64,TRUE,0,54,FALSE,1,70,TRUE,1,85,FALSE,1,91,FALSE,0,55,TRUE,1,65,TRUE,1,91,TRUE,1,92,FALSE,1,54,FALSE,1,71,FALSE,0,64,FALSE,1,100,TRUE,1,53,TRUE,1,100,FALSE,1,65,TRUE,0,100,FALSE,1,60,FALSE,1,58,TRUE,1,91,TRUE,1,91,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,60,FALSE,0,95,TRUE,1,50,TRUE,1,90,0.1225,0,0,0.3025,0.01,0.0081,0,0.0064,0.1764,0.0081,0.9025,0.4096,0.0081,0.2116,0.0225,0.1296,0,0.09,0,0,0.0081,0.2209,0.16,0,0.1225,0.25,0.25,0.0016,0.2916,1,0.16,0.0841,0.161846429,0.141635714,0.182057143,21,65.63,27,84.38,8,100,7,87.5,6,75,6,75,13,81.25,14,87.5,78.59,61.5,80.75,91.75,80.38,80.38,76.81,-18.75,-5.79,-38.5,-6.75,16.75,5.38,-0.87,-10.69,2,1,1,1,1,3,2,2,3,0,2,1,1,3,1,1,2,2,2,5,1,0,0,2,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,0,1.2,2,1.6,2.4,0.8,1,0.2,0.4,1.8,0.6,2.67,0.67,2,2,2,-2,2,5 cents,100 minutes,47 days,Female,University - Undergraduate,22,1.125,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,1,1,1,-1,0,2,1,1,2,-1,2,1,1,2,1,0,1,2,2,5,0.4,1,1.4,2,1.2 +915,R_1fjs7QwhfJ2SNCa,18 - 24,American,Female,-1,1,-2,-2,-2,-3,1,-2,2,-1,-1,-2,1,-3,1,-3,-3,-2,-3,-3,3,-1,1,-2,0,9,-2,-1,-3,-2,-1,4,3,-2,-1,2,-1,7,-1,-2,-2,-2,3,3,1,1,1,1,1,7,-2,0,-1,1,1,5,-1,-2,1,-1,1,0,-2,-2,-1,-2,1,3,TRUE,0,69,FALSE,0,50,FALSE,1,58,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,82,FALSE,0,50,TRUE,1,61,FALSE,1,50,FALSE,1,88,FALSE,0,78,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,70,TRUE,0,69,TRUE,0,70,FALSE,1,50,TRUE,1,75,TRUE,1,70,FALSE,1,50,TRUE,1,95,FALSE,1,91,FALSE,0,50,FALSE,1,50,FALSE,1,60,FALSE,1,95,FALSE,0,70,FALSE,0,70,FALSE,0,90,0.6724,0.25,0.25,0.25,0.81,0.25,0.0025,0.1521,0.25,0.09,0.49,0.6084,0.25,0.25,0.25,0.25,0.25,0.25,0.16,0.0081,0.0625,0.25,0.49,0.25,0.49,0.25,0.49,0.4761,0.1764,0.4761,0.0025,0.0144,0.276753571,0.296642857,0.256864286,14,43.75,16,50,3,37.5,4,50,4,50,5,62.5,4,25,12,75,64.41,55,69.75,63.75,69.12,65.06,63.75,-6.25,14.41,17.5,19.75,13.75,6.62,40.06,-11.25,4,2,3,0,2,1,2,1,4,0,4,0,2,5,2,2,1,0,1,6,2,0,3,3,3,1,1,1,1,2,0,0,0,2,0,1,1,1,1,4,2.2,1.6,2.6,2,2.2,1.2,0.4,1.6,2.1,1.35,6.67,4,2,-1,7,0,2.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,1.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,2,2,0,-3,-1,0,1,0,3,-2,4,0,2,3,2,1,0,-1,0,2,0,0.4,2.2,0.4,0.75 +916,R_7xPgAa1XuVBzGtQ,18 - 24,American,Male,2,2,2,2,2,2,-3,2,-3,2,1,1,1,1,1,2,2,2,1,1,2,2,2,2,2,8,1,-3,1,-3,1,9,1,2,2,2,2,7,2,2,2,2,2,8,2,2,2,2,2,8,2,-3,1,-3,1,8,2,2,2,2,1,8,2,2,2,2,2,8,FALSE,1,70,TRUE,1,96,FALSE,1,61,FALSE,1,78,FALSE,0,71,FALSE,1,72,TRUE,1,92,FALSE,0,75,TRUE,1,72,TRUE,1,73,TRUE,0,78,TRUE,0,87,TRUE,1,85,FALSE,1,82,FALSE,0,80,TRUE,1,75,FALSE,1,76,TRUE,0,79,FALSE,1,86,FALSE,1,88,FALSE,0,79,TRUE,1,84,FALSE,1,83,TRUE,1,75,FALSE,1,78,FALSE,0,87,FALSE,1,82,TRUE,0,78,FALSE,1,80,TRUE,1,79,FALSE,0,80,FALSE,0,81,0.5625,0.7569,0.0625,0.0064,0.6561,0.0784,0.0625,0.0729,0.0144,0.0256,0.0441,0.0225,0.0784,0.6084,0.5041,0.0016,0.0289,0.0484,0.6084,0.0484,0.6241,0.64,0.0196,0.0324,0.0576,0.0324,0.64,0.09,0.1521,0.6241,0.04,0.7569,0.236153571,0.16045,0.311857143,10,31.25,21,65.63,5,62.5,5,62.5,6,75,5,62.5,9,56.25,12,75,79.44,81.5,78.38,80.62,77.25,80.25,78.62,-34.38,13.81,19,15.88,5.62,14.75,24,3.62,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,0.6,0.8,0.4,0,0.4,0.8,0.4,0.45,0.4,8,8,0,1,-1,0,0,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,23,0.375,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,1,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0.2,0,0,0.05 +917,R_3H1nqNEp9z9PHTX,18 - 24,American,Male,3,3,2,-2,-2,-2,-3,-1,1,1,2,-2,1,-1,3,-1,1,1,-1,-2,2,1,3,-2,2,8,0,-2,-2,2,-1,3,-1,-1,1,2,1,6,-1,-1,1,1,-2,7,1,2,3,1,0,3,1,-3,2,-1,0,4,2,-2,2,-2,3,2,2,1,3,1,2,6,FALSE,1,82,TRUE,1,59,FALSE,1,64,FALSE,1,52,TRUE,1,88,FALSE,1,59,TRUE,1,75,TRUE,1,81,TRUE,1,65,FALSE,0,56,TRUE,0,50,TRUE,0,82,TRUE,1,92,TRUE,0,78,FALSE,0,68,TRUE,1,96,FALSE,1,67,TRUE,0,56,TRUE,0,66,TRUE,0,57,TRUE,1,99,TRUE,1,96,FALSE,1,71,TRUE,1,66,FALSE,1,59,TRUE,1,87,FALSE,1,50,FALSE,1,65,TRUE,0,82,TRUE,1,61,TRUE,1,65,TRUE,1,56,0.0361,0.0169,0.0016,0.0625,0.1936,0.1681,0.1156,0.3136,0.3249,0.0016,0.1521,0.0064,0.1225,0.25,0.0144,0.1681,0.0841,0.2304,0.1225,0.1681,0.0001,0.4624,0.4356,0.6084,0.1089,0.25,0.1225,0.0324,0.1296,0.3136,0.6724,0.6724,0.223010714,0.153242857,0.292778571,19,59.38,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,70.31,59.38,76.75,73.62,71.5,75.62,65,-12.5,-1.57,-3.12,-10.75,11.12,-3.5,-11.88,8.75,1,2,1,0,4,2,1,1,1,2,3,1,0,3,2,0,2,0,2,0,2,1,1,3,2,3,0,3,2,1,0,0,1,1,0,3,0,2,2,4,1.6,1.4,1.8,0.8,1.8,1.8,0.4,2.2,1.4,1.55,5.67,3,5,-1,4,1,2.67,5 cents,5 minutes,24 days,Male,University - Undergraduate,20,0.75,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,1,0,-3,2,-1,1,-2,-1,1,3,1,-1,2,2,-3,2,-2,0,-4,-0.2,-0.4,1.4,-1.4,-0.15 +918,R_1qz22AVCAwv76bk,18 - 24,American,Female,3,3,3,3,3,-3,-3,1,3,-2,2,-3,3,-2,3,-2,0,1,1,-2,3,3,3,3,-2,4,-3,-3,-3,3,-3,3,-2,-3,1,2,3,3,2,2,2,2,3,8,2,2,2,1,3,7,-3,-3,1,1,1,2,2,-3,3,-2,3,2,2,2,2,2,0,8,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,67,FALSE,1,50,TRUE,0,81,TRUE,1,92,FALSE,1,93,TRUE,1,60,TRUE,1,60,TRUE,0,50,TRUE,0,76,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,0,70,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,98,0,0,0.16,0,0.0004,0,0,0.1089,0.25,0,0,0.0064,0.25,0.25,0,0.01,0.04,0.25,0,0.0025,1,0.16,0.25,0.0049,0.25,0.49,0.25,1,1,0.5776,1,0.6561,0.278814286,0.083264286,0.474364286,25,78.13,22,68.75,5,62.5,5,62.5,6,75,6,75,14,87.5,8,50,81.62,58.75,90,91.38,86.38,85.44,77.81,9.38,12.87,-3.75,27.5,16.38,11.38,-2.06,27.81,0,0,0,0,5,0,0,4,0,1,4,0,2,4,0,4,2,1,1,5,1,1,1,2,0,0,0,0,2,3,0,0,0,0,0,4,2,1,1,2,1,1,2,2.6,1,1,0,2,1.65,1,3.33,3.67,-3,1,1,0,-0.34,10 cents,25 minutes,24 days,Female,University - Undergraduate,23,1.75,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-1,-1,-1,-2,5,0,0,4,-2,-2,4,0,2,4,0,0,0,0,0,3,0,0,2,0.6,0.65 +919,R_18ZeIdwMss8AtrQ,18 - 24,American,Female,1,2,3,1,3,2,-1,2,1,2,1,-2,2,1,0,2,2,3,1,1,-2,2,2,-2,2,7,3,-2,-1,3,3,4,1,1,1,2,0,5,3,3,2,2,2,1,2,2,1,2,3,3,2,-2,2,0,1,2,2,0,3,-1,1,6,2,3,3,3,1,3,TRUE,0,75,TRUE,1,50,TRUE,0,90,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,90,TRUE,1,70,TRUE,1,50,FALSE,0,80,FALSE,1,50,TRUE,0,90,TRUE,1,60,FALSE,1,100,TRUE,1,80,TRUE,1,50,TRUE,0,57,TRUE,0,100,FALSE,1,50,TRUE,0,54,TRUE,1,91,TRUE,1,91,FALSE,1,90,TRUE,1,70,FALSE,1,65,TRUE,1,91,FALSE,1,50,TRUE,0,54,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.09,0.0081,0.25,0.01,0.25,0,0.09,0.64,0.2916,0.0081,0.25,0.16,0.25,0.25,0.16,0.25,0.01,0.25,0.2916,0.1225,0.0081,0.04,0.25,0,0.3249,0.25,0.25,0.5625,0.81,1,0.25,0.81,0.279617857,0.204264286,0.354971429,10,31.25,21,65.63,7,87.5,6,75,5,62.5,3,37.5,12,75,9,56.25,69,53.75,69.75,86.5,66,67.69,70.31,-34.38,3.37,-33.75,-5.25,24,28.5,-7.31,14.06,3,0,1,3,1,1,1,3,2,1,0,3,1,1,0,1,1,1,1,1,1,0,2,1,0,0,1,0,1,1,1,2,1,2,1,0,1,0,2,0,1.6,1.6,1,1,0.8,0.6,1.4,0.6,1.3,0.85,5.33,3.67,4,2,-1,-2,1.66,10 cents,5 minutes,47 days,Female,University - Undergraduate,21,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,2,0,-1,2,1,1,0,3,1,0,-1,1,0,-1,-1,1,0,1,-1,1,0.8,1,-0.4,0.4,0.45 +920,R_7Pq8WMBPdLAwPMa,18 - 24,American,Female,-3,2,3,3,3,-2,1,2,-2,1,3,1,3,2,3,-1,0,1,1,-3,1,-1,3,2,3,1,-1,-3,-1,-3,-2,3,3,3,1,2,1,2,2,1,2,1,-3,6,0,3,3,-1,3,1,0,2,2,0,2,3,3,1,3,3,3,1,2,2,2,1,2,6,FALSE,1,87,TRUE,1,50,TRUE,0,73,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,84,FALSE,1,50,TRUE,1,100,TRUE,1,80,TRUE,0,61,TRUE,0,99,TRUE,0,67,FALSE,1,50,FALSE,0,97,FALSE,0,50,FALSE,1,50,TRUE,1,89,FALSE,1,50,TRUE,1,61,FALSE,1,50,FALSE,1,65,TRUE,0,63,TRUE,1,94,TRUE,1,75,FALSE,0,50,0.0625,0.1521,0.04,0,0.25,0.25,0.0121,0,0.25,0.25,0.0036,0.0256,0.25,0.25,0.25,0.25,0.25,0.25,0.1225,0.25,0.9409,0,0.4489,0.25,0.3721,0.25,0.0625,0.0169,0.5329,0.9801,0.3969,1,0.291607143,0.181521429,0.401692857,10,31.25,21,65.63,6,75,3,37.5,6,75,6,75,11,68.75,10,62.5,69.38,61.5,63.12,74.62,78.25,75.31,63.44,-34.38,3.75,-13.5,25.62,-0.38,3.25,6.56,0.94,4,3,0,1,0,1,4,3,1,3,0,2,2,0,2,3,1,1,0,0,3,1,0,4,0,2,1,0,2,1,0,0,0,1,0,3,2,1,0,5,1.6,2.4,1.2,1,1.6,1.2,0.2,2.2,1.55,1.3,2,1.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,2,0,-3,0,-1,3,3,-1,2,0,2,2,-1,2,0,-1,0,0,-5,0,1.2,1,-1.2,0.25 +921,R_7IoZsPxWNX6p412,18 - 24,Canadian,Female,1,2,1,0,-1,0,0,0,2,1,0,1,1,0,-1,1,2,3,1,-1,2,-1,1,2,1,6,0,1,0,-2,1,6,1,0,0,2,1,6,1,0,1,1,1,7,3,2,1,0,2,6,1,1,1,1,-1,5,0,2,1,-1,1,5,-1,1,2,0,1,7,TRUE,0,76,TRUE,1,82,FALSE,1,72,TRUE,0,69,FALSE,0,76,TRUE,0,63,FALSE,0,80,FALSE,0,65,TRUE,1,70,FALSE,0,78,FALSE,1,68,FALSE,1,80,TRUE,1,74,TRUE,0,74,TRUE,1,74,FALSE,0,64,TRUE,0,73,FALSE,1,73,TRUE,0,65,TRUE,0,67,TRUE,1,66,TRUE,1,64,FALSE,1,68,FALSE,0,67,TRUE,0,67,TRUE,1,84,FALSE,1,62,TRUE,0,76,FALSE,1,67,FALSE,0,68,FALSE,0,74,TRUE,1,68,0.4225,0.0256,0.4096,0.64,0.1024,0.3969,0.4489,0.6084,0.4489,0.1296,0.4624,0.0676,0.09,0.1024,0.5776,0.0324,0.1024,0.4761,0.5776,0.4489,0.1156,0.0676,0.4225,0.5476,0.5329,0.1444,0.5476,0.5776,0.0784,0.0729,0.1089,0.04,0.297446429,0.289,0.305892857,12,37.5,15,46.88,5,62.5,5,62.5,3,37.5,2,25,8,50,7,43.75,71.06,70.5,69.38,74.5,69.88,72.12,70,-9.38,24.18,8,6.88,37,44.88,22.12,26.25,1,3,0,2,2,0,1,0,4,0,1,1,1,2,2,0,2,2,0,2,2,0,0,0,3,1,1,1,1,2,0,1,0,1,2,2,1,1,1,2,1.6,1,1.4,1.2,1,1.2,0.8,1.4,1.3,1.1,6,5.33,0,1,1,0,0.67,10 cents,100 minutes,36 days,Female,University - Undergraduate,23,0.375,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,3,0,2,-1,-1,0,-1,3,-2,1,0,1,1,0,-2,1,1,-1,0,0.6,-0.2,0.6,-0.2,0.2 +922,R_5ivTq3ppmJ52lcS,18 - 24,American,Female,1,3,2,1,2,-3,-1,1,1,1,1,-3,1,-2,3,-3,-3,-3,2,-3,3,3,-2,-2,0,3,-3,0,0,3,-1,8,-2,-3,3,-3,3,2,-3,-3,-3,-3,-3,2,2,3,2,1,2,1,-2,0,2,-2,3,6,2,-3,2,-3,3,2,2,2,2,2,-2,10,TRUE,0,96,TRUE,1,52,FALSE,1,100,TRUE,0,52,TRUE,1,52,FALSE,1,80,TRUE,1,75,TRUE,1,98,TRUE,1,52,TRUE,1,64,FALSE,1,56,FALSE,1,53,TRUE,1,53,TRUE,0,53,TRUE,1,53,TRUE,1,53,TRUE,0,53,TRUE,0,60,TRUE,0,54,TRUE,0,53,FALSE,0,54,TRUE,1,54,TRUE,0,71,TRUE,1,53,TRUE,0,53,TRUE,1,68,TRUE,0,53,TRUE,0,69,TRUE,0,72,FALSE,0,63,FALSE,0,53,TRUE,1,67,0.0004,0.1024,0.2209,0.0625,0.1089,0.04,0.2209,0.1296,0.2809,0.2116,0.3969,0.2209,0.2304,0.1936,0.2304,0.2304,0.5041,0.2704,0.4761,0.2809,0.2916,0.2209,0.2916,0.2809,0.2809,0.2809,0.2809,0.9216,0,0.36,0.5184,0.2209,0.284807143,0.2335,0.336114286,9,28.13,17,53.13,4,50,4,50,4,50,5,62.5,13,81.25,4,25,62.25,53.12,62.75,65.38,67.75,60.25,64.25,-25,9.12,3.12,12.75,15.38,5.25,-21,39.25,2,0,4,3,2,0,1,1,2,2,3,0,2,1,0,0,0,0,5,0,1,0,0,0,0,1,1,1,3,2,1,0,1,1,0,5,5,5,0,1,2.2,1.2,1.2,1,0.2,1.6,0.6,3.2,1.4,1.4,4.33,3,2,2,0,-8,1.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,1.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,1,0,4,3,2,-1,0,0,-1,0,2,0,1,0,0,-5,-5,-5,5,-1,2,-0.4,0.6,-2.2,0 +923,R_7gphfUsWbSINllm,18 - 24,American,Female,3,2,2,0,2,-2,1,2,2,1,1,2,2,2,3,2,2,2,1,1,-3,-1,1,-2,1,7,-3,1,1,-1,-3,9,2,2,-1,3,-1,4,1,2,2,1,1,3,3,2,2,2,3,3,1,1,3,-1,2,4,2,3,3,1,3,1,3,3,3,3,3,3,FALSE,1,70,TRUE,1,53,TRUE,0,95,FALSE,1,58,TRUE,1,54,FALSE,1,100,FALSE,0,55,TRUE,1,55,FALSE,0,54,TRUE,1,95,FALSE,1,95,TRUE,0,55,TRUE,1,53,FALSE,1,52,TRUE,1,56,FALSE,0,54,TRUE,0,54,TRUE,0,100,FALSE,1,53,FALSE,1,52,FALSE,0,84,FALSE,0,62,FALSE,1,57,TRUE,1,54,TRUE,0,85,TRUE,1,94,FALSE,1,61,TRUE,0,87,FALSE,1,72,TRUE,1,66,TRUE,1,76,TRUE,1,100,0.2025,0.0036,0.2916,0.3025,0,0,0.2116,0.0025,0.2304,0.3844,0.1156,0.2209,0.2916,0.0025,0.2116,0.2209,0.1849,0.1764,0.7569,0.7225,0.7056,0.1936,0.2209,0.2304,0.2916,0.1521,0.0576,0.09,0.9025,1,0.0784,0.3025,0.284210714,0.16095,0.407471429,5,15.63,21,65.63,7,87.5,6,75,4,50,4,50,11,68.75,10,62.5,69.09,63.25,71.75,76.62,64.75,66.56,71.62,-50,3.46,-24.25,-3.25,26.62,14.75,-2.19,9.12,6,3,1,2,1,1,0,1,3,4,1,0,3,1,4,1,0,0,0,0,0,0,0,2,1,3,0,1,3,1,1,1,1,1,0,1,1,1,2,2,2.6,1.8,1.8,0.2,0.6,1.6,0.8,1.4,1.6,1.1,6.67,2.67,4,5,3,0,4,5 cents,100 minutes,24 days,Female,High School (or equivalent),19,0.75,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,6,3,1,0,0,-2,0,0,0,3,0,-1,2,0,4,0,-1,-1,-2,-2,2,0.2,1,-1.2,0.5 +924,R_3EzTfT7zZ08JSaM,18 - 24,American,Female,1,2,1,1,2,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,1,1,-1,2,-1,1,0,6,1,-1,-1,1,-1,8,1,-1,1,1,1,7,-1,-1,-1,-1,-1,8,2,1,1,1,2,7,-2,-2,2,-2,0,7,1,1,2,-2,2,7,2,2,2,2,2,7,FALSE,1,81,FALSE,0,61,TRUE,0,100,FALSE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,93,TRUE,1,91,FALSE,1,100,TRUE,1,90,TRUE,1,89,TRUE,0,97,FALSE,1,100,FALSE,1,100,FALSE,1,78,FALSE,0,75,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,83,TRUE,1,100,FALSE,1,85,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,79,TRUE,1,79,0,0,0.0121,0,0.0441,0,0,1,0.0484,0.0009,1,0.0081,1,0,0,0.3721,0,0.0081,0,0.0289,0.5625,0.01,0,0,0.9409,0.0225,0.0441,0.0361,1,0,1,0.0049,0.2547,0.248692857,0.260707143,24,75,24,75,6,75,5,62.5,7,87.5,6,75,11,68.75,13,81.25,92.78,88.25,92.75,95.12,95,91.31,94.25,0,17.78,13.25,30.25,7.62,20,22.56,13,2,0,2,0,2,2,0,2,2,2,0,2,0,2,0,2,2,2,2,2,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1.2,1.6,0.8,2,0.4,1,0.6,1,1.4,0.75,7,7,-1,1,0,1,0,10 cents,100 minutes,47 days,Female,University - Undergraduate,24,0.875,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,1,-1,2,0,2,1,-1,1,1,1,0,2,-1,1,-1,1,1,1,1,1,0.8,0.6,0.2,1,0.65 +925,R_35VRsLfQRg6h0D7,18 - 24,American,Female,2,3,3,2,3,-1,-3,2,-3,0,3,1,3,0,3,2,2,2,2,2,1,3,3,2,3,8,0,-3,0,-3,1,5,3,1,3,0,3,3,2,2,3,3,2,0,2,3,3,2,3,9,0,-3,2,-3,2,1,3,2,3,0,3,2,1,2,2,2,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,90,TRUE,0,90,FALSE,1,70,FALSE,0,100,TRUE,1,90,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0.81,0.0025,0,0,0,0,0,0.01,0.01,0,1,1,0.09,1,0.247232143,0.214285714,0.280178571,26,81.25,25,78.13,7,87.5,7,87.5,7,87.5,4,50,14,87.5,11,68.75,97.97,97.5,96.25,99.38,98.75,99.38,96.56,3.12,19.84,10,8.75,11.88,48.75,11.88,27.81,1,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0,1,0,0,0,2,0.2,0.8,0,0.4,0,0.6,0.2,0.6,0.35,0.35,5.33,4,-1,4,1,-5,1.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,1.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,0,0,0,0,0,2,0,-1,0,-1,0,0,0,-1,0,1,1,-2,0.2,0.2,-0.2,-0.2,0 +926,R_5pX9PNrzfuK4xW9,18 - 24,American,Female,3,1,2,-2,1,-2,-2,0,0,1,1,1,2,-3,2,0,1,0,-1,1,2,0,2,-3,2,3,-2,-2,0,-1,-1,4,2,0,-1,1,0,4,3,3,3,2,3,2,3,2,1,-2,2,3,-2,-2,0,-1,2,2,1,1,2,-3,2,3,2,2,1,2,1,5,TRUE,0,85,TRUE,1,72,FALSE,1,100,FALSE,1,55,TRUE,1,60,FALSE,1,76,TRUE,1,92,TRUE,1,56,FALSE,0,60,TRUE,1,100,TRUE,0,62,TRUE,0,100,TRUE,1,79,FALSE,1,52,FALSE,0,50,TRUE,1,83,TRUE,0,66,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,65,TRUE,1,70,FALSE,1,50,FALSE,1,60,TRUE,0,90,FALSE,0,55,FALSE,0,53,TRUE,1,75,0.1936,0.09,0.0289,0.0064,0.0625,0.0576,0.0025,0,0.25,0,0.3025,0.0441,0.36,0.3844,0.16,0.0784,0,0.2025,0.16,0.4225,0.2304,0.25,0.25,0.2304,0.4356,0.25,0.2809,0.7225,0,1,0.81,1,0.283814286,0.136035714,0.431592857,15,46.88,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,72.28,56.5,74.75,83,74.88,72,72.56,-18.75,6.65,6.5,-0.25,20.5,-0.12,-3,16.31,1,1,0,1,1,0,0,0,1,2,1,1,3,4,2,3,2,3,3,2,0,1,1,0,1,0,0,0,1,1,0,0,0,0,0,2,1,1,3,0,0.8,0.6,2.2,2.6,0.6,0.4,0,1.4,1.55,0.6,3.67,2.67,0,2,1,-3,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),20,1,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,-1,1,0,0,0,0,0,1,1,1,3,4,2,1,1,2,0,2,0.2,0.2,2.2,1.2,0.95 +927,R_6ydvWA8a9X2tSeZ,18 - 24,American,Male,2,1,3,2,3,1,3,-1,0,1,1,3,2,2,1,2,3,3,2,2,2,3,2,3,1,8,0,0,2,0,1,6,1,1,1,3,2,4,2,3,1,2,2,8,1,2,1,2,3,7,1,1,3,1,2,5,2,1,2,1,3,7,2,3,2,2,1,5,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,52,FALSE,0,50,FALSE,1,50,TRUE,0,83,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,55,FALSE,1,50,FALSE,1,71,FALSE,0,50,FALSE,0,50,FALSE,1,51,FALSE,0,50,FALSE,1,52,FALSE,0,53,FALSE,1,58,FALSE,1,54,FALSE,1,51,TRUE,1,68,FALSE,0,65,TRUE,1,67,0.25,0.2809,0.25,0.25,0.1089,0.25,0.25,0.25,0.0841,0.25,0.1024,0.25,0.2704,0.25,0.25,0.25,0.2401,0.25,0.2116,0.2304,0.25,0.25,0.25,0.25,0.25,0.1764,0.4225,0.25,0.25,0.3025,0.2401,0.6889,0.252796429,0.218278571,0.287314286,22,68.75,16,50,4,50,5,62.5,3,37.5,4,50,2,12.5,14,87.5,54.06,53.12,52.38,51.25,59.5,53.44,54.69,18.75,4.06,3.12,-10.12,13.75,9.5,40.94,-32.81,0,2,1,1,2,1,3,3,0,0,0,2,1,1,1,0,0,2,0,0,1,1,2,0,0,0,2,4,1,1,1,2,0,1,2,0,0,1,0,1,1.2,1.4,1,0.4,0.8,1.6,1.2,0.4,1,1,6,6.33,1,1,-3,3,-0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,-1,1,-1,1,2,1,1,-1,-1,-1,-1,0,1,0,-1,0,0,1,0,-1,0.4,-0.2,-0.2,0,0 +928,R_3IlTfmR9FgPMBaL,18 - 24,American,Female,2,2,3,3,2,-3,2,3,1,2,1,1,3,2,3,-1,-2,-1,1,-1,2,3,2,3,1,9,2,2,1,2,0,6,2,1,-1,0,0,7,1,2,1,2,2,8,2,3,3,3,3,10,2,2,2,2,2,9,2,1,1,2,2,8,3,3,2,3,1,10,TRUE,0,79,TRUE,1,56,TRUE,0,100,FALSE,1,62,TRUE,1,79,FALSE,1,100,TRUE,1,63,FALSE,0,57,TRUE,1,71,TRUE,1,69,FALSE,1,62,TRUE,0,100,TRUE,1,93,FALSE,1,65,TRUE,1,71,TRUE,1,78,FALSE,1,86,TRUE,0,100,TRUE,0,67,FALSE,1,65,TRUE,1,87,FALSE,0,56,TRUE,0,95,TRUE,1,75,TRUE,0,87,FALSE,0,54,TRUE,0,73,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,76,0.3249,0.2916,0.0484,0.1369,0.0576,0,0.0625,0.0961,0.1225,0.3136,0,0.0049,0.0841,0.1444,0.0441,0.1936,0.9025,0.1444,1,0.7569,0.0169,0.0841,0.4489,0.1225,0.0196,0.5329,0.3025,0.6241,1,1,1,1,0.359953571,0.155021429,0.564885714,16,50,18,56.25,5,62.5,6,75,3,37.5,4,50,12,75,6,37.5,77.53,64.62,89.5,71.62,84.38,71.25,83.81,-6.25,21.28,2.12,14.5,34.12,34.38,-3.75,46.31,0,1,1,0,1,5,0,2,1,2,1,0,4,2,3,2,4,2,1,3,0,1,0,0,1,5,0,1,1,0,1,0,2,0,1,4,5,3,2,2,0.6,2,2,2.4,0.4,1.4,0.8,3.2,1.75,1.45,7.33,9,-1,-3,-1,-2,-1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,1,0,0,0,0,1,0,2,0,0,2,2,2,-2,-1,-1,-1,1,0.2,0.6,1.2,-0.8,0.3 +929,R_5O2CRKNvSbJ9R8m,18 - 24,Canadian,Female,3,3,3,3,3,0,2,2,-3,3,3,2,2,2,3,2,2,2,2,2,3,3,3,2,3,5,0,2,2,-3,3,2,3,3,3,3,3,3,2,2,2,2,2,5,3,3,3,3,3,5,0,2,2,-3,3,2,3,3,3,3,3,2,2,2,2,2,2,5,FALSE,1,100,TRUE,1,71,FALSE,1,100,FALSE,1,84,TRUE,1,94,FALSE,1,90,TRUE,1,63,TRUE,1,62,TRUE,1,60,TRUE,1,100,FALSE,1,65,TRUE,0,75,FALSE,0,65,FALSE,1,65,TRUE,1,65,TRUE,1,100,TRUE,0,81,TRUE,0,90,FALSE,1,80,FALSE,1,85,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,90,FALSE,1,80,FALSE,1,70,FALSE,1,50,FALSE,0,80,TRUE,1,70,TRUE,1,100,0.1444,0.01,0,0.1369,0,0.01,0.0625,0,0.0225,0,0.64,0.4225,0.16,0.1225,0.0036,0.0841,0,0.0256,0.09,0,0,0.1225,0.04,0.1225,0.6561,0.04,0.09,0,0,0.81,0.25,0.5625,0.154889286,0.11095,0.198828571,16,50,27,84.38,8,100,6,75,7,87.5,6,75,14,87.5,13,81.25,81.56,71.88,85,88.5,80.88,80.94,82.19,-34.38,-2.82,-28.12,10,1,5.88,-6.56,0.94,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0.2,0,0.6,0,0,0,0.6,0,0.2,0.15,3.33,3,0,0,1,0,0.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),23,1.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05 +930,R_5rGyFnKQ45RTsh0,18 - 24,American,Female,2,3,3,3,-1,-3,2,0,3,0,3,-2,3,-2,3,-3,-2,-2,-3,-3,-1,1,2,-3,2,8,2,-3,1,-1,2,10,3,3,-1,3,2,10,1,1,2,2,0,10,3,3,1,2,3,7,1,-3,3,-3,2,10,2,-2,3,-3,3,10,3,2,3,3,2,10,FALSE,1,50,TRUE,1,60,TRUE,0,85,TRUE,0,50,TRUE,1,81,FALSE,1,50,TRUE,1,90,TRUE,1,90,TRUE,1,60,TRUE,1,50,FALSE,1,55,TRUE,0,95,TRUE,1,59,FALSE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,60,TRUE,0,85,TRUE,0,55,FALSE,1,100,TRUE,1,55,TRUE,1,60,TRUE,0,50,TRUE,1,71,FALSE,1,100,TRUE,1,60,TRUE,0,70,FALSE,1,50,TRUE,0,60,FALSE,0,60,FALSE,0,50,FALSE,0,80,0.01,0.16,0.0025,0.01,0.64,0.25,0.0841,0.25,0,0.16,0.36,0.1681,0.16,0.2025,0.0361,0.16,0.25,0.25,0.25,0,0.2025,0.25,0.3025,0,0.16,0.49,0.25,0.25,0.7225,0.7225,0.36,0.9025,0.279760714,0.2122,0.347321429,16,50,20,62.5,3,37.5,5,62.5,7,87.5,5,62.5,12,75,8,50,68.31,56.25,61.88,74.38,80.75,66.94,69.69,-12.5,5.81,18.75,-0.62,-13.12,18.25,-8.06,19.69,3,2,1,6,3,5,5,1,4,2,0,5,4,5,1,4,3,4,5,3,1,0,2,1,4,4,5,3,6,2,1,0,0,1,0,6,4,5,6,5,3,3.4,3,3.8,1.6,4,0.4,5.2,3.3,2.8,9.33,9,1,0,0,0,0.33,10 cents,25 minutes,47 days,Female,High School (or equivalent),21,0.75,0,0,1,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,2,-1,5,-1,1,0,-2,-2,0,-1,5,4,4,1,-2,-1,-1,-1,-2,1.4,-0.6,2.6,-1.4,0.5 +931,R_5l4fedH1LanuIcI,18 - 24,American,Female,3,3,3,3,-1,0,1,0,3,1,2,0,3,-3,2,-2,0,-2,3,-2,3,3,3,2,2,6,3,3,-3,3,0,5,3,-3,-3,1,0,8,2,2,2,3,-3,7,3,3,3,3,0,6,0,2,1,2,0,2,2,2,0,0,0,4,0,0,0,0,-2,4,TRUE,0,100,FALSE,0,50,FALSE,1,64,FALSE,1,61,TRUE,1,100,FALSE,1,94,FALSE,0,50,TRUE,1,89,FALSE,0,93,TRUE,1,96,FALSE,1,75,FALSE,1,50,TRUE,1,68,FALSE,1,56,TRUE,1,67,TRUE,1,100,TRUE,0,84,TRUE,0,100,FALSE,1,67,FALSE,1,81,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,78,TRUE,0,90,TRUE,0,83,TRUE,1,84,FALSE,0,70,TRUE,1,100,0.0121,0,0,0.25,0,0.0036,0,0.0016,0.0361,0,0.0256,0.1024,0.8649,0.0625,0,0.25,0,0.1521,0.81,0,1,0.1089,0.1089,0.1936,0.7056,0.0484,0.49,1,0.1296,1,0.6889,0.25,0.286882143,0.107057143,0.466707143,16,50,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,11,68.75,11,68.75,82.81,70.12,91.12,87.75,82.25,85.44,80.19,-18.75,14.06,7.62,28.62,25.25,-5.25,16.69,11.44,0,0,0,1,3,3,2,3,0,1,1,3,6,4,2,4,2,4,0,1,0,0,0,0,1,0,1,1,1,1,0,2,3,3,2,2,0,2,3,0,0.8,1.8,3.2,2.2,0.2,0.8,2,1.4,2,1.1,6.33,4,0,3,4,3,2.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,2,3,1,2,-1,0,1,1,3,1,0,2,2,2,-3,1,0.6,1,1.2,0.8,0.9 +932,R_5fK8cmWCYY7Cy84,18 - 24,American,Male,1,1,0,2,-1,-2,-1,-1,1,1,-1,-3,2,2,3,-3,-1,-2,-3,-2,2,2,2,-2,-2,4,-2,-2,-1,-1,-1,5,2,1,-1,2,1,8,2,2,2,2,2,10,2,1,1,2,-2,2,-2,-2,0,1,1,1,-1,-3,3,1,3,1,-1,-1,-1,-1,0,3,FALSE,1,85,TRUE,1,50,TRUE,0,90,TRUE,0,50,TRUE,1,50,TRUE,0,60,TRUE,1,70,TRUE,1,60,TRUE,1,50,TRUE,1,50,FALSE,1,55,TRUE,0,100,TRUE,1,65,FALSE,1,60,TRUE,1,70,TRUE,1,100,FALSE,1,50,TRUE,0,80,TRUE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,0,75,TRUE,1,90,FALSE,1,70,TRUE,1,75,FALSE,1,50,FALSE,1,80,TRUE,0,60,TRUE,1,55,TRUE,1,50,TRUE,1,70,0.16,0.0625,0,0.09,0.09,0.36,0.01,0.25,0.25,0.25,0.2025,0.1225,0.25,0.2025,0.25,0.25,0.5625,0.25,0.04,0.09,0,0.09,0.25,0.16,0.25,0.25,0.25,0.0225,0.81,0.64,0.36,1,0.268303571,0.235714286,0.300892857,13,40.63,24,75,6,75,5,62.5,7,87.5,6,75,16,100,8,50,66.25,53.12,66.25,67.5,78.12,65.94,66.56,-34.37,-8.75,-21.88,3.75,-20,3.12,-34.06,16.56,1,1,2,4,1,0,1,0,2,2,3,4,3,0,2,5,3,4,5,4,1,0,1,0,1,0,1,1,0,0,0,0,1,1,0,2,0,1,2,2,1.8,1,2.4,4.2,0.6,0.4,0.4,1.4,2.35,0.7,5.67,1.33,2,4,7,7,4.34,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,21,1.375,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,1,1,4,0,0,0,-1,2,2,3,4,2,-1,2,3,3,3,3,2,1.2,0.6,2,2.8,1.65 +933,R_1afQb6ELZHqScFz,18 - 24,American,Female,1,3,2,2,2,2,1,3,1,1,3,3,2,1,3,2,1,2,3,-1,-3,1,-3,-3,0,7,-2,3,2,-3,-2,6,-1,-2,-1,3,-1,9,-3,-3,-3,-3,-3,10,1,2,1,0,3,3,3,-1,3,-1,3,2,3,3,3,1,3,2,3,3,2,3,3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,88,TRUE,1,100,FALSE,1,84,FALSE,1,100,FALSE,0,96,FALSE,1,100,TRUE,1,73,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,TRUE,1,86,FALSE,1,91,TRUE,1,100,FALSE,1,96,FALSE,1,73,TRUE,0,90,FALSE,0,95,TRUE,1,82,FALSE,0,54,0,0,1,0,0.2916,0,0.0196,0,0,0,0.9025,0.9216,0.0144,0.0256,0,0,0.0625,0,0.0729,0.0081,0,0.0729,0.0225,0,0,0.0016,0.0324,1,1,0,0.81,0,0.187792857,0.159842857,0.215742857,25,78.13,25,78.13,8,100,5,62.5,7,87.5,5,62.5,12,75,13,81.25,92.75,88.5,89.38,98.88,94.25,92.12,93.38,0,14.62,-11.5,26.88,11.38,31.75,17.12,12.13,4,2,5,5,2,4,2,1,4,3,4,5,3,2,4,5,4,5,6,2,0,1,1,2,1,1,2,0,2,2,0,0,1,0,0,1,2,0,0,4,3.6,2.8,3.6,4.4,1,1.4,0.2,1.4,3.6,1,7.33,2.33,4,4,7,6,5,5 cents,5 minutes,47 days,Female,University - Undergraduate,23,-0.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,4,1,4,3,1,3,0,1,2,1,4,5,2,2,4,4,2,5,6,-2,2.6,1.4,3.4,3,2.6 +934,R_6xasPwdSClR7OZb,18 - 24,American,Female,3,3,-1,3,2,-3,1,2,2,2,-2,0,3,0,3,-3,-3,-2,-1,-2,3,2,2,-3,-1,3,-3,-3,0,3,1,8,1,-1,3,2,3,9,-3,-3,-3,-3,1,4,3,3,0,2,2,3,-3,-2,3,-1,3,7,-1,-2,3,-2,3,4,3,2,2,3,1,10,TRUE,0,100,TRUE,1,88,FALSE,1,53,FALSE,1,67,FALSE,0,51,FALSE,1,100,TRUE,1,100,TRUE,1,89,TRUE,1,50,TRUE,1,100,TRUE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,89,TRUE,1,67,TRUE,1,86,TRUE,0,79,FALSE,1,100,TRUE,0,82,FALSE,1,85,TRUE,1,70,TRUE,1,99,TRUE,0,50,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,92,TRUE,0,62,FALSE,0,60,FALSE,0,50,TRUE,1,87,0.0121,0,0.0196,0,0.0169,0,0.0169,0,0.0225,0.0001,0.36,0,0.25,0.4096,0.2601,0.0144,0.25,0.1089,0.0064,0,0.09,0.1089,0.6724,0.7921,0.6241,0.25,0.25,1,0.2209,0,0.3844,1,0.253878571,0.1221,0.385657143,23,71.88,20,62.5,4,50,4,50,6,75,6,75,13,81.25,7,43.75,79.91,64.75,74.88,98.5,81.5,80.25,79.56,9.38,17.41,14.75,24.88,23.5,6.5,-1,35.81,0,1,3,6,3,0,4,2,1,1,3,1,0,2,0,0,0,1,2,3,0,0,1,1,0,0,3,1,3,1,1,2,0,2,0,6,5,4,4,3,2.6,1.6,1.2,1.2,0.4,1.6,1,4.4,1.65,1.85,6.67,4.67,0,1,5,-6,2,10 cents,5 minutes,47 days,Female,High School (or equivalent),19,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,1,2,5,3,0,1,1,-2,0,2,-1,0,0,0,-6,-5,-3,-2,0,2.2,0,0.2,-3.2,-0.2 +935,R_3gIrdCqFac5ou6L,18 - 24,Canadian,Male,1,-1,-1,1,3,1,0,-1,1,0,1,-1,0,2,0,0,-1,2,1,0,-1,1,1,0,-1,7,-1,0,0,1,0,5,0,-1,0,1,0,4,-1,1,0,-1,1,6,1,1,-1,1,0,5,-1,1,1,0,-1,6,0,-1,0,1,-1,5,0,1,1,0,-1,4,TRUE,0,100,TRUE,1,80,TRUE,0,59,FALSE,1,50,TRUE,1,64,FALSE,1,60,FALSE,0,61,TRUE,1,82,FALSE,0,66,TRUE,1,93,TRUE,0,68,TRUE,0,100,FALSE,0,56,FALSE,1,72,FALSE,0,61,TRUE,1,83,TRUE,0,60,TRUE,0,64,FALSE,1,70,TRUE,0,95,FALSE,0,71,FALSE,0,74,FALSE,1,58,FALSE,0,59,FALSE,1,63,FALSE,0,65,FALSE,1,58,FALSE,1,54,FALSE,1,67,FALSE,0,64,FALSE,0,58,TRUE,1,94,0.0324,0.4225,0.0289,0.3721,0.0036,0.16,0.3481,0.0049,0.9025,0.5476,0.4096,0.3136,0.4356,0.4624,0.1296,0.04,0.1764,0.25,0.2116,0.1369,0.5041,0.3721,0.09,0.0784,0.36,0.1764,0.3364,1,0.3481,0.4096,0.1089,1,0.332728571,0.29885,0.366607143,18,56.25,15,46.88,4,50,5,62.5,3,37.5,3,37.5,6,37.5,9,56.25,69.66,63.88,66.25,74,74.5,70.69,68.62,9.37,22.78,13.88,3.75,36.5,37,33.19,12.37,2,2,2,1,4,2,0,1,0,0,1,0,0,1,0,1,2,2,2,1,0,2,0,0,3,2,1,2,1,1,1,0,0,1,1,0,2,1,1,1,2.2,0.6,0.4,1.6,1,1.4,0.6,1,1.2,1,5.33,5.33,2,-1,-1,2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,2,0,2,1,1,0,-1,-1,-1,-1,0,0,0,0,-1,1,0,1,1,0,1.2,-0.8,-0.2,0.6,0.2 +936,R_7osZtna6c3BVmZn,18 - 24,American,Female,1,-3,-3,-1,3,-1,0,-1,-2,0,0,-1,-2,2,2,1,-2,3,1,-3,-3,2,-3,3,-1,6,2,-3,-3,0,-3,5,-3,-3,-3,2,3,9,-3,3,1,-3,2,2,3,0,-3,0,-1,5,-2,-3,3,3,-3,9,-3,-1,1,-3,3,5,2,-3,-3,2,-2,6,FALSE,1,76,TRUE,1,63,TRUE,0,60,FALSE,1,81,TRUE,1,83,FALSE,1,62,FALSE,0,63,TRUE,1,73,FALSE,0,77,FALSE,0,59,TRUE,0,65,TRUE,0,70,FALSE,0,80,TRUE,0,63,FALSE,0,61,TRUE,1,73,TRUE,0,71,FALSE,1,92,TRUE,0,62,FALSE,1,61,FALSE,0,82,TRUE,1,64,TRUE,0,85,FALSE,0,72,TRUE,0,69,TRUE,1,68,FALSE,1,73,FALSE,1,80,TRUE,0,56,FALSE,0,59,TRUE,1,55,FALSE,0,75,0.0729,0.1024,0.0729,0.3969,0.5625,0.1444,0.5184,0.3481,0.1521,0.1296,0.3481,0.64,0.5929,0.4225,0.0289,0.1369,0.7225,0.0361,0.04,0.4761,0.6724,0.3721,0.3844,0.3969,0.5041,0.0729,0.2025,0.0576,0.36,0.0064,0.3136,0.49,0.326142857,0.341642857,0.310642857,16,50,14,43.75,4,50,2,25,4,50,4,50,7,43.75,7,43.75,69.78,67.12,74.25,69.25,68.5,69.19,70.38,6.25,26.03,17.12,49.25,19.25,18.5,25.44,26.63,4,5,0,4,4,3,3,2,2,3,3,2,1,0,1,4,5,2,4,5,2,3,0,1,4,1,3,4,5,3,3,0,3,5,1,1,1,6,1,1,3.4,2.6,1.4,4,2,3.2,2.4,2,2.85,2.4,6.67,6.33,1,-4,4,-4,0.34,15 cents,75 minutes,15 days,Female,High School (or equivalent),19,0.125,0,0,0,0,0,0,0,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,2,2,0,3,0,2,0,-2,-3,0,0,2,-2,-5,0,3,4,-4,3,4,1.4,-0.6,-1,2,0.45 +937,R_1QqwFfTsxP1c6g9,18 - 24,Canadian,Female,1,1,1,1,1,1,-1,1,-2,1,2,2,2,2,2,1,1,2,2,2,1,2,2,1,-1,8,1,2,1,2,3,6,2,1,1,1,2,7,2,1,2,2,2,7,2,1,1,1,1,7,1,2,1,1,2,7,1,2,1,1,1,7,1,2,2,1,1,7,FALSE,1,67,TRUE,1,69,TRUE,0,67,FALSE,1,59,TRUE,1,69,FALSE,1,60,TRUE,1,67,TRUE,1,62,TRUE,1,68,TRUE,1,71,FALSE,1,71,TRUE,0,66,TRUE,1,67,FALSE,1,70,TRUE,1,65,TRUE,1,69,FALSE,1,56,TRUE,0,73,FALSE,1,76,FALSE,1,81,TRUE,1,74,TRUE,1,68,FALSE,1,81,TRUE,1,72,FALSE,1,65,TRUE,1,82,FALSE,1,64,TRUE,0,75,FALSE,1,83,TRUE,1,98,TRUE,1,79,TRUE,1,74,0.1444,0.0324,0.0961,0.1089,0.0676,0.16,0.0784,0.0841,0.0361,0.1024,0.0004,0.1089,0.1024,0.0841,0.0961,0.0961,0.0361,0.1681,0.5625,0.1225,0.0676,0.1225,0.0576,0.09,0.1936,0.1296,0.0441,0.1089,0.4489,0.5329,0.0289,0.4356,0.148785714,0.0872,0.210371429,22,68.75,28,87.5,8,100,8,100,7,87.5,5,62.5,16,100,12,75,70.88,68.88,70.5,70.38,73.75,72.12,69.62,-18.75,-16.62,-31.12,-29.5,-17.12,11.25,-27.88,-5.38,0,1,1,0,2,0,3,0,4,2,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,3,0,3,1,1,0,1,1,1,0,1,0,1,1,0.8,1.8,0.6,0.2,0.2,1.4,0.8,0.6,0.85,0.75,7,7,1,-1,0,0,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,0.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,-1,1,1,0,2,0,0,0,1,1,-1,1,0,0,-1,1,-1,0,-1,-1,0.6,0.4,-0.2,-0.4,0.1 +938,R_10ursrLnikZBqVE,18 - 24,American,Female,2,3,1,3,2,2,1,3,3,2,2,3,1,3,2,3,3,1,2,2,2,1,2,3,3,10,2,2,3,1,3,10,1,2,2,3,3,9,2,2,3,1,3,8,3,3,2,1,2,10,3,2,2,1,3,9,1,3,2,2,3,8,1,2,3,2,3,7,FALSE,1,97,TRUE,1,93,FALSE,1,89,FALSE,1,79,TRUE,1,98,FALSE,1,95,TRUE,1,91,TRUE,1,85,TRUE,1,100,TRUE,1,98,FALSE,1,93,FALSE,1,91,FALSE,0,86,FALSE,1,82,TRUE,1,88,TRUE,1,93,FALSE,1,100,FALSE,1,96,FALSE,1,92,FALSE,1,88,TRUE,1,83,TRUE,1,77,FALSE,1,83,TRUE,1,91,FALSE,1,100,TRUE,1,96,FALSE,1,91,FALSE,1,86,FALSE,1,82,TRUE,1,87,FALSE,0,92,TRUE,1,97,0.0225,0.0016,0.0049,0.0081,0.0009,0.0025,0.0081,0.0004,0.0144,0.0529,0.0169,0.7396,0,0.0049,0.0004,0.0049,0.0289,0.0441,0.0196,0,0.0289,0.0144,0.0064,0.0324,0,0.0081,0.8464,0.0009,0.0121,0.0016,0.0324,0.0081,0.068935714,0.065635714,0.072235714,32,100,30,93.75,7,87.5,7,87.5,8,100,8,100,14,87.5,16,100,90.59,91,90.5,92.12,88.75,90.94,90.25,6.25,-3.16,3.5,3,-7.88,-11.25,3.44,-9.75,0,2,1,0,1,0,1,0,2,1,1,1,1,0,1,1,1,2,1,1,1,0,1,2,0,1,1,1,2,1,1,0,1,1,1,2,1,2,0,1,0.8,0.8,0.8,1.2,0.8,1.2,0.8,1.2,0.9,1,9.67,9,0,1,1,1,0.67,5 cents,5 minutes,47 days,Female,University - PhD,22,0.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,-1,2,0,-2,1,-1,0,-1,0,0,0,1,0,-1,0,-1,0,0,1,0,0,-0.4,0,0,-0.1 +939,R_3iJtRquYbpjVhgV,18 - 24,Both,Female,3,3,1,0,2,-2,0,1,0,1,1,1,3,0,2,1,1,2,1,-1,3,1,2,-3,3,8,1,-1,1,-2,1,7,1,2,1,1,3,7,2,2,2,1,1,8,3,3,1,3,2,4,-1,0,2,-1,1,4,1,0,3,0,3,4,1,1,1,0,-2,5,FALSE,1,53,FALSE,0,50,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,1,57,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,68,TRUE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,58,FALSE,0,62,TRUE,1,100,FALSE,1,59,FALSE,1,69,FALSE,1,50,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,78,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0,0,0,0,0.1849,0,0.1024,0.1225,0,0,0,0.25,0.25,0,0.25,0.0484,0.1849,0.0625,0,0,0.3844,0.25,0.1764,0.1681,0.25,0.2809,0.2209,1,0.0961,1,0,0.188657143,0.099507143,0.277807143,24,75,25,78.13,3,37.5,7,87.5,8,100,7,87.5,13,81.25,12,75,78.25,52.75,86.75,81,92.5,86.44,70.06,-3.13,0.12,15.25,-0.75,-19,5,5.19,-4.94,0,2,1,3,1,3,1,0,2,0,0,1,2,1,1,1,1,0,0,2,0,0,0,3,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1,1,1.4,1.2,1,0.8,0.6,0.6,0.4,0.6,1.1,0.55,7.33,4,4,3,3,3,3.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),18,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,2,1,0,1,2,1,-1,1,0,0,0,2,1,0,1,1,-1,-1,1,0.8,0.6,0.6,0.2,0.55 +940,R_1t0tg6QnXe9S4xz,18 - 24,American,Male,-3,3,1,3,0,-3,2,-3,2,-3,-2,2,3,0,2,1,-3,0,1,-3,1,3,2,3,0,5,3,-3,1,-3,2,5,2,0,2,0,2,9,2,2,2,2,2,0,0,3,1,3,2,9,-3,-3,3,-3,2,9,2,3,3,3,3,9,2,2,2,2,2,9,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,78,TRUE,1,63,FALSE,1,58,TRUE,1,62,FALSE,1,51,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.25,0.1444,0,0,0,0,0.1369,0.25,0,0,0,0,0.25,0.25,0,0.25,0.6084,0.25,1,0.1764,0.25,0.25,0.25,0.25,0.25,0.2401,0,0.25,1,1,1,1,0.318278571,0.142521429,0.494035714,16,50,20,62.5,4,50,5,62.5,7,87.5,4,50,11,68.75,9,56.25,75.38,56.38,84.75,71.25,89.12,76.56,74.19,-12.5,12.88,6.38,22.25,-16.25,39.12,7.81,17.94,4,0,1,0,0,6,5,4,5,5,4,2,1,0,0,1,5,2,1,5,3,0,0,0,2,0,5,6,5,5,4,1,0,3,1,1,5,2,1,5,1,5,1.4,2.8,1,4.2,1.8,2.8,2.55,2.45,6.33,9,-4,-4,0,-9,-2.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),19,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,1,0,1,0,-2,6,0,-2,0,0,0,1,1,-3,-1,0,0,0,0,0,0,0.8,-0.4,0,0.1 +941,R_1JCtnfb1srdcz8M,18 - 24,Canadian,Male,0,3,3,1,2,-2,3,-1,1,2,2,3,2,-1,3,-3,-3,-3,-2,-3,2,-1,3,3,2,2,2,-2,-3,-3,1,8,2,2,2,-1,3,3,2,2,2,-2,1,8,3,3,1,3,3,3,3,3,3,0,3,10,2,2,1,-2,3,8,3,3,3,3,3,10,TRUE,0,75,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,69,TRUE,0,79,TRUE,1,96,FALSE,1,52,TRUE,1,50,FALSE,0,62,TRUE,0,92,FALSE,1,94,FALSE,1,50,FALSE,1,89,FALSE,0,50,TRUE,1,53,TRUE,0,50,TRUE,1,89,TRUE,0,94,TRUE,1,82,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,97,0.25,0.0324,0.3844,0.25,0.0009,0.25,0.0121,0,0.0121,0.2209,0,0.0016,0.25,0.0961,0,0.25,0.25,0.25,0.25,0.8836,0.25,0.25,0.25,0.2304,0.8464,0.25,0.25,0.5625,0,0.0036,0.25,0.6241,0.231939286,0.113835714,0.350042857,12,37.5,19,59.38,6,75,3,37.5,5,62.5,5,62.5,11,68.75,8,50,69.47,52.38,73.12,75,77.38,70.56,68.38,-21.88,10.09,-22.62,35.62,12.5,14.88,1.81,18.38,2,4,0,2,0,4,5,2,4,1,0,1,0,0,0,5,5,5,0,4,3,0,2,2,1,5,0,4,1,1,0,1,1,1,0,6,6,6,5,6,1.6,3.2,0.2,3.8,1.6,2.2,0.6,5.8,2.2,2.55,4.33,7,-1,-2,-5,-2,-2.67,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,-1,4,-2,0,-1,-1,5,-2,3,0,0,0,-1,-1,0,-1,-1,-1,-5,-2,0,1,-0.4,-2,-0.35 +942,R_6nDFxsYs7n40BOO,18 - 24,American,Female,-1,3,3,2,2,0,1,0,1,3,-1,-2,3,0,0,-2,-1,-1,-1,-2,-2,3,3,3,1,1,1,-1,1,1,1,4,2,0,1,1,1,3,-2,-1,1,-1,-1,5,1,3,2,1,3,3,2,-3,3,-3,3,7,0,-2,3,0,3,5,3,3,3,3,3,10,FALSE,1,61,FALSE,0,52,TRUE,0,100,FALSE,1,56,TRUE,1,59,TRUE,0,51,TRUE,1,80,TRUE,1,52,TRUE,1,51,TRUE,1,100,FALSE,1,54,TRUE,0,73,TRUE,1,51,FALSE,1,100,FALSE,0,56,TRUE,1,50,TRUE,0,55,TRUE,0,63,TRUE,0,63,FALSE,1,51,TRUE,1,73,TRUE,1,76,FALSE,1,100,TRUE,1,75,TRUE,0,52,TRUE,1,82,TRUE,0,62,TRUE,0,55,TRUE,0,61,FALSE,0,57,FALSE,0,53,TRUE,1,100,0.2304,0.0324,0.25,0.04,0,0.2601,0.0625,0,0.2401,0.0576,0.3249,0.2401,0.2401,0.2116,0.1681,0.2704,0,0.1936,0.3025,0.2704,0.0729,0.3136,0.3969,0,0.3025,0.3844,0.2809,0.1521,1,0.3969,0.3721,0.5329,0.251685714,0.162078571,0.341292857,16,50,18,56.25,3,37.5,5,62.5,6,75,4,50,12,75,6,37.5,66.38,55.88,68.75,76.75,64.12,66.69,66.06,-6.25,10.13,18.38,6.25,1.75,14.12,-8.31,28.56,1,0,0,1,1,1,2,1,0,2,3,2,2,1,1,0,0,2,0,1,2,0,1,1,1,2,4,3,4,0,1,0,0,0,3,5,4,4,4,5,0.6,1.2,1.8,0.6,1,2.6,0.8,4.4,1.05,2.2,2.67,5,-2,-3,-2,-5,-2.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,1.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,0,-1,0,0,-1,-2,-2,-4,2,2,2,2,1,-2,-5,-4,-2,-4,-4,-0.4,-1.4,1,-3.8,-1.15 +943,R_5LcMh2B9OVA3yV7,18 - 24,American,Male,1,3,3,1,2,1,0,1,1,2,2,1,2,-2,3,1,1,1,2,-1,-1,2,3,-1,0,3,2,0,-1,3,1,4,1,2,1,2,2,5,-2,-2,2,1,-2,5,2,3,3,3,3,0,1,-1,2,1,2,4,3,1,3,-1,3,3,2,3,3,2,2,3,TRUE,0,70,TRUE,1,100,TRUE,0,81,FALSE,1,51,FALSE,0,51,TRUE,0,100,TRUE,1,80,FALSE,0,59,TRUE,1,73,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,93,FALSE,0,70,TRUE,1,98,FALSE,1,53,FALSE,1,100,TRUE,0,100,FALSE,1,78,FALSE,0,100,TRUE,1,57,FALSE,1,100,TRUE,1,93,TRUE,0,100,TRUE,1,100,FALSE,1,64,FALSE,1,66,TRUE,0,79,TRUE,1,100,FALSE,0,56,TRUE,1,51,0.3481,0,0.0004,0.04,0.2401,1,0.0049,0,0.0484,0.1849,0,0,0.0729,0,0.2601,0,0,0.2401,0.1156,1,1,0.49,1,0.0049,0.2209,0.1296,0.3136,0.49,0.6561,0,0.6241,0,0.28915,0.146528571,0.431771429,18,56.25,21,65.63,5,62.5,4,50,6,75,6,75,11,68.75,10,62.5,81.97,76.75,79.25,87.5,84.38,80.5,83.44,-9.38,16.34,14.25,29.25,12.5,9.38,11.75,20.94,2,1,0,2,2,1,0,2,2,1,1,1,1,4,1,3,3,1,1,1,1,0,0,2,1,0,1,1,0,0,1,0,1,1,0,1,2,2,0,3,1.4,1.2,1.6,1.8,0.8,0.4,0.6,1.6,1.5,0.85,4,2.33,3,0,2,2,1.67,5 cents,5 minutes,24 days,Male,High School (or equivalent),21,1,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,1,1,0,0,1,1,-1,1,2,1,0,1,0,3,1,2,1,-1,1,-2,0.6,0.8,1,0.2,0.65 +944,R_6juHRUsdd4czYwf,25 - 31,American,Male,3,3,2,2,2,3,-3,3,-1,3,3,-3,3,-2,3,3,2,1,2,-1,0,3,3,-2,2,9,0,-2,0,1,0,10,2,0,3,2,2,10,1,0,3,2,2,8,2,2,0,3,2,7,1,-2,0,-2,0,8,3,0,-1,2,1,8,1,1,3,1,2,10,TRUE,0,55,FALSE,0,62,FALSE,1,75,FALSE,1,60,FALSE,0,50,TRUE,0,65,TRUE,1,89,TRUE,1,68,FALSE,0,59,FALSE,0,55,FALSE,1,58,FALSE,1,100,TRUE,1,82,FALSE,1,100,FALSE,0,58,TRUE,1,86,FALSE,1,63,TRUE,0,58,FALSE,1,50,FALSE,1,75,FALSE,0,91,FALSE,0,74,TRUE,0,69,TRUE,1,100,FALSE,1,70,TRUE,1,80,FALSE,1,58,FALSE,1,100,TRUE,0,96,FALSE,0,96,FALSE,0,50,TRUE,1,100,0.1024,0.04,0.0196,0.0121,0,0.4225,0,0.3025,0.0625,0.5476,0.9216,0.0324,0.3481,0.1764,0.25,0.3844,0.4761,0.16,0,0.09,0.8281,0.3364,0.25,0,0.1369,0.1764,0.25,0.3025,0.0625,0.3364,0.9216,0,0.277675,0.291721429,0.263628571,12,37.5,18,56.25,4,50,3,37.5,4,50,7,87.5,7,43.75,11,68.75,73.5,56.88,77,72.62,87.5,75,72,-18.75,17.25,6.88,39.5,22.62,0,31.25,3.25,3,0,1,4,0,3,1,3,2,3,1,3,0,4,1,2,2,2,0,3,1,1,2,1,0,2,1,3,1,3,0,3,4,4,2,2,1,2,1,3,1.6,2.4,1.8,1.8,1,2,2.6,1.8,1.9,1.85,9.67,7.67,2,2,2,-2,2,10 cents,75 minutes,47 days,Male,High School (or equivalent),25,0.5,0,0,1,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,-1,-1,3,0,1,0,0,1,0,1,0,-4,0,-1,0,1,0,-1,0,0.6,0.4,-0.8,0,0.05 +945,R_7ZVbWzAeDIxHUR1,18 - 24,American,Male,1,3,3,-3,3,-3,-1,2,-3,0,3,1,3,3,1,2,3,2,-1,-2,-3,1,0,3,-1,8,1,-3,3,-2,2,7,3,3,-1,2,-1,8,-3,-2,3,-3,-3,10,0,3,3,2,3,4,1,-2,1,-3,2,6,3,2,3,3,2,2,2,1,1,1,-1,4,TRUE,0,100,TRUE,1,81,FALSE,1,86,FALSE,1,50,TRUE,1,81,FALSE,1,93,TRUE,1,85,TRUE,1,86,TRUE,1,70,TRUE,1,84,FALSE,1,84,TRUE,0,77,TRUE,1,86,TRUE,0,71,FALSE,0,54,TRUE,1,92,TRUE,0,96,FALSE,1,69,FALSE,1,83,FALSE,1,61,TRUE,1,100,TRUE,1,61,FALSE,1,95,TRUE,1,85,FALSE,1,75,TRUE,1,100,FALSE,1,89,TRUE,0,100,FALSE,1,76,FALSE,0,100,TRUE,1,99,TRUE,1,97,0.0196,0,0.0064,0.0225,0.0009,0.0049,0.0225,0.0256,0.1521,0.1521,1,0.0196,0.09,0.0256,0.0361,0.0361,0.0025,0.25,1,0.0625,0,0.2916,0.0289,0.5041,0.9216,0.0121,0.0001,1,0.0196,0.0961,0.0576,0.5929,0.228753571,0.129857143,0.32765,28,87.5,25,78.13,7,87.5,7,87.5,6,75,5,62.5,14,87.5,11,68.75,83.31,76.25,90.5,80.62,85.88,85.06,81.56,9.37,5.18,-11.25,3,5.62,23.38,-2.44,12.81,4,2,3,6,4,4,2,1,1,2,0,2,4,1,2,5,5,1,2,1,1,0,0,5,0,4,1,1,0,2,0,1,0,0,1,0,2,1,2,1,3.8,2,1.8,2.8,1.2,1.6,0.4,1.2,2.6,1.1,7.67,4,4,1,6,6,3.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),21,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,3,2,3,1,4,0,1,0,1,0,0,1,4,1,1,5,3,0,0,0,2.6,0.4,1.4,1.6,1.5 +946,R_5RvKlNPfLIW6A3n,18 - 24,Canadian,Female,1,2,2,2,2,1,1,1,0,1,0,0,1,1,1,-1,0,0,0,2,-1,1,3,-1,1,8,-1,0,-1,1,-1,10,-1,2,-1,0,1,10,-3,-1,-2,-2,0,8,2,2,2,2,2,2,2,0,2,-2,2,4,0,-2,2,-1,2,5,3,3,3,3,3,10,FALSE,1,80,TRUE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,61,FALSE,1,50,TRUE,1,93,FALSE,0,50,TRUE,1,89,TRUE,1,97,FALSE,1,50,TRUE,0,70,TRUE,1,80,FALSE,1,50,TRUE,1,97,TRUE,1,90,TRUE,0,50,TRUE,0,77,TRUE,0,50,FALSE,1,50,FALSE,0,65,TRUE,1,59,FALSE,1,57,TRUE,1,50,FALSE,1,80,FALSE,0,50,FALSE,1,50,TRUE,0,65,TRUE,0,50,FALSE,0,50,TRUE,1,54,TRUE,1,85,0.25,0.25,0.01,0.0049,0.0225,0.25,0.25,0.0009,0.25,0.1681,0.25,0.04,0.0121,0.25,0.1521,0.25,0.1849,0.25,0.4225,0.04,0.4225,0.0009,0.25,0.25,0.25,0.25,0.2116,0.04,0.5625,0.5929,0.25,0.49,0.227267857,0.166471429,0.288064286,16,50,21,65.63,7,87.5,5,62.5,6,75,3,37.5,12,75,9,56.25,64.81,61.25,62.25,73.25,62.5,70,59.62,-15.63,-0.82,-26.25,-0.25,-1.75,25,-5,3.37,2,1,1,3,1,2,1,2,1,2,1,2,2,1,0,2,1,2,2,2,1,0,0,0,0,1,1,1,2,1,0,2,1,2,1,4,3,3,3,1,1.6,1.6,1.2,1.8,0.2,1.2,1.2,2.8,1.55,1.35,9.33,3.67,6,6,5,-2,5.66,5 cents,100 minutes,47 days,Female,University - Undergraduate,24,0.125,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,1,1,1,3,1,1,0,1,-1,1,1,0,1,-1,-1,-2,-2,-1,-1,1,1.4,0.4,0,-1,0.2 +947,R_3FGNFRLm8W2mWmB,32 - 38,American,Male,0,3,2,2,3,1,0,2,-1,1,1,0,3,1,-1,0,1,2,2,-2,0,0,1,3,2,7,2,1,2,0,3,8,0,1,-1,3,1,8,2,1,-1,3,1,6,2,3,0,2,3,7,2,-1,1,3,0,8,0,2,-1,1,-1,6,2,2,3,3,0,4,FALSE,1,100,TRUE,1,93,TRUE,0,72,FALSE,1,73,TRUE,1,96,FALSE,1,85,TRUE,1,82,TRUE,1,100,TRUE,1,94,TRUE,1,83,FALSE,1,100,TRUE,0,68,FALSE,0,87,FALSE,1,75,FALSE,0,63,TRUE,1,100,FALSE,1,97,TRUE,0,72,FALSE,1,100,FALSE,1,91,TRUE,1,95,TRUE,1,74,TRUE,0,64,TRUE,1,91,TRUE,0,88,TRUE,1,74,FALSE,1,100,FALSE,1,96,TRUE,0,86,TRUE,1,57,TRUE,1,92,FALSE,0,92,0,0.0676,0,0.0324,0.8464,0.0225,0.0081,0.0289,0.0081,0.0676,0.1849,0.7569,0.0036,0,0.0016,0.0049,0.4096,0.0729,0.0016,0.7744,0.0025,0.3969,0,0.0625,0.0009,0,0.0064,0,0.5184,0.5184,0.7396,0.4624,0.210714286,0.172571429,0.248857143,25,78.13,23,71.88,7,87.5,4,50,6,75,6,75,13,81.25,10,62.5,85.62,89.38,87.75,81,84.38,85.81,85.44,6.25,13.74,1.88,37.75,6,9.38,4.56,22.94,0,3,1,1,1,1,1,0,1,2,1,1,4,2,2,2,0,3,1,3,2,0,2,0,0,1,1,1,4,1,1,2,4,0,0,2,1,1,1,2,1.2,1,2,1.8,0.8,1.6,1.4,1.4,1.5,1.3,7.67,7,0,0,2,2,0.67,10 cents,100 minutes,47 days,Male,High School (or equivalent),35,0,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-2,3,-1,1,1,0,0,-1,-3,1,0,-1,0,2,2,0,-1,2,0,1,0.4,-0.6,0.6,0.4,0.2 +948,R_3djZmCukYTMNCKZ,18 - 24,Canadian,Male,1,2,1,0,2,1,0,0,-1,1,1,0,1,1,1,1,2,1,2,1,1,-1,2,0,1,6,0,1,0,1,1,5,0,1,1,1,1,8,0,1,2,1,2,7,2,1,-1,0,1,7,0,-1,2,1,1,8,0,1,1,0,1,6,0,1,1,1,1,5,FALSE,1,55,FALSE,0,60,FALSE,1,75,FALSE,1,55,FALSE,0,50,TRUE,0,55,TRUE,1,100,FALSE,0,65,FALSE,0,60,TRUE,1,65,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,0,65,TRUE,1,75,TRUE,0,75,TRUE,0,100,TRUE,0,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,75,FALSE,0,65,FALSE,1,75,FALSE,0,50,FALSE,1,55,FALSE,1,55,FALSE,1,55,TRUE,1,100,TRUE,1,100,FALSE,0,50,0.4225,0.25,0.0625,0,0.25,0.3025,0.4225,0.1225,0.1225,0,0,0,0.36,0.25,0.25,0.36,0.0625,0.2025,0.2025,0.0625,0,0.4225,1,0.5625,0.5625,0.2025,0,0.2025,0.0625,1,0.2025,1,0.292410714,0.193214286,0.391607143,20,62.5,18,56.25,4,50,4,50,5,62.5,5,62.5,8,50,10,62.5,72.66,68.12,70,77.5,75,75.31,70,6.25,16.41,18.12,20,15,12.5,25.31,7.5,0,3,1,0,1,1,1,0,2,0,1,1,0,0,0,1,1,1,1,1,1,1,2,0,1,1,1,2,2,0,1,1,0,1,0,1,1,0,1,0,1,0.8,0.4,1,1,1.2,0.6,0.6,0.8,0.85,6.33,7,-1,-3,2,2,-0.67,10 cents,100 minutes,47 days,Male,High School (or equivalent),24,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,2,-1,0,0,0,0,-2,0,0,0,0,0,-1,0,0,0,1,0,1,0,-0.4,-0.2,0.4,-0.05 +949,R_5mXGwTbhFQ345Db,18 - 24,Canadian,Female,2,3,1,-1,1,-2,1,-1,1,-1,1,-2,1,-2,2,-2,-2,-2,-1,-2,2,1,2,-2,0,4,1,0,-1,-1,1,6,1,-1,1,-2,2,5,-2,-1,-2,-1,-2,3,2,3,1,1,2,2,-1,0,1,-1,1,3,1,-2,2,-2,2,2,1,0,1,1,-1,4,TRUE,0,100,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,75,TRUE,1,85,FALSE,0,70,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,0,80,TRUE,1,50,FALSE,1,75,TRUE,1,60,TRUE,1,50,TRUE,0,50,TRUE,0,90,TRUE,0,50,FALSE,1,50,FALSE,0,60,FALSE,0,50,FALSE,1,70,TRUE,1,50,TRUE,0,50,TRUE,1,80,FALSE,1,50,FALSE,1,75,TRUE,0,50,FALSE,0,75,FALSE,0,50,FALSE,0,60,0.49,0.04,0.25,0.0225,0.36,0.0625,0.25,0.09,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.09,0.25,0.0625,0.25,0.36,0.16,0.25,0.0625,0.25,0.25,0.25,1,0,0.81,0.25,0.64,0.286071429,0.243928571,0.328214286,10,31.25,17,53.13,4,50,4,50,4,50,5,62.5,8,50,9,56.25,63.28,51.25,58.12,75,68.75,60,66.56,-21.88,10.15,1.25,8.12,25,6.25,10,10.31,0,2,1,1,1,3,1,0,2,2,0,1,0,0,0,0,1,0,0,0,0,0,0,2,1,1,1,2,2,2,0,0,1,0,0,3,2,3,2,1,1,1.6,0.2,0.2,0.6,1.6,0.2,2.2,0.75,1.15,5,2.33,2,3,3,-1,2.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,2,1,-1,0,2,0,-2,0,0,0,1,-1,0,0,-3,-1,-3,-2,-1,0.4,0,0,-2,-0.4 +950,R_3ruEKS7o2pKeasF,60 - 66,Canadian,Male,0,0,1,2,3,-1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,1,1,1,1,1,0,3,1,1,1,0,0,4,1,1,1,1,1,4,0,1,0,1,-2,4,2,2,2,1,1,7,0,0,0,0,0,6,1,0,0,1,1,6,0,0,1,-1,-1,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,77,TRUE,0,73,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,99,FALSE,1,92,FALSE,0,77,TRUE,1,100,TRUE,0,94,TRUE,0,94,FALSE,1,99,FALSE,1,98,TRUE,1,95,TRUE,1,96,TRUE,0,98,TRUE,1,96,TRUE,0,94,TRUE,1,100,TRUE,0,94,FALSE,1,93,TRUE,0,93,FALSE,0,92,TRUE,1,94,TRUE,1,90,0,0,0,0,0.01,0.5329,0.0016,0,0.0004,0.0016,0.8464,0.0001,0,0.0036,0.5929,0,0.9604,1,0.0049,0.8836,0.0025,0.5929,0.0001,0.0064,0.8836,0.8836,0.0036,1,1,0.8836,0.8649,1,0.427128571,0.282135714,0.572121429,25,78.13,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,13,81.25,5,31.25,94.75,94.75,89.88,97,97.38,94.75,94.75,21.88,38.5,32.25,52.38,34.5,34.88,13.5,63.5,1,1,0,1,3,2,2,0,1,1,0,0,0,0,2,1,0,1,0,3,2,2,1,1,2,1,1,1,1,1,0,1,1,0,2,1,1,0,2,2,1.2,1.2,0.4,1,1.6,1,0.8,1.2,0.95,1.15,3.67,6.33,-4,-2,-2,-1,-2.66,10 cents,5 minutes,47 days,Male,High School (or equivalent),60,0.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,-1,-1,-1,0,1,1,1,-1,0,0,0,-1,-1,0,0,0,-1,1,-2,1,-0.4,0.2,-0.4,-0.2,-0.2 +951,R_6V58PWU0Reztyhz,60 - 66,Canadian,Male,1,3,3,-3,-2,-3,-3,3,2,-1,3,-2,3,-3,3,-3,-3,-3,-1,-3,-2,3,1,-1,0,9,1,-3,3,-2,2,3,3,2,3,-2,3,5,2,2,2,2,1,10,1,3,1,-2,2,10,2,-3,3,-3,3,8,3,-3,3,-3,3,0,3,3,3,3,-3,10,FALSE,1,100,FALSE,0,75,TRUE,0,100,FALSE,1,54,TRUE,1,75,FALSE,1,54,TRUE,1,100,TRUE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,1,89,TRUE,0,82,FALSE,0,80,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,94,FALSE,1,100,FALSE,0,93,TRUE,1,100,TRUE,0,59,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,94,FALSE,1,100,TRUE,1,100,TRUE,1,61,TRUE,1,91,0,0,0,0,0.0081,0.2116,0,0,0,0,0,0.0121,0.2401,0.0784,0.0625,0.5625,0.3481,0.2116,0.8836,1,0.8649,0.64,0.8836,0.6724,0.2401,1,0.1521,0,1,0,0,1,0.359703571,0.123928571,0.595478571,27,84.38,21,65.63,4,50,6,75,6,75,5,62.5,13,81.25,8,50,86.72,73.38,76.5,97.75,99.25,88.44,85,18.75,21.09,23.38,1.5,22.75,36.75,7.19,35,3,0,2,2,2,4,0,0,4,3,0,4,0,1,0,5,5,5,3,4,0,0,2,1,4,5,0,0,5,4,0,1,0,0,0,6,6,6,4,0,1.8,2.2,1,4.4,1.4,2.8,0.2,4.4,2.35,2.2,5.67,6,-1,-5,5,0,-0.33,5 cents,100 minutes,15 days,Male,High School (or equivalent),66,1,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,3,0,0,1,-2,-1,0,0,-1,-1,0,3,0,1,0,-1,-1,-1,-1,4,0.4,-0.6,0.8,0,0.15 +952,R_1P7HFMubSLxJSWR,67 - 73,Canadian,Male,3,3,3,3,2,1,-1,3,-3,1,2,2,3,-1,2,0,2,1,2,-2,3,3,3,3,2,0,2,-2,3,-2,3,4,2,2,3,0,2,4,1,1,1,1,-2,4,3,3,3,3,2,0,2,-3,3,-2,3,0,2,2,3,0,2,4,1,1,2,1,-3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,78,TRUE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,100,TRUE,1,99,FALSE,0,86,FALSE,1,79,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,82,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,90,TRUE,0,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.01,0,0,0,0.8649,0,0.7396,1,0,0,0.0169,0.0001,0.0441,0,0,1,0.0484,0,0.5625,0,0.0324,1,1,0.7569,0.5625,0,1,1,1,1,1,0.451010714,0.265285714,0.636735714,30,93.75,18,56.25,6,75,4,50,3,37.5,5,62.5,15,93.75,3,18.75,94.72,89.12,95.88,93.88,100,96.5,92.94,37.5,38.47,14.12,45.88,56.38,37.5,2.75,74.19,0,0,0,0,0,1,1,0,1,2,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,2,0,1,2,0,0,0,1,0,1,1,1,1,1,0,1,0.2,0.6,0,1.2,0.2,1,0.45,0.6,2.67,1.33,0,4,0,0,1.34,10 cents,5 minutes,24 days,Male,University - Undergraduate,73,1.125,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,-0.2,0,-0.4,-0.15 +953,R_3rzpThwNkJJajg5,67 - 73,Canadian,Male,1,3,2,-3,0,-3,-3,3,-3,1,2,1,3,-2,1,-1,1,2,2,-2,2,3,2,-3,0,0,-3,-3,3,-3,1,0,2,1,3,-3,1,0,-2,1,2,1,-2,2,2,3,3,2,-3,4,-3,-2,0,-2,-3,6,2,1,3,-3,1,0,-2,-2,1,0,-2,6,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,50,FALSE,0,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,0,100,TRUE,1,50,0,0,0,0.09,0.25,0,0,1,0,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,1,0.25,0.25,1,0.25,1,0.25,0.25,1,0.375,0.303571429,0.446428571,16,50,20,62.5,6,75,3,37.5,5,62.5,6,75,11,68.75,9,56.25,70.94,56.25,62.5,71.25,93.75,73.12,68.75,-12.5,8.44,-18.75,25,8.75,18.75,4.37,12.5,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,1,5,3,0,1,3,1,4,0,0,0,1,0,1,3,1,2,0,0.2,0,0.2,0.4,2,1.8,0.2,1.4,0.2,1.35,0,3.33,-4,-6,0,-4,-3.33,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,68,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,-1,-5,-3,0,-1,-3,-1,-4,0,0,0,0,0,0,-3,-1,-1,0,-1.8,-1.8,0,-1,-1.15 +954,R_1plDXanV8kNHLlK,67 - 73,Canadian,Male,-2,-1,2,2,2,-3,1,1,-2,-2,2,1,1,-3,2,0,1,1,1,-2,-1,-2,2,0,3,5,-3,1,1,-2,-2,3,-2,1,1,-2,2,2,-2,-1,-1,1,-2,7,-2,-2,2,3,0,4,-3,1,1,0,-2,2,1,1,1,-3,2,2,-2,-2,1,1,-3,7,FALSE,1,98,TRUE,1,92,TRUE,0,93,TRUE,0,53,TRUE,1,53,FALSE,1,97,TRUE,1,53,TRUE,1,92,TRUE,1,55,FALSE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,96,TRUE,0,93,FALSE,0,53,TRUE,1,100,FALSE,1,68,TRUE,0,62,FALSE,1,52,FALSE,1,100,TRUE,1,95,TRUE,1,96,FALSE,1,52,TRUE,1,99,TRUE,0,54,TRUE,1,100,TRUE,0,62,TRUE,0,70,TRUE,0,99,TRUE,1,76,TRUE,1,98,TRUE,1,98,0.0064,0,0,0.2209,0.0004,0.0009,0.0001,0.2809,0,0.0016,0.0576,0.0016,0.2025,0.2209,0.2209,0.0064,0.2304,0.2809,0.49,0.2916,0.0025,0.2809,0.2304,0.8649,0.1024,0.3844,0.0004,0.0004,0.8649,0.3844,0.9801,0.2209,0.235832143,0.107507143,0.364157143,26,81.25,22,68.75,5,62.5,7,87.5,4,50,6,75,14,87.5,8,50,77.12,64.75,82.25,76.12,85.38,81.81,72.44,12.5,8.37,2.25,-5.25,26.12,10.38,-5.69,22.44,1,1,0,2,1,0,0,0,0,0,4,0,0,1,0,2,2,2,0,0,0,1,0,1,2,0,0,0,2,0,1,0,0,0,0,2,3,0,0,1,1,0,1,1.2,0.8,0.4,0.2,1.2,0.8,0.65,3.33,2.67,1,1,0,0,0.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),71,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,1,0,0,1,-1,0,0,0,-2,0,3,0,0,1,0,0,-1,2,0,-1,0.2,-0.4,0.8,0,0.15 +955,R_58HsVEeLBESJcI1,18 - 24,American,Female,1,1,1,1,1,1,0,1,1,1,1,-1,1,1,1,0,-1,-1,-1,-1,1,1,1,1,1,7,-1,0,2,1,0,7,1,1,0,0,1,7,0,0,0,0,0,7,1,1,0,0,2,5,2,0,2,-1,2,5,0,-2,2,0,2,5,2,1,2,2,0,5,FALSE,1,88,TRUE,1,50,TRUE,0,80,FALSE,1,50,TRUE,1,82,FALSE,1,78,TRUE,1,83,TRUE,1,95,TRUE,1,82,TRUE,1,86,FALSE,1,94,TRUE,0,85,TRUE,1,77,TRUE,0,86,FALSE,0,50,TRUE,1,64,TRUE,0,77,TRUE,0,93,FALSE,1,50,FALSE,1,50,FALSE,0,75,TRUE,1,76,TRUE,0,76,TRUE,1,50,FALSE,1,100,FALSE,0,75,FALSE,1,50,TRUE,0,80,TRUE,0,59,FALSE,0,81,FALSE,0,50,TRUE,1,100,0.0025,0.5625,0.1296,0.0289,0,0.0484,0.25,0.0196,0.25,0.0576,0.6561,0.0529,0.0324,0.0036,0.0324,0.25,0.5776,0.25,0.64,0,0.5625,0.25,0.25,0.7396,0.5929,0.25,0.25,0.0144,0.64,0.8649,0.3481,0.7225,0.307339286,0.177185714,0.437492857,17,53.13,19,59.38,6,75,4,50,5,62.5,4,50,11,68.75,8,50,74.12,59.5,78,85.88,73.12,73.5,74.75,-6.25,14.74,-15.5,28,23.38,23.12,4.75,24.75,0,0,0,0,0,2,0,1,0,1,0,2,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,2,1,1,1,1,1,1,2,2,3,3,1,0,0.8,0.8,0.8,0.6,1,1,2.2,0.6,1.2,7,5,2,2,2,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,24,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,-1,-1,-1,1,0,0,-2,0,-1,1,0,0,-1,-2,-1,-2,-2,0,-0.6,-0.2,-0.2,-1.4,-0.6 +956,R_62OCFs2732b3GKJ,67 - 73,Canadian,Male,-3,3,3,0,3,-3,-2,2,-2,0,3,2,3,3,3,1,2,2,2,-3,-3,3,3,0,3,0,-3,-2,3,-2,2,0,3,3,3,3,3,0,0,2,1,1,-3,0,-3,3,3,0,2,0,-3,-2,3,-2,2,0,3,3,3,3,3,0,2,1,2,3,-3,0,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0.25,0,1,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.25,0,0.25,0.25,1,1,1,0.25,1,0.383928571,0.214285714,0.553571429,13,40.63,18,56.25,5,62.5,5,62.5,2,25,6,75,8,50,10,62.5,68.75,56.25,62.5,68.75,87.5,68.75,68.75,-15.62,12.5,-6.25,0,43.75,12.5,18.75,6.25,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,2,0,1,0,0,0,1,1,0,1,0,0,0.6,0.2,0.6,0.2,0.6,0.2,0.6,0.35,0.4,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,67,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,-0.2,0,0,0,-0.05 +957,R_1tEglXSyMh9qA5o,39 - 45,Canadian,Male,2,2,1,3,2,1,-3,3,-2,2,3,1,3,1,2,-3,-1,-2,-3,-3,3,3,3,3,3,1,-2,-3,-3,-2,2,3,1,1,2,-1,3,4,-3,-3,-3,-3,-3,6,3,2,1,3,2,3,1,-3,3,-2,3,2,3,1,3,3,2,1,1,3,3,3,-2,8,FALSE,1,100,FALSE,0,71,TRUE,0,91,TRUE,0,64,TRUE,1,55,FALSE,1,56,TRUE,1,100,TRUE,1,89,TRUE,1,84,TRUE,1,100,FALSE,1,53,TRUE,0,89,FALSE,0,96,FALSE,1,88,TRUE,1,72,TRUE,1,99,FALSE,1,58,TRUE,0,91,FALSE,1,99,FALSE,1,100,FALSE,0,99,TRUE,1,100,FALSE,1,65,FALSE,0,72,FALSE,1,62,TRUE,1,87,TRUE,0,80,FALSE,1,71,FALSE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,0.0121,0.0169,0.0001,0,0,0.1936,0.5184,0,0,0,0,0.9216,0.0256,0.2209,0.2025,0.5041,0.1225,0.4096,0.0841,0.1444,0.9801,0.0784,0.0001,0.0144,0.1764,0.64,0.0036,0,0.8281,0.8281,0,0.7921,0.274592857,0.222771429,0.326414286,20,62.5,23,71.88,5,62.5,6,75,7,87.5,5,62.5,12,75,11,68.75,83.91,77.12,78.62,91,88.88,88.62,79.19,-9.38,12.03,14.62,3.62,3.5,26.38,13.62,10.44,1,1,2,0,1,3,0,6,0,0,2,0,1,2,1,0,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,2,0,4,4,5,6,1,1,1.8,1.2,0.6,0.2,0.2,0.4,4,1.15,1.2,2.67,2,-2,1,3,-2,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,39,1.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,1,2,0,1,3,0,6,0,-1,2,0,1,0,1,-4,-2,-4,-6,-1,0.8,1.6,0.8,-3.4,-0.05 +958,R_34TAmNpBoVjFjsR,67 - 73,Canadian,Male,-3,1,3,0,-2,-2,-2,3,-1,1,3,2,3,-1,3,1,1,2,2,0,-3,2,3,3,-3,0,-2,-1,3,2,2,0,3,3,3,2,3,4,1,1,2,1,0,8,-3,2,3,3,-2,5,-2,-2,3,-1,2,6,3,3,3,-1,3,5,3,1,3,3,0,7,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,78,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,59,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,87,TRUE,1,100,TRUE,0,79,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.25,0,0,0.0484,0.16,0.25,0,0.25,0,0,0.7569,0,0.0196,1,0,0.1681,0.6241,0.25,1,1,1,1,1,0.313467857,0.068457143,0.558478571,25,78.13,23,71.88,6,75,7,87.5,4,50,6,75,15,93.75,8,50,89.03,81.62,82.38,92.12,100,88.38,89.69,6.25,17.15,6.62,-5.12,42.12,25,-5.37,39.69,0,1,0,3,1,0,1,0,3,1,0,1,0,3,0,0,0,0,1,0,0,1,0,3,0,0,0,0,0,1,0,1,0,0,0,2,0,1,1,0,1,1,0.8,0.2,0.8,0.2,0.2,0.8,0.75,0.5,1.33,5.33,-5,-6,-1,1,-4,10 cents,5 minutes,24 days,Male,High School (or equivalent),68,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,1,0,1,0,3,0,0,0,0,3,0,-2,0,-1,0,0,0.2,0.8,0.6,-0.6,0.25 +959,R_5UBRUCddWy4RBzH,18 - 24,American,Male,2,1,2,0,2,-1,0,0,1,0,0,1,1,0,0,-2,-2,-2,-2,-3,1,1,1,0,1,9,-2,0,0,0,0,8,0,0,0,0,0,9,-1,-1,-1,-1,-3,8,2,2,2,0,2,5,0,0,0,0,0,8,0,2,1,0,0,7,0,0,0,0,1,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,62,FALSE,1,100,FALSE,0,52,TRUE,1,100,FALSE,1,58,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,70,FALSE,1,50,FALSE,1,100,TRUE,0,71,FALSE,0,64,TRUE,1,72,TRUE,1,78,0,0.49,0,0,0.0484,0.25,0,0.04,0,0,0.4096,0.1444,0.16,0.25,0,0,0,0.25,0,0,0,0.2704,0,0,0.1764,0.25,0.0784,0,0,0,0.5041,0.25,0.110060714,0.110885714,0.109235714,16,50,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,13,81.25,15,93.75,81.78,66.75,77.38,93.75,89.25,83.62,79.94,-37.5,-5.72,-20.75,-10.12,6.25,1.75,2.37,-13.81,1,0,1,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,2,2,2,2,4,0.6,0.4,0.4,0.8,0.2,0.4,0.2,2.4,0.55,0.8,8.67,6.67,4,0,2,1,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),23,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,1,-1,1,0,1,0,0,0,0,0,0,0,1,0,0,-1,-1,-1,-1,-4,0.4,0,0.2,-1.6,-0.25 +960,R_7GKtwk4AIdHKva9,18 - 24,American,Male,-1,3,3,2,2,2,-1,2,-1,2,3,1,2,-1,2,2,2,3,3,2,0,-1,3,1,3,8,1,1,-1,1,-1,7,3,2,1,2,1,7,2,1,-1,3,2,5,1,3,2,2,3,7,3,-2,2,0,3,2,3,3,3,1,3,7,2,1,3,2,3,6,FALSE,1,96,TRUE,1,100,FALSE,1,80,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,70,TRUE,1,75,TRUE,1,100,FALSE,1,65,TRUE,0,100,TRUE,1,100,FALSE,1,65,TRUE,1,88,TRUE,1,100,TRUE,0,90,TRUE,0,100,FALSE,1,56,TRUE,0,63,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,83,TRUE,1,76,FALSE,1,65,TRUE,0,100,TRUE,0,85,FALSE,0,100,FALSE,0,68,TRUE,1,80,0.09,0.0576,0,0,0.04,1,0.09,0,0.3969,0,1,0,0.0625,0.1225,0,0,0,0.7225,1,0.6889,0.5625,0.0144,0.1936,0.1225,0.81,0.1225,0.4624,0.0016,0.04,1,0.7225,1,0.363403571,0.245314286,0.481492857,18,56.25,20,62.5,6,75,4,50,6,75,4,50,13,81.25,7,43.75,85.47,75.25,91.25,90,85.38,87.62,83.31,-6.25,22.97,0.25,41.25,15,35.38,6.37,39.56,1,4,0,1,1,1,2,3,2,3,0,1,1,3,1,0,1,4,0,0,2,0,1,0,1,1,1,0,1,1,0,2,1,2,1,0,1,0,1,1,1.4,2.2,1.2,1,0.8,0.8,1.2,0.6,1.45,0.85,7.33,5.33,1,5,0,-1,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-1,4,-1,1,0,0,1,3,1,2,0,-1,0,1,0,0,0,4,-1,-1,0.6,1.4,0,0.4,0.6 +961,R_7BDrO6b7AbW3qiB,18 - 24,American,Male,1,2,2,-2,-1,1,1,-1,2,3,-2,-3,2,1,2,1,-1,-1,0,0,2,1,3,-2,2,6,1,-2,-3,-1,-2,7,-3,1,1,2,1,6,0,-2,-1,1,-3,4,1,2,1,0,0,5,1,2,1,0,2,5,-3,-3,3,0,2,5,0,0,0,0,2,5,TRUE,0,99,FALSE,0,65,TRUE,0,98,FALSE,1,55,TRUE,1,96,FALSE,1,67,TRUE,1,66,FALSE,0,66,FALSE,0,57,TRUE,1,80,FALSE,1,50,TRUE,0,76,TRUE,1,83,FALSE,1,91,TRUE,1,50,TRUE,1,71,FALSE,1,95,TRUE,0,97,TRUE,0,70,FALSE,1,56,FALSE,0,55,TRUE,1,90,TRUE,0,54,TRUE,1,70,TRUE,0,59,TRUE,1,88,TRUE,0,50,FALSE,1,73,TRUE,0,50,FALSE,0,65,FALSE,0,53,TRUE,1,90,0.4356,0.0144,0.0841,0.1156,0.01,0.1089,0.09,0.04,0.1936,0.01,0.4225,0.0289,0.3249,0.25,0.0016,0.4225,0.2916,0.2025,0.0729,0.3481,0.3025,0.25,0.49,0.0081,0.0025,0.25,0.2809,0.9801,0.9604,0.9409,0.25,0.5776,0.289678571,0.171214286,0.408142857,16,50,17,53.13,3,37.5,5,62.5,5,62.5,4,50,10,62.5,7,43.75,71.41,56.25,73.75,83.75,71.88,71.56,71.25,-3.13,18.28,18.75,11.25,21.25,21.88,9.06,27.5,1,1,1,0,3,0,3,2,3,5,1,4,1,1,1,1,1,0,1,3,0,0,1,2,1,0,1,2,2,1,1,0,1,1,0,1,1,1,0,2,1.2,2.6,1.6,1.2,0.8,1.2,0.6,1,1.65,0.9,6.33,5,1,2,1,-1,1.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,1,0,-2,2,0,2,0,1,4,0,4,0,0,1,0,0,-1,1,1,0.4,1.4,1,0.2,0.75 +962,R_6H2c8x72JVggldp,18 - 24,American,Female,3,3,3,3,3,1,0,2,2,3,2,-2,3,2,3,1,0,1,1,0,3,3,3,3,3,0,3,-2,1,-2,3,3,3,-1,1,3,3,2,0,2,2,0,0,7,3,3,3,3,3,0,3,-2,3,-2,3,5,2,-3,3,2,3,2,3,3,3,3,-2,8,FALSE,1,65,TRUE,1,50,TRUE,0,95,FALSE,1,50,TRUE,1,75,FALSE,1,65,TRUE,1,85,FALSE,0,50,TRUE,1,60,TRUE,1,95,FALSE,1,50,TRUE,0,98,TRUE,1,80,FALSE,1,63,TRUE,1,61,TRUE,1,80,TRUE,0,50,TRUE,0,90,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,80,TRUE,1,50,TRUE,1,80,0.25,0.0025,0.04,0.0225,0.04,0.1225,0,0.0025,0.25,0.0004,0.04,0.04,0.16,0.25,0.0625,0.25,0,0.25,0.25,0,0.25,0.1521,0.25,0.1369,0.25,0.25,0.25,0.1225,0.9025,0.81,1,0.9604,0.251867857,0.10485,0.398885714,19,59.38,24,75,7,87.5,6,75,7,87.5,4,50,15,93.75,9,56.25,72.34,52.62,75,86.38,75.38,74.31,70.38,-15.62,-2.66,-34.88,0,-1.12,25.38,-19.44,14.13,0,0,0,0,0,2,2,1,4,0,1,1,2,1,0,1,2,1,1,0,0,0,0,0,0,2,2,1,4,0,0,1,0,0,0,2,3,2,2,2,0,1.8,1,1,0,1.8,0.2,2.2,0.95,1.05,1.67,2.33,0,-2,0,-1,-0.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),20,0.875,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,1,0,2,1,0,-1,-1,-1,-1,-2,0,0,0.8,-1.2,-0.1 +963,R_7VJC3dAZp5t5i8H,18 - 24,American,Male,0,3,0,0,1,-2,0,0,0,0,0,-2,1,0,2,-2,0,-3,1,-3,-2,1,3,-1,0,5,0,0,0,0,0,5,0,0,-1,-1,-1,4,1,2,2,1,-3,9,0,3,1,1,1,5,-2,0,1,0,0,4,0,0,1,0,2,5,-1,0,-1,0,-3,5,TRUE,0,63,FALSE,0,57,TRUE,0,62,FALSE,1,54,FALSE,0,53,FALSE,1,60,TRUE,1,72,TRUE,1,68,TRUE,1,63,FALSE,0,55,FALSE,1,53,TRUE,0,53,TRUE,1,61,FALSE,1,54,TRUE,1,66,TRUE,1,100,TRUE,0,57,FALSE,1,55,FALSE,1,55,FALSE,1,61,TRUE,1,75,TRUE,1,73,TRUE,0,68,FALSE,0,61,FALSE,1,58,TRUE,1,81,FALSE,1,71,FALSE,1,85,FALSE,1,77,FALSE,0,69,FALSE,0,56,TRUE,1,97,0.1024,0.0361,0,0.0784,0.0009,0.16,0.3721,0.3025,0.1521,0.0729,0.4761,0.1521,0.1369,0.2209,0.2809,0.3249,0.4624,0.2116,0.0225,0.1764,0.0625,0.1156,0.2025,0.2116,0.3249,0.0841,0.3136,0.3969,0.3844,0.2025,0.0529,0.2809,0.219914286,0.237592857,0.202235714,11,34.38,21,65.63,6,75,5,62.5,6,75,4,50,10,62.5,11,68.75,65.41,59.38,68.5,63.88,69.88,69.19,61.62,-31.25,-0.22,-15.62,6,-11.12,19.88,6.69,-7.13,2,2,3,1,1,2,0,0,0,0,0,2,2,1,3,3,2,5,0,0,0,0,1,1,0,0,0,1,0,0,0,2,0,0,0,1,0,2,1,0,1.8,0.4,1.6,2,0.4,0.2,0.4,0.8,1.45,0.45,4.67,4.67,0,1,-1,4,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,19,0.5,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,2,2,0,1,2,0,-1,0,0,0,0,2,1,3,2,2,3,-1,0,1.4,0.2,1.2,1.2,1 +964,R_7r6L1MPWM8BL8Wv,32 - 38,Canadian,Male,2,2,2,1,-2,1,-1,0,-1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,7,1,1,1,0,1,7,1,1,1,0,1,8,1,1,1,1,2,7,0,0,0,0,0,5,0,0,0,0,0,7,1,0,0,1,1,7,1,1,1,1,1,6,TRUE,0,81,TRUE,1,80,TRUE,0,75,TRUE,0,75,TRUE,1,76,TRUE,0,88,TRUE,1,75,TRUE,1,90,TRUE,1,79,TRUE,1,83,TRUE,0,86,TRUE,0,83,TRUE,1,83,TRUE,0,84,TRUE,1,79,TRUE,1,75,TRUE,0,86,TRUE,0,89,TRUE,0,88,TRUE,0,84,TRUE,1,81,TRUE,1,91,TRUE,0,83,TRUE,1,93,TRUE,0,79,TRUE,1,87,TRUE,0,83,TRUE,0,87,TRUE,0,80,TRUE,1,94,TRUE,1,90,TRUE,1,92,0.01,0.0169,0.0625,0.0625,0.0064,0.7744,0.0049,0.0289,0.7056,0.0081,0.0036,0.0289,0.0441,0.7396,0.0576,0.04,0.6889,0.5625,0.7569,0.6241,0.0361,0.0441,0.7744,0.7056,0.7396,0.6889,0.01,0.6561,0.5625,0.7921,0.64,0.6889,0.4076,0.263821429,0.551378571,16,50,16,50,4,50,4,50,4,50,4,50,16,100,0,0,83.72,82.5,83.62,83.62,85.12,84.25,83.19,0,33.72,32.5,33.62,33.62,35.12,-15.75,83.19,1,2,1,1,3,0,2,1,1,0,0,0,0,1,0,0,0,0,0,1,2,2,2,1,2,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,1.6,0.8,0.2,0.2,1.8,0.8,0.4,0,0.7,0.75,7.33,6.33,2,0,1,1,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,37,0.125,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,0,-1,0,1,-1,1,1,0,-1,0,-1,-1,1,0,0,0,0,0,1,-0.2,0,-0.2,0.2,-0.05 +965,R_5l8R2oWrQLP0fHr,39 - 45,Canadian,Male,1,0,2,2,-1,-3,-1,2,0,0,-2,-3,3,1,3,-3,-3,-3,-3,-3,0,0,3,1,-3,1,-3,-3,1,-2,-1,6,1,-2,1,2,3,6,-3,-3,-3,-3,-3,5,1,0,2,3,-1,1,-3,-1,3,-1,1,3,-3,-3,3,0,3,2,-3,-3,-3,-3,-3,2,FALSE,1,78,TRUE,1,63,FALSE,1,69,FALSE,1,73,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,87,TRUE,1,100,TRUE,1,100,FALSE,1,59,FALSE,1,69,TRUE,1,73,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,63,TRUE,0,90,FALSE,1,65,FALSE,1,78,TRUE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,76,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,65,TRUE,0,100,TRUE,1,100,TRUE,1,81,TRUE,1,100,0.0169,0,0,0,0,0,0.0576,0,0.0484,0.0225,0,0.0729,0,0.1681,0,0.1369,0,0.0729,0.1225,0,0,0.0225,0.1225,0,0.1369,0.2809,0.0361,0.0484,0.0961,0.81,1,0.0961,0.119689286,0.041378571,0.198,27,84.38,29,90.63,7,87.5,7,87.5,7,87.5,8,100,16,100,13,81.25,84.75,72.38,92,94.12,80.5,90.62,78.88,-6.25,-5.88,-15.12,4.5,6.62,-19.5,-9.38,-2.37,1,0,1,1,2,0,2,1,2,1,3,1,2,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,1,1.2,1.4,0,0.2,0.6,0.4,0,0.9,0.3,4.33,2,0,3,4,3,2.33,10 cents,5 minutes,47 days,Male,University - Undergraduate,39,1.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,02REV,1,0,1,0,2,0,2,0,1,0,2,1,2,0,0,0,0,0,0,0,0.8,0.6,1,0,0.6 +966,R_53dWX4p2nUU2svX,32 - 38,Canadian,Male,1,2,2,0,2,-1,-2,0,-2,-1,1,1,1,-1,1,1,1,1,1,1,1,2,2,0,2,3,-2,-2,1,-2,0,5,1,1,1,-2,1,3,1,1,1,1,1,3,1,1,2,0,2,5,-1,-1,0,1,0,5,1,1,1,-1,1,4,1,2,1,1,2,5,FALSE,1,50,FALSE,0,65,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,72,TRUE,1,69,FALSE,0,50,TRUE,1,75,FALSE,1,71,TRUE,0,75,TRUE,1,76,FALSE,1,50,FALSE,0,53,TRUE,1,72,FALSE,1,57,TRUE,0,67,FALSE,1,50,TRUE,0,70,FALSE,0,65,FALSE,0,61,FALSE,1,62,TRUE,1,74,TRUE,0,69,TRUE,1,67,FALSE,1,63,FALSE,1,66,FALSE,1,62,TRUE,1,65,FALSE,0,56,TRUE,1,80,0.0961,0.1089,0.0784,0.0784,0.04,0.25,0.0676,0.0625,0.49,0.3721,0.1225,0.0576,0.25,0.0841,0.25,0.4225,0.1444,0.25,0.1156,0.4761,0.4225,0.2809,0.25,0.25,0.1849,0.1369,0.3136,0.25,0.25,0.4489,0.1444,0.5625,0.2482,0.204521429,0.291878571,16,50,21,65.63,4,50,6,75,5,62.5,6,75,9,56.25,12,75,62.88,57.25,62.75,63.88,67.62,65.62,60.12,-15.63,-2.75,7.25,-12.25,1.38,-7.38,9.37,-14.88,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,3,1,0,0,0,0,0,0,1,0,0,1,0,0.6,0.2,0,0.2,1,0,0.4,0.2,0.4,3.67,4.67,-2,0,-1,-2,-1,10 cents,100 minutes,36 days,Male,College Diploma/Certificate,34,-0.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,-1,0,0,0,1,-1,1,-3,0,0,0,0,1,0,0,-1,0,0,-1,-0.2,-0.4,0.2,-0.4,-0.2 +967,R_7rfzIX6Dhq7YeKq,32 - 38,Canadian,Male,2,3,2,2,3,2,-2,2,-2,3,2,3,2,2,3,1,1,1,1,-2,3,1,2,2,1,8,2,0,1,2,1,7,3,1,1,2,3,7,-1,-1,0,-3,-2,7,1,3,2,2,3,4,1,-3,3,-3,3,9,2,3,2,2,3,4,3,2,2,2,-1,4,FALSE,1,56,TRUE,1,69,TRUE,0,100,TRUE,0,67,FALSE,0,59,TRUE,0,75,TRUE,1,85,TRUE,1,100,TRUE,1,86,TRUE,1,84,FALSE,1,69,TRUE,0,90,FALSE,0,75,FALSE,1,74,TRUE,1,89,TRUE,1,85,TRUE,0,100,FALSE,1,100,FALSE,1,67,FALSE,1,80,FALSE,0,62,TRUE,1,74,FALSE,1,90,FALSE,0,69,FALSE,1,100,FALSE,0,80,FALSE,1,56,TRUE,0,79,FALSE,1,61,TRUE,1,60,FALSE,0,85,FALSE,0,100,0,0.64,0.0225,0.0225,1,0.5625,0.4761,0.0256,0.04,0.0676,0.16,0.5625,0.0196,0.0961,0.3481,0.0961,0.01,0.4489,0.6241,0,0.3844,0.0121,0.1089,0.0676,1,0.1936,0.7225,0.1936,1,0,0.1521,0.81,0.327928571,0.279507143,0.37635,16,50,19,59.38,6,75,2,25,7,87.5,4,50,9,56.25,10,62.5,78.94,73.5,77.75,81.62,82.88,78.88,79,-9.38,19.56,-1.5,52.75,-5.88,32.88,22.63,16.5,1,2,0,0,2,0,2,1,4,2,1,2,1,0,0,2,2,1,4,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,2,1,1,1,1,1,1.8,0.8,1.8,0.2,0.8,0,1.2,1.35,0.55,7.33,5.67,4,-2,3,3,1.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),34,1.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,2,0,0,2,-1,1,0,3,2,1,2,1,0,0,0,1,0,3,-1,0.8,1,0.8,0.6,0.8 +968,R_1njzHccnsMcDWUe,32 - 38,American,Male,-1,1,3,-2,2,-3,-1,1,3,-2,3,2,2,2,2,-3,-2,-3,-3,-3,2,1,3,2,2,8,2,2,2,2,2,8,2,-1,-1,2,2,9,2,2,-1,2,1,10,3,2,3,2,-1,9,-3,-3,3,3,-3,8,3,3,3,3,3,8,-3,-2,-3,-3,-3,10,TRUE,0,53,TRUE,1,55,FALSE,1,84,FALSE,1,54,FALSE,0,52,FALSE,1,100,TRUE,1,83,TRUE,1,64,FALSE,0,55,TRUE,1,79,FALSE,1,51,FALSE,1,53,TRUE,1,100,FALSE,1,54,FALSE,0,52,TRUE,1,100,TRUE,0,100,TRUE,0,53,FALSE,1,62,TRUE,0,55,FALSE,0,100,TRUE,1,77,FALSE,1,100,TRUE,1,52,TRUE,0,52,TRUE,1,55,TRUE,0,55,FALSE,1,50,FALSE,1,50,TRUE,1,66,FALSE,0,59,TRUE,1,100,0.1296,0.2025,0,0.0289,0,0,0.2304,0.0441,0.3025,0.0529,0.1156,0,0.3025,0.2401,0.2704,0.2025,0,0.2116,0.25,0.2704,1,0.2704,0.1444,0.2116,1,0.3025,0.3481,0.2809,0.0256,0.2809,0.25,0.2209,0.243867857,0.1409,0.346835714,8,25,21,65.63,4,50,5,62.5,5,62.5,7,87.5,11,68.75,10,62.5,67.97,55.38,87.75,63.25,65.5,71.81,64.12,-40.63,2.34,5.38,25.25,0.75,-22,3.06,1.62,3,0,0,4,0,5,3,1,1,4,1,3,3,0,0,5,4,2,5,4,4,1,0,4,3,0,2,2,0,1,0,1,1,1,1,0,0,0,0,0,1.4,2.8,1.4,4,2.4,1,0.8,0,2.4,1.05,8.33,8.33,-1,0,1,0,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,38,1.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,-1,-1,0,0,-3,5,1,-1,1,3,1,2,2,-1,-1,5,4,2,5,4,-1,1.8,0.6,4,1.35 +969,R_7BrnO4eAWl04uwP,60 - 66,American,Male,-2,3,3,3,-1,-2,-3,-2,-2,-2,1,2,1,-1,1,-2,-2,-2,-1,-2,0,3,2,2,0,4,1,1,0,0,0,7,-1,1,2,1,0,6,-1,-2,-1,-1,-2,5,-3,3,3,3,-1,1,-2,-2,0,-1,-2,3,1,3,1,-2,1,0,-3,-3,-2,-2,-2,0,FALSE,1,75,FALSE,0,84,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,85,TRUE,1,95,TRUE,1,100,TRUE,1,71,TRUE,1,63,FALSE,1,50,TRUE,0,92,TRUE,1,89,TRUE,0,89,FALSE,0,50,TRUE,1,88,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,95,TRUE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,91,FALSE,0,83,TRUE,0,90,FALSE,1,86,TRUE,0,58,TRUE,1,62,TRUE,1,100,TRUE,1,100,0,0.6889,0.0144,0.0025,0,0.0225,0.0025,0.1369,0.0025,0,0.1444,0.0121,0.0841,0.25,0,0.7056,0,0.25,0.0196,0.8281,0.2401,0.25,0.25,0.7921,0.25,0.81,0,0.0625,0,0.25,0.3364,0.8464,0.233778571,0.115042857,0.352514286,16,50,24,75,5,62.5,7,87.5,5,62.5,7,87.5,13,81.25,11,68.75,79.44,68.12,79.12,80.75,89.75,83.19,75.69,-25,4.44,5.62,-8.38,18.25,2.25,1.94,6.94,2,0,1,1,1,3,4,2,2,2,2,1,1,2,1,1,0,1,0,0,1,0,0,0,0,0,1,2,1,0,0,1,0,1,0,1,1,0,1,0,1,2.6,1.4,0.4,0.2,0.8,0.4,0.6,1.35,0.5,5.67,1.33,3,4,6,5,4.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,1,0,1,1,1,3,3,0,1,2,2,0,1,1,1,0,-1,1,-1,0,0.8,1.8,1,-0.2,0.85 +970,R_1soecjnBRZ7oNeX,32 - 38,American,Male,3,2,2,-1,3,-1,3,1,0,3,1,-2,1,2,3,1,1,3,3,0,-2,-1,-2,-2,-2,9,-1,2,0,0,0,4,3,0,3,0,1,6,3,3,3,-1,0,1,2,2,1,-2,3,5,-2,-2,0,0,3,2,1,-1,1,0,2,3,3,2,3,3,0,0,TRUE,0,100,FALSE,0,73,TRUE,0,69,FALSE,1,90,TRUE,1,85,FALSE,1,100,TRUE,1,93,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,93,TRUE,0,88,FALSE,0,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,TRUE,0,61,TRUE,0,100,FALSE,1,67,FALSE,1,100,FALSE,0,56,TRUE,1,100,TRUE,0,69,TRUE,1,97,FALSE,1,50,TRUE,1,86,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,0,54,FALSE,0,51,TRUE,1,100,0.01,0.0196,0,0.0049,0,0,0.0009,0,0,0,0.2916,1,0,0.8649,0.0225,0.5329,0.4761,0.01,0,0.25,0.3136,0.1681,0.1089,0,0.3721,0.25,0.2601,1,0.4761,1,1,0.7744,0.327578571,0.228492857,0.426664286,22,68.75,19,59.38,5,62.5,3,37.5,6,75,5,62.5,11,68.75,8,50,83.78,72.88,83.88,91.12,87.25,84,83.56,9.37,24.4,10.38,46.38,16.12,24.75,15.25,33.56,5,3,4,1,5,0,1,1,0,3,2,2,2,2,2,2,2,0,4,0,1,0,1,1,0,1,5,1,0,0,0,1,0,2,1,2,1,0,0,0,3.6,1,2,1.6,0.6,1.4,0.8,0.6,2.05,0.85,6.33,3.33,4,2,3,1,3,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,33,0.75,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,4,3,3,0,5,-1,-4,0,0,3,2,1,2,0,1,0,1,0,4,0,3,-0.4,1.2,1,1.2 +971,R_5kum2RlXl1Pxv4g,32 - 38,American,Male,1,1,2,1,3,-2,-3,3,-1,-1,3,3,1,1,3,1,1,1,2,-3,1,2,3,1,3,8,0,1,2,1,2,9,3,3,1,2,2,8,1,1,1,1,1,9,1,2,2,1,3,1,-2,-1,1,1,2,10,3,3,1,1,3,10,2,2,1,1,2,9,FALSE,1,59,FALSE,0,56,TRUE,0,92,FALSE,1,50,FALSE,0,61,FALSE,1,52,TRUE,1,90,TRUE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,68,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,0,84,TRUE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,64,TRUE,1,100,0,0,0,0.01,0,0.2304,0,0,0.25,0,0,0,0.2704,0.8281,0.3721,0.3136,0.7056,0.25,1,0.7225,0,0.4624,1,1,1,0.25,0.4096,0.1681,0.8464,1,1,1,0.467114286,0.230014286,0.704214286,20,62.5,16,50,2,25,4,50,5,62.5,5,62.5,11,68.75,5,31.25,84.5,66.38,87.12,91.75,92.75,86.94,82.06,12.5,34.5,41.38,37.12,29.25,30.25,18.19,50.81,0,1,1,0,0,2,4,1,2,3,0,0,0,1,1,0,0,0,1,4,0,1,0,0,0,0,2,2,2,3,0,0,0,0,0,1,1,0,1,5,0.4,2.4,0.4,1,0.2,1.8,0,1.6,1.05,0.9,8.33,7,7,-1,-2,0,1.33,5 cents,5 minutes,36 days,Male,College Diploma/Certificate,33,-0.125,1,1,0,0,0,0,0.67,0,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,1,0,0,2,2,-1,0,0,0,0,0,1,1,-1,-1,0,0,-1,0.2,0.6,0.4,-0.6,0.15 +972,R_7hQpBSC0FLY69a6,46 - 52,American,Male,3,3,3,2,2,-2,2,0,3,1,-1,-1,2,-1,3,-2,-1,-1,-2,-2,3,3,3,2,3,2,0,2,-1,1,2,5,-2,-2,2,-2,3,3,-1,0,1,-1,0,8,3,3,3,2,2,3,-1,0,1,-2,2,5,-1,-1,3,-1,3,7,2,2,2,2,1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,50,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,0,75,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,59,TRUE,1,95,FALSE,1,100,FALSE,1,97,TRUE,0,100,TRUE,1,92,FALSE,0,70,TRUE,1,100,0,0.0025,0,0,0,0.04,0,1,0,0,0.0064,0,0,0.25,0,0,0,0.25,0.0009,0.3481,0.25,0.0576,0.5625,0,0.0784,0,0.49,0,1,1,1,0.9604,0.260510714,0.110457143,0.410564286,26,81.25,23,71.88,6,75,6,75,5,62.5,6,75,13,81.25,10,62.5,89.5,77.62,87.75,94.25,98.38,92.69,86.31,9.37,17.62,2.62,12.75,31.75,23.38,11.44,23.81,0,0,0,0,1,2,0,1,2,1,1,1,0,1,0,1,1,2,1,2,0,0,0,0,0,1,2,1,5,1,0,0,1,0,0,4,3,3,4,3,0.2,1.2,0.6,1.4,0,2,0.2,3.4,0.85,1.4,3.33,5,-1,0,-4,0,-1.67,10 cents,5 minutes,15 days,Male,High School (or equivalent),46,1.375,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,1,1,-2,0,-3,0,1,1,-1,1,0,-3,-2,-1,-3,-1,0.2,-0.8,0.4,-2,-0.55 +973,R_6zwj7FoNzv6n4el,60 - 66,American,Male,1,3,2,2,3,1,-1,2,-1,1,2,1,2,0,2,2,2,2,2,2,0,3,2,1,3,1,1,-1,2,-1,2,2,2,2,2,-1,3,2,2,2,2,2,2,2,1,3,2,2,3,1,1,-1,2,-1,1,2,2,1,2,-1,2,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,80,FALSE,1,80,TRUE,1,80,FALSE,1,85,TRUE,1,95,TRUE,1,80,TRUE,1,80,TRUE,1,100,FALSE,1,85,TRUE,0,100,TRUE,1,85,FALSE,1,70,TRUE,1,85,TRUE,1,100,FALSE,1,80,TRUE,0,100,FALSE,1,65,FALSE,1,100,TRUE,1,75,FALSE,0,71,FALSE,1,65,TRUE,1,60,FALSE,1,75,TRUE,1,75,FALSE,1,60,FALSE,1,95,TRUE,0,54,FALSE,0,50,TRUE,1,55,TRUE,1,85,0.04,0.0625,0,0.0025,0.0225,0.0225,0.16,0,0,0.5041,0.25,0.0225,0.04,0.0225,0.04,0,0.1225,0.04,0.0025,0.0625,0.0625,0.0225,0.1225,0.09,0.04,0.16,0.2025,1,0.64,1,0.2916,1,0.212257143,0.089042857,0.335471429,18,56.25,25,78.13,8,100,7,87.5,5,62.5,5,62.5,14,87.5,11,68.75,80.31,76.25,76.12,85.75,83.12,79.75,80.88,-21.88,2.18,-23.75,-11.38,23.25,20.62,-7.75,12.13,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.4,0.2,0.6,0,0,0,0.2,0,0.3,0.05,1.67,1.67,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0.4,0.2,0.4,0,0.25 +974,R_7tYy85r3076itb3,39 - 45,American,Male,1,2,2,-1,2,-1,0,1,0,1,1,1,2,2,2,-1,-1,-1,-1,-1,1,1,1,-1,-1,3,-2,1,1,1,0,3,0,1,1,-1,1,3,-1,-1,-1,-1,-1,2,1,1,1,0,1,3,0,-1,1,0,1,3,1,1,2,0,3,2,-1,-1,-1,-1,-1,4,TRUE,0,67,TRUE,1,74,TRUE,0,80,FALSE,1,62,TRUE,1,62,FALSE,1,72,TRUE,1,72,TRUE,1,72,FALSE,0,56,TRUE,1,88,FALSE,1,70,FALSE,1,60,TRUE,1,84,FALSE,1,68,FALSE,0,58,TRUE,1,85,FALSE,1,58,TRUE,0,66,TRUE,0,68,FALSE,1,80,TRUE,1,73,TRUE,1,75,FALSE,1,85,TRUE,1,58,FALSE,1,73,TRUE,1,78,FALSE,1,55,FALSE,1,63,TRUE,0,60,TRUE,1,65,FALSE,0,63,TRUE,1,72,0.0784,0.0484,0.0225,0.0784,0.0784,0.0784,0.1764,0.0144,0.04,0.0625,0.1225,0.0256,0.3136,0.09,0.1444,0.0676,0.0225,0.1444,0.1369,0.0729,0.0729,0.3364,0.4624,0.1024,0.1764,0.2025,0.3969,0.4489,0.64,0.4356,0.36,0.16,0.192317857,0.098621429,0.286014286,24,75,24,75,4,50,7,87.5,6,75,7,87.5,13,81.25,11,68.75,69.44,63.25,70.75,73.38,70.38,70.94,67.94,0,-5.56,13.25,-16.75,-1.62,-17.12,-10.31,-0.81,0,1,1,0,3,1,1,0,1,1,1,0,1,3,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,2,1,0,0,0,0,0,1,0.8,1.2,0,0.8,0.4,0.6,0,0.75,0.45,3,2.67,0,0,1,-2,0.33,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,44,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,-1,2,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0.2,0.4,0.6,0,0.3 +975,R_5qIt91B3oLYyRHh,39 - 45,American,Male,3,3,3,2,3,-3,3,3,-3,2,3,3,3,2,3,3,2,3,3,3,2,3,3,3,3,5,2,3,3,-2,3,5,2,3,3,3,3,8,3,3,3,3,3,5,3,3,3,3,3,0,2,0,3,-3,3,5,3,3,3,3,3,7,3,3,3,2,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,0,95,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,95,FALSE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,95,TRUE,0,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,96,FALSE,1,95,FALSE,1,90,TRUE,1,90,TRUE,1,96,TRUE,1,100,0,0,0,0.0025,0,0,0,0,0,0.0025,0.01,0.9025,0.0025,0,0,0,0,0.9025,0.0025,0.0025,0,0.0004,0,0,0.0025,0.0016,0.0016,0,0.0081,0.8281,0.01,0.01,0.095975,0.13,0.06195,30,93.75,29,90.63,7,87.5,7,87.5,7,87.5,8,100,15,93.75,14,87.5,96.94,97.5,97.5,97,95.75,97.75,96.12,3.12,6.31,10,10,9.5,-4.25,4,8.62,1,0,0,1,0,5,0,0,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,5,3,0,0,1,0,0,0,1,0,0,1,0,1,0,0.4,1.4,0.4,0.2,0.2,1.8,0.2,0.4,0.6,0.65,6,4,5,0,1,0,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,0.875,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,1,0,0,0,0,0,-3,0,1,0,1,0,0,0,0,0,0,0,-1,0,0.2,-0.4,0.2,-0.2,-0.05 +976,R_3PuL0KDwfjj4sQp,46 - 52,American,Male,2,2,2,3,2,-2,0,2,1,1,-1,2,2,2,2,-3,-3,-3,-3,-3,1,2,3,2,2,6,2,1,2,1,2,8,0,2,2,2,3,9,-2,-2,-3,-2,-2,8,2,2,2,2,2,7,-2,2,2,1,1,8,1,-2,2,-1,3,9,-2,-2,-2,-2,-3,5,TRUE,0,96,TRUE,1,100,FALSE,1,100,FALSE,1,98,FALSE,0,97,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.0004,1,0,0,0,0,0,0,0,0.9409,0,1,0.0004,0,1,0,1,0,1,1,1,1,0.9216,0,0,1,0,0.387975,0.210121429,0.565828571,22,68.75,21,65.63,5,62.5,4,50,5,62.5,7,87.5,12,75,9,56.25,99.66,99.75,99.38,99.5,100,99.81,99.5,3.12,34.03,37.25,49.38,37,12.5,24.81,43.25,1,0,1,1,0,4,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,0,0,1,0,0,2,0,0,0,2,4,0,3,1,1,1,1,1,0,0.6,1.2,0.4,0.8,0.2,0.4,2,0.8,0.75,0.85,7.67,8,-1,0,0,3,-0.33,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,47,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,0,1,0,0,4,-1,0,0,1,-1,-4,0,-3,0,0,0,-1,0,1,0.4,0.8,-1.6,0,-0.1 +977,R_7OjN6oZfNkfvps9,18 - 24,American,Male,-1,3,-1,-3,3,-1,0,0,1,1,2,-1,3,1,2,-2,-1,-1,-1,-2,0,0,3,-1,3,3,2,1,-2,-1,-1,8,1,-2,0,3,0,8,1,1,1,1,0,2,0,2,0,2,3,3,-1,-1,1,0,1,3,2,-1,3,2,3,5,1,1,1,2,2,6,FALSE,1,58,FALSE,0,57,FALSE,1,100,TRUE,0,83,TRUE,1,100,FALSE,1,88,TRUE,1,100,TRUE,1,88,TRUE,1,92,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,53,TRUE,1,70,TRUE,1,86,FALSE,1,60,TRUE,0,100,TRUE,0,87,TRUE,0,53,TRUE,1,100,TRUE,1,100,FALSE,1,92,FALSE,0,54,FALSE,1,100,TRUE,1,87,TRUE,0,50,FALSE,1,88,TRUE,0,97,TRUE,1,85,FALSE,0,61,TRUE,1,100,0.0144,0.0169,0.0196,0,0,0.0144,0.2916,0,0.2809,0,0.0225,0,0.0064,0,0,0.3249,0.0064,0.6889,0.0144,0,0,0.09,0.7569,0.2209,0.16,0.25,0.3721,0.1764,0,1,0.9409,1,0.236342857,0.116857143,0.355828571,24,75,22,68.75,3,37.5,7,87.5,7,87.5,5,62.5,13,81.25,9,56.25,84.03,75,92.12,87.25,81.75,86.25,81.81,6.25,15.28,37.5,4.62,-0.25,19.25,5,25.56,1,3,4,2,0,3,1,2,2,2,1,1,3,2,2,3,2,2,2,2,1,1,1,5,0,0,1,1,1,0,0,0,0,1,1,3,2,2,3,4,2,2,1.8,2.2,1.6,0.6,0.4,2.8,2,1.35,6.33,3.67,0,5,3,-4,2.66,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,0.625,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,2,3,-3,0,3,0,1,1,2,1,1,3,1,1,0,0,0,-1,-2,0.4,1.4,1.4,-0.6,0.65 +978,R_7Ei9VuEs5TkiVa5,25 - 31,American,Male,3,1,3,2,1,3,1,2,0,2,2,2,3,1,3,3,2,2,3,2,3,1,3,2,2,7,2,3,1,1,2,7,2,3,1,1,2,5,2,3,1,1,2,7,1,1,3,0,2,8,2,1,1,2,3,7,1,1,2,1,3,7,3,2,1,2,1,7,TRUE,0,100,FALSE,0,80,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,50,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,60,TRUE,0,100,TRUE,1,65,TRUE,0,65,TRUE,0,100,TRUE,0,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.1225,1,0,0,0,0.16,0,0.25,0,0,0,0,0,0.16,0.64,0.25,0.25,1,1,1,0.25,0.25,0.25,0.25,0.4225,0,1,0,1,0.49,1,0.343660714,0.122142857,0.565178571,17,53.13,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,82.81,74.38,78.75,89.38,88.75,88.44,77.19,-12.5,17.18,-0.62,16.25,26.88,26.25,7.19,27.19,0,0,0,0,1,1,2,1,1,0,0,1,2,0,1,1,1,1,2,0,2,0,0,2,1,1,0,1,2,1,1,1,1,0,0,0,0,1,1,1,0.2,1,0.8,1,1,1,0.6,0.6,0.75,0.8,6.33,7.33,-1,0,-2,0,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),31,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-2,0,0,-2,0,0,2,0,-1,-1,-1,0,1,0,1,1,1,0,1,-1,-0.8,0,0.2,0.4,-0.05 +979,R_3Ow9i9lNAkypVYS,39 - 45,American,Male,-2,-2,-1,-3,2,-2,1,3,-1,-1,-1,-1,3,-1,2,0,0,1,1,-2,-2,-2,-1,-3,-1,2,-2,1,3,-2,-2,3,-1,-1,3,-2,2,2,-1,-1,1,0,-2,4,-2,-3,-2,-3,2,1,-2,1,3,-2,1,2,1,-1,3,-2,2,2,1,1,2,2,-2,7,FALSE,1,55,TRUE,1,100,FALSE,1,97,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,52,TRUE,0,56,TRUE,1,100,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,92,FALSE,1,100,FALSE,1,54,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,87,FALSE,1,50,FALSE,1,89,FALSE,1,50,TRUE,1,75,TRUE,1,51,TRUE,1,80,0,0.0169,0,0,0.04,0,0,0,0,0,0.0625,0,0.0064,0.2304,0,0,0,0.25,0.0121,0.25,0.0025,0.1225,0.2116,0,0.0064,0.25,0.2401,0.2025,0.0009,0,0.25,0.3136,0.087553571,0.042092857,0.133014286,16,50,30,93.75,8,100,8,100,7,87.5,7,87.5,16,100,14,87.5,82.5,64.25,89.62,86.5,89.62,90.31,74.69,-43.75,-11.25,-35.75,-10.38,-1,2.12,-9.69,-12.81,0,0,0,0,3,0,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,2,2,0,0,1,0,1,1,1,1,0,0.6,0.4,0.2,0.6,0.4,0.6,0.6,0.8,0.45,0.6,2.33,1.67,1,1,0,-3,0.66,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,44,1.875,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,-1,-1,0,3,0,0,0,0,-1,-2,0,0,0,0,0,0,-1,0,0,0.2,-0.2,-0.4,-0.2,-0.15 +980,R_70JVQdKTDYuklKp,32 - 38,American,Male,-2,1,1,1,-1,-2,-1,2,1,1,0,-2,2,-1,2,1,-1,0,-1,-2,-2,1,1,1,-1,4,-2,-1,2,0,1,3,1,-1,1,0,1,6,2,1,1,1,-1,7,-1,1,1,1,-1,2,-1,-1,2,0,1,4,-1,-2,2,-1,2,2,1,0,0,1,-2,6,FALSE,1,95,TRUE,1,75,TRUE,0,70,FALSE,1,55,TRUE,1,90,TRUE,0,60,TRUE,1,75,TRUE,1,75,TRUE,1,80,TRUE,1,65,FALSE,1,55,FALSE,1,90,TRUE,1,60,FALSE,1,65,FALSE,0,55,TRUE,1,90,TRUE,0,65,TRUE,0,80,FALSE,1,60,FALSE,1,100,TRUE,1,75,TRUE,1,85,FALSE,1,100,TRUE,1,65,FALSE,1,80,TRUE,1,75,FALSE,1,55,FALSE,1,65,TRUE,0,65,TRUE,1,70,FALSE,0,60,TRUE,1,75,0.0625,0.0625,0.01,0.0625,0.0625,0.36,0.1225,0.1225,0,0.0225,0.09,0.16,0.04,0.2025,0.01,0.0625,0,0.2025,0.1225,0.04,0.0625,0.3025,0.16,0.1225,0.4225,0.2025,0.36,0.0025,0.49,0.64,0.4225,0.01,0.172053571,0.104107143,0.24,25,78.13,25,78.13,6,75,5,62.5,7,87.5,7,87.5,14,87.5,11,68.75,72.81,61.88,73.75,77.5,78.12,73.12,72.5,0,-5.32,-13.12,11.25,-10,-9.38,-14.38,3.75,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,2,1,2,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,2,0,0,0.2,1,1.4,0.2,0.4,0.2,0.6,0.65,0.35,4.33,2.67,2,-1,4,1,1.66,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,37,1.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,01ITEM,01DIR,-1,0,0,0,0,-1,0,0,0,0,0,1,1,1,1,1,1,1,0,1,-0.2,-0.2,0.8,0.8,0.3 +981,R_5rPbbE9CjOffOO5,25 - 31,American,Male,2,2,3,1,2,0,0,0,-1,1,0,1,3,1,2,-1,0,-1,-2,-3,-1,2,3,2,2,0,-1,-1,-1,1,-1,1,1,2,0,-1,0,2,-3,-2,-2,-2,-3,3,2,2,2,2,2,4,0,-1,1,0,1,1,0,2,3,1,2,0,2,2,2,2,0,10,FALSE,1,100,TRUE,1,93,TRUE,0,77,TRUE,0,61,TRUE,1,71,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,77,TRUE,1,83,FALSE,1,71,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,72,TRUE,0,93,FALSE,1,71,TRUE,0,61,TRUE,1,51,TRUE,1,100,FALSE,1,92,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,61,FALSE,1,100,TRUE,0,69,TRUE,1,83,FALSE,0,71,TRUE,1,91,0,0,0,0.0324,0.0081,0,0,0.0289,0.3721,0,0.0289,0,0.0529,0.0841,0.0841,0.0049,0.0064,0.3721,0,0,0.2401,0.0841,0.0841,0,0.5184,0.1521,0.5041,0,0.5929,0.8649,0.4761,1,0.198546429,0.074464286,0.322628571,16,50,24,75,6,75,6,75,7,87.5,5,62.5,15,93.75,9,56.25,84.41,72,80.75,94.75,90.12,85.81,83,-25,9.41,-3,5.75,7.25,27.62,-7.94,26.75,3,0,0,1,0,1,1,1,2,2,1,1,3,2,2,2,2,1,0,0,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,3,2,3,4,3,0.8,1.4,1.8,1,0.4,0.6,0.2,3,1.25,1.05,1,1.67,-4,0,2,-7,-0.67,10 cents,5 minutes,24 days,Male,Trade School (non-military),30,0.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,3,0,-1,0,0,1,0,0,1,2,1,0,3,2,2,-1,0,-2,-4,-3,0.4,0.8,1.6,-2,0.2 +982,R_50oD9rRW7qLSVOW,32 - 38,American,Male,3,3,3,3,3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,2,3,-2,3,-3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,86,TRUE,0,100,TRUE,0,61,TRUE,1,100,TRUE,0,77,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,0,86,TRUE,0,100,TRUE,1,100,TRUE,0,89,TRUE,1,96,TRUE,1,100,TRUE,0,85,TRUE,0,85,TRUE,0,83,TRUE,0,82,TRUE,1,94,TRUE,1,93,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,TRUE,0,83,TRUE,0,80,TRUE,1,96,TRUE,1,58,TRUE,1,83,0,0,0,0,0.0289,0.5929,0,0,0.6724,0.0049,0.0016,0,0.0025,0.7396,0,0.0196,0.8649,0.3721,0.6889,0,0.0036,0.0016,0.6889,0.7921,0.7225,0.5776,0.1764,0,1,0.7225,0.64,1,0.368339286,0.235671429,0.501007143,32,100,18,56.25,4,50,4,50,6,75,4,50,16,100,2,12.5,90.03,80.12,89,95.88,95.12,93.81,86.25,43.75,33.78,30.12,39,20.88,45.12,-6.19,73.75,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0,1.4,0,0,0.3,0.35,10,7.33,8,0,0,0,2.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),37,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,5,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,-0.2,0,0,-0.05 +983,R_6DOyq2DXNKHvkSw,46 - 52,American,Male,3,1,3,-1,3,2,-2,2,-2,1,2,1,2,-1,3,1,0,1,0,-1,-1,2,1,-2,3,5,2,-2,3,-2,2,2,2,2,2,-2,3,2,1,1,1,2,-1,7,3,2,2,-2,3,1,3,-3,3,-3,3,1,2,2,2,-3,3,1,1,0,2,2,0,3,TRUE,0,86,TRUE,1,55,TRUE,0,100,TRUE,0,51,TRUE,1,80,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,57,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,88,TRUE,0,91,FALSE,0,61,TRUE,1,100,FALSE,1,68,TRUE,0,100,FALSE,1,59,FALSE,1,71,FALSE,0,100,TRUE,1,71,TRUE,0,88,TRUE,1,59,TRUE,0,96,FALSE,0,91,FALSE,1,62,FALSE,1,96,TRUE,0,66,TRUE,1,86,TRUE,1,82,TRUE,1,91,0,0.8281,0,0.0081,0.0081,0,0.1681,1,0.0841,0.0841,0.0196,0.0144,0.1849,0,0.04,0.2025,0.7744,0.2601,0.0016,0.9216,1,0.3721,0.1681,0.8281,0.1024,0.1444,0.0324,0.7396,1,1,0.4356,1,0.378078571,0.202878571,0.553278571,17,53.13,19,59.38,6,75,5,62.5,2,25,6,75,12,75,7,43.75,82.69,65.88,85.12,90.75,89,82,83.38,-6.25,23.31,-9.12,22.62,65.75,14,7,39.63,4,1,2,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,2,0,0,1,1,1,0,1,1,1,1,2,0,1,0,2,0,0,0,1,2,1,1.6,0.4,0.4,0.6,0.6,1.2,0.6,0.8,0.75,0.8,3,1,4,1,1,4,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,52,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,4,0,1,0,0,-1,-1,0,-1,-1,0,0,0,-1,0,0,1,-1,0,-1,1,-0.8,-0.2,-0.2,-0.05 +984,R_132nTZp6t0IpNeS,25 - 31,American,Male,-2,2,2,1,2,-1,-1,1,1,2,1,1,2,2,3,-3,-3,-2,-1,-2,-2,3,2,-1,2,3,0,0,0,0,0,5,3,0,3,3,3,4,0,0,0,0,0,0,-3,2,2,1,2,2,-2,-1,2,1,1,2,3,3,2,2,3,2,-1,-3,-1,-1,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0.178571429,0.071428571,0.285714286,31,96.88,27,84.38,6,75,7,87.5,7,87.5,7,87.5,12,75,15,93.75,100,100,100,100,100,100,100,12.5,15.62,25,12.5,12.5,12.5,25,6.25,0,1,0,2,0,1,1,1,1,2,2,1,1,1,0,3,3,2,1,2,1,0,0,0,0,1,0,1,0,1,2,2,0,0,0,2,0,1,0,1,0.6,1.2,1,2.2,0.2,0.6,0.8,0.8,1.25,0.6,4,2,1,3,2,0,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,28,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,-1,1,0,2,0,0,1,0,1,1,0,-1,1,1,0,1,3,1,1,1,0.4,0.6,0.2,1.4,0.65 +985,R_1jpGmGiqzWyZRy0,39 - 45,American,Male,2,3,-2,-2,1,-2,1,-1,1,-1,-1,-3,3,-2,2,-3,-3,-3,0,-3,3,3,-2,1,1,1,-2,1,-1,1,1,1,-2,-3,3,-2,2,0,0,1,1,1,-3,7,3,3,-2,1,1,0,-2,1,-1,1,1,1,-1,-3,3,-2,2,1,-3,-2,-3,-2,-3,1,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,80,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,FALSE,1,70,FALSE,0,50,TRUE,1,95,TRUE,0,65,TRUE,0,75,TRUE,0,60,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,95,TRUE,1,80,FALSE,0,60,TRUE,1,70,0.0025,0,0.0025,0,0.09,0,0.01,0,0,0,0.04,0.01,0.04,0.25,0.0025,0.0225,0.36,0.25,0,0,0.04,0.25,0.36,0.09,0.4225,0.25,0.36,0,0,0.5625,0.9025,1,0.189732143,0.076785714,0.302678571,28,87.5,24,75,5,62.5,5,62.5,7,87.5,7,87.5,14,87.5,10,62.5,82.66,60.62,81.88,93.12,95,85.62,79.69,12.5,7.66,-1.88,19.38,5.62,7.5,-1.88,17.19,1,0,0,3,0,0,0,0,0,2,1,0,0,0,0,3,4,4,1,0,1,0,0,3,0,0,0,0,0,2,0,0,0,0,0,0,1,0,2,0,0.8,0.4,0.2,2.4,0.8,0.4,0,0.6,0.95,0.45,0.67,0.67,1,0,-1,6,0,10 cents,100 minutes,47 days,Male,High School (or equivalent),39,1.875,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,3,3,4,-1,0,0,0,0.2,1.8,0.5 +986,R_5WxvAQUGMBVUqZE,46 - 52,American,Male,1,2,3,2,2,1,-3,2,-3,1,3,2,2,1,3,1,1,2,2,1,2,2,3,2,2,0,2,-3,2,-3,2,0,3,2,2,1,3,0,2,1,2,2,2,2,2,2,3,2,2,1,2,-3,2,-3,1,0,3,2,2,2,3,1,2,1,2,2,1,2,FALSE,1,60,TRUE,1,100,TRUE,0,98,FALSE,1,50,FALSE,0,50,TRUE,0,65,TRUE,1,92,TRUE,1,92,TRUE,1,92,FALSE,0,93,FALSE,1,50,TRUE,0,95,TRUE,1,57,TRUE,0,77,TRUE,1,50,TRUE,1,77,TRUE,0,50,FALSE,1,77,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,65,TRUE,0,84,TRUE,1,91,FALSE,1,59,FALSE,1,92,TRUE,0,74,TRUE,1,93,TRUE,1,91,TRUE,1,99,0.0064,0.0081,0.0529,0.0064,0.0001,0.4225,0.1225,0.8649,0,0.25,0.0049,0.1849,0.0064,0.25,0.25,0,0.25,0.25,0.0064,0.7056,0.25,0.25,0.25,0.5929,0.25,0.1681,0.0081,0.16,0.9604,0.0529,0.5476,0.9025,0.284310714,0.204014286,0.364607143,16,50,21,65.63,8,100,3,37.5,4,50,6,75,13,81.25,8,50,74.16,67.75,61.88,78,89,77.62,70.69,-15.63,8.53,-32.25,24.38,28,14,-3.63,20.69,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.2,0.4,0,0.4,0.2,0.2,0.2,0.2,0.25,0.2,0,0.67,-1,0,-1,0,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,51,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,1,0,0.2,-0.2,0.2,0.05 +987,R_6I6RwbbZOOms5xI,39 - 45,American,Male,2,2,2,2,1,2,3,2,1,2,1,3,1,2,2,1,2,2,2,1,2,2,1,2,1,9,0,1,2,2,1,7,2,2,1,0,1,9,1,2,1,2,2,9,2,2,2,1,0,9,0,1,2,2,1,9,2,3,1,1,1,8,1,2,3,2,1,8,TRUE,0,50,FALSE,0,50,TRUE,0,50,FALSE,1,55,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,52,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,0,73,TRUE,1,59,TRUE,1,60,0.25,0.25,0.25,0.25,0.16,0.25,0.25,0.2304,0.25,0.25,0.5329,0.25,0.25,0.25,0.25,0.25,0.25,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1681,0.25,0.25,0.25,0.25,0.25,0.251567857,0.258985714,0.24415,28,87.5,18,56.25,6,75,5,62.5,3,37.5,4,50,11,68.75,7,43.75,51.53,51.75,51.25,50.25,52.88,52.75,50.31,31.25,-4.72,-23.25,-11.25,12.75,2.88,-16,6.56,0,0,1,0,0,2,2,0,1,1,1,1,0,2,1,0,0,1,0,1,0,0,0,1,1,2,2,0,1,1,1,0,0,1,1,0,0,1,0,0,0.2,1.2,1,0.4,0.4,1.2,0.6,0.2,0.7,0.6,8.33,8.67,0,-2,1,1,-0.34,15 cents,75 minutes,24 days,Male,University - Graduate (Masters),44,-0.375,0,0,0,0,0,1,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,1,-1,-1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,-0.2,0,0.4,0.2,0.1 +988,R_1XWui7pnTtQMTm1,32 - 38,American,Male,3,3,2,1,3,3,-1,2,-1,1,3,1,3,-1,3,-1,-2,1,-2,-1,3,3,2,2,3,5,3,-3,3,-3,3,5,3,2,3,-1,3,6,-1,-3,1,-2,-1,9,3,3,2,2,3,6,3,-3,3,-2,3,7,3,1,3,-1,3,5,2,2,2,2,-1,8,FALSE,1,99,TRUE,1,80,FALSE,1,88,FALSE,1,86,TRUE,1,100,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,0,82,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0036,0,0,0.6724,0,0.01,0.8464,0.0004,0,0,0.04,0,0.0196,1,0,0,0,0,0,1,0,0,0.0001,0.0144,0,0,1,0.164532143,0.113742857,0.215321429,29,90.63,27,84.38,8,100,6,75,8,100,5,62.5,15,93.75,12,75,97.16,95.5,98.25,99.88,95,97.5,96.81,6.25,12.78,-4.5,23.25,-0.12,32.5,3.75,21.81,0,0,0,1,0,0,2,1,2,2,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,2,1,1,2,0,0,0,0,0,3,4,1,4,0,0.2,1.4,0.2,0.2,0.2,1.2,0,2.4,0.5,0.95,5.33,6,-1,-2,1,1,-0.67,5 cents,5 minutes,24 days,Male,University - Undergraduate,33,1.25,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,-3,-3,-1,-4,0,0,0.2,0.2,-2.2,-0.45 +989,R_5QtmX2yqA5EsiEq,32 - 38,American,Male,3,3,3,2,2,3,2,3,-3,2,3,1,3,3,3,3,3,3,3,2,1,3,3,3,2,10,3,1,3,3,2,10,2,3,3,3,2,10,3,1,3,3,2,10,2,3,2,3,3,10,3,3,2,1,3,10,3,1,3,3,3,10,3,3,1,2,3,10,FALSE,1,95,TRUE,1,98,FALSE,1,90,FALSE,1,85,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,95,TRUE,0,100,FALSE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,100,TRUE,1,100,FALSE,0,90,0,0,0,0,0.81,0,0,0,0,0,1,1,0.0025,0,0,0.0004,0,0.0225,0,0.01,0,0,0.0025,0,0.0025,0,0,0.0025,0.01,1,0.01,0.01,0.138675,0.202528571,0.074821429,30,93.75,28,87.5,8,100,6,75,7,87.5,7,87.5,13,81.25,15,93.75,97.28,96.62,96.88,98.12,97.5,98.94,95.62,6.25,9.78,-3.38,21.88,10.62,10,17.69,1.87,2,0,0,1,0,0,1,0,6,0,1,2,0,0,1,0,2,0,0,0,1,0,1,1,1,0,1,1,4,1,0,0,0,0,0,0,0,2,1,1,0.6,1.4,0.8,0.4,0.8,1.4,0,0.8,0.8,0.75,10,10,0,0,0,0,0,5 cents,5 minutes,47 days,Male,University - PhD,33,0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,0,-1,0,-1,0,0,-1,2,-1,1,2,0,0,1,0,2,-2,-1,-1,-0.2,0,0.8,-0.4,0.05 +990,R_7MyBVy2Q21iHRZn,39 - 45,American,Male,3,1,2,2,0,0,1,2,1,1,2,2,3,2,3,-2,-3,-2,0,-3,3,1,3,2,0,3,-1,1,2,1,2,4,2,2,3,2,3,1,-2,-2,-2,-3,-3,5,3,2,3,2,1,2,1,-2,2,-2,2,5,2,2,3,3,2,3,3,-3,3,3,-2,9,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0.142857143,0,0.285714286,32,100,28,87.5,8,100,7,87.5,7,87.5,6,75,16,100,12,75,100,100,100,100,100,100,100,12.5,12.5,0,12.5,12.5,25,0,25,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,3,0,0,1,1,0,1,1,3,0,3,1,0,0,0,1,1,5,0,5,3,1,0.2,0.4,0,0.8,0.6,1.6,0.4,2.8,0.35,1.35,2.67,3.33,1,-1,-2,-4,-0.66,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),42,1.5,1,0,1,0,1,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-1,0,0,-1,0,-3,0,-3,0,0,0,0,-1,-1,-5,1,-5,0,-1,-0.4,-1.2,-0.4,-2,-1 +991,R_5EzyVLZGMVzRU7F,32 - 38,American,Male,2,3,2,0,2,-1,-2,0,1,2,0,0,2,0,2,-3,-3,-3,-3,-3,2,3,0,0,2,5,-2,-2,0,0,0,6,1,0,2,0,2,5,-3,-3,-3,-3,-3,8,2,2,0,0,2,5,0,0,0,0,2,5,-1,0,0,-2,0,5,-2,-2,-2,-2,-2,5,FALSE,1,100,TRUE,1,70,TRUE,0,60,FALSE,1,64,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,60,TRUE,1,77,TRUE,1,74,TRUE,0,53,FALSE,1,50,FALSE,0,52,TRUE,0,58,FALSE,0,50,TRUE,1,58,FALSE,1,59,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,87,FALSE,1,100,TRUE,1,50,FALSE,1,74,TRUE,1,53,TRUE,0,55,FALSE,1,50,TRUE,0,54,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.16,0.2209,0.1764,0.0625,0.25,0,0.25,0.0676,0,0.0169,0.25,0.2704,0.0529,0.2809,0.01,0.09,0,0.1296,0.25,0.0676,1,0.25,0.25,0.3364,0.1681,0.3025,0.25,0,0.36,0.25,0.2916,0.25,0.203375,0.119164286,0.287585714,21,65.63,21,65.63,4,50,4,50,7,87.5,6,75,10,62.5,11,68.75,66.34,58.62,75.62,71.38,59.75,65.38,67.31,0,0.71,8.62,25.62,-16.12,-15.25,2.88,-1.44,0,0,2,0,0,1,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,1,2,0,0,1,2,0,1,0,1,0,2,2,2,1,1,1,1,1,0.4,0.8,0.2,0,0.6,0.8,1.4,1,0.35,0.95,5.33,5,0,1,0,3,0.33,10 cents,5 minutes,15 days,Male,University - Undergraduate,36,1,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,-1,0,0,0,0,-2,0,0,2,0,0,-2,-2,-2,-1,-1,-1,-1,-1,-0.2,0,-1.2,-1,-0.6 +992,R_6SpHjdxlfnt9ea5,32 - 38,American,Male,3,3,3,3,3,3,-2,3,-1,0,1,-1,3,1,3,0,1,2,2,0,3,1,3,1,3,6,3,0,3,-1,1,7,1,1,3,2,3,9,0,0,0,-1,0,7,3,3,3,3,3,9,1,0,1,0,1,9,3,0,3,1,3,8,3,3,3,3,0,8,FALSE,1,93,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,FALSE,1,92,FALSE,1,95,FALSE,0,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,1,90,FALSE,1,88,TRUE,1,100,TRUE,1,100,FALSE,1,86,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,90,FALSE,1,90,FALSE,1,90,FALSE,0,100,TRUE,1,100,TRUE,1,100,0.0025,0,0,0,0,0.0064,0,0,0.0144,0,1,1,0,0.0064,0,0,0.0196,1,0.01,0.0025,0,0,0.01,0.0025,0.0036,0.01,0,0.0049,0.0036,1,0.01,0.0025,0.146657143,0.217628571,0.075685714,30,93.75,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,96.22,96.5,95.25,97.88,95.25,99.69,92.75,6.25,8.72,9,7.75,10.38,7.75,12.19,5.25,0,2,0,2,0,0,2,0,0,1,0,2,0,1,0,0,1,2,3,0,0,0,0,0,0,2,2,2,1,1,2,1,0,0,0,3,2,1,1,0,0.8,0.6,0.6,1.2,0,1.6,0.6,1.4,0.8,0.9,7.33,8.67,-3,-2,1,-1,-1.34,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,1.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,2,0,2,0,-2,0,-2,-1,0,-2,1,0,1,0,-3,-1,1,2,0,0.8,-1,0,-0.2,-0.1 +993,R_7QAPX4pUQYDqIST,18 - 24,American,Male,2,3,3,0,2,2,-3,3,-3,3,3,3,3,0,3,3,3,3,2,3,3,3,3,0,2,4,2,-3,3,-3,2,4,3,3,3,0,3,4,3,1,2,2,3,4,3,3,3,2,3,5,3,-3,3,-3,2,6,3,3,3,0,3,6,3,3,3,2,3,5,FALSE,1,57,TRUE,1,64,FALSE,1,64,FALSE,1,100,FALSE,0,50,TRUE,0,67,FALSE,0,50,TRUE,1,100,FALSE,0,64,TRUE,1,100,FALSE,1,100,TRUE,0,69,FALSE,0,62,FALSE,1,52,FALSE,0,62,FALSE,0,59,FALSE,1,60,TRUE,0,100,FALSE,1,57,FALSE,1,100,TRUE,1,64,FALSE,0,65,FALSE,1,66,TRUE,1,58,FALSE,1,85,TRUE,1,100,TRUE,0,54,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,0,53,FALSE,0,100,0,0,0.3481,0.25,1,0.4489,0.1764,0,0,0.4225,0,0.3844,0.4096,0,0.25,0.1296,0.1156,0,0,0.0225,0.1296,0.3844,0.1849,0.2304,0.16,0.2916,0.2809,0.1849,0.1296,1,0.3364,0.4761,0.255296429,0.238357143,0.272235714,20,62.5,18,56.25,4,50,3,37.5,5,62.5,6,75,7,43.75,11,68.75,73.12,69.25,65.88,76.12,81.25,71.94,74.31,6.25,16.87,19.25,28.38,13.62,6.25,28.19,5.56,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,1,0,0,2,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,0.6,0.8,0.4,0,0,0.25,0.3,4,5.67,-1,-2,-2,-1,-1.67,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),23,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,2,1,0,0,-0.6,-0.2,0,0.6,-0.05 +994,R_62f44m0U1ZadJSw,25 - 31,American,Male,3,2,3,2,2,3,3,3,3,3,3,3,3,0,2,3,3,3,3,3,2,2,2,2,2,10,2,2,2,0,3,10,2,2,0,2,2,10,2,3,3,2,3,10,3,2,3,2,3,5,2,2,2,-2,3,5,3,3,3,3,2,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,0,70,TRUE,1,100,FALSE,1,55,FALSE,0,57,TRUE,1,100,FALSE,0,63,TRUE,1,100,TRUE,0,100,FALSE,1,70,FALSE,0,100,TRUE,0,79,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,0,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0.3249,0,0.2025,0,0,0.25,0,0,1,0.3969,1,0,0.25,0.25,0.49,1,1,1,1,0.25,0.6241,0.25,0.25,1,0,0.25,1,1,0.09,0.448339286,0.274242857,0.622435714,16,50,17,53.13,3,37.5,5,62.5,4,50,5,62.5,10,62.5,7,43.75,82.62,72.88,81.88,92,83.75,91.88,73.38,-3.13,29.49,35.38,19.38,42,21.25,29.38,29.63,1,0,1,0,0,1,1,1,3,0,1,1,3,2,0,1,0,0,1,0,0,0,0,0,1,1,1,1,5,0,0,0,0,3,0,0,0,0,0,0,0.4,1.2,1.4,0.4,0.2,1.6,0.6,0,0.85,0.6,10,6.67,5,5,0,0,3.33,20 cents,100 minutes,24 days,Male,University - Undergraduate,26,0.5,0,0,0,0,1,1,0,0.67,04LPfPsV,02COC,02FUT,01ITEM,01DIR,1,0,1,0,-1,0,0,0,-2,0,1,1,3,-1,0,1,0,0,1,0,0.2,-0.4,0.8,0.4,0.25 +995,R_3dTGyvdnzxdRvIB,39 - 45,Canadian,Male,3,2,1,1,1,0,-2,1,-1,1,1,1,1,0,3,-1,1,1,1,1,1,0,1,1,2,7,-1,1,0,1,0,5,1,1,2,0,1,3,-2,-2,-1,-2,-2,9,2,3,3,3,2,1,-2,-3,2,1,1,4,1,3,2,-1,2,3,-1,0,-1,-2,-1,7,FALSE,1,88,FALSE,0,93,TRUE,0,82,FALSE,1,80,TRUE,1,66,FALSE,1,100,FALSE,0,68,FALSE,0,84,FALSE,0,55,FALSE,0,95,FALSE,1,91,TRUE,0,83,TRUE,1,75,FALSE,1,100,FALSE,0,100,FALSE,0,70,TRUE,0,87,FALSE,1,88,TRUE,0,84,FALSE,1,68,TRUE,1,100,FALSE,0,80,FALSE,1,76,TRUE,1,100,TRUE,0,74,TRUE,1,100,FALSE,1,63,FALSE,1,91,TRUE,0,74,TRUE,1,81,FALSE,0,67,TRUE,1,79,0.7056,0,0.49,0.4624,0.0441,0,0,0.9025,0.1024,0.64,0.0361,0.0625,0.3025,0.0081,0.1156,0.8649,0.0576,0.04,0.0081,0.5476,0,1,0.7056,0,0.7569,0.1369,0.4489,0.0144,0.6724,0.0144,0.5476,0.6889,0.311357143,0.226878571,0.395835714,21,65.63,17,53.13,3,37.5,6,75,4,50,4,50,7,43.75,10,62.5,82.56,79.12,82.12,86.62,82.38,82.06,83.06,12.5,29.43,41.62,7.12,36.62,32.38,38.31,20.56,2,2,0,0,1,1,3,1,2,1,0,0,1,0,2,1,3,2,3,3,1,1,2,2,1,2,1,1,2,0,0,2,1,1,1,0,1,2,3,2,1,1.6,0.6,2.4,1.4,1.2,1,1.6,1.4,1.3,5,2.67,6,1,0,2,2.33,10 cents,5 minutes,47 days,Male,University - Undergraduate,39,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,1,-2,-2,0,-1,2,0,0,1,0,-2,0,-1,1,1,2,0,0,1,-0.4,0.4,-0.4,0.8,0.1 +996,R_5OkLALUWGKdFYrn,39 - 45,Canadian,Male,-3,2,2,1,-3,-3,1,1,2,0,3,0,-1,0,3,0,1,-1,-2,-3,-3,3,-1,-1,-3,1,-3,-1,1,1,-1,1,1,-2,-1,-1,1,5,0,2,2,0,-2,7,-3,3,2,2,-2,0,-3,0,2,2,-1,0,3,0,2,2,2,1,2,2,2,2,0,1,FALSE,1,87,FALSE,0,82,TRUE,0,100,TRUE,0,87,TRUE,1,80,FALSE,1,89,TRUE,1,100,FALSE,0,84,FALSE,0,51,TRUE,1,100,FALSE,1,55,TRUE,0,100,TRUE,1,86,FALSE,1,85,FALSE,0,59,TRUE,1,85,TRUE,0,76,TRUE,0,100,FALSE,1,62,FALSE,1,100,FALSE,0,51,FALSE,0,54,FALSE,1,52,FALSE,0,53,FALSE,1,100,FALSE,0,100,TRUE,0,91,TRUE,0,100,FALSE,1,65,TRUE,1,82,FALSE,0,82,TRUE,1,100,0.7056,1,0.0225,0,0,0.0121,0.2809,0,0,0.2916,0.0324,0.0196,0.2601,0.2025,0.04,0.6724,0.2304,0.7569,1,0,0.2601,0.3481,0.1444,0.0225,0.5776,0.8281,0.6724,0.0169,1,1,0.1225,1,0.349696429,0.199921429,0.499471429,8,25,16,50,2,25,6,75,5,62.5,3,37.5,7,43.75,9,56.25,81.19,71.12,74.88,90.75,88,78.06,84.31,-25,31.19,46.12,-0.12,28.25,50.5,34.31,28.06,0,1,3,2,0,0,2,0,1,1,2,2,0,1,2,0,1,3,2,1,0,1,0,1,1,0,1,1,0,1,0,0,3,2,1,2,1,3,4,3,1.2,0.8,1.4,1.4,0.6,0.6,1.2,2.6,1.2,1.25,2.33,0.33,1,1,4,6,2,10 cents,5 minutes,15 days,Male,High School (or equivalent),39,1,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,3,1,-1,0,1,-1,1,0,2,2,-3,-1,1,-2,0,0,-2,-2,0.6,0.2,0.2,-1.2,-0.05 +997,R_5dhs4Es7Ep0gGwt,39 - 45,American,Female,2,2,2,2,-3,-2,0,1,0,1,0,-1,2,0,2,-3,-3,-3,-3,-3,2,2,2,2,-3,2,-1,0,1,0,1,2,0,-1,1,1,1,2,-3,-3,-3,-3,-3,2,2,2,2,2,-3,5,-3,0,1,0,1,2,0,-1,1,-1,1,2,-3,-3,-3,-3,-3,2,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,58,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,57,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,58,TRUE,0,57,TRUE,1,60,FALSE,1,60,TRUE,1,57,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,63,TRUE,1,50,0.1764,0.1849,0.25,0.25,0.25,0.25,0.16,0.25,0.25,0.1764,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.25,0.25,0.16,0.25,0.25,0.25,0.25,0.25,0.25,0.1369,0.25,0.25,0.3249,0.25,0.25,0.242253571,0.243664286,0.240842857,9,28.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,16,100,3,18.75,52.19,51.62,50.88,54,52.25,52.88,51.5,-31.25,-7.19,-10.88,0.88,-8.5,-10.25,-47.12,32.75,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0.2,0.6,0,0,0.2,0.6,0,0.2,0.2,2,3,-3,0,0,0,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),39,1.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +998,R_1SbmUbaWtqakKk1,39 - 45,American,Female,1,3,3,3,-3,-3,0,1,1,-3,3,3,3,0,3,1,1,1,1,1,3,3,3,3,-3,0,-3,-3,1,-3,-3,0,1,1,1,1,1,0,1,1,1,1,1,0,3,3,3,3,-3,0,-3,-3,1,-3,1,0,1,1,1,1,1,0,1,1,1,1,1,0,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.25,1,0.25,0,0.25,0,0,0.25,0.25,0,0,0,0.25,0.25,0.25,0,0.25,1,0,0,0.25,0.25,0.25,0.25,0.25,1,1,1,1,0.25,1,0.330357143,0.125,0.535714286,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,76.56,62.5,75,75,93.75,81.25,71.88,-12.5,14.06,0,0,12.5,43.75,12.5,15.63,2,0,0,0,0,0,3,0,4,0,2,2,2,1,2,0,0,0,0,0,2,0,0,0,0,0,3,0,4,4,2,2,2,1,2,0,0,0,0,0,0.4,1.4,1.8,0,0.4,2.2,1.8,0,0.9,1.1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,40,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,-4,0,0,0,0,0,0,0,0,0,0,0,-0.8,0,0,-0.2 +999,R_5B2M5p5U6Ucv4KH,46 - 52,American,Female,3,2,-2,-2,3,2,-2,3,-2,-2,3,2,3,1,3,3,3,3,3,3,3,2,1,-2,3,4,2,-1,3,1,-2,6,3,3,3,2,3,2,1,1,1,1,1,7,3,2,1,1,3,3,1,-2,3,-2,-2,1,3,2,3,-2,3,2,3,3,3,3,3,1,TRUE,0,70,TRUE,1,100,TRUE,0,83,FALSE,1,52,TRUE,1,100,FALSE,1,93,TRUE,1,91,TRUE,1,100,FALSE,0,56,TRUE,1,78,FALSE,1,81,TRUE,0,100,TRUE,1,100,TRUE,0,87,FALSE,0,50,TRUE,1,100,TRUE,0,84,FALSE,1,83,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,87,FALSE,1,100,TRUE,1,91,TRUE,0,100,TRUE,1,87,FALSE,1,50,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,0,56,TRUE,1,100,0,0.0169,0,0.0081,0,0.0049,0.0081,0.0484,0.25,0.0169,0.25,0,0.3136,0.0361,0,0,0,0.2304,0.25,1,0.25,0.25,0.25,0.7569,0.7056,0.25,0.3136,0.49,0.6889,0.0289,1,1,0.299725,0.082742857,0.516707143,17,53.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,11,68.75,9,56.25,79.03,61.88,90.88,85.38,78,81,77.06,-9.37,16.53,-0.62,28.38,22.88,15.5,12.25,20.81,0,0,3,0,0,0,1,0,3,0,0,1,0,1,0,2,2,2,2,2,0,0,3,3,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0.6,0.8,0.4,2,1.2,0.2,0.6,0,0.95,0.5,4,2,1,5,0,6,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),50,1.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-3,0,-1,1,0,3,0,0,1,0,-2,0,2,2,2,2,2,-0.6,0.6,-0.2,2,0.45 +1000,R_52Lyabi3ByuaRHU,39 - 45,American,Female,0,3,3,-1,1,-3,-2,3,-1,-1,3,1,3,-2,3,1,1,1,1,-1,2,3,3,0,2,2,-3,-2,3,-1,-1,2,3,1,3,-1,3,0,1,1,1,2,-1,3,1,1,2,1,2,0,-2,-1,1,-2,1,1,3,1,2,-1,3,3,2,3,3,2,2,2,TRUE,0,85,FALSE,0,50,TRUE,0,92,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,78,TRUE,1,99,FALSE,0,50,TRUE,1,60,FALSE,1,50,TRUE,0,87,TRUE,1,58,TRUE,0,89,TRUE,1,50,TRUE,1,56,TRUE,0,59,TRUE,0,70,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,79,TRUE,1,85,FALSE,1,76,TRUE,1,57,TRUE,0,50,FALSE,1,72,TRUE,0,57,FALSE,0,50,FALSE,0,51,TRUE,1,77,0.0001,0.1849,0.1936,0.0484,0.0529,0,0.0225,0.16,0.25,0.25,0.25,0.1764,0.25,0.25,0.25,0.25,0.0441,0.25,0.0784,0.0576,0.25,0.25,0.25,0.7921,0.3481,0.25,0.2601,0.7225,0.8464,0.49,0.3249,0.7569,0.290460714,0.175421429,0.4055,16,50,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,65.22,50.12,66.25,70.62,73.88,60.69,69.75,-9.38,5.84,0.12,3.75,8.12,11.38,-8.06,19.75,2,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,2,1,2,1,1,1,2,1,2,0,0,1,1,0,1,2,2,1,3,0.8,0,0.2,0.2,1.4,1.4,0.4,1.8,0.3,1.25,1.33,1.33,2,1,-3,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,42,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,-2,-1,-1,0,-1,-1,-2,-1,-2,0,0,-1,0,0,-1,-2,-2,0,-3,-0.6,-1.4,-0.2,-1.6,-0.95 +1001,R_60y1sHUREAIPW25,39 - 45,Canadian,Male,2,3,3,1,2,2,0,3,-2,2,2,3,3,1,3,1,1,2,1,1,2,3,2,1,2,1,2,0,2,-2,2,1,2,3,2,1,2,1,1,2,2,2,1,2,2,3,2,1,1,1,2,0,3,-2,2,7,3,3,3,1,2,1,2,2,2,2,2,2,TRUE,0,50,TRUE,1,58,FALSE,1,83,TRUE,0,86,TRUE,1,54,FALSE,1,66,TRUE,1,50,TRUE,1,58,FALSE,0,79,TRUE,1,76,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,65,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,0.1764,0.25,0.25,0.25,0.25,0.1156,0.25,0.0576,0.25,0.25,0.25,0.25,0.6241,0.25,0.2116,0.1764,0.25,0.7396,0.25,0.25,0.25,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.0289,0.25,0.25,0.25,0.252725,0.28035,0.2251,25,78.13,24,75,6,75,5,62.5,6,75,7,87.5,13,81.25,11,68.75,55.47,59.12,52.5,55.12,55.12,54.69,56.25,3.13,-19.53,-15.88,-10,-19.88,-32.38,-26.56,-12.5,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1,0.2,0.2,0.4,0.4,0.4,0,0.4,0.8,0.3,0.4,1,3,0,-6,0,0,-2,5 cents,5 minutes,47 days,Male,University - PhD,43,0.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,-1,0,0,1,0,0,-1,0,1,0,0,-1,0,0,0,-1,-0.2,0.2,0,-0.4,-0.1 +1002,R_306qNPdQLqQWswA,46 - 52,American,Female,3,2,1,0,-3,-3,-1,0,0,0,3,-1,0,1,0,0,0,0,0,0,0,0,0,0,-3,4,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,-3,6,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,69,TRUE,0,100,TRUE,0,71,FALSE,0,55,TRUE,0,86,TRUE,1,76,FALSE,0,70,FALSE,0,60,TRUE,1,89,FALSE,1,58,TRUE,0,82,TRUE,1,56,FALSE,1,65,TRUE,1,63,FALSE,0,56,FALSE,1,57,TRUE,0,73,TRUE,0,60,FALSE,1,56,TRUE,1,83,FALSE,0,68,TRUE,0,71,FALSE,0,64,TRUE,0,87,TRUE,1,97,FALSE,1,53,TRUE,0,75,TRUE,0,78,TRUE,1,84,TRUE,1,60,TRUE,1,100,0.49,0.0009,0.3136,0.0576,0,0.7396,0.4096,0.0121,0.1936,0.4624,0.0256,0.1936,0.36,0.1764,0.3025,0.0961,0.5041,0.5041,0.5625,0.7569,0.0289,0.1369,0.36,0.1225,0.1849,0.2209,0.16,1,1,0.5329,0.6084,0.6724,0.368817857,0.284264286,0.453371429,14,43.75,15,46.88,5,62.5,4,50,4,50,2,25,10,62.5,5,31.25,72.56,61.75,73.25,81.88,73.38,71.88,73.25,-3.13,25.68,-0.75,23.25,31.88,48.38,9.38,42,3,2,1,0,0,3,1,0,0,0,3,1,0,1,0,0,0,0,0,0,3,2,1,0,0,3,1,0,0,0,3,1,0,1,0,0,0,0,0,0,1.2,0.8,1,0,1.2,0.8,1,0,0.75,0.75,5,6,-2,-1,0,1,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,0.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +1003,R_7DJ8cRP3DHtga9x,46 - 52,American,Female,3,3,1,-3,3,-2,-1,3,0,2,0,-1,3,-1,3,1,2,1,2,0,3,3,1,-3,3,2,-1,-2,3,0,2,1,-1,-2,3,-1,3,0,-2,-2,-1,-1,-1,5,3,3,1,-2,3,2,-2,-2,2,0,0,2,-1,-2,3,-1,3,1,0,0,0,1,0,4,FALSE,1,99,TRUE,1,100,TRUE,0,66,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,TRUE,0,76,TRUE,1,92,FALSE,1,87,TRUE,1,84,TRUE,1,100,TRUE,0,71,TRUE,0,100,TRUE,0,69,FALSE,1,50,FALSE,0,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,81,TRUE,0,69,FALSE,1,99,TRUE,0,99,TRUE,1,76,FALSE,0,50,TRUE,1,100,0,0.0361,0,0.0009,0,0,0,0,0.25,0.0004,0.0576,0.0064,0,0.0625,0,0,0,0.25,0.0001,0,0.25,0.0256,0.4761,0.0169,0.5041,0.4761,0.25,0.0001,0.4356,1,0.9801,0.5776,0.200685714,0.044778571,0.356592857,28,87.5,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,85.56,74.62,89,95.25,83.38,89.25,81.88,15.62,13.68,12.12,26.5,7.75,8.38,1.75,25.63,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,3,4,2,3,1,0,0,0,1,0,0,1,1,0,2,1,1,0,0,0,1,2,1,1,0,0,0.4,0.4,2.6,0.2,0.8,0.4,1,0.85,0.6,1,1.67,0,-1,-1,1,-0.67,5 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),51,1.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,-1,0,1,0,-1,0,-2,0,0,0,0,0,2,2,1,2,1,-0.2,-0.4,0,1.6,0.25 +1004,R_33vBuSq1T7samS8,46 - 52,American,Female,2,1,1,0,2,-2,-2,2,-2,0,2,-2,2,2,3,2,0,0,0,-3,2,2,2,2,2,5,-2,0,2,0,2,8,0,1,1,1,2,7,-2,-2,-2,-2,-2,3,2,2,2,2,2,6,-2,-2,-2,-2,0,6,2,3,2,2,3,5,0,0,0,0,0,7,FALSE,1,76,FALSE,0,73,TRUE,0,96,FALSE,1,65,FALSE,0,59,FALSE,1,100,TRUE,1,91,TRUE,1,93,TRUE,1,64,TRUE,1,68,FALSE,1,73,TRUE,0,94,FALSE,0,63,TRUE,0,62,FALSE,0,68,TRUE,1,60,FALSE,1,83,TRUE,0,78,FALSE,1,67,FALSE,1,70,FALSE,0,61,FALSE,0,75,FALSE,1,71,FALSE,0,67,TRUE,0,83,TRUE,1,85,FALSE,1,68,FALSE,1,65,FALSE,1,80,TRUE,1,100,FALSE,0,83,FALSE,0,60,0.0049,0.0225,0.16,0.0081,0.36,0,0.4489,0.1024,0.09,0.5625,0,0.3969,0.1296,0.0729,0.3481,0.5329,0.0841,0.1225,0.1225,0.6889,0.3721,0.4624,0.1089,0.3844,0.0289,0.1024,0.6889,0.0576,0.9216,0.6084,0.04,0.8836,0.311478571,0.2322,0.390757143,19,59.38,18,56.25,5,62.5,4,50,4,50,5,62.5,7,43.75,11,68.75,75.03,70.12,72.12,77.25,80.62,73.12,76.94,3.13,18.78,7.62,22.12,27.25,18.12,29.37,8.19,0,1,1,2,0,0,2,0,2,2,2,3,1,1,1,4,2,2,2,1,0,1,1,2,0,0,0,4,0,0,0,5,0,0,0,2,0,0,0,3,0.8,1.2,1.6,2.2,0.8,0.8,1,1,1.45,0.9,6.67,5.67,-1,2,2,-4,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,2,-4,2,2,2,-2,1,1,1,2,2,2,2,-2,0,0.4,0.6,1.2,0.55 +1005,R_5RTXrTAVifP2iB0,32 - 38,American,Female,1,3,0,2,2,-1,3,2,1,1,2,2,2,1,3,0,0,1,0,-1,1,3,-1,-1,3,4,0,3,3,3,3,6,2,3,3,3,3,1,3,3,3,0,3,10,2,3,0,3,3,6,0,3,3,-1,3,4,2,3,3,0,3,3,3,3,2,1,-1,10,TRUE,0,64,TRUE,1,57,TRUE,0,100,FALSE,1,67,FALSE,0,64,FALSE,1,94,TRUE,1,95,TRUE,1,83,TRUE,1,76,FALSE,0,97,FALSE,1,82,TRUE,0,73,TRUE,1,82,TRUE,0,67,TRUE,1,60,TRUE,1,66,FALSE,1,60,TRUE,0,93,FALSE,1,64,FALSE,1,100,TRUE,1,60,FALSE,0,59,TRUE,0,61,TRUE,1,53,FALSE,1,63,TRUE,1,83,FALSE,1,57,FALSE,1,74,FALSE,1,83,TRUE,1,69,FALSE,0,58,TRUE,1,50,0.0289,0.0289,0.1156,0.0025,0.25,0.0036,0.2209,0.9409,0,0.3481,0.0961,0.0324,0.0576,0.0324,0.4096,0.1849,0.3721,0.1089,0.0676,0.1369,0.16,0.16,0.1296,0.4489,0.16,0.1849,0.3364,0.4096,1,0.8649,0.0289,0.5329,0.274217857,0.218392857,0.330042857,15,46.88,22,68.75,7,87.5,6,75,3,37.5,6,75,12,75,10,62.5,72.31,65.12,69.25,77.62,77.25,69.5,75.12,-21.87,3.56,-22.38,-5.75,40.12,2.25,-5.5,12.62,0,0,1,3,1,1,0,1,2,2,0,1,1,2,0,3,3,2,0,4,1,0,0,1,1,1,0,1,2,2,0,1,1,1,0,3,3,1,1,0,1,1.2,0.8,2.4,0.6,1.2,0.6,1.6,1.35,1,3.67,4.33,-2,2,-2,0,-0.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,0,1,2,0,0,0,0,0,0,0,0,0,1,0,0,0,1,-1,4,0.4,0,0.2,0.8,0.35 +1006,R_7qNLAeIrEpq97X5,39 - 45,American,Female,3,3,3,3,3,-1,0,3,1,0,2,-1,3,0,3,2,1,2,3,0,3,3,3,3,3,0,0,0,3,2,1,5,3,1,3,1,3,5,0,0,-2,0,0,6,3,3,3,3,3,0,-2,-2,3,0,1,2,1,-1,3,0,3,0,3,3,3,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,77,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,99,TRUE,0,62,TRUE,0,100,TRUE,0,77,FALSE,1,51,FALSE,0,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,56,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,65,TRUE,1,100,0,0,0.0001,0,0,0,0,1,0.2401,0,0,0,0,0,0,0,0,0.25,0,1,0.3136,0.25,0.5929,0,0.3844,0.3136,0.4225,1,1,1,1,0.5929,0.334285714,0.106435714,0.562135714,28,87.5,19,59.38,4,50,5,62.5,4,50,6,75,12,75,7,43.75,88.84,74.75,89.75,100,90.88,91.88,85.81,28.12,29.46,24.75,27.25,50,15.88,16.88,42.06,0,0,0,0,0,1,0,0,1,1,1,2,0,1,0,2,1,4,3,0,0,0,0,0,0,1,2,0,1,1,1,0,0,0,0,1,2,1,0,3,0,0.6,0.8,2,0,1,0.2,1.4,0.85,0.65,3.33,0.67,0,3,5,5,2.66,5 cents,5 minutes,24 days,Female,University - Graduate (Masters),45,0.125,1,1,0,0,0,1,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,-2,0,0,0,0,2,0,1,0,1,-1,3,3,-3,0,-0.4,0.6,0.6,0.2 +1007,R_6tYHn1xjiofoT6h,46 - 52,American,Female,3,3,2,0,3,1,-3,2,-2,2,2,0,3,0,3,1,2,2,2,0,2,3,2,-1,3,3,1,-3,2,-2,2,2,2,0,2,-2,3,2,1,1,2,1,0,7,3,3,1,1,3,3,0,-3,3,-3,2,1,2,0,3,-3,3,2,2,1,1,1,1,3,FALSE,1,100,TRUE,1,72,FALSE,1,68,FALSE,1,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,100,FALSE,1,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,80,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,73,TRUE,0,100,TRUE,1,100,TRUE,1,56,TRUE,1,100,0,0.01,0,0,0,0,0.04,1,0,0,0,0,0.0081,0,0,0.0784,0,0.1521,0.5329,0,0,0,0,0,0.04,0,0.1936,0,0.1024,0,1,0.0625,0.114642857,0.091328571,0.137957143,18,56.25,29,90.63,8,100,7,87.5,7,87.5,7,87.5,15,93.75,14,87.5,92.06,85,97.5,98.75,87,93.06,91.06,-34.38,1.43,-15,10,11.25,-0.5,-0.69,3.56,1,0,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,1,0,0,0,1,1,0,1,0,1,1,0,0,0,0,3,0,1,1,1,1,1,0.4,0,0.6,0.4,0.4,0.6,0.6,1,0.35,0.65,2.33,2,0,1,0,4,0.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,52,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,0,-1,0,0,-1,0,-1,-1,0,0,0,1,-1,0,-1,0,-1,0,-1,0,-0.6,0,-0.6,-0.3 +1008,R_7nj844TBfQvT4C0,18 - 24,American,Female,-2,2,-3,-3,3,1,3,3,3,3,1,-2,-3,2,3,-3,-3,-3,-3,-3,-1,2,2,-2,3,4,2,3,3,-1,3,3,2,-2,-2,3,2,1,2,3,3,3,3,9,1,2,-2,1,3,2,1,3,3,-2,3,1,1,-2,2,-1,3,2,2,3,2,2,-3,9,TRUE,0,90,TRUE,1,100,TRUE,0,100,FALSE,1,53,TRUE,1,85,TRUE,0,81,TRUE,1,100,TRUE,1,99,TRUE,1,96,TRUE,1,51,FALSE,1,51,TRUE,0,93,TRUE,1,86,FALSE,1,65,TRUE,1,57,FALSE,0,51,FALSE,1,100,TRUE,0,92,FALSE,1,100,TRUE,0,51,TRUE,1,92,FALSE,0,51,TRUE,0,52,FALSE,0,51,TRUE,0,75,TRUE,1,95,TRUE,0,94,FALSE,1,100,TRUE,0,52,TRUE,1,100,TRUE,1,69,FALSE,0,50,0.0001,0.0025,0.2601,0,0.25,0.6561,0.2601,0.2401,0.2601,0.2601,0,0.0196,0.0016,0.2401,0.0225,0,0.2704,0.2209,0,0.5625,0.0064,0.1849,0,0.1225,0,0.8836,0.0961,0.81,1,0.8464,0.2704,0.8649,0.298189286,0.192971429,0.403407143,5,15.63,18,56.25,7,87.5,4,50,4,50,3,37.5,12,75,6,37.5,77.56,77.5,74.75,77.38,80.62,77.06,78.06,-40.62,21.31,-10,24.75,27.38,43.12,2.06,40.56,1,0,5,1,0,1,0,0,4,0,1,0,1,1,1,5,6,6,6,6,3,0,1,4,0,0,0,0,5,0,0,0,5,3,0,5,6,5,5,0,1.4,1,0.8,5.8,1.6,1,1.6,4.2,2.25,2.1,2.67,1.67,2,2,-1,0,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,24,1.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-2,0,4,-3,0,1,0,0,-1,0,1,0,-4,-2,1,0,0,1,1,6,-0.2,0,-0.8,1.6,0.15 +1009,R_36v6o7qFq7ACuwF,39 - 45,Canadian,Male,-2,2,2,0,2,-3,0,0,0,2,3,1,3,0,2,0,-1,-3,-3,-3,-2,2,2,-2,2,4,-2,0,2,-2,2,2,2,2,2,0,2,7,-3,-3,0,-2,-3,5,-2,2,2,-2,2,7,0,-2,2,-3,2,4,2,2,2,0,2,3,0,0,0,0,-2,5,TRUE,0,75,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,75,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,90,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,TRUE,1,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.09,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.25,0.25,0.25,0.25,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.259821429,0.207321429,0.312321429,8,25,17,53.13,6,75,3,37.5,3,37.5,5,62.5,8,50,9,56.25,55,50,58.12,53.12,58.75,55.31,54.69,-28.13,1.87,-25,20.62,15.62,-3.75,5.31,-1.56,0,0,0,2,0,1,0,2,2,0,1,1,1,0,0,3,2,3,1,0,0,0,0,2,0,3,2,2,3,0,1,1,1,0,0,0,1,3,3,1,0.4,1,0.6,1.8,0.4,2,0.6,1.6,0.95,1.15,4.33,4.67,-3,-2,4,0,-0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,41,1.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,-2,-2,0,-1,0,0,0,0,0,0,3,1,0,-2,-1,0,-1,0,0.2,-0.2 +1010,R_7PTUw4FzGaZ5mzi,32 - 38,American,Female,2,2,1,1,3,-3,-2,3,1,3,0,0,3,3,3,-3,-1,-3,-3,-3,3,3,-2,3,-2,10,0,-3,3,-3,-3,10,-2,-3,3,-1,-3,8,2,1,1,2,1,10,3,-2,-2,3,3,10,2,-3,3,-3,3,10,3,-3,3,3,3,8,3,3,3,3,3,10,TRUE,0,75,FALSE,0,50,TRUE,0,95,TRUE,0,50,TRUE,1,60,FALSE,1,90,TRUE,1,93,TRUE,1,98,FALSE,0,50,TRUE,1,56,FALSE,1,54,TRUE,0,90,FALSE,0,55,TRUE,0,70,TRUE,1,71,TRUE,1,70,TRUE,0,91,TRUE,0,94,TRUE,0,55,TRUE,0,50,TRUE,1,75,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,76,TRUE,1,75,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,65,0.0004,0.0625,0.09,0.0049,0.1225,0.01,0.25,0.1936,0.25,0.25,0,0.3025,0.25,0.2116,0.16,0.25,0.25,0.25,0.25,0.5776,0.0625,0.0841,0.3025,0.49,0.8281,0.25,0.25,0.5625,0.9025,0.8836,0.25,0.81,0.330485714,0.196442857,0.464528571,9,28.13,16,50,3,37.5,6,75,3,37.5,4,50,10,62.5,6,37.5,67.44,53.75,67,73.62,75.38,66.75,68.12,-21.87,17.44,16.25,-8,36.12,25.38,4.25,30.62,1,1,3,2,5,3,1,0,4,6,2,3,0,4,6,5,2,4,5,4,1,4,3,2,0,5,1,0,4,0,3,3,0,0,0,6,4,6,6,6,2.4,2.8,3,4,2,2,1.2,5.6,3.05,2.7,9.33,9.33,0,0,0,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),33,1.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,-3,0,0,5,-2,0,0,0,6,-1,0,0,4,6,-1,-2,-2,-1,-2,0.4,0.8,1.8,-1.6,0.35 +1011,R_3P2dJHTAgH47mGE,32 - 38,American,Female,-1,2,2,3,-3,-3,-3,2,2,1,-1,-2,3,1,3,-3,-2,-2,-2,-3,2,2,2,2,1,4,-3,-3,1,3,-2,4,3,3,-3,3,3,8,-3,-3,-3,-3,-3,6,0,2,2,2,1,5,-3,-3,3,-2,2,7,-1,-2,3,-1,3,3,-1,-1,-1,-1,-1,3,TRUE,0,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,65,TRUE,1,100,TRUE,0,70,TRUE,0,100,FALSE,1,75,FALSE,1,50,TRUE,1,80,TRUE,1,100,TRUE,0,100,TRUE,1,75,FALSE,1,75,FALSE,0,100,FALSE,1,50,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,75,0,1,0,0,0.0625,0,0.0625,0,0.25,0,0,0,0,1,0.16,0.25,1,0.25,0.0625,0.0625,0.04,0.1225,0.0625,1,0.49,0.25,0.25,0.25,0,1,1,0.25,0.28125,0.216785714,0.345714286,16,50,22,68.75,5,62.5,5,62.5,4,50,8,100,13,81.25,9,56.25,81.25,67.5,85.62,90.62,81.25,84.69,77.81,-18.75,12.5,5,23.12,40.62,-18.75,3.44,21.56,3,0,0,1,4,0,0,1,1,3,4,5,6,2,0,0,1,1,1,0,1,0,0,1,4,0,0,1,4,1,0,0,0,2,0,2,1,1,1,2,1.6,1,3.4,0.6,1.2,1.2,0.4,1.4,1.65,1.05,5.33,5,-1,-3,5,3,0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),35,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,2,0,0,0,0,0,0,0,-3,2,4,5,6,0,0,-2,0,0,0,-2,0.4,-0.2,3,-0.8,0.6 +1012,R_1VIW1mgSS6FAif9,18 - 24,American,Female,3,2,3,2,2,0,0,1,2,2,1,0,1,1,1,2,2,2,1,2,3,3,3,3,1,7,1,2,1,3,1,10,2,2,2,1,2,10,-2,-2,-1,-3,-3,10,2,3,3,2,3,10,1,1,3,0,3,10,1,3,3,2,1,10,3,3,3,3,1,10,TRUE,0,68,FALSE,0,63,TRUE,0,100,TRUE,0,66,TRUE,1,56,TRUE,0,72,TRUE,1,88,TRUE,1,60,TRUE,1,59,FALSE,0,55,TRUE,0,66,TRUE,0,100,TRUE,1,61,TRUE,0,100,TRUE,1,61,FALSE,0,56,TRUE,0,84,TRUE,0,93,TRUE,0,59,TRUE,0,57,TRUE,1,79,TRUE,1,61,FALSE,1,59,TRUE,1,59,FALSE,1,100,TRUE,1,67,FALSE,1,59,TRUE,0,87,TRUE,0,72,TRUE,1,100,TRUE,1,64,TRUE,1,100,0.16,0.1089,0.3136,0.0144,0,0.5184,0.1681,0.3025,0.3249,0.1521,0,0.1521,0.1681,0.4356,0.1936,0.3969,0.1681,0.4356,0.7569,0,0.0441,0.1521,0.3481,1,0.7056,0.1681,0.1296,0.4624,1,0.8649,0.5184,1,0.377364286,0.244,0.510728571,12,37.5,16,50,4,50,5,62.5,4,50,3,37.5,13,81.25,3,18.75,72.84,62.12,72.88,79,77.38,68.06,77.62,-12.5,22.84,12.12,10.38,29,39.88,-13.19,58.87,0,1,0,1,1,1,2,0,1,1,1,2,1,0,1,4,4,3,4,5,1,1,0,0,1,1,1,2,2,1,0,3,2,1,0,1,1,1,2,1,0.6,1,1,4,0.6,1.4,1.2,1.2,1.65,1.1,9,10,-3,0,0,0,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),23,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,-1,0,0,1,0,0,1,-2,-1,0,1,-1,-1,-1,1,3,3,2,2,4,0,-0.4,-0.2,2.8,0.55 +1013,R_7EFdT2zk09C5KRq,32 - 38,American,Female,3,3,3,3,-1,-2,-3,3,-3,2,0,-3,3,2,2,2,2,3,2,3,3,3,3,3,-2,0,-3,-3,3,-3,1,0,0,-3,3,2,3,0,2,2,2,2,3,0,3,3,3,3,-2,0,-3,-3,3,-3,0,0,0,-3,3,2,2,0,2,2,2,2,3,0,TRUE,0,85,FALSE,0,59,TRUE,0,80,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,62,TRUE,1,50,TRUE,1,50,TRUE,1,84,TRUE,0,50,TRUE,0,100,TRUE,1,71,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,80,TRUE,0,61,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,50,TRUE,0,72,FALSE,1,50,TRUE,1,85,FALSE,0,50,TRUE,1,100,0.25,0.0576,0.25,0.1444,0,0.25,0.25,0.0256,0.25,0.25,0.0225,0.0841,0.25,0.25,0.25,0.3481,0.25,0.25,0.5184,0,0.25,0.25,0.25,0.25,0.64,0.25,0.25,0.7225,0.64,0.3721,0.25,1,0.299046429,0.195021429,0.403071429,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,62.97,51.12,62.62,71,67.12,61.69,64.25,-12.5,0.47,-11.38,-12.38,8.5,17.12,-7.06,8,0,0,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0.2,0.4,0.2,0.2,0.2,0.6,0,0.2,0.25,0.25,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,35,-1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,0,0,-0.2,0.2,0,0 +1014,R_1Rw3ETd8Vs3nQjm,25 - 31,American,Female,3,3,3,3,2,0,-2,-1,1,1,1,1,2,2,1,-1,0,0,-1,-3,3,1,1,2,-1,4,3,-2,1,-1,1,4,2,1,1,1,1,4,-2,-1,-2,-2,-2,3,2,2,2,3,2,6,-1,1,1,3,1,6,-1,1,2,1,0,5,-2,-2,-2,-1,-2,5,FALSE,1,100,TRUE,1,79,FALSE,1,93,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,62,TRUE,1,84,TRUE,1,50,FALSE,0,73,FALSE,1,67,FALSE,1,50,TRUE,1,67,FALSE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,50,FALSE,1,64,FALSE,1,66,FALSE,1,50,TRUE,1,90,TRUE,1,96,FALSE,1,100,FALSE,0,58,FALSE,1,100,TRUE,1,88,TRUE,0,50,FALSE,1,63,TRUE,0,100,TRUE,1,78,TRUE,1,72,TRUE,1,95,0.0256,0.0144,0,0.1444,0.0025,0,0.3364,0.5329,0.25,0.0016,0.0484,0.1089,0.25,0.1089,0,0.0441,0,0.25,0.1369,0,0.01,0.2704,0.1156,0,0.25,0.25,0.0784,0,0.0049,0.1296,1,0.25,0.158196429,0.138121429,0.178271429,24,75,26,81.25,6,75,6,75,7,87.5,7,87.5,13,81.25,13,81.25,76.47,60.75,87.75,85.38,72,77.75,75.19,-6.25,-4.78,-14.25,12.75,-2.12,-15.5,-3.5,-6.06,0,2,2,1,3,3,0,2,2,0,1,0,1,1,0,1,1,2,1,1,1,1,1,0,0,1,3,2,2,0,2,0,0,1,1,1,2,2,0,1,1.6,1.4,0.6,1.2,0.6,1.6,0.8,1.2,1.2,1.05,4,5.67,-2,-2,-1,-2,-1.67,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,29,0.375,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,-1,1,1,1,3,2,-3,0,0,0,-1,0,1,0,-1,0,-1,0,1,0,1,-0.2,-0.2,0,0.15 +1015,R_1d6tdK2seeQDtXb,32 - 38,American,Female,3,3,-1,0,0,-2,-1,1,-1,1,0,0,2,0,3,-1,-1,0,-1,-1,3,3,-1,-1,0,4,-2,1,-1,0,0,6,-1,0,2,0,3,5,-1,-1,-1,-1,-1,5,3,3,-1,0,0,5,-1,-2,1,0,0,5,0,0,3,0,3,6,0,0,0,0,-1,5,TRUE,0,100,FALSE,0,50,FALSE,1,75,TRUE,0,50,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,75,TRUE,1,97,TRUE,0,95,FALSE,0,50,TRUE,1,91,TRUE,0,82,TRUE,0,88,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,95,TRUE,1,91,FALSE,1,50,FALSE,1,98,TRUE,0,74,TRUE,1,80,FALSE,0,50,TRUE,1,88,0,0.0081,0.0081,0,0.0144,0,0.01,0.0625,0.25,0,0.04,0.0009,0.25,0.25,0.0081,0.25,0,0.25,0.0004,0.9025,1,0.25,0.25,0.9025,0.6724,0.25,0.25,1,0.0625,0.7744,0.5476,0.5625,0.314667857,0.098992857,0.530342857,17,53.13,19,59.38,3,37.5,5,62.5,4,50,7,87.5,11,68.75,8,50,79.22,50,91.5,93,82.38,81.44,77,-6.25,19.84,12.5,29,43,-5.12,12.69,27,0,0,0,1,0,0,2,2,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0.2,1.2,0.2,0.2,0,0.8,0.2,0.6,0.45,0.4,5,5.33,-1,1,-1,0,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,1,0,-1,1,2,0,0,1,0,-1,0,0,-1,-1,1,-1,0,0.2,0.4,0,-0.4,0.05 +1016,R_7g17tPigzefh9gq,32 - 38,American,Female,2,1,1,-1,1,-3,1,1,1,0,1,1,1,1,1,-2,0,0,0,-1,1,1,1,0,-1,4,-3,1,1,1,-1,4,1,1,1,1,1,3,-3,-2,-2,-2,-2,8,2,2,1,-1,2,4,0,0,1,1,1,2,1,0,1,1,1,3,1,1,1,1,0,8,TRUE,0,89,TRUE,1,77,TRUE,0,92,TRUE,0,50,TRUE,1,70,FALSE,1,82,TRUE,1,91,TRUE,1,94,TRUE,1,50,TRUE,1,82,FALSE,1,50,TRUE,0,85,TRUE,1,76,FALSE,1,60,TRUE,1,60,TRUE,1,82,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,71,TRUE,1,92,FALSE,1,82,TRUE,1,83,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,92,TRUE,1,50,TRUE,1,86,0.0036,0.0289,0.0324,0.0081,0.0196,0.0324,0.0064,0.0324,0.25,0.25,0.0064,0.0576,0.25,0.25,0.09,0.0529,0.0841,0.25,0.25,0.0324,0.25,0.16,0.25,0.16,0.25,0.25,0.25,0.7921,0.8464,0.25,0.25,0.7225,0.226614286,0.116557143,0.336671429,27,84.38,22,68.75,6,75,5,62.5,6,75,5,62.5,15,93.75,7,43.75,68.62,54.62,66.88,73.38,79.62,74.06,63.19,15.63,-0.13,-20.38,4.38,-1.62,17.12,-19.69,19.44,1,0,0,1,2,0,0,0,0,1,0,0,0,0,0,1,2,2,2,1,0,1,0,0,1,3,1,0,0,1,0,1,0,0,0,3,1,1,1,1,0.8,0.2,0,1.6,0.4,1,0.2,1.4,0.65,0.75,3.67,3,0,2,0,0,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,1,-1,0,1,1,-3,-1,0,0,0,0,-1,0,0,0,-2,1,1,1,0,0.4,-0.8,-0.2,0.2,-0.1 +1017,R_7rAlOlV8H83Wb4g,32 - 38,American,Female,3,3,2,2,2,0,0,3,0,2,2,0,3,0,3,0,0,0,0,0,3,3,3,3,3,5,0,0,0,0,3,5,0,0,3,0,3,5,-3,-3,-3,-3,-3,5,3,3,3,3,3,5,0,0,3,0,3,5,0,0,3,0,3,5,0,0,0,0,0,5,FALSE,1,57,TRUE,1,59,TRUE,0,100,FALSE,1,55,TRUE,1,59,FALSE,1,56,TRUE,1,78,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,96,FALSE,1,54,TRUE,1,57,TRUE,1,58,TRUE,0,59,TRUE,0,100,TRUE,0,64,FALSE,1,100,FALSE,0,52,FALSE,0,55,FALSE,1,100,TRUE,1,58,TRUE,0,83,TRUE,1,77,FALSE,1,53,TRUE,0,57,TRUE,0,83,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0.0529,0.1764,0.0484,0,0.1936,0.1764,0,0,0.3025,0,0.0016,0,0.1849,0.1681,0.1681,0,0.2025,0.3249,0.6889,0.2704,0.1849,0.4096,0.2116,0.3481,0.2209,0.3364,0.1849,1,1,0.6889,1,0.295257143,0.099835714,0.490678571,4,12.5,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,74.53,62.88,75.62,75.5,84.12,75.44,73.62,-53.13,8.9,-12.12,13.12,13,21.62,-5.81,23.62,0,0,1,1,1,0,0,3,0,1,2,0,0,0,0,3,3,3,3,3,0,0,1,1,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0.6,0.8,0.4,3,0.6,0.2,0.4,0,1.2,0.3,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Female,Professional Degree (ex. JD/MD),37,0.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,3,3,3,3,0,0.6,0,3,0.9 +1018,R_7LXDbn4zZiDJuc9,32 - 38,American,Female,2,3,2,3,3,2,3,3,3,2,3,2,3,2,3,2,3,3,2,3,1,2,3,3,2,4,3,3,3,2,2,3,3,2,3,2,1,3,3,3,2,3,2,9,2,2,3,3,3,5,3,3,2,3,2,7,2,3,3,3,2,5,3,2,3,2,3,6,FALSE,1,100,FALSE,0,91,TRUE,0,79,FALSE,1,77,TRUE,1,99,FALSE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,99,FALSE,1,99,TRUE,0,100,TRUE,1,83,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,91,TRUE,1,100,FALSE,0,98,TRUE,1,98,0,0,0,0,0.0004,0.0001,0.0001,0.0001,1,0,0,0.0289,0.0081,0.0001,0.0001,0.8281,1,0.0529,1,0,0,0,0,1,0,0,0.9604,0,0.6241,1,0.0081,1,0.303982143,0.208492857,0.399471429,25,78.13,23,71.88,6,75,7,87.5,6,75,4,50,14,87.5,9,56.25,96.97,94.5,96.25,99.88,97.25,97.38,96.56,6.25,25.09,19.5,8.75,24.88,47.25,9.88,40.31,1,1,1,0,1,1,0,0,1,0,0,0,0,0,2,1,0,1,1,1,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,1,0,0,0,0.8,0.4,0.4,0.8,0.4,0.4,0.8,0.4,0.6,0.5,3.33,5.67,-1,-4,-2,3,-2.34,10 cents,25 minutes,47 days,Female,High School (or equivalent),37,-0.5,0,0,1,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,1,0,0,0,1,0,0,-1,1,0,-1,-1,0,-1,1,0,-1,1,1,1,0.4,0,-0.4,0.4,0.1 +1019,R_1aQckAe7IKkR5Sh,25 - 31,Canadian,Male,1,2,3,2,-3,-2,1,-2,2,0,1,3,1,-1,2,-1,0,-1,1,-3,2,2,2,2,0,2,-3,-1,-3,1,-3,6,1,3,0,0,2,0,-1,-1,-1,-1,-1,2,2,3,2,3,1,4,0,1,0,1,0,3,1,2,2,0,2,4,-1,-1,-1,1,-1,4,TRUE,0,73,TRUE,1,88,FALSE,1,79,FALSE,1,55,TRUE,1,62,FALSE,1,81,TRUE,1,92,TRUE,1,67,TRUE,1,84,TRUE,1,97,FALSE,1,100,FALSE,1,83,TRUE,1,53,TRUE,0,100,TRUE,1,85,TRUE,1,99,FALSE,1,100,FALSE,1,95,FALSE,1,81,FALSE,1,86,TRUE,1,100,TRUE,1,70,FALSE,1,66,TRUE,1,97,FALSE,1,74,TRUE,1,92,TRUE,0,51,FALSE,1,70,FALSE,1,83,FALSE,0,82,FALSE,0,71,TRUE,1,100,0.1089,0.0064,0.0001,0.0064,0,0.0361,0.0009,0.0009,0.0196,0.09,0.6724,0.2209,0.0256,0,0.1444,0.0144,0.1156,0.2025,0.09,0.0676,0,0.0225,0.0361,1,0,0.2601,0.5041,0.5329,0.0441,0.0025,0.0289,0.0289,0.148607143,0.110235714,0.186978571,26,81.25,27,84.38,6,75,8,100,6,75,7,87.5,14,87.5,13,81.25,81.75,76.88,80.62,86.62,82.88,83.69,79.81,-3.13,-2.63,1.88,-19.38,11.62,-4.62,-3.81,-1.44,1,0,1,0,3,1,2,1,1,3,0,0,1,1,0,0,1,0,2,2,1,1,1,1,4,2,0,2,1,0,0,1,1,1,0,0,1,0,0,2,1,1.6,0.4,1,1.6,1,0.6,0.6,1,0.95,2.67,3.67,-2,3,-4,-2,-1,5 cents,5 minutes,47 days,Male,University - Undergraduate,25,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,-1,0,-1,-1,-1,2,-1,0,3,0,-1,0,0,0,0,0,0,2,0,-0.6,0.6,-0.2,0.4,0.05 +1020,R_1dXtGZIn3kCFmTt,32 - 38,American,Female,1,1,3,3,3,-1,-2,0,0,1,0,-3,1,0,3,1,1,2,3,-3,-2,3,3,-2,3,10,1,1,1,1,1,5,-3,3,3,3,-3,10,-1,-2,1,-3,3,10,3,3,3,3,3,5,0,0,2,-2,0,5,0,-3,1,0,1,4,3,3,3,3,-3,5,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,71,TRUE,0,100,TRUE,1,75,TRUE,0,50,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,100,TRUE,0,80,FALSE,1,50,TRUE,1,71,TRUE,1,50,FALSE,1,50,TRUE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,50,TRUE,0,76,TRUE,0,80,TRUE,1,100,FALSE,0,50,TRUE,1,85,0,0,0.0576,0.0576,0.0225,0,0,0,0.25,0.25,0,0.0625,0.25,0.0841,0.25,0.25,0.25,0.25,0.5776,0.7225,0.0841,0.25,0.64,0.25,0.25,0.25,0.25,0.25,0,1,0.64,1,0.288689286,0.137078571,0.4403,16,50,20,62.5,5,62.5,5,62.5,4,50,6,75,13,81.25,7,43.75,72.66,56.38,70.12,76.38,87.75,73.94,71.38,-12.5,10.16,-6.12,7.62,26.38,12.75,-7.31,27.63,3,2,0,5,0,2,3,1,1,0,3,6,2,3,6,2,3,1,6,6,2,2,0,0,0,1,2,2,2,1,0,0,0,0,2,2,2,1,0,0,2,1.4,4,3.6,0.8,1.6,0.4,1,2.75,0.95,8.33,4.67,5,0,6,5,3.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),36,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,1,0,0,5,0,1,1,-1,-1,-1,3,6,2,3,4,0,1,0,6,6,1.2,-0.2,3.6,2.6,1.8 +1021,R_1rkBy9CAGranra9,32 - 38,Canadian,Male,1,1,1,0,1,1,-1,-1,0,1,0,0,1,1,3,-1,0,0,1,-2,1,1,1,0,1,4,0,-1,0,0,1,3,0,1,1,1,2,4,2,0,0,0,-1,5,1,1,1,1,0,4,0,1,0,1,0,5,0,1,1,1,2,4,-1,-1,-1,0,-2,6,TRUE,0,85,FALSE,0,50,FALSE,1,55,FALSE,1,50,TRUE,1,65,FALSE,1,65,TRUE,1,55,TRUE,1,60,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,70,TRUE,1,55,FALSE,1,90,TRUE,1,55,TRUE,1,98,FALSE,1,55,TRUE,0,70,TRUE,0,55,FALSE,1,60,TRUE,1,90,TRUE,1,85,FALSE,1,50,TRUE,1,50,FALSE,1,55,FALSE,0,55,TRUE,0,50,FALSE,1,55,FALSE,1,50,FALSE,0,60,FALSE,0,50,TRUE,1,80,0.16,0.3025,0.0004,0.2025,0.04,0.1225,0.25,0.1225,0.16,0.0225,0.36,0.2025,0.25,0.25,0.1225,0.25,0.25,0.25,0.2025,0.2025,0.01,0.2025,0.3025,0.01,0.2025,0.25,0.25,0.7225,0.2025,0.49,0.25,0.09,0.215714286,0.189464286,0.241964286,18,56.25,23,71.88,3,37.5,8,100,5,62.5,7,87.5,11,68.75,12,75,62.12,51.25,63.75,70,63.5,63.94,60.31,-15.63,-9.76,13.75,-36.25,7.5,-24,-4.81,-14.69,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,3,0,0,1,1,0,0,0,1,1,1,2,1,1,1,0,1,0,0,1,0,1,1,1,0,0,0.4,0.4,1,0.4,1.2,0.4,0.6,0.45,0.65,3.67,4.33,0,-2,0,-1,-0.66,5 cents,5 minutes,47 days,Male,University - Undergraduate,37,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,-1,0,-2,0,-1,-1,0,0,0,0,0,3,-1,-1,0,1,-0.4,-0.8,0,0.4,-0.2 +1022,R_6p3WA5U38zr1qOW,32 - 38,American,Female,1,2,2,1,0,-3,0,2,2,0,0,0,2,0,2,1,0,1,0,-1,2,3,2,1,1,5,-3,0,1,3,0,5,0,0,1,0,1,5,-1,-1,-3,-2,-3,5,0,3,2,0,2,5,-2,0,2,1,0,5,0,2,2,0,2,5,2,0,1,1,0,5,TRUE,0,53,FALSE,0,50,TRUE,0,86,FALSE,1,59,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,85,TRUE,1,64,TRUE,1,100,FALSE,1,62,TRUE,0,81,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,80,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,0,74,FALSE,0,50,FALSE,1,50,TRUE,1,85,FALSE,1,50,TRUE,0,69,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,0.0225,0.0225,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.04,0.1296,0.1444,0.25,0.25,0.5476,0.1681,0.4761,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.7396,0.64,0.25,0.6561,0.272675,0.19855,0.3468,6,18.75,19,59.38,5,62.5,6,75,4,50,4,50,9,56.25,10,62.5,62.59,54.38,66.12,64.75,65.12,61.81,63.38,-40.63,3.21,-8.12,-8.88,14.75,15.12,5.56,0.88,1,1,0,0,1,0,0,1,1,0,0,0,1,0,1,2,1,4,2,2,1,1,0,1,2,1,0,0,1,0,0,2,0,0,0,1,0,0,1,1,0.6,0.4,0.4,2.2,1,0.4,0.4,0.6,0.9,0.6,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),32,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-1,-1,-1,0,1,0,0,0,-2,1,0,1,1,1,4,1,1,-0.4,0,0,1.6,0.3 +1023,R_5jqsnVaFyqCV394,32 - 38,American,Female,2,3,3,-3,-1,-3,0,-1,-1,1,-1,-3,3,1,3,-3,-2,-3,-2,-3,3,3,3,-3,1,4,-3,1,-2,1,1,6,2,-2,3,1,3,5,-3,-3,-3,1,-3,8,3,3,3,1,-1,2,-3,-2,2,-3,2,3,-2,-2,3,1,3,3,2,2,3,3,-2,10,FALSE,1,100,FALSE,0,68,TRUE,0,67,TRUE,0,70,TRUE,1,100,FALSE,1,74,TRUE,1,100,TRUE,1,93,TRUE,1,96,TRUE,1,90,FALSE,1,67,TRUE,0,100,TRUE,1,75,TRUE,0,78,TRUE,1,72,TRUE,1,91,FALSE,1,70,TRUE,0,68,TRUE,0,73,FALSE,1,50,TRUE,1,86,TRUE,1,70,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,1,76,FALSE,1,60,FALSE,0,76,FALSE,0,55,TRUE,1,100,0.0049,0.04,0.0081,0,0,0.0676,0,0.01,0.25,0.09,0.5776,0.0625,0.0016,0.1089,0,0.4624,0.0625,0.49,0.0576,0,0.0196,0.0784,0.5329,0.6084,0.09,0.25,0.3025,0,0.4489,0.4624,0.16,1,0.221207143,0.155935714,0.286478571,21,65.63,23,71.88,4,50,8,100,6,75,5,62.5,13,81.25,10,62.5,79.06,68.88,80,85.75,81.62,84.5,73.62,-6.25,7.18,18.88,-20,10.75,19.12,3.25,11.12,1,0,0,0,2,0,1,1,2,0,3,1,0,0,0,0,1,0,3,0,1,0,0,4,0,0,2,3,2,1,1,1,0,0,0,5,4,6,5,1,0.6,0.8,0.8,0.8,1,1.6,0.4,4.2,0.75,1.8,5,2.67,2,3,2,-2,2.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,33,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-4,2,0,-1,-2,0,-1,2,0,0,0,0,-5,-3,-6,-2,-1,-0.4,-0.8,0.4,-3.4,-1.05 +1024,R_7DZP5dCxwcF7leI,32 - 38,American,Female,2,3,1,0,1,-1,-1,0,0,0,1,1,2,-1,2,0,0,0,0,0,2,3,2,0,2,4,-1,-1,0,0,0,3,2,1,2,-1,2,3,0,0,0,0,0,4,2,2,2,0,2,2,0,-1,0,0,1,3,2,2,2,-1,2,3,0,0,0,0,0,4,TRUE,0,56,TRUE,1,50,FALSE,1,69,FALSE,1,50,TRUE,1,61,FALSE,1,100,TRUE,1,66,TRUE,1,65,TRUE,1,50,TRUE,1,61,FALSE,1,50,TRUE,0,66,TRUE,1,50,FALSE,1,88,TRUE,1,50,TRUE,1,99,TRUE,0,54,FALSE,1,50,TRUE,0,54,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,91,FALSE,1,93,TRUE,1,64,FALSE,1,50,FALSE,1,50,TRUE,0,67,TRUE,1,53,FALSE,0,50,TRUE,1,100,0.1225,0.1296,0.0001,0.1156,0,0,0.0081,0.1521,0.25,0.25,0.2209,0.25,0.25,0.25,0.1521,0.25,0,0.25,0.25,0.0049,0.25,0.25,0.2916,0.0144,0.2916,0.25,0.25,0.3136,0.0961,0.25,0.4489,0.4356,0.202853571,0.163085714,0.242621429,14,43.75,25,78.13,6,75,5,62.5,7,87.5,7,87.5,14,87.5,11,68.75,64.28,50.5,72.75,66,67.88,63.12,65.44,-34.38,-13.85,-24.5,10.25,-21.5,-19.62,-24.38,-3.31,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0.4,0,0.2,0,0.6,0.4,0.4,0,0.15,0.35,3.33,2.67,2,0,0,0,0.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,-1,0,0,0,-1,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,-0.2,-0.4,-0.2,0,-0.2 +1025,R_5WmT9o59K4UskO5,25 - 31,American,Female,3,1,2,3,3,3,2,3,1,3,3,2,3,3,3,3,2,3,3,3,3,3,3,3,3,0,3,3,3,2,3,0,3,3,3,2,3,1,3,3,3,3,3,1,3,3,3,3,3,0,3,3,3,2,3,0,3,3,3,3,3,0,3,3,3,3,3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.0004,0,0,0,0,1,0,0,0,0,0,0,0.36,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0.191442857,0.097171429,0.285714286,32,100,26,81.25,6,75,8,100,7,87.5,5,62.5,14,87.5,12,75,98.69,95,99.75,100,100,100,97.38,18.75,17.44,20,-0.25,12.5,37.5,12.5,22.38,0,2,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,2,1,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0.6,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0.4,0.35,0.33,0,0,0,1,1,0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),26,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0.2,0,0.05 +1026,R_6exAZhaAxlvYZc2,32 - 38,Canadian,Male,2,2,2,-1,2,1,-2,2,-1,1,1,2,2,1,1,1,2,2,2,1,2,2,2,-2,2,6,1,-2,2,0,1,6,2,1,2,2,2,7,-1,2,1,-1,-1,8,2,2,2,-1,2,6,1,-1,2,-1,1,6,2,1,2,0,2,6,2,2,2,2,1,6,TRUE,0,81,FALSE,0,50,TRUE,0,76,FALSE,1,50,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,62,TRUE,1,100,TRUE,0,85,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,100,TRUE,0,59,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,70,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,100,TRUE,0,70,FALSE,0,79,TRUE,1,68,TRUE,1,100,0,0.0064,0,0,0,0,0.25,0,0.25,0,0.6241,0,0.1444,0.7225,0.0225,0.25,0.25,0.25,0,0,0.09,0.09,0.25,1,0.3481,0.25,0.1024,0.6561,0.5776,0,0.49,0.8281,0.265921429,0.197392857,0.33445,23,71.88,22,68.75,6,75,6,75,6,75,4,50,13,81.25,9,56.25,79.31,60.62,79.25,96.62,80.75,82.88,75.75,3.13,10.56,-14.38,4.25,21.62,30.75,1.63,19.5,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,2,0,1,3,2,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0.2,0.2,0.8,1.6,0,0.2,0.8,0.2,0.7,0.3,6.33,6,0,0,1,2,0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,32,1,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,1,0,0,-1,0,1,0,0,0,0,0,0,1,0,1,3,2,0.2,0,0,1.4,0.4 +1027,R_7xJjBlv5ONJ8eTV,32 - 38,Canadian,Male,-2,1,1,2,0,-1,-1,1,-2,0,1,-1,1,0,0,0,-1,-1,0,0,-2,1,2,2,0,2,-2,-2,1,-2,0,2,1,0,1,0,1,3,-1,-1,-1,-1,-1,4,-1,0,2,2,0,2,0,-2,1,0,1,3,0,0,0,0,0,2,0,0,0,0,-1,2,TRUE,0,73,FALSE,0,73,FALSE,1,70,FALSE,1,64,FALSE,0,66,FALSE,1,73,TRUE,1,74,TRUE,1,76,FALSE,0,77,TRUE,1,83,FALSE,1,67,TRUE,0,76,TRUE,1,63,TRUE,0,81,FALSE,0,63,TRUE,1,74,TRUE,0,64,FALSE,1,64,TRUE,0,71,FALSE,1,61,TRUE,1,61,FALSE,0,74,TRUE,0,67,TRUE,1,73,FALSE,1,70,TRUE,1,66,TRUE,0,66,TRUE,0,81,FALSE,1,60,TRUE,1,100,FALSE,0,75,TRUE,1,100,0.0576,0.1156,0.0676,0.0676,0,0.0729,0.0729,0.0289,0.1521,0.5476,0,0.1369,0.5929,0.1089,0.4356,0.5329,0.4489,0.1296,0.6561,0.09,0.1521,0.3969,0.5041,0.6561,0.4096,0.4356,0.5625,0.5329,0.09,0.1296,0.16,0.5776,0.307614286,0.232864286,0.382364286,17,53.13,18,56.25,2,25,5,62.5,5,62.5,6,75,10,62.5,8,50,72.06,69.5,69.25,73.12,76.38,74.88,69.25,-3.12,15.81,44.5,6.75,10.62,1.38,12.38,19.25,0,0,1,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,1,1,1,1,0,0,1,1,0,2,1,1,1,1,0,0,0,1,1,0,1,0.2,0.4,0.4,0.6,0.6,1,0.6,0.6,0.4,0.7,2.33,2.33,0,-1,1,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,37,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,-1,0,0,0,0,0,0,-2,-1,-1,0,-1,0,1,1,-1,-1,1,0,-0.4,-0.6,-0.2,0,-0.3 +1028,R_5UadrYih4hlHoMK,25 - 31,American,Female,1,3,2,3,2,-1,3,2,-1,2,3,3,2,1,3,-1,-1,0,0,-1,-1,3,3,3,0,7,1,-1,1,1,1,7,1,1,2,0,3,8,1,0,1,1,0,8,-1,3,3,2,3,8,2,2,3,-1,2,7,3,3,2,1,1,7,2,1,1,2,1,6,FALSE,1,94,TRUE,1,94,TRUE,0,99,FALSE,1,68,TRUE,1,66,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,0,100,TRUE,0,100,TRUE,1,72,FALSE,1,91,TRUE,1,60,TRUE,1,89,TRUE,0,55,TRUE,0,78,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,87,TRUE,1,68,TRUE,0,67,TRUE,1,68,FALSE,1,62,FALSE,1,75,TRUE,0,100,TRUE,1,69,TRUE,1,84,TRUE,1,100,0,0.1024,0.0121,0,0,0,0.1024,0.0001,1,0,0.0961,0.0784,0,1,0.1156,0.0036,0.0169,0.1024,0.0625,0.4489,0,0.16,1,0.0081,0.3025,0.1444,0.0256,0.0036,0.9801,0.6084,1,1,0.294985714,0.179678571,0.410292857,21,65.63,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,85.78,83.5,85,87.12,87.5,85.56,86,-6.25,13.9,8.5,10,12.12,25,-14.44,42.25,2,0,1,0,2,2,4,1,2,1,2,2,0,1,0,2,1,1,1,1,2,0,1,1,1,3,1,1,0,0,0,0,0,0,2,3,2,1,2,2,1,2,1,1.2,1,1,0.4,2,1.3,1.1,7.33,7.33,-1,0,1,2,0,5 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),29,0,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,-1,1,-1,3,0,2,1,2,2,0,1,-2,-1,-1,0,-1,-1,0,1,0.6,-0.8,0.2 +1029,R_71XWLkqv67mo4XO,18 - 24,American,Female,-2,3,3,-1,3,0,2,-3,3,1,-3,-1,3,3,1,-3,-3,-3,-3,-3,1,3,2,-3,3,10,3,3,-3,3,3,10,-3,3,-3,3,-3,10,1,0,0,-3,-3,10,-3,3,3,-1,1,2,0,2,-1,0,2,7,0,0,2,1,0,6,0,2,1,-2,-1,7,FALSE,1,100,TRUE,1,64,FALSE,1,89,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,85,FALSE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,FALSE,1,100,FALSE,0,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,FALSE,0,87,FALSE,0,50,TRUE,1,100,0,1,0.25,0,0,0,0.16,1,0.25,0,0.7569,0,0.25,0.25,0,0.1296,0,0.25,0,0,0,0.25,0.25,0.0676,0.25,0.25,0.25,0,0.0121,0.7225,1,0,0.217810714,0.217607143,0.218014286,25,78.13,19,59.38,2,25,6,75,5,62.5,6,75,10,62.5,9,56.25,79.97,51.75,93.75,94.88,79.5,81.94,78,18.75,20.59,26.75,18.75,32.38,4.5,19.44,21.75,3,0,1,2,0,3,1,0,0,2,0,4,6,0,4,4,3,3,0,0,1,0,0,0,2,0,0,2,3,1,3,1,1,2,1,3,5,4,1,2,1.2,1.2,2.8,2,0.6,1.2,1.6,3,1.8,1.6,10,5,8,3,4,3,5,5 cents,5 minutes,47 days,Female,High School (or equivalent),22,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,01DIR,2,0,1,2,-2,3,1,-2,-3,1,-3,3,5,-2,3,1,-2,-1,-1,-2,0.6,0,1.2,-1,0.2 +1030,R_3PjaFDfG3yfrr8e,32 - 38,American,Female,-3,2,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,-2,0,-3,2,1,0,3,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,4,FALSE,1,64,FALSE,0,68,FALSE,1,100,FALSE,1,62,FALSE,0,61,FALSE,1,100,TRUE,1,81,TRUE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,94,FALSE,1,71,TRUE,1,78,FALSE,1,100,TRUE,1,66,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,75,TRUE,0,71,FALSE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,81,FALSE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,74,TRUE,1,100,TRUE,1,100,0,0.0361,0,0.0361,0,0,0,0,0.5041,0,0.0676,0.0484,0.4225,0.0036,0.3721,0.4624,0,0.1444,1,0,0.8649,0.1156,0.0625,0,0.2916,0,0,0.1296,0,1,0.2916,0.0841,0.209464286,0.14465,0.274278571,14,43.75,23,71.88,6,75,4,50,7,87.5,6,75,12,75,11,68.75,84.75,78.75,80,90.75,89.5,85.44,84.06,-28.13,12.87,3.75,30,3.25,14.5,10.44,15.31,0,0,1,0,2,0,0,0,3,0,0,0,1,0,0,0,0,0,2,0,3,2,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0.6,0.6,0.2,0.4,1.6,0,0.2,0.4,0.45,0.55,0,6.67,0,-10,-10,-4,-6.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-3,-2,-1,0,1,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,-1,0.6,0,0,-0.1 +1031,R_1CKeGCl62iyVvge,18 - 24,Canadian,Male,2,3,3,2,3,-1,2,0,3,1,3,3,3,1,1,-2,-3,-1,-1,2,1,2,2,0,2,5,1,0,2,0,1,5,3,1,1,2,2,5,-2,-3,-1,-2,0,5,2,1,2,0,2,4,-1,0,0,3,1,7,3,1,2,1,1,8,-2,-3,-3,-3,-1,5,TRUE,0,100,TRUE,1,75,TRUE,0,80,FALSE,1,75,FALSE,0,50,TRUE,0,80,TRUE,1,90,FALSE,0,50,FALSE,0,70,FALSE,0,50,TRUE,0,80,TRUE,0,90,TRUE,1,85,FALSE,1,50,FALSE,0,50,TRUE,1,90,TRUE,0,75,TRUE,0,75,FALSE,1,64,FALSE,1,50,TRUE,1,75,TRUE,1,80,TRUE,0,75,FALSE,0,50,FALSE,1,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,80,TRUE,1,80,TRUE,1,85,0.25,0.09,0.01,0.01,0.0225,0.64,0.25,0.25,0.25,0.04,0.04,0.0225,0.49,0.64,0.25,0.0625,0.5625,0.0625,0.25,0.25,0.0625,0.25,0.1296,0.25,0.5625,0.25,0.04,1,0.64,0.5625,0.25,0.81,0.317485714,0.255892857,0.379078571,16,50,18,56.25,5,62.5,4,50,5,62.5,4,50,10,62.5,8,50,69.5,68,71.88,70.62,67.5,70.62,68.38,-6.25,13.25,5.5,21.88,8.12,17.5,8.12,18.38,1,1,1,2,1,2,2,2,3,0,0,2,2,1,1,0,0,0,1,2,0,2,1,2,1,0,2,0,0,0,0,2,1,0,0,0,0,2,2,3,1.2,1.8,1.2,0.6,1.2,0.4,0.6,1.4,1.2,0.9,5,6.33,1,-2,-3,0,-1.33,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,0.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,1,-1,0,0,0,2,0,2,3,0,0,0,1,1,1,0,0,-2,-1,-1,0,1.4,0.6,-0.8,0.3 +1032,R_6GOyOOfukQvdlML,32 - 38,Canadian,Male,-1,1,1,2,1,0,-1,0,0,1,0,0,-2,-1,1,-1,2,1,0,0,0,1,1,2,-1,7,0,1,-1,1,-1,10,1,-1,2,0,0,8,1,1,0,-1,0,8,-1,1,2,2,1,6,0,-1,-2,2,-1,7,0,1,0,-1,1,6,1,-1,-1,2,0,8,TRUE,0,87,TRUE,1,68,TRUE,0,90,TRUE,0,78,FALSE,0,72,FALSE,1,84,TRUE,1,93,TRUE,1,79,TRUE,1,91,FALSE,0,53,TRUE,0,81,TRUE,0,83,FALSE,0,69,TRUE,0,73,TRUE,1,79,TRUE,1,79,TRUE,0,80,FALSE,1,90,FALSE,1,90,FALSE,1,67,FALSE,0,91,TRUE,1,85,TRUE,0,90,FALSE,0,71,TRUE,0,87,FALSE,0,67,TRUE,0,79,FALSE,1,73,FALSE,1,74,TRUE,1,88,FALSE,0,76,TRUE,1,77,0.0441,0.4489,0.0441,0.0049,0.0529,0.0256,0.5041,0.2809,0.1089,0.0225,0.0144,0.4761,0.0081,0.6561,0.5184,0.1024,0.81,0.6084,0.0729,0.7569,0.8281,0.0441,0.01,0.5329,0.64,0.6241,0.5776,0.7569,0.81,0.01,0.0676,0.6889,0.378885714,0.2992,0.458571429,17,53.13,15,46.88,4,50,3,37.5,3,37.5,5,62.5,9,56.25,6,37.5,79.5,80.25,79.62,79.38,78.75,77.38,81.62,6.25,32.62,30.25,42.12,41.88,16.25,21.13,44.12,1,0,0,0,2,0,2,1,1,2,1,1,4,1,1,2,1,1,1,0,0,0,1,0,0,0,0,2,2,2,0,1,2,0,0,2,3,2,2,0,0.6,1.2,1.6,1,0.2,1.2,0.6,1.8,1.1,0.95,8.33,6.33,1,3,2,0,2,10 cents,25 minutes,24 days,Male,University - Undergraduate,36,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,1,0,-1,0,2,0,2,-1,-1,0,1,0,2,1,1,0,-2,-1,-1,0,0.4,0,1,-0.8,0.15 +1033,R_7EiGpRFWemTNEuI,32 - 38,Canadian,Male,3,3,2,3,3,2,2,2,2,1,1,1,1,1,2,-2,-2,-2,-2,-2,3,2,2,2,2,7,2,2,3,3,1,8,2,3,3,3,2,8,2,2,2,1,3,7,2,3,3,3,2,10,2,3,3,2,3,8,1,3,2,1,1,9,2,2,1,2,3,9,TRUE,0,100,TRUE,1,53,FALSE,1,92,FALSE,1,93,FALSE,0,83,TRUE,0,76,TRUE,1,89,FALSE,0,55,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,82,TRUE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,96,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,77,FALSE,0,78,TRUE,0,65,FALSE,1,97,TRUE,0,100,FALSE,0,100,TRUE,1,65,TRUE,1,100,0.3025,0.6084,0,0.0121,0,0.5776,0,0,0.0025,0,1,0,0,0.0004,0.6889,0.2209,1,0.0049,0.0009,0.5929,0.9216,0,0,1,0.0324,0.4225,0.1225,1,0.0064,1,1,1,0.378371429,0.249657143,0.507085714,16,50,18,56.25,7,87.5,3,37.5,3,37.5,5,62.5,11,68.75,7,43.75,90.44,84.25,92.12,93,92.38,88.69,92.19,-6.25,34.19,-3.25,54.62,55.5,29.88,19.94,48.44,0,1,0,1,1,0,0,1,1,0,1,2,2,2,0,4,4,4,3,5,1,0,1,0,1,0,1,1,0,2,0,2,1,0,1,4,4,3,4,5,0.6,0.4,1.4,4,0.6,0.8,0.8,4,1.6,1.55,7.67,9,-3,0,-1,-2,-1.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),35,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,1,-1,1,0,0,-1,0,1,-2,1,0,1,2,-1,0,0,1,-1,0,0,-0.4,0.6,0,0.05 +1034,R_3a12hokuEVApex3,32 - 38,Canadian,Male,1,3,3,3,3,3,-2,2,-2,3,2,2,3,3,2,2,2,2,-3,3,-3,2,2,-2,3,1,-2,-3,-3,2,-2,9,1,2,1,2,1,3,-3,-3,-3,-3,-2,4,-1,3,2,3,3,9,2,-2,1,-2,1,8,2,2,2,3,3,8,2,2,2,-3,3,9,TRUE,0,88,TRUE,1,73,FALSE,1,63,FALSE,1,91,TRUE,1,88,TRUE,0,86,TRUE,1,82,TRUE,1,74,TRUE,1,97,TRUE,1,100,FALSE,1,96,FALSE,1,100,TRUE,1,100,FALSE,1,83,FALSE,0,64,TRUE,1,98,TRUE,0,100,TRUE,0,100,FALSE,1,75,FALSE,1,100,FALSE,0,81,FALSE,0,100,FALSE,1,94,TRUE,1,88,TRUE,0,100,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,0,97,TRUE,1,100,FALSE,0,100,TRUE,1,86,0.0676,0,0.0004,0.0324,0.0196,0.7396,0.0144,0,0,1,0,0,0.0009,0.0016,0.0144,0.0729,0.0036,0.0081,1,1,0.6561,0.4096,0.0625,0.0289,1,0.1089,1,0.7744,0.1369,1,0.9409,0,0.356903571,0.133935714,0.579871429,17,53.13,21,65.63,6,75,4,50,4,50,7,87.5,12,75,9,56.25,89.72,82.88,91.5,94.12,90.38,89.44,90,-12.5,24.09,7.88,41.5,44.12,2.88,14.44,33.75,4,1,1,5,0,5,1,5,4,5,1,0,2,1,1,5,5,5,0,5,2,0,1,0,0,1,0,1,0,2,0,0,1,0,1,0,0,0,0,0,2.2,4,1,4,0.6,0.8,0.4,0,2.8,0.45,4.33,8.33,-8,1,-5,-5,-4,10 cents,25 minutes,24 days,Male,University - Undergraduate,33,1.25,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,1,0,5,0,4,1,4,4,3,1,0,1,1,0,5,5,5,0,5,1.6,3.2,0.6,4,2.35 +1035,R_7l0EFONzd5EiPzE,25 - 31,American,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,2,TRUE,0,85,TRUE,1,84,TRUE,0,65,FALSE,1,81,TRUE,1,83,TRUE,0,80,TRUE,1,88,TRUE,1,88,TRUE,1,91,TRUE,1,88,TRUE,0,90,TRUE,0,89,TRUE,1,91,TRUE,0,88,TRUE,1,87,TRUE,1,89,TRUE,0,88,TRUE,0,85,TRUE,0,85,TRUE,0,85,FALSE,0,90,TRUE,1,90,TRUE,0,87,TRUE,1,85,FALSE,1,90,FALSE,0,83,TRUE,0,85,FALSE,1,88,TRUE,0,92,TRUE,1,84,FALSE,0,87,TRUE,1,89,0.0144,0.6889,0.0121,0.0144,0.0121,0.64,0.0225,0.0144,0.7225,0.01,0.0256,0.0081,0.0081,0.81,0.0289,0.0256,0.7569,0.0361,0.0144,0.01,0.81,0.0169,0.7225,0.7744,0.7744,0.7225,0.7569,0.7225,0.4225,0.7225,0.8464,0.7921,0.401028571,0.222914286,0.579142857,27,84.38,16,50,4,50,3,37.5,4,50,5,62.5,13,81.25,3,18.75,86.25,86.25,87.5,87.12,84.12,87.31,85.19,34.38,36.25,36.25,50,37.12,21.62,6.06,66.44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4.33,8,0,-5,-6,0,-3.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,29,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +1036,R_5spLTuDdtfqvVE7,25 - 31,Canadian,Male,1,3,3,3,3,2,2,0,1,2,2,0,1,-1,1,0,2,3,2,1,1,3,3,2,1,4,-2,2,-1,2,-1,8,1,-1,2,1,1,7,-1,2,-2,1,0,3,1,3,1,3,3,7,-2,2,0,1,1,8,0,1,-1,0,2,7,0,-1,1,2,2,7,TRUE,0,78,FALSE,0,63,TRUE,0,75,FALSE,1,66,TRUE,1,66,TRUE,0,75,TRUE,1,75,FALSE,0,58,FALSE,0,50,TRUE,1,82,FALSE,1,54,FALSE,1,59,TRUE,1,100,FALSE,1,68,FALSE,0,50,TRUE,1,100,TRUE,0,59,TRUE,0,80,FALSE,1,70,FALSE,1,61,TRUE,1,66,FALSE,0,63,FALSE,1,60,TRUE,1,87,FALSE,1,56,TRUE,1,84,FALSE,1,65,FALSE,1,73,FALSE,1,65,TRUE,1,77,FALSE,0,63,FALSE,0,65,0.3364,0.0256,0,0.0625,0.4225,0.5625,0.0169,0.0324,0.1521,0.3969,0.0529,0,0.25,0.2116,0.1156,0.3969,0.16,0.1156,0.0729,0.1936,0.1156,0.25,0.09,0.1024,0.3481,0.1225,0.3969,0.6084,0.5625,0.64,0.1225,0.1681,0.23855,0.206135714,0.270964286,10,31.25,20,62.5,4,50,5,62.5,5,62.5,6,75,9,56.25,11,68.75,69.16,60.12,69.5,73.25,73.75,71.81,66.5,-31.25,6.66,10.12,7,10.75,-1.25,15.56,-2.25,0,0,0,1,2,4,0,1,1,3,1,1,1,2,0,1,0,5,1,1,0,0,2,0,0,4,0,0,0,1,2,1,2,1,1,0,3,2,0,1,0.6,1.8,1,1.6,0.4,1,1.4,1.2,1.25,1,6.33,7.33,-3,0,0,-4,-1,10 cents,5 minutes,24 days,Male,University - Undergraduate,25,0.75,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,-2,1,2,0,0,1,1,2,-1,0,-1,1,-1,1,-3,3,1,0,0.2,0.8,-0.4,0.4,0.25 +1037,R_7ovZUoxdrCKde3V,32 - 38,Canadian,Male,0,2,3,2,3,-1,0,1,0,2,3,2,2,1,3,0,1,0,1,-3,1,3,3,2,2,2,1,1,1,2,1,5,0,3,1,2,2,4,0,3,1,-2,2,8,2,3,3,2,2,7,3,2,1,2,1,5,2,1,2,1,2,6,-1,-1,0,-1,-1,6,TRUE,0,90,TRUE,1,74,FALSE,1,56,FALSE,1,95,FALSE,0,86,FALSE,1,76,TRUE,1,100,TRUE,1,92,FALSE,0,69,FALSE,0,58,FALSE,1,65,TRUE,0,100,TRUE,1,86,TRUE,0,100,TRUE,1,79,TRUE,1,93,TRUE,0,97,TRUE,0,97,TRUE,0,90,FALSE,1,54,TRUE,1,100,TRUE,1,54,TRUE,0,60,TRUE,1,98,TRUE,0,93,TRUE,1,80,TRUE,0,96,FALSE,1,50,TRUE,0,80,FALSE,0,60,TRUE,1,95,TRUE,1,90,0.0064,0.04,0.0049,0,0.01,0.0576,0.0004,0.3364,0.2116,0.2116,0.36,0.0196,0.4761,0.1225,0.7396,0.0676,0.36,0.0025,0.25,0.8649,0,0.0441,0.81,1,0.9409,0.9216,0.0025,0.81,0.1936,0.9409,0.64,1,0.406928571,0.212535714,0.601321429,10,31.25,18,56.25,5,62.5,4,50,3,37.5,6,75,12,75,6,37.5,81.66,82.88,84.38,84,75.38,82.12,81.19,-25,25.41,20.38,34.38,46.5,0.38,7.12,43.69,1,1,0,0,1,2,1,0,2,1,3,1,1,1,1,0,2,1,3,5,2,1,0,0,1,4,2,0,2,1,1,1,0,0,1,1,2,0,2,2,0.6,1.2,1.4,2.2,0.8,1.8,0.6,1.4,1.35,1.15,3.67,6,-5,0,-2,2,-2.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,35,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,-1,0,0,0,0,-2,-1,0,0,0,2,0,1,1,0,-1,0,1,1,3,-0.2,-0.6,0.8,0.8,0.2 +1038,R_3VvzQjSV4swk1yE,32 - 38,Canadian,Male,-1,2,3,2,0,-1,1,0,1,0,2,0,1,0,1,-2,-1,0,-1,-1,0,2,2,2,0,2,-1,1,0,1,0,1,2,0,1,0,1,1,-1,-1,-1,-1,-1,2,0,2,2,2,0,0,0,1,1,1,0,2,2,0,2,0,2,1,-1,-1,-1,-1,-1,0,FALSE,1,68,TRUE,1,90,FALSE,1,63,TRUE,0,50,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,61,TRUE,1,87,FALSE,1,88,TRUE,1,68,TRUE,1,100,TRUE,0,72,TRUE,0,100,TRUE,0,75,FALSE,1,100,TRUE,1,74,TRUE,1,62,TRUE,0,63,TRUE,1,100,TRUE,0,62,TRUE,1,64,TRUE,0,58,TRUE,0,74,TRUE,0,100,TRUE,1,90,TRUE,1,50,TRUE,1,83,0,0.1296,0,0,0.0289,0,0,0,0,0.1444,0.01,0.0169,0,0.25,0.0049,0.01,0.3969,0.25,0.5476,0.3844,0.0676,0.1024,0.5625,0.0144,0.5184,0.3364,0.25,0.1024,0.1369,1,1,0.1521,0.224539286,0.079428571,0.36965,24,75,23,71.88,5,62.5,5,62.5,6,75,7,87.5,16,100,7,43.75,79.53,67.62,84,80.5,86,85.06,74,3.12,7.65,5.12,21.5,5.5,-1.5,-14.94,30.25,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0.4,0,0,0.4,0.4,0.4,0.4,0.4,0.2,0.4,1.33,1,2,-1,0,2,0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),34,0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,0,-1,0,0,0,0,-1,0,-1,0,0,0,0,0,0,-0.4,-0.4,0,-0.2 +1039,R_7OxcsWq1kON7Wl5,25 - 31,American,Female,3,3,3,1,3,3,1,2,-3,2,3,2,3,1,1,1,1,1,1,-2,3,3,3,1,2,8,1,2,2,3,0,9,1,3,1,3,1,9,1,2,1,2,1,9,2,3,2,1,2,7,-1,1,2,2,1,10,3,2,2,3,3,7,3,3,2,1,1,10,FALSE,1,100,FALSE,0,96,TRUE,0,100,FALSE,1,99,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,81,FALSE,0,53,FALSE,1,93,TRUE,0,97,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,76,FALSE,1,99,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,77,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,99,FALSE,1,91,FALSE,0,98,TRUE,1,95,TRUE,1,100,0,0,0,0,0,0.0004,0.0529,0.2809,1,1,0.9604,1,0.0361,0.0049,0,0.9216,1,0.0001,0.9801,0,0,0,0,0,0.0576,0,0.0025,0,1,0.0001,0.0081,0.9409,0.330235714,0.44695,0.213521429,30,93.75,22,68.75,7,87.5,6,75,6,75,3,37.5,11,68.75,11,68.75,95.38,95.5,95.62,94,96.38,93.75,97,25,26.63,8,20.62,19,58.88,25,28.25,0,0,0,0,1,2,1,0,6,2,2,1,2,2,0,0,1,0,1,3,1,0,1,0,1,4,0,0,5,1,0,0,1,2,2,2,2,1,0,3,0.2,2.2,1.4,1,0.6,2,1,1.6,1.2,1.3,8.67,8,1,-1,2,-1,0.67,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),25,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-1,0,-1,0,0,-2,1,0,1,1,2,1,1,0,-2,-2,-1,-1,1,0,-0.4,0.2,0.4,-0.6,-0.1 +1040,R_6xjOsURNNhM7ELD,25 - 31,American,Male,2,0,1,2,2,2,2,2,2,1,2,1,2,2,2,0,2,2,1,2,2,2,1,3,3,5,0,-1,2,3,1,5,3,1,2,2,0,7,1,2,1,0,2,6,1,2,3,1,1,6,2,0,3,1,-1,8,3,-2,1,-3,-1,9,2,0,1,3,1,7,TRUE,0,77,TRUE,1,50,TRUE,0,71,FALSE,1,86,FALSE,0,76,FALSE,1,89,TRUE,1,84,TRUE,1,66,FALSE,0,68,TRUE,1,68,TRUE,0,71,TRUE,0,96,FALSE,0,91,FALSE,1,74,TRUE,1,75,TRUE,1,79,TRUE,0,70,TRUE,0,71,FALSE,1,80,TRUE,0,75,TRUE,1,61,FALSE,0,71,TRUE,0,72,TRUE,1,63,TRUE,0,50,FALSE,0,74,TRUE,0,51,TRUE,0,79,TRUE,0,80,FALSE,0,77,FALSE,0,78,TRUE,1,78,0.1156,0.5476,0.0441,0.0256,0.0484,0.0121,0.1369,0.1024,0.5625,0.5041,0.5929,0.8281,0.4624,0.5041,0.5776,0.25,0.5184,0.0196,0.6241,0.25,0.1521,0.0625,0.04,0.0676,0.49,0.2601,0.6084,0.5929,0.5041,0.5041,0.64,0.9216,0.387035714,0.365678571,0.408392857,17,53.13,13,40.63,4,50,3,37.5,3,37.5,3,37.5,9,56.25,4,25,73.47,69.88,77.12,71.12,75.75,72.44,74.5,12.5,32.84,19.88,39.62,33.62,38.25,16.19,49.5,0,2,0,1,1,2,3,0,1,0,1,0,0,0,2,1,0,1,1,0,1,2,2,1,1,0,2,1,1,2,1,3,1,5,3,2,2,1,2,1,0.8,1.2,0.6,0.6,1.4,1.2,2.6,1.6,0.8,1.7,5.67,7.67,-1,-3,-2,-1,-2,10 cents,25 minutes,36 days,Male,University - Graduate (Masters),27,-0.375,0,0,0,1,0,0,0,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,0,-2,0,0,2,1,-1,0,-2,0,-3,-1,-5,-1,-1,-2,0,-1,-1,-0.6,0,-2,-1,-0.9 +1041,R_39cvBVBZ3VzfSRW,25 - 31,American,Female,0,1,3,0,1,-2,-2,2,0,2,2,0,2,0,3,0,0,1,1,2,1,2,1,-2,2,6,-2,-2,2,0,2,5,1,0,1,2,3,6,1,0,1,0,-1,6,0,1,2,2,2,2,-2,-2,2,-1,2,2,2,0,2,1,3,2,1,2,1,2,2,2,FALSE,1,70,TRUE,1,100,TRUE,0,65,FALSE,1,50,TRUE,1,85,FALSE,1,85,TRUE,1,90,TRUE,1,90,TRUE,1,50,TRUE,1,75,TRUE,0,50,FALSE,1,100,TRUE,1,90,FALSE,1,95,FALSE,0,50,TRUE,1,95,TRUE,0,50,FALSE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,50,TRUE,1,61,TRUE,0,76,TRUE,1,100,TRUE,0,93,TRUE,1,98,FALSE,1,50,FALSE,1,56,TRUE,0,92,FALSE,0,75,TRUE,1,70,TRUE,1,92,0.01,0.0004,0.0025,0.01,0.0064,0.0225,0,0.0625,0,0.1521,0.5625,0.01,0.25,0.25,0.0225,0,0.5776,0.25,0.1936,0.8649,0.25,0.25,0.16,0.0025,0.25,0.25,0.09,0.09,0.4225,0,0.8464,0,0.208428571,0.154721429,0.262135714,10,31.25,24,75,6,75,5,62.5,7,87.5,6,75,14,87.5,10,62.5,76.97,60,77.5,85.25,85.12,79.44,74.5,-43.75,1.97,-15,15,-2.25,10.12,-8.06,12,1,1,2,2,1,0,0,0,0,0,1,0,1,2,0,1,0,0,1,3,0,0,1,2,1,0,0,0,1,0,0,0,0,1,0,1,2,0,1,0,1.4,0,0.8,1,0.8,0.2,0.2,0.8,0.8,0.5,5.67,2,4,3,4,4,3.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,1,1,0,0,0,0,0,-1,0,1,0,1,1,0,0,-2,0,0,3,0.6,-0.2,0.6,0.2,0.3 +1042,R_7s0cfU8ooQnpkW2,25 - 31,American,Female,2,3,2,3,2,1,-2,3,1,3,2,3,2,-1,3,1,2,3,2,-2,3,3,3,2,2,0,2,-2,3,2,2,5,3,2,2,-2,3,0,1,1,2,-2,-2,10,3,2,3,2,2,0,2,-2,3,1,2,0,3,2,1,-2,2,0,2,2,3,2,2,9,FALSE,1,100,TRUE,1,87,TRUE,0,100,FALSE,1,86,TRUE,1,93,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,1,97,TRUE,0,90,TRUE,1,100,TRUE,1,89,TRUE,0,100,FALSE,1,100,FALSE,1,89,FALSE,1,64,TRUE,1,99,TRUE,1,96,TRUE,0,86,TRUE,1,85,TRUE,0,87,TRUE,1,96,TRUE,0,96,TRUE,0,97,TRUE,0,80,TRUE,1,86,TRUE,1,76,FALSE,0,82,0,0.0016,0.0121,0,0.6724,0.64,0.0225,0,0.1296,0.0016,0.0196,0.0009,0,0.7569,0.0049,0.0169,0.7396,0.0196,0.9409,0.7569,0.0001,0,0.0121,0.81,1,0.9216,0.0576,0,1,0,0.64,1,0.362989286,0.216035714,0.509942857,23,71.88,20,62.5,6,75,3,37.5,6,75,5,62.5,15,93.75,5,31.25,91.5,90.12,89.62,96.12,90.12,92.88,90.12,9.38,29,15.12,52.12,21.12,27.62,-0.87,58.87,1,0,1,1,0,1,0,0,1,1,1,1,0,1,0,0,1,1,4,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,4,0.6,0.6,0.6,1.2,0.8,0.4,1,1,0.75,0.8,1.67,0,0,5,0,1,1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,-1,0,0,0,0,0,0,1,0,0,0,-1,0,-1,-1,1,1,4,-4,-0.2,0.2,-0.4,0.2,-0.05 +1043,R_7lacZSWPPugloS0,25 - 31,American,Female,3,3,3,3,3,-1,3,1,1,3,2,3,3,3,2,-2,0,-2,-2,-2,-2,2,2,-2,2,8,1,-1,-2,3,0,8,-2,-2,2,2,2,8,-1,-2,2,-2,-1,6,3,3,3,3,3,10,3,-1,3,-3,2,10,1,-2,3,3,3,10,2,2,2,2,2,8,TRUE,0,100,TRUE,1,100,FALSE,1,59,TRUE,0,57,TRUE,1,56,FALSE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,96,FALSE,1,64,TRUE,0,100,TRUE,1,59,TRUE,0,62,FALSE,0,54,TRUE,1,53,TRUE,0,65,TRUE,0,100,FALSE,1,54,FALSE,1,52,FALSE,0,100,TRUE,1,78,FALSE,1,54,TRUE,1,52,FALSE,1,100,TRUE,1,100,TRUE,0,83,TRUE,0,84,TRUE,0,68,TRUE,1,63,FALSE,0,56,TRUE,1,56,0,0,0.2209,0,0.1936,0.0081,0.2304,0.0016,0.2304,0.0484,0.1369,0.1681,0.2025,0.1296,0.1936,0,0.2116,0.3249,0.7056,0,1,0.2916,0.2116,0.3844,0.4225,0.6889,0.3136,1,0.1681,1,0.4624,1,0.347442857,0.14855,0.546335714,10,31.25,20,62.5,4,50,5,62.5,5,62.5,6,75,13,81.25,7,43.75,74.09,65.38,68.62,92,70.38,73.62,74.56,-31.25,11.59,15.38,6.12,29.5,-4.62,-7.63,30.81,5,1,1,5,1,2,4,3,2,3,4,5,1,1,0,1,2,4,0,1,0,0,0,0,0,4,4,2,4,1,1,5,0,0,1,4,2,4,4,4,2.6,2.8,2.2,1.6,0,3,1.4,3.6,2.3,2,8,10,-2,-2,-2,-2,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),29,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,5,1,1,5,1,-2,0,1,-2,2,3,0,1,1,-1,-3,0,0,-4,-3,2.6,-0.2,0.8,-2,0.3 +1044,R_6lTVn2VOOfAGtTX,25 - 31,American,Male,1,2,2,2,2,0,-2,0,0,0,1,0,0,0,0,0,1,1,0,0,1,2,2,2,2,8,0,0,0,0,0,8,0,0,0,1,0,8,0,-1,0,0,0,8,0,1,1,1,1,8,0,0,0,-1,0,8,1,0,0,0,0,8,1,1,1,1,1,8,TRUE,0,72,TRUE,1,79,TRUE,0,76,TRUE,0,82,TRUE,1,78,TRUE,0,88,TRUE,1,77,TRUE,1,77,TRUE,1,85,TRUE,1,73,TRUE,0,67,TRUE,0,98,TRUE,1,77,TRUE,0,71,TRUE,1,65,TRUE,1,72,TRUE,0,65,TRUE,0,64,TRUE,0,73,TRUE,0,74,TRUE,1,72,TRUE,1,64,FALSE,1,64,TRUE,1,79,TRUE,0,66,TRUE,1,55,TRUE,0,89,TRUE,0,87,TRUE,0,92,TRUE,1,89,TRUE,1,94,TRUE,1,96,0.0529,0.2025,0.0784,0.0529,0.0016,0.7744,0.0441,0.0729,0.5476,0.1296,0.0121,0.0529,0.0225,0.4489,0.0484,0.0441,0.1296,0.6724,0.7569,0.4356,0.0784,0.1225,0.5329,0.5041,0.4225,0.7921,0.0036,0.5184,0.5776,0.4096,0.8464,0.9604,0.355789286,0.214364286,0.497214286,24,75,17,53.13,4,50,5,62.5,4,50,4,50,16,100,1,6.25,76.88,79.25,79,67.75,81.5,77,76.75,21.87,23.75,29.25,16.5,17.75,31.5,-23,70.5,0,0,0,0,0,0,2,0,0,0,1,0,0,1,0,0,2,1,0,0,1,1,1,1,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0.4,0.4,0.6,1,0.6,0,0.6,0.35,0.55,8,8,0,0,0,0,0,5 cents,5 minutes,36 days,Male,University - Undergraduate,30,0.125,1,1,0,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,-1,-1,-1,-1,0,0,0,-1,0,1,0,0,1,0,-1,2,1,-1,-1,-1,-0.2,0.4,0,-0.2 +1045,R_5fJDjeqC29H2TE5,25 - 31,American,Male,3,3,3,3,3,1,-2,-1,-3,-3,2,1,3,1,3,2,3,2,2,3,3,3,2,3,2,8,2,0,1,-2,1,9,2,2,3,2,3,8,2,2,3,2,3,8,3,3,3,3,3,8,2,2,2,2,3,7,2,2,3,3,0,7,2,3,2,2,2,8,FALSE,1,87,TRUE,1,94,FALSE,1,92,FALSE,1,54,TRUE,1,89,FALSE,1,91,TRUE,1,89,TRUE,1,83,TRUE,1,79,TRUE,1,85,FALSE,1,82,FALSE,1,63,FALSE,0,86,FALSE,1,90,TRUE,1,88,TRUE,1,86,TRUE,0,86,TRUE,0,88,FALSE,1,85,FALSE,1,90,TRUE,1,85,TRUE,1,86,TRUE,0,71,TRUE,1,87,FALSE,1,82,TRUE,1,90,FALSE,1,86,FALSE,1,90,FALSE,1,83,FALSE,0,93,TRUE,1,89,TRUE,1,82,0.0289,0.01,0.0196,0.0121,0.0324,0.0081,0.0169,0.0225,0.01,0.0196,0.8649,0.7396,0.0441,0.0324,0.0121,0.0036,0.5041,0.2116,0.01,0.0324,0.0225,0.0144,0.0225,0.01,0.7396,0.0196,0.0121,0.0169,0.0064,0.7744,0.0289,0.1369,0.156017857,0.180135714,0.1319,26,81.25,27,84.38,8,100,5,62.5,7,87.5,7,87.5,14,87.5,13,81.25,84.72,82.12,84.12,87.12,85.5,86.94,82.5,-3.13,0.34,-17.88,21.62,-0.38,-2,-0.56,1.25,0,0,1,0,1,1,2,2,1,4,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,4,3,5,6,0,1,0,2,3,0,0,0,0,1,0.4,2,0.4,0.4,0,3.8,1.2,0.2,0.8,1.3,8.33,7.33,0,2,1,0,1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),29,1.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,1,0,1,0,-2,-1,-4,-2,0,0,0,-1,-3,0,1,1,0,-1,0.4,-1.8,-0.8,0.2,-0.5 +1046,R_5QBdYcwQpZ3JBiV,32 - 38,Canadian,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,57,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1849,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.247675,0.24535,0.25,16,50,19,59.38,4,50,7,87.5,5,62.5,3,37.5,8,50,11,68.75,50.22,50,50.88,50,50,50.44,50,-9.38,-9.16,0,-36.62,-12.5,12.5,0.44,-18.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),37,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +1047,R_7axCMgMstvJ4z3X,25 - 31,American,Male,0,3,2,-1,0,-2,1,-3,1,2,-2,1,3,2,2,-2,-2,-1,-2,-1,1,3,3,1,0,10,1,1,0,-1,3,9,-1,3,2,3,2,10,1,1,1,0,1,10,1,3,3,3,2,7,2,-2,3,-2,2,5,1,0,2,3,2,5,3,3,3,3,3,8,TRUE,0,100,FALSE,0,63,FALSE,1,100,FALSE,1,53,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,65,TRUE,0,57,FALSE,0,65,TRUE,0,85,FALSE,0,60,FALSE,0,59,FALSE,1,57,FALSE,1,100,TRUE,0,58,TRUE,0,64,TRUE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,57,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,69,TRUE,1,72,0,0,0.3481,0,0.0784,0,0,0,0.4096,0.16,0,0.4225,0.2304,0.1225,0.0081,0.3969,0,0.2209,0,0,0.1444,0.36,0.3364,0.7225,0.1849,0.1849,0.0961,1,0,0,0.6561,0.3249,0.216410714,0.146378571,0.286442857,16,50,22,68.75,5,62.5,6,75,6,75,5,62.5,12,75,10,62.5,79.06,59.62,78.5,93.12,85,78.31,79.81,-18.75,10.31,-2.88,3.5,18.12,22.5,3.31,17.31,1,0,1,2,0,3,0,3,2,1,1,2,1,1,0,3,3,2,2,2,1,0,1,4,2,4,3,6,3,0,3,1,1,1,0,5,5,4,5,4,0.8,1.8,1,2.4,1.6,3.2,1.2,4.6,1.5,2.65,9.67,5.67,3,4,5,2,4,10 cents,100 minutes,47 days,Male,High School (or equivalent),31,0.75,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-2,-2,-1,-3,-3,-1,1,-2,1,0,0,0,-2,-2,-2,-3,-2,-0.8,-1.4,-0.2,-2.2,-1.15 +1048,R_5npjApQ2bVvcQA0,25 - 31,American,Female,2,2,2,2,2,3,-1,2,1,3,3,0,2,1,2,1,0,1,0,1,2,2,2,2,2,4,2,0,2,2,2,4,2,2,2,2,2,4,2,2,2,2,2,4,2,2,2,2,2,4,0,0,2,1,2,4,3,0,3,1,3,4,1,1,1,1,1,4,TRUE,0,65,FALSE,0,58,FALSE,1,87,FALSE,1,54,TRUE,1,59,FALSE,1,54,TRUE,1,55,TRUE,1,50,FALSE,0,54,FALSE,0,54,TRUE,0,55,TRUE,0,56,FALSE,0,55,TRUE,0,53,FALSE,0,52,TRUE,1,53,TRUE,0,54,TRUE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,52,FALSE,0,57,FALSE,1,54,TRUE,1,52,FALSE,1,53,TRUE,1,53,FALSE,1,56,TRUE,0,54,FALSE,1,53,TRUE,1,57,FALSE,0,55,TRUE,1,53,0.25,0.2209,0.2209,0.2025,0.2209,0.2116,0.2304,0.2916,0.2209,0.3249,0.1849,0.3025,0.2916,0.3025,0.1681,0.3364,0.2116,0.2116,0.2916,0.2209,0.2304,0.2704,0.2209,0.2809,0.2916,0.1936,0.3025,0.4225,0.0169,0.2809,0.2209,0.3136,0.252396429,0.250678571,0.254114286,11,34.38,18,56.25,3,37.5,6,75,3,37.5,6,75,9,56.25,9,56.25,55.5,54.62,54.25,55.38,57.75,54.31,56.69,-21.87,-0.75,17.12,-20.75,17.88,-17.25,-1.94,0.44,0,0,0,0,0,1,1,0,1,1,1,2,0,1,0,1,2,1,2,1,0,0,0,0,0,3,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0.8,0.8,1.4,0,1,0.4,0.4,0.75,0.45,4,4,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),29,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,-2,0,0,1,0,1,2,-1,1,-1,1,1,1,1,1,0,-0.2,0.4,1,0.3 +1049,R_7JOviwR13qNO3cP,32 - 38,Canadian,Female,3,3,1,0,2,-3,-3,2,-1,2,2,3,3,3,2,-2,0,2,3,2,3,3,2,0,3,6,3,-2,2,0,2,6,3,2,2,-1,3,6,0,1,1,1,-2,6,3,3,2,0,2,6,0,-2,2,0,1,5,3,1,2,-1,1,6,1,0,1,2,3,5,TRUE,0,66,TRUE,1,80,TRUE,0,81,FALSE,1,59,TRUE,1,60,FALSE,1,63,TRUE,1,90,TRUE,1,90,TRUE,1,64,TRUE,1,85,TRUE,0,59,TRUE,0,81,TRUE,1,66,FALSE,1,54,TRUE,1,61,TRUE,1,72,TRUE,0,73,TRUE,0,100,TRUE,0,76,FALSE,1,58,TRUE,1,81,TRUE,1,69,FALSE,1,52,TRUE,1,59,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,56,TRUE,1,100,FALSE,0,52,TRUE,1,85,0.01,0,0.0784,0.01,0.0225,0.1369,0.1681,0.0225,0.1764,0.0961,0,0.1156,0.1296,0.3481,0.16,0.04,0.2304,0.1681,0.49,0.5625,0.0361,0.1521,0.5776,0.2116,0.5329,0.25,0.2704,0.4356,0.6561,1,0.3136,0.6561,0.284246429,0.129592857,0.4389,17,53.13,21,65.63,5,62.5,6,75,5,62.5,5,62.5,15,93.75,6,37.5,71.47,62.62,67,79.88,76.38,75.88,67.06,-12.5,5.84,0.12,-8,17.38,13.88,-17.87,29.56,0,0,1,0,1,6,1,0,1,0,1,1,1,4,1,2,1,1,2,4,0,0,1,0,0,3,1,0,1,1,1,2,1,4,1,3,0,1,1,1,0.4,1.6,1.6,2,0.2,1.2,1.8,1.2,1.4,1.1,6,5.67,0,1,0,1,0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),35,0.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,1,3,0,0,0,-1,0,-1,0,0,0,-1,1,0,1,3,0.2,0.4,-0.2,0.8,0.3 +1050,R_63DxfW1B20fS2bN,32 - 38,Canadian,Female,3,3,2,-1,1,0,0,2,0,1,0,1,3,-1,2,0,1,1,0,-2,3,2,2,-1,1,4,-3,1,1,3,2,3,3,3,3,1,3,1,-3,0,-1,-3,-1,5,3,3,2,0,0,2,0,-2,2,0,0,3,0,0,3,-2,0,1,0,0,0,0,0,5,FALSE,1,90,FALSE,0,75,FALSE,1,90,FALSE,1,50,TRUE,1,75,FALSE,1,80,TRUE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,95,TRUE,0,100,TRUE,1,90,FALSE,1,90,TRUE,1,50,FALSE,0,90,FALSE,1,80,TRUE,0,60,FALSE,1,50,FALSE,1,50,TRUE,1,95,TRUE,1,90,FALSE,1,95,TRUE,1,75,FALSE,1,95,TRUE,1,90,FALSE,1,50,FALSE,1,50,TRUE,0,60,FALSE,0,95,TRUE,1,50,TRUE,1,100,0,0.01,0.81,0.0625,0,0.04,0.0625,0.0025,0.25,0.01,0.9025,0.01,0.25,0.0025,0.0625,0.5625,0.0025,0.25,0.25,0.0025,0.0025,0.25,0.25,0.01,0.04,0.25,0.25,0.01,0.01,0.36,0.36,1,0.194732143,0.171964286,0.2175,25,78.13,25,78.13,6,75,7,87.5,7,87.5,5,62.5,12,75,13,81.25,77.5,58.75,84.38,85.62,81.25,80.94,74.06,0,-0.63,-16.25,-3.12,-1.88,18.75,5.94,-7.19,0,1,0,0,0,3,1,1,3,1,3,2,0,2,1,3,1,2,3,1,0,0,0,1,1,0,2,0,0,1,0,1,0,1,2,0,1,1,0,2,0.2,1.8,1.6,2,0.4,0.6,0.8,0.8,1.4,0.65,2.67,2,2,0,0,0,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,0,-1,-1,3,-1,1,3,0,3,1,0,1,-1,3,0,1,3,-1,-0.2,1.2,0.8,1.2,0.75 +1051,R_50ctFWHn1sR6MOg,32 - 38,Canadian,Female,3,3,3,2,3,1,-3,2,-3,2,3,-2,3,0,3,0,2,2,1,-1,3,3,3,2,3,6,1,-3,1,-3,2,6,3,-3,3,1,3,6,0,0,1,0,-1,5,2,2,2,1,2,5,2,-3,2,-3,2,5,3,-2,3,-1,3,2,0,0,0,0,0,5,TRUE,0,87,TRUE,1,86,TRUE,0,99,FALSE,1,67,TRUE,1,77,FALSE,1,99,FALSE,0,100,TRUE,1,100,FALSE,0,71,TRUE,1,90,FALSE,1,96,TRUE,0,88,FALSE,0,68,TRUE,0,100,FALSE,0,72,TRUE,1,98,FALSE,1,67,TRUE,0,90,FALSE,1,71,FALSE,1,90,FALSE,0,72,TRUE,1,95,FALSE,1,68,TRUE,1,98,FALSE,1,61,TRUE,1,88,TRUE,0,63,TRUE,0,91,TRUE,0,87,TRUE,1,98,FALSE,0,57,TRUE,1,93,0,0.0144,0.0004,1,0.0049,0.0001,0.0004,0.01,0.01,0.0025,0.0004,0.4624,0.5041,0.0016,0.0529,0.0196,0.1024,0.1089,0.8281,0.1521,0.5184,0.5184,0.0841,1,0.1089,0.3969,0.3249,0.7569,0.9801,0.81,0.7569,0.7744,0.331796429,0.091442857,0.57215,22,68.75,18,56.25,4,50,5,62.5,4,50,5,62.5,10,62.5,8,50,83.97,72.88,78.88,88.88,95.25,85.19,82.75,12.5,27.72,22.88,16.38,38.88,32.75,22.69,32.75,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,2,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,2,2,1,1,0,0.2,0.4,0.8,1,0.2,0.2,1.2,0.35,0.65,6,4,1,1,4,0,2,10 cents,100 minutes,36 days,Female,University - PhD,38,1.25,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,-1,-1,-1,-1,-1,0,1,0,0,0,1,0,0,0,0,0,-1,0,-1,-1,0,0.2,-0.4,-0.3 +1052,R_7zVcxc8cgaWuoj3,18 - 24,Canadian,Female,0,1,-2,-3,2,-3,1,3,-3,2,-2,-1,2,0,-1,1,1,1,0,0,1,0,0,-3,-3,3,-3,1,3,-3,2,1,-3,-2,3,0,-2,2,0,0,0,-2,0,6,0,1,-2,-2,1,4,-3,0,3,-3,2,4,-3,0,3,0,-2,3,1,1,1,1,0,3,TRUE,0,61,TRUE,1,88,TRUE,0,78,FALSE,1,54,TRUE,1,96,FALSE,1,50,TRUE,1,77,TRUE,1,91,TRUE,1,96,TRUE,1,93,FALSE,1,50,TRUE,0,96,TRUE,1,66,TRUE,0,50,TRUE,1,69,TRUE,1,94,TRUE,0,55,TRUE,0,55,TRUE,0,89,FALSE,1,82,TRUE,1,58,TRUE,1,95,FALSE,1,96,TRUE,1,82,FALSE,1,91,TRUE,1,92,FALSE,1,50,FALSE,1,55,FALSE,1,58,TRUE,1,76,FALSE,0,50,TRUE,1,95,0.0081,0.0064,0.0036,0.0529,0.0025,0.25,0.0324,0.0049,0.0324,0.0025,0.0576,0.1156,0.0016,0.25,0.0016,0.0144,0.0016,0.2116,0.2025,0.0081,0.1764,0.0961,0.7921,0.25,0.3025,0.25,0.25,0.3721,0.6084,0.3025,0.1764,0.9216,0.203121429,0.069907143,0.336335714,22,68.75,24,75,6,75,7,87.5,5,62.5,6,75,15,93.75,9,56.25,74.62,68.25,71.75,76.75,81.75,82.38,66.88,-6.25,-0.38,-6.75,-15.75,14.25,6.75,-11.37,10.63,1,1,2,0,5,0,0,0,0,0,1,1,1,0,1,1,1,1,2,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1.8,0,0.8,1,0.4,0.2,0.8,0.2,0.9,0.4,2,3.67,-1,-3,-1,3,-1.67,10 cents,5 minutes,47 days,Female,University - Undergraduate,24,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,1,1,2,-1,4,0,-1,0,0,0,0,0,0,0,0,1,1,1,1,0,1.4,-0.2,0,0.8,0.5 +1053,R_7Wm0ehpn1dyWifT,32 - 38,Canadian,Female,-2,-1,1,2,3,-1,-2,3,0,1,1,0,1,1,1,-1,-1,-1,-1,-2,0,-2,-1,-3,0,3,-1,2,2,3,3,6,-1,-3,0,3,-2,6,2,3,3,2,1,5,1,-1,2,1,3,5,1,-1,3,-2,1,6,2,2,3,0,2,3,-1,-1,-1,-1,-2,7,TRUE,0,94,FALSE,0,50,TRUE,0,74,TRUE,0,55,FALSE,0,50,TRUE,0,55,TRUE,1,100,TRUE,1,60,FALSE,0,53,TRUE,1,79,TRUE,0,55,FALSE,1,100,TRUE,1,62,TRUE,0,59,TRUE,1,54,TRUE,1,58,TRUE,0,82,TRUE,0,100,FALSE,1,70,FALSE,1,50,TRUE,1,64,FALSE,0,53,FALSE,1,52,TRUE,1,55,TRUE,0,82,TRUE,1,92,TRUE,0,50,TRUE,0,53,TRUE,0,51,TRUE,1,92,FALSE,0,50,FALSE,0,53,0.16,0.0064,0.1764,0,0.2809,0.3025,0.2025,0.0441,0.25,0.2809,0.0064,0.1444,0.2809,0.3025,0.25,0.25,0.2304,0.3025,0.2809,0.6724,0.1296,0.2116,0.09,0.3481,0.6724,0.25,0.25,0.8836,0.5476,1,0.2601,0,0.311582143,0.223428571,0.399735714,18,56.25,14,43.75,2,25,3,37.5,3,37.5,6,75,10,62.5,4,25,65.84,54.62,58.62,82.38,67.75,64.06,67.62,12.5,22.09,29.62,21.12,44.88,-7.25,1.56,42.62,2,1,2,5,3,0,4,1,3,2,2,3,1,2,3,3,4,4,3,3,3,0,1,1,0,2,1,0,2,0,1,2,2,1,1,0,0,0,0,0,2.6,2,2.2,3.4,1,1,1.4,0,2.55,0.85,5,4.67,-2,0,3,-2,0.33,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),36,0.875,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,1,1,4,3,-2,3,1,1,2,1,1,-1,1,2,3,4,4,3,3,1.6,1,0.8,3.4,1.7 +1054,R_14AiiVMvOeu3nV1,32 - 38,Canadian,Female,3,2,2,0,2,1,-3,3,-2,1,2,-1,1,-2,2,1,2,2,2,1,3,2,2,-1,2,1,1,-3,2,-2,1,1,2,-1,1,-1,2,1,2,2,2,1,1,1,3,2,2,0,2,1,1,-3,2,-2,0,1,2,-1,2,-2,2,0,2,2,2,2,1,3,FALSE,1,99,TRUE,1,89,FALSE,1,88,FALSE,1,57,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,92,TRUE,0,100,TRUE,1,89,FALSE,1,97,TRUE,1,89,TRUE,1,100,TRUE,0,96,FALSE,1,98,FALSE,1,88,FALSE,1,92,FALSE,0,81,TRUE,1,88,FALSE,1,98,TRUE,1,100,FALSE,1,94,TRUE,1,100,FALSE,1,80,FALSE,1,100,FALSE,1,72,TRUE,1,98,FALSE,0,63,TRUE,1,100,0,0,0,0,0,0,0,0,0.0064,0.0144,0.0004,0.0121,0.0004,0.0064,0.0049,0.0121,0.0004,0.1849,0,0.0036,0.6561,0.0121,0.0144,0.0009,0.9216,0.04,0.3969,0.0001,0.0144,0.0004,0.0784,1,0.120760714,0.017314286,0.224207143,26,81.25,28,87.5,7,87.5,6,75,8,100,7,87.5,14,87.5,14,87.5,91.84,82,91.12,97,97.25,93,90.69,-6.25,4.34,-5.5,16.12,-3,9.75,5.5,3.19,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0.2,0.2,0.2,0.4,0,0.4,0.2,0.2,0.25,0.2,1,0.67,0,0,1,-2,0.33,10 cents,5 minutes,15 days,Female,University - Undergraduate,35,1.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,1,0,0,0,0,0,-1,0,0,-1,1,0,0,0,0,1,0,0.2,-0.2,0,0.2,0.05 +1055,R_7iUqK9XSmc5WjKy,32 - 38,Canadian,Female,2,3,2,1,3,2,1,3,1,2,3,2,3,3,2,2,1,1,1,1,2,3,3,3,2,4,2,1,2,2,3,3,2,2,2,2,3,3,2,1,2,1,2,3,3,3,2,3,3,6,2,2,2,1,1,8,3,2,3,2,2,4,2,3,2,3,-2,8,FALSE,1,68,FALSE,0,57,TRUE,0,100,FALSE,1,55,TRUE,1,72,FALSE,1,54,TRUE,1,99,TRUE,1,100,FALSE,0,63,FALSE,0,59,TRUE,0,66,TRUE,0,97,TRUE,1,96,TRUE,0,78,TRUE,1,79,TRUE,1,96,TRUE,0,69,TRUE,0,64,TRUE,0,89,FALSE,1,66,TRUE,1,79,TRUE,1,80,TRUE,0,92,TRUE,1,97,TRUE,0,74,TRUE,1,94,FALSE,1,62,TRUE,0,78,TRUE,0,74,TRUE,1,84,FALSE,0,64,FALSE,0,83,0,0.0036,0.0016,0.0001,0.6889,0.2116,0.0009,0.3481,0.1156,0.04,0.0256,0.0016,0.3969,0.4356,0.0784,0.3249,0.8464,0.2025,0.6084,0.5476,0.0441,0.0441,0.7921,0.6084,0.4761,0.1444,0.4096,0.1024,1,0.4096,0.5476,0.9409,0.371153571,0.2655,0.476807143,17,53.13,16,50,3,37.5,4,50,4,50,5,62.5,11,68.75,5,31.25,77.75,66.88,77.38,77,89.75,81.38,74.12,3.13,27.75,29.38,27.38,27,27.25,12.63,42.87,0,0,1,2,1,0,0,1,1,1,1,0,1,1,1,0,0,1,0,1,1,0,0,2,0,0,1,1,0,1,0,0,0,1,0,0,2,1,2,3,0.8,0.6,0.8,0.4,0.6,0.6,0.2,1.6,0.65,0.75,3.33,6,-2,-5,-1,-5,-2.67,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),35,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,0,1,0,1,0,-1,0,1,0,1,0,1,0,1,0,-2,0,-2,-2,0.2,0,0.6,-1.2,-0.1 +1056,R_10jBeCnb04zrIat,32 - 38,Canadian,Male,-2,2,2,-2,2,-1,-1,3,-2,2,-2,-3,3,-2,3,2,2,2,2,1,-3,2,3,-2,2,3,0,0,3,-3,2,2,-2,-3,3,2,3,3,2,2,2,2,2,2,0,2,2,2,2,2,0,0,3,-2,0,2,-3,-3,3,-2,3,1,0,0,0,2,0,5,FALSE,1,70,TRUE,1,50,TRUE,0,81,FALSE,1,50,FALSE,0,50,FALSE,1,90,TRUE,1,92,FALSE,0,76,FALSE,0,70,TRUE,1,76,FALSE,1,75,TRUE,0,80,FALSE,0,50,TRUE,0,91,FALSE,0,50,TRUE,1,81,FALSE,1,50,TRUE,0,80,FALSE,1,90,FALSE,1,100,FALSE,0,70,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,75,TRUE,1,91,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,1,50,0.5776,0.0081,0.0361,0.0064,0.25,0.01,0.25,0.0576,0,0.25,0.0625,0.25,0.49,0.0625,0.25,0.25,0.25,0.25,0.25,0.5625,0.49,0.25,0.01,0.8281,0.25,0.25,0.25,0.09,0.6561,0.64,0.25,0.64,0.289260714,0.191614286,0.386907143,5,15.63,18,56.25,5,62.5,5,62.5,4,50,4,50,7,43.75,11,68.75,67.59,60.62,57.5,78.12,74.12,64.44,70.75,-40.62,11.34,-1.88,-5,28.12,24.12,20.69,2,1,0,1,0,0,1,1,0,1,0,0,0,0,4,0,0,0,0,0,1,2,0,0,4,0,1,1,0,0,2,1,0,0,0,0,2,2,2,0,1,0.4,0.6,0.8,0.2,1.2,0.8,0.2,1.4,0.5,0.9,2.67,1.67,1,0,2,-3,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,36,1.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,-1,0,1,-4,0,0,0,0,1,-2,-1,0,0,4,0,-2,-2,-2,0,0,-0.8,-0.2,0.6,-1.2,-0.4 +1057,R_5gXU659OXdRsSdG,32 - 38,Canadian,Female,2,2,0,-1,-1,-2,1,1,2,0,2,-1,1,-2,3,-1,-1,-1,1,-1,-1,2,2,-3,2,5,-3,0,1,2,2,3,2,2,-1,1,2,4,1,1,1,2,0,3,2,1,0,2,-1,3,-2,1,1,0,1,2,1,0,3,-3,3,3,0,-1,0,2,-1,4,FALSE,1,100,TRUE,1,75,TRUE,0,100,FALSE,1,51,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,50,TRUE,0,70,TRUE,0,90,TRUE,1,75,FALSE,1,60,FALSE,0,100,TRUE,1,100,TRUE,0,90,TRUE,0,52,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,91,TRUE,0,50,TRUE,0,75,TRUE,0,100,TRUE,1,100,FALSE,0,60,FALSE,0,91,0,0.0081,0,0,0.8281,0,0,0.25,0.25,0,0,0.0625,0.01,0.49,0.01,0.0625,0,0.2401,0.5625,0.01,0,1,1,0.16,0.81,0.25,0.36,0,1,0.2704,1,0.81,0.337003571,0.157371429,0.516635714,16,50,20,62.5,3,37.5,5,62.5,7,87.5,5,62.5,13,81.25,7,43.75,84.38,74.5,93.25,80.38,89.38,88.88,79.88,-12.5,21.88,37,30.75,-7.12,26.88,7.63,36.13,3,0,2,2,3,1,1,0,0,2,0,3,2,3,1,2,2,2,1,1,0,1,0,3,0,0,0,0,2,1,1,1,2,1,0,1,0,1,1,0,2,0.8,1.8,1.6,0.8,0.6,1,0.6,1.55,0.75,4,2.67,2,1,1,-1,1.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),32,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,3,-1,2,-1,3,1,1,0,-2,1,-1,2,0,2,1,1,2,1,0,1,1.2,0.2,0.8,1,0.8 +1058,R_75Fb2p82PhEaCGb,32 - 38,Canadian,Female,3,3,2,-2,-2,-2,1,-1,1,1,3,0,2,1,3,-2,1,0,-2,-2,1,3,2,1,-2,1,1,2,-1,2,1,3,3,0,1,0,3,1,0,1,1,-3,-2,2,3,3,2,0,-2,1,0,0,1,0,1,4,3,0,2,2,3,1,1,1,1,1,-2,6,FALSE,1,100,TRUE,1,75,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,85,FALSE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,90,FALSE,1,100,TRUE,1,80,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,70,FALSE,0,50,TRUE,1,60,TRUE,1,91,0,0,0,0,0.0081,0,0.01,0,0,0.0225,0.25,0.7225,0,0,0,0.0625,0,0.25,0,0,0.04,0.25,0.01,0.0025,0,0.25,0.16,0,0,1,0.49,0,0.126003571,0.094685714,0.157321429,28,87.5,27,84.38,7,87.5,6,75,7,87.5,7,87.5,14,87.5,13,81.25,88.16,71.88,90.75,97.5,92.5,85.38,90.94,3.12,3.78,-15.62,15.75,10,5,-2.12,9.69,2,0,0,3,0,3,1,0,1,0,0,0,1,1,0,2,0,1,1,0,0,0,0,2,0,2,1,2,1,0,0,0,0,1,0,3,0,1,3,0,1,1,0.4,0.8,0.4,1.2,0.2,1.4,0.8,0.8,1.67,2,0,-1,0,-4,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),33,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,2,0,0,1,0,1,0,-2,0,0,0,0,1,0,0,-1,0,0,-2,0,0.6,-0.2,0.2,-0.6,0 +1059,R_15F05olnqxr8h3U,32 - 38,Canadian,Male,2,2,2,1,-1,-1,-1,1,1,1,2,1,1,1,2,-1,1,1,-1,-1,2,2,2,-1,-1,3,-2,-2,1,1,-1,3,2,1,1,2,1,3,-1,1,-1,-1,-1,6,2,2,2,1,-1,3,-1,-2,1,1,1,4,2,1,1,1,2,3,1,1,1,1,1,4,TRUE,0,86,TRUE,1,51,TRUE,0,60,FALSE,1,51,TRUE,1,60,FALSE,1,75,TRUE,1,59,TRUE,1,60,TRUE,1,79,TRUE,1,60,FALSE,1,51,TRUE,0,54,TRUE,1,70,TRUE,0,55,FALSE,0,70,TRUE,1,80,TRUE,0,51,TRUE,0,60,FALSE,1,51,FALSE,1,51,FALSE,0,60,TRUE,1,60,FALSE,1,90,TRUE,1,70,TRUE,0,55,TRUE,1,65,TRUE,0,52,FALSE,1,52,TRUE,0,59,TRUE,1,60,TRUE,1,51,TRUE,1,60,0.16,0.1225,0.04,0.1681,0.16,0.0625,0.09,0.16,0.2401,0.16,0.16,0.09,0.0441,0.2401,0.16,0.2401,0.01,0.2401,0.2304,0.3025,0.36,0.49,0.2401,0.3025,0.2601,0.2704,0.2401,0.7396,0.36,0.36,0.3481,0.2916,0.244728571,0.146928571,0.342528571,14,43.75,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,61.5,57,65.62,62.5,60.88,63.44,59.56,-21.88,-4.13,-18,3.12,12.5,-14.12,-24.06,15.81,0,0,0,2,0,1,1,0,0,2,0,0,0,1,1,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,2,2,0.4,0.8,0.4,0.4,0,0.2,0,1.2,0.5,0.35,3,3.33,0,-1,0,2,-0.33,10 cents,25 minutes,47 days,Male,College Diploma/Certificate,36,1,0,0,1,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,2,0,1,0,0,0,2,0,0,0,1,1,-2,0,2,-2,-2,0.4,0.6,0.4,-0.8,0.15 +1060,R_3k0Wezenu6zwiKK,32 - 38,Canadian,Male,1,3,3,3,2,1,1,2,-1,2,2,2,2,2,2,0,0,1,0,0,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,2,2,2,2,2,6,2,2,2,2,2,8,1,1,1,1,1,8,2,2,2,2,2,7,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,1,54,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,80,TRUE,1,69,FALSE,1,77,TRUE,1,100,TRUE,0,69,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,86,TRUE,1,100,TRUE,1,81,TRUE,1,100,0,0,0,0.25,0,0,0,0.25,0,0.0961,0,0.25,0.2116,0.25,0,0.25,0.0529,0.25,1,0.4761,0.04,0,0.25,0.25,0.6561,1,0.0361,0.25,0.25,1,0.7396,1,0.305660714,0.115042857,0.496278571,16,50,19,59.38,4,50,6,75,4,50,5,62.5,16,100,3,18.75,78.03,66.88,84.25,67.25,93.75,80.25,75.81,-9.38,18.65,16.88,9.25,17.25,31.25,-19.75,57.06,0,2,2,2,1,0,0,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,3,0,1,1,1,1,1,2,2,1,2,2,1.4,0.8,1,0.8,0.8,1,1,1.8,1,1.15,7,7.33,1,-1,-1,0,-0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,32,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,1,1,1,1,-1,-1,1,-1,1,0,0,0,0,0,-1,-1,-1,-1,-1,0.6,-0.2,0,-1,-0.15 +1061,R_5aXOQw00ax7DfeZ,32 - 38,Canadian,Female,2,2,2,2,2,0,0,0,0,0,3,0,0,0,0,-3,-3,-3,-3,-3,2,2,2,2,2,8,0,0,0,0,0,8,3,0,0,0,0,8,2,2,2,-3,-3,8,2,2,2,2,2,8,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,8,TRUE,0,51,FALSE,0,51,TRUE,0,81,FALSE,1,51,TRUE,1,52,FALSE,1,81,FALSE,0,52,TRUE,1,52,FALSE,0,52,TRUE,1,51,FALSE,1,51,TRUE,0,51,TRUE,1,64,FALSE,1,51,TRUE,1,53,TRUE,1,51,TRUE,0,51,FALSE,1,52,FALSE,1,51,FALSE,1,51,TRUE,1,53,TRUE,1,59,TRUE,0,54,TRUE,1,53,TRUE,0,51,TRUE,1,59,FALSE,1,52,FALSE,1,52,FALSE,1,52,FALSE,0,53,FALSE,0,52,FALSE,0,51,0.2304,0.1681,0.2401,0.2704,0.2601,0.0361,0.2209,0.2401,0.2401,0.1681,0.2809,0.1296,0.2704,0.2401,0.2304,0.2601,0.2916,0.2401,0.2304,0.2601,0.2209,0.2209,0.2401,0.2401,0.2601,0.2304,0.2704,0.2601,0.6561,0.2304,0.2304,0.2601,0.247110714,0.222042857,0.272178571,1,3.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,10,62.5,10,62.5,54.41,51.62,57.25,53.25,55.5,53.62,55.19,-59.37,-8.09,-10.88,-5.25,-9.25,-7,-8.88,-7.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,3,3,3,3,3,0,0,0,3,0,0,0.6,3,0.75,0.9,8,8,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),38,0.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,2,2,2,-3,-3,0,0,-0.6,0,-0.15 +1062,R_6aaSjwMz2a04kQ9,32 - 38,Canadian,Female,3,3,3,3,3,3,-3,3,-2,0,3,3,3,0,3,1,-1,0,0,-3,3,3,3,3,3,0,2,-3,1,0,2,4,3,3,3,0,3,2,-3,-3,-3,-3,-3,0,3,3,3,3,3,2,1,-3,3,-2,2,9,3,3,3,0,3,9,0,0,0,0,-2,5,FALSE,1,80,TRUE,1,100,TRUE,0,64,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0081,0,0,0.25,0,0.5625,0.25,1,0.25,0,0.01,0,0,1,0,0,0.04,0.4096,0,1,0,0.170721429,0.076471429,0.264971429,25,78.13,26,81.25,8,100,4,50,8,100,6,75,15,93.75,11,68.75,92.19,92.5,89.5,91.25,95.5,95.69,88.69,-3.12,10.94,-7.5,39.5,-8.75,20.5,1.94,19.94,0,0,0,0,0,1,0,2,2,2,0,0,0,0,0,4,2,3,3,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,1,0,0,1,0,1.4,0,2.4,0,0.8,0,0.6,0.95,0.35,2,6.67,-2,-5,-7,-5,-4.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,-1,0,2,2,0,0,0,0,0,0,3,1,3,3,-1,0,0.6,0,1.8,0.6 +1063,R_1TFlsEbpSCpaLq9,18 - 24,Canadian,Female,3,3,1,-1,0,1,1,-1,3,3,1,2,3,1,2,-2,1,1,1,-1,3,3,1,3,1,2,-2,3,-3,3,-1,6,-3,1,-2,3,-2,4,-3,-3,-3,-2,-3,10,3,3,3,2,3,5,2,-1,3,-2,3,3,0,3,3,-1,3,3,2,3,2,3,1,8,TRUE,0,82,FALSE,0,52,TRUE,0,100,FALSE,1,54,TRUE,1,53,FALSE,1,65,FALSE,0,54,TRUE,1,100,TRUE,1,75,TRUE,1,63,FALSE,1,54,TRUE,0,100,FALSE,0,52,TRUE,0,59,FALSE,0,53,FALSE,0,52,TRUE,0,62,TRUE,0,100,TRUE,0,53,FALSE,1,52,TRUE,1,51,FALSE,0,54,FALSE,1,100,TRUE,1,60,FALSE,1,52,TRUE,1,91,TRUE,0,55,TRUE,0,52,TRUE,0,65,TRUE,1,91,FALSE,0,51,TRUE,1,100,0,0.0081,0.2704,0.2916,0,0.1225,0.16,0.1369,0.2304,0.2916,0.0081,0.2704,0.0625,0.2116,0.2209,0.2704,0,0.2116,0.2704,0.2304,0.2401,0.2809,0.2809,0.3481,0.3844,0.3025,0.2601,0.6724,1,1,0.4225,1,0.317485714,0.156921429,0.47805,17,53.13,15,46.88,3,37.5,5,62.5,3,37.5,4,50,9,56.25,6,37.5,67.41,55.88,68.5,69.38,75.88,65.75,69.06,6.25,20.53,18.38,6,31.88,25.88,9.5,31.56,0,0,0,4,1,3,2,2,0,4,4,1,5,2,4,1,4,4,3,2,0,0,2,3,3,1,2,4,5,0,1,1,0,2,1,4,2,1,2,2,1,2.2,3.2,2.8,1.6,2.4,1,2.2,2.3,1.8,4,3.67,-3,3,1,2,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,-2,1,-2,2,0,-2,-5,4,3,0,5,0,3,-3,2,3,1,0,-0.6,-0.2,2.2,0.6,0.5 diff --git a/eohi1/ehi1.csv b/eohi1/ehi1.csv new file mode 100644 index 0000000..8cc57fc --- /dev/null +++ b/eohi1/ehi1.csv @@ -0,0 +1,1064 @@ +pID,ResponseId,taq_age,Citizenship,taq_sex,nowPref_read,nowPref_music,nowPref_tv,nowPref_nap,nowPref_travel,nowPers_extravert,nowPers_critical,nowPers_dependable,nowPers_anxious,nowPers_complex,nowVal_obey,nowVal_trad,nowVal_opinion,nowVal_performance,nowVal_justice,nowLife_ideal,nowLife_excellent,nowLife_satisfied,nowLife_important,nowLife_change,pastPref_read,pastPref_music,pastPref_tv,pastPref_nap,pastPref_travel,pastPref_DGEN,pastPers_extravert,pastPers_critical,pastPers_dependable,pastPers_anxious,pastPers_complex,pastPers_DGEN,pastVal_obey,pastVal_trad,pastVal_opinion,pastVal_performance,pastVal_justice,pastVal_DGEN,pastLife_ideal,pastLife_excellent,pastLife_satisfied,pastLife_important,pastLife_change,pastLife_DGEN,futPref_read,futPref_music,futPref_tv,futPref_nap,futPref_travel,futPref_DGEN,futPers_extravert,futPers_critical,futPers_dependable,futPers_anxious,futPers_complex,futPers_DGEN,futVal_obey,futVal_trad,futVal_opinion,futVal_performance,futVal_justice,futVal_DGEN,futLife_ideal,futLife_excellent,futLife_satisfied,futLife_important,futLife_change,futLife_DGEN,moza_55_F_1,moza_55_F,moza_55_CON,vaud_15_T_1,vaud_15_T,vaud_15_CON,croc_75_F_1,croc_75_F,croc_75_CON,demo_15_F_1,demo_15_F,demo_15_CON,oedi_35_T_1,oedi_35_T,oedi_35_CON,hume_35_F_1,hume_35_F,hume_35_CON,mons_55_T_1,mons_55_T,mons_55_CON,gest_75_T_1,gest_75_T,gest_75_CON,kabu_15_T_1,kabu_15_T,kabu_15_CON,sham_55_T_1,sham_55_T,sham_55_CON,gulf_15_F_1,gulf_15_F,gulf_15_CON,memo_75_F_1,memo_75_F,memo_75_CON,pana_35_T_1,pana_35_T,pana_35_CON,vitc_55_F_1,vitc_55_F,vitc_55_CON,bohr_15_T_1,bohr_15_T,bohr_15_CON,chur_75_T_1,chur_75_T,chur_75_CON,hert_35_F_1,hert_35_F,hert_35_CON,gees_55_F_1,gees_55_F,gees_55_CON,gang_15_F_1,gang_15_F,gang_15_CON,list_75_F_1,list_75_F,list_75_CON,carb_35_T_1,carb_35_T,carb_35_CON,cons_55_T_1,cons_55_T,cons_55_CON,mont_35_F_1,mont_35_F,mont_35_CON,papy_75_T_1,papy_75_T,papy_75_CON,dwar_55_F_1,dwar_55_F,dwar_55_CON,dors_55_T_1,dors_55_T,dors_55_CON,pucc_15_F_1,pucc_15_F,pucc_15_CON,spee_75_F_1,spee_75_F,spee_75_CON,lute_35_F_1,lute_35_F,lute_35_CON,tsun_75_T_1,tsun_75_T,tsun_75_CON,troy_15_T_1,troy_15_T,troy_15_CON,lock_35_T_1,lock_35_T,lock_35_CON,gest_T_ex,dors_T_ex,chur_T_ex,mons_T_ex,lock_T_easy,hume_F_easy,papy_T_easy,sham_T_easy,list_F_easy,cons_T_easy,tsun_T_easy,pana_T_easy,kabu_T_easy,gulf_F_easy,oedi_T_easy,vaud_T_easy,mont_F_easy,demo_F_easy,spee_F_hard,dwar_F_hard,carb_T_hard,bohr_T_hard,gang_F_hard,vitc_F_hard,hert_F_hard,pucc_F_hard,troy_T_hard,moza_F_hard,croc_F_hard,gees_F_hard,lute_F_hard,memo_F_hard,bs_28,bs_easy,bs_hard,COC_self_count,COC_self_acc,COC_actual_count,COC_actual_acc,COC_15count,COC_acc15,COC_35count,COC_acc35,COC_55count,COC_acc55,COC_75count,COC_acc75,COC_Tcount,COC_accT,COC_Fcount,COC_accF,COC_con_all,COC_con15,COC_con35,COC_con55,COC_con75,COC_conT,COC_conF,cal_selfActual,cal_global,cal_15,cal_35,cal_55,cal_75,cal_true,cal_false,NPastDiff_pref_read,NPastDiff_pref_music,NPastDiff_pref_tv,NPastDiff_pref_nap,NPastDiff_pref_travel,NPastDiff_pers_extravert,NPastDiff_pers_critical,NPastDiff_pers_dependable,NPastDiff_pers_anxious,NPastDiff_pers_complex,NPastDiff_val_obey,NPastDiff_val_trad,NPastDiff_val_opinion,NPastDiff_val_performance,NPastDiff_val_justice,NPastDiff_life_ideal,NPastDiff_life_excellent,NPastDiff_life_satisfied,NPastDiff_life_important,NPastDiff_life_change,NFutDiff_pref_read,NFutDiff_pref_music,NFutDiff_pref_tv,NFutDiff_pref_nap,NFutDiff_pref_travel,NFutDiff_pers_extravert,NFutDiff_pers_critical,NFutDiff_pers_dependable,NFutDiff_pers_anxious,NFutDiff_pers_complex,NFutDiff_val_obey,NFutDiff_val_trad,NFutDiff_val_opinion,NFutDiff_val_performance,NFutDiff_val_justice,NFutDiff_life_ideal,NFutDiff_life_excellent,NFutDiff_life_satisfied,NFutDiff_life_important,NFutDiff_life_change,NPast_mean_pref,NPast_mean_pers,NPast_mean_val,NPast_mean_life,NFut_mean_pref,NFut_mean_pers,NFut_mean_val,NFut_mean_life,NPast_mean_total,NFut_mean_total,DGEN_past_mean,DGEN_fut_mean,eohiDGEN_pref,eohiDGEN_pers,eohiDGEN_val,eohiDGEN_life,eohiDGEN_mean,CRT01,CRT02,CRT03,demo_sex,demo_edu,demo_age_1,AOT_total,CRT1_correct,CRT2_correct,CRT3_correct,CRT1_int,CRT2_int,CRT3_int,CRT_correct,CRT_int,GROUP,TASK_DO,TEMPORAL_DO,ITEM_DO,COC_DO,ehi_pref_read,ehi_pref_music,ehi_pref_tv,ehi_pref_nap,ehi_pref_travel,ehi_pers_extravert,ehi_pers_critical,ehi_pers_dependable,ehi_pers_anxious,ehi_pers_complex,ehi_val_obey,ehi_val_trad,ehi_val_opinion,ehi_val_performance,ehi_val_justice,ehi_life_ideal,ehi_life_excellent,ehi_life_satisfied,ehi_life_important,ehi_life_change,ehi_pref_mean,ehi_pers_mean,ehi_val_mean,ehi_life_mean,ehi_global_mean,edu3 +1,R_7UW3QVlPbJl2GBF,18 - 24,Canadian,Female,-2,2,-2,-2,-3,-3,-2,0,3,1,0,0,0,-1,1,0,0,-2,-2,-2,-2,3,-2,-2,-3,1,-3,1,0,3,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,3,0,0,-2,2,-1,-2,0,1,0,2,0,1,1,1,2,1,0,0,0,0,0,2,TRUE,0,100,FALSE,0,53,FALSE,1,100,FALSE,1,55,FALSE,0,55,FALSE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,54,TRUE,1,100,FALSE,1,58,FALSE,1,61,TRUE,1,58,TRUE,0,95,TRUE,1,65,TRUE,1,55,FALSE,1,52,TRUE,0,100,FALSE,1,63,TRUE,0,62,FALSE,0,100,TRUE,1,59,TRUE,0,55,TRUE,1,100,TRUE,0,100,TRUE,1,86,TRUE,0,61,TRUE,0,75,FALSE,1,53,TRUE,1,80,FALSE,0,51,TRUE,1,64,0.0081,0.0196,0.2025,0,0.1296,0,0,0,0.3844,0.1681,0.04,0.1764,0.2916,0.1764,0.3025,0.2809,0.3025,0.2025,0.5625,1,1,0.1225,0.1369,0.9025,0.2304,0.3721,0.2601,1,0,1,0.2209,0.1521,0.336246429,0.17535,0.497142857,7,21.88,19,59.38,4,50,5,62.5,4,50,6,75,11,68.75,8,50,73.78,57.5,67.12,92.5,78,73.19,74.38,-37.5,14.4,7.5,4.62,42.5,3,4.44,24.38,0,1,0,0,0,0,3,0,0,1,0,0,0,1,0,0,0,2,2,2,2,1,2,2,1,2,0,0,2,1,0,1,1,2,1,0,0,2,2,2,0.2,0.8,0.2,1.2,1.6,1,1,1.2,0.6,1.2,1,1.67,-1,-1,0,-1,-0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,-2,0,-2,-2,-1,-2,3,0,-2,0,0,-1,-1,-1,-1,0,0,0,0,0,-1.4,-0.2,-0.8,0,-0.6,HS_TS +2,R_5mra6gsZxI5JgBU,53 - 59,Canadian,Female,3,3,-1,-2,-1,0,-2,3,1,0,3,1,3,0,3,1,1,2,2,2,2,3,-2,-3,-1,8,1,-2,2,1,0,7,3,2,3,2,3,3,1,2,2,2,0,8,2,3,2,0,-3,7,0,0,0,0,0,2,0,0,0,0,0,8,0,0,0,0,0,7,FALSE,1,50,TRUE,1,85,TRUE,0,85,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,93,TRUE,1,97,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,0,50,FALSE,0,88,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,74,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0009,0,0.7744,0.0049,0,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.0225,0.25,0.25,0.5476,0.25,1,0.25,0.25,1,0.25,0.25,0.25,0.25,0.7225,1,0.25,1,0.349735714,0.180178571,0.519292857,16,50,17,53.13,4,50,5,62.5,5,62.5,3,37.5,9,56.25,8,50,69.44,54.38,62.5,80.38,80.5,75.81,63.06,-3.13,16.31,4.38,0,17.88,43,19.56,13.06,1,0,1,1,0,1,0,1,0,0,0,1,0,2,0,0,1,0,0,2,1,0,3,2,2,0,2,3,1,0,3,1,3,0,3,1,1,2,2,2,0.6,0.4,0.6,0.6,1.6,1.2,2,1.6,0.55,1.6,6,5.67,1,5,-5,1,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),58,1.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,-2,-1,-2,1,-2,-2,-1,0,-3,0,-3,2,-3,-1,0,-2,-2,0,-1,-0.8,-1.4,-1,-1.05,HS_TS +3,R_7GwZPZK1uNHwyRZ,53 - 59,Canadian,Male,-1,2,0,1,3,-3,1,1,1,-1,1,3,2,1,2,1,-1,1,1,1,-1,3,0,2,3,7,1,1,1,0,0,7,2,1,2,1,3,7,1,2,1,2,2,7,-1,3,0,1,3,6,1,2,0,1,0,8,1,2,2,1,1,7,1,2,2,1,0,7,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,62,TRUE,1,100,TRUE,1,100,FALSE,1,78,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0.0625,0,0,1,0,0,0,0,0,1,0,1,0,0,0.1444,0.0484,0,0,0,1,1,0,1,0.259117857,0.147321429,0.370914286,29,90.63,25,78.13,7,87.5,7,87.5,7,87.5,4,50,14,87.5,11,68.75,97.34,100,97.25,92.12,100,98.44,96.25,12.5,19.21,12.5,9.75,4.62,50,10.94,27.5,0,1,0,1,0,4,0,0,1,1,1,2,0,0,1,0,3,0,1,1,0,1,0,0,0,4,1,1,0,1,0,1,0,0,1,0,3,1,0,1,0.4,1.2,0.8,1,0.2,1.4,0.4,1,0.85,0.75,7,7,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,58,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,0,0,-1,-1,1,0,1,1,0,0,0,0,0,-1,1,0,0.2,-0.2,0.4,0,0.1,C_Ug +4,R_1nMWQYBUmr27PZ5,67 - 73,American,Female,-3,2,3,2,3,-3,-3,3,-3,0,3,3,3,-3,3,2,-2,1,2,-2,-3,3,3,3,3,0,-3,-3,3,-3,0,0,3,3,3,-3,0,0,2,1,3,3,-3,1,0,0,0,0,0,5,0,0,0,0,0,5,3,0,0,-3,0,4,0,0,2,2,-3,4,TRUE,0,54,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,53,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,60,TRUE,1,52,TRUE,0,51,FALSE,1,93,TRUE,0,93,TRUE,1,97,TRUE,1,73,TRUE,1,100,0,0.2304,0,0,0,0,0.0576,0,0,0,0.0009,0,0.2209,0,0.25,0,0,0.25,0.0049,0.36,1,0.25,0,1,0,0.2601,0.0729,0.2916,0,0,0.8649,1,0.210135714,0.055671429,0.3646,28,87.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,86,72.12,92.88,83.25,95.75,84.44,87.56,15.62,14.12,-2.88,30.38,20.75,8.25,3.19,25.06,0,1,0,1,0,0,0,0,0,0,0,0,0,0,3,0,3,2,1,1,3,2,3,2,3,3,3,3,3,0,0,3,3,0,3,2,2,1,0,1,0.4,0,0.6,1.4,2.6,2.4,1.8,1.2,0.6,2,0,4.67,-5,-5,-4,-3,-4.67,10 cents,5 minutes,47 days,Female,High School (or equivalent),71,0.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,-3,-1,-3,-1,-3,-3,-3,-3,-3,0,0,-3,-3,0,0,-2,1,1,1,0,-2.2,-2.4,-1.2,0.2,-1.4,HS_TS +5,R_61dWTD6v8MMe6Hl,67 - 73,American,Female,3,3,3,2,3,3,3,3,3,3,1,2,3,-3,2,-3,-3,-3,-3,-3,3,3,3,2,3,0,3,0,3,3,3,1,1,3,3,-3,2,1,-1,-3,-3,-1,-3,9,3,3,3,2,2,1,3,0,3,0,3,4,1,3,3,-2,2,2,-2,-2,-2,-2,-2,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,87,TRUE,1,87,TRUE,0,89,TRUE,1,88,TRUE,1,88,TRUE,1,85,TRUE,1,100,FALSE,1,97,TRUE,0,94,TRUE,1,95,TRUE,0,100,TRUE,1,82,TRUE,1,100,FALSE,1,91,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,90,FALSE,0,84,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0144,0,0,0.0144,0,0.7921,0,0,0,0.7056,0,0.0025,0.0225,0.0009,0.0169,0,0,0.0169,0,0,0.81,0.0324,0,1,0.0081,0.5625,1,1,1,1,1,0.8836,0.351928571,0.111242857,0.592614286,22,68.75,21,65.63,6,75,5,62.5,4,50,6,75,13,81.25,8,50,94.75,90.75,94,96.5,97.75,93.69,95.81,3.12,29.12,15.75,31.5,46.5,22.75,12.44,45.81,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,2,0,0,2,0,0,0,0,0,1,0,3,0,3,0,0,1,0,1,0,1,1,1,1,1,0,0.6,0.2,0.8,0.2,1.2,0.4,1,0.4,0.7,0.67,2.33,-1,-3,-1,8,-1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),71,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,0,-3,0,0,0,0,-1,0,1,-1,-1,1,-1,-0.2,-0.6,-0.2,-0.2,-0.3,HS_TS +6,R_6DndYBp6h4JJNOQ,53 - 59,Canadian,Female,3,2,3,-3,1,2,-2,3,0,1,2,-2,3,0,2,0,1,1,1,-2,3,2,3,-3,2,0,2,-2,3,0,1,1,3,-3,2,0,2,1,1,1,2,2,-2,3,3,2,3,1,1,4,2,1,2,0,1,4,2,-1,2,-1,2,1,1,1,1,2,0,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,1,96,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,59,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,96,FALSE,1,95,TRUE,0,81,TRUE,1,95,FALSE,0,76,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.1681,0.0025,0.0016,0.5776,0.0361,0.16,0,1,0.36,0.0025,1,0.25,0.25,0.25,1,0,0.0016,0.5776,1,1,0,0.6561,1,0.331917857,0.164707143,0.499128571,28,87.5,20,62.5,4,50,5,62.5,5,62.5,6,75,12,75,8,50,88.28,73.62,85.88,94.88,98.75,85.12,91.44,25,25.78,23.62,23.38,32.38,23.75,10.12,41.44,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,4,0,0,3,1,0,0,0,1,1,1,0,1,0,0,1,2,0.2,0,0.6,0.6,0.8,0.8,0.6,0.8,0.35,0.75,0.67,3,-4,-3,0,-1,-2.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,58,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,-4,1,0,-3,-1,0,0,1,0,0,-1,0,0,0,1,0,-2,-0.6,-0.8,0,-0.2,-0.4,C_Ug +7,R_1PDDLmZmpxdk7BL,39 - 45,Canadian,Female,-1,1,1,1,1,0,-1,1,-1,1,1,0,0,0,0,-1,-1,-1,-1,-1,0,1,1,1,1,7,-1,-1,1,-1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,-1,-1,-1,1,-1,7,1,1,1,1,1,8,1,1,1,1,1,7,TRUE,0,94,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,66,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1156,0.25,0.25,0.25,0.25,0.25,0.5476,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.8836,0.25,0.25,0.25,1,0.332028571,0.2404,0.423657143,5,15.63,16,50,5,62.5,6,75,3,37.5,2,25,5,31.25,11,68.75,55.75,52,56.25,55.5,59.25,54.12,57.38,-34.37,5.75,-10.5,-18.75,18,34.25,22.87,-11.37,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,0,0,0,0,1,0,2,2,2,0,1,1,1,1,2,2,2,2,2,0.2,0.2,0.8,2,0.4,1.4,0.8,2,0.8,1.15,7,7.33,0,0,-1,0,-0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,45,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,0,0,0,0,0,0,-2,-2,-2,0,0,0,0,0,0,0,0,0,0,-0.2,-1.2,0,0,-0.35,C_Ug +8,R_7ymc6kKk1g2zyfc,53 - 59,Canadian,Female,3,3,3,-2,2,-1,1,3,2,2,1,-2,1,0,3,-2,-1,-2,1,-2,3,3,2,2,3,4,0,1,3,1,2,4,1,-1,2,1,3,4,1,-1,0,2,0,5,3,3,3,0,1,4,-1,1,3,1,2,4,1,-2,2,0,3,3,-1,0,0,-1,-1,5,FALSE,1,100,TRUE,1,72,FALSE,1,92,FALSE,1,70,TRUE,1,89,FALSE,1,100,TRUE,1,95,TRUE,1,96,TRUE,1,100,TRUE,1,100,FALSE,1,59,TRUE,0,91,TRUE,1,76,FALSE,1,100,FALSE,0,58,TRUE,1,100,FALSE,1,59,TRUE,0,90,TRUE,0,83,FALSE,1,100,FALSE,0,83,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,77,FALSE,1,96,FALSE,1,100,TRUE,0,99,TRUE,1,87,FALSE,0,97,TRUE,1,100,0.0016,0.0529,0,0.0025,0,0,0,0,0,0,0.0169,0.0576,0,0.1681,0.0121,0.0784,0,0.09,0,0.01,0.6889,0.3364,0.6889,0,0.1681,0.0016,0.9409,0,0.0064,0.81,0.9801,0.8281,0.210089286,0.030221429,0.389957143,25,78.13,25,78.13,5,62.5,6,75,7,87.5,7,87.5,13,81.25,12,75,89.34,79.38,88.25,94,95.75,89.38,89.31,0,11.21,16.88,13.25,6.5,8.25,8.13,14.31,0,0,1,4,1,1,0,0,1,0,0,1,1,1,0,3,0,2,1,2,0,0,0,2,1,0,0,0,1,0,0,0,1,0,0,1,1,2,2,1,1.2,0.4,0.6,1.6,0.6,0.2,0.2,1.4,0.95,0.6,4,3.67,0,0,1,0,0.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,53,1.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,1,2,0,1,0,0,0,0,0,1,0,1,0,2,-1,0,-1,1,0.6,0.2,0.4,0.2,0.35,C_Ug +9,R_7P6m5sDPPv0UQuJ,39 - 45,Canadian,Male,2,3,2,0,1,1,-3,2,-3,2,1,1,1,1,1,1,1,1,1,1,2,3,3,0,2,7,1,-3,2,-3,2,2,2,2,2,2,2,2,0,0,0,-2,-2,7,1,2,2,0,1,7,1,-3,2,-2,2,2,2,-1,-1,-1,-1,3,1,0,1,3,0,2,TRUE,0,95,FALSE,0,88,FALSE,1,58,FALSE,1,50,FALSE,0,50,TRUE,0,70,TRUE,1,81,FALSE,0,50,FALSE,0,50,TRUE,1,85,FALSE,1,50,FALSE,1,66,TRUE,1,78,TRUE,0,88,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,0,75,TRUE,0,59,FALSE,1,100,TRUE,1,100,FALSE,0,50,TRUE,0,50,FALSE,0,55,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,0,70,TRUE,0,75,TRUE,1,85,FALSE,0,61,TRUE,1,100,0.25,0.25,0.0025,0.0361,0,0.49,0.3025,0.0225,0,0.25,0.0225,0.0484,0.25,0.25,0.25,0.7744,0.25,0.25,0.49,1,0,0.25,0.3481,0.7744,0.25,0.25,0.3721,0.9025,0.1764,0.5625,0.5625,0.1156,0.329085714,0.225735714,0.432435714,16,50,13,40.63,3,37.5,3,37.5,2,25,5,62.5,7,43.75,6,37.5,69.81,57.25,71.62,78,72.38,70.5,69.12,9.37,29.18,19.75,34.12,53,9.88,26.75,31.62,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,3,3,1,1,0,0,0,0,0,0,1,0,1,2,2,2,2,0,1,0,2,1,0.4,0,1,1.8,0.4,0.2,1.8,0.8,0.8,0.8,3.67,4,0,0,-1,5,-0.33,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,40,1.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,-1,-1,1,0,1,0,0,0,-1,0,0,-1,-1,-1,-1,1,0,1,1,2,0,-0.2,-0.8,1,0,C_Ug +10,R_5F5l8L8SX8iBoiH,60 - 66,Canadian,Female,3,2,3,0,2,1,-1,2,-3,0,0,0,1,0,1,2,2,2,3,-1,3,3,1,-2,3,7,1,0,2,-3,0,2,2,2,2,2,1,8,1,2,1,3,-1,7,3,1,2,1,-1,5,1,-1,2,-3,-1,2,1,1,2,-1,2,1,2,2,2,3,2,1,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,0,50,TRUE,1,93,FALSE,1,92,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,75,TRUE,0,71,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,TRUE,0,90,TRUE,0,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0064,0,0,0.5041,0,0,0,0.25,0.09,0.0049,0.04,0,0.25,0.81,0,0.09,0.25,0.0625,1,0.2916,0.5041,0,0,0,1,0.81,1,0.2487,0.081814286,0.415585714,27,84.38,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,87.69,68.25,87.38,100,95.12,90.19,85.19,12.5,15.81,-6.75,12.38,25,32.62,-9.81,41.44,0,1,2,2,1,0,1,0,0,0,2,2,1,2,0,1,0,1,0,0,0,1,1,1,3,0,0,0,0,1,1,1,1,1,1,0,0,0,0,3,1.2,0.2,1.4,0.4,1.2,0.2,1,0.6,0.8,0.75,5.67,2.67,2,0,7,6,3,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,1.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,1,1,-2,0,1,0,0,-1,1,1,0,1,-1,1,0,1,0,-3,0,0,0.4,-0.2,0.05,HS_TS +11,R_3PvzFllH1poEz69,67 - 73,Canadian,Male,2,2,2,0,2,1,0,2,0,1,3,1,3,0,2,1,2,2,2,-1,2,2,2,0,2,6,0,0,0,0,0,6,3,1,3,0,2,6,2,2,2,2,-1,6,2,2,2,0,1,6,2,0,2,0,2,6,2,2,3,0,2,6,2,2,2,2,-1,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,0,0,0,0,0,0.25,0.25,0,0,0.25,0,0.25,0,0.25,1,1,0.25,1,0,0,1,1,1,1,0.3125,0.071428571,0.553571429,24,75,21,65.63,4,50,5,62.5,6,75,6,75,16,100,5,31.25,89.06,81.25,81.25,93.75,100,93.75,84.38,9.37,23.43,31.25,18.75,18.75,25,-6.25,53.13,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0.8,0,0.2,0.2,0.4,0.4,0.2,0.25,0.3,6,6,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,67,1.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,2,0,0,-1,-1,0,0,0,0,0,0,0,0,-0.2,0.4,-0.4,0,-0.05,C_Ug +12,R_5L4NB0Flxbu1zDL,46 - 52,Canadian,Male,2,2,2,2,2,1,1,1,-2,1,2,-2,2,-2,2,-2,-2,-2,-2,2,2,2,2,2,2,5,2,2,2,-2,2,5,2,2,2,2,2,5,-2,-2,-2,-2,-2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,86,TRUE,1,89,FALSE,1,90,FALSE,1,88,TRUE,1,80,TRUE,0,79,TRUE,1,77,TRUE,1,84,TRUE,1,83,TRUE,1,79,FALSE,1,79,TRUE,0,92,TRUE,1,77,FALSE,1,75,TRUE,1,77,TRUE,1,95,TRUE,0,73,FALSE,1,68,TRUE,0,74,TRUE,0,69,TRUE,1,74,TRUE,1,76,FALSE,1,66,FALSE,0,79,FALSE,1,83,TRUE,1,81,FALSE,1,61,FALSE,1,62,FALSE,1,67,TRUE,1,71,FALSE,0,68,TRUE,1,89,0.0256,0.0361,0.0025,0.0529,0.0121,0.6241,0.6241,0.0441,0.4761,0.0576,0.0841,0.0529,0.0289,0.0441,0.04,0.0121,0.1156,0.0144,0.1444,0.0289,0.0676,0.0529,0.5476,0.0625,0.5329,0.1521,0.4624,0.7396,0.01,0.1024,0.1089,0.8464,0.217457143,0.1593,0.275614286,12,37.5,24,75,6,75,6,75,7,87.5,5,62.5,14,87.5,10,62.5,77.84,77.38,75.62,78.12,80.25,79.94,75.75,-37.5,2.84,2.38,0.62,-9.38,17.75,-7.56,13.25,0,0,0,0,0,1,1,1,0,1,0,4,0,4,0,0,0,0,0,4,2,2,2,2,2,1,1,1,2,1,2,2,2,2,2,2,2,2,2,2,0,0.8,1.6,0.8,2,1.2,2,2,0.8,1.8,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),46,0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,-2,-2,-2,-2,-2,0,0,0,-2,0,-2,2,-2,2,-2,-2,-2,-2,-2,2,-2,-0.4,-0.4,-1.2,-1,HS_TS +13,R_5DNhjyQhmJfztEG,53 - 59,Canadian,Female,3,3,3,2,-2,-1,-3,1,0,-1,3,0,2,-2,3,1,1,2,1,1,3,3,3,3,-2,5,1,-3,2,-1,-1,3,3,2,2,0,3,2,2,2,2,1,1,8,3,3,3,3,-3,5,0,-3,0,-3,-3,3,3,2,2,-2,2,5,0,1,1,0,1,5,TRUE,0,100,TRUE,1,80,TRUE,0,68,FALSE,1,64,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,0,89,FALSE,0,66,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,61,FALSE,0,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,73,FALSE,1,74,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,1,0,0.4356,0,0.5329,0,0,0.7921,1,0,0.04,0.0676,0.1296,0.25,1,0,0.4225,0,0.1521,1,1,0.25,1,0.4624,1,1,1,0.447671429,0.285557143,0.609785714,17,53.13,17,53.13,3,37.5,5,62.5,3,37.5,6,75,11,68.75,6,37.5,88.75,81,96.75,87.5,89.75,88.94,88.56,0,35.62,43.5,34.25,50,14.75,20.19,51.06,0,0,0,1,0,2,0,1,1,0,0,2,0,2,0,1,1,0,0,0,0,0,0,1,1,1,0,1,3,2,0,2,0,0,1,1,0,1,1,0,0.2,0.8,0.8,0.4,0.4,1.4,0.6,0.6,0.55,0.75,3.33,4.33,0,0,-3,3,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,59,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,-1,1,0,0,-2,-2,0,0,0,2,-1,0,1,-1,-1,0,-0.2,-0.6,0.2,-0.2,-0.2,C_Ug +14,R_1E0YgrofVrYuFKH,60 - 66,American,Female,3,2,2,2,2,-2,0,2,0,0,1,-1,2,0,2,-1,0,0,1,-1,3,2,2,0,1,4,-1,-1,1,-1,-1,7,1,-1,2,1,2,2,-1,0,0,1,-1,6,3,2,1,2,1,3,-2,-1,2,-1,0,2,1,-1,2,-1,2,2,0,0,0,0,-1,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,86,FALSE,1,96,TRUE,1,95,TRUE,0,97,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,72,FALSE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,92,FALSE,1,97,TRUE,0,80,TRUE,1,92,FALSE,0,74,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0064,0.0025,0,0.0196,0,0,0,0.2304,0.0009,0,0.0081,0.0625,0.5184,0.9409,0,0.8464,0.5476,0,0,1,0.64,0.0016,0.172332143,0.018492857,0.326171429,29,90.63,26,81.25,5,62.5,7,87.5,6,75,8,100,15,93.75,11,68.75,93.72,81.38,95.75,99.62,98.12,95.44,92,9.38,12.47,18.88,8.25,24.62,-1.88,1.69,23.25,0,0,0,2,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0.6,1,0.2,0,0.4,0.4,0.2,0.4,0.45,0.35,4.33,2.33,1,5,0,3,2,5 cents,5 minutes,24 days,Female,University - Undergraduate,62,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,-1,2,0,1,0,1,0,1,0,0,0,0,0,-1,0,0,-1,0,0.2,0.6,0,-0.4,0.1,C_Ug +15,R_5RduTzrkolBe5dB,60 - 66,Canadian,Female,-1,1,2,-1,-1,-1,-1,1,0,0,1,1,1,0,1,-1,0,0,1,-1,0,1,1,-1,1,6,-1,0,1,-1,0,6,0,1,-1,0,0,6,1,1,1,1,1,6,0,0,1,-1,-1,5,-1,0,1,0,-1,5,0,1,1,1,0,5,-1,-1,0,0,0,5,TRUE,0,64,FALSE,0,62,FALSE,1,81,FALSE,1,78,TRUE,1,71,FALSE,1,82,TRUE,1,90,TRUE,1,78,FALSE,0,80,TRUE,1,79,FALSE,1,80,TRUE,0,80,TRUE,1,81,TRUE,0,90,FALSE,0,100,TRUE,1,89,TRUE,0,99,TRUE,0,88,TRUE,0,97,FALSE,1,86,FALSE,0,81,TRUE,1,90,FALSE,1,88,TRUE,1,93,FALSE,1,99,TRUE,1,100,FALSE,1,98,TRUE,0,87,FALSE,1,100,TRUE,1,100,FALSE,0,84,TRUE,1,93,0.0484,0,0.0121,0.01,0.0049,0.0324,0.0049,0.0441,0.0196,0.01,0,0.0361,0.64,0.04,0.0841,0.3844,0.0144,0.0484,0.7569,0.0001,0.6561,1,0.9409,0.81,0.9801,0.0004,0.7056,0.4096,0.0361,0.7744,0,0.64,0.324053571,0.097378571,0.550728571,19,59.38,20,62.5,3,37.5,6,75,5,62.5,6,75,11,68.75,9,56.25,86.5,84.88,86.88,87.5,86.75,85.69,87.31,-3.12,24,47.38,11.88,25,11.75,16.94,31.06,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,2,1,1,0,2,1,1,1,0,0,0,1,0,0,1,1,0,0,1,1,0,1,0,1,1,0.8,0.4,0.8,1.2,0.6,0.4,0.6,0.6,0.8,0.55,6,5,1,1,1,1,1,10 cents,100 minutes,36 days,Female,High School (or equivalent),62,-0.25,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,-1,0,0,2,0,0,0,1,-1,0,0,2,-1,0,2,0,1,-1,1,0.2,0,0.2,0.6,0.25,HS_TS +16,R_7LW9FcFtqnMtwZj,67 - 73,Canadian,Male,3,2,2,0,0,1,-1,2,-1,0,3,1,1,0,1,0,1,1,1,-1,3,2,2,0,0,2,2,-1,2,-1,0,4,2,2,0,2,0,3,0,1,1,0,0,3,3,2,3,2,-2,7,1,0,0,0,-1,3,2,-2,0,-2,-2,5,0,0,1,1,0,7,TRUE,0,75,TRUE,1,60,TRUE,0,60,FALSE,1,50,TRUE,1,51,FALSE,1,100,TRUE,1,65,TRUE,1,90,TRUE,1,78,TRUE,1,64,FALSE,1,56,FALSE,1,53,TRUE,1,55,FALSE,1,100,TRUE,1,50,TRUE,1,61,FALSE,1,77,TRUE,0,98,TRUE,0,50,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,73,FALSE,1,83,FALSE,1,100,FALSE,1,53,TRUE,1,94,FALSE,0,50,TRUE,1,75,0.01,0.0729,0.1521,0.1225,0.0625,0,0.25,0.1296,0,0,0.0036,0.2025,0.0484,0.1936,0.2401,0.16,0,0.25,0,0.25,0.1225,0.25,0.25,0,0.0529,0.0289,0.25,0.5625,0.36,0.9604,0.2209,0.2209,0.181046429,0.110021429,0.252071429,23,71.88,26,81.25,6,75,8,100,6,75,6,75,14,87.5,12,75,71.44,59.62,72,78.12,76,67.56,75.31,-9.37,-9.81,-15.38,-28,3.12,1,-19.94,0.31,0,0,0,0,0,1,0,0,0,0,1,1,1,2,1,0,0,0,1,1,0,0,1,2,2,0,1,2,1,1,1,3,1,2,3,0,1,0,0,1,0,0.2,1.2,0.4,1,1,2,0.4,0.45,1.1,3,5,-5,1,-2,-4,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,68,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,-1,-2,-2,1,-1,-2,-1,-1,0,-2,0,0,-2,0,-1,0,1,0,-1,-0.8,-0.8,0,-0.65,C_Ug +17,R_11ZL15wRsIhme41,67 - 73,American,Female,3,2,3,3,3,1,-2,2,1,1,3,1,1,-1,2,1,1,1,-1,-3,3,3,3,3,3,7,-2,1,3,2,1,8,3,3,1,-2,3,6,-3,-3,-3,-3,-3,9,2,2,2,2,2,7,-1,-2,1,-1,0,5,3,3,-1,-3,3,3,-1,-2,1,-2,-3,6,TRUE,0,78,TRUE,1,83,FALSE,1,86,FALSE,1,52,TRUE,1,54,FALSE,1,53,TRUE,1,77,TRUE,1,74,FALSE,0,56,TRUE,1,78,FALSE,1,78,TRUE,0,81,TRUE,1,77,TRUE,0,100,FALSE,0,53,TRUE,1,100,FALSE,1,53,TRUE,0,69,FALSE,1,61,FALSE,1,100,TRUE,1,79,TRUE,1,76,FALSE,1,92,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,91,FALSE,1,58,TRUE,1,100,TRUE,1,85,TRUE,1,100,0.0676,0,0,0.0529,0,0.2209,0.0625,0.0484,0,0.0576,0,0.0529,0.3136,0.0484,0.2116,0.0289,0.0064,0.2304,0.0081,0,0.0441,0.2809,0.1521,1,0.2209,1,0.0225,0.6084,0.0196,0.4761,0.1764,0.6561,0.212385714,0.091542857,0.333228571,19,59.38,25,78.13,5,62.5,8,100,5,62.5,7,87.5,14,87.5,11,68.75,78.72,71,70.75,84.75,88.38,79.19,78.25,-18.75,0.59,8.5,-29.25,22.25,0.88,-8.31,9.5,0,1,0,0,0,3,3,1,1,0,0,2,0,1,1,4,4,4,2,0,1,0,1,1,1,2,0,1,2,1,0,2,2,2,1,2,3,0,1,0,0.2,1.6,0.8,2.8,0.8,1.2,1.4,1.2,1.35,1.15,7,5,0,3,3,3,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,68,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,1,-1,-1,-1,1,3,0,-1,-1,0,0,-2,-1,0,2,1,4,1,0,-0.6,0.4,-0.6,1.6,0.2,C_Ug +18,R_6uIjsIW8BBWcSri,67 - 73,Canadian,Male,-2,3,3,-3,2,-3,-3,3,-3,-1,2,2,2,-3,2,2,1,2,2,1,-2,3,1,-3,0,2,-3,-3,2,-2,-1,1,2,2,1,-3,2,2,-1,-1,-1,-2,-3,7,-2,3,3,2,1,2,-3,-2,2,-2,-2,2,2,2,1,-3,2,1,1,1,2,2,1,4,TRUE,0,75,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,86,FALSE,1,50,TRUE,0,100,TRUE,1,91,TRUE,0,50,FALSE,0,50,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,88,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,71,TRUE,1,100,0,0,0,0,0,0,0,0.0196,0,0,0,0.0081,0.25,0.25,0.25,0,0,0.25,1,0.7744,0.7056,0.25,1,0.25,0.7744,0.25,0.0841,0.5625,1,0,1,1,0.345667857,0.073407143,0.617928571,25,78.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,14,87.5,6,37.5,85.41,65.12,89.12,87.38,100,86.38,84.44,15.63,22.91,2.62,26.62,24.88,37.5,-1.12,46.94,0,0,2,0,2,0,0,1,1,0,0,0,1,0,0,3,2,3,4,4,0,0,0,5,1,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0.8,0.4,0.2,3.2,1.2,0.8,0.2,0.2,1.15,0.6,1.67,1.67,0,-1,1,3,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),70,0.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,2,-5,1,0,-1,0,0,-1,0,0,0,0,0,2,2,3,4,4,-0.4,-0.4,0,3,0.55,HS_TS +19,R_3jIXWL517XN41G2,46 - 52,American,Male,-2,2,2,3,3,-2,-2,2,1,2,2,-2,3,-3,3,-3,-3,-3,-3,-3,-1,2,2,1,3,3,-2,-1,2,1,3,3,2,-2,3,-3,3,3,-3,-3,-3,-3,-3,3,2,1,2,3,3,3,-2,-1,2,1,3,3,2,-2,3,-3,3,3,-3,-3,-3,-2,-3,3,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,55,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,74,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,0,100,TRUE,1,51,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,69,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,87,TRUE,1,100,TRUE,0,50,TRUE,0,56,TRUE,0,61,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0064,0.0676,0,0.0064,0,0,0.2025,0.3136,0.0169,0,0.2401,0.0961,1,0.25,0.25,0,0,0.7396,0,0.3721,0,0.127189286,0.020207143,0.234171429,28,87.5,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,88.22,74.88,86.88,98.38,92.75,94.31,82.12,3.12,3.84,-12.62,-0.62,10.88,17.75,-5.69,13.37,1,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0.6,0.4,0,0,1,0.4,0,0.2,0.25,0.4,3,3,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,51,1.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-3,-1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-0.4,0,0,-0.2,-0.15,C_Ug +20,R_72nDnI9zDRG0eCR,67 - 73,Canadian,Male,1,3,1,0,1,-1,1,2,0,0,1,2,3,1,1,-1,-2,0,1,-1,1,3,2,0,1,0,0,1,2,0,0,1,1,2,2,1,1,0,-1,-1,0,1,-1,0,1,3,2,0,1,0,-1,1,2,0,0,0,1,2,2,1,1,0,0,0,0,0,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,76,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,91,TRUE,0,100,FALSE,1,76,FALSE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0576,0.0081,0,0,0,0,0,0.01,0,0.25,0,0,0.25,0,0,0.0064,0.09,0.0576,0,0.8281,0,0,1,1,1,0,1,0.198492857,0.041121429,0.355864286,27,84.38,27,84.38,8,100,7,87.5,6,75,6,75,16,100,11,68.75,93.31,85.75,88.62,100,98.88,93.31,93.31,0,8.93,-14.25,1.12,25,23.88,-6.69,24.56,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,2,0,1,0,0.2,0.2,0.2,0.2,0.2,0,0.2,0.8,0.2,0.3,0.33,0,0,1,0,-2,0.33,10 cents,5 minutes,47 days,Male,Trade School (non-military),67,0.875,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,-1,-1,0,-1,0,0,0.2,0,-0.6,-0.1,HS_TS +21,R_3xtXT1ced0XvMfT,60 - 66,Canadian,Female,2,1,0,0,1,-2,0,1,1,0,2,2,2,0,2,0,-1,-1,1,-1,2,1,0,1,1,4,-2,0,1,0,1,4,2,2,1,0,2,4,0,0,0,0,0,4,2,1,0,1,1,4,-2,0,1,1,0,4,1,2,1,0,1,4,0,0,1,1,0,4,FALSE,1,100,TRUE,1,89,TRUE,0,97,TRUE,0,50,TRUE,1,100,FALSE,1,99,TRUE,1,96,TRUE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,91,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,91,TRUE,0,50,TRUE,0,97,FALSE,1,65,FALSE,1,100,TRUE,1,86,TRUE,1,70,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,58,TRUE,0,50,FALSE,1,50,TRUE,0,77,FALSE,0,95,FALSE,0,50,TRUE,1,95,0,0.1764,0.0081,0.0016,0.0025,0.0001,0.04,0.25,0,0.09,0.9025,0,0.25,0.25,0,0.0121,0,0.25,0.25,0,0.0196,0.25,0.1225,0.25,0.25,0.25,0.25,0,0.9409,0.9409,0.5929,0.8281,0.249717857,0.146228571,0.353207143,21,65.63,21,65.63,5,62.5,6,75,5,62.5,5,62.5,13,81.25,8,50,77.69,56.75,88.38,77.62,88,78.75,76.62,0,12.06,-5.75,13.38,15.12,25.5,-2.5,26.62,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,2,0,1,0.2,0.4,0.2,0.8,0.2,0,0.6,0.8,0.4,0.4,4,4,0,0,0,0,0,10 cents,100 minutes,47 days,Female,University - Undergraduate,60,0.625,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,1,1,-1,0,0,0,-1,0,0,-1,1,0,0,0.4,-0.4,0,0,C_Ug +22,R_6z03p5JYjs5B7kR,53 - 59,Canadian,Female,2,3,3,1,3,0,1,0,1,0,2,3,3,-1,1,-1,-3,-2,1,-2,2,3,3,1,2,2,2,2,2,1,1,3,1,3,3,0,1,2,2,1,2,1,-1,7,3,3,3,3,3,2,0,1,2,1,1,2,2,3,3,0,1,3,1,-1,-1,1,-2,5,TRUE,0,100,TRUE,1,100,TRUE,0,98,TRUE,0,78,FALSE,0,53,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,99,TRUE,0,67,TRUE,0,100,TRUE,1,99,TRUE,0,97,TRUE,1,79,TRUE,1,99,TRUE,0,85,TRUE,0,92,FALSE,1,55,FALSE,1,63,TRUE,1,94,FALSE,0,54,TRUE,0,66,TRUE,1,94,TRUE,0,98,TRUE,1,96,TRUE,0,55,TRUE,0,99,TRUE,0,87,TRUE,1,100,FALSE,0,61,TRUE,1,98,0,0.0016,0.0001,0,0.0004,0.2025,0.0036,0.0001,0.1369,0.2916,0,0.0001,0.0256,0.4489,0.2809,0,0.4356,0.6084,0.9801,0.9604,0.0036,0.0441,0.2025,0.9409,0.7225,0.3025,0.3721,1,0.9604,0.8464,0.7569,1,0.411678571,0.1739,0.649457143,27,84.38,16,50,4,50,4,50,3,37.5,5,62.5,13,81.25,3,18.75,84.53,72.38,79.62,92,94.12,88.12,80.94,34.38,34.53,22.38,29.62,54.5,31.62,6.87,62.19,0,0,0,0,1,2,1,2,0,1,1,0,0,1,0,3,4,4,0,1,1,0,0,2,0,0,0,2,0,1,0,0,0,1,0,2,2,1,0,0,0.2,1.2,0.4,2.4,0.6,0.6,0.2,1,1.05,0.6,2.33,2.33,0,1,-1,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),55,0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,-1,0,0,-2,1,2,1,0,0,0,1,0,0,0,0,1,2,3,0,1,-0.4,0.6,0.2,1.4,0.45,HS_TS +23,R_34cU3jQU6zArgQN,60 - 66,Canadian,Male,-2,3,2,-2,2,3,-3,3,-3,1,2,2,3,1,2,2,2,3,3,2,-2,3,2,-2,2,1,3,-3,3,-3,1,1,2,2,3,1,2,1,2,2,2,2,2,1,-2,3,2,-2,1,1,3,-3,3,-3,1,1,2,2,3,1,2,1,2,1,2,2,2,1,TRUE,0,52,TRUE,1,60,TRUE,0,94,FALSE,1,50,TRUE,1,50,TRUE,0,52,TRUE,1,98,TRUE,1,93,TRUE,1,52,TRUE,1,70,TRUE,0,53,TRUE,0,95,TRUE,1,97,TRUE,0,78,TRUE,1,52,TRUE,1,94,TRUE,0,67,FALSE,1,60,TRUE,0,56,FALSE,1,90,TRUE,1,52,TRUE,1,56,TRUE,0,63,TRUE,1,84,TRUE,0,87,TRUE,1,95,TRUE,0,52,FALSE,1,84,TRUE,0,58,TRUE,1,86,TRUE,1,89,TRUE,1,91,0.0049,0.0025,0.0036,0.0004,0.0081,0.2704,0.0256,0.09,0.01,0.1936,0.0196,0.0009,0.2304,0.2809,0.25,0.16,0.3969,0.25,0.0256,0.7569,0.2304,0.2304,0.3136,0.6084,0.4489,0.2704,0.0121,0.2704,0.8836,0.16,0.3364,0.9025,0.272714286,0.156171429,0.389257143,21,65.63,20,62.5,5,62.5,4,50,5,62.5,6,75,16,100,4,25,72.19,58,66.25,74.5,90,76.19,68.19,3.13,9.69,-4.5,16.25,12,15,-23.81,43.19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0.4,0.2,0,0,0.6,0.1,0.2,1,1,0,0,0,0,0,10 cents,5 minutes,24 days,Male,Trade School (non-military),65,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-0.2,0,0,-0.2,-0.1,HS_TS +24,R_1nLwqGeXAf3t7vb,53 - 59,Canadian,Male,0,1,0,1,3,-2,-2,2,1,1,1,-1,1,-3,3,1,2,2,2,1,2,3,3,1,3,5,1,0,3,1,-1,4,0,-2,2,1,3,4,-2,0,-1,-1,-1,7,1,2,2,2,0,3,0,-2,1,1,1,3,1,-2,1,-3,3,4,1,1,1,2,2,3,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,76,FALSE,1,100,TRUE,1,100,TRUE,1,76,TRUE,0,77,TRUE,1,95,FALSE,1,86,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0025,0,0,0.0576,0,0,0,0.09,0,0,0.5929,0.7396,0,0.0196,0,0.16,0.0576,1,0,1,0,0,1,0,0.64,1,0.227135714,0.1059,0.348371429,30,93.75,25,78.13,6,75,6,75,7,87.5,6,75,16,100,9,56.25,93.94,86.5,94.62,95.25,99.38,95.69,92.19,15.62,15.81,11.5,19.62,7.75,24.38,-4.31,35.94,2,2,3,0,0,3,2,1,0,2,1,1,1,4,0,3,2,3,3,2,1,1,2,1,3,2,0,1,0,0,0,1,0,0,0,0,1,1,0,1,1.4,1.6,1.4,2.6,1.6,0.6,0.2,0.6,1.75,0.75,4.33,3.33,2,1,0,4,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),56,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,1,1,1,-1,-3,1,2,0,0,2,1,0,1,4,0,3,1,2,3,1,-0.2,1,1.2,2,1,grad_prof +25,R_3CJRdTKCSIpHtQF,60 - 66,American,Male,0,2,2,-1,1,-1,0,1,-1,-1,1,1,1,-1,1,0,-1,1,-1,1,-1,2,2,-2,0,7,-1,-1,1,-1,0,7,2,1,1,0,0,4,0,0,2,0,0,8,-1,1,1,-1,0,7,0,0,1,-1,-1,5,1,0,1,0,1,5,-1,-2,0,0,-1,8,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,90,FALSE,0,82,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,FALSE,1,66,FALSE,1,75,FALSE,0,91,FALSE,1,86,FALSE,0,63,TRUE,1,74,TRUE,0,70,FALSE,1,93,FALSE,1,88,FALSE,1,100,FALSE,0,83,FALSE,0,62,FALSE,1,61,TRUE,1,70,FALSE,1,89,TRUE,1,88,FALSE,1,86,FALSE,1,92,TRUE,0,76,TRUE,1,100,TRUE,1,95,TRUE,1,100,0,0.0144,0.0676,0,0,0,0.09,0.0064,0,0.3844,0,0.8281,0,0.1156,0.6724,0,0.1521,0.01,0.0064,0.0121,0.6889,0.3969,0.0144,0.0196,0.49,0.0196,0.0025,1,1,0.0049,0.5776,0.0625,0.234085714,0.161357143,0.306814286,23,71.88,23,71.88,7,87.5,3,37.5,6,75,7,87.5,11,68.75,12,75,86.62,86,82.88,88.75,88.88,87.5,85.75,0,14.74,-1.5,45.38,13.75,1.38,18.75,10.75,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,2,0.6,0.4,0.6,0.8,0.8,0.2,0.4,1.2,0.6,0.65,6,5.67,0,2,-1,0,0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,-1,-1,1,0,-1,1,0,0,1,1,-1,0,0,1,-1,0,0,0,-1,-0.2,0.2,0.2,-0.4,-0.05,HS_TS +26,R_37BfDy3qhTKSOmA,39 - 45,Canadian,Female,2,1,3,3,-2,1,1,0,2,1,0,-3,3,0,3,1,2,1,-1,-2,2,1,3,2,-2,7,1,3,-3,2,2,3,0,-3,1,3,3,3,-2,0,-2,-2,-3,10,2,1,3,2,0,7,0,0,0,0,0,4,0,-3,3,1,3,1,0,0,0,0,0,9,FALSE,1,100,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,89,FALSE,0,100,FALSE,1,89,FALSE,1,74,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0,0,0,0.25,1,0.25,0.25,0,0,0.7921,0.0121,0.25,0.25,0.25,0.25,0,0,1,0.25,0,1,0,0.25,0.25,0,1,1,1,0.0676,0.334707143,0.253871429,0.415542857,21,65.63,16,50,3,37.5,4,50,4,50,5,62.5,7,43.75,9,56.25,81.31,66,87.5,93.75,78,77.44,85.19,15.63,31.31,28.5,37.5,43.75,15.5,33.69,28.94,0,0,0,1,0,0,2,3,0,1,0,0,2,3,0,3,2,3,1,1,0,0,0,1,2,1,1,0,2,1,0,0,0,1,0,1,2,1,1,2,0.2,1.2,1,2,0.6,1,0.2,1.4,1.1,0.8,4.33,4,0,-1,2,1,0.33,20 cents,100 minutes,24 days,Female,College Diploma/Certificate,42,1.625,0,0,0,0,1,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,0,0,-2,-1,1,3,-2,0,0,0,2,2,0,2,0,2,0,-1,-0.4,0.2,0.8,0.6,0.3,C_Ug +27,R_32QFc83XaDmeEmn,67 - 73,Canadian,Male,1,1,1,1,1,1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,23,71.88,17,53.13,4,50,4,50,4,50,5,62.5,16,100,1,6.25,100,100,100,100,100,100,100,18.75,46.87,50,50,50,37.5,0,93.75,0,0,0,0,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0.25,0.25,0,0,0,0,0,0,0,5 cents,100 minutes,24 days,Male,University - Undergraduate,68,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +28,R_3WPuG2TB1D1M4wJ,67 - 73,Canadian,Male,0,1,1,0,2,1,-1,1,-2,1,2,2,2,2,2,1,1,2,1,1,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,5,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,TRUE,0,77,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,77,TRUE,1,76,TRUE,0,50,TRUE,1,50,TRUE,1,77,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,80,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,0.25,0.25,0.0529,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.0576,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.5929,0.25,0.25,0.25,0.5929,0.251192857,0.2184,0.283985714,8,25,16,50,4,50,4,50,4,50,4,50,16,100,0,0,55.84,50,57,59.62,56.75,58.31,53.38,-25,5.84,0,7,9.62,6.75,-41.69,53.38,2,1,1,2,0,1,3,1,4,1,0,0,0,0,0,1,1,0,1,1,2,1,1,2,0,1,3,1,4,1,0,0,0,0,0,1,1,0,1,1,1.2,2,0,0.8,1.2,2,0,0.8,1,1,7,8,0,0,-3,0,-1,10 cents,5 minutes,47 days,Male,Trade School (non-military),73,0.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +29,R_3TtmXVWvij8FtpT,46 - 52,Canadian,Male,0,3,3,-3,1,2,-2,3,-2,0,3,0,3,0,3,1,1,1,1,-2,0,3,3,-3,2,1,2,-2,3,-2,0,0,3,0,3,0,3,0,1,1,1,1,-2,5,0,3,3,-2,1,4,2,-2,3,-2,0,1,3,0,3,0,3,1,1,1,1,1,-2,6,FALSE,1,100,TRUE,1,50,TRUE,0,77,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,84,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,87,FALSE,0,100,TRUE,1,75,0,0,0,0,0.0625,0,0,0,0,0.0225,0.0169,1,1,0,0.01,0.25,0,0.25,0,1,0.7056,0,0,0,0.5625,0.25,1,0,0.5929,1,0.25,1,0.320460714,0.186564286,0.454357143,22,68.75,21,65.63,5,62.5,4,50,6,75,6,75,12,75,9,56.25,89.78,81.25,84.25,98.12,95.5,91.94,87.62,3.12,24.15,18.75,34.25,23.12,20.5,16.94,31.37,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.2,0,0,0,0.05,0.05,0.33,2,-3,-1,-1,-1,-1.67,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,1.75,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +30,R_14BsEKbGVp5mLSn,67 - 73,Canadian,Female,3,2,3,1,2,0,-3,1,-3,0,0,1,1,0,-1,-2,-1,0,-2,-2,3,3,3,1,3,5,0,0,2,-3,0,5,0,2,2,0,0,5,-2,0,0,-2,-3,5,2,3,3,3,0,5,0,-3,0,-2,0,5,0,2,0,-3,0,5,-3,-2,0,-3,-3,5,FALSE,1,98,TRUE,1,100,FALSE,1,100,FALSE,1,66,FALSE,0,53,FALSE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,TRUE,1,100,TRUE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,53,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,0,80,FALSE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,84,TRUE,0,59,FALSE,1,99,TRUE,0,100,TRUE,1,100,FALSE,0,54,TRUE,1,100,0.0289,0.0256,0,0,0,0,0,0,0,0,0,0,0,0.4096,0.2809,0,0.2025,0.1156,0.0001,0,0.36,0.2809,0.64,1,0.1089,0.3481,0.2916,0.0004,0,1,1,1,0.251378571,0.072042857,0.430714286,25,78.13,21,65.63,3,37.5,5,62.5,6,75,7,87.5,12,75,9,56.25,86.72,72,79.38,97.75,97.75,86.69,86.75,12.5,21.09,34.5,16.88,22.75,10.25,11.69,30.5,0,1,0,0,1,0,3,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,2,2,0,0,1,1,0,0,1,1,3,1,1,1,0,1,1,0.4,0.8,0.6,0.4,1.2,0.4,1.2,0.8,0.55,0.9,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,72,0.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,-1,0,0,-2,-1,0,3,0,-1,0,0,0,0,-3,0,-1,0,0,-1,0,-0.8,0.4,-0.6,-0.4,-0.35,C_Ug +31,R_5vkfEv3GS4mgHJv,60 - 66,Canadian,Female,3,1,2,-2,2,1,-1,1,-1,1,1,-1,3,1,2,2,1,2,1,-1,2,1,2,-3,2,3,2,-1,2,1,2,5,1,-1,2,2,2,3,1,1,2,1,-1,5,2,1,2,-1,1,5,1,-1,1,-1,1,4,1,-1,0,0,2,4,1,1,2,2,1,6,TRUE,0,63,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,81,TRUE,1,100,FALSE,1,75,TRUE,0,96,FALSE,0,95,FALSE,1,92,TRUE,1,50,TRUE,1,100,FALSE,1,79,FALSE,1,100,TRUE,0,65,FALSE,1,100,TRUE,1,81,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,91,TRUE,0,70,FALSE,1,100,TRUE,0,75,TRUE,1,79,TRUE,1,66,TRUE,1,98,0,0.0081,0,0,0.0004,0,0,0,0,0,0.0441,0.9025,0.0361,0.0625,0,0,0,0.25,0,0,0.0361,0.25,0.4225,0.0064,0.0441,0.49,0.1156,0.3969,0,0,0.5625,0.9216,0.162189286,0.092542857,0.231835714,26,81.25,26,81.25,6,75,6,75,7,87.5,7,87.5,15,93.75,11,68.75,87.69,69.62,91,93.25,96.88,90.06,85.31,0,6.44,-5.38,16,5.75,9.38,-3.69,16.56,1,0,0,1,0,1,0,1,2,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,3,1,0,1,0,0,1,2,0.4,1,0.4,0.2,0.6,0,0.8,0.8,0.5,0.55,3.67,4.33,-2,1,-1,-1,-0.66,10 cents,5 minutes,15 days,Female,University - Undergraduate,64,1.125,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,1,0,1,2,1,0,0,-2,0,0,0,0,0,-1,-2,-0.2,1,-0.4,-0.6,-0.05,C_Ug +32,R_7CUkaE56X55bl7d,67 - 73,American,Female,3,2,3,0,2,-1,-2,3,-1,0,3,2,2,1,2,1,0,0,1,-1,2,2,2,-2,2,5,1,-2,2,-1,1,4,2,2,2,2,2,6,0,0,-1,-1,-2,5,3,0,2,1,0,5,-2,0,0,0,0,5,0,1,0,0,2,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,83,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,89,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,77,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,90,FALSE,1,100,FALSE,0,100,FALSE,0,90,TRUE,0,100,TRUE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,96,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0.0025,0,0,0.81,0,0,0.0196,0.0121,0.0289,0,1,0.5625,1,1,1,0.0529,0.81,1,1,0.9216,0,1,1,1,1,1,0.543575,0.2454,0.84175,27,84.38,16,50,5,62.5,3,37.5,3,37.5,5,62.5,14,87.5,2,12.5,96.28,89.12,97.88,98.75,99.38,95.69,96.88,34.38,46.28,26.62,60.38,61.25,36.88,8.19,84.38,1,0,1,2,0,2,0,1,0,1,1,0,0,1,0,1,0,1,2,1,0,2,1,1,2,1,2,3,1,0,3,1,2,1,0,1,0,0,1,1,0.8,0.8,0.4,1,1.2,1.4,1.4,0.6,0.75,1.15,5,5,0,-1,1,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),69,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,-2,0,1,-2,1,-2,-2,-1,1,-2,-1,-2,0,0,0,0,1,1,0,-0.4,-0.6,-1,0.4,-0.4,HS_TS +33,R_5dKGXxQBJH6raux,67 - 73,Canadian,Female,3,3,3,3,1,0,-1,3,-1,1,1,0,3,-3,3,-1,-1,-1,-1,-1,3,3,3,3,1,4,0,0,3,1,0,5,1,0,3,-3,3,5,-1,-1,-1,-1,-1,4,3,3,3,3,1,5,0,0,0,0,0,4,1,0,3,-3,3,5,-1,0,-1,-1,-1,3,TRUE,0,100,TRUE,1,100,FALSE,1,89,FALSE,1,51,TRUE,1,51,FALSE,1,53,TRUE,1,93,TRUE,1,91,TRUE,1,56,TRUE,1,52,FALSE,1,53,FALSE,1,94,TRUE,1,100,TRUE,0,89,TRUE,1,53,TRUE,1,100,FALSE,1,54,TRUE,0,93,FALSE,1,55,FALSE,1,76,TRUE,1,81,TRUE,1,68,FALSE,1,70,TRUE,1,70,TRUE,0,90,TRUE,1,81,TRUE,0,67,TRUE,0,99,FALSE,1,54,TRUE,1,100,FALSE,0,61,TRUE,1,100,0.0081,0.0361,0,0.0049,0,0.2209,0.09,0.2304,0.0576,0.1024,0,0,0.1936,0.2209,0.2401,0,0.09,0.2401,0.9801,0.81,0.0361,0.2209,0.2025,0.7921,0.2116,0.4489,0.3721,1,0.0121,0.8649,0.2116,0.0036,0.280446429,0.120428571,0.440464286,14,43.75,25,78.13,6,75,8,100,4,50,7,87.5,15,93.75,10,62.5,76.38,62,70.38,83.25,89.88,78.56,74.19,-34.38,-1.75,-13,-29.62,33.25,2.38,-15.19,11.69,0,0,0,0,0,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,1,1,0,0,0,0,0,0,1,0,0,0,0,0.8,0,0,0,1.2,0,0.2,0.2,0.35,4.67,4.67,-1,1,0,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),68,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,-3,1,0,0,0,0,0,0,0,-1,0,0,0,0,-0.4,0,-0.2,-0.15,HS_TS +34,R_1qSBBGypd2Ecdjz,39 - 45,Canadian,Female,1,2,2,-2,2,-3,-2,-1,1,3,-2,-3,3,-3,3,1,1,2,2,1,2,2,2,-3,2,1,-2,-2,1,1,2,1,-2,-3,3,-3,3,1,2,2,2,2,2,1,2,2,2,-3,2,0,-3,-3,2,-1,2,3,-2,-2,2,-2,3,2,2,1,2,2,2,2,FALSE,1,86,FALSE,0,50,FALSE,1,67,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,90,TRUE,1,93,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,79,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,95,FALSE,1,50,FALSE,1,50,FALSE,0,81,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,97,FALSE,0,50,FALSE,0,50,0.0049,0,0.25,0.01,0.25,0,0.25,0,0.25,0.25,0.0009,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.6561,0.25,0.25,0.6241,0.25,0.25,0.25,0.0196,0.1089,0.9025,0.25,1,0.279003571,0.178635714,0.379371429,20,62.5,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,66.81,50,66.38,81.25,69.62,66.31,67.31,9.37,13.68,0,3.88,31.25,19.62,28.81,-1.44,1,0,0,1,0,1,0,2,0,1,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,1,3,2,1,0,1,1,1,0,1,0,0,0,1,0.4,0.8,0,0.6,0.4,1.4,0.6,0.4,0.45,0.7,1,1.67,1,-2,-1,-1,-0.67,5 cents,5 minutes,24 days,Female,University - Undergraduate,42,1.375,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,-2,0,0,-1,-1,-1,0,0,1,0,0,0,0,-0.6,-0.6,0.2,-0.25,C_Ug +35,R_6sUdYaBray9ntlO,67 - 73,Canadian,Male,-2,2,-2,2,-2,-1,-3,2,-3,0,2,2,1,-2,1,1,1,2,2,1,-2,2,-2,2,-2,1,-1,-2,2,-2,1,1,2,2,1,-2,1,1,1,1,2,2,1,1,-2,2,-2,2,-2,8,-2,-2,2,-2,0,8,2,2,1,-2,1,1,1,1,2,2,1,2,TRUE,0,95,TRUE,1,95,TRUE,0,89,FALSE,1,50,FALSE,0,63,FALSE,1,59,TRUE,1,99,FALSE,0,100,TRUE,1,58,TRUE,1,93,TRUE,0,71,TRUE,0,98,TRUE,1,89,TRUE,0,100,TRUE,1,63,TRUE,1,100,TRUE,0,85,TRUE,0,98,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,1,90,FALSE,1,100,TRUE,1,90,TRUE,0,84,TRUE,1,98,TRUE,0,74,TRUE,0,100,TRUE,0,99,TRUE,1,98,TRUE,1,96,TRUE,1,100,1,0.0004,0,0.0001,0,0.1681,0.01,0.0049,0,0.01,0.0004,0.0121,0.1764,0.5041,0.3969,0.0025,0,0.25,1,0.7056,0.0064,0.1369,0,1,0.7225,0.5476,0.0016,0.9025,0.7921,0.9604,0.9801,0.9604,0.366125,0.109671429,0.622578571,31,96.88,19,59.38,6,75,5,62.5,4,50,4,50,14,87.5,5,31.25,88.31,75.88,85.88,94.62,96.88,89,87.62,37.5,28.93,0.88,23.38,44.62,46.88,1.5,56.37,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0.6,0,0,0.15,0.15,1,5.67,-7,-7,0,-1,-4.67,5 cents,5 minutes,24 days,Male,High School (or equivalent),68,0.5,1,1,0,0,0,1,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +36,R_6ZCBZC4aia4UBds,67 - 73,Canadian,Male,3,3,3,3,3,-1,-2,3,0,1,3,3,2,2,3,1,0,2,2,-1,2,2,1,0,1,2,-1,-1,3,1,1,4,3,3,3,3,3,1,2,1,1,2,0,2,3,3,3,3,3,1,1,-2,3,-1,3,2,3,3,3,3,3,1,2,2,2,2,2,1,TRUE,0,100,TRUE,1,100,FALSE,1,65,FALSE,1,81,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,97,TRUE,0,100,TRUE,1,100,TRUE,1,75,TRUE,1,50,0,0,0,0,0.25,0.0064,0,0,0,0,0,0,0,0.25,0,0,1,0.0361,0.9409,1,0,0,1,1,1,1,0.0625,1,0.1225,1,1,1,0.416728571,0.110178571,0.723278571,25,78.13,20,62.5,5,62.5,5,62.5,4,50,6,75,16,100,4,25,94.06,88.25,92.75,100,95.25,95.31,92.81,15.63,31.56,25.75,30.25,50,20.25,-4.69,67.81,1,1,2,3,2,0,1,0,1,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,2,0,0,1,2,0,0,1,1,0,1,2,0,0,3,1.8,0.4,0.4,0.8,0,1,0.4,1.2,0.85,0.65,2.33,1.33,1,2,0,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,1,2,3,2,-2,1,0,0,-2,0,0,0,0,0,0,-1,1,0,-2,1.8,-0.6,0,-0.4,0.2,C_Ug +37,R_30eQfgyKVbfUNdN,25 - 31,Canadian,Female,3,3,2,3,3,1,1,2,2,3,0,1,3,1,2,0,2,1,1,2,2,3,1,2,1,6,2,2,3,2,1,7,2,1,3,2,3,7,2,1,1,2,0,5,2,3,2,2,3,2,2,2,1,2,3,2,3,1,2,3,2,3,1,1,2,2,2,5,FALSE,1,100,FALSE,0,50,TRUE,0,68,FALSE,1,50,TRUE,1,97,TRUE,0,53,TRUE,1,89,TRUE,1,86,TRUE,1,66,TRUE,1,90,TRUE,0,50,TRUE,0,80,TRUE,1,50,TRUE,0,58,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,87,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,55,TRUE,0,51,FALSE,0,53,FALSE,1,50,TRUE,1,80,TRUE,0,50,TRUE,0,78,FALSE,1,55,FALSE,0,83,FALSE,0,54,TRUE,1,66,0.0196,0.04,0.0576,0.0121,0.1156,0.2809,0.2809,0.01,0.25,0.2025,0.6889,0.25,0.1156,0.25,0.0009,0.25,0.2601,0.25,0.6084,0.25,0.25,0.25,0.25,0.3364,0.25,0.25,0.2916,0,0.4624,0.7569,0.2025,0.64,0.285842857,0.228957143,0.342728571,16,50,16,50,3,37.5,5,62.5,6,75,2,25,11,68.75,5,31.25,64.84,52.5,59,76.12,71.75,68.44,61.25,0,14.84,15,-3.5,1.12,46.75,-0.31,30,1,0,1,1,2,1,1,1,0,2,2,0,0,1,1,2,1,0,1,2,1,0,0,1,0,1,1,1,0,0,3,0,1,2,0,1,1,1,1,0,1,1,0.8,1.2,0.4,0.6,1.2,0.8,1,0.75,6.67,2.33,4,5,4,0,4.34,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,1.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,1,0,2,0,0,0,0,2,-1,0,-1,-1,1,1,0,-1,0,2,0.6,0.4,-0.4,0.4,0.25,C_Ug +38,R_1RPnnJVgH73v1F0,67 - 73,Canadian,Male,-3,3,3,2,0,0,3,3,-3,-2,1,1,3,0,0,2,3,3,2,1,-3,2,2,0,2,5,2,-3,2,-3,-2,1,0,0,2,0,-2,2,0,-1,0,-1,0,10,-3,3,3,3,-3,4,0,-3,3,-3,-3,4,0,3,3,-3,0,3,2,3,3,3,0,2,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,89,TRUE,1,100,FALSE,0,100,FALSE,0,73,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,65,FALSE,1,100,TRUE,0,85,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,0,0,0,0.0121,0,0,1,0,0,0,0.5329,0,1,0,0.2025,1,0,0.16,0,0,1,0,0,0.1225,1,1,0,0,0.7225,1,0.312589286,0.267678571,0.3575,26,81.25,22,68.75,4,50,6,75,7,87.5,5,62.5,12,75,10,62.5,94.59,92.25,91.12,95,100,98.31,90.88,12.5,25.84,42.25,16.12,7.5,37.5,23.31,28.38,0,1,1,2,2,2,6,1,0,0,1,1,1,0,2,2,4,3,3,1,0,0,0,1,3,0,6,0,0,1,1,2,0,3,0,0,0,0,1,1,1.2,1.8,1,2.6,0.8,1.4,1.2,0.4,1.65,0.95,2.67,3.67,1,-3,-1,8,-1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,69,0.5,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,1,1,1,-1,2,0,1,0,-1,0,-1,1,-3,2,2,4,3,2,0,0.4,0.4,-0.2,2.2,0.7,C_Ug +39,R_5VPHRV8vSdZKYg6,53 - 59,Canadian,Female,2,2,2,1,2,-2,-2,1,0,0,2,-1,2,0,2,2,2,2,2,-1,0,2,2,-2,2,10,-2,-2,1,1,1,2,2,1,0,2,2,4,-1,-1,0,0,-2,7,2,2,2,0,2,8,-2,-2,0,0,-1,0,2,-1,2,-2,2,8,-1,0,-1,1,-2,4,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,69,TRUE,1,51,FALSE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,FALSE,0,50,TRUE,1,100,0.0961,1,0,0.25,0,0,0,1,0,0.25,1,0.25,0.2401,0.25,0.25,0.25,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0,0.258575,0.285007143,0.232142857,16,50,22,68.75,6,75,6,75,3,37.5,7,87.5,11,68.75,11,68.75,70.94,50.12,62.5,75,96.12,70,71.88,-18.75,2.19,-24.88,-12.5,37.5,8.62,1.25,3.13,2,0,0,3,0,0,0,0,1,1,0,2,2,2,0,3,3,2,2,1,0,0,0,1,0,0,0,1,0,1,0,0,0,2,0,3,2,3,1,1,1,0.4,1.2,2.2,0.2,0.4,0.4,2,1.2,0.75,5.33,5.33,2,2,-4,3,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,59,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,2,0,0,2,0,0,0,-1,1,0,0,2,2,0,0,0,1,-1,1,0,0.8,0,0.8,0.2,0.45,C_Ug +40,R_3OFt005YkPug1PP,67 - 73,Canadian,Male,3,3,3,1,3,2,-2,3,1,-2,3,3,3,2,3,2,1,2,2,-3,3,3,3,3,3,0,3,-3,3,3,3,0,3,3,3,3,3,8,2,2,2,2,-1,0,3,3,3,3,3,0,2,-2,2,2,2,1,3,3,3,3,3,1,3,3,3,3,3,0,TRUE,0,75,TRUE,1,94,TRUE,0,93,FALSE,1,51,FALSE,0,55,FALSE,1,55,TRUE,1,99,FALSE,0,56,TRUE,1,92,TRUE,1,100,TRUE,0,50,TRUE,0,95,TRUE,1,96,TRUE,0,70,FALSE,0,54,TRUE,1,100,FALSE,1,100,TRUE,0,57,TRUE,0,96,FALSE,1,91,TRUE,1,52,TRUE,1,100,FALSE,1,53,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,99,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,93,TRUE,1,99,0.3136,0.25,0,0.0001,0.0001,0.2025,0,0,0.0081,0,0,0.0016,0.0064,0.25,0.3025,0.0036,0.2209,0.2401,1,0,0.2304,0.2916,0.9216,0.49,0,0.9801,0.0049,0.5625,0.8649,0.3249,1,0.9025,0.314614286,0.088271429,0.540957143,23,71.88,18,56.25,4,50,6,75,4,50,4,50,12,75,6,37.5,82.03,78.62,76.25,81.38,91.88,83.75,80.31,15.63,25.78,28.62,1.25,31.38,41.88,8.75,42.81,0,0,0,2,0,1,1,0,2,5,0,0,0,1,0,0,1,0,0,2,0,0,0,2,0,0,0,1,1,4,0,0,0,1,0,1,2,1,1,6,0.4,1.8,0.2,0.6,0.4,1.2,0.2,2.2,0.75,1,2.67,0.67,0,-1,7,0,2,10 cents,25 minutes,24 days,Male,High School (or equivalent),68,-1.125,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,1,1,-1,1,1,0,0,0,0,0,-1,-1,-1,-1,-4,0,0.6,0,-1.6,-0.25,HS_TS +41,R_5n247JOppS7EHxw,39 - 45,Canadian,Male,2,2,2,1,2,-2,-2,1,1,2,-1,-2,2,-2,2,-2,-1,-1,-1,-3,3,3,-2,3,3,7,-2,0,0,-2,-2,4,0,-2,1,-3,2,5,1,2,1,2,1,8,0,0,0,0,0,5,-2,-3,0,0,1,5,-2,-2,1,-3,0,3,2,2,2,2,2,9,FALSE,1,71,TRUE,1,91,TRUE,0,100,FALSE,1,50,TRUE,1,93,FALSE,1,86,TRUE,1,92,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,91,TRUE,1,75,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,87,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,0,50,FALSE,1,85,TRUE,0,83,FALSE,0,70,TRUE,1,81,TRUE,1,57,0.01,0,0,0.0064,0.1849,0.0196,0,0,0.0169,0,0.49,0.0576,0,0.25,0.0049,0.0081,0,0.25,0.0225,0.36,0.0081,0.0625,0.25,0.0081,0.25,0.25,0.0361,0.0841,1,1,0.6889,0,0.189367857,0.091571429,0.287164286,28,87.5,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,82.16,68.38,79.5,89.25,91.5,88.5,75.81,12.5,7.16,-6.62,4.5,14.25,16.5,-5.25,19.56,1,1,4,2,1,0,2,1,3,4,1,0,1,1,0,3,3,2,3,4,2,2,2,1,2,0,1,1,1,1,1,0,1,1,2,4,3,3,3,5,1.8,2,0.6,3,1.8,0.8,1,3.6,1.85,1.8,5.33,4.33,2,-1,2,-1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,41,1.5,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,-1,-1,2,1,-1,0,1,0,2,3,0,0,0,0,-2,-1,0,-1,0,-1,0,1.2,-0.4,-0.6,0.05,C_Ug +42,R_5luzhX0pDEWLnPl,67 - 73,Canadian,Male,2,3,3,2,1,-3,0,2,1,1,1,1,1,-2,3,-1,0,-1,-2,-3,3,3,3,-2,2,4,-3,0,1,0,2,8,3,3,2,-2,3,4,-2,-2,-2,-2,-3,5,2,3,2,2,0,7,-3,1,2,0,2,3,3,2,1,-2,3,6,-2,-2,-2,-2,-3,7,FALSE,1,100,TRUE,1,80,TRUE,0,99,FALSE,1,73,TRUE,1,75,FALSE,1,98,TRUE,1,91,TRUE,1,95,TRUE,1,79,TRUE,1,95,FALSE,1,85,TRUE,0,100,FALSE,0,94,FALSE,1,90,FALSE,0,66,TRUE,1,97,FALSE,1,87,FALSE,1,99,FALSE,1,92,FALSE,1,100,TRUE,1,94,TRUE,1,93,FALSE,1,76,TRUE,1,85,FALSE,1,98,TRUE,1,93,FALSE,1,83,FALSE,1,90,TRUE,0,94,TRUE,1,99,TRUE,1,100,TRUE,1,100,0.0025,0.0049,0.0009,0.0081,0,0.0004,0.0225,0.0025,0,0.0049,0.0001,0.8836,0.0441,0.0225,0.0625,0.04,0.0576,0.0729,0.01,0.0004,0.0036,0.4356,0.0064,0.01,0.0169,0.0289,0,0,0.9801,0.0001,0.8836,1,0.1639,0.086685714,0.241114286,26,81.25,27,84.38,7,87.5,6,75,8,100,6,75,14,87.5,13,81.25,90.62,82.25,89.75,94.88,95.62,89.75,91.5,-3.13,6.24,-5.25,14.75,-5.12,20.62,2.25,10.25,1,0,0,4,1,0,0,1,1,1,2,2,1,0,0,1,2,1,0,0,0,0,1,0,1,0,1,0,1,1,2,1,0,0,0,1,2,1,0,0,1.2,0.6,1,0.8,0.4,0.6,0.6,0.8,0.9,0.6,5.33,5.33,-3,5,-2,-2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),68,1.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,1,0,-1,4,0,0,-1,1,0,0,0,1,1,0,0,0,0,0,0,0,0.8,0,0.4,0,0.3,HS_TS +43,R_6PzcODVrTnHwgj7,60 - 66,American,Female,3,3,2,-1,3,2,-2,2,-2,1,3,2,0,-1,3,-1,1,2,1,2,3,3,3,1,3,1,2,-2,1,-2,2,1,2,2,2,-2,3,1,2,2,2,1,2,1,3,3,3,1,3,1,3,-3,1,-3,-2,1,3,3,2,-2,3,1,2,-1,1,1,2,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,66,FALSE,0,59,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,60,FALSE,1,100,FALSE,0,60,TRUE,1,82,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0324,0,0,0,0,0.3481,0,1,0.1156,0,0,0.36,0.0196,0.16,1,0,0.2304,0.36,0,0,0,1,0,0.165217857,0.106864286,0.223571429,24,75,26,81.25,7,87.5,4,50,7,87.5,8,100,13,81.25,13,81.25,91.41,78,89.88,97.75,100,90.44,92.38,-6.25,10.16,-9.5,39.88,10.25,0,9.19,11.13,0,0,1,2,0,0,0,1,0,1,1,0,2,1,0,3,1,0,0,0,0,0,1,2,0,1,1,1,1,3,0,1,2,1,0,3,2,1,0,0,0.6,0.4,0.8,0.8,0.6,1.4,0.8,1.2,0.65,1,1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,-1,-1,0,-1,-2,1,-1,0,0,0,0,-1,-1,0,0,0,-1,0,-0.4,-0.35,HS_TS +44,R_7SdDoaxdAAkVHyl,25 - 31,Canadian,Male,1,2,1,-3,1,-2,1,-1,1,0,-1,0,2,0,2,-3,-3,-3,-3,-3,1,1,1,-2,2,4,1,-1,1,-1,2,8,-1,-2,1,0,0,3,-1,-1,1,-2,-3,10,1,2,0,-2,2,4,1,-2,2,-2,2,10,-1,-2,2,1,2,3,-2,1,1,0,0,10,TRUE,0,69,FALSE,0,50,TRUE,0,100,FALSE,1,53,TRUE,1,73,FALSE,1,50,TRUE,1,94,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,89,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,79,TRUE,0,91,FALSE,1,72,FALSE,1,100,TRUE,1,87,FALSE,0,57,FALSE,1,57,TRUE,1,79,TRUE,0,61,TRUE,1,87,FALSE,1,50,FALSE,1,100,TRUE,0,84,TRUE,1,100,TRUE,1,57,TRUE,1,58,0,0.0169,0,0.0036,0.1764,0.25,0.0441,0,0,0.3249,0,0.0121,0.25,0.64,0.0729,0.25,0.1849,0.2209,0,0.3721,0.0169,1,0.0784,0,0.6241,0.25,0.1849,0.4761,1,0.8281,0.7056,1,0.320085714,0.1733,0.466871429,15,46.88,20,62.5,4,50,6,75,4,50,6,75,12,75,8,50,78.97,64,72.12,82.38,97.38,80.06,77.88,-15.62,16.47,14,-2.88,32.38,22.38,5.06,27.88,0,1,0,1,1,3,2,2,2,2,0,2,1,0,2,2,2,4,1,0,0,0,1,1,1,3,3,3,3,2,0,2,0,1,0,1,4,4,3,3,0.6,2.2,1,1.8,0.6,2.8,0.6,3,1.4,1.75,5,5.67,0,-2,0,0,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,27,1.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,1,-1,0,0,0,-1,-1,-1,0,0,0,1,-1,2,1,-2,0,-2,-3,0,-0.6,0.4,-1.2,-0.35,C_Ug +45,R_6aaknJPN9Yr00Yu,67 - 73,Canadian,Male,2,3,2,-3,2,2,-3,2,-3,1,1,2,3,3,3,0,1,1,2,1,2,3,2,-3,2,1,2,-3,2,-3,2,1,1,2,3,3,3,2,2,2,2,2,2,7,2,3,2,-1,-1,4,1,-2,2,0,0,6,2,2,2,1,2,6,-1,0,0,2,1,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,TRUE,0,100,FALSE,1,84,FALSE,1,100,FALSE,0,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,TRUE,0,50,FALSE,1,85,TRUE,0,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.25,0.0225,0.4096,0.8281,0.25,0.0256,1,0.0625,0.25,0.0081,0,0,1,1,1,0.227014286,0.035714286,0.418314286,28,87.5,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,90.31,78.12,89.5,95.5,98.12,92.62,88,12.5,15.31,3.12,14.5,33,10.62,-1.13,31.75,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,1,0,1,0,0,0,2,3,1,1,0,3,1,1,0,1,2,1,1,1,1,0,0,0,0.2,0,1,1,1.2,1,0.6,0.3,0.95,1.33,5.33,-3,-5,-4,0,-4,10 cents,100 minutes,24 days,Male,University - Undergraduate,70,1.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-2,-3,-1,-1,0,-3,0,-1,0,-1,-2,-1,1,0,0,0,1,-1,-1,-1,0.4,-0.65,C_Ug +46,R_34faNNc4HIy8yfY,67 - 73,American,Female,3,2,3,2,2,-1,0,3,1,1,2,1,2,0,2,-2,-2,0,1,-1,3,3,3,2,2,7,0,-2,2,0,1,5,2,2,2,-1,2,7,0,-1,-1,0,-2,7,3,2,3,2,2,5,0,-2,2,-1,2,3,2,2,2,-1,2,2,1,0,1,1,0,9,TRUE,0,89,FALSE,0,50,TRUE,0,100,FALSE,1,69,TRUE,1,97,TRUE,0,62,TRUE,1,93,TRUE,1,76,TRUE,1,77,TRUE,1,90,TRUE,0,62,TRUE,0,95,FALSE,0,72,TRUE,0,99,FALSE,0,73,TRUE,1,57,TRUE,0,73,TRUE,0,100,TRUE,0,79,FALSE,1,100,FALSE,0,99,TRUE,1,70,FALSE,1,78,TRUE,1,75,TRUE,0,79,TRUE,1,94,FALSE,1,76,FALSE,1,100,FALSE,1,81,TRUE,1,100,FALSE,0,74,TRUE,1,100,0.0576,0.0036,0.1849,0.0049,0,0.3844,0.0625,0.01,0,0.09,0,0.5184,0.0529,0.3844,0.0009,0.25,0.0484,0.0961,0,0.6241,0.9801,0.5329,0.6241,0.9801,0.5329,0.0576,0.5476,0.7921,1,1,0.0361,0.9025,0.375289286,0.135571429,0.615007143,17,53.13,17,53.13,3,37.5,4,50,4,50,6,75,11,68.75,6,37.5,82.47,70,82.75,89.25,87.88,81.06,83.88,0,29.34,32.5,32.75,39.25,12.88,12.31,46.38,0,1,0,0,0,1,2,1,1,0,0,1,0,1,0,2,1,1,1,1,0,0,0,0,0,1,2,1,2,1,0,1,0,1,0,3,2,1,0,1,0.2,1,0.4,1.2,0,1.4,0.4,1.4,0.7,0.8,6.33,3.33,2,2,5,-2,3,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,70,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,0,0,0,0,0,0,-1,-1,0,0,0,0,0,-1,-1,0,1,0,0.2,-0.4,0,-0.2,-0.1,C_Ug +47,R_1AYXGgvcxrcayA6,39 - 45,Canadian,Male,-3,3,-2,-3,0,-2,-2,1,-3,-1,-2,2,3,-1,3,-2,1,-2,-2,-3,-3,3,-3,-2,-2,0,-2,-2,1,-3,-2,0,-2,2,3,0,3,1,1,1,-2,-2,-3,0,-3,2,0,-3,-2,2,-2,-2,1,-3,-2,1,-2,2,3,-2,3,0,1,2,0,-2,-3,0,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,97,TRUE,0,50,TRUE,1,97,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,95,TRUE,1,50,FALSE,0,92,0,0,0,0,0.8464,0.25,0.0009,0,0.25,0.0009,0.0025,0,0.25,0,0.25,0.25,0.25,0.25,0,1,0,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,0.25,0.9409,0.331842857,0.185764286,0.477921429,8,25,18,56.25,5,62.5,4,50,4,50,5,62.5,15,93.75,3,18.75,77.44,56.25,67.75,93.38,92.38,83.19,71.69,-31.25,21.19,-6.25,17.75,43.38,29.88,-10.56,52.94,0,0,1,1,2,0,0,0,0,1,0,0,0,1,0,3,0,0,0,0,0,1,2,0,2,0,0,0,0,1,0,0,0,1,0,3,1,2,0,0,0.8,0.2,0.2,0.6,1,0.2,0.2,1.2,0.45,0.65,0.33,1,-2,-1,1,0,-0.67,10 cents,5 minutes,24 days,Male,Trade School (non-military),45,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,-1,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,-2,0,0,-0.2,0,0,-0.6,-0.2,HS_TS +48,R_6Q47AqweUbtMBRT,67 - 73,Canadian,Female,3,3,3,2,3,3,-1,3,-1,3,3,3,3,3,3,2,1,2,2,-1,3,3,3,-2,3,8,3,-1,3,-1,3,8,3,3,3,2,3,0,1,-1,1,1,-1,5,3,3,3,3,3,3,3,-3,3,-3,2,5,3,3,3,2,3,3,1,0,0,1,-1,5,TRUE,0,100,FALSE,0,71,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,63,TRUE,1,100,TRUE,0,77,TRUE,0,100,TRUE,0,87,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,0,75,TRUE,1,90,TRUE,0,77,TRUE,1,70,TRUE,0,50,FALSE,1,60,TRUE,0,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.09,0,0,0,0,0.01,0,0.25,0.25,0.0625,0,0.25,0.25,0.25,0.5041,0.5625,0.25,0.16,0.5929,0,0.3969,0.7569,1,0.5929,0.25,0.25,1,1,1,1,1,0.415667857,0.188507143,0.642828571,23,71.88,16,50,3,37.5,4,50,3,37.5,6,75,11,68.75,5,31.25,79.53,58.88,87.75,87.12,84.38,79.31,79.75,21.88,29.53,21.38,37.75,49.62,9.38,10.56,48.5,0,0,0,4,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,0,0,0,0,1,0,0,2,0,2,1,0,0,0,1,0,1,1,2,1,0,0.8,0,0.2,1,0.2,1,0.2,1,0.5,0.6,5.33,3.67,5,3,-3,0,1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,69,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,3,0,0,-2,0,-2,-1,0,0,0,0,0,0,1,-1,0,0,0.6,-1,0,0,-0.1,C_Ug +49,R_3z5vrZ4mxBm70tb,25 - 31,Canadian,Female,1,2,2,1,2,-1,0,1,2,2,1,-2,1,-1,2,1,1,1,2,1,1,2,2,-1,2,7,2,2,0,1,2,3,3,-1,1,1,1,2,-1,-1,-1,-1,0,9,2,2,3,3,2,6,1,1,2,1,2,5,2,-2,2,-1,2,1,2,2,2,2,2,3,FALSE,1,96,TRUE,1,65,FALSE,1,79,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,100,TRUE,1,80,TRUE,1,90,FALSE,1,70,FALSE,1,65,TRUE,1,90,FALSE,1,74,TRUE,1,91,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,75,FALSE,1,50,TRUE,1,100,TRUE,1,70,FALSE,1,90,TRUE,1,91,FALSE,1,96,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,95,FALSE,0,75,FALSE,0,54,TRUE,1,96,0,0.04,0,0.0625,0.0016,0,0.0081,0.01,0.25,0.09,0.5625,0.01,0.04,0.09,0.0625,0.1225,0.01,0.25,0.25,0.0016,0,0.0081,0.5625,0.0676,0.49,0.36,0.2916,0.0016,0.0441,1,0.9025,0.1225,0.200332143,0.107657143,0.293007143,24,75,25,78.13,5,62.5,6,75,7,87.5,7,87.5,14,87.5,11,68.75,79.75,68.12,89.5,85.12,76.25,83.25,76.25,-3.13,1.62,5.62,14.5,-2.38,-11.25,-4.25,7.5,0,0,0,2,0,3,2,1,1,0,2,1,0,2,1,2,2,2,3,1,1,0,1,2,0,2,1,1,1,0,1,0,1,0,0,1,1,1,0,1,0.4,1.4,1.2,2,0.8,1,0.4,0.8,1.25,0.75,4,4,1,-2,1,6,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,30,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,0,-1,0,0,1,1,0,0,0,1,1,-1,2,1,1,1,1,3,0,-0.4,0.4,0.8,1.2,0.5,C_Ug +50,R_7u4PSg6FKCVx4Qx,53 - 59,Canadian,Male,1,3,1,2,2,-1,0,2,1,-1,2,1,2,-2,2,0,1,1,1,-1,-1,1,1,-2,-1,7,-2,1,2,1,-1,7,3,1,2,3,3,1,1,1,1,-1,-1,4,3,2,2,2,3,8,-1,1,1,2,0,5,3,3,3,-2,3,2,2,1,2,3,1,4,TRUE,0,77,TRUE,1,71,FALSE,1,67,FALSE,1,59,TRUE,1,58,FALSE,1,70,TRUE,1,76,TRUE,1,84,FALSE,0,53,TRUE,1,77,FALSE,1,74,FALSE,1,67,TRUE,1,65,TRUE,0,65,FALSE,0,59,TRUE,1,88,TRUE,0,60,FALSE,1,89,FALSE,1,89,FALSE,1,94,FALSE,0,70,TRUE,1,79,TRUE,0,66,TRUE,1,82,TRUE,0,62,TRUE,1,62,TRUE,0,64,FALSE,1,91,TRUE,0,71,TRUE,1,79,FALSE,0,89,TRUE,1,83,0.0256,0.1444,0.0144,0.0576,0.0289,0.09,0.0324,0.0529,0.0036,0.0441,0.0441,0.1225,0.2809,0.0676,0.1764,0.0841,0.4356,0.1681,0.0081,0.3844,0.49,0.3481,0.0121,0.4225,0.36,0.4096,0.7921,0.5929,0.1089,0.0121,0.5041,0.1089,0.220892857,0.116514286,0.325271429,22,68.75,21,65.63,4,50,4,50,5,62.5,8,100,12,75,9,56.25,73.12,69.75,67.88,73.38,81.5,73.44,72.81,3.12,7.49,19.75,17.88,10.88,-18.5,-1.56,16.56,2,2,0,4,3,1,1,0,0,0,1,0,0,5,1,1,0,0,2,0,2,1,1,0,1,0,1,1,1,1,1,2,1,0,1,2,0,1,2,2,2.2,0.4,1.4,0.6,1,0.8,1,1.4,1.15,1.05,5,5,-1,2,-1,0,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,54,0.5,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,1,-1,4,2,1,0,-1,-1,-1,0,-2,-1,5,0,-1,0,-1,0,-2,1.2,-0.4,0.4,-0.8,0.1,C_Ug +51,R_7lyqTGSyYrIwngs,46 - 52,Canadian,Female,3,2,3,2,2,-2,0,-1,1,0,1,0,2,-3,3,-2,1,-1,-2,-1,3,2,3,-1,3,3,-3,0,0,-2,3,5,1,0,1,-3,3,6,3,3,3,3,3,8,3,2,3,3,-1,5,-3,0,-2,2,-2,5,-1,0,0,-3,3,5,-3,-3,-3,-3,-3,8,FALSE,1,75,TRUE,1,66,TRUE,0,55,FALSE,1,75,TRUE,1,88,FALSE,1,75,TRUE,1,50,TRUE,1,55,TRUE,1,50,TRUE,1,88,FALSE,1,55,TRUE,0,75,FALSE,0,55,FALSE,1,75,TRUE,1,50,TRUE,1,99,FALSE,1,55,FALSE,1,88,FALSE,1,55,FALSE,1,100,TRUE,1,55,TRUE,1,88,FALSE,1,99,TRUE,1,66,FALSE,1,99,TRUE,1,75,FALSE,1,66,FALSE,1,75,FALSE,1,55,TRUE,1,55,TRUE,1,55,TRUE,1,55,0.2025,0.0625,0.0001,0.25,0.2025,0.0625,0.1156,0.0144,0,0.0144,0.2025,0.3025,0.25,0.2025,0.0144,0.1156,0.0001,0.0625,0.0625,0.0001,0.2025,0.25,0.2025,0.0625,0.2025,0.1156,0.2025,0.0625,0.3025,0.0144,0.2025,0.5625,0.143021429,0.111392857,0.17465,24,75,29,90.63,8,100,7,87.5,8,100,6,75,15,93.75,14,87.5,69.59,59,67.12,79.75,72.5,65.62,73.56,-15.63,-21.04,-41,-20.38,-20.25,-2.5,-28.13,-13.94,0,0,0,3,1,1,0,1,3,3,0,0,1,0,0,5,2,4,5,4,0,0,0,1,3,1,0,1,1,2,2,0,2,0,0,1,4,2,1,2,0.8,1.6,0.2,4,0.8,1,0.8,2,1.65,1.15,4.67,5,-2,0,1,0,-0.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,46,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,2,-2,0,0,0,2,1,-2,0,-1,0,0,4,-2,2,4,2,0,0.6,-0.6,2,0.5,C_Ug +52,R_7ilfgOcIomd4yMA,53 - 59,Canadian,Male,1,3,3,0,2,2,-2,3,-3,2,2,1,3,0,3,1,1,2,2,0,1,3,3,-1,2,7,2,-3,3,-3,2,9,3,2,3,1,3,7,2,3,3,2,0,9,3,3,3,1,2,8,2,-2,2,-3,1,8,3,2,3,0,2,8,2,1,2,2,0,9,FALSE,1,100,TRUE,1,58,TRUE,0,84,TRUE,0,63,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,86,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,86,TRUE,0,100,TRUE,1,50,TRUE,1,83,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,60,FALSE,1,100,FALSE,0,85,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0.0289,0.7225,1,0.0196,0,0.0625,0.1764,1,0.3969,0.36,0,0.25,0.25,0.0196,1,0.25,0.7569,0,0,0.7056,1,0,0.7396,0.347803571,0.314771429,0.380835714,24,75,20,62.5,6,75,5,62.5,6,75,3,37.5,14,87.5,6,37.5,87.59,78.75,84.38,97.88,89.38,86.69,88.5,12.5,25.09,3.75,21.88,22.88,51.88,-0.81,51,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,1,2,1,0,0,2,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0,0,0,0.2,0.2,0.6,0.8,0.6,0.4,0.6,0.2,0.45,0.45,7.67,8,-1,1,-1,0,-0.33,10 cents,100 minutes,15 days,Male,Trade School (non-military),57,0.875,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,-2,0,0,0,0,0,1,-1,0,-1,0,0,0,1,-1,0,2,1,0,0,-0.4,-0.2,0,0.6,0,HS_TS +53,R_3CKH5nALclcXyCd,67 - 73,Canadian,Male,3,3,3,2,3,-1,-1,0,0,0,2,0,3,-3,3,1,1,1,1,-2,2,3,3,1,2,3,-1,-2,0,0,0,1,2,-2,3,-3,3,1,-1,0,-1,0,-2,2,2,3,3,3,2,1,-2,0,0,0,0,0,2,-3,2,-3,3,1,-1,0,0,0,-2,1,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,80,TRUE,1,80,FALSE,1,80,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,80,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,50,TRUE,0,90,TRUE,1,90,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.01,0.04,0,0.25,0,0,0,0.25,0.25,0,0,0.25,0,0.04,0,0.5625,0,0,0.64,0.64,0.81,0.64,0.156517857,0.039285714,0.27375,28,87.5,25,78.13,5,62.5,7,87.5,7,87.5,6,75,16,100,9,56.25,89.22,78.12,96.25,95,87.5,95,83.44,9.37,11.09,15.62,8.75,7.5,12.5,-5,27.19,1,0,0,1,1,0,1,0,0,0,0,2,0,0,0,2,1,2,1,0,1,0,0,1,1,1,1,0,0,0,0,3,1,0,0,2,1,1,1,0,0.6,0.2,0.4,1.2,0.6,0.4,0.8,1,0.6,0.7,1.67,0.67,2,1,0,1,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,69,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,-1,0,0,0,0,0,-1,-1,0,0,0,0,1,0,0,0,-0.2,-0.4,0.2,-0.1,C_Ug +54,R_6J2a15FEPNrer3J,60 - 66,American,Female,3,2,3,1,-1,-2,-2,1,1,1,2,0,3,-1,2,-2,-1,0,-1,-1,2,2,2,-1,-2,5,1,-1,2,-1,1,6,2,2,2,2,2,2,1,1,1,2,1,8,2,2,2,3,-1,3,-1,-1,2,1,-1,4,2,1,1,-1,2,2,1,0,1,1,0,7,FALSE,1,50,TRUE,1,100,FALSE,1,86,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,83,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,91,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,82,FALSE,0,69,TRUE,1,100,0,0.8281,0.0361,0,0,0,0.25,0.01,0,0.25,0.0324,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0,0.25,0.25,0.25,1,0.25,0.25,0.4761,0.25,0.0196,0.6889,0.25,1,0.249178571,0.128028571,0.370328571,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,9,56.25,12,75,72.88,58.62,68.75,83,81.12,72.69,73.06,-3.13,7.25,-3.88,6.25,20.5,6.12,16.44,-1.94,1,0,1,2,1,3,1,1,2,0,0,2,1,3,0,3,2,1,3,2,1,0,1,2,0,1,1,1,0,2,0,1,2,0,0,3,1,1,2,1,1,1.4,1.2,2.2,0.8,1,0.6,1.6,1.45,1,4.33,3,2,2,0,1,1.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,61,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,1,2,0,0,2,-2,0,1,-1,3,0,0,1,0,1,1,0.2,0.4,0.6,0.6,0.45,C_Ug +55,R_7p6hcM2Xv9ALWsn,53 - 59,Canadian,Male,0,0,2,0,2,-3,-2,2,-2,0,2,0,3,-3,3,0,1,2,1,0,0,-3,3,2,3,5,-3,-3,-1,-3,2,2,2,0,0,-3,3,2,-2,1,1,-2,0,5,0,0,3,3,3,1,0,0,0,0,0,1,2,0,0,-3,3,5,0,0,0,0,0,5,TRUE,0,94,FALSE,0,75,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,100,TRUE,1,50,FALSE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,0,96,TRUE,1,50,TRUE,1,100,TRUE,0,92,TRUE,0,97,TRUE,0,93,TRUE,0,50,FALSE,0,50,TRUE,1,88,TRUE,0,50,TRUE,1,93,TRUE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,100,1,0.25,0,0,0,0.25,0.0049,1,0.25,0.0144,0.25,0.0016,0.25,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.8649,0.9216,0.8464,0.25,0.25,0.8836,1,0.9409,0.25,0.25,0.394314286,0.255957143,0.532671429,23,71.88,14,43.75,6,75,3,37.5,2,25,3,37.5,9,56.25,5,31.25,71.06,58.5,67.25,84.38,74.12,75.12,67,28.13,27.31,-16.5,29.75,59.38,36.62,18.87,35.75,0,3,1,2,1,0,1,3,1,2,0,0,3,0,0,2,0,1,3,0,0,0,1,3,1,3,2,2,2,0,0,0,3,0,0,0,1,2,1,0,1.4,1.4,0.6,1.2,1,1.8,0.6,0.8,1.15,1.05,3,2.33,4,1,-3,0,0.67,5 cents,100 minutes,15 days,Male,High School (or equivalent),55,0.5,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,3,0,-1,0,-3,-1,1,-1,2,0,0,0,0,0,2,-1,-1,2,0,0.4,-0.4,0,0.4,0.1,HS_TS +56,R_1TpH8LJdYVHcyHm,53 - 59,Canadian,Female,1,3,3,1,3,1,0,2,-1,1,1,1,3,1,3,2,2,2,2,2,1,3,3,1,3,1,1,0,3,1,1,1,1,1,3,2,3,4,1,1,1,1,1,7,1,3,3,1,3,4,2,1,2,1,0,1,1,1,3,0,3,1,2,2,2,2,2,4,TRUE,0,100,TRUE,1,75,TRUE,0,65,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,80,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,0,60,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,80,TRUE,1,60,TRUE,0,90,TRUE,1,100,TRUE,0,60,TRUE,0,80,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0.04,0,0.25,0.16,0.25,0.25,0.0225,0,0,0.25,0,0.25,0.0625,0.04,0.25,0.64,0.81,0.25,0.25,0.36,0,0,0.36,0.25,1,0.4225,1,1,1,0.325982143,0.1275,0.524464286,20,62.5,16,50,3,37.5,5,62.5,4,50,4,50,9,56.25,7,43.75,76.09,61.88,78.75,88.12,75.62,71.88,80.31,12.5,26.09,24.38,16.25,38.12,25.62,15.63,36.56,0,0,0,0,0,0,0,1,2,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,2,1,0,0,0,1,0,0,0,0,0,0,0,0.6,0.2,1,0,1,0.2,0,0.45,0.3,2,2,-3,0,3,3,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,58,0.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,-1,1,0,-1,0,0,0,0,0,1,1,1,1,1,0,-0.4,0,1,0.15,C_Ug +57,R_6DRa1CrwESPCbtv,67 - 73,Canadian,Male,0,2,-1,0,2,1,-1,2,-3,1,3,-1,3,0,3,1,0,2,2,-1,0,2,-1,-1,3,8,1,0,1,-2,1,8,3,-1,2,0,3,8,0,1,1,0,0,7,0,2,0,1,2,8,1,0,2,0,1,8,3,2,2,0,3,7,2,1,2,2,2,7,FALSE,1,65,TRUE,1,74,TRUE,0,84,FALSE,1,60,TRUE,1,71,FALSE,1,81,TRUE,1,89,TRUE,1,81,TRUE,1,76,TRUE,1,90,FALSE,1,64,TRUE,0,73,TRUE,1,82,TRUE,0,50,TRUE,1,81,TRUE,1,100,FALSE,1,50,TRUE,0,73,TRUE,0,57,TRUE,0,100,TRUE,1,81,TRUE,1,64,FALSE,1,54,TRUE,1,77,FALSE,1,74,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,50,TRUE,1,58,TRUE,1,50,TRUE,1,63,0.0361,0.04,0,0.0121,0.1369,0.0361,0.0529,0.01,1,0.1296,0.1764,0.0324,0.0576,0.1296,0.0841,0.0676,0.2116,0.16,0.25,0.0676,0.0361,0.0361,0.3249,0.25,0.25,0.36,0.25,0.1225,0.7056,0.5329,0.25,0.5329,0.223335714,0.1632,0.283471429,25,78.13,24,75,6,75,7,87.5,6,75,5,62.5,16,100,8,50,70.69,65.25,66.5,73.12,77.88,76.06,65.31,3.13,-4.31,-9.75,-21,-1.88,15.38,-23.94,15.31,0,0,0,1,1,0,1,1,1,0,0,0,1,0,0,1,1,1,2,1,0,0,1,1,0,0,1,0,3,0,0,3,1,0,0,1,1,0,0,3,0.4,0.6,0.2,1.2,0.4,0.8,0.8,1,0.6,0.75,8,7.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,69,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,-1,0,1,0,0,1,-2,0,0,-3,0,0,0,0,0,1,2,-2,0,-0.2,-0.6,0.2,-0.15,C_Ug +58,R_1CjweTLqC4QaUJP,39 - 45,Canadian,Female,3,3,3,0,3,2,-3,0,-3,-3,2,2,3,2,0,3,3,3,3,3,2,2,2,3,2,9,1,0,0,-2,2,9,0,1,0,2,1,9,2,2,2,3,2,10,2,2,2,0,2,9,2,2,2,2,2,10,3,3,2,3,2,10,2,2,2,2,2,10,TRUE,0,73,TRUE,1,84,FALSE,1,85,FALSE,1,71,FALSE,0,88,TRUE,0,85,TRUE,1,81,TRUE,1,76,TRUE,1,77,TRUE,1,78,FALSE,1,71,FALSE,1,81,TRUE,1,78,FALSE,1,77,TRUE,1,78,FALSE,0,82,TRUE,0,72,TRUE,0,82,FALSE,1,75,TRUE,0,76,TRUE,1,68,FALSE,0,83,TRUE,0,79,FALSE,0,77,TRUE,0,79,FALSE,0,80,TRUE,0,76,FALSE,1,76,TRUE,0,77,TRUE,1,79,FALSE,0,83,TRUE,1,75,0.0576,0.64,0.6724,0.0361,0.0625,0.7225,0.5929,0.0484,0.5776,0.6889,0.0441,0.0484,0.0529,0.0841,0.7744,0.0256,0.6241,0.0841,0.0576,0.6241,0.1024,0.0484,0.0625,0.0529,0.5184,0.5776,0.6889,0.5329,0.0225,0.6724,0.5929,0.0361,0.322146429,0.316464286,0.327828571,30,93.75,17,53.13,6,75,3,37.5,3,37.5,5,62.5,10,62.5,7,43.75,78.19,76.88,77.75,79.12,79,79.19,77.19,40.62,25.06,1.88,40.25,41.62,16.5,16.69,33.44,1,1,1,3,1,1,3,0,1,5,2,1,3,0,1,1,1,1,0,1,1,1,1,0,1,0,5,2,5,5,1,1,1,1,2,1,1,1,1,1,1.4,2,1.4,0.8,0.8,3.4,1.2,1,1.4,1.6,9,9.67,0,-1,-1,0,-0.67,10 cents,25 minutes,24 days,Female,University - Graduate (Masters),41,-0.125,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,3,0,1,-2,-2,-4,0,1,0,2,-1,-1,0,0,0,-1,0,0.6,-1.4,0.2,-0.2,-0.2,grad_prof +59,R_5ddcGt1nU3rO4Rm,60 - 66,Canadian,Male,0,3,3,1,2,-2,-2,2,0,1,2,0,1,-2,2,0,0,0,1,-1,0,3,3,1,1,3,0,-1,1,1,1,7,1,0,0,1,0,3,-2,-1,-1,-1,-2,8,0,3,3,2,0,3,-2,-2,2,-2,1,1,2,0,1,-2,2,2,0,-1,0,0,-2,8,FALSE,1,95,TRUE,1,95,TRUE,0,91,FALSE,1,50,TRUE,1,93,FALSE,1,86,TRUE,1,97,TRUE,1,96,TRUE,1,77,TRUE,1,63,FALSE,1,96,TRUE,0,66,FALSE,0,50,FALSE,1,99,FALSE,0,50,TRUE,1,97,FALSE,1,50,FALSE,1,98,FALSE,1,50,FALSE,1,100,TRUE,1,96,TRUE,1,98,FALSE,1,50,TRUE,1,50,FALSE,1,62,TRUE,1,95,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,93,TRUE,1,74,TRUE,1,100,0.0016,0.0025,0.0009,0.0009,0,0.0196,0.25,0.1369,0,0.0004,0.0049,0.25,0.0529,0.0016,0.0049,0.0025,0.25,0.25,0,0.1444,0.0016,0.25,0.25,0.0001,0.25,0.25,0.0676,0.0025,0.8281,0.0004,1,0.4356,0.168,0.087407143,0.248592857,26,81.25,26,81.25,6,75,6,75,8,100,6,75,14,87.5,12,75,80.22,67.75,78.12,88.38,86.62,82.75,77.69,0,-1.03,-7.25,3.12,-11.62,11.62,-4.75,2.69,0,0,0,0,1,2,1,1,1,0,1,0,1,3,2,2,1,1,2,1,0,0,0,1,2,0,0,0,2,0,0,0,0,0,0,0,1,0,1,1,0.2,1,1.4,1.4,0.6,0.4,0,0.6,1,0.4,4.33,2,0,6,1,0,2.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),65,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-1,-1,2,1,1,-1,0,1,0,1,3,2,2,0,1,1,0,-0.4,0.6,1.4,0.8,0.6,HS_TS +60,R_7P6o620cMbqo84U,60 - 66,Canadian,Female,3,0,2,2,-2,-2,-2,1,1,-1,2,1,2,-2,3,1,1,1,2,-1,3,1,2,2,0,5,-2,-3,2,-1,-1,7,2,2,2,-1,3,2,2,2,1,1,1,3,3,1,1,2,-3,6,-2,0,1,0,-1,5,2,2,2,-3,3,3,0,0,0,0,0,5,FALSE,1,90,TRUE,1,80,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,95,FALSE,1,90,TRUE,0,80,FALSE,1,100,TRUE,1,80,TRUE,1,90,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,0,75,TRUE,0,95,TRUE,1,70,FALSE,0,50,TRUE,1,95,0,0.0625,0,0.0025,0.0025,0.0025,0.04,0.01,0,0.01,0.09,0.01,0.01,0,0.0025,0.04,0,0.25,0.5625,0,0.04,0.0625,0.64,0,0.0025,0,0.25,0.01,0,0.01,0.9025,0,0.105267857,0.033392857,0.177142857,16,50,28,87.5,6,75,7,87.5,8,100,7,87.5,15,93.75,13,81.25,88.28,78.12,93.12,91.25,90.62,84.69,91.88,-37.5,0.78,3.12,5.62,-8.75,3.12,-9.06,10.63,0,1,0,0,2,0,1,1,2,0,0,1,0,1,0,1,1,0,1,2,0,1,1,0,1,0,2,0,1,0,0,1,0,1,0,1,1,1,2,1,0.6,0.8,0.4,1,0.6,0.6,0.4,1.2,0.7,0.7,4.67,4.67,-1,2,-1,-2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,-1,0,1,0,-1,1,1,0,0,0,0,0,0,0,0,-1,-1,1,0,0.2,0,-0.2,0,HS_TS +61,R_3XNQMr9xxovT2eJ,60 - 66,Canadian,Male,0,3,1,1,2,3,-1,1,-2,2,2,-1,2,1,3,2,2,2,2,2,-1,3,2,-1,-1,2,3,1,2,1,3,4,2,1,2,3,2,2,1,0,1,1,2,5,1,3,3,2,1,1,2,-1,2,-2,1,1,2,0,2,2,2,1,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,50,TRUE,0,97,TRUE,1,100,FALSE,1,50,TRUE,1,93,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.0625,0.25,0,0,0,0,0.25,0,0,0.25,0.5625,0.8281,0.25,0,0.0049,0.25,0.25,0.25,1,0,1,1,1,1,0.9409,0.326746429,0.098214286,0.555278571,25,78.13,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,86.91,83.5,87.5,84.38,92.25,98,75.81,6.25,15.03,8.5,12.5,9.38,29.75,-2,32.06,1,0,1,2,3,0,2,1,3,1,0,2,0,2,1,1,2,1,1,0,1,0,2,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,0,1.4,1.4,1,1,1,0.6,0.6,0,1.2,0.55,2.67,1,1,3,1,3,1.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,64,1.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,-1,1,2,-1,2,0,3,0,0,1,0,1,0,1,2,1,1,0,0.4,0.8,0.4,1,0.65,C_Ug +62,R_51AeU8rD9pFk6YR,67 - 73,Canadian,Male,-2,0,2,-2,1,-2,-1,2,-2,-1,2,3,3,1,0,-2,0,-1,-2,-3,-3,-2,3,0,1,6,-2,0,2,1,-2,4,1,3,3,1,0,3,-3,-3,-3,-3,-3,10,-3,1,2,1,-1,7,-2,-2,1,-3,-2,5,2,3,3,0,-1,6,1,0,1,1,-3,7,FALSE,1,92,TRUE,1,75,FALSE,1,76,FALSE,1,60,FALSE,0,55,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,97,FALSE,1,60,TRUE,0,83,TRUE,1,88,FALSE,1,94,TRUE,1,55,TRUE,1,100,FALSE,1,71,FALSE,1,88,FALSE,1,61,FALSE,1,100,FALSE,0,59,FALSE,0,57,FALSE,1,100,TRUE,1,100,FALSE,1,64,TRUE,1,95,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,87,TRUE,1,100,0,0.0025,0,0,0,0.0049,0,0.0009,0,0.3249,0,0.0144,0.0841,0.16,0.3025,0.0625,0,0.16,0,0.1296,0.3481,0.2025,0.1521,0.0036,0.0841,0.2304,0.0169,0.0064,0.0576,0.0144,1,0.6889,0.1446,0.079585714,0.209614286,23,71.88,27,84.38,8,100,5,62.5,7,87.5,7,87.5,13,81.25,14,87.5,82.28,65.12,83.25,85.88,94.88,83.69,80.88,-12.5,-2.1,-34.88,20.75,-1.62,7.38,2.44,-6.62,1,2,1,2,0,0,1,0,3,1,1,0,0,0,0,1,3,2,1,0,1,1,0,3,2,0,1,1,1,1,0,0,0,1,1,3,0,2,3,0,1.2,1,0.2,1.4,1.4,0.8,0.4,1.6,0.95,1.05,4.33,6,-1,-1,-3,3,-1.67,10 cents,5 minutes,24 days,Male,University - Undergraduate,68,-0.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,1,1,-1,-2,0,0,-1,2,0,1,0,0,-1,-1,-2,3,0,-2,0,-0.2,0.2,-0.2,-0.2,-0.1,C_Ug +63,R_5Yuhp62PhCluVLy,67 - 73,Canadian,Female,2,1,3,-2,3,-1,-3,3,-3,0,3,0,3,-1,3,2,2,2,3,2,2,1,3,-3,3,1,-3,-3,3,-3,1,1,3,1,3,1,3,1,3,3,3,3,2,1,3,1,3,-3,3,1,-3,-3,3,-3,1,1,3,1,3,-2,3,1,3,3,3,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,62,FALSE,1,100,TRUE,0,75,FALSE,1,100,TRUE,1,77,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,80,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,1,0,0,0,0.5625,0,0,0,0,0,0,0,0.25,0,0,0,0.2916,0,0,0.0529,0.2401,0.5625,0,0.1444,0.64,0,1,1,0,0,0,0.169428571,0.078864286,0.259992857,29,90.63,25,78.13,5,62.5,7,87.5,6,75,7,87.5,15,93.75,10,62.5,91.38,76.25,89.25,100,100,95.5,87.25,12.5,13.25,13.75,1.75,25,12.5,1.75,24.75,0,0,0,1,0,2,0,0,0,1,0,1,0,2,0,1,1,1,0,0,1,0,0,1,0,2,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0.2,0.6,0.6,0.6,0.4,0.6,0.4,0.8,0.5,0.55,1,1,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),70,1,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,-1,-0.2,0,0.2,-0.2,-0.05,HS_TS +64,R_1dMoiYjw25x8NIn,39 - 45,Canadian,Male,-3,3,-3,3,0,-3,2,3,3,2,3,1,3,3,3,1,1,-2,1,0,1,2,-3,1,0,6,-1,2,2,2,1,7,2,0,2,1,1,7,0,1,1,2,1,6,3,3,-1,3,2,7,-1,1,3,1,3,6,3,2,3,3,3,7,2,2,2,2,2,7,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,0,51,FALSE,0,51,FALSE,1,52,FALSE,0,52,TRUE,1,73,TRUE,1,68,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,0,54,FALSE,1,56,FALSE,0,52,FALSE,0,53,TRUE,0,53,TRUE,0,100,TRUE,0,53,TRUE,0,54,FALSE,0,100,TRUE,1,53,FALSE,1,53,FALSE,0,54,FALSE,1,100,TRUE,1,72,FALSE,1,100,FALSE,1,100,TRUE,0,54,TRUE,1,100,FALSE,0,69,TRUE,1,100,0.0729,0.0784,0.2809,0.2704,0,0.2304,0.2916,0,0.2916,0.2209,0,0.2916,0.1024,0.2916,0.2601,0.3025,0.2209,0.2601,0,0,1,0.2704,0.2809,0.1936,0.2809,0,0.4761,0,0,1,0.2916,1,0.2699,0.197407143,0.342392857,14,43.75,15,46.88,2,25,3,37.5,6,75,4,50,7,43.75,8,50,71.44,62.75,64.62,79.12,79.25,69.12,73.75,-3.13,24.56,37.75,27.12,4.12,29.25,25.37,23.75,4,1,0,2,0,2,0,1,1,1,1,1,1,2,2,1,0,3,1,1,6,0,2,0,2,2,1,0,2,1,0,1,0,0,0,1,1,4,1,2,1.4,1,1.4,1.2,2,1.2,0.2,1.8,1.25,1.3,6.67,6.67,-1,1,0,-1,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,42,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-2,1,-2,2,-2,0,-1,1,-1,0,1,0,1,2,2,0,-1,-1,0,-1,-0.6,-0.2,1.2,-0.6,-0.05,C_Ug +65,R_737tNmqawo6NYoU,25 - 31,Canadian,Male,2,3,2,-3,3,-3,2,2,1,1,-1,-2,3,-3,2,-3,-2,-3,-3,-3,-2,2,2,-2,-1,8,-3,3,-3,3,-3,8,-3,-3,1,-3,2,6,-3,-2,-3,-3,-3,1,2,3,1,-3,3,3,1,-2,3,-2,2,8,-1,-2,3,-3,2,2,-1,-1,-1,-1,-3,6,FALSE,1,90,FALSE,0,50,FALSE,1,91,TRUE,0,55,TRUE,1,75,FALSE,1,100,TRUE,1,55,TRUE,1,70,TRUE,1,85,TRUE,1,70,TRUE,0,55,TRUE,0,65,TRUE,1,90,FALSE,1,55,TRUE,1,55,FALSE,0,55,TRUE,0,70,TRUE,0,80,FALSE,1,55,FALSE,1,55,TRUE,1,65,FALSE,0,55,TRUE,0,80,TRUE,1,60,TRUE,0,70,TRUE,1,60,FALSE,1,55,TRUE,0,55,TRUE,0,55,TRUE,1,80,TRUE,1,75,FALSE,0,55,0.09,0.16,0.3025,0.2025,0.3025,0,0.16,0.09,0.2025,0.3025,0.04,0.01,0.0225,0.3025,0.0625,0.25,0.64,0.3025,0.3025,0.49,0.1225,0.2025,0.2025,0.2025,0.49,0.2025,0.0625,0.01,0.0081,0.64,0.3025,0.4225,0.226717857,0.191964286,0.261471429,16,50,19,59.38,5,62.5,4,50,5,62.5,5,62.5,12,75,7,43.75,66.91,60.62,73.75,66.88,66.38,65.94,67.88,-9.38,7.53,-1.88,23.75,4.38,3.88,-9.06,24.13,4,1,0,1,4,0,1,5,2,4,2,1,2,0,0,0,0,0,0,0,0,0,1,0,0,4,4,1,3,1,0,0,0,0,0,2,1,2,2,0,2,2.4,1,0,0.2,2.6,0,1.4,1.35,1.05,7.33,4.33,5,0,4,-5,3,5 cents,5 minutes,47 days,Male,High School (or equivalent),26,1.625,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,4,1,-1,1,4,-4,-3,4,-1,3,2,1,2,0,0,-2,-1,-2,-2,0,1.8,-0.2,1,-1.4,0.3,HS_TS +66,R_31aufd3cGtnHFI0,53 - 59,Canadian,Female,3,3,1,-3,-3,-1,0,2,-1,-1,2,3,1,-1,1,-3,-3,-3,0,-3,2,2,0,-3,-3,9,1,1,0,-1,1,5,2,2,2,-1,1,0,-3,0,-3,-3,-3,0,3,3,1,-3,-3,0,1,-1,2,0,-1,0,2,3,1,-1,1,0,-3,-3,-3,-3,-3,0,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,0,53,TRUE,1,56,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,55,TRUE,0,100,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,0,50,FALSE,1,74,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,70,FALSE,1,56,TRUE,1,87,FALSE,0,60,TRUE,1,50,0.1936,0,0.25,0.2809,0.25,0.25,0.25,0,0.25,0.25,0.0169,0.25,0.25,0.25,0.25,0.25,0.0676,0.25,0.49,1,0.25,0.25,0.25,0.25,0.2025,0.25,0.36,0.25,0,1,0.1936,1,0.30645,0.202464286,0.410435714,9,28.13,16,50,4,50,6,75,3,37.5,3,37.5,8,50,8,50,62.84,51.25,54.38,75.38,70.38,59.75,65.94,-21.87,12.84,1.25,-20.62,37.88,32.88,9.75,15.94,1,1,1,0,0,2,1,2,0,2,0,1,1,0,0,0,3,0,3,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,3,0,0.6,1.4,0.4,1.2,0,0.8,0,0.6,0.9,0.35,4.67,0,9,5,0,0,4.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),53,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,1,1,0,0,0,0,2,-1,2,0,1,1,0,0,0,3,0,0,0,0.6,0.6,0.4,0.6,0.55,HS_TS +67,R_78rnoTc0MRM3n7X,53 - 59,Canadian,Female,3,3,3,2,0,-2,1,1,2,0,1,0,1,1,2,1,0,1,3,-2,2,3,2,2,1,1,1,0,0,3,0,3,0,1,0,1,1,3,-2,-3,-2,-2,-2,5,2,2,1,0,1,1,0,0,1,-1,1,6,1,0,1,1,2,1,1,1,2,2,0,3,TRUE,0,95,TRUE,1,80,TRUE,0,69,TRUE,0,63,TRUE,1,90,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,77,TRUE,1,74,TRUE,0,98,TRUE,1,50,TRUE,1,100,TRUE,0,58,TRUE,0,89,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,96,FALSE,1,76,TRUE,1,50,TRUE,0,64,FALSE,1,50,FALSE,1,58,TRUE,1,50,FALSE,0,50,TRUE,1,96,0,0.25,0,0,0.0016,0.2304,0.0016,0.0025,0.25,0.0025,0.25,0.0676,0.25,0.25,0.01,0.04,0,0.3969,0.25,0.0576,0.25,0.25,0.25,0.9604,0.3364,0.4096,0.25,0.9025,0.4761,0.7921,0.1764,0.0529,0.255967857,0.125221429,0.386714286,24,75,22,68.75,3,37.5,7,87.5,5,62.5,7,87.5,15,93.75,7,43.75,72.66,57.12,72.25,87.25,74,76.62,68.69,6.25,3.91,19.62,-15.25,24.75,-13.5,-17.13,24.94,1,0,1,0,1,3,1,1,1,0,1,1,1,0,1,3,3,3,5,0,1,1,2,2,1,2,1,0,3,1,0,0,0,0,0,0,1,1,1,2,0.6,1.2,0.8,2.8,1.4,1.4,0,1,1.35,0.95,2.33,2.67,0,-3,2,2,-0.34,10 cents,100 minutes,15 days,Female,University - Undergraduate,54,1.375,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,-1,-1,-2,0,1,0,1,-2,-1,1,1,1,0,1,3,2,2,4,-2,-0.8,-0.2,0.8,1.8,0.4,C_Ug +68,R_1VmdyPIjBNvrern,60 - 66,American,Female,2,3,2,3,2,1,-2,1,-3,1,1,3,2,3,1,2,2,2,2,1,1,1,1,1,2,8,1,-2,1,0,0,8,0,1,0,1,0,8,3,2,2,2,1,8,2,2,1,1,1,8,1,-1,-1,-1,1,7,0,1,0,1,0,8,2,2,2,3,1,7,TRUE,0,100,FALSE,0,71,FALSE,1,96,TRUE,0,76,TRUE,1,86,FALSE,1,78,TRUE,1,87,TRUE,1,97,TRUE,1,84,TRUE,1,92,FALSE,1,74,TRUE,0,94,TRUE,1,76,FALSE,1,65,FALSE,0,74,FALSE,0,90,FALSE,1,69,FALSE,1,88,FALSE,1,72,FALSE,1,70,FALSE,0,79,FALSE,0,75,FALSE,1,73,TRUE,1,73,FALSE,1,91,TRUE,1,91,FALSE,1,74,FALSE,1,78,TRUE,0,82,TRUE,1,89,FALSE,0,71,TRUE,1,80,0.0009,0.0081,0.81,0.0169,0.04,0.0484,0.0729,0.0064,0.09,0.5625,0.0121,0.0576,0.0256,0.0676,0.0196,0.5041,0.0729,0.5776,0.0484,0.0081,0.6241,0.5476,0.0784,0.1225,0.0961,0.0676,0.5041,1,0.0016,0.0144,0.6724,0.8836,0.243792857,0.154092857,0.333492857,26,81.25,22,68.75,4,50,6,75,6,75,6,75,10,62.5,12,75,81.09,74.5,77.88,86.12,85.88,82.19,80,12.5,12.34,24.5,2.88,11.12,10.88,19.69,5,1,2,1,2,0,0,0,0,3,1,1,2,2,2,1,1,0,0,0,0,0,1,1,2,1,0,1,2,2,0,1,2,2,2,1,0,0,0,1,0,1.2,0.8,1.6,0.2,1,1,1.6,0.2,0.95,0.95,8,7.67,0,1,0,1,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),61,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,1,1,0,0,-1,0,-1,-2,1,1,0,0,0,0,0,1,0,0,-1,0,0.2,-0.2,0,0,0,HS_TS +69,R_1xqCkBaPxJEbxrX,67 - 73,American,Female,2,2,1,0,0,-2,-3,2,-1,0,2,-3,3,-2,3,0,1,2,2,0,2,2,1,0,0,0,-2,-3,3,0,0,1,2,-3,3,-3,3,0,0,0,2,2,0,0,2,2,1,1,0,1,-3,-3,3,-1,-1,2,2,-3,3,-3,3,0,0,-1,1,1,0,2,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,96,FALSE,1,100,TRUE,0,90,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,80,TRUE,0,91,TRUE,1,90,FALSE,1,50,TRUE,0,81,FALSE,1,50,TRUE,1,91,TRUE,1,89,TRUE,1,100,0,0.01,0.0016,0.25,0,0,0.04,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0.25,0,0,0.25,0.6561,0.8281,0.25,0.25,0.25,0.25,0,0.25,0.0121,0.25,0,0.81,0.25,1,0.253728571,0.146292857,0.361164286,16,50,25,78.13,7,87.5,7,87.5,5,62.5,6,75,14,87.5,11,68.75,72.12,61.12,75,65.12,87.25,71.62,72.62,-28.13,-6.01,-26.38,-12.5,2.62,12.25,-15.88,3.87,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,2,1,1,0,0,0.4,0.2,0.2,0.2,0.6,0.2,0.8,0.2,0.45,0.33,1,-1,-1,0,-2,-0.67,10 cents,5 minutes,24 days,Female,Trade School (non-military),72,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,-1,0,-1,0,0,1,-1,0,0,0,0,0,0,-1,-1,-1,0,-0.2,-0.2,0,-0.6,-0.25,HS_TS +70,R_3Pd9d7qCcQ4RYat,67 - 73,Canadian,Female,1,2,3,-2,-2,1,-3,3,-2,-3,2,1,3,-3,3,2,2,2,3,2,2,2,3,-3,-2,0,2,-3,3,-2,-3,0,2,2,3,-3,3,0,3,3,2,3,3,0,1,2,3,1,-3,0,1,-3,3,-2,-3,0,2,3,3,-3,3,0,3,2,3,3,3,0,TRUE,0,50,FALSE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,100,FALSE,1,56,FALSE,1,100,FALSE,0,59,TRUE,1,68,FALSE,1,93,FALSE,0,50,TRUE,0,95,TRUE,1,75,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,0,0.0625,0.09,0.0196,0,0,0.25,0,0,0.1024,0,1,0.25,0,0.25,1,0.0049,0.25,0,0.9025,0.3481,0.25,0.1936,0,0.25,0.25,0.0001,0.25,1,0,1,1,0.305414286,0.22195,0.388878571,24,75,19,59.38,4,50,4,50,6,75,5,62.5,9,56.25,10,62.5,81.28,69.38,81.5,84.25,90,78.56,84,15.62,21.9,19.38,31.5,9.25,27.5,22.31,21.5,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,3,1,0,0,0,0,0,0,2,0,0,0,1,0,1,0,1,0.4,0.2,0.2,0.6,0.8,0,0.4,0.6,0.35,0.45,0,0,0,0,0,0,0,10 cents,5 minutes,47 days,Female,High School (or equivalent),68,0.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,1,0,0,-2,-1,1,0,0,0,0,0,-1,0,0,0,0,1,-1,0,0,-0.4,0.2,-0.2,0,-0.1,HS_TS +71,R_1OJKQA1K4pCkc37,67 - 73,Canadian,Female,2,3,3,-3,1,1,0,1,-2,-1,3,3,2,0,0,2,1,3,2,2,3,3,3,-3,2,8,1,-3,-1,-3,-3,6,3,3,2,2,-1,6,2,2,2,0,1,8,1,3,3,-3,-1,0,3,-3,3,-3,0,3,3,3,2,-1,1,2,3,3,3,3,2,1,FALSE,1,100,FALSE,0,80,TRUE,0,100,FALSE,1,64,FALSE,0,81,TRUE,0,77,TRUE,1,94,TRUE,1,100,TRUE,1,74,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,TRUE,0,89,FALSE,0,62,FALSE,0,100,FALSE,1,93,TRUE,0,100,FALSE,1,67,FALSE,1,74,FALSE,0,100,FALSE,0,63,FALSE,1,67,TRUE,1,70,FALSE,1,66,TRUE,1,100,TRUE,0,59,TRUE,0,98,FALSE,1,85,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,1,0.0036,0,0.5929,0.09,0,0.0676,0.3969,0,0,0.0676,0.64,0.6561,0.64,0.1089,0.1296,0.9604,0.1156,1,0.3844,0.1089,0.7921,0.0049,0.3481,0.3025,0,1,1,0.0225,1,0.372464286,0.242114286,0.502814286,27,84.38,17,53.13,3,37.5,5,62.5,5,62.5,4,50,9,56.25,8,50,84.31,67.62,87.88,89,92.75,86.19,82.44,31.25,31.18,30.12,25.38,26.5,42.75,29.94,32.44,1,0,0,0,1,0,3,2,1,2,0,0,0,2,1,0,1,1,2,1,1,0,0,0,2,2,3,2,1,1,0,0,0,1,1,1,2,0,1,0,0.4,1.6,0.6,1,0.6,1.8,0.4,0.8,0.9,0.9,6.67,1.67,8,3,4,7,5,10 cents,75 minutes,36 days,Female,High School (or equivalent),67,0.875,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,-1,-2,0,0,0,1,0,0,0,1,0,-1,-1,1,1,1,-0.2,-0.2,0.2,0.2,0,HS_TS +72,R_6YJKAzC8xCjFbpC,67 - 73,Canadian,Male,3,3,-1,-1,2,-1,-2,3,-3,0,3,1,3,0,3,3,3,3,3,3,3,3,3,-2,3,3,0,-2,3,-3,1,2,3,1,3,-2,3,2,3,3,3,3,3,0,3,3,0,1,3,1,0,-1,3,-3,-1,2,3,2,3,-2,3,1,3,3,3,3,3,0,FALSE,1,100,FALSE,0,80,FALSE,1,100,FALSE,1,69,TRUE,1,68,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,75,FALSE,1,100,TRUE,1,88,TRUE,1,82,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0.0324,0,0,0,0.8281,0.1024,0.64,0,0.0961,0,0,0.0144,0.0625,0.5625,0,0,0.5776,0,0,0,0,1,1,0.211285714,0.192785714,0.229785714,30,93.75,25,78.13,4,50,6,75,8,100,7,87.5,15,93.75,10,62.5,93.88,83.25,94.5,97.75,100,93.31,94.44,15.62,15.75,33.25,19.5,-2.25,12.5,-0.44,31.94,0,0,4,1,1,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,1,2,1,1,1,0,0,1,0,1,0,2,0,0,0,0,0,0,1.2,0.4,0.4,0,0.8,0.6,0.6,0,0.5,0.5,2.33,1.33,2,0,1,0,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),68,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,3,-1,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0.4,-0.2,-0.2,0,0,HS_TS +73,R_6Lo0CIpx8AJk2Yx,53 - 59,Canadian,Male,-1,2,2,2,2,1,1,2,2,2,1,1,2,2,2,-1,1,-1,1,-1,-1,2,2,2,2,8,2,-1,2,2,2,8,1,2,2,1,2,8,1,2,1,1,-1,7,-1,2,2,1,2,8,1,1,2,2,1,7,1,1,2,1,2,7,1,-1,1,1,-1,7,TRUE,0,92,TRUE,1,80,FALSE,1,65,TRUE,0,69,TRUE,1,73,FALSE,1,92,TRUE,1,82,TRUE,1,73,TRUE,1,74,TRUE,1,95,FALSE,1,77,TRUE,0,91,TRUE,1,88,TRUE,0,73,TRUE,1,76,TRUE,1,78,TRUE,0,74,TRUE,0,92,TRUE,0,73,FALSE,1,82,FALSE,0,87,FALSE,0,80,FALSE,1,87,TRUE,1,81,TRUE,0,87,TRUE,1,90,FALSE,1,83,TRUE,0,89,TRUE,0,87,TRUE,1,91,TRUE,1,86,TRUE,1,97,0.0729,0.01,0.0484,0.0324,0.0009,0.0064,0.0361,0.0025,0.0324,0.64,0.0081,0.0144,0.0676,0.0529,0.0729,0.04,0.0169,0.4761,0.7921,0.7569,0.7569,0.0576,0.5329,0.5329,0.5476,0.0289,0.0196,0.8464,0.1225,0.8464,0.7569,0.8281,0.317603571,0.1048,0.530407143,28,87.5,20,62.5,6,75,5,62.5,3,37.5,6,75,14,87.5,6,37.5,82.62,77.25,85.62,86.38,81.25,83.19,82.06,25,20.12,2.25,23.12,48.88,6.25,-4.31,44.56,0,0,0,0,0,1,2,0,0,0,0,1,0,1,0,2,1,2,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,2,2,0,0,0,0.6,0.4,1,0.2,0.2,0.2,1.2,0.5,0.45,8,7.33,0,1,1,0,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,-0.25,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,1,2,0,0,-1,0,1,0,0,0,0,-1,0,0,0,-0.2,0.4,0.2,-0.2,0.05,HS_TS +74,R_6UarpWzGi9zvY9X,46 - 52,Canadian,Male,2,3,2,2,3,-1,-1,-1,-2,1,1,0,2,-1,1,2,2,3,0,2,3,3,3,0,1,7,-2,1,1,0,-1,3,0,-1,2,1,0,7,2,2,2,1,-1,9,1,3,0,3,2,5,-2,0,0,-2,-1,3,-1,0,1,-2,0,5,1,1,2,1,2,7,FALSE,1,100,FALSE,0,95,FALSE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,98,TRUE,1,96,TRUE,1,92,TRUE,1,85,FALSE,1,70,FALSE,1,70,TRUE,1,87,FALSE,1,100,FALSE,0,60,TRUE,1,95,FALSE,1,90,TRUE,0,100,TRUE,0,75,FALSE,1,100,FALSE,0,100,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,90,TRUE,1,100,FALSE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,64,TRUE,1,80,0.0016,0,0.0025,0.0004,0.04,0,0.01,0.0225,0,0.0225,0.01,0.0169,0.0064,0.09,0.01,0.9025,0,0.36,0,0.01,1,0.36,0.5625,0,0.01,0.01,0.1296,0,0,1,0,0.09,0.166532143,0.106485714,0.226578571,27,84.38,26,81.25,4,50,7,87.5,7,87.5,8,100,13,81.25,13,81.25,89.12,75.75,93.38,94.75,92.62,87.94,90.31,3.13,7.87,25.75,5.88,7.25,-7.38,6.69,9.06,1,0,1,2,2,1,2,2,2,2,1,1,0,2,1,0,0,1,1,3,1,0,2,1,1,1,1,1,0,2,2,0,1,1,1,1,1,1,1,0,1.2,1.8,1,1,1,1,1,0.8,1.25,0.95,5.67,4.33,2,0,2,2,1.34,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,46,0.625,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,-1,1,1,0,1,1,2,0,-1,1,-1,1,0,-1,-1,0,0,3,0.2,0.8,0,0.2,0.3,C_Ug +75,R_3onatePMIchcixw,53 - 59,Canadian,Male,-2,2,1,1,3,3,-3,3,-3,2,2,-2,3,-2,2,2,2,2,3,2,-2,2,1,1,3,1,2,-3,2,-3,2,1,2,-2,3,-2,2,1,2,2,2,3,2,1,-2,2,1,1,3,1,2,-3,3,-3,2,1,2,-3,3,-3,3,1,2,2,2,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,91,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,73,FALSE,0,73,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,FALSE,1,84,FALSE,1,73,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,88,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0144,0.5329,0,0,0,0,0.5329,0,0,0,0,0.0625,0,0,1,0.09,0.0729,1,0,1,0,1,0.8281,0.0256,1,1,0.291403571,0.081621429,0.501185714,25,78.13,23,71.88,6,75,6,75,5,62.5,6,75,13,81.25,10,62.5,94.59,86.38,100,94.62,97.38,94,95.19,6.25,22.71,11.38,25,32.12,22.38,12.75,32.69,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0.4,0,0,0,0.2,0.6,0.2,0.1,0.25,1,1,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,58,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,1,0,0,0,-1,0,-1,-1,0,0,0,0,-1,0,0.2,-0.6,-0.2,-0.15,C_Ug +76,R_7xSlTDefzznUrD7,67 - 73,Canadian,Female,2,1,2,-1,3,-2,-1,1,1,0,3,2,0,-3,1,0,0,2,2,-1,2,1,3,-3,3,2,-1,-1,1,-1,0,5,3,3,1,-3,1,1,2,2,2,2,1,7,1,1,2,1,1,6,2,0,0,1,-1,7,3,2,1,-3,2,2,-1,-1,0,1,-2,5,TRUE,0,80,TRUE,1,59,FALSE,1,75,FALSE,1,53,FALSE,0,59,FALSE,1,59,TRUE,1,85,TRUE,1,89,FALSE,0,50,TRUE,1,85,FALSE,1,54,TRUE,0,90,TRUE,1,87,TRUE,0,80,TRUE,1,57,TRUE,1,83,TRUE,0,84,TRUE,0,79,FALSE,1,54,FALSE,1,56,TRUE,1,50,FALSE,0,55,FALSE,1,52,TRUE,1,92,TRUE,0,84,TRUE,1,80,FALSE,1,50,FALSE,1,80,FALSE,1,53,TRUE,1,90,TRUE,1,50,TRUE,1,100,0.0121,0.04,0.0289,0.0225,0,0.1681,0.0064,0.0225,0.1936,0.3025,0.01,0.0169,0.25,0.2116,0.3481,0.1681,0.2304,0.2209,0.04,0.7056,0.25,0.1849,0.2116,0.64,0.7056,0.25,0.25,0.64,0.0625,0.6241,0.2209,0.81,0.276582143,0.153507143,0.399657143,19,59.38,23,71.88,7,87.5,6,75,3,37.5,7,87.5,13,81.25,10,62.5,70.44,53.38,68,78.5,81.88,73.19,67.69,-12.5,-1.44,-34.12,-7,41,-5.62,-8.06,5.19,0,0,1,2,0,1,0,0,2,0,0,1,1,0,0,2,2,0,0,2,1,0,0,2,2,4,1,1,0,1,0,0,1,0,1,1,1,2,1,1,0.6,0.6,0.4,1.2,1,1.4,0.4,1.2,0.7,1,2.67,5,-4,-2,-1,2,-2.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,0,1,0,-2,-3,-1,-1,2,-1,0,1,0,0,-1,1,1,-2,-1,1,-0.4,-0.8,0,0,-0.3,HS_TS +77,R_7huVumcWu2J2f9D,67 - 73,American,Female,2,2,3,2,3,-2,-1,1,2,-1,1,-1,2,-3,1,-2,-2,-1,-1,-2,2,2,3,-1,2,8,-3,1,1,1,-1,8,1,1,2,-3,1,8,1,1,1,-1,1,5,2,2,3,2,2,10,-3,-2,1,1,-1,9,1,1,2,-3,2,9,0,-2,-1,-2,-2,8,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,86,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,65,TRUE,0,100,FALSE,0,50,TRUE,1,70,FALSE,1,90,FALSE,1,80,FALSE,1,50,FALSE,1,70,TRUE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,92,TRUE,0,83,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.0064,0.09,0,0,0.0016,0,0,0.09,0.25,0,0.1225,0.0064,0.25,0.0196,0,0,0.25,0.0064,0,0.25,0.25,0.25,1,0.01,0.25,0.25,0.2025,0,0.04,0.6889,1,0.185282143,0.070721429,0.299842857,22,68.75,27,84.38,6,75,7,87.5,7,87.5,7,87.5,15,93.75,12,75,80.34,61.5,83.75,84.62,91.5,81.56,79.12,-15.63,-4.04,-13.5,-3.75,-2.88,4,-12.19,4.12,0,0,0,3,1,1,2,0,1,0,0,2,0,0,0,3,3,2,0,3,0,0,0,0,1,1,1,0,1,0,0,2,0,0,1,2,0,0,1,0,0.8,0.8,0.4,2.2,0.2,0.6,0.6,0.6,1.05,0.5,8,9.33,-2,-1,-1,-3,-1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,70,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,3,0,0,1,0,0,0,0,0,0,0,-1,1,3,2,-1,3,0.6,0.2,-0.2,1.6,0.55,C_Ug +78,R_7dLMCYItO3tbRjp,60 - 66,Canadian,Female,2,2,3,-1,0,-1,-1,1,1,-1,2,1,1,-2,1,0,2,2,1,-1,2,2,3,-1,0,0,-1,-1,2,1,-1,1,2,1,1,-2,1,1,1,1,2,1,-1,1,2,2,3,-1,0,1,1,-1,1,1,-1,1,2,1,1,-1,1,1,1,0,1,1,-1,1,TRUE,0,61,FALSE,0,50,FALSE,1,96,FALSE,1,50,FALSE,0,50,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,92,TRUE,1,84,FALSE,1,72,FALSE,0,50,TRUE,1,55,TRUE,0,50,TRUE,0,99,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,51,TRUE,0,50,TRUE,1,100,FALSE,1,79,TRUE,1,100,TRUE,0,53,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.2025,0,0,0.2304,0,0,0.25,0.2401,0,0.0256,0.25,0.25,0.25,0.25,0.25,0.25,1,0.0441,0.25,0.25,0.25,0.0784,0.25,0.2809,0.25,0.3721,0.0016,0.9801,1,0.8464,0.289275,0.160435714,0.418114286,26,81.25,18,56.25,3,37.5,3,37.5,6,75,6,75,11,68.75,7,43.75,71.69,50.38,67,82.75,86.62,74.38,69,25,15.44,12.88,29.5,7.75,11.62,5.63,25.25,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,1,2,1,0,0,0,0.2,0,0.4,0,0.4,0.2,0.8,0.15,0.35,0.67,1,-1,0,0,0,-0.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),62,0,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,-2,0,1,0,0,0,0,0,-1,0,0,-1,-1,0,0,0,-0.2,-0.2,-0.4,-0.2,HS_TS +79,R_5e4W9ZBiMs9fFz2,67 - 73,American,Female,3,2,1,-2,3,2,-3,2,-1,2,1,-1,3,-2,3,-2,-2,1,0,-1,3,2,2,-3,3,7,2,-3,2,1,3,8,1,1,3,-2,3,9,-1,1,1,-1,-2,8,3,1,0,1,1,7,1,-3,2,-1,2,9,-1,-1,2,-3,2,8,1,0,2,2,1,7,TRUE,0,77,TRUE,1,100,TRUE,0,98,FALSE,1,60,TRUE,1,92,FALSE,1,90,TRUE,1,99,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,66,TRUE,1,100,TRUE,0,82,TRUE,0,100,FALSE,1,69,FALSE,1,100,TRUE,1,78,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,0,85,FALSE,1,90,TRUE,0,99,TRUE,1,92,TRUE,1,99,TRUE,1,100,0,0,0,0.0001,0,0.01,0.0081,0,0,0,0.0064,1,0.0256,0.0016,0.0064,0,0,0.16,0.01,0,0.0484,0.1156,0.0961,1,0.6724,0.7225,0.0001,0.5929,0.9604,1,0.9801,1,0.300592857,0.087007143,0.514178571,24,75,23,71.88,7,87.5,5,62.5,5,62.5,6,75,15,93.75,8,50,92.09,82.38,92.62,97,96.38,93.81,90.38,3.12,20.21,-5.12,30.12,34.5,21.38,0.06,40.38,0,0,1,1,0,0,0,0,2,1,0,2,0,0,0,1,3,0,1,1,0,1,1,3,2,1,0,0,0,0,2,0,1,1,1,3,2,1,2,2,0.4,0.6,0.4,1.2,1.4,0.2,1,2,0.65,1.15,8,8,0,-1,1,1,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,67,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,-1,0,-2,-2,-1,0,0,2,1,-2,2,-1,-1,-1,-2,1,-1,-1,-1,-1,0.4,-0.6,-0.8,-0.5,C_Ug +80,R_51v3e3OUwwSDNlp,67 - 73,American,Female,3,3,0,0,0,-2,-2,2,-1,1,2,2,2,-2,3,-1,0,2,2,-2,3,3,0,-3,2,3,-3,-3,2,-3,2,1,2,2,2,-3,2,1,-3,0,-2,1,-3,7,2,2,0,0,0,2,-3,-3,2,-3,2,1,2,2,2,-3,3,0,1,0,2,2,-2,1,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,80,TRUE,1,100,FALSE,1,72,FALSE,1,92,TRUE,0,90,FALSE,1,100,FALSE,0,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0.0081,1,0,0,0,0.3025,0,0,0.5041,0.04,0.81,1,0.0784,1,0,1,0,0.0064,1,0,0.276767857,0.165042857,0.388492857,28,87.5,23,71.88,4,50,5,62.5,6,75,8,100,14,87.5,9,56.25,95.34,89.5,92.88,99,100,96.38,94.31,15.62,23.46,39.5,30.38,24,0,8.88,38.06,0,0,0,3,2,1,1,0,2,1,0,0,0,1,1,2,0,4,1,1,1,1,0,0,0,1,1,0,2,1,0,0,0,1,0,2,0,0,0,0,1,1,0.4,1.6,0.4,1,0.2,0.4,1,0.5,1.67,1,1,0,1,6,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,69,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,-1,0,3,2,0,0,0,0,0,0,0,0,0,1,0,0,4,1,1,0.6,0,0.2,1.2,0.5,C_Ug +81,R_3NLRhLB8UD8d65b,67 - 73,American,Male,0,2,3,2,2,-3,-3,3,-3,-1,3,1,2,-2,1,2,1,2,2,-1,0,2,1,-1,2,3,-3,-3,3,-3,2,1,3,2,2,-2,2,1,2,2,2,2,-3,8,-1,1,3,3,-1,7,-3,-3,3,-2,-1,5,3,2,2,-3,1,4,-1,-1,1,2,-1,8,TRUE,0,81,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,62,FALSE,1,100,FALSE,1,100,TRUE,1,66,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,58,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,88,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,72,TRUE,1,100,0,0,0,0,0,0,0,0.3844,0,0,0,0.1156,0,0,0,0,0,0.25,0,0.0144,0,0.25,0.3364,0,0,0.25,0.0784,0.6561,1,1,1,0,0.190546429,0.053571429,0.327521429,28,87.5,25,78.13,6,75,7,87.5,5,62.5,7,87.5,15,93.75,10,62.5,89.91,72.5,95.75,91.38,100,90.62,89.19,9.37,11.78,-2.5,8.25,28.88,12.5,-3.13,26.69,0,0,2,3,0,0,0,0,0,3,0,1,0,0,1,0,1,0,0,2,1,1,0,1,3,0,0,0,1,0,0,1,0,1,0,3,2,1,0,0,1,0.6,0.4,0.6,1.2,0.2,0.4,1.2,0.65,0.75,1.67,5.33,-4,-4,-3,0,-3.66,10 cents,5 minutes,47 days,Male,High School (or equivalent),72,1.375,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,-1,-1,2,2,-3,0,0,0,-1,3,0,0,0,-1,1,-3,-1,-1,0,2,-0.2,0.4,0,-0.6,-0.1,HS_TS +82,R_77kyIslwbC2FY80,60 - 66,Canadian,Male,3,3,3,1,3,-2,1,-1,2,1,2,1,1,-1,3,-1,-1,-1,1,0,3,3,3,1,3,6,0,1,-1,1,0,6,3,2,2,1,3,4,1,-1,0,2,1,8,3,3,3,1,3,6,1,-1,0,1,0,6,2,1,0,0,3,5,1,-1,1,-1,1,6,FALSE,1,95,TRUE,1,93,TRUE,0,100,FALSE,1,95,TRUE,1,95,FALSE,1,73,TRUE,1,89,TRUE,1,67,TRUE,1,67,TRUE,1,92,TRUE,0,90,TRUE,0,98,TRUE,1,100,TRUE,0,66,TRUE,1,94,TRUE,1,100,TRUE,0,93,TRUE,0,90,TRUE,0,97,TRUE,0,91,FALSE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,85,FALSE,0,68,TRUE,0,100,FALSE,1,77,TRUE,0,100,TRUE,1,97,FALSE,0,78,TRUE,1,95,0.1089,0.4624,0,0.0121,0.0025,0.0729,0,0.0064,0.8281,0,0.0009,0,0.1089,0.81,0.0025,0.0049,0,0.0025,0.0529,0.7225,0.4624,0.0036,0.9409,0.4356,0.8649,1,0.6084,0.0025,1,0.81,1,0.9604,0.382275,0.1314,0.63315,28,87.5,18,56.25,4,50,5,62.5,4,50,5,62.5,13,81.25,5,31.25,89.16,89.25,90.5,85.62,91.25,87.69,90.62,31.25,32.91,39.25,28,35.62,28.75,6.44,59.37,0,0,0,0,0,2,0,0,1,1,1,1,1,2,0,2,0,1,1,1,0,0,0,0,0,3,2,1,1,1,0,0,1,1,0,2,0,2,2,1,0,0.8,1,1,0,1.6,0.4,1.4,0.7,0.85,5.33,5.67,0,0,-1,2,-0.34,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),65,0,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,-2,-1,0,0,1,1,0,1,0,0,0,-1,-1,0,0,-0.8,0.6,-0.4,-0.15,grad_prof +83,R_1jSRqk2G1NpcOcH,67 - 73,American,Female,-1,-1,1,1,2,0,-1,1,-1,0,2,2,2,1,2,1,1,1,1,-1,-1,0,1,1,2,5,1,-1,1,-1,1,2,2,1,1,0,1,4,0,1,1,1,-1,4,-1,-1,1,1,2,5,0,-1,1,-1,0,3,1,1,1,0,1,8,1,0,1,1,0,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,64,FALSE,0,100,FALSE,1,80,TRUE,0,100,TRUE,1,78,TRUE,0,100,TRUE,1,73,TRUE,1,89,FALSE,1,100,FALSE,1,100,FALSE,1,71,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,1,77,TRUE,0,100,TRUE,1,100,FALSE,0,74,TRUE,1,100,0,0,0.0121,0,0,0,0,1,0,0,0,0.0484,0.4096,0.04,0,0,0,0.3364,0.0529,0,1,0.0729,0.0841,1,0,0.0676,0.5476,0,0,0,1,1,0.237839286,0.131028571,0.34465,24,75,24,75,5,62.5,6,75,6,75,7,87.5,12,75,12,75,91.81,74.25,97.25,100,95.75,92.38,91.25,0,16.81,11.75,22.25,25,8.25,17.38,16.25,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,1,0.2,0.4,0.8,0.2,0,0,1,0.4,0.4,0.35,3.67,5.33,0,-1,-4,1,-1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,1,0,0,0,1,0,0,0,1,-1,0,0,0,0,1,-1,0,0,-1,0.2,0.4,-0.2,-0.2,0.05,HS_TS +84,R_5TWlNmjz0LyQSvn,67 - 73,Canadian,Female,3,3,2,1,-2,1,-1,1,3,1,2,0,2,1,2,1,1,2,1,0,3,3,2,1,-1,6,0,1,3,3,1,5,2,0,2,3,2,5,-1,-1,-1,0,0,5,3,3,3,3,-3,3,0,1,0,3,0,4,2,-2,2,0,2,4,1,1,1,1,0,3,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,77,FALSE,0,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,81,FALSE,1,76,TRUE,1,76,TRUE,0,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,87,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,58,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0.0576,0,0.0361,0.5929,0.0225,0,0.0529,0.0025,0,0.04,0.3249,0.7569,1,0,0.3364,0.0196,0,0,1,1,0.0576,0.224996429,0.125857143,0.324135714,23,71.88,24,75,5,62.5,6,75,5,62.5,8,100,13,81.25,11,68.75,91.72,78.88,91.62,100,96.38,91.31,92.12,-3.12,16.72,16.38,16.62,37.5,-3.62,10.06,23.37,0,0,0,0,1,1,2,2,0,0,0,0,0,2,0,2,2,3,1,0,0,0,1,2,1,1,2,1,0,1,0,2,0,1,0,0,0,1,0,0,0.2,1,0.4,1.6,0.8,1,0.6,0.2,0.8,0.65,5.33,3.67,3,1,1,2,1.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),67,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,-1,-2,0,0,0,1,0,-1,0,-2,0,1,0,2,2,2,1,0,-0.6,0,-0.2,1.4,0.15,HS_TS +85,R_5SB261mcsInzUna,67 - 73,Canadian,Female,-1,2,3,1,-2,-1,-1,1,1,-2,1,1,0,0,1,1,1,1,1,-1,0,1,1,1,1,1,-1,-1,1,1,0,4,1,1,1,1,1,1,-1,0,1,1,1,3,1,1,2,1,0,5,-1,0,1,1,0,5,1,1,1,0,1,5,0,0,0,1,-1,5,TRUE,0,78,TRUE,1,83,TRUE,0,100,TRUE,0,51,TRUE,1,56,FALSE,1,100,TRUE,1,77,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,57,TRUE,0,78,FALSE,0,74,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,55,TRUE,0,74,TRUE,0,76,FALSE,1,100,TRUE,1,69,TRUE,1,53,TRUE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,70,TRUE,0,100,TRUE,1,80,TRUE,1,51,TRUE,1,100,0,0,0,0.0529,0,0,0,0,0,0.2209,0.04,0.5476,0.0256,0.1849,0.1936,0.0289,0.4624,0.2601,0.09,0,0.0961,0.25,0.5776,1,0.3025,0.2809,0.2401,0.6084,1,0.5476,1,0.6084,0.305914286,0.140285714,0.471542857,16,50,20,62.5,5,62.5,4,50,5,62.5,6,75,15,93.75,5,31.25,79.28,63.12,77.75,85.25,91,79.81,78.75,-12.5,16.78,0.62,27.75,22.75,16,-13.94,47.5,1,1,2,0,3,0,0,0,0,2,0,0,1,1,0,2,1,0,0,2,2,1,1,0,2,0,1,0,0,2,0,0,1,0,0,1,1,1,0,0,1.4,0.4,0.4,1,1.2,0.6,0.2,0.6,0.8,0.65,2,5,-4,-1,-4,-2,-3,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,0.75,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,0,1,0,1,0,-1,0,0,0,0,0,0,1,0,1,0,-1,0,2,0.2,-0.2,0.2,0.4,0.15,HS_TS +86,R_5sz5kJpCL0GuQui,67 - 73,American,Female,0,3,3,0,1,1,0,3,-3,1,3,3,0,0,0,-3,-3,-3,-3,-3,1,3,2,0,2,8,3,0,3,-3,2,3,3,3,3,0,1,4,3,3,1,1,-1,10,1,0,3,1,-1,6,-2,1,-1,1,-3,10,3,3,1,0,0,6,-3,-3,-3,-3,-3,10,TRUE,0,71,FALSE,0,63,TRUE,0,77,TRUE,0,55,FALSE,0,53,FALSE,1,61,TRUE,1,72,TRUE,1,87,TRUE,1,79,TRUE,1,95,FALSE,1,56,TRUE,0,85,FALSE,0,68,TRUE,0,80,FALSE,0,58,TRUE,1,61,FALSE,1,55,TRUE,0,95,TRUE,0,63,TRUE,0,62,FALSE,0,53,FALSE,0,54,FALSE,1,61,TRUE,1,54,TRUE,0,86,TRUE,1,74,TRUE,0,51,TRUE,0,70,TRUE,0,56,TRUE,1,100,TRUE,1,65,TRUE,1,92,0.0169,0.0676,0.1521,0.0784,0.0064,0.1521,0.2116,0.0025,0.3844,0.2916,0,0.4624,0.0441,0.1936,0.2809,0.3969,0.1521,0.3025,0.49,0.7396,0.2809,0.3364,0.3969,0.64,0.2025,0.2601,0.1225,0.5041,0.5929,0.9025,0.3136,0.7225,0.3352,0.205792857,0.464607143,22,68.75,14,43.75,3,37.5,4,50,3,37.5,4,50,10,62.5,4,25,69.12,61.25,62.38,78.38,74.5,70.5,67.75,25,25.37,23.75,12.38,40.88,24.5,8,42.75,1,0,1,0,1,2,0,0,0,1,0,0,3,0,1,6,6,4,4,2,1,3,0,1,2,3,1,4,4,4,0,0,1,0,0,0,0,0,0,0,0.6,0.6,0.8,4.4,1.4,3.2,0.2,0,1.6,1.2,5,7.33,2,-7,-2,0,-2.33,10 cents,100 minutes,24 days,Female,Trade School (non-military),69,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-3,1,-1,-1,-1,-1,-4,-4,-3,0,0,2,0,1,6,6,4,4,2,-0.8,-2.6,0.6,4.4,0.4,HS_TS +87,R_7RrdYEClXXNwi3F,60 - 66,American,Female,2,2,3,-3,3,1,-3,2,-3,0,2,0,3,-2,3,2,2,2,2,-2,3,3,3,-3,3,1,1,-3,2,-3,0,2,2,0,3,0,2,1,2,2,2,3,-1,2,3,2,3,1,2,1,1,-3,1,-2,-1,1,2,0,3,-3,3,1,0,0,2,2,-1,3,TRUE,0,91,TRUE,1,92,FALSE,1,86,FALSE,1,50,TRUE,1,55,FALSE,1,85,TRUE,1,80,TRUE,1,90,TRUE,1,90,TRUE,1,71,FALSE,1,85,TRUE,0,86,FALSE,0,70,TRUE,0,86,FALSE,0,50,TRUE,1,95,FALSE,1,50,TRUE,0,71,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,100,TRUE,1,95,FALSE,1,60,TRUE,1,75,FALSE,1,50,FALSE,1,60,TRUE,0,90,FALSE,0,60,TRUE,1,60,TRUE,1,75,0.01,0.0625,0.0025,0.04,0.0625,0.0225,0.0025,0.0841,0,0.09,0.36,0.49,0.01,0.0225,0.2025,0.0064,0,0.25,0.16,0.16,0.25,0.25,0.25,0.7396,0.25,0.25,0.16,0.8281,0.0196,0.5041,0.81,0.7396,0.249071429,0.1145,0.383642857,18,56.25,22,68.75,6,75,5,62.5,5,62.5,6,75,12,75,10,62.5,74.31,65.88,71.88,75.5,84,73.62,75,-12.5,5.56,-9.12,9.38,13,9,-1.38,12.5,1,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,1,1,1,0,0,4,1,0,0,1,1,1,0,0,0,1,0,2,2,0,0,1,0.4,0,0.6,0.4,1.2,0.6,0.2,1,0.35,0.75,1.33,1,0,1,0,-1,0.33,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,0.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,1,0,-4,-1,0,0,-1,-1,-1,0,0,0,1,1,-2,-2,0,1,0,-0.8,-0.6,0.4,-0.6,-0.4,grad_prof +88,R_698vEegpho6l6RH,67 - 73,Canadian,Female,2,3,2,3,0,-2,-2,2,-2,1,-1,0,1,-1,2,-1,0,0,2,2,2,3,2,1,1,3,-3,-2,2,-1,1,3,-1,1,2,1,2,1,-1,-1,-1,1,1,5,2,3,2,2,-1,3,-2,0,1,-2,-1,3,-1,1,1,1,2,2,0,0,1,2,2,4,FALSE,1,60,TRUE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,86,FALSE,1,65,TRUE,0,100,TRUE,1,100,FALSE,1,86,TRUE,1,75,TRUE,1,100,TRUE,0,65,FALSE,1,100,TRUE,0,86,FALSE,1,86,FALSE,0,65,TRUE,1,65,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,0,90,TRUE,1,81,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0.0196,0.0196,0.1225,0.0361,0,0.0625,0.1225,0.16,0,0.8281,0.2916,0.25,1,0.4225,0.0625,0.7396,0.0196,0.4225,0.25,0.25,0.16,1,0,0.81,1,0.287471429,0.11875,0.456192857,25,78.13,20,62.5,4,50,4,50,7,87.5,5,62.5,14,87.5,6,37.5,82.5,69.38,83.88,87.12,89.62,84.81,80.19,15.63,20,19.38,33.88,-0.38,27.12,-2.69,42.69,0,0,0,2,1,1,0,0,1,0,0,1,1,2,0,0,1,1,1,1,0,0,0,1,1,0,2,1,0,2,0,1,0,2,0,1,0,1,0,0,0.6,0.4,0.8,0.8,0.4,1,0.6,0.4,0.65,0.6,2.33,2.67,0,0,-1,1,-0.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,70,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,0,1,-2,-1,1,-2,0,0,1,0,0,-1,1,0,1,1,0.2,-0.6,0.2,0.4,0.05,C_Ug +89,R_7t6d6cFSLKTLPTS,60 - 66,Canadian,Male,-1,0,2,2,0,-1,0,1,0,0,2,0,0,-2,-1,-1,-2,-2,0,-3,2,1,1,0,1,8,0,1,1,2,0,6,2,0,0,-1,0,3,0,-1,-2,0,-3,8,0,0,2,2,0,5,-2,2,2,-2,-2,0,2,-2,0,-3,0,5,0,-2,-2,0,-3,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,73,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,74,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,74,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,80,TRUE,0,59,TRUE,1,81,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.25,0,0.0676,0.0361,0,0.0729,0.25,0.25,0,0,0.25,0.04,0,0,0.25,0.25,0,0.0676,0.25,0,0,1,0,0.3481,0.25,0.129725,0.084042857,0.175407143,30,93.75,27,84.38,5,62.5,7,87.5,8,100,7,87.5,16,100,11,68.75,82.53,65.38,85.38,90.5,88.88,86.12,78.94,9.37,-1.85,2.88,-2.12,-9.5,1.38,-13.88,10.19,3,1,1,2,1,1,1,0,2,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,2,1,2,2,0,2,0,1,1,1,0,0,0,0,1.6,0.8,0.4,0.4,0.2,1.6,0.8,0.2,0.8,0.7,5.67,3.33,3,6,-2,6,2.34,20 cents,100 minutes,47 days,Male,University - Undergraduate,61,1.5,0,0,1,0,1,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,2,1,1,2,1,0,-1,-1,0,-2,0,-2,0,0,0,0,1,0,0,0,1.4,-0.8,-0.4,0.2,0.1,C_Ug +90,R_3HuGQO7ogFJUBJZ,67 - 73,American,Female,-3,-2,2,-1,-2,0,-2,3,-2,1,3,0,2,-3,3,-3,-2,-1,2,-3,-3,-2,2,-1,0,1,1,-2,3,-2,2,1,3,1,2,-3,3,1,-1,2,1,1,-3,6,-3,-2,2,0,-3,1,-1,-2,1,0,0,2,3,0,2,-3,3,2,-2,-2,-2,2,-3,6,TRUE,0,87,TRUE,1,100,FALSE,1,81,FALSE,1,50,TRUE,1,95,FALSE,1,92,TRUE,1,81,TRUE,1,96,FALSE,0,50,FALSE,0,95,FALSE,1,76,TRUE,0,97,FALSE,0,50,TRUE,0,96,FALSE,0,50,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,76,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0016,0,0,0.0361,0,0.0064,0,0.9025,0,0.16,0,0.25,0.25,0.0576,0.0025,0,0,0.25,0.25,0,0.25,0.25,0.25,0.9216,0.0361,0.25,0.25,0.7569,0.0361,1,0.5776,0.9409,0.27315,0.134214286,0.412085714,22,68.75,21,65.63,4,50,6,75,4,50,7,87.5,11,68.75,10,62.5,80.09,59.5,80.5,89.88,90.5,79.81,80.38,3.12,14.46,9.5,5.5,39.88,3,11.06,17.88,0,0,0,0,2,1,0,0,0,1,0,1,0,0,0,2,4,2,1,0,0,0,0,1,1,1,0,2,2,1,0,0,0,0,0,1,0,1,0,0,0.4,0.4,0.2,1.8,0.4,1.2,0,0.4,0.7,0.5,1,1.67,0,-1,-1,0,-0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,1.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,-1,1,0,0,-2,-2,0,0,1,0,0,0,1,4,1,1,0,0,-0.8,0.2,1.4,0.2,HS_TS +91,R_3zYM8IjnxrPy43Y,67 - 73,Canadian,Female,3,1,1,1,3,-1,1,1,-1,0,1,1,0,0,1,0,1,2,2,0,3,2,2,1,3,7,-1,0,0,1,-1,7,0,1,1,1,1,5,0,0,1,-1,1,5,3,2,1,1,3,4,0,0,1,-2,0,6,1,0,1,0,1,5,1,0,1,0,0,4,TRUE,0,85,TRUE,1,87,FALSE,1,100,FALSE,1,76,TRUE,1,65,FALSE,1,65,TRUE,1,90,TRUE,1,90,TRUE,1,73,TRUE,1,82,TRUE,0,65,TRUE,0,77,TRUE,1,92,TRUE,0,100,FALSE,0,50,FALSE,0,60,FALSE,1,50,TRUE,0,84,FALSE,1,60,FALSE,1,70,TRUE,1,74,TRUE,1,55,FALSE,1,72,TRUE,1,71,FALSE,1,70,TRUE,1,70,TRUE,0,50,FALSE,1,50,TRUE,0,73,TRUE,1,71,TRUE,1,50,TRUE,1,91,0.01,0.09,0.36,0.01,0.0081,0.1225,0.0841,0.0324,0.09,0.2025,0.0841,0.0064,0.0729,0.4225,0.1225,0.0169,0.0784,0.0576,0.25,0.09,0.0676,0.25,0.16,1,0.25,0.25,0.25,0.7225,0,0.7056,0.5329,0.5929,0.232942857,0.100064286,0.365821429,20,62.5,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,72.44,63.88,72.75,79.5,73.62,73.19,71.69,-9.38,0.56,1.38,-14.75,17,-1.38,-14.31,15.44,0,1,1,0,0,0,1,1,2,1,1,0,1,1,0,0,1,1,3,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,1,1,1,2,0,0.4,1,0.6,1.2,0.2,0.6,0.4,1,0.8,0.55,6.33,5,3,1,0,1,1.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,1,0,0,-1,0,1,1,1,1,-1,0,1,0,-1,0,0,1,1,0.2,0.4,0.2,0.2,0.25,HS_TS +92,R_3GxmlipNoWtF7t7,67 - 73,American,Female,2,1,3,-2,-3,2,-3,3,-3,2,2,2,3,0,2,2,2,2,3,2,2,1,2,-2,-3,1,2,-3,3,-2,2,1,2,3,3,3,2,1,2,1,2,3,3,1,2,0,3,0,-3,2,1,-3,3,-3,2,2,3,3,3,2,3,1,2,2,2,3,3,3,TRUE,0,95,TRUE,1,99,FALSE,1,91,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,70,FALSE,1,80,FALSE,0,100,TRUE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,100,FALSE,0,85,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0.04,0.04,0.7225,0,0.0625,0,0.25,0.0001,0.25,0.25,0.25,0,1,0.25,0.09,0.36,0.25,0.25,0.25,0.9025,0.0081,0.25,1,1,0.266989286,0.115364286,0.418614286,25,78.13,22,68.75,6,75,5,62.5,5,62.5,6,75,11,68.75,11,68.75,80.78,68,81.25,85.62,88.25,86.81,74.75,9.38,12.03,-7,18.75,23.12,13.25,18.06,6,0,0,1,0,0,0,0,0,1,0,0,1,0,3,0,0,1,0,0,1,0,1,0,2,0,1,0,0,0,0,1,1,0,2,1,0,0,0,0,1,0.2,0.2,0.8,0.4,0.6,0.2,1,0.2,0.4,0.5,1,1.67,-1,-1,0,-2,-0.67,10 cents,100 minutes,47 days,Female,High School (or equivalent),71,-0.75,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,-1,1,-2,0,-1,0,0,1,0,-1,0,0,1,-1,0,1,0,0,0,-0.4,0,-0.2,0.2,-0.1,HS_TS +93,R_7luEeVGChG2wXTP,53 - 59,Canadian,Female,1,3,3,1,1,-1,-2,2,-2,1,1,1,-1,-2,2,-1,1,1,1,-1,-1,3,3,-1,2,7,-1,-2,2,-2,1,1,2,2,1,-1,2,6,2,1,3,2,3,8,1,3,3,2,-1,3,0,-1,1,0,-1,2,2,1,-1,-3,2,4,-1,-1,1,1,1,6,TRUE,0,86,TRUE,1,86,TRUE,0,72,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,1,88,TRUE,1,100,TRUE,1,59,TRUE,1,88,FALSE,1,60,FALSE,1,89,TRUE,1,82,TRUE,0,90,TRUE,1,70,TRUE,1,84,TRUE,0,53,FALSE,1,76,FALSE,1,61,FALSE,1,89,TRUE,1,54,TRUE,1,63,FALSE,1,100,TRUE,1,68,TRUE,0,70,TRUE,1,73,TRUE,0,58,FALSE,1,69,TRUE,0,71,TRUE,1,78,FALSE,0,53,TRUE,1,96,0,0.0729,0.0256,0.0144,0.0016,0.25,0.1024,0.0144,0.0121,0.1369,0.0484,0.0324,0.1681,0.16,0.0361,0.0196,0,0.25,0.0961,0.49,0.2116,0.09,0.1521,0.81,0.2809,0.3364,0.2809,0.7396,0.5184,0.0576,0.5041,0.0121,0.207564286,0.088,0.327128571,24,75,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,73.97,62.12,73.38,79.25,81.12,76.44,71.5,0,-1.03,-12.88,-1.62,16.75,-6.38,-17.31,15.25,2,0,0,2,1,0,0,0,0,0,1,1,2,1,0,3,0,2,1,4,0,0,0,1,2,1,1,1,2,2,1,0,0,1,0,0,2,0,0,2,1,0,1,2,0.6,1.4,0.4,0.8,1,0.8,4.67,3,4,-1,2,2,1.67,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,0,0,1,-1,-1,-1,-1,-2,-2,0,1,2,0,0,3,-2,2,1,2,0.4,-1.4,0.6,1.2,0.2,C_Ug +94,R_78PcOG5RrfRfqev,67 - 73,Canadian,Female,1,-2,2,-3,3,0,2,3,0,1,2,0,3,-3,3,1,1,1,2,1,1,-3,2,-3,3,1,1,1,3,0,3,1,3,2,3,-3,3,1,0,0,1,0,0,4,2,-2,2,0,3,1,0,1,3,0,2,1,3,2,3,-3,3,0,2,0,1,1,1,2,TRUE,0,86,TRUE,1,88,TRUE,0,96,FALSE,1,57,FALSE,0,56,FALSE,1,92,TRUE,1,94,TRUE,1,93,TRUE,1,58,TRUE,1,94,FALSE,1,86,TRUE,0,92,TRUE,1,93,TRUE,0,94,TRUE,1,58,TRUE,1,96,FALSE,1,57,FALSE,1,92,TRUE,0,81,FALSE,1,92,FALSE,0,86,TRUE,1,86,TRUE,0,76,TRUE,1,80,FALSE,1,90,TRUE,1,92,FALSE,1,78,FALSE,1,89,TRUE,0,89,TRUE,1,90,TRUE,1,87,TRUE,1,96,0.0049,0.0064,0.0016,0.0036,0.0016,0.0064,0.04,0.0036,0.0064,0.0196,0.01,0.0049,0.1764,0.0196,0.3136,0.0144,0.5776,0.1849,0.0121,0.01,0.7396,0.1764,0.6561,0.8836,0.1849,0.0484,0.0169,0.7396,0.9216,0.0064,0.7921,0.8464,0.264753571,0.0985,0.431007143,24,75,23,71.88,7,87.5,4,50,6,75,6,75,14,87.5,9,56.25,84.19,74.12,80.62,91,91,84.19,84.19,3.12,12.31,-13.38,30.62,16,16,-3.31,27.94,0,1,0,0,0,1,1,0,0,2,1,2,0,0,0,1,1,0,2,1,1,0,0,3,0,0,1,0,0,1,1,2,0,0,0,1,1,0,1,0,0.2,0.8,0.6,1,0.8,0.4,0.6,0.6,0.65,0.6,1,0.67,0,0,1,2,0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,73,1,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,-1,1,0,-3,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,-0.6,0.4,0,0.4,0.05,C_Ug +95,R_5Q1aVF0TWRgy34Z,67 - 73,Both,Female,3,0,0,2,-2,-2,-2,2,-2,-1,2,0,2,-2,2,0,1,1,2,0,2,2,2,1,2,6,-2,0,2,-2,-1,6,2,1,2,0,2,4,2,2,2,1,1,5,2,2,2,3,0,7,-2,0,0,0,-2,8,2,0,-2,-3,0,9,-3,-3,-2,0,0,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,50,TRUE,1,85,FALSE,1,94,FALSE,1,85,TRUE,1,100,TRUE,0,90,FALSE,0,74,TRUE,1,100,FALSE,1,100,FALSE,1,91,FALSE,1,82,FALSE,1,100,TRUE,1,74,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,93,TRUE,1,85,TRUE,0,50,FALSE,1,98,TRUE,0,93,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.01,0.0225,0,0,0,0,0,0.0225,0,0.25,0,0,0.25,0.0036,0.25,0,0,0.2304,0.0004,0.8649,0.0676,0.5476,0.0324,0.81,0,0.25,0.0625,0,0,0.0081,0.8649,0.0225,0.16205,0.071892857,0.252207143,25,78.13,27,84.38,6,75,7,87.5,6,75,8,100,15,93.75,12,75,86.28,72.12,89.62,86.75,96.62,83.31,89.25,-6.25,1.9,-2.88,2.12,11.75,-3.38,-10.44,14.25,1,2,2,1,4,0,2,0,0,0,0,1,0,2,0,2,1,1,1,1,1,2,2,1,2,0,2,2,2,1,0,0,4,1,2,3,4,3,2,0,2,0.4,0.6,1.2,1.6,1.4,1.4,2.4,1.05,1.7,5.33,8,-1,-2,-5,-5,-2.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,70,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,2,0,0,-2,-2,-1,0,1,-4,1,-2,-1,-3,-2,-1,1,0.4,-1,-0.8,-1.2,-0.65,C_Ug +96,R_5P1hksMwlBeyIeH,60 - 66,Canadian,Male,2,3,2,1,0,-3,0,1,0,1,-1,-3,3,-2,2,-3,-2,-3,-3,-3,2,3,2,1,0,0,-3,0,1,0,2,0,-1,-3,3,-3,2,0,-3,-3,-3,-3,-3,1,1,3,2,1,0,0,-3,0,1,0,1,1,-1,-3,3,-3,2,0,-3,-3,-3,-3,-3,0,FALSE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,0,75,TRUE,0,85,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,95,TRUE,1,100,TRUE,0,85,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,80,TRUE,1,100,0,0,0,0,0,0,0.04,0,0,0,1,0,0.0025,0.5625,0.0025,0,0,0.25,0,0.0025,0,0.25,0.25,0,0,0.7225,0.04,0.0025,0,0,1,0.7225,0.173125,0.132678571,0.213571429,31,96.88,26,81.25,5,62.5,7,87.5,8,100,6,75,15,93.75,11,68.75,91.72,73.12,99.38,98.75,95.62,93.75,89.69,15.63,10.47,10.62,11.88,-1.25,20.62,0,20.94,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0.2,0.2,0.2,0.2,0,0.2,0.2,0.15,0.15,0,0.33,0,-1,0,1,-0.33,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,63,1.25,1,1,0,0,0,1,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,-0.2,0.2,0,0,0,C_Ug +97,R_5GlEaRuPX31tPTC,67 - 73,American,Male,2,2,-2,1,1,1,-2,3,-3,3,2,-1,3,1,3,1,1,2,2,-2,2,2,-2,0,1,4,1,-2,2,-2,2,6,2,-1,2,1,2,5,1,1,1,1,-2,5,2,2,-2,2,-1,4,1,-2,1,-2,1,3,2,0,3,0,3,3,1,2,2,2,-2,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0.107142857,0,0.214285714,31,96.88,29,90.63,7,87.5,7,87.5,8,100,7,87.5,15,93.75,14,87.5,100,100,100,100,100,100,100,6.25,9.37,12.5,12.5,0,12.5,6.25,12.5,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,2,0,0,2,1,2,0,1,0,1,0,0,1,0,0,0,0.2,0.6,0.4,0.4,0.6,1,0.4,0.2,0.4,0.55,5,3.33,0,3,2,-1,1.67,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),72,1.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,-2,0,0,-1,0,-1,0,-1,1,-1,1,0,-1,1,1,0,-0.4,-0.4,0,0.2,-0.15,grad_prof +98,R_3ez3PwUo6gXjOzn,67 - 73,Canadian,Female,2,2,2,2,2,1,1,1,1,0,0,-1,1,-2,3,1,2,2,1,0,2,2,2,2,2,2,1,1,1,2,-1,1,-1,-1,2,-2,3,1,0,0,0,1,1,1,2,2,2,2,1,1,0,-1,1,0,-1,1,-1,-1,2,-2,3,2,1,2,1,1,1,1,FALSE,1,100,TRUE,1,87,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,85,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,50,TRUE,0,90,TRUE,0,76,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,1,0,0,0.0225,0.0196,0,0,0.0169,0,0.25,0,0,0,0.04,0.5776,0,0.25,0,1,0,0,0.81,0,1,0.187021429,0.111357143,0.262685714,26,81.25,24,75,5,62.5,6,75,7,87.5,6,75,15,93.75,9,56.25,92.31,84.88,85.62,98.75,100,96.12,88.5,6.25,17.31,22.38,10.62,11.25,25,2.37,32.25,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,2,2,0,1,0,0,0,0,1,1,2,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0.4,0.4,1.2,0.2,1,0.4,0.4,0.5,0.5,1.33,1.33,1,0,-1,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,72,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,0,-1,-1,-2,0,0,0,0,0,0,0,0,1,2,1,0,0,-0.2,-0.6,0,0.8,0,C_Ug +99,R_76hSlL9MwQGDYBQ,67 - 73,American,Female,3,2,2,3,2,0,0,2,3,0,3,2,2,-1,2,-2,-1,-1,-1,-3,2,2,2,2,2,5,0,-1,2,2,1,6,3,2,1,-3,2,6,-3,-2,0,0,-3,5,2,2,2,2,2,7,-1,-1,2,2,-1,5,3,2,2,-3,2,6,-3,-3,-3,-3,-3,6,TRUE,0,61,TRUE,1,53,FALSE,1,55,TRUE,0,55,FALSE,0,53,FALSE,1,55,TRUE,1,73,TRUE,1,62,FALSE,0,51,TRUE,1,88,TRUE,0,51,TRUE,0,73,TRUE,1,63,TRUE,0,76,FALSE,0,55,TRUE,1,84,FALSE,1,51,TRUE,0,56,FALSE,1,53,FALSE,1,51,FALSE,0,52,TRUE,1,84,TRUE,0,55,TRUE,1,72,FALSE,1,55,TRUE,1,72,TRUE,0,63,FALSE,1,57,TRUE,0,72,TRUE,1,100,TRUE,1,72,TRUE,1,100,0.1444,0.0784,0.0256,0.0729,0,0.2025,0.0784,0.0144,0.2401,0.0256,0,0.1369,0.2601,0.2601,0.2809,0.2209,0.3025,0.3025,0.1849,0.2025,0.2704,0.3025,0.2209,0.5776,0.2401,0.3969,0.0784,0.3721,0.2025,0.3136,0.5184,0.5329,0.240664286,0.166064286,0.315264286,18,56.25,19,59.38,3,37.5,4,50,5,62.5,7,87.5,12,75,7,43.75,64.78,56.62,62.62,70.62,69.25,70.88,58.69,-3.13,5.4,19.12,12.62,8.12,-18.25,-4.12,14.94,1,0,0,1,0,0,1,0,1,1,0,0,1,2,0,1,1,1,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,2,0,1,2,2,2,0,0.4,0.6,0.6,0.8,0.4,0.8,0.4,1.4,0.6,0.75,5.67,6,-2,1,0,-1,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,-1,-1,-1,0,0,-0.2,0.2,-0.6,-0.15,HS_TS +100,R_7MXrK9TJaqNt8nC,60 - 66,American,Female,1,2,2,0,0,1,-1,2,-2,1,1,-3,1,0,3,2,2,2,2,2,2,2,2,0,1,2,1,-2,2,-2,1,2,2,-2,1,1,2,3,2,2,2,2,2,3,2,2,2,0,0,2,1,-2,2,-2,2,2,2,-2,2,0,2,2,2,2,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,65,TRUE,0,64,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,93,TRUE,0,100,FALSE,0,86,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,82,TRUE,0,92,TRUE,1,92,TRUE,1,95,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0.0064,0.0049,0.0196,0,0,0,0,0.4096,0.0324,0,0,0.7396,0,1,0,0,0.0025,0,0.4225,1,0.8464,0,0.195853571,0.102892857,0.288814286,26,81.25,25,78.13,6,75,7,87.5,5,62.5,7,87.5,14,87.5,11,68.75,95.47,91.38,98.12,100,92.38,97,93.94,3.12,17.34,16.38,10.62,37.5,4.88,9.5,25.19,1,0,0,0,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,1,0,0,0,0,0,0.4,0.2,0.8,0,0.2,0.4,0.8,0,0.35,0.35,2.33,2,0,0,1,1,0.33,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,64,0.875,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,1,0,0,0,0,-1,0,0,-1,1,0,0,0,0,0,0,0.2,-0.2,0,0,0,C_Ug +101,R_57D1Mby93xoTCpW,67 - 73,Canadian,Female,2,3,3,0,3,-1,-3,3,1,1,3,3,3,0,3,3,3,3,2,-3,3,3,3,2,3,3,-1,-3,3,2,1,3,3,1,3,1,3,3,1,0,0,1,1,8,3,3,3,3,0,3,-1,-3,3,-2,0,2,3,1,3,-2,3,2,2,0,3,3,-3,7,FALSE,1,60,TRUE,1,100,FALSE,1,60,FALSE,1,55,FALSE,0,60,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,55,TRUE,0,70,FALSE,1,55,TRUE,0,100,FALSE,0,100,FALSE,0,55,TRUE,0,55,TRUE,1,55,TRUE,0,100,TRUE,1,55,FALSE,1,55,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0.2025,0,0,0,0.2025,0.2025,0,1,0.3025,0,0,0.1225,1,0.36,0,0.3025,0.2025,1,1,1,0.3025,0.2025,1,0.2025,0.2025,0.3025,0.16,0.16,0.49,1,1,0.418482143,0.263928571,0.573035714,15,46.88,18,56.25,5,62.5,4,50,4,50,5,62.5,11,68.75,7,43.75,78.75,67.5,78.12,80,89.38,81.25,76.25,-9.37,22.5,5,28.12,30,26.88,12.5,32.5,1,0,0,2,0,0,0,0,1,0,0,2,0,1,0,2,3,3,1,4,1,0,0,3,3,0,0,0,3,1,0,2,0,2,0,1,3,0,1,0,0.6,0.2,0.6,2.6,1.4,0.8,0.8,1,1,1,3,2.33,0,1,1,1,0.67,10 cents,5 minutes,24 days,Female,High School (or equivalent),72,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,-3,0,0,0,-2,-1,0,0,0,-1,0,1,0,3,0,4,-0.8,-0.6,-0.2,1.6,0,HS_TS +102,R_1oyJxsrxJj0tKUF,67 - 73,Canadian,Male,1,0,2,2,2,-2,1,3,-2,0,2,0,3,-1,3,0,1,1,1,-1,1,0,2,2,2,9,-2,1,3,-2,1,9,2,0,3,-2,3,9,0,-1,1,1,-2,7,1,1,3,3,-1,6,-3,1,2,-2,-2,7,2,0,3,-3,3,8,0,0,0,1,-1,5,TRUE,0,65,FALSE,0,50,TRUE,0,84,FALSE,1,50,TRUE,1,50,FALSE,1,54,TRUE,1,100,TRUE,1,100,TRUE,1,82,TRUE,1,66,TRUE,0,71,TRUE,0,99,TRUE,1,100,TRUE,0,91,FALSE,0,55,TRUE,1,100,FALSE,1,53,TRUE,0,92,TRUE,0,64,FALSE,1,100,TRUE,1,75,TRUE,1,77,TRUE,0,50,TRUE,1,98,TRUE,0,60,TRUE,1,93,FALSE,1,50,FALSE,1,56,FALSE,1,53,TRUE,1,80,TRUE,1,70,TRUE,1,96,0,0.0049,0,0,0.0016,0.2116,0.0004,0.1156,0,0.0529,0.04,0,0.0324,0.5041,0.25,0.25,0.25,0.25,0.1936,0.36,0.0625,0.3025,0.4096,0.8281,0.2209,0.25,0.09,0.4225,0.7056,0.8464,0.2209,0.9801,0.280403571,0.1399,0.420907143,20,62.5,21,65.63,4,50,7,87.5,4,50,6,75,14,87.5,7,43.75,74.5,61.5,66.38,80.5,89.62,80.75,68.25,-3.13,8.87,11.5,-21.12,30.5,14.62,-6.75,24.5,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,2,0,0,1,0,1,1,1,3,1,0,1,0,2,0,0,0,2,0,0,1,1,0,0,0,0.2,0.2,0.6,1.2,0.8,0.4,0.4,0.25,0.7,9,7,3,2,1,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,72,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,-1,-1,-1,-3,-1,0,-1,0,-1,0,0,0,-1,0,0,1,-1,0,1,-1.2,-0.6,-0.2,0.2,-0.45,C_Ug +103,R_3cBpKskAvNb0wUN,67 - 73,American,Male,3,1,2,2,2,-2,0,3,1,-1,1,3,1,1,-2,2,1,2,2,1,3,2,2,2,1,7,1,1,-1,0,-1,6,1,-1,1,0,1,6,0,1,2,2,1,5,3,2,2,3,1,6,-3,1,2,1,-1,6,0,3,2,1,-2,3,1,2,0,0,1,8,FALSE,1,92,TRUE,1,100,TRUE,0,86,FALSE,1,87,FALSE,0,91,FALSE,1,97,TRUE,1,91,TRUE,1,100,TRUE,1,59,FALSE,0,100,FALSE,1,86,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,71,FALSE,1,92,TRUE,0,87,FALSE,1,100,TRUE,1,92,TRUE,1,76,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,69,FALSE,1,100,FALSE,1,82,TRUE,1,100,TRUE,1,65,TRUE,1,100,0,0,0,0.0081,0,0.0009,0,1,0,0.0576,0,1,0.1681,0.0196,0.8281,0,0,0.0169,0,1,0.0064,0.0576,0.7569,1,0.0841,0.4761,0.1225,0.0064,0.7396,0.0064,0.0324,0,0.263557143,0.2208,0.306314286,24,75,24,75,6,75,6,75,5,62.5,7,87.5,13,81.25,11,68.75,90.59,78.62,91.62,93.88,98.25,90.62,90.56,0,15.59,3.62,16.62,31.38,10.75,9.37,21.81,0,1,0,0,1,3,1,4,1,0,0,4,0,1,3,2,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,0,1,0,0,1,1,2,2,0,0.4,1.8,1.6,0.4,0.6,0.6,0.4,1.2,1.05,0.7,6.33,5,1,0,3,-3,1.33,10 cents,25 minutes,24 days,Male,University - Graduate (Masters),67,0.625,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,-1,0,2,0,3,1,0,-1,4,-1,1,3,1,-1,-2,-2,0,-0.2,1.2,1.2,-0.8,0.35,grad_prof +104,R_35WTDTUYDDCHJhT,67 - 73,American,Male,3,3,0,3,2,2,1,3,-3,1,3,2,3,1,3,1,1,1,1,1,3,3,-2,3,2,2,2,1,3,-3,2,2,3,3,3,2,3,2,1,1,1,1,1,2,3,3,-2,3,2,1,1,1,3,-3,1,2,3,3,3,1,3,1,0,0,1,1,1,2,FALSE,1,64,TRUE,1,100,FALSE,1,100,FALSE,1,53,TRUE,1,52,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,66,FALSE,1,100,TRUE,1,62,TRUE,1,94,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,61,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0036,0,0,0,0,0.2304,0,0,0.2209,0,0,0.1444,0.2304,0.1156,0,0,0.1521,0,0.1296,0,0,1,0,0.079535714,0.032492857,0.126578571,29,90.63,31,96.88,8,100,7,87.5,8,100,8,100,16,100,15,93.75,90.75,79,89.25,94.75,100,91.25,90.25,-6.25,-6.13,-21,1.75,-5.25,0,-8.75,-3.5,0,0,2,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0.4,0.2,0.4,0,0.4,0.2,0.2,0.4,0.25,0.3,2,1.33,1,0,1,0,0.67,10 cents,100 minutes,24 days,Male,Trade School (non-military),71,0.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,-1,0,0,0,1,0,0,0,1,0,-1,-1,0,0,0,0,0,0.2,-0.4,-0.05,HS_TS +105,R_6ZaZJqHovVAvk1r,60 - 66,Canadian,Male,2,1,2,-2,3,-2,-3,3,-2,1,3,3,2,0,1,2,2,3,2,1,0,3,2,-3,2,2,0,-2,3,-3,1,5,3,3,2,0,2,4,2,3,2,1,2,3,2,-1,2,2,0,3,-1,-2,2,-1,0,3,2,3,0,2,1,4,2,-1,2,3,2,4,TRUE,0,100,TRUE,1,86,TRUE,0,86,FALSE,1,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,96,FALSE,0,50,TRUE,1,92,FALSE,1,63,TRUE,0,81,FALSE,0,80,TRUE,0,100,FALSE,0,66,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,59,FALSE,1,100,FALSE,0,59,TRUE,1,91,FALSE,1,92,TRUE,1,60,FALSE,1,100,TRUE,1,85,FALSE,1,60,TRUE,0,88,FALSE,1,70,TRUE,1,87,TRUE,1,94,TRUE,1,100,0.0016,0.0225,0,0,0,0,0.16,0.0064,0,0.0081,0.0169,0.64,0.25,0.1369,0.0004,0.0196,0.0064,0.25,0.7744,0,0.3481,0.4356,0.1681,1,0.25,0.16,0.0036,1,0.7396,1,0.09,0.6561,0.290007143,0.106764286,0.47325,23,71.88,21,65.63,6,75,5,62.5,5,62.5,5,62.5,12,75,9,56.25,82.59,66,81.12,96,87.25,84,81.19,6.25,16.96,-9,18.62,33.5,24.75,9,24.94,2,2,0,1,1,2,1,0,1,0,0,0,0,0,1,0,1,1,1,1,0,2,0,4,3,1,1,1,1,1,1,0,2,2,0,0,3,1,1,1,1.2,0.8,0.2,0.8,1.8,1,1,1.2,0.75,1.25,3.67,3.33,-1,2,0,-1,0.34,10 cents,5 minutes,24 days,Male,University - Undergraduate,66,0.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,2,0,0,-3,-2,1,0,-1,0,-1,-1,0,-2,-2,1,0,-2,0,0,0,-0.6,-0.2,-0.8,-0.4,-0.5,C_Ug +106,R_77lKBxK1DWYlmSQ,60 - 66,American,Female,3,2,2,-1,3,-1,-2,2,0,-1,3,2,2,-2,2,-3,0,0,1,-2,3,3,2,-2,3,1,-2,-2,1,0,-1,4,3,2,2,-2,2,1,-2,-1,-1,-1,-1,4,2,-1,3,2,-1,6,-2,-2,1,-1,-1,1,3,3,2,-2,2,3,-2,-2,-1,0,-2,3,TRUE,0,56,TRUE,1,100,FALSE,1,99,TRUE,0,52,TRUE,1,69,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,60,TRUE,1,71,FALSE,1,99,TRUE,0,100,TRUE,1,95,TRUE,0,96,FALSE,0,51,TRUE,1,99,FALSE,1,63,FALSE,1,100,TRUE,0,60,FALSE,1,100,TRUE,1,55,TRUE,1,92,FALSE,1,89,TRUE,1,100,FALSE,1,89,TRUE,1,96,TRUE,0,58,FALSE,1,99,TRUE,0,96,TRUE,1,93,TRUE,1,51,TRUE,1,100,0.0001,0.0016,0.0001,0,0,0,0,0.0841,0,0.0064,0.0049,0.0025,0.16,0.0001,0.0961,0,0.0121,0.2704,0.0001,0.0121,0.2025,0.2601,0.36,0.9216,0.1369,0.3364,0.2401,0.3136,0.0001,0,0.9216,1,0.190775,0.045471429,0.336078571,18,56.25,24,75,4,50,7,87.5,6,75,7,87.5,15,93.75,9,56.25,83.97,66.38,83.38,87.5,98.62,83.19,84.75,-18.75,8.97,16.38,-4.12,12.5,11.12,-10.56,28.5,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,1,1,2,1,1,3,1,3,4,1,0,1,1,0,0,1,0,0,0,1,2,1,1,0,0.4,0.4,0,1.2,2.4,0.6,0.2,1,0.5,1.05,2,3.33,-5,3,-2,1,-1.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,-1,-2,-1,-2,-4,0,0,0,-1,0,0,-1,0,0,0,0,-1,0,1,1,-2,-0.2,-0.2,0.2,-0.55,HS_TS +107,R_3zM72bExBqJJK2n,60 - 66,American,Male,3,2,3,3,3,2,-2,2,-1,2,1,2,3,0,3,2,2,3,3,2,3,2,3,0,3,8,2,-2,2,-2,3,9,1,2,2,0,3,9,1,1,2,1,1,8,3,2,3,3,2,7,1,0,2,-1,1,9,1,3,3,0,3,9,1,2,2,2,2,9,TRUE,0,72,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,77,FALSE,1,100,TRUE,0,100,TRUE,1,98,TRUE,0,93,TRUE,1,68,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,82,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,98,TRUE,1,100,0,0,0,0,0,0,0.0009,0.0529,0,0,0,0.0004,0.01,0,0,0,0,0.1849,0,0,0,0.1024,0.6724,0.8649,0,0.7744,0.0004,0.5184,0,0,0.8649,1,0.180246429,0.017792857,0.3427,28,87.5,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,94.16,85.38,98.88,92.75,99.62,95.5,92.81,6.25,12.91,10.38,11.38,17.75,12.12,-4.5,30.31,0,0,0,3,0,0,0,0,1,1,0,0,1,0,0,1,1,1,2,1,0,0,0,0,1,1,2,0,0,1,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.2,1.2,0.2,0.8,0.2,0.6,0.6,0.45,8.67,8.33,1,0,0,-1,0.34,10 cents,5 minutes,24 days,Male,High School (or equivalent),66,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,3,-1,-1,-2,0,1,0,0,-1,1,0,0,0,1,0,1,1,0.4,-0.4,0,0.6,0.15,HS_TS +108,R_6S66IPNS1Xsnw0d,67 - 73,Canadian,Male,1,1,1,-1,-1,-1,1,-1,0,-1,2,-1,2,-1,2,1,1,1,2,-1,1,2,1,-2,1,4,0,-1,1,-1,1,4,2,1,2,1,2,2,-1,-1,0,1,-1,6,1,1,1,0,-2,6,-2,2,-2,1,-2,6,2,-1,1,-2,2,3,-1,0,-1,1,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,76,FALSE,1,100,TRUE,1,78,TRUE,1,100,TRUE,1,76,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,55,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,72,FALSE,1,50,FALSE,1,64,FALSE,0,55,TRUE,1,66,TRUE,1,100,0,0,0,0.0484,0,0,0,0,0,0.2025,0.3025,0,0.0576,0.0625,0.0576,0,0,0.25,0.25,0,0,0.25,0.25,0,0,0.5184,0.1156,0,0,0,0.1296,0,0.087367857,0.066621429,0.108114286,24,75,29,90.63,6,75,8,100,8,100,7,87.5,15,93.75,14,87.5,84.91,67.38,92.5,91.62,88.12,84.75,85.06,-15.63,-5.72,-7.62,-7.5,-8.38,0.62,-9,-2.44,0,1,0,1,2,1,2,2,1,2,0,2,0,2,0,2,2,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,0,2,1,2,1,0,0.8,1.6,0.8,1.2,0.4,1,0.4,1.2,1.1,0.75,3.33,5,-2,-2,-1,1,-1.67,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),69,1.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,1,0,0,1,0,1,1,0,1,0,2,-1,1,0,0,1,-1,0,0,0.4,0.6,0.4,0,0.35,grad_prof +109,R_7d3QuMhkCxFlQ42,60 - 66,Canadian,Female,2,1,1,-1,2,-1,1,0,2,-1,2,-2,2,1,3,1,0,0,2,0,1,1,0,-1,2,1,-1,0,0,2,-1,1,2,-1,1,1,3,1,0,0,0,1,0,2,1,1,1,1,0,2,-1,1,0,1,0,3,2,-1,2,1,3,2,0,0,1,1,0,2,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,0,59,TRUE,1,100,FALSE,1,82,TRUE,1,65,TRUE,1,73,TRUE,1,62,TRUE,1,100,FALSE,1,61,FALSE,1,94,TRUE,1,94,TRUE,0,92,FALSE,0,62,TRUE,1,99,FALSE,1,95,TRUE,0,97,FALSE,1,62,FALSE,1,71,TRUE,1,100,TRUE,1,98,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,92,TRUE,0,100,TRUE,1,91,FALSE,0,50,TRUE,1,100,0.0729,0,0.0001,0.1225,0,0.0324,0,0,0.0841,0.0004,0.0081,0.0036,0.1444,0.1521,0,0,0.01,0.3481,0.0064,0,0,0.3844,0.1444,0.8464,0.0025,0,0.25,0.01,0,0.9409,1,0.0036,0.156135714,0.055942857,0.256328571,26,81.25,26,81.25,5,62.5,7,87.5,6,75,8,100,14,87.5,12,75,86.84,69.5,95.12,92.75,90,87.12,86.56,0,5.59,7,7.62,17.75,-10,-0.38,11.56,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,0,0,2,2,0,0,0,1,1,0,1,0,0,0,1,0,1,1,0,0.4,0.2,0.4,0.4,1,0.4,0.2,0.6,0.35,0.55,1,2.33,-1,-2,-1,0,-1.33,10 cents,100 minutes,47 days,Female,University - Undergraduate,64,1.25,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,1,-2,-2,0,1,0,-1,-1,0,0,1,0,0,0,0,-1,0,0,-0.6,-0.2,0.2,-0.2,-0.2,C_Ug +110,R_5purQVlYG87drpx,39 - 45,Canadian,Female,1,2,2,2,3,-2,-1,0,0,1,2,0,2,1,3,0,1,1,1,-1,0,2,2,1,3,2,-1,0,1,1,1,3,2,0,2,1,3,3,0,-1,1,1,-1,6,1,2,2,2,3,2,0,-1,1,0,2,3,2,1,2,0,3,3,2,1,2,2,-1,3,TRUE,0,90,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,70,TRUE,1,90,TRUE,1,95,TRUE,1,50,TRUE,1,95,FALSE,1,65,TRUE,0,90,TRUE,1,80,TRUE,0,50,TRUE,1,50,TRUE,1,85,TRUE,0,50,TRUE,0,100,TRUE,0,70,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,95,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.0025,0.0625,0.0225,0.01,0,0.09,0.25,0.0025,0.25,0.25,0.01,0.04,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.0025,1,0.25,0.49,0.25,0.25,0.25,0.25,0.81,1,1,0.25,0.81,0.325982143,0.161785714,0.490178571,16,50,17,53.13,5,62.5,4,50,4,50,4,50,12,75,5,31.25,70,54.38,68.75,80.62,76.25,72.5,67.5,-3.13,16.87,-8.12,18.75,30.62,26.25,-2.5,36.25,1,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,1,0,1,0,1,0,1,0,2,0,1,1,0,0.4,0.8,0,0.4,0,0.8,0.4,0.8,0.4,0.5,2.67,2.67,0,0,0,3,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),42,1.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,0,0,1,0,-1,1,0,1,-1,0,-1,0,-1,0,-2,2,-1,-1,0,0.4,0,-0.4,-0.4,-0.1,HS_TS +111,R_6O7c3GMsV8YPQkI,67 - 73,Canadian,Male,-1,1,2,0,-2,-2,-1,3,-1,-1,2,-1,3,1,2,0,0,2,2,0,-2,0,2,0,-2,2,-2,-2,3,-1,-2,2,2,-2,3,2,2,1,-1,0,1,0,0,3,-1,1,3,1,-3,1,-2,-2,3,-2,-2,1,2,0,3,1,2,1,0,0,1,1,1,1,FALSE,1,100,TRUE,1,75,FALSE,1,55,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,50,TRUE,0,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.25,0.25,0.16,0,0.0625,0,0.2025,0.25,0,0,0.36,0.36,1,0,1,1,0,0.2025,1,0,0,0.217767857,0.066071429,0.369464286,26,81.25,26,81.25,4,50,8,100,6,75,8,100,14,87.5,12,75,87.97,70,93.75,100,88.12,89.69,86.25,0,6.72,20,-6.25,25,-11.88,2.19,11.25,1,1,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,2,0,0,0,1,1,1,0,1,0,1,1,0,1,0,0,0,0,0,1,1,1,0.4,0.4,0.4,0.8,0.6,0.6,0.2,0.6,0.5,0.5,1.67,1,1,1,0,2,0.67,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),70,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,01DIR,1,1,-1,-1,-1,0,0,0,-1,0,0,0,0,1,0,1,0,0,1,-1,-0.2,-0.2,0.2,0.2,0,grad_prof +112,R_3paIdAavet2XfnF,46 - 52,American,Female,3,3,2,2,3,2,-1,2,-2,2,2,0,2,1,3,2,2,2,2,1,3,3,2,2,3,5,2,-2,2,-2,1,3,2,0,3,1,3,3,1,1,2,-1,1,8,3,3,3,3,3,2,2,-3,2,-2,3,1,2,0,2,-2,3,2,3,3,3,3,2,2,FALSE,1,71,TRUE,1,100,FALSE,1,100,TRUE,0,69,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,81,FALSE,0,100,FALSE,1,67,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,74,FALSE,1,77,TRUE,0,71,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,67,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,62,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,1,0,0,0,0,0.0361,0.1089,0,0,0.4489,0.4761,0,0,0.0841,0.0841,0.5041,0,0.5476,0.3844,0,0.0841,0,0.0529,1,1,0.207546429,0.147857143,0.267235714,26,81.25,23,71.88,5,62.5,5,62.5,6,75,7,87.5,14,87.5,9,56.25,90.03,77.62,89,93.5,100,95.19,84.88,9.37,18.15,15.12,26.5,18.5,12.5,7.69,28.63,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,3,0,0,0,1,1,0,0,2,0,0,1,0,0,0,3,0,1,1,1,1,1,0,0.4,0.2,1,0.4,0.6,0.6,1,0.4,0.65,3.67,1.67,3,2,1,6,2,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,48,1.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,-1,-1,0,0,-1,0,0,0,0,0,1,-3,0,0,0,-1,2,-1,-0.4,-0.2,-0.4,0,-0.25,C_Ug +113,R_7LbZA9yEiDUHBsw,39 - 45,Canadian,Female,2,3,3,2,2,2,-1,3,-2,-2,3,3,3,-3,3,2,2,1,1,2,3,3,3,3,3,5,3,-3,3,-3,0,6,3,3,3,-3,3,5,2,1,0,1,3,6,3,3,3,3,3,4,3,-3,3,-2,3,4,3,3,3,-3,3,2,1,1,2,2,2,2,FALSE,1,50,TRUE,1,50,TRUE,0,57,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,86,TRUE,1,50,TRUE,1,50,TRUE,1,61,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,80,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,84,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.0256,0.25,0.0196,0,0,0.25,0.1521,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.64,0.25,1,0.24525,0.171578571,0.318921429,16,50,23,71.88,6,75,7,87.5,7,87.5,3,37.5,13,81.25,10,62.5,63.06,50,68.75,70.12,63.38,61.31,64.81,-21.88,-8.82,-25,-18.75,-17.38,25.88,-19.94,2.31,1,0,0,1,1,1,2,0,1,2,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,2,0,0,5,0,0,0,0,0,1,1,1,1,0,0.6,1.2,0,0.6,0.6,1.6,0,0.8,0.6,0.75,5.33,3.33,1,2,3,4,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),40,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,1,-3,0,0,0,0,0,-1,0,0,-1,1,0,-0.4,0,-0.2,-0.15,HS_TS +114,R_3rqsHRxXmF3A9ah,60 - 66,Canadian,Female,2,2,2,2,2,-3,-1,1,2,0,1,2,3,-2,2,-1,-1,-1,1,-1,2,2,2,2,2,0,-2,-1,1,2,0,3,1,2,2,-1,2,1,-1,-1,-1,0,-1,2,2,2,2,2,2,0,-2,0,2,3,-1,1,1,2,2,-2,2,0,-2,-2,-2,-1,-2,1,TRUE,0,70,TRUE,1,62,FALSE,1,100,TRUE,0,50,TRUE,1,83,TRUE,0,73,TRUE,1,93,TRUE,1,94,TRUE,1,66,TRUE,1,88,TRUE,0,66,TRUE,0,84,TRUE,1,58,TRUE,0,91,TRUE,1,54,TRUE,1,91,FALSE,1,50,TRUE,0,81,TRUE,0,63,FALSE,1,50,FALSE,0,50,TRUE,1,80,FALSE,1,64,TRUE,1,73,TRUE,0,55,TRUE,1,72,FALSE,1,50,FALSE,1,50,TRUE,0,54,TRUE,1,65,FALSE,0,50,TRUE,1,100,0.0036,0.0784,0.0081,0.0049,0,0.5329,0.0729,0.0144,0.25,0.04,0.1225,0.1764,0.1156,0.4356,0.0289,0.1444,0.1296,0.25,0.25,0.3025,0.25,0.2116,0.3969,0.8281,0.25,0.25,0.25,0.49,0,0.6561,0.2916,0.7056,0.265914286,0.165228571,0.3666,16,50,20,62.5,4,50,5,62.5,4,50,7,87.5,14,87.5,6,37.5,69.69,57.62,66.5,78.75,75.88,73.69,65.69,-12.5,7.19,7.62,4,28.75,-11.62,-13.81,28.19,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,1,0,0,1,1,1,2,1,0,0.2,0.4,0.2,0,1,0.2,1.2,0.2,0.6,1.33,0.33,0,2,1,1,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,-1,-1,-1,-1,0,0,0,1,0,-1,-1,-1,-1,-1,0,-0.8,0.2,-1,-0.4,HS_TS +115,R_77kGdbqP662k2Ou,53 - 59,Canadian,Female,3,3,1,-2,0,-2,-2,2,-2,-1,3,3,3,0,3,1,3,1,3,-1,3,3,1,-2,1,0,-3,-3,3,-3,-2,2,3,3,3,-2,3,0,1,3,3,3,-1,0,3,3,1,-2,0,0,-3,-3,3,-2,-3,1,3,3,3,-3,3,0,-1,0,1,2,-1,4,FALSE,1,100,FALSE,0,100,TRUE,0,92,FALSE,1,50,FALSE,0,50,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,85,FALSE,1,50,FALSE,1,91,FALSE,0,65,TRUE,0,76,FALSE,0,50,TRUE,1,100,FALSE,1,60,FALSE,1,92,TRUE,0,77,FALSE,1,83,TRUE,1,54,TRUE,1,92,FALSE,1,94,TRUE,1,50,TRUE,0,80,TRUE,1,75,FALSE,1,57,FALSE,1,94,TRUE,0,50,TRUE,1,92,FALSE,0,50,TRUE,1,73,0,0.0625,0,0,0.0729,0.0016,0.25,0.7225,0.0289,0.0064,0.0064,0.4225,0.25,0.25,0.25,1,0.0036,0.25,0.0036,0.64,0.2116,0.25,0.5929,0.5776,0.16,0.1849,0.25,0,0.8464,0.0064,0.25,0.0081,0.267725,0.251057143,0.284392857,22,68.75,21,65.63,4,50,5,62.5,5,62.5,7,87.5,10,62.5,11,68.75,75.88,60.5,67.75,87.5,87.75,74.12,77.62,3.12,10.25,10.5,5.25,25,0.25,11.62,8.87,0,0,0,0,1,1,1,1,1,1,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,1,1,1,0,2,0,0,0,3,0,2,3,0,1,0,0.2,1,0.4,0.4,0,1,0.6,1.2,0.5,0.7,0.67,0.33,0,1,0,-4,0.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,54,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,1,0,0,0,1,-1,0,0,0,-1,0,-2,-3,2,-1,0,0.2,0,-0.2,-0.8,-0.2,C_Ug +116,R_32l0Zm7J87O1e4G,60 - 66,Canadian,Female,1,1,1,1,2,0,3,3,3,2,2,3,3,1,3,-3,-2,-3,-3,-1,2,1,-1,2,3,7,2,-1,3,0,3,10,3,3,2,3,3,4,-2,1,1,0,-2,8,2,1,2,3,-1,3,-2,0,0,1,0,5,1,2,0,-3,3,8,-3,-3,-3,-3,-3,1,TRUE,0,54,TRUE,1,53,FALSE,1,70,TRUE,0,54,FALSE,0,53,FALSE,1,54,TRUE,1,100,TRUE,1,99,TRUE,1,53,TRUE,1,99,FALSE,1,58,TRUE,0,97,TRUE,1,69,TRUE,0,96,TRUE,1,91,TRUE,1,96,TRUE,0,55,TRUE,0,100,FALSE,1,92,FALSE,1,56,TRUE,1,80,TRUE,1,51,TRUE,0,56,TRUE,1,97,TRUE,0,95,TRUE,1,80,TRUE,0,53,TRUE,0,67,FALSE,1,52,TRUE,1,58,FALSE,0,50,TRUE,1,53,0.0001,0.04,0.0016,0,0.2209,0.2116,0.0009,0.0001,0.1936,0.2401,0.1764,0.0961,0.2209,0.1764,0.2809,0.2209,0.3136,0.2916,0.4489,0.9025,0.04,0.0081,0.0064,0.9216,0.3025,0.2809,0.25,0.2916,0.09,1,0.2304,0.9409,0.298492857,0.188857143,0.408128571,12,37.5,20,62.5,5,62.5,5,62.5,4,50,6,75,14,87.5,6,37.5,71.59,63,59,84.38,80,73.88,69.31,-25,9.09,0.5,-3.5,34.38,5,-13.62,31.81,1,0,2,1,1,2,4,0,3,1,1,0,1,2,0,1,3,4,3,1,1,0,1,2,3,2,3,3,2,2,1,1,3,4,0,0,1,0,0,2,1,2,0.8,2.4,1.4,2.4,1.8,0.6,1.55,1.55,7,5.33,4,5,-4,7,1.67,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,66,0.75,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,1,-1,-2,0,1,-3,1,-1,0,-1,-2,-2,0,1,2,4,3,-1,-0.4,-0.4,-1,1.8,0,C_Ug +117,R_3rJN39fpWBEuqvw,60 - 66,Canadian,Female,3,3,1,1,3,1,-3,1,-2,1,3,1,3,-3,0,1,1,1,1,-1,3,2,1,1,3,2,1,-3,1,-3,3,2,3,1,3,-3,0,2,1,1,1,1,-1,2,3,2,1,1,3,2,3,-3,1,-3,3,2,3,1,3,-3,0,2,1,1,1,1,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,75,FALSE,1,50,TRUE,1,65,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,0,80,TRUE,0,50,TRUE,0,98,TRUE,1,100,FALSE,0,50,TRUE,1,50,0,0.0001,0,0.0001,0.25,0.25,0,0.25,0.25,0,0,0,0.25,1,0,0,0.25,0.25,0.25,0.25,0.1225,0,0.5625,1,1,0.64,0.25,1,1,1,0.9604,1,0.420907143,0.196428571,0.645385714,22,68.75,17,53.13,2,25,6,75,4,50,5,62.5,13,81.25,4,25,81.75,75.62,76.62,87.25,87.5,85.19,78.31,15.62,28.62,50.62,1.62,37.25,25,3.94,53.31,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0.2,0.6,0,0,0.2,1,0,0,0.2,0.3,2,2,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,63,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.4,0,0,-0.1,C_Ug +118,R_6CeWh0LbhPXXLzg,60 - 66,Canadian,Male,3,3,2,1,-2,-3,-2,2,2,2,2,-2,3,-2,3,2,2,3,3,-3,3,3,2,2,-1,2,-3,2,3,3,1,6,2,-2,3,-3,3,0,0,0,2,-2,2,4,3,3,2,2,-3,0,-3,-2,3,-1,1,2,2,-2,3,-2,3,0,2,3,3,2,-2,2,FALSE,1,70,TRUE,1,81,TRUE,0,83,TRUE,0,63,TRUE,1,78,FALSE,1,100,TRUE,1,94,TRUE,1,100,TRUE,1,84,FALSE,0,71,FALSE,1,60,TRUE,0,64,TRUE,1,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,84,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,72,TRUE,1,100,TRUE,1,100,0,0,0,0.0036,0,0,0,0.5041,0.04,0,0.0784,0,0.0256,0.16,0.0484,0.0361,0.25,0.3969,0,0,0,0.0625,0.0256,1,0,0.25,0,0.09,0.6889,1,1,0.4096,0.216646429,0.109964286,0.323328571,28,87.5,24,75,6,75,7,87.5,5,62.5,6,75,15,93.75,9,56.25,86.22,74.62,91,91.88,87.38,90.94,81.5,12.5,11.22,-0.38,3.5,29.38,12.38,-2.81,25.25,0,0,0,1,1,0,4,1,1,1,0,0,0,1,0,2,2,1,5,5,0,0,0,1,1,0,0,1,3,1,0,0,0,0,0,0,1,0,1,1,0.4,1.4,0.2,3,0.4,1,0,0.6,1.25,0.5,2.67,0.67,2,4,0,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,62,1.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,4,0,-2,0,0,0,0,1,0,2,1,1,4,4,0,0.4,0.2,2.4,0.75,C_Ug +119,R_1OfCGJJDeaWfNGy,60 - 66,Canadian,Female,3,3,3,3,3,3,-3,3,0,3,2,2,3,2,3,-3,-3,-2,-3,-3,3,3,3,3,3,0,2,-3,3,2,2,1,2,2,3,2,3,1,-3,-3,-3,-3,-3,1,3,3,3,3,3,1,2,-3,3,2,2,0,2,3,3,2,3,1,-3,-3,-3,-3,-3,1,TRUE,0,90,TRUE,1,100,TRUE,0,87,FALSE,1,84,TRUE,1,73,FALSE,1,85,TRUE,1,98,TRUE,1,96,FALSE,0,60,TRUE,1,100,TRUE,0,97,TRUE,0,96,TRUE,1,91,TRUE,0,95,FALSE,0,52,TRUE,1,100,FALSE,1,53,TRUE,0,95,TRUE,0,61,FALSE,1,54,TRUE,1,93,TRUE,1,86,FALSE,1,86,FALSE,0,62,TRUE,0,94,TRUE,1,89,FALSE,1,60,TRUE,0,92,TRUE,0,85,TRUE,1,95,FALSE,0,60,TRUE,1,99,0.0016,0.0121,0,0.0004,0.0001,0.0225,0.3844,0,0.2116,0.0196,0.0025,0.0081,0.36,0.9409,0.0729,0,0.0196,0.0256,0.8464,0.8836,0.0049,0.2704,0.3721,0.9025,0.2209,0.16,0.36,0.81,0.7569,0.9025,0.7225,0.9216,0.364360714,0.1477,0.581021429,9,28.13,18,56.25,3,37.5,7,87.5,4,50,4,50,12,75,6,37.5,83.38,71.75,83.12,93.38,85.25,84.62,82.12,-28.12,27.13,34.25,-4.38,43.38,35.25,9.62,44.62,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,2,1,0,1,0,0,0,0,0,1,0,0,0,0.8,0,0.2,0,0.8,0.2,0.2,0.25,0.3,0.67,0.67,-1,1,0,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),65,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,-0.2,0,-0.05,HS_TS +120,R_1BDXOvYr3SMssDf,60 - 66,Canadian,Female,1,2,3,1,2,0,0,1,-1,0,1,2,1,-2,1,0,0,1,1,0,1,2,3,0,2,5,-1,0,1,1,-1,3,1,1,0,-1,1,3,0,1,0,0,-1,3,2,2,2,1,2,5,0,0,0,0,0,1,1,2,0,-2,1,3,0,1,1,1,0,1,TRUE,0,79,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,78,TRUE,1,100,TRUE,1,100,TRUE,1,74,TRUE,1,74,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,0,50,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,69,FALSE,1,50,TRUE,1,100,FALSE,1,77,TRUE,1,76,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.0576,0,0,0,0.0484,0,0.0676,0,0.0961,0,0.25,0.0676,0.25,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.25,0.25,1,0.5625,0.25,0.25,0.6241,1,1,1,1,0.331042857,0.109264286,0.552821429,19,59.38,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,76.62,59.25,69.12,84.38,93.75,77.69,75.56,-6.25,10.99,-3.25,6.62,21.88,18.75,-9.81,31.81,0,0,0,1,0,1,0,0,2,1,0,1,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0.2,0.8,0.6,0.8,0.4,0.4,0.2,0.2,0.6,0.3,3.67,3,0,2,0,2,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,66,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,-1,0,-1,1,0,1,0,-1,1,1,0,1,0,1,0,0,0,1,1,1,-0.2,0.4,0.4,0.6,0.3,C_Ug +121,R_7HCeHrTpMN1UNBZ,53 - 59,Canadian,Male,3,1,0,0,1,-2,-1,2,-2,1,1,-1,2,-2,1,-2,0,-2,-2,-2,2,1,1,-2,1,7,-2,-1,2,-1,1,6,1,1,1,1,0,5,-2,1,-1,-1,-2,7,3,1,0,0,2,3,-2,-2,1,-2,1,7,1,1,1,-3,1,3,1,1,1,1,-2,4,TRUE,0,50,TRUE,1,69,TRUE,0,80,FALSE,1,80,FALSE,0,65,TRUE,0,58,TRUE,1,90,TRUE,1,80,TRUE,1,86,FALSE,0,92,FALSE,1,85,TRUE,0,95,FALSE,0,86,TRUE,0,89,FALSE,0,87,TRUE,1,85,TRUE,0,50,FALSE,1,65,FALSE,1,59,FALSE,1,100,FALSE,0,59,TRUE,1,91,TRUE,0,81,TRUE,1,93,FALSE,1,96,TRUE,1,91,TRUE,0,61,FALSE,1,100,FALSE,1,70,TRUE,1,80,FALSE,0,90,TRUE,1,100,0.04,0.0081,0.0225,0.01,0,0.3364,0.0049,0.8464,0,0.0081,0.04,0.7396,0.0196,0.0225,0.4225,0.0961,0.6561,0.04,0,0.0016,0.3481,0.7569,0.1681,0.7921,0.25,0.3721,0.81,0.25,0.64,0.1225,0.09,0.9025,0.312003571,0.230871429,0.393135714,25,78.13,18,56.25,5,62.5,2,25,5,62.5,6,75,10,62.5,8,50,80.09,77.12,71.12,83,89.12,84,76.19,21.88,23.84,14.62,46.12,20.5,14.12,21.5,26.19,1,0,1,2,0,0,0,0,1,0,0,2,1,3,1,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,2,1,1,0,3,1,3,3,0,0.8,0.2,1.4,0.6,0.2,0.4,0.8,2,0.75,0.85,6,4.33,4,-1,2,3,1.67,5 cents,100 minutes,47 days,Male,University - Undergraduate,59,0.875,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,1,0,1,2,-1,0,-1,-1,1,0,0,0,0,2,1,-3,0,-2,-2,0,0.6,-0.2,0.6,-1.4,-0.1,C_Ug +122,R_71oXpdwjBQQF0Hd,60 - 66,Canadian,Female,2,0,0,-3,2,-2,-3,3,-1,2,2,1,2,-2,3,-2,1,0,0,1,3,1,0,-3,2,6,-2,-2,3,0,3,5,2,1,1,0,3,7,-2,-1,-1,-1,-2,6,2,1,0,-3,2,1,-3,-3,2,-1,2,3,1,0,2,-3,3,5,-1,0,0,-1,0,5,FALSE,1,100,TRUE,1,96,FALSE,1,100,FALSE,1,50,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,91,FALSE,0,53,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,FALSE,1,60,TRUE,0,70,FALSE,1,58,TRUE,1,65,TRUE,1,91,FALSE,1,96,TRUE,1,97,FALSE,1,88,TRUE,1,95,FALSE,1,95,FALSE,1,98,FALSE,1,65,TRUE,1,90,FALSE,0,79,TRUE,1,100,0,0.0025,0,0,0,0,0.0009,0,0.1764,0.0081,0.01,0.2809,0.25,0,0.0081,0.0016,0.0016,0.25,0.0004,0.0144,0.1225,0.25,0.49,0,0.09,0.0025,0.6241,0,0,0.16,0.1225,0.8281,0.131860714,0.070542857,0.193178571,25,78.13,27,84.38,5,62.5,7,87.5,8,100,7,87.5,13,81.25,14,87.5,84.31,73.75,80,91.75,91.75,84.81,83.81,-6.25,-0.07,11.25,-7.5,-8.25,4.25,3.56,-3.69,1,1,0,0,0,0,1,0,1,1,0,0,1,2,0,0,2,1,1,3,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,0.4,0.6,0.6,1.4,0.2,0.4,0.6,0.8,0.75,0.5,6,3,5,2,2,1,3,10 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),64,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,1,0,0,0,0,-1,1,-1,1,1,-1,-1,1,1,0,-1,1,1,0,2,0.2,0.2,0,0.6,0.25,grad_prof +123,R_7Va42f92krLujmc,53 - 59,Canadian,Female,2,2,3,-3,1,-3,-3,3,-1,-3,3,3,3,-3,3,2,2,2,2,-3,2,2,3,-1,1,1,-3,-3,3,-1,-3,1,3,3,3,-3,3,0,1,1,1,2,2,2,0,3,3,0,1,1,-3,-3,3,-2,-3,1,3,3,3,-3,3,0,2,2,2,3,2,1,TRUE,0,50,TRUE,1,70,TRUE,0,70,FALSE,1,50,FALSE,0,50,FALSE,1,70,TRUE,1,70,TRUE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,95,TRUE,1,100,FALSE,1,90,TRUE,1,85,TRUE,1,85,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,FALSE,0,50,TRUE,1,75,FALSE,1,80,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,0,50,FALSE,1,80,TRUE,0,85,TRUE,1,95,FALSE,0,50,TRUE,1,90,0.0025,0.0016,0.0225,0.09,0.01,0.09,0.0025,0,0.25,0.0625,0.0025,0,0.25,0.25,0.25,0.09,0.04,0.25,0.04,0,0.25,0.0225,0.81,0.01,0.25,0.25,0.25,0.25,0.49,1,0.7225,0.9025,0.242678571,0.110535714,0.374821429,22,68.75,22,68.75,5,62.5,5,62.5,6,75,6,75,13,81.25,9,56.25,75.5,61.88,71.88,85.12,83.12,78.5,72.5,0,6.75,-0.62,9.38,10.12,8.12,-2.75,16.25,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,5,2,1,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,5,0.4,0,0,1.6,1.2,0.2,0,1.2,0.5,0.65,0.67,0.67,0,0,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,59,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-2,-1,0,-1,0,0,0,0,-1,0,0,0,0,0,0,1,1,1,-1,0,-0.8,-0.2,0,0.4,-0.15,C_Ug +124,R_3TE4Et8JPxD5E2d,53 - 59,Canadian,Female,0,0,3,0,3,2,-2,0,-3,3,0,3,3,-3,3,3,3,3,3,1,3,0,3,0,3,0,3,-2,2,-3,3,0,0,3,3,-3,3,0,-1,-1,-3,-3,-3,0,3,0,3,0,3,1,1,-1,0,-3,2,0,0,3,3,-3,3,5,3,3,3,3,1,0,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0,0,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,1,0.25,0.285714286,0.178571429,0.392857143,24,75,15,46.88,3,37.5,3,37.5,3,37.5,6,75,13,81.25,2,12.5,67.19,56.25,62.5,81.25,68.75,71.88,62.5,28.12,20.31,18.75,25,43.75,-6.25,-9.37,50,3,0,0,0,0,1,0,2,0,0,0,0,0,0,0,4,4,6,6,4,3,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0.6,0.6,0,4.8,0.6,0.6,0,0,1.5,0.3,0,2,-1,0,-5,0,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),56,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,-1,2,0,-1,0,0,0,0,0,4,4,6,6,4,0,0,0,4.8,1.2,HS_TS +125,R_7Cg6cPOKf5R6mch,67 - 73,Canadian,Male,-1,3,1,2,1,-1,-2,3,-2,-1,2,1,2,-2,1,1,0,1,1,1,-2,3,1,-3,1,2,-1,1,2,1,1,3,1,1,2,-2,1,7,-3,-3,-3,-1,-2,7,-1,3,2,3,2,4,-1,-2,1,1,-3,2,1,1,2,-2,1,2,-1,-2,-2,1,-1,4,TRUE,0,54,TRUE,1,65,TRUE,0,70,TRUE,0,50,FALSE,0,50,FALSE,1,71,TRUE,1,62,TRUE,1,50,FALSE,0,50,FALSE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,69,FALSE,1,50,FALSE,0,50,TRUE,1,81,TRUE,0,50,TRUE,0,78,FALSE,1,50,FALSE,1,94,TRUE,1,89,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,59,TRUE,1,57,TRUE,0,50,TRUE,0,80,TRUE,0,50,TRUE,1,77,TRUE,1,73,TRUE,1,97,0.25,0.1849,0.0361,0.1444,0.0009,0.0841,0.25,0.5625,0.0036,0.25,0.0529,0.0961,0.25,0.25,0.25,0.1225,0.25,0.25,0.64,0.1681,0.0121,0.25,0.25,0.25,0.25,0.25,0.0729,0.2916,0.49,0.6084,0.25,0.25,0.239489286,0.1909,0.288078571,24,75,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,62.53,54.75,65.75,60.62,69,65.31,59.75,15.62,3.15,4.75,3.25,-1.88,6.5,-3.44,9.75,1,0,0,5,0,0,3,1,3,2,1,0,0,0,0,4,3,4,2,3,0,0,1,1,1,0,0,2,3,2,1,0,0,0,0,2,2,3,0,2,1.2,1.8,0.2,3.2,0.6,1.4,0.2,1.8,1.6,1,4,2.67,-2,1,5,3,1.33,10 cents,5 minutes,47 days,Male,University - Undergraduate,72,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,0,-1,4,-1,0,3,-1,0,0,0,0,0,0,0,2,1,1,2,1,0.6,0.4,0,1.4,0.6,C_Ug +126,R_1EsdwdL2CMmGUmS,67 - 73,American,Male,2,2,-1,0,3,0,0,3,-1,0,3,3,1,2,0,3,1,2,0,3,2,3,1,0,3,9,1,-1,2,-1,1,9,0,1,1,2,1,9,1,0,1,0,1,9,2,2,1,2,3,9,2,-1,3,-1,3,9,3,3,0,3,1,9,2,3,3,1,2,9,TRUE,0,100,TRUE,1,100,FALSE,1,62,FALSE,1,59,TRUE,1,100,TRUE,0,90,FALSE,0,85,TRUE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,59,TRUE,0,100,FALSE,0,75,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,58,TRUE,0,100,TRUE,0,100,FALSE,1,66,TRUE,1,100,TRUE,1,100,TRUE,1,81,0,0.3364,0,0.7225,0.0361,0.81,0,0,1,0,0,0,0.01,1,0,0,1,0.1681,1,1,0.5625,0,0.1681,1,1,1,0,1,0.1444,1,0.1156,1,0.464814286,0.287442857,0.642185714,25,78.13,17,53.13,6,75,4,50,2,25,5,62.5,13,81.25,4,25,91.41,88.5,89,92.88,95.25,93.06,89.75,25,38.28,13.5,39,67.88,32.75,11.81,64.75,0,1,2,0,0,1,1,1,0,1,3,2,0,0,1,2,1,1,0,2,0,0,2,2,0,2,1,0,0,3,0,0,1,1,1,1,2,1,1,1,0.6,0.8,1.2,1.2,0.8,1.2,0.6,1.2,0.95,0.95,9,9,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - PhD,72,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,1,0,-2,0,-1,0,1,0,-2,3,2,-1,-1,0,1,-1,0,-1,1,-0.2,-0.4,0.6,0,0,grad_prof +127,R_3flOdNLpKVbmtLi,67 - 73,American,Female,2,1,2,1,1,1,-2,2,-1,-1,3,3,3,-2,2,2,1,3,2,2,2,1,2,1,1,1,1,-2,2,-2,1,1,3,3,1,-2,2,1,1,1,1,2,2,1,2,1,2,1,1,2,1,-1,2,-1,-1,1,3,3,2,-2,2,1,2,2,2,1,2,2,TRUE,0,70,TRUE,1,80,FALSE,1,71,FALSE,1,50,TRUE,1,54,FALSE,1,55,TRUE,1,80,TRUE,1,90,TRUE,1,60,TRUE,1,70,FALSE,1,70,TRUE,0,91,TRUE,1,75,FALSE,1,50,TRUE,1,60,TRUE,1,92,FALSE,1,65,TRUE,0,91,FALSE,1,55,FALSE,1,90,TRUE,1,55,TRUE,1,55,FALSE,1,55,TRUE,1,60,FALSE,1,76,TRUE,1,71,FALSE,1,55,FALSE,1,76,TRUE,0,75,FALSE,0,75,FALSE,0,60,TRUE,1,100,0.01,0.0841,0.0064,0.04,0,0.2025,0.16,0.09,0.01,0.2025,0.5625,0.0625,0.16,0.09,0.2116,0.04,0.2025,0.25,0.0576,0.0576,0.2025,0.16,0.2025,0.25,0.1225,0.2025,0.36,0.49,0.0841,0.8281,0.5625,0.8281,0.237575,0.160292857,0.314857143,16,50,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,69.75,61.25,66.75,70.38,80.62,71.06,68.44,-31.25,-11.5,-26.25,-20.75,-4.62,5.62,-16.44,-6.56,0,0,0,0,0,0,0,0,1,2,0,0,2,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0.6,0.4,0.6,0,0.2,0.2,0.6,0.4,0.25,1,1.33,-1,0,0,-1,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,-1,0,1,2,0,0,1,0,0,1,-1,1,-1,0,0,0.4,0.2,0,0.15,HS_TS +128,R_3YXRM924PtBf6ux,32 - 38,Canadian,Male,-1,3,2,-1,-3,-2,-1,-2,2,0,1,-1,3,-1,3,-3,-2,-1,-2,-3,1,3,3,0,-3,6,0,2,-3,3,1,5,0,-1,0,0,0,5,0,0,1,0,-1,4,0,2,2,0,2,5,0,0,0,0,0,5,0,-1,2,-1,3,4,0,0,0,0,-1,5,TRUE,0,60,FALSE,0,50,TRUE,0,60,FALSE,1,50,FALSE,0,60,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,60,FALSE,1,50,FALSE,0,70,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,50,FALSE,1,50,FALSE,0,100,TRUE,1,65,TRUE,0,95,TRUE,1,60,FALSE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,67,FALSE,0,91,FALSE,0,50,TRUE,1,71,0,0.0025,0,0.1225,0.0841,0,0.16,0.25,0.25,0.1225,0.8281,0.49,0.25,0.16,0.36,0.25,0.9025,0.25,0.25,0.25,1,0.25,0.25,0,0.25,0.25,0.25,0.36,0.36,0.49,0.4489,0.25,0.322003571,0.311228571,0.332778571,19,59.38,16,50,2,25,3,37.5,5,62.5,6,75,7,43.75,9,56.25,66.84,51.25,76.62,69.38,70.12,70.44,63.25,9.38,16.84,26.25,39.12,6.88,-4.88,26.69,7,2,0,1,1,0,2,3,1,1,1,1,0,3,1,3,3,2,2,2,2,1,1,0,1,5,2,1,2,2,0,1,0,1,0,0,3,2,1,2,2,0.8,1.6,1.6,2.2,1.6,1.4,0.4,2,1.55,1.35,5.33,4.67,1,0,1,-1,0.66,10 cents,5 minutes,24 days,Male,High School (or equivalent),32,0.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,01DIR,1,-1,1,0,-5,0,2,-1,-1,1,0,0,2,1,3,0,0,1,0,0,-0.8,0.2,1.2,0.2,0.2,HS_TS +129,R_12AaJXOVHjAjKCq,60 - 66,Canadian,Male,0,3,3,1,3,2,-2,3,-1,3,1,2,3,0,1,2,2,3,2,0,0,3,2,-1,2,7,2,-1,2,0,2,4,0,2,2,1,0,2,-1,-2,-1,-1,-2,8,0,2,3,3,-1,7,-1,-3,-1,-3,-1,4,0,2,2,-3,0,2,-3,-2,1,2,1,8,TRUE,0,100,FALSE,0,64,TRUE,0,94,FALSE,1,51,FALSE,0,51,FALSE,1,69,TRUE,1,95,TRUE,1,87,TRUE,1,51,FALSE,0,96,FALSE,1,74,TRUE,0,91,TRUE,1,88,TRUE,0,55,FALSE,0,51,TRUE,1,96,TRUE,0,59,TRUE,0,65,TRUE,0,60,FALSE,1,76,FALSE,0,64,TRUE,1,81,TRUE,0,53,TRUE,1,71,FALSE,1,96,TRUE,1,92,TRUE,0,52,FALSE,1,99,TRUE,0,62,FALSE,0,86,TRUE,1,79,TRUE,1,100,0.0169,0.0064,0.0016,0.0025,0,0.0961,0.0841,0.9216,0.0576,0.0361,0.7396,0.0144,0.2401,0.0676,0.2601,0.4096,0.2809,0.2401,0.0001,0.0016,0.4096,0.2601,0.36,0.3025,0.3481,0.2704,0.0441,1,0.8836,0.4225,0.3844,0.8281,0.320107143,0.246278571,0.393935714,18,56.25,16,50,4,50,3,37.5,4,50,5,62.5,10,62.5,6,37.5,75.25,60.25,68.25,85,87.5,78.25,72.25,6.25,25.25,10.25,30.75,35,25,15.75,34.75,0,0,1,2,1,0,1,1,1,1,1,0,1,1,1,3,4,4,3,2,0,1,0,2,4,3,1,4,2,4,1,0,1,3,1,5,4,2,0,1,0.8,0.8,0.8,3.2,1.4,2.8,1.2,2.4,1.4,1.95,4.33,4.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),63,1.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,-1,1,0,-3,-3,0,-3,-1,-3,0,0,0,-2,0,-2,0,2,3,1,-0.6,-2,-0.4,0.8,-0.55,HS_TS +130,R_6VkvM4RwzyqX4xX,25 - 31,Canadian,Female,2,1,2,1,2,-1,-2,-1,1,1,1,1,1,2,0,-1,-1,-3,-2,-2,-2,3,1,-2,2,5,2,-1,-2,-1,2,6,1,1,1,0,1,0,-2,-2,-1,-1,-2,10,1,1,2,2,2,6,1,-2,1,-2,1,6,1,1,1,1,1,1,1,1,0,0,0,4,TRUE,0,80,TRUE,1,50,TRUE,0,100,FALSE,1,52,TRUE,1,50,FALSE,1,53,TRUE,1,96,TRUE,1,75,FALSE,0,55,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,1,62,TRUE,0,55,FALSE,0,58,TRUE,1,76,TRUE,0,70,TRUE,0,80,FALSE,1,92,FALSE,1,67,FALSE,0,70,TRUE,1,83,TRUE,0,79,FALSE,0,82,FALSE,1,100,TRUE,1,80,FALSE,1,72,FALSE,1,79,FALSE,1,70,TRUE,1,81,TRUE,1,70,TRUE,1,71,0.0625,0.04,0.0576,0.0016,0.0841,0.2209,0.6724,0,0.1089,0.0289,0.0361,0.1444,0.3025,0.6561,0.25,0.25,0.6241,0.2304,0.0441,0,0.49,0.3364,0.0064,0.3025,0.49,0.0784,0.09,0.64,1,0.64,0.09,1,0.314878571,0.257771429,0.371985714,19,59.38,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,12,75,8,50,74.66,66.25,65.62,84.25,82.5,72.44,76.88,-3.12,12.16,3.75,3.12,21.75,20,-2.56,26.88,4,2,1,3,0,3,1,1,2,1,0,0,0,2,1,1,1,2,1,0,1,0,0,1,0,2,0,2,3,0,0,0,0,1,1,2,2,3,2,2,2,1.6,0.6,1,0.4,1.4,0.4,2.2,1.3,1.1,3.67,4.33,-1,0,-1,6,-0.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),29,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,3,2,1,2,0,1,1,-1,-1,1,0,0,0,1,0,-1,-1,-1,-1,-2,1.6,0.2,0.2,-1.2,0.2,HS_TS +131,R_7dCk3EV35G3hOnf,60 - 66,Canadian,Male,2,2,2,2,1,1,0,3,1,2,3,2,3,3,2,1,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,0,0,0,1,1,2,3,3,2,3,3,3,2,2,2,2,2,3,2,3,2,3,3,3,2,1,2,1,1,3,TRUE,0,100,TRUE,1,99,TRUE,0,50,FALSE,1,68,FALSE,0,52,FALSE,1,50,TRUE,1,90,TRUE,1,89,TRUE,1,70,TRUE,1,64,TRUE,0,86,TRUE,0,82,TRUE,1,89,TRUE,0,87,FALSE,0,50,TRUE,1,96,FALSE,1,50,TRUE,0,90,FALSE,1,60,FALSE,1,98,FALSE,0,99,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,69,TRUE,1,86,TRUE,0,100,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,81,0.0121,0.0196,0.0016,0.01,0.0361,0.25,0.25,0.1296,0.0004,0.25,0,0.0121,0.09,0.7396,0.2704,0.0001,0.25,0.1024,0.25,0.4761,0.9801,0.25,0.16,0.7569,0.25,1,0.25,1,0.25,0.81,0.25,0.6724,0.347721429,0.17005,0.525392857,16,50,17,53.13,4,50,4,50,4,50,5,62.5,11,68.75,6,37.5,73.59,72.88,65.12,79.5,76.88,75.94,71.25,-3.13,20.46,22.88,15.12,29.5,14.38,7.19,33.75,0,0,0,0,1,1,2,1,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,1,2,1,2,1,1,0,1,1,1,0,1,1,1,1,0,0,0.2,1,0.6,0.4,1,1,0.8,0.6,0.55,0.85,2.33,3,-1,0,-1,-1,-0.67,10 cents,25 minutes,24 days,Male,High School (or equivalent),63,0.25,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,-1,-1,0,-1,-1,0,0,0,0,0,0,-1,0,1,-1,0,-1,0,0,0,-0.8,0,-0.2,-0.2,-0.3,HS_TS +132,R_6fdhGMa008fFigW,67 - 73,American,Female,3,2,2,1,2,-1,-2,3,-2,0,2,2,2,-1,2,-1,0,1,1,0,2,2,2,2,2,7,-1,-2,2,-2,0,6,2,2,2,-1,2,7,0,-1,1,0,-1,5,2,2,2,2,2,5,-2,-2,2,-2,-2,7,2,2,2,0,2,8,0,0,0,0,0,5,TRUE,0,84,TRUE,1,100,FALSE,1,100,TRUE,0,60,TRUE,1,100,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,92,FALSE,0,100,TRUE,0,72,TRUE,0,100,TRUE,1,96,TRUE,0,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,TRUE,0,63,TRUE,0,78,FALSE,1,100,FALSE,0,84,TRUE,1,85,FALSE,1,100,TRUE,1,72,FALSE,1,100,TRUE,1,56,TRUE,0,68,TRUE,0,60,TRUE,0,95,TRUE,1,79,TRUE,1,100,TRUE,1,100,0,0.1936,0,0,0,0.0016,0.0784,1,0,0.0225,0.0441,0.0016,0.0064,0.5184,0,0,0,0.36,0.36,0,0.7056,0.1225,0.6084,1,0,0.4624,0,0.7056,0,0.3969,0.9025,1,0.296317857,0.145214286,0.447421429,23,71.88,20,62.5,4,50,6,75,4,50,6,75,14,87.5,6,37.5,87.66,79.38,96.38,86,88.88,89.31,86,9.38,25.16,29.38,21.38,36,13.88,1.81,48.5,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,1,0,2,0,0,0,1,0,1,0,1,1,0,0.4,0.2,0,0.8,0.4,0.8,0.2,0.6,0.35,0.5,6.67,6.67,2,-1,-1,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),69,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,-1,0,0,0,-2,0,0,0,-1,0,0,1,-1,0,1,0,-0.6,-0.2,0.2,-0.15,grad_prof +133,R_1jiy35s47l7pFP2,60 - 66,Canadian,Male,-2,-2,-1,1,-2,0,0,1,1,1,1,0,1,1,0,1,1,1,0,1,-2,-2,-2,-1,-2,3,1,0,1,0,0,5,1,1,1,0,1,6,0,0,0,0,0,6,0,0,0,0,0,5,1,0,0,0,1,5,1,1,1,0,1,5,1,1,0,0,0,5,FALSE,1,64,TRUE,1,53,TRUE,0,91,TRUE,0,65,TRUE,1,53,TRUE,0,62,FALSE,0,62,TRUE,1,54,TRUE,1,69,TRUE,1,100,FALSE,1,65,TRUE,0,98,TRUE,1,57,FALSE,1,50,TRUE,1,50,TRUE,1,56,TRUE,0,61,TRUE,0,100,FALSE,1,54,TRUE,0,50,TRUE,1,56,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,89,TRUE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.2116,0.0121,0.1936,0.3844,0,0.3844,0.25,0,0.25,0.25,0,0.1849,0.0961,0.1225,0.2209,0.2209,0.25,0.4225,1,0.25,0.1936,0.25,0.2116,0.25,0.3721,0.25,0.25,0.1296,0.8281,1,0.25,0.9604,0.315985714,0.189442857,0.442528571,19,59.38,19,59.38,6,75,5,62.5,4,50,4,50,14,87.5,5,31.25,65.91,57,61.12,70.62,74.88,65.56,66.25,0,6.53,-18,-1.38,20.62,24.88,-21.94,35,0,0,1,2,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,2,2,1,1,2,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0.6,0.6,0.6,0.8,1.6,0.6,0.6,0.4,0.65,0.8,4.67,5,-2,0,1,1,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),60,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-2,-2,0,1,-2,0,0,-1,0,1,0,0,0,0,0,1,1,0,0,0,-1,0,0,0.4,-0.15,HS_TS +134,R_52nkx602HV2MbSm,67 - 73,American,Female,2,2,2,2,2,1,0,1,0,1,2,2,2,0,1,0,1,1,1,0,1,1,0,-1,1,6,2,1,2,0,2,5,0,1,0,1,0,5,1,0,0,0,0,7,0,1,1,1,0,4,0,0,1,1,0,5,1,1,2,0,1,5,0,-1,0,0,0,5,TRUE,0,93,TRUE,1,92,FALSE,1,68,FALSE,1,55,FALSE,0,62,FALSE,1,100,FALSE,0,59,TRUE,1,83,TRUE,1,61,TRUE,1,62,TRUE,0,57,FALSE,1,90,FALSE,0,84,FALSE,1,92,TRUE,1,60,FALSE,0,52,FALSE,1,67,TRUE,0,91,TRUE,0,62,FALSE,1,100,FALSE,0,65,TRUE,1,62,TRUE,0,66,TRUE,1,85,FALSE,1,71,TRUE,1,66,TRUE,0,60,FALSE,1,68,TRUE,0,70,FALSE,0,65,FALSE,0,60,TRUE,1,100,0.0289,0.1156,0.2704,0.3481,0,0,0.0225,0.1444,0,0.1444,0.4225,0.7056,0.1521,0.3249,0.3844,0.0064,0.4356,0.2025,0.1024,0.0841,0.4225,0.16,0.3844,0.0064,0.1089,0.36,0.36,0.8649,0.1024,0.8281,0.49,0.01,0.258192857,0.210378571,0.306007143,13,40.63,18,56.25,4,50,3,37.5,5,62.5,6,75,9,56.25,9,56.25,72.75,63.38,76.75,74.5,76.38,69.88,75.62,-15.62,16.5,13.38,39.25,12,1.38,13.63,19.37,1,1,2,3,1,1,1,1,0,1,2,1,2,1,1,1,1,1,1,0,2,1,1,1,2,1,0,0,1,1,1,1,0,0,0,0,2,1,1,0,1.6,0.8,1.4,0.8,1.4,0.6,0.4,0.8,1.15,0.8,5.33,4.67,2,0,0,2,0.66,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,68,0.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,-1,0,1,2,-1,0,1,1,-1,0,1,0,2,1,1,1,-1,0,0,0,0.2,0.2,1,0,0.35,C_Ug +135,R_7nejt6E4wnCP4L3,67 - 73,Canadian,Female,1,0,2,1,2,1,-1,1,-1,1,1,1,1,0,2,0,-1,1,0,0,0,0,2,1,2,7,0,-2,1,0,0,7,1,1,2,-1,1,8,1,1,1,1,-1,3,1,0,2,1,2,7,0,-2,1,-1,0,5,1,1,1,0,2,6,0,0,0,0,-1,6,FALSE,1,86,TRUE,1,100,TRUE,0,100,FALSE,1,82,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,78,FALSE,0,68,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,0,72,TRUE,0,100,TRUE,1,94,TRUE,1,61,TRUE,0,66,TRUE,1,72,TRUE,0,75,TRUE,1,80,TRUE,0,75,TRUE,0,87,TRUE,0,92,TRUE,1,97,TRUE,1,100,TRUE,1,100,0,0.04,0,0,0,0,0.0784,0,1,0.1521,0.0009,0.4624,0,1,0.0025,0,0.4356,0.0324,0.7569,0.5625,0.0036,0,0.5184,0,0.6561,0.5625,0,0.0196,1,1,0.8464,0.0484,0.326382143,0.226021429,0.426742857,24,75,20,62.5,5,62.5,4,50,6,75,5,62.5,15,93.75,5,31.25,89.41,91.12,87,87.75,91.75,91.69,87.12,12.5,26.91,28.62,37,12.75,29.25,-2.06,55.87,1,0,0,0,0,1,1,0,1,1,0,0,1,1,1,1,2,0,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,1,1,0,1,0.2,0.8,0.6,1,0,0.6,0,0.6,0.65,0.3,7.33,6,0,2,2,-3,1.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),73,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,-1,1,0,0.2,0.2,0.6,0.4,0.35,HS_TS +136,R_6VvkzF78AK1eC8F,53 - 59,Canadian,Female,1,2,2,-2,0,-1,1,2,0,0,2,1,2,1,2,-1,1,1,1,2,2,2,2,-1,0,7,-1,-1,1,1,0,6,1,1,1,1,1,8,-1,-1,-1,-1,2,8,2,1,2,0,0,8,-1,0,2,0,0,6,2,2,2,0,2,8,1,1,1,1,2,7,FALSE,1,52,FALSE,0,51,FALSE,1,100,FALSE,1,53,FALSE,0,50,FALSE,1,100,TRUE,1,64,TRUE,1,74,FALSE,0,53,TRUE,1,55,TRUE,0,53,TRUE,0,62,TRUE,1,63,TRUE,0,90,TRUE,1,53,TRUE,1,68,TRUE,0,54,TRUE,0,79,FALSE,1,55,TRUE,0,51,TRUE,1,51,TRUE,1,58,TRUE,0,59,TRUE,1,82,FALSE,1,88,TRUE,1,77,TRUE,0,53,TRUE,0,54,TRUE,0,91,TRUE,1,87,TRUE,1,61,TRUE,1,100,0.0676,0.0529,0.1024,0.1296,0,0,0.0324,0.2025,0.2601,0.1764,0.0169,0.1369,0.2809,0.2809,0.25,0.2601,0.3481,0.2209,0.2916,0.0144,0.2401,0.2209,0.2025,0.81,0.2916,0.2809,0.1521,0.2304,0,0.6241,0.8281,0.3844,0.251328571,0.17615,0.326507143,18,56.25,19,59.38,4,50,4,50,6,75,5,62.5,13,81.25,6,37.5,66.91,54,71,70.38,72.25,65.44,68.38,-3.13,7.53,4,21,-4.62,9.75,-15.81,30.88,1,0,0,1,0,0,2,1,1,0,1,0,1,0,1,0,2,2,2,0,1,1,0,2,0,0,1,0,0,0,0,1,0,1,0,2,0,0,0,0,0.4,0.8,0.6,1.2,0.8,0.2,0.4,0.4,0.75,0.45,7,7.33,-1,0,0,1,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),54,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,-1,0,-1,0,0,1,1,1,0,1,-1,1,-1,1,-2,2,2,2,0,-0.4,0.6,0.2,0.8,0.3,HS_TS +137,R_3SBOkbknaMoB7Mv,53 - 59,Canadian,Male,2,1,3,1,2,-2,0,3,-1,-1,2,2,2,-2,2,1,1,1,1,1,2,1,2,-2,2,3,-2,-2,2,-2,1,2,2,2,2,-2,2,4,1,2,1,1,2,2,2,1,2,2,2,2,-2,-1,2,-1,-1,2,2,2,1,-2,1,2,1,0,2,1,1,6,TRUE,0,76,TRUE,1,100,TRUE,0,100,FALSE,1,57,TRUE,1,67,FALSE,1,71,TRUE,1,100,TRUE,1,84,TRUE,1,53,FALSE,0,100,FALSE,1,54,TRUE,0,93,TRUE,1,96,FALSE,1,91,TRUE,1,63,FALSE,0,85,TRUE,0,83,TRUE,0,90,TRUE,0,58,TRUE,0,100,FALSE,0,55,TRUE,1,53,TRUE,0,53,FALSE,0,55,FALSE,1,66,TRUE,1,64,FALSE,1,51,TRUE,0,87,FALSE,1,54,TRUE,1,92,TRUE,1,60,TRUE,1,55,0.0256,0.1296,0.7225,0,0.2025,0.0841,0.3025,1,1,0.2209,0.0064,0.0016,0.2209,0.2116,0.1089,0,0.2809,0.1849,0.7569,0.1156,0.3025,0.1369,0.3364,0.0081,0.6889,0.2401,0.16,0.5776,1,0.81,0.2116,0.8649,0.358382143,0.273228571,0.443535714,23,71.88,19,59.38,7,87.5,5,62.5,5,62.5,2,25,12,75,7,43.75,73.94,62,66.75,80,87,73.88,74,12.5,14.56,-25.5,4.25,17.5,62,-1.12,30.25,0,0,1,3,0,0,2,1,1,2,0,0,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,1,1,0,0,0.8,1.2,0,0.4,0.4,0.4,0.4,0.4,0.6,0.4,3,2,1,0,2,-4,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,57,0,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,2,0,0,1,0,1,2,0,0,-1,0,-1,0,0,-1,0,1,0.4,0.8,-0.4,0,0.2,C_Ug +138,R_5OACV3KWceUn6UF,39 - 45,American,Female,3,3,3,-2,3,-1,-2,3,0,3,3,0,3,-1,3,-1,1,2,0,-3,3,3,3,-3,-1,4,-3,1,-1,2,-2,5,2,0,0,0,1,3,-2,-2,-3,-2,-3,4,3,3,3,-2,3,2,-2,-2,3,-2,3,0,3,0,3,0,3,0,0,0,0,0,-2,3,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,92,TRUE,1,91,TRUE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,81,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,80,TRUE,0,50,TRUE,1,75,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,79,TRUE,1,50,TRUE,1,100,0,0.0625,0.25,0.0081,0,0.0064,0.04,0.25,0.25,0.25,0.0441,0,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.6561,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.214164286,0.149321429,0.279007143,6,18.75,18,56.25,3,37.5,6,75,4,50,5,62.5,14,87.5,4,25,62.44,50,74,62.12,63.62,67.19,57.69,-37.5,6.19,12.5,-1,12.12,1.12,-20.31,32.69,0,0,0,1,4,2,3,4,2,5,1,0,3,1,2,1,3,5,2,0,0,0,0,0,0,1,0,0,2,0,0,0,0,1,0,1,1,2,0,1,1,3.2,1.4,2.2,0,0.6,0.2,1,1.95,0.45,4,0.67,2,5,3,1,3.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,43,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,4,1,3,4,0,5,1,0,3,0,2,0,2,3,2,-1,1,2.6,1.2,1.2,1.5,C_Ug +139,R_13Wi1nBilcnuUPc,67 - 73,Canadian,Female,3,1,3,-1,2,1,-2,-1,3,1,2,2,2,-1,3,1,2,1,3,1,3,2,1,-3,3,6,1,-2,2,2,2,7,1,3,3,2,3,6,1,2,2,3,1,8,3,-2,3,2,-3,9,-1,1,-3,3,-3,9,-2,2,-1,1,3,5,-2,-2,-2,0,1,9,TRUE,0,86,TRUE,1,92,FALSE,1,87,FALSE,1,73,FALSE,0,79,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,63,FALSE,0,100,TRUE,0,66,TRUE,0,99,TRUE,1,88,TRUE,0,92,TRUE,1,54,TRUE,1,100,FALSE,1,56,FALSE,1,93,FALSE,1,55,FALSE,1,99,FALSE,0,75,TRUE,1,91,FALSE,1,73,FALSE,0,53,FALSE,1,95,TRUE,1,96,FALSE,1,53,FALSE,1,100,FALSE,1,56,TRUE,1,65,TRUE,1,90,TRUE,1,100,0,0.0016,0,0.0001,0,0,0.2809,1,0.0001,0.0081,0.1225,0.0144,0.1369,0.4356,0.6241,0.0064,0.0729,0.0729,0,0.0025,0.5625,0.2116,0.2025,0.8464,0.1936,0.2209,0.01,0.7396,0.0169,0.0049,0.1936,0.9801,0.248567857,0.1982,0.298935714,19,59.38,24,75,7,87.5,6,75,5,62.5,6,75,12,75,12,75,82.12,68.25,78.38,94,87.88,84.06,80.19,-15.62,7.12,-19.25,3.38,31.5,12.88,9.06,5.19,0,1,2,2,1,0,0,3,1,1,1,1,1,3,0,0,0,1,0,0,0,3,0,3,5,2,3,2,0,4,4,0,3,2,0,3,4,3,3,0,1.2,1,1.2,0.2,2.2,2.2,1.8,2.6,0.9,2.2,6.33,7.67,-3,-2,1,-1,-1.34,10 cents,5 minutes,24 days,Female,High School (or equivalent),70,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,-2,2,-1,-4,-2,-3,1,1,-3,-3,1,-2,1,0,-3,-4,-2,-3,0,-1,-1.2,-0.6,-2.4,-1.3,HS_TS +140,R_5OYQlm06tBC3oYW,67 - 73,Canadian,Male,3,0,0,1,-1,-2,0,1,-1,0,1,2,1,0,1,2,3,2,3,2,2,0,-2,0,-1,1,-1,-1,1,-1,-1,1,2,3,1,-1,2,2,1,2,2,2,2,2,2,1,-1,1,-1,3,0,-1,1,-1,-1,2,2,3,2,-1,2,1,2,1,3,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,FALSE,0,96,TRUE,0,100,TRUE,1,90,TRUE,1,100,TRUE,0,65,TRUE,0,100,TRUE,0,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,0,0,0,0,0.9216,0,0.5625,0,0,0.7225,0.25,0,1,0,0.01,0.9025,1,0.4225,0.36,0,1,1,1,0.7396,0,0.353257143,0.175471429,0.531042857,28,87.5,18,56.25,4,50,4,50,3,37.5,7,87.5,14,87.5,4,25,93.81,83.75,91.5,100,100,99.12,88.5,31.25,37.56,33.75,41.5,62.5,12.5,11.62,63.5,1,0,2,1,0,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,0,0,2,1,0,0,1,1,1,1,1,1,0,2,1,1,0,0.8,0.6,0.8,0.6,0.6,0.8,1,0.8,0.7,0.8,1.33,2,-2,-1,1,0,-0.67,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),73,-0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,-1,1,1,0,-1,0,0,0,0,0,0,-1,0,0,1,-1,-1,0,0,0.2,-0.2,-0.2,-0.2,-0.1,grad_prof +141,R_6JgOAENdUiQE35f,67 - 73,American,Female,3,1,1,-1,3,-1,1,3,-1,-1,2,2,3,1,2,1,1,2,2,2,3,1,1,-1,3,6,-1,-1,3,1,0,2,2,3,3,1,2,4,1,1,1,1,1,5,3,1,1,1,2,6,-2,0,2,1,-1,5,2,3,3,1,2,6,1,-1,1,2,2,7,TRUE,0,96,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,96,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,FALSE,1,91,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,84,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,87,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.5776,1,0,0,0,0,0.0081,0.0016,0,0,0.25,0,0,0.0576,0.7056,0.7569,1,1,0.25,0,0.9216,0,0,1,1,0.304607143,0.131235714,0.477978571,30,93.75,22,68.75,5,62.5,6,75,5,62.5,6,75,14,87.5,8,50,93.94,82.75,96.5,96.5,100,95.75,92.12,25,25.19,20.25,21.5,34,25,8.25,42.12,0,0,0,0,0,0,2,0,2,1,0,1,0,0,0,0,0,1,1,1,0,0,0,2,1,1,1,1,2,0,0,1,0,0,0,0,2,1,0,0,0,1,0.2,0.6,0.6,1,0.2,0.6,0.45,0.6,4,5.67,0,-3,-2,-2,-1.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,-2,-1,-1,1,-1,0,1,0,0,0,0,0,0,-2,0,1,1,-0.6,0,0,0,-0.15,HS_TS +142,R_7PFea8DfeKrRjGW,67 - 73,American,Male,1,3,2,1,0,0,-3,2,-2,1,3,2,2,-1,1,-1,1,2,2,-1,0,3,2,1,2,0,0,-2,2,-2,2,0,2,-1,2,1,2,3,2,2,1,2,1,1,1,2,2,1,-2,1,0,-2,2,-2,2,1,2,2,2,1,2,1,2,1,2,2,-1,4,TRUE,0,95,TRUE,1,100,TRUE,0,100,FALSE,1,57,FALSE,0,50,FALSE,1,74,TRUE,1,100,TRUE,1,85,TRUE,1,82,TRUE,1,93,FALSE,1,77,TRUE,0,84,TRUE,1,85,TRUE,0,73,FALSE,0,60,TRUE,1,100,FALSE,1,79,TRUE,0,86,TRUE,0,58,FALSE,1,100,TRUE,1,58,FALSE,0,57,FALSE,1,64,FALSE,0,61,TRUE,0,60,TRUE,1,98,FALSE,1,50,FALSE,1,74,TRUE,0,56,TRUE,1,95,TRUE,1,97,TRUE,1,81,0.0225,0.0004,0,0,0.0361,0.0676,0.3721,0.0049,0,0.3249,0.0025,0.0225,0.0324,0.0529,0.25,0,0.1296,0.1849,0.0676,0.36,0.1764,0.36,0.3364,0.5329,0.0441,0.25,0.0009,0.9025,1,0.7396,0.3136,0.7056,0.259642857,0.105742857,0.413542857,24,75,20,62.5,6,75,6,75,3,37.5,5,62.5,12,75,8,50,77.78,72.62,68.38,82.75,87.38,81.38,74.19,12.5,15.28,-2.38,-6.62,45.25,24.88,6.38,24.19,1,0,0,0,2,0,1,0,0,1,1,3,0,2,1,3,1,1,0,2,0,1,0,0,2,0,1,0,0,1,1,0,0,2,1,3,0,0,0,0,0.6,0.4,1.4,1.4,0.6,0.4,0.8,0.6,0.95,0.6,1,1,-1,-1,2,-3,0,10 cents,5 minutes,24 days,Male,Trade School (non-military),73,1,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,1,-1,0,0,0,0,0,0,0,0,0,3,0,0,0,0,1,1,0,2,0,0,0.6,0.8,0.35,HS_TS +143,R_7w7DRq89EHLmPTW,67 - 73,American,Male,3,2,2,-2,0,-1,0,1,2,0,2,2,2,1,3,0,0,0,0,1,3,2,2,-2,1,2,0,0,0,1,-1,3,2,2,1,0,2,1,1,1,0,0,0,3,3,2,2,0,1,1,-1,-1,0,1,0,3,2,0,1,1,2,2,1,0,2,1,1,3,FALSE,1,97,TRUE,1,96,FALSE,1,65,FALSE,1,59,TRUE,1,64,FALSE,1,87,TRUE,1,90,TRUE,1,80,TRUE,1,74,TRUE,1,73,FALSE,1,70,TRUE,0,85,TRUE,1,61,TRUE,0,87,FALSE,0,57,TRUE,1,97,FALSE,1,58,TRUE,0,61,TRUE,0,76,FALSE,1,100,TRUE,1,77,TRUE,1,80,FALSE,1,83,TRUE,1,84,TRUE,0,79,TRUE,1,82,TRUE,0,53,FALSE,1,91,TRUE,0,83,TRUE,1,83,FALSE,0,65,TRUE,1,66,0.04,0.0324,0.0009,0.01,0.1156,0.0169,0.0256,0.0729,0,0.04,0.0289,0.1521,0.0676,0.09,0.1296,0.0016,0.0289,0.1681,0.0081,0.6241,0.0529,0.3249,0.5776,0.7569,0.1764,0.2809,0.4225,0.0009,0.1225,0.3721,0.6889,0.7225,0.21675,0.066985714,0.366514286,17,53.13,23,71.88,4,50,7,87.5,5,62.5,7,87.5,14,87.5,9,56.25,76.97,68.75,72.38,81.12,85.62,76.81,77.12,-18.75,5.09,18.75,-15.12,18.62,-1.88,-10.69,20.87,0,0,0,0,1,1,0,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,2,1,0,1,1,1,0,0,2,1,0,1,1,0,2,1,0,0.2,0.8,0.6,0.6,0.6,0.6,0.8,0.8,0.55,0.7,2,2,1,0,-1,0,0,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,71,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-2,0,1,-1,0,0,1,0,-2,0,1,0,0,1,-2,-1,1,-0.4,0.2,-0.2,-0.2,-0.15,C_Ug +144,R_5guQAIjetvIDuH6,67 - 73,American,Male,-1,3,3,1,0,2,1,3,1,1,3,3,3,-3,0,2,1,2,3,1,0,3,3,1,0,2,3,1,3,1,-1,0,3,3,3,-3,0,0,2,2,2,2,2,0,2,3,2,3,-2,0,0,1,3,1,-2,7,3,3,1,-3,0,7,1,0,1,2,1,7,TRUE,0,97,FALSE,0,50,TRUE,0,98,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,97,FALSE,1,100,TRUE,0,92,TRUE,1,96,TRUE,0,50,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,98,TRUE,1,96,TRUE,1,100,TRUE,1,96,0,0,0.01,0,0.0016,0.25,0.25,0.0009,0.25,0.25,0.0016,0.0016,0.25,0,0.25,0.25,0.25,0.25,0,0.25,0.0016,0.25,0.25,0.25,0.25,0.25,0,0.9409,0.9604,1,0.9604,0.8464,0.302335714,0.161121429,0.44355,23,71.88,20,62.5,5,62.5,6,75,4,50,5,62.5,11,68.75,9,56.25,75.19,62.5,73.25,80.5,84.5,79.44,70.94,9.38,12.69,0,-1.75,30.5,22,10.69,14.69,1,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,1,1,3,0,1,2,2,2,0,0,0,3,0,0,2,0,0,1,1,1,1,0,0.2,0.6,0,0.6,1.6,1,0.4,0.8,0.35,0.95,0.67,4.67,2,-7,-7,-7,-4,10 cents,25 minutes,24 days,Male,High School (or equivalent),73,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,-2,0,-1,-2,-2,-1,0,0,0,-1,0,0,-2,0,0,-1,0,-1,0,1,-1.4,-0.4,-0.4,-0.2,-0.6,HS_TS +145,R_1Yb2YCDG83IHgrM,53 - 59,Canadian,Female,2,1,0,2,2,-3,0,2,-2,1,2,-2,2,2,3,-2,-1,-1,-1,-3,2,2,1,-1,3,5,-3,0,1,-1,-2,4,1,-2,1,3,1,3,-2,-3,-2,-3,-3,5,0,0,0,1,0,4,-3,-2,3,-2,0,2,0,0,0,-1,1,3,-2,-1,0,0,-3,5,FALSE,1,85,TRUE,1,54,TRUE,0,54,TRUE,0,53,TRUE,1,71,TRUE,0,54,TRUE,1,95,TRUE,1,53,FALSE,0,55,FALSE,0,53,TRUE,0,53,TRUE,0,80,TRUE,1,86,TRUE,0,53,TRUE,1,53,TRUE,1,80,TRUE,0,70,TRUE,0,79,FALSE,1,55,TRUE,0,62,TRUE,1,65,TRUE,1,87,TRUE,0,54,TRUE,1,53,TRUE,0,54,TRUE,1,54,TRUE,0,54,TRUE,0,54,TRUE,0,56,TRUE,1,89,TRUE,1,53,FALSE,0,50,0.2209,0.2116,0.04,0.0025,0.25,0.2916,0.2209,0.2809,0.3844,0.0169,0.0121,0.0196,0.3025,0.2809,0.0841,0.2116,0.2916,0.2809,0.2916,0.2916,0.1225,0.2209,0.2025,0.2809,0.49,0.2916,0.2209,0.0225,0.2916,0.6241,0.3136,0.64,0.258296429,0.209142857,0.30745,5,15.63,15,46.88,4,50,3,37.5,4,50,4,50,13,81.25,2,12.5,63.16,53.75,63.25,70,65.62,65.69,60.62,-31.25,16.28,3.75,25.75,20,15.62,-15.56,48.12,0,1,1,3,1,0,0,1,1,3,1,0,1,1,2,0,2,1,2,0,2,1,0,1,2,0,2,1,0,1,2,2,2,3,2,0,0,1,1,0,1.2,1,1,1,1.2,0.8,2.2,0.4,1.05,1.15,4,3,1,2,0,0,1,5 cents,100 minutes,36 days,Female,High School (or equivalent),59,1.375,1,0,0,0,1,0,0.33,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,-2,0,1,2,-1,0,-2,0,1,2,-1,-2,-1,-2,0,0,2,0,1,0,0,0.2,-1.2,0.6,-0.1,HS_TS +146,R_5OOEIEnQs4N8XqD,60 - 66,Canadian,Female,3,2,2,-1,3,1,1,3,-3,1,0,1,3,-3,3,0,0,0,3,3,3,2,2,-2,1,2,2,0,3,-3,3,0,1,2,3,-3,3,0,3,3,3,3,2,1,3,2,2,0,2,0,0,0,3,-3,0,5,0,2,3,-3,3,0,1,1,3,3,-2,3,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,1,91,TRUE,0,100,TRUE,1,77,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0081,0.0081,0.0361,0,0,0,0.04,0.25,0,0.25,0.0529,0.5776,1,0.8464,0.25,0.25,1,0,1,1,1,0.270328571,0.006592857,0.534064286,27,84.38,23,71.88,5,62.5,6,75,5,62.5,7,87.5,15,93.75,8,50,90.25,75.62,91.62,100,93.75,91.19,89.31,12.5,18.37,13.12,16.62,37.5,6.25,-2.56,39.31,0,0,0,1,2,1,1,0,0,2,1,1,0,0,0,3,3,3,0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,0,0,1,1,3,0,5,0.6,0.8,0.4,2,0.4,0.6,0.2,2,0.95,0.8,0.67,1.67,2,-5,0,-2,-1,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,2,2,0,0,-4,0.2,0.2,0.2,0,0.15,C_Ug +147,R_6KAyi2mZ8RoW8oh,60 - 66,Canadian,Male,2,3,-1,-1,2,1,-2,1,-2,0,1,0,2,-1,1,1,1,2,1,1,2,3,-1,-1,2,7,1,-2,1,-2,1,8,1,-1,2,-1,1,8,1,1,1,1,1,8,2,3,-1,-1,2,9,1,-2,1,-2,0,8,1,-1,1,-2,2,8,1,1,2,1,1,8,FALSE,1,55,TRUE,1,64,TRUE,0,80,FALSE,1,50,TRUE,1,55,FALSE,1,85,TRUE,1,79,TRUE,1,76,TRUE,1,63,TRUE,1,69,FALSE,1,57,FALSE,1,91,FALSE,0,66,FALSE,1,61,FALSE,0,55,TRUE,1,100,FALSE,1,79,TRUE,0,73,TRUE,0,69,TRUE,0,100,FALSE,0,59,TRUE,1,61,TRUE,0,58,TRUE,1,100,FALSE,1,57,TRUE,1,75,TRUE,0,58,TRUE,0,70,TRUE,0,100,TRUE,1,100,FALSE,0,63,TRUE,1,89,0.0576,0.0625,0,0.0441,0.0121,0.0225,0,0.0961,1,0.1521,0,0.4356,0.1369,0.1849,0.2025,0.1296,0.3364,0.25,0.49,0.1849,0.3481,0.3025,0.4761,0.1521,0.0441,0.3364,0.3969,0.2025,0.64,0.5329,1,0.0081,0.288332143,0.211335714,0.365328571,20,62.5,20,62.5,4,50,4,50,7,87.5,5,62.5,12,75,8,50,72.41,59.88,73.88,66.25,89.62,73.38,71.44,0,9.91,9.88,23.88,-21.25,27.12,-1.62,21.44,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0.2,0.2,0.2,0,0,0.8,0,0.15,0.2,7.67,8.33,-2,0,0,0,-0.66,5 cents,5 minutes,47 days,Male,Trade School (non-military),62,0.625,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,1,0,0,-1,-1,-1,0,0,1,0,0,0,0.2,-0.6,0.2,-0.05,HS_TS +148,R_19xzfsLiRU0FSEh,53 - 59,Canadian,Female,2,1,2,-3,0,1,-2,3,-2,1,3,-1,3,-1,3,2,2,2,3,3,2,2,1,-3,2,4,1,-2,3,-2,0,1,3,0,2,-1,3,1,2,2,2,2,2,3,2,1,2,-2,0,1,1,-2,3,-2,0,0,3,-1,3,-1,3,0,2,2,2,2,3,1,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,70,FALSE,1,63,TRUE,1,81,TRUE,1,97,TRUE,1,85,TRUE,1,81,FALSE,1,50,TRUE,0,55,TRUE,1,70,FALSE,1,76,FALSE,0,50,TRUE,1,86,FALSE,1,50,TRUE,0,92,FALSE,1,59,FALSE,1,50,FALSE,0,75,TRUE,1,81,FALSE,1,100,FALSE,0,82,TRUE,0,60,TRUE,1,87,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,92,FALSE,0,85,TRUE,1,100,0.0009,0.0169,0.0196,0.0361,0,0.1369,0.6724,0.0361,0.25,0.0361,0.0064,0.09,0.0225,0.25,0.09,0.25,0,0.25,0,0.36,0.5625,0.25,0.1681,0.0576,0.25,0.25,0.7225,0.25,0,0.8464,1,0.3025,0.253928571,0.149314286,0.358542857,17,53.13,23,71.88,5,62.5,6,75,6,75,6,75,11,68.75,12,75,74.28,59.88,78.5,76,82.75,79.5,69.06,-18.75,2.4,-2.62,3.5,1,7.75,10.75,-5.94,0,1,1,0,2,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0.8,0.2,0.4,0.4,0.2,0.2,0,0.2,0.45,0.15,2,0.33,3,1,1,2,1.67,10 cents,5 minutes,36 days,Female,University - Graduate (Masters),57,1,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,1,1,-1,2,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0.6,0,0.4,0.2,0.3,grad_prof +149,R_3uTX9MGCaRJttCL,67 - 73,American,Male,3,0,-2,1,-1,-1,1,1,-1,1,1,0,2,-2,2,-1,0,1,1,-2,3,0,-1,2,0,2,-1,1,1,-1,2,3,1,0,2,-2,3,2,-2,-1,-1,0,-1,6,3,0,-2,2,-2,2,-2,0,1,-1,-1,2,1,-1,2,-2,3,2,-2,-2,0,2,-1,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,74,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,0,70,FALSE,1,100,TRUE,1,100,TRUE,1,82,FALSE,1,100,TRUE,1,87,FALSE,1,73,TRUE,1,100,FALSE,1,73,FALSE,1,65,TRUE,0,71,TRUE,1,82,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0169,0,0,0.0324,0.0324,1,0,0,0,0,0,0.25,0.1225,0.0729,0,0.5476,0.49,0,0,0.0729,0,0,1,0.7396,0.5041,0,0.174332143,0.095121429,0.253542857,24,75,26,81.25,6,75,6,75,7,87.5,7,87.5,14,87.5,12,75,91.03,83.38,96.38,92.62,91.75,95.31,86.75,-6.25,9.78,8.38,21.38,5.12,4.25,7.81,11.75,0,0,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,2,1,1,0,0,0,1,1,1,1,0,0,2,0,1,0,0,1,1,2,1,1,1,0.6,0.2,0.2,1.2,0.4,0.8,0.4,1.2,0.55,0.7,2.33,2,0,1,0,2,0.33,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),73,1.25,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,1,0,0,-1,-1,0,0,-1,0,-1,0,0,0,0,-1,1,0,0,0.2,-0.6,-0.2,0,-0.15,grad_prof +150,R_11dUwtt1T1ylv5a,67 - 73,American,Male,1,2,2,1,2,0,-2,2,-2,-1,2,2,2,-3,2,1,1,1,2,-1,1,2,2,-1,2,1,-2,-2,1,-2,-1,3,2,2,2,-3,2,0,1,1,1,2,-1,3,0,2,1,2,2,2,-2,-1,1,0,-2,4,2,2,2,-3,2,1,2,1,2,2,1,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,90,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,96,TRUE,1,100,FALSE,1,91,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,80,FALSE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,0,0,0,0.0025,0,0.01,0,0,0,0.01,0,0,0,0,0,0,0,0.25,1,0.0081,0,0.25,0.64,0.0081,0.25,0.5625,0.0196,0,0,0.0625,1,0.9216,0.1783,0.019285714,0.337314286,25,78.13,26,81.25,6,75,6,75,8,100,6,75,16,100,10,62.5,91.22,80.12,92.5,92.75,99.5,95.06,87.38,-3.12,9.97,5.12,17.5,-7.25,24.5,-4.94,24.88,0,0,0,2,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,2,1,1,2,1,0,0,0,0,0,1,0,1,0,2,0.4,0.6,0,0,0.6,1.4,0,0.8,0.25,0.7,1.33,2.33,-1,-1,-1,0,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,0.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,0,-1,1,0,0,-1,0,-2,-1,0,0,0,0,0,-1,0,-1,0,-2,-0.2,-0.8,0,-0.8,-0.45,C_Ug +151,R_3pRrDsIC7Uswrr8,67 - 73,Canadian,Female,3,2,2,0,3,2,-2,3,-3,1,0,1,3,0,2,-1,-1,1,1,-2,2,2,2,-1,2,5,2,-2,3,-3,1,2,0,1,2,2,2,4,0,1,1,-1,-1,7,2,2,2,2,1,3,2,-2,2,-2,0,2,0,2,3,0,2,5,-1,-3,-1,-1,-2,8,FALSE,1,86,TRUE,1,95,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,50,TRUE,1,86,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,59,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,77,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0081,0,0,0,0.0196,0,0,0,0.25,0.25,0.25,0.16,0.0025,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.3481,0.5929,0,0.0196,0,0.25,1,1,0.201525,0.102292857,0.300757143,22,68.75,26,81.25,7,87.5,5,62.5,7,87.5,7,87.5,15,93.75,11,68.75,79.81,65.25,71.12,82.88,100,83.25,76.38,-12.5,-1.44,-22.25,8.62,-4.62,12.5,-10.5,7.63,1,0,0,1,1,0,0,0,0,0,0,0,1,2,0,1,2,0,2,1,1,0,0,2,2,0,0,1,1,1,0,1,0,0,0,0,2,2,2,0,0.6,0,0.6,1.2,1,0.6,0.2,1.2,0.6,0.75,3.67,3.33,2,0,-1,-1,0.34,10 cents,5 minutes,24 days,Female,Trade School (non-military),72,-0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-1,-1,0,0,-1,-1,-1,0,-1,1,2,0,1,0,-2,0,1,-0.4,-0.6,0.4,0,-0.15,HS_TS +152,R_5OlIcdJP5TxlpQW,67 - 73,American,Male,2,2,2,2,1,0,-3,3,-3,0,3,3,2,-2,3,2,2,2,2,1,2,2,2,0,1,0,0,-3,3,-3,2,5,3,3,2,0,3,5,2,2,2,2,2,0,2,2,2,2,1,0,0,-3,3,-3,0,0,3,3,2,0,3,0,2,2,2,2,2,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0.25,0.25,0.25,0,0,0.25,0.25,0.25,0,0.25,0.25,0,1,1,1,0,0.1875,0.053571429,0.321428571,16,50,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,85.94,68.75,87.5,93.75,93.75,90.62,81.25,-31.25,4.69,-6.25,0,18.75,6.25,-9.38,18.75,0,0,0,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0.4,0.4,0.4,0.2,0,0,0.4,0.2,0.35,0.15,3.33,0,0,5,5,0,3.33,10 cents,5 minutes,24 days,Male,Trade School (non-military),71,0.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0.4,0.4,0,0,0.2,HS_TS +153,R_3gGBNDpfcFEgBvr,60 - 66,American,Female,2,1,3,3,3,1,-2,3,-3,2,3,3,3,2,3,0,2,2,2,-2,3,1,3,3,3,2,2,-3,2,0,2,6,3,3,3,3,3,6,-2,-2,1,0,-3,6,2,0,3,3,1,7,0,-3,2,-1,1,5,3,3,3,0,3,7,2,-2,3,2,-1,5,TRUE,0,76,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,64,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,99,TRUE,0,100,TRUE,1,68,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,76,FALSE,0,100,TRUE,1,100,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,56,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0,0,0,0,0,0,0,0.0576,0,0,0.1024,0.25,0.0001,0.1296,0.25,0.1681,0.25,0,0,1,0.25,0,1,0,0.1936,0.3364,0.5776,0,0,1,1,0.234478571,0.086271429,0.382685714,17,53.13,23,71.88,4,50,6,75,6,75,7,87.5,11,68.75,12,75,86.12,64.12,86.38,97,97,83.75,88.5,-18.75,14.24,14.12,11.38,22,9.5,15,13.5,1,0,0,0,0,1,1,1,3,0,0,0,0,1,0,2,4,1,2,1,0,1,0,0,2,1,1,1,2,1,0,0,0,2,0,2,4,1,0,1,0.2,1.2,0.2,2,0.6,1.2,0.4,1.6,0.9,0.95,4.67,6.33,-5,1,-1,1,-1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,1,-1,0,0,-2,0,0,0,1,-1,0,0,0,-1,0,0,0,0,2,0,-0.4,0,-0.2,0.4,-0.05,C_Ug +154,R_7QVFkMHaSFHI6jL,67 - 73,Canadian,Male,-1,2,3,2,0,0,-1,2,-2,0,1,2,2,-1,1,1,1,1,1,1,1,2,1,0,2,1,0,-2,2,-2,1,1,1,2,2,0,1,1,1,1,1,1,1,1,-1,2,3,2,-2,3,-3,-1,1,0,-1,2,1,1,1,-3,1,3,0,-1,0,1,1,8,TRUE,0,83,TRUE,1,80,TRUE,0,99,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,76,TRUE,1,91,TRUE,1,50,TRUE,1,80,TRUE,0,75,TRUE,0,98,TRUE,1,98,TRUE,0,91,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,1,55,TRUE,0,50,TRUE,1,85,FALSE,1,80,TRUE,1,88,FALSE,1,50,FALSE,1,72,TRUE,0,75,TRUE,1,95,TRUE,1,95,TRUE,1,100,0.0081,0.0144,0,0.0576,0,0.25,0.0225,0.04,1,0.2025,0.0025,0.0004,0.25,0.5625,0.25,0.04,0.25,0.25,0.0784,0.04,0,0.25,0.25,0.8281,0.25,0.25,0.0025,0.6889,0.9801,0,0.5625,0.9604,0.295046429,0.222885714,0.367207143,25,78.13,20,62.5,4,50,5,62.5,6,75,5,62.5,15,93.75,5,31.25,77.06,62.5,71.62,81.62,92.5,80.81,73.31,15.63,14.56,12.5,9.12,6.62,30,-12.94,42.06,2,0,2,2,2,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,3,0,1,2,1,0,1,1,2,0,1,2,1,0,0,1.6,0.4,0.2,0,0.4,1.4,0.8,0.8,0.55,0.85,1,2.67,-2,-1,-2,-7,-1.67,10 cents,5 minutes,47 days,Male,Trade School (non-military),70,0.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,2,0,2,2,0,-3,1,-1,-2,0,0,-1,-1,-1,0,-1,-2,-1,0,0,1.2,-1,-0.6,-0.8,-0.3,HS_TS +155,R_3907jAvTB0WHfsM,60 - 66,Canadian,Male,0,2,1,0,-3,0,-2,1,0,-1,2,1,1,0,1,-1,0,1,0,3,0,2,0,0,-3,8,0,1,0,1,1,8,1,1,1,1,1,8,0,0,0,1,3,5,0,1,1,1,-3,6,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,6,FALSE,1,50,FALSE,0,50,TRUE,0,60,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,64,TRUE,1,76,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,76,TRUE,1,65,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,76,FALSE,1,50,FALSE,1,75,FALSE,1,50,TRUE,1,85,FALSE,0,50,TRUE,1,70,0.0576,0.0576,0.25,0.1296,0.09,0.25,0.25,0.0625,0.25,0.25,0.0225,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.36,0.5625,0.25,0.5776,0.245003571,0.199821429,0.290185714,16,50,22,68.75,4,50,7,87.5,6,75,5,62.5,9,56.25,13,81.25,57.72,50,54.38,61.25,65.25,60.06,55.38,-18.75,-11.03,0,-33.12,-13.75,2.75,3.81,-25.87,0,0,1,0,0,0,3,1,1,2,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,2,1,0,1,2,1,1,0,1,1,0,1,0,3,0.2,1.4,0.4,0.6,0.4,0.8,1,1,0.65,0.8,8,5.67,2,3,2,-1,2.33,10 cents,25 minutes,47 days,Male,Trade School (non-military),60,0,0,0,1,1,0,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,-1,1,-1,0,0,1,0,1,1,-1,-1,-1,1,-1,0,0,0,1,-3,-0.2,0.6,-0.6,-0.4,-0.15,HS_TS +156,R_5KpX417DipbCyIn,39 - 45,Canadian,Female,3,3,2,2,-2,-3,2,1,1,2,2,-3,3,-3,3,-2,-2,-2,1,-3,3,3,2,2,0,0,-2,2,2,0,3,0,2,-3,3,-3,3,0,-1,-2,-1,1,-3,4,3,3,2,3,-3,0,-3,2,1,2,2,0,2,-3,3,-3,3,0,-2,-3,-2,1,-3,2,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,0,70,TRUE,1,50,FALSE,1,55,FALSE,1,100,TRUE,1,65,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,98,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,0,70,TRUE,1,100,0,0.0064,0,0.25,0,0,0,0.25,0.25,0.0001,0.25,0.1225,0.49,0.2025,0.25,1,0,0.25,0.25,0,1,0.25,0.25,0,0.25,0.25,0.49,0,0,0.9604,1,0,0.277339286,0.218935714,0.335742857,24,75,25,78.13,4,50,6,75,7,87.5,8,100,11,68.75,14,87.5,78.09,61.88,83.12,86.12,81.25,77.88,78.31,-3.13,-0.04,11.88,8.12,-1.38,-18.75,9.13,-9.19,0,0,0,0,2,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0.4,0.8,0,0.4,0.4,0.2,0,0.2,0.4,0.2,0,0,0,0,0,2,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,42,1.75,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,1,1,0,1,0,1,0,0,0,0,0,1,-1,1,0,0,0,0.6,0,0.2,0.2,C_Ug +157,R_6tyUS9LOzy8825t,67 - 73,American,Female,2,2,2,0,2,2,0,2,-1,2,2,1,2,1,2,1,0,1,1,0,2,2,2,0,2,2,2,-1,2,0,1,2,2,2,2,1,2,1,0,1,0,1,-1,2,2,2,2,0,2,2,2,0,1,0,2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,2,TRUE,0,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,85,FALSE,1,88,TRUE,1,88,TRUE,1,100,TRUE,1,92,TRUE,1,88,FALSE,1,55,FALSE,1,71,FALSE,0,66,TRUE,0,68,TRUE,1,63,TRUE,1,97,FALSE,1,97,TRUE,0,66,TRUE,0,72,FALSE,1,100,FALSE,0,65,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,70,TRUE,1,68,TRUE,0,70,FALSE,1,100,TRUE,0,94,TRUE,1,82,TRUE,1,83,TRUE,1,100,0,0.1024,0.0009,0.0144,0,0.0144,0.0225,0.0144,0,0.01,0.0324,0.4356,0.0064,0.2025,0.0225,0,0,0.25,0,0.09,0.4225,0.1369,0.5184,0.4624,0.0009,0.49,0.0289,0.9025,0,0.4356,0.8836,0.0841,0.195232143,0.072192857,0.318271429,24,75,24,75,6,75,5,62.5,5,62.5,8,100,14,87.5,10,62.5,82.75,73.12,86.88,79.12,91.88,84.5,81,0,7.75,-1.88,24.38,16.62,-8.12,-3,18.5,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,2,1,2,2,1,0,0.6,0.2,0.8,0,0.4,0.4,1.6,0.4,0.6,1.67,2,0,0,-1,0,-0.33,10 cents,100 minutes,24 days,Female,University - PhD,73,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,1,-1,0,1,0,0,0,-1,0,-1,0,-1,-2,0,0,0.2,-0.2,-0.8,-0.2,grad_prof +158,R_5kGqpY0ZTnPPebw,25 - 31,Canadian,Female,3,3,1,3,3,3,-3,3,-3,3,2,3,3,0,3,3,3,3,3,3,3,3,1,3,3,9,0,-3,3,-3,3,10,2,1,1,0,3,10,1,3,0,3,3,5,3,3,1,3,3,10,0,-3,3,-3,3,3,2,2,2,0,3,5,3,3,3,3,1,10,FALSE,1,74,FALSE,0,82,TRUE,0,100,FALSE,1,88,TRUE,1,87,TRUE,0,71,FALSE,0,73,TRUE,1,86,TRUE,1,86,TRUE,1,65,FALSE,1,85,TRUE,0,100,TRUE,1,61,FALSE,1,91,TRUE,1,81,TRUE,1,70,TRUE,0,67,FALSE,1,99,FALSE,1,61,FALSE,1,54,FALSE,0,74,FALSE,0,100,FALSE,1,90,FALSE,0,89,FALSE,1,100,TRUE,1,81,FALSE,1,73,TRUE,0,100,FALSE,1,72,TRUE,1,62,TRUE,1,77,TRUE,1,94,0.0196,0.0361,0.09,0.5329,0.0036,0.5041,0.7921,0.1225,0.2116,1,0.1444,0.1521,0.0196,0.0225,0.0169,0.6724,0.01,0.0144,1,0,0.5476,0.0361,0.1521,0.0081,0.4489,0.0729,0.0529,0.0676,1,0.0001,0.0784,1,0.291103571,0.2633,0.318907143,17,53.13,22,68.75,7,87.5,5,62.5,6,75,4,50,11,68.75,11,68.75,81.03,79.12,77,85.38,82.62,79.25,82.81,-15.62,12.28,-8.38,14.5,10.38,32.62,10.5,14.06,0,0,0,0,0,3,0,0,0,0,0,2,2,0,0,2,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0.6,0.8,1,0,0.6,0.4,0.4,0.6,0.35,9.67,6,-1,7,5,-5,3.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,0.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,2,0,3,0,-2,0,0,0.4,0.6,0.25,grad_prof +159,R_3qdPz2lU3zQiB3P,25 - 31,American,Male,3,1,3,2,1,3,1,2,2,2,2,1,1,2,2,3,3,3,2,1,1,3,2,0,2,8,1,1,0,2,1,8,1,1,0,1,2,8,2,2,2,1,1,9,1,-1,1,0,3,8,0,0,1,-1,1,7,1,0,0,2,1,8,-1,1,2,-1,1,5,TRUE,0,99,FALSE,0,97,TRUE,0,86,TRUE,0,78,FALSE,0,93,TRUE,0,94,FALSE,0,83,TRUE,1,71,TRUE,1,84,FALSE,0,90,FALSE,1,96,TRUE,0,86,TRUE,1,88,TRUE,0,82,TRUE,1,89,FALSE,0,91,TRUE,0,91,TRUE,0,94,FALSE,1,84,TRUE,0,95,FALSE,0,82,TRUE,1,85,TRUE,0,98,TRUE,1,80,FALSE,1,84,TRUE,1,85,TRUE,0,86,TRUE,0,97,TRUE,0,85,TRUE,1,77,TRUE,1,82,TRUE,1,63,0.0841,0.0225,0.8281,0.6889,0.1369,0.8836,0.04,0.81,0.9025,0.0225,0.0529,0.0144,0.0256,0.0016,0.8649,0.9409,0.9604,0.6084,0.9409,0.0256,0.6724,0.0121,0.0256,0.6724,0.8281,0.7396,0.0324,0.9801,0.7396,0.8836,0.7225,0.7396,0.509967857,0.447471429,0.572464286,23,71.88,13,40.63,5,62.5,2,25,3,37.5,3,37.5,10,62.5,3,18.75,86.72,87,86.75,87.75,85.38,83.75,89.69,31.25,46.09,24.5,61.75,50.25,47.88,21.25,70.94,2,2,1,2,1,2,0,2,0,1,1,0,1,1,0,1,1,1,1,0,2,2,2,2,2,3,1,1,3,1,1,1,1,0,1,4,2,1,3,0,1.6,1,0.6,0.8,2,1.8,0.8,2,1,1.65,8,7.67,0,1,0,4,0.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,27,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,-1,0,-1,-1,-1,1,-3,0,0,-1,0,1,-1,-3,-1,0,-2,0,-0.4,-0.8,-0.2,-1.2,-0.65,C_Ug +160,R_7prnYqlq02LBnad,53 - 59,American,Female,3,2,3,-1,2,1,-3,3,-2,2,2,3,2,2,2,3,2,2,3,2,2,2,3,2,0,3,3,-3,3,-1,0,5,2,1,2,2,2,8,2,2,2,2,3,2,2,2,3,0,0,4,1,-3,0,1,0,5,2,0,2,1,2,3,0,2,2,2,2,5,FALSE,1,59,TRUE,1,100,TRUE,0,100,FALSE,1,87,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,79,TRUE,1,98,FALSE,1,95,TRUE,0,100,TRUE,1,94,TRUE,0,100,TRUE,1,96,TRUE,1,92,TRUE,0,93,TRUE,0,85,FALSE,1,67,TRUE,0,89,TRUE,1,76,TRUE,1,75,TRUE,0,74,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,80,TRUE,0,79,TRUE,0,78,TRUE,1,93,FALSE,0,75,TRUE,1,100,0,0,0.0064,0,0,0,0,0.0004,0.7921,0.0625,0.0049,0.0036,0.6241,0.0025,0.0225,0,0.5476,0.0169,0.6241,1,0.0576,0.0016,0.1089,1,0.8649,0.64,0.5625,0.1681,1,0.7225,0.6084,1,0.372703571,0.148364286,0.597042857,23,71.88,19,59.38,5,62.5,5,62.5,5,62.5,4,50,14,87.5,5,31.25,89.03,84.88,87.5,89.62,94.12,91.44,86.62,12.5,29.65,22.38,25,27.12,44.12,3.94,55.37,1,0,0,3,2,2,0,0,1,2,0,2,0,0,0,1,0,0,1,1,1,0,0,1,2,0,0,3,3,2,0,3,0,1,0,3,0,0,1,0,1.2,1,0.4,0.6,0.8,1.6,0.8,0.8,0.8,1,5.33,4,-1,0,5,-3,1.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),59,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,2,0,2,0,-3,-2,0,0,-1,0,-1,0,-2,0,0,0,1,0.4,-0.6,-0.4,-0.2,-0.2,grad_prof +161,R_6Vt3d1FpDEYtCxH,67 - 73,American,Male,1,1,2,0,1,-1,0,2,-2,1,2,3,3,1,2,2,1,3,3,1,0,2,2,-2,1,3,-2,-2,2,-2,1,2,2,2,2,2,2,2,2,1,2,2,2,3,1,0,2,1,0,3,-2,0,1,-2,-1,3,2,2,2,-2,2,2,1,0,2,2,2,3,TRUE,0,100,TRUE,1,95,TRUE,0,100,FALSE,1,88,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,97,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,100,TRUE,1,61,TRUE,1,100,TRUE,0,91,FALSE,1,82,FALSE,1,88,FALSE,1,100,TRUE,1,99,TRUE,1,98,TRUE,0,62,TRUE,1,98,TRUE,0,72,TRUE,1,97,FALSE,1,50,FALSE,1,98,TRUE,0,97,TRUE,1,100,TRUE,1,93,TRUE,1,100,0,0.0009,0,0,0,0,0.0004,0.0009,0,0.0004,0,0,0.25,0,0.0004,0.0025,0.3844,0.0144,0.0004,0.5184,0.0001,0.1521,0.0144,1,0.8281,0.25,0.0049,1,1,0.0324,0.9409,0.9409,0.262,0.046671429,0.477328571,28,87.5,24,75,8,100,5,62.5,5,62.5,6,75,16,100,8,50,90.97,78.12,93.38,93.25,99.12,92.88,89.06,12.5,15.97,-21.88,30.88,30.75,24.12,-7.12,39.06,1,1,0,2,0,1,2,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0,2,0,1,1,3,0,1,1,1,1,1,0.8,0.6,0.6,0.6,0.6,0.8,1,1,0.65,0.85,2.33,2.67,0,-1,0,0,-0.34,10 cents,5 minutes,15 days,Male,University - Undergraduate,73,1.25,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,1,0,0,1,-1,0,2,-1,0,-2,0,0,0,-2,0,-1,-1,0,0,0,0.2,-0.2,-0.4,-0.4,-0.2,C_Ug +162,R_1u9AK8gy2PrSuRz,60 - 66,Canadian,Female,2,2,2,0,2,-1,0,1,-1,1,2,2,1,0,2,-1,-1,0,0,-1,2,2,2,0,2,4,-1,-1,1,-1,1,4,2,2,2,0,2,4,-1,-1,0,-1,-1,5,2,2,2,0,1,4,-1,-1,1,-1,1,4,2,2,1,-1,2,4,-1,-1,0,-1,-1,5,FALSE,1,95,TRUE,1,99,TRUE,0,94,FALSE,1,50,TRUE,1,86,FALSE,1,95,TRUE,1,95,TRUE,1,97,TRUE,1,81,TRUE,1,98,TRUE,0,94,TRUE,0,86,TRUE,1,100,FALSE,1,94,TRUE,1,50,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,1,72,FALSE,1,100,FALSE,0,76,TRUE,1,97,FALSE,1,92,TRUE,1,96,FALSE,1,100,TRUE,1,93,TRUE,0,86,FALSE,1,96,TRUE,0,100,TRUE,1,100,TRUE,1,91,TRUE,1,80,0.0009,0.0049,0,0.0025,0.04,0.0025,0.0016,0.0004,0,0.0009,0,0,0.0361,0.8836,0.0196,0.0001,0.0064,0.25,0.0016,0,0.5776,0.25,0.0784,0.0036,0.0016,0.7396,0.0081,0.0025,0.8836,1,1,0.7396,0.233121429,0.088657143,0.377585714,17,53.13,25,78.13,6,75,6,75,7,87.5,6,75,15,93.75,10,62.5,90.28,77.88,90.62,96.5,96.12,89.94,90.62,-25,12.15,2.88,15.62,9,21.12,-3.81,28.12,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.15,0.2,4,4,0,0,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,64,0.875,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,-1,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,-0.2,0,0,0,-0.05,C_Ug +163,R_7RvF7lBwedH2yB4,60 - 66,American,Male,1,2,2,-1,-2,0,-2,3,-2,0,1,2,3,1,1,2,2,2,3,1,0,2,2,-2,-2,0,0,-2,3,-2,0,0,1,2,3,1,1,0,2,2,2,2,1,0,0,2,2,-1,-2,0,0,-2,3,-2,0,0,1,2,3,1,1,0,2,2,3,3,1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,100,FALSE,0,99,TRUE,0,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,0,86,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.9801,0,0.36,0.25,0,0.5776,0.25,0,0,0,0.04,0.0625,1,0,0.5625,0,1,1,0.7396,0.6561,1,0.3028,0.172692857,0.432907143,24,75,22,68.75,6,75,5,62.5,5,62.5,6,75,15,93.75,7,43.75,91.62,80,88.25,98.25,100,95.56,87.69,6.25,22.87,5,25.75,35.75,25,1.81,43.94,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0,0.2,0.2,0,0,0.2,0.15,0.1,0,0,0,0,0,0,0,10 cents,25 minutes,36 days,Male,College Diploma/Certificate,61,-0.75,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0.2,0,0,0,0.05,C_Ug +164,R_7EGL2cPMFfL1fUE,67 - 73,Canadian,Male,3,2,2,-1,2,2,-3,3,-3,3,2,1,2,1,3,2,2,2,2,3,3,1,2,-3,2,3,2,-3,2,-2,1,3,3,2,2,0,2,2,1,1,1,0,1,4,3,3,2,1,3,2,2,-3,2,-2,1,2,3,3,2,3,3,2,2,2,2,2,3,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,67,FALSE,0,74,FALSE,1,86,TRUE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,74,TRUE,1,100,FALSE,1,78,TRUE,0,100,TRUE,0,82,FALSE,1,100,TRUE,1,96,TRUE,1,88,FALSE,1,74,TRUE,1,100,TRUE,0,79,TRUE,1,100,TRUE,0,100,FALSE,1,99,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0016,0,0,0,0,0.0196,0,0,0,0.0144,0,0,0,0.0004,0.5476,0,0.0676,0.1089,0.0001,0.6241,0.0016,0.0676,0.6724,1,0.0484,1,0,1,1,1,0.0049,1,0.292057143,0.054178571,0.529935714,27,84.38,23,71.88,6,75,7,87.5,4,50,6,75,15,93.75,8,50,93.25,90.12,87.62,95.88,99.38,95.5,91,12.5,21.37,15.12,0.12,45.88,24.38,1.75,41,0,1,0,2,0,0,0,1,1,2,1,1,0,1,1,1,1,1,2,2,0,1,0,2,1,0,0,1,1,2,1,2,0,2,0,0,0,0,0,0,0.6,0.8,0.8,1.4,0.8,0.8,1,0,0.9,0.65,2.67,2,1,1,0,1,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,1.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,-1,0,0,0,0,0,0,-1,0,-1,1,1,1,1,2,2,-0.2,0,-0.2,1.4,0.25,C_Ug +165,R_3aQuHaDKpIOZR30,67 - 73,American,Female,3,2,3,-2,2,1,-2,2,-2,-1,1,2,1,-1,3,1,2,2,2,-1,3,2,3,-2,2,1,1,-2,2,-1,-1,1,1,1,1,-1,3,1,1,1,2,1,-1,1,3,1,3,1,-1,2,0,-3,0,-2,-2,1,1,2,1,-2,3,0,1,-1,0,2,-1,1,TRUE,0,53,TRUE,1,71,TRUE,0,72,FALSE,1,52,TRUE,1,50,FALSE,1,100,TRUE,1,82,TRUE,1,86,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,73,TRUE,0,100,TRUE,1,50,TRUE,1,60,FALSE,1,50,FALSE,1,60,TRUE,0,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,63,TRUE,1,58,FALSE,1,50,FALSE,1,50,FALSE,1,60,TRUE,1,87,FALSE,0,50,TRUE,1,100,0.0196,0.1764,0.16,0.0324,0,0,0.25,0,0,0.25,0.0169,0.0729,0.25,0.25,0.25,0.0841,0.25,0.2304,0.25,0.3969,0.25,0.25,0.25,1,0.25,0.25,0.25,0.2809,0.5184,0.16,0.16,1,0.256089286,0.136021429,0.376157143,21,65.63,22,68.75,4,50,8,100,4,50,6,75,13,81.25,9,56.25,66.47,52.88,66.62,70.75,75.62,66.69,66.25,-3.12,-2.28,2.88,-33.38,20.75,0.62,-14.56,10,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,1,0,3,3,1,1,2,0,1,0,0,0,1,0,0,3,2,0,0,0,0.2,0.2,0.4,1.4,1,0.2,1,0.2,0.9,1,1,-1,0,1,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),73,0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,-3,-3,-1,-1,-2,1,-1,0,1,0,-1,0,0,-2,-2,1,0,-1.4,-0.8,0,-0.6,-0.7,HS_TS +166,R_3b918O6l0IYvDd7,67 - 73,American,Female,3,3,1,3,3,-1,-3,3,-2,2,2,1,3,-2,3,2,2,2,3,1,3,3,1,-1,3,0,-2,-3,3,1,3,7,2,2,1,1,2,0,1,2,2,2,2,6,3,3,3,3,2,0,1,-3,2,-2,2,0,2,2,3,-2,2,0,0,0,2,3,0,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,51,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.2304,0,0,0,0.16,0,0,0,1,0.1849,0,0.2601,0,0,0.25,1,0.25,1,0,1,1,0,1,0.7396,0.288392857,0.112521429,0.464264286,25,78.13,23,71.88,6,75,6,75,5,62.5,6,75,16,100,7,43.75,90.81,83.38,93.75,93.88,92.25,97.5,84.12,6.25,18.93,8.38,18.75,31.38,17.25,-2.5,40.37,0,0,0,4,0,1,0,0,3,1,0,1,2,3,1,1,0,0,1,1,0,0,2,0,1,2,0,1,0,0,0,1,0,0,1,2,2,0,0,1,0.8,1,1.4,0.6,0.6,0.6,0.4,1,0.95,0.65,2.33,0,0,7,0,6,2.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,67,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,-2,4,-1,-1,0,-1,3,1,0,0,2,3,0,-1,-2,0,1,0,0.2,0.4,1,-0.4,0.3,C_Ug +167,R_6aM6vvxGj0PaJKp,67 - 73,Canadian,Female,-2,2,3,0,3,0,1,3,-2,1,2,1,2,0,2,-2,1,-1,2,-3,-3,1,3,-3,3,1,1,0,3,-2,0,7,2,2,2,-1,2,2,-1,1,-1,0,-2,5,-1,1,3,1,3,2,-2,-2,2,-1,-1,1,2,2,2,-2,2,1,-1,0,-1,0,0,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,0,100,FALSE,1,75,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,92,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,1,0,0,0,0,0,0.25,0,0.25,0,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0,0,0.25,0.25,0,0,0,0.8464,1,0.193175,0.142857143,0.243492857,16,50,25,78.13,6,75,6,75,8,100,5,62.5,14,87.5,11,68.75,81.78,62.5,80.25,90.62,93.75,81.25,82.31,-28.13,3.65,-12.5,5.25,-9.38,31.25,-6.25,13.56,1,1,0,3,0,1,1,0,0,1,0,1,0,1,0,1,0,0,2,1,1,1,0,1,0,2,3,1,1,2,0,1,0,2,0,1,1,0,2,3,1,0.6,0.4,0.8,0.6,1.8,0.6,1.4,0.7,1.1,3.33,1.33,-1,6,1,-2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,2,0,-1,-2,-1,-1,-1,0,0,0,-1,0,0,-1,0,0,-2,0.4,-1.2,-0.2,-0.6,-0.4,C_Ug +168,R_3wNRnLW5pNxtlMB,32 - 38,Canadian,Female,2,3,-3,1,1,-1,1,2,0,1,0,1,3,0,2,0,0,1,2,3,3,3,-3,1,2,8,0,2,2,2,1,7,1,1,3,0,2,6,-2,-2,-3,-2,0,9,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,73,TRUE,1,87,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,75,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,74,0.25,0.0625,0.0169,0.25,0.0676,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.0729,0.25,0.25,0.25,0.25,0.25,0,1,0.25,0.25,1,0.272875,0.236971429,0.308778571,9,28.13,20,62.5,5,62.5,6,75,5,62.5,4,50,8,50,12,75,59.66,52.88,53,65.62,67.12,56.81,62.5,-34.37,-2.84,-9.62,-22,3.12,17.12,6.81,-12.5,1,0,0,0,1,1,1,0,2,0,1,0,0,0,0,2,2,4,4,3,2,3,3,1,1,1,1,2,0,1,0,1,3,0,2,0,0,1,2,3,0.4,0.8,0.2,3,2,1,1.2,1.2,1.1,1.35,7,5,3,2,1,4,2,5 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,0.625,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,-3,-3,-1,0,0,0,-2,2,-1,1,-1,-3,0,-2,2,2,3,2,0,-1.6,-0.2,-1,1.8,-0.25,C_Ug +169,R_3QnfACwTXTNSXlL,67 - 73,Canadian,Male,-1,2,1,-1,1,0,-1,2,-1,1,1,1,1,0,1,1,1,1,1,1,-1,2,1,-2,2,5,1,0,2,-2,1,2,1,1,1,-1,1,1,1,1,1,1,0,6,-2,2,1,0,2,0,0,-1,2,-1,-1,0,2,2,1,2,1,0,2,2,2,2,2,3,FALSE,1,97,TRUE,1,100,FALSE,1,84,FALSE,1,60,FALSE,0,56,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,92,TRUE,1,99,FALSE,1,99,TRUE,0,99,TRUE,1,95,FALSE,1,100,FALSE,0,73,TRUE,1,100,FALSE,1,94,TRUE,0,99,TRUE,0,58,FALSE,1,100,TRUE,1,100,FALSE,0,89,FALSE,1,50,FALSE,0,92,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,76,TRUE,1,92,TRUE,1,50,TRUE,1,100,0,0,0,0.0004,0,0,0.8464,0.0001,0,0.7921,0.0064,0.0025,0.0064,0.0001,0.3136,0,0.25,0.16,0,0,0,0.5329,0.3364,0,0.0036,0.25,0.25,0.0009,0.0256,0.9801,0.5776,0.9801,0.225528571,0.169828571,0.281228571,27,84.38,23,71.88,5,62.5,6,75,6,75,6,75,12,75,11,68.75,87.56,72.75,83.88,97.75,95.88,89.75,85.38,12.5,15.68,10.25,8.88,22.75,20.88,14.75,16.63,0,0,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,2,1,1,0,2,0,1,1,1,1,1,0.4,0.6,0.2,0.2,0.6,0.4,0.8,1,0.35,0.7,2.67,0,5,2,1,3,2.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,69,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,0,1,1,0,1,-2,-1,-1,0,-1,0,-1,-1,-1,-1,0,-0.2,0.2,-0.6,-0.8,-0.35,C_Ug +170,R_32ilka2D1HBpF0Y,60 - 66,Canadian,Female,2,3,3,-1,3,0,1,1,1,1,2,2,2,0,3,1,2,1,2,2,3,3,3,-1,3,7,1,0,2,-1,1,8,1,1,1,1,1,7,1,1,1,2,1,8,3,3,3,1,2,8,1,1,1,1,1,8,1,1,1,1,1,8,1,0,2,0,-1,7,FALSE,1,76,TRUE,1,62,FALSE,1,100,FALSE,1,57,FALSE,0,55,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,50,TRUE,0,83,FALSE,0,50,FALSE,1,52,FALSE,0,54,TRUE,1,100,TRUE,0,54,FALSE,1,100,TRUE,0,54,FALSE,1,91,FALSE,0,56,TRUE,1,100,FALSE,1,61,TRUE,1,100,FALSE,1,75,TRUE,1,100,TRUE,0,60,FALSE,1,95,TRUE,0,56,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.04,0,0,0.0081,0,0,0.25,0.16,0.25,0.3025,0.1444,0.1521,0.1849,0.0025,0.0625,0.3136,0.2916,0.2916,0.2304,0.2916,0.36,0,0.0576,0,0,0.3136,0.6889,0.156996429,0.106571429,0.207421429,24,75,22,68.75,4,50,3,37.5,8,100,7,87.5,12,75,10,62.5,77.53,62.12,64,87.88,96.12,83.56,71.5,6.25,8.78,12.12,26.5,-12.12,8.62,8.56,9,1,0,0,0,0,1,1,1,2,0,1,1,1,1,2,0,1,0,0,1,1,0,0,2,1,1,0,0,0,0,1,1,1,1,2,0,2,1,2,3,0.2,1,1.2,0.4,0.8,0.2,1.2,1.6,0.7,0.95,7.33,8,-1,0,-1,1,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,-2,-1,0,1,1,2,0,0,0,0,0,0,0,-1,-1,-2,-2,-0.6,0.8,0,-1.2,-0.25,C_Ug +171,R_3q3q3Q0nJoJN9XV,60 - 66,American,Male,0,2,2,2,1,2,-2,2,-2,3,3,2,3,-1,3,3,3,3,3,3,1,3,2,1,2,2,3,-1,3,-2,3,1,3,3,2,-1,3,1,3,2,2,2,3,1,1,3,2,3,0,1,2,-2,2,-2,3,1,3,3,3,-2,3,1,3,3,3,3,3,0,FALSE,1,54,TRUE,1,87,FALSE,1,55,FALSE,1,52,TRUE,1,54,FALSE,1,63,TRUE,1,83,TRUE,1,70,TRUE,1,76,FALSE,0,96,FALSE,1,67,TRUE,0,91,TRUE,1,91,TRUE,0,55,TRUE,1,78,FALSE,0,62,TRUE,0,91,TRUE,0,94,FALSE,1,59,TRUE,0,63,TRUE,1,89,FALSE,0,63,TRUE,0,64,TRUE,1,67,TRUE,0,92,TRUE,1,93,TRUE,0,64,TRUE,0,93,FALSE,1,59,TRUE,1,98,FALSE,0,73,TRUE,1,97,0.09,0.0049,0.3844,0.0289,0.0009,0.1369,0.1089,0.9216,0.3969,0.3969,0.0004,0.0081,0.0576,0.1089,0.2116,0.0169,0.4096,0.2304,0.8649,0.8464,0.0121,0.0484,0.1681,0.3025,0.8281,0.4096,0.5329,0.2116,0.2025,0.8836,0.1681,0.8281,0.332589286,0.214685714,0.450492857,11,34.38,19,59.38,6,75,6,75,3,37.5,4,50,12,75,7,43.75,74.78,69.5,76,78.75,74.88,79.81,69.75,-25,15.4,-5.5,1,41.25,24.88,4.81,26,1,1,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,0,1,1,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0.8,0.6,0.4,0.6,0.8,0,0.4,0,0.6,0.3,1.33,1,1,0,0,1,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,66,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,1,1,1,0,0,0,0,1,-1,0,0,1,1,1,0,0,0.6,0,0.6,0.3,C_Ug +172,R_5aelI5mKEHjLTkn,53 - 59,Canadian,Male,2,2,2,0,2,1,0,2,0,2,2,2,2,2,0,0,0,0,0,-2,2,2,2,-2,2,5,0,-1,2,0,2,2,2,1,2,2,1,4,0,1,1,0,0,2,2,2,2,0,2,4,1,0,1,0,1,3,2,1,2,2,1,3,1,0,0,1,1,2,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,80,TRUE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.04,0,0.25,0,0,0,0,0.25,1,0,0.25,0.25,0,0.5625,0,0,1,0,0,0.25,0,0.25,1,1,1,1,0.289375,0.145714286,0.433035714,25,78.13,21,65.63,5,62.5,6,75,5,62.5,5,62.5,15,93.75,6,37.5,89.22,81.25,93.75,90.62,91.25,98.75,79.69,12.5,23.59,18.75,18.75,28.12,28.75,5,42.19,0,0,0,2,0,1,1,0,0,0,0,1,0,0,1,0,1,1,0,2,0,0,0,0,0,0,0,1,0,1,0,1,0,0,1,1,0,0,1,3,0.4,0.4,0.4,0.8,0,0.4,0.4,1,0.5,0.45,3.67,3.33,1,-1,1,0,0.34,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),58,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,2,0,1,1,-1,0,-1,0,0,0,0,0,-1,1,1,-1,-1,0.4,0,0,-0.2,0.05,grad_prof +173,R_7j5jomYdBGGQDa9,25 - 31,American,Male,2,3,2,1,3,2,0,2,-2,2,3,2,3,2,3,2,2,2,2,1,2,2,3,1,2,10,1,1,0,2,1,9,2,1,1,1,1,6,-1,-1,0,-1,0,9,3,3,2,3,3,10,2,1,2,3,3,9,2,3,3,2,2,9,1,2,2,1,2,8,FALSE,1,100,TRUE,1,51,FALSE,1,52,FALSE,1,50,FALSE,0,50,TRUE,0,63,FALSE,0,57,TRUE,1,93,TRUE,1,70,TRUE,1,88,FALSE,1,71,TRUE,0,87,TRUE,1,70,FALSE,1,75,TRUE,1,55,TRUE,1,76,TRUE,0,51,TRUE,0,73,FALSE,1,70,FALSE,1,81,TRUE,1,88,TRUE,1,83,FALSE,1,89,TRUE,1,98,FALSE,1,83,TRUE,1,75,FALSE,1,52,FALSE,1,90,TRUE,0,81,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0049,0.0625,0.0576,0.3249,0,0.3969,0.0004,0.0144,0.0361,0.0289,0,0.09,0.09,0.0841,0.25,0.2401,0.0121,0.25,0.01,0.0289,0.0144,0.2025,0.09,0.0625,0.2601,0.2304,0,0,0.2304,0.5329,0.6561,0.7569,0.163146429,0.106642857,0.21965,25,78.13,25,78.13,8,100,4,50,6,75,7,87.5,14,87.5,11,68.75,75.69,64.88,74,79.25,84.62,78.38,73,0,-2.44,-35.12,24,4.25,-2.88,-9.12,4.25,0,1,1,0,1,1,1,2,4,1,1,1,2,1,2,3,3,2,3,1,1,0,0,2,0,0,1,0,5,1,1,1,0,0,1,1,0,0,1,1,0.6,1.8,1.4,2.4,0.6,1.4,0.6,0.6,1.55,0.8,8.33,9.33,0,0,-3,1,-1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),29,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,1,1,-2,1,1,0,2,-1,0,0,0,2,1,1,2,3,2,2,0,0,0.4,0.8,1.8,0.75,grad_prof +174,R_3OpLNshcHuBpHF9,46 - 52,Canadian,Female,2,0,0,2,1,2,0,2,1,0,2,0,1,0,-1,2,0,1,0,-2,2,1,2,2,2,5,2,-1,2,-1,-1,5,2,2,2,0,-1,5,-1,-3,-2,-3,-2,5,1,1,0,2,1,5,0,0,0,0,0,5,1,1,1,0,-2,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,16,50,16,50,3,37.5,6,75,4,50,3,37.5,6,37.5,10,62.5,50,50,50,50,50,50,50,0,0,12.5,-25,0,12.5,12.5,-12.5,0,1,2,0,1,0,1,0,2,1,0,2,1,0,0,3,3,3,3,0,1,1,0,0,0,2,0,2,1,0,1,1,0,0,1,2,0,1,0,2,0.8,0.8,0.6,2.4,0.4,1,0.6,1,1.15,0.75,5,5,0,0,0,0,0,20 cents,100 minutes,24 days,Female,University - Undergraduate,49,-0.125,0,0,0,0,1,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,-1,0,2,0,1,-2,1,-2,1,1,-1,1,1,0,-1,1,3,2,3,-2,0.4,-0.2,0,1.4,0.4,C_Ug +175,R_72tu5iEDLN846PN,60 - 66,American,Female,3,3,3,3,3,0,-1,2,1,1,3,3,2,-1,1,3,3,3,3,3,2,2,2,2,2,0,-1,-2,1,-1,0,2,2,2,-1,2,2,5,1,1,1,1,1,4,3,3,3,3,3,1,-1,-2,0,1,-1,1,1,2,1,0,2,1,2,2,2,2,2,1,TRUE,0,93,FALSE,0,78,FALSE,1,92,FALSE,1,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,99,FALSE,1,75,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,86,TRUE,1,100,TRUE,0,86,TRUE,0,94,TRUE,0,88,TRUE,0,78,TRUE,1,91,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,79,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,61,TRUE,1,100,0,0,0,0,0,0,0,0.0001,0.6084,0,0,0.0169,0.0289,0.0625,0,0.6084,0.8281,0.0841,1,1,0.0081,0.0196,0.7744,1,0.7396,0.6241,0.3721,0.8649,0.0064,0.8836,1,1,0.411792857,0.159814286,0.663771429,21,65.63,18,56.25,4,50,5,62.5,4,50,5,62.5,14,87.5,4,25,91.62,77.62,94.38,98.25,96.25,92.81,90.44,9.38,35.37,27.62,31.88,48.25,33.75,5.31,65.44,1,1,1,1,1,1,1,1,2,1,1,1,3,3,1,2,2,2,2,2,0,0,0,0,0,1,1,2,0,2,2,1,1,1,1,1,1,1,1,1,1,1.2,1.8,2,0,1.2,1.2,1,1.5,0.85,2.33,1,-1,1,4,3,1.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,1,1,1,1,0,0,-1,2,-1,-1,0,2,2,0,1,1,1,1,1,1,0,0.6,1,0.65,C_Ug +176,R_7Hz5Ri71s7av0sI,46 - 52,Canadian,Female,3,1,1,3,2,-1,-2,-1,-1,1,0,-1,2,-3,2,2,2,2,3,2,3,1,1,3,2,1,-2,-2,-1,1,-1,1,0,-1,2,-3,2,1,-1,-1,-1,-1,0,4,3,1,1,3,2,1,-2,-2,-1,-1,1,1,0,-1,2,-3,2,1,2,2,2,2,2,1,FALSE,1,100,TRUE,1,69,FALSE,1,100,TRUE,0,51,TRUE,1,88,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,92,FALSE,0,63,FALSE,1,54,TRUE,0,91,TRUE,1,94,FALSE,1,96,TRUE,1,71,TRUE,1,96,TRUE,0,55,TRUE,0,96,TRUE,0,53,FALSE,1,51,TRUE,1,98,TRUE,1,100,FALSE,1,59,TRUE,1,52,FALSE,1,100,TRUE,1,58,FALSE,1,51,FALSE,1,100,TRUE,0,64,TRUE,1,91,TRUE,1,55,TRUE,1,100,0,0.1764,0.0016,0.0004,0,0,0.2304,0.3969,0.2401,0,0.0081,0.0036,0.0064,0.2116,0.0144,0.0961,0.1681,0.2601,0,0,0.0004,0.0841,0.2809,0.0016,0.3025,0.2401,0.2025,0,0,0.9216,0.4096,0.8281,0.175257143,0.116842857,0.233671429,20,62.5,25,78.13,6,75,6,75,6,75,7,87.5,15,93.75,10,62.5,79.56,62,82.25,88.88,85.12,82.81,76.31,-15.63,1.43,-13,7.25,13.88,-2.38,-10.94,13.81,0,0,0,0,0,1,0,0,2,2,0,0,0,0,0,3,3,3,4,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,3,0,0.2,0,0.2,1,0.1,1,1,0,0,0,3,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,52,1.375,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,3,3,3,3,2,0,0.8,0,2.8,0.9,C_Ug +177,R_7KwWl3ph6J35kk1,32 - 38,Canadian,Female,3,3,3,3,3,0,-1,2,1,1,1,2,2,1,2,1,2,1,1,0,3,3,3,3,3,0,0,-1,2,-1,1,2,1,2,2,1,1,1,-2,0,-1,-2,-1,0,3,3,3,3,3,1,0,-2,2,-1,1,2,1,2,2,1,2,0,2,2,2,2,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,55,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,70,FALSE,1,100,FALSE,0,90,FALSE,0,95,TRUE,1,90,0,0,0,0,0.01,0,0,0,0,0,0.81,0,0,1,0,0,0,0.36,0.09,0,0.49,1,0,0,0.2025,1,0.9025,0,0.64,1,0,0,0.268035714,0.155714286,0.380357143,22,68.75,23,71.88,3,37.5,7,87.5,7,87.5,6,75,12,75,11,68.75,94.06,94.38,89.38,100,92.5,96.56,91.56,-3.13,22.18,56.88,1.88,12.5,17.5,21.56,22.81,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,3,2,2,3,1,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,1,1,1,0,0.4,0.2,2.2,0,0.6,0,0.8,0.7,0.35,1,1,-1,0,1,-2,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,37,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,2,2,1,2,0,0,-0.2,0.2,1.4,0.35,C_Ug +178,R_6VOqOlFTMz7RiZR,67 - 73,Canadian,Male,1,3,3,2,-3,1,-1,2,2,3,2,2,3,1,3,0,-1,-1,1,-1,1,3,3,1,-3,2,1,-1,2,1,1,4,2,2,2,2,2,3,-1,-1,-2,1,-1,2,1,3,3,2,-3,2,-1,1,1,-1,-1,5,0,0,1,0,1,6,0,-1,-2,1,-1,5,TRUE,0,100,TRUE,1,100,FALSE,1,69,TRUE,0,100,TRUE,1,100,TRUE,0,72,TRUE,1,100,TRUE,1,100,FALSE,0,63,TRUE,1,83,TRUE,0,69,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,92,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,75,TRUE,1,76,TRUE,1,100,TRUE,0,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,79,FALSE,1,65,TRUE,0,82,TRUE,1,100,TRUE,1,68,TRUE,1,100,0,0,0,0,0,0.5184,0,0.0289,0.5625,0,0,0,0.3969,0.4761,0,0,0.3721,1,0.1225,0,0.0576,0.0064,1,1,1,0.6241,0.1024,1,0.0961,1,0.6724,1,0.394157143,0.239635714,0.548678571,16,50,18,56.25,3,37.5,4,50,5,62.5,6,75,15,93.75,3,18.75,89.19,83.88,86.38,97.88,88.62,92.62,85.75,-6.25,32.94,46.38,36.38,35.38,13.62,-1.13,67,0,0,0,1,0,0,0,0,1,2,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,2,2,1,3,4,2,2,2,1,2,0,0,1,0,0,0.2,0.6,0.6,0.4,0,2.4,1.8,0.2,0.45,1.1,3,4.33,0,-1,-3,-3,-1.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,72,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,0,1,0,-2,-2,-1,-2,-2,-2,-2,-1,0,-1,1,0,0,0,0,0.2,-1.8,-1.2,0.2,-0.65,C_Ug +179,R_1nr8rXNvKWOPJUa,46 - 52,American,Female,3,2,1,2,3,-2,1,3,-1,2,2,3,1,0,2,1,2,2,1,3,3,3,0,0,1,9,3,-3,3,0,3,10,3,3,2,2,2,8,3,3,3,3,3,8,3,3,-3,2,3,9,2,-2,3,-3,1,9,3,3,0,0,2,10,2,2,2,2,3,10,FALSE,1,100,FALSE,0,79,TRUE,0,100,FALSE,1,77,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,1,73,FALSE,0,72,TRUE,1,100,TRUE,0,96,TRUE,0,100,TRUE,1,90,FALSE,1,67,TRUE,1,100,TRUE,1,100,TRUE,0,89,TRUE,0,100,FALSE,1,85,FALSE,1,59,FALSE,0,66,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,66,TRUE,0,100,TRUE,0,100,TRUE,1,91,FALSE,0,66,TRUE,1,89,0.0729,0.0064,0,0,0.0121,0.8281,0,0,0.1681,0,0.0081,0.01,0.5184,0.9216,0,0.6241,1,0.0529,1,0,0.4356,0,0.0225,0.1089,0.7921,0.1156,0.4356,0,1,1,1,1,0.394775,0.295957143,0.493592857,23,71.88,19,59.38,4,50,3,37.5,7,87.5,5,62.5,12,75,7,43.75,89,80.12,90.62,94.88,90.38,88.62,89.38,12.5,29.62,30.12,53.12,7.38,27.88,13.62,45.63,0,1,1,2,2,5,4,0,1,1,1,0,1,2,0,2,1,1,2,0,0,1,4,0,0,4,3,0,2,1,1,0,1,0,0,1,0,0,1,0,1.2,2.2,0.8,1.2,1,2,0.4,0.4,1.35,0.95,9,9.33,0,1,-2,-2,-0.33,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),51,0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,-3,2,2,1,1,0,-1,0,0,0,0,2,0,1,1,1,1,0,0.2,0.2,0.4,0.8,0.4,grad_prof +180,R_1lavWYwMBcrhkBT,67 - 73,American,Male,2,1,2,-1,2,0,-2,2,-2,2,1,-1,2,0,2,1,2,2,2,0,3,2,2,-2,3,2,2,-2,2,-2,2,2,1,0,2,2,2,2,1,2,2,2,-1,2,2,2,2,1,2,1,0,-2,2,0,2,2,0,-2,2,-2,2,2,0,0,2,2,-1,3,TRUE,0,81,FALSE,0,80,TRUE,0,90,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,FALSE,0,50,FALSE,1,81,TRUE,0,81,TRUE,1,81,FALSE,1,100,FALSE,0,81,TRUE,1,81,FALSE,1,100,TRUE,0,80,FALSE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,91,FALSE,1,81,FALSE,0,91,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,50,TRUE,1,100,0,0,0.0361,0,0,0,0.8281,0.25,0,0.0081,1,0.0361,0.16,0.0361,0.0361,0.64,0.0361,0.25,0,0.25,0,0.6561,0.0196,0,0,0.25,0.25,0.6561,0.81,0.64,0,0.6561,0.266732143,0.234328571,0.299135714,25,78.13,22,68.75,5,62.5,8,100,5,62.5,4,50,11,68.75,11,68.75,83.62,67.25,92.88,81.5,92.88,84.12,83.12,9.38,14.87,4.75,-7.12,19,42.88,15.37,14.37,1,1,0,1,1,2,0,0,0,0,0,1,0,2,0,0,0,0,0,1,0,1,0,2,0,0,0,0,2,0,1,1,0,2,0,1,2,0,0,1,0.8,0.4,0.6,0.2,0.6,0.4,0.8,0.8,0.5,0.65,2,1.67,1,0,0,-1,0.33,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),70,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,0,-1,1,2,0,0,-2,0,-1,0,0,0,0,-1,-2,0,0,0,0.2,0,-0.2,-0.6,-0.15,grad_prof +181,R_5hEr8txNV8G6XyV,67 - 73,Canadian,Female,-2,-2,2,-1,-3,-2,2,2,2,-1,1,2,2,1,0,1,-1,1,1,-1,-2,-2,1,-2,-3,2,-2,1,2,2,-2,1,-1,2,1,1,-1,1,-2,-2,-1,0,-2,1,-3,-2,1,1,-3,0,-3,1,0,0,-3,1,1,2,-1,-1,-1,1,1,-1,1,1,-1,0,TRUE,0,50,FALSE,0,50,FALSE,1,84,FALSE,1,50,FALSE,0,50,FALSE,1,76,TRUE,1,80,TRUE,1,90,FALSE,0,50,TRUE,1,62,TRUE,0,50,FALSE,1,65,TRUE,1,51,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,72,TRUE,1,91,FALSE,1,54,FALSE,1,75,TRUE,0,86,TRUE,1,85,FALSE,0,50,TRUE,1,97,0.01,0.0081,0.25,0.04,0.0009,0.0576,0.25,0.1444,0.25,0.25,0.0225,0.2401,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.5184,0.25,0.25,0.25,0.25,0.25,0.2116,0.25,0.25,0.0256,0.0625,0.7396,0.1225,0.221721429,0.193964286,0.249478571,15,46.88,19,59.38,3,37.5,5,62.5,5,62.5,6,75,8,50,11,68.75,62.28,50.5,63.75,66.25,68.62,62.88,61.69,-12.5,2.9,13,1.25,3.75,-6.38,12.88,-7.06,0,0,1,1,0,0,1,0,0,1,2,0,1,0,1,3,1,2,1,1,1,0,1,2,0,1,1,2,2,2,0,0,3,2,1,0,0,0,0,0,0.4,0.4,0.8,1.6,0.8,1.6,1.2,0,0.8,0.9,1.33,0.67,2,0,0,1,0.66,10 cents,100 minutes,47 days,Female,High School (or equivalent),69,0.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-1,0,0,-1,0,-1,0,-2,-2,-1,2,0,-2,-2,0,3,1,2,1,1,-0.4,-1.2,-0.4,1.6,-0.1,HS_TS +182,R_3gOW8RvlAJODhim,67 - 73,Canadian,Male,-1,3,-1,1,2,0,0,2,-3,0,1,2,2,0,2,0,0,1,2,1,-1,3,-1,0,3,2,1,-2,2,-3,0,1,1,2,2,1,3,0,1,0,1,0,1,2,-1,3,-1,2,0,6,0,0,-1,-3,0,2,1,2,2,-3,3,1,0,-2,1,1,1,7,FALSE,1,53,TRUE,1,50,TRUE,0,62,TRUE,0,50,TRUE,1,53,FALSE,1,50,FALSE,0,64,TRUE,1,96,TRUE,1,50,TRUE,1,100,FALSE,1,68,FALSE,1,87,TRUE,1,100,FALSE,1,69,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,62,FALSE,1,100,TRUE,1,62,TRUE,1,85,FALSE,1,50,TRUE,1,63,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,71,FALSE,0,50,TRUE,1,50,TRUE,1,100,0.0016,0,0,0.4096,0,0.25,0.1369,0,0,0.0225,0.25,0,0.25,0.1024,0.2209,0.25,0.25,0.25,0,1,0.1444,0.25,0.1444,0.0961,0.25,0.25,0.25,0.2209,0.3844,0,0.5041,0.0169,0.196210714,0.141621429,0.2508,17,53.13,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,71.72,53.75,67,83.88,82.25,73.31,70.12,-21.87,-3.28,-21.25,-8,8.88,7.25,-14.19,7.62,0,0,0,1,1,1,2,0,0,0,0,0,0,1,1,1,0,0,2,0,0,0,0,1,2,0,0,3,0,0,0,0,0,3,1,0,2,0,1,0,0.4,0.6,0.4,0.6,0.6,0.6,0.8,0.6,0.5,0.65,1,3,-4,-1,-1,-5,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,71,0.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,-1,1,2,-3,0,0,0,0,0,-2,0,1,-2,0,1,0,-0.2,0,-0.4,0,-0.15,C_Ug +183,R_6DOx4ZWfqkOgT71,53 - 59,American,Female,1,3,3,3,3,-1,0,1,1,2,0,-1,2,1,1,-2,-2,-2,-2,-3,3,3,3,1,3,7,0,1,-1,-2,3,5,-1,-1,3,3,3,3,-1,0,1,-2,-2,4,3,3,3,3,3,2,-2,1,-1,1,1,3,1,-2,2,-2,2,2,0,1,1,1,-2,6,FALSE,1,83,TRUE,1,100,TRUE,0,87,TRUE,0,52,TRUE,1,95,FALSE,1,98,TRUE,1,87,TRUE,1,95,TRUE,1,89,TRUE,1,83,TRUE,0,83,TRUE,0,98,TRUE,1,95,FALSE,1,82,TRUE,1,77,TRUE,1,89,FALSE,1,76,TRUE,0,93,FALSE,1,83,FALSE,1,100,FALSE,0,73,TRUE,1,90,FALSE,1,69,TRUE,1,83,TRUE,0,81,TRUE,1,63,TRUE,0,73,FALSE,1,71,TRUE,0,69,TRUE,1,76,FALSE,0,74,TRUE,1,100,0.0025,0.1369,0.0121,0.0169,0,0.0004,0.0289,0.0289,0,0.01,0.0576,0.0025,0.0121,0.6889,0.0025,0,0.0961,0.2704,0.0841,0.6561,0.5329,0.0529,0.0289,0.0324,0.0576,0.5329,0.5476,0.0289,0.7569,0.8649,0.4761,0.9604,0.243246429,0.085592857,0.4009,26,81.25,22,68.75,4,50,6,75,6,75,6,75,14,87.5,8,50,83.34,78.88,84.38,82.75,87.38,85.56,81.12,12.5,14.59,28.88,9.38,7.75,12.38,-1.94,31.12,2,0,0,2,0,1,1,2,3,1,1,0,1,2,2,1,2,3,0,1,2,0,0,0,0,1,1,2,0,1,1,1,0,3,1,2,3,3,3,1,0.8,1.6,1.2,1.4,0.4,1,1.2,2.4,1.25,1.25,5,2.33,5,2,1,-2,2.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,53,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,2,0,0,0,0,3,0,0,-1,1,-1,1,-1,-1,0,-3,0,0.4,0.6,0,-1,0,C_Ug +184,R_1TooM3xgnfa4iAN,67 - 73,American,Female,1,0,1,1,3,-3,-2,2,1,0,3,3,3,-2,3,2,2,3,3,2,2,0,0,0,3,5,-3,-3,3,0,0,1,3,3,3,-2,3,0,2,2,2,2,2,2,0,-2,0,2,2,3,-3,-3,0,1,0,5,3,3,3,-3,3,1,2,2,3,3,2,1,TRUE,0,77,TRUE,1,100,FALSE,1,100,FALSE,1,56,FALSE,0,58,FALSE,1,85,TRUE,1,90,TRUE,1,96,TRUE,1,87,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,92,TRUE,1,57,TRUE,1,100,FALSE,1,75,FALSE,1,97,TRUE,0,71,FALSE,1,82,FALSE,0,61,TRUE,1,94,FALSE,1,98,TRUE,1,100,FALSE,1,99,TRUE,1,97,TRUE,0,67,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,68,TRUE,1,92,0.0016,0.0009,0,0.01,0.0064,0.0225,0,0,0.0324,0.0036,0,0,0.0169,0,0.3364,0,0.0004,0.1936,0.0025,0.0001,0.3721,0.1849,0.5041,0.8464,0.0625,0.4489,0.1024,0.5929,0,0.0009,1,1,0.204639286,0.043728571,0.36555,13,40.63,24,75,6,75,5,62.5,6,75,7,87.5,14,87.5,10,62.5,87.31,75.75,83.62,93.25,96.62,87.5,87.12,-34.37,12.31,0.75,21.12,18.25,9.12,0,24.62,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,0,1,2,1,1,1,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0.6,0.6,0,0.4,1.2,0.6,0.2,0,0.4,0.5,2,3,2,-4,-1,1,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,71,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,-2,0,0,-1,0,0,-1,1,0,0,0,0,-1,0,0,0,1,1,0,-0.6,0,-0.2,0.4,-0.1,C_Ug +185,R_1EJn0lGnt7PpQmB,60 - 66,Canadian,Male,2,3,3,1,3,-1,-1,1,0,1,3,-3,3,1,3,-1,1,-1,-1,-3,2,3,3,3,3,2,-2,-1,1,2,1,3,3,-3,3,1,3,2,1,-3,1,0,3,9,2,3,3,1,2,2,-3,-3,1,-3,0,1,3,-3,3,1,2,2,-3,1,-1,-1,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,60,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,75,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,66,FALSE,1,80,TRUE,1,53,FALSE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,58,TRUE,1,50,TRUE,1,100,0,0.2209,0,0,0,0,0.1156,0,0,0.04,0.1764,0,0.25,0.25,0,0,0,0.25,0,0.04,0.25,0.25,0.25,0.25,0.25,0,0.25,0,0.36,0.25,0.25,0.0625,0.126589286,0.077285714,0.175892857,27,84.38,27,84.38,6,75,6,75,8,100,7,87.5,14,87.5,13,81.25,75.69,62.5,81.25,76.62,82.38,78.56,72.81,0,-8.69,-12.5,6.25,-23.38,-5.12,-8.94,-8.44,0,0,0,2,0,1,0,0,2,0,0,0,0,0,0,2,4,2,1,6,0,0,0,0,1,2,2,0,3,1,0,0,0,0,1,2,0,0,0,0,0.4,0.6,0,3,0.2,1.6,0.2,0.4,1,0.6,2.33,1.67,0,2,0,4,0.66,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,65,1,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,2,-1,-1,-2,0,-1,-1,0,0,0,0,-1,0,4,2,1,6,0.2,-1,-0.2,2.6,0.4,C_Ug +186,R_5BP5IvVmlpPoyuR,60 - 66,American,Female,-2,0,3,3,2,-2,0,1,0,0,2,1,2,-1,1,1,1,2,2,1,-2,0,3,2,3,4,-2,0,1,0,0,4,2,1,2,-1,1,3,1,1,1,1,1,5,-2,0,3,3,2,2,-2,0,1,0,0,2,2,1,2,-1,1,2,1,1,1,2,1,3,TRUE,0,88,TRUE,1,81,TRUE,0,89,FALSE,1,50,TRUE,1,50,FALSE,1,91,TRUE,1,87,TRUE,1,96,TRUE,1,83,TRUE,1,50,FALSE,1,50,TRUE,0,82,TRUE,1,73,TRUE,0,97,TRUE,1,50,TRUE,1,98,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,81,FALSE,1,50,TRUE,1,50,FALSE,1,82,TRUE,1,84,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,80,FALSE,0,50,TRUE,1,83,0.0016,0.0256,0.0004,0.0169,0.0289,0.0081,0.25,0.25,0.25,0.0361,0.04,0.0729,0.0289,0.25,0.25,0.0361,0.25,0.25,0.25,0.0324,0.25,0.25,0.25,0.9409,0.25,0.25,0.25,0.7744,0.7921,0.25,0.25,0.6724,0.266542857,0.142928571,0.390157143,25,78.13,23,71.88,7,87.5,6,75,5,62.5,5,62.5,15,93.75,8,50,67.97,58,62.12,77.38,74.38,71.62,64.31,6.25,-3.91,-29.5,-12.88,14.88,11.88,-22.13,14.31,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0,0.4,0,0,0,0.2,0.2,0.05,3.67,2,2,2,1,2,1.67,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,0.75,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0.4,0,0,0.2,0.15,grad_prof +187,R_3zDeRIbcpMwUQ13,67 - 73,Canadian,Male,1,1,3,-2,-2,-2,-1,2,3,-2,1,2,-1,1,1,-2,-2,-1,-1,-1,2,2,-1,-1,2,5,-2,0,-2,3,1,5,2,1,2,3,1,6,-1,-3,-2,-2,0,8,2,1,3,2,-2,4,-3,-3,-3,3,-1,4,1,2,-3,-3,1,4,-1,-2,-1,-1,-1,2,TRUE,0,82,TRUE,1,78,TRUE,0,100,FALSE,1,77,FALSE,0,69,TRUE,0,69,FALSE,0,100,TRUE,1,88,FALSE,0,58,TRUE,1,98,TRUE,0,82,FALSE,1,98,TRUE,1,100,TRUE,0,100,TRUE,1,71,TRUE,1,100,FALSE,1,61,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,80,TRUE,1,97,FALSE,1,76,TRUE,1,100,TRUE,0,67,TRUE,1,100,TRUE,0,72,FALSE,1,68,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0144,0,0,1,0,0.4761,0,0.0004,0,0.0009,0,0,0.3364,0.6724,0.4761,0.0484,0.0576,0.0529,0.1024,0.4489,0.04,0.0841,0.0081,1,0.1521,0.5184,0,0.6724,1,1,1,0.0004,0.291,0.151514286,0.430485714,14,43.75,20,62.5,5,62.5,5,62.5,3,37.5,7,87.5,13,81.25,7,43.75,86.94,78.62,81.88,93,94.25,89.94,83.94,-18.75,24.44,16.12,19.38,55.5,6.75,8.69,40.19,1,1,4,1,4,0,1,4,0,3,1,1,3,2,0,1,1,1,1,1,1,0,0,4,0,1,2,5,0,1,0,0,2,4,0,1,0,0,0,0,2.2,1.6,1.4,1,1,1.8,1.2,0.2,1.55,1.05,5.33,4,1,1,2,6,1.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,1.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,1,4,-3,4,-1,-1,-1,0,2,1,1,1,-2,0,0,1,1,1,1,1.2,-0.2,0.2,0.8,0.5,C_Ug +188,R_6rrnCccLen5H6KZ,46 - 52,Canadian,Male,1,2,2,-3,3,1,0,1,-2,3,-1,0,3,1,1,-1,0,0,1,-3,2,3,3,-3,3,5,2,0,2,-2,3,1,-1,0,3,3,0,6,-2,0,0,-1,-2,6,1,3,3,0,3,2,2,-1,0,-1,3,3,-1,0,3,0,1,2,0,0,0,0,0,3,FALSE,1,100,TRUE,1,90,FALSE,1,50,FALSE,1,80,TRUE,1,100,FALSE,1,99,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,90,TRUE,1,95,TRUE,1,100,FALSE,1,80,FALSE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0001,0,0.0001,0,0.0025,0,0,1,1,0,0,0,0.01,0,0.04,1,0.04,0,0.0025,0,0.01,0.04,0,0,0,0.25,0.01,1,1,0.193039286,0.146614286,0.239464286,16,50,27,84.38,8,100,6,75,8,100,5,62.5,14,87.5,13,81.25,95.25,95.62,97.38,94.25,93.75,98.69,91.81,-34.38,10.87,-4.38,22.38,-5.75,31.25,11.19,10.56,1,1,1,0,0,1,0,1,0,0,0,0,0,2,1,1,0,0,2,1,0,1,1,3,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,3,0.6,0.4,0.6,0.8,1,0.8,0.2,1,0.6,0.75,4,2.33,3,-2,4,3,1.67,10 cents,5 minutes,47 days,Male,High School (or equivalent),49,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,0,0,-3,0,0,-1,0,-1,0,0,0,0,1,1,0,0,0,1,-2,-0.4,-0.4,0.4,-0.2,-0.15,HS_TS +189,R_6S8ENIP57PJHIsp,60 - 66,Canadian,Male,1,1,3,0,2,-1,1,2,1,1,0,-1,1,0,2,-1,-1,1,-1,-3,3,2,3,2,2,2,-2,1,1,1,1,2,-1,-1,1,0,2,2,-1,0,-1,0,-3,3,2,2,3,2,1,3,-1,1,1,1,1,4,0,0,1,0,2,4,-3,-2,-2,-1,-3,7,TRUE,0,85,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,60,FALSE,1,50,TRUE,1,58,TRUE,1,62,FALSE,0,50,FALSE,0,50,FALSE,1,67,TRUE,0,50,TRUE,1,50,FALSE,1,90,TRUE,1,50,TRUE,1,91,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,89,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,86,TRUE,0,55,TRUE,1,74,TRUE,0,50,FALSE,1,70,TRUE,0,59,FALSE,0,66,FALSE,0,50,TRUE,1,96,0.1444,0.0676,0.0081,0.1764,0.0016,0.25,0.0196,0.25,0.0121,0.25,0.4356,0.25,0.25,0.1089,0.16,0.04,0.25,0.25,0.09,0.3025,0.25,0.25,0.25,0.01,0.25,0.25,0.25,0.7225,0.25,0.25,0.3481,0.25,0.223246429,0.180557143,0.265935714,23,71.88,19,59.38,5,62.5,5,62.5,3,37.5,6,75,10,62.5,9,56.25,62.12,55.88,58.12,64,70.5,63.94,60.31,12.5,2.74,-6.62,-4.38,26.5,-4.5,1.44,4.06,2,1,0,2,0,1,0,1,0,0,1,0,0,0,0,0,1,2,1,0,1,1,0,2,1,0,0,1,0,0,0,1,0,0,0,2,1,3,0,0,1,0.4,0.2,0.8,1,0.2,0.2,1.2,0.6,0.65,2,3.67,-1,-2,-2,-4,-1.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,61,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,1,0,0,0,-1,1,0,0,0,0,1,-1,0,0,0,-2,0,-1,1,0,0,0.2,0,-0.4,-0.05,C_Ug +190,R_7KZu4HZPAvniCUw,60 - 66,American,Female,2,3,2,1,3,0,-2,2,-1,1,2,1,2,1,2,1,1,1,1,-1,2,3,2,1,3,4,0,-2,2,-1,1,4,2,2,2,2,1,6,0,1,1,1,-1,6,2,3,2,2,1,3,-1,-2,2,-1,0,5,1,1,1,0,2,2,1,2,1,1,1,5,TRUE,0,94,TRUE,1,100,TRUE,0,100,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,93,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,90,TRUE,1,97,FALSE,1,92,TRUE,0,100,TRUE,0,85,FALSE,1,100,TRUE,1,100,TRUE,1,96,TRUE,0,100,TRUE,1,100,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,0,0,0.0009,0,0,0,0,0,0,0.0016,0,0,0,0.0049,0,0,1,0.64,0.64,0.9216,0,0.01,0.7225,1,0.0064,1,0.0064,0.8836,1,1,1,1,0.387035714,0.117607143,0.656464286,25,78.13,20,62.5,5,62.5,6,75,4,50,5,62.5,16,100,4,25,96.72,92.5,99,98.25,97.12,98.44,95,15.63,34.22,30,24,48.25,34.62,-1.56,70,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,1,2,1,0,0,0,1,1,0,1,1,0,0,1,0,0,2,0,0,0.6,0.2,0.6,0.4,0.6,0.6,0.2,0.55,4.67,3.33,1,-1,4,1,1.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,0,-1,-2,-1,0,0,0,-1,-1,1,-1,0,1,1,-1,0,0,-2,-0.6,-0.4,0,-0.4,-0.35,C_Ug +191,R_7uK8ncoM3QhZibI,60 - 66,American,Female,-3,-3,3,-3,2,3,-3,-3,-3,1,3,3,3,1,3,3,3,3,3,3,-3,-3,3,-3,3,0,3,-3,3,-3,3,0,3,3,3,3,3,2,3,3,3,3,3,0,-2,-2,3,1,-1,4,3,-3,3,-3,1,1,3,3,3,1,3,0,3,3,3,3,3,0,TRUE,0,60,TRUE,1,85,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,80,FALSE,1,85,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,60,FALSE,1,100,FALSE,1,55,FALSE,1,100,FALSE,0,100,TRUE,1,50,FALSE,1,100,TRUE,1,65,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,FALSE,0,70,FALSE,0,90,TRUE,1,100,0,0,0.25,0,0,0,0.1225,0.64,0,0.25,0.49,1,0.25,0.0225,0.25,0.0225,0,0.25,0,0,1,0.25,0.2025,1,0.16,0.25,0.81,0.36,1,0,0.5625,0,0.317589286,0.235535714,0.399642857,16,50,21,65.63,6,75,4,50,5,62.5,6,75,10,62.5,11,68.75,80.47,64.38,85.62,86.25,85.62,77.5,83.44,-15.63,14.84,-10.62,35.62,23.75,10.62,15,14.69,0,0,0,0,1,0,0,6,0,2,0,0,0,2,0,0,0,0,0,0,1,1,0,4,3,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0.2,1.6,0.4,0,1.8,1.2,0,0,0.55,0.75,0.67,1.67,-4,-1,2,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,60,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-1,-1,0,-4,-2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,-1.6,0.4,0.4,0,-0.2,C_Ug +192,R_717Qrjqx0Ht7egx,60 - 66,Canadian,Female,3,2,2,2,-1,1,-3,2,-1,1,2,-1,2,-2,3,3,3,3,3,3,2,2,2,2,-1,1,1,-1,3,0,1,2,2,0,2,-3,3,2,1,1,1,1,1,6,2,2,2,2,-2,1,1,-3,3,-3,1,0,1,0,2,-3,3,0,3,2,3,2,2,1,FALSE,1,81,TRUE,1,93,FALSE,1,100,FALSE,1,50,TRUE,1,85,FALSE,1,93,TRUE,1,94,TRUE,1,94,TRUE,1,100,TRUE,1,100,FALSE,1,86,FALSE,1,70,TRUE,1,92,TRUE,0,92,FALSE,0,71,TRUE,1,89,TRUE,0,75,TRUE,0,90,FALSE,1,94,FALSE,1,94,TRUE,1,96,TRUE,1,79,TRUE,0,59,TRUE,1,91,FALSE,1,95,TRUE,1,91,FALSE,1,63,FALSE,1,96,TRUE,0,78,TRUE,1,90,FALSE,0,59,TRUE,1,95,0.0036,0.0081,0.0121,0.0036,0.0025,0.0049,0.0081,0,0.0036,0.0441,0.01,0.0064,0,0.0196,0.0225,0.0049,0.3481,0.25,0.0016,0.0025,0.0016,0.5041,0.0036,0.8464,0.5625,0.1369,0.3481,0.0361,0,0.81,0.6084,0.09,0.167017857,0.051764286,0.282271429,27,84.38,25,78.13,6,75,5,62.5,6,75,8,100,14,87.5,11,68.75,85.47,77,84.12,90.25,90.5,88.69,82.25,6.25,7.34,2,21.62,15.25,-9.5,1.19,13.5,1,0,0,0,0,0,2,1,1,0,0,1,0,1,0,2,2,2,2,2,1,0,0,0,1,0,0,1,2,0,1,1,0,1,0,0,1,0,1,1,0.2,0.8,0.4,2,0.4,0.6,0.6,0.6,0.85,0.55,1.67,0.33,0,2,2,5,1.34,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,-1,0,2,0,-1,0,-1,0,0,0,0,2,1,2,1,1,-0.2,0.2,-0.2,1.4,0.3,C_Ug +193,R_32AbkEeLXpIYgdH,60 - 66,Canadian,Female,3,2,2,-2,1,-2,0,2,1,1,3,3,3,0,3,1,2,2,2,2,3,3,3,-1,0,3,-1,1,3,0,2,0,3,3,3,2,3,3,0,1,1,2,2,0,3,2,2,0,2,0,0,0,2,0,-1,0,3,3,3,-1,3,2,1,0,2,2,1,0,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,89,TRUE,1,100,FALSE,0,79,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,1,0.25,1,1,0,0.0625,1,1,0.81,0.25,0.6241,0.7225,1,1,0.7921,1,0.420042857,0.107142857,0.732942857,24,75,17,53.13,4,50,4,50,4,50,5,62.5,14,87.5,3,18.75,92.75,81.75,91.12,98.12,100,94,91.5,21.87,39.62,31.75,41.12,48.12,37.5,6.5,72.75,0,1,1,1,1,1,1,1,1,1,0,0,0,2,0,1,1,1,0,0,0,0,0,2,1,2,0,0,1,2,0,0,0,1,0,0,2,0,0,1,0.8,1,0.4,0.6,0.6,1,0.2,0.6,0.7,0.6,2,0.67,3,0,1,0,1.33,10 cents,5 minutes,24 days,Female,Trade School (non-military),65,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,1,1,-1,0,-1,1,1,0,-1,0,0,0,1,0,1,-1,1,0,-1,0.2,0,0.2,0,0.1,HS_TS +194,R_7EpfyyIfd3kset4,18 - 24,Canadian,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,1,1,1,1,0.642857143,0.571428571,0.714285714,32,100,12,37.5,4,50,2,25,3,37.5,3,37.5,7,43.75,5,31.25,100,100,100,100,100,100,100,62.5,62.5,50,75,62.5,62.5,56.25,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,5 minutes,47 days,Female,University - PhD,23,0,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,grad_prof +195,R_5s1fW4qD4ZuXL1M,53 - 59,Canadian,Male,-2,3,2,1,3,0,2,1,0,1,0,0,0,0,0,1,0,0,0,0,-2,3,1,1,3,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,-2,3,0,1,3,1,0,1,1,1,1,1,0,0,0,0,0,2,1,0,0,0,0,2,TRUE,0,97,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0.25,1,0,0,0.25,0,0.25,1,0,0,0,0,0.25,0,0.25,0.25,0,0.25,0,0,1,0.25,0,1,0,0.25,0.25,0.9409,1,0,0.25,1,0.301460714,0.178571429,0.42435,24,75,16,50,3,37.5,5,62.5,4,50,4,50,5,31.25,11,68.75,82.72,62.5,81.25,99.62,87.5,75,90.44,25,32.72,25,18.75,49.62,37.5,43.75,21.69,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0.2,0.4,0.4,0,0,0.2,0.2,0.67,1.33,-1,0,-1,-1,-0.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,59,0.625,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-0.2,0,0,0.2,0,C_Ug +196,R_7W6fO2X8ztw1fhv,60 - 66,American,Female,0,1,2,-2,3,1,0,2,-2,1,3,3,2,0,3,2,2,2,2,2,0,1,3,-2,3,8,2,0,3,-1,2,7,3,3,2,0,2,9,2,2,2,2,2,6,0,2,2,0,3,5,3,0,3,0,2,5,3,3,2,0,3,0,2,2,2,3,2,8,FALSE,1,79,FALSE,0,76,TRUE,0,100,FALSE,1,78,FALSE,0,73,FALSE,1,78,TRUE,1,100,TRUE,1,100,FALSE,0,82,TRUE,1,100,TRUE,0,71,TRUE,0,100,TRUE,1,100,FALSE,1,79,FALSE,0,74,TRUE,1,100,TRUE,0,83,TRUE,0,79,FALSE,1,76,FALSE,1,77,FALSE,0,78,TRUE,1,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,74,FALSE,1,100,FALSE,1,76,TRUE,1,100,FALSE,0,75,TRUE,1,100,0,0.0625,0,0,0,0.0484,0,0,0.0529,0,0,0,0.6724,0.5041,0.5329,0.5776,0.0576,0.0484,0,0,0.6084,0.5476,0.0576,0.0441,0.6889,0.5476,0.5625,0.0441,1,0.6241,0.0576,1,0.2956,0.178164286,0.413035714,16,50,20,62.5,2,25,5,62.5,7,87.5,6,75,10,62.5,10,62.5,86.22,75.75,83,89,97.12,89.56,82.88,-12.5,23.72,50.75,20.5,1.5,22.12,27.06,20.38,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,2,0,2,0,1,2,1,0,0,0,0,0,0,0,0,1,0,0.2,0.8,0.2,0,0.6,1.2,0,0.2,0.3,0.5,8,3.33,3,2,9,-2,4.67,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,61,0,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,-1,1,-2,0,-1,0,0,-1,0,0,0,0,0,1,0,0,0,-1,0,-0.4,-0.4,0.2,-0.2,-0.2,C_Ug +197,R_7zUz2CkLTb6URq7,60 - 66,American,Female,3,3,2,-3,3,2,-3,2,-2,3,-2,-3,3,-3,3,0,-1,1,2,-2,3,3,1,-3,3,5,3,-3,3,-3,3,2,-2,-3,3,-3,3,1,3,2,3,2,2,10,3,3,1,-2,3,1,2,-3,2,-2,3,0,-2,-3,3,-3,3,0,2,3,3,3,-2,4,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,95,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,89,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,96,TRUE,1,100,1,0,0,1,0,0,0,1,0,0,0,1,0.0025,0,0,0.0009,0,0,0,1,1,0.7921,0,0,0,1,0.0016,0,0,0,1,0,0.242753571,0.1431,0.342407143,28,87.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,10,62.5,13,81.25,99.28,97.12,100,100,100,98.56,100,15.62,27.4,22.12,37.5,37.5,12.5,36.06,18.75,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,3,3,2,0,4,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,2,4,2,1,0,0.2,0.6,0,2.4,0.4,0,0,1.8,0.8,0.55,2.67,0.33,4,2,1,6,2.34,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,62,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,0,1,0,1,1,0,0,0,0,0,0,1,-1,0,-1,4,-0.2,0.6,0,0.6,0.25,C_Ug +198,R_1ptXb6hcKwxf94N,67 - 73,American,Male,3,3,3,0,3,-2,-3,3,-3,1,1,1,1,-3,1,3,3,3,3,-1,3,3,3,-3,3,1,-2,-3,2,-3,1,0,1,1,2,-3,2,0,3,2,2,3,2,1,3,3,3,1,3,2,-2,-3,2,-3,1,1,2,1,2,-3,2,2,2,2,3,3,2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,65,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,61,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.25,0,0.3721,0,0.16,0.4225,1,0,1,0,0,1,1,1,0,0.257307143,0.089285714,0.425328571,30,93.75,24,75,6,75,7,87.5,4,50,7,87.5,15,93.75,9,56.25,94.88,84.38,100,95.12,100,97.5,92.25,18.75,19.88,9.38,12.5,45.12,12.5,3.75,36,0,0,0,3,0,0,0,1,0,0,0,0,1,0,1,0,1,1,0,3,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,1,1,0,0,3,0.6,0.2,0.4,1,0.2,0.2,0.6,1,0.55,0.5,0.33,1.67,-1,-1,-2,0,-1.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,2,0,0,0,0,0,0,-1,0,0,0,0,-1,0,1,0,0,0.4,0,-0.2,0,0.05,C_Ug +199,R_7jdIJPh0nOHF8jT,60 - 66,Canadian,Male,-2,1,1,-1,2,1,-1,3,-1,0,1,2,3,2,1,1,1,1,1,0,-2,1,1,-1,1,5,1,-2,1,-2,1,5,2,2,3,2,2,5,1,1,1,1,1,5,-1,1,2,0,1,5,1,-3,1,-1,-2,1,2,2,2,0,1,5,1,1,1,1,1,5,TRUE,0,75,FALSE,0,80,FALSE,1,80,TRUE,0,90,FALSE,0,55,FALSE,1,90,TRUE,1,77,TRUE,1,95,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,100,TRUE,1,79,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,82,FALSE,1,74,TRUE,0,89,FALSE,1,97,FALSE,0,100,FALSE,0,79,FALSE,1,77,TRUE,1,76,TRUE,0,100,TRUE,1,83,FALSE,1,62,FALSE,1,62,TRUE,0,70,FALSE,0,100,TRUE,1,67,FALSE,0,79,0.0025,0.0289,0,0.0529,0.6241,0.01,0.0576,0.25,0.0009,0.6241,1,0.0441,0.25,0.25,0.3025,0.64,0.0529,0.81,0.1444,1,1,0.25,0.7921,0.25,0.6724,0.1444,0.1089,0.5625,0.04,0.0676,0.49,1,0.408517857,0.351157143,0.465878571,15,46.88,15,46.88,2,25,3,37.5,4,50,6,75,7,43.75,8,50,77.12,67.25,79,73.5,88.75,76.25,78,0,30.24,42.25,41.5,23.5,13.75,32.5,28,0,0,0,0,1,0,1,2,1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,2,2,0,2,1,0,1,2,0,0,0,0,0,1,0.2,1,0.4,0.2,0.8,1.2,0.8,0.2,0.45,0.75,5,3.67,0,4,0,0,1.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,0.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,-1,0,-1,-1,0,0,-1,0,1,-1,0,0,-1,-2,1,0,0,0,0,0,-0.6,-0.2,-0.4,0,-0.3,HS_TS +200,R_1zTf0GDK4e5UVk5,53 - 59,American,Female,1,2,-1,0,2,-2,-2,2,-2,2,2,-2,3,-2,2,-1,0,-1,-1,2,0,2,1,2,2,1,-2,1,2,1,2,3,2,-2,3,-2,2,0,-1,-1,0,-1,2,1,1,2,-1,0,2,1,-2,-2,2,-2,2,0,2,-2,3,-2,2,0,2,2,2,2,2,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,51,TRUE,1,68,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,54,FALSE,0,100,TRUE,0,58,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,54,FALSE,0,100,TRUE,0,60,FALSE,1,100,FALSE,1,71,FALSE,1,65,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,55,TRUE,1,100,0,0,1,0,0,0,0,1,0.1225,0,0,1,0.2116,0.3364,0.1024,0,0,0.2401,0,0,1,0.2116,0.0841,1,0.36,0.25,0.2025,0,0,0,0.5625,1,0.274417857,0.215214286,0.333621429,16,50,23,71.88,7,87.5,4,50,6,75,6,75,12,75,11,68.75,86.28,61.62,87.88,100,95.62,89.44,83.12,-21.88,14.4,-25.88,37.88,25,20.62,14.44,14.37,1,0,2,2,0,0,3,0,3,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,3,3,0,1,1.2,0,0.4,0,0,0,2.2,0.65,0.55,1.33,0.33,0,3,0,-4,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,56,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,1,0,2,2,0,0,3,0,3,0,0,0,0,0,0,-3,-1,-2,-3,0,1,1.2,0,-1.8,0.1,C_Ug +201,R_3pS9MbfPbpA5x10,60 - 66,American,Female,3,1,2,0,2,-1,-2,3,-2,1,2,2,2,-2,2,1,1,1,2,0,3,2,2,-1,2,2,-2,-2,3,-2,2,1,2,2,2,-2,2,1,1,1,1,1,0,7,2,1,2,2,0,7,-2,-2,3,-2,1,3,2,2,2,-2,2,0,0,0,1,1,0,6,TRUE,0,96,TRUE,1,99,FALSE,1,100,FALSE,1,62,TRUE,1,71,FALSE,1,100,TRUE,1,86,TRUE,1,100,TRUE,1,96,TRUE,1,100,FALSE,1,85,TRUE,0,92,TRUE,1,98,TRUE,0,100,TRUE,1,59,TRUE,1,97,FALSE,1,63,TRUE,0,100,TRUE,0,70,FALSE,1,55,FALSE,0,57,TRUE,1,56,FALSE,1,100,TRUE,1,97,FALSE,1,61,TRUE,1,99,TRUE,0,76,FALSE,1,74,TRUE,0,98,TRUE,1,97,TRUE,1,75,TRUE,1,100,0,0.0001,0.0009,0.0196,0,0,0.0009,0,0.2025,0.1936,0.0009,0.0004,0.0016,0.0225,0.0841,0.0001,0,0.1444,0.0676,0.1521,0.3249,0.1681,0.49,1,0.1369,0.5776,0.0625,0.9216,0,1,0.9604,0.8464,0.262825,0.0465,0.47915,25,78.13,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,84.97,77.75,85.88,87.25,89,86.69,83.25,3.13,9.97,2.75,10.88,24.75,1.5,-7.06,27,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,2,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0.4,0.4,0,0.2,1,0.2,0,0.6,0.25,0.45,1.33,3.33,-5,-2,1,1,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),65,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,-1,1,0,-1,-2,0,0,0,0,1,0,0,0,0,0,-1,-1,0,0,0,-0.6,0.2,0,-0.4,-0.2,grad_prof +202,R_139l5pMR4M1ByHb,67 - 73,American,Female,2,1,3,1,3,1,-3,3,-3,1,2,-1,2,0,3,0,2,2,1,-1,3,2,3,0,3,6,2,-3,3,-3,3,2,2,1,2,0,3,1,-2,1,0,1,-2,6,3,2,3,3,1,2,0,-1,2,-1,-2,5,3,0,2,0,3,1,-1,0,2,1,0,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,54,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,82,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,75,0,0,0,0,0.0625,0.25,0,0,0,0,0,0,0,0,0.2116,0,0,0.25,0.01,0,0.0324,0.25,0.0625,1,0.0081,0.0016,0.0625,0,0,1,0,1,0.150042857,0.055292857,0.244792857,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,15,93.75,12,75,90.25,80.75,81.5,100,98.75,89.75,90.75,3.12,5.87,-6.75,-6,25,11.25,-4,15.75,1,1,0,1,0,1,0,0,0,2,0,2,0,0,0,2,1,2,0,1,1,1,0,2,2,1,2,1,2,3,1,1,0,0,0,1,2,0,0,1,0.6,0.6,0.4,1.2,1.2,1.8,0.4,0.8,0.7,1.05,3,2.67,4,-3,0,4,0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,69,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,-2,0,-2,-1,-2,-1,-1,1,0,0,0,1,-1,2,0,0,-0.6,-1.2,0,0.4,-0.35,C_Ug +203,R_5Ebv5xofP7yfolg,67 - 73,Canadian,Female,1,3,1,-1,3,1,-1,2,-2,1,3,1,1,1,3,2,2,2,2,2,0,3,0,-1,3,2,1,-2,-2,-1,1,2,3,2,2,1,3,2,2,2,1,2,2,2,2,2,2,0,2,2,1,-1,0,-1,1,2,3,3,2,1,2,2,2,1,2,2,2,2,TRUE,0,81,FALSE,0,66,TRUE,0,100,FALSE,1,76,TRUE,1,66,TRUE,0,59,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,FALSE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,68,TRUE,1,95,TRUE,0,71,TRUE,0,89,TRUE,0,72,TRUE,0,71,FALSE,0,93,FALSE,0,72,FALSE,1,64,TRUE,1,67,TRUE,0,100,TRUE,1,63,FALSE,1,65,FALSE,1,90,TRUE,0,85,TRUE,1,100,FALSE,0,98,TRUE,1,100,0,0.1369,0.0025,0,0,0.3481,0.1089,0,0.5041,0.5184,0,0,0.0289,0.0256,0.1156,0.4356,0.1296,0.0576,0.01,1,0.8649,0.4624,0.5184,1,0.5041,0.1225,0.9604,0.6561,1,0.7921,0.7225,1,0.424492857,0.162314286,0.686671429,23,71.88,16,50,4,50,4,50,3,37.5,5,62.5,11,68.75,5,31.25,83.69,76.5,79.75,88.12,90.38,85.69,81.69,21.88,33.69,26.5,29.75,50.62,27.88,16.94,50.44,1,0,1,0,0,0,1,4,1,0,0,1,1,0,0,0,0,1,0,0,1,1,1,1,1,0,0,2,1,0,0,2,1,0,1,0,1,0,0,0,0.4,1.2,0.4,0.2,1,0.6,0.8,0.2,0.55,0.65,2,2,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,-1,0,-1,-1,0,1,2,0,0,0,-1,0,0,-1,0,-1,1,0,0,-0.6,0.6,-0.4,0,-0.1,HS_TS +204,R_5C8AFC3Hsg4XcR3,39 - 45,American,Male,2,3,2,-3,1,0,-3,3,-3,1,2,-2,3,-3,3,3,2,2,3,0,2,3,3,0,1,7,0,-3,3,-3,2,8,2,-2,3,-3,2,7,1,1,1,3,0,8,2,2,2,-2,2,7,1,-3,3,-3,2,6,2,-3,3,-3,3,6,3,2,3,3,0,7,TRUE,0,90,TRUE,1,90,TRUE,0,80,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,55,FALSE,1,55,FALSE,1,70,TRUE,1,70,TRUE,0,100,TRUE,1,90,TRUE,1,100,TRUE,0,70,TRUE,0,70,TRUE,0,80,FALSE,1,60,TRUE,1,60,TRUE,1,90,TRUE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,90,TRUE,0,70,TRUE,0,100,TRUE,1,85,FALSE,0,75,TRUE,1,100,0,0,0,0,0,0,0,0.2025,0.16,0.01,0.0225,0.09,0.2025,0.2025,0,0.01,0.49,0.04,0.49,0,0.16,0.01,0.64,1,0.49,0.81,0.5625,0.81,0.64,0.49,1,0.09,0.307946429,0.102142857,0.51375,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,15,93.75,6,37.5,82.97,76.88,83.75,88.12,83.12,85.62,80.31,-3.13,17.34,14.38,21.25,25.62,8.12,-8.13,42.81,0,0,1,3,0,0,0,0,0,1,0,0,0,0,1,2,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0.8,0.2,0.2,0.8,0.6,0.4,0.2,0.2,0.5,0.35,7.33,6.33,0,2,1,1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),43,1.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,-1,1,2,-1,-1,0,0,0,0,0,-1,0,0,1,2,1,0,0,0,0.2,-0.2,0,0.6,0.15,HS_TS +205,R_3Flzy7YelLpRL66,32 - 38,American,Female,3,1,-1,1,1,-3,2,2,3,1,2,-1,3,0,3,1,-1,0,0,0,3,1,0,2,-1,3,-3,2,3,2,0,2,3,-1,3,0,3,3,-2,-2,-2,-2,-2,5,3,1,-1,2,2,5,-3,2,3,3,1,3,3,-1,3,0,3,4,0,0,0,1,1,6,TRUE,0,53,TRUE,1,54,TRUE,0,72,FALSE,1,52,TRUE,1,53,FALSE,1,63,TRUE,1,87,TRUE,1,100,TRUE,1,56,TRUE,1,92,FALSE,1,100,TRUE,0,54,TRUE,1,78,FALSE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,50,TRUE,0,99,TRUE,0,54,FALSE,1,50,TRUE,1,89,TRUE,1,100,FALSE,1,74,TRUE,1,75,FALSE,1,94,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,61,TRUE,1,50,TRUE,1,88,0,0,0,0.0169,0.0144,0.1369,0.0625,0.0064,0.25,0,0.1521,0.0484,0.1936,0,0.2209,0.2116,0.0676,0.2304,0.25,0.0036,0.0121,0.2704,0.2916,0,0.25,0.25,0.25,0.2809,0.5184,0.9801,0.25,0.2916,0.196196429,0.113914286,0.278478571,16,50,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,71.88,58.5,68.12,90.62,70.25,77.19,66.56,-28.13,-6.25,-16.5,-19.38,15.62,-4.75,-16.56,4.06,0,0,1,1,2,0,0,1,1,1,1,0,0,0,0,3,1,2,2,2,0,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0.8,0.6,0.2,2,0.4,0.2,0.2,0.8,0.9,0.4,2.67,4,-2,-1,-1,-1,-1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,38,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,2,0,2,1,1,0.4,0.4,0,1.2,0.5,C_Ug +206,R_7DBVC3WDgttHfaH,46 - 52,Canadian,Male,3,3,3,3,3,1,-1,3,-2,1,3,1,3,-2,3,0,0,3,-2,2,3,3,3,3,3,8,1,-2,1,-1,0,7,3,1,3,-1,3,7,-1,-1,-1,-1,-1,7,3,3,3,3,3,7,1,-3,3,-3,0,7,3,1,3,-3,3,6,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,85,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,1,87,FALSE,1,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0225,0,0,0.01,0,0,0,0,0.6561,0,0,0.0169,0,0.04,0,0,0,0,1,0,0,0.3249,1,0,0,1,0,0,0,0,1,1,0.215639286,0.050928571,0.38035,25,78.13,25,78.13,5,62.5,7,87.5,8,100,5,62.5,15,93.75,10,62.5,96.25,92.12,98.38,98.75,95.75,94.94,97.56,0,18.12,29.62,10.88,-1.25,33.25,1.19,35.06,0,0,0,0,0,0,1,2,1,1,0,0,0,1,0,1,1,4,1,3,0,0,0,0,0,0,2,0,1,1,0,0,0,1,0,3,3,0,5,1,0,1,0.2,2,0,0.8,0.2,2.4,0.8,0.85,7.33,6.67,1,0,1,2,0.66,10 cents,100 minutes,24 days,Male,High School (or equivalent),52,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,-1,2,0,0,0,0,0,0,0,-2,-2,4,-4,2,0,0.2,0,-0.4,-0.05,HS_TS +207,R_3zhmgRSyA5EFlvz,67 - 73,American,Male,3,2,3,3,0,-1,1,2,1,0,2,2,2,-1,1,-2,-2,-2,0,-3,3,2,3,2,2,7,0,0,2,0,0,6,1,2,2,0,0,5,-2,0,-1,0,-3,8,3,3,3,3,0,5,-1,0,0,0,0,5,1,1,1,-1,0,5,-1,0,0,0,-3,7,TRUE,0,88,TRUE,1,99,FALSE,1,84,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,98,TRUE,1,96,FALSE,1,78,TRUE,0,50,FALSE,0,75,FALSE,1,76,FALSE,0,64,TRUE,1,100,FALSE,1,98,TRUE,0,96,TRUE,0,84,FALSE,1,100,FALSE,0,50,TRUE,1,96,TRUE,0,96,TRUE,1,100,TRUE,0,89,TRUE,1,99,TRUE,0,94,FALSE,1,71,FALSE,1,77,TRUE,1,100,TRUE,1,95,TRUE,1,100,0,0.0001,0,0.0001,0,0,0,0.0016,0,0.0016,0,0.5625,0.0004,0.0484,0.0025,0.0001,0.9216,0.25,0.0841,0.7921,0.25,0.4096,0.7056,0.0576,0.0004,0.8836,0.0025,0.7744,0.0256,0.9216,0.0529,0.25,0.249953571,0.127764286,0.372142857,27,84.38,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,13,81.25,9,56.25,87.41,82.75,86.38,92.38,88.12,91.62,83.19,15.63,18.66,20.25,23.88,29.88,0.62,10.37,26.94,0,0,0,1,2,1,1,0,1,0,1,0,0,1,1,0,2,1,0,0,0,1,0,0,0,0,1,2,1,0,1,1,1,0,1,1,2,2,0,0,0.6,0.6,0.6,0.6,0.2,0.8,0.8,1,0.6,0.7,6,5,2,1,0,1,1,5 cents,5 minutes,47 days,Male,Trade School (non-military),70,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,-1,0,1,2,1,0,-2,0,0,0,-1,-1,1,0,-1,0,-1,0,0,0.4,-0.2,-0.2,-0.4,-0.1,HS_TS +208,R_6rGTb1zXAhIJ1wH,32 - 38,American,Female,3,3,3,-2,-1,-2,0,1,0,-2,2,-2,2,-2,2,-2,-1,-1,-1,-3,3,3,2,-1,-1,2,-2,1,1,0,-2,3,2,-2,2,-2,2,4,-2,-1,-1,-1,-3,2,3,3,2,0,-1,1,-2,0,1,0,-2,2,2,-2,2,-2,2,4,-1,0,0,0,-3,5,FALSE,1,50,FALSE,0,50,FALSE,1,73,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,55,TRUE,1,65,FALSE,0,50,FALSE,0,60,TRUE,0,50,TRUE,0,80,FALSE,0,65,TRUE,0,55,TRUE,1,50,TRUE,1,59,TRUE,0,50,TRUE,0,74,FALSE,1,55,FALSE,1,50,TRUE,1,65,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,65,FALSE,0,50,TRUE,1,55,0.1225,0.25,0.1681,0.2025,0.2025,0.25,0.25,0.36,0.25,0.25,0.1225,0.4225,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.1225,0.25,0.2025,0.3025,0.25,0.25,0.25,0.25,0.0729,0.5476,0.25,0.64,0.258767857,0.239821429,0.277714286,3,9.38,19,59.38,3,37.5,5,62.5,4,50,7,87.5,11,68.75,8,50,57.06,50.62,60.62,55.5,61.5,55.56,58.56,-50,-2.32,13.12,-1.88,5.5,-26,-13.19,8.56,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0.4,0.2,0,0,0.6,0,0,0.8,0.15,0.35,3,2.33,1,1,0,-3,0.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),36,0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,-1,-1,-1,-1,0,-0.2,0.2,0,-0.8,-0.2,HS_TS +209,R_3FeZQo6wCs3ezdv,46 - 52,American,Female,-1,-1,1,2,-1,-2,1,1,1,-1,1,2,2,-1,2,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,6,-1,-1,-1,-1,-1,5,1,1,1,1,1,8,-1,-1,-1,-1,-1,5,-1,-1,-1,0,-1,5,-1,-1,-1,-1,-1,5,-1,-1,-1,-1,-1,5,-1,-1,-1,-1,-1,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,70,FALSE,1,81,FALSE,1,85,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.25,0,0.0361,1,0,0.25,0,1,1,0.49,0,1,0,0,0.0225,1,0.251735714,0.089285714,0.414185714,27,84.38,24,75,6,75,6,75,5,62.5,7,87.5,16,100,8,50,94.88,90,91.88,100,97.62,96.88,92.88,9.38,19.88,15,16.88,37.5,10.12,-3.12,42.88,0,0,2,3,0,1,2,2,2,0,0,1,1,2,1,0,0,1,0,0,0,0,2,2,0,1,2,2,2,0,2,3,3,0,3,0,0,1,0,0,1,1.4,1,0.2,0.8,1.4,2.2,0.2,0.9,1.15,6.33,5,1,0,3,0,1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,1,0,0,0,0,0,0,-2,-2,-2,2,-2,0,0,0,0,0,0.2,0,-1.2,0,-0.25,C_Ug +210,R_31QKekQaep1x2GI,60 - 66,American,Female,2,3,1,1,-2,-1,-2,2,-3,1,3,3,1,-2,2,1,-1,-1,3,-1,3,3,2,1,-2,0,-2,-3,3,-3,1,2,3,3,1,-2,1,0,3,2,3,3,3,7,3,3,2,3,-1,1,1,-3,1,-3,1,1,3,3,1,-2,1,1,-1,-1,-1,-1,-1,1,TRUE,0,67,TRUE,1,98,FALSE,1,100,FALSE,1,61,TRUE,1,61,FALSE,1,99,TRUE,1,89,TRUE,1,99,TRUE,1,89,TRUE,1,94,FALSE,1,66,TRUE,0,99,FALSE,0,100,TRUE,0,98,FALSE,0,73,TRUE,1,69,TRUE,0,82,TRUE,0,100,TRUE,0,90,FALSE,1,85,TRUE,1,89,TRUE,1,80,FALSE,1,66,TRUE,1,64,FALSE,1,94,TRUE,1,85,TRUE,0,88,FALSE,1,92,TRUE,0,95,FALSE,0,87,FALSE,0,89,TRUE,1,100,0.0001,0.0225,0.0961,0.0121,0,0.0001,0.1296,0.0036,0.0225,0.04,0.7569,1,0.0121,0.1156,0.1521,0.0004,0.1156,0.1521,0.0064,0.0036,0.0121,0.5329,0.81,0.9604,0.6724,0.7744,0.7921,0.4489,0,1,0.9025,0.9801,0.3713,0.178614286,0.563985714,26,81.25,20,62.5,4,50,5,62.5,5,62.5,6,75,12,75,8,50,85.88,81.75,86.5,88.38,86.88,85.38,86.38,18.75,23.38,31.75,24,25.88,11.88,10.38,36.38,1,0,1,0,0,1,1,1,0,0,0,0,0,0,1,2,3,4,0,4,1,0,1,2,1,2,1,1,0,0,0,0,0,0,1,2,0,0,4,0,0.4,0.6,0.2,2.6,1,0.8,0.2,1.2,0.95,0.8,0.67,1,-1,1,-1,6,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,3,4,-4,4,-0.6,-0.2,0,1.4,0.15,HS_TS +211,R_7xLsJucwczP9rR6,46 - 52,American,Female,1,1,1,1,1,2,-1,2,-1,0,2,2,1,0,2,0,-1,1,1,-1,2,2,2,2,2,1,2,-2,1,-2,2,1,2,2,2,0,2,1,0,0,0,0,0,5,2,2,2,2,2,1,0,-2,2,-2,2,1,2,2,0,0,2,1,2,2,2,2,2,1,TRUE,0,100,TRUE,1,59,TRUE,0,58,FALSE,1,66,TRUE,1,72,FALSE,1,100,TRUE,1,81,TRUE,1,86,TRUE,1,80,TRUE,1,65,FALSE,1,70,TRUE,0,100,TRUE,1,70,TRUE,0,71,TRUE,1,70,TRUE,1,76,TRUE,0,78,TRUE,0,68,FALSE,1,78,FALSE,1,72,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,75,FALSE,1,75,TRUE,1,76,FALSE,1,77,TRUE,0,78,TRUE,0,75,TRUE,1,81,FALSE,0,50,TRUE,1,75,0.0196,0.0576,0.0576,0.0361,0.0625,0,0.5625,0.1225,0.0784,0.25,0.0361,0.09,0.04,0.09,0.0784,0.1681,0.25,0.1156,0.6084,0.0625,0.25,0.09,0.0484,0.5041,0.6084,0.0529,0.25,1,0.3364,0.4624,0.5625,1,0.277860714,0.138864286,0.416857143,9,28.13,20,62.5,7,87.5,5,62.5,4,50,4,50,12,75,8,50,72.88,68.75,71.25,73.25,78.25,69.75,76,-34.37,10.38,-18.75,8.75,23.25,28.25,-5.25,26,1,1,1,1,1,0,1,1,1,2,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,2,1,0,1,2,0,0,1,0,0,2,3,1,1,3,1,1,0.2,0.8,1,1.2,0.2,2,0.75,1.1,1,1,0,0,0,4,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,-0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,-2,0,1,0,0,0,0,0,0,0,-2,-2,0,0,-2,0,-0.2,0,-1.2,-0.35,C_Ug +212,R_3jD4zQ9K1au3W7Z,25 - 31,Canadian,Female,3,3,0,2,2,2,-1,3,-1,2,2,-3,3,1,2,2,3,2,3,1,3,3,2,-1,3,3,3,1,3,1,3,3,3,1,2,3,-1,4,-3,1,0,-3,-2,2,3,3,-1,1,2,2,1,-2,3,0,2,0,2,-3,3,-1,3,1,2,1,2,3,3,1,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,0,66,TRUE,0,83,TRUE,1,75,FALSE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,95,TRUE,0,100,FALSE,1,63,FALSE,1,77,FALSE,0,81,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,85,FALSE,1,75,FALSE,1,50,TRUE,0,70,TRUE,1,100,TRUE,1,72,TRUE,1,94,0,0.0225,0,0.0009,0.0036,0,0,0.0016,0.0529,0,0,0.0625,0,0.4356,0,0.25,0,0.25,0.25,0,0.6561,0.1156,0.1369,0,0.0025,0.0625,0.0784,0,0,1,0.49,0.6889,0.162039286,0.075442857,0.248635714,28,87.5,27,84.38,7,87.5,6,75,7,87.5,7,87.5,15,93.75,12,75,85.78,67.75,89.38,97.25,88.75,88.5,83.06,3.12,1.4,-19.75,14.38,9.75,1.25,-5.25,8.06,0,0,2,3,1,1,2,0,2,1,1,4,1,2,3,5,2,2,6,3,0,0,1,1,0,1,1,0,1,0,0,0,0,2,1,0,2,0,0,2,1.2,1.2,2.2,3.6,0.4,0.6,0.6,0.8,2.05,0.6,3.33,1,1,3,3,1,2.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,1,2,1,0,1,0,1,1,1,4,1,0,2,5,0,2,6,1,0.8,0.6,1.6,2.8,1.45,grad_prof +213,R_7dT7VMMXH4xfwLX,67 - 73,American,Male,3,2,1,1,0,0,-3,2,-2,1,0,0,2,-2,2,-3,-3,-2,-2,-2,3,2,2,1,0,1,1,-3,1,-3,2,1,1,-2,2,-1,2,1,-3,-3,-3,-3,-3,5,3,2,2,1,0,1,0,-3,2,-3,1,2,0,-1,2,0,2,1,-2,-2,-2,-2,-2,1,FALSE,1,99,TRUE,1,100,TRUE,0,85,FALSE,1,54,TRUE,1,100,FALSE,1,84,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,97,FALSE,1,65,FALSE,1,100,FALSE,0,89,TRUE,0,86,FALSE,0,73,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,84,FALSE,1,100,TRUE,1,100,FALSE,1,91,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,68,TRUE,1,63,0,0,0,0,0.1369,0.0256,0.0256,0.0009,0,0,0,0.7921,0,0.1225,0,0,0,0.2116,0,0,0,0.5329,0.0225,0.7396,0.0036,0.0081,0.1024,0.0001,0.7225,1,0.0484,0,0.160546429,0.093942857,0.22715,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,90.47,79.5,88.5,97.75,96.12,92.12,88.81,3.12,6.09,-8,1,22.75,8.62,4.62,7.56,0,0,1,0,0,1,0,1,1,1,1,2,0,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,1,0,2,0,1,1,0,0,0,0.2,0.8,0.8,0.6,0.2,0.2,0.6,0.4,0.6,0.35,1,1.33,0,-1,0,4,-0.33,5 cents,5 minutes,47 days,Male,High School (or equivalent),67,1.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,1,0,1,0,1,1,1,0,-1,0,-1,-1,1,1,1,0,0.6,0.2,0.2,0.25,HS_TS +214,R_3dH0X8NfSZ719Wz,60 - 66,American,Female,-1,2,1,-3,3,-1,1,2,1,0,1,3,2,-2,1,-2,-3,-2,-1,-2,0,3,1,-3,1,8,2,-1,3,-2,1,7,1,3,2,1,1,7,1,0,0,1,0,7,-2,2,2,0,2,3,-3,1,1,1,-1,3,2,2,0,-2,1,4,-2,-3,-2,-2,-2,4,TRUE,0,97,TRUE,1,81,FALSE,1,76,FALSE,1,61,FALSE,0,61,FALSE,1,59,TRUE,1,92,TRUE,1,90,FALSE,0,54,TRUE,1,97,TRUE,0,62,TRUE,0,89,TRUE,1,73,TRUE,0,88,FALSE,0,68,FALSE,0,81,TRUE,0,71,TRUE,0,92,FALSE,1,52,FALSE,1,66,FALSE,0,92,FALSE,0,54,FALSE,1,53,FALSE,0,61,FALSE,1,82,TRUE,1,92,FALSE,1,61,FALSE,1,81,FALSE,1,62,TRUE,1,83,FALSE,0,81,TRUE,1,99,0.01,0.0064,0.6561,0.0064,0.0001,0.1681,0.3721,0.0009,0.1156,0.2916,0.0289,0.0729,0.2916,0.3844,0.3721,0.0361,0.2209,0.1521,0.0361,0.0324,0.8464,0.4624,0.2304,0.7744,0.5041,0.1521,0.6561,0.9409,0.0576,0.8464,0.1444,0.7921,0.320828571,0.1791,0.462557143,20,62.5,18,56.25,4,50,5,62.5,4,50,5,62.5,8,50,10,62.5,75.34,65,71.25,86.75,78.38,78.69,72,6.25,19.09,15,8.75,36.75,15.88,28.69,9.5,1,1,0,0,2,3,2,1,3,1,0,0,0,3,0,3,3,2,2,2,1,0,1,3,1,2,0,1,0,1,1,1,2,0,0,0,0,0,1,0,0.8,2,0.6,2.4,1.2,0.8,0.8,0.2,1.45,0.75,7.33,3.33,5,4,3,3,4,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,61,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,1,-1,-3,1,1,2,0,3,0,-1,-1,-2,3,0,3,3,2,1,2,-0.4,1.2,-0.2,2.2,0.7,C_Ug +215,R_74oY4mzWeayvNRg,67 - 73,American,Female,3,3,1,1,3,-2,-3,3,-2,1,2,-3,3,-2,3,3,3,3,3,-2,3,3,1,-2,3,4,-3,-3,3,-1,1,2,-2,-2,3,-3,3,3,1,1,-1,-2,2,3,3,3,2,3,2,1,-3,-3,1,-1,1,7,-2,-3,3,-3,3,2,3,2,3,3,0,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,89,FALSE,0,100,TRUE,1,50,TRUE,0,61,TRUE,1,79,TRUE,0,77,TRUE,1,71,FALSE,1,50,FALSE,1,76,TRUE,0,50,TRUE,1,60,TRUE,1,50,TRUE,1,100,0,0.0841,0,0.0625,0,0,0.0441,0.0576,0.0121,0.25,0.16,0,0.25,0.25,0,0,0.3721,0.25,0.0576,0.5929,1,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,0.25,1,0.323085714,0.117564286,0.528607143,26,81.25,18,56.25,4,50,4,50,4,50,6,75,14,87.5,4,25,75.44,56.25,82.62,74.88,88,78.81,72.06,25,19.19,6.25,32.62,24.88,13,-8.69,47.06,0,0,0,3,0,1,0,0,1,0,4,1,0,1,0,2,2,4,5,4,0,0,1,2,1,1,0,2,1,0,4,0,0,1,0,0,1,0,0,2,0.6,0.4,1.2,3.4,0.8,0.8,1,0.6,1.4,0.8,3,3.33,3,-5,1,1,-0.33,10 cents,100 minutes,15 days,Female,High School (or equivalent),68,1,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,-1,1,-1,0,0,-2,0,0,0,1,0,0,0,2,1,4,5,2,-0.2,-0.4,0.2,2.8,0.6,HS_TS +216,R_6uRm1ocr1AINFPr,53 - 59,Canadian,Female,3,2,3,2,-3,-3,-1,2,2,1,0,-3,2,-2,2,1,1,1,1,-3,2,1,2,2,1,6,-3,1,-1,1,-2,7,1,-1,-1,-2,2,7,1,0,1,0,0,7,2,2,2,3,-1,3,-2,-1,1,0,1,7,-2,-3,2,-2,3,4,0,-1,0,0,0,7,TRUE,0,92,TRUE,1,79,FALSE,1,98,TRUE,0,54,TRUE,1,87,FALSE,1,86,TRUE,1,92,TRUE,1,92,TRUE,1,77,TRUE,1,77,FALSE,1,73,TRUE,0,72,TRUE,1,82,TRUE,0,77,TRUE,1,64,TRUE,1,91,TRUE,0,67,TRUE,0,86,TRUE,0,72,TRUE,0,70,FALSE,0,65,TRUE,1,77,TRUE,0,71,TRUE,1,83,FALSE,1,71,TRUE,1,80,TRUE,0,65,TRUE,0,77,TRUE,0,70,TRUE,1,91,TRUE,1,91,TRUE,1,69,0.0064,0.04,0.0081,0.0064,0.0961,0.0196,0.0289,0.0529,0.49,0.0529,0.0081,0.0324,0.0529,0.0729,0.0169,0.0441,0.5041,0.2916,0.5929,0.0841,0.4225,0.1296,0.5184,0.5929,0.4489,0.4225,0.0081,0.8464,0.0004,0.7396,0.49,0.5184,0.270646429,0.125957143,0.415335714,23,71.88,19,59.38,5,62.5,4,50,5,62.5,5,62.5,15,93.75,4,25,78.06,71.88,74.62,81.5,84.25,81.06,75.06,12.5,18.68,9.38,24.62,19,21.75,-12.69,50.06,1,1,1,0,4,0,2,3,1,3,1,2,3,0,0,0,1,0,1,3,1,0,1,1,2,1,0,1,2,0,2,0,0,0,1,1,2,1,1,3,1.4,1.8,1.2,1,1,0.8,0.6,1.6,1.35,1,6.67,4.67,3,0,3,0,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,58,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,1,0,-1,2,-1,2,2,-1,3,-1,2,3,0,-1,-1,-1,-1,0,0,0.4,1,0.6,-0.6,0.35,C_Ug +217,R_6viaW1TKSDJLOgo,60 - 66,Canadian,Female,3,3,3,3,3,2,-2,1,-2,2,-2,-2,3,-2,3,2,2,2,2,3,3,3,3,3,3,1,3,-2,1,-1,3,0,-2,-2,2,-2,3,2,1,1,2,2,3,2,3,3,3,3,3,4,3,-2,1,-1,3,0,-2,-2,2,-2,3,1,1,1,1,3,1,2,TRUE,0,83,TRUE,1,100,FALSE,1,100,TRUE,0,54,TRUE,1,76,FALSE,1,100,TRUE,1,81,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,78,TRUE,0,96,FALSE,0,100,FALSE,1,83,FALSE,0,52,TRUE,1,82,FALSE,1,87,FALSE,1,97,TRUE,0,75,FALSE,1,100,FALSE,0,86,TRUE,1,70,FALSE,1,90,TRUE,1,79,FALSE,1,100,TRUE,1,96,TRUE,0,75,FALSE,1,86,TRUE,0,70,TRUE,1,92,FALSE,0,51,TRUE,1,100,0,0.0016,0.0324,0.0361,0,0,0.0441,0,0,0.09,0.0064,1,0.0625,0.0484,0.0576,0,0.01,0.2916,0.0196,0,0.7396,0.2704,0.5625,0.0289,0.0169,0.5625,0.2601,0.6889,0,0.0009,0.49,0.9216,0.220446429,0.115042857,0.32585,26,81.25,22,68.75,3,37.5,5,62.5,7,87.5,7,87.5,12,75,10,62.5,84.81,70,88.62,88.75,91.88,83.75,85.88,12.5,16.06,32.5,26.12,1.25,4.38,8.75,23.38,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,2,0,0.6,0.2,0.4,0,0.6,0.2,1.2,0.3,0.5,1,1.67,-3,0,1,0,-0.67,10 cents,100 minutes,15 days,Female,University - Graduate (Masters),63,0.875,0,0,0,1,1,0,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,-2,0,0,0,-0.8,-0.2,grad_prof +218,R_310qWWe9FxZzRWc,60 - 66,American,Female,1,2,1,2,1,-3,-3,1,-3,-3,-1,-1,-1,-1,-1,1,1,1,1,1,1,0,1,1,1,7,1,0,1,1,1,5,1,1,0,1,1,6,1,0,1,1,1,5,0,0,1,0,1,7,0,0,1,0,-1,8,0,0,-1,0,0,7,0,1,1,1,1,6,TRUE,0,81,FALSE,0,85,TRUE,0,100,TRUE,0,53,TRUE,1,71,FALSE,1,62,FALSE,0,77,TRUE,1,61,TRUE,1,73,TRUE,1,96,TRUE,0,100,TRUE,0,100,FALSE,0,85,TRUE,0,100,FALSE,0,72,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,1,82,FALSE,1,94,FALSE,0,100,FALSE,0,96,TRUE,0,84,TRUE,1,100,TRUE,0,87,TRUE,1,85,FALSE,1,90,TRUE,0,90,TRUE,0,89,TRUE,1,100,TRUE,1,100,FALSE,0,84,0.1521,0.0225,0,0.5929,0.7056,0.1444,0,0.0016,0.0036,0.9216,0,0.7225,0.0729,1,0.0841,0.7225,0.7056,0.2809,0.81,0.7569,1,0.5184,0.0324,1,0.01,0.01,0,0.6561,1,1,0.7921,1,0.498257143,0.383235714,0.613278571,7,21.88,14,43.75,4,50,3,37.5,2,25,5,62.5,9,56.25,5,31.25,87.09,81.88,83.12,90.25,93.12,86.56,87.62,-21.87,43.34,31.88,45.62,65.25,30.62,30.31,56.37,0,2,0,1,0,4,3,0,4,4,2,2,1,2,2,0,1,0,0,0,1,2,0,2,0,3,3,0,3,2,1,1,0,1,1,1,0,0,0,0,0.6,3,1.8,0.2,1,2.2,0.8,0.2,1.4,1.05,6,7.33,0,-3,-1,-1,-1.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),60,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,-1,0,1,0,0,1,2,1,1,1,1,1,-1,1,0,0,0,-0.4,0.8,1,0,0.35,HS_TS +219,R_3nMGogVXpl2Jq3x,25 - 31,American,Female,1,1,1,-2,1,-2,-2,2,-2,-2,1,1,2,0,1,1,0,1,1,0,0,0,0,-2,2,4,-1,-1,2,0,-1,5,0,0,0,0,0,5,0,0,1,0,0,4,2,2,2,0,1,2,-1,-1,2,0,0,3,1,1,0,0,0,2,1,0,1,0,0,5,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,60,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,76,TRUE,1,59,FALSE,1,50,TRUE,1,72,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,0,0.0784,0,0.16,0.25,0,0.1681,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.5776,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.285560714,0.213978571,0.357142857,10,31.25,21,65.63,4,50,5,62.5,6,75,6,75,8,50,13,81.25,63.03,50,65.75,66.5,69.88,65.06,61,-34.38,-2.6,0,3.25,-8.5,-5.12,15.06,-20.25,1,1,1,0,1,1,1,0,2,1,1,1,2,0,1,1,0,0,1,0,1,1,1,2,0,1,1,0,2,2,0,0,2,0,1,0,0,0,1,0,0.8,1,1,0.4,1,1.2,0.6,0.2,0.8,0.75,4.67,2.33,2,2,3,-1,2.34,10 cents,100 minutes,24 days,Female,Trade School (non-military),31,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-2,1,0,0,0,0,-1,1,1,0,0,0,1,0,0,0,0,-0.2,-0.2,0.4,0.2,0.05,HS_TS +220,R_37at2W1uBdBvtUD,60 - 66,Canadian,Male,1,3,1,3,1,-1,-3,3,-3,1,1,1,2,-2,3,-2,0,1,3,2,1,3,1,0,3,2,-1,-3,3,-3,2,1,1,1,3,0,3,2,-2,0,-2,1,1,7,1,3,1,3,0,4,-3,-3,3,-2,1,3,1,1,2,-3,3,1,-2,-2,0,1,-1,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,95,TRUE,0,100,TRUE,1,100,TRUE,1,64,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0625,0,0,0.09,0,0.04,0,0.1225,0.25,0.9025,0,0,0.25,0,0,0,0.25,0.1296,1,1,0,1,0,0.182039286,0.040357143,0.323721429,29,90.63,26,81.25,6,75,7,87.5,7,87.5,6,75,15,93.75,11,68.75,90.59,73,93.12,96.88,99.38,89.94,91.25,9.38,9.34,-2,5.62,9.38,24.38,-3.81,22.5,0,0,0,3,2,0,0,0,0,1,0,0,1,2,0,0,0,3,2,1,0,0,0,0,1,2,0,0,1,0,0,0,0,1,0,0,2,1,2,3,1,0.2,0.6,1.2,0.2,0.6,0.2,1.6,0.75,0.65,1.67,2.67,-2,-2,1,2,-1,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,0.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,3,1,-2,0,0,-1,1,0,0,1,1,0,0,-2,2,0,-2,0.8,-0.4,0.4,-0.4,0.1,HS_TS +221,R_7g6FXrNVvkYg5md,60 - 66,American,Female,0,2,2,0,0,-2,-1,1,-1,0,1,0,2,0,2,0,1,2,0,-1,0,2,2,0,0,5,-1,-1,1,-1,0,7,0,0,2,0,2,4,0,1,1,0,0,3,0,2,2,0,0,6,-1,-1,1,-1,0,7,0,0,2,0,2,3,0,0,1,0,0,6,TRUE,0,71,TRUE,1,89,FALSE,1,100,FALSE,1,51,TRUE,1,80,FALSE,1,100,TRUE,1,89,TRUE,1,93,TRUE,1,77,TRUE,1,55,FALSE,1,93,FALSE,1,88,TRUE,1,100,TRUE,0,65,TRUE,1,61,TRUE,1,100,FALSE,1,96,TRUE,0,92,FALSE,1,60,FALSE,1,100,FALSE,0,100,TRUE,1,83,FALSE,1,100,TRUE,1,86,FALSE,1,96,TRUE,1,90,TRUE,0,81,FALSE,1,95,TRUE,0,87,TRUE,1,96,TRUE,1,89,TRUE,1,100,0.0049,0.01,0,0.0121,0,0,0.0196,0.2025,0,0.0289,0.0016,0,0.0529,0.0049,0.04,0.0121,0,0.2401,0.0025,0.0016,1,0.1521,0.16,0.4225,0.0016,0.6561,0.0121,0.5041,0,0.8464,0.7569,0.0144,0.183317857,0.043042857,0.323592857,25,78.13,26,81.25,7,87.5,6,75,5,62.5,8,100,15,93.75,11,68.75,86.34,75.12,95.38,80.12,94.75,86.75,85.94,-3.12,5.09,-12.38,20.38,17.62,-5.25,-7,17.19,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0.2,0.2,0.4,0,0.2,0.2,0.6,0.2,0.25,5.33,5.33,-1,0,1,-3,0,10 cents,5 minutes,24 days,Female,Professional Degree (ex. JD/MD),62,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-0.2,-0.05,grad_prof +222,R_3k0uiZGeVT6n0a1,46 - 52,American,Female,2,2,2,3,2,1,-1,1,-1,1,2,2,2,-1,2,1,0,1,1,0,2,2,2,2,2,6,2,-2,2,-2,2,7,2,2,2,2,2,6,1,-1,2,2,1,6,2,2,2,2,2,6,2,-2,2,-2,2,7,2,2,2,2,2,7,2,2,2,2,2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,79,TRUE,0,100,TRUE,1,99,TRUE,0,80,TRUE,1,86,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,79,FALSE,1,81,FALSE,0,100,TRUE,1,80,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,81,TRUE,0,79,TRUE,1,100,FALSE,0,85,TRUE,1,100,0,0,0,0,0,0,0,1,0.0361,0.04,0,0.0001,0,0.0441,0,0,0,0.0676,0.6561,0,1,0.0196,0.6241,0.64,0.81,0.25,0.7225,1,0,1,0.6241,1,0.340510714,0.08485,0.596171429,17,53.13,20,62.5,5,62.5,5,62.5,4,50,6,75,13,81.25,7,43.75,91.97,81.62,96,95,95.25,96.88,87.06,-9.37,29.47,19.12,33.5,45,20.25,15.63,43.31,0,0,0,1,0,1,1,1,1,1,0,0,0,3,0,0,1,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,0,3,0,1,2,1,1,2,0.2,1,0.6,0.8,0.2,1,0.6,1.4,0.65,0.8,6.33,6.67,0,0,-1,1,-0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,49,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,0,-1,0,0,0,-0.6,-0.15,C_Ug +223,R_7ojPyhcZ9OXZ470,60 - 66,American,Female,2,0,2,2,-2,0,0,2,1,1,1,0,2,-2,2,1,0,1,1,1,1,1,1,-1,1,9,1,1,1,1,1,6,1,0,2,-2,2,5,0,-1,-1,1,2,8,1,0,2,2,-2,5,-1,0,0,2,0,6,1,0,2,-2,2,3,1,-1,1,2,2,2,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,75,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,TRUE,1,92,TRUE,0,100,TRUE,1,87,TRUE,1,100,TRUE,0,96,FALSE,1,93,FALSE,1,80,FALSE,1,64,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,95,TRUE,1,100,0,0,0,0,0,0,0,0,0.1296,0,0,0.0064,0.25,0.0081,0.25,0.0361,0,0.5625,0,1,1,0.0169,0.04,1,0.9216,0.0625,0.9025,0.25,0.25,0.0049,1,1,0.310396429,0.088764286,0.532028571,28,87.5,22,68.75,5,62.5,4,50,6,75,7,87.5,12,75,10,62.5,88.41,79.25,92.25,92.88,89.25,90.94,85.88,18.75,19.66,16.75,42.25,17.88,1.75,15.94,23.38,1,1,1,3,3,1,1,1,0,0,0,0,0,0,0,1,1,2,0,1,1,0,0,0,0,1,0,2,1,1,0,0,0,0,0,0,1,0,1,1,1.8,0.6,0,1,0.2,1,0,0.6,0.85,0.45,6.67,4.67,4,0,2,6,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,1,1,3,3,0,1,-1,-1,-1,0,0,0,0,0,1,0,2,-1,0,1.6,-0.4,0,0.4,0.4,HS_TS +224,R_3XdEnFjaTRbjdzR,46 - 52,Canadian,Female,3,3,3,2,3,-2,-3,3,3,3,-1,1,3,1,3,-3,-2,-3,-3,-3,-3,-3,-3,-3,-3,8,-2,-2,3,3,3,8,1,1,3,-2,3,8,-2,-1,1,2,2,9,-3,-3,-3,-3,-3,10,-3,-3,-3,-3,-3,8,-3,-3,-3,-3,-3,3,-3,-3,-3,-3,-3,7,TRUE,0,82,TRUE,1,74,TRUE,0,81,TRUE,0,76,TRUE,1,87,TRUE,0,80,TRUE,1,86,TRUE,1,87,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,92,FALSE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,72,FALSE,1,90,FALSE,1,81,FALSE,1,85,FALSE,0,94,FALSE,0,83,FALSE,1,85,TRUE,1,100,FALSE,1,75,TRUE,1,79,FALSE,1,80,FALSE,1,91,TRUE,0,80,FALSE,0,89,TRUE,1,85,TRUE,1,100,0.0169,0.0441,0,0.0196,0,0.64,0,0,0.0225,0.6889,0.7921,0.8464,0.0081,0,0.0169,0.0676,0.0225,0.5776,0.0081,0.0625,0.8836,0.0081,0.0361,0,0.0784,0.04,0.0225,0.6724,0.6561,0.01,0.64,1,0.278585714,0.263042857,0.294128571,18,56.25,22,68.75,7,87.5,4,50,6,75,5,62.5,12,75,10,62.5,87.38,84.75,86.25,86.88,91.62,89.88,84.88,-12.5,18.63,-2.75,36.25,11.88,29.12,14.88,22.38,6,6,6,5,6,0,1,0,0,0,2,0,0,3,0,1,1,4,5,5,6,6,6,5,6,1,0,6,6,6,2,4,6,4,6,0,1,0,0,0,5.8,0.2,1,3.2,5.8,3.8,4.4,0.2,2.55,3.55,8,7,-2,0,5,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,51,1.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,-1,1,-6,-6,-6,0,-4,-6,-1,-6,1,0,4,5,5,0,-3.6,-3.4,3,-1,C_Ug +225,R_3rCZdWPhxfYeoQI,60 - 66,American,Male,3,3,3,3,2,0,-2,2,1,1,1,3,3,2,3,-1,1,2,1,-2,3,3,3,2,2,6,0,-2,1,1,0,9,1,3,3,-1,3,1,-1,1,1,1,-2,5,3,3,3,3,3,1,0,-1,2,0,1,1,1,3,3,0,3,2,1,2,1,1,-2,1,TRUE,0,100,TRUE,1,100,FALSE,1,95,FALSE,1,50,TRUE,1,70,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,55,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,90,TRUE,1,50,TRUE,1,100,TRUE,0,65,TRUE,0,96,FALSE,1,70,FALSE,1,100,TRUE,1,65,TRUE,1,96,FALSE,1,75,TRUE,1,50,TRUE,0,80,FALSE,0,50,FALSE,1,60,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.25,0,0,0,0.0025,0.25,0.2025,0,0.0016,0,0,0.01,0.0025,0.09,0,0.0625,0.25,0.81,0.64,0.1225,0.25,0.09,0.81,0.4225,0.16,0.25,1,0.0025,0.9216,0.25,1,0.271453571,0.062257143,0.48065,24,75,24,75,8,100,7,87.5,3,37.5,6,75,15,93.75,9,56.25,80.84,70.62,77.5,83.38,91.88,79.75,81.94,0,5.84,-29.38,-10,45.88,16.88,-14,25.69,0,0,0,1,0,0,0,1,0,1,0,0,0,3,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,2,0,2,1,1,0,0,0.2,0.4,0.6,0.2,0.2,0.4,0.4,0.8,0.35,0.45,5.33,1.33,5,8,-1,4,4,10 cents,25 minutes,15 days,Male,University - Graduate (Masters),61,1.375,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,1,-1,0,-1,1,-1,1,0,0,0,1,0,-2,-1,0,0,0,0,0,0.2,-0.6,-0.1,grad_prof +226,R_5rwEoL80JtdSsdX,60 - 66,American,Female,-2,3,2,-3,2,2,-1,2,1,0,3,2,2,2,3,-1,1,1,-1,-2,-2,3,0,-3,-1,4,2,-1,-1,1,-1,6,1,1,1,0,0,7,-2,0,-2,-2,-2,8,0,3,2,-2,2,2,2,-1,2,0,-1,2,3,2,3,-1,3,7,1,0,1,1,-2,4,TRUE,0,63,TRUE,1,75,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,59,TRUE,1,74,TRUE,1,59,FALSE,0,50,FALSE,0,60,FALSE,1,50,TRUE,0,86,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,76,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.1681,0,0.0576,0.0676,0,0.1681,0.25,0.36,0,0.25,0,0,0.25,0.25,0.25,0.0625,0,0.25,0,1,0.25,0.25,1,1,0.25,0.25,0.25,0.3969,0,0,1,0.7396,0.302753571,0.149328571,0.456178571,11,34.38,21,65.63,4,50,7,87.5,3,37.5,7,87.5,12,75,9,56.25,75.06,59.38,76.12,80.88,83.88,68.38,81.75,-31.25,9.43,9.38,-11.38,43.38,-3.62,-6.62,25.5,0,0,2,0,3,0,0,3,0,1,2,1,1,2,3,1,1,3,1,0,2,0,0,1,0,0,0,0,1,1,0,0,1,3,0,2,1,0,2,0,1,0.8,1.8,1.2,0.6,0.4,0.8,1,1.2,0.7,5.67,3.67,2,4,0,4,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,-2,0,2,-1,3,0,0,3,-1,0,2,1,0,-1,3,-1,0,3,-1,0,0.4,0.4,1,0.2,0.5,C_Ug +227,R_6OVzbh3kj7EIBeq,53 - 59,Canadian,Female,3,0,0,1,3,-1,-1,2,-2,2,1,3,3,1,2,1,1,1,2,1,3,0,0,1,3,0,-1,-2,2,-2,2,0,2,2,3,2,2,1,1,1,1,1,1,1,3,0,0,1,3,1,-1,-2,2,-2,2,0,1,2,3,0,2,1,2,1,2,2,2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,92,FALSE,0,56,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,88,FALSE,1,75,TRUE,1,59,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,90,TRUE,1,97,TRUE,0,82,FALSE,1,70,FALSE,1,86,FALSE,0,81,FALSE,0,92,TRUE,1,100,0,0.0009,0,0,0,0,0,0,0.0625,0,0.6561,0,0,0,0.3136,0,0.04,0.0064,0.09,0.01,0.1681,0,0.7744,0,0.7569,0.6724,0.8464,0,1,1,0.0196,1,0.264871429,0.077042857,0.4527,28,87.5,23,71.88,5,62.5,6,75,7,87.5,5,62.5,13,81.25,10,62.5,91.72,94.25,83.5,98.38,90.75,92.81,90.62,15.62,19.84,31.75,8.5,10.88,28.25,11.56,28.12,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0.2,0.6,0.2,0,0.2,0.4,0.6,0.25,0.3,0.33,0.67,-1,0,0,0,-0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,-1,1,-1,0,0,0.2,-0.4,-0.05,C_Ug +228,R_3CKv8BRmfzwHhXp,46 - 52,American,Female,3,3,3,3,1,0,2,1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,3,3,3,3,3,7,1,-2,1,-2,2,5,2,-1,1,-1,-2,6,2,2,2,2,2,4,3,3,3,3,2,5,-1,2,2,-2,1,6,2,2,2,-1,-1,5,2,2,2,2,2,5,FALSE,1,84,TRUE,1,87,TRUE,0,88,FALSE,1,62,TRUE,1,80,FALSE,1,55,TRUE,1,82,TRUE,1,87,TRUE,1,73,TRUE,1,80,FALSE,1,83,TRUE,0,78,TRUE,1,72,TRUE,0,80,TRUE,1,72,TRUE,1,86,TRUE,0,66,FALSE,1,59,TRUE,0,61,FALSE,1,58,FALSE,0,55,TRUE,1,65,FALSE,1,91,TRUE,1,89,TRUE,0,75,TRUE,1,90,TRUE,0,76,FALSE,1,100,TRUE,0,89,TRUE,1,87,FALSE,0,57,TRUE,1,95,0.0169,0.01,0.0196,0.0324,0.0025,0.2025,0.0121,0.04,0.1764,0.1225,0.0169,0.0784,0.0729,0.0289,0.04,0.0169,0.0081,0.1444,0,0.5625,0.3025,0.0784,0.3721,0.64,0.4356,0.5776,0.3249,0.0256,0.7744,0.1681,0.7921,0.6084,0.236596429,0.06875,0.404442857,16,50,22,68.75,5,62.5,5,62.5,6,75,6,75,14,87.5,8,50,76.94,71.38,75.38,76.88,84.12,78.56,75.31,-18.75,8.19,8.88,12.88,1.88,9.12,-8.94,25.31,0,0,0,0,2,1,4,0,3,1,1,2,0,2,1,3,3,1,3,1,0,0,0,0,1,1,0,1,3,0,1,1,1,2,0,3,3,1,3,1,0.4,1.8,1.2,2.2,0.2,1,1,2.2,1.4,1.1,6,5.33,2,-1,1,-1,0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),49,1.25,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,1,0,4,-1,0,1,0,1,-1,0,1,0,0,0,0,0,0.2,0.8,0.2,0,0.3,HS_TS +229,R_3lnLirb7cmoNtqp,39 - 45,American,Female,3,2,1,-3,3,0,1,3,1,2,3,0,3,-2,3,-3,-3,-2,-2,0,0,2,1,-3,3,1,0,0,3,-1,2,7,3,0,3,-2,3,0,0,0,1,-2,0,7,3,2,1,-3,3,1,0,1,3,0,1,1,3,0,3,-3,3,1,0,0,0,0,0,3,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,0,50,TRUE,0,60,TRUE,0,75,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,0,70,FALSE,0,50,TRUE,0,70,TRUE,1,97,FALSE,1,50,TRUE,0,95,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,75,0,0.0009,0.0625,0,0.0625,0,0.25,0,0.25,0.25,0.0625,0,0.25,0,0.25,0.25,0.49,0.25,0.9025,0.49,0.0625,0.0625,0.5625,0.25,0.25,0.25,0.25,0.25,1,0.36,0.25,1,0.296607143,0.168928571,0.424285714,16,50,17,53.13,4,50,5,62.5,4,50,4,50,12,75,5,31.25,71.62,62.5,71.25,72.12,80.62,73.25,70,-3.13,18.49,12.5,8.75,22.12,30.62,-1.75,38.75,3,0,0,0,0,0,1,0,2,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,3,3,2,2,0,0.6,0.6,0,1.8,0,0.4,0.2,2,0.75,0.65,2.67,1,0,6,-1,4,1.67,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),39,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,02REV,3,0,0,0,0,0,1,0,1,-1,0,0,0,-1,0,0,0,1,-2,0,0.6,0.2,-0.2,-0.2,0.1,grad_prof +230,R_54iwi18tDXM5uP4,46 - 52,Canadian,Male,2,3,3,3,1,-1,1,3,-1,1,2,2,2,1,2,-1,-1,1,1,-1,2,3,3,3,2,3,-2,-1,3,-1,1,2,3,3,3,2,3,2,1,1,1,1,-1,3,1,3,3,3,1,2,-1,1,3,0,1,2,3,3,3,-1,3,3,1,1,1,1,-1,3,TRUE,0,64,FALSE,0,63,TRUE,0,65,FALSE,1,61,FALSE,0,71,FALSE,1,100,TRUE,1,86,FALSE,0,55,FALSE,0,59,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,1,65,FALSE,1,54,FALSE,0,61,FALSE,0,59,TRUE,0,78,TRUE,0,64,FALSE,1,71,FALSE,1,65,FALSE,0,62,FALSE,0,63,FALSE,1,58,FALSE,0,54,TRUE,0,68,TRUE,1,100,FALSE,1,56,TRUE,0,60,TRUE,0,55,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.3025,0,0.3481,0.0196,0,0,0.2916,0,0.1225,0.3969,0.01,0.1225,0.3481,0.49,0.5041,0.3969,0.1764,0.1521,0.36,0.4624,0.3844,0.3721,0.0841,0.2116,0.6084,0.1936,0.25,0.4096,0.4225,0.4096,0.3025,1,0.302925,0.215078571,0.390771429,13,40.63,13,40.63,3,37.5,4,50,4,50,2,25,6,37.5,7,43.75,69.59,61.38,73.62,74.88,68.5,71.12,68.06,0,28.96,23.88,23.62,24.88,43.5,33.62,24.31,0,0,0,0,1,1,2,0,0,0,1,1,1,1,1,2,2,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,2,1,2,2,0,0,0,0.2,0.6,1,0.8,0.2,0.2,1.2,0.8,0.65,0.6,2.33,2.33,1,0,-1,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,50,1,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,-1,0,0,0,1,1,2,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0.4,-0.2,0,0.05,C_Ug +231,R_7GqQFm5zoFfvVSt,60 - 66,American,Female,0,2,1,-2,2,2,-2,2,-1,0,2,1,1,1,2,1,2,2,1,1,0,2,2,-2,2,4,1,-3,2,-3,1,2,2,1,2,-2,2,2,1,1,2,1,1,4,0,2,1,-1,2,8,-2,-2,2,-2,1,2,2,1,1,-2,2,3,1,1,1,1,1,8,TRUE,0,98,TRUE,1,93,TRUE,0,94,FALSE,1,94,TRUE,1,96,FALSE,1,97,TRUE,1,96,TRUE,1,95,TRUE,1,96,TRUE,1,97,FALSE,1,83,TRUE,0,96,FALSE,0,91,TRUE,0,96,FALSE,0,91,TRUE,1,96,FALSE,1,95,FALSE,1,96,FALSE,1,98,FALSE,1,96,TRUE,1,96,TRUE,1,96,TRUE,0,83,TRUE,1,96,TRUE,0,97,TRUE,1,97,FALSE,1,94,TRUE,0,94,TRUE,0,98,TRUE,1,96,TRUE,1,96,TRUE,1,98,0.0025,0.0009,0.0016,0.0016,0.0004,0.0009,0.0016,0.0009,0.0016,0.0016,0.0016,0.8281,0.0016,0.0289,0.0016,0.0049,0.6889,0.0036,0.8836,0.9409,0.0016,0.8281,0.0004,0.9216,0.0025,0.0036,0.0016,0.9604,0.8836,0.0016,0.9604,0.9216,0.317060714,0.111871429,0.52225,30,93.75,22,68.75,7,87.5,5,62.5,5,62.5,5,62.5,14,87.5,8,50,94.84,93.12,94.25,96.62,95.38,95.38,94.31,25,26.09,5.62,31.75,34.12,32.88,7.88,44.31,0,0,1,0,0,1,1,0,2,1,0,0,1,3,0,0,1,0,0,0,0,0,0,1,0,4,0,0,1,1,0,0,0,3,0,0,1,1,0,0,0.2,1,0.8,0.2,0.2,1.2,0.6,0.4,0.55,0.6,2.67,4.33,-4,0,-1,-4,-1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,0.625,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,1,-1,0,-3,1,0,1,0,0,0,1,0,0,0,0,-1,0,0,0,-0.2,0.2,-0.2,-0.05,C_Ug +232,R_6zUDlbxSGcq66dq,60 - 66,American,Female,1,2,2,-3,3,0,-2,2,3,0,-1,-1,2,0,1,-2,-1,0,0,-3,3,1,2,-3,3,7,1,-2,1,-1,1,7,1,-2,3,3,3,7,-2,1,1,-2,-3,5,2,2,2,1,2,4,1,-2,1,-2,-1,2,0,-2,1,-2,1,2,2,2,2,1,-3,8,FALSE,1,77,TRUE,1,88,FALSE,1,100,FALSE,1,54,FALSE,0,56,FALSE,1,100,TRUE,1,62,TRUE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,90,TRUE,1,53,TRUE,1,89,FALSE,1,57,TRUE,0,100,TRUE,0,54,FALSE,1,66,TRUE,1,59,TRUE,1,55,FALSE,1,53,TRUE,1,95,FALSE,1,100,TRUE,1,84,TRUE,0,53,FALSE,1,100,TRUE,0,90,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0.0256,0.0121,0.1444,0,0,0.0025,0,0.1156,0.2025,0,0,0.2401,0,0.3136,0.0144,0.2209,0.2116,0,0,0.1681,0.2209,0.2916,0.81,0.1849,0.2809,0.2809,0.0529,0,1,0.81,1,0.229335714,0.094371429,0.3643,21,65.63,24,75,5,62.5,6,75,6,75,7,87.5,14,87.5,10,62.5,79.34,63.25,76.88,83.5,93.75,77.81,80.88,-9.37,4.34,0.75,1.88,8.5,6.25,-9.69,18.38,2,1,0,0,0,1,0,1,4,1,2,1,1,3,2,0,2,1,2,0,1,0,0,4,1,1,0,1,5,1,1,1,1,2,0,4,3,2,1,0,0.6,1.4,1.8,1,1.2,1.6,1,2,1.2,1.45,7,2.67,3,5,5,-3,4.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,63,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,1,0,-4,-1,0,0,0,-1,0,1,0,0,1,2,-4,-1,-1,1,0,-0.6,-0.2,0.8,-1,-0.25,C_Ug +233,R_5VLj8wSI5Etrp3X,53 - 59,American,Female,3,1,1,-3,-2,0,-3,1,-2,1,1,1,2,-2,1,-2,-2,1,1,-2,3,2,1,-2,-2,1,1,-2,1,-2,1,1,1,1,1,-3,1,1,0,-1,1,-1,-2,2,3,2,2,-2,-2,1,1,-2,1,-2,1,1,1,1,1,-2,1,1,-1,0,0,0,-1,1,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,77,TRUE,1,100,FALSE,1,78,TRUE,1,92,TRUE,1,100,TRUE,1,96,TRUE,1,76,FALSE,1,70,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,99,TRUE,0,64,TRUE,0,100,TRUE,0,91,TRUE,0,50,TRUE,1,91,TRUE,1,96,FALSE,1,100,TRUE,1,92,FALSE,1,67,TRUE,1,90,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,0,0.01,0.0001,0.0064,0.0081,0.0484,0.0064,0.0576,0.25,0.0016,0,0,0.0016,0.09,0,0.01,0,0.5929,0,0.1089,0.0081,0.09,0.8281,1,0.4096,0.25,0,0,0,1,1,0.25,0.214689286,0.076185714,0.353192857,28,87.5,23,71.88,5,62.5,6,75,6,75,6,75,16,100,7,43.75,86.88,80.5,90.5,90.12,86.38,92.69,81.06,15.62,15,18,15.5,15.12,11.38,-7.31,37.31,0,1,0,1,0,1,1,0,0,0,0,0,1,1,0,2,1,0,2,0,0,1,1,1,0,1,1,0,0,0,0,0,1,0,0,1,2,1,1,1,0.4,0.4,0.4,1,0.6,0.4,0.2,1.2,0.55,0.6,1,1,0,0,0,1,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,57,0.625,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,1,-1,-1,1,-1,-0.2,0,0.2,-0.2,-0.05,C_Ug +234,R_5j7L6CmlWnkapAw,46 - 52,Canadian,Female,2,1,2,1,0,-1,-2,0,-2,1,0,0,2,0,0,-2,-1,-1,-1,-1,2,2,2,1,2,10,-1,-2,0,-2,1,0,0,0,1,-1,-3,1,1,2,2,2,-1,10,2,1,2,2,0,0,-1,-1,0,-2,1,1,1,0,1,0,0,5,-1,-1,-1,-1,-1,0,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,93,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,1,1,0.8649,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0.209460714,0.276064286,0.142857143,30,93.75,26,81.25,5,62.5,7,87.5,7,87.5,7,87.5,11,68.75,15,93.75,99.78,100,99.12,100,100,99.56,100,12.5,18.53,37.5,11.62,12.5,12.5,30.81,6.25,0,1,0,0,2,0,0,0,0,0,0,0,1,1,3,3,3,3,3,0,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0.6,0,1,2.4,0.2,0.2,0.4,0.2,1,0.25,3.67,2,10,-1,-4,10,1.67,5 cents,5 minutes,47 days,Female,University - Undergraduate,50,0.75,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,1,0,-1,2,0,-1,0,0,0,-1,0,0,1,3,2,3,3,3,0,0.4,-0.2,0.6,2.2,0.75,C_Ug +235,R_1VKMbZSA4ZQ4nRL,60 - 66,American,Female,0,-1,2,3,3,-3,2,2,2,3,-1,-1,2,-3,3,-2,-3,-2,-2,-1,2,0,1,1,2,3,-1,3,1,2,2,3,-2,-1,2,-3,3,2,-3,-3,-2,-2,-1,4,1,1,1,3,2,2,-2,2,2,2,2,2,-1,1,3,-2,3,4,-2,-2,-2,-3,-1,2,TRUE,0,93,TRUE,1,100,TRUE,0,99,FALSE,1,50,TRUE,1,89,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,76,TRUE,1,87,FALSE,1,99,TRUE,0,82,TRUE,1,95,TRUE,0,79,TRUE,1,61,TRUE,1,100,FALSE,1,91,TRUE,0,87,TRUE,0,91,FALSE,1,100,TRUE,1,80,TRUE,1,86,FALSE,1,100,TRUE,1,98,FALSE,1,100,TRUE,1,96,TRUE,0,92,FALSE,1,76,TRUE,0,91,TRUE,1,94,FALSE,0,80,TRUE,1,94,0,0.0016,0,0.0001,0.0036,0,0.0004,0.0169,0,0.0196,0.0036,0.0025,0.0576,0.0001,0.0121,0,0,0.25,0.0576,0,0.04,0.1521,0.8281,0.6241,0.0081,0.8464,0.64,0.8649,0.9801,0.7569,0.8281,0.6724,0.273757143,0.026171429,0.521342857,26,81.25,23,71.88,5,62.5,7,87.5,5,62.5,6,75,15,93.75,8,50,89.53,81.12,92.5,90.88,93.62,89.69,89.38,9.37,17.65,18.62,5,28.38,18.62,-4.06,39.38,2,1,1,2,1,2,1,1,0,1,1,0,0,0,0,1,0,0,0,0,1,2,1,0,1,1,0,0,0,1,0,2,1,1,0,0,1,0,1,0,1.4,1,0.2,0.2,1,0.4,0.8,0.4,0.7,0.65,2.67,2.67,1,1,-2,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,63,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,-1,0,2,0,1,1,1,0,0,1,-2,-1,-1,0,1,-1,0,-1,0,0.4,0.6,-0.6,-0.2,0.05,C_Ug +236,R_5qfba3NnReh8vR9,67 - 73,Canadian,Female,3,3,1,-3,3,0,-2,3,-3,3,2,-2,3,-3,3,3,3,3,3,3,3,3,1,-3,3,0,1,-2,3,-2,3,1,2,-3,3,-3,3,1,1,1,1,1,1,3,3,3,1,-3,3,0,1,-3,3,-3,3,0,2,-2,3,-3,3,0,3,3,2,3,2,1,TRUE,0,100,TRUE,1,91,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,80,TRUE,0,50,TRUE,0,64,TRUE,1,72,TRUE,0,89,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,91,TRUE,0,77,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,92,TRUE,0,76,TRUE,1,93,TRUE,0,75,TRUE,0,82,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.0049,0,0,0,0.25,0.0064,0.64,0,0.25,0,0.0784,0.0081,0.25,0,0.0081,0,0.25,0.6724,0.5776,0.25,0.25,0.5929,0.7921,0.25,0.5625,1,1,1,0.8281,1,0.4096,0.390221429,0.124357143,0.656085714,25,78.13,16,50,4,50,5,62.5,2,25,5,62.5,12,75,4,25,81.97,73,77.75,84.88,92.25,85.56,78.38,28.13,31.97,23,15.25,59.88,29.75,10.56,53.38,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,2,2,2,2,2,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0.4,0.2,2,0,0.4,0,0.4,0.65,0.2,0.67,0,0,1,1,2,0.67,10 cents,100 minutes,47 days,Female,Trade School (non-military),72,1.625,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,-1,0,1,0,0,1,0,0,0,2,2,1,2,1,0,0,0.2,1.6,0.45,HS_TS +237,R_5ds5A7mqBfTU6tT,53 - 59,American,Female,3,3,1,3,1,1,-2,2,-2,1,-1,-2,3,0,3,1,0,1,3,2,2,2,-1,0,2,1,1,-2,1,-2,3,1,-2,-2,3,-1,3,0,1,0,2,1,1,5,3,3,2,3,-2,1,0,-3,-1,-2,1,1,-2,-2,2,-2,3,1,-2,-1,1,1,0,6,FALSE,1,91,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,85,FALSE,1,76,FALSE,1,78,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,57,TRUE,0,97,FALSE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,96,TRUE,1,99,FALSE,1,100,TRUE,1,88,TRUE,0,79,FALSE,1,60,FALSE,1,96,TRUE,1,100,TRUE,1,69,FALSE,0,100,0,0.0144,0,0,1,0,0.0001,0.7225,0,0,0,0,0.0225,0.0576,0.0529,0,0.0016,0.25,0.16,0,0.0009,0.25,0,1,0.3249,0.6241,0.0961,0.0081,0,0.9409,0.0016,0.0484,0.19865,0.150514286,0.246785714,25,78.13,26,81.25,7,87.5,6,75,5,62.5,8,100,14,87.5,12,75,88.44,76.12,90.38,95.12,92.12,90.62,86.25,-3.12,7.19,-11.38,15.38,32.62,-7.88,3.12,11.25,1,1,2,3,1,0,0,1,0,2,1,0,0,1,0,0,0,1,2,1,0,0,1,0,3,1,1,3,0,0,1,0,1,2,0,3,1,0,2,2,1.6,0.6,0.4,0.8,0.8,1,0.8,1.6,0.85,1.05,0.67,1,0,0,-1,-1,-0.33,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,59,0.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,1,1,3,-2,-1,-1,-2,0,2,0,0,-1,-1,0,-3,-1,1,0,-1,0.8,-0.4,-0.4,-0.8,-0.2,C_Ug +238,R_6o4LQv42EL708UR,60 - 66,Canadian,Male,1,3,2,-1,3,-2,1,1,1,1,1,1,1,1,1,0,1,-1,1,-1,2,3,2,-1,3,4,0,0,1,1,0,5,2,1,0,2,1,4,1,1,0,1,1,5,1,2,2,-1,3,4,-2,1,1,1,1,6,2,1,1,0,1,7,-1,-2,-1,-1,0,4,FALSE,1,100,FALSE,0,59,FALSE,1,62,FALSE,1,59,TRUE,1,57,TRUE,0,73,TRUE,1,61,TRUE,1,74,TRUE,1,100,FALSE,0,67,FALSE,1,59,TRUE,0,100,FALSE,0,100,FALSE,1,70,TRUE,1,62,TRUE,1,100,TRUE,0,100,FALSE,1,81,FALSE,1,100,TRUE,0,58,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,67,TRUE,0,56,TRUE,1,79,TRUE,0,100,FALSE,1,54,TRUE,0,55,TRUE,1,100,FALSE,0,100,FALSE,0,69,0.0676,0.0441,0,0.1521,0.4761,0.5329,0.1089,0.4489,0.3364,0,0,1,0,0.1681,0.1849,0.3481,0,0.1681,0.2116,0.3136,1,0.1444,0,0.09,1,1,1,0,0.1444,0.0361,0.3025,1,0.357678571,0.269457143,0.4459,15,46.88,19,59.38,5,62.5,2,25,6,75,6,75,10,62.5,9,56.25,78.81,79.88,81.75,76.75,76.88,80.94,76.69,-12.5,19.43,17.38,56.75,1.75,1.88,18.44,20.44,1,0,0,0,0,2,1,0,0,1,1,0,1,1,0,1,0,1,0,2,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,3,0,2,1,0.2,0.8,0.6,0.8,0.2,0,0.4,1.4,0.6,0.5,4.33,5.67,0,-1,-3,1,-1.34,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),62,0.25,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,1,-1,0,0,0,2,1,0,0,1,0,0,1,0,0,0,-3,1,-2,1,0,0.8,0.2,-0.6,0.1,grad_prof +239,R_5wvQyrUh6tDd2Fw,67 - 73,American,Male,1,2,3,2,1,1,-1,2,-1,1,2,2,2,1,2,1,-1,1,-2,-2,1,2,1,0,1,3,2,-1,2,-2,0,3,2,2,2,0,2,3,1,1,-1,-1,0,3,1,2,2,1,1,3,1,-1,1,0,1,3,2,1,2,1,2,3,0,-1,0,0,-1,4,FALSE,1,62,TRUE,1,75,FALSE,1,100,FALSE,1,98,FALSE,0,80,FALSE,1,86,TRUE,1,85,TRUE,1,73,FALSE,0,78,FALSE,0,84,FALSE,1,96,TRUE,0,96,TRUE,1,92,FALSE,1,89,FALSE,0,73,TRUE,1,98,TRUE,0,83,TRUE,0,97,FALSE,1,88,FALSE,1,100,FALSE,0,71,FALSE,0,83,TRUE,0,81,TRUE,1,91,TRUE,0,89,TRUE,1,94,FALSE,1,89,FALSE,1,84,FALSE,1,87,TRUE,1,91,TRUE,1,97,TRUE,1,92,0.0729,0.0036,0.0004,0.0225,0.0064,0.0196,0.0081,0.7056,0,0.6889,0.0081,0.0064,0.6084,0.0016,0.64,0.0625,0.6561,0.0004,0.0256,0.7921,0.5041,0.5329,0.0144,0.0121,0.6889,0.0121,0.0009,0.1444,0,0.9409,0.0169,0.9216,0.286392857,0.243721429,0.329064286,24,75,21,65.63,6,75,4,50,4,50,7,87.5,10,62.5,11,68.75,86.94,86.75,84,85.38,91.62,84.81,89.06,9.37,21.31,11.75,34,35.38,4.12,22.31,20.31,0,0,2,2,0,1,0,0,1,1,0,0,0,1,0,0,2,2,1,2,0,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,2,1,0.8,0.6,0.2,1.4,0.4,0.4,0.2,1,0.75,0.5,3,3,0,0,0,-1,0,10 cents,75 minutes,24 days,Male,University - Undergraduate,68,0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,1,1,0,1,0,-1,0,1,0,-1,0,1,0,-1,2,1,-1,1,0.4,0.2,0,0.4,0.25,C_Ug +240,R_7trHlNVY8Ujs9mp,53 - 59,American,Female,2,2,2,3,3,1,0,2,1,2,2,1,2,0,3,1,1,1,2,-3,1,2,2,3,3,8,2,1,0,0,1,9,-1,1,-1,1,-1,9,1,-1,-2,-2,-3,9,3,2,2,3,3,9,2,-1,2,1,2,9,3,2,3,-3,3,9,2,2,2,2,1,9,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,FALSE,0,75,FALSE,1,75,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,75,TRUE,0,75,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,75,TRUE,1,75,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,FALSE,1,75,TRUE,0,65,FALSE,0,100,FALSE,0,75,TRUE,1,100,1,0,0.0625,0,0,0.0625,0,0.0625,0,0,1,0,1,0.5625,0.5625,0,0.5625,0.0625,0.0625,0,0,0.0625,1,0.5625,1,0.0625,0.5625,0,0,1,0.4225,1,0.343214286,0.276785714,0.409642857,16,50,19,59.38,4,50,4,50,6,75,5,62.5,11,68.75,8,50,89.53,84.38,86.25,93.75,93.75,92.19,86.88,-9.38,30.15,34.38,36.25,18.75,31.25,23.44,36.88,1,0,0,0,0,1,1,2,1,1,3,0,3,1,4,0,2,3,4,0,1,0,0,0,0,1,1,0,0,0,1,1,1,3,0,1,1,1,0,4,0.2,1.2,2.2,1.8,0.2,0.4,1.2,1.4,1.35,0.8,8.67,9,-1,0,0,0,-0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),58,0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,2,1,1,2,-1,2,-2,4,-1,1,2,4,-4,0,0.8,1,0.4,0.55,grad_prof +241,R_32WfQVSCfaI1ZCN,67 - 73,American,Male,2,2,2,2,2,-1,1,0,-1,-1,1,-1,2,0,2,-1,0,0,-1,-1,2,2,2,2,2,1,-1,1,1,0,-1,3,-1,-1,0,-1,2,2,-1,-1,-1,-1,-1,3,2,2,2,2,2,0,-1,1,1,0,-1,2,-1,-1,1,0,2,2,0,0,0,0,-1,2,TRUE,0,90,TRUE,1,95,FALSE,1,93,FALSE,1,89,TRUE,1,90,FALSE,1,86,TRUE,1,98,TRUE,1,96,TRUE,1,82,TRUE,1,85,FALSE,1,88,TRUE,0,90,FALSE,0,88,TRUE,0,90,TRUE,1,74,TRUE,1,100,FALSE,1,94,TRUE,0,97,TRUE,0,90,FALSE,1,100,FALSE,0,88,TRUE,1,94,FALSE,1,94,TRUE,1,92,FALSE,1,96,TRUE,1,94,FALSE,1,72,FALSE,1,84,TRUE,0,76,TRUE,1,100,FALSE,0,50,TRUE,1,99,0.0016,0.0036,0,0.0004,0.0001,0.0196,0.0064,0.0225,0,0.0036,0,0.7744,0.0324,0.0144,0.01,0.0025,0.0036,0.0121,0.0256,0.0016,0.7744,0.0676,0.81,0.81,0.0036,0.0784,0.25,0.81,0.0049,0.9409,0.5776,0.81,0.245221429,0.0644,0.426042857,26,81.25,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,89.19,80,89.38,93,94.38,89.06,89.31,9.37,17.31,5,26.88,30.5,6.88,7.81,26.81,0,0,0,0,0,0,0,1,1,0,2,0,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,2,0,1,0,0,1,0,0,1,0,0,0.4,1,0.4,0,0.4,0.6,0.4,0.45,0.35,2,1.33,1,1,0,1,0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,72,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,-1,1,1,-1,0,0,0,0.4,0,0.1,C_Ug +242,R_7NyRGAJKCMGNlQ2,60 - 66,American,Male,2,3,0,0,2,-1,1,1,1,0,3,0,3,3,-3,-3,-3,-3,-3,-3,3,3,1,0,0,10,-2,1,1,1,0,10,3,0,3,3,-3,10,-3,-3,-3,-3,-3,10,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,96,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,91,FALSE,0,100,TRUE,1,74,TRUE,1,55,FALSE,1,100,TRUE,0,54,TRUE,1,100,TRUE,0,100,TRUE,1,66,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,81,FALSE,1,100,FALSE,0,50,TRUE,1,81,FALSE,1,50,TRUE,1,89,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,80,TRUE,1,57,TRUE,1,100,1,0,0,0.0081,0,0,0.0121,0.2025,0,0.0361,0.04,0,0.0676,0,0.25,0.0016,0.25,0.25,1,0.25,0.25,0.1156,0.6561,1,0,0,0.1849,0,0,1,1,0.2916,0.244932143,0.079278571,0.410585714,23,71.88,22,68.75,6,75,6,75,5,62.5,5,62.5,14,87.5,8,50,83.56,78,81.25,84.62,90.38,80.56,86.56,3.13,14.81,3,6.25,22.12,27.88,-6.94,36.56,1,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,0,0,2,1,1,1,1,0,3,0,3,3,3,3,3,3,3,3,0.8,0.2,0,0,1.4,0.8,2.4,3,0.25,1.9,10,5,5,5,5,5,5,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),61,1.375,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-1,-3,1,0,0,0,-1,-1,-1,0,-3,0,-3,-3,-3,-3,-3,-3,-3,-3,-0.6,-0.6,-2.4,-3,-1.65,grad_prof +243,R_3RlbqGMWL80DcgM,53 - 59,Canadian,Female,3,2,2,1,3,-1,-1,2,1,2,2,0,3,-2,2,-2,-1,1,-1,-1,2,2,2,0,2,1,-1,-1,2,1,1,2,2,0,2,0,2,3,-1,-1,0,-1,-1,3,3,2,2,1,2,1,-1,0,2,0,1,1,2,0,3,-2,2,1,-1,-1,0,0,0,1,TRUE,0,100,TRUE,1,100,FALSE,1,58,FALSE,1,57,FALSE,0,57,FALSE,1,88,FALSE,0,75,TRUE,1,92,TRUE,1,73,TRUE,1,86,FALSE,1,56,TRUE,0,87,TRUE,1,93,TRUE,0,58,FALSE,0,55,TRUE,1,100,FALSE,1,91,TRUE,0,98,FALSE,1,59,FALSE,1,88,FALSE,0,59,TRUE,1,97,FALSE,1,100,TRUE,1,97,FALSE,1,99,TRUE,1,98,FALSE,1,55,FALSE,1,78,TRUE,0,95,TRUE,1,90,FALSE,0,60,TRUE,1,95,0.0064,0.0004,0,0.5625,0.0025,0.0144,0.0009,0.0196,0.0144,0.0009,0.01,0.0049,0.0729,0.1936,0.3249,0,0,0.1849,0.0484,0.0001,0.3481,0.3025,0.1681,0.3364,0.0081,0.2025,0.36,1,0.1764,0.9604,0.9025,0.7569,0.229082143,0.060278571,0.397885714,16,50,22,68.75,6,75,5,62.5,4,50,7,87.5,11,68.75,11,68.75,81.06,64.38,84.75,88.88,86.25,82.94,79.19,-18.75,12.31,-10.62,22.25,38.88,-1.25,14.19,10.44,1,0,0,1,1,0,0,0,0,1,0,0,1,2,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,1,1,1,0.6,0.2,0.6,0.4,0.2,0.6,0,0.8,0.45,0.4,2,1,0,1,2,2,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,55,0.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,1,0,0,1,0,0,-1,0,-1,0,0,0,1,2,0,0,0,0,-1,-1,0.4,-0.4,0.6,-0.4,0.05,C_Ug +244,R_3NP9W6V4IxAnjR7,60 - 66,American,Female,3,3,-3,0,0,-3,-3,2,-3,1,2,-2,2,-2,2,1,1,2,0,-2,3,3,-3,0,1,0,-3,-3,1,-3,2,0,2,-2,2,-2,3,0,-1,-1,-1,0,-1,3,3,3,-3,0,-1,0,-3,-3,1,-3,1,0,1,-3,2,-3,3,0,0,0,0,0,-2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,75,FALSE,1,75,TRUE,1,75,TRUE,1,75,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0.09,0.0625,0.0625,0.0625,0.5625,0.25,0,0.25,0,0.0625,0,0,0.25,0.0625,1,0.099196429,0.010892857,0.1875,28,87.5,29,90.63,7,87.5,7,87.5,8,100,7,87.5,15,93.75,14,87.5,88.91,83.75,87.5,90.62,93.75,93.75,84.06,-3.13,-1.72,-3.75,0,-9.38,6.25,0,-3.44,0,0,0,0,1,0,0,1,0,1,0,0,0,0,1,2,2,3,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,1,1,1,1,2,0,0,0.2,0.4,0.2,1.6,0.2,0.2,0.8,0.8,0.6,0.5,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,66,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,1,-1,-1,0,-1,0,1,1,1,0,1,0,0.2,-0.6,0.8,0.1,C_Ug +245,R_3sjJd1nWoml3n0t,67 - 73,Canadian,Female,3,3,3,1,3,3,0,3,0,3,2,-1,3,0,3,-2,-1,1,-1,0,3,3,3,3,3,2,3,-2,3,-1,2,2,2,3,3,3,3,4,0,-1,-1,-1,-1,9,3,3,3,3,3,6,3,-2,2,-1,3,6,2,-1,3,0,3,7,0,0,1,1,-1,6,FALSE,1,55,TRUE,1,100,FALSE,1,76,TRUE,0,57,TRUE,1,85,TRUE,0,62,TRUE,1,100,TRUE,1,100,TRUE,1,68,TRUE,1,100,TRUE,0,96,TRUE,0,66,TRUE,1,79,TRUE,0,100,FALSE,0,65,TRUE,1,100,TRUE,0,60,FALSE,1,64,TRUE,0,78,FALSE,1,88,FALSE,0,61,TRUE,1,100,FALSE,1,82,TRUE,1,100,TRUE,0,62,TRUE,1,100,TRUE,0,65,FALSE,1,100,TRUE,0,100,TRUE,1,85,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.3844,0,0,0.0144,0,0.0225,0.0441,0.1024,0.9216,0.0225,0,0.0324,0.3249,0,0.3844,0.3721,0.4225,0.6084,1,0.36,0.4225,0,0.2025,0.0576,0.1296,1,0.4356,0.259442857,0.133514286,0.385371429,17,53.13,20,62.5,3,37.5,4,50,6,75,7,87.5,14,87.5,6,37.5,82.94,78.62,78.62,85.12,89.38,90.19,75.69,-9.37,20.44,41.12,28.62,10.12,1.88,2.69,38.19,0,0,0,2,0,0,2,0,1,1,0,4,0,3,0,2,0,2,0,1,0,0,0,2,0,0,2,1,1,0,0,0,0,0,0,2,1,0,2,1,0.4,0.8,1.4,1,0.4,0.8,0,1.2,0.9,0.6,2.67,6.33,-4,-4,-3,3,-3.66,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,2,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,-1,0,1,0,4,0,3,0,0,-1,2,-2,0,0,0,1.4,-0.2,0.3,C_Ug +246,R_3WDVJ4iJx1Pk9SF,60 - 66,Canadian,Female,2,2,2,2,-1,-3,1,1,1,0,3,2,3,0,3,-2,-2,-2,0,-3,3,3,3,0,-2,4,-3,0,2,1,-1,7,3,3,3,1,3,5,-1,-1,1,1,-2,6,2,2,2,3,-3,4,-3,1,1,1,0,4,3,1,2,-3,3,4,-1,-1,-1,-1,1,3,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,64,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,100,FALSE,1,79,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,67,FALSE,1,100,TRUE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,68,FALSE,1,97,FALSE,1,93,TRUE,1,100,TRUE,1,77,TRUE,1,100,0,0,0,0,0,0,0,1,0,0.0009,0,0,0.25,0.0441,0.1296,0,0,0.25,0.0009,0,0,0.25,0.4489,0,0,0.4624,0.0529,0.0009,0,1,0.0049,1,0.174839286,0.119614286,0.230064286,30,93.75,25,78.13,4,50,8,100,6,75,7,87.5,14,87.5,11,68.75,90.28,67.62,94.62,99.25,99.62,89.88,90.69,15.62,12.15,17.62,-5.38,24.25,12.12,2.38,21.94,1,1,1,2,1,0,1,1,0,1,0,1,0,1,0,1,1,3,1,1,0,0,0,1,2,0,0,0,0,0,0,1,1,3,0,1,1,1,1,4,1.2,0.6,0.4,1.4,0.6,0,1,1.6,0.9,0.8,5.33,4,0,3,1,3,1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,64,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,1,1,1,1,-1,0,1,1,0,1,0,0,-1,-2,0,0,0,2,0,-3,0.6,0.6,-0.6,-0.2,0.1,C_Ug +247,R_7k16stDRcdmYSEP,67 - 73,American,Female,0,0,1,0,0,0,0,-1,1,-1,0,-1,1,0,2,-3,-2,-2,-2,-3,2,2,2,1,2,7,1,0,1,0,1,5,0,0,0,0,0,5,0,0,1,-1,0,7,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,-3,-2,-1,-1,-2,5,FALSE,1,58,TRUE,1,77,TRUE,0,80,TRUE,0,50,TRUE,1,96,FALSE,1,88,TRUE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,89,FALSE,1,50,TRUE,1,90,TRUE,0,95,TRUE,1,91,TRUE,1,100,FALSE,1,50,TRUE,0,68,TRUE,0,50,FALSE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,72,TRUE,1,53,TRUE,0,68,FALSE,1,60,TRUE,0,78,TRUE,1,100,TRUE,1,67,TRUE,1,87,0,0.2209,0,0.0016,0.0169,0.0144,0,0.01,0.0025,0,0,0.01,0,0.0121,0.0016,0.0529,0,0.25,0.16,0.0784,0.25,0.0081,0.25,0.9025,0.25,0.4624,0.1089,0.1764,0.64,0.4624,0.6084,0.25,0.177782143,0.026457143,0.329107143,21,65.63,25,78.13,5,62.5,7,87.5,6,75,7,87.5,16,100,9,56.25,79.62,74,79.88,79,85.62,87.31,71.94,-12.5,1.49,11.5,-7.62,4,-1.88,-12.69,15.69,2,2,1,1,2,1,0,2,1,2,0,1,1,0,2,3,2,3,1,3,0,0,1,0,0,0,0,1,1,1,0,1,1,0,2,0,0,1,1,1,1.6,1.2,0.8,2.4,0.2,0.6,0.8,0.6,1.5,0.55,5.67,5,2,0,0,2,0.67,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,69,1,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,2,2,0,1,2,1,0,1,0,1,0,0,0,0,0,3,2,2,0,2,1.4,0.6,0,1.8,0.95,C_Ug +248,R_60VP0Bh1vQF50Tn,46 - 52,Canadian,Female,1,2,2,1,3,-2,0,2,0,1,2,1,2,-1,2,1,1,2,1,-1,2,2,2,1,3,1,-2,-1,2,-1,1,1,2,1,2,0,2,1,1,1,1,1,-1,1,2,2,2,1,2,1,-2,0,2,-1,1,1,2,1,2,-1,2,1,0,1,1,1,-1,2,FALSE,1,50,TRUE,1,50,TRUE,0,90,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,80,TRUE,1,85,TRUE,1,50,TRUE,1,79,FALSE,1,50,TRUE,0,89,TRUE,1,90,FALSE,1,50,TRUE,1,50,TRUE,1,70,FALSE,1,50,TRUE,0,70,FALSE,1,50,FALSE,1,50,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,1,80,FALSE,1,70,TRUE,1,85,FALSE,1,80,TRUE,0,90,TRUE,0,80,TRUE,1,80,TRUE,1,50,TRUE,1,90,0.0225,0.0225,0.09,0.04,0.01,0.25,0.04,0.0441,0.25,0,0.04,0.01,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.09,0.0625,0.25,0.25,0.25,0.25,0.04,0.25,0.25,0.81,0.49,0.64,0.7921,0.263525,0.15315,0.3739,20,62.5,27,84.38,8,100,7,87.5,7,87.5,5,62.5,16,100,11,68.75,68.22,53.75,66.88,73,79.25,72.75,63.69,-21.88,-16.16,-46.25,-20.62,-14.5,16.75,-27.25,-5.06,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0.2,0.4,0.2,0.2,0.4,0.2,0,0.4,0.25,0.25,1,1,0,0,0,-1,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,51,0.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,-1,0,1,0,0,0,0,0,0,1,0,-1,0,0,0,0,-0.2,0.2,0.2,-0.2,0,C_Ug +249,R_5QK8rCRX1n6Hy71,39 - 45,Canadian,Male,2,3,3,1,3,2,-3,3,-3,2,2,1,3,-1,3,1,1,2,-2,-1,2,3,3,0,3,2,3,-3,3,-3,2,1,2,1,3,0,3,1,1,0,1,-1,-1,3,2,3,3,2,3,1,2,-3,3,-3,3,2,2,1,3,-1,3,2,1,1,1,0,-1,3,FALSE,1,90,TRUE,1,94,FALSE,1,65,FALSE,1,75,FALSE,0,80,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,91,TRUE,1,95,FALSE,1,80,TRUE,0,90,TRUE,1,100,TRUE,0,94,FALSE,0,51,TRUE,1,100,FALSE,1,70,TRUE,0,96,TRUE,0,87,FALSE,1,100,FALSE,0,81,TRUE,1,90,FALSE,1,100,TRUE,1,70,TRUE,0,76,TRUE,1,94,FALSE,1,63,FALSE,1,100,FALSE,1,59,TRUE,1,91,TRUE,1,100,TRUE,1,100,0,0.0036,0,0.01,0,0,0.09,0.0025,0,0.01,0.0081,0,0.0081,0.04,0.64,0.0036,0,0.0625,0,0.5776,0.6561,0.2601,0.7569,0.8836,0.09,0.1369,0,0.01,0.1225,0.9216,0.1681,0.81,0.223507143,0.061771429,0.385242857,22,68.75,24,75,6,75,6,75,5,62.5,7,87.5,13,81.25,11,68.75,86.62,80.12,86.25,90.62,89.5,89.19,84.06,-6.25,11.62,5.12,11.25,28.12,2,7.94,15.31,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,2,0,0.2,0.2,0.2,0.6,0.2,0.2,0,0.6,0.3,0.25,1.33,1.67,1,-1,-1,0,-0.34,5 cents,100 minutes,24 days,Male,University - Undergraduate,45,1,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,0,0,-1,0,0,0,1,0,0,1,0,-1,0,0,0,0.2,0,0.05,C_Ug +250,R_5duLDrZ0Xpzbyop,53 - 59,Canadian,Female,2,3,2,0,2,-2,-2,1,1,-1,1,0,2,0,1,1,-1,1,1,0,1,3,2,-2,2,5,0,-2,2,1,1,5,1,0,1,1,1,4,2,1,2,2,2,3,2,2,2,0,0,3,-3,-3,0,2,-2,4,1,1,1,0,1,2,1,0,1,1,0,1,TRUE,0,82,TRUE,1,97,FALSE,1,60,FALSE,1,58,TRUE,1,100,FALSE,1,55,TRUE,1,82,TRUE,1,76,TRUE,1,53,TRUE,1,95,FALSE,1,53,TRUE,0,89,FALSE,0,56,FALSE,1,94,TRUE,1,68,TRUE,1,100,TRUE,0,59,TRUE,0,89,TRUE,0,60,TRUE,0,59,TRUE,1,73,TRUE,1,96,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,1,97,FALSE,1,53,TRUE,0,71,TRUE,0,68,TRUE,1,76,FALSE,0,60,TRUE,1,100,0.0576,0.0009,0,0.0324,0,0.2025,0,0.0025,0.3481,0.0016,0.0576,0.3136,0.2209,0.2209,0,0.0009,0,0.1764,0.5041,0.8836,0.0729,0.1024,0.36,0.0036,0.3481,0.2209,0.36,0.6724,0.16,0.7921,0.4624,0.7921,0.259985714,0.110357143,0.409614286,22,68.75,21,65.63,6,75,5,62.5,5,62.5,5,62.5,14,87.5,7,43.75,77.28,62.75,76.38,91.12,78.88,83.06,71.5,3.12,11.65,-12.25,13.88,28.62,16.38,-4.44,27.75,1,0,0,2,0,2,0,1,0,2,0,0,1,1,0,1,2,1,1,2,0,1,0,0,2,1,1,1,1,1,0,1,1,0,0,0,1,0,0,0,0.6,1,0.4,1.4,0.6,1,0.4,0.2,0.85,0.55,4.67,3,2,1,2,2,1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,57,0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,-1,0,2,-2,1,-1,0,-1,1,0,-1,0,1,0,1,1,1,1,2,0,0,0,1.2,0.3,C_Ug +251,R_1KwqwJDsh0DTUJ2,39 - 45,American,Female,3,3,2,1,3,-1,1,1,3,1,1,0,2,-1,3,-1,-1,-1,1,-3,3,3,2,2,3,10,0,1,3,2,0,10,2,0,0,0,2,0,0,0,0,0,0,2,3,2,2,1,3,5,-1,1,1,3,1,9,1,0,1,1,3,6,0,1,0,1,1,6,FALSE,1,100,FALSE,0,62,FALSE,1,65,FALSE,1,53,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,76,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,1,74,TRUE,1,89,TRUE,1,87,FALSE,1,74,TRUE,0,59,TRUE,0,89,FALSE,1,52,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,77,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.01,0.0169,0,0,0,0,0.5776,0.2304,0,0,0,1,0,0,0.3844,0,0.2209,0.0529,0,0.5625,0.0121,0.7921,0.0676,0.0676,1,1,0,0.1225,0.3481,1,0.09,0.268882143,0.172378571,0.365385714,28,87.5,23,71.88,3,37.5,6,75,6,75,8,100,11,68.75,12,75,87.25,86.62,93.62,87.38,81.38,92.44,82.06,15.62,15.37,49.12,18.62,12.38,-18.62,23.69,7.06,0,0,0,1,0,1,0,2,1,1,1,0,2,1,1,1,1,1,1,3,0,1,0,0,0,0,0,0,0,0,0,0,1,2,0,1,2,1,0,4,0.2,1,1,1.4,0.2,0,0.6,1.6,0.9,0.6,6.67,6.67,5,1,-6,-4,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),44,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,-1,0,1,0,1,0,2,1,1,1,0,1,-1,1,0,-1,0,1,-1,0,1,0.4,-0.2,0.3,grad_prof +252,R_7pAnaXoEVkzxNb7,60 - 66,American,Male,3,2,1,1,0,0,-3,3,-3,0,2,0,2,-1,2,2,2,2,2,2,2,2,2,1,1,1,0,-3,2,-3,1,1,2,0,2,-2,2,6,1,0,2,2,2,1,3,2,2,2,2,2,-1,-3,2,-3,0,4,2,1,2,-1,2,3,3,2,3,2,2,4,TRUE,0,58,TRUE,1,84,TRUE,0,87,FALSE,1,56,FALSE,0,52,FALSE,1,50,TRUE,1,94,TRUE,1,57,TRUE,1,50,TRUE,1,83,FALSE,1,50,TRUE,0,95,TRUE,1,90,FALSE,1,50,TRUE,1,55,TRUE,1,90,FALSE,1,66,TRUE,0,100,FALSE,1,52,FALSE,1,56,TRUE,1,100,TRUE,1,93,FALSE,1,79,TRUE,1,65,FALSE,1,64,TRUE,1,96,TRUE,0,84,FALSE,1,100,TRUE,0,91,TRUE,1,100,TRUE,1,83,FALSE,0,50,0.1849,0.0016,0.01,0.0036,0.25,0.25,0.1225,0.0289,0.1936,0.0049,0,0.01,0.25,0.25,0.2704,0.0256,0.0441,0.1936,0,0.1296,0,0.2025,0.2304,0.25,0.1156,0.7056,0.0289,0.3364,0.7569,1,0.8281,0.9025,0.263575,0.135257143,0.391892857,18,56.25,24,75,7,87.5,5,62.5,6,75,6,75,14,87.5,10,62.5,74.38,64.25,72.25,79.75,81.25,77.62,71.12,-18.75,-0.62,-23.25,9.75,4.75,6.25,-9.88,8.62,1,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,2,0,0,0,0,0,1,1,2,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0.6,0.4,0.2,0.6,0.8,0.4,0.2,0.4,0.45,0.45,2.67,3,-1,-3,3,-3,-0.33,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),63,0.75,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,1,0,0,-1,-1,-1,0,0,0,1,0,-1,0,1,0,0,2,-1,0,0,-0.2,0,0,0.2,0,grad_prof +253,R_3tAvwSUORjliA9U,53 - 59,Canadian,Male,-1,1,2,2,-2,-2,-2,1,0,-1,2,2,2,2,2,2,1,2,2,-1,-2,1,2,2,-2,4,-1,-1,2,1,-1,0,2,1,1,1,1,1,-1,1,1,1,-2,7,-1,1,2,2,-1,2,-2,-2,1,-2,-2,1,2,2,0,0,0,0,1,1,2,2,2,1,TRUE,0,82,FALSE,0,70,TRUE,0,89,FALSE,1,77,FALSE,0,85,FALSE,1,75,TRUE,1,100,TRUE,1,100,TRUE,1,84,FALSE,0,76,FALSE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,72,FALSE,0,79,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,72,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,100,FALSE,0,87,FALSE,1,90,TRUE,0,67,FALSE,1,96,TRUE,1,91,FALSE,0,100,FALSE,0,93,0,0.7569,0.6241,0,0.8649,0.0625,0.0025,0.5776,0.0784,0,0.0081,0,0.0256,0.0576,0.7225,0.49,0,0.0529,0.4489,1,1,0.5184,1,1,1,0.01,1,0.6724,0.7921,1,0.0016,1,0.478071429,0.210185714,0.745957143,24,75,14,43.75,4,50,4,50,2,25,4,50,7,43.75,7,43.75,89.25,83.62,93.62,93.12,86.62,89.5,89,31.25,45.5,33.62,43.62,68.12,36.62,45.75,45.25,1,0,0,0,0,1,1,1,1,0,0,1,1,1,1,3,0,1,1,1,0,0,0,0,1,0,0,0,2,1,0,0,2,2,2,1,0,0,0,3,0.2,0.8,0.8,1.2,0.2,0.6,1.2,0.8,0.75,0.7,1.67,1,2,-1,1,6,0.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,56,0.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,0,0,0,-1,1,1,1,-1,-1,0,1,-1,-1,-1,2,0,1,1,-2,0,0.2,-0.4,0.4,0.05,C_Ug +254,R_5oSF57Z2IEBUbXS,60 - 66,Both,Female,3,3,3,-2,3,-1,1,3,-2,1,3,3,3,1,3,1,2,2,3,-1,3,3,3,-2,3,1,-2,-2,3,-2,1,4,3,3,3,2,3,0,3,3,3,1,-1,5,3,3,3,-2,3,0,-2,-3,3,-2,2,0,3,3,3,1,3,0,3,3,3,3,3,1,TRUE,0,67,TRUE,1,96,TRUE,0,100,TRUE,0,68,TRUE,1,100,TRUE,0,92,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,TRUE,0,88,TRUE,0,99,TRUE,1,90,FALSE,1,79,FALSE,0,76,TRUE,1,100,FALSE,1,75,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,0,74,TRUE,0,100,TRUE,1,96,FALSE,1,78,TRUE,0,78,TRUE,0,92,TRUE,1,96,FALSE,0,100,TRUE,1,100,0,0.0016,0,0,0,0.8464,0.5476,0,0,0,0.0016,0.01,0.0625,0.7744,0,0.0016,0,0.4624,0.6084,1,0.0049,0.5776,1,0.0441,0.0625,0.0484,1,0.4489,1,1,0.8464,0.9801,0.404564286,0.193321429,0.615807143,24,75,18,56.25,3,37.5,6,75,5,62.5,4,50,13,81.25,5,31.25,91,85.12,92.75,92.75,93.38,93.5,88.5,18.75,34.75,47.62,17.75,30.25,43.38,12.25,57.25,0,0,0,0,0,1,3,0,0,0,0,0,0,1,0,2,1,1,2,0,0,0,0,0,0,1,4,0,0,1,0,0,0,0,0,2,1,1,0,4,0,0.8,0.2,1.2,0,1.2,0,1.6,0.55,0.7,1.67,0,1,4,0,4,1.67,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,60,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,-1,0,0,-1,0,0,0,1,0,0,0,0,2,-4,0,-0.4,0.2,-0.4,-0.15,C_Ug +255,R_3oS05I58MGLFdJc,60 - 66,American,Male,3,3,2,2,2,1,-3,2,-3,3,1,-2,3,-1,3,-2,-1,1,-2,-2,3,3,2,2,2,0,1,-3,2,-3,2,0,2,-2,3,2,3,1,-2,-2,-2,-2,-2,5,3,3,2,2,2,0,2,-3,2,-3,2,0,1,-2,3,-2,3,1,0,0,2,2,1,5,TRUE,0,100,TRUE,1,100,FALSE,1,80,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,75,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,1,0.0625,0,0,0.25,0,0,0,0.64,0,0,0.25,0.25,1,0.25,1,0.0625,0.25,0.0625,0.25,0.25,0.25,1,0.04,1,1,1,0.352410714,0.175178571,0.529642857,20,62.5,19,59.38,3,37.5,5,62.5,5,62.5,6,75,14,87.5,5,31.25,83.91,69.38,87.5,84.38,94.38,90.62,77.19,3.12,24.53,31.88,25,21.88,19.38,3.12,45.94,0,0,0,0,0,0,0,0,0,1,1,0,0,3,0,0,1,3,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,2,1,1,4,3,0,0.2,0.8,0.8,0,0.4,0.2,2.2,0.45,0.7,0.33,0.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,0,0,0,0,1,0,0,2,0,-2,0,2,-4,-3,0,-0.2,0.6,-1.4,-0.25,C_Ug +256,R_3smjKTwBjkxUhgg,60 - 66,Canadian,Female,3,3,2,2,3,3,1,3,-2,2,3,-3,3,0,3,1,3,2,3,2,3,3,2,2,3,1,3,2,3,-2,2,1,3,-3,3,2,3,1,2,2,2,2,1,1,3,3,2,3,3,2,2,-2,2,-2,2,2,3,-3,3,-3,3,2,0,0,2,2,2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,FALSE,0,76,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,96,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,77,FALSE,1,98,FALSE,1,54,TRUE,0,53,FALSE,0,76,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,100,FALSE,1,57,TRUE,0,59,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,1,0,0,0,0.25,0,0.0016,0.2809,0.0009,0,0.25,0,0.25,0.5776,0,0,0.25,0.1849,0,0.5776,0.25,0.2116,0,0.5929,1,0.2809,0,0,0.0004,0.3481,1,0.225264286,0.132928571,0.3176,25,78.13,21,65.63,5,62.5,3,37.5,7,87.5,6,75,11,68.75,10,62.5,82.69,69.62,73.5,98.88,88.75,87.38,78,12.5,17.06,7.12,36,11.38,13.75,18.63,15.5,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,1,1,0,1,1,0,0,0,1,0,1,3,1,0,0,0,0,0,3,0,1,3,0,1,0,0,0.2,0.4,0.8,0.2,1,0.6,1,0.35,0.7,1,2,-1,-1,-1,-2,-1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,63,2,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-1,0,-1,-2,-1,0,0,0,0,0,-1,0,0,-2,0,0,1,-0.2,-0.8,-0.2,-0.2,-0.35,C_Ug +257,R_3Ny3Vz7ahIARXLP,67 - 73,Canadian,Female,2,2,2,2,2,2,-2,2,-2,2,1,2,2,0,2,2,1,2,2,-1,2,2,2,2,2,0,2,-2,2,-2,2,0,1,2,2,-2,2,0,-2,-2,-2,-2,-2,10,2,2,2,2,2,0,2,-2,2,-2,2,0,1,2,2,2,2,0,2,2,2,2,-1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,51,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0.25,0,0.25,0,0,0,0.25,1,0,0,1,0.25,1,1,0,0.25,0.2601,0.25,0.25,0.25,0,1,1,1,1,1,0.411075,0.232142857,0.590007143,24,75,19,59.38,4,50,6,75,5,62.5,4,50,13,81.25,6,37.5,84.41,68.88,87.5,93.75,87.5,90.62,78.19,15.62,25.03,18.88,12.5,31.25,37.5,9.37,40.69,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,3,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0.4,3.2,0,0,0.4,0.2,0.9,0.15,0,0,0,0,0,10,0,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),71,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,2,4,4,1,0,0,0,3,0.75,grad_prof +258,R_5QzhtHCfdj5aZJi,60 - 66,American,Female,3,3,3,3,3,-2,-2,3,-2,0,2,3,3,3,2,1,-1,2,1,-3,1,1,2,-2,-3,10,2,0,1,3,-3,10,-1,-2,-2,2,-1,10,-3,-3,0,-3,-3,7,3,3,3,3,3,1,0,0,0,0,0,1,3,3,3,3,2,0,-2,-2,1,1,-2,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,95,FALSE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,100,TRUE,1,85,TRUE,1,100,FALSE,1,95,FALSE,1,95,TRUE,0,85,FALSE,1,100,FALSE,0,55,TRUE,1,80,FALSE,1,100,TRUE,1,95,TRUE,0,60,TRUE,1,60,FALSE,1,100,FALSE,1,97,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.16,0,0.0025,0,0,0.0025,0.0025,0,0.04,0,0.0025,0.01,0,0,0,0,0.2025,0.0009,0.36,0.3025,0.0225,0.7225,1,0.0025,0,1,0,1,0.0025,1,0,0.202621429,0.018571429,0.386671429,28,87.5,25,78.13,6,75,6,75,6,75,7,87.5,14,87.5,11,68.75,91.78,89.38,93.12,85.62,99,90.62,92.94,9.37,13.65,14.38,18.12,10.62,11.5,3.12,24.19,2,2,1,5,6,4,2,2,5,3,3,5,5,1,3,4,2,2,4,0,0,0,0,0,0,2,2,3,2,0,1,0,0,0,0,3,1,1,0,1,3.2,3.2,3.4,2.4,0,1.8,0.2,1.2,3.05,0.8,10,0.67,9,9,10,2,9.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,1.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,2,2,1,5,6,2,0,-1,3,3,2,5,5,1,3,1,1,1,4,-1,3.2,1.4,3.2,1.2,2.25,C_Ug +259,R_3ZZqKke6RXCTGTf,46 - 52,Canadian,Male,2,2,2,1,3,0,-3,2,-3,2,-2,-3,2,0,3,-3,-2,-2,-3,-3,2,2,2,1,3,0,0,-3,2,-3,3,0,-2,-3,2,0,3,0,-3,1,-3,-3,-3,7,2,2,2,1,3,0,0,-3,2,-3,2,0,-2,-3,2,-1,3,0,-2,-1,-1,-2,-3,2,TRUE,0,97,FALSE,0,60,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,56,FALSE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,85,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,60,TRUE,0,50,FALSE,1,50,TRUE,1,55,TRUE,1,90,FALSE,1,75,TRUE,1,50,FALSE,1,100,TRUE,1,60,FALSE,1,50,FALSE,1,100,TRUE,0,70,TRUE,1,55,TRUE,1,50,TRUE,1,100,0,0.16,0,0,0,0,0.25,0.1936,0.25,0.01,0.2025,0.0016,0.25,0,0.25,0.36,0.0625,0.25,0,0,0.2025,0.25,0.25,0.0225,0.25,0.25,0.25,0.9409,0.25,0.36,0.49,0,0.199860714,0.148585714,0.251135714,10,31.25,26,81.25,6,75,7,87.5,6,75,7,87.5,15,93.75,11,68.75,72.16,57.5,74.5,81,75.62,70.12,74.19,-50,-9.09,-17.5,-13,6,-11.88,-23.63,5.44,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0.2,0,0.8,0,0,0.2,0.8,0.25,0.25,0,0,0,0,0,5,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),49,1.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,-1,2,0,-1,0,0,0.2,-0.2,0,0,HS_TS +260,R_3q7qGAiUw8YtYfI,67 - 73,American,Female,3,3,2,2,1,-1,-1,2,3,1,3,3,2,2,3,-3,-3,-1,-2,-3,2,3,2,2,3,2,1,-2,3,-1,2,8,3,3,3,3,3,7,1,2,1,-1,1,8,3,3,3,3,1,3,-1,-1,2,-1,0,7,3,3,3,3,3,3,-1,-2,-1,-1,-2,9,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,68,FALSE,0,74,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,93,FALSE,1,88,TRUE,0,100,TRUE,1,93,TRUE,0,93,TRUE,1,59,TRUE,1,90,FALSE,1,100,FALSE,1,100,FALSE,1,97,FALSE,1,100,FALSE,0,100,TRUE,1,56,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,0,93,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.01,0,0,0,0,0.0049,0,0.1936,0,0.0049,0.0016,0.0144,0.5476,0,0,0.1024,0.1849,1,1,0.1681,0.0009,0.8649,0,0,0,1,0.0625,0,0.8649,1,0.250557143,0.0621,0.439014286,27,84.38,25,78.13,8,100,5,62.5,5,62.5,7,87.5,14,87.5,11,68.75,91.62,88.5,95,92.75,90.25,91.31,91.94,6.25,13.49,-11.5,32.5,30.25,2.75,3.81,23.19,1,0,0,0,2,2,1,1,4,1,0,0,1,1,0,4,5,2,1,4,0,0,1,1,0,0,0,0,4,1,0,0,1,1,0,2,1,0,1,1,0.6,1.8,0.4,3.2,0.4,1,0.4,1,1.5,0.7,5.67,4.33,-1,1,4,-1,1.34,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,68,1,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,0,-1,-1,2,2,1,1,0,0,0,0,0,0,0,2,4,2,0,3,0.2,0.8,0,2.2,0.8,C_Ug +261,R_5rNwdFvn0qIr1GV,46 - 52,American,Male,3,3,-3,3,0,-3,1,3,3,1,-2,-3,3,-3,3,-3,-3,-3,-3,-3,3,3,3,3,3,10,-3,2,2,2,-3,10,-3,-3,3,-3,3,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,10,-3,2,3,3,-3,10,-3,3,3,-3,3,10,3,3,3,3,-3,10,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,50,0,1,1,0,0.25,0.25,0.25,0,0,1,0,0,0.25,1,0,0.25,0.25,0,1,0,1,0.25,0.25,0.25,0,0,0.25,0.25,0,1,0.25,1,0.321428571,0.25,0.392857143,4,12.5,21,65.63,4,50,7,87.5,5,62.5,5,62.5,9,56.25,12,75,81.25,68.75,75,87.5,93.75,81.25,81.25,-53.13,15.62,18.75,-12.5,25,31.25,25,6.25,0,0,6,0,3,0,1,1,1,4,1,0,0,0,0,0,0,0,0,0,0,0,6,0,3,0,1,0,0,4,1,6,0,0,0,6,6,6,6,0,1.8,1.4,0.2,0,1.8,1,1.4,4.8,0.85,2.25,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),49,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,1,1,0,0,-6,0,0,0,-6,-6,-6,-6,0,0,0.4,-1.2,-4.8,-1.4,HS_TS +262,R_7cTcJgRvQCfuUdj,60 - 66,Canadian,Male,1,3,2,1,2,-2,0,1,1,1,2,1,3,-2,2,0,0,0,1,-1,2,3,2,-2,2,6,-2,0,1,1,1,6,2,1,3,-2,2,6,0,1,0,0,-1,6,1,3,2,1,1,4,-2,1,1,1,1,4,2,1,3,-2,2,2,0,0,0,0,-1,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,50,FALSE,1,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.0016,0,0,0,0,0,0,0,0,0,1,0.0625,0,0.0196,0,0,0.25,0,0,0,0.25,0,0,0,0.25,0,0,1,1,0.1225,0,0.141235714,0.09515,0.187321429,30,93.75,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,92.88,78.12,93.88,99.5,100,94.19,91.56,6.25,5.38,-9.38,6.38,12,12.5,6.69,4.06,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0.8,0,0,0.4,0.2,0.2,0,0.2,0.3,0.15,6,3.33,2,2,4,0,2.67,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),61,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,1,0,0,3,-1,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.6,-0.2,0,0.2,0.15,grad_prof +263,R_57ZgjQtLkHOY40x,67 - 73,American,Female,3,3,1,1,1,-1,1,2,1,1,1,1,0,1,2,-1,-1,1,1,-3,3,3,2,1,3,4,-2,2,2,1,0,5,1,1,1,1,2,3,-1,1,1,-1,-2,6,3,3,3,3,3,6,-1,-1,1,-2,0,2,1,1,3,1,3,3,-1,-1,1,-2,-2,5,TRUE,0,100,TRUE,1,95,FALSE,1,75,FALSE,1,55,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,98,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,94,FALSE,1,97,TRUE,0,80,FALSE,1,100,FALSE,0,55,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,55,TRUE,1,90,FALSE,1,60,TRUE,0,82,TRUE,0,85,TRUE,1,100,FALSE,0,60,TRUE,1,60,0,0.01,0,0,0.16,0.0025,0,0.0004,0,1,0,0,0.01,0,0,0.0025,0,0.2025,0.6724,0.3025,0.3025,0.0576,0.64,1,0.0036,0.16,0.36,1,0.0625,0.0009,0.7225,0,0.237942857,0.098421429,0.377464286,28,87.5,23,71.88,6,75,6,75,4,50,7,87.5,13,81.25,10,62.5,87.56,77,86.12,92.5,94.62,89,86.12,15.62,15.68,2,11.12,42.5,7.12,7.75,23.62,0,0,1,0,2,1,1,0,0,1,0,0,1,0,0,0,2,0,2,1,0,0,2,2,2,0,2,1,3,1,0,0,3,0,1,0,0,0,3,1,0.6,0.6,0.2,1,1.2,1.4,0.8,0.8,0.6,1.05,4,3.67,-2,3,0,1,0.33,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),72,0.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,-1,-2,0,1,-1,-1,-3,0,0,0,-2,0,-1,0,2,0,-1,0,-0.6,-0.8,-0.6,0.2,-0.45,grad_prof +264,R_710J4BbVCOc2iEF,53 - 59,Canadian,Male,2,3,3,2,3,1,-2,2,-2,1,3,1,2,2,1,-3,-3,-3,-3,-3,2,2,2,2,3,5,1,0,1,0,1,3,0,0,1,1,0,5,0,0,1,1,0,4,1,3,1,1,3,6,2,0,3,-2,3,7,3,2,2,3,2,4,3,3,3,3,3,10,FALSE,1,53,TRUE,1,64,TRUE,0,80,FALSE,1,58,FALSE,0,55,FALSE,1,58,TRUE,1,68,FALSE,0,59,FALSE,0,60,FALSE,0,90,TRUE,0,75,TRUE,0,79,TRUE,1,70,FALSE,1,63,FALSE,0,66,TRUE,1,80,TRUE,0,76,TRUE,0,96,TRUE,0,75,FALSE,1,78,FALSE,0,93,FALSE,0,79,FALSE,1,76,FALSE,0,67,TRUE,0,79,TRUE,1,84,FALSE,1,76,TRUE,0,82,FALSE,1,73,TRUE,1,93,FALSE,0,90,TRUE,1,98,0.3481,0.0256,0.04,0.1024,0.0004,0.1764,0.4489,0.81,0.0484,0.6241,0.0049,0.09,0.36,0.5625,0.3025,0.1296,0.0576,0.1764,0.6724,0.6241,0.8649,0.4356,0.5625,0.1369,0.5776,0.0576,0.81,0.2209,0.64,0.9216,0.0729,0.6241,0.393314286,0.270835714,0.515792857,10,31.25,15,46.88,3,37.5,5,62.5,4,50,3,37.5,7,43.75,8,50,74.78,70.5,74.88,76.5,77.25,76,73.56,-15.63,27.9,33,12.38,26.5,39.75,32.25,23.56,0,1,1,0,0,0,2,1,2,0,3,1,1,1,1,3,3,4,4,3,1,0,2,1,0,1,2,1,0,2,0,1,0,1,1,6,6,6,6,6,0.4,1,1.4,3.4,0.8,1.2,0.6,6,1.55,2.15,4.33,5.67,-1,-4,1,-6,-1.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),53,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,-1,1,-1,-1,0,-1,0,0,2,-2,3,0,1,0,0,-3,-3,-2,-2,-3,-0.4,-0.2,0.8,-2.6,-0.6,HS_TS +265,R_6FGX2RDKjKb8wzD,53 - 59,Canadian,Male,0,3,1,2,0,-1,1,3,-2,1,1,2,3,3,1,-3,-2,-2,0,-3,0,3,2,2,0,3,-1,1,3,-2,0,3,0,3,3,2,1,3,-3,-2,-2,-3,-2,3,0,3,2,2,0,2,-1,1,3,-2,0,2,0,3,3,3,1,2,-2,-3,-2,0,-3,2,TRUE,0,100,TRUE,1,71,TRUE,0,92,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,92,TRUE,1,61,TRUE,1,99,TRUE,1,62,FALSE,1,76,TRUE,0,99,FALSE,0,77,TRUE,0,96,TRUE,1,50,TRUE,1,100,FALSE,1,76,TRUE,0,83,TRUE,0,79,FALSE,1,100,FALSE,0,100,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,98,TRUE,1,100,0.1521,0,0,0.0064,0,0,0,0.1444,0,0.16,0.01,0.5929,0.0001,0.0576,0.25,0.0841,0,0.25,0,0,1,0.25,0.6241,0.9216,0.0576,0.25,0.0004,1,0.8464,0.6889,0,0.9801,0.291721429,0.11065,0.472792857,22,68.75,23,71.88,6,75,6,75,5,62.5,6,75,14,87.5,9,56.25,84.72,71.62,87.88,86.62,92.75,81.88,87.56,-3.13,12.84,-3.38,12.88,24.12,17.75,-5.62,31.31,0,0,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,3,1,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0.2,0.2,0.6,0.8,0.2,0.2,0.4,0.4,0.45,0.3,3,2,1,1,1,1,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),55,0.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,-1,-1,0,3,1,0,0,0.2,0.4,0.15,grad_prof +266,R_5NnszuPXPUh3hpB,46 - 52,Canadian,Female,2,2,2,2,3,1,2,2,-1,2,1,2,0,2,1,1,1,2,1,2,1,2,1,1,0,7,2,1,2,2,1,6,0,0,1,1,1,6,1,2,2,0,1,7,2,1,2,2,1,8,1,2,0,1,1,7,2,0,1,1,2,7,1,2,0,1,0,7,TRUE,0,100,FALSE,0,67,TRUE,0,100,FALSE,1,84,FALSE,0,82,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,85,TRUE,1,100,TRUE,0,94,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,0,94,TRUE,1,89,TRUE,0,83,TRUE,1,85,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,52,FALSE,0,53,0,0.0225,0,0,0.2809,1,0.0121,0,0.25,0,0,0,0.16,0.25,0.6724,0.4489,0.8836,0.0256,0,0.6889,1,0.0225,1,1,0.8836,0.25,0.2304,1,1,1,0,1,0.466389286,0.284535714,0.648242857,32,100,18,56.25,6,75,2,25,4,50,6,75,12,75,6,37.5,86.81,68.5,90.38,96,92.38,85.81,87.81,43.75,30.56,-6.5,65.38,46,17.38,10.81,50.31,1,0,1,1,3,1,1,0,3,1,1,2,1,1,0,0,1,0,1,1,0,1,0,0,2,0,0,2,2,1,1,2,1,1,1,0,1,2,0,2,1.2,1.2,1,0.6,0.6,1,1.2,1,1,0.95,6.33,7.33,-1,-1,-1,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,-1,1,1,1,1,1,-2,1,0,0,0,0,0,-1,0,0,-2,1,-1,0.6,0.2,-0.2,-0.4,0.05,C_Ug +267,R_17PQ70EjmFqYYx8,46 - 52,American,Female,1,1,2,0,3,-1,1,2,0,0,1,3,2,-2,2,0,-1,1,1,0,1,2,2,0,2,1,0,0,2,0,0,1,1,3,2,-2,2,0,0,-1,1,1,0,1,1,1,2,1,3,1,-1,0,2,0,0,5,1,3,2,-2,2,1,0,0,1,1,0,1,TRUE,0,75,FALSE,0,50,FALSE,1,90,FALSE,1,50,FALSE,0,50,FALSE,1,53,TRUE,1,75,TRUE,1,100,FALSE,0,51,TRUE,1,75,FALSE,1,52,TRUE,0,99,TRUE,1,68,TRUE,0,52,FALSE,0,51,TRUE,1,51,FALSE,1,52,TRUE,0,90,FALSE,1,51,FALSE,1,51,FALSE,0,100,FALSE,0,51,TRUE,0,52,TRUE,1,75,TRUE,0,70,TRUE,1,91,FALSE,1,50,TRUE,0,71,TRUE,0,66,TRUE,1,100,FALSE,0,52,TRUE,1,100,0,0.0081,0.2401,0.0625,0,0.2209,0.0625,0.0625,0.2401,0.2601,0,0.1024,0.2601,0.2304,0.25,0.25,0.2704,0.25,0.5041,0.49,1,0.2601,0.2401,0.2704,0.2304,0.25,0.2704,0.5625,0.01,0.81,0.4356,0.9801,0.313325,0.175671429,0.450978571,6,18.75,17,53.13,4,50,4,50,3,37.5,6,75,9,56.25,8,50,67.62,50.88,67.62,72.38,79.62,71.25,64,-34.38,14.49,0.88,17.62,34.88,4.62,15,14,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.4,0.4,0,0,0.2,0.2,0,0.2,0.2,0.15,0.67,2.33,0,-4,-1,0,-1.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,1,0,-1,1,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0.2,0.2,0,-0.2,0.05,C_Ug +268,R_5ocomYDlDwHAkjD,53 - 59,Canadian,Female,1,2,2,1,1,-1,-2,1,-1,0,-2,0,2,-2,1,1,0,1,1,-1,2,2,2,2,2,4,-1,-1,-1,-2,1,2,-1,0,2,1,1,3,-2,-2,-2,-2,-2,3,2,2,2,2,2,2,-1,-2,0,-2,-1,2,0,2,2,-2,2,2,0,0,1,0,0,2,TRUE,0,89,TRUE,1,85,TRUE,0,90,FALSE,1,54,FALSE,0,60,FALSE,1,68,TRUE,1,78,TRUE,1,84,TRUE,1,74,TRUE,1,78,TRUE,0,73,TRUE,0,85,FALSE,0,70,FALSE,1,64,FALSE,0,64,TRUE,1,91,TRUE,0,70,TRUE,0,82,FALSE,1,62,FALSE,1,76,FALSE,0,86,TRUE,1,71,TRUE,0,64,TRUE,1,71,FALSE,1,100,TRUE,1,72,TRUE,0,74,FALSE,1,76,TRUE,0,65,TRUE,1,100,FALSE,0,69,TRUE,1,100,0.0256,0.0784,0.0081,0.0484,0,0.1024,0.0841,0.0484,0.0576,0.0841,0,0.49,0.0676,0.5329,0.36,0.0225,0.4096,0.2116,0.0576,0,0.7396,0.4096,0.1444,0.1296,0.49,0.5476,0.4761,0.7921,0.81,0.6724,0.4225,0.7225,0.317314286,0.176485714,0.458142857,16,50,18,56.25,4,50,2,25,6,75,6,75,11,68.75,7,43.75,76.41,69.38,72.88,79.25,84.12,78.31,74.5,-6.25,20.16,19.38,47.88,4.25,9.12,9.56,30.75,1,0,0,1,1,0,1,2,1,1,1,0,0,3,0,3,2,3,3,1,1,0,0,1,1,0,0,1,1,1,2,2,0,0,1,1,0,0,1,1,0.6,1,0.8,2.4,0.6,0.6,1,0.6,1.2,0.7,3,2,2,0,1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),58,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,1,1,0,0,-1,-2,0,3,-1,2,2,3,2,0,0,0.4,-0.2,1.8,0.5,HS_TS +269,R_6keDxtnLDMK2iGd,39 - 45,Canadian,Female,-1,3,2,3,2,-1,-2,1,-2,-1,3,1,2,-1,3,-2,-2,-2,1,-1,1,3,1,3,2,6,-3,-3,2,-2,-1,5,3,2,1,-3,3,5,2,2,3,3,3,8,2,3,2,3,3,10,-1,-3,1,-2,-1,5,3,2,3,-2,3,5,2,2,2,2,-2,10,FALSE,1,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,75,TRUE,1,100,TRUE,1,90,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,0,85,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,70,TRUE,0,50,TRUE,0,85,FALSE,1,50,TRUE,1,95,TRUE,1,50,TRUE,0,50,TRUE,1,70,TRUE,0,85,TRUE,1,70,FALSE,1,50,TRUE,0,70,TRUE,0,60,TRUE,1,100,FALSE,0,80,TRUE,1,50,0.01,0.09,0.0025,0,0.25,0.0625,0.09,0.09,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.49,0.7225,0.0025,0.25,0.7225,0,0.49,0.25,0.64,0,1,0.25,0.36,0.7225,0.335446429,0.249464286,0.421428571,13,40.63,20,62.5,5,62.5,4,50,6,75,5,62.5,13,81.25,7,43.75,71.88,58.12,68.75,78.12,82.5,73.12,70.62,-21.87,9.38,-4.38,18.75,3.12,20,-8.13,26.87,2,0,1,0,0,2,1,1,0,0,0,1,1,2,0,4,4,5,2,4,3,0,0,0,1,0,1,0,0,0,0,1,1,1,0,4,4,4,1,1,0.6,0.8,0.8,3.8,0.8,0.2,0.6,2.8,1.5,1.1,5.33,6.67,-4,0,0,-2,-1.34,5 cents,5 minutes,47 days,Female,University - PhD,41,0.75,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,0,1,0,-1,2,0,1,0,0,0,0,0,1,0,0,0,1,1,3,-0.2,0.6,0.2,1,0.4,grad_prof +270,R_7TWnEr6dY4HbC2B,60 - 66,American,Female,3,2,2,-2,-2,2,-3,2,-1,-1,3,3,3,3,3,1,-3,-3,-2,-1,3,3,3,0,1,0,3,-2,1,3,1,2,3,3,3,3,3,8,1,0,1,1,-2,2,0,0,0,0,0,1,0,-3,0,0,0,1,3,3,3,3,3,5,0,0,0,0,0,10,FALSE,1,100,TRUE,1,84,TRUE,0,100,FALSE,1,50,FALSE,0,51,TRUE,0,64,TRUE,1,62,TRUE,1,100,TRUE,1,55,TRUE,1,74,TRUE,0,61,TRUE,0,100,TRUE,1,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,58,TRUE,0,100,TRUE,0,63,FALSE,1,57,TRUE,1,70,TRUE,1,58,FALSE,1,67,TRUE,1,59,TRUE,0,78,TRUE,1,65,TRUE,0,77,TRUE,0,75,TRUE,0,83,TRUE,1,100,FALSE,0,57,TRUE,1,100,0,0.1225,0.25,0.1444,0,0.4096,0.1681,0.0676,0.1849,0.1764,0,0.0676,0.2025,0.3721,0.2601,0.0256,0.1089,0.25,0.5625,0.6084,0.09,0.25,0.3969,0.25,0.3364,0.5929,0.3249,0,1,1,0.6889,1,0.335510714,0.163814286,0.507207143,23,71.88,17,53.13,3,37.5,4,50,6,75,4,50,12,75,5,31.25,71.62,62.12,70.88,73.38,80.12,69.31,73.94,18.75,18.49,24.62,20.88,-1.62,30.12,-5.69,42.69,0,1,1,2,3,1,1,1,4,2,0,0,0,0,0,0,3,4,3,1,3,2,2,2,2,2,0,2,1,1,0,0,0,0,0,1,3,3,2,1,1.4,1.8,0,2.2,2.2,1.2,0,2,1.35,1.35,3.33,2.33,-1,1,3,-8,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),62,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,-3,-1,-1,0,1,-1,1,-1,3,1,0,0,0,0,0,-1,0,1,1,0,-0.8,0.6,0,0.2,0,HS_TS +271,R_5ksKzm2HPRTlWTu,67 - 73,American,Female,3,2,2,-3,-2,-3,-3,3,1,-1,3,3,2,-3,3,-1,1,2,2,-2,3,2,2,-3,-2,1,-3,-3,3,2,-1,1,3,3,3,2,3,1,2,1,2,2,2,1,3,2,2,-3,-2,1,-3,-3,3,1,-1,1,3,3,3,-3,3,0,2,1,2,2,-2,2,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,68,FALSE,1,96,FALSE,1,89,FALSE,1,83,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,57,TRUE,1,100,0,0,0,0,0,0,0,0,0.0289,0,0,0.25,0,0.25,0,0,0.25,0.25,0,0.8281,0.25,0.25,0.0121,1,0.1024,0.25,0.1849,0.25,0,0.0016,1,0,0.184214286,0.073492857,0.294935714,25,78.13,27,84.38,6,75,7,87.5,6,75,8,100,16,100,11,68.75,83.88,68.25,77.25,92.12,97.88,87.94,79.81,-6.25,-0.5,-6.75,-10.25,17.12,-2.12,-12.06,11.06,0,0,0,0,0,0,0,0,1,0,0,0,1,5,0,3,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0.2,1.2,1.4,0,0,0.2,0.6,0.7,0.2,1,0.67,0,0,1,-1,0.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),73,1.125,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,1,0,0,0,0,5,0,0,0,0,0,4,0,0.2,1,0.8,0.5,HS_TS +272,R_1916rOSJUwEPADZ,46 - 52,Canadian,Male,-1,2,2,3,3,-1,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,6,0,0,0,-1,0,6,0,1,0,0,-1,6,0,0,0,0,1,8,-1,-1,-1,-2,-1,5,-1,-1,-1,-1,0,6,1,0,1,1,1,7,0,-1,0,0,1,5,TRUE,0,88,TRUE,1,81,TRUE,0,74,FALSE,1,65,FALSE,0,63,FALSE,1,69,TRUE,1,90,TRUE,1,85,TRUE,1,99,TRUE,1,75,FALSE,1,66,TRUE,0,83,TRUE,1,73,TRUE,0,100,TRUE,1,55,TRUE,1,86,TRUE,0,76,TRUE,0,100,TRUE,0,54,FALSE,1,94,TRUE,1,73,TRUE,1,77,TRUE,0,58,TRUE,1,56,TRUE,0,52,TRUE,1,59,TRUE,0,57,FALSE,1,53,TRUE,0,62,TRUE,1,73,TRUE,1,90,TRUE,1,93,0.0225,0.1681,0.0196,0.01,0.0049,0.0961,0.1936,0.0625,0.0036,0.0529,0.0729,0.0729,0.0001,0.1156,0.3969,0.0361,0.3364,0.1225,0.2209,0.2704,0.0729,0.2025,0.2916,1,0.5776,0.3249,0.01,0.7744,0.5476,1,0.3844,0.6889,0.283325,0.111928571,0.454721429,24,75,20,62.5,6,75,4,50,4,50,6,75,15,93.75,5,31.25,74.34,70.88,70.88,80.12,75.5,76.75,71.94,12.5,11.84,-4.12,20.88,30.12,0.5,-17,40.69,1,2,1,3,3,1,1,1,2,0,0,1,0,0,2,0,1,0,0,1,0,3,3,5,4,0,2,2,2,0,1,0,1,1,0,0,2,0,0,1,2,1,0.6,0.4,3,1.2,0.6,0.6,1,1.35,6,6,1,0,-1,3,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),48,0,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,02REV,1,-1,-2,-2,-1,1,-1,-1,0,0,-1,1,-1,-1,2,0,-1,0,0,0,-1,-0.2,0,-0.2,-0.35,grad_prof +273,R_7K9iTpqYzeRz5ew,39 - 45,Canadian,Female,3,2,1,2,3,-2,-2,2,-2,2,2,1,1,-3,3,-3,-3,-3,-3,-3,3,2,2,-3,3,7,-3,-3,2,1,1,8,-1,-2,3,-2,2,5,-3,-3,-3,-3,-3,8,2,2,1,3,-1,5,-3,-3,1,-3,0,4,1,0,3,-3,2,3,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,96,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,89,FALSE,1,100,TRUE,1,100,FALSE,0,57,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,62,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,1,0,0,0.3249,0,0,0,0,0,0,0,0.1444,0,0,0,0.0016,0.0121,1,0,0.3844,0,0,0,0,1,1,0.173835714,0.10495,0.242721429,24,75,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,95.81,88.62,100,94.62,100,97.06,94.56,-6.25,14.56,1.12,12.5,19.62,25,9.56,19.56,0,0,1,5,0,1,1,0,3,1,3,3,2,1,1,0,0,0,0,0,1,0,0,1,4,1,1,1,1,2,1,1,2,0,1,0,0,0,0,0,1.2,1.2,2,0,1.2,1.2,1,0,1.1,0.85,6.67,4,2,4,2,3,2.67,15 cents,5 minutes,24 days,Female,University - Graduate (Masters),45,0.875,0,1,0,0,0,1,0.33,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,0,1,4,-4,0,0,-1,2,-1,2,2,0,1,0,0,0,0,0,0,0,0,1,0,0.25,grad_prof +274,R_3PIfTQUOYJNg6P3,60 - 66,American,Male,-1,0,3,2,3,1,1,3,-2,3,1,3,2,0,1,2,2,2,2,2,1,2,2,2,2,2,2,1,3,1,2,1,1,2,2,2,2,0,2,2,2,3,2,2,-1,1,2,3,3,1,2,1,3,0,2,0,1,3,2,0,2,0,2,2,2,2,3,2,TRUE,0,91,TRUE,1,100,FALSE,1,100,FALSE,1,87,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,95,TRUE,1,98,0,0,0,0,0.0004,0,0,1,0,0,1,0,0,0,0.0064,0,0,0.0169,0,0,0,0.0049,1,0,0,0.1369,0.0025,0.8281,0,0,1,0,0.178432143,0.14455,0.212314286,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,97.47,92.25,98.75,98.88,100,98.62,96.31,3.12,13.09,4.75,11.25,23.88,12.5,11.12,15.06,2,2,1,0,1,1,0,0,3,1,0,1,0,2,1,0,0,0,1,0,0,1,1,1,0,1,0,0,2,1,0,0,0,0,1,0,0,0,0,1,1.2,1,0.8,0.2,0.6,0.8,0.2,0.2,0.8,0.45,1,0.33,1,1,0,0,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,66,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,2,1,0,-1,1,0,0,0,1,0,0,1,0,2,0,0,0,0,1,-1,0.6,0.2,0.6,0,0.35,C_Ug +275,R_624VMp6OYkzBtLP,67 - 73,American,Female,3,1,3,1,3,-2,-2,3,-2,1,3,1,3,-2,3,0,1,1,1,-2,3,3,1,0,3,7,-3,-3,3,-3,2,7,2,3,3,0,3,7,-2,-2,-2,1,-2,7,3,3,3,3,1,6,-2,-3,3,0,1,5,2,2,3,-2,3,5,-1,0,0,1,-2,5,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,90,TRUE,1,90,TRUE,0,60,TRUE,0,75,TRUE,1,75,FALSE,1,75,TRUE,1,85,TRUE,1,100,FALSE,1,60,FALSE,1,75,FALSE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,85,FALSE,1,75,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.01,0,0,0,0.01,0,0,0,0.0625,0.01,0.36,0.01,0.01,0,0.36,0.0625,0,0.0625,0.0225,0.0625,0.0625,0.16,0.0225,0,0,0,0.0625,1,0.5625,0.103660714,0.05875,0.148571429,16,50,28,87.5,6,75,7,87.5,8,100,7,87.5,16,100,12,75,88.28,80.62,87.5,91.25,93.75,92.81,83.75,-37.5,0.78,5.62,0,-8.75,6.25,-7.19,8.75,0,2,2,1,0,1,1,0,1,1,1,2,0,2,0,2,3,3,0,0,0,2,0,2,2,0,1,0,2,0,1,1,0,0,0,1,1,1,0,0,1,0.8,1,1.6,1.2,0.6,0.4,0.6,1.1,0.7,7,5.33,1,2,2,2,1.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),69,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,2,-1,-2,1,0,0,-1,1,0,1,0,2,0,1,2,2,0,0,-0.2,0.2,0.6,1,0.4,grad_prof +276,R_6Ec2nE6EMk7EaE9,32 - 38,American,Female,2,2,3,-1,2,-2,-2,2,1,1,1,0,0,-1,1,-1,1,0,-1,0,1,2,3,-1,2,1,-1,-2,1,1,1,1,1,1,0,0,1,1,0,1,1,-1,1,1,2,2,3,-1,2,2,-1,-2,2,-1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,TRUE,0,70,TRUE,1,88,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,90,TRUE,1,85,TRUE,1,100,FALSE,0,50,FALSE,0,95,FALSE,1,60,FALSE,1,92,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,0,86,FALSE,1,50,FALSE,1,50,FALSE,0,60,TRUE,1,50,FALSE,1,75,TRUE,1,77,FALSE,1,95,TRUE,1,87,TRUE,0,50,FALSE,1,60,TRUE,0,77,TRUE,1,86,FALSE,0,66,TRUE,1,100,0,0.0169,0.25,0.0225,0,0.01,0.0529,0.9025,0.25,0.25,0.0196,0.25,0.25,0.16,0.25,0.0144,0.0625,0.25,0.16,0.0025,0.36,0.25,0.25,0.25,0.25,0.25,0.4356,0.49,1,0.7396,0.5929,0.0064,0.277103571,0.194421429,0.359785714,12,37.5,20,62.5,5,62.5,4,50,5,62.5,6,75,10,62.5,10,62.5,70.28,58,69,77.25,76.88,71.5,69.06,-25,7.78,-4.5,19,14.75,1.88,9,6.56,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,2,0,0,0,1,1,0,2,0,1,2,1,0.2,0.4,0.4,0.6,0,0.6,0.4,1.2,0.4,0.55,1,1.33,-1,0,0,0,-0.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,37,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,0,0,0,0,0,0,1,-2,0,0,1,-1,0,0,-1,0,0,-2,0,0.2,-0.2,0,-0.6,-0.15,C_Ug +277,R_13fH2HE7LMaeZmx,53 - 59,Canadian,Male,-2,2,2,-1,3,-1,1,1,0,1,0,1,1,1,0,-1,0,0,1,-1,-3,1,2,-3,1,6,0,1,0,1,0,5,0,0,0,1,0,5,-1,1,-1,0,-1,6,0,1,1,1,1,6,-1,0,0,0,0,5,2,0,0,-1,0,5,0,-1,0,1,-1,5,TRUE,0,57,FALSE,0,54,TRUE,0,94,FALSE,1,64,FALSE,0,54,FALSE,1,68,TRUE,1,94,TRUE,1,91,FALSE,0,56,TRUE,1,92,FALSE,1,97,TRUE,0,86,FALSE,0,75,TRUE,0,81,FALSE,0,60,TRUE,1,95,TRUE,0,65,TRUE,0,91,TRUE,0,85,FALSE,1,86,FALSE,0,85,TRUE,1,80,FALSE,1,56,FALSE,0,56,FALSE,1,61,TRUE,1,88,FALSE,1,55,TRUE,0,84,TRUE,0,55,TRUE,1,90,TRUE,1,63,FALSE,0,85,0.0081,0.0144,0.0025,0.0036,0.7225,0.1024,0.3136,0.0064,0.0196,0.04,0.01,0.5625,0.3136,0.0009,0.2916,0.2916,0.1936,0.1296,0.7056,0.1521,0.7225,0.36,0.7225,0.6561,0.4225,0.2025,0.1369,0.3249,0.8836,0.8281,0.3025,0.7396,0.362760714,0.214135714,0.511385714,12,37.5,15,46.88,4,50,2,25,5,62.5,4,50,8,50,7,43.75,75.09,66.75,67.88,80.5,85.25,76.12,74.06,-9.38,28.21,16.75,42.88,18,35.25,26.12,30.31,1,1,0,2,2,1,0,1,1,1,0,1,1,0,0,0,1,1,1,0,2,1,1,2,2,0,1,1,0,1,2,1,1,2,0,1,1,0,0,0,1.2,0.8,0.4,0.6,1.6,0.6,1.2,0.4,0.75,0.95,5.33,5.33,0,0,0,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),53,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,-1,0,-1,0,0,1,-1,0,1,0,-2,0,0,-2,0,-1,0,1,1,0,-0.4,0.2,-0.8,0.2,-0.2,HS_TS +278,R_3JdXuxYOg4c8Y35,53 - 59,American,Female,0,-1,1,1,-3,0,0,1,1,0,-1,1,2,0,1,0,0,-3,0,-2,1,0,1,1,-2,5,0,1,1,0,0,5,-1,1,1,0,1,5,0,0,0,0,-2,6,2,0,1,2,-3,5,0,0,2,0,1,5,-2,1,2,0,2,6,0,1,0,1,0,5,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,0,53,TRUE,1,55,FALSE,1,53,TRUE,1,91,TRUE,1,100,FALSE,0,54,FALSE,0,54,FALSE,1,52,FALSE,1,52,FALSE,0,52,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,67,TRUE,0,100,FALSE,1,53,FALSE,1,68,FALSE,0,100,TRUE,1,75,FALSE,1,100,FALSE,0,51,FALSE,1,100,TRUE,1,79,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,0,0.0441,0,0.0081,0,0.2209,0.2601,0.2916,0.1024,0.0625,0,0.2704,0.2916,0.2304,0.2025,0,0,0.2809,0,0,1,0.25,0.2209,1,0.1089,0.2304,0.0064,0.2025,0,1,1,0.2304,0.266528571,0.158092857,0.374964286,17,53.13,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,10,62.5,12,75,76.81,63.25,78.38,81.75,83.88,78.31,75.31,-15.62,8.06,0.75,15.88,19.25,-3.62,15.81,0.31,1,1,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,3,0,0,2,1,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1,3,1,2,0.6,0.4,0.2,0.6,0.8,0.6,0.4,1.4,0.45,0.8,5,5.33,0,0,-1,1,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,0.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,-1,0,0,-1,1,0,1,-1,0,-1,-1,0,1,0,-1,0,-1,0,-1,-2,-0.2,-0.2,-0.2,-0.8,-0.35,HS_TS +279,R_5NmG2cp8T5XW0u0,67 - 73,American,Female,1,1,2,0,2,1,-2,2,1,0,2,1,0,1,3,1,2,1,2,1,1,0,2,-2,0,6,1,0,3,2,1,6,2,3,1,-2,3,6,0,0,0,1,0,8,0,-1,3,1,0,5,0,-1,1,0,0,4,2,2,2,-2,3,6,0,0,0,2,0,1,TRUE,0,100,TRUE,1,100,TRUE,0,92,FALSE,1,65,TRUE,1,87,FALSE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,86,FALSE,0,100,TRUE,0,76,TRUE,0,100,TRUE,1,84,TRUE,0,90,TRUE,1,92,TRUE,1,100,TRUE,0,89,FALSE,1,100,TRUE,0,90,FALSE,1,81,TRUE,1,81,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,88,TRUE,0,80,FALSE,1,77,TRUE,0,99,TRUE,1,89,FALSE,0,58,TRUE,1,100,0,0.0144,0,0,0,0.0001,0,1,0.0361,0.0361,0.0121,0.0256,0.0196,0.5776,0.0169,0,0,0.1225,0.0529,1,0.0361,0.0064,0.81,0.81,0.7921,0.64,0.3364,1,0.8464,0,0.9801,1,0.36275,0.1319,0.5936,21,65.63,20,62.5,4,50,6,75,4,50,6,75,14,87.5,6,37.5,90.12,80.88,92.38,94.88,92.38,90.38,89.88,3.13,27.62,30.88,17.38,44.88,17.38,2.88,52.38,0,1,0,2,2,0,2,1,1,1,0,2,1,3,0,1,2,1,1,1,1,2,1,1,2,1,1,1,1,0,0,1,2,3,0,1,2,1,0,1,1,1,1.2,1.2,1.4,0.8,1.2,1,1.1,1.1,6,5,1,2,0,7,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,71,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,-1,-1,-1,1,0,-1,1,0,0,1,0,1,-1,0,0,0,0,0,1,0,-0.4,0.2,0,0.2,0,C_Ug +280,R_30diGYhBfh1dGSd,60 - 66,Canadian,Female,1,1,3,-2,1,-2,-2,2,1,-2,1,1,1,-1,2,-1,-1,1,1,1,-1,-1,3,2,2,9,-1,1,1,-1,1,9,1,1,1,1,2,8,-1,-1,1,1,1,8,1,1,2,1,-1,9,-2,1,0,1,-2,9,-2,1,-2,-2,2,9,-2,-3,0,-1,-1,9,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,77,FALSE,0,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,80,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,77,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,72,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0,0,0,0,0,0,0,1,0.0529,0,0,0,1,1,0.5929,0,0,0.0529,0,1,1,0.64,1,1,0,0.0784,0.0324,1,1,1,0,1,0.444625,0.264192857,0.625057143,24,75,19,59.38,4,50,6,75,3,37.5,6,75,11,68.75,8,50,95.78,88.88,97.12,100,97.12,96.19,95.38,15.62,36.4,38.88,22.12,62.5,22.12,27.44,45.38,2,2,0,4,1,1,3,1,2,3,0,0,0,2,0,0,0,0,0,0,0,0,1,3,2,0,3,2,0,0,3,0,3,1,0,1,2,1,2,2,1.8,2,0.4,0,1.2,1,1.4,1.6,1.05,1.3,8.67,9,0,0,-1,-1,-0.33,5 cents,25 minutes,47 days,Female,University - Undergraduate,63,0.5,1,0,1,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,2,-1,1,-1,1,0,-1,2,3,-3,0,-3,1,0,-1,-2,-1,-2,-2,0.6,1,-1,-1.6,-0.25,C_Ug +281,R_7YY9n2jk9GxsOtB,60 - 66,American,Female,2,2,3,2,2,3,-2,2,0,2,2,2,2,-2,1,1,1,1,-1,1,3,3,2,2,2,5,2,-2,2,-1,1,5,2,2,2,-2,2,5,2,-2,-1,-2,-2,4,2,2,3,2,2,3,2,-2,2,1,2,5,2,2,2,-2,2,5,1,1,1,-2,1,5,TRUE,0,59,TRUE,1,95,TRUE,0,86,FALSE,1,54,TRUE,1,53,FALSE,1,96,TRUE,1,100,TRUE,1,96,FALSE,0,57,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,84,TRUE,0,92,FALSE,0,82,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,0,95,FALSE,1,100,TRUE,1,97,TRUE,1,74,FALSE,1,67,TRUE,1,95,FALSE,1,66,TRUE,1,89,FALSE,1,65,FALSE,1,82,TRUE,0,79,TRUE,1,100,FALSE,0,57,TRUE,1,100,0.0016,0.0121,0,0,0,0.0016,0.0025,0,0,0.0676,0,0.0256,0.3249,0.1849,0.2209,0.0025,0.1089,0.2116,0.0324,0.1156,0.0009,0.6724,0.9025,0.8464,0.0784,0.1225,0.3249,0.3481,0.7396,1,0.6241,1,0.284242857,0.082214286,0.486271429,22,68.75,22,68.75,4,50,7,87.5,5,62.5,6,75,13,81.25,9,56.25,82.78,70.25,81,85,94.88,86.19,79.38,0,14.03,20.25,-6.5,22.5,19.88,4.94,23.13,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,3,2,1,3,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0.6,0.6,0.2,2,0,0.4,0.2,0.2,0.85,0.2,5,4.33,2,0,0,-1,0.67,10 cents,5 minutes,24 days,Female,High School (or equivalent),63,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,3,2,0,3,0.6,0.2,0,1.8,0.65,HS_TS +282,R_3GfymnrK9od8RuX,53 - 59,American,Female,2,1,2,2,1,-3,-2,3,-3,-1,2,2,2,-2,2,1,1,2,2,2,3,-1,2,2,3,9,-3,-2,2,-3,1,8,2,2,2,-2,2,8,1,1,2,1,2,7,2,0,3,3,1,9,-3,-2,1,-3,-1,7,2,3,2,-3,2,8,1,1,2,2,2,8,TRUE,0,98,TRUE,1,96,FALSE,1,98,FALSE,1,50,TRUE,1,76,FALSE,1,100,TRUE,1,88,TRUE,1,100,TRUE,1,50,TRUE,1,97,FALSE,1,87,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,94,TRUE,0,50,TRUE,0,50,TRUE,1,90,TRUE,1,83,TRUE,0,91,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,87,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0.0144,0,0,0.0196,0.0009,0.25,0.0289,0,0,0.25,0.0169,0.0576,0.0016,0.8281,0.25,0,0,0.01,0.25,0.25,0,0.0625,0.25,0.25,0.9604,0.0004,0.0036,0.0169,1,0.169907143,0.121685714,0.218128571,26,81.25,25,78.13,5,62.5,7,87.5,7,87.5,6,75,15,93.75,10,62.5,84.25,60.38,89.88,95,91.75,85.38,83.12,3.12,6.12,-2.12,2.38,7.5,16.75,-8.37,20.62,1,2,0,0,2,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,1,0.6,0,0.2,0.6,0.4,0.4,0,0.45,0.35,8.33,8,0,1,0,-1,0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,59,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,1,1,-1,-1,2,0,0,-1,0,2,0,-1,0,-1,0,0,0,0,1,0,0.4,0.2,-0.4,0.2,0.1,C_Ug +283,R_3ASUzEPdUYTIVmB,60 - 66,Canadian,Male,-2,2,2,0,1,0,-1,2,-1,1,1,1,2,0,2,-1,-1,1,1,-2,-2,2,2,-2,0,3,1,-2,2,-2,1,3,1,2,2,0,2,7,-1,-1,1,1,-2,7,0,2,2,1,0,4,0,-1,0,-1,0,5,1,1,1,-1,2,7,-1,-1,-1,0,-2,7,TRUE,0,100,FALSE,0,80,TRUE,0,100,FALSE,1,60,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,FALSE,0,70,FALSE,1,50,TRUE,1,100,FALSE,1,91,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,91,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.49,0.8281,0,0.25,0,0.25,0.64,0.25,0.16,0,0.0081,0,0.25,0.09,0.25,0,0.25,0,1,1,1,0.25,1,0.284507143,0.204864286,0.36415,24,75,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,10,62.5,12,75,84.75,70,81.25,88.88,98.88,86.94,82.56,6.25,16,7.5,-6.25,26.38,36.38,24.44,7.56,0,0,0,2,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,2,0,1,0,0,1,1,0,0,0,2,1,0,0.6,0.6,0.2,0,0.8,0.6,0.4,0.6,0.35,0.6,4.33,5.33,-1,-2,0,0,-1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,65,0.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-2,0,0,1,0,1,1,-2,1,-1,0,1,-1,-1,0,0,0,-2,-1,0,-0.2,0,-0.2,-0.6,-0.25,C_Ug +284,R_6NZYksdGLAmX51p,67 - 73,Canadian,Female,3,3,2,2,1,1,0,1,0,1,2,1,3,0,3,-1,-1,1,1,-1,3,3,3,3,1,4,2,-1,3,-1,1,1,2,2,3,-1,3,2,2,2,2,1,2,6,3,3,3,3,-1,3,1,-1,2,0,1,8,2,2,2,-2,3,3,2,-1,0,2,2,3,FALSE,1,59,TRUE,1,100,TRUE,0,100,FALSE,1,57,FALSE,0,53,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,0,53,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,55,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0.04,0,0,0,0,0,0,0.2809,0,0.2809,0,0.36,0.1849,0.16,1,0.04,0.3025,1,1,0.64,0.3025,0.36,0.1681,1,1,1,1,0.361421429,0.081907143,0.640935714,20,62.5,18,56.25,3,37.5,4,50,5,62.5,6,75,12,75,6,37.5,86,72.5,81.62,94.88,95,87.56,84.44,6.25,29.75,35,31.62,32.38,20,12.56,46.94,0,0,1,1,0,1,1,2,1,0,0,1,0,1,0,3,3,1,0,3,0,0,1,1,2,0,1,1,0,0,0,1,1,2,0,3,0,1,1,3,0.4,1,0.4,2,0.8,0.4,0.8,1.6,0.95,0.9,2.33,4.67,1,-7,-1,3,-2.34,10 cents,100 minutes,24 days,Female,Trade School (non-military),68,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,0,-2,1,0,1,1,0,0,0,-1,-1,0,0,3,0,-1,0,-0.4,0.6,-0.4,0.4,0.05,HS_TS +285,R_5mEnAkIrRgTZ6SP,60 - 66,Canadian,Female,0,1,3,-2,1,1,-2,1,-1,3,2,1,2,2,1,1,2,2,3,2,2,1,1,-1,1,7,3,-2,0,-3,3,8,2,2,1,-2,2,4,2,2,2,1,1,8,0,2,2,2,-2,8,2,1,1,1,0,7,-1,1,2,-2,1,7,2,-2,2,3,2,4,TRUE,0,92,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,86,FALSE,1,100,TRUE,1,100,TRUE,1,51,TRUE,1,90,TRUE,1,100,TRUE,0,91,TRUE,0,91,TRUE,1,70,FALSE,1,100,FALSE,0,52,TRUE,1,93,TRUE,0,87,FALSE,1,100,TRUE,0,98,TRUE,0,50,FALSE,0,100,TRUE,1,66,FALSE,1,100,TRUE,1,99,FALSE,1,100,TRUE,1,98,FALSE,1,62,FALSE,1,100,TRUE,0,95,FALSE,0,96,TRUE,1,100,TRUE,1,100,0.2401,0.0004,0.0049,0,0,0,0.0001,0,0.25,0.1156,0.9216,0.09,0.01,0.8281,0.7396,0,0,0.25,0,0,1,0.2704,0.9604,0,0.7569,0.1444,0,0.8464,0,0,0.9025,0.8281,0.318360714,0.228928571,0.407792857,27,84.38,21,65.63,5,62.5,4,50,7,87.5,5,62.5,12,75,9,56.25,88.03,80.38,92.25,94.5,85,87.56,88.5,18.75,22.4,17.88,42.25,7,22.5,12.56,32.25,2,0,2,1,0,2,0,1,2,0,0,1,1,4,1,1,0,0,2,1,0,1,1,4,3,1,3,0,2,3,3,0,0,4,0,1,4,0,0,0,1,1,1.4,0.8,1.8,1.8,1.4,1,1.05,1.5,6.33,7.33,-1,1,-3,4,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),60,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,2,-1,1,-3,-3,1,-3,1,0,-3,-3,1,1,0,1,0,-4,0,2,1,-0.8,-0.8,0,-0.2,-0.45,HS_TS +286,R_3FhNNeBDsPUEbj5,53 - 59,American,Male,0,2,2,-2,2,-2,1,1,1,1,1,-2,2,-2,2,-2,-1,-1,-1,-2,-1,2,2,-2,2,4,-2,1,-1,1,2,3,1,-2,2,-1,2,4,-2,-2,-2,-2,-2,6,0,1,1,0,2,5,-2,-1,-1,-1,1,3,1,-2,2,-2,2,2,-1,-1,-1,1,-1,5,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,0,60,TRUE,1,60,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,1,0,0.09,0,0,0,0,0,0,0,0,0,0,0.16,0.0841,0.25,0.36,0,1,0,0.25,0.25,0,0.25,1,0.25,0,0,0,1,1,0.209075,0.061007143,0.357142857,25,78.13,22,68.75,3,37.5,6,75,6,75,7,87.5,13,81.25,9,56.25,87.84,72.62,82.5,96.25,100,87.56,88.12,9.38,19.09,35.12,7.5,21.25,12.5,6.31,31.87,1,0,0,0,0,0,0,2,0,1,0,0,0,1,0,0,1,1,1,0,0,1,1,2,0,0,2,2,2,0,0,0,0,0,0,1,0,0,2,1,0.2,0.6,0.2,0.6,0.8,1.2,0,0.8,0.4,0.7,3.67,3.33,-1,0,2,1,0.34,10 cents,5 minutes,15 days,Male,College Diploma/Certificate,55,1.5,0,1,0,1,0,0,0.33,0.33,03VLPfPs,02COC,02FUT,01ITEM,02REV,1,-1,-1,-2,0,0,-2,0,-2,1,0,0,0,1,0,-1,1,1,-1,-1,-0.6,-0.6,0.2,-0.2,-0.3,C_Ug +287,R_7gdKYBE0dYWcE3j,60 - 66,American,Female,1,3,3,1,3,1,-1,2,1,3,2,0,3,1,3,-3,-3,-2,0,-3,3,3,3,1,-1,1,2,-2,3,0,3,5,2,2,2,1,3,4,-3,-3,-3,1,-3,5,3,3,3,3,0,0,0,-3,0,-3,1,7,3,3,3,3,3,7,-2,-2,0,-2,-3,2,FALSE,1,99,TRUE,1,62,FALSE,1,100,FALSE,1,64,TRUE,1,65,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,76,TRUE,1,95,FALSE,1,84,TRUE,0,89,TRUE,1,99,FALSE,1,100,TRUE,1,73,TRUE,1,100,FALSE,1,91,FALSE,1,100,TRUE,0,100,TRUE,0,66,FALSE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,92,FALSE,0,74,TRUE,0,88,TRUE,0,75,TRUE,0,100,FALSE,0,90,TRUE,1,97,TRUE,1,100,0,0.5476,0,0.0324,0,0,0,0.0025,0.4356,0,0.81,0.0001,0.0576,0.0256,0.1225,0.1444,1,0.1296,0.5625,0.0064,0.81,0.0729,1,0,0.0081,0.7744,0.0009,0.0001,0,0,1,0.7921,0.276975,0.19485,0.3591,16,50,22,68.75,6,75,5,62.5,7,87.5,4,50,13,81.25,9,56.25,89.09,80.5,93.12,92.75,90,87.69,90.5,-18.75,20.34,5.5,30.62,5.25,40,6.44,34.25,2,0,0,0,4,1,1,1,1,0,0,2,1,0,0,0,0,1,1,0,2,0,0,2,3,1,2,2,4,2,1,3,0,2,0,1,1,2,2,0,1.2,0.8,0.6,0.4,1.4,2.2,1.2,1.2,0.75,1.5,3.33,4.67,1,-2,-3,3,-1.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,66,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-2,1,0,-1,-1,-3,-2,-1,-1,1,-2,0,-1,-1,-1,-1,0,-0.2,-1.4,-0.6,-0.8,-0.75,C_Ug +288,R_1aftuJyleCr7sbn,67 - 73,Canadian,Male,2,2,2,1,-1,-1,-2,0,1,0,1,1,1,-1,1,-3,-1,-2,-1,-2,1,1,2,0,-3,2,-1,1,-1,1,-1,4,2,2,1,-1,2,3,-2,-2,-2,-2,-2,5,1,1,1,1,-2,2,0,0,1,1,-1,5,1,1,2,-1,0,3,-2,-2,-2,-2,-2,3,TRUE,0,100,TRUE,1,66,FALSE,1,100,FALSE,1,100,TRUE,1,59,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,87,FALSE,0,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,FALSE,1,100,TRUE,0,82,TRUE,0,89,FALSE,1,91,FALSE,0,95,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,81,FALSE,0,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,1,0.0081,0,1,1,1,1,0.1681,0.1156,0.01,0,0,1,0.9025,0.1681,0.7921,0,0,0.7744,1,1,0,0.6724,0.6561,0.7569,0.465153571,0.3787,0.551607143,26,81.25,18,56.25,3,37.5,5,62.5,4,50,6,75,10,62.5,8,50,93.34,87.75,90.62,97.75,97.25,92.44,94.25,25,37.09,50.25,28.12,47.75,22.25,29.94,44.25,1,1,0,1,2,0,3,1,0,1,1,1,0,0,1,1,1,0,1,0,1,1,1,0,1,1,2,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0.6,0.6,0.8,1,0.4,0.6,0.8,0.7,3,3.33,0,-1,0,2,-0.33,10 cents,100 minutes,24 days,Male,Trade School (non-military),67,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,-1,1,1,-1,1,0,0,0,1,1,-1,0,0,0,0,0,0,0,0.2,0,0.2,0,0.1,HS_TS +289,R_38UI4Nfo4ZxgWvT,60 - 66,Canadian,Male,3,3,3,-1,1,-2,0,2,-2,1,1,0,2,0,0,1,1,2,1,1,3,3,3,-2,1,6,-2,-2,2,-2,1,3,1,0,2,1,0,2,-1,-1,-1,-1,0,3,3,3,3,0,1,3,-2,0,2,-2,1,2,1,0,2,0,0,2,1,1,1,1,0,2,TRUE,0,85,TRUE,1,85,TRUE,0,59,TRUE,0,57,TRUE,1,62,FALSE,1,91,TRUE,1,77,TRUE,1,70,TRUE,1,94,TRUE,1,92,TRUE,0,59,FALSE,1,88,TRUE,1,90,FALSE,1,100,TRUE,1,59,TRUE,1,100,FALSE,1,100,FALSE,1,81,FALSE,1,73,FALSE,1,100,FALSE,0,85,TRUE,1,95,TRUE,0,86,TRUE,1,89,FALSE,1,88,TRUE,1,95,TRUE,0,79,FALSE,1,100,TRUE,0,100,FALSE,0,90,TRUE,1,87,TRUE,1,100,0.09,0.0025,0,0.0529,0,0.0081,0.0121,0.0064,0,0.0025,0.81,0.01,0.0036,0.3481,0.1444,0.0225,0.7396,0.3249,0,0.0144,0.7225,0.1681,0.0729,0,0,0.6241,0.0169,0.7225,0.3481,0.0361,1,0.0144,0.220435714,0.173728571,0.267142857,21,65.63,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,84.88,74.12,89.25,89.12,87,85.62,84.12,-6.25,13,11.62,26.75,1.62,12,-1.88,27.87,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,2,2,3,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0.2,0.4,0.2,2,0.2,0,0,0.4,0.7,0.15,3.67,2.33,3,1,0,1,1.34,5 cents,5 minutes,24 days,Male,University - Undergraduate,62,0.625,1,1,0,0,0,1,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,2,2,2,2,0,0,0.4,0.2,1.6,0.55,C_Ug +290,R_5wjoMyBPGjBVmtp,53 - 59,American,Male,2,1,-1,0,3,2,-2,1,1,1,3,3,3,2,3,-2,-2,-2,-3,-3,3,1,2,-2,1,3,1,1,2,2,0,4,1,3,2,3,1,2,2,1,2,2,1,8,1,1,-3,2,2,4,-2,1,1,3,-1,6,1,2,2,-2,1,4,-3,-3,-3,-3,-3,9,TRUE,0,100,TRUE,1,85,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,85,TRUE,1,65,FALSE,1,80,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,TRUE,0,80,TRUE,0,50,FALSE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,70,TRUE,1,85,FALSE,1,90,TRUE,1,100,FALSE,1,50,TRUE,0,75,TRUE,0,70,TRUE,1,95,TRUE,1,75,TRUE,1,85,0,0,0,0,0.0225,0,0.0225,0.1225,0.01,0,0.0025,0,0.0225,0.04,0,0.0225,0.09,0.25,0.5625,0.01,0,0.25,0.25,0,0.09,0.25,0.0625,1,1,0.64,0.49,0.36,0.198928571,0.043214286,0.354642857,26,81.25,25,78.13,7,87.5,7,87.5,6,75,5,62.5,16,100,9,56.25,83.12,65.62,86.88,91.88,88.12,89.06,77.19,3.12,4.99,-21.88,-0.62,16.88,25.62,-10.94,20.94,1,0,3,2,2,1,3,1,1,1,2,0,1,1,2,4,3,4,5,4,1,0,2,2,1,4,3,0,2,2,2,1,1,4,2,1,1,1,0,0,1.6,1.4,1.2,4,1.2,2.2,2,0.6,2.05,1.5,3,4.67,-1,-2,-2,-1,-1.67,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),55,1.25,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,1,0,1,-3,0,1,-1,-1,0,-1,0,-3,0,3,2,3,5,4,0.4,-0.8,-0.8,3.4,0.55,grad_prof +291,R_7Pmtr9gYRDIqooh,67 - 73,Canadian,Female,-3,1,3,-3,2,0,-3,2,-2,1,3,1,2,1,3,-2,-2,-1,-3,-3,-3,1,3,-3,2,2,0,-3,2,0,2,6,3,1,3,2,3,2,-2,-3,-2,-2,-3,2,-3,0,3,2,1,8,0,-2,2,0,1,8,3,1,2,1,3,1,-3,-2,-2,-3,-3,9,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,95,FALSE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,95,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,95,TRUE,1,50,TRUE,1,100,0.25,0.25,0,0.0025,0,0.25,0.25,0,0.25,0.25,0.0025,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9025,1,0.25,0.25,0.25,1,1,1,0.25,1,0.371607143,0.17875,0.564464286,25,78.13,16,50,5,62.5,4,50,4,50,3,37.5,12,75,4,25,68.28,55.62,62.5,80.62,74.38,68.12,68.44,28.13,18.28,-6.88,12.5,30.62,36.88,-6.88,43.44,0,0,0,0,0,0,0,0,2,1,0,0,1,1,0,0,1,1,1,0,0,1,0,5,1,0,1,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0.6,0.4,0.6,1.4,0.6,0,0.4,0.4,0.6,3.33,5.67,-6,-2,1,-7,-2.34,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,1.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,-5,-1,0,-1,0,0,1,0,0,1,1,0,-1,1,0,1,0,-1.4,0,0.4,0.2,-0.2,HS_TS +292,R_7lWWWaqjZyxbpRv,53 - 59,American,Female,1,3,1,2,3,3,-3,3,-2,3,2,-1,2,1,3,3,3,3,2,-2,3,1,2,-3,1,7,1,1,3,1,-1,8,2,2,2,1,2,4,-2,-2,-2,-2,-2,9,2,3,1,0,3,2,3,-3,3,-3,3,1,3,-1,3,1,3,1,3,3,3,2,-1,1,TRUE,0,70,TRUE,1,93,FALSE,1,95,TRUE,0,65,FALSE,0,60,FALSE,1,99,TRUE,1,97,TRUE,1,96,FALSE,0,73,TRUE,1,98,TRUE,0,91,TRUE,0,96,TRUE,1,87,TRUE,0,97,TRUE,1,78,TRUE,1,79,FALSE,1,81,FALSE,1,94,TRUE,0,88,TRUE,0,73,FALSE,0,86,TRUE,1,91,FALSE,1,67,TRUE,1,92,TRUE,0,89,TRUE,1,96,FALSE,1,61,TRUE,0,83,FALSE,1,61,TRUE,1,89,FALSE,0,68,TRUE,1,98,0.0016,0.0016,0.0441,0.0009,0.0004,0.0001,0.0064,0.0004,0.5329,0.0081,0.0121,0.0169,0.5329,0.8281,0.36,0.0049,0.1089,0.4225,0.6889,0.7921,0.7396,0.0484,0.7744,0.9409,0.0361,0.1521,0.4624,0.49,0.0025,0.0036,0.1521,0.9216,0.322832143,0.202471429,0.443192857,18,56.25,19,59.38,3,37.5,6,75,5,62.5,5,62.5,12,75,7,43.75,84.09,77.12,79.88,91.5,87.88,86.31,81.88,-3.13,24.71,39.62,4.88,29,25.38,11.31,38.13,2,2,1,5,2,2,4,0,3,4,0,3,0,0,1,5,5,5,4,0,1,0,0,2,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,2.4,2.6,0.8,3.8,0.6,0.2,0.4,0.2,2.4,0.35,6.33,1.33,5,7,3,8,5,10 cents,5 minutes,24 days,Female,High School (or equivalent),57,1.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,2,1,3,2,2,4,0,2,4,-1,3,-1,0,1,5,5,5,4,-1,1.8,2.4,0.4,3.6,2.05,HS_TS +293,R_63D332NuCPnFAOe,32 - 38,Canadian,Female,1,3,3,3,2,2,1,3,1,2,3,3,3,-1,3,2,1,-2,-2,-1,3,3,3,3,3,6,3,0,2,-3,2,3,2,3,3,-1,3,4,0,1,1,-3,1,5,3,3,3,3,3,0,2,2,3,2,2,0,2,3,2,-1,3,0,1,1,1,2,-3,0,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0.25,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0.25,1,0.232142857,0.160714286,0.303571429,32,100,25,78.13,8,100,4,50,7,87.5,6,75,15,93.75,10,62.5,96.88,93.75,93.75,100,100,96.88,96.88,21.87,18.75,-6.25,43.75,12.5,25,3.13,34.38,2,0,0,0,1,1,1,1,4,0,1,0,0,0,0,2,0,3,1,2,2,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,3,4,2,0.6,1.4,0.2,1.6,0.6,0.4,0.4,2,0.95,0.85,4.33,0,6,3,4,5,4.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),35,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,1,0,1,3,0,0,0,-1,0,0,1,0,0,-3,0,0,1,-0.2,-0.4,0.1,HS_TS +294,R_3v32TkdVqdL7noW,53 - 59,Canadian,Female,0,1,2,1,1,-2,0,1,0,1,2,2,1,0,2,1,1,1,1,0,0,2,2,2,1,3,0,0,2,0,2,3,2,0,0,0,2,4,1,1,0,0,0,3,0,1,2,1,1,4,-2,-2,2,0,1,3,2,2,2,-1,2,3,2,1,1,1,2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0.178571429,0.071428571,0.285714286,32,100,27,84.38,8,100,5,62.5,8,100,6,75,15,93.75,12,75,100,100,100,100,100,100,100,15.62,15.62,0,37.5,0,25,6.25,25,0,1,0,1,0,2,0,1,0,1,0,2,1,0,0,0,0,1,1,0,0,0,0,0,0,0,2,1,0,0,0,0,1,1,0,1,0,0,0,2,0.4,0.8,0.6,0.4,0,0.6,0.4,0.6,0.55,0.4,3.33,3.33,-1,0,1,0,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,54,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,1,0,1,0,2,-2,0,0,1,0,2,0,-1,0,-1,0,1,1,-2,0.4,0.2,0.2,-0.2,0.15,C_Ug +295,R_5J9jfdbOIc1QKDy,67 - 73,American,Female,1,-1,-1,-2,-1,-1,-1,2,-2,-1,3,3,2,2,2,-1,-2,-1,1,-2,2,0,2,-2,-2,1,0,0,3,-3,0,1,3,3,2,2,3,0,-2,-3,-2,-1,-3,6,0,0,0,-3,-3,1,0,-2,3,-2,0,1,3,3,3,2,3,1,-2,-3,-1,0,-3,1,FALSE,1,96,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,69,FALSE,1,100,FALSE,0,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,81,TRUE,0,90,TRUE,0,90,FALSE,1,90,FALSE,0,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,50,FALSE,1,80,FALSE,1,80,TRUE,1,100,FALSE,0,70,TRUE,1,100,0,1,0,0,0,0,0,0,0.01,0,0,1,0.16,0.4761,0.25,0,0,0.25,0.04,0,0.81,0.25,0.81,1,0.0361,0.25,0.49,0.0016,1,0.81,0.04,0,0.274421429,0.153292857,0.39555,25,78.13,21,65.63,3,37.5,6,75,5,62.5,7,87.5,11,68.75,10,62.5,87.38,67.38,87.62,98.25,96.25,88.75,86,12.5,21.75,29.88,12.62,35.75,8.75,20,23.5,1,1,3,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,2,1,1,1,1,1,2,1,1,1,0,1,0,0,1,0,1,1,1,0,1,1,1.2,1,0.2,1.2,1.2,0.8,0.4,0.8,0.9,0.8,0.67,1,0,0,-1,5,-0.33,10 cents,100 minutes,24 days,Female,Professional Degree (ex. JD/MD),68,0.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,2,-1,-1,0,0,0,1,0,0,0,-1,0,0,0,0,1,1,0,0,0.2,-0.2,0.4,0.1,grad_prof +296,R_1rzHjl5vvoGnMI1,67 - 73,American,Male,-3,0,3,1,3,0,1,1,1,1,0,2,2,0,2,-1,-1,0,0,-3,-3,1,3,-1,3,6,1,1,1,1,1,5,0,2,2,0,2,5,-1,-1,1,-1,-2,6,-3,-2,3,1,3,6,0,1,1,1,1,6,0,3,1,0,2,5,0,0,0,0,-3,6,TRUE,0,70,TRUE,1,70,TRUE,0,100,TRUE,0,50,FALSE,0,50,TRUE,0,65,TRUE,1,100,TRUE,1,65,TRUE,1,50,TRUE,1,70,TRUE,0,70,TRUE,0,70,TRUE,1,70,TRUE,0,60,FALSE,0,50,TRUE,1,95,FALSE,1,90,FALSE,1,85,FALSE,1,71,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,65,FALSE,0,60,FALSE,1,100,TRUE,1,70,FALSE,1,51,FALSE,1,100,TRUE,0,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.1225,0.09,0.0025,0,0,0.4225,0.36,0.09,0,0,0,0.09,0.25,0.49,0.25,0.09,0.4225,0.25,0,0,0.25,0.25,0.0841,0.36,0.01,0.2401,0,0.49,1,0.0225,0.49,0.49,0.228632143,0.193928571,0.263335714,21,65.63,19,59.38,5,62.5,3,37.5,6,75,5,62.5,12,75,7,43.75,75.53,64,70,81.88,86.25,75,76.06,6.25,16.15,1.5,32.5,6.88,23.75,0,32.31,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,2,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0.6,0.2,0,0.6,0.4,0,0.4,0.4,0.35,0.3,5.33,5.67,0,-1,0,0,-0.34,10 cents,5 minutes,24 days,Male,High School (or equivalent),72,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,-1,0,2,0,1,0,0,0,0,0,-1,-1,0,0,-1,-1,1,1,1,0.2,0.2,-0.4,0.2,0.05,HS_TS +297,R_6qkiecRf87DHC9F,67 - 73,American,Male,1,-2,2,-2,-2,-1,-1,1,1,-1,1,1,1,-1,0,2,1,2,2,2,2,0,2,-1,-1,2,-1,-1,1,-1,0,2,2,2,1,-1,0,3,1,1,1,1,1,4,1,-2,2,-2,-3,2,-1,-1,1,0,-1,1,1,1,1,-1,1,1,0,0,1,1,1,1,TRUE,0,100,TRUE,1,86,FALSE,1,100,FALSE,1,52,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,70,TRUE,0,79,TRUE,0,100,TRUE,1,90,TRUE,0,98,TRUE,1,50,TRUE,1,92,FALSE,1,50,TRUE,0,100,TRUE,0,53,TRUE,0,57,FALSE,0,90,FALSE,0,51,FALSE,1,100,TRUE,1,53,FALSE,1,100,TRUE,1,84,TRUE,0,52,TRUE,0,98,FALSE,1,50,TRUE,1,98,TRUE,1,51,TRUE,1,100,0,0.0256,0.0064,0,0,0.25,0.2209,0.09,0.3249,0.2601,0.0004,0.01,0.25,0.6241,0.25,0.0196,0,0.2304,0.9604,0,0.81,0.25,0.2809,0.9604,0.25,0.2704,0.2401,1,0,1,0.25,1,0.350092857,0.180742857,0.519442857,23,71.88,19,59.38,4,50,6,75,4,50,5,62.5,12,75,7,43.75,76.69,59.12,72.5,87.88,87.25,75.94,77.44,12.5,17.31,9.12,-2.5,37.88,24.75,0.94,33.69,1,2,0,1,1,0,0,0,2,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,2,1,1,1,1,1,0.6,0.4,0.8,0.2,0.2,0.2,1.2,0.7,0.45,2.33,1.33,0,1,2,3,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),69,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,1,2,0,1,0,0,0,0,1,1,1,1,0,0,-1,-1,-1,0,0,0,0.8,0.4,0.2,-0.4,0.25,HS_TS +298,R_6HTUWXqRQKtiHdf,53 - 59,Canadian,Female,0,3,2,0,3,0,-3,2,2,2,1,2,3,0,3,-3,-2,-3,-2,-2,-2,3,3,-2,3,8,2,-3,2,0,3,9,-1,0,0,1,2,6,-2,-1,-2,-1,-3,9,0,3,3,2,3,8,0,-3,3,1,2,8,2,1,3,0,3,7,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,88,TRUE,0,100,FALSE,1,50,TRUE,1,91,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,97,TRUE,0,100,TRUE,1,80,TRUE,0,100,TRUE,1,87,TRUE,1,94,FALSE,1,76,TRUE,0,100,TRUE,0,95,TRUE,0,100,TRUE,1,98,TRUE,1,80,TRUE,0,82,TRUE,1,100,FALSE,1,86,TRUE,1,99,TRUE,0,100,TRUE,0,94,TRUE,0,90,FALSE,0,77,TRUE,1,100,TRUE,1,100,0,0.0001,0.0036,0.0004,0,0,0,0,1,0.04,0.5929,0.04,0,0.9409,0.0081,0.0144,0.6724,0.25,0.8836,0.0196,0.0004,0.0169,0.9025,1,0.0576,1,0,0,1,1,0.81,1,0.401760714,0.254192857,0.549328571,26,81.25,20,62.5,5,62.5,6,75,6,75,3,37.5,15,93.75,5,31.25,92.56,89.62,89.62,95.38,95.62,93.25,91.88,18.75,30.06,27.12,14.62,20.38,58.12,-0.5,60.63,2,0,1,2,0,2,0,0,2,1,2,2,3,1,1,1,1,1,1,1,0,0,1,2,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,1,1,1.8,1,0.6,0.4,0.4,0.6,1.2,0.5,7.67,7.67,0,1,-1,4,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,57,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,2,0,0,0,0,2,0,-1,1,1,1,1,3,1,1,1,0,1,0,0,0.4,0.6,1.4,0.4,0.7,C_Ug +299,R_3q4JHgQQI86k13W,67 - 73,American,Male,1,-3,-2,2,-3,-2,-3,2,-2,-1,2,1,2,-2,-1,-1,-1,2,0,2,0,-1,-1,0,-1,10,-3,-3,3,-3,-2,10,2,1,2,-2,-1,8,-2,-2,0,-2,-2,10,2,0,0,2,-2,8,-3,-3,3,-3,-3,8,2,2,2,-2,-1,8,-3,-2,0,-2,-2,8,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,0,100,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0.464285714,0.642857143,0.285714286,32,100,19,59.38,4,50,4,50,5,62.5,6,75,4,25,15,93.75,100,100,100,100,100,100,100,40.62,40.62,50,50,37.5,25,75,6.25,1,2,1,2,2,1,0,1,1,1,0,0,0,0,0,1,1,2,2,4,1,3,2,0,1,1,0,1,1,2,0,1,0,0,0,2,1,2,2,4,1.6,0.8,0,2,1.4,1,0.2,2.2,1.1,1.2,9.33,8,2,2,0,2,1.33,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),71,-0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,-1,-1,2,1,0,0,0,0,-1,0,-1,0,0,0,-1,0,0,0,0,0.2,-0.2,-0.2,-0.2,-0.1,grad_prof +300,R_17KcLcxoWWcjhtD,18 - 24,American,Male,-1,3,2,-2,3,3,-1,2,-2,3,1,0,3,2,3,1,2,3,2,3,2,1,1,-2,-1,4,-2,-2,3,-3,1,4,-1,1,2,3,1,0,2,3,-1,2,1,3,1,3,1,-1,2,7,-2,-1,1,-3,2,5,2,2,1,3,1,2,2,-1,3,1,2,3,FALSE,1,81,TRUE,1,73,FALSE,1,71,FALSE,1,80,TRUE,1,100,FALSE,1,100,FALSE,0,73,FALSE,0,62,TRUE,1,78,FALSE,0,80,FALSE,1,100,FALSE,1,88,TRUE,1,87,FALSE,1,82,FALSE,0,85,TRUE,1,77,FALSE,1,95,FALSE,1,61,TRUE,0,72,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,67,FALSE,0,86,FALSE,1,71,FALSE,0,57,FALSE,1,83,FALSE,1,100,FALSE,1,76,TRUE,1,81,TRUE,1,76,FALSE,0,90,0.3844,0.3249,0.0529,0.5329,0.81,0,0.7396,0.64,0,1,0.0361,0.0169,0.0484,0,0,0.0729,0.4489,0.04,0,0.0841,1,0.7225,0.5184,0.0324,0.0025,0.0289,0.0576,0.0361,0.0841,0.1521,0.0576,0.0144,0.237267857,0.2752,0.199335714,16,50,21,65.63,6,75,5,62.5,4,50,6,75,7,43.75,14,87.5,82.25,80.88,89.38,75.62,83.12,81.56,82.94,-15.63,16.62,5.88,26.88,25.62,8.12,37.81,-4.56,3,2,1,0,4,5,1,1,1,2,2,1,1,1,2,1,1,4,0,2,2,0,1,1,1,5,0,1,1,1,1,2,2,1,2,1,3,0,1,1,2,2,1.4,1.6,1,1.6,1.6,1.2,1.75,1.35,2.67,4.67,-3,-1,-2,0,-2,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),24,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,1,2,0,-1,3,0,1,0,0,1,1,-1,-1,0,0,0,-2,4,-1,1,1,0.4,-0.2,0.4,0.4,grad_prof +301,R_6P0kamWHi489yyl,25 - 31,American,Female,3,2,2,3,3,-2,-1,2,-2,2,1,1,3,-1,2,2,3,3,1,2,2,2,2,3,2,3,0,0,1,1,1,4,2,3,1,-1,2,4,2,3,2,2,1,4,3,2,2,3,3,3,2,1,0,1,0,1,0,1,1,1,0,3,3,3,3,3,2,9,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,93,FALSE,0,90,FALSE,1,91,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,95,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,100,FALSE,0,82,TRUE,1,100,TRUE,1,95,0,0,0,0.0025,0.0025,0,0,0,1,0,0.6724,0.81,0,0,0.0036,0,0,1,0.0625,0,1,0,0.0025,0.0081,0,0,0,0,0.8836,0,1,0.0049,0.230360714,0.249178571,0.211542857,29,90.63,25,78.13,7,87.5,5,62.5,8,100,5,62.5,13,81.25,12,75,97,99.38,97.38,98.25,93,97.25,96.75,12.5,18.87,11.88,34.88,-1.75,30.5,16,21.75,1,0,0,0,1,2,1,1,3,1,1,2,2,0,0,0,0,1,1,1,0,0,0,0,0,4,2,2,3,2,1,0,2,2,2,1,0,0,2,0,0.4,1.6,1,0.6,0,2.6,1.4,0.6,0.9,1.15,3.67,2.33,0,3,1,-5,1.34,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),29,1.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,0,0,0,1,-2,-1,-1,0,-1,0,2,0,-2,-2,-1,0,1,-1,1,0.4,-1,-0.4,0,-0.25,grad_prof +302,R_6hXuPjXu4GtwAxl,60 - 66,Canadian,Male,-3,3,3,3,3,-1,1,-1,1,3,1,1,3,0,2,3,3,3,3,3,-3,3,3,-2,3,5,2,1,2,0,2,5,1,2,2,0,2,7,-1,-1,0,-1,3,8,-3,3,3,3,3,1,2,0,3,0,3,8,2,1,2,0,2,7,3,3,3,3,3,1,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,1,0.535714286,0.428571429,0.642857143,25,78.13,16,50,2,25,4,50,5,62.5,5,62.5,10,62.5,6,37.5,100,100,100,100,100,100,100,28.13,50,75,50,37.5,37.5,37.5,62.5,0,0,0,5,0,3,0,3,1,1,0,1,1,0,0,4,4,3,4,0,0,0,0,0,0,3,1,4,1,0,1,0,1,0,0,0,0,0,0,0,1,1.6,0.4,3,0,1.8,0.4,0,1.5,0.55,5.67,5.33,4,-3,0,7,0.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),63,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,5,0,0,-1,-1,0,1,-1,1,0,0,0,4,4,3,4,0,1,-0.2,0,3,0.95,HS_TS +303,R_7O3X2HkbSJtBspb,25 - 31,American,Male,2,1,0,-3,3,1,-3,1,-3,3,0,-3,3,-3,3,2,3,2,3,-3,2,-2,3,1,0,5,-3,0,-2,1,0,8,0,-3,3,-3,3,2,-1,-2,-3,-1,-3,8,2,1,0,-3,3,5,3,-3,1,-3,3,2,0,-3,3,-3,3,1,3,3,3,3,-3,3,TRUE,0,75,FALSE,0,52,TRUE,0,55,TRUE,0,75,TRUE,1,57,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,1,80,TRUE,1,70,FALSE,1,50,TRUE,0,90,TRUE,1,86,FALSE,1,100,FALSE,0,70,TRUE,1,100,TRUE,0,80,TRUE,0,76,TRUE,0,86,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,65,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,0,70,TRUE,1,50,FALSE,0,50,TRUE,1,80,0.0625,0.25,0,0.0625,0.04,0.25,0,0.09,0,0,0.25,0.0196,0.04,0.25,0.1849,0.2704,0.25,0.5625,0.25,0.4225,0.25,0.49,0.7396,0,0.64,0.36,0.25,0.5625,0.3025,0.5776,0.49,0.81,0.298289286,0.157671429,0.438907143,10,31.25,16,50,2,25,3,37.5,5,62.5,6,75,12,75,4,25,71.16,65.38,65.38,76.38,77.5,71.56,70.75,-18.75,21.16,40.38,27.88,13.88,2.5,-3.44,45.75,0,3,3,4,3,4,3,3,4,3,0,0,0,0,0,3,5,5,4,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2.6,3.4,0,3.4,0,0.4,0,0.4,2.35,0.2,5,2.67,0,6,1,5,2.33,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,30,1.5,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,3,3,4,3,2,3,3,4,3,0,0,0,0,0,2,5,4,4,0,2.6,3,0,3,2.15,C_Ug +304,R_71qUGxUVNF7HhaF,46 - 52,American,Female,3,3,3,0,3,1,-3,3,-3,2,2,-3,3,0,3,0,2,2,2,0,3,3,3,0,3,2,1,-3,3,-3,3,3,2,-3,2,0,3,1,-1,1,0,-1,-1,5,3,3,3,1,3,2,1,-3,3,-3,2,1,2,-3,3,0,3,1,3,3,3,3,0,1,TRUE,0,82,TRUE,1,87,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,100,TRUE,0,50,TRUE,0,82,TRUE,1,81,FALSE,1,100,TRUE,1,50,TRUE,1,91,TRUE,0,76,TRUE,0,76,TRUE,0,53,FALSE,1,53,FALSE,0,50,TRUE,1,81,FALSE,1,100,TRUE,1,91,TRUE,0,100,TRUE,1,87,TRUE,0,54,FALSE,1,100,TRUE,0,81,TRUE,1,76,TRUE,1,50,TRUE,1,100,0,0.0169,0.0081,0,0,0,0.0081,1,0.2209,0.0361,0.0576,0.0361,0.0081,0.25,0,0.0169,0,0.25,0,1,0.25,0.25,0.2809,0,0.5776,0.2916,0.25,0.6724,0.25,0.5776,0.6561,0.6724,0.271871429,0.134557143,0.409185714,24,75,20,62.5,4,50,5,62.5,4,50,7,87.5,14,87.5,6,37.5,79.44,60.62,86,90.75,80.38,83.44,75.44,12.5,16.94,10.62,23.5,40.75,-7.12,-4.06,37.94,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,2,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,3,1,1,1,0,0,0.2,0.2,1.6,0.2,0,0,1.2,0.5,0.35,2,1.33,0,2,0,4,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,1.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,-1,0,0,0,0,0,1,0,0,1,0,0,-2,0,1,2,1,-0.2,0.2,0.2,0.4,0.15,C_Ug +305,R_7nhQXDvCukJnMvT,53 - 59,Canadian,Female,3,3,2,2,3,2,-2,1,0,2,0,-3,3,1,3,2,2,2,2,0,2,3,-1,1,1,5,3,-1,1,1,1,3,2,-3,3,2,3,3,-1,0,-1,-1,-1,5,3,3,1,2,3,1,2,-3,2,0,3,1,1,-3,3,0,3,2,2,2,2,2,2,4,FALSE,1,100,FALSE,0,87,FALSE,1,100,TRUE,0,53,TRUE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,76,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,67,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,81,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,76,TRUE,1,100,0,0,0,0.0016,0,0,0,0,0,0,0,0.4489,0.0576,1,0,0.7569,0,0.2809,0,0,0,1,1,0,0.6561,1,0.5776,0,0,0,1,1,0.3135,0.181735714,0.445264286,28,87.5,21,65.63,1,12.5,5,62.5,8,100,7,87.5,12,75,9,56.25,94.88,86.5,93.5,99.5,100,93.88,95.88,21.87,29.25,74,31,-0.5,12.5,18.88,39.63,1,0,3,1,2,1,1,0,1,1,2,0,0,1,0,3,2,3,3,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,2,1.4,0.8,0.6,2.4,0.2,0.6,0.4,0.4,1.3,0.4,3.67,1.33,4,2,1,1,2.34,10 cents,5 minutes,15 days,Female,University - Undergraduate,53,1.625,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,1,0,2,1,2,1,0,-1,1,0,1,0,0,0,0,3,2,3,3,-1,1.2,0.2,0.2,2,0.9,C_Ug +306,R_7pYaXLvoeSp5urG,39 - 45,Canadian,Female,3,3,2,0,2,1,-1,0,-1,3,0,0,3,0,3,0,1,1,0,-1,3,3,2,-1,2,2,2,1,0,0,3,1,-1,0,3,1,3,1,0,1,0,0,0,5,3,3,2,0,2,1,1,-2,2,-1,3,1,0,0,3,-2,3,0,2,2,2,1,1,2,FALSE,1,97,TRUE,1,96,FALSE,1,94,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,85,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,88,TRUE,0,60,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,50,TRUE,1,94,0,0,0,0,0.0036,0,0,0,0.25,0,0,0,0,0.0225,0.01,0.0016,0,0.25,0,0,0.25,0.25,0.36,0,0.25,0.25,0.25,0.0009,0.0036,0.7744,0.5625,0.25,0.133539286,0.038407143,0.228671429,22,68.75,24,75,6,75,5,62.5,7,87.5,6,75,15,93.75,9,56.25,83.72,67.62,82.38,98.12,86.75,89.38,78.06,-6.25,8.72,-7.38,19.88,10.62,11.75,-4.37,21.81,0,0,0,1,0,1,2,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,2,0,2,1,1,1,2,0.2,0.8,0.4,0.4,0,0.6,0.4,1.4,0.45,0.6,1.33,0.67,1,0,1,3,0.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),44,1.875,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,1,0,1,1,-2,1,0,1,0,0,-1,0,-2,-1,0,-1,-1,0.2,0.2,0,-1,-0.15,HS_TS +307,R_3NxJttisIIAEUus,60 - 66,American,Female,3,2,2,-2,2,-2,-1,2,-2,2,2,1,2,1,2,1,2,3,2,-2,3,2,2,-3,2,2,0,0,3,0,1,3,1,1,2,3,2,1,0,0,0,1,-3,6,3,2,2,0,3,0,0,-2,3,-2,1,0,2,1,3,0,2,0,2,2,2,2,-1,1,FALSE,1,98,FALSE,0,91,FALSE,1,100,FALSE,1,93,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,100,FALSE,1,76,TRUE,1,90,TRUE,0,88,TRUE,1,81,TRUE,1,100,FALSE,1,100,FALSE,1,97,TRUE,0,88,FALSE,1,100,TRUE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,97,TRUE,0,90,TRUE,1,94,FALSE,1,86,TRUE,0,99,TRUE,0,98,TRUE,1,98,TRUE,1,99,TRUE,1,99,0,0.0036,0,0,0.0001,0,0.0009,0,0,0.0064,0.0004,0.01,0.0009,0,0.04,0.8281,0,0.0049,0.9801,0.81,0,0.0361,0.7744,0.7744,0,0.0196,0.0001,0.0004,0,0.0009,0.9604,0.0576,0.189489286,0.063692857,0.315285714,29,90.63,26,81.25,6,75,7,87.5,6,75,7,87.5,15,93.75,11,68.75,94.72,91.88,95.88,94.88,96.25,94.88,94.56,9.38,13.47,16.88,8.38,19.88,8.75,1.13,25.81,0,0,0,1,0,2,1,1,2,1,1,0,0,2,0,1,2,3,1,1,0,0,0,2,1,2,1,1,0,1,0,0,1,1,0,1,0,1,0,1,0.2,1.4,0.6,1.6,0.6,1,0.4,0.6,0.95,0.65,2,0,2,3,1,5,2,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,0,-1,-1,0,0,0,2,0,1,0,-1,1,0,0,2,2,1,0,-0.4,0.4,0.2,1,0.3,grad_prof +308,R_3CEIGdrkYXHGlap,53 - 59,American,Female,3,-1,2,2,-3,0,-2,1,-2,0,1,-1,1,-1,1,1,0,1,2,1,3,-1,2,0,-1,2,-1,1,1,-1,1,5,1,-1,1,0,1,2,0,0,1,0,0,4,3,-1,2,2,-3,3,-2,-2,0,-2,-2,3,1,0,0,-1,0,2,-1,0,-1,1,0,3,FALSE,1,99,TRUE,1,99,FALSE,1,91,FALSE,1,54,TRUE,1,96,FALSE,1,54,TRUE,1,98,TRUE,1,99,TRUE,1,96,TRUE,1,97,FALSE,1,60,TRUE,0,93,TRUE,1,93,TRUE,0,100,TRUE,1,96,TRUE,1,99,FALSE,1,90,FALSE,1,96,TRUE,0,60,FALSE,1,100,FALSE,0,56,TRUE,1,87,FALSE,1,59,TRUE,1,86,TRUE,0,59,TRUE,1,60,FALSE,1,59,FALSE,1,87,TRUE,0,82,TRUE,1,85,TRUE,1,95,TRUE,1,96,0.0001,0.16,0.0001,0.0004,0.0016,0.2116,0.0196,0.0009,0,0.0169,0.0225,0.0049,0.0016,0.16,0.0016,0.0001,0.1681,0.2116,0.0169,0.3481,0.3136,0.0016,0.36,1,0.01,0.1681,0.0025,0.0001,0.0081,0.0016,0.6724,0.8649,0.163889286,0.058642857,0.269135714,16,50,26,81.25,7,87.5,6,75,6,75,7,87.5,15,93.75,11,68.75,83.78,77.38,78.25,87,92.5,89.88,77.69,-31.25,2.53,-10.12,3.25,12,5,-3.87,8.94,0,0,0,2,2,1,3,0,1,1,0,0,0,1,0,1,0,0,2,1,0,0,0,0,0,2,0,1,0,2,0,1,1,0,1,2,0,2,1,1,0.8,1.2,0.2,0.8,0,1,0.6,1.2,0.75,0.7,3,2.67,-1,2,0,1,0.33,20 cents,100 minutes,15 days,Female,University - Undergraduate,55,0.75,0,0,0,0,1,0,0,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,2,2,-1,3,-1,1,-1,0,-1,-1,1,-1,-1,0,-2,1,0,0.8,0.2,-0.4,-0.4,0.05,C_Ug +309,R_3Vr7U3YMAjw2Ymt,25 - 31,Canadian,Female,-3,2,2,2,2,1,-2,2,1,1,2,-1,3,1,2,-3,-1,-2,-3,-3,-3,2,3,2,2,2,2,-2,3,1,2,0,3,2,-1,2,1,4,1,1,1,1,-2,3,-3,3,3,3,3,4,-1,-1,2,1,2,4,3,1,3,2,2,3,1,1,2,-1,-1,4,TRUE,0,66,FALSE,0,50,FALSE,1,62,TRUE,0,50,FALSE,0,50,FALSE,1,60,TRUE,1,89,TRUE,1,82,FALSE,0,50,FALSE,0,50,FALSE,1,51,TRUE,0,61,TRUE,1,54,TRUE,0,50,FALSE,0,50,TRUE,1,65,TRUE,0,50,TRUE,0,60,TRUE,0,52,FALSE,1,53,TRUE,1,70,FALSE,0,53,TRUE,0,56,FALSE,0,65,FALSE,1,79,TRUE,1,73,TRUE,0,58,TRUE,0,52,FALSE,1,57,FALSE,0,100,FALSE,0,54,FALSE,0,50,0.0324,0.0729,0.1225,0.0121,0.25,0.16,0.4225,0.25,0.2209,0.2809,1,0.2116,0.25,0.2401,0.25,0.25,0.3136,0.25,0.2704,0.0441,0.09,0.25,0.2704,0.25,0.25,0.3364,0.2916,0.4356,0.1444,0.36,0.1849,0.3721,0.282125,0.310685714,0.253564286,4,12.5,12,37.5,1,12.5,4,50,3,37.5,4,50,6,37.5,6,37.5,60.06,51.88,55.88,65,67.5,62.81,57.31,-25,22.56,39.38,5.88,27.5,17.5,25.31,19.81,0,0,1,0,0,1,0,1,0,1,1,3,4,1,1,4,2,3,4,1,0,1,1,1,1,2,1,0,0,1,1,2,0,1,0,4,2,4,2,2,0.2,0.6,2,2.8,0.8,0.8,0.8,2.8,1.4,1.3,2,3.67,-2,-4,1,-1,-1.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,-1,0,-1,-1,-1,-1,1,0,0,0,1,4,0,1,0,0,-1,2,-1,-0.6,-0.2,1.2,0,0.1,C_Ug +310,R_2me4V9FQ08N57m5,46 - 52,American,Female,3,2,2,1,2,0,-3,3,-3,2,2,-3,3,-3,3,2,2,2,2,-1,3,2,2,1,2,0,0,-3,3,-3,2,0,2,-3,3,-3,3,0,2,2,2,2,-1,0,3,2,2,2,2,0,0,-3,3,-3,2,0,2,-3,3,-3,3,0,2,2,2,2,-1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,0,0,0.25,0,1,0,0,0,0,0,0,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,1,1,0.294642857,0.107142857,0.482142857,24,75,22,68.75,6,75,6,75,5,62.5,5,62.5,11,68.75,11,68.75,84.38,68.75,87.5,87.5,93.75,87.5,81.25,6.25,15.63,-6.25,12.5,25,31.25,18.75,12.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0.05,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,1.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.2,0,0,0,-0.05,HS_TS +311,R_731h46kt2EWVDLY,67 - 73,American,Male,-2,2,2,0,3,0,-2,3,-2,1,2,1,3,0,3,1,1,2,1,-2,-1,1,1,-1,2,3,2,-2,3,-1,3,3,3,2,3,2,3,1,-1,0,-1,-1,-2,2,0,2,3,2,1,6,-1,-2,0,-1,-1,3,2,1,2,-1,3,5,2,0,2,1,-2,6,TRUE,0,70,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,50,TRUE,0,70,TRUE,1,95,TRUE,1,80,TRUE,1,86,FALSE,0,90,TRUE,0,75,TRUE,0,91,TRUE,1,90,TRUE,0,80,TRUE,1,75,FALSE,0,80,FALSE,1,95,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,50,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,70,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.04,0.09,0.64,0.0025,0,0.49,0.01,0.81,0,0.25,0,0.01,0.0196,0.5625,0.25,0,0.25,0.25,0,0,0.0625,0.0625,0.25,0.64,0.0025,0.25,0.25,0.49,0.04,1,0.25,0.8281,0.250989286,0.207292857,0.294685714,15,46.88,23,71.88,7,87.5,6,75,4,50,6,75,14,87.5,9,56.25,77.88,67,72.5,81.88,90.12,80.06,75.69,-25,6,-20.5,-2.5,31.88,15.12,-7.44,19.44,1,1,1,1,1,2,0,0,1,2,1,1,0,2,0,2,1,3,2,0,2,0,1,2,2,1,0,3,1,2,0,0,1,1,0,1,1,0,0,0,1,1,0.8,1.6,1.4,1.4,0.4,0.4,1.1,0.9,2.33,4.67,-3,0,-4,-4,-2.34,10 cents,25 minutes,36 days,Male,Trade School (non-military),67,1.25,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,-1,1,0,-1,-1,1,0,-3,0,0,1,1,-1,1,0,1,0,3,2,0,-0.4,-0.4,0.4,1.2,0.2,HS_TS +312,R_7SoYnD9VhiT967v,39 - 45,American,Female,3,3,1,3,2,-2,-3,3,2,1,1,-2,2,2,3,-2,-1,-1,-2,-2,3,1,2,3,3,2,-2,-3,3,1,3,4,2,-2,2,3,3,3,-1,-1,-1,-1,-2,3,3,3,1,3,2,1,-2,-3,3,2,2,1,2,-2,3,2,3,2,-2,-2,-2,-2,-1,2,FALSE,1,96,TRUE,1,85,FALSE,1,100,TRUE,0,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,70,FALSE,0,65,TRUE,0,70,TRUE,0,66,TRUE,1,100,FALSE,1,60,TRUE,1,54,TRUE,1,100,FALSE,1,76,FALSE,1,97,FALSE,1,90,FALSE,1,100,TRUE,1,62,TRUE,1,85,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,100,FALSE,1,100,TRUE,0,83,TRUE,1,100,TRUE,1,84,TRUE,1,100,0,0.0016,0,0,0,0,0,0.4225,0,0.0225,0,0,0.09,0.49,0.16,0.0225,0,0.25,0,0,0.1444,0.2116,0.01,0.16,0.0576,0,0.0256,0.0016,0,0.0009,0.6889,0.4356,0.114060714,0.104107143,0.124014286,28,87.5,27,84.38,6,75,7,87.5,7,87.5,7,87.5,15,93.75,12,75,85.91,75.38,85.12,87.38,95.75,85.06,86.75,3.12,1.53,0.38,-2.38,-0.12,8.25,-8.69,11.75,0,2,1,0,1,0,0,0,1,2,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0.8,0.6,0.4,0.4,0,0.2,0.4,0.6,0.55,0.3,3,1.33,1,3,1,1,1.67,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,43,1.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,2,1,0,1,0,0,0,1,1,0,0,-1,1,0,1,-1,-1,1,-1,0.8,0.4,0,-0.2,0.25,C_Ug +313,R_3h0yvrbnLX57zfm,67 - 73,Canadian,Male,3,3,3,2,3,3,3,3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,-3,3,-2,3,1,3,3,3,3,3,1,3,-2,-3,-3,3,1,3,3,3,3,3,2,3,3,3,3,3,10,3,3,3,3,3,1,1,3,3,2,3,10,FALSE,1,100,TRUE,1,100,FALSE,1,78,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,88,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,97,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,77,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.5929,0,0,0,0,0,0,0,0,0,0,0,0.04,0,0,0,0,0,0,0,0,0.0625,1,0,0,0,0,0.0484,0.0009,1,0.7744,0.104507143,0.002857143,0.206157143,31,96.88,28,87.5,8,100,7,87.5,6,75,7,87.5,15,93.75,13,81.25,96.72,94.38,100,96.75,95.75,98.56,94.88,9.38,9.22,-5.62,12.5,21.75,8.25,4.81,13.63,0,0,0,1,0,0,6,0,3,0,0,1,0,0,0,0,5,6,6,0,0,0,0,1,0,0,0,0,2,0,0,1,0,0,0,2,0,0,1,0,0.2,1.8,0.2,3.4,0.2,0.4,0.2,0.6,1.4,0.35,1,4.33,-1,-9,0,-9,-3.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,6,0,1,0,0,0,0,0,0,-2,5,6,5,0,0,1.4,0,2.8,1.05,C_Ug +314,R_1rV4mMwVSaPgDhP,60 - 66,Canadian,Male,1,1,3,3,0,-3,1,1,3,-2,2,-2,3,-3,-1,-3,-1,0,0,-1,3,1,3,3,-3,0,-3,3,-3,3,-3,8,2,-3,3,-3,-1,5,-2,1,-1,0,-2,5,3,1,3,3,-3,0,-3,1,1,3,-3,0,2,-3,3,-3,-2,0,-1,-1,0,-1,-2,0,TRUE,0,72,TRUE,1,74,TRUE,0,76,TRUE,0,50,TRUE,1,75,FALSE,1,84,TRUE,1,98,TRUE,1,91,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,71,FALSE,0,50,TRUE,1,100,0.0081,0.0001,0,0.0004,0,0.0256,0,0.25,0,0.25,0.0841,0,0.25,0.25,0.0625,0.0676,0,0.25,0.25,0,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,0.5776,0.25,0.25,0.25,0.183867857,0.106414286,0.261321429,16,50,24,75,4,50,7,87.5,6,75,7,87.5,14,87.5,10,62.5,70.78,53,79.25,71.12,79.75,77.06,64.5,-25,-4.22,3,-8.25,-3.88,-7.75,-10.44,2,2,0,0,0,3,0,2,4,0,1,0,1,0,0,0,1,2,1,0,1,2,0,0,0,3,0,0,0,0,1,0,1,0,0,1,2,0,0,1,1,1,1.4,0.2,1,1,0.2,0.4,0.8,0.9,0.6,4.33,0,0,8,5,5,4.33,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,63,1,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,2,4,0,0,0,0,0,0,-1,-1,2,1,-1,0,0,1.2,-0.2,0.2,0.3,C_Ug +315,R_52qO8tcxdz4rbj3,39 - 45,Canadian,Female,3,3,3,-3,0,-2,1,2,-2,0,1,0,0,-3,3,1,3,3,3,1,3,3,3,-3,0,1,-2,1,2,-2,0,1,1,0,-1,-3,3,1,1,3,3,1,0,0,3,3,3,-2,0,1,-2,0,2,-2,0,0,0,0,1,-3,3,2,1,1,1,1,0,2,FALSE,1,100,FALSE,0,77,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,65,FALSE,0,60,FALSE,1,50,TRUE,0,57,FALSE,0,50,TRUE,0,82,TRUE,1,55,TRUE,1,75,FALSE,1,56,FALSE,1,50,TRUE,0,59,FALSE,1,100,FALSE,0,81,TRUE,1,67,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,FALSE,1,84,FALSE,1,92,TRUE,1,85,FALSE,0,50,TRUE,1,100,0,0,0.0625,0.01,0,0,0,0.36,0,0.1089,0.0225,0.25,0.1225,0.25,0,0.5929,0,0.25,0.0256,0,0.6561,0.2025,0.3481,0.6724,0.1936,0.5041,0.25,0,0,0.25,0.0064,0.3249,0.192517857,0.139771429,0.245264286,20,62.5,23,71.88,4,50,6,75,6,75,7,87.5,11,68.75,12,75,78.31,59.62,84.88,81.12,87.62,78.44,78.19,-9.38,6.43,9.62,9.88,6.12,0.12,9.69,3.19,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,2,2,2,1,0,0,0.2,0.6,0.2,0.2,0.4,1.4,0.2,0.55,1,1,0,1,-1,-2,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),45,1.5,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,-1,0,0,-1,0,0,0,-1,0,0,0,0,0,-2,-2,0,0,-0.2,-0.2,-0.2,-0.8,-0.35,grad_prof +316,R_7dgvydr6nSPUpWq,53 - 59,American,Female,3,2,0,-1,-1,0,-1,2,-1,0,3,2,2,0,3,0,1,1,2,-1,3,2,1,-1,-1,1,0,-2,2,-2,0,1,3,2,2,0,3,1,0,1,1,1,-1,2,3,2,0,-1,-1,1,0,-2,2,-1,0,1,3,2,2,0,3,1,0,0,1,1,-1,3,FALSE,1,50,TRUE,1,73,TRUE,0,98,FALSE,1,50,TRUE,1,60,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,0,60,FALSE,1,100,TRUE,1,80,TRUE,1,87,TRUE,0,75,TRUE,1,99,TRUE,0,90,TRUE,1,100,TRUE,0,75,TRUE,0,96,TRUE,0,100,TRUE,1,95,TRUE,1,72,TRUE,1,100,0,0,0,0,0,0.0016,0.0001,0,0,0.0169,0.0025,0,0,0.36,0.16,0.0729,0.5625,0.25,0.9216,0.81,0.04,0.25,0.36,1,0.16,0.5625,0.0784,0.25,0.9604,1,1,0.81,0.343907143,0.101892857,0.585921429,20,62.5,21,65.63,5,62.5,6,75,5,62.5,5,62.5,16,100,5,31.25,84.88,67.5,83.88,90.88,97.25,88.5,81.25,-3.13,19.25,5,8.88,28.38,34.75,-11.5,50,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0.2,0.4,0,0.2,0,0.2,0,0.4,0.2,0.15,1,1,0,0,0,-1,0,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,57,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0.2,0.2,0,-0.2,0.05,C_Ug +317,R_3dcLGFPMgWZ26bY,53 - 59,Canadian,Female,2,2,3,1,2,1,-3,3,0,2,3,2,2,0,3,1,2,3,1,-2,3,2,3,1,0,8,0,-3,3,1,2,5,3,3,2,-1,3,4,-1,-2,-1,-1,-3,1,3,3,3,1,2,2,1,-3,3,-2,1,1,3,2,2,0,3,1,1,1,1,1,2,7,TRUE,0,50,TRUE,1,50,TRUE,0,83,TRUE,0,77,TRUE,1,80,TRUE,0,60,TRUE,1,100,FALSE,0,50,TRUE,1,66,TRUE,1,50,TRUE,0,50,TRUE,0,82,TRUE,1,50,TRUE,0,50,TRUE,1,54,TRUE,1,50,FALSE,1,50,TRUE,0,87,TRUE,0,82,TRUE,0,50,FALSE,0,56,TRUE,1,50,TRUE,0,72,FALSE,0,74,TRUE,0,85,TRUE,1,77,TRUE,0,55,TRUE,0,81,TRUE,0,50,TRUE,1,92,TRUE,1,82,TRUE,1,50,0.25,0.0529,0.25,0,0.25,0.36,0.5476,0.25,0.25,0.25,0.0064,0.25,0.1156,0.25,0.04,0.25,0.5184,0.5929,0.6561,0.7225,0.3136,0.2116,0.6724,0.25,0.25,0.3025,0.0324,0.25,0.6889,0.7569,0.25,0.6724,0.355721429,0.280778571,0.430664286,17,53.13,14,43.75,4,50,4,50,4,50,2,25,13,81.25,1,6.25,65.47,64.5,58.5,68.62,70.25,64.44,66.5,9.38,21.72,14.5,8.5,18.62,45.25,-16.81,60.25,1,0,0,0,2,1,0,0,1,0,0,1,0,1,0,2,4,4,2,1,1,1,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,2,0,4,0.6,0.4,0.4,2.6,0.4,0.6,0,1.4,1,0.6,5.67,1.33,6,4,3,-6,4.34,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),57,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,-1,0,0,2,1,0,0,-1,-1,0,1,0,1,0,2,3,2,2,-3,0.2,-0.2,0.4,1.2,0.4,grad_prof +318,R_5qgj0pp3cfHpCQo,67 - 73,American,Female,2,1,3,-2,-3,-2,-1,3,-3,1,3,-2,3,-2,3,2,2,2,2,0,3,2,2,-2,-3,1,-2,-2,3,-2,2,1,3,-2,2,-2,3,1,2,1,2,2,0,1,2,1,3,-2,-3,1,-2,-2,2,-2,1,1,3,-1,2,-2,3,1,2,2,2,2,0,8,FALSE,1,90,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,90,FALSE,0,50,TRUE,1,100,FALSE,1,85,TRUE,0,90,FALSE,1,95,FALSE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,85,TRUE,0,60,FALSE,1,95,TRUE,0,75,TRUE,1,90,FALSE,0,70,TRUE,1,90,0,0.0225,0,0.0025,0.01,0,0,0,0,0.0025,0.01,1,0,0,0.01,0,0,0.25,0.0025,0.0025,0.25,0.25,0.0025,0.81,0.0225,0.36,0.49,0.01,0.25,0.81,0.5625,0,0.182321429,0.091607143,0.273035714,25,78.13,24,75,5,62.5,5,62.5,6,75,8,100,12,75,12,75,87.19,78.12,86.25,92.5,91.88,88.44,85.94,3.13,12.19,15.62,23.75,17.5,-8.12,13.44,10.94,1,1,1,0,0,0,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0.6,0.6,0.2,0.2,0,0.6,0.4,0,0.4,0.25,1,1,0,0,0,-7,0,10 cents,5 minutes,24 days,Female,University - PhD,68,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,1,1,1,0,0,0,0,-1,0,1,0,-1,0,0,0,0,1,0,0,0,0.6,0,-0.2,0.2,0.15,grad_prof +319,R_7Damdpe88cGpgRz,53 - 59,Canadian,Female,2,3,2,0,2,-3,-3,3,-2,2,3,2,3,-3,2,2,2,2,2,2,2,3,3,2,2,2,-3,-3,3,-3,2,1,3,2,2,-3,3,1,2,1,2,2,2,1,3,3,3,2,3,1,-3,-3,3,-3,3,1,3,2,3,-3,3,1,2,2,2,2,2,1,TRUE,0,97,FALSE,0,100,FALSE,1,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,82,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0025,0,0,0,0,0,1,0,0.0576,1,0.0324,0,0,1,0,0,0,0,0.9409,0,1,0.0196,0.8281,0.210039286,0.075721429,0.344357143,24,75,26,81.25,6,75,8,100,6,75,6,75,15,93.75,11,68.75,97.72,97,98.25,96.75,98.88,99.69,95.75,-6.25,16.47,22,-1.75,21.75,23.88,5.94,27,0,0,1,2,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,2,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0.6,0.2,0.4,0.2,1,0.4,0.2,0,0.35,0.4,1.33,1,1,0,0,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,-1,0,0,0,-1,0,0,0,0,-1,0,0,1,0,0,0,1,0,0,0,-0.4,-0.2,0.2,0.2,-0.05,HS_TS +320,R_7x2lXCwuRgtTlER,53 - 59,Canadian,Female,3,3,3,-1,2,-1,3,3,-2,-1,1,3,3,-3,2,1,1,1,-1,-2,3,2,3,1,2,2,0,3,3,-1,1,4,3,3,3,1,2,3,-2,1,1,1,-3,8,3,2,3,-1,2,2,-2,3,3,-1,-2,5,1,3,3,-3,0,6,0,0,1,1,1,3,TRUE,0,97,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,53,FALSE,1,100,TRUE,1,84,TRUE,1,96,TRUE,1,57,TRUE,1,93,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,0,81,TRUE,1,50,TRUE,1,81,TRUE,0,77,FALSE,1,100,TRUE,0,75,FALSE,1,100,FALSE,0,94,TRUE,1,55,TRUE,0,59,FALSE,0,60,FALSE,1,58,TRUE,1,93,TRUE,0,50,FALSE,1,100,TRUE,0,69,FALSE,0,91,FALSE,0,65,TRUE,1,85,0.0016,0.0049,0.0361,0.0256,0.0225,0,0.36,0.0049,0,0.2025,0.8281,0.0064,0.1849,0,0.2209,0,0.3481,0.25,0,0.1764,0.8836,0.25,0.5625,0.6561,0.5929,0.25,0.4225,0.9409,1,0,0.4761,0,0.308546429,0.17345,0.443642857,10,31.25,19,59.38,4,50,4,50,6,75,5,62.5,12,75,7,43.75,80.16,68.38,78.62,82.62,91,78.06,82.25,-28.13,20.78,18.38,28.62,7.62,28.5,3.06,38.5,0,1,0,2,0,1,0,0,1,2,2,0,0,4,0,3,0,0,2,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,2,1,1,0,2,3,0.6,0.8,1.2,1.2,0.2,0.6,0.4,1.4,0.95,0.65,3,4.33,0,-1,-3,5,-1.33,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,59,0.5,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,2,0,0,0,0,0,1,2,0,0,4,-2,2,-1,0,0,-2,0.4,0.2,0.8,-0.2,0.3,C_Ug +321,R_7dS16cqOTMcqZNc,53 - 59,American,Female,3,2,3,-3,1,-2,1,3,-1,-1,2,-3,2,-3,3,-3,0,1,1,-2,3,2,3,-3,1,0,-3,1,3,1,-3,5,2,-3,2,-3,3,2,-3,-2,-3,-1,-2,7,3,2,2,0,0,5,-2,-1,2,0,0,5,2,-3,2,-3,3,0,-1,0,0,1,-2,3,FALSE,1,100,TRUE,1,82,TRUE,0,100,FALSE,1,50,TRUE,1,79,FALSE,1,100,TRUE,1,50,TRUE,1,69,TRUE,1,50,FALSE,0,87,FALSE,1,50,TRUE,0,98,TRUE,1,67,TRUE,0,100,TRUE,1,50,TRUE,1,72,FALSE,1,50,TRUE,0,72,FALSE,1,50,FALSE,1,71,FALSE,0,100,TRUE,1,50,FALSE,1,96,TRUE,1,80,TRUE,0,50,TRUE,1,91,FALSE,1,50,FALSE,1,50,TRUE,0,53,TRUE,1,61,FALSE,0,50,TRUE,1,91,0.0961,0.0081,0.0784,0.25,0.0081,0,0.04,0.7569,0.0841,0.25,0.1521,0.1089,0.25,0.25,0.0441,0.0324,0.0016,0.25,0.25,0.25,1,0.25,0.25,1,0.25,0.25,0.25,0,1,0.5184,0.2809,0.9604,0.312067857,0.159157143,0.464978571,21,65.63,23,71.88,7,87.5,6,75,4,50,6,75,13,81.25,10,62.5,70.91,54,79.5,75,75.12,70.56,71.25,-6.25,-0.97,-33.5,4.5,25,0.12,-10.69,8.75,0,0,0,0,0,1,0,0,2,2,0,0,0,0,0,0,2,4,2,0,0,0,1,3,1,0,2,1,1,1,0,0,0,0,0,2,0,1,0,0,0,1,0,1.6,1,1,0,0.6,0.65,0.65,2.33,3.33,-5,0,2,4,-1,5 cents,100 minutes,24 days,Female,University - Undergraduate,53,1.5,1,0,0,0,1,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,-1,-3,-1,1,-2,-1,1,1,0,0,0,0,0,-2,2,3,2,0,-1,0,0,1,0,C_Ug +322,R_5INxtYR8BYWS99W,32 - 38,Canadian,Female,-2,1,1,-1,1,0,-1,-1,-1,2,1,2,1,1,1,1,-2,-1,-1,1,2,2,2,-1,2,6,1,0,-1,1,0,5,0,1,-1,-1,1,5,-2,-2,-2,-2,-2,10,0,2,2,2,2,8,0,0,2,0,0,7,2,2,2,2,1,7,0,0,1,1,0,7,TRUE,0,56,FALSE,0,55,FALSE,1,55,FALSE,1,55,TRUE,1,55,FALSE,1,55,TRUE,1,65,TRUE,1,55,FALSE,0,55,TRUE,1,55,TRUE,0,55,TRUE,0,55,TRUE,1,55,FALSE,1,55,FALSE,0,55,TRUE,1,70,FALSE,1,55,TRUE,0,70,TRUE,0,55,FALSE,1,55,TRUE,1,60,FALSE,0,55,FALSE,1,55,FALSE,0,55,TRUE,0,70,FALSE,0,55,FALSE,1,55,TRUE,0,80,TRUE,0,55,TRUE,1,56,FALSE,0,55,FALSE,0,55,0.2025,0.3025,0.09,0.1225,0.3025,0.2025,0.3025,0.2025,0.2025,0.3025,0.1936,0.2025,0.3025,0.3025,0.2025,0.3025,0.2025,0.2025,0.64,0.49,0.16,0.3025,0.3025,0.2025,0.2025,0.2025,0.3025,0.3136,0.2025,0.49,0.3025,0.3025,0.280078571,0.244721429,0.315435714,16,50,16,50,2,25,6,75,3,37.5,5,62.5,8,50,8,50,57.72,55,55.62,60.12,60.12,56.94,58.5,0,7.72,30,-19.38,22.62,-2.38,6.94,8.5,4,1,1,0,1,1,1,0,2,2,1,1,2,2,0,3,0,1,1,3,2,1,1,3,1,0,1,3,1,2,1,0,1,1,0,1,2,2,2,1,1.4,1.2,1.2,1.6,1.6,1.4,0.6,1.6,1.35,1.3,5.33,7.33,-2,-2,-2,3,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,35,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,0,0,-3,0,1,0,-3,1,0,0,1,1,1,0,2,-2,-1,-1,2,-0.2,-0.2,0.6,0,0.05,C_Ug +323,R_5yfj8xtjmhQoJvW,60 - 66,Canadian,Female,2,1,2,1,1,0,-1,2,-1,-1,1,1,2,-1,1,-1,-1,0,-1,-1,2,2,2,1,1,5,0,-1,2,-1,0,5,1,2,2,-1,2,5,-1,-1,-1,0,-1,5,2,1,2,1,0,5,0,0,2,-1,0,5,1,1,1,-1,2,5,0,0,0,0,-1,5,TRUE,0,100,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,91,TRUE,1,100,TRUE,1,50,TRUE,1,82,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,80,TRUE,0,80,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,80,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.04,0.04,0.0081,0,0.25,0,0.0324,0,0.25,0,0.25,0.25,0.25,0.25,0.0081,0,0.25,0,0.0004,0.25,0.25,0.25,0,0.64,0.25,0.25,1,0,0.25,0.25,1,0.220746429,0.127892857,0.3136,25,78.13,23,71.88,4,50,6,75,6,75,7,87.5,14,87.5,9,56.25,75.06,55.12,66.25,81.38,97.5,73.38,76.75,6.25,3.18,5.12,-8.75,6.38,10,-14.12,20.5,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0.2,0.2,0.4,0.4,0.2,0.4,0.4,0.6,0.3,0.4,5,5,0,0,0,0,0,20 cents,75 minutes,36 days,Female,High School (or equivalent),62,0.25,0,0,0,0,0,0,0,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,1,0,0,-1,0,-1,0,0,0,0,1,-1,0,0,-1,-1,1,0,0,0,-0.2,0,-0.2,-0.1,HS_TS +324,R_11QtYtoOyvRCpN0,53 - 59,Canadian,Male,3,0,2,0,2,-3,-1,2,-1,1,2,1,2,-3,2,0,1,2,1,-1,3,1,0,-2,3,4,-3,0,1,-1,1,3,2,-1,2,-3,3,2,-1,1,1,0,-1,3,3,1,2,1,1,3,-3,0,2,0,0,3,2,1,2,-3,2,2,0,-1,0,1,-1,4,TRUE,0,100,FALSE,0,50,TRUE,0,89,TRUE,0,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,70,TRUE,0,91,TRUE,1,90,FALSE,1,90,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,94,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,FALSE,1,74,TRUE,0,84,TRUE,1,100,TRUE,1,100,TRUE,1,96,0,0,0,0,0.0016,0,0,0,0.25,0,0,0.01,0,0.49,0.01,0.25,0,0.25,0.0676,0,0.25,0.25,0.0036,0.01,0.25,0.5041,0,1,0.7921,1,0.7056,0.8281,0.247239286,0.090114286,0.404364286,28,87.5,20,62.5,4,50,5,62.5,6,75,5,62.5,14,87.5,6,37.5,85.59,73.12,82.5,98.75,88,89.12,82.06,25,23.09,23.12,20,23.75,25.5,1.62,44.56,0,1,2,2,1,0,1,1,0,0,0,2,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,2,2,0,0,1.2,0.4,0.6,0.6,0.6,0.6,0,0.8,0.7,0.5,3,2.67,1,0,0,-1,0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,58,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,2,1,0,0,0,1,-1,-1,0,2,0,0,1,1,-2,-1,1,0,0.6,-0.2,0.6,-0.2,0.2,C_Ug +325,R_1FQe71JwkCj1JCd,39 - 45,American,Female,3,-2,0,-1,-3,-3,1,2,0,-3,1,-1,0,-3,0,-2,-2,-1,-2,-3,3,-1,-2,-3,-3,2,-3,0,2,-1,-3,3,1,-3,0,0,-1,2,-1,0,0,0,-1,4,3,-2,-1,0,-3,1,-3,-1,1,0,-3,1,1,-3,0,-3,0,8,-1,0,0,-1,-2,5,TRUE,0,50,TRUE,1,85,TRUE,0,91,FALSE,1,50,TRUE,1,85,FALSE,1,100,TRUE,1,57,TRUE,1,87,FALSE,0,56,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,61,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,52,TRUE,0,63,TRUE,0,50,FALSE,1,50,TRUE,1,62,TRUE,1,54,FALSE,1,65,TRUE,1,76,FALSE,1,58,TRUE,1,71,FALSE,1,50,FALSE,1,96,TRUE,0,50,TRUE,1,81,FALSE,0,50,TRUE,1,89,0.0169,0.0841,0.25,0.1849,0.0121,0,0.0576,0.1225,0.25,0.2116,0.0361,0.1521,0.3136,0.25,0.0225,0.0225,0.1225,0.25,0.0016,0.1764,0.1444,0.25,0.25,0.25,0.2304,0.25,0.25,0.25,0.8281,0.3969,0.25,0.25,0.200032143,0.130221429,0.269842857,16,50,23,71.88,4,50,7,87.5,5,62.5,7,87.5,13,81.25,10,62.5,64.19,55.12,70.5,58.5,72.62,67.44,60.94,-21.88,-7.69,5.12,-17,-4,-14.88,-13.81,-1.56,0,1,2,2,0,0,1,0,1,0,0,2,0,3,1,1,2,1,2,2,0,0,1,1,0,0,2,1,0,0,0,2,0,0,0,1,2,1,1,1,1,0.4,1.2,1.6,0.4,0.6,0.4,1.2,1.05,0.65,2.33,3.33,1,2,-6,-1,-1,5 cents,5 minutes,47 days,Female,High School (or equivalent),42,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,1,1,1,0,0,-1,-1,1,0,0,0,0,3,1,0,0,0,1,1,0.6,-0.2,0.8,0.4,0.4,HS_TS +326,R_1KGAKS6dO4f3c4e,53 - 59,Canadian,Male,2,3,1,1,1,-2,-2,2,-2,1,3,-3,3,-3,3,-2,-2,-1,-2,-2,2,3,2,1,2,1,-3,1,2,1,-1,5,2,1,3,0,1,7,-3,-2,-2,-2,-2,1,2,3,2,2,0,2,-3,-3,2,-3,1,0,3,-3,3,-3,3,0,0,0,0,0,0,0,TRUE,0,50,TRUE,1,60,TRUE,0,90,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,60,TRUE,1,80,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,85,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,85,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,75,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,100,TRUE,0,65,TRUE,1,100,FALSE,0,50,TRUE,1,60,0.04,0.25,0,0.16,0.16,0.25,0.0625,0,0,0,0,0.0225,0.25,0.25,0.25,0.16,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.7225,0.4225,1,0.245,0.136071429,0.353928571,16,50,20,62.5,4,50,4,50,6,75,6,75,13,81.25,7,43.75,69.06,51.25,57.5,74.38,93.12,70,68.12,-12.5,6.56,1.25,7.5,-0.62,18.12,-11.25,24.37,0,0,1,0,1,1,3,0,3,2,1,4,0,3,2,1,0,1,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,2,2,1,2,2,0.4,1.8,2,0.4,0.6,0.6,0,1.8,1.15,0.75,4.33,0.67,-1,5,7,1,3.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,57,1.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-1,0,0,2,0,2,2,1,4,0,3,2,-1,-2,0,-2,-2,-0.2,1.2,2,-1.4,0.4,C_Ug +327,R_6c2i1T1GCjpPNC2,53 - 59,American,Male,2,3,2,2,2,0,0,1,1,1,1,-2,3,-2,3,2,2,2,2,1,3,2,3,1,2,2,-1,0,0,1,1,3,0,-2,2,-2,3,2,2,2,2,2,1,2,2,2,2,2,2,2,1,1,1,1,2,3,2,-2,2,2,2,2,2,2,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,1,88,TRUE,0,100,TRUE,1,95,TRUE,1,97,FALSE,1,100,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,100,FALSE,0,68,TRUE,0,95,TRUE,0,91,TRUE,0,86,TRUE,1,100,FALSE,0,74,TRUE,1,100,0,0.4624,0.0009,0,0,0,0.0025,0,0,0,0,0.0144,0,0,0,0,0,0.0676,0.8281,0,0,0.0025,0.0081,1,0,0.9025,0.5476,0,1,1,0.7396,0.7396,0.244732143,0.006035714,0.483428571,30,93.75,23,71.88,6,75,7,87.5,5,62.5,5,62.5,14,87.5,9,56.25,95,91.12,96.75,96,96.12,94.81,95.19,21.87,23.12,16.12,9.25,33.5,33.62,7.31,38.94,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,4,1,0,0,0,0,1,0.8,0.4,0.4,0,0.2,0.6,1.4,0.2,0.4,0.6,2.33,2.33,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,55,1.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,01DIR,1,0,1,1,0,0,-1,1,0,-1,0,0,0,-4,-1,0,0,0,0,-1,0.6,-0.2,-1,-0.2,-0.2,C_Ug +328,R_3e2fo9qBxt2z05U,25 - 31,Canadian,Male,3,3,2,3,1,-1,3,3,-1,-1,1,1,3,3,2,1,0,-1,3,0,1,3,3,2,2,10,1,3,2,-1,0,10,1,0,3,2,1,8,1,3,1,-1,3,7,2,2,3,2,2,6,3,2,2,1,3,8,-2,1,1,0,3,7,2,-1,1,3,-1,8,FALSE,1,64,FALSE,0,65,FALSE,1,65,FALSE,1,60,FALSE,0,59,FALSE,1,65,TRUE,1,64,FALSE,0,65,FALSE,0,65,FALSE,0,57,FALSE,1,77,TRUE,0,63,FALSE,0,65,FALSE,1,70,FALSE,0,67,TRUE,1,59,TRUE,0,66,TRUE,0,77,FALSE,1,67,TRUE,0,64,FALSE,0,65,FALSE,0,59,FALSE,1,67,FALSE,0,59,FALSE,1,72,TRUE,1,62,TRUE,0,63,FALSE,1,57,TRUE,0,67,TRUE,1,83,FALSE,0,52,TRUE,1,70,0.4225,0.1444,0.1681,0.1296,0.09,0.1225,0.3481,0.3249,0.4096,0.3481,0.0289,0.4225,0.4225,0.0529,0.3481,0.4225,0.1089,0.16,0.1849,0.0784,0.4225,0.4489,0.1089,0.09,0.4356,0.3969,0.2704,0.1296,0.1225,0.5929,0.4489,0.3969,0.276314286,0.257821429,0.294807143,12,37.5,15,46.88,3,37.5,3,37.5,5,62.5,4,50,5,31.25,10,62.5,65,64.5,65.5,65.62,64.38,63.5,66.5,-9.38,18.12,27,28,3.12,14.38,32.25,4,2,0,1,1,1,2,0,1,0,1,0,1,0,1,1,0,3,2,4,3,1,1,1,1,1,4,1,1,2,4,3,0,2,3,1,1,1,2,0,1,1,0.8,0.6,2.4,1,2.4,1.8,1,1.2,1.55,9.33,7,4,2,1,-1,2.33,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,30,0.375,0,1,0,1,0,0,0.33,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,-1,0,0,0,-2,-1,0,-2,-3,-3,1,-2,-2,0,-1,2,0,4,2,0,-1.6,-1.2,1.4,-0.35,C_Ug +329,R_6P5ndp1vUxA8rGX,67 - 73,Canadian,Male,-1,2,2,2,2,0,-2,2,-2,0,2,2,3,1,2,0,0,1,1,-1,-1,2,2,2,2,1,-1,-2,2,-1,0,3,1,1,2,0,1,3,1,1,2,2,1,2,-1,2,2,2,2,2,0,-1,1,-2,0,3,2,2,2,1,2,2,1,0,1,1,0,3,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,95,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.9025,0,0,0,0,0,0.01,1,0.0025,1,0,0,0,1,0,0.9025,1,0,1,0,1,0.279196429,0.065178571,0.493214286,28,87.5,24,75,7,87.5,5,62.5,6,75,6,75,13,81.25,11,68.75,99.22,98.12,99.38,99.38,100,99.38,99.06,12.5,24.22,10.62,36.88,24.38,25,18.13,30.31,0,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1,1,1,1,2,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0.4,1,1.2,0,0.4,0.2,0.4,0.65,0.25,2.33,2.33,-1,0,1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),69,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,1,0,1,1,0,1,1,0,1,1,1,1,0,0,0.8,0.8,0.4,HS_TS +330,R_138QJj22J0zRWVj,67 - 73,Canadian,Male,1,2,1,1,1,1,1,0,0,2,1,-1,3,-1,3,0,0,1,1,-1,2,2,2,1,1,2,2,1,1,-2,2,1,1,-2,2,-1,3,1,0,-1,1,1,-1,6,2,2,2,2,0,6,1,0,-1,0,2,1,1,-1,2,-2,3,1,-1,-2,0,0,-2,6,TRUE,0,86,TRUE,1,70,TRUE,0,66,FALSE,1,54,TRUE,1,59,FALSE,1,100,TRUE,1,78,TRUE,1,100,TRUE,1,53,TRUE,1,71,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,64,TRUE,0,100,TRUE,0,63,FALSE,1,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,64,TRUE,1,100,FALSE,1,54,FALSE,1,100,TRUE,0,100,FALSE,0,58,TRUE,1,100,TRUE,1,100,0,0,0,0.0484,0,0,0,0.0841,0,0,0.3364,0,0.2209,0,0.1681,0.09,0,0.2116,0,0.1296,0.3249,0.2304,0.3969,0,0.1296,0.2116,0,0.7396,0.4356,1,1,1,0.239617857,0.079364286,0.399871429,23,71.88,24,75,7,87.5,6,75,6,75,5,62.5,14,87.5,10,62.5,82.78,68.25,85,87.38,90.5,81.12,84.44,-3.12,7.78,-19.25,10,12.38,28,-6.38,21.94,1,0,1,0,0,1,0,1,2,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0,1,1,0,1,2,1,1,1,0.4,0.8,0.4,0.2,0.8,0.4,0.4,1.2,0.45,0.7,1.33,2.67,-4,0,0,0,-1.34,10 cents,25 minutes,24 days,Male,High School (or equivalent),71,1.375,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,-1,-1,1,-1,0,2,0,0,1,0,-1,0,-1,-1,-1,-1,-1,-0.4,0.4,0,-1,-0.25,HS_TS +331,R_1Cr08YEudxQc7a9,32 - 38,Canadian,Female,2,1,2,1,0,-1,-2,2,2,0,3,1,1,2,1,2,3,2,2,3,3,3,-2,3,3,6,3,1,1,-3,3,5,3,0,1,-1,2,2,3,0,2,0,1,5,3,3,-2,3,3,4,-3,-3,0,0,-1,5,3,1,1,-2,2,4,3,1,2,1,0,7,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,64,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,85,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0.0225,0,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.4096,0.25,0.25,0.25,0.25,1,1,0.25,1,0.327932143,0.23375,0.422114286,3,9.38,15,46.88,3,37.5,4,50,3,37.5,5,62.5,5,31.25,10,62.5,62.47,50,62.5,64.25,73.12,61.56,63.38,-37.5,15.59,12.5,12.5,26.75,10.62,30.31,0.88,1,2,4,2,3,4,3,1,5,3,0,1,0,3,1,1,3,0,2,2,1,2,4,2,3,2,1,2,2,1,0,0,0,4,1,1,2,0,1,3,2.4,3.2,1,1.6,2.4,1.6,1,1.4,2.05,1.6,4.33,4.33,2,0,-2,-2,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),33,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,2,2,-1,3,2,0,1,0,-1,0,0,1,0,1,-1,0,1.6,0,0.2,0.45,grad_prof +332,R_1s6gTd5jGExqCag,39 - 45,Canadian,Female,2,2,2,2,2,0,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,8,1,1,1,1,1,8,2,2,2,2,2,10,0,0,1,-1,1,10,1,1,1,1,1,10,2,2,2,2,2,10,TRUE,0,79,TRUE,1,87,TRUE,0,76,TRUE,0,84,TRUE,1,72,TRUE,0,73,TRUE,1,80,TRUE,1,75,TRUE,1,88,TRUE,1,90,TRUE,0,81,TRUE,0,64,TRUE,1,85,TRUE,0,85,TRUE,1,79,TRUE,1,75,TRUE,0,79,TRUE,0,95,TRUE,0,65,TRUE,0,82,TRUE,1,81,TRUE,1,83,TRUE,0,79,TRUE,1,76,TRUE,0,79,TRUE,1,75,TRUE,0,81,TRUE,0,77,TRUE,0,84,TRUE,1,88,TRUE,1,78,TRUE,1,67,0.0625,0.0625,0.0625,0.04,0.1089,0.5329,0.0576,0.01,0.6724,0.0289,0.0144,0.0225,0.0144,0.6561,0.0784,0.0169,0.6241,0.7056,0.5929,0.6241,0.0361,0.0441,0.4225,0.7225,0.6241,0.6561,0.0484,0.6241,0.5776,0.9025,0.7056,0.4096,0.376189286,0.253078571,0.4993,16,50,16,50,4,50,4,50,4,50,4,50,16,100,0,0,79.44,80.38,77.5,83.25,76.62,79.94,78.94,0,29.44,30.38,27.5,33.25,26.62,-20.06,78.94,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0.8,0,1,0,1,1,0,0.45,0.5,8.67,10,-1,-1,-2,-2,-1.33,10 cents,25 minutes,24 days,Female,Trade School (non-military),40,0.125,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,2,-2,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,0,-0.2,-1,1,-0.05,HS_TS +333,R_3GcvCyzqWXpEvn0,46 - 52,Canadian,Male,3,3,2,3,2,3,-2,3,-3,3,3,3,2,2,3,-1,-2,-1,-1,-3,3,3,3,3,3,7,3,-3,3,-3,2,6,3,3,2,3,3,9,3,3,3,3,3,10,3,3,3,3,3,10,2,-1,2,2,-1,10,3,3,3,3,3,4,-2,-2,-2,-2,-3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,96,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,66,TRUE,0,100,TRUE,0,94,TRUE,1,96,TRUE,1,76,TRUE,1,100,0,0.0025,0,0,0,0,0,0,1,0,0.0016,1,0,0.01,0,0,0.0004,0.9216,1,0,0,0.0225,0,0,0,0.1156,0.0576,0,1,0,0.8836,1,0.250460714,0.209542857,0.291378571,28,87.5,25,78.13,7,87.5,6,75,8,100,4,50,15,93.75,10,62.5,96.75,89.12,99,99.38,99.5,97,96.5,9.37,18.62,1.62,24,-0.62,49.5,3.25,34,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,4,5,4,4,6,0,0,1,0,1,1,1,1,5,4,0,0,1,1,0,1,0,1,1,0,0.4,0.4,0.2,4.6,0.4,2.4,0.4,0.6,1.4,0.95,7.33,8,-3,-4,5,0,-0.67,10 cents,100 minutes,24 days,Male,University - PhD,48,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,-1,0,-1,-5,-3,0,0,-1,0,0,3,5,3,3,6,0,-2,-0.2,4,0.45,grad_prof +334,R_7PzgbNGfqCYPx9p,53 - 59,Canadian,Female,3,3,3,3,3,-3,-1,2,3,-1,2,1,1,-3,3,1,2,1,2,1,3,3,3,3,3,5,-3,-1,2,3,-1,0,2,1,1,-3,3,1,1,2,1,1,1,3,3,3,3,3,3,1,-3,-1,2,3,-1,0,2,1,1,-3,3,1,1,2,1,2,1,0,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,1,70,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,85,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,78,FALSE,0,89,TRUE,1,85,0,0.0225,0,0,0.0225,0,0,0,0,0,0.0484,0.0625,0.25,0.25,0,0,0,0.25,0,0.5625,0.25,0.25,0.25,0.09,0.25,0.25,0.7921,0,0,0.25,1,0.25,0.181357143,0.0631,0.299614286,16,50,26,81.25,5,62.5,6,75,7,87.5,8,100,14,87.5,12,75,79.91,61.12,82.5,85,91,85.12,74.69,-31.25,-1.34,-1.38,7.5,-2.5,-9,-2.38,-0.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0.05,0,2,0.67,4,0,0,3,1.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,57,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0.2,0.05,C_Ug +335,R_3hEDoZrChL2qwgr,53 - 59,American,Female,0,2,1,2,3,-3,-2,2,-1,1,1,2,1,1,0,2,2,2,2,2,-2,2,1,2,3,1,-2,-2,2,-2,2,0,2,2,2,2,2,1,2,2,2,2,2,0,-2,1,1,2,2,1,-2,-2,3,-2,0,0,2,2,2,2,2,1,2,2,2,2,2,0,TRUE,0,100,TRUE,1,81,TRUE,0,91,FALSE,1,52,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,87,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,80,FALSE,1,54,FALSE,1,60,TRUE,1,74,FALSE,0,50,FALSE,1,50,TRUE,1,89,TRUE,0,85,TRUE,1,97,FALSE,1,59,FALSE,1,50,TRUE,0,54,TRUE,1,97,FALSE,0,82,TRUE,1,87,0,0.0009,0,0,0.0169,0.01,0.0121,0.7569,0.16,0.25,0.0009,0,0.25,0.25,0,0.0361,0.25,0.2304,0.25,0.7225,0.0676,0.25,0.2116,1,0.25,0.1681,0.6724,1,0.8281,0.64,0.2916,1,0.341971429,0.158807143,0.525135714,24,75,20,62.5,5,62.5,7,87.5,2,25,6,75,11,68.75,9,56.25,77.16,59.75,75.62,87.38,85.88,84,70.31,12.5,14.66,-2.75,-11.88,62.38,10.88,15.25,14.06,2,0,0,0,0,1,0,0,1,1,1,0,1,1,2,0,0,0,0,0,2,1,0,0,1,1,0,1,1,1,1,0,1,1,2,0,0,0,0,0,0.4,0.6,1,0,0.8,0.8,1,0,0.5,0.65,0.67,0.67,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,54,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,-1,0,0,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-0.4,-0.2,0,0,-0.15,C_Ug +336,R_6JsgvtLboY690D4,53 - 59,Canadian,Female,2,2,3,2,-2,-1,-2,3,-2,1,2,-2,2,-2,3,-3,-2,-2,-2,-3,2,2,3,2,-2,3,1,-2,3,-2,2,4,2,-2,2,1,3,4,-1,1,1,2,-2,7,2,2,3,2,-2,2,-2,1,3,-2,-2,2,2,-2,2,-3,3,6,2,1,2,2,-2,7,TRUE,0,86,TRUE,1,62,TRUE,0,91,FALSE,1,56,FALSE,0,53,FALSE,1,56,TRUE,1,76,TRUE,1,72,TRUE,1,51,TRUE,1,87,TRUE,0,52,TRUE,0,90,TRUE,1,59,TRUE,0,51,FALSE,0,51,TRUE,1,73,FALSE,1,51,TRUE,0,91,FALSE,1,52,FALSE,1,93,TRUE,1,58,FALSE,0,51,FALSE,1,53,TRUE,1,59,FALSE,1,67,TRUE,1,91,FALSE,1,52,FALSE,1,53,TRUE,0,61,FALSE,0,82,TRUE,1,89,TRUE,1,96,0.0784,0.0081,0.0729,0.0576,0.0016,0.1936,0.1681,0.0169,0.0049,0.2601,0.6724,0.1681,0.2401,0.2704,0.2809,0.1444,0.2209,0.1936,0.2209,0.1089,0.1764,0.2601,0.2304,0.2601,0.2401,0.2304,0.0121,0.7396,0.8281,0.8281,0.3721,0.81,0.291189286,0.202571429,0.379807143,8,25,21,65.63,6,75,6,75,4,50,5,62.5,12,75,9,56.25,67.66,58.12,60.88,75,76.62,69.38,65.94,-40.63,2.03,-16.88,-14.12,25,14.12,-5.62,9.69,0,0,0,0,0,2,0,0,0,1,0,0,0,3,0,2,3,3,4,1,0,0,0,0,0,1,3,0,0,3,0,0,0,1,0,5,3,4,4,1,0,0.6,0.6,2.6,0,1.4,0.2,3.4,0.95,1.25,3.67,3.33,1,2,-2,0,0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,1,-3,0,0,-2,0,0,0,2,0,-3,0,-1,0,0,0,-0.8,0.4,-0.8,-0.3,C_Ug +337,R_11XxjRTPru0bWxt,60 - 66,American,Male,-2,2,3,0,1,-2,1,-2,1,-2,0,1,2,0,1,-3,-3,-3,-3,-3,1,2,2,0,1,9,-1,1,1,1,0,8,0,1,2,1,0,10,-2,-1,-2,-2,-1,10,0,0,0,0,0,10,-3,-3,-3,-3,-3,10,0,0,0,0,0,5,1,1,1,-3,-3,10,TRUE,0,50,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,80,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,70,TRUE,0,91,TRUE,0,91,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,76,TRUE,1,100,TRUE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,60,TRUE,0,80,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.04,0.0576,0.09,0,0,0.25,0,0,0.25,0,0,0,0.25,0.25,0.25,0.25,0.5776,0.25,0.36,0.25,0.25,0.25,0.25,0.25,0.8281,0.25,0.0625,0.25,1,0.8281,0.64,1,0.314153571,0.166257143,0.46205,25,78.13,19,59.38,4,50,5,62.5,5,62.5,5,62.5,16,100,3,18.75,71.84,53.12,74.62,77.12,82.5,78.19,65.5,18.75,12.46,3.12,12.12,14.62,20,-21.81,46.75,3,0,1,0,0,1,0,3,0,2,0,0,0,1,1,1,2,1,1,2,2,2,3,0,1,1,4,1,4,1,0,1,2,0,1,4,4,4,0,0,0.8,1.2,0.4,1.4,1.6,2.2,0.8,2.4,0.95,1.75,9,8.33,-1,-2,5,0,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),61,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,1,-2,-2,0,-1,0,-4,2,-4,1,0,-1,-2,1,0,-3,-2,-3,1,2,-0.8,-1,-0.4,-1,-0.8,HS_TS +338,R_6DTwiYnZ5g4Op84,46 - 52,Canadian,Female,3,3,3,1,3,-2,-2,3,-1,1,2,0,2,2,1,-3,-2,0,-3,-3,3,3,3,-2,3,1,-2,-2,3,0,2,1,2,0,2,2,1,1,-2,-2,0,-3,-3,3,3,2,3,2,2,1,-2,-1,2,0,2,1,2,0,2,2,1,1,-3,-3,-3,-3,-3,1,FALSE,1,100,TRUE,1,100,FALSE,1,95,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,99,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,96,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,0,100,TRUE,1,100,FALSE,0,86,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0001,0,0,0,0.0009,0.1444,0,0,0.9216,0,0,0,0,0.7396,0,0.0025,0,1,1,0.136039286,0.0000714,0.272007143,31,96.88,28,87.5,6,75,7,87.5,8,100,7,87.5,14,87.5,14,87.5,97.97,97.25,100,100,94.62,98.88,97.06,9.38,10.47,22.25,12.5,0,7.12,11.38,9.56,0,0,0,3,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,3,0,0,0.6,0.4,0,0.2,0.6,0.8,0,0.8,0.3,0.55,1,1,0,0,0,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,-1,0,2,-1,0,-1,-1,0,0,0,0,0,0,0,1,-1,-3,0,0,0,-0.4,0,-0.6,-0.25,C_Ug +339,R_5jfujassAQJlmEo,46 - 52,American,Female,2,3,3,3,3,0,-3,-2,0,3,-2,-3,3,-3,3,0,1,1,-1,-3,2,3,3,3,3,7,1,1,-3,0,3,7,-3,-2,1,2,1,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,4,-1,-3,-3,-2,3,3,-3,-3,3,-3,3,0,2,2,2,2,0,10,FALSE,1,100,TRUE,1,74,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,0,91,TRUE,1,100,TRUE,1,76,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,0,60,FALSE,1,84,FALSE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,98,FALSE,0,75,TRUE,1,100,0,0,0,0.8281,0,0,0,1,0.0256,0.0036,0.0004,0,0.0576,0,0,0.0676,0,0.25,0,0,1,0.25,0.36,0,0,0.25,0.5625,0,0,0.25,1,1,0.217046429,0.100342857,0.33375,25,78.13,23,71.88,5,62.5,6,75,5,62.5,7,87.5,12,75,11,68.75,89.12,66.88,100,91.88,97.75,91.12,87.12,6.25,17.24,4.38,25,29.38,10.25,16.12,18.37,0,0,0,0,0,1,4,1,0,0,1,1,2,5,2,3,4,4,2,0,1,0,0,0,0,1,0,1,2,0,1,0,0,0,0,2,1,1,3,3,0,1.2,2.2,2.6,0.2,0.8,0.2,2,1.5,0.8,8,2.33,3,4,10,0,5.67,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,46,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,0,0,0,0,0,4,0,-2,0,0,1,2,5,2,1,3,3,-1,-3,-0.2,0.4,2,0.6,0.7,C_Ug +340,R_7etxJyVTqqJqk6d,53 - 59,American,Male,1,2,2,2,1,-1,-2,2,-2,1,1,2,2,0,2,0,1,2,-1,1,0,2,2,0,2,5,-2,-2,2,-2,2,3,2,2,2,2,2,1,0,0,0,0,-1,5,-1,2,2,3,0,2,-1,0,1,-2,0,5,2,2,2,0,2,1,0,0,0,0,-1,5,FALSE,1,97,TRUE,1,94,TRUE,0,99,FALSE,1,50,FALSE,0,50,FALSE,1,85,TRUE,1,100,TRUE,1,97,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,99,TRUE,0,98,FALSE,1,100,FALSE,0,50,TRUE,1,98,TRUE,0,100,TRUE,1,76,TRUE,0,73,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,59,TRUE,1,100,FALSE,0,50,TRUE,1,75,0.0009,0,0,0,0.0625,0.0225,0.0576,0,0,0.0004,0,0,0.0081,0,0.25,0.0036,1,0.25,0,0.5329,0.25,0.25,0.9604,1,0.25,0.25,0.25,0.0009,0.9801,0.9801,0.3481,0.81,0.304185714,0.118192857,0.490178571,22,68.75,21,65.63,6,75,4,50,5,62.5,6,75,13,81.25,8,50,83.78,72.88,71.12,95.88,95.25,83.19,84.38,3.12,18.15,-2.12,21.12,33.38,20.25,1.94,34.38,1,0,0,2,1,1,0,0,0,1,1,0,0,2,0,0,1,2,1,2,2,0,0,1,1,0,2,1,0,1,1,0,0,0,0,0,1,2,1,2,0.8,0.4,0.6,1.2,0.8,0.8,0.2,1.2,0.75,0.75,3,2.67,3,-2,0,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,58,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,0,0,1,0,1,-2,-1,0,0,0,0,0,2,0,0,0,0,0,0,0,-0.4,0.4,0,0,C_Ug +341,R_77D4w3eu85U5Wqu,60 - 66,Canadian,Female,0,2,2,2,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,0,0,0,0,2,6,0,0,0,0,0,5,1,1,1,1,1,6,1,1,1,1,1,5,0,0,0,0,0,7,0,0,0,0,0,5,0,1,0,1,1,6,2,2,2,2,2,6,TRUE,0,98,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,67,TRUE,1,62,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,53,TRUE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,53,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,52,FALSE,0,61,FALSE,1,75,FALSE,1,66,FALSE,1,64,TRUE,1,76,TRUE,1,50,FALSE,0,50,0.25,0.3721,0.25,0.25,0.25,0.25,0.25,0.25,0.2209,0.25,0.0576,0.1444,0.25,0.25,0.25,0.25,0.25,0.25,0.1156,0.2304,0.2209,0.25,0.2209,0.25,0.2209,0.0625,0.25,0.9604,0.25,0.2809,0.1296,0.4489,0.252282143,0.226635714,0.277928571,15,46.88,15,46.88,5,62.5,5,62.5,1,12.5,4,50,4,25,11,68.75,55.81,53.5,54,58,57.75,53.25,58.38,0,8.93,-9,-8.5,45.5,7.75,28.25,-10.37,0,2,2,2,0,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,0,2,2,2,2,1,1,1,2,1,1,0,1,0,1,1,1,1,1,1,1.2,1.2,0.2,0,1.6,1.2,0.6,1,0.65,1.1,5.67,6,-1,0,0,-1,-0.33,5 cents,5 minutes,24 days,Female,High School (or equivalent),63,0.25,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,-2,0,0,0,0,0,-1,0,-1,0,0,-1,-1,-1,-1,-1,-0.4,0,-0.4,-1,-0.45,HS_TS +342,R_10Hwl0ASEOovzbj,53 - 59,Canadian,Male,3,3,2,1,-1,-3,0,2,0,1,2,-2,3,3,2,-3,-3,-3,-3,-3,3,3,1,1,-1,5,-3,1,2,2,2,3,2,-2,3,2,-1,8,-3,-3,-3,-3,-3,6,3,3,0,2,0,5,-3,-2,2,-1,0,3,3,-2,3,3,2,5,-2,-2,-2,-2,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,90,TRUE,1,100,FALSE,1,100,FALSE,0,80,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,90,TRUE,0,50,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,FALSE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,90,0.01,0.09,0,0,0.01,0.36,0,0,0.25,0,0,0,0,0.25,0,0,0,0.25,0.25,0,0.04,0.64,0.81,0,1,0,0.25,0,0.81,1,1,0.81,0.276071429,0.08,0.472142857,28,87.5,23,71.88,6,75,5,62.5,7,87.5,5,62.5,15,93.75,8,50,87.19,77.5,91.25,96.25,83.75,91.25,83.12,15.62,15.31,2.5,28.75,8.75,21.25,-2.5,33.12,0,0,1,0,0,0,1,0,2,1,0,0,0,1,3,0,0,0,0,0,0,0,2,1,1,0,2,0,1,1,1,0,0,0,0,1,1,1,1,0,0.2,0.8,0.8,0,0.8,0.8,0.2,0.8,0.45,0.65,5.33,4.33,0,0,3,1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,56,2,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,-1,-1,-1,0,-1,0,1,0,-1,0,0,1,3,-1,-1,-1,-1,0,-0.6,0,0.6,-0.8,-0.2,C_Ug +343,R_51WXEtmjXUZBgzu,60 - 66,Canadian,Female,3,3,2,1,2,1,-2,2,-1,3,3,0,2,-1,3,2,1,2,3,3,3,3,2,1,3,2,3,-1,2,-1,2,2,3,1,2,0,3,2,3,2,3,2,2,2,3,3,0,2,2,2,3,-2,3,-1,2,2,3,0,2,-1,3,2,3,2,3,3,3,2,TRUE,0,63,TRUE,1,81,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,1,96,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,90,TRUE,0,90,FALSE,1,100,FALSE,0,100,FALSE,0,50,TRUE,0,52,TRUE,1,88,TRUE,0,90,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,70,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0,0.0144,0,0,0.25,0,0.0016,0.25,0.25,0.25,0.0361,0.2704,0.25,0,0.81,1,0.25,0.81,0,0.25,0.25,0.09,0.3969,0,0.01,0.49,0.25,0.220692857,0.112321429,0.329064286,17,53.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,79.38,61.38,77.25,86.62,92.25,83.44,75.31,-18.75,7.5,-13.62,14.75,24.12,4.75,2.19,12.81,0,0,0,0,1,2,1,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,2,1,0,2,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0.2,0.8,0.4,1,0.6,0.8,0,0.6,0.6,0.5,2,2,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,1.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,-2,-1,1,0,1,-1,0,0,0,1,0,1,0,0,0,0,1,1,-0.4,0,0.4,0.4,0.1,HS_TS +344,R_7MFjmjTfEMufNe2,46 - 52,Canadian,Female,3,1,1,2,2,-3,0,2,-1,1,1,-3,3,-2,2,-3,-2,-2,-2,-1,3,2,2,1,2,0,-3,-2,2,-2,2,2,2,-3,3,-3,2,2,-2,-2,-2,-2,-2,2,3,2,2,2,1,9,-3,1,1,1,0,4,3,-3,3,-2,2,1,-3,-3,-2,-3,-2,3,FALSE,1,84,TRUE,1,90,FALSE,1,72,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,82,TRUE,1,92,TRUE,1,68,FALSE,0,55,FALSE,1,64,FALSE,1,86,FALSE,0,50,TRUE,0,83,FALSE,0,50,TRUE,1,87,FALSE,1,70,TRUE,0,66,TRUE,0,71,TRUE,0,50,TRUE,1,62,TRUE,1,96,FALSE,1,97,TRUE,1,68,FALSE,1,100,FALSE,0,50,TRUE,0,50,FALSE,1,83,FALSE,1,68,TRUE,1,63,TRUE,1,50,TRUE,1,75,0.0064,0.25,0.0169,0.0324,0.0625,0.25,0.1024,0.3025,0.25,0.0016,0.1369,0.25,0.1024,0.1296,0,0.01,0.0009,0.25,0.0289,0,0.1444,0.25,0.5041,0.6889,0.09,0.25,0.25,0.0256,0.0784,0.4356,0.1024,0.0196,0.168453571,0.132057143,0.20485,20,62.5,23,71.88,5,62.5,7,87.5,4,50,7,87.5,12,75,11,68.75,71.31,61.62,71.5,77,75.12,71.12,71.5,-9.38,-0.57,-0.88,-16,27,-12.38,-3.88,2.75,0,1,1,1,0,0,2,0,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,0,1,1,2,1,2,0,0,0,0,0,1,0,1,1,0.6,0.8,0.4,0.4,0.6,1,0.4,0.6,0.55,0.65,1.33,4.67,-9,-2,1,-1,-3.34,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),48,1.5,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,1,-1,0,1,-1,-1,0,-1,0,0,1,0,1,-1,0,-1,0,0,-0.2,0,-0.2,-0.1,grad_prof +345,R_7g13iJm8PT5Lh2e,53 - 59,American,Female,2,2,1,-1,1,1,2,3,3,-1,1,1,3,2,1,-3,-1,-3,1,-3,3,3,2,1,3,7,1,1,3,1,1,7,-1,1,3,-2,1,8,-2,-2,-2,0,-2,6,3,2,3,2,0,6,1,-2,0,-1,1,6,1,3,3,2,1,5,0,1,1,2,-2,5,TRUE,0,90,FALSE,0,54,TRUE,0,87,FALSE,1,56,FALSE,0,50,FALSE,1,50,TRUE,1,96,TRUE,1,100,FALSE,0,54,TRUE,1,100,FALSE,1,53,TRUE,0,94,FALSE,0,54,TRUE,0,75,FALSE,0,63,FALSE,0,98,TRUE,0,76,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,72,FALSE,1,50,FALSE,0,50,TRUE,0,70,FALSE,0,65,FALSE,1,50,TRUE,0,94,TRUE,0,50,TRUE,1,91,FALSE,0,60,TRUE,1,100,0,0.4225,0.9604,0.0016,0,0.25,0.25,0,0.25,0.0784,0.0081,0.2916,0.2916,0.2209,0.25,0.2916,0.25,0.1936,0.8836,0.49,0.25,0.3969,0.25,0.5625,0.5776,0.25,0.36,0.81,0.7569,1,0.25,0.8836,0.369532143,0.187557143,0.551507143,16,50,14,43.75,4,50,4,50,3,37.5,3,37.5,7,43.75,7,43.75,70.38,55,60,83.5,83,72.31,68.44,6.25,26.63,5,10,46,45.5,28.56,24.69,1,1,1,2,2,0,1,0,2,2,2,0,0,4,0,1,1,1,1,1,1,0,2,3,1,0,4,3,4,2,0,2,0,0,0,3,2,4,1,1,1.4,1,1.2,1,1.4,2.6,0.4,2.2,1.15,1.65,7.33,5.67,1,1,3,1,1.66,10 cents,100 minutes,24 days,Female,Trade School (non-military),55,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,1,-1,-1,1,0,-3,-3,-2,0,2,-2,0,4,0,-2,-1,-3,0,0,0,-1.6,0.8,-1.2,-0.5,HS_TS +346,R_3aK34IiIm2trdOD,60 - 66,American,Female,1,3,-2,0,0,-2,-3,1,-3,0,1,2,3,-2,3,-1,-1,1,-3,-3,1,3,1,1,2,8,0,-3,1,-3,-3,8,-1,3,3,-3,3,8,0,-3,0,0,-3,8,1,3,-1,1,1,6,0,-3,2,-3,0,8,1,3,3,-3,3,8,1,0,1,1,0,8,TRUE,0,85,FALSE,0,73,TRUE,0,73,FALSE,1,71,FALSE,0,70,FALSE,1,97,TRUE,1,84,TRUE,1,82,TRUE,1,63,TRUE,1,94,FALSE,1,60,TRUE,0,80,TRUE,1,89,TRUE,0,92,TRUE,1,94,TRUE,1,89,FALSE,1,57,TRUE,0,93,FALSE,1,58,FALSE,1,60,FALSE,0,64,FALSE,0,63,FALSE,1,62,TRUE,1,89,TRUE,0,92,TRUE,1,92,TRUE,0,61,TRUE,0,94,TRUE,0,89,FALSE,0,54,FALSE,0,63,TRUE,1,91,0.0324,0.0064,0.0121,0.0256,0.0081,0.0009,0.0121,0.0036,0.16,0.3969,0.2916,0.0121,0.1369,0.16,0.49,0.5329,0.1444,0.0841,0.8836,0.8464,0.4096,0.0036,0.1764,0.8464,0.1849,0.3721,0.3969,0.7225,0.5329,0.8649,0.7921,0.64,0.360925,0.173828571,0.548021429,17,53.13,17,53.13,5,62.5,5,62.5,3,37.5,4,50,10,62.5,7,43.75,77.44,67.88,77.38,86.88,77.62,78.38,76.5,0,24.31,5.38,14.88,49.38,27.62,15.88,32.75,0,0,3,1,2,2,0,0,0,3,2,1,0,1,0,1,2,1,3,0,0,0,1,1,1,2,0,1,0,0,0,1,0,1,0,2,1,0,4,3,1.2,1,0.8,1.4,0.6,0.6,0.4,2,1.1,0.9,8,7.33,2,0,0,0,0.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),61,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,2,0,1,0,0,-1,0,3,2,0,0,0,0,-1,1,1,-1,-3,0.6,0.4,0.4,-0.6,0.2,grad_prof +347,R_6itlGcuLkBRlyOE,53 - 59,Canadian,Female,2,2,-3,3,0,2,0,0,3,0,0,3,3,0,0,2,0,0,2,3,2,2,-2,2,0,5,2,0,0,3,-2,2,0,2,2,0,0,5,0,-2,-2,2,2,5,2,2,-3,0,0,5,0,0,3,3,0,2,0,2,2,0,0,5,0,2,0,2,2,7,FALSE,1,61,TRUE,1,80,TRUE,0,100,FALSE,1,60,FALSE,0,65,FALSE,1,70,TRUE,1,100,TRUE,1,100,FALSE,0,60,TRUE,1,70,FALSE,1,60,TRUE,0,70,TRUE,1,95,TRUE,0,80,FALSE,0,60,TRUE,1,80,FALSE,1,60,TRUE,0,90,TRUE,0,80,TRUE,0,70,TRUE,1,80,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,59,TRUE,1,69,FALSE,1,55,TRUE,0,60,TRUE,0,80,TRUE,1,75,FALSE,0,54,TRUE,1,100,0,0.0961,0.04,0,0,0.09,0,0.09,0.49,0,0.0625,0.0025,0.36,0.16,0.4225,0.04,0.1936,0.16,0.36,0.1681,0.04,0.36,0.64,0.64,0.16,0.2025,0.2916,0.1521,1,0.81,0.64,0.49,0.286621429,0.147935714,0.425307143,16,50,20,62.5,4,50,6,75,6,75,4,50,12,75,8,50,74.97,63.62,75.75,78.62,81.88,80.5,69.44,-12.5,12.47,13.62,0.75,3.62,31.88,5.5,19.44,0,0,1,1,0,0,0,0,0,2,0,1,1,0,0,2,2,2,0,1,0,0,0,3,0,2,0,3,0,0,0,1,1,0,0,2,2,0,0,1,0.4,0.4,0.4,1.4,0.6,1,0.4,1,0.65,0.75,4,4,0,0,0,-2,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,53,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,1,-2,0,-2,0,-3,0,2,0,0,0,0,0,0,0,2,0,0,-0.2,-0.6,0,0.4,-0.1,C_Ug +348,R_5DB7iEbTk4da9Pc,60 - 66,Canadian,Female,2,1,3,1,3,-2,-1,2,2,0,3,1,1,0,2,1,1,1,1,1,1,2,3,1,2,1,-2,-1,1,3,0,0,3,1,1,0,2,1,1,1,1,1,1,1,2,2,3,2,1,2,-1,0,1,1,-1,1,3,1,1,0,2,2,1,1,1,1,1,1,TRUE,0,100,TRUE,1,96,FALSE,1,85,FALSE,1,55,TRUE,1,76,FALSE,1,80,TRUE,1,91,TRUE,1,100,TRUE,1,95,TRUE,1,55,FALSE,1,54,FALSE,1,100,FALSE,0,55,TRUE,0,100,TRUE,1,58,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,57,FALSE,1,68,FALSE,0,57,TRUE,1,58,FALSE,1,100,TRUE,1,84,FALSE,1,99,TRUE,1,94,TRUE,0,65,FALSE,1,55,TRUE,0,76,FALSE,0,55,FALSE,0,58,TRUE,1,95,0,0.0036,0,0.0081,0.0025,0.04,0.0256,0.2025,0.1024,0.1764,0.3025,0.3025,0.0025,0.2116,0.0576,0.0016,0,0.2025,0.2025,0.0001,0.3249,0.1764,0.1849,1,0.2916,0.4225,0.3364,1,0.0225,1,0.5776,0,0.256057143,0.116442857,0.395671429,21,65.63,22,68.75,6,75,4,50,5,62.5,7,87.5,12,75,10,62.5,77.34,67.25,74.12,87.12,80.88,76.69,78,-3.12,8.59,-7.75,24.12,24.62,-6.62,1.69,15.5,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0.6,0.4,0,0,0.8,1,0,0,0.25,0.45,0.67,1.67,-1,-1,-1,0,-1,10 cents,5 minutes,24 days,Female,University - Undergraduate,62,1.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,1,0,0,-1,-1,-1,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,-0.2,-0.6,0,0,-0.2,C_Ug +349,R_3HnBfY0lIp3qaUp,46 - 52,Canadian,Female,1,3,3,2,3,-1,-1,2,0,0,3,-1,2,0,2,-1,0,0,-1,-1,2,3,3,2,3,5,1,-2,2,-2,1,5,2,-3,2,0,3,4,0,1,1,0,0,7,2,3,3,3,2,8,-1,0,2,1,0,4,2,-2,3,-1,3,5,0,0,0,0,0,5,TRUE,0,97,TRUE,1,53,FALSE,1,69,FALSE,1,50,TRUE,1,85,FALSE,1,94,TRUE,1,90,TRUE,1,90,FALSE,0,50,TRUE,1,92,FALSE,1,50,TRUE,0,88,TRUE,1,66,FALSE,1,50,FALSE,0,50,TRUE,1,95,FALSE,1,50,TRUE,0,92,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,76,FALSE,0,50,TRUE,0,67,TRUE,1,71,FALSE,1,50,FALSE,1,55,TRUE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,61,0.01,0.0841,0.0025,0.01,0.1521,0.0036,0.25,0.0064,0.25,0.25,0.25,0.1156,0.25,0.25,0.0225,0.2209,0.5776,0.25,0.2025,0.4489,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9409,0.0961,0.8464,0.25,0.7744,0.291353571,0.203478571,0.379228571,14,43.75,20,62.5,5,62.5,6,75,4,50,5,62.5,10,62.5,10,62.5,65.34,50.38,66.5,76.12,68.38,65.81,64.88,-18.75,2.84,-12.12,-8.5,26.12,5.88,3.31,2.38,1,0,0,0,0,2,1,0,2,1,1,2,0,0,1,1,1,1,1,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,0,0,1,1,0.2,1.2,0.8,1,0.6,0.4,1,0.6,0.8,0.65,4.67,5.67,-3,1,-1,2,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,0.75,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,-1,2,0,0,1,1,0,1,-1,-1,0,0,1,1,0,0,-0.4,0.8,-0.2,0.4,0.15,C_Ug +350,R_7mLb9cbulVDWv7c,60 - 66,Canadian,Male,1,1,1,-1,2,-1,0,2,0,0,0,-1,2,-2,-1,1,1,2,2,-1,2,1,2,-2,2,7,-1,1,2,0,0,3,-1,-1,2,1,-1,5,-1,-1,0,-1,-2,7,2,1,2,1,-2,7,-2,0,2,-1,1,6,-1,0,2,-2,1,7,2,1,2,2,-2,6,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,90,TRUE,1,100,TRUE,1,90,TRUE,0,65,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,60,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,80,TRUE,0,70,TRUE,1,100,FALSE,1,85,TRUE,1,100,TRUE,0,90,FALSE,1,100,TRUE,0,85,FALSE,0,81,TRUE,1,50,TRUE,1,100,0.01,0,0,0.0625,0,0,0,0.01,0,0.04,0.6561,1,0,0.4225,0.0625,0,0.49,0.25,0,0.0225,0,0.25,0.0625,0,0.36,0.81,0.25,0,0,1,0.7225,0,0.228878571,0.209364286,0.248392857,28,87.5,24,75,6,75,4,50,7,87.5,7,87.5,14,87.5,10,62.5,86.59,72.5,86.25,91.25,96.38,86.94,86.25,12.5,11.59,-2.5,36.25,3.75,8.88,-0.56,23.75,1,0,1,1,0,0,1,0,0,0,1,0,0,3,0,2,2,2,3,1,1,0,1,2,4,1,0,0,1,1,1,1,0,0,2,1,0,0,0,1,0.6,0.2,0.8,2,1.6,0.6,0.8,0.4,0.9,0.85,5,6.67,0,-3,-2,1,-1.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,62,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,-1,-4,-1,1,0,-1,-1,0,-1,0,3,-2,1,2,2,3,0,-1,-0.4,0,1.6,0.05,C_Ug +351,R_6MIObewhpcim2EF,53 - 59,American,Male,3,2,1,2,1,-2,-1,1,1,1,0,-3,2,-3,3,-2,-1,-2,-2,-2,2,2,2,2,2,3,-1,-2,1,1,1,8,-1,-2,2,-2,3,6,-3,-2,-2,-2,-3,8,2,2,2,2,2,5,-1,-2,2,1,-1,5,-1,-2,2,-3,3,4,0,0,1,0,-1,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,58,TRUE,1,98,FALSE,1,100,TRUE,1,95,TRUE,1,86,TRUE,1,98,FALSE,0,94,TRUE,0,98,TRUE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,97,TRUE,1,99,TRUE,0,96,TRUE,0,94,FALSE,1,59,FALSE,1,100,TRUE,1,97,FALSE,0,96,TRUE,0,100,TRUE,1,100,TRUE,0,98,TRUE,1,100,TRUE,0,77,FALSE,1,77,TRUE,0,100,TRUE,1,99,TRUE,1,97,TRUE,1,100,0.0196,0,0.0001,0.0025,0,0,0,0.8836,0,0.9216,0.0001,0.0036,0.0004,0.9604,0.0004,0,1,0.1764,0.0529,0.9604,0.0009,0.0009,0.1681,0,0.9216,0.5929,0.0009,0,1,0.8836,1,1,0.376025,0.281892857,0.470157143,28,87.5,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,93.97,85.5,98.12,97.12,95.12,96.88,91.06,21.87,28.34,10.5,35.62,47.12,20.12,9.38,47.31,1,0,1,0,1,1,1,0,0,0,1,1,0,1,0,1,1,0,0,1,1,0,1,0,1,1,1,1,0,2,1,1,0,0,0,2,1,3,2,1,0.6,0.4,0.6,0.6,0.6,1,0.4,1.8,0.55,0.95,5.67,4.67,-2,3,2,-1,1,15 cents,25 minutes,24 days,Male,College Diploma/Certificate,54,0.625,0,0,0,0,0,1,0,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,-1,0,-2,0,0,0,1,0,-1,0,-3,-2,0,0,-0.6,0.2,-1.2,-0.4,C_Ug +352,R_1BWY1jkuOwgS7iB,46 - 52,Canadian,Male,1,1,-2,1,3,-3,1,0,1,3,2,-3,3,1,3,-3,-3,-1,-3,-3,0,1,-3,-2,3,8,-3,1,1,1,3,7,2,-3,3,1,3,1,-3,-3,-3,-3,-3,6,0,1,-3,1,3,2,-3,2,1,2,3,2,2,-3,3,-3,3,2,-3,-3,-3,-3,-3,8,TRUE,0,100,TRUE,1,75,FALSE,1,75,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,90,FALSE,1,100,FALSE,1,90,TRUE,1,90,FALSE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,60,TRUE,1,90,0,0,0,0,0.01,0.25,0,0.81,0.25,0.01,1,0.01,0,0,0,0.0625,0,0.25,0,0,0,0.16,0.81,0,0.25,0.25,0.16,1,0.0625,1,0,0.01,0.226964286,0.189464286,0.264464286,20,62.5,26,81.25,6,75,8,100,5,62.5,7,87.5,14,87.5,12,75,86.25,73.12,85,97.5,89.38,90.94,81.56,-18.75,5,-1.88,-15,35,1.88,3.44,6.56,1,0,1,3,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0,4,0,0,0,2,0,0,1,0.2,0,0.4,0.4,0.6,0.8,0.4,0.4,0.55,5.33,2,6,5,-1,-2,3.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,0,3,0,0,-1,0,-1,0,0,0,0,-4,0,0,0,0,0,0,0.6,-0.4,-0.8,0,-0.15,C_Ug +353,R_3Sfsbnd8gP6qoou,32 - 38,Canadian,Male,1,0,1,2,3,2,0,3,-2,3,0,2,3,3,1,1,2,2,2,1,0,3,3,2,3,7,2,2,2,-2,2,8,0,2,2,2,2,6,3,2,3,3,2,5,0,0,0,0,0,6,3,3,3,3,3,8,-1,0,2,0,2,5,3,3,3,3,3,10,FALSE,1,100,TRUE,1,60,FALSE,1,69,TRUE,0,87,TRUE,1,77,FALSE,1,71,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,73,FALSE,1,89,TRUE,1,100,TRUE,0,50,TRUE,1,88,TRUE,1,100,FALSE,1,80,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,57,FALSE,0,63,FALSE,1,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,FALSE,0,87,0,0,0,0,0.7569,0.0841,0.3969,0,0,0,0,0,0,0.0729,0.0529,0.16,0.1849,0.7569,0,0,0,0.0144,0.0081,0.25,0.04,0.36,1,0,0.0961,1,1,0.0121,0.223078571,0.176107143,0.27005,27,84.38,24,75,5,62.5,6,75,6,75,7,87.5,13,81.25,11,68.75,87.56,82.38,84,93.75,90.12,92.19,82.94,9.38,12.56,19.88,9,18.75,2.62,10.94,14.19,1,3,2,0,0,0,2,1,0,1,0,0,1,1,1,2,0,1,1,1,1,0,1,2,3,1,3,0,5,0,1,2,1,3,1,2,1,1,1,2,1.2,0.8,0.6,1,1.4,1.8,1.6,1.4,0.9,1.55,7,6.33,1,0,1,-5,0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,3,1,-2,-3,-1,-1,1,-5,1,-1,-2,0,-2,0,0,-1,0,0,-1,-0.2,-1,-1,-0.4,-0.65,C_Ug +354,R_7qEzOyCILFOJjxu,53 - 59,Canadian,Female,0,1,3,2,0,1,-2,0,-3,-1,3,0,1,-2,3,2,0,1,0,-3,3,3,2,0,1,1,0,-3,0,-1,0,1,2,1,3,-2,2,1,-1,0,1,0,1,1,3,2,1,1,-1,1,0,-1,1,-1,-3,1,2,3,0,-3,3,1,0,-3,0,0,-2,5,FALSE,1,55,FALSE,0,54,TRUE,0,66,FALSE,1,54,FALSE,0,54,FALSE,1,53,FALSE,0,51,FALSE,0,52,FALSE,0,58,TRUE,1,53,FALSE,1,60,TRUE,0,85,TRUE,1,90,FALSE,1,54,TRUE,1,54,FALSE,0,50,FALSE,1,55,TRUE,0,80,FALSE,1,53,FALSE,1,75,TRUE,1,53,FALSE,0,51,FALSE,1,51,FALSE,0,51,FALSE,1,51,FALSE,0,51,FALSE,1,51,FALSE,1,58,FALSE,1,52,TRUE,1,52,FALSE,0,53,TRUE,1,73,0.2704,0.2601,0.25,0.2601,0.0729,0.2209,0.2601,0.2209,0.0625,0.2601,0.2304,0.01,0.3364,0.16,0.2916,0.2916,0.2401,0.2116,0.1764,0.2401,0.2209,0.2116,0.2209,0.2116,0.2025,0.2401,0.2809,0.2025,0.4356,0.64,0.2304,0.7225,0.253753571,0.204935714,0.302571429,17,53.13,19,59.38,5,62.5,7,87.5,4,50,3,37.5,6,37.5,13,81.25,57.91,54.62,60.12,55.75,61.12,56.25,59.56,-6.25,-1.47,-7.88,-27.38,5.75,23.62,18.75,-21.69,3,2,1,2,1,1,1,0,2,1,1,1,2,0,1,3,0,0,0,4,3,1,2,1,1,1,1,1,2,2,1,3,1,1,0,2,3,1,0,1,1.8,1,1,1.4,1.6,1.4,1.2,1.4,1.3,1.4,1,1,0,0,0,-4,0,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,53,-0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,1,-1,1,0,0,0,-1,0,-1,0,-2,1,-1,1,1,-3,-1,0,3,0.2,-0.4,-0.2,0,-0.1,C_Ug +355,R_67NA8zgS1bPutTI,53 - 59,Canadian,Female,3,3,3,2,-1,-1,-3,3,1,-2,3,1,2,-3,3,-3,-2,1,1,-1,3,1,3,-2,1,4,1,2,1,3,-2,7,3,1,2,-1,3,5,-3,-3,-3,-2,-3,6,3,3,3,3,-2,0,-2,-2,3,-1,-3,3,3,1,2,-3,3,2,-1,-3,1,0,-1,4,FALSE,1,100,TRUE,1,90,FALSE,1,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,85,TRUE,1,85,TRUE,0,80,FALSE,1,100,FALSE,0,50,FALSE,1,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,90,TRUE,0,60,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,80,FALSE,1,55,TRUE,0,75,FALSE,0,70,FALSE,0,50,TRUE,1,100,0,0.09,0,0.01,0,0,0,0.0225,0,0,0.49,0.25,0.0225,0.64,0.0625,0.01,0,0.25,0.2025,0,0.1225,0.25,0.36,0.16,0.25,0.64,0.25,0,0,0.81,0.5625,0,0.19125,0.124821429,0.257678571,21,65.63,23,71.88,3,37.5,6,75,7,87.5,7,87.5,12,75,11,68.75,80.62,68.12,76.88,86.88,90.62,80,81.25,-6.25,8.74,30.62,1.88,-0.62,3.12,5,12.5,0,2,0,4,2,2,5,2,2,0,0,0,0,2,0,0,1,4,3,2,0,0,0,1,1,1,1,0,2,1,0,0,0,0,0,2,1,0,1,0,1.6,2.2,0.4,2,0.4,1,0,0.8,1.55,0.55,5.33,1.67,4,4,3,2,3.66,10 cents,100 minutes,15 days,Female,High School (or equivalent),55,0.375,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,2,0,3,1,1,4,2,0,-1,0,0,0,2,0,-2,0,4,2,2,1.2,1.2,0.4,1.2,1,HS_TS +356,R_3wSrJ7Gl3snoC2d,60 - 66,Canadian,Female,2,2,2,0,3,0,0,2,-2,1,3,3,3,0,3,0,0,1,0,1,2,2,2,-2,3,5,0,-1,2,-2,0,5,3,3,3,0,3,5,0,-1,1,0,0,7,2,2,2,2,2,7,0,0,1,0,0,5,2,0,-2,-1,0,4,0,0,1,1,1,6,TRUE,0,82,TRUE,1,66,TRUE,0,98,FALSE,1,55,FALSE,0,55,TRUE,0,83,TRUE,1,86,TRUE,1,94,FALSE,0,68,TRUE,1,100,TRUE,0,71,TRUE,0,96,TRUE,1,60,FALSE,1,100,FALSE,0,67,TRUE,1,100,TRUE,0,90,TRUE,0,98,FALSE,1,57,TRUE,0,100,TRUE,1,91,FALSE,0,53,FALSE,1,79,TRUE,1,89,FALSE,1,100,TRUE,1,97,FALSE,1,57,TRUE,0,85,TRUE,0,86,TRUE,1,100,FALSE,0,59,TRUE,1,100,0.0036,0.0009,0,0.0196,0,0.6889,0.0121,0,1,0.2809,0,0.16,0.4624,0.5041,0.3025,0.1156,0.0441,0.2025,0.7225,0,0.0081,0.4489,0.1849,0,0.81,0.1849,0.3481,0.6724,0.9604,0.9604,0.7396,0.9216,0.383389286,0.269507143,0.497271429,19,59.38,17,53.13,4,50,4,50,5,62.5,4,50,11,68.75,6,37.5,81.94,62.5,80.5,89.5,95.25,80.31,83.56,6.25,28.81,12.5,30.5,27,45.25,11.56,46.06,0,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,1,2,1,1,3,5,1,3,0,0,0,1,0,0.4,0.4,0,0.4,0.6,0.8,2.6,0.2,0.3,1.05,5,5.33,-2,0,1,1,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),65,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,1,-1,-2,0,-1,-3,-5,-1,-3,0,1,0,-1,1,-0.2,-0.4,-2.6,0.2,-0.75,HS_TS +357,R_7HiTKDTQv39yl5k,67 - 73,American,Male,-2,-1,-1,-2,1,0,-1,2,-2,-2,2,1,3,1,0,1,1,1,1,-3,-2,-1,0,-2,2,1,0,-2,2,-2,-2,1,2,1,3,1,0,0,-1,1,1,1,-3,9,-1,0,1,0,-1,1,0,0,0,0,-2,3,2,1,3,-1,0,1,0,0,0,1,-3,6,TRUE,0,100,TRUE,1,80,FALSE,1,100,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0.0625,0,0.04,0,0.2116,0,0,0,0.25,0,0,0,1,0,1,0,1,1,0.2116,0.172792857,0.0269,0.318685714,28,87.5,28,87.5,7,87.5,7,87.5,6,75,8,100,16,100,12,75,93.38,82.38,100,100,91.12,94.06,92.69,0,5.88,-5.12,12.5,25,-8.88,-5.94,17.69,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,2,2,2,0,1,2,2,0,0,0,0,2,0,1,1,1,0,0,0.4,0.2,0,0.4,1.6,1,0.4,0.6,0.25,0.9,0.67,1.67,0,-2,-1,3,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,69,-0.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,-1,-1,-2,-1,0,0,-2,-2,0,0,0,0,-2,0,1,-1,-1,0,0,-1.2,-0.8,-0.4,-0.2,-0.65,C_Ug +358,R_7I9Od9hmN304V0k,39 - 45,Canadian,Male,1,2,1,-2,-3,-3,1,3,-3,-1,-2,3,3,-3,-1,3,0,3,3,3,-1,3,3,2,-3,7,-1,-3,0,-2,-2,5,-1,3,3,-3,-1,5,-1,-1,-2,1,3,5,1,-2,-2,-2,-3,7,-3,3,3,-3,-2,3,-2,3,3,-3,-1,3,3,-2,3,3,3,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,85,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0625,0,0.5625,1,0,1,0.64,0.04,0.7225,0,1,1,1,1,0,0.286696429,0.004464286,0.568928571,30,93.75,23,71.88,6,75,6,75,4,50,7,87.5,15,93.75,8,50,96.72,95,97.5,94.38,100,100,93.44,21.87,24.84,20,22.5,44.38,12.5,6.25,43.44,2,1,2,4,0,2,4,3,1,1,1,0,0,0,0,4,1,5,2,0,0,4,3,0,0,0,2,0,0,1,0,0,0,0,0,0,2,0,0,0,1.8,2.2,0.2,2.4,1.4,0.6,0,0.4,1.65,0.6,5.67,4.33,0,2,2,2,1.34,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,42,-0.375,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,2,-3,-1,4,0,2,2,3,1,0,1,0,0,0,0,4,-1,5,2,0,0.4,1.6,0.2,2,1.05,C_Ug +359,R_74eXLz4khUCjBgq,39 - 45,Canadian,Female,0,3,2,2,3,0,-1,1,1,2,1,1,2,0,1,0,-1,-2,0,-2,2,3,1,2,3,7,3,2,3,1,3,8,1,-1,2,3,2,9,2,1,3,3,3,10,2,3,2,2,3,7,0,0,0,0,0,10,-1,0,2,0,1,9,2,2,2,2,2,10,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,1,55,TRUE,1,100,FALSE,1,70,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,TRUE,1,80,TRUE,0,100,FALSE,1,65,TRUE,0,70,TRUE,0,100,FALSE,0,55,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,90,TRUE,1,90,FALSE,0,60,TRUE,1,100,0,0.04,0.04,0,0,0.09,0,0,1,0.16,0.01,0,0.3025,0.16,0,0,0,0.2025,0.25,0,0.3025,0.16,0.49,0,1,0.36,0.36,1,0.5625,0.1225,0.81,1,0.297946429,0.1375,0.458392857,22,68.75,21,65.63,4,50,5,62.5,7,87.5,5,62.5,13,81.25,8,50,82.34,65,89.38,88.12,86.88,83.75,80.94,3.12,16.71,15,26.88,0.62,24.38,2.5,30.94,2,0,1,0,0,3,3,2,0,1,0,2,0,3,1,2,2,5,3,5,2,0,0,0,0,0,1,1,1,2,2,1,0,0,0,2,3,4,2,4,0.6,1.8,1.2,3.4,0.4,1,0.6,3,1.75,1.25,8,8.67,0,-2,0,0,-0.67,10 cents,5 minutes,24 days,Female,University - Undergraduate,45,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,1,0,0,3,2,1,-1,-1,-2,1,0,3,1,0,-1,1,1,1,0.2,0.8,0.6,0.4,0.5,C_Ug +360,R_3e714bzOWPS2ZBT,39 - 45,Canadian,Female,-3,2,1,3,-2,-2,2,1,3,1,-1,-2,-2,-1,0,-2,-2,-1,-1,-2,-3,2,3,2,-2,6,1,2,1,3,2,7,-1,-2,-1,-1,0,6,-2,-1,-2,-2,-2,4,-3,1,2,3,0,6,-3,1,1,1,-2,6,-1,-2,-2,-3,-2,6,-1,-2,-1,-1,-2,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,80,TRUE,0,50,TRUE,1,59,TRUE,1,58,TRUE,1,50,TRUE,1,59,FALSE,1,50,TRUE,0,54,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,73,FALSE,1,50,TRUE,1,81,FALSE,1,50,FALSE,1,54,FALSE,1,50,FALSE,0,54,FALSE,0,54,TRUE,1,90,0.1764,0.0361,0.25,0.1681,0.01,0.25,0.0729,0.1681,0.25,0.25,0.2916,0.25,0.25,0.25,0.04,0.25,0.25,0.25,0.2116,0.25,0.25,0.25,0.25,0,0.25,0.25,0.2916,0.25,0.25,0.25,0.25,0.2916,0.218835714,0.202328571,0.235342857,8,25,22,68.75,5,62.5,4,50,7,87.5,6,75,9,56.25,13,81.25,56.75,50.5,58.75,62.38,55.38,59.88,53.62,-43.75,-12,-12,8.75,-25.12,-19.62,3.63,-27.63,0,0,2,1,0,3,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,2,1,1,0,2,3,0,0,0,2,2,1,0,0,0,0,0.6,0.8,0.2,0.6,0.8,1.4,0.8,0.2,0.55,0.8,6.33,6,0,1,0,-2,0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,43,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,-1,1,1,-2,2,-1,0,-2,-2,0,0,1,-2,-2,-1,1,1,1,0,-0.2,-0.6,-0.6,0.4,-0.25,C_Ug +361,R_5EtClCm5PQEaGv1,53 - 59,American,Male,-3,3,3,-3,3,1,-3,3,-3,3,3,3,3,-1,3,3,3,3,3,3,-3,3,3,-3,3,0,-1,-3,3,-3,1,2,3,3,3,1,3,0,-1,-1,-1,-1,-1,10,-3,3,3,-3,3,0,1,-3,3,-3,3,0,3,3,3,1,3,0,3,0,3,3,3,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,61,FALSE,0,61,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,52,FALSE,1,100,TRUE,1,70,FALSE,0,78,FALSE,1,51,FALSE,0,52,TRUE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,54,FALSE,0,75,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.2704,0,0,0.6084,0.5625,1,0,0,0.0841,0,0.2401,0,0,0.5625,0.09,0.3721,0.2304,0.3721,0,0.25,0,1,1,1,0.2916,1,0.319078571,0.197535714,0.440621429,17,53.13,19,59.38,6,75,6,75,3,37.5,4,50,11,68.75,8,50,85.94,82.88,80.75,89.25,90.88,87.94,83.94,-6.25,26.56,7.88,5.75,51.75,40.88,19.19,33.94,0,0,0,0,0,2,0,0,0,2,0,0,0,2,0,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0.8,0.4,4,0,0,0.4,0.6,1.3,0.25,0.67,0,0,2,0,8,0.67,10 cents,5 minutes,24 days,Male,High School (or equivalent),57,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,4,1,4,4,4,0,0.8,0,3.4,1.05,HS_TS +362,R_5KThwaDWZxRmrux,32 - 38,American,Female,0,-1,0,2,3,-1,-3,1,2,-1,3,1,-1,1,1,-1,0,0,1,-3,0,-1,3,3,2,6,-1,1,-1,0,1,6,1,1,-1,0,2,7,2,1,-1,-1,1,4,-3,0,1,-1,-1,6,0,-1,2,0,0,7,1,2,1,-1,2,8,2,0,-1,1,3,7,FALSE,1,85,TRUE,1,95,FALSE,1,54,FALSE,1,53,FALSE,0,53,TRUE,0,77,TRUE,1,98,TRUE,1,98,TRUE,1,90,FALSE,0,74,FALSE,1,59,TRUE,0,95,TRUE,1,91,TRUE,0,89,FALSE,0,50,TRUE,1,71,TRUE,0,86,TRUE,0,73,FALSE,1,64,FALSE,1,65,FALSE,0,74,TRUE,1,61,FALSE,1,100,TRUE,1,72,FALSE,1,99,FALSE,0,50,FALSE,1,50,TRUE,0,96,TRUE,0,86,TRUE,1,82,FALSE,0,50,TRUE,1,100,0.0004,0.25,0.0841,0.0004,0,0.5929,0.0784,0.5476,0.1225,0.1521,0.0324,0.0081,0.01,0.1681,0.2809,0.0025,0,0.2209,0.9216,0.0001,0.5476,0.25,0.1296,0.7921,0.7396,0.25,0.25,0.0225,0.2116,0.5329,0.7396,0.9025,0.303789286,0.158314286,0.449264286,12,37.5,19,59.38,6,75,3,37.5,4,50,6,75,10,62.5,9,56.25,76.25,63.88,83.38,78.62,79.12,75.56,76.94,-21.88,16.87,-11.12,45.88,28.62,4.12,13.06,20.69,0,0,3,1,1,0,4,2,2,2,2,0,0,1,1,3,1,1,2,4,3,1,1,3,4,1,2,1,2,1,2,1,2,2,1,3,0,1,0,6,1,2,0.8,2.2,2.4,1.4,1.6,2,1.5,1.85,6.33,7,0,-1,-1,-3,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,-3,-1,2,-2,-3,-1,2,1,0,1,0,-1,-2,-1,0,0,1,0,2,-2,-1.4,0.6,-0.8,0.2,-0.35,C_Ug +363,R_12sc5rnLHC24OZS,46 - 52,Canadian,Male,2,0,2,0,2,-1,1,2,1,2,0,-2,2,1,0,2,2,2,2,1,2,2,1,-2,2,4,2,1,2,2,2,7,-1,-2,2,2,1,7,2,2,2,2,1,6,2,0,1,1,3,7,0,-1,2,-1,2,6,0,-2,2,-1,1,6,2,2,2,3,1,7,TRUE,0,54,TRUE,1,58,TRUE,0,63,FALSE,1,52,TRUE,1,68,FALSE,1,55,TRUE,1,61,TRUE,1,75,TRUE,1,58,FALSE,0,53,TRUE,0,53,TRUE,0,71,TRUE,1,59,TRUE,0,59,TRUE,1,56,TRUE,1,100,TRUE,0,54,TRUE,0,53,TRUE,0,77,FALSE,1,53,FALSE,0,54,FALSE,0,53,FALSE,1,53,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,52,FALSE,1,100,FALSE,1,55,TRUE,1,55,FALSE,0,55,TRUE,1,61,0.0625,0,0,0.1521,0.1521,0.2025,0.2116,0.2809,0.2209,0.2809,0.2025,0.1681,0.1764,0.2809,0.1024,0.1764,0.2209,0.2304,0,0,0.2916,0.1936,0.5929,0.3481,0.2916,0.2304,0.3025,0.2916,0.3969,0.2809,0.2025,0.5041,0.244057143,0.207635714,0.280478571,5,15.63,20,62.5,5,62.5,6,75,3,37.5,6,75,12,75,8,50,63.25,57.62,57.38,66.62,71.38,63.75,62.75,-46.87,0.75,-4.88,-17.62,29.12,-3.62,-11.25,12.75,0,2,1,2,0,3,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,2,0,2,0,0,0,0,2,1,0,0,0,1,0,1,0.8,0.6,0,0.6,1,0.6,0.2,0.6,0.6,6,6.33,-3,1,1,-1,-0.33,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,51,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,2,0,1,-1,2,-2,0,-1,0,1,0,0,-1,0,0,0,0,-1,0,0.4,-0.2,0,-0.2,0,C_Ug +364,R_57kAOyXKZLlEKxT,53 - 59,American,Female,3,2,2,2,3,-3,-1,1,0,-1,2,1,2,-1,2,1,1,1,2,1,3,3,3,3,3,1,-3,-2,1,1,-2,0,1,1,-1,-1,1,2,1,1,1,1,1,2,2,2,2,2,2,2,-3,-1,1,1,-1,1,2,1,1,1,1,4,1,1,1,1,1,1,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,0,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.285714286,0.214285714,0.357142857,2,6.25,17,53.13,4,50,4,50,5,62.5,4,50,16,100,1,6.25,59.38,50,50,68.75,68.75,62.5,56.25,-46.88,6.25,0,0,6.25,18.75,-37.5,50,0,1,1,1,0,0,1,0,1,1,1,0,3,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,2,1,0,0,0,1,0,0.6,0.6,1,0.2,0.4,0.2,0.8,0.2,0.6,0.4,1,2.33,-1,-1,-2,1,-1.33,5 cents,100 minutes,15 days,Female,College Diploma/Certificate,53,0.625,1,0,0,0,1,0,0.33,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,1,1,1,-1,0,1,0,0,1,1,0,2,-2,0,0,0,0,0,0,0.2,0.4,0.2,0,0.2,C_Ug +365,R_3PJEmvviwvNuAnL,32 - 38,Canadian,Female,1,0,-2,-3,1,-2,-2,1,0,3,0,0,1,-1,0,-1,-2,0,0,-1,2,3,2,-3,0,6,2,0,0,-2,3,10,-2,-2,3,3,-1,5,2,1,2,1,1,8,3,2,-2,-3,3,3,1,-3,2,-2,3,5,1,2,3,-2,0,4,2,3,3,3,1,7,FALSE,1,61,FALSE,0,54,FALSE,1,100,FALSE,1,69,TRUE,1,68,FALSE,1,94,TRUE,1,100,TRUE,1,100,FALSE,0,56,TRUE,1,91,TRUE,0,64,TRUE,0,100,TRUE,1,93,FALSE,1,58,FALSE,0,73,TRUE,1,65,TRUE,0,59,TRUE,0,62,FALSE,1,79,TRUE,0,61,FALSE,0,53,FALSE,0,59,TRUE,0,100,TRUE,1,60,TRUE,0,100,TRUE,1,55,FALSE,1,52,FALSE,1,51,FALSE,1,52,TRUE,1,59,FALSE,0,51,TRUE,1,100,0,0.2025,0.1225,0,0,0.0036,0.16,0.0081,0.3721,0.3481,0.1681,0.0049,0.3136,0.4096,0.1024,0.2916,1,0.0961,0.2401,1,0.2809,0.5329,0.0441,0.1764,0.3481,0.2304,0.2601,0.1521,0,0.3844,0.2304,1,0.291360714,0.234157143,0.348564286,16,50,19,59.38,3,37.5,5,62.5,5,62.5,6,75,10,62.5,9,56.25,71.84,62.25,77.38,73.25,74.5,71.06,72.62,-9.38,12.46,24.75,14.88,10.75,-0.5,8.56,16.37,1,3,4,0,1,4,2,1,2,0,2,2,2,4,1,3,3,2,1,2,2,2,0,0,2,3,1,1,2,0,1,2,2,1,0,3,5,3,3,2,1.8,1.8,2.2,2.2,1.2,1.4,1.2,3.2,2,1.75,7,4,3,5,1,1,3,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,37,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,1,4,0,-1,1,1,0,0,0,1,0,0,3,1,0,-2,-1,-2,0,0.6,0.4,1,-1,0.25,C_Ug +366,R_5wvnZJXgfWFlJm5,39 - 45,American,Male,1,2,1,2,2,1,1,2,2,1,1,2,2,1,1,1,1,2,0,2,1,2,1,1,2,8,2,2,2,3,1,8,0,1,2,0,1,8,1,1,2,2,2,8,2,1,1,2,2,8,1,1,2,2,1,8,1,1,2,2,2,8,2,1,0,2,1,8,TRUE,0,88,TRUE,1,89,FALSE,1,76,FALSE,1,71,FALSE,0,76,FALSE,1,77,FALSE,0,82,FALSE,0,73,TRUE,1,84,FALSE,0,87,FALSE,1,98,TRUE,0,71,FALSE,0,75,TRUE,0,90,FALSE,0,72,TRUE,1,77,FALSE,1,75,TRUE,0,73,FALSE,1,75,FALSE,1,76,FALSE,0,88,FALSE,0,76,FALSE,1,85,FALSE,0,82,FALSE,1,87,FALSE,0,81,FALSE,1,85,FALSE,1,68,FALSE,1,80,TRUE,1,86,FALSE,0,80,FALSE,0,84,0.5329,0.6561,0.0529,0.6724,0.7056,0.0529,0.6724,0.7569,0.0576,0.5776,0.0196,0.5625,0.0256,0.0004,0.5776,0.0121,0.0225,0.0841,0.1024,0.0169,0.7744,0.5184,0.0625,0.81,0.0625,0.0225,0.64,0.7744,0.0576,0.5329,0.04,0.5041,0.323071429,0.294814286,0.351328571,18,56.25,16,50,6,75,4,50,1,12.5,5,62.5,4,25,12,75,80.22,81.75,80,83,76.12,80.75,79.69,6.25,30.22,6.75,30,70.5,13.62,55.75,4.69,0,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0,2,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,2,2,1,0.2,0.6,0.6,0.4,0.4,0,0.6,1.2,0.45,0.55,8,8,0,0,0,0,0,10 cents,5 minutes,36 days,Male,Trade School (non-military),41,0.125,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,-1,-1,0,1,0,1,1,0,1,0,1,0,0,0,-1,-1,0,-2,0,-1,-0.2,0.6,0,-0.8,-0.1,HS_TS +367,R_78UHVzrSM2g903q,67 - 73,Canadian,Male,-2,1,2,-2,1,-2,-3,0,-1,-2,-1,1,1,0,2,-2,-2,-2,-2,-2,-3,2,2,-2,2,1,0,-2,0,-2,-1,1,-2,1,1,1,-1,2,-3,-3,-3,-2,-3,6,-2,2,2,-2,2,1,-1,-3,2,-3,1,2,0,2,2,-2,1,3,1,0,2,1,0,4,TRUE,0,96,TRUE,1,61,FALSE,1,96,FALSE,1,53,FALSE,0,53,FALSE,1,85,TRUE,1,91,TRUE,1,95,TRUE,1,54,TRUE,1,55,FALSE,1,56,FALSE,1,99,TRUE,1,96,TRUE,0,98,FALSE,0,60,FALSE,0,98,TRUE,0,54,TRUE,0,99,TRUE,0,80,TRUE,0,99,TRUE,1,100,FALSE,0,53,TRUE,0,53,TRUE,1,77,FALSE,1,55,TRUE,1,99,FALSE,1,53,FALSE,1,99,TRUE,0,52,TRUE,1,65,TRUE,1,68,TRUE,1,100,0.0025,0.0001,0.9604,0.0081,0,0.0225,0.0529,0.2025,0.9801,0.2809,0.1225,0.0016,0.2116,0.1936,0.2809,0.1521,0.2809,0.2209,0.0001,0.2025,0,0.36,0.64,0.9604,0.2916,0.2209,0.1024,0.9216,0.0016,0.9801,0.2704,0.0001,0.284096429,0.2145,0.353692857,28,87.5,20,62.5,6,75,4,50,4,50,6,75,12,75,8,50,76.62,60.62,74.12,80.75,91,76.56,76.69,25,14.12,-14.38,24.12,30.75,16,1.56,26.69,1,1,0,0,1,2,1,0,1,1,1,0,0,1,3,1,1,1,0,1,0,1,0,0,1,1,0,2,2,3,1,1,1,2,1,3,2,4,3,2,0.6,1,1,0.8,0.4,1.6,1.2,2.8,0.85,1.5,1.33,2,0,-1,-1,2,-0.67,10 cents,5 minutes,24 days,Male,High School (or equivalent),72,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,1,0,0,0,0,1,1,-2,-1,-2,0,-1,-1,-1,2,-2,-1,-3,-3,-1,0.2,-0.6,-0.2,-2,-0.65,HS_TS +368,R_7HOCctrM57A9aW5,46 - 52,American,Female,1,2,2,0,1,-1,-1,2,-1,0,0,-1,2,2,2,1,2,1,2,-1,1,2,2,0,0,4,-1,-1,2,-1,1,3,1,-1,2,2,2,3,1,1,1,1,-1,3,1,2,2,1,1,2,-1,-1,2,1,-1,2,0,-1,2,2,2,2,0,1,1,0,-1,2,FALSE,1,100,FALSE,0,76,TRUE,0,98,FALSE,1,64,TRUE,1,99,FALSE,1,100,TRUE,1,97,TRUE,1,97,TRUE,1,97,FALSE,0,94,FALSE,1,93,TRUE,0,94,TRUE,1,98,TRUE,0,98,FALSE,0,64,TRUE,1,95,FALSE,1,91,TRUE,0,99,FALSE,1,65,FALSE,1,98,TRUE,1,96,TRUE,1,96,FALSE,1,96,TRUE,1,98,TRUE,0,99,TRUE,1,100,FALSE,1,64,FALSE,1,96,TRUE,0,92,TRUE,1,100,FALSE,0,91,TRUE,1,99,0.0009,0,0.0025,0.0009,0.0001,0,0.0004,0.8836,0.0004,0.0016,0,0.0004,0.0009,0.0049,0.0001,0.5776,0.0016,0.1296,0.0016,0.9801,0.0016,0.4096,0.1225,0.9604,0.0081,0.1296,0.8281,0,0.9604,0.9801,0.8464,0.8836,0.311189286,0.114371429,0.508007143,27,84.38,22,68.75,5,62.5,7,87.5,4,50,6,75,12,75,10,62.5,92,76.75,96.38,97.88,97,93.56,90.44,15.63,23.25,14.25,8.88,47.88,22,18.56,27.94,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,2,1,0,0,0,0,0,1,1,0,2,0,0.2,0.2,0.2,0.4,0.2,0.6,0,0.8,0.25,0.4,3.33,2,2,1,1,1,1.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,47,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,-1,1,0,0,0,-2,0,1,0,0,0,0,-1,0,0,-1,0,0,-0.4,0.2,-0.4,-0.15,C_Ug +369,R_3VJhpQnj11ZDfBI,67 - 73,American,Female,3,1,3,3,2,0,-2,2,-3,3,1,-2,3,-2,3,0,1,2,2,-2,3,2,-1,1,2,3,0,-2,-1,0,1,3,2,-1,2,-1,3,6,-3,-2,-3,-2,-3,4,3,2,3,3,2,2,-1,-2,2,-3,1,1,-3,-3,3,-3,3,1,-2,-1,2,2,-3,1,FALSE,1,76,FALSE,0,76,FALSE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,0,100,TRUE,1,75,FALSE,0,100,FALSE,1,100,FALSE,1,81,TRUE,1,76,TRUE,0,100,FALSE,0,54,TRUE,1,75,FALSE,1,100,FALSE,1,100,TRUE,0,63,FALSE,1,63,FALSE,0,100,TRUE,1,81,FALSE,1,100,TRUE,1,86,FALSE,1,100,TRUE,1,78,TRUE,0,55,FALSE,1,100,TRUE,0,100,FALSE,0,65,FALSE,0,56,FALSE,0,100,1,0.0484,0.0625,0.0625,1,0,0.0196,1,0.1369,0.0361,0.4225,0.0576,0.0625,0,0,0.5776,0,0.16,0,0,1,0.2916,0.3969,1,0,0.3025,0.3136,0.0576,0,0,1,0.0361,0.281110714,0.248057143,0.314164286,22,68.75,20,62.5,3,37.5,5,62.5,6,75,6,75,8,50,12,75,84.22,67.38,97,88.75,83.75,81.06,87.38,6.25,21.72,29.88,34.5,13.75,8.75,31.06,12.38,0,1,4,2,0,0,0,3,3,2,1,1,1,1,0,3,3,5,4,1,0,1,0,0,0,1,0,0,0,2,4,1,0,1,0,2,2,0,0,1,1.4,1.6,0.8,3.2,0.2,0.6,1.2,1,1.75,0.75,4,1.33,1,2,5,3,2.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,71,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,0,4,2,0,-1,0,3,3,0,-3,0,1,0,0,1,1,5,4,0,1.2,1,-0.4,2.2,1,C_Ug +370,R_3fQMosAnclVpbrP,25 - 31,Canadian,Female,3,2,2,-1,3,-1,-1,1,-1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,6,1,1,1,1,1,6,1,1,1,1,1,6,0,0,1,-1,0,6,0,0,0,0,0,6,0,0,0,0,0,7,TRUE,0,64,TRUE,1,65,TRUE,0,88,TRUE,0,68,TRUE,1,70,TRUE,0,70,TRUE,1,76,TRUE,1,74,FALSE,0,77,TRUE,1,74,FALSE,1,92,TRUE,0,95,FALSE,0,58,FALSE,1,61,FALSE,0,70,TRUE,1,87,FALSE,1,62,TRUE,0,84,TRUE,0,54,TRUE,0,63,TRUE,1,77,FALSE,0,58,TRUE,0,85,TRUE,1,69,FALSE,1,79,TRUE,1,62,FALSE,1,78,TRUE,0,66,TRUE,0,69,TRUE,1,76,FALSE,0,73,TRUE,1,69,0.0676,0.1444,0.0169,0.0576,0.0961,0.49,0.0961,0.0676,0.3969,0.3364,0.0576,0.3364,0.5929,0.0064,0.09,0.1225,0.7225,0.4624,0.4356,0.0441,0.0529,0.49,0.2916,0.1521,0.1444,0.0484,0.5329,0.4096,0.7744,0.7056,0.4761,0.9025,0.333357143,0.2767,0.390014286,16,50,16,50,3,37.5,4,50,5,62.5,4,50,11,68.75,5,31.25,72.28,72.12,70,69.75,77.25,70.94,73.62,0,22.28,34.62,20,7.25,27.25,2.19,42.37,2,1,1,2,2,2,2,0,2,1,1,1,1,1,1,1,0,0,1,1,2,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1.6,1.4,1,0.6,1.6,0.4,0,0.4,1.15,0.6,6.67,6,1,1,0,-1,0.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,29,0,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,1,0,2,1,1,1,1,1,1,1,-1,-1,1,1,0,1,1,0.2,0.55,C_Ug +371,R_3VKJ5OzEbyaKuO0,67 - 73,American,Female,3,3,3,2,0,2,-3,3,-3,2,2,-2,2,-2,2,1,0,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,1,2,-2,2,-2,2,1,1,1,1,1,1,2,2,2,2,2,2,1,3,-3,3,-3,3,0,3,0,2,0,3,1,2,2,2,2,2,0,FALSE,1,61,TRUE,1,100,TRUE,0,100,TRUE,0,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,83,TRUE,0,100,TRUE,1,100,TRUE,0,74,TRUE,1,58,TRUE,1,64,TRUE,0,64,TRUE,0,100,TRUE,0,62,FALSE,1,100,FALSE,0,75,TRUE,1,79,TRUE,0,75,TRUE,1,78,TRUE,0,77,TRUE,1,75,TRUE,0,81,TRUE,0,79,TRUE,0,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0,0.0625,0.1296,0,0,0,0.0484,0,0,0.0441,0,0,0,0.6889,0,0,0.5625,0.3721,0.6241,0.5929,0.5625,0.1764,0.3844,0.5476,0.4096,0.6561,0.0324,0.1521,1,1,1,1,0.351932143,0.122571429,0.581292857,27,84.38,18,56.25,4,50,4,50,5,62.5,5,62.5,15,93.75,3,18.75,85.25,78.38,89.25,83.25,90.12,88.19,82.31,28.13,29,28.38,39.25,20.75,27.62,-5.56,63.56,1,1,1,0,2,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,2,1,0,0,0,1,1,2,0,2,1,1,2,0,0,0,1,0.6,0,0.8,1,0.4,1.2,0.6,0.6,0.8,1.33,0.67,1,1,0,2,0.66,10 cents,100 minutes,24 days,Female,Trade School (non-military),70,1.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,1,1,1,-1,-1,-2,0,-2,-1,-1,-1,1,1,1,0,0.2,-1.2,0.2,-0.2,HS_TS +372,R_715Q1qPVNnSgfuk,60 - 66,Canadian,Female,-3,1,-2,1,-2,-1,0,0,1,-3,3,3,2,0,2,0,0,1,0,1,-3,1,-3,-2,0,5,0,-1,0,1,-1,5,2,3,3,0,2,6,0,-1,0,0,2,5,-3,2,-1,-2,-2,5,0,0,0,1,1,5,3,3,2,0,2,5,0,0,1,1,2,5,FALSE,1,53,FALSE,0,55,TRUE,0,82,FALSE,1,53,FALSE,0,55,FALSE,1,81,FALSE,0,55,TRUE,1,77,TRUE,1,54,TRUE,1,85,FALSE,1,55,TRUE,0,100,TRUE,1,56,FALSE,1,54,FALSE,0,54,TRUE,1,55,FALSE,1,53,TRUE,0,95,FALSE,1,54,FALSE,1,55,FALSE,0,53,FALSE,0,54,FALSE,1,56,FALSE,0,54,FALSE,1,73,TRUE,1,65,FALSE,1,55,TRUE,0,87,FALSE,1,55,FALSE,0,54,FALSE,0,54,TRUE,1,73,0.0529,0.1225,0.2025,0.3025,0.0729,0.0361,0.2916,0.0225,0.2025,0.2916,0.2916,0.1936,0.2116,0.2025,0.3025,0.3025,0.1936,0.2209,0.7569,0.0729,0.2809,0.2916,0.2116,0.2116,0.2209,0.2025,0.2916,0.2209,0.6724,0.9025,0.2025,1,0.2991,0.202571429,0.395628571,9,28.13,19,59.38,5,62.5,6,75,5,62.5,3,37.5,7,43.75,12,75,62.94,54.25,60.25,66.75,70.5,59.56,66.31,-31.25,3.56,-8.25,-14.75,4.25,33,15.81,-8.69,0,0,1,3,2,1,1,0,0,2,1,0,1,0,0,0,1,1,0,1,0,1,1,3,0,1,0,0,0,4,0,0,0,0,0,0,0,0,1,1,1.2,0.8,0.4,0.6,1,1,0,0.4,0.75,0.6,5.33,5,0,0,1,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,0,2,0,1,0,0,-2,1,0,1,0,0,0,1,1,-1,0,0.2,-0.2,0.4,0.2,0.15,HS_TS +373,R_3jy7lCRUyQvFSvx,53 - 59,American,Female,3,3,2,0,2,-3,-3,2,-2,1,2,0,3,-1,1,-2,-3,-3,-3,-3,3,3,3,-1,3,5,-3,-1,0,1,2,5,2,0,2,0,2,5,0,0,0,1,-1,10,3,3,2,2,2,5,-3,-2,2,-2,2,5,2,0,2,-3,2,5,2,2,2,2,-2,10,FALSE,1,100,TRUE,1,78,FALSE,1,100,FALSE,1,50,TRUE,1,97,FALSE,1,50,TRUE,1,88,TRUE,1,73,TRUE,1,70,TRUE,1,68,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,93,FALSE,0,50,TRUE,1,87,TRUE,0,68,FALSE,1,87,FALSE,1,73,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,75,TRUE,0,75,TRUE,1,93,TRUE,0,50,FALSE,1,50,TRUE,0,80,TRUE,1,67,FALSE,0,50,TRUE,1,100,0.0729,0.0049,0.0169,0.0144,0,0.25,0.0625,0.1024,0,0.25,0.1089,0.25,0.09,0.25,0.0009,0.0484,0,0.25,0.25,0.5625,0.25,0.25,0.0729,0.8649,0.4624,0.25,0.25,0,0,0.0169,0.64,0.25,0.206525,0.118792857,0.294257143,16,50,21,65.63,4,50,4,50,5,62.5,8,100,11,68.75,10,62.5,72.56,58.88,74.38,81.75,75.25,71.62,73.5,-15.63,6.93,8.88,24.38,19.25,-24.75,2.87,11,0,0,1,1,1,0,2,2,3,1,0,0,1,1,1,2,3,3,4,2,0,0,0,2,0,0,1,0,0,1,0,0,1,2,1,4,5,5,5,1,0.6,1.6,0.6,2.8,0.4,0.4,0.8,4,1.4,1.4,5,5,0,0,0,0,0,20 cents,5 minutes,47 days,Female,College Diploma/Certificate,55,-0.375,0,1,1,0,0,0,0.67,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,1,-1,1,0,1,2,3,0,0,0,0,-1,0,-2,-2,-2,-1,1,0.2,1.2,-0.2,-1.2,0,C_Ug +374,R_5Cp3IxHCoFb1Vch,46 - 52,Canadian,Male,-2,2,2,2,2,-1,0,0,2,1,-1,3,2,0,0,-3,-3,-3,-3,-3,-2,2,2,2,2,10,2,0,2,0,2,10,-2,3,2,2,3,10,3,3,3,3,3,10,-2,2,2,2,2,7,0,0,0,1,0,7,-1,2,1,1,0,7,0,0,0,0,0,7,TRUE,0,100,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,81,FALSE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,59,TRUE,0,64,TRUE,0,100,TRUE,1,54,FALSE,1,50,FALSE,0,50,TRUE,1,70,TRUE,0,74,TRUE,0,95,FALSE,1,50,TRUE,0,60,TRUE,1,60,FALSE,0,50,TRUE,0,96,TRUE,1,54,FALSE,1,100,TRUE,1,100,TRUE,0,55,FALSE,1,100,TRUE,0,64,TRUE,1,100,FALSE,0,54,FALSE,0,50,0,0,0.09,0.25,0.25,0.0361,0.2116,0.1681,0.36,0.25,0,0.2116,0.25,0.4096,0.25,0.25,0.9216,0.25,0,0,0.16,0.25,0.25,0.25,0.5476,0.3025,0.2916,1,0,0.9025,0.4096,1,0.327942857,0.272757143,0.383128571,16,50,16,50,2,25,4,50,4,50,6,75,9,56.25,7,43.75,70,52.88,66.12,75.5,85.5,62.56,77.44,0,20,27.88,16.12,25.5,10.5,6.31,33.69,0,0,0,0,0,3,0,2,2,1,1,0,0,2,3,6,6,6,6,6,0,0,0,0,0,1,0,0,1,1,0,1,1,1,0,3,3,3,3,3,0,1.6,1.2,6,0,0.6,0.6,3,2.2,1.05,10,7,3,3,3,3,3,10 cents,100 minutes,24 days,Male,Trade School (non-military),48,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,2,0,2,1,0,1,-1,-1,1,3,3,3,3,3,3,0,1,0.6,3,1.15,HS_TS +375,R_6ODCd9pDC2ACPRv,46 - 52,American,Female,3,3,0,0,2,1,2,2,2,2,-2,0,3,-1,3,-2,-2,-2,-3,-3,3,3,0,-2,2,2,2,1,3,2,3,4,-2,0,2,1,3,4,-3,-3,-3,-3,-3,7,3,3,0,0,2,1,0,2,2,2,2,2,-2,0,3,-2,3,2,0,0,0,-2,-3,5,FALSE,1,89,TRUE,1,86,FALSE,1,87,FALSE,1,66,TRUE,1,92,FALSE,1,88,TRUE,1,88,TRUE,1,86,TRUE,1,80,TRUE,1,91,FALSE,1,69,FALSE,1,64,TRUE,1,86,FALSE,1,90,TRUE,1,74,TRUE,1,97,TRUE,0,63,FALSE,1,62,FALSE,1,61,TRUE,0,59,FALSE,0,70,TRUE,1,92,FALSE,1,96,TRUE,1,86,TRUE,0,65,FALSE,0,71,TRUE,0,90,FALSE,1,75,TRUE,0,86,TRUE,1,81,TRUE,1,65,TRUE,1,91,0.0196,0.5041,0.0009,0.0144,0.0081,0.0144,0.0196,0.0081,0.3481,0.0064,0.0361,0.0196,0.04,0.0961,0.0064,0.0196,0.0016,0.1156,0.0625,0.4225,0.49,0.0676,0.1521,0.01,0.3969,0.81,0.1225,0.0121,0.0169,0.1444,0.7396,0.1296,0.154157143,0.052835714,0.255478571,22,68.75,25,78.13,7,87.5,5,62.5,6,75,7,87.5,14,87.5,11,68.75,79.56,73.88,84,81,79.38,83.5,75.62,-9.38,1.43,-13.62,21.5,6,-8.12,-4,6.87,0,0,0,2,0,1,1,1,0,1,0,0,1,2,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,2,2,1,0,0.4,0.8,0.6,0.6,0,0.2,0.2,1.4,0.6,0.45,3.33,1.67,1,2,2,2,1.66,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),46,1.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,2,0,0,1,1,0,1,0,0,1,1,0,-1,-1,-1,-1,0,0.4,0.6,0.4,-0.8,0.15,grad_prof +376,R_6CIbrBjMX2IaGzx,32 - 38,Canadian,Male,0,3,2,2,3,3,2,2,1,2,2,2,3,3,0,1,2,2,2,2,1,2,2,2,1,8,1,2,0,3,2,8,3,2,1,2,1,8,2,1,1,2,2,7,0,3,1,3,3,8,3,2,3,0,1,8,2,2,2,2,3,8,2,2,2,2,0,8,TRUE,0,70,TRUE,1,66,TRUE,0,87,FALSE,1,88,TRUE,1,79,FALSE,1,82,FALSE,0,78,FALSE,0,87,TRUE,1,83,TRUE,1,84,FALSE,1,82,TRUE,0,96,TRUE,1,91,FALSE,1,89,FALSE,0,75,TRUE,1,97,TRUE,0,93,TRUE,0,91,FALSE,1,93,FALSE,1,95,FALSE,0,87,TRUE,1,97,FALSE,1,93,TRUE,1,98,TRUE,0,95,FALSE,0,90,TRUE,0,91,TRUE,0,90,FALSE,1,91,TRUE,1,90,FALSE,0,97,FALSE,0,90,0.7569,0.81,0.0009,0.6084,0.81,0.0324,0.0004,0.0256,0.0025,0.0009,0.01,0.0081,0.0289,0.0324,0.0441,0.1156,0.0049,0.0144,0.81,0.9025,0.7569,0.5625,0.0049,0.0121,0.8649,0.8281,0.9409,0.49,0.7569,0.8281,0.0081,0.9216,0.350632143,0.080728571,0.620535714,20,62.5,17,53.13,5,62.5,5,62.5,3,37.5,4,50,9,56.25,8,50,87.97,84.38,88.25,86.75,92.5,86.81,89.12,9.37,34.84,21.88,25.75,49.25,42.5,30.56,39.12,1,1,0,0,2,2,0,2,2,0,1,0,2,1,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,3,1,0,0,0,2,0.8,1.2,1,0.6,0.4,0.6,1,0.6,0.9,0.65,8,8,0,0,0,-1,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),36,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,1,1,-1,-1,2,2,0,1,1,-1,1,0,1,0,-2,0,1,1,0,-2,0.4,0.6,0,0,0.25,grad_prof +377,R_3OAVX3Wn1zJHxFj,46 - 52,Canadian,Female,1,2,-2,0,2,1,-3,3,-2,-2,3,1,1,0,3,2,2,2,1,-2,0,2,-1,1,2,5,0,-2,2,-1,-2,6,2,2,2,-2,2,5,2,2,2,2,2,5,1,2,0,0,1,5,-1,-2,1,-1,1,5,2,2,1,2,2,5,2,2,2,2,0,5,FALSE,1,92,TRUE,1,70,TRUE,0,100,TRUE,0,74,FALSE,0,71,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,0,55,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,52,FALSE,0,100,TRUE,0,100,TRUE,0,90,FALSE,1,83,FALSE,1,72,TRUE,1,91,TRUE,1,53,TRUE,0,81,FALSE,0,93,TRUE,0,84,TRUE,1,100,TRUE,0,59,TRUE,0,100,TRUE,0,83,TRUE,1,81,FALSE,0,95,TRUE,1,94,0,0,1,0.0081,0.0036,0,0.8649,0,0.0784,0.2209,0.0361,0,0.0081,0.3025,0.5041,0.09,0.6561,0.5476,1,0.7056,0.0081,0.2304,0.0289,1,1,0.3481,0.9025,0.0064,1,0.81,0.6889,1,0.430042857,0.236592857,0.623492857,16,50,16,50,4,50,4,50,5,62.5,3,37.5,12,75,4,25,86.09,72.38,90,88.75,93.25,86.38,85.81,0,36.09,22.38,40,26.25,55.75,11.38,60.81,1,0,1,1,0,1,1,1,1,0,1,1,1,2,1,0,0,0,1,4,0,0,2,0,1,2,1,2,1,3,1,1,0,2,1,0,0,0,1,2,0.6,0.8,1.2,1,0.6,1.8,1,0.6,0.9,1,5.33,5,0,1,0,0,0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,1,0,-1,1,-1,-1,0,-1,0,-3,0,0,1,0,0,0,0,0,0,2,0,-1,0.2,0.4,-0.1,C_Ug +378,R_7mdm9AY0zbSba49,18 - 24,American,Female,0,1,0,-1,1,-2,-1,1,2,2,2,-1,3,0,3,-3,-2,-2,-3,-3,3,2,0,1,0,5,-3,-2,-2,-1,0,5,2,-1,3,0,3,1,0,0,1,-3,1,8,1,1,1,-2,1,4,-1,-2,2,-1,1,4,2,-1,3,0,3,0,0,0,1,0,-1,8,FALSE,1,100,TRUE,1,52,FALSE,1,76,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,94,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,0,63,FALSE,0,67,TRUE,1,100,FALSE,1,52,FALSE,1,80,TRUE,0,68,FALSE,1,85,FALSE,0,64,FALSE,0,55,FALSE,1,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,TRUE,0,74,TRUE,0,62,TRUE,0,100,FALSE,0,74,FALSE,0,53,FALSE,0,100,0.0001,0,0,0,1,0,0.0001,0.04,0.0225,0.3025,0.5476,0.0016,0.0036,0.25,0,0.2304,0,0.2304,0.3844,0,0.4096,0.4489,0.4624,0.3969,0.2304,0.5476,0.2809,0,0.0576,0.04,1,0.25,0.254907143,0.187764286,0.32205,26,81.25,21,65.63,4,50,5,62.5,6,75,6,75,10,62.5,11,68.75,79.53,63.75,89,84.75,80.62,83.31,75.75,15.62,13.9,13.75,26.5,9.75,5.62,20.81,7,3,1,0,2,1,1,1,3,3,2,0,0,0,0,0,3,2,3,0,4,1,0,1,1,0,1,1,1,3,1,0,0,0,0,0,3,2,3,3,2,1.4,2,0,2.4,0.6,1.4,0,2.6,1.45,1.15,3.67,2.67,1,1,1,0,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,23,1.125,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,1,-1,1,1,0,0,2,0,1,0,0,0,0,0,0,0,0,-3,2,0.8,0.6,0,-0.2,0.3,C_Ug +379,R_5KNnaSA3QeWeCr9,60 - 66,American,Female,3,3,3,3,3,-3,1,1,1,-2,2,3,3,1,3,2,1,2,2,0,3,3,3,3,3,0,-3,2,1,2,-3,2,3,3,3,0,3,1,0,-1,0,0,-1,6,3,3,3,3,-1,1,-3,2,1,2,-3,0,3,3,3,-2,3,0,0,0,0,1,1,5,FALSE,1,100,TRUE,1,90,TRUE,0,95,FALSE,1,67,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,TRUE,0,78,TRUE,1,73,TRUE,0,100,TRUE,1,74,TRUE,1,100,TRUE,0,83,TRUE,0,100,TRUE,0,84,FALSE,1,100,TRUE,1,85,TRUE,1,93,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,59,FALSE,1,57,TRUE,0,81,TRUE,1,100,FALSE,0,57,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0049,0,0.0729,0.0025,0,0,0.01,1,0.1089,0.1849,0,0.0225,0.0676,0.7056,1,0.6889,0.3481,0.3249,0,0.9025,1,0.6561,0.6084,0.275310714,0.085657143,0.464964286,27,84.38,22,68.75,5,62.5,5,62.5,6,75,6,75,15,93.75,7,43.75,89.72,78.25,90.25,99.12,91.25,91.69,87.75,15.63,20.97,15.75,27.75,24.12,16.25,-2.06,44,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,2,2,2,2,1,0,0,0,0,4,0,1,0,1,1,1,0,0,3,0,2,1,2,1,1,0,0.6,0.4,1.8,0.8,0.6,0.8,1.4,0.7,0.9,1,0.33,-1,2,1,1,0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),63,1.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,-4,0,0,0,0,0,0,0,0,-2,0,0,1,0,1,0,-0.8,0,-0.4,0.4,-0.2,HS_TS +380,R_3QFOR6F1kwh7Qjv,46 - 52,Canadian,Female,3,1,3,2,2,-3,-3,2,-2,1,1,1,1,1,2,1,1,1,1,0,2,1,3,2,2,5,-3,-3,2,-2,1,5,1,1,2,2,2,2,1,1,1,1,0,3,3,1,3,2,2,4,-3,-3,2,-2,2,2,1,1,2,0,2,2,1,1,1,1,1,2,FALSE,1,95,TRUE,1,98,FALSE,1,98,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,97,TRUE,1,98,TRUE,1,92,FALSE,1,50,TRUE,0,100,TRUE,1,98,FALSE,1,54,FALSE,0,50,TRUE,1,100,FALSE,1,93,TRUE,0,100,FALSE,1,56,FALSE,1,50,TRUE,1,97,TRUE,1,96,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,95,FALSE,1,50,FALSE,1,50,TRUE,0,97,FALSE,0,50,FALSE,0,50,TRUE,1,97,0.0009,0.0025,0,0.0016,0.0009,0,0.0081,0.0064,0.25,0.0016,0.25,0.0004,0.0004,0.25,0,0.0004,0,0.25,0.25,0,0.0009,0.25,0.1936,0.2116,0.0049,0.25,0.25,0.0025,0.0004,1,0.9409,1,0.191892857,0.072728571,0.311057143,28,87.5,26,81.25,6,75,7,87.5,7,87.5,6,75,13,81.25,13,81.25,82.75,62.75,97.75,91,79.5,87.81,77.69,6.25,1.5,-12.25,10.25,3.5,4.5,6.56,-3.56,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0.2,0,0.4,0,0,0.2,0.4,0.2,0.15,0.2,4,2.67,1,3,0,1,1.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,48,0.125,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,0.2,-0.2,0,-0.2,-0.05,C_Ug +381,R_5woH3iyCjf4hAY8,39 - 45,American,Female,3,-3,-3,-3,2,-1,-1,2,0,1,1,0,1,0,1,-2,-2,-2,-2,-1,3,1,1,-3,2,7,1,0,1,-1,1,7,2,1,0,-1,1,7,0,0,0,0,0,9,3,-2,-3,-3,3,2,2,-2,2,-2,1,3,1,-1,1,-1,0,2,1,0,1,1,1,8,TRUE,0,75,TRUE,1,94,FALSE,1,96,FALSE,1,80,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,0,93,FALSE,1,75,TRUE,0,100,FALSE,1,65,FALSE,1,63,FALSE,0,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,55,FALSE,1,83,FALSE,1,59,TRUE,1,99,TRUE,1,86,TRUE,1,100,0,0,0.8649,0,0,0,0,1,0.1369,0,0.0001,0,0,0,0.0225,0.0036,0,0.04,0.0289,0,0.4225,0.25,0.1225,0,0.0625,0.3025,0.0196,0.5625,0.0016,1,0.1681,1,0.183707143,0.085935714,0.281478571,20,62.5,24,75,6,75,7,87.5,5,62.5,6,75,12,75,12,75,88.22,78.75,85.5,96.88,91.75,92,84.44,-12.5,13.22,3.75,-2,34.38,16.75,17,9.44,0,4,4,0,0,2,1,1,1,0,1,1,1,1,0,2,2,2,2,1,0,1,0,0,1,3,1,0,2,0,0,1,0,1,1,3,2,3,3,2,1.6,1,0.8,1.8,0.4,1.2,0.6,2.6,1.3,1.2,7,2.33,5,4,5,1,4.67,10 cents,100 minutes,36 days,Female,High School (or equivalent),42,0.375,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,3,4,0,-1,-1,0,1,-1,0,1,0,1,0,-1,-1,0,-1,-1,-1,1.2,-0.2,0.2,-0.8,0.1,HS_TS +382,R_7vJeWfEssRlpo9r,32 - 38,Canadian,Female,3,3,2,-2,1,3,1,1,2,1,3,1,2,1,0,-1,0,1,2,0,-2,3,3,-3,3,5,0,0,0,0,0,5,0,0,0,0,0,8,0,0,0,0,0,7,3,3,3,0,3,5,3,3,3,2,0,7,1,2,3,0,1,8,1,1,2,2,2,7,TRUE,0,90,TRUE,1,50,FALSE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,76,TRUE,1,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,83,FALSE,1,100,TRUE,0,89,TRUE,0,50,TRUE,1,78,TRUE,1,100,FALSE,1,65,TRUE,1,100,TRUE,0,69,TRUE,1,92,TRUE,0,67,FALSE,1,50,TRUE,0,63,FALSE,0,50,FALSE,0,50,TRUE,1,96,0,0.0064,0,0.0196,0.0016,0.0576,0,0,0.25,0,0.25,0,0,0.25,0,0.25,0.1225,0.2025,0.25,0.4761,0.0484,0,0.7921,1,0.0289,0.4489,0.25,0.81,0,0,0.3969,0,0.210196429,0.098871429,0.321521429,16,50,22,68.75,4,50,7,87.5,5,62.5,6,75,14,87.5,8,50,81.53,70.12,82.62,92.12,81.25,87.62,75.44,-18.75,12.78,20.12,-4.88,29.62,6.25,0.12,25.44,5,0,1,1,2,3,1,1,2,1,3,1,2,1,0,1,0,1,2,0,0,0,1,2,2,0,2,2,0,1,2,1,1,1,1,2,1,1,0,2,1.8,1.6,1.4,0.8,1,1,1.2,1.2,1.4,1.1,6,6.67,0,-2,0,0,-0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,33,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,0,0,-1,0,3,-1,-1,2,0,1,0,1,0,-1,-1,-1,0,2,-2,0.8,0.6,0.2,-0.4,0.3,C_Ug +383,R_7cZeMbi0x1TzwVz,39 - 45,American,Male,0,3,2,0,3,0,-3,3,-3,1,3,2,2,1,0,2,2,3,2,-1,-2,3,3,-1,3,4,2,-3,2,-2,1,6,3,-1,3,3,-2,4,1,0,1,1,-1,7,2,3,2,2,3,1,1,-3,3,-3,1,0,3,3,3,-2,1,0,3,3,3,3,3,2,FALSE,1,100,TRUE,1,74,FALSE,1,70,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,78,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,87,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,0,0,0,0,0,0,0,0,0,1,0.0484,0,0,0.0676,0,0,0.0625,0,0,0,0,0.0169,0,0,1,0,0.09,0,1,0,0.117335714,0.079714286,0.154957143,31,96.88,28,87.5,7,87.5,6,75,8,100,7,87.5,13,81.25,15,93.75,96.38,94,100,98.38,93.12,97,95.75,9.38,8.88,6.5,25,-1.62,5.62,15.75,2,2,0,1,1,0,2,0,1,1,0,0,3,1,2,2,1,2,2,1,0,2,0,0,2,0,1,0,0,0,0,0,1,1,3,1,1,1,0,1,4,0.8,0.8,1.6,1.2,0.8,0.2,1.2,1.4,1.1,0.9,4.67,0.33,3,6,4,5,4.34,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),44,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,1,-1,0,1,0,1,1,0,0,2,0,-1,1,0,1,2,0,-4,0,0.6,0.4,-0.2,0.2,grad_prof +384,R_37dqDNnecMDxKoa,25 - 31,Canadian,Male,2,3,1,-2,3,-1,-1,1,0,2,1,2,2,1,2,-3,2,0,-1,-1,2,2,2,0,3,4,-2,-2,1,1,2,5,2,1,1,1,3,7,0,2,1,1,0,4,2,3,1,0,2,2,1,-1,2,-2,2,6,1,2,2,2,2,3,2,2,2,2,0,8,FALSE,1,98,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,65,FALSE,1,98,TRUE,1,98,TRUE,1,98,TRUE,1,75,FALSE,0,75,FALSE,1,75,TRUE,0,99,TRUE,1,95,FALSE,1,95,FALSE,0,77,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,98,TRUE,0,55,TRUE,1,100,TRUE,0,50,FALSE,1,99,TRUE,0,76,FALSE,0,80,FALSE,0,60,TRUE,1,92,0.0004,0,0,0.0004,0.0064,0.0004,0.0004,0.5625,0.25,0,0.64,0.0025,0.0625,0.0625,0.1225,0.25,0,0.25,0.0001,0.3025,0.0009,0.5929,0.25,0.0025,0.25,0.25,0.36,0.0004,0.36,1,0.5776,0.9801,0.254882143,0.157835714,0.351928571,24,75,20,62.5,4,50,6,75,5,62.5,5,62.5,12,75,8,50,80.16,60.88,84.12,90.12,85.5,85,75.31,12.5,17.66,10.88,9.12,27.62,23,10,25.31,0,1,1,2,0,1,1,0,1,0,1,1,1,0,1,3,0,1,2,1,0,0,0,2,1,2,0,1,2,0,0,0,0,1,0,5,0,2,3,1,0.8,0.6,0.8,1.4,0.6,1,0.2,2.2,0.9,1,5.33,3.67,2,-1,4,-4,1.66,5 cents,5 minutes,47 days,Male,High School (or equivalent),26,0.5,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,1,1,0,-1,-1,1,-1,-1,0,1,1,1,-1,1,-2,0,-1,-1,0,0.2,-0.4,0.6,-0.8,-0.1,HS_TS +385,R_7B3ymhEs2PX8Sys,46 - 52,American,Male,-1,3,1,1,1,-1,-2,1,0,2,3,-2,3,-2,3,1,1,2,2,3,0,3,0,0,-1,4,-2,2,2,1,0,6,3,2,3,-2,3,3,3,3,3,3,3,3,0,2,0,1,1,1,-2,-1,2,0,0,3,3,-2,3,-2,3,0,2,1,2,1,3,0,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,65,TRUE,1,90,TRUE,1,75,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,75,FALSE,0,75,TRUE,0,92,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,86,TRUE,0,76,FALSE,1,100,TRUE,1,100,TRUE,1,91,TRUE,0,50,TRUE,1,64,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,75,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,1,93,0.0625,0.25,0,0.01,0.0049,0.1225,0.1296,0.0625,0,0.0081,0.0625,0.5625,0.25,0.25,0.25,0,0.25,0.25,0.0625,0.25,0,0.25,0.5776,0.8464,0.25,0.25,0.0625,1,0.25,0.7396,0.25,0.5625,0.269775,0.157328571,0.382221429,18,56.25,21,65.63,5,62.5,5,62.5,4,50,7,87.5,14,87.5,7,43.75,71.31,62.62,66.62,79.25,76.75,75.81,66.81,-9.38,5.68,0.12,4.12,29.25,-10.75,-11.69,23.06,1,0,1,1,2,1,4,1,1,2,0,4,0,0,0,2,2,1,1,0,1,1,1,0,0,1,1,1,0,2,0,0,0,0,0,1,0,0,1,0,1,1.8,0.8,1.2,0.6,1,0,0.4,1.2,0.5,4.33,1.33,3,3,3,3,3,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,47,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,-1,0,1,2,0,3,0,1,0,0,4,0,0,0,1,2,1,0,0,0.4,0.8,0.8,0.8,0.7,C_Ug +386,R_6TBfmZR2s5RGLyV,32 - 38,Canadian,Female,3,1,3,3,2,2,2,3,1,2,2,1,3,2,2,2,2,2,3,3,2,1,3,2,2,8,1,2,2,2,3,8,3,2,1,2,3,7,3,1,2,2,2,8,3,2,2,1,2,8,3,3,3,2,2,8,1,2,1,2,2,8,3,2,1,1,2,7,TRUE,0,85,TRUE,1,78,TRUE,0,74,TRUE,0,74,TRUE,1,62,TRUE,0,68,TRUE,1,77,TRUE,1,70,TRUE,1,81,TRUE,1,73,TRUE,0,74,TRUE,0,71,TRUE,1,68,TRUE,0,76,TRUE,1,83,TRUE,1,72,TRUE,0,67,TRUE,0,67,TRUE,0,70,TRUE,0,79,TRUE,1,69,FALSE,0,83,FALSE,1,77,TRUE,1,80,TRUE,0,74,TRUE,1,79,TRUE,0,66,TRUE,0,86,TRUE,0,69,TRUE,1,91,TRUE,1,79,TRUE,1,70,0.09,0.0441,0.0784,0.0529,0.09,0.4624,0.04,0.0729,0.6241,0.6889,0.0081,0.1024,0.0361,0.5476,0.1444,0.0484,0.0529,0.5476,0.7396,0.5476,0.0961,0.0289,0.49,0.5776,0.4489,0.4356,0.0441,0.7225,0.5476,0.4489,0.4761,0.5041,0.341907143,0.247557143,0.436257143,27,84.38,16,50,4,50,5,62.5,3,37.5,4,50,15,93.75,1,6.25,74.75,75.62,68.75,76.75,77.88,75.94,73.56,34.38,24.75,25.62,6.25,39.25,27.88,-17.81,67.31,1,0,0,1,0,1,0,1,1,1,1,1,2,0,1,1,1,0,1,1,0,1,1,2,0,1,1,0,1,0,1,1,2,0,0,1,0,1,2,1,0.4,0.8,1,0.8,0.8,0.6,0.8,1,0.75,0.8,7.67,8,0,0,-1,1,-0.33,10 cents,75 minutes,24 days,Female,College Diploma/Certificate,34,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,-1,-1,-1,0,0,-1,1,0,1,0,0,0,0,1,0,1,-1,-1,0,-0.4,0.2,0.2,-0.2,-0.05,C_Ug +387,R_13pgamghMYPOZF4,67 - 73,American,Male,2,2,0,2,0,-1,-1,0,-1,1,-1,0,1,0,2,0,0,1,-1,1,2,2,0,2,0,6,-1,-1,1,-2,0,2,0,0,0,0,1,4,0,0,2,1,1,1,2,2,-1,2,-2,3,-2,-1,1,-1,0,5,0,1,1,0,1,5,0,0,2,1,1,5,TRUE,0,90,TRUE,1,92,TRUE,0,100,FALSE,1,59,TRUE,1,58,FALSE,1,95,TRUE,1,78,TRUE,1,95,TRUE,1,89,TRUE,1,82,FALSE,1,92,TRUE,0,96,FALSE,0,96,FALSE,1,94,FALSE,0,50,TRUE,1,94,FALSE,1,89,TRUE,0,98,FALSE,1,98,FALSE,1,98,TRUE,1,100,FALSE,0,90,TRUE,0,71,TRUE,1,69,FALSE,1,93,TRUE,1,100,TRUE,0,50,FALSE,1,88,TRUE,0,92,FALSE,0,97,FALSE,0,84,TRUE,1,90,0.0025,0,0.0036,0.0484,0.01,0.0025,0.0961,0.0324,0.0004,0.81,0.9409,0.9216,0.0121,0.0064,0.1764,0.0064,0.5041,0.1681,0.0144,0.0049,0,0.25,0.0004,0.0036,0.0121,0.25,0.7056,0.81,1,0.9604,0.8464,0.9216,0.3381,0.263385714,0.412814286,17,53.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,11,68.75,9,56.25,86.47,76.75,86.38,90.62,92.12,85.25,87.69,-9.37,23.97,14.25,23.88,28.12,29.62,16.5,31.44,0,0,0,0,0,0,0,1,1,1,1,0,1,0,1,0,0,1,2,0,0,0,1,0,2,1,0,1,0,1,1,1,0,0,1,0,0,1,2,0,0,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.45,0.6,4,4.33,3,-3,-1,-4,-0.33,5 cents,5 minutes,47 days,Male,Trade School (non-military),71,0.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,-2,-1,0,0,1,0,0,-1,1,0,0,0,0,0,0,0,-0.6,0,0,0,-0.15,HS_TS +388,R_5VvG2RgUCE91pSh,32 - 38,American,Male,2,2,3,3,-1,2,0,1,-2,2,0,2,2,1,-1,1,2,2,3,1,2,1,1,2,2,6,2,2,1,1,2,2,3,1,2,2,1,8,3,2,0,1,2,3,2,2,2,3,-3,3,1,0,0,1,2,1,1,-1,0,2,1,2,2,2,2,2,1,3,TRUE,0,100,FALSE,0,76,FALSE,1,100,FALSE,1,100,FALSE,0,79,TRUE,0,85,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,83,TRUE,0,100,TRUE,1,85,FALSE,1,79,FALSE,0,84,FALSE,0,88,FALSE,1,78,TRUE,0,100,FALSE,1,80,TRUE,0,100,FALSE,0,79,FALSE,0,92,FALSE,1,67,TRUE,1,85,TRUE,0,78,TRUE,1,82,FALSE,1,91,TRUE,0,86,FALSE,1,78,TRUE,1,93,FALSE,0,81,FALSE,0,100,0,0.0324,0.7744,0,1,0.7225,0.0225,0,1,0.8464,0.0049,0.0225,0.0625,0.0289,0.6241,0.5776,0.1089,0,0.7396,0.6084,0.6241,0.7056,0.04,0.0441,0.0484,0.0081,0.6561,1,0,1,0.0484,1,0.412271429,0.358628571,0.465914286,24,75,17,53.13,5,62.5,4,50,4,50,4,50,8,50,9,56.25,87.62,83.75,81.38,91.38,94,87.44,87.81,21.87,34.49,21.25,31.38,41.38,44,37.44,31.56,0,1,2,1,3,0,2,0,3,0,3,1,0,1,2,2,0,2,2,1,0,0,1,0,2,1,0,1,3,0,1,3,2,1,2,1,0,0,1,0,1.4,1,1.4,1.4,0.6,1,1.8,0.4,1.3,0.95,5.33,2,3,1,6,0,3.33,10 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),36,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,1,1,1,1,-1,2,-1,0,0,2,-2,-2,0,0,1,0,2,1,1,0.8,0,-0.4,1,0.35,grad_prof +389,R_6SITLWWJmtAriTQ,67 - 73,American,Female,2,2,2,-1,2,-2,-2,3,-2,1,2,2,2,-1,3,2,2,2,2,2,2,2,2,-2,2,0,-2,-1,2,-1,2,0,2,2,2,-1,2,0,2,2,2,2,2,0,2,2,2,-1,2,0,-2,-2,2,-2,2,0,2,2,2,-1,2,0,2,2,2,2,2,0,TRUE,0,98,TRUE,1,100,FALSE,1,100,FALSE,1,77,TRUE,1,76,FALSE,1,73,TRUE,1,100,FALSE,0,70,FALSE,0,78,TRUE,1,100,FALSE,1,73,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,82,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,84,FALSE,1,100,FALSE,0,100,FALSE,0,82,FALSE,1,92,TRUE,1,83,TRUE,0,100,TRUE,1,81,TRUE,0,81,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,52,TRUE,1,100,0.49,0.0361,0,0,0,0.0729,0.0289,0,0,0.6724,0,0,0.6084,0.0729,0.0576,0,0.0064,0.0529,1,1,1,0.6724,0.7056,1,0,0.6561,0.2704,0.9604,0,1,0,1,0.387046429,0.112314286,0.661778571,13,40.63,18,56.25,3,37.5,7,87.5,3,37.5,5,62.5,10,62.5,8,50,90.06,78.38,92.62,95.12,94.12,87.75,92.38,-15.62,33.81,40.88,5.12,57.62,31.62,25.25,42.38,0,0,0,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0.2,0.8,0.2,0,0,0.4,0.2,0,0.3,0.15,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0,0.15,HS_TS +390,R_1L13XK3l1GnM7R3,60 - 66,Canadian,Female,0,0,0,-1,0,0,0,1,0,1,0,3,3,0,3,0,0,1,0,-1,1,0,1,1,1,6,0,0,0,0,0,5,0,3,3,0,3,5,0,1,0,0,-1,6,0,0,0,-2,-1,5,0,0,0,-1,0,4,0,3,3,0,3,5,0,-1,0,-1,-2,5,TRUE,0,67,FALSE,0,71,TRUE,0,95,FALSE,1,77,FALSE,0,67,FALSE,1,90,FALSE,0,55,TRUE,1,85,FALSE,0,66,TRUE,1,81,TRUE,0,69,TRUE,0,97,TRUE,1,67,FALSE,1,63,TRUE,1,77,TRUE,1,96,TRUE,0,91,TRUE,0,100,TRUE,0,75,TRUE,0,90,FALSE,0,100,TRUE,1,62,FALSE,1,56,TRUE,1,92,TRUE,0,86,TRUE,1,100,TRUE,0,63,TRUE,0,100,TRUE,0,86,TRUE,1,98,FALSE,0,51,TRUE,1,100,0.0225,0,0.0016,0.3025,0,0.01,0.0064,0.0361,0.81,0.1444,0.0004,0.1089,0.4356,0.4761,0.4489,0.5041,0.1936,0.0529,1,0.7396,1,0.0529,0.5625,0.1369,0.8281,0.3969,0.2601,0.4489,0.9025,1,0.7396,0.9409,0.437010714,0.230528571,0.643492857,18,56.25,14,43.75,2,25,4,50,4,50,4,50,10,62.5,4,25,80.41,68.62,82.12,76.75,94.12,79.25,81.56,12.5,36.66,43.62,32.12,26.75,44.12,16.75,56.56,1,0,1,2,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0.4,0,0.4,0.4,0.6,0,0.8,0.45,0.45,5.33,4.67,1,1,0,1,0.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),61,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,0,1,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,-1,0.6,-0.2,0,-0.4,0,HS_TS +391,R_1JquTUde1fPhKN1,53 - 59,American,Female,2,3,3,2,2,-1,-1,-2,-3,1,-1,-3,3,-3,3,0,-1,1,0,1,3,3,3,3,3,1,-1,-1,-1,-3,0,4,0,-3,3,-3,3,3,0,1,0,0,0,5,3,3,3,3,3,7,-2,-1,-1,-3,2,5,-1,-3,3,-3,3,2,0,0,0,0,0,7,TRUE,0,80,TRUE,1,98,FALSE,1,100,TRUE,0,55,TRUE,1,98,FALSE,1,98,FALSE,0,83,TRUE,1,100,TRUE,1,84,TRUE,1,96,FALSE,1,100,TRUE,0,86,TRUE,1,87,FALSE,1,93,TRUE,1,74,TRUE,1,90,TRUE,0,87,TRUE,0,92,FALSE,1,78,FALSE,1,100,FALSE,0,92,TRUE,1,97,FALSE,1,100,TRUE,1,89,FALSE,1,100,TRUE,1,69,TRUE,0,77,FALSE,1,85,TRUE,0,95,TRUE,1,75,TRUE,1,99,TRUE,1,99,0,0.0961,0.01,0.6889,0.0001,0.0004,0.0121,0.0016,0,0.0009,0.0625,0.0169,0.0256,0,0.0004,0.0004,0,0.3025,0.0225,0,0.8464,0.0676,0.0484,0.0049,0.7569,0.5929,0.0001,0.64,0,0.8464,0.9025,0.7396,0.210414286,0.030242857,0.390585714,23,71.88,23,71.88,6,75,5,62.5,5,62.5,7,87.5,14,87.5,9,56.25,89.25,83.12,94.5,88.75,90.62,89.38,89.12,0,17.37,8.12,32,26.25,3.12,1.88,32.87,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,1,1,0,1,0.6,0.4,0.2,0.8,0.6,0.6,0,0.6,0.5,0.45,2.67,4.67,-6,-1,1,-2,-2,10 cents,100 minutes,15 days,Female,University - Graduate (Masters),53,1,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,-0.2,0.2,0.2,0.05,grad_prof +392,R_5HoRkWGs8yCWtI1,53 - 59,American,Male,-2,3,3,2,3,1,0,3,-1,1,-2,3,3,3,2,0,0,2,0,2,-3,3,3,2,-2,10,-3,1,2,-3,-3,8,1,1,0,1,0,2,1,-1,0,0,1,5,-3,3,3,3,3,2,2,-1,2,0,0,10,0,2,2,2,2,4,3,3,3,3,3,9,TRUE,0,100,FALSE,0,71,FALSE,1,99,TRUE,0,69,FALSE,0,100,FALSE,1,99,FALSE,0,100,FALSE,0,82,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,98,FALSE,0,72,FALSE,1,100,FALSE,0,100,TRUE,1,91,FALSE,1,100,TRUE,0,100,TRUE,0,73,FALSE,1,100,FALSE,0,100,FALSE,0,66,FALSE,1,77,FALSE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,FALSE,1,86,FALSE,0,99,FALSE,0,100,TRUE,1,100,0.6724,0,0.0081,1,0,0.0001,0.4096,0,0,0.4356,0.9801,0.5184,0.0196,0,1,0.5041,0.0529,0.4761,1,1,1,1,0.5329,0,0,0.7569,1,1,0.0001,1,0.0196,0.9604,0.488085714,0.314035714,0.662135714,21,65.63,13,40.63,2,25,5,62.5,3,37.5,3,37.5,5,31.25,8,50,91.22,85.75,91.75,95.75,91.62,89.44,93,25,50.59,60.75,29.25,58.25,54.12,58.19,43,1,0,0,0,5,4,1,1,2,4,3,2,3,2,2,1,1,2,0,1,1,0,0,1,0,1,1,1,1,1,2,1,1,1,0,3,3,1,3,1,1.2,2.4,2.4,1,0.4,1,1,2.2,1.75,1.15,6.67,5.33,8,-2,-2,-4,1.34,10 cents,75 minutes,47 days,Male,High School (or equivalent),56,-0.625,0,0,1,1,0,0,0.33,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,-1,5,3,0,0,1,3,1,1,2,1,2,-2,-2,1,-3,0,0.8,1.4,1.4,-1.2,0.6,HS_TS +393,R_5rNELR6ehTmOSux,39 - 45,American,Female,0,2,3,2,3,-2,2,0,2,2,-2,-3,2,0,2,-3,-3,-3,0,-3,2,2,2,2,3,5,-2,1,2,1,2,6,0,-3,3,0,0,5,-1,-1,0,1,-2,7,2,2,2,2,2,6,0,0,1,-1,1,6,0,-3,3,1,2,5,1,0,1,1,0,8,TRUE,0,90,TRUE,1,73,FALSE,1,100,FALSE,1,50,TRUE,1,99,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,91,TRUE,1,99,FALSE,1,50,TRUE,0,93,TRUE,1,97,TRUE,0,83,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,94,TRUE,0,82,FALSE,1,62,TRUE,1,76,TRUE,1,100,FALSE,1,100,FALSE,0,68,FALSE,1,100,TRUE,1,80,TRUE,0,59,FALSE,1,60,TRUE,0,72,TRUE,1,77,FALSE,0,58,TRUE,1,93,0,0.04,0,0.0016,0.0049,0,0.4624,0.0001,0.1444,0,0.0529,0.0009,0.0081,0.25,0.0001,0.0729,0,0.25,0.16,0,0.0576,0.25,0.6724,0.6889,0.25,0.3481,0.3364,0.81,0,0.8836,0.5184,0.8649,0.253107143,0.08905,0.417164286,23,71.88,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,81.31,64.12,85.88,92.75,82.5,84.81,77.81,0,9.43,1.62,-1.62,30.25,7.5,-2.69,21.56,2,0,1,0,0,0,1,2,1,0,2,0,1,0,2,2,2,3,1,1,2,0,1,0,1,2,2,1,3,1,2,0,1,1,0,4,3,4,1,3,0.6,0.8,1,1.8,0.8,1.8,0.8,3,1.05,1.6,5.33,5.67,-1,0,0,-1,-0.34,10 cents,5 minutes,47 days,Female,University - Undergraduate,39,0.75,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,-1,-2,-1,1,-2,-1,0,0,0,-1,2,-2,-1,-1,0,-2,-0.2,-1,0.2,-1.2,-0.55,C_Ug +394,R_3stWU9kNbJvpNuW,39 - 45,American,Female,2,3,2,1,3,0,1,3,1,1,1,-1,2,-1,3,0,1,1,1,0,2,3,2,1,3,7,2,0,3,0,1,5,2,-1,3,-1,3,5,0,1,1,0,0,5,2,3,2,2,3,5,0,1,3,1,0,5,2,0,1,-3,3,5,0,1,0,1,-1,6,TRUE,0,100,TRUE,1,100,TRUE,0,96,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,TRUE,1,95,FALSE,1,50,TRUE,0,86,TRUE,1,67,FALSE,1,100,TRUE,1,98,TRUE,1,96,TRUE,0,81,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,77,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,87,TRUE,0,100,TRUE,1,98,FALSE,0,50,TRUE,1,100,0,0,0.0016,0,0,0,0.0529,0.0025,0.25,0,0.0004,0.1089,0.5776,0.25,0,0,0,0.25,0.7569,1,0.49,0.0004,0.25,0,0.6561,1,0.25,1,0.9216,1,1,0.7396,0.377032143,0.106592857,0.647471429,16,50,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,13,81.25,7,43.75,86.78,71.75,89.75,99.38,86.25,89.19,84.38,-12.5,24.28,9.25,27.25,36.88,23.75,7.94,40.63,0,0,0,0,0,2,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,2,0,0,0,1,0,1,0,0.8,0.4,0.2,0.2,0.2,1,0.4,0.35,0.45,5.67,5,2,0,0,-1,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,44,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,2,1,0,1,-1,0,-1,0,-2,0,0,0,-1,1,-1,-0.2,0.6,-0.6,-0.2,-0.1,C_Ug +395,R_6ogKWHZARE6wFR9,53 - 59,American,Male,2,1,3,1,-1,-2,-2,2,1,-1,1,1,2,1,2,-1,-2,1,1,-1,2,1,2,1,-2,4,-2,-2,2,2,-1,8,2,2,2,1,2,3,-2,-1,-2,-2,-2,2,2,1,2,2,-1,2,-2,-2,2,1,1,2,1,-1,3,-1,2,2,-1,-1,1,-1,-2,7,TRUE,0,81,TRUE,1,92,TRUE,0,81,FALSE,1,65,TRUE,1,79,FALSE,1,82,TRUE,1,81,TRUE,1,79,TRUE,1,97,TRUE,1,92,FALSE,1,82,FALSE,1,93,FALSE,0,55,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,90,FALSE,1,87,TRUE,0,76,FALSE,1,100,TRUE,1,70,TRUE,1,85,FALSE,1,100,TRUE,1,92,FALSE,1,97,TRUE,1,96,TRUE,0,56,FALSE,1,99,TRUE,0,97,TRUE,1,100,FALSE,0,93,TRUE,1,100,0.0441,0.0016,0,0.0361,0,0.0324,0.0064,0.0064,0,0.0225,0,0.3025,0.0009,0.0324,0.0441,0.0064,0,0.1225,0.0001,0.0009,0.09,0.25,0.5776,0.36,0.01,0.3136,0.8649,0.6561,0.6561,0.0169,0.9409,0.0049,0.189946429,0.041178571,0.338714286,26,81.25,23,71.88,4,50,6,75,6,75,7,87.5,13,81.25,10,62.5,84.59,76.38,84.12,84.88,93,85.06,84.12,9.37,12.71,26.38,9.12,9.88,5.5,3.81,21.62,0,0,1,0,1,0,0,0,1,0,1,1,0,0,0,1,1,3,3,1,0,0,1,1,0,0,0,0,0,2,0,2,1,2,0,0,1,0,2,1,0.4,0.2,0.4,1.8,0.4,0.4,1,0.8,0.7,0.65,5,2,2,6,1,-5,3,5 cents,5 minutes,47 days,Male,Trade School (non-military),57,1.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,-1,1,0,0,0,1,-2,1,-1,-1,-2,0,1,0,3,1,0,0,-0.2,-0.6,1,0.05,HS_TS +396,R_3FCIkOBSK5YMuPo,67 - 73,American,Female,3,3,3,1,-1,-3,-3,1,-3,-1,2,3,3,-2,3,-3,-2,-1,-1,-1,3,3,3,1,-1,0,-3,-3,1,-3,-3,1,2,3,3,-1,3,1,-3,-3,-3,-3,-3,1,3,3,3,1,-1,1,-3,-3,1,-3,0,2,2,3,3,-1,3,1,2,2,2,1,2,7,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,97,TRUE,1,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,FALSE,0,59,TRUE,1,100,FALSE,1,67,FALSE,1,78,TRUE,0,96,FALSE,1,100,TRUE,1,83,TRUE,1,95,TRUE,0,78,TRUE,1,100,FALSE,1,100,TRUE,1,79,FALSE,1,58,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0.0441,0,0,0,0.0009,0,0,0,0.0025,1,1,0.36,0,0,0,0.6084,0.16,0,0,0.0289,0.3481,0.9216,1,0.1089,0.1764,0,1,0,0.0484,1,1,0.313003571,0.2237,0.402307143,24,75,22,68.75,5,62.5,5,62.5,6,75,6,75,12,75,10,62.5,90.94,79.12,90.62,94,100,92.25,89.62,6.25,22.19,16.62,28.12,19,25,17.25,27.12,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,1,2,2,2,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,5,4,3,2,3,0,0.4,0.2,1.4,0,0.2,0.2,3.4,0.5,0.95,0.67,1.33,-1,-1,0,-6,-0.66,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,68,0.625,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,-5,-3,-1,0,-1,0,0.2,0,-2,-0.45,C_Ug +397,R_35HGnysLLLV4m2Z,25 - 31,American,Male,1,1,1,1,1,2,-2,2,-2,2,1,1,2,2,2,0,1,1,1,1,-2,1,1,-1,2,7,2,1,-1,1,2,7,-2,-1,1,2,-1,8,0,1,1,1,1,5,0,1,1,1,1,4,0,0,2,0,0,5,2,2,1,2,2,3,0,0,0,0,1,5,FALSE,1,90,TRUE,1,92,TRUE,0,84,FALSE,1,78,TRUE,1,85,FALSE,1,98,TRUE,1,88,TRUE,1,93,TRUE,1,78,TRUE,1,83,FALSE,1,76,FALSE,1,67,FALSE,0,86,TRUE,0,88,TRUE,1,80,TRUE,1,82,FALSE,1,77,FALSE,1,56,FALSE,1,75,FALSE,1,66,FALSE,0,66,TRUE,1,77,TRUE,0,66,TRUE,1,85,TRUE,0,88,TRUE,1,90,FALSE,1,62,FALSE,1,81,TRUE,0,84,TRUE,1,86,FALSE,0,76,TRUE,1,87,0.0049,0.01,0.0324,0.0144,0.0169,0.0004,0.0225,0.0289,0.1156,0.0529,0.0196,0.7396,0.0484,0.0576,0.0225,0.0064,0.4356,0.0484,0.0361,0.7744,0.4356,0.04,0.0625,0.7744,0.0529,0.1444,0.5776,0.01,0.7056,0.1936,0.7056,0.1089,0.222746429,0.115378571,0.330114286,21,65.63,24,75,7,87.5,4,50,6,75,7,87.5,13,81.25,11,68.75,80.31,77.12,81.12,82.5,80.5,83.38,77.25,-9.37,5.31,-10.38,31.12,7.5,-7,2.13,8.5,3,0,0,2,1,0,3,3,3,0,3,2,1,0,3,0,0,0,0,0,1,0,0,0,0,2,2,0,2,2,1,1,1,0,0,0,1,1,1,0,1.2,1.8,1.8,0,0.2,1.6,0.6,0.6,1.2,0.75,7.33,4,3,2,5,0,3.33,10 cents,5 minutes,15 days,Male,University - Undergraduate,26,0.875,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,0,0,2,1,-2,1,3,1,-2,2,1,0,0,3,0,-1,-1,-1,0,1,0.2,1.2,-0.6,0.45,C_Ug +398,R_3fkKyOckODVypDZ,53 - 59,American,Male,2,0,1,1,1,-3,1,2,-1,0,-1,0,2,-3,0,0,1,0,0,-1,2,-1,1,1,1,5,-3,2,2,-1,-2,5,0,2,1,2,-1,6,-1,-1,0,-1,0,8,2,2,2,2,2,5,-3,1,2,-2,-2,5,-1,0,2,-3,-2,6,0,0,1,0,0,8,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,83,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,57,TRUE,1,100,TRUE,0,50,TRUE,1,67,TRUE,0,50,TRUE,0,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.1089,0,0.2304,0,0.25,0,0,0,0,0,0,0,0,0.25,0.25,0.3249,0.25,0.3721,0.25,0.25,0.25,1,0,0,0.25,0,0.25,0,1,0,0.6889,0.201282143,0.094635714,0.307928571,13,40.63,22,68.75,5,62.5,6,75,5,62.5,6,75,14,87.5,8,50,80.31,75,75.88,77.38,93,82.44,78.19,-28.12,11.56,12.5,0.88,14.88,18,-5.06,28.19,0,1,0,0,0,0,1,0,0,2,1,2,1,5,1,1,2,0,1,1,0,2,1,1,1,0,0,0,1,2,0,0,0,0,2,0,1,1,0,1,0.2,0.6,2,1,1,0.6,0.4,0.6,0.95,0.65,5.33,5.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,-1,-1,-1,-1,0,1,0,-1,0,1,2,1,5,-1,1,1,-1,1,0,-0.8,0,1.6,0.4,0.3,HS_TS +399,R_6jizLscD9XqNAo9,39 - 45,Canadian,Female,3,3,2,2,1,2,3,2,0,1,3,1,2,1,2,2,3,1,2,3,3,2,2,1,1,6,0,3,2,1,3,9,1,0,0,1,2,10,2,1,2,2,3,7,2,3,3,2,1,6,3,2,1,2,0,9,3,0,2,2,1,8,2,2,3,1,1,7,TRUE,0,93,FALSE,0,76,TRUE,0,100,TRUE,0,92,FALSE,0,71,FALSE,1,86,FALSE,0,69,TRUE,1,87,TRUE,1,69,FALSE,0,81,FALSE,1,72,TRUE,0,100,FALSE,0,65,FALSE,1,85,FALSE,0,80,FALSE,0,70,FALSE,1,72,TRUE,0,91,FALSE,1,72,TRUE,0,90,FALSE,0,68,FALSE,0,72,FALSE,1,80,FALSE,0,72,FALSE,1,86,TRUE,1,85,FALSE,1,79,TRUE,0,84,FALSE,1,63,TRUE,1,91,TRUE,1,83,TRUE,1,85,0.0169,0.0225,0.49,0.4761,0.0225,0.0196,0.5184,0.6561,0.81,0.5184,0.0081,0.4225,0.0961,0.0784,0.5041,0.5776,0.04,0.8464,0.7056,0.0196,0.4624,0.64,0.0784,0.0225,0.0784,0.0441,0.0289,0.8649,1,0.8281,0.1369,1,0.393857143,0.365585714,0.422128571,19,59.38,15,46.88,5,62.5,5,62.5,3,37.5,2,25,6,37.5,9,56.25,80.28,77.88,73.75,82.75,86.75,76.5,84.06,12.5,33.4,15.38,11.25,45.25,61.75,39,27.81,0,1,0,1,0,2,0,0,1,2,2,1,2,0,0,0,2,1,0,0,1,0,1,0,0,1,1,1,2,1,0,1,0,1,1,0,1,2,1,2,0.4,1,1,0.6,0.4,1.2,0.6,1.2,0.75,0.85,8.33,7.67,0,0,2,0,0.66,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),40,-0.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,-1,1,-1,1,0,1,-1,-1,-1,1,2,0,2,-1,-1,0,1,-1,-1,-2,0,-0.2,0.4,-0.6,-0.1,grad_prof +400,R_7G0P5PING61jNop,32 - 38,Canadian,Male,2,0,1,-1,-1,-1,0,0,0,0,0,-1,0,-2,1,0,-1,-1,0,-1,2,0,2,-1,-1,3,0,0,0,0,0,5,0,-1,0,-1,2,2,0,0,0,0,0,7,2,0,2,-1,0,2,-1,0,0,0,0,5,0,-1,0,-2,2,2,0,0,0,0,-1,5,FALSE,1,78,FALSE,0,50,TRUE,0,65,FALSE,1,50,FALSE,0,50,FALSE,1,57,FALSE,0,50,TRUE,1,90,TRUE,1,80,TRUE,1,75,FALSE,1,50,TRUE,0,85,FALSE,0,50,FALSE,1,93,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,78,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,73,TRUE,1,77,FALSE,0,50,FALSE,0,50,0.01,0.25,0.25,0.25,0.25,0.1849,0.25,0.0625,0.25,0.25,0.0529,0.25,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.0049,0.25,0.25,0.25,0.0484,0.4225,0.6084,0.5329,0.7225,0.256425,0.202878571,0.309971429,16,50,16,50,5,62.5,3,37.5,4,50,4,50,4,25,12,75,59.41,53.75,53.75,65.5,64.62,57.62,61.19,0,9.41,-8.75,16.25,15.5,14.62,32.62,-13.81,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0.2,0.2,0.4,0.6,0.4,0,0.2,0.4,0.35,0.25,3.33,3,1,0,0,2,0.33,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,37,0.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,-1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,-0.2,0.2,0.2,0.2,0.1,C_Ug +401,R_1QRtJlPZGiqAiX7,53 - 59,American,Male,1,2,2,2,1,-2,-2,1,-2,2,2,2,2,-3,3,1,1,2,2,1,1,2,2,2,2,1,1,1,-1,1,-1,9,1,1,1,-1,1,3,-2,-2,-2,-2,-2,9,1,2,2,2,2,8,-1,-2,2,-2,2,7,2,2,2,-3,3,1,1,-1,1,1,1,1,TRUE,0,100,TRUE,1,91,TRUE,0,91,FALSE,1,50,FALSE,0,50,FALSE,1,92,TRUE,1,91,TRUE,1,88,TRUE,1,61,TRUE,1,75,FALSE,1,94,FALSE,1,69,TRUE,1,58,TRUE,0,85,TRUE,1,50,TRUE,1,87,FALSE,1,50,TRUE,0,85,TRUE,0,83,FALSE,1,50,TRUE,1,59,TRUE,1,74,TRUE,0,65,TRUE,1,50,FALSE,1,61,TRUE,1,86,TRUE,0,50,FALSE,1,50,TRUE,0,71,TRUE,1,73,TRUE,1,84,TRUE,1,92,0.0144,0.0196,0.0169,0.0081,0.0064,0.0064,0.25,0.0625,0.25,0.0676,0.0729,0.1764,0.1521,0.0036,0.25,0.0081,0.4225,0.25,0.25,0.1521,0.1681,0.25,0.6889,0.7225,0.25,0.25,0.0256,1,0.8281,0.7225,0.5041,0.0961,0.281660714,0.141321429,0.422,25,78.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,15,93.75,8,50,72.34,70.38,67.12,82.12,69.75,73.06,71.62,6.25,0.46,-4.62,4.62,19.62,-17.75,-20.69,21.62,0,0,0,0,1,3,3,2,3,3,1,1,1,2,2,3,3,4,4,3,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,1,1,0,0.2,2.8,1.4,3.4,0.2,0.4,0,0.8,1.95,0.35,4.33,5.33,-7,2,2,8,-1,10 cents,100 minutes,36 days,Male,College Diploma/Certificate,58,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,2,3,1,3,3,1,1,1,2,2,3,1,3,3,3,0,2.4,1.4,2.6,1.6,C_Ug +402,R_1GeNRkyQ5YVBNQQ,39 - 45,American,Male,2,3,3,1,2,2,-1,3,-1,1,1,2,1,-1,3,3,2,1,1,1,0,-2,-2,-3,-1,5,-1,2,-3,1,-1,6,-1,-2,-1,1,-3,6,0,-3,-2,-1,-1,7,1,3,1,2,2,9,1,-2,-1,-2,1,7,0,-1,-2,-2,-2,6,3,3,1,2,1,6,TRUE,0,63,TRUE,1,80,TRUE,0,68,TRUE,0,71,TRUE,1,77,TRUE,0,74,TRUE,1,69,TRUE,1,92,TRUE,1,79,TRUE,1,82,TRUE,0,82,TRUE,0,100,TRUE,1,65,TRUE,0,79,TRUE,1,74,TRUE,1,65,TRUE,0,100,FALSE,1,100,TRUE,0,66,TRUE,0,78,FALSE,0,74,TRUE,1,68,TRUE,0,66,TRUE,1,71,TRUE,0,61,TRUE,1,100,TRUE,0,77,TRUE,0,62,FALSE,1,71,TRUE,1,100,TRUE,1,64,TRUE,1,86,0.0064,0,0.1225,0.0961,0.0196,0.5476,0.0841,0.0324,0.6084,0.1024,0,0.1225,0.0441,0.6724,0.0529,0.04,0.4356,0.5041,0.3844,0.3721,0.5476,0.0676,0.4356,0.6241,1,0.5929,0.1296,0.3969,0.4624,0,0.0841,1,0.334407143,0.233292857,0.435521429,25,78.13,17,53.13,4,50,4,50,5,62.5,4,50,15,93.75,2,12.5,77,74.12,76.62,77.75,79.5,77.88,76.12,25,23.87,24.12,26.62,15.25,29.5,-15.87,63.62,2,5,5,4,3,3,3,6,2,2,2,4,2,2,6,3,5,3,2,2,1,0,2,1,0,1,1,4,1,0,1,3,3,1,5,0,1,0,1,0,3.8,3.2,3.2,3,0.8,1.4,2.6,0.4,3.3,1.3,5.67,7.33,-4,-1,0,1,-1.66,5 cents,100 minutes,24 days,Male,University - Undergraduate,43,0.375,1,0,0,0,1,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,1,5,3,3,3,2,2,2,1,2,1,1,-1,1,1,3,4,3,1,2,3,1.8,0.6,2.6,2,C_Ug +403,R_5gP0vwAfPWywdOx,53 - 59,Canadian,Female,2,2,2,2,2,-2,-3,2,-2,-1,1,2,1,0,0,1,1,2,2,-2,2,2,2,2,2,0,-2,-2,2,-2,-1,0,1,2,1,0,0,0,1,1,2,2,-2,0,2,2,2,2,2,0,-2,-2,2,-2,-1,0,1,1,1,0,0,0,1,0,1,2,-1,1,FALSE,1,87,FALSE,0,50,FALSE,1,80,FALSE,1,50,TRUE,1,85,FALSE,1,94,TRUE,1,74,TRUE,1,92,FALSE,0,54,FALSE,0,50,TRUE,0,80,TRUE,0,55,TRUE,1,65,FALSE,1,92,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,53,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,FALSE,1,100,TRUE,1,71,FALSE,1,91,FALSE,1,86,TRUE,0,59,TRUE,1,100,FALSE,0,50,TRUE,1,80,0.0064,0.0841,0,0.0676,0.04,0.0036,0.16,0.25,0,0,0,0.1225,0.2916,0.64,0.0225,0.25,0,0.25,0.0196,0,1,0.25,0.2809,0.0064,0.25,0.0081,0.25,0.0169,0.04,0.25,0.3481,0.3025,0.180453571,0.145014286,0.215892857,22,68.75,22,68.75,2,25,6,75,7,87.5,7,87.5,10,62.5,12,75,75.25,59.75,79.12,78,84.12,73.81,76.69,0,6.5,34.75,4.12,-9.5,-3.38,11.31,1.69,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0.2,0,0,0,0.2,0.2,0.6,0.05,0.25,0,0,0,0,0,-1,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),59,0.875,1,1,0,0,0,1,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,-1,0,-1,0,0,-0.2,-0.6,-0.2,HS_TS +404,R_32KQgZLqx87Bq3m,67 - 73,Canadian,Male,-2,1,3,0,1,1,1,3,1,1,0,3,3,3,1,2,2,2,2,1,-3,1,3,0,2,1,1,1,3,1,1,2,0,3,3,3,1,2,2,2,2,2,2,4,-3,1,3,1,0,2,1,1,3,1,1,2,0,3,3,2,1,2,1,1,2,2,2,5,FALSE,1,100,TRUE,1,100,TRUE,0,95,TRUE,0,50,TRUE,1,90,TRUE,0,75,TRUE,1,90,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,90,TRUE,1,50,FALSE,1,70,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,95,TRUE,1,100,TRUE,0,75,FALSE,1,60,TRUE,0,70,TRUE,1,90,TRUE,1,50,TRUE,1,100,0.01,0,0,0.01,0,0.5625,0.0625,0,0,0,0.01,0.25,0,0.36,0.01,0,0,0.25,0.16,0.0025,0.25,0.0625,0,0.09,0,0.5625,0.25,0,0.9025,0,0.49,0.81,0.181607143,0.1075,0.255714286,26,81.25,24,75,5,62.5,5,62.5,8,100,6,75,15,93.75,9,56.25,84.38,76.25,79.38,94.38,87.5,85,83.75,6.25,9.38,13.75,16.88,-5.62,12.5,-8.75,27.5,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0.4,0,0,0.2,0.6,0,0.2,0.6,0.15,0.35,1.67,2,-1,0,0,-1,-0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,68,0.625,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,0,-1,-1,0,0,0,-0.2,0,-0.2,-0.4,-0.2,C_Ug +405,R_37ouadzHvN5P8U9,46 - 52,American,Female,-3,-2,0,-2,3,-3,-2,2,0,0,1,1,3,-3,2,2,2,2,3,3,-3,0,1,-3,3,5,-3,-3,2,0,-3,1,1,1,3,-3,2,6,0,0,0,0,0,6,-3,-2,0,-3,2,5,-3,0,0,0,-3,1,1,2,3,-3,0,5,0,0,0,0,0,5,TRUE,0,100,FALSE,0,50,FALSE,1,90,TRUE,0,90,TRUE,1,90,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,TRUE,0,100,FALSE,0,50,TRUE,1,80,TRUE,0,90,FALSE,1,100,FALSE,1,80,FALSE,1,100,FALSE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,80,TRUE,0,80,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.04,1,0,0,0.04,0,0,0.01,0,0.01,0,0.25,0.01,0.25,0,0.81,0,0.64,1,0.25,0.04,1,0.81,0.25,0,1,0.01,0,0.25,1,0.2725,0.098571429,0.446428571,22,68.75,21,65.63,5,62.5,5,62.5,4,50,7,87.5,12,75,9,56.25,87.81,71.25,90,96.25,93.75,89.38,86.25,3.12,22.18,8.75,27.5,46.25,6.25,14.38,30,0,2,1,1,0,0,1,0,0,3,0,0,0,0,0,2,2,2,3,3,0,0,0,1,1,0,2,2,0,3,0,1,0,0,2,2,2,2,3,3,0.8,0.8,0,2.4,0.4,1.4,0.6,2.4,1,1.2,4,3.67,0,0,1,1,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),50,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,2,1,0,-1,0,-1,-2,0,0,0,-1,0,0,-2,0,0,0,0,0,0.4,-0.6,-0.6,0,-0.2,HS_TS +406,R_3e2Cal4Kzt5T3Tl,25 - 31,Canadian,Female,2,3,3,2,2,2,2,2,3,3,2,3,2,2,2,2,3,2,2,3,3,3,3,3,2,5,-1,2,2,3,0,3,3,2,3,2,3,3,2,0,1,2,1,8,2,3,2,2,3,6,0,-1,3,-1,2,3,3,3,2,3,3,2,3,2,3,3,3,7,FALSE,1,100,FALSE,0,57,FALSE,1,89,FALSE,1,58,TRUE,1,100,FALSE,1,83,TRUE,1,64,TRUE,1,68,TRUE,1,80,TRUE,1,78,TRUE,0,62,TRUE,0,77,TRUE,1,100,TRUE,0,85,TRUE,1,50,TRUE,1,100,TRUE,0,52,TRUE,0,100,FALSE,1,63,FALSE,1,77,TRUE,1,89,FALSE,0,100,TRUE,0,56,TRUE,1,100,TRUE,0,62,TRUE,1,55,FALSE,1,75,TRUE,0,55,TRUE,0,86,TRUE,1,100,TRUE,1,55,TRUE,1,73,0.1024,0.2025,0,0.1296,0.0729,0.0289,0,0.0484,0.0529,1,0,0,0.04,0.3844,0,0.3249,0.3136,0.1764,0.3025,0.3844,0.0121,0.25,0.1369,0.7225,0.2704,0.0625,0.2025,0,0.0121,1,0.7396,0.5929,0.254671429,0.174457143,0.334885714,25,78.13,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,76.53,62.5,79.88,80.5,83.25,79.31,73.75,12.5,10.9,-12.5,17.38,30.5,8.25,-8.19,30,1,0,0,1,0,3,0,0,0,3,1,1,1,0,1,0,3,1,0,2,0,0,1,0,1,2,3,1,4,1,1,0,0,1,1,1,1,1,1,0,0.4,1.2,0.8,1.2,0.4,2.2,0.6,0.8,0.9,1,3.67,3.67,-1,0,1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,28,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,0,-1,1,-1,1,-3,-1,-4,2,0,1,1,-1,0,-1,2,0,-1,2,0,-1,0.2,0.4,-0.1,C_Ug +407,R_514Twbm6xuNkAVv,46 - 52,American,Female,3,3,1,-2,1,-3,0,3,-1,3,2,-2,3,0,3,-1,0,1,-1,-2,3,3,3,-3,2,1,-3,-2,2,0,2,3,2,-3,3,1,3,1,-1,0,-2,-1,-2,1,3,3,2,-2,2,3,-3,-1,2,-1,2,3,2,-2,3,0,3,1,-2,-2,-2,-2,-2,2,FALSE,1,74,FALSE,0,53,TRUE,0,91,FALSE,1,62,TRUE,1,94,FALSE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,52,TRUE,1,97,FALSE,1,92,TRUE,0,97,TRUE,1,92,FALSE,1,96,TRUE,1,53,TRUE,1,79,TRUE,0,83,TRUE,0,83,TRUE,0,54,FALSE,1,53,FALSE,0,52,TRUE,1,99,TRUE,0,65,TRUE,1,95,FALSE,1,98,TRUE,1,60,FALSE,1,52,TRUE,0,86,TRUE,0,94,TRUE,1,53,FALSE,0,55,TRUE,1,99,0.0016,0.16,0.0441,0,0.0001,0,0.0025,0.0009,0.2209,0.0001,0.2209,0.0064,0.2304,0.0064,0.0036,0.2809,0.4225,0.1444,0.7396,0.0004,0.2704,0.2209,0.2916,0.0016,0.6889,0.2304,0.3025,0.0676,0.8281,0.6889,0.8836,0.9409,0.274835714,0.11,0.439671429,18,56.25,21,65.63,5,62.5,4,50,7,87.5,5,62.5,13,81.25,8,50,78.41,59.12,84.88,88.38,81.25,76.81,80,-9.38,12.78,-3.38,34.88,0.88,18.75,-4.44,30,0,0,2,1,1,0,2,1,1,1,0,1,0,1,0,0,0,3,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,0,1,2,3,1,0,0.8,1,0.4,0.6,0.4,0.6,0,1.4,0.7,0.6,1.67,2.33,-2,0,0,-1,-0.66,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),48,0.5,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,1,1,0,0,1,0,1,0,0,1,0,1,0,-1,-2,0,-1,0,0.4,0.4,0.4,-0.8,0.1,grad_prof +408,R_6bHNp7BbzF4X5fT,46 - 52,Canadian,Female,2,2,2,-2,2,-2,-2,2,-2,0,2,0,2,-2,2,-2,0,-2,0,-2,2,2,2,-2,2,2,-2,-2,2,-2,-1,3,2,1,2,-2,2,3,-2,0,0,-2,-2,4,2,2,2,-2,2,3,-2,-2,2,-2,-2,2,2,2,2,-2,2,2,-2,0,-2,-2,-2,4,TRUE,0,96,TRUE,1,91,FALSE,1,100,TRUE,0,61,TRUE,1,52,FALSE,1,92,TRUE,1,99,TRUE,1,100,FALSE,0,86,TRUE,1,64,TRUE,0,65,TRUE,0,85,TRUE,1,73,TRUE,0,64,TRUE,1,59,TRUE,1,83,TRUE,0,75,TRUE,0,100,TRUE,0,60,FALSE,1,69,FALSE,0,100,FALSE,0,71,FALSE,1,100,TRUE,1,79,TRUE,0,78,TRUE,1,96,FALSE,1,76,FALSE,1,100,TRUE,0,72,FALSE,0,91,TRUE,1,80,TRUE,1,100,0,0.0016,0.0289,0.0001,0,0.0064,0.0441,0.1296,0.0961,0.5041,0.8281,0.0729,0.7396,0.4225,0.2304,0.0081,0,0.3721,0,0.6084,1,0.1681,0.36,0.4096,0.5625,0.0576,0.04,0.9216,0,1,0.5184,0.7225,0.350810714,0.246714286,0.454907143,20,62.5,18,56.25,4,50,5,62.5,3,37.5,6,75,12,75,6,37.5,81.78,72.25,83,83.5,88.38,82.75,80.81,6.25,25.53,22.25,20.5,46,13.38,7.75,43.31,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,2,0,0,0.2,0.2,0.8,0,0.4,0.4,0.4,0.3,0.3,2.67,2.33,-1,1,1,0,0.34,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,52,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,2,0,0,0,-0.2,-0.2,0.4,0,C_Ug +409,R_3805DpetJfO3EJz,53 - 59,Canadian,Male,2,3,3,3,3,-3,-2,1,-2,2,0,1,1,-2,1,-1,-1,-1,0,-3,0,3,3,3,3,8,-3,-3,1,-3,2,8,0,2,2,2,2,9,2,2,2,2,2,10,2,3,1,3,2,7,-3,-3,0,-3,1,2,1,1,2,-2,2,2,-1,1,1,1,-3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,51,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,52,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,94,FALSE,0,94,0,0,0,0,0.8836,0,0,1,0,0,0,0,0,0,0,0,0,0.2304,0,1,1,0.25,0.2304,0.2401,0,1,0.8836,1,1,1,1,1,0.418503571,0.151,0.686007143,22,68.75,20,62.5,5,62.5,5,62.5,4,50,6,75,11,68.75,9,56.25,93.53,81,99.25,93.88,100,96.12,90.94,6.25,31.03,18.5,36.75,43.88,25,27.37,34.69,2,0,0,0,0,0,1,0,1,0,0,1,1,4,1,3,3,3,2,5,0,0,2,0,1,0,1,1,1,1,1,0,1,0,1,0,2,2,1,0,0.4,0.4,1.4,3.2,0.6,0.8,0.6,1,1.35,0.75,8.33,3.67,1,6,7,6,4.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),59,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,2,0,-2,0,-1,0,0,-1,0,-1,-1,1,0,4,0,3,1,1,1,5,-0.2,-0.4,0.8,2.2,0.6,grad_prof +410,R_5ezzYdogimJP8ky,53 - 59,American,Male,1,2,2,1,2,-2,-2,1,-2,-1,2,2,1,1,2,1,1,1,1,1,1,2,2,1,1,1,-2,-2,1,-1,-1,2,2,2,1,1,2,1,2,2,2,2,2,2,1,2,2,1,2,1,-2,-1,1,-1,-1,1,2,2,1,1,2,2,1,1,1,1,1,3,FALSE,1,100,TRUE,1,90,TRUE,0,80,TRUE,0,50,TRUE,1,60,FALSE,1,90,TRUE,1,90,TRUE,1,90,FALSE,0,70,TRUE,1,90,FALSE,1,60,FALSE,1,60,TRUE,1,70,TRUE,0,80,FALSE,0,60,TRUE,1,90,FALSE,1,90,TRUE,0,90,FALSE,1,70,FALSE,1,100,TRUE,1,60,TRUE,1,80,FALSE,1,60,TRUE,1,70,TRUE,0,60,TRUE,1,70,FALSE,1,60,FALSE,1,60,FALSE,1,60,TRUE,1,60,FALSE,0,60,TRUE,1,90,0.01,0.09,0.01,0.01,0.01,0.01,0.09,0.01,0,0.04,0.16,0.09,0.49,0.16,0.16,0.01,0.16,0.25,0.16,0.36,0.16,0.36,0.09,0.64,0.01,0.16,0.36,0,0.64,0.81,0.16,0.16,0.203928571,0.117142857,0.290714286,24,75,24,75,4,50,8,100,5,62.5,7,87.5,13,81.25,11,68.75,74.06,65,72.5,82.5,76.25,75,73.12,0,-0.94,15,-27.5,20,-11.25,-6.25,4.37,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,1,0,0.4,0,0,0.35,0.1,1.33,1.33,0,1,-1,-1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,58,0.625,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,0,1,0,-1,0,0,0,0,0,0,0,0,1,1,1,1,1,0.2,-0.2,0,1,0.25,C_Ug +411,R_6Pp6q4gizO7hH7Q,46 - 52,Canadian,Male,0,2,2,2,-1,0,0,1,-1,-1,2,2,1,0,1,1,1,2,1,1,0,1,2,2,-1,7,0,0,1,0,0,7,2,0,1,0,0,7,0,0,1,0,1,7,-1,1,1,0,0,7,0,0,0,-1,0,7,0,1,1,0,1,7,0,0,0,0,1,7,TRUE,0,76,TRUE,1,69,TRUE,0,61,TRUE,0,60,FALSE,0,61,TRUE,0,58,TRUE,1,60,TRUE,1,64,TRUE,1,59,TRUE,1,59,TRUE,0,58,TRUE,0,61,FALSE,0,59,FALSE,1,58,TRUE,1,57,TRUE,1,57,FALSE,1,50,TRUE,0,62,FALSE,1,50,FALSE,1,92,TRUE,1,62,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,1,50,TRUE,0,59,FALSE,0,50,FALSE,0,50,TRUE,1,86,0.1296,0.25,0.1849,0.16,0.0196,0.3364,0.25,0.1681,0.0064,0.25,0.25,0.3481,0.1681,0.3364,0.3721,0.0961,0.25,0.36,0.25,0.25,0.1444,0.1849,0.25,0.1764,0.25,0.25,0.25,0.5776,0.3721,0.3844,0.3481,0.3721,0.259689286,0.229378571,0.29,16,50,17,53.13,4,50,4,50,5,62.5,4,50,10,62.5,7,43.75,59,56.62,60.62,58.12,60.62,58.94,59.06,-3.13,5.87,6.62,10.62,-4.38,10.62,-3.56,15.31,0,1,0,0,0,0,0,0,1,1,0,2,0,0,1,1,1,1,1,0,1,1,1,2,1,0,0,1,0,1,2,1,0,0,0,1,1,2,1,0,0.2,0.4,0.6,0.8,1.2,0.4,0.6,1,0.5,0.8,7,7,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),49,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,0,-1,-2,-1,0,0,-1,1,0,-2,1,0,0,1,0,0,-1,0,0,-1,0,0,-0.2,-0.3,HS_TS +412,R_170Ug1Iq1gkth8K,46 - 52,American,Female,3,3,3,3,3,0,2,0,2,1,3,1,2,2,2,2,0,2,1,2,2,3,3,2,3,8,0,2,3,1,0,8,3,2,2,2,3,8,1,2,0,2,1,7,3,3,3,3,3,10,-1,1,2,2,1,6,3,3,2,3,2,8,3,3,2,2,2,6,FALSE,1,99,FALSE,0,50,FALSE,1,68,FALSE,1,58,TRUE,1,64,FALSE,1,73,TRUE,1,100,FALSE,0,55,TRUE,1,60,TRUE,1,98,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,54,TRUE,1,63,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,74,FALSE,0,60,FALSE,1,83,FALSE,0,60,FALSE,1,89,TRUE,1,70,FALSE,1,85,TRUE,0,100,FALSE,1,59,TRUE,1,100,TRUE,1,66,TRUE,1,100,0.3025,0.09,0,0,0,0.0729,0.36,0.0004,0,0.36,0,1,0.16,0,0.1296,0.25,0.0289,0.1764,1,0.0121,0.5476,0.1369,0,0.2116,1,0.0225,0.1156,0.0001,0.1024,1,0.1681,1,0.280539286,0.1813,0.379778571,16,50,22,68.75,7,87.5,5,62.5,6,75,4,50,10,62.5,12,75,80.88,72.75,81.62,83.75,85.38,76.25,85.5,-18.75,12.13,-14.75,19.12,8.75,35.38,13.75,10.5,1,0,0,1,0,0,0,3,1,1,0,1,0,0,1,1,2,2,1,1,0,0,0,0,0,1,1,2,0,0,0,2,0,1,0,1,3,0,1,0,0.4,1,0.4,1.4,0,0.8,0.6,1,0.8,0.6,8,8,-2,2,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,0,0,1,0,-1,-1,1,1,1,0,-1,0,-1,1,0,-1,2,0,1,0.4,0.2,-0.2,0.4,0.2,C_Ug +413,R_1OrTLDR6rCD7Wpu,53 - 59,American,Female,3,0,1,0,3,-2,1,2,-2,3,2,-1,3,2,2,2,2,2,2,2,3,0,1,0,3,0,-2,1,3,-2,3,1,2,-2,3,2,2,1,2,2,2,2,2,1,3,-2,1,1,3,3,-2,1,2,-2,3,0,2,-1,3,3,3,1,0,0,0,0,1,3,FALSE,1,97,TRUE,1,97,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,85,TRUE,1,91,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,99,FALSE,0,50,TRUE,1,95,FALSE,1,50,FALSE,1,72,TRUE,0,55,FALSE,1,50,FALSE,0,50,TRUE,1,96,FALSE,1,99,TRUE,1,97,FALSE,1,100,TRUE,1,97,TRUE,0,57,FALSE,1,96,TRUE,0,63,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.0009,0.0025,0.0001,0,0,0.0009,0.0081,0.25,0.0016,0.0625,0,0.0225,0.25,0,0.0009,0.0001,0.25,0.0016,0,0.25,0.25,0.3025,0.0001,0.25,0.3249,0.25,0.0009,0,0.0784,0.3969,0,0.105425,0.060471429,0.150378571,27,84.38,26,81.25,4,50,6,75,8,100,8,100,13,81.25,13,81.25,81.88,61.75,82.75,93.88,89.12,86.38,77.38,3.13,0.63,11.75,7.75,-6.12,-10.88,5.13,-3.87,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,1,0,0.2,0.2,0,0.6,0,0.4,1.8,0.1,0.7,0.67,1.33,-3,1,0,-2,-0.66,5 cents,5 minutes,15 days,Female,University - PhD,56,1.375,1,1,0,0,0,0,0.67,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,-2,0,-1,0,0,0,1,0,0,0,1,0,-1,-1,-2,-2,-2,-2,-1,-0.6,0.2,-0.2,-1.8,-0.6,grad_prof +414,R_3HuyZ0X8TIq41jw,53 - 59,Canadian,Male,-2,2,1,-2,1,1,1,-1,-1,1,2,2,2,2,2,-2,-2,-1,0,-1,-2,2,0,-3,-2,8,1,0,1,-2,1,1,2,2,2,2,2,8,1,1,0,1,-1,8,-3,2,1,-2,1,5,1,-1,1,-2,1,3,2,2,2,2,2,1,1,0,2,1,1,8,TRUE,0,100,TRUE,1,96,TRUE,0,86,TRUE,0,74,TRUE,1,83,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,85,TRUE,1,90,TRUE,0,86,TRUE,0,86,TRUE,1,74,TRUE,0,70,TRUE,1,80,TRUE,1,100,TRUE,0,87,TRUE,0,78,TRUE,0,60,FALSE,1,100,TRUE,1,79,TRUE,1,80,TRUE,0,84,TRUE,1,88,TRUE,0,72,TRUE,1,100,TRUE,0,74,FALSE,1,84,TRUE,0,94,FALSE,0,86,FALSE,0,55,TRUE,1,100,0,0,0,0,0,0.04,0.0144,0.01,0,0.04,0.7396,0.0676,0.0225,0.7396,0.0289,0.0016,0.7056,0.5476,0.0256,0.5184,0.0441,0.04,0.36,0.49,0.7569,0.5476,0.3025,1,0.7396,0.6084,0.8836,0.7396,0.357632143,0.211242857,0.504021429,9,28.13,17,53.13,3,37.5,5,62.5,4,50,5,62.5,14,87.5,3,18.75,84.72,76.25,85.12,86.25,91.25,87.25,82.19,-25,31.59,38.75,22.62,36.25,28.75,-0.25,63.44,0,0,1,1,3,0,1,2,1,0,0,0,0,0,0,3,3,1,1,0,1,0,0,0,0,0,2,2,1,0,0,0,0,0,0,3,2,3,1,2,1,0.8,0,1.6,0.2,1,0,2.2,0.85,0.85,5.67,3,3,-2,7,0,2.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,53,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,0,1,1,3,0,-1,0,0,0,0,0,0,0,0,0,1,-2,0,-2,0.8,-0.2,0,-0.6,0,C_Ug +415,R_7HUEOPWFPRuB995,60 - 66,Canadian,Female,0,1,2,0,-1,-1,-1,1,-1,0,-1,1,2,-2,1,1,1,2,2,1,-2,1,2,-2,-2,2,-2,-2,2,-2,-2,2,-1,1,1,-2,1,2,1,1,1,1,1,2,-1,1,2,-1,-1,2,-2,0,2,-2,-1,2,-1,1,2,-2,2,2,2,1,1,1,1,2,FALSE,1,99,FALSE,0,60,TRUE,0,92,FALSE,1,51,TRUE,1,95,FALSE,1,63,TRUE,1,92,TRUE,1,98,FALSE,0,53,TRUE,1,95,FALSE,1,97,TRUE,0,100,TRUE,1,98,FALSE,1,88,TRUE,1,70,TRUE,1,96,TRUE,0,77,TRUE,0,80,TRUE,0,87,FALSE,1,78,TRUE,1,52,TRUE,1,96,TRUE,0,65,TRUE,1,98,FALSE,1,78,TRUE,1,79,FALSE,1,83,TRUE,0,91,FALSE,1,83,FALSE,0,95,TRUE,1,51,TRUE,1,95,0.0004,0.0441,0.0016,0.0064,0.0025,0.1369,0.0004,0.0025,0.0484,0.0016,0.9025,0.0004,0.2809,0.0009,0.0025,0.36,0.4225,0.2401,0.8281,0.0484,0.2304,0.09,0.7569,0.0144,0.5929,0.0289,0.2401,0.0001,0.8464,0.64,0.0289,1,0.2767,0.171578571,0.381821429,16,50,22,68.75,5,62.5,6,75,7,87.5,4,50,13,81.25,9,56.25,82.34,69,78.5,88.38,93.5,82.69,82,-18.75,13.59,6.5,3.5,0.88,43.5,1.44,25.75,2,0,0,2,1,1,1,1,1,2,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,0,1,1.2,0.2,0.4,0.4,1,0.2,0.6,0.7,0.55,2,2,0,0,0,0,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),61,0,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,1,0,0,1,1,0,0,0,0,1,0,0,1,0,-1,-1,0,0,0,0,0.6,0.2,0,-0.2,0.15,grad_prof +416,R_1HkpOnFzZo2O7jl,46 - 52,Canadian,Male,1,3,3,2,3,1,-2,3,-2,2,2,2,2,-1,3,3,2,3,2,1,3,3,3,3,3,1,0,-3,0,-2,0,5,-2,-1,-2,1,2,6,-1,-1,-1,-1,-2,6,2,3,3,3,3,9,2,-2,3,-3,2,1,1,2,2,-2,3,1,3,3,3,3,3,1,FALSE,1,50,FALSE,0,50,TRUE,0,76,FALSE,1,50,FALSE,0,50,TRUE,0,66,TRUE,1,97,TRUE,1,97,TRUE,1,50,TRUE,1,97,TRUE,0,50,TRUE,0,77,FALSE,0,62,TRUE,0,73,TRUE,1,50,TRUE,1,95,TRUE,0,60,TRUE,0,78,FALSE,1,50,FALSE,1,98,TRUE,1,96,TRUE,1,97,FALSE,1,50,FALSE,0,50,TRUE,0,65,TRUE,1,76,TRUE,0,50,TRUE,0,66,FALSE,1,86,TRUE,1,91,FALSE,0,59,FALSE,0,95,0.0009,0.0576,0.0025,0.0009,0.9025,0.4356,0.25,0.0009,0.0004,0.0009,0.0081,0.3844,0.25,0.25,0.25,0.25,0.25,0.25,0.4356,0.4225,0.0016,0.25,0.25,0.5329,0.36,0.25,0.3481,0.25,0.5776,0.6084,0.0196,0.5929,0.299357143,0.248771429,0.349942857,20,62.5,16,50,4,50,3,37.5,5,62.5,4,50,10,62.5,6,37.5,70.53,51.12,70.62,79.12,81.25,75.75,65.31,12.5,20.53,1.12,33.12,16.62,31.25,13.25,27.81,2,0,0,1,0,1,1,3,0,2,4,3,4,2,1,4,3,4,3,3,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,2,0.6,1.4,2.8,3.4,0.4,0.4,0.4,0.8,2.05,0.5,4,3.67,-8,4,5,5,0.33,5 cents,5 minutes,24 days,Male,University - PhD,46,1,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,1,0,0,0,0,0,1,3,-1,2,3,3,4,1,1,4,2,4,2,1,0.2,1,2.4,2.6,1.55,grad_prof +417,R_3qkqjzWRZrcoqIx,39 - 45,American,Female,0,2,2,2,0,-1,-1,3,1,0,3,2,1,-1,3,2,1,2,2,2,0,2,2,2,1,2,-1,-1,3,1,0,2,3,2,1,-1,3,2,2,2,2,2,2,2,0,2,2,2,0,2,-1,-1,3,1,0,2,3,2,2,-1,3,3,2,2,2,2,2,3,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,FALSE,0,74,TRUE,0,100,TRUE,0,100,TRUE,1,98,TRUE,0,91,TRUE,1,96,TRUE,1,96,TRUE,0,100,TRUE,0,99,TRUE,0,88,TRUE,0,88,TRUE,1,88,TRUE,1,91,TRUE,0,94,TRUE,1,77,FALSE,1,77,TRUE,1,97,TRUE,0,80,TRUE,0,93,FALSE,1,89,TRUE,1,97,FALSE,0,88,TRUE,1,91,0,0.0009,0.0016,0,0.0081,0,0.0529,0.5476,0.7744,0.0081,0.0009,0.0004,0.0025,1,0.0001,0,0.8836,1,0.8649,0.0529,0.0144,0.0016,0.7744,0.8281,1,0.64,0.7744,0.9216,1,0.9801,0.0121,1,0.469396429,0.305614286,0.633178571,20,62.5,17,53.13,3,37.5,6,75,4,50,4,50,14,87.5,3,18.75,93.19,93.38,94.88,90.62,93.88,92.94,93.44,9.37,40.06,55.88,19.88,40.62,43.88,5.44,74.69,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.2,0,0,0.2,0,0,0.2,0.2,0.1,0.1,2,2.33,0,0,-1,-1,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,41,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0.2,0,-0.2,0,0,C_Ug +418,R_5qrd0tdCp9EcqTV,32 - 38,Both,Female,1,1,2,-2,-2,-2,1,1,2,-1,1,-1,1,1,1,-2,-1,-1,0,-1,2,2,2,-2,-2,3,-2,1,2,2,-2,4,1,-1,2,1,1,3,-2,-2,-2,-2,-2,4,2,1,2,-1,-2,3,-2,1,2,2,-2,3,1,-2,1,1,1,2,-1,-1,-2,-2,-2,7,FALSE,1,100,TRUE,1,76,FALSE,1,89,TRUE,0,50,TRUE,1,89,FALSE,1,50,TRUE,1,91,TRUE,1,92,TRUE,1,94,TRUE,1,100,FALSE,1,50,TRUE,0,92,TRUE,1,95,TRUE,0,82,TRUE,1,51,TRUE,1,100,FALSE,1,50,FALSE,1,93,FALSE,1,50,FALSE,1,98,FALSE,0,51,TRUE,1,78,FALSE,1,50,TRUE,1,81,TRUE,0,88,TRUE,1,91,TRUE,0,88,TRUE,0,50,TRUE,0,94,TRUE,1,75,TRUE,1,84,TRUE,1,80,0.0064,0.0081,0,0.0081,0.04,0.25,0.0361,0,0.0004,0.0484,0.0625,0.0025,0.0036,0.25,0.0121,0.0576,0.25,0.25,0.25,0.7744,0.2601,0.2401,0.25,0.6724,0.25,0.7744,0.0256,0,0.0121,0.0049,0.8836,0.8464,0.2324,0.090228571,0.374571429,8,25,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,78.19,67.88,69.88,90.38,84.62,83,73.38,-50,3.19,-7.12,-5.12,15.38,9.62,-10.75,17.13,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,2,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,2,1,0.4,0.4,0.2,1,0.4,0.4,0.2,1,0.5,0.5,3.33,2.67,0,1,1,-3,0.66,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),36,0.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,1,0,-1,0,0,0,0,0,0,0,-1,1,0,0,-1,1,0,0,0,0,0,0,0,0,grad_prof +419,R_1LzFombgHpQ84me,46 - 52,American,Male,2,3,3,2,3,1,-2,2,-2,2,3,2,2,2,3,1,1,3,2,1,1,1,2,2,2,7,1,1,1,0,0,7,-1,0,0,0,1,0,2,2,3,2,2,8,2,2,2,1,2,8,0,0,1,1,0,7,0,0,2,1,0,8,1,2,1,1,1,8,FALSE,1,96,TRUE,1,98,FALSE,1,85,FALSE,1,70,TRUE,1,95,FALSE,1,95,TRUE,1,98,TRUE,1,100,TRUE,1,95,TRUE,1,98,FALSE,1,97,FALSE,1,85,FALSE,0,90,FALSE,1,95,TRUE,1,90,TRUE,1,100,FALSE,1,90,TRUE,0,95,FALSE,1,85,FALSE,1,95,TRUE,1,100,TRUE,1,99,FALSE,1,96,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,1,95,TRUE,0,90,FALSE,1,90,FALSE,0,95,TRUE,1,95,TRUE,1,95,0,0,0,0.0004,0.0025,0.0025,0,0.0004,0.0025,0.0001,0.9025,0.81,0.0025,0.0009,0.0025,0.0004,0.0016,0.09,0.81,0.0225,0,0.01,0.0225,0.0025,0.01,0.0025,0.0025,0.0016,0.0225,0.9025,0.01,0.0225,0.130714286,0.129885714,0.131542857,32,100,28,87.5,8,100,7,87.5,7,87.5,6,75,14,87.5,14,87.5,93.5,90.62,93.88,95.75,93.75,96.75,90.25,12.5,6,-9.38,6.38,8.25,18.75,9.25,2.75,1,2,1,0,1,0,3,1,2,2,4,2,2,2,2,1,1,0,0,1,0,1,1,1,1,1,2,1,3,2,3,2,0,1,3,0,1,2,1,0,1,1.6,2.4,0.6,0.8,1.8,1.8,0.8,1.4,1.3,4.67,7.67,-1,0,-8,0,-3,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),47,1.875,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,1,0,-1,0,-1,1,0,-1,0,1,0,2,1,-1,1,0,-2,-1,1,0.2,-0.2,0.6,-0.2,0.1,grad_prof +420,R_1SojIeCCuVQciPw,53 - 59,American,Female,0,0,3,-3,-3,-1,-3,1,-1,-1,3,1,2,0,3,-2,-3,-2,-2,-2,0,0,3,-3,-3,1,-1,-3,3,0,-1,2,2,2,2,-1,3,1,0,-2,0,0,-2,5,0,0,3,0,-3,1,-2,-3,2,-1,-1,1,2,1,0,-1,2,1,-1,-1,-1,-1,-1,2,TRUE,0,50,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,75,TRUE,1,85,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,75,TRUE,1,75,TRUE,0,75,TRUE,0,75,TRUE,0,75,TRUE,1,75,TRUE,1,50,TRUE,1,100,0.0225,0.0625,0.25,0.0625,0,0.25,0.25,0,0.25,0.25,0.0625,0.25,0.0625,0.25,0.25,0.0625,0.25,0.25,0.5625,0.5625,0.25,0.25,0.25,1,0.25,0.5625,0.25,0.25,0.25,0.5625,0.5625,1,0.321428571,0.174107143,0.46875,23,71.88,22,68.75,7,87.5,5,62.5,4,50,6,75,16,100,6,37.5,65.16,59.38,59.38,75,66.88,66.25,64.06,3.13,-3.59,-28.12,-3.12,25,-8.12,-33.75,26.56,0,0,0,0,0,0,0,2,1,0,1,1,0,1,0,2,1,2,2,0,0,0,0,3,0,1,0,1,0,0,1,0,2,1,1,1,2,1,1,1,0,0.6,0.6,1.4,0.6,0.4,1,1.2,0.65,0.8,1.33,1,0,1,0,3,0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),57,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-3,0,-1,0,1,1,0,0,1,-2,0,-1,1,-1,1,1,-1,-0.6,0.2,-0.4,0.2,-0.15,HS_TS +421,R_6YlMdPmRSe9svO9,53 - 59,American,Male,2,3,3,-3,3,-3,-3,3,-3,3,3,0,3,-3,3,-3,-3,-3,0,-3,3,3,3,-3,3,6,3,-3,3,-3,3,0,3,0,3,-3,3,0,-3,-3,-3,-3,-3,0,0,3,3,-3,3,9,0,-3,3,-3,3,8,3,0,3,-3,3,0,0,0,3,1,-3,3,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,99,TRUE,1,96,FALSE,1,50,TRUE,1,50,TRUE,1,96,FALSE,1,71,FALSE,1,71,FALSE,1,61,FALSE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,54,FALSE,0,55,FALSE,1,59,FALSE,1,100,TRUE,0,50,TRUE,1,96,FALSE,0,100,TRUE,1,100,0,0.3025,0.0016,0,0,0,0.25,0.25,0,0,0.0016,0.0016,0.25,0,0.25,0,0,0.25,0,0.2916,0.0064,0.25,0.1521,0.25,0.0841,0.1681,1,1,0.5625,0.0841,0.25,0.9801,0.22615,0.089514286,0.362785714,16,50,21,65.63,6,75,6,75,4,50,5,62.5,10,62.5,11,68.75,78.91,71.25,82.38,72.5,89.5,80.31,77.5,-15.63,13.28,-3.75,7.38,22.5,27,17.81,8.75,1,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,6,1,0,0.2,1.2,0,0.6,0.4,0.6,0,2.6,0.5,0.9,2,5.67,-3,-8,0,-3,-3.67,10 cents,100 minutes,24 days,Male,Trade School (non-military),53,1.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,0,0,0,0,3,0,0,0,0,0,0,0,0,0,-3,-3,-6,2,0,-0.2,0.6,0,-2,-0.4,HS_TS +422,R_5QLUC9EzFyEQGLZ,67 - 73,Canadian,Female,3,0,3,2,3,-1,-1,2,0,-1,2,2,3,0,2,2,2,3,2,2,1,0,3,-2,3,6,-1,-1,3,0,0,3,2,2,2,-2,2,2,1,1,2,-1,2,7,3,0,2,3,0,9,-2,0,2,0,-3,5,2,2,2,0,2,1,1,0,2,3,2,8,TRUE,0,88,TRUE,1,100,TRUE,0,100,FALSE,1,58,TRUE,1,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,66,TRUE,1,95,FALSE,1,100,FALSE,1,93,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,56,TRUE,0,100,FALSE,1,84,FALSE,1,100,TRUE,1,70,TRUE,1,89,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,0,98,FALSE,1,78,TRUE,0,97,TRUE,1,100,FALSE,0,64,TRUE,1,100,0,0.0001,0,0,0,0,0,0.0025,0,0.0121,0,0,0.4356,0,0.1521,0,0.0009,0.1764,0.0484,0,0.09,0.3025,0.0256,1,0.1936,0.9604,0.4096,0.7744,1,1,0.9409,0.0049,0.268925,0.055685714,0.482164286,24,75,23,71.88,4,50,7,87.5,5,62.5,7,87.5,13,81.25,10,62.5,89,78.12,85.12,96.38,96.38,87.44,90.56,3.12,17.12,28.12,-2.38,33.88,8.88,6.19,28.06,2,0,0,4,0,0,0,1,0,1,0,0,1,2,0,1,1,1,3,0,0,0,1,1,3,1,1,0,0,2,0,0,1,0,0,1,2,1,1,0,1.2,0.4,0.6,1.2,1,0.8,0.2,1,0.85,0.75,3.67,5,-3,-2,1,-1,-1.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,72,-0.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,0,-1,3,-3,-1,-1,1,0,-1,0,0,0,2,0,0,-1,0,2,0,0.2,-0.4,0.4,0.2,0.1,C_Ug +423,R_5rpijjmze8smW8X,53 - 59,American,Male,3,3,-3,-3,-3,-3,3,3,-1,-3,-3,3,3,-3,-3,-3,0,-3,-3,-3,3,3,-3,-3,-3,1,-3,2,3,2,-3,1,-3,3,3,-3,-3,1,-3,-3,-3,-3,-3,0,3,3,-3,-3,-3,0,-3,3,3,3,-3,0,-3,3,3,-3,-3,0,-3,-3,-3,-3,-3,0,FALSE,1,52,TRUE,1,56,TRUE,0,100,FALSE,1,50,FALSE,0,53,FALSE,1,54,TRUE,1,100,TRUE,1,73,TRUE,1,94,FALSE,0,76,FALSE,1,50,FALSE,1,53,FALSE,0,54,FALSE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,95,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,55,FALSE,1,51,FALSE,0,53,FALSE,1,52,TRUE,1,100,FALSE,1,51,FALSE,1,100,FALSE,1,51,FALSE,0,52,FALSE,0,51,FALSE,0,53,0.0729,0,0,0,0.2809,0.2116,0.2809,0.5776,0,0.3025,0.2704,0.2916,0.0036,0.25,0.2809,0.1936,0.2401,0.25,0,0.2304,0,0.36,0.25,0,0,0.2401,0.2601,0.2304,1,0.9025,0.2401,0.2209,0.26315,0.245264286,0.281035714,13,40.63,21,65.63,6,75,5,62.5,5,62.5,5,62.5,7,43.75,14,87.5,69.97,57.75,64.5,78.75,78.88,70.62,69.31,-25,4.34,-17.25,2,16.25,16.38,26.87,-18.19,0,0,0,0,0,0,1,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,3,0,0,0,0,0.8,0,0.6,0,0.8,0,0.6,0.35,0.35,1,0,1,1,1,0,1,10 cents,25 minutes,24 days,Male,High School (or equivalent),54,-1.125,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +424,R_3zqBtM41MgTa0Ok,67 - 73,American,Female,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,-1,2,0,2,-2,3,3,3,3,3,10,2,-2,3,-2,0,0,2,2,2,2,2,10,3,3,3,3,3,10,3,3,3,3,3,10,3,0,0,-3,0,5,3,3,3,3,3,2,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0001,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0.571428571,0.357142857,0.785714286,32,100,16,50,3,37.5,5,62.5,4,50,4,50,15,93.75,1,6.25,99.97,100,100,99.88,100,99.94,100,50,49.97,62.5,37.5,49.88,50,6.19,93.75,0,0,0,0,0,2,2,3,2,0,2,2,2,2,2,4,1,3,1,5,0,0,0,0,0,3,0,0,3,0,3,3,3,3,3,4,1,3,1,5,0,1.8,2,2.8,0,1.2,3,2.8,1.65,1.75,6.67,5.67,0,-5,8,0,1,5 cents,100 minutes,47 days,Female,College Diploma/Certificate,73,0,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,-1,2,3,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0,0.6,-1,0,-0.1,C_Ug +425,R_5kWmAe2xL3wBJpn,53 - 59,American,Male,2,1,2,0,3,-2,-3,3,-3,1,2,0,1,-2,2,0,0,1,1,3,2,-1,3,1,3,5,1,-3,3,-3,1,5,2,1,1,-1,3,5,0,0,0,0,0,5,2,0,2,2,3,5,-3,-3,3,-3,0,8,1,0,1,0,3,7,3,3,3,3,3,5,FALSE,1,81,TRUE,1,57,TRUE,0,53,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,72,TRUE,1,71,TRUE,1,66,TRUE,1,100,FALSE,1,55,TRUE,0,78,TRUE,1,97,TRUE,0,97,FALSE,0,54,TRUE,1,100,FALSE,1,90,TRUE,0,86,FALSE,1,55,FALSE,1,100,TRUE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,77,FALSE,1,100,TRUE,1,87,TRUE,0,50,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,0.0841,0.0169,0,0.0784,0,0,0.0529,0,0,0.16,0,0.0009,0.1156,0.2025,0,0.1849,0,0.25,0.09,0,0.1444,0.2916,0.2025,0.9409,0.01,0.25,0.1225,0.0361,0.2809,0.7396,1,0.6084,0.202989286,0.069057143,0.336921429,26,81.25,24,75,5,62.5,7,87.5,6,75,6,75,15,93.75,9,56.25,79.16,56.5,93.62,85.38,81.12,79.25,79.06,6.25,4.16,-6,6.12,10.38,6.12,-14.5,22.81,0,2,1,1,0,3,0,0,0,0,0,1,0,1,1,0,0,1,1,3,0,1,0,2,0,1,0,0,0,1,1,0,0,2,1,3,3,2,2,0,0.8,0.6,0.6,1,0.6,0.4,0.8,2,0.75,0.95,5,6.67,0,-3,-2,0,-1.67,5 cents,5 minutes,47 days,Male,University - Undergraduate,58,0.875,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,1,1,-1,0,2,0,0,0,-1,-1,1,0,-1,0,-3,-3,-1,-1,3,0.2,0.2,-0.2,-1,-0.2,C_Ug +426,R_7Y1IbOapKud15Hb,67 - 73,Canadian,Male,3,2,2,0,2,-3,1,2,-1,0,2,0,3,-2,3,3,2,3,3,3,3,2,2,-2,2,2,-3,1,2,1,1,2,2,0,3,0,3,2,2,2,3,2,3,2,3,2,2,-2,2,2,-3,2,2,0,0,2,2,0,3,-2,3,2,2,0,2,2,3,2,FALSE,1,94,TRUE,1,76,TRUE,0,96,FALSE,1,50,FALSE,0,92,FALSE,1,93,TRUE,1,50,TRUE,1,95,TRUE,1,50,TRUE,1,93,TRUE,0,50,FALSE,1,71,TRUE,1,93,FALSE,1,50,TRUE,1,50,TRUE,1,97,TRUE,0,50,FALSE,1,50,TRUE,0,61,FALSE,1,96,TRUE,1,69,TRUE,1,91,FALSE,1,50,TRUE,1,90,FALSE,1,50,TRUE,1,91,TRUE,0,59,FALSE,1,50,FALSE,1,50,TRUE,1,91,FALSE,0,50,TRUE,1,50,0.0025,0.0081,0.0009,0.25,0.25,0.0049,0.01,0.0049,0.0016,0.0081,0.0081,0.0049,0.25,0.25,0.8464,0.0576,0.25,0.25,0.25,0.25,0.0961,0.25,0.3721,0.25,0.25,0.3481,0.25,0.0036,0.9216,0.25,0.25,0.0841,0.215075,0.156892857,0.273257143,25,78.13,25,78.13,4,50,6,75,8,100,7,87.5,14,87.5,11,68.75,70.25,55.75,68.38,71.12,85.75,76.75,63.75,0,-7.88,5.75,-6.62,-28.88,-1.75,-10.75,-5,0,0,0,2,0,0,0,0,2,1,0,0,0,2,0,1,0,0,1,0,0,0,0,2,0,0,1,0,1,0,0,0,0,0,0,1,2,1,1,0,0.4,0.6,0.4,0.4,0.4,0.4,0,1,0.45,0.45,2,2,0,0,0,0,0,10 cents,25 minutes,15 days,Male,High School (or equivalent),70,1.125,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,-1,0,1,1,0,0,0,2,0,0,-2,-1,0,0,0,0.2,0.4,-0.6,0,HS_TS +427,R_6PLPYhC0VFT9Oz7,39 - 45,Canadian,Male,1,3,1,0,-3,-3,0,1,-3,0,2,-3,1,0,3,2,2,2,1,1,1,3,1,0,-3,1,-3,0,1,0,0,1,2,-3,1,1,3,1,0,1,0,1,-1,3,1,3,1,0,-3,0,-3,0,1,0,0,1,2,-3,1,0,3,0,1,1,1,1,1,1,FALSE,1,100,TRUE,1,75,TRUE,0,75,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,90,TRUE,1,90,TRUE,1,90,TRUE,1,90,FALSE,1,75,TRUE,0,90,TRUE,1,95,TRUE,0,90,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,75,TRUE,0,50,FALSE,1,90,TRUE,1,75,TRUE,1,90,FALSE,1,100,TRUE,1,90,FALSE,1,50,TRUE,1,60,FALSE,1,100,FALSE,1,60,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,60,0.01,0.16,0,0.01,0.16,0,0.01,0.01,0.01,0.01,0.25,0.0025,0.01,0.0625,0.0625,0.0625,0,0.25,0.16,0.25,0.0625,0.25,0.25,0.81,0.25,0,0.25,0,0.5625,0.5625,0.25,0.81,0.191696429,0.064285714,0.319107143,24,75,23,71.88,6,75,6,75,6,75,5,62.5,14,87.5,9,56.25,76.09,67.5,75.62,80.62,80.62,76.88,75.31,3.12,4.21,-7.5,0.62,5.62,18.12,-10.62,19.06,0,0,0,0,0,0,0,0,3,0,0,0,0,1,0,2,1,2,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,1,1,0,0,0,0.6,0.2,1.4,0,0.6,0,0.6,0.55,0.3,1,0.33,1,0,1,2,0.67,5 cents,5 minutes,47 days,Male,University - Undergraduate,45,1.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,2,0,0,0.2,0.8,0.25,C_Ug +428,R_7XgJIuD2YuirCqG,46 - 52,Canadian,Male,2,3,2,-1,3,1,-3,2,-3,1,0,1,3,-1,3,0,0,0,0,0,2,2,2,-1,2,5,1,-3,1,-3,1,5,1,1,1,1,1,5,1,1,1,1,1,5,2,3,2,-2,3,5,0,-3,2,-3,1,5,1,1,1,1,1,2,1,1,1,1,1,4,TRUE,0,100,FALSE,0,54,TRUE,0,100,FALSE,1,62,FALSE,0,54,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,1,100,FALSE,1,70,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,0,0,0,1,0,0,0.1225,0,0,0,0,0.1089,0.2916,0.2916,1,0.1444,1,1,0,0,1,0.09,1,1,0.3025,1,1,1,1,1,0.476839286,0.211357143,0.742321429,22,68.75,17,53.13,4,50,3,37.5,5,62.5,5,62.5,13,81.25,4,25,91.47,79.75,94.25,96.25,95.62,91.44,91.5,15.62,38.34,29.75,56.75,33.75,33.12,10.19,66.5,0,1,0,0,1,0,0,1,0,0,1,0,2,2,2,1,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,0,2,2,2,1,1,1,1,1,0.4,0.2,1.4,1,0.2,0.2,1.4,1,0.75,0.7,5,4,0,0,3,1,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,49,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,1,0,-1,1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05,C_Ug +429,R_16XZ1yejBSDUIG5,60 - 66,American,Female,3,3,3,-2,1,1,-3,3,-2,2,3,3,2,-3,3,2,-1,3,3,2,-2,3,3,-3,2,4,2,-2,3,1,2,4,1,2,2,-3,2,2,2,-2,2,2,2,2,3,3,3,-3,-1,1,1,-3,3,-2,1,1,3,3,3,-2,3,3,2,-1,2,2,2,2,TRUE,0,87,FALSE,0,55,FALSE,1,100,FALSE,1,52,TRUE,1,56,FALSE,1,68,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,100,FALSE,1,54,TRUE,0,100,TRUE,1,63,TRUE,0,91,TRUE,1,53,TRUE,1,59,TRUE,0,57,TRUE,0,100,TRUE,0,56,FALSE,1,56,TRUE,1,78,FALSE,0,52,TRUE,0,57,FALSE,0,84,FALSE,1,61,TRUE,1,71,FALSE,1,51,TRUE,0,67,TRUE,0,54,TRUE,1,99,FALSE,0,52,TRUE,1,65,0,0.0841,0.1681,0,0.1225,0.1024,0.7056,0,0.1936,0.2704,0.0001,0.1369,0.2025,0.2116,0.1936,0.3025,0.3249,0.2304,0.4489,0.1521,0.0484,0.2209,0.3136,0.8281,0.3249,0.2401,0.2704,0.7569,0,1,0.2916,1,0.317603571,0.214071429,0.421135714,16,50,19,59.38,5,62.5,5,62.5,4,50,5,62.5,12,75,7,43.75,70.41,53.5,62.25,82.75,83.12,71.38,69.44,-9.38,11.03,-9,-0.25,32.75,20.62,-3.62,25.69,5,0,0,1,1,1,1,0,3,0,2,1,0,0,1,0,1,1,1,0,0,0,0,1,2,0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,1.4,1,0.8,0.6,0.6,0.2,0.4,0.4,0.95,0.4,3.33,1.67,3,3,-1,0,1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),65,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,5,0,0,0,-1,1,1,0,3,-1,2,1,-1,-1,1,0,1,0,0,0,0.8,0.8,0.4,0.2,0.55,HS_TS +430,R_7W3Jss5Qy6jeZl7,60 - 66,American,Female,-1,2,0,-2,-2,-3,-2,3,3,-2,2,2,0,-2,0,1,0,2,2,-2,2,2,-2,2,-1,5,-3,-1,2,3,-3,7,3,2,0,-3,-2,4,-1,-2,-1,-1,-2,8,2,2,1,-1,0,5,-3,0,3,3,-3,3,3,3,0,-2,1,7,0,-1,0,1,-2,5,FALSE,1,100,TRUE,1,100,FALSE,1,55,TRUE,0,54,TRUE,1,54,FALSE,1,100,TRUE,1,81,TRUE,1,100,TRUE,1,100,FALSE,0,53,FALSE,1,58,FALSE,1,53,FALSE,0,54,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,53,TRUE,0,53,FALSE,1,55,FALSE,1,100,FALSE,0,53,TRUE,1,58,FALSE,1,100,TRUE,1,66,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,51,TRUE,0,53,TRUE,1,70,FALSE,0,62,TRUE,1,100,0,0.25,0,0.0361,0,0,0.1156,0.2809,0,0.1764,0.09,0.2916,0,0.1764,0.2116,0,0,0.2916,0.2601,0.25,0.2809,0.3025,0.2025,1,0.2209,0.25,0.3844,0,0.2025,0.2809,0.2809,0.2209,0.206092857,0.116721429,0.295464286,14,43.75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,11,68.75,11,68.75,70.03,66.75,70.88,68.12,74.38,72.25,67.81,-25,1.28,4.25,8.38,5.62,-13.12,3.5,-0.94,3,0,2,4,1,0,1,1,0,1,1,0,0,1,2,2,2,3,3,0,3,0,1,1,2,0,2,0,0,1,1,1,0,0,1,1,1,2,1,0,2,0.6,0.8,2,1.4,0.6,0.6,1,1.35,0.9,5.33,5,0,4,-3,3,0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,61,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,1,3,-1,0,-1,1,0,0,0,-1,0,1,1,1,1,1,2,0,0.6,0,0.2,1,0.45,C_Ug +431,R_1TAWadiw4jlO7Gg,67 - 73,American,Female,3,2,-2,-1,1,0,-3,2,-2,2,3,-3,3,1,3,-2,-1,-2,1,0,3,2,0,-2,1,1,0,-3,2,-2,1,1,3,-3,3,1,3,1,1,1,1,2,0,9,3,3,-2,-2,0,1,0,-3,2,-3,0,1,3,-3,3,1,3,1,0,0,0,0,0,5,TRUE,0,92,TRUE,1,86,FALSE,1,100,TRUE,0,50,TRUE,1,85,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,0,92,TRUE,1,60,TRUE,0,67,TRUE,0,97,TRUE,1,77,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,78,TRUE,0,50,TRUE,0,66,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,57,TRUE,1,98,TRUE,0,50,TRUE,0,50,TRUE,0,90,TRUE,1,93,TRUE,1,50,TRUE,1,100,0,0.0004,0,0.1225,0,0,0.0025,0.16,0,0,0.0049,0.0529,0.8464,0.4489,0.0225,0.0196,0,0.25,0.25,0.3249,0.25,0.25,0.4356,1,0.6084,0.25,0.25,0.8464,0,0.25,0.81,0.9409,0.295496429,0.129121429,0.461871429,24,75,19,59.38,3,37.5,6,75,4,50,6,75,15,93.75,4,25,79.62,63.88,85,77.75,91.88,81.31,77.94,15.62,20.24,26.38,10,27.75,16.88,-12.44,52.94,0,0,2,1,0,0,0,0,0,1,0,0,0,0,0,3,2,3,1,0,0,1,0,1,1,0,0,0,1,2,0,0,0,0,0,2,1,2,1,0,0.6,0.2,0,1.8,0.6,0.6,0,1.2,0.65,0.6,1,1,0,0,0,4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,70,1.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,-1,2,0,-1,0,0,0,-1,-1,0,0,0,0,0,1,1,1,0,0,0,-0.4,0,0.6,0.05,C_Ug +432,R_5meluxYLoVHhaVj,60 - 66,American,Male,2,3,2,-3,3,2,-2,1,-1,2,2,1,2,2,2,0,1,1,3,2,2,3,1,-3,3,2,3,-2,3,-2,3,2,2,2,3,3,3,2,3,3,3,3,3,7,1,3,2,0,1,2,2,-2,1,-2,1,2,2,2,2,2,2,2,2,0,0,3,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,68,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,100,FALSE,1,79,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,67,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0.1024,0,0,0,0,0,0,0.0016,0.0441,0,0,0,0.25,0,0.1089,0,0.0841,0.0529,0,0,0.36,0.09,0,0.25,0,1,0.8649,0.114603571,0.028435714,0.200771429,25,78.13,27,84.38,6,75,7,87.5,8,100,6,75,16,100,11,68.75,90.03,75.38,96,95.88,92.88,96.06,84,-6.25,5.65,0.38,8.5,-4.12,17.88,-3.94,15.25,0,0,1,0,0,1,0,2,1,1,0,1,1,1,1,3,2,2,0,1,1,0,0,3,2,0,0,0,1,1,0,1,0,0,0,2,1,1,0,0,0.2,1,0.8,1.6,1.2,0.4,0.2,0.8,0.9,0.65,2,2,0,0,0,5,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),64,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,-1,0,1,-3,-2,1,0,2,0,0,0,0,1,1,1,1,1,1,0,1,-1,0.6,0.6,0.8,0.25,HS_TS +433,R_52QubOgVKMWofAS,60 - 66,Canadian,Male,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,6,1,0,1,1,1,5,0,1,1,1,1,5,1,0,1,1,0,5,1,1,1,1,0,5,1,1,1,0,1,5,0,0,0,0,0,5,1,1,1,1,0,5,TRUE,0,100,FALSE,0,56,FALSE,1,56,FALSE,1,59,FALSE,0,60,FALSE,1,64,FALSE,0,63,TRUE,1,86,TRUE,1,67,FALSE,0,56,FALSE,1,59,TRUE,0,100,TRUE,1,76,FALSE,1,56,FALSE,0,61,TRUE,1,100,TRUE,0,82,FALSE,1,61,FALSE,1,69,FALSE,1,100,TRUE,1,72,FALSE,0,63,FALSE,1,65,FALSE,0,64,FALSE,1,66,FALSE,0,64,FALSE,1,66,FALSE,1,66,FALSE,1,66,FALSE,0,69,TRUE,1,74,FALSE,0,81,0.0196,0.4096,0,0.3969,0.6561,0.1296,0.4096,0.3136,0,0.3969,0.4761,0.0576,0.1089,0.1681,0.36,0.3136,0.1225,0.1681,0.1156,0.1156,0.0784,0.3721,0.0961,0.1936,0.6724,0.1156,0.0676,1,0.1936,0.1521,0.1156,1,0.284607143,0.262907143,0.306307143,11,34.38,19,59.38,6,75,5,62.5,3,37.5,5,62.5,6,37.5,13,81.25,70.22,63.88,70.75,66.12,80.12,69.5,70.94,-25,10.84,-11.12,8.25,28.62,17.62,32,-10.31,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,0.2,0.2,0.2,0.2,0.4,0.2,1,0.4,0.2,0.5,5.33,5,1,0,0,0,0.33,10 cents,100 minutes,24 days,Male,Trade School (non-military),62,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,1,0,0,-1,-1,0,1,0,-1,0,0,-1,-1,-1,-1,0,-1,0,0,0,-0.2,0,-0.8,-0.2,-0.3,HS_TS +434,R_3bU9o5xihZILjB9,67 - 73,American,Male,2,2,2,-1,2,1,-1,2,-1,0,1,2,1,1,1,0,2,2,2,1,2,2,2,-2,2,2,2,-1,2,-2,1,2,1,2,2,2,2,2,1,2,1,1,1,2,2,1,1,0,0,2,1,-2,1,-2,-1,2,1,1,1,0,1,2,0,0,1,1,0,2,FALSE,1,71,FALSE,0,73,FALSE,1,76,FALSE,1,55,TRUE,1,75,FALSE,1,100,TRUE,1,70,TRUE,1,75,TRUE,1,68,TRUE,1,64,FALSE,1,75,FALSE,1,91,TRUE,1,65,FALSE,1,75,FALSE,0,57,TRUE,1,96,FALSE,1,70,FALSE,1,80,FALSE,1,75,FALSE,1,100,TRUE,1,76,TRUE,1,75,FALSE,1,95,TRUE,1,76,FALSE,1,91,TRUE,1,89,FALSE,1,56,FALSE,1,92,TRUE,0,60,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.0625,0.0121,0.0016,0.09,0,0,0.0576,0.1296,0,0.0625,0,0.1225,0.1024,0.0625,0.0625,0.5329,0.0025,0.2025,0.0064,0.0081,0.0576,0.3249,0.0625,0.0625,0.09,0.1936,0.0625,0.0841,0.0576,0.04,0.36,0.0081,0.098407143,0.095535714,0.101278571,22,68.75,29,90.63,6,75,7,87.5,8,100,8,100,14,87.5,15,93.75,78,66.75,80.12,76.88,88.25,77.12,78.88,-21.88,-12.63,-8.25,-7.38,-23.12,-11.75,-10.38,-14.87,0,0,0,1,0,1,0,0,1,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,2,0,1,1,1,1,0,1,0,1,0,0,2,1,1,1,0.2,0.6,0.6,0.6,1,0.8,0.4,1,0.5,0.8,2,2,0,0,0,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),71,1,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,-1,-1,0,-2,1,-1,-1,0,0,0,-1,1,0,1,1,-2,0,0,-1,-0.8,-0.2,0.2,-0.4,-0.3,grad_prof +435,R_1RXvoqs6mVtuc0x,32 - 38,American,Male,2,3,3,3,1,3,1,3,1,2,3,2,3,1,3,-1,-1,1,0,-2,2,3,3,3,1,1,3,2,3,2,1,2,3,2,3,1,3,8,-1,0,0,1,-2,2,2,3,3,3,1,1,3,2,3,1,2,1,3,3,3,2,3,0,1,1,1,2,-2,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,75,FALSE,0,100,TRUE,0,75,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,100,FALSE,0,75,FALSE,0,75,TRUE,1,75,0,0,0,0,0.0625,0.25,0,1,0,0,0.5625,1,0.0625,0.5625,0,0,0,0.25,0,0,1,0.0625,1,1,0.5625,0.5625,0.5625,1,1,1,1,1,0.482142857,0.267857143,0.696428571,25,78.13,17,53.13,4,50,4,50,4,50,5,62.5,11,68.75,6,37.5,90.62,78.12,87.5,100,96.88,92.19,89.06,25,37.49,28.12,37.5,50,34.38,23.44,51.56,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,2,2,0,2,0,0,0.6,0,0.6,0,0.2,0.4,1.2,0.3,0.45,3.67,0.67,0,1,8,-1,3,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,1,1,0,-1,0,-1,0,-2,-1,1,-1,0,0,0.4,-0.4,-0.6,-0.15,grad_prof +436,R_5L68C81K8u8zCKJ,46 - 52,American,Male,-1,3,2,3,1,1,-3,3,-1,2,3,3,3,1,2,3,2,2,2,3,-1,3,3,3,1,4,2,-3,3,-1,3,2,3,3,3,2,2,2,1,2,2,3,3,4,-1,3,3,3,1,2,3,-3,3,-2,1,1,3,3,3,2,2,5,2,1,2,3,3,4,FALSE,1,70,TRUE,1,65,FALSE,1,94,TRUE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,84,TRUE,1,80,TRUE,1,55,TRUE,1,60,FALSE,1,50,FALSE,1,95,FALSE,0,68,FALSE,1,90,TRUE,1,75,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,1,58,FALSE,1,100,TRUE,1,100,TRUE,1,55,FALSE,1,90,TRUE,1,81,FALSE,1,100,TRUE,1,100,FALSE,1,92,FALSE,1,95,FALSE,1,100,FALSE,0,74,TRUE,1,91,TRUE,1,96,0.04,0,0,0.0256,0.0016,0,0.0361,0.16,0,0.2025,0.5476,0.4624,0.2025,0.25,0.04,0.1225,0.01,0.25,0.0025,0,0,0.0625,0.1764,0.01,0.01,0.0064,0.0081,0.09,0.0036,1,0,0.0025,0.130614286,0.163228571,0.098,20,62.5,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,82.44,67,90.5,82.38,89.88,79,85.88,-25,-5.06,-20.5,3,-5.12,2.38,-8.5,-1.62,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,1,0,0,2,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0.2,0.4,0.2,0.6,0.2,0.8,0.2,0.6,0.35,0.45,2.67,2.67,2,1,-3,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),51,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,-1,0,0,-1,0,0,0,0,0,0,1,-1,0,0,0,0,-0.4,0,0,-0.1,grad_prof +437,R_3ZF1F4uNVZMZuwx,46 - 52,American,Female,3,2,1,0,2,-3,0,1,2,-1,1,-1,3,0,2,-1,0,0,-1,-1,2,2,1,0,3,2,-2,0,2,2,0,1,1,0,2,1,2,2,0,0,0,0,0,4,2,1,0,0,1,2,-3,0,1,2,0,2,1,0,3,0,2,2,-2,-2,0,-2,-2,5,FALSE,1,50,TRUE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,65,FALSE,1,50,TRUE,1,70,TRUE,1,65,TRUE,1,70,TRUE,1,70,FALSE,1,50,TRUE,0,64,TRUE,1,64,FALSE,1,50,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,70,TRUE,1,70,FALSE,1,70,TRUE,1,65,TRUE,0,60,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,70,TRUE,1,60,FALSE,0,50,TRUE,1,50,0.1225,0.09,0.09,0.09,0.25,0.25,0.1225,0.09,0.25,0.09,0.16,0.1296,0.09,0.25,0.1225,0.25,0.09,0.25,0.25,0.36,0.49,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5625,0.25,0.49,0.4096,0.248453571,0.171042857,0.325864286,10,31.25,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,59.31,52.5,61.12,61.25,62.38,63.06,55.56,-43.75,-15.69,-10,-13.88,-26.25,-12.62,-18.19,-13.19,1,0,0,0,1,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,2,0,1,1,0.4,0.6,0.6,0.6,0.8,0.2,0.2,1,0.55,0.55,1.67,2,0,-1,0,-1,-0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,-1,-1,0,0,1,0,1,0,0,0,0,1,1,0,0,-2,0,0,0,-0.4,0.4,0.4,-0.4,0,C_Ug +438,R_7Ztgepj79DndxxD,46 - 52,Canadian,Female,3,2,2,2,3,-3,-1,1,-1,2,3,0,2,2,3,-3,-2,-2,-1,-3,3,3,2,-1,3,3,-3,0,1,1,2,2,3,2,2,1,2,4,-2,0,0,-2,-2,6,3,2,2,2,3,1,-3,-1,2,-1,1,2,3,-1,3,0,3,3,-2,-1,0,0,-1,2,FALSE,1,70,TRUE,1,92,FALSE,1,94,TRUE,0,50,TRUE,1,81,FALSE,1,100,TRUE,1,87,TRUE,1,85,TRUE,1,75,TRUE,1,92,FALSE,1,60,TRUE,0,99,TRUE,1,90,FALSE,1,76,TRUE,1,71,TRUE,1,100,TRUE,0,50,TRUE,0,75,FALSE,1,60,FALSE,1,70,FALSE,0,50,TRUE,1,98,FALSE,1,100,TRUE,1,75,FALSE,1,80,TRUE,1,80,TRUE,0,70,FALSE,1,80,FALSE,1,79,FALSE,0,60,FALSE,0,60,TRUE,1,82,0.0225,0.04,0,0.0169,0.0324,0,0.0625,0.0064,0.09,0.0004,0.36,0.01,0.0625,0.16,0.0361,0.0064,0,0.25,0.04,0.04,0.25,0.0841,0.16,0.0576,0.25,0.49,0.36,0.09,0.0036,0.5625,0.0441,0.9801,0.160310714,0.076907143,0.243714286,20,62.5,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,77.84,67.25,79,82.25,82.88,79.88,75.81,-12.5,2.84,4.75,4,-5.25,7.88,-1.37,7.06,0,1,0,3,0,0,1,0,2,0,0,2,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,2,0,1,1,2,1,2,0.8,0.6,0.8,1.4,0,0.4,0.8,1.4,0.9,0.65,3,2,2,0,1,4,1,5 cents,25 minutes,36 days,Female,College Diploma/Certificate,48,1.5,1,0,0,0,0,0,0.33,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,1,0,3,0,0,1,-1,2,-1,0,1,-1,-1,1,0,1,0,0,-1,0.8,0.2,0,0,0.25,C_Ug +439,R_3Jg6vBxakqFpzJ8,25 - 31,Canadian,Female,1,3,1,-2,2,-3,1,1,-2,-1,-2,0,1,0,0,-2,-3,-3,-2,-3,-1,2,1,-3,2,1,-3,0,0,-2,0,1,-2,-2,2,-2,-1,0,-3,-2,-2,-2,-2,1,1,3,0,-1,2,2,-3,2,1,-2,0,1,-3,-2,2,0,-1,1,-2,0,-2,-2,-3,1,FALSE,1,77,FALSE,0,57,TRUE,0,83,FALSE,1,54,TRUE,1,87,FALSE,1,61,TRUE,1,60,FALSE,0,54,TRUE,1,58,TRUE,1,95,FALSE,1,60,TRUE,0,91,FALSE,0,63,FALSE,1,60,FALSE,0,58,FALSE,0,57,TRUE,0,60,TRUE,0,98,FALSE,1,55,FALSE,1,56,FALSE,0,99,FALSE,0,52,TRUE,0,64,FALSE,0,53,FALSE,1,100,TRUE,1,84,FALSE,1,60,FALSE,1,62,FALSE,1,58,TRUE,1,69,FALSE,0,61,TRUE,1,94,0.2916,0.0256,0.3249,0.16,0.0036,0.1521,0.2809,0.0025,0.1936,0.2704,0.0961,0.3969,0.1764,0.16,0.0169,0.3249,0.4096,0.2116,0.1444,0,0.9801,0.3364,0.2025,0.16,0.36,0.16,0.3721,0.0529,0.6889,0.9604,0.1764,0.8281,0.289917857,0.192535714,0.3873,5,15.63,18,56.25,5,62.5,4,50,6,75,3,37.5,7,43.75,11,68.75,68.75,57.88,73.25,78.25,65.62,68.81,68.69,-40.62,12.5,-4.62,23.25,3.25,28.12,25.06,-0.06,2,1,0,1,0,0,1,1,0,1,0,2,1,2,1,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,2,1,0,1,0,3,1,0,0,0.8,0.6,1.2,0.8,0.4,0.4,1,0.8,0.85,0.65,0.67,1.33,-1,0,-1,0,-0.66,10 cents,75 minutes,36 days,Female,High School (or equivalent),31,-0.25,0,0,0,1,0,0,0,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,2,1,-1,0,0,0,0,1,0,0,-1,0,0,2,0,1,-2,0,0,1,0.4,0.2,0.2,0,0.2,HS_TS +440,R_3QD3B1WiwQy6b3X,25 - 31,Canadian,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,10,TRUE,0,82,TRUE,1,79,TRUE,0,78,TRUE,0,85,TRUE,1,84,TRUE,0,80,TRUE,1,85,TRUE,1,75,TRUE,1,90,TRUE,1,87,TRUE,0,75,TRUE,0,86,TRUE,1,72,TRUE,0,75,TRUE,1,68,TRUE,1,68,TRUE,0,79,TRUE,0,69,TRUE,0,75,TRUE,0,76,TRUE,1,78,TRUE,1,82,TRUE,0,86,TRUE,1,82,TRUE,0,82,TRUE,1,86,TRUE,0,100,TRUE,0,96,TRUE,0,97,TRUE,1,86,TRUE,1,72,TRUE,1,81,0.0625,0.0196,0.1024,0.0225,0.0361,0.64,0.0324,0.0169,0.5776,0.0324,0.0196,0.0784,0.01,0.5625,0.0256,0.0441,0.7396,0.7225,0.9216,0.6724,0.0484,0.1024,0.5625,0.5625,0.6241,1,0.0784,0.6724,0.6084,0.4761,0.9409,0.7396,0.412407143,0.252692857,0.572121429,21,65.63,16,50,4,50,4,50,4,50,4,50,16,100,0,0,81.12,80.5,82.12,81,80.88,79.69,82.56,15.63,31.12,30.5,32.12,31,30.88,-20.31,82.56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9.33,-1,0,0,0,-0.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +441,R_3geIBUArUehfBct,60 - 66,Canadian,Female,3,3,3,3,3,1,3,2,1,0,0,1,1,0,1,3,2,1,1,1,2,3,2,2,3,8,2,0,1,1,1,5,1,0,2,1,2,8,1,2,1,1,1,3,3,3,3,3,3,1,3,3,3,3,3,0,1,1,2,3,2,8,3,2,2,2,2,9,TRUE,0,85,FALSE,0,90,TRUE,0,85,TRUE,0,80,FALSE,0,82,TRUE,0,80,FALSE,0,84,TRUE,1,90,TRUE,1,73,TRUE,1,98,TRUE,0,91,TRUE,0,85,TRUE,1,82,TRUE,0,76,FALSE,0,84,TRUE,1,87,TRUE,0,79,TRUE,0,79,FALSE,1,87,TRUE,0,82,TRUE,1,72,FALSE,0,73,TRUE,0,75,FALSE,0,78,FALSE,1,100,TRUE,1,77,TRUE,0,75,TRUE,0,80,TRUE,0,81,TRUE,1,82,FALSE,0,82,FALSE,0,86,0.01,0.0529,0.0169,0.7056,0.7396,0.64,0.6084,0.0004,0.6724,0.5329,0.0324,0.0324,0.0729,0.8281,0.6724,0.81,0.5625,0.64,0.64,0,0.0784,0.7056,0.0169,0.5776,0.6241,0.5625,0.6724,0.7225,0.7225,0.6241,0.6561,0.7225,0.506057143,0.488885714,0.523228571,13,40.63,10,31.25,2,25,2,25,3,37.5,3,37.5,8,50,2,12.5,82.5,82.75,79.62,84,83.62,82.5,82.5,9.38,51.25,57.75,54.62,46.5,46.12,32.5,70,1,0,1,1,0,1,3,1,0,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,2,0,1,2,3,1,0,1,3,1,0,0,1,1,1,0.6,1.2,1,0.4,0,1.6,1.2,0.6,0.8,0.85,7,3,7,5,0,-6,4,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,63,0.375,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,1,0,1,1,0,-1,3,0,-2,-2,0,1,0,-2,0,2,0,-1,-1,-1,0.6,-0.4,-0.2,-0.2,-0.05,C_Ug +442,R_57B2rYAOs6YLNGp,46 - 52,Canadian,Female,2,1,0,-2,1,0,1,1,-2,1,1,-1,3,-1,3,-2,-2,-1,-3,-1,3,2,2,-2,2,3,2,2,1,-1,2,1,1,-2,2,-1,3,2,2,2,2,2,0,7,2,2,1,-2,1,1,0,1,2,-2,2,1,1,-2,3,-2,3,1,0,0,0,-1,0,1,FALSE,1,100,TRUE,1,80,TRUE,0,95,TRUE,0,50,TRUE,1,76,FALSE,1,91,TRUE,1,76,TRUE,1,95,TRUE,1,85,FALSE,0,65,FALSE,1,55,FALSE,1,50,TRUE,1,70,TRUE,0,70,TRUE,1,62,TRUE,1,90,FALSE,1,50,TRUE,0,80,TRUE,0,70,FALSE,1,60,TRUE,1,95,TRUE,1,75,FALSE,1,60,FALSE,0,65,FALSE,1,95,TRUE,1,65,TRUE,0,50,TRUE,0,65,TRUE,0,70,FALSE,0,65,FALSE,0,50,TRUE,1,85,0.0025,0.1225,0.01,0.0576,0.0225,0.0081,0.4225,0.4225,0.16,0.0625,0.4225,0.09,0.0225,0.2025,0.0576,0.04,0.16,0.25,0.4225,0.0025,0.0025,0.1444,0.49,0.49,0.25,0.25,0.25,0,0.9025,0.64,0.49,0.25,0.247414286,0.167371429,0.327457143,21,65.63,20,62.5,4,50,7,87.5,5,62.5,4,50,12,75,8,50,72.19,62.75,74.62,78.25,73.12,74.94,69.44,3.13,9.69,12.75,-12.88,15.75,23.12,-0.06,19.44,1,1,2,0,1,2,1,0,1,1,0,1,1,0,0,4,4,3,5,1,0,1,1,0,0,0,0,1,0,1,0,1,0,1,0,2,2,1,2,1,1,1,0.4,3.4,0.4,0.4,0.4,1.6,1.45,0.7,2,1,2,0,1,6,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),51,1.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,1,0,1,0,1,2,1,-1,1,0,0,0,1,-1,0,2,2,2,3,0,0.6,0.6,0,1.8,0.75,grad_prof +443,R_6cOXunV51Bjkbjr,60 - 66,American,Male,-1,2,1,0,1,-1,0,0,-1,0,0,-1,2,-1,2,-2,-1,0,0,-1,-1,2,1,-1,1,6,-1,-1,0,-1,1,5,0,-1,1,-1,2,5,-1,-2,-2,-1,-1,4,-1,2,1,1,1,6,-1,-1,1,-1,1,5,0,-1,2,-1,2,5,-2,-2,-1,-1,-1,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,97,FALSE,1,98,TRUE,1,99,TRUE,1,100,TRUE,1,61,TRUE,1,75,TRUE,0,68,FALSE,1,94,FALSE,0,100,FALSE,1,97,FALSE,0,94,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,99,FALSE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,94,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,84,FALSE,1,100,TRUE,0,99,TRUE,1,100,TRUE,1,90,TRUE,1,100,0,0,0,0.0001,0,0.0004,0,0.0625,0,0.0036,0,1,0.1521,0.4624,0.0009,0,0.0036,0.25,0,0,0,0.8836,0.0001,0.0009,0,0.7056,0.01,0,1,0,0.9801,0.0036,0.197121429,0.13825,0.255992857,28,87.5,26,81.25,5,62.5,6,75,8,100,7,87.5,14,87.5,12,75,93.53,80.75,98.5,95.62,99.25,94.38,92.69,6.25,12.28,18.25,23.5,-4.38,11.75,6.88,17.69,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,2,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,1,1,0,0.2,0.4,0.2,1,0.2,0.6,0,0.6,0.45,0.35,5.33,5.33,0,0,0,-1,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),63,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,0,1,0,1,0,0,0,-0.2,0.2,0.4,0.1,HS_TS +444,R_37Yheba8jAG5I0F,46 - 52,Canadian,Male,2,1,-2,-2,0,-1,-2,2,-1,1,1,0,0,-1,1,1,2,2,1,0,2,2,-2,-2,-1,2,-1,-2,2,-2,1,2,0,0,0,-2,1,2,1,2,1,2,1,3,2,2,-2,-2,0,2,-1,-1,2,-2,0,2,1,0,0,-2,1,2,1,2,2,2,1,1,FALSE,1,100,TRUE,1,100,FALSE,1,81,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,94,TRUE,1,76,TRUE,1,100,FALSE,0,100,TRUE,0,53,TRUE,0,55,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,52,TRUE,0,100,TRUE,0,65,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,51,TRUE,0,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0.0576,0,0,0.0036,0,0,0.3025,1,0,0,1,0,0,0.2809,0,0,0,0.1681,0.2401,0,0,1,0.4225,0,0.2304,0.2401,1,0,0.0361,1,1,0.3025,0.293685714,0.196535714,0.390835714,25,78.13,22,68.75,4,50,7,87.5,6,75,5,62.5,11,68.75,11,68.75,87.25,78.5,94,99.25,77.25,95.31,79.19,9.38,18.5,28.5,6.5,24.25,14.75,26.56,10.44,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,1,0.4,0.2,0.4,0.6,0.2,0.6,0.2,0.4,0.4,0.35,2,2,0,0,0,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,47,0.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,1,0,-1,0,0,-1,1,0,0,0,0,0,0,1,0,0,0.2,-0.4,0.2,0.2,0.05,C_Ug +445,R_5qQWvPnKhFCaiNv,60 - 66,American,Female,3,3,3,3,-3,-3,-1,-3,1,-1,2,-1,2,0,2,-1,-1,0,-1,-1,3,2,2,3,-3,2,-3,-2,-3,1,-3,2,2,-1,2,0,2,2,1,1,1,0,-1,7,3,2,2,3,-3,2,-3,0,-3,1,-3,5,2,-2,2,-2,2,2,-1,-1,-1,-1,-1,5,TRUE,0,100,TRUE,1,75,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,75,FALSE,1,50,TRUE,1,75,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,0,75,TRUE,0,50,FALSE,1,100,TRUE,1,75,TRUE,1,75,FALSE,1,100,TRUE,1,50,FALSE,1,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,75,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0.0625,0,0,0.25,0,0,0.0625,0,0.0625,0.0625,0.0625,0,0.0625,0,0.25,0,0.0625,0.0625,0.25,0.25,0.25,0.0625,0.25,0.25,1,0,0.5625,0.0625,0.25,0.147321429,0.058035714,0.236607143,8,25,27,84.38,5,62.5,8,100,6,75,8,100,15,93.75,12,75,78.91,59.38,87.5,81.25,87.5,81.25,76.56,-59.38,-5.47,-3.12,-12.5,6.25,-12.5,-12.5,1.56,0,1,1,0,0,0,1,0,0,2,0,0,0,0,0,2,2,1,1,0,0,1,1,0,0,0,1,0,0,2,0,1,0,2,0,0,0,1,0,0,0.4,0.6,0,1.2,0.4,0.6,0.6,0.2,0.55,0.45,2,3,0,-3,0,2,-1,5 cents,5 minutes,47 days,Female,Trade School (non-military),66,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,-1,0,-2,0,2,2,0,1,0,0,0,-0.6,1,0.1,HS_TS +446,R_1EYu8MtTbarT1nO,46 - 52,American,Female,3,3,3,1,2,3,2,3,3,2,3,3,3,0,3,-3,0,0,0,-3,3,3,3,3,3,2,3,3,3,2,3,1,3,1,3,1,1,6,2,2,2,2,0,10,3,3,3,2,1,4,2,2,3,3,0,4,3,3,3,-1,3,2,-3,-2,-3,-2,-3,10,TRUE,0,100,TRUE,1,100,TRUE,0,93,FALSE,1,57,TRUE,1,100,TRUE,0,85,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,79,TRUE,1,65,TRUE,1,97,FALSE,1,64,TRUE,0,100,TRUE,0,74,FALSE,1,87,TRUE,1,74,TRUE,1,66,FALSE,1,100,FALSE,0,72,FALSE,1,100,FALSE,0,59,FALSE,1,61,FALSE,1,65,TRUE,0,93,TRUE,1,99,FALSE,0,57,TRUE,1,100,0,0.3481,0.0009,0,0,0.7225,0.5184,0,0.0169,0.1156,0.0001,0,0.0064,0.0576,0,0,0,0.1849,0.1225,0,0.0676,0.1225,0.5476,0.6241,0.1296,0.1521,0.3249,1,0.8649,1,0.8649,1,0.301539286,0.115885714,0.487192857,23,71.88,21,65.63,6,75,6,75,4,50,5,62.5,13,81.25,8,50,84.84,72.75,89.5,88,89.12,86.31,83.38,6.25,19.21,-2.25,14.5,38,26.62,5.06,33.38,0,0,0,2,1,0,1,0,1,1,0,2,0,1,2,5,2,2,2,3,0,0,0,1,1,1,0,0,0,2,0,0,0,1,0,0,2,3,2,0,0.6,0.6,1,2.8,0.4,0.6,0.2,1.4,1.25,0.65,3,3.33,-2,-3,4,0,-0.33,10 cents,75 minutes,24 days,Female,University - Undergraduate,52,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,0,-1,1,0,1,-1,0,2,0,0,2,5,0,-1,0,3,0.2,0,0.8,1.4,0.6,C_Ug +447,R_1FVW9WLvMYgNwug,46 - 52,Canadian,Male,2,2,2,-1,2,2,1,3,-2,2,3,2,2,2,3,1,1,1,1,-1,3,2,1,-1,2,4,3,-1,2,-3,3,4,3,2,2,2,3,1,0,1,1,1,-1,4,2,2,2,1,2,3,2,2,3,3,3,4,2,3,3,2,2,4,-1,0,1,2,0,6,FALSE,1,60,FALSE,0,50,FALSE,1,57,FALSE,1,50,TRUE,1,97,FALSE,1,100,TRUE,1,97,TRUE,1,97,FALSE,0,54,FALSE,0,62,TRUE,0,90,TRUE,0,98,TRUE,1,92,FALSE,1,98,TRUE,1,73,TRUE,1,98,FALSE,1,56,TRUE,0,100,FALSE,1,54,FALSE,1,50,FALSE,0,55,TRUE,1,88,FALSE,1,50,TRUE,1,64,TRUE,0,72,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,85,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0009,0,0.0004,0.0009,0,0,0.1296,0.3844,0.25,0.0144,0,0.0064,0.2916,0.81,0.0009,0.25,0.25,0.25,0.49,0.5184,0.3025,0.0729,0.2116,0.0004,0.1936,0.25,0.25,0.16,0.1849,1,0.7225,0.9604,0.284089286,0.188378571,0.3798,27,84.38,21,65.63,4,50,6,75,5,62.5,6,75,11,68.75,10,62.5,75.53,58.88,79.38,84.62,79.25,79.81,71.25,18.75,9.9,8.88,4.38,22.12,4.25,11.06,8.75,1,0,1,0,0,1,2,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,1,0,5,1,1,1,1,0,1,2,1,0,1,1,0.4,1.2,0,0.2,0.4,1.4,0.8,1,0.45,0.9,3,3.67,1,0,-3,-2,-0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,52,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,0,1,-2,0,1,1,1,-4,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,0,-0.2,-0.8,-0.8,-0.45,C_Ug +448,R_7GHD4KYhAazV2oh,46 - 52,American,Female,3,3,3,2,3,-2,-2,1,-1,1,2,-1,3,-2,3,2,2,2,2,-1,3,3,3,2,3,4,-1,-2,1,-2,1,3,2,-1,2,-2,3,2,1,2,1,1,1,3,3,3,3,3,3,2,-2,-2,2,-2,1,2,2,-1,3,-2,3,2,2,2,2,2,1,1,TRUE,0,81,TRUE,1,96,TRUE,0,91,FALSE,1,50,TRUE,1,96,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,87,TRUE,1,93,FALSE,1,50,TRUE,0,50,TRUE,1,70,TRUE,0,60,TRUE,1,50,TRUE,1,92,TRUE,0,59,TRUE,0,92,FALSE,1,50,FALSE,1,96,TRUE,1,86,TRUE,1,77,FALSE,1,100,TRUE,1,75,FALSE,1,99,TRUE,1,81,TRUE,0,50,FALSE,1,61,TRUE,0,65,TRUE,1,96,FALSE,0,50,TRUE,1,51,0,0.0361,0.0064,0.0009,0.2401,0,0.0625,0.0049,0.0016,0.0529,0.0016,0.09,0.0169,0.25,0.0016,0.0016,0,0.25,0.1521,0.0001,0.0196,0.25,0.25,0.36,0.3481,0.25,0.25,0.6561,0.8281,0.8464,0.4225,0.25,0.209167857,0.06955,0.348785714,23,71.88,23,71.88,6,75,6,75,5,62.5,6,75,15,93.75,8,50,76.59,60.38,78.38,85,82.62,81.06,72.12,0,4.71,-14.62,3.38,22.5,7.62,-12.69,22.12,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,2,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,0,0.4,0.2,1,0.2,0.4,0,0.4,0.4,0.25,3,2,2,1,0,2,1,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),51,1,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,1,0,-1,0,0,0,0,1,0,0,1,0,1,1,0,-0.2,0,0.2,0.6,0.15,grad_prof +449,R_5hhEfortNPO7U2k,46 - 52,Canadian,Female,3,1,3,3,3,-2,1,3,0,1,3,0,2,-1,2,-2,0,0,0,-2,3,1,3,3,3,1,1,1,3,1,1,1,3,1,2,1,2,1,-2,-2,-2,-2,-2,4,3,1,3,3,3,1,0,0,2,0,0,1,3,1,2,-2,3,1,1,1,0,-2,-2,1,FALSE,1,55,TRUE,1,77,FALSE,1,81,FALSE,1,51,TRUE,1,59,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,84,TRUE,1,87,FALSE,1,68,TRUE,0,55,TRUE,1,77,FALSE,1,88,FALSE,0,55,TRUE,1,67,FALSE,1,52,TRUE,0,81,TRUE,0,64,FALSE,1,61,FALSE,0,59,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,60,FALSE,1,100,TRUE,0,95,TRUE,1,65,FALSE,0,51,TRUE,1,97,0,0.0625,0.1089,0.0324,0.0009,0,0,0.0169,0.1521,0.0625,0.1225,0.0529,0.0256,0.1024,0.1681,0.0529,0,0.2401,0,0,0.3481,0.3025,0.4096,0.0144,0.2304,0.36,0.2601,0.2025,0.0361,0.6561,0.9025,0.3025,0.179346429,0.071207143,0.287485714,16,50,24,75,4,50,6,75,7,87.5,7,87.5,13,81.25,11,68.75,75.66,63.75,79.88,80.38,78.62,75.62,75.69,-25,0.66,13.75,4.88,-7.12,-8.88,-5.63,6.94,0,0,0,0,0,3,0,0,1,0,0,1,0,2,0,0,2,2,2,0,0,0,0,0,0,2,1,1,0,1,0,1,0,1,1,3,1,0,2,0,0,0.8,0.6,1.2,0,1,0.6,1.2,0.65,0.7,1,1,0,0,0,3,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,46,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,1,-1,0,0,0,1,-1,-3,1,2,0,0,0,-0.2,0,0,-0.05,C_Ug +450,R_17rJWLnwTMigMBt,60 - 66,Canadian,Male,-2,1,2,-2,-1,-3,-2,1,1,0,1,-1,2,0,3,-2,-1,-1,0,0,-1,1,2,-2,-2,6,-3,-2,1,1,-1,7,1,-1,2,0,3,7,-1,-1,-1,0,0,6,-1,1,2,0,-1,7,-3,-1,1,1,0,8,1,-1,2,-2,3,7,-2,-1,-1,0,-1,6,FALSE,1,95,TRUE,1,69,TRUE,0,61,FALSE,1,72,TRUE,1,58,FALSE,1,58,TRUE,1,66,TRUE,1,75,TRUE,1,67,FALSE,0,69,FALSE,1,54,TRUE,0,64,FALSE,0,50,TRUE,0,96,TRUE,1,62,TRUE,1,100,FALSE,1,95,FALSE,1,85,FALSE,1,55,FALSE,1,57,TRUE,1,98,TRUE,1,67,FALSE,1,60,TRUE,1,92,FALSE,1,76,TRUE,1,98,FALSE,1,84,FALSE,1,86,TRUE,0,96,TRUE,1,100,FALSE,0,60,TRUE,1,96,0.0625,0.0004,0,0.1156,0.0016,0.1764,0.0064,0.4761,0.1849,0.1089,0,0.25,0.1089,0.2116,0.1764,0.0961,0.16,0.0784,0.0196,0.0576,0.0004,0.1444,0.2025,0.9216,0.0025,0.0256,0.36,0.0025,0.3721,0.0225,0.9216,0.4096,0.196364286,0.145407143,0.247321429,25,78.13,25,78.13,7,87.5,6,75,6,75,6,75,13,81.25,12,75,75.66,65.38,76.38,81.5,79.38,76.69,74.62,0,-2.47,-22.12,1.38,6.5,4.38,-4.56,-0.38,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,1,0.4,0.2,0,0.2,0.6,0.2,0.4,0.2,0.2,0.35,6.67,7.33,-1,-1,0,0,-0.66,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),66,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,0,-2,1,0,-1,0,0,1,0,0,0,-2,0,1,0,0,0,-1,-0.2,0,-0.4,0,-0.15,grad_prof +451,R_7hbkyFIQJB8GlLb,67 - 73,American,Male,2,2,2,-2,2,0,-2,2,-3,-1,2,-2,3,-2,2,0,0,1,1,2,2,2,2,-2,2,0,0,-3,2,-3,-1,0,2,-2,3,-2,2,0,0,0,2,0,2,5,2,2,2,-2,2,0,0,-2,2,-3,-1,0,2,-2,3,-2,2,0,-2,-2,0,2,2,3,FALSE,1,75,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0625,0,0,0.25,0.25,0.0625,0,0,0.25,0,0,0,0.25,0.25,1,0.0625,0.25,0,0.0625,1,0,1,1,0.205357143,0.0625,0.348214286,24,75,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,87.5,62.5,93.75,93.75,100,90.62,84.38,-9.38,3.12,-25,6.25,6.25,25,-9.38,15.63,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,1,0,0,0.2,0,0.4,0,0,0,1.2,0.15,0.3,0,0,0,0,0,2,0,5 cents,5 minutes,47 days,Male,Trade School (non-military),71,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,-2,-2,0,0,0,0,0.2,0,-0.8,-0.15,HS_TS +452,R_7dENSqRpiTdY0TI,67 - 73,American,Female,2,0,2,0,-2,-1,0,3,-1,2,3,0,3,-3,3,1,1,1,1,-2,3,2,-1,-3,-2,5,-1,-3,3,-3,2,4,3,1,3,2,3,6,-1,1,1,1,-2,5,3,-2,0,3,-3,8,-3,2,0,1,-3,9,3,0,3,-3,3,6,-1,-2,-1,2,-2,8,TRUE,0,90,TRUE,1,100,TRUE,0,64,FALSE,1,52,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,94,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0,0.0064,0,0.0064,0,0,0.2304,0,0,0,0,0,0.0036,0,0,0,0.81,0.4096,0,0.0225,0,0.088889286,0.0888,0.088978571,30,93.75,29,90.63,8,100,8,100,7,87.5,6,75,15,93.75,14,87.5,95.91,93,97.12,98,95.5,99,92.81,3.12,5.28,-7,-2.88,10.5,20.5,5.25,5.31,1,2,3,3,0,0,3,0,2,0,0,1,0,5,0,2,0,0,0,0,1,2,2,3,1,2,2,3,2,5,0,0,0,0,0,2,3,2,1,0,1.8,1,1.2,0.4,1.8,2.8,0,1.6,1.1,1.55,5,7.67,-3,-5,0,-3,-2.67,5 cents,5 minutes,47 days,Female,University - PhD,72,2,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,1,0,-1,-2,1,-3,0,-5,0,1,0,5,0,0,-3,-2,-1,0,0,-1.8,1.2,-1.2,-0.45,grad_prof +453,R_6lRKWj5nin6dJbr,67 - 73,American,Male,2,2,2,1,0,-2,-1,0,-2,2,1,-1,2,-2,2,0,-1,0,1,-1,2,2,2,-1,0,3,-2,-1,0,-2,1,2,1,0,2,-1,2,3,-1,-1,-1,-1,-1,3,2,2,2,1,0,2,-2,-2,0,-2,1,3,1,-1,2,-1,2,1,0,0,0,0,-1,5,FALSE,1,100,TRUE,1,74,TRUE,0,67,FALSE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,72,TRUE,1,68,TRUE,1,61,TRUE,1,76,FALSE,1,68,FALSE,1,89,FALSE,0,73,FALSE,1,100,FALSE,0,62,TRUE,1,77,FALSE,1,95,FALSE,1,84,TRUE,0,57,FALSE,1,74,TRUE,1,87,TRUE,1,58,FALSE,1,100,TRUE,1,92,FALSE,1,92,TRUE,1,100,TRUE,0,74,TRUE,0,69,TRUE,0,77,TRUE,1,82,TRUE,1,78,TRUE,1,100,0.1024,0,0.0529,0.0784,0,0,0.0064,0.0576,0.0676,0.1764,0.0324,0.5329,0.1521,0.1024,0.16,0.0676,0,0.1444,0.4761,0.0064,0.0169,0.3844,0.3249,0,0.0025,0.5476,0.0484,0,0.4489,0.0256,0.5929,0.0121,0.156660714,0.107128571,0.206192857,20,62.5,25,78.13,5,62.5,6,75,8,100,6,75,14,87.5,11,68.75,79,67,86.5,85.25,77.25,76.25,81.75,-15.63,0.87,4.5,11.5,-14.75,2.25,-11.25,13,0,0,0,2,0,0,0,0,0,1,0,1,0,1,0,1,0,1,2,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0.4,0.2,0.4,0.8,0,0.4,0.2,0.4,0.45,0.25,2.67,2,1,-1,2,-2,0.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,73,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,2,0,0,-1,0,0,0,0,1,0,0,0,1,-1,1,1,0,0.4,-0.2,0.2,0.4,0.2,C_Ug +454,R_5CBR3UkagBtfDFr,39 - 45,American,Female,3,3,3,1,-1,1,2,3,2,0,3,1,3,3,3,0,0,0,1,-3,2,3,3,3,1,10,-1,3,1,3,-1,4,3,3,-1,-1,2,8,-2,-2,-2,1,-2,8,3,1,3,2,-1,5,-1,0,1,0,-1,7,1,0,1,0,1,4,-1,-1,-1,2,-3,5,TRUE,0,55,TRUE,1,55,TRUE,0,94,FALSE,1,56,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,FALSE,1,54,TRUE,0,100,TRUE,1,64,TRUE,0,84,TRUE,1,54,TRUE,1,53,TRUE,0,65,TRUE,0,100,FALSE,1,53,FALSE,1,53,FALSE,0,54,TRUE,1,54,FALSE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,85,TRUE,0,53,FALSE,1,59,TRUE,0,81,TRUE,1,90,FALSE,0,54,TRUE,1,100,0,0.0225,0.2209,0,0,0,0,0,0.2209,0.2116,0.01,0.1296,0.3025,0.2116,0.0064,0.2025,0.2401,0.1936,0.1681,0,0.2916,0.2116,0.2209,0.7056,0.4225,0.2809,0.2916,0.3025,0.8836,1,0.6561,1,0.291564286,0.123485714,0.459642857,16,50,21,65.63,5,62.5,5,62.5,5,62.5,6,75,13,81.25,8,50,74,54.25,75.88,84.75,81.12,75.62,72.38,-15.63,8.37,-8.25,13.38,22.25,6.12,-5.63,22.38,1,0,0,2,2,2,1,2,1,1,0,2,4,4,1,2,2,2,0,1,0,2,0,1,0,2,2,2,2,1,2,1,2,3,2,1,1,1,1,0,1,1.4,2.2,1.4,0.6,1.8,2,0.8,1.5,1.3,7.33,5.33,5,-3,4,3,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),43,1.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,-2,0,1,2,0,-1,0,-1,0,-2,1,2,1,-1,1,1,1,-1,1,0.4,-0.4,0.2,0.6,0.2,HS_TS +455,R_5HnHpmaeIsczeAQ,25 - 31,Canadian,Male,1,3,2,3,1,-2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,1,1,1,3,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,6,FALSE,1,68,FALSE,0,51,TRUE,0,51,TRUE,0,50,FALSE,0,51,TRUE,0,51,TRUE,1,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2601,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1024,0.2601,0.25,0.25,0.25,0.246171429,0.252164286,0.240178571,9,28.13,18,56.25,4,50,4,50,7,87.5,3,37.5,8,50,10,62.5,50.69,50.12,50.25,52.25,50.12,50.12,51.25,-28.12,-5.56,0.12,0.25,-35.25,12.62,0.12,-11.25,0,2,1,0,1,2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,1,3,2,3,1,2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,0.8,0.4,1,1.2,2,0.4,1,1.2,0.85,1.15,6.33,7,0,-1,-1,1,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,26,0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,-1,-1,-1,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1.2,0,0,0,-0.3,C_Ug +456,R_7zLQPsiyRE1oW26,32 - 38,Canadian,Male,2,2,0,2,1,-1,0,1,0,1,0,0,1,0,2,1,1,1,0,1,-2,1,-2,-2,-3,7,-1,2,0,2,0,8,1,1,1,3,-2,7,0,1,1,-1,2,8,2,3,0,3,2,7,1,-2,1,-1,1,8,0,0,2,1,1,7,2,2,3,1,3,8,FALSE,1,100,FALSE,0,70,TRUE,0,89,TRUE,0,65,TRUE,1,100,TRUE,0,67,TRUE,1,74,TRUE,1,85,FALSE,0,63,TRUE,1,71,FALSE,1,58,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,57,TRUE,1,100,TRUE,0,82,TRUE,0,63,TRUE,0,67,FALSE,1,100,TRUE,1,65,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,63,TRUE,0,100,FALSE,1,61,TRUE,0,100,TRUE,1,81,FALSE,0,64,TRUE,1,76,0.0225,0.1369,0,0.0676,0.0576,0.4489,0.0225,0.0841,0,0.01,0.0361,0,0.3969,0.1764,0,0.49,0,0.4225,0.1521,0,0.1225,0.1849,0.4489,0.5625,0.6724,1,0.4096,0,0.7921,0.3969,1,1,0.317389286,0.153214286,0.481564286,16,50,19,59.38,2,25,5,62.5,6,75,6,75,13,81.25,6,37.5,80.34,68,86.25,79.5,87.62,77.75,82.94,-9.38,20.96,43,23.75,4.5,12.62,-3.5,45.44,4,1,2,4,4,0,2,1,2,1,1,1,0,3,4,1,0,0,1,1,0,1,0,1,1,2,2,0,1,0,0,0,1,1,1,1,1,2,1,2,3,1.2,1.8,0.6,0.6,1,0.6,1.4,1.65,0.9,7.33,7.33,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,38,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,4,0,2,3,3,-2,0,1,1,1,1,1,-1,2,3,0,-1,-2,0,-1,2.4,0.2,1.2,-0.8,0.75,C_Ug +457,R_3F5r2fdtLitN8uk,53 - 59,American,Male,3,2,2,0,-1,-1,1,2,1,1,2,0,3,-1,3,-3,-3,-2,-2,-3,3,2,2,0,-1,1,-2,3,0,3,0,5,2,0,3,-2,3,3,-3,-3,-2,-3,-3,7,3,1,2,0,-1,2,-2,1,2,2,0,3,2,0,3,-3,3,6,-2,-2,-1,-2,-3,8,TRUE,0,100,TRUE,1,95,FALSE,1,100,FALSE,1,75,FALSE,0,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,1,90,FALSE,1,90,TRUE,1,55,TRUE,1,100,FALSE,1,85,FALSE,1,90,FALSE,1,85,FALSE,1,100,FALSE,0,98,TRUE,1,100,FALSE,1,75,TRUE,1,98,TRUE,0,75,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,95,TRUE,1,90,TRUE,1,85,FALSE,0,85,0,0,0,0,0.7225,0,0.0004,0,0,0,0.01,0.01,0.4225,0.0625,0.7225,0.0025,0.0625,0.0625,0,0.5625,0.9604,0.2025,0.0225,0.01,0.0225,0.5625,0.0225,1,0,0.01,0.9025,0,0.226992857,0.148421429,0.305564286,25,78.13,24,75,6,75,4,50,6,75,8,100,12,75,12,75,89.56,76.25,89.12,94.38,98.5,90.38,88.75,3.13,14.56,1.25,39.12,19.38,-1.5,15.38,13.75,0,0,0,0,0,1,2,2,2,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,0,0,0,2,0,1,1,1,0,0,0,1.6,0.2,0.2,0.2,0.6,0.4,0.6,0.5,0.45,3,3.67,-1,2,-3,-1,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,1.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,-1,0,0,0,0,2,2,1,0,0,0,0,-1,0,-1,-1,-1,1,0,-0.2,1,-0.2,-0.4,0.05,C_Ug +458,R_1DP6m7WlbOvFoup,60 - 66,Canadian,Female,1,1,2,-2,2,-1,0,2,0,1,1,0,2,-2,3,-2,-1,0,-1,-2,2,2,2,0,2,5,0,1,2,1,0,4,2,-2,2,0,3,5,-3,-2,-2,-2,-2,3,2,2,2,1,2,6,0,1,1,0,1,4,2,-2,2,-2,3,4,-2,-1,0,0,-2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,84,FALSE,1,87,FALSE,0,50,TRUE,1,100,TRUE,1,85,TRUE,1,71,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,58,TRUE,1,81,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,91,TRUE,1,79,TRUE,1,100,0,0,0,0.25,0,0.0169,0,0.0841,0.25,0.0361,0.0081,0,0.0225,0.25,0.0256,0,0,0.25,0,0,0.1764,0.25,0.25,1,0.25,0.25,0.0441,0,1,0.25,1,0.25,0.202278571,0.067378571,0.337178571,25,78.13,22,68.75,4,50,7,87.5,5,62.5,6,75,14,87.5,8,50,79.25,64.25,84.88,81.5,86.38,84.31,74.19,9.38,10.5,14.25,-2.62,19,11.38,-3.19,24.19,1,1,0,2,0,1,1,0,1,1,1,2,0,2,0,1,1,2,1,0,1,1,0,3,0,1,1,1,0,0,1,2,0,0,0,0,0,0,1,0,0.8,0.8,1,1,1,0.6,0.6,0.2,0.9,0.6,4.67,4.67,-1,0,1,2,0,10 cents,25 minutes,15 days,Female,College Diploma/Certificate,61,1.5,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,-1,0,0,0,-1,1,1,0,0,0,2,0,1,1,2,0,0,-0.2,0.2,0.4,0.8,0.3,C_Ug +459,R_1ar5XFCcTOQEkYV,32 - 38,American,Male,2,3,3,1,2,1,-1,2,-1,0,3,1,1,2,2,2,1,2,3,1,2,1,3,1,2,8,1,0,2,0,2,8,3,2,1,2,1,6,-1,1,1,1,0,9,2,1,2,2,3,5,0,2,1,-1,1,5,1,1,3,2,2,8,3,1,0,1,2,8,TRUE,0,100,FALSE,0,77,TRUE,0,87,FALSE,1,59,TRUE,1,100,TRUE,0,92,TRUE,1,62,FALSE,0,61,TRUE,1,65,FALSE,0,58,TRUE,0,69,TRUE,0,69,FALSE,0,71,TRUE,0,67,FALSE,0,59,TRUE,1,100,TRUE,0,77,FALSE,1,98,FALSE,1,71,FALSE,1,65,TRUE,1,86,FALSE,0,83,FALSE,1,73,TRUE,1,96,FALSE,1,75,TRUE,1,83,FALSE,1,88,TRUE,0,90,FALSE,1,83,TRUE,1,100,FALSE,0,70,TRUE,1,90,0.3721,0.0289,0,0.1444,0.01,0.8464,0.0016,0.3364,0.1225,0.6889,0,0.5041,0.1225,0.4761,0,0.5929,0.0729,0.1681,0.81,0.0625,0.0196,0.3481,0.0841,0.4489,0.5929,0.0144,0.49,1,0.7569,0.0004,0.0289,0.4761,0.324114286,0.2816,0.366628571,16,50,17,53.13,4,50,5,62.5,4,50,4,50,9,56.25,8,50,78.88,69.75,84,78.25,83.5,78.81,78.94,-3.13,25.75,19.75,21.5,28.25,33.5,22.56,28.94,0,2,0,0,0,0,1,0,1,2,0,1,0,0,1,3,0,1,2,1,0,2,1,1,1,1,3,1,0,1,2,0,2,0,0,1,0,2,2,1,0.4,0.8,0.4,1.4,1,1.2,0.8,1.2,0.75,1.05,7.33,6,3,3,-2,1,1.33,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),36,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,-1,-1,-1,-1,-2,-1,1,1,-2,1,-2,0,1,2,0,-1,0,0,-0.6,-0.4,-0.4,0.2,-0.3,grad_prof +460,R_3ALShty7HyVU7Cj,18 - 24,American,Male,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,1,1,1,1,1,8,1,1,0,1,0,8,1,1,1,1,1,8,0,0,0,0,0,9,1,1,0,0,1,8,0,0,1,1,0,8,TRUE,0,74,TRUE,1,81,TRUE,0,93,TRUE,0,85,TRUE,1,84,TRUE,0,78,TRUE,1,94,TRUE,1,82,FALSE,0,59,FALSE,0,71,FALSE,1,67,TRUE,0,80,FALSE,0,70,TRUE,0,74,FALSE,0,76,TRUE,1,73,TRUE,0,71,FALSE,1,86,TRUE,0,70,TRUE,0,83,TRUE,1,69,TRUE,1,69,TRUE,0,69,TRUE,1,68,TRUE,0,81,TRUE,1,69,TRUE,0,67,TRUE,0,76,TRUE,0,68,TRUE,1,72,TRUE,1,75,TRUE,1,80,0.0324,0.0961,0.0729,0.0036,0.04,0.6084,0.1024,0.5041,0.6889,0.0961,0.0784,0.49,0.3481,0.1089,0.0256,0.0361,0.4761,0.7225,0.5776,0.6561,0.0961,0.5776,0.49,0.5476,0.5041,0.4489,0.0625,0.5476,0.8649,0.0196,0.4624,0.64,0.38645,0.308971429,0.463928571,18,56.25,14,43.75,3,37.5,3,37.5,4,50,4,50,12,75,2,12.5,75.44,72.5,73.62,77.25,78.38,74.5,76.38,12.5,31.69,35,36.12,27.25,28.38,-0.5,63.88,0,0,0,0,1,0,0,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0.2,0.2,1,0.6,0.8,0.2,0.6,0.4,0.5,0.5,8.33,8.33,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,22,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-1,-1,-1,-1,1,0,0,0,0,0,0,0,1,1,0,1,1,-1,0,0,-0.6,0,0.4,0.2,0,C_Ug +461,R_5RHvl8v1OXQu9uV,46 - 52,Canadian,Male,2,3,3,-1,1,1,-2,2,-1,2,1,-2,2,-2,2,2,1,2,2,2,1,3,2,-3,1,3,2,-2,2,-1,2,3,1,1,2,-2,3,0,2,2,1,2,2,4,2,3,2,2,-1,5,0,0,1,-1,0,4,1,-1,2,-2,2,4,2,2,2,2,2,0,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,0,1,1,1,0.285714286,0,0.571428571,28,87.5,24,75,5,62.5,7,87.5,6,75,6,75,15,93.75,9,56.25,100,100,100,100,100,100,100,12.5,25,37.5,12.5,25,25,6.25,43.75,1,0,1,2,0,1,0,0,0,0,0,3,0,0,1,0,1,1,0,0,0,0,1,3,2,1,2,1,0,2,0,1,0,0,0,0,1,0,0,0,0.8,0.2,0.8,0.4,1.2,1.2,0.2,0.2,0.55,0.7,2,4.33,-2,-1,-4,4,-2.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,48,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,1,0,0,-1,-2,0,-2,-1,0,-2,0,2,0,0,1,0,0,1,0,0,-0.4,-1,0.6,0.2,-0.15,C_Ug +462,R_1cs6UyRYsp5Jla9,46 - 52,American,Female,0,2,2,1,2,1,-3,3,-2,2,2,2,2,0,3,2,2,2,1,2,-2,2,2,2,2,0,1,-2,2,1,2,0,2,1,3,0,3,0,3,3,3,3,1,10,-1,2,2,2,2,0,2,-2,3,1,2,1,2,2,2,3,3,0,2,2,2,2,2,1,TRUE,0,75,TRUE,1,74,TRUE,0,71,FALSE,1,72,TRUE,1,67,TRUE,0,70,TRUE,1,98,TRUE,1,95,TRUE,1,62,TRUE,1,100,FALSE,1,52,TRUE,0,100,TRUE,1,89,TRUE,0,100,TRUE,1,57,TRUE,1,52,FALSE,1,59,TRUE,0,55,FALSE,1,54,FALSE,1,53,FALSE,0,54,FALSE,0,54,FALSE,1,51,FALSE,0,53,FALSE,1,51,TRUE,1,59,FALSE,1,82,FALSE,1,76,TRUE,0,51,TRUE,1,87,TRUE,1,74,TRUE,1,100,0.0025,0.1681,0.2304,0.0004,0,0.49,0.2809,0,0.2209,0.2916,0.0169,0.0121,0.1444,0.2304,0.1089,0.0676,0.2401,0.0784,0.0576,0.2401,0.2916,0.1849,0.2116,1,0.1681,0.0324,0.0676,0.5625,0.5041,0.3025,0.2601,1,0.252332143,0.155871429,0.348792857,16,50,22,68.75,8,100,5,62.5,4,50,5,62.5,13,81.25,9,56.25,70.22,65.88,67.62,74,73.38,73.44,67,-18.75,1.47,-34.12,5.12,24,10.88,-7.81,10.75,2,0,0,1,0,0,1,1,3,0,0,1,1,0,0,1,1,1,2,1,1,0,0,1,0,1,1,0,3,0,0,0,0,3,0,0,0,0,1,0,0.6,1,0.4,1.2,0.4,1,0.6,0.2,0.8,0.55,0,0.33,0,-1,0,9,-0.33,10 cents,5 minutes,47 days,Female,University - Undergraduate,50,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,1,0,0,0,0,-1,0,1,0,0,0,1,1,-3,0,1,1,1,1,1,0.2,0,-0.2,1,0.25,C_Ug +463,R_7EhzEr2Y4MmMbh1,18 - 24,Canadian,Male,-2,0,3,1,-3,3,-2,2,-1,0,1,-3,2,2,-2,-2,0,2,-3,1,-3,-1,-1,3,2,6,-2,1,-2,1,3,3,-2,0,3,-2,2,3,-2,2,0,3,0,4,3,-1,1,-2,1,10,0,-2,3,1,2,4,-3,3,2,-1,-2,8,-2,2,3,0,1,5,FALSE,1,65,TRUE,1,87,FALSE,1,70,TRUE,0,93,FALSE,0,83,TRUE,0,70,FALSE,0,91,TRUE,1,69,FALSE,0,80,TRUE,1,60,TRUE,0,91,FALSE,1,69,TRUE,1,80,FALSE,1,65,TRUE,1,60,TRUE,1,80,FALSE,1,84,TRUE,0,93,TRUE,0,71,TRUE,0,87,FALSE,0,64,TRUE,1,90,FALSE,1,82,TRUE,1,64,FALSE,1,63,TRUE,1,87,TRUE,0,54,TRUE,0,91,FALSE,1,57,TRUE,1,82,TRUE,1,64,FALSE,0,58,0.0961,0.0169,0.04,0.8281,0.3364,0.49,0.1296,0.16,0.7569,0.01,0.0324,0.04,0.64,0.8281,0.6889,0.0169,0.0324,0.8649,0.8281,0.1369,0.4096,0.16,0.5041,0.1225,0.0256,0.2916,0.1296,0.1225,0.09,0.8649,0.1849,0.0961,0.321175,0.359035714,0.283314286,26,81.25,19,59.38,3,37.5,4,50,6,75,6,75,11,68.75,8,50,75.12,75,72.25,76.75,76.5,74.94,75.31,21.87,15.74,37.5,22.25,1.75,1.5,6.19,25.31,1,1,4,2,5,5,3,4,2,3,3,3,1,4,4,0,2,2,6,1,5,1,2,3,4,3,0,1,2,2,4,6,0,3,0,0,2,1,3,0,2.6,3.4,3,2.2,3,1.6,2.6,1.2,2.8,2.1,4,7.33,-4,-1,-5,-1,-3.33,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,22,0.5,0,0,0,1,0,0,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-4,0,2,-1,1,2,3,3,0,1,-1,-3,1,1,4,0,0,1,3,1,-0.4,1.8,0.4,1,0.7,C_Ug +464,R_572QfiahRx8w0ez,46 - 52,American,Male,-2,1,1,-2,1,1,1,2,1,1,-1,-2,3,-2,1,1,1,2,1,1,-2,2,-1,-2,-1,3,2,1,1,1,-1,2,0,-1,3,-2,0,4,-3,-1,-1,1,-2,8,-2,1,-1,-1,2,1,2,-1,2,-1,0,1,-1,0,3,-3,1,2,1,1,1,2,2,3,FALSE,1,50,TRUE,1,60,TRUE,0,60,FALSE,1,50,FALSE,0,50,FALSE,1,65,TRUE,1,80,TRUE,1,85,FALSE,0,50,TRUE,1,55,FALSE,1,75,FALSE,1,65,TRUE,1,90,FALSE,1,65,FALSE,0,50,TRUE,1,100,FALSE,1,59,FALSE,1,50,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,65,FALSE,1,50,TRUE,1,65,FALSE,1,50,TRUE,1,75,TRUE,0,50,FALSE,1,80,TRUE,0,50,TRUE,1,85,TRUE,1,96,TRUE,1,90,0.0225,0.0625,0,0.04,0.01,0.1225,0.1225,0.2025,0,0.1225,0.0225,0.01,0.25,0.0625,0.25,0.16,0.25,0.25,0.04,0.25,0.25,0.25,0.25,0.1225,0.1681,0.25,0.0016,0.25,0.36,0.25,0.25,0.1225,0.166060714,0.131071429,0.20105,20,62.5,24,75,4,50,5,62.5,8,100,7,87.5,12,75,12,75,66.09,60.12,63,61.25,80,71.62,60.56,-12.5,-8.91,10.12,0.5,-38.75,-7.5,-3.38,-14.44,0,1,2,0,2,1,0,1,0,2,1,1,0,0,1,4,2,3,0,3,0,0,2,1,1,1,2,0,2,1,0,2,0,1,0,0,0,1,1,1,1,0.8,0.6,2.4,0.8,1.2,0.6,0.6,1.2,0.8,3,1.33,2,1,2,5,1.67,5 cents,5 minutes,47 days,Male,Trade School (non-military),52,1.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,1,0,-1,1,0,-2,1,-2,1,1,-1,0,-1,1,4,2,2,-1,2,0.2,-0.4,0,1.8,0.4,HS_TS +465,R_7KvDmDr5mNTxPd2,60 - 66,Canadian,Female,3,2,1,1,1,-1,-1,1,0,1,0,0,2,-2,1,-1,0,-1,-1,-2,1,2,1,0,-2,8,0,0,1,2,-1,4,1,2,-1,0,2,6,-2,-2,-2,-2,0,8,2,3,0,1,2,4,0,-2,2,-1,0,5,0,0,2,-3,2,3,0,0,1,0,0,6,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,71,FALSE,1,93,TRUE,1,82,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,80,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,50,FALSE,1,82,TRUE,0,89,TRUE,1,86,TRUE,1,50,TRUE,1,100,0,0.0625,0,0.0081,0,0,0,0,0,0,0.0196,0.0324,0,0.0841,0,0.0225,0.25,0.25,0.0324,0,0.64,0.25,0.25,1,0.25,0.25,0.25,0,0,1,0.7921,0.0049,0.192071429,0.047042857,0.3371,22,68.75,26,81.25,7,87.5,5,62.5,6,75,8,100,15,93.75,11,68.75,83.88,63.25,81.38,95.75,95.12,87.44,80.31,-12.5,2.63,-24.25,18.88,20.75,-4.88,-6.31,11.56,2,0,0,1,3,1,1,0,2,2,1,2,3,2,1,1,2,1,1,2,1,1,1,0,1,1,1,1,1,1,0,0,0,1,1,1,0,2,1,2,1.2,1.2,1.8,1.4,0.8,1,0.4,1.2,1.4,0.85,6,4,4,-1,3,2,2,5 cents,5 minutes,24 days,Female,University - Undergraduate,66,0.875,1,1,0,0,0,1,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,1,-1,-1,1,2,0,0,-1,1,1,1,2,3,1,0,0,2,-1,0,0,0.4,0.2,1.4,0.2,0.55,C_Ug +466,R_5MFNOcgzXAWhKb2,32 - 38,American,Female,3,3,3,3,2,0,0,2,1,1,2,3,3,2,3,1,1,1,0,0,2,3,3,3,2,7,0,0,3,3,1,5,3,2,3,3,3,5,1,0,1,0,0,5,3,3,3,3,3,5,1,2,3,1,3,9,3,3,3,2,3,6,3,2,2,2,2,9,TRUE,0,92,FALSE,0,50,FALSE,1,97,TRUE,0,65,TRUE,1,56,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,TRUE,1,76,TRUE,0,86,TRUE,1,50,FALSE,0,50,TRUE,0,81,TRUE,0,55,FALSE,1,50,FALSE,1,50,TRUE,1,57,FALSE,0,50,TRUE,0,84,TRUE,1,66,TRUE,0,50,FALSE,0,50,TRUE,0,69,TRUE,0,63,TRUE,0,55,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.25,0.25,0.25,0,0.25,0.1156,0,0.25,0.25,0,0.0576,0.25,0.0081,0.1936,0.25,0.7056,0.4225,0.3969,0.25,0.1849,0.25,0.25,0.7396,0.6561,0.4761,0.25,0.8464,0.0009,0.3025,0.3025,1,0.309246429,0.196642857,0.42185,7,21.88,14,43.75,3,37.5,5,62.5,1,12.5,5,62.5,9,56.25,5,31.25,66.97,59.38,69.88,66.62,72,62.81,71.12,-21.87,23.22,21.88,7.38,54.12,9.5,6.56,39.87,1,0,0,0,0,0,0,1,2,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,1,2,1,0,2,1,0,0,0,0,2,1,1,2,2,0.2,0.6,0.6,0.2,0.2,1.2,0.2,1.6,0.4,0.8,5.67,6.67,2,-4,-1,-4,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),36,0.5,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,1,0,0,0,-1,-1,-2,0,2,-2,0,1,0,1,0,-2,0,-1,-2,-2,0,-0.6,0.4,-1.4,-0.4,HS_TS +467,R_1nSHXHHFpEvrozL,25 - 31,Canadian,Female,1,2,0,1,0,-1,0,0,1,0,1,0,2,1,2,-1,-1,-3,-2,-3,-1,2,1,2,3,3,-1,0,0,2,1,3,1,0,0,2,2,3,-1,-1,-2,-1,-3,4,2,2,0,1,1,0,-2,0,0,2,1,2,0,0,2,1,1,0,-1,-1,-2,-1,-3,5,TRUE,0,50,TRUE,1,50,TRUE,0,69,FALSE,1,74,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,1,99,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,76,TRUE,1,73,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,79,FALSE,1,50,TRUE,0,50,FALSE,0,95,TRUE,1,69,FALSE,1,98,TRUE,1,92,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,0,59,FALSE,0,75,FALSE,0,50,FALSE,0,74,0.0001,0,0,0.0001,0.5476,0.25,0.0064,0.25,0.25,0.0961,0.5625,0.0729,0.25,0.25,0,0.25,0.0004,0.0676,0.25,0,0.9025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.4761,0.6241,0.3481,0.5776,0.277925,0.203821429,0.352028571,16,50,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,10,62.5,8,50,69.72,53,74.88,74.62,76.38,76.62,62.81,-6.25,13.47,-9.5,12.38,12.12,38.88,14.12,12.81,2,0,1,1,3,0,0,0,1,1,0,0,2,1,0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,1,1,0,1.4,0.4,0.6,0.4,0.4,0.6,0.4,0.4,0.7,0.45,3,0.67,3,1,3,-1,2.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),29,0.125,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,0,1,1,2,-1,0,0,0,0,-1,0,2,1,-1,0,0,0,0,0,1,-0.2,0.2,0,0.25,HS_TS +468,R_7mnrQ0GlaUV2Mkj,53 - 59,Canadian,Male,1,1,3,1,2,1,-3,1,-1,1,1,1,1,0,2,1,1,1,1,1,2,1,3,1,3,4,1,-2,1,-2,1,2,1,1,2,0,2,1,-1,-1,-1,-1,-1,9,1,1,3,1,1,2,1,-3,1,-2,1,2,1,1,2,0,2,2,1,3,3,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,52,FALSE,0,56,FALSE,1,60,TRUE,1,76,TRUE,1,88,FALSE,0,61,FALSE,0,58,FALSE,1,58,TRUE,0,100,TRUE,1,83,FALSE,1,64,FALSE,0,63,TRUE,1,56,TRUE,0,60,FALSE,1,59,TRUE,0,85,TRUE,0,85,FALSE,0,64,TRUE,1,87,TRUE,0,64,TRUE,1,87,TRUE,0,65,TRUE,1,72,TRUE,0,76,TRUE,0,73,TRUE,0,75,TRUE,1,92,TRUE,1,57,TRUE,1,90,0.0144,0.0784,0.1936,0.0576,0.01,0.16,0.0169,0.3364,0.7225,0.0169,0.0064,0.0289,0.3721,0.1764,0.3136,0,0.4096,0.2304,0.5329,0.4225,0.4096,0.3969,0.7225,0.1296,0.36,0.5776,0.1849,1,1,0.1681,0.5625,1,0.366685714,0.200007143,0.533364286,25,78.13,16,50,4,50,3,37.5,5,62.5,4,50,11,68.75,5,31.25,73.94,69,69,72.62,85.12,74.38,73.5,28.13,23.94,19,31.5,10.12,35.12,5.63,42.25,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,2,2,2,2,2,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,2,1,1,0.4,0.4,0.2,2,0.2,0.2,0.2,1.2,0.75,0.45,2.33,2,2,0,-1,7,0.33,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,57,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0.2,0.2,0,0.8,0.3,C_Ug +469,R_11PSrb2DfJaoQKt,46 - 52,Canadian,Female,3,3,0,-2,2,-1,1,2,3,1,3,1,3,0,3,-3,-3,-3,-3,-3,3,3,0,-1,2,5,1,0,0,0,0,5,3,0,3,0,3,5,1,1,1,-3,1,9,3,3,0,0,2,5,0,0,3,0,0,5,3,0,3,0,3,5,0,0,-1,0,-3,5,FALSE,1,69,TRUE,1,100,FALSE,1,50,FALSE,1,80,FALSE,0,78,FALSE,1,89,TRUE,1,97,TRUE,1,100,FALSE,0,79,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,94,TRUE,0,98,FALSE,0,77,TRUE,1,96,TRUE,0,78,FALSE,1,84,TRUE,0,78,TRUE,0,71,FALSE,0,71,TRUE,1,82,TRUE,0,79,FALSE,0,75,TRUE,0,100,TRUE,1,82,FALSE,1,66,FALSE,1,94,TRUE,0,85,TRUE,1,83,FALSE,0,77,TRUE,1,98,0,0.0324,0.0016,0.0009,0.0004,0.0121,0.5625,0,0.5041,0.0324,0.0289,0.0036,0.6241,0.0324,0.6084,0,0.6241,0.04,0.0036,1,0.5041,0.5929,0.6084,0.9604,0.6084,0.1156,0.5929,0.0961,0.25,0.0256,0.7225,1,0.362625,0.2195,0.50575,17,53.13,18,56.25,4,50,3,37.5,6,75,5,62.5,10,62.5,8,50,84.12,79.88,84,89,83.62,86.81,81.44,-3.12,27.87,29.88,46.5,14,21.12,24.31,31.44,0,0,0,1,0,2,1,2,3,1,0,1,0,0,0,4,4,4,0,4,0,0,0,2,0,1,1,1,3,1,0,1,0,0,0,3,3,2,3,0,0.2,1.8,0.2,3.2,0.4,1.4,0.2,2.2,1.35,1.05,5,5,0,0,0,4,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,46,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,-1,0,1,0,1,0,0,0,0,0,0,0,1,1,2,-3,4,-0.2,0.4,0,1,0.3,C_Ug +470,R_3LimH14pa2AtjvZ,46 - 52,Canadian,Female,3,3,-3,-2,3,1,-1,2,-2,2,3,1,3,-1,3,2,2,3,2,3,3,3,-3,-3,3,2,1,-1,2,-2,3,2,3,2,3,-1,3,2,2,2,3,2,3,2,3,3,-3,-1,3,2,1,-1,2,-2,2,2,3,2,3,-3,3,2,2,0,3,2,3,2,FALSE,1,100,TRUE,1,54,FALSE,1,100,FALSE,1,50,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,54,TRUE,1,75,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,58,FALSE,0,74,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,52,TRUE,1,100,TRUE,1,57,FALSE,1,54,TRUE,1,100,FALSE,1,54,TRUE,1,82,TRUE,0,58,FALSE,1,64,TRUE,0,54,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.0324,0.5476,0,0,0,0,0.0625,0.2304,0.1849,0,1,0.2916,0,0.0169,0.2116,0.2116,0.25,0.1296,0.2116,0,0.1764,1,1,0,0.3364,1,0,0,1,0.2916,1,0.307325,0.175678571,0.438971429,20,62.5,22,68.75,4,50,6,75,6,75,6,75,12,75,10,62.5,82.09,71.75,86.88,83.5,86.25,83.81,80.38,-6.25,13.34,21.75,11.88,8.5,11.25,8.81,17.88,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,2,0,0,0,0.2,0.2,0.2,0,0.2,0,0.6,0.4,0.15,0.3,2,2,0,0,0,0,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,49,0.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,1,0,0,0,-2,0,0,-2,0,0,0,0,0.2,-0.4,-0.4,-0.15,C_Ug +471,R_3N3mzNU5d4yDSl5,32 - 38,Canadian,Female,3,3,3,3,3,3,-3,3,-3,3,1,3,2,2,3,3,3,3,3,2,1,3,2,-2,-1,9,2,-3,0,-3,3,8,1,-2,1,2,0,8,-3,-1,-1,-3,2,8,1,2,2,2,1,5,3,-3,3,-3,3,4,1,2,3,3,2,0,3,2,3,1,3,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.142857143,0.142857143,0.142857143,32,100,28,87.5,8,100,7,87.5,8,100,5,62.5,15,93.75,13,81.25,100,100,100,100,100,100,100,12.5,12.5,0,12.5,0,37.5,6.25,18.75,2,0,1,5,4,1,0,3,0,0,0,5,1,0,3,6,4,4,6,0,2,1,1,1,2,0,0,0,0,0,0,1,1,1,1,0,1,0,2,1,2.4,0.8,1.8,4,1.4,0,0.8,0.8,2.25,0.75,8.33,3,4,4,8,4,5.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,32,1.25,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,-1,0,4,2,1,0,3,0,0,0,4,0,-1,2,6,3,4,4,-1,1,0.8,1,3.2,1.5,C_Ug +472,R_1lFXPYGgftyjMmR,46 - 52,Canadian,Male,1,2,2,-2,2,0,0,3,-3,1,0,-3,3,0,3,2,2,2,2,2,0,2,2,-3,2,3,0,1,3,-3,2,4,0,-3,3,1,3,2,2,2,2,2,2,2,1,2,2,0,3,2,0,0,3,-3,1,2,0,-3,3,1,3,2,2,2,2,2,2,2,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,54,TRUE,1,100,TRUE,1,84,FALSE,0,61,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,71,TRUE,1,78,TRUE,1,100,TRUE,0,91,TRUE,0,100,FALSE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,79,TRUE,1,87,TRUE,0,84,FALSE,1,96,TRUE,0,86,TRUE,1,100,TRUE,1,100,TRUE,1,86,0.0256,0.0169,0,0,0.0196,0.2116,0,0,0,0,0,0,0.3721,0,0.25,0.25,0.5625,0.25,0.0016,0.6241,0,0.0484,0.0025,0.0841,0.8281,0.7056,0,1,1,1,0.7396,1,0.319635714,0.136842857,0.502428571,25,78.13,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,86.78,77.25,80.25,92.12,97.5,87.25,86.31,12.5,21.15,14.75,17.75,29.62,22.5,-0.25,42.56,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.4,0.4,0.2,0,0.6,0,0.2,0,0.25,0.2,3,2,1,2,0,0,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,1.75,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,0,0,-1,-1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,-0.2,0.4,0,0,0.05,C_Ug +473,R_6zcFZItVldhRnQz,32 - 38,American,Male,-1,0,1,1,-1,0,0,2,0,1,2,3,1,0,0,-3,-2,-2,-3,-3,-1,0,1,1,0,0,0,0,-1,1,1,5,2,3,1,0,0,2,-3,-3,-3,-3,-3,4,-1,0,1,1,-1,0,0,0,2,0,1,0,2,3,1,0,0,0,0,0,0,0,0,5,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,75,TRUE,1,50,TRUE,1,50,TRUE,1,95,FALSE,1,75,FALSE,1,50,TRUE,1,60,FALSE,1,75,TRUE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,60,TRUE,0,60,TRUE,1,60,FALSE,1,75,TRUE,1,95,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,1,95,0.25,0.0025,0.0025,0.0625,0.0025,0.25,0.16,0.0025,0.25,0.16,0.0625,0.16,0.25,0.0625,0.25,0.25,0.36,0.25,0.25,0.0625,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.199821429,0.176428571,0.223214286,16,50,24,75,6,75,4,50,7,87.5,7,87.5,13,81.25,11,68.75,60.78,53.12,58.12,71.88,60,66.25,55.31,-25,-14.22,-21.88,8.12,-15.62,-27.5,-15,-13.44,0,0,0,0,1,0,0,3,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,2,3,3,0.2,0.8,0,0.4,0,0,0,2.6,0.35,0.65,2.33,0,0,5,2,-1,2.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,1,0,0,3,1,0,0,0,0,0,0,-3,-1,-1,-3,-3,0.2,0.8,0,-2.2,-0.3,HS_TS +474,R_6KL8A5jQBqTMmlP,46 - 52,American,Female,2,1,2,0,1,-2,0,1,0,0,0,0,2,-1,-2,-2,0,1,0,-2,2,2,2,0,2,5,-3,-2,0,-1,0,5,-1,0,0,0,-3,5,0,0,-2,0,0,5,2,1,2,0,0,5,-3,-2,0,-2,0,5,-2,-1,2,-2,0,5,0,0,0,0,-2,5,TRUE,0,98,FALSE,0,66,FALSE,1,91,FALSE,1,55,TRUE,1,95,FALSE,1,98,TRUE,1,94,TRUE,1,97,FALSE,0,58,TRUE,1,96,FALSE,1,54,TRUE,0,93,TRUE,1,88,TRUE,0,98,FALSE,0,69,TRUE,1,77,FALSE,1,66,FALSE,1,75,FALSE,1,82,FALSE,1,50,FALSE,0,90,FALSE,0,86,FALSE,1,100,TRUE,1,96,FALSE,1,50,TRUE,1,97,FALSE,1,50,FALSE,1,50,TRUE,0,94,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0009,0.0009,0.0529,0.0036,0,0.0004,0.0016,0.0016,0.25,0.7396,0.25,0.0144,0.3364,0.2116,0.0025,0.4356,0,0.2025,0.25,0.25,0.81,0.4761,0.0324,0.9604,0.1156,0.25,0.25,0.9604,0.0081,0.0625,0.8836,0.8649,0.307864286,0.174728571,0.441,25,78.13,21,65.63,4,50,6,75,5,62.5,6,75,9,56.25,12,75,78.53,60.5,91.38,86.75,75.5,81.81,75.25,12.5,12.9,10.5,16.38,24.25,0.5,25.56,0.25,0,1,0,0,1,1,2,1,1,0,1,0,2,1,1,2,0,3,0,2,0,0,0,0,1,1,2,1,2,0,2,1,0,1,2,2,0,1,0,0,0.4,1,1,1.4,0.2,1.2,1.2,0.6,0.95,0.8,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,51,0.875,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,1,0,0,0,0,0,0,-1,0,-1,-1,2,0,-1,0,0,2,0,2,0.2,-0.2,-0.2,0.8,0.15,C_Ug +475,R_6KUCD6O2Ur15fd7,46 - 52,American,Female,3,2,2,-1,3,1,-2,2,2,1,3,3,2,-2,3,2,2,2,3,2,2,2,1,-3,3,4,1,-3,3,2,2,5,3,3,2,-2,3,0,2,2,2,2,2,5,2,2,2,1,3,5,2,-3,2,1,2,5,3,3,3,-2,3,3,2,2,2,3,2,5,FALSE,1,82,TRUE,1,98,FALSE,1,84,TRUE,0,58,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,1,87,FALSE,0,77,TRUE,1,100,FALSE,1,75,TRUE,0,97,FALSE,0,70,FALSE,1,88,TRUE,1,91,TRUE,1,93,FALSE,1,75,TRUE,0,93,FALSE,1,96,FALSE,1,88,FALSE,0,82,TRUE,1,96,TRUE,0,80,TRUE,1,86,FALSE,1,78,TRUE,1,82,FALSE,1,89,FALSE,1,78,TRUE,0,94,TRUE,1,95,TRUE,1,90,TRUE,1,84,0.0169,0.0324,0.0049,0.0016,0.0256,0,0.0196,0,0.0144,0.0016,0.0025,0.49,0.5929,0.0625,0.0025,0.0004,0.64,0.3364,0.0484,0.0484,0.6724,0.0081,0.0016,0.0144,0.0625,0.0121,0.01,0.0324,0.0256,0.8649,0.8836,0.9409,0.207632143,0.156314286,0.25895,21,65.63,24,75,6,75,4,50,7,87.5,7,87.5,13,81.25,11,68.75,86.78,84.25,85,89.38,88.5,88.88,84.69,-9.37,11.78,9.25,35,1.88,1,7.63,15.94,1,0,1,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0.8,0.6,0,0.2,0.6,0.8,0.2,0,0.4,0.4,3,4.33,-1,0,-3,0,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,1,0,0,-1,0,1,-1,0,0,0,-1,0,0,0,0,0,1,0,0.2,-0.2,-0.2,0.2,0,C_Ug +476,R_6NTYh5c7onoo8gK,60 - 66,American,Female,3,2,-2,0,-2,-1,-1,1,1,0,1,-2,3,-3,3,-1,1,1,-2,-2,3,2,-2,0,-3,2,-3,-3,0,2,0,1,1,-2,3,-3,3,1,-1,1,1,-2,-2,1,3,2,-2,0,-1,2,-2,-2,0,2,0,2,1,-2,3,-3,3,2,-1,-1,0,-2,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,90,TRUE,1,100,TRUE,1,50,TRUE,1,90,FALSE,1,75,TRUE,0,75,FALSE,0,75,FALSE,1,95,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,0,75,TRUE,0,50,FALSE,1,75,FALSE,0,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,FALSE,1,50,FALSE,0,50,TRUE,0,75,FALSE,1,75,TRUE,0,75,TRUE,1,50,TRUE,1,75,FALSE,0,90,0,0.25,0,0.01,0.81,0.25,0.0625,0.01,0.0625,0.0625,0.25,0.5625,0.25,0.0625,0,0,0,0.25,0.0625,0.25,0.25,0.25,0.25,0.0025,0.0625,0.5625,0.0625,0,0,0.5625,0.5625,0.5625,0.216875,0.188035714,0.245714286,16,50,21,65.63,4,50,4,50,6,75,7,87.5,11,68.75,10,62.5,75.47,65.62,76.88,78.12,81.25,76.25,74.69,-15.63,9.84,15.62,26.88,3.12,-6.25,7.5,12.19,0,0,0,0,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,2,1,0,1,0.2,1.2,0,0,0.2,0.8,0,0.8,0.35,0.45,1.33,2,0,-1,-1,-4,-0.67,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),61,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,-2,-1,0,-1,0,0.4,0,-0.8,-0.1,grad_prof +477,R_6zAqowkNLFILVl3,67 - 73,American,Female,3,2,1,3,3,1,-3,1,-3,1,1,2,3,-2,2,-2,-2,-2,1,-2,3,3,3,3,3,5,2,-3,1,-3,2,5,1,3,2,-1,3,5,-2,-2,-2,-2,-2,5,3,3,0,3,3,5,2,-3,1,-3,2,5,1,3,3,-2,2,5,0,0,0,0,0,5,TRUE,0,80,TRUE,1,85,FALSE,1,100,TRUE,0,50,TRUE,1,80,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,80,FALSE,1,50,FALSE,0,100,TRUE,0,81,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,80,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,1,90,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,80,TRUE,1,100,0,0.01,0,0,0,0.25,0,0.25,0,0.25,0,1,0.25,0.64,0.04,0.0225,0,0.25,0,0.64,0.25,0.25,0.64,0.6561,0.25,0.25,0.04,0.64,0,1,0,0.25,0.279235714,0.210892857,0.347578571,25,78.13,21,65.63,5,62.5,6,75,2,25,8,100,12,75,9,56.25,79.25,65.62,78.75,78.88,93.75,80.31,78.19,12.5,13.62,3.12,3.75,53.88,-6.25,5.31,21.94,0,1,2,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,3,0,0,1,1,0,0,1,0,0,0,1,0,1,0,0,0,2,2,2,1,2,0.6,0.4,0.8,0.6,0.4,0.4,0.2,1.8,0.6,0.7,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,71,1.125,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,-2,-2,-2,2,-2,0.2,0,0.6,-1.2,-0.1,C_Ug +478,R_6QFnQ6N0jk3RNgP,60 - 66,Canadian,Male,-3,3,2,1,3,2,-2,3,-2,3,1,2,2,1,0,2,3,3,2,0,-3,3,1,-2,3,7,2,-2,2,-2,2,5,1,-2,2,1,1,6,1,2,2,2,2,7,-3,3,2,2,3,7,0,0,1,2,0,5,1,2,1,1,0,6,2,2,2,1,2,8,TRUE,0,92,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,82,FALSE,1,78,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,79,FALSE,0,78,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,FALSE,1,62,FALSE,0,94,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0,0,0,0.25,0.0484,0.25,0,0.1444,0,0,0,0.3025,1,0.0324,0,0.25,0.5625,1,1,0.8836,0.6084,1,0.0441,0.25,0.25,0.25,0.8464,1,1,0.25,1,0.436525,0.202871429,0.670178571,23,71.88,17,53.13,2,25,6,75,5,62.5,4,50,10,62.5,7,43.75,82.66,76,69.25,96.38,89,84.94,80.38,18.75,29.53,51,-5.75,33.88,39,22.44,36.63,0,0,1,3,0,0,0,1,0,1,0,4,0,0,1,1,1,1,0,2,0,0,0,1,0,2,2,2,4,3,0,0,1,0,0,0,1,1,1,2,0.8,0.4,1,1,0.2,2.6,0.2,1,0.8,1,6,6,0,0,0,-1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,63,0.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,1,2,0,-2,-2,-1,-4,-2,0,4,-1,0,1,1,0,0,-1,0,0.6,-2.2,0.8,0,-0.2,C_Ug +479,R_6c2EeRUiwhKfUjU,60 - 66,Canadian,Male,2,2,2,-1,1,-1,-1,1,1,-2,1,1,3,1,2,1,1,2,2,0,2,1,3,2,-2,9,2,2,2,1,1,9,2,1,1,2,1,9,1,1,2,1,2,9,2,1,2,2,3,9,2,1,1,2,1,9,2,1,1,1,2,8,2,2,2,3,1,9,TRUE,0,91,FALSE,0,94,TRUE,0,98,FALSE,1,88,FALSE,0,61,FALSE,1,97,TRUE,1,96,TRUE,1,97,FALSE,0,58,FALSE,0,62,FALSE,1,61,TRUE,0,95,TRUE,1,94,FALSE,1,66,FALSE,0,62,TRUE,1,97,TRUE,0,94,TRUE,0,97,FALSE,1,67,FALSE,1,92,FALSE,0,64,FALSE,0,64,FALSE,1,61,TRUE,1,81,TRUE,0,94,TRUE,1,66,FALSE,1,64,TRUE,0,95,TRUE,0,91,TRUE,1,95,FALSE,0,63,FALSE,0,67,0.0009,0.1156,0.0009,0.0016,0.4489,0.0009,0.0361,0.3844,0.0064,0.4096,0.0025,0.0036,0.3364,0.1521,0.3721,0.8836,0.1521,0.0144,0.9025,0.8836,0.4096,0.3844,0.1089,0.1156,0.8836,0.1296,0.3969,0.8281,0.9604,0.9409,0.8281,0.9025,0.424207143,0.228792857,0.619621429,25,78.13,15,46.88,4,50,3,37.5,3,37.5,5,62.5,7,43.75,8,50,80.38,69.62,78.62,79.5,93.75,76.31,84.44,31.25,33.5,19.62,41.12,42,31.25,32.56,34.44,0,1,1,3,3,3,3,1,0,3,1,0,2,1,1,0,0,0,1,2,0,1,0,3,2,3,2,0,1,3,1,0,2,0,0,1,1,0,1,1,1.6,2,1,0.6,1.2,1.8,0.6,0.8,1.3,1.1,9,8.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,62,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,1,0,1,0,1,1,-1,0,0,0,0,1,1,-1,-1,0,0,1,0.4,0.2,0.4,-0.2,0.2,C_Ug +480,R_1iR7JvUF5ip9eOn,60 - 66,Canadian,Male,3,1,3,1,3,0,0,1,0,0,0,0,0,0,0,-3,-2,-2,-1,-3,1,1,1,-1,1,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,0,TRUE,0,99,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0.25,1,1,1,0.5776,1,0.9801,1,1,1,1,0.493132143,0.285714286,0.70055,30,93.75,18,56.25,3,37.5,5,62.5,5,62.5,5,62.5,15,93.75,3,18.75,97.66,90.75,100,99.88,100,96.88,98.44,37.5,41.41,53.25,37.5,37.38,37.5,3.13,79.69,2,0,2,2,2,0,0,1,0,0,0,0,0,0,0,3,2,2,1,3,3,1,3,1,3,0,0,1,0,0,0,0,0,0,0,3,2,2,1,3,1.6,0.2,0,2.2,2.2,0.2,0,2.2,1,1.15,5,5.33,0,-1,0,5,-0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,60,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-1,-1,-1,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.6,0,0,0,-0.15,C_Ug +481,R_38Sz1L5x6DzjiHA,60 - 66,American,Male,2,2,2,1,0,1,1,2,1,1,0,1,2,-1,2,-2,-2,-2,3,-2,2,2,2,1,1,2,-2,1,2,1,0,4,-1,2,2,-2,2,2,-2,-2,-2,3,-2,2,2,2,2,1,0,2,1,1,2,1,1,2,-1,1,2,-2,2,2,-2,0,0,2,-2,2,FALSE,1,50,TRUE,1,90,TRUE,0,98,FALSE,1,77,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,93,TRUE,1,76,TRUE,1,100,TRUE,0,97,TRUE,0,100,TRUE,1,99,TRUE,0,98,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,96,FALSE,1,76,TRUE,1,100,TRUE,1,100,FALSE,1,97,TRUE,1,92,TRUE,0,75,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0.0049,0,0,0,0,0,0.0064,0,0.0576,0,0,0.0001,0.0576,0.9409,0.0064,0.01,0.0009,0.0529,1,0.5625,0,0.0576,0.9216,0.9604,0,0.5625,0.0324,0.25,0.9604,1,1,1,0.33715,0.080914286,0.593385714,24,75,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,16,100,6,37.5,91.84,83.62,98.5,90.38,94.88,93.75,89.94,6.25,23.09,21.12,11,27.88,32.38,-6.25,52.44,0,0,0,0,1,3,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,2,2,1,0,0.2,0.8,0.6,0,0,0,0.4,1,0.4,0.35,2.67,2,0,2,0,0,0.67,10 cents,5 minutes,24 days,Male,High School (or equivalent),66,0.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,1,3,0,0,0,1,0,1,0,0,0,0,-2,-2,-1,0,0.2,0.8,0.2,-1,0.05,HS_TS +482,R_3wEUroxBZQ4qxNG,53 - 59,Canadian,Male,1,1,1,1,1,-1,1,2,2,0,2,1,2,2,0,1,1,1,1,1,1,1,1,1,1,5,-1,1,2,2,1,5,1,1,1,0,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,69,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,80,TRUE,1,100,0,0,0,0,0,0,0,0,0,1,0,0,0.0625,1,0,1,0,0.5476,0,0,1,0,0.4761,0,0,0.25,0.04,1,1,0,0.8649,1,0.330039286,0.257864286,0.402214286,26,81.25,21,65.63,3,37.5,6,75,6,75,6,75,13,81.25,8,50,95.03,81,99.12,100,100,97.19,92.88,15.62,29.4,43.5,24.12,25,25,15.94,42.88,0,0,0,0,0,0,0,0,0,1,1,0,1,2,1,0,0,0,0,0,0,0,0,0,0,2,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0.2,1,0,0,1,0.8,0,0.3,0.45,5,5,0,0,0,0,0,15 cents,100 minutes,36 days,Male,University - Undergraduate,55,0.125,0,0,0,0,1,0,0,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,-2,0,-1,-1,0,0,0,0,1,0,0,0,0,0,0,0,-0.8,0.2,0,-0.15,C_Ug +483,R_7GUCMjzxXfZ7UvT,60 - 66,Canadian,Male,-3,2,3,-3,1,-1,-3,3,-2,-1,2,-2,3,-3,3,1,2,3,2,-1,-3,3,2,-3,1,3,1,-1,3,-1,1,2,1,-2,1,-1,3,2,1,1,1,1,-1,4,-2,2,2,-2,2,1,-1,-2,2,-2,1,3,2,-2,2,-3,3,1,1,1,2,2,-1,3,TRUE,0,76,TRUE,1,97,TRUE,0,96,TRUE,0,50,TRUE,1,86,FALSE,1,64,TRUE,1,97,TRUE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,59,TRUE,0,100,TRUE,1,98,TRUE,0,100,TRUE,1,60,TRUE,1,98,TRUE,0,50,TRUE,0,59,TRUE,0,60,FALSE,1,50,TRUE,1,55,TRUE,1,93,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,59,FALSE,1,50,TRUE,1,91,TRUE,1,92,TRUE,1,100,0,0,0.0004,0.0009,0,0.1296,0,0,0.25,0.0049,0.0081,0.0004,0.0081,0.1681,0.0196,0.0009,0.25,0.25,0.1681,0,0.2025,0.16,0.36,1,0.25,0.25,0.0064,0.5776,0.9216,0.3481,0.25,1,0.235142857,0.077835714,0.39245,26,81.25,22,68.75,5,62.5,6,75,5,62.5,6,75,16,100,6,37.5,79.09,69.88,69.12,90.62,86.75,91.12,67.06,12.5,10.34,7.38,-5.88,28.12,11.75,-8.88,29.56,0,1,1,0,0,2,2,0,1,2,1,0,2,2,0,0,1,2,1,0,1,0,1,1,1,0,1,1,0,2,0,0,1,0,0,0,1,1,0,0,0.4,1.4,1,0.8,0.8,0.8,0.2,0.4,0.9,0.55,2.33,1.67,2,-1,1,1,0.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,62,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,1,0,-1,-1,2,1,-1,1,0,1,0,1,2,0,0,0,1,1,0,-0.4,0.6,0.8,0.4,0.35,C_Ug +484,R_5bx13hGQXN0QbyF,60 - 66,Canadian,Female,2,3,2,-1,1,-2,-2,2,0,-1,1,1,0,-2,1,2,2,2,3,1,2,3,2,-1,1,3,-2,-2,2,0,0,2,2,1,0,1,1,4,1,1,0,1,1,3,3,3,2,-1,-1,3,-3,-2,2,-1,-2,1,2,1,0,-2,1,1,1,1,2,2,2,3,FALSE,1,69,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,88,FALSE,1,89,TRUE,1,95,TRUE,1,98,TRUE,1,59,TRUE,1,88,FALSE,1,58,FALSE,1,59,FALSE,0,67,TRUE,0,90,TRUE,1,50,TRUE,1,99,FALSE,1,61,TRUE,0,88,FALSE,1,61,FALSE,1,71,FALSE,0,94,TRUE,1,69,FALSE,1,87,TRUE,1,87,TRUE,0,62,TRUE,1,66,TRUE,0,64,FALSE,1,89,TRUE,0,70,FALSE,0,71,TRUE,1,82,TRUE,1,100,0.0004,0.1156,0.0001,0.0025,0,0.0121,0.0169,0.0144,0.0841,0.0961,0.5041,0.4489,0.1681,0.1764,0.0144,0.0081,0.0169,0.25,0.0121,0.3844,0.8836,0.25,0.1521,0.81,0.1521,0.4096,0.0324,0.0961,0,0.7744,0.49,0.1681,0.229478571,0.129321429,0.329635714,25,78.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,77.25,64.38,82,78.38,84.25,81.5,73,6.25,5.37,-10.62,19.5,15.88,-3.25,0.25,10.5,0,0,0,0,0,0,0,0,0,1,1,0,0,3,0,1,1,2,2,0,1,0,0,0,2,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,0,0.2,0.8,1.2,0.6,0.6,0.2,0.8,0.55,0.55,3,1.67,0,1,3,0,1.33,10 cents,5 minutes,36 days,Female,High School (or equivalent),66,0.875,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,-1,0,0,0,-2,-1,0,0,-1,0,0,0,0,3,0,0,0,2,1,-1,-0.6,-0.4,0.6,0.4,0,HS_TS +485,R_7rr9Lf4jp0qsiBP,60 - 66,American,Female,1,1,3,2,0,-2,0,2,0,1,3,1,2,-2,2,1,-1,2,2,-1,0,1,2,2,-3,7,-2,-1,1,0,1,6,2,1,1,1,1,7,1,1,2,0,2,6,2,2,3,3,-2,7,1,-1,1,-2,0,7,3,0,3,0,2,8,1,1,2,2,-1,5,FALSE,1,93,TRUE,1,92,TRUE,0,79,FALSE,1,51,TRUE,1,53,TRUE,0,52,FALSE,0,70,TRUE,1,52,TRUE,1,51,TRUE,1,72,FALSE,1,53,FALSE,1,70,TRUE,1,74,FALSE,1,51,TRUE,1,50,TRUE,1,73,FALSE,1,53,TRUE,0,58,TRUE,0,57,TRUE,0,82,TRUE,1,57,TRUE,1,61,FALSE,1,76,FALSE,0,52,TRUE,0,51,TRUE,1,57,TRUE,0,71,FALSE,1,70,FALSE,1,51,TRUE,1,93,FALSE,0,50,TRUE,1,100,0.2304,0.1849,0.0729,0.49,0,0.2704,0.2704,0.0784,0.6724,0.1521,0.0049,0.0676,0.2401,0.2209,0.2209,0.0064,0.0576,0.2401,0.09,0.2601,0.1849,0.25,0.3249,0.2401,0.2209,0.5041,0.25,0.0049,0.6241,0.3364,0.2401,0.09,0.218667857,0.178728571,0.258607143,21,65.63,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,13,81.25,9,56.25,64.84,59.38,64.5,64.12,71.38,66.06,63.62,-3.12,-3.91,-3.12,-23,1.62,8.88,-15.19,7.37,1,0,1,0,3,0,1,1,0,0,1,0,1,3,1,0,2,0,2,3,1,1,0,1,2,3,1,1,2,1,0,1,1,2,0,0,2,0,0,0,1,0.4,1.2,1.4,1,1.6,0.8,0.4,1,0.95,6.67,7.33,0,-1,-1,1,-0.66,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,1,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,-1,1,-1,1,-3,0,0,-2,-1,1,-1,0,1,1,0,0,0,2,3,0,-1.2,0.4,1,0.05,HS_TS +486,R_7rvHiXsBZBwFJzB,67 - 73,Canadian,Male,1,2,3,3,1,0,-2,2,-2,1,3,0,1,0,1,-1,-1,0,1,-1,2,2,3,3,1,6,-2,-2,2,-2,0,7,3,-1,1,1,1,7,1,1,1,1,-1,7,2,2,3,2,1,8,-2,-2,1,-2,-2,7,3,-1,2,0,2,7,-1,-1,-1,-1,-1,7,TRUE,0,100,FALSE,0,51,TRUE,0,100,TRUE,0,54,FALSE,0,53,FALSE,1,75,TRUE,1,80,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,80,TRUE,0,94,TRUE,1,95,TRUE,0,76,TRUE,1,62,TRUE,1,100,FALSE,1,100,TRUE,0,99,FALSE,1,75,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,98,FALSE,1,53,FALSE,1,87,TRUE,0,99,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0.0004,0,0.04,0,0.0625,0,0,1,0,0,0.0025,0.25,0.04,0.2809,0.2601,0.2304,0.2916,0.0169,0,0,0.1444,0.0625,0.5776,0,0.2209,0.2809,1,1,0.9801,0.9801,0.8836,0.305892857,0.172714286,0.439071429,26,81.25,21,65.63,5,62.5,6,75,5,62.5,5,62.5,13,81.25,8,50,83.94,59.75,84.25,94.12,97.62,83.88,84,15.62,18.31,-2.75,9.25,31.62,35.12,2.63,34,1,0,0,0,0,2,0,0,0,1,0,1,0,1,0,2,2,1,0,0,1,0,0,1,0,2,0,1,0,3,0,1,1,0,1,0,0,1,2,0,0.2,0.6,0.4,1,0.4,1.2,0.6,0.6,0.55,0.7,6.67,7.33,-2,0,0,0,-0.66,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,1.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,0,0,-1,0,-2,0,0,-1,1,-1,2,2,0,-2,0,-0.2,-0.6,-0.2,0.4,-0.15,C_Ug +487,R_3cvFlRg40Ei120A,39 - 45,Canadian,Male,2,3,2,1,3,-3,-1,2,-1,3,2,-2,1,1,3,0,0,0,-1,-1,2,3,2,0,3,2,-3,0,-2,0,2,6,3,-2,1,2,3,7,0,0,0,-2,-1,4,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,FALSE,0,75,FALSE,1,75,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,70,TRUE,1,50,TRUE,1,75,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,50,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,75,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.09,0,0,0.5625,0,0,0,0.0625,0.25,0,0.25,0,0.25,0,0.25,0.5625,0,0.25,0.0625,1,0.0625,0.25,1,0.0625,0.25,0.25,0.25,0,0.0625,1,0.5625,0,0.238839286,0.133928571,0.34375,20,62.5,21,65.63,3,37.5,6,75,5,62.5,7,87.5,11,68.75,10,62.5,78.75,65.62,81.25,90.62,77.5,76.25,81.25,-3.13,13.12,28.12,6.25,28.12,-10,7.5,18.75,0,0,0,1,0,0,1,4,1,1,1,0,0,1,0,0,0,0,1,0,2,3,2,1,3,3,1,2,1,3,2,2,1,1,3,0,0,0,1,1,0.2,1.4,0.4,0.2,2.2,2,1.8,0.4,0.55,1.6,5,5,-3,1,2,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-2,-3,-2,0,-3,-3,0,2,0,-2,-1,-2,-1,0,-3,0,0,0,0,-1,-2,-0.6,-1.4,-0.2,-1.05,HS_TS +488,R_5WNi0HR9SkD0VYR,60 - 66,American,Female,2,2,2,0,1,-1,-1,2,-2,0,3,3,1,-1,2,1,1,1,1,-2,2,2,2,2,2,2,-1,-2,2,0,-1,1,2,3,2,-3,2,1,-2,-1,1,0,-2,1,2,2,2,0,2,4,0,-3,2,-3,0,1,2,2,1,-3,2,3,-1,-1,0,0,-3,1,TRUE,0,91,FALSE,0,56,FALSE,1,100,FALSE,1,50,TRUE,1,58,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,53,TRUE,0,99,TRUE,1,75,TRUE,0,59,TRUE,1,50,TRUE,1,71,FALSE,1,56,TRUE,0,70,FALSE,1,50,FALSE,1,53,TRUE,1,57,TRUE,1,55,FALSE,1,78,TRUE,1,74,FALSE,1,69,TRUE,1,97,FALSE,1,56,FALSE,1,55,TRUE,0,100,TRUE,1,81,FALSE,0,54,TRUE,1,79,0,0.0009,0.0841,0.0576,0.0441,0,0.0676,0,0.2209,0.2025,0.0361,0.0625,0.1225,0.2209,0.1764,0.3136,0.0484,0.25,0.2025,0.0961,0.1849,0.25,0.25,0.3481,0.1936,0.1936,0.2916,0.8281,0,0.49,1,0.9801,0.252646429,0.126107143,0.379185714,16,50,25,78.13,6,75,7,87.5,5,62.5,7,87.5,14,87.5,11,68.75,71.47,54.25,75.38,77.12,79.12,71.75,71.19,-28.13,-6.66,-20.75,-12.12,14.62,-8.38,-15.75,2.44,0,0,0,2,1,0,1,0,2,1,1,0,1,2,0,3,2,0,1,0,0,0,0,0,1,1,2,0,1,0,1,1,0,2,0,2,2,1,1,1,0.6,0.8,0.8,1.2,0.2,0.8,0.8,1.4,0.85,0.8,1.33,2.67,-2,0,-2,0,-1.34,10 cents,100 minutes,24 days,Female,University - Undergraduate,63,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,2,0,-1,-1,0,1,1,0,-1,1,0,0,1,0,-1,0,-1,0.4,0,0,-0.2,0.05,C_Ug +489,R_6MhAwx12zO2geZ5,53 - 59,American,Male,3,3,3,0,-3,0,3,-3,3,-3,-3,-3,3,-3,0,-3,-3,-3,-3,-3,3,3,3,0,-3,0,0,3,-3,3,-3,0,-3,-3,3,0,0,0,-3,-3,-3,-3,-3,0,3,3,3,0,-3,0,0,3,-3,3,-3,0,-3,-3,3,-3,0,0,-3,-3,-3,-3,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,1,1,1,1,0.223214286,0.035714286,0.410714286,24,75,24,75,4,50,7,87.5,7,87.5,6,75,15,93.75,9,56.25,85.94,62.5,87.5,93.75,100,90.62,81.25,0,10.94,12.5,0,6.25,25,-3.13,25,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0,0,0.15,0,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),59,0,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0.6,0,0.15,HS_TS +490,R_7g8xvezOordk4nv,60 - 66,American,Female,2,3,3,2,3,-2,-3,3,-2,2,3,3,2,-3,2,2,2,3,3,2,2,3,3,2,3,2,-2,-3,3,-3,2,2,3,3,3,-3,2,1,2,2,3,2,3,6,2,3,3,3,-1,1,-3,-2,3,-2,2,1,3,3,1,-3,2,1,-1,1,0,1,1,1,FALSE,1,82,TRUE,1,93,FALSE,1,100,FALSE,1,55,TRUE,1,71,FALSE,1,100,TRUE,1,61,TRUE,1,100,TRUE,1,82,TRUE,1,81,FALSE,1,50,FALSE,1,63,TRUE,1,62,TRUE,0,100,TRUE,1,50,TRUE,1,57,FALSE,1,74,FALSE,1,100,TRUE,0,55,FALSE,1,98,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,100,TRUE,1,80,TRUE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,81,FALSE,0,50,TRUE,1,90,0,0.04,0.1849,0.1521,0.01,0,0.0576,0.0361,0.0004,0.25,0.0361,0.1444,0.0324,0.25,0.0841,0.0049,0,0.2025,0,0,0.25,0.25,0.3025,1,0.0676,0.25,0.25,0.0324,0,0,0.25,0.1369,0.139210714,0.079178571,0.199242857,25,78.13,26,81.25,5,62.5,7,87.5,6,75,8,100,13,81.25,13,81.25,75.34,60.62,74.62,81.75,84.38,70.88,79.81,-3.12,-5.91,-1.88,-12.88,6.75,-15.62,-10.37,-1.44,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,4,1,1,0,0,0,0,0,1,0,0,3,1,3,2,1,0,0.2,0.2,0.4,1,0.4,0.2,2,0.2,0.9,1.67,1,1,1,0,5,0.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,63,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-1,-4,-1,-1,0,1,0,0,0,0,0,0,-3,-1,-3,-1,0,-1,-0.2,0,-1.6,-0.7,C_Ug +491,R_3dFIVMPBxdyXYss,60 - 66,Canadian,Female,2,0,2,0,3,-1,-1,2,-3,1,2,-2,2,-2,3,2,2,2,2,2,2,0,2,1,2,4,-1,1,2,1,1,7,2,-2,-1,2,2,6,-1,0,1,-1,1,6,2,0,2,2,2,1,-2,0,2,-3,-1,2,2,-2,2,-3,3,1,1,1,2,2,2,2,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,65,FALSE,1,100,TRUE,1,60,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,FALSE,0,100,TRUE,1,50,TRUE,1,100,0,0,0,0.16,0,0,0,0,0.25,0.04,1,0,0.25,0.0625,0.1225,0,0,0.25,0,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.16,0,1,0.5625,0.0625,0.187857143,0.141071429,0.234642857,25,78.13,24,75,5,62.5,5,62.5,7,87.5,7,87.5,14,87.5,10,62.5,79.38,59.38,80,87.5,90.62,81.56,77.19,3.13,4.38,-3.12,17.5,0,3.12,-5.94,14.69,0,0,0,1,1,0,2,0,4,0,0,0,3,4,1,3,2,1,3,1,0,0,0,2,1,1,1,0,0,2,0,0,0,1,0,1,1,0,0,0,0.4,1.2,1.6,2,0.6,0.8,0.2,0.4,1.3,0.5,5.67,1.33,3,5,5,4,4.34,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,1.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,0,-1,1,0,4,-2,0,0,3,3,1,2,1,1,3,1,-0.2,0.4,1.4,1.6,0.8,C_Ug +492,R_1AFJJE4jeOYAfJc,53 - 59,American,Male,3,3,3,3,3,2,2,3,0,3,2,3,3,3,3,-3,0,-3,0,-3,3,3,3,3,3,3,1,3,3,3,3,2,3,3,3,3,3,3,-3,-3,-3,-3,-3,0,3,3,3,3,3,0,3,2,3,3,3,4,-2,3,3,3,-1,5,-1,0,0,0,-3,6,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.25,0.01,0,0,0,0,0,0,0.25,0,0,0,0,0,0,0.25,1,0.0576,1,0.25,0,0,1,1,0,0,1,0,1,1,1,1,0.350271429,0.111257143,0.589285714,28,87.5,20,62.5,5,62.5,6,75,6,75,3,37.5,13,81.25,7,43.75,92.69,90.75,100,92.5,87.5,93.12,92.25,25,30.19,28.25,25,17.5,50,11.87,48.5,0,0,0,0,0,1,1,0,3,0,1,0,0,0,0,0,3,0,3,0,0,0,0,0,0,1,0,0,3,0,4,0,0,0,4,2,0,3,0,0,0,1,0.2,1.2,0,0.8,1.6,1,0.6,0.85,2.67,3,3,-2,-2,-6,-0.33,10 cents,25 minutes,15 days,Male,High School (or equivalent),53,1.375,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,1,0,0,0,-3,0,0,0,-4,-2,3,-3,3,0,0,0.2,-1.4,0.2,-0.25,HS_TS +493,R_6DPoGEOTRfRezWV,53 - 59,Canadian,Female,3,-3,3,0,3,-3,1,3,3,-1,3,-1,1,1,3,-1,0,0,2,2,3,-3,2,-3,3,0,1,0,3,2,1,1,3,-2,0,1,1,1,2,2,2,2,1,10,3,-3,3,2,3,3,-2,0,3,2,-1,1,3,-2,0,-3,3,1,0,0,0,2,2,8,TRUE,0,85,FALSE,0,66,FALSE,1,68,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,87,TRUE,1,95,TRUE,1,50,FALSE,1,50,TRUE,0,66,TRUE,1,75,TRUE,0,100,TRUE,1,74,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,1,97,TRUE,0,75,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0169,0.25,0,0,0,0,0.01,0.25,0,0,0,0.0625,0.0025,0.25,0.04,0.4356,0,0.25,0.0009,0.25,0,0.0676,0.25,1,0.25,0.25,1,0.7225,0.1024,0.25,0.5625,0.4356,0.230075,0.0929,0.36725,23,71.88,21,65.63,4,50,6,75,4,50,7,87.5,14,87.5,7,43.75,78.38,66.88,85,73.12,88.5,85.44,71.31,6.25,12.75,16.88,10,23.12,1,-2.06,27.56,0,0,1,3,0,4,1,0,1,2,0,1,1,0,2,3,2,2,0,1,0,0,0,2,0,1,1,0,1,0,0,1,1,4,0,1,0,0,0,0,0.8,1.6,0.8,1.6,0.4,0.6,1.2,0.2,1.2,0.6,0.67,1.67,-3,0,0,2,-1,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),53,1.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,1,1,0,3,0,0,0,2,0,0,0,-4,2,2,2,2,0,1,0.4,1,-0.4,1.4,0.6,grad_prof +494,R_3F3tIXBjwMQ5kZi,53 - 59,Canadian,Male,3,3,3,3,3,1,0,1,-2,2,2,1,3,1,3,2,3,3,3,3,3,3,3,2,3,2,3,0,1,-1,3,1,2,2,3,2,3,1,3,3,3,3,3,3,3,3,3,3,3,0,1,0,1,-2,2,8,2,1,3,2,3,9,3,3,3,3,3,9,TRUE,0,100,TRUE,1,100,TRUE,0,96,FALSE,1,80,FALSE,0,64,FALSE,1,63,TRUE,1,60,TRUE,1,100,TRUE,1,70,FALSE,0,65,TRUE,0,77,TRUE,0,100,TRUE,1,97,TRUE,0,87,FALSE,0,65,TRUE,1,100,FALSE,1,87,FALSE,1,73,TRUE,0,86,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,66,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,79,FALSE,1,100,TRUE,0,87,TRUE,1,100,FALSE,0,96,TRUE,1,96,0,0.0025,0,0.16,0.0016,0.1369,0,0.4225,0,0,0,0.0009,0.09,0.5929,0.4096,0,0.1156,0.04,0,0,0.0225,0.4225,0.7396,0.7569,0.0169,0.0441,0.9216,1,0.9216,0.0729,0.7569,1,0.303053571,0.129285714,0.476821429,20,62.5,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,86.69,81.62,80.62,85,99.5,87.06,86.31,-3.13,21.06,31.62,5.62,22.5,24.5,12.06,30.06,0,0,0,1,0,2,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.2,0.8,0.4,0.2,0,0,0.2,0.2,0.4,0.1,1.33,5.67,2,-7,-8,-6,-4.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,1,0,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0.2,0.8,0.2,0,0.3,C_Ug +495,R_12Y2xhiqWBwP4Mi,60 - 66,American,Male,1,1,1,-2,-3,-2,-3,2,-2,-2,3,1,-2,-3,1,2,3,2,3,0,0,-1,2,-3,0,1,-3,-3,2,-3,-2,1,3,2,0,-2,2,1,2,2,3,2,-1,1,1,0,1,-2,-3,0,-3,-1,2,-3,-2,1,3,2,0,-3,1,1,3,3,3,3,0,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,54,FALSE,0,70,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,51,TRUE,1,96,FALSE,1,100,TRUE,0,98,FALSE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,51,TRUE,0,100,TRUE,0,90,TRUE,1,100,FALSE,0,75,TRUE,1,100,0,0,0,0,0,0,0,0.0016,0,0,0,1,0.2601,0,0.49,0,0,0.2116,1,0,0,0,0,1,0.7744,0.2601,0.5625,0,0,0,0.81,0.9604,0.261810714,0.140235714,0.383385714,21,65.63,22,68.75,5,62.5,4,50,7,87.5,6,75,12,75,10,62.5,92.91,78.88,93.5,99.5,99.75,93.25,92.56,-3.12,24.16,16.38,43.5,12,24.75,18.25,30.06,1,2,1,1,3,1,0,0,1,0,0,1,2,1,1,0,1,1,1,1,0,1,0,0,0,1,2,0,1,0,0,1,2,0,0,1,0,1,0,0,1.6,0.4,1,0.8,0.2,0.8,0.6,0.4,0.95,0.5,1,0.67,1,0,0,0,0.33,5 cents,5 minutes,24 days,Male,University - Undergraduate,66,0.125,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,1,1,1,1,3,0,-2,0,0,0,0,0,0,1,1,-1,1,0,1,1,1.4,-0.4,0.4,0.4,0.45,C_Ug +496,R_7eLg2r874DaAHXS,46 - 52,American,Male,2,1,1,1,2,0,0,1,-1,1,1,1,2,1,1,0,1,2,1,-1,1,1,1,1,1,4,1,1,1,0,1,4,1,1,1,1,1,6,0,0,0,0,-1,7,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,TRUE,0,97,TRUE,1,75,TRUE,0,95,TRUE,0,50,TRUE,1,50,TRUE,0,59,TRUE,1,90,TRUE,1,96,TRUE,1,50,TRUE,1,95,FALSE,1,57,TRUE,0,70,TRUE,1,94,TRUE,0,85,TRUE,1,50,TRUE,1,94,TRUE,0,50,FALSE,1,76,TRUE,0,60,TRUE,0,95,TRUE,1,90,TRUE,1,95,TRUE,0,60,TRUE,1,87,TRUE,0,60,TRUE,1,95,TRUE,0,60,FALSE,1,54,TRUE,0,52,TRUE,1,90,TRUE,1,90,TRUE,1,93,0.0016,0.0025,0.0036,0.01,0.0049,0.3481,0.0169,0.0025,0.9025,0.0025,0.01,0.0036,0.25,0.1849,0.25,0.0625,0.36,0.25,0.2116,0.36,0.01,0.25,0.36,0.7225,0.25,0.36,0.01,0.9409,0.9025,0.0576,0.2704,0.49,0.280139286,0.189171429,0.371107143,25,78.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,16,100,3,18.75,75.44,61.5,68.5,86.62,85.12,83.38,67.5,18.75,16.06,-1,18.5,24.12,22.62,-16.62,48.75,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,0,1,2,1,0,1,0,0,0,1,1,1,0,2,0,0,0,1,0,0,1,0,1,0,2,0.4,0.6,0.2,0.8,0.4,0.8,0.2,0.8,0.5,0.55,4.67,5,-1,-1,1,2,-0.33,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),50,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,1,1,1,-2,0,-0.2,0,0,-0.05,grad_prof +497,R_51EwmmhPhkag5zR,60 - 66,American,Female,3,2,2,1,1,-3,-2,2,-2,2,1,-1,3,-3,3,2,-1,2,2,-1,1,3,1,-1,3,7,1,1,1,1,2,8,0,-1,3,-3,3,2,-2,-1,-2,-1,0,3,2,2,2,2,-2,3,1,-2,2,-2,2,4,0,-2,3,-3,3,4,0,0,2,1,-1,4,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,0,50,TRUE,1,95,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,50,TRUE,1,95,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,75,TRUE,1,65,TRUE,1,100,FALSE,1,70,TRUE,0,85,TRUE,0,85,FALSE,1,95,FALSE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,85,FALSE,1,80,TRUE,1,95,TRUE,0,70,FALSE,1,90,TRUE,0,85,TRUE,1,80,FALSE,0,70,TRUE,1,95,0,0.0025,0,0.01,0.0025,0,0.0225,0.0025,0.0025,0.81,0.04,0.25,0.25,0.25,0.0025,0,0,0.25,0.01,0.04,1,0.1225,0.7225,0.0625,0.09,0.49,0.49,0,0.01,0.7225,0.7225,1,0.263035714,0.134464286,0.391607143,25,78.13,23,71.88,4,50,6,75,6,75,7,87.5,13,81.25,10,62.5,83.91,67.5,86.88,88.75,92.5,85,82.81,6.25,12.03,17.5,11.88,13.75,5,3.75,20.31,2,1,1,2,2,4,3,1,3,0,1,0,0,0,0,4,0,4,3,1,1,0,0,1,3,4,0,0,0,0,1,1,0,0,0,2,1,0,1,0,1.6,2.2,0.2,2.4,1,0.8,0.4,0.8,1.6,0.75,5.67,3.67,4,4,-2,-1,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,1,1,1,-1,0,3,1,3,0,0,-1,0,0,0,2,-1,4,2,1,0.6,1.4,-0.2,1.6,0.85,C_Ug +498,R_3hVZbhbk0TiHbhX,46 - 52,Canadian,Male,1,3,2,-1,3,1,-3,3,-3,-1,3,1,2,-2,1,-1,1,1,2,-1,1,3,2,-1,3,8,1,-2,3,-3,-2,8,3,1,2,-1,3,8,-1,-1,0,-1,-2,8,1,2,2,0,2,8,1,-3,2,-3,1,8,3,2,3,-2,2,8,-1,-1,1,1,-2,7,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,53,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,52,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,65,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0.2704,0,0.2809,0,0,0,1,1,0,1,1,0,1,1,0,1,0,1,0.4225,1,0.356207143,0.039378571,0.673035714,25,78.13,20,62.5,4,50,5,62.5,5,62.5,6,75,13,81.25,7,43.75,95.94,94,89.75,100,100,94.06,97.81,15.63,33.44,44,27.25,37.5,25,12.81,54.06,0,0,0,0,0,0,1,0,0,1,0,0,0,1,2,0,2,1,3,1,0,1,0,1,1,0,0,1,0,2,0,1,1,0,1,0,2,0,1,1,0,0.4,0.6,1.4,0.6,0.6,0.6,0.8,0.6,0.65,8,8,0,0,0,1,0,10 cents,100 minutes,15 days,Male,High School (or equivalent),51,1.875,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-1,0,-1,-1,0,1,-1,0,-1,0,-1,-1,1,1,0,0,1,2,0,-0.6,-0.2,0,0.6,-0.05,HS_TS +499,R_5PdYf6o5pPhwHuN,60 - 66,American,Female,2,3,3,3,3,2,-3,3,-1,2,3,3,3,0,3,2,2,3,3,1,2,3,3,3,3,1,2,-3,3,1,2,1,3,3,3,0,3,1,-1,1,-1,-1,-1,1,2,3,3,3,3,2,1,-3,3,-2,1,2,3,3,3,0,3,0,2,2,2,2,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,68,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0.1024,0,0,1,1,1,1,0.253657143,0.142857143,0.364457143,28,87.5,25,78.13,8,100,6,75,6,75,5,62.5,14,87.5,11,68.75,99,96,100,100,100,100,98,9.37,20.87,-4,25,25,37.5,12.5,29.25,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,4,4,2,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0.4,0,2.8,0,0.6,0,0.4,0.8,0.25,1,1.33,-1,-1,1,-1,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,1.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,-1,0,0,1,-1,0,0,0,0,0,3,1,3,3,2,0,-0.2,0,2.4,0.55,C_Ug +500,R_7CVPG5Jkd2rRrts,39 - 45,Canadian,Female,1,3,3,-1,3,2,-2,1,1,1,0,1,1,1,2,-1,-2,1,1,-3,3,3,3,1,3,4,2,-2,2,2,1,1,0,2,1,2,2,3,-1,1,1,1,-1,7,2,3,3,1,3,3,3,-3,2,-1,2,6,0,1,2,-1,2,2,1,1,2,2,-2,5,FALSE,1,84,TRUE,1,77,TRUE,0,97,FALSE,1,50,TRUE,1,90,FALSE,1,81,TRUE,1,100,TRUE,1,96,TRUE,1,96,TRUE,1,90,FALSE,1,86,TRUE,0,87,TRUE,1,100,FALSE,1,87,FALSE,0,57,TRUE,1,90,TRUE,0,91,FALSE,1,75,FALSE,1,81,FALSE,1,64,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,93,TRUE,1,74,FALSE,1,85,FALSE,1,100,FALSE,1,80,TRUE,1,92,TRUE,1,75,TRUE,1,83,0.0016,0.0676,0.01,0,0.0289,0.0361,0.0064,0.01,0.1296,0,0.0064,0,0.0016,0.0196,0.01,0.0529,0,0.25,0,0.0049,0.04,0.3249,0.0361,0.0169,0.8281,0.0225,0.0625,0.0256,0.9409,0.0625,0.04,0.7569,0.132617857,0.039392857,0.225842857,16,50,28,87.5,7,87.5,7,87.5,8,100,6,75,15,93.75,13,81.25,85.41,75.88,88.12,87.88,89.75,87,83.81,-37.5,-2.09,-11.62,0.62,-12.12,14.75,-6.75,2.56,2,0,0,2,0,0,0,1,1,0,0,1,0,1,0,0,3,0,0,2,1,0,0,2,0,1,1,1,2,1,0,0,1,2,0,2,3,1,1,1,0.8,0.4,0.4,1,0.6,1.2,0.6,1.6,0.65,1,2.67,3.67,1,-5,1,2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),45,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,1,0,0,0,0,-1,-1,0,-1,-1,0,1,-1,-1,0,-2,0,-1,-1,1,0.2,-0.8,-0.2,-0.6,-0.35,grad_prof +501,R_57s4MotjUN6HqHz,60 - 66,American,Female,-1,3,2,0,-2,1,0,3,0,0,2,1,2,0,1,-2,0,0,0,-3,-1,3,1,0,-1,5,0,1,3,0,1,7,2,2,2,2,2,6,0,0,0,0,-1,6,-1,2,0,0,-1,6,0,0,0,0,-1,7,2,3,2,0,2,4,1,0,0,1,-1,6,TRUE,0,96,TRUE,1,100,TRUE,0,81,FALSE,1,50,FALSE,0,51,FALSE,1,51,TRUE,1,71,TRUE,1,84,FALSE,0,51,TRUE,1,82,FALSE,1,51,TRUE,0,76,FALSE,0,71,FALSE,1,50,FALSE,0,51,FALSE,0,60,TRUE,0,60,TRUE,0,60,FALSE,1,54,FALSE,1,53,TRUE,1,60,FALSE,0,51,FALSE,1,50,FALSE,0,52,FALSE,1,100,TRUE,1,60,FALSE,1,50,FALSE,1,66,FALSE,1,53,TRUE,1,100,FALSE,0,51,TRUE,1,100,0.0256,0.16,0.36,0.0841,0,0.2401,0.2704,0.0324,0.2209,0.2601,0,0.5041,0.2601,0.2401,0.2601,0,0.25,0.25,0.1156,0,0.16,0.2601,0.2116,0.25,0.36,0.25,0.2601,0.9216,0.6561,0.36,0.2209,0.5776,0.263996429,0.199164286,0.328828571,17,53.13,19,59.38,5,62.5,5,62.5,5,62.5,4,50,8,50,11,68.75,65.5,57.25,62,71.25,71.5,68.44,62.56,-6.25,6.12,-5.25,-0.5,8.75,21.5,18.44,-6.19,0,0,1,0,1,1,1,0,0,1,0,1,0,2,1,2,0,0,0,2,0,1,2,0,1,1,0,3,0,1,0,2,0,0,1,3,0,0,1,2,0.4,0.6,0.8,0.8,0.8,1,0.6,1.2,0.65,0.9,6,5.67,-1,0,2,0,0.33,10 cents,25 minutes,15 days,Female,High School (or equivalent),65,0.5,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,-1,-1,0,0,0,1,-3,0,0,0,-1,0,2,0,-1,0,0,-1,0,-0.4,-0.4,0.2,-0.4,-0.25,HS_TS +502,R_6EhRcpqkjSAlOt7,60 - 66,American,Male,2,2,0,2,2,-1,-2,2,-2,0,1,1,0,1,1,2,1,2,2,1,1,0,0,-1,-1,0,2,-1,0,1,-2,0,1,-1,0,-1,0,0,0,-1,1,0,-1,0,1,-1,1,0,0,0,-1,0,0,-1,1,0,1,1,1,1,1,0,0,-1,0,1,0,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.25,0,0,0,0,0,1,0,0.25,0,0,1,0,1,1,0.169642857,0.035714286,0.303571429,32,100,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,95.31,87.5,93.75,100,100,96.88,93.75,15.62,10.93,0,6.25,12.5,25,-3.12,25,1,2,0,3,3,3,1,2,3,2,0,2,0,2,1,2,2,1,2,2,1,3,1,2,2,0,2,2,1,1,0,0,1,0,0,2,2,2,1,1,1.8,2.2,1,1.8,1.8,1.2,0.2,1.6,1.7,1.2,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,65,0,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,-1,-1,1,1,3,-1,0,2,1,0,2,-1,2,1,0,0,-1,1,1,0,1,0.8,0.2,0.5,C_Ug +503,R_6Iu7tgW5S1KMdS6,39 - 45,Canadian,Female,0,3,1,0,0,-2,1,1,1,1,0,0,2,1,2,-2,-2,-2,-3,-3,0,3,1,0,0,3,-2,1,1,1,1,2,0,-1,1,1,2,2,-2,-2,-2,-3,-3,2,1,3,1,0,1,4,-1,1,2,0,2,2,0,0,2,1,2,3,-1,-1,-1,-2,-3,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,55,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.2025,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.232142857,0.232142857,0.232142857,8,25,17,53.13,4,50,4,50,5,62.5,4,50,6,37.5,11,68.75,53.28,50,56.25,56.25,50.62,50.31,56.25,-28.13,0.15,0,6.25,-6.25,0.62,12.81,-12.5,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0.4,0,0.4,0.8,0,0.8,0.1,0.5,2.33,3,-1,0,-1,-4,-0.67,10 cents,5 minutes,47 days,Female,University - Undergraduate,41,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,0,0,0,-1,-1,0,-1,-1,-1,0,1,1,0,0,-1,-1,-1,-1,0,-0.4,-0.8,0.4,-0.8,-0.4,C_Ug +504,R_67rL8jAOKD0ykKU,46 - 52,Canadian,Female,1,2,3,3,3,-3,0,2,0,-1,2,-1,2,0,1,2,2,2,2,2,2,2,3,3,3,0,1,0,3,1,0,2,3,0,2,0,1,1,2,2,2,2,2,0,1,2,3,3,3,0,-3,0,3,-1,0,1,3,0,3,1,2,1,2,2,2,2,2,0,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,75,TRUE,1,75,TRUE,1,75,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,91,TRUE,1,90,TRUE,0,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,1,100,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,100,0.0625,0,0.25,0.0625,0,0.0625,0,0.01,0.25,0.25,0.0625,0.01,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,1,0,0.25,0.8281,0.249039286,0.153214286,0.344864286,16,50,20,62.5,6,75,3,37.5,6,75,5,62.5,11,68.75,9,56.25,69.41,50,64.38,83.12,80.12,69.06,69.75,-12.5,6.91,-25,26.88,8.12,17.62,0.31,13.5,1,0,0,0,0,4,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0.2,1.4,0.4,0,0,0.6,1,0,0.5,0.4,1,0.67,0,1,0,0,0.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,46,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,1,0,0,0,0,4,0,0,0,0,0,0,-1,-1,-1,0,0,0,0,0,0.2,0.8,-0.6,0,0.1,C_Ug +505,R_32DPnRQOpw7JI2X,60 - 66,American,Male,0,2,2,1,1,0,0,1,1,0,2,1,1,0,1,0,-1,-1,0,0,0,2,2,1,2,5,1,-1,1,0,1,8,2,1,1,0,1,5,1,0,1,0,1,8,0,2,2,1,2,6,0,0,1,0,0,7,2,2,1,0,2,6,1,0,1,0,0,7,FALSE,1,68,TRUE,1,68,TRUE,0,81,TRUE,0,59,TRUE,1,57,FALSE,1,64,TRUE,1,68,TRUE,1,63,FALSE,0,61,FALSE,0,71,FALSE,1,60,TRUE,0,68,TRUE,1,65,TRUE,0,72,FALSE,0,58,FALSE,0,68,TRUE,0,63,FALSE,1,69,FALSE,1,65,FALSE,1,86,FALSE,0,65,TRUE,1,62,FALSE,1,64,TRUE,1,60,TRUE,0,67,TRUE,1,65,FALSE,1,60,TRUE,0,72,FALSE,1,62,TRUE,1,64,FALSE,0,60,TRUE,1,77,0.1369,0.1225,0.4624,0.1024,0.0529,0.1296,0.16,0.5041,0.0196,0.1444,0.1296,0.1225,0.3721,0.16,0.1849,0.1024,0.1296,0.3481,0.5184,0.4489,0.4225,0.3364,0.1225,0.5184,0.3969,0.16,0.36,0.1024,0.6561,0.0961,0.1444,0.4624,0.2609,0.182842857,0.338957143,12,37.5,19,59.38,4,50,6,75,5,62.5,4,50,10,62.5,9,56.25,66,61.38,64.62,67.75,70.25,64.5,67.5,-21.88,6.62,11.38,-10.38,5.25,20.25,2,11.25,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,1,1,2,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,2,0,0,0.2,0.8,0,1,0.2,0.2,0.4,0.8,0.5,0.4,6,6.33,-1,1,-1,1,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),62,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,1,1,0,0,1,0,-1,0,0,-1,0,0,0,0,1,0,0.6,-0.4,0.2,0.1,HS_TS +506,R_3rrxpCpwguuOENK,53 - 59,Canadian,Male,3,3,3,3,-3,3,-3,3,-3,-3,3,3,0,0,2,3,3,3,3,3,3,3,3,3,-3,0,3,-3,3,-3,0,10,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,-3,0,3,-3,3,-3,-3,0,3,3,3,3,3,0,3,3,3,3,3,0,FALSE,1,100,FALSE,0,76,TRUE,0,100,TRUE,0,50,TRUE,1,80,FALSE,1,54,TRUE,1,100,TRUE,1,100,FALSE,0,58,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,1,87,TRUE,0,100,TRUE,1,91,TRUE,0,100,FALSE,1,100,TRUE,0,90,TRUE,1,100,TRUE,1,93,TRUE,1,100,0,0.0081,0,0,0,0.2116,0.0169,0,0,0,0,0,0.3364,0.8464,0.04,0.5776,0.8281,0.25,0,1,0,0,1,1,0.2401,1,0.0049,0,1,0,0.81,1,0.362928571,0.221928571,0.503928571,27,84.38,20,62.5,2,25,6,75,6,75,6,75,14,87.5,6,37.5,91.03,83.62,83.25,98.88,98.38,92.81,89.25,21.88,28.53,58.62,8.25,23.88,23.38,5.31,51.75,0,0,0,0,0,0,0,0,0,3,0,0,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,1,0,0,0,0,0,0,0.6,1.4,0,0,0,1.4,0,0.5,0.35,3.33,0,0,10,0,0,3.33,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,58,1.375,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0.15,C_Ug +507,R_5p5z6fZrDuttTgw,53 - 59,Canadian,Male,1,1,2,2,1,1,-2,3,-2,1,2,1,2,1,2,1,-1,1,1,-1,2,2,2,2,2,8,1,-1,0,1,2,3,2,2,2,1,2,7,1,-1,1,-2,-2,7,2,2,2,2,2,8,1,-3,2,-3,2,8,2,2,3,1,3,8,2,1,2,2,-2,8,FALSE,1,52,FALSE,0,50,TRUE,0,87,FALSE,1,66,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,98,TRUE,0,100,TRUE,0,80,TRUE,1,77,TRUE,0,90,TRUE,1,88,TRUE,1,100,TRUE,0,85,FALSE,1,89,FALSE,1,87,FALSE,1,98,TRUE,1,93,TRUE,1,100,FALSE,1,97,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,0,50,TRUE,0,100,TRUE,0,90,TRUE,1,98,TRUE,1,65,FALSE,0,75,0.0001,0.0025,0,0,0.5625,0,0.0025,0.0004,0.0004,0,0.0004,0.0529,0,1,0.0004,0.25,0.0009,0.1156,1,0.0025,0.0049,0.0144,0.0169,0.81,0.7225,0.25,0.1225,0.2304,0.7569,0.0121,0.81,0.64,0.263539286,0.141857143,0.385221429,25,78.13,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,14,87.5,8,50,87.41,75.75,89.38,89.88,94.62,89.44,85.38,9.38,18.66,13.25,26.88,2.38,32.12,1.94,35.38,1,1,0,0,1,0,1,3,3,1,0,1,0,0,0,0,0,0,3,1,1,1,0,0,1,0,1,1,1,1,0,1,1,0,1,1,2,1,1,1,0.6,1.6,0.2,0.8,0.6,0.8,0.6,1.2,0.8,0.8,6,8,0,-5,-1,-1,-2,10 cents,100 minutes,24 days,Male,University - Undergraduate,53,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,2,2,0,0,0,-1,0,-1,-1,-2,-1,2,0,0,0.8,-0.4,-0.4,0,C_Ug +508,R_1fdOXGrZjaVCOrT,53 - 59,Canadian,Male,1,2,2,-1,3,3,-2,1,0,2,2,-2,0,3,2,1,1,2,2,2,1,2,2,-2,3,2,3,-2,1,2,2,4,1,-2,1,3,2,2,1,1,1,-1,2,6,1,2,2,-1,3,2,2,-1,1,-2,1,3,1,-1,-1,2,2,4,2,2,2,2,2,2,FALSE,1,96,TRUE,1,92,TRUE,0,94,FALSE,1,50,TRUE,1,62,TRUE,0,82,TRUE,1,100,TRUE,1,85,FALSE,0,50,TRUE,1,100,FALSE,1,57,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,95,TRUE,0,96,FALSE,1,90,FALSE,1,100,FALSE,0,50,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,0,50,FALSE,1,100,TRUE,0,91,TRUE,1,90,TRUE,1,100,TRUE,1,100,0.0225,0.25,0,0,0,0.6724,0,0,0,0.0196,0.01,0,0.25,0.1849,0.1444,0.0064,0,0.25,0,1,0.25,0.25,0.01,0,0.0025,0.25,0,0.0016,0.8836,0.9216,0.8281,0.25,0.220896429,0.109835714,0.331957143,21,65.63,23,71.88,6,75,5,62.5,6,75,6,75,14,87.5,9,56.25,83.31,67.38,85,91,89.88,82.19,84.44,-6.25,11.43,-7.62,22.5,16,14.88,-5.31,28.19,0,0,0,1,0,0,0,0,2,0,1,0,1,0,0,0,0,1,3,0,0,0,0,0,0,1,1,0,2,1,1,1,1,1,0,1,1,0,0,0,0.2,0.4,0.4,0.8,0,1,0.8,0.4,0.45,0.55,2.67,3,0,1,-2,4,-0.33,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),58,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,1,0,-1,-1,0,0,-1,0,-1,0,-1,0,-1,-1,1,3,0,0.2,-0.6,-0.4,0.4,-0.1,grad_prof +509,R_5pmS9Q29astWndN,39 - 45,Canadian,Male,1,3,3,1,3,0,0,2,1,1,1,1,3,1,2,1,2,2,3,1,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,5,1,1,1,1,1,7,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,6,FALSE,1,92,TRUE,1,100,TRUE,0,98,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,97,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,55,FALSE,0,50,TRUE,1,57,FALSE,1,50,FALSE,1,60,TRUE,0,60,FALSE,1,100,FALSE,0,60,TRUE,1,50,FALSE,1,100,TRUE,1,52,TRUE,0,63,TRUE,1,95,TRUE,0,53,FALSE,1,93,TRUE,0,92,TRUE,1,100,TRUE,1,89,TRUE,1,96,0,0.0025,0.1849,0,0.0016,0,0.2304,0.0009,0,0.25,0,0,0.2304,0.25,0,0,0,0.25,0.0049,0.3969,0.36,0.25,0.36,0.2025,0.25,0.2809,0.0121,0.0064,0.9604,0.16,0.8464,1,0.225135714,0.086664286,0.363607143,28,87.5,22,68.75,3,37.5,6,75,7,87.5,6,75,14,87.5,8,50,78.56,63,87.25,76.5,87.5,81.12,76,18.75,9.81,25.5,12.25,-11,12.5,-6.38,26,0,2,2,0,2,1,1,1,0,0,0,0,2,0,1,0,1,1,2,0,0,2,2,0,2,1,1,1,0,0,1,1,1,1,0,0,1,1,2,0,1.2,0.6,0.6,0.8,1.2,0.6,0.8,0.8,0.8,0.85,3,3.33,-4,2,1,-1,-0.33,10 cents,100 minutes,47 days,Male,University - Undergraduate,44,0.625,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,-1,-1,1,-1,1,0,0,0,0,0,0,0,-0.2,0,-0.05,C_Ug +510,R_5pASad3k0CB72dF,53 - 59,Canadian,Male,0,1,1,1,3,0,-2,1,0,2,1,-2,2,-1,0,-2,-2,-2,-1,-1,1,1,2,1,2,3,0,-1,2,0,2,6,1,-1,2,-1,0,4,-2,-2,-2,-2,-3,8,1,1,1,1,2,3,0,-1,1,0,1,3,1,-1,2,-1,0,3,-1,-2,-1,-2,-1,4,TRUE,0,70,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,85,TRUE,1,100,TRUE,1,75,TRUE,1,90,FALSE,1,50,TRUE,0,75,TRUE,1,70,TRUE,0,100,TRUE,1,50,TRUE,1,90,TRUE,0,70,TRUE,0,75,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,75,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,90,TRUE,1,80,TRUE,1,100,0,0,0.01,0.0225,0,0,0.0025,0.01,0.25,0.0625,0.81,0.09,0.0625,0.25,0.0625,0.25,0.25,0.25,0.25,0,0,0.25,0.25,1,0.49,0.25,0.04,0.49,0.36,0.5625,0.25,0.5625,0.25375,0.167857143,0.339642857,18,56.25,22,68.75,6,75,7,87.5,5,62.5,4,50,15,93.75,7,43.75,74.22,56.88,76.88,86.88,76.25,82.81,65.62,-12.5,5.47,-18.12,-10.62,24.38,26.25,-10.94,21.87,1,0,1,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,1,2,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.2,0.6,0.4,0.4,0.2,0.6,0.45,0.4,4.33,3,0,3,1,4,1.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,53,1.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,1,0,0,0,0,1,0,-1,0,0,0,0,0,-1,0,-1,0,2,0.2,0,0,0,0.05,C_Ug +511,R_3f1Xozb2iQRXGhm,39 - 45,Canadian,Female,2,3,2,0,3,2,0,2,2,2,2,-1,3,3,3,-1,1,2,1,-1,3,1,2,-3,3,6,0,-1,1,-2,3,9,2,0,3,2,2,8,-3,-3,-3,-3,-3,8,3,3,3,0,3,4,1,0,2,0,3,4,0,0,3,0,2,4,2,2,2,2,2,7,TRUE,0,91,FALSE,0,62,FALSE,1,77,TRUE,0,72,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,1,97,FALSE,0,57,FALSE,0,93,FALSE,1,56,TRUE,0,81,TRUE,1,86,FALSE,1,97,FALSE,0,56,TRUE,1,95,TRUE,0,61,TRUE,0,96,TRUE,0,88,FALSE,1,100,FALSE,0,50,TRUE,1,94,FALSE,1,97,TRUE,1,86,TRUE,0,54,TRUE,1,73,FALSE,1,50,FALSE,1,51,TRUE,0,89,FALSE,0,53,FALSE,0,58,TRUE,1,100,0.0009,0.0729,0.0025,0,0,0,0.0196,0.8649,0,0.0036,0.2809,0.0196,0.3249,0.1936,0.0169,0.3844,0.0009,0.5184,0.2401,0.2916,0.25,0.3136,0.7744,0.0009,0.3721,0.25,0.3364,0.8281,0.0529,0.9216,0.7921,0.6561,0.310985714,0.187692857,0.434278571,24,75,17,53.13,2,25,5,62.5,4,50,6,75,9,56.25,8,50,78.34,62.38,83.75,87.25,80,77.94,78.75,21.87,25.21,37.38,21.25,37.25,5,21.69,28.75,1,2,0,3,0,2,1,1,4,1,0,1,0,1,1,2,4,5,4,2,1,0,1,0,0,1,0,0,2,1,2,1,0,3,1,3,1,0,1,3,1.2,1.8,0.6,3.4,0.4,0.8,1.4,1.6,1.75,1.05,7.67,4,2,5,4,1,3.67,5 cents,5 minutes,24 days,Female,High School (or equivalent),42,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,2,-1,3,0,1,1,1,2,0,-2,0,0,-2,0,-1,3,5,3,-1,0.8,1,-0.8,1.8,0.7,HS_TS +512,R_6mgx9iUVweotOgY,39 - 45,Canadian,Male,2,3,2,1,1,-1,-3,1,-3,1,3,2,3,0,3,1,1,2,2,-1,-1,2,2,-1,-1,1,-3,-3,-1,-3,-2,4,3,3,3,3,3,1,-1,-1,-1,-1,-1,8,2,3,3,1,2,1,0,-3,3,-3,3,1,3,3,3,3,3,1,3,3,3,3,3,5,TRUE,0,96,TRUE,1,96,FALSE,1,93,TRUE,0,74,TRUE,1,94,TRUE,0,90,TRUE,1,100,TRUE,1,57,TRUE,1,85,TRUE,1,75,FALSE,1,87,TRUE,0,93,FALSE,0,83,TRUE,0,70,TRUE,1,50,TRUE,1,98,FALSE,1,64,TRUE,0,98,TRUE,0,50,FALSE,1,93,TRUE,1,62,TRUE,1,93,TRUE,0,50,TRUE,1,100,FALSE,1,88,TRUE,1,50,FALSE,1,69,TRUE,0,63,TRUE,0,81,TRUE,1,100,FALSE,0,56,TRUE,1,92,0.1849,0.25,0.0004,0,0.0064,0.81,0,0.0625,0.0049,0.0049,0,0.6889,0.0225,0.0169,0.0036,0.0016,0.25,0.5476,0.3969,0.0144,0.1444,0.25,0.25,0.49,0.1296,0.0961,0.3136,0.9216,0.0049,0.9604,0.6561,0.8649,0.282596429,0.172842857,0.39235,25,78.13,20,62.5,5,62.5,4,50,5,62.5,6,75,14,87.5,6,37.5,79.69,70.88,77,83.75,87.12,80.69,78.69,15.63,17.19,8.38,27,21.25,12.12,-6.81,41.19,3,1,0,2,2,2,0,2,0,3,0,1,0,3,0,2,2,3,3,0,0,0,1,0,1,1,0,2,0,2,0,1,0,3,0,2,2,1,1,4,1.6,1.4,0.8,2,0.4,1,0.8,2,1.45,1.05,2,1,0,3,0,3,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,45,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,3,1,-1,2,1,1,0,0,0,1,0,0,0,0,0,0,0,2,2,-4,1.2,0.4,0,0,0.4,C_Ug +513,R_5Eff3JIxO7fBkqd,32 - 38,Canadian,Female,3,3,-1,3,1,-3,1,1,-1,0,2,3,3,-2,3,2,2,2,2,0,3,3,1,3,0,2,1,3,-1,3,0,7,-1,-1,2,1,0,5,-3,1,-3,-2,-1,7,3,3,-2,3,2,1,-3,-1,2,-1,0,5,3,3,3,-1,3,3,2,3,2,3,0,4,TRUE,0,74,FALSE,0,50,TRUE,0,69,FALSE,1,50,TRUE,1,69,FALSE,1,50,TRUE,1,50,TRUE,1,77,FALSE,0,50,TRUE,1,59,FALSE,1,50,TRUE,0,83,TRUE,1,78,FALSE,1,50,FALSE,0,53,TRUE,1,85,TRUE,0,50,TRUE,0,76,FALSE,1,80,FALSE,1,62,FALSE,0,76,TRUE,1,74,FALSE,1,100,TRUE,1,78,FALSE,1,97,TRUE,1,50,FALSE,1,50,FALSE,1,95,TRUE,0,83,TRUE,1,51,FALSE,0,66,TRUE,1,92,0.0529,0.25,0.0225,0.25,0.0064,0.25,0.0484,0.1681,0.1444,0.0676,0.2401,0.0484,0.25,0.25,0.0961,0.25,0,0.25,0.0025,0.0009,0.5776,0.2809,0.04,0.25,0.25,0.25,0.4356,0.5476,0.4761,0.5776,0.6889,0.6889,0.254860714,0.147821429,0.3619,21,65.63,21,65.63,4,50,5,62.5,6,75,6,75,11,68.75,10,62.5,68.03,56.12,74.75,66.25,75,66.12,69.94,0,2.4,6.12,12.25,-8.75,0,-2.63,7.44,0,0,2,0,1,4,2,2,4,0,3,4,1,3,3,5,1,5,4,1,0,0,1,0,1,0,2,1,0,0,1,0,0,1,0,0,1,0,1,0,0.6,2.4,2.8,3.2,0.4,0.6,0.4,0.4,2.25,0.45,4.67,3,1,2,2,3,1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,32,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,1,0,0,4,0,1,4,0,2,4,1,2,3,5,0,5,3,1,0.2,1.8,2.4,2.8,1.8,C_Ug +514,R_6M0eRrQkHoeb5OD,39 - 45,Canadian,Male,3,2,2,-2,3,-2,-1,-1,-1,3,1,-3,3,-3,3,-3,-3,-3,-3,-3,3,0,-2,-2,3,5,-2,-3,-1,-2,3,4,1,-3,3,-2,3,4,-3,-2,-1,-3,-1,3,3,2,0,1,3,3,-1,-2,1,-2,3,3,0,-3,3,-3,3,1,-1,1,2,1,-3,4,TRUE,0,74,TRUE,1,83,TRUE,0,74,FALSE,1,50,FALSE,0,50,TRUE,0,57,TRUE,1,72,TRUE,1,58,TRUE,1,65,TRUE,1,70,TRUE,0,59,TRUE,0,76,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,61,TRUE,0,91,TRUE,0,100,TRUE,0,55,TRUE,1,73,FALSE,0,62,TRUE,0,54,TRUE,1,80,FALSE,1,56,TRUE,1,73,FALSE,1,52,FALSE,1,100,TRUE,0,59,FALSE,0,72,FALSE,0,68,FALSE,0,62,0.1764,0.0729,0,0.0784,0.3844,0.3249,0.04,0.09,0.3025,0.3844,0.5184,1,0.1225,0.3481,0.25,0.0289,0.2916,0.25,0,0.1936,0.0729,0.25,1,0,0.1521,0.2304,0.4624,0.5476,0.5476,0.8281,0.3481,0.5776,0.340932143,0.309692857,0.372171429,16,50,16,50,5,62.5,2,25,5,62.5,4,50,10,62.5,6,37.5,70.5,65.88,64.5,74.75,76.88,71.12,69.88,0,20.5,3.38,39.5,12.25,26.88,8.62,32.38,0,2,4,0,0,0,2,0,1,0,0,0,0,1,0,0,1,2,0,2,0,0,2,3,0,1,1,2,1,0,1,0,0,0,0,2,4,5,4,0,1.2,0.6,0.2,1,1,1,0.2,3,0.75,1.3,4.33,2.33,2,1,3,-1,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,43,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,2,2,-3,0,-1,1,-2,0,0,-1,0,0,1,0,-2,-3,-3,-4,2,0.2,-0.4,0,-2,-0.55,C_Ug +515,R_34vzQKoASOHHcL9,32 - 38,Canadian,Female,1,2,3,3,2,0,1,1,-2,3,-1,-2,3,-2,1,3,-2,-1,2,3,-2,3,3,3,3,2,-3,3,-2,3,-1,10,3,-2,3,1,3,5,-2,0,-3,-3,-3,7,-2,3,3,3,1,4,3,1,3,-3,3,7,-3,-1,1,-3,1,5,3,3,3,3,3,7,FALSE,1,70,TRUE,1,51,FALSE,1,92,TRUE,0,51,TRUE,1,90,FALSE,1,100,TRUE,1,78,TRUE,1,90,FALSE,0,50,TRUE,1,81,FALSE,1,52,TRUE,0,92,TRUE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,95,FALSE,1,58,TRUE,0,76,FALSE,1,66,FALSE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,67,TRUE,1,100,TRUE,0,50,TRUE,1,93,FALSE,1,55,FALSE,1,82,TRUE,0,85,TRUE,1,70,FALSE,0,81,TRUE,1,96,0.01,0.0049,0.0025,0.0484,0.0016,0,0,0.0361,0,0.0036,0.09,0.25,0.25,0.2304,0.01,0.2401,0.1089,0.2601,0.0324,0.25,0,0.5625,0.1156,0,0.1764,0.2025,0.6561,0.09,0.0064,0.5776,0.7225,0.8464,0.204257143,0.105771429,0.302742857,20,62.5,24,75,4,50,7,87.5,6,75,7,87.5,13,81.25,11,68.75,77.81,60.12,80.75,80.25,90.12,80.88,74.75,-12.5,2.81,10.12,-6.75,5.25,2.62,-0.37,6,3,1,0,0,1,3,2,3,5,4,4,0,0,3,2,5,2,2,5,6,3,1,0,0,1,3,0,2,1,0,2,1,2,1,0,0,5,4,1,0,1,3.4,1.8,4,1,1.2,1.2,2,2.55,1.35,5.67,5.33,-2,3,0,0,0.34,10 cents,5 minutes,47 days,Female,University - Undergraduate,34,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,2,1,4,4,2,-1,-2,2,2,5,-3,-2,4,6,0,2.2,0.6,2,1.2,C_Ug +516,R_7lbgMntFFRBybCp,46 - 52,Canadian,Male,2,3,1,1,3,-2,3,2,0,2,1,0,3,-3,3,1,1,2,2,-3,3,3,2,0,1,2,-3,2,0,3,1,2,-3,0,3,-3,2,3,1,2,2,1,-3,7,2,3,1,2,3,0,-2,1,1,0,3,2,2,0,3,-2,3,8,1,1,1,0,-3,5,TRUE,0,100,TRUE,1,100,TRUE,0,85,TRUE,0,50,TRUE,1,92,FALSE,1,100,TRUE,1,85,TRUE,1,95,TRUE,1,96,TRUE,1,100,FALSE,1,80,TRUE,0,90,TRUE,1,98,TRUE,0,100,TRUE,1,50,TRUE,1,80,FALSE,1,50,TRUE,0,70,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,90,FALSE,1,89,TRUE,0,100,TRUE,1,91,TRUE,1,99,TRUE,1,100,0.0025,0,0.04,0.0225,0,0,0,0,0,0.0009,0.0081,0.0004,0.0016,0.04,0.0064,0,0,0.25,0.0121,0,1,0.25,0.25,1,0.25,0.81,0.0001,1,0.7225,0.49,1,0.81,0.282217857,0.021957143,0.542478571,28,87.5,23,71.88,6,75,6,75,5,62.5,6,75,15,93.75,8,50,88.66,76.88,92.5,94,91.25,92.69,84.62,15.62,16.78,1.88,17.5,31.5,16.25,-1.06,34.62,1,0,1,1,2,1,1,2,3,1,4,0,0,0,1,0,1,0,1,0,0,0,0,1,0,0,2,1,0,1,1,0,0,1,0,0,0,1,2,0,1,1.6,1,0.4,0.2,0.8,0.4,0.6,1,0.5,2.33,3.33,2,0,-5,2,-1,5 cents,5 minutes,47 days,Male,High School (or equivalent),51,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,1,0,1,0,2,1,-1,1,3,0,3,0,0,-1,1,0,1,-1,-1,0,0.8,0.8,0.6,-0.2,0.5,HS_TS +517,R_31Mug8JPXfCCLlL,32 - 38,Canadian,Female,2,2,2,1,3,1,2,2,1,2,3,1,2,2,2,2,3,1,2,2,1,2,1,2,2,8,2,2,1,3,2,9,1,2,2,3,2,8,2,2,1,3,2,9,1,2,1,2,1,8,1,3,2,1,2,8,2,1,1,1,2,6,2,3,2,2,3,7,FALSE,1,51,FALSE,0,53,TRUE,0,92,FALSE,1,55,FALSE,0,53,FALSE,1,59,TRUE,1,100,TRUE,1,100,FALSE,0,54,TRUE,1,90,TRUE,0,69,TRUE,0,100,TRUE,1,81,FALSE,1,54,TRUE,1,63,TRUE,1,97,TRUE,0,95,TRUE,0,99,TRUE,0,86,TRUE,0,91,TRUE,1,86,FALSE,0,54,FALSE,1,53,TRUE,1,100,FALSE,1,100,TRUE,1,78,TRUE,0,63,TRUE,0,94,TRUE,0,88,FALSE,0,60,TRUE,1,94,TRUE,1,66,0,0.0484,0.0009,0,0.1156,0.1681,0,0.01,0.8281,0.2916,0.36,0.0361,0.2916,0.4761,0.2809,0.2809,0.2209,0.2025,0.8836,0,0.0196,0.1369,0.7396,0.2116,0.9025,0.3969,0.0036,0.2401,0.8464,0.9801,0.7744,1,0.382060714,0.254457143,0.509664286,25,78.13,17,53.13,3,37.5,5,62.5,6,75,3,37.5,11,68.75,6,37.5,77.44,67.12,72.62,78.25,91.75,76.81,78.06,25,24.31,29.62,10.12,3.25,54.25,8.06,40.56,1,0,1,1,1,1,0,1,2,0,2,1,0,1,0,0,1,0,1,0,1,0,1,1,2,0,1,0,0,0,1,0,1,1,0,0,0,1,0,1,0.8,0.8,0.8,0.4,1,0.2,0.6,0.4,0.7,0.55,8.33,7.33,0,1,2,2,1,10 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),38,0,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,-1,1,-1,1,2,0,1,1,-1,0,0,0,1,-1,1,-1,-0.2,0.6,0.2,0,0.15,grad_prof +518,R_5nBn9uQByRCQc9N,46 - 52,Canadian,Female,3,3,-1,-1,2,-2,-1,2,-1,1,2,-1,3,1,3,1,1,2,1,0,3,3,2,-1,3,3,-3,-2,2,-2,2,2,2,-1,3,2,3,1,-1,-1,-1,-2,1,7,3,3,1,2,2,4,-3,-1,2,-2,-1,1,2,-1,3,1,3,1,2,2,2,2,1,3,FALSE,1,99,TRUE,1,65,FALSE,1,97,FALSE,1,80,TRUE,1,80,FALSE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,60,FALSE,0,90,FALSE,1,60,TRUE,0,60,TRUE,1,60,FALSE,1,98,FALSE,0,85,TRUE,1,98,FALSE,1,60,FALSE,1,75,FALSE,1,60,FALSE,1,58,TRUE,1,98,TRUE,1,85,FALSE,1,100,TRUE,1,85,TRUE,0,60,TRUE,1,75,FALSE,1,96,FALSE,1,85,TRUE,0,90,TRUE,1,76,TRUE,1,70,TRUE,1,90,0.01,0.0625,0.0004,0,0.01,0.0025,0.0225,0.81,0.1764,0.0225,0.0576,0.16,0.16,0.16,0.04,0.1225,0,0.04,0.0225,0.36,0.0004,0.7225,0.16,0.0004,0.16,0.0016,0.09,0.0001,0.0009,0.0625,0.81,0.36,0.161960714,0.127428571,0.196492857,21,65.63,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,80.62,72,84.12,85.25,81.12,81.69,79.56,-18.75,-3.76,-15.5,-3.38,10.25,-6.38,-5.81,-1.69,0,0,3,0,1,1,1,0,1,1,0,0,0,1,0,2,2,3,3,1,0,0,2,3,0,1,0,0,1,2,0,0,0,0,0,1,1,0,1,1,0.8,0.8,0.2,2.2,1,0.8,0,0.8,1,0.65,2,2,-1,1,0,4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,47,1.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,1,-3,1,0,1,0,0,-1,0,0,0,1,0,1,1,3,2,0,-0.2,0,0.2,1.4,0.35,C_Ug +519,R_7D6WMp7DnNOxRaD,46 - 52,American,Female,2,3,3,3,3,3,-3,3,-3,3,3,3,3,-3,3,3,1,2,3,2,3,3,3,3,3,5,3,-3,3,-3,3,5,3,3,3,-3,3,5,3,2,3,3,3,5,2,3,3,3,3,5,3,-3,3,-3,3,5,3,3,3,-3,3,5,3,2,3,2,2,5,TRUE,0,73,FALSE,0,80,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,100,TRUE,0,96,FALSE,0,82,TRUE,1,98,TRUE,0,89,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,94,TRUE,1,96,FALSE,0,100,0,0,0.0004,0,1,0,0.0025,1,1,0,0.0036,1,1,0,0,0.64,1,1,1,1,0,0.6724,1,0.9216,0.7921,1,0.0016,0.5329,1,1,1,0.0025,0.627471429,0.54615,0.708792857,10,31.25,13,40.63,2,25,3,37.5,3,37.5,5,62.5,10,62.5,3,18.75,96.81,94.75,98.62,96.12,97.75,96.56,97.06,-9.38,56.18,69.75,61.12,58.62,35.25,34.06,78.31,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0.2,0,0,0.6,0,0,0,0.6,0.2,0.15,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),51,0.5,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0.2,0,0,0,0.05,HS_TS +520,R_1oMu1lsMXM4KW0p,32 - 38,Canadian,Female,3,3,2,-1,-1,1,2,2,3,2,2,-1,2,1,2,1,1,1,1,-1,2,2,2,-2,-1,2,1,3,1,3,-1,4,1,1,-1,0,-1,5,1,1,1,0,1,2,3,3,3,-1,1,4,2,1,1,1,2,4,3,-1,2,2,2,3,2,2,2,3,2,6,FALSE,1,54,TRUE,1,71,FALSE,1,88,FALSE,1,65,TRUE,1,84,FALSE,1,76,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,67,TRUE,0,87,TRUE,1,79,TRUE,0,82,TRUE,1,70,TRUE,1,91,TRUE,0,70,TRUE,0,70,TRUE,0,92,FALSE,1,68,TRUE,1,74,TRUE,1,99,FALSE,1,100,TRUE,1,86,FALSE,1,100,TRUE,1,96,TRUE,0,86,FALSE,1,79,FALSE,1,100,TRUE,1,98,FALSE,0,67,TRUE,1,71,0,0.0016,0.0081,0,0.0841,0.0576,0.0196,0,0.1024,0.0001,0.0004,0.0441,0,0.1089,0.0256,0.0841,0,0.1225,0.0441,0,0.0676,0.09,0.8464,0.6724,0.49,0.7396,0.4489,0.2116,0.0144,0.49,0,0.7569,0.197189286,0.046385714,0.347992857,17,53.13,25,78.13,5,62.5,7,87.5,6,75,7,87.5,15,93.75,10,62.5,83.44,77.25,81.75,87.62,87.12,86.62,80.25,-25,5.31,14.75,-5.75,12.62,-0.38,-7.13,17.75,1,1,0,1,0,0,1,1,0,3,1,2,3,1,3,0,0,0,1,2,0,0,1,0,2,1,1,1,2,0,1,0,0,1,0,1,1,1,2,3,0.6,1,2,0.6,0.6,1,0.4,1.6,1.05,0.9,3.67,3.67,-2,0,2,-4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,34,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,1,1,-1,1,-2,-1,0,0,-2,3,0,2,3,0,3,-1,-1,-1,-1,-1,0,0,1.6,-1,0.15,C_Ug +521,R_5OuF4lYJjPeZ2yf,46 - 52,Canadian,Female,2,3,3,1,1,-3,-3,2,-2,-3,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,5,1,1,2,1,1,6,-2,-3,-2,-2,-2,6,2,2,2,2,2,5,1,1,1,1,1,5,-1,-1,-1,-1,-1,10,-1,-1,-1,-2,2,7,1,1,1,1,1,6,TRUE,0,78,TRUE,1,71,TRUE,0,82,TRUE,0,84,FALSE,0,80,TRUE,0,90,TRUE,1,78,TRUE,1,85,FALSE,0,82,TRUE,1,85,TRUE,0,76,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,74,TRUE,1,73,FALSE,1,98,TRUE,0,74,FALSE,1,86,FALSE,1,84,TRUE,1,100,FALSE,0,65,TRUE,0,100,TRUE,1,83,TRUE,0,100,TRUE,1,100,FALSE,1,78,TRUE,0,79,FALSE,1,86,TRUE,1,88,FALSE,0,78,TRUE,1,100,0.0225,0,0.0729,0.0484,0,0.81,0.0289,0.0225,0.0256,0.4225,0.0144,0,0.6724,0.5776,0.64,0.0841,1,0.7056,0.6241,1,0,0.5476,0.0196,1,0.0004,0.0484,0.6084,0.6084,0.6724,0.5476,0.0196,1,0.417860714,0.3574,0.478321429,19,59.38,16,50,3,37.5,5,62.5,3,37.5,5,62.5,11,68.75,5,31.25,85.53,78.62,94.25,85,84.25,83.88,87.19,9.38,35.53,41.12,31.75,47.5,21.75,15.13,55.94,1,2,2,0,0,4,4,0,3,4,4,5,4,4,4,0,0,0,0,0,1,2,2,0,0,2,2,3,1,2,3,3,3,4,0,1,1,1,1,1,1,3,4.2,0,1,2,2.6,1,2.05,1.65,5.67,7.33,0,-4,-1,-1,-1.66,10 cents,100 minutes,24 days,Female,University - Undergraduate,47,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,2,2,-3,2,2,1,2,1,0,4,-1,-1,-1,-1,-1,0,1,1.6,-1,0.4,C_Ug +522,R_3cx1Ajq8O3TIchj,39 - 45,American,Female,3,3,1,3,3,3,-2,3,-3,-1,3,-2,3,-2,3,1,-3,-2,-1,-3,3,3,1,3,2,1,3,-3,3,-2,0,7,3,1,1,1,3,4,2,-3,-1,1,-3,10,3,3,3,3,3,6,3,-1,3,-3,3,7,3,0,3,-3,3,4,3,3,3,3,-3,10,TRUE,0,57,FALSE,0,57,FALSE,1,100,FALSE,1,54,FALSE,0,59,FALSE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,80,TRUE,1,99,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,91,TRUE,1,85,TRUE,1,100,TRUE,0,100,TRUE,0,76,TRUE,0,100,FALSE,1,100,TRUE,1,88,TRUE,1,80,FALSE,1,69,FALSE,0,60,TRUE,0,100,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,0,55,TRUE,1,100,0.0009,0,0,0,0,0,0.36,0.0001,0,0.04,0,0,0.04,0.09,0.3481,0.3249,0.0961,0.2116,0,1,0.0144,0.0225,1,0.8281,1,0.1369,0.3025,0.3249,0,0.5776,0.3364,1,0.287646429,0.107914286,0.467378571,3,9.38,20,62.5,5,62.5,5,62.5,4,50,6,75,12,75,8,50,84.31,70.5,84.25,87.88,94.62,85,83.62,-53.12,21.81,8,21.75,37.88,19.62,10,33.62,0,0,0,0,1,0,1,0,1,1,0,3,2,3,0,1,0,1,2,0,0,0,2,0,0,0,1,0,0,4,0,2,0,1,0,2,6,5,4,0,0.2,0.6,1.6,0.8,0.4,1,0.6,3.4,0.8,1.35,4,5.67,-5,0,0,0,-1.67,20 cents,25 minutes,24 days,Female,High School (or equivalent),40,1,0,0,0,0,0,1,0,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,0,0,-2,0,1,0,0,0,1,-3,0,1,2,2,0,-1,-6,-4,-2,0,-0.2,-0.4,1,-2.6,-0.55,HS_TS +523,R_1pzBtlBUOMIdBlS,53 - 59,American,Female,3,3,3,0,2,2,3,3,1,2,2,2,3,1,3,1,2,1,3,-1,1,2,3,-1,3,7,3,-1,3,-2,2,9,2,1,1,3,0,10,2,1,1,2,2,8,2,1,1,2,2,9,2,2,0,2,2,8,1,2,2,3,1,9,2,3,2,3,2,8,FALSE,1,73,TRUE,1,89,FALSE,1,100,TRUE,0,70,TRUE,1,91,FALSE,1,72,TRUE,1,100,TRUE,1,91,TRUE,1,93,TRUE,1,100,FALSE,1,88,TRUE,0,100,TRUE,1,100,FALSE,1,99,TRUE,1,85,TRUE,1,88,TRUE,0,97,TRUE,0,100,FALSE,1,90,FALSE,1,71,TRUE,1,97,TRUE,1,80,FALSE,1,61,TRUE,1,96,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,57,TRUE,0,67,TRUE,1,98,TRUE,1,80,TRUE,1,100,0.0081,0.0009,0.0144,0,0,0.0784,0.0016,0,0.0841,0.04,0.0004,0,0.0049,0.0144,0.0081,0.0121,0.1521,0.49,0.1849,0,0.0009,0.0225,0.01,0.0001,0.9409,0,0.04,0.0729,0,1,0.4489,1,0.164542857,0.063292857,0.265792857,16,50,27,84.38,7,87.5,6,75,7,87.5,7,87.5,16,100,11,68.75,88.44,86.88,85.62,93.62,87.62,92.81,84.06,-34.38,4.06,-0.62,10.62,6.12,0.12,-7.19,15.31,2,1,0,1,1,1,4,0,3,0,0,1,2,2,3,1,1,0,1,3,1,2,2,2,0,0,1,3,1,0,1,0,1,2,2,1,1,1,0,3,1,1.6,1.6,1.2,1.4,1,1.2,1.2,1.35,1.2,8.67,8.67,-2,1,1,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,56,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,1,-1,-2,-1,1,1,3,-3,2,0,-1,1,1,0,1,0,0,-1,1,0,-0.4,0.6,0.4,0,0.15,C_Ug +524,R_5uxDugtohnaFA38,32 - 38,Canadian,Female,0,2,2,3,1,-1,1,2,3,0,1,0,1,0,1,-3,-2,-3,-3,-3,2,2,2,2,3,5,-1,1,0,2,1,7,1,1,1,1,1,3,1,0,1,1,0,9,2,2,2,2,2,6,-1,0,1,0,1,6,1,1,1,0,1,6,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,90,FALSE,1,50,FALSE,0,50,FALSE,1,95,TRUE,1,62,TRUE,1,67,TRUE,1,71,FALSE,0,50,FALSE,1,50,FALSE,1,52,TRUE,1,50,FALSE,1,71,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,72,FALSE,1,97,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,52,TRUE,1,77,FALSE,1,100,TRUE,1,88,TRUE,0,52,FALSE,1,54,TRUE,0,55,TRUE,1,75,FALSE,0,64,FALSE,0,53,0.1089,0.0144,0.25,0.1444,0.2809,0.0025,0.0529,0.25,0.25,0.25,0.0625,0.25,0.0841,0.25,0.25,0.25,0.2304,0.25,0.2116,0,0.25,0.25,0.0009,0.0841,0.25,0.2704,0.4096,0.25,0.81,0.5184,0.3025,0.2304,0.233971429,0.193807143,0.274135714,8,25,19,59.38,4,50,5,62.5,4,50,6,75,8,50,11,68.75,62.41,60.5,56.88,67.88,64.38,59.81,65,-34.38,3.03,10.5,-5.62,17.88,-10.62,9.81,-3.75,2,0,0,1,2,0,0,2,1,1,0,1,0,1,0,4,2,4,4,3,2,0,0,1,1,0,1,1,3,1,0,1,0,0,0,3,2,3,3,3,1,0.8,0.4,3.4,0.8,1.2,0.2,2.8,1.4,1.25,5,6,-1,1,-3,4,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,32,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,1,0,-1,1,-2,0,0,0,0,1,0,1,0,1,1,0,0.2,-0.4,0.2,0.6,0.15,C_Ug +525,R_3LigOeEx4VwTQXD,39 - 45,Canadian,Female,0,2,-2,2,3,2,0,2,0,-1,1,-2,0,1,1,1,0,1,1,0,0,2,-1,1,3,3,1,-1,2,-2,0,1,2,-2,1,0,2,2,-1,0,-1,-1,-1,2,0,3,-2,2,3,3,3,1,2,-2,0,2,1,-1,1,1,1,2,0,1,1,1,0,2,TRUE,0,70,FALSE,0,72,FALSE,1,96,TRUE,0,56,FALSE,0,55,FALSE,1,63,FALSE,0,65,TRUE,1,61,FALSE,0,55,TRUE,1,59,FALSE,1,54,TRUE,0,87,TRUE,1,86,FALSE,1,60,FALSE,0,61,TRUE,1,90,FALSE,1,60,TRUE,0,83,FALSE,1,54,FALSE,1,56,FALSE,0,58,FALSE,0,57,FALSE,1,60,FALSE,0,55,TRUE,0,75,TRUE,1,69,FALSE,1,57,FALSE,1,56,FALSE,1,57,TRUE,1,54,FALSE,0,51,FALSE,0,71,0.1521,0.0961,0.01,0.4225,0.5041,0.1369,0.3025,0.1681,0.1936,0.3249,0.2116,0.0196,0.3025,0.2116,0.3025,0.5184,0.16,0.3136,0.1936,0.5625,0.3364,0.3721,0.2116,0.16,0.16,0.1849,0.2601,0.49,0.0016,0.6889,0.1849,0.7569,0.29405,0.262135714,0.325964286,12,37.5,17,53.13,3,37.5,5,62.5,3,37.5,6,75,6,37.5,11,68.75,64.47,57.5,63.75,67.25,69.38,63.69,65.25,-15.63,11.34,20,1.25,29.75,-5.62,26.19,-3.5,0,0,1,1,0,1,1,0,2,1,1,0,1,1,1,2,0,2,2,1,0,1,0,0,0,1,1,0,2,1,0,1,1,0,0,1,1,0,0,0,0.4,1,0.8,1.4,0.2,1,0.4,0.4,0.9,0.5,2,2.33,0,-1,0,0,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,40,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,-1,1,1,0,0,0,0,0,0,1,-1,0,1,1,1,-1,2,2,1,0.2,0,0.4,1,0.4,C_Ug +526,R_6K8v1R7OK8j51Mo,53 - 59,Canadian,Female,-1,3,3,2,1,2,2,3,3,3,3,3,3,0,3,2,-1,1,1,3,-3,3,3,-2,3,1,3,3,3,3,3,1,3,3,3,1,3,1,1,-1,1,1,2,3,-3,3,3,3,2,0,1,2,3,1,2,0,3,3,3,-2,3,0,1,-2,1,1,2,7,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,73,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.0484,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.5329,0,0,0,0,1,1,1,1,0.235046429,0.074885714,0.395207143,27,84.38,25,78.13,8,100,6,75,6,75,5,62.5,16,100,9,56.25,98.47,100,100,96.62,97.25,100,96.94,6.25,20.34,0,25,21.62,34.75,0,40.69,2,0,0,4,2,1,1,0,0,0,0,0,0,1,0,1,0,0,0,1,2,0,0,1,1,1,0,0,2,1,0,0,0,2,0,1,1,0,0,1,1.6,0.4,0.2,0.4,0.8,0.8,0.4,0.6,0.65,0.65,1,0,1,1,1,-4,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,2,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,3,1,0,1,0,-2,-1,0,0,0,-1,0,0,-1,0,0,0,0.8,-0.4,-0.2,-0.2,0,HS_TS +527,R_3GOWhHu6d27W8q6,53 - 59,Canadian,Male,2,3,2,3,2,2,-2,2,-2,1,2,1,2,2,2,2,2,2,1,2,3,2,2,2,3,2,1,-2,1,-2,1,2,2,2,2,2,1,1,1,1,1,1,2,1,1,1,2,2,1,2,1,-3,1,-2,1,1,2,1,1,2,2,1,2,2,2,2,1,7,FALSE,1,84,TRUE,1,79,TRUE,0,76,FALSE,1,76,TRUE,1,76,FALSE,1,77,TRUE,1,87,TRUE,1,92,TRUE,1,82,FALSE,0,78,FALSE,1,85,TRUE,0,87,FALSE,0,82,TRUE,0,82,FALSE,0,81,TRUE,1,86,TRUE,0,84,TRUE,0,87,FALSE,1,88,FALSE,1,87,FALSE,0,87,FALSE,0,87,FALSE,1,83,TRUE,1,87,FALSE,1,82,TRUE,1,86,FALSE,1,88,TRUE,0,83,FALSE,1,83,TRUE,1,86,FALSE,0,87,FALSE,0,91,0.0064,0.0196,0.0196,0.0169,0.8281,0.0529,0.0169,0.6084,0.0169,0.7569,0.0196,0.6724,0.0324,0.0225,0.0576,0.0441,0.0289,0.0576,0.6889,0.0324,0.7569,0.6561,0.0144,0.6724,0.7056,0.0144,0.7569,0.0256,0.5776,0.7569,0.0289,0.7569,0.344967857,0.229657143,0.460278571,26,81.25,19,59.38,6,75,4,50,4,50,5,62.5,9,56.25,10,62.5,83.94,83.25,82.88,84.12,85.5,84.62,83.25,21.87,24.56,8.25,32.88,34.12,23,28.37,20.75,1,1,0,1,1,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,1,2,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0.8,0.4,0.4,0.6,1,0.6,0.2,0.4,0.55,0.55,1.67,1.33,0,1,0,-6,0.34,10 cents,100 minutes,24 days,Male,University - Undergraduate,58,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,-1,0,0,0,0,-1,0,0,0,0,1,-1,0,1,1,1,1,-1,-1,-0.2,-0.2,0.2,0.2,0,C_Ug +528,R_16gYUufnZvp69ln,39 - 45,Canadian,Female,1,2,1,0,-1,-2,-2,1,1,1,1,1,2,-1,0,-1,0,-1,-2,-2,2,2,1,-1,0,3,-1,-2,1,2,1,2,1,0,2,1,1,3,0,1,-1,1,-1,2,2,2,2,-1,0,1,-2,-2,2,1,1,1,1,2,2,-1,0,2,0,0,0,-1,-2,3,TRUE,0,80,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,70,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,50,TRUE,0,95,TRUE,1,65,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,65,TRUE,0,90,TRUE,0,70,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,75,TRUE,1,75,TRUE,0,70,TRUE,1,65,FALSE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,85,0,0.1225,0,0,0.0225,0,0.0625,0,0.25,0.25,0.01,0.1225,0.1225,0.25,0.09,0.1225,0.0625,0.25,0.5625,0.49,0.25,0.25,0.49,0.25,0.4225,0.25,0.25,0.64,0.25,0.81,0.25,0.9025,0.274375,0.115357143,0.433392857,18,56.25,22,68.75,5,62.5,6,75,5,62.5,6,75,13,81.25,9,56.25,70.31,56.25,70,75.62,79.38,73.75,66.88,-12.5,1.56,-6.25,-5,13.12,4.38,-7.5,10.63,1,0,0,1,1,1,0,0,1,0,0,1,0,2,1,1,1,0,3,1,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.8,1.2,0.8,0.2,0.2,0.6,0.75,0.45,2.67,1.33,2,1,1,-1,1.34,10 cents,25 minutes,24 days,Female,University - Undergraduate,42,0.875,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,-1,0,0,1,0,-1,1,0,0,0,0,2,1,0,1,-1,2,1,-0.2,0.2,0.6,0.6,0.3,C_Ug +529,R_7JFQ49rioJVFELu,46 - 52,Canadian,Female,1,0,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,6,0,1,-1,0,0,6,-1,1,0,1,0,6,0,1,0,-1,1,6,0,0,1,1,1,6,0,-1,1,0,1,6,0,1,1,0,-1,6,0,-1,1,1,2,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,62,TRUE,0,80,TRUE,1,88,FALSE,0,57,TRUE,1,91,0.25,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0.25,0.25,0.0144,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1444,0,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.25,0.25,0.25,0.64,0.25,0.23685,0.215892857,0.257807143,13,40.63,17,53.13,4,50,4,50,4,50,5,62.5,2,12.5,15,93.75,55.56,50.88,58.88,56.25,56.25,55.38,55.75,-12.5,2.43,0.88,8.88,6.25,-6.25,42.88,-38,1,0,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,0,1,0,1,0,0,0,1,1,2,1,0,1,0,1,0,0,2,0,2,1,1,1,0.4,0.4,1,0.2,0.4,1,0.6,1,0.5,0.75,6,6,0,0,0,0,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,47,0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,1,0,-1,0,-2,0,0,-1,1,0,1,1,-1,0,-2,-1,0,-1,0,-0.6,0.4,-0.8,-0.25,C_Ug +530,R_3DqhW2ozlQPLiUG,39 - 45,Canadian,Male,2,2,2,2,2,0,-2,2,0,0,1,2,1,0,1,0,-1,-2,0,0,1,1,1,1,1,5,2,1,1,1,1,6,-1,1,1,0,0,5,0,1,1,0,0,5,1,2,2,1,1,6,1,1,1,1,1,6,0,2,0,-1,-2,6,0,0,0,-1,0,6,FALSE,1,91,TRUE,1,65,TRUE,0,60,FALSE,1,62,TRUE,1,100,FALSE,1,73,FALSE,0,78,FALSE,0,81,TRUE,1,93,TRUE,1,83,FALSE,1,94,TRUE,0,85,TRUE,1,82,TRUE,0,62,TRUE,1,61,TRUE,1,100,TRUE,0,73,FALSE,1,62,FALSE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,1,76,TRUE,1,81,FALSE,1,77,FALSE,0,77,TRUE,0,79,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,1,85,TRUE,1,75,0.6561,0.5929,0,0.6084,0.0625,0.0729,0.0361,0.0289,0.04,0,0,0.0324,0.0049,0.0036,0,0.1225,0.0576,0.1444,0,0.0529,0,0.1521,0,0.3844,0.5329,0.6241,0.0225,0.0081,0.36,0.1444,0.9409,0.7225,0.162521429,0.043271429,0.281771429,16,50,23,71.88,7,87.5,6,75,5,62.5,5,62.5,13,81.25,10,62.5,82.25,79.88,84.5,78.75,85.88,85.06,79.44,-21.88,10.37,-7.62,9.5,16.25,23.38,3.81,16.94,1,1,1,1,1,2,3,1,1,1,2,1,0,0,1,0,2,3,0,0,1,0,0,1,1,1,3,1,1,1,1,0,1,1,3,0,1,2,1,0,1,1.6,0.8,1,0.6,1.4,1.2,0.8,1.1,1,5.33,6,-1,0,-1,-1,-0.67,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),42,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,1,1,0,0,1,0,0,0,0,1,1,-1,-1,-2,0,1,1,-1,0,0.4,0.2,-0.4,0.2,0.1,grad_prof +531,R_601MBPZ8B6KePPS,53 - 59,Canadian,Female,2,2,2,2,1,-2,-2,2,2,-1,2,1,2,-1,2,0,-1,1,-1,-1,2,2,2,2,1,2,-3,-2,1,1,-2,4,2,1,2,-1,1,5,-1,-2,0,-1,-1,7,2,2,2,2,1,3,-2,-2,2,1,-2,6,2,1,2,0,2,2,1,0,2,1,-1,5,FALSE,1,60,FALSE,0,50,TRUE,0,80,FALSE,1,50,FALSE,0,95,FALSE,1,50,TRUE,1,85,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,60,TRUE,0,100,TRUE,1,70,TRUE,0,85,TRUE,1,60,FALSE,0,65,FALSE,1,60,TRUE,0,100,TRUE,0,60,FALSE,1,70,TRUE,1,70,TRUE,1,55,FALSE,1,60,TRUE,1,70,TRUE,0,80,TRUE,1,60,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,60,TRUE,1,90,0,0.16,0.4225,0.0225,0.01,0.25,0.09,0,0.09,0.2025,0,0.09,0.16,0.36,0.9025,0.25,0.16,0.25,0.25,0.64,0.09,0.16,0.36,0.7225,0.16,0.25,0.16,0.16,0.64,1,0.25,1,0.309196429,0.201071429,0.417321429,23,71.88,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,13,81.25,9,56.25,70.47,56.25,68.12,78.12,79.38,74.38,66.56,3.13,1.72,-6.25,-19.38,15.62,16.88,-6.87,10.31,0,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,1,1,2,0,0,0.8,0.2,0.6,0,0.4,0.2,1,0.4,0.4,3.67,3.67,-1,-2,3,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,56,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,1,0,0,0,0,0,-1,1,0,0,0,-2,0,0,0.4,0,-0.4,0,C_Ug +532,R_3PCAiCZh86iZFZL,67 - 73,Canadian,Male,2,1,2,1,3,-1,1,2,-3,1,1,2,2,-1,1,1,-1,2,1,-2,1,2,1,0,3,3,-2,1,2,-3,2,6,1,2,3,-1,1,4,0,1,1,1,-1,4,0,1,2,3,-1,6,-1,2,0,1,-1,7,-1,1,1,-2,1,8,-1,-2,-1,2,-2,4,TRUE,0,76,TRUE,1,100,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,58,TRUE,1,100,FALSE,1,100,FALSE,1,91,FALSE,0,98,TRUE,0,97,FALSE,0,60,TRUE,1,100,FALSE,1,57,TRUE,0,74,TRUE,0,95,FALSE,1,50,FALSE,0,62,TRUE,1,95,FALSE,1,87,TRUE,1,75,FALSE,1,90,TRUE,1,74,TRUE,0,71,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,0,100,TRUE,1,92,0,0.0676,0,0,0.0064,0,0.0625,0,0.25,0.0025,1,0.9604,0.1764,0,0,0,0.0169,0.0576,1,0.01,0.3844,0.36,0.9025,0.9409,0.1849,0.5041,1,0.5776,1,0.5476,1,0.0081,0.391171429,0.180907143,0.601435714,22,68.75,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,86.81,82.5,87,88.25,89.5,88.38,85.25,9.37,27.43,32.5,24.5,25.75,27,19.63,35.25,1,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,2,1,0,1,2,0,0,2,4,0,1,2,4,2,2,1,1,1,0,2,1,3,1,0,0.8,0.4,0.2,1,1.6,1.8,1,1.4,0.6,1.45,4.33,7,-3,-1,-4,0,-2.67,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),69,0.875,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,1,1,-1,-4,1,-1,-2,-4,-1,-2,-1,0,-1,0,-1,1,-2,-1,1,-0.8,-1.4,-0.8,-0.4,-0.85,grad_prof +533,R_6khUynIGgapHzgG,46 - 52,American,Male,3,3,3,3,0,-1,-2,0,0,2,0,-3,2,-1,3,-1,-1,0,0,-2,3,3,3,3,2,2,-1,-2,0,-1,2,1,0,-3,2,-1,3,2,0,0,0,0,-2,2,3,3,3,3,2,1,0,-2,0,-1,2,4,0,-3,2,-1,3,1,0,0,0,0,-1,2,FALSE,1,100,FALSE,0,82,FALSE,1,68,FALSE,1,69,FALSE,0,72,FALSE,1,80,TRUE,1,84,TRUE,1,83,TRUE,1,77,TRUE,1,91,FALSE,1,78,TRUE,0,83,TRUE,1,77,TRUE,0,59,FALSE,0,62,TRUE,1,85,FALSE,1,56,TRUE,0,86,TRUE,0,62,FALSE,1,100,FALSE,0,78,TRUE,1,74,FALSE,1,100,TRUE,1,79,FALSE,1,50,TRUE,1,85,FALSE,1,52,FALSE,1,54,TRUE,0,70,TRUE,1,84,TRUE,1,61,TRUE,1,91,0.0289,0.0225,0.0225,0.0256,0.0081,0.04,0.0441,0.0081,0,0.0676,0.0256,0.0529,0.0529,0.0484,0.5184,0.6724,0,0.0961,0.2116,0.25,0.6084,0.3844,0.3844,0.3481,0.1936,0.2304,0.1521,0,0.1024,0.7396,0.49,0.6889,0.229232143,0.116757143,0.341707143,14,43.75,23,71.88,5,62.5,5,62.5,6,75,7,87.5,12,75,11,68.75,76,67.88,78,78.62,79.5,79.06,72.94,-28.13,4.12,5.38,15.5,3.62,-8,4.06,4.19,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0.4,0.2,0,0.4,0.4,0.4,0,0.6,0.25,0.35,1.67,2,1,-3,1,0,-0.33,15 cents,25 minutes,24 days,Male,High School (or equivalent),46,1.5,0,0,0,0,0,1,0,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-0.2,0,-0.2,-0.1,HS_TS +534,R_3wafSDodTn91koj,39 - 45,Canadian,Male,2,3,3,2,2,1,-1,1,-3,-2,3,1,2,1,1,2,1,2,1,-1,2,3,3,2,2,7,1,-2,1,-2,-3,7,3,1,2,0,1,3,0,1,0,0,0,7,2,3,3,2,2,3,1,-2,3,-3,-2,3,3,1,2,0,1,3,2,2,2,2,1,7,TRUE,0,85,FALSE,0,75,TRUE,0,91,FALSE,1,100,TRUE,1,79,FALSE,1,92,TRUE,1,88,FALSE,0,76,FALSE,0,92,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,84,FALSE,1,87,FALSE,0,66,TRUE,1,92,TRUE,0,71,FALSE,1,91,FALSE,1,94,FALSE,1,100,TRUE,1,83,TRUE,1,89,FALSE,1,74,TRUE,1,93,FALSE,1,92,FALSE,0,77,FALSE,1,91,FALSE,1,76,TRUE,0,85,TRUE,1,100,FALSE,0,77,TRUE,1,80,0.5776,0.5929,0.0064,0.0144,0.04,0.0064,0.0049,0,0,0.0121,0,0.0256,0.8464,0.0324,0.0441,0.5625,0.0676,0,0.0576,0.0064,0.0289,0.4356,0.0036,0.0169,0.5041,0.0081,0.5929,0.7225,0.8281,0.0081,0.7225,1,0.234903571,0.117285714,0.352521429,16,50,21,65.63,4,50,6,75,6,75,5,62.5,10,62.5,11,68.75,86.31,84.62,81,88.62,91,84.44,88.19,-15.63,20.68,34.62,6,13.62,28.5,21.94,19.44,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,2,0,2,1,1,0,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,1,0,1,2,0,0.6,0.2,1.2,0,0.6,0.2,0.8,0.5,0.4,5.67,3,4,4,0,0,2.67,5 cents,100 minutes,24 days,Male,University - Undergraduate,42,0.75,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,-2,1,1,0,0,0,0,0,2,-1,2,0,-1,0,0,0,0.4,0.1,C_Ug +535,R_5RsJ6LV9TQfp9At,60 - 66,American,Female,3,2,3,1,0,2,1,-1,-1,3,3,0,2,2,1,1,2,0,1,-2,1,3,3,-1,1,5,1,-1,2,0,2,5,2,-1,1,3,0,5,-1,0,-1,-2,-2,7,2,2,2,-2,1,7,1,-3,2,-3,-2,6,-2,-2,2,0,2,5,1,-1,0,-2,-2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,1,80,FALSE,1,87,TRUE,1,88,TRUE,1,91,TRUE,1,79,FALSE,0,86,FALSE,1,83,TRUE,0,69,TRUE,1,99,TRUE,0,100,TRUE,1,61,TRUE,1,95,FALSE,1,87,FALSE,1,96,TRUE,0,93,FALSE,1,70,TRUE,1,82,TRUE,1,95,FALSE,1,85,TRUE,1,92,TRUE,0,87,TRUE,1,97,TRUE,0,76,FALSE,1,82,TRUE,0,89,TRUE,1,92,FALSE,0,70,TRUE,1,100,0.0081,0.0009,0.0025,0.0144,0,0.0169,0.0064,0.7396,0.09,0.0025,0.0064,0.0001,0.0441,0.0289,0.04,0,0.0225,0.1444,0.0324,0.7569,0.0324,0.1521,0.8649,1,0.0169,0.5776,0.49,1,0,0.0016,0.7921,0.4761,0.261957143,0.081557143,0.442357143,24,75,23,71.88,5,62.5,7,87.5,4,50,7,87.5,14,87.5,9,56.25,86.66,78,88.62,93.62,86.38,87.94,85.38,3.12,14.78,15.5,1.12,43.62,-1.12,0.44,29.13,2,1,0,2,1,1,2,3,1,1,1,1,1,1,1,2,2,1,3,0,1,0,1,3,1,1,4,3,2,5,5,2,0,2,1,0,3,0,3,0,1.2,1.6,1,1.6,1.2,3,2,1.2,1.35,1.85,5,6,-2,-1,0,2,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,1,1,-1,-1,0,0,-2,0,-1,-4,-4,-1,1,-1,0,2,-1,1,0,0,0,-1.4,-1,0.4,-0.5,HS_TS +536,R_52aH641n3e20uMV,39 - 45,American,Female,3,2,1,1,2,-1,-3,2,-3,0,2,2,3,-1,1,2,2,2,2,1,3,3,2,-1,3,5,-1,-3,2,-2,-1,7,1,0,1,-1,0,5,1,0,1,0,1,5,3,3,2,0,3,5,0,-3,1,-2,0,6,1,0,2,-1,0,5,2,2,2,2,2,5,FALSE,1,81,TRUE,1,96,FALSE,1,63,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,91,TRUE,1,97,FALSE,0,54,FALSE,0,58,FALSE,1,73,TRUE,0,93,FALSE,0,89,TRUE,0,93,TRUE,1,87,TRUE,1,85,TRUE,0,94,TRUE,0,99,FALSE,1,50,FALSE,1,100,TRUE,1,92,TRUE,1,93,FALSE,1,92,FALSE,0,50,FALSE,1,94,TRUE,1,81,FALSE,1,63,FALSE,1,68,TRUE,0,89,TRUE,1,86,FALSE,0,50,TRUE,1,86,0.0009,0.0361,0.0225,0.0081,0.0196,0,0.25,0.3364,0,0.0049,0.0196,0.7921,0.2916,0.0729,0.25,0.0016,0.0064,0.25,0.1024,0.0036,0.0064,0.0169,0.25,0.8649,0.8836,0.1369,0.25,0.0361,0.1369,0.9801,0.7921,0.8649,0.272139286,0.163935714,0.380342857,17,53.13,21,65.63,6,75,4,50,5,62.5,6,75,10,62.5,11,68.75,79.59,65.38,86.5,86.25,80.25,77.81,81.38,-12.5,13.96,-9.62,36.5,23.75,5.25,15.31,12.63,0,1,1,2,1,0,0,0,1,1,1,2,2,0,1,1,2,1,2,0,0,1,1,1,1,1,0,1,1,0,1,2,1,0,1,0,0,0,0,1,1,0.4,1.2,1.2,0.8,0.6,1,0.2,0.95,0.65,5.67,5.33,0,1,0,0,0.34,10 cents,75 minutes,47 days,Female,College Diploma/Certificate,42,0.375,0,0,1,1,0,0,0.33,0.33,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,1,0,-1,0,-1,0,1,0,0,1,0,0,1,2,1,2,-1,0.2,-0.2,0.2,1,0.3,C_Ug +537,R_6A8dwSRHTK7fgo9,46 - 52,American,Female,3,3,3,3,1,0,-1,3,0,1,1,1,3,-1,3,-1,-3,-2,1,-1,3,3,3,3,0,10,0,-1,3,0,0,10,3,3,3,-3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,0,-1,3,-1,1,10,3,3,3,-1,3,10,3,3,3,3,3,10,TRUE,0,81,TRUE,1,70,TRUE,0,100,TRUE,0,77,TRUE,1,66,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,66,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,95,TRUE,1,90,TRUE,0,85,TRUE,0,100,TRUE,0,99,TRUE,0,75,TRUE,1,96,TRUE,1,99,TRUE,0,72,TRUE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,66,FALSE,1,63,TRUE,0,67,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0,0.01,0,0,1,0.0576,0,0.5625,0.0001,0,0,0.1156,0.8464,0.1156,0.09,0.5184,0.5929,0.1369,1,0.0016,0.0025,0.9801,1,0.7225,0.4356,0.3364,0.6561,1,1,0.4489,1,0.450703571,0.278507143,0.6229,28,87.5,16,50,3,37.5,4,50,4,50,5,62.5,15,93.75,1,6.25,87.28,77.88,85.75,97.5,88,88.5,86.06,37.5,37.28,40.38,35.75,47.5,25.5,-5.25,79.81,0,0,0,0,1,0,0,0,0,1,2,2,0,2,0,4,6,5,2,4,0,0,0,0,2,0,0,0,1,0,2,2,0,0,0,4,6,5,2,4,0.2,0.2,1.2,4.2,0.4,0.2,0.8,4.2,1.45,1.4,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),47,0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,0,-1,1,0,0,0,2,0,0,0,0,0,0,-0.2,0,0.4,0,0.05,HS_TS +538,R_3wme3XCgzo0jj81,53 - 59,Canadian,Female,3,3,0,0,3,2,-2,3,-2,2,1,1,2,-2,3,0,0,1,2,-1,3,3,1,-2,3,3,2,-3,3,0,2,2,2,1,1,0,3,3,-2,-2,-1,1,-2,8,3,3,1,1,3,2,1,-2,2,0,1,2,1,0,3,-2,3,1,0,0,0,1,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,84,FALSE,1,100,TRUE,0,83,FALSE,1,50,FALSE,0,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,71,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0.81,0.0064,0,0,0.25,0,0,0.7396,0.25,0.6889,1,0.7056,0,0.0841,0,0,0,1,1,0.251235714,0.111885714,0.390585714,26,81.25,25,78.13,6,75,5,62.5,7,87.5,7,87.5,15,93.75,10,62.5,90.81,74.25,95.25,100,93.75,90.56,91.06,3.12,12.68,-0.75,32.75,12.5,6.25,-3.19,28.56,0,0,1,2,0,0,1,0,2,0,1,0,1,2,0,2,2,2,1,1,0,0,1,1,0,1,0,1,2,1,0,1,1,0,0,0,0,1,1,0,0.6,0.6,0.8,1.6,0.4,1,0.4,0.4,0.9,0.55,2.67,1.67,1,0,2,3,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,58,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,1,0,-1,1,-1,0,-1,1,-1,0,2,0,2,2,1,0,1,0.2,-0.4,0.4,1.2,0.35,C_Ug +539,R_1lLGG34Y7Qr2q1x,53 - 59,Canadian,Female,3,3,3,2,1,3,-2,3,-2,-1,-1,1,3,-3,1,-1,0,1,0,1,3,3,2,2,2,2,3,1,3,1,2,4,-2,1,3,-3,1,3,-2,3,3,-3,0,10,3,3,3,3,2,0,3,-2,3,-2,0,0,-1,1,3,-3,1,8,2,0,2,2,-1,10,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,78,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,52,TRUE,0,86,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0.25,0.25,0,0,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.7396,1,0.0484,0.25,0.25,0.25,0.25,0.2304,0.25,1,1,1,0.25,1,0.384585714,0.232142857,0.537028571,10,31.25,18,56.25,4,50,6,75,4,50,4,50,8,50,10,62.5,73.94,50.25,66,87.5,92,76.75,71.12,-25,17.69,0.25,-9,37.5,42,26.75,8.62,0,0,1,0,1,0,3,0,3,3,1,0,0,0,0,1,3,2,3,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,3,0,1,2,2,0.4,1.8,0.2,2,0.4,0.2,0,1.6,1.1,0.55,3,2.67,2,4,-5,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,0,1,-1,0,0,3,0,3,2,1,0,0,0,0,-2,3,1,1,-1,0,1.6,0.2,0.4,0.55,HS_TS +540,R_7bejcOOpN7kMZ8d,46 - 52,American,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,10,2,2,2,2,2,9,2,2,2,2,2,7,0,0,0,0,0,8,0,0,0,0,0,7,3,3,3,3,3,10,FALSE,1,58,TRUE,1,55,TRUE,0,100,TRUE,0,89,FALSE,0,53,TRUE,0,57,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,53,FALSE,1,52,TRUE,0,100,TRUE,1,100,FALSE,1,52,TRUE,1,51,FALSE,0,50,FALSE,1,52,TRUE,0,100,TRUE,0,52,TRUE,0,52,TRUE,1,53,FALSE,0,52,FALSE,1,51,TRUE,1,51,TRUE,0,52,TRUE,1,52,FALSE,1,52,FALSE,1,55,TRUE,0,53,TRUE,1,54,FALSE,0,52,TRUE,1,51,0,0.2304,0.25,0,0.2401,0.3249,0.2401,0.2209,0.2704,0.2704,0.2116,0,0.2304,0.2304,0.2809,0.2025,0.2401,0.7921,0.2025,0.2704,0.2209,0.2401,0.2704,0.2304,0.2304,0.2304,0.2704,0.1764,1,1,0.2809,1,0.334928571,0.2682,0.401657143,25,78.13,19,59.38,5,62.5,5,62.5,5,62.5,4,50,12,75,7,43.75,62.69,56.88,58.75,64.88,70.25,61.19,64.19,18.75,3.31,-5.62,-3.75,2.38,20.25,-13.81,20.44,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,2,2,2,2,2,0,0,3,2,1.25,9,7.33,1,1,3,-1,1.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,49,0,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,0,2,2,-1,0.75,C_Ug +541,R_5uZJkBhivI2UNcp,46 - 52,Canadian,Male,3,3,1,-2,2,-2,-3,2,-1,2,2,0,1,-1,2,0,1,2,1,2,3,3,1,-2,2,4,-3,-3,2,-2,2,4,2,1,1,-2,1,4,-1,1,1,1,2,8,3,3,-2,0,2,7,-2,-1,2,0,1,7,2,0,0,-2,2,7,2,2,2,2,2,6,FALSE,1,100,TRUE,1,59,TRUE,0,66,TRUE,0,56,TRUE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,77,TRUE,0,55,FALSE,1,58,TRUE,1,75,FALSE,1,100,TRUE,1,69,TRUE,1,100,TRUE,0,57,FALSE,1,100,FALSE,1,57,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,0,90,TRUE,1,80,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0.64,0,0.0529,0,0,0.04,0.0625,0,0.3025,0,0.1681,0,0.3136,0.5625,0,1,0.0961,0.1849,0,0.3249,1,0.09,0,0.4356,0,0.81,0.1764,0.223571429,0.112828571,0.334314286,26,81.25,23,71.88,5,62.5,4,50,8,100,6,75,15,93.75,8,50,85.12,70.75,87.75,97.12,84.88,89.38,80.88,9.37,13.24,8.25,37.75,-2.88,9.88,-4.37,30.88,0,0,0,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,3,2,0,0,2,0,1,1,0,0,1,1,0,2,1,0,1,0,0,0.4,0.6,0.4,1,0.8,0.4,0.8,0.35,0.75,4,7,-3,-3,-3,2,-3,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),48,0.875,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,-3,-2,0,1,-2,0,0,-1,0,1,-1,0,1,-1,-1,1,-1,0,-1,-0.4,0.2,-0.4,-0.4,grad_prof +542,R_7JJSpreMxXWxp8d,60 - 66,American,Female,1,1,1,0,1,1,-3,3,1,1,3,3,2,0,3,-2,-2,-2,0,-1,0,3,0,-1,3,5,1,-3,3,-2,2,1,3,3,3,0,3,3,0,2,2,0,-2,10,2,2,2,1,0,5,2,-3,3,0,2,7,3,3,3,0,3,6,0,0,0,0,0,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,50,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,89,FALSE,1,100,FALSE,1,86,TRUE,1,100,TRUE,1,60,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0.25,0,0.25,0.25,0,0.25,0,0.25,0.25,0,0.5625,0.25,0.25,0.5625,0.36,0.25,0.7921,0.16,1,0,0,0.0196,1,0.248453571,0.125,0.371907143,24,75,19,59.38,4,50,5,62.5,4,50,6,75,10,62.5,9,56.25,79.53,71.75,67,85.62,93.75,78.75,80.31,15.62,20.15,21.75,4.5,35.62,18.75,16.25,24.06,1,2,1,1,2,0,0,0,3,1,0,0,1,0,0,2,4,4,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,0,0,2,2,2,0,1,1.4,0.8,0.2,2.2,1,0.6,0.2,1.4,1.15,0.8,3,6,0,-6,-3,5,-3,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,1,0,0,1,-1,0,0,2,0,0,0,0,0,0,0,2,2,0,0,0.4,0.2,0,0.8,0.35,HS_TS +543,R_1TcIkOx0f3EjeRX,46 - 52,Canadian,Male,1,2,2,-2,2,0,0,2,0,2,0,0,0,0,0,-2,-1,-2,-3,0,3,3,3,0,3,1,1,1,1,0,1,2,-3,-3,-3,-3,-3,9,-3,-3,-3,-3,-3,2,3,3,1,3,3,3,0,0,3,0,3,2,0,0,0,0,0,2,1,-1,1,-2,-3,1,TRUE,0,93,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,58,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,57,FALSE,0,50,TRUE,1,57,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,66,TRUE,0,71,FALSE,0,60,FALSE,0,57,TRUE,1,100,0,0,0.1849,0,0,0,0,0,0,0.0025,0.36,1,0.25,0,0.1764,0.25,0,0.25,0.4356,0,0,0.25,0,0.3249,0,0.25,0.3249,0.8649,1,0,0.5041,1,0.258689286,0.163492857,0.353885714,25,78.13,22,68.75,6,75,6,75,6,75,4,50,12,75,10,62.5,83.25,63.38,91.12,93.12,85.38,79.81,86.69,9.38,14.5,-11.62,16.12,18.12,35.38,4.81,24.19,2,1,1,2,1,1,1,1,0,1,3,3,3,3,3,1,2,1,0,3,2,1,1,5,1,0,0,1,0,1,0,0,0,0,0,3,0,3,1,3,1.4,0.8,3,1.4,2,0.4,0,2,1.65,1.1,4,2.33,-2,0,7,1,1.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,46,1.375,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-3,0,1,1,0,0,0,3,3,3,3,3,-2,2,-2,-1,0,-0.6,0.4,3,-0.6,0.55,C_Ug +544,R_1NWsBClOlYG35WF,39 - 45,Canadian,Male,3,3,2,-1,2,0,2,3,0,2,0,0,1,3,1,1,0,1,0,0,0,1,1,1,0,8,1,0,0,0,1,8,1,0,0,-1,1,7,-1,1,0,2,2,5,1,3,2,2,3,7,3,2,1,3,2,8,0,-1,3,3,0,8,-1,0,3,3,3,8,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,64,FALSE,0,94,TRUE,0,97,TRUE,1,85,TRUE,1,50,TRUE,1,55,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,0,66,FALSE,1,100,TRUE,0,97,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0,0,0.0225,0,0.9409,0,0,1,0,0,0,0.2025,0.0036,0.8836,0,0,0.1296,0.25,1,0.25,0,0.9409,0.0025,0.4356,0.25,0.25,1,0.25,0,1,1,0.349614286,0.225728571,0.4735,22,68.75,20,62.5,6,75,3,37.5,6,75,5,62.5,13,81.25,7,43.75,85.84,76.25,88.38,97.5,81.25,86.5,85.19,6.25,23.34,1.25,50.88,22.5,18.75,5.25,41.44,3,2,1,2,2,1,2,3,0,1,1,0,1,4,0,2,1,1,2,2,2,0,0,3,1,3,0,2,3,0,0,1,2,0,1,2,0,2,3,3,2,1.4,1.2,1.6,1.2,1.6,0.8,2,1.55,1.4,7.67,7.67,1,0,-1,-3,0,10 cents,100 minutes,36 days,Male,University - Graduate (Masters),43,1,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,2,1,-1,1,-2,2,1,-3,1,1,-1,-1,4,-1,0,1,-1,-1,-1,0.8,-0.2,0.4,-0.4,0.15,grad_prof +545,R_5TmIC9FlspsxFG1,46 - 52,American,Female,1,3,3,0,3,2,-1,2,-2,0,-1,2,2,0,2,-3,0,-1,0,1,2,2,2,0,3,6,2,-1,2,-2,2,4,-1,2,2,0,2,6,-2,1,2,-1,2,5,3,2,2,0,2,4,2,-2,2,-2,2,6,0,2,2,2,2,2,-2,-2,0,-1,2,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,95,TRUE,1,96,TRUE,1,95,TRUE,1,95,TRUE,1,91,FALSE,1,100,TRUE,0,100,FALSE,0,92,TRUE,0,100,TRUE,1,97,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,95,FALSE,1,100,TRUE,1,92,TRUE,0,50,TRUE,1,92,FALSE,1,95,FALSE,1,91,FALSE,1,91,FALSE,0,90,TRUE,1,100,TRUE,1,95,0.0025,0.0064,0,0.0016,0.0025,0.0025,0.0064,0.0081,0,0.0025,0.81,0.8464,0.0025,0,0,0,0,0.01,0.0081,0.25,0.0016,0.0009,0,1,1,0.0025,0,0,0,0,0.0081,1,0.177217857,0.120778571,0.233657143,25,78.13,26,81.25,8,100,6,75,6,75,6,75,14,87.5,12,75,94.94,97.12,96.12,90.5,96,95.38,94.5,-3.12,13.69,-2.88,21.12,15.5,21,7.88,19.5,1,1,1,0,0,0,0,0,0,2,0,0,0,0,0,1,1,3,1,1,2,1,1,0,1,0,1,0,0,2,1,0,0,2,0,1,2,1,1,1,0.6,0.4,0,1.4,1,0.6,0.6,1.2,0.6,0.85,5.33,4,2,-2,4,3,1.33,10 cents,25 minutes,24 days,Female,University - Undergraduate,52,-0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,0,0,0,-1,0,-1,0,0,0,-1,0,0,-2,0,0,-1,2,0,0,-0.4,-0.2,-0.6,0.2,-0.25,C_Ug +546,R_5C7I2Ai9dXQSlDi,25 - 31,Canadian,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,99,TRUE,1,100,TRUE,1,100,TRUE,1,99,0,0,0,0.0001,0.0001,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,0.9801,1,0.9801,1,0.570010714,0.35715,0.782871429,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,99.88,100,99.75,99.88,99.88,99.88,99.88,50,49.88,50,49.75,49.88,49.88,-0.12,99.88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,29,0,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +547,R_7dzuwtiPAfCbbt7,60 - 66,American,Female,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,2,2,1,1,1,1,1,1,8,1,1,1,1,1,8,0,0,0,0,0,8,1,1,1,1,1,9,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,91,TRUE,1,100,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,89,TRUE,0,100,TRUE,0,96,TRUE,0,92,FALSE,0,94,TRUE,1,98,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,96,0,0,0,0,0.0016,0.0049,0,0,0.8464,0.0004,0,0,0.0064,1,0,0,0.9604,0.8281,0,0,0.8836,0,0.9216,1,0.0121,0.8281,0.0025,0.9216,1,1,0,1,0.400632143,0.260585714,0.540678571,25,78.13,20,62.5,4,50,6,75,5,62.5,5,62.5,15,93.75,5,31.25,97.53,95.62,96.25,99.25,99,98.44,96.62,15.63,35.03,45.62,21.25,36.75,36.5,4.69,65.37,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0.2,0,0,0.4,0.2,0,1,0.4,0.15,0.4,8,8,0,0,0,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),63,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-1,0,-0.25,HS_TS +548,R_5KGw8CVCkXeVwY0,60 - 66,American,Female,2,1,2,2,2,1,-2,3,-2,-2,2,0,1,-2,2,0,1,1,1,-2,2,2,2,1,2,6,2,-2,2,1,-2,4,2,0,2,-2,2,4,0,0,0,0,-2,5,2,1,2,2,2,2,1,0,1,0,-3,2,1,1,1,-2,2,3,-1,-1,0,-1,-2,3,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,55,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,98,FALSE,1,80,TRUE,0,100,FALSE,0,100,TRUE,0,98,TRUE,1,95,TRUE,1,100,FALSE,1,85,FALSE,1,100,TRUE,0,90,FALSE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,90,TRUE,1,90,TRUE,0,85,TRUE,1,85,FALSE,1,65,FALSE,1,90,TRUE,0,90,TRUE,1,100,FALSE,0,70,TRUE,1,100,0,0.0225,0,0,0,0,0.01,0.0004,0,0.01,0,1,0.0001,0.04,1,0,0.01,0.2025,0.01,0.7225,0.01,0.0025,0.81,0.9604,0.0225,0.1225,0.49,0,1,0,0.81,1,0.29405,0.162357143,0.425742857,25,78.13,23,71.88,6,75,5,62.5,6,75,6,75,13,81.25,10,62.5,92.03,81.75,94.38,94.5,97.5,94.81,89.25,6.25,20.15,6.75,31.88,19.5,22.5,13.56,26.75,0,1,0,1,0,1,0,1,3,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,2,2,2,1,1,1,0,0,0,1,2,1,2,0,0.4,1,0.2,0.6,0,1.4,0.4,1.2,0.55,0.75,4.67,2.33,4,2,1,2,2.34,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),65,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,1,0,1,0,1,-2,-1,1,-1,-1,-1,1,0,0,-1,-1,0,-1,0,0.4,-0.4,-0.2,-0.6,-0.2,grad_prof +549,R_5qZ4y6NaJUrH4kh,53 - 59,American,Male,3,3,3,3,3,-3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,-3,-3,3,-3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,-3,-3,3,-3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,0.535714286,0.357142857,0.714285714,16,50,17,53.13,3,37.5,4,50,4,50,6,75,12,75,5,31.25,100,100,100,100,100,100,100,-3.13,46.87,62.5,50,50,25,25,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),58,-0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +550,R_7KkIoV41qxnDucT,46 - 52,American,Male,2,1,-1,2,-1,-2,0,1,1,-1,2,1,2,1,1,-1,-1,-1,1,-2,2,2,2,2,-2,3,-2,0,2,2,1,3,2,1,2,1,1,1,-1,-2,-1,-2,-2,1,2,2,1,2,0,2,-2,0,2,-1,-2,3,2,1,1,-1,1,2,-1,-1,0,-2,-2,2,TRUE,0,97,TRUE,1,92,TRUE,0,91,TRUE,0,50,TRUE,1,60,FALSE,1,98,TRUE,1,93,TRUE,1,92,TRUE,1,50,TRUE,1,60,FALSE,1,72,TRUE,0,100,FALSE,0,77,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,0,67,TRUE,0,92,TRUE,0,72,FALSE,1,100,TRUE,1,76,TRUE,1,96,TRUE,0,70,TRUE,1,90,TRUE,0,80,TRUE,1,70,TRUE,0,50,FALSE,1,96,TRUE,0,60,TRUE,1,91,TRUE,1,94,TRUE,1,52,0.0064,0.09,0,0.0049,0.2304,0.0004,0.01,0.16,0,0.0016,0.0081,0.5929,0.25,0.0784,0.16,0.0064,0.49,0.25,0.0016,0.64,0.0576,0.0324,0.5184,0,0.4489,0.25,0.0036,0.9409,0.8281,0.8464,0.36,1,0.291646429,0.159871429,0.423421429,19,59.38,20,62.5,5,62.5,4,50,5,62.5,6,75,15,93.75,5,31.25,80.31,70.25,70,86,95,79.69,80.94,-3.12,17.81,7.75,20,23.5,20,-14.06,49.69,0,1,3,0,1,0,0,1,1,2,0,0,0,0,0,0,1,0,3,0,0,1,2,0,1,0,0,1,2,1,0,0,1,2,0,0,0,1,3,0,1,0.8,0,0.8,0.8,0.8,0.6,0.8,0.65,0.75,2.33,2.33,1,0,-1,-1,0,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,52,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,1,0,0,0,0,0,-1,1,0,0,-1,-2,0,0,1,-1,0,0,0.2,0,-0.6,0,-0.1,C_Ug +551,R_7HfprOKQHqsNliF,60 - 66,American,Male,3,3,1,2,3,-1,0,2,-1,1,-1,-2,3,-1,2,-2,-2,-2,1,-2,2,2,2,2,2,3,-1,-2,1,-1,1,0,1,-2,2,-1,2,0,-2,-1,-1,-1,-1,4,3,3,0,2,1,0,-1,0,1,0,1,1,-2,-2,2,-3,3,1,-2,-2,-1,-1,-2,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2304,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0.079657143,0.016457143,0.142857143,31,96.88,30,93.75,7,87.5,8,100,7,87.5,8,100,15,93.75,15,93.75,98.5,94,100,100,100,100,97,3.13,4.75,6.5,0,12.5,0,6.25,3.25,1,1,1,0,1,0,2,1,0,0,2,0,1,0,0,0,1,1,2,1,0,0,1,0,2,0,0,1,1,0,1,0,1,2,1,0,0,1,2,0,0.8,0.6,0.6,1,0.6,0.4,1,0.6,0.75,0.65,1,0.67,3,-1,-1,3,0.33,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,66,1.5,1,1,0,0,0,1,0.67,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,1,1,0,0,-1,0,2,0,-1,0,1,0,0,-2,-1,0,1,0,0,1,0.2,0.2,-0.4,0.4,0.1,C_Ug +552,R_12AnLzAROw0zlWt,25 - 31,Canadian,Female,2,2,2,2,0,1,-2,2,0,2,0,1,2,-2,2,2,2,2,2,3,2,2,2,2,0,5,-1,1,-1,1,2,8,-1,1,2,0,1,5,2,2,2,2,2,5,2,2,1,2,0,5,1,-2,2,0,2,5,0,1,2,0,2,5,2,2,2,2,2,5,TRUE,0,50,FALSE,0,50,TRUE,0,80,TRUE,0,50,FALSE,0,50,FALSE,1,85,TRUE,1,87,TRUE,1,100,FALSE,0,50,TRUE,1,91,FALSE,1,50,TRUE,0,100,TRUE,1,74,FALSE,1,88,TRUE,1,77,TRUE,1,73,TRUE,0,71,TRUE,0,91,FALSE,1,50,TRUE,0,59,TRUE,1,78,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,87,TRUE,1,100,FALSE,1,50,FALSE,1,88,FALSE,1,50,TRUE,1,88,TRUE,1,50,TRUE,1,98,0,0,0.0729,0.0169,0.0004,0.0225,0.25,0.0081,0.3481,0.25,0.0144,0.0676,0.25,0.25,0.25,0.25,0.25,0.25,0.0144,0.7569,0.0484,0.0529,0.25,0.0144,0.5041,0.25,0.25,0.25,0.64,0.8281,0.25,1,0.270367857,0.175792857,0.364942857,16,50,18,56.25,5,62.5,5,62.5,4,50,4,50,11,68.75,7,43.75,70.78,53.38,69.5,80.5,79.75,72.88,68.69,-6.25,14.53,-9.12,7,30.5,29.75,4.13,24.94,0,0,0,0,0,2,3,3,1,0,1,0,0,2,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,1.8,0.8,0.2,0.2,0,0.4,0.2,0.7,0.2,6,5,0,3,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),30,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,0,2,3,3,1,0,1,0,0,0,1,0,0,0,0,0,-0.2,1.8,0.4,0,0.5,HS_TS +553,R_55HIwZfhomcRWEx,53 - 59,Canadian,Female,3,-2,3,0,3,-2,-1,0,-1,0,2,2,0,-1,1,1,1,2,1,2,3,-2,3,0,3,8,-1,-1,0,-1,-1,3,3,1,0,-1,1,3,0,1,-1,-1,0,7,3,-2,3,0,3,4,-1,-1,0,-1,-1,4,3,2,1,-2,2,3,1,1,1,1,1,3,TRUE,0,100,FALSE,0,79,TRUE,0,95,FALSE,1,58,TRUE,1,92,FALSE,1,100,FALSE,0,50,TRUE,1,99,TRUE,1,96,TRUE,1,68,FALSE,1,58,TRUE,0,78,TRUE,1,95,TRUE,0,59,FALSE,0,57,TRUE,1,88,TRUE,0,87,FALSE,1,54,FALSE,1,96,FALSE,1,57,FALSE,0,87,TRUE,1,92,TRUE,0,82,TRUE,1,100,TRUE,0,97,FALSE,0,92,TRUE,0,90,FALSE,1,97,TRUE,0,96,TRUE,1,94,FALSE,0,54,TRUE,1,53,0.0001,0.8464,0.0144,0.25,0.2209,0,0,0.1024,0.1849,0.0064,0.0036,0.0025,0.0016,0.1764,0.0064,0.6241,0.6724,0.1764,0.0009,0.9409,0.7569,0.3249,0.0016,0.3481,0.7569,0.81,0.2916,1,0.9025,0.2116,0.9216,0.6084,0.359067857,0.155571429,0.562564286,26,81.25,17,53.13,4,50,4,50,3,37.5,6,75,10,62.5,7,43.75,81.25,73.5,86.5,76.5,88.5,81,81.5,28.12,28.12,23.5,36.5,39,13.5,18.5,37.75,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,3,2,2,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,0.4,0.4,1.6,0,0.4,0.8,0.4,0.6,0.4,4.67,3.67,4,-1,0,4,1,10 cents,25 minutes,24 days,Female,University - Undergraduate,57,0.375,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,1,-1,-1,-1,1,0,2,2,1,0,0,-0.4,1.2,0.2,C_Ug +554,R_6HYbTSeN4jWBDWB,46 - 52,Canadian,Male,1,3,3,2,1,1,-3,-1,-2,-1,0,3,2,0,0,0,-1,-1,0,2,2,3,3,1,1,2,3,-3,-1,-2,0,2,0,3,3,1,1,2,0,0,1,0,2,2,2,3,3,3,1,1,2,-3,0,-2,-2,2,0,3,2,0,1,2,0,-1,-1,0,2,2,TRUE,0,86,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,64,TRUE,1,99,TRUE,1,75,FALSE,0,50,TRUE,1,77,TRUE,0,69,TRUE,0,78,TRUE,1,70,TRUE,0,71,FALSE,0,62,TRUE,1,100,FALSE,1,57,FALSE,1,93,FALSE,1,59,FALSE,1,100,FALSE,0,57,TRUE,1,86,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,73,FALSE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,88,0.0625,0,0,0.0001,0.0144,0.1296,0.25,0.0529,0,0.0196,0.01,0.09,0.25,0.4761,0.25,0.25,0,0.25,0.0729,0,0.3249,0.3844,0.1681,0.5041,0.1849,0.25,0.25,0.7396,1,0.0049,0.25,0.6084,0.242314286,0.1459,0.338728571,25,78.13,20,62.5,3,37.5,6,75,6,75,5,62.5,9,56.25,11,68.75,73.56,55,67,89,83.25,72.12,75,15.63,11.06,17.5,-8,14,20.75,15.87,6.25,1,0,0,1,0,2,0,0,0,1,0,0,1,1,1,0,1,2,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0.4,0.6,0.6,0.6,0.4,0.6,0.2,0,0.55,0.3,2,1.67,1,0,0,0,0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),51,-1.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,-1,0,0,0,0,1,1,0,0,1,2,0,0,0,0,0.4,0.6,0.25,HS_TS +555,R_7rPxckCG4wznxO3,53 - 59,American,Male,0,-1,-1,0,3,3,1,-1,-3,-2,-2,-1,0,1,1,-1,1,0,2,0,-2,-1,-1,-3,3,5,3,-2,0,-3,1,4,-2,1,0,-1,0,6,-1,-2,1,1,0,4,-2,0,1,1,-1,4,0,-1,2,1,0,5,-1,0,-1,1,-2,4,-1,0,-1,2,-1,10,FALSE,1,100,TRUE,1,99,TRUE,0,97,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,FALSE,1,100,FALSE,1,93,TRUE,1,83,FALSE,1,91,TRUE,1,93,TRUE,1,100,FALSE,1,99,FALSE,1,86,FALSE,1,99,FALSE,1,100,TRUE,1,64,TRUE,1,99,FALSE,1,100,TRUE,1,94,FALSE,1,100,TRUE,1,91,FALSE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,74,0,0.0081,0,0,0.0676,0,0.0036,0,0,0.0001,0,0.0289,0.0036,0,0,0.0001,0,0.25,0.25,0,0.1296,0.0049,0.0001,0.0081,0.0001,0,0,0,0.9409,0.0196,1,0.0049,0.096860714,0.025278571,0.168442857,31,96.88,30,93.75,8,100,7,87.5,8,100,7,87.5,16,100,14,87.5,92.38,91.88,90,95.88,91.75,93.19,91.56,3.13,-1.37,-8.12,2.5,-4.12,4.25,-6.81,4.06,2,0,0,3,0,0,3,1,0,3,0,2,0,2,1,0,3,1,1,0,2,1,2,1,4,3,2,3,4,2,1,1,1,0,3,0,1,1,0,1,1,1.4,1,1,2,2.8,1.2,0.6,1.1,1.65,5,4.33,1,-1,2,-6,0.67,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),57,1.375,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,-1,-2,2,-4,-3,1,-2,-4,1,-1,1,-1,2,-2,0,2,0,1,-1,-1,-1.4,-0.2,0.4,-0.55,grad_prof +556,R_77jW0e7TZUzEM31,46 - 52,Canadian,Female,3,3,3,3,3,0,1,0,1,1,3,2,1,-2,2,0,1,1,1,-2,3,3,3,3,3,5,1,1,2,-2,2,1,2,2,1,-1,3,4,0,0,0,0,0,4,3,3,3,3,3,4,1,0,0,0,1,4,3,3,0,-3,3,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,55,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,57,TRUE,1,100,FALSE,1,56,TRUE,0,100,TRUE,1,75,TRUE,0,81,TRUE,1,60,TRUE,1,100,TRUE,0,55,TRUE,0,100,FALSE,1,54,FALSE,1,100,TRUE,1,96,TRUE,1,75,FALSE,1,92,TRUE,1,81,FALSE,1,100,TRUE,1,85,FALSE,1,54,FALSE,1,54,TRUE,0,54,TRUE,1,75,FALSE,0,52,TRUE,1,100,0,0.0225,0,0.0324,0,0,0.0361,0,0,0.0625,0.0625,0.0625,0.1849,0.1936,0.2025,0,0.0064,0.36,0.2116,0,0.0016,0.16,0.2116,0.6561,0.3025,0.2116,0.2704,0,1,1,0.2916,1,0.231714286,0.083642857,0.379785714,14,43.75,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,79.78,61.62,78.38,90.38,88.75,80.81,78.75,-31.25,4.78,-13.38,3.38,15.38,13.75,-12.94,22.5,0,0,0,0,0,1,0,2,3,1,1,0,0,1,1,0,1,1,1,2,0,0,0,0,0,1,1,0,1,0,0,1,1,1,1,0,1,1,1,2,0,1.4,0.6,1,0,0.6,0.8,1,0.75,0.6,3.33,4.33,1,-3,-1,-1,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,1.25,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,-1,2,2,1,1,-1,-1,0,0,0,0,0,0,0,0,0.8,-0.2,0,0.15,C_Ug +557,R_17yp9IsUhb29vup,39 - 45,Canadian,Male,-1,3,3,1,3,1,0,2,1,3,0,-2,3,2,3,-1,0,-1,0,1,0,3,2,1,3,2,2,0,3,-1,3,7,0,-2,3,2,3,0,1,1,2,1,3,6,1,3,1,2,3,4,1,-1,3,-1,1,5,0,-2,3,2,3,0,2,2,2,2,3,8,TRUE,0,60,FALSE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,70,TRUE,1,80,TRUE,1,50,TRUE,1,50,TRUE,1,70,FALSE,1,75,FALSE,1,90,TRUE,1,90,TRUE,0,60,TRUE,1,55,TRUE,1,100,FALSE,1,60,FALSE,1,60,TRUE,0,50,TRUE,0,50,FALSE,0,70,TRUE,1,50,FALSE,1,50,FALSE,0,70,TRUE,0,60,TRUE,1,65,TRUE,0,50,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,85,0.25,0.1225,0,0.04,0.0225,0.09,0.49,0.09,0.25,0.25,0,0.01,0.25,0.0625,0.25,0.25,0.25,0.25,0.04,0.36,0.49,0.2025,0.25,0.36,0.16,0.25,0.25,0.36,1,0.16,0.25,0.01,0.237767857,0.179642857,0.295892857,20,62.5,20,62.5,3,37.5,7,87.5,5,62.5,5,62.5,12,75,8,50,65.62,53.75,65.62,63.12,80,67.81,63.44,0,3.12,16.25,-21.88,0.62,17.5,-7.19,13.44,1,0,1,0,0,1,0,1,2,0,0,0,0,0,0,2,1,3,1,2,2,0,2,1,0,0,1,1,2,2,0,0,0,0,0,3,2,3,2,2,0.4,0.8,0,1.8,1,1.2,0,2.4,0.75,1.15,3,3,-2,2,0,-2,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,39,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-1,0,-1,-1,0,1,-1,0,0,-2,0,0,0,0,0,-1,-1,0,-1,0,-0.6,-0.4,0,-0.6,-0.4,C_Ug +558,R_7M6xdAfF4VEibhK,53 - 59,American,Female,1,3,3,-3,3,1,-1,2,-2,1,2,2,1,-1,2,1,1,1,1,1,3,3,3,-2,3,1,1,-2,2,-3,1,1,2,2,1,1,2,1,0,-1,-1,1,0,4,3,3,3,1,3,1,2,-3,3,-2,1,3,2,3,2,0,3,1,2,2,2,3,2,1,TRUE,0,93,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,86,TRUE,1,100,TRUE,1,50,FALSE,0,75,FALSE,1,77,TRUE,0,82,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,75,TRUE,0,60,TRUE,0,80,TRUE,0,61,FALSE,1,50,TRUE,1,95,TRUE,1,63,TRUE,0,50,TRUE,1,75,FALSE,1,92,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,96,0,0,0.0625,0.0196,0.0016,0,0.0625,0.5625,0.25,0.1369,0,0,0.25,0.0529,0.16,0,0.25,0.25,0,0.0064,0.0025,0.25,0.3721,1,0.36,0.25,0.25,0.8649,1,0.64,0.25,0.6724,0.281953571,0.141171429,0.422735714,20,62.5,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,77.19,61,76.38,86.12,85.25,79.69,74.69,-3.13,11.56,-14,13.88,36.12,10.25,-7.81,30.94,2,0,0,1,0,0,1,0,1,0,0,0,0,2,0,1,2,2,0,1,2,0,0,4,0,1,2,1,0,0,0,1,1,1,1,1,1,1,2,1,0.6,0.4,0.4,1.2,1.2,0.8,0.8,1.2,0.65,1,1,1.67,0,-2,0,3,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,54,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,-3,0,-1,-1,-1,1,0,0,-1,-1,1,-1,0,1,1,-2,0,-0.6,-0.4,-0.4,0,-0.35,C_Ug +559,R_11l5p9v4Gsca74d,46 - 52,Canadian,Female,2,3,3,0,1,1,0,1,-1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,6,0,1,1,1,0,7,0,-1,1,1,0,7,0,1,1,0,0,6,1,1,1,1,0,7,1,1,0,0,1,4,0,1,0,1,1,3,1,0,0,1,0,6,FALSE,1,88,TRUE,1,63,FALSE,1,65,TRUE,0,57,FALSE,0,58,FALSE,1,60,FALSE,0,62,TRUE,1,71,FALSE,0,67,TRUE,1,71,FALSE,1,62,TRUE,0,64,TRUE,1,66,FALSE,1,58,TRUE,1,69,TRUE,1,72,TRUE,0,66,TRUE,0,71,FALSE,1,62,FALSE,1,75,FALSE,0,73,FALSE,0,76,TRUE,0,61,FALSE,0,67,FALSE,1,100,TRUE,1,82,TRUE,0,61,FALSE,1,100,TRUE,0,79,TRUE,1,84,FALSE,0,69,TRUE,1,83,0.0841,0.0324,0.0784,0.3844,0.0289,0.16,0.4489,0.0841,0.0625,0.5776,0.0256,0.1156,0.4489,0.1444,0.3364,0.1369,0.3721,0.3249,0,0,0.5329,0.0961,0.1444,0.1764,0.4356,0.3721,0.4761,0.0144,0.1225,0.5041,0.6241,0.4096,0.256253571,0.233342857,0.279164286,16,50,18,56.25,4,50,3,37.5,5,62.5,6,75,9,56.25,9,56.25,70.69,63.75,68.25,76,74.75,70.81,70.56,-6.25,14.44,13.75,30.75,13.5,-0.25,14.56,14.31,1,3,3,1,0,1,1,0,2,0,0,2,1,0,1,0,1,0,0,1,1,2,2,1,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1.6,0.8,0.8,0.4,1.4,0.8,0,0.8,0.9,0.75,6.67,4.67,-1,3,4,0,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),47,0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,1,0,-1,1,0,-1,1,-1,0,2,1,0,1,-1,1,-1,-1,0,0.2,0,0.8,-0.4,0.15,HS_TS +560,R_7kch5BE6iz8any9,53 - 59,American,Female,-2,2,3,1,2,-2,-3,2,-1,-1,2,1,2,-2,2,2,1,2,2,1,-3,2,3,-1,1,4,-2,-3,3,-1,-2,4,2,1,2,-2,2,3,1,2,2,1,1,4,-1,2,3,1,1,3,-2,-3,2,-2,-1,3,3,1,2,-2,3,3,2,2,2,1,1,4,TRUE,0,82,TRUE,1,100,TRUE,0,92,FALSE,1,60,FALSE,0,61,FALSE,1,66,TRUE,1,85,TRUE,1,79,TRUE,1,76,TRUE,1,89,FALSE,1,58,TRUE,0,84,TRUE,1,74,FALSE,1,56,FALSE,0,61,TRUE,1,81,FALSE,1,61,TRUE,0,91,FALSE,1,61,FALSE,1,65,TRUE,1,84,FALSE,0,76,FALSE,1,76,FALSE,0,71,TRUE,0,85,TRUE,1,70,FALSE,1,56,FALSE,1,70,FALSE,1,60,TRUE,1,90,FALSE,0,65,TRUE,1,85,0.0441,0.09,0.0361,0.0225,0.0225,0.1156,0.5041,0.0121,0.1225,0.5776,0.01,0.0676,0.0576,0.1764,0.3721,0,0.0576,0.16,0.09,0.7225,0.0256,0.3721,0.1521,0.1936,0.1521,0.1936,0.4225,0.6724,0.8464,0.8281,0.16,0.7056,0.278296429,0.161121429,0.395471429,17,53.13,22,68.75,6,75,7,87.5,4,50,5,62.5,11,68.75,11,68.75,74.06,67.12,70.88,79.25,79,77.94,70.19,-15.62,5.31,-7.88,-16.62,29.25,16.5,9.19,1.44,1,0,0,2,1,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0.8,0.4,0,0.6,0.4,0.2,0.4,0.4,0.45,0.35,3.67,3,1,1,0,0,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,53,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,2,0,0,0,1,-1,1,-1,0,0,0,-1,1,0,0,0,0,0.4,0.2,-0.4,0.2,0.1,C_Ug +561,R_3sXwUwOwBrTijxx,39 - 45,Canadian,Female,3,2,2,-1,2,-2,-1,1,-2,0,1,0,1,-1,1,-1,0,1,0,0,3,2,2,-2,2,5,-2,-2,2,-2,0,5,0,0,1,-2,1,5,-1,-1,0,-1,0,5,3,2,2,0,2,5,-2,-2,2,-2,0,5,0,0,1,-2,2,5,0,0,0,0,0,5,TRUE,0,66,TRUE,1,59,TRUE,0,61,FALSE,1,54,FALSE,0,54,FALSE,1,65,TRUE,1,71,TRUE,1,71,TRUE,1,59,TRUE,1,81,FALSE,1,57,FALSE,1,59,TRUE,1,61,FALSE,1,57,FALSE,0,53,FALSE,0,58,FALSE,1,56,FALSE,1,100,TRUE,0,57,FALSE,1,59,FALSE,0,60,TRUE,1,60,FALSE,1,76,TRUE,1,70,FALSE,1,81,TRUE,1,86,TRUE,0,60,TRUE,0,71,TRUE,0,76,TRUE,1,100,TRUE,1,59,TRUE,1,100,0.0841,0.0196,0.3364,0.0841,0,0.1225,0.09,0.0361,0.1681,0.16,0,0.1521,0.1681,0.1849,0.2916,0.1681,0.0576,0.2116,0.5041,0.0361,0.36,0.2809,0.3249,0.1849,0.1936,0.36,0.1681,0.4356,0.3721,0,0.5776,0.1681,0.206310714,0.129335714,0.283285714,16,50,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,12,75,10,62.5,67.41,57.25,68.5,75.25,68.62,68.88,65.94,-18.75,-1.34,-5.25,6,-12.25,6.12,-6.12,3.44,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0.2,0.4,0.4,0.6,0.2,0.4,0.6,0.4,0.4,0.4,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,45,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,1,0,1,0,0,0,-0.2,0.2,0,C_Ug +562,R_73CmFL4triVTvWN,53 - 59,American,Female,0,1,1,1,1,-1,-2,1,-2,-1,1,1,1,-1,1,0,0,1,1,1,1,1,1,1,1,8,-1,-2,1,-2,-1,3,1,1,0,-1,1,2,0,0,0,1,1,3,0,1,1,1,-1,2,0,-2,1,-1,-2,2,1,1,1,-1,1,2,0,0,0,0,1,2,TRUE,0,93,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,91,TRUE,1,50,TRUE,1,50,TRUE,1,93,FALSE,1,83,TRUE,0,94,TRUE,1,96,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,98,FALSE,1,63,FALSE,1,50,TRUE,1,89,TRUE,1,73,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,76,TRUE,1,89,FALSE,0,58,FALSE,0,50,0.25,0.25,0,0.0081,0.25,0.25,0.25,0.0049,0.25,0.0729,0.0121,0.0016,0.25,0.0289,0.25,0.25,0.25,0.25,0.25,0.25,0.0121,0.25,0.1369,0.25,0.25,0.25,0.3364,0.8649,1,0.9604,0.5776,0.8836,0.308653571,0.169314286,0.447992857,12,37.5,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,10,62.5,8,50,67.06,56.75,63.88,74.75,72.88,68.06,66.06,-18.75,10.81,-5.75,26.38,12.25,10.38,5.56,16.06,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0.2,0,0.2,0.2,0.4,0.6,0,0.4,0.15,0.35,4.33,2,6,1,0,1,2.33,5 cents,5 minutes,24 days,Female,High School (or equivalent),56,1,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,1,0,0,0,-2,-1,0,0,-1,-1,0,0,1,0,0,0,0,0,-1,0,-0.2,-0.6,0.2,-0.2,-0.2,HS_TS +563,R_7KJYqqIU2QGldUt,53 - 59,American,Female,2,2,1,-2,3,-2,-2,2,3,0,2,-3,3,-3,3,-1,1,1,1,-3,-1,2,1,-3,3,1,-2,-1,2,3,0,0,2,-3,3,-3,3,2,-1,-1,-1,-1,-3,4,1,2,1,1,3,8,-2,-1,2,2,0,1,2,-3,3,-3,3,0,0,0,0,-1,-3,5,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,63,TRUE,1,80,TRUE,1,100,FALSE,0,50,TRUE,1,57,TRUE,0,50,TRUE,0,100,TRUE,1,71,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,56,FALSE,1,50,FALSE,1,50,TRUE,1,68,FALSE,0,50,FALSE,1,50,TRUE,1,57,FALSE,1,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,62,FALSE,0,50,TRUE,1,100,0,0.09,0,0.04,0,0.3969,0.1849,0.1849,0.25,0.25,0.1444,0.0841,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.1024,0.25,0.25,1,0.25,0.25,0.25,0.25,0,0.1936,0.25,1,0.251471429,0.178228571,0.324714286,15,46.88,23,71.88,5,62.5,5,62.5,6,75,7,87.5,13,81.25,10,62.5,66.69,56.25,69,64.12,77.38,72.81,60.56,-25,-5.19,-6.25,6.5,-10.88,-10.12,-8.44,-1.94,3,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,2,2,0,1,0,0,3,0,0,1,0,1,0,0,0,0,0,0,1,1,1,2,0,0.8,0.2,0,1.2,0.8,0.4,0,1,0.55,0.55,1,3,-7,-1,2,-1,-2,10 cents,100 minutes,24 days,Female,University - PhD,54,1.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,2,0,0,-2,0,0,0,0,-1,0,0,0,0,0,0,-1,1,1,0,0,0,-0.2,0,0.2,0,grad_prof +564,R_5DuA1HvIy5gY2vK,32 - 38,American,Female,1,1,1,0,0,-3,-1,0,1,0,0,-1,2,-2,1,0,0,0,0,0,2,2,2,0,0,6,-3,0,0,2,0,6,0,-1,2,-2,2,5,-1,-1,-2,0,-2,5,1,1,1,0,0,6,-2,0,0,1,1,5,0,-1,2,-2,1,5,0,0,0,0,-1,5,TRUE,0,76,TRUE,1,85,TRUE,0,97,FALSE,1,51,TRUE,1,64,FALSE,1,83,FALSE,0,53,TRUE,1,62,TRUE,1,71,TRUE,1,81,FALSE,1,50,TRUE,0,57,FALSE,0,51,FALSE,1,61,FALSE,0,50,TRUE,1,68,FALSE,1,50,TRUE,0,72,TRUE,0,54,FALSE,1,50,TRUE,1,82,TRUE,1,64,FALSE,1,67,TRUE,1,56,FALSE,1,84,TRUE,1,54,TRUE,0,50,FALSE,1,61,TRUE,0,50,FALSE,0,65,FALSE,0,52,TRUE,1,52,0.1444,0.2116,0.1024,0.2809,0.2304,0.0289,0.1936,0.0361,0.25,0.1296,0.4225,0.2601,0.0841,0.25,0.1296,0.0225,0.1089,0.2401,0.1521,0.0256,0.0324,0.25,0.2916,0.1521,0.25,0.25,0.2704,0.5776,0.9409,0.5184,0.25,0.3249,0.2383,0.170457143,0.306142857,17,53.13,20,62.5,4,50,6,75,5,62.5,5,62.5,11,68.75,9,56.25,63.22,57.88,62.38,68.12,64.5,63.12,63.31,-9.37,0.72,7.88,-12.62,5.62,2,-5.63,7.06,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,2,0,2,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0.6,0.4,0.2,1.2,0,0.6,0,0.2,0.6,0.2,5.67,5.33,0,1,0,0,0.34,5 cents,5 minutes,47 days,Female,University - Undergraduate,34,0.5,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,1,1,1,0,0,-1,0,0,1,-1,0,0,0,0,1,1,1,2,0,1,0.6,-0.2,0.2,1,0.4,C_Ug +565,R_1rTcNI0ME0EkqHe,53 - 59,American,Female,2,2,3,-2,1,-1,-1,2,-2,-2,1,2,1,0,1,2,2,2,2,2,2,2,3,-1,2,1,-2,-2,2,-1,-2,1,1,2,-1,-1,1,1,2,2,2,2,2,1,2,2,3,1,1,1,-2,-2,2,-2,-2,1,1,2,1,0,2,1,2,2,2,2,2,0,FALSE,1,51,FALSE,0,50,FALSE,1,51,FALSE,1,50,FALSE,0,52,FALSE,1,89,TRUE,1,81,TRUE,1,89,FALSE,0,53,FALSE,0,50,FALSE,1,84,FALSE,1,51,TRUE,1,74,TRUE,0,75,FALSE,0,53,TRUE,1,77,FALSE,1,54,TRUE,0,84,TRUE,0,63,FALSE,1,83,TRUE,1,63,FALSE,0,58,FALSE,1,96,TRUE,1,82,FALSE,1,90,TRUE,1,87,TRUE,0,69,FALSE,1,89,TRUE,0,67,TRUE,1,78,FALSE,0,68,TRUE,1,67,0.0121,0.0169,0.0529,0.0361,0.1089,0.0121,0.0324,0.25,0.0289,0.3364,0.0484,0.0676,0.2809,0.0256,0.2704,0.25,0.0016,0.25,0.0121,0.01,0.1369,0.2809,0.3969,0.5625,0.2116,0.4761,0.4624,0.2401,0.2401,0.7056,0.4489,0.2401,0.228121429,0.140228571,0.316014286,16,50,20,62.5,2,25,6,75,4,50,8,100,9,56.25,11,68.75,69.62,61.25,70.25,72,75,67.62,71.62,-12.5,7.12,36.25,-4.75,22,-25,11.37,2.87,0,0,0,1,1,1,1,0,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0.4,0.6,0.6,0,0.6,0.4,0.2,0,0.4,0.3,1,1,0,0,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,57,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,-2,1,0,0,0,1,0,0,0,2,1,-1,0,0,0,0,0,-0.2,0.2,0.4,0,0.1,C_Ug +566,R_6afONHtpQoqqCjf,53 - 59,American,Female,-1,2,2,1,1,-3,-2,2,-2,1,2,1,2,-2,2,0,1,1,1,-1,-1,2,2,-3,1,6,-3,-2,1,-1,1,5,2,2,2,1,2,4,-1,-1,-1,-1,-1,5,-1,2,2,-1,2,7,-3,-2,2,-2,0,4,2,2,2,-1,2,4,1,1,2,2,2,6,FALSE,1,50,TRUE,1,70,FALSE,1,88,TRUE,0,50,TRUE,1,60,FALSE,1,100,TRUE,1,76,TRUE,1,94,FALSE,0,50,TRUE,1,63,FALSE,1,66,TRUE,0,64,TRUE,1,82,TRUE,0,59,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,64,FALSE,1,50,FALSE,1,100,FALSE,0,64,TRUE,1,71,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,50,TRUE,0,50,TRUE,0,80,TRUE,1,71,FALSE,0,59,TRUE,1,100,0.0036,0.0576,0.0625,0.0576,0,0,0,0.1369,0,0.0841,0.0841,0.0324,0.25,0.1156,0.16,0.09,0.25,0.25,0.25,0,0.4096,0.25,0.25,0.3481,0.25,0.25,0.3481,0.25,0.0144,0.4096,0.64,0.4096,0.197589286,0.103792857,0.291385714,16,50,21,65.63,3,37.5,6,75,6,75,6,75,12,75,9,56.25,69.75,55.62,73.25,69.88,80.25,72.56,66.94,-15.63,4.12,18.12,-1.75,-5.12,5.25,-2.44,10.69,0,0,0,4,0,0,0,1,1,0,0,1,0,3,0,1,2,2,2,0,0,0,0,2,1,0,0,0,0,1,0,1,0,1,0,1,0,1,1,3,0.8,0.4,0.8,1.4,0.6,0.2,0.4,1.2,0.85,0.6,5,5,-1,1,0,-1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),55,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,0,0,0,2,-1,0,0,1,1,-1,0,0,0,2,0,0,2,1,1,-3,0.2,0.2,0.4,0.2,0.25,grad_prof +567,R_3LYIwChxV19BDIp,53 - 59,Canadian,Female,3,2,1,3,0,-2,-2,1,-2,-1,2,1,2,-3,2,0,0,2,3,2,3,2,1,2,0,2,-2,-2,2,-2,0,3,2,2,2,-2,2,2,0,1,1,2,2,3,3,2,1,3,-1,6,-2,-2,2,-2,-1,2,2,1,2,-2,2,0,0,0,1,3,2,3,FALSE,1,100,TRUE,1,88,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,65,TRUE,1,87,TRUE,1,100,TRUE,1,84,TRUE,1,82,TRUE,0,52,TRUE,0,76,TRUE,1,77,FALSE,1,86,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,75,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,84,TRUE,1,92,FALSE,1,100,TRUE,1,88,TRUE,0,77,FALSE,1,56,TRUE,0,88,TRUE,1,100,TRUE,1,88,TRUE,1,100,0,0.0144,0,0.0169,0,0.1225,0.0064,0.0324,0.25,0.0225,0,0.0529,0.0256,0.2704,0.25,0.0144,0.0256,0.25,0.1936,0,0.25,0.25,0.5625,0.0196,0.25,0.5929,0.0144,0,1,1,0.7744,0.5776,0.243132143,0.094478571,0.391785714,24,75,22,68.75,4,50,5,62.5,7,87.5,6,75,14,87.5,8,50,79.06,70.5,70.5,91,84.25,82.56,75.56,6.25,10.31,20.5,8,3.5,9.25,-4.94,25.56,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0.2,0.4,0.4,0.6,0.2,0.2,0.2,0.2,0.4,0.2,2.33,2.67,-4,1,2,0,-0.34,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,1,-1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0.2,0.2,0.4,0.2,HS_TS +568,R_3tth360TgaYpm1b,32 - 38,American,Female,-3,2,2,-1,2,0,-1,2,1,0,0,1,1,2,1,1,1,1,2,1,-2,2,2,0,1,5,1,0,2,1,-1,6,1,1,1,1,0,4,-1,0,0,1,-1,5,-2,2,2,0,2,4,1,0,1,-1,1,7,1,2,2,2,2,7,2,2,2,2,0,7,TRUE,0,100,TRUE,1,55,TRUE,0,100,FALSE,1,66,TRUE,1,65,FALSE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,56,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,79,TRUE,1,100,TRUE,0,82,FALSE,1,100,TRUE,0,81,FALSE,1,74,FALSE,0,78,TRUE,1,90,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,TRUE,0,80,TRUE,0,85,TRUE,0,65,TRUE,1,81,TRUE,1,63,TRUE,1,99,0.0225,0.0169,0,0,0.0001,0,0,0,0.0676,0.01,0.0361,0,0.3136,0,0.1225,0.2025,1,0.1156,0.7225,0,0.6084,0.0441,0.6561,0.0625,0.6724,0.64,0.1369,1,1,0,0.4225,1,0.315478571,0.133428571,0.497528571,21,65.63,21,65.63,5,62.5,4,50,7,87.5,5,62.5,14,87.5,7,43.75,85.81,72.5,86.12,94,90.62,83.62,88,0,20.18,10,36.12,6.5,28.12,-3.88,44.25,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,2,1,1,1,2,1,0,0,1,0,1,1,1,2,1,1,1,1,0,1,1,1,1,0,1,0.6,0.6,0.6,1.4,0.4,1.2,0.8,0.8,0.8,0.8,5,6,1,-1,-3,-2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),34,1.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,1,0,0,-1,-2,0,0,-1,-1,1,0,1,0,0,1,1,0.2,-0.6,-0.2,0.6,0,grad_prof +569,R_7i3mDGkJaiIUWAN,39 - 45,Canadian,Female,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,0,1,-1,-1,1,1,1,1,1,1,1,1,-1,1,4,-2,1,1,1,1,1,-1,2,-1,-1,-1,6,1,2,2,1,2,4,0,0,1,0,1,4,-3,1,3,1,2,2,1,1,3,1,-1,2,FALSE,1,70,TRUE,1,51,TRUE,0,100,TRUE,0,55,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,62,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,89,TRUE,0,67,TRUE,0,100,TRUE,0,81,FALSE,1,66,TRUE,1,59,TRUE,1,71,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,58,FALSE,1,100,FALSE,1,61,TRUE,1,91,FALSE,0,58,TRUE,1,100,0,0,0.0121,0,0,0,0,0,0.1156,0.0841,0.0081,0,1,0.3844,0.2025,0.2401,1,0.3025,0,0,0.1681,0,0.6561,0,0.4489,0.1764,0.3364,0.09,1,1,0.1521,1,0.298760714,0.238378571,0.359142857,22,68.75,22,68.75,3,37.5,6,75,7,87.5,6,75,14,87.5,8,50,84.19,70.62,80.25,92.62,93.25,85.88,82.5,0,15.44,33.12,5.25,5.12,18.25,-1.62,32.5,0,0,0,0,0,2,0,0,2,0,1,0,0,0,0,0,1,1,2,0,2,1,1,0,1,1,1,0,1,0,2,0,2,0,1,2,0,3,0,0,0,0.8,0.2,0.8,1,0.6,1,1,0.45,0.9,2,3.33,-3,0,-1,4,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,41,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,-2,-1,-1,0,-1,1,-1,0,1,0,-1,0,-2,0,-1,-2,1,-2,2,0,-1,0.2,-0.8,-0.2,-0.45,C_Ug +570,R_6O1tML60LtMQHqe,25 - 31,Canadian,Female,2,2,2,2,2,0,-1,2,2,3,0,-2,2,1,3,0,1,0,0,0,2,2,2,3,2,6,1,0,1,0,2,7,1,-1,1,2,1,6,1,1,0,1,0,6,3,2,2,3,2,7,2,-2,2,0,2,6,1,-2,2,2,3,5,2,2,2,2,2,8,TRUE,0,75,TRUE,1,54,FALSE,1,100,FALSE,1,61,TRUE,1,75,FALSE,1,94,TRUE,1,95,TRUE,1,76,FALSE,0,60,TRUE,1,59,FALSE,1,56,TRUE,0,100,TRUE,1,75,FALSE,1,90,TRUE,1,72,TRUE,1,97,TRUE,0,83,TRUE,0,100,TRUE,0,88,FALSE,1,56,FALSE,0,92,TRUE,1,86,FALSE,1,91,TRUE,1,100,FALSE,1,96,TRUE,1,94,TRUE,0,88,FALSE,1,70,FALSE,1,82,FALSE,0,100,FALSE,0,50,TRUE,1,100,0.0576,0.0036,0.0009,0.0025,0,0.0036,0,0.1681,0.1936,0.0196,1,0.0625,0.36,0.1936,0.0625,0.2116,0.0081,0.1521,0.09,0.0016,0.8464,0.0784,0.7744,0.01,0.6889,0.7744,0.25,0.5625,0,1,0.0324,1,0.305153571,0.17395,0.436357143,20,62.5,22,68.75,4,50,6,75,6,75,6,75,12,75,10,62.5,81.72,66.12,86.5,86.88,87.38,80.31,83.12,-6.25,12.97,16.12,11.5,11.88,12.38,5.31,20.62,0,0,0,1,0,1,1,1,2,1,1,1,1,1,2,1,0,0,1,0,1,0,0,1,0,2,1,0,2,1,1,0,0,1,0,2,1,2,2,2,0.2,1.2,1.2,0.4,0.4,1.2,0.4,1.8,0.75,0.95,6.33,6,-1,1,1,-2,0.33,10 cents,5 minutes,47 days,Female,University - Undergraduate,25,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,0,-1,0,1,0,0,0,1,1,0,2,-1,-1,-2,-1,-2,-0.2,0,0.8,-1.4,-0.2,C_Ug +571,R_7jWcITvDBLPvHQR,32 - 38,Canadian,Female,3,1,3,0,2,-3,-1,0,0,2,3,0,1,0,0,-3,-1,-1,-1,-3,-3,0,0,0,0,5,-3,0,0,0,0,5,3,0,3,3,3,4,-1,0,0,-3,-3,2,3,0,3,0,3,5,-1,0,0,-3,3,8,3,-1,2,0,3,5,2,0,3,0,3,5,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,54,TRUE,1,50,FALSE,1,100,TRUE,1,73,TRUE,0,50,TRUE,0,50,TRUE,0,50,FALSE,0,76,TRUE,1,50,TRUE,1,100,0.25,0.0729,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.25,0.25,0.25,0.25,0.2116,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,1,1,0.25,1,0.3139,0.2528,0.375,8,25,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,62.59,50,56.75,77.88,65.75,59.31,65.88,-34.38,3.21,-12.5,6.75,2.88,15.75,-15.69,22.13,6,1,3,0,2,0,1,0,0,2,0,0,2,3,3,2,1,1,2,0,0,1,0,0,1,2,1,0,3,1,0,1,1,0,3,5,1,4,1,6,2.4,0.6,1.6,1.2,0.4,1.4,1,3.4,1.45,1.55,4.67,6,0,-3,-1,-3,-1.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,33,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,6,0,3,0,1,-2,0,0,-3,1,0,-1,1,3,0,-3,0,-3,1,-6,2,-0.8,0.6,-2.2,-0.1,C_Ug +572,R_3du9twEcINOyPCq,32 - 38,American,Female,1,3,3,3,-3,2,2,0,0,2,2,2,3,1,3,-3,-2,-1,-3,-3,3,2,3,3,0,5,3,2,2,0,2,7,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,58,TRUE,1,100,FALSE,1,62,TRUE,0,100,TRUE,1,61,TRUE,0,77,TRUE,1,72,FALSE,0,54,TRUE,0,87,TRUE,0,100,TRUE,0,56,FALSE,1,95,TRUE,1,62,TRUE,1,53,FALSE,1,56,TRUE,1,54,TRUE,0,54,TRUE,1,60,TRUE,0,50,TRUE,0,100,TRUE,0,65,TRUE,1,100,TRUE,1,75,TRUE,1,100,0,0.16,0.2916,0,0,0,0.2116,0,0.0025,0.2209,0,0.1521,0.1764,0.1444,0,0,0.1936,0,1,0.2916,0.1444,0.0784,0.3136,0.5929,0.7569,0.25,0.0625,0,1,1,0.4225,1,0.286225,0.078678571,0.493771429,17,53.13,21,65.63,6,75,6,75,5,62.5,4,50,15,93.75,6,37.5,79.72,71.62,78.88,80.5,87.88,78.06,81.38,-12.5,14.09,-3.38,3.88,18,37.88,-15.69,43.88,2,1,0,0,3,1,0,2,0,0,1,1,0,2,0,6,5,4,6,6,2,0,0,0,6,1,1,3,3,1,1,1,0,2,0,6,5,4,6,6,1.2,0.6,0.8,5.4,1.6,1.8,0.8,5.4,2,2.4,7.33,10,-5,-3,0,0,-2.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),36,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,1,0,0,-3,0,-1,-1,-3,-1,0,0,0,0,0,0,0,0,0,0,-0.4,-1.2,0,0,-0.4,HS_TS +573,R_5Gompk2q3VXsckp,25 - 31,Canadian,Female,1,1,3,2,3,2,-1,1,1,2,2,3,3,1,3,1,1,1,1,-1,2,2,3,2,3,9,2,2,2,0,3,9,2,2,2,3,2,9,2,2,2,2,2,8,1,1,3,2,3,8,2,0,2,0,2,8,3,3,2,2,2,8,1,2,2,2,1,7,TRUE,0,80,TRUE,1,75,FALSE,1,75,FALSE,1,70,TRUE,1,75,TRUE,0,90,TRUE,1,100,TRUE,1,90,TRUE,1,80,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,80,FALSE,1,60,TRUE,1,80,TRUE,1,100,TRUE,0,80,TRUE,0,90,FALSE,1,80,TRUE,0,90,TRUE,1,90,TRUE,1,90,FALSE,1,75,TRUE,1,85,FALSE,1,80,FALSE,0,75,TRUE,0,85,TRUE,0,80,TRUE,0,85,TRUE,1,85,TRUE,1,85,FALSE,0,80,0.01,0.5625,0,0,0.64,0.81,0.0225,0,0.81,0.01,0.0225,0.04,0.04,0.64,0.0625,0.0625,0.0625,0.09,0.64,0.04,0.01,0.04,0.04,0.16,0.64,0.7225,0.0225,0.64,0.0625,0.81,0.7225,1,0.316517857,0.236607143,0.396428571,25,78.13,20,62.5,6,75,4,50,5,62.5,5,62.5,14,87.5,6,37.5,83.44,79.38,81.88,84.38,88.12,85.62,81.25,15.63,20.94,4.38,31.88,21.88,25.62,-1.88,43.75,1,1,0,0,0,0,3,1,1,1,0,1,1,2,1,1,1,1,1,3,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1,0,1,1,1,2,0.4,1.2,1,1.4,0,0.6,0.8,1,1,0.6,9,8,1,1,1,1,1,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,27,0.25,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,1,1,0,0,0,0,2,0,0,1,-1,1,0,1,0,1,0,0,0,1,0.4,0.6,0.2,0.4,0.4,C_Ug +574,R_5Y9q0BIpJ1p8sOl,46 - 52,Canadian,Female,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,5,0,0,0,0,0,7,0,0,0,1,1,7,1,1,1,1,1,7,1,1,1,1,1,6,0,0,0,0,0,7,1,1,1,1,2,7,0,0,0,0,0,8,TRUE,0,100,TRUE,1,100,FALSE,1,64,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,73,FALSE,0,75,FALSE,1,90,TRUE,0,87,TRUE,1,61,FALSE,1,100,FALSE,0,51,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,77,TRUE,1,62,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,70,0,0.1444,0.25,0,0.09,0,0.25,0.5625,0.25,0.25,0.25,0.1521,0.0729,0.01,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.2601,0.25,0,0.25,0.25,0.25,1,0.1296,0.25,0.25,0.7569,0.244178571,0.188392857,0.299964286,16,50,22,68.75,6,75,6,75,5,62.5,5,62.5,8,50,14,87.5,65.94,64.25,60.12,76.75,62.62,65.12,66.75,-18.75,-2.81,-10.75,-14.88,14.25,0.12,15.12,-20.75,2,2,1,0,2,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,2,0,0,0,0,0,1.4,0,0.4,1,0.8,0,1.2,0,0.7,0.5,6.33,6.67,-1,0,0,-1,-0.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,47,-0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,1,1,-1,1,0,0,0,0,0,-1,-1,-1,0,-1,1,1,1,1,1,0.6,0,-0.8,1,0.2,C_Ug +575,R_5l6J18fCm9PC8y4,39 - 45,American,Male,0,0,2,3,-3,-3,-1,0,0,0,1,0,2,-3,1,-3,-3,-3,-3,-3,3,3,3,0,-3,8,0,0,-3,0,-3,9,2,0,2,-3,-3,6,-3,-3,-3,-3,-3,7,0,1,3,3,-3,7,-3,-1,-2,0,-3,3,2,0,1,-3,2,5,-3,-3,-3,-3,-3,7,FALSE,1,50,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,77,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.225103571,0.178571429,0.271635714,5,15.63,24,75,5,62.5,8,100,4,50,7,87.5,10,62.5,14,87.5,61.78,56.25,62.5,65.88,62.5,62.5,61.06,-59.37,-13.22,-6.25,-37.5,15.88,-25,0,-26.44,3,3,1,3,0,3,1,3,0,3,1,0,0,0,4,0,0,0,0,0,0,1,1,0,0,0,0,2,0,3,1,0,1,0,1,0,0,0,0,0,2,2,1,0,0.4,1,0.6,0,1.25,0.5,7.67,5,1,6,1,0,2.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),45,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,3,2,0,3,0,3,1,1,0,0,0,0,-1,0,3,0,0,0,0,0,1.6,1,0.4,0,0.75,HS_TS +576,R_7jNc3fMFTZ2N9kN,25 - 31,Canadian,Female,2,3,3,2,3,-2,-3,3,-3,-2,3,2,2,-2,3,-2,-2,2,-1,-2,3,3,3,2,3,1,-3,-3,3,-3,-3,1,3,3,3,-3,3,1,1,1,1,1,1,5,3,3,3,2,3,1,-3,-3,3,-3,-3,1,3,3,3,3,3,1,3,3,3,3,3,6,TRUE,0,100,TRUE,1,74,TRUE,0,72,TRUE,0,50,TRUE,1,50,FALSE,1,82,TRUE,1,60,TRUE,1,100,TRUE,1,66,TRUE,1,70,TRUE,0,72,TRUE,0,100,TRUE,1,71,FALSE,1,84,FALSE,0,72,FALSE,0,57,TRUE,0,59,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,79,TRUE,0,81,TRUE,1,75,TRUE,0,67,TRUE,0,50,TRUE,0,64,TRUE,1,64,TRUE,1,98,TRUE,1,100,0,0.0625,0.3249,0.16,0,0.0324,0.0441,0.09,0,0,0.1296,0.0841,0.1156,0.5184,0.25,0.0676,0.25,0.25,0.25,0.6561,0,0.5184,0,0.0256,0.3481,0.4489,0.0004,1,0.5184,0,0.4096,1,0.250260714,0.130842857,0.369678571,15,46.88,20,62.5,4,50,6,75,6,75,4,50,14,87.5,6,37.5,77.09,74.88,72,83.75,77.75,77.25,76.94,-15.62,14.59,24.88,-3,8.75,27.75,-10.25,39.44,1,0,0,0,0,1,0,0,0,1,0,1,1,1,0,3,3,1,2,3,1,0,0,0,0,1,0,0,0,1,0,1,1,5,0,5,5,1,4,5,0.2,0.4,0.6,2.4,0.2,0.4,1.4,4,0.9,1.5,1,1,0,0,0,-1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,30,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,0,-2,-2,0,-2,-2,0,0,-0.8,-1.6,-0.6,C_Ug +577,R_7E5JIhztzOZfm1J,53 - 59,American,Female,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,32,100,17,53.13,5,62.5,4,50,4,50,4,50,15,93.75,2,12.5,100,100,100,100,100,100,100,46.87,46.87,37.5,50,50,50,6.25,87.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,3,0,0,0,3,0.75,0.75,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),54,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +578,R_32JklZgbFSYGk4g,25 - 31,Canadian,Male,3,3,1,2,3,1,1,2,1,2,2,3,1,3,3,-1,1,-3,1,-2,2,3,0,2,3,5,-3,3,2,3,-2,8,3,3,-3,3,0,10,1,1,2,3,-2,10,2,3,0,2,3,2,0,-3,3,-3,1,10,3,3,2,-1,3,4,3,3,3,1,1,5,TRUE,0,84,FALSE,0,70,TRUE,0,100,TRUE,0,100,FALSE,0,61,TRUE,0,59,FALSE,0,63,TRUE,1,100,FALSE,0,59,FALSE,0,53,TRUE,0,93,TRUE,0,100,TRUE,1,98,FALSE,1,55,FALSE,0,54,FALSE,0,52,TRUE,0,64,TRUE,0,90,FALSE,1,61,FALSE,1,59,FALSE,0,75,TRUE,1,100,FALSE,1,62,TRUE,1,100,TRUE,0,78,TRUE,1,100,TRUE,0,100,TRUE,0,69,TRUE,0,100,TRUE,1,78,FALSE,0,55,TRUE,1,100,0,0,0.2704,0.3969,0,0.3481,0,0.2809,0.1681,0,0.0484,0.0004,0.3481,0.8649,0.3721,0.49,0.1444,1,0.4761,0.6084,0.5625,0.2916,0.1521,0.2025,0.4096,1,0.3025,0.7056,1,0.81,1,1,0.449510714,0.290385714,0.608635714,12,37.5,11,34.38,1,12.5,3,37.5,3,37.5,4,50,7,43.75,4,25,77.88,74,77.38,77.88,82.25,76.12,79.62,3.12,43.5,61.5,39.88,40.38,32.25,32.37,54.62,1,0,1,0,0,4,2,0,2,4,1,0,4,0,3,2,0,5,2,0,1,0,1,0,0,1,4,1,4,1,1,0,1,4,0,4,2,6,0,3,0.4,2.4,1.6,1.8,0.4,2.2,1.2,3,1.55,1.7,7.67,5.33,3,-2,6,5,2.34,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),29,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,3,-2,-1,-2,3,0,0,3,-4,3,-2,-2,-1,2,-3,0,0.2,0.4,-1.2,-0.15,grad_prof +579,R_6Bxhobb9ECeIrNB,39 - 45,American,Female,3,1,3,0,3,-3,1,3,1,-1,1,2,2,2,-3,2,1,2,2,2,-1,2,3,2,3,5,-3,1,2,1,-3,2,1,2,2,2,-3,0,0,0,-1,-1,0,8,1,1,2,1,3,2,-3,1,2,1,-2,4,1,2,2,2,-3,5,-1,0,0,0,0,4,TRUE,0,52,TRUE,1,81,TRUE,0,83,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,79,TRUE,1,89,TRUE,1,50,TRUE,1,55,TRUE,0,52,TRUE,0,67,TRUE,1,68,TRUE,0,100,TRUE,1,85,FALSE,0,65,FALSE,1,65,TRUE,0,81,TRUE,0,82,FALSE,1,61,TRUE,1,50,TRUE,1,54,TRUE,0,60,TRUE,1,88,TRUE,0,56,TRUE,1,60,TRUE,0,50,FALSE,1,79,TRUE,0,56,TRUE,1,67,FALSE,0,51,TRUE,1,81,0.0121,0.16,0.4225,0.0441,0.0361,0,0.0144,0.2025,0.1521,0.2116,0.1089,0.1024,0.25,0.2704,0.25,0.0361,0.36,0.25,0.0441,0.3136,0.25,0.0225,0.6724,1,0.1225,0.25,0.2601,0.2704,0.6889,0.6561,0.3136,0.4489,0.269914286,0.160321429,0.379507143,21,65.63,17,53.13,3,37.5,5,62.5,4,50,5,62.5,13,81.25,4,25,67.72,62.62,66.25,67.12,74.88,67.06,68.38,12.5,14.59,25.12,3.75,17.12,12.38,-14.19,43.38,4,1,0,2,0,0,0,1,0,2,0,0,0,0,0,2,1,3,3,2,2,0,1,1,0,0,0,1,0,1,0,0,0,0,0,3,1,2,2,2,1.4,0.6,0,2.2,0.8,0.4,0,2,1.05,0.8,2.33,3.67,3,-2,-5,4,-1.34,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,45,1,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,2,1,-1,1,0,0,0,0,0,1,0,0,0,0,0,-1,0,1,1,0,0.6,0.2,0,0.2,0.25,C_Ug +580,R_3yONc4fAkV08keZ,60 - 66,American,Female,2,2,2,1,1,1,0,2,-1,1,2,1,3,-3,2,1,1,1,-1,-1,2,2,2,-1,1,0,2,2,2,1,1,1,2,1,3,-3,2,0,1,1,1,1,-1,0,2,2,2,2,0,0,0,1,2,0,1,1,2,1,3,-3,2,0,1,1,1,0,-1,0,TRUE,0,92,TRUE,1,100,FALSE,1,93,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,92,TRUE,1,100,TRUE,1,50,TRUE,1,85,TRUE,0,70,FALSE,1,65,FALSE,0,90,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,FALSE,1,50,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,1,90,FALSE,0,50,TRUE,1,100,0,0.0225,0,0.0064,0,0,0.01,0.0225,0.25,0,0.01,0.81,0.25,0.49,0.04,0,0,0.25,0,0,0.5625,0.25,0.5625,1,0.25,0.25,0.25,0.8464,0.0049,0,0.5625,0.1225,0.242635714,0.152321429,0.33295,16,50,23,71.88,4,50,5,62.5,6,75,8,100,12,75,11,68.75,81.47,61.88,83.75,94.25,86,83.56,79.38,-21.88,9.59,11.88,21.25,19.25,-14,8.56,10.63,0,0,0,2,0,1,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0.4,1,0,0.4,0.4,0.6,0,0.2,0.45,0.3,0.33,0.33,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,0,1,-1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0.2,0.15,HS_TS +581,R_6sWLSoBqWdsAvER,46 - 52,Canadian,Female,3,3,2,1,3,1,-1,3,-2,3,1,-1,3,-3,3,1,2,2,2,1,3,3,2,1,3,3,1,-2,3,-3,2,3,2,-1,3,-3,3,2,1,1,2,1,1,2,3,3,2,2,3,3,1,-3,3,-3,3,2,2,-2,3,-3,3,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,55,TRUE,1,99,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,TRUE,0,57,TRUE,0,100,TRUE,1,69,TRUE,0,100,TRUE,1,73,TRUE,1,100,TRUE,0,70,FALSE,1,75,TRUE,0,96,FALSE,1,100,FALSE,0,98,TRUE,1,94,FALSE,1,100,TRUE,1,100,TRUE,0,87,TRUE,1,80,TRUE,0,100,FALSE,1,99,TRUE,0,99,TRUE,1,100,TRUE,1,65,TRUE,1,100,0,0.04,0,0,0,0.2025,0,0,0,0.0036,0,0.0961,0.0004,0.3249,0.0001,0,0,0.2025,0.0001,0.7569,0.9604,0.0729,0.9216,1,0.49,1,0.1225,1,0,0.0625,0.9801,1,0.328467857,0.059292857,0.597642857,25,78.13,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,15,93.75,7,43.75,89.66,80.5,86.25,92,99.88,92.25,87.06,9.38,20.91,18,23.75,29.5,12.38,-1.5,43.31,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,2,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0.6,0.2,0.4,0.2,0.6,0.4,0.4,0.3,0.4,2.67,2.33,0,1,0,0,0.34,10 cents,100 minutes,24 days,Female,University - Undergraduate,48,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,0,-1,0,0,1,0,-1,0,0,0,-1,1,0,1,-1,-0.2,0,-0.2,0,-0.1,C_Ug +582,R_5P7eU8tKjWbiexA,39 - 45,Canadian,Female,3,2,2,0,1,2,-3,3,-3,1,2,0,2,0,3,2,2,3,2,2,3,2,2,-1,0,7,3,-3,3,-3,1,6,3,1,3,1,3,7,1,-1,2,-1,3,5,3,2,3,0,0,5,2,-3,3,-3,1,5,3,0,3,0,3,2,1,1,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,73,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,98,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,61,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.25,0,0.0729,0,0,1,0,0,0,0,0,1,0.25,0,0,0,0.25,0,0,0.25,0.25,0.1521,1,0,0.25,0,0,1,0,1,0.9604,0.262946429,0.178571429,0.347321429,16,50,24,75,6,75,6,75,7,87.5,5,62.5,12,75,12,75,88.5,70.12,93.75,90.38,99.75,88.94,88.06,-25,13.5,-4.88,18.75,2.88,37.25,13.94,13.06,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1,3,1,3,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,0.4,0.2,0.8,1.8,0.4,0,0.4,0.6,0.8,0.35,6.67,4,2,1,5,3,2.67,10 cents,5 minutes,15 days,Female,University - Undergraduate,41,1.25,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,-1,1,0,1,0,0,0,0,0,1,0,1,0,0,2,0,3,1,0,0.2,0.4,1.2,0.45,C_Ug +583,R_3cjduHlfZVXi9FU,39 - 45,Canadian,Male,2,2,1,2,3,-1,-2,3,-2,3,3,-1,3,0,2,0,1,1,1,-1,-1,2,3,-1,0,8,-1,0,1,1,1,8,3,0,2,1,2,8,0,1,1,0,1,7,2,3,1,2,3,7,-2,-3,3,-3,3,6,3,-1,3,-2,3,8,0,0,1,1,-1,6,TRUE,0,99,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,86,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,88,FALSE,0,98,FALSE,1,79,FALSE,1,75,FALSE,0,87,FALSE,1,100,TRUE,1,87,TRUE,1,100,FALSE,1,50,FALSE,1,73,TRUE,0,65,FALSE,1,76,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,88,FALSE,1,74,TRUE,0,89,FALSE,0,50,TRUE,1,100,TRUE,1,100,0,0.25,0,0,0,0.0016,0,0.9604,0.0576,0,0.25,0.7569,0.0144,0.0441,0.0196,0,0,0.25,0.0676,0,0,0.0169,0.4225,0,0.25,0.7744,0,0.9801,1,0.0729,0.7921,0.0625,0.242628571,0.168185714,0.317071429,23,71.88,22,68.75,5,62.5,6,75,5,62.5,6,75,12,75,10,62.5,86.25,82.12,88.5,90,84.38,90.38,82.12,3.13,17.5,19.62,13.5,27.5,9.38,15.38,19.62,3,0,2,3,3,0,2,2,3,2,0,1,1,1,0,0,0,0,1,2,0,1,0,0,0,1,1,0,1,0,0,0,0,2,1,0,1,0,0,0,2.2,1.8,0.6,0.6,0.2,0.6,0.6,0.2,1.3,0.4,8,7,1,2,0,1,1,5 cents,100 minutes,47 days,Male,University - Undergraduate,40,1.5,1,0,1,0,1,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,3,-1,2,3,3,-1,1,2,2,2,0,1,1,-1,-1,0,-1,0,1,2,2,1.2,0,0.4,0.9,C_Ug +584,R_37Hk3LKZJ0Cghx7,39 - 45,American,Male,3,3,2,0,1,-1,-3,3,-3,2,0,-1,3,-2,3,-2,1,0,1,0,3,3,1,0,0,3,-3,-3,0,3,-2,6,0,0,2,-1,3,4,-2,-2,-3,-3,-2,8,3,3,1,0,3,3,1,-3,3,-3,3,0,-2,-2,3,-3,3,0,3,1,3,2,3,1,TRUE,0,97,TRUE,1,100,TRUE,0,99,FALSE,1,50,TRUE,1,83,FALSE,1,82,FALSE,0,50,TRUE,1,100,TRUE,1,89,TRUE,1,100,TRUE,0,52,TRUE,0,50,TRUE,1,92,FALSE,1,94,FALSE,0,50,TRUE,1,96,FALSE,1,50,TRUE,0,97,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,65,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,50,FALSE,1,50,TRUE,0,57,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.0576,0.0016,0.25,0,0.0324,0,0,0.25,0.1225,0,0.0064,0.0121,0.2704,0.0289,0,0,0.25,0.25,0,0.25,0.25,0.25,0.0036,0.25,0.25,0.25,0.9409,0.9801,0.9409,0.3249,0.25,0.220110714,0.069478571,0.370742857,20,62.5,21,65.63,4,50,7,87.5,5,62.5,5,62.5,13,81.25,8,50,75.91,61.38,76.75,84.88,80.62,81.31,70.5,-3.13,10.28,11.38,-10.75,22.38,18.12,0.06,20.5,0,0,1,0,1,2,0,3,6,4,0,1,1,1,0,0,3,3,4,2,0,0,1,0,2,2,0,0,0,1,2,1,0,1,0,5,0,3,1,3,0.4,3,0.6,2.4,0.6,0.6,0.8,2.4,1.6,1.1,4.33,1,0,6,4,7,3.33,5 cents,100 minutes,24 days,Male,University - Undergraduate,42,1,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,-1,0,0,3,6,3,-2,0,1,0,0,-5,3,0,3,-1,-0.2,2.4,-0.2,0,0.5,C_Ug +585,R_5O8gYBMH1PFssNw,46 - 52,Canadian,Female,3,2,3,3,-1,-3,-2,3,-3,0,0,-3,3,-2,3,3,3,3,3,2,3,2,3,1,1,3,-3,-3,3,-3,1,3,0,-3,2,-2,3,1,0,0,1,1,1,7,2,2,3,2,0,2,-3,-3,2,-2,0,1,0,-3,2,-2,3,1,0,0,0,2,2,0,FALSE,1,95,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,92,FALSE,1,51,TRUE,0,100,TRUE,1,61,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,56,FALSE,1,60,TRUE,0,90,TRUE,0,57,FALSE,0,85,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,1,88,TRUE,0,75,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.0144,0,0,0,0,0,0.0064,0.3249,0.0049,0,0.1521,0.0841,0.2401,0,0,0,0.25,0.25,0.8836,0.7225,0.25,0.81,1,0.1936,0.5625,0.25,0.0025,1,0.16,1,1,0.326685714,0.075892857,0.577478571,27,84.38,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,83.38,67.12,87.75,90.25,88.38,86.88,79.88,15.63,14.63,4.62,12.75,15.25,25.88,-0.62,29.88,0,0,0,2,2,0,1,0,0,1,0,0,1,0,0,3,3,2,2,1,1,0,0,1,1,0,1,1,1,0,0,0,1,0,0,3,3,3,1,0,0.8,0.4,0.2,2.2,0.6,0.6,0.2,2,0.9,0.85,2.33,1.33,1,2,0,7,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,1.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,0,0,1,1,0,0,-1,-1,1,0,0,0,0,0,0,0,-1,1,1,0.2,-0.2,0,0.2,0.05,C_Ug +586,R_6P5D4RUzUfkrJ9g,25 - 31,Canadian,Female,2,2,3,1,2,-2,-2,1,-2,1,3,2,3,-2,3,-1,-1,1,1,-1,3,3,3,1,3,6,-2,-3,3,-3,1,7,3,1,2,-3,3,7,1,1,1,-1,1,6,2,3,3,1,3,6,0,-3,3,-3,1,7,3,2,3,-3,3,6,1,1,1,1,-1,6,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0.107142857,0.071428571,0.142857143,32,100,29,90.63,8,100,6,75,8,100,7,87.5,15,93.75,14,87.5,100,100,100,100,100,100,100,9.37,9.37,0,25,0,12.5,6.25,12.5,1,1,0,0,1,0,1,2,1,0,0,1,1,1,0,2,2,0,2,2,0,1,0,0,1,2,1,2,1,0,0,0,0,1,0,2,2,0,0,0,0.6,0.8,0.6,1.6,0.4,1.2,0.2,0.8,0.9,0.65,6.67,6.33,0,0,1,0,0.34,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,1,0,0,0,0,-2,0,0,0,0,0,1,1,0,0,0,0,0,2,2,0.2,-0.4,0.4,0.8,0.25,HS_TS +587,R_1wQsp7UmZK6dseF,39 - 45,Canadian,Female,2,3,2,1,2,-2,-2,3,3,1,1,3,3,2,0,-3,-1,-2,-3,-3,2,3,2,1,2,2,-2,-2,3,3,1,2,1,3,3,2,0,2,-3,-1,-3,-3,-3,2,2,3,2,1,2,2,-2,-2,3,3,1,2,1,3,3,2,0,1,-1,0,0,0,-2,6,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,79,TRUE,1,71,FALSE,1,100,FALSE,0,51,TRUE,1,100,TRUE,1,53,FALSE,0,69,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,76,TRUE,0,100,FALSE,1,59,FALSE,1,56,FALSE,0,100,FALSE,0,60,TRUE,0,59,TRUE,1,100,FALSE,1,55,TRUE,1,63,TRUE,0,56,FALSE,1,82,TRUE,0,100,TRUE,1,87,TRUE,1,69,TRUE,1,100,0,0.1369,0,0.2601,0,0,0,0.4761,0.1936,0.36,0.0169,0,0.2209,0,0.0841,1,0.3481,0.6241,0.0324,0.2025,1,0.04,0.1681,0,0.5776,0.3136,0.0961,0,1,1,1,1,0.348360714,0.237414286,0.459307143,16,50,19,59.38,5,62.5,4,50,4,50,6,75,11,68.75,8,50,82.03,74.5,88.25,74.75,90.62,81.44,82.62,-9.38,22.65,12,38.25,24.75,15.62,12.69,32.62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,3,1,0,0,0,0.2,0,0,0,1.8,0.05,0.45,2,1.67,0,0,1,-4,0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,44,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,-1,-3,-1,0,0,0,-1.6,-0.4,C_Ug +588,R_5fYQJRqkZWFGWR4,18 - 24,Canadian,Female,1,2,0,2,2,1,1,1,1,-2,1,1,2,0,1,1,2,1,1,1,2,-2,0,3,3,6,-1,0,1,1,-1,9,1,-1,1,1,0,7,3,3,3,-3,3,6,2,3,0,3,-2,6,1,1,1,0,1,6,0,1,0,1,-1,6,2,2,3,3,3,7,FALSE,1,68,TRUE,1,60,TRUE,0,100,FALSE,1,63,TRUE,1,81,FALSE,1,67,TRUE,1,65,FALSE,0,100,TRUE,1,65,TRUE,1,81,TRUE,0,72,TRUE,0,100,FALSE,0,73,FALSE,1,100,TRUE,1,65,TRUE,1,97,TRUE,0,100,TRUE,0,84,TRUE,0,86,FALSE,1,92,TRUE,1,93,TRUE,1,100,TRUE,0,92,TRUE,1,100,TRUE,0,72,TRUE,1,100,TRUE,0,85,FALSE,1,89,TRUE,0,93,FALSE,0,86,TRUE,1,86,FALSE,0,93,1,0,0.0009,0.1225,0.8649,0.1089,0,0.0361,0.0064,0,0.7396,0.5329,0.1225,0.5184,0.0361,0.16,0.8464,0.1369,0.0121,0.5184,0.0049,0.1225,0.7396,0,1,0.7225,0.0196,0.1024,1,0.7056,0.8649,1,0.390057143,0.293507143,0.486607143,32,100,18,56.25,5,62.5,3,37.5,6,75,4,50,12,75,6,37.5,84.62,72.75,86.5,83.75,95.5,84.06,85.19,43.75,28.37,10.25,49,8.75,45.5,9.06,47.69,1,4,0,1,1,2,1,0,0,1,0,2,1,1,1,2,1,2,4,2,1,1,0,1,4,0,0,0,1,3,1,0,2,1,2,1,0,2,2,2,1.4,0.8,1,2.2,1.4,0.8,1.2,1.4,1.35,1.2,7.33,6,0,3,1,-1,1.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),20,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,3,0,0,-3,2,1,0,-1,-2,-1,2,-1,0,-1,1,1,0,2,0,0,0,-0.2,0.8,0.15,HS_TS +589,R_1H2iF1BXiFFOtRi,32 - 38,Canadian,Male,2,3,2,-2,3,2,-2,-2,-2,2,2,2,2,1,3,-1,-2,1,-1,-2,2,3,2,-2,3,3,2,-2,2,-2,2,4,2,2,2,1,3,3,-2,-3,-2,-2,-2,7,2,3,2,-2,3,7,2,-2,-2,-2,2,7,2,2,2,1,3,7,2,2,2,2,-2,7,FALSE,1,99,TRUE,1,98,FALSE,1,96,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,97,TRUE,1,100,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,0,97,FALSE,1,98,TRUE,1,97,TRUE,1,100,FALSE,1,97,TRUE,0,100,FALSE,1,94,FALSE,1,96,TRUE,1,92,TRUE,1,91,FALSE,1,93,TRUE,1,92,FALSE,1,91,TRUE,1,92,FALSE,1,91,FALSE,1,89,FALSE,1,92,FALSE,0,87,TRUE,1,89,TRUE,1,73,0.0009,0.0064,0,0.0025,0.0729,0,0.0064,0,0.0016,0.0081,0.7569,0.9409,0,0.0016,0,0.0004,0.0049,0.9604,0.0121,0.0081,0.0064,0.0009,0.0036,0.0004,0.0009,0.0081,0.0121,0.0001,0.0016,1,0.0064,1,0.171957143,0.196721429,0.147192857,26,81.25,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,94.69,95.38,93,95.75,94.62,93.75,95.62,-3.13,10.31,7.88,5.5,8.25,19.62,6.25,14.37,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,1,3,0,0,0.8,0,1.2,0,0,0,2.2,0.5,0.55,3.33,7,-4,-3,-4,0,-3.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),33,0.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,-2,-3,2,-2,0,0,0.8,0,-1,-0.05,HS_TS +590,R_1VyXet4YO7WSVtn,32 - 38,Canadian,Female,-2,3,2,-2,0,0,0,0,0,-1,0,0,2,-2,3,-1,0,0,-1,-2,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,4,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,76,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,94,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,68,0.25,0,0.25,0.25,0.1024,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.8836,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.314771429,0.245,0.384542857,4,12.5,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,8,50,10,62.5,60.56,50,55.5,75,61.75,57.38,63.75,-43.75,4.31,-12.5,-7,12.5,24.25,7.38,1.25,2,3,2,2,0,0,0,0,0,1,0,0,2,2,3,1,0,0,1,2,2,3,2,2,0,0,0,0,0,1,0,0,2,2,3,1,0,0,1,2,1.8,0.2,1.4,0.8,1.8,0.2,1.4,0.8,1.05,1.05,4.67,5,0,0,-1,0,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),38,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +591,R_5I5irZ0eBE0gODo,46 - 52,American,Male,2,-3,3,2,-2,-3,-2,2,1,1,2,3,2,-2,2,-3,-3,-3,1,-3,2,-2,2,2,-2,0,-3,2,1,3,2,0,2,3,3,-3,2,0,-3,-3,-3,1,-3,6,2,-3,3,2,-2,0,-3,0,2,2,2,1,2,2,2,-3,2,10,-3,-3,-3,2,-3,0,TRUE,0,100,TRUE,1,52,TRUE,0,100,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,FALSE,0,100,FALSE,1,87,FALSE,1,70,TRUE,1,94,FALSE,1,59,TRUE,1,100,TRUE,1,100,TRUE,0,98,TRUE,0,100,FALSE,1,53,FALSE,1,74,TRUE,1,98,TRUE,1,70,FALSE,1,59,TRUE,1,81,TRUE,0,84,TRUE,1,85,FALSE,1,55,FALSE,1,57,TRUE,0,88,TRUE,1,79,TRUE,1,100,TRUE,1,100,0,0.0225,0,0,0,0,0.0361,1,0.0676,0.09,0.0441,0.0036,0.0841,0.0169,0.0361,0.2304,0.1681,0.25,0.1849,0.7056,0.0004,0,0.2209,0.1681,0.9604,0.2025,0,1,1,1,0.7744,0.09,0.29765,0.144785714,0.450514286,17,53.13,25,78.13,8,100,6,75,4,50,7,87.5,15,93.75,10,62.5,82.66,71,89.75,87.25,82.62,88.19,77.12,-25,4.53,-29,14.75,37.25,-4.88,-5.56,14.62,0,1,1,0,0,0,4,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,1,0,1,0,1,0,0,0,0,1,0,0.4,1.6,0.4,0,0,0.8,0.4,0.2,0.6,0.35,0,3.67,0,-1,-10,6,-3.67,10 cents,75 minutes,24 days,Male,High School (or equivalent),48,0.25,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,1,1,0,0,0,2,1,1,0,0,-1,1,0,0,0,0,0,-1,0,0.4,0.8,0,-0.2,0.25,HS_TS +592,R_6qy0KJnYzppG2b4,46 - 52,Canadian,Male,0,0,3,0,0,-3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,FALSE,1,100,FALSE,1,79,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,1,100,FALSE,1,83,TRUE,1,50,TRUE,0,50,FALSE,1,84,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.25,0.25,0,0,0,0.25,0,0,0.0441,0,0,0,0.25,0.25,0.25,0.25,0.8281,0.25,0.0256,0.0289,0,0,0,1,0.25,0.25,0.25,1,0.25,0.25,0.25,1,0.247382143,0.169442857,0.325321429,16,50,20,62.5,5,62.5,4,50,5,62.5,6,75,16,100,4,25,76.16,62.5,73.88,85.38,82.88,81.25,71.06,-12.5,13.66,0,23.88,22.88,7.88,-18.75,46.06,0,0,3,0,0,3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0.6,1,0.2,0,0.6,1,0.2,0,0.45,0.45,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,51,0,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +593,R_7tCl8IW1fbG8MeJ,39 - 45,Canadian,Male,0,1,2,1,1,-1,-1,1,-2,1,1,-2,2,1,3,-3,-3,-3,-2,-3,0,2,2,1,2,4,-2,1,2,0,0,5,3,0,2,0,2,4,-1,1,2,0,-2,8,0,2,2,2,2,2,0,0,0,0,0,6,2,2,2,0,0,5,0,0,0,0,-3,5,TRUE,0,72,FALSE,0,56,FALSE,1,59,FALSE,1,57,TRUE,1,87,FALSE,1,59,TRUE,1,70,TRUE,1,100,TRUE,1,62,TRUE,1,100,FALSE,1,57,TRUE,0,58,TRUE,1,86,TRUE,0,68,TRUE,1,95,TRUE,1,100,TRUE,0,68,TRUE,0,96,TRUE,0,83,TRUE,0,100,TRUE,1,65,FALSE,0,54,FALSE,1,62,FALSE,0,54,TRUE,0,65,TRUE,1,65,FALSE,1,53,TRUE,0,59,FALSE,1,53,TRUE,1,64,FALSE,0,50,TRUE,1,100,0,0.1225,0,0.09,0,0.1681,0.2916,0,1,0.2916,0.1296,0.0196,0.1444,0.1849,0.0169,0.3136,0.1444,0.1849,0.3481,0.4225,0.1225,0.0025,0.6889,0.4624,0.4624,0.2209,0.25,0.5184,0.1681,0.9216,0.2209,0.3364,0.286971429,0.2064,0.367542857,19,59.38,19,59.38,5,62.5,7,87.5,3,37.5,4,50,12,75,7,43.75,71.16,64.12,72.5,73.75,74.25,75.5,66.81,0,11.78,1.62,-15,36.25,24.25,0.5,23.06,0,1,0,0,1,1,2,1,2,1,2,2,0,1,1,2,4,5,2,1,0,1,0,1,1,1,1,1,2,1,1,4,0,1,3,3,3,3,2,0,0.4,1.4,1.2,2.8,0.6,1.2,1.8,2.2,1.45,1.45,4.33,4.33,2,-1,-1,3,0,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),43,1.5,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,-1,0,0,1,0,0,0,1,-2,0,0,-2,-1,1,2,0,1,-0.2,0.2,-0.6,0.6,0,grad_prof +594,R_3vaz9NIWdwJZZHb,39 - 45,Canadian,Male,0,2,1,0,1,-2,1,0,-2,0,1,0,1,0,1,-2,0,0,-1,-3,1,2,1,0,1,6,-2,1,0,-2,0,3,1,0,1,0,1,6,-2,0,-1,-2,-3,3,1,2,1,0,1,3,0,1,0,-2,0,5,1,0,1,0,1,5,2,2,2,2,-2,8,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,85,TRUE,1,91,TRUE,1,80,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,90,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,100,FALSE,1,80,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0225,0.25,0.01,0.25,0,0.25,0.04,0.04,0.25,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.04,0.25,0.183146429,0.167007143,0.199285714,11,34.38,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,6,37.5,16,100,62.69,55.12,66.25,60,69.38,64.12,61.25,-34.37,-6.06,-7.38,3.75,-2.5,-18.12,26.62,-38.75,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,4,2,2,3,1,0.2,0,0,0.4,0.2,0.4,0,2.4,0.15,0.75,5,4.33,3,-2,1,-5,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,-4,-2,-1,-2,-1,0,-0.4,0,-2,-0.6,HS_TS +595,R_1R1uDnYCf5JJcuL,46 - 52,Canadian,Male,2,3,2,3,3,-2,-3,3,-3,3,-1,2,3,2,3,-1,-1,-1,-2,-1,1,3,3,3,3,1,1,2,1,3,-2,8,3,3,-2,3,3,8,-3,1,-1,-3,1,8,2,3,-1,3,3,3,-3,-3,3,-3,2,3,3,3,3,3,3,5,2,1,3,2,-1,8,FALSE,1,100,FALSE,0,95,FALSE,1,93,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,95,FALSE,0,100,FALSE,1,99,FALSE,0,94,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0.01,1,0,0.0001,0,0,1,0,0,1,1,1,0,0,0,0.9025,0,0.64,0,0,1,0.8836,0,0.0001,0,0,1,0,0.0049,0,0,0.0025,0.3012,0.395892857,0.206507143,25,78.13,22,68.75,4,50,6,75,6,75,6,75,7,43.75,15,93.75,98.28,96.12,100,99.75,97.25,98.62,97.94,9.38,29.53,46.12,25,24.75,22.25,54.87,4.19,1,0,1,0,0,3,5,2,6,5,4,1,5,1,0,2,2,0,1,2,0,0,3,0,0,1,0,0,0,1,4,1,0,1,0,3,2,4,4,0,0.4,4.2,2.2,1.4,0.6,0.4,1.2,2.6,2.05,1.2,5.67,3.67,-2,5,3,0,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,47,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,0,-2,0,0,2,5,2,6,4,0,0,5,0,0,-1,0,-4,-3,2,-0.2,3.8,1,-1.2,0.85,C_Ug +596,R_5jVXDLirMWeFO7r,32 - 38,Canadian,Male,2,3,2,2,3,1,3,3,2,3,3,2,2,2,3,3,2,3,3,-1,3,3,2,0,2,9,1,3,2,-1,2,8,3,3,2,2,0,9,1,3,2,2,0,9,2,2,3,1,2,9,2,2,2,-1,1,8,2,3,2,2,3,8,2,3,2,3,3,8,TRUE,0,73,TRUE,1,89,FALSE,1,73,FALSE,1,91,TRUE,1,90,TRUE,0,94,FALSE,0,90,TRUE,1,87,TRUE,1,85,FALSE,0,89,TRUE,0,87,TRUE,0,78,TRUE,1,100,TRUE,0,74,TRUE,1,71,TRUE,1,76,TRUE,0,88,TRUE,0,79,FALSE,1,91,TRUE,0,79,FALSE,0,82,TRUE,1,95,FALSE,1,83,TRUE,1,84,FALSE,1,50,TRUE,1,79,TRUE,0,71,TRUE,0,68,TRUE,0,85,TRUE,1,58,FALSE,0,66,FALSE,0,79,0.0169,0.0441,0.0576,0.81,0.6241,0.8836,0.0256,0.7921,0.6241,0.0025,0.1764,0,0.0225,0.7569,0.01,0.0121,0.0289,0.0081,0.4624,0.25,0.6724,0.0841,0.0081,0.5476,0.7744,0.5041,0.4356,0.5329,0.0729,0.6241,0.7225,0.6084,0.366657143,0.28335,0.449964286,11,34.38,16,50,5,62.5,3,37.5,3,37.5,5,62.5,11,68.75,5,31.25,80.75,81.38,87.62,78.62,75.38,82.5,79,-15.62,30.75,18.88,50.12,41.12,12.88,13.75,47.75,1,0,0,2,1,0,0,1,3,1,0,1,0,0,3,2,1,1,1,1,0,1,1,1,1,1,1,1,3,2,1,1,0,0,0,1,1,1,0,4,0.8,1,0.8,1.2,0.8,1.6,0.4,1.4,0.95,1.05,8.67,8.33,0,0,1,1,0.34,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),37,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,-1,-1,1,0,-1,-1,0,0,-1,-1,0,0,0,3,1,0,0,1,-3,0,-0.6,0.4,-0.2,-0.1,grad_prof +597,R_5d2frsq8ebtA2fn,53 - 59,American,Male,2,2,2,2,-2,-2,-2,2,-2,2,-2,-2,2,-2,2,-2,-2,-2,-2,-2,2,2,2,2,-2,0,-2,-2,2,-2,2,0,-2,-2,2,-2,2,0,-2,-2,-2,-2,-2,1,2,2,2,2,-2,1,-2,-2,2,-2,2,1,-2,-2,2,-2,2,1,-2,-2,-2,-2,-2,1,FALSE,1,94,TRUE,1,100,FALSE,1,98,FALSE,1,79,TRUE,1,100,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,0,95,FALSE,0,100,FALSE,1,84,FALSE,1,100,FALSE,0,86,FALSE,1,100,FALSE,0,74,FALSE,0,90,TRUE,0,77,TRUE,0,100,FALSE,1,77,FALSE,1,100,FALSE,0,83,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,63,TRUE,0,93,TRUE,1,98,TRUE,1,72,TRUE,1,100,0,0.0009,0.81,0.0196,0,0,0,1,0,0.0001,0.0004,0.7396,0.9025,0.0256,0,0,0,0.0441,0.1369,0,0.6889,0.5476,0.0529,0,0.5929,0,0.0784,0.0036,0.0004,1,0.8649,0,0.238528571,0.193735714,0.283321429,24,75,23,71.88,6,75,4,50,6,75,7,87.5,10,62.5,13,81.25,92.03,85.12,92.38,97,93.62,92.5,91.56,3.12,20.15,10.12,42.38,22,6.12,30,10.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,-1,-1,0,-1,20 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,1.125,0,0,0,0,1,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +598,R_7oA5PsZawq3t9en,25 - 31,Canadian,Female,2,2,1,-1,0,0,-2,2,0,2,1,-2,3,-1,2,-2,-2,-2,-2,-3,3,3,3,-2,-2,3,-3,-2,-1,1,-2,6,-1,-2,1,-1,1,5,-3,-3,-3,-3,-3,8,2,2,2,1,0,3,0,-2,3,-1,2,2,2,-2,3,-1,3,1,-2,-1,0,0,-1,8,TRUE,0,81,FALSE,0,50,TRUE,0,94,FALSE,1,50,TRUE,1,71,FALSE,1,85,TRUE,1,55,TRUE,1,86,TRUE,1,75,TRUE,1,90,FALSE,1,50,TRUE,0,83,TRUE,1,53,FALSE,1,52,FALSE,0,52,FALSE,0,53,FALSE,1,53,TRUE,0,72,FALSE,1,51,FALSE,1,52,FALSE,0,94,FALSE,0,51,FALSE,1,50,TRUE,1,92,FALSE,1,51,TRUE,1,95,FALSE,1,51,FALSE,1,52,TRUE,0,95,FALSE,0,52,FALSE,0,70,TRUE,1,98,0.0196,0.0025,0.2809,0.2025,0.0004,0.0225,0.0064,0.01,0.2304,0.2601,0.2704,0.2209,0.0625,0.25,0.0841,0.25,0.25,0.25,0.2304,0.2401,0.8836,0.2704,0.2401,0.2304,0.2209,0.2401,0.49,0.6561,0.8836,0.5184,0.9025,0.6889,0.316542857,0.154835714,0.47825,20,62.5,20,62.5,5,62.5,6,75,5,62.5,4,50,9,56.25,11,68.75,67.47,56.12,74.88,68.38,70.5,71.06,63.88,0,4.97,-6.38,-0.12,5.88,20.5,14.81,-4.87,1,1,2,1,2,3,0,3,1,4,2,0,2,0,1,1,1,1,1,0,0,0,1,2,0,0,0,1,1,0,1,0,0,0,1,0,1,2,2,2,1.4,2.2,1,0.8,0.6,0.4,0.4,1.4,1.35,0.7,4.67,2,0,4,4,0,2.67,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,30,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,1,1,-1,2,3,0,2,0,4,1,0,2,0,0,1,0,-1,-1,-2,0.8,1.8,0.6,-0.6,0.65,C_Ug +599,R_7B3gNZyQnJYWSeO,39 - 45,Canadian,Male,0,0,2,-2,1,0,0,1,0,2,1,0,1,1,0,-3,-2,-2,-2,-1,-1,-1,2,-1,2,5,1,0,0,0,1,5,1,1,1,1,1,5,-1,0,0,0,0,5,0,0,2,0,2,5,0,0,0,0,0,5,1,0,1,0,0,5,0,0,0,0,0,8,FALSE,1,82,TRUE,1,90,FALSE,1,78,FALSE,1,50,TRUE,1,74,FALSE,1,57,TRUE,1,87,TRUE,1,93,TRUE,1,59,TRUE,1,70,FALSE,1,50,TRUE,0,77,TRUE,1,81,FALSE,1,83,FALSE,0,50,TRUE,1,87,FALSE,1,54,TRUE,0,88,FALSE,1,50,FALSE,1,87,FALSE,0,83,FALSE,0,50,TRUE,0,66,FALSE,0,50,FALSE,1,90,TRUE,1,78,FALSE,1,55,TRUE,0,65,TRUE,0,94,TRUE,1,96,FALSE,0,56,TRUE,1,100,0.0049,0.0484,0.0169,0.0169,0,0.1849,0.25,0.09,0.0169,0.25,0.0016,0.0361,0.1681,0.25,0.0676,0.01,0.4356,0.25,0.4225,0.01,0.6889,0.25,0.25,0.0289,0.2116,0.2025,0.3136,0.0324,0.0484,0.7744,0.8836,0.5929,0.240017857,0.143628571,0.336407143,25,78.13,22,68.75,6,75,5,62.5,6,75,5,62.5,11,68.75,11,68.75,72.81,57.5,76.12,78.5,79.12,75.25,70.38,9.38,4.06,-17.5,13.62,3.5,16.62,6.5,1.63,1,1,0,1,1,1,0,1,0,1,0,1,0,0,1,2,2,2,2,1,0,0,0,2,1,0,0,1,0,2,0,0,0,1,0,3,2,2,2,1,0.8,0.6,0.4,1.8,0.6,0.6,0.2,2,0.9,0.85,5,5,0,0,0,-3,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,41,0.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,02REV,1,1,0,-1,0,1,0,0,0,-1,0,1,0,-1,1,-1,0,0,0,0,0.2,0,0.2,-0.2,0.05,C_Ug +600,R_6tldWtJsPKe7ccx,32 - 38,American,Female,3,3,3,2,3,3,-1,3,3,3,2,0,3,3,3,2,-1,-2,3,3,3,3,3,2,3,10,1,0,1,2,3,10,0,3,3,-1,3,5,3,2,3,0,3,10,3,3,3,1,3,10,0,-1,2,2,2,3,1,3,3,3,3,10,3,3,3,3,-3,10,TRUE,0,100,TRUE,1,98,TRUE,0,87,TRUE,0,79,TRUE,1,81,TRUE,0,69,TRUE,1,74,TRUE,1,75,TRUE,1,83,TRUE,1,65,TRUE,0,76,TRUE,0,100,FALSE,0,99,TRUE,0,70,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,94,TRUE,1,99,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,88,TRUE,0,100,TRUE,1,99,FALSE,0,99,TRUE,1,100,0.0625,0,0,0.0676,0,0.4761,0.0001,0.1225,0,0,0.0001,0.9801,0.0289,0.5776,0.0361,0.0004,0.8836,0.6241,0.7744,1,1,0.0625,0,0.49,0,0,0.9801,1,0.7569,0,1,1,0.421196429,0.2664,0.575992857,16,50,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,13,81.25,5,31.25,90.94,88.75,92.88,88.62,93.5,90.44,91.44,-6.25,34.69,26.25,55.38,26.12,31,9.19,60.19,0,0,0,0,0,2,1,2,1,0,2,3,0,4,0,1,3,5,3,0,0,0,0,1,0,3,0,1,1,1,1,3,0,0,0,1,4,5,0,6,0,1.2,1.8,2.4,0.2,1.2,0.8,3.2,1.35,1.35,8.33,7.67,0,7,-5,0,0.66,10 cents,25 minutes,36 days,Female,College Diploma/Certificate,38,0.125,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,0,-1,1,1,0,-1,1,0,0,4,0,0,-1,0,3,-6,-0.2,0,1,-0.8,0,C_Ug +601,R_1Kf4u6wyxvfsiK5,32 - 38,Canadian,Female,0,1,1,3,3,0,-2,2,1,1,2,2,2,2,2,1,1,2,1,2,0,1,1,1,1,7,0,0,0,0,0,5,3,2,2,2,2,7,2,2,2,2,2,7,0,0,2,3,3,7,0,-3,2,0,1,7,2,2,2,-1,2,8,3,3,3,3,3,8,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,70,TRUE,0,70,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,75,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,0,80,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0225,0.25,0.09,0,0,0,0.25,0.25,0.25,0.5625,0.25,0.09,0.25,0.25,0.25,0.25,0.25,0.25,0.64,1,0.0625,0.25,0.25,0.49,0.25,0.25,0.25,0.25,0,0,0.25,0,0.253392857,0.225178571,0.281607143,16,50,19,59.38,4,50,7,87.5,3,37.5,5,62.5,6,37.5,13,81.25,66.41,50,68.12,74.38,73.12,64.06,68.75,-9.38,7.03,0,-19.38,36.88,10.62,26.56,-12.5,0,0,0,2,2,0,2,2,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,3,0,2,2,1,2,1,0.8,1.2,0.2,0.6,0.4,0.4,0.6,1.6,0.7,0.75,6.33,7.33,0,-2,-1,-1,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,37,0,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,-1,-1,2,2,0,1,2,0,1,1,0,0,-3,0,-1,-1,-1,-1,-1,0.4,0.8,-0.4,-1,-0.05,C_Ug +602,R_3dgnEiy0SXxuaGA,25 - 31,Canadian,Male,2,2,-1,2,3,2,-3,2,-3,3,-2,-3,2,-2,3,2,3,2,2,2,2,2,-1,1,3,0,2,-3,2,-3,3,0,-2,-3,2,-2,3,0,2,1,2,2,1,1,1,2,-2,1,3,0,2,-3,2,-3,3,1,-2,-3,2,2,3,0,2,1,2,2,2,0,FALSE,1,95,TRUE,1,90,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,0,50,FALSE,0,100,TRUE,1,50,TRUE,1,50,0,0.25,0,0,0.25,0.25,0.25,0,0,0,1,0,0,0,0,0.01,0,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,1,0.25,0.0025,0.25,0.25,0.25,1,0.232589286,0.143571429,0.321607143,20,62.5,24,75,6,75,6,75,7,87.5,5,62.5,12,75,12,75,76.09,73.75,68.75,80.62,81.25,80.62,71.56,-12.5,1.09,-1.25,-6.25,-6.88,18.75,5.62,-3.44,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,4,0,0,2,0,0,0,0.2,0,0,0.6,0.6,0,0.8,0.4,0.2,0.45,0,0.33,0,-1,0,1,-0.33,10 cents,5 minutes,24 days,Male,University - Undergraduate,30,1.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,-1,0,-1,0,0,0,0,0,0,0,0,0,0,-4,0,0,0,0,0,1,-0.4,0,-0.8,0.2,-0.25,C_Ug +603,R_1NayeAJIS2Angtt,25 - 31,American,Male,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,0,3,6,3,3,3,3,3,7,3,3,3,3,3,7,3,3,3,3,3,6,3,3,3,3,3,6,3,3,3,3,3,8,3,3,3,3,3,7,TRUE,0,75,TRUE,1,80,TRUE,0,77,TRUE,0,75,TRUE,1,76,TRUE,0,75,TRUE,1,79,TRUE,1,74,TRUE,1,72,TRUE,1,66,TRUE,0,81,TRUE,0,88,TRUE,1,78,TRUE,0,70,TRUE,1,78,TRUE,1,82,TRUE,0,88,TRUE,0,78,TRUE,0,88,TRUE,0,91,TRUE,1,78,TRUE,1,85,TRUE,0,79,TRUE,1,80,TRUE,0,85,TRUE,1,79,TRUE,0,89,TRUE,0,79,TRUE,0,71,TRUE,1,72,TRUE,1,77,TRUE,1,85,0.0676,0.0441,0.0324,0.0441,0.0225,0.5625,0.04,0.1156,0.8281,0.0225,0.0784,0.0484,0.0784,0.6561,0.0576,0.04,0.6241,0.5625,0.6241,0.7225,0.0484,0.0484,0.7744,0.49,0.7744,0.7921,0.0529,0.5625,0.5929,0.6084,0.5041,0.7744,0.39665,0.266907143,0.526392857,27,84.38,16,50,4,50,4,50,4,50,4,50,16,100,0,0,79.06,80,78.75,77.12,80.38,77.56,80.56,34.38,29.06,30,28.75,27.12,30.38,-22.44,80.56,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0,0,0,0,0.3,0,5,6.67,-4,0,-1,0,-1.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,30,0,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0.3,C_Ug +604,R_5cAaW06IpPj9KAZ,46 - 52,Canadian,Female,2,3,2,-2,3,0,2,1,0,3,0,0,3,0,3,-2,-1,0,-1,-2,2,3,2,-2,3,2,0,0,1,-1,3,2,0,0,3,0,3,2,1,1,1,0,-2,9,2,3,2,0,3,2,0,0,0,0,2,1,0,3,3,0,3,1,0,0,0,0,0,3,FALSE,1,50,TRUE,1,59,FALSE,1,75,TRUE,0,50,TRUE,1,50,FALSE,1,97,TRUE,1,75,TRUE,1,81,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,97,TRUE,1,97,TRUE,0,50,TRUE,1,50,TRUE,1,90,TRUE,0,50,FALSE,1,86,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,50,TRUE,1,70,FALSE,1,50,TRUE,1,99,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,FALSE,0,50,TRUE,1,91,0.0361,0.0001,0.01,0.0625,0.0081,0.0009,0.09,0.25,0.25,0.0225,0.09,0.0009,0.25,0.25,0.25,0.1681,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.0196,0.25,0.0009,0.177267857,0.152178571,0.202357143,26,81.25,23,71.88,4,50,5,62.5,6,75,8,100,13,81.25,10,62.5,64.75,51.12,66.88,68.12,72.88,69.81,59.69,9.37,-7.13,1.12,4.38,-6.88,-27.12,-11.44,-2.81,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,3,2,1,1,0,0,0,0,2,0,0,2,1,0,1,0,3,0,0,0,2,1,0,1,2,0,0.6,0,1.4,0.4,0.8,0.6,1.2,0.5,0.75,2,1.33,0,1,1,6,0.67,5 cents,5 minutes,47 days,Female,University - Undergraduate,48,1.375,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,-2,0,0,0,-1,1,-1,0,-3,0,0,0,1,1,1,0,-2,-0.4,-0.2,-0.6,0.2,-0.25,C_Ug +605,R_5Hk8AWYo2ec0omN,53 - 59,American,Female,2,2,2,2,1,1,-3,2,-2,2,2,-3,2,-2,2,2,2,2,2,-2,2,2,1,-2,1,10,1,-3,2,-3,-1,9,2,-3,3,1,1,6,-3,-2,-3,-1,-3,10,2,2,3,2,3,3,2,-3,2,-3,3,1,2,-3,2,-3,2,2,2,1,2,2,-3,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,77,TRUE,1,84,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,88,TRUE,1,99,FALSE,1,72,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,60,TRUE,1,98,FALSE,1,54,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0.0004,0.0004,0,0,0,0.0001,0,0,0,0,0.0144,0.0784,0.0256,0,0,0.5929,0,0,0.1156,0.36,0.5776,0,0.2116,1,1,1,1,1,1,1,0.320578571,0.050814286,0.590342857,24,75,22,68.75,3,37.5,7,87.5,6,75,6,75,14,87.5,8,50,92.88,84.12,88,99.62,99.75,93.31,92.44,6.25,24.13,46.62,0.5,24.62,24.75,5.81,42.44,0,0,1,4,0,0,0,0,1,3,0,0,1,3,1,5,4,5,3,1,0,0,1,0,2,1,0,0,1,1,0,0,0,1,0,0,1,0,0,1,1,0.8,1,3.6,0.6,0.6,0.2,0.4,1.6,0.45,8.33,2,7,8,4,8,6.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,56,1,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,4,-2,-1,0,0,0,2,0,0,1,2,1,5,3,5,3,0,0.4,0.2,0.8,3.2,1.15,C_Ug +606,R_7JXftDKPzQjEhGI,39 - 45,American,Male,-3,3,3,0,-3,1,0,1,1,2,2,2,3,1,-1,2,2,0,3,2,-3,3,3,0,-3,4,3,2,2,2,2,6,1,1,1,2,1,5,2,3,1,1,1,5,-3,3,3,2,-3,7,3,0,2,2,2,7,2,3,2,1,2,8,2,2,2,3,2,5,TRUE,0,100,TRUE,1,55,TRUE,0,100,FALSE,1,50,TRUE,1,55,FALSE,1,94,FALSE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,86,FALSE,1,100,FALSE,1,95,FALSE,0,55,TRUE,0,100,FALSE,0,50,TRUE,1,50,FALSE,1,53,FALSE,1,50,TRUE,0,50,TRUE,0,56,FALSE,0,52,FALSE,0,50,FALSE,1,67,TRUE,1,62,FALSE,1,100,TRUE,1,71,FALSE,1,50,TRUE,0,53,FALSE,1,53,TRUE,1,64,TRUE,1,50,TRUE,1,100,0.25,0.0841,0.25,0.25,0,0.0036,0.1444,0.0196,0.3136,0.25,0.1296,0.3025,0.25,0,0.2025,0.2025,0.1089,0.25,0.2809,0,0.2704,0.25,0.25,1,0.2209,0.25,0.25,1,1,0.25,0.2209,0.0025,0.2651,0.155514286,0.374685714,7,21.88,20,62.5,6,75,6,75,4,50,4,50,10,62.5,10,62.5,66.28,56.88,66.12,75.88,66.25,59.38,73.19,-40.62,3.78,-18.12,-8.88,25.88,16.25,-3.12,10.69,0,0,0,0,0,2,2,1,1,0,1,1,2,1,2,0,1,1,2,1,0,0,0,2,0,2,0,1,1,0,0,1,1,0,3,0,0,2,0,0,0,1.2,1.4,1,0.4,0.8,1,0.4,0.9,0.65,5,7.33,-3,-1,-3,0,-2.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),43,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-2,0,0,2,0,0,0,1,0,1,1,-1,0,1,-1,2,1,-0.4,0.4,0.4,0.6,0.25,HS_TS +607,R_5ckmxcbDinSRtHz,46 - 52,American,Male,3,1,1,1,3,0,-3,3,-3,3,2,0,-3,-3,2,2,2,2,2,2,3,2,1,1,3,1,1,-3,3,-3,3,1,3,0,3,-3,3,1,2,2,2,1,2,1,3,3,1,1,3,1,1,-3,3,-3,3,1,3,0,3,-3,2,1,2,2,2,2,2,1,FALSE,1,58,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,1,56,FALSE,1,100,TRUE,1,100,TRUE,1,99,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,58,TRUE,1,100,FALSE,1,100,FALSE,1,82,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,99,TRUE,0,83,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0001,0,0,0,0,0,0,1,0,0,0,0,1,0,0.1936,0,0.1936,0.1849,0.0001,0,0,0.3364,1,1,0,0.2809,1,0.1764,0,0.0324,0.6889,1,0.288828571,0.183721429,0.393935714,23,71.88,23,71.88,3,37.5,7,87.5,6,75,7,87.5,12,75,11,68.75,90.66,83.5,86.88,92.5,99.75,94.56,86.75,0,18.78,46,-0.62,17.5,12.25,19.56,18,0,1,0,0,0,1,0,0,0,0,1,0,6,0,1,0,0,0,1,0,0,2,0,0,0,1,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0.2,0.2,1.6,0.2,0.4,0.2,1.4,0,0.55,0.5,1,1,0,0,0,0,0,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),50,0.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,-0.2,0,0.2,0.2,0.05,grad_prof +608,R_6nacRReK5I8yOn7,46 - 52,Canadian,Female,2,2,2,2,2,-1,-2,2,-1,1,2,-2,2,-1,2,2,2,2,2,2,2,2,2,2,2,5,-1,-2,2,-1,1,6,2,-2,2,-2,2,5,1,1,1,1,2,6,2,2,2,2,2,5,-1,-2,2,-1,0,5,2,-2,2,-1,2,6,2,2,2,2,2,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,0,1,1,1,1,1,0.464285714,0.142857143,0.785714286,30,93.75,19,59.38,5,62.5,4,50,5,62.5,5,62.5,14,87.5,5,31.25,100,100,100,100,100,100,100,34.37,40.62,37.5,50,37.5,37.5,12.5,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.8,0,0.2,0,0,0.25,0.05,5.33,5.33,0,1,-1,1,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,52,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,1,1,1,1,0,0,-0.2,0.2,0.8,0.2,C_Ug +609,R_51j4STDFM37GFno,32 - 38,American,Female,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,-3,-3,-3,-3,-3,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,75,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,76,TRUE,1,76,TRUE,1,73,TRUE,1,100,TRUE,0,73,TRUE,0,100,TRUE,1,100,FALSE,1,74,FALSE,0,78,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,75,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,78,FALSE,1,50,TRUE,0,72,FALSE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0576,0.0484,0,0.5776,0,0,0.25,0,0.25,0.25,0,0,0.0729,0.5329,0.25,0.0625,0.25,0.25,0.5184,0,0,0.6084,0.0625,0.0676,0,0.25,0.25,1,1,1,0.0625,1,0.285275,0.154878571,0.415671429,16,50,20,62.5,4,50,8,100,4,50,4,50,11,68.75,9,56.25,78.91,65.5,84.38,84.75,81,78.5,79.31,-12.5,16.41,15.5,-15.62,34.75,31,9.75,23.06,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,2.4,0,0,3,2.4,0,0,3,1.35,1.35,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +610,R_1Ez47sYA4mD0iDD,46 - 52,American,Female,3,3,-1,3,0,-3,-1,2,-2,-2,1,3,2,-2,1,3,3,3,3,3,3,3,1,3,-1,1,-3,-2,3,-2,-2,2,1,3,2,-2,1,2,3,3,3,3,3,1,3,3,-1,3,-2,1,-3,-1,2,-2,-2,1,1,3,2,-2,1,1,3,3,3,3,3,1,TRUE,0,91,TRUE,1,83,FALSE,1,100,TRUE,0,57,TRUE,1,62,FALSE,1,95,TRUE,1,85,TRUE,1,92,TRUE,1,76,TRUE,1,94,FALSE,1,75,FALSE,1,85,TRUE,1,73,TRUE,0,81,TRUE,1,85,TRUE,1,85,TRUE,0,82,FALSE,1,97,FALSE,1,87,TRUE,0,73,TRUE,1,90,TRUE,1,90,FALSE,1,76,TRUE,1,93,FALSE,1,98,TRUE,1,97,TRUE,0,59,FALSE,1,87,TRUE,0,98,FALSE,0,71,FALSE,0,95,FALSE,0,74,0.0064,0.0009,0.0225,0.0225,0.5476,0.0025,0.0049,0.0036,0.5329,0.01,0.5041,0.0729,0.0576,0.0625,0.1444,0.0289,0.0576,0.3249,0.0169,0.0004,0.01,0.0225,0.0169,0.6561,0.6724,0.3481,0.9025,0.8281,0,0.0009,0.9604,0.0225,0.243289286,0.168171429,0.318407143,14,43.75,22,68.75,5,62.5,5,62.5,6,75,6,75,13,81.25,9,56.25,83.94,77.12,81.25,91.62,85.75,84.06,83.81,-25,15.19,14.62,18.75,16.62,10.75,2.81,27.56,0,0,2,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0.4,0,0,0.4,0,0,0,0.25,0.1,1.67,1,0,1,1,0,0.67,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,0.375,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,2,0,-1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0,0.15,C_Ug +611,R_1dMxnugtrZ4FKc4,32 - 38,American,Male,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,3,2,3,2,3,3,3,9,2,3,3,3,3,7,1,3,3,3,3,10,2,3,2,3,3,10,3,3,3,2,2,8,3,3,3,3,3,10,3,3,3,3,3,10,3,3,2,1,2,8,TRUE,0,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,81,TRUE,0,78,TRUE,0,80,TRUE,1,92,TRUE,0,100,TRUE,1,83,TRUE,1,81,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,0,63,TRUE,1,50,TRUE,1,50,TRUE,0,51,TRUE,1,50,TRUE,0,50,TRUE,1,68,TRUE,0,89,TRUE,0,94,TRUE,0,81,TRUE,1,100,TRUE,1,85,TRUE,1,96,0.25,0.1024,0.0361,0,0.0016,0.25,0.25,0.0361,0.3969,0.25,0,0.0064,0.25,0.6084,0,0.25,0.2601,1,0.8836,0.25,0.25,0.0289,0.25,1,1,0.7921,0.0225,0.25,1,0.25,0.6561,0.64,0.386882143,0.25425,0.519514286,29,90.63,15,46.88,3,37.5,4,50,4,50,4,50,15,93.75,0,0,74.12,73.12,77.5,68.62,77.25,74.12,74.12,43.75,27.24,35.62,27.5,18.62,27.25,-19.63,74.12,0,1,0,0,0,1,0,0,1,0,2,0,0,0,1,1,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,2,0,0.2,0.4,0.6,0.6,0.4,0.2,0.2,0.6,0.45,0.35,8.67,9.33,1,-3,0,2,-0.66,5 cents,100 minutes,36 days,Male,College Diploma/Certificate,35,0,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,1,0,-1,-1,1,0,0,0,0,2,0,0,0,0,1,0,0,-2,1,-0.2,0.2,0.4,0,0.1,C_Ug +612,R_5fASb8KCbKFlqxD,46 - 52,American,Female,2,3,3,-1,2,-2,-1,1,1,1,1,-2,2,-2,2,1,1,-1,-1,-2,3,3,3,-2,1,7,-2,-2,-2,1,1,5,1,-2,2,-2,3,5,1,1,1,1,-1,6,3,3,3,-1,2,5,-1,-1,2,-1,1,5,3,-1,2,-2,3,5,1,1,1,-1,-1,5,FALSE,1,100,TRUE,1,63,TRUE,0,81,TRUE,0,55,TRUE,1,55,FALSE,1,100,TRUE,1,80,FALSE,0,65,TRUE,1,62,TRUE,1,96,FALSE,1,100,TRUE,0,71,TRUE,1,76,TRUE,0,77,FALSE,0,50,TRUE,1,61,TRUE,0,57,FALSE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,77,FALSE,1,100,TRUE,1,61,TRUE,0,58,TRUE,1,100,TRUE,0,50,FALSE,1,69,TRUE,0,50,TRUE,1,82,TRUE,1,50,TRUE,1,100,0.4225,0,0.1521,0.04,0,0,0.1521,0.0016,0.25,0.0529,0.0324,0.0576,0.1444,0,0.2025,0.1369,0,0.3025,0.0961,0.3364,0,0.25,0,0.5929,0.3249,0.25,0.25,0,0.6561,0,0.25,0.5041,0.172978571,0.095207143,0.25075,20,62.5,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,74.88,66.25,79.75,86,67.5,73.62,76.12,-6.25,6.13,3.75,4.75,11,5,-13.88,26.12,1,0,0,1,1,0,1,3,0,0,0,0,0,0,1,0,0,2,2,1,1,0,0,0,0,1,0,1,2,0,2,1,0,0,1,0,0,2,0,1,0.6,0.8,0.2,1,0.2,0.8,0.8,0.6,0.65,0.6,5.67,5,2,0,0,1,0.67,10 cents,25 minutes,24 days,Female,High School (or equivalent),50,0.25,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,1,1,-1,1,2,-2,0,-2,-1,0,0,0,0,0,0,2,0,0.4,0,-0.6,0.4,0.05,HS_TS +613,R_7D7xN24lmXDg2r9,46 - 52,American,Male,0,2,3,2,2,2,3,2,3,2,0,1,1,2,1,1,-1,0,1,-2,0,2,3,3,2,5,1,2,2,2,2,6,-3,0,0,1,0,6,2,3,2,2,0,9,1,1,0,1,0,6,1,0,1,0,1,6,1,1,1,1,1,6,1,1,0,1,1,6,TRUE,0,98,FALSE,0,77,TRUE,0,100,FALSE,1,86,FALSE,0,72,FALSE,1,86,TRUE,1,100,TRUE,1,79,TRUE,1,83,FALSE,0,82,TRUE,0,77,FALSE,1,76,TRUE,1,70,TRUE,0,90,TRUE,1,68,TRUE,1,58,TRUE,0,69,FALSE,1,100,TRUE,0,84,FALSE,1,97,TRUE,1,74,TRUE,1,80,FALSE,1,100,FALSE,0,72,TRUE,0,78,TRUE,1,98,TRUE,0,94,FALSE,1,90,TRUE,0,61,TRUE,1,100,FALSE,0,63,TRUE,1,88,0.0441,0.0004,0.1764,0,0.0144,0.0196,0.5184,0.6724,0.0009,0.04,0,0.09,0.0289,0.5929,0.5184,0.5929,0,0.0196,0.01,0.6084,0.0676,0.1024,0.7056,0.81,0.4761,0.8836,0.3969,0.9604,1,0,0.3721,0.0576,0.341396429,0.222028571,0.460764286,24,75,18,56.25,3,37.5,5,62.5,4,50,6,75,11,68.75,7,43.75,82.81,79,77.5,90.75,84,79,86.62,18.75,26.56,41.5,15,40.75,9,10.25,42.87,0,0,0,1,0,1,1,0,1,0,3,1,1,1,1,1,4,2,1,2,1,1,3,1,2,1,3,1,3,1,1,0,0,1,0,0,2,0,0,3,0.2,0.6,1.4,2,1.6,1.8,0.4,1,1.05,1.2,5.67,6,-1,0,0,3,-0.33,10 cents,5 minutes,24 days,Male,University - PhD,46,0,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,-1,-3,0,-2,0,-2,-1,-2,-1,2,1,1,0,1,1,2,2,1,-1,-1.4,-1.2,1,1,-0.15,grad_prof +614,R_3CUEy5WMiVcl5hL,46 - 52,American,Female,3,3,3,3,3,-3,-1,1,-1,3,1,-1,2,-1,3,2,2,2,3,2,3,3,3,3,3,0,-3,-1,2,-1,3,1,1,-2,3,-1,3,1,2,1,2,3,2,4,2,3,3,3,2,1,-3,-2,2,-2,3,1,1,-2,3,-2,3,1,2,1,2,3,2,4,FALSE,1,100,TRUE,1,76,FALSE,1,75,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,98,FALSE,1,94,TRUE,0,86,TRUE,1,98,FALSE,1,95,TRUE,1,88,TRUE,1,92,FALSE,1,92,TRUE,0,100,TRUE,0,71,FALSE,1,100,TRUE,1,100,TRUE,1,98,FALSE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,0,70,FALSE,1,94,TRUE,0,100,TRUE,1,90,TRUE,1,74,TRUE,1,100,0,0,0.0064,0,0,0,0.0064,0.0004,0,0.0004,0.01,0.0004,0.0004,0.0036,0,0.0576,0,0.25,0.0036,0,0,0.0144,0.5041,0.0025,0.0064,0.49,0.0676,0,0.0625,1,1,0.7396,0.150710714,0.023514286,0.277907143,27,84.38,26,81.25,5,62.5,7,87.5,7,87.5,7,87.5,16,100,10,62.5,91.59,77.62,98.75,98.88,91.12,94,89.19,3.13,10.34,15.12,11.25,11.38,3.62,-6,26.69,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,0,0.2,0.4,0.2,0.4,0.6,0.6,0.2,0.2,0.45,0.67,1,-1,0,0,0,-0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,51,1.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,0,0,0,-1,0,-1,0,-1,0,0,0,0,-1,0,0,0,0,0,0,-0.4,-0.4,-0.2,0,-0.25,C_Ug +615,R_7DA0CusRVJLhNBr,39 - 45,American,Female,1,1,1,1,-3,-2,0,1,0,1,0,-1,1,-1,1,-3,-3,-3,-3,-3,2,2,1,1,-3,5,-3,0,0,0,1,5,0,-3,1,-2,1,5,-3,-3,-3,-3,-3,5,1,1,1,1,1,5,-2,0,0,0,1,5,-1,-1,1,-1,0,5,0,0,0,0,0,5,TRUE,0,52,TRUE,1,52,FALSE,1,50,FALSE,1,50,TRUE,1,53,TRUE,0,51,TRUE,1,51,TRUE,1,78,TRUE,1,50,TRUE,1,50,TRUE,0,51,TRUE,0,54,TRUE,1,50,TRUE,0,53,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,52,TRUE,1,50,0.0484,0.25,0.25,0.2401,0.25,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2601,0.2209,0.2304,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.25,0.25,0.2304,0.2704,0.25,0.25,0.25,0.2916,0.2516,0.247964286,0.255235714,6,18.75,22,68.75,6,75,5,62.5,5,62.5,6,75,16,100,6,37.5,51.47,50.62,50.5,50.75,54,52.25,50.69,-50,-17.28,-24.38,-12,-11.75,-21,-47.75,13.19,1,1,0,0,0,1,0,1,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,4,0,0,1,0,0,1,0,0,0,1,3,3,3,3,3,0.4,0.4,0.6,0,0.8,0.2,0.4,3,0.35,1.1,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),39,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,1,1,0,0,-4,1,0,0,0,0,-1,2,0,1,-1,-3,-3,-3,-3,-3,-0.4,0.2,0.2,-3,-0.75,HS_TS +616,R_5OjN5p4s72spH8M,39 - 45,Canadian,Male,2,2,1,-2,1,1,-2,2,-2,2,-2,-2,2,-2,1,1,1,2,1,-1,2,2,2,-2,2,1,1,-2,2,-2,2,2,-1,-1,2,-1,1,2,0,2,1,0,-1,2,2,2,2,-1,1,2,2,-2,2,-2,2,2,-1,-1,2,-3,1,2,1,1,1,1,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,91,TRUE,0,89,TRUE,1,100,TRUE,0,100,FALSE,0,62,TRUE,1,100,TRUE,0,97,FALSE,1,89,FALSE,1,84,FALSE,1,96,TRUE,1,90,TRUE,1,100,FALSE,1,98,FALSE,0,95,FALSE,1,100,TRUE,1,95,TRUE,0,93,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,85,TRUE,1,100,0,0.0025,0,0,0,0,0.9025,0,0.0016,0,0,0,0,0.0081,0,0,0.0004,0.7056,0.0025,0,0.01,0.3844,0.0256,1,0.9409,0.8649,0.0225,1,1,0.0121,1,0.7921,0.309757143,0.115585714,0.503928571,29,90.63,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,95.09,87.38,98.12,98,96.88,95.44,94.75,21.88,26.34,24.88,23.12,23,34.38,7.94,44.75,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,0.4,0,0.6,0.8,0.4,0.2,0.6,0.2,0.45,0.35,1.67,2,-1,0,0,0,-0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),42,1.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,1,-1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,-0.2,0,0.6,0.1,HS_TS +617,R_3KZ8crIbT1lOYdB,32 - 38,American,Female,3,3,3,2,3,1,0,1,1,1,1,2,2,1,1,1,3,2,2,0,3,2,2,2,3,10,0,2,1,1,2,9,1,3,1,2,1,8,2,1,3,2,1,8,3,2,3,3,3,9,3,-3,3,-3,3,10,1,2,2,2,3,10,3,3,3,3,3,10,TRUE,0,100,FALSE,0,60,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,51,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,69,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,99,FALSE,0,93,TRUE,1,100,0,0,0,0,0,0.2401,1,1,0,0,0.0001,0,0,0,0,0.36,0,1,1,0,1,0,0,0.0961,0,0,0.8649,1,1,1,1,1,0.4129,0.257157143,0.568642857,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,96,94.12,93.88,96.12,99.88,97,95,-12.5,33.5,31.62,18.88,33.62,49.88,28.25,38.75,0,1,1,0,0,1,2,0,0,1,0,1,1,1,0,1,2,1,0,1,0,1,0,1,0,2,3,2,4,2,0,0,0,1,2,2,0,1,1,3,0.4,0.8,0.6,1,0.4,2.6,0.6,1.4,0.7,1.25,9,9.67,1,-1,-2,-2,-0.67,15 cents,100 minutes,24 days,Female,University - Undergraduate,34,0.375,0,0,0,0,1,1,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,1,-1,0,-1,-1,-2,-4,-1,0,1,1,0,-2,-1,2,0,-1,-2,0,-1.8,0,-0.4,-0.55,C_Ug +618,R_1Gic3Mg1IiLYIzn,39 - 45,American,Male,-1,2,3,2,1,1,-2,1,0,0,2,0,3,-1,3,-1,-1,-1,0,-2,0,3,3,2,0,2,2,-2,1,-1,0,5,2,2,3,-1,3,4,-1,0,0,0,-2,6,0,3,3,3,2,7,2,-1,1,1,0,6,3,3,3,-2,3,4,1,1,0,1,-1,7,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,72,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,0,50,FALSE,1,100,FALSE,1,100,TRUE,1,63,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,0.25,0.0784,0,0,0.1369,0,0,0.25,0,0,0,0.25,0,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0,0.25,0.150546429,0.06895,0.232142857,16,50,24,75,4,50,8,100,6,75,6,75,13,81.25,11,68.75,77.66,62.5,93.75,71.5,82.88,83.44,71.88,-25,2.66,12.5,-6.25,-3.5,7.88,2.19,3.13,1,1,0,0,1,1,0,0,1,0,0,2,0,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,1,0,1,3,0,1,0,2,2,1,1,1,0.6,0.4,0.4,0.4,0.8,0.6,1,1.4,0.45,0.95,3.67,5.67,-5,-1,0,-1,-2,5 cents,5 minutes,24 days,Male,High School (or equivalent),42,1.375,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,0,0,-1,0,0,0,-1,-1,0,-1,0,-2,-1,0,-1,-1,-0.2,-0.2,-0.6,-1,-0.5,HS_TS +619,R_74ocXQ0S1nX87vz,46 - 52,American,Male,3,3,3,2,3,3,3,3,2,3,2,2,3,3,3,2,3,3,3,3,3,3,2,3,3,10,3,3,3,2,3,9,3,2,3,3,3,10,3,3,3,3,2,10,3,2,3,3,3,10,3,3,3,2,3,9,3,2,3,3,3,10,2,3,3,3,3,10,TRUE,0,74,TRUE,1,70,TRUE,0,83,TRUE,0,69,TRUE,1,74,FALSE,1,66,FALSE,0,70,TRUE,1,66,FALSE,0,69,TRUE,1,69,FALSE,1,67,FALSE,1,73,FALSE,0,87,TRUE,0,79,FALSE,0,67,TRUE,1,100,TRUE,0,96,TRUE,0,100,FALSE,1,60,FALSE,1,59,FALSE,0,60,TRUE,1,67,FALSE,1,69,FALSE,0,58,FALSE,1,64,FALSE,0,69,TRUE,0,70,TRUE,0,100,FALSE,1,96,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.1156,0.4761,0,0.49,0,0.1156,0.3364,0.0961,0.1681,0.1089,0,0.7569,0.4761,0.1089,0.0676,0.09,0.0961,0.4761,1,0.1296,0.36,0.4489,0.16,0.6241,0.9216,0.49,1,0.5476,0.6889,1,0.0016,0.0729,0.369357143,0.206914286,0.5318,30,93.75,16,50,3,37.5,5,62.5,3,37.5,5,62.5,8,50,8,50,76.59,71.5,81,74,79.88,76.62,76.56,43.75,26.59,34,18.5,36.5,17.38,26.62,26.56,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.4,0,0.2,0.4,0.4,0,0.2,0,0.25,0.15,9.67,9.67,0,0,0,0,0,10 cents,75 minutes,15 days,Male,High School (or equivalent),46,-0.125,0,0,0,1,0,0,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.4,0.1,HS_TS +620,R_7V9lOXSXlzNyyzL,46 - 52,American,Male,1,0,-3,1,1,-3,0,2,1,0,2,3,3,0,2,-3,-3,-3,-3,-3,-1,2,1,1,1,4,-3,-3,2,3,0,5,3,1,3,2,3,5,-3,-3,-3,-3,-3,2,1,0,-3,3,1,4,-3,-3,2,2,0,3,3,3,3,-2,2,2,-3,-3,-3,-3,-3,3,TRUE,0,80,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,77,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0.01,0,0,0.25,0.81,0,0,0,0.64,1,0,0.5929,0,0.64,0,1,1,0,0.221175,0.036428571,0.405921429,25,78.13,25,78.13,6,75,7,87.5,5,62.5,7,87.5,16,100,9,56.25,94.28,82.12,98.75,97.5,98.75,99.38,89.19,0,16.15,7.12,11.25,35,11.25,-0.62,32.94,2,2,4,0,0,0,3,0,2,0,1,2,0,2,1,0,0,0,0,0,0,0,0,2,0,0,3,0,1,0,1,0,0,2,0,0,0,0,0,0,1.6,1,1.2,0,0.4,0.8,0.6,0,0.95,0.45,4.67,3,0,2,3,-1,1.67,10 cents,5 minutes,24 days,Male,University - Undergraduate,50,0.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,2,2,4,-2,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,1.2,0.2,0.6,0,0.5,C_Ug +621,R_6oB9NiPV5S5aljA,32 - 38,American,Male,3,2,0,1,0,1,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,-1,2,-1,0,7,1,2,0,0,0,7,0,0,2,0,2,9,1,0,0,3,2,7,0,2,2,3,0,8,1,0,2,0,2,7,3,1,0,0,3,8,1,2,2,1,0,7,TRUE,0,91,TRUE,1,79,TRUE,0,80,TRUE,0,83,FALSE,0,87,TRUE,0,80,TRUE,1,85,TRUE,1,68,TRUE,1,72,FALSE,0,78,TRUE,0,72,FALSE,1,73,TRUE,1,75,TRUE,0,78,TRUE,1,77,TRUE,1,76,TRUE,0,78,FALSE,1,77,TRUE,0,75,TRUE,0,81,TRUE,1,88,TRUE,1,71,FALSE,1,75,TRUE,1,88,TRUE,0,72,FALSE,0,76,TRUE,0,76,TRUE,0,74,FALSE,1,69,TRUE,1,73,TRUE,1,67,FALSE,0,88,0.1024,0.5776,0.0576,0.0225,0.7744,0.64,0.0144,0.6084,0.6561,0.0841,0.0729,0.0625,0.0784,0.5184,0.7569,0.0441,0.0625,0.6889,0.5476,0.5184,0.0144,0.0529,0.5625,0.6084,0.6084,0.5776,0.1089,0.8281,0.64,0.0529,0.0961,0.0729,0.369682143,0.361571429,0.377792857,17,53.13,16,50,4,50,4,50,3,37.5,5,62.5,12,75,4,25,77.56,75.12,80,78.5,76.62,78,77.12,3.13,27.56,25.12,30,41,14.12,3,52.12,2,3,2,2,0,0,2,1,0,1,0,0,2,1,0,0,1,0,3,0,3,0,2,2,0,0,0,1,0,1,3,1,0,1,1,0,1,2,1,2,1.8,0.8,0.6,0.8,1.4,0.4,1.2,1.2,1,1.05,7.67,7.67,-1,0,1,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,34,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-1,3,0,0,0,0,2,0,0,0,-3,-1,2,0,-1,0,0,-2,2,-2,0.4,0.4,-0.6,-0.4,-0.05,C_Ug +622,R_1ovEWvomQ23gvPv,53 - 59,American,Female,2,2,1,1,1,1,-2,2,1,1,2,1,2,0,2,0,-1,1,-1,-2,2,2,1,1,2,5,1,0,2,1,1,6,2,2,2,1,2,6,-1,-1,1,0,-2,6,2,2,1,2,2,6,1,-1,1,1,1,6,2,2,2,1,2,6,1,1,0,1,-1,6,FALSE,1,87,TRUE,1,65,FALSE,1,58,FALSE,1,57,FALSE,0,55,FALSE,1,79,TRUE,1,80,TRUE,1,83,TRUE,1,78,FALSE,0,73,TRUE,0,71,TRUE,0,77,TRUE,1,73,TRUE,0,85,TRUE,1,57,TRUE,1,89,FALSE,1,82,FALSE,1,91,TRUE,0,86,FALSE,1,90,FALSE,0,69,FALSE,0,87,FALSE,1,89,TRUE,1,92,FALSE,1,95,TRUE,1,91,FALSE,1,91,FALSE,1,80,TRUE,0,91,TRUE,1,86,TRUE,1,73,TRUE,1,76,0.0289,0.0081,0.0121,0.04,0.0576,0.0441,0.0064,0.5329,0.01,0.7569,0.0196,0.0729,0.0484,0.5041,0.3025,0.1225,0.0121,0.1849,0.04,0.0025,0.4761,0.1849,0.7396,0.7225,0.0324,0.0081,0.0729,0.0169,0.1764,0.0081,0.8281,0.5929,0.234867857,0.191064286,0.278671429,20,62.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,12,75,11,68.75,79.25,72.25,76.75,86.12,81.88,76.69,81.81,-9.38,7.37,-2.75,14.25,23.62,-5.62,1.69,13.06,0,0,0,0,1,0,2,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,0,1,2,1,2,1,0.2,0.4,0.4,0.4,0.4,0.4,0.4,1.4,0.35,0.65,5.67,6,-1,0,0,0,-0.33,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,54,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,0,0,1,-1,0,0,0,0,0,0,0,0,-2,-1,-1,-1,-0.2,0,0,-1,-0.3,C_Ug +623,R_6NUiy7iyoMSnmYM,53 - 59,American,Female,-2,1,2,3,-1,-1,1,2,0,-1,2,2,2,-1,3,1,1,2,1,1,-3,0,3,-2,2,7,1,1,2,1,1,2,1,1,3,1,2,3,-2,-3,-2,-1,-1,8,-2,1,2,3,-1,2,-2,-1,2,0,-1,2,2,2,2,-1,3,2,2,1,2,1,1,3,FALSE,1,88,TRUE,1,71,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,98,TRUE,1,95,TRUE,1,100,TRUE,1,81,TRUE,1,90,FALSE,1,61,TRUE,0,96,TRUE,1,94,TRUE,0,98,TRUE,1,50,TRUE,1,81,FALSE,1,73,FALSE,1,100,FALSE,1,74,FALSE,1,57,TRUE,1,88,TRUE,1,95,TRUE,0,91,TRUE,1,87,TRUE,0,66,TRUE,1,96,FALSE,1,50,TRUE,0,56,TRUE,0,93,TRUE,1,92,TRUE,1,52,TRUE,1,98,0,0.0016,0.0361,0.0025,0.0004,0.0004,0.0169,0.01,0.1849,0.0025,0.0064,0.0036,0.0361,0.1521,0.25,0.0841,0.8281,0.25,0.3136,0.4356,0.0144,0.25,0.0676,0.9604,0.0729,0.25,0.2304,0.0144,0,0,0.8649,0.9216,0.222189286,0.130392857,0.313985714,20,62.5,25,78.13,7,87.5,6,75,6,75,6,75,16,100,9,56.25,80.34,61.12,85.62,91,83.62,82.5,78.19,-15.63,2.21,-26.38,10.62,16,8.62,-17.5,21.94,1,1,1,5,3,2,0,0,1,2,1,1,1,2,1,3,4,4,2,2,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,2.2,1,1.2,3,0,0.6,0,0.2,1.85,0.2,4,2,5,0,1,5,2,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,1,1,1,5,3,1,-2,0,1,2,1,1,1,2,1,2,4,4,2,2,2.2,0.4,1.2,2.8,1.65,C_Ug +624,R_1TsHqwdlsg8NyRI,60 - 66,American,Female,3,2,2,1,0,-2,0,2,0,-2,3,2,3,-2,3,0,-2,0,0,-2,3,2,2,0,-2,1,-3,1,1,1,-3,1,3,2,3,-2,3,1,-3,-3,-3,-2,-2,1,3,2,2,1,-1,1,-2,-1,1,-1,-2,2,3,2,3,-2,3,1,0,0,0,0,-2,1,TRUE,0,65,TRUE,1,70,FALSE,1,95,FALSE,1,52,TRUE,1,53,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,98,TRUE,0,100,FALSE,0,99,TRUE,0,95,TRUE,1,55,TRUE,1,91,TRUE,0,95,TRUE,0,99,TRUE,0,97,FALSE,1,100,FALSE,0,75,TRUE,1,85,FALSE,1,54,TRUE,1,90,FALSE,1,100,TRUE,1,97,TRUE,0,58,FALSE,1,95,TRUE,0,90,TRUE,1,98,FALSE,0,70,TRUE,1,97,0,0.0009,0.0081,0.0009,0.0009,0,0.01,0,0,0.0225,0.0004,0.9801,0.16,0.0004,0.2209,0.09,0.2116,0.2304,0.0025,0,0.5625,0.2025,0.9409,0.9025,0.9025,0.3364,0.49,0.4225,0.0025,0.9801,0.81,1,0.338646429,0.137657143,0.539635714,18,56.25,21,65.63,5,62.5,4,50,5,62.5,7,87.5,13,81.25,8,50,85.31,70,82.88,92.25,96.12,83.56,87.06,-9.38,19.68,7.5,32.88,29.75,8.62,2.31,37.06,0,0,0,1,2,1,1,1,1,1,0,0,0,0,0,3,1,3,2,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0.6,1,0,1.8,0.2,0.6,0,0.4,0.85,0.3,1,1.33,0,-1,0,0,-0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,-0.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,3,-1,3,2,0,0.4,0.4,0,1.4,0.55,HS_TS +625,R_1scbTlFE5WDcKLq,53 - 59,American,Female,3,3,3,2,3,1,-2,3,-2,2,3,1,3,3,3,2,2,2,2,-1,3,3,3,2,3,1,3,-2,3,-3,3,1,3,2,3,3,3,1,2,3,2,2,-2,1,3,3,3,2,3,1,2,-2,3,-2,3,1,3,2,3,2,3,2,2,2,2,2,-1,9,FALSE,1,90,TRUE,1,79,FALSE,1,77,FALSE,1,61,TRUE,1,78,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,92,TRUE,0,81,FALSE,0,76,FALSE,1,92,TRUE,1,70,TRUE,1,86,FALSE,1,82,TRUE,0,92,FALSE,1,50,FALSE,1,100,TRUE,1,90,TRUE,1,73,FALSE,1,69,TRUE,1,85,FALSE,1,84,TRUE,1,68,FALSE,1,54,FALSE,1,63,FALSE,1,51,FALSE,0,86,FALSE,0,53,TRUE,1,100,0,0.1024,0.0196,0,0,0,0.0225,0,0,0.0729,0.7396,0.5776,0.0625,0.0064,0.0484,0.0441,0.0961,0.1521,0.1369,0.0256,0.01,0.09,0.25,0.0064,0.0324,0.2116,0.2809,0.01,0.0529,0.8464,0.2401,0.6561,0.166839286,0.130157143,0.203521429,25,78.13,27,84.38,7,87.5,7,87.5,7,87.5,6,75,13,81.25,14,87.5,79.91,66.75,80.75,87.38,84.75,82.44,77.38,-6.25,-4.47,-20.75,-6.75,-0.12,9.75,1.19,-10.12,0,0,0,0,0,2,0,0,1,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0.8,0.2,0.4,0,0.4,0.4,0,0.35,0.2,1,1.33,0,0,-1,-8,-0.33,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,58,0.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,1,0,0,1,0,0,0,0,-1,0,0,1,0,0,1,0,0.4,-0.2,0.4,0.15,C_Ug +626,R_37pd9qapjRdtkJa,46 - 52,American,Female,0,2,2,0,0,-2,-2,2,-2,0,0,1,1,-2,2,0,0,2,0,0,0,0,0,0,0,5,-2,-2,2,-2,0,3,0,1,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,5,-2,-2,2,-2,0,2,-2,2,2,-2,2,1,0,0,0,0,0,2,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,80,TRUE,0,60,TRUE,0,100,TRUE,1,80,TRUE,0,100,FALSE,0,74,TRUE,1,80,TRUE,0,76,FALSE,1,100,TRUE,0,90,FALSE,1,90,TRUE,1,80,TRUE,1,80,FALSE,1,76,TRUE,1,91,TRUE,0,92,TRUE,1,84,FALSE,1,100,TRUE,0,82,TRUE,0,75,FALSE,0,90,FALSE,0,77,TRUE,1,100,0,0.0256,0.04,0,0,0,0.0081,0.04,0.01,0.04,0.81,0.04,0.01,0.36,0.25,0.25,0.0576,0.25,0.6724,0.8464,0.04,0.5476,0.81,1,0.5776,0,0.5929,1,1,0,0.5625,1,0.384825,0.151835714,0.617814286,16,50,18,56.25,3,37.5,6,75,5,62.5,4,50,12,75,6,37.5,84.28,73.88,79.62,92,91.62,81.62,86.94,-6.25,28.03,36.38,4.62,29.5,41.62,6.62,49.44,0,2,2,0,0,0,0,0,0,0,0,0,1,2,2,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,2,1,1,0,0,0,0,2,0,0,0.8,0,1,0.4,0.8,0,0.8,0.4,0.55,0.5,3.67,2.67,0,1,2,3,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),50,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,-2,-1,0,2,2,0,0,0,0,0,0,0,0.2,0,0.05,HS_TS +627,R_6RYM8XZDS6nkhGh,46 - 52,Canadian,Male,-3,2,0,0,2,0,0,0,0,0,0,2,0,0,0,-3,-3,-3,-3,-3,0,2,2,0,0,5,0,2,0,0,0,5,-3,0,0,0,0,5,-3,-3,-3,-3,-3,5,-3,0,0,0,2,5,0,0,0,2,0,5,0,2,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,FALSE,0,50,TRUE,0,66,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,81,TRUE,1,95,TRUE,0,50,TRUE,0,100,TRUE,1,66,TRUE,0,50,TRUE,1,50,FALSE,0,50,TRUE,0,76,TRUE,0,80,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,81,FALSE,1,73,TRUE,1,100,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,70,TRUE,0,100,TRUE,1,100,TRUE,1,55,TRUE,1,84,0.25,0.0361,0.25,0,0.0256,0.25,0,0.0025,0.25,0.0361,0,0.1156,0.0361,0.25,0.25,0.25,0.0729,0.25,0.49,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.2025,1,0.4356,0.64,1,1,0.308375,0.127771429,0.488978571,5,15.63,18,56.25,6,75,4,50,5,62.5,3,37.5,11,68.75,7,43.75,69,54.5,68.62,79.62,73.25,71.44,66.56,-40.62,12.75,-20.5,18.62,17.12,35.75,2.69,22.81,3,0,2,0,2,0,2,0,0,0,3,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,3,3,3,3,3,1.4,0.4,1,0,0.4,0.4,0,3,0.7,0.95,5,5,0,0,0,0,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,47,0.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,3,-2,2,0,2,0,2,0,-2,0,3,2,0,0,0,-3,-3,-3,-3,-3,1,0,1,-3,-0.25,C_Ug +628,R_3r97C10hrmEY6lU,39 - 45,American,Female,0,3,-3,3,-3,-3,3,-3,3,-2,-1,-1,1,1,1,-3,-3,-3,-3,-3,2,2,2,-3,-3,10,2,-2,2,2,2,9,-3,-3,2,2,2,2,2,2,-1,2,-1,9,3,3,3,3,-3,10,-3,-3,-3,-3,-3,10,-3,-3,2,2,2,1,2,2,2,2,2,9,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,1,51,TRUE,1,50,FALSE,1,75,TRUE,1,99,FALSE,0,51,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,0,54,FALSE,1,100,TRUE,1,60,FALSE,0,80,FALSE,1,53,TRUE,0,100,FALSE,1,52,FALSE,1,54,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,92,FALSE,1,61,FALSE,0,98,FALSE,1,51,FALSE,1,100,TRUE,0,98,FALSE,0,100,FALSE,0,100,TRUE,1,96,0.2601,0.9604,0.64,0.0001,0.0016,0.0625,0.0064,0,0.2116,0,1,0.2916,0,0.0036,0.25,0.25,0.0256,0.2401,0,0.1521,0,0.16,0.2304,0,0.2209,0.2401,1,1,0.25,1,0.9604,1,0.305603571,0.167357143,0.44385,16,50,21,65.63,6,75,6,75,5,62.5,4,50,9,56.25,12,75,79.78,69.75,76.25,94.75,78.38,83.12,76.44,-15.63,14.15,-5.25,1.25,32.25,28.38,26.87,1.44,2,1,5,6,0,5,5,5,1,4,2,2,1,1,1,5,5,2,5,2,3,0,6,0,0,0,6,0,6,1,2,2,1,1,1,5,5,5,5,5,2.8,4,1.4,3.8,1.8,2.6,1.4,5,3,2.7,7,7,0,-1,1,0,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,45,1.375,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,-1,1,-1,6,0,5,-1,5,-5,3,0,0,0,0,0,0,0,-3,0,-3,1,1.4,0,-1.2,0.3,C_Ug +629,R_3x3YdUaKFiS8CEF,46 - 52,Canadian,Female,2,1,1,-1,2,1,-1,1,-1,2,2,-1,3,-2,1,0,-1,0,1,-2,2,1,1,-2,2,3,1,-1,1,-1,2,2,2,-1,3,-2,0,2,-1,-1,-1,0,-2,6,2,1,1,-2,2,4,0,-2,1,-1,1,5,2,-1,3,-2,0,5,1,1,1,1,-2,7,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,95,FALSE,1,100,FALSE,0,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,75,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,1,0,0.81,0,0,0,0,0,0,1,0.81,0,0,0.9025,1,0,0,0,0,0,0.04,0,0,0,0.5625,0,0,0,0,0,1,0.189821429,0.265178571,0.114464286,20,62.5,24,75,6,75,6,75,6,75,6,75,10,62.5,14,87.5,97.81,94.38,98.12,98.75,100,97.19,98.44,-12.5,22.81,19.38,23.12,23.75,25,34.69,10.94,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,2,1,0,0,0.2,0,0.2,0.6,0.2,0.6,0.2,0.8,0.25,0.45,2.33,4.67,-1,-3,-3,-1,-2.34,5 cents,5 minutes,47 days,Female,University - Undergraduate,49,1.5,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,-1,-1,0,0,-1,0,0,0,0,0,0,-2,0,1,0,0,-0.6,0,-0.2,-0.2,C_Ug +630,R_5yNgKYnVHrBUF21,39 - 45,Canadian,Male,3,0,2,0,3,0,0,0,0,0,3,0,0,0,0,2,2,3,2,0,3,1,3,0,3,5,0,0,0,0,0,6,3,0,0,0,0,5,0,0,0,0,0,5,2,0,0,0,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,2,0,0,5,FALSE,1,53,FALSE,0,52,FALSE,1,54,FALSE,1,52,FALSE,0,56,FALSE,1,51,FALSE,0,53,FALSE,0,52,FALSE,0,52,FALSE,0,52,FALSE,1,53,FALSE,1,50,FALSE,0,51,FALSE,1,52,FALSE,0,53,FALSE,0,52,FALSE,1,51,FALSE,1,51,FALSE,1,51,FALSE,1,51,FALSE,0,51,FALSE,0,51,FALSE,1,51,FALSE,0,53,FALSE,1,52,FALSE,0,53,FALSE,1,52,FALSE,1,52,FALSE,1,51,FALSE,0,52,FALSE,0,51,FALSE,0,52,0.2704,0.2809,0.2704,0.2809,0.2704,0.2401,0.2809,0.2704,0.2401,0.2601,0.2704,0.2601,0.2704,0.2209,0.3136,0.2704,0.2401,0.2304,0.2304,0.2304,0.2601,0.2809,0.2401,0.2304,0.2401,0.2304,0.2601,0.2209,0.2116,0.2401,0.2401,0.25,0.250139286,0.259878571,0.2404,16,50,16,50,4,50,4,50,4,50,4,50,0,0,16,100,51.97,52,51.75,52.12,52,52.25,51.69,0,1.97,2,1.75,2.12,2,52.25,-48.31,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,2,3,2,0,1,0,2,0,1,0,0,0,0,0,3,0,0,0,0,2,2,1,2,0,0.4,0,0,1.8,0.8,0,0.6,1.4,0.55,0.7,5.33,5,0,1,0,0,0.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,40,0,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,1,-1,0,-1,0,0,0,0,0,-3,0,0,0,0,0,0,2,0,0,-0.4,0,-0.6,0.4,-0.15,C_Ug +631,R_71n1inSBq85hYMV,32 - 38,Canadian,Male,2,3,2,0,1,1,-1,2,-1,1,2,1,2,0,3,1,1,1,1,-1,2,3,2,0,1,6,2,-1,2,-1,1,7,3,1,3,2,1,7,0,0,0,-1,-1,7,1,3,2,0,3,9,0,-1,2,0,1,7,2,0,2,0,3,7,0,0,0,-1,-1,8,FALSE,1,71,TRUE,1,64,FALSE,1,65,TRUE,0,74,TRUE,1,67,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,58,FALSE,0,68,FALSE,1,68,TRUE,0,83,TRUE,1,88,TRUE,0,95,FALSE,0,68,TRUE,1,82,FALSE,1,67,TRUE,0,66,FALSE,1,68,TRUE,0,66,FALSE,0,92,FALSE,0,60,TRUE,0,85,FALSE,0,75,FALSE,1,61,TRUE,1,84,FALSE,1,67,TRUE,0,75,FALSE,1,71,TRUE,1,85,FALSE,0,70,FALSE,0,91,0,0.0256,0.0324,0.09,0.8281,0,0.5625,0.4624,0.4356,0.36,0.0225,0.0144,0.1764,0.1024,0.1089,0.1296,0.7225,0.5476,0.5625,0.1521,0.8464,0.4624,0.1024,0.9025,0.1089,0.1089,0.49,0.0841,0.1225,0.4356,0.0841,0.6889,0.343721429,0.319492857,0.36795,22,68.75,18,56.25,5,62.5,5,62.5,4,50,4,50,9,56.25,9,56.25,75.12,67.12,82.62,71.88,78.88,76.38,73.88,12.5,18.87,4.62,20.12,21.88,28.88,20.13,17.63,0,0,0,0,0,1,0,0,0,0,1,0,1,2,2,1,1,1,2,0,1,0,0,0,2,1,0,0,1,0,0,1,0,0,0,1,1,1,2,0,0,0.2,1.2,1,0.6,0.4,0.2,1,0.6,0.55,6.67,7.67,-3,0,0,-1,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,34,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,0,-2,0,0,0,-1,0,1,-1,1,2,2,0,0,0,0,0,-0.6,-0.2,1,0,0.05,C_Ug +632,R_5MXNHq2DCzPe2cS,46 - 52,Canadian,Male,2,2,3,1,3,2,1,2,-2,3,2,1,1,2,1,-2,0,-2,2,-3,-1,3,3,3,3,7,3,-3,0,0,1,8,0,0,-2,-2,0,7,-3,-2,1,-3,-3,8,1,3,3,1,3,7,2,0,2,-3,1,7,1,0,0,0,0,6,1,2,2,3,1,5,FALSE,1,100,FALSE,0,59,FALSE,1,58,FALSE,1,74,FALSE,0,80,FALSE,1,100,TRUE,1,86,FALSE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,89,FALSE,1,100,FALSE,0,86,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,72,TRUE,0,100,FALSE,1,100,FALSE,1,72,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,54,TRUE,0,86,FALSE,1,64,TRUE,1,100,TRUE,1,74,FALSE,0,86,1,0,0,0.0196,0.7396,0,0,0,0.0784,0,0,0.7396,1,0.0121,0.64,0.3481,0,0.0676,0.7396,0,0,1,0,0,0.5184,0.2116,0.0676,0,0.1764,1,0.1296,0,0.266735714,0.258957143,0.274514286,22,68.75,22,68.75,5,62.5,4,50,7,87.5,6,75,9,56.25,13,81.25,88.75,81.25,86,98.25,89.5,91.94,85.56,0,20,18.75,36,10.75,14.5,35.69,4.31,3,1,0,2,0,1,4,2,2,2,2,1,3,4,1,1,2,3,5,0,1,1,0,0,0,0,1,0,1,2,1,1,1,2,1,3,2,4,1,4,1.2,2.2,2.2,2.2,0.4,0.8,1.2,2.8,1.95,1.3,7.33,6.67,0,1,1,3,0.66,10 cents,5 minutes,47 days,Male,Professional Degree (ex. JD/MD),49,1.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,2,0,0,2,0,1,3,2,1,0,1,0,2,2,0,-2,0,-1,4,-4,0.8,1.4,1,-0.6,0.65,grad_prof +633,R_7ZEzyZBvyiJaXvH,32 - 38,American,Male,3,2,3,2,2,2,1,1,-1,2,2,2,1,2,2,2,2,2,2,2,2,2,2,1,1,6,2,1,2,1,1,6,2,1,1,1,2,7,1,2,2,1,2,6,1,1,2,2,1,6,1,1,1,-2,1,6,1,1,1,1,1,6,1,2,2,1,2,6,TRUE,0,87,TRUE,1,50,TRUE,0,54,FALSE,1,57,FALSE,0,54,FALSE,1,52,FALSE,0,52,TRUE,1,53,FALSE,0,57,TRUE,1,56,FALSE,1,53,TRUE,0,75,TRUE,1,83,FALSE,1,52,TRUE,1,86,TRUE,1,73,TRUE,0,60,TRUE,0,60,TRUE,0,61,TRUE,0,54,TRUE,1,60,TRUE,1,79,TRUE,0,54,FALSE,0,55,TRUE,0,67,FALSE,0,50,FALSE,1,53,TRUE,0,88,FALSE,1,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,0.2209,0.25,0.0729,0.2704,0.25,0.2304,0.3025,0.1936,0.2916,0.0441,0.25,0.0289,0.3249,0.2209,0.2916,0.25,0.2916,0.1849,0.7744,0.4489,0.16,0.0196,0.3721,0.2304,0.36,0.2209,0.25,0.7569,0.2916,0.36,0.25,0.5625,0.293296429,0.225357143,0.361235714,17,53.13,16,50,6,75,5,62.5,3,37.5,2,25,10,62.5,6,37.5,60.47,58.38,57.88,62.88,62.75,59.88,61.06,3.13,10.47,-16.62,-4.62,25.38,37.75,-2.62,23.56,1,0,1,1,1,0,0,1,2,1,0,1,0,1,0,1,0,0,1,0,2,1,1,0,1,1,0,0,1,1,1,1,0,1,1,1,0,0,1,0,0.8,0.8,0.4,0.4,1,0.6,0.8,0.4,0.6,0.7,6.33,6,0,0,1,0,0.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),34,0,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-1,-1,0,1,0,-1,0,1,1,0,-1,0,0,0,-1,0,0,0,0,0,-0.2,0.2,-0.4,0,-0.1,grad_prof +634,R_3KkEy6EPkKoHwd3,53 - 59,American,Male,-2,3,3,3,3,0,2,3,2,2,3,0,3,3,3,-2,0,-2,0,-2,-1,3,3,3,3,3,-1,1,3,1,3,4,3,0,3,3,3,2,-2,-2,-2,-2,-2,2,0,3,3,3,3,3,0,2,3,2,2,3,3,1,3,3,3,2,-2,-2,0,-2,-2,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0.0625,0,0.04,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0,1,0,1,0.077321429,0.007321429,0.147321429,30,93.75,30,93.75,8,100,8,100,7,87.5,7,87.5,16,100,14,87.5,97.81,93.75,97.5,100,100,95.62,100,0,4.06,-6.25,-2.5,12.5,12.5,-4.38,12.5,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,2,2,0,0.2,0.8,0,0.8,0.4,0,0.2,1.2,0.45,0.45,3,2.67,0,1,0,0,0.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),59,1.5,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,-1,0,0,0,0,1,1,0,1,1,0,-1,0,0,0,0,0,-2,0,0,-0.2,0.8,-0.2,-0.4,0,grad_prof +635,R_79j5xsAlxQdKxqx,25 - 31,American,Male,2,2,0,0,2,3,-3,3,-1,3,3,0,1,3,3,0,0,0,-2,-3,3,3,3,0,3,3,-2,-3,2,-3,0,8,3,0,0,3,3,3,0,-3,1,-3,-3,8,3,3,0,0,2,3,2,-3,3,-3,3,3,3,0,2,3,3,3,2,1,2,1,-3,3,TRUE,0,60,FALSE,0,59,TRUE,0,71,TRUE,0,62,TRUE,1,62,FALSE,1,57,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,60,TRUE,0,72,FALSE,1,100,FALSE,0,81,FALSE,1,100,TRUE,1,67,TRUE,1,100,TRUE,0,71,TRUE,0,77,FALSE,1,63,FALSE,1,56,TRUE,1,100,FALSE,0,61,FALSE,1,56,TRUE,1,74,FALSE,1,65,TRUE,1,100,TRUE,0,68,TRUE,0,100,FALSE,1,60,TRUE,1,71,TRUE,1,55,TRUE,1,100,0,0,0,0,0,0.1849,0.0676,0.16,0.1936,0.3721,0.0841,0.6561,0.1225,0.5184,0.1444,0.3481,0.1936,0.3844,1,0.1225,0,0.1089,0.1369,0,0.5041,0.4624,0.2025,0.36,0.5041,0.5929,0.16,0,0.270860714,0.244985714,0.296735714,16,50,21,65.63,4,50,6,75,5,62.5,6,75,13,81.25,8,50,74.78,63.88,73.38,77.88,84,78.44,71.12,-15.63,9.15,13.88,-1.62,15.38,9,-2.81,21.12,1,1,3,0,1,5,0,1,2,3,0,0,1,0,0,0,3,1,1,0,1,1,0,0,0,1,0,0,2,0,0,0,1,0,0,2,1,2,3,0,1.2,2.2,0.2,1,0.4,0.6,0.2,1.6,1.15,0.7,4.67,3,0,5,0,5,1.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,30,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,0,3,0,1,4,0,1,0,3,0,0,0,0,0,-2,2,-1,-2,0,0.8,1.6,0,-0.6,0.45,C_Ug +636,R_60MjAJsX7YGSw6k,32 - 38,American,Male,2,2,3,2,3,1,-1,1,-2,2,3,2,2,1,1,1,2,2,3,1,2,2,1,3,1,9,1,2,2,3,1,8,1,2,2,1,1,5,2,1,3,1,2,9,1,3,2,2,1,9,2,2,2,1,1,7,2,2,2,1,2,9,3,3,1,2,1,8,TRUE,0,89,FALSE,0,95,TRUE,0,90,FALSE,1,95,FALSE,0,88,TRUE,0,69,FALSE,0,92,FALSE,0,68,TRUE,1,94,FALSE,0,72,TRUE,0,96,FALSE,1,67,TRUE,1,91,TRUE,0,89,TRUE,1,96,TRUE,1,85,FALSE,1,67,TRUE,0,93,TRUE,0,88,TRUE,0,92,TRUE,1,93,TRUE,1,89,TRUE,0,86,TRUE,1,95,TRUE,0,94,TRUE,1,90,FALSE,1,66,TRUE,0,88,TRUE,0,93,TRUE,1,92,TRUE,1,93,TRUE,1,92,0.4624,0.01,0.0225,0.8464,0.0064,0.4761,0.0025,0.5184,0.8464,0.0121,0.0064,0.0081,0.0036,0.9216,0.7744,0.9025,0.7396,0.0025,0.7744,0.8836,0.0049,0.0016,0.7744,0.7921,0.1089,0.1156,0.0049,0.7921,0.81,0.8649,0.8649,0.1089,0.432921429,0.3729,0.492942857,22,68.75,15,46.88,5,62.5,4,50,2,25,4,50,11,68.75,4,25,87.09,90.38,84.88,88.5,84.62,89.06,85.12,21.87,40.21,27.88,34.88,63.5,34.62,20.31,60.12,0,0,2,1,2,0,3,1,5,1,2,0,0,0,0,1,1,1,2,1,1,1,1,0,2,1,3,1,3,1,1,0,0,0,1,2,1,1,1,0,1,2,0.4,1.2,1,1.8,0.4,1,1.15,1.05,7.33,8.33,0,1,-4,1,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,-1,1,1,0,-1,0,0,2,0,1,0,0,0,-1,-1,0,0,1,1,0,0.2,0,0.2,0.1,grad_prof +637,R_5YEzxFVFQAp2Krn,32 - 38,Canadian,Female,-3,3,3,3,1,-3,-1,1,2,-1,2,2,3,1,3,1,1,1,-1,-3,-1,3,3,3,2,5,-3,-2,3,2,1,5,2,2,3,-1,3,4,-1,1,1,1,-2,4,-3,-3,3,3,3,7,1,-2,3,-2,2,9,2,1,3,3,3,5,-1,1,2,1,-1,6,FALSE,1,100,TRUE,1,91,TRUE,0,86,TRUE,0,75,TRUE,1,64,FALSE,1,80,TRUE,1,86,TRUE,1,100,TRUE,1,86,TRUE,1,91,FALSE,1,69,TRUE,0,91,FALSE,0,75,FALSE,1,86,TRUE,1,86,TRUE,1,70,FALSE,1,65,TRUE,0,100,FALSE,1,70,FALSE,1,80,TRUE,1,86,FALSE,0,71,TRUE,0,75,TRUE,1,65,TRUE,0,91,TRUE,1,100,FALSE,1,65,TRUE,0,71,TRUE,0,81,TRUE,1,97,FALSE,0,60,TRUE,1,91,0,0,0.09,0.0196,0.0081,0.04,0.1225,0.0081,0.04,0.5041,0.0009,0.5625,0.0196,0.0961,0.1296,0.0081,0.5625,0.5625,0.5041,0.8281,0.0196,0.0196,0.09,0.0196,0.1225,0.1225,0.36,0,0.7396,1,0.6561,0.8281,0.2848,0.190328571,0.379271429,16,50,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,81.38,75.25,77.12,90.62,82.5,82.44,80.31,-15.63,15.75,0.25,14.62,28.12,20,1.19,30.31,2,0,0,0,1,0,1,2,0,2,0,0,0,2,0,2,0,0,2,1,0,6,0,0,2,4,1,2,4,3,0,1,0,2,0,2,0,1,2,2,0.6,1,0.4,1,1.6,2.8,0.6,1.4,0.75,1.6,4.67,7,-2,-4,-1,-2,-2.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,-6,0,0,-1,-4,0,0,-4,-1,0,-1,0,0,0,0,0,-1,0,-1,-1,-1.8,-0.2,-0.4,-0.85,C_Ug +638,R_1JvZO0PUMVo7krx,39 - 45,Canadian,Female,-1,3,0,0,-1,-2,0,-1,3,0,2,1,1,1,1,-2,-1,-1,1,-2,-1,3,2,1,1,3,-2,1,-1,3,1,7,3,1,1,1,1,6,-1,-1,-1,0,0,3,1,3,0,1,-2,2,-3,0,1,3,-2,2,3,1,2,1,1,4,-1,-1,0,1,0,5,TRUE,0,100,TRUE,1,62,TRUE,0,100,FALSE,1,51,TRUE,1,100,FALSE,1,64,TRUE,1,89,TRUE,1,100,TRUE,1,70,TRUE,1,79,FALSE,1,86,FALSE,1,76,TRUE,1,82,TRUE,0,51,TRUE,1,51,TRUE,1,78,TRUE,0,50,TRUE,0,100,TRUE,0,51,TRUE,0,51,TRUE,1,50,TRUE,1,51,TRUE,0,86,TRUE,1,51,TRUE,0,100,TRUE,1,100,TRUE,0,51,FALSE,1,54,FALSE,1,57,TRUE,1,100,FALSE,0,66,TRUE,1,100,0,0,0.0484,0.0121,0,0.1296,0.2401,0.0441,0.2601,0.2401,0,0.0324,0.09,0.0196,0,0.1444,0.7396,0.2401,0.2116,1,0.25,0.2401,0.2601,0.2601,0.25,0.2601,0.4356,1,1,1,0.1849,0.0576,0.306792857,0.155721429,0.457864286,18,56.25,21,65.63,5,62.5,6,75,4,50,6,75,15,93.75,6,37.5,73.66,61,73.62,83.75,76.25,76.81,70.5,-9.38,8.03,-1.5,-1.38,33.75,1.25,-16.94,33,0,0,2,1,2,0,1,0,0,1,1,0,0,0,0,1,0,0,1,2,2,0,0,1,1,1,0,2,0,2,1,0,1,0,0,1,0,1,0,2,1,0.4,0.2,0.8,0.8,1,0.4,0.8,0.6,0.75,5.33,2.67,1,5,2,-2,2.66,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,39,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,-2,0,2,0,1,-1,1,-2,0,-1,0,0,-1,0,0,0,0,-1,1,0,0.2,-0.6,-0.2,0,-0.15,C_Ug +639,R_7pWJcjCxgY1ukTe,46 - 52,Canadian,Male,2,1,1,2,0,0,-1,2,-1,1,0,0,2,0,2,0,2,2,2,1,2,2,1,2,0,1,0,-1,2,-2,2,1,0,-2,2,1,2,1,1,2,2,1,1,1,2,1,1,2,1,1,1,-1,1,-1,1,1,0,0,2,0,3,1,1,1,1,1,1,1,TRUE,0,66,TRUE,1,58,FALSE,1,70,TRUE,0,50,TRUE,1,90,TRUE,0,86,TRUE,1,98,TRUE,1,89,TRUE,1,79,TRUE,1,82,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,76,TRUE,0,50,FALSE,1,100,TRUE,0,89,TRUE,1,75,FALSE,0,57,TRUE,1,92,0.0121,0.0576,0,0.0004,0.0064,0.7396,0.25,0.0324,0.25,0.25,0.0625,0,0.0441,0.25,0.01,0.1764,0.25,0.25,0,0,0,0,0.25,1,1,0.25,0.3249,0.4356,0.09,1,0.7921,1,0.311214286,0.183671429,0.438757143,18,56.25,18,56.25,3,37.5,5,62.5,4,50,6,75,14,87.5,4,25,78.34,61.75,88.38,84,79.25,81,75.69,0,22.09,24.25,25.88,34,4.25,-6.5,50.69,0,1,0,0,0,0,0,0,1,1,0,2,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0.2,0.4,0.6,0.4,0.2,0.4,0.2,0.8,0.4,0.4,1,1,0,0,0,0,0,10 cents,5 minutes,15 days,Male,University - Undergraduate,50,1.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,1,0,0,-1,-1,0,-1,1,1,0,2,0,1,-1,0,-1,-1,0,0,0,0,0.4,-0.4,0,C_Ug +640,R_6CsOtPiUGljnF6x,46 - 52,Canadian,Male,3,3,3,1,-2,-3,0,2,-2,1,3,-1,3,1,-1,0,0,-1,-1,0,3,3,3,0,-2,10,1,0,3,-3,1,7,3,0,3,3,1,8,0,1,1,1,-2,10,3,3,3,2,0,10,-2,-2,3,-3,0,9,3,0,3,3,3,7,1,1,0,3,-1,10,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,59,TRUE,1,86,FALSE,1,65,TRUE,1,100,TRUE,1,91,TRUE,1,86,TRUE,1,100,TRUE,0,76,TRUE,0,100,FALSE,0,85,TRUE,0,100,TRUE,1,59,TRUE,1,100,FALSE,1,75,TRUE,0,100,FALSE,1,70,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,84,TRUE,1,100,TRUE,0,77,TRUE,0,94,TRUE,0,95,TRUE,1,85,TRUE,1,75,TRUE,1,100,0.0081,0,0,0,0,0.1225,0,0,0,0,0.0225,0.7225,0.0196,0.5776,0.0196,0,1,0.1681,0.8836,0.7056,0.01,0.1681,0.09,1,0.0625,0.5929,0.0625,0,0.7396,1,0.9025,1,0.352489286,0.189457143,0.515521429,23,71.88,21,65.63,6,75,5,62.5,5,62.5,5,62.5,15,93.75,6,37.5,88.69,75.25,87,98,94.5,91.06,86.31,6.25,23.06,0.25,24.5,35.5,32,-2.69,48.81,0,0,0,1,0,4,0,1,1,0,0,1,0,2,2,0,1,2,2,2,0,0,0,1,2,1,2,1,1,1,0,1,0,2,4,1,1,1,4,1,0.2,1.2,1,1.4,0.6,1.2,1.4,1.6,0.95,1.2,8.33,8.67,0,-2,1,0,-0.34,10 cents,100 minutes,47 days,Male,High School (or equivalent),46,1.625,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,-2,3,-2,0,0,-1,0,0,0,0,-2,-1,0,1,-2,1,-0.4,0,-0.4,-0.2,-0.25,HS_TS +641,R_5JPSmdojOMKyeDn,46 - 52,American,Male,2,2,2,-2,2,2,-2,2,-2,2,2,0,2,2,2,1,0,0,1,-1,0,2,2,-2,-1,8,2,-2,2,-2,2,0,2,1,2,1,2,6,-1,-1,1,-1,-2,7,2,2,2,-2,2,3,2,-2,2,-2,2,3,2,0,2,0,2,1,0,0,1,1,-2,5,TRUE,0,100,TRUE,1,97,TRUE,0,100,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0.0361,0.0009,0.25,0.25,0,1,0,0.25,1,1,0.25,1,0,1,1,1,1,0,0.331678571,0.056214286,0.607142857,29,90.63,22,68.75,6,75,5,62.5,4,50,7,87.5,16,100,6,37.5,91.5,80.88,85.12,100,100,95.5,87.5,21.88,22.75,5.88,22.62,50,12.5,-4.5,50,2,0,0,0,3,0,0,0,0,0,0,1,0,1,0,2,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,1,0,1,1,0,0.4,1.4,0,0,0.4,0.6,0.7,0.25,4.67,2.33,5,-3,5,2,2.34,10 cents,25 minutes,24 days,Male,University - Undergraduate,46,0.75,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,0,0,0,3,0,0,0,0,0,0,1,0,-1,0,1,1,0,2,0,1,0,0,0.8,0.45,C_Ug +642,R_66fHMN8Wm3HAbGa,39 - 45,Canadian,Male,3,1,2,-2,0,-2,0,2,1,1,1,-2,2,0,2,-2,0,-2,-2,-2,2,1,2,-2,0,1,-2,-2,2,1,1,1,1,-2,2,0,2,2,-2,0,-2,-2,-2,2,2,2,2,-2,-1,2,-2,-1,2,1,1,2,1,-2,2,0,2,2,-2,-1,-2,-2,-2,2,FALSE,1,95,TRUE,1,60,TRUE,0,90,FALSE,1,60,TRUE,1,95,FALSE,1,100,TRUE,1,95,TRUE,1,95,TRUE,1,55,TRUE,1,95,FALSE,1,50,TRUE,0,56,FALSE,0,65,FALSE,1,100,FALSE,0,56,TRUE,1,95,FALSE,1,65,TRUE,0,100,FALSE,1,56,FALSE,1,50,TRUE,1,100,TRUE,1,92,FALSE,1,92,TRUE,1,94,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,1,80,FALSE,1,75,TRUE,1,85,TRUE,1,74,TRUE,1,100,0.0025,0.04,0.0025,0.0025,0,0,0.0036,0.0025,0.25,0.0064,0.0225,0.4225,0.2025,0.25,0.0025,0.16,0.0064,0.16,0.04,0,0,0.3136,0.1936,0,0.1225,0.25,0.0676,0.0025,0.81,1,0.0625,0.3136,0.1666,0.10635,0.22685,23,71.88,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,79.84,57.62,86.5,94.62,80.62,83.5,76.19,-12.5,-4.54,-29.88,-1,7.12,5.62,-4,-5.06,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.2,0.4,0,0,0.6,0.2,0,0.2,0.15,0.25,1.33,2,-1,-1,0,0,-0.67,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,42,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,-1,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,-1,0,0,0,-0.4,0.2,0,-0.2,-0.1,C_Ug +643,R_731ZPU2UTKGHQaQ,39 - 45,Canadian,Male,0,2,1,0,2,1,-1,1,-1,3,0,-1,1,1,1,0,1,1,1,0,-1,1,-1,0,0,8,2,0,2,0,3,8,0,0,1,1,1,7,1,1,2,2,1,7,0,1,0,0,1,7,1,-1,1,-1,3,6,0,-1,1,1,1,8,1,1,2,2,1,6,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,84,FALSE,0,50,TRUE,1,50,TRUE,1,71,TRUE,0,50,TRUE,0,50,TRUE,1,82,TRUE,0,89,TRUE,1,88,TRUE,1,83,FALSE,1,58,FALSE,1,69,TRUE,0,62,TRUE,0,50,TRUE,1,80,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,58,FALSE,1,50,FALSE,1,100,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,1,50,0.25,0.1764,0.0289,0.0256,0.25,0,0,0.0841,0.25,0,1,0.0324,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.04,0.0144,0.3844,0.7921,0.1764,0.25,0.25,0,0.25,0.0961,0.25,0.25,0.218567857,0.222607143,0.214528571,17,53.13,19,59.38,4,50,6,75,6,75,3,37.5,12,75,7,43.75,67.94,56.25,65,77.62,72.88,71.62,64.25,-6.25,8.56,6.25,-10,2.62,35.38,-3.38,20.5,1,1,2,0,2,1,1,1,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1.2,0.8,0.2,0.8,0.6,0,0,0.8,0.75,0.35,7.67,7,1,2,-1,1,0.67,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),43,1.75,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,1,0,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0.6,0.8,0.2,0,0.4,grad_prof +644,R_1dDRjpFlZ4n0twm,46 - 52,Canadian,Male,-3,2,2,2,-2,-2,1,2,2,-3,2,2,2,2,-3,-3,-1,-2,-1,-2,-2,0,2,-1,0,4,-2,1,2,1,-2,4,1,1,1,1,0,4,-2,-2,-2,0,-3,2,-2,2,2,2,-1,1,-3,2,0,2,-3,1,2,3,2,2,-2,2,-3,-2,-2,-2,-2,1,FALSE,1,80,FALSE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,60,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,TRUE,0,60,FALSE,1,60,TRUE,1,85,FALSE,1,100,TRUE,1,95,TRUE,1,85,TRUE,0,60,FALSE,1,100,TRUE,0,65,FALSE,1,50,TRUE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,60,TRUE,0,95,TRUE,1,90,FALSE,0,90,TRUE,1,100,0,0,0.0225,0,0,0.1225,0.01,0,0.25,0.0225,0.01,0.0225,0.3025,0.36,0.36,0.25,0,0.25,0.16,0,0,0.0025,0.4225,0,0.36,0.25,0.81,0.04,0,0,0.9025,0.16,0.180982143,0.14,0.221964286,20,62.5,24,75,3,37.5,5,62.5,8,100,8,100,12,75,12,75,80.62,64.38,83.12,95.62,79.38,86.56,74.69,-12.5,5.62,26.88,20.62,-4.38,-20.62,11.56,-0.31,1,2,0,3,2,0,0,0,1,1,1,1,1,1,3,1,1,0,1,1,1,0,0,0,1,1,1,2,0,0,0,1,0,0,1,0,1,0,1,0,1.6,0.4,1.4,0.8,0.4,0.8,0.4,0.4,1.05,0.5,4,1.33,3,3,2,1,2.67,10 cents,25 minutes,24 days,Male,University - Undergraduate,48,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,2,0,3,1,-1,-1,-2,1,1,1,0,1,1,2,1,0,0,0,1,1.2,-0.4,1,0.4,0.55,C_Ug +645,R_6I70FHN36RzXTsR,46 - 52,American,Male,0,3,-2,0,0,-3,0,0,0,-2,1,0,2,0,2,-1,-1,0,-1,-1,1,3,1,-1,0,3,-3,0,0,0,0,0,1,0,2,2,2,2,0,0,1,0,-1,7,0,3,-2,1,0,1,-3,0,0,0,0,1,1,0,2,0,3,1,-1,0,0,-1,-1,5,TRUE,0,60,TRUE,1,80,TRUE,0,70,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,70,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,FALSE,1,75,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,1,75,FALSE,1,90,TRUE,1,75,TRUE,0,50,FALSE,1,75,TRUE,0,75,FALSE,0,50,FALSE,0,50,TRUE,1,75,0,0.0625,0,0.09,0.0625,0,0.0625,0.25,0.25,0,0.25,0,0.09,0.25,0.0625,0.04,0.0625,0.25,0.0625,0.01,0.25,0.25,0.25,0.25,0.0625,0.25,0.25,0.36,0.49,0.0625,0.5625,0,0.169285714,0.116428571,0.222142857,16,50,21,65.63,5,62.5,6,75,5,62.5,5,62.5,11,68.75,10,62.5,70.78,56.25,78.12,71.25,77.5,73.12,68.44,-15.63,5.15,-6.25,3.12,8.75,15,4.37,5.94,1,0,3,1,0,0,0,0,0,2,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,1,0,1,0,0,0,1,0.4,0.4,0.8,0.2,0.4,0.2,0.2,0.65,0.25,1.67,1,2,-1,1,2,0.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,49,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,1,0,3,0,0,0,0,0,0,0,0,0,0,2,-1,1,0,1,1,0,0.8,0,0.2,0.6,0.4,C_Ug +646,R_7KrrcA7c2ET46vs,46 - 52,Canadian,Male,3,3,3,1,2,-2,2,-2,3,1,3,3,3,-2,3,-3,-3,-3,-1,-3,3,3,3,0,2,5,2,-1,3,2,3,3,3,3,3,1,3,7,-1,-1,-1,-2,-1,7,3,3,3,3,3,3,2,-1,2,-1,3,6,3,3,3,-3,3,7,-2,-1,0,0,-3,7,TRUE,0,100,FALSE,0,100,TRUE,0,84,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,64,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,59,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,0,0,0,0,0,1,0,1,0,0.25,0,0.5625,0,0.1296,1,1,0.1849,0.3481,0,1,0.7056,1,1,0,0.336810714,0.178571429,0.49505,25,78.13,22,68.75,4,50,7,87.5,4,50,7,87.5,15,93.75,7,43.75,91.84,84.12,88.38,96.88,98,97.75,85.94,9.38,23.09,34.12,0.88,46.88,10.5,4,42.19,0,0,0,1,0,4,3,5,1,2,0,0,0,3,0,2,2,2,1,2,0,0,0,2,1,4,3,4,4,2,0,0,0,1,0,1,2,3,1,0,0.2,3,0.6,1.8,0.6,3.4,0.2,1.4,1.4,1.4,5,5.33,2,-3,0,0,-0.33,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),51,1.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,-1,0,0,1,-3,0,0,0,0,2,0,1,0,-1,0,2,-0.4,-0.4,0.4,0.4,0,grad_prof +647,R_7BW7avPLZO34zke,32 - 38,Canadian,Male,1,0,-2,1,-2,-3,0,0,0,-1,-1,1,1,0,1,1,1,1,0,0,0,1,2,-2,-1,6,-2,0,-1,0,0,5,0,-2,1,1,1,4,-2,1,0,-1,0,6,0,0,-2,0,-2,4,-2,0,0,0,-1,5,0,1,1,0,1,6,0,0,0,0,0,5,FALSE,1,85,TRUE,1,65,TRUE,0,55,TRUE,0,55,TRUE,1,65,TRUE,0,65,TRUE,1,70,TRUE,1,75,TRUE,1,60,TRUE,1,65,TRUE,0,60,FALSE,1,60,TRUE,1,60,TRUE,0,55,TRUE,1,55,TRUE,1,75,TRUE,0,55,TRUE,0,75,FALSE,1,65,FALSE,1,70,FALSE,0,70,TRUE,1,90,FALSE,1,75,TRUE,1,65,FALSE,1,60,TRUE,1,60,TRUE,0,55,TRUE,0,55,TRUE,0,59,TRUE,1,80,FALSE,0,70,TRUE,1,85,0.0625,0.16,0.0625,0.09,0.0225,0.4225,0.1225,0.1225,0.09,0.01,0.04,0.16,0.16,0.36,0.1225,0.1225,0.0625,0.3025,0.3025,0.16,0.49,0.2025,0.1225,0.3025,0.3025,0.3025,0.49,0.0225,0.3025,0.5625,0.3481,0.16,0.221092857,0.151428571,0.290757143,8,25,20,62.5,4,50,4,50,6,75,6,75,14,87.5,6,37.5,66.06,60.62,66.75,70,66.88,69.38,62.75,-37.5,3.56,10.62,16.75,-5,-8.12,-18.12,25.25,1,1,4,3,1,1,0,1,0,1,1,3,0,1,0,3,0,1,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,1,1,0,0,2,0.6,1,1,0.4,0.2,0.2,0.6,1.15,0.35,5,5,2,0,-2,1,0,5 cents,5 minutes,24 days,Male,University - Undergraduate,35,0.25,1,1,0,0,0,1,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,1,4,2,1,0,0,1,0,1,0,3,0,1,0,2,-1,0,1,0,1.6,0.4,0.8,0.4,0.8,C_Ug +648,R_6P05gacJmqYglwn,32 - 38,Canadian,Male,3,3,3,2,2,0,-2,2,-1,2,3,3,2,0,2,3,2,2,2,2,2,3,2,3,2,8,1,-2,1,-3,2,8,2,3,2,0,2,8,2,1,2,2,3,8,2,3,2,2,3,8,2,1,2,-3,1,8,2,2,1,2,2,8,2,2,2,3,2,8,TRUE,0,76,TRUE,1,66,TRUE,0,64,FALSE,1,83,TRUE,1,98,FALSE,1,95,TRUE,1,67,TRUE,1,96,TRUE,1,74,TRUE,1,96,FALSE,1,100,TRUE,0,92,FALSE,0,92,FALSE,1,88,FALSE,0,87,TRUE,1,96,TRUE,0,93,FALSE,1,86,TRUE,0,93,FALSE,1,91,FALSE,0,96,FALSE,0,88,FALSE,1,97,FALSE,0,92,FALSE,1,81,TRUE,1,91,FALSE,1,95,FALSE,1,96,TRUE,0,85,FALSE,0,84,FALSE,0,86,FALSE,0,87,0.0016,0.0081,0.0016,0.1089,0.7569,0.0025,0.8464,0.0016,0.0081,0.7744,0.7056,0.8464,0.0676,0,0.0004,0.1156,0.0009,0.0289,0.0016,0.0361,0.9216,0.7569,0.8649,0.0144,0.8649,0.0025,0.7396,0.5776,0.4096,0.0196,0.7225,0.8464,0.390482143,0.296807143,0.484157143,23,71.88,18,56.25,5,62.5,3,37.5,6,75,4,50,8,50,10,62.5,87.84,85.5,92.88,84.12,88.88,87.25,88.44,15.63,31.59,23,55.38,9.12,38.88,37.25,25.94,1,0,1,1,0,1,0,1,2,0,1,0,0,0,0,1,1,0,0,1,1,0,1,0,1,2,3,0,2,1,1,1,1,2,0,1,0,0,1,0,0.6,0.8,0.2,0.6,0.6,1.6,1,0.4,0.55,0.9,8,8,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),37,0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,1,-1,-1,-3,1,0,-1,0,-1,-1,-2,0,0,1,0,-1,1,0,-0.8,-0.8,0.2,-0.35,grad_prof +649,R_7XuMXfNpMkp9lJf,32 - 38,Canadian,Male,1,3,2,-2,0,3,-3,2,-3,0,3,2,3,2,3,1,3,1,1,1,3,3,3,-3,-2,0,3,3,3,3,0,0,3,3,3,3,3,0,3,2,1,1,3,0,1,3,3,-3,-3,0,0,0,0,-1,-1,0,2,3,0,-3,3,0,2,-2,3,3,2,8,FALSE,1,100,TRUE,1,52,TRUE,0,50,FALSE,1,86,FALSE,0,54,FALSE,1,95,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,91,FALSE,1,50,FALSE,1,97,TRUE,1,64,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,51,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,93,0.25,0.25,0.25,0.25,0.0049,0.0025,0.25,0.0081,0.25,0.25,0.25,0.1296,0.25,0.25,0.2916,0.2304,0,0.0196,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.2601,0.25,0.0009,0.185632143,0.156192857,0.215071429,28,87.5,16,50,5,62.5,6,75,3,37.5,2,25,4,25,12,75,60.41,54.75,69.5,61.5,55.88,56.5,64.31,37.5,10.41,-7.75,-5.5,24,30.88,31.5,-10.69,2,0,1,1,2,0,6,1,6,0,0,1,0,1,0,2,1,0,0,2,0,0,1,1,3,3,3,2,2,1,1,1,3,5,0,1,5,2,2,1,1.2,2.6,0.4,1,1,2.2,2,2.2,1.3,1.85,0,0,0,0,0,-8,0,5 cents,100 minutes,47 days,Male,High School (or equivalent),35,1,1,0,1,0,1,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,2,0,0,0,-1,-3,3,-1,4,-1,-1,0,-3,-4,0,1,-4,-2,-2,1,0.2,0.4,-1.6,-1.2,-0.55,HS_TS +650,R_7BbvZqPsCnAtPHL,53 - 59,American,Male,0,0,3,2,1,2,-3,2,-3,3,1,-3,2,-3,3,-3,-3,-3,-3,-3,2,1,1,-1,-1,7,3,2,2,1,3,7,-2,-3,2,-2,3,7,1,1,1,1,-2,8,3,1,3,3,-3,7,-1,-2,2,-2,2,4,2,-3,2,-3,3,7,-3,-3,0,-3,-3,9,TRUE,0,100,TRUE,1,100,TRUE,0,88,FALSE,1,60,FALSE,0,93,FALSE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,90,TRUE,1,100,FALSE,1,99,FALSE,0,58,TRUE,1,100,FALSE,1,95,FALSE,1,100,TRUE,0,97,FALSE,1,91,FALSE,0,100,TRUE,1,100,FALSE,1,55,TRUE,1,75,TRUE,0,89,TRUE,1,100,FALSE,1,55,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,0,0,0,0.0081,0.0625,0,0.0081,0,0,0,0,0.5625,0.8649,0,0.2025,0.16,0,0.7921,1,0.3364,0.9409,0.0001,0.0025,0.2025,0.3025,1,0.7744,0,1,0.81,0.3225,0.133471429,0.511528571,24,75,21,65.63,4,50,5,62.5,6,75,6,75,12,75,9,56.25,89.56,75,91.75,98.5,93,92.56,86.56,9.37,23.93,25,29.25,23.5,18,17.56,30.31,2,1,2,3,2,1,5,0,4,0,3,0,0,1,0,4,4,4,4,1,3,1,0,1,4,3,1,0,1,1,1,0,0,0,0,0,0,3,0,0,2,2,0.8,3.4,1.8,1.2,0.2,0.6,2.05,0.95,7,6,0,3,0,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),59,2,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,-1,0,2,2,-2,-2,4,0,3,-1,2,0,0,1,0,4,4,1,4,1,0.2,0.8,0.6,2.8,1.1,HS_TS +651,R_3ClE7IcIuk4W5XQ,53 - 59,American,Male,3,3,2,0,2,-1,-2,1,-1,1,0,1,2,0,2,0,0,1,1,-3,3,3,1,-2,3,7,-2,0,1,-2,0,3,2,1,2,1,2,5,1,2,1,1,2,8,3,3,0,1,0,5,-1,-1,1,-2,0,3,0,0,2,0,2,5,-1,-1,-1,-1,-3,8,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,54,TRUE,1,100,FALSE,1,76,TRUE,1,94,TRUE,1,98,TRUE,1,87,TRUE,1,98,FALSE,1,95,TRUE,0,98,FALSE,0,79,TRUE,0,79,TRUE,1,77,TRUE,1,99,TRUE,0,69,FALSE,1,85,FALSE,1,92,FALSE,1,99,FALSE,0,73,TRUE,1,84,FALSE,1,98,TRUE,1,92,FALSE,1,60,TRUE,1,98,FALSE,1,94,FALSE,1,93,TRUE,0,86,TRUE,1,92,FALSE,0,50,TRUE,1,98,0.0004,0.0004,0.0001,0.0036,0.0004,0.0576,0.0064,0.0004,0.0001,0.0256,0.0064,0.6241,0.0169,0.0025,0,0.01,0.0004,0.2116,0.0049,0.16,0.5329,0.0529,0.0064,0.6241,0.4761,0.0036,0.25,0,1,0.0225,0.7396,0.9604,0.206992857,0.068742857,0.345242857,24,75,24,75,7,87.5,4,50,7,87.5,6,75,13,81.25,11,68.75,87.09,79.88,84.88,87.25,96.38,88.06,86.12,0,12.09,-7.62,34.88,-0.25,21.38,6.81,17.37,0,0,1,2,1,1,2,0,1,1,2,0,0,1,0,1,2,0,0,5,0,0,2,1,2,0,1,0,1,1,0,1,0,0,0,1,1,2,2,0,0.8,1,0.6,1.6,1,0.6,0.2,1.2,1,0.75,5,4.33,2,0,0,0,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),57,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,0,-1,1,-1,1,1,0,0,0,2,-1,0,1,0,0,1,-2,-2,5,-0.2,0.4,0.4,0.4,0.25,HS_TS +652,R_7vk59A621u2tiiO,46 - 52,American,Male,1,0,-1,-2,2,-2,0,3,1,-1,3,0,1,1,0,-1,-1,1,1,-1,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,6,0,-1,0,-2,1,6,0,0,0,0,0,6,0,0,0,0,1,6,0,0,0,0,0,5,FALSE,1,77,FALSE,0,54,TRUE,0,72,FALSE,1,78,FALSE,0,52,FALSE,1,57,TRUE,1,52,FALSE,0,54,FALSE,0,53,TRUE,1,97,FALSE,1,55,TRUE,0,87,TRUE,1,73,TRUE,0,52,FALSE,0,53,FALSE,0,56,TRUE,0,71,TRUE,0,85,FALSE,1,54,FALSE,1,87,FALSE,0,81,TRUE,1,65,FALSE,1,77,FALSE,0,56,FALSE,1,55,FALSE,0,55,FALSE,1,57,FALSE,1,50,FALSE,1,54,FALSE,0,68,TRUE,1,56,FALSE,0,55,0.2916,0.3025,0.3136,0.2304,0.3025,0.1849,0.3136,0.0009,0.0169,0.1225,0.4624,0.0729,0.2809,0.2025,0.2704,0.2916,0.0529,0.0484,0.25,0.2025,0.6561,0.2809,0.2116,0.2704,0.5041,0.1849,0.1936,0.0529,0.5184,0.7225,0.2116,0.7569,0.272846429,0.187378571,0.358314286,10,31.25,16,50,5,62.5,4,50,5,62.5,2,25,5,31.25,11,68.75,64,57.5,65,67.25,66.25,61.25,66.75,-18.75,14,-5,15,4.75,41.25,30,-2,1,0,1,2,2,2,0,3,1,1,3,0,1,1,0,1,1,1,1,1,1,1,1,0,1,2,0,3,1,1,3,0,1,1,1,1,1,1,1,1,1.2,1.4,1,1,0.8,1.4,1.2,1,1.15,1.1,5.33,6,0,-1,-1,1,-0.67,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,51,0.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,-1,0,2,1,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0.4,0,-0.2,0,0.05,C_Ug +653,R_5AqyTyOrKkGLL4R,53 - 59,American,Male,3,3,3,3,3,1,-2,3,1,0,3,3,2,1,3,1,0,2,2,2,3,3,3,3,3,2,-1,-2,3,-3,0,3,3,3,2,-1,1,5,1,1,1,1,0,3,3,3,3,3,3,5,0,-2,3,0,2,6,3,3,2,0,3,6,1,1,2,1,1,5,TRUE,0,73,TRUE,1,70,TRUE,0,61,FALSE,1,76,FALSE,0,53,TRUE,0,57,TRUE,1,90,TRUE,1,78,FALSE,0,53,TRUE,1,82,FALSE,1,82,FALSE,1,77,FALSE,0,80,TRUE,0,61,FALSE,0,58,TRUE,1,62,FALSE,1,77,FALSE,1,74,FALSE,1,54,FALSE,1,62,FALSE,0,100,TRUE,1,60,FALSE,1,59,TRUE,1,59,TRUE,0,65,TRUE,1,80,TRUE,0,68,FALSE,1,70,TRUE,0,62,TRUE,1,100,TRUE,1,70,FALSE,0,76,0.0484,0.04,0.1444,0.01,0.5776,0.3249,0.1681,0.0324,0.1444,0.16,0,0.64,0.2809,0.0324,0.2809,0.09,0.1681,0.0576,0.09,0.4225,1,0.3364,0.2116,0.3721,0.0529,0.4624,0.09,0.5329,0.3721,0.0676,0.3844,0.0529,0.264467857,0.211235714,0.3177,15,46.88,19,59.38,5,62.5,2,25,5,62.5,7,87.5,10,62.5,9,56.25,70.28,66.38,70.5,73.12,71.12,73.19,67.38,-12.5,10.9,3.88,45.5,10.62,-16.38,10.69,11.13,0,0,0,0,0,2,0,0,4,0,0,0,0,2,2,0,1,1,1,2,0,0,0,0,0,1,0,0,1,2,0,0,0,1,0,0,1,0,1,1,0,1.2,0.8,1,0,0.8,0.2,0.6,0.75,0.4,3.33,5.67,-3,-3,-1,-2,-2.34,10 cents,75 minutes,24 days,Male,Trade School (non-military),55,0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,1,0,0,3,-2,0,0,0,1,2,0,0,1,0,1,0,0.4,0.6,0.4,0.35,HS_TS +654,R_7uOZIAqY9LEalrz,39 - 45,Canadian,Male,0,0,0,0,2,-1,-1,1,-1,-1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,8,-1,-1,-1,-1,-1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,FALSE,1,69,TRUE,1,76,TRUE,0,74,TRUE,0,77,TRUE,1,73,FALSE,1,73,FALSE,0,70,FALSE,0,66,FALSE,0,67,TRUE,1,72,FALSE,1,69,TRUE,0,72,TRUE,1,73,TRUE,0,76,FALSE,0,65,TRUE,1,78,TRUE,0,69,FALSE,1,67,FALSE,1,64,TRUE,0,71,FALSE,0,79,TRUE,1,74,FALSE,1,67,TRUE,1,65,FALSE,1,68,FALSE,0,69,FALSE,1,69,TRUE,0,91,FALSE,1,70,TRUE,1,91,TRUE,1,70,FALSE,0,70,0.4356,0.4761,0.0484,0.49,0.49,0.0729,0.1225,0.0784,0.5041,0.0676,0.0081,0.0729,0.4489,0.0961,0.0729,0.0576,0.1089,0.5929,0.8281,0.1024,0.6241,0.4225,0.1296,0.5776,0.4761,0.0961,0.09,0.0961,0.5476,0.1089,0.09,0.5184,0.267903571,0.199557143,0.33625,20,62.5,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,9,56.25,9,56.25,72,69.62,71.75,70.62,76,72.38,71.62,6.25,15.75,7.12,9.25,8.12,38.5,16.13,15.37,1,1,1,1,1,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,2,2,0,2,2,0,0,0,0,1,0,0,0,0,0,1,0.4,0.2,0,1,1.6,0.2,0,0.4,0.7,8,8,0,0,0,0,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,40,0,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,-2,-2,2,-2,-2,0,0,0,0,0,0,0,0,0,0,0,-1.2,0,0,-0.3,C_Ug +655,R_1w66l8DC239XPIO,39 - 45,Canadian,Male,-3,1,0,3,2,0,-3,2,-3,1,3,0,2,-3,2,-1,1,1,0,-3,-3,1,-2,3,3,8,0,-3,1,-3,2,8,3,1,0,-3,2,7,1,1,2,2,-2,8,-3,2,0,3,2,5,0,-3,2,-3,1,8,3,0,0,-3,2,7,1,1,2,2,-2,9,FALSE,1,80,TRUE,1,97,TRUE,0,96,FALSE,1,65,TRUE,1,91,TRUE,0,87,TRUE,1,93,FALSE,0,59,TRUE,1,84,TRUE,1,92,FALSE,1,57,TRUE,0,100,TRUE,1,86,FALSE,1,59,TRUE,1,76,TRUE,1,100,FALSE,1,69,TRUE,0,100,FALSE,1,92,FALSE,1,74,FALSE,0,63,TRUE,1,94,TRUE,0,69,FALSE,0,53,TRUE,0,91,TRUE,1,82,FALSE,1,53,FALSE,1,93,FALSE,1,50,TRUE,1,75,TRUE,1,54,TRUE,1,53,0.3481,0.0324,0,0.0049,0.2209,0.7569,0.2809,0.0064,0.0676,0.0036,0.0625,0.0196,0.0256,0.1849,0.0081,0.0009,0.4761,0.1225,0.0049,0.8281,0.3969,0.0576,0.0064,0.1681,0.0961,0.2209,0.2116,0.04,0.9216,1,0.25,1,0.265667857,0.15975,0.371585714,9,28.13,23,71.88,8,100,5,62.5,6,75,4,50,13,81.25,10,62.5,77.72,72.25,71,86.38,81.25,78.25,77.19,-43.75,5.84,-27.75,8.5,11.38,31.25,-3,14.69,0,0,2,0,1,0,0,1,0,1,0,1,2,0,0,2,0,1,2,1,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,1,2,1,0.6,0.4,0.6,1.2,0.2,0,0.4,1.2,0.7,0.45,7.67,6.67,3,0,0,-1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,45,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,-1,2,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0.4,0.4,0.2,0,0.25,C_Ug +656,R_6nUsAJTWZgp44VO,25 - 31,Canadian,Male,1,3,3,2,3,1,-2,3,-1,3,0,1,3,0,2,0,1,1,2,-1,-2,3,3,1,-1,8,-2,-2,1,-2,2,7,-2,-2,2,2,2,7,3,2,2,2,3,8,2,2,2,1,1,4,2,-2,2,-2,2,7,1,1,2,1,2,8,2,1,2,2,2,8,FALSE,1,69,TRUE,1,60,FALSE,1,76,TRUE,0,80,FALSE,0,54,TRUE,0,82,TRUE,1,86,FALSE,0,56,TRUE,1,62,TRUE,1,84,FALSE,1,82,TRUE,0,85,FALSE,0,81,FALSE,1,85,TRUE,1,88,TRUE,1,74,FALSE,1,79,TRUE,0,72,TRUE,0,85,FALSE,1,89,TRUE,1,79,TRUE,1,84,FALSE,1,77,TRUE,1,81,FALSE,1,74,TRUE,1,79,TRUE,0,78,TRUE,0,100,FALSE,1,86,TRUE,1,92,FALSE,0,64,TRUE,1,93,0.3136,0.0441,0.0676,0.0196,0.0049,0.6724,0.0361,0.0256,0.0121,0.0256,0.0064,0.6561,0.1444,0.0324,0.2916,0.16,0.0529,0.64,1,0.0676,0.0441,0.0144,0.7225,0.0225,0.0441,0.6084,0.4096,0.0961,0.0576,0.5184,0.0196,0.7225,0.253853571,0.197178571,0.310528571,15,46.88,21,65.63,4,50,5,62.5,7,87.5,5,62.5,12,75,9,56.25,78.62,74.88,78.88,79.12,81.62,76.06,81.19,-18.75,12.99,24.88,16.38,-8.38,19.12,1.06,24.94,3,0,0,1,4,3,0,2,1,1,2,3,1,2,0,3,1,1,0,4,1,1,1,1,2,1,0,1,1,1,1,0,1,1,0,2,0,1,0,3,1.6,1.4,1.6,1.8,1.2,0.8,0.6,1.2,1.6,0.95,7.33,6.33,4,0,-1,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,2,-1,-1,0,2,2,0,1,0,0,1,3,0,1,0,1,1,0,0,1,0.4,0.6,1,0.6,0.65,C_Ug +657,R_8yfGtl8dxbEotbe,39 - 45,American,Male,-1,3,3,0,1,1,0,1,-2,0,2,0,-2,2,-1,-1,0,-1,2,-2,2,-2,2,0,2,3,1,-2,-1,-1,3,5,-2,-3,1,1,-2,8,-2,2,0,2,-2,6,2,1,-2,0,-3,4,0,-1,-1,-2,0,7,0,-3,2,2,0,8,1,1,2,-1,2,3,FALSE,1,66,FALSE,0,83,TRUE,0,96,TRUE,0,57,FALSE,0,64,FALSE,1,78,TRUE,1,62,TRUE,1,66,TRUE,1,66,TRUE,1,88,TRUE,0,77,FALSE,1,59,FALSE,0,61,TRUE,0,92,FALSE,0,77,TRUE,1,88,TRUE,0,90,FALSE,1,83,TRUE,0,75,FALSE,1,67,TRUE,1,89,TRUE,1,76,TRUE,0,83,FALSE,0,57,FALSE,1,88,FALSE,0,73,FALSE,1,61,TRUE,0,86,FALSE,1,60,TRUE,1,84,TRUE,1,65,FALSE,0,56,0.1156,0.5329,0.0144,0.1444,0.3136,0.0484,0.3249,0.0144,0.1089,0.0576,0.0256,0.3721,0.1156,0.5929,0.4096,0.6889,0.6889,0.3249,0.7396,0.0144,0.0121,0.5929,0.5625,0.8464,0.81,0.1521,0.1225,0.1156,0.9216,0.0289,0.16,0.1681,0.333321429,0.291878571,0.374764286,13,40.63,17,53.13,3,37.5,3,37.5,6,75,5,62.5,9,56.25,8,50,74.16,70.12,72.62,78.5,75.38,72.19,76.12,-12.5,21.03,32.62,35.12,3.5,12.88,15.94,26.12,3,5,1,0,1,0,2,2,1,3,4,3,3,1,1,1,2,1,0,0,3,2,5,0,4,1,1,2,0,0,2,3,4,0,1,2,1,3,3,4,2,1.6,2.4,0.8,2.8,0.8,2,2.6,1.7,2.05,5.33,6.33,-1,-2,0,3,-1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),44,-0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,0,3,-4,0,-3,-1,1,0,1,3,2,0,-1,1,0,-1,1,-2,-3,-4,-0.8,0.8,0.4,-1.8,-0.35,grad_prof +658,R_64RW0hFTd5hbqhP,32 - 38,Canadian,Male,2,1,2,1,2,2,1,1,-2,2,-3,-3,3,-1,3,0,0,1,-1,-1,2,1,2,0,2,1,3,-1,0,-1,3,1,-3,-3,3,-1,3,1,0,-1,0,-1,-1,4,2,2,2,1,2,1,3,-2,1,-1,3,1,-3,-3,3,-1,3,1,0,-1,1,1,-1,2,FALSE,1,60,TRUE,1,55,TRUE,0,66,FALSE,1,70,TRUE,1,90,FALSE,1,93,TRUE,1,74,TRUE,1,54,TRUE,1,78,FALSE,0,51,FALSE,1,71,TRUE,0,62,TRUE,1,72,FALSE,1,89,TRUE,1,53,TRUE,1,97,FALSE,1,59,TRUE,0,85,FALSE,1,51,FALSE,1,99,TRUE,1,51,FALSE,0,51,FALSE,1,71,TRUE,1,78,FALSE,1,97,FALSE,0,59,FALSE,1,51,FALSE,1,52,FALSE,1,51,FALSE,0,52,FALSE,0,52,FALSE,0,58,0.2116,0.3481,0.0009,0.0676,0.3364,0.0049,0.0484,0.2601,0.0001,0.2601,0.2704,0.0784,0.0484,0.0841,0.01,0.2025,0.0841,0.09,0.2304,0.0009,0.2401,0.2209,0.2401,0.0121,0.1681,0.2401,0.2704,0.16,0.4356,0.7225,0.2401,0.3844,0.190842857,0.126992857,0.254692857,25,78.13,23,71.88,7,87.5,7,87.5,4,50,5,62.5,10,62.5,13,81.25,67.25,60.12,68.12,70.75,70,64.06,70.44,6.25,-4.63,-27.38,-19.38,20.75,7.5,1.56,-10.81,0,0,0,1,0,1,2,1,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,1,3,0,1,1,0,0,0,0,0,0,1,0,2,0,0.2,1.2,0,0.4,0.2,1.2,0,0.6,0.45,0.5,1,1,0,0,0,2,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,1.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,0,-1,0,1,0,0,-1,1,0,0,0,0,0,0,0,0,0,1,-2,0,0,0,0,-0.2,-0.05,grad_prof +659,R_5lGxOvHem88IAP7,18 - 24,Canadian,Male,3,2,1,0,2,1,0,2,-2,2,2,0,2,1,3,2,2,2,2,2,3,-2,3,-3,2,8,-2,1,-1,-2,-2,8,2,2,-1,0,2,7,2,2,2,2,2,1,3,2,1,1,2,3,1,-2,3,-3,2,3,2,-1,2,0,3,2,2,2,2,2,2,1,FALSE,1,100,FALSE,0,60,TRUE,0,100,TRUE,0,60,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,80,TRUE,0,86,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,60,TRUE,1,100,TRUE,0,60,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0,1,0,0.7396,0,1,0,0.1225,1,0.25,0.36,0,0.36,1,0.16,0,0,0.64,1,1,0.36,0.36,0,1,1,1,1,0.476860714,0.34515,0.608571429,24,75,16,50,2,25,6,75,6,75,2,25,12,75,4,25,90.03,73.12,93.75,95,98.25,89.69,90.38,25,40.03,48.12,18.75,20,73.25,14.69,65.38,0,4,2,3,0,3,1,3,0,4,0,2,3,1,1,0,0,0,0,0,0,0,0,1,0,0,2,1,1,0,0,1,0,1,0,0,0,0,0,0,1.8,2.2,1.4,0,0.2,0.8,0.4,0,1.35,0.35,7.67,2.67,5,5,5,0,5,10 cents,5 minutes,47 days,Male,High School (or equivalent),18,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,4,2,2,0,3,-1,2,-1,4,0,1,3,0,1,0,0,0,0,0,1.6,1.4,1,0,1,HS_TS +660,R_5WZnCnA5ZMfjqh1,32 - 38,Canadian,Male,2,2,1,2,3,1,2,2,1,2,1,2,3,2,2,1,1,1,2,0,2,3,2,2,3,8,2,3,3,3,3,5,0,0,2,1,2,8,2,2,3,1,1,8,2,2,1,2,3,7,1,2,3,1,2,7,1,2,3,3,2,6,1,1,1,2,0,7,FALSE,1,100,TRUE,1,70,FALSE,1,90,FALSE,1,64,TRUE,1,90,FALSE,1,100,TRUE,1,80,TRUE,1,81,TRUE,1,82,TRUE,1,81,FALSE,1,85,TRUE,0,85,FALSE,0,100,FALSE,1,75,TRUE,1,88,TRUE,1,100,TRUE,0,85,TRUE,0,85,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,61,TRUE,0,70,FALSE,0,50,TRUE,1,100,TRUE,1,100,0.0361,0,0,0.04,0,0,0,0.0361,0,0,0.25,1,0.0324,0.0225,0.01,0.09,0,0.1296,0.3721,0,0,0.0144,0,0.0625,0.7225,0,0,0,0.01,0.7225,0.49,0.7225,0.167396429,0.112185714,0.222607143,18,56.25,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,88.19,86.12,93.12,90.12,83.38,88.88,87.5,-21.88,10.06,-13.88,30.62,2.62,20.88,1.38,18.75,0,1,1,0,0,1,1,1,2,1,1,2,1,1,0,1,1,2,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0.4,1.2,1,1.2,0,0.2,0.2,0,0.95,0.1,7,6.67,1,-2,2,1,0.33,5 cents,5 minutes,47 days,Male,University - PhD,35,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,1,1,0,0,1,1,0,2,1,1,2,1,0,0,1,1,2,1,1,0.4,1,0.8,1.2,0.85,grad_prof +661,R_7hYZBL2Y9z6VkLq,18 - 24,Canadian,Male,1,3,0,2,2,3,1,2,1,2,1,1,2,1,2,0,1,1,3,2,1,3,2,1,2,6,2,3,1,0,1,6,0,2,2,1,1,7,3,1,1,2,2,7,2,2,0,1,2,8,2,2,2,3,0,8,2,2,1,1,-1,8,1,2,1,-1,2,8,TRUE,0,100,FALSE,0,53,TRUE,0,71,FALSE,1,53,FALSE,0,50,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,0,53,TRUE,1,60,TRUE,0,83,TRUE,0,100,TRUE,1,75,FALSE,1,54,FALSE,0,57,TRUE,1,88,TRUE,0,75,TRUE,0,91,FALSE,1,56,TRUE,0,53,FALSE,0,90,TRUE,1,100,TRUE,0,64,TRUE,1,92,TRUE,0,75,TRUE,1,74,FALSE,1,80,FALSE,1,76,FALSE,1,59,FALSE,0,76,FALSE,0,52,FALSE,0,52,0.25,0.0676,0.0144,0.1764,0.2704,0.25,0.0064,0.16,0.2809,0,0.5776,0.0625,0.2809,0.6889,0.25,0.2809,0.4096,0.2209,0.0576,0.5625,0.81,0.3249,0.1936,0.2116,0.5625,0.04,0.2704,1,0.5041,0.8281,0.1681,1,0.366871429,0.267071429,0.466671429,25,78.13,14,43.75,3,37.5,3,37.5,5,62.5,3,37.5,7,43.75,7,43.75,69.38,60.88,64.38,76.5,75.75,67.5,71.25,34.38,25.63,23.38,26.88,14,38.25,23.75,27.5,0,0,2,1,0,1,2,1,1,1,1,1,0,0,1,3,0,0,1,0,1,1,0,1,0,1,1,0,2,2,1,1,1,0,3,1,1,0,4,0,0.6,1.2,0.6,0.8,0.6,1.2,1.2,1.2,0.8,1.05,6.33,8,-2,-2,-1,-1,-1.67,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),23,0.375,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,-1,-1,2,0,0,0,1,1,-1,-1,0,0,-1,0,-2,2,-1,0,-3,0,0,0,-0.6,-0.4,-0.25,grad_prof +662,R_6e4P4G7XkW3QdTX,25 - 31,Canadian,Male,1,1,1,-1,-1,-1,-1,0,1,0,0,-1,1,1,1,1,0,1,1,1,1,1,1,-1,1,0,0,0,0,0,0,10,0,0,1,1,1,6,1,1,1,1,1,5,1,1,1,-1,-1,0,0,0,0,0,0,5,0,-1,1,1,1,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,75,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,76,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,0,71,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,1,0,0.0625,0,0,0.5041,0,0,0,0,0.0576,0,0,0,0.0576,0,1,0.0625,1,1,0,0.5625,0.0625,1,0,1,1,1,0,0.298903571,0.0487,0.549107143,16,50,22,68.75,5,62.5,6,75,5,62.5,6,75,13,81.25,9,56.25,94.47,90.88,90.62,100,96.38,98.44,90.5,-18.75,25.72,28.38,15.62,37.5,21.38,17.19,34.25,0,0,0,0,2,1,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,1,1,0.4,0.6,0.2,0.2,0,0.6,0,0.8,0.35,0.35,5.33,3.33,0,5,1,0,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),27,0.875,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,-1,1,-1,-1,-1,0.4,0,0.2,-0.6,0,HS_TS +663,R_3cAmHE8UALSr7bz,18 - 24,Canadian,Male,3,3,-2,2,-1,1,-3,1,-2,3,2,-1,3,-2,3,2,2,2,1,-3,3,3,-2,-2,-1,2,-3,-1,-3,2,2,2,3,1,-2,2,2,7,1,1,-3,-1,-3,3,3,3,-2,2,1,4,-1,-3,1,-3,2,3,3,-1,3,-3,3,6,1,2,1,1,-2,8,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,80,TRUE,1,100,TRUE,1,95,TRUE,1,50,TRUE,1,80,FALSE,1,80,TRUE,0,100,TRUE,1,70,FALSE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,96,FALSE,1,95,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,50,FALSE,0,70,0.0025,0,0,0,0.49,0.04,0.0016,0.04,0.25,0.25,0,0.09,0.25,0.04,0.25,0.25,1,0.25,0,0.0025,0,0.16,0.25,0,1,0.25,0.25,1,1,0,0.01,1,0.290146429,0.228685714,0.351607143,26,81.25,25,78.13,7,87.5,5,62.5,7,87.5,6,75,15,93.75,10,62.5,80.19,55,82.5,90.62,92.62,76.31,84.06,3.12,2.06,-32.5,20,3.12,17.62,-17.44,21.56,0,0,0,4,0,4,2,4,4,1,1,2,5,4,1,1,1,5,2,0,0,0,0,0,2,2,0,0,1,1,1,0,0,1,0,1,0,1,0,1,0.8,3,2.6,1.8,0.4,0.8,0.4,0.6,2.05,0.55,3.67,4.33,-2,-1,1,-5,-0.66,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,22,1.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,4,-2,2,2,4,3,0,0,2,5,3,1,0,1,4,2,-1,0.4,2.2,2.2,1.2,1.5,C_Ug +664,R_6G9EWfU6MX8l8ZE,32 - 38,Canadian,Male,-1,1,2,1,0,-3,-3,3,-3,-2,-1,0,2,0,3,0,1,2,2,0,-2,3,3,3,0,2,-1,-3,3,-3,0,4,-1,-2,3,0,3,2,-2,0,-2,-2,-2,7,0,1,3,3,2,2,-3,-2,2,-3,0,1,-1,-2,3,-2,3,1,0,0,1,1,-1,4,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,80,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,0,100,TRUE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,TRUE,1,70,TRUE,1,50,0,1,0.25,0,0.25,0,0,0,0.25,0,1,0.64,0.25,0,0.25,0.25,0,0.25,0,0.25,0,0.25,0,1,0.25,0.25,0.09,0.25,1,0,0.25,1,0.276071429,0.224285714,0.327857143,12,37.5,22,68.75,6,75,6,75,5,62.5,5,62.5,11,68.75,11,68.75,78.12,65,72.5,87.5,87.5,78.12,78.12,-31.25,9.37,-10,-2.5,25,25,9.37,9.37,1,2,1,2,0,2,0,0,0,2,0,2,1,0,0,2,1,4,4,2,1,0,1,2,2,0,1,1,0,2,0,2,1,2,0,0,1,1,1,1,1.2,0.8,0.6,2.6,1.2,0.8,1,0.8,1.3,0.95,2.67,1.33,0,3,1,3,1.34,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,36,1.125,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,2,0,0,-2,2,-1,-1,0,0,0,0,0,-2,0,2,0,3,3,1,0,0,-0.4,1.8,0.35,C_Ug +665,R_5mC07SFhmdZHbH7,39 - 45,American,Male,2,3,3,2,1,-1,-1,-1,-2,1,0,-2,1,0,1,-1,-2,-1,-2,-2,2,3,3,2,2,1,-1,-2,0,-2,1,2,0,-2,1,-1,1,2,-1,-2,-1,-1,-1,3,2,3,3,2,2,2,-1,-2,1,-2,1,2,0,-2,1,0,1,2,1,1,1,1,0,5,FALSE,1,100,FALSE,0,56,TRUE,0,76,FALSE,1,58,FALSE,0,56,FALSE,1,55,TRUE,1,76,TRUE,1,77,FALSE,0,63,TRUE,1,81,FALSE,1,58,TRUE,0,100,TRUE,1,57,FALSE,1,57,FALSE,0,59,TRUE,1,88,TRUE,0,65,TRUE,0,82,FALSE,1,61,FALSE,1,85,FALSE,0,87,FALSE,0,65,FALSE,1,60,FALSE,0,54,FALSE,1,100,TRUE,1,85,FALSE,1,57,TRUE,0,71,FALSE,1,53,TRUE,1,80,FALSE,0,58,TRUE,1,85,0.0529,0.0225,0.0144,0.0576,0.0225,0.2025,0.2916,0.0361,0.0225,0.4225,0.04,0.1849,0.3969,0.1764,0.3136,0.3136,0.16,0.1764,0.5041,0,0.7569,0.3481,0.1521,0.1849,0.4225,0.1849,0.3364,0,0.5776,0.6724,0.2209,1,0.290010714,0.197107143,0.382914286,16,50,19,59.38,4,50,5,62.5,6,75,4,50,8,50,11,68.75,70.78,58.75,64.75,80.75,78.88,70.44,71.12,-9.38,11.4,8.75,2.25,5.75,28.88,20.44,2.37,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,2,0,0,0,0,0,0,0,2,3,2,3,2,0.2,0.4,0.2,0.4,0.2,0.6,0,2.4,0.3,0.8,1.67,2,-1,0,0,-2,-0.33,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,45,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,-1,0,0,0,0,0,1,0,-2,-3,-2,-2,-1,0,-0.2,0.2,-2,-0.5,C_Ug +666,R_1yl8kaxHTWxt6lM,53 - 59,American,Male,3,2,3,-1,-1,-3,-1,3,1,-3,2,1,2,0,3,-3,0,-2,-2,-3,1,2,3,-2,-1,1,-3,1,3,2,-2,6,2,2,0,1,3,1,-2,-2,-2,-2,-3,2,3,2,3,-2,-1,2,-2,-1,3,0,-1,3,2,2,2,-1,3,3,-1,-1,-1,-1,-2,4,TRUE,0,91,TRUE,1,98,TRUE,0,96,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,1,60,TRUE,1,90,TRUE,1,96,FALSE,1,56,TRUE,0,60,TRUE,1,75,FALSE,1,62,TRUE,1,88,TRUE,1,82,FALSE,1,77,FALSE,1,100,TRUE,0,55,FALSE,1,100,FALSE,0,82,TRUE,1,76,FALSE,1,100,FALSE,0,56,FALSE,1,91,TRUE,1,92,TRUE,0,56,FALSE,1,54,TRUE,0,81,TRUE,1,70,FALSE,0,51,TRUE,1,97,0.16,0.0064,0.0324,0.0576,0.0009,0,0.3136,0.0016,0,0.0576,0.09,0.0625,0.01,0.1936,0,0.0004,0,0.2304,0.2116,0.0081,0.6724,0.0144,0.3025,0.1444,0.0529,0.3136,0.2601,0.8281,0.9216,0,0.6561,0.36,0.2038,0.068614286,0.338985714,24,75,23,71.88,5,62.5,6,75,7,87.5,5,62.5,13,81.25,10,62.5,78.75,68.25,89,85.5,72.25,80.56,76.94,3.12,6.87,5.75,14,-2,9.75,-0.69,14.44,2,0,0,1,0,0,2,0,1,1,0,1,2,1,0,1,2,0,0,0,0,0,0,1,0,1,0,0,1,2,0,1,0,1,0,2,1,1,1,1,0.6,0.8,0.8,0.6,0.2,0.8,0.4,1.2,0.7,0.65,2.67,2.67,-1,3,-2,-2,0,5 cents,100 minutes,15 days,Male,High School (or equivalent),53,0.875,1,0,0,0,1,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,2,0,0,0,0,-1,2,0,0,-1,0,0,2,0,0,-1,1,-1,-1,-1,0.4,0,0.4,-0.6,0.05,HS_TS +667,R_3HvAsPu6RolGbO9,46 - 52,Canadian,Male,-2,1,0,-1,1,-2,1,1,-1,0,-1,1,2,-1,-1,-2,-2,-2,-2,-2,-2,2,1,-2,2,3,-2,1,1,-1,1,4,-1,1,0,-1,-1,3,-2,-2,-2,-2,-2,6,-2,1,0,1,2,3,-1,-1,-1,-1,-1,4,-1,-1,-1,0,-1,3,-2,-2,-2,-2,-3,3,TRUE,0,90,TRUE,1,100,TRUE,0,59,TRUE,0,50,TRUE,1,50,FALSE,1,86,TRUE,1,100,TRUE,1,92,FALSE,0,60,TRUE,1,98,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,90,FALSE,1,50,FALSE,1,81,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,55,TRUE,1,54,FALSE,1,50,FALSE,1,100,TRUE,0,83,TRUE,1,69,FALSE,0,50,TRUE,1,80,0.0064,0.2116,0.01,0,0.04,0.0196,0.0081,0.0004,0,0,0.0961,0,0.36,0.25,0.25,0,0,0.25,0,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.3481,0.0361,0.6889,0.25,0.191421429,0.091014286,0.291828571,28,87.5,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,73.06,57.5,74.88,78.5,81.38,77.12,69,12.5,-1.94,-5,-0.12,-9,6.38,-4.13,0.25,0,1,1,1,1,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,2,1,1,2,2,0,1,0,2,3,1,0,0,0,0,0,1,0.8,0.2,0.4,0,0.6,1.2,1.2,0.2,0.35,0.8,3.33,3.33,0,0,0,3,0,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,1,-1,0,-1,-2,-2,0,0,0,-2,-1,-1,0,0,0,0,0,-1,0.2,-1,-0.8,-0.2,-0.45,C_Ug +668,R_16arDcHSBUmfHjw,25 - 31,Canadian,Male,2,3,1,1,2,0,-2,3,-1,1,2,-1,2,0,3,3,3,3,2,2,2,3,2,3,2,9,-1,-2,2,3,3,9,3,-3,2,0,3,7,1,1,1,3,0,9,2,3,1,-2,2,8,-2,-2,3,0,2,8,3,-1,3,-1,2,6,3,3,3,2,0,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,88,TRUE,1,100,FALSE,1,61,TRUE,0,88,FALSE,0,96,TRUE,0,87,TRUE,1,100,TRUE,1,100,TRUE,0,94,FALSE,1,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,100,FALSE,1,71,TRUE,1,100,TRUE,0,96,TRUE,0,100,FALSE,1,74,FALSE,0,85,FALSE,0,100,FALSE,0,88,0,0,0,0,0.7744,0,0,0,0,0,0.7225,0.9216,0.0144,0.1521,0,0,0.0256,0,1,0.0841,0,0,0.0081,0.7569,0.8836,0.9216,1,0,1,0,0.0676,0.7744,0.325246429,0.186471429,0.464021429,27,84.38,22,68.75,6,75,5,62.5,7,87.5,4,50,12,75,10,62.5,93.84,92,92,94.75,96.62,97.31,90.38,15.63,25.09,17,29.5,7.25,46.62,22.31,27.88,0,0,1,2,0,1,0,1,4,2,1,2,0,0,0,2,2,2,1,2,0,0,0,3,0,2,0,0,1,1,1,0,1,1,1,0,0,0,0,2,0.6,1.6,0.6,1.8,0.6,0.8,0.8,0.4,1.15,0.65,8.33,7.33,1,1,1,1,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,30,-0.25,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,1,-1,0,-1,0,1,3,1,0,2,-1,-1,-1,2,2,2,1,0,0,0.8,-0.2,1.4,0.5,C_Ug +669,R_7mOk6ToUgjkheRH,46 - 52,Canadian,Male,-1,2,0,1,0,0,0,1,0,0,0,0,1,0,0,-1,-3,-2,-2,-3,-3,2,1,1,0,5,-1,0,0,0,0,5,0,0,0,1,1,5,-3,-3,-3,-3,-3,5,-3,2,2,2,0,5,-2,0,-1,1,0,5,0,0,0,-1,0,5,-2,-3,-3,-3,-3,5,TRUE,0,50,FALSE,0,53,TRUE,0,54,TRUE,0,51,TRUE,1,51,FALSE,1,50,TRUE,1,56,TRUE,1,52,TRUE,1,55,TRUE,1,61,FALSE,1,50,TRUE,0,65,TRUE,1,52,TRUE,0,51,TRUE,1,54,TRUE,1,52,TRUE,0,52,TRUE,0,67,FALSE,1,51,TRUE,0,50,TRUE,1,51,TRUE,1,50,TRUE,0,51,TRUE,1,70,TRUE,0,53,TRUE,1,51,TRUE,0,54,TRUE,0,52,TRUE,0,50,TRUE,1,70,TRUE,1,50,TRUE,1,55,0.2304,0.2401,0.2304,0.1936,0.2025,0.25,0.09,0.1521,0.25,0.25,0.09,0.2304,0.2025,0.25,0.2401,0.2809,0.2601,0.2601,0.2704,0.2809,0.2401,0.2116,0.2401,0.2601,0.2704,0.2916,0.25,0.25,0.2916,0.4489,0.25,0.4225,0.249532143,0.214907143,0.284157143,8,25,18,56.25,5,62.5,5,62.5,4,50,4,50,15,93.75,3,18.75,54.19,52.25,51.5,54.88,58.12,55.19,53.19,-31.25,-2.06,-10.25,-11,4.88,8.12,-38.56,34.44,2,0,1,0,0,1,0,1,0,0,0,0,1,1,1,2,0,1,1,0,2,0,2,1,0,2,0,2,1,0,0,0,1,1,0,1,0,1,1,0,0.6,0.4,0.6,0.8,1,1,0.4,0.6,0.6,0.75,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),50,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,0,0,-1,-1,0,-1,0,-1,-1,0,0,0,0,0,1,1,0,0,0,0,-0.4,-0.6,0.2,0.2,-0.15,HS_TS +670,R_5mnUZGp5jKWAttn,25 - 31,American,Male,3,3,1,2,3,3,-3,3,-1,1,3,2,2,1,3,0,0,0,-1,-1,3,2,2,2,3,1,1,-3,1,-3,2,1,3,3,1,-1,2,1,-2,-2,-3,-2,-1,5,3,3,2,3,3,10,1,-3,3,-3,1,10,2,3,3,-1,3,10,3,3,1,3,-1,9,FALSE,1,79,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,95,TRUE,1,97,TRUE,1,98,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,98,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,0,0,0.0004,0,0,0.01,1,0,0,1,0,1,0,0,0,0,0.0004,0,0,0,0,0.0009,0,0.0025,1,0.0016,0.0001,0.0441,1,0,0,1,0.216414286,0.215028571,0.2178,16,50,26,81.25,8,100,6,75,7,87.5,5,62.5,13,81.25,13,81.25,98.5,99,98.5,96.75,99.75,99.62,97.38,-31.25,17.25,-1,23.5,9.25,37.25,18.37,16.13,0,1,1,0,0,2,0,2,2,1,0,1,1,2,1,2,2,3,1,0,0,0,1,1,0,2,0,0,2,0,1,1,1,2,0,3,3,1,4,0,0.4,1.4,1,1.6,0.4,0.8,1,2.2,1.1,1.1,1,10,-9,-9,-9,-4,-9,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),30,0.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,1,0,-1,0,0,0,2,0,1,-1,0,0,0,1,-1,-1,2,-3,0,0,0.6,0,-0.6,0,grad_prof +671,R_5gUeZWBb9NLCH7P,46 - 52,Canadian,Male,2,3,1,-3,1,2,-2,3,-3,2,0,0,2,-3,3,1,2,2,0,3,3,3,1,-3,1,1,2,-2,2,-3,3,2,0,1,2,-3,3,1,-2,0,-2,-1,3,7,1,3,1,0,0,2,2,-2,2,-3,0,1,0,0,2,-3,3,1,0,0,2,0,3,5,FALSE,1,100,FALSE,0,50,FALSE,1,60,FALSE,1,50,TRUE,1,50,FALSE,1,60,TRUE,1,85,TRUE,1,65,TRUE,1,55,TRUE,1,52,FALSE,1,50,TRUE,0,65,FALSE,0,55,FALSE,1,80,TRUE,1,90,TRUE,1,100,TRUE,0,69,TRUE,0,58,TRUE,0,65,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,1,95,TRUE,0,60,TRUE,1,50,FALSE,1,50,FALSE,1,70,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.1225,0.25,0,0.0225,0.25,0.16,0.0025,0.2304,0,0.09,0.25,0.3025,0.2025,0.25,0.25,0.25,0.25,0.25,0.09,0.36,0.25,0.01,0.4225,0.04,0.4761,0.25,0.25,0,0.16,0.3364,0.25,0.4225,0.216264286,0.195564286,0.236964286,12,37.5,21,65.63,5,62.5,4,50,6,75,6,75,10,62.5,11,68.75,64.19,57.5,54.25,69.38,75.62,63.56,64.81,-28.13,-1.44,-5,4.25,-5.62,0.62,1.06,-3.94,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,3,2,4,1,0,1,0,0,3,1,0,0,1,0,2,0,0,0,0,0,1,2,0,0,0,0.2,0.4,0.2,2,1,0.6,0,0.6,0.7,0.55,1.33,1.33,-1,1,0,2,0,5 cents,5 minutes,15 days,Male,College Diploma/Certificate,50,1.75,1,1,0,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,-3,-1,0,0,0,0,-1,0,1,0,0,0,2,0,4,1,0,-0.8,-0.2,0.2,1.4,0.15,C_Ug +672,R_3mihKaMDHI1tKwN,53 - 59,American,Male,1,1,2,1,1,-1,0,1,-1,0,1,1,1,0,2,-1,0,0,0,-1,1,1,2,1,2,3,0,0,1,0,1,3,2,2,1,0,2,1,0,0,-1,0,-1,4,1,1,2,1,1,1,0,-1,1,-1,1,3,1,2,1,-1,1,2,0,-1,0,0,-1,2,TRUE,0,96,TRUE,1,89,TRUE,0,88,FALSE,1,54,TRUE,1,60,FALSE,1,81,TRUE,1,81,TRUE,1,74,TRUE,1,80,TRUE,1,89,TRUE,0,60,FALSE,1,97,FALSE,0,89,FALSE,1,100,TRUE,1,66,TRUE,1,80,FALSE,1,60,FALSE,1,85,FALSE,1,55,FALSE,1,100,TRUE,1,66,TRUE,1,70,FALSE,1,100,TRUE,1,72,TRUE,0,63,TRUE,1,66,TRUE,0,70,FALSE,1,76,TRUE,0,78,TRUE,1,67,TRUE,1,69,TRUE,1,83,0.0676,0.1156,0.04,0.0361,0.0289,0.0361,0.0784,0.0121,0,0.09,0.1089,0.7921,0.04,0.36,0.16,0.0121,0,0.2116,0.0576,0.3969,0.1156,0.1156,0.2025,0,0.16,0.49,0.0961,0.9216,0.7744,0.0225,0.6084,0.0009,0.210439286,0.137871429,0.283007143,22,68.75,25,78.13,6,75,6,75,6,75,7,87.5,15,93.75,10,62.5,77,67.88,77.12,81.25,81.75,75.06,78.94,-9.38,-1.13,-7.12,2.12,6.25,-5.75,-18.69,16.44,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,1,1,0,0,0,0.2,0.6,0.4,0.4,0,0.6,0.6,0.4,0.4,0.4,2.33,2,2,0,-1,2,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,55,0.875,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,0,1,0,-1,0,1,0,1,0,0,-1,-1,0,-1,1,0,0,0.2,0,-0.2,0,0,C_Ug +673,R_5OPaqVxNTufwlYx,46 - 52,Canadian,Male,-2,-3,-3,0,-3,-3,-1,1,2,-1,3,-1,0,-3,2,-3,-3,-3,-3,-3,-2,-2,-2,0,-3,3,-3,-1,1,1,-1,3,3,-1,0,-3,2,3,-2,-1,-1,-1,-1,8,-2,-3,-3,0,-3,2,-3,-1,1,1,-2,3,3,-1,0,-3,2,3,-3,-3,-3,-3,-3,1,TRUE,0,69,TRUE,1,54,FALSE,1,60,TRUE,0,50,TRUE,1,57,FALSE,1,79,TRUE,1,82,TRUE,1,90,TRUE,1,50,TRUE,1,60,FALSE,1,50,TRUE,0,59,FALSE,0,100,FALSE,1,91,TRUE,1,58,TRUE,1,78,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,57,TRUE,1,82,TRUE,1,66,FALSE,1,99,TRUE,1,69,FALSE,1,83,TRUE,1,61,TRUE,0,51,FALSE,1,89,TRUE,0,68,FALSE,0,55,TRUE,1,59,TRUE,1,88,0.01,0.1521,0.0484,0.0324,0.0144,0.0441,0.0961,0.16,0.1849,0.1156,0.3025,1,0.25,0.25,0.1849,0.2116,0.0001,0.25,0.0121,0.0289,0.0324,0.1764,0.25,0.0081,0.25,0.2601,0.1681,0.4761,0.16,0.25,0.4624,0.3481,0.212389286,0.218871429,0.205907143,8,25,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,67.62,52.75,77.88,70.25,69.62,69.31,65.94,-50,-7.38,-22.25,2.88,-4.75,-5.38,-18.19,3.44,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,2,2,2,2,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0.4,0.2,0,1.8,0,0.4,0,0,0.6,0.1,3,2.67,1,0,0,7,0.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,48,1.375,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,1,1,0,0,0,0,0,0,-1,0,0,0,0,0,1,2,2,2,2,0.4,-0.2,0,1.8,0.5,C_Ug +674,R_7Kd549Jv3m2lNUW,46 - 52,American,Male,2,3,3,2,3,-3,1,1,-3,2,2,-3,3,1,3,-3,-3,-2,-3,-2,2,3,3,3,3,1,-2,2,1,-3,2,1,2,-2,3,-2,3,4,-2,-2,-2,-2,-2,9,2,3,3,3,3,1,1,2,2,-3,2,1,2,-2,2,-2,3,1,-2,-2,-2,-2,-2,1,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,74,TRUE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,78,TRUE,1,89,TRUE,0,88,TRUE,0,100,TRUE,0,77,TRUE,0,92,FALSE,0,50,TRUE,1,83,FALSE,1,73,TRUE,1,79,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,72,TRUE,1,85,FALSE,0,50,TRUE,1,98,0,0,0.0121,0,0.0004,0.5476,0.0441,0,0.8464,0.0289,0.0225,0,0.0256,0,0.25,0.25,0.0729,0.25,0,1,0.25,0.0484,0.5929,0.25,0.7744,0.25,0.25,0.25,1,1,0.5184,1,0.340089286,0.167028571,0.51315,24,75,19,59.38,6,75,3,37.5,5,62.5,5,62.5,13,81.25,6,37.5,80.38,67.38,75.62,85.38,93.12,81,79.75,15.62,21,-7.62,38.12,22.88,30.62,-0.25,42.25,0,0,0,1,0,1,1,0,0,0,0,1,0,3,0,1,1,0,1,0,0,0,0,1,0,4,1,1,0,0,0,1,1,3,0,1,1,0,1,0,0.2,0.4,0.8,0.6,0.2,1.2,1,0.6,0.5,0.75,2,1,0,0,3,8,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),47,1.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,-3,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,-0.8,-0.2,0,-0.25,HS_TS +675,R_3Of8EufxfaIEqoV,46 - 52,Canadian,Male,1,0,1,0,-1,1,1,2,0,2,2,1,1,1,2,-1,-2,-1,-1,-1,1,0,0,2,1,8,0,1,1,1,0,6,1,0,-1,0,1,7,0,2,1,2,1,7,1,1,1,2,2,7,1,1,2,0,0,8,-1,0,0,2,1,8,1,1,2,1,2,7,FALSE,1,100,FALSE,0,64,TRUE,0,100,FALSE,1,68,TRUE,1,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,93,TRUE,0,74,TRUE,1,74,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,88,TRUE,1,100,TRUE,0,70,TRUE,1,100,TRUE,0,100,FALSE,0,65,TRUE,0,100,FALSE,1,100,TRUE,0,62,FALSE,0,59,TRUE,1,79,TRUE,1,74,0,0.4225,0,0,0.0676,0,0,0,0,0,0.3481,0.0049,0.0289,0,0.1521,0.4096,0.49,0.1024,0,1,0.0144,0.0676,0.0625,0.5476,1,1,0.0441,0,1,1,0.3844,1,0.311578571,0.114542857,0.508614286,16,50,20,62.5,6,75,5,62.5,4,50,5,62.5,13,81.25,7,43.75,87.16,80.38,81,92.38,94.88,83.75,90.56,-12.5,24.66,5.38,18.5,42.38,32.38,2.5,46.81,0,0,1,2,2,1,0,1,1,2,1,1,2,1,1,1,4,2,3,2,0,1,0,2,3,0,0,0,0,2,3,1,1,1,1,2,3,3,2,3,1,1,1.2,2.4,1.2,0.4,1.4,2.6,1.4,1.4,7,7.67,1,-2,-1,0,-0.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,47,-0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,-1,1,0,-1,1,0,1,1,0,-2,0,1,0,0,-1,1,-1,1,-1,-0.2,0.6,-0.2,-0.2,0,C_Ug +676,R_73q19pg52KZaZZn,39 - 45,American,Male,2,-2,2,0,1,-2,-2,2,0,2,3,-1,1,1,-2,1,-1,2,0,-3,-1,0,3,-2,2,7,-1,1,3,1,-2,4,1,1,-3,-1,3,1,-2,2,0,-1,-1,5,2,-2,-2,1,1,2,0,-2,0,2,-2,3,2,0,2,-2,1,2,-2,-1,-2,2,1,8,FALSE,1,82,TRUE,1,64,TRUE,0,100,FALSE,1,84,TRUE,1,62,FALSE,1,84,FALSE,0,60,TRUE,1,88,TRUE,1,87,TRUE,1,95,FALSE,1,85,TRUE,0,61,FALSE,0,62,TRUE,0,85,FALSE,0,53,TRUE,1,52,TRUE,0,93,FALSE,1,56,FALSE,1,52,TRUE,0,85,FALSE,0,56,TRUE,1,73,TRUE,0,81,FALSE,0,57,FALSE,1,63,FALSE,0,56,TRUE,0,63,TRUE,0,58,FALSE,1,88,TRUE,1,54,TRUE,1,86,FALSE,0,75,0.0144,0.3136,0.2304,0.36,0.5625,0.0256,0.3249,0.0025,0.7225,0.0729,0.2116,0.3844,0.0169,0.0225,0.1444,0.1296,0.6561,0.0256,0.3364,0.1369,0.3136,0.2809,0.2304,0.7225,0.8649,0.3969,0.0196,0.0324,1,0.1936,0.0144,0.3721,0.29345,0.235857143,0.351042857,19,59.38,17,53.13,6,75,3,37.5,5,62.5,3,37.5,9,56.25,8,50,71.88,71.75,75.12,71.25,69.38,67.5,76.25,6.25,18.75,-3.25,37.62,8.75,31.88,11.25,26.25,3,2,1,2,1,1,3,1,1,4,2,2,4,2,5,3,3,2,1,2,0,0,4,1,0,2,0,2,2,4,1,1,1,3,3,3,0,4,2,4,1.8,2,3,2.2,1,2,1.8,2.6,2.25,1.85,4,2.33,5,1,-1,-3,1.67,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),41,0.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,3,2,-3,1,1,-1,3,-1,-1,0,1,1,3,-1,2,0,3,-2,-1,-2,0.8,0,1.2,-0.4,0.4,grad_prof +677,R_7ISuO9yeWcD34BP,25 - 31,Canadian,Male,-2,3,0,-2,3,1,1,1,1,2,1,1,2,1,1,-1,0,1,1,0,-1,1,1,-1,0,3,0,-1,1,1,-1,7,1,0,1,2,1,7,1,1,2,-1,1,6,-2,3,-2,-2,3,7,0,-1,1,0,1,2,1,1,1,1,1,6,2,2,2,2,1,5,TRUE,0,70,TRUE,1,75,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,80,FALSE,0,60,TRUE,1,50,TRUE,1,95,FALSE,1,60,TRUE,0,80,TRUE,1,80,TRUE,0,60,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,60,FALSE,1,75,FALSE,1,100,FALSE,0,100,TRUE,1,60,FALSE,1,100,TRUE,1,60,TRUE,0,80,FALSE,0,50,FALSE,1,50,FALSE,1,90,FALSE,1,50,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.36,0.25,0,0.04,0,0.25,0.16,0.0025,0,0.16,0,0.04,0.25,0.16,0.25,0.0625,0,0.25,0.01,0.64,1,0.25,0.0625,0.36,0.25,0.25,0.01,0.49,0.25,0.16,0.25,0.64,0.221696429,0.113214286,0.330178571,20,62.5,22,68.75,7,87.5,5,62.5,4,50,6,75,13,81.25,9,56.25,71.09,62.5,72.5,69.38,80,75,67.19,-6.25,2.34,-25,10,19.38,5,-6.25,10.94,1,2,1,1,3,1,2,0,0,3,0,1,1,1,0,2,1,1,2,1,0,0,2,0,0,1,2,0,1,1,0,0,1,0,0,3,2,1,1,1,1.6,1.2,0.6,1.4,0.4,1,0.2,1.6,1.2,0.8,5.67,5,-4,5,1,1,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,27,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,2,-1,1,3,0,0,0,-1,2,0,1,0,1,0,-1,-1,0,1,0,1.2,0.2,0.4,-0.2,0.4,C_Ug +678,R_7z6DP671COc8ph6,53 - 59,American,Male,-1,2,3,3,-1,2,0,1,-3,0,3,0,2,-1,1,0,1,1,1,0,2,2,2,2,1,5,1,1,-1,-1,0,5,0,0,-1,1,1,5,1,0,1,-1,-2,6,-1,2,2,2,-1,6,1,-3,0,-2,-1,7,1,2,3,-2,0,7,0,0,0,1,1,6,TRUE,0,92,TRUE,1,95,TRUE,0,97,FALSE,1,67,TRUE,1,62,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,100,FALSE,1,100,FALSE,1,57,TRUE,1,99,FALSE,1,65,TRUE,1,55,TRUE,1,100,FALSE,1,56,TRUE,0,100,FALSE,1,58,TRUE,0,91,TRUE,1,99,TRUE,1,100,FALSE,1,100,FALSE,0,52,FALSE,1,100,TRUE,1,99,FALSE,1,55,FALSE,1,100,TRUE,0,58,TRUE,1,86,FALSE,0,57,TRUE,1,100,0,0.0001,0,0,0,0,0.2704,1,0.8281,0,0.0196,0.0001,0.25,0,0.1444,0.0025,0,0.1089,0,0,0.0001,0.2025,0.1764,0.1225,0.1936,0.2025,0.3249,0.8464,0.9409,1,0.3364,0.1849,0.255539286,0.187428571,0.32365,24,75,23,71.88,6,75,7,87.5,5,62.5,5,62.5,12,75,11,68.75,82.81,67.12,84.25,94.5,85.38,84.62,81,3.12,10.93,-7.88,-3.25,32,22.88,9.62,12.25,3,0,1,1,2,1,1,2,2,0,3,0,3,2,0,1,1,0,2,2,0,0,1,1,0,1,3,1,1,1,2,2,1,1,1,0,1,1,0,1,1.4,1.2,1.6,1.2,0.4,1.4,1.4,0.6,1.35,0.95,5,6.67,-1,-2,-2,0,-1.67,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,53,-0.5,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,0,0,0,2,0,-2,1,1,-1,1,-2,2,1,-1,1,0,-1,2,1,1,-0.2,0.2,0.6,0.4,C_Ug +679,R_1JgWJdUQWW0nn6V,39 - 45,American,Male,2,3,3,2,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,2,2,2,10,3,3,3,3,3,10,2,2,2,2,2,9,1,1,1,0,1,8,3,3,3,3,3,10,3,3,3,3,3,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,1,0,1,0,0,0,0.0036,0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,1,1,1,0.500128571,0.3574,0.642857143,32,100,18,56.25,5,62.5,3,37.5,6,75,4,50,14,87.5,4,25,99.81,99.25,100,100,100,99.62,100,43.75,43.56,36.75,62.5,25,50,12.12,75,1,0,0,1,0,0,6,0,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,1,2,4,2,3,2,0,0,0,0,0,0,0,0,0,0,0.4,2.4,0.6,0,0.6,2.6,0,0,0.85,0.8,10,9,1,2,0,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,43,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,1,-1,-1,1,-1,-2,2,-2,3,-2,0,0,1,1,1,0,0,0,0,0,-0.2,-0.2,0.6,0,0.05,C_Ug +680,R_5LtUa8bqZ8QlyAI,25 - 31,American,Male,1,3,3,3,3,1,1,1,-2,1,1,1,1,1,0,2,2,1,2,1,1,3,3,3,3,9,1,0,-1,-1,1,9,0,0,-1,-1,0,9,2,2,3,1,2,9,0,3,3,-3,3,9,0,-2,0,-2,0,8,0,0,0,0,0,9,-1,0,0,-2,-2,9,TRUE,0,100,FALSE,0,88,FALSE,1,94,FALSE,1,93,TRUE,1,93,TRUE,0,86,TRUE,1,88,TRUE,1,89,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,97,FALSE,1,99,TRUE,0,98,TRUE,1,100,TRUE,1,87,TRUE,1,100,0.0121,0,0,0.0144,0,0.7396,0,0,0,0,0,0,0,1,0.0049,0.7744,1,0.0049,0.0001,1,1,0,0,1,1,0.9409,0.0169,1,0.0036,1,0.9604,1,0.444489286,0.2517,0.637278571,16,50,19,59.38,5,62.5,3,37.5,4,50,7,87.5,14,87.5,5,31.25,97.25,95.62,97.12,98.5,97.75,96.56,97.94,-9.38,37.87,33.12,59.62,48.5,10.25,9.06,66.69,0,0,0,0,0,0,1,2,1,0,1,1,2,2,0,0,0,2,1,1,1,0,0,6,0,1,3,1,0,1,1,1,1,1,0,3,2,1,4,3,0,0.8,1.2,0.8,1.4,1.2,0.8,2.6,0.7,1.5,9,8.67,0,1,0,0,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,25,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,-1,0,0,-6,0,-1,-2,1,1,-1,0,0,1,1,0,-3,-2,1,-3,-2,-1.4,-0.4,0.4,-1.8,-0.8,C_Ug +681,R_1me0UE09DCXstD6,39 - 45,Canadian,Male,-1,-1,1,2,1,-2,-2,-1,-2,1,1,1,1,1,2,-3,-3,-3,-3,-3,1,-1,2,1,2,2,-2,-2,1,-2,1,1,1,1,1,1,2,1,-2,0,-1,-1,1,6,-1,-1,-1,2,2,2,-2,-2,1,-2,1,1,2,2,1,2,2,2,0,0,0,0,-2,7,TRUE,0,70,TRUE,1,60,TRUE,0,60,FALSE,1,95,TRUE,1,65,FALSE,1,99,FALSE,0,55,TRUE,1,75,TRUE,1,90,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,1,99,FALSE,0,50,TRUE,1,99,FALSE,1,60,FALSE,1,85,TRUE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,60,FALSE,1,100,TRUE,1,99,TRUE,0,50,FALSE,1,80,FALSE,1,60,FALSE,0,70,FALSE,0,50,TRUE,1,99,0.0625,0.0001,0.0001,0.3025,0.0001,0.0001,0.36,0.04,0.25,0,0.49,0.0625,0.01,0.25,0.1225,0.16,0,0.0025,0.04,0,0,0.25,0.25,0.0001,0.16,0.25,0.25,0.49,0.36,0.0225,0.16,0.25,0.151082143,0.124835714,0.177328571,24,75,23,71.88,4,50,8,100,6,75,5,62.5,11,68.75,12,75,74.53,61.88,82.25,86,68,76.69,72.38,3.12,2.65,11.88,-17.75,11,5.5,7.94,-2.62,2,0,1,1,1,0,0,2,0,0,0,0,0,0,0,1,3,2,2,4,0,0,2,0,1,0,0,2,0,0,1,1,0,1,0,3,3,3,3,1,1,0.4,0,2.4,0.6,0.4,0.6,2.6,0.95,1.05,1.33,1.67,0,0,-1,-1,-0.34,5 cents,5 minutes,47 days,Male,University - Undergraduate,42,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,2,0,-1,1,0,0,0,0,0,0,-1,-1,0,-1,0,-2,0,-1,-1,3,0.4,0,-0.6,-0.2,-0.1,C_Ug +682,R_1N9ylwpvLg7lFLl,18 - 24,Canadian,Male,1,3,2,2,3,2,-2,1,-2,2,2,2,1,-1,-1,0,1,-1,2,-1,-1,1,1,-1,1,8,2,-2,1,-1,-1,8,2,1,-1,-2,1,5,-1,1,-1,2,-1,8,1,3,2,2,3,8,2,-1,2,-2,1,8,-1,-1,-1,2,2,5,2,-1,2,2,-1,8,FALSE,1,74,FALSE,0,66,TRUE,0,71,FALSE,1,93,FALSE,0,59,FALSE,1,54,FALSE,0,64,FALSE,0,56,TRUE,1,80,TRUE,1,90,TRUE,0,70,TRUE,0,90,TRUE,1,90,FALSE,1,70,FALSE,0,80,TRUE,1,90,FALSE,1,57,TRUE,0,100,FALSE,1,72,FALSE,1,52,FALSE,0,60,FALSE,0,70,FALSE,1,70,FALSE,0,80,TRUE,0,70,TRUE,1,90,FALSE,1,70,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,0,62,FALSE,0,54,0.3136,0.01,0.01,0.4096,0.2916,0.2116,0.64,0.01,0.2304,0.49,0,0.01,0.04,0.49,0.3481,0.4356,0.09,0.0049,0,0.49,0.36,0.64,0.0784,0.09,0.1849,0.09,0.3844,0.0676,0.5041,1,0.09,0.81,0.288628571,0.235157143,0.3421,20,62.5,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,74.19,74.12,64.25,78.5,79.88,74.44,73.94,9.37,21.06,24.12,1.75,28.5,29.88,36.94,5.19,2,2,1,3,2,0,0,0,1,3,0,1,2,1,2,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,3,3,2,3,3,2,2,3,0,0,2,0.8,1.2,0.2,0,0.6,2.8,1.4,1.05,1.2,7,7,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,21,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,2,2,1,3,2,0,-1,-1,1,2,-3,-2,0,-2,-1,-1,-2,-3,0,0,2,0.2,-1.6,-1.2,-0.15,C_Ug +683,R_5wcNlag6ceIUjS7,25 - 31,American,Male,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,9,2,2,2,2,2,9,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,TRUE,0,88,TRUE,1,87,TRUE,0,87,TRUE,0,84,TRUE,1,81,TRUE,0,86,TRUE,1,83,TRUE,1,86,TRUE,1,85,TRUE,1,88,TRUE,0,88,TRUE,0,100,TRUE,1,85,TRUE,0,89,TRUE,1,81,TRUE,1,82,TRUE,0,82,TRUE,0,86,TRUE,0,82,TRUE,0,83,TRUE,1,80,TRUE,1,77,TRUE,0,81,TRUE,1,82,FALSE,1,89,TRUE,1,83,TRUE,0,89,TRUE,0,91,TRUE,0,90,TRUE,1,93,TRUE,1,92,TRUE,1,93,0.0196,0.0289,0.0324,0.0289,0.0049,0.7396,0.0324,0.0144,0.6889,0.0529,0.0049,0.0225,0.0225,0.7744,0.0361,0.0169,0.6561,0.7056,0.8281,0.0121,0.04,0.0361,0.6724,0.7921,0.6724,0.7921,0.0064,0.7744,0.7569,0.7396,0.81,1,0.418025,0.269435714,0.566614286,23,71.88,17,53.13,4,50,4,50,5,62.5,4,50,16,100,1,6.25,86.03,86,84.75,85.38,88,84.88,87.19,18.75,32.9,36,34.75,22.88,38,-15.12,80.94,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0,0,0.05,0,8.67,9,0,0,-1,0,-0.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,27,0.25,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05,C_Ug +684,R_3GOLclcTglSIaGV,39 - 45,Canadian,Male,1,3,2,2,1,-2,1,2,1,0,2,0,1,1,2,0,1,1,0,-2,0,1,3,0,0,4,-2,0,1,1,0,3,2,1,1,2,2,3,-1,0,-1,-2,-2,1,3,3,2,3,2,3,-2,0,2,1,0,2,2,-1,1,1,2,2,-1,0,0,0,-1,5,TRUE,0,61,FALSE,0,57,TRUE,0,91,FALSE,1,53,FALSE,0,79,FALSE,1,100,TRUE,1,98,FALSE,0,50,TRUE,1,50,FALSE,0,90,FALSE,1,99,TRUE,0,97,TRUE,1,99,FALSE,1,98,FALSE,0,53,TRUE,1,74,FALSE,1,54,FALSE,1,80,TRUE,0,90,FALSE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,70,TRUE,1,52,FALSE,1,91,TRUE,1,64,FALSE,1,50,FALSE,1,95,TRUE,0,96,TRUE,1,100,FALSE,0,86,TRUE,1,70,0.25,0.1296,0.0676,0.0004,0.09,0,0.2304,0.81,0,0.25,0,0.0001,0.25,0.0001,0.6241,0.3249,0.49,0.2209,0.0025,0.0081,0.25,0.2809,0.81,0.0004,0.2116,0.25,0.7396,0.3721,0.8281,0.04,0.9216,0.9409,0.319510714,0.235035714,0.403985714,23,71.88,18,56.25,4,50,4,50,5,62.5,5,62.5,8,50,10,62.5,76.47,67.25,77.25,79,82.38,70.12,82.81,15.63,20.22,17.25,27.25,16.5,19.88,20.12,20.31,1,2,1,2,1,0,1,1,0,0,0,1,0,1,0,1,1,2,2,0,2,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,1,1,0,1,1.4,0.4,0.4,1.2,0.8,0.2,0.2,0.8,0.85,0.5,3.33,2.33,1,1,1,-4,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,43,1.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,-1,2,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,2,-1,0.6,0.2,0.2,0.4,0.35,C_Ug +685,R_78Gq86eg0MMuGTO,25 - 31,Canadian,Male,-3,2,3,-2,3,2,2,0,2,2,1,1,3,3,2,2,2,2,1,-1,-3,3,3,-3,3,1,-1,3,-1,3,0,8,0,-1,0,3,0,9,-1,-2,-2,0,-3,10,-1,3,3,0,3,2,2,2,0,-1,2,2,1,2,3,2,2,2,2,1,2,3,2,2,TRUE,0,100,FALSE,0,50,TRUE,0,83,FALSE,1,50,FALSE,0,50,FALSE,1,87,FALSE,0,50,TRUE,1,64,TRUE,1,60,TRUE,1,90,FALSE,1,70,TRUE,0,94,TRUE,1,98,TRUE,0,73,FALSE,0,55,TRUE,1,80,TRUE,0,90,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,80,FALSE,1,50,TRUE,1,75,FALSE,1,50,TRUE,1,90,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,61,0.1296,0.01,0.04,0.25,0.1521,0.0169,0.0625,0.01,0,0.04,0,0.0004,0.16,0.09,0.25,0.25,0.25,0.25,0,0.25,1,0.3025,0.25,0.5329,0.81,0.25,1,1,0.6889,1,1,0.8836,0.374992857,0.109421429,0.640564286,17,53.13,19,59.38,5,62.5,4,50,4,50,6,75,10,62.5,9,56.25,76.56,60.62,79.5,79.12,87,75.19,77.94,-6.25,17.18,-1.88,29.5,29.12,12,12.69,21.69,0,1,0,1,0,3,1,1,1,2,1,2,3,0,2,3,4,4,1,2,2,1,0,2,0,0,0,0,3,0,0,1,0,1,0,0,1,0,2,3,0.4,1.6,1.6,2.8,1,0.6,0.4,1.2,1.6,0.8,6,2,-1,6,7,8,4,10 cents,5 minutes,47 days,Male,University - Undergraduate,30,0.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-2,0,0,-1,0,3,1,1,-2,2,1,1,3,-1,2,3,3,4,-1,-1,-0.6,1,1.2,1.6,0.8,C_Ug +686,R_1LMC5Teu1zXZQGs,39 - 45,Canadian,Male,0,0,1,1,2,0,1,1,-1,0,1,2,3,0,0,-1,-1,-2,0,-2,1,1,1,1,2,0,0,0,0,0,0,8,2,2,2,2,3,0,0,-1,0,0,0,10,0,0,0,0,0,0,1,1,1,1,1,8,2,1,1,1,1,0,-1,-1,-1,-1,-1,0,TRUE,0,80,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,95,FALSE,0,100,0.25,0,0,0.25,1,0,0,0,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,1,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.0025,0.64,0.25,1,1,0.25,0.32875,0.214285714,0.443214286,16,50,20,62.5,6,75,5,62.5,3,37.5,6,75,9,56.25,11,68.75,70.31,55.62,75,75.62,75,74.69,65.94,-12.5,7.81,-19.38,12.5,38.12,0,18.44,-2.81,1,1,0,0,0,0,1,1,1,0,1,0,1,2,3,1,0,2,0,2,0,0,1,1,2,1,0,0,2,1,1,1,2,1,1,0,0,1,1,1,0.4,0.6,1.4,1,0.8,0.8,1.2,0.6,0.85,0.85,2.67,2.67,0,0,0,10,0,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),44,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,1,-1,-1,-2,-1,1,1,-1,-1,0,-1,-1,1,2,1,0,1,-1,1,-0.4,-0.2,0.2,0.4,0,grad_prof +687,R_3rGc9083GRoB6jR,46 - 52,American,Male,1,3,3,-1,3,1,-1,-1,-1,1,-1,-1,1,-3,3,1,1,2,2,2,1,3,3,1,3,1,1,1,-1,-1,1,1,-1,0,1,-3,3,1,2,2,2,2,2,1,2,3,3,2,2,1,1,-1,1,1,1,1,1,1,1,-3,3,1,1,1,1,2,1,1,FALSE,1,76,TRUE,1,73,FALSE,1,78,FALSE,1,52,TRUE,1,89,FALSE,1,80,TRUE,1,91,TRUE,1,66,FALSE,0,52,TRUE,1,80,FALSE,1,93,FALSE,1,97,TRUE,1,90,FALSE,1,97,FALSE,0,50,TRUE,1,89,TRUE,0,57,FALSE,1,93,TRUE,0,53,FALSE,1,89,FALSE,0,53,TRUE,1,52,FALSE,1,70,TRUE,1,77,TRUE,0,86,TRUE,1,92,TRUE,0,50,FALSE,1,93,TRUE,0,88,TRUE,1,100,TRUE,1,84,TRUE,1,100,0.1156,0.0064,0.0121,0.0081,0,0.04,0.0529,0.04,0.0121,0.2304,0,0.01,0.2704,0.0049,0.0121,0.0729,0.09,0.2304,0.0049,0.7396,0.2809,0.25,0.2809,0.0009,0.3249,0.25,0.0256,0.0576,0.0484,0.0049,0.7744,0.0009,0.146785714,0.07615,0.217421429,25,78.13,24,75,4,50,5,62.5,7,87.5,8,100,13,81.25,11,68.75,77.81,63.38,78.38,83.38,86.12,77.38,78.25,3.13,2.81,13.38,15.88,-4.12,-13.88,-3.87,9.5,0,0,0,2,0,0,2,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,3,1,0,0,2,2,0,2,2,0,0,0,0,0,1,0,1,0.4,0.4,0.2,0.4,1,0.8,0.8,0.4,0.35,0.75,1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,52,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-1,0,0,-1,-1,0,2,-2,-2,0,-2,-1,0,0,0,1,1,-1,0,-1,-0.6,-0.4,-0.6,0,-0.4,C_Ug +688,R_7YS8TYsC6D8Qr2F,53 - 59,American,Male,2,2,2,1,1,0,-2,2,-1,1,2,2,2,-1,3,-1,-1,1,0,-1,2,2,2,2,2,0,1,-2,2,-1,1,2,2,2,2,-1,3,2,0,0,0,0,-1,3,2,2,2,2,2,0,0,0,0,0,0,3,2,2,2,-1,3,1,0,0,0,0,-1,4,TRUE,0,50,TRUE,1,65,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,81,TRUE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,72,TRUE,0,50,TRUE,1,50,TRUE,1,87,TRUE,0,50,TRUE,0,72,TRUE,0,50,FALSE,1,79,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,75,TRUE,0,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,0.25,0.0625,0.0169,0.0361,0.25,0.25,0.25,0.25,0.0441,0.25,0.25,0.0784,0.25,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,0.25,0.25,0.24155,0.213928571,0.269171429,23,71.88,19,59.38,5,62.5,5,62.5,4,50,5,62.5,14,87.5,5,31.25,55.66,51.88,52.75,59.75,58.25,58.12,53.19,12.5,-3.72,-10.62,-9.75,9.75,-4.25,-29.38,21.94,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,2,2,1,1,0,0,0,0,0,1,1,1,0,0,0.4,0.2,0,0.6,0.4,1.2,0,0.6,0.3,0.55,1.33,1.33,0,-1,1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,1.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-2,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-0.25,HS_TS +689,R_5ctjaI2kk0V2XEM,53 - 59,American,Male,3,3,3,3,-1,1,-1,2,-2,1,2,-2,2,1,3,2,1,2,1,1,2,3,2,1,-1,2,-1,1,1,-1,-1,4,1,-2,2,1,3,3,0,1,2,1,1,3,3,3,3,3,-1,2,-1,-1,2,-1,1,2,2,-1,3,0,3,2,2,1,2,1,1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,70,TRUE,1,100,FALSE,1,64,TRUE,1,75,TRUE,1,87,TRUE,1,93,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,58,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,90,FALSE,1,100,FALSE,0,85,TRUE,1,62,FALSE,1,97,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,0,76,FALSE,1,77,TRUE,0,92,FALSE,0,71,FALSE,0,60,TRUE,1,100,0.0169,0,0,0.0625,0,0.1296,0,0,0,0.1444,0.5041,0.0169,0.0049,0.0324,0,0,0.0009,0.09,0.0529,0.0064,0.7225,0.1764,0.81,1,0.7569,0.5776,0.36,1,1,1,0.8464,1,0.365439286,0.065942857,0.664935714,23,71.88,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,13,81.25,7,43.75,87.66,78.62,89,91.12,91.88,86.12,89.19,9.38,25.16,16.12,26.5,28.62,29.38,4.87,45.44,1,0,1,2,0,2,2,1,1,2,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0.8,1.6,0.2,0.4,0,0.6,0.6,0,0.75,0.3,3,2,0,2,1,1,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,56,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,1,0,1,2,0,0,2,1,0,2,1,-1,-1,-1,0,2,0,0,0,0,0.8,1,-0.4,0.4,0.45,C_Ug +690,R_1IJDBdArUJMY0PT,32 - 38,Canadian,Male,-3,3,0,-3,-3,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,-3,3,3,0,-3,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,-3,3,0,0,-3,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,82,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.6724,0.25,0.25,0.318657143,0.25,0.387314286,15,46.88,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,54.12,50,50,54,62.5,50,58.25,-6.25,0.99,0,-12.5,4,12.5,12.5,-10.5,0,0,3,3,0,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,1.2,0,1.6,0,0.6,0,1.6,0,0.7,0.55,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),38,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0.15,HS_TS +691,R_7NJaYdxng6i1y05,53 - 59,American,Male,1,1,2,1,0,-2,0,3,1,0,0,0,3,0,2,-1,-3,-2,0,-2,1,2,2,2,0,0,-1,0,2,1,0,0,0,0,2,-2,2,3,0,-1,-1,0,-2,2,1,1,2,2,2,2,0,0,2,0,0,1,0,0,2,0,2,0,0,0,0,0,0,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0.25,0,0,0,0,0,1,0,0.25,0,0,1,1,1,1,0.232142857,0.089285714,0.375,28,87.5,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,96.88,87.5,100,100,100,100,93.75,9.37,18.75,12.5,12.5,25,25,6.25,31.25,0,1,0,1,0,1,0,1,0,0,0,0,1,2,0,1,2,1,0,0,0,0,0,1,2,2,0,1,1,0,0,0,1,0,0,1,3,2,0,2,0.4,0.4,0.6,0.8,0.6,0.8,0.2,1.6,0.55,0.8,1,1,-2,-1,3,2,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),54,1,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,1,0,0,-2,-1,0,0,-1,0,0,0,0,2,0,0,-1,-1,0,-2,-0.2,-0.4,0.4,-0.8,-0.25,HS_TS +692,R_5oyuDdGaXGNSoGB,39 - 45,Canadian,Male,2,-2,3,2,-3,-3,-2,1,2,-2,2,1,1,-3,3,2,2,2,2,2,2,-2,3,2,-3,0,-3,-2,2,2,-2,0,2,1,1,-3,3,0,2,2,2,2,2,0,2,-2,3,2,-3,0,-3,-2,2,2,-2,0,2,1,1,-3,3,0,2,2,2,2,2,0,TRUE,0,99,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,1,95,TRUE,1,90,TRUE,1,50,FALSE,1,50,TRUE,0,99,TRUE,1,99,FALSE,1,100,TRUE,1,50,TRUE,1,95,FALSE,1,50,TRUE,0,95,TRUE,0,50,FALSE,1,50,TRUE,1,95,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0025,0,0.0025,0.0025,0,0.0025,0,0.25,0.25,0,0,0.0001,0.01,0.25,0.0025,0,0.5625,0.25,0,0,0.0025,0.25,0.25,0,0.25,0.25,1,0.9801,1,0.9025,0,0.9801,0.265814286,0.112685714,0.418942857,25,78.13,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,85.22,67.5,88.62,92.38,92.38,91.5,78.94,0,7.09,-7.5,1.12,17.38,17.38,-2.25,16.44,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.2,0,0,0.05,0.05,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),44,1.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +693,R_6pMPYhEviIc7du6,32 - 38,Canadian,Male,2,3,2,-2,2,-2,1,0,1,3,-2,-3,2,0,3,-3,-2,-3,-3,-3,2,3,2,-2,1,2,-2,0,3,-1,3,4,-2,-3,3,0,3,1,-3,-3,-3,-3,-3,5,3,3,2,-2,2,3,-1,-3,3,0,3,2,-2,-3,3,0,3,1,0,1,0,0,0,5,FALSE,1,100,TRUE,1,86,TRUE,0,90,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,75,TRUE,1,90,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,60,FALSE,1,100,FALSE,1,100,FALSE,0,70,FALSE,0,75,TRUE,1,70,0.0625,0.0025,0,0.25,0.09,0,0,0,0,0.01,0.49,0.25,0.01,0.25,0,0.0196,0,0.25,0,0,0,0.04,0.09,0,0,0.36,0.5625,0,0.81,0,0,0.25,0.124360714,0.097828571,0.150892857,24,75,27,84.38,6,75,7,87.5,8,100,6,75,13,81.25,14,87.5,84.41,70.12,90,91.88,85.62,83.19,85.62,-9.38,0.03,-4.88,2.5,-8.12,10.62,1.94,-1.88,0,0,0,0,1,0,1,3,2,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,4,3,1,0,0,0,1,0,0,3,3,3,3,3,0.2,1.2,0.2,0.2,0.2,1.8,0.2,3,0.45,1.3,2.33,2,-1,2,0,0,0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,33,1.25,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-1,0,0,0,1,-1,-3,0,1,0,0,0,0,0,0,-3,-2,-3,-3,-3,0,-0.6,0,-2.8,-0.85,C_Ug +694,R_77cXVuCUiJzau8Z,39 - 45,Canadian,Male,-1,2,3,1,3,1,-3,3,-3,0,1,0,2,1,3,-1,-1,0,1,0,0,2,2,1,3,7,1,-3,2,-2,2,7,1,-1,2,1,2,5,1,1,1,1,0,7,-2,2,2,3,3,7,0,2,0,1,-1,7,1,1,2,2,3,7,-1,0,0,0,-2,7,FALSE,1,91,FALSE,0,52,TRUE,0,87,FALSE,1,54,TRUE,1,97,FALSE,1,51,TRUE,1,98,TRUE,1,56,TRUE,1,53,TRUE,1,99,FALSE,1,51,TRUE,0,96,TRUE,1,99,FALSE,1,52,TRUE,1,50,TRUE,1,100,FALSE,1,51,TRUE,0,53,TRUE,0,83,FALSE,1,55,TRUE,1,53,TRUE,1,100,TRUE,0,75,TRUE,1,96,FALSE,1,91,TRUE,1,51,FALSE,1,51,TRUE,0,50,TRUE,0,79,TRUE,1,71,FALSE,0,50,TRUE,1,74,0.1936,0.2401,0,0.0004,0.0676,0.2401,0.0016,0.0001,0.2025,0,0.0841,0.0001,0.2209,0.2401,0.0009,0.2704,0.5625,0.2116,0.25,0.0081,0.2209,0.25,0.6889,0.2304,0.2401,0.2401,0.25,0.0081,0.7569,0.2809,0.6241,0.9216,0.252592857,0.150178571,0.355007143,24,75,23,71.88,5,62.5,6,75,7,87.5,5,62.5,14,87.5,9,56.25,70.91,55.5,72.38,79.38,76.38,74.94,66.88,3.12,-0.97,-7,-2.62,-8.12,13.88,-12.56,10.63,1,0,1,0,0,0,0,1,1,2,0,1,0,0,1,2,2,1,0,0,1,0,1,2,0,1,5,3,4,1,0,1,0,1,0,0,1,0,1,2,0.4,0.8,0.4,1,0.8,2.8,0.4,0.8,0.65,1.2,6.33,7,0,0,-2,0,-0.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,42,0.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,0,-2,0,-1,-5,-2,-3,1,0,0,0,-1,1,2,1,1,-1,-2,-0.4,-2,0,0.2,-0.55,C_Ug +695,R_1uZoR76C6abtr4B,32 - 38,Canadian,Prefer not to say,0,2,1,0,-1,-2,1,-1,2,-1,1,-3,3,-1,2,-2,-1,-1,-3,-1,-1,3,3,1,-1,4,-1,2,-1,2,0,5,1,-3,3,-2,2,2,0,-1,-2,-2,-2,5,1,3,0,0,-1,7,-1,2,-1,1,0,6,1,-3,3,-2,3,1,-1,-1,-1,0,-1,3,TRUE,0,93,FALSE,0,70,FALSE,1,100,TRUE,0,60,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,70,FALSE,1,60,TRUE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,59,FALSE,0,55,TRUE,0,70,FALSE,1,100,FALSE,1,56,FALSE,1,53,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,88,FALSE,1,100,TRUE,1,93,FALSE,1,51,FALSE,1,57,FALSE,1,95,TRUE,1,80,FALSE,0,62,TRUE,1,90,0,0.0049,0.3025,0,0.01,0,0.0144,0.09,0.2209,0,0.04,0.01,0.01,0.16,0.0025,0.49,0,0.36,0.1849,0,0.0576,0.1681,0.1936,0,0.49,0.2401,0.3844,0.8649,0,0,0.0025,1,0.178353571,0.100557143,0.25615,17,53.13,25,78.13,5,62.5,7,87.5,7,87.5,6,75,13,81.25,12,75,81.66,63.5,89.5,94.5,79.12,82.38,80.94,-25,3.53,1,2,7,4.12,1.13,5.94,1,1,2,1,0,1,1,0,0,1,0,0,0,1,0,2,0,1,1,1,1,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,3,0,1,0.6,0.2,1,0.6,0.8,0.4,0.8,0.7,0.65,3.67,4.67,-3,-1,1,2,-1,10 cents,5 minutes,47 days,Prefer not to say,University - Undergraduate,35,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,1,1,0,0,0,0,-1,0,0,0,0,0,-1,1,0,1,-2,1,0.4,-0.2,-0.2,0.2,0.05,C_Ug +696,R_59nVyrToJ79uzG8,32 - 38,Canadian,Male,1,2,0,0,1,0,-1,0,0,0,0,0,0,0,0,-1,-1,0,0,-1,2,2,2,2,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,2,3,2,2,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,3,FALSE,1,100,TRUE,1,95,FALSE,1,75,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,95,TRUE,1,50,TRUE,1,95,TRUE,0,50,TRUE,0,95,TRUE,1,75,TRUE,0,95,TRUE,1,70,TRUE,1,75,TRUE,0,50,TRUE,0,75,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,FALSE,1,95,TRUE,1,50,TRUE,0,50,FALSE,1,75,TRUE,0,95,TRUE,1,95,FALSE,0,90,TRUE,1,85,0.0025,0.25,0.0625,0.0025,0.0225,0,0.25,0.0025,0.25,0.25,0.0025,0.0625,0.25,0.25,0,0.0025,0,0.25,0.0625,0.0025,0.25,0.09,0.25,0.9025,0.25,0.25,0.81,0,0.0625,0.5625,0.9025,0.9025,0.246071429,0.11375,0.378392857,20,62.5,21,65.63,3,37.5,5,62.5,6,75,7,87.5,14,87.5,7,43.75,75.78,63.12,81.88,81.88,76.25,76.25,75.31,-3.13,10.15,25.62,19.38,6.88,-11.25,-11.25,31.56,1,0,2,2,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,2,2,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1.2,0.2,0,0.6,1.4,0.2,0,0.6,0.5,0.55,5,5,0,0,0,2,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),33,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.2,0,0,0,-0.05,HS_TS +697,R_7gXzr1kaUlmsUSt,46 - 52,American,Male,2,2,2,1,1,-1,1,1,-1,1,1,1,2,1,1,-1,-1,-1,1,-1,2,2,2,1,2,1,-1,0,1,-1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,2,2,2,2,1,0,-2,1,0,1,0,6,1,1,1,1,1,1,-2,-2,-2,-2,2,9,FALSE,1,100,TRUE,1,83,TRUE,0,84,FALSE,1,59,TRUE,1,80,FALSE,1,77,TRUE,1,91,TRUE,1,91,TRUE,1,91,FALSE,0,100,FALSE,1,87,TRUE,0,93,TRUE,1,100,FALSE,1,74,TRUE,1,83,TRUE,1,100,FALSE,1,96,FALSE,1,100,FALSE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,88,TRUE,1,100,FALSE,1,76,FALSE,1,100,TRUE,0,94,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.0081,0,0,0.0081,0,0.0529,0,1,0,0,0,0,0.0081,0.0169,0.04,0.0289,0,0.1681,0,0.7744,0,0.0289,0.0196,0.0676,0.0016,0.0576,0.01,0,0.7056,0,0.8836,0.8649,0.168882143,0.093921429,0.243842857,27,84.38,27,84.38,8,100,7,87.5,6,75,6,75,15,93.75,12,75,91.34,81.88,93.38,94.12,96,94.31,88.38,0,6.96,-18.12,5.88,19.12,21,0.56,13.38,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,2,2,2,0,2,0,0,0,1,0,1,0,1,2,1,0,0,1,0,0,1,1,1,3,3,0.2,0.4,0.2,1.6,0.2,1,0.2,1.8,0.6,0.8,0.67,2.33,1,-5,-1,-9,-1.66,10 cents,100 minutes,24 days,Male,Trade School (non-military),51,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,0,-1,1,-1,1,-1,-2,0,0,0,0,0,0,1,1,1,-3,-1,0,-0.6,0,-0.2,-0.2,HS_TS +698,R_5IXegawSCFWVBBL,53 - 59,American,Male,-1,2,3,0,1,2,-2,-2,-2,2,1,0,2,0,1,2,2,2,2,1,0,2,2,0,1,7,1,0,1,-1,2,7,1,0,1,1,0,4,1,1,1,1,1,6,-1,2,2,1,1,5,1,-1,0,-1,1,5,1,-1,1,0,1,5,1,1,1,1,1,5,TRUE,0,100,TRUE,1,100,TRUE,0,54,TRUE,0,50,TRUE,1,52,FALSE,1,58,TRUE,1,100,TRUE,1,100,TRUE,1,57,TRUE,1,57,FALSE,1,100,TRUE,0,68,FALSE,0,100,TRUE,0,79,TRUE,1,58,TRUE,1,100,TRUE,0,58,TRUE,0,100,TRUE,0,54,FALSE,1,100,FALSE,0,57,TRUE,1,50,TRUE,0,54,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.1764,0.25,0.1849,0,0.25,0,1,0.1849,0,0.2304,0,0.2916,0.25,0,0,0.3249,0.1764,0.2916,0.6241,0.3364,0.7396,0,1,0.2916,1,1,0.4624,0.323757143,0.2013,0.446214286,21,65.63,19,59.38,5,62.5,3,37.5,5,62.5,6,75,14,87.5,5,31.25,79.44,75.62,72.38,85.75,84,80.06,78.81,6.25,20.06,13.12,34.88,23.25,9,-7.44,47.56,1,0,1,0,0,1,2,3,1,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,1,1,2,1,1,0,1,1,0,0,1,1,1,1,0,0.4,1.4,0.6,0.8,0.4,1.2,0.4,0.8,0.8,0.7,6,5,2,2,-1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,57,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,1,0,0,-1,0,0,1,1,0,-1,0,-1,0,1,1,0,0,0,0,0,0,0.2,0.2,0,0.1,C_Ug +699,R_3ozIW9Bv45r1Lyh,32 - 38,Canadian,Male,-1,2,1,0,3,-1,0,2,1,1,1,1,1,0,1,1,1,1,1,-1,-2,1,1,0,2,5,-1,1,1,0,2,4,0,-1,2,2,0,7,0,0,0,-1,1,6,0,3,2,1,2,2,0,1,1,1,0,3,1,1,1,0,1,2,1,1,1,2,0,3,FALSE,1,64,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,75,FALSE,1,54,FALSE,1,73,FALSE,1,81,FALSE,1,50,FALSE,0,86,TRUE,1,75,FALSE,1,50,TRUE,1,68,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,68,FALSE,0,50,FALSE,0,50,0.25,0.25,0.0625,0.25,0.25,0.25,0.1024,0.1225,0.25,0.0625,0.1024,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.7396,0.25,0.0361,0.25,0.2116,0.25,0.25,0.1296,0.25,0.0729,0.25,0.25,0.218557143,0.191414286,0.2457,3,9.38,22,68.75,4,50,5,62.5,6,75,7,87.5,6,37.5,16,100,57.47,53.88,58.75,59.62,57.62,60.44,54.5,-59.37,-11.28,3.88,-3.75,-15.38,-29.88,22.94,-45.5,1,1,0,0,1,0,1,1,1,1,1,2,1,2,1,1,1,1,2,2,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,1,1,0.6,0.8,1.4,1.4,1,0.8,0,0.4,1.05,0.55,5.33,2.33,3,1,5,3,3,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,-1,-1,0,-1,0,0,1,0,1,2,1,2,1,1,1,1,1,1,-0.4,0,1.4,1,0.5,C_Ug +700,R_6YX2sTgwzQSA3lu,53 - 59,American,Male,-2,3,3,2,2,-3,-3,3,-3,-1,3,-2,3,-3,3,-3,-3,-3,-3,-3,3,3,3,-3,3,0,-3,-3,3,-3,-3,0,3,-3,3,-3,3,0,1,1,1,1,-3,7,-3,3,3,3,-3,0,-3,-3,3,-3,-3,0,3,-3,3,-3,3,0,-3,-3,-3,-3,-3,5,TRUE,0,70,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,1,70,FALSE,0,50,TRUE,0,100,FALSE,1,100,TRUE,0,99,TRUE,0,61,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.25,0,0,0.25,0,0,0.3721,0,0,0.01,0.25,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.09,0.9801,1,1,0.25,0,0.49,1,0,1,1,0.364007143,0.188007143,0.540007143,20,62.5,18,56.25,5,62.5,3,37.5,6,75,4,50,12,75,6,37.5,80.94,71.12,80,90,82.62,85,76.88,6.25,24.69,8.62,42.5,15,32.62,10,39.38,5,0,0,5,1,0,0,0,0,2,0,1,0,0,0,4,4,4,4,0,1,0,0,1,5,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,2.2,0.4,0.2,3.2,1.4,0.4,0.2,0,1.5,0.5,0,0,0,0,0,2,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),57,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,4,0,0,4,-4,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0.8,0,0,3.2,1,HS_TS +701,R_7tx5RrfukbAwIJr,46 - 52,American,Male,0,2,1,1,-3,1,0,2,0,1,3,3,3,3,3,2,2,2,2,2,-2,2,2,0,-2,0,0,0,2,0,0,0,2,2,1,2,1,0,2,2,2,2,0,0,0,0,0,0,-1,0,2,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,0,50,FALSE,0,100,FALSE,1,56,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,1,51,TRUE,0,75,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,0,100,TRUE,1,100,1,1,1,0,0,1,0.2401,0,0.25,0.25,1,0,0,0.25,0.25,0,1,1,1,0.5625,0.25,0.25,0,0.25,0.1936,0.25,1,1,1,1,0.25,1,0.473078571,0.374292857,0.571864286,13,40.63,12,37.5,4,50,4,50,2,25,2,25,7,43.75,5,31.25,82.25,81.25,75.75,84.38,87.62,84.44,80.06,3.13,44.75,31.25,25.75,59.38,62.62,40.69,48.81,2,0,1,1,1,1,0,0,0,1,1,1,2,1,2,0,0,0,0,2,0,2,1,1,2,1,0,2,0,1,1,1,1,1,3,2,2,2,2,2,1,0.4,1.4,0.4,1.2,0.8,1.4,2,0.8,1.35,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),48,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,2,-2,0,0,-1,0,0,-2,0,0,0,0,1,0,-1,-2,-2,-2,-2,0,-0.2,-0.4,0,-1.6,-0.55,HS_TS +702,R_5sGDbJBH9foLL7X,39 - 45,Canadian,Male,3,3,3,3,3,0,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,2,3,3,3,0,3,5,1,-3,3,-3,3,5,3,-3,3,-3,3,5,1,1,-2,-2,2,2,3,3,3,3,3,0,0,-3,3,-3,3,0,3,-3,3,-3,3,0,3,3,3,3,-3,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,73,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,91,FALSE,1,73,TRUE,1,100,TRUE,0,50,FALSE,1,90,TRUE,0,100,TRUE,1,100,TRUE,1,73,TRUE,1,100,0,0,0,0,0,0,0.0081,0,1,0,0,0,0,1,0,0,1,1,0.01,0.0729,0,0.0729,1,1,1,0.25,0.0729,1,1,1,1,1,0.445957143,0.286292857,0.605621429,25,78.13,19,59.38,4,50,5,62.5,5,62.5,5,62.5,16,100,3,18.75,95.31,87,100,96.62,97.62,96.06,94.56,18.75,35.93,37,37.5,34.12,35.12,-3.94,75.81,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,2,2,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0.6,0.2,0,2.8,0,0,0,1,0.9,0.25,5,0,5,5,5,2,5,5 cents,5 minutes,24 days,Male,High School (or equivalent),44,2,1,1,0,0,0,1,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,2,2,5,5,-5,0.6,0.2,0,1.8,0.65,HS_TS +703,R_1rpsJJpEBZlalKj,39 - 45,American,Male,3,3,3,1,3,2,2,3,-3,3,2,3,3,3,2,2,3,3,2,2,3,3,3,2,3,9,2,1,3,-3,3,10,3,2,3,2,3,10,2,3,3,2,-1,10,3,3,3,2,3,10,3,3,2,-3,2,10,3,3,3,2,2,9,2,3,2,3,2,10,TRUE,0,83,FALSE,0,50,TRUE,0,100,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,51,FALSE,1,51,FALSE,0,50,FALSE,1,51,TRUE,1,94,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,86,FALSE,1,75,TRUE,1,98,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,1,97,FALSE,1,96,FALSE,1,94,FALSE,1,97,FALSE,0,96,FALSE,0,99,TRUE,1,97,0,0.0009,0,0,0.0009,0.25,0,0.0036,0.0625,0.0025,0.9216,0.25,0,0.2401,0.25,0.25,0,1,0.0036,0.0081,0.0004,0.0036,0.0196,0.2401,0.25,0.0016,0.9801,0.6889,1,0,0.0009,0.2401,0.23815,0.2308,0.2455,28,87.5,24,75,5,62.5,6,75,7,87.5,6,75,11,68.75,13,81.25,84.22,84.5,74,88.88,89.5,88.75,79.69,12.5,9.22,22,-1,1.38,14.5,20,-1.56,0,0,0,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,0,3,0,0,0,1,0,1,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0.2,0.2,0.8,0.6,0.2,0.8,0.4,0.4,0.45,0.45,9.67,9.67,-1,0,1,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),42,1.875,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,0,-1,0,-1,0,1,0,0,1,0,0,-1,-1,3,0,-0.6,0.4,0.2,0,grad_prof +704,R_1L0iPBv1CXiyvPF,53 - 59,American,Male,2,2,2,2,-2,-1,-1,1,-2,-2,1,1,1,0,1,-2,-1,-1,-1,-3,2,2,2,2,-1,3,-2,-2,1,-2,0,3,1,1,1,1,1,3,-2,-2,-2,-2,-2,3,2,2,2,2,0,3,0,-2,2,-2,0,3,2,2,2,-1,2,2,1,1,1,1,0,3,FALSE,1,81,TRUE,1,97,TRUE,0,99,TRUE,0,73,TRUE,1,71,FALSE,1,77,TRUE,1,98,TRUE,1,93,TRUE,1,91,TRUE,1,65,FALSE,1,76,FALSE,1,100,TRUE,1,90,FALSE,1,77,FALSE,0,62,TRUE,1,99,TRUE,0,90,TRUE,0,99,FALSE,1,57,FALSE,1,83,FALSE,0,62,TRUE,1,97,TRUE,0,79,TRUE,1,95,FALSE,1,95,TRUE,1,100,FALSE,1,57,FALSE,1,89,TRUE,0,89,TRUE,1,96,FALSE,0,55,TRUE,1,100,0.0049,0,0.0001,0.0004,0,0.0529,0.0025,0.1225,0.0289,0.0009,0.0016,0.01,0.0081,0.0576,0.0841,0.0009,0.6241,0.5329,0.0121,0.0025,0.3844,0.3844,0.1849,0.0529,0.81,0.1849,0.3025,0.0361,0.9801,0.9801,0.7921,0,0.236928571,0.109071429,0.364785714,25,78.13,23,71.88,5,62.5,4,50,7,87.5,7,87.5,13,81.25,10,62.5,84.12,71,82.25,89,94.25,85.69,82.56,6.25,12.24,8.5,32.25,1.5,6.75,4.44,20.06,0,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,1,1,1,1,0,0,0,0,2,1,1,1,0,2,1,1,1,1,1,3,2,2,2,3,0.2,0.8,0.2,0.8,0.4,1,1,2.4,0.5,1.2,3,2.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,-1,0,0,-1,0,0,-1,-1,-1,0,-1,-3,-1,-1,-1,-2,-0.2,-0.2,-0.8,-1.6,-0.7,C_Ug +705,R_1ILfv5LW2t6taE3,32 - 38,Canadian,Male,1,2,2,2,-3,-3,-3,0,-1,0,1,2,2,0,1,-2,0,-1,-2,1,1,1,1,1,-3,7,0,0,0,0,0,6,1,1,1,1,1,6,1,0,1,0,0,7,1,3,2,1,-3,7,-3,-3,0,0,0,1,1,1,2,0,0,9,0,0,0,0,0,7,FALSE,1,95,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,91,TRUE,1,100,TRUE,0,93,TRUE,0,94,TRUE,1,91,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,90,TRUE,0,100,TRUE,1,94,TRUE,1,63,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,88,TRUE,0,57,FALSE,1,100,TRUE,0,90,TRUE,1,90,TRUE,1,90,TRUE,1,100,0.0025,0.0144,0,0,0,0,0,0,1,0.1369,0.01,0.0081,0.0081,0.8649,0,0,0.25,0.25,0,0.5625,0.0036,0.25,0.81,1,0.25,0.3249,0.01,0.0025,1,1,0.81,0.8836,0.336967857,0.180571429,0.493364286,22,68.75,20,62.5,4,50,6,75,5,62.5,5,62.5,16,100,4,25,87.38,77.62,84.38,90.12,97.38,90.75,84,6.25,24.88,27.62,9.38,27.62,34.88,-9.25,59,0,1,1,1,0,3,3,0,1,0,0,1,1,1,0,3,0,2,2,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,1,2,0,1,2,1,0.6,1.4,0.6,1.6,0.4,0.2,0.4,1.2,1.05,0.55,6.33,5.67,0,5,-3,0,0.66,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,37,0.875,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,1,0,0,3,3,0,0,0,0,0,1,1,-1,1,0,1,0,0,0.2,1.2,0.2,0.4,0.5,C_Ug +706,R_1xKnFWKG19g38RR,25 - 31,Canadian,Male,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,32,100,17,53.13,4,50,5,62.5,4,50,4,50,16,100,1,6.25,100,100,100,100,100,100,100,46.87,46.87,50,37.5,50,50,0,93.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,28,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +707,R_6CUhgLMp2tRMApz,32 - 38,Canadian,Male,2,3,3,3,-2,-1,0,0,1,1,3,1,2,3,3,-2,-2,-2,-1,-3,-2,3,3,3,-2,2,-2,-2,-2,-2,-2,3,0,-3,0,0,0,2,2,3,2,2,3,3,1,3,2,3,-2,2,0,1,2,1,-2,4,3,0,2,3,3,7,-2,-2,-2,-2,-3,2,TRUE,0,81,TRUE,1,56,FALSE,1,64,TRUE,0,52,TRUE,1,52,TRUE,0,55,TRUE,1,51,TRUE,1,74,TRUE,1,54,TRUE,1,55,TRUE,0,51,TRUE,0,100,TRUE,1,100,FALSE,1,51,TRUE,1,70,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,60,FALSE,1,50,TRUE,1,100,TRUE,1,76,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,61,TRUE,0,50,TRUE,0,100,TRUE,0,71,TRUE,1,81,FALSE,0,66,TRUE,1,100,0.0676,0.1521,0,0.2401,0,0.3025,0,0.2025,0.25,0.0576,0.0361,0,0.2116,0.2601,0.2304,0.1936,0.25,0.2704,1,0,0,0.09,0.36,0.2401,0.25,0.25,0.4356,0.6561,0.1296,1,0.5041,1,0.292153571,0.161771429,0.422535714,10,31.25,19,59.38,3,37.5,4,50,6,75,6,75,15,93.75,4,25,71.28,57.38,72.25,71.88,83.62,74.75,67.81,-28.13,11.9,19.88,22.25,-3.12,8.62,-19,42.81,4,0,0,0,0,1,2,2,3,3,3,4,2,3,3,4,5,4,3,6,1,0,1,0,0,1,1,2,0,3,0,1,0,0,0,0,0,0,1,0,0.8,2.2,3,4.4,0.4,1.4,0.2,0.2,2.6,0.55,2.33,4.33,0,-1,-5,1,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,32,1.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,3,0,-1,0,0,0,1,0,3,0,3,3,2,3,3,4,5,4,2,6,0.4,0.8,2.8,4.2,2.05,C_Ug +708,R_1o6n2BEn75fNXkS,53 - 59,American,Male,0,3,3,0,2,3,-2,3,-2,3,3,2,1,0,2,2,3,3,3,2,1,3,3,-3,0,7,2,0,2,-1,2,6,2,2,2,1,1,6,-1,1,1,1,-1,7,2,3,3,2,3,5,3,-3,3,-3,3,2,3,1,2,2,2,2,3,3,3,3,3,3,TRUE,0,56,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,63,FALSE,1,96,TRUE,1,91,TRUE,1,100,TRUE,1,96,FALSE,0,77,FALSE,1,96,TRUE,0,97,TRUE,1,50,TRUE,0,80,FALSE,0,54,TRUE,1,90,FALSE,1,59,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,77,FALSE,1,100,FALSE,0,71,TRUE,0,91,TRUE,1,100,FALSE,1,62,FALSE,1,70,FALSE,1,55,TRUE,1,98,FALSE,0,58,TRUE,1,99,0,0,0.01,0.0081,0.0001,0.0016,0.5041,0.5929,0,0.5929,0.0004,0.25,0.0016,0.0016,0.1369,0.25,0,0.25,0.09,0.8281,0,0.2916,0.25,0.64,0.1681,0.1444,0.3364,0.3136,1,0,0.2025,0.9409,0.278132143,0.184435714,0.371828571,23,71.88,21,65.63,5,62.5,8,100,3,37.5,5,62.5,10,62.5,11,68.75,79.25,64.5,77.75,84,90.75,79.62,78.88,6.25,13.62,2,-22.25,46.5,28.25,17.12,10.13,1,0,0,3,2,1,2,1,1,1,1,0,1,1,1,3,2,2,2,3,2,0,0,2,1,0,1,0,1,0,0,1,1,2,0,1,0,0,0,1,1.2,1.2,0.8,2.4,1,0.4,0.8,0.4,1.4,0.65,6.33,3,2,4,4,4,3.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,-1,0,0,1,1,1,1,1,0,1,1,-1,0,-1,1,2,2,2,2,2,0.2,0.8,0,2,0.75,C_Ug +709,R_5M02t0GA7k6Eymg,39 - 45,Canadian,Male,3,3,3,3,3,1,0,1,-2,1,1,3,3,1,1,2,1,2,1,-2,3,3,3,3,3,2,1,1,1,1,1,6,1,1,1,1,1,7,1,1,2,2,1,3,3,3,3,3,3,5,2,0,3,0,3,5,3,3,3,3,3,8,2,2,2,2,2,5,TRUE,0,81,FALSE,0,82,FALSE,1,80,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,82,FALSE,0,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,79,TRUE,1,81,FALSE,0,100,FALSE,1,73,TRUE,0,100,FALSE,1,71,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,79,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,1,0,0,0,0,1,0,0,0,0,0.0324,0.25,0.25,0.6724,0,0.25,1,0.04,1,0.0361,0.0841,0.0441,0.0729,0.25,0,0.6561,0.04,1,0.6241,1,0.296507143,0.175342857,0.417671429,26,81.25,22,68.75,6,75,6,75,5,62.5,5,62.5,12,75,10,62.5,87.12,70.75,87.75,92.5,97.5,93.44,80.81,12.5,18.37,-4.25,12.75,30,35,18.44,18.31,0,0,0,0,0,0,1,0,3,0,0,2,2,0,0,1,0,0,1,3,0,0,0,0,0,1,0,2,2,2,2,0,0,2,2,0,1,0,1,4,0,0.8,0.8,1,0,1.4,1.2,1.2,0.65,0.95,5,6,-3,1,-1,-2,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,43,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,1,-2,1,-2,-2,2,2,-2,-2,1,-1,0,0,-1,0,-0.6,-0.4,-0.2,-0.3,C_Ug +710,R_1xwnkrmdgUDTVa9,39 - 45,American,Male,3,2,3,1,3,-1,3,3,1,-1,1,-1,3,3,3,1,1,3,1,2,0,2,3,3,2,4,3,2,1,2,2,8,2,1,3,0,2,8,2,2,2,3,2,7,2,2,3,3,1,7,2,1,1,2,3,8,3,2,1,2,3,9,3,2,1,3,2,8,FALSE,1,100,TRUE,1,98,FALSE,1,100,FALSE,1,79,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,93,TRUE,1,100,FALSE,1,90,FALSE,1,84,FALSE,0,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,70,TRUE,0,89,FALSE,1,98,FALSE,0,91,TRUE,1,80,TRUE,0,86,TRUE,1,100,TRUE,0,86,FALSE,0,80,TRUE,0,100,FALSE,1,72,TRUE,0,86,FALSE,0,93,TRUE,1,82,TRUE,1,100,0,0.64,0,0,0,0,0,0,0.0004,0.04,0.8649,0.6561,0.8649,0.01,0.0025,0.0004,0.7396,0.0441,0.0784,0.7396,0.8281,0,0.7921,0,0.25,1,0.0324,0,0,0.09,0.7396,0.0256,0.278525,0.230207143,0.326842857,23,71.88,21,65.63,5,62.5,3,37.5,6,75,7,87.5,11,68.75,10,62.5,90.09,91.38,86.12,89.5,93.38,93.31,86.88,6.25,24.46,28.88,48.62,14.5,5.88,24.56,24.38,3,0,0,2,1,4,1,2,1,3,1,2,0,3,1,1,1,1,2,0,1,0,0,2,2,3,2,2,1,4,2,3,2,1,0,2,1,2,2,0,1.2,2.2,1.4,1,1,2.4,1.6,1.4,1.45,1.6,6.67,8,-3,0,-1,-1,-1.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,0.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,0,0,0,-1,1,-1,0,0,-1,-1,-1,-2,2,1,-1,0,-1,0,0,0.2,-0.2,-0.2,-0.4,-0.15,C_Ug +711,R_7YzQfRm2q7nhZW9,39 - 45,Canadian,Male,3,3,3,-3,3,-2,1,2,0,1,1,-3,1,-1,3,2,2,3,3,2,3,3,3,-3,3,3,-3,1,-1,-2,2,3,2,-1,-1,-1,2,6,2,3,3,2,3,3,3,3,3,-3,3,2,-3,1,2,0,2,3,1,-3,2,-2,3,3,3,2,3,3,2,2,FALSE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,0,62,TRUE,1,99,TRUE,1,91,TRUE,1,96,FALSE,1,60,TRUE,0,89,TRUE,1,100,FALSE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,96,TRUE,0,98,TRUE,0,65,FALSE,1,100,FALSE,0,78,TRUE,1,94,FALSE,1,100,TRUE,1,93,TRUE,0,75,TRUE,1,81,TRUE,0,63,FALSE,1,54,TRUE,0,93,TRUE,1,74,FALSE,0,50,TRUE,1,95,0.0001,0.0361,0,0.3844,0.0025,0,0.0049,0.0016,0,0.0036,0.0676,0,0.0081,0.16,0,0,0,0.25,0.2116,0.5625,0.6084,0.4225,0.4225,0,0.0016,0.3969,0.25,0.0025,0,0.9604,0.8649,0.7921,0.214078571,0.035592857,0.392564286,24,75,22,68.75,4,50,6,75,5,62.5,7,87.5,12,75,10,62.5,84.88,68,95.25,87.62,88.62,86.12,83.62,6.25,16.13,18,20.25,25.12,1.12,11.12,21.12,0,0,0,0,0,1,0,3,2,1,1,2,2,0,1,0,1,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1.4,1.2,0.6,0,0.4,0.4,0.2,0.8,0.25,4,2.67,1,0,3,1,1.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),39,1.625,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,3,2,0,1,2,1,-1,1,-1,1,0,1,1,0,1,0.8,0.4,0.55,grad_prof +712,R_5obSekahAU98dbX,25 - 31,Canadian,Male,2,2,-1,1,2,2,1,2,-2,1,-2,3,2,1,-2,-2,-2,-1,-2,-2,3,1,1,1,2,5,2,-1,-2,1,1,4,2,-1,1,1,1,3,2,1,1,-2,2,7,2,1,-1,1,2,2,3,-1,2,-3,-1,1,1,3,1,2,-3,0,1,1,2,2,-1,5,TRUE,0,89,TRUE,1,90,TRUE,0,100,FALSE,1,85,TRUE,1,84,FALSE,1,76,TRUE,1,100,TRUE,1,86,TRUE,1,66,TRUE,1,71,FALSE,1,80,FALSE,1,75,TRUE,1,96,FALSE,1,96,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,66,FALSE,1,88,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,85,FALSE,1,90,TRUE,1,86,TRUE,0,50,FALSE,1,91,FALSE,1,90,FALSE,0,80,FALSE,0,91,TRUE,1,80,0.0196,0.0196,0,0,0.04,0.0576,0.0225,0.0841,0.0144,0,0.64,0.0016,0.1156,0.04,0.0256,0.01,0,0.0225,0.0081,0.01,0.5625,1,0.4356,0.0016,0.25,0.25,0.8281,0.7921,1,1,0.01,0.0625,0.260157143,0.076707143,0.443607143,25,78.13,23,71.88,4,50,7,87.5,6,75,6,75,12,75,11,68.75,84.88,78.5,81.38,91.5,88.12,86.88,82.88,6.25,13,28.5,-6.12,16.5,13.12,11.88,14.13,1,1,2,0,0,0,2,4,3,0,4,4,1,0,3,4,3,2,0,4,0,1,0,0,0,1,2,0,1,2,3,0,1,1,1,3,3,3,4,1,0.8,1.8,2.4,2.6,0.2,1.2,1.2,2.8,1.9,1.35,4,1,3,3,3,2,3,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),28,-0.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,01DIR,1,0,2,0,0,-1,0,4,2,-2,1,4,0,-1,2,1,0,-1,-4,3,0.6,0.6,1.2,-0.2,0.55,grad_prof +713,R_7Z0VCH5qavegU2R,25 - 31,Canadian,Male,-1,3,1,-1,2,-1,1,-2,2,1,-3,-2,3,2,2,0,-1,-2,-1,-3,-3,3,-3,-3,-2,9,-3,3,-3,3,-3,7,1,-3,-2,2,-3,8,-3,-1,-3,-2,-3,8,1,3,0,2,2,8,-2,-1,1,-1,0,4,-1,-3,2,-2,1,6,1,2,2,1,-2,7,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,54,FALSE,0,56,TRUE,0,74,TRUE,1,100,TRUE,1,91,FALSE,0,65,TRUE,1,76,TRUE,0,70,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,TRUE,0,53,TRUE,0,97,TRUE,0,86,FALSE,1,53,TRUE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,82,TRUE,0,54,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,87,TRUE,1,100,FALSE,0,52,TRUE,1,100,0.0081,0,0,0,0,0.5476,0.0324,0.0576,0.2209,0,0,0,0.4225,0.49,0.3136,0,0,0.2916,0,0.2916,0.2304,0.1681,0.7396,0,0.2809,0.2401,0.2704,1,1,0.9409,0.7569,1,0.331967857,0.169728571,0.494207143,25,78.13,18,56.25,3,37.5,4,50,5,62.5,6,75,13,81.25,5,31.25,81.62,67.12,77.75,90.88,90.75,83.31,79.94,21.88,25.37,29.62,27.75,28.38,15.75,2.06,48.69,2,0,4,2,4,2,2,1,1,4,4,1,5,0,5,3,0,1,1,0,2,0,1,3,0,1,2,3,3,1,2,1,1,4,1,1,3,4,2,1,2.4,2,3,1,1.2,2,1.8,2.2,2.1,1.8,8,6,1,3,2,1,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,28,1,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,3,-1,4,1,0,-2,-2,3,2,0,4,-4,4,2,-3,-3,-1,-1,1.2,0,1.2,-1.2,0.3,C_Ug +714,R_1OTP4KVeTkcmHWa,32 - 38,Canadian,Male,2,2,3,2,0,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,1,2,1,1,2,7,2,1,1,-1,2,6,1,2,1,1,1,7,1,1,1,2,2,7,1,2,2,2,2,7,1,1,2,1,1,7,2,2,1,2,2,7,2,1,2,2,2,7,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,TRUE,1,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,TRUE,0,81,TRUE,1,77,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,78,FALSE,1,67,TRUE,1,85,TRUE,1,98,FALSE,1,100,TRUE,1,67,FALSE,1,72,TRUE,1,73,TRUE,0,78,FALSE,1,80,TRUE,0,77,TRUE,1,83,FALSE,0,83,TRUE,1,83,0.0256,0.0729,0,0,0.0289,0,0.1089,0,0.1089,0.0004,0.0289,0,0,0.09,0,0.25,0,0.25,0.04,0.0784,0.0225,0.0529,0.0484,0.6561,0,0.6084,0.6889,1,1,1,0.5929,0,0.237660714,0.061857143,0.413464286,23,71.88,24,75,5,62.5,7,87.5,5,62.5,7,87.5,15,93.75,9,56.25,85.5,73.25,93.12,90.5,85.12,86.44,84.56,-3.12,10.5,10.75,5.62,28,-2.38,-7.31,28.31,1,0,2,1,2,0,0,1,3,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,2,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1.2,0.8,0.8,0.4,0.8,0.6,0.2,0,0.8,0.4,6.67,7,0,-1,0,0,-0.33,10 cents,5 minutes,24 days,Male,University - Undergraduate,38,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,1,1,0,-1,0,1,2,-1,1,0,0,1,1,1,0,1,0,0,0.4,0.2,0.6,0.4,0.4,C_Ug +715,R_7qg4gPN4iucazxe,53 - 59,American,Male,1,3,3,3,3,0,3,3,3,3,3,3,3,3,3,-3,-3,-3,-3,-3,3,3,3,3,3,1,3,3,3,3,3,4,3,3,3,3,3,1,0,0,0,0,-3,10,1,3,3,3,1,1,1,-3,3,1,2,1,3,3,3,3,3,1,3,3,3,3,-3,8,FALSE,1,68,TRUE,1,100,TRUE,0,100,FALSE,1,59,FALSE,0,61,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,91,TRUE,0,100,TRUE,1,100,FALSE,1,91,FALSE,0,76,TRUE,1,100,FALSE,1,76,TRUE,0,100,FALSE,1,92,FALSE,1,67,FALSE,0,87,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,85,TRUE,1,100,0,0,0,0,0,0.0036,0,1,0.1089,0,0,0,0,0.0081,0.3721,0,0,0.1681,0,0,0.7569,0.5776,0.0064,0.0081,0.0576,0.01,0.7225,0.1024,1,1,1,1,0.282225,0.118628571,0.445821429,25,78.13,23,71.88,6,75,5,62.5,6,75,6,75,11,68.75,12,75,91.78,86.62,89.75,94.88,95.88,94.31,89.25,6.25,19.9,11.62,27.25,19.88,20.88,25.56,14.25,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,2,1,6,0,2,1,0,0,0,0,0,6,6,6,6,0,0.4,0.6,0,2.4,0.4,2,0,4.8,0.85,1.8,2,1,0,3,0,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,0.875,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,2,0,0,0,-2,2,-6,0,-2,-1,0,0,0,0,0,-3,-3,-3,-3,0,0,-1.4,0,-2.4,-0.95,C_Ug +716,R_6cjwQtHPkI4LZLd,25 - 31,Canadian,Male,1,3,2,2,3,1,3,2,2,1,2,3,2,3,1,3,1,2,2,2,1,2,1,2,2,7,1,1,1,2,2,8,1,1,3,3,2,8,1,3,2,3,2,7,1,2,3,3,1,8,2,2,1,3,1,8,1,1,2,1,3,8,3,1,2,2,1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,74,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.25,0,0.25,0,0,0.0676,0,0,0,0,0,0,0,1,0.25,0,0,0,0,1,0,1,1,0,0,1,1,1,1,0.305985714,0.111971429,0.5,27,84.38,23,71.88,6,75,5,62.5,6,75,6,75,15,93.75,8,50,94.5,93.75,93.75,93.75,96.75,96.88,92.12,12.5,22.62,18.75,31.25,18.75,21.75,3.13,42.12,0,1,1,0,1,0,2,1,0,1,1,2,1,0,1,2,2,0,1,0,0,1,1,1,2,1,1,1,1,0,1,2,0,2,2,0,0,0,0,1,0.6,0.8,1,1,1,0.8,1.4,0.2,0.85,0.85,7.67,8,-1,0,0,-1,-0.33,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,29,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-1,-1,-1,1,0,-1,1,0,0,1,-2,-1,2,2,0,1,-1,-0.4,0,-0.4,0.8,0,C_Ug +717,R_65ZVP5XDElZvCWG,25 - 31,Canadian,Male,2,2,1,1,2,2,2,1,1,2,1,1,2,1,1,2,2,2,2,1,2,2,1,3,1,8,1,1,1,2,0,8,1,1,2,2,1,8,1,1,1,2,2,8,1,2,3,0,2,7,1,1,1,0,1,8,1,1,2,2,1,8,2,1,1,1,2,8,FALSE,1,90,FALSE,0,74,TRUE,0,89,FALSE,1,93,FALSE,0,81,TRUE,0,79,FALSE,0,76,TRUE,1,81,TRUE,1,83,FALSE,0,83,FALSE,1,88,FALSE,1,83,TRUE,1,86,TRUE,0,90,FALSE,0,73,TRUE,1,91,TRUE,0,85,TRUE,0,89,TRUE,0,93,FALSE,1,74,TRUE,1,78,FALSE,0,73,TRUE,0,85,FALSE,0,80,FALSE,1,84,TRUE,1,76,FALSE,1,84,TRUE,0,85,TRUE,0,67,TRUE,1,73,TRUE,1,83,FALSE,0,71,0.0361,0.0576,0.0081,0.5776,0.5041,0.6241,0.64,0.6889,0.0676,0.5329,0.0729,0.0196,0.0289,0.0144,0.6561,0.5476,0.7225,0.0049,0.7225,0.0256,0.0484,0.5329,0.8649,0.81,0.7225,0.0256,0.0289,0.01,0.7921,0.7921,0.4489,0.0289,0.392064286,0.366035714,0.418092857,16,50,15,46.88,5,62.5,2,25,3,37.5,5,62.5,8,50,7,43.75,81.88,83.88,79,82.62,82,78.88,84.88,3.12,35,21.38,54,45.12,19.5,28.88,41.13,0,0,0,2,1,1,1,0,1,2,0,0,0,1,0,1,1,1,0,1,1,0,2,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,1,0.6,1,0.2,0.8,0.8,0.8,0.2,0.8,0.65,0.65,8,7.67,1,0,0,0,0.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),27,0,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-1,0,-2,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,-1,0,-0.2,0.2,0,0,0,grad_prof +718,R_5RG0avAu55kmmoV,32 - 38,Canadian,Male,2,2,2,2,3,0,-2,3,-2,2,2,-1,3,2,1,3,3,3,1,1,2,3,0,3,2,7,2,0,-1,2,3,7,-1,-3,0,-2,3,5,-2,-2,-2,-2,-2,10,3,3,3,3,3,6,0,-3,3,-3,1,5,2,0,3,2,2,5,3,3,3,3,3,5,TRUE,0,75,FALSE,0,58,TRUE,0,97,TRUE,0,56,FALSE,0,57,TRUE,0,82,TRUE,1,93,TRUE,1,98,FALSE,0,98,TRUE,1,99,FALSE,1,96,TRUE,0,100,TRUE,1,83,TRUE,0,85,TRUE,1,80,TRUE,1,92,FALSE,1,92,TRUE,0,95,TRUE,0,90,FALSE,1,92,FALSE,0,91,FALSE,0,76,FALSE,1,71,TRUE,1,72,FALSE,1,65,FALSE,0,63,FALSE,1,68,FALSE,1,76,FALSE,1,54,TRUE,1,58,TRUE,1,56,TRUE,1,91,0.0004,0.3969,0.0064,0.0049,0.0081,0.6724,0.0784,0.0001,0.0064,0.5776,0.1764,0.0289,0.9604,0.0016,0.3249,0.3364,0.0841,0.3136,0.0576,0.1225,0.8281,0.04,0.81,0.7225,0.0064,0.1024,0.1936,0.5625,0.9409,0.9025,0.2116,1,0.359639286,0.25495,0.464328571,11,34.38,18,56.25,4,50,5,62.5,3,37.5,6,75,10,62.5,8,50,79.97,75.25,77.62,81.38,85.62,79.06,80.88,-21.87,23.72,25.25,15.12,43.88,10.62,16.56,30.88,0,1,2,1,1,2,2,4,4,1,3,2,3,4,2,5,5,5,3,3,1,1,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,2,2,1,2.6,2.8,4.2,0.8,0.6,0.4,0.8,2.65,0.65,6.33,5.33,1,2,0,5,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,1,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,0,1,0,1,2,1,4,3,0,3,1,3,4,1,5,5,5,1,1,0.2,2,2.4,3.4,2,HS_TS +719,R_7fek83LkP4smdCV,32 - 38,American,Male,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,7,2,2,2,2,2,8,2,2,2,1,1,9,1,2,2,2,1,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,8,TRUE,0,74,TRUE,1,75,TRUE,0,87,TRUE,0,79,TRUE,1,84,TRUE,0,76,TRUE,1,81,TRUE,1,79,TRUE,1,81,TRUE,1,80,TRUE,0,79,TRUE,0,77,TRUE,1,80,TRUE,0,77,TRUE,1,79,TRUE,1,80,TRUE,0,74,TRUE,0,81,TRUE,0,92,TRUE,0,70,TRUE,1,83,TRUE,1,75,TRUE,0,89,TRUE,1,72,TRUE,0,81,TRUE,1,78,FALSE,1,70,TRUE,0,65,FALSE,1,78,TRUE,1,71,TRUE,1,74,TRUE,1,82,0.0441,0.0484,0.04,0.0361,0.0324,0.5776,0.0784,0.04,0.49,0.0625,0.0841,0.04,0.0361,0.6241,0.0256,0.0625,0.7921,0.6241,0.4225,0.6561,0.0289,0.0441,0.8464,0.5929,0.5476,0.09,0.0676,0.5476,0.7569,0.6561,0.0484,0.5929,0.338125,0.254964286,0.421285714,19,59.38,18,56.25,5,62.5,5,62.5,4,50,4,50,16,100,2,12.5,78.22,78.62,80.75,78.38,75.12,78.38,78.06,3.13,21.97,16.12,18.25,28.38,25.12,-21.62,65.56,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.4,0,0.4,0.4,0,0,0,0,0.3,0,8,8.33,-1,0,0,0,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),34,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0.4,0,0.4,0.4,0.3,HS_TS +720,R_7wlVNalzLhBlkyZ,18 - 24,American,Male,2,3,2,-2,2,1,0,1,1,1,2,1,2,-1,2,1,2,3,1,2,-2,3,2,-2,2,6,2,-2,2,-2,2,3,2,2,2,-2,2,3,2,2,2,2,2,5,2,2,2,0,2,4,2,-2,2,-2,1,5,2,1,1,-2,1,5,2,2,2,2,2,3,FALSE,1,98,FALSE,0,50,FALSE,1,94,TRUE,0,88,FALSE,0,50,FALSE,1,71,FALSE,0,50,TRUE,1,78,FALSE,0,64,TRUE,1,100,FALSE,1,100,TRUE,0,76,TRUE,1,97,TRUE,0,64,FALSE,0,70,TRUE,1,76,TRUE,0,80,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,75,FALSE,0,50,TRUE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,86,TRUE,0,83,FALSE,0,76,FALSE,0,76,TRUE,1,90,0.0484,0,0.0576,0.25,0.01,0.0841,0.01,0,0,0.25,0.5776,0.0009,0.4096,0,0.25,0.25,1,0.7744,0.7396,0,0.0625,0.49,0.25,0.4096,0.64,0.5625,0.5776,0.0004,0.0036,1,0.6889,0.5776,0.343532143,0.258328571,0.428735714,12,37.5,15,46.88,2,25,4,50,4,50,5,62.5,8,50,7,43.75,79.91,71.62,80.75,82.75,84.5,74.5,85.31,-9.38,33.03,46.62,30.75,32.75,22,24.5,41.56,4,0,0,0,0,1,2,1,3,1,0,1,0,1,0,1,0,1,1,0,0,1,0,2,0,1,2,1,3,0,0,0,1,1,1,1,0,1,1,0,0.8,1.6,0.4,0.6,0.6,1.4,0.6,0.6,0.85,0.8,4,4.67,2,-2,-2,2,-0.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),23,1.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,4,-1,0,-2,0,0,0,0,0,1,0,1,-1,0,-1,0,0,0,0,0,0.2,0.2,-0.2,0,0.05,HS_TS +721,R_3U1U4COkEtoP4Kl,25 - 31,Canadian,Female,3,3,3,0,0,-2,-3,1,-2,-1,1,-3,3,0,2,0,0,0,0,0,3,3,3,0,0,5,-3,-3,0,-3,0,5,2,-3,3,0,2,5,0,0,0,0,0,5,3,3,3,0,0,5,-3,-3,1,-2,0,5,2,0,3,0,2,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,73,TRUE,0,100,FALSE,1,87,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,68,TRUE,0,90,TRUE,1,73,FALSE,1,69,TRUE,1,73,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,0,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,100,TRUE,1,82,FALSE,0,66,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0324,0.0729,0,0.4624,0,0.0729,0.5041,0.0169,1,0,0.0576,0.0729,0.5776,0.0961,1,0.49,0.4356,1,1,1,1,0.81,0.346478571,0.082971429,0.609985714,16,50,20,62.5,4,50,5,62.5,6,75,5,62.5,15,93.75,5,31.25,89.81,76.62,90,96.12,96.5,90.19,89.44,-12.5,27.31,26.62,27.5,21.12,34,-3.56,58.19,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,3,0,0,0,0,0,0,0,0,0,0.8,0.2,0,0,0.4,0.8,0,0.25,0.3,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),25,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,1,1,0,0,-3,0,0,0,0,0,0,0,0,0,0.4,-0.6,0,-0.05,HS_TS +722,R_1qvUo44vR7P53GI,53 - 59,American,Male,-1,2,2,1,2,-1,-2,1,-1,1,2,2,2,0,2,-1,-2,-1,-1,-1,-2,1,1,1,1,3,-2,-2,1,-2,0,3,2,2,1,-1,1,2,-1,-1,-1,-1,0,6,-2,1,1,1,1,5,-1,-1,2,0,0,2,2,2,2,0,2,5,0,0,0,0,-1,5,TRUE,0,96,TRUE,1,97,TRUE,0,99,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,97,TRUE,1,97,TRUE,1,50,FALSE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,62,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,99,TRUE,0,50,FALSE,1,100,TRUE,1,62,TRUE,1,50,FALSE,1,97,FALSE,0,50,TRUE,0,92,TRUE,1,77,FALSE,1,50,FALSE,1,72,TRUE,0,50,TRUE,1,62,FALSE,0,50,TRUE,1,98,0.0009,0.0529,0.25,0.0009,0.0004,0,0.25,1,0,0.25,0.1444,0.25,0.25,0.25,0.25,0.0009,0.0009,0.25,0.0784,0.8464,0.1444,0.25,0.25,0.3844,0.25,0.25,0.25,0.9216,0.9801,0.0001,0.25,0.25,0.285785714,0.2069,0.364671429,17,53.13,21,65.63,4,50,7,87.5,4,50,6,75,13,81.25,8,50,70.53,55.88,69.62,84.12,72.5,68.12,72.94,-12.5,4.9,5.88,-17.88,34.12,-2.5,-13.13,22.94,1,1,1,0,1,1,0,0,1,1,0,0,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,1,1,1,0,0,0,0,0,1,2,1,1,0,0.8,0.6,0.6,0.4,0.8,0.8,0,1,0.6,0.65,2.67,4,-2,1,-3,1,-1.33,10 cents,100 minutes,15 days,Male,High School (or equivalent),59,1.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,1,-1,-1,0,0,0,0,1,1,1,-1,-1,-1,-1,1,0,-0.2,0.6,-0.6,-0.05,HS_TS +723,R_7wH4KDYIOiyWbXS,32 - 38,American,Male,0,2,2,1,1,0,0,1,-1,2,0,0,1,-2,1,1,1,1,1,0,0,1,1,-2,0,8,0,0,0,0,-1,5,1,1,0,-2,1,5,0,0,0,-1,0,7,0,1,1,1,0,5,0,-1,0,-1,1,3,1,1,1,-1,0,5,1,0,1,1,0,5,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,75,FALSE,0,50,FALSE,1,50,FALSE,0,100,FALSE,0,75,FALSE,0,75,FALSE,0,100,FALSE,1,75,TRUE,0,75,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,FALSE,1,75,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,75,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.5625,0,0,1,0,0.25,0.25,1,0.25,0,0,0.0625,0.5625,0.0625,0.25,0,0.25,0.0625,0,0,1,0,0.0625,0,0.5625,0.25,0.01,0,0.25,0,0.0625,0.5625,0.205714286,0.214285714,0.197142857,24,75,23,71.88,7,87.5,5,62.5,6,75,5,62.5,9,56.25,14,87.5,81.72,80,71.88,100,75,88.44,75,3.12,9.84,-7.5,9.38,25,12.5,32.19,-12.5,0,1,1,3,1,0,0,1,1,3,1,1,1,0,0,1,1,1,2,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,1,0,0,0,1.2,1,0.6,1,0.6,0.6,0.8,0.2,0.95,0.55,6,4.33,3,2,0,2,1.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,36,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,3,0,0,-1,0,1,2,0,0,1,-1,-1,1,0,1,2,0,0.6,0.4,-0.2,0.8,0.4,C_Ug +724,R_52DoAZyuOZpaNXC,46 - 52,American,Male,-1,3,0,2,0,-2,-3,1,-2,3,0,0,3,-3,3,-2,-1,-2,0,-3,-2,3,0,3,2,0,-3,-3,1,-3,3,4,-1,1,3,-3,3,1,-3,-1,-2,-2,-3,1,1,3,0,2,0,3,-3,-3,2,-3,2,2,-1,-2,3,-3,3,0,-1,0,0,-1,-3,6,FALSE,1,100,TRUE,1,84,FALSE,1,99,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,100,FALSE,0,61,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,86,FALSE,1,100,FALSE,0,100,TRUE,1,91,TRUE,0,50,FALSE,0,59,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,79,TRUE,1,100,0,0,0,0,0,0,0.3481,0,0,0.0081,0,0,0.25,0,0.25,0.0256,0.25,0.25,1,1,1,0.3721,0.7396,0,0.49,0.25,0.0441,0,0.0001,1,1,0.7225,0.321435714,0.0987,0.544171429,25,78.13,20,62.5,6,75,3,37.5,6,75,5,62.5,12,75,8,50,86.38,70,83.75,98.88,92.88,85.88,86.88,15.63,23.88,-5,46.25,23.88,30.38,10.88,36.88,1,0,0,1,2,1,0,0,1,0,1,1,0,0,0,1,0,0,2,0,2,0,0,0,0,1,0,1,1,1,1,2,0,0,0,1,1,2,1,0,0.8,0.4,0.4,0.6,0.4,0.8,0.6,1,0.55,0.7,1.67,1.67,-3,2,1,-5,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,52,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,-1,0,0,1,2,0,0,-1,0,-1,0,-1,0,0,0,0,-1,-2,1,0,0.4,-0.4,-0.2,-0.4,-0.15,C_Ug +725,R_3EGhMJk2zWyGk3T,32 - 38,American,Male,2,2,3,-2,-1,1,1,2,-2,2,1,3,2,1,0,2,2,3,1,2,2,3,3,-3,-3,10,1,1,1,1,2,5,-2,3,3,1,0,5,-1,-3,-2,-1,-1,8,2,3,3,0,-1,1,2,2,3,-1,2,1,3,3,3,2,0,2,3,3,3,3,3,1,TRUE,0,54,FALSE,0,72,TRUE,0,73,FALSE,1,85,TRUE,1,84,FALSE,1,100,TRUE,1,67,TRUE,1,73,FALSE,0,67,TRUE,1,68,TRUE,0,71,FALSE,1,79,TRUE,1,65,TRUE,0,71,FALSE,0,76,TRUE,1,60,FALSE,1,78,TRUE,0,71,FALSE,1,66,FALSE,1,100,FALSE,0,80,TRUE,1,76,TRUE,0,73,FALSE,0,73,FALSE,1,100,TRUE,1,100,FALSE,1,71,FALSE,1,80,TRUE,0,91,FALSE,0,77,FALSE,0,83,TRUE,1,100,0.0729,0,0.16,0.1089,0,0,0.5329,0.1024,0,0.0576,0.5929,0.1225,0.4489,0.5041,0.0256,0.5184,0.5329,0.0225,0.04,0,0.64,0.5776,0.1156,0.5041,0.0484,0.0841,0.6889,0.2916,0.5329,0.5041,0.8281,0.0441,0.298578571,0.247192857,0.349964286,22,68.75,18,56.25,3,37.5,5,62.5,5,62.5,5,62.5,9,56.25,9,56.25,77.62,73.88,83.88,75.88,76.88,76.31,78.94,12.5,21.37,36.38,21.38,13.38,14.38,20.06,22.69,0,1,0,1,2,0,0,1,3,0,3,0,1,0,0,3,5,5,2,3,0,1,0,2,0,1,1,1,1,0,2,0,1,1,0,1,1,0,2,1,0.8,0.8,0.8,3.6,0.6,0.8,0.8,1,1.5,0.8,6.67,1.33,9,4,3,7,5.34,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,2,-1,-1,0,2,0,1,0,0,-1,0,2,4,5,0,2,0.2,0,0,2.6,0.7,C_Ug +726,R_11zHvASS8qAPqBa,32 - 38,American,Male,0,3,3,2,-3,0,1,0,0,0,1,1,0,1,0,1,1,0,0,1,0,0,0,0,0,5,0,0,0,1,-1,5,1,1,0,1,0,5,1,0,0,1,0,5,0,1,1,0,-1,5,1,0,1,0,1,5,0,1,1,0,0,5,1,1,0,0,2,5,TRUE,0,80,FALSE,0,77,TRUE,0,74,TRUE,0,76,FALSE,0,75,TRUE,0,88,TRUE,1,82,FALSE,0,77,TRUE,1,77,TRUE,1,100,FALSE,1,81,TRUE,0,80,TRUE,1,79,FALSE,1,80,FALSE,0,76,TRUE,1,76,TRUE,0,80,TRUE,0,100,FALSE,1,80,TRUE,0,50,FALSE,0,50,TRUE,1,88,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,TRUE,0,100,FALSE,1,90,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.5929,0.25,0.0576,0.0324,0,0.7744,0.25,0,0.25,0.0144,0,0.0441,0.0529,0.0361,0.5625,0.5929,0.25,0.5776,1,1,0.25,0.5776,0.04,0.04,0.64,0.25,0.25,0.64,0.5476,1,0.01,0.64,0.367503571,0.243207143,0.4918,18,56.25,13,40.63,3,37.5,3,37.5,4,50,3,37.5,9,56.25,4,25,77.06,70.88,76.5,85,75.88,75.44,78.69,15.62,36.43,33.38,39,35,38.38,19.19,53.69,0,3,3,2,3,0,1,0,1,1,0,0,0,0,0,0,1,0,1,1,0,2,2,2,2,1,1,1,0,1,1,0,1,1,0,0,0,0,0,1,2.2,0.6,0,0.6,1.6,0.8,0.6,0.2,0.85,0.8,5,5,0,0,0,0,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,33,0.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,0,1,1,0,1,-1,0,-1,1,0,-1,0,-1,-1,0,0,1,0,1,0,0.6,-0.2,-0.6,0.4,0.05,C_Ug +727,R_31SgCoAYXD3306B,32 - 38,American,Male,3,3,3,3,3,2,-2,3,-2,2,2,2,2,2,3,0,-1,-1,-1,-1,-2,2,2,2,2,8,-2,-1,-2,2,-2,9,-2,-1,0,1,-2,9,-3,-3,-3,-3,-3,9,3,3,3,3,3,7,2,-3,3,-3,2,3,2,3,2,1,3,5,2,3,2,2,2,10,FALSE,1,100,FALSE,0,53,TRUE,0,64,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,58,TRUE,1,83,TRUE,0,60,TRUE,1,100,TRUE,0,60,TRUE,1,52,TRUE,0,50,TRUE,0,100,TRUE,0,75,TRUE,1,96,FALSE,0,72,FALSE,0,100,0,0.2304,0,0,1,0,0,0,0,0.0289,0.0016,1,0,0,0,0.2809,0.36,0,1,0.36,0.3364,1,0,0,0,0.25,0.5184,0,0.4096,0,0.5625,1,0.289582143,0.190814286,0.38835,21,65.63,19,59.38,4,50,3,37.5,7,87.5,5,62.5,10,62.5,9,56.25,88.22,84.38,86.62,86.88,95,88.38,88.06,6.25,28.84,34.38,49.12,-0.62,32.5,25.88,31.81,5,1,1,1,1,4,1,5,4,4,4,3,2,1,5,3,2,2,2,2,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,2,4,3,3,3,1.8,3.6,3,2.2,0,0.4,0.4,3,2.65,0.95,8.67,5,1,6,4,-1,3.67,5 cents,100 minutes,24 days,Male,University - Undergraduate,36,1.375,1,0,0,0,1,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,1,1,1,1,4,0,5,3,4,4,2,2,0,5,1,-2,-1,-1,-1,1.8,3.2,2.6,-0.8,1.7,C_Ug +728,R_3k196ZmlVAouPwp,53 - 59,American,Male,-1,3,1,3,1,-2,-2,1,1,0,0,3,3,0,2,0,1,1,2,-1,-1,3,2,-2,0,5,-2,1,0,-1,-1,6,1,0,1,2,0,6,-1,-1,1,-2,0,5,1,2,-1,3,2,3,-1,0,1,1,-1,1,1,3,3,-2,2,1,0,2,2,1,0,2,FALSE,1,91,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,0,91,TRUE,1,100,FALSE,1,70,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,95,FALSE,1,60,FALSE,1,100,FALSE,0,65,TRUE,1,85,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,92,TRUE,0,50,FALSE,1,75,FALSE,1,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.0064,0,0.04,0,0,0.04,0,0,0.0225,0.0625,0.25,0.8281,0.09,0,0,0,0.25,0.0625,0,0.4225,0.25,0.16,1,0.25,0.25,0.25,0.0081,0.04,0.9025,0,0,0.183525,0.110221429,0.256828571,20,62.5,24,75,4,50,6,75,6,75,8,100,11,68.75,13,81.25,82.47,65.12,83.12,92.88,88.75,82.38,82.56,-12.5,7.47,15.12,8.12,17.88,-11.25,13.63,1.31,0,0,1,5,1,0,3,1,2,1,1,3,2,2,2,1,2,0,4,1,2,1,2,0,1,1,2,0,0,1,1,0,0,2,0,0,1,1,1,1,1.4,1.4,2,1.6,1.2,0.8,0.6,0.8,1.6,0.85,5.67,1.67,2,5,5,3,4,15 cents,5 minutes,36 days,Male,College Diploma/Certificate,54,1.25,0,1,0,0,0,0,0.33,0,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-2,-1,-1,5,0,-1,1,1,2,0,0,3,2,0,2,1,1,-1,3,0,0.2,0.6,1.4,0.8,0.75,C_Ug +729,R_3cTHsSlgIh4LWv9,25 - 31,Canadian,Male,2,-3,1,2,-1,-2,-1,-1,1,1,1,1,3,1,3,-1,1,2,-1,-1,1,-3,2,1,-3,6,-3,1,1,1,-3,6,2,-3,1,3,3,6,-1,-1,1,-2,1,4,2,-3,-2,2,2,6,1,-2,1,-1,1,6,2,1,3,2,3,6,2,1,2,2,2,5,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,FALSE,1,87,TRUE,1,87,TRUE,0,87,FALSE,1,87,FALSE,1,87,TRUE,1,87,TRUE,1,87,FALSE,0,87,0,0.0169,0,0,0.7569,0,0.0169,0,0,0,0.0169,0,1,0,0.25,0,0,0.25,0.0169,0.0169,0,1,0,0,0,0.7569,0.0169,0.25,1,1,0.0169,1,0.263042857,0.163621429,0.362464286,24,75,23,71.88,4,50,6,75,7,87.5,6,75,12,75,11,68.75,91.66,90.5,90.5,90.5,95.12,92.81,90.5,3.12,19.78,40.5,15.5,3,20.12,17.81,21.75,1,0,1,1,2,1,2,2,0,4,1,4,2,2,0,0,2,1,1,2,0,0,3,0,3,3,1,2,2,0,1,0,0,1,0,3,0,0,3,3,1,1.8,1.8,1.2,1.2,1.6,0.4,1.8,1.45,1.25,6,6,0,0,0,-1,0,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),28,1,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,0,-2,1,-1,-2,1,0,-2,4,0,4,2,1,0,-3,2,1,-2,-1,-0.2,0.2,1.4,-0.6,0.2,grad_prof +730,R_5Hod50BeirlFVba,53 - 59,American,Male,2,3,3,1,0,-3,1,-2,3,2,3,-3,2,-2,3,-1,-1,-2,-2,-3,3,3,3,3,0,3,-3,2,-3,3,-1,8,3,-3,1,-3,3,6,-3,-3,-3,-3,-3,3,3,3,3,3,0,5,-1,1,0,1,1,5,3,-3,3,-3,3,5,0,0,-2,0,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,1,0,0,0.25,0.25,1,0,0,0,0,1,1,1,0.25,0.214285714,0.017857143,0.410714286,28,87.5,26,81.25,8,100,7,87.5,6,75,5,62.5,16,100,10,62.5,93.75,81.25,100,100,93.75,96.88,90.62,6.25,12.5,-18.75,12.5,25,31.25,-3.12,28.12,1,0,0,2,0,0,1,1,0,3,0,0,1,1,0,2,2,1,1,0,1,0,0,2,0,2,0,2,2,1,0,0,1,1,0,1,1,0,2,0,0.6,1,0.4,1.2,0.6,1.4,0.4,0.8,0.8,0.8,5.67,5,-2,3,1,-2,0.67,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),55,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,-2,1,-1,-2,2,0,0,0,0,0,1,1,1,-1,0,0,-0.4,0,0.4,0,grad_prof +731,R_7rP0sO1BbSPkG9A,18 - 24,Canadian,Female,3,3,3,-2,3,-3,2,-1,3,1,2,-2,0,1,1,-2,1,-1,1,-3,3,3,3,-3,3,3,-1,0,2,3,2,4,2,-3,0,3,2,8,-1,0,0,2,-1,7,3,3,3,0,3,2,0,1,2,2,2,6,3,-1,0,2,2,3,1,1,2,2,-3,8,TRUE,0,90,FALSE,0,50,FALSE,1,89,FALSE,1,50,TRUE,1,95,FALSE,1,91,TRUE,1,50,TRUE,1,92,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,FALSE,1,80,FALSE,0,50,TRUE,1,52,FALSE,1,55,TRUE,0,80,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,60,FALSE,1,60,TRUE,1,88,FALSE,1,90,TRUE,1,87,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,64,FALSE,0,50,FALSE,0,60,0.0064,0.0169,0.2304,0.25,0.36,0.0081,0.0144,0.25,0.25,0.16,0.4096,0.09,0.25,0.25,0.0025,0.25,0.16,0.25,0.25,0.01,0.25,0.25,0.25,0.04,0.2025,0.25,0.25,0.81,0.0121,0.64,0.25,0.25,0.229257143,0.193185714,0.265328571,14,43.75,22,68.75,4,50,7,87.5,6,75,5,62.5,11,68.75,11,68.75,64.16,50,66.38,73.38,66.88,63.62,64.69,-25,-4.59,0,-21.12,-1.62,4.38,-5.13,-4.06,0,0,0,1,0,2,2,3,0,1,0,1,0,2,1,1,1,1,1,2,0,0,0,2,0,3,1,3,1,1,1,1,0,1,1,3,0,3,1,0,0.2,1.6,0.8,1.2,0.4,1.8,0.8,1.4,0.95,1.1,5,3.67,1,-2,5,-1,1.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),21,1.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,-1,0,-1,1,0,-1,0,-1,0,0,1,0,-2,1,-2,0,2,-0.2,-0.2,0,-0.2,-0.15,HS_TS +732,R_1cRGwOJjIklBBmb,46 - 52,American,Male,-2,3,3,3,3,-2,0,1,2,1,1,3,3,2,3,1,2,3,3,0,-2,3,3,3,3,0,-1,0,1,2,2,1,1,3,3,2,3,0,3,3,3,3,2,3,-2,3,3,3,3,0,-1,0,1,1,1,1,1,3,3,2,3,0,3,3,3,3,2,2,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,55,FALSE,1,90,TRUE,1,100,FALSE,1,50,FALSE,0,70,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,54,TRUE,1,96,FALSE,1,100,FALSE,0,67,FALSE,1,56,FALSE,1,100,FALSE,1,53,TRUE,1,100,FALSE,0,100,FALSE,0,58,0,0.4489,0,0,0.3364,1,0.0016,0,0,0,0,0,0,0.2025,0,0.25,0.2916,0.25,0,0,1,0.49,1,0.25,0,0.1936,1,1,1,0.1849,0.2209,0.01,0.310053571,0.166578571,0.453528571,25,78.13,22,68.75,5,62.5,4,50,6,75,7,87.5,11,68.75,11,68.75,84.56,72.62,83.12,84.25,98.25,90.06,79.06,9.38,15.81,10.12,33.12,9.25,10.75,21.31,10.31,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,2,1,0,0,2,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,2,1,0,0,2,0,0.4,0,1,0,0.4,0,1,0.35,0.35,0.33,0.33,0,0,0,1,0,10 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),47,-0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,grad_prof +733,R_3NywKajIQG0QJbF,32 - 38,American,Male,1,1,1,1,2,0,0,1,0,1,1,-2,1,-1,1,1,1,1,1,2,-2,0,2,2,1,10,1,1,-1,0,0,9,-1,0,0,0,0,5,0,0,0,1,2,10,1,1,1,1,1,7,0,0,0,0,0,7,2,0,2,0,2,6,0,2,2,2,0,6,TRUE,0,100,FALSE,0,60,FALSE,1,100,FALSE,1,79,FALSE,0,79,FALSE,1,100,TRUE,1,100,TRUE,1,68,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,55,FALSE,0,54,FALSE,1,52,TRUE,0,100,TRUE,0,77,FALSE,1,100,TRUE,1,64,TRUE,1,72,TRUE,0,67,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,78,FALSE,1,51,TRUE,1,85,FALSE,0,51,TRUE,1,77,0.1024,0,0.2916,0,0.0529,0,0.25,0,0,0.0784,0.0225,0,0.04,0,0.6241,0.36,0.4489,0.0441,0.0484,0,0.1296,0.3025,0.5929,0,0.2304,0.5625,0.2601,1,0,1,0.2401,0,0.22455,0.137207143,0.311892857,16,50,21,65.63,3,37.5,6,75,6,75,6,75,10,62.5,11,68.75,80.44,72.12,73.75,96.5,79.38,74.69,86.19,-15.63,14.81,34.62,-1.25,21.5,4.38,12.19,17.44,3,1,1,1,1,1,1,2,0,1,2,2,1,1,1,1,1,1,0,0,0,0,0,0,1,0,0,1,0,1,1,2,1,1,1,1,1,1,1,2,1.4,1,1.4,0.6,0.2,0.4,1.2,1.2,1.1,0.75,8,6.67,3,2,-1,4,1.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,1.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,3,1,1,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,-1,-2,1.2,0.6,0.2,-0.6,0.35,HS_TS +734,R_192GcY4ARIi5d6N,46 - 52,American,Male,0,3,2,-3,-1,-2,-2,3,-2,2,2,0,3,1,3,-2,-1,-3,-2,-3,-1,3,3,-3,-2,4,-1,-2,2,-2,2,5,3,3,3,1,3,5,-3,0,0,-3,-3,6,-1,2,2,-3,-2,5,-1,-3,3,-2,1,4,3,0,3,2,3,3,-1,0,0,0,0,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,51,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,100,FALSE,1,51,TRUE,1,96,FALSE,0,50,TRUE,1,100,1,0,0,0,0,0,0,0,0,0,0.0016,1,0,0.2209,0,0,0.25,0.2401,0,0,0,0.2601,0.25,0,0,0.2401,0.25,1,1,1,0.2401,0,0.212603571,0.122328571,0.302878571,26,81.25,25,78.13,6,75,7,87.5,6,75,6,75,12,75,13,81.25,87.59,63.25,87.62,100,99.5,93.56,81.62,3.12,9.46,-11.75,0.12,25,24.5,18.56,0.37,1,0,1,0,1,1,0,1,0,0,1,3,0,0,0,1,1,3,1,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,1,1,3,2,3,0.6,0.4,0.8,1.2,0.6,0.6,0.4,2,0.75,0.9,4.67,4,-1,1,2,1,0.67,10 cents,5 minutes,47 days,Male,University - Undergraduate,51,1.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,-1,1,0,0,0,-1,1,0,-1,0,3,0,-1,0,0,0,0,-1,-3,0,-0.2,0.4,-0.8,-0.15,C_Ug +735,R_63xcflDzFQ1r20D,25 - 31,American,Male,2,3,-1,0,2,0,0,0,0,2,0,0,0,-1,3,-3,-2,-1,-1,-3,3,3,0,1,0,7,1,2,-1,2,-1,8,-1,1,2,2,0,7,0,0,-1,-1,-1,6,3,2,1,2,3,6,1,-1,2,-1,1,6,1,0,0,-1,3,6,1,1,1,1,1,8,TRUE,0,59,TRUE,1,50,TRUE,0,67,FALSE,1,52,TRUE,1,100,FALSE,1,57,FALSE,0,54,TRUE,1,65,TRUE,1,52,FALSE,0,84,FALSE,1,52,TRUE,0,57,TRUE,1,83,FALSE,1,68,TRUE,1,71,TRUE,1,84,FALSE,1,56,TRUE,0,67,FALSE,1,68,TRUE,0,65,TRUE,1,81,TRUE,1,82,FALSE,1,100,FALSE,0,63,FALSE,1,57,FALSE,0,58,TRUE,0,64,FALSE,1,76,TRUE,0,78,TRUE,1,73,FALSE,0,55,TRUE,1,92,0.1225,0.3364,0.0256,0.2916,0.0064,0.1849,0.3969,0.7056,0.4225,0.0324,0.0729,0.0289,0.2304,0.2304,0,0.25,0,0.2304,0.0576,0.1849,0.0361,0.0841,0.1024,0.1024,0.1936,0.4096,0.3025,0.3481,0.4489,0.4489,0.6084,0.3249,0.230146429,0.199407143,0.260885714,14,43.75,20,62.5,6,75,7,87.5,3,37.5,4,50,11,68.75,9,56.25,68.44,58,80.88,66.12,68.75,71.69,65.19,-18.75,5.94,-17,-6.62,28.62,18.75,2.94,8.94,1,0,1,1,2,1,2,1,2,3,1,1,2,3,3,3,2,0,0,2,1,1,2,2,1,1,1,2,1,1,1,0,0,0,0,4,3,2,2,4,1,1.8,2,1.4,1.4,1.2,0.2,3,1.55,1.45,7.33,6,1,2,1,-2,1.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,31,1.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,-1,-1,-1,1,0,1,-1,1,2,0,1,2,3,3,-1,-1,-2,-2,-2,-0.4,0.6,1.8,-1.6,0.1,C_Ug +736,R_1Yg2RfkDojgKcX1,18 - 24,Canadian,Female,3,1,1,-3,3,-2,-1,-1,-2,-1,2,-3,3,2,0,-1,-3,1,1,-2,3,2,1,-1,1,2,2,1,0,-3,-2,6,3,1,-1,-1,3,6,2,2,3,2,2,7,3,2,0,-1,3,5,1,-1,2,-2,1,6,2,-3,2,-1,2,6,1,-1,1,1,-1,7,TRUE,0,61,TRUE,1,50,FALSE,1,100,FALSE,1,53,TRUE,1,99,FALSE,1,58,TRUE,1,89,TRUE,1,100,TRUE,1,52,TRUE,1,97,FALSE,1,61,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,1,52,TRUE,1,100,TRUE,0,56,TRUE,0,100,FALSE,1,100,FALSE,1,52,TRUE,1,63,TRUE,1,98,TRUE,0,50,TRUE,1,62,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,87,TRUE,0,100,TRUE,1,89,FALSE,0,87,FALSE,0,81,0,0,0,0.0121,0.6561,0.1764,0.1444,0.0009,0.2304,0.0004,0.0121,0,0.2304,0.1521,0.0001,0.25,0.25,0.2209,0.7569,0,0.1369,0.2304,0,0.25,0.3136,0.25,0.7569,0.3721,0,1,1,0.5625,0.284053571,0.166014286,0.402092857,6,18.75,23,71.88,7,87.5,4,50,6,75,6,75,14,87.5,9,56.25,77.25,63.12,75.88,86.88,83.12,82.44,72.06,-53.13,5.37,-24.38,25.88,11.88,8.12,-5.06,15.81,0,1,0,2,2,4,2,1,1,1,1,4,4,3,3,3,5,2,1,4,0,1,1,2,0,3,0,3,0,2,0,0,1,3,2,2,2,0,0,1,1,1.8,3,3,0.8,1.6,1.2,1,2.2,1.15,4.67,5.67,-3,0,0,0,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),18,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,-1,0,2,1,2,-2,1,-1,1,4,3,0,1,1,3,2,1,3,0.2,0.2,1.8,2,1.05,HS_TS +737,R_3eWO2HE3Av3N3e0,46 - 52,American,Male,3,3,2,1,3,3,1,3,2,3,2,3,2,2,3,3,2,3,3,1,-1,-1,2,-3,3,5,1,2,-1,-1,1,8,-1,2,-2,2,-2,7,0,-3,2,-1,2,6,3,2,3,2,3,6,2,3,3,1,1,6,3,0,2,1,3,6,2,2,3,1,0,9,TRUE,0,72,FALSE,0,95,TRUE,0,77,TRUE,0,78,FALSE,0,57,TRUE,0,69,TRUE,1,65,FALSE,0,51,FALSE,0,53,TRUE,1,67,FALSE,1,60,TRUE,0,54,TRUE,1,61,FALSE,1,57,TRUE,1,62,FALSE,0,100,FALSE,1,60,TRUE,0,63,FALSE,1,60,TRUE,0,63,TRUE,1,73,TRUE,1,63,FALSE,1,64,TRUE,1,100,TRUE,0,57,FALSE,0,71,TRUE,0,66,FALSE,1,100,TRUE,0,71,FALSE,0,72,TRUE,1,100,TRUE,1,79,0.2601,0.5041,1,0.1225,0.0441,0.4761,0,0.1089,0.3969,0.1369,0.5184,0.1521,0.2809,0.16,0.3249,0.9025,0.1296,0.6084,0,0.3249,0.0729,0.1444,0.16,0.1849,0.16,0.4356,0,0.5184,0.5929,0.3969,0.5041,0.2916,0.286653571,0.302835714,0.270471429,10,31.25,15,46.88,4,50,5,62.5,4,50,2,25,9,56.25,6,37.5,70,71.75,66.75,64.38,77.12,73.06,66.94,-15.63,23.12,21.75,4.25,14.38,52.12,16.81,29.44,4,4,0,4,0,2,1,4,3,2,3,1,4,0,5,3,5,1,4,1,0,1,1,1,0,1,2,0,1,2,1,3,0,1,0,1,0,0,2,1,2.4,2.4,2.6,2.8,0.6,1.2,1,0.8,2.55,0.9,6.67,6,-1,2,1,-3,0.67,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),49,0.125,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,4,3,-1,3,0,1,-1,4,2,0,2,-2,4,-1,5,2,5,1,2,0,1.8,1.2,1.6,2,1.65,grad_prof +738,R_5q9yojkPnsuJB2B,32 - 38,American,Male,3,3,3,-2,-2,-3,-3,3,-3,1,-1,-2,3,-3,3,-1,-1,-1,0,-2,3,3,3,-2,-1,1,1,-3,3,-3,1,3,-1,-2,3,-3,3,2,0,1,1,0,1,6,3,3,3,-2,-1,1,0,-3,3,-3,0,1,-1,-2,3,-2,3,1,0,1,1,1,1,7,TRUE,0,96,TRUE,1,65,FALSE,1,74,TRUE,0,79,TRUE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,94,TRUE,1,94,TRUE,1,86,FALSE,1,88,FALSE,1,97,TRUE,1,88,TRUE,0,90,TRUE,1,71,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,86,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,85,TRUE,1,100,0.0036,0,0,0,0,0.04,0,0.0196,0,0,0.25,0.0144,0.0036,0.0144,0,0.1225,0,0.6241,0,0,0.25,0.0841,0.7396,0.81,0.25,1,0.0225,0.9216,0.0676,1,1,0.0009,0.258389286,0.077757143,0.439021429,24,75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,14,87.5,8,50,88.22,83.5,83.5,96.5,89.38,86.44,90,6.25,19.47,21,21,34,1.88,-1.06,40,0,0,0,0,1,4,0,0,0,0,0,0,0,0,0,1,2,2,0,3,0,0,0,0,1,3,0,0,0,1,0,0,0,1,0,1,2,2,1,3,0.2,0.8,0,1.6,0.2,0.8,0.2,1.8,0.65,0.75,2,1,0,2,1,-1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,1,0,0,0,-1,0,0,0,-1,0,0,0,0,-1,0,0,0,-0.2,-0.2,-0.1,C_Ug +739,R_7JR3NaQJDhjIYbS,39 - 45,American,Male,2,3,3,1,0,2,1,3,0,0,2,1,2,3,3,-2,-1,1,3,-3,2,0,3,-2,0,8,2,-3,2,0,0,5,1,0,2,2,1,7,1,0,2,2,1,7,1,3,2,-3,0,6,2,-3,1,0,1,6,2,2,1,-2,2,7,1,-1,2,2,1,7,FALSE,1,57,FALSE,0,84,FALSE,1,64,FALSE,1,55,FALSE,0,58,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,88,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,79,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,55,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,0,83,FALSE,0,69,0,0,0,0,0.4761,1,0,0,0,0,0,0.0144,0,0.9801,0.3364,0.7056,0.1936,0.2025,1,0,1,0,0.0441,1,1,0.2025,0.6889,0.1849,0.1296,1,0.1849,1,0.405128571,0.279192857,0.531064286,11,34.38,20,62.5,5,62.5,3,37.5,6,75,6,75,11,68.75,9,56.25,87.62,81.88,78.5,94.62,95.5,92.62,82.62,-28.12,25.12,19.38,41,19.62,20.5,23.87,26.37,0,3,0,3,0,0,4,1,0,0,1,1,0,1,2,3,1,1,1,4,1,0,1,4,0,0,4,2,0,1,0,1,1,5,1,3,0,1,1,4,1.2,1,1,2,1.2,1.4,1.6,1.8,1.3,1.5,6.67,6.33,2,-1,0,0,0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,44,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,-1,3,-1,-1,0,0,0,-1,0,-1,1,0,-1,-4,1,0,1,0,0,0,0,-0.4,-0.6,0.2,-0.2,C_Ug +740,R_7tjJuhM7HFKgeVb,25 - 31,American,Male,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.571428571,0.357142857,0.785714286,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,100,100,100,100,100,100,100,50,50,50,50,50,50,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),30,0,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +741,R_7u1VMhlvNjxgYrD,18 - 24,Canadian,Male,3,3,1,2,2,2,0,2,-1,2,1,0,3,1,3,0,0,0,3,-1,1,1,2,2,2,7,2,0,2,2,1,8,3,2,3,1,3,7,1,2,1,2,1,8,3,3,-2,1,3,5,1,0,3,0,3,8,2,2,1,1,3,3,3,3,3,3,1,10,TRUE,0,90,FALSE,0,81,TRUE,0,100,FALSE,1,100,TRUE,1,76,FALSE,1,80,TRUE,1,79,TRUE,1,89,TRUE,1,90,FALSE,0,68,FALSE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,74,TRUE,1,86,TRUE,1,81,TRUE,0,93,FALSE,1,89,TRUE,0,92,FALSE,1,82,FALSE,0,89,TRUE,1,89,FALSE,1,85,TRUE,1,80,FALSE,1,84,TRUE,1,85,FALSE,1,95,TRUE,0,82,TRUE,0,71,TRUE,1,78,FALSE,0,79,TRUE,1,79,0.0121,0.0225,0.0361,0.0441,0.0441,0.04,0.04,0.4624,0.0324,0.0121,0.0484,0,0.01,0.0256,0.0576,0.6561,0.0225,0,0.6724,0.0256,0.7921,0.0196,0.8464,0.5476,0.8649,0.0025,0.6241,0.81,1,0.0121,0.5041,1,0.327592857,0.103657143,0.551528571,25,78.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,12,75,8,50,85.31,88.38,84.12,82.25,86.5,83.06,87.56,15.63,22.81,25.88,21.62,19.75,24,8.06,37.56,2,2,1,0,0,0,0,0,3,1,2,2,0,0,0,1,2,1,1,2,0,0,3,1,1,1,0,1,1,1,1,2,2,0,0,3,3,3,0,2,1,0.8,0.8,1.4,1,0.8,1,2.2,1,1.25,7.33,5.33,2,0,4,-2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,24,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,2,-2,-1,-1,-1,0,-1,2,0,1,0,-2,0,0,-2,-1,-2,1,0,0,0,-0.2,-0.8,-0.25,C_Ug +742,R_3zUtl7DoAFOU12F,25 - 31,Canadian,Female,3,2,2,3,2,1,2,1,2,1,2,2,1,1,3,-2,-3,-3,-1,-2,2,2,2,2,2,6,1,-1,-2,3,-1,7,1,2,2,1,2,8,-3,-3,-3,-1,-2,9,3,2,3,3,3,8,1,-1,3,-2,3,8,3,3,3,3,3,8,3,3,3,3,1,7,TRUE,0,72,TRUE,1,50,TRUE,0,100,TRUE,0,53,FALSE,0,50,FALSE,1,50,TRUE,1,55,TRUE,1,100,FALSE,0,50,TRUE,1,93,TRUE,0,50,TRUE,0,88,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,54,TRUE,0,50,TRUE,0,56,FALSE,0,53,TRUE,1,50,TRUE,0,50,TRUE,1,83,FALSE,1,97,TRUE,1,55,TRUE,0,50,TRUE,0,97,TRUE,0,54,TRUE,1,69,FALSE,0,50,TRUE,1,73,0,0.2025,0.25,0.2025,0.0729,0.25,0.0289,0.0049,0.3136,0.25,0.0961,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.9409,0.0009,0.2809,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,1,0.2116,0.2916,0.7744,0.297,0.199807143,0.394192857,16,50,15,46.88,1,12.5,4,50,6,75,4,50,11,68.75,4,25,62.56,50.38,53.75,65.75,80.38,61.31,63.81,3.12,15.68,37.88,3.75,-9.25,30.38,-7.44,38.81,1,0,0,1,0,0,3,3,1,2,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1,0,3,2,4,2,1,1,2,2,0,5,6,6,4,3,0.4,1.8,0.6,0.2,0.4,2.2,1.2,4.8,0.75,2.15,7,8,-2,-1,0,2,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,25,-1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,1,0,-1,1,-1,0,0,1,-3,0,0,-1,-1,-2,1,-4,-6,-6,-4,-3,0,-0.4,-0.6,-4.6,-1.4,C_Ug +743,R_6lQW45S27ysSd3j,46 - 52,American,Male,3,3,3,1,1,2,-1,1,0,1,-1,-1,3,1,0,1,1,2,0,-2,3,3,3,-1,1,7,3,-3,3,-1,1,4,1,2,1,2,1,6,-3,-2,-3,-2,-3,9,3,3,2,2,2,4,3,-2,2,-2,1,4,1,2,3,2,1,2,2,3,3,3,-3,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,60,TRUE,1,84,FALSE,1,100,TRUE,1,89,TRUE,1,100,TRUE,1,97,TRUE,1,93,FALSE,1,100,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,62,TRUE,0,100,TRUE,0,77,FALSE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,94,FALSE,0,75,TRUE,0,91,FALSE,1,100,TRUE,0,84,FALSE,0,70,TRUE,1,89,TRUE,1,100,0,0.5625,0,0.0121,0,0,0,0.0049,0,0,0.49,0,0.0009,0,0.0256,0,0,0.16,0,0.8836,0.09,0.0009,0.5929,0,0.1444,0.8281,0.0121,0,1,1,0.7056,0.8649,0.242996429,0.048671429,0.437321429,27,84.38,23,71.88,6,75,7,87.5,5,62.5,5,62.5,14,87.5,9,56.25,91.41,88.88,87.5,93.88,95.38,91.5,91.31,12.5,19.53,13.88,0,31.38,32.88,4,35.06,0,0,0,2,0,1,2,2,1,0,2,3,2,1,1,4,3,5,2,1,0,0,1,1,1,1,1,1,2,0,2,3,0,1,1,1,2,1,3,1,0.4,1.2,1.8,3,0.6,1,1.4,1.6,1.6,1.15,5.67,3.33,3,0,4,0,2.34,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),49,0.375,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,-1,1,-1,0,1,1,-1,0,0,0,2,0,0,3,1,4,-1,0,-0.2,0.2,0.4,1.4,0.45,grad_prof +744,R_7FwXOfwfi0MRCgW,25 - 31,Canadian,Male,3,0,-1,0,0,1,-2,1,-1,0,0,-3,3,-3,1,-2,-2,0,1,-2,2,2,2,-3,2,7,1,-2,1,-3,1,6,3,-3,1,-2,0,6,-2,-2,-2,-2,1,6,2,1,0,0,2,4,0,-2,2,-3,2,3,3,-3,2,-3,3,3,1,1,2,1,-3,5,TRUE,0,89,TRUE,1,93,TRUE,0,92,FALSE,1,74,TRUE,1,93,FALSE,1,94,TRUE,1,98,TRUE,1,85,TRUE,1,76,TRUE,1,84,FALSE,1,95,TRUE,0,95,FALSE,0,91,FALSE,1,65,TRUE,1,90,TRUE,1,86,FALSE,1,94,FALSE,1,83,FALSE,1,95,FALSE,1,69,TRUE,1,96,TRUE,1,78,FALSE,1,82,TRUE,1,96,FALSE,1,98,TRUE,1,91,FALSE,1,63,FALSE,1,97,FALSE,1,78,TRUE,1,84,FALSE,0,83,TRUE,1,94,0.0225,0.0081,0.0196,0.0004,0.0036,0.0036,0.0016,0.0256,0.0961,0.0484,0.0256,0.8281,0.0576,0.0025,0.0049,0.0049,0.0324,0.0676,0.0009,0.0004,0.0016,0.01,0.0025,0.1225,0.0036,0.1369,0.6889,0.7921,0.8464,0.0289,0.0484,0.9025,0.171003571,0.085892857,0.256114286,21,65.63,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,86.91,83.62,90.25,85.75,88,88.62,85.19,-18.75,2.53,-3.88,2.75,-1.75,13,1.12,3.94,1,2,3,3,2,0,0,0,2,1,3,0,2,1,1,0,0,2,3,3,1,1,1,0,2,1,0,1,2,2,3,0,1,0,2,3,3,2,0,1,2.2,0.6,1.4,1.6,1,1.2,1.2,1.8,1.45,1.3,6.33,3.33,3,3,3,1,3,10 cents,100 minutes,24 days,Male,University - Undergraduate,26,-0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,1,2,3,0,-1,0,-1,0,-1,0,0,1,1,-1,-3,-3,0,3,2,1.2,-0.6,0.2,-0.2,0.15,C_Ug +745,R_73fMUnCCOSljM6A,46 - 52,American,Male,2,2,1,1,2,-2,1,0,0,1,2,0,2,0,3,-3,-3,-3,-3,-3,2,2,1,1,3,10,0,2,2,-3,2,6,1,0,1,2,1,5,1,1,1,2,0,9,0,0,0,0,1,5,-1,0,1,1,0,5,0,0,0,0,0,5,-3,-3,-2,-3,-3,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,85,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,TRUE,1,100,FALSE,1,100,TRUE,0,79,FALSE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,0,74,TRUE,1,100,FALSE,0,100,FALSE,0,100,0,0,0,0,1,0,0,0,0.0025,0,0,0,0,0,0,0,0.4096,0.7225,0.25,0,0,0.0169,0,0,0,1,1,0,1,0.6241,0.5476,1,0.270471429,0.152471429,0.388471429,27,84.38,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,14,87.5,8,50,94.81,96.5,92.25,97.38,93.12,99.19,90.44,15.63,26.06,34,29.75,9.88,30.62,11.69,40.44,0,0,0,0,1,2,1,2,3,1,1,0,1,2,2,4,4,4,5,3,2,2,1,1,1,1,1,1,1,1,2,0,2,0,3,0,0,1,0,0,0.2,1.8,1.2,4,1.4,1,1.4,0.2,1.8,1,7,5,5,1,0,5,2,5 cents,5 minutes,47 days,Male,University - PhD,48,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,-2,-2,-1,-1,0,1,0,1,2,0,-1,0,-1,2,-1,4,4,3,5,3,-1.2,0.8,-0.2,3.8,0.8,grad_prof +746,R_3awXX1EJ7go8pt7,25 - 31,Canadian,Male,0,-3,-2,-2,0,-1,-1,1,-2,-3,1,-2,-1,1,-2,1,0,1,1,-1,-1,-3,1,2,0,8,-1,-2,3,-2,-2,2,-2,-2,-3,-2,-2,5,-1,-1,-1,-1,-2,3,-3,-2,0,-2,-2,5,-1,-3,0,-2,-1,3,-3,-3,-1,-1,-1,3,-1,0,-2,-2,-2,8,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,61,TRUE,1,87,FALSE,1,56,TRUE,0,100,FALSE,0,58,TRUE,0,50,TRUE,1,89,TRUE,1,57,FALSE,1,50,FALSE,1,50,TRUE,0,67,FALSE,1,100,TRUE,1,62,FALSE,0,68,TRUE,0,58,FALSE,0,57,FALSE,1,61,FALSE,0,57,FALSE,1,52,FALSE,1,89,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,0,50,0.25,0.3249,0.1849,0.25,0.25,0.25,0.3249,0.0169,0,0.4624,0.1764,0.3364,0.1521,0.1936,0.25,0.25,0.3364,0.25,0.0121,0.1521,0.1444,0.0121,0.4489,0.25,0.25,0.2304,0.25,0.25,0.25,0.25,0.25,1,0.249967857,0.232078571,0.267857143,4,12.5,18,56.25,5,62.5,4,50,4,50,5,62.5,6,37.5,12,75,60.53,59.38,53.5,59.12,70.12,59.62,61.44,-43.75,4.28,-3.12,3.5,9.12,7.62,22.12,-13.56,1,0,3,4,0,0,1,2,0,1,3,0,2,3,0,2,1,2,2,1,3,1,2,0,2,0,2,1,0,2,4,1,0,2,1,2,0,3,3,1,1.6,0.8,1.6,1.6,1.6,1,1.6,1.8,1.4,1.5,5,3.67,3,-1,2,-5,1.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,25,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,-2,-1,1,4,-2,0,-1,1,0,-1,-1,-1,2,1,-1,0,1,-1,-1,0,0,-0.2,0,-0.2,-0.1,C_Ug +747,R_7oBG7d9UTEDu1Fa,18 - 24,Canadian,Female,1,3,3,2,2,-1,1,1,1,1,2,-1,2,0,2,-1,-1,1,1,-1,0,0,3,-1,1,6,-1,-1,-1,1,-1,4,2,-1,0,1,0,5,1,2,1,1,1,7,2,2,2,2,2,2,1,1,2,-1,2,4,2,-1,2,-2,2,3,2,1,2,2,0,7,FALSE,1,97,FALSE,0,59,TRUE,0,67,FALSE,1,50,TRUE,1,73,FALSE,1,99,FALSE,0,50,FALSE,0,61,FALSE,0,50,TRUE,1,54,FALSE,1,52,TRUE,0,65,FALSE,0,52,FALSE,1,60,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,0,53,FALSE,1,87,FALSE,1,50,TRUE,1,57,TRUE,1,68,FALSE,1,58,TRUE,1,60,FALSE,1,92,TRUE,1,60,FALSE,1,50,FALSE,1,83,TRUE,0,50,FALSE,0,53,FALSE,0,52,TRUE,1,59,0.3721,0.16,0.0025,0.25,0.1681,0.0001,0.16,0.2116,0.25,0.1024,0.2809,0.2704,0.25,0.2304,0.0729,0.3481,0.1764,0.25,0.0289,0.0064,0.1849,0.25,0.0169,0.16,0.25,0.25,0.2704,0.0009,0.4489,0.2809,0.25,0.4225,0.199714286,0.19795,0.201478571,6,18.75,19,59.38,4,50,5,62.5,6,75,4,50,8,50,11,68.75,63,56.25,62.25,66.75,66.75,59.56,66.44,-40.63,3.62,6.25,-0.25,-8.25,16.75,9.56,-2.31,1,3,0,3,1,0,2,2,0,2,0,0,2,1,2,2,3,0,0,2,1,1,1,0,0,2,0,1,2,1,0,0,0,2,0,3,2,1,1,1,1.6,1.2,1,1.4,0.6,1.2,0.4,1.6,1.3,0.95,5,3,4,0,2,0,2,10 cents,25 minutes,24 days,Female,High School (or equivalent),21,0.5,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,2,-1,3,1,-2,2,1,-2,1,0,0,2,-1,2,-1,1,-1,-1,1,1,0,0.6,-0.2,0.35,HS_TS +748,R_1mjyLE3w9JQjVyd,46 - 52,American,Male,1,2,1,2,2,1,0,1,-1,1,1,1,2,0,2,0,0,1,1,0,0,2,1,2,2,6,1,-1,1,-1,1,5,1,1,2,0,1,5,1,0,1,1,1,6,0,2,0,2,2,5,1,-1,1,-1,1,6,1,1,1,0,2,6,0,1,1,0,0,6,TRUE,0,94,TRUE,1,86,TRUE,0,85,FALSE,1,65,TRUE,1,100,FALSE,1,86,TRUE,1,97,TRUE,1,91,TRUE,1,85,TRUE,1,86,FALSE,1,63,TRUE,0,74,FALSE,0,80,TRUE,0,86,TRUE,1,84,TRUE,1,97,TRUE,0,75,TRUE,0,87,TRUE,0,74,FALSE,1,87,TRUE,1,64,TRUE,1,89,FALSE,1,79,TRUE,1,75,FALSE,1,76,TRUE,1,82,TRUE,0,72,FALSE,1,74,TRUE,0,81,TRUE,1,81,FALSE,0,61,TRUE,1,89,0.0081,0.0324,0.0009,0.0009,0.0121,0.0196,0.0625,0.0196,0.0169,0.0121,0.0361,0.64,0.0225,0.1369,0,0.0196,0.0441,0.1225,0.0676,0.0576,0.1296,0.0256,0.5476,0.7396,0.5625,0.5184,0.3721,0.8836,0.7225,0.7569,0.6561,0.5476,0.27685,0.083178571,0.470521429,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,81.41,73.75,81.75,87.12,83,84.19,78.62,-3.13,15.78,11.25,19.25,24.62,8,-3.31,34.87,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0.2,0.2,0.2,0.4,0.4,0.2,0.2,0.4,0.25,0.3,5.33,5.67,1,-1,-1,0,-0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,49,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,-1,0,0,0,0,0,0,0,0,0,-1,0,1,1,-1,0,-1,1,-0.2,0,0,0,-0.05,C_Ug +749,R_5QL9v7f7GSirI4c,32 - 38,American,Male,-1,2,2,-1,1,-2,-2,2,-2,0,2,1,2,0,2,1,-1,0,1,-1,-1,2,2,-2,2,2,-1,-2,2,-2,1,1,2,2,2,-2,2,2,-1,-1,1,0,-2,5,0,2,2,-1,2,7,-2,-2,2,-2,0,3,2,2,1,-1,2,2,-1,0,-1,0,-1,1,TRUE,0,100,TRUE,1,94,TRUE,0,100,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,1,73,TRUE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,76,TRUE,1,100,FALSE,1,65,TRUE,0,100,FALSE,1,72,FALSE,1,100,TRUE,1,81,FALSE,0,86,FALSE,1,100,FALSE,0,84,TRUE,0,100,TRUE,1,92,TRUE,0,78,FALSE,1,100,TRUE,0,69,FALSE,0,76,TRUE,1,100,TRUE,1,100,0,0.0064,0,0.0729,0,0,0.7056,0,0,0.7396,0.5776,0,0.0049,0,0,0.0036,0,0.16,0,1,0.0361,0.5776,0.0784,0,0.1225,0.6084,0,1,1,1,0.4761,0,0.288942857,0.156521429,0.421364286,21,65.63,22,68.75,6,75,7,87.5,4,50,5,62.5,12,75,10,62.5,90.59,84.12,89.38,93.88,95,90.94,90.25,-3.12,21.84,9.12,1.88,43.88,32.5,15.94,27.75,0,0,0,1,1,1,0,0,0,1,0,1,0,2,0,2,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,1,1,0,2,1,1,1,0,0.4,0.4,0.6,1,0.4,0,0.6,1,0.6,0.5,1.67,4,-5,-2,0,4,-2.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,0,0,1,0,1,0,0,0,1,0,0,-1,1,0,0,-1,0,0,1,0,0.4,0,0,0.1,C_Ug +750,R_1Y5HzVbWajCz5o8,18 - 24,Canadian,Female,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,7,0,1,-1,0,1,8,1,1,1,1,1,8,2,1,1,2,0,7,1,1,1,0,1,7,1,-1,1,1,0,8,1,1,1,1,0,8,3,2,1,3,2,8,FALSE,1,89,TRUE,1,68,TRUE,0,79,FALSE,1,58,FALSE,0,59,FALSE,1,58,TRUE,1,77,FALSE,0,55,TRUE,1,85,TRUE,1,70,FALSE,1,81,TRUE,0,76,TRUE,1,71,FALSE,1,63,TRUE,1,67,TRUE,1,57,FALSE,1,59,TRUE,0,59,FALSE,1,56,FALSE,1,56,TRUE,1,60,TRUE,1,62,FALSE,1,58,TRUE,1,60,FALSE,1,56,TRUE,1,64,FALSE,1,58,TRUE,0,57,FALSE,1,56,TRUE,1,65,FALSE,0,58,TRUE,1,60,0.3025,0.1296,0.1849,0.0529,0.16,0.1764,0.16,0.09,0.1936,0.1444,0.1225,0.0841,0.0225,0.0361,0.3481,0.1024,0.1764,0.1764,0.3249,0.1936,0.16,0.1089,0.1936,0.1369,0.1681,0.1764,0.3364,0.0121,0.6241,0.3481,0.1936,0.5776,0.198114286,0.14235,0.253878571,16,50,25,78.13,7,87.5,7,87.5,7,87.5,4,50,13,81.25,12,75,64.28,66.38,60.12,67.5,63.12,64.88,63.69,-28.13,-13.85,-21.12,-27.38,-20,13.12,-16.37,-11.31,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,0,2,1,0,0,0,0,1,2,0,1,2,1,0,1.2,0,1,0.2,0.6,0.2,1.2,0.55,0.55,7.67,7.67,0,0,0,-1,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),22,0.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,0,1,2,2,-1,-1,0,0,0,0,-1,-1,1,0,-1,0,-0.2,0.6,-0.2,-0.2,0,HS_TS +751,R_5tDmr9134UaAzgP,18 - 24,Canadian,Female,2,3,-1,1,-1,-2,-1,-1,1,1,1,-2,2,1,1,-1,-1,0,-1,-2,3,2,2,-2,1,6,0,0,2,1,1,6,2,-2,1,3,1,4,1,1,0,1,1,7,2,3,1,-1,1,4,-1,-2,1,0,2,4,1,-2,1,0,1,3,1,1,2,2,-1,4,TRUE,0,66,TRUE,1,50,FALSE,1,88,TRUE,0,50,FALSE,0,50,FALSE,1,60,TRUE,1,50,TRUE,1,60,TRUE,1,65,TRUE,1,87,TRUE,0,60,TRUE,0,75,FALSE,0,70,FALSE,1,81,TRUE,1,50,TRUE,1,50,FALSE,1,56,TRUE,0,80,FALSE,1,54,FALSE,1,53,TRUE,1,65,TRUE,1,95,FALSE,1,87,TRUE,1,82,FALSE,1,96,TRUE,1,70,TRUE,0,50,FALSE,1,96,TRUE,0,81,TRUE,1,65,FALSE,0,71,TRUE,1,70,0.16,0.09,0.25,0.25,0.09,0.16,0.0324,0.0169,0.2209,0.0025,0.1225,0.49,0.1225,0.36,0.25,0.25,0.0169,0.25,0.0016,0.0016,0.1225,0.25,0.2116,0.0361,0.1936,0.25,0.5041,0.4356,0.0144,0.64,0.6561,0.5625,0.223725,0.170328571,0.277121429,16,50,22,68.75,4,50,5,62.5,6,75,7,87.5,13,81.25,9,56.25,68.22,56.25,67.38,78.12,71.12,65.62,70.81,-18.75,-0.53,6.25,4.88,3.12,-16.38,-15.63,14.56,1,1,3,3,2,2,1,3,0,0,1,0,1,2,0,2,2,0,2,3,0,0,2,2,2,1,1,2,1,1,0,0,1,1,0,2,2,2,3,1,2,1.2,0.8,1.8,1.2,1.2,0.4,2,1.45,1.2,5.33,3.67,2,2,1,3,1.66,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,1.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,1,1,1,1,0,1,0,1,-1,-1,1,0,0,1,0,0,0,-2,-1,2,0.8,0,0.4,-0.2,0.25,HS_TS +752,R_5WnDdxhOf2TFPpf,39 - 45,American,Male,3,3,3,3,1,3,1,2,1,3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,10,2,3,1,3,2,10,3,3,3,3,3,10,2,2,1,2,2,9,2,2,2,2,2,8,3,1,3,2,2,9,3,3,3,3,3,9,3,3,3,3,3,10,TRUE,0,88,TRUE,1,84,TRUE,0,100,FALSE,1,70,TRUE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,77,TRUE,1,97,TRUE,1,95,FALSE,1,76,TRUE,0,97,TRUE,1,92,TRUE,0,76,TRUE,1,100,FALSE,0,88,TRUE,0,80,TRUE,0,100,FALSE,1,90,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,97,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,0,91,TRUE,1,100,FALSE,0,92,TRUE,1,100,0.0529,0,0.7744,0,0,0,0,0.0025,0,1,0,0.0064,0.0009,0.0576,0.0529,0.0256,0,0.09,1,0.9409,1,0,0.01,0.5776,0.64,0.04,0.8464,0.7744,1,1,0.8281,0.9409,0.386935714,0.088278571,0.685592857,24,75,19,59.38,7,87.5,5,62.5,3,37.5,4,50,12,75,7,43.75,92.09,86.12,92.5,94.5,95.25,93.88,90.31,15.62,32.71,-1.38,30,57,45.25,18.88,46.56,1,1,1,1,1,1,2,1,2,1,0,0,0,1,1,1,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,1,1,1,1,1.4,0.4,0.4,1,0.6,0.4,0.8,0.8,0.7,10,8.67,2,1,1,-1,1.33,10 cents,75 minutes,36 days,Male,University - Undergraduate,43,0.375,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,0,1,2,0,1,0,0,0,0,0,0,1,-1,0,-1,-1,0,0.8,0,-0.4,0.1,C_Ug +753,R_5oFdNv3wDUJVbDH,25 - 31,Canadian,Female,1,1,1,1,2,0,0,0,-1,1,0,1,0,-1,1,-1,0,0,0,-1,0,1,0,1,2,5,1,-1,0,0,1,5,-1,0,0,-1,-1,5,0,1,0,1,0,5,1,1,0,1,2,5,1,-1,0,0,1,5,0,1,0,-1,0,5,0,1,1,1,0,5,FALSE,1,81,TRUE,1,75,FALSE,1,79,TRUE,0,57,TRUE,1,73,FALSE,1,71,FALSE,0,57,TRUE,1,75,TRUE,1,57,TRUE,1,55,FALSE,1,59,TRUE,0,51,FALSE,0,73,FALSE,1,77,FALSE,0,53,TRUE,1,57,FALSE,1,53,FALSE,1,51,TRUE,0,54,TRUE,0,61,TRUE,1,55,TRUE,1,61,TRUE,0,53,TRUE,1,73,FALSE,1,74,TRUE,1,72,TRUE,0,55,TRUE,0,55,TRUE,0,57,FALSE,0,57,TRUE,1,55,TRUE,1,91,0.0625,0.0784,0.1849,0.3249,0.0081,0.0841,0.0729,0.2025,0.3721,0.1521,0.3249,0.5329,0.1849,0.1681,0.0729,0.0625,0.2809,0.3249,0.3025,0.0676,0.2025,0.2809,0.2916,0.0529,0.2209,0.3025,0.2025,0.0361,0.0441,0.2401,0.3249,0.2601,0.202607143,0.203128571,0.202085714,17,53.13,20,62.5,4,50,5,62.5,7,87.5,4,50,12,75,8,50,63.34,58.12,65.75,66,63.5,64.94,61.75,-9.37,0.84,8.12,3.25,-21.5,13.5,-10.06,11.75,1,0,1,0,0,1,1,0,1,0,1,1,0,0,2,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,1,1,0.4,0.6,0.8,0.8,0.2,0.6,0.2,1,0.65,0.5,5,5,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,-1,0,0,0.2,0,0.6,-0.2,0.15,C_Ug +754,R_7d0MjTxC7gmGqE1,39 - 45,American,Male,1,2,3,2,3,1,1,3,3,1,3,2,1,3,2,2,1,2,3,1,3,2,3,2,1,10,2,1,3,3,2,10,2,2,3,3,1,10,2,2,3,3,1,10,3,2,1,3,2,10,2,3,3,2,1,10,2,2,1,3,3,9,3,2,3,1,2,9,FALSE,1,100,TRUE,1,94,FALSE,1,95,TRUE,0,74,TRUE,1,97,FALSE,1,99,TRUE,1,100,TRUE,1,95,TRUE,1,94,TRUE,1,98,FALSE,1,100,TRUE,0,85,TRUE,1,95,FALSE,1,100,FALSE,0,87,TRUE,1,100,TRUE,0,89,TRUE,0,90,FALSE,1,96,FALSE,1,86,TRUE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,0,99,FALSE,1,99,FALSE,1,94,FALSE,1,96,FALSE,0,93,TRUE,1,95,TRUE,1,91,0.0025,0.9801,0,0,0.0081,0.0001,0,0.0004,0.0196,0.0064,0.8649,0.0025,0.0036,0,0.0009,0.0036,0,0.5476,0.0036,0.0016,0,0.7569,0.0016,0,0.7921,0.0001,0.0025,0,0.0025,0.81,0.0016,0.7225,0.162596429,0.104121429,0.221071429,32,100,25,78.13,6,75,7,87.5,6,75,6,75,13,81.25,12,75,94.66,92.38,95.88,96.88,93.5,95.62,93.69,21.87,16.53,17.38,8.38,21.88,18.5,14.37,18.69,2,0,0,0,2,1,0,0,0,1,1,0,2,0,1,0,1,1,0,0,2,0,2,1,1,1,2,0,1,0,1,0,0,0,1,1,1,1,2,1,0.8,0.4,0.8,0.4,1.2,0.8,0.4,1.2,0.6,0.9,10,9.67,0,0,1,1,0.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,41,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,0,-2,-1,1,0,-2,0,-1,1,0,0,2,0,0,-1,0,0,-2,-1,-0.4,-0.4,0.4,-0.8,-0.3,C_Ug +755,R_30cvYfnM8L8PEKS,18 - 24,Canadian,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,FALSE,1,68,TRUE,1,89,TRUE,0,79,FALSE,1,72,FALSE,0,83,FALSE,1,92,TRUE,1,74,TRUE,1,84,TRUE,1,94,TRUE,1,82,FALSE,1,64,TRUE,0,92,TRUE,1,85,TRUE,0,85,FALSE,0,84,TRUE,1,76,TRUE,0,87,FALSE,1,85,TRUE,0,88,FALSE,1,79,TRUE,1,91,FALSE,0,74,TRUE,0,75,TRUE,1,76,FALSE,1,88,TRUE,1,96,FALSE,1,69,TRUE,0,95,TRUE,0,87,TRUE,1,95,FALSE,0,63,FALSE,0,85,0.0256,0.0016,0.0576,0.0676,0.7225,0.0064,0.0576,0.0324,0.0441,0.5476,0.0025,0.0225,0.0036,0.1296,0.6889,0.0121,0.5625,0.0784,0.9025,0.0144,0.0081,0.7056,0.7744,0.7225,0.7569,0.0961,0.3969,0.1024,0.6241,0.0225,0.7569,0.8464,0.3443,0.207907143,0.480692857,26,81.25,19,59.38,5,62.5,3,37.5,6,75,5,62.5,11,68.75,8,50,82.38,77.88,85.62,81.5,84.5,83.19,81.56,21.87,23,15.38,48.12,6.5,22,14.44,31.56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6.33,-1,0,0,-1,-0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,23,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +756,R_5hWQ8LJnGFnQkcP,18 - 24,Canadian,Female,2,3,3,3,3,0,-2,1,2,2,2,-1,3,2,3,-1,2,-1,1,-1,-3,1,3,-3,0,5,-3,1,-3,3,2,2,1,0,2,0,1,6,1,-1,2,-2,1,10,2,3,3,3,3,8,1,-2,3,-1,3,8,2,-2,3,2,3,2,2,2,2,2,0,10,FALSE,1,85,FALSE,0,50,TRUE,0,70,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,96,TRUE,1,50,TRUE,1,100,FALSE,1,60,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,65,FALSE,1,50,TRUE,0,92,TRUE,0,50,FALSE,1,50,FALSE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,0,63,FALSE,0,62,TRUE,1,50,0.0016,0.25,0.1225,0.25,0.25,0,0.25,0,0.25,0.25,0.3969,0,0.25,0.16,0.25,0.25,1,0.25,0.25,0.25,1,0.25,0.25,0,0.25,0.25,0.3844,0.0225,0.49,0.8464,0.25,0.25,0.296435714,0.254064286,0.338807143,13,40.63,19,59.38,4,50,6,75,5,62.5,4,50,11,68.75,8,50,65.41,52.75,75,72.12,61.75,64.75,66.06,-18.75,6.03,2.75,0,9.62,11.75,-4,16.06,5,2,0,6,3,3,3,4,1,0,1,1,1,2,2,2,3,3,3,2,0,0,0,0,0,1,0,2,3,1,0,1,0,0,0,3,0,3,1,1,3.2,2.2,1.4,2.6,0,1.4,0.2,1.6,2.35,0.8,4.33,6,-3,-6,4,0,-1.67,15 cents,5 minutes,15 days,Female,High School (or equivalent),18,0.625,0,1,0,0,0,0,0.33,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,5,2,0,6,3,2,3,2,-2,-1,1,0,1,2,2,-1,3,0,2,1,3.2,0.8,1.2,1,1.55,HS_TS +757,R_52VDrdvaO5dhjEE,18 - 24,Canadian,Female,3,3,3,3,1,0,2,2,2,1,2,-1,3,1,1,-2,0,-1,1,0,3,3,3,3,2,1,0,-1,0,-1,3,3,2,3,2,-1,2,5,-1,2,2,0,2,7,2,3,2,3,3,1,3,2,3,-1,3,8,3,-1,3,0,2,6,3,3,3,3,2,10,FALSE,1,92,TRUE,1,75,FALSE,1,100,TRUE,0,51,TRUE,1,72,FALSE,1,100,TRUE,1,83,TRUE,1,85,TRUE,1,57,TRUE,1,62,FALSE,1,62,FALSE,1,92,FALSE,0,76,FALSE,1,54,TRUE,1,75,TRUE,1,59,FALSE,1,56,TRUE,0,65,FALSE,1,51,FALSE,1,52,TRUE,1,60,TRUE,1,52,TRUE,0,61,TRUE,1,52,FALSE,1,99,TRUE,1,90,TRUE,0,58,FALSE,1,58,FALSE,1,51,TRUE,1,100,TRUE,1,55,TRUE,1,79,0.0225,0.01,0.1681,0.0289,0.0441,0,0.2304,0.1444,0.2304,0.2304,0,0.5776,0.1849,0.1444,0.0784,0.0625,0.3721,0.2601,0.1764,0.0001,0.16,0.0625,0.2401,0.2116,0.1936,0.3364,0.2025,0.0064,0,0.4225,0.2401,0.0064,0.172082143,0.182835714,0.161328571,16,50,27,84.38,6,75,6,75,7,87.5,8,100,15,93.75,12,75,69.81,60.5,69.38,74.62,74.75,70.75,68.88,-34.38,-14.57,-14.5,-5.62,-12.88,-25.25,-23,-6.12,0,0,0,0,1,0,3,2,3,2,0,4,1,2,1,1,2,3,1,2,1,0,1,0,2,3,0,1,3,2,1,0,0,1,1,5,3,4,2,2,0.2,2,1.6,1.8,0.8,1.8,0.6,3.2,1.4,1.6,3,5,0,-5,-1,-3,-2,10 cents,25 minutes,15 days,Female,High School (or equivalent),19,0.875,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,0,-1,0,-1,-3,3,1,0,0,-1,4,1,1,0,-4,-1,-1,-1,0,-0.6,0.2,1,-1.4,-0.2,HS_TS +758,R_3OeHvPqMYqgioPE,25 - 31,Canadian,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,59,FALSE,0,57,TRUE,0,58,FALSE,1,57,TRUE,1,54,TRUE,0,55,FALSE,0,55,FALSE,0,54,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,71,FALSE,1,50,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,1,76,TRUE,1,70,FALSE,1,50,TRUE,1,84,FALSE,1,50,TRUE,0,63,FALSE,1,50,TRUE,1,58,TRUE,1,50,TRUE,1,76,0.2916,0.0256,0.25,0.3025,0.0576,0.3025,0.09,0.25,0.25,0.25,0.1764,0.25,0.25,0.25,0.2116,0.3249,0.0576,0.1849,0.3969,0.25,0.1764,0.25,0.25,0.25,0.25,0.25,0.25,0.1681,0.3364,0.5041,0.25,0.25,0.240621429,0.207535714,0.273707143,11,34.38,19,59.38,5,62.5,6,75,4,50,4,50,7,43.75,12,75,56.41,51.75,58.62,58.62,56.62,57.25,55.56,-25,-2.97,-10.75,-16.38,8.62,6.62,13.5,-19.44,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0,0,0.05,0,5,5,0,0,0,0,0,5 cents,100 minutes,24 days,Female,High School (or equivalent),26,0,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05,HS_TS +759,R_1B3q9bSFF0Y7SCZ,18 - 24,Canadian,Female,0,3,1,3,2,-3,1,1,3,1,1,0,2,0,0,-3,-3,-3,-3,-2,0,3,3,3,0,5,1,-1,0,1,-2,8,2,3,1,3,1,5,-3,-3,-3,-3,-2,2,1,3,3,3,3,3,-2,2,2,3,2,7,0,0,1,1,1,3,2,0,1,0,0,4,TRUE,0,70,TRUE,1,50,FALSE,1,68,FALSE,1,63,TRUE,1,60,FALSE,1,63,TRUE,1,83,FALSE,0,60,FALSE,0,62,TRUE,1,70,FALSE,1,71,TRUE,0,60,TRUE,1,71,FALSE,1,64,FALSE,0,81,TRUE,1,92,FALSE,1,76,TRUE,0,67,FALSE,1,62,FALSE,1,59,TRUE,1,64,TRUE,1,64,TRUE,0,50,TRUE,1,74,FALSE,1,68,TRUE,1,66,FALSE,1,63,FALSE,1,59,FALSE,1,58,TRUE,1,67,FALSE,0,68,FALSE,0,64,0.36,0.1156,0.0064,0.0289,0.4096,0.1369,0.0676,0.09,0.1681,0.1296,0.1089,0.0841,0.3844,0.0841,0.16,0.25,0.25,0.1369,0.1681,0.1024,0.1296,0.6561,0.1444,0.1296,0.0576,0.1369,0.4624,0.49,0.1024,0.4489,0.1764,0.36,0.215178571,0.175728571,0.254628571,32,100,23,71.88,5,62.5,6,75,6,75,6,75,11,68.75,12,75,66.16,65,63.25,69,67.38,68.5,63.81,28.12,-5.72,2.5,-11.75,-6,-7.62,-0.25,-11.19,0,0,2,0,2,4,2,1,2,3,1,3,1,3,1,0,0,0,0,0,1,0,2,0,1,1,1,1,0,1,1,0,1,1,1,5,3,4,3,2,0.8,2.4,1.8,0,0.8,0.8,0.8,3.4,1.25,1.45,6,4.33,2,1,2,-2,1.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),20,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,-1,0,0,0,1,3,1,0,2,2,0,3,0,2,0,-5,-3,-4,-3,-2,0,1.6,1,-3.4,-0.2,HS_TS +760,R_7dfOXQgqKbzUjGY,25 - 31,Canadian,Female,1,3,2,-1,3,0,-2,2,-1,0,2,2,2,1,2,1,-2,2,2,-2,2,3,3,-2,3,7,-2,-2,2,-2,1,8,2,2,2,2,2,8,-1,0,1,1,0,0,2,1,1,1,2,4,1,0,0,1,0,4,1,0,2,1,0,5,2,1,0,0,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,FALSE,1,80,TRUE,0,80,FALSE,1,100,FALSE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,80,FALSE,1,80,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0.25,0,0,0,0,0.25,0,0,0,0,1,0.04,1,0.64,0.25,0.64,1,1,0.64,1,0,1,0.04,1,1,0.383928571,0.107142857,0.660714286,25,78.13,18,56.25,2,25,5,62.5,5,62.5,6,75,11,68.75,7,43.75,92.19,82.5,97.5,91.25,97.5,89.38,95,21.88,35.94,57.5,35,28.75,22.5,20.63,51.25,1,0,1,1,0,2,0,0,1,1,0,0,0,1,0,2,2,1,1,2,1,2,1,2,1,1,2,2,2,0,1,2,0,0,2,1,3,2,2,3,0.6,0.8,0.2,1.6,1.4,1.4,1,2.2,0.8,1.5,7.67,4.33,3,4,3,-2,3.34,10 cents,100 minutes,36 days,Female,Professional Degree (ex. JD/MD),25,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,-2,0,-1,-1,1,-2,-2,-1,1,-1,-2,0,1,-2,1,-1,-1,-1,-1,-0.8,-0.6,-0.8,-0.6,-0.7,grad_prof +761,R_5lF9fKPJczQMLnL,39 - 45,American,Male,2,3,1,1,0,1,0,2,0,1,0,0,3,1,1,0,0,1,1,0,3,2,2,1,0,5,0,0,1,0,1,4,0,-1,3,0,1,2,1,1,0,0,0,4,1,3,1,2,0,3,0,0,2,0,1,2,0,-1,3,2,1,1,0,0,1,1,0,4,FALSE,1,96,FALSE,0,81,FALSE,1,95,TRUE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,94,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,88,TRUE,0,94,FALSE,0,100,FALSE,1,96,FALSE,0,87,TRUE,1,100,TRUE,0,75,TRUE,0,93,TRUE,0,80,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,90,TRUE,1,72,FALSE,1,100,TRUE,1,94,TRUE,0,73,FALSE,1,80,TRUE,0,91,FALSE,0,76,FALSE,0,52,TRUE,1,100,0,0.0036,0,0.0036,0,0,0.0784,1,0,0,0.5776,1,0,0.0144,0,0.6561,0.01,0.4624,0.04,0,0.0025,0.7569,0.64,0.0016,0.5625,0.5329,0.2704,0.0016,0.0025,0.8649,0.8281,0.8836,0.328085714,0.27135,0.384821429,28,87.5,19,59.38,2,25,5,62.5,6,75,6,75,10,62.5,9,56.25,89.69,78.62,93.88,96.62,89.62,90.69,88.69,28.12,30.31,53.62,31.38,21.62,14.62,28.19,32.44,1,1,1,0,0,1,0,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0.6,0.4,0.4,0.8,0.4,0.2,0.4,0,0.55,0.25,3.67,2,2,2,1,0,1.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,44,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,1,1,-1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0.2,0.2,0,0.8,0.3,C_Ug +762,R_5Mz0tsSQPdptHFL,46 - 52,American,Male,-1,1,3,3,1,-3,1,3,2,0,1,1,2,-1,0,0,0,1,0,3,-3,1,3,-1,1,6,1,1,2,3,-1,3,3,2,2,0,1,5,-1,-3,0,-3,3,6,-1,1,3,3,2,4,2,3,3,3,-1,2,3,3,3,2,1,6,1,0,2,2,3,4,TRUE,0,100,TRUE,1,52,TRUE,0,76,TRUE,0,61,FALSE,0,63,FALSE,1,64,TRUE,1,100,TRUE,1,78,TRUE,1,63,FALSE,0,53,FALSE,1,60,TRUE,0,75,TRUE,1,64,TRUE,0,80,FALSE,0,54,TRUE,1,65,FALSE,1,65,TRUE,0,79,FALSE,1,69,FALSE,1,73,TRUE,1,75,FALSE,0,56,FALSE,1,72,TRUE,1,69,TRUE,0,75,TRUE,1,72,TRUE,0,66,TRUE,0,60,TRUE,0,65,TRUE,1,66,TRUE,1,70,TRUE,1,100,0.0484,0.0784,0.1225,0,0,0.1296,0.0961,0.2809,0.0729,0.3136,0.1156,0.1296,0.1369,0.16,0.3969,0.2304,0.0784,0.3721,0.36,0.5625,0.0625,0.2916,0.0961,0.64,0.1225,0.4356,0.09,1,0.5776,0.6241,0.4225,0.5625,0.298589286,0.1795,0.417678571,10,31.25,18,56.25,5,62.5,6,75,2,25,5,62.5,12,75,6,37.5,70,61.88,71,76.88,70.25,68.75,71.25,-25,13.75,-0.62,-4,51.88,7.75,-6.25,33.75,2,0,0,4,0,4,0,1,1,1,2,1,0,1,1,1,3,1,3,0,0,0,0,0,1,5,2,0,1,1,2,2,1,3,1,1,0,1,2,0,1.2,1.4,1,1.6,0.2,1.8,1.8,0.8,1.3,1.15,4.67,4,2,1,-1,2,0.67,10 cents,25 minutes,24 days,Male,High School (or equivalent),51,-0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,2,0,0,4,-1,-1,-2,1,0,0,0,-1,-1,-2,0,0,3,0,1,0,1,-0.4,-0.8,0.8,0.15,HS_TS +763,R_6ixPXVWXRaYMHnt,39 - 45,American,Male,3,3,3,3,3,1,1,3,-2,1,1,3,3,3,3,3,3,3,3,3,3,3,2,2,3,6,1,3,3,3,3,10,3,3,3,1,1,10,3,3,2,3,2,7,3,3,3,3,3,10,2,3,3,1,3,10,2,2,3,3,2,8,3,1,2,3,-2,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.071428571,0.071428571,0.071428571,32,100,30,93.75,8,100,7,87.5,7,87.5,8,100,15,93.75,15,93.75,100,100,100,100,100,100,100,6.25,6.25,0,12.5,12.5,0,6.25,6.25,0,0,1,1,0,0,2,0,5,2,2,0,0,2,2,0,0,1,0,1,0,0,0,0,0,1,2,0,3,2,1,1,0,0,1,0,2,1,0,5,0.4,1.8,1.2,0.4,0,1.6,0.6,1.6,0.95,0.95,8.67,9.33,-4,0,2,-3,-0.66,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),39,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,1,1,0,-1,0,0,2,0,1,-1,0,2,1,0,-2,0,0,-4,0.4,0.2,0.6,-1.2,0,grad_prof +764,R_32E5t5jnIUY070h,39 - 45,American,Male,3,3,3,2,3,2,2,3,2,1,3,1,3,-1,3,2,3,3,1,-2,2,3,3,2,2,10,3,3,2,1,2,9,1,-1,1,2,3,9,-1,1,1,-3,-1,9,3,3,3,-2,3,8,-1,-2,3,-3,2,8,3,3,3,-2,3,8,3,3,3,2,-1,2,FALSE,1,80,TRUE,1,97,TRUE,0,96,FALSE,1,96,FALSE,0,91,FALSE,1,89,TRUE,1,92,TRUE,1,96,FALSE,0,77,TRUE,1,91,FALSE,1,80,TRUE,0,86,FALSE,0,96,FALSE,1,93,FALSE,0,76,TRUE,1,98,FALSE,1,100,FALSE,1,100,FALSE,1,91,FALSE,1,92,TRUE,1,100,TRUE,1,70,FALSE,1,51,FALSE,0,100,FALSE,1,92,TRUE,1,93,FALSE,1,92,FALSE,1,91,FALSE,1,89,FALSE,0,100,FALSE,0,55,FALSE,0,100,0.0016,0.0049,0.0004,0.0064,1,0.0121,1,0.0081,0.0064,0.09,1,0.9216,0.5929,0.04,0.8281,0.0009,0.2401,0.0016,0.0081,0.0064,0,0.5776,0.0081,0.0049,0,0.0064,0.3025,0.04,0.9216,0,0.0121,0.7396,0.298896429,0.410128571,0.187664286,17,53.13,22,68.75,5,62.5,5,62.5,8,100,4,50,8,50,14,87.5,89.06,83,89.5,88.88,94.88,89.5,88.62,-15.62,20.31,20.5,27,-11.12,44.88,39.5,1.12,1,0,0,0,1,1,1,1,1,1,2,2,2,3,0,3,2,2,4,1,0,0,0,4,0,3,4,0,5,1,0,2,0,1,0,1,0,0,1,1,0.4,1,1.8,2.4,0.8,2.6,0.6,0.6,1.4,1.15,9.33,8,2,1,1,7,1.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,41,0.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,1,0,0,-4,1,-2,-3,1,-4,0,2,0,2,2,0,2,2,2,3,0,-0.4,-1.6,1.2,1.8,0.25,C_Ug +765,R_3g2bx0A4YCg9BM7,25 - 31,Canadian,Male,-2,3,2,3,1,1,0,2,1,1,2,2,3,-1,2,-1,-1,-1,-1,0,-2,3,0,2,-1,3,-1,-1,-2,2,-1,9,-2,-2,-2,-2,-2,10,2,2,2,2,2,8,-2,3,2,3,3,4,3,3,3,-1,2,5,2,2,2,2,2,2,2,3,3,2,-2,2,TRUE,0,92,TRUE,1,68,FALSE,1,50,FALSE,1,50,TRUE,1,72,FALSE,1,89,TRUE,1,95,TRUE,1,90,FALSE,0,50,FALSE,0,50,TRUE,0,83,TRUE,0,100,TRUE,1,95,FALSE,1,50,FALSE,0,50,TRUE,1,77,FALSE,1,50,FALSE,1,50,TRUE,0,95,FALSE,1,50,FALSE,0,92,FALSE,0,50,TRUE,0,83,TRUE,1,70,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,0,95,TRUE,1,100,FALSE,0,90,FALSE,0,50,0.01,0.25,0.0529,0.0025,0.25,0.0121,0.09,0.25,0.25,0.25,0,0.0025,0.25,0.6889,0.0784,0.1024,0.6889,0.25,1,0.25,0.8464,0.25,0.9025,0.25,0.25,0.25,0.81,0.8464,0.25,0.25,0.9025,1,0.40075,0.225942857,0.575557143,16,50,17,53.13,3,37.5,4,50,4,50,6,75,8,50,9,56.25,71.44,67,78.25,60.88,79.62,71.81,71.06,-3.13,18.31,29.5,28.25,10.88,4.62,21.81,14.81,0,0,2,1,2,2,1,4,1,2,4,4,5,1,4,3,3,3,3,2,0,0,0,0,2,2,3,1,2,1,0,0,1,3,0,3,4,4,3,2,1,2,3.6,2.8,0.4,1.8,0.8,3.2,2.35,1.55,7.33,3.67,-1,4,8,6,3.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),28,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,2,1,0,0,-2,3,-1,1,4,4,4,-2,4,0,-1,-1,0,0,0.6,0.2,2.8,-0.4,0.8,grad_prof +766,R_70ZQmEKkRKoUQPk,46 - 52,American,Male,3,2,2,2,2,2,2,2,2,1,2,3,2,2,2,2,1,2,2,2,3,2,2,2,1,7,-2,-2,1,-2,1,7,1,2,2,2,3,5,3,2,2,2,2,6,2,2,1,2,1,7,2,-2,1,1,1,8,2,2,1,2,2,7,2,2,2,1,2,3,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,0,100,TRUE,1,80,TRUE,0,100,TRUE,1,100,TRUE,1,90,TRUE,1,85,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,90,TRUE,0,90,TRUE,0,90,FALSE,0,95,TRUE,1,100,TRUE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.01,0,1,0,0,1,0.81,0,0.81,0,0,0,0.0225,1,0.04,0.01,1,1,1,0,0.9025,0,0.81,0.0225,1,1,1,1,1,0.81,1,1,0.579910714,0.406607143,0.753214286,16,50,14,43.75,3,37.5,3,37.5,6,75,2,25,12,75,2,12.5,96.41,95.62,96.88,96.88,96.25,95.62,97.19,6.25,52.66,58.12,59.38,21.88,71.25,20.62,84.69,0,0,0,0,1,4,4,1,4,0,1,1,0,0,1,1,1,0,0,0,1,0,1,0,1,0,4,1,1,0,0,1,1,0,0,0,1,0,1,0,0.2,2.6,0.6,0.4,0.6,1.2,0.4,0.4,0.95,0.65,6.33,7.33,0,-1,-2,3,-1,5 cents,25 minutes,47 days,Male,High School (or equivalent),49,0,1,0,1,0,0,0,0.67,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,-1,0,-1,0,0,4,0,0,3,0,1,0,-1,0,1,1,0,0,-1,0,-0.4,1.4,0.2,0,0.3,HS_TS +767,R_3aXLDtWCm56JVH5,46 - 52,American,Male,1,3,1,2,2,0,-2,3,-2,3,2,0,1,0,2,3,3,3,3,2,2,3,2,2,3,9,2,-1,3,-3,3,9,2,-1,1,2,2,9,-1,1,1,0,-1,10,2,2,2,2,2,3,2,-3,2,-3,2,6,2,1,0,3,3,2,2,2,3,3,3,3,TRUE,0,96,TRUE,1,50,FALSE,1,97,FALSE,1,96,FALSE,0,50,FALSE,1,97,TRUE,1,55,TRUE,1,73,FALSE,0,50,FALSE,0,100,FALSE,1,66,TRUE,0,84,FALSE,0,74,FALSE,1,50,FALSE,0,50,TRUE,1,98,FALSE,1,50,FALSE,1,50,FALSE,1,82,FALSE,1,100,FALSE,0,50,TRUE,1,75,TRUE,0,75,TRUE,1,94,FALSE,1,97,TRUE,1,94,FALSE,1,50,FALSE,1,98,FALSE,1,97,FALSE,0,96,FALSE,0,50,FALSE,0,50,0.0729,0.0036,0.0004,0.2025,0.25,0.0009,0.0036,1,0,0.0625,0.9216,0.5476,0.25,0.1156,0.25,0.25,0.5625,0.0016,0.0004,0.0009,0.25,0.25,0.0324,0.25,0.25,0.25,0.25,0.9216,0.0009,0.25,0.0009,0.7056,0.27245,0.301135714,0.243764286,8,25,20,62.5,5,62.5,3,37.5,6,75,6,75,7,43.75,13,81.25,74.81,61.75,67.88,77.12,92.5,69.31,80.31,-37.5,12.31,-0.75,30.38,2.12,17.5,25.56,-0.94,1,0,1,0,1,2,1,0,1,0,0,1,0,2,0,4,2,2,3,3,1,1,1,0,0,2,1,1,1,1,0,1,1,3,1,1,1,0,0,1,0.6,0.8,0.6,2.8,0.6,1.2,1.2,0.6,1.2,0.9,9,3.67,6,3,7,7,5.33,10 cents,100 minutes,47 days,Male,University - Undergraduate,48,0.375,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,0,-1,0,0,1,0,0,-1,0,-1,0,0,-1,-1,-1,3,1,2,3,2,0,-0.4,-0.6,2.2,0.3,C_Ug +768,R_79TkYrC8fTkZ9hn,39 - 45,American,Male,1,2,2,1,1,0,-1,1,-1,1,1,0,1,0,1,-1,0,0,0,-1,1,1,1,1,1,3,-1,-1,1,-1,1,3,1,0,1,0,1,3,-1,-1,0,0,0,3,1,1,1,1,1,3,0,0,1,0,1,3,1,0,2,0,1,3,0,0,0,0,0,3,TRUE,0,90,TRUE,1,97,TRUE,0,94,FALSE,1,64,TRUE,1,100,FALSE,1,87,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,98,FALSE,1,56,TRUE,0,100,TRUE,1,87,FALSE,1,56,TRUE,1,81,TRUE,1,99,FALSE,1,66,TRUE,0,93,FALSE,1,76,FALSE,1,88,FALSE,0,97,TRUE,1,83,TRUE,0,93,TRUE,1,91,TRUE,0,72,TRUE,1,90,FALSE,1,53,FALSE,1,100,FALSE,1,55,FALSE,0,64,FALSE,0,96,FALSE,0,68,0,0.01,0.0001,0,0.4624,0.0169,0.0081,0.0004,0.0144,0.0289,0.4096,0.0169,0.0064,0.1936,0,0.0009,0.8649,0.1296,0,0.5184,0.9409,0.0361,0.0576,0.1936,0.1156,0.2209,0.9216,0.81,0.8836,0.8649,0.2025,1,0.318525,0.153785714,0.483264286,25,78.13,22,68.75,7,87.5,5,62.5,5,62.5,5,62.5,12,75,10,62.5,83.94,76.88,81.62,85.25,92,90.19,77.69,9.38,15.19,-10.62,19.12,22.75,29.5,15.19,15.19,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0.4,0.2,0,0.4,0.4,0.4,0.2,0.4,0.25,0.35,3,3,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,39,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,1,-1,0,-1,0,0,0,-1,0,0,-1,1,0,0,0,0,-0.2,-0.2,0,-0.1,C_Ug +769,R_6QE36qxNx5mVK4C,18 - 24,Canadian,Female,1,3,3,3,1,2,-1,3,0,2,2,3,3,-3,3,1,1,1,1,3,-1,-1,-1,-1,-1,10,-1,-1,-1,-1,-1,5,0,-3,-1,3,-2,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,6,3,0,3,-3,3,5,3,3,3,-3,3,6,3,3,3,3,3,7,TRUE,0,83,TRUE,1,96,TRUE,0,91,TRUE,0,83,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,FALSE,1,83,TRUE,0,100,TRUE,1,92,TRUE,0,90,TRUE,1,82,TRUE,1,63,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,92,TRUE,1,100,TRUE,1,82,TRUE,0,68,TRUE,1,70,FALSE,1,65,TRUE,1,100,TRUE,0,77,TRUE,0,75,TRUE,0,81,TRUE,1,100,TRUE,1,73,FALSE,0,100,0,0,0.1369,0,1,1,0.09,0.0289,0.0064,0.0324,0,0.0064,0,0.0289,0,0.0016,0.4624,0.6889,0.5625,0.1225,0,0.0324,1,0.81,1,0.5929,0.0729,0.6889,0.8281,1,0.6561,1,0.418292857,0.238992857,0.597592857,26,81.25,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,15,93.75,3,18.75,88.41,86.75,92.62,87.88,86.38,90.06,86.75,25,32.16,24.25,55.12,25.38,23.88,-3.69,68,2,4,4,4,2,3,0,4,1,3,2,6,4,6,5,4,4,4,4,6,2,0,0,0,2,1,1,0,3,1,1,0,0,0,0,2,2,2,2,0,3.2,2.2,4.6,4.4,0.8,1.2,0.2,1.6,3.6,0.95,8.33,5.67,4,0,4,3,2.66,10 cents,100 minutes,24 days,Female,University - Undergraduate,24,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,4,4,4,0,2,-1,4,-2,2,1,6,4,6,5,2,2,2,2,6,2.4,1,4.4,2.8,2.65,C_Ug +770,R_3ozpWk0WXkPDv2J,25 - 31,Canadian,Female,2,2,2,2,2,0,0,1,1,0,2,1,3,2,1,0,3,2,2,-3,3,3,3,3,3,5,-1,0,-1,-2,3,7,2,3,2,1,2,4,1,-1,-1,-2,-2,8,3,3,3,3,3,3,2,2,2,-2,2,5,3,2,3,3,3,9,3,3,3,3,1,4,FALSE,1,65,TRUE,1,83,TRUE,0,100,FALSE,1,50,FALSE,0,85,TRUE,0,68,TRUE,1,89,TRUE,1,67,TRUE,1,82,TRUE,1,100,FALSE,1,64,TRUE,0,89,TRUE,1,69,TRUE,0,73,FALSE,0,68,FALSE,0,64,FALSE,1,58,TRUE,0,94,FALSE,1,71,FALSE,1,53,TRUE,1,71,FALSE,0,54,TRUE,0,86,TRUE,1,93,FALSE,1,68,TRUE,1,67,TRUE,0,64,FALSE,1,63,TRUE,0,93,TRUE,1,90,FALSE,0,74,TRUE,1,100,0.1089,0.1089,0.4096,0.0121,0,0.4624,0.0049,0,0.2209,0.2916,0.01,0.0961,0.0324,0.1296,0.7225,0.0289,0.7396,0.25,0.1369,0.1024,0.0841,0.4624,0.0841,0.5329,0.1764,0.4096,0.5476,0.1225,1,0.8836,0.8649,0.7921,0.328157143,0.213492857,0.442821429,9,28.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,11,68.75,8,50,75.47,69.5,78.75,76.25,77.38,78.5,72.44,-31.25,16.09,7,28.75,13.75,14.88,9.75,22.44,1,1,1,1,1,1,0,2,3,3,0,2,1,1,1,1,4,3,4,1,1,1,1,1,1,2,2,1,3,2,1,1,0,1,2,3,0,1,1,4,1,1.8,1,2.6,1,2,1,1.8,1.6,1.45,5.33,5.67,2,2,-5,4,-0.34,10 cents,25 minutes,24 days,Female,High School (or equivalent),27,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,-1,-2,1,0,1,-1,1,1,0,-1,-2,4,2,3,-3,0,-0.2,0,0.8,0.15,HS_TS +771,R_6qCttAVyouSxM4S,25 - 31,Canadian,Female,3,3,3,-1,3,1,-1,0,1,3,-1,-3,3,-2,3,0,1,2,0,-2,-1,3,3,3,3,1,1,-2,-2,1,3,1,-2,-3,3,-2,3,1,-1,-1,-1,-1,-2,1,3,3,3,-2,3,1,1,-2,2,1,3,1,-1,-3,3,-1,3,0,1,3,2,2,1,6,FALSE,1,75,FALSE,0,50,TRUE,0,96,FALSE,1,50,TRUE,1,80,FALSE,1,55,TRUE,1,91,TRUE,1,60,TRUE,1,55,TRUE,1,93,FALSE,1,50,TRUE,0,55,TRUE,1,70,FALSE,1,50,FALSE,0,50,TRUE,1,57,TRUE,0,54,TRUE,0,56,FALSE,1,50,TRUE,0,50,TRUE,1,52,TRUE,1,71,FALSE,1,100,TRUE,1,50,FALSE,1,95,TRUE,1,60,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,85,0.16,0.16,0.1849,0.0081,0.0225,0.2025,0.25,0.0049,0.25,0.0841,0.25,0.09,0.2025,0.25,0.04,0.25,0,0.25,0.25,0.0025,0.2304,0.25,0.25,0.25,0.2916,0.25,0.25,0.0625,0.9216,0.3136,0.25,0.3025,0.215042857,0.153321429,0.276764286,14,43.75,23,71.88,5,62.5,7,87.5,7,87.5,4,50,12,75,11,68.75,62.81,50.62,68.25,73.88,58.5,64,61.62,-28.13,-9.07,-11.88,-19.25,-13.62,8.5,-11,-7.13,4,0,0,4,0,0,1,2,0,0,1,0,0,0,0,1,2,3,1,0,0,0,0,1,0,0,1,2,0,0,0,0,0,1,0,1,2,0,2,3,1.6,0.6,0.2,1.4,0.2,0.6,0.2,1.6,0.95,0.65,1,0.67,0,0,1,-5,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),28,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,4,0,0,3,0,0,0,0,0,0,1,0,0,-1,0,0,0,3,-1,-3,1.4,0,0,-0.2,0.3,HS_TS +772,R_3KUgGNSeDtsAYzX,18 - 24,Canadian,Female,2,2,2,2,2,0,0,1,0,1,0,0,1,1,1,-2,1,-1,0,-3,2,2,2,2,2,0,-2,0,1,2,0,3,1,1,0,1,1,3,-2,1,-2,-2,-2,2,2,2,1,2,2,1,0,-2,3,-2,2,7,0,0,2,1,2,6,3,3,3,3,2,9,TRUE,0,90,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,75,TRUE,0,50,TRUE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,80,FALSE,1,85,TRUE,1,75,TRUE,1,50,TRUE,0,50,TRUE,0,80,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,90,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,75,TRUE,1,50,TRUE,1,50,0.01,0.01,0.25,0.25,0.25,0.25,0.04,0.0625,0.25,0.25,0.0625,0.04,0.25,0.25,0.0625,0.25,0,0.25,0.25,0,0.25,0.0625,0.25,0.0225,0.25,0.25,0.25,0.81,0.25,0.64,0.25,0.25,0.216160714,0.161964286,0.270357143,16,50,22,68.75,6,75,5,62.5,5,62.5,6,75,13,81.25,9,56.25,63.91,53.12,63.12,77.5,61.88,65,62.81,-18.75,-4.84,-21.88,0.62,15,-13.12,-16.25,6.56,0,0,0,0,0,2,0,0,2,1,1,1,1,0,0,0,0,1,2,1,0,0,1,0,0,0,2,2,2,1,0,0,1,0,1,5,2,4,3,5,0,1,0.6,0.8,0.2,1.4,0.4,3.8,0.6,1.45,2,4.67,-1,-4,-3,-7,-2.67,10 cents,100 minutes,47 days,Female,University - Undergraduate,23,0.5,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,0,0,-1,0,0,2,-2,-2,0,0,1,1,0,0,-1,-5,-2,-3,-1,-4,-0.2,-0.4,0.2,-3,-0.85,C_Ug +773,R_5jZ4qTpkKjrfANY,25 - 31,Canadian,Female,3,3,1,-2,2,-3,1,1,3,3,0,-2,3,0,3,-2,-2,-3,-2,-3,3,3,1,3,2,3,-3,3,-2,3,2,2,-2,-3,2,-1,2,1,-3,-3,-3,-3,-3,5,3,3,0,-1,3,2,0,-1,2,-1,3,3,0,-2,3,0,3,2,0,0,0,1,-2,7,FALSE,1,75,TRUE,1,75,FALSE,1,82,TRUE,0,50,TRUE,1,91,FALSE,1,70,TRUE,1,91,TRUE,1,79,TRUE,1,95,TRUE,1,96,FALSE,1,61,TRUE,0,100,TRUE,1,61,FALSE,1,75,FALSE,0,50,FALSE,0,55,TRUE,0,58,FALSE,1,92,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,55,FALSE,1,64,TRUE,1,75,TRUE,0,64,TRUE,1,71,TRUE,0,50,FALSE,1,59,TRUE,0,59,FALSE,0,62,FALSE,0,50,TRUE,1,75,0.0441,0.0841,0.3025,0.0081,0.0625,0.09,0.0625,0.0016,0.25,0.3025,0.3844,0.1521,0.0025,0.1521,0.0081,0.0625,0.1296,0.25,0.1681,0.4096,0.25,0.25,0.25,0.0625,0.3364,0.25,0.25,0.0625,0.0324,0.0064,0.3481,1,0.199514286,0.136457143,0.262571429,17,53.13,20,62.5,3,37.5,6,75,6,75,5,62.5,11,68.75,9,56.25,68.44,60.12,66,77.38,70.25,70.69,66.19,-9.37,5.94,22.62,-9,2.38,7.75,1.94,9.94,0,0,0,5,0,0,2,3,0,1,2,1,1,1,1,1,1,0,1,0,0,0,1,1,1,3,2,1,4,0,0,0,0,0,0,2,2,3,3,1,1,1.2,1.2,0.6,0.6,2,0,2.2,1,1.2,2,2.33,1,-1,-1,-2,-0.33,10 cents,25 minutes,24 days,Female,High School (or equivalent),29,1.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,-1,4,-1,-3,0,2,-4,1,2,1,1,1,1,-1,-1,-3,-2,-1,0.4,-0.8,1.2,-1.6,-0.2,HS_TS +774,R_76PXZknRmvT7F2p,18 - 24,Canadian,Female,-3,1,-3,3,3,-1,-3,3,0,0,2,1,3,2,3,-2,-2,-1,-2,-3,-3,-3,0,0,-3,6,1,1,1,1,-1,4,0,1,1,3,0,3,0,0,2,1,-1,5,3,1,3,-1,3,9,3,-2,3,-2,0,9,3,1,3,-1,3,6,2,2,2,2,1,8,FALSE,1,100,FALSE,0,62,TRUE,0,85,TRUE,0,74,TRUE,1,90,TRUE,0,76,TRUE,1,70,FALSE,0,55,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,75,FALSE,1,53,TRUE,1,100,TRUE,0,100,TRUE,1,57,FALSE,1,61,FALSE,1,58,TRUE,0,80,TRUE,1,84,FALSE,0,66,FALSE,0,75,0.3025,0.1849,0,0.09,0.5625,0.5776,0,0,0,0.5625,0.0256,1,0,0,0.01,0.3844,0.2209,0.5476,0.1764,1,0,0,0,0,1,0.1521,0.4356,0,0.7225,1,0.64,0,0.322060714,0.277935714,0.366185714,12,37.5,19,59.38,5,62.5,3,37.5,5,62.5,6,75,10,62.5,9,56.25,85.03,82.88,84.25,87.75,85.25,83.38,86.69,-21.88,25.65,20.38,46.75,25.25,10.25,20.88,30.44,0,4,3,3,6,2,4,2,1,1,2,0,2,1,3,2,2,3,3,2,6,0,6,4,0,4,1,0,2,0,1,0,0,3,0,4,4,3,4,4,3.2,2,1.6,2.4,3.2,1.4,0.8,3.8,2.3,2.3,4.33,8,-3,-5,-3,-3,-3.67,5 cents,5 minutes,47 days,Female,University - Undergraduate,20,1,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,-6,4,-3,-1,6,-2,3,2,-1,1,1,0,2,-2,3,-2,-2,0,-1,-2,0,0.6,0.8,-1.4,0,C_Ug +775,R_5rBPsTH1rZzRdio,25 - 31,Canadian,Female,2,3,2,2,3,2,2,2,1,3,2,-2,3,-2,3,2,2,2,2,1,2,3,2,-1,2,5,-1,1,2,3,2,6,3,-2,2,-1,3,2,-2,1,-1,-1,-1,9,2,3,2,2,3,2,3,3,3,-2,3,2,2,-3,3,-2,3,3,2,2,2,2,2,5,TRUE,0,80,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,100,TRUE,1,50,TRUE,1,75,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,FALSE,0,60,FALSE,0,100,TRUE,0,65,TRUE,0,90,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,65,TRUE,1,50,TRUE,0,50,FALSE,1,70,TRUE,0,50,FALSE,0,75,TRUE,1,50,TRUE,1,60,1,0.25,1,0.25,0.16,0.25,0.25,0.0625,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.09,0.4225,0.25,0.36,0.25,0.25,0.4225,0.25,0.25,0.64,0,0.81,0.25,1,0.313571429,0.2525,0.374642857,13,40.63,16,50,4,50,5,62.5,4,50,3,37.5,10,62.5,6,37.5,62.19,51.25,53.12,63.75,80.62,60.62,63.75,-9.37,12.19,1.25,-9.38,13.75,43.12,-1.88,26.25,0,0,0,3,1,3,1,0,2,1,1,0,1,1,0,4,1,3,3,2,0,0,0,0,0,1,1,1,3,0,0,1,0,0,0,0,0,0,0,1,0.8,1.4,0.6,2.6,0,1.2,0.2,0.2,1.35,0.4,4.33,2.33,3,4,-1,4,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,0,3,1,2,0,-1,-1,1,1,-1,1,1,0,4,1,3,3,1,0.8,0.2,0.4,2.4,0.95,C_Ug +776,R_3exVCA64WEpktJn,18 - 24,Canadian,Female,3,3,1,1,2,-2,1,0,-1,2,0,0,2,1,3,-1,1,-1,-1,-1,3,0,3,-2,3,4,-1,3,1,-2,1,4,2,-2,2,3,2,1,1,3,0,2,2,5,3,3,0,3,3,4,-2,1,2,-2,2,3,0,-1,2,1,3,2,1,2,2,1,0,8,TRUE,0,97,TRUE,1,54,FALSE,1,98,FALSE,1,52,TRUE,1,54,FALSE,1,89,TRUE,1,99,TRUE,1,100,TRUE,1,83,TRUE,1,98,FALSE,1,91,FALSE,1,90,TRUE,1,59,TRUE,0,92,TRUE,1,95,TRUE,1,95,FALSE,1,93,TRUE,0,95,FALSE,1,94,FALSE,1,93,TRUE,1,75,TRUE,1,99,FALSE,1,99,TRUE,1,64,FALSE,1,100,TRUE,1,69,FALSE,1,84,TRUE,0,68,TRUE,0,74,FALSE,0,64,TRUE,1,100,TRUE,1,90,0,0.0961,0.0025,0.0001,0.01,0.0121,0.1296,0.0004,0.0049,0.0001,0.4096,0.1681,0.0289,0.0081,0.2116,0.2116,0.0001,0.2304,0.4624,0,0.0625,0.0025,0.0036,0.8464,0.0049,0.0256,0,0.9409,0.0004,0.9025,0.5476,0.01,0.186957143,0.101821429,0.272092857,15,46.88,26,81.25,8,100,7,87.5,5,62.5,6,75,15,93.75,11,68.75,84.59,81.62,79.12,93.62,84,81.12,88.06,-34.37,3.34,-18.38,-8.38,31.12,9,-12.63,19.31,0,3,2,3,1,1,2,1,1,1,2,2,0,2,1,2,2,1,3,3,0,0,1,2,1,0,0,2,1,0,0,1,0,0,0,2,1,3,2,1,1.8,1.2,1.4,2.2,0.8,0.6,0.2,1.8,1.65,0.85,3,3,0,1,-1,-3,0,5 cents,100 minutes,47 days,Female,High School (or equivalent),18,0.375,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,3,1,1,0,1,2,-1,0,1,2,1,0,2,1,0,1,-2,1,2,1,0.6,1.2,0.4,0.8,HS_TS +777,R_7Ecs2WhisNDf65d,39 - 45,American,Male,1,2,-1,2,3,0,0,2,0,1,2,2,3,2,2,0,0,0,0,-1,2,2,0,2,3,9,0,-1,0,0,1,5,2,3,2,2,2,4,0,-1,-1,-1,-1,4,1,2,0,2,3,8,0,-1,1,-2,2,4,2,2,2,2,2,3,1,1,1,1,0,5,TRUE,0,53,FALSE,0,100,FALSE,1,100,FALSE,1,78,TRUE,1,54,FALSE,1,99,TRUE,1,97,TRUE,1,92,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,83,TRUE,1,78,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,81,TRUE,1,100,FALSE,1,90,FALSE,1,100,FALSE,1,54,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.0064,0,0,0.0009,0,0.0001,0,0,0,0.2116,0,0.0484,0,0.04,0.2116,1,0,0.0484,0,0.0361,0,1,0.2025,1,0,0.01,0.0625,0.2809,0,0,0.2116,0.6889,0.18045,0.111435714,0.249464286,27,84.38,27,84.38,6,75,8,100,6,75,7,87.5,14,87.5,13,81.25,88.22,84.75,85.62,85.62,96.88,90.62,85.81,0,3.84,9.75,-14.38,10.62,9.38,3.12,4.56,1,0,1,0,0,0,1,2,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,1,1,2,1,0,0,1,0,0,1,1,1,1,1,0.4,0.6,0.4,0.6,0.2,1,0.2,1,0.5,0.6,6,5,1,1,1,-1,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),42,0,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,1,0,0,0,0,0,0,1,-2,-1,0,1,0,0,0,-1,0,0,0,-1,0.2,-0.4,0.2,-0.4,-0.1,HS_TS +778,R_5H1xr9LBPdaX84h,18 - 24,Canadian,Male,1,-3,2,1,0,-2,-3,2,1,2,1,-1,3,-3,2,1,-1,-1,-2,3,2,3,3,3,2,5,3,3,-3,3,3,10,-3,2,-2,1,-3,10,2,-2,2,2,-3,10,1,-3,2,2,2,2,1,-3,3,-3,1,2,2,-1,1,-3,1,2,2,1,2,2,3,10,TRUE,0,100,TRUE,1,80,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,80,TRUE,1,95,TRUE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,50,TRUE,0,90,FALSE,0,95,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,92,TRUE,0,90,FALSE,1,62,FALSE,1,75,TRUE,1,90,TRUE,1,100,TRUE,0,50,TRUE,1,99,TRUE,0,90,TRUE,1,85,TRUE,0,50,FALSE,1,100,FALSE,1,95,TRUE,1,85,TRUE,1,65,TRUE,1,100,0,0.0225,0,0.0025,0,0.04,0.0001,0.0025,0.0625,0,0.0225,0.9025,0.25,0.25,0.25,0.04,0.25,0.25,0,0.81,0.01,0.25,0.1444,0,0.8464,0.25,0.1225,1,0,0.81,0.0025,0.81,0.263425,0.165721429,0.361128571,22,68.75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,15,93.75,7,43.75,81.66,57.12,81.5,94.38,93.62,83.69,79.62,0,12.91,-5.38,19,31.88,6.12,-10.06,35.87,1,6,1,2,2,5,6,5,2,1,4,3,5,4,5,1,1,3,4,6,0,0,0,1,2,3,0,1,4,1,1,0,2,0,1,1,2,3,4,0,2.4,3.8,4.2,3,0.6,1.8,0.8,2,3.35,1.3,8.33,2,3,8,8,0,6.33,10 cents,100 minutes,47 days,Male,High School (or equivalent),21,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,1,6,1,1,0,2,6,4,-2,0,3,3,3,4,4,0,-1,0,0,6,1.8,2,3.4,1,2.05,HS_TS +779,R_5mkDxdKw1vi4gyK,39 - 45,American,Male,2,1,2,0,1,-2,-2,0,1,-1,2,3,1,0,2,1,1,-1,1,-1,2,1,2,-2,-1,4,-3,-2,-1,1,-2,5,2,3,0,0,0,2,1,-1,-2,-2,-3,5,2,1,2,2,1,2,-2,-2,1,0,-1,2,2,3,2,0,2,2,2,2,1,1,-1,3,FALSE,1,100,TRUE,1,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,75,FALSE,1,100,TRUE,1,72,TRUE,1,100,FALSE,1,51,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,FALSE,1,66,TRUE,1,100,TRUE,1,95,TRUE,1,97,0,0,0,0,0.0009,0,0.0064,0,0,0,0,0,0,0.2209,0,0.0081,0.2401,0,0,0,0.0784,0,0.5625,0,0.81,0.7744,0.0025,0,0,1,0.1156,0,0.136421429,0.034028571,0.238814286,27,84.38,28,87.5,6,75,7,87.5,7,87.5,8,100,16,100,12,75,92.81,87.75,84.5,100,99,96.69,88.94,-3.12,5.31,12.75,-3,12.5,-1,-3.31,13.94,0,0,0,2,2,1,0,1,0,1,0,0,1,0,2,0,2,1,3,2,0,0,0,2,0,0,0,1,1,0,0,0,1,0,0,1,1,2,0,0,0.8,0.6,0.6,1.6,0.4,0.4,0.2,0.8,0.9,0.45,3.67,2,2,3,0,2,1.67,10 cents,5 minutes,15 days,Male,University - Undergraduate,44,0.875,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,2,1,0,0,-1,1,0,0,0,0,2,-1,1,-1,3,2,0.4,0.2,0.4,0.8,0.45,C_Ug +780,R_3uOaBsaam5UC3KN,25 - 31,Canadian,Male,2,-3,-1,0,2,0,-3,2,-3,1,2,2,2,1,1,0,1,2,1,0,2,2,-1,-1,2,8,0,-3,1,-2,0,9,2,2,2,1,1,7,1,1,1,2,-1,7,2,-3,1,0,1,7,1,-1,2,-1,0,6,2,2,0,0,1,6,1,1,1,1,1,8,TRUE,0,100,TRUE,1,64,TRUE,0,100,FALSE,1,61,FALSE,0,66,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,69,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,66,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,59,FALSE,0,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,65,TRUE,0,100,TRUE,0,90,FALSE,0,100,FALSE,0,61,TRUE,1,100,0,0,0,0,0,0,0,0,0.1681,0,1,0,0.4761,0.1849,0.4356,0.1296,0,0.1521,1,1,0.5776,0.1156,1,0.0625,1,0.1225,0.3721,1,1,1,0.81,1,0.450239286,0.181885714,0.718592857,26,81.25,18,56.25,5,62.5,4,50,5,62.5,4,50,11,68.75,7,43.75,87.78,67.88,91.5,96.88,94.88,87.62,87.94,25,31.53,5.38,41.5,34.38,44.88,18.87,44.19,0,5,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,1,0,0,2,0,1,1,2,0,2,1,0,0,2,1,0,1,0,1,0,1,1.2,0.6,0,0.8,0.6,1.2,0.6,0.6,0.65,0.75,8,6.33,1,3,1,-1,1.67,5 cents,25 minutes,36 days,Male,University - Graduate (Masters),29,0,1,0,0,0,0,0,0.33,0,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,5,-2,1,-1,-1,-2,1,-1,0,0,0,-2,-1,0,0,0,0,1,0,0.6,-0.6,-0.6,0.2,-0.1,grad_prof +781,R_6cUDOClbgaba5re,39 - 45,American,Male,3,3,1,-1,2,0,-1,3,0,3,-3,-3,3,-2,3,-2,-2,-2,-2,-3,0,3,2,2,1,5,2,-1,3,-3,0,9,1,-2,1,1,3,8,-1,-1,0,-3,-1,5,3,3,-2,1,-2,5,-3,0,3,0,1,5,-3,-2,-1,0,3,5,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,74,FALSE,1,100,FALSE,0,86,TRUE,1,83,TRUE,1,100,TRUE,1,70,FALSE,1,100,TRUE,0,75,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,88,FALSE,1,100,FALSE,1,76,TRUE,0,87,FALSE,1,100,TRUE,1,100,TRUE,1,83,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,76,TRUE,0,76,FALSE,1,100,FALSE,1,100,TRUE,1,87,FALSE,0,100,TRUE,1,100,0.0289,0.5776,0.0144,0.7396,0,0,1,0.09,0,0.0289,0.0169,0.0081,0,0,0.0676,0,0,0.25,0,0,0,0,0.7569,0,0,0.5776,1,0,1,0.0576,0,0.5625,0.193432143,0.104392857,0.282471429,22,68.75,24,75,5,62.5,8,100,6,75,5,62.5,12,75,12,75,90.69,89.12,95.62,86.38,91.62,89.88,91.5,-6.25,15.69,26.62,-4.38,11.38,29.12,14.88,16.5,3,0,1,3,1,2,0,0,3,3,4,1,2,3,0,1,1,2,1,2,0,0,3,2,4,3,1,0,0,2,0,1,4,2,0,1,1,1,1,0,1.6,1.6,2,1.4,1.8,1.2,1.4,0.8,1.65,1.3,7.33,5,0,4,3,0,2.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,45,1.625,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,3,0,-2,1,-3,-1,-1,0,3,1,4,0,-2,1,0,0,0,1,0,2,-0.2,0.4,0.6,0.6,0.35,C_Ug +782,R_3xs0n15eFOtlXix,25 - 31,Canadian,Male,1,3,-2,3,3,-1,1,-1,1,2,1,-3,3,-1,2,-2,1,0,-1,-3,1,3,1,3,3,3,0,2,-3,3,3,5,-1,0,3,2,-1,3,3,3,2,2,-2,6,0,3,-2,3,3,2,1,-1,1,-1,3,4,1,-3,3,-2,3,4,2,2,2,3,-2,6,TRUE,0,70,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,54,TRUE,1,55,TRUE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,86,TRUE,0,70,TRUE,1,64,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,57,TRUE,0,100,TRUE,0,79,FALSE,1,50,TRUE,1,90,TRUE,1,90,FALSE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,0,50,FALSE,1,100,FALSE,1,82,TRUE,1,60,TRUE,1,100,TRUE,1,63,0,0.0049,0,0.2025,0.1369,0.2116,0,0.01,0.25,0.01,0.16,0.1296,0.01,0.0196,0,0,0.09,0.25,0,0,0.01,0.09,0.6241,0,0.3249,0.25,0,0.49,0.04,1,0.0324,0.49,0.165325,0.091264286,0.239385714,17,53.13,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,80.09,78.12,72.5,87.25,82.5,85.31,74.88,-28.12,-1.16,3.12,-15,12.25,-5,-14.69,12.38,0,0,3,0,0,1,1,2,2,1,2,3,0,3,3,5,2,2,3,1,1,0,0,0,0,2,2,2,2,1,0,0,0,1,1,4,1,2,4,1,0.6,1.4,2.2,2.6,0.2,1.8,0.4,2.4,1.7,1.2,3.67,3.33,1,1,-1,0,0.34,5 cents,5 minutes,47 days,Male,High School (or equivalent),27,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,-1,0,3,0,0,-1,-1,0,0,0,2,3,0,2,2,1,1,0,-1,0,0.4,-0.4,1.8,0.2,0.5,HS_TS +783,R_7c7xaPs4lZKH7zH,32 - 38,American,Male,2,3,3,2,3,2,-1,-2,-2,2,1,2,2,1,3,1,1,1,2,-1,2,3,3,2,3,5,1,-1,1,-1,2,5,1,2,2,1,2,5,0,1,1,2,1,5,2,2,3,2,3,5,2,-1,2,-1,2,5,1,2,2,1,2,5,1,2,2,2,1,5,FALSE,1,88,FALSE,0,76,TRUE,0,89,FALSE,1,61,TRUE,1,87,FALSE,1,64,FALSE,0,73,TRUE,1,99,TRUE,1,75,TRUE,1,73,FALSE,1,80,FALSE,1,80,TRUE,1,71,TRUE,0,84,FALSE,0,69,TRUE,1,95,TRUE,0,67,TRUE,0,93,FALSE,1,82,FALSE,1,88,FALSE,0,84,TRUE,1,82,FALSE,1,71,TRUE,1,97,FALSE,1,97,TRUE,1,89,FALSE,1,57,TRUE,0,62,TRUE,0,94,TRUE,1,69,FALSE,0,94,TRUE,1,80,0.0001,0.0121,0.0025,0.5329,0.04,0.1296,0.0009,0.0729,0.0144,0.0324,0.0961,0.0841,0.0625,0.04,0.0169,0.5776,0.0841,0.1521,0.3844,0.0009,0.7056,0.4761,0.0324,0.7056,0.4489,0.1849,0.8836,0.0144,0.7921,0.8649,0.8836,0.04,0.279321429,0.100257143,0.458385714,23,71.88,21,65.63,5,62.5,5,62.5,5,62.5,6,75,11,68.75,10,62.5,80.31,74.25,77.25,84.88,84.88,82.06,78.56,6.25,14.68,11.75,14.75,22.38,9.88,13.31,16.06,0,0,0,0,0,1,0,3,1,0,0,0,0,0,1,1,0,0,0,2,0,1,0,0,0,0,0,4,1,0,0,0,0,0,1,0,1,1,0,2,0,1,0.2,0.6,0.2,1,0.2,0.8,0.45,0.55,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,32,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-1,0,0,0,1,0,-1,0,0,0,0,0,0,0,1,-1,-1,0,0,-0.2,0,0,-0.2,-0.1,C_Ug +784,R_3opUSXehbAHNJwG,18 - 24,Canadian,Male,-2,3,0,2,2,2,1,2,0,1,0,0,2,1,1,-1,-1,-2,1,0,-3,2,2,0,1,6,2,1,0,1,2,6,0,0,1,-1,1,6,-3,0,0,-2,-3,8,0,3,0,0,3,5,3,0,3,-1,3,5,1,1,1,1,2,6,1,2,1,3,0,6,FALSE,1,63,FALSE,0,67,TRUE,0,96,FALSE,1,63,TRUE,1,77,TRUE,0,75,TRUE,1,100,TRUE,1,100,FALSE,0,62,FALSE,0,60,FALSE,1,64,TRUE,0,100,TRUE,1,72,FALSE,1,56,TRUE,1,60,FALSE,0,60,TRUE,0,94,TRUE,0,73,FALSE,1,57,FALSE,1,55,FALSE,0,58,TRUE,1,78,FALSE,1,53,TRUE,1,88,FALSE,1,54,TRUE,1,61,TRUE,0,69,TRUE,0,100,TRUE,0,60,TRUE,1,74,FALSE,0,53,FALSE,0,53,0,0.1521,0.36,0,0.2809,0.5625,0.0144,0.36,0.2025,0.0484,0.0676,0.0784,0.3844,0.1296,0.0529,0.4489,0.2209,0.1369,1,0.2116,0.3364,0.16,0.1849,0.1936,0.8836,0.4761,0.2809,0.1369,0.9216,0.5329,0.36,1,0.345242857,0.21345,0.477035714,5,15.63,17,53.13,4,50,3,37.5,6,75,4,50,9,56.25,8,50,70.47,61.88,67.75,68.12,84.12,70.19,70.75,-37.5,17.34,11.88,30.25,-6.88,34.12,13.94,20.75,1,1,2,2,1,0,0,2,1,1,0,0,1,2,0,2,1,2,3,3,2,0,0,2,1,1,1,1,1,2,1,1,1,0,1,2,3,3,2,0,1.4,0.8,0.6,2.2,1,1.2,0.8,2,1.25,1.25,6,5.33,1,1,0,2,0.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),22,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,1,2,0,0,-1,-1,1,0,-1,-1,-1,0,2,-1,0,-2,-1,1,3,0.4,-0.4,-0.2,0.2,0,HS_TS +785,R_6GITWb0bS6KmYsZ,18 - 24,Canadian,Male,-1,3,1,1,3,-1,-3,1,0,3,-3,-3,3,-1,2,-1,1,1,-1,1,-3,2,3,1,2,7,-1,-1,-2,1,-1,9,3,-3,0,-2,3,10,3,3,3,3,3,10,1,3,1,1,3,1,-1,-3,2,-2,3,3,-2,-3,3,-2,3,3,1,1,1,0,2,6,FALSE,1,96,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,63,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,60,FALSE,1,59,FALSE,1,75,TRUE,1,100,TRUE,0,100,TRUE,1,87,TRUE,1,100,FALSE,1,76,FALSE,1,94,FALSE,1,91,FALSE,1,50,TRUE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,90,FALSE,1,95,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,97,FALSE,0,55,FALSE,0,50,TRUE,1,90,0,0,0,0,0.01,0.1369,0.01,0.16,0.25,0.0081,0.3025,0,0.0196,0.1681,0,0.0081,0,0.25,0,0.0025,0,0.0169,0.0081,1,0.0576,0.25,0.25,0.0016,0,0.0036,0.9409,0.0625,0.139892857,0.094521429,0.185264286,25,78.13,27,84.38,6,75,7,87.5,7,87.5,7,87.5,14,87.5,13,81.25,84.25,70.5,90.75,92,83.75,87.5,81,-6.25,-0.13,-4.5,3.25,4.5,-3.75,0,-0.25,2,1,2,0,1,0,2,3,1,4,6,0,3,1,1,4,2,2,4,2,2,0,0,0,0,0,0,1,2,0,1,0,0,1,1,2,0,0,1,1,1.2,2,2.2,2.8,0.4,0.6,0.6,0.8,2.05,0.6,8.67,2.33,6,6,7,4,6.34,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,1,2,0,1,0,2,2,-1,4,5,0,3,0,0,2,2,2,3,1,0.8,1.4,1.6,2,1.45,C_Ug +786,R_5DO6PvIpItaY44V,18 - 24,Canadian,Female,1,3,3,3,2,1,1,-1,3,1,0,-1,1,1,2,-3,-1,-3,-2,-3,3,2,2,1,-1,4,1,-1,1,1,-1,5,1,1,-1,2,1,4,0,1,1,2,1,4,2,3,3,3,2,3,1,0,1,0,1,3,0,-2,2,1,3,3,2,1,2,1,-1,6,TRUE,0,57,TRUE,1,69,TRUE,0,72,FALSE,1,50,TRUE,1,50,FALSE,1,81,TRUE,1,100,TRUE,1,100,TRUE,1,62,TRUE,1,87,FALSE,1,50,TRUE,0,74,TRUE,1,98,FALSE,1,50,TRUE,1,75,TRUE,1,81,TRUE,0,59,TRUE,0,96,TRUE,0,50,TRUE,0,50,TRUE,1,84,TRUE,1,72,FALSE,1,67,TRUE,1,65,TRUE,0,50,TRUE,1,92,TRUE,0,50,FALSE,1,58,TRUE,0,50,TRUE,1,76,TRUE,1,50,TRUE,1,82,0,0.0064,0.0361,0,0.0324,0.0361,0.1225,0.0169,0.25,0.0784,0.0576,0.0004,0.1444,0.25,0.25,0.0961,0.1089,0.25,0.1764,0.25,0.0256,0.0625,0.25,0.25,0.3481,0.25,0.25,0.3249,0.5184,0.9216,0.25,0.5476,0.218528571,0.120978571,0.316078571,13,40.63,22,68.75,6,75,6,75,5,62.5,5,62.5,16,100,6,37.5,68.97,57,71.38,75.5,72,77.69,60.25,-28.12,0.22,-18,-3.62,13,9.5,-22.31,22.75,2,1,1,2,3,0,2,2,2,2,1,2,2,1,1,3,2,4,4,4,1,0,0,0,0,0,1,2,3,0,0,1,1,0,1,5,2,5,3,2,1.8,1.6,1.4,3.4,0.2,1.2,0.6,3.4,2.05,1.35,4.33,3,1,2,1,-2,1.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),21,1.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,1,1,2,3,0,1,0,-1,2,1,1,1,1,0,-2,0,-1,1,2,1.6,0.4,0.8,0,0.7,HS_TS +787,R_1mb2WqGSgK3tz69,39 - 45,American,Male,2,2,2,-2,2,0,0,2,-1,2,1,0,2,-2,3,2,1,2,2,-1,2,2,2,-2,2,2,0,0,2,-1,2,2,0,0,2,-2,3,3,1,-1,1,0,-2,5,2,2,2,-2,2,1,0,0,2,-2,0,3,0,-1,2,-3,3,4,2,2,2,2,2,2,FALSE,1,70,TRUE,1,96,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,82,TRUE,1,58,TRUE,1,91,TRUE,1,82,FALSE,1,50,TRUE,0,71,TRUE,1,100,TRUE,0,60,TRUE,1,50,TRUE,1,60,TRUE,0,60,TRUE,0,91,TRUE,0,50,FALSE,1,92,FALSE,0,50,TRUE,1,71,FALSE,1,91,TRUE,1,82,TRUE,0,60,TRUE,1,60,TRUE,0,50,FALSE,1,81,FALSE,1,60,TRUE,1,60,FALSE,0,50,TRUE,1,100,0.1764,0.16,0.16,0.0324,0,0.25,0.0324,0.0324,0.0064,0.0841,0.16,0,0.0081,0.25,0.25,0.0016,0.0081,0.25,0.0361,0.36,0.25,0.25,0.25,0.36,0.36,0.25,0.25,0.09,0.25,0.8281,0.16,0.5041,0.19755,0.095221429,0.299878571,22,68.75,23,71.88,5,62.5,6,75,5,62.5,7,87.5,14,87.5,9,56.25,68.06,60.88,70.12,72,69.25,71.38,64.75,-3.13,-3.82,-1.62,-4.88,9.5,-18.25,-16.12,8.5,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,2,1,2,1,0,0,0,0,0,0,0,0,1,2,1,1,0,1,0,0,1,0,0,3,0,0,0.2,1.4,0,0.6,0.6,0.8,0.4,0.5,2.33,2.67,1,-1,-1,3,-0.34,5 cents,5 minutes,47 days,Male,University - Undergraduate,41,1.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,-1,-2,0,-1,0,-1,0,1,1,1,2,-2,0,-0.6,-0.4,0.6,-0.1,C_Ug +788,R_7LtcDJJsu3A12Iz,32 - 38,American,Male,3,3,2,3,2,2,3,3,3,2,2,3,3,3,2,2,3,3,3,2,3,2,3,3,2,10,3,3,3,2,2,9,3,3,3,2,2,9,3,2,3,3,2,9,3,3,3,2,2,9,3,2,2,3,3,9,3,3,2,2,3,9,3,3,2,2,3,9,TRUE,0,83,FALSE,0,91,TRUE,0,72,TRUE,0,89,TRUE,1,95,TRUE,0,88,TRUE,1,91,TRUE,1,99,TRUE,1,92,FALSE,0,81,TRUE,0,89,TRUE,0,78,TRUE,1,96,TRUE,0,83,FALSE,0,86,TRUE,1,95,TRUE,0,85,TRUE,0,94,TRUE,0,81,FALSE,1,88,TRUE,1,97,TRUE,1,93,FALSE,1,81,FALSE,0,90,FALSE,1,90,TRUE,1,95,TRUE,0,92,TRUE,0,89,TRUE,0,89,TRUE,1,97,TRUE,1,87,TRUE,1,88,0.0001,0.0025,0.0025,0.0081,0.0144,0.7744,0.81,0.6561,0.0144,0.0049,0.0009,0.0016,0.0064,0.7921,0.0025,0.8281,0.0361,0.7921,0.7921,0.01,0.0009,0.7396,0.6561,0.6889,0.7225,0.8464,0.0169,0.6889,0.5184,0.8836,0.7921,0.6084,0.453528571,0.338142857,0.568914286,27,84.38,15,46.88,2,25,5,62.5,4,50,4,50,12,75,3,18.75,88.88,88.38,89.88,88.75,88.5,92.06,85.69,37.5,42,63.38,27.38,38.75,38.5,17.06,66.94,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,1,0.4,0.4,0.4,0.4,0.4,0.8,0.8,0.8,0.4,0.7,9.33,9,1,0,0,0,0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,1,0,-1,0,0,-1,-1,1,-1,0,0,-1,0,-1,0,1,-1,-1,-1,0,-0.4,-0.4,-0.4,-0.3,C_Ug +789,R_1qvpvPkUq3A7QHL,25 - 31,American,Male,2,2,3,-3,0,-3,-2,2,-2,1,2,1,3,-2,3,-2,1,2,1,1,1,2,3,-3,0,5,-3,-3,1,-1,2,3,3,2,3,-3,3,0,-3,-3,-3,-3,-3,10,2,2,3,-3,0,2,-3,-3,3,-3,3,0,3,3,3,-2,3,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,89,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,68,FALSE,1,50,FALSE,1,100,TRUE,1,77,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,88,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,1,76,0,0,0,0,0.0576,0.0121,0,0.1024,0,0.0144,1,0.0529,0.25,0.25,0.25,0.25,0,0.25,0,0,0.5625,0.25,0.25,0,0.25,0.25,0,1,1,1,0.25,0,0.260782143,0.177814286,0.34375,20,62.5,24,75,6,75,6,75,6,75,6,75,11,68.75,13,81.25,80.41,56.25,70.88,94.5,100,80.25,80.56,-12.5,5.41,-18.75,-4.12,19.5,25,11.5,-0.69,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,4,5,4,4,0,0,0,0,0,0,1,1,1,2,1,2,0,0,0,4,1,0,1,1,0.2,0.8,0.6,3.6,0,1,0.6,1.4,1.3,0.75,2.67,1.33,3,3,-2,8,1.34,10 cents,5 minutes,24 days,Male,High School (or equivalent),30,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,0,0,0,0,0,0,0,0,-1,0,-1,0,1,0,-3,3,5,3,3,0.2,-0.2,0,2.2,0.55,HS_TS +790,R_1LHZwuv3ArwDt97,18 - 24,American,Male,-3,3,-3,0,-3,-3,0,0,1,0,-1,-1,3,0,3,0,0,0,-1,-3,0,3,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,5,TRUE,0,50,TRUE,1,50,TRUE,0,70,FALSE,1,55,TRUE,1,68,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,75,FALSE,1,84,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,55,FALSE,1,50,FALSE,1,65,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,64,FALSE,0,50,TRUE,1,56,0.25,0.25,0.25,0.25,0.1936,0.25,0.0841,0.5625,0.1225,0.25,0.1296,0.25,0.25,0.0256,0.1024,0.25,0,0.2025,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.49,0.3025,0.25,1,0.248760714,0.190914286,0.306607143,2,6.25,20,62.5,6,75,4,50,5,62.5,5,62.5,10,62.5,10,62.5,59.78,54.88,59.25,60,65,55.25,64.31,-56.25,-2.72,-20.12,9.25,-2.5,2.5,-7.25,1.81,3,0,3,0,3,3,0,0,1,0,1,1,3,0,3,0,0,0,1,3,3,3,3,0,3,3,0,0,1,0,1,1,3,0,3,0,0,0,1,3,1.8,0.8,1.6,0.8,2.4,0.8,1.6,0.8,1.25,1.4,4.33,4.67,0,0,-1,0,-0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,19,0.75,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.6,0,0,0,-0.15,C_Ug +791,R_3O3zMA225SHV2Kb,32 - 38,American,Male,1,-2,0,-2,-3,-2,-1,1,-2,-1,-1,1,0,-2,2,0,-1,1,1,-2,2,-2,1,-2,-3,2,-2,-2,-1,-2,-2,2,-1,2,0,-2,1,2,-2,-2,-2,-2,-2,5,1,-1,1,-2,-3,2,-3,-2,2,-2,-2,2,-1,2,1,-2,2,2,-1,-1,-1,-1,-2,2,FALSE,1,91,FALSE,0,70,FALSE,1,65,FALSE,1,52,TRUE,1,51,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,80,FALSE,1,76,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,52,TRUE,0,90,FALSE,1,82,FALSE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,80,TRUE,1,75,TRUE,1,76,TRUE,1,100,0,0,0,0,0,0,0,0.04,0,0,0.0625,0,0.0841,0.0576,0.2401,0.49,0,0.2304,0,0,0.09,0.25,0.0324,0,0.2704,0.25,0.0576,0.0081,0.1225,0.81,0.64,0,0.133417857,0.08605,0.180785714,20,62.5,27,84.38,6,75,6,75,7,87.5,8,100,15,93.75,12,75,83.78,65.88,81.62,95.12,92.5,83.94,83.62,-21.88,-0.6,-9.12,6.62,7.62,-7.5,-9.81,8.62,1,0,1,0,0,0,1,2,0,1,0,1,0,0,1,2,1,3,3,0,0,1,1,0,0,1,1,1,0,1,0,1,1,0,0,1,0,2,2,0,0.4,0.8,0.4,1.8,0.4,0.8,0.4,1,0.85,0.65,2,2,0,0,0,3,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),38,0.75,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,-1,0,0,0,-1,0,1,0,0,0,0,-1,0,1,1,1,1,1,0,0,0,0,0.8,0.2,HS_TS +792,R_1ZO4Z0bMP1CCwKt,18 - 24,Canadian,Female,-1,2,1,-1,1,2,0,1,-2,3,2,1,2,2,3,0,2,1,1,0,1,1,0,1,1,6,0,0,-1,-1,-2,8,0,0,0,-1,1,6,-1,1,1,1,1,6,1,1,1,1,1,7,1,0,1,1,1,7,1,1,1,0,0,5,2,1,2,1,2,7,TRUE,0,64,FALSE,0,59,TRUE,0,100,TRUE,0,75,TRUE,1,75,FALSE,1,56,TRUE,1,76,FALSE,0,56,FALSE,0,59,TRUE,1,78,FALSE,1,62,TRUE,0,100,FALSE,0,61,FALSE,1,64,TRUE,1,100,FALSE,0,57,TRUE,0,60,TRUE,0,80,FALSE,1,60,FALSE,1,70,FALSE,0,100,FALSE,0,60,TRUE,0,55,TRUE,1,59,TRUE,0,82,TRUE,1,90,FALSE,1,59,TRUE,0,93,TRUE,0,80,TRUE,1,100,FALSE,0,53,FALSE,0,53,0.3136,0.01,0.3249,0.0576,0.2809,0.1936,0.1681,0.0484,0.09,0.36,0,0.3721,0.3481,0.1444,0.0625,0.3481,0.3025,0.5625,0.8649,0.6724,1,0,0.16,0.1296,0.36,0.1681,0.2809,0.4096,1,0.64,0.64,1,0.378810714,0.234371429,0.52325,16,50,13,40.63,4,50,2,25,4,50,3,37.5,7,43.75,6,37.5,71.75,65.88,67.5,74.25,79.38,71,72.5,9.37,31.12,15.88,42.5,24.25,41.88,27.25,35,2,1,1,2,0,2,0,2,1,5,2,1,2,3,2,1,1,0,0,1,2,1,0,2,0,1,0,0,3,2,1,0,1,2,3,2,1,1,0,2,1.2,2,2,0.6,1,1.2,1.4,1.2,1.45,1.2,6.67,6.33,-1,1,1,-1,0.34,10 cents,75 minutes,47 days,Female,University - Undergraduate,20,0,0,0,1,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,1,0,0,1,0,2,-2,3,1,1,1,1,-1,-1,0,-1,0,-1,0.2,0.8,0.6,-0.6,0.25,C_Ug +793,R_3ht32nKfhP8a70Z,39 - 45,American,Male,2,2,2,2,2,2,0,3,-3,2,2,0,0,0,2,1,2,2,2,0,2,2,2,2,2,1,2,0,2,-2,2,5,2,2,0,0,2,0,2,0,2,2,2,5,2,2,2,2,2,2,2,0,2,-2,2,2,2,2,0,0,2,2,2,2,2,1,0,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,81,FALSE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0.0361,1,1,1,0.0676,0.09,1,1,0,0.0484,1,0.330075,0.142857143,0.517292857,26,81.25,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,96.97,90.62,97.25,100,100,96.94,97,12.5,28.22,28.12,22.25,25,37.5,9.44,47,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,1,2,0,0,2,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,1,0,0,1,0,0,0.4,0.4,1,0,0.4,0.4,0.4,0.45,0.3,2,2,-1,3,-2,3,0,10 cents,5 minutes,15 days,Male,High School (or equivalent),43,1.25,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,-1,2,0,0,0,0.6,0.15,HS_TS +794,R_6KvJr2tX3MpsurF,39 - 45,American,Male,1,3,3,3,3,2,-2,2,-2,2,2,2,2,2,2,3,3,3,3,3,1,3,3,3,3,5,2,-1,2,-2,2,5,2,2,1,2,2,5,3,3,2,3,3,5,1,3,3,3,3,3,2,-2,2,-2,2,5,2,2,2,2,2,5,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.6561,0,1,1,0,0,0,0,0.0256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.095775,0.19155,0,29,90.63,29,90.63,8,100,7,87.5,8,100,6,75,14,87.5,15,93.75,98.91,100,98,100,97.62,100,97.81,0,8.28,0,10.5,0,22.62,12.5,4.06,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0.2,0,0,0,0,0.15,0,5,4.33,2,0,0,0,0.67,5 cents,5 minutes,47 days,Male,University - PhD,39,0,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0.2,0.2,0.2,0.15,grad_prof +795,R_1CTlUoqH71ssoqs,32 - 38,American,Male,3,3,2,3,2,3,2,3,3,3,2,3,2,3,3,2,3,3,3,3,2,2,3,3,3,9,2,2,3,3,3,10,3,3,3,2,3,10,2,3,3,2,3,10,2,3,2,2,2,10,3,3,2,2,2,8,2,2,3,3,3,10,2,3,2,3,3,10,TRUE,0,100,TRUE,1,91,FALSE,1,94,FALSE,1,89,FALSE,0,82,TRUE,0,98,FALSE,0,98,TRUE,1,91,TRUE,1,92,TRUE,1,92,FALSE,1,100,FALSE,1,96,FALSE,0,82,TRUE,0,84,TRUE,1,100,TRUE,1,82,TRUE,0,100,TRUE,0,87,TRUE,0,92,FALSE,1,82,FALSE,0,80,FALSE,0,92,FALSE,1,100,TRUE,1,83,TRUE,0,87,FALSE,0,92,FALSE,1,97,FALSE,1,88,TRUE,0,81,TRUE,1,81,TRUE,1,81,TRUE,1,100,0.0081,0.8464,0.0324,0.9604,0,0.9604,0.0289,0.0064,0.0324,0.8464,0.0361,0.6724,0.0064,0,0.6724,0.0081,0,0.0121,0.0144,0.7569,0.64,0,0.8464,0.7056,1,0.0009,0.0361,1,0.0036,0.7569,0.6561,0.0016,0.346446429,0.234428571,0.458464286,18,56.25,18,56.25,7,87.5,2,25,1,12.5,8,100,10,62.5,8,50,90.44,92.75,90.38,91.5,87.12,88.69,92.19,0,34.19,5.25,65.38,79,-12.88,26.19,42.19,1,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,1,0,0,0,0,1,0,0,0.8,0.2,0.6,0.2,0.4,0.8,0.4,0.2,0.45,0.45,9.67,9.33,-1,2,0,0,0.34,10 cents,100 minutes,24 days,Male,University - PhD,35,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,1,1,-1,1,1,-1,-1,-1,-1,1,-1,0,1,0,0,0,-1,1,0,0.4,-0.6,0.2,0,0,grad_prof +796,R_3rTYmI54D4bgnwY,25 - 31,Canadian,Female,-1,2,1,0,2,1,0,-2,2,1,0,1,0,1,1,0,1,1,1,-1,2,1,0,3,1,7,1,2,3,1,1,7,0,-2,1,0,-1,6,0,1,1,0,2,6,2,1,2,1,2,7,1,2,1,2,0,7,-1,2,0,0,1,7,1,1,1,0,1,7,TRUE,0,87,FALSE,0,73,TRUE,0,87,FALSE,1,75,FALSE,0,78,FALSE,1,79,FALSE,0,73,TRUE,1,76,FALSE,0,72,TRUE,1,82,FALSE,1,78,TRUE,0,100,FALSE,0,73,FALSE,1,84,TRUE,1,90,FALSE,0,86,FALSE,1,65,TRUE,0,81,FALSE,1,84,FALSE,1,86,TRUE,1,100,FALSE,0,82,TRUE,0,79,FALSE,0,94,FALSE,1,72,FALSE,0,85,FALSE,1,85,FALSE,1,79,FALSE,1,78,TRUE,1,83,FALSE,0,78,FALSE,0,64,0.0576,0.7225,0.7396,0.5329,0.4096,0.0441,0.8836,0.0324,0.0196,0.6724,0.0289,0.5329,0.5184,0.0484,0.6084,0.5329,0.6241,0.0625,0.0441,0.0784,0,0.01,0.0256,0.0256,0.1225,0.0225,0.6084,0.7569,0.7569,0.6561,0.0484,1,0.327628571,0.358442857,0.296814286,20,62.5,16,50,5,62.5,4,50,3,37.5,4,50,5,31.25,11,68.75,80.88,79.38,77,80.75,86.38,80.56,81.19,12.5,30.88,16.88,27,43.25,36.38,49.31,12.44,3,1,1,3,1,0,2,5,1,0,0,3,1,1,2,0,0,0,1,3,3,1,1,1,0,0,2,3,0,1,1,1,0,1,0,1,0,0,1,2,1.8,1.6,1.4,0.8,1.2,1.2,0.6,0.8,1.4,0.95,6.67,7,0,0,-1,-1,-0.33,5 cents,5 minutes,47 days,Female,University - Undergraduate,26,-0.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,2,1,0,0,2,1,-1,-1,2,1,0,2,-1,0,0,0,1,0.6,0.4,0.8,0,0.45,C_Ug +797,R_5Bo1X3nIGzcQF1q,25 - 31,Canadian,Female,2,3,3,1,2,-3,-2,3,0,0,2,-2,2,-2,3,-1,-1,0,0,-2,1,3,3,-1,1,6,-3,-3,3,0,-2,1,2,-3,2,-2,3,2,-1,1,1,0,1,7,3,3,3,2,2,3,-2,-2,3,0,-1,4,2,-3,3,-3,3,3,-2,-2,0,0,-2,7,TRUE,0,79,FALSE,0,50,TRUE,0,62,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,93,TRUE,1,50,TRUE,1,63,FALSE,1,50,FALSE,1,57,TRUE,1,55,FALSE,1,50,TRUE,1,62,TRUE,1,59,TRUE,0,66,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,56,TRUE,1,69,FALSE,1,50,TRUE,1,92,TRUE,0,59,TRUE,1,80,FALSE,1,50,FALSE,1,74,TRUE,0,50,TRUE,1,80,TRUE,1,50,TRUE,1,51,0.0049,0.04,0.1681,0.25,0.2401,0.25,0.0064,0.1369,0.25,0.0961,0.04,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.0676,0.3481,0.1936,0.1444,0.25,0.25,0.4356,0.25,0.25,0.6241,0.3844,0.25,0.25,0.1849,0.235882143,0.194428571,0.277335714,9,28.13,22,68.75,5,62.5,6,75,4,50,7,87.5,14,87.5,8,50,59.59,51.5,53.5,62.5,70.88,63.12,56.06,-40.62,-9.16,-11,-21.5,12.5,-16.62,-24.38,6.06,1,0,0,2,1,0,1,0,0,2,0,1,0,0,0,0,2,1,0,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0.8,0.6,0.2,1.2,0.4,0.4,0.6,0.4,0.7,0.45,3,3.33,3,-3,-1,0,-0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,0,0,0,1,1,-1,1,0,0,1,0,0,-1,-1,0,-1,1,1,0,3,0.4,0.2,-0.4,0.8,0.25,grad_prof +798,R_7E6OiTDqe7hlo19,18 - 24,Canadian,Female,2,3,3,0,3,2,0,2,1,2,2,0,3,0,3,0,1,2,1,0,2,3,3,-1,3,7,0,-1,2,1,2,4,2,0,2,1,2,2,0,1,1,-1,0,2,2,3,3,0,3,7,2,-1,3,0,3,3,2,-1,3,0,3,3,1,3,1,1,0,6,TRUE,0,85,TRUE,1,90,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,90,FALSE,1,100,TRUE,0,70,TRUE,1,100,FALSE,1,75,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,80,TRUE,0,75,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,98,TRUE,1,100,TRUE,0,70,FALSE,1,50,TRUE,0,85,FALSE,0,65,FALSE,0,100,TRUE,1,96,0,0,0,0,0.0016,0,0.0025,0.01,0.25,0,0.4225,0,0.0025,0,0,0.01,0,0.25,0.25,0.0004,0,0.16,0.5625,0.0625,0.25,0.49,1,0.7225,0,0.64,0.7225,0.49,0.224982143,0.067792857,0.382171429,26,81.25,24,75,5,62.5,7,87.5,6,75,6,75,14,87.5,10,62.5,85.28,80,91.38,91,78.75,93.19,77.38,6.25,10.28,17.5,3.88,16,3.75,5.69,14.88,0,0,0,1,0,2,1,0,0,0,0,0,1,1,1,0,0,1,2,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,2,1,0,0,0.2,0.6,0.6,0.6,0,0.8,0.2,0.8,0.5,0.45,4.33,4.33,0,1,-1,-4,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,1,0,2,0,-1,-1,-1,0,-1,1,1,1,-1,-2,0,2,0,0.2,-0.2,0.4,-0.2,0.05,C_Ug +799,R_3mhdoEs0UVczlc4,18 - 24,Canadian,Female,-3,3,3,3,2,3,3,2,2,1,2,3,2,3,-1,-2,2,-1,2,0,1,-1,-1,0,-3,8,1,-2,-2,2,0,10,-1,-1,2,-2,1,9,2,2,-1,2,1,9,-1,0,2,-2,1,8,-2,1,2,1,-1,10,3,3,-1,2,3,5,-2,0,-1,1,2,9,FALSE,1,100,FALSE,0,55,TRUE,0,55,FALSE,1,68,FALSE,0,57,TRUE,0,59,TRUE,1,58,FALSE,0,56,FALSE,0,55,TRUE,1,55,FALSE,1,55,TRUE,0,76,FALSE,0,59,TRUE,0,68,FALSE,0,66,TRUE,1,64,FALSE,1,55,FALSE,1,100,FALSE,1,55,FALSE,1,100,FALSE,0,54,FALSE,0,54,FALSE,1,100,TRUE,1,54,FALSE,1,55,TRUE,1,86,FALSE,1,60,FALSE,1,59,TRUE,0,74,TRUE,1,100,FALSE,0,83,TRUE,1,100,0.3136,0.0196,0.1296,0.1764,0,0.3481,0.2116,0.2025,0,0.2916,0,0.3481,0.3025,0.2025,0.3249,0.3025,0,0.1024,0.1681,0.2025,0.2916,0.4356,0.2025,0.4624,0.2025,0.16,0.6889,0,0.3025,0,0.5476,0.5776,0.245660714,0.188335714,0.302985714,4,12.5,18,56.25,4,50,3,37.5,6,75,5,62.5,7,43.75,11,68.75,68.59,62.12,69.75,72,70.5,66,71.19,-43.75,12.34,12.12,32.25,-3,8,22.25,2.44,4,4,4,3,5,2,5,4,0,1,3,4,0,5,2,4,0,0,0,1,2,3,1,5,1,5,2,0,1,2,1,0,3,1,4,0,2,0,1,2,4,2.4,2.8,1,2.4,2,1.8,1,2.55,1.8,9,7.67,0,0,4,0,1.33,15 cents,100 minutes,15 days,Female,College Diploma/Certificate,24,0.375,0,0,0,0,1,0,0,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,1,3,-2,4,-3,3,4,-1,-1,2,4,-3,4,-2,4,-2,0,-1,-1,1.6,0.4,1,0,0.75,C_Ug +800,R_5KOpAvIfnlnAQTG,25 - 31,Canadian,Female,2,2,2,-1,2,-1,-2,3,-1,1,1,-3,2,3,2,1,1,1,1,0,2,2,2,3,0,4,-1,-1,-1,3,0,5,1,-3,-1,-1,1,6,-2,-2,-2,-2,-2,7,3,2,2,-1,3,0,-1,-2,2,-2,2,2,0,-3,3,3,2,1,2,3,2,2,0,4,TRUE,0,70,FALSE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,63,FALSE,1,100,TRUE,1,85,TRUE,1,79,FALSE,0,50,TRUE,1,62,FALSE,1,52,TRUE,0,52,TRUE,1,77,FALSE,1,100,FALSE,0,61,TRUE,1,90,TRUE,0,65,TRUE,0,65,TRUE,0,50,FALSE,1,50,TRUE,1,70,TRUE,1,72,TRUE,0,50,TRUE,1,77,FALSE,1,89,TRUE,1,100,FALSE,1,50,FALSE,1,68,TRUE,0,50,FALSE,0,65,FALSE,0,60,TRUE,1,84,0.0441,0,0.01,0.0225,0.0256,0,0.0529,0.1444,0.25,0.0784,0.4225,0.0529,0.25,0.2304,0.1369,0.25,0.25,0.25,0.1024,0.0121,0.09,0.3721,0.25,0,0.4225,0.25,0.36,0.49,0,0.4225,0.25,0.2704,0.203071429,0.171,0.235142857,12,37.5,19,59.38,2,25,5,62.5,6,75,6,75,11,68.75,8,50,68.94,52.88,69.88,80.38,72.62,71.56,66.31,-21.88,9.56,27.88,7.38,5.38,-2.38,2.81,16.31,0,0,0,4,2,0,1,4,4,1,0,0,3,4,1,3,3,3,3,2,1,0,0,0,1,0,0,1,1,1,1,0,1,0,0,1,2,1,1,0,1.2,2,1.6,2.8,0.4,0.6,0.4,1,1.9,0.6,5,1,4,3,5,3,4,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),31,1.875,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-1,0,0,4,1,0,1,3,3,0,-1,0,2,4,1,2,1,2,2,2,0.8,1.4,1.2,1.8,1.3,grad_prof +801,R_7DOLfyoA3NG45QB,18 - 24,Canadian,Female,-2,2,-1,2,-1,-3,2,-3,3,1,1,1,2,1,3,-2,1,-3,-3,-3,-1,2,2,-1,1,4,-1,1,-3,3,1,6,-1,-1,1,3,2,5,1,2,-2,1,-3,8,-1,2,1,3,0,4,-1,1,1,2,-1,3,1,2,2,1,2,3,-2,-2,-2,-2,-3,8,TRUE,0,97,FALSE,0,65,FALSE,1,70,FALSE,1,60,TRUE,1,76,FALSE,1,53,FALSE,0,98,FALSE,0,65,TRUE,1,53,TRUE,1,60,FALSE,1,50,TRUE,0,99,TRUE,1,51,FALSE,1,100,FALSE,0,52,TRUE,1,60,FALSE,1,50,TRUE,0,52,TRUE,0,55,FALSE,1,53,FALSE,0,50,TRUE,1,100,TRUE,0,81,FALSE,0,65,TRUE,0,85,TRUE,1,98,FALSE,1,50,FALSE,1,57,TRUE,0,51,FALSE,0,57,TRUE,1,50,FALSE,0,59,0.4225,0.0004,0.16,0.9604,0.3481,0.2209,0.4225,0.16,0.2209,0,0.3249,0.2401,0.2209,0.25,0.0576,0.4225,0.6561,0.16,0.1849,0.7225,0.25,0.2704,0.3025,0,0.25,0.25,0.25,0.9409,0.09,0.2704,0.2601,0.9801,0.311653571,0.264607143,0.3587,20,62.5,17,53.13,5,62.5,4,50,4,50,4,50,8,50,9,56.25,66.31,54.38,58.88,86.25,65.75,66.19,66.44,9.37,13.18,-8.12,8.88,36.25,15.75,16.19,10.19,1,0,3,3,2,2,1,0,0,0,2,2,1,2,1,3,1,1,4,0,1,0,2,1,1,2,1,4,1,2,0,1,0,0,1,0,3,1,1,0,1.8,0.6,1.6,1.8,1,2,0.4,1,1.45,1.1,5,3.33,0,3,2,0,1.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),21,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,0,0,1,2,1,0,0,-4,-1,-2,2,1,1,2,0,3,-2,0,3,0,0.8,-1.4,1.2,0.8,0.35,HS_TS +802,R_7rS7ENCwiu74QgF,32 - 38,American,Male,0,2,2,1,2,-3,-1,0,1,1,1,2,3,3,3,-1,1,1,1,-3,-2,2,2,1,2,3,-1,-1,1,2,2,3,2,2,3,3,3,2,-3,-2,-2,-3,-2,9,1,3,2,2,3,2,-2,-2,0,-2,2,6,1,1,3,-1,3,5,2,3,1,3,1,8,TRUE,0,50,FALSE,0,50,TRUE,0,88,FALSE,1,94,TRUE,1,98,FALSE,1,93,TRUE,1,78,TRUE,1,86,TRUE,1,50,TRUE,1,93,TRUE,0,69,TRUE,0,65,TRUE,1,66,FALSE,1,76,TRUE,1,87,TRUE,1,99,FALSE,1,50,FALSE,1,91,FALSE,1,91,FALSE,1,99,FALSE,0,50,TRUE,1,96,FALSE,1,83,TRUE,1,93,TRUE,0,50,TRUE,1,96,FALSE,1,50,FALSE,1,88,TRUE,0,91,TRUE,1,94,TRUE,1,91,TRUE,1,99,0.0196,0.0016,0.0001,0.0484,0.0001,0.0049,0.0049,0.0049,0.0001,0.0016,0.0036,0.1156,0.25,0.4761,0.0004,0.25,0.0289,0.0036,0.0144,0.25,0.25,0.0169,0.0081,0.0576,0.25,0.25,0.0081,0.25,0.7744,0.0081,0.8281,0.4225,0.161889286,0.081764286,0.242014286,28,87.5,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,79.81,72.75,78.75,78.75,89,82.88,76.75,12.5,4.81,-2.25,3.75,3.75,14,-4.62,14.25,2,0,0,0,0,2,0,1,1,1,1,0,0,0,0,2,3,3,4,1,1,1,0,1,1,1,1,0,3,1,0,1,0,4,0,3,2,0,2,4,0.4,1,0.2,2.6,0.8,1.2,1,2.2,1.05,1.3,2.67,4.33,1,-3,-3,1,-1.66,5 cents,100 minutes,24 days,Male,University - Undergraduate,32,0.5,1,0,0,0,1,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,1,-1,0,-1,-1,1,-1,1,-2,0,1,-1,0,-4,0,-1,1,3,2,-3,-0.4,-0.2,-0.8,0.4,-0.25,C_Ug +803,R_5poqvhw8eRGOHLk,32 - 38,American,Male,3,3,3,3,3,3,0,3,-1,2,3,3,3,0,3,2,3,2,2,1,3,3,3,3,3,2,1,-1,2,0,2,2,3,3,3,3,3,2,3,3,2,3,1,2,3,3,3,3,3,1,1,-1,3,-1,3,3,3,3,3,0,3,2,3,3,3,3,3,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,97,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,97,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0.9409,0,0,0,1,1,0.0009,1,0.283635714,0.214285714,0.352985714,31,96.88,23,71.88,8,100,5,62.5,6,75,4,50,12,75,11,68.75,99.81,100,99.25,100,100,100,99.62,25,27.93,0,36.75,25,50,25,30.87,0,0,0,0,0,2,1,1,1,0,0,0,0,3,0,1,0,0,1,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,1,0,1,1,2,0,1,0.6,0.4,0,0.8,0,1,0.5,0.45,2,2,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,1,1,-1,0,0,0,3,0,0,0,-1,0,-2,0,0.2,0.6,-0.6,0.05,grad_prof +804,R_1OSX13Su1EVLJut,32 - 38,American,Male,2,2,3,1,1,1,1,1,0,2,1,1,2,2,1,3,2,1,2,1,2,1,2,3,1,8,3,2,1,1,1,7,2,1,3,2,1,8,3,1,2,1,2,7,3,0,2,1,2,6,2,0,2,1,1,4,2,3,1,3,2,8,2,1,2,1,1,9,TRUE,0,76,FALSE,0,75,TRUE,0,63,TRUE,0,77,FALSE,0,66,TRUE,0,71,TRUE,1,55,TRUE,1,64,FALSE,0,66,TRUE,1,74,TRUE,0,64,FALSE,1,64,TRUE,1,65,TRUE,0,83,FALSE,0,61,TRUE,1,70,TRUE,0,67,FALSE,1,71,TRUE,0,80,FALSE,1,92,TRUE,1,81,TRUE,1,61,TRUE,0,73,TRUE,1,65,TRUE,0,62,TRUE,1,66,FALSE,1,57,TRUE,0,92,TRUE,0,80,FALSE,0,62,TRUE,1,78,TRUE,1,75,0.1296,0.1156,0.09,0.2025,0.0625,0.5041,0.1225,0.0676,0.0064,0.1521,0.3844,0.1225,0.4356,0.4096,0.4356,0.5625,0.5329,0.5929,0.8464,0.3844,0.0361,0.3721,0.64,0.6889,0.4489,0.1849,0.0484,0.5776,0.3969,0.0841,0.64,0.1296,0.352482143,0.313657143,0.391307143,21,65.63,15,46.88,2,25,3,37.5,5,62.5,5,62.5,11,68.75,4,25,70.5,69.75,72.25,68.5,71.5,67.75,73.25,18.75,23.62,44.75,34.75,6,9,-1,48.25,0,1,1,2,0,2,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,2,1,0,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,0,0.8,1,0.4,0.8,1,1,1.2,0.8,0.75,1,7.67,6,2,3,0,-2,1.67,10 cents,25 minutes,24 days,Male,University - Undergraduate,34,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,-1,-1,0,2,-1,1,0,-1,0,0,0,-2,0,-1,-1,-1,0,0,0,1,-0.2,0,-0.8,0,-0.25,C_Ug +805,R_7I3ZKe8VLaN9gvc,39 - 45,American,Male,3,3,2,3,3,2,2,2,1,1,2,1,2,2,1,1,2,2,1,3,2,2,1,2,1,7,0,1,2,1,1,6,1,-2,2,-1,1,7,1,1,1,0,0,8,1,1,0,2,1,5,0,1,0,1,1,8,1,0,0,2,1,9,2,1,1,2,1,8,TRUE,0,98,FALSE,0,55,FALSE,1,100,FALSE,1,60,TRUE,1,84,FALSE,1,100,FALSE,0,83,TRUE,1,100,FALSE,0,72,FALSE,0,75,FALSE,1,75,TRUE,0,64,TRUE,1,92,FALSE,1,91,TRUE,1,67,TRUE,1,89,TRUE,0,61,FALSE,1,79,TRUE,0,58,TRUE,0,70,FALSE,0,62,TRUE,1,64,TRUE,0,65,TRUE,1,79,TRUE,0,65,TRUE,1,100,TRUE,0,67,TRUE,0,57,FALSE,1,73,TRUE,1,50,FALSE,0,78,TRUE,1,100,0,0,0.0121,0.6889,0,0,0.0441,0.5625,0.49,0.1296,0.25,0.0064,0.5184,0.0625,0.0256,0.3025,0.4225,0.16,0.3249,0.4225,0.3844,0.1089,0.3364,0.0081,0.3721,0.4489,0.6084,0.9604,0,0.0441,0.0729,0.4096,0.266989286,0.212435714,0.321542857,12,37.5,17,53.13,3,37.5,5,62.5,4,50,5,62.5,10,62.5,7,43.75,76.03,66.5,79.62,81.88,76.12,78.12,73.94,-15.63,22.9,29,17.12,31.88,13.62,15.62,30.19,1,1,1,1,2,2,1,0,0,0,1,3,0,3,0,0,1,1,1,3,2,2,2,1,2,2,1,2,0,0,1,1,2,0,0,1,1,1,1,2,1.2,0.6,1.4,1.2,1.8,1,0.8,1.2,1.1,1.2,6.67,7.33,2,-2,-2,0,-0.66,10 cents,25 minutes,36 days,Male,University - Undergraduate,39,0,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,-1,-1,-1,0,0,0,0,-2,0,0,0,2,-2,3,0,-1,0,0,0,1,-0.6,-0.4,0.6,0,-0.1,C_Ug +806,R_7RQGYuJcznE1sTy,25 - 31,Canadian,Female,2,3,3,1,0,0,0,1,-1,0,1,-1,0,0,1,0,0,1,1,0,3,3,3,1,0,5,-1,-2,1,-1,0,2,1,-1,0,0,1,5,0,0,1,0,0,5,2,3,3,2,0,5,1,-2,2,-1,1,2,2,-2,0,-1,0,4,0,0,1,0,0,5,TRUE,0,70,FALSE,0,65,TRUE,0,73,FALSE,1,64,FALSE,0,72,FALSE,1,65,TRUE,1,75,TRUE,1,71,FALSE,0,69,TRUE,1,83,FALSE,1,74,FALSE,1,61,FALSE,0,65,FALSE,1,64,FALSE,0,63,TRUE,1,77,FALSE,1,60,TRUE,0,76,FALSE,1,69,FALSE,1,61,TRUE,1,83,TRUE,1,82,FALSE,1,96,TRUE,1,89,FALSE,1,85,TRUE,1,84,FALSE,1,75,FALSE,1,76,TRUE,0,81,FALSE,0,85,TRUE,1,69,TRUE,1,96,0.0841,0.0256,0.0529,0.0625,0.0016,0.1225,0.0121,0.0289,0.1521,0.0324,0.7225,0.4225,0.4761,0.0676,0.5184,0.4225,0.0016,0.1296,0.0576,0.0225,0.0289,0.3969,0.0961,0.1296,0.16,0.0625,0.0961,0.49,0.5329,0.5776,0.6561,0.1521,0.234617857,0.222171429,0.247064286,13,40.63,22,68.75,5,62.5,5,62.5,6,75,6,75,10,62.5,12,75,74.31,68.5,77.25,77.38,74.12,76.75,71.88,-28.12,5.56,6,14.75,2.38,-0.88,14.25,-3.12,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,2,1,0,1,1,1,0,1,1,0,0,0,1,0,0.2,0.6,0,0.2,0.2,1,0.8,0.2,0.25,0.55,4,3.67,0,0,1,0,0.33,15 cents,100 minutes,47 days,Female,College Diploma/Certificate,31,0.125,0,0,1,0,1,0,0.33,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,0,0,-1,0,0,0,-1,0,-1,-1,-1,0,-1,-1,0,0,0,0,0,0,-0.4,-0.8,0,-0.3,C_Ug +807,R_6uDtRv1gSz16lK6,25 - 31,American,Male,-1,3,-3,3,-3,1,0,1,3,3,-3,-3,-2,-3,3,-2,-2,-3,-3,-3,3,1,-3,-3,-3,5,3,-3,3,3,3,10,3,3,-3,0,-3,10,1,-3,1,1,-3,10,3,3,-3,0,3,6,3,-3,3,-3,3,9,-3,-3,3,-1,3,3,-1,-2,3,3,1,10,TRUE,0,95,FALSE,0,57,TRUE,0,91,FALSE,1,56,TRUE,1,82,TRUE,0,71,TRUE,1,69,TRUE,1,68,TRUE,1,71,TRUE,1,100,TRUE,0,73,TRUE,0,96,TRUE,1,75,TRUE,0,66,FALSE,0,55,FALSE,0,60,TRUE,0,93,TRUE,0,99,TRUE,0,57,TRUE,0,63,FALSE,0,57,TRUE,1,60,TRUE,0,74,TRUE,1,100,TRUE,0,57,TRUE,1,63,FALSE,1,51,TRUE,0,82,TRUE,0,93,FALSE,0,60,FALSE,0,61,TRUE,1,100,0.1024,0.1369,0.36,0.0961,0,0.5041,0,0,0.3969,0.16,0.36,0.0625,0.0841,0.5329,0.0324,0.3249,0.5476,0.1936,0.6724,0.3249,0.3249,0.3025,0.3249,0.4356,0.8649,0.2401,0.3721,0.9025,0.8281,0.9801,0.8649,0.9216,0.412803571,0.2285,0.597107143,23,71.88,12,37.5,3,37.5,3,37.5,4,50,2,25,10,62.5,2,12.5,73.59,60.12,80.62,76.12,77.5,71.12,76.06,34.38,36.09,22.62,43.12,26.12,52.5,8.62,63.56,4,2,0,6,0,2,3,2,0,0,6,6,1,3,6,3,1,4,4,0,4,0,0,3,6,2,3,2,6,0,0,0,5,2,0,1,0,6,6,4,2.4,1.4,4.4,2.4,2.6,2.6,1.4,3.4,2.65,2.5,8.33,6,-1,1,7,0,2.33,5 cents,100 minutes,47 days,Male,High School (or equivalent),25,1.25,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,2,0,3,-6,0,0,0,-6,0,6,6,-4,1,6,2,1,-2,-2,-4,-0.2,-1.2,3,-1,0.15,HS_TS +808,R_37uBEKEHZ4l6BaN,25 - 31,Canadian,Female,2,2,1,1,1,0,1,0,0,2,1,1,1,0,1,0,1,1,2,2,0,0,1,1,1,8,0,1,0,1,1,8,1,1,0,1,1,7,1,1,1,0,2,6,1,1,0,0,-1,8,1,1,0,0,1,7,1,0,1,0,0,7,0,0,1,1,0,6,TRUE,0,82,FALSE,0,77,FALSE,1,75,FALSE,1,74,FALSE,0,74,FALSE,1,82,FALSE,0,100,FALSE,0,77,TRUE,1,84,FALSE,0,81,TRUE,0,81,FALSE,1,80,TRUE,1,87,TRUE,0,76,FALSE,0,75,FALSE,0,85,TRUE,0,79,TRUE,0,71,TRUE,0,86,FALSE,1,78,TRUE,1,82,FALSE,0,82,FALSE,1,76,FALSE,0,79,TRUE,0,74,TRUE,1,80,FALSE,1,77,TRUE,0,68,FALSE,1,87,TRUE,1,86,TRUE,1,80,FALSE,0,91,0.5929,0.04,0.7225,1,0.8281,0.0324,0.6241,0.6561,0.0484,0.6724,0.0196,0.0169,0.0256,0.6561,0.5476,0.5929,0.0576,0.0676,0.4624,0.5476,0.0324,0.5625,0.7396,0.5776,0.6241,0.0529,0.04,0.6724,0.0625,0.5041,0.0169,0.04,0.3493,0.3461,0.3525,16,50,14,43.75,4,50,5,62.5,1,12.5,4,50,6,37.5,8,50,80.19,79.25,82.25,80.75,78.5,82.5,77.88,6.25,36.44,29.25,19.75,68.25,28.5,45,27.88,2,2,0,0,0,0,0,0,1,1,0,0,1,1,0,1,0,0,2,0,1,1,1,1,2,1,0,0,0,1,0,1,0,0,1,0,1,0,1,2,0.8,0.4,0.4,0.6,1.2,0.4,0.4,0.8,0.55,0.7,7.67,7.33,0,1,0,0,0.34,10 cents,75 minutes,24 days,Female,University - Undergraduate,31,0.375,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,02DGEN,02REV,1,1,-1,-1,-2,-1,0,0,1,0,0,-1,1,1,-1,1,-1,0,1,-2,-0.4,0,0,-0.2,-0.15,C_Ug +809,R_5PgAbxytNTVLYM9,25 - 31,Canadian,Female,-2,3,3,-1,3,3,-1,2,1,1,1,0,2,-2,2,2,1,1,1,-2,-1,-1,-1,1,1,5,1,-1,1,1,1,3,-2,-1,1,1,-1,5,1,1,1,-1,1,6,-2,-1,1,1,1,2,-2,-2,1,-1,1,4,1,1,-1,2,1,5,1,1,1,2,-1,6,TRUE,0,86,FALSE,0,50,TRUE,0,100,TRUE,0,67,FALSE,0,53,FALSE,1,100,TRUE,1,96,TRUE,1,83,FALSE,0,54,FALSE,0,81,FALSE,1,59,TRUE,0,98,FALSE,0,61,TRUE,0,58,FALSE,0,56,TRUE,1,87,TRUE,0,81,TRUE,0,83,FALSE,1,50,FALSE,1,52,TRUE,1,66,FALSE,0,62,FALSE,1,100,TRUE,1,61,TRUE,0,76,FALSE,0,56,FALSE,1,58,TRUE,0,73,TRUE,0,75,FALSE,0,69,TRUE,1,69,TRUE,1,100,0.0289,0.3136,0.0169,0.0016,0,0,0.1521,0.6561,0.2304,0.3844,0.4761,0.3721,0.2916,0.1681,0.2809,0.25,0,0.4489,0.5329,0.5776,0.1156,0.3136,0.25,0.3364,0.6561,0.1764,0.0961,0.7396,1,0.6889,0.5625,0.9604,0.382742857,0.26505,0.500435714,16,50,13,40.63,4,50,4,50,1,12.5,4,50,7,43.75,6,37.5,72.5,57.88,79.5,74.75,77.88,69,76,9.37,31.87,7.88,29.5,62.25,27.88,25.25,38.5,1,4,4,2,2,2,0,1,0,0,3,1,1,3,3,1,0,0,2,3,0,4,2,2,2,5,1,1,2,0,0,1,3,4,1,1,0,0,1,1,2.6,0.6,2.2,1.2,2,1.8,1.8,0.6,1.65,1.55,4.33,3.67,3,-1,0,0,0.66,10 cents,100 minutes,24 days,Female,University - Undergraduate,26,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,0,2,0,0,-3,-1,0,-2,0,3,0,-2,-1,2,0,0,0,1,2,0.6,-1.2,0.4,0.6,0.1,C_Ug +810,R_3pQtt2jkjulJS6g,32 - 38,American,Male,3,3,3,3,3,2,0,0,-1,3,3,0,2,0,2,1,2,2,2,0,3,3,0,3,1,5,2,3,1,1,3,5,1,2,1,1,0,5,0,0,1,1,2,4,3,3,3,3,3,6,3,3,0,1,1,5,0,2,2,1,2,5,1,1,0,0,0,6,TRUE,0,81,TRUE,1,62,TRUE,0,76,TRUE,0,59,TRUE,1,68,TRUE,0,67,TRUE,1,65,TRUE,1,67,TRUE,1,63,TRUE,1,57,TRUE,0,60,TRUE,0,64,TRUE,1,65,TRUE,0,59,TRUE,1,59,TRUE,1,69,TRUE,0,59,TRUE,0,65,TRUE,0,67,TRUE,0,65,TRUE,1,68,TRUE,1,78,TRUE,0,72,TRUE,1,74,TRUE,0,66,TRUE,1,70,TRUE,0,81,TRUE,0,77,TRUE,0,72,TRUE,1,76,TRUE,1,70,TRUE,1,65,0.1089,0.09,0.0961,0.1225,0.1225,0.4489,0.0676,0.1849,0.4225,0.0484,0.0576,0.1225,0.1369,0.36,0.1024,0.1444,0.5184,0.3481,0.5929,0.4356,0.1024,0.1681,0.4489,0.3481,0.3481,0.6561,0.09,0.6561,0.5776,0.4225,0.5184,0.4096,0.316410714,0.220364286,0.412457143,29,90.63,16,50,4,50,4,50,4,50,4,50,16,100,0,0,67.69,65.12,67,67.62,71,67.25,68.12,40.63,17.69,15.12,17,17.62,21,-32.75,68.12,0,0,3,0,2,0,3,1,2,0,2,2,1,1,2,1,2,1,1,2,0,0,0,0,0,1,3,0,2,2,3,2,0,1,0,0,1,2,2,0,1,1.2,1.6,1.4,0,1.6,1.2,1,1.3,0.95,5,5.33,-1,0,0,-2,-0.33,10 cents,25 minutes,24 days,Male,Professional Degree (ex. JD/MD),34,0.125,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,0,0,3,0,2,-1,0,1,0,-2,-1,0,1,0,2,1,1,-1,-1,2,1,-0.4,0.4,0.4,0.35,grad_prof +811,R_123oEnenHpDVSrq,25 - 31,Canadian,Female,3,3,3,-1,3,2,0,3,1,1,2,-3,1,1,2,0,1,2,2,-2,3,3,3,-3,-2,6,3,-3,-3,1,0,9,3,-2,-3,-3,1,8,-3,0,1,0,0,5,3,3,3,1,3,6,0,2,1,1,1,8,3,0,2,-2,3,4,2,1,1,2,-1,6,TRUE,0,91,TRUE,1,50,TRUE,0,98,FALSE,1,50,TRUE,1,100,FALSE,1,85,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,73,TRUE,0,51,TRUE,0,80,TRUE,1,50,FALSE,1,87,FALSE,0,50,FALSE,0,50,FALSE,1,64,TRUE,0,75,TRUE,0,50,FALSE,1,50,FALSE,0,88,FALSE,0,50,FALSE,1,66,FALSE,0,50,TRUE,0,96,TRUE,1,58,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,94,FALSE,0,51,TRUE,1,100,0.25,0.1764,0.25,0.25,0,0.0225,0.25,0.0729,0.25,0.25,0.8836,0.25,0.25,0.2601,0,0.25,0.1156,0.25,0.25,0.9216,0.7744,0.25,0.25,0.0169,0.1296,0.25,0.2601,0.8281,0.9604,0.5625,0.25,0.64,0.337439286,0.221764286,0.453114286,14,43.75,18,56.25,4,50,7,87.5,4,50,3,37.5,9,56.25,9,56.25,65.84,50.25,75.38,72.5,65.25,63.38,68.31,-12.5,9.59,0.25,-12.12,22.5,27.75,7.13,12.06,0,0,0,2,5,1,3,6,0,1,1,1,4,4,1,3,1,1,2,2,0,0,0,2,0,2,2,2,0,0,1,3,1,3,1,2,0,1,0,1,1.4,2.2,2.2,1.8,0.4,1.2,1.8,0.8,1.9,1.05,7.67,6,0,1,4,-1,1.67,10 cents,25 minutes,15 days,Female,University - Graduate (Masters),27,0.875,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,5,-1,1,4,0,1,0,-2,3,1,0,1,1,0,2,1,1,1,0.4,1,0.85,grad_prof +812,R_5G30NJQga0bbt5f,18 - 24,American,Male,3,2,2,2,2,3,1,2,1,2,3,2,3,3,3,2,1,2,2,2,1,2,1,2,1,3,-1,1,1,1,1,3,2,1,2,1,2,3,1,1,1,2,2,8,3,3,2,2,2,2,2,1,3,1,3,4,3,2,3,2,3,4,2,3,2,2,2,6,TRUE,0,100,TRUE,1,71,TRUE,0,89,FALSE,1,86,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,98,TRUE,0,88,TRUE,0,79,TRUE,1,92,FALSE,1,70,TRUE,1,84,TRUE,1,87,FALSE,1,80,TRUE,0,100,FALSE,1,94,FALSE,1,98,TRUE,1,95,TRUE,1,96,TRUE,0,93,TRUE,1,99,FALSE,1,93,TRUE,1,91,FALSE,1,65,TRUE,0,88,TRUE,0,90,TRUE,1,90,TRUE,1,66,TRUE,1,95,0.0009,0.0081,0.0169,0,0.0025,0,0.0001,0.0004,0.0004,0.0016,0.01,0.0064,0,0.7744,0.0004,0.0841,0.8649,0.0196,0.7744,0.0049,0.0025,0.0256,0.0036,0.09,0.04,0.1225,0.1156,1,0.7921,1,0.81,0.6241,0.256075,0.126057143,0.386092857,25,78.13,24,75,7,87.5,6,75,6,75,5,62.5,16,100,8,50,89.75,81.75,92.88,93.5,90.88,91.19,88.31,3.13,14.75,-5.75,17.88,18.5,28.38,-8.81,38.31,2,0,1,0,1,4,0,1,0,1,1,1,1,2,1,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,2,0,0,0,0.8,1.2,1.2,0.4,0.2,0.6,0.2,0.4,0.9,0.35,3,3.33,1,-1,-1,2,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),19,1.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,-1,1,0,1,3,0,0,0,0,1,1,1,1,1,1,-2,1,0,0,0.6,0.6,1,0,0.55,HS_TS +813,R_7N4mmETX5ChvFfP,25 - 31,Canadian,Male,2,2,2,2,-1,0,0,1,1,1,1,1,1,2,1,1,1,1,1,1,-1,0,1,1,-1,5,-1,-1,-2,0,-1,7,-1,0,-1,1,1,7,-1,-1,-1,-1,-1,8,2,3,3,3,1,6,0,1,2,1,1,6,2,2,2,2,2,6,2,2,2,2,3,6,FALSE,1,100,TRUE,1,100,TRUE,0,94,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,0,100,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,64,FALSE,0,100,TRUE,0,55,FALSE,1,54,TRUE,0,92,TRUE,1,92,TRUE,1,80,TRUE,1,100,0,1,0,0,0,0,0,0,0.0225,0.2116,0.0064,1,0,0,0,0,0,0.04,0.2116,0.1296,1,0,0,0,0,0.3025,0.04,0,0.8836,0,0.8464,0,0.16765,0.091464286,0.243835714,26,81.25,26,81.25,7,87.5,5,62.5,7,87.5,7,87.5,13,81.25,13,81.25,92.19,89.38,99,89.75,90.62,95.38,89,0,10.94,1.88,36.5,2.25,3.12,14.13,7.75,3,2,1,1,0,1,1,3,1,2,2,1,2,1,0,2,2,2,2,2,0,1,1,1,2,0,1,1,0,0,1,1,1,0,1,1,1,1,1,2,1.4,1.6,1.2,2,1,0.4,0.8,1.2,1.55,0.85,6.33,6,-1,1,1,2,0.33,10 cents,5 minutes,47 days,Male,High School (or equivalent),29,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,3,1,0,0,-2,1,0,2,1,2,1,0,1,1,-1,1,1,1,1,0,0.4,1.2,0.4,0.8,0.7,HS_TS +814,R_5EXqrTpgDzX2xJk,25 - 31,Canadian,Female,-1,0,1,1,0,1,0,0,1,1,0,0,1,-1,1,1,0,0,1,0,1,1,1,0,0,6,1,1,0,1,0,6,1,0,-1,0,1,6,1,1,0,0,1,6,0,1,0,-1,1,6,0,0,0,1,1,6,0,1,1,0,1,6,0,1,1,1,0,6,TRUE,0,57,TRUE,1,56,TRUE,0,58,FALSE,1,61,TRUE,1,67,TRUE,0,63,TRUE,1,63,TRUE,1,64,FALSE,0,65,TRUE,1,68,FALSE,1,69,TRUE,0,69,FALSE,0,69,FALSE,1,61,FALSE,0,65,FALSE,0,67,FALSE,1,67,TRUE,0,68,FALSE,1,63,FALSE,1,52,FALSE,0,65,FALSE,0,67,FALSE,1,84,FALSE,0,77,FALSE,1,87,TRUE,1,89,FALSE,1,55,FALSE,1,68,TRUE,0,64,TRUE,1,90,FALSE,0,74,TRUE,1,94,0.1296,0.0121,0.4489,0.1369,0.0036,0.3969,0.5929,0.1024,0.2304,0.4489,0.01,0.4761,0.4225,0.0961,0.1089,0.1936,0.0256,0.1521,0.1024,0.0169,0.4225,0.4225,0.1369,0.1521,0.1089,0.2025,0.5476,0.3249,0.3364,0.4624,0.4096,0.4761,0.263632143,0.232857143,0.294407143,16,50,18,56.25,5,62.5,4,50,5,62.5,4,50,8,50,10,62.5,68.31,63.5,71.62,70,68.12,71.25,65.38,-6.25,12.06,1,21.62,7.5,18.12,21.25,2.88,2,1,0,1,0,0,1,0,0,1,1,0,2,1,0,0,1,0,1,1,1,1,1,2,1,1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0.8,0.4,0.8,0.6,1.2,0.2,0.4,0.6,0.65,0.6,6,6,0,0,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,30,0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,1,0,-1,-1,-1,-1,1,0,0,1,1,-1,2,0,0,-1,0,-1,1,1,-0.4,0.2,0.4,0,0.05,C_Ug +815,R_5RrN123xKRLl9vD,18 - 24,Canadian,Female,-1,3,2,3,2,3,2,3,1,1,3,-1,3,1,3,-1,1,1,1,-2,2,1,3,-1,1,4,1,-1,1,3,1,7,3,1,3,2,3,6,-1,1,-2,1,0,7,1,3,2,3,2,3,3,2,3,1,3,4,3,-1,3,0,3,5,2,3,2,3,0,6,TRUE,0,79,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,84,TRUE,1,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,87,TRUE,0,50,TRUE,1,79,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,56,TRUE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,62,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,0,74,TRUE,1,100,TRUE,0,50,TRUE,0,86,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,1,73,0,0,1,0.25,0.0729,0.0256,0.25,0,0.25,0.25,1,0.0441,0.25,0.0169,0.25,0.25,0,0.25,0.7396,0.5476,0.1444,1,0.25,0,0.3136,0.25,0.25,0.6241,1,1,0.25,0.25,0.340314286,0.207821429,0.472807143,13,40.63,14,43.75,3,37.5,5,62.5,4,50,2,25,8,50,6,37.5,72.81,60.88,69.25,81.62,79.5,72.75,72.88,-3.12,29.06,23.38,6.75,31.62,54.5,22.75,35.38,3,2,1,4,1,2,3,2,2,0,0,2,0,1,0,0,0,3,0,2,2,0,0,0,0,0,0,0,0,2,0,0,0,1,0,3,2,1,2,2,2.2,1.8,0.6,1,0.4,0.4,0.2,2,1.4,0.75,5.67,4,1,3,1,1,1.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,1,2,1,4,1,2,3,2,2,-2,0,2,0,0,0,-3,-2,2,-2,0,1.8,1.4,0.4,-1,0.65,HS_TS +816,R_62lx4D4mSWS2N0p,39 - 45,American,Male,2,3,2,2,3,2,1,3,-1,3,2,0,2,2,2,2,2,1,2,0,3,2,2,-1,0,8,1,0,2,2,1,9,2,1,1,1,2,9,0,2,1,2,-1,9,2,3,2,2,2,8,1,0,2,0,2,9,2,2,2,2,1,8,3,2,2,2,3,9,TRUE,0,100,FALSE,0,58,TRUE,0,58,TRUE,0,58,FALSE,0,58,TRUE,0,69,FALSE,0,60,TRUE,1,58,TRUE,1,56,TRUE,1,61,TRUE,0,60,TRUE,0,91,TRUE,1,77,TRUE,0,61,TRUE,1,76,TRUE,1,60,TRUE,0,80,TRUE,0,57,FALSE,1,57,FALSE,1,59,TRUE,1,63,FALSE,0,60,FALSE,1,57,FALSE,0,60,TRUE,0,63,TRUE,1,72,FALSE,1,57,TRUE,0,77,FALSE,1,58,TRUE,1,73,TRUE,1,96,TRUE,1,87,0.1764,0.0784,0.16,0.36,0.0169,0.4761,0.36,0.1521,0.1681,0.36,0.0729,0.0529,0.1936,0.36,0.3364,0.3364,0.1849,0.3364,0.5929,0.3969,0.1369,0.0576,0.1849,0.3721,0.64,0.1849,0.0016,1,0.3364,0.3249,0.1764,0.8281,0.308582143,0.243335714,0.373828571,16,50,16,50,5,62.5,5,62.5,2,25,4,50,11,68.75,5,31.25,66.78,64.75,68.62,66.75,67,67.19,66.38,0,16.78,2.25,6.12,41.75,17,-1.56,35.13,1,1,0,3,3,1,1,1,3,2,0,1,1,1,0,2,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,2,0,0,1,1,0,1,0,3,1.6,1.6,0.6,0.6,0.2,1,0.6,1,1.1,0.7,8.67,8.33,0,0,1,0,0.34,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),41,0,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,1,0,3,2,0,0,0,2,1,0,-1,1,1,-1,1,0,-1,0,-2,1.4,0.6,0,-0.4,0.4,grad_prof +817,R_7dLFcejCIvzD4qy,32 - 38,American,Male,1,3,3,2,2,2,0,2,0,2,2,2,2,2,2,2,2,2,2,2,1,3,3,2,3,7,2,2,2,0,2,8,3,2,2,2,0,6,2,2,2,2,2,8,1,3,3,3,3,7,2,2,2,0,2,6,2,2,2,2,2,7,2,2,2,2,2,6,TRUE,0,100,FALSE,0,98,TRUE,0,82,FALSE,1,70,TRUE,1,78,FALSE,1,85,TRUE,1,100,FALSE,0,93,TRUE,1,90,FALSE,0,79,TRUE,0,92,TRUE,0,87,TRUE,1,86,FALSE,1,83,FALSE,0,86,TRUE,1,91,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,93,FALSE,0,60,FALSE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,77,TRUE,0,76,TRUE,0,92,FALSE,0,95,FALSE,0,100,TRUE,1,96,0.8649,0,0.0081,0,0.0016,0.0225,0.0009,0.6241,0.0025,0.36,0.9025,0.0196,0.01,0.8464,0.0484,0.9604,0,0.09,0.5776,0,0.8649,0.7396,0,0.0289,0,0.0529,1,1,0.6724,1,0.8464,0.7569,0.408160714,0.277778571,0.538542857,16,50,17,53.13,4,50,6,75,4,50,3,37.5,8,50,9,56.25,90.03,89.12,91.25,90.25,89.5,90.12,89.94,-3.13,36.9,39.12,16.25,40.25,52,40.12,33.69,0,0,0,0,1,0,2,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,1,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0.6,0,0.4,0.4,0,0,0.3,0.2,7,6.67,0,2,-1,2,0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,-0.2,0,0.6,0,0.1,HS_TS +818,R_6w6U2sqxn4Hih1I,39 - 45,American,Male,2,2,2,0,2,1,-1,2,0,2,2,2,3,-1,2,1,2,2,1,3,1,3,3,1,2,6,2,2,2,3,2,7,2,2,0,3,2,7,1,1,2,2,3,8,2,3,2,2,3,8,-2,-2,2,0,2,7,3,-1,0,-1,1,8,1,2,3,2,3,6,FALSE,1,93,TRUE,1,88,FALSE,1,93,TRUE,0,86,TRUE,1,62,FALSE,1,87,TRUE,1,87,TRUE,1,83,TRUE,1,88,TRUE,1,87,FALSE,1,89,FALSE,1,90,FALSE,0,92,FALSE,1,82,FALSE,0,90,TRUE,1,87,FALSE,1,92,TRUE,0,90,FALSE,1,84,FALSE,1,88,TRUE,1,91,TRUE,1,96,FALSE,1,94,TRUE,1,89,FALSE,1,88,TRUE,1,93,FALSE,1,87,FALSE,1,92,FALSE,1,87,TRUE,1,87,TRUE,1,87,TRUE,1,89,0.0289,0.0049,0.0169,0.0169,0.0121,0.0169,0.0121,0.0169,0.0144,0.0016,0.0169,0.8464,0.0144,0.0121,0.1444,0.0144,0.0036,0.7396,0.0064,0.0144,0.0081,0.81,0.0256,0.0324,0.0064,0.0169,0.0169,0.0049,0.0049,0.81,0.0169,0.01,0.130342857,0.133271429,0.127414286,29,90.63,28,87.5,6,75,7,87.5,7,87.5,8,100,14,87.5,14,87.5,88.06,87.38,86.75,89.5,88.62,87.25,88.88,3.13,0.56,12.38,-0.75,2,-11.38,-0.25,1.38,1,1,1,1,0,1,3,0,3,0,0,0,3,4,0,0,1,0,1,0,0,1,0,2,1,3,1,0,0,0,1,3,3,0,1,0,0,1,1,0,0.8,1.4,1.4,0.4,0.8,0.8,1.6,0.4,1,0.9,6.67,7.67,-2,0,-1,2,-1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),44,0.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,1,-1,-1,-2,2,0,3,0,-1,-3,0,4,-1,0,1,-1,0,0,0,0.6,-0.2,0,0.1,grad_prof +819,R_6nQ22abOSqXFXJk,18 - 24,Canadian,Female,3,3,1,1,2,2,1,1,-2,2,3,2,3,2,3,-3,-3,-3,-3,-3,1,3,3,-1,2,4,0,-1,-2,-2,0,7,0,-1,1,0,0,7,0,-3,-3,-3,-3,8,3,3,3,2,3,7,3,-1,3,-3,3,5,3,3,3,2,3,9,2,1,2,1,-3,9,FALSE,1,71,TRUE,1,63,TRUE,0,95,FALSE,1,57,TRUE,1,100,FALSE,1,75,TRUE,1,97,TRUE,1,81,TRUE,1,55,TRUE,1,94,TRUE,0,59,TRUE,0,87,FALSE,0,71,TRUE,0,69,TRUE,1,65,FALSE,0,84,FALSE,1,80,TRUE,0,89,TRUE,0,94,TRUE,0,94,TRUE,1,79,TRUE,1,60,FALSE,1,62,TRUE,1,100,TRUE,0,88,TRUE,1,91,FALSE,1,55,TRUE,0,67,TRUE,0,100,TRUE,1,80,TRUE,1,71,FALSE,0,59,0.0361,0.0081,0.7056,0.0009,0.3481,0.0625,0,0.0036,0.8836,0.16,0.04,0.5041,0.2025,0.3481,0,0.1369,0.1444,0.1849,0.4489,0.7744,0.0441,0.1225,0.8836,0.4761,0.04,0.2025,0.0841,0.0841,0.9025,0.7921,1,0.7569,0.343946429,0.215621429,0.472271429,15,46.88,19,59.38,6,75,5,62.5,5,62.5,3,37.5,13,81.25,6,37.5,77.88,64.88,78.25,82.38,86,78.12,77.62,-12.5,18.5,-10.12,15.75,19.88,48.5,-3.13,40.12,2,0,2,2,0,2,2,3,0,2,3,3,2,2,3,3,0,0,0,0,0,0,2,1,1,1,2,2,1,1,0,1,0,0,0,5,4,5,4,0,1.2,1.8,2.6,0.6,0.8,1.4,0.2,3.6,1.55,1.5,6,7,-3,2,-2,-1,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),19,0.125,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,2,0,0,1,-1,1,0,1,-1,1,3,2,2,2,3,-2,-4,-5,-4,0,0.4,0.4,2.4,-3,0.05,HS_TS +820,R_5jiUES1850eL6yD,39 - 45,American,Male,2,3,3,1,2,0,-3,2,-1,2,3,2,3,0,3,-3,-2,-1,-3,-3,2,3,3,2,2,6,0,-2,3,-2,2,5,3,1,2,0,3,7,-2,1,0,-2,-3,8,3,3,3,1,3,7,0,-2,1,-2,2,5,3,2,3,0,3,8,0,0,0,0,-3,9,FALSE,1,78,FALSE,0,59,TRUE,0,90,TRUE,0,73,FALSE,0,50,TRUE,0,66,TRUE,1,93,FALSE,0,52,FALSE,0,50,TRUE,1,55,FALSE,1,80,TRUE,0,100,TRUE,1,50,FALSE,1,58,FALSE,0,70,TRUE,1,76,FALSE,1,51,TRUE,0,98,FALSE,1,54,FALSE,1,93,TRUE,1,86,TRUE,1,74,FALSE,1,59,TRUE,1,69,FALSE,1,50,FALSE,0,53,FALSE,1,56,FALSE,1,70,FALSE,1,67,TRUE,1,68,TRUE,1,65,FALSE,0,90,0.2704,0.2809,0.0576,0.0049,0.81,0.4356,0.0961,0.2025,0.0049,0.0676,0.1024,0.25,0.25,0.04,0.25,0.3481,0.1681,0.5329,0.09,0.25,0.0196,0.49,0.2116,0.1764,0.2401,0.1936,0.1225,0.0484,0.81,0.9604,0.1089,1,0.295703571,0.254157143,0.33725,11,34.38,20,62.5,4,50,5,62.5,6,75,5,62.5,9,56.25,11,68.75,68.84,63.38,64.88,69.88,77.25,66.25,71.44,-28.12,6.34,13.38,2.38,-5.12,14.75,10,2.69,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,3,1,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,3,2,1,3,0,0.2,0.6,0.4,1.2,0.4,0.6,0,1.8,0.6,0.7,6,6.67,-1,0,-1,-1,-0.67,10 cents,25 minutes,36 days,Male,High School (or equivalent),43,0.75,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,-1,0,0,1,-1,0,0,0,0,0,0,1,1,0,0,-2,1,0,-2,0,-0.2,0,0.4,-0.6,-0.1,HS_TS +821,R_50JdB3gPcLim8aj,18 - 24,Canadian,Female,3,3,-2,-1,1,-1,1,3,1,2,2,3,3,-1,3,0,0,0,0,-3,3,3,2,2,3,3,-3,-3,1,3,1,5,3,0,3,2,3,3,-1,-3,-3,-3,-3,10,2,2,0,0,2,3,-1,1,2,-1,1,2,2,1,3,0,3,4,1,1,1,1,-3,10,TRUE,0,70,FALSE,0,53,TRUE,0,65,TRUE,0,70,TRUE,1,80,FALSE,1,90,TRUE,1,93,TRUE,1,87,FALSE,0,52,TRUE,1,72,TRUE,0,60,TRUE,0,64,TRUE,1,63,FALSE,1,73,TRUE,1,72,FALSE,0,62,TRUE,0,73,FALSE,1,100,TRUE,0,52,TRUE,0,51,FALSE,0,52,FALSE,0,52,TRUE,0,52,TRUE,1,64,FALSE,1,96,TRUE,1,98,TRUE,0,51,FALSE,1,67,TRUE,0,68,TRUE,1,70,FALSE,0,51,TRUE,1,51,0.0169,0.0004,0.3844,0.0049,0.2401,0.01,0.1296,0.0784,0.2601,0.2704,0.09,0.1369,0.2704,0.36,0.04,0.2809,0.2704,0.49,0.1089,0.0016,0.2704,0.0784,0.2704,0.0729,0.5329,0.2601,0.2601,0.49,0.4225,0,0.4624,0.4096,0.23455,0.209085714,0.260014286,5,15.63,15,46.88,1,12.5,4,50,6,75,4,50,10,62.5,5,31.25,67.94,57.62,66.12,81.75,66.25,67,68.88,-31.25,21.06,45.12,16.12,6.75,16.25,4.5,37.63,0,0,4,3,2,2,4,2,2,1,1,3,0,3,0,1,3,3,3,0,1,1,2,1,1,0,0,1,2,1,0,2,0,1,0,1,1,1,1,0,1.8,2.2,1.4,2,1.2,0.8,0.6,0.8,1.85,0.85,3.67,3,0,3,-1,0,0.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,-1,-1,2,2,1,2,4,1,0,0,1,1,0,2,0,0,2,2,2,0,0.6,1.4,0.8,1.2,1,HS_TS +822,R_6LsULTfUjm0kP9T,18 - 24,Canadian,Male,1,3,1,2,3,1,0,2,-1,3,1,0,3,0,2,2,2,1,2,2,-3,1,3,3,3,7,3,-3,-1,1,0,4,2,-3,3,3,-2,3,2,2,3,3,3,4,2,3,2,3,3,4,2,3,3,-1,3,3,1,-1,3,1,0,3,1,1,2,2,2,2,FALSE,1,50,TRUE,1,50,TRUE,0,98,TRUE,0,54,FALSE,0,50,TRUE,0,70,TRUE,1,88,FALSE,0,50,TRUE,1,65,FALSE,0,59,TRUE,0,52,TRUE,0,99,FALSE,0,100,FALSE,1,86,FALSE,0,50,TRUE,1,58,TRUE,0,63,TRUE,0,100,TRUE,0,53,TRUE,0,83,TRUE,1,100,TRUE,1,91,FALSE,1,77,TRUE,1,50,FALSE,1,50,TRUE,1,76,FALSE,1,51,FALSE,1,100,TRUE,0,54,TRUE,1,100,FALSE,0,50,FALSE,0,68,0.25,0.0576,0.1764,0.0144,0.4624,0.49,0.25,0.3481,0.6889,0.0081,0,1,0.1225,0.2704,0.25,0.25,0.0529,0.2916,0,0.25,0,0.25,0.2809,0.0196,0.3969,0.2401,0.25,0.25,0.9604,1,0.2916,0.9801,0.344803571,0.32035,0.369257143,12,37.5,15,46.88,3,37.5,2,25,6,75,4,50,9,56.25,6,37.5,70.16,53.12,72.75,75,79.75,69.06,71.25,-9.38,23.28,15.62,47.75,0,29.75,12.81,33.75,4,2,2,1,0,2,3,3,2,3,1,3,0,3,4,0,0,2,1,1,1,0,1,1,0,1,3,1,0,0,0,1,0,1,2,1,1,1,0,0,1.8,2.6,2.2,0.8,0.6,1,0.8,0.6,1.85,0.75,4.67,3.33,3,1,0,2,1.34,5 cents,100 minutes,36 days,Male,University - Undergraduate,23,1.375,1,0,0,0,1,0,0.33,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,3,2,1,0,0,1,0,2,2,3,1,2,0,2,2,-1,-1,1,1,1,1.2,1.6,1.4,0.2,1.1,C_Ug +823,R_3L1API9vGOPA5Md,18 - 24,Canadian,Female,1,3,-1,1,1,-2,1,1,3,1,3,1,2,1,3,-2,-1,1,1,0,2,2,2,3,3,4,-3,2,-1,3,-2,6,3,3,-1,0,2,7,1,0,2,1,2,5,2,3,1,0,3,7,2,1,2,-1,3,7,3,1,3,2,3,3,3,3,3,3,3,8,TRUE,0,76,FALSE,0,54,TRUE,0,100,FALSE,1,52,FALSE,0,52,FALSE,1,100,TRUE,1,52,FALSE,0,60,FALSE,0,59,TRUE,1,85,FALSE,1,51,TRUE,0,90,TRUE,1,51,FALSE,1,55,FALSE,0,51,FALSE,0,52,FALSE,1,52,TRUE,0,85,FALSE,1,51,FALSE,1,51,TRUE,1,79,FALSE,0,54,FALSE,1,65,TRUE,1,81,FALSE,1,100,TRUE,1,83,FALSE,1,55,FALSE,1,87,TRUE,0,54,FALSE,0,74,FALSE,0,57,TRUE,1,65,0.36,0.0289,0.2704,0.2304,0.1225,0,0.0361,0.0225,0.2401,0.2916,0.5476,0.2401,0.3481,0.2401,0.2704,0.2916,0.1225,0.2304,0.0169,0,0.0441,0.2601,0.2401,0.2025,0.2304,0.2025,0.3249,0.5776,1,0.7225,0.2916,0.81,0.2831,0.214542857,0.351657143,8,25,18,56.25,4,50,6,75,5,62.5,3,37.5,7,43.75,11,68.75,66.66,53.75,64.75,73.75,74.38,63.06,70.25,-31.25,10.41,3.75,-10.25,11.25,36.88,19.31,1.5,1,1,3,2,2,1,1,2,0,3,0,2,3,1,1,3,1,1,0,2,1,0,2,1,2,4,0,1,4,2,0,0,1,1,0,5,4,2,2,3,1.8,1.4,1.4,1.4,1.2,2.2,0.4,3.2,1.5,1.75,5.67,5.67,-3,-1,4,-3,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),18,0.625,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,0,1,1,1,0,-3,1,1,-4,1,0,2,2,0,1,-2,-3,-1,-2,-1,0.6,-0.8,1,-1.8,-0.25,HS_TS +824,R_1lDrQCEn5qubXel,32 - 38,American,Male,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,-3,3,-3,3,5,3,3,3,3,3,0,-3,-3,-3,-3,-3,10,3,3,3,3,3,10,3,-3,3,3,3,10,3,3,3,3,3,0,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,0,100,0,1,0,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0.214285714,0.357142857,0.071428571,32,100,25,78.13,8,100,5,62.5,6,75,6,75,10,62.5,15,93.75,100,100,100,100,100,100,100,21.87,21.87,0,37.5,25,25,37.5,6.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,1.2,0,0,1.5,0.3,1.67,6.67,-10,-5,0,5,-5,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),38,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,-6,0,0,0,0,0,0,6,6,6,6,6,0,-1.2,0,6,1.2,grad_prof +825,R_7CPiwAiwByBo9QO,39 - 45,American,Male,1,3,2,3,2,3,1,2,3,2,3,2,2,1,1,3,2,3,2,1,2,2,1,3,3,10,2,3,2,3,1,10,1,2,3,3,2,10,3,1,2,2,3,10,3,2,3,2,1,10,3,2,2,3,1,10,2,1,3,2,3,10,3,2,3,2,1,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,99,TRUE,1,97,FALSE,1,99,TRUE,1,99,TRUE,1,98,TRUE,1,96,TRUE,1,97,FALSE,1,98,TRUE,0,100,FALSE,0,100,FALSE,1,93,TRUE,1,95,TRUE,1,99,FALSE,1,97,TRUE,0,99,FALSE,1,98,FALSE,1,100,TRUE,1,99,TRUE,1,99,FALSE,1,100,TRUE,1,97,FALSE,1,97,TRUE,1,99,FALSE,1,100,FALSE,1,94,FALSE,1,95,TRUE,1,96,TRUE,1,93,TRUE,1,100,0.0004,0.0001,0.0001,0.0001,0,0.0001,0.0009,0.0009,0,0.0001,0.0016,1,0.0016,0.0004,0.0009,0,0,0.9801,0.0036,0.0009,0.0001,0.0025,0.0004,0.0049,0.0009,0,0.0049,0,0,0.9801,0.0025,1,0.142407143,0.1419,0.142914286,32,100,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,15,93.75,13,81.25,97.91,97.38,98.38,97.88,98,97.75,98.06,12.5,10.41,9.88,10.88,10.38,10.5,4,16.81,1,1,1,0,1,1,2,0,0,1,2,0,1,2,1,0,1,1,0,2,2,1,1,1,1,0,1,0,0,1,1,1,1,1,2,0,0,0,0,0,0.8,0.8,1.2,0.8,1.2,0.4,1.2,0,0.9,0.7,10,10,0,0,0,0,0,15 cents,25 minutes,24 days,Male,University - Graduate (Masters),43,0,0,0,0,0,0,1,0,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-1,0,0,-1,0,1,1,0,0,0,1,-1,0,1,-1,0,1,1,0,2,-0.4,0.4,0,0.8,0.2,grad_prof +826,R_5FWZQLK0B9joAw1,25 - 31,Canadian,Male,1,2,1,0,1,0,1,0,-1,0,-1,-1,2,1,0,0,-1,1,0,0,0,1,0,1,-1,3,-2,-1,-1,1,-1,5,0,-1,0,1,0,6,-1,-1,-1,-1,-1,4,1,2,0,1,1,5,1,0,1,-1,1,6,0,0,1,1,1,6,1,1,1,1,0,5,FALSE,1,87,FALSE,0,67,FALSE,1,73,TRUE,0,100,FALSE,0,50,TRUE,0,67,TRUE,1,64,FALSE,0,63,TRUE,1,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,82,FALSE,0,50,TRUE,1,100,TRUE,0,78,TRUE,0,92,FALSE,1,67,FALSE,1,100,FALSE,0,67,FALSE,0,58,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,64,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,89,FALSE,0,50,FALSE,0,58,0.3969,0.4096,0,0.1296,0.3364,0.4489,0.25,0.25,0,0.3364,0.7921,0,0.25,1,0.25,0.4489,0.25,1,0,0.25,0.4489,0.25,0.1089,0.0324,0.6084,0.25,0.25,0.0169,0.0729,0.8464,0.25,1,0.357053571,0.400907143,0.3132,15,46.88,14,43.75,3,37.5,3,37.5,4,50,4,50,4,25,10,62.5,71.12,66.75,65,68.38,84.38,64.38,77.88,3.13,27.37,29.25,27.5,18.38,34.38,39.38,15.38,1,1,1,1,2,2,2,1,2,1,1,0,2,0,0,1,0,2,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,0,1,1,2,0,1,0,1.2,1.6,0.6,1,0.4,0.8,0.8,0.8,1.1,0.7,4.67,5.67,-2,-1,0,-1,-1,10 cents,25 minutes,24 days,Male,University - Undergraduate,27,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,1,0,0,2,1,1,0,2,0,0,-1,1,0,-1,0,-2,2,0,1,0.8,0.8,-0.2,0.2,0.4,C_Ug +827,R_3PdTdTVt4EZ5LdO,25 - 31,American,Male,1,3,2,0,1,1,-1,2,-1,2,2,2,2,3,3,1,1,1,1,0,-1,3,0,-3,3,5,0,-3,2,0,3,4,3,3,3,3,2,6,-1,2,1,0,0,8,2,3,1,0,1,3,1,-3,3,-3,2,0,3,3,3,-1,3,5,3,3,3,3,3,8,TRUE,0,67,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,58,FALSE,1,100,TRUE,1,83,FALSE,0,66,TRUE,1,59,TRUE,1,71,TRUE,0,64,TRUE,0,76,TRUE,1,84,TRUE,0,69,TRUE,1,57,TRUE,1,68,TRUE,0,69,TRUE,0,95,TRUE,0,91,TRUE,0,64,TRUE,1,80,FALSE,0,50,TRUE,0,75,FALSE,0,50,TRUE,0,75,TRUE,1,80,FALSE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,63,TRUE,1,80,FALSE,0,50,0.4356,0.04,0.1024,0.0289,0.25,0,0.25,0.0841,0.4096,0.25,0.1369,0.0256,0.1681,0.4096,0.3364,0.25,0.5625,0.25,0.36,0.5625,0.04,0.1849,0.8281,0.4761,0.4761,0.25,0.04,0.4489,1,0.9025,0.25,0.5776,0.349267857,0.241628571,0.456907143,19,59.38,13,40.63,4,50,4,50,3,37.5,2,25,10,62.5,3,18.75,68.88,62.62,70.75,73.75,68.38,65.56,72.19,18.75,28.25,12.62,20.75,36.25,43.38,3.06,53.44,2,0,2,3,2,1,2,0,1,1,1,1,1,0,1,2,1,0,1,0,1,0,1,0,0,0,2,1,2,0,1,1,1,4,0,2,2,2,2,3,1.8,1,0.8,0.8,0.4,1,1.4,2.2,1.1,1.25,5,2.67,2,4,1,0,2.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,30,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,1,0,1,3,2,1,0,-1,-1,1,0,0,0,-4,1,0,-1,-2,-1,-3,1.4,0,-0.6,-1.4,-0.15,C_Ug +828,R_5aS6ebRQYuxR6vz,25 - 31,American,Male,-1,1,0,-1,-1,0,-1,1,1,1,-1,0,1,-1,1,-1,-1,0,0,-1,-2,3,0,-2,-1,5,1,0,1,1,1,6,1,0,1,0,0,8,1,1,-1,-1,1,7,-1,1,-1,-1,-2,7,0,0,1,0,1,5,-1,1,1,0,2,6,1,1,1,1,-2,9,TRUE,0,88,FALSE,0,82,TRUE,0,88,FALSE,1,75,FALSE,0,88,FALSE,1,88,TRUE,1,90,TRUE,1,86,FALSE,0,87,FALSE,0,85,FALSE,1,86,TRUE,0,89,TRUE,1,86,TRUE,0,90,TRUE,1,89,TRUE,1,88,FALSE,1,84,TRUE,0,88,TRUE,0,90,FALSE,1,70,FALSE,0,90,TRUE,1,59,FALSE,1,59,FALSE,0,57,FALSE,1,56,TRUE,1,96,TRUE,0,57,TRUE,0,51,FALSE,1,56,TRUE,1,87,FALSE,0,61,TRUE,1,76,0.0196,0.0016,0.0144,0.01,0.0576,0.0144,0.3249,0.7225,0.09,0.1681,0.0169,0.0196,0.7569,0.0196,0.7744,0.6724,0.1681,0.0625,0.2601,0.1936,0.81,0.0121,0.81,0.81,0.0256,0.3249,0.3721,0.7744,0.7744,0.7744,0.1936,0.7921,0.385542857,0.276278571,0.494807143,16,50,17,53.13,3,37.5,6,75,4,50,4,50,9,56.25,8,50,78.81,78.38,78.38,81.5,77,81.69,75.94,-3.13,25.68,40.88,3.38,31.5,27,25.44,25.94,1,2,0,1,0,1,1,0,0,0,2,0,0,1,1,2,2,1,1,2,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,2,2,1,1,1,0.8,0.4,0.8,1.6,0.4,0.4,0.6,1.4,0.9,0.7,6.33,6,-2,1,2,-2,0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),29,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,1,2,-1,1,-1,1,0,0,-1,0,2,-1,0,0,0,0,0,0,0,1,0.4,0,0.2,0.2,0.2,HS_TS +829,R_7jU8vCajvbsV8BA,18 - 24,Canadian,Male,2,3,2,2,2,0,0,1,-3,2,2,2,2,0,1,1,2,2,2,1,2,2,2,2,2,3,-1,0,1,-1,1,5,2,2,2,1,2,7,3,2,2,2,2,3,2,3,2,2,2,4,0,0,2,-3,2,2,2,2,2,0,2,4,2,2,2,2,2,5,FALSE,1,90,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,55,TRUE,1,50,TRUE,1,55,FALSE,0,55,TRUE,1,60,FALSE,1,65,TRUE,0,70,TRUE,1,75,TRUE,0,65,FALSE,0,55,TRUE,1,90,TRUE,0,70,TRUE,0,75,TRUE,0,65,FALSE,1,60,FALSE,0,95,TRUE,1,65,TRUE,0,60,FALSE,0,50,TRUE,0,60,TRUE,1,55,TRUE,0,55,TRUE,0,70,TRUE,0,65,TRUE,1,75,FALSE,0,55,FALSE,0,60,0.2025,0.2025,0.01,0.25,0.36,0.3025,0.25,0.16,0.16,0.1225,0.0625,0.0625,0.3025,0.1225,0.25,0.25,0.36,0.25,0.49,0.36,0.9025,0.3025,0.4225,0.4225,0.49,0.3025,0.3025,0.01,0.25,0.5625,0.4225,0.49,0.312321429,0.215357143,0.409285714,12,37.5,14,43.75,3,37.5,1,12.5,5,62.5,5,62.5,9,56.25,5,31.25,63.12,56.25,66.25,65,65,62.19,64.06,-6.25,19.37,18.75,53.75,2.5,2.5,5.94,32.81,0,1,0,0,0,1,0,0,2,1,0,0,0,1,1,2,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0.2,0.8,0.4,0.6,0,0.2,0.2,0.4,0.5,0.2,5,3.33,-1,3,3,-2,1.67,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,20,0.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,1,0,0,0,1,0,-1,2,1,0,0,0,1,0,1,0,0,0,0,0.2,0.6,0.2,0.2,0.3,C_Ug +830,R_6JRPravQkDHvdZn,32 - 38,American,Male,2,2,2,3,2,-3,-1,-2,1,-2,0,0,2,-2,1,-3,-1,-1,0,-2,3,2,3,2,2,9,-2,0,-2,1,1,9,0,0,3,0,1,9,-2,-2,0,-2,-2,10,3,3,3,3,3,7,0,-2,2,-2,0,7,0,0,3,0,2,7,1,3,2,2,0,10,TRUE,0,50,TRUE,1,60,FALSE,1,50,TRUE,0,60,TRUE,1,60,TRUE,0,70,TRUE,1,90,TRUE,1,90,TRUE,1,60,TRUE,1,90,FALSE,1,50,TRUE,0,80,TRUE,1,90,FALSE,1,60,TRUE,1,60,TRUE,1,100,TRUE,0,55,TRUE,0,70,TRUE,0,70,FALSE,1,50,TRUE,1,60,TRUE,1,100,FALSE,1,90,TRUE,1,55,TRUE,0,90,TRUE,1,55,TRUE,0,75,TRUE,0,60,TRUE,0,90,TRUE,1,90,TRUE,1,55,TRUE,1,90,0.01,0.2025,0,0.01,0.01,0.49,0.2025,0.01,0.25,0,0.01,0.01,0.16,0.25,0.16,0.16,0.01,0.36,0.36,0.81,0.16,0.16,0.49,0.16,0.3025,0.5625,0.2025,0.25,0.25,0.49,0.81,0.64,0.276071429,0.14875,0.403392857,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,16,100,5,31.25,71.09,61.25,75.62,75.62,71.88,75.31,66.88,-3.13,5.46,-1.25,13.12,13.12,-3.12,-24.69,35.63,1,0,1,1,0,1,1,0,0,3,0,0,1,2,0,1,1,1,2,0,1,1,1,0,1,3,1,4,3,2,0,0,1,2,1,4,4,3,2,2,0.6,1,0.6,1,0.8,2.6,0.8,3,0.8,1.8,9,7,2,2,2,0,2,10 cents,100 minutes,47 days,Male,High School (or equivalent),38,1.25,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,0,-1,0,1,-1,-2,0,-4,-3,1,0,0,0,0,-1,-3,-3,-2,0,-2,-0.2,-1.6,-0.2,-2,-1,HS_TS +831,R_37aADac832DvBND,32 - 38,American,Male,2,2,2,2,2,-1,-1,1,-1,3,2,2,2,2,2,-1,0,0,2,-1,2,2,2,2,2,7,0,1,1,1,0,9,1,1,1,1,1,9,-1,0,0,0,-1,8,2,2,2,2,2,8,0,0,2,0,1,4,2,1,2,0,1,4,2,2,2,2,1,5,FALSE,1,95,TRUE,1,79,FALSE,1,74,FALSE,1,75,TRUE,1,100,FALSE,1,75,TRUE,1,90,TRUE,1,94,TRUE,1,92,TRUE,1,96,FALSE,1,92,TRUE,0,86,FALSE,0,81,FALSE,1,86,TRUE,1,86,TRUE,1,85,TRUE,0,93,TRUE,0,71,FALSE,1,69,TRUE,0,73,TRUE,1,100,TRUE,1,100,FALSE,1,85,TRUE,1,87,FALSE,1,87,TRUE,1,90,FALSE,1,89,FALSE,1,83,TRUE,0,72,FALSE,0,85,TRUE,1,81,TRUE,1,83,0.0036,0.01,0.0225,0.01,0.0289,0.0625,0.0169,0.0016,0.5329,0,0.7225,0.6561,0.0064,0.0064,0,0.0441,0.0225,0.0625,0.0289,0.0169,0,0.0196,0.0961,0.0196,0.8649,0.0121,0.0361,0.0025,0.0676,0.5041,0.5184,0.7396,0.181775,0.154521429,0.209028571,26,81.25,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,85.44,82.88,86.12,89.38,83.38,89.31,81.56,3.12,7.31,-17.12,23.62,1.88,20.88,1.81,12.81,0,0,0,0,0,1,2,0,2,3,1,1,1,1,1,0,0,0,2,0,0,0,0,0,0,1,1,1,1,2,0,1,0,2,1,3,2,2,0,2,0,1.6,1,0.4,0,1.2,0.8,1.8,0.75,0.95,8.33,5.33,-1,5,5,3,3,10 cents,100 minutes,24 days,Male,University - Undergraduate,32,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,0,1,-1,1,1,1,0,1,-1,0,-3,-2,-2,2,-2,0,0.4,0.2,-1.4,-0.2,C_Ug +832,R_1GQif6oeHhhHPwm,39 - 45,Canadian,Male,-3,0,3,1,3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,10,TRUE,0,85,TRUE,1,100,FALSE,1,56,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.7225,0.1936,0.25,0.25,0.25,0.255932143,0.232142857,0.279721429,5,15.63,17,53.13,6,75,5,62.5,3,37.5,3,37.5,6,37.5,11,68.75,52.84,56.25,50,54.38,50.75,53.12,52.56,-37.5,-0.29,-18.75,-12.5,16.88,13.25,15.62,-16.19,0,3,6,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.8,0,0,0,3.8,0,0,0,0.95,0.95,0,0,0,0,0,-10,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),40,0,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +833,R_1uJQeGZjWt5MvwB,25 - 31,American,Male,1,2,1,0,1,1,2,1,0,1,2,1,1,2,1,2,2,1,1,1,1,1,2,2,2,7,2,1,1,2,1,8,1,2,1,2,1,7,1,2,1,1,2,6,1,2,1,1,2,7,1,1,1,2,2,8,1,2,1,2,1,6,1,2,2,1,1,5,TRUE,0,79,TRUE,1,69,TRUE,0,78,TRUE,0,74,TRUE,1,79,TRUE,0,75,TRUE,1,76,TRUE,1,72,TRUE,1,85,TRUE,1,80,TRUE,0,64,TRUE,0,79,TRUE,1,76,TRUE,0,75,TRUE,1,84,TRUE,1,73,TRUE,0,79,TRUE,0,77,FALSE,1,60,TRUE,0,80,TRUE,1,83,TRUE,1,84,TRUE,0,80,TRUE,1,76,TRUE,0,86,TRUE,1,78,TRUE,0,87,TRUE,0,78,FALSE,1,72,TRUE,1,74,TRUE,1,66,TRUE,1,76,0.0784,0.0484,0.0729,0.0576,0.0576,0.5625,0.0576,0.04,0.64,0.0256,0.0676,0.0576,0.0225,0.4096,0.0441,0.0961,0.64,0.5476,0.6084,0.7396,0.0289,0.0256,0.16,0.5625,0.6241,0.7569,0.1156,0.6241,0.6084,0.5929,0.0784,0.6241,0.336353571,0.233457143,0.43925,29,90.63,18,56.25,5,62.5,5,62.5,4,50,4,50,16,100,2,12.5,76.69,73.62,77.5,79.38,76.25,76.94,76.44,34.38,20.44,11.12,15,29.38,26.25,-23.06,63.94,0,1,1,2,1,1,1,0,2,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,1,0,2,1,1,1,0,0,0,1,0,1,0,0,1,0.8,0.4,0.4,0.4,0.8,0.4,0.4,0.65,0.5,7.33,7,0,0,1,1,0.33,10 cents,100 minutes,15 days,Male,University - PhD,30,0,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,1,1,1,0,1,0,0,0,-1,0,0,0,0,0,0,0,-1,0,1,0.6,0,0,0,0.15,grad_prof +834,R_3dG7OKXUX6VUzWF,25 - 31,American,Male,-1,2,3,3,2,3,2,2,-2,3,1,3,3,3,2,2,2,3,3,1,0,2,3,2,3,4,3,2,3,-3,2,8,3,1,3,2,2,7,2,3,3,3,2,6,0,2,3,3,2,7,3,3,2,-3,2,5,3,2,3,3,2,7,3,3,3,2,1,8,TRUE,0,76,FALSE,0,87,FALSE,1,84,FALSE,1,70,FALSE,0,100,FALSE,1,85,TRUE,1,86,TRUE,1,79,FALSE,0,76,FALSE,0,66,FALSE,1,86,FALSE,1,70,TRUE,1,80,TRUE,0,90,FALSE,0,68,TRUE,1,100,FALSE,1,77,TRUE,0,100,FALSE,1,76,FALSE,1,88,FALSE,0,100,TRUE,1,95,FALSE,1,80,TRUE,1,95,FALSE,1,77,FALSE,0,100,FALSE,1,81,FALSE,1,70,TRUE,0,100,FALSE,0,85,FALSE,0,65,FALSE,0,79,0.0441,1,0,0.0196,0.6241,0.0225,0.0025,0.4356,0.0144,0.0025,0.7225,0.04,0.5776,0.0196,1,0.7569,0.04,0.09,0.09,0.0529,1,0.4624,0.0576,0.81,0.0529,0.0361,0.4225,0.5776,0.0256,1,1,0.09,0.358064286,0.310585714,0.405542857,15,46.88,18,56.25,4,50,4,50,3,37.5,7,87.5,6,37.5,12,75,83.47,76.12,87.62,86.25,83.88,85.06,81.88,-9.37,27.22,26.12,37.62,48.75,-3.62,47.56,6.88,1,0,0,1,1,0,0,1,1,1,2,2,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,2,1,0,0,0,1,1,0,1,0,0.6,0.6,1,0.4,0.2,0.6,0.6,0.6,0.65,0.5,6.33,6.33,-3,3,0,-2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,26,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,1,1,0,-1,1,0,0,0,1,0,1,0,-1,0,0,-1,1,0.4,0,0.4,-0.2,0.15,C_Ug +835,R_1GU2LMYusQivyVR,39 - 45,American,Male,2,2,1,1,2,1,2,3,0,2,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,9,2,1,2,1,1,10,2,2,1,1,1,10,2,1,1,2,2,10,2,1,1,1,2,9,1,1,1,0,1,8,1,1,1,2,1,9,1,2,1,2,1,10,FALSE,1,100,TRUE,1,95,FALSE,1,95,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,95,FALSE,0,90,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,95,TRUE,0,90,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,85,TRUE,1,87,FALSE,1,96,TRUE,0,77,TRUE,0,96,TRUE,1,100,TRUE,1,76,TRUE,1,75,0,0.0169,0,0,0.0625,0,0,0,0,0,0,0.81,0.0025,0,0,0.0025,0,0.01,0.5929,0.7225,0,0.0025,0,0,0.0025,0.0016,0.0576,0,0.0025,0.81,0.9216,0.0025,0.142989286,0.063392857,0.222585714,32,100,27,84.38,8,100,6,75,6,75,7,87.5,15,93.75,12,75,94.75,93.38,94.5,95.25,95.88,94.56,94.94,15.62,10.37,-6.62,19.5,20.25,8.38,0.81,19.94,1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,2,0,1,0,0,1,1,1,0,1,0,1,0,0.6,1,0.8,0.6,0.2,0.8,0.6,0.4,0.75,0.5,9.67,8.67,0,2,1,0,1,5 cents,5 minutes,47 days,Male,University - PhD,44,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,1,0,0,0,1,1,0,-1,1,0,1,1,0,-1,0,1,-1,0,0,1,0.4,0.2,0.2,0.2,0.25,grad_prof +836,R_19om6KG1zhLsRrh,39 - 45,American,Male,0,-1,3,-1,2,1,1,0,0,1,1,3,2,2,3,1,1,1,2,0,2,2,2,1,0,8,2,2,2,1,3,9,-1,-1,0,1,1,8,2,1,2,2,0,10,2,3,2,1,2,9,3,2,2,1,3,10,0,2,1,1,-1,9,2,1,2,2,3,9,FALSE,1,70,TRUE,1,70,TRUE,0,100,FALSE,1,59,FALSE,0,73,FALSE,1,60,FALSE,0,68,TRUE,1,57,TRUE,1,62,TRUE,1,69,FALSE,1,64,TRUE,0,100,FALSE,0,63,FALSE,1,62,FALSE,0,68,FALSE,0,69,FALSE,1,67,TRUE,0,72,FALSE,1,78,FALSE,1,81,TRUE,1,73,FALSE,0,79,FALSE,1,68,TRUE,1,65,TRUE,0,69,TRUE,1,70,FALSE,1,76,TRUE,0,75,FALSE,1,87,TRUE,1,93,FALSE,0,77,TRUE,1,75,0.1849,0.09,0.4761,0.4624,0.0625,0.16,0.1225,0.0961,0.0361,0.6241,0.0049,0.3969,0.1444,0.1296,0.5329,0.09,0.1024,0.1681,0.5625,0.4761,0.0729,0.4624,0.0484,0.1444,0.1089,0.0576,0.5929,0.09,1,0.5184,0.0169,1,0.279353571,0.19075,0.367957143,19,59.38,20,62.5,6,75,6,75,4,50,4,50,9,56.25,11,68.75,72.47,69.25,70.75,69.88,80,70.69,74.25,-3.12,9.97,-5.75,-4.25,19.88,30,14.44,5.5,2,3,1,2,2,1,1,2,1,2,2,4,2,1,2,1,0,1,0,0,2,4,1,2,0,2,1,2,1,2,1,1,1,1,4,1,0,1,0,3,2,1.4,2.2,0.4,1.8,1.6,1.6,1,1.5,1.5,8.33,9.33,-1,-1,-1,1,-1,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,-1,0,0,2,-1,0,0,0,0,1,3,1,0,-2,0,0,0,0,-3,0.2,-0.2,0.6,-0.6,0,C_Ug +837,R_6sKu4twJjm42oXT,39 - 45,American,Male,3,-1,1,-1,3,0,2,3,1,0,-1,-1,3,-2,3,-1,-1,0,-1,-1,3,-2,2,-1,3,1,0,3,3,3,0,10,-1,-1,3,3,3,10,2,-3,-3,-3,-3,10,3,-1,-1,-1,2,6,0,2,3,-1,0,5,-1,-1,3,-2,3,5,1,0,-1,0,-2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,99,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0.81,0,0,0,0,0,0.25,0.9801,0,0,0,0,0,1,0.25,0,1,0,1,0,0,0.224646429,0.147142857,0.30215,31,96.88,25,78.13,7,87.5,6,75,6,75,6,75,14,87.5,11,68.75,96.53,87.5,98.75,100,99.88,99.38,93.69,18.75,18.4,0,23.75,25,24.88,11.88,24.94,0,1,1,0,0,0,1,0,2,0,0,0,0,5,0,3,2,3,2,2,0,0,2,0,1,0,0,0,2,0,0,0,0,0,0,2,1,1,1,1,0.4,0.6,1,2.4,0.6,0.4,0,1.2,1.1,0.55,7,5.33,-5,5,5,5,1.67,5 cents,5 minutes,47 days,Male,University - Undergraduate,42,2,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,1,-1,0,-1,0,1,0,0,0,0,0,0,5,0,1,1,2,1,1,-0.2,0.2,1,1.2,0.55,C_Ug +838,R_1LUz4Ap00xqEBFe,39 - 45,American,Female,3,3,-2,2,3,1,-3,2,-3,3,2,0,3,-2,3,-2,-2,1,0,-2,-2,3,3,-3,2,8,2,2,-2,1,3,8,-3,-2,2,2,2,9,-2,-2,-2,-3,-3,8,3,3,0,3,3,2,-2,-3,3,-3,3,0,3,3,-2,-3,3,1,2,2,3,2,3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,95,TRUE,0,96,TRUE,0,97,FALSE,0,98,TRUE,1,100,TRUE,0,100,TRUE,1,99,FALSE,1,96,TRUE,1,100,TRUE,0,97,TRUE,0,99,TRUE,0,99,TRUE,1,96,FALSE,0,90,TRUE,1,99,0,0,0,0,0.0001,1,0.0001,0,0.9409,0,0.0016,0,0,0.9801,0,0,1,1,0.9801,0.0016,0.9604,0,0.9216,1,0.9801,0.9409,0.81,0,1,0.9025,0.9801,1,0.550003571,0.351628571,0.748378571,32,100,16,50,3,37.5,3,37.5,6,75,4,50,14,87.5,2,12.5,98.72,97.75,99.38,98.88,98.88,98.88,98.56,50,48.72,60.25,61.88,23.88,48.88,11.38,86.06,5,0,5,5,1,1,5,4,4,0,5,2,1,4,1,0,0,3,3,1,0,0,2,1,0,3,0,1,0,0,1,3,5,1,0,4,4,2,2,5,3.2,2.8,2.6,1.4,0.6,0.8,2,3.4,2.5,1.7,8.33,1,6,8,8,8,7.33,10 cents,5 minutes,24 days,Female,University - Undergraduate,45,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,5,0,3,4,1,-2,5,3,4,0,4,-1,-4,3,1,-4,-4,1,1,-4,2.6,2,0.6,-2,0.8,C_Ug +839,R_5FROcjSqTWns2vu,25 - 31,American,Male,2,3,2,2,2,2,2,2,3,3,3,2,2,3,2,2,3,2,2,3,2,2,2,2,2,6,2,1,1,2,2,4,2,1,2,2,2,6,1,2,2,2,2,2,3,3,1,3,2,2,3,3,2,3,2,8,2,2,1,2,2,6,2,3,3,3,3,10,TRUE,0,83,TRUE,1,82,FALSE,1,63,TRUE,0,83,TRUE,1,80,TRUE,0,93,TRUE,1,78,TRUE,1,85,FALSE,0,58,TRUE,1,64,TRUE,0,55,TRUE,0,78,FALSE,0,56,TRUE,0,59,TRUE,1,61,TRUE,1,59,TRUE,0,55,FALSE,1,76,TRUE,0,54,TRUE,0,58,TRUE,1,57,TRUE,1,59,TRUE,0,57,TRUE,1,61,FALSE,1,85,FALSE,0,65,TRUE,0,55,TRUE,0,73,FALSE,1,83,FALSE,0,70,TRUE,1,68,TRUE,1,62,0.0225,0.4225,0.1681,0.0484,0.1444,0.8649,0.1521,0.1296,0.3364,0.1681,0.49,0.3136,0.3364,0.3025,0.04,0.0324,0.3249,0.6889,0.5329,0.0225,0.1849,0.1521,0.2916,0.3481,0.3025,0.3025,0.1024,0.6889,0.1369,0.0576,0.0289,0.6084,0.288728571,0.308871429,0.268585714,20,62.5,16,50,3,37.5,4,50,5,62.5,4,50,12,75,4,25,67.97,64.5,67.88,71.12,68.38,66.56,69.38,12.5,17.97,27,17.88,8.62,18.38,-8.44,44.38,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0.2,0.8,0.6,0.6,0.6,0.6,0.6,0.4,0.55,0.55,5.33,5.33,4,-4,0,-8,0,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),30,0.125,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,1,-1,-1,0,-1,0,1,1,0,0,1,-1,0,0,1,1,-1,-1,1,-0.4,0.2,0,0.2,0,grad_prof +840,R_3QilYYtmKHDOMlb,32 - 38,American,Male,2,3,2,3,2,3,1,3,0,0,3,3,3,2,3,2,1,2,1,3,-1,2,2,3,1,5,1,3,1,0,0,8,-1,1,-1,0,-1,10,1,3,2,3,3,8,3,3,3,3,1,7,3,0,3,0,2,5,3,2,3,2,3,5,2,2,3,2,3,8,TRUE,0,76,TRUE,1,100,TRUE,0,77,FALSE,1,84,TRUE,1,100,FALSE,1,95,FALSE,0,89,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,79,TRUE,0,87,TRUE,1,100,FALSE,1,79,TRUE,1,82,TRUE,1,100,TRUE,0,100,TRUE,0,88,FALSE,1,96,FALSE,1,100,FALSE,0,88,FALSE,0,93,FALSE,1,81,TRUE,1,65,FALSE,1,100,TRUE,1,90,FALSE,1,76,TRUE,0,100,TRUE,0,97,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.01,0,0.7921,0,0.0025,0.1225,0,0,0.8649,0,0,0,0.0441,0,0,0.0361,0.0256,1,0,0.7744,0.0324,0.0016,0.0441,1,0.0576,1,0.5776,0.5929,0.7744,0.9409,0.7569,0.308875,0.078264286,0.539485714,28,87.5,21,65.63,7,87.5,5,62.5,4,50,5,62.5,12,75,9,56.25,91.31,89.62,95.12,89.38,91.12,94.19,88.44,21.87,25.68,2.12,32.62,39.38,28.62,19.19,32.19,3,1,0,0,1,2,2,2,0,0,4,2,4,2,4,1,2,0,2,0,1,0,1,0,1,0,1,0,0,2,0,1,0,0,0,0,1,1,1,0,1,1.2,3.2,1,0.6,0.6,0.2,0.6,1.6,0.5,7.67,5.67,-2,3,5,0,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,1,-1,0,0,2,1,2,0,-2,4,1,4,2,4,1,1,-1,1,0,0.4,0.6,3,0.4,1.1,HS_TS +841,R_5ZIfIu4LYO9gDKY,39 - 45,American,Male,2,2,2,2,2,1,3,1,1,1,3,2,3,3,2,2,2,1,1,2,3,2,2,3,2,8,1,1,1,1,1,9,1,1,2,3,1,8,3,3,3,3,3,8,1,1,1,3,3,7,1,1,1,1,1,7,1,1,1,1,1,9,3,3,0,3,2,8,TRUE,0,86,TRUE,1,87,TRUE,0,82,TRUE,0,87,TRUE,1,78,TRUE,0,78,TRUE,1,88,TRUE,1,86,TRUE,1,85,TRUE,1,81,TRUE,0,78,TRUE,0,80,TRUE,1,85,TRUE,0,82,TRUE,1,78,TRUE,1,87,TRUE,0,81,TRUE,0,80,TRUE,0,85,TRUE,0,81,TRUE,1,84,TRUE,1,88,TRUE,0,78,TRUE,1,75,TRUE,0,90,TRUE,1,74,TRUE,0,71,TRUE,0,83,TRUE,0,87,TRUE,1,87,TRUE,1,87,TRUE,1,82,0.0196,0.0676,0.0169,0.0144,0.0324,0.6084,0.0625,0.0361,0.6561,0.0144,0.0169,0.0225,0.0225,0.6084,0.0484,0.0169,0.6084,0.7569,0.6889,0.81,0.0256,0.0484,0.7225,0.6724,0.6561,0.5041,0.0169,0.7396,0.6724,0.64,0.7569,0.64,0.396592857,0.250771429,0.542414286,28,87.5,16,50,4,50,4,50,4,50,4,50,16,100,0,0,82.53,82.25,81.62,83.62,82.62,83.25,81.81,37.5,32.53,32.25,31.62,33.62,32.62,-16.75,81.81,1,0,0,1,0,0,2,0,0,0,2,1,1,0,1,1,1,2,2,1,1,1,1,1,1,0,2,0,0,0,2,1,2,2,1,1,1,1,2,0,0.4,0.4,1,1.4,1,0.4,1.6,1,0.8,1,8.33,7.67,1,2,-1,0,0.66,5 cents,25 minutes,15 days,Male,University - Graduate (Masters),42,0.25,1,0,0,0,0,0,0.33,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,-1,-1,0,-1,0,0,0,0,0,0,0,-1,-2,0,0,0,1,0,1,-0.6,0,-0.6,0.4,-0.2,grad_prof +842,R_1UbbhiHgu7q1d7S,25 - 31,American,Male,-1,2,2,1,1,0,-1,1,0,1,2,0,2,0,2,1,0,3,0,2,2,2,2,-2,2,8,2,0,-2,-1,-2,8,2,1,1,1,2,8,0,-1,2,1,0,8,-1,1,1,-1,2,7,2,-2,1,-1,2,9,2,2,1,2,2,8,1,1,2,2,2,8,FALSE,1,87,TRUE,1,73,TRUE,0,75,FALSE,1,98,TRUE,1,98,FALSE,1,99,TRUE,1,69,TRUE,1,100,TRUE,1,98,TRUE,1,99,FALSE,1,75,TRUE,0,67,TRUE,1,92,FALSE,1,74,TRUE,1,87,TRUE,1,95,FALSE,1,81,FALSE,1,91,FALSE,1,91,FALSE,1,65,TRUE,1,81,TRUE,1,87,FALSE,1,91,FALSE,0,73,FALSE,1,92,TRUE,1,86,FALSE,1,89,FALSE,1,91,FALSE,1,61,TRUE,1,85,TRUE,1,75,TRUE,1,91,0,0.0196,0.0025,0.0961,0.0081,0.0001,0.5329,0.0001,0.1225,0.0169,0.0225,0.0064,0.0004,0.0625,0.0004,0.0729,0.0081,0.0004,0.0081,0.0064,0.0361,0.0169,0.0081,0.0676,0.0361,0.0121,0.0625,0.0169,0.5625,0.0081,0.1521,0.4489,0.082021429,0.061014286,0.103028571,24,75,29,90.63,8,100,8,100,8,100,5,62.5,15,93.75,14,87.5,84.88,85.75,86.75,85.62,81.38,86.81,82.94,-15.63,-5.75,-14.25,-13.25,-14.38,18.88,-6.94,-4.56,3,0,0,3,1,2,1,3,1,3,0,1,1,1,0,1,1,1,1,2,0,1,1,2,1,2,1,0,1,1,0,2,1,2,0,0,1,1,2,0,1.4,2,0.6,1.2,1,1,1,0.8,1.3,0.95,8,8,1,-1,0,0,0,5 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),27,0.875,1,0,0,0,1,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,3,-1,-1,1,0,0,0,3,0,2,0,-1,0,-1,0,1,0,0,-1,2,0.4,1,-0.4,0.4,0.35,grad_prof +843,R_1hG7SPwTVGonzr7,32 - 38,American,Male,3,3,3,3,3,3,0,3,1,3,2,-3,3,0,3,-1,1,-1,1,0,3,3,3,3,3,3,3,0,3,2,3,1,2,-3,3,0,3,2,1,1,2,3,2,8,3,3,3,3,3,3,3,0,3,3,3,3,2,-3,3,0,3,2,-3,-3,-3,-3,-3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,81,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,97,FALSE,1,100,TRUE,1,93,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,78,FALSE,1,96,TRUE,0,100,FALSE,0,100,TRUE,1,97,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0.0009,0,0,0.0081,0,0,0.0361,0.0016,0,0,0.0049,0,0,1,0.6084,0.0009,0,1,1,1,1,0.237889286,0.07465,0.401128571,29,90.63,25,78.13,7,87.5,6,75,7,87.5,5,62.5,15,93.75,10,62.5,97.91,93.62,98.5,100,99.5,98.62,97.19,12.5,19.78,6.12,23.5,12.5,37,4.87,34.69,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,3,2,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,4,2,4,3,0,0.2,0,1.8,0,0.4,0,3,0.5,0.85,2,2.67,0,-2,0,-2,-0.67,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,34,1.375,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-4,1,-2,-1,0,-0.2,0,-1.2,-0.35,C_Ug +844,R_7VC9MkNQAU53tAJ,25 - 31,Canadian,Male,2,3,2,3,0,2,0,3,-2,3,0,0,3,0,3,2,3,3,3,3,-3,3,3,-3,-3,9,-3,0,-3,1,-3,9,3,-3,3,-3,3,8,-2,-3,-1,-3,3,10,0,3,0,3,1,4,3,-3,3,-3,3,5,0,3,3,1,3,4,3,3,3,3,3,4,FALSE,1,90,TRUE,1,95,TRUE,0,100,FALSE,1,52,FALSE,0,52,FALSE,1,100,TRUE,1,100,FALSE,0,61,TRUE,1,55,TRUE,1,96,FALSE,1,52,TRUE,0,100,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,1,69,FALSE,1,50,TRUE,1,100,TRUE,0,73,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,79,TRUE,1,100,0.3721,0,0.25,0,0,0,0,0.0016,0.25,0.0961,0.25,0.04,0.2025,0.2304,0.2704,0.0025,0.25,0.2304,0.25,0.5329,0.25,0.25,1,0.25,0.25,0.25,0.0441,0.01,1,1,0.25,1,0.291460714,0.130278571,0.452642857,16,50,22,68.75,6,75,6,75,6,75,4,50,11,68.75,11,68.75,72,66.62,66.5,84.75,70.12,74.19,69.81,-18.75,3.25,-8.38,-8.5,9.75,20.12,5.44,1.06,5,0,1,6,3,5,0,6,3,6,3,3,0,3,0,4,6,4,6,0,2,0,2,0,1,1,3,0,1,0,0,3,0,1,0,1,0,0,0,0,3,4,1.8,4,1,1,0.8,0.2,3.2,0.75,8.67,4.33,5,4,4,6,4.34,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,3,0,-1,6,2,4,-3,6,2,6,3,0,0,2,0,3,6,4,6,0,2,3,1,3.8,2.45,C_Ug +845,R_5lPlbGTB3MWad44,18 - 24,Canadian,Male,2,3,3,-1,2,2,-2,1,-2,3,1,-2,2,1,3,-1,-1,1,1,2,2,3,3,-3,2,0,2,-3,2,-3,3,1,2,1,1,0,3,2,3,3,3,1,3,3,2,3,3,1,3,1,2,-2,2,-3,3,2,1,-1,2,2,3,2,2,2,2,2,1,8,TRUE,0,100,FALSE,0,80,TRUE,0,75,FALSE,1,58,TRUE,1,100,FALSE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,0,90,TRUE,0,95,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,0,95,FALSE,1,100,TRUE,0,65,FALSE,1,60,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,90,FALSE,0,95,FALSE,0,67,TRUE,1,99,0,0,0,0,0.0001,0.0009,0,0.0001,0.16,0,0.9025,0.0025,0,0.81,0,0.64,0,0.1764,0,0,0,0.0016,0.4225,0,0.9025,0.25,0.4489,1,0.5625,0,0.81,0.9025,0.285464286,0.192321429,0.378607143,25,78.13,21,65.63,3,37.5,6,75,7,87.5,5,62.5,13,81.25,8,50,90.81,75.75,97,99.88,90.62,95.69,85.94,12.5,25.18,38.25,22,12.38,28.12,14.44,35.94,0,0,0,2,0,0,1,1,1,0,1,3,1,1,0,4,4,2,0,1,0,0,0,2,1,0,0,1,1,0,0,1,0,1,0,3,3,1,1,1,0.4,0.6,1.2,2.2,0.6,0.4,0.4,1.8,1.1,0.8,1,1.67,-1,-1,0,-5,-0.67,10 cents,100 minutes,47 days,Male,University - Undergraduate,24,1,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,-1,0,1,0,0,0,1,2,1,0,0,1,1,1,-1,0,-0.2,0.2,0.8,0.4,0.3,C_Ug +846,R_12KBIr7QMRhgQ9J,18 - 24,American,Male,3,2,0,1,2,2,1,-2,-1,0,2,3,1,-1,0,-1,2,-2,1,0,1,-2,0,-3,-1,4,2,0,2,0,-1,8,-1,-1,-2,-2,1,3,0,-1,-2,1,2,3,-1,0,1,-2,2,6,-1,1,0,-1,2,4,2,-1,1,3,1,5,2,3,3,2,1,6,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,52,TRUE,1,79,FALSE,1,54,TRUE,1,90,TRUE,1,77,TRUE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,52,TRUE,1,100,FALSE,1,100,FALSE,0,59,TRUE,1,100,FALSE,1,58,TRUE,0,100,TRUE,0,100,FALSE,1,55,FALSE,0,54,FALSE,0,54,FALSE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,FALSE,1,62,FALSE,1,59,TRUE,0,100,FALSE,0,100,FALSE,0,63,TRUE,1,100,0.0529,0,0,0.01,0,0.2116,0,0,0.2025,0.2916,1,0,0,0.64,0.0441,1,0,0.2704,0.1681,0.4096,0.2916,0.3481,1,0,0.1764,0.1444,0.3969,1,0,1,1,0.2704,0.352346429,0.261442857,0.44325,22,68.75,18,56.25,2,25,6,75,4,50,6,75,10,62.5,8,50,81.62,77,80.62,88.5,80.38,86,77.25,12.5,25.37,52,5.62,38.5,5.38,23.5,27.25,2,4,0,4,3,0,1,4,1,1,3,4,3,1,1,1,3,0,0,2,4,2,1,3,0,3,0,2,0,2,0,4,0,4,1,3,1,5,1,1,2.6,1.4,2.4,1.2,2,1.4,1.8,2.2,1.9,1.85,5,5,-2,4,-2,-3,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,-0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,-2,2,-1,1,3,-3,1,2,1,-1,3,0,3,-3,0,-2,2,-5,-1,1,0.6,0,0.6,-1,0.05,C_Ug +847,R_3O6paGKu9Eu6TGz,18 - 24,American,Male,1,2,0,0,3,-1,-1,-1,-1,3,-2,-3,3,-2,3,-2,0,3,-1,-1,-1,1,1,0,2,2,0,-2,-1,1,2,1,-2,-3,2,-2,3,1,-1,1,3,1,-2,3,1,2,0,0,3,1,0,-1,-1,0,3,1,-3,-3,3,-3,3,1,0,1,2,1,-1,5,FALSE,1,60,TRUE,1,50,TRUE,0,60,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,75,TRUE,1,55,TRUE,1,90,TRUE,1,60,FALSE,1,50,TRUE,0,90,FALSE,0,70,TRUE,0,55,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,60,TRUE,0,75,FALSE,1,50,TRUE,1,95,TRUE,1,50,TRUE,0,50,TRUE,1,75,FALSE,1,90,TRUE,1,60,TRUE,0,50,TRUE,0,90,FALSE,1,60,FALSE,0,80,FALSE,0,90,TRUE,1,55,0.2025,0.16,0.25,0.0625,0.2025,0.25,0.0625,0.16,0.25,0.25,0.64,0.49,0.01,0.25,0.25,0.25,0.25,0.25,0.81,0.01,0.0025,0.25,0.5625,0.3025,0.25,0.25,0.81,0.16,0.36,0.36,0.16,0.81,0.309375,0.254642857,0.364107143,24,75,18,56.25,4,50,4,50,6,75,4,50,13,81.25,5,31.25,63.91,63.12,60,63.75,68.75,65.94,61.88,18.75,7.66,13.12,10,-11.25,18.75,-15.31,30.63,2,1,1,0,1,1,1,0,2,1,0,0,1,0,0,1,1,0,2,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,2,1,1,2,0,1,1,0.2,1,0,0.4,0.4,1.2,0.8,0.5,1.33,1,1,0,0,-2,0.33,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,0.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,2,1,1,0,1,0,1,0,1,1,-1,0,1,-1,0,-1,0,-1,0,1,1,0.6,-0.2,-0.2,0.3,HS_TS +848,R_19b31cGhKIE1KVF,25 - 31,American,Male,3,3,3,2,2,1,2,3,-2,3,3,1,2,-1,3,2,1,0,0,-2,3,3,3,3,3,0,3,-3,1,-2,3,2,3,1,2,0,3,0,-1,1,-1,-1,2,2,3,2,3,3,3,1,3,-3,3,-3,3,0,3,0,2,1,3,7,2,3,0,3,-1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,0,50,TRUE,0,94,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,0,100,FALSE,0,50,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0.25,0.25,0.25,0.01,0.01,0,0,0.25,0.0025,0.25,0,0,0,0.25,0.8836,0,0,0.25,0,1,0,1,1,0.210932143,0.090892857,0.330971429,28,87.5,23,71.88,7,87.5,6,75,6,75,4,50,13,81.25,10,62.5,86.53,84.38,87.5,93,81.25,86.88,86.19,15.62,14.65,-3.12,12.5,18,31.25,5.63,23.69,0,0,0,1,1,2,5,2,0,0,0,0,0,1,0,3,0,1,1,4,0,1,0,1,1,2,5,0,1,0,0,1,0,2,0,0,2,0,3,1,0.4,1.8,0.2,1.8,0.6,1.6,0.6,1.2,1.05,1,0.67,2.67,-1,2,-7,-6,-2,10 cents,5 minutes,24 days,Male,University - Undergraduate,30,0.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,-1,0,0,0,0,0,2,-1,0,0,-1,0,-1,0,3,-2,1,-2,3,-0.2,0.2,-0.4,0.6,0.05,C_Ug +849,R_3BAOztTRoiGCqad,39 - 45,American,Male,3,3,3,3,3,3,-3,3,-3,3,3,2,3,3,2,3,3,3,3,-1,2,2,2,2,2,6,1,1,3,-2,2,9,1,1,1,1,0,8,2,3,3,1,2,9,3,3,3,3,3,9,1,-3,2,-3,3,9,3,3,3,3,3,10,0,3,3,2,-2,8,TRUE,0,100,TRUE,1,100,TRUE,0,82,TRUE,0,82,TRUE,1,80,FALSE,1,88,TRUE,1,100,TRUE,1,64,TRUE,1,82,TRUE,1,76,TRUE,0,80,TRUE,0,76,TRUE,1,74,TRUE,0,99,TRUE,1,71,FALSE,0,100,TRUE,0,87,TRUE,0,82,FALSE,1,92,FALSE,1,86,TRUE,1,83,TRUE,1,87,FALSE,1,92,TRUE,1,85,TRUE,0,99,FALSE,0,82,TRUE,0,78,FALSE,1,94,TRUE,0,86,TRUE,1,86,TRUE,1,86,TRUE,1,86,0.1296,0.6724,1,0,0.0196,0.0144,0.0225,0.0576,0.0196,0.0169,0.0196,0.0676,0.0324,0.64,0.04,0,0.0064,0.6724,0.0036,0.9801,0.0289,0.0841,0.0064,0.9801,0.7569,0.6084,0.0196,1,0.6724,0.6724,0.7396,0.5776,0.312825,0.116357143,0.509292857,17,53.13,19,59.38,5,62.5,6,75,3,37.5,5,62.5,14,87.5,5,31.25,85.78,83.88,84.5,90.62,84.12,83.88,87.69,-6.25,26.4,21.38,9.5,53.12,21.62,-3.62,56.44,1,1,1,1,1,2,4,0,1,1,2,1,2,2,2,1,0,0,2,3,0,0,0,0,0,2,0,1,0,0,0,1,0,0,1,3,0,0,1,1,1,1.6,1.8,1.2,0,0.6,0.4,1,1.4,0.5,7.67,9.33,-3,0,-2,1,-1.66,5 cents,100 minutes,24 days,Male,University - Undergraduate,40,-0.375,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,1,1,1,1,1,0,4,-1,1,1,2,0,2,2,1,-2,0,0,1,2,1,1,1.4,0.2,0.9,C_Ug +850,R_1vL5akX2XeXP55L,25 - 31,Canadian,Female,3,3,1,1,2,-2,1,1,3,2,2,-2,3,1,3,-2,2,-2,-2,-1,2,3,2,-1,2,9,-2,-1,0,2,0,9,2,-2,2,2,3,9,-2,2,-2,-1,-1,7,3,3,2,2,2,7,-2,1,2,2,3,7,2,-2,3,2,3,3,-1,-1,0,1,1,8,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,51,TRUE,1,100,TRUE,0,52,TRUE,0,100,TRUE,0,88,FALSE,1,50,TRUE,1,61,TRUE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,97,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,1,54,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0.25,0,0.01,0.9409,0.1936,0.81,0.5625,0.1521,0.2601,0.7744,0,0.2704,0.9409,0.2116,0,1,1,1,1,0.352732143,0.135321429,0.570142857,28,87.5,21,65.63,5,62.5,5,62.5,6,75,5,62.5,15,93.75,6,37.5,86.28,67,88.75,96.88,92.5,87.88,84.69,21.87,20.65,4.5,26.25,21.88,30,-5.87,47.19,1,0,1,2,0,0,2,1,1,2,0,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,3,2,3,2,0.8,1.2,0.4,0.2,0.4,0.6,0.2,2.2,0.65,0.85,9,5.67,2,2,6,-1,3.33,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,31,1.375,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,0,0,1,0,0,2,0,0,1,0,0,1,0,0,-1,-3,-2,-2,-2,0.4,0.6,0.2,-2,-0.2,C_Ug +851,R_51dYvxwyn1qXXSF,25 - 31,Canadian,Female,2,3,2,-3,0,-3,-1,2,2,1,2,-2,2,-2,3,0,1,-3,-3,0,3,3,2,-3,0,7,-3,-3,1,3,-3,6,3,-3,-3,-2,3,3,-3,-3,-3,-3,-3,8,1,2,2,-3,1,3,-3,-1,2,1,2,5,2,-3,3,-3,3,3,1,1,1,1,1,7,TRUE,0,82,FALSE,0,50,TRUE,0,63,FALSE,1,50,TRUE,1,56,FALSE,1,56,TRUE,1,58,TRUE,1,76,FALSE,0,72,TRUE,1,57,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,57,FALSE,0,50,FALSE,1,74,TRUE,1,69,FALSE,1,50,TRUE,1,64,FALSE,1,50,FALSE,1,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,59,0.0576,0.1296,0.25,0.1764,0.3481,0.1936,0.0961,0.1849,0.25,0.25,0.25,0.25,0.5184,0.25,0.1936,0.25,0.0676,0.25,0.0676,0.25,0.3249,0.25,0.25,0.25,0.25,0.25,0.25,0.6724,0.3969,0.25,0.25,0.25,0.261217857,0.23945,0.282985714,5,15.63,20,62.5,4,50,5,62.5,6,75,5,62.5,6,37.5,14,87.5,56.78,52.75,56.5,57.62,60.25,57.38,56.19,-46.87,-5.72,2.75,-6,-17.38,-2.25,19.88,-31.31,1,0,0,0,0,0,2,1,1,4,1,1,5,0,0,3,4,0,0,3,1,1,0,0,1,0,0,0,1,1,0,1,1,1,0,1,0,4,4,1,0.2,1.6,1.4,2,0.6,0.4,0.6,2,1.3,0.9,5.33,3.67,4,1,0,1,1.66,5 cents,5 minutes,47 days,Female,University - Undergraduate,25,1.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,-1,0,0,-1,0,2,1,0,3,1,0,4,-1,0,2,4,-4,-4,2,-0.4,1.2,0.8,0,0.4,C_Ug +852,R_1guzVEXB7Tff2yU,18 - 24,Canadian,Female,3,3,-1,1,3,1,2,3,2,3,3,-2,3,3,3,1,3,2,2,-1,3,3,2,2,3,7,-2,3,-1,3,-2,8,3,3,-1,3,3,7,-3,-1,-3,-3,-3,9,3,3,-1,-1,3,2,2,-2,3,1,3,2,3,-2,3,-1,3,1,3,3,3,3,3,4,FALSE,1,64,TRUE,1,50,TRUE,0,100,TRUE,0,58,TRUE,1,100,FALSE,1,58,TRUE,1,90,TRUE,1,90,TRUE,1,50,TRUE,1,96,TRUE,0,51,TRUE,0,64,TRUE,1,68,FALSE,1,71,FALSE,0,51,TRUE,1,100,TRUE,0,70,TRUE,0,74,TRUE,0,50,FALSE,1,51,TRUE,1,64,TRUE,1,54,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,81,TRUE,0,50,TRUE,0,63,TRUE,0,100,TRUE,1,87,FALSE,0,50,TRUE,1,100,0.01,0.0361,0,0.01,0,0.1764,0,0.0016,0.2401,0.2116,0.0169,0.1024,0.25,0.2601,0,0.25,0.36,0.3364,0.3969,0,0.1296,0.2601,0.25,0.0841,0.49,0.25,0.25,0.1296,1,0.5476,1,0.4096,0.264392857,0.157535714,0.37125,16,50,19,59.38,2,25,5,62.5,7,87.5,5,62.5,14,87.5,5,31.25,72.34,51.25,77.5,78.75,81.88,76.94,67.75,-9.38,12.96,26.25,15,-8.75,19.38,-10.56,36.5,0,0,3,1,0,3,1,4,1,5,0,5,4,0,0,4,4,5,5,2,0,0,0,2,0,1,4,0,1,0,0,0,0,4,0,2,0,1,1,4,0.8,2.8,1.8,4,0.4,1.2,0.8,1.6,2.35,1,7.33,1.67,5,6,6,5,5.66,5 cents,5 minutes,47 days,Female,High School (or equivalent),18,1.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,3,-1,0,2,-3,4,0,5,0,5,4,-4,0,2,4,4,4,-2,0.4,1.6,1,2.4,1.35,HS_TS +853,R_7rTUGoYyHM1m3DX,25 - 31,American,Female,2,3,3,2,2,2,-2,2,-2,2,3,3,3,2,2,2,3,3,2,3,-1,3,2,2,2,7,1,-2,1,-2,1,8,2,3,3,-2,3,7,1,-1,1,-1,-1,8,3,3,3,3,3,7,3,0,3,-3,2,4,2,3,3,1,3,6,2,2,2,3,3,8,TRUE,0,83,TRUE,1,74,TRUE,0,100,TRUE,0,77,FALSE,0,98,FALSE,1,100,TRUE,1,65,TRUE,1,100,TRUE,1,73,FALSE,0,100,FALSE,1,83,TRUE,0,100,TRUE,1,72,FALSE,1,63,TRUE,1,62,TRUE,1,100,TRUE,0,86,TRUE,0,100,FALSE,1,89,TRUE,0,71,TRUE,1,100,TRUE,1,100,TRUE,0,57,TRUE,1,66,TRUE,0,79,FALSE,0,55,TRUE,0,68,TRUE,0,100,TRUE,0,76,TRUE,1,53,FALSE,0,66,TRUE,1,76,0,0.3025,0,0.1225,0.0576,0,0.1156,1,0.5041,0,0.2209,0.0784,0.0729,0.0289,0.9604,0.0676,0.3249,0.5929,1,0.6241,0,0.1444,0.0121,0.1369,0.7396,0.4624,0.4356,0.6889,1,1,0.5776,1,0.423064286,0.287442857,0.558685714,18,56.25,16,50,5,62.5,4,50,3,37.5,4,50,12,75,4,25,81,74,83.12,80.62,86.25,78.75,83.25,6.25,31,11.5,33.12,43.12,36.25,3.75,58.25,3,0,1,0,0,1,0,1,0,1,1,0,0,4,1,1,4,2,3,4,1,0,0,1,1,1,2,1,1,0,1,0,0,1,1,0,1,1,1,0,0.8,0.6,1.2,2.8,0.6,1,0.6,0.6,1.35,0.7,7.33,5.67,0,4,1,0,1.66,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,31,0.375,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,2,0,1,-1,-1,0,-2,0,-1,1,0,0,0,3,0,1,3,1,2,4,0.2,-0.4,0.6,2.2,0.65,C_Ug +854,R_7OTvOoQC0biSLms,18 - 24,American,Female,3,3,2,1,3,2,0,2,1,3,0,2,2,3,1,0,1,1,3,3,0,1,3,2,2,7,2,1,0,2,3,9,1,3,2,0,1,7,2,1,3,2,1,5,2,3,3,1,0,7,2,1,1,3,2,7,3,2,2,0,1,7,2,3,1,0,1,10,FALSE,1,100,TRUE,1,100,TRUE,0,79,TRUE,0,59,TRUE,1,100,FALSE,1,70,TRUE,1,66,FALSE,0,69,TRUE,1,64,FALSE,0,55,TRUE,0,65,FALSE,1,64,FALSE,0,62,TRUE,0,84,FALSE,0,63,TRUE,1,86,TRUE,0,60,FALSE,1,75,FALSE,1,56,TRUE,0,82,TRUE,1,70,TRUE,1,63,TRUE,0,92,TRUE,1,66,FALSE,1,100,TRUE,1,90,FALSE,1,63,TRUE,0,80,TRUE,0,66,TRUE,1,100,TRUE,1,65,TRUE,1,100,0.4761,0.01,0.0196,0.1156,0,0.09,0.1156,0.3025,0.6724,0.1369,0,0.3844,0.1296,0.4225,0,0,0.8464,0.3481,0.64,0,0.09,0.3969,0.1936,0.7056,0.36,0.1369,0.1225,0,0.6241,0.0625,0.4356,0.1296,0.262346429,0.246314286,0.278378571,24,75,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,75.44,66.88,77.5,79.12,78.25,76.19,74.69,15.62,16.06,4.38,27.5,4.12,28.25,1.19,30.94,3,2,1,1,1,0,1,2,1,0,1,1,0,3,0,2,0,2,1,2,1,0,1,0,3,0,1,1,2,1,3,0,0,3,0,2,2,0,3,2,1.6,0.8,1,1.4,1,1,1.2,1.8,1.2,1.25,7.67,7,0,2,0,-5,0.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,2,2,0,1,-2,0,0,1,-1,-1,-2,1,0,0,0,0,-2,2,-2,0,0.6,-0.2,-0.2,-0.4,-0.05,HS_TS +855,R_551EH1NZAgKO3YJ,18 - 24,Canadian,Female,2,3,3,3,3,-1,0,2,1,3,1,0,3,0,3,1,1,2,1,1,3,3,3,3,0,9,1,3,1,3,0,7,2,0,3,2,3,8,2,1,3,1,2,7,3,3,3,3,3,0,-2,-3,3,1,2,0,-1,-3,3,-2,3,2,3,3,3,3,0,4,TRUE,0,63,TRUE,1,64,TRUE,0,86,FALSE,1,63,TRUE,1,92,FALSE,1,96,TRUE,1,86,TRUE,1,82,TRUE,1,100,TRUE,1,100,FALSE,1,58,TRUE,0,72,TRUE,1,61,FALSE,1,100,TRUE,1,56,TRUE,1,65,FALSE,1,59,TRUE,0,74,TRUE,0,76,FALSE,1,66,TRUE,1,79,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,64,TRUE,0,79,FALSE,1,62,FALSE,1,60,FALSE,0,55,FALSE,0,62,TRUE,1,100,0.0324,0.1296,0.1225,0.0196,0,0.0016,0,0,0.1156,0,0.3025,0.1521,0,0.1764,0.0064,0.1296,0,0.1369,0.1444,0,0.0441,0.1936,0.5776,0,0.1681,0.6241,0.3844,0.3969,0.7396,0.5476,0.16,0.5184,0.197139286,0.072935714,0.321342857,19,59.38,24,75,5,62.5,8,100,6,75,5,62.5,14,87.5,10,62.5,77.5,69.75,80.88,85.88,73.5,79.12,75.88,-15.62,2.5,7.25,-19.12,10.88,11,-8.38,13.38,1,0,0,0,3,2,3,1,2,3,1,0,0,2,0,1,0,1,0,1,1,0,0,0,0,1,3,1,0,1,2,3,0,2,0,2,2,1,2,1,0.8,2.2,0.6,0.6,0.2,1.2,1.4,1.6,1.05,1.1,8,0.67,9,7,6,3,7.33,10 cents,5 minutes,36 days,Female,College Diploma/Certificate,21,0.875,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,0,3,1,0,0,2,2,-1,-3,0,0,0,-1,-2,0,-2,0,0.6,1,-0.8,-1,-0.05,C_Ug +856,R_7Ofyp1ai5hRQU7L,25 - 31,American,Male,1,2,2,1,2,1,-1,1,-1,1,1,1,1,0,1,0,0,2,1,1,1,2,2,2,1,2,1,-1,1,-1,1,2,1,0,1,1,1,2,1,1,0,1,1,5,1,2,2,1,2,2,1,-1,1,-1,1,2,1,1,1,0,1,2,1,1,2,1,1,6,FALSE,1,100,TRUE,1,89,TRUE,0,100,FALSE,1,56,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,68,FALSE,0,72,FALSE,1,65,FALSE,1,95,TRUE,1,100,TRUE,0,83,TRUE,1,60,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,85,FALSE,1,68,TRUE,1,68,TRUE,1,94,FALSE,1,63,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,78,FALSE,1,89,TRUE,0,88,FALSE,0,79,TRUE,1,86,TRUE,1,91,0,0,0,0,0.0081,0,0,0.5184,0.1024,0.0036,0.6241,0,0.1024,0.1225,0.2025,0.0121,0.1369,0.1936,0.0121,0,0.1024,0.16,0.7225,0.6889,0.1369,0.0484,0.0196,0,1,0,0.7744,0.0025,0.203367857,0.144757143,0.261978571,13,40.63,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,84.22,73.38,78.5,93.62,91.38,85.12,83.31,-40.62,2.97,-14.12,-9,18.62,16.38,-2.38,8.31,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0.4,0,0.4,0.8,0,0,0,0.4,0.4,0.1,2,2,0,0,0,-1,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),27,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,2,0,0,0.4,0,0.4,0.4,0.3,grad_prof +857,R_3k7yDhUCnYMqSNm,18 - 24,American,Female,3,3,3,3,3,3,3,3,-3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,2,2,10,2,3,3,2,3,10,3,3,2,3,2,10,3,3,2,3,2,10,3,3,2,3,2,10,3,3,3,3,2,10,3,3,2,2,3,10,3,2,3,3,2,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,84,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0004,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.0004,0,0,0.0256,0,0,0,0,1,0,0,0.072371429,0.071457143,0.073285714,32,100,30,93.75,8,100,7,87.5,7,87.5,8,100,15,93.75,15,93.75,99.38,99.75,97.75,100,100,99.88,98.88,6.25,5.63,-0.25,10.25,12.5,0,6.13,5.13,0,0,0,1,1,1,0,0,5,0,0,0,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,6,1,0,0,1,0,0,1,1,0,0,1,0.4,1.2,0.6,0.6,0.4,1.4,0.2,0.6,0.7,0.65,10,10,0,0,0,0,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,24,0,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,0,0,-1,1,0,1,0,0,-1,-1,0,0,0,1,1,0,-1,1,0,0,0,-0.2,0.4,0,0.05,C_Ug +858,R_1WuuZPODn5sL2k0,18 - 24,American,Male,1,3,3,2,3,-2,0,2,-2,-3,3,3,2,2,1,0,0,1,1,0,0,3,1,2,1,8,1,0,0,-2,-3,7,0,0,-2,0,-2,6,0,0,1,2,0,6,0,3,1,1,0,5,0,0,1,0,0,5,0,0,0,1,1,4,1,0,0,1,0,7,TRUE,0,90,TRUE,1,84,TRUE,0,94,TRUE,0,86,FALSE,0,83,TRUE,0,78,TRUE,1,85,TRUE,1,85,TRUE,1,88,TRUE,1,87,TRUE,0,88,TRUE,0,89,TRUE,1,92,TRUE,0,89,FALSE,0,88,TRUE,1,86,FALSE,1,100,TRUE,0,84,TRUE,0,77,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,89,TRUE,0,86,TRUE,0,76,FALSE,0,73,TRUE,1,84,TRUE,1,84,0.0225,0,0.0196,0.0225,0.0256,0.6084,0,0.0169,1,0,0.5329,0.0064,0.0144,0.7744,0.6889,0.0256,0.9025,0.7396,0.7396,0,0,0.7744,0.5929,0.7921,0,0.7921,0.0256,0.81,0.8836,0.7056,0.5776,0.7921,0.4579,0.381114286,0.534685714,17,53.13,15,46.88,3,37.5,4,50,5,62.5,3,37.5,13,81.25,2,12.5,88.75,85.5,88.5,91.88,89.12,88.69,88.81,6.25,41.87,48,38.5,29.38,51.62,7.44,76.31,1,0,2,0,2,3,0,2,0,0,3,3,4,2,3,0,0,0,1,0,1,0,2,1,3,2,0,1,2,3,3,3,2,1,0,1,0,1,0,0,1,1,3,0.2,1.4,1.6,1.8,0.4,1.3,1.3,7,4.67,3,2,2,-1,2.33,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,-1,-1,1,0,1,-2,-3,0,0,2,1,3,-1,0,-1,1,0,-0.4,-0.6,1.2,-0.2,0,C_Ug +859,R_3OJ91rDlvOTOUrH,18 - 24,American,Female,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,TRUE,0,100,TRUE,1,76,TRUE,0,100,FALSE,1,50,FALSE,0,82,FALSE,1,92,FALSE,0,93,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,64,TRUE,0,100,FALSE,0,82,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,68,TRUE,0,95,TRUE,1,64,FALSE,0,50,TRUE,0,90,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,1,60,TRUE,0,75,TRUE,0,90,TRUE,1,100,FALSE,0,50,TRUE,1,60,0.25,0,0,0.8649,0.16,0.0064,0,0,0.9025,0.25,0,0.6724,0.25,0.1296,0.6724,0.0576,0.81,0.25,0.5625,0.0225,0.1296,0.25,0.1024,0,1,0.16,0.25,1,1,1,0.81,1,0.408853571,0.297207143,0.5205,16,50,16,50,5,62.5,3,37.5,4,50,4,50,9,56.25,7,43.75,80.5,58.5,82.5,91,90,75.44,85.56,0,30.5,-4,45,41,40,19.19,41.81,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,2,0,1,0,2,0,1,0,0.75,0.75,0,0,0,0,0,0,0,15 cents,100 minutes,24 days,Female,College Diploma/Certificate,22,-0.25,0,0,0,0,1,1,0,0.67,03VLPfPs,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +860,R_6Y9x4iu9imBy3ct,18 - 24,American,Female,2,3,1,2,2,3,-1,-2,-3,2,-1,-2,2,2,1,0,1,2,2,-2,2,3,3,3,1,6,-3,-3,1,-2,2,8,3,1,-2,2,2,8,-2,1,2,1,3,6,2,3,-1,3,2,2,3,0,0,-2,2,1,-1,-2,2,0,2,1,2,-2,0,1,-2,8,TRUE,0,100,TRUE,1,50,TRUE,0,65,FALSE,1,50,TRUE,1,70,FALSE,1,100,TRUE,1,90,TRUE,1,90,TRUE,1,100,FALSE,0,100,FALSE,1,54,TRUE,0,94,TRUE,1,60,TRUE,0,73,FALSE,0,52,TRUE,1,53,TRUE,0,50,TRUE,0,76,FALSE,1,67,FALSE,1,50,TRUE,1,64,TRUE,1,59,TRUE,0,80,TRUE,1,95,TRUE,0,63,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,60,FALSE,0,69,FALSE,0,75,TRUE,1,95,0.01,0.0025,0.2209,0.01,0.0025,0,0.0025,1,0.25,0.1681,0.4761,0.16,0,0.2116,0.09,0.25,0.64,0.25,0.25,0.3969,0.1296,0.2704,0.1089,0.5329,0.25,0.25,0.5625,1,0.4225,0.5776,0.36,0.8836,0.339132143,0.250057143,0.428207143,13,40.63,18,56.25,5,62.5,5,62.5,3,37.5,5,62.5,12,75,6,37.5,71.84,62.25,72.38,82,70.75,76.06,67.62,-15.62,15.59,-0.25,9.88,44.5,8.25,1.06,30.12,0,0,2,1,1,6,2,3,1,0,4,3,4,0,1,2,0,0,1,5,0,0,2,1,0,0,1,2,1,0,0,0,0,2,1,2,3,2,1,0,0.8,2.4,2.4,1.6,0.6,0.8,0.6,1.6,1.8,0.9,7.33,1.33,4,7,7,-2,6,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,0,0,0,0,1,6,1,1,0,0,4,3,4,-2,0,0,-3,-2,0,5,0.2,1.6,1.8,0,0.9,HS_TS +861,R_3O2lLNh3P30DMHf,18 - 24,American,Female,3,3,2,3,2,2,1,3,3,2,2,2,1,0,2,2,2,1,2,2,2,1,1,1,2,5,1,1,2,2,1,3,2,3,1,3,2,7,1,1,1,2,2,5,2,1,2,2,1,3,2,2,3,2,3,6,1,2,3,2,1,8,2,1,1,0,3,7,FALSE,1,65,FALSE,0,67,FALSE,1,71,TRUE,0,57,FALSE,0,54,FALSE,1,68,FALSE,0,69,FALSE,0,68,FALSE,0,61,FALSE,0,66,FALSE,1,71,FALSE,1,72,FALSE,0,69,FALSE,1,65,FALSE,0,64,FALSE,0,61,FALSE,1,61,FALSE,1,57,TRUE,0,71,FALSE,1,71,FALSE,0,63,TRUE,1,63,TRUE,0,59,FALSE,0,53,TRUE,0,66,TRUE,1,66,FALSE,1,61,FALSE,1,62,FALSE,1,58,FALSE,0,74,FALSE,0,75,TRUE,1,61,0.4624,0.1156,0.3721,0.4761,0.1521,0.1024,0.2809,0.4356,0.0841,0.1369,0.5476,0.4761,0.3721,0.0841,0.2916,0.4489,0.3481,0.3249,0.1444,0.4356,0.3969,0.4096,0.5041,0.1225,0.1521,0.1521,0.5625,0.1225,0.0841,0.1849,0.1764,0.0784,0.271839286,0.291814286,0.251864286,18,56.25,15,46.88,2,25,4,50,5,62.5,4,50,3,18.75,12,75,64.66,65.88,61.62,64.62,66.5,64.62,64.69,9.37,17.78,40.88,11.62,2.12,16.5,45.87,-10.31,1,2,1,2,0,1,0,1,1,1,0,1,0,3,0,1,1,0,0,0,1,2,0,1,1,0,1,0,1,1,1,0,2,2,1,0,1,0,2,1,1.2,0.8,0.8,0.4,1,0.6,1.2,0.8,0.8,0.9,5,5.67,2,-3,-1,-2,-0.67,5 cents,100 minutes,47 days,Female,High School (or equivalent),21,-0.25,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,1,1,-1,1,-1,1,0,0,-1,1,-2,1,-1,1,0,0,-2,-1,0.2,0.2,-0.4,-0.4,-0.1,HS_TS +862,R_3costSOlw5ZSWJj,18 - 24,American,Female,2,3,-3,0,1,0,0,1,0,0,3,1,3,2,2,1,1,1,1,-3,1,3,0,-3,3,3,-2,3,1,3,1,9,3,1,3,1,1,9,-3,-1,-3,-3,-3,10,3,3,-2,1,3,2,1,0,3,0,1,4,3,1,3,2,2,7,3,3,3,3,-1,10,FALSE,1,100,TRUE,1,58,TRUE,0,100,FALSE,1,60,TRUE,1,100,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,67,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,64,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,0,52,TRUE,1,83,TRUE,0,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,FALSE,0,52,TRUE,1,100,0,0.0289,0,0,0,0.2025,0.0841,0,0.1225,0,1,0,0,0.2209,0,0.1764,0,0.16,0.25,0.2704,0,0.1089,0.4096,0.25,1,1,0.2704,0,1,0,1,0.25,0.277703571,0.140457143,0.41495,16,50,23,71.88,5,62.5,6,75,7,87.5,5,62.5,14,87.5,9,56.25,82.19,69.25,94.38,85.62,79.5,89.44,74.94,-21.88,10.31,6.75,19.38,-1.88,17,1.94,18.69,1,0,3,3,2,2,3,0,3,1,0,0,0,1,1,4,2,4,4,0,1,0,1,1,2,1,0,2,0,1,0,0,0,0,0,2,2,2,2,2,1.8,1.8,0.4,2.8,1,0.8,0,2,1.7,0.95,7,4.33,1,5,2,0,2.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,2,2,0,1,3,-2,3,0,0,0,0,1,1,2,0,2,2,-2,0.8,1,0.4,0.8,0.75,HS_TS +863,R_5dYvNycLhDsBzDo,25 - 31,American,Female,3,3,2,0,3,0,1,2,0,0,2,1,3,0,3,2,0,0,1,-1,1,3,3,3,1,2,1,-1,2,1,0,2,3,2,3,0,3,3,-1,0,-1,0,-1,3,3,3,2,-1,3,3,0,-1,3,-1,2,2,3,2,3,-1,3,2,2,2,2,2,2,2,FALSE,1,98,TRUE,1,58,TRUE,0,100,FALSE,1,60,TRUE,1,65,FALSE,1,100,TRUE,1,65,TRUE,1,92,TRUE,1,75,TRUE,1,97,FALSE,1,70,TRUE,0,87,TRUE,1,87,TRUE,0,61,TRUE,1,59,FALSE,0,70,TRUE,0,70,TRUE,0,87,TRUE,0,81,TRUE,0,54,FALSE,0,64,TRUE,1,91,FALSE,1,100,TRUE,1,75,TRUE,0,86,TRUE,1,81,TRUE,0,50,TRUE,0,97,TRUE,0,54,TRUE,1,86,FALSE,0,58,TRUE,1,96,0.0064,0.0361,0.49,0.1225,0.0016,0,0.0625,0.0009,0.2916,0.0081,0.0196,0.0169,0.0625,0.09,0.1225,0.1764,0,0.16,0.9409,0.7396,0.4096,0.1681,0.6561,0.3721,0.49,0.25,0.3364,0.0004,1,0.7569,0.2916,0.7569,0.292185714,0.072328571,0.512042857,16,50,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,13,81.25,5,31.25,77.31,63.88,79.5,83.25,82.62,76.19,78.44,-6.25,21.06,1.38,17,20.75,45.12,-5.06,47.19,2,0,1,3,2,1,2,0,1,0,1,1,0,0,0,3,0,1,1,0,0,0,0,1,0,0,2,1,1,2,1,1,0,1,0,0,2,2,1,3,1.6,0.8,0.4,1,0.2,1.2,0.6,1.6,0.95,0.9,2.33,2.33,-1,0,1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,28,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,0,1,2,2,1,0,-1,0,-2,0,0,0,-1,0,3,-2,-1,0,-3,1.4,-0.4,-0.2,-0.6,0.05,C_Ug +864,R_3r4jCd87S8QXS9z,18 - 24,American,Male,-3,-2,3,-2,-3,-3,-2,1,3,-3,2,2,2,-2,3,2,3,3,1,-3,-3,2,2,-3,-3,0,-3,-2,-2,-2,-2,1,-1,2,-1,-2,-1,10,2,2,2,2,-3,5,-2,0,-2,-2,-3,0,-2,-2,1,0,-3,2,-2,2,2,2,2,0,2,2,2,2,-2,0,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,60,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.36,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.253928571,0.25,0.257857143,2,6.25,19,59.38,4,50,4,50,5,62.5,6,75,3,18.75,16,100,50.78,50,51.25,50,51.88,51.56,50,-53.13,-8.6,0,1.25,-12.5,-23.12,32.81,-50,0,4,1,1,0,0,0,3,5,1,3,0,3,0,4,0,1,1,1,0,1,2,5,0,0,1,0,0,3,0,4,0,0,4,1,0,1,1,1,1,1.2,1.8,2,0.6,1.6,0.8,1.8,0.8,1.4,1.25,3.67,0.67,0,-1,10,5,3,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,23,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-1,2,-4,1,0,-1,0,3,2,1,-1,0,3,-4,3,0,0,0,0,-1,-0.4,1,0.2,-0.2,0.15,C_Ug +865,R_1X5UXxlbHryt7c7,25 - 31,American,Female,2,3,3,3,2,-3,3,2,2,1,3,3,3,2,3,0,2,1,1,-1,0,3,2,2,3,8,2,2,3,1,3,8,3,3,2,3,3,1,1,2,3,2,3,9,2,3,3,3,1,6,0,1,3,1,3,4,3,3,3,2,3,5,1,1,2,2,2,5,TRUE,0,64,TRUE,1,89,FALSE,1,74,FALSE,1,87,TRUE,1,79,FALSE,1,98,TRUE,1,88,TRUE,1,78,TRUE,1,94,TRUE,1,88,FALSE,1,66,TRUE,0,97,TRUE,1,82,FALSE,1,70,TRUE,1,85,TRUE,1,92,FALSE,1,83,FALSE,1,100,FALSE,1,90,FALSE,1,86,TRUE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,93,FALSE,1,84,TRUE,1,86,FALSE,1,70,TRUE,0,94,FALSE,1,78,TRUE,1,85,FALSE,0,72,FALSE,0,67,0.0484,0.0196,0.0064,0.0144,0.4489,0.0004,0.0049,0.0144,0.0196,0.04,0.0225,0.0324,0.0036,0.1156,0.0441,0.0121,0,0.0169,0.8836,0.0256,0,0.0225,0.01,0.09,0.0289,0.09,0.5184,0.4096,0.0676,0,0.0484,0.9409,0.139675,0.055385714,0.223964286,11,34.38,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,84.34,81.62,85.88,82.5,87.38,84.88,83.81,-50,-0.04,-5.88,-1.62,-5,12.38,-2.62,2.56,2,0,1,1,1,5,1,1,1,2,0,0,1,1,0,1,0,2,1,4,0,0,0,0,1,3,2,1,1,2,0,0,0,0,0,1,1,1,1,3,1,2,0.4,1.6,0.2,1.8,0,1.4,1.25,0.85,5.67,5,2,4,-4,4,0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,28,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,0,1,1,0,2,-1,0,0,0,0,0,1,1,0,0,-1,1,0,1,0.8,0.2,0.4,0.2,0.4,C_Ug +866,R_6e5t08ZY1L6J1vb,18 - 24,American,Female,-2,2,2,2,-2,0,0,0,2,2,3,3,3,0,2,3,3,3,3,3,3,3,3,3,3,0,2,-2,0,-2,-2,4,3,0,2,0,0,4,3,3,3,3,3,3,0,0,0,0,0,5,0,-2,0,-2,2,5,2,2,2,0,0,5,2,2,3,2,3,6,FALSE,1,62,FALSE,0,67,TRUE,0,90,FALSE,1,82,FALSE,0,87,TRUE,0,80,FALSE,0,76,TRUE,1,67,FALSE,0,70,TRUE,1,86,TRUE,0,81,TRUE,0,83,TRUE,1,84,FALSE,1,67,FALSE,0,71,FALSE,0,63,FALSE,1,69,TRUE,0,80,FALSE,1,86,FALSE,1,78,FALSE,0,78,FALSE,0,76,FALSE,1,83,FALSE,0,68,FALSE,1,79,TRUE,1,76,FALSE,1,74,TRUE,0,88,FALSE,1,86,TRUE,1,92,FALSE,0,87,FALSE,0,72,0.1089,0.0576,0.3969,0.5776,0.5184,0.64,0.4624,0.0196,0.0484,0.5776,0.0064,0.0256,0.49,0.6561,0.7569,0.4489,0.0289,0.0324,0.7744,0.0441,0.6084,0.5041,0.0196,0.1089,0.0961,0.0676,0.7569,0.1444,0.81,0.64,0.0196,0.6889,0.35695,0.336542857,0.377357143,16,50,15,46.88,3,37.5,4,50,5,62.5,3,37.5,5,31.25,10,62.5,77.75,77.25,79.88,75.25,78.62,76.25,79.25,3.12,30.87,39.75,29.88,12.75,41.12,45,16.75,5,1,1,1,5,2,2,0,4,4,0,3,1,0,2,0,0,0,0,0,2,2,2,2,2,0,2,0,4,0,1,1,1,0,2,1,1,0,1,0,2.6,2.4,1.2,0,2,1.2,1,0.6,1.55,1.2,2.67,5,-5,-1,-1,-3,-2.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),23,0.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,3,-1,-1,-1,3,2,0,0,0,4,-1,2,0,0,0,-1,-1,0,-1,0,0.6,1.2,0.2,-0.6,0.35,HS_TS +867,R_3IRFJSyzunHLkEK,25 - 31,American,Female,2,2,1,2,1,2,-1,3,1,3,2,2,2,1,3,-1,1,1,1,-1,0,-1,3,3,1,7,1,2,-1,2,1,8,1,0,1,1,3,6,-1,0,-2,-2,1,9,1,1,0,2,2,8,3,-3,2,-1,3,8,3,3,2,2,3,9,2,3,1,3,-1,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0.25,0.142857143,0.357142857,32,100,25,78.13,6,75,6,75,8,100,5,62.5,15,93.75,10,62.5,100,100,100,100,100,100,100,21.87,21.87,25,25,0,37.5,6.25,37.5,2,3,2,1,0,1,3,4,1,2,1,2,1,0,0,0,1,3,3,2,1,1,1,0,1,1,2,1,2,0,1,1,0,1,0,3,2,0,2,0,1.6,2.2,0.8,1.8,0.8,1.2,0.6,1.4,1.6,1,7,8.33,-1,0,-3,-1,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,30,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,2,1,1,-1,0,1,3,-1,2,0,1,1,-1,0,-3,-1,3,1,2,0.8,1,0.2,0.4,0.6,C_Ug +868,R_7aOhb3G82QkZXON,25 - 31,American,Male,1,3,3,-2,2,2,1,3,2,1,-1,-2,3,-2,3,-1,1,-1,0,-1,1,3,3,-1,2,2,2,1,-1,2,-1,4,-2,-2,2,-2,3,4,-3,-2,-3,-3,-2,8,2,3,3,-1,3,8,3,-2,3,-3,3,7,-2,-2,3,-2,3,8,3,3,3,3,3,7,TRUE,0,90,TRUE,1,60,TRUE,0,85,FALSE,1,65,TRUE,1,70,FALSE,1,55,TRUE,1,80,FALSE,0,60,TRUE,1,50,TRUE,1,80,FALSE,1,90,TRUE,0,90,TRUE,1,80,FALSE,1,50,TRUE,1,55,TRUE,1,70,TRUE,0,50,TRUE,0,70,FALSE,1,50,TRUE,0,60,FALSE,0,50,TRUE,1,50,FALSE,1,75,TRUE,1,70,FALSE,1,75,TRUE,1,80,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,90,0.36,0.04,0.09,0.04,0.01,0.2025,0.09,0.04,0.36,0.25,0.0625,0.04,0.25,0.01,0.09,0.16,0.0625,0.1225,0.25,0.0625,0.25,0.2025,0.25,0.25,0.25,0.25,0.25,0.81,0.7225,0.49,0.25,0.81,0.244553571,0.125,0.364107143,15,46.88,21,65.63,6,75,5,62.5,6,75,4,50,13,81.25,8,50,66.41,58.75,65,71.88,70,66.88,65.94,-18.75,0.78,-16.25,2.5,-3.12,20,-14.37,15.94,0,0,0,1,0,0,0,4,0,2,1,0,1,0,0,2,3,2,3,1,1,0,0,1,1,1,3,0,5,2,1,0,0,0,0,4,2,4,3,4,0.2,1.2,0.4,2.2,0.6,2.2,0.2,3.4,1,1.6,3.33,7.67,-6,-3,-4,1,-4.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),29,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,-1,0,0,0,-1,-1,-3,4,-5,0,0,0,1,0,0,-2,1,-2,0,-3,-0.4,-1,0.2,-1.2,-0.6,HS_TS +869,R_5SfD2exjwMqMkgW,25 - 31,American,Female,-3,3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,10,3,3,3,3,3,0,3,3,3,3,3,0,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,50,50,50,50,50,50,50,50,0,0,0,0,0,-50,50,6,0,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2.4,0,0,0,1.6,0,0,0,0.6,0.4,0,3.33,0,-10,0,0,-3.33,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),27,0,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.8,0,0,0,0.2,grad_prof +870,R_3ErRfDkZXc00MMA,25 - 31,American,Female,3,3,2,1,3,-1,1,2,-1,3,2,2,3,3,3,1,2,2,2,1,3,3,2,2,3,2,1,1,1,3,2,7,2,2,3,3,3,3,-1,2,-2,2,-2,8,3,3,2,2,3,1,1,1,2,-3,3,4,2,2,3,3,3,2,3,3,2,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,51,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,0,54,TRUE,1,100,TRUE,0,51,TRUE,0,100,FALSE,1,52,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,52,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,65,FALSE,0,100,FALSE,0,59,TRUE,1,55,0,0,0,0,0.2025,0,0.09,0,0,0,1,0,0.2601,0,0,0,0,0.2025,0,0.2704,0,0.2916,0.2304,0.5625,0.2601,0.2401,0.3481,0,0,1,0.4225,0,0.192171429,0.125364286,0.258978571,12,37.5,23,71.88,5,62.5,6,75,5,62.5,7,87.5,12,75,11,68.75,84.06,65.25,83.88,90.88,96.25,86.81,81.31,-34.38,12.18,2.75,8.88,28.38,8.75,11.81,12.56,0,0,0,1,0,2,0,1,4,1,0,0,0,0,0,2,0,4,0,3,0,0,0,1,0,2,0,0,2,0,0,0,0,0,0,2,1,0,1,2,0.2,1.6,0,1.8,0.2,0.8,0,1.2,0.9,0.55,4,2.33,1,3,1,3,1.67,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),31,1.875,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0,-1,4,-1,1,0,0.8,0,0.6,0.35,grad_prof +871,R_5oQGSysi5uvMM2w,25 - 31,American,Female,0,2,2,3,3,-1,-2,3,-1,1,3,3,3,1,3,2,1,3,3,1,1,3,3,3,3,4,-2,0,3,1,3,4,2,2,2,1,2,8,1,3,3,1,2,2,0,2,2,2,3,3,0,-2,2,0,2,4,3,3,3,-1,2,4,3,0,2,2,2,3,TRUE,0,88,FALSE,0,55,TRUE,0,100,TRUE,0,56,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,87,FALSE,0,55,TRUE,1,100,TRUE,0,70,TRUE,0,95,TRUE,1,71,TRUE,0,52,TRUE,1,59,TRUE,1,69,FALSE,1,59,TRUE,0,99,TRUE,0,65,TRUE,0,90,TRUE,1,80,FALSE,0,52,TRUE,0,70,TRUE,1,95,TRUE,0,95,TRUE,1,95,FALSE,1,50,FALSE,1,55,TRUE,0,65,TRUE,1,79,FALSE,0,50,TRUE,1,75,0.0169,0.0025,0.0961,0,0.0625,0,0.0025,0,0.81,0.2704,0.0441,0.0841,0.3025,0.49,0.2025,0.3025,0.49,0.3136,0.2025,0.9025,0.04,0.1681,0.4225,0.2704,0.1681,0.25,0.25,0.7744,1,0.9801,0.4225,0.9025,0.361725,0.24105,0.4824,14,43.75,16,50,2,25,6,75,3,37.5,5,62.5,12,75,4,25,74.56,57.5,71.88,85.12,83.75,73.56,75.56,-6.25,24.56,32.5,-3.12,47.62,21.25,-1.44,50.56,1,1,1,0,0,1,2,0,2,2,1,1,1,0,1,1,2,0,2,1,0,0,0,1,0,1,0,1,1,1,0,0,0,2,1,1,1,1,1,1,0.6,1.4,0.8,1.2,0.2,0.8,0.6,1,1,0.65,5.33,3.67,1,0,4,-1,1.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,1,1,1,-1,0,0,2,-1,1,1,1,1,1,-2,0,0,1,-1,1,0,0.4,0.6,0.2,0.2,0.35,HS_TS +872,R_3qVx10RPM0TI7Du,18 - 24,American,Female,3,3,3,3,3,1,3,2,3,2,2,1,0,3,1,2,0,1,3,1,0,1,0,1,2,7,3,1,2,1,2,8,2,1,3,3,2,8,0,1,0,1,2,7,3,3,2,1,2,9,-1,0,2,1,3,6,1,1,2,2,3,10,2,0,3,-1,1,7,FALSE,1,65,TRUE,1,65,FALSE,1,64,TRUE,0,68,FALSE,0,62,TRUE,0,72,FALSE,0,80,TRUE,1,66,FALSE,0,67,TRUE,1,71,FALSE,1,79,TRUE,0,64,FALSE,0,72,FALSE,1,65,TRUE,1,63,TRUE,1,59,TRUE,0,63,TRUE,0,79,FALSE,1,69,FALSE,1,58,FALSE,0,65,FALSE,0,72,TRUE,0,79,TRUE,1,68,TRUE,0,59,FALSE,0,62,TRUE,0,66,FALSE,1,60,FALSE,1,62,TRUE,1,59,FALSE,0,55,TRUE,1,66,0.1156,0.3844,0.1681,0.64,0.1156,0.5184,0.1024,0.0841,0.1764,0.5184,0.1681,0.5184,0.4489,0.0441,0.3844,0.1225,0.6241,0.4624,0.16,0.3481,0.4225,0.1369,0.0961,0.1225,0.3969,0.4356,0.3025,0.1225,0.1296,0.6241,0.1444,0.4096,0.290696429,0.3063,0.275092857,24,75,16,50,4,50,2,25,3,37.5,7,87.5,8,50,8,50,66.38,66.5,67.62,69.12,62.25,65.75,67,25,16.38,16.5,42.62,31.62,-25.25,15.75,17,3,2,3,2,1,2,2,0,2,0,0,0,3,0,1,2,1,1,2,1,0,0,1,2,1,2,3,0,2,1,1,0,2,1,2,0,0,2,4,0,2.2,1.2,0.8,1.4,0.8,1.6,1.2,1.2,1.4,1.2,7.67,8.33,-2,2,-2,0,-0.66,10 cents,100 minutes,24 days,Female,University - PhD,24,-1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,3,2,2,0,0,0,-1,0,0,-1,-1,0,1,-1,-1,2,1,-1,-2,1,1.4,-0.4,-0.4,0.2,0.2,grad_prof +873,R_7HCrIcsRpIc8QZX,18 - 24,American,Male,0,1,-3,3,3,-3,0,2,-3,3,-2,-1,3,0,3,0,0,-1,2,3,2,-1,1,3,-1,10,-3,3,-3,3,-3,10,-3,3,-3,-3,-3,10,0,-3,-3,2,-3,10,-1,3,-3,3,3,3,-3,-3,0,-3,0,2,-3,-1,3,-3,3,2,-3,-3,-3,-3,-3,4,TRUE,0,70,TRUE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,70,TRUE,1,90,TRUE,1,54,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,55,FALSE,0,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,FALSE,1,53,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,56,FALSE,1,82,FALSE,1,75,FALSE,0,100,FALSE,0,100,FALSE,0,100,0.09,0,0,1,1,0,0,0.2116,0,0.0625,1,0,0.01,0,0,0.25,0,0,0.0324,0.16,0,1,0.2209,0.2025,0.36,0.1936,1,0.49,0,0,0.0625,0,0.223428571,0.181007143,0.26585,22,68.75,25,78.13,6,75,6,75,6,75,7,87.5,11,68.75,14,87.5,85.94,81.12,91.88,76.75,94,89.94,81.94,-9.38,7.81,6.12,16.88,1.75,6.5,21.19,-5.56,2,2,4,0,4,0,3,5,6,6,1,4,6,3,6,0,3,2,0,6,1,2,0,0,0,0,3,2,0,3,1,0,0,3,0,3,3,2,5,6,2.4,4,4,2.2,0.6,1.6,0.8,3.8,3.15,1.7,10,2.33,7,8,8,6,7.67,5 cents,100 minutes,47 days,Male,High School (or equivalent),20,1.125,1,0,1,0,1,0,0.67,0.33,03VLPfPs,02COC,02FUT,01ITEM,01DIR,1,0,4,0,4,0,0,3,6,3,0,4,6,0,6,-3,0,0,-5,0,1.8,2.4,3.2,-1.6,1.45,HS_TS +874,R_6VPc11udpjyq5Td,18 - 24,Canadian,Female,0,2,2,3,0,-1,-1,1,0,0,1,1,1,1,-2,2,1,2,1,0,0,2,1,3,-1,5,1,0,2,2,0,5,0,-1,2,1,-3,4,1,2,1,0,1,6,2,3,3,3,1,6,2,1,0,-1,1,6,1,1,0,0,-3,6,3,3,2,2,1,5,TRUE,0,70,FALSE,0,92,TRUE,0,100,FALSE,1,93,TRUE,1,63,FALSE,1,77,TRUE,1,97,FALSE,0,75,TRUE,1,66,FALSE,0,82,FALSE,1,75,TRUE,0,95,TRUE,1,86,FALSE,1,100,TRUE,1,86,FALSE,0,59,TRUE,0,82,FALSE,1,95,FALSE,1,85,TRUE,0,65,TRUE,1,78,FALSE,0,67,TRUE,0,73,TRUE,1,66,TRUE,0,66,TRUE,1,67,FALSE,1,67,FALSE,1,92,TRUE,0,71,TRUE,1,93,FALSE,0,74,FALSE,0,87,0.5625,0.1089,0.3481,0.0009,0.7569,0.0529,0.1156,0.6724,0.4225,0.4489,0.0049,0.0196,0.1156,0.0625,0.1369,0.8464,0.5329,0.0049,0.0064,0.4356,0.0484,0.0196,0.0225,0,0.6724,0.1089,0.5476,0.49,1,0.0025,0.5041,0.9025,0.319764286,0.299492857,0.340035714,17,53.13,17,53.13,6,75,4,50,4,50,3,37.5,9,56.25,8,50,79.5,79.75,77.12,80.5,80.62,77.38,81.62,0,26.37,4.75,27.12,30.5,43.12,21.13,31.62,0,0,1,0,1,2,1,1,2,0,1,2,1,0,1,1,1,1,1,1,2,1,1,0,1,3,2,1,1,1,0,0,1,1,1,1,2,0,1,1,0.4,1.2,1,1,1,1.6,0.6,1,0.9,1.05,4.67,6,-1,-1,-2,1,-1.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,19,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,-2,-1,0,0,0,-1,-1,0,1,-1,1,2,0,-1,0,0,-1,1,0,0,-0.6,-0.4,0.4,0,-0.15,C_Ug +875,R_1VL3zORMuDfKsNo,25 - 31,American,Female,1,3,0,-1,-1,-1,-2,2,0,-1,3,3,1,1,3,0,0,1,1,-2,3,3,-3,1,-3,5,-2,2,-1,2,-1,5,-1,2,3,3,-1,9,1,3,2,2,1,10,1,3,1,2,-3,5,-3,0,1,2,0,7,3,3,1,-1,3,4,-1,0,0,1,-3,9,FALSE,1,100,TRUE,1,97,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,94,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,72,TRUE,0,74,TRUE,1,79,TRUE,0,70,FALSE,0,50,TRUE,1,68,TRUE,0,54,TRUE,0,81,FALSE,1,55,FALSE,1,100,TRUE,1,89,TRUE,1,50,FALSE,1,50,TRUE,1,93,FALSE,1,84,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,68,FALSE,0,50,TRUE,1,50,TRUE,1,100,0.25,0,0.1024,0.0036,0,0,0.0049,0,0,0.25,0.25,0.0441,0.25,0.0784,0.25,0.0009,0.25,0.25,0.0625,0.0256,0.0121,0.25,0.2025,0.49,0.2916,0,0.25,0,1,0.6561,0.4624,0.5476,0.209953571,0.116307143,0.3036,15,46.88,23,71.88,7,87.5,5,62.5,6,75,5,62.5,13,81.25,10,62.5,75.09,65.5,73.75,84.88,76.25,73.12,77.06,-25,3.21,-22,11.25,9.88,13.75,-8.13,14.56,2,0,3,2,2,1,4,3,2,0,4,1,2,2,4,1,3,1,1,3,0,0,1,3,2,2,2,1,2,1,0,0,0,2,0,1,0,1,0,1,1.8,2,2.6,1.8,1.2,1.6,0.4,0.6,2.05,0.95,6.33,5.33,0,-2,5,1,1,10 cents,100 minutes,15 days,Female,High School (or equivalent),28,1,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,02REV,2,0,2,-1,0,-1,2,2,0,-1,4,1,2,0,4,0,3,0,1,2,0.6,0.4,2.2,1.2,1.1,HS_TS +876,R_5zc474LXAVKaI4f,25 - 31,American,Female,-3,-3,-3,-3,-3,2,2,2,3,3,1,2,2,2,1,-3,-2,-3,-1,-2,2,2,3,1,1,5,-2,2,2,-2,2,7,2,3,3,0,3,7,3,-3,2,2,1,6,0,3,3,2,3,8,1,3,3,2,1,9,2,-1,2,3,-1,1,1,2,3,1,0,7,FALSE,1,54,TRUE,1,56,TRUE,0,91,FALSE,1,56,TRUE,1,55,FALSE,1,54,TRUE,1,76,FALSE,0,54,TRUE,1,56,TRUE,1,54,TRUE,0,58,FALSE,1,55,FALSE,0,55,FALSE,1,100,FALSE,0,66,TRUE,1,71,TRUE,0,54,TRUE,0,99,FALSE,1,53,FALSE,1,53,FALSE,0,100,TRUE,1,54,FALSE,1,55,FALSE,0,64,TRUE,0,71,TRUE,1,100,TRUE,0,65,FALSE,1,72,TRUE,0,67,TRUE,1,100,TRUE,1,53,TRUE,1,100,0.2916,0,0.0841,0.0576,0,0.2116,0.4096,0.2116,0.2209,0.2116,0,0.3025,0.1936,0.3364,0.2025,0.1936,0.2025,0.1936,0.0784,0.5041,1,0.4356,0.2209,0,0.2916,0.4225,0.2209,0.2116,0.8281,0.9801,0.4489,0.2025,0.311971429,0.206428571,0.417514286,5,15.63,20,62.5,5,62.5,4,50,6,75,5,62.5,11,68.75,9,56.25,67.84,57.88,67.5,76,70,69.62,66.06,-46.87,5.34,-4.62,17.5,1,7.5,0.87,9.81,5,5,6,4,4,4,0,0,5,1,1,1,1,2,2,6,1,5,3,3,3,6,6,5,6,1,1,1,1,2,1,3,0,1,2,4,4,6,2,2,4.8,2,1.4,3.6,5.2,1.2,1.4,3.6,2.95,2.85,6.33,6,-3,-2,6,-1,0.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,-1,0,-1,-2,3,-1,-1,4,-1,0,-2,1,1,0,2,-3,-1,1,1,-0.4,0.8,0,0,0.1,C_Ug +877,R_3LXMNqKDKNC3lNT,25 - 31,American,Female,2,2,0,2,0,0,2,2,2,0,3,1,3,1,2,0,0,0,0,-2,3,3,2,0,1,7,-3,0,1,0,-2,9,2,0,0,0,0,8,0,1,1,0,-3,9,3,3,0,-2,2,10,3,-2,3,-2,1,10,3,2,3,2,1,10,3,3,3,3,2,10,TRUE,0,95,FALSE,0,50,TRUE,0,77,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,55,FALSE,0,50,TRUE,1,80,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,57,FALSE,1,50,TRUE,0,91,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,89,TRUE,1,75,FALSE,0,50,TRUE,1,93,0.2025,0,0.1849,0.25,0.0049,0.25,0.25,0.04,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9025,0.5929,0.8281,0.7921,1,0.311535714,0.186242857,0.436828571,16,50,17,53.13,4,50,4,50,4,50,5,62.5,6,37.5,11,68.75,64.44,50,66.5,77,64.25,60,68.88,-3.13,11.31,0,16.5,27,1.75,22.5,0.13,1,1,2,2,1,3,2,1,2,2,1,1,3,1,2,0,1,1,0,1,1,1,0,4,2,3,4,1,4,1,0,1,0,1,1,3,3,3,3,4,1.4,2,1.6,0.6,1.6,2.6,0.6,3.2,1.4,2,8,10,-3,-1,-2,-1,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),31,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,2,-2,-1,0,-2,0,-2,1,1,0,3,0,1,-3,-2,-2,-3,-3,-0.2,-0.6,1,-2.6,-0.6,grad_prof +878,R_5Hqcf3bOOCH1Sq5,18 - 24,Canadian,Male,1,1,1,1,1,0,3,-1,0,0,-3,-2,2,0,2,-1,0,-1,0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,-3,0,0,0,5,TRUE,0,75,FALSE,0,50,TRUE,0,62,FALSE,1,60,FALSE,0,56,FALSE,1,60,TRUE,1,66,TRUE,1,70,FALSE,0,50,TRUE,1,84,FALSE,1,67,FALSE,1,70,FALSE,0,67,FALSE,1,57,FALSE,0,59,TRUE,1,100,FALSE,1,55,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,68,TRUE,1,74,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,60,TRUE,1,66,TRUE,1,50,TRUE,1,100,0.09,0.25,0,0.1156,0,0.16,0.25,0.0256,0.25,0.0676,0.1156,0.4489,0.25,0.1089,0.3136,0.25,0,0.16,0.25,0,0.1024,0.3481,0.25,0.1849,0.2025,0.25,0.25,0.5625,0.3844,0.25,0.36,0.09,0.210178571,0.171442857,0.248914286,8,25,22,68.75,5,62.5,5,62.5,6,75,6,75,9,56.25,13,81.25,64.88,54.5,70.75,69.5,64.75,66.25,63.5,-43.75,-3.87,-8,8.25,-5.5,-10.25,10,-17.75,1,1,1,1,1,0,3,1,0,0,3,2,2,0,2,1,0,1,0,0,1,1,1,1,1,0,3,1,0,0,3,2,2,0,2,1,3,1,0,0,1,0.8,1.8,0.4,1,0.8,1.8,1,1,1.15,6,5,0,1,2,0,1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,20,0.875,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,-0.6,-0.15,C_Ug +879,R_5JyjqEE5uYRgVqe,18 - 24,Canadian,Female,2,2,2,2,3,1,-2,2,1,1,1,-2,2,-2,1,1,1,1,2,2,1,2,2,-2,-1,6,3,-1,2,-3,-1,4,3,-2,-2,1,-2,7,2,2,2,2,2,3,3,2,2,1,3,2,2,-3,3,-2,2,4,2,-1,3,-1,2,2,2,2,3,2,3,5,TRUE,0,91,FALSE,0,54,TRUE,0,91,TRUE,0,59,TRUE,1,85,FALSE,1,100,TRUE,1,70,TRUE,1,70,FALSE,0,51,TRUE,1,97,FALSE,1,76,TRUE,0,60,TRUE,1,96,FALSE,1,100,TRUE,1,86,TRUE,1,75,TRUE,0,65,FALSE,1,100,FALSE,1,54,FALSE,1,81,FALSE,0,97,FALSE,0,50,FALSE,1,92,TRUE,1,92,FALSE,1,92,TRUE,1,99,TRUE,0,55,FALSE,1,74,FALSE,1,65,FALSE,0,59,FALSE,0,50,TRUE,1,99,0.09,0.0001,0.0625,0.09,0.0001,0,0.0064,0.0009,0.0361,0.25,0.3481,0.0016,0.2601,0.0576,0.0225,0.2916,0.0064,0.3481,0.0676,0.0064,0.9409,0.0196,0.2116,0,0.4225,0.3025,0.25,0.8281,0.8281,0,0.1225,0.36,0.213903571,0.116392857,0.311414286,21,65.63,20,62.5,3,37.5,6,75,6,75,5,62.5,10,62.5,10,62.5,77.66,60.62,87.38,87.38,75.25,76.88,78.44,3.13,15.16,23.12,12.38,12.38,12.75,14.38,15.94,1,0,0,4,4,2,1,0,4,2,2,0,4,3,3,1,1,1,0,0,1,0,0,1,0,1,1,1,3,1,1,1,1,1,1,1,1,2,0,1,1.8,1.8,2.4,0.6,0.4,1.4,1,1,1.65,0.95,5.67,2.67,4,0,5,-2,3,10 cents,5 minutes,15 days,Female,University - Undergraduate,21,1.625,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,0,0,3,4,1,0,-1,1,1,1,-1,3,2,2,0,0,-1,0,-1,1.4,0.4,1.4,-0.4,0.7,C_Ug +880,R_7XiaGit9PpgYp8Y,25 - 31,American,Male,3,2,2,2,3,-1,0,1,2,-1,2,1,1,3,2,2,1,2,3,2,1,3,2,3,1,9,1,2,1,2,3,8,2,2,1,1,3,9,2,1,2,0,2,8,2,1,3,2,2,9,1,3,2,3,2,9,3,2,1,2,1,9,1,3,1,3,2,9,TRUE,0,84,TRUE,1,85,TRUE,0,91,TRUE,0,76,TRUE,1,64,TRUE,0,71,TRUE,1,71,TRUE,1,70,FALSE,0,93,TRUE,1,100,TRUE,0,85,FALSE,1,89,TRUE,1,76,TRUE,0,92,TRUE,1,87,TRUE,1,79,FALSE,1,96,TRUE,0,81,FALSE,1,74,TRUE,0,90,FALSE,0,82,TRUE,1,79,TRUE,0,82,FALSE,0,90,TRUE,0,88,TRUE,1,81,FALSE,1,92,TRUE,0,87,TRUE,0,92,FALSE,0,87,TRUE,1,83,FALSE,0,89,0.09,0.0361,0.0441,0.0841,0.7921,0.5041,0.81,0,0.81,0.0441,0.7569,0.0576,0.8649,0.7225,0.1296,0.0225,0.6724,0.5776,0.7569,0.7744,0.6724,0.0169,0.0676,0.8464,0.0016,0.0064,0.0289,0.7056,0.8281,0.6561,0.8464,0.0121,0.463717857,0.483164286,0.444271429,27,84.38,15,46.88,5,62.5,3,37.5,4,50,3,37.5,11,68.75,4,25,83.94,84.38,81.5,84.5,85.38,82.25,85.62,37.5,37.06,21.88,44,34.5,47.88,13.5,60.62,2,1,0,1,2,2,2,0,0,4,0,1,0,2,1,0,0,0,3,0,1,1,1,0,1,2,3,1,1,3,1,1,0,1,1,1,2,1,0,0,1.2,1.6,0.8,0.6,0.8,2,0.8,0.8,1.05,1.1,8.67,9,0,-1,0,-1,-0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),26,0.125,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,1,0,-1,1,1,0,-1,-1,-1,1,-1,0,0,1,0,-1,-2,-1,3,0,0.4,-0.4,0,-0.2,-0.05,HS_TS +881,R_3T8yCDUypN1CDZL,25 - 31,American,Male,3,3,3,3,3,3,-3,3,-3,3,3,2,3,3,3,3,2,2,3,3,3,3,3,3,3,10,3,-3,3,-3,3,9,3,2,3,3,3,10,2,3,3,3,2,9,2,2,3,3,3,9,3,-3,3,-3,3,10,3,3,2,2,3,7,3,2,3,2,1,9,FALSE,1,97,TRUE,1,100,TRUE,0,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0256,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0.0009,0.9801,0,0,0,0.106464286,0.071428571,0.1415,32,100,29,90.63,8,100,7,87.5,8,100,6,75,15,93.75,14,87.5,99.38,100,100,99.62,97.88,99,99.75,9.37,8.75,0,12.5,-0.38,22.88,5.25,12.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,2,0,0,0,0.8,0.4,0,0.6,0.8,0.2,0.45,9.67,8.67,1,-1,3,0,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),25,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,-1,-1,0,0,0,0,0,0,0,0,0,-1,-1,-1,0,1,1,0,-1,-1,-0.4,0,-0.6,0,-0.25,HS_TS +882,R_1mfxtXmWuzrRwfr,25 - 31,Canadian,Female,2,2,2,-2,2,3,1,2,1,1,0,3,3,3,2,0,0,-1,0,1,-3,-1,3,-3,3,7,-1,-2,2,3,3,5,3,0,-2,3,-3,7,0,3,0,-3,-2,6,2,0,2,1,0,3,3,1,3,0,-1,2,0,3,3,3,1,4,2,0,2,2,3,7,FALSE,1,60,TRUE,1,50,FALSE,1,100,TRUE,0,50,FALSE,0,75,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,1,80,FALSE,0,75,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,85,TRUE,0,96,FALSE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,70,FALSE,1,100,FALSE,0,50,TRUE,0,50,TRUE,0,85,TRUE,0,75,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0.25,0,0.25,0.25,0,0.09,0.5625,0.25,0,0,0,0.04,0.25,0.5625,0.25,0.04,0.25,0.7225,0,0,0.25,0.25,0,0.7225,0.25,0.25,0.16,0,0.9216,0.5625,1,0.272646429,0.181785714,0.363507143,10,31.25,17,53.13,3,37.5,4,50,5,62.5,5,62.5,10,62.5,7,43.75,75.97,53.75,83.12,78.88,88.12,75,76.94,-21.88,22.84,16.25,33.12,16.38,25.62,12.5,33.19,5,3,1,1,1,4,3,0,2,2,3,3,5,0,5,0,3,1,3,3,0,2,0,3,2,0,0,1,1,2,0,0,0,0,1,2,0,3,2,2,2.2,2.2,3.2,2,1.4,0.8,0.2,1.8,2.4,1.05,6.33,3,4,3,3,-1,3.33,10 cents,100 minutes,47 days,Female,University - Undergraduate,25,0.25,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,5,1,1,-2,-1,4,3,-1,1,0,3,3,5,0,4,-2,3,-2,1,1,0.8,1.4,3,0.2,1.35,C_Ug +883,R_35WM3rWzxA5ZeWL,18 - 24,Canadian,Female,2,2,-1,3,3,2,3,3,-1,1,3,-3,2,3,-1,3,1,3,3,0,3,2,3,3,-3,5,-2,3,-1,3,-3,10,1,3,1,-3,-3,7,-3,1,-3,3,-3,5,2,3,-2,1,3,3,2,0,3,-1,3,3,3,-3,3,3,-2,1,3,3,3,2,1,4,TRUE,0,78,FALSE,0,50,TRUE,0,54,TRUE,0,50,TRUE,1,70,TRUE,0,53,FALSE,0,50,TRUE,1,57,TRUE,1,81,TRUE,1,66,FALSE,1,53,TRUE,0,84,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,64,TRUE,0,50,TRUE,0,100,TRUE,0,55,FALSE,1,50,TRUE,1,51,FALSE,0,50,FALSE,1,50,TRUE,1,65,FALSE,1,100,TRUE,1,80,TRUE,0,50,TRUE,0,50,TRUE,0,100,TRUE,1,53,FALSE,0,50,TRUE,1,60,0.1849,0.04,0.1296,0.25,0.16,0.2809,0.1225,0.1156,0.25,0.25,0.2209,0.25,0.0361,0.2209,0.09,0.25,0.25,0.25,0.25,0,0.2401,0.25,0.3025,0.25,0.25,0.25,0.25,0.6084,0.2916,1,1,0.7056,0.299825,0.196207143,0.403442857,9,28.13,16,50,3,37.5,4,50,4,50,5,62.5,11,68.75,5,31.25,61.69,54.88,60.5,71.75,59.62,59.19,64.19,-21.87,11.69,17.38,10.5,21.75,-2.88,-9.56,32.94,1,0,4,0,6,4,0,4,4,4,2,6,1,6,2,6,0,6,0,3,0,1,1,2,0,0,3,0,0,2,0,0,1,0,1,0,2,0,1,1,2.2,3.2,3.4,3,0.8,1,0.4,0.8,2.95,0.75,7.33,2.33,2,7,6,1,5,10 cents,5 minutes,47 days,Female,University - Undergraduate,21,0.125,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,1,-1,3,-2,6,4,-3,4,4,2,2,6,0,6,1,6,-2,6,-1,2,1.4,2.2,3,2.2,2.2,C_Ug +884,R_7ReKyF7BtGzjQc0,25 - 31,American,Female,3,3,2,-1,0,0,-3,1,3,1,1,1,1,-3,1,-3,-2,-2,-3,-1,3,2,1,1,0,3,-1,-3,-1,1,0,1,1,1,1,-3,1,2,-2,-2,-2,-2,-2,1,2,3,2,0,0,2,0,-3,0,1,1,3,2,2,2,-3,2,3,-2,-2,-2,-2,-2,0,TRUE,0,93,FALSE,0,63,TRUE,0,72,FALSE,1,89,TRUE,1,87,FALSE,1,100,TRUE,1,85,TRUE,1,98,FALSE,0,89,TRUE,1,100,FALSE,1,93,TRUE,0,94,TRUE,1,89,FALSE,1,86,FALSE,0,91,TRUE,1,91,TRUE,0,92,TRUE,0,83,FALSE,1,59,FALSE,1,80,FALSE,0,100,FALSE,0,60,FALSE,1,100,TRUE,1,82,FALSE,1,93,TRUE,1,66,FALSE,1,50,FALSE,1,94,TRUE,0,97,TRUE,1,94,FALSE,0,89,TRUE,1,100,0.0004,0.1156,0.0081,0.0225,0,0,0.0324,0,0.04,0.36,0.0036,0.0121,0.7921,0.0049,0.0169,0.3969,0,0.0121,0.0036,0.0049,1,0.8281,0.1681,0.0196,0.8464,0.25,0.7921,0.8649,0.5184,0.6889,0.9409,0.8836,0.338589286,0.119357143,0.557821429,8,25,20,62.5,4,50,5,62.5,5,62.5,6,75,10,62.5,10,62.5,86.22,77.88,95.62,83.25,88.12,86.5,85.94,-37.5,23.72,27.88,33.12,20.75,13.12,24,23.44,0,1,1,2,0,1,0,2,2,1,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0,0,0,1,2,0,1,1,1,0,1,1,0,0,1,1,0.8,1.2,0,0.6,0.4,0.6,0.8,0.6,0.65,0.6,2,2.67,1,-2,-1,1,-0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,-1,1,1,1,0,1,0,1,0,1,-1,-1,-1,0,-1,0,0,0,0,0,0.4,0.6,-0.8,0,0.05,C_Ug +885,R_1zSef5kmP9u9TPo,25 - 31,American,Prefer not to say,2,2,2,2,2,0,0,2,0,2,0,0,2,0,2,0,0,0,0,0,3,3,3,3,3,1,0,0,2,1,2,3,0,0,2,2,2,1,0,0,0,0,0,1,3,3,3,3,3,3,0,0,2,0,2,1,0,0,2,1,2,1,-1,-1,-1,-1,-1,1,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,0,53,TRUE,1,100,FALSE,1,100,TRUE,1,53,TRUE,1,100,TRUE,1,100,FALSE,0,71,TRUE,0,53,TRUE,0,100,TRUE,1,100,TRUE,0,69,TRUE,1,65,TRUE,1,100,TRUE,0,63,FALSE,1,100,FALSE,1,100,TRUE,0,57,TRUE,1,60,TRUE,1,64,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,65,FALSE,1,61,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0.2209,0,0,0,0.5041,0.3249,0.1296,0,0,0,0.2809,0,0.3025,0,0.2809,0.1521,0,0.16,0.1225,0,0.4761,0.3969,0.4225,0.36,0,0,0,1,1,0.211178571,0.130207143,0.29215,16,50,21,65.63,3,37.5,6,75,6,75,6,75,13,81.25,8,50,82.78,68.88,90.38,82.12,89.75,83,82.56,-15.63,17.15,31.38,15.38,7.12,14.75,1.75,32.56,1,1,1,1,1,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0.2,0.4,0,1,0,0.2,1,0.4,0.55,1.67,1.67,-2,2,0,0,0,10 cents,100 minutes,24 days,Prefer not to say,University - Graduate (Masters),31,1.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,-1,-1,-1,-1,-1,0,0.2,0.2,-1,-0.15,grad_prof +886,R_5yaxFqyivv3pIQM,18 - 24,American,Female,2,3,3,-3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,-3,5,0,0,0,0,0,6,2,1,3,3,3,5,3,3,3,3,3,4,3,3,3,-3,-3,3,3,3,3,3,3,4,3,2,2,3,3,4,0,0,3,0,0,3,FALSE,1,61,TRUE,1,100,TRUE,0,72,FALSE,1,85,FALSE,0,73,TRUE,0,80,TRUE,1,68,FALSE,0,72,TRUE,1,83,TRUE,1,76,FALSE,1,79,TRUE,0,89,FALSE,0,72,FALSE,1,58,FALSE,0,75,FALSE,0,76,FALSE,1,79,TRUE,0,77,FALSE,1,68,FALSE,1,65,TRUE,1,82,FALSE,0,83,FALSE,1,89,TRUE,1,86,TRUE,0,74,TRUE,1,81,TRUE,0,67,TRUE,0,79,TRUE,0,83,TRUE,1,84,TRUE,1,61,TRUE,1,100,0.5184,0.0361,0.5776,0.1024,0,0.64,0.0196,0.0576,0.1225,0.6889,0.0256,0.5184,0.0289,0.0441,0.5329,0,0.0121,0.0225,0.6241,0.5476,0.0324,0.5625,0.1024,0.1764,0.0441,0.4489,0.1521,0.1521,0.5184,0.5929,0.6889,0.7921,0.291,0.193792857,0.388207143,24,75,18,56.25,6,75,4,50,5,62.5,3,37.5,10,62.5,8,50,77.41,77.25,82.25,72.25,77.88,79.5,75.31,18.75,21.16,2.25,32.25,9.75,40.38,17,25.31,0,0,0,6,0,3,3,3,3,3,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,3,3,0,3,3,1.2,3,0.6,0,0.2,0,0.4,2.4,1.2,0.75,5.33,3.67,2,2,1,1,1.66,20 cents,100 minutes,36 days,Female,High School (or equivalent),23,-0.625,0,0,0,0,1,0,0,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,0,0,6,0,3,3,3,3,3,1,1,-1,0,0,-3,-3,0,-3,-3,1,3,0.2,-2.4,0.45,HS_TS +887,R_6UVBLYH5Wp8n5Ci,32 - 38,American,Female,2,3,2,2,3,2,-1,2,-1,2,3,2,3,0,3,2,2,2,2,2,2,2,2,1,2,1,1,0,1,-1,-1,1,3,1,2,0,2,1,-1,0,0,1,-1,1,2,2,2,2,2,1,2,-1,2,-1,1,1,3,1,2,0,2,1,1,1,1,1,1,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0.25,0.142857143,0.357142857,27,84.38,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,100,100,100,100,100,100,100,6.25,21.87,0,37.5,12.5,37.5,12.5,31.25,0,1,0,1,1,1,1,1,0,3,0,1,1,0,1,3,2,2,1,3,0,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0.6,1.2,0.6,2.2,0.4,0.2,0.6,1,1.15,0.55,1,1,0,0,0,0,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),32,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,0,0,0,1,0,1,1,1,0,2,0,0,0,0,0,2,1,1,0,2,0.2,1,0,1.2,0.6,grad_prof +888,R_7gbZbs5pz5pzmpN,18 - 24,American,Male,-1,3,1,2,0,2,-2,3,-2,1,1,0,2,2,2,1,1,-2,-2,-2,0,1,3,-1,0,8,-2,-1,-3,2,2,8,1,2,0,-1,2,7,-3,-1,-3,-3,0,7,1,3,1,2,1,10,3,-2,2,-3,2,3,1,0,2,2,3,7,2,2,2,3,0,7,FALSE,1,100,TRUE,1,75,FALSE,1,80,FALSE,1,50,TRUE,1,91,FALSE,1,50,TRUE,1,55,FALSE,0,80,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,75,FALSE,1,70,TRUE,1,50,TRUE,1,100,TRUE,0,70,TRUE,0,75,TRUE,0,50,FALSE,1,70,TRUE,1,75,TRUE,1,100,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,0,50,FALSE,1,50,TRUE,0,75,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.64,0.04,0,0.2025,0,0.25,0,0,0.09,0,0.01,0.0625,0.25,0.25,0.0081,0.0625,0.64,0.25,0.25,0,0.0625,0.25,0.25,0.09,0.49,0.25,0.25,0,0.04,0.5625,0.5625,1,0.211807143,0.133792857,0.289821429,16,50,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,74.72,53.12,77,85,83.75,79.44,70,-21.88,2.84,-9.38,14.5,-2.5,8.75,-8.06,13.75,1,2,2,3,0,4,1,6,4,1,0,2,2,3,0,4,2,1,1,2,2,0,0,0,1,1,0,1,1,1,0,0,0,0,1,1,1,4,5,2,1.6,3.2,1.4,2,0.6,0.8,0.2,2.6,2.05,1.05,7.67,6.67,-2,5,0,0,1,10 cents,100 minutes,36 days,Male,High School (or equivalent),21,1.5,0,0,0,1,1,0,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,-1,2,2,3,-1,3,1,5,3,0,0,2,2,3,-1,3,1,-3,-4,0,1,2.4,1.2,-0.6,1,HS_TS +889,R_6VmrmE3nt3lx2jj,25 - 31,American,Female,2,3,2,3,-3,-3,-2,1,2,-2,2,1,2,0,2,-2,-2,-2,-2,-2,3,3,3,3,-3,1,-3,-3,-2,3,-3,1,2,2,2,-1,2,1,-2,-2,-2,-2,-2,1,3,2,2,3,-3,1,-2,-3,1,2,-2,1,2,2,2,0,2,1,1,0,1,1,-2,8,TRUE,0,100,FALSE,0,53,TRUE,0,94,FALSE,1,56,TRUE,1,96,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,1,70,TRUE,0,54,FALSE,0,50,TRUE,1,95,TRUE,0,53,TRUE,0,100,TRUE,0,70,FALSE,1,55,TRUE,1,97,FALSE,0,56,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,90,TRUE,0,100,TRUE,1,95,FALSE,0,82,TRUE,1,95,0,0,0.0025,0,0.0025,0.0036,0,0,0.2025,0.3136,0.0025,0.09,0.09,0.49,0.0016,0.2809,0.2116,0.1936,0.01,0,0.0009,0.25,0.49,0.2916,0.2809,0.25,0.6724,1,0.8836,1,1,1,0.32185,0.134457143,0.509242857,25,78.13,18,56.25,2,25,6,75,4,50,6,75,12,75,6,37.5,81.22,62.62,82.38,88.75,91.12,84.94,77.5,21.88,24.97,37.62,7.38,38.75,16.12,9.94,40,1,0,1,0,0,0,1,3,1,1,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,3,2,3,3,0,0.4,1.2,0.4,0,0.4,0.4,0.2,2.2,0.5,0.8,1,1,0,0,0,-7,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),27,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,0,-1,1,0,0,-1,0,3,1,1,0,0,0,1,0,-3,-2,-3,-3,0,0,0.8,0.2,-2.2,-0.3,HS_TS +890,R_1j8rDeHXUGqOs1B,25 - 31,American,Female,2,2,2,2,3,1,1,0,2,2,3,2,3,1,2,-1,-1,-3,-2,-2,0,2,2,-1,1,4,2,2,3,2,1,4,3,3,0,3,3,5,2,2,3,2,1,6,2,2,2,2,3,0,2,0,2,0,2,4,2,2,3,1,2,0,2,2,2,2,0,4,FALSE,1,50,FALSE,0,50,FALSE,1,65,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,60,FALSE,0,60,TRUE,1,50,TRUE,1,85,FALSE,1,50,TRUE,0,60,TRUE,1,50,TRUE,0,50,TRUE,1,60,FALSE,0,50,FALSE,1,50,TRUE,0,60,TRUE,0,50,FALSE,1,60,FALSE,0,70,TRUE,1,60,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,60,TRUE,0,50,FALSE,1,60,TRUE,0,55,FALSE,0,85,FALSE,0,50,TRUE,1,60,0.36,0.16,0.25,0.16,0.16,0,0.0625,0.0225,0.16,0.16,0.7225,0.25,0.25,0.25,0.25,0.25,0,0.25,0.16,0,0.49,0.16,0.25,0.25,0.25,0.25,0.25,0.25,0.1225,0.36,0.3025,0.36,0.222946429,0.199107143,0.246785714,16,50,20,62.5,4,50,6,75,6,75,4,50,10,62.5,10,62.5,62.03,51.25,66.88,65.62,64.38,60.94,63.12,-12.5,-0.47,1.25,-8.12,-9.38,14.38,-1.56,0.62,2,0,0,3,2,1,1,3,0,1,0,1,3,2,1,3,3,6,4,3,0,0,0,0,0,1,1,2,2,0,1,0,0,0,0,3,3,5,4,2,1.4,1.2,1.4,3.8,0,1.2,0.2,3.4,1.95,1.2,4.33,1.33,4,0,5,2,3,10 cents,100 minutes,47 days,Female,University - Undergraduate,27,0.375,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,0,0,3,2,0,0,1,-2,1,-1,1,3,2,1,0,0,1,0,1,1.4,0,1.2,0.4,0.75,C_Ug +891,R_3Jq5MA8WvQoLH6T,25 - 31,American,Female,3,3,0,1,3,-2,1,2,0,2,2,-1,3,1,2,-1,1,-1,-1,-2,3,3,3,3,1,4,-3,2,0,2,0,7,-1,-2,1,2,2,4,0,-2,-1,-2,-1,7,3,3,1,2,3,1,-2,0,1,-1,2,4,2,-1,3,0,2,2,2,1,2,1,1,7,FALSE,1,73,FALSE,0,52,TRUE,0,100,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,75,FALSE,1,62,TRUE,1,100,FALSE,1,92,TRUE,1,63,FALSE,0,93,TRUE,0,83,TRUE,0,81,TRUE,0,60,FALSE,1,58,TRUE,1,53,TRUE,1,57,FALSE,1,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,93,TRUE,0,100,FALSE,0,91,FALSE,0,50,FALSE,0,100,0,0,0.8649,0.0049,1,0,0,0,0.1764,0.1849,0.8281,0,0.1156,0.0625,0,0.2704,0.0196,0.1681,0.8649,0,0.2209,0.1369,0.36,0.0064,0.6889,0.25,0.25,0.0729,1,0.6561,1,0.1444,0.30275,0.201828571,0.403671429,21,65.63,21,65.63,5,62.5,5,62.5,7,87.5,4,50,11,68.75,10,62.5,80.94,59.38,90.25,87,87.12,82.38,79.5,0,15.31,-3.12,27.75,-0.5,37.12,13.63,17,0,0,3,2,2,1,1,2,2,2,3,1,2,1,0,1,3,0,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0,3,0,3,2,3,1.4,1.6,1.4,1.2,0.4,0.6,0.2,2.2,1.4,0.85,5,2.33,3,3,2,0,2.67,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),25,1.25,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,0,0,2,1,2,1,0,1,1,2,3,1,2,0,0,-2,3,-3,-1,-2,1,1,1.2,-1,0.55,grad_prof +892,R_77OGSdkLT2ZcOzu,25 - 31,American,Male,1,3,1,2,-1,-2,2,-1,2,-1,1,-3,3,0,3,-1,-1,-1,-1,-2,-1,2,3,2,-1,6,-2,-1,-3,1,-1,5,3,1,-1,2,3,7,-1,-2,-2,1,-2,5,3,3,1,1,3,6,1,-1,1,1,1,6,0,-3,3,-1,3,6,2,2,2,3,1,7,FALSE,1,100,TRUE,1,100,TRUE,0,80,FALSE,1,76,TRUE,1,95,FALSE,1,75,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,60,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,55,FALSE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,0,75,FALSE,1,75,TRUE,1,65,TRUE,0,65,FALSE,1,50,TRUE,0,80,FALSE,0,90,TRUE,1,50,TRUE,1,100,0,0.1225,0,0,0,0.0625,0.5625,0.01,0,0,0.81,0.01,0,0.16,0.0025,0,0,0.0576,0.25,0.0625,0.04,0.0625,0.16,0,0.2025,0.4225,0.25,0,0.64,0,0.64,0,0.157325,0.11965,0.195,16,50,27,84.38,7,87.5,7,87.5,8,100,5,62.5,14,87.5,13,81.25,83.94,73.25,84.38,91.25,86.88,88.12,79.75,-34.38,-0.44,-14.25,-3.12,-8.75,24.38,0.62,-1.5,2,1,2,0,0,0,3,2,1,0,2,4,4,2,0,0,1,1,2,0,2,0,0,1,4,3,3,2,1,2,1,0,0,1,0,3,3,3,4,3,1,1.2,2.4,0.8,1.4,2.2,0.4,3.2,1.35,1.8,6,6,0,-1,1,-2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,26,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,1,2,-1,-4,-3,0,0,0,-2,1,4,4,1,0,-3,-2,-2,-2,-3,-0.4,-1,2,-2.4,-0.45,C_Ug +893,R_5nUWBF6DV3W816R,25 - 31,American,Female,1,2,2,2,3,-1,1,-1,2,2,0,1,0,1,3,0,-3,-2,0,-3,-2,-1,2,1,-1,7,0,-2,1,-3,-3,7,1,-1,-1,-1,1,6,-3,-3,-3,-3,-3,5,2,2,-1,0,3,7,2,-2,3,-3,3,8,2,2,3,0,3,8,3,3,2,3,2,8,FALSE,1,83,TRUE,1,94,TRUE,0,99,FALSE,1,95,TRUE,1,96,FALSE,1,73,TRUE,1,55,TRUE,1,98,TRUE,1,94,TRUE,1,99,FALSE,1,90,TRUE,0,98,TRUE,1,93,FALSE,1,56,TRUE,1,81,TRUE,1,98,TRUE,0,80,TRUE,0,96,TRUE,0,79,FALSE,1,89,TRUE,1,64,FALSE,0,50,TRUE,0,82,TRUE,1,53,FALSE,1,93,TRUE,1,98,TRUE,0,99,TRUE,0,98,TRUE,0,97,FALSE,0,86,FALSE,0,66,FALSE,0,99,0.0004,0.0004,0.0004,0.2025,0.9801,0.0729,0.2209,0.0001,0.0121,0.25,0.7396,0.0049,0.0036,0.01,0.0016,0.0036,0.6724,0.0025,0.9604,0.0049,0.1296,0.0361,0.6241,0.1936,0.64,0.9801,0.4356,0.0289,0.9801,0.9216,0.9409,0.9604,0.386092857,0.21245,0.559735714,21,65.63,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,85.34,87.25,85.5,78.75,89.88,82.75,87.94,6.25,25.96,24.75,35.5,3.75,39.88,7.75,44.19,3,3,0,1,4,1,3,2,5,5,1,2,1,2,2,3,0,1,3,0,1,0,3,2,0,3,3,4,5,1,2,1,3,1,0,3,6,4,3,5,2.2,3.2,1.6,1.4,1.2,3.2,1.4,4.2,2.1,2.5,6.67,7.67,0,-1,-2,-3,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),29,0.75,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,2,3,-3,-1,4,-2,0,-2,0,4,-1,1,-2,1,2,0,-6,-3,0,-5,1,0,0.2,-2.8,-0.4,grad_prof +894,R_7rq1ZFhgbVbpRQm,25 - 31,American,Male,1,3,2,1,3,1,-1,2,-2,2,-1,1,2,-1,1,-1,1,2,2,1,3,3,3,2,3,10,-2,-2,-2,-2,-2,4,-3,-3,-3,-3,-3,10,0,0,0,0,0,10,3,3,-1,3,3,9,3,-2,3,-3,3,8,3,3,3,-2,3,10,3,3,3,3,3,10,TRUE,0,100,FALSE,0,58,TRUE,0,99,TRUE,0,72,FALSE,0,56,TRUE,0,62,TRUE,1,100,FALSE,0,57,TRUE,1,85,TRUE,1,91,FALSE,1,82,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,FALSE,0,52,FALSE,1,54,TRUE,0,100,FALSE,1,57,FALSE,1,53,TRUE,1,100,FALSE,0,59,FALSE,1,51,FALSE,0,51,TRUE,0,71,TRUE,1,100,FALSE,1,52,TRUE,0,100,FALSE,1,63,TRUE,1,100,FALSE,0,51,TRUE,1,100,0.3249,0,0.2704,0,0,0.3844,0.2601,0.0081,0.2209,0.3481,0,0,0.0225,0.0324,0.3136,0.3364,0.2401,0.5184,1,0.5041,0,0.2304,0.1849,0,0.2116,0.2304,0.2601,1,0.9801,1,0.1369,1,0.336553571,0.191785714,0.481321429,21,65.63,17,53.13,5,62.5,6,75,4,50,2,25,9,56.25,8,50,75.88,63.62,73.25,90.12,76.5,75.75,76,12.5,22.75,1.12,-1.75,40.12,51.5,19.5,26,2,0,1,1,0,3,1,4,0,4,2,4,5,2,4,1,1,2,2,1,2,0,3,2,0,2,1,1,1,1,4,2,1,1,2,4,2,1,1,2,0.8,2.4,3.4,1.4,1.4,1.2,2,2,2,1.65,8,9,1,-4,0,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),26,-0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,-2,-1,0,1,0,3,-1,3,-2,2,4,1,2,-3,-1,1,1,-1,-0.6,1.2,1.4,-0.6,0.35,HS_TS +895,R_1duwX3m2RzUdeij,18 - 24,Canadian,Female,2,3,3,-3,2,-1,1,0,2,1,0,-3,3,-1,3,-1,1,0,-1,-3,1,3,3,-3,-1,4,-2,3,-2,2,-1,6,1,-3,3,1,3,7,1,2,2,1,-1,6,2,3,3,-3,1,6,-2,1,1,0,3,6,0,-3,3,1,3,5,0,0,0,0,0,5,TRUE,0,85,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,96,FALSE,1,100,TRUE,1,50,TRUE,1,96,TRUE,1,70,TRUE,1,50,FALSE,1,70,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,1,59,TRUE,0,50,TRUE,1,96,FALSE,1,50,FALSE,1,60,TRUE,0,100,FALSE,0,100,FALSE,0,50,TRUE,1,86,0.0016,0.0016,0,0.25,0.0196,0,0.1681,0.25,0.25,0.0025,1,0,0.09,0.09,0.0016,0.25,0.25,0.25,0.16,0.25,0.25,0.25,0,0,0.25,0.25,0.25,0.7225,1,1,1,0.25,0.294796429,0.187271429,0.402321429,22,68.75,22,68.75,6,75,5,62.5,5,62.5,6,75,13,81.25,9,56.25,73.84,61.25,79,78.25,76.88,74.88,72.81,0,5.09,-13.75,16.5,15.75,1.88,-6.37,16.56,1,0,0,0,3,1,2,2,0,2,1,0,0,2,0,2,1,2,2,2,0,0,0,0,1,1,0,1,2,2,0,0,0,2,0,1,1,0,1,3,0.8,1.4,0.6,1.8,0.2,1.2,0.4,1.2,1.15,0.75,5.67,5.67,-2,0,2,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,22,1.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,1,0,0,0,2,0,2,1,-2,0,1,0,0,0,0,1,0,2,1,-1,0.6,0.2,0.2,0.6,0.4,C_Ug +896,R_7CEILV5bRV86Hvl,18 - 24,American,Female,2,3,2,1,2,2,-1,3,1,2,-1,2,2,2,1,3,2,3,3,2,3,3,2,2,3,4,1,1,3,2,2,4,1,2,-1,2,2,4,-1,1,-1,-1,-2,5,3,3,1,2,2,3,2,-1,3,1,1,1,-1,1,2,2,1,4,3,3,3,3,2,1,TRUE,0,74,FALSE,0,60,TRUE,0,86,TRUE,0,61,TRUE,1,91,FALSE,1,95,TRUE,1,87,TRUE,1,92,TRUE,1,51,FALSE,0,100,FALSE,1,65,FALSE,1,70,TRUE,1,75,FALSE,1,70,TRUE,1,70,TRUE,1,91,FALSE,1,55,TRUE,0,58,FALSE,1,56,FALSE,1,57,TRUE,1,70,TRUE,1,71,TRUE,0,69,FALSE,0,58,FALSE,1,97,TRUE,1,75,TRUE,0,68,FALSE,1,64,TRUE,0,82,TRUE,1,67,FALSE,0,64,TRUE,1,92,0.0064,0.0625,0.0081,0.0169,0.0064,0.0025,0.3364,1,0.1849,0.0841,0.1089,0.0625,0.2401,0.1225,0.0081,0.36,0.4761,0.3721,0.1296,0.0009,0.09,0.09,0.1936,0.09,0.2025,0.4624,0.4096,0.5476,0.7396,0.3364,0.6724,0.09,0.264971429,0.240328571,0.289614286,20,62.5,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,73.16,61.88,78.62,79,73.12,75.88,70.44,-3.13,7.53,11.88,3.62,16.5,-1.88,0.88,14.19,1,0,0,1,1,1,2,0,1,0,2,0,3,0,1,4,1,4,4,4,1,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0.6,0.8,1.2,3.4,0.6,0.2,0.2,0.2,1.5,0.3,4,2.67,1,3,0,4,1.33,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,-1,0,1,1,2,0,1,-1,2,-1,3,0,1,4,0,4,4,4,0,0.6,1,3.2,1.2,C_Ug +897,R_6IB94fVqlSmayPv,18 - 24,Canadian,Female,2,3,3,1,3,2,1,2,2,3,3,-1,3,1,3,1,1,2,3,3,3,3,2,-2,2,5,2,1,1,2,1,2,1,1,2,3,3,4,-1,-1,-2,1,-1,7,3,3,3,2,3,1,2,2,2,2,3,1,3,-2,3,-1,3,2,3,3,3,3,3,4,TRUE,0,59,TRUE,1,90,TRUE,0,85,FALSE,1,51,TRUE,1,100,FALSE,1,70,TRUE,1,60,TRUE,1,64,TRUE,1,51,TRUE,1,91,TRUE,0,54,TRUE,0,75,TRUE,1,55,FALSE,1,60,TRUE,1,52,TRUE,1,70,TRUE,0,59,TRUE,0,100,FALSE,1,51,TRUE,0,95,TRUE,1,73,TRUE,1,83,TRUE,0,51,TRUE,1,87,FALSE,1,63,TRUE,1,96,TRUE,0,51,FALSE,1,52,TRUE,0,57,TRUE,1,100,TRUE,1,56,TRUE,1,100,0.1296,0.0016,0.09,0.16,0,0.09,0.0169,0.0081,0.9025,0.0289,0,0.2025,0.2401,0.2916,0,0.01,0.2601,0.2401,0.2304,0.1369,0.0729,0.2304,0.2401,0.16,0.3481,0.2601,0.1936,0.3481,0.7225,1,0.3249,0.5625,0.254332143,0.163628571,0.345035714,17,53.13,22,68.75,6,75,5,62.5,6,75,5,62.5,16,100,6,37.5,70.66,57,70.62,76.5,78.5,76.75,64.56,-15.62,1.91,-18,8.12,1.5,16,-23.25,27.06,1,0,1,3,1,0,0,1,0,2,2,2,1,2,0,2,2,4,2,4,1,0,0,1,0,0,1,0,0,0,0,1,0,2,0,2,2,1,0,0,1.2,0.6,1.4,2.8,0.4,0.2,0.6,1,1.5,0.55,3.67,1.33,4,1,2,3,2.34,10 cents,5 minutes,24 days,Female,High School (or equivalent),20,0.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,0,1,2,1,0,-1,1,0,2,2,1,1,0,0,0,0,3,2,4,0.8,0.4,0.8,1.8,0.95,HS_TS +898,R_16eDFK5gNmiumwF,18 - 24,American,Female,2,3,3,3,3,-1,1,1,1,-1,1,0,2,2,3,0,-1,-1,2,0,2,3,3,3,3,1,0,2,1,2,-2,7,2,2,2,-2,3,5,3,3,3,3,3,8,3,3,3,3,3,1,0,0,3,-2,2,4,3,3,3,3,3,6,2,2,2,2,2,5,FALSE,1,59,FALSE,0,62,TRUE,0,100,TRUE,0,67,TRUE,1,70,FALSE,1,100,FALSE,0,65,FALSE,0,97,TRUE,1,58,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,55,TRUE,0,77,FALSE,0,66,TRUE,1,76,FALSE,1,59,TRUE,0,100,TRUE,0,60,FALSE,1,63,FALSE,0,100,FALSE,0,62,TRUE,0,67,FALSE,0,53,FALSE,1,90,TRUE,1,81,TRUE,0,60,TRUE,0,67,FALSE,1,78,TRUE,1,100,FALSE,0,72,TRUE,1,100,0.9409,0.0361,0.0576,0.4225,0,0,0.2809,1,0.1369,0.3844,0,0.2025,0.1764,0,0.09,0.3844,0.4489,0.4489,0.4489,0.01,1,0.4356,0.36,0.5929,0.1681,0.36,0.5184,0.1681,1,1,0.0484,1,0.380846429,0.253807143,0.507885714,10,31.25,14,43.75,2,25,6,75,3,37.5,3,37.5,7,43.75,7,43.75,77,68.12,78.62,79.25,82,76.06,77.94,-12.5,33.25,43.12,3.62,41.75,44.5,32.31,34.19,0,0,0,0,0,1,1,0,1,1,1,2,0,4,0,3,4,4,1,3,1,0,0,0,0,1,1,2,3,3,2,3,1,1,0,2,3,3,0,2,0,0.8,1.4,3,0.2,2,1.4,2,1.3,1.4,4.33,3.67,0,3,-1,3,0.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,-1,0,0,0,0,0,0,-2,-2,-2,-1,-1,-1,3,0,1,1,1,1,1,-0.2,-1.2,0,1,-0.1,HS_TS +899,R_5YRfud4tR7Cg3Kq,25 - 31,American,Male,2,3,3,3,2,1,-3,3,-3,3,1,2,3,-3,3,3,2,2,2,0,3,3,3,0,3,0,1,-3,3,-3,3,3,3,1,3,-3,3,1,-1,-3,-3,-3,-3,0,3,3,3,2,3,1,1,-3,3,-3,3,2,-1,-3,3,1,3,1,-3,-3,3,-3,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,88,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.8649,0.25,0,0,0,0,0.7744,1,0,1,0.25,0,1,0,1,1,0.263903571,0.097492857,0.430314286,27,84.38,24,75,5,62.5,6,75,7,87.5,6,75,15,93.75,9,56.25,94.72,79.75,99.12,100,100,96.88,92.56,9.38,19.72,17.25,24.12,12.5,25,3.13,36.31,1,0,0,3,1,0,0,0,0,0,2,1,0,0,0,4,5,5,5,3,1,0,0,1,1,0,0,0,0,0,2,5,0,4,0,6,5,1,5,3,1,0,0.6,4.4,0.6,0,2.2,4,1.5,1.7,1.33,1.33,-1,1,0,0,0,20 cents,5 minutes,47 days,Male,University - PhD,29,1.375,0,1,1,0,0,0,0.67,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,0,0,2,0,0,0,0,0,0,0,-4,0,-4,0,-2,0,4,0,0,0.4,0,-1.6,0.4,-0.2,grad_prof +900,R_1nOdNjrTBRvM0PV,18 - 24,American,Female,3,3,2,3,1,3,1,3,2,0,2,1,3,1,3,1,-1,1,0,-1,3,3,2,2,-1,4,3,3,-2,3,-1,3,0,1,1,2,2,3,0,-1,0,-2,-2,3,3,3,2,2,2,1,2,1,1,0,2,3,1,0,3,2,1,3,0,1,2,0,1,6,TRUE,0,97,FALSE,0,58,TRUE,0,75,FALSE,1,56,FALSE,0,58,FALSE,1,56,TRUE,1,55,TRUE,1,89,TRUE,1,67,TRUE,1,95,FALSE,1,64,FALSE,1,90,FALSE,0,54,TRUE,0,90,TRUE,1,91,FALSE,0,58,TRUE,0,100,TRUE,0,96,FALSE,1,53,FALSE,1,54,TRUE,1,58,TRUE,1,90,TRUE,0,78,FALSE,0,65,FALSE,1,94,TRUE,1,87,FALSE,1,55,FALSE,1,65,FALSE,1,54,TRUE,1,91,FALSE,0,98,TRUE,1,100,0.0121,0.0169,0.3364,0.2025,0,0.1936,0.4225,0.0025,0.2116,0.01,0.0081,0.2916,0.1089,0.1296,0.3364,0.3364,0.6084,0.1936,0.1225,0.0036,0.1764,0.0081,0.2209,0.81,1,0.2025,0.9604,0.9409,0.5625,0.9216,0.2116,0.01,0.321578571,0.2038,0.439357143,22,68.75,20,62.5,6,75,4,50,5,62.5,5,62.5,10,62.5,10,62.5,74.72,67.75,69.75,88,73.38,75.88,73.56,6.25,12.22,-7.25,19.75,25.5,10.88,13.38,11.06,0,0,0,1,2,0,2,5,1,1,2,0,2,1,1,1,0,1,2,1,0,0,0,1,1,1,0,2,2,2,1,1,0,1,2,1,2,1,0,2,0.6,1.8,1.2,1,0.4,1.4,1,1.2,1.15,1,3.33,2.33,3,0,0,-3,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,19,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,0,1,-1,2,3,-1,-1,1,-1,2,0,-1,0,-2,0,2,-1,0.2,0.4,0.2,-0.2,0.15,C_Ug +901,R_7TvfjtO0ztEIfay,18 - 24,Canadian,Male,1,1,-1,1,3,-1,2,0,2,1,0,0,1,2,1,-3,0,-3,-3,-3,-1,1,-1,-1,2,4,0,0,0,0,0,5,-1,0,0,0,0,5,-2,-1,-1,-2,-2,3,0,1,0,1,3,5,0,1,0,1,1,5,1,0,0,0,1,5,0,-1,0,1,0,5,FALSE,1,59,FALSE,0,50,TRUE,0,89,FALSE,1,50,TRUE,1,72,FALSE,1,95,TRUE,1,92,TRUE,1,71,TRUE,1,54,TRUE,1,82,FALSE,1,100,FALSE,1,58,TRUE,1,100,FALSE,1,100,TRUE,1,64,TRUE,1,57,TRUE,0,73,TRUE,0,78,FALSE,1,55,FALSE,1,57,FALSE,0,68,TRUE,1,76,FALSE,1,62,FALSE,0,61,FALSE,1,50,TRUE,1,58,FALSE,1,57,TRUE,0,74,TRUE,0,57,TRUE,1,67,TRUE,1,78,FALSE,0,52,0.0841,0.1764,0.1849,0.0064,0.2704,0.0025,0.3721,0.0324,0.1849,0.0576,0.1089,0,0.2116,0,0.0784,0.25,0.1444,0.25,0.5476,0.25,0.4624,0.1296,0.2025,0,0.5329,0.1849,0.0484,0.1681,0.7921,0.6084,0.3249,0.1764,0.228264286,0.140228571,0.3163,12,37.5,23,71.88,7,87.5,4,50,7,87.5,5,62.5,12,75,11,68.75,69.25,63.5,72.38,74.38,66.75,68.88,69.62,-34.38,-2.63,-24,22.38,-13.12,4.25,-6.12,0.87,2,0,0,2,1,1,2,0,2,1,1,0,1,2,1,1,1,2,1,1,1,0,1,0,0,1,1,0,1,0,1,0,1,2,0,3,1,3,4,3,1,1.2,1,1.2,0.4,0.6,0.8,2.8,1.1,1.15,4.67,5,-1,0,0,-2,-0.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,1,0,-1,2,1,0,1,0,1,1,0,0,0,0,1,-2,0,-1,-3,-2,0.6,0.6,0.2,-1.6,-0.05,HS_TS +902,R_1k7msazkdMzLZEI,18 - 24,Canadian,Female,1,3,-1,1,2,-1,1,1,0,3,-1,1,3,0,3,0,1,1,-1,-2,2,-2,2,-3,0,5,1,1,-1,-1,1,7,1,1,2,1,2,5,3,2,3,0,3,7,1,3,-2,1,2,3,1,2,2,-1,2,3,-2,1,3,-1,3,4,2,2,2,3,2,8,FALSE,1,100,TRUE,1,50,FALSE,1,74,FALSE,1,58,TRUE,1,74,FALSE,1,56,TRUE,1,62,TRUE,1,50,TRUE,1,100,TRUE,1,80,TRUE,0,89,TRUE,0,53,FALSE,0,50,TRUE,0,53,TRUE,1,64,TRUE,1,100,FALSE,1,56,TRUE,0,81,FALSE,1,50,FALSE,1,67,TRUE,1,64,TRUE,1,50,FALSE,1,81,TRUE,1,59,FALSE,1,100,TRUE,1,64,FALSE,1,100,FALSE,1,50,TRUE,0,86,TRUE,1,58,TRUE,1,54,FALSE,0,60,0.25,0.1296,0,0.1444,0.36,0.1936,0.1681,0.04,0.1089,0.25,0.1764,0.25,0,0.7921,0.0676,0.25,0.0361,0.1764,0.25,0,0.1296,0.1296,0.25,0.2809,0.1936,0,0.2116,0,0.0676,0.6561,0.7396,0.2809,0.216382143,0.204942857,0.227821429,10,31.25,25,78.13,7,87.5,5,62.5,6,75,7,87.5,14,87.5,11,68.75,68.53,70.62,65.88,73.75,63.88,64.94,72.12,-46.88,-9.6,-16.88,3.38,-1.25,-23.62,-22.56,3.37,1,5,3,4,2,2,0,2,1,2,2,0,1,1,1,3,1,2,1,5,0,0,1,0,0,2,1,1,1,1,1,0,0,1,0,2,1,1,4,4,3,1.4,1,2.4,0.2,1.2,0.4,2.4,1.95,1.05,5.67,3.33,2,4,1,-1,2.34,10 cents,100 minutes,47 days,Female,High School (or equivalent),18,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,5,2,4,2,0,-1,1,0,1,1,0,1,0,1,1,0,1,-3,1,2.8,0.2,0.6,0,0.9,HS_TS +903,R_6U3KmYdeqoSlheG,18 - 24,Canadian,Female,-2,3,0,3,2,-2,0,0,1,0,0,-3,2,1,0,0,2,-1,0,-3,2,1,2,-2,0,4,-3,0,0,2,-3,10,0,0,0,1,0,7,1,0,1,-2,0,2,2,3,1,3,3,2,-2,-2,2,0,2,3,0,-3,3,1,0,2,3,3,3,3,1,1,TRUE,0,67,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,60,TRUE,1,59,FALSE,0,69,FALSE,0,85,TRUE,1,100,TRUE,0,95,TRUE,0,91,TRUE,1,87,FALSE,1,91,FALSE,0,77,TRUE,1,69,TRUE,0,78,TRUE,0,93,TRUE,0,50,FALSE,1,50,TRUE,1,79,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,1,72,TRUE,1,100,FALSE,1,50,TRUE,0,59,TRUE,0,62,FALSE,0,80,FALSE,0,59,TRUE,1,96,0.4761,0,0.0961,0.1681,0.0016,0.16,0,0,0.25,0.25,0.64,0.0169,0.7225,0.9025,0,0.25,0.25,0.25,0.3481,0.0784,0.0441,0.5929,0.25,0.0081,0.6084,0.25,0.3481,0.4489,0,0.8649,0.3844,0.8281,0.312425,0.263821429,0.361028571,20,62.5,18,56.25,3,37.5,6,75,5,62.5,4,50,10,62.5,8,50,74.31,64.5,76.5,79,77.25,78.75,69.88,6.25,18.06,27,1.5,16.5,27.25,16.25,19.88,4,2,2,5,2,1,0,0,1,3,0,3,2,0,0,1,2,2,2,3,4,0,1,0,1,0,2,2,1,2,0,0,1,0,0,3,1,4,3,4,3,1,1,2,1.2,1.4,0.2,3,1.75,1.45,7,2.33,2,7,5,1,4.67,10 cents,5 minutes,24 days,Female,University - Undergraduate,24,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,0,2,1,5,1,1,-2,-2,0,1,0,3,1,0,0,-2,1,-2,-1,-1,1.8,-0.4,0.8,-1,0.3,C_Ug +904,R_3fJEhsjBdt5E5AT,18 - 24,American,Male,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0.321428571,0.142857143,0.5,30,93.75,23,71.88,5,62.5,7,87.5,8,100,3,37.5,14,87.5,9,56.25,100,100,100,100,100,100,100,21.87,28.12,37.5,12.5,0,62.5,12.5,43.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,0,0,0,0,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,22,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +905,R_5jTF8jxiUSm42md,18 - 24,American,Female,-3,3,-3,3,3,3,1,3,1,3,3,2,3,1,3,0,2,2,1,-3,-3,3,3,-1,3,8,-3,-2,0,3,-2,9,3,1,0,3,3,10,-3,-1,0,-3,-3,10,-3,3,-3,3,3,5,3,3,2,3,3,10,3,3,3,3,3,10,2,2,1,1,0,10,FALSE,1,60,TRUE,1,96,TRUE,0,100,TRUE,0,100,TRUE,1,55,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,78,TRUE,1,89,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,57,FALSE,1,58,TRUE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,69,TRUE,0,76,TRUE,1,100,TRUE,1,57,TRUE,1,52,0,0,0,0,0.2304,1,0.0256,0,1,0.3249,0,0,0,1,0.2025,0.0016,0.1764,1,0.4761,1,0,0.0121,1,0.0484,1,0.25,0.1849,0.16,1,1,0.5776,1,0.452517857,0.354385714,0.55065,16,50,18,56.25,4,50,5,62.5,5,62.5,4,50,15,93.75,3,18.75,86.91,86.5,80.12,86.88,94.12,86.88,86.94,-6.25,30.66,36.5,17.62,24.38,44.12,-6.87,68.19,0,0,6,4,0,6,3,3,2,5,0,1,3,2,0,3,3,2,4,0,0,0,0,0,0,0,2,1,2,0,0,1,0,2,0,2,0,1,0,3,2,3.8,1.2,2.4,0,1,0.6,1.2,2.35,0.7,9,8.33,3,-1,0,0,0.67,10 cents,100 minutes,24 days,Female,Trade School (non-military),20,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,6,4,0,6,1,2,0,5,0,0,3,0,0,1,3,1,4,-3,2,2.8,0.6,1.2,1.65,HS_TS +906,R_7wGM92UfF3Vd7Rk,18 - 24,American,Male,1,3,2,3,-3,2,2,2,1,2,-1,3,3,-2,3,3,-2,1,-1,2,2,3,3,-1,-3,7,2,-2,2,2,-1,10,3,-3,-1,2,3,7,0,2,2,-1,2,6,3,3,3,3,-2,1,3,3,2,-1,2,8,-1,3,3,-1,3,3,1,1,1,1,2,7,TRUE,0,99,TRUE,1,60,TRUE,0,95,TRUE,0,70,TRUE,1,57,TRUE,0,75,TRUE,1,60,TRUE,1,80,FALSE,0,65,TRUE,1,60,FALSE,1,65,TRUE,0,95,TRUE,1,95,TRUE,0,70,TRUE,1,58,TRUE,1,90,TRUE,0,80,TRUE,0,70,FALSE,1,53,FALSE,1,80,TRUE,1,99,FALSE,0,80,TRUE,0,54,FALSE,0,65,FALSE,1,80,TRUE,1,60,TRUE,0,55,TRUE,0,75,TRUE,0,51,TRUE,1,95,TRUE,1,55,TRUE,1,99,0.04,0.16,0.01,0.16,0.0001,0.5625,0.4225,0.16,0.04,0.64,0.0025,0.0025,0.4225,0.1225,0.1849,0.16,0.2916,0.49,0.5625,0.04,0.0001,0.1764,0.2209,0.49,0.64,0.3025,0.2025,0.9801,0.9025,0.49,0.2601,0.9025,0.345417857,0.250114286,0.440721429,7,21.88,17,53.13,5,62.5,4,50,4,50,4,50,13,81.25,4,25,73.28,60.12,76.25,72.38,84.38,73.62,72.94,-31.25,20.15,-2.38,26.25,22.38,34.38,-7.63,47.94,1,0,1,4,0,0,4,0,1,3,4,6,4,4,0,3,4,1,0,0,2,0,1,0,1,1,1,0,2,0,0,0,0,1,0,2,3,0,2,0,1.2,1.6,3.6,1.6,0.8,0.8,0.2,1.4,2,0.8,8,4,6,2,4,-1,4,5 cents,5 minutes,47 days,Male,University - Undergraduate,22,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-1,0,0,4,-1,-1,3,0,-1,3,4,6,4,3,0,1,1,1,-2,0,0.4,0.8,3.4,0.2,1.2,C_Ug +907,R_3l4abEHSRGvw1GI,18 - 24,Canadian,Male,0,0,0,0,0,-1,0,-1,0,1,1,-2,0,-1,1,0,0,0,0,1,1,0,1,0,-2,6,-2,1,3,-1,0,7,0,0,0,2,2,8,0,0,1,0,-1,5,-2,1,2,0,-1,5,1,2,2,0,1,8,0,0,0,0,0,6,0,0,0,0,0,5,TRUE,0,60,TRUE,1,50,FALSE,1,50,TRUE,0,89,FALSE,0,57,TRUE,0,61,FALSE,0,61,TRUE,1,72,TRUE,1,72,TRUE,1,89,FALSE,1,77,TRUE,0,90,TRUE,1,63,FALSE,1,50,TRUE,1,64,TRUE,1,82,FALSE,1,50,TRUE,0,81,TRUE,0,85,TRUE,0,77,FALSE,0,59,TRUE,1,50,FALSE,1,50,TRUE,1,95,TRUE,0,55,TRUE,1,50,FALSE,1,61,TRUE,0,59,FALSE,1,63,TRUE,1,93,FALSE,0,79,FALSE,0,100,0.0784,0.25,0.0324,0.3721,1,0.3721,0.0025,0.0121,0.5929,0.25,0.0049,0.1369,0.0784,0.0529,0.3249,0.25,0.25,0.7921,0.3481,0.3025,0.3481,0.1296,0.7225,0.25,0.25,0.1521,0.6241,0.36,0.25,0.6561,0.1369,0.81,0.337846429,0.294264286,0.381428571,24,75,18,56.25,5,62.5,4,50,4,50,5,62.5,11,68.75,7,43.75,68.56,72.12,62.88,62,77.25,71,66.12,18.75,12.31,9.62,12.88,12,14.75,2.25,22.37,1,0,1,0,2,1,1,4,1,1,1,2,0,3,1,0,0,1,0,2,2,1,2,0,1,2,2,3,0,0,1,2,0,1,1,0,0,0,0,1,0.8,1.6,1.4,0.6,1.2,1.4,1,0.2,1.1,0.95,7,6.33,1,-1,2,0,0.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,-1,-1,0,1,-1,-1,1,1,1,0,0,0,2,0,0,0,1,0,1,-0.4,0.2,0.4,0.4,0.15,HS_TS +908,R_3bE5SzkOxAqHxRL,18 - 24,American,Male,0,3,3,0,3,-3,-3,-3,-3,3,1,3,2,3,-3,2,1,3,3,0,1,1,3,-3,3,8,-3,-3,-3,-3,3,7,0,3,2,2,-3,9,0,0,0,3,-3,6,0,3,3,-3,3,10,-3,-3,-3,-3,3,5,-3,3,0,0,-3,5,3,3,3,3,0,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,100,FALSE,1,90,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0.0081,0,0,0,0,0.25,0,0,0.25,0,1,0,0,0.01,0,0,0,0.25,1,0,0,0,0,0,1,0,0,0,0,1,0,0.25,0.178928571,0.125714286,0.232142857,25,78.13,28,87.5,8,100,7,87.5,7,87.5,6,75,15,93.75,13,81.25,93.16,92.5,93.75,100,86.38,99.44,86.88,-9.37,5.66,-7.5,6.25,12.5,11.38,5.69,5.63,1,2,0,3,0,0,0,0,0,0,1,0,0,1,0,2,1,3,0,3,0,0,0,3,0,0,0,0,0,0,4,0,2,3,0,1,2,0,0,0,1.2,0,0.4,1.8,0.6,0,1.8,0.6,0.85,0.75,8,6.67,-2,2,4,-4,1.33,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),19,0.5,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,2,0,0,0,0,0,0,0,0,-3,0,-2,-2,0,1,-1,3,0,3,0.6,0,-1.4,1.2,0.1,grad_prof +909,R_3eIQtfq2u3vKgHa,18 - 24,Canadian,Female,2,3,2,2,3,-1,1,2,3,1,2,2,2,2,2,2,2,2,2,-1,1,3,3,1,3,5,1,1,1,2,1,2,1,1,1,1,1,2,2,2,2,2,2,4,3,3,3,2,2,6,2,2,1,3,1,2,2,2,2,2,2,3,2,2,1,1,1,3,TRUE,0,59,TRUE,1,60,TRUE,0,65,FALSE,1,59,FALSE,0,62,TRUE,0,63,TRUE,1,64,TRUE,1,65,TRUE,1,63,TRUE,1,58,TRUE,0,57,TRUE,0,81,TRUE,1,62,TRUE,0,67,TRUE,1,66,FALSE,0,63,FALSE,1,59,TRUE,0,81,FALSE,1,67,TRUE,0,63,TRUE,1,63,TRUE,1,62,FALSE,1,66,TRUE,1,62,TRUE,0,65,TRUE,1,63,TRUE,0,71,TRUE,0,66,TRUE,0,67,TRUE,1,60,FALSE,0,59,TRUE,1,62,0.1225,0.1369,0.3969,0.1296,0.1444,0.3969,0.1444,0.1764,0.3969,0.1444,0.16,0.1444,0.1369,0.3249,0.3844,0.16,0.1156,0.1681,0.4356,0.4225,0.1369,0.1156,0.1089,0.4489,0.1681,0.5041,0.3481,0.3481,0.4225,0.6561,0.4489,0.6561,0.293503571,0.214121429,0.372885714,11,34.38,17,53.13,5,62.5,5,62.5,4,50,3,37.5,13,81.25,4,25,64.06,62.75,63,64.88,65.62,62.12,66,-18.75,10.93,0.25,0.5,14.88,28.12,-19.13,41,1,0,1,1,0,2,0,1,1,0,1,1,1,1,1,0,0,0,0,3,1,0,1,0,1,3,1,1,0,0,0,0,0,0,0,0,0,1,1,2,0.6,0.8,1,0.6,0.6,1,0,0.8,0.75,0.6,3,3.67,-1,0,-1,1,-0.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,-1,-1,-1,0,1,0,1,1,1,1,1,0,0,-1,-1,1,0,-0.2,1,-0.2,0.15,C_Ug +910,R_5Id4nGbfP5nTMTD,18 - 24,Canadian,Female,2,2,-1,-3,2,2,1,3,-1,3,0,-3,3,2,3,2,1,2,2,-3,3,3,3,-2,3,4,-2,3,-3,3,-3,8,3,3,-1,3,0,9,-3,-3,-3,-3,-3,10,3,3,-3,2,3,8,0,-2,3,-3,3,5,-2,-3,3,-2,3,7,3,3,3,3,3,7,FALSE,1,60,TRUE,1,50,FALSE,1,80,FALSE,1,51,TRUE,1,85,FALSE,1,92,TRUE,1,65,TRUE,1,95,TRUE,1,51,TRUE,1,65,FALSE,1,51,TRUE,0,60,TRUE,1,53,FALSE,1,93,TRUE,1,52,TRUE,1,51,TRUE,0,51,TRUE,0,87,TRUE,0,51,TRUE,0,51,TRUE,1,51,TRUE,1,87,TRUE,0,65,TRUE,1,77,TRUE,0,76,TRUE,1,92,TRUE,0,51,FALSE,1,60,TRUE,0,52,TRUE,1,81,FALSE,0,52,TRUE,1,91,0.0025,0.0064,0.2401,0.1225,0.0081,0.0064,0.0529,0.1225,0.2601,0.0169,0.0361,0.2209,0.2401,0.2401,0.0225,0.25,0.4225,0.2401,0.16,0.5776,0.2401,0.2304,0.2601,0.0049,0.2601,0.2601,0.2704,0.16,0.04,0.7569,0.2704,0.36,0.213935714,0.1528,0.275071429,8,25,22,68.75,5,62.5,5,62.5,6,75,6,75,15,93.75,7,43.75,66.53,51.12,67.5,78.12,69.38,68.62,64.44,-43.75,-2.22,-11.38,5,3.12,-5.62,-25.13,20.69,1,1,4,1,1,4,2,6,4,6,3,6,4,1,3,5,4,5,5,0,1,1,2,5,1,2,3,0,2,0,2,0,0,4,0,1,2,1,1,6,1.6,4.4,3.4,3.8,2,1.4,1.2,2.2,3.3,1.7,7,6.67,-4,3,2,3,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,2,-4,0,2,-1,6,2,6,1,6,4,-3,3,4,2,4,4,-6,-0.4,3,2.2,1.6,1.6,HS_TS +911,R_3GdmyJ2yUqxO7YT,18 - 24,American,Female,-2,2,1,3,2,1,1,3,1,2,1,1,2,2,2,2,1,2,2,2,-2,3,1,3,-1,4,1,1,2,1,-1,8,3,3,-1,3,1,8,2,-1,1,1,1,7,-1,3,2,3,3,7,1,1,3,-1,2,6,2,2,1,3,2,6,3,3,3,3,3,8,TRUE,0,80,FALSE,0,54,TRUE,0,100,FALSE,1,59,TRUE,1,69,FALSE,1,100,TRUE,1,84,TRUE,1,66,TRUE,1,77,FALSE,0,79,FALSE,1,56,TRUE,0,68,FALSE,0,66,FALSE,1,59,TRUE,1,80,TRUE,1,94,TRUE,0,62,FALSE,1,88,FALSE,1,65,FALSE,1,55,FALSE,0,71,TRUE,1,93,FALSE,1,87,TRUE,1,78,FALSE,1,100,TRUE,1,84,FALSE,1,58,FALSE,1,97,TRUE,0,67,TRUE,1,65,FALSE,0,59,TRUE,1,86,0.1156,0.0256,0.0036,0.0256,0.0196,0,0.0484,0.6241,0.2025,0.0049,0.1225,0.4356,0.0529,0.1936,0.0961,0.2916,0.0169,0.1681,0.0009,0,0.5041,0.04,0.1225,0.1681,0.3844,0.1764,0.3481,0.64,1,0.0144,0.4489,0.4624,0.23525,0.162628571,0.307871429,24,75,22,68.75,6,75,4,50,6,75,6,75,11,68.75,11,68.75,75.19,63.5,76,83.38,77.88,75.31,75.06,6.25,6.44,-11.5,26,8.38,2.88,6.56,6.31,0,1,0,0,3,0,0,1,0,3,2,2,3,1,1,0,2,1,1,1,1,1,1,0,1,0,0,0,2,0,1,1,1,1,0,1,2,1,1,1,0.8,0.8,1.8,1,0.8,0.4,0.8,1.2,1.1,0.8,6.67,6.33,-3,2,2,-1,0.34,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),24,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,-1,0,-1,0,2,0,0,1,-2,3,1,1,2,0,1,-1,0,0,0,0,0,0.4,1,-0.2,0.3,grad_prof +912,R_7oYZmtoO8ONj4I1,18 - 24,American,Male,2,3,3,1,3,2,1,3,1,2,2,1,2,1,2,2,2,1,2,1,3,2,3,2,3,8,3,2,2,3,2,8,2,3,3,2,2,8,2,3,2,2,2,8,2,3,3,2,3,7,2,2,3,3,2,7,2,1,2,2,1,7,2,1,1,2,2,7,TRUE,0,81,TRUE,1,81,TRUE,0,81,FALSE,1,84,TRUE,1,86,FALSE,1,82,TRUE,1,88,FALSE,0,88,FALSE,0,90,TRUE,1,78,FALSE,1,75,TRUE,0,86,TRUE,1,85,TRUE,0,80,FALSE,0,87,TRUE,1,81,FALSE,1,84,TRUE,0,100,TRUE,0,95,FALSE,1,88,TRUE,1,83,TRUE,1,85,FALSE,1,84,TRUE,1,79,TRUE,0,77,FALSE,0,98,TRUE,0,86,FALSE,1,66,TRUE,0,85,TRUE,1,89,TRUE,1,76,FALSE,0,80,0.7744,0.9604,0.0361,0.0144,0.64,0.0324,0.0441,0.0484,0.0144,0.0225,0.0121,0.0225,0.81,0.0625,0.0196,0.0361,0.0256,0.0256,0.1156,0.5929,0.0289,0.7569,0.9025,0.64,0.0256,0.7396,0.0576,0.6561,0.6561,1,0.7225,0.7396,0.337489286,0.1297,0.545278571,23,71.88,18,56.25,4,50,6,75,3,37.5,5,62.5,11,68.75,7,43.75,84,84.25,83.62,85.88,82.25,84.62,83.38,15.63,27.75,34.25,8.62,48.38,19.75,15.87,39.63,1,1,0,1,0,1,1,1,2,0,0,2,1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,2,0,0,0,0,1,1,0,1,0,0,1,0.6,1,0.8,0.6,0.2,0.6,0.4,0.4,0.75,0.4,8,7,1,1,1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),22,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,1,1,0,0,0,1,0,1,0,0,0,2,1,0,-1,0,0,1,0,0,0.4,0.4,0.4,0.2,0.35,HS_TS +913,R_1DooZXB2EuSAKJu,18 - 24,Canadian,Male,-3,3,-1,-2,2,-3,2,-2,0,3,2,1,2,-2,0,-3,-2,-3,-3,-3,1,0,2,0,3,10,3,0,0,-1,1,10,2,0,0,1,0,10,3,3,3,3,3,10,0,3,0,0,0,8,0,0,0,0,0,8,2,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,65,FALSE,0,50,TRUE,0,62,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,78,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,79,TRUE,1,100,FALSE,1,100,TRUE,1,57,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,83,TRUE,0,100,TRUE,1,90,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,75,FALSE,0,50,FALSE,0,50,0.0484,0.01,0,0.25,0.25,0,0.0289,0,0.25,0.25,0.5625,0,0.25,0.25,0.25,0.25,0,0.25,0.25,1,0.25,0.1849,0.81,0,0.25,0.25,0.25,0.1225,0.3844,1,0.25,0.6241,0.293475,0.1851,0.40185,16,50,19,59.38,4,50,5,62.5,5,62.5,5,62.5,8,50,11,68.75,69.66,55.88,68.75,81.88,72.12,67.69,71.62,-9.38,10.28,5.88,6.25,19.38,9.62,17.69,2.87,4,3,3,2,1,6,2,2,1,2,0,1,2,3,0,6,5,6,6,6,3,0,1,2,2,3,2,2,0,3,0,1,2,2,0,3,2,3,3,3,2.6,2.6,1.2,5.8,1.6,2,1,2.8,3.05,1.85,10,7,2,2,5,5,3,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,3,2,0,-1,3,0,0,1,-1,0,0,0,1,0,3,3,3,3,3,1,0.6,0.2,3,1.2,HS_TS +914,R_3ASFLRx5pg2eAMM,18 - 24,Canadian,Female,1,3,2,-2,0,-2,1,1,1,1,1,-3,2,-1,3,1,1,1,0,-2,3,2,3,-3,1,2,1,3,-1,-2,1,3,-1,-2,3,2,2,3,2,3,3,2,3,1,2,3,2,0,1,0,-1,0,2,0,0,1,1,-3,2,-2,3,1,0,0,1,0,-2,3,FALSE,1,96,TRUE,1,64,TRUE,0,54,FALSE,1,70,TRUE,1,85,FALSE,1,91,FALSE,0,55,TRUE,1,65,TRUE,1,91,TRUE,1,92,FALSE,1,54,FALSE,1,71,FALSE,0,64,FALSE,1,100,TRUE,1,53,TRUE,1,100,FALSE,1,65,TRUE,0,100,FALSE,1,60,FALSE,1,58,TRUE,1,91,TRUE,1,91,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,60,FALSE,0,95,TRUE,1,50,TRUE,1,90,0.1225,0,0,0.3025,0.01,0.0081,0,0.0064,0.1764,0.0081,0.9025,0.4096,0.0081,0.2116,0.0225,0.1296,0,0.09,0,0,0.0081,0.2209,0.16,0,0.1225,0.25,0.25,0.0016,0.2916,1,0.16,0.0841,0.161846429,0.141635714,0.182057143,21,65.63,27,84.38,8,100,7,87.5,6,75,6,75,13,81.25,14,87.5,78.59,61.5,80.75,91.75,80.38,80.38,76.81,-18.75,-5.79,-38.5,-6.75,16.75,5.38,-0.87,-10.69,2,1,1,1,1,3,2,2,3,0,2,1,1,3,1,1,2,2,2,5,1,0,0,2,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,0,1.2,2,1.6,2.4,0.8,1,0.2,0.4,1.8,0.6,2.67,0.67,2,2,2,-2,2,5 cents,100 minutes,47 days,Female,University - Undergraduate,22,1.125,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,1,1,1,-1,0,2,1,1,2,-1,2,1,1,2,1,0,1,2,2,5,0.4,1,1.4,2,1.2,C_Ug +915,R_1fjs7QwhfJ2SNCa,18 - 24,American,Female,-1,1,-2,-2,-2,-3,1,-2,2,-1,-1,-2,1,-3,1,-3,-3,-2,-3,-3,3,-1,1,-2,0,9,-2,-1,-3,-2,-1,4,3,-2,-1,2,-1,7,-1,-2,-2,-2,3,3,1,1,1,1,1,7,-2,0,-1,1,1,5,-1,-2,1,-1,1,0,-2,-2,-1,-2,1,3,TRUE,0,69,FALSE,0,50,FALSE,1,58,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,82,FALSE,0,50,TRUE,1,61,FALSE,1,50,FALSE,1,88,FALSE,0,78,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,70,TRUE,0,69,TRUE,0,70,FALSE,1,50,TRUE,1,75,TRUE,1,70,FALSE,1,50,TRUE,1,95,FALSE,1,91,FALSE,0,50,FALSE,1,50,FALSE,1,60,FALSE,1,95,FALSE,0,70,FALSE,0,70,FALSE,0,90,0.6724,0.25,0.25,0.25,0.81,0.25,0.0025,0.1521,0.25,0.09,0.49,0.6084,0.25,0.25,0.25,0.25,0.25,0.25,0.16,0.0081,0.0625,0.25,0.49,0.25,0.49,0.25,0.49,0.4761,0.1764,0.4761,0.0025,0.0144,0.276753571,0.296642857,0.256864286,14,43.75,16,50,3,37.5,4,50,4,50,5,62.5,4,25,12,75,64.41,55,69.75,63.75,69.12,65.06,63.75,-6.25,14.41,17.5,19.75,13.75,6.62,40.06,-11.25,4,2,3,0,2,1,2,1,4,0,4,0,2,5,2,2,1,0,1,6,2,0,3,3,3,1,1,1,1,2,0,0,0,2,0,1,1,1,1,4,2.2,1.6,2.6,2,2.2,1.2,0.4,1.6,2.1,1.35,6.67,4,2,-1,7,0,2.67,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,1.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,2,2,0,-3,-1,0,1,0,3,-2,4,0,2,3,2,1,0,-1,0,2,0,0.4,2.2,0.4,0.75,HS_TS +916,R_7xPgAa1XuVBzGtQ,18 - 24,American,Male,2,2,2,2,2,2,-3,2,-3,2,1,1,1,1,1,2,2,2,1,1,2,2,2,2,2,8,1,-3,1,-3,1,9,1,2,2,2,2,7,2,2,2,2,2,8,2,2,2,2,2,8,2,-3,1,-3,1,8,2,2,2,2,1,8,2,2,2,2,2,8,FALSE,1,70,TRUE,1,96,FALSE,1,61,FALSE,1,78,FALSE,0,71,FALSE,1,72,TRUE,1,92,FALSE,0,75,TRUE,1,72,TRUE,1,73,TRUE,0,78,TRUE,0,87,TRUE,1,85,FALSE,1,82,FALSE,0,80,TRUE,1,75,FALSE,1,76,TRUE,0,79,FALSE,1,86,FALSE,1,88,FALSE,0,79,TRUE,1,84,FALSE,1,83,TRUE,1,75,FALSE,1,78,FALSE,0,87,FALSE,1,82,TRUE,0,78,FALSE,1,80,TRUE,1,79,FALSE,0,80,FALSE,0,81,0.5625,0.7569,0.0625,0.0064,0.6561,0.0784,0.0625,0.0729,0.0144,0.0256,0.0441,0.0225,0.0784,0.6084,0.5041,0.0016,0.0289,0.0484,0.6084,0.0484,0.6241,0.64,0.0196,0.0324,0.0576,0.0324,0.64,0.09,0.1521,0.6241,0.04,0.7569,0.236153571,0.16045,0.311857143,10,31.25,21,65.63,5,62.5,5,62.5,6,75,5,62.5,9,56.25,12,75,79.44,81.5,78.38,80.62,77.25,80.25,78.62,-34.38,13.81,19,15.88,5.62,14.75,24,3.62,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,0.6,0.8,0.4,0,0.4,0.8,0.4,0.45,0.4,8,8,0,1,-1,0,0,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,23,0.375,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,1,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0.2,0,0,0.05,C_Ug +917,R_3H1nqNEp9z9PHTX,18 - 24,American,Male,3,3,2,-2,-2,-2,-3,-1,1,1,2,-2,1,-1,3,-1,1,1,-1,-2,2,1,3,-2,2,8,0,-2,-2,2,-1,3,-1,-1,1,2,1,6,-1,-1,1,1,-2,7,1,2,3,1,0,3,1,-3,2,-1,0,4,2,-2,2,-2,3,2,2,1,3,1,2,6,FALSE,1,82,TRUE,1,59,FALSE,1,64,FALSE,1,52,TRUE,1,88,FALSE,1,59,TRUE,1,75,TRUE,1,81,TRUE,1,65,FALSE,0,56,TRUE,0,50,TRUE,0,82,TRUE,1,92,TRUE,0,78,FALSE,0,68,TRUE,1,96,FALSE,1,67,TRUE,0,56,TRUE,0,66,TRUE,0,57,TRUE,1,99,TRUE,1,96,FALSE,1,71,TRUE,1,66,FALSE,1,59,TRUE,1,87,FALSE,1,50,FALSE,1,65,TRUE,0,82,TRUE,1,61,TRUE,1,65,TRUE,1,56,0.0361,0.0169,0.0016,0.0625,0.1936,0.1681,0.1156,0.3136,0.3249,0.0016,0.1521,0.0064,0.1225,0.25,0.0144,0.1681,0.0841,0.2304,0.1225,0.1681,0.0001,0.4624,0.4356,0.6084,0.1089,0.25,0.1225,0.0324,0.1296,0.3136,0.6724,0.6724,0.223010714,0.153242857,0.292778571,19,59.38,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,70.31,59.38,76.75,73.62,71.5,75.62,65,-12.5,-1.57,-3.12,-10.75,11.12,-3.5,-11.88,8.75,1,2,1,0,4,2,1,1,1,2,3,1,0,3,2,0,2,0,2,0,2,1,1,3,2,3,0,3,2,1,0,0,1,1,0,3,0,2,2,4,1.6,1.4,1.8,0.8,1.8,1.8,0.4,2.2,1.4,1.55,5.67,3,5,-1,4,1,2.67,5 cents,5 minutes,24 days,Male,University - Undergraduate,20,0.75,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,1,0,-3,2,-1,1,-2,-1,1,3,1,-1,2,2,-3,2,-2,0,-4,-0.2,-0.4,1.4,-1.4,-0.15,C_Ug +918,R_1qz22AVCAwv76bk,18 - 24,American,Female,3,3,3,3,3,-3,-3,1,3,-2,2,-3,3,-2,3,-2,0,1,1,-2,3,3,3,3,-2,4,-3,-3,-3,3,-3,3,-2,-3,1,2,3,3,2,2,2,2,3,8,2,2,2,1,3,7,-3,-3,1,1,1,2,2,-3,3,-2,3,2,2,2,2,2,0,8,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,67,FALSE,1,50,TRUE,0,81,TRUE,1,92,FALSE,1,93,TRUE,1,60,TRUE,1,60,TRUE,0,50,TRUE,0,76,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,0,70,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,98,0,0,0.16,0,0.0004,0,0,0.1089,0.25,0,0,0.0064,0.25,0.25,0,0.01,0.04,0.25,0,0.0025,1,0.16,0.25,0.0049,0.25,0.49,0.25,1,1,0.5776,1,0.6561,0.278814286,0.083264286,0.474364286,25,78.13,22,68.75,5,62.5,5,62.5,6,75,6,75,14,87.5,8,50,81.62,58.75,90,91.38,86.38,85.44,77.81,9.38,12.87,-3.75,27.5,16.38,11.38,-2.06,27.81,0,0,0,0,5,0,0,4,0,1,4,0,2,4,0,4,2,1,1,5,1,1,1,2,0,0,0,0,2,3,0,0,0,0,0,4,2,1,1,2,1,1,2,2.6,1,1,0,2,1.65,1,3.33,3.67,-3,1,1,0,-0.34,10 cents,25 minutes,24 days,Female,University - Undergraduate,23,1.75,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-1,-1,-1,-2,5,0,0,4,-2,-2,4,0,2,4,0,0,0,0,0,3,0,0,2,0.6,0.65,C_Ug +919,R_18ZeIdwMss8AtrQ,18 - 24,American,Female,1,2,3,1,3,2,-1,2,1,2,1,-2,2,1,0,2,2,3,1,1,-2,2,2,-2,2,7,3,-2,-1,3,3,4,1,1,1,2,0,5,3,3,2,2,2,1,2,2,1,2,3,3,2,-2,2,0,1,2,2,0,3,-1,1,6,2,3,3,3,1,3,TRUE,0,75,TRUE,1,50,TRUE,0,90,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,90,TRUE,1,70,TRUE,1,50,FALSE,0,80,FALSE,1,50,TRUE,0,90,TRUE,1,60,FALSE,1,100,TRUE,1,80,TRUE,1,50,TRUE,0,57,TRUE,0,100,FALSE,1,50,TRUE,0,54,TRUE,1,91,TRUE,1,91,FALSE,1,90,TRUE,1,70,FALSE,1,65,TRUE,1,91,FALSE,1,50,TRUE,0,54,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.09,0.0081,0.25,0.01,0.25,0,0.09,0.64,0.2916,0.0081,0.25,0.16,0.25,0.25,0.16,0.25,0.01,0.25,0.2916,0.1225,0.0081,0.04,0.25,0,0.3249,0.25,0.25,0.5625,0.81,1,0.25,0.81,0.279617857,0.204264286,0.354971429,10,31.25,21,65.63,7,87.5,6,75,5,62.5,3,37.5,12,75,9,56.25,69,53.75,69.75,86.5,66,67.69,70.31,-34.38,3.37,-33.75,-5.25,24,28.5,-7.31,14.06,3,0,1,3,1,1,1,3,2,1,0,3,1,1,0,1,1,1,1,1,1,0,2,1,0,0,1,0,1,1,1,2,1,2,1,0,1,0,2,0,1.6,1.6,1,1,0.8,0.6,1.4,0.6,1.3,0.85,5.33,3.67,4,2,-1,-2,1.66,10 cents,5 minutes,47 days,Female,University - Undergraduate,21,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,2,0,-1,2,1,1,0,3,1,0,-1,1,0,-1,-1,1,0,1,-1,1,0.8,1,-0.4,0.4,0.45,C_Ug +920,R_7Pq8WMBPdLAwPMa,18 - 24,American,Female,-3,2,3,3,3,-2,1,2,-2,1,3,1,3,2,3,-1,0,1,1,-3,1,-1,3,2,3,1,-1,-3,-1,-3,-2,3,3,3,1,2,1,2,2,1,2,1,-3,6,0,3,3,-1,3,1,0,2,2,0,2,3,3,1,3,3,3,1,2,2,2,1,2,6,FALSE,1,87,TRUE,1,50,TRUE,0,73,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,84,FALSE,1,50,TRUE,1,100,TRUE,1,80,TRUE,0,61,TRUE,0,99,TRUE,0,67,FALSE,1,50,FALSE,0,97,FALSE,0,50,FALSE,1,50,TRUE,1,89,FALSE,1,50,TRUE,1,61,FALSE,1,50,FALSE,1,65,TRUE,0,63,TRUE,1,94,TRUE,1,75,FALSE,0,50,0.0625,0.1521,0.04,0,0.25,0.25,0.0121,0,0.25,0.25,0.0036,0.0256,0.25,0.25,0.25,0.25,0.25,0.25,0.1225,0.25,0.9409,0,0.4489,0.25,0.3721,0.25,0.0625,0.0169,0.5329,0.9801,0.3969,1,0.291607143,0.181521429,0.401692857,10,31.25,21,65.63,6,75,3,37.5,6,75,6,75,11,68.75,10,62.5,69.38,61.5,63.12,74.62,78.25,75.31,63.44,-34.38,3.75,-13.5,25.62,-0.38,3.25,6.56,0.94,4,3,0,1,0,1,4,3,1,3,0,2,2,0,2,3,1,1,0,0,3,1,0,4,0,2,1,0,2,1,0,0,0,1,0,3,2,1,0,5,1.6,2.4,1.2,1,1.6,1.2,0.2,2.2,1.55,1.3,2,1.67,0,0,1,0,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,1,2,0,-3,0,-1,3,3,-1,2,0,2,2,-1,2,0,-1,0,0,-5,0,1.2,1,-1.2,0.25,HS_TS +921,R_7IoZsPxWNX6p412,18 - 24,Canadian,Female,1,2,1,0,-1,0,0,0,2,1,0,1,1,0,-1,1,2,3,1,-1,2,-1,1,2,1,6,0,1,0,-2,1,6,1,0,0,2,1,6,1,0,1,1,1,7,3,2,1,0,2,6,1,1,1,1,-1,5,0,2,1,-1,1,5,-1,1,2,0,1,7,TRUE,0,76,TRUE,1,82,FALSE,1,72,TRUE,0,69,FALSE,0,76,TRUE,0,63,FALSE,0,80,FALSE,0,65,TRUE,1,70,FALSE,0,78,FALSE,1,68,FALSE,1,80,TRUE,1,74,TRUE,0,74,TRUE,1,74,FALSE,0,64,TRUE,0,73,FALSE,1,73,TRUE,0,65,TRUE,0,67,TRUE,1,66,TRUE,1,64,FALSE,1,68,FALSE,0,67,TRUE,0,67,TRUE,1,84,FALSE,1,62,TRUE,0,76,FALSE,1,67,FALSE,0,68,FALSE,0,74,TRUE,1,68,0.4225,0.0256,0.4096,0.64,0.1024,0.3969,0.4489,0.6084,0.4489,0.1296,0.4624,0.0676,0.09,0.1024,0.5776,0.0324,0.1024,0.4761,0.5776,0.4489,0.1156,0.0676,0.4225,0.5476,0.5329,0.1444,0.5476,0.5776,0.0784,0.0729,0.1089,0.04,0.297446429,0.289,0.305892857,12,37.5,15,46.88,5,62.5,5,62.5,3,37.5,2,25,8,50,7,43.75,71.06,70.5,69.38,74.5,69.88,72.12,70,-9.38,24.18,8,6.88,37,44.88,22.12,26.25,1,3,0,2,2,0,1,0,4,0,1,1,1,2,2,0,2,2,0,2,2,0,0,0,3,1,1,1,1,2,0,1,0,1,2,2,1,1,1,2,1.6,1,1.4,1.2,1,1.2,0.8,1.4,1.3,1.1,6,5.33,0,1,1,0,0.67,10 cents,100 minutes,36 days,Female,University - Undergraduate,23,0.375,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,3,0,2,-1,-1,0,-1,3,-2,1,0,1,1,0,-2,1,1,-1,0,0.6,-0.2,0.6,-0.2,0.2,C_Ug +922,R_5ivTq3ppmJ52lcS,18 - 24,American,Female,1,3,2,1,2,-3,-1,1,1,1,1,-3,1,-2,3,-3,-3,-3,2,-3,3,3,-2,-2,0,3,-3,0,0,3,-1,8,-2,-3,3,-3,3,2,-3,-3,-3,-3,-3,2,2,3,2,1,2,1,-2,0,2,-2,3,6,2,-3,2,-3,3,2,2,2,2,2,-2,10,TRUE,0,96,TRUE,1,52,FALSE,1,100,TRUE,0,52,TRUE,1,52,FALSE,1,80,TRUE,1,75,TRUE,1,98,TRUE,1,52,TRUE,1,64,FALSE,1,56,FALSE,1,53,TRUE,1,53,TRUE,0,53,TRUE,1,53,TRUE,1,53,TRUE,0,53,TRUE,0,60,TRUE,0,54,TRUE,0,53,FALSE,0,54,TRUE,1,54,TRUE,0,71,TRUE,1,53,TRUE,0,53,TRUE,1,68,TRUE,0,53,TRUE,0,69,TRUE,0,72,FALSE,0,63,FALSE,0,53,TRUE,1,67,0.0004,0.1024,0.2209,0.0625,0.1089,0.04,0.2209,0.1296,0.2809,0.2116,0.3969,0.2209,0.2304,0.1936,0.2304,0.2304,0.5041,0.2704,0.4761,0.2809,0.2916,0.2209,0.2916,0.2809,0.2809,0.2809,0.2809,0.9216,0,0.36,0.5184,0.2209,0.284807143,0.2335,0.336114286,9,28.13,17,53.13,4,50,4,50,4,50,5,62.5,13,81.25,4,25,62.25,53.12,62.75,65.38,67.75,60.25,64.25,-25,9.12,3.12,12.75,15.38,5.25,-21,39.25,2,0,4,3,2,0,1,1,2,2,3,0,2,1,0,0,0,0,5,0,1,0,0,0,0,1,1,1,3,2,1,0,1,1,0,5,5,5,0,1,2.2,1.2,1.2,1,0.2,1.6,0.6,3.2,1.4,1.4,4.33,3,2,2,0,-8,1.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,1.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,1,0,4,3,2,-1,0,0,-1,0,2,0,1,0,0,-5,-5,-5,5,-1,2,-0.4,0.6,-2.2,0,HS_TS +923,R_7gphfUsWbSINllm,18 - 24,American,Female,3,2,2,0,2,-2,1,2,2,1,1,2,2,2,3,2,2,2,1,1,-3,-1,1,-2,1,7,-3,1,1,-1,-3,9,2,2,-1,3,-1,4,1,2,2,1,1,3,3,2,2,2,3,3,1,1,3,-1,2,4,2,3,3,1,3,1,3,3,3,3,3,3,FALSE,1,70,TRUE,1,53,TRUE,0,95,FALSE,1,58,TRUE,1,54,FALSE,1,100,FALSE,0,55,TRUE,1,55,FALSE,0,54,TRUE,1,95,FALSE,1,95,TRUE,0,55,TRUE,1,53,FALSE,1,52,TRUE,1,56,FALSE,0,54,TRUE,0,54,TRUE,0,100,FALSE,1,53,FALSE,1,52,FALSE,0,84,FALSE,0,62,FALSE,1,57,TRUE,1,54,TRUE,0,85,TRUE,1,94,FALSE,1,61,TRUE,0,87,FALSE,1,72,TRUE,1,66,TRUE,1,76,TRUE,1,100,0.2025,0.0036,0.2916,0.3025,0,0,0.2116,0.0025,0.2304,0.3844,0.1156,0.2209,0.2916,0.0025,0.2116,0.2209,0.1849,0.1764,0.7569,0.7225,0.7056,0.1936,0.2209,0.2304,0.2916,0.1521,0.0576,0.09,0.9025,1,0.0784,0.3025,0.284210714,0.16095,0.407471429,5,15.63,21,65.63,7,87.5,6,75,4,50,4,50,11,68.75,10,62.5,69.09,63.25,71.75,76.62,64.75,66.56,71.62,-50,3.46,-24.25,-3.25,26.62,14.75,-2.19,9.12,6,3,1,2,1,1,0,1,3,4,1,0,3,1,4,1,0,0,0,0,0,0,0,2,1,3,0,1,3,1,1,1,1,1,0,1,1,1,2,2,2.6,1.8,1.8,0.2,0.6,1.6,0.8,1.4,1.6,1.1,6.67,2.67,4,5,3,0,4,5 cents,100 minutes,24 days,Female,High School (or equivalent),19,0.75,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,6,3,1,0,0,-2,0,0,0,3,0,-1,2,0,4,0,-1,-1,-2,-2,2,0.2,1,-1.2,0.5,HS_TS +924,R_3EzTfT7zZ08JSaM,18 - 24,American,Female,1,2,1,1,2,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,1,1,-1,2,-1,1,0,6,1,-1,-1,1,-1,8,1,-1,1,1,1,7,-1,-1,-1,-1,-1,8,2,1,1,1,2,7,-2,-2,2,-2,0,7,1,1,2,-2,2,7,2,2,2,2,2,7,FALSE,1,81,FALSE,0,61,TRUE,0,100,FALSE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,93,TRUE,1,91,FALSE,1,100,TRUE,1,90,TRUE,1,89,TRUE,0,97,FALSE,1,100,FALSE,1,100,FALSE,1,78,FALSE,0,75,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,83,TRUE,1,100,FALSE,1,85,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,79,TRUE,1,79,0,0,0.0121,0,0.0441,0,0,1,0.0484,0.0009,1,0.0081,1,0,0,0.3721,0,0.0081,0,0.0289,0.5625,0.01,0,0,0.9409,0.0225,0.0441,0.0361,1,0,1,0.0049,0.2547,0.248692857,0.260707143,24,75,24,75,6,75,5,62.5,7,87.5,6,75,11,68.75,13,81.25,92.78,88.25,92.75,95.12,95,91.31,94.25,0,17.78,13.25,30.25,7.62,20,22.56,13,2,0,2,0,2,2,0,2,2,2,0,2,0,2,0,2,2,2,2,2,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1.2,1.6,0.8,2,0.4,1,0.6,1,1.4,0.75,7,7,-1,1,0,1,0,10 cents,100 minutes,47 days,Female,University - Undergraduate,24,0.875,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,1,-1,2,0,2,1,-1,1,1,1,0,2,-1,1,-1,1,1,1,1,1,0.8,0.6,0.2,1,0.65,C_Ug +925,R_35VRsLfQRg6h0D7,18 - 24,American,Female,2,3,3,2,3,-1,-3,2,-3,0,3,1,3,0,3,2,2,2,2,2,1,3,3,2,3,8,0,-3,0,-3,1,5,3,1,3,0,3,3,2,2,3,3,2,0,2,3,3,2,3,9,0,-3,2,-3,2,1,3,2,3,0,3,2,1,2,2,2,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,90,TRUE,0,90,FALSE,1,70,FALSE,0,100,TRUE,1,90,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0.81,0.0025,0,0,0,0,0,0.01,0.01,0,1,1,0.09,1,0.247232143,0.214285714,0.280178571,26,81.25,25,78.13,7,87.5,7,87.5,7,87.5,4,50,14,87.5,11,68.75,97.97,97.5,96.25,99.38,98.75,99.38,96.56,3.12,19.84,10,8.75,11.88,48.75,11.88,27.81,1,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0,1,0,0,0,2,0.2,0.8,0,0.4,0,0.6,0.2,0.6,0.35,0.35,5.33,4,-1,4,1,-5,1.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,1.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,0,0,0,0,0,2,0,-1,0,-1,0,0,0,-1,0,1,1,-2,0.2,0.2,-0.2,-0.2,0,C_Ug +926,R_5pX9PNrzfuK4xW9,18 - 24,American,Female,3,1,2,-2,1,-2,-2,0,0,1,1,1,2,-3,2,0,1,0,-1,1,2,0,2,-3,2,3,-2,-2,0,-1,-1,4,2,0,-1,1,0,4,3,3,3,2,3,2,3,2,1,-2,2,3,-2,-2,0,-1,2,2,1,1,2,-3,2,3,2,2,1,2,1,5,TRUE,0,85,TRUE,1,72,FALSE,1,100,FALSE,1,55,TRUE,1,60,FALSE,1,76,TRUE,1,92,TRUE,1,56,FALSE,0,60,TRUE,1,100,TRUE,0,62,TRUE,0,100,TRUE,1,79,FALSE,1,52,FALSE,0,50,TRUE,1,83,TRUE,0,66,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,65,TRUE,1,70,FALSE,1,50,FALSE,1,60,TRUE,0,90,FALSE,0,55,FALSE,0,53,TRUE,1,75,0.1936,0.09,0.0289,0.0064,0.0625,0.0576,0.0025,0,0.25,0,0.3025,0.0441,0.36,0.3844,0.16,0.0784,0,0.2025,0.16,0.4225,0.2304,0.25,0.25,0.2304,0.4356,0.25,0.2809,0.7225,0,1,0.81,1,0.283814286,0.136035714,0.431592857,15,46.88,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,72.28,56.5,74.75,83,74.88,72,72.56,-18.75,6.65,6.5,-0.25,20.5,-0.12,-3,16.31,1,1,0,1,1,0,0,0,1,2,1,1,3,4,2,3,2,3,3,2,0,1,1,0,1,0,0,0,1,1,0,0,0,0,0,2,1,1,3,0,0.8,0.6,2.2,2.6,0.6,0.4,0,1.4,1.55,0.6,3.67,2.67,0,2,1,-3,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),20,1,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,1,0,-1,1,0,0,0,0,0,1,1,1,3,4,2,1,1,2,0,2,0.2,0.2,2.2,1.2,0.95,HS_TS +927,R_6ydvWA8a9X2tSeZ,18 - 24,American,Male,2,1,3,2,3,1,3,-1,0,1,1,3,2,2,1,2,3,3,2,2,2,3,2,3,1,8,0,0,2,0,1,6,1,1,1,3,2,4,2,3,1,2,2,8,1,2,1,2,3,7,1,1,3,1,2,5,2,1,2,1,3,7,2,3,2,2,1,5,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,52,FALSE,0,50,FALSE,1,50,TRUE,0,83,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,55,FALSE,1,50,FALSE,1,71,FALSE,0,50,FALSE,0,50,FALSE,1,51,FALSE,0,50,FALSE,1,52,FALSE,0,53,FALSE,1,58,FALSE,1,54,FALSE,1,51,TRUE,1,68,FALSE,0,65,TRUE,1,67,0.25,0.2809,0.25,0.25,0.1089,0.25,0.25,0.25,0.0841,0.25,0.1024,0.25,0.2704,0.25,0.25,0.25,0.2401,0.25,0.2116,0.2304,0.25,0.25,0.25,0.25,0.25,0.1764,0.4225,0.25,0.25,0.3025,0.2401,0.6889,0.252796429,0.218278571,0.287314286,22,68.75,16,50,4,50,5,62.5,3,37.5,4,50,2,12.5,14,87.5,54.06,53.12,52.38,51.25,59.5,53.44,54.69,18.75,4.06,3.12,-10.12,13.75,9.5,40.94,-32.81,0,2,1,1,2,1,3,3,0,0,0,2,1,1,1,0,0,2,0,0,1,1,2,0,0,0,2,4,1,1,1,2,0,1,2,0,0,1,0,1,1.2,1.4,1,0.4,0.8,1.6,1.2,0.4,1,1,6,6.33,1,1,-3,3,-0.33,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,-1,1,-1,1,2,1,1,-1,-1,-1,-1,0,1,0,-1,0,0,1,0,-1,0.4,-0.2,-0.2,0,0,C_Ug +928,R_3IlTfmR9FgPMBaL,18 - 24,American,Female,2,2,3,3,2,-3,2,3,1,2,1,1,3,2,3,-1,-2,-1,1,-1,2,3,2,3,1,9,2,2,1,2,0,6,2,1,-1,0,0,7,1,2,1,2,2,8,2,3,3,3,3,10,2,2,2,2,2,9,2,1,1,2,2,8,3,3,2,3,1,10,TRUE,0,79,TRUE,1,56,TRUE,0,100,FALSE,1,62,TRUE,1,79,FALSE,1,100,TRUE,1,63,FALSE,0,57,TRUE,1,71,TRUE,1,69,FALSE,1,62,TRUE,0,100,TRUE,1,93,FALSE,1,65,TRUE,1,71,TRUE,1,78,FALSE,1,86,TRUE,0,100,TRUE,0,67,FALSE,1,65,TRUE,1,87,FALSE,0,56,TRUE,0,95,TRUE,1,75,TRUE,0,87,FALSE,0,54,TRUE,0,73,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,76,0.3249,0.2916,0.0484,0.1369,0.0576,0,0.0625,0.0961,0.1225,0.3136,0,0.0049,0.0841,0.1444,0.0441,0.1936,0.9025,0.1444,1,0.7569,0.0169,0.0841,0.4489,0.1225,0.0196,0.5329,0.3025,0.6241,1,1,1,1,0.359953571,0.155021429,0.564885714,16,50,18,56.25,5,62.5,6,75,3,37.5,4,50,12,75,6,37.5,77.53,64.62,89.5,71.62,84.38,71.25,83.81,-6.25,21.28,2.12,14.5,34.12,34.38,-3.75,46.31,0,1,1,0,1,5,0,2,1,2,1,0,4,2,3,2,4,2,1,3,0,1,0,0,1,5,0,1,1,0,1,0,2,0,1,4,5,3,2,2,0.6,2,2,2.4,0.4,1.4,0.8,3.2,1.75,1.45,7.33,9,-1,-3,-1,-2,-1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,1,0,0,0,0,1,0,2,0,0,2,2,2,-2,-1,-1,-1,1,0.2,0.6,1.2,-0.8,0.3,C_Ug +929,R_5O2CRKNvSbJ9R8m,18 - 24,Canadian,Female,3,3,3,3,3,0,2,2,-3,3,3,2,2,2,3,2,2,2,2,2,3,3,3,2,3,5,0,2,2,-3,3,2,3,3,3,3,3,3,2,2,2,2,2,5,3,3,3,3,3,5,0,2,2,-3,3,2,3,3,3,3,3,2,2,2,2,2,2,5,FALSE,1,100,TRUE,1,71,FALSE,1,100,FALSE,1,84,TRUE,1,94,FALSE,1,90,TRUE,1,63,TRUE,1,62,TRUE,1,60,TRUE,1,100,FALSE,1,65,TRUE,0,75,FALSE,0,65,FALSE,1,65,TRUE,1,65,TRUE,1,100,TRUE,0,81,TRUE,0,90,FALSE,1,80,FALSE,1,85,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,90,FALSE,1,80,FALSE,1,70,FALSE,1,50,FALSE,0,80,TRUE,1,70,TRUE,1,100,0.1444,0.01,0,0.1369,0,0.01,0.0625,0,0.0225,0,0.64,0.4225,0.16,0.1225,0.0036,0.0841,0,0.0256,0.09,0,0,0.1225,0.04,0.1225,0.6561,0.04,0.09,0,0,0.81,0.25,0.5625,0.154889286,0.11095,0.198828571,16,50,27,84.38,8,100,6,75,7,87.5,6,75,14,87.5,13,81.25,81.56,71.88,85,88.5,80.88,80.94,82.19,-34.38,-2.82,-28.12,10,1,5.88,-6.56,0.94,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0.2,0,0.6,0,0,0,0.6,0,0.2,0.15,3.33,3,0,0,1,0,0.33,5 cents,5 minutes,47 days,Female,High School (or equivalent),23,1.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.05,HS_TS +930,R_5rGyFnKQ45RTsh0,18 - 24,American,Female,2,3,3,3,-1,-3,2,0,3,0,3,-2,3,-2,3,-3,-2,-2,-3,-3,-1,1,2,-3,2,8,2,-3,1,-1,2,10,3,3,-1,3,2,10,1,1,2,2,0,10,3,3,1,2,3,7,1,-3,3,-3,2,10,2,-2,3,-3,3,10,3,2,3,3,2,10,FALSE,1,50,TRUE,1,60,TRUE,0,85,TRUE,0,50,TRUE,1,81,FALSE,1,50,TRUE,1,90,TRUE,1,90,TRUE,1,60,TRUE,1,50,FALSE,1,55,TRUE,0,95,TRUE,1,59,FALSE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,60,TRUE,0,85,TRUE,0,55,FALSE,1,100,TRUE,1,55,TRUE,1,60,TRUE,0,50,TRUE,1,71,FALSE,1,100,TRUE,1,60,TRUE,0,70,FALSE,1,50,TRUE,0,60,FALSE,0,60,FALSE,0,50,FALSE,0,80,0.01,0.16,0.0025,0.01,0.64,0.25,0.0841,0.25,0,0.16,0.36,0.1681,0.16,0.2025,0.0361,0.16,0.25,0.25,0.25,0,0.2025,0.25,0.3025,0,0.16,0.49,0.25,0.25,0.7225,0.7225,0.36,0.9025,0.279760714,0.2122,0.347321429,16,50,20,62.5,3,37.5,5,62.5,7,87.5,5,62.5,12,75,8,50,68.31,56.25,61.88,74.38,80.75,66.94,69.69,-12.5,5.81,18.75,-0.62,-13.12,18.25,-8.06,19.69,3,2,1,6,3,5,5,1,4,2,0,5,4,5,1,4,3,4,5,3,1,0,2,1,4,4,5,3,6,2,1,0,0,1,0,6,4,5,6,5,3,3.4,3,3.8,1.6,4,0.4,5.2,3.3,2.8,9.33,9,1,0,0,0,0.33,10 cents,25 minutes,47 days,Female,High School (or equivalent),21,0.75,0,0,1,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,2,-1,5,-1,1,0,-2,-2,0,-1,5,4,4,1,-2,-1,-1,-1,-2,1.4,-0.6,2.6,-1.4,0.5,HS_TS +931,R_5l4fedH1LanuIcI,18 - 24,American,Female,3,3,3,3,-1,0,1,0,3,1,2,0,3,-3,2,-2,0,-2,3,-2,3,3,3,2,2,6,3,3,-3,3,0,5,3,-3,-3,1,0,8,2,2,2,3,-3,7,3,3,3,3,0,6,0,2,1,2,0,2,2,2,0,0,0,4,0,0,0,0,-2,4,TRUE,0,100,FALSE,0,50,FALSE,1,64,FALSE,1,61,TRUE,1,100,FALSE,1,94,FALSE,0,50,TRUE,1,89,FALSE,0,93,TRUE,1,96,FALSE,1,75,FALSE,1,50,TRUE,1,68,FALSE,1,56,TRUE,1,67,TRUE,1,100,TRUE,0,84,TRUE,0,100,FALSE,1,67,FALSE,1,81,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,78,TRUE,0,90,TRUE,0,83,TRUE,1,84,FALSE,0,70,TRUE,1,100,0.0121,0,0,0.25,0,0.0036,0,0.0016,0.0361,0,0.0256,0.1024,0.8649,0.0625,0,0.25,0,0.1521,0.81,0,1,0.1089,0.1089,0.1936,0.7056,0.0484,0.49,1,0.1296,1,0.6889,0.25,0.286882143,0.107057143,0.466707143,16,50,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,11,68.75,11,68.75,82.81,70.12,91.12,87.75,82.25,85.44,80.19,-18.75,14.06,7.62,28.62,25.25,-5.25,16.69,11.44,0,0,0,1,3,3,2,3,0,1,1,3,6,4,2,4,2,4,0,1,0,0,0,0,1,0,1,1,1,1,0,2,3,3,2,2,0,2,3,0,0.8,1.8,3.2,2.2,0.2,0.8,2,1.4,2,1.1,6.33,4,0,3,4,3,2.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,1,2,3,1,2,-1,0,1,1,3,1,0,2,2,2,-3,1,0.6,1,1.2,0.8,0.9,HS_TS +932,R_5fK8cmWCYY7Cy84,18 - 24,American,Male,1,1,0,2,-1,-2,-1,-1,1,1,-1,-3,2,2,3,-3,-1,-2,-3,-2,2,2,2,-2,-2,4,-2,-2,-1,-1,-1,5,2,1,-1,2,1,8,2,2,2,2,2,10,2,1,1,2,-2,2,-2,-2,0,1,1,1,-1,-3,3,1,3,1,-1,-1,-1,-1,0,3,FALSE,1,85,TRUE,1,50,TRUE,0,90,TRUE,0,50,TRUE,1,50,TRUE,0,60,TRUE,1,70,TRUE,1,60,TRUE,1,50,TRUE,1,50,FALSE,1,55,TRUE,0,100,TRUE,1,65,FALSE,1,60,TRUE,1,70,TRUE,1,100,FALSE,1,50,TRUE,0,80,TRUE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,0,75,TRUE,1,90,FALSE,1,70,TRUE,1,75,FALSE,1,50,FALSE,1,80,TRUE,0,60,TRUE,1,55,TRUE,1,50,TRUE,1,70,0.16,0.0625,0,0.09,0.09,0.36,0.01,0.25,0.25,0.25,0.2025,0.1225,0.25,0.2025,0.25,0.25,0.5625,0.25,0.04,0.09,0,0.09,0.25,0.16,0.25,0.25,0.25,0.0225,0.81,0.64,0.36,1,0.268303571,0.235714286,0.300892857,13,40.63,24,75,6,75,5,62.5,7,87.5,6,75,16,100,8,50,66.25,53.12,66.25,67.5,78.12,65.94,66.56,-34.37,-8.75,-21.88,3.75,-20,3.12,-34.06,16.56,1,1,2,4,1,0,1,0,2,2,3,4,3,0,2,5,3,4,5,4,1,0,1,0,1,0,1,1,0,0,0,0,1,1,0,2,0,1,2,2,1.8,1,2.4,4.2,0.6,0.4,0.4,1.4,2.35,0.7,5.67,1.33,2,4,7,7,4.34,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,21,1.375,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,01ITEM,01DIR,0,1,1,4,0,0,0,-1,2,2,3,4,2,-1,2,3,3,3,3,2,1.2,0.6,2,2.8,1.65,C_Ug +933,R_1afQb6ELZHqScFz,18 - 24,American,Female,1,3,2,2,2,2,1,3,1,1,3,3,2,1,3,2,1,2,3,-1,-3,1,-3,-3,0,7,-2,3,2,-3,-2,6,-1,-2,-1,3,-1,9,-3,-3,-3,-3,-3,10,1,2,1,0,3,3,3,-1,3,-1,3,2,3,3,3,1,3,2,3,3,2,3,3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,88,TRUE,1,100,FALSE,1,84,FALSE,1,100,FALSE,0,96,FALSE,1,100,TRUE,1,73,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,TRUE,1,86,FALSE,1,91,TRUE,1,100,FALSE,1,96,FALSE,1,73,TRUE,0,90,FALSE,0,95,TRUE,1,82,FALSE,0,54,0,0,1,0,0.2916,0,0.0196,0,0,0,0.9025,0.9216,0.0144,0.0256,0,0,0.0625,0,0.0729,0.0081,0,0.0729,0.0225,0,0,0.0016,0.0324,1,1,0,0.81,0,0.187792857,0.159842857,0.215742857,25,78.13,25,78.13,8,100,5,62.5,7,87.5,5,62.5,12,75,13,81.25,92.75,88.5,89.38,98.88,94.25,92.12,93.38,0,14.62,-11.5,26.88,11.38,31.75,17.12,12.13,4,2,5,5,2,4,2,1,4,3,4,5,3,2,4,5,4,5,6,2,0,1,1,2,1,1,2,0,2,2,0,0,1,0,0,1,2,0,0,4,3.6,2.8,3.6,4.4,1,1.4,0.2,1.4,3.6,1,7.33,2.33,4,4,7,6,5,5 cents,5 minutes,47 days,Female,University - Undergraduate,23,-0.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,4,1,4,3,1,3,0,1,2,1,4,5,2,2,4,4,2,5,6,-2,2.6,1.4,3.4,3,2.6,C_Ug +934,R_6xasPwdSClR7OZb,18 - 24,American,Female,3,3,-1,3,2,-3,1,2,2,2,-2,0,3,0,3,-3,-3,-2,-1,-2,3,2,2,-3,-1,3,-3,-3,0,3,1,8,1,-1,3,2,3,9,-3,-3,-3,-3,1,4,3,3,0,2,2,3,-3,-2,3,-1,3,7,-1,-2,3,-2,3,4,3,2,2,3,1,10,TRUE,0,100,TRUE,1,88,FALSE,1,53,FALSE,1,67,FALSE,0,51,FALSE,1,100,TRUE,1,100,TRUE,1,89,TRUE,1,50,TRUE,1,100,TRUE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,89,TRUE,1,67,TRUE,1,86,TRUE,0,79,FALSE,1,100,TRUE,0,82,FALSE,1,85,TRUE,1,70,TRUE,1,99,TRUE,0,50,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,92,TRUE,0,62,FALSE,0,60,FALSE,0,50,TRUE,1,87,0.0121,0,0.0196,0,0.0169,0,0.0169,0,0.0225,0.0001,0.36,0,0.25,0.4096,0.2601,0.0144,0.25,0.1089,0.0064,0,0.09,0.1089,0.6724,0.7921,0.6241,0.25,0.25,1,0.2209,0,0.3844,1,0.253878571,0.1221,0.385657143,23,71.88,20,62.5,4,50,4,50,6,75,6,75,13,81.25,7,43.75,79.91,64.75,74.88,98.5,81.5,80.25,79.56,9.38,17.41,14.75,24.88,23.5,6.5,-1,35.81,0,1,3,6,3,0,4,2,1,1,3,1,0,2,0,0,0,1,2,3,0,0,1,1,0,0,3,1,3,1,1,2,0,2,0,6,5,4,4,3,2.6,1.6,1.2,1.2,0.4,1.6,1,4.4,1.65,1.85,6.67,4.67,0,1,5,-6,2,10 cents,5 minutes,47 days,Female,High School (or equivalent),19,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,1,2,5,3,0,1,1,-2,0,2,-1,0,0,0,-6,-5,-3,-2,0,2.2,0,0.2,-3.2,-0.2,HS_TS +935,R_3gIrdCqFac5ou6L,18 - 24,Canadian,Male,1,-1,-1,1,3,1,0,-1,1,0,1,-1,0,2,0,0,-1,2,1,0,-1,1,1,0,-1,7,-1,0,0,1,0,5,0,-1,0,1,0,4,-1,1,0,-1,1,6,1,1,-1,1,0,5,-1,1,1,0,-1,6,0,-1,0,1,-1,5,0,1,1,0,-1,4,TRUE,0,100,TRUE,1,80,TRUE,0,59,FALSE,1,50,TRUE,1,64,FALSE,1,60,FALSE,0,61,TRUE,1,82,FALSE,0,66,TRUE,1,93,TRUE,0,68,TRUE,0,100,FALSE,0,56,FALSE,1,72,FALSE,0,61,TRUE,1,83,TRUE,0,60,TRUE,0,64,FALSE,1,70,TRUE,0,95,FALSE,0,71,FALSE,0,74,FALSE,1,58,FALSE,0,59,FALSE,1,63,FALSE,0,65,FALSE,1,58,FALSE,1,54,FALSE,1,67,FALSE,0,64,FALSE,0,58,TRUE,1,94,0.0324,0.4225,0.0289,0.3721,0.0036,0.16,0.3481,0.0049,0.9025,0.5476,0.4096,0.3136,0.4356,0.4624,0.1296,0.04,0.1764,0.25,0.2116,0.1369,0.5041,0.3721,0.09,0.0784,0.36,0.1764,0.3364,1,0.3481,0.4096,0.1089,1,0.332728571,0.29885,0.366607143,18,56.25,15,46.88,4,50,5,62.5,3,37.5,3,37.5,6,37.5,9,56.25,69.66,63.88,66.25,74,74.5,70.69,68.62,9.37,22.78,13.88,3.75,36.5,37,33.19,12.37,2,2,2,1,4,2,0,1,0,0,1,0,0,1,0,1,2,2,2,1,0,2,0,0,3,2,1,2,1,1,1,0,0,1,1,0,2,1,1,1,2.2,0.6,0.4,1.6,1,1.4,0.6,1,1.2,1,5.33,5.33,2,-1,-1,2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,2,0,2,1,1,0,-1,-1,-1,-1,0,0,0,0,-1,1,0,1,1,0,1.2,-0.8,-0.2,0.6,0.2,C_Ug +936,R_7osZtna6c3BVmZn,18 - 24,American,Female,1,-3,-3,-1,3,-1,0,-1,-2,0,0,-1,-2,2,2,1,-2,3,1,-3,-3,2,-3,3,-1,6,2,-3,-3,0,-3,5,-3,-3,-3,2,3,9,-3,3,1,-3,2,2,3,0,-3,0,-1,5,-2,-3,3,3,-3,9,-3,-1,1,-3,3,5,2,-3,-3,2,-2,6,FALSE,1,76,TRUE,1,63,TRUE,0,60,FALSE,1,81,TRUE,1,83,FALSE,1,62,FALSE,0,63,TRUE,1,73,FALSE,0,77,FALSE,0,59,TRUE,0,65,TRUE,0,70,FALSE,0,80,TRUE,0,63,FALSE,0,61,TRUE,1,73,TRUE,0,71,FALSE,1,92,TRUE,0,62,FALSE,1,61,FALSE,0,82,TRUE,1,64,TRUE,0,85,FALSE,0,72,TRUE,0,69,TRUE,1,68,FALSE,1,73,FALSE,1,80,TRUE,0,56,FALSE,0,59,TRUE,1,55,FALSE,0,75,0.0729,0.1024,0.0729,0.3969,0.5625,0.1444,0.5184,0.3481,0.1521,0.1296,0.3481,0.64,0.5929,0.4225,0.0289,0.1369,0.7225,0.0361,0.04,0.4761,0.6724,0.3721,0.3844,0.3969,0.5041,0.0729,0.2025,0.0576,0.36,0.0064,0.3136,0.49,0.326142857,0.341642857,0.310642857,16,50,14,43.75,4,50,2,25,4,50,4,50,7,43.75,7,43.75,69.78,67.12,74.25,69.25,68.5,69.19,70.38,6.25,26.03,17.12,49.25,19.25,18.5,25.44,26.63,4,5,0,4,4,3,3,2,2,3,3,2,1,0,1,4,5,2,4,5,2,3,0,1,4,1,3,4,5,3,3,0,3,5,1,1,1,6,1,1,3.4,2.6,1.4,4,2,3.2,2.4,2,2.85,2.4,6.67,6.33,1,-4,4,-4,0.34,15 cents,75 minutes,15 days,Female,High School (or equivalent),19,0.125,0,0,0,0,0,0,0,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,2,2,0,3,0,2,0,-2,-3,0,0,2,-2,-5,0,3,4,-4,3,4,1.4,-0.6,-1,2,0.45,HS_TS +937,R_1QqwFfTsxP1c6g9,18 - 24,Canadian,Female,1,1,1,1,1,1,-1,1,-2,1,2,2,2,2,2,1,1,2,2,2,1,2,2,1,-1,8,1,2,1,2,3,6,2,1,1,1,2,7,2,1,2,2,2,7,2,1,1,1,1,7,1,2,1,1,2,7,1,2,1,1,1,7,1,2,2,1,1,7,FALSE,1,67,TRUE,1,69,TRUE,0,67,FALSE,1,59,TRUE,1,69,FALSE,1,60,TRUE,1,67,TRUE,1,62,TRUE,1,68,TRUE,1,71,FALSE,1,71,TRUE,0,66,TRUE,1,67,FALSE,1,70,TRUE,1,65,TRUE,1,69,FALSE,1,56,TRUE,0,73,FALSE,1,76,FALSE,1,81,TRUE,1,74,TRUE,1,68,FALSE,1,81,TRUE,1,72,FALSE,1,65,TRUE,1,82,FALSE,1,64,TRUE,0,75,FALSE,1,83,TRUE,1,98,TRUE,1,79,TRUE,1,74,0.1444,0.0324,0.0961,0.1089,0.0676,0.16,0.0784,0.0841,0.0361,0.1024,0.0004,0.1089,0.1024,0.0841,0.0961,0.0961,0.0361,0.1681,0.5625,0.1225,0.0676,0.1225,0.0576,0.09,0.1936,0.1296,0.0441,0.1089,0.4489,0.5329,0.0289,0.4356,0.148785714,0.0872,0.210371429,22,68.75,28,87.5,8,100,8,100,7,87.5,5,62.5,16,100,12,75,70.88,68.88,70.5,70.38,73.75,72.12,69.62,-18.75,-16.62,-31.12,-29.5,-17.12,11.25,-27.88,-5.38,0,1,1,0,2,0,3,0,4,2,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,3,0,3,1,1,0,1,1,1,0,1,0,1,1,0.8,1.8,0.6,0.2,0.2,1.4,0.8,0.6,0.85,0.75,7,7,1,-1,0,0,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,0.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,-1,1,1,0,2,0,0,0,1,1,-1,1,0,0,-1,1,-1,0,-1,-1,0.6,0.4,-0.2,-0.4,0.1,HS_TS +938,R_10ursrLnikZBqVE,18 - 24,American,Female,2,3,1,3,2,2,1,3,3,2,2,3,1,3,2,3,3,1,2,2,2,1,2,3,3,10,2,2,3,1,3,10,1,2,2,3,3,9,2,2,3,1,3,8,3,3,2,1,2,10,3,2,2,1,3,9,1,3,2,2,3,8,1,2,3,2,3,7,FALSE,1,97,TRUE,1,93,FALSE,1,89,FALSE,1,79,TRUE,1,98,FALSE,1,95,TRUE,1,91,TRUE,1,85,TRUE,1,100,TRUE,1,98,FALSE,1,93,FALSE,1,91,FALSE,0,86,FALSE,1,82,TRUE,1,88,TRUE,1,93,FALSE,1,100,FALSE,1,96,FALSE,1,92,FALSE,1,88,TRUE,1,83,TRUE,1,77,FALSE,1,83,TRUE,1,91,FALSE,1,100,TRUE,1,96,FALSE,1,91,FALSE,1,86,FALSE,1,82,TRUE,1,87,FALSE,0,92,TRUE,1,97,0.0225,0.0016,0.0049,0.0081,0.0009,0.0025,0.0081,0.0004,0.0144,0.0529,0.0169,0.7396,0,0.0049,0.0004,0.0049,0.0289,0.0441,0.0196,0,0.0289,0.0144,0.0064,0.0324,0,0.0081,0.8464,0.0009,0.0121,0.0016,0.0324,0.0081,0.068935714,0.065635714,0.072235714,32,100,30,93.75,7,87.5,7,87.5,8,100,8,100,14,87.5,16,100,90.59,91,90.5,92.12,88.75,90.94,90.25,6.25,-3.16,3.5,3,-7.88,-11.25,3.44,-9.75,0,2,1,0,1,0,1,0,2,1,1,1,1,0,1,1,1,2,1,1,1,0,1,2,0,1,1,1,2,1,1,0,1,1,1,2,1,2,0,1,0.8,0.8,0.8,1.2,0.8,1.2,0.8,1.2,0.9,1,9.67,9,0,1,1,1,0.67,5 cents,5 minutes,47 days,Female,University - PhD,22,0.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,-1,2,0,-2,1,-1,0,-1,0,0,0,1,0,-1,0,-1,0,0,1,0,0,-0.4,0,0,-0.1,grad_prof +939,R_3iJtRquYbpjVhgV,18 - 24,Both,Female,3,3,1,0,2,-2,0,1,0,1,1,1,3,0,2,1,1,2,1,-1,3,1,2,-3,3,8,1,-1,1,-2,1,7,1,2,1,1,3,7,2,2,2,1,1,8,3,3,1,3,2,4,-1,0,2,-1,1,4,1,0,3,0,3,4,1,1,1,0,-2,5,FALSE,1,53,FALSE,0,50,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,1,57,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,68,TRUE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,58,FALSE,0,62,TRUE,1,100,FALSE,1,59,FALSE,1,69,FALSE,1,50,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,78,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0,0,0,0,0.1849,0,0.1024,0.1225,0,0,0,0.25,0.25,0,0.25,0.0484,0.1849,0.0625,0,0,0.3844,0.25,0.1764,0.1681,0.25,0.2809,0.2209,1,0.0961,1,0,0.188657143,0.099507143,0.277807143,24,75,25,78.13,3,37.5,7,87.5,8,100,7,87.5,13,81.25,12,75,78.25,52.75,86.75,81,92.5,86.44,70.06,-3.13,0.12,15.25,-0.75,-19,5,5.19,-4.94,0,2,1,3,1,3,1,0,2,0,0,1,2,1,1,1,1,0,0,2,0,0,0,3,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1,1,1.4,1.2,1,0.8,0.6,0.6,0.4,0.6,1.1,0.55,7.33,4,4,3,3,3,3.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),18,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,0,2,1,0,1,2,1,-1,1,0,0,0,2,1,0,1,1,-1,-1,1,0.8,0.6,0.6,0.2,0.55,HS_TS +940,R_1t0tg6QnXe9S4xz,18 - 24,American,Male,-3,3,1,3,0,-3,2,-3,2,-3,-2,2,3,0,2,1,-3,0,1,-3,1,3,2,3,0,5,3,-3,1,-3,2,5,2,0,2,0,2,9,2,2,2,2,2,0,0,3,1,3,2,9,-3,-3,3,-3,2,9,2,3,3,3,3,9,2,2,2,2,2,9,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,78,TRUE,1,63,FALSE,1,58,TRUE,1,62,FALSE,1,51,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.25,0.1444,0,0,0,0,0.1369,0.25,0,0,0,0,0.25,0.25,0,0.25,0.6084,0.25,1,0.1764,0.25,0.25,0.25,0.25,0.25,0.2401,0,0.25,1,1,1,1,0.318278571,0.142521429,0.494035714,16,50,20,62.5,4,50,5,62.5,7,87.5,4,50,11,68.75,9,56.25,75.38,56.38,84.75,71.25,89.12,76.56,74.19,-12.5,12.88,6.38,22.25,-16.25,39.12,7.81,17.94,4,0,1,0,0,6,5,4,5,5,4,2,1,0,0,1,5,2,1,5,3,0,0,0,2,0,5,6,5,5,4,1,0,3,1,1,5,2,1,5,1,5,1.4,2.8,1,4.2,1.8,2.8,2.55,2.45,6.33,9,-4,-4,0,-9,-2.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),19,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,1,0,1,0,-2,6,0,-2,0,0,0,1,1,-3,-1,0,0,0,0,0,0,0.8,-0.4,0,0.1,HS_TS +941,R_1JCtnfb1srdcz8M,18 - 24,Canadian,Male,0,3,3,1,2,-2,3,-1,1,2,2,3,2,-1,3,-3,-3,-3,-2,-3,2,-1,3,3,2,2,2,-2,-3,-3,1,8,2,2,2,-1,3,3,2,2,2,-2,1,8,3,3,1,3,3,3,3,3,3,0,3,10,2,2,1,-2,3,8,3,3,3,3,3,10,TRUE,0,75,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,69,TRUE,0,79,TRUE,1,96,FALSE,1,52,TRUE,1,50,FALSE,0,62,TRUE,0,92,FALSE,1,94,FALSE,1,50,FALSE,1,89,FALSE,0,50,TRUE,1,53,TRUE,0,50,TRUE,1,89,TRUE,0,94,TRUE,1,82,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,97,0.25,0.0324,0.3844,0.25,0.0009,0.25,0.0121,0,0.0121,0.2209,0,0.0016,0.25,0.0961,0,0.25,0.25,0.25,0.25,0.8836,0.25,0.25,0.25,0.2304,0.8464,0.25,0.25,0.5625,0,0.0036,0.25,0.6241,0.231939286,0.113835714,0.350042857,12,37.5,19,59.38,6,75,3,37.5,5,62.5,5,62.5,11,68.75,8,50,69.47,52.38,73.12,75,77.38,70.56,68.38,-21.88,10.09,-22.62,35.62,12.5,14.88,1.81,18.38,2,4,0,2,0,4,5,2,4,1,0,1,0,0,0,5,5,5,0,4,3,0,2,2,1,5,0,4,1,1,0,1,1,1,0,6,6,6,5,6,1.6,3.2,0.2,3.8,1.6,2.2,0.6,5.8,2.2,2.55,4.33,7,-1,-2,-5,-2,-2.67,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,-1,4,-2,0,-1,-1,5,-2,3,0,0,0,-1,-1,0,-1,-1,-1,-5,-2,0,1,-0.4,-2,-0.35,C_Ug +942,R_6nDFxsYs7n40BOO,18 - 24,American,Female,-1,3,3,2,2,0,1,0,1,3,-1,-2,3,0,0,-2,-1,-1,-1,-2,-2,3,3,3,1,1,1,-1,1,1,1,4,2,0,1,1,1,3,-2,-1,1,-1,-1,5,1,3,2,1,3,3,2,-3,3,-3,3,7,0,-2,3,0,3,5,3,3,3,3,3,10,FALSE,1,61,FALSE,0,52,TRUE,0,100,FALSE,1,56,TRUE,1,59,TRUE,0,51,TRUE,1,80,TRUE,1,52,TRUE,1,51,TRUE,1,100,FALSE,1,54,TRUE,0,73,TRUE,1,51,FALSE,1,100,FALSE,0,56,TRUE,1,50,TRUE,0,55,TRUE,0,63,TRUE,0,63,FALSE,1,51,TRUE,1,73,TRUE,1,76,FALSE,1,100,TRUE,1,75,TRUE,0,52,TRUE,1,82,TRUE,0,62,TRUE,0,55,TRUE,0,61,FALSE,0,57,FALSE,0,53,TRUE,1,100,0.2304,0.0324,0.25,0.04,0,0.2601,0.0625,0,0.2401,0.0576,0.3249,0.2401,0.2401,0.2116,0.1681,0.2704,0,0.1936,0.3025,0.2704,0.0729,0.3136,0.3969,0,0.3025,0.3844,0.2809,0.1521,1,0.3969,0.3721,0.5329,0.251685714,0.162078571,0.341292857,16,50,18,56.25,3,37.5,5,62.5,6,75,4,50,12,75,6,37.5,66.38,55.88,68.75,76.75,64.12,66.69,66.06,-6.25,10.13,18.38,6.25,1.75,14.12,-8.31,28.56,1,0,0,1,1,1,2,1,0,2,3,2,2,1,1,0,0,2,0,1,2,0,1,1,1,2,4,3,4,0,1,0,0,0,3,5,4,4,4,5,0.6,1.2,1.8,0.6,1,2.6,0.8,4.4,1.05,2.2,2.67,5,-2,-3,-2,-5,-2.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,1.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,-1,0,-1,0,0,-1,-2,-2,-4,2,2,2,2,1,-2,-5,-4,-2,-4,-4,-0.4,-1.4,1,-3.8,-1.15,HS_TS +943,R_5LcMh2B9OVA3yV7,18 - 24,American,Male,1,3,3,1,2,1,0,1,1,2,2,1,2,-2,3,1,1,1,2,-1,-1,2,3,-1,0,3,2,0,-1,3,1,4,1,2,1,2,2,5,-2,-2,2,1,-2,5,2,3,3,3,3,0,1,-1,2,1,2,4,3,1,3,-1,3,3,2,3,3,2,2,3,TRUE,0,70,TRUE,1,100,TRUE,0,81,FALSE,1,51,FALSE,0,51,TRUE,0,100,TRUE,1,80,FALSE,0,59,TRUE,1,73,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,93,FALSE,0,70,TRUE,1,98,FALSE,1,53,FALSE,1,100,TRUE,0,100,FALSE,1,78,FALSE,0,100,TRUE,1,57,FALSE,1,100,TRUE,1,93,TRUE,0,100,TRUE,1,100,FALSE,1,64,FALSE,1,66,TRUE,0,79,TRUE,1,100,FALSE,0,56,TRUE,1,51,0.3481,0,0.0004,0.04,0.2401,1,0.0049,0,0.0484,0.1849,0,0,0.0729,0,0.2601,0,0,0.2401,0.1156,1,1,0.49,1,0.0049,0.2209,0.1296,0.3136,0.49,0.6561,0,0.6241,0,0.28915,0.146528571,0.431771429,18,56.25,21,65.63,5,62.5,4,50,6,75,6,75,11,68.75,10,62.5,81.97,76.75,79.25,87.5,84.38,80.5,83.44,-9.38,16.34,14.25,29.25,12.5,9.38,11.75,20.94,2,1,0,2,2,1,0,2,2,1,1,1,1,4,1,3,3,1,1,1,1,0,0,2,1,0,1,1,0,0,1,0,1,1,0,1,2,2,0,3,1.4,1.2,1.6,1.8,0.8,0.4,0.6,1.6,1.5,0.85,4,2.33,3,0,2,2,1.67,5 cents,5 minutes,24 days,Male,High School (or equivalent),21,1,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,1,1,0,0,1,1,-1,1,2,1,0,1,0,3,1,2,1,-1,1,-2,0.6,0.8,1,0.2,0.65,HS_TS +944,R_6juHRUsdd4czYwf,25 - 31,American,Male,3,3,2,2,2,3,-3,3,-1,3,3,-3,3,-2,3,3,2,1,2,-1,0,3,3,-2,2,9,0,-2,0,1,0,10,2,0,3,2,2,10,1,0,3,2,2,8,2,2,0,3,2,7,1,-2,0,-2,0,8,3,0,-1,2,1,8,1,1,3,1,2,10,TRUE,0,55,FALSE,0,62,FALSE,1,75,FALSE,1,60,FALSE,0,50,TRUE,0,65,TRUE,1,89,TRUE,1,68,FALSE,0,59,FALSE,0,55,FALSE,1,58,FALSE,1,100,TRUE,1,82,FALSE,1,100,FALSE,0,58,TRUE,1,86,FALSE,1,63,TRUE,0,58,FALSE,1,50,FALSE,1,75,FALSE,0,91,FALSE,0,74,TRUE,0,69,TRUE,1,100,FALSE,1,70,TRUE,1,80,FALSE,1,58,FALSE,1,100,TRUE,0,96,FALSE,0,96,FALSE,0,50,TRUE,1,100,0.1024,0.04,0.0196,0.0121,0,0.4225,0,0.3025,0.0625,0.5476,0.9216,0.0324,0.3481,0.1764,0.25,0.3844,0.4761,0.16,0,0.09,0.8281,0.3364,0.25,0,0.1369,0.1764,0.25,0.3025,0.0625,0.3364,0.9216,0,0.277675,0.291721429,0.263628571,12,37.5,18,56.25,4,50,3,37.5,4,50,7,87.5,7,43.75,11,68.75,73.5,56.88,77,72.62,87.5,75,72,-18.75,17.25,6.88,39.5,22.62,0,31.25,3.25,3,0,1,4,0,3,1,3,2,3,1,3,0,4,1,2,2,2,0,3,1,1,2,1,0,2,1,3,1,3,0,3,4,4,2,2,1,2,1,3,1.6,2.4,1.8,1.8,1,2,2.6,1.8,1.9,1.85,9.67,7.67,2,2,2,-2,2,10 cents,75 minutes,47 days,Male,High School (or equivalent),25,0.5,0,0,1,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,-1,-1,3,0,1,0,0,1,0,1,0,-4,0,-1,0,1,0,-1,0,0.6,0.4,-0.8,0,0.05,HS_TS +945,R_7ZVbWzAeDIxHUR1,18 - 24,American,Male,1,3,3,-3,3,-3,-1,2,-3,0,3,1,3,3,1,2,3,2,-1,-2,-3,1,0,3,-1,8,1,-3,3,-2,2,7,3,3,-1,2,-1,8,-3,-2,3,-3,-3,10,0,3,3,2,3,4,1,-2,1,-3,2,6,3,2,3,3,2,2,2,1,1,1,-1,4,TRUE,0,100,TRUE,1,81,FALSE,1,86,FALSE,1,50,TRUE,1,81,FALSE,1,93,TRUE,1,85,TRUE,1,86,TRUE,1,70,TRUE,1,84,FALSE,1,84,TRUE,0,77,TRUE,1,86,TRUE,0,71,FALSE,0,54,TRUE,1,92,TRUE,0,96,FALSE,1,69,FALSE,1,83,FALSE,1,61,TRUE,1,100,TRUE,1,61,FALSE,1,95,TRUE,1,85,FALSE,1,75,TRUE,1,100,FALSE,1,89,TRUE,0,100,FALSE,1,76,FALSE,0,100,TRUE,1,99,TRUE,1,97,0.0196,0,0.0064,0.0225,0.0009,0.0049,0.0225,0.0256,0.1521,0.1521,1,0.0196,0.09,0.0256,0.0361,0.0361,0.0025,0.25,1,0.0625,0,0.2916,0.0289,0.5041,0.9216,0.0121,0.0001,1,0.0196,0.0961,0.0576,0.5929,0.228753571,0.129857143,0.32765,28,87.5,25,78.13,7,87.5,7,87.5,6,75,5,62.5,14,87.5,11,68.75,83.31,76.25,90.5,80.62,85.88,85.06,81.56,9.37,5.18,-11.25,3,5.62,23.38,-2.44,12.81,4,2,3,6,4,4,2,1,1,2,0,2,4,1,2,5,5,1,2,1,1,0,0,5,0,4,1,1,0,2,0,1,0,0,1,0,2,1,2,1,3.8,2,1.8,2.8,1.2,1.6,0.4,1.2,2.6,1.1,7.67,4,4,1,6,6,3.67,5 cents,5 minutes,47 days,Male,High School (or equivalent),21,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,3,2,3,1,4,0,1,0,1,0,0,1,4,1,1,5,3,0,0,0,2.6,0.4,1.4,1.6,1.5,HS_TS +946,R_5RvKlNPfLIW6A3n,18 - 24,Canadian,Female,1,2,2,2,2,1,1,1,0,1,0,0,1,1,1,-1,0,0,0,2,-1,1,3,-1,1,8,-1,0,-1,1,-1,10,-1,2,-1,0,1,10,-3,-1,-2,-2,0,8,2,2,2,2,2,2,2,0,2,-2,2,4,0,-2,2,-1,2,5,3,3,3,3,3,10,FALSE,1,80,TRUE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,61,FALSE,1,50,TRUE,1,93,FALSE,0,50,TRUE,1,89,TRUE,1,97,FALSE,1,50,TRUE,0,70,TRUE,1,80,FALSE,1,50,TRUE,1,97,TRUE,1,90,TRUE,0,50,TRUE,0,77,TRUE,0,50,FALSE,1,50,FALSE,0,65,TRUE,1,59,FALSE,1,57,TRUE,1,50,FALSE,1,80,FALSE,0,50,FALSE,1,50,TRUE,0,65,TRUE,0,50,FALSE,0,50,TRUE,1,54,TRUE,1,85,0.25,0.25,0.01,0.0049,0.0225,0.25,0.25,0.0009,0.25,0.1681,0.25,0.04,0.0121,0.25,0.1521,0.25,0.1849,0.25,0.4225,0.04,0.4225,0.0009,0.25,0.25,0.25,0.25,0.2116,0.04,0.5625,0.5929,0.25,0.49,0.227267857,0.166471429,0.288064286,16,50,21,65.63,7,87.5,5,62.5,6,75,3,37.5,12,75,9,56.25,64.81,61.25,62.25,73.25,62.5,70,59.62,-15.63,-0.82,-26.25,-0.25,-1.75,25,-5,3.37,2,1,1,3,1,2,1,2,1,2,1,2,2,1,0,2,1,2,2,2,1,0,0,0,0,1,1,1,2,1,0,2,1,2,1,4,3,3,3,1,1.6,1.6,1.2,1.8,0.2,1.2,1.2,2.8,1.55,1.35,9.33,3.67,6,6,5,-2,5.66,5 cents,100 minutes,47 days,Female,University - Undergraduate,24,0.125,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,1,1,1,3,1,1,0,1,-1,1,1,0,1,-1,-1,-2,-2,-1,-1,1,1.4,0.4,0,-1,0.2,C_Ug +947,R_3FGNFRLm8W2mWmB,32 - 38,American,Male,0,3,2,2,3,1,0,2,-1,1,1,0,3,1,-1,0,1,2,2,-2,0,0,1,3,2,7,2,1,2,0,3,8,0,1,-1,3,1,8,2,1,-1,3,1,6,2,3,0,2,3,7,2,-1,1,3,0,8,0,2,-1,1,-1,6,2,2,3,3,0,4,FALSE,1,100,TRUE,1,93,TRUE,0,72,FALSE,1,73,TRUE,1,96,FALSE,1,85,TRUE,1,82,TRUE,1,100,TRUE,1,94,TRUE,1,83,FALSE,1,100,TRUE,0,68,FALSE,0,87,FALSE,1,75,FALSE,0,63,TRUE,1,100,FALSE,1,97,TRUE,0,72,FALSE,1,100,FALSE,1,91,TRUE,1,95,TRUE,1,74,TRUE,0,64,TRUE,1,91,TRUE,0,88,TRUE,1,74,FALSE,1,100,FALSE,1,96,TRUE,0,86,TRUE,1,57,TRUE,1,92,FALSE,0,92,0,0.0676,0,0.0324,0.8464,0.0225,0.0081,0.0289,0.0081,0.0676,0.1849,0.7569,0.0036,0,0.0016,0.0049,0.4096,0.0729,0.0016,0.7744,0.0025,0.3969,0,0.0625,0.0009,0,0.0064,0,0.5184,0.5184,0.7396,0.4624,0.210714286,0.172571429,0.248857143,25,78.13,23,71.88,7,87.5,4,50,6,75,6,75,13,81.25,10,62.5,85.62,89.38,87.75,81,84.38,85.81,85.44,6.25,13.74,1.88,37.75,6,9.38,4.56,22.94,0,3,1,1,1,1,1,0,1,2,1,1,4,2,2,2,0,3,1,3,2,0,2,0,0,1,1,1,4,1,1,2,4,0,0,2,1,1,1,2,1.2,1,2,1.8,0.8,1.6,1.4,1.4,1.5,1.3,7.67,7,0,0,2,2,0.67,10 cents,100 minutes,47 days,Male,High School (or equivalent),35,0,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,-2,3,-1,1,1,0,0,-1,-3,1,0,-1,0,2,2,0,-1,2,0,1,0.4,-0.6,0.6,0.4,0.2,HS_TS +948,R_3djZmCukYTMNCKZ,18 - 24,Canadian,Male,1,2,1,0,2,1,0,0,-1,1,1,0,1,1,1,1,2,1,2,1,1,-1,2,0,1,6,0,1,0,1,1,5,0,1,1,1,1,8,0,1,2,1,2,7,2,1,-1,0,1,7,0,-1,2,1,1,8,0,1,1,0,1,6,0,1,1,1,1,5,FALSE,1,55,FALSE,0,60,FALSE,1,75,FALSE,1,55,FALSE,0,50,TRUE,0,55,TRUE,1,100,FALSE,0,65,FALSE,0,60,TRUE,1,65,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,0,65,TRUE,1,75,TRUE,0,75,TRUE,0,100,TRUE,0,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,75,FALSE,0,65,FALSE,1,75,FALSE,0,50,FALSE,1,55,FALSE,1,55,FALSE,1,55,TRUE,1,100,TRUE,1,100,FALSE,0,50,0.4225,0.25,0.0625,0,0.25,0.3025,0.4225,0.1225,0.1225,0,0,0,0.36,0.25,0.25,0.36,0.0625,0.2025,0.2025,0.0625,0,0.4225,1,0.5625,0.5625,0.2025,0,0.2025,0.0625,1,0.2025,1,0.292410714,0.193214286,0.391607143,20,62.5,18,56.25,4,50,4,50,5,62.5,5,62.5,8,50,10,62.5,72.66,68.12,70,77.5,75,75.31,70,6.25,16.41,18.12,20,15,12.5,25.31,7.5,0,3,1,0,1,1,1,0,2,0,1,1,0,0,0,1,1,1,1,1,1,1,2,0,1,1,1,2,2,0,1,1,0,1,0,1,1,0,1,0,1,0.8,0.4,1,1,1.2,0.6,0.6,0.8,0.85,6.33,7,-1,-3,2,2,-0.67,10 cents,100 minutes,47 days,Male,High School (or equivalent),24,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,2,-1,0,0,0,0,-2,0,0,0,0,0,-1,0,0,0,1,0,1,0,-0.4,-0.2,0.4,-0.05,HS_TS +949,R_5mXGwTbhFQ345Db,18 - 24,Canadian,Female,2,3,1,-1,1,-2,1,-1,1,-1,1,-2,1,-2,2,-2,-2,-2,-1,-2,2,1,2,-2,0,4,1,0,-1,-1,1,6,1,-1,1,-2,2,5,-2,-1,-2,-1,-2,3,2,3,1,1,2,2,-1,0,1,-1,1,3,1,-2,2,-2,2,2,1,0,1,1,-1,4,TRUE,0,100,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,75,TRUE,1,85,FALSE,0,70,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,0,80,TRUE,1,50,FALSE,1,75,TRUE,1,60,TRUE,1,50,TRUE,0,50,TRUE,0,90,TRUE,0,50,FALSE,1,50,FALSE,0,60,FALSE,0,50,FALSE,1,70,TRUE,1,50,TRUE,0,50,TRUE,1,80,FALSE,1,50,FALSE,1,75,TRUE,0,50,FALSE,0,75,FALSE,0,50,FALSE,0,60,0.49,0.04,0.25,0.0225,0.36,0.0625,0.25,0.09,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.09,0.25,0.0625,0.25,0.36,0.16,0.25,0.0625,0.25,0.25,0.25,1,0,0.81,0.25,0.64,0.286071429,0.243928571,0.328214286,10,31.25,17,53.13,4,50,4,50,4,50,5,62.5,8,50,9,56.25,63.28,51.25,58.12,75,68.75,60,66.56,-21.88,10.15,1.25,8.12,25,6.25,10,10.31,0,2,1,1,1,3,1,0,2,2,0,1,0,0,0,0,1,0,0,0,0,0,0,2,1,1,1,2,2,2,0,0,1,0,0,3,2,3,2,1,1,1.6,0.2,0.2,0.6,1.6,0.2,2.2,0.75,1.15,5,2.33,2,3,3,-1,2.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,2,1,-1,0,2,0,-2,0,0,0,1,-1,0,0,-3,-1,-3,-2,-1,0.4,0,0,-2,-0.4,C_Ug +950,R_3ruEKS7o2pKeasF,60 - 66,Canadian,Male,0,0,1,2,3,-1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,1,1,1,1,1,0,3,1,1,1,0,0,4,1,1,1,1,1,4,0,1,0,1,-2,4,2,2,2,1,1,7,0,0,0,0,0,6,1,0,0,1,1,6,0,0,1,-1,-1,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,77,TRUE,0,73,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,99,FALSE,1,92,FALSE,0,77,TRUE,1,100,TRUE,0,94,TRUE,0,94,FALSE,1,99,FALSE,1,98,TRUE,1,95,TRUE,1,96,TRUE,0,98,TRUE,1,96,TRUE,0,94,TRUE,1,100,TRUE,0,94,FALSE,1,93,TRUE,0,93,FALSE,0,92,TRUE,1,94,TRUE,1,90,0,0,0,0,0.01,0.5329,0.0016,0,0.0004,0.0016,0.8464,0.0001,0,0.0036,0.5929,0,0.9604,1,0.0049,0.8836,0.0025,0.5929,0.0001,0.0064,0.8836,0.8836,0.0036,1,1,0.8836,0.8649,1,0.427128571,0.282135714,0.572121429,25,78.13,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,13,81.25,5,31.25,94.75,94.75,89.88,97,97.38,94.75,94.75,21.88,38.5,32.25,52.38,34.5,34.88,13.5,63.5,1,1,0,1,3,2,2,0,1,1,0,0,0,0,2,1,0,1,0,3,2,2,1,1,2,1,1,1,1,1,0,1,1,0,2,1,1,0,2,2,1.2,1.2,0.4,1,1.6,1,0.8,1.2,0.95,1.15,3.67,6.33,-4,-2,-2,-1,-2.66,10 cents,5 minutes,47 days,Male,High School (or equivalent),60,0.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,-1,-1,-1,0,1,1,1,-1,0,0,0,-1,-1,0,0,0,-1,1,-2,1,-0.4,0.2,-0.4,-0.2,-0.2,HS_TS +951,R_6V58PWU0Reztyhz,60 - 66,Canadian,Male,1,3,3,-3,-2,-3,-3,3,2,-1,3,-2,3,-3,3,-3,-3,-3,-1,-3,-2,3,1,-1,0,9,1,-3,3,-2,2,3,3,2,3,-2,3,5,2,2,2,2,1,10,1,3,1,-2,2,10,2,-3,3,-3,3,8,3,-3,3,-3,3,0,3,3,3,3,-3,10,FALSE,1,100,FALSE,0,75,TRUE,0,100,FALSE,1,54,TRUE,1,75,FALSE,1,54,TRUE,1,100,TRUE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,1,89,TRUE,0,82,FALSE,0,80,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,94,FALSE,1,100,FALSE,0,93,TRUE,1,100,TRUE,0,59,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,94,FALSE,1,100,TRUE,1,100,TRUE,1,61,TRUE,1,91,0,0,0,0,0.0081,0.2116,0,0,0,0,0,0.0121,0.2401,0.0784,0.0625,0.5625,0.3481,0.2116,0.8836,1,0.8649,0.64,0.8836,0.6724,0.2401,1,0.1521,0,1,0,0,1,0.359703571,0.123928571,0.595478571,27,84.38,21,65.63,4,50,6,75,6,75,5,62.5,13,81.25,8,50,86.72,73.38,76.5,97.75,99.25,88.44,85,18.75,21.09,23.38,1.5,22.75,36.75,7.19,35,3,0,2,2,2,4,0,0,4,3,0,4,0,1,0,5,5,5,3,4,0,0,2,1,4,5,0,0,5,4,0,1,0,0,0,6,6,6,4,0,1.8,2.2,1,4.4,1.4,2.8,0.2,4.4,2.35,2.2,5.67,6,-1,-5,5,0,-0.33,5 cents,100 minutes,15 days,Male,High School (or equivalent),66,1,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,3,0,0,1,-2,-1,0,0,-1,-1,0,3,0,1,0,-1,-1,-1,-1,4,0.4,-0.6,0.8,0,0.15,HS_TS +952,R_1P7HFMubSLxJSWR,67 - 73,Canadian,Male,3,3,3,3,2,1,-1,3,-3,1,2,2,3,-1,2,0,2,1,2,-2,3,3,3,3,2,0,2,-2,3,-2,3,4,2,2,3,0,2,4,1,1,1,1,-2,4,3,3,3,3,2,0,2,-3,3,-2,3,0,2,2,3,0,2,4,1,1,2,1,-3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,78,TRUE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,100,TRUE,1,99,FALSE,0,86,FALSE,1,79,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,82,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,90,TRUE,0,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.01,0,0,0,0.8649,0,0.7396,1,0,0,0.0169,0.0001,0.0441,0,0,1,0.0484,0,0.5625,0,0.0324,1,1,0.7569,0.5625,0,1,1,1,1,1,0.451010714,0.265285714,0.636735714,30,93.75,18,56.25,6,75,4,50,3,37.5,5,62.5,15,93.75,3,18.75,94.72,89.12,95.88,93.88,100,96.5,92.94,37.5,38.47,14.12,45.88,56.38,37.5,2.75,74.19,0,0,0,0,0,1,1,0,1,2,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,2,0,1,2,0,0,0,1,0,1,1,1,1,1,0,1,0.2,0.6,0,1.2,0.2,1,0.45,0.6,2.67,1.33,0,4,0,0,1.34,10 cents,5 minutes,24 days,Male,University - Undergraduate,73,1.125,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,-0.2,0,-0.4,-0.15,C_Ug +953,R_3rzpThwNkJJajg5,67 - 73,Canadian,Male,1,3,2,-3,0,-3,-3,3,-3,1,2,1,3,-2,1,-1,1,2,2,-2,2,3,2,-3,0,0,-3,-3,3,-3,1,0,2,1,3,-3,1,0,-2,1,2,1,-2,2,2,3,3,2,-3,4,-3,-2,0,-2,-3,6,2,1,3,-3,1,0,-2,-2,1,0,-2,6,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,50,FALSE,0,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,0,100,TRUE,1,50,0,0,0,0.09,0.25,0,0,1,0,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,1,0.25,0.25,1,0.25,1,0.25,0.25,1,0.375,0.303571429,0.446428571,16,50,20,62.5,6,75,3,37.5,5,62.5,6,75,11,68.75,9,56.25,70.94,56.25,62.5,71.25,93.75,73.12,68.75,-12.5,8.44,-18.75,25,8.75,18.75,4.37,12.5,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,1,5,3,0,1,3,1,4,0,0,0,1,0,1,3,1,2,0,0.2,0,0.2,0.4,2,1.8,0.2,1.4,0.2,1.35,0,3.33,-4,-6,0,-4,-3.33,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,68,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,0,0,-1,-5,-3,0,-1,-3,-1,-4,0,0,0,0,0,0,-3,-1,-1,0,-1.8,-1.8,0,-1,-1.15,C_Ug +954,R_1plDXanV8kNHLlK,67 - 73,Canadian,Male,-2,-1,2,2,2,-3,1,1,-2,-2,2,1,1,-3,2,0,1,1,1,-2,-1,-2,2,0,3,5,-3,1,1,-2,-2,3,-2,1,1,-2,2,2,-2,-1,-1,1,-2,7,-2,-2,2,3,0,4,-3,1,1,0,-2,2,1,1,1,-3,2,2,-2,-2,1,1,-3,7,FALSE,1,98,TRUE,1,92,TRUE,0,93,TRUE,0,53,TRUE,1,53,FALSE,1,97,TRUE,1,53,TRUE,1,92,TRUE,1,55,FALSE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,96,TRUE,0,93,FALSE,0,53,TRUE,1,100,FALSE,1,68,TRUE,0,62,FALSE,1,52,FALSE,1,100,TRUE,1,95,TRUE,1,96,FALSE,1,52,TRUE,1,99,TRUE,0,54,TRUE,1,100,TRUE,0,62,TRUE,0,70,TRUE,0,99,TRUE,1,76,TRUE,1,98,TRUE,1,98,0.0064,0,0,0.2209,0.0004,0.0009,0.0001,0.2809,0,0.0016,0.0576,0.0016,0.2025,0.2209,0.2209,0.0064,0.2304,0.2809,0.49,0.2916,0.0025,0.2809,0.2304,0.8649,0.1024,0.3844,0.0004,0.0004,0.8649,0.3844,0.9801,0.2209,0.235832143,0.107507143,0.364157143,26,81.25,22,68.75,5,62.5,7,87.5,4,50,6,75,14,87.5,8,50,77.12,64.75,82.25,76.12,85.38,81.81,72.44,12.5,8.37,2.25,-5.25,26.12,10.38,-5.69,22.44,1,1,0,2,1,0,0,0,0,0,4,0,0,1,0,2,2,2,0,0,0,1,0,1,2,0,0,0,2,0,1,0,0,0,0,2,3,0,0,1,1,0,1,1.2,0.8,0.4,0.2,1.2,0.8,0.65,3.33,2.67,1,1,0,0,0.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),71,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,1,0,0,1,-1,0,0,0,-2,0,3,0,0,1,0,0,-1,2,0,-1,0.2,-0.4,0.8,0,0.15,grad_prof +955,R_58HsVEeLBESJcI1,18 - 24,American,Female,1,1,1,1,1,1,0,1,1,1,1,-1,1,1,1,0,-1,-1,-1,-1,1,1,1,1,1,7,-1,0,2,1,0,7,1,1,0,0,1,7,0,0,0,0,0,7,1,1,0,0,2,5,2,0,2,-1,2,5,0,-2,2,0,2,5,2,1,2,2,0,5,FALSE,1,88,TRUE,1,50,TRUE,0,80,FALSE,1,50,TRUE,1,82,FALSE,1,78,TRUE,1,83,TRUE,1,95,TRUE,1,82,TRUE,1,86,FALSE,1,94,TRUE,0,85,TRUE,1,77,TRUE,0,86,FALSE,0,50,TRUE,1,64,TRUE,0,77,TRUE,0,93,FALSE,1,50,FALSE,1,50,FALSE,0,75,TRUE,1,76,TRUE,0,76,TRUE,1,50,FALSE,1,100,FALSE,0,75,FALSE,1,50,TRUE,0,80,TRUE,0,59,FALSE,0,81,FALSE,0,50,TRUE,1,100,0.0025,0.5625,0.1296,0.0289,0,0.0484,0.25,0.0196,0.25,0.0576,0.6561,0.0529,0.0324,0.0036,0.0324,0.25,0.5776,0.25,0.64,0,0.5625,0.25,0.25,0.7396,0.5929,0.25,0.25,0.0144,0.64,0.8649,0.3481,0.7225,0.307339286,0.177185714,0.437492857,17,53.13,19,59.38,6,75,4,50,5,62.5,4,50,11,68.75,8,50,74.12,59.5,78,85.88,73.12,73.5,74.75,-6.25,14.74,-15.5,28,23.38,23.12,4.75,24.75,0,0,0,0,0,2,0,1,0,1,0,2,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,2,1,1,1,1,1,1,2,2,3,3,1,0,0.8,0.8,0.8,0.6,1,1,2.2,0.6,1.2,7,5,2,2,2,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,24,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,0,-1,-1,-1,1,0,0,-2,0,-1,1,0,0,-1,-2,-1,-2,-2,0,-0.6,-0.2,-0.2,-1.4,-0.6,C_Ug +956,R_62OCFs2732b3GKJ,67 - 73,Canadian,Male,-3,3,3,0,3,-3,-2,2,-2,0,3,2,3,3,3,1,2,2,2,-3,-3,3,3,0,3,0,-3,-2,3,-2,2,0,3,3,3,3,3,0,0,2,1,1,-3,0,-3,3,3,0,2,0,-3,-2,3,-2,2,0,3,3,3,3,3,0,2,1,2,3,-3,0,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0.25,0,1,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.25,0,0.25,0.25,1,1,1,0.25,1,0.383928571,0.214285714,0.553571429,13,40.63,18,56.25,5,62.5,5,62.5,2,25,6,75,8,50,10,62.5,68.75,56.25,62.5,68.75,87.5,68.75,68.75,-15.62,12.5,-6.25,0,43.75,12.5,18.75,6.25,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,2,0,1,0,0,0,1,1,0,1,0,0,0.6,0.2,0.6,0.2,0.6,0.2,0.6,0.35,0.4,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,67,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,-0.2,0,0,0,-0.05,C_Ug +957,R_1tEglXSyMh9qA5o,39 - 45,Canadian,Male,2,2,1,3,2,1,-3,3,-2,2,3,1,3,1,2,-3,-1,-2,-3,-3,3,3,3,3,3,1,-2,-3,-3,-2,2,3,1,1,2,-1,3,4,-3,-3,-3,-3,-3,6,3,2,1,3,2,3,1,-3,3,-2,3,2,3,1,3,3,2,1,1,3,3,3,-2,8,FALSE,1,100,FALSE,0,71,TRUE,0,91,TRUE,0,64,TRUE,1,55,FALSE,1,56,TRUE,1,100,TRUE,1,89,TRUE,1,84,TRUE,1,100,FALSE,1,53,TRUE,0,89,FALSE,0,96,FALSE,1,88,TRUE,1,72,TRUE,1,99,FALSE,1,58,TRUE,0,91,FALSE,1,99,FALSE,1,100,FALSE,0,99,TRUE,1,100,FALSE,1,65,FALSE,0,72,FALSE,1,62,TRUE,1,87,TRUE,0,80,FALSE,1,71,FALSE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,0.0121,0.0169,0.0001,0,0,0.1936,0.5184,0,0,0,0,0.9216,0.0256,0.2209,0.2025,0.5041,0.1225,0.4096,0.0841,0.1444,0.9801,0.0784,0.0001,0.0144,0.1764,0.64,0.0036,0,0.8281,0.8281,0,0.7921,0.274592857,0.222771429,0.326414286,20,62.5,23,71.88,5,62.5,6,75,7,87.5,5,62.5,12,75,11,68.75,83.91,77.12,78.62,91,88.88,88.62,79.19,-9.38,12.03,14.62,3.62,3.5,26.38,13.62,10.44,1,1,2,0,1,3,0,6,0,0,2,0,1,2,1,0,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,2,0,4,4,5,6,1,1,1.8,1.2,0.6,0.2,0.2,0.4,4,1.15,1.2,2.67,2,-2,1,3,-2,0.67,10 cents,100 minutes,24 days,Male,University - Undergraduate,39,1.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,0,1,2,0,1,3,0,6,0,-1,2,0,1,0,1,-4,-2,-4,-6,-1,0.8,1.6,0.8,-3.4,-0.05,C_Ug +958,R_34TAmNpBoVjFjsR,67 - 73,Canadian,Male,-3,1,3,0,-2,-2,-2,3,-1,1,3,2,3,-1,3,1,1,2,2,0,-3,2,3,3,-3,0,-2,-1,3,2,2,0,3,3,3,2,3,4,1,1,2,1,0,8,-3,2,3,3,-2,5,-2,-2,3,-1,2,6,3,3,3,-1,3,5,3,1,3,3,0,7,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,78,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,59,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,87,TRUE,1,100,TRUE,0,79,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.25,0,0,0.0484,0.16,0.25,0,0.25,0,0,0.7569,0,0.0196,1,0,0.1681,0.6241,0.25,1,1,1,1,1,0.313467857,0.068457143,0.558478571,25,78.13,23,71.88,6,75,7,87.5,4,50,6,75,15,93.75,8,50,89.03,81.62,82.38,92.12,100,88.38,89.69,6.25,17.15,6.62,-5.12,42.12,25,-5.37,39.69,0,1,0,3,1,0,1,0,3,1,0,1,0,3,0,0,0,0,1,0,0,1,0,3,0,0,0,0,0,1,0,1,0,0,0,2,0,1,1,0,1,1,0.8,0.2,0.8,0.2,0.2,0.8,0.75,0.5,1.33,5.33,-5,-6,-1,1,-4,10 cents,5 minutes,24 days,Male,High School (or equivalent),68,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,0,0,0,0,1,0,1,0,3,0,0,0,0,3,0,-2,0,-1,0,0,0.2,0.8,0.6,-0.6,0.25,HS_TS +959,R_5UBRUCddWy4RBzH,18 - 24,American,Male,2,1,2,0,2,-1,0,0,1,0,0,1,1,0,0,-2,-2,-2,-2,-3,1,1,1,0,1,9,-2,0,0,0,0,8,0,0,0,0,0,9,-1,-1,-1,-1,-3,8,2,2,2,0,2,5,0,0,0,0,0,8,0,2,1,0,0,7,0,0,0,0,1,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,62,FALSE,1,100,FALSE,0,52,TRUE,1,100,FALSE,1,58,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,70,FALSE,1,50,FALSE,1,100,TRUE,0,71,FALSE,0,64,TRUE,1,72,TRUE,1,78,0,0.49,0,0,0.0484,0.25,0,0.04,0,0,0.4096,0.1444,0.16,0.25,0,0,0,0.25,0,0,0,0.2704,0,0,0.1764,0.25,0.0784,0,0,0,0.5041,0.25,0.110060714,0.110885714,0.109235714,16,50,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,13,81.25,15,93.75,81.78,66.75,77.38,93.75,89.25,83.62,79.94,-37.5,-5.72,-20.75,-10.12,6.25,1.75,2.37,-13.81,1,0,1,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,2,2,2,2,4,0.6,0.4,0.4,0.8,0.2,0.4,0.2,2.4,0.55,0.8,8.67,6.67,4,0,2,1,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),23,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,1,-1,1,0,1,0,0,0,0,0,0,0,1,0,0,-1,-1,-1,-1,-4,0.4,0,0.2,-1.6,-0.25,HS_TS +960,R_7GKtwk4AIdHKva9,18 - 24,American,Male,-1,3,3,2,2,2,-1,2,-1,2,3,1,2,-1,2,2,2,3,3,2,0,-1,3,1,3,8,1,1,-1,1,-1,7,3,2,1,2,1,7,2,1,-1,3,2,5,1,3,2,2,3,7,3,-2,2,0,3,2,3,3,3,1,3,7,2,1,3,2,3,6,FALSE,1,96,TRUE,1,100,FALSE,1,80,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,70,TRUE,1,75,TRUE,1,100,FALSE,1,65,TRUE,0,100,TRUE,1,100,FALSE,1,65,TRUE,1,88,TRUE,1,100,TRUE,0,90,TRUE,0,100,FALSE,1,56,TRUE,0,63,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,83,TRUE,1,76,FALSE,1,65,TRUE,0,100,TRUE,0,85,FALSE,0,100,FALSE,0,68,TRUE,1,80,0.09,0.0576,0,0,0.04,1,0.09,0,0.3969,0,1,0,0.0625,0.1225,0,0,0,0.7225,1,0.6889,0.5625,0.0144,0.1936,0.1225,0.81,0.1225,0.4624,0.0016,0.04,1,0.7225,1,0.363403571,0.245314286,0.481492857,18,56.25,20,62.5,6,75,4,50,6,75,4,50,13,81.25,7,43.75,85.47,75.25,91.25,90,85.38,87.62,83.31,-6.25,22.97,0.25,41.25,15,35.38,6.37,39.56,1,4,0,1,1,1,2,3,2,3,0,1,1,3,1,0,1,4,0,0,2,0,1,0,1,1,1,0,1,1,0,2,1,2,1,0,1,0,1,1,1.4,2.2,1.2,1,0.8,0.8,1.2,0.6,1.45,0.85,7.33,5.33,1,5,0,-1,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-1,4,-1,1,0,0,1,3,1,2,0,-1,0,1,0,0,0,4,-1,-1,0.6,1.4,0,0.4,0.6,HS_TS +961,R_7BDrO6b7AbW3qiB,18 - 24,American,Male,1,2,2,-2,-1,1,1,-1,2,3,-2,-3,2,1,2,1,-1,-1,0,0,2,1,3,-2,2,6,1,-2,-3,-1,-2,7,-3,1,1,2,1,6,0,-2,-1,1,-3,4,1,2,1,0,0,5,1,2,1,0,2,5,-3,-3,3,0,2,5,0,0,0,0,2,5,TRUE,0,99,FALSE,0,65,TRUE,0,98,FALSE,1,55,TRUE,1,96,FALSE,1,67,TRUE,1,66,FALSE,0,66,FALSE,0,57,TRUE,1,80,FALSE,1,50,TRUE,0,76,TRUE,1,83,FALSE,1,91,TRUE,1,50,TRUE,1,71,FALSE,1,95,TRUE,0,97,TRUE,0,70,FALSE,1,56,FALSE,0,55,TRUE,1,90,TRUE,0,54,TRUE,1,70,TRUE,0,59,TRUE,1,88,TRUE,0,50,FALSE,1,73,TRUE,0,50,FALSE,0,65,FALSE,0,53,TRUE,1,90,0.4356,0.0144,0.0841,0.1156,0.01,0.1089,0.09,0.04,0.1936,0.01,0.4225,0.0289,0.3249,0.25,0.0016,0.4225,0.2916,0.2025,0.0729,0.3481,0.3025,0.25,0.49,0.0081,0.0025,0.25,0.2809,0.9801,0.9604,0.9409,0.25,0.5776,0.289678571,0.171214286,0.408142857,16,50,17,53.13,3,37.5,5,62.5,5,62.5,4,50,10,62.5,7,43.75,71.41,56.25,73.75,83.75,71.88,71.56,71.25,-3.13,18.28,18.75,11.25,21.25,21.88,9.06,27.5,1,1,1,0,3,0,3,2,3,5,1,4,1,1,1,1,1,0,1,3,0,0,1,2,1,0,1,2,2,1,1,0,1,1,0,1,1,1,0,2,1.2,2.6,1.6,1.2,0.8,1.2,0.6,1,1.65,0.9,6.33,5,1,2,1,-1,1.33,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,1,0,-2,2,0,2,0,1,4,0,4,0,0,1,0,0,-1,1,1,0.4,1.4,1,0.2,0.75,HS_TS +962,R_6H2c8x72JVggldp,18 - 24,American,Female,3,3,3,3,3,1,0,2,2,3,2,-2,3,2,3,1,0,1,1,0,3,3,3,3,3,0,3,-2,1,-2,3,3,3,-1,1,3,3,2,0,2,2,0,0,7,3,3,3,3,3,0,3,-2,3,-2,3,5,2,-3,3,2,3,2,3,3,3,3,-2,8,FALSE,1,65,TRUE,1,50,TRUE,0,95,FALSE,1,50,TRUE,1,75,FALSE,1,65,TRUE,1,85,FALSE,0,50,TRUE,1,60,TRUE,1,95,FALSE,1,50,TRUE,0,98,TRUE,1,80,FALSE,1,63,TRUE,1,61,TRUE,1,80,TRUE,0,50,TRUE,0,90,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,80,TRUE,1,50,TRUE,1,80,0.25,0.0025,0.04,0.0225,0.04,0.1225,0,0.0025,0.25,0.0004,0.04,0.04,0.16,0.25,0.0625,0.25,0,0.25,0.25,0,0.25,0.1521,0.25,0.1369,0.25,0.25,0.25,0.1225,0.9025,0.81,1,0.9604,0.251867857,0.10485,0.398885714,19,59.38,24,75,7,87.5,6,75,7,87.5,4,50,15,93.75,9,56.25,72.34,52.62,75,86.38,75.38,74.31,70.38,-15.62,-2.66,-34.88,0,-1.12,25.38,-19.44,14.13,0,0,0,0,0,2,2,1,4,0,1,1,2,1,0,1,2,1,1,0,0,0,0,0,0,2,2,1,4,0,0,1,0,0,0,2,3,2,2,2,0,1.8,1,1,0,1.8,0.2,2.2,0.95,1.05,1.67,2.33,0,-2,0,-1,-0.66,10 cents,5 minutes,47 days,Female,High School (or equivalent),20,0.875,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,1,0,2,1,0,-1,-1,-1,-1,-2,0,0,0.8,-1.2,-0.1,HS_TS +963,R_7VJC3dAZp5t5i8H,18 - 24,American,Male,0,3,0,0,1,-2,0,0,0,0,0,-2,1,0,2,-2,0,-3,1,-3,-2,1,3,-1,0,5,0,0,0,0,0,5,0,0,-1,-1,-1,4,1,2,2,1,-3,9,0,3,1,1,1,5,-2,0,1,0,0,4,0,0,1,0,2,5,-1,0,-1,0,-3,5,TRUE,0,63,FALSE,0,57,TRUE,0,62,FALSE,1,54,FALSE,0,53,FALSE,1,60,TRUE,1,72,TRUE,1,68,TRUE,1,63,FALSE,0,55,FALSE,1,53,TRUE,0,53,TRUE,1,61,FALSE,1,54,TRUE,1,66,TRUE,1,100,TRUE,0,57,FALSE,1,55,FALSE,1,55,FALSE,1,61,TRUE,1,75,TRUE,1,73,TRUE,0,68,FALSE,0,61,FALSE,1,58,TRUE,1,81,FALSE,1,71,FALSE,1,85,FALSE,1,77,FALSE,0,69,FALSE,0,56,TRUE,1,97,0.1024,0.0361,0,0.0784,0.0009,0.16,0.3721,0.3025,0.1521,0.0729,0.4761,0.1521,0.1369,0.2209,0.2809,0.3249,0.4624,0.2116,0.0225,0.1764,0.0625,0.1156,0.2025,0.2116,0.3249,0.0841,0.3136,0.3969,0.3844,0.2025,0.0529,0.2809,0.219914286,0.237592857,0.202235714,11,34.38,21,65.63,6,75,5,62.5,6,75,4,50,10,62.5,11,68.75,65.41,59.38,68.5,63.88,69.88,69.19,61.62,-31.25,-0.22,-15.62,6,-11.12,19.88,6.69,-7.13,2,2,3,1,1,2,0,0,0,0,0,2,2,1,3,3,2,5,0,0,0,0,1,1,0,0,0,1,0,0,0,2,0,0,0,1,0,2,1,0,1.8,0.4,1.6,2,0.4,0.2,0.4,0.8,1.45,0.45,4.67,4.67,0,1,-1,4,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,19,0.5,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,2,2,0,1,2,0,-1,0,0,0,0,2,1,3,2,2,3,-1,0,1.4,0.2,1.2,1.2,1,C_Ug +964,R_7r6L1MPWM8BL8Wv,32 - 38,Canadian,Male,2,2,2,1,-2,1,-1,0,-1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,7,1,1,1,0,1,7,1,1,1,0,1,8,1,1,1,1,2,7,0,0,0,0,0,5,0,0,0,0,0,7,1,0,0,1,1,7,1,1,1,1,1,6,TRUE,0,81,TRUE,1,80,TRUE,0,75,TRUE,0,75,TRUE,1,76,TRUE,0,88,TRUE,1,75,TRUE,1,90,TRUE,1,79,TRUE,1,83,TRUE,0,86,TRUE,0,83,TRUE,1,83,TRUE,0,84,TRUE,1,79,TRUE,1,75,TRUE,0,86,TRUE,0,89,TRUE,0,88,TRUE,0,84,TRUE,1,81,TRUE,1,91,TRUE,0,83,TRUE,1,93,TRUE,0,79,TRUE,1,87,TRUE,0,83,TRUE,0,87,TRUE,0,80,TRUE,1,94,TRUE,1,90,TRUE,1,92,0.01,0.0169,0.0625,0.0625,0.0064,0.7744,0.0049,0.0289,0.7056,0.0081,0.0036,0.0289,0.0441,0.7396,0.0576,0.04,0.6889,0.5625,0.7569,0.6241,0.0361,0.0441,0.7744,0.7056,0.7396,0.6889,0.01,0.6561,0.5625,0.7921,0.64,0.6889,0.4076,0.263821429,0.551378571,16,50,16,50,4,50,4,50,4,50,4,50,16,100,0,0,83.72,82.5,83.62,83.62,85.12,84.25,83.19,0,33.72,32.5,33.62,33.62,35.12,-15.75,83.19,1,2,1,1,3,0,2,1,1,0,0,0,0,1,0,0,0,0,0,1,2,2,2,1,2,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,1.6,0.8,0.2,0.2,1.8,0.8,0.4,0,0.7,0.75,7.33,6.33,2,0,1,1,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,37,0.125,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,-1,0,-1,0,1,-1,1,1,0,-1,0,-1,-1,1,0,0,0,0,0,1,-0.2,0,-0.2,0.2,-0.05,C_Ug +965,R_5l8R2oWrQLP0fHr,39 - 45,Canadian,Male,1,0,2,2,-1,-3,-1,2,0,0,-2,-3,3,1,3,-3,-3,-3,-3,-3,0,0,3,1,-3,1,-3,-3,1,-2,-1,6,1,-2,1,2,3,6,-3,-3,-3,-3,-3,5,1,0,2,3,-1,1,-3,-1,3,-1,1,3,-3,-3,3,0,3,2,-3,-3,-3,-3,-3,2,FALSE,1,78,TRUE,1,63,FALSE,1,69,FALSE,1,73,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,87,TRUE,1,100,TRUE,1,100,FALSE,1,59,FALSE,1,69,TRUE,1,73,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,63,TRUE,0,90,FALSE,1,65,FALSE,1,78,TRUE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,76,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,65,TRUE,0,100,TRUE,1,100,TRUE,1,81,TRUE,1,100,0.0169,0,0,0,0,0,0.0576,0,0.0484,0.0225,0,0.0729,0,0.1681,0,0.1369,0,0.0729,0.1225,0,0,0.0225,0.1225,0,0.1369,0.2809,0.0361,0.0484,0.0961,0.81,1,0.0961,0.119689286,0.041378571,0.198,27,84.38,29,90.63,7,87.5,7,87.5,7,87.5,8,100,16,100,13,81.25,84.75,72.38,92,94.12,80.5,90.62,78.88,-6.25,-5.88,-15.12,4.5,6.62,-19.5,-9.38,-2.37,1,0,1,1,2,0,2,1,2,1,3,1,2,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,1,1.2,1.4,0,0.2,0.6,0.4,0,0.9,0.3,4.33,2,0,3,4,3,2.33,10 cents,5 minutes,47 days,Male,University - Undergraduate,39,1.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,02REV,1,0,1,0,2,0,2,0,1,0,2,1,2,0,0,0,0,0,0,0,0.8,0.6,1,0,0.6,C_Ug +966,R_53dWX4p2nUU2svX,32 - 38,Canadian,Male,1,2,2,0,2,-1,-2,0,-2,-1,1,1,1,-1,1,1,1,1,1,1,1,2,2,0,2,3,-2,-2,1,-2,0,5,1,1,1,-2,1,3,1,1,1,1,1,3,1,1,2,0,2,5,-1,-1,0,1,0,5,1,1,1,-1,1,4,1,2,1,1,2,5,FALSE,1,50,FALSE,0,65,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,72,TRUE,1,69,FALSE,0,50,TRUE,1,75,FALSE,1,71,TRUE,0,75,TRUE,1,76,FALSE,1,50,FALSE,0,53,TRUE,1,72,FALSE,1,57,TRUE,0,67,FALSE,1,50,TRUE,0,70,FALSE,0,65,FALSE,0,61,FALSE,1,62,TRUE,1,74,TRUE,0,69,TRUE,1,67,FALSE,1,63,FALSE,1,66,FALSE,1,62,TRUE,1,65,FALSE,0,56,TRUE,1,80,0.0961,0.1089,0.0784,0.0784,0.04,0.25,0.0676,0.0625,0.49,0.3721,0.1225,0.0576,0.25,0.0841,0.25,0.4225,0.1444,0.25,0.1156,0.4761,0.4225,0.2809,0.25,0.25,0.1849,0.1369,0.3136,0.25,0.25,0.4489,0.1444,0.5625,0.2482,0.204521429,0.291878571,16,50,21,65.63,4,50,6,75,5,62.5,6,75,9,56.25,12,75,62.88,57.25,62.75,63.88,67.62,65.62,60.12,-15.63,-2.75,7.25,-12.25,1.38,-7.38,9.37,-14.88,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,3,1,0,0,0,0,0,0,1,0,0,1,0,0.6,0.2,0,0.2,1,0,0.4,0.2,0.4,3.67,4.67,-2,0,-1,-2,-1,10 cents,100 minutes,36 days,Male,College Diploma/Certificate,34,-0.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,-1,0,0,0,1,-1,1,-3,0,0,0,0,1,0,0,-1,0,0,-1,-0.2,-0.4,0.2,-0.4,-0.2,C_Ug +967,R_7rfzIX6Dhq7YeKq,32 - 38,Canadian,Male,2,3,2,2,3,2,-2,2,-2,3,2,3,2,2,3,1,1,1,1,-2,3,1,2,2,1,8,2,0,1,2,1,7,3,1,1,2,3,7,-1,-1,0,-3,-2,7,1,3,2,2,3,4,1,-3,3,-3,3,9,2,3,2,2,3,4,3,2,2,2,-1,4,FALSE,1,56,TRUE,1,69,TRUE,0,100,TRUE,0,67,FALSE,0,59,TRUE,0,75,TRUE,1,85,TRUE,1,100,TRUE,1,86,TRUE,1,84,FALSE,1,69,TRUE,0,90,FALSE,0,75,FALSE,1,74,TRUE,1,89,TRUE,1,85,TRUE,0,100,FALSE,1,100,FALSE,1,67,FALSE,1,80,FALSE,0,62,TRUE,1,74,FALSE,1,90,FALSE,0,69,FALSE,1,100,FALSE,0,80,FALSE,1,56,TRUE,0,79,FALSE,1,61,TRUE,1,60,FALSE,0,85,FALSE,0,100,0,0.64,0.0225,0.0225,1,0.5625,0.4761,0.0256,0.04,0.0676,0.16,0.5625,0.0196,0.0961,0.3481,0.0961,0.01,0.4489,0.6241,0,0.3844,0.0121,0.1089,0.0676,1,0.1936,0.7225,0.1936,1,0,0.1521,0.81,0.327928571,0.279507143,0.37635,16,50,19,59.38,6,75,2,25,7,87.5,4,50,9,56.25,10,62.5,78.94,73.5,77.75,81.62,82.88,78.88,79,-9.38,19.56,-1.5,52.75,-5.88,32.88,22.63,16.5,1,2,0,0,2,0,2,1,4,2,1,2,1,0,0,2,2,1,4,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,2,1,1,1,1,1,1.8,0.8,1.8,0.2,0.8,0,1.2,1.35,0.55,7.33,5.67,4,-2,3,3,1.66,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),34,1.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,2,0,0,2,-1,1,0,3,2,1,2,1,0,0,0,1,0,3,-1,0.8,1,0.8,0.6,0.8,grad_prof +968,R_1njzHccnsMcDWUe,32 - 38,American,Male,-1,1,3,-2,2,-3,-1,1,3,-2,3,2,2,2,2,-3,-2,-3,-3,-3,2,1,3,2,2,8,2,2,2,2,2,8,2,-1,-1,2,2,9,2,2,-1,2,1,10,3,2,3,2,-1,9,-3,-3,3,3,-3,8,3,3,3,3,3,8,-3,-2,-3,-3,-3,10,TRUE,0,53,TRUE,1,55,FALSE,1,84,FALSE,1,54,FALSE,0,52,FALSE,1,100,TRUE,1,83,TRUE,1,64,FALSE,0,55,TRUE,1,79,FALSE,1,51,FALSE,1,53,TRUE,1,100,FALSE,1,54,FALSE,0,52,TRUE,1,100,TRUE,0,100,TRUE,0,53,FALSE,1,62,TRUE,0,55,FALSE,0,100,TRUE,1,77,FALSE,1,100,TRUE,1,52,TRUE,0,52,TRUE,1,55,TRUE,0,55,FALSE,1,50,FALSE,1,50,TRUE,1,66,FALSE,0,59,TRUE,1,100,0.1296,0.2025,0,0.0289,0,0,0.2304,0.0441,0.3025,0.0529,0.1156,0,0.3025,0.2401,0.2704,0.2025,0,0.2116,0.25,0.2704,1,0.2704,0.1444,0.2116,1,0.3025,0.3481,0.2809,0.0256,0.2809,0.25,0.2209,0.243867857,0.1409,0.346835714,8,25,21,65.63,4,50,5,62.5,5,62.5,7,87.5,11,68.75,10,62.5,67.97,55.38,87.75,63.25,65.5,71.81,64.12,-40.63,2.34,5.38,25.25,0.75,-22,3.06,1.62,3,0,0,4,0,5,3,1,1,4,1,3,3,0,0,5,4,2,5,4,4,1,0,4,3,0,2,2,0,1,0,1,1,1,1,0,0,0,0,0,1.4,2.8,1.4,4,2.4,1,0.8,0,2.4,1.05,8.33,8.33,-1,0,1,0,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,38,1.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,-1,-1,0,0,-3,5,1,-1,1,3,1,2,2,-1,-1,5,4,2,5,4,-1,1.8,0.6,4,1.35,C_Ug +969,R_7BrnO4eAWl04uwP,60 - 66,American,Male,-2,3,3,3,-1,-2,-3,-2,-2,-2,1,2,1,-1,1,-2,-2,-2,-1,-2,0,3,2,2,0,4,1,1,0,0,0,7,-1,1,2,1,0,6,-1,-2,-1,-1,-2,5,-3,3,3,3,-1,1,-2,-2,0,-1,-2,3,1,3,1,-2,1,0,-3,-3,-2,-2,-2,0,FALSE,1,75,FALSE,0,84,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,85,TRUE,1,95,TRUE,1,100,TRUE,1,71,TRUE,1,63,FALSE,1,50,TRUE,0,92,TRUE,1,89,TRUE,0,89,FALSE,0,50,TRUE,1,88,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,95,TRUE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,91,FALSE,0,83,TRUE,0,90,FALSE,1,86,TRUE,0,58,TRUE,1,62,TRUE,1,100,TRUE,1,100,0,0.6889,0.0144,0.0025,0,0.0225,0.0025,0.1369,0.0025,0,0.1444,0.0121,0.0841,0.25,0,0.7056,0,0.25,0.0196,0.8281,0.2401,0.25,0.25,0.7921,0.25,0.81,0,0.0625,0,0.25,0.3364,0.8464,0.233778571,0.115042857,0.352514286,16,50,24,75,5,62.5,7,87.5,5,62.5,7,87.5,13,81.25,11,68.75,79.44,68.12,79.12,80.75,89.75,83.19,75.69,-25,4.44,5.62,-8.38,18.25,2.25,1.94,6.94,2,0,1,1,1,3,4,2,2,2,2,1,1,2,1,1,0,1,0,0,1,0,0,0,0,0,1,2,1,0,0,1,0,1,0,1,1,0,1,0,1,2.6,1.4,0.4,0.2,0.8,0.4,0.6,1.35,0.5,5.67,1.33,3,4,6,5,4.34,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,1,0,1,1,1,3,3,0,1,2,2,0,1,1,1,0,-1,1,-1,0,0.8,1.8,1,-0.2,0.85,HS_TS +970,R_1soecjnBRZ7oNeX,32 - 38,American,Male,3,2,2,-1,3,-1,3,1,0,3,1,-2,1,2,3,1,1,3,3,0,-2,-1,-2,-2,-2,9,-1,2,0,0,0,4,3,0,3,0,1,6,3,3,3,-1,0,1,2,2,1,-2,3,5,-2,-2,0,0,3,2,1,-1,1,0,2,3,3,2,3,3,0,0,TRUE,0,100,FALSE,0,73,TRUE,0,69,FALSE,1,90,TRUE,1,85,FALSE,1,100,TRUE,1,93,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,93,TRUE,0,88,FALSE,0,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,TRUE,0,61,TRUE,0,100,FALSE,1,67,FALSE,1,100,FALSE,0,56,TRUE,1,100,TRUE,0,69,TRUE,1,97,FALSE,1,50,TRUE,1,86,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,0,54,FALSE,0,51,TRUE,1,100,0.01,0.0196,0,0.0049,0,0,0.0009,0,0,0,0.2916,1,0,0.8649,0.0225,0.5329,0.4761,0.01,0,0.25,0.3136,0.1681,0.1089,0,0.3721,0.25,0.2601,1,0.4761,1,1,0.7744,0.327578571,0.228492857,0.426664286,22,68.75,19,59.38,5,62.5,3,37.5,6,75,5,62.5,11,68.75,8,50,83.78,72.88,83.88,91.12,87.25,84,83.56,9.37,24.4,10.38,46.38,16.12,24.75,15.25,33.56,5,3,4,1,5,0,1,1,0,3,2,2,2,2,2,2,2,0,4,0,1,0,1,1,0,1,5,1,0,0,0,1,0,2,1,2,1,0,0,0,3.6,1,2,1.6,0.6,1.4,0.8,0.6,2.05,0.85,6.33,3.33,4,2,3,1,3,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,33,0.75,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,4,3,3,0,5,-1,-4,0,0,3,2,1,2,0,1,0,1,0,4,0,3,-0.4,1.2,1,1.2,C_Ug +971,R_5kum2RlXl1Pxv4g,32 - 38,American,Male,1,1,2,1,3,-2,-3,3,-1,-1,3,3,1,1,3,1,1,1,2,-3,1,2,3,1,3,8,0,1,2,1,2,9,3,3,1,2,2,8,1,1,1,1,1,9,1,2,2,1,3,1,-2,-1,1,1,2,10,3,3,1,1,3,10,2,2,1,1,2,9,FALSE,1,59,FALSE,0,56,TRUE,0,92,FALSE,1,50,FALSE,0,61,FALSE,1,52,TRUE,1,90,TRUE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,68,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,0,84,TRUE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,64,TRUE,1,100,0,0,0,0.01,0,0.2304,0,0,0.25,0,0,0,0.2704,0.8281,0.3721,0.3136,0.7056,0.25,1,0.7225,0,0.4624,1,1,1,0.25,0.4096,0.1681,0.8464,1,1,1,0.467114286,0.230014286,0.704214286,20,62.5,16,50,2,25,4,50,5,62.5,5,62.5,11,68.75,5,31.25,84.5,66.38,87.12,91.75,92.75,86.94,82.06,12.5,34.5,41.38,37.12,29.25,30.25,18.19,50.81,0,1,1,0,0,2,4,1,2,3,0,0,0,1,1,0,0,0,1,4,0,1,0,0,0,0,2,2,2,3,0,0,0,0,0,1,1,0,1,5,0.4,2.4,0.4,1,0.2,1.8,0,1.6,1.05,0.9,8.33,7,7,-1,-2,0,1.33,5 cents,5 minutes,36 days,Male,College Diploma/Certificate,33,-0.125,1,1,0,0,0,0,0.67,0,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,0,0,1,0,0,2,2,-1,0,0,0,0,0,1,1,-1,-1,0,0,-1,0.2,0.6,0.4,-0.6,0.15,C_Ug +972,R_7hQpBSC0FLY69a6,46 - 52,American,Male,3,3,3,2,2,-2,2,0,3,1,-1,-1,2,-1,3,-2,-1,-1,-2,-2,3,3,3,2,3,2,0,2,-1,1,2,5,-2,-2,2,-2,3,3,-1,0,1,-1,0,8,3,3,3,2,2,3,-1,0,1,-2,2,5,-1,-1,3,-1,3,7,2,2,2,2,1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,50,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,0,75,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,59,TRUE,1,95,FALSE,1,100,FALSE,1,97,TRUE,0,100,TRUE,1,92,FALSE,0,70,TRUE,1,100,0,0.0025,0,0,0,0.04,0,1,0,0,0.0064,0,0,0.25,0,0,0,0.25,0.0009,0.3481,0.25,0.0576,0.5625,0,0.0784,0,0.49,0,1,1,1,0.9604,0.260510714,0.110457143,0.410564286,26,81.25,23,71.88,6,75,6,75,5,62.5,6,75,13,81.25,10,62.5,89.5,77.62,87.75,94.25,98.38,92.69,86.31,9.37,17.62,2.62,12.75,31.75,23.38,11.44,23.81,0,0,0,0,1,2,0,1,2,1,1,1,0,1,0,1,1,2,1,2,0,0,0,0,0,1,2,1,5,1,0,0,1,0,0,4,3,3,4,3,0.2,1.2,0.6,1.4,0,2,0.2,3.4,0.85,1.4,3.33,5,-1,0,-4,0,-1.67,10 cents,5 minutes,15 days,Male,High School (or equivalent),46,1.375,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,1,1,-2,0,-3,0,1,1,-1,1,0,-3,-2,-1,-3,-1,0.2,-0.8,0.4,-2,-0.55,HS_TS +973,R_6zwj7FoNzv6n4el,60 - 66,American,Male,1,3,2,2,3,1,-1,2,-1,1,2,1,2,0,2,2,2,2,2,2,0,3,2,1,3,1,1,-1,2,-1,2,2,2,2,2,-1,3,2,2,2,2,2,2,2,1,3,2,2,3,1,1,-1,2,-1,1,2,2,1,2,-1,2,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,80,FALSE,1,80,TRUE,1,80,FALSE,1,85,TRUE,1,95,TRUE,1,80,TRUE,1,80,TRUE,1,100,FALSE,1,85,TRUE,0,100,TRUE,1,85,FALSE,1,70,TRUE,1,85,TRUE,1,100,FALSE,1,80,TRUE,0,100,FALSE,1,65,FALSE,1,100,TRUE,1,75,FALSE,0,71,FALSE,1,65,TRUE,1,60,FALSE,1,75,TRUE,1,75,FALSE,1,60,FALSE,1,95,TRUE,0,54,FALSE,0,50,TRUE,1,55,TRUE,1,85,0.04,0.0625,0,0.0025,0.0225,0.0225,0.16,0,0,0.5041,0.25,0.0225,0.04,0.0225,0.04,0,0.1225,0.04,0.0025,0.0625,0.0625,0.0225,0.1225,0.09,0.04,0.16,0.2025,1,0.64,1,0.2916,1,0.212257143,0.089042857,0.335471429,18,56.25,25,78.13,8,100,7,87.5,5,62.5,5,62.5,14,87.5,11,68.75,80.31,76.25,76.12,85.75,83.12,79.75,80.88,-21.88,2.18,-23.75,-11.38,23.25,20.62,-7.75,12.13,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.4,0.2,0.6,0,0,0,0.2,0,0.3,0.05,1.67,1.67,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0.4,0.2,0.4,0,0.25,C_Ug +974,R_7tYy85r3076itb3,39 - 45,American,Male,1,2,2,-1,2,-1,0,1,0,1,1,1,2,2,2,-1,-1,-1,-1,-1,1,1,1,-1,-1,3,-2,1,1,1,0,3,0,1,1,-1,1,3,-1,-1,-1,-1,-1,2,1,1,1,0,1,3,0,-1,1,0,1,3,1,1,2,0,3,2,-1,-1,-1,-1,-1,4,TRUE,0,67,TRUE,1,74,TRUE,0,80,FALSE,1,62,TRUE,1,62,FALSE,1,72,TRUE,1,72,TRUE,1,72,FALSE,0,56,TRUE,1,88,FALSE,1,70,FALSE,1,60,TRUE,1,84,FALSE,1,68,FALSE,0,58,TRUE,1,85,FALSE,1,58,TRUE,0,66,TRUE,0,68,FALSE,1,80,TRUE,1,73,TRUE,1,75,FALSE,1,85,TRUE,1,58,FALSE,1,73,TRUE,1,78,FALSE,1,55,FALSE,1,63,TRUE,0,60,TRUE,1,65,FALSE,0,63,TRUE,1,72,0.0784,0.0484,0.0225,0.0784,0.0784,0.0784,0.1764,0.0144,0.04,0.0625,0.1225,0.0256,0.3136,0.09,0.1444,0.0676,0.0225,0.1444,0.1369,0.0729,0.0729,0.3364,0.4624,0.1024,0.1764,0.2025,0.3969,0.4489,0.64,0.4356,0.36,0.16,0.192317857,0.098621429,0.286014286,24,75,24,75,4,50,7,87.5,6,75,7,87.5,13,81.25,11,68.75,69.44,63.25,70.75,73.38,70.38,70.94,67.94,0,-5.56,13.25,-16.75,-1.62,-17.12,-10.31,-0.81,0,1,1,0,3,1,1,0,1,1,1,0,1,3,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,2,1,0,0,0,0,0,1,0.8,1.2,0,0.8,0.4,0.6,0,0.75,0.45,3,2.67,0,0,1,-2,0.33,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,44,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,0,-1,2,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0.2,0.4,0.6,0,0.3,C_Ug +975,R_5qIt91B3oLYyRHh,39 - 45,American,Male,3,3,3,2,3,-3,3,3,-3,2,3,3,3,2,3,3,2,3,3,3,2,3,3,3,3,5,2,3,3,-2,3,5,2,3,3,3,3,8,3,3,3,3,3,5,3,3,3,3,3,0,2,0,3,-3,3,5,3,3,3,3,3,7,3,3,3,2,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,0,95,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,95,FALSE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,95,TRUE,0,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,96,FALSE,1,95,FALSE,1,90,TRUE,1,90,TRUE,1,96,TRUE,1,100,0,0,0,0.0025,0,0,0,0,0,0.0025,0.01,0.9025,0.0025,0,0,0,0,0.9025,0.0025,0.0025,0,0.0004,0,0,0.0025,0.0016,0.0016,0,0.0081,0.8281,0.01,0.01,0.095975,0.13,0.06195,30,93.75,29,90.63,7,87.5,7,87.5,7,87.5,8,100,15,93.75,14,87.5,96.94,97.5,97.5,97,95.75,97.75,96.12,3.12,6.31,10,10,9.5,-4.25,4,8.62,1,0,0,1,0,5,0,0,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,5,3,0,0,1,0,0,0,1,0,0,1,0,1,0,0.4,1.4,0.4,0.2,0.2,1.8,0.2,0.4,0.6,0.65,6,4,5,0,1,0,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,0.875,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,1,0,0,0,0,0,-3,0,1,0,1,0,0,0,0,0,0,0,-1,0,0.2,-0.4,0.2,-0.2,-0.05,C_Ug +976,R_3PuL0KDwfjj4sQp,46 - 52,American,Male,2,2,2,3,2,-2,0,2,1,1,-1,2,2,2,2,-3,-3,-3,-3,-3,1,2,3,2,2,6,2,1,2,1,2,8,0,2,2,2,3,9,-2,-2,-3,-2,-2,8,2,2,2,2,2,7,-2,2,2,1,1,8,1,-2,2,-1,3,9,-2,-2,-2,-2,-3,5,TRUE,0,96,TRUE,1,100,FALSE,1,100,FALSE,1,98,FALSE,0,97,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.0004,1,0,0,0,0,0,0,0,0.9409,0,1,0.0004,0,1,0,1,0,1,1,1,1,0.9216,0,0,1,0,0.387975,0.210121429,0.565828571,22,68.75,21,65.63,5,62.5,4,50,5,62.5,7,87.5,12,75,9,56.25,99.66,99.75,99.38,99.5,100,99.81,99.5,3.12,34.03,37.25,49.38,37,12.5,24.81,43.25,1,0,1,1,0,4,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,0,0,1,0,0,2,0,0,0,2,4,0,3,1,1,1,1,1,0,0.6,1.2,0.4,0.8,0.2,0.4,2,0.8,0.75,0.85,7.67,8,-1,0,0,3,-0.33,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,47,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,0,1,0,0,4,-1,0,0,1,-1,-4,0,-3,0,0,0,-1,0,1,0.4,0.8,-1.6,0,-0.1,C_Ug +977,R_7OjN6oZfNkfvps9,18 - 24,American,Male,-1,3,-1,-3,3,-1,0,0,1,1,2,-1,3,1,2,-2,-1,-1,-1,-2,0,0,3,-1,3,3,2,1,-2,-1,-1,8,1,-2,0,3,0,8,1,1,1,1,0,2,0,2,0,2,3,3,-1,-1,1,0,1,3,2,-1,3,2,3,5,1,1,1,2,2,6,FALSE,1,58,FALSE,0,57,FALSE,1,100,TRUE,0,83,TRUE,1,100,FALSE,1,88,TRUE,1,100,TRUE,1,88,TRUE,1,92,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,53,TRUE,1,70,TRUE,1,86,FALSE,1,60,TRUE,0,100,TRUE,0,87,TRUE,0,53,TRUE,1,100,TRUE,1,100,FALSE,1,92,FALSE,0,54,FALSE,1,100,TRUE,1,87,TRUE,0,50,FALSE,1,88,TRUE,0,97,TRUE,1,85,FALSE,0,61,TRUE,1,100,0.0144,0.0169,0.0196,0,0,0.0144,0.2916,0,0.2809,0,0.0225,0,0.0064,0,0,0.3249,0.0064,0.6889,0.0144,0,0,0.09,0.7569,0.2209,0.16,0.25,0.3721,0.1764,0,1,0.9409,1,0.236342857,0.116857143,0.355828571,24,75,22,68.75,3,37.5,7,87.5,7,87.5,5,62.5,13,81.25,9,56.25,84.03,75,92.12,87.25,81.75,86.25,81.81,6.25,15.28,37.5,4.62,-0.25,19.25,5,25.56,1,3,4,2,0,3,1,2,2,2,1,1,3,2,2,3,2,2,2,2,1,1,1,5,0,0,1,1,1,0,0,0,0,1,1,3,2,2,3,4,2,2,1.8,2.2,1.6,0.6,0.4,2.8,2,1.35,6.33,3.67,0,5,3,-4,2.66,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,0.625,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,2,3,-3,0,3,0,1,1,2,1,1,3,1,1,0,0,0,-1,-2,0.4,1.4,1.4,-0.6,0.65,HS_TS +978,R_7Ei9VuEs5TkiVa5,25 - 31,American,Male,3,1,3,2,1,3,1,2,0,2,2,2,3,1,3,3,2,2,3,2,3,1,3,2,2,7,2,3,1,1,2,7,2,3,1,1,2,5,2,3,1,1,2,7,1,1,3,0,2,8,2,1,1,2,3,7,1,1,2,1,3,7,3,2,1,2,1,7,TRUE,0,100,FALSE,0,80,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,50,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,60,TRUE,0,100,TRUE,1,65,TRUE,0,65,TRUE,0,100,TRUE,0,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.1225,1,0,0,0,0.16,0,0.25,0,0,0,0,0,0.16,0.64,0.25,0.25,1,1,1,0.25,0.25,0.25,0.25,0.4225,0,1,0,1,0.49,1,0.343660714,0.122142857,0.565178571,17,53.13,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,82.81,74.38,78.75,89.38,88.75,88.44,77.19,-12.5,17.18,-0.62,16.25,26.88,26.25,7.19,27.19,0,0,0,0,1,1,2,1,1,0,0,1,2,0,1,1,1,1,2,0,2,0,0,2,1,1,0,1,2,1,1,1,1,0,0,0,0,1,1,1,0.2,1,0.8,1,1,1,0.6,0.6,0.75,0.8,6.33,7.33,-1,0,-2,0,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),31,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,-2,0,0,-2,0,0,2,0,-1,-1,-1,0,1,0,1,1,1,0,1,-1,-0.8,0,0.2,0.4,-0.05,grad_prof +979,R_3Ow9i9lNAkypVYS,39 - 45,American,Male,-2,-2,-1,-3,2,-2,1,3,-1,-1,-1,-1,3,-1,2,0,0,1,1,-2,-2,-2,-1,-3,-1,2,-2,1,3,-2,-2,3,-1,-1,3,-2,2,2,-1,-1,1,0,-2,4,-2,-3,-2,-3,2,1,-2,1,3,-2,1,2,1,-1,3,-2,2,2,1,1,2,2,-2,7,FALSE,1,55,TRUE,1,100,FALSE,1,97,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,52,TRUE,0,56,TRUE,1,100,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,92,FALSE,1,100,FALSE,1,54,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,87,FALSE,1,50,FALSE,1,89,FALSE,1,50,TRUE,1,75,TRUE,1,51,TRUE,1,80,0,0.0169,0,0,0.04,0,0,0,0,0,0.0625,0,0.0064,0.2304,0,0,0,0.25,0.0121,0.25,0.0025,0.1225,0.2116,0,0.0064,0.25,0.2401,0.2025,0.0009,0,0.25,0.3136,0.087553571,0.042092857,0.133014286,16,50,30,93.75,8,100,8,100,7,87.5,7,87.5,16,100,14,87.5,82.5,64.25,89.62,86.5,89.62,90.31,74.69,-43.75,-11.25,-35.75,-10.38,-1,2.12,-9.69,-12.81,0,0,0,0,3,0,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,2,2,0,0,1,0,1,1,1,1,0,0.6,0.4,0.2,0.6,0.4,0.6,0.6,0.8,0.45,0.6,2.33,1.67,1,1,0,-3,0.66,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,44,1.875,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,0,-1,-1,0,3,0,0,0,0,-1,-2,0,0,0,0,0,0,-1,0,0,0.2,-0.2,-0.4,-0.2,-0.15,C_Ug +980,R_70JVQdKTDYuklKp,32 - 38,American,Male,-2,1,1,1,-1,-2,-1,2,1,1,0,-2,2,-1,2,1,-1,0,-1,-2,-2,1,1,1,-1,4,-2,-1,2,0,1,3,1,-1,1,0,1,6,2,1,1,1,-1,7,-1,1,1,1,-1,2,-1,-1,2,0,1,4,-1,-2,2,-1,2,2,1,0,0,1,-2,6,FALSE,1,95,TRUE,1,75,TRUE,0,70,FALSE,1,55,TRUE,1,90,TRUE,0,60,TRUE,1,75,TRUE,1,75,TRUE,1,80,TRUE,1,65,FALSE,1,55,FALSE,1,90,TRUE,1,60,FALSE,1,65,FALSE,0,55,TRUE,1,90,TRUE,0,65,TRUE,0,80,FALSE,1,60,FALSE,1,100,TRUE,1,75,TRUE,1,85,FALSE,1,100,TRUE,1,65,FALSE,1,80,TRUE,1,75,FALSE,1,55,FALSE,1,65,TRUE,0,65,TRUE,1,70,FALSE,0,60,TRUE,1,75,0.0625,0.0625,0.01,0.0625,0.0625,0.36,0.1225,0.1225,0,0.0225,0.09,0.16,0.04,0.2025,0.01,0.0625,0,0.2025,0.1225,0.04,0.0625,0.3025,0.16,0.1225,0.4225,0.2025,0.36,0.0025,0.49,0.64,0.4225,0.01,0.172053571,0.104107143,0.24,25,78.13,25,78.13,6,75,5,62.5,7,87.5,7,87.5,14,87.5,11,68.75,72.81,61.88,73.75,77.5,78.12,73.12,72.5,0,-5.32,-13.12,11.25,-10,-9.38,-14.38,3.75,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,2,1,2,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,2,0,0,0.2,1,1.4,0.2,0.4,0.2,0.6,0.65,0.35,4.33,2.67,2,-1,4,1,1.66,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,37,1.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,01ITEM,01DIR,-1,0,0,0,0,-1,0,0,0,0,0,1,1,1,1,1,1,1,0,1,-0.2,-0.2,0.8,0.8,0.3,C_Ug +981,R_5rPbbE9CjOffOO5,25 - 31,American,Male,2,2,3,1,2,0,0,0,-1,1,0,1,3,1,2,-1,0,-1,-2,-3,-1,2,3,2,2,0,-1,-1,-1,1,-1,1,1,2,0,-1,0,2,-3,-2,-2,-2,-3,3,2,2,2,2,2,4,0,-1,1,0,1,1,0,2,3,1,2,0,2,2,2,2,0,10,FALSE,1,100,TRUE,1,93,TRUE,0,77,TRUE,0,61,TRUE,1,71,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,77,TRUE,1,83,FALSE,1,71,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,72,TRUE,0,93,FALSE,1,71,TRUE,0,61,TRUE,1,51,TRUE,1,100,FALSE,1,92,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,61,FALSE,1,100,TRUE,0,69,TRUE,1,83,FALSE,0,71,TRUE,1,91,0,0,0,0.0324,0.0081,0,0,0.0289,0.3721,0,0.0289,0,0.0529,0.0841,0.0841,0.0049,0.0064,0.3721,0,0,0.2401,0.0841,0.0841,0,0.5184,0.1521,0.5041,0,0.5929,0.8649,0.4761,1,0.198546429,0.074464286,0.322628571,16,50,24,75,6,75,6,75,7,87.5,5,62.5,15,93.75,9,56.25,84.41,72,80.75,94.75,90.12,85.81,83,-25,9.41,-3,5.75,7.25,27.62,-7.94,26.75,3,0,0,1,0,1,1,1,2,2,1,1,3,2,2,2,2,1,0,0,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,3,2,3,4,3,0.8,1.4,1.8,1,0.4,0.6,0.2,3,1.25,1.05,1,1.67,-4,0,2,-7,-0.67,10 cents,5 minutes,24 days,Male,Trade School (non-military),30,0.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,3,0,-1,0,0,1,0,0,1,2,1,0,3,2,2,-1,0,-2,-4,-3,0.4,0.8,1.6,-2,0.2,HS_TS +982,R_50oD9rRW7qLSVOW,32 - 38,American,Male,3,3,3,3,3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,2,3,-2,3,-3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,86,TRUE,0,100,TRUE,0,61,TRUE,1,100,TRUE,0,77,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,0,86,TRUE,0,100,TRUE,1,100,TRUE,0,89,TRUE,1,96,TRUE,1,100,TRUE,0,85,TRUE,0,85,TRUE,0,83,TRUE,0,82,TRUE,1,94,TRUE,1,93,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,TRUE,0,83,TRUE,0,80,TRUE,1,96,TRUE,1,58,TRUE,1,83,0,0,0,0,0.0289,0.5929,0,0,0.6724,0.0049,0.0016,0,0.0025,0.7396,0,0.0196,0.8649,0.3721,0.6889,0,0.0036,0.0016,0.6889,0.7921,0.7225,0.5776,0.1764,0,1,0.7225,0.64,1,0.368339286,0.235671429,0.501007143,32,100,18,56.25,4,50,4,50,6,75,4,50,16,100,2,12.5,90.03,80.12,89,95.88,95.12,93.81,86.25,43.75,33.78,30.12,39,20.88,45.12,-6.19,73.75,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0,1.4,0,0,0.3,0.35,10,7.33,8,0,0,0,2.67,10 cents,100 minutes,24 days,Male,High School (or equivalent),37,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,0,5,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,-0.2,0,0,-0.05,HS_TS +983,R_6DOyq2DXNKHvkSw,46 - 52,American,Male,3,1,3,-1,3,2,-2,2,-2,1,2,1,2,-1,3,1,0,1,0,-1,-1,2,1,-2,3,5,2,-2,3,-2,2,2,2,2,2,-2,3,2,1,1,1,2,-1,7,3,2,2,-2,3,1,3,-3,3,-3,3,1,2,2,2,-3,3,1,1,0,2,2,0,3,TRUE,0,86,TRUE,1,55,TRUE,0,100,TRUE,0,51,TRUE,1,80,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,57,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,88,TRUE,0,91,FALSE,0,61,TRUE,1,100,FALSE,1,68,TRUE,0,100,FALSE,1,59,FALSE,1,71,FALSE,0,100,TRUE,1,71,TRUE,0,88,TRUE,1,59,TRUE,0,96,FALSE,0,91,FALSE,1,62,FALSE,1,96,TRUE,0,66,TRUE,1,86,TRUE,1,82,TRUE,1,91,0,0.8281,0,0.0081,0.0081,0,0.1681,1,0.0841,0.0841,0.0196,0.0144,0.1849,0,0.04,0.2025,0.7744,0.2601,0.0016,0.9216,1,0.3721,0.1681,0.8281,0.1024,0.1444,0.0324,0.7396,1,1,0.4356,1,0.378078571,0.202878571,0.553278571,17,53.13,19,59.38,6,75,5,62.5,2,25,6,75,12,75,7,43.75,82.69,65.88,85.12,90.75,89,82,83.38,-6.25,23.31,-9.12,22.62,65.75,14,7,39.63,4,1,2,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,2,0,0,1,1,1,0,1,1,1,1,2,0,1,0,2,0,0,0,1,2,1,1.6,0.4,0.4,0.6,0.6,1.2,0.6,0.8,0.75,0.8,3,1,4,1,1,4,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,52,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,4,0,1,0,0,-1,-1,0,-1,-1,0,0,0,-1,0,0,1,-1,0,-1,1,-0.8,-0.2,-0.2,-0.05,C_Ug +984,R_132nTZp6t0IpNeS,25 - 31,American,Male,-2,2,2,1,2,-1,-1,1,1,2,1,1,2,2,3,-3,-3,-2,-1,-2,-2,3,2,-1,2,3,0,0,0,0,0,5,3,0,3,3,3,4,0,0,0,0,0,0,-3,2,2,1,2,2,-2,-1,2,1,1,2,3,3,2,2,3,2,-1,-3,-1,-1,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0.178571429,0.071428571,0.285714286,31,96.88,27,84.38,6,75,7,87.5,7,87.5,7,87.5,12,75,15,93.75,100,100,100,100,100,100,100,12.5,15.62,25,12.5,12.5,12.5,25,6.25,0,1,0,2,0,1,1,1,1,2,2,1,1,1,0,3,3,2,1,2,1,0,0,0,0,1,0,1,0,1,2,2,0,0,0,2,0,1,0,1,0.6,1.2,1,2.2,0.2,0.6,0.8,0.8,1.25,0.6,4,2,1,3,2,0,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,28,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,-1,1,0,2,0,0,1,0,1,1,0,-1,1,1,0,1,3,1,1,1,0.4,0.6,0.2,1.4,0.65,C_Ug +985,R_1jpGmGiqzWyZRy0,39 - 45,American,Male,2,3,-2,-2,1,-2,1,-1,1,-1,-1,-3,3,-2,2,-3,-3,-3,0,-3,3,3,-2,1,1,1,-2,1,-1,1,1,1,-2,-3,3,-2,2,0,0,1,1,1,-3,7,3,3,-2,1,1,0,-2,1,-1,1,1,1,-1,-3,3,-2,2,1,-3,-2,-3,-2,-3,1,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,80,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,FALSE,1,70,FALSE,0,50,TRUE,1,95,TRUE,0,65,TRUE,0,75,TRUE,0,60,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,95,TRUE,1,80,FALSE,0,60,TRUE,1,70,0.0025,0,0.0025,0,0.09,0,0.01,0,0,0,0.04,0.01,0.04,0.25,0.0025,0.0225,0.36,0.25,0,0,0.04,0.25,0.36,0.09,0.4225,0.25,0.36,0,0,0.5625,0.9025,1,0.189732143,0.076785714,0.302678571,28,87.5,24,75,5,62.5,5,62.5,7,87.5,7,87.5,14,87.5,10,62.5,82.66,60.62,81.88,93.12,95,85.62,79.69,12.5,7.66,-1.88,19.38,5.62,7.5,-1.88,17.19,1,0,0,3,0,0,0,0,0,2,1,0,0,0,0,3,4,4,1,0,1,0,0,3,0,0,0,0,0,2,0,0,0,0,0,0,1,0,2,0,0.8,0.4,0.2,2.4,0.8,0.4,0,0.6,0.95,0.45,0.67,0.67,1,0,-1,6,0,10 cents,100 minutes,47 days,Male,High School (or equivalent),39,1.875,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,3,3,4,-1,0,0,0,0.2,1.8,0.5,HS_TS +986,R_5WxvAQUGMBVUqZE,46 - 52,American,Male,1,2,3,2,2,1,-3,2,-3,1,3,2,2,1,3,1,1,2,2,1,2,2,3,2,2,0,2,-3,2,-3,2,0,3,2,2,1,3,0,2,1,2,2,2,2,2,2,3,2,2,1,2,-3,2,-3,1,0,3,2,2,2,3,1,2,1,2,2,1,2,FALSE,1,60,TRUE,1,100,TRUE,0,98,FALSE,1,50,FALSE,0,50,TRUE,0,65,TRUE,1,92,TRUE,1,92,TRUE,1,92,FALSE,0,93,FALSE,1,50,TRUE,0,95,TRUE,1,57,TRUE,0,77,TRUE,1,50,TRUE,1,77,TRUE,0,50,FALSE,1,77,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,65,TRUE,0,84,TRUE,1,91,FALSE,1,59,FALSE,1,92,TRUE,0,74,TRUE,1,93,TRUE,1,91,TRUE,1,99,0.0064,0.0081,0.0529,0.0064,0.0001,0.4225,0.1225,0.8649,0,0.25,0.0049,0.1849,0.0064,0.25,0.25,0,0.25,0.25,0.0064,0.7056,0.25,0.25,0.25,0.5929,0.25,0.1681,0.0081,0.16,0.9604,0.0529,0.5476,0.9025,0.284310714,0.204014286,0.364607143,16,50,21,65.63,8,100,3,37.5,4,50,6,75,13,81.25,8,50,74.16,67.75,61.88,78,89,77.62,70.69,-15.63,8.53,-32.25,24.38,28,14,-3.63,20.69,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.2,0.4,0,0.4,0.2,0.2,0.2,0.2,0.25,0.2,0,0.67,-1,0,-1,0,-0.67,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,51,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,1,0,0.2,-0.2,0.2,0.05,C_Ug +987,R_6I6RwbbZOOms5xI,39 - 45,American,Male,2,2,2,2,1,2,3,2,1,2,1,3,1,2,2,1,2,2,2,1,2,2,1,2,1,9,0,1,2,2,1,7,2,2,1,0,1,9,1,2,1,2,2,9,2,2,2,1,0,9,0,1,2,2,1,9,2,3,1,1,1,8,1,2,3,2,1,8,TRUE,0,50,FALSE,0,50,TRUE,0,50,FALSE,1,55,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,52,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,0,73,TRUE,1,59,TRUE,1,60,0.25,0.25,0.25,0.25,0.16,0.25,0.25,0.2304,0.25,0.25,0.5329,0.25,0.25,0.25,0.25,0.25,0.25,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1681,0.25,0.25,0.25,0.25,0.25,0.251567857,0.258985714,0.24415,28,87.5,18,56.25,6,75,5,62.5,3,37.5,4,50,11,68.75,7,43.75,51.53,51.75,51.25,50.25,52.88,52.75,50.31,31.25,-4.72,-23.25,-11.25,12.75,2.88,-16,6.56,0,0,1,0,0,2,2,0,1,1,1,1,0,2,1,0,0,1,0,1,0,0,0,1,1,2,2,0,1,1,1,0,0,1,1,0,0,1,0,0,0.2,1.2,1,0.4,0.4,1.2,0.6,0.2,0.7,0.6,8.33,8.67,0,-2,1,1,-0.34,15 cents,75 minutes,24 days,Male,University - Graduate (Masters),44,-0.375,0,0,0,0,0,1,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,1,-1,-1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,-0.2,0,0.4,0.2,0.1,grad_prof +988,R_1XWui7pnTtQMTm1,32 - 38,American,Male,3,3,2,1,3,3,-1,2,-1,1,3,1,3,-1,3,-1,-2,1,-2,-1,3,3,2,2,3,5,3,-3,3,-3,3,5,3,2,3,-1,3,6,-1,-3,1,-2,-1,9,3,3,2,2,3,6,3,-3,3,-2,3,7,3,1,3,-1,3,5,2,2,2,2,-1,8,FALSE,1,99,TRUE,1,80,FALSE,1,88,FALSE,1,86,TRUE,1,100,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,0,82,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0036,0,0,0.6724,0,0.01,0.8464,0.0004,0,0,0.04,0,0.0196,1,0,0,0,0,0,1,0,0,0.0001,0.0144,0,0,1,0.164532143,0.113742857,0.215321429,29,90.63,27,84.38,8,100,6,75,8,100,5,62.5,15,93.75,12,75,97.16,95.5,98.25,99.88,95,97.5,96.81,6.25,12.78,-4.5,23.25,-0.12,32.5,3.75,21.81,0,0,0,1,0,0,2,1,2,2,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,2,1,1,2,0,0,0,0,0,3,4,1,4,0,0.2,1.4,0.2,0.2,0.2,1.2,0,2.4,0.5,0.95,5.33,6,-1,-2,1,1,-0.67,5 cents,5 minutes,24 days,Male,University - Undergraduate,33,1.25,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,-3,-3,-1,-4,0,0,0.2,0.2,-2.2,-0.45,C_Ug +989,R_5QtmX2yqA5EsiEq,32 - 38,American,Male,3,3,3,2,2,3,2,3,-3,2,3,1,3,3,3,3,3,3,3,2,1,3,3,3,2,10,3,1,3,3,2,10,2,3,3,3,2,10,3,1,3,3,2,10,2,3,2,3,3,10,3,3,2,1,3,10,3,1,3,3,3,10,3,3,1,2,3,10,FALSE,1,95,TRUE,1,98,FALSE,1,90,FALSE,1,85,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,95,TRUE,0,100,FALSE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,100,TRUE,1,100,FALSE,0,90,0,0,0,0,0.81,0,0,0,0,0,1,1,0.0025,0,0,0.0004,0,0.0225,0,0.01,0,0,0.0025,0,0.0025,0,0,0.0025,0.01,1,0.01,0.01,0.138675,0.202528571,0.074821429,30,93.75,28,87.5,8,100,6,75,7,87.5,7,87.5,13,81.25,15,93.75,97.28,96.62,96.88,98.12,97.5,98.94,95.62,6.25,9.78,-3.38,21.88,10.62,10,17.69,1.87,2,0,0,1,0,0,1,0,6,0,1,2,0,0,1,0,2,0,0,0,1,0,1,1,1,0,1,1,4,1,0,0,0,0,0,0,0,2,1,1,0.6,1.4,0.8,0.4,0.8,1.4,0,0.8,0.8,0.75,10,10,0,0,0,0,0,5 cents,5 minutes,47 days,Male,University - PhD,33,0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,1,0,-1,0,-1,0,0,-1,2,-1,1,2,0,0,1,0,2,-2,-1,-1,-0.2,0,0.8,-0.4,0.05,grad_prof +990,R_7MyBVy2Q21iHRZn,39 - 45,American,Male,3,1,2,2,0,0,1,2,1,1,2,2,3,2,3,-2,-3,-2,0,-3,3,1,3,2,0,3,-1,1,2,1,2,4,2,2,3,2,3,1,-2,-2,-2,-3,-3,5,3,2,3,2,1,2,1,-2,2,-2,2,5,2,2,3,3,2,3,3,-3,3,3,-2,9,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0.142857143,0,0.285714286,32,100,28,87.5,8,100,7,87.5,7,87.5,6,75,16,100,12,75,100,100,100,100,100,100,100,12.5,12.5,0,12.5,12.5,25,0,25,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,3,0,0,1,1,0,1,1,3,0,3,1,0,0,0,1,1,5,0,5,3,1,0.2,0.4,0,0.8,0.6,1.6,0.4,2.8,0.35,1.35,2.67,3.33,1,-1,-2,-4,-0.66,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),42,1.5,1,0,1,0,1,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,0,-1,0,0,-1,0,-3,0,-3,0,0,0,0,-1,-1,-5,1,-5,0,-1,-0.4,-1.2,-0.4,-2,-1,grad_prof +991,R_5EzyVLZGMVzRU7F,32 - 38,American,Male,2,3,2,0,2,-1,-2,0,1,2,0,0,2,0,2,-3,-3,-3,-3,-3,2,3,0,0,2,5,-2,-2,0,0,0,6,1,0,2,0,2,5,-3,-3,-3,-3,-3,8,2,2,0,0,2,5,0,0,0,0,2,5,-1,0,0,-2,0,5,-2,-2,-2,-2,-2,5,FALSE,1,100,TRUE,1,70,TRUE,0,60,FALSE,1,64,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,60,TRUE,1,77,TRUE,1,74,TRUE,0,53,FALSE,1,50,FALSE,0,52,TRUE,0,58,FALSE,0,50,TRUE,1,58,FALSE,1,59,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,87,FALSE,1,100,TRUE,1,50,FALSE,1,74,TRUE,1,53,TRUE,0,55,FALSE,1,50,TRUE,0,54,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.16,0.2209,0.1764,0.0625,0.25,0,0.25,0.0676,0,0.0169,0.25,0.2704,0.0529,0.2809,0.01,0.09,0,0.1296,0.25,0.0676,1,0.25,0.25,0.3364,0.1681,0.3025,0.25,0,0.36,0.25,0.2916,0.25,0.203375,0.119164286,0.287585714,21,65.63,21,65.63,4,50,4,50,7,87.5,6,75,10,62.5,11,68.75,66.34,58.62,75.62,71.38,59.75,65.38,67.31,0,0.71,8.62,25.62,-16.12,-15.25,2.88,-1.44,0,0,2,0,0,1,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,1,2,0,0,1,2,0,1,0,1,0,2,2,2,1,1,1,1,1,0.4,0.8,0.2,0,0.6,0.8,1.4,1,0.35,0.95,5.33,5,0,1,0,3,0.33,10 cents,5 minutes,15 days,Male,University - Undergraduate,36,1,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,-1,0,0,0,0,-2,0,0,2,0,0,-2,-2,-2,-1,-1,-1,-1,-1,-0.2,0,-1.2,-1,-0.6,C_Ug +992,R_6SpHjdxlfnt9ea5,32 - 38,American,Male,3,3,3,3,3,3,-2,3,-1,0,1,-1,3,1,3,0,1,2,2,0,3,1,3,1,3,6,3,0,3,-1,1,7,1,1,3,2,3,9,0,0,0,-1,0,7,3,3,3,3,3,9,1,0,1,0,1,9,3,0,3,1,3,8,3,3,3,3,0,8,FALSE,1,93,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,FALSE,1,92,FALSE,1,95,FALSE,0,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,1,90,FALSE,1,88,TRUE,1,100,TRUE,1,100,FALSE,1,86,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,90,FALSE,1,90,FALSE,1,90,FALSE,0,100,TRUE,1,100,TRUE,1,100,0.0025,0,0,0,0,0.0064,0,0,0.0144,0,1,1,0,0.0064,0,0,0.0196,1,0.01,0.0025,0,0,0.01,0.0025,0.0036,0.01,0,0.0049,0.0036,1,0.01,0.0025,0.146657143,0.217628571,0.075685714,30,93.75,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,96.22,96.5,95.25,97.88,95.25,99.69,92.75,6.25,8.72,9,7.75,10.38,7.75,12.19,5.25,0,2,0,2,0,0,2,0,0,1,0,2,0,1,0,0,1,2,3,0,0,0,0,0,0,2,2,2,1,1,2,1,0,0,0,3,2,1,1,0,0.8,0.6,0.6,1.2,0,1.6,0.6,1.4,0.8,0.9,7.33,8.67,-3,-2,1,-1,-1.34,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,1.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,2,0,2,0,-2,0,-2,-1,0,-2,1,0,1,0,-3,-1,1,2,0,0.8,-1,0,-0.2,-0.1,grad_prof +993,R_7QAPX4pUQYDqIST,18 - 24,American,Male,2,3,3,0,2,2,-3,3,-3,3,3,3,3,0,3,3,3,3,2,3,3,3,3,0,2,4,2,-3,3,-3,2,4,3,3,3,0,3,4,3,1,2,2,3,4,3,3,3,2,3,5,3,-3,3,-3,2,6,3,3,3,0,3,6,3,3,3,2,3,5,FALSE,1,57,TRUE,1,64,FALSE,1,64,FALSE,1,100,FALSE,0,50,TRUE,0,67,FALSE,0,50,TRUE,1,100,FALSE,0,64,TRUE,1,100,FALSE,1,100,TRUE,0,69,FALSE,0,62,FALSE,1,52,FALSE,0,62,FALSE,0,59,FALSE,1,60,TRUE,0,100,FALSE,1,57,FALSE,1,100,TRUE,1,64,FALSE,0,65,FALSE,1,66,TRUE,1,58,FALSE,1,85,TRUE,1,100,TRUE,0,54,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,0,53,FALSE,0,100,0,0,0.3481,0.25,1,0.4489,0.1764,0,0,0.4225,0,0.3844,0.4096,0,0.25,0.1296,0.1156,0,0,0.0225,0.1296,0.3844,0.1849,0.2304,0.16,0.2916,0.2809,0.1849,0.1296,1,0.3364,0.4761,0.255296429,0.238357143,0.272235714,20,62.5,18,56.25,4,50,3,37.5,5,62.5,6,75,7,43.75,11,68.75,73.12,69.25,65.88,76.12,81.25,71.94,74.31,6.25,16.87,19.25,28.38,13.62,6.25,28.19,5.56,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,1,0,0,2,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,0.6,0.8,0.4,0,0,0.25,0.3,4,5.67,-1,-2,-2,-1,-1.67,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),23,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,2,1,0,0,-0.6,-0.2,0,0.6,-0.05,grad_prof +994,R_62f44m0U1ZadJSw,25 - 31,American,Male,3,2,3,2,2,3,3,3,3,3,3,3,3,0,2,3,3,3,3,3,2,2,2,2,2,10,2,2,2,0,3,10,2,2,0,2,2,10,2,3,3,2,3,10,3,2,3,2,3,5,2,2,2,-2,3,5,3,3,3,3,2,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,0,70,TRUE,1,100,FALSE,1,55,FALSE,0,57,TRUE,1,100,FALSE,0,63,TRUE,1,100,TRUE,0,100,FALSE,1,70,FALSE,0,100,TRUE,0,79,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,0,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0.3249,0,0.2025,0,0,0.25,0,0,1,0.3969,1,0,0.25,0.25,0.49,1,1,1,1,0.25,0.6241,0.25,0.25,1,0,0.25,1,1,0.09,0.448339286,0.274242857,0.622435714,16,50,17,53.13,3,37.5,5,62.5,4,50,5,62.5,10,62.5,7,43.75,82.62,72.88,81.88,92,83.75,91.88,73.38,-3.13,29.49,35.38,19.38,42,21.25,29.38,29.63,1,0,1,0,0,1,1,1,3,0,1,1,3,2,0,1,0,0,1,0,0,0,0,0,1,1,1,1,5,0,0,0,0,3,0,0,0,0,0,0,0.4,1.2,1.4,0.4,0.2,1.6,0.6,0,0.85,0.6,10,6.67,5,5,0,0,3.33,20 cents,100 minutes,24 days,Male,University - Undergraduate,26,0.5,0,0,0,0,1,1,0,0.67,04LPfPsV,02COC,02FUT,01ITEM,01DIR,1,0,1,0,-1,0,0,0,-2,0,1,1,3,-1,0,1,0,0,1,0,0.2,-0.4,0.8,0.4,0.25,C_Ug +995,R_3dTGyvdnzxdRvIB,39 - 45,Canadian,Male,3,2,1,1,1,0,-2,1,-1,1,1,1,1,0,3,-1,1,1,1,1,1,0,1,1,2,7,-1,1,0,1,0,5,1,1,2,0,1,3,-2,-2,-1,-2,-2,9,2,3,3,3,2,1,-2,-3,2,1,1,4,1,3,2,-1,2,3,-1,0,-1,-2,-1,7,FALSE,1,88,FALSE,0,93,TRUE,0,82,FALSE,1,80,TRUE,1,66,FALSE,1,100,FALSE,0,68,FALSE,0,84,FALSE,0,55,FALSE,0,95,FALSE,1,91,TRUE,0,83,TRUE,1,75,FALSE,1,100,FALSE,0,100,FALSE,0,70,TRUE,0,87,FALSE,1,88,TRUE,0,84,FALSE,1,68,TRUE,1,100,FALSE,0,80,FALSE,1,76,TRUE,1,100,TRUE,0,74,TRUE,1,100,FALSE,1,63,FALSE,1,91,TRUE,0,74,TRUE,1,81,FALSE,0,67,TRUE,1,79,0.7056,0,0.49,0.4624,0.0441,0,0,0.9025,0.1024,0.64,0.0361,0.0625,0.3025,0.0081,0.1156,0.8649,0.0576,0.04,0.0081,0.5476,0,1,0.7056,0,0.7569,0.1369,0.4489,0.0144,0.6724,0.0144,0.5476,0.6889,0.311357143,0.226878571,0.395835714,21,65.63,17,53.13,3,37.5,6,75,4,50,4,50,7,43.75,10,62.5,82.56,79.12,82.12,86.62,82.38,82.06,83.06,12.5,29.43,41.62,7.12,36.62,32.38,38.31,20.56,2,2,0,0,1,1,3,1,2,1,0,0,1,0,2,1,3,2,3,3,1,1,2,2,1,2,1,1,2,0,0,2,1,1,1,0,1,2,3,2,1,1.6,0.6,2.4,1.4,1.2,1,1.6,1.4,1.3,5,2.67,6,1,0,2,2.33,10 cents,5 minutes,47 days,Male,University - Undergraduate,39,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,1,1,-2,-2,0,-1,2,0,0,1,0,-2,0,-1,1,1,2,0,0,1,-0.4,0.4,-0.4,0.8,0.1,C_Ug +996,R_5OkLALUWGKdFYrn,39 - 45,Canadian,Male,-3,2,2,1,-3,-3,1,1,2,0,3,0,-1,0,3,0,1,-1,-2,-3,-3,3,-1,-1,-3,1,-3,-1,1,1,-1,1,1,-2,-1,-1,1,5,0,2,2,0,-2,7,-3,3,2,2,-2,0,-3,0,2,2,-1,0,3,0,2,2,2,1,2,2,2,2,0,1,FALSE,1,87,FALSE,0,82,TRUE,0,100,TRUE,0,87,TRUE,1,80,FALSE,1,89,TRUE,1,100,FALSE,0,84,FALSE,0,51,TRUE,1,100,FALSE,1,55,TRUE,0,100,TRUE,1,86,FALSE,1,85,FALSE,0,59,TRUE,1,85,TRUE,0,76,TRUE,0,100,FALSE,1,62,FALSE,1,100,FALSE,0,51,FALSE,0,54,FALSE,1,52,FALSE,0,53,FALSE,1,100,FALSE,0,100,TRUE,0,91,TRUE,0,100,FALSE,1,65,TRUE,1,82,FALSE,0,82,TRUE,1,100,0.7056,1,0.0225,0,0,0.0121,0.2809,0,0,0.2916,0.0324,0.0196,0.2601,0.2025,0.04,0.6724,0.2304,0.7569,1,0,0.2601,0.3481,0.1444,0.0225,0.5776,0.8281,0.6724,0.0169,1,1,0.1225,1,0.349696429,0.199921429,0.499471429,8,25,16,50,2,25,6,75,5,62.5,3,37.5,7,43.75,9,56.25,81.19,71.12,74.88,90.75,88,78.06,84.31,-25,31.19,46.12,-0.12,28.25,50.5,34.31,28.06,0,1,3,2,0,0,2,0,1,1,2,2,0,1,2,0,1,3,2,1,0,1,0,1,1,0,1,1,0,1,0,0,3,2,1,2,1,3,4,3,1.2,0.8,1.4,1.4,0.6,0.6,1.2,2.6,1.2,1.25,2.33,0.33,1,1,4,6,2,10 cents,5 minutes,15 days,Male,High School (or equivalent),39,1,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,3,1,-1,0,1,-1,1,0,2,2,-3,-1,1,-2,0,0,-2,-2,0.6,0.2,0.2,-1.2,-0.05,HS_TS +997,R_5dhs4Es7Ep0gGwt,39 - 45,American,Female,2,2,2,2,-3,-2,0,1,0,1,0,-1,2,0,2,-3,-3,-3,-3,-3,2,2,2,2,-3,2,-1,0,1,0,1,2,0,-1,1,1,1,2,-3,-3,-3,-3,-3,2,2,2,2,2,-3,5,-3,0,1,0,1,2,0,-1,1,-1,1,2,-3,-3,-3,-3,-3,2,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,58,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,57,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,58,TRUE,0,57,TRUE,1,60,FALSE,1,60,TRUE,1,57,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,63,TRUE,1,50,0.1764,0.1849,0.25,0.25,0.25,0.25,0.16,0.25,0.25,0.1764,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.25,0.25,0.16,0.25,0.25,0.25,0.25,0.25,0.25,0.1369,0.25,0.25,0.3249,0.25,0.25,0.242253571,0.243664286,0.240842857,9,28.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,16,100,3,18.75,52.19,51.62,50.88,54,52.25,52.88,51.5,-31.25,-7.19,-10.88,0.88,-8.5,-10.25,-47.12,32.75,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0.2,0.6,0,0,0.2,0.6,0,0.2,0.2,2,3,-3,0,0,0,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),39,1.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +998,R_1SbmUbaWtqakKk1,39 - 45,American,Female,1,3,3,3,-3,-3,0,1,1,-3,3,3,3,0,3,1,1,1,1,1,3,3,3,3,-3,0,-3,-3,1,-3,-3,0,1,1,1,1,1,0,1,1,1,1,1,0,3,3,3,3,-3,0,-3,-3,1,-3,1,0,1,1,1,1,1,0,1,1,1,1,1,0,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.25,1,0.25,0,0.25,0,0,0.25,0.25,0,0,0,0.25,0.25,0.25,0,0.25,1,0,0,0.25,0.25,0.25,0.25,0.25,1,1,1,1,0.25,1,0.330357143,0.125,0.535714286,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,76.56,62.5,75,75,93.75,81.25,71.88,-12.5,14.06,0,0,12.5,43.75,12.5,15.63,2,0,0,0,0,0,3,0,4,0,2,2,2,1,2,0,0,0,0,0,2,0,0,0,0,0,3,0,4,4,2,2,2,1,2,0,0,0,0,0,0.4,1.4,1.8,0,0.4,2.2,1.8,0,0.9,1.1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,40,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,-4,0,0,0,0,0,0,0,0,0,0,0,-0.8,0,0,-0.2,C_Ug +999,R_5B2M5p5U6Ucv4KH,46 - 52,American,Female,3,2,-2,-2,3,2,-2,3,-2,-2,3,2,3,1,3,3,3,3,3,3,3,2,1,-2,3,4,2,-1,3,1,-2,6,3,3,3,2,3,2,1,1,1,1,1,7,3,2,1,1,3,3,1,-2,3,-2,-2,1,3,2,3,-2,3,2,3,3,3,3,3,1,TRUE,0,70,TRUE,1,100,TRUE,0,83,FALSE,1,52,TRUE,1,100,FALSE,1,93,TRUE,1,91,TRUE,1,100,FALSE,0,56,TRUE,1,78,FALSE,1,81,TRUE,0,100,TRUE,1,100,TRUE,0,87,FALSE,0,50,TRUE,1,100,TRUE,0,84,FALSE,1,83,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,87,FALSE,1,100,TRUE,1,91,TRUE,0,100,TRUE,1,87,FALSE,1,50,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,0,56,TRUE,1,100,0,0.0169,0,0.0081,0,0.0049,0.0081,0.0484,0.25,0.0169,0.25,0,0.3136,0.0361,0,0,0,0.2304,0.25,1,0.25,0.25,0.25,0.7569,0.7056,0.25,0.3136,0.49,0.6889,0.0289,1,1,0.299725,0.082742857,0.516707143,17,53.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,11,68.75,9,56.25,79.03,61.88,90.88,85.38,78,81,77.06,-9.37,16.53,-0.62,28.38,22.88,15.5,12.25,20.81,0,0,3,0,0,0,1,0,3,0,0,1,0,1,0,2,2,2,2,2,0,0,3,3,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0.6,0.8,0.4,2,1.2,0.2,0.6,0,0.95,0.5,4,2,1,5,0,6,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),50,1.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-3,0,-1,1,0,3,0,0,1,0,-2,0,2,2,2,2,2,-0.6,0.6,-0.2,2,0.45,grad_prof +1000,R_52Lyabi3ByuaRHU,39 - 45,American,Female,0,3,3,-1,1,-3,-2,3,-1,-1,3,1,3,-2,3,1,1,1,1,-1,2,3,3,0,2,2,-3,-2,3,-1,-1,2,3,1,3,-1,3,0,1,1,1,2,-1,3,1,1,2,1,2,0,-2,-1,1,-2,1,1,3,1,2,-1,3,3,2,3,3,2,2,2,TRUE,0,85,FALSE,0,50,TRUE,0,92,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,78,TRUE,1,99,FALSE,0,50,TRUE,1,60,FALSE,1,50,TRUE,0,87,TRUE,1,58,TRUE,0,89,TRUE,1,50,TRUE,1,56,TRUE,0,59,TRUE,0,70,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,79,TRUE,1,85,FALSE,1,76,TRUE,1,57,TRUE,0,50,FALSE,1,72,TRUE,0,57,FALSE,0,50,FALSE,0,51,TRUE,1,77,0.0001,0.1849,0.1936,0.0484,0.0529,0,0.0225,0.16,0.25,0.25,0.25,0.1764,0.25,0.25,0.25,0.25,0.0441,0.25,0.0784,0.0576,0.25,0.25,0.25,0.7921,0.3481,0.25,0.2601,0.7225,0.8464,0.49,0.3249,0.7569,0.290460714,0.175421429,0.4055,16,50,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,65.22,50.12,66.25,70.62,73.88,60.69,69.75,-9.38,5.84,0.12,3.75,8.12,11.38,-8.06,19.75,2,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,2,1,2,1,1,1,2,1,2,0,0,1,1,0,1,2,2,1,3,0.8,0,0.2,0.2,1.4,1.4,0.4,1.8,0.3,1.25,1.33,1.33,2,1,-3,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,42,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,1,-2,-1,-1,0,-1,-1,-2,-1,-2,0,0,-1,0,0,-1,-2,-2,0,-3,-0.6,-1.4,-0.2,-1.6,-0.95,C_Ug +1001,R_60y1sHUREAIPW25,39 - 45,Canadian,Male,2,3,3,1,2,2,0,3,-2,2,2,3,3,1,3,1,1,2,1,1,2,3,2,1,2,1,2,0,2,-2,2,1,2,3,2,1,2,1,1,2,2,2,1,2,2,3,2,1,1,1,2,0,3,-2,2,7,3,3,3,1,2,1,2,2,2,2,2,2,TRUE,0,50,TRUE,1,58,FALSE,1,83,TRUE,0,86,TRUE,1,54,FALSE,1,66,TRUE,1,50,TRUE,1,58,FALSE,0,79,TRUE,1,76,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,65,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,0.1764,0.25,0.25,0.25,0.25,0.1156,0.25,0.0576,0.25,0.25,0.25,0.25,0.6241,0.25,0.2116,0.1764,0.25,0.7396,0.25,0.25,0.25,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.0289,0.25,0.25,0.25,0.252725,0.28035,0.2251,25,78.13,24,75,6,75,5,62.5,6,75,7,87.5,13,81.25,11,68.75,55.47,59.12,52.5,55.12,55.12,54.69,56.25,3.13,-19.53,-15.88,-10,-19.88,-32.38,-26.56,-12.5,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1,0.2,0.2,0.4,0.4,0.4,0,0.4,0.8,0.3,0.4,1,3,0,-6,0,0,-2,5 cents,5 minutes,47 days,Male,University - PhD,43,0.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,0,0,0,-1,0,0,1,0,0,-1,0,1,0,0,-1,0,0,0,-1,-0.2,0.2,0,-0.4,-0.1,grad_prof +1002,R_306qNPdQLqQWswA,46 - 52,American,Female,3,2,1,0,-3,-3,-1,0,0,0,3,-1,0,1,0,0,0,0,0,0,0,0,0,0,-3,4,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,-3,6,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,69,TRUE,0,100,TRUE,0,71,FALSE,0,55,TRUE,0,86,TRUE,1,76,FALSE,0,70,FALSE,0,60,TRUE,1,89,FALSE,1,58,TRUE,0,82,TRUE,1,56,FALSE,1,65,TRUE,1,63,FALSE,0,56,FALSE,1,57,TRUE,0,73,TRUE,0,60,FALSE,1,56,TRUE,1,83,FALSE,0,68,TRUE,0,71,FALSE,0,64,TRUE,0,87,TRUE,1,97,FALSE,1,53,TRUE,0,75,TRUE,0,78,TRUE,1,84,TRUE,1,60,TRUE,1,100,0.49,0.0009,0.3136,0.0576,0,0.7396,0.4096,0.0121,0.1936,0.4624,0.0256,0.1936,0.36,0.1764,0.3025,0.0961,0.5041,0.5041,0.5625,0.7569,0.0289,0.1369,0.36,0.1225,0.1849,0.2209,0.16,1,1,0.5329,0.6084,0.6724,0.368817857,0.284264286,0.453371429,14,43.75,15,46.88,5,62.5,4,50,4,50,2,25,10,62.5,5,31.25,72.56,61.75,73.25,81.88,73.38,71.88,73.25,-3.13,25.68,-0.75,23.25,31.88,48.38,9.38,42,3,2,1,0,0,3,1,0,0,0,3,1,0,1,0,0,0,0,0,0,3,2,1,0,0,3,1,0,0,0,3,1,0,1,0,0,0,0,0,0,1.2,0.8,1,0,1.2,0.8,1,0,0.75,0.75,5,6,-2,-1,0,1,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,0.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +1003,R_7DJ8cRP3DHtga9x,46 - 52,American,Female,3,3,1,-3,3,-2,-1,3,0,2,0,-1,3,-1,3,1,2,1,2,0,3,3,1,-3,3,2,-1,-2,3,0,2,1,-1,-2,3,-1,3,0,-2,-2,-1,-1,-1,5,3,3,1,-2,3,2,-2,-2,2,0,0,2,-1,-2,3,-1,3,1,0,0,0,1,0,4,FALSE,1,99,TRUE,1,100,TRUE,0,66,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,TRUE,0,76,TRUE,1,92,FALSE,1,87,TRUE,1,84,TRUE,1,100,TRUE,0,71,TRUE,0,100,TRUE,0,69,FALSE,1,50,FALSE,0,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,81,TRUE,0,69,FALSE,1,99,TRUE,0,99,TRUE,1,76,FALSE,0,50,TRUE,1,100,0,0.0361,0,0.0009,0,0,0,0,0.25,0.0004,0.0576,0.0064,0,0.0625,0,0,0,0.25,0.0001,0,0.25,0.0256,0.4761,0.0169,0.5041,0.4761,0.25,0.0001,0.4356,1,0.9801,0.5776,0.200685714,0.044778571,0.356592857,28,87.5,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,85.56,74.62,89,95.25,83.38,89.25,81.88,15.62,13.68,12.12,26.5,7.75,8.38,1.75,25.63,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,3,4,2,3,1,0,0,0,1,0,0,1,1,0,2,1,1,0,0,0,1,2,1,1,0,0,0.4,0.4,2.6,0.2,0.8,0.4,1,0.85,0.6,1,1.67,0,-1,-1,1,-0.67,5 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),51,1.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,-1,0,1,0,-1,0,-2,0,0,0,0,0,2,2,1,2,1,-0.2,-0.4,0,1.6,0.25,grad_prof +1004,R_33vBuSq1T7samS8,46 - 52,American,Female,2,1,1,0,2,-2,-2,2,-2,0,2,-2,2,2,3,2,0,0,0,-3,2,2,2,2,2,5,-2,0,2,0,2,8,0,1,1,1,2,7,-2,-2,-2,-2,-2,3,2,2,2,2,2,6,-2,-2,-2,-2,0,6,2,3,2,2,3,5,0,0,0,0,0,7,FALSE,1,76,FALSE,0,73,TRUE,0,96,FALSE,1,65,FALSE,0,59,FALSE,1,100,TRUE,1,91,TRUE,1,93,TRUE,1,64,TRUE,1,68,FALSE,1,73,TRUE,0,94,FALSE,0,63,TRUE,0,62,FALSE,0,68,TRUE,1,60,FALSE,1,83,TRUE,0,78,FALSE,1,67,FALSE,1,70,FALSE,0,61,FALSE,0,75,FALSE,1,71,FALSE,0,67,TRUE,0,83,TRUE,1,85,FALSE,1,68,FALSE,1,65,FALSE,1,80,TRUE,1,100,FALSE,0,83,FALSE,0,60,0.0049,0.0225,0.16,0.0081,0.36,0,0.4489,0.1024,0.09,0.5625,0,0.3969,0.1296,0.0729,0.3481,0.5329,0.0841,0.1225,0.1225,0.6889,0.3721,0.4624,0.1089,0.3844,0.0289,0.1024,0.6889,0.0576,0.9216,0.6084,0.04,0.8836,0.311478571,0.2322,0.390757143,19,59.38,18,56.25,5,62.5,4,50,4,50,5,62.5,7,43.75,11,68.75,75.03,70.12,72.12,77.25,80.62,73.12,76.94,3.13,18.78,7.62,22.12,27.25,18.12,29.37,8.19,0,1,1,2,0,0,2,0,2,2,2,3,1,1,1,4,2,2,2,1,0,1,1,2,0,0,0,4,0,0,0,5,0,0,0,2,0,0,0,3,0.8,1.2,1.6,2.2,0.8,0.8,1,1,1.45,0.9,6.67,5.67,-1,2,2,-4,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,2,-4,2,2,2,-2,1,1,1,2,2,2,2,-2,0,0.4,0.6,1.2,0.55,C_Ug +1005,R_5RTXrTAVifP2iB0,32 - 38,American,Female,1,3,0,2,2,-1,3,2,1,1,2,2,2,1,3,0,0,1,0,-1,1,3,-1,-1,3,4,0,3,3,3,3,6,2,3,3,3,3,1,3,3,3,0,3,10,2,3,0,3,3,6,0,3,3,-1,3,4,2,3,3,0,3,3,3,3,2,1,-1,10,TRUE,0,64,TRUE,1,57,TRUE,0,100,FALSE,1,67,FALSE,0,64,FALSE,1,94,TRUE,1,95,TRUE,1,83,TRUE,1,76,FALSE,0,97,FALSE,1,82,TRUE,0,73,TRUE,1,82,TRUE,0,67,TRUE,1,60,TRUE,1,66,FALSE,1,60,TRUE,0,93,FALSE,1,64,FALSE,1,100,TRUE,1,60,FALSE,0,59,TRUE,0,61,TRUE,1,53,FALSE,1,63,TRUE,1,83,FALSE,1,57,FALSE,1,74,FALSE,1,83,TRUE,1,69,FALSE,0,58,TRUE,1,50,0.0289,0.0289,0.1156,0.0025,0.25,0.0036,0.2209,0.9409,0,0.3481,0.0961,0.0324,0.0576,0.0324,0.4096,0.1849,0.3721,0.1089,0.0676,0.1369,0.16,0.16,0.1296,0.4489,0.16,0.1849,0.3364,0.4096,1,0.8649,0.0289,0.5329,0.274217857,0.218392857,0.330042857,15,46.88,22,68.75,7,87.5,6,75,3,37.5,6,75,12,75,10,62.5,72.31,65.12,69.25,77.62,77.25,69.5,75.12,-21.87,3.56,-22.38,-5.75,40.12,2.25,-5.5,12.62,0,0,1,3,1,1,0,1,2,2,0,1,1,2,0,3,3,2,0,4,1,0,0,1,1,1,0,1,2,2,0,1,1,1,0,3,3,1,1,0,1,1.2,0.8,2.4,0.6,1.2,0.6,1.6,1.35,1,3.67,4.33,-2,2,-2,0,-0.66,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,-1,0,1,2,0,0,0,0,0,0,0,0,0,1,0,0,0,1,-1,4,0.4,0,0.2,0.8,0.35,C_Ug +1006,R_7qNLAeIrEpq97X5,39 - 45,American,Female,3,3,3,3,3,-1,0,3,1,0,2,-1,3,0,3,2,1,2,3,0,3,3,3,3,3,0,0,0,3,2,1,5,3,1,3,1,3,5,0,0,-2,0,0,6,3,3,3,3,3,0,-2,-2,3,0,1,2,1,-1,3,0,3,0,3,3,3,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,77,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,99,TRUE,0,62,TRUE,0,100,TRUE,0,77,FALSE,1,51,FALSE,0,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,56,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,65,TRUE,1,100,0,0,0.0001,0,0,0,0,1,0.2401,0,0,0,0,0,0,0,0,0.25,0,1,0.3136,0.25,0.5929,0,0.3844,0.3136,0.4225,1,1,1,1,0.5929,0.334285714,0.106435714,0.562135714,28,87.5,19,59.38,4,50,5,62.5,4,50,6,75,12,75,7,43.75,88.84,74.75,89.75,100,90.88,91.88,85.81,28.12,29.46,24.75,27.25,50,15.88,16.88,42.06,0,0,0,0,0,1,0,0,1,1,1,2,0,1,0,2,1,4,3,0,0,0,0,0,0,1,2,0,1,1,1,0,0,0,0,1,2,1,0,3,0,0.6,0.8,2,0,1,0.2,1.4,0.85,0.65,3.33,0.67,0,3,5,5,2.66,5 cents,5 minutes,24 days,Female,University - Graduate (Masters),45,0.125,1,1,0,0,0,1,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,0,0,0,0,0,0,-2,0,0,0,0,2,0,1,0,1,-1,3,3,-3,0,-0.4,0.6,0.6,0.2,grad_prof +1007,R_6tYHn1xjiofoT6h,46 - 52,American,Female,3,3,2,0,3,1,-3,2,-2,2,2,0,3,0,3,1,2,2,2,0,2,3,2,-1,3,3,1,-3,2,-2,2,2,2,0,2,-2,3,2,1,1,2,1,0,7,3,3,1,1,3,3,0,-3,3,-3,2,1,2,0,3,-3,3,2,2,1,1,1,1,3,FALSE,1,100,TRUE,1,72,FALSE,1,68,FALSE,1,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,100,FALSE,1,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,80,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,73,TRUE,0,100,TRUE,1,100,TRUE,1,56,TRUE,1,100,0,0.01,0,0,0,0,0.04,1,0,0,0,0,0.0081,0,0,0.0784,0,0.1521,0.5329,0,0,0,0,0,0.04,0,0.1936,0,0.1024,0,1,0.0625,0.114642857,0.091328571,0.137957143,18,56.25,29,90.63,8,100,7,87.5,7,87.5,7,87.5,15,93.75,14,87.5,92.06,85,97.5,98.75,87,93.06,91.06,-34.38,1.43,-15,10,11.25,-0.5,-0.69,3.56,1,0,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,1,0,0,0,1,1,0,1,0,1,1,0,0,0,0,3,0,1,1,1,1,1,0.4,0,0.6,0.4,0.4,0.6,0.6,1,0.35,0.65,2.33,2,0,1,0,4,0.33,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,52,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,02REV,1,0,-1,0,0,-1,0,-1,-1,0,0,0,1,-1,0,-1,0,-1,0,-1,0,-0.6,0,-0.6,-0.3,C_Ug +1008,R_7nj844TBfQvT4C0,18 - 24,American,Female,-2,2,-3,-3,3,1,3,3,3,3,1,-2,-3,2,3,-3,-3,-3,-3,-3,-1,2,2,-2,3,4,2,3,3,-1,3,3,2,-2,-2,3,2,1,2,3,3,3,3,9,1,2,-2,1,3,2,1,3,3,-2,3,1,1,-2,2,-1,3,2,2,3,2,2,-3,9,TRUE,0,90,TRUE,1,100,TRUE,0,100,FALSE,1,53,TRUE,1,85,TRUE,0,81,TRUE,1,100,TRUE,1,99,TRUE,1,96,TRUE,1,51,FALSE,1,51,TRUE,0,93,TRUE,1,86,FALSE,1,65,TRUE,1,57,FALSE,0,51,FALSE,1,100,TRUE,0,92,FALSE,1,100,TRUE,0,51,TRUE,1,92,FALSE,0,51,TRUE,0,52,FALSE,0,51,TRUE,0,75,TRUE,1,95,TRUE,0,94,FALSE,1,100,TRUE,0,52,TRUE,1,100,TRUE,1,69,FALSE,0,50,0.0001,0.0025,0.2601,0,0.25,0.6561,0.2601,0.2401,0.2601,0.2601,0,0.0196,0.0016,0.2401,0.0225,0,0.2704,0.2209,0,0.5625,0.0064,0.1849,0,0.1225,0,0.8836,0.0961,0.81,1,0.8464,0.2704,0.8649,0.298189286,0.192971429,0.403407143,5,15.63,18,56.25,7,87.5,4,50,4,50,3,37.5,12,75,6,37.5,77.56,77.5,74.75,77.38,80.62,77.06,78.06,-40.62,21.31,-10,24.75,27.38,43.12,2.06,40.56,1,0,5,1,0,1,0,0,4,0,1,0,1,1,1,5,6,6,6,6,3,0,1,4,0,0,0,0,5,0,0,0,5,3,0,5,6,5,5,0,1.4,1,0.8,5.8,1.6,1,1.6,4.2,2.25,2.1,2.67,1.67,2,2,-1,0,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,24,1.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,-2,0,4,-3,0,1,0,0,-1,0,1,0,-4,-2,1,0,0,1,1,6,-0.2,0,-0.8,1.6,0.15,C_Ug +1009,R_36v6o7qFq7ACuwF,39 - 45,Canadian,Male,-2,2,2,0,2,-3,0,0,0,2,3,1,3,0,2,0,-1,-3,-3,-3,-2,2,2,-2,2,4,-2,0,2,-2,2,2,2,2,2,0,2,7,-3,-3,0,-2,-3,5,-2,2,2,-2,2,7,0,-2,2,-3,2,4,2,2,2,0,2,3,0,0,0,0,-2,5,TRUE,0,75,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,75,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,90,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,TRUE,1,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.09,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.25,0.25,0.25,0.25,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.259821429,0.207321429,0.312321429,8,25,17,53.13,6,75,3,37.5,3,37.5,5,62.5,8,50,9,56.25,55,50,58.12,53.12,58.75,55.31,54.69,-28.13,1.87,-25,20.62,15.62,-3.75,5.31,-1.56,0,0,0,2,0,1,0,2,2,0,1,1,1,0,0,3,2,3,1,0,0,0,0,2,0,3,2,2,3,0,1,1,1,0,0,0,1,3,3,1,0.4,1,0.6,1.8,0.4,2,0.6,1.6,0.95,1.15,4.33,4.67,-3,-2,4,0,-0.34,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,41,1.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,0,0,0,0,0,-2,-2,0,-1,0,0,0,0,0,0,3,1,0,-2,-1,0,-1,0,0.2,-0.2,C_Ug +1010,R_7PTUw4FzGaZ5mzi,32 - 38,American,Female,2,2,1,1,3,-3,-2,3,1,3,0,0,3,3,3,-3,-1,-3,-3,-3,3,3,-2,3,-2,10,0,-3,3,-3,-3,10,-2,-3,3,-1,-3,8,2,1,1,2,1,10,3,-2,-2,3,3,10,2,-3,3,-3,3,10,3,-3,3,3,3,8,3,3,3,3,3,10,TRUE,0,75,FALSE,0,50,TRUE,0,95,TRUE,0,50,TRUE,1,60,FALSE,1,90,TRUE,1,93,TRUE,1,98,FALSE,0,50,TRUE,1,56,FALSE,1,54,TRUE,0,90,FALSE,0,55,TRUE,0,70,TRUE,1,71,TRUE,1,70,TRUE,0,91,TRUE,0,94,TRUE,0,55,TRUE,0,50,TRUE,1,75,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,76,TRUE,1,75,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,65,0.0004,0.0625,0.09,0.0049,0.1225,0.01,0.25,0.1936,0.25,0.25,0,0.3025,0.25,0.2116,0.16,0.25,0.25,0.25,0.25,0.5776,0.0625,0.0841,0.3025,0.49,0.8281,0.25,0.25,0.5625,0.9025,0.8836,0.25,0.81,0.330485714,0.196442857,0.464528571,9,28.13,16,50,3,37.5,6,75,3,37.5,4,50,10,62.5,6,37.5,67.44,53.75,67,73.62,75.38,66.75,68.12,-21.87,17.44,16.25,-8,36.12,25.38,4.25,30.62,1,1,3,2,5,3,1,0,4,6,2,3,0,4,6,5,2,4,5,4,1,4,3,2,0,5,1,0,4,0,3,3,0,0,0,6,4,6,6,6,2.4,2.8,3,4,2,2,1.2,5.6,3.05,2.7,9.33,9.33,0,0,0,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),33,1.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,0,-3,0,0,5,-2,0,0,0,6,-1,0,0,4,6,-1,-2,-2,-1,-2,0.4,0.8,1.8,-1.6,0.35,HS_TS +1011,R_3P2dJHTAgH47mGE,32 - 38,American,Female,-1,2,2,3,-3,-3,-3,2,2,1,-1,-2,3,1,3,-3,-2,-2,-2,-3,2,2,2,2,1,4,-3,-3,1,3,-2,4,3,3,-3,3,3,8,-3,-3,-3,-3,-3,6,0,2,2,2,1,5,-3,-3,3,-2,2,7,-1,-2,3,-1,3,3,-1,-1,-1,-1,-1,3,TRUE,0,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,65,TRUE,1,100,TRUE,0,70,TRUE,0,100,FALSE,1,75,FALSE,1,50,TRUE,1,80,TRUE,1,100,TRUE,0,100,TRUE,1,75,FALSE,1,75,FALSE,0,100,FALSE,1,50,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,75,0,1,0,0,0.0625,0,0.0625,0,0.25,0,0,0,0,1,0.16,0.25,1,0.25,0.0625,0.0625,0.04,0.1225,0.0625,1,0.49,0.25,0.25,0.25,0,1,1,0.25,0.28125,0.216785714,0.345714286,16,50,22,68.75,5,62.5,5,62.5,4,50,8,100,13,81.25,9,56.25,81.25,67.5,85.62,90.62,81.25,84.69,77.81,-18.75,12.5,5,23.12,40.62,-18.75,3.44,21.56,3,0,0,1,4,0,0,1,1,3,4,5,6,2,0,0,1,1,1,0,1,0,0,1,4,0,0,1,4,1,0,0,0,2,0,2,1,1,1,2,1.6,1,3.4,0.6,1.2,1.2,0.4,1.4,1.65,1.05,5.33,5,-1,-3,5,3,0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),35,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,2,0,0,0,0,0,0,0,-3,2,4,5,6,0,0,-2,0,0,0,-2,0.4,-0.2,3,-0.8,0.6,grad_prof +1012,R_1VIW1mgSS6FAif9,18 - 24,American,Female,3,2,3,2,2,0,0,1,2,2,1,0,1,1,1,2,2,2,1,2,3,3,3,3,1,7,1,2,1,3,1,10,2,2,2,1,2,10,-2,-2,-1,-3,-3,10,2,3,3,2,3,10,1,1,3,0,3,10,1,3,3,2,1,10,3,3,3,3,1,10,TRUE,0,68,FALSE,0,63,TRUE,0,100,TRUE,0,66,TRUE,1,56,TRUE,0,72,TRUE,1,88,TRUE,1,60,TRUE,1,59,FALSE,0,55,TRUE,0,66,TRUE,0,100,TRUE,1,61,TRUE,0,100,TRUE,1,61,FALSE,0,56,TRUE,0,84,TRUE,0,93,TRUE,0,59,TRUE,0,57,TRUE,1,79,TRUE,1,61,FALSE,1,59,TRUE,1,59,FALSE,1,100,TRUE,1,67,FALSE,1,59,TRUE,0,87,TRUE,0,72,TRUE,1,100,TRUE,1,64,TRUE,1,100,0.16,0.1089,0.3136,0.0144,0,0.5184,0.1681,0.3025,0.3249,0.1521,0,0.1521,0.1681,0.4356,0.1936,0.3969,0.1681,0.4356,0.7569,0,0.0441,0.1521,0.3481,1,0.7056,0.1681,0.1296,0.4624,1,0.8649,0.5184,1,0.377364286,0.244,0.510728571,12,37.5,16,50,4,50,5,62.5,4,50,3,37.5,13,81.25,3,18.75,72.84,62.12,72.88,79,77.38,68.06,77.62,-12.5,22.84,12.12,10.38,29,39.88,-13.19,58.87,0,1,0,1,1,1,2,0,1,1,1,2,1,0,1,4,4,3,4,5,1,1,0,0,1,1,1,2,2,1,0,3,2,1,0,1,1,1,2,1,0.6,1,1,4,0.6,1.4,1.2,1.2,1.65,1.1,9,10,-3,0,0,0,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),23,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,-1,0,0,1,0,0,1,-2,-1,0,1,-1,-1,-1,1,3,3,2,2,4,0,-0.4,-0.2,2.8,0.55,HS_TS +1013,R_7EFdT2zk09C5KRq,32 - 38,American,Female,3,3,3,3,-1,-2,-3,3,-3,2,0,-3,3,2,2,2,2,3,2,3,3,3,3,3,-2,0,-3,-3,3,-3,1,0,0,-3,3,2,3,0,2,2,2,2,3,0,3,3,3,3,-2,0,-3,-3,3,-3,0,0,0,-3,3,2,2,0,2,2,2,2,3,0,TRUE,0,85,FALSE,0,59,TRUE,0,80,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,62,TRUE,1,50,TRUE,1,50,TRUE,1,84,TRUE,0,50,TRUE,0,100,TRUE,1,71,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,80,TRUE,0,61,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,50,TRUE,0,72,FALSE,1,50,TRUE,1,85,FALSE,0,50,TRUE,1,100,0.25,0.0576,0.25,0.1444,0,0.25,0.25,0.0256,0.25,0.25,0.0225,0.0841,0.25,0.25,0.25,0.3481,0.25,0.25,0.5184,0,0.25,0.25,0.25,0.25,0.64,0.25,0.25,0.7225,0.64,0.3721,0.25,1,0.299046429,0.195021429,0.403071429,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,62.97,51.12,62.62,71,67.12,61.69,64.25,-12.5,0.47,-11.38,-12.38,8.5,17.12,-7.06,8,0,0,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0.2,0.4,0.2,0.2,0.2,0.6,0,0.2,0.25,0.25,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,35,-1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,0,0,-0.2,0.2,0,0,C_Ug +1014,R_1Rw3ETd8Vs3nQjm,25 - 31,American,Female,3,3,3,3,2,0,-2,-1,1,1,1,1,2,2,1,-1,0,0,-1,-3,3,1,1,2,-1,4,3,-2,1,-1,1,4,2,1,1,1,1,4,-2,-1,-2,-2,-2,3,2,2,2,3,2,6,-1,1,1,3,1,6,-1,1,2,1,0,5,-2,-2,-2,-1,-2,5,FALSE,1,100,TRUE,1,79,FALSE,1,93,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,62,TRUE,1,84,TRUE,1,50,FALSE,0,73,FALSE,1,67,FALSE,1,50,TRUE,1,67,FALSE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,50,FALSE,1,64,FALSE,1,66,FALSE,1,50,TRUE,1,90,TRUE,1,96,FALSE,1,100,FALSE,0,58,FALSE,1,100,TRUE,1,88,TRUE,0,50,FALSE,1,63,TRUE,0,100,TRUE,1,78,TRUE,1,72,TRUE,1,95,0.0256,0.0144,0,0.1444,0.0025,0,0.3364,0.5329,0.25,0.0016,0.0484,0.1089,0.25,0.1089,0,0.0441,0,0.25,0.1369,0,0.01,0.2704,0.1156,0,0.25,0.25,0.0784,0,0.0049,0.1296,1,0.25,0.158196429,0.138121429,0.178271429,24,75,26,81.25,6,75,6,75,7,87.5,7,87.5,13,81.25,13,81.25,76.47,60.75,87.75,85.38,72,77.75,75.19,-6.25,-4.78,-14.25,12.75,-2.12,-15.5,-3.5,-6.06,0,2,2,1,3,3,0,2,2,0,1,0,1,1,0,1,1,2,1,1,1,1,1,0,0,1,3,2,2,0,2,0,0,1,1,1,2,2,0,1,1.6,1.4,0.6,1.2,0.6,1.6,0.8,1.2,1.2,1.05,4,5.67,-2,-2,-1,-2,-1.67,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,29,0.375,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,-1,1,1,1,3,2,-3,0,0,0,-1,0,1,0,-1,0,-1,0,1,0,1,-0.2,-0.2,0,0.15,C_Ug +1015,R_1d6tdK2seeQDtXb,32 - 38,American,Female,3,3,-1,0,0,-2,-1,1,-1,1,0,0,2,0,3,-1,-1,0,-1,-1,3,3,-1,-1,0,4,-2,1,-1,0,0,6,-1,0,2,0,3,5,-1,-1,-1,-1,-1,5,3,3,-1,0,0,5,-1,-2,1,0,0,5,0,0,3,0,3,6,0,0,0,0,-1,5,TRUE,0,100,FALSE,0,50,FALSE,1,75,TRUE,0,50,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,75,TRUE,1,97,TRUE,0,95,FALSE,0,50,TRUE,1,91,TRUE,0,82,TRUE,0,88,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,95,TRUE,1,91,FALSE,1,50,FALSE,1,98,TRUE,0,74,TRUE,1,80,FALSE,0,50,TRUE,1,88,0,0.0081,0.0081,0,0.0144,0,0.01,0.0625,0.25,0,0.04,0.0009,0.25,0.25,0.0081,0.25,0,0.25,0.0004,0.9025,1,0.25,0.25,0.9025,0.6724,0.25,0.25,1,0.0625,0.7744,0.5476,0.5625,0.314667857,0.098992857,0.530342857,17,53.13,19,59.38,3,37.5,5,62.5,4,50,7,87.5,11,68.75,8,50,79.22,50,91.5,93,82.38,81.44,77,-6.25,19.84,12.5,29,43,-5.12,12.69,27,0,0,0,1,0,0,2,2,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0.2,1.2,0.2,0.2,0,0.8,0.2,0.6,0.45,0.4,5,5.33,-1,1,-1,0,-0.33,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,1,0,-1,1,2,0,0,1,0,-1,0,0,-1,-1,1,-1,0,0.2,0.4,0,-0.4,0.05,C_Ug +1016,R_7g17tPigzefh9gq,32 - 38,American,Female,2,1,1,-1,1,-3,1,1,1,0,1,1,1,1,1,-2,0,0,0,-1,1,1,1,0,-1,4,-3,1,1,1,-1,4,1,1,1,1,1,3,-3,-2,-2,-2,-2,8,2,2,1,-1,2,4,0,0,1,1,1,2,1,0,1,1,1,3,1,1,1,1,0,8,TRUE,0,89,TRUE,1,77,TRUE,0,92,TRUE,0,50,TRUE,1,70,FALSE,1,82,TRUE,1,91,TRUE,1,94,TRUE,1,50,TRUE,1,82,FALSE,1,50,TRUE,0,85,TRUE,1,76,FALSE,1,60,TRUE,1,60,TRUE,1,82,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,71,TRUE,1,92,FALSE,1,82,TRUE,1,83,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,92,TRUE,1,50,TRUE,1,86,0.0036,0.0289,0.0324,0.0081,0.0196,0.0324,0.0064,0.0324,0.25,0.25,0.0064,0.0576,0.25,0.25,0.09,0.0529,0.0841,0.25,0.25,0.0324,0.25,0.16,0.25,0.16,0.25,0.25,0.25,0.7921,0.8464,0.25,0.25,0.7225,0.226614286,0.116557143,0.336671429,27,84.38,22,68.75,6,75,5,62.5,6,75,5,62.5,15,93.75,7,43.75,68.62,54.62,66.88,73.38,79.62,74.06,63.19,15.63,-0.13,-20.38,4.38,-1.62,17.12,-19.69,19.44,1,0,0,1,2,0,0,0,0,1,0,0,0,0,0,1,2,2,2,1,0,1,0,0,1,3,1,0,0,1,0,1,0,0,0,3,1,1,1,1,0.8,0.2,0,1.6,0.4,1,0.2,1.4,0.65,0.75,3.67,3,0,2,0,0,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,1,-1,0,1,1,-3,-1,0,0,0,0,-1,0,0,0,-2,1,1,1,0,0.4,-0.8,-0.2,0.2,-0.1,C_Ug +1017,R_7rAlOlV8H83Wb4g,32 - 38,American,Female,3,3,2,2,2,0,0,3,0,2,2,0,3,0,3,0,0,0,0,0,3,3,3,3,3,5,0,0,0,0,3,5,0,0,3,0,3,5,-3,-3,-3,-3,-3,5,3,3,3,3,3,5,0,0,3,0,3,5,0,0,3,0,3,5,0,0,0,0,0,5,FALSE,1,57,TRUE,1,59,TRUE,0,100,FALSE,1,55,TRUE,1,59,FALSE,1,56,TRUE,1,78,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,96,FALSE,1,54,TRUE,1,57,TRUE,1,58,TRUE,0,59,TRUE,0,100,TRUE,0,64,FALSE,1,100,FALSE,0,52,FALSE,0,55,FALSE,1,100,TRUE,1,58,TRUE,0,83,TRUE,1,77,FALSE,1,53,TRUE,0,57,TRUE,0,83,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0.0529,0.1764,0.0484,0,0.1936,0.1764,0,0,0.3025,0,0.0016,0,0.1849,0.1681,0.1681,0,0.2025,0.3249,0.6889,0.2704,0.1849,0.4096,0.2116,0.3481,0.2209,0.3364,0.1849,1,1,0.6889,1,0.295257143,0.099835714,0.490678571,4,12.5,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,74.53,62.88,75.62,75.5,84.12,75.44,73.62,-53.13,8.9,-12.12,13.12,13,21.62,-5.81,23.62,0,0,1,1,1,0,0,3,0,1,2,0,0,0,0,3,3,3,3,3,0,0,1,1,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0.6,0.8,0.4,3,0.6,0.2,0.4,0,1.2,0.3,5,5,0,0,0,0,0,10 cents,5 minutes,24 days,Female,Professional Degree (ex. JD/MD),37,0.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,3,3,3,3,0,0.6,0,3,0.9,grad_prof +1018,R_7LXDbn4zZiDJuc9,32 - 38,American,Female,2,3,2,3,3,2,3,3,3,2,3,2,3,2,3,2,3,3,2,3,1,2,3,3,2,4,3,3,3,2,2,3,3,2,3,2,1,3,3,3,2,3,2,9,2,2,3,3,3,5,3,3,2,3,2,7,2,3,3,3,2,5,3,2,3,2,3,6,FALSE,1,100,FALSE,0,91,TRUE,0,79,FALSE,1,77,TRUE,1,99,FALSE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,99,FALSE,1,99,TRUE,0,100,TRUE,1,83,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,91,TRUE,1,100,FALSE,0,98,TRUE,1,98,0,0,0,0,0.0004,0.0001,0.0001,0.0001,1,0,0,0.0289,0.0081,0.0001,0.0001,0.8281,1,0.0529,1,0,0,0,0,1,0,0,0.9604,0,0.6241,1,0.0081,1,0.303982143,0.208492857,0.399471429,25,78.13,23,71.88,6,75,7,87.5,6,75,4,50,14,87.5,9,56.25,96.97,94.5,96.25,99.88,97.25,97.38,96.56,6.25,25.09,19.5,8.75,24.88,47.25,9.88,40.31,1,1,1,0,1,1,0,0,1,0,0,0,0,0,2,1,0,1,1,1,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,1,0,0,0,0.8,0.4,0.4,0.8,0.4,0.4,0.8,0.4,0.6,0.5,3.33,5.67,-1,-4,-2,3,-2.34,10 cents,25 minutes,47 days,Female,High School (or equivalent),37,-0.5,0,0,1,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,1,0,0,0,1,0,0,-1,1,0,-1,-1,0,-1,1,0,-1,1,1,1,0.4,0,-0.4,0.4,0.1,HS_TS +1019,R_1aQckAe7IKkR5Sh,25 - 31,Canadian,Male,1,2,3,2,-3,-2,1,-2,2,0,1,3,1,-1,2,-1,0,-1,1,-3,2,2,2,2,0,2,-3,-1,-3,1,-3,6,1,3,0,0,2,0,-1,-1,-1,-1,-1,2,2,3,2,3,1,4,0,1,0,1,0,3,1,2,2,0,2,4,-1,-1,-1,1,-1,4,TRUE,0,73,TRUE,1,88,FALSE,1,79,FALSE,1,55,TRUE,1,62,FALSE,1,81,TRUE,1,92,TRUE,1,67,TRUE,1,84,TRUE,1,97,FALSE,1,100,FALSE,1,83,TRUE,1,53,TRUE,0,100,TRUE,1,85,TRUE,1,99,FALSE,1,100,FALSE,1,95,FALSE,1,81,FALSE,1,86,TRUE,1,100,TRUE,1,70,FALSE,1,66,TRUE,1,97,FALSE,1,74,TRUE,1,92,TRUE,0,51,FALSE,1,70,FALSE,1,83,FALSE,0,82,FALSE,0,71,TRUE,1,100,0.1089,0.0064,0.0001,0.0064,0,0.0361,0.0009,0.0009,0.0196,0.09,0.6724,0.2209,0.0256,0,0.1444,0.0144,0.1156,0.2025,0.09,0.0676,0,0.0225,0.0361,1,0,0.2601,0.5041,0.5329,0.0441,0.0025,0.0289,0.0289,0.148607143,0.110235714,0.186978571,26,81.25,27,84.38,6,75,8,100,6,75,7,87.5,14,87.5,13,81.25,81.75,76.88,80.62,86.62,82.88,83.69,79.81,-3.13,-2.63,1.88,-19.38,11.62,-4.62,-3.81,-1.44,1,0,1,0,3,1,2,1,1,3,0,0,1,1,0,0,1,0,2,2,1,1,1,1,4,2,0,2,1,0,0,1,1,1,0,0,1,0,0,2,1,1.6,0.4,1,1.6,1,0.6,0.6,1,0.95,2.67,3.67,-2,3,-4,-2,-1,5 cents,5 minutes,47 days,Male,University - Undergraduate,25,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,0,-1,0,-1,-1,-1,2,-1,0,3,0,-1,0,0,0,0,0,0,2,0,-0.6,0.6,-0.2,0.4,0.05,C_Ug +1020,R_1dXtGZIn3kCFmTt,32 - 38,American,Female,1,1,3,3,3,-1,-2,0,0,1,0,-3,1,0,3,1,1,2,3,-3,-2,3,3,-2,3,10,1,1,1,1,1,5,-3,3,3,3,-3,10,-1,-2,1,-3,3,10,3,3,3,3,3,5,0,0,2,-2,0,5,0,-3,1,0,1,4,3,3,3,3,-3,5,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,71,TRUE,0,100,TRUE,1,75,TRUE,0,50,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,100,TRUE,0,80,FALSE,1,50,TRUE,1,71,TRUE,1,50,FALSE,1,50,TRUE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,50,TRUE,0,76,TRUE,0,80,TRUE,1,100,FALSE,0,50,TRUE,1,85,0,0,0.0576,0.0576,0.0225,0,0,0,0.25,0.25,0,0.0625,0.25,0.0841,0.25,0.25,0.25,0.25,0.5776,0.7225,0.0841,0.25,0.64,0.25,0.25,0.25,0.25,0.25,0,1,0.64,1,0.288689286,0.137078571,0.4403,16,50,20,62.5,5,62.5,5,62.5,4,50,6,75,13,81.25,7,43.75,72.66,56.38,70.12,76.38,87.75,73.94,71.38,-12.5,10.16,-6.12,7.62,26.38,12.75,-7.31,27.63,3,2,0,5,0,2,3,1,1,0,3,6,2,3,6,2,3,1,6,6,2,2,0,0,0,1,2,2,2,1,0,0,0,0,2,2,2,1,0,0,2,1.4,4,3.6,0.8,1.6,0.4,1,2.75,0.95,8.33,4.67,5,0,6,5,3.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),36,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,1,0,0,5,0,1,1,-1,-1,-1,3,6,2,3,4,0,1,0,6,6,1.2,-0.2,3.6,2.6,1.8,HS_TS +1021,R_1rkBy9CAGranra9,32 - 38,Canadian,Male,1,1,1,0,1,1,-1,-1,0,1,0,0,1,1,3,-1,0,0,1,-2,1,1,1,0,1,4,0,-1,0,0,1,3,0,1,1,1,2,4,2,0,0,0,-1,5,1,1,1,1,0,4,0,1,0,1,0,5,0,1,1,1,2,4,-1,-1,-1,0,-2,6,TRUE,0,85,FALSE,0,50,FALSE,1,55,FALSE,1,50,TRUE,1,65,FALSE,1,65,TRUE,1,55,TRUE,1,60,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,70,TRUE,1,55,FALSE,1,90,TRUE,1,55,TRUE,1,98,FALSE,1,55,TRUE,0,70,TRUE,0,55,FALSE,1,60,TRUE,1,90,TRUE,1,85,FALSE,1,50,TRUE,1,50,FALSE,1,55,FALSE,0,55,TRUE,0,50,FALSE,1,55,FALSE,1,50,FALSE,0,60,FALSE,0,50,TRUE,1,80,0.16,0.3025,0.0004,0.2025,0.04,0.1225,0.25,0.1225,0.16,0.0225,0.36,0.2025,0.25,0.25,0.1225,0.25,0.25,0.25,0.2025,0.2025,0.01,0.2025,0.3025,0.01,0.2025,0.25,0.25,0.7225,0.2025,0.49,0.25,0.09,0.215714286,0.189464286,0.241964286,18,56.25,23,71.88,3,37.5,8,100,5,62.5,7,87.5,11,68.75,12,75,62.12,51.25,63.75,70,63.5,63.94,60.31,-15.63,-9.76,13.75,-36.25,7.5,-24,-4.81,-14.69,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,3,0,0,1,1,0,0,0,1,1,1,2,1,1,1,0,1,0,0,1,0,1,1,1,0,0,0.4,0.4,1,0.4,1.2,0.4,0.6,0.45,0.65,3.67,4.33,0,-2,0,-1,-0.66,5 cents,5 minutes,47 days,Male,University - Undergraduate,37,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,0,0,0,-1,-1,0,-2,0,-1,-1,0,0,0,0,0,3,-1,-1,0,1,-0.4,-0.8,0,0.4,-0.2,C_Ug +1022,R_6p3WA5U38zr1qOW,32 - 38,American,Female,1,2,2,1,0,-3,0,2,2,0,0,0,2,0,2,1,0,1,0,-1,2,3,2,1,1,5,-3,0,1,3,0,5,0,0,1,0,1,5,-1,-1,-3,-2,-3,5,0,3,2,0,2,5,-2,0,2,1,0,5,0,2,2,0,2,5,2,0,1,1,0,5,TRUE,0,53,FALSE,0,50,TRUE,0,86,FALSE,1,59,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,85,TRUE,1,64,TRUE,1,100,FALSE,1,62,TRUE,0,81,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,80,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,0,74,FALSE,0,50,FALSE,1,50,TRUE,1,85,FALSE,1,50,TRUE,0,69,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,0.0225,0.0225,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.04,0.1296,0.1444,0.25,0.25,0.5476,0.1681,0.4761,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.7396,0.64,0.25,0.6561,0.272675,0.19855,0.3468,6,18.75,19,59.38,5,62.5,6,75,4,50,4,50,9,56.25,10,62.5,62.59,54.38,66.12,64.75,65.12,61.81,63.38,-40.63,3.21,-8.12,-8.88,14.75,15.12,5.56,0.88,1,1,0,0,1,0,0,1,1,0,0,0,1,0,1,2,1,4,2,2,1,1,0,1,2,1,0,0,1,0,0,2,0,0,0,1,0,0,1,1,0.6,0.4,0.4,2.2,1,0.4,0.4,0.6,0.9,0.6,5,5,0,0,0,0,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),32,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,0,0,0,-1,-1,-1,0,1,0,0,0,-2,1,0,1,1,1,4,1,1,-0.4,0,0,1.6,0.3,HS_TS +1023,R_5jqsnVaFyqCV394,32 - 38,American,Female,2,3,3,-3,-1,-3,0,-1,-1,1,-1,-3,3,1,3,-3,-2,-3,-2,-3,3,3,3,-3,1,4,-3,1,-2,1,1,6,2,-2,3,1,3,5,-3,-3,-3,1,-3,8,3,3,3,1,-1,2,-3,-2,2,-3,2,3,-2,-2,3,1,3,3,2,2,3,3,-2,10,FALSE,1,100,FALSE,0,68,TRUE,0,67,TRUE,0,70,TRUE,1,100,FALSE,1,74,TRUE,1,100,TRUE,1,93,TRUE,1,96,TRUE,1,90,FALSE,1,67,TRUE,0,100,TRUE,1,75,TRUE,0,78,TRUE,1,72,TRUE,1,91,FALSE,1,70,TRUE,0,68,TRUE,0,73,FALSE,1,50,TRUE,1,86,TRUE,1,70,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,1,76,FALSE,1,60,FALSE,0,76,FALSE,0,55,TRUE,1,100,0.0049,0.04,0.0081,0,0,0.0676,0,0.01,0.25,0.09,0.5776,0.0625,0.0016,0.1089,0,0.4624,0.0625,0.49,0.0576,0,0.0196,0.0784,0.5329,0.6084,0.09,0.25,0.3025,0,0.4489,0.4624,0.16,1,0.221207143,0.155935714,0.286478571,21,65.63,23,71.88,4,50,8,100,6,75,5,62.5,13,81.25,10,62.5,79.06,68.88,80,85.75,81.62,84.5,73.62,-6.25,7.18,18.88,-20,10.75,19.12,3.25,11.12,1,0,0,0,2,0,1,1,2,0,3,1,0,0,0,0,1,0,3,0,1,0,0,4,0,0,2,3,2,1,1,1,0,0,0,5,4,6,5,1,0.6,0.8,0.8,0.8,1,1.6,0.4,4.2,0.75,1.8,5,2.67,2,3,2,-2,2.33,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,33,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,0,0,0,-4,2,0,-1,-2,0,-1,2,0,0,0,0,-5,-3,-6,-2,-1,-0.4,-0.8,0.4,-3.4,-1.05,C_Ug +1024,R_7DZP5dCxwcF7leI,32 - 38,American,Female,2,3,1,0,1,-1,-1,0,0,0,1,1,2,-1,2,0,0,0,0,0,2,3,2,0,2,4,-1,-1,0,0,0,3,2,1,2,-1,2,3,0,0,0,0,0,4,2,2,2,0,2,2,0,-1,0,0,1,3,2,2,2,-1,2,3,0,0,0,0,0,4,TRUE,0,56,TRUE,1,50,FALSE,1,69,FALSE,1,50,TRUE,1,61,FALSE,1,100,TRUE,1,66,TRUE,1,65,TRUE,1,50,TRUE,1,61,FALSE,1,50,TRUE,0,66,TRUE,1,50,FALSE,1,88,TRUE,1,50,TRUE,1,99,TRUE,0,54,FALSE,1,50,TRUE,0,54,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,91,FALSE,1,93,TRUE,1,64,FALSE,1,50,FALSE,1,50,TRUE,0,67,TRUE,1,53,FALSE,0,50,TRUE,1,100,0.1225,0.1296,0.0001,0.1156,0,0,0.0081,0.1521,0.25,0.25,0.2209,0.25,0.25,0.25,0.1521,0.25,0,0.25,0.25,0.0049,0.25,0.25,0.2916,0.0144,0.2916,0.25,0.25,0.3136,0.0961,0.25,0.4489,0.4356,0.202853571,0.163085714,0.242621429,14,43.75,25,78.13,6,75,5,62.5,7,87.5,7,87.5,14,87.5,11,68.75,64.28,50.5,72.75,66,67.88,63.12,65.44,-34.38,-13.85,-24.5,10.25,-21.5,-19.62,-24.38,-3.31,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0.4,0,0.2,0,0.6,0.4,0.4,0,0.15,0.35,3.33,2.67,2,0,0,0,0.66,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,0,-1,0,0,0,-1,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,-0.2,-0.4,-0.2,0,-0.2,HS_TS +1025,R_5WmT9o59K4UskO5,25 - 31,American,Female,3,1,2,3,3,3,2,3,1,3,3,2,3,3,3,3,2,3,3,3,3,3,3,3,3,0,3,3,3,2,3,0,3,3,3,2,3,1,3,3,3,3,3,1,3,3,3,3,3,0,3,3,3,2,3,0,3,3,3,3,3,0,3,3,3,3,3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.0004,0,0,0,0,1,0,0,0,0,0,0,0.36,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0.191442857,0.097171429,0.285714286,32,100,26,81.25,6,75,8,100,7,87.5,5,62.5,14,87.5,12,75,98.69,95,99.75,100,100,100,97.38,18.75,17.44,20,-0.25,12.5,37.5,12.5,22.38,0,2,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,2,1,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0.6,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0.4,0.35,0.33,0,0,0,1,1,0.33,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),26,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0.2,0,0.05,grad_prof +1026,R_6exAZhaAxlvYZc2,32 - 38,Canadian,Male,2,2,2,-1,2,1,-2,2,-1,1,1,2,2,1,1,1,2,2,2,1,2,2,2,-2,2,6,1,-2,2,0,1,6,2,1,2,2,2,7,-1,2,1,-1,-1,8,2,2,2,-1,2,6,1,-1,2,-1,1,6,2,1,2,0,2,6,2,2,2,2,1,6,TRUE,0,81,FALSE,0,50,TRUE,0,76,FALSE,1,50,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,62,TRUE,1,100,TRUE,0,85,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,100,TRUE,0,59,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,70,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,100,TRUE,0,70,FALSE,0,79,TRUE,1,68,TRUE,1,100,0,0.0064,0,0,0,0,0.25,0,0.25,0,0.6241,0,0.1444,0.7225,0.0225,0.25,0.25,0.25,0,0,0.09,0.09,0.25,1,0.3481,0.25,0.1024,0.6561,0.5776,0,0.49,0.8281,0.265921429,0.197392857,0.33445,23,71.88,22,68.75,6,75,6,75,6,75,4,50,13,81.25,9,56.25,79.31,60.62,79.25,96.62,80.75,82.88,75.75,3.13,10.56,-14.38,4.25,21.62,30.75,1.63,19.5,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,2,0,1,3,2,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0.2,0.2,0.8,1.6,0,0.2,0.8,0.2,0.7,0.3,6.33,6,0,0,1,2,0.33,5 cents,5 minutes,47 days,Male,University - Undergraduate,32,1,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,0,0,0,1,0,0,-1,0,1,0,0,0,0,0,0,1,0,1,3,2,0.2,0,0,1.4,0.4,C_Ug +1027,R_7xJjBlv5ONJ8eTV,32 - 38,Canadian,Male,-2,1,1,2,0,-1,-1,1,-2,0,1,-1,1,0,0,0,-1,-1,0,0,-2,1,2,2,0,2,-2,-2,1,-2,0,2,1,0,1,0,1,3,-1,-1,-1,-1,-1,4,-1,0,2,2,0,2,0,-2,1,0,1,3,0,0,0,0,0,2,0,0,0,0,-1,2,TRUE,0,73,FALSE,0,73,FALSE,1,70,FALSE,1,64,FALSE,0,66,FALSE,1,73,TRUE,1,74,TRUE,1,76,FALSE,0,77,TRUE,1,83,FALSE,1,67,TRUE,0,76,TRUE,1,63,TRUE,0,81,FALSE,0,63,TRUE,1,74,TRUE,0,64,FALSE,1,64,TRUE,0,71,FALSE,1,61,TRUE,1,61,FALSE,0,74,TRUE,0,67,TRUE,1,73,FALSE,1,70,TRUE,1,66,TRUE,0,66,TRUE,0,81,FALSE,1,60,TRUE,1,100,FALSE,0,75,TRUE,1,100,0.0576,0.1156,0.0676,0.0676,0,0.0729,0.0729,0.0289,0.1521,0.5476,0,0.1369,0.5929,0.1089,0.4356,0.5329,0.4489,0.1296,0.6561,0.09,0.1521,0.3969,0.5041,0.6561,0.4096,0.4356,0.5625,0.5329,0.09,0.1296,0.16,0.5776,0.307614286,0.232864286,0.382364286,17,53.13,18,56.25,2,25,5,62.5,5,62.5,6,75,10,62.5,8,50,72.06,69.5,69.25,73.12,76.38,74.88,69.25,-3.12,15.81,44.5,6.75,10.62,1.38,12.38,19.25,0,0,1,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,1,1,1,1,0,0,1,1,0,2,1,1,1,1,0,0,0,1,1,0,1,0.2,0.4,0.4,0.6,0.6,1,0.6,0.6,0.4,0.7,2.33,2.33,0,-1,1,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,37,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,-1,-1,0,0,0,0,0,0,-2,-1,-1,0,-1,0,1,1,-1,-1,1,0,-0.4,-0.6,-0.2,0,-0.3,C_Ug +1028,R_5UadrYih4hlHoMK,25 - 31,American,Female,1,3,2,3,2,-1,3,2,-1,2,3,3,2,1,3,-1,-1,0,0,-1,-1,3,3,3,0,7,1,-1,1,1,1,7,1,1,2,0,3,8,1,0,1,1,0,8,-1,3,3,2,3,8,2,2,3,-1,2,7,3,3,2,1,1,7,2,1,1,2,1,6,FALSE,1,94,TRUE,1,94,TRUE,0,99,FALSE,1,68,TRUE,1,66,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,0,100,TRUE,0,100,TRUE,1,72,FALSE,1,91,TRUE,1,60,TRUE,1,89,TRUE,0,55,TRUE,0,78,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,87,TRUE,1,68,TRUE,0,67,TRUE,1,68,FALSE,1,62,FALSE,1,75,TRUE,0,100,TRUE,1,69,TRUE,1,84,TRUE,1,100,0,0.1024,0.0121,0,0,0,0.1024,0.0001,1,0,0.0961,0.0784,0,1,0.1156,0.0036,0.0169,0.1024,0.0625,0.4489,0,0.16,1,0.0081,0.3025,0.1444,0.0256,0.0036,0.9801,0.6084,1,1,0.294985714,0.179678571,0.410292857,21,65.63,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,85.78,83.5,85,87.12,87.5,85.56,86,-6.25,13.9,8.5,10,12.12,25,-14.44,42.25,2,0,1,0,2,2,4,1,2,1,2,2,0,1,0,2,1,1,1,1,2,0,1,1,1,3,1,1,0,0,0,0,0,0,2,3,2,1,2,2,1,2,1,1.2,1,1,0.4,2,1.3,1.1,7.33,7.33,-1,0,1,2,0,5 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),29,0,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,0,0,0,-1,1,-1,3,0,2,1,2,2,0,1,-2,-1,-1,0,-1,-1,0,1,0.6,-0.8,0.2,grad_prof +1029,R_71XWLkqv67mo4XO,18 - 24,American,Female,-2,3,3,-1,3,0,2,-3,3,1,-3,-1,3,3,1,-3,-3,-3,-3,-3,1,3,2,-3,3,10,3,3,-3,3,3,10,-3,3,-3,3,-3,10,1,0,0,-3,-3,10,-3,3,3,-1,1,2,0,2,-1,0,2,7,0,0,2,1,0,6,0,2,1,-2,-1,7,FALSE,1,100,TRUE,1,64,FALSE,1,89,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,85,FALSE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,FALSE,1,100,FALSE,0,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,FALSE,0,87,FALSE,0,50,TRUE,1,100,0,1,0.25,0,0,0,0.16,1,0.25,0,0.7569,0,0.25,0.25,0,0.1296,0,0.25,0,0,0,0.25,0.25,0.0676,0.25,0.25,0.25,0,0.0121,0.7225,1,0,0.217810714,0.217607143,0.218014286,25,78.13,19,59.38,2,25,6,75,5,62.5,6,75,10,62.5,9,56.25,79.97,51.75,93.75,94.88,79.5,81.94,78,18.75,20.59,26.75,18.75,32.38,4.5,19.44,21.75,3,0,1,2,0,3,1,0,0,2,0,4,6,0,4,4,3,3,0,0,1,0,0,0,2,0,0,2,3,1,3,1,1,2,1,3,5,4,1,2,1.2,1.2,2.8,2,0.6,1.2,1.6,3,1.8,1.6,10,5,8,3,4,3,5,5 cents,5 minutes,47 days,Female,High School (or equivalent),22,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,01DIR,2,0,1,2,-2,3,1,-2,-3,1,-3,3,5,-2,3,1,-2,-1,-1,-2,0.6,0,1.2,-1,0.2,HS_TS +1030,R_3PjaFDfG3yfrr8e,32 - 38,American,Female,-3,2,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,-2,0,-3,2,1,0,3,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,4,FALSE,1,64,FALSE,0,68,FALSE,1,100,FALSE,1,62,FALSE,0,61,FALSE,1,100,TRUE,1,81,TRUE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,94,FALSE,1,71,TRUE,1,78,FALSE,1,100,TRUE,1,66,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,75,TRUE,0,71,FALSE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,81,FALSE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,74,TRUE,1,100,TRUE,1,100,0,0.0361,0,0.0361,0,0,0,0,0.5041,0,0.0676,0.0484,0.4225,0.0036,0.3721,0.4624,0,0.1444,1,0,0.8649,0.1156,0.0625,0,0.2916,0,0,0.1296,0,1,0.2916,0.0841,0.209464286,0.14465,0.274278571,14,43.75,23,71.88,6,75,4,50,7,87.5,6,75,12,75,11,68.75,84.75,78.75,80,90.75,89.5,85.44,84.06,-28.13,12.87,3.75,30,3.25,14.5,10.44,15.31,0,0,1,0,2,0,0,0,3,0,0,0,1,0,0,0,0,0,2,0,3,2,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0.6,0.6,0.2,0.4,1.6,0,0.2,0.4,0.45,0.55,0,6.67,0,-10,-10,-4,-6.67,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,-3,-2,-1,0,1,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,-1,0.6,0,0,-0.1,HS_TS +1031,R_1CKeGCl62iyVvge,18 - 24,Canadian,Male,2,3,3,2,3,-1,2,0,3,1,3,3,3,1,1,-2,-3,-1,-1,2,1,2,2,0,2,5,1,0,2,0,1,5,3,1,1,2,2,5,-2,-3,-1,-2,0,5,2,1,2,0,2,4,-1,0,0,3,1,7,3,1,2,1,1,8,-2,-3,-3,-3,-1,5,TRUE,0,100,TRUE,1,75,TRUE,0,80,FALSE,1,75,FALSE,0,50,TRUE,0,80,TRUE,1,90,FALSE,0,50,FALSE,0,70,FALSE,0,50,TRUE,0,80,TRUE,0,90,TRUE,1,85,FALSE,1,50,FALSE,0,50,TRUE,1,90,TRUE,0,75,TRUE,0,75,FALSE,1,64,FALSE,1,50,TRUE,1,75,TRUE,1,80,TRUE,0,75,FALSE,0,50,FALSE,1,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,80,TRUE,1,80,TRUE,1,85,0.25,0.09,0.01,0.01,0.0225,0.64,0.25,0.25,0.25,0.04,0.04,0.0225,0.49,0.64,0.25,0.0625,0.5625,0.0625,0.25,0.25,0.0625,0.25,0.1296,0.25,0.5625,0.25,0.04,1,0.64,0.5625,0.25,0.81,0.317485714,0.255892857,0.379078571,16,50,18,56.25,5,62.5,4,50,5,62.5,4,50,10,62.5,8,50,69.5,68,71.88,70.62,67.5,70.62,68.38,-6.25,13.25,5.5,21.88,8.12,17.5,8.12,18.38,1,1,1,2,1,2,2,2,3,0,0,2,2,1,1,0,0,0,1,2,0,2,1,2,1,0,2,0,0,0,0,2,1,0,0,0,0,2,2,3,1.2,1.8,1.2,0.6,1.2,0.4,0.6,1.4,1.2,0.9,5,6.33,1,-2,-3,0,-1.33,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,0.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,1,-1,0,0,0,2,0,2,3,0,0,0,1,1,1,0,0,-2,-1,-1,0,1.4,0.6,-0.8,0.3,C_Ug +1032,R_6GOyOOfukQvdlML,32 - 38,Canadian,Male,-1,1,1,2,1,0,-1,0,0,1,0,0,-2,-1,1,-1,2,1,0,0,0,1,1,2,-1,7,0,1,-1,1,-1,10,1,-1,2,0,0,8,1,1,0,-1,0,8,-1,1,2,2,1,6,0,-1,-2,2,-1,7,0,1,0,-1,1,6,1,-1,-1,2,0,8,TRUE,0,87,TRUE,1,68,TRUE,0,90,TRUE,0,78,FALSE,0,72,FALSE,1,84,TRUE,1,93,TRUE,1,79,TRUE,1,91,FALSE,0,53,TRUE,0,81,TRUE,0,83,FALSE,0,69,TRUE,0,73,TRUE,1,79,TRUE,1,79,TRUE,0,80,FALSE,1,90,FALSE,1,90,FALSE,1,67,FALSE,0,91,TRUE,1,85,TRUE,0,90,FALSE,0,71,TRUE,0,87,FALSE,0,67,TRUE,0,79,FALSE,1,73,FALSE,1,74,TRUE,1,88,FALSE,0,76,TRUE,1,77,0.0441,0.4489,0.0441,0.0049,0.0529,0.0256,0.5041,0.2809,0.1089,0.0225,0.0144,0.4761,0.0081,0.6561,0.5184,0.1024,0.81,0.6084,0.0729,0.7569,0.8281,0.0441,0.01,0.5329,0.64,0.6241,0.5776,0.7569,0.81,0.01,0.0676,0.6889,0.378885714,0.2992,0.458571429,17,53.13,15,46.88,4,50,3,37.5,3,37.5,5,62.5,9,56.25,6,37.5,79.5,80.25,79.62,79.38,78.75,77.38,81.62,6.25,32.62,30.25,42.12,41.88,16.25,21.13,44.12,1,0,0,0,2,0,2,1,1,2,1,1,4,1,1,2,1,1,1,0,0,0,1,0,0,0,0,2,2,2,0,1,2,0,0,2,3,2,2,0,0.6,1.2,1.6,1,0.2,1.2,0.6,1.8,1.1,0.95,8.33,6.33,1,3,2,0,2,10 cents,25 minutes,24 days,Male,University - Undergraduate,36,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,1,0,-1,0,2,0,2,-1,-1,0,1,0,2,1,1,0,-2,-1,-1,0,0.4,0,1,-0.8,0.15,C_Ug +1033,R_7EiGpRFWemTNEuI,32 - 38,Canadian,Male,3,3,2,3,3,2,2,2,2,1,1,1,1,1,2,-2,-2,-2,-2,-2,3,2,2,2,2,7,2,2,3,3,1,8,2,3,3,3,2,8,2,2,2,1,3,7,2,3,3,3,2,10,2,3,3,2,3,8,1,3,2,1,1,9,2,2,1,2,3,9,TRUE,0,100,TRUE,1,53,FALSE,1,92,FALSE,1,93,FALSE,0,83,TRUE,0,76,TRUE,1,89,FALSE,0,55,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,82,TRUE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,96,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,77,FALSE,0,78,TRUE,0,65,FALSE,1,97,TRUE,0,100,FALSE,0,100,TRUE,1,65,TRUE,1,100,0.3025,0.6084,0,0.0121,0,0.5776,0,0,0.0025,0,1,0,0,0.0004,0.6889,0.2209,1,0.0049,0.0009,0.5929,0.9216,0,0,1,0.0324,0.4225,0.1225,1,0.0064,1,1,1,0.378371429,0.249657143,0.507085714,16,50,18,56.25,7,87.5,3,37.5,3,37.5,5,62.5,11,68.75,7,43.75,90.44,84.25,92.12,93,92.38,88.69,92.19,-6.25,34.19,-3.25,54.62,55.5,29.88,19.94,48.44,0,1,0,1,1,0,0,1,1,0,1,2,2,2,0,4,4,4,3,5,1,0,1,0,1,0,1,1,0,2,0,2,1,0,1,4,4,3,4,5,0.6,0.4,1.4,4,0.6,0.8,0.8,4,1.6,1.55,7.67,9,-3,0,-1,-2,-1.33,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),35,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,-1,1,-1,1,0,0,-1,0,1,-2,1,0,1,2,-1,0,0,1,-1,0,0,-0.4,0.6,0,0.05,grad_prof +1034,R_3a12hokuEVApex3,32 - 38,Canadian,Male,1,3,3,3,3,3,-2,2,-2,3,2,2,3,3,2,2,2,2,-3,3,-3,2,2,-2,3,1,-2,-3,-3,2,-2,9,1,2,1,2,1,3,-3,-3,-3,-3,-2,4,-1,3,2,3,3,9,2,-2,1,-2,1,8,2,2,2,3,3,8,2,2,2,-3,3,9,TRUE,0,88,TRUE,1,73,FALSE,1,63,FALSE,1,91,TRUE,1,88,TRUE,0,86,TRUE,1,82,TRUE,1,74,TRUE,1,97,TRUE,1,100,FALSE,1,96,FALSE,1,100,TRUE,1,100,FALSE,1,83,FALSE,0,64,TRUE,1,98,TRUE,0,100,TRUE,0,100,FALSE,1,75,FALSE,1,100,FALSE,0,81,FALSE,0,100,FALSE,1,94,TRUE,1,88,TRUE,0,100,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,0,97,TRUE,1,100,FALSE,0,100,TRUE,1,86,0.0676,0,0.0004,0.0324,0.0196,0.7396,0.0144,0,0,1,0,0,0.0009,0.0016,0.0144,0.0729,0.0036,0.0081,1,1,0.6561,0.4096,0.0625,0.0289,1,0.1089,1,0.7744,0.1369,1,0.9409,0,0.356903571,0.133935714,0.579871429,17,53.13,21,65.63,6,75,4,50,4,50,7,87.5,12,75,9,56.25,89.72,82.88,91.5,94.12,90.38,89.44,90,-12.5,24.09,7.88,41.5,44.12,2.88,14.44,33.75,4,1,1,5,0,5,1,5,4,5,1,0,2,1,1,5,5,5,0,5,2,0,1,0,0,1,0,1,0,2,0,0,1,0,1,0,0,0,0,0,2.2,4,1,4,0.6,0.8,0.4,0,2.8,0.45,4.33,8.33,-8,1,-5,-5,-4,10 cents,25 minutes,24 days,Male,University - Undergraduate,33,1.25,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,1,0,5,0,4,1,4,4,3,1,0,1,1,0,5,5,5,0,5,1.6,3.2,0.6,4,2.35,C_Ug +1035,R_7l0EFONzd5EiPzE,25 - 31,American,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,2,TRUE,0,85,TRUE,1,84,TRUE,0,65,FALSE,1,81,TRUE,1,83,TRUE,0,80,TRUE,1,88,TRUE,1,88,TRUE,1,91,TRUE,1,88,TRUE,0,90,TRUE,0,89,TRUE,1,91,TRUE,0,88,TRUE,1,87,TRUE,1,89,TRUE,0,88,TRUE,0,85,TRUE,0,85,TRUE,0,85,FALSE,0,90,TRUE,1,90,TRUE,0,87,TRUE,1,85,FALSE,1,90,FALSE,0,83,TRUE,0,85,FALSE,1,88,TRUE,0,92,TRUE,1,84,FALSE,0,87,TRUE,1,89,0.0144,0.6889,0.0121,0.0144,0.0121,0.64,0.0225,0.0144,0.7225,0.01,0.0256,0.0081,0.0081,0.81,0.0289,0.0256,0.7569,0.0361,0.0144,0.01,0.81,0.0169,0.7225,0.7744,0.7744,0.7225,0.7569,0.7225,0.4225,0.7225,0.8464,0.7921,0.401028571,0.222914286,0.579142857,27,84.38,16,50,4,50,3,37.5,4,50,5,62.5,13,81.25,3,18.75,86.25,86.25,87.5,87.12,84.12,87.31,85.19,34.38,36.25,36.25,50,37.12,21.62,6.06,66.44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4.33,8,0,-5,-6,0,-3.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,29,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C_Ug +1036,R_5spLTuDdtfqvVE7,25 - 31,Canadian,Male,1,3,3,3,3,2,2,0,1,2,2,0,1,-1,1,0,2,3,2,1,1,3,3,2,1,4,-2,2,-1,2,-1,8,1,-1,2,1,1,7,-1,2,-2,1,0,3,1,3,1,3,3,7,-2,2,0,1,1,8,0,1,-1,0,2,7,0,-1,1,2,2,7,TRUE,0,78,FALSE,0,63,TRUE,0,75,FALSE,1,66,TRUE,1,66,TRUE,0,75,TRUE,1,75,FALSE,0,58,FALSE,0,50,TRUE,1,82,FALSE,1,54,FALSE,1,59,TRUE,1,100,FALSE,1,68,FALSE,0,50,TRUE,1,100,TRUE,0,59,TRUE,0,80,FALSE,1,70,FALSE,1,61,TRUE,1,66,FALSE,0,63,FALSE,1,60,TRUE,1,87,FALSE,1,56,TRUE,1,84,FALSE,1,65,FALSE,1,73,FALSE,1,65,TRUE,1,77,FALSE,0,63,FALSE,0,65,0.3364,0.0256,0,0.0625,0.4225,0.5625,0.0169,0.0324,0.1521,0.3969,0.0529,0,0.25,0.2116,0.1156,0.3969,0.16,0.1156,0.0729,0.1936,0.1156,0.25,0.09,0.1024,0.3481,0.1225,0.3969,0.6084,0.5625,0.64,0.1225,0.1681,0.23855,0.206135714,0.270964286,10,31.25,20,62.5,4,50,5,62.5,5,62.5,6,75,9,56.25,11,68.75,69.16,60.12,69.5,73.25,73.75,71.81,66.5,-31.25,6.66,10.12,7,10.75,-1.25,15.56,-2.25,0,0,0,1,2,4,0,1,1,3,1,1,1,2,0,1,0,5,1,1,0,0,2,0,0,4,0,0,0,1,2,1,2,1,1,0,3,2,0,1,0.6,1.8,1,1.6,0.4,1,1.4,1.2,1.25,1,6.33,7.33,-3,0,0,-4,-1,10 cents,5 minutes,24 days,Male,University - Undergraduate,25,0.75,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,0,0,-2,1,2,0,0,1,1,2,-1,0,-1,1,-1,1,-3,3,1,0,0.2,0.8,-0.4,0.4,0.25,C_Ug +1037,R_7ovZUoxdrCKde3V,32 - 38,Canadian,Male,0,2,3,2,3,-1,0,1,0,2,3,2,2,1,3,0,1,0,1,-3,1,3,3,2,2,2,1,1,1,2,1,5,0,3,1,2,2,4,0,3,1,-2,2,8,2,3,3,2,2,7,3,2,1,2,1,5,2,1,2,1,2,6,-1,-1,0,-1,-1,6,TRUE,0,90,TRUE,1,74,FALSE,1,56,FALSE,1,95,FALSE,0,86,FALSE,1,76,TRUE,1,100,TRUE,1,92,FALSE,0,69,FALSE,0,58,FALSE,1,65,TRUE,0,100,TRUE,1,86,TRUE,0,100,TRUE,1,79,TRUE,1,93,TRUE,0,97,TRUE,0,97,TRUE,0,90,FALSE,1,54,TRUE,1,100,TRUE,1,54,TRUE,0,60,TRUE,1,98,TRUE,0,93,TRUE,1,80,TRUE,0,96,FALSE,1,50,TRUE,0,80,FALSE,0,60,TRUE,1,95,TRUE,1,90,0.0064,0.04,0.0049,0,0.01,0.0576,0.0004,0.3364,0.2116,0.2116,0.36,0.0196,0.4761,0.1225,0.7396,0.0676,0.36,0.0025,0.25,0.8649,0,0.0441,0.81,1,0.9409,0.9216,0.0025,0.81,0.1936,0.9409,0.64,1,0.406928571,0.212535714,0.601321429,10,31.25,18,56.25,5,62.5,4,50,3,37.5,6,75,12,75,6,37.5,81.66,82.88,84.38,84,75.38,82.12,81.19,-25,25.41,20.38,34.38,46.5,0.38,7.12,43.69,1,1,0,0,1,2,1,0,2,1,3,1,1,1,1,0,2,1,3,5,2,1,0,0,1,4,2,0,2,1,1,1,0,0,1,1,2,0,2,2,0.6,1.2,1.4,2.2,0.8,1.8,0.6,1.4,1.35,1.15,3.67,6,-5,0,-2,2,-2.33,10 cents,25 minutes,24 days,Male,University - Undergraduate,35,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,-1,0,0,0,0,-2,-1,0,0,0,2,0,1,1,0,-1,0,1,1,3,-0.2,-0.6,0.8,0.8,0.2,C_Ug +1038,R_3VvzQjSV4swk1yE,32 - 38,Canadian,Male,-1,2,3,2,0,-1,1,0,1,0,2,0,1,0,1,-2,-1,0,-1,-1,0,2,2,2,0,2,-1,1,0,1,0,1,2,0,1,0,1,1,-1,-1,-1,-1,-1,2,0,2,2,2,0,0,0,1,1,1,0,2,2,0,2,0,2,1,-1,-1,-1,-1,-1,0,FALSE,1,68,TRUE,1,90,FALSE,1,63,TRUE,0,50,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,61,TRUE,1,87,FALSE,1,88,TRUE,1,68,TRUE,1,100,TRUE,0,72,TRUE,0,100,TRUE,0,75,FALSE,1,100,TRUE,1,74,TRUE,1,62,TRUE,0,63,TRUE,1,100,TRUE,0,62,TRUE,1,64,TRUE,0,58,TRUE,0,74,TRUE,0,100,TRUE,1,90,TRUE,1,50,TRUE,1,83,0,0.1296,0,0,0.0289,0,0,0,0,0.1444,0.01,0.0169,0,0.25,0.0049,0.01,0.3969,0.25,0.5476,0.3844,0.0676,0.1024,0.5625,0.0144,0.5184,0.3364,0.25,0.1024,0.1369,1,1,0.1521,0.224539286,0.079428571,0.36965,24,75,23,71.88,5,62.5,5,62.5,6,75,7,87.5,16,100,7,43.75,79.53,67.62,84,80.5,86,85.06,74,3.12,7.65,5.12,21.5,5.5,-1.5,-14.94,30.25,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0.4,0,0,0.4,0.4,0.4,0.4,0.4,0.2,0.4,1.33,1,2,-1,0,2,0.33,10 cents,5 minutes,24 days,Male,High School (or equivalent),34,0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,0,0,0,0,0,-1,0,-1,0,0,0,0,-1,0,-1,0,0,0,0,0,0,-0.4,-0.4,0,-0.2,HS_TS +1039,R_7OxcsWq1kON7Wl5,25 - 31,American,Female,3,3,3,1,3,3,1,2,-3,2,3,2,3,1,1,1,1,1,1,-2,3,3,3,1,2,8,1,2,2,3,0,9,1,3,1,3,1,9,1,2,1,2,1,9,2,3,2,1,2,7,-1,1,2,2,1,10,3,2,2,3,3,7,3,3,2,1,1,10,FALSE,1,100,FALSE,0,96,TRUE,0,100,FALSE,1,99,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,81,FALSE,0,53,FALSE,1,93,TRUE,0,97,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,76,FALSE,1,99,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,77,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,99,FALSE,1,91,FALSE,0,98,TRUE,1,95,TRUE,1,100,0,0,0,0,0,0.0004,0.0529,0.2809,1,1,0.9604,1,0.0361,0.0049,0,0.9216,1,0.0001,0.9801,0,0,0,0,0,0.0576,0,0.0025,0,1,0.0001,0.0081,0.9409,0.330235714,0.44695,0.213521429,30,93.75,22,68.75,7,87.5,6,75,6,75,3,37.5,11,68.75,11,68.75,95.38,95.5,95.62,94,96.38,93.75,97,25,26.63,8,20.62,19,58.88,25,28.25,0,0,0,0,1,2,1,0,6,2,2,1,2,2,0,0,1,0,1,3,1,0,1,0,1,4,0,0,5,1,0,0,1,2,2,2,2,1,0,3,0.2,2.2,1.4,1,0.6,2,1,1.6,1.2,1.3,8.67,8,1,-1,2,-1,0.67,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),25,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,-1,0,-1,0,0,-2,1,0,1,1,2,1,1,0,-2,-2,-1,-1,1,0,-0.4,0.2,0.4,-0.6,-0.1,grad_prof +1040,R_6xjOsURNNhM7ELD,25 - 31,American,Male,2,0,1,2,2,2,2,2,2,1,2,1,2,2,2,0,2,2,1,2,2,2,1,3,3,5,0,-1,2,3,1,5,3,1,2,2,0,7,1,2,1,0,2,6,1,2,3,1,1,6,2,0,3,1,-1,8,3,-2,1,-3,-1,9,2,0,1,3,1,7,TRUE,0,77,TRUE,1,50,TRUE,0,71,FALSE,1,86,FALSE,0,76,FALSE,1,89,TRUE,1,84,TRUE,1,66,FALSE,0,68,TRUE,1,68,TRUE,0,71,TRUE,0,96,FALSE,0,91,FALSE,1,74,TRUE,1,75,TRUE,1,79,TRUE,0,70,TRUE,0,71,FALSE,1,80,TRUE,0,75,TRUE,1,61,FALSE,0,71,TRUE,0,72,TRUE,1,63,TRUE,0,50,FALSE,0,74,TRUE,0,51,TRUE,0,79,TRUE,0,80,FALSE,0,77,FALSE,0,78,TRUE,1,78,0.1156,0.5476,0.0441,0.0256,0.0484,0.0121,0.1369,0.1024,0.5625,0.5041,0.5929,0.8281,0.4624,0.5041,0.5776,0.25,0.5184,0.0196,0.6241,0.25,0.1521,0.0625,0.04,0.0676,0.49,0.2601,0.6084,0.5929,0.5041,0.5041,0.64,0.9216,0.387035714,0.365678571,0.408392857,17,53.13,13,40.63,4,50,3,37.5,3,37.5,3,37.5,9,56.25,4,25,73.47,69.88,77.12,71.12,75.75,72.44,74.5,12.5,32.84,19.88,39.62,33.62,38.25,16.19,49.5,0,2,0,1,1,2,3,0,1,0,1,0,0,0,2,1,0,1,1,0,1,2,2,1,1,0,2,1,1,2,1,3,1,5,3,2,2,1,2,1,0.8,1.2,0.6,0.6,1.4,1.2,2.6,1.6,0.8,1.7,5.67,7.67,-1,-3,-2,-1,-2,10 cents,25 minutes,36 days,Male,University - Graduate (Masters),27,-0.375,0,0,0,1,0,0,0,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,0,-2,0,0,2,1,-1,0,-2,0,-3,-1,-5,-1,-1,-2,0,-1,-1,-0.6,0,-2,-1,-0.9,grad_prof +1041,R_39cvBVBZ3VzfSRW,25 - 31,American,Female,0,1,3,0,1,-2,-2,2,0,2,2,0,2,0,3,0,0,1,1,2,1,2,1,-2,2,6,-2,-2,2,0,2,5,1,0,1,2,3,6,1,0,1,0,-1,6,0,1,2,2,2,2,-2,-2,2,-1,2,2,2,0,2,1,3,2,1,2,1,2,2,2,FALSE,1,70,TRUE,1,100,TRUE,0,65,FALSE,1,50,TRUE,1,85,FALSE,1,85,TRUE,1,90,TRUE,1,90,TRUE,1,50,TRUE,1,75,TRUE,0,50,FALSE,1,100,TRUE,1,90,FALSE,1,95,FALSE,0,50,TRUE,1,95,TRUE,0,50,FALSE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,50,TRUE,1,61,TRUE,0,76,TRUE,1,100,TRUE,0,93,TRUE,1,98,FALSE,1,50,FALSE,1,56,TRUE,0,92,FALSE,0,75,TRUE,1,70,TRUE,1,92,0.01,0.0004,0.0025,0.01,0.0064,0.0225,0,0.0625,0,0.1521,0.5625,0.01,0.25,0.25,0.0225,0,0.5776,0.25,0.1936,0.8649,0.25,0.25,0.16,0.0025,0.25,0.25,0.09,0.09,0.4225,0,0.8464,0,0.208428571,0.154721429,0.262135714,10,31.25,24,75,6,75,5,62.5,7,87.5,6,75,14,87.5,10,62.5,76.97,60,77.5,85.25,85.12,79.44,74.5,-43.75,1.97,-15,15,-2.25,10.12,-8.06,12,1,1,2,2,1,0,0,0,0,0,1,0,1,2,0,1,0,0,1,3,0,0,1,2,1,0,0,0,1,0,0,0,0,1,0,1,2,0,1,0,1.4,0,0.8,1,0.8,0.2,0.2,0.8,0.8,0.5,5.67,2,4,3,4,4,3.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,1,1,1,0,0,0,0,0,-1,0,1,0,1,1,0,0,-2,0,0,3,0.6,-0.2,0.6,0.2,0.3,C_Ug +1042,R_7s0cfU8ooQnpkW2,25 - 31,American,Female,2,3,2,3,2,1,-2,3,1,3,2,3,2,-1,3,1,2,3,2,-2,3,3,3,2,2,0,2,-2,3,2,2,5,3,2,2,-2,3,0,1,1,2,-2,-2,10,3,2,3,2,2,0,2,-2,3,1,2,0,3,2,1,-2,2,0,2,2,3,2,2,9,FALSE,1,100,TRUE,1,87,TRUE,0,100,FALSE,1,86,TRUE,1,93,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,1,97,TRUE,0,90,TRUE,1,100,TRUE,1,89,TRUE,0,100,FALSE,1,100,FALSE,1,89,FALSE,1,64,TRUE,1,99,TRUE,1,96,TRUE,0,86,TRUE,1,85,TRUE,0,87,TRUE,1,96,TRUE,0,96,TRUE,0,97,TRUE,0,80,TRUE,1,86,TRUE,1,76,FALSE,0,82,0,0.0016,0.0121,0,0.6724,0.64,0.0225,0,0.1296,0.0016,0.0196,0.0009,0,0.7569,0.0049,0.0169,0.7396,0.0196,0.9409,0.7569,0.0001,0,0.0121,0.81,1,0.9216,0.0576,0,1,0,0.64,1,0.362989286,0.216035714,0.509942857,23,71.88,20,62.5,6,75,3,37.5,6,75,5,62.5,15,93.75,5,31.25,91.5,90.12,89.62,96.12,90.12,92.88,90.12,9.38,29,15.12,52.12,21.12,27.62,-0.87,58.87,1,0,1,1,0,1,0,0,1,1,1,1,0,1,0,0,1,1,4,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,4,0.6,0.6,0.6,1.2,0.8,0.4,1,1,0.75,0.8,1.67,0,0,5,0,1,1.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,0,-1,0,0,0,0,0,0,1,0,0,0,-1,0,-1,-1,1,1,4,-4,-0.2,0.2,-0.4,0.2,-0.05,C_Ug +1043,R_7lacZSWPPugloS0,25 - 31,American,Female,3,3,3,3,3,-1,3,1,1,3,2,3,3,3,2,-2,0,-2,-2,-2,-2,2,2,-2,2,8,1,-1,-2,3,0,8,-2,-2,2,2,2,8,-1,-2,2,-2,-1,6,3,3,3,3,3,10,3,-1,3,-3,2,10,1,-2,3,3,3,10,2,2,2,2,2,8,TRUE,0,100,TRUE,1,100,FALSE,1,59,TRUE,0,57,TRUE,1,56,FALSE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,96,FALSE,1,64,TRUE,0,100,TRUE,1,59,TRUE,0,62,FALSE,0,54,TRUE,1,53,TRUE,0,65,TRUE,0,100,FALSE,1,54,FALSE,1,52,FALSE,0,100,TRUE,1,78,FALSE,1,54,TRUE,1,52,FALSE,1,100,TRUE,1,100,TRUE,0,83,TRUE,0,84,TRUE,0,68,TRUE,1,63,FALSE,0,56,TRUE,1,56,0,0,0.2209,0,0.1936,0.0081,0.2304,0.0016,0.2304,0.0484,0.1369,0.1681,0.2025,0.1296,0.1936,0,0.2116,0.3249,0.7056,0,1,0.2916,0.2116,0.3844,0.4225,0.6889,0.3136,1,0.1681,1,0.4624,1,0.347442857,0.14855,0.546335714,10,31.25,20,62.5,4,50,5,62.5,5,62.5,6,75,13,81.25,7,43.75,74.09,65.38,68.62,92,70.38,73.62,74.56,-31.25,11.59,15.38,6.12,29.5,-4.62,-7.63,30.81,5,1,1,5,1,2,4,3,2,3,4,5,1,1,0,1,2,4,0,1,0,0,0,0,0,4,4,2,4,1,1,5,0,0,1,4,2,4,4,4,2.6,2.8,2.2,1.6,0,3,1.4,3.6,2.3,2,8,10,-2,-2,-2,-2,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),29,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,5,1,1,5,1,-2,0,1,-2,2,3,0,1,1,-1,-3,0,0,-4,-3,2.6,-0.2,0.8,-2,0.3,grad_prof +1044,R_6lTVn2VOOfAGtTX,25 - 31,American,Male,1,2,2,2,2,0,-2,0,0,0,1,0,0,0,0,0,1,1,0,0,1,2,2,2,2,8,0,0,0,0,0,8,0,0,0,1,0,8,0,-1,0,0,0,8,0,1,1,1,1,8,0,0,0,-1,0,8,1,0,0,0,0,8,1,1,1,1,1,8,TRUE,0,72,TRUE,1,79,TRUE,0,76,TRUE,0,82,TRUE,1,78,TRUE,0,88,TRUE,1,77,TRUE,1,77,TRUE,1,85,TRUE,1,73,TRUE,0,67,TRUE,0,98,TRUE,1,77,TRUE,0,71,TRUE,1,65,TRUE,1,72,TRUE,0,65,TRUE,0,64,TRUE,0,73,TRUE,0,74,TRUE,1,72,TRUE,1,64,FALSE,1,64,TRUE,1,79,TRUE,0,66,TRUE,1,55,TRUE,0,89,TRUE,0,87,TRUE,0,92,TRUE,1,89,TRUE,1,94,TRUE,1,96,0.0529,0.2025,0.0784,0.0529,0.0016,0.7744,0.0441,0.0729,0.5476,0.1296,0.0121,0.0529,0.0225,0.4489,0.0484,0.0441,0.1296,0.6724,0.7569,0.4356,0.0784,0.1225,0.5329,0.5041,0.4225,0.7921,0.0036,0.5184,0.5776,0.4096,0.8464,0.9604,0.355789286,0.214364286,0.497214286,24,75,17,53.13,4,50,5,62.5,4,50,4,50,16,100,1,6.25,76.88,79.25,79,67.75,81.5,77,76.75,21.87,23.75,29.25,16.5,17.75,31.5,-23,70.5,0,0,0,0,0,0,2,0,0,0,1,0,0,1,0,0,2,1,0,0,1,1,1,1,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0.4,0.4,0.6,1,0.6,0,0.6,0.35,0.55,8,8,0,0,0,0,0,5 cents,5 minutes,36 days,Male,University - Undergraduate,30,0.125,1,1,0,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,-1,-1,-1,-1,0,0,0,-1,0,1,0,0,1,0,-1,2,1,-1,-1,-1,-0.2,0.4,0,-0.2,C_Ug +1045,R_5fJDjeqC29H2TE5,25 - 31,American,Male,3,3,3,3,3,1,-2,-1,-3,-3,2,1,3,1,3,2,3,2,2,3,3,3,2,3,2,8,2,0,1,-2,1,9,2,2,3,2,3,8,2,2,3,2,3,8,3,3,3,3,3,8,2,2,2,2,3,7,2,2,3,3,0,7,2,3,2,2,2,8,FALSE,1,87,TRUE,1,94,FALSE,1,92,FALSE,1,54,TRUE,1,89,FALSE,1,91,TRUE,1,89,TRUE,1,83,TRUE,1,79,TRUE,1,85,FALSE,1,82,FALSE,1,63,FALSE,0,86,FALSE,1,90,TRUE,1,88,TRUE,1,86,TRUE,0,86,TRUE,0,88,FALSE,1,85,FALSE,1,90,TRUE,1,85,TRUE,1,86,TRUE,0,71,TRUE,1,87,FALSE,1,82,TRUE,1,90,FALSE,1,86,FALSE,1,90,FALSE,1,83,FALSE,0,93,TRUE,1,89,TRUE,1,82,0.0289,0.01,0.0196,0.0121,0.0324,0.0081,0.0169,0.0225,0.01,0.0196,0.8649,0.7396,0.0441,0.0324,0.0121,0.0036,0.5041,0.2116,0.01,0.0324,0.0225,0.0144,0.0225,0.01,0.7396,0.0196,0.0121,0.0169,0.0064,0.7744,0.0289,0.1369,0.156017857,0.180135714,0.1319,26,81.25,27,84.38,8,100,5,62.5,7,87.5,7,87.5,14,87.5,13,81.25,84.72,82.12,84.12,87.12,85.5,86.94,82.5,-3.13,0.34,-17.88,21.62,-0.38,-2,-0.56,1.25,0,0,1,0,1,1,2,2,1,4,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,4,3,5,6,0,1,0,2,3,0,0,0,0,1,0.4,2,0.4,0.4,0,3.8,1.2,0.2,0.8,1.3,8.33,7.33,0,2,1,0,1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),29,1.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,1,0,1,0,-2,-1,-4,-2,0,0,0,-1,-3,0,1,1,0,-1,0.4,-1.8,-0.8,0.2,-0.5,grad_prof +1046,R_5QBdYcwQpZ3JBiV,32 - 38,Canadian,Female,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,57,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1849,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.247675,0.24535,0.25,16,50,19,59.38,4,50,7,87.5,5,62.5,3,37.5,8,50,11,68.75,50.22,50,50.88,50,50,50.44,50,-9.38,-9.16,0,-36.62,-12.5,12.5,0.44,-18.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),37,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,HS_TS +1047,R_7axCMgMstvJ4z3X,25 - 31,American,Male,0,3,2,-1,0,-2,1,-3,1,2,-2,1,3,2,2,-2,-2,-1,-2,-1,1,3,3,1,0,10,1,1,0,-1,3,9,-1,3,2,3,2,10,1,1,1,0,1,10,1,3,3,3,2,7,2,-2,3,-2,2,5,1,0,2,3,2,5,3,3,3,3,3,8,TRUE,0,100,FALSE,0,63,FALSE,1,100,FALSE,1,53,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,65,TRUE,0,57,FALSE,0,65,TRUE,0,85,FALSE,0,60,FALSE,0,59,FALSE,1,57,FALSE,1,100,TRUE,0,58,TRUE,0,64,TRUE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,57,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,69,TRUE,1,72,0,0,0.3481,0,0.0784,0,0,0,0.4096,0.16,0,0.4225,0.2304,0.1225,0.0081,0.3969,0,0.2209,0,0,0.1444,0.36,0.3364,0.7225,0.1849,0.1849,0.0961,1,0,0,0.6561,0.3249,0.216410714,0.146378571,0.286442857,16,50,22,68.75,5,62.5,6,75,6,75,5,62.5,12,75,10,62.5,79.06,59.62,78.5,93.12,85,78.31,79.81,-18.75,10.31,-2.88,3.5,18.12,22.5,3.31,17.31,1,0,1,2,0,3,0,3,2,1,1,2,1,1,0,3,3,2,2,2,1,0,1,4,2,4,3,6,3,0,3,1,1,1,0,5,5,4,5,4,0.8,1.8,1,2.4,1.6,3.2,1.2,4.6,1.5,2.65,9.67,5.67,3,4,5,2,4,10 cents,100 minutes,47 days,Male,High School (or equivalent),31,0.75,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,0,0,0,-2,-2,-1,-3,-3,-1,1,-2,1,0,0,0,-2,-2,-2,-3,-2,-0.8,-1.4,-0.2,-2.2,-1.15,HS_TS +1048,R_5npjApQ2bVvcQA0,25 - 31,American,Female,2,2,2,2,2,3,-1,2,1,3,3,0,2,1,2,1,0,1,0,1,2,2,2,2,2,4,2,0,2,2,2,4,2,2,2,2,2,4,2,2,2,2,2,4,2,2,2,2,2,4,0,0,2,1,2,4,3,0,3,1,3,4,1,1,1,1,1,4,TRUE,0,65,FALSE,0,58,FALSE,1,87,FALSE,1,54,TRUE,1,59,FALSE,1,54,TRUE,1,55,TRUE,1,50,FALSE,0,54,FALSE,0,54,TRUE,0,55,TRUE,0,56,FALSE,0,55,TRUE,0,53,FALSE,0,52,TRUE,1,53,TRUE,0,54,TRUE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,52,FALSE,0,57,FALSE,1,54,TRUE,1,52,FALSE,1,53,TRUE,1,53,FALSE,1,56,TRUE,0,54,FALSE,1,53,TRUE,1,57,FALSE,0,55,TRUE,1,53,0.25,0.2209,0.2209,0.2025,0.2209,0.2116,0.2304,0.2916,0.2209,0.3249,0.1849,0.3025,0.2916,0.3025,0.1681,0.3364,0.2116,0.2116,0.2916,0.2209,0.2304,0.2704,0.2209,0.2809,0.2916,0.1936,0.3025,0.4225,0.0169,0.2809,0.2209,0.3136,0.252396429,0.250678571,0.254114286,11,34.38,18,56.25,3,37.5,6,75,3,37.5,6,75,9,56.25,9,56.25,55.5,54.62,54.25,55.38,57.75,54.31,56.69,-21.87,-0.75,17.12,-20.75,17.88,-17.25,-1.94,0.44,0,0,0,0,0,1,1,0,1,1,1,2,0,1,0,1,2,1,2,1,0,0,0,0,0,3,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0.8,0.8,1.4,0,1,0.4,0.4,0.75,0.45,4,4,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),29,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,0,0,-2,0,0,1,0,1,2,-1,1,-1,1,1,1,1,1,0,-0.2,0.4,1,0.3,HS_TS +1049,R_7JOviwR13qNO3cP,32 - 38,Canadian,Female,3,3,1,0,2,-3,-3,2,-1,2,2,3,3,3,2,-2,0,2,3,2,3,3,2,0,3,6,3,-2,2,0,2,6,3,2,2,-1,3,6,0,1,1,1,-2,6,3,3,2,0,2,6,0,-2,2,0,1,5,3,1,2,-1,1,6,1,0,1,2,3,5,TRUE,0,66,TRUE,1,80,TRUE,0,81,FALSE,1,59,TRUE,1,60,FALSE,1,63,TRUE,1,90,TRUE,1,90,TRUE,1,64,TRUE,1,85,TRUE,0,59,TRUE,0,81,TRUE,1,66,FALSE,1,54,TRUE,1,61,TRUE,1,72,TRUE,0,73,TRUE,0,100,TRUE,0,76,FALSE,1,58,TRUE,1,81,TRUE,1,69,FALSE,1,52,TRUE,1,59,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,56,TRUE,1,100,FALSE,0,52,TRUE,1,85,0.01,0,0.0784,0.01,0.0225,0.1369,0.1681,0.0225,0.1764,0.0961,0,0.1156,0.1296,0.3481,0.16,0.04,0.2304,0.1681,0.49,0.5625,0.0361,0.1521,0.5776,0.2116,0.5329,0.25,0.2704,0.4356,0.6561,1,0.3136,0.6561,0.284246429,0.129592857,0.4389,17,53.13,21,65.63,5,62.5,6,75,5,62.5,5,62.5,15,93.75,6,37.5,71.47,62.62,67,79.88,76.38,75.88,67.06,-12.5,5.84,0.12,-8,17.38,13.88,-17.87,29.56,0,0,1,0,1,6,1,0,1,0,1,1,1,4,1,2,1,1,2,4,0,0,1,0,0,3,1,0,1,1,1,2,1,4,1,3,0,1,1,1,0.4,1.6,1.6,2,0.2,1.2,1.8,1.2,1.4,1.1,6,5.67,0,1,0,1,0.33,10 cents,5 minutes,24 days,Female,High School (or equivalent),35,0.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,0,0,0,0,1,3,0,0,0,-1,0,-1,0,0,0,-1,1,0,1,3,0.2,0.4,-0.2,0.8,0.3,HS_TS +1050,R_63DxfW1B20fS2bN,32 - 38,Canadian,Female,3,3,2,-1,1,0,0,2,0,1,0,1,3,-1,2,0,1,1,0,-2,3,2,2,-1,1,4,-3,1,1,3,2,3,3,3,3,1,3,1,-3,0,-1,-3,-1,5,3,3,2,0,0,2,0,-2,2,0,0,3,0,0,3,-2,0,1,0,0,0,0,0,5,FALSE,1,90,FALSE,0,75,FALSE,1,90,FALSE,1,50,TRUE,1,75,FALSE,1,80,TRUE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,95,TRUE,0,100,TRUE,1,90,FALSE,1,90,TRUE,1,50,FALSE,0,90,FALSE,1,80,TRUE,0,60,FALSE,1,50,FALSE,1,50,TRUE,1,95,TRUE,1,90,FALSE,1,95,TRUE,1,75,FALSE,1,95,TRUE,1,90,FALSE,1,50,FALSE,1,50,TRUE,0,60,FALSE,0,95,TRUE,1,50,TRUE,1,100,0,0.01,0.81,0.0625,0,0.04,0.0625,0.0025,0.25,0.01,0.9025,0.01,0.25,0.0025,0.0625,0.5625,0.0025,0.25,0.25,0.0025,0.0025,0.25,0.25,0.01,0.04,0.25,0.25,0.01,0.01,0.36,0.36,1,0.194732143,0.171964286,0.2175,25,78.13,25,78.13,6,75,7,87.5,7,87.5,5,62.5,12,75,13,81.25,77.5,58.75,84.38,85.62,81.25,80.94,74.06,0,-0.63,-16.25,-3.12,-1.88,18.75,5.94,-7.19,0,1,0,0,0,3,1,1,3,1,3,2,0,2,1,3,1,2,3,1,0,0,0,1,1,0,2,0,0,1,0,1,0,1,2,0,1,1,0,2,0.2,1.8,1.6,2,0.4,0.6,0.8,0.8,1.4,0.65,2.67,2,2,0,0,0,0.67,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,0,1,0,-1,-1,3,-1,1,3,0,3,1,0,1,-1,3,0,1,3,-1,-0.2,1.2,0.8,1.2,0.75,C_Ug +1051,R_50ctFWHn1sR6MOg,32 - 38,Canadian,Female,3,3,3,2,3,1,-3,2,-3,2,3,-2,3,0,3,0,2,2,1,-1,3,3,3,2,3,6,1,-3,1,-3,2,6,3,-3,3,1,3,6,0,0,1,0,-1,5,2,2,2,1,2,5,2,-3,2,-3,2,5,3,-2,3,-1,3,2,0,0,0,0,0,5,TRUE,0,87,TRUE,1,86,TRUE,0,99,FALSE,1,67,TRUE,1,77,FALSE,1,99,FALSE,0,100,TRUE,1,100,FALSE,0,71,TRUE,1,90,FALSE,1,96,TRUE,0,88,FALSE,0,68,TRUE,0,100,FALSE,0,72,TRUE,1,98,FALSE,1,67,TRUE,0,90,FALSE,1,71,FALSE,1,90,FALSE,0,72,TRUE,1,95,FALSE,1,68,TRUE,1,98,FALSE,1,61,TRUE,1,88,TRUE,0,63,TRUE,0,91,TRUE,0,87,TRUE,1,98,FALSE,0,57,TRUE,1,93,0,0.0144,0.0004,1,0.0049,0.0001,0.0004,0.01,0.01,0.0025,0.0004,0.4624,0.5041,0.0016,0.0529,0.0196,0.1024,0.1089,0.8281,0.1521,0.5184,0.5184,0.0841,1,0.1089,0.3969,0.3249,0.7569,0.9801,0.81,0.7569,0.7744,0.331796429,0.091442857,0.57215,22,68.75,18,56.25,4,50,5,62.5,4,50,5,62.5,10,62.5,8,50,83.97,72.88,78.88,88.88,95.25,85.19,82.75,12.5,27.72,22.88,16.38,38.88,32.75,22.69,32.75,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,2,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,2,2,1,1,0,0.2,0.4,0.8,1,0.2,0.2,1.2,0.35,0.65,6,4,1,1,4,0,2,10 cents,100 minutes,36 days,Female,University - PhD,38,1.25,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,-1,-1,-1,-1,-1,-1,0,1,0,0,0,1,0,0,0,0,0,-1,0,-1,-1,0,0.2,-0.4,-0.3,grad_prof +1052,R_7zVcxc8cgaWuoj3,18 - 24,Canadian,Female,0,1,-2,-3,2,-3,1,3,-3,2,-2,-1,2,0,-1,1,1,1,0,0,1,0,0,-3,-3,3,-3,1,3,-3,2,1,-3,-2,3,0,-2,2,0,0,0,-2,0,6,0,1,-2,-2,1,4,-3,0,3,-3,2,4,-3,0,3,0,-2,3,1,1,1,1,0,3,TRUE,0,61,TRUE,1,88,TRUE,0,78,FALSE,1,54,TRUE,1,96,FALSE,1,50,TRUE,1,77,TRUE,1,91,TRUE,1,96,TRUE,1,93,FALSE,1,50,TRUE,0,96,TRUE,1,66,TRUE,0,50,TRUE,1,69,TRUE,1,94,TRUE,0,55,TRUE,0,55,TRUE,0,89,FALSE,1,82,TRUE,1,58,TRUE,1,95,FALSE,1,96,TRUE,1,82,FALSE,1,91,TRUE,1,92,FALSE,1,50,FALSE,1,55,FALSE,1,58,TRUE,1,76,FALSE,0,50,TRUE,1,95,0.0081,0.0064,0.0036,0.0529,0.0025,0.25,0.0324,0.0049,0.0324,0.0025,0.0576,0.1156,0.0016,0.25,0.0016,0.0144,0.0016,0.2116,0.2025,0.0081,0.1764,0.0961,0.7921,0.25,0.3025,0.25,0.25,0.3721,0.6084,0.3025,0.1764,0.9216,0.203121429,0.069907143,0.336335714,22,68.75,24,75,6,75,7,87.5,5,62.5,6,75,15,93.75,9,56.25,74.62,68.25,71.75,76.75,81.75,82.38,66.88,-6.25,-0.38,-6.75,-15.75,14.25,6.75,-11.37,10.63,1,1,2,0,5,0,0,0,0,0,1,1,1,0,1,1,1,1,2,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1.8,0,0.8,1,0.4,0.2,0.8,0.2,0.9,0.4,2,3.67,-1,-3,-1,3,-1.67,10 cents,5 minutes,47 days,Female,University - Undergraduate,24,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,1,1,2,-1,4,0,-1,0,0,0,0,0,0,0,0,1,1,1,1,0,1.4,-0.2,0,0.8,0.5,C_Ug +1053,R_7Wm0ehpn1dyWifT,32 - 38,Canadian,Female,-2,-1,1,2,3,-1,-2,3,0,1,1,0,1,1,1,-1,-1,-1,-1,-2,0,-2,-1,-3,0,3,-1,2,2,3,3,6,-1,-3,0,3,-2,6,2,3,3,2,1,5,1,-1,2,1,3,5,1,-1,3,-2,1,6,2,2,3,0,2,3,-1,-1,-1,-1,-2,7,TRUE,0,94,FALSE,0,50,TRUE,0,74,TRUE,0,55,FALSE,0,50,TRUE,0,55,TRUE,1,100,TRUE,1,60,FALSE,0,53,TRUE,1,79,TRUE,0,55,FALSE,1,100,TRUE,1,62,TRUE,0,59,TRUE,1,54,TRUE,1,58,TRUE,0,82,TRUE,0,100,FALSE,1,70,FALSE,1,50,TRUE,1,64,FALSE,0,53,FALSE,1,52,TRUE,1,55,TRUE,0,82,TRUE,1,92,TRUE,0,50,TRUE,0,53,TRUE,0,51,TRUE,1,92,FALSE,0,50,FALSE,0,53,0.16,0.0064,0.1764,0,0.2809,0.3025,0.2025,0.0441,0.25,0.2809,0.0064,0.1444,0.2809,0.3025,0.25,0.25,0.2304,0.3025,0.2809,0.6724,0.1296,0.2116,0.09,0.3481,0.6724,0.25,0.25,0.8836,0.5476,1,0.2601,0,0.311582143,0.223428571,0.399735714,18,56.25,14,43.75,2,25,3,37.5,3,37.5,6,75,10,62.5,4,25,65.84,54.62,58.62,82.38,67.75,64.06,67.62,12.5,22.09,29.62,21.12,44.88,-7.25,1.56,42.62,2,1,2,5,3,0,4,1,3,2,2,3,1,2,3,3,4,4,3,3,3,0,1,1,0,2,1,0,2,0,1,2,2,1,1,0,0,0,0,0,2.6,2,2.2,3.4,1,1,1.4,0,2.55,0.85,5,4.67,-2,0,3,-2,0.33,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),36,0.875,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,-1,1,1,4,3,-2,3,1,1,2,1,1,-1,1,2,3,4,4,3,3,1.6,1,0.8,3.4,1.7,grad_prof +1054,R_14AiiVMvOeu3nV1,32 - 38,Canadian,Female,3,2,2,0,2,1,-3,3,-2,1,2,-1,1,-2,2,1,2,2,2,1,3,2,2,-1,2,1,1,-3,2,-2,1,1,2,-1,1,-1,2,1,2,2,2,1,1,1,3,2,2,0,2,1,1,-3,2,-2,0,1,2,-1,2,-2,2,0,2,2,2,2,1,3,FALSE,1,99,TRUE,1,89,FALSE,1,88,FALSE,1,57,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,92,TRUE,0,100,TRUE,1,89,FALSE,1,97,TRUE,1,89,TRUE,1,100,TRUE,0,96,FALSE,1,98,FALSE,1,88,FALSE,1,92,FALSE,0,81,TRUE,1,88,FALSE,1,98,TRUE,1,100,FALSE,1,94,TRUE,1,100,FALSE,1,80,FALSE,1,100,FALSE,1,72,TRUE,1,98,FALSE,0,63,TRUE,1,100,0,0,0,0,0,0,0,0,0.0064,0.0144,0.0004,0.0121,0.0004,0.0064,0.0049,0.0121,0.0004,0.1849,0,0.0036,0.6561,0.0121,0.0144,0.0009,0.9216,0.04,0.3969,0.0001,0.0144,0.0004,0.0784,1,0.120760714,0.017314286,0.224207143,26,81.25,28,87.5,7,87.5,6,75,8,100,7,87.5,14,87.5,14,87.5,91.84,82,91.12,97,97.25,93,90.69,-6.25,4.34,-5.5,16.12,-3,9.75,5.5,3.19,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0.2,0.2,0.2,0.4,0,0.4,0.2,0.2,0.25,0.2,1,0.67,0,0,1,-2,0.33,10 cents,5 minutes,15 days,Female,University - Undergraduate,35,1.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,0,0,0,1,0,0,0,0,0,-1,0,0,-1,1,0,0,0,0,1,0,0.2,-0.2,0,0.2,0.05,C_Ug +1055,R_7iUqK9XSmc5WjKy,32 - 38,Canadian,Female,2,3,2,1,3,2,1,3,1,2,3,2,3,3,2,2,1,1,1,1,2,3,3,3,2,4,2,1,2,2,3,3,2,2,2,2,3,3,2,1,2,1,2,3,3,3,2,3,3,6,2,2,2,1,1,8,3,2,3,2,2,4,2,3,2,3,-2,8,FALSE,1,68,FALSE,0,57,TRUE,0,100,FALSE,1,55,TRUE,1,72,FALSE,1,54,TRUE,1,99,TRUE,1,100,FALSE,0,63,FALSE,0,59,TRUE,0,66,TRUE,0,97,TRUE,1,96,TRUE,0,78,TRUE,1,79,TRUE,1,96,TRUE,0,69,TRUE,0,64,TRUE,0,89,FALSE,1,66,TRUE,1,79,TRUE,1,80,TRUE,0,92,TRUE,1,97,TRUE,0,74,TRUE,1,94,FALSE,1,62,TRUE,0,78,TRUE,0,74,TRUE,1,84,FALSE,0,64,FALSE,0,83,0,0.0036,0.0016,0.0001,0.6889,0.2116,0.0009,0.3481,0.1156,0.04,0.0256,0.0016,0.3969,0.4356,0.0784,0.3249,0.8464,0.2025,0.6084,0.5476,0.0441,0.0441,0.7921,0.6084,0.4761,0.1444,0.4096,0.1024,1,0.4096,0.5476,0.9409,0.371153571,0.2655,0.476807143,17,53.13,16,50,3,37.5,4,50,4,50,5,62.5,11,68.75,5,31.25,77.75,66.88,77.38,77,89.75,81.38,74.12,3.13,27.75,29.38,27.38,27,27.25,12.63,42.87,0,0,1,2,1,0,0,1,1,1,1,0,1,1,1,0,0,1,0,1,1,0,0,2,0,0,1,1,0,1,0,0,0,1,0,0,2,1,2,3,0.8,0.6,0.8,0.4,0.6,0.6,0.2,1.6,0.65,0.75,3.33,6,-2,-5,-1,-5,-2.67,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),35,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,-1,0,1,0,1,0,-1,0,1,0,1,0,1,0,1,0,-2,0,-2,-2,0.2,0,0.6,-1.2,-0.1,grad_prof +1056,R_10jBeCnb04zrIat,32 - 38,Canadian,Male,-2,2,2,-2,2,-1,-1,3,-2,2,-2,-3,3,-2,3,2,2,2,2,1,-3,2,3,-2,2,3,0,0,3,-3,2,2,-2,-3,3,2,3,3,2,2,2,2,2,2,0,2,2,2,2,2,0,0,3,-2,0,2,-3,-3,3,-2,3,1,0,0,0,2,0,5,FALSE,1,70,TRUE,1,50,TRUE,0,81,FALSE,1,50,FALSE,0,50,FALSE,1,90,TRUE,1,92,FALSE,0,76,FALSE,0,70,TRUE,1,76,FALSE,1,75,TRUE,0,80,FALSE,0,50,TRUE,0,91,FALSE,0,50,TRUE,1,81,FALSE,1,50,TRUE,0,80,FALSE,1,90,FALSE,1,100,FALSE,0,70,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,75,TRUE,1,91,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,1,50,0.5776,0.0081,0.0361,0.0064,0.25,0.01,0.25,0.0576,0,0.25,0.0625,0.25,0.49,0.0625,0.25,0.25,0.25,0.25,0.25,0.5625,0.49,0.25,0.01,0.8281,0.25,0.25,0.25,0.09,0.6561,0.64,0.25,0.64,0.289260714,0.191614286,0.386907143,5,15.63,18,56.25,5,62.5,5,62.5,4,50,4,50,7,43.75,11,68.75,67.59,60.62,57.5,78.12,74.12,64.44,70.75,-40.62,11.34,-1.88,-5,28.12,24.12,20.69,2,1,0,1,0,0,1,1,0,1,0,0,0,0,4,0,0,0,0,0,1,2,0,0,4,0,1,1,0,0,2,1,0,0,0,0,2,2,2,0,1,0.4,0.6,0.8,0.2,1.2,0.8,0.2,1.4,0.5,0.9,2.67,1.67,1,0,2,-3,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,36,1.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,-1,0,1,-4,0,0,0,0,1,-2,-1,0,0,4,0,-2,-2,-2,0,0,-0.8,-0.2,0.6,-1.2,-0.4,C_Ug +1057,R_5gXU659OXdRsSdG,32 - 38,Canadian,Female,2,2,0,-1,-1,-2,1,1,2,0,2,-1,1,-2,3,-1,-1,-1,1,-1,-1,2,2,-3,2,5,-3,0,1,2,2,3,2,2,-1,1,2,4,1,1,1,2,0,3,2,1,0,2,-1,3,-2,1,1,0,1,2,1,0,3,-3,3,3,0,-1,0,2,-1,4,FALSE,1,100,TRUE,1,75,TRUE,0,100,FALSE,1,51,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,50,TRUE,0,70,TRUE,0,90,TRUE,1,75,FALSE,1,60,FALSE,0,100,TRUE,1,100,TRUE,0,90,TRUE,0,52,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,91,TRUE,0,50,TRUE,0,75,TRUE,0,100,TRUE,1,100,FALSE,0,60,FALSE,0,91,0,0.0081,0,0,0.8281,0,0,0.25,0.25,0,0,0.0625,0.01,0.49,0.01,0.0625,0,0.2401,0.5625,0.01,0,1,1,0.16,0.81,0.25,0.36,0,1,0.2704,1,0.81,0.337003571,0.157371429,0.516635714,16,50,20,62.5,3,37.5,5,62.5,7,87.5,5,62.5,13,81.25,7,43.75,84.38,74.5,93.25,80.38,89.38,88.88,79.88,-12.5,21.88,37,30.75,-7.12,26.88,7.63,36.13,3,0,2,2,3,1,1,0,0,2,0,3,2,3,1,2,2,2,1,1,0,1,0,3,0,0,0,0,2,1,1,1,2,1,0,1,0,1,1,0,2,0.8,1.8,1.6,0.8,0.6,1,0.6,1.55,0.75,4,2.67,2,1,1,-1,1.33,10 cents,5 minutes,47 days,Female,High School (or equivalent),32,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,3,-1,2,-1,3,1,1,0,-2,1,-1,2,0,2,1,1,2,1,0,1,1.2,0.2,0.8,1,0.8,HS_TS +1058,R_75Fb2p82PhEaCGb,32 - 38,Canadian,Female,3,3,2,-2,-2,-2,1,-1,1,1,3,0,2,1,3,-2,1,0,-2,-2,1,3,2,1,-2,1,1,2,-1,2,1,3,3,0,1,0,3,1,0,1,1,-3,-2,2,3,3,2,0,-2,1,0,0,1,0,1,4,3,0,2,2,3,1,1,1,1,1,-2,6,FALSE,1,100,TRUE,1,75,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,85,FALSE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,90,FALSE,1,100,TRUE,1,80,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,70,FALSE,0,50,TRUE,1,60,TRUE,1,91,0,0,0,0,0.0081,0,0.01,0,0,0.0225,0.25,0.7225,0,0,0,0.0625,0,0.25,0,0,0.04,0.25,0.01,0.0025,0,0.25,0.16,0,0,1,0.49,0,0.126003571,0.094685714,0.157321429,28,87.5,27,84.38,7,87.5,6,75,7,87.5,7,87.5,14,87.5,13,81.25,88.16,71.88,90.75,97.5,92.5,85.38,90.94,3.12,3.78,-15.62,15.75,10,5,-2.12,9.69,2,0,0,3,0,3,1,0,1,0,0,0,1,1,0,2,0,1,1,0,0,0,0,2,0,2,1,2,1,0,0,0,0,1,0,3,0,1,3,0,1,1,0.4,0.8,0.4,1.2,0.2,1.4,0.8,0.8,1.67,2,0,-1,0,-4,-0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),33,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,2,0,0,1,0,1,0,-2,0,0,0,0,1,0,0,-1,0,0,-2,0,0.6,-0.2,0.2,-0.6,0,HS_TS +1059,R_15F05olnqxr8h3U,32 - 38,Canadian,Male,2,2,2,1,-1,-1,-1,1,1,1,2,1,1,1,2,-1,1,1,-1,-1,2,2,2,-1,-1,3,-2,-2,1,1,-1,3,2,1,1,2,1,3,-1,1,-1,-1,-1,6,2,2,2,1,-1,3,-1,-2,1,1,1,4,2,1,1,1,2,3,1,1,1,1,1,4,TRUE,0,86,TRUE,1,51,TRUE,0,60,FALSE,1,51,TRUE,1,60,FALSE,1,75,TRUE,1,59,TRUE,1,60,TRUE,1,79,TRUE,1,60,FALSE,1,51,TRUE,0,54,TRUE,1,70,TRUE,0,55,FALSE,0,70,TRUE,1,80,TRUE,0,51,TRUE,0,60,FALSE,1,51,FALSE,1,51,FALSE,0,60,TRUE,1,60,FALSE,1,90,TRUE,1,70,TRUE,0,55,TRUE,1,65,TRUE,0,52,FALSE,1,52,TRUE,0,59,TRUE,1,60,TRUE,1,51,TRUE,1,60,0.16,0.1225,0.04,0.1681,0.16,0.0625,0.09,0.16,0.2401,0.16,0.16,0.09,0.0441,0.2401,0.16,0.2401,0.01,0.2401,0.2304,0.3025,0.36,0.49,0.2401,0.3025,0.2601,0.2704,0.2401,0.7396,0.36,0.36,0.3481,0.2916,0.244728571,0.146928571,0.342528571,14,43.75,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,61.5,57,65.62,62.5,60.88,63.44,59.56,-21.88,-4.13,-18,3.12,12.5,-14.12,-24.06,15.81,0,0,0,2,0,1,1,0,0,2,0,0,0,1,1,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,2,2,0.4,0.8,0.4,0.4,0,0.2,0,1.2,0.5,0.35,3,3.33,0,-1,0,2,-0.33,10 cents,25 minutes,47 days,Male,College Diploma/Certificate,36,1,0,0,1,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,0,0,0,2,0,1,0,0,0,2,0,0,0,1,1,-2,0,2,-2,-2,0.4,0.6,0.4,-0.8,0.15,C_Ug +1060,R_3k0Wezenu6zwiKK,32 - 38,Canadian,Male,1,3,3,3,2,1,1,2,-1,2,2,2,2,2,2,0,0,1,0,0,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,2,2,2,2,2,6,2,2,2,2,2,8,1,1,1,1,1,8,2,2,2,2,2,7,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,1,54,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,80,TRUE,1,69,FALSE,1,77,TRUE,1,100,TRUE,0,69,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,86,TRUE,1,100,TRUE,1,81,TRUE,1,100,0,0,0,0.25,0,0,0,0.25,0,0.0961,0,0.25,0.2116,0.25,0,0.25,0.0529,0.25,1,0.4761,0.04,0,0.25,0.25,0.6561,1,0.0361,0.25,0.25,1,0.7396,1,0.305660714,0.115042857,0.496278571,16,50,19,59.38,4,50,6,75,4,50,5,62.5,16,100,3,18.75,78.03,66.88,84.25,67.25,93.75,80.25,75.81,-9.38,18.65,16.88,9.25,17.25,31.25,-19.75,57.06,0,2,2,2,1,0,0,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,3,0,1,1,1,1,1,2,2,1,2,2,1.4,0.8,1,0.8,0.8,1,1,1.8,1,1.15,7,7.33,1,-1,-1,0,-0.33,10 cents,100 minutes,24 days,Male,University - Undergraduate,32,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,-1,1,1,1,1,-1,-1,1,-1,1,0,0,0,0,0,-1,-1,-1,-1,-1,0.6,-0.2,0,-1,-0.15,C_Ug +1061,R_5aXOQw00ax7DfeZ,32 - 38,Canadian,Female,2,2,2,2,2,0,0,0,0,0,3,0,0,0,0,-3,-3,-3,-3,-3,2,2,2,2,2,8,0,0,0,0,0,8,3,0,0,0,0,8,2,2,2,-3,-3,8,2,2,2,2,2,8,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,8,TRUE,0,51,FALSE,0,51,TRUE,0,81,FALSE,1,51,TRUE,1,52,FALSE,1,81,FALSE,0,52,TRUE,1,52,FALSE,0,52,TRUE,1,51,FALSE,1,51,TRUE,0,51,TRUE,1,64,FALSE,1,51,TRUE,1,53,TRUE,1,51,TRUE,0,51,FALSE,1,52,FALSE,1,51,FALSE,1,51,TRUE,1,53,TRUE,1,59,TRUE,0,54,TRUE,1,53,TRUE,0,51,TRUE,1,59,FALSE,1,52,FALSE,1,52,FALSE,1,52,FALSE,0,53,FALSE,0,52,FALSE,0,51,0.2304,0.1681,0.2401,0.2704,0.2601,0.0361,0.2209,0.2401,0.2401,0.1681,0.2809,0.1296,0.2704,0.2401,0.2304,0.2601,0.2916,0.2401,0.2304,0.2601,0.2209,0.2209,0.2401,0.2401,0.2601,0.2304,0.2704,0.2601,0.6561,0.2304,0.2304,0.2601,0.247110714,0.222042857,0.272178571,1,3.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,10,62.5,10,62.5,54.41,51.62,57.25,53.25,55.5,53.62,55.19,-59.37,-8.09,-10.88,-5.25,-9.25,-7,-8.88,-7.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,3,3,3,3,3,0,0,0,3,0,0,0.6,3,0.75,0.9,8,8,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),38,0.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,2,2,2,-3,-3,0,0,-0.6,0,-0.15,grad_prof +1062,R_6aaSjwMz2a04kQ9,32 - 38,Canadian,Female,3,3,3,3,3,3,-3,3,-2,0,3,3,3,0,3,1,-1,0,0,-3,3,3,3,3,3,0,2,-3,1,0,2,4,3,3,3,0,3,2,-3,-3,-3,-3,-3,0,3,3,3,3,3,2,1,-3,3,-2,2,9,3,3,3,0,3,9,0,0,0,0,-2,5,FALSE,1,80,TRUE,1,100,TRUE,0,64,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0081,0,0,0.25,0,0.5625,0.25,1,0.25,0,0.01,0,0,1,0,0,0.04,0.4096,0,1,0,0.170721429,0.076471429,0.264971429,25,78.13,26,81.25,8,100,4,50,8,100,6,75,15,93.75,11,68.75,92.19,92.5,89.5,91.25,95.5,95.69,88.69,-3.12,10.94,-7.5,39.5,-8.75,20.5,1.94,19.94,0,0,0,0,0,1,0,2,2,2,0,0,0,0,0,4,2,3,3,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,1,0,0,1,0,1.4,0,2.4,0,0.8,0,0.6,0.95,0.35,2,6.67,-2,-5,-7,-5,-4.67,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,0,0,0,0,0,-1,0,2,2,0,0,0,0,0,0,3,1,3,3,-1,0,0.6,0,1.8,0.6,C_Ug +1063,R_1TFlsEbpSCpaLq9,18 - 24,Canadian,Female,3,3,1,-1,0,1,1,-1,3,3,1,2,3,1,2,-2,1,1,1,-1,3,3,1,3,1,2,-2,3,-3,3,-1,6,-3,1,-2,3,-2,4,-3,-3,-3,-2,-3,10,3,3,3,2,3,5,2,-1,3,-2,3,3,0,3,3,-1,3,3,2,3,2,3,1,8,TRUE,0,82,FALSE,0,52,TRUE,0,100,FALSE,1,54,TRUE,1,53,FALSE,1,65,FALSE,0,54,TRUE,1,100,TRUE,1,75,TRUE,1,63,FALSE,1,54,TRUE,0,100,FALSE,0,52,TRUE,0,59,FALSE,0,53,FALSE,0,52,TRUE,0,62,TRUE,0,100,TRUE,0,53,FALSE,1,52,TRUE,1,51,FALSE,0,54,FALSE,1,100,TRUE,1,60,FALSE,1,52,TRUE,1,91,TRUE,0,55,TRUE,0,52,TRUE,0,65,TRUE,1,91,FALSE,0,51,TRUE,1,100,0,0.0081,0.2704,0.2916,0,0.1225,0.16,0.1369,0.2304,0.2916,0.0081,0.2704,0.0625,0.2116,0.2209,0.2704,0,0.2116,0.2704,0.2304,0.2401,0.2809,0.2809,0.3481,0.3844,0.3025,0.2601,0.6724,1,1,0.4225,1,0.317485714,0.156921429,0.47805,17,53.13,15,46.88,3,37.5,5,62.5,3,37.5,4,50,9,56.25,6,37.5,67.41,55.88,68.5,69.38,75.88,65.75,69.06,6.25,20.53,18.38,6,31.88,25.88,9.5,31.56,0,0,0,4,1,3,2,2,0,4,4,1,5,2,4,1,4,4,3,2,0,0,2,3,3,1,2,4,5,0,1,1,0,2,1,4,2,1,2,2,1,2.2,3.2,2.8,1.6,2.4,1,2.2,2.3,1.8,4,3.67,-3,3,1,2,0.33,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,0,0,-2,1,-2,2,0,-2,-5,4,3,0,5,0,3,-3,2,3,1,0,-0.6,-0.2,2.2,0.6,0.5,HS_TS diff --git a/eohi1/eohi_calibration_correlations_summary.csv b/eohi1/eohi_calibration_correlations_summary.csv new file mode 100644 index 0000000..850d659 --- /dev/null +++ b/eohi1/eohi_calibration_correlations_summary.csv @@ -0,0 +1,81 @@ +eohi_var,cal_var,n,pearson_r,pearson_ci_lower,pearson_ci_upper,pearson_p,spearman_rho,spearman_ci_lower,spearman_ci_upper,spearman_p +eohi_mean,cal_selfActual,1063,-0.09447,-0.15019,-0.0362,0.00205,-0.11288,-0.1699,-0.05351,0.00023 +eohi_val,cal_selfActual,1063,-0.09384,-0.15347,-0.03616,0.00219,-0.09963,-0.16267,-0.04046,0.00114 +eohi_pers,cal_selfActual,1063,-0.07652,-0.12898,-0.01613,0.01258,-0.08281,-0.14357,-0.02535,0.00691 +eohiDGEN_pref,cal_15,1063,0.11449,0.04892,0.17239,0.00018,0.08071,0.01776,0.13995,0.00847 +eohi_pers,cal_55,1063,-0.06004,-0.1185,-0.0065,0.05036,-0.07699,-0.13816,-0.01519,0.01204 +eohi_mean,cal_55,1063,-0.06632,-0.11782,-0.01552,0.03061,-0.07588,-0.13634,-0.01868,0.01333 +eohiDGEN_val,cal_55,1063,-0.05006,-0.1073,0.00598,0.10281,-0.06964,-0.12753,-0.01077,0.02318 +eohiDGEN_mean,cal_true,1063,0.05754,-0.0009,0.11652,0.06074,0.0676,0.00725,0.12602,0.02754 +eohiDGEN_life,cal_75,1063,-0.04564,-0.10516,0.01314,0.13702,-0.05638,-0.11573,0.00538,0.06615 +eohi_life,cal_75,1063,-0.03875,-0.09577,0.01879,0.20683,-0.05565,-0.11564,0.00491,0.06974 +eohiDGEN_mean,cal_15,1063,0.07628,0.01598,0.13615,0.01285,0.05395,-0.00598,0.11493,0.0787 +eohi_val,cal_55,1063,-0.05666,-0.10898,-0.00182,0.06479,-0.05346,-0.10885,0.00265,0.0815 +eohiDGEN_life,cal_55,1063,0.05044,-0.00773,0.10614,0.10026,0.04956,-0.00878,0.11087,0.10635 +eohiDGEN_pref,cal_true,1063,0.07292,0.0095,0.134,0.01741,0.04803,-0.0094,0.108,0.11761 +eohi_pref,cal_selfActual,1063,-0.03281,-0.09762,0.032,0.28519,-0.04423,-0.10373,0.01867,0.14958 +eohiDGEN_val,cal_false,1063,-0.02787,-0.09239,0.03411,0.36398,-0.04393,-0.10451,0.01416,0.15236 +eohiDGEN_pers,cal_15,1063,0.04714,-0.01715,0.10944,0.12451,0.04308,-0.01746,0.10317,0.16046 +eohiDGEN_life,cal_false,1063,0.03476,-0.02508,0.09492,0.25753,0.04047,-0.02102,0.10411,0.18735 +eohi_life,cal_true,1063,-0.02269,-0.08192,0.0416,0.45982,-0.03779,-0.0985,0.01964,0.21833 +eohiDGEN_life,cal_15,1063,0.05091,-0.01796,0.11623,0.09709,0.03755,-0.02524,0.09835,0.22121 +eohiDGEN_life,cal_true,1063,-0.00526,-0.06612,0.05833,0.86395,-0.03744,-0.09633,0.02643,0.22263 +eohiDGEN_life,cal_selfActual,1063,0.02779,-0.03579,0.0868,0.36538,0.03688,-0.02625,0.10029,0.22962 +eohi_val,cal_75,1063,-0.03432,-0.09303,0.02511,0.26362,-0.03548,-0.09664,0.02788,0.24775 +eohiDGEN_val,cal_selfActual,1063,0.02114,-0.04078,0.08546,0.49105,0.03547,-0.02636,0.09663,0.24789 +eohiDGEN_pers,cal_true,1063,0.02354,-0.03617,0.08422,0.44334,0.03532,-0.02544,0.09158,0.24994 +eohiDGEN_pers,cal_35,1063,-0.03495,-0.09252,0.02312,0.25493,-0.03489,-0.09183,0.02535,0.25578 +eohiDGEN_pers,cal_75,1063,-0.01611,-0.07516,0.04168,0.59971,-0.03379,-0.08928,0.02687,0.271 +eohiDGEN_pers,cal_false,1063,-0.02503,-0.08151,0.03334,0.4149,-0.03266,-0.08708,0.02624,0.28745 +eohiDGEN_val,cal_global,1063,-0.00447,-0.05803,0.05482,0.8843,-0.03204,-0.08825,0.0252,0.29666 +eohiDGEN_mean,cal_55,1063,-0.03699,-0.08943,0.01668,0.2282,-0.02929,-0.08473,0.03097,0.34006 +eohiDGEN_pers,cal_selfActual,1063,-0.03827,-0.10619,0.02517,0.21254,-0.02835,-0.09145,0.03191,0.35572 +eohi_life,cal_selfActual,1063,0.04737,-0.01652,0.10847,0.12274,0.02825,-0.03176,0.08666,0.35753 +eohi_mean,cal_75,1063,-0.01187,-0.06715,0.04855,0.69916,-0.0275,-0.0859,0.03279,0.37045 +eohiDGEN_val,cal_15,1063,0.00914,-0.04676,0.06618,0.76607,-0.02707,-0.08456,0.02837,0.37789 +eohi_pref,cal_55,1063,-0.02632,-0.08106,0.02643,0.39136,-0.02524,-0.08705,0.03558,0.41101 +eohiDGEN_pref,cal_35,1063,-0.00852,-0.0681,0.0469,0.78147,-0.02501,-0.08136,0.03028,0.41525 +eohi_val,cal_global,1063,-0.03245,-0.08628,0.02097,0.29049,-0.02445,-0.0837,0.03405,0.42589 +eohiDGEN_pref,cal_global,1063,0.05135,-0.00854,0.10781,0.09423,0.02438,-0.03698,0.07747,0.42716 +eohi_mean,cal_global,1063,-0.00987,-0.0669,0.04625,0.74782,-0.02423,-0.08093,0.03538,0.43002 +eohi_mean,cal_false,1063,0.00103,-0.05609,0.05796,0.97329,-0.02413,-0.08528,0.034,0.43184 +eohi_pers,cal_15,1063,0.0424,-0.01973,0.10006,0.16717,0.02377,-0.03499,0.07967,0.4388 +eohiDGEN_pref,cal_75,1063,0.04194,-0.01865,0.10462,0.17182,0.02253,-0.03687,0.08394,0.46315 +eohi_val,cal_35,1063,0.00919,-0.04488,0.06395,0.76478,-0.02132,-0.07724,0.0359,0.48748 +eohiDGEN_mean,cal_75,1063,0.02182,-0.03779,0.08058,0.47734,0.02086,-0.0387,0.08009,0.49684 +eohi_val,cal_15,1063,-0.0114,-0.06675,0.04342,0.71036,0.02045,-0.0384,0.08265,0.50533 +eohiDGEN_mean,cal_global,1063,0.01728,-0.04015,0.07341,0.5736,0.01974,-0.03874,0.07654,0.52029 +eohiDGEN_val,cal_true,1063,0.03211,-0.02651,0.08716,0.29554,0.01936,-0.04555,0.08179,0.52834 +eohi_mean,cal_15,1063,0.02437,-0.03634,0.08546,0.42732,0.01772,-0.03986,0.07648,0.56377 +eohiDGEN_pers,cal_55,1063,-0.02109,-0.07397,0.03478,0.49211,-0.0175,-0.0759,0.04546,0.56869 +eohiDGEN_mean,cal_selfActual,1063,0.00131,-0.05794,0.06413,0.96594,0.0169,-0.04525,0.07532,0.582 +eohi_life,cal_false,1063,0.02929,-0.02351,0.0794,0.34004,0.01689,-0.04339,0.07467,0.58238 +eohiDGEN_mean,cal_false,1063,-0.02032,-0.07402,0.03873,0.5082,-0.01576,-0.07583,0.04145,0.60773 +eohiDGEN_pref,cal_55,1063,-0.01025,-0.064,0.04642,0.73848,-0.01542,-0.0708,0.046,0.61559 +eohi_life,cal_35,1063,0.03599,-0.02203,0.08892,0.24108,0.01538,-0.04474,0.07414,0.61636 +eohi_pers,cal_false,1063,-0.00935,-0.06513,0.04644,0.76086,-0.01485,-0.07336,0.04336,0.62859 +eohi_life,cal_15,1063,0.0156,-0.0452,0.07483,0.61145,0.01432,-0.04315,0.07438,0.64092 +eohi_pers,cal_true,1063,0.0055,-0.05876,0.07464,0.85794,-0.01291,-0.06976,0.04539,0.67419 +eohi_pref,cal_75,1063,0.02725,-0.03153,0.08793,0.37474,0.01264,-0.0447,0.07576,0.68049 +eohi_mean,cal_true,1063,-0.01786,-0.07676,0.04265,0.56079,-0.01207,-0.07091,0.05063,0.69435 +eohi_val,cal_false,1063,-0.01276,-0.07529,0.04177,0.6777,-0.0115,-0.0741,0.04742,0.7081 +eohi_pers,cal_35,1063,0.01428,-0.04037,0.07111,0.6418,0.01092,-0.04486,0.06885,0.7222 +eohiDGEN_pers,cal_global,1063,-0.00723,-0.06312,0.05198,0.81387,-0.01039,-0.06483,0.05266,0.73501 +eohi_mean,cal_35,1063,0.02233,-0.03257,0.08046,0.46697,-0.01029,-0.06915,0.04512,0.73748 +eohi_pref,cal_global,1063,0.0183,-0.03841,0.07643,0.55118,0.00972,-0.0475,0.07007,0.75165 +eohi_pers,cal_global,1063,-0.00467,-0.06118,0.05112,0.87911,-0.00916,-0.06635,0.05143,0.76546 +eohiDGEN_pref,cal_selfActual,1063,0.02085,-0.03875,0.07863,0.49712,0.00839,-0.04939,0.06846,0.78474 +eohi_val,cal_true,1063,-0.0358,-0.0949,0.02654,0.24352,-0.0081,-0.07342,0.05105,0.79199 +eohi_pref,cal_15,1063,0.02312,-0.04369,0.0815,0.45148,0.00755,-0.05412,0.06986,0.80582 +eohi_pref,cal_false,1063,0.02725,-0.03088,0.08754,0.37477,0.00736,-0.05157,0.06691,0.8106 +eohiDGEN_pref,cal_false,1063,0.00873,-0.04608,0.05948,0.77614,0.00453,-0.05188,0.05691,0.88276 +eohi_pref,cal_35,1063,0.02663,-0.03409,0.08569,0.38574,0.00424,-0.05505,0.06505,0.89016 +eohiDGEN_life,cal_global,1063,0.02651,-0.03474,0.08515,0.38781,0.00414,-0.06008,0.06383,0.89275 +eohiDGEN_val,cal_35,1063,0.0047,-0.04819,0.06294,0.87827,-0.00387,-0.06182,0.05569,0.89972 +eohi_pers,cal_75,1063,-0.01501,-0.08009,0.05265,0.62493,-0.00292,-0.06324,0.06169,0.92424 +eohi_life,cal_global,1063,0.01135,-0.04298,0.06703,0.71158,-0.00291,-0.0638,0.0565,0.92459 +eohiDGEN_life,cal_35,1063,0.01256,-0.04397,0.071,0.68263,-0.00226,-0.06355,0.06168,0.94137 +eohi_life,cal_55,1063,0.0154,-0.0459,0.07265,0.61609,0.00223,-0.05962,0.05937,0.94216 +eohiDGEN_mean,cal_35,1063,-0.01765,-0.07148,0.0442,0.5654,-0.0016,-0.05665,0.05409,0.95856 +eohiDGEN_val,cal_75,1063,0.02365,-0.04062,0.08878,0.44107,-0.00147,-0.06785,0.06103,0.96186 +eohi_pref,cal_true,1063,-0.00826,-0.06273,0.05423,0.78791,0.00098,-0.05588,0.06502,0.97445 diff --git a/eohi1/eohi_process.xlsm b/eohi1/eohi_process.xlsm new file mode 100644 index 0000000..b1536e6 Binary files /dev/null and b/eohi1/eohi_process.xlsm differ diff --git a/eohi1/exp1.csv b/eohi1/exp1.csv new file mode 100644 index 0000000..ede5d50 --- /dev/null +++ b/eohi1/exp1.csv @@ -0,0 +1,1073 @@ +pID,ResponseId,taq_age,taq_cit_1,taq_cit_2,Citizenship,taq_sex,prePrefItem_1,prePrefItem_2,prePrefItem_3,prePrefItem_4,prePrefItem_5,prePrefItem_DO_1,prePrefItem_DO_2,prePrefItem_DO_3,prePrefItem_DO_4,prePrefItem_DO_5,prePersItem_1,prePersItem_2,prePersItem_3,prePersItem_4,prePersItem_5,prePersItem_DO_1,prePersItem_DO_2,prePersItem_DO_3,prePersItem_DO_4,prePersItem_DO_5,preValItem_1,preValItem_2,preValItem_3,preValItem_4,preValItem_5,preValItem_DO_1,preValItem_DO_2,preValItem_DO_3,preValItem_DO_4,preValItem_DO_5,preLifeItem_1,preLifeItem_2,preLifeItem_3,preLifeItem_4,preLifeItem_5,preLifeItem_DO_1,preLifeItem_DO_2,preLifeItem_DO_3,preLifeItem_DO_4,preLifeItem_DO_5,X01pastPrefItem_1,X01pastPrefItem_2,X01pastPrefItem_3,X01pastPrefItem_4,X01pastPrefItem_5,X01pastPrefItem_DO_1,X01pastPrefItem_DO_2,X01pastPrefItem_DO_3,X01pastPrefItem_DO_4,X01pastPrefItem_DO_5,X01pastPrefDGEN_1,X01pastPersItem_1,X01pastPersItem_2,X01pastPersItem_3,X01pastPersItem_4,X01pastPersItem_5,X01pastPersItem_DO_1,X01pastPersItem_DO_2,X01pastPersItem_DO_3,X01pastPersItem_DO_4,X01pastPersItem_DO_5,X01pastPersDGEN_1,X01pastValItem_1,X01pastValItem_2,X01pastValItem_3,X01pastValItem_4,X01pastValItem_5,X01pastValItem_DO_1,X01pastValItem_DO_2,X01pastValItem_DO_3,X01pastValItem_DO_4,X01pastValItem_DO_5,X01pastValDGEN_1,X01pastLifeItem_1,X01pastLifeItem_2,X01pastLifeItem_3,X01pastLifeItem_4,X01pastLifeItem_5,X01pastLifeItem_DO_1,X01pastLifeItem_DO_2,X01pastLifeItem_DO_3,X01pastLifeItem_DO_4,X01pastLifeItem_DO_5,X01pastLifeDGEN_1,X02pastPrefDGEN_1,X02pastPrefItem_1,X02pastPrefItem_2,X02pastPrefItem_3,X02pastPrefItem_4,X02pastPrefItem_5,X02pastPrefItem_DO_1,X02pastPrefItem_DO_2,X02pastPrefItem_DO_3,X02pastPrefItem_DO_4,X02pastPrefItem_DO_5,X02pastPersDGEN_1,X02pastPersItem_1,X02pastPersItem_2,X02pastPersItem_3,X02pastPersItem_4,X02pastPersItem_5,X02pastPersItem_DO_1,X02pastPersItem_DO_2,X02pastPersItem_DO_3,X02pastPersItem_DO_4,X02pastPersItem_DO_5,X02pastValDGEN_1,X02pastValItem_1,X02pastValItem_2,X02pastValItem_3,X02pastValItem_4,X02pastValItem_5,X02pastValItem_DO_1,X02pastValItem_DO_2,X02pastValItem_DO_3,X02pastValItem_DO_4,X02pastValItem_DO_5,X02pastLifeDGEN_1,X02pastLifeItem_1,X02pastLifeItem_2,X02pastLifeItem_3,X02pastLifeItem_4,X02pastLifeItem_5,X02pastLifeItem_DO_1,X02pastLifeItem_DO_2,X02pastLifeItem_DO_3,X02pastLifeItem_DO_4,X02pastLifeItem_DO_5,X01futPrefItem_1,X01futPrefItem_2,X01futPrefItem_3,X01futPrefItem_4,X01futPrefItem_5,X01futPrefItem_DO_1,X01futPrefItem_DO_2,X01futPrefItem_DO_3,X01futPrefItem_DO_4,X01futPrefItem_DO_5,X01futPrefDGEN_1,X01futPersItem_1,X01futPersItem_2,X01futPersItem_3,X01futPersItem_4,X01futPersItem_5,X01futPersItem_DO_1,X01futPersItem_DO_2,X01futPersItem_DO_3,X01futPersItem_DO_4,X01futPersItem_DO_5,X01futPersDGEN_1,X01futValItem_1,X01futValItem_2,X01futValItem_3,X01futValItem_4,X01futValItem_5,X01futValItem_DO_1,X01futValItem_DO_2,X01futValItem_DO_3,X01futValItem_DO_4,X01futValItem_DO_5,X01futValDGEN_1,X01futLifeItem_1,X01futLifeItem_2,X01futLifeItem_3,X01futLifeItem_4,X01futLifeItem_5,X01futLifeItem_DO_1,X01futLifeItem_DO_2,X01futLifeItem_DO_3,X01futLifeItem_DO_4,X01futLifeItem_DO_5,X01futLifeDGEN_1,X02futPrefDGEN_1,X02futPrefItem_1,X02futPrefItem_2,X02futPrefItem_3,X02futPrefItem_4,X02futPrefItem_5,X02futPrefItem_DO_1,X02futPrefItem_DO_2,X02futPrefItem_DO_3,X02futPrefItem_DO_4,X02futPrefItem_DO_5,X02futPersDGEN_1,X02futPersItem_1,X02futPersItem_2,X02futPersItem_3,X02futPersItem_4,X02futPersItem_5,X02futPersItem_DO_1,X02futPersItem_DO_2,X02futPersItem_DO_3,X02futPersItem_DO_4,X02futPersItem_DO_5,X02futValDGEN_1,X02futValItem_1,X02futValItem_2,X02futValItem_3,X02futValItem_4,X02futValItem_5,X02futValItem_DO_1,X02futValItem_DO_2,X02futValItem_DO_3,X02futValItem_DO_4,X02futValItem_DO_5,X02futLifeDGEN_1,X02futLifeItem_1,X02futLifeItem_2,X02futLifeItem_3,X02futLifeItem_4,X02futLifeItem_5,X02futLifeItem_DO_1,X02futLifeItem_DO_2,X02futLifeItem_DO_3,X02futLifeItem_DO_4,X02futLifeItem_DO_5,X01_14moza55F,X01_14moza55CON_1,X02_27vaud15T,X02_27vaud15CON_1,X03_05croc75F,X03_05croc75CON_1,X04_31demo15F,X04_31demo15CON_1,X05_18oedi35T,X05_18oedi35CON_1,X06_22hume35F,X06_22hume35CON_1,X07_09mons55T,X07_09mons55CON_1,X08_01gest75T,X08_01gest75CON_1,X09_25kabu15T,X09_25kabu15CON_1,X10_11sham55T,X10_11sham55CON_1,X11_30gulf15F,X11_30gulf15CON_1,X12_06memo75F,X12_06memo75CON_1,X13_20pana35T,X13_20pana35CON_1,X14_16vitc55F,X14_16vitc55CON_1,X15_28bohr15T,X15_28bohr15CON_1,X16_04chur75T,X16_04chur75CON_1,X17_23hert35F,X17_23hert35CON_1,X18_13gees55F,X18_13gees55CON_1,X19_32gang15F,X19_32gang15CON_1,X20_07list75F,X20_07list75CON_1,X21_19carb35T,X21_19carb35CON_1,X22_10cons55T,X22_10cons55CON_1,X23_24mont35F,X23_24mont35CON_1,X24_02papy75T,X24_02papy75CON_1,X25_15dwar55F,X25_15dwar55CON_1,X26_12dors55T,X26_12dors55CON_1,X27_29pucc15F,X27_29pucc15CON_1,X28_08spee75F,X28_08spee75CON_1,X29_21lute35F,X29_21lute35CON_1,X30_03tsun75T,X30_03tsun75CON_1,X31_26troy15T,X31_26troy15CON_1,X32_17lock35T,X32_17lock35CON_1,GEN_correct_1,r01_17lock35T,r01_17lock35CON_1,r02_26troy15T,r02_26troy15CON_1,r03_03tsun75T,r03_03tsun75CON_1,r04_21lute35F,r04_21lute35CON_1,r05_08spee75F,r05_08spee75CON_1,r06_29pucc15F,r06_29pucc15CON_1,r07_12dors55T,r07_12dors55CON_1,r08_15dwar55F,r08_15dwar55CON_1,r09_02papy75T,r09_02papy75CON_1,r10_24mont35F,r10_24mont35CON_1,r11_10cons55T,r11_10cons55CON_1,r12_19carb35T,r12_19carb35CON_1,r13_07list75F,r13_07list75CON_1,r14_32gang15F,r14_32gang15CON_1,r15_13gees55F,r15_13gees55CON_1,r16_23hert35F,r16_23hert35CON_1,r17_04chur75T,r17_04chur75CON_1,r18_28bohr15T,r18_28bohr15CON_1,r19_16vitc55F,r19_16vitc55CON_1,r20_20pana35T,r20_20pana35CON_1,r21_06memo75F,r21_06memo75CON_1,r22_30gulf15F,r22_30gulf15CON_1,r23_11sham55T,r23_11sham55CON_1,r24_25kabu15T,r24_25kabu15CON_1,r25_01gest75T,r25_01gest75CON_1,r26_09mons55T,r26_09mons55CON_1,r27_22hume35F,r27_22hume35CON_1,r28_18oedi35T,r28_18oedi35CON_1,r29_31demo15F,r29_31demo15CON_1,r30_5croc75F,r30_5croc75CON_1,r31_27vaud15T,r31_27vaud15CON_1,r32_14moza55F,r32_14moza55CON_1,rGEN_correct_1,nowPref_read,nowPref_music,nowPref_tv,nowPref_nap,nowPref_travel,nowPers_extravert,nowPers_critical,nowPers_dependable,nowPers_anxious,nowPers_complex,nowVal_obey,nowVal_trad,nowVal_opinion,nowVal_performance,nowVal_justice,nowLife_ideal,nowLife_excellent,nowLife_satisfied,nowLife_important,nowLife_change,pastPref_read,pastPref_music,pastPref_tv,pastPref_nap,pastPref_travel,pastPref_DGEN,pastPers_extravert,pastPers_critical,pastPers_dependable,pastPers_anxious,pastPers_complex,pastPers_DGEN,pastVal_obey,pastVal_trad,pastVal_opinion,pastVal_performance,pastVal_justice,pastVal_DGEN,pastLife_ideal,pastLife_excellent,pastLife_satisfied,pastLife_important,pastLife_change,pastLife_DGEN,futPref_read,futPref_music,futPref_tv,futPref_nap,futPref_travel,futPref_DGEN,futPers_extravert,futPers_critical,futPers_dependable,futPers_anxious,futPers_complex,futPers_DGEN,futVal_obey,futVal_trad,futVal_opinion,futVal_performance,futVal_justice,futVal_DGEN,futLife_ideal,futLife_excellent,futLife_satisfied,futLife_important,futLife_change,futLife_DGEN,moza_55_F_1,moza_55_F,moza_55_CON,vaud_15_T_1,vaud_15_T,vaud_15_CON,croc_75_F_1,croc_75_F,croc_75_CON,demo_15_F_1,demo_15_F,demo_15_CON,oedi_35_T_1,oedi_35_T,oedi_35_CON,hume_35_F_1,hume_35_F,hume_35_CON,mons_55_T_1,mons_55_T,mons_55_CON,gest_75_T_1,gest_75_T,gest_75_CON,kabu_15_T_1,kabu_15_T,kabu_15_CON,sham_55_T_1,sham_55_T,sham_55_CON,gulf_15_F_1,gulf_15_F,gulf_15_CON,memo_75_F_1,memo_75_F,memo_75_CON,pana_35_T_1,pana_35_T,pana_35_CON,vitc_55_F_1,vitc_55_F,vitc_55_CON,bohr_15_T_1,bohr_15_T,bohr_15_CON,chur_75_T_1,chur_75_T,chur_75_CON,hert_35_F_1,hert_35_F,hert_35_CON,gees_55_F_1,gees_55_F,gees_55_CON,gang_15_F_1,gang_15_F,gang_15_CON,list_75_F_1,list_75_F,list_75_CON,carb_35_T_1,carb_35_T,carb_35_CON,cons_55_T_1,cons_55_T,cons_55_CON,mont_35_F_1,mont_35_F,mont_35_CON,papy_75_T_1,papy_75_T,papy_75_CON,dwar_55_F_1,dwar_55_F,dwar_55_CON,dors_55_T_1,dors_55_T,dors_55_CON,pucc_15_F_1,pucc_15_F,pucc_15_CON,spee_75_F_1,spee_75_F,spee_75_CON,lute_35_F_1,lute_35_F,lute_35_CON,tsun_75_T_1,tsun_75_T,tsun_75_CON,troy_15_T_1,troy_15_T,troy_15_CON,lock_35_T_1,lock_35_T,lock_35_CON,gest_T_ex,dors_T_ex,chur_T_ex,mons_T_ex,lock_T_easy,hume_F_easy,papy_T_easy,sham_T_easy,list_F_easy,cons_T_easy,tsun_T_easy,pana_T_easy,kabu_T_easy,gulf_F_easy,oedi_T_easy,vaud_T_easy,mont_F_easy,demo_F_easy,spee_F_hard,dwar_F_hard,carb_T_hard,bohr_T_hard,gang_F_hard,vitc_F_hard,hert_F_hard,pucc_F_hard,troy_T_hard,moza_F_hard,croc_F_hard,gees_F_hard,lute_F_hard,memo_F_hard,bs_28,bs_easy,bs_hard,COC_self_count,COC_self_acc,COC_actual_count,COC_actual_acc,COC_15count,COC_acc15,COC_35count,COC_acc35,COC_55count,COC_acc55,COC_75count,COC_acc75,COC_Tcount,COC_accT,COC_Fcount,COC_accF,COC_con_all,COC_con15,COC_con35,COC_con55,COC_con75,COC_conT,COC_conF,cal_selfActual,cal_global,cal_15,cal_35,cal_55,cal_75,cal_true,cal_false,NPastDiff_pref_read,NPastDiff_pref_music,NPastDiff_pref_tv,NPastDiff_pref_nap,NPastDiff_pref_travel,NPastDiff_pers_extravert,NPastDiff_pers_critical,NPastDiff_pers_dependable,NPastDiff_pers_anxious,NPastDiff_pers_complex,NPastDiff_val_obey,NPastDiff_val_trad,NPastDiff_val_opinion,NPastDiff_val_performance,NPastDiff_val_justice,NPastDiff_life_ideal,NPastDiff_life_excellent,NPastDiff_life_satisfied,NPastDiff_life_important,NPastDiff_life_change,NFutDiff_pref_read,NFutDiff_pref_music,NFutDiff_pref_tv,NFutDiff_pref_nap,NFutDiff_pref_travel,NFutDiff_pers_extravert,NFutDiff_pers_critical,NFutDiff_pers_dependable,NFutDiff_pers_anxious,NFutDiff_pers_complex,NFutDiff_val_obey,NFutDiff_val_trad,NFutDiff_val_opinion,NFutDiff_val_performance,NFutDiff_val_justice,NFutDiff_life_ideal,NFutDiff_life_excellent,NFutDiff_life_satisfied,NFutDiff_life_important,NFutDiff_life_change,NPast_mean_pref,NPast_mean_pers,NPast_mean_val,NPast_mean_life,NFut_mean_pref,NFut_mean_pers,NFut_mean_val,NFut_mean_life,NPast_mean_total,NFut_mean_total,domain_mean,DGEN_past_mean,DGEN_fut_mean,DGEN_mean,eohi_pref,eohi_pers,eohi_val,eohi_life,eohi_mean,eohiDGEN_pref,eohiDGEN_pers,eohiDGEN_val,eohiDGEN_life,eohiDGEN_mean,AOT01_1,AOT02_1,AOT03_1,iAOT04_1,AOT04_1,iAOT05_1,AOT05_1,iAOT06_1,AOT06_1,iAOT07_1,AOT07_1,AOT08_1,CRT01,CRT02,CRT03,demo_sex,demo_edu,demo_age_1,demo_f,AOT_total,CRT1_correct,CRT2_correct,CRT3_correct,CRT1_int,CRT2_int,CRT3_int,CRT_correct,CRT_int,GROUP,TASK_DO,TEMPORAL_DO,ITEM_DO,COC_DO,ActivelyOpen.MindedThinking_DO_AOT07,ActivelyOpen.MindedThinking_DO_AOT08,ActivelyOpen.MindedThinking_DO_AOT01,ActivelyOpen.MindedThinking_DO_AOT02,ActivelyOpen.MindedThinking_DO_AOT03,ActivelyOpen.MindedThinking_DO_AOT04,ActivelyOpen.MindedThinking_DO_AOT05,ActivelyOpen.MindedThinking_DO_AOT_inst,ActivelyOpen.MindedThinking_DO_AOT06,CognitiveReflectionTest_DO_CRT01,CognitiveReflectionTest_DO_CRT02,CognitiveReflectionTest_DO_CRT03,CognitiveReflectionTest_DO_CRT_ins +1,R_7UW3QVlPbJl2GBF,18 - 24,,Canadian,Canadian,Female,Disagree,Agree,Disagree,Disagree,Strongly disagree,1,4,2,3,5,Strongly disagree,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,3,5,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,2,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,1,2,5,3,4,Disagree,Strongly Agree,Disagree,Disagree,Strongly disagree,2,5,1,3,4,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,2,4,5,3,1,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,4,5,3,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,5,3,2,4,2,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,3,1,5,2,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,2,4,1,3,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,3,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,64,FALSE,51,TRUE,80,FALSE,53,TRUE,75,TRUE,61,TRUE,86,TRUE,100,TRUE,100,TRUE,55,TRUE,59,FALSE,100,TRUE,62,FALSE,63,TRUE,100,FALSE,52,TRUE,55,TRUE,65,TRUE,95,TRUE,58,FALSE,61,FALSE,58,TRUE,100,FALSE,54,TRUE,91,TRUE,100,FALSE,100,FALSE,55,FALSE,55,FALSE,100,FALSE,53,TRUE,100,7,-2,2,-2,-2,-3,-3,-2,0,3,1,0,0,0,-1,1,0,0,-2,-2,-2,-2,3,-2,-2,-3,1,-3,1,0,3,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,3,0,0,-2,2,-1,-2,0,1,0,2,0,1,1,1,2,1,0,0,0,0,0,2,TRUE,0,100,FALSE,0,53,FALSE,1,100,FALSE,1,55,FALSE,0,55,FALSE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,54,TRUE,1,100,FALSE,1,58,FALSE,1,61,TRUE,1,58,TRUE,0,95,TRUE,1,65,TRUE,1,55,FALSE,1,52,TRUE,0,100,FALSE,1,63,TRUE,0,62,FALSE,0,100,TRUE,1,59,TRUE,0,55,TRUE,1,100,TRUE,0,100,TRUE,1,86,TRUE,0,61,TRUE,0,75,FALSE,1,53,TRUE,1,80,FALSE,0,51,TRUE,1,64,0.0081,0.0196,0.2025,0,0.1296,0,0,0,0.3844,0.1681,0.04,0.1764,0.2916,0.1764,0.3025,0.2809,0.3025,0.2025,0.5625,1,1,0.1225,0.1369,0.9025,0.2304,0.3721,0.2601,1,0,1,0.2209,0.1521,0.336246429,0.17535,0.497142857,7,21.88,19,59.38,4,50,5,62.5,4,50,6,75,11,68.75,8,50,73.78,57.5,67.12,92.5,78,73.19,74.38,-37.5,14.4,7.5,4.62,42.5,3,4.44,24.38,0,1,0,0,0,0,3,0,0,1,0,0,0,1,0,0,0,2,2,2,2,1,2,2,1,2,0,0,2,1,0,1,1,2,1,0,0,2,2,2,0.2,0.8,0.2,1.2,1.6,1,1,1.2,0.6,1.2,0.9,1,1.67,1.375,-1.4,-0.2,-0.8,0,-0.8,-1,-1,0,-1,-0.67,0,2,2,-1,1,0,0,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,5,2,7,6,3,4,8,1,9,2,3,4,1 +2,R_5mra6gsZxI5JgBU,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat disagree,Disagree,Somewhat disagree,1,2,5,3,4,Neither agree nor disagree,Disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,2,3,4,5,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,5,4,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Disagree,Strongly disagree,Somewhat disagree,1,4,3,2,5,7,Somewhat agree,Disagree,Agree,Somewhat agree,Neither agree nor disagree,5,4,2,3,1,3,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,3,1,2,4,8,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Agree,Neither agree nor disagree,Strongly disagree,4,1,3,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,5,4,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,3,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,FALSE,50,TRUE,85,TRUE,85,FALSE,50,FALSE,50,TRUE,50,TRUE,93,TRUE,97,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,88,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,74,FALSE,50,TRUE,100,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-1,-2,-1,0,-2,3,1,0,3,1,3,0,3,1,1,2,2,2,2,3,-2,-3,-1,8,1,-2,2,1,0,7,3,2,3,2,3,3,1,2,2,2,0,8,2,3,2,0,-3,7,0,0,0,0,0,2,0,0,0,0,0,8,0,0,0,0,0,7,FALSE,1,50,TRUE,1,85,TRUE,0,85,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,93,TRUE,1,97,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,0,50,FALSE,0,88,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,74,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0009,0,0.7744,0.0049,0,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.0225,0.25,0.25,0.5476,0.25,1,0.25,0.25,1,0.25,0.25,0.25,0.25,0.7225,1,0.25,1,0.349735714,0.180178571,0.519292857,16,50,17,53.13,4,50,5,62.5,5,62.5,3,37.5,9,56.25,8,50,69.44,54.38,62.5,80.38,80.5,75.81,63.06,-3.13,16.31,4.38,0,17.88,43,19.56,13.06,1,0,1,1,0,1,0,1,0,0,0,1,0,2,0,0,1,0,0,2,1,0,3,2,2,0,2,3,1,0,3,1,3,0,3,1,1,2,2,2,0.6,0.4,0.6,0.6,1.6,1.2,2,1.6,0.55,1.6,1.075,6,5.67,6.25,-1,-0.8,-1.4,-1,-1.066666667,1,5,-5,1,0.33,1,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),58,,1.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,7,6,2,8,4,3,9,1,5,4,2,3,1 +3,R_7GwZPZK1uNHwyRZ,53 - 59,,Canadian,Canadian,Male,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,Strongly agree,5,4,3,1,2,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,2,1,4,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,Agree,2,1,4,3,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Strongly Agree,Neither agree nor disagree,Agree,Strongly Agree,3,4,5,2,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,2,4,7,Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,5,4,3,2,1,7,Somewhat agree,Agree,Somewhat agree,Agree,Agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat disagree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,3,4,5,2,1,8,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,1,4,2,5,7,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,1,4,5,3,2,7,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,75,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,78,TRUE,100,TRUE,100,FALSE,62,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,29,-1,2,0,1,3,-3,1,1,1,-1,1,3,2,1,2,1,-1,1,1,1,-1,3,0,2,3,7,1,1,1,0,0,7,2,1,2,1,3,7,1,2,1,2,2,7,-1,3,0,1,3,6,1,2,0,1,0,8,1,2,2,1,1,7,1,2,2,1,0,7,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,62,TRUE,1,100,TRUE,1,100,FALSE,1,78,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0.0625,0,0,1,0,0,0,0,0,1,0,1,0,0,0.1444,0.0484,0,0,0,1,1,0,1,0.259117857,0.147321429,0.370914286,29,90.63,25,78.13,7,87.5,7,87.5,7,87.5,4,50,14,87.5,11,68.75,97.34,100,97.25,92.12,100,98.44,96.25,12.5,19.21,12.5,9.75,4.62,50,10.94,27.5,0,1,0,1,0,4,0,0,1,1,1,2,0,0,1,0,3,0,1,1,0,1,0,0,0,4,1,1,0,1,0,1,0,0,1,0,3,1,0,1,0.4,1.2,0.8,1,0.2,1.4,0.4,1,0.85,0.75,0.8,7,7,7,0.2,-0.2,0.4,0,0.133333333,1,-1,0,0,0,1,2,-1,-2,2,0,0,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,58,it was all good,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,3,8,4,6,9,5,7,1,2,3,2,4,1 +4,R_1nMWQYBUmr27PZ5,67 - 73,American,,American,Female,Strongly disagree,Agree,Strongly agree,Agree,Strongly agree,1,5,4,3,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,2,3,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,5,2,1,Agree,Disagree,Somewhat agree,Agree,Disagree,5,3,4,1,2,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,4,1,2,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,1,4,3,2,5,0,Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,3,4,2,1,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,5,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,4,1,3,5,2,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Strongly disagree,5,1,2,3,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,73,TRUE,97,TRUE,93,FALSE,93,TRUE,51,TRUE,52,TRUE,60,TRUE,76,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,53,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,54,28,-3,2,3,2,3,-3,-3,3,-3,0,3,3,3,-3,3,2,-2,1,2,-2,-3,3,3,3,3,0,-3,-3,3,-3,0,0,3,3,3,-3,0,0,2,1,3,3,-3,1,0,0,0,0,0,5,0,0,0,0,0,5,3,0,0,-3,0,4,0,0,2,2,-3,4,TRUE,0,54,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,53,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,60,TRUE,1,52,TRUE,0,51,FALSE,1,93,TRUE,0,93,TRUE,1,97,TRUE,1,73,TRUE,1,100,0,0.2304,0,0,0,0,0.0576,0,0,0,0.0009,0,0.2209,0,0.25,0,0,0.25,0.0049,0.36,1,0.25,0,1,0,0.2601,0.0729,0.2916,0,0,0.8649,1,0.210135714,0.055671429,0.3646,28,87.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,86,72.12,92.88,83.25,95.75,84.44,87.56,15.62,14.12,-2.88,30.38,20.75,8.25,3.19,25.06,0,1,0,1,0,0,0,0,0,0,0,0,0,0,3,0,3,2,1,1,3,2,3,2,3,3,3,3,3,0,0,3,3,0,3,2,2,1,0,1,0.4,0,0.6,1.4,2.6,2.4,1.8,1.2,0.6,2,1.3,0,4.67,2.375,-2.2,-2.4,-1.2,0.2,-1.933333333,-5,-5,-4,-3,-4.67,0,1,1,-2,2,2,-2,0,0,0,0,1,10 cents,5 minutes,47 days,Female,High School (or equivalent),71,,0.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,3,5,2,6,4,8,7,1,9,4,2,3,1 +5,R_61dWTD6v8MMe6Hl,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,1,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,1,3,4,Somewhat Agree,Agree,Strongly Agree,Strongly Disagree,Agree,5,1,2,4,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,5,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,5,2,4,1,0,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,2,5,1,3,4,1,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,1,3,5,2,4,1,Somewhat disagree,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly disagree,2,4,3,1,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,2,5,4,3,1,1,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,4,5,2,3,4,Somewhat Agree,Strongly Agree,Strongly Agree,Disagree,Agree,3,1,2,4,5,2,Disagree,Disagree,Disagree,Disagree,Disagree,1,5,4,3,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,87,TRUE,87,TRUE,89,TRUE,88,TRUE,88,TRUE,85,TRUE,100,FALSE,97,TRUE,94,TRUE,95,TRUE,100,TRUE,82,TRUE,100,FALSE,91,TRUE,100,FALSE,100,FALSE,100,FALSE,90,FALSE,84,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,3,3,3,3,3,1,2,3,-3,2,-3,-3,-3,-3,-3,3,3,3,2,3,0,3,0,3,3,3,1,1,3,3,-3,2,1,-1,-3,-3,-1,-3,9,3,3,3,2,2,1,3,0,3,0,3,4,1,3,3,-2,2,2,-2,-2,-2,-2,-2,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,87,TRUE,1,87,TRUE,0,89,TRUE,1,88,TRUE,1,88,TRUE,1,85,TRUE,1,100,FALSE,1,97,TRUE,0,94,TRUE,1,95,TRUE,0,100,TRUE,1,82,TRUE,1,100,FALSE,1,91,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,90,FALSE,0,84,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0144,0,0,0.0144,0,0.7921,0,0,0,0.7056,0,0.0025,0.0225,0.0009,0.0169,0,0,0.0169,0,0,0.81,0.0324,0,1,0.0081,0.5625,1,1,1,1,1,0.8836,0.351928571,0.111242857,0.592614286,22,68.75,21,65.63,6,75,5,62.5,4,50,6,75,13,81.25,8,50,94.75,90.75,94,96.5,97.75,93.69,95.81,3.12,29.12,15.75,31.5,46.5,22.75,12.44,45.81,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,2,0,0,2,0,0,0,0,0,1,0,3,0,3,0,0,1,0,1,0,1,1,1,1,1,0,0.6,0.2,0.8,0.2,1.2,0.4,1,0.4,0.7,0.55,0.67,2.33,2.375,-0.2,-0.6,-0.2,-0.2,-0.333333333,-1,-3,-1,8,-1.66,0,0,-1,-2,2,2,-2,2,-2,-2,2,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),71,This was an interesting survey. I would gladly participate in another of your studies.,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,6,7,2,9,3,4,8,1,5,3,2,4,1 +6,R_6DndYBp6h4JJNOQ,53 - 59,,Canadian,Canadian,Female,Strongly agree,Agree,Strongly agree,Strongly disagree,Somewhat agree,3,4,5,1,2,Agree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,3,2,4,1,Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,1,2,3,5,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,1,5,3,2,Strongly Agree,Agree,Strongly Agree,Strongly disagree,Agree,2,4,5,3,1,0,Agree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,2,5,1,3,1,Strongly Agree,Strongly Disagree,Agree,Neither Agree nor Disagree,Agree,4,1,3,2,5,1,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,5,4,1,3,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,4,1,3,2,5,4,Agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,3,4,5,1,4,Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,1,2,4,3,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,4,2,3,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,60,TRUE,60,FALSE,100,TRUE,100,TRUE,100,FALSE,76,TRUE,100,FALSE,81,TRUE,100,TRUE,96,TRUE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,100,FALSE,50,FALSE,100,FALSE,50,TRUE,59,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,96,FALSE,95,TRUE,81,TRUE,95,FALSE,76,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,-3,1,2,-2,3,0,1,2,-2,3,0,2,0,1,1,1,-2,3,2,3,-3,2,0,2,-2,3,0,1,1,3,-3,2,0,2,1,1,1,2,2,-2,3,3,2,3,1,1,4,2,1,2,0,1,4,2,-1,2,-1,2,1,1,1,1,2,0,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,1,96,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,59,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,96,FALSE,1,95,TRUE,0,81,TRUE,1,95,FALSE,0,76,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.1681,0.0025,0.0016,0.5776,0.0361,0.16,0,1,0.36,0.0025,1,0.25,0.25,0.25,1,0,0.0016,0.5776,1,1,0,0.6561,1,0.331917857,0.164707143,0.499128571,28,87.5,20,62.5,4,50,5,62.5,5,62.5,6,75,12,75,8,50,88.28,73.62,85.88,94.88,98.75,85.12,91.44,25,25.78,23.62,23.38,32.38,23.75,10.12,41.44,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,4,0,0,3,1,0,0,0,1,1,1,0,1,0,0,1,2,0.2,0,0.6,0.6,0.8,0.8,0.6,0.8,0.35,0.75,0.55,0.67,3,2.25,-0.6,-0.8,0,-0.2,-0.466666667,-4,-3,0,-1,-2.33,1,2,2,-2,2,0,0,-1,1,-1,1,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,58,Interesting survey! I enjoyed taking it.,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,3,4,2,7,6,9,8,1,5,3,2,4,1 +7,R_1PDDLmZmpxdk7BL,39 - 45,,Canadian,Canadian,Female,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,2,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,4,2,1,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,2,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,5,2,3,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,2,3,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,4,2,1,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,5,4,1,3,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,4,5,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,2,1,5,TRUE,94,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,66,FALSE,50,FALSE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,74,FALSE,50,FALSE,50,FALSE,50,FALSE,50,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,1,1,1,1,0,-1,1,-1,1,1,0,0,0,0,-1,-1,-1,-1,-1,0,1,1,1,1,7,-1,-1,1,-1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,-1,-1,-1,1,-1,7,1,1,1,1,1,8,1,1,1,1,1,7,TRUE,0,94,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,66,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1156,0.25,0.25,0.25,0.25,0.25,0.5476,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.8836,0.25,0.25,0.25,1,0.332028571,0.2404,0.423657143,5,15.63,16,50,5,62.5,6,75,3,37.5,2,25,5,31.25,11,68.75,55.75,52,56.25,55.5,59.25,54.12,57.38,-34.37,5.75,-10.5,-18.75,18,34.25,22.87,-11.37,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,0,0,0,0,1,0,2,2,2,0,1,1,1,1,2,2,2,2,2,0.2,0.2,0.8,2,0.4,1.4,0.8,2,0.8,1.15,0.975,7,7.33,7.125,-0.2,-1.2,0,0,-0.466666667,0,0,-1,0,-0.33,0,1,0,-1,1,1,-1,0,0,0,0,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,45,,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,3,9,4,6,8,7,5,1,2,3,4,2,1 +8,R_7ymc6kKk1g2zyfc,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Disagree,Agree,3,1,2,4,5,Somewhat disagree,Somewhat agree,Strongly agree,Agree,Agree,3,5,4,1,2,Somewhat Agree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,4,2,5,1,3,Disagree,Somewhat disagree,Disagree,Somewhat agree,Disagree,3,5,1,4,2,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,4,3,2,4,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Agree,5,2,1,3,4,4,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Strongly Agree,4,5,1,2,3,4,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,3,1,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,2,1,5,3,4,4,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Agree,4,1,5,3,2,4,Somewhat Agree,Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,2,1,4,3,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,1,5,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,97,TRUE,87,TRUE,99,FALSE,100,FALSE,96,TRUE,77,FALSE,90,TRUE,100,FALSE,100,TRUE,100,FALSE,83,FALSE,100,TRUE,83,TRUE,90,FALSE,59,TRUE,100,FALSE,58,FALSE,100,TRUE,76,TRUE,91,FALSE,59,TRUE,100,TRUE,100,TRUE,96,TRUE,95,FALSE,100,TRUE,89,FALSE,70,FALSE,92,TRUE,72,FALSE,100,25,3,3,3,-2,2,-1,1,3,2,2,1,-2,1,0,3,-2,-1,-2,1,-2,3,3,2,2,3,4,0,1,3,1,2,4,1,-1,2,1,3,4,1,-1,0,2,0,5,3,3,3,0,1,4,-1,1,3,1,2,4,1,-2,2,0,3,3,-1,0,0,-1,-1,5,FALSE,1,100,TRUE,1,72,FALSE,1,92,FALSE,1,70,TRUE,1,89,FALSE,1,100,TRUE,1,95,TRUE,1,96,TRUE,1,100,TRUE,1,100,FALSE,1,59,TRUE,0,91,TRUE,1,76,FALSE,1,100,FALSE,0,58,TRUE,1,100,FALSE,1,59,TRUE,0,90,TRUE,0,83,FALSE,1,100,FALSE,0,83,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,77,FALSE,1,96,FALSE,1,100,TRUE,0,99,TRUE,1,87,FALSE,0,97,TRUE,1,100,0.0016,0.0529,0,0.0025,0,0,0,0,0,0,0.0169,0.0576,0,0.1681,0.0121,0.0784,0,0.09,0,0.01,0.6889,0.3364,0.6889,0,0.1681,0.0016,0.9409,0,0.0064,0.81,0.9801,0.8281,0.210089286,0.030221429,0.389957143,25,78.13,25,78.13,5,62.5,6,75,7,87.5,7,87.5,13,81.25,12,75,89.34,79.38,88.25,94,95.75,89.38,89.31,0,11.21,16.88,13.25,6.5,8.25,8.13,14.31,0,0,1,4,1,1,0,0,1,0,0,1,1,1,0,3,0,2,1,2,0,0,0,2,1,0,0,0,1,0,0,0,1,0,0,1,1,2,2,1,1.2,0.4,0.6,1.6,0.6,0.2,0.2,1.4,0.95,0.6,0.775,4,3.67,4.125,0.6,0.2,0.4,0.2,0.4,0,0,1,0,0.33,0,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,53,I really would have appreciated feedback on how many questions I answered correctly. This is going to be on my mind for a couple of hours!,1.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,2,6,4,7,3,9,5,1,8,4,3,2,1 +9,R_7P6m5sDPPv0UQuJ,39 - 45,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,2,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,3,2,5,4,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,1,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,2,5,1,4,3,2,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,3,2,5,1,4,2,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,1,3,5,2,2,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,2,3,5,4,1,3,Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,3,2,5,4,1,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Neither agree nor disagree,3,4,2,5,1,TRUE,95,FALSE,88,FALSE,58,FALSE,50,FALSE,50,TRUE,70,TRUE,81,FALSE,50,FALSE,50,TRUE,85,FALSE,50,FALSE,66,TRUE,78,TRUE,88,FALSE,50,TRUE,95,TRUE,50,TRUE,75,TRUE,59,FALSE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,55,TRUE,100,FALSE,50,FALSE,50,TRUE,70,TRUE,75,TRUE,85,FALSE,61,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,0,1,1,-3,2,-3,2,1,1,1,1,1,1,1,1,1,1,2,3,3,0,2,7,1,-3,2,-3,2,2,2,2,2,2,2,2,0,0,0,-2,-2,7,1,2,2,0,1,7,1,-3,2,-2,2,2,2,-1,-1,-1,-1,3,1,0,1,3,0,2,TRUE,0,95,FALSE,0,88,FALSE,1,58,FALSE,1,50,FALSE,0,50,TRUE,0,70,TRUE,1,81,FALSE,0,50,FALSE,0,50,TRUE,1,85,FALSE,1,50,FALSE,1,66,TRUE,1,78,TRUE,0,88,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,0,75,TRUE,0,59,FALSE,1,100,TRUE,1,100,FALSE,0,50,TRUE,0,50,FALSE,0,55,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,0,70,TRUE,0,75,TRUE,1,85,FALSE,0,61,TRUE,1,100,0.25,0.25,0.0025,0.0361,0,0.49,0.3025,0.0225,0,0.25,0.0225,0.0484,0.25,0.25,0.25,0.7744,0.25,0.25,0.49,1,0,0.25,0.3481,0.7744,0.25,0.25,0.3721,0.9025,0.1764,0.5625,0.5625,0.1156,0.329085714,0.225735714,0.432435714,16,50,13,40.63,3,37.5,3,37.5,2,25,5,62.5,7,43.75,6,37.5,69.81,57.25,71.62,78,72.38,70.5,69.12,9.37,29.18,19.75,34.12,53,9.88,26.75,31.62,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,3,3,1,1,0,0,0,0,0,0,1,0,1,2,2,2,2,0,1,0,2,1,0.4,0,1,1.8,0.4,0.2,1.8,0.8,0.8,0.8,0.8,3.67,4,4,0,-0.2,-0.8,1,-0.333333333,0,0,-1,5,-0.33,-1,2,2,-2,2,0,0,-1,1,-2,2,2,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,40,Great survey!,1.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,5,8,6,7,9,3,4,1,2,2,3,4,1 +10,R_5F5l8L8SX8iBoiH,60 - 66,,Canadian,Canadian,Female,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,Agree,1,3,2,4,5,Somewhat agree,Somewhat disagree,Agree,Strongly disagree,Neither agree nor disagree,1,5,4,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,1,3,5,Agree,Agree,Agree,Strongly Agree,Somewhat disagree,4,5,3,2,1,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,3,4,2,5,1,7,Somewhat agree,Neither agree nor disagree,Agree,Strongly disagree,Neither agree nor disagree,4,3,5,1,2,2,Agree,Agree,Agree,Agree,Somewhat Agree,3,2,1,4,5,8,Somewhat agree,Agree,Somewhat agree,Strongly Agree,Somewhat disagree,4,2,3,1,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,5,1,2,4,3,5,Somewhat agree,Somewhat disagree,Agree,Strongly disagree,Somewhat disagree,4,5,3,1,2,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,5,2,3,4,1,1,Agree,Agree,Agree,Strongly Agree,Agree,4,3,5,2,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,90,TRUE,71,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,70,TRUE,71,FALSE,75,TRUE,100,TRUE,54,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,70,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,92,TRUE,93,TRUE,50,FALSE,100,TRUE,80,FALSE,100,27,3,2,3,0,2,1,-1,2,-3,0,0,0,1,0,1,2,2,2,3,-1,3,3,1,-2,3,7,1,0,2,-3,0,2,2,2,2,2,1,8,1,2,1,3,-1,7,3,1,2,1,-1,5,1,-1,2,-3,-1,2,1,1,2,-1,2,1,2,2,2,3,2,1,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,0,50,TRUE,1,93,FALSE,1,92,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,75,TRUE,0,71,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,TRUE,0,90,TRUE,0,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0064,0,0,0.5041,0,0,0,0.25,0.09,0.0049,0.04,0,0.25,0.81,0,0.09,0.25,0.0625,1,0.2916,0.5041,0,0,0,1,0.81,1,0.2487,0.081814286,0.415585714,27,84.38,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,87.69,68.25,87.38,100,95.12,90.19,85.19,12.5,15.81,-6.75,12.38,25,32.62,-9.81,41.44,0,1,2,2,1,0,1,0,0,0,2,2,1,2,0,1,0,1,0,0,0,1,1,1,3,0,0,0,0,1,1,1,1,1,1,0,0,0,0,3,1.2,0.2,1.4,0.4,1.2,0.2,1,0.6,0.8,0.75,0.775,5.67,2.67,4.125,0,0,0.4,-0.2,0.133333333,2,0,7,6,3,1,1,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,"Really liked this survey, but would like to know my score.",1.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,6,7,5,9,4,2,8,1,3,2,3,4,1 +11,R_3PvzFllH1poEz69,67 - 73,,Canadian,Canadian,Male,Agree,Agree,Agree,Neither agree nor disagree,Agree,3,5,4,1,2,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,5,3,2,1,4,Somewhat agree,Agree,Agree,Agree,Somewhat disagree,3,5,4,1,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,5,3,2,4,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,1,3,6,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,4,1,3,5,2,6,Agree,Agree,Agree,Agree,Somewhat disagree,1,5,4,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,6,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,2,4,1,3,5,6,Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,2,4,5,3,1,6,Agree,Agree,Agree,Agree,Somewhat disagree,1,2,5,4,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,0,2,1,0,2,0,1,3,1,3,0,2,1,2,2,2,-1,2,2,2,0,2,6,0,0,0,0,0,6,3,1,3,0,2,6,2,2,2,2,-1,6,2,2,2,0,1,6,2,0,2,0,2,6,2,2,3,0,2,6,2,2,2,2,-1,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,0,0,0,0,0,0.25,0.25,0,0,0.25,0,0.25,0,0.25,1,1,0.25,1,0,0,1,1,1,1,0.3125,0.071428571,0.553571429,24,75,21,65.63,4,50,5,62.5,6,75,6,75,16,100,5,31.25,89.06,81.25,81.25,93.75,100,93.75,84.38,9.37,23.43,31.25,18.75,18.75,25,-6.25,53.13,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0.8,0,0.2,0.2,0.4,0.4,0.2,0.25,0.3,0.275,6,6,6,-0.2,0.4,-0.4,0,-0.066666667,0,0,0,0,0,2,2,2,-2,2,0,0,-1,1,-2,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,67,,1.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,6,7,4,9,5,3,8,1,2,3,4,2,1 +12,R_5L4NB0Flxbu1zDL,46 - 52,,Canadian,Canadian,Male,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,5,3,4,2,1,Agree,Disagree,Agree,Disagree,Agree,1,5,3,4,2,Disagree,Disagree,Disagree,Disagree,Agree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Agree,4,3,2,1,5,5,Agree,Agree,Agree,Disagree,Agree,4,3,2,1,5,5,Agree,Agree,Agree,Agree,Agree,4,5,1,3,2,5,Disagree,Disagree,Disagree,Disagree,Disagree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,89,FALSE,68,TRUE,71,FALSE,67,FALSE,62,FALSE,61,TRUE,81,FALSE,83,FALSE,79,FALSE,66,TRUE,76,TRUE,74,TRUE,69,TRUE,74,FALSE,68,TRUE,73,TRUE,95,TRUE,77,FALSE,75,TRUE,77,TRUE,92,FALSE,79,TRUE,79,TRUE,83,TRUE,84,TRUE,77,TRUE,79,TRUE,80,FALSE,88,FALSE,90,TRUE,89,TRUE,86,12,2,2,2,2,2,1,1,1,-2,1,2,-2,2,-2,2,-2,-2,-2,-2,2,2,2,2,2,2,5,2,2,2,-2,2,5,2,2,2,2,2,5,-2,-2,-2,-2,-2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,86,TRUE,1,89,FALSE,1,90,FALSE,1,88,TRUE,1,80,TRUE,0,79,TRUE,1,77,TRUE,1,84,TRUE,1,83,TRUE,1,79,FALSE,1,79,TRUE,0,92,TRUE,1,77,FALSE,1,75,TRUE,1,77,TRUE,1,95,TRUE,0,73,FALSE,1,68,TRUE,0,74,TRUE,0,69,TRUE,1,74,TRUE,1,76,FALSE,1,66,FALSE,0,79,FALSE,1,83,TRUE,1,81,FALSE,1,61,FALSE,1,62,FALSE,1,67,TRUE,1,71,FALSE,0,68,TRUE,1,89,0.0256,0.0361,0.0025,0.0529,0.0121,0.6241,0.6241,0.0441,0.4761,0.0576,0.0841,0.0529,0.0289,0.0441,0.04,0.0121,0.1156,0.0144,0.1444,0.0289,0.0676,0.0529,0.5476,0.0625,0.5329,0.1521,0.4624,0.7396,0.01,0.1024,0.1089,0.8464,0.217457143,0.1593,0.275614286,12,37.5,24,75,6,75,6,75,7,87.5,5,62.5,14,87.5,10,62.5,77.84,77.38,75.62,78.12,80.25,79.94,75.75,-37.5,2.84,2.38,0.62,-9.38,17.75,-7.56,13.25,0,0,0,0,0,1,1,1,0,1,0,4,0,4,0,0,0,0,0,4,2,2,2,2,2,1,1,1,2,1,2,2,2,2,2,2,2,2,2,2,0,0.8,1.6,0.8,2,1.2,2,2,0.8,1.8,1.3,5,5,5,-2,-0.4,-0.4,-1.2,-0.933333333,0,0,0,0,0,-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,10 cents,5 minutes,24 days,Male,High School (or equivalent),46,none,0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,7,9,8,5,4,2,6,1,3,4,3,2,1 +13,R_5DNhjyQhmJfztEG,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Disagree,4,3,5,2,1,Somewhat disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,5,3,1,4,Strongly Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,5,3,2,1,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,3,2,1,5,4,3,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,5,2,1,4,3,2,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,2,1,3,4,8,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,3,4,2,5,3,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,5,3,2,4,1,5,Strongly agree,Agree,Agree,Disagree,Agree,5,4,3,1,2,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,3,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,74,FALSE,73,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,65,FALSE,61,TRUE,100,TRUE,100,TRUE,100,FALSE,66,FALSE,89,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,64,TRUE,68,TRUE,80,TRUE,100,17,3,3,3,2,-2,-1,-3,1,0,-1,3,0,2,-2,3,1,1,2,1,1,3,3,3,3,-2,5,1,-3,2,-1,-1,3,3,2,2,0,3,2,2,2,2,1,1,8,3,3,3,3,-3,5,0,-3,0,-3,-3,3,3,2,2,-2,2,5,0,1,1,0,1,5,TRUE,0,100,TRUE,1,80,TRUE,0,68,FALSE,1,64,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,0,89,FALSE,0,66,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,61,FALSE,0,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,73,FALSE,1,74,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,1,0,0.4356,0,0.5329,0,0,0.7921,1,0,0.04,0.0676,0.1296,0.25,1,0,0.4225,0,0.1521,1,1,0.25,1,0.4624,1,1,1,0.447671429,0.285557143,0.609785714,17,53.13,17,53.13,3,37.5,5,62.5,3,37.5,6,75,11,68.75,6,37.5,88.75,81,96.75,87.5,89.75,88.94,88.56,0,35.62,43.5,34.25,50,14.75,20.19,51.06,0,0,0,1,0,2,0,1,1,0,0,2,0,2,0,1,1,0,0,0,0,0,0,1,1,1,0,1,3,2,0,2,0,0,1,1,0,1,1,0,0.2,0.8,0.8,0.4,0.4,1.4,0.6,0.6,0.55,0.75,0.65,3.33,4.33,4.5,-0.2,-0.6,0.2,-0.2,-0.2,0,0,-3,3,-1,0,1,1,-2,2,1,-1,0,0,-2,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,59,thanks,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,8,4,2,7,9,3,6,1,5,4,3,2,1 +14,R_1E0YgrofVrYuFKH,60 - 66,American,,American,Female,Strongly agree,Agree,Agree,Agree,Agree,5,1,2,4,3,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,5,1,4,3,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,3,5,2,4,1,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,2,3,5,4,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,3,1,4,2,5,6,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Somewhat agree,Agree,Somewhat agree,2,4,1,3,5,2,Disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,4,5,1,3,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,2,4,5,1,3,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,4,3,1,2,FALSE,100,TRUE,100,FALSE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,86,FALSE,96,TRUE,95,TRUE,97,TRUE,75,TRUE,100,FALSE,100,TRUE,100,TRUE,72,FALSE,100,TRUE,91,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,92,FALSE,97,TRUE,80,TRUE,92,FALSE,74,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,2,2,-2,0,2,0,0,1,-1,2,0,2,-1,0,0,1,-1,3,2,2,0,1,4,-1,-1,1,-1,-1,7,1,-1,2,1,2,2,-1,0,0,1,-1,6,3,2,1,2,1,3,-2,-1,2,-1,0,2,1,-1,2,-1,2,2,0,0,0,0,-1,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,86,FALSE,1,96,TRUE,1,95,TRUE,0,97,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,72,FALSE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,92,FALSE,1,97,TRUE,0,80,TRUE,1,92,FALSE,0,74,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0064,0.0025,0,0.0196,0,0,0,0.2304,0.0009,0,0.0081,0.0625,0.5184,0.9409,0,0.8464,0.5476,0,0,1,0.64,0.0016,0.172332143,0.018492857,0.326171429,29,90.63,26,81.25,5,62.5,7,87.5,6,75,8,100,15,93.75,11,68.75,93.72,81.38,95.75,99.62,98.12,95.44,92,9.38,12.47,18.88,8.25,24.62,-1.88,1.69,23.25,0,0,0,2,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0.6,1,0.2,0,0.4,0.4,0.2,0.4,0.45,0.35,0.4,4.33,2.33,3.625,0.2,0.6,0,-0.4,0.266666667,1,5,0,3,2,0,2,1,-2,2,0,0,-1,1,-2,2,1,5 cents,5 minutes,24 days,Female,University - Undergraduate,62,Hate the logic questions on how many can x make of X in x minutes,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,8,7,9,4,2,3,5,1,6,4,2,3,1 +15,R_5RduTzrkolBe5dB,60 - 66,,Canadian,Canadian,Female,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,5,1,3,4,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,3,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,4,2,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,2,1,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,1,2,4,6,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,5,4,2,1,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,5,1,3,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,2,1,4,5,3,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,4,1,5,3,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,3,1,5,2,4,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,64,FALSE,62,FALSE,81,FALSE,78,TRUE,71,FALSE,82,TRUE,90,TRUE,78,FALSE,80,TRUE,79,FALSE,80,TRUE,80,TRUE,81,TRUE,90,FALSE,100,TRUE,89,TRUE,99,TRUE,88,TRUE,97,FALSE,86,FALSE,81,TRUE,90,FALSE,88,TRUE,93,FALSE,99,TRUE,100,FALSE,98,TRUE,87,FALSE,100,TRUE,100,FALSE,84,TRUE,93,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,1,2,-1,-1,-1,-1,1,0,0,1,1,1,0,1,-1,0,0,1,-1,0,1,1,-1,1,6,-1,0,1,-1,0,6,0,1,-1,0,0,6,1,1,1,1,1,6,0,0,1,-1,-1,5,-1,0,1,0,-1,5,0,1,1,1,0,5,-1,-1,0,0,0,5,TRUE,0,64,FALSE,0,62,FALSE,1,81,FALSE,1,78,TRUE,1,71,FALSE,1,82,TRUE,1,90,TRUE,1,78,FALSE,0,80,TRUE,1,79,FALSE,1,80,TRUE,0,80,TRUE,1,81,TRUE,0,90,FALSE,0,100,TRUE,1,89,TRUE,0,99,TRUE,0,88,TRUE,0,97,FALSE,1,86,FALSE,0,81,TRUE,1,90,FALSE,1,88,TRUE,1,93,FALSE,1,99,TRUE,1,100,FALSE,1,98,TRUE,0,87,FALSE,1,100,TRUE,1,100,FALSE,0,84,TRUE,1,93,0.0484,0,0.0121,0.01,0.0049,0.0324,0.0049,0.0441,0.0196,0.01,0,0.0361,0.64,0.04,0.0841,0.3844,0.0144,0.0484,0.7569,0.0001,0.6561,1,0.9409,0.81,0.9801,0.0004,0.7056,0.4096,0.0361,0.7744,0,0.64,0.324053571,0.097378571,0.550728571,19,59.38,20,62.5,3,37.5,6,75,5,62.5,6,75,11,68.75,9,56.25,86.5,84.88,86.88,87.5,86.75,85.69,87.31,-3.12,24,47.38,11.88,25,11.75,16.94,31.06,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,2,1,1,0,2,1,1,1,0,0,0,1,0,0,1,1,0,0,1,1,0,1,0,1,1,0.8,0.4,0.8,1.2,0.6,0.4,0.6,0.6,0.8,0.55,0.675,6,5,5.5,0.2,0,0.2,0.6,0.133333333,1,1,1,1,1,0,0,-1,-1,1,0,0,1,-1,0,0,-1,10 cents,100 minutes,36 days,Female,High School (or equivalent),62,,-0.25,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,4,8,9,3,5,2,7,1,6,4,2,3,1 +16,R_7LW9FcFtqnMtwZj,67 - 73,,Canadian,Canadian,Male,Strongly agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,2,5,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,2,5,4,3,Strongly Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,4,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,4,1,2,5,Strongly Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,2,Agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,2,1,5,4,4,Agree,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,1,4,5,2,3,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,2,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Agree,Disagree,3,4,2,1,5,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,1,3,4,2,3,Agree,Disagree,Neither Agree nor Disagree,Disagree,Disagree,1,5,2,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,5,1,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,75,TRUE,60,TRUE,60,FALSE,50,TRUE,51,FALSE,100,TRUE,65,TRUE,90,TRUE,78,TRUE,64,FALSE,56,FALSE,53,TRUE,55,FALSE,100,TRUE,50,TRUE,61,FALSE,77,TRUE,98,TRUE,50,FALSE,100,TRUE,65,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,73,FALSE,83,FALSE,100,FALSE,53,TRUE,94,FALSE,50,TRUE,75,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,0,0,1,-1,2,-1,0,3,1,1,0,1,0,1,1,1,-1,3,2,2,0,0,2,2,-1,2,-1,0,4,2,2,0,2,0,3,0,1,1,0,0,3,3,2,3,2,-2,7,1,0,0,0,-1,3,2,-2,0,-2,-2,5,0,0,1,1,0,7,TRUE,0,75,TRUE,1,60,TRUE,0,60,FALSE,1,50,TRUE,1,51,FALSE,1,100,TRUE,1,65,TRUE,1,90,TRUE,1,78,TRUE,1,64,FALSE,1,56,FALSE,1,53,TRUE,1,55,FALSE,1,100,TRUE,1,50,TRUE,1,61,FALSE,1,77,TRUE,0,98,TRUE,0,50,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,73,FALSE,1,83,FALSE,1,100,FALSE,1,53,TRUE,1,94,FALSE,0,50,TRUE,1,75,0.01,0.0729,0.1521,0.1225,0.0625,0,0.25,0.1296,0,0,0.0036,0.2025,0.0484,0.1936,0.2401,0.16,0,0.25,0,0.25,0.1225,0.25,0.25,0,0.0529,0.0289,0.25,0.5625,0.36,0.9604,0.2209,0.2209,0.181046429,0.110021429,0.252071429,23,71.88,26,81.25,6,75,8,100,6,75,6,75,14,87.5,12,75,71.44,59.62,72,78.12,76,67.56,75.31,-9.37,-9.81,-15.38,-28,3.12,1,-19.94,0.31,0,0,0,0,0,1,0,0,0,0,1,1,1,2,1,0,0,0,1,1,0,0,1,2,2,0,1,2,1,1,1,3,1,2,3,0,1,0,0,1,0,0.2,1.2,0.4,1,1,2,0.4,0.45,1.1,0.775,3,5,4.25,-1,-0.8,-0.8,0,-0.866666667,-5,1,-2,-4,-2,0,0,0,-1,1,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,68,,0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,2,7,5,8,6,4,3,1,9,2,3,4,1 +17,R_11ZL15wRsIhme41,67 - 73,American,,American,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,4,5,1,2,Somewhat agree,Disagree,Agree,Somewhat agree,Somewhat agree,5,1,2,3,4,Strongly Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,4,3,1,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,2,5,8,Disagree,Somewhat agree,Strongly agree,Agree,Somewhat agree,1,4,3,5,2,6,Strongly Agree,Strongly Agree,Somewhat Agree,Disagree,Strongly Agree,2,4,1,3,5,9,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,5,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,1,5,2,4,3,Strongly agree,Strongly agree,Somewhat Disagree,Strongly Disagree,Strongly agree,3,5,1,2,4,6,Somewhat disagree,Disagree,Somewhat agree,Disagree,Strongly disagree,4,2,3,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,85,TRUE,100,FALSE,58,FALSE,91,TRUE,100,TRUE,100,FALSE,100,TRUE,75,FALSE,92,TRUE,76,TRUE,79,FALSE,100,FALSE,61,TRUE,69,FALSE,53,TRUE,100,FALSE,53,TRUE,100,TRUE,77,TRUE,81,FALSE,78,TRUE,78,FALSE,56,TRUE,74,TRUE,77,FALSE,53,TRUE,54,FALSE,52,FALSE,86,TRUE,83,TRUE,78,19,3,2,3,3,3,1,-2,2,1,1,3,1,1,-1,2,1,1,1,-1,-3,3,3,3,3,3,7,-2,1,3,2,1,8,3,3,1,-2,3,6,-3,-3,-3,-3,-3,9,2,2,2,2,2,7,-1,-2,1,-1,0,5,3,3,-1,-3,3,3,-1,-2,1,-2,-3,6,TRUE,0,78,TRUE,1,83,FALSE,1,86,FALSE,1,52,TRUE,1,54,FALSE,1,53,TRUE,1,77,TRUE,1,74,FALSE,0,56,TRUE,1,78,FALSE,1,78,TRUE,0,81,TRUE,1,77,TRUE,0,100,FALSE,0,53,TRUE,1,100,FALSE,1,53,TRUE,0,69,FALSE,1,61,FALSE,1,100,TRUE,1,79,TRUE,1,76,FALSE,1,92,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,91,FALSE,1,58,TRUE,1,100,TRUE,1,85,TRUE,1,100,0.0676,0,0,0.0529,0,0.2209,0.0625,0.0484,0,0.0576,0,0.0529,0.3136,0.0484,0.2116,0.0289,0.0064,0.2304,0.0081,0,0.0441,0.2809,0.1521,1,0.2209,1,0.0225,0.6084,0.0196,0.4761,0.1764,0.6561,0.212385714,0.091542857,0.333228571,19,59.38,25,78.13,5,62.5,8,100,5,62.5,7,87.5,14,87.5,11,68.75,78.72,71,70.75,84.75,88.38,79.19,78.25,-18.75,0.59,8.5,-29.25,22.25,0.88,-8.31,9.5,0,1,0,0,0,3,3,1,1,0,0,2,0,1,1,4,4,4,2,0,1,0,1,1,1,2,0,1,2,1,0,2,2,2,1,2,3,0,1,0,0.2,1.6,0.8,2.8,0.8,1.2,1.4,1.2,1.35,1.15,1.25,7,5,6.375,-0.6,0.4,-0.6,1.6,-0.266666667,0,3,3,3,2,-1,2,1,-1,1,0,0,1,-1,-1,1,-2,10 cents,100 minutes,24 days,Female,University - Undergraduate,68,interesting survey,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,9,3,5,7,6,2,8,1,4,4,2,3,1 +18,R_6uIjsIW8BBWcSri,67 - 73,,Canadian,Canadian,Male,Disagree,Strongly agree,Strongly agree,Strongly disagree,Agree,4,3,1,5,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,1,5,2,3,4,Agree,Agree,Agree,Strongly Disagree,Agree,2,3,5,1,4,Agree,Somewhat agree,Agree,Agree,Somewhat agree,1,2,5,4,3,Disagree,Strongly Agree,Somewhat agree,Strongly disagree,Neither agree nor disagree,5,2,1,3,4,2,Strongly disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,1,5,2,4,3,1,Agree,Agree,Somewhat Agree,Strongly Disagree,Agree,2,1,3,5,4,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Strongly disagree,3,1,2,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,5,3,1,2,4,2,Strongly disagree,Disagree,Agree,Disagree,Disagree,2,4,1,3,5,2,Agree,Agree,Somewhat Agree,Strongly Disagree,Agree,1,5,3,2,4,1,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,2,3,5,1,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,71,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,88,TRUE,100,FALSE,100,TRUE,100,FALSE,84,FALSE,100,TRUE,100,FALSE,100,TRUE,88,TRUE,100,FALSE,50,TRUE,50,TRUE,91,TRUE,100,FALSE,50,TRUE,86,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,100,TRUE,75,25,-2,3,3,-3,2,-3,-3,3,-3,-1,2,2,2,-3,2,2,1,2,2,1,-2,3,1,-3,0,2,-3,-3,2,-2,-1,1,2,2,1,-3,2,2,-1,-1,-1,-2,-3,7,-2,3,3,2,1,2,-3,-2,2,-2,-2,2,2,2,1,-3,2,1,1,1,2,2,1,4,TRUE,0,75,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,86,FALSE,1,50,TRUE,0,100,TRUE,1,91,TRUE,0,50,FALSE,0,50,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,88,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,71,TRUE,1,100,0,0,0,0,0,0,0,0.0196,0,0,0,0.0081,0.25,0.25,0.25,0,0,0.25,1,0.7744,0.7056,0.25,1,0.25,0.7744,0.25,0.0841,0.5625,1,0,1,1,0.345667857,0.073407143,0.617928571,25,78.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,14,87.5,6,37.5,85.41,65.12,89.12,87.38,100,86.38,84.44,15.63,22.91,2.62,26.62,24.88,37.5,-1.12,46.94,0,0,2,0,2,0,0,1,1,0,0,0,1,0,0,3,2,3,4,4,0,0,0,5,1,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0.8,0.4,0.2,3.2,1.2,0.8,0.2,0.2,1.15,0.6,0.875,1.67,1.67,2.625,-0.4,-0.4,0,3,-0.266666667,0,-1,1,3,0,1,1,1,-2,2,1,-1,1,-1,-2,2,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),70,all was well and interesting,0.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,5,6,9,4,8,3,7,1,2,3,2,4,1 +19,R_3jIXWL517XN41G2,46 - 52,American,,American,Male,Disagree,Agree,Agree,Strongly agree,Strongly agree,1,2,5,4,3,Disagree,Disagree,Agree,Somewhat agree,Agree,5,4,1,2,3,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,4,1,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,3,1,2,Somewhat disagree,Agree,Agree,Somewhat agree,Strongly Agree,2,1,3,4,5,3,Disagree,Somewhat disagree,Agree,Somewhat agree,Strongly agree,4,1,5,2,3,3,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,3,5,1,2,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,4,5,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,3,Disagree,Somewhat disagree,Agree,Somewhat agree,Strongly agree,2,3,1,4,5,3,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,4,2,3,3,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,5,2,4,1,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,86,FALSE,55,TRUE,92,FALSE,100,TRUE,100,TRUE,100,TRUE,74,TRUE,100,FALSE,100,FALSE,100,TRUE,92,TRUE,100,TRUE,51,TRUE,100,FALSE,50,FALSE,100,FALSE,69,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,87,TRUE,100,TRUE,50,TRUE,56,TRUE,61,TRUE,100,TRUE,100,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,3,3,-2,-2,2,1,2,2,-2,3,-3,3,-3,-3,-3,-3,-3,-1,2,2,1,3,3,-2,-1,2,1,3,3,2,-2,3,-3,3,3,-3,-3,-3,-3,-3,3,2,1,2,3,3,3,-2,-1,2,1,3,3,2,-2,3,-3,3,3,-3,-3,-3,-2,-3,3,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,55,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,74,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,0,100,TRUE,1,51,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,69,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,87,TRUE,1,100,TRUE,0,50,TRUE,0,56,TRUE,0,61,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0064,0.0676,0,0.0064,0,0,0.2025,0.3136,0.0169,0,0.2401,0.0961,1,0.25,0.25,0,0,0.7396,0,0.3721,0,0.127189286,0.020207143,0.234171429,28,87.5,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,88.22,74.88,86.88,98.38,92.75,94.31,82.12,3.12,3.84,-12.62,-0.62,10.88,17.75,-5.69,13.37,1,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0.6,0.4,0,0,1,0.4,0,0.2,0.25,0.4,0.325,3,3,3,-0.4,0,0,-0.2,-0.133333333,0,0,0,0,0,2,2,2,-2,2,1,-1,-2,2,-2,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,51,"This survey was far too long, far too repetitive and the questions were absurd. I answered accurately, but feel like this was a waste of my time.",1.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,5,2,4,7,3,6,8,1,9,4,2,3,1 +20,R_72nDnI9zDRG0eCR,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,1,5,4,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,2,1,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,5,3,4,1,2,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,4,1,2,5,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,2,5,4,3,1,0,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,2,3,4,5,1,0,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,5,1,3,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,4,1,2,0,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,3,2,0,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,1,2,4,5,3,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,2,3,5,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,76,TRUE,100,TRUE,100,TRUE,90,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,70,TRUE,100,TRUE,91,TRUE,100,FALSE,76,FALSE,100,TRUE,92,TRUE,100,FALSE,100,TRUE,91,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,0,1,-1,1,2,0,0,1,2,3,1,1,-1,-2,0,1,-1,1,3,2,0,1,0,0,1,2,0,0,1,1,2,2,1,1,0,-1,-1,0,1,-1,0,1,3,2,0,1,0,-1,1,2,0,0,0,1,2,2,1,1,0,0,0,0,0,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,76,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,91,TRUE,0,100,FALSE,1,76,FALSE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0576,0.0081,0,0,0,0,0,0.01,0,0.25,0,0,0.25,0,0,0.0064,0.09,0.0576,0,0.8281,0,0,1,1,1,0,1,0.198492857,0.041121429,0.355864286,27,84.38,27,84.38,8,100,7,87.5,6,75,6,75,16,100,11,68.75,93.31,85.75,88.62,100,98.88,93.31,93.31,0,8.93,-14.25,1.12,25,23.88,-6.69,24.56,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,2,0,1,0,0.2,0.2,0.2,0.2,0.2,0,0.2,0.8,0.2,0.3,0.25,0.33,0,0.375,0,0.2,0,-0.6,0.066666667,0,1,0,-2,0.33,0,2,1,-2,2,1,-1,0,0,-2,2,1,10 cents,5 minutes,47 days,Male,Trade School (non-military),67,??,0.875,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,4,2,9,7,5,6,8,1,3,2,3,4,1 +21,R_3xtXT1ced0XvMfT,60 - 66,,Canadian,Canadian,Female,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,1,5,3,4,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,3,5,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,2,4,3,5,1,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,2,5,1,3,4,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,5,4,3,4,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,1,5,4,3,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,3,4,5,1,4,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,5,2,3,4,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,5,3,1,4,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,50,FALSE,95,TRUE,77,FALSE,50,TRUE,50,TRUE,58,FALSE,100,TRUE,80,FALSE,100,TRUE,70,TRUE,86,FALSE,100,FALSE,65,TRUE,97,TRUE,50,TRUE,91,TRUE,50,TRUE,50,TRUE,100,TRUE,91,FALSE,50,FALSE,50,TRUE,50,TRUE,100,TRUE,96,FALSE,99,TRUE,100,TRUE,50,TRUE,97,TRUE,89,FALSE,100,21,2,1,0,0,1,-2,0,1,1,0,2,2,2,0,2,0,-1,-1,1,-1,2,1,0,1,1,4,-2,0,1,0,1,4,2,2,1,0,2,4,0,0,0,0,0,4,2,1,0,1,1,4,-2,0,1,1,0,4,1,2,1,0,1,4,0,0,1,1,0,4,FALSE,1,100,TRUE,1,89,TRUE,0,97,TRUE,0,50,TRUE,1,100,FALSE,1,99,TRUE,1,96,TRUE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,91,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,91,TRUE,0,50,TRUE,0,97,FALSE,1,65,FALSE,1,100,TRUE,1,86,TRUE,1,70,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,58,TRUE,0,50,FALSE,1,50,TRUE,0,77,FALSE,0,95,FALSE,0,50,TRUE,1,95,0,0.1764,0.0081,0.0016,0.0025,0.0001,0.04,0.25,0,0.09,0.9025,0,0.25,0.25,0,0.0121,0,0.25,0.25,0,0.0196,0.25,0.1225,0.25,0.25,0.25,0.25,0,0.9409,0.9409,0.5929,0.8281,0.249717857,0.146228571,0.353207143,21,65.63,21,65.63,5,62.5,6,75,5,62.5,5,62.5,13,81.25,8,50,77.69,56.75,88.38,77.62,88,78.75,76.62,0,12.06,-5.75,13.38,15.12,25.5,-2.5,26.62,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,2,0,1,0.2,0.4,0.2,0.8,0.2,0,0.6,0.8,0.4,0.4,0.4,4,4,4,0,0.4,-0.4,0,0,0,0,0,0,0,1,1,0,-1,1,0,0,0,0,-1,1,1,10 cents,100 minutes,47 days,Female,University - Undergraduate,60,I would like to know the results of my answers.,0.625,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,2,6,3,8,4,7,9,1,5,2,3,4,1 +22,R_6z03p5JYjs5B7kR,53 - 59,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,3,2,1,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Somewhat Agree,1,3,4,5,2,Somewhat disagree,Strongly disagree,Disagree,Somewhat agree,Disagree,4,2,3,1,5,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,5,2,1,4,3,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,5,2,1,4,3,Somewhat Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,1,3,4,2,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,1,5,4,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,1,3,2,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,5,3,4,2,2,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,1,3,5,3,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,1,5,4,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,98,TRUE,78,FALSE,53,FALSE,55,TRUE,100,TRUE,100,TRUE,84,TRUE,99,TRUE,67,TRUE,100,TRUE,99,TRUE,97,TRUE,79,TRUE,99,TRUE,85,TRUE,92,FALSE,55,FALSE,63,TRUE,94,FALSE,54,TRUE,66,TRUE,94,TRUE,98,TRUE,96,TRUE,55,TRUE,99,TRUE,87,TRUE,100,FALSE,61,TRUE,98,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,3,0,1,0,1,0,2,3,3,-1,1,-1,-3,-2,1,-2,2,3,3,1,2,2,2,2,2,1,1,3,1,3,3,0,1,2,2,1,2,1,-1,7,3,3,3,3,3,2,0,1,2,1,1,2,2,3,3,0,1,3,1,-1,-1,1,-2,5,TRUE,0,100,TRUE,1,100,TRUE,0,98,TRUE,0,78,FALSE,0,53,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,99,TRUE,0,67,TRUE,0,100,TRUE,1,99,TRUE,0,97,TRUE,1,79,TRUE,1,99,TRUE,0,85,TRUE,0,92,FALSE,1,55,FALSE,1,63,TRUE,1,94,FALSE,0,54,TRUE,0,66,TRUE,1,94,TRUE,0,98,TRUE,1,96,TRUE,0,55,TRUE,0,99,TRUE,0,87,TRUE,1,100,FALSE,0,61,TRUE,1,98,0,0.0016,0.0001,0,0.0004,0.2025,0.0036,0.0001,0.1369,0.2916,0,0.0001,0.0256,0.4489,0.2809,0,0.4356,0.6084,0.9801,0.9604,0.0036,0.0441,0.2025,0.9409,0.7225,0.3025,0.3721,1,0.9604,0.8464,0.7569,1,0.411678571,0.1739,0.649457143,27,84.38,16,50,4,50,4,50,3,37.5,5,62.5,13,81.25,3,18.75,84.53,72.38,79.62,92,94.12,88.12,80.94,34.38,34.53,22.38,29.62,54.5,31.62,6.87,62.19,0,0,0,0,1,2,1,2,0,1,1,0,0,1,0,3,4,4,0,1,1,0,0,2,0,0,0,2,0,1,0,0,0,1,0,2,2,1,0,0,0.2,1.2,0.4,2.4,0.6,0.6,0.2,1,1.05,0.6,0.825,2.33,2.33,3.25,-0.4,0.6,0.2,1.4,0.133333333,0,1,-1,2,0,1,1,1,-1,1,1,-1,2,-2,1,-1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),55,survey was great very interesting ,0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,2,7,4,5,3,9,8,1,6,2,4,3,1 +23,R_34cU3jQU6zArgQN,60 - 66,,Canadian,Canadian,Male,Disagree,Strongly agree,Agree,Disagree,Agree,5,3,4,1,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,5,4,3,2,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,1,2,4,5,3,Agree,Agree,Strongly Agree,Strongly Agree,Agree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Strongly Agree,Agree,Disagree,Agree,5,3,1,2,4,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,1,5,4,2,1,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,4,3,2,1,5,1,Agree,Agree,Agree,Agree,Agree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Strongly Agree,Agree,Disagree,Somewhat agree,4,5,3,1,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,5,1,2,3,1,Agree,Agree,Strongly agree,Somewhat Agree,Agree,5,1,2,3,4,1,Agree,Somewhat agree,Agree,Agree,Agree,3,5,1,2,4,TRUE,52,TRUE,60,TRUE,94,FALSE,50,TRUE,50,TRUE,52,TRUE,98,TRUE,93,TRUE,52,TRUE,70,TRUE,53,TRUE,95,TRUE,97,TRUE,78,TRUE,52,TRUE,94,TRUE,67,FALSE,60,TRUE,56,FALSE,90,TRUE,52,TRUE,56,TRUE,63,TRUE,84,TRUE,87,TRUE,95,TRUE,52,FALSE,84,TRUE,58,TRUE,86,TRUE,89,TRUE,91,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,2,-2,2,3,-3,3,-3,1,2,2,3,1,2,2,2,3,3,2,-2,3,2,-2,2,1,3,-3,3,-3,1,1,2,2,3,1,2,1,2,2,2,2,2,1,-2,3,2,-2,1,1,3,-3,3,-3,1,1,2,2,3,1,2,1,2,1,2,2,2,1,TRUE,0,52,TRUE,1,60,TRUE,0,94,FALSE,1,50,TRUE,1,50,TRUE,0,52,TRUE,1,98,TRUE,1,93,TRUE,1,52,TRUE,1,70,TRUE,0,53,TRUE,0,95,TRUE,1,97,TRUE,0,78,TRUE,1,52,TRUE,1,94,TRUE,0,67,FALSE,1,60,TRUE,0,56,FALSE,1,90,TRUE,1,52,TRUE,1,56,TRUE,0,63,TRUE,1,84,TRUE,0,87,TRUE,1,95,TRUE,0,52,FALSE,1,84,TRUE,0,58,TRUE,1,86,TRUE,1,89,TRUE,1,91,0.0049,0.0025,0.0036,0.0004,0.0081,0.2704,0.0256,0.09,0.01,0.1936,0.0196,0.0009,0.2304,0.2809,0.25,0.16,0.3969,0.25,0.0256,0.7569,0.2304,0.2304,0.3136,0.6084,0.4489,0.2704,0.0121,0.2704,0.8836,0.16,0.3364,0.9025,0.272714286,0.156171429,0.389257143,21,65.63,20,62.5,5,62.5,4,50,5,62.5,6,75,16,100,4,25,72.19,58,66.25,74.5,90,76.19,68.19,3.13,9.69,-4.5,16.25,12,15,-23.81,43.19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0.4,0.2,0,0,0.6,0.1,0.2,0.15,1,1,1,-0.2,0,0,-0.2,-0.066666667,0,0,0,0,0,1,2,2,-2,2,-1,1,-2,2,-2,2,-1,10 cents,5 minutes,24 days,Male,Trade School (non-military),65,"This was quite different, interesting and kind of fun.",1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,4,2,9,3,8,7,5,1,6,2,4,3,1 +24,R_1nLwqGeXAf3t7vb,53 - 59,,Canadian,Canadian,Male,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly agree,3,5,4,1,2,Disagree,Disagree,Agree,Somewhat agree,Somewhat agree,3,5,1,2,4,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,5,2,3,4,1,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,2,5,4,3,4,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat disagree,5,2,3,4,1,4,Neither Agree nor Disagree,Disagree,Agree,Somewhat Agree,Strongly Agree,5,1,3,2,4,7,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,3,5,4,2,1,3,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,4,5,4,Somewhat Agree,Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,3,1,2,4,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,4,5,3,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,80,FALSE,100,TRUE,100,TRUE,100,FALSE,86,TRUE,95,TRUE,77,TRUE,76,TRUE,100,FALSE,100,FALSE,76,FALSE,100,FALSE,100,TRUE,100,TRUE,60,TRUE,100,TRUE,100,TRUE,100,FALSE,70,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,86,TRUE,100,TRUE,100,FALSE,100,30,0,1,0,1,3,-2,-2,2,1,1,1,-1,1,-3,3,1,2,2,2,1,2,3,3,1,3,5,1,0,3,1,-1,4,0,-2,2,1,3,4,-2,0,-1,-1,-1,7,1,2,2,2,0,3,0,-2,1,1,1,3,1,-2,1,-3,3,4,1,1,1,2,2,3,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,76,FALSE,1,100,TRUE,1,100,TRUE,1,76,TRUE,0,77,TRUE,1,95,FALSE,1,86,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0025,0,0,0.0576,0,0,0,0.09,0,0,0.5929,0.7396,0,0.0196,0,0.16,0.0576,1,0,1,0,0,1,0,0.64,1,0.227135714,0.1059,0.348371429,30,93.75,25,78.13,6,75,6,75,7,87.5,6,75,16,100,9,56.25,93.94,86.5,94.62,95.25,99.38,95.69,92.19,15.62,15.81,11.5,19.62,7.75,24.38,-4.31,35.94,2,2,3,0,0,3,2,1,0,2,1,1,1,4,0,3,2,3,3,2,1,1,2,1,3,2,0,1,0,0,0,1,0,0,0,0,1,1,0,1,1.4,1.6,1.4,2.6,1.6,0.6,0.2,0.6,1.75,0.75,1.25,4.33,3.33,4.125,-0.2,1,1.2,2,0.666666667,2,1,0,4,1,1,2,2,-2,2,1,-1,-1,1,-2,2,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),56,Very interesting survey. I'd be interested how many of the questions I got correct,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,9,6,4,8,5,7,2,1,3,4,3,2,1 +25,R_3CJRdTKCSIpHtQF,60 - 66,American,,American,Male,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Somewhat agree,5,3,2,1,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,4,3,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,2,1,3,5,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Agree,Agree,Disagree,Neither agree nor disagree,2,4,5,1,3,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,5,1,2,3,4,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,4,5,3,8,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,4,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,5,3,1,2,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,3,4,2,8,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,1,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,95,TRUE,100,TRUE,76,FALSE,92,FALSE,86,TRUE,88,FALSE,89,TRUE,70,FALSE,61,FALSE,62,FALSE,83,FALSE,100,FALSE,88,FALSE,93,TRUE,70,TRUE,74,FALSE,63,FALSE,86,FALSE,91,FALSE,75,FALSE,66,TRUE,92,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,82,FALSE,90,TRUE,100,TRUE,100,TRUE,100,23,0,2,2,-1,1,-1,0,1,-1,-1,1,1,1,-1,1,0,-1,1,-1,1,-1,2,2,-2,0,7,-1,-1,1,-1,0,7,2,1,1,0,0,4,0,0,2,0,0,8,-1,1,1,-1,0,7,0,0,1,-1,-1,5,1,0,1,0,1,5,-1,-2,0,0,-1,8,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,90,FALSE,0,82,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,FALSE,1,66,FALSE,1,75,FALSE,0,91,FALSE,1,86,FALSE,0,63,TRUE,1,74,TRUE,0,70,FALSE,1,93,FALSE,1,88,FALSE,1,100,FALSE,0,83,FALSE,0,62,FALSE,1,61,TRUE,1,70,FALSE,1,89,TRUE,1,88,FALSE,1,86,FALSE,1,92,TRUE,0,76,TRUE,1,100,TRUE,1,95,TRUE,1,100,0,0.0144,0.0676,0,0,0,0.09,0.0064,0,0.3844,0,0.8281,0,0.1156,0.6724,0,0.1521,0.01,0.0064,0.0121,0.6889,0.3969,0.0144,0.0196,0.49,0.0196,0.0025,1,1,0.0049,0.5776,0.0625,0.234085714,0.161357143,0.306814286,23,71.88,23,71.88,7,87.5,3,37.5,6,75,7,87.5,11,68.75,12,75,86.62,86,82.88,88.75,88.88,87.5,85.75,0,14.74,-1.5,45.38,13.75,1.38,18.75,10.75,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,2,0.6,0.4,0.6,0.8,0.8,0.2,0.4,1.2,0.6,0.65,0.625,6,5.67,6.375,-0.2,0.2,0.2,-0.4,0.066666667,0,2,-1,0,0.33,0,1,0,-1,1,1,-1,1,-1,-1,1,-1,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,Good survey. I enjoyed it,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,9,4,7,6,2,5,3,1,8,3,4,2,1 +26,R_37BfDy3qhTKSOmA,39 - 45,,Canadian,Canadian,Female,Agree,Somewhat agree,Strongly agree,Strongly agree,Disagree,3,5,4,2,1,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,1,3,4,5,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,4,2,5,3,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Disagree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Strongly Agree,Agree,Disagree,5,4,2,3,1,3,Somewhat agree,Strongly agree,Strongly disagree,Agree,Agree,2,1,4,3,5,3,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,10,Disagree,Neither agree nor disagree,Disagree,Disagree,Strongly disagree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,2,5,1,3,4,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,5,2,1,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,5,4,1,3,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,74,FALSE,89,FALSE,100,FALSE,89,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,100,21,2,1,3,3,-2,1,1,0,2,1,0,-3,3,0,3,1,2,1,-1,-2,2,1,3,2,-2,7,1,3,-3,2,2,3,0,-3,1,3,3,3,-2,0,-2,-2,-3,10,2,1,3,2,0,7,0,0,0,0,0,4,0,-3,3,1,3,1,0,0,0,0,0,9,FALSE,1,100,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,89,FALSE,0,100,FALSE,1,89,FALSE,1,74,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0,0,0,0.25,1,0.25,0.25,0,0,0.7921,0.0121,0.25,0.25,0.25,0.25,0,0,1,0.25,0,1,0,0.25,0.25,0,1,1,1,0.0676,0.334707143,0.253871429,0.415542857,21,65.63,16,50,3,37.5,4,50,4,50,5,62.5,7,43.75,9,56.25,81.31,66,87.5,93.75,78,77.44,85.19,15.63,31.31,28.5,37.5,43.75,15.5,33.69,28.94,0,0,0,1,0,0,2,3,0,1,0,0,2,3,0,3,2,3,1,1,0,0,0,1,2,1,1,0,2,1,0,0,0,1,0,1,2,1,1,2,0.2,1.2,1,2,0.6,1,0.2,1.4,1.1,0.8,0.95,4.33,4,5.5,-0.4,0.2,0.8,0.6,0.2,0,-1,2,1,0.33,2,2,2,-2,2,0,0,-2,2,-2,2,1,20 cents,100 minutes,24 days,Female,College Diploma/Certificate,42,,1.625,0,0,0,0,1,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,4,7,3,9,8,6,5,1,2,4,3,2,1 +27,R_32QFc83XaDmeEmn,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,4,1,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,2,5,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,5,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,3,2,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,3,2,4,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,4,2,5,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,1,3,5,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,4,1,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,23,1,1,1,1,1,1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,23,71.88,17,53.13,4,50,4,50,4,50,5,62.5,16,100,1,6.25,100,100,100,100,100,100,100,18.75,46.87,50,50,50,37.5,0,93.75,0,0,0,0,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0.25,0.25,0.25,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,-1,1,1,-1,0,0,0,0,1,5 cents,100 minutes,24 days,Male,University - Undergraduate,68,Good,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,4,2,7,5,6,3,9,1,8,4,2,3,1 +28,R_3WPuG2TB1D1M4wJ,67 - 73,,Canadian,Canadian,Male,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,1,3,4,5,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,2,1,4,3,5,Agree,Agree,Agree,Agree,Agree,2,1,5,3,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,3,2,5,4,1,8,Agree,Agree,Agree,Agree,Agree,4,1,3,2,5,5,Agree,Agree,Agree,Agree,Agree,2,3,4,5,1,8,Agree,Agree,Agree,Agree,Agree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,1,4,2,5,3,8,Agree,Agree,Agree,Agree,Agree,1,4,5,3,2,8,Agree,Agree,Agree,Agree,Agree,2,4,3,5,1,8,Agree,Agree,Agree,Agree,Agree,3,2,4,5,1,TRUE,77,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,77,TRUE,76,TRUE,50,TRUE,50,TRUE,77,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,80,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,1,1,0,2,1,-1,1,-2,1,2,2,2,2,2,1,1,2,1,1,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,5,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,8,TRUE,0,77,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,77,TRUE,1,76,TRUE,0,50,TRUE,1,50,TRUE,1,77,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,80,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,0.25,0.25,0.0529,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.0576,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.5929,0.25,0.25,0.25,0.5929,0.251192857,0.2184,0.283985714,8,25,16,50,4,50,4,50,4,50,4,50,16,100,0,0,55.84,50,57,59.62,56.75,58.31,53.38,-25,5.84,0,7,9.62,6.75,-41.69,53.38,2,1,1,2,0,1,3,1,4,1,0,0,0,0,0,1,1,0,1,1,2,1,1,2,0,1,3,1,4,1,0,0,0,0,0,1,1,0,1,1,1.2,2,0,0.8,1.2,2,0,0.8,1,1,1,7,8,7.625,0,0,0,0,0,0,0,-3,0,-1,1,1,1,0,0,1,-1,1,-1,0,0,1,10 cents,5 minutes,47 days,Male,Trade School (non-military),73,n/a,0.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,6,4,9,3,5,7,1,8,3,4,2,1 +29,R_3TtmXVWvij8FtpT,46 - 52,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,2,3,4,5,1,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,3,2,5,4,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,5,2,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly disagree,Agree,4,3,1,2,5,0,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,4,3,5,2,0,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,5,4,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,2,4,1,5,3,1,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,2,1,3,4,5,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,3,2,1,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,5,2,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,FALSE,100,TRUE,87,TRUE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,85,FALSE,84,FALSE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,90,FALSE,50,TRUE,77,TRUE,50,FALSE,100,22,0,3,3,-3,1,2,-2,3,-2,0,3,0,3,0,3,1,1,1,1,-2,0,3,3,-3,2,1,2,-2,3,-2,0,0,3,0,3,0,3,0,1,1,1,1,-2,5,0,3,3,-2,1,4,2,-2,3,-2,0,1,3,0,3,0,3,1,1,1,1,1,-2,6,FALSE,1,100,TRUE,1,50,TRUE,0,77,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,84,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,87,FALSE,0,100,TRUE,1,75,0,0,0,0,0.0625,0,0,0,0,0.0225,0.0169,1,1,0,0.01,0.25,0,0.25,0,1,0.7056,0,0,0,0.5625,0.25,1,0,0.5929,1,0.25,1,0.320460714,0.186564286,0.454357143,22,68.75,21,65.63,5,62.5,4,50,6,75,6,75,12,75,9,56.25,89.78,81.25,84.25,98.12,95.5,91.94,87.62,3.12,24.15,18.75,34.25,23.12,20.5,16.94,31.37,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.2,0,0,0,0.05,0.05,0.05,0.33,2,2.25,0,0,0,0,0,-3,-1,-1,-1,-1.67,0,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,,1.75,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,3,4,9,2,7,8,5,1,6,3,4,2,1 +30,R_14BsEKbGVp5mLSn,67 - 73,,Canadian,Canadian,Female,Strongly agree,Agree,Strongly agree,Somewhat agree,Agree,4,3,5,1,2,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,2,1,3,4,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,1,3,4,5,2,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,3,4,2,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,2,5,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,Neither agree nor disagree,3,1,4,2,5,5,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,1,5,4,5,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly disagree,1,4,3,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,5,4,1,2,5,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,5,3,2,4,1,5,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,5,1,3,2,4,5,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,4,1,3,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,98,TRUE,100,FALSE,100,FALSE,66,FALSE,53,FALSE,100,TRUE,100,TRUE,83,TRUE,100,TRUE,100,TRUE,64,TRUE,100,TRUE,100,TRUE,100,FALSE,53,TRUE,100,FALSE,67,TRUE,100,TRUE,80,FALSE,100,FALSE,60,TRUE,100,FALSE,55,TRUE,100,FALSE,100,TRUE,84,TRUE,59,FALSE,99,TRUE,100,TRUE,100,FALSE,54,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,1,2,0,-3,1,-3,0,0,1,1,0,-1,-2,-1,0,-2,-2,3,3,3,1,3,5,0,0,2,-3,0,5,0,2,2,0,0,5,-2,0,0,-2,-3,5,2,3,3,3,0,5,0,-3,0,-2,0,5,0,2,0,-3,0,5,-3,-2,0,-3,-3,5,FALSE,1,98,TRUE,1,100,FALSE,1,100,FALSE,1,66,FALSE,0,53,FALSE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,TRUE,1,100,TRUE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,53,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,0,80,FALSE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,84,TRUE,0,59,FALSE,1,99,TRUE,0,100,TRUE,1,100,FALSE,0,54,TRUE,1,100,0.0289,0.0256,0,0,0,0,0,0,0,0,0,0,0,0.4096,0.2809,0,0.2025,0.1156,0.0001,0,0.36,0.2809,0.64,1,0.1089,0.3481,0.2916,0.0004,0,1,1,1,0.251378571,0.072042857,0.430714286,25,78.13,21,65.63,3,37.5,5,62.5,6,75,7,87.5,12,75,9,56.25,86.72,72,79.38,97.75,97.75,86.69,86.75,12.5,21.09,34.5,16.88,22.75,10.25,11.69,30.5,0,1,0,0,1,0,3,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,2,2,0,0,1,1,0,0,1,1,3,1,1,1,0,1,1,0.4,0.8,0.6,0.4,1.2,0.4,1.2,0.8,0.55,0.9,0.725,5,5,5,-0.8,0.4,-0.6,-0.4,-0.333333333,0,0,0,0,0,0,0,0,-2,2,0,0,0,0,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,72,,0.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,2,6,3,8,9,5,7,1,4,3,2,4,1 +31,R_5vkfEv3GS4mgHJv,60 - 66,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Agree,Disagree,Agree,1,4,5,3,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,5,4,1,3,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Agree,1,3,4,5,2,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,5,2,4,3,1,Agree,Somewhat agree,Agree,Strongly disagree,Agree,3,1,2,5,4,3,Agree,Somewhat disagree,Agree,Somewhat agree,Agree,1,4,2,3,5,5,Somewhat Agree,Somewhat Disagree,Agree,Agree,Agree,3,4,5,2,1,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,1,4,3,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,4,1,2,5,3,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,4,5,2,4,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,1,5,4,3,4,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,2,5,4,3,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,63,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,81,TRUE,100,FALSE,75,TRUE,96,FALSE,95,FALSE,92,TRUE,50,TRUE,100,FALSE,79,FALSE,100,TRUE,65,FALSE,100,TRUE,81,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,91,TRUE,70,FALSE,100,TRUE,75,TRUE,79,TRUE,66,TRUE,98,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,2,-2,2,1,-1,1,-1,1,1,-1,3,1,2,2,1,2,1,-1,2,1,2,-3,2,3,2,-1,2,1,2,5,1,-1,2,2,2,3,1,1,2,1,-1,5,2,1,2,-1,1,5,1,-1,1,-1,1,4,1,-1,0,0,2,4,1,1,2,2,1,6,TRUE,0,63,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,81,TRUE,1,100,FALSE,1,75,TRUE,0,96,FALSE,0,95,FALSE,1,92,TRUE,1,50,TRUE,1,100,FALSE,1,79,FALSE,1,100,TRUE,0,65,FALSE,1,100,TRUE,1,81,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,91,TRUE,0,70,FALSE,1,100,TRUE,0,75,TRUE,1,79,TRUE,1,66,TRUE,1,98,0,0.0081,0,0,0.0004,0,0,0,0,0,0.0441,0.9025,0.0361,0.0625,0,0,0,0.25,0,0,0.0361,0.25,0.4225,0.0064,0.0441,0.49,0.1156,0.3969,0,0,0.5625,0.9216,0.162189286,0.092542857,0.231835714,26,81.25,26,81.25,6,75,6,75,7,87.5,7,87.5,15,93.75,11,68.75,87.69,69.62,91,93.25,96.88,90.06,85.31,0,6.44,-5.38,16,5.75,9.38,-3.69,16.56,1,0,0,1,0,1,0,1,2,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,3,1,0,1,0,0,1,2,0.4,1,0.4,0.2,0.6,0,0.8,0.8,0.5,0.55,0.525,3.67,4.33,4.375,-0.2,1,-0.4,-0.6,0.133333333,-2,1,-1,-1,-0.66,1,1,1,-1,1,-1,1,-1,1,-2,2,1,10 cents,5 minutes,15 days,Female,University - Undergraduate,64,I would like to know how well I did on the quiz! ,1.125,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,9,8,7,5,3,2,4,1,6,4,3,2,1 +32,R_7CUkaE56X55bl7d,67 - 73,American,,American,Female,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,Agree,5,4,3,1,2,Somewhat disagree,Disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,3,4,1,5,2,Strongly Agree,Agree,Agree,Somewhat Agree,Agree,3,1,4,2,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Disagree,Agree,3,2,1,5,4,4,Somewhat agree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,5,4,3,1,6,Agree,Agree,Agree,Agree,Agree,1,2,3,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,3,2,5,1,4,5,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,5,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,5,1,4,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,96,TRUE,100,TRUE,100,TRUE,95,TRUE,100,FALSE,90,FALSE,100,FALSE,100,TRUE,90,TRUE,100,TRUE,100,TRUE,100,TRUE,77,TRUE,100,TRUE,100,TRUE,100,FALSE,89,TRUE,100,TRUE,86,TRUE,100,TRUE,100,TRUE,100,TRUE,83,TRUE,75,TRUE,100,TRUE,100,TRUE,100,27,3,2,3,0,2,-1,-2,3,-1,0,3,2,2,1,2,1,0,0,1,-1,2,2,2,-2,2,5,1,-2,2,-1,1,4,2,2,2,2,2,6,0,0,-1,-1,-2,5,3,0,2,1,0,5,-2,0,0,0,0,5,0,1,0,0,2,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,83,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,89,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,77,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,90,FALSE,1,100,FALSE,0,100,FALSE,0,90,TRUE,0,100,TRUE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,96,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0.0025,0,0,0.81,0,0,0.0196,0.0121,0.0289,0,1,0.5625,1,1,1,0.0529,0.81,1,1,0.9216,0,1,1,1,1,1,0.543575,0.2454,0.84175,27,84.38,16,50,5,62.5,3,37.5,3,37.5,5,62.5,14,87.5,2,12.5,96.28,89.12,97.88,98.75,99.38,95.69,96.88,34.38,46.28,26.62,60.38,61.25,36.88,8.19,84.38,1,0,1,2,0,2,0,1,0,1,1,0,0,1,0,1,0,1,2,1,0,2,1,1,2,1,2,3,1,0,3,1,2,1,0,1,0,0,1,1,0.8,0.8,0.4,1,1.2,1.4,1.4,0.6,0.75,1.15,0.95,5,5,5,-0.4,-0.6,-1,0.4,-0.666666667,0,-1,1,0,0,1,1,1,-1,1,0,0,-1,1,-1,1,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),69,No additional comments,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,7,5,2,3,4,6,8,1,9,3,2,4,1 +33,R_5dKGXxQBJH6raux,67 - 73,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,1,2,3,5,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,4,1,5,2,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,5,3,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,4,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,3,5,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,5,2,1,4,5,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,3,2,5,1,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,2,5,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,2,4,5,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,1,4,5,2,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,61,TRUE,100,FALSE,54,TRUE,99,TRUE,67,TRUE,81,TRUE,90,TRUE,70,FALSE,70,TRUE,68,TRUE,81,FALSE,76,FALSE,55,TRUE,93,FALSE,54,TRUE,100,TRUE,53,TRUE,89,TRUE,100,FALSE,94,FALSE,53,TRUE,52,TRUE,56,TRUE,91,TRUE,93,FALSE,53,TRUE,51,FALSE,51,FALSE,89,TRUE,100,TRUE,100,14,3,3,3,3,1,0,-1,3,-1,1,1,0,3,-3,3,-1,-1,-1,-1,-1,3,3,3,3,1,4,0,0,3,1,0,5,1,0,3,-3,3,5,-1,-1,-1,-1,-1,4,3,3,3,3,1,5,0,0,0,0,0,4,1,0,3,-3,3,5,-1,0,-1,-1,-1,3,TRUE,0,100,TRUE,1,100,FALSE,1,89,FALSE,1,51,TRUE,1,51,FALSE,1,53,TRUE,1,93,TRUE,1,91,TRUE,1,56,TRUE,1,52,FALSE,1,53,FALSE,1,94,TRUE,1,100,TRUE,0,89,TRUE,1,53,TRUE,1,100,FALSE,1,54,TRUE,0,93,FALSE,1,55,FALSE,1,76,TRUE,1,81,TRUE,1,68,FALSE,1,70,TRUE,1,70,TRUE,0,90,TRUE,1,81,TRUE,0,67,TRUE,0,99,FALSE,1,54,TRUE,1,100,FALSE,0,61,TRUE,1,100,0.0081,0.0361,0,0.0049,0,0.2209,0.09,0.2304,0.0576,0.1024,0,0,0.1936,0.2209,0.2401,0,0.09,0.2401,0.9801,0.81,0.0361,0.2209,0.2025,0.7921,0.2116,0.4489,0.3721,1,0.0121,0.8649,0.2116,0.0036,0.280446429,0.120428571,0.440464286,14,43.75,25,78.13,6,75,8,100,4,50,7,87.5,15,93.75,10,62.5,76.38,62,70.38,83.25,89.88,78.56,74.19,-34.38,-1.75,-13,-29.62,33.25,2.38,-15.19,11.69,0,0,0,0,0,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,1,1,0,0,0,0,0,0,1,0,0,0,0,0.8,0,0,0,1.2,0,0.2,0.2,0.35,0.275,4.67,4.67,4.375,0,-0.4,0,-0.2,-0.133333333,-1,1,0,1,0,0,1,1,-1,1,1,-1,-1,1,-1,1,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),68,I enjoyed participating in this survey as I found the activities interesting whether I answered correctly or not!,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,5,8,2,4,9,3,6,1,7,3,2,4,1 +34,R_1qSBBGypd2Ecdjz,39 - 45,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Disagree,Agree,2,3,4,5,1,Strongly disagree,Disagree,Somewhat disagree,Somewhat agree,Strongly agree,5,2,3,1,4,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,5,3,1,2,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,3,2,4,1,Agree,Agree,Agree,Strongly disagree,Agree,2,4,1,5,3,1,Disagree,Disagree,Somewhat agree,Somewhat agree,Agree,1,3,4,5,2,1,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,5,1,3,1,Agree,Agree,Agree,Agree,Agree,2,4,5,1,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Strongly disagree,Agree,4,2,3,1,5,0,Strongly disagree,Strongly disagree,Agree,Somewhat disagree,Agree,2,1,4,5,3,3,Disagree,Disagree,Agree,Disagree,Strongly Agree,3,2,5,4,1,2,Agree,Somewhat agree,Agree,Agree,Agree,5,2,3,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,86,FALSE,50,FALSE,67,FALSE,50,FALSE,50,FALSE,100,TRUE,90,TRUE,93,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,79,FALSE,50,FALSE,50,FALSE,50,TRUE,95,FALSE,50,FALSE,50,FALSE,81,FALSE,50,FALSE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,50,TRUE,97,FALSE,50,FALSE,50,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,-2,2,-3,-2,-1,1,3,-2,-3,3,-3,3,1,1,2,2,1,2,2,2,-3,2,1,-2,-2,1,1,2,1,-2,-3,3,-3,3,1,2,2,2,2,2,1,2,2,2,-3,2,0,-3,-3,2,-1,2,3,-2,-2,2,-2,3,2,2,1,2,2,2,2,FALSE,1,86,FALSE,0,50,FALSE,1,67,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,90,TRUE,1,93,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,79,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,95,FALSE,1,50,FALSE,1,50,FALSE,0,81,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,97,FALSE,0,50,FALSE,0,50,0.0049,0,0.25,0.01,0.25,0,0.25,0,0.25,0.25,0.0009,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.6561,0.25,0.25,0.6241,0.25,0.25,0.25,0.0196,0.1089,0.9025,0.25,1,0.279003571,0.178635714,0.379371429,20,62.5,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,66.81,50,66.38,81.25,69.62,66.31,67.31,9.37,13.68,0,3.88,31.25,19.62,28.81,-1.44,1,0,0,1,0,1,0,2,0,1,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,1,3,2,1,0,1,1,1,0,1,0,0,0,1,0.4,0.8,0,0.6,0.4,1.4,0.6,0.4,0.45,0.7,0.575,1,1.67,1.375,0,-0.6,-0.6,0.2,-0.4,1,-2,-1,-1,-0.67,2,2,2,-2,2,2,-2,-2,2,-2,2,1,5 cents,5 minutes,24 days,Female,University - Undergraduate,42,"Tricky questions, would love to know how I did.",1.375,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,5,6,3,7,8,9,4,1,2,2,4,3,1 +35,R_6sUdYaBray9ntlO,67 - 73,,Canadian,Canadian,Male,Disagree,Agree,Disagree,Agree,Disagree,2,3,1,5,4,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,2,1,3,4,5,Agree,Agree,Somewhat Agree,Disagree,Somewhat Agree,4,5,2,1,3,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Agree,Disagree,Agree,Disagree,5,3,2,4,1,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,2,3,5,1,4,1,Agree,Agree,Somewhat Agree,Disagree,Somewhat Agree,3,5,2,1,4,1,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Disagree,Agree,Disagree,Agree,Disagree,1,5,4,2,3,8,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,2,3,5,4,1,Agree,Agree,Somewhat Agree,Disagree,Somewhat Agree,5,1,2,3,4,2,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,5,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,96,TRUE,98,TRUE,99,TRUE,100,TRUE,74,TRUE,98,TRUE,84,TRUE,90,FALSE,100,TRUE,90,TRUE,92,FALSE,100,FALSE,100,TRUE,98,TRUE,85,TRUE,100,TRUE,63,TRUE,100,TRUE,89,TRUE,98,TRUE,71,TRUE,93,TRUE,58,FALSE,100,TRUE,99,FALSE,59,FALSE,63,FALSE,50,TRUE,89,TRUE,95,TRUE,95,31,-2,2,-2,2,-2,-1,-3,2,-3,0,2,2,1,-2,1,1,1,2,2,1,-2,2,-2,2,-2,1,-1,-2,2,-2,1,1,2,2,1,-2,1,1,1,1,2,2,1,1,-2,2,-2,2,-2,8,-2,-2,2,-2,0,8,2,2,1,-2,1,1,1,1,2,2,1,2,TRUE,0,95,TRUE,1,95,TRUE,0,89,FALSE,1,50,FALSE,0,63,FALSE,1,59,TRUE,1,99,FALSE,0,100,TRUE,1,58,TRUE,1,93,TRUE,0,71,TRUE,0,98,TRUE,1,89,TRUE,0,100,TRUE,1,63,TRUE,1,100,TRUE,0,85,TRUE,0,98,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,1,90,FALSE,1,100,TRUE,1,90,TRUE,0,84,TRUE,1,98,TRUE,0,74,TRUE,0,100,TRUE,0,99,TRUE,1,98,TRUE,1,96,TRUE,1,100,1,0.0004,0,0.0001,0,0.1681,0.01,0.0049,0,0.01,0.0004,0.0121,0.1764,0.5041,0.3969,0.0025,0,0.25,1,0.7056,0.0064,0.1369,0,1,0.7225,0.5476,0.0016,0.9025,0.7921,0.9604,0.9801,0.9604,0.366125,0.109671429,0.622578571,31,96.88,19,59.38,6,75,5,62.5,4,50,4,50,14,87.5,5,31.25,88.31,75.88,85.88,94.62,96.88,89,87.62,37.5,28.93,0.88,23.38,44.62,46.88,1.5,56.37,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0.6,0,0,0.15,0.15,0.15,1,5.67,2.875,0,0,0,0,0,-7,-7,0,-1,-4.67,1,1,1,-1,1,1,-1,1,-1,-1,1,1,5 cents,5 minutes,24 days,Male,High School (or equivalent),68,n/a,0.5,1,1,0,0,0,1,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,4,5,9,3,6,7,8,1,2,3,2,4,1 +36,R_6ZCBZC4aia4UBds,67 - 73,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,4,2,3,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,5,1,2,4,3,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,4,1,5,4,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,5,3,1,2,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,5,1,2,2,Agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,3,5,2,Somewhat agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,4,5,1,3,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,1,Agree,Agree,Agree,Agree,Agree,4,5,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,TRUE,75,TRUE,100,TRUE,100,TRUE,97,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,92,TRUE,100,FALSE,81,FALSE,65,TRUE,100,TRUE,100,25,3,3,3,3,3,-1,-2,3,0,1,3,3,2,2,3,1,0,2,2,-1,2,2,1,0,1,2,-1,-1,3,1,1,4,3,3,3,3,3,1,2,1,1,2,0,2,3,3,3,3,3,1,1,-2,3,-1,3,2,3,3,3,3,3,1,2,2,2,2,2,1,TRUE,0,100,TRUE,1,100,FALSE,1,65,FALSE,1,81,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,97,TRUE,0,100,TRUE,1,100,TRUE,1,75,TRUE,1,50,0,0,0,0,0.25,0.0064,0,0,0,0,0,0,0,0.25,0,0,1,0.0361,0.9409,1,0,0,1,1,1,1,0.0625,1,0.1225,1,1,1,0.416728571,0.110178571,0.723278571,25,78.13,20,62.5,5,62.5,5,62.5,4,50,6,75,16,100,4,25,94.06,88.25,92.75,100,95.25,95.31,92.81,15.63,31.56,25.75,30.25,50,20.25,-4.69,67.81,1,1,2,3,2,0,1,0,1,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,2,0,0,1,2,0,0,1,1,0,1,2,0,0,3,1.8,0.4,0.4,0.8,0,1,0.4,1.2,0.85,0.65,0.75,2.33,1.33,1.75,1.8,-0.6,0,-0.4,0.4,1,2,0,1,1,2,2,2,-2,2,2,-2,1,-1,-2,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,good survey!,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,2,7,4,6,5,9,3,1,8,3,4,2,1 +37,R_30eQfgyKVbfUNdN,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,5,3,2,1,4,Somewhat agree,Somewhat agree,Agree,Agree,Strongly agree,3,1,2,4,5,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,3,4,5,1,2,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Agree,3,5,1,4,2,Agree,Strongly Agree,Somewhat agree,Agree,Somewhat agree,3,5,4,2,1,6,Agree,Agree,Strongly agree,Agree,Somewhat agree,5,4,3,2,1,7,Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,4,3,2,1,5,7,Agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,1,4,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Agree,Strongly Agree,5,4,3,2,1,2,Agree,Agree,Somewhat agree,Agree,Strongly agree,1,3,2,5,4,2,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,Agree,3,1,5,4,2,3,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,1,4,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,66,FALSE,54,FALSE,83,FALSE,55,TRUE,78,TRUE,50,TRUE,80,FALSE,50,FALSE,53,TRUE,51,TRUE,55,TRUE,50,TRUE,50,FALSE,50,TRUE,87,TRUE,50,TRUE,76,FALSE,50,TRUE,58,TRUE,50,TRUE,80,TRUE,50,TRUE,90,TRUE,66,TRUE,86,TRUE,89,TRUE,53,TRUE,97,FALSE,50,TRUE,68,FALSE,50,FALSE,100,16,3,3,2,3,3,1,1,2,2,3,0,1,3,1,2,0,2,1,1,2,2,3,1,2,1,6,2,2,3,2,1,7,2,1,3,2,3,7,2,1,1,2,0,5,2,3,2,2,3,2,2,2,1,2,3,2,3,1,2,3,2,3,1,1,2,2,2,5,FALSE,1,100,FALSE,0,50,TRUE,0,68,FALSE,1,50,TRUE,1,97,TRUE,0,53,TRUE,1,89,TRUE,1,86,TRUE,1,66,TRUE,1,90,TRUE,0,50,TRUE,0,80,TRUE,1,50,TRUE,0,58,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,87,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,55,TRUE,0,51,FALSE,0,53,FALSE,1,50,TRUE,1,80,TRUE,0,50,TRUE,0,78,FALSE,1,55,FALSE,0,83,FALSE,0,54,TRUE,1,66,0.0196,0.04,0.0576,0.0121,0.1156,0.2809,0.2809,0.01,0.25,0.2025,0.6889,0.25,0.1156,0.25,0.0009,0.25,0.2601,0.25,0.6084,0.25,0.25,0.25,0.25,0.3364,0.25,0.25,0.2916,0,0.4624,0.7569,0.2025,0.64,0.285842857,0.228957143,0.342728571,16,50,16,50,3,37.5,5,62.5,6,75,2,25,11,68.75,5,31.25,64.84,52.5,59,76.12,71.75,68.44,61.25,0,14.84,15,-3.5,1.12,46.75,-0.31,30,1,0,1,1,2,1,1,1,0,2,2,0,0,1,1,2,1,0,1,2,1,0,0,1,0,1,1,1,0,0,3,0,1,2,0,1,1,1,1,0,1,1,0.8,1.2,0.4,0.6,1.2,0.8,1,0.75,0.875,6.67,2.33,4.625,0.6,0.4,-0.4,0.4,0.2,4,5,4,0,4.34,2,2,2,-1,1,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,n/a :) very interesting questions.,1.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,9,6,7,3,4,5,8,1,2,4,2,3,1 +38,R_1RPnnJVgH73v1F0,67 - 73,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,2,1,5,4,3,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,Disagree,2,4,1,5,3,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,4,1,5,Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,3,5,2,1,4,Strongly disagree,Agree,Agree,Neither agree nor disagree,Agree,5,4,3,2,1,5,Agree,Strongly disagree,Agree,Strongly disagree,Disagree,2,4,1,3,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Disagree,2,5,3,4,1,2,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,3,4,2,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,5,1,3,2,4,4,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,1,3,5,2,4,4,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,3,2,4,1,5,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,5,3,1,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,85,FALSE,100,FALSE,65,TRUE,100,FALSE,60,TRUE,100,FALSE,55,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,73,FALSE,100,TRUE,100,FALSE,89,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,26,-3,3,3,2,0,0,3,3,-3,-2,1,1,3,0,0,2,3,3,2,1,-3,2,2,0,2,5,2,-3,2,-3,-2,1,0,0,2,0,-2,2,0,-1,0,-1,0,10,-3,3,3,3,-3,4,0,-3,3,-3,-3,4,0,3,3,-3,0,3,2,3,3,3,0,2,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,89,TRUE,1,100,FALSE,0,100,FALSE,0,73,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,65,FALSE,1,100,TRUE,0,85,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,0,0,0,0.0121,0,0,1,0,0,0,0.5329,0,1,0,0.2025,1,0,0.16,0,0,1,0,0,0.1225,1,1,0,0,0.7225,1,0.312589286,0.267678571,0.3575,26,81.25,22,68.75,4,50,6,75,7,87.5,5,62.5,12,75,10,62.5,94.59,92.25,91.12,95,100,98.31,90.88,12.5,25.84,42.25,16.12,7.5,37.5,23.31,28.38,0,1,1,2,2,2,6,1,0,0,1,1,1,0,2,2,4,3,3,1,0,0,0,1,3,0,6,0,0,1,1,2,0,3,0,0,0,0,1,1,1.2,1.8,1,2.6,0.8,1.4,1.2,0.4,1.65,0.95,1.3,2.67,3.67,3.875,0.4,0.4,-0.2,2.2,0.2,1,-3,-1,8,-1,0,2,0,2,-2,-2,2,-2,2,-2,2,-2,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,69,none,0.5,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,2,6,5,4,8,9,3,1,7,2,3,4,1 +39,R_5VPHRV8vSdZKYg6,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Agree,Somewhat agree,Agree,5,2,4,3,1,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,1,4,5,2,3,Agree,Agree,Agree,Agree,Somewhat disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Neither agree nor disagree,Agree,Agree,Disagree,Agree,4,1,3,2,5,2,Disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,2,3,4,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,3,5,2,4,1,7,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,1,3,2,5,0,Disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,2,3,4,1,8,Agree,Somewhat Disagree,Agree,Disagree,Agree,5,2,1,4,3,4,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Disagree,4,3,5,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,100,FALSE,50,FALSE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,50,FALSE,50,TRUE,50,FALSE,100,TRUE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,50,TRUE,50,FALSE,100,FALSE,50,FALSE,100,TRUE,51,TRUE,69,TRUE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,50,TRUE,50,16,2,2,2,1,2,-2,-2,1,0,0,2,-1,2,0,2,2,2,2,2,-1,0,2,2,-2,2,10,-2,-2,1,1,1,2,2,1,0,2,2,4,-1,-1,0,0,-2,7,2,2,2,0,2,8,-2,-2,0,0,-1,0,2,-1,2,-2,2,8,-1,0,-1,1,-2,4,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,69,TRUE,1,51,FALSE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,FALSE,0,50,TRUE,1,100,0.0961,1,0,0.25,0,0,0,1,0,0.25,1,0.25,0.2401,0.25,0.25,0.25,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0,0.258575,0.285007143,0.232142857,16,50,22,68.75,6,75,6,75,3,37.5,7,87.5,11,68.75,11,68.75,70.94,50.12,62.5,75,96.12,70,71.88,-18.75,2.19,-24.88,-12.5,37.5,8.62,1.25,3.13,2,0,0,3,0,0,0,0,1,1,0,2,2,2,0,3,3,2,2,1,0,0,0,1,0,0,0,1,0,1,0,0,0,2,0,3,2,3,1,1,1,0.4,1.2,2.2,0.2,0.4,0.4,2,1.2,0.75,0.975,5.33,5.33,5.375,0.8,0,0.8,0.2,0.533333333,2,2,-4,3,0,-1,-2,0,-2,2,0,0,-2,2,0,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,59,,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,3,2,8,9,4,5,7,1,6,2,4,3,1 +40,R_3OFt005YkPug1PP,67 - 73,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,3,5,1,2,Agree,Disagree,Strongly agree,Somewhat agree,Disagree,2,4,3,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,2,1,4,5,Agree,Somewhat agree,Agree,Agree,Strongly disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,4,5,3,0,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,2,5,4,3,1,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,5,3,0,Agree,Agree,Agree,Agree,Somewhat disagree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,5,1,1,Agree,Disagree,Agree,Agree,Agree,2,1,5,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,4,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,4,2,TRUE,75,TRUE,94,TRUE,93,FALSE,51,FALSE,55,FALSE,55,TRUE,99,FALSE,56,TRUE,92,TRUE,100,TRUE,50,TRUE,95,TRUE,96,TRUE,70,FALSE,54,TRUE,100,FALSE,100,TRUE,57,TRUE,96,FALSE,91,TRUE,52,TRUE,100,FALSE,53,TRUE,100,FALSE,100,FALSE,50,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,93,TRUE,99,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,3,2,-2,3,1,-2,3,3,3,2,3,2,1,2,2,-3,3,3,3,3,3,0,3,-3,3,3,3,0,3,3,3,3,3,8,2,2,2,2,-1,0,3,3,3,3,3,0,2,-2,2,2,2,1,3,3,3,3,3,1,3,3,3,3,3,0,TRUE,0,75,TRUE,1,94,TRUE,0,93,FALSE,1,51,FALSE,0,55,FALSE,1,55,TRUE,1,99,FALSE,0,56,TRUE,1,92,TRUE,1,100,TRUE,0,50,TRUE,0,95,TRUE,1,96,TRUE,0,70,FALSE,0,54,TRUE,1,100,FALSE,1,100,TRUE,0,57,TRUE,0,96,FALSE,1,91,TRUE,1,52,TRUE,1,100,FALSE,1,53,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,99,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,93,TRUE,1,99,0.3136,0.25,0,0.0001,0.0001,0.2025,0,0,0.0081,0,0,0.0016,0.0064,0.25,0.3025,0.0036,0.2209,0.2401,1,0,0.2304,0.2916,0.9216,0.49,0,0.9801,0.0049,0.5625,0.8649,0.3249,1,0.9025,0.314614286,0.088271429,0.540957143,23,71.88,18,56.25,4,50,6,75,4,50,4,50,12,75,6,37.5,82.03,78.62,76.25,81.38,91.88,83.75,80.31,15.63,25.78,28.62,1.25,31.38,41.88,8.75,42.81,0,0,0,2,0,1,1,0,2,5,0,0,0,1,0,0,1,0,0,2,0,0,0,2,0,0,0,1,1,4,0,0,0,1,0,1,2,1,1,6,0.4,1.8,0.2,0.6,0.4,1.2,0.2,2.2,0.75,1,0.875,2.67,0.67,1.25,0,0.6,0,-1.6,0.2,0,-1,7,0,2,-1,-2,-2,-1,1,2,-2,2,-2,-1,1,-2,10 cents,25 minutes,24 days,Male,High School (or equivalent),68,none,-1.125,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,4,7,5,3,6,2,9,1,8,2,3,4,1 +41,R_5n247JOppS7EHxw,39 - 45,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Agree,3,1,5,4,2,Disagree,Disagree,Somewhat agree,Somewhat agree,Agree,5,4,1,2,3,Somewhat Disagree,Disagree,Agree,Disagree,Agree,1,2,4,3,5,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,1,5,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,5,2,4,1,3,4,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,2,5,1,4,3,5,Neither Agree nor Disagree,Disagree,Somewhat Agree,Strongly Disagree,Agree,1,2,4,5,3,8,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,5,Disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,1,2,3,4,3,Disagree,Disagree,Somewhat Agree,Strongly Disagree,Neither Agree nor Disagree,4,5,2,1,3,9,Agree,Agree,Agree,Agree,Agree,3,2,5,4,1,FALSE,71,TRUE,91,TRUE,100,FALSE,50,TRUE,93,FALSE,86,TRUE,92,TRUE,90,TRUE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,76,FALSE,91,TRUE,75,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,87,TRUE,91,TRUE,100,FALSE,100,TRUE,100,TRUE,60,TRUE,100,TRUE,50,FALSE,85,TRUE,83,FALSE,70,TRUE,81,TRUE,57,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,1,2,-2,-2,1,1,2,-1,-2,2,-2,2,-2,-1,-1,-1,-3,3,3,-2,3,3,7,-2,0,0,-2,-2,4,0,-2,1,-3,2,5,1,2,1,2,1,8,0,0,0,0,0,5,-2,-3,0,0,1,5,-2,-2,1,-3,0,3,2,2,2,2,2,9,FALSE,1,71,TRUE,1,91,TRUE,0,100,FALSE,1,50,TRUE,1,93,FALSE,1,86,TRUE,1,92,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,91,TRUE,1,75,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,87,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,0,50,FALSE,1,85,TRUE,0,83,FALSE,0,70,TRUE,1,81,TRUE,1,57,0.01,0,0,0.0064,0.1849,0.0196,0,0,0.0169,0,0.49,0.0576,0,0.25,0.0049,0.0081,0,0.25,0.0225,0.36,0.0081,0.0625,0.25,0.0081,0.25,0.25,0.0361,0.0841,1,1,0.6889,0,0.189367857,0.091571429,0.287164286,28,87.5,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,82.16,68.38,79.5,89.25,91.5,88.5,75.81,12.5,7.16,-6.62,4.5,14.25,16.5,-5.25,19.56,1,1,4,2,1,0,2,1,3,4,1,0,1,1,0,3,3,2,3,4,2,2,2,1,2,0,1,1,1,1,1,0,1,1,2,4,3,3,3,5,1.8,2,0.6,3,1.8,0.8,1,3.6,1.85,1.8,1.825,5.33,4.33,5.75,0,1.2,-0.4,-0.6,0.266666667,2,-1,2,-1,1,2,2,2,-2,2,0,0,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,41,,1.5,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,7,5,2,9,8,3,6,1,4,2,4,3,1 +42,R_5luzhX0pDEWLnPl,67 - 73,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,5,2,4,3,Strongly disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,2,5,1,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Disagree,Strongly Agree,2,1,5,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Strongly disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Agree,2,5,3,1,4,8,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,3,1,5,4,2,4,Strongly Agree,Strongly Agree,Agree,Disagree,Strongly Agree,3,4,1,5,2,5,Disagree,Disagree,Disagree,Disagree,Strongly disagree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,5,4,3,1,2,3,Strongly disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,5,1,4,3,2,6,Strongly agree,Agree,Somewhat Agree,Disagree,Strongly agree,2,5,1,4,3,7,Disagree,Disagree,Disagree,Disagree,Strongly disagree,5,1,2,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,99,TRUE,94,FALSE,90,FALSE,83,TRUE,93,FALSE,98,TRUE,85,FALSE,76,TRUE,93,TRUE,94,FALSE,100,FALSE,92,FALSE,99,FALSE,87,TRUE,97,FALSE,66,FALSE,90,FALSE,94,TRUE,100,FALSE,85,TRUE,95,TRUE,79,TRUE,95,TRUE,91,FALSE,98,TRUE,75,FALSE,73,TRUE,99,TRUE,80,FALSE,100,26,2,3,3,2,1,-3,0,2,1,1,1,1,1,-2,3,-1,0,-1,-2,-3,3,3,3,-2,2,4,-3,0,1,0,2,8,3,3,2,-2,3,4,-2,-2,-2,-2,-3,5,2,3,2,2,0,7,-3,1,2,0,2,3,3,2,1,-2,3,6,-2,-2,-2,-2,-3,7,FALSE,1,100,TRUE,1,80,TRUE,0,99,FALSE,1,73,TRUE,1,75,FALSE,1,98,TRUE,1,91,TRUE,1,95,TRUE,1,79,TRUE,1,95,FALSE,1,85,TRUE,0,100,FALSE,0,94,FALSE,1,90,FALSE,0,66,TRUE,1,97,FALSE,1,87,FALSE,1,99,FALSE,1,92,FALSE,1,100,TRUE,1,94,TRUE,1,93,FALSE,1,76,TRUE,1,85,FALSE,1,98,TRUE,1,93,FALSE,1,83,FALSE,1,90,TRUE,0,94,TRUE,1,99,TRUE,1,100,TRUE,1,100,0.0025,0.0049,0.0009,0.0081,0,0.0004,0.0225,0.0025,0,0.0049,0.0001,0.8836,0.0441,0.0225,0.0625,0.04,0.0576,0.0729,0.01,0.0004,0.0036,0.4356,0.0064,0.01,0.0169,0.0289,0,0,0.9801,0.0001,0.8836,1,0.1639,0.086685714,0.241114286,26,81.25,27,84.38,7,87.5,6,75,8,100,6,75,14,87.5,13,81.25,90.62,82.25,89.75,94.88,95.62,89.75,91.5,-3.13,6.24,-5.25,14.75,-5.12,20.62,2.25,10.25,1,0,0,4,1,0,0,1,1,1,2,2,1,0,0,1,2,1,0,0,0,0,1,0,1,0,1,0,1,1,2,1,0,0,0,1,2,1,0,0,1.2,0.6,1,0.8,0.4,0.6,0.6,0.8,0.9,0.6,0.75,5.33,5.33,5.5,0.8,0,0.4,0,0.4,-3,5,-2,-2,0,1,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),68,A lot of the questions were quite difficult,1.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,3,2,5,8,6,4,9,1,7,3,4,2,1 +43,R_6PzcODVrTnHwgj7,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,4,5,1,2,3,Agree,Disagree,Agree,Disagree,Somewhat agree,5,3,2,4,1,Strongly Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,2,5,4,3,1,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Agree,4,2,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,5,2,3,4,1,1,Agree,Disagree,Somewhat agree,Disagree,Agree,4,5,3,2,1,1,Agree,Agree,Agree,Disagree,Strongly Agree,1,2,4,5,3,1,Agree,Agree,Agree,Somewhat agree,Agree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,5,4,2,3,1,1,Strongly agree,Strongly disagree,Somewhat agree,Strongly disagree,Disagree,3,1,5,4,2,1,Strongly agree,Strongly agree,Agree,Disagree,Strongly agree,3,2,4,5,1,1,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,5,2,3,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,60,TRUE,100,TRUE,100,FALSE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,82,FALSE,60,FALSE,100,FALSE,60,FALSE,100,FALSE,100,TRUE,100,TRUE,86,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,59,FALSE,66,FALSE,100,TRUE,100,FALSE,100,24,3,3,2,-1,3,2,-2,2,-2,1,3,2,0,-1,3,-1,1,2,1,2,3,3,3,1,3,1,2,-2,1,-2,2,1,2,2,2,-2,3,1,2,2,2,1,2,1,3,3,3,1,3,1,3,-3,1,-3,-2,1,3,3,2,-2,3,1,2,-1,1,1,2,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,66,FALSE,0,59,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,60,FALSE,1,100,FALSE,0,60,TRUE,1,82,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0324,0,0,0,0,0.3481,0,1,0.1156,0,0,0.36,0.0196,0.16,1,0,0.2304,0.36,0,0,0,1,0,0.165217857,0.106864286,0.223571429,24,75,26,81.25,7,87.5,4,50,7,87.5,8,100,13,81.25,13,81.25,91.41,78,89.88,97.75,100,90.44,92.38,-6.25,10.16,-9.5,39.88,10.25,0,9.19,11.13,0,0,1,2,0,0,0,1,0,1,1,0,2,1,0,3,1,0,0,0,0,0,1,2,0,1,1,1,1,3,0,1,2,1,0,3,2,1,0,0,0.6,0.4,0.8,0.8,0.6,1.4,0.8,1.2,0.65,1,0.825,1,1,1,0,-1,0,-0.4,-0.333333333,0,0,0,0,0,-2,-2,-1,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,Very interesting survey,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,7,9,2,8,5,4,6,1,3,3,2,4,1 +44,R_7SdDoaxdAAkVHyl,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Agree,Somewhat agree,Strongly disagree,Somewhat agree,5,2,3,1,4,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,4,1,5,2,3,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,3,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,5,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Agree,3,4,1,2,5,4,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,1,3,2,4,5,8,Somewhat Disagree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,5,1,3,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Strongly disagree,4,1,3,5,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Neither agree nor disagree,Disagree,Agree,1,4,2,5,3,4,Somewhat agree,Disagree,Agree,Disagree,Agree,4,3,2,5,1,10,Somewhat Disagree,Disagree,Agree,Somewhat Agree,Agree,2,3,5,1,4,3,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,4,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,69,FALSE,50,TRUE,100,FALSE,53,TRUE,73,FALSE,50,TRUE,94,TRUE,100,FALSE,50,TRUE,100,TRUE,80,TRUE,100,TRUE,89,FALSE,100,FALSE,100,TRUE,100,TRUE,79,TRUE,91,FALSE,72,FALSE,100,TRUE,87,FALSE,57,FALSE,57,TRUE,79,TRUE,61,TRUE,87,FALSE,50,FALSE,100,TRUE,84,TRUE,100,TRUE,57,TRUE,58,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,-3,1,-2,1,-1,1,0,-1,0,2,0,2,-3,-3,-3,-3,-3,1,1,1,-2,2,4,1,-1,1,-1,2,8,-1,-2,1,0,0,3,-1,-1,1,-2,-3,10,1,2,0,-2,2,4,1,-2,2,-2,2,10,-1,-2,2,1,2,3,-2,1,1,0,0,10,TRUE,0,69,FALSE,0,50,TRUE,0,100,FALSE,1,53,TRUE,1,73,FALSE,1,50,TRUE,1,94,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,89,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,79,TRUE,0,91,FALSE,1,72,FALSE,1,100,TRUE,1,87,FALSE,0,57,FALSE,1,57,TRUE,1,79,TRUE,0,61,TRUE,1,87,FALSE,1,50,FALSE,1,100,TRUE,0,84,TRUE,1,100,TRUE,1,57,TRUE,1,58,0,0.0169,0,0.0036,0.1764,0.25,0.0441,0,0,0.3249,0,0.0121,0.25,0.64,0.0729,0.25,0.1849,0.2209,0,0.3721,0.0169,1,0.0784,0,0.6241,0.25,0.1849,0.4761,1,0.8281,0.7056,1,0.320085714,0.1733,0.466871429,15,46.88,20,62.5,4,50,6,75,4,50,6,75,12,75,8,50,78.97,64,72.12,82.38,97.38,80.06,77.88,-15.62,16.47,14,-2.88,32.38,22.38,5.06,27.88,0,1,0,1,1,3,2,2,2,2,0,2,1,0,2,2,2,4,1,0,0,0,1,1,1,3,3,3,3,2,0,2,0,1,0,1,4,4,3,3,0.6,2.2,1,1.8,0.6,2.8,0.6,3,1.4,1.75,1.575,5,5.67,6.5,0,-0.6,0.4,-1.2,-0.066666667,0,-2,0,0,-0.67,2,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,27,long,1.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,4,9,3,5,8,6,2,1,7,4,2,3,1 +45,R_6aaknJPN9Yr00Yu,67 - 73,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Strongly disagree,Agree,4,1,3,2,5,Agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,3,5,1,2,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,1,2,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,2,1,3,4,5,Agree,Strongly Agree,Agree,Strongly disagree,Agree,3,2,1,4,5,1,Agree,Strongly disagree,Agree,Strongly disagree,Agree,2,3,5,1,4,1,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,2,3,1,2,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Somewhat disagree,Somewhat disagree,4,1,3,2,5,4,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,5,3,6,Agree,Agree,Agree,Somewhat Agree,Agree,4,3,2,1,5,6,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,5,3,1,4,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,75,TRUE,100,FALSE,84,FALSE,100,FALSE,91,TRUE,100,FALSE,100,TRUE,100,TRUE,64,TRUE,100,TRUE,50,FALSE,85,TRUE,100,TRUE,100,TRUE,91,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,-3,2,2,-3,2,-3,1,1,2,3,3,3,0,1,1,2,1,2,3,2,-3,2,1,2,-3,2,-3,2,1,1,2,3,3,3,2,2,2,2,2,2,7,2,3,2,-1,-1,4,1,-2,2,0,0,6,2,2,2,1,2,6,-1,0,0,2,1,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,TRUE,0,100,FALSE,1,84,FALSE,1,100,FALSE,0,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,TRUE,0,50,FALSE,1,85,TRUE,0,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.25,0.0225,0.4096,0.8281,0.25,0.0256,1,0.0625,0.25,0.0081,0,0,1,1,1,0.227014286,0.035714286,0.418314286,28,87.5,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,90.31,78.12,89.5,95.5,98.12,92.62,88,12.5,15.31,3.12,14.5,33,10.62,-1.13,31.75,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,1,0,1,0,0,0,2,3,1,1,0,3,1,1,0,1,2,1,1,1,1,0,0,0,0.2,0,1,1,1.2,1,0.6,0.3,0.95,0.625,1.33,5.33,4.25,-1,-1,-1,0.4,-1,-3,-5,-4,0,-4,1,1,1,-2,2,-1,1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,70,interesting. enjoyed the exercise,1.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,3,5,6,7,9,8,4,1,2,4,3,2,1 +46,R_34faNNc4HIy8yfY,67 - 73,American,,American,Female,Strongly agree,Agree,Strongly agree,Agree,Agree,3,1,2,5,4,Somewhat disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,1,4,2,5,3,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,3,4,5,1,2,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,2,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,4,5,2,1,5,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,1,2,4,3,5,7,Agree,Agree,Agree,Somewhat Disagree,Agree,2,5,3,4,1,7,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Strongly Agree,Agree,Agree,3,4,1,5,2,3,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Agree,4,1,2,5,3,2,Agree,Agree,Agree,Somewhat Disagree,Agree,1,5,2,3,4,9,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,5,3,1,4,TRUE,89,FALSE,50,TRUE,100,FALSE,69,TRUE,97,TRUE,62,TRUE,93,TRUE,76,TRUE,77,TRUE,90,TRUE,62,TRUE,95,FALSE,72,TRUE,99,FALSE,73,TRUE,57,TRUE,73,TRUE,100,TRUE,79,FALSE,100,FALSE,99,TRUE,70,FALSE,78,TRUE,75,TRUE,79,TRUE,94,FALSE,76,FALSE,100,FALSE,81,TRUE,100,FALSE,74,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,2,2,-1,0,3,1,1,2,1,2,0,2,-2,-2,0,1,-1,3,3,3,2,2,7,0,-2,2,0,1,5,2,2,2,-1,2,7,0,-1,-1,0,-2,7,3,2,3,2,2,5,0,-2,2,-1,2,3,2,2,2,-1,2,2,1,0,1,1,0,9,TRUE,0,89,FALSE,0,50,TRUE,0,100,FALSE,1,69,TRUE,1,97,TRUE,0,62,TRUE,1,93,TRUE,1,76,TRUE,1,77,TRUE,1,90,TRUE,0,62,TRUE,0,95,FALSE,0,72,TRUE,0,99,FALSE,0,73,TRUE,1,57,TRUE,0,73,TRUE,0,100,TRUE,0,79,FALSE,1,100,FALSE,0,99,TRUE,1,70,FALSE,1,78,TRUE,1,75,TRUE,0,79,TRUE,1,94,FALSE,1,76,FALSE,1,100,FALSE,1,81,TRUE,1,100,FALSE,0,74,TRUE,1,100,0.0576,0.0036,0.1849,0.0049,0,0.3844,0.0625,0.01,0,0.09,0,0.5184,0.0529,0.3844,0.0009,0.25,0.0484,0.0961,0,0.6241,0.9801,0.5329,0.6241,0.9801,0.5329,0.0576,0.5476,0.7921,1,1,0.0361,0.9025,0.375289286,0.135571429,0.615007143,17,53.13,17,53.13,3,37.5,4,50,4,50,6,75,11,68.75,6,37.5,82.47,70,82.75,89.25,87.88,81.06,83.88,0,29.34,32.5,32.75,39.25,12.88,12.31,46.38,0,1,0,0,0,1,2,1,1,0,0,1,0,1,0,2,1,1,1,1,0,0,0,0,0,1,2,1,2,1,0,1,0,1,0,3,2,1,0,1,0.2,1,0.4,1.2,0,1.4,0.4,1.4,0.7,0.8,0.75,6.33,3.33,5.625,0.2,-0.4,0,-0.2,-0.066666667,2,2,5,-2,3,1,1,1,-2,2,0,0,0,0,-1,1,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,70,"Loved it, very thought provoking.",0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,6,9,5,2,3,8,4,1,7,3,4,2,1 +47,R_1AYXGgvcxrcayA6,39 - 45,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Disagree,Strongly disagree,Neither agree nor disagree,5,3,2,1,4,Disagree,Disagree,Somewhat agree,Strongly disagree,Somewhat disagree,2,3,5,1,4,Disagree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,2,1,4,5,3,Disagree,Somewhat agree,Disagree,Disagree,Strongly disagree,2,1,3,5,4,Strongly disagree,Strongly Agree,Strongly disagree,Disagree,Disagree,2,1,4,3,5,0,Disagree,Disagree,Somewhat agree,Strongly disagree,Disagree,3,4,2,5,1,0,Disagree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,1,3,4,2,1,Somewhat agree,Somewhat agree,Disagree,Disagree,Strongly disagree,4,3,1,5,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Agree,Neither agree nor disagree,Strongly disagree,Disagree,1,2,3,5,4,2,Disagree,Disagree,Somewhat agree,Strongly disagree,Disagree,2,4,5,1,3,1,Disagree,Agree,Strongly Agree,Disagree,Strongly Agree,5,2,4,3,1,0,Somewhat agree,Agree,Neither agree nor disagree,Disagree,Strongly disagree,3,4,1,5,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,92,TRUE,50,TRUE,95,TRUE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,97,TRUE,50,TRUE,97,TRUE,100,TRUE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,97,FALSE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,8,-3,3,-2,-3,0,-2,-2,1,-3,-1,-2,2,3,-1,3,-2,1,-2,-2,-3,-3,3,-3,-2,-2,0,-2,-2,1,-3,-2,0,-2,2,3,0,3,1,1,1,-2,-2,-3,0,-3,2,0,-3,-2,2,-2,-2,1,-3,-2,1,-2,2,3,-2,3,0,1,2,0,-2,-3,0,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,97,TRUE,0,50,TRUE,1,97,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,95,TRUE,1,50,FALSE,0,92,0,0,0,0,0.8464,0.25,0.0009,0,0.25,0.0009,0.0025,0,0.25,0,0.25,0.25,0.25,0.25,0,1,0,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,0.25,0.9409,0.331842857,0.185764286,0.477921429,8,25,18,56.25,5,62.5,4,50,4,50,5,62.5,15,93.75,3,18.75,77.44,56.25,67.75,93.38,92.38,83.19,71.69,-31.25,21.19,-6.25,17.75,43.38,29.88,-10.56,52.94,0,0,1,1,2,0,0,0,0,1,0,0,0,1,0,3,0,0,0,0,0,1,2,0,2,0,0,0,0,1,0,0,0,1,0,3,1,2,0,0,0.8,0.2,0.2,0.6,1,0.2,0.2,1.2,0.45,0.65,0.55,0.33,1,0.5,-0.2,0,0,-0.6,-0.066666667,-2,-1,1,0,-0.67,0,1,2,-1,1,0,0,-1,1,-2,2,1,10 cents,5 minutes,24 days,Male,Trade School (non-military),45,,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,7,8,2,9,3,5,4,1,6,2,4,3,1 +48,R_6Q47AqweUbtMBRT,67 - 73,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,5,1,2,4,Strongly agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,2,4,1,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,5,2,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,3,1,5,4,2,8,Strongly agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,5,4,1,2,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,2,5,1,3,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,4,2,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,1,2,3,5,3,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,3,4,1,2,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,1,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,75,TRUE,100,FALSE,60,TRUE,50,TRUE,70,TRUE,77,TRUE,90,TRUE,75,FALSE,50,TRUE,100,FALSE,50,TRUE,87,TRUE,100,TRUE,77,TRUE,100,FALSE,63,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,71,TRUE,100,23,3,3,3,2,3,3,-1,3,-1,3,3,3,3,3,3,2,1,2,2,-1,3,3,3,-2,3,8,3,-1,3,-1,3,8,3,3,3,2,3,0,1,-1,1,1,-1,5,3,3,3,3,3,3,3,-3,3,-3,2,5,3,3,3,2,3,3,1,0,0,1,-1,5,TRUE,0,100,FALSE,0,71,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,63,TRUE,1,100,TRUE,0,77,TRUE,0,100,TRUE,0,87,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,0,75,TRUE,1,90,TRUE,0,77,TRUE,1,70,TRUE,0,50,FALSE,1,60,TRUE,0,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.09,0,0,0,0,0.01,0,0.25,0.25,0.0625,0,0.25,0.25,0.25,0.5041,0.5625,0.25,0.16,0.5929,0,0.3969,0.7569,1,0.5929,0.25,0.25,1,1,1,1,1,0.415667857,0.188507143,0.642828571,23,71.88,16,50,3,37.5,4,50,3,37.5,6,75,11,68.75,5,31.25,79.53,58.88,87.75,87.12,84.38,79.31,79.75,21.88,29.53,21.38,37.75,49.62,9.38,10.56,48.5,0,0,0,4,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,0,0,0,0,1,0,0,2,0,2,1,0,0,0,1,0,1,1,2,1,0,0.8,0,0.2,1,0.2,1,0.2,1,0.5,0.6,0.55,5.33,3.67,4.625,0.6,-1,0,0,-0.133333333,5,3,-3,0,1.66,1,2,1,-2,2,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,69,was a good survey- enjoyed doing it,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,9,2,3,5,6,4,7,1,8,3,4,2,1 +49,R_3z5vrZ4mxBm70tb,25 - 31,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Somewhat agree,Agree,5,3,2,4,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Agree,2,5,1,3,4,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Disagree,Agree,1,2,5,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Agree,Agree,Somewhat disagree,Agree,5,3,2,1,4,3,Agree,Agree,Neither agree nor disagree,Somewhat agree,Agree,2,4,5,3,1,2,Strongly Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,1,3,4,9,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Strongly Agree,Strongly Agree,Agree,3,4,1,5,2,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,1,2,3,4,5,1,Agree,Disagree,Agree,Somewhat Disagree,Agree,1,2,4,3,5,3,Agree,Agree,Agree,Agree,Agree,2,4,1,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,54,FALSE,75,TRUE,95,FALSE,50,TRUE,60,TRUE,80,FALSE,96,TRUE,91,FALSE,90,TRUE,70,TRUE,100,FALSE,50,TRUE,75,TRUE,100,TRUE,70,TRUE,100,TRUE,91,FALSE,74,TRUE,90,FALSE,65,FALSE,70,TRUE,90,TRUE,80,TRUE,100,TRUE,75,FALSE,100,TRUE,75,FALSE,50,FALSE,79,TRUE,65,FALSE,96,24,1,2,2,1,2,-1,0,1,2,2,1,-2,1,-1,2,1,1,1,2,1,1,2,2,-1,2,7,2,2,0,1,2,3,3,-1,1,1,1,2,-1,-1,-1,-1,0,9,2,2,3,3,2,6,1,1,2,1,2,5,2,-2,2,-1,2,1,2,2,2,2,2,3,FALSE,1,96,TRUE,1,65,FALSE,1,79,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,100,TRUE,1,80,TRUE,1,90,FALSE,1,70,FALSE,1,65,TRUE,1,90,FALSE,1,74,TRUE,1,91,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,75,FALSE,1,50,TRUE,1,100,TRUE,1,70,FALSE,1,90,TRUE,1,91,FALSE,1,96,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,95,FALSE,0,75,FALSE,0,54,TRUE,1,96,0,0.04,0,0.0625,0.0016,0,0.0081,0.01,0.25,0.09,0.5625,0.01,0.04,0.09,0.0625,0.1225,0.01,0.25,0.25,0.0016,0,0.0081,0.5625,0.0676,0.49,0.36,0.2916,0.0016,0.0441,1,0.9025,0.1225,0.200332143,0.107657143,0.293007143,24,75,25,78.13,5,62.5,6,75,7,87.5,7,87.5,14,87.5,11,68.75,79.75,68.12,89.5,85.12,76.25,83.25,76.25,-3.13,1.62,5.62,14.5,-2.38,-11.25,-4.25,7.5,0,0,0,2,0,3,2,1,1,0,2,1,0,2,1,2,2,2,3,1,1,0,1,2,0,2,1,1,1,0,1,0,1,0,0,1,1,1,0,1,0.4,1.4,1.2,2,0.8,1,0.4,0.8,1.25,0.75,1,4,4,4.5,-0.4,0.4,0.8,1.2,0.266666667,1,-2,1,6,0,1,2,2,-1,1,0,0,1,-1,-2,2,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,30,,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,2,4,9,3,7,6,1,8,4,3,2,1 +50,R_7u4PSg6FKCVx4Qx,53 - 59,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Agree,Agree,2,4,5,3,1,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,4,3,5,2,1,Agree,Somewhat Agree,Agree,Disagree,Agree,5,1,2,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,4,5,1,2,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat disagree,1,2,3,4,5,7,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,5,1,4,2,3,7,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,3,5,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Agree,Strongly Agree,5,2,3,1,4,8,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,2,3,4,1,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,3,4,2,5,1,2,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat agree,2,4,5,3,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,83,FALSE,89,TRUE,79,TRUE,71,FALSE,91,TRUE,64,TRUE,62,TRUE,62,TRUE,82,TRUE,66,TRUE,79,FALSE,70,FALSE,94,FALSE,89,FALSE,89,TRUE,60,TRUE,88,FALSE,59,TRUE,65,TRUE,65,FALSE,67,FALSE,74,TRUE,77,FALSE,53,TRUE,84,TRUE,76,FALSE,70,TRUE,58,FALSE,59,FALSE,67,TRUE,71,TRUE,77,22,1,3,1,2,2,-1,0,2,1,-1,2,1,2,-2,2,0,1,1,1,-1,-1,1,1,-2,-1,7,-2,1,2,1,-1,7,3,1,2,3,3,1,1,1,1,-1,-1,4,3,2,2,2,3,8,-1,1,1,2,0,5,3,3,3,-2,3,2,2,1,2,3,1,4,TRUE,0,77,TRUE,1,71,FALSE,1,67,FALSE,1,59,TRUE,1,58,FALSE,1,70,TRUE,1,76,TRUE,1,84,FALSE,0,53,TRUE,1,77,FALSE,1,74,FALSE,1,67,TRUE,1,65,TRUE,0,65,FALSE,0,59,TRUE,1,88,TRUE,0,60,FALSE,1,89,FALSE,1,89,FALSE,1,94,FALSE,0,70,TRUE,1,79,TRUE,0,66,TRUE,1,82,TRUE,0,62,TRUE,1,62,TRUE,0,64,FALSE,1,91,TRUE,0,71,TRUE,1,79,FALSE,0,89,TRUE,1,83,0.0256,0.1444,0.0144,0.0576,0.0289,0.09,0.0324,0.0529,0.0036,0.0441,0.0441,0.1225,0.2809,0.0676,0.1764,0.0841,0.4356,0.1681,0.0081,0.3844,0.49,0.3481,0.0121,0.4225,0.36,0.4096,0.7921,0.5929,0.1089,0.0121,0.5041,0.1089,0.220892857,0.116514286,0.325271429,22,68.75,21,65.63,4,50,4,50,5,62.5,8,100,12,75,9,56.25,73.12,69.75,67.88,73.38,81.5,73.44,72.81,3.12,7.49,19.75,17.88,10.88,-18.5,-1.56,16.56,2,2,0,4,3,1,1,0,0,0,1,0,0,5,1,1,0,0,2,0,2,1,1,0,1,0,1,1,1,1,1,2,1,0,1,2,0,1,2,2,2.2,0.4,1.4,0.6,1,0.8,1,1.4,1.15,1.05,1.1,5,5,4.75,1.2,-0.4,0.4,-0.8,0.4,-1,2,-1,0,0,1,1,2,-1,1,2,-2,1,-1,-2,2,0,10 cents,100 minutes,15 days,Male,University - Undergraduate,54,Good questions to ponder on,0.5,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,8,3,9,6,5,4,7,1,2,2,3,4,1 +51,R_7lyqTGSyYrIwngs,46 - 52,,Canadian,Canadian,Female,Strongly agree,Agree,Strongly agree,Agree,Agree,1,3,5,4,2,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,5,1,4,2,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly Agree,5,4,1,3,2,Disagree,Somewhat agree,Somewhat disagree,Disagree,Somewhat disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Strongly Agree,Somewhat disagree,Strongly Agree,3,5,2,4,1,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly agree,1,4,5,3,2,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,3,2,5,1,4,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Somewhat disagree,2,3,4,5,1,5,Strongly disagree,Neither agree nor disagree,Disagree,Agree,Disagree,3,5,2,4,1,5,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,5,2,1,4,3,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,3,4,5,FALSE,75,TRUE,66,TRUE,55,FALSE,75,TRUE,88,FALSE,75,TRUE,50,TRUE,55,TRUE,50,TRUE,88,FALSE,55,TRUE,75,FALSE,55,FALSE,75,TRUE,50,TRUE,99,FALSE,55,FALSE,88,FALSE,55,FALSE,100,TRUE,55,TRUE,88,FALSE,99,TRUE,66,FALSE,99,TRUE,75,FALSE,66,FALSE,75,FALSE,55,TRUE,55,TRUE,55,TRUE,55,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,2,2,-2,0,-1,1,0,1,0,2,-3,3,-2,1,-1,-2,-1,3,2,3,-1,3,3,-3,0,0,-2,3,5,1,0,1,-3,3,6,3,3,3,3,3,8,3,2,3,3,-1,5,-3,0,-2,2,-2,5,-1,0,0,-3,3,5,-3,-3,-3,-3,-3,8,FALSE,1,75,TRUE,1,66,TRUE,0,55,FALSE,1,75,TRUE,1,88,FALSE,1,75,TRUE,1,50,TRUE,1,55,TRUE,1,50,TRUE,1,88,FALSE,1,55,TRUE,0,75,FALSE,0,55,FALSE,1,75,TRUE,1,50,TRUE,1,99,FALSE,1,55,FALSE,1,88,FALSE,1,55,FALSE,1,100,TRUE,1,55,TRUE,1,88,FALSE,1,99,TRUE,1,66,FALSE,1,99,TRUE,1,75,FALSE,1,66,FALSE,1,75,FALSE,1,55,TRUE,1,55,TRUE,1,55,TRUE,1,55,0.2025,0.0625,0.0001,0.25,0.2025,0.0625,0.1156,0.0144,0,0.0144,0.2025,0.3025,0.25,0.2025,0.0144,0.1156,0.0001,0.0625,0.0625,0.0001,0.2025,0.25,0.2025,0.0625,0.2025,0.1156,0.2025,0.0625,0.3025,0.0144,0.2025,0.5625,0.143021429,0.111392857,0.17465,24,75,29,90.63,8,100,7,87.5,8,100,6,75,15,93.75,14,87.5,69.59,59,67.12,79.75,72.5,65.62,73.56,-15.63,-21.04,-41,-20.38,-20.25,-2.5,-28.13,-13.94,0,0,0,3,1,1,0,1,3,3,0,0,1,0,0,5,2,4,5,4,0,0,0,1,3,1,0,1,1,2,2,0,2,0,0,1,4,2,1,2,0.8,1.6,0.2,4,0.8,1,0.8,2,1.65,1.15,1.4,4.67,5,5.625,0,0.6,-0.6,2,0,-2,0,1,0,-0.33,2,2,2,-1,1,-1,1,-1,1,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,46,I would like to have gotten the correct answers to the true and false questions after that section of the quiz.,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,3,2,6,5,7,8,9,1,4,4,3,2,1 +52,R_7ilfgOcIomd4yMA,53 - 59,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,5,4,1,2,3,Agree,Disagree,Strongly agree,Strongly disagree,Agree,2,5,4,1,3,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,4,1,3,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,2,4,3,1,5,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,Agree,5,1,2,3,4,7,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,2,5,3,1,9,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,5,4,3,2,7,Agree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,5,2,4,1,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,5,3,4,2,1,8,Agree,Disagree,Agree,Strongly disagree,Somewhat agree,4,1,2,5,3,8,Strongly Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,5,4,3,2,1,8,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,1,2,5,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,85,FALSE,100,TRUE,60,TRUE,87,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,83,TRUE,50,TRUE,100,FALSE,86,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,86,FALSE,100,TRUE,100,TRUE,86,TRUE,100,TRUE,100,FALSE,100,TRUE,75,TRUE,63,TRUE,84,TRUE,58,FALSE,100,24,1,3,3,0,2,2,-2,3,-3,2,2,1,3,0,3,1,1,2,2,0,1,3,3,-1,2,7,2,-3,3,-3,2,9,3,2,3,1,3,7,2,3,3,2,0,9,3,3,3,1,2,8,2,-2,2,-3,1,8,3,2,3,0,2,8,2,1,2,2,0,9,FALSE,1,100,TRUE,1,58,TRUE,0,84,TRUE,0,63,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,86,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,86,TRUE,0,100,TRUE,1,50,TRUE,1,83,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,60,FALSE,1,100,FALSE,0,85,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0.0289,0.7225,1,0.0196,0,0.0625,0.1764,1,0.3969,0.36,0,0.25,0.25,0.0196,1,0.25,0.7569,0,0,0.7056,1,0,0.7396,0.347803571,0.314771429,0.380835714,24,75,20,62.5,6,75,5,62.5,6,75,3,37.5,14,87.5,6,37.5,87.59,78.75,84.38,97.88,89.38,86.69,88.5,12.5,25.09,3.75,21.88,22.88,51.88,-0.81,51,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,1,2,1,0,0,2,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0,0,0,0.2,0.2,0.6,0.8,0.6,0.4,0.6,0.2,0.45,0.45,0.45,7.67,8,8.125,-0.4,-0.2,0,0.6,-0.2,-1,1,-1,0,-0.33,0,2,2,-2,2,0,0,2,-2,-1,1,2,10 cents,100 minutes,15 days,Male,Trade School (non-military),57,Very thought provoking and interesting survey!,0.875,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,9,3,6,4,7,5,8,1,2,3,4,2,1 +53,R_3CKH5nALclcXyCd,67 - 73,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,1,5,4,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,2,4,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,3,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,3,2,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,2,3,4,5,1,1,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,5,1,1,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,2,5,1,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,5,3,2,4,0,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,1,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,3,1,2,4,5,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,3,1,2,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,90,TRUE,90,FALSE,50,TRUE,75,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,80,FALSE,100,TRUE,100,TRUE,50,FALSE,80,TRUE,80,TRUE,80,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,80,TRUE,100,FALSE,100,28,3,3,3,2,3,-1,-1,0,0,0,2,0,3,-3,3,1,1,1,1,-2,2,3,3,1,2,3,-1,-2,0,0,0,1,2,-2,3,-3,3,1,-1,0,-1,0,-2,2,2,3,3,3,2,1,-2,0,0,0,0,0,2,-3,2,-3,3,1,-1,0,0,0,-2,1,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,80,TRUE,1,80,FALSE,1,80,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,80,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,50,TRUE,0,90,TRUE,1,90,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.01,0.04,0,0.25,0,0,0,0.25,0.25,0,0,0.25,0,0.04,0,0.5625,0,0,0.64,0.64,0.81,0.64,0.156517857,0.039285714,0.27375,28,87.5,25,78.13,5,62.5,7,87.5,7,87.5,6,75,16,100,9,56.25,89.22,78.12,96.25,95,87.5,95,83.44,9.37,11.09,15.62,8.75,7.5,12.5,-5,27.19,1,0,0,1,1,0,1,0,0,0,0,2,0,0,0,2,1,2,1,0,1,0,0,1,1,1,1,0,0,0,0,3,1,0,0,2,1,1,1,0,0.6,0.2,0.4,1.2,0.6,0.4,0.8,1,0.6,0.7,0.65,1.67,0.67,1.25,0,-0.2,-0.4,0.2,-0.2,2,1,0,1,1,1,1,1,-2,2,0,0,-2,2,-2,2,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,69,Very interesting survey.,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,02DGEN,02REV,9,6,2,8,7,5,3,1,4,4,2,3,1 +54,R_6J2a15FEPNrer3J,60 - 66,American,,American,Female,Strongly agree,Agree,Strongly agree,Somewhat agree,Somewhat disagree,1,3,2,4,5,Disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,4,3,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Agree,4,3,1,2,5,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,1,5,3,4,Agree,Agree,Agree,Somewhat disagree,Disagree,3,5,2,1,4,5,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,5,3,4,1,2,6,Agree,Agree,Agree,Agree,Agree,1,2,3,4,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,2,3,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Strongly Agree,Somewhat disagree,2,1,5,3,4,3,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,4,3,1,2,5,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,2,4,3,1,5,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,5,4,3,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,69,TRUE,82,FALSE,50,FALSE,50,FALSE,50,FALSE,91,FALSE,100,FALSE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,50,TRUE,83,FALSE,50,TRUE,81,TRUE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,90,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,86,TRUE,100,FALSE,50,20,3,2,3,1,-1,-2,-2,1,1,1,2,0,3,-1,2,-2,-1,0,-1,-1,2,2,2,-1,-2,5,1,-1,2,-1,1,6,2,2,2,2,2,2,1,1,1,2,1,8,2,2,2,3,-1,3,-1,-1,2,1,-1,4,2,1,1,-1,2,2,1,0,1,1,0,7,FALSE,1,50,TRUE,1,100,FALSE,1,86,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,83,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,91,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,82,FALSE,0,69,TRUE,1,100,0,0.8281,0.0361,0,0,0,0.25,0.01,0,0.25,0.0324,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0,0.25,0.25,0.25,1,0.25,0.25,0.4761,0.25,0.0196,0.6889,0.25,1,0.249178571,0.128028571,0.370328571,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,9,56.25,12,75,72.88,58.62,68.75,83,81.12,72.69,73.06,-3.13,7.25,-3.88,6.25,20.5,6.12,16.44,-1.94,1,0,1,2,1,3,1,1,2,0,0,2,1,3,0,3,2,1,3,2,1,0,1,2,0,1,1,1,0,2,0,1,2,0,0,3,1,1,2,1,1,1.4,1.2,2.2,0.8,1,0.6,1.6,1.45,1,1.225,4.33,3,4.625,0.2,0.4,0.6,0.6,0.4,2,2,0,1,1.33,1,2,-1,-1,1,1,-1,0,0,-2,2,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,61,I enjoyed the survey very much...thank you,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,7,6,8,5,9,3,4,1,2,4,2,3,1 +55,R_7p6hcM2Xv9ALWsn,53 - 59,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,3,1,5,2,Strongly disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,1,2,3,5,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,4,1,3,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Strongly disagree,Strongly Agree,Agree,Strongly Agree,3,2,5,1,4,2,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly disagree,Agree,2,3,5,1,4,2,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,5,1,2,3,4,5,Disagree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,1,3,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,2,1,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,2,4,5,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,1,4,5,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,1,5,TRUE,94,FALSE,75,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,96,TRUE,96,TRUE,50,TRUE,100,TRUE,92,TRUE,97,TRUE,93,TRUE,50,FALSE,50,TRUE,88,TRUE,50,TRUE,93,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,2,0,2,-3,-2,2,-2,0,2,0,3,-3,3,0,1,2,1,0,0,-3,3,2,3,5,-3,-3,-1,-3,2,2,2,0,0,-3,3,2,-2,1,1,-2,0,5,0,0,3,3,3,1,0,0,0,0,0,1,2,0,0,-3,3,5,0,0,0,0,0,5,TRUE,0,94,FALSE,0,75,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,100,TRUE,1,50,FALSE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,0,96,TRUE,1,50,TRUE,1,100,TRUE,0,92,TRUE,0,97,TRUE,0,93,TRUE,0,50,FALSE,0,50,TRUE,1,88,TRUE,0,50,TRUE,1,93,TRUE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,100,1,0.25,0,0,0,0.25,0.0049,1,0.25,0.0144,0.25,0.0016,0.25,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.8649,0.9216,0.8464,0.25,0.25,0.8836,1,0.9409,0.25,0.25,0.394314286,0.255957143,0.532671429,23,71.88,14,43.75,6,75,3,37.5,2,25,3,37.5,9,56.25,5,31.25,71.06,58.5,67.25,84.38,74.12,75.12,67,28.13,27.31,-16.5,29.75,59.38,36.62,18.87,35.75,0,3,1,2,1,0,1,3,1,2,0,0,3,0,0,2,0,1,3,0,0,0,1,3,1,3,2,2,2,0,0,0,3,0,0,0,1,2,1,0,1.4,1.4,0.6,1.2,1,1.8,0.6,0.8,1.15,1.05,1.1,3,2.33,3.25,0.4,-0.4,0,0.4,-7.4E-17,4,1,-3,0,0.67,0,2,1,-2,2,0,0,2,-2,-1,1,0,5 cents,100 minutes,15 days,Male,High School (or equivalent),55,feel dumber,0.5,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,5,2,9,8,6,7,4,1,3,3,2,4,1 +56,R_1TpH8LJdYVHcyHm,53 - 59,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,2,3,5,1,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,2,5,3,1,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,4,1,2,3,Agree,Agree,Agree,Agree,Agree,4,5,1,2,3,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,2,5,3,4,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,4,5,1,3,2,1,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,5,4,1,2,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,1,2,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,2,1,3,4,5,4,Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,3,4,1,2,1,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,4,2,1,5,1,Agree,Agree,Agree,Agree,Agree,1,4,2,5,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,65,FALSE,50,FALSE,50,FALSE,50,TRUE,80,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,60,FALSE,50,FALSE,50,TRUE,85,FALSE,80,TRUE,60,TRUE,90,TRUE,100,TRUE,60,TRUE,80,TRUE,100,TRUE,100,FALSE,50,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,1,3,1,0,2,-1,1,1,1,3,1,3,2,2,2,2,2,1,3,3,1,3,1,1,0,3,1,1,1,1,1,3,2,3,4,1,1,1,1,1,7,1,3,3,1,3,4,2,1,2,1,0,1,1,1,3,0,3,1,2,2,2,2,2,4,TRUE,0,100,TRUE,1,75,TRUE,0,65,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,80,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,0,60,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,80,TRUE,1,60,TRUE,0,90,TRUE,1,100,TRUE,0,60,TRUE,0,80,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0.04,0,0.25,0.16,0.25,0.25,0.0225,0,0,0.25,0,0.25,0.0625,0.04,0.25,0.64,0.81,0.25,0.25,0.36,0,0,0.36,0.25,1,0.4225,1,1,1,0.325982143,0.1275,0.524464286,20,62.5,16,50,3,37.5,5,62.5,4,50,4,50,9,56.25,7,43.75,76.09,61.88,78.75,88.12,75.62,71.88,80.31,12.5,26.09,24.38,16.25,38.12,25.62,15.63,36.56,0,0,0,0,0,0,0,1,2,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,2,1,0,0,0,1,0,0,0,0,0,0,0,0.6,0.2,1,0,1,0.2,0,0.45,0.3,0.375,2,2,2.875,0,-0.4,0,1,-0.133333333,-3,0,3,3,0,1,1,0,-2,2,1,-1,1,-1,-1,1,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,58,,0.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,01DIR,7,8,5,2,3,6,9,1,4,2,4,3,1 +57,R_6DRa1CrwESPCbtv,67 - 73,,Canadian,Canadian,Male,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,3,5,4,2,1,Somewhat agree,Somewhat disagree,Agree,Strongly disagree,Somewhat agree,1,3,2,4,5,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,3,2,4,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,3,4,2,1,5,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat disagree,Strongly Agree,2,1,3,5,4,8,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat agree,5,4,3,2,1,8,Strongly Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,3,1,5,2,4,8,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Agree,4,5,2,3,1,8,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,5,1,2,3,4,8,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,5,2,3,4,7,Agree,Somewhat agree,Agree,Agree,Agree,3,4,1,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,65,TRUE,74,TRUE,84,FALSE,60,TRUE,71,FALSE,81,TRUE,89,TRUE,81,TRUE,76,TRUE,90,FALSE,64,TRUE,73,TRUE,82,TRUE,50,TRUE,81,TRUE,100,FALSE,50,TRUE,73,TRUE,57,TRUE,100,TRUE,81,TRUE,64,FALSE,54,TRUE,77,FALSE,74,TRUE,80,TRUE,60,FALSE,50,TRUE,50,TRUE,58,TRUE,50,TRUE,63,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,2,-1,0,2,1,-1,2,-3,1,3,-1,3,0,3,1,0,2,2,-1,0,2,-1,-1,3,8,1,0,1,-2,1,8,3,-1,2,0,3,8,0,1,1,0,0,7,0,2,0,1,2,8,1,0,2,0,1,8,3,2,2,0,3,7,2,1,2,2,2,7,FALSE,1,65,TRUE,1,74,TRUE,0,84,FALSE,1,60,TRUE,1,71,FALSE,1,81,TRUE,1,89,TRUE,1,81,TRUE,1,76,TRUE,1,90,FALSE,1,64,TRUE,0,73,TRUE,1,82,TRUE,0,50,TRUE,1,81,TRUE,1,100,FALSE,1,50,TRUE,0,73,TRUE,0,57,TRUE,0,100,TRUE,1,81,TRUE,1,64,FALSE,1,54,TRUE,1,77,FALSE,1,74,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,50,TRUE,1,58,TRUE,1,50,TRUE,1,63,0.0361,0.04,0,0.0121,0.1369,0.0361,0.0529,0.01,1,0.1296,0.1764,0.0324,0.0576,0.1296,0.0841,0.0676,0.2116,0.16,0.25,0.0676,0.0361,0.0361,0.3249,0.25,0.25,0.36,0.25,0.1225,0.7056,0.5329,0.25,0.5329,0.223335714,0.1632,0.283471429,25,78.13,24,75,6,75,7,87.5,6,75,5,62.5,16,100,8,50,70.69,65.25,66.5,73.12,77.88,76.06,65.31,3.13,-4.31,-9.75,-21,-1.88,15.38,-23.94,15.31,0,0,0,1,1,0,1,1,1,0,0,0,1,0,0,1,1,1,2,1,0,0,1,1,0,0,1,0,3,0,0,3,1,0,0,1,1,0,0,3,0.4,0.6,0.2,1.2,0.4,0.8,0.8,1,0.6,0.75,0.675,8,7.67,7.625,0,-0.2,-0.6,0.2,-0.266666667,0,0,1,0,0.33,1,0,0,0,0,0,0,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,69,interesting,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,9,7,3,4,8,5,6,1,2,3,2,4,1 +58,R_1CjweTLqC4QaUJP,39 - 45,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,2,4,5,3,Agree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,3,5,4,2,1,Agree,Agree,Strongly Agree,Agree,Neither Agree nor Disagree,1,3,2,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Agree,Strongly Agree,Agree,4,3,1,2,5,9,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Agree,3,2,4,5,1,9,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,5,3,4,1,2,10,Agree,Agree,Agree,Strongly Agree,Agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,3,5,1,2,10,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,10,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,5,4,3,2,10,Agree,Agree,Agree,Agree,Agree,3,1,4,2,5,TRUE,73,TRUE,84,FALSE,85,FALSE,71,FALSE,88,TRUE,85,TRUE,81,TRUE,76,TRUE,77,TRUE,78,FALSE,71,FALSE,81,TRUE,78,FALSE,77,TRUE,78,FALSE,82,TRUE,72,TRUE,82,FALSE,75,TRUE,76,TRUE,68,FALSE,83,TRUE,79,FALSE,77,TRUE,79,FALSE,80,TRUE,76,FALSE,76,TRUE,77,TRUE,79,FALSE,83,TRUE,75,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,0,3,2,-3,0,-3,-3,2,2,3,2,0,3,3,3,3,3,2,2,2,3,2,9,1,0,0,-2,2,9,0,1,0,2,1,9,2,2,2,3,2,10,2,2,2,0,2,9,2,2,2,2,2,10,3,3,2,3,2,10,2,2,2,2,2,10,TRUE,0,73,TRUE,1,84,FALSE,1,85,FALSE,1,71,FALSE,0,88,TRUE,0,85,TRUE,1,81,TRUE,1,76,TRUE,1,77,TRUE,1,78,FALSE,1,71,FALSE,1,81,TRUE,1,78,FALSE,1,77,TRUE,1,78,FALSE,0,82,TRUE,0,72,TRUE,0,82,FALSE,1,75,TRUE,0,76,TRUE,1,68,FALSE,0,83,TRUE,0,79,FALSE,0,77,TRUE,0,79,FALSE,0,80,TRUE,0,76,FALSE,1,76,TRUE,0,77,TRUE,1,79,FALSE,0,83,TRUE,1,75,0.0576,0.64,0.6724,0.0361,0.0625,0.7225,0.5929,0.0484,0.5776,0.6889,0.0441,0.0484,0.0529,0.0841,0.7744,0.0256,0.6241,0.0841,0.0576,0.6241,0.1024,0.0484,0.0625,0.0529,0.5184,0.5776,0.6889,0.5329,0.0225,0.6724,0.5929,0.0361,0.322146429,0.316464286,0.327828571,30,93.75,17,53.13,6,75,3,37.5,3,37.5,5,62.5,10,62.5,7,43.75,78.19,76.88,77.75,79.12,79,79.19,77.19,40.62,25.06,1.88,40.25,41.62,16.5,16.69,33.44,1,1,1,3,1,1,3,0,1,5,2,1,3,0,1,1,1,1,0,1,1,1,1,0,1,0,5,2,5,5,1,1,1,1,2,1,1,1,1,1,1.4,2,1.4,0.8,0.8,3.4,1.2,1,1.4,1.6,1.5,9,9.67,9.5,0.6,-1.4,0.2,-0.2,-0.2,0,-1,-1,0,-0.67,0,0,1,0,0,1,-1,1,-1,1,-1,1,10 cents,25 minutes,24 days,Female,University - Graduate (Masters),41,like,-0.125,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,9,5,3,6,7,4,2,1,8,2,4,3,1 +59,R_5ddcGt1nU3rO4Rm,60 - 66,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,3,2,1,4,Disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,2,4,3,5,1,Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Agree,5,2,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,3,5,2,1,4,7,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,1,4,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,2,3,4,5,8,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,2,1,4,3,5,1,Disagree,Disagree,Agree,Disagree,Somewhat agree,5,3,1,2,4,2,Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Agree,4,1,2,3,5,8,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,2,3,5,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,74,TRUE,93,TRUE,100,FALSE,100,TRUE,50,TRUE,95,FALSE,62,TRUE,50,FALSE,50,TRUE,98,TRUE,96,FALSE,100,FALSE,50,FALSE,98,FALSE,50,TRUE,97,FALSE,50,FALSE,99,FALSE,50,TRUE,66,FALSE,96,TRUE,63,TRUE,77,TRUE,96,TRUE,97,FALSE,86,TRUE,93,FALSE,50,TRUE,91,TRUE,95,FALSE,95,26,0,3,3,1,2,-2,-2,2,0,1,2,0,1,-2,2,0,0,0,1,-1,0,3,3,1,1,3,0,-1,1,1,1,7,1,0,0,1,0,3,-2,-1,-1,-1,-2,8,0,3,3,2,0,3,-2,-2,2,-2,1,1,2,0,1,-2,2,2,0,-1,0,0,-2,8,FALSE,1,95,TRUE,1,95,TRUE,0,91,FALSE,1,50,TRUE,1,93,FALSE,1,86,TRUE,1,97,TRUE,1,96,TRUE,1,77,TRUE,1,63,FALSE,1,96,TRUE,0,66,FALSE,0,50,FALSE,1,99,FALSE,0,50,TRUE,1,97,FALSE,1,50,FALSE,1,98,FALSE,1,50,FALSE,1,100,TRUE,1,96,TRUE,1,98,FALSE,1,50,TRUE,1,50,FALSE,1,62,TRUE,1,95,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,93,TRUE,1,74,TRUE,1,100,0.0016,0.0025,0.0009,0.0009,0,0.0196,0.25,0.1369,0,0.0004,0.0049,0.25,0.0529,0.0016,0.0049,0.0025,0.25,0.25,0,0.1444,0.0016,0.25,0.25,0.0001,0.25,0.25,0.0676,0.0025,0.8281,0.0004,1,0.4356,0.168,0.087407143,0.248592857,26,81.25,26,81.25,6,75,6,75,8,100,6,75,14,87.5,12,75,80.22,67.75,78.12,88.38,86.62,82.75,77.69,0,-1.03,-7.25,3.12,-11.62,11.62,-4.75,2.69,0,0,0,0,1,2,1,1,1,0,1,0,1,3,2,2,1,1,2,1,0,0,0,1,2,0,0,0,2,0,0,0,0,0,0,0,1,0,1,1,0.2,1,1.4,1.4,0.6,0.4,0,0.6,1,0.4,0.7,4.33,2,4.375,-0.4,0.6,1.4,0.8,0.533333333,0,6,1,0,2.33,1,2,2,-1,1,-1,1,-1,1,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),65,None ,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,8,9,4,7,5,2,6,1,3,2,3,4,1 +60,R_7P6o620cMbqo84U,60 - 66,,Canadian,Canadian,Female,Strongly agree,Neither agree nor disagree,Agree,Agree,Disagree,2,1,4,3,5,Disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,1,2,3,4,Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,1,2,4,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,2,5,4,1,3,Strongly Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,1,5,3,2,4,5,Disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,4,1,5,2,3,7,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,5,2,3,4,1,2,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,5,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Somewhat agree,Agree,Strongly disagree,5,3,4,1,2,6,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,4,2,1,3,5,Agree,Agree,Agree,Strongly Disagree,Strongly Agree,5,2,4,3,1,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,50,TRUE,70,TRUE,95,TRUE,75,FALSE,100,TRUE,75,FALSE,100,TRUE,80,FALSE,100,TRUE,90,TRUE,80,FALSE,100,TRUE,80,FALSE,90,FALSE,95,TRUE,100,TRUE,75,FALSE,100,TRUE,90,FALSE,100,FALSE,100,TRUE,90,TRUE,90,TRUE,100,TRUE,95,FALSE,95,TRUE,95,FALSE,50,FALSE,100,TRUE,80,FALSE,90,16,3,0,2,2,-2,-2,-2,1,1,-1,2,1,2,-2,3,1,1,1,2,-1,3,1,2,2,0,5,-2,-3,2,-1,-1,7,2,2,2,-1,3,2,2,2,1,1,1,3,3,1,1,2,-3,6,-2,0,1,0,-1,5,2,2,2,-3,3,3,0,0,0,0,0,5,FALSE,1,90,TRUE,1,80,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,95,FALSE,1,90,TRUE,0,80,FALSE,1,100,TRUE,1,80,TRUE,1,90,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,0,75,TRUE,0,95,TRUE,1,70,FALSE,0,50,TRUE,1,95,0,0.0625,0,0.0025,0.0025,0.0025,0.04,0.01,0,0.01,0.09,0.01,0.01,0,0.0025,0.04,0,0.25,0.5625,0,0.04,0.0625,0.64,0,0.0025,0,0.25,0.01,0,0.01,0.9025,0,0.105267857,0.033392857,0.177142857,16,50,28,87.5,6,75,7,87.5,8,100,7,87.5,15,93.75,13,81.25,88.28,78.12,93.12,91.25,90.62,84.69,91.88,-37.5,0.78,3.12,5.62,-8.75,3.12,-9.06,10.63,0,1,0,0,2,0,1,1,2,0,0,1,0,1,0,1,1,0,1,2,0,1,1,0,1,0,2,0,1,0,0,1,0,1,0,1,1,1,2,1,0.6,0.8,0.4,1,0.6,0.6,0.4,1.2,0.7,0.7,0.7,4.67,4.67,4.5,0,0.2,0,-0.2,0.066666667,-1,2,-1,-2,0,0,2,2,-2,2,1,-1,0,0,-2,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,"It was different than the usual surveys. More interesting in some respects and it delves more into the internal ideas of a person instead of beliefs about the outer world. It made me really think about ""how I think""!",1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,8,9,7,3,6,4,1,5,2,3,4,1 +61,R_3XNQMr9xxovT2eJ,60 - 66,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,Agree,3,5,4,2,1,Strongly agree,Somewhat disagree,Somewhat agree,Disagree,Agree,1,4,3,5,2,Agree,Somewhat Disagree,Agree,Somewhat Agree,Strongly Agree,5,3,4,1,2,Agree,Agree,Agree,Agree,Agree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat disagree,Strongly Agree,Agree,Somewhat disagree,Somewhat disagree,5,3,4,1,2,4,Strongly agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,4,3,5,2,1,2,Agree,Somewhat Agree,Agree,Strongly Agree,Agree,5,3,2,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,4,3,5,2,1,1,Agree,Somewhat disagree,Agree,Disagree,Somewhat agree,3,5,1,2,4,1,Agree,Neither Agree nor Disagree,Agree,Agree,Agree,3,4,5,1,2,2,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,91,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,93,FALSE,50,TRUE,100,TRUE,97,FALSE,50,TRUE,75,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,100,TRUE,100,25,0,3,1,1,2,3,-1,1,-2,2,2,-1,2,1,3,2,2,2,2,2,-1,3,2,-1,-1,2,3,1,2,1,3,4,2,1,2,3,2,2,1,0,1,1,2,5,1,3,3,2,1,1,2,-1,2,-2,1,1,2,0,2,2,2,1,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,50,TRUE,0,97,TRUE,1,100,FALSE,1,50,TRUE,1,93,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.0625,0.25,0,0,0,0,0.25,0,0,0.25,0.5625,0.8281,0.25,0,0.0049,0.25,0.25,0.25,1,0,1,1,1,1,0.9409,0.326746429,0.098214286,0.555278571,25,78.13,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,86.91,83.5,87.5,84.38,92.25,98,75.81,6.25,15.03,8.5,12.5,9.38,29.75,-2,32.06,1,0,1,2,3,0,2,1,3,1,0,2,0,2,1,1,2,1,1,0,1,0,2,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,0,1.4,1.4,1,1,1,0.6,0.6,0,1.2,0.55,0.875,2.67,1,2.25,0.4,0.8,0.4,1,0.533333333,1,3,1,3,1.67,2,1,2,0,0,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,64,Nothing to add,1.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,3,6,9,7,5,2,8,1,4,3,2,4,1 +62,R_51AeU8rD9pFk6YR,67 - 73,,Canadian,Canadian,Male,Disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,2,4,3,1,5,Disagree,Somewhat disagree,Agree,Disagree,Somewhat disagree,5,3,4,1,2,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,4,3,1,2,5,Disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Strongly disagree,3,4,1,5,2,Strongly disagree,Disagree,Strongly Agree,Neither agree nor disagree,Somewhat agree,3,1,4,5,2,6,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Disagree,5,3,1,2,4,4,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,1,3,4,2,5,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,1,4,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,5,4,2,3,1,7,Disagree,Disagree,Somewhat agree,Strongly disagree,Disagree,2,4,3,1,5,5,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Disagree,2,4,3,5,1,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly disagree,2,1,3,4,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,92,TRUE,75,FALSE,76,FALSE,60,FALSE,55,FALSE,93,TRUE,100,TRUE,100,TRUE,71,TRUE,97,FALSE,60,TRUE,83,TRUE,88,FALSE,94,TRUE,55,TRUE,100,FALSE,71,FALSE,88,FALSE,61,FALSE,100,FALSE,59,FALSE,57,FALSE,100,TRUE,100,FALSE,64,TRUE,95,FALSE,52,FALSE,100,TRUE,100,TRUE,100,TRUE,87,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,0,2,-2,1,-2,-1,2,-2,-1,2,3,3,1,0,-2,0,-1,-2,-3,-3,-2,3,0,1,6,-2,0,2,1,-2,4,1,3,3,1,0,3,-3,-3,-3,-3,-3,10,-3,1,2,1,-1,7,-2,-2,1,-3,-2,5,2,3,3,0,-1,6,1,0,1,1,-3,7,FALSE,1,92,TRUE,1,75,FALSE,1,76,FALSE,1,60,FALSE,0,55,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,97,FALSE,1,60,TRUE,0,83,TRUE,1,88,FALSE,1,94,TRUE,1,55,TRUE,1,100,FALSE,1,71,FALSE,1,88,FALSE,1,61,FALSE,1,100,FALSE,0,59,FALSE,0,57,FALSE,1,100,TRUE,1,100,FALSE,1,64,TRUE,1,95,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,87,TRUE,1,100,0,0.0025,0,0,0,0.0049,0,0.0009,0,0.3249,0,0.0144,0.0841,0.16,0.3025,0.0625,0,0.16,0,0.1296,0.3481,0.2025,0.1521,0.0036,0.0841,0.2304,0.0169,0.0064,0.0576,0.0144,1,0.6889,0.1446,0.079585714,0.209614286,23,71.88,27,84.38,8,100,5,62.5,7,87.5,7,87.5,13,81.25,14,87.5,82.28,65.12,83.25,85.88,94.88,83.69,80.88,-12.5,-2.1,-34.88,20.75,-1.62,7.38,2.44,-6.62,1,2,1,2,0,0,1,0,3,1,1,0,0,0,0,1,3,2,1,0,1,1,0,3,2,0,1,1,1,1,0,0,0,1,1,3,0,2,3,0,1.2,1,0.2,1.4,1.4,0.8,0.4,1.6,0.95,1.05,1,4.33,6,6,-0.2,0.2,-0.2,-0.2,-0.066666667,-1,-1,-3,3,-1.67,-1,1,-1,-1,1,-1,1,2,-2,1,-1,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,68,"QUITE AN INTERESTING SURVEY, WOULD LIKE TO SEE THE RESULTS",-0.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,4,7,5,6,8,3,2,1,9,2,3,4,1 +63,R_5Yuhp62PhCluVLy,67 - 73,,Canadian,Canadian,Female,Agree,Somewhat agree,Strongly agree,Disagree,Strongly agree,3,2,5,1,4,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,4,2,1,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,4,1,3,2,Agree,Agree,Agree,Strongly Agree,Agree,1,2,3,4,5,Agree,Somewhat agree,Strongly Agree,Strongly disagree,Strongly Agree,4,3,1,2,5,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,1,4,5,3,1,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,4,1,2,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,3,2,1,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Strongly disagree,Strongly Agree,1,4,3,2,5,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,4,3,5,2,1,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,2,4,1,5,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,3,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,54,TRUE,100,TRUE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,51,TRUE,100,FALSE,62,FALSE,100,TRUE,75,FALSE,100,TRUE,77,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,80,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,3,-2,3,-1,-3,3,-3,0,3,0,3,-1,3,2,2,2,3,2,2,1,3,-3,3,1,-3,-3,3,-3,1,1,3,1,3,1,3,1,3,3,3,3,2,1,3,1,3,-3,3,1,-3,-3,3,-3,1,1,3,1,3,-2,3,1,3,3,3,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,62,FALSE,1,100,TRUE,0,75,FALSE,1,100,TRUE,1,77,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,80,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,1,0,0,0,0.5625,0,0,0,0,0,0,0,0.25,0,0,0,0.2916,0,0,0.0529,0.2401,0.5625,0,0.1444,0.64,0,1,1,0,0,0,0.169428571,0.078864286,0.259992857,29,90.63,25,78.13,5,62.5,7,87.5,6,75,7,87.5,15,93.75,10,62.5,91.38,76.25,89.25,100,100,95.5,87.25,12.5,13.25,13.75,1.75,25,12.5,1.75,24.75,0,0,0,1,0,2,0,0,0,1,0,1,0,2,0,1,1,1,0,0,1,0,0,1,0,2,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0.2,0.6,0.6,0.6,0.4,0.6,0.4,0.8,0.5,0.55,0.525,1,1,1,-0.2,0,0.2,-0.2,0,0,0,0,0,0,2,2,1,-2,2,0,0,0,0,-2,2,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),70,It was interesting.,1,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,2,9,5,4,8,7,3,1,6,4,3,2,1 +64,R_1dMoiYjw25x8NIn,39 - 45,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,5,2,3,1,4,Strongly disagree,Agree,Strongly agree,Strongly agree,Agree,1,4,2,5,3,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,5,4,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,2,3,1,5,4,7,Somewhat disagree,Agree,Agree,Agree,Somewhat agree,1,4,2,5,3,7,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,2,5,4,3,1,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,Agree,4,3,2,1,5,6,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,2,4,5,3,1,7,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,7,Agree,Agree,Agree,Agree,Agree,3,1,5,2,4,FALSE,100,FALSE,55,FALSE,100,TRUE,51,FALSE,51,FALSE,52,FALSE,52,TRUE,73,TRUE,68,TRUE,100,TRUE,54,TRUE,100,FALSE,54,FALSE,56,FALSE,52,FALSE,53,TRUE,53,TRUE,100,TRUE,53,TRUE,54,FALSE,100,TRUE,53,FALSE,53,FALSE,54,FALSE,100,TRUE,72,FALSE,100,FALSE,100,TRUE,54,TRUE,100,FALSE,69,TRUE,100,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,-3,3,0,-3,2,3,3,2,3,1,3,3,3,1,1,-2,1,0,1,2,-3,1,0,6,-1,2,2,2,1,7,2,0,2,1,1,7,0,1,1,2,1,6,3,3,-1,3,2,7,-1,1,3,1,3,6,3,2,3,3,3,7,2,2,2,2,2,7,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,0,51,FALSE,0,51,FALSE,1,52,FALSE,0,52,TRUE,1,73,TRUE,1,68,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,0,54,FALSE,1,56,FALSE,0,52,FALSE,0,53,TRUE,0,53,TRUE,0,100,TRUE,0,53,TRUE,0,54,FALSE,0,100,TRUE,1,53,FALSE,1,53,FALSE,0,54,FALSE,1,100,TRUE,1,72,FALSE,1,100,FALSE,1,100,TRUE,0,54,TRUE,1,100,FALSE,0,69,TRUE,1,100,0.0729,0.0784,0.2809,0.2704,0,0.2304,0.2916,0,0.2916,0.2209,0,0.2916,0.1024,0.2916,0.2601,0.3025,0.2209,0.2601,0,0,1,0.2704,0.2809,0.1936,0.2809,0,0.4761,0,0,1,0.2916,1,0.2699,0.197407143,0.342392857,14,43.75,15,46.88,2,25,3,37.5,6,75,4,50,7,43.75,8,50,71.44,62.75,64.62,79.12,79.25,69.12,73.75,-3.13,24.56,37.75,27.12,4.12,29.25,25.37,23.75,4,1,0,2,0,2,0,1,1,1,1,1,1,2,2,1,0,3,1,1,6,0,2,0,2,2,1,0,2,1,0,1,0,0,0,1,1,4,1,2,1.4,1,1.4,1.2,2,1.2,0.2,1.8,1.25,1.3,1.275,6.67,6.67,6.625,-0.6,-0.2,1.2,-0.6,0.133333333,-1,1,0,-1,0,-2,2,1,-2,2,2,-2,-2,2,-2,2,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,42,,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,4,8,5,9,2,7,3,1,6,4,3,2,1 +65,R_737tNmqawo6NYoU,25 - 31,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Strongly disagree,Strongly agree,4,2,5,1,3,Strongly disagree,Agree,Agree,Somewhat agree,Somewhat agree,1,5,4,2,3,Somewhat Disagree,Disagree,Strongly Agree,Strongly Disagree,Agree,2,3,5,1,4,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,4,1,5,Disagree,Agree,Agree,Disagree,Somewhat disagree,2,1,3,5,4,8,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,5,3,2,1,4,8,Strongly Disagree,Strongly Disagree,Somewhat Agree,Strongly Disagree,Agree,1,3,4,2,5,6,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,4,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly Agree,3,4,5,1,2,3,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,1,2,5,4,3,8,Somewhat Disagree,Disagree,Strongly Agree,Strongly Disagree,Agree,3,5,1,2,4,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,2,3,5,4,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,55,TRUE,75,TRUE,80,TRUE,55,TRUE,55,FALSE,55,TRUE,60,TRUE,70,TRUE,60,TRUE,80,FALSE,55,TRUE,65,FALSE,55,FALSE,55,TRUE,80,TRUE,70,FALSE,55,TRUE,55,FALSE,55,TRUE,90,TRUE,65,TRUE,55,TRUE,70,TRUE,85,TRUE,70,TRUE,55,FALSE,100,TRUE,75,TRUE,55,FALSE,91,FALSE,50,FALSE,90,16,2,3,2,-3,3,-3,2,2,1,1,-1,-2,3,-3,2,-3,-2,-3,-3,-3,-2,2,2,-2,-1,8,-3,3,-3,3,-3,8,-3,-3,1,-3,2,6,-3,-2,-3,-3,-3,1,2,3,1,-3,3,3,1,-2,3,-2,2,8,-1,-2,3,-3,2,2,-1,-1,-1,-1,-3,6,FALSE,1,90,FALSE,0,50,FALSE,1,91,TRUE,0,55,TRUE,1,75,FALSE,1,100,TRUE,1,55,TRUE,1,70,TRUE,1,85,TRUE,1,70,TRUE,0,55,TRUE,0,65,TRUE,1,90,FALSE,1,55,TRUE,1,55,FALSE,0,55,TRUE,0,70,TRUE,0,80,FALSE,1,55,FALSE,1,55,TRUE,1,65,FALSE,0,55,TRUE,0,80,TRUE,1,60,TRUE,0,70,TRUE,1,60,FALSE,1,55,TRUE,0,55,TRUE,0,55,TRUE,1,80,TRUE,1,75,FALSE,0,55,0.09,0.16,0.3025,0.2025,0.3025,0,0.16,0.09,0.2025,0.3025,0.04,0.01,0.0225,0.3025,0.0625,0.25,0.64,0.3025,0.3025,0.49,0.1225,0.2025,0.2025,0.2025,0.49,0.2025,0.0625,0.01,0.0081,0.64,0.3025,0.4225,0.226717857,0.191964286,0.261471429,16,50,19,59.38,5,62.5,4,50,5,62.5,5,62.5,12,75,7,43.75,66.91,60.62,73.75,66.88,66.38,65.94,67.88,-9.38,7.53,-1.88,23.75,4.38,3.88,-9.06,24.13,4,1,0,1,4,0,1,5,2,4,2,1,2,0,0,0,0,0,0,0,0,0,1,0,0,4,4,1,3,1,0,0,0,0,0,2,1,2,2,0,2,2.4,1,0,0.2,2.6,0,1.4,1.35,1.05,1.2,7.33,4.33,5.25,1.8,-0.2,1,-1.4,0.866666667,5,0,4,-5,3,2,2,2,-2,2,1,-1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),26,I have no feedback to provide.,1.625,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,5,3,4,7,8,2,9,1,6,2,3,4,1 +66,R_31aufd3cGtnHFI0,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly disagree,Strongly disagree,4,2,5,1,3,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat disagree,1,2,4,5,3,Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,5,1,3,4,Strongly disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Neither agree nor disagree,Strongly disagree,Strongly disagree,2,3,1,5,4,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,2,1,3,4,5,0,Agree,Agree,Agree,Somewhat Disagree,Somewhat Agree,3,2,4,5,1,0,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly disagree,1,2,3,4,5,0,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,2,5,4,3,1,0,Agree,Strongly agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,4,1,3,2,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,5,4,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,60,TRUE,87,FALSE,56,TRUE,70,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,74,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,55,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,56,FALSE,53,TRUE,50,TRUE,50,TRUE,50,FALSE,100,FALSE,50,FALSE,50,9,3,3,1,-3,-3,-1,0,2,-1,-1,2,3,1,-1,1,-3,-3,-3,0,-3,2,2,0,-3,-3,9,1,1,0,-1,1,5,2,2,2,-1,1,0,-3,0,-3,-3,-3,0,3,3,1,-3,-3,0,1,-1,2,0,-1,0,2,3,1,-1,1,0,-3,-3,-3,-3,-3,0,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,0,53,TRUE,1,56,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,55,TRUE,0,100,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,0,50,FALSE,1,74,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,70,FALSE,1,56,TRUE,1,87,FALSE,0,60,TRUE,1,50,0.1936,0,0.25,0.2809,0.25,0.25,0.25,0,0.25,0.25,0.0169,0.25,0.25,0.25,0.25,0.25,0.0676,0.25,0.49,1,0.25,0.25,0.25,0.25,0.2025,0.25,0.36,0.25,0,1,0.1936,1,0.30645,0.202464286,0.410435714,9,28.13,16,50,4,50,6,75,3,37.5,3,37.5,8,50,8,50,62.84,51.25,54.38,75.38,70.38,59.75,65.94,-21.87,12.84,1.25,-20.62,37.88,32.88,9.75,15.94,1,1,1,0,0,2,1,2,0,2,0,1,1,0,0,0,3,0,3,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,3,0,0.6,1.4,0.4,1.2,0,0.8,0,0.6,0.9,0.35,0.625,4.67,0,1.75,0.6,0.6,0.4,0.6,0.533333333,9,5,0,0,4.67,-2,0,0,-2,2,0,0,0,0,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),53,totally a waste of time and boring too many redundant questions and repeats,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,5,9,7,3,2,4,6,1,8,2,4,3,1 +67,R_78rnoTc0MRM3n7X,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,1,5,3,4,2,Disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,2,1,5,4,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,1,4,2,5,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Agree,Agree,Somewhat agree,3,1,4,2,5,3,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,5,2,1,4,3,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,2,3,1,5,5,Disagree,Strongly disagree,Disagree,Disagree,Disagree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,5,3,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,4,5,2,3,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,1,2,4,5,3,3,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,2,4,5,3,1,TRUE,95,TRUE,80,TRUE,69,TRUE,63,TRUE,90,FALSE,52,TRUE,100,TRUE,100,TRUE,50,TRUE,95,TRUE,50,FALSE,77,TRUE,74,TRUE,98,TRUE,50,TRUE,100,TRUE,58,TRUE,89,TRUE,50,FALSE,50,TRUE,50,TRUE,95,FALSE,100,TRUE,96,FALSE,76,TRUE,50,TRUE,64,FALSE,50,FALSE,58,TRUE,50,FALSE,50,TRUE,96,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,0,-2,1,1,2,0,1,0,1,1,2,1,0,1,3,-2,2,3,2,2,1,1,1,0,0,3,0,3,0,1,0,1,1,3,-2,-3,-2,-2,-2,5,2,2,1,0,1,1,0,0,1,-1,1,6,1,0,1,1,2,1,1,1,2,2,0,3,TRUE,0,95,TRUE,1,80,TRUE,0,69,TRUE,0,63,TRUE,1,90,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,77,TRUE,1,74,TRUE,0,98,TRUE,1,50,TRUE,1,100,TRUE,0,58,TRUE,0,89,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,96,FALSE,1,76,TRUE,1,50,TRUE,0,64,FALSE,1,50,FALSE,1,58,TRUE,1,50,FALSE,0,50,TRUE,1,96,0,0.25,0,0,0.0016,0.2304,0.0016,0.0025,0.25,0.0025,0.25,0.0676,0.25,0.25,0.01,0.04,0,0.3969,0.25,0.0576,0.25,0.25,0.25,0.9604,0.3364,0.4096,0.25,0.9025,0.4761,0.7921,0.1764,0.0529,0.255967857,0.125221429,0.386714286,24,75,22,68.75,3,37.5,7,87.5,5,62.5,7,87.5,15,93.75,7,43.75,72.66,57.12,72.25,87.25,74,76.62,68.69,6.25,3.91,19.62,-15.25,24.75,-13.5,-17.13,24.94,1,0,1,0,1,3,1,1,1,0,1,1,1,0,1,3,3,3,5,0,1,1,2,2,1,2,1,0,3,1,0,0,0,0,0,0,1,1,1,2,0.6,1.2,0.8,2.8,1.4,1.4,0,1,1.35,0.95,1.15,2.33,2.67,2.875,-0.8,-0.2,0.8,1.8,-0.066666667,0,-3,2,2,-0.34,1,2,1,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,15 days,Female,University - Undergraduate,54,all good,1.375,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,7,4,6,3,9,5,2,1,8,4,3,2,1 +68,R_1VmdyPIjBNvrern,60 - 66,American,,American,Female,Agree,Strongly agree,Agree,Strongly agree,Agree,1,5,2,3,4,Somewhat agree,Disagree,Somewhat agree,Strongly disagree,Somewhat agree,5,4,2,1,3,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,3,5,4,2,1,Agree,Agree,Agree,Agree,Somewhat agree,1,2,4,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,4,2,1,3,8,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,5,1,8,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,4,1,2,3,5,8,Strongly Agree,Agree,Agree,Agree,Somewhat agree,2,5,1,3,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,2,4,1,8,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,3,4,2,5,1,7,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,2,5,4,3,8,Agree,Agree,Agree,Strongly Agree,Somewhat agree,1,2,5,3,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,71,FALSE,96,TRUE,76,TRUE,86,FALSE,78,TRUE,87,TRUE,97,TRUE,84,TRUE,92,FALSE,74,TRUE,94,TRUE,76,FALSE,65,FALSE,74,FALSE,90,FALSE,69,FALSE,88,FALSE,72,FALSE,70,FALSE,79,FALSE,75,FALSE,73,TRUE,73,FALSE,91,TRUE,91,FALSE,74,FALSE,78,TRUE,82,TRUE,89,FALSE,71,TRUE,80,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,2,1,-2,1,-3,1,1,3,2,3,1,2,2,2,2,1,1,1,1,1,2,8,1,-2,1,0,0,8,0,1,0,1,0,8,3,2,2,2,1,8,2,2,1,1,1,8,1,-1,-1,-1,1,7,0,1,0,1,0,8,2,2,2,3,1,7,TRUE,0,100,FALSE,0,71,FALSE,1,96,TRUE,0,76,TRUE,1,86,FALSE,1,78,TRUE,1,87,TRUE,1,97,TRUE,1,84,TRUE,1,92,FALSE,1,74,TRUE,0,94,TRUE,1,76,FALSE,1,65,FALSE,0,74,FALSE,0,90,FALSE,1,69,FALSE,1,88,FALSE,1,72,FALSE,1,70,FALSE,0,79,FALSE,0,75,FALSE,1,73,TRUE,1,73,FALSE,1,91,TRUE,1,91,FALSE,1,74,FALSE,1,78,TRUE,0,82,TRUE,1,89,FALSE,0,71,TRUE,1,80,0.0009,0.0081,0.81,0.0169,0.04,0.0484,0.0729,0.0064,0.09,0.5625,0.0121,0.0576,0.0256,0.0676,0.0196,0.5041,0.0729,0.5776,0.0484,0.0081,0.6241,0.5476,0.0784,0.1225,0.0961,0.0676,0.5041,1,0.0016,0.0144,0.6724,0.8836,0.243792857,0.154092857,0.333492857,26,81.25,22,68.75,4,50,6,75,6,75,6,75,10,62.5,12,75,81.09,74.5,77.88,86.12,85.88,82.19,80,12.5,12.34,24.5,2.88,11.12,10.88,19.69,5,1,2,1,2,0,0,0,0,3,1,1,2,2,2,1,1,0,0,0,0,0,1,1,2,1,0,1,2,2,0,1,2,2,2,1,0,0,0,1,0,1.2,0.8,1.6,0.2,1,1,1.6,0.2,0.95,0.95,0.95,8,7.67,7.75,0.2,-0.2,0,0,0,0,1,0,1,0.33,2,0,0,-1,1,1,-1,0,0,0,0,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),61,it was a fun interesting survey,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,4,8,5,9,3,2,6,1,7,4,3,2,1 +69,R_1xqCkBaPxJEbxrX,67 - 73,American,,American,Female,Agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,Disagree,Strongly disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,1,3,5,2,Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,3,1,2,4,5,Neither agree nor disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,2,1,3,4,Agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,3,2,0,Disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,1,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,2,3,1,4,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,5,2,3,1,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,4,2,3,1,1,Strongly disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat disagree,3,5,4,1,2,2,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,4,2,1,0,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,5,3,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,89,TRUE,91,FALSE,50,TRUE,81,FALSE,50,TRUE,90,TRUE,91,TRUE,80,FALSE,100,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,90,FALSE,100,TRUE,96,TRUE,50,FALSE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,50,16,2,2,1,0,0,-2,-3,2,-1,0,2,-3,3,-2,3,0,1,2,2,0,2,2,1,0,0,0,-2,-3,3,0,0,1,2,-3,3,-3,3,0,0,0,2,2,0,0,2,2,1,1,0,1,-3,-3,3,-1,-1,2,2,-3,3,-3,3,0,0,-1,1,1,0,2,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,96,FALSE,1,100,TRUE,0,90,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,80,TRUE,0,91,TRUE,1,90,FALSE,1,50,TRUE,0,81,FALSE,1,50,TRUE,1,91,TRUE,1,89,TRUE,1,100,0,0.01,0.0016,0.25,0,0,0.04,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0.25,0,0,0.25,0.6561,0.8281,0.25,0.25,0.25,0.25,0,0.25,0.0121,0.25,0,0.81,0.25,1,0.253728571,0.146292857,0.361164286,16,50,25,78.13,7,87.5,7,87.5,5,62.5,6,75,14,87.5,11,68.75,72.12,61.12,75,65.12,87.25,71.62,72.62,-28.13,-6.01,-26.38,-12.5,2.62,12.25,-15.88,3.87,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,2,1,1,0,0,0.4,0.2,0.2,0.2,0.6,0.2,0.8,0.2,0.45,0.325,0.33,1,0.75,-0.2,-0.2,0,-0.6,-0.133333333,-1,-1,0,-2,-0.67,1,2,1,-2,2,-1,1,-2,2,-2,2,0,10 cents,5 minutes,24 days,Female,Trade School (non-military),72,tough,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,5,9,6,3,4,8,7,1,2,2,3,4,1 +70,R_3Pd9d7qCcQ4RYat,67 - 73,,Canadian,Canadian,Female,Somewhat agree,Agree,Strongly agree,Disagree,Disagree,3,1,4,2,5,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Strongly disagree,1,5,2,3,4,Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,1,4,5,3,Agree,Agree,Agree,Strongly Agree,Agree,2,1,4,3,5,Agree,Agree,Strongly Agree,Strongly disagree,Disagree,3,1,5,2,4,0,Agree,Strongly disagree,Strongly agree,Disagree,Strongly disagree,3,1,4,5,2,0,Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,1,5,3,2,4,0,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,2,3,5,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Strongly disagree,1,2,4,3,5,0,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Strongly disagree,2,3,5,1,4,0,Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,2,4,3,0,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,4,3,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,99,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,75,TRUE,95,FALSE,50,FALSE,93,TRUE,68,FALSE,59,FALSE,100,FALSE,56,FALSE,100,FALSE,50,TRUE,70,FALSE,50,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,86,FALSE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,50,24,1,2,3,-2,-2,1,-3,3,-2,-3,2,1,3,-3,3,2,2,2,3,2,2,2,3,-3,-2,0,2,-3,3,-2,-3,0,2,2,3,-3,3,0,3,3,2,3,3,0,1,2,3,1,-3,0,1,-3,3,-2,-3,0,2,3,3,-3,3,0,3,2,3,3,3,0,TRUE,0,50,FALSE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,100,FALSE,1,56,FALSE,1,100,FALSE,0,59,TRUE,1,68,FALSE,1,93,FALSE,0,50,TRUE,0,95,TRUE,1,75,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,0,0.0625,0.09,0.0196,0,0,0.25,0,0,0.1024,0,1,0.25,0,0.25,1,0.0049,0.25,0,0.9025,0.3481,0.25,0.1936,0,0.25,0.25,0.0001,0.25,1,0,1,1,0.305414286,0.22195,0.388878571,24,75,19,59.38,4,50,4,50,6,75,5,62.5,9,56.25,10,62.5,81.28,69.38,81.5,84.25,90,78.56,84,15.62,21.9,19.38,31.5,9.25,27.5,22.31,21.5,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,3,1,0,0,0,0,0,0,2,0,0,0,1,0,1,0,1,0.4,0.2,0.2,0.6,0.8,0,0.4,0.6,0.35,0.45,0.4,0,0,0,-0.4,0.2,-0.2,0,-0.133333333,0,0,0,0,0,-1,2,1,-2,2,2,-2,0,0,-2,2,1,10 cents,5 minutes,47 days,Female,High School (or equivalent),68,It was an entertaining survey. Do I get to know if how many of my answers were correct?,0.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,6,5,2,8,4,3,7,1,9,3,4,2,1 +71,R_1OJKQA1K4pCkc37,67 - 73,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,5,3,4,1,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat disagree,2,5,3,4,1,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,2,1,4,Agree,Somewhat agree,Strongly Agree,Agree,Agree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Agree,5,3,4,2,1,6,Somewhat agree,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,5,4,2,1,3,6,Strongly Agree,Strongly Agree,Agree,Agree,Somewhat Disagree,2,4,5,3,1,8,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat disagree,1,4,5,2,3,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,3,2,5,4,2,Strongly agree,Strongly agree,Agree,Somewhat Disagree,Somewhat Agree,2,5,3,1,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,3,5,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,55,TRUE,100,FALSE,85,TRUE,98,TRUE,59,TRUE,100,FALSE,66,TRUE,70,FALSE,67,FALSE,63,FALSE,100,FALSE,74,FALSE,67,TRUE,100,FALSE,93,FALSE,100,FALSE,62,TRUE,89,TRUE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,74,TRUE,100,TRUE,94,TRUE,77,FALSE,81,FALSE,64,TRUE,100,FALSE,80,FALSE,100,27,2,3,3,-3,1,1,0,1,-2,-1,3,3,2,0,0,2,1,3,2,2,3,3,3,-3,2,8,1,-3,-1,-3,-3,6,3,3,2,2,-1,6,2,2,2,0,1,8,1,3,3,-3,-1,0,3,-3,3,-3,0,3,3,3,2,-1,1,2,3,3,3,3,2,1,FALSE,1,100,FALSE,0,80,TRUE,0,100,FALSE,1,64,FALSE,0,81,TRUE,0,77,TRUE,1,94,TRUE,1,100,TRUE,1,74,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,TRUE,0,89,FALSE,0,62,FALSE,0,100,FALSE,1,93,TRUE,0,100,FALSE,1,67,FALSE,1,74,FALSE,0,100,FALSE,0,63,FALSE,1,67,TRUE,1,70,FALSE,1,66,TRUE,1,100,TRUE,0,59,TRUE,0,98,FALSE,1,85,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,1,0.0036,0,0.5929,0.09,0,0.0676,0.3969,0,0,0.0676,0.64,0.6561,0.64,0.1089,0.1296,0.9604,0.1156,1,0.3844,0.1089,0.7921,0.0049,0.3481,0.3025,0,1,1,0.0225,1,0.372464286,0.242114286,0.502814286,27,84.38,17,53.13,3,37.5,5,62.5,5,62.5,4,50,9,56.25,8,50,84.31,67.62,87.88,89,92.75,86.19,82.44,31.25,31.18,30.12,25.38,26.5,42.75,29.94,32.44,1,0,0,0,1,0,3,2,1,2,0,0,0,2,1,0,1,1,2,1,1,0,0,0,2,2,3,2,1,1,0,0,0,1,1,1,2,0,1,0,0.4,1.6,0.6,1,0.6,1.8,0.4,0.8,0.9,0.9,0.9,6.67,1.67,4.25,-0.2,-0.2,0.2,0.2,-0.066666667,8,3,4,7,5,0,2,1,-1,1,2,-2,-1,1,-2,2,2,10 cents,75 minutes,36 days,Female,High School (or equivalent),67,awesome survey,0.875,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,7,4,3,5,2,8,9,1,6,2,4,3,1 +72,R_6YJKAzC8xCjFbpC,67 - 73,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Agree,5,4,1,2,3,Somewhat disagree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,3,5,4,1,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,3,5,4,1,2,3,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,3,2,1,4,5,2,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,1,3,4,5,2,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,5,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,4,5,3,1,2,1,Neither agree nor disagree,Somewhat disagree,Strongly agree,Strongly disagree,Somewhat disagree,3,4,2,1,5,2,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,5,1,4,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,1,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,76,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,82,TRUE,88,FALSE,100,TRUE,75,FALSE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,100,TRUE,100,TRUE,91,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,68,FALSE,69,FALSE,100,FALSE,80,FALSE,100,30,3,3,-1,-1,2,-1,-2,3,-3,0,3,1,3,0,3,3,3,3,3,3,3,3,3,-2,3,3,0,-2,3,-3,1,2,3,1,3,-2,3,2,3,3,3,3,3,0,3,3,0,1,3,1,0,-1,3,-3,-1,2,3,2,3,-2,3,1,3,3,3,3,3,0,FALSE,1,100,FALSE,0,80,FALSE,1,100,FALSE,1,69,TRUE,1,68,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,75,FALSE,1,100,TRUE,1,88,TRUE,1,82,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0.0324,0,0,0,0.8281,0.1024,0.64,0,0.0961,0,0,0.0144,0.0625,0.5625,0,0,0.5776,0,0,0,0,1,1,0.211285714,0.192785714,0.229785714,30,93.75,25,78.13,4,50,6,75,8,100,7,87.5,15,93.75,10,62.5,93.88,83.25,94.5,97.75,100,93.31,94.44,15.62,15.75,33.25,19.5,-2.25,12.5,-0.44,31.94,0,0,4,1,1,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,1,2,1,1,1,0,0,1,0,1,0,2,0,0,0,0,0,0,1.2,0.4,0.4,0,0.8,0.6,0.6,0,0.5,0.5,0.5,2.33,1.33,1.375,0.4,-0.2,-0.2,0,0,2,0,1,0,1,2,2,2,-2,2,2,-2,0,0,-2,2,2,10 cents,5 minutes,47 days,Male,High School (or equivalent),68,I enjoyed this,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,4,5,6,9,8,7,2,1,3,3,2,4,1 +73,R_6Lo0CIpx8AJk2Yx,53 - 59,,Canadian,Canadian,Male,Somewhat disagree,Agree,Agree,Agree,Agree,3,5,4,2,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,4,5,2,1,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,4,5,3,1,2,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Agree,Agree,Agree,Agree,5,2,3,4,1,8,Agree,Somewhat disagree,Agree,Agree,Agree,2,5,3,1,4,8,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,2,1,5,4,3,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Agree,Agree,Somewhat agree,Agree,2,1,3,4,5,7,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,1,4,3,2,5,7,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,1,4,5,2,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,TRUE,86,TRUE,91,TRUE,87,TRUE,89,FALSE,83,TRUE,90,TRUE,87,TRUE,81,FALSE,87,FALSE,80,FALSE,87,FALSE,82,TRUE,73,TRUE,92,TRUE,74,TRUE,78,TRUE,76,TRUE,73,TRUE,88,TRUE,91,FALSE,77,TRUE,95,TRUE,74,TRUE,73,TRUE,82,FALSE,92,TRUE,73,TRUE,69,FALSE,65,TRUE,80,TRUE,92,28,-1,2,2,2,2,1,1,2,2,2,1,1,2,2,2,-1,1,-1,1,-1,-1,2,2,2,2,8,2,-1,2,2,2,8,1,2,2,1,2,8,1,2,1,1,-1,7,-1,2,2,1,2,8,1,1,2,2,1,7,1,1,2,1,2,7,1,-1,1,1,-1,7,TRUE,0,92,TRUE,1,80,FALSE,1,65,TRUE,0,69,TRUE,1,73,FALSE,1,92,TRUE,1,82,TRUE,1,73,TRUE,1,74,TRUE,1,95,FALSE,1,77,TRUE,0,91,TRUE,1,88,TRUE,0,73,TRUE,1,76,TRUE,1,78,TRUE,0,74,TRUE,0,92,TRUE,0,73,FALSE,1,82,FALSE,0,87,FALSE,0,80,FALSE,1,87,TRUE,1,81,TRUE,0,87,TRUE,1,90,FALSE,1,83,TRUE,0,89,TRUE,0,87,TRUE,1,91,TRUE,1,86,TRUE,1,97,0.0729,0.01,0.0484,0.0324,0.0009,0.0064,0.0361,0.0025,0.0324,0.64,0.0081,0.0144,0.0676,0.0529,0.0729,0.04,0.0169,0.4761,0.7921,0.7569,0.7569,0.0576,0.5329,0.5329,0.5476,0.0289,0.0196,0.8464,0.1225,0.8464,0.7569,0.8281,0.317603571,0.1048,0.530407143,28,87.5,20,62.5,6,75,5,62.5,3,37.5,6,75,14,87.5,6,37.5,82.62,77.25,85.62,86.38,81.25,83.19,82.06,25,20.12,2.25,23.12,48.88,6.25,-4.31,44.56,0,0,0,0,0,1,2,0,0,0,0,1,0,1,0,2,1,2,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,2,2,0,0,0,0.6,0.4,1,0.2,0.2,0.2,1.2,0.5,0.45,0.475,8,7.33,7.5,-0.2,0.4,0.2,-0.2,0.133333333,0,1,1,0,0.67,2,-1,0,-1,1,1,-1,1,-1,1,-1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,"I think the survey is very well done, and think it is professional already. I wouldn't change a thing.",-0.25,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,5,4,9,6,3,8,1,7,4,3,2,1 +74,R_6UarpWzGi9zvY9X,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Agree,Strongly agree,4,5,3,1,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,5,4,1,3,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,1,4,5,2,3,Agree,Agree,Strongly Agree,Neither agree nor disagree,Agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,4,3,1,2,5,3,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,4,1,3,5,7,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,5,3,1,4,9,Agree,Agree,Agree,Somewhat agree,Somewhat disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Agree,5,2,3,1,4,3,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Somewhat disagree,2,1,3,4,5,5,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Neither Agree nor Disagree,2,3,1,4,5,7,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,5,3,4,2,1,FALSE,100,FALSE,95,FALSE,100,TRUE,60,TRUE,90,FALSE,100,TRUE,98,TRUE,96,TRUE,92,TRUE,85,FALSE,70,FALSE,70,TRUE,87,FALSE,100,FALSE,60,TRUE,95,FALSE,90,TRUE,100,TRUE,75,FALSE,100,FALSE,100,TRUE,85,FALSE,100,TRUE,90,FALSE,90,TRUE,100,FALSE,90,FALSE,100,FALSE,100,TRUE,90,TRUE,64,TRUE,80,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,3,-1,-1,-1,-2,1,1,0,2,-1,1,2,2,3,0,2,3,3,3,0,1,7,-2,1,1,0,-1,3,0,-1,2,1,0,7,2,2,2,1,-1,9,1,3,0,3,2,5,-2,0,0,-2,-1,3,-1,0,1,-2,0,5,1,1,2,1,2,7,FALSE,1,100,FALSE,0,95,FALSE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,98,TRUE,1,96,TRUE,1,92,TRUE,1,85,FALSE,1,70,FALSE,1,70,TRUE,1,87,FALSE,1,100,FALSE,0,60,TRUE,1,95,FALSE,1,90,TRUE,0,100,TRUE,0,75,FALSE,1,100,FALSE,0,100,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,90,TRUE,1,100,FALSE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,64,TRUE,1,80,0.0016,0,0.0025,0.0004,0.04,0,0.01,0.0225,0,0.0225,0.01,0.0169,0.0064,0.09,0.01,0.9025,0,0.36,0,0.01,1,0.36,0.5625,0,0.01,0.01,0.1296,0,0,1,0,0.09,0.166532143,0.106485714,0.226578571,27,84.38,26,81.25,4,50,7,87.5,7,87.5,8,100,13,81.25,13,81.25,89.12,75.75,93.38,94.75,92.62,87.94,90.31,3.13,7.87,25.75,5.88,7.25,-7.38,6.69,9.06,1,0,1,2,2,1,2,2,2,2,1,1,0,2,1,0,0,1,1,3,1,0,2,1,1,1,1,1,0,2,2,0,1,1,1,1,1,1,1,0,1.2,1.8,1,1,1,1,1,0.8,1.25,0.95,1.1,5.67,4.33,5.75,0.2,0.8,0,0.2,0.333333333,2,0,2,2,1.34,2,1,1,-2,2,1,-1,0,0,-1,1,-1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,46,This was a nice change of pace. Very interesting,0.625,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,7,8,3,2,6,5,4,1,9,3,2,4,1 +75,R_3onatePMIchcixw,53 - 59,,Canadian,Canadian,Male,Disagree,Agree,Somewhat agree,Somewhat agree,Strongly agree,1,2,5,4,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,4,2,5,3,Agree,Disagree,Strongly Agree,Disagree,Agree,4,1,5,2,3,Agree,Agree,Agree,Strongly Agree,Agree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,4,1,2,5,3,1,Agree,Strongly disagree,Agree,Strongly disagree,Agree,4,5,1,3,2,1,Agree,Disagree,Strongly Agree,Disagree,Agree,1,4,5,3,2,1,Agree,Agree,Agree,Strongly Agree,Agree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,3,5,4,2,1,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,1,3,2,4,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,5,2,4,3,1,Agree,Agree,Agree,Strongly Agree,Strongly Agree,1,5,3,4,2,TRUE,100,TRUE,100,TRUE,91,FALSE,75,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,73,FALSE,73,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,70,TRUE,100,FALSE,100,FALSE,84,FALSE,73,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,88,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,1,1,3,3,-3,3,-3,2,2,-2,3,-2,2,2,2,2,3,2,-2,2,1,1,3,1,2,-3,2,-3,2,1,2,-2,3,-2,2,1,2,2,2,3,2,1,-2,2,1,1,3,1,2,-3,3,-3,2,1,2,-3,3,-3,3,1,2,2,2,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,91,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,73,FALSE,0,73,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,FALSE,1,84,FALSE,1,73,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,88,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0144,0.5329,0,0,0,0,0.5329,0,0,0,0,0.0625,0,0,1,0.09,0.0729,1,0,1,0,1,0.8281,0.0256,1,1,0.291403571,0.081621429,0.501185714,25,78.13,23,71.88,6,75,6,75,5,62.5,6,75,13,81.25,10,62.5,94.59,86.38,100,94.62,97.38,94,95.19,6.25,22.71,11.38,25,32.12,22.38,12.75,32.69,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0.4,0,0,0,0.2,0.6,0.2,0.1,0.25,0.175,1,1,1,0,0.2,-0.6,-0.2,-0.133333333,0,0,0,0,0,1,2,2,-2,2,-1,1,-2,2,2,-2,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,58,really silly questions of now real value to anyone,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,3,6,9,2,5,8,7,1,4,3,4,2,1 +76,R_7xSlTDefzznUrD7,67 - 73,,Canadian,Canadian,Female,Agree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,5,2,1,3,4,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,3,4,1,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,1,5,3,2,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,5,4,3,2,1,Agree,Somewhat agree,Strongly Agree,Strongly disagree,Strongly Agree,4,5,3,1,2,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,3,2,1,4,5,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,3,1,5,4,2,1,Agree,Agree,Agree,Agree,Somewhat agree,1,4,2,3,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,1,2,5,3,6,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,2,4,3,5,7,Strongly Agree,Agree,Somewhat Agree,Strongly Disagree,Agree,4,2,3,5,1,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,2,1,5,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,90,FALSE,53,FALSE,80,FALSE,50,TRUE,80,TRUE,84,TRUE,92,FALSE,52,FALSE,55,TRUE,50,FALSE,56,FALSE,54,TRUE,79,TRUE,84,TRUE,83,TRUE,57,TRUE,80,TRUE,87,TRUE,90,FALSE,54,TRUE,85,FALSE,50,TRUE,89,TRUE,85,FALSE,59,FALSE,59,FALSE,53,FALSE,75,TRUE,59,TRUE,80,19,2,1,2,-1,3,-2,-1,1,1,0,3,2,0,-3,1,0,0,2,2,-1,2,1,3,-3,3,2,-1,-1,1,-1,0,5,3,3,1,-3,1,1,2,2,2,2,1,7,1,1,2,1,1,6,2,0,0,1,-1,7,3,2,1,-3,2,2,-1,-1,0,1,-2,5,TRUE,0,80,TRUE,1,59,FALSE,1,75,FALSE,1,53,FALSE,0,59,FALSE,1,59,TRUE,1,85,TRUE,1,89,FALSE,0,50,TRUE,1,85,FALSE,1,54,TRUE,0,90,TRUE,1,87,TRUE,0,80,TRUE,1,57,TRUE,1,83,TRUE,0,84,TRUE,0,79,FALSE,1,54,FALSE,1,56,TRUE,1,50,FALSE,0,55,FALSE,1,52,TRUE,1,92,TRUE,0,84,TRUE,1,80,FALSE,1,50,FALSE,1,80,FALSE,1,53,TRUE,1,90,TRUE,1,50,TRUE,1,100,0.0121,0.04,0.0289,0.0225,0,0.1681,0.0064,0.0225,0.1936,0.3025,0.01,0.0169,0.25,0.2116,0.3481,0.1681,0.2304,0.2209,0.04,0.7056,0.25,0.1849,0.2116,0.64,0.7056,0.25,0.25,0.64,0.0625,0.6241,0.2209,0.81,0.276582143,0.153507143,0.399657143,19,59.38,23,71.88,7,87.5,6,75,3,37.5,7,87.5,13,81.25,10,62.5,70.44,53.38,68,78.5,81.88,73.19,67.69,-12.5,-1.44,-34.12,-7,41,-5.62,-8.06,5.19,0,0,1,2,0,1,0,0,2,0,0,1,1,0,0,2,2,0,0,2,1,0,0,2,2,4,1,1,0,1,0,0,1,0,1,1,1,2,1,1,0.6,0.6,0.4,1.2,1,1.4,0.4,1.2,0.7,1,0.85,2.67,5,4.375,-0.4,-0.8,0,0,-0.4,-4,-2,-1,2,-2.33,0,-1,1,-2,2,1,-1,0,0,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,5,9,2,7,3,4,8,1,6,3,2,4,1 +77,R_7huVumcWu2J2f9D,67 - 73,American,,American,Female,Agree,Agree,Strongly agree,Agree,Strongly agree,4,3,5,1,2,Disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,1,4,5,2,3,Somewhat Agree,Somewhat Disagree,Agree,Strongly Disagree,Somewhat Agree,3,4,2,1,5,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Strongly Agree,Somewhat disagree,Agree,3,2,4,5,1,8,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,2,4,5,1,8,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Somewhat Agree,2,5,1,3,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Agree,Strongly Agree,Agree,Agree,3,1,2,5,4,9,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,1,2,3,4,9,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,5,4,1,2,3,8,Neither agree nor disagree,Disagree,Somewhat disagree,Disagree,Disagree,2,3,5,4,1,FALSE,55,TRUE,100,FALSE,100,TRUE,50,TRUE,86,FALSE,96,TRUE,100,TRUE,100,TRUE,92,TRUE,100,FALSE,50,TRUE,100,TRUE,65,TRUE,100,FALSE,50,TRUE,70,FALSE,90,FALSE,80,FALSE,50,FALSE,70,TRUE,50,TRUE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,92,FALSE,50,FALSE,92,TRUE,83,TRUE,100,TRUE,50,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,2,3,-2,-1,1,2,-1,1,-1,2,-3,1,-2,-2,-1,-1,-2,2,2,3,-1,2,8,-3,1,1,1,-1,8,1,1,2,-3,1,8,1,1,1,-1,1,5,2,2,3,2,2,10,-3,-2,1,1,-1,9,1,1,2,-3,2,9,0,-2,-1,-2,-2,8,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,86,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,65,TRUE,0,100,FALSE,0,50,TRUE,1,70,FALSE,1,90,FALSE,1,80,FALSE,1,50,FALSE,1,70,TRUE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,92,TRUE,0,83,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.0064,0.09,0,0,0.0016,0,0,0.09,0.25,0,0.1225,0.0064,0.25,0.0196,0,0,0.25,0.0064,0,0.25,0.25,0.25,1,0.01,0.25,0.25,0.2025,0,0.04,0.6889,1,0.185282143,0.070721429,0.299842857,22,68.75,27,84.38,6,75,7,87.5,7,87.5,7,87.5,15,93.75,12,75,80.34,61.5,83.75,84.62,91.5,81.56,79.12,-15.63,-4.04,-13.5,-3.75,-2.88,4,-12.19,4.12,0,0,0,3,1,1,2,0,1,0,0,2,0,0,0,3,3,2,0,3,0,0,0,0,1,1,1,0,1,0,0,2,0,0,1,2,0,0,1,0,0.8,0.8,0.4,2.2,0.2,0.6,0.6,0.6,1.05,0.5,0.775,8,9.33,8.125,0.6,0.2,-0.2,1.6,0.2,-2,-1,-1,-3,-1.33,-1,2,2,-2,2,0,0,-2,2,-2,2,-1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,70,It was interesting and different than other surveys I've taken.,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,3,7,5,4,8,9,6,1,2,2,3,4,1 +78,R_7dLMCYItO3tbRjp,60 - 66,,Canadian,Canadian,Female,Agree,Agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,1,3,2,5,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,1,3,2,Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,5,4,3,2,1,Neither agree nor disagree,Agree,Agree,Somewhat agree,Somewhat disagree,2,1,3,5,4,Agree,Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,4,1,5,3,2,0,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,4,1,3,5,2,1,Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,3,5,4,2,1,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,3,5,2,1,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,3,1,5,4,2,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,2,3,5,4,1,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,2,1,4,3,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,5,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,53,TRUE,100,FALSE,79,TRUE,100,TRUE,50,TRUE,51,FALSE,50,FALSE,50,TRUE,50,TRUE,99,TRUE,50,TRUE,55,FALSE,50,FALSE,72,TRUE,84,TRUE,92,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,52,FALSE,50,FALSE,50,FALSE,96,FALSE,50,TRUE,61,26,2,2,3,-1,0,-1,-1,1,1,-1,2,1,1,-2,1,0,2,2,1,-1,2,2,3,-1,0,0,-1,-1,2,1,-1,1,2,1,1,-2,1,1,1,1,2,1,-1,1,2,2,3,-1,0,1,1,-1,1,1,-1,1,2,1,1,-1,1,1,1,0,1,1,-1,1,TRUE,0,61,FALSE,0,50,FALSE,1,96,FALSE,1,50,FALSE,0,50,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,92,TRUE,1,84,FALSE,1,72,FALSE,0,50,TRUE,1,55,TRUE,0,50,TRUE,0,99,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,51,TRUE,0,50,TRUE,1,100,FALSE,1,79,TRUE,1,100,TRUE,0,53,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.2025,0,0,0.2304,0,0,0.25,0.2401,0,0.0256,0.25,0.25,0.25,0.25,0.25,0.25,1,0.0441,0.25,0.25,0.25,0.0784,0.25,0.2809,0.25,0.3721,0.0016,0.9801,1,0.8464,0.289275,0.160435714,0.418114286,26,81.25,18,56.25,3,37.5,3,37.5,6,75,6,75,11,68.75,7,43.75,71.69,50.38,67,82.75,86.62,74.38,69,25,15.44,12.88,29.5,7.75,11.62,5.63,25.25,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,1,2,1,0,0,0,0.2,0,0.4,0,0.4,0.2,0.8,0.15,0.35,0.25,0.67,1,0.875,0,-0.2,-0.2,-0.4,-0.133333333,-1,0,0,0,-0.33,0,1,0,-1,1,1,-1,1,-1,-1,1,-1,5 cents,5 minutes,47 days,Female,High School (or equivalent),62,"i am really not sure what this survey was trying to prove or not prove, what was the purpose",0,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,5,3,2,4,7,6,8,1,9,2,3,4,1 +79,R_5e4W9ZBiMs9fFz2,67 - 73,American,,American,Female,Strongly agree,Agree,Somewhat agree,Disagree,Strongly agree,3,1,2,4,5,Agree,Strongly disagree,Agree,Somewhat disagree,Agree,4,5,1,2,3,Somewhat Agree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,3,2,5,1,4,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Agree,Agree,Strongly disagree,Strongly Agree,5,4,3,1,2,8,Agree,Strongly disagree,Agree,Somewhat agree,Strongly agree,1,5,4,2,3,9,Somewhat Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,3,4,5,2,1,8,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,4,5,1,3,9,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Agree,3,2,1,4,5,8,Somewhat Disagree,Somewhat Disagree,Agree,Strongly Disagree,Agree,2,5,3,4,1,7,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat agree,2,3,4,1,5,TRUE,77,TRUE,100,TRUE,98,FALSE,60,TRUE,92,FALSE,90,TRUE,99,TRUE,100,TRUE,84,TRUE,100,FALSE,96,TRUE,100,FALSE,100,TRUE,100,TRUE,66,TRUE,100,TRUE,82,TRUE,100,FALSE,69,FALSE,100,TRUE,78,TRUE,100,FALSE,100,TRUE,91,FALSE,100,TRUE,100,TRUE,85,FALSE,90,TRUE,99,TRUE,92,TRUE,99,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,-2,3,2,-3,2,-1,2,1,-1,3,-2,3,-2,-2,1,0,-1,3,2,2,-3,3,7,2,-3,2,1,3,8,1,1,3,-2,3,9,-1,1,1,-1,-2,8,3,1,0,1,1,7,1,-3,2,-1,2,9,-1,-1,2,-3,2,8,1,0,2,2,1,7,TRUE,0,77,TRUE,1,100,TRUE,0,98,FALSE,1,60,TRUE,1,92,FALSE,1,90,TRUE,1,99,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,66,TRUE,1,100,TRUE,0,82,TRUE,0,100,FALSE,1,69,FALSE,1,100,TRUE,1,78,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,0,85,FALSE,1,90,TRUE,0,99,TRUE,1,92,TRUE,1,99,TRUE,1,100,0,0,0,0.0001,0,0.01,0.0081,0,0,0,0.0064,1,0.0256,0.0016,0.0064,0,0,0.16,0.01,0,0.0484,0.1156,0.0961,1,0.6724,0.7225,0.0001,0.5929,0.9604,1,0.9801,1,0.300592857,0.087007143,0.514178571,24,75,23,71.88,7,87.5,5,62.5,5,62.5,6,75,15,93.75,8,50,92.09,82.38,92.62,97,96.38,93.81,90.38,3.12,20.21,-5.12,30.12,34.5,21.38,0.06,40.38,0,0,1,1,0,0,0,0,2,1,0,2,0,0,0,1,3,0,1,1,0,1,1,3,2,1,0,0,0,0,2,0,1,1,1,3,2,1,2,2,0.4,0.6,0.4,1.2,1.4,0.2,1,2,0.65,1.15,0.9,8,8,7.875,-1,0.4,-0.6,-0.8,-0.4,0,-1,1,1,0,1,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,67,Most of these were very good questions but the final group was a bit odd compared to the rest.,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,7,6,2,5,3,8,4,1,9,2,3,4,1 +80,R_51v3e3OUwwSDNlp,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,Disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,4,2,3,1,Agree,Agree,Agree,Disagree,Strongly Agree,5,2,1,4,3,Somewhat disagree,Neither agree nor disagree,Agree,Agree,Disagree,3,4,2,5,1,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,Agree,5,1,3,2,4,3,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Agree,5,1,2,4,3,1,Agree,Agree,Agree,Strongly Disagree,Agree,1,2,5,4,3,1,Strongly disagree,Neither agree nor disagree,Disagree,Somewhat agree,Strongly disagree,2,5,1,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,1,3,2,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Agree,1,5,3,2,4,1,Agree,Agree,Agree,Strongly Disagree,Strongly Agree,5,1,4,2,3,0,Somewhat agree,Neither agree nor disagree,Agree,Agree,Disagree,2,1,5,4,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,TRUE,55,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,91,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,80,TRUE,100,FALSE,72,FALSE,92,TRUE,90,FALSE,100,FALSE,71,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,0,0,0,-2,-2,2,-1,1,2,2,2,-2,3,-1,0,2,2,-2,3,3,0,-3,2,3,-3,-3,2,-3,2,1,2,2,2,-3,2,1,-3,0,-2,1,-3,7,2,2,0,0,0,2,-3,-3,2,-3,2,1,2,2,2,-3,3,0,1,0,2,2,-2,1,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,80,TRUE,1,100,FALSE,1,72,FALSE,1,92,TRUE,0,90,FALSE,1,100,FALSE,0,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0.0081,1,0,0,0,0.3025,0,0,0.5041,0.04,0.81,1,0.0784,1,0,1,0,0.0064,1,0,0.276767857,0.165042857,0.388492857,28,87.5,23,71.88,4,50,5,62.5,6,75,8,100,14,87.5,9,56.25,95.34,89.5,92.88,99,100,96.38,94.31,15.62,23.46,39.5,30.38,24,0,8.88,38.06,0,0,0,3,2,1,1,0,2,1,0,0,0,1,1,2,0,4,1,1,1,1,0,0,0,1,1,0,2,1,0,0,0,1,0,2,0,0,0,0,1,1,0.4,1.6,0.4,1,0.2,0.4,1,0.5,0.75,1.67,1,2,0.6,0,0.2,1.2,0.266666667,1,0,1,6,0.67,0,0,0,-2,2,0,0,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,69,no comment,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,2,5,7,4,3,9,8,1,6,2,3,4,1 +81,R_3NLRhLB8UD8d65b,67 - 73,American,,American,Male,Neither agree nor disagree,Agree,Strongly agree,Agree,Agree,5,3,4,2,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,3,2,1,4,5,Strongly Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,4,1,3,5,2,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,2,5,4,1,3,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,Agree,5,4,3,2,1,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,2,5,4,1,Strongly Agree,Agree,Agree,Disagree,Agree,5,3,1,4,2,1,Agree,Agree,Agree,Agree,Strongly disagree,5,2,4,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,5,1,2,3,4,7,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Somewhat disagree,5,2,1,3,4,5,Strongly Agree,Agree,Agree,Strongly Disagree,Somewhat Agree,4,3,1,2,5,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,4,5,3,2,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,72,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,88,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,58,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,66,FALSE,100,FALSE,100,FALSE,62,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,81,28,0,2,3,2,2,-3,-3,3,-3,-1,3,1,2,-2,1,2,1,2,2,-1,0,2,1,-1,2,3,-3,-3,3,-3,2,1,3,2,2,-2,2,1,2,2,2,2,-3,8,-1,1,3,3,-1,7,-3,-3,3,-2,-1,5,3,2,2,-3,1,4,-1,-1,1,2,-1,8,TRUE,0,81,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,62,FALSE,1,100,FALSE,1,100,TRUE,1,66,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,58,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,88,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,72,TRUE,1,100,0,0,0,0,0,0,0,0.3844,0,0,0,0.1156,0,0,0,0,0,0.25,0,0.0144,0,0.25,0.3364,0,0,0.25,0.0784,0.6561,1,1,1,0,0.190546429,0.053571429,0.327521429,28,87.5,25,78.13,6,75,7,87.5,5,62.5,7,87.5,15,93.75,10,62.5,89.91,72.5,95.75,91.38,100,90.62,89.19,9.37,11.78,-2.5,8.25,28.88,12.5,-3.13,26.69,0,0,2,3,0,0,0,0,0,3,0,1,0,0,1,0,1,0,0,2,1,1,0,1,3,0,0,0,1,0,0,1,0,1,0,3,2,1,0,0,1,0.6,0.4,0.6,1.2,0.2,0.4,1.2,0.65,0.75,0.7,1.67,5.33,4.625,-0.2,0.4,0,-0.6,0.066666667,-4,-4,-3,0,-3.66,-1,2,1,-2,2,-2,2,-2,2,-2,2,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),72,,1.375,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,8,7,6,5,2,3,4,1,9,4,3,2,1 +82,R_77kyIslwbC2FY80,60 - 66,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,4,2,3,1,Disagree,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,3,1,5,4,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,3,2,5,1,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,3,4,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,4,1,2,3,5,6,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,1,4,5,2,3,6,Strongly Agree,Agree,Agree,Somewhat Agree,Strongly Agree,2,5,4,3,1,4,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,5,3,4,1,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,2,4,1,5,3,6,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,4,1,2,3,6,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,4,3,1,5,2,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,2,1,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,95,TRUE,93,TRUE,100,FALSE,95,TRUE,95,FALSE,73,TRUE,89,TRUE,67,TRUE,67,TRUE,92,TRUE,90,TRUE,98,TRUE,100,TRUE,66,TRUE,94,TRUE,100,TRUE,93,TRUE,90,TRUE,97,TRUE,91,FALSE,68,TRUE,100,FALSE,100,TRUE,100,TRUE,85,FALSE,68,TRUE,100,FALSE,77,TRUE,100,TRUE,97,FALSE,78,TRUE,95,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,3,-2,1,-1,2,1,2,1,1,-1,3,-1,-1,-1,1,0,3,3,3,1,3,6,0,1,-1,1,0,6,3,2,2,1,3,4,1,-1,0,2,1,8,3,3,3,1,3,6,1,-1,0,1,0,6,2,1,0,0,3,5,1,-1,1,-1,1,6,FALSE,1,95,TRUE,1,93,TRUE,0,100,FALSE,1,95,TRUE,1,95,FALSE,1,73,TRUE,1,89,TRUE,1,67,TRUE,1,67,TRUE,1,92,TRUE,0,90,TRUE,0,98,TRUE,1,100,TRUE,0,66,TRUE,1,94,TRUE,1,100,TRUE,0,93,TRUE,0,90,TRUE,0,97,TRUE,0,91,FALSE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,85,FALSE,0,68,TRUE,0,100,FALSE,1,77,TRUE,0,100,TRUE,1,97,FALSE,0,78,TRUE,1,95,0.1089,0.4624,0,0.0121,0.0025,0.0729,0,0.0064,0.8281,0,0.0009,0,0.1089,0.81,0.0025,0.0049,0,0.0025,0.0529,0.7225,0.4624,0.0036,0.9409,0.4356,0.8649,1,0.6084,0.0025,1,0.81,1,0.9604,0.382275,0.1314,0.63315,28,87.5,18,56.25,4,50,5,62.5,4,50,5,62.5,13,81.25,5,31.25,89.16,89.25,90.5,85.62,91.25,87.69,90.62,31.25,32.91,39.25,28,35.62,28.75,6.44,59.37,0,0,0,0,0,2,0,0,1,1,1,1,1,2,0,2,0,1,1,1,0,0,0,0,0,3,2,1,1,1,0,0,1,1,0,2,0,2,2,1,0,0.8,1,1,0,1.6,0.4,1.4,0.7,0.85,0.775,5.33,5.67,5.875,0,-0.8,0.6,-0.4,-0.066666667,0,0,-1,2,-0.34,1,1,1,0,0,2,-2,1,-1,1,-1,1,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),65,,0,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,8,5,4,9,6,7,3,1,2,4,3,2,1 +83,R_1jSRqk2G1NpcOcH,67 - 73,American,,American,Female,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,5,4,2,3,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,2,5,1,3,Agree,Agree,Agree,Somewhat Agree,Agree,1,4,2,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,5,3,4,2,1,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,5,4,3,2,4,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,4,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,1,2,4,5,3,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,2,4,1,5,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,2,5,4,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,5,3,2,FALSE,100,TRUE,100,FALSE,100,TRUE,58,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,64,FALSE,100,FALSE,80,TRUE,100,TRUE,78,TRUE,100,TRUE,73,TRUE,89,FALSE,100,FALSE,100,FALSE,71,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,74,FALSE,77,TRUE,100,TRUE,100,FALSE,74,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,-1,1,1,2,0,-1,1,-1,0,2,2,2,1,2,1,1,1,1,-1,-1,0,1,1,2,5,1,-1,1,-1,1,2,2,1,1,0,1,4,0,1,1,1,-1,4,-1,-1,1,1,2,5,0,-1,1,-1,0,3,1,1,1,0,1,8,1,0,1,1,0,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,64,FALSE,0,100,FALSE,1,80,TRUE,0,100,TRUE,1,78,TRUE,0,100,TRUE,1,73,TRUE,1,89,FALSE,1,100,FALSE,1,100,FALSE,1,71,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,1,77,TRUE,0,100,TRUE,1,100,FALSE,0,74,TRUE,1,100,0,0,0.0121,0,0,0,0,1,0,0,0,0.0484,0.4096,0.04,0,0,0,0.3364,0.0529,0,1,0.0729,0.0841,1,0,0.0676,0.5476,0,0,0,1,1,0.237839286,0.131028571,0.34465,24,75,24,75,5,62.5,6,75,6,75,7,87.5,12,75,12,75,91.81,74.25,97.25,100,95.75,92.38,91.25,0,16.81,11.75,22.25,25,8.25,17.38,16.25,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,1,0.2,0.4,0.8,0.2,0,0,1,0.4,0.4,0.35,0.375,3.67,5.33,4.25,0.2,0.4,-0.2,-0.2,0.133333333,0,-1,-4,1,-1.66,-1,1,0,-1,1,-1,1,-1,1,0,0,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,Too long,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,3,9,2,8,4,7,5,1,6,2,4,3,1 +84,R_5TWlNmjz0LyQSvn,67 - 73,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Disagree,2,4,5,1,3,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,2,5,4,3,1,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,3,4,1,5,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Somewhat disagree,3,2,4,5,1,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,2,4,1,3,5,5,Agree,Neither Agree nor Disagree,Agree,Strongly Agree,Agree,3,5,1,2,4,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,2,4,5,3,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,4,1,3,2,5,4,Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,2,4,3,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,4,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,86,TRUE,100,TRUE,100,FALSE,95,TRUE,58,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,80,FALSE,100,TRUE,87,TRUE,100,FALSE,100,TRUE,100,FALSE,57,TRUE,100,TRUE,76,FALSE,76,FALSE,81,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,77,FALSE,77,FALSE,100,TRUE,85,FALSE,100,23,3,3,2,1,-2,1,-1,1,3,1,2,0,2,1,2,1,1,2,1,0,3,3,2,1,-1,6,0,1,3,3,1,5,2,0,2,3,2,5,-1,-1,-1,0,0,5,3,3,3,3,-3,3,0,1,0,3,0,4,2,-2,2,0,2,4,1,1,1,1,0,3,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,77,FALSE,0,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,81,FALSE,1,76,TRUE,1,76,TRUE,0,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,87,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,58,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0.0576,0,0.0361,0.5929,0.0225,0,0.0529,0.0025,0,0.04,0.3249,0.7569,1,0,0.3364,0.0196,0,0,1,1,0.0576,0.224996429,0.125857143,0.324135714,23,71.88,24,75,5,62.5,6,75,5,62.5,8,100,13,81.25,11,68.75,91.72,78.88,91.62,100,96.38,91.31,92.12,-3.12,16.72,16.38,16.62,37.5,-3.62,10.06,23.37,0,0,0,0,1,1,2,2,0,0,0,0,0,2,0,2,2,3,1,0,0,0,1,2,1,1,2,1,0,1,0,2,0,1,0,0,0,1,0,0,0.2,1,0.4,1.6,0.8,1,0.6,0.2,0.8,0.65,0.725,5.33,3.67,4.375,-0.6,0,-0.2,1.4,-0.266666667,3,1,1,2,1.66,0,2,2,-1,1,-1,1,-2,2,-2,2,2,10 cents,5 minutes,47 days,Female,High School (or equivalent),67,Quite different from the usual surveys that I participate in.,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,02REV,5,9,2,8,7,4,6,1,3,3,4,2,1 +85,R_5SB261mcsInzUna,67 - 73,,Canadian,Canadian,Female,Somewhat disagree,Agree,Strongly agree,Somewhat agree,Disagree,3,4,2,5,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,3,2,4,1,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,5,4,1,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,5,1,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,5,2,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,3,1,5,4,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,5,3,1,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,1,2,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,2,1,4,3,5,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,2,5,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,51,TRUE,80,TRUE,100,FALSE,70,TRUE,53,TRUE,100,FALSE,100,TRUE,100,TRUE,68,TRUE,53,TRUE,69,FALSE,100,TRUE,76,TRUE,74,TRUE,55,TRUE,100,TRUE,50,TRUE,100,FALSE,74,TRUE,78,FALSE,57,TRUE,100,TRUE,84,TRUE,100,TRUE,77,FALSE,100,TRUE,56,TRUE,51,TRUE,100,TRUE,83,TRUE,78,16,-1,2,3,1,-2,-1,-1,1,1,-2,1,1,0,0,1,1,1,1,1,-1,0,1,1,1,1,1,-1,-1,1,1,0,4,1,1,1,1,1,1,-1,0,1,1,1,3,1,1,2,1,0,5,-1,0,1,1,0,5,1,1,1,0,1,5,0,0,0,1,-1,5,TRUE,0,78,TRUE,1,83,TRUE,0,100,TRUE,0,51,TRUE,1,56,FALSE,1,100,TRUE,1,77,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,57,TRUE,0,78,FALSE,0,74,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,55,TRUE,0,74,TRUE,0,76,FALSE,1,100,TRUE,1,69,TRUE,1,53,TRUE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,70,TRUE,0,100,TRUE,1,80,TRUE,1,51,TRUE,1,100,0,0,0,0.0529,0,0,0,0,0,0.2209,0.04,0.5476,0.0256,0.1849,0.1936,0.0289,0.4624,0.2601,0.09,0,0.0961,0.25,0.5776,1,0.3025,0.2809,0.2401,0.6084,1,0.5476,1,0.6084,0.305914286,0.140285714,0.471542857,16,50,20,62.5,5,62.5,4,50,5,62.5,6,75,15,93.75,5,31.25,79.28,63.12,77.75,85.25,91,79.81,78.75,-12.5,16.78,0.62,27.75,22.75,16,-13.94,47.5,1,1,2,0,3,0,0,0,0,2,0,0,1,1,0,2,1,0,0,2,2,1,1,0,2,0,1,0,0,2,0,0,1,0,0,1,1,1,0,0,1.4,0.4,0.4,1,1.2,0.6,0.2,0.6,0.8,0.65,0.725,2,5,3.625,0.2,-0.2,0.2,0.4,0.066666667,-4,-1,-4,-2,-3,0,1,0,-2,2,-1,1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,Unknown,0.75,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,5,7,2,4,3,9,6,1,8,4,2,3,1 +86,R_5sz5kJpCL0GuQui,67 - 73,American,,American,Female,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,5,3,1,2,Somewhat agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Somewhat agree,5,3,2,1,4,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,5,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,4,5,1,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,Agree,3,5,2,1,4,8,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,1,5,4,2,3,3,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,5,3,1,4,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,4,5,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Neither agree nor disagree,Strongly Agree,Somewhat agree,Somewhat disagree,4,1,3,2,5,6,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly disagree,5,2,4,3,1,10,Strongly Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,2,3,1,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,5,3,2,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,TRUE,65,TRUE,100,TRUE,56,TRUE,70,TRUE,51,TRUE,74,TRUE,86,TRUE,54,FALSE,61,FALSE,54,FALSE,53,TRUE,62,TRUE,63,TRUE,95,FALSE,55,TRUE,61,FALSE,58,TRUE,80,FALSE,68,TRUE,85,FALSE,56,TRUE,95,TRUE,79,TRUE,87,TRUE,72,FALSE,61,FALSE,53,TRUE,55,TRUE,77,FALSE,63,TRUE,71,22,0,3,3,0,1,1,0,3,-3,1,3,3,0,0,0,-3,-3,-3,-3,-3,1,3,2,0,2,8,3,0,3,-3,2,3,3,3,3,0,1,4,3,3,1,1,-1,10,1,0,3,1,-1,6,-2,1,-1,1,-3,10,3,3,1,0,0,6,-3,-3,-3,-3,-3,10,TRUE,0,71,FALSE,0,63,TRUE,0,77,TRUE,0,55,FALSE,0,53,FALSE,1,61,TRUE,1,72,TRUE,1,87,TRUE,1,79,TRUE,1,95,FALSE,1,56,TRUE,0,85,FALSE,0,68,TRUE,0,80,FALSE,0,58,TRUE,1,61,FALSE,1,55,TRUE,0,95,TRUE,0,63,TRUE,0,62,FALSE,0,53,FALSE,0,54,FALSE,1,61,TRUE,1,54,TRUE,0,86,TRUE,1,74,TRUE,0,51,TRUE,0,70,TRUE,0,56,TRUE,1,100,TRUE,1,65,TRUE,1,92,0.0169,0.0676,0.1521,0.0784,0.0064,0.1521,0.2116,0.0025,0.3844,0.2916,0,0.4624,0.0441,0.1936,0.2809,0.3969,0.1521,0.3025,0.49,0.7396,0.2809,0.3364,0.3969,0.64,0.2025,0.2601,0.1225,0.5041,0.5929,0.9025,0.3136,0.7225,0.3352,0.205792857,0.464607143,22,68.75,14,43.75,3,37.5,4,50,3,37.5,4,50,10,62.5,4,25,69.12,61.25,62.38,78.38,74.5,70.5,67.75,25,25.37,23.75,12.38,40.88,24.5,8,42.75,1,0,1,0,1,2,0,0,0,1,0,0,3,0,1,6,6,4,4,2,1,3,0,1,2,3,1,4,4,4,0,0,1,0,0,0,0,0,0,0,0.6,0.6,0.8,4.4,1.4,3.2,0.2,0,1.6,1.2,1.4,5,7.33,7.125,-0.8,-2.6,0.6,4.4,-0.933333333,2,-7,-2,0,-2.33,-1,2,2,0,0,0,0,0,0,0,0,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),69,really interesting survey,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,5,9,4,2,6,3,7,1,8,4,2,3,1 +87,R_7RrdYEClXXNwi3F,60 - 66,American,,American,Female,Agree,Agree,Strongly agree,Strongly disagree,Strongly agree,4,3,2,5,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,2,1,3,5,4,Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,2,5,3,1,4,Agree,Agree,Agree,Agree,Disagree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,3,2,4,5,1,2,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,2,1,3,5,4,1,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,5,4,2,3,1,2,Agree,Agree,Agree,Strongly Agree,Somewhat disagree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Agree,4,1,3,2,5,1,Somewhat agree,Strongly disagree,Somewhat agree,Disagree,Somewhat disagree,3,2,5,4,1,1,Agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,1,5,4,2,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,1,5,4,2,3,TRUE,91,TRUE,92,FALSE,86,FALSE,50,TRUE,55,FALSE,85,TRUE,80,TRUE,90,TRUE,90,TRUE,71,FALSE,85,TRUE,86,FALSE,70,TRUE,86,FALSE,50,TRUE,95,FALSE,50,TRUE,71,TRUE,50,FALSE,100,FALSE,50,TRUE,70,FALSE,100,TRUE,95,FALSE,60,TRUE,75,FALSE,50,FALSE,60,TRUE,90,FALSE,60,TRUE,60,TRUE,75,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,-3,3,1,-3,2,-3,0,2,0,3,-2,3,2,2,2,2,-2,3,3,3,-3,3,1,1,-3,2,-3,0,2,2,0,3,0,2,1,2,2,2,3,-1,2,3,2,3,1,2,1,1,-3,1,-2,-1,1,2,0,3,-3,3,1,0,0,2,2,-1,3,TRUE,0,91,TRUE,1,92,FALSE,1,86,FALSE,1,50,TRUE,1,55,FALSE,1,85,TRUE,1,80,TRUE,1,90,TRUE,1,90,TRUE,1,71,FALSE,1,85,TRUE,0,86,FALSE,0,70,TRUE,0,86,FALSE,0,50,TRUE,1,95,FALSE,1,50,TRUE,0,71,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,100,TRUE,1,95,FALSE,1,60,TRUE,1,75,FALSE,1,50,FALSE,1,60,TRUE,0,90,FALSE,0,60,TRUE,1,60,TRUE,1,75,0.01,0.0625,0.0025,0.04,0.0625,0.0225,0.0025,0.0841,0,0.09,0.36,0.49,0.01,0.0225,0.2025,0.0064,0,0.25,0.16,0.16,0.25,0.25,0.25,0.7396,0.25,0.25,0.16,0.8281,0.0196,0.5041,0.81,0.7396,0.249071429,0.1145,0.383642857,18,56.25,22,68.75,6,75,5,62.5,5,62.5,6,75,12,75,10,62.5,74.31,65.88,71.88,75.5,84,73.62,75,-12.5,5.56,-9.12,9.38,13,9,-1.38,12.5,1,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,1,1,1,0,0,4,1,0,0,1,1,1,0,0,0,1,0,2,2,0,0,1,0.4,0,0.6,0.4,1.2,0.6,0.2,1,0.35,0.75,0.55,1.33,1,1.5,-0.8,-0.6,0.4,-0.6,-0.333333333,0,1,0,-1,0.33,0,1,-1,-2,2,-2,2,0,0,0,0,-1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,,0.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,6,8,5,2,9,3,4,1,7,4,3,2,1 +88,R_698vEegpho6l6RH,67 - 73,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,2,4,1,3,5,Disagree,Disagree,Agree,Disagree,Somewhat agree,3,4,2,5,1,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Agree,4,5,1,2,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,4,5,2,1,3,Agree,Strongly Agree,Agree,Somewhat agree,Somewhat agree,5,3,2,4,1,3,Strongly disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,2,1,4,5,3,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,Agree,4,2,5,1,3,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,5,4,1,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Agree,Somewhat disagree,3,5,2,4,1,3,Disagree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat disagree,3,5,1,2,4,3,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,4,5,3,1,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Agree,5,3,1,4,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,60,TRUE,100,TRUE,100,TRUE,54,TRUE,60,FALSE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,86,FALSE,65,TRUE,100,TRUE,100,FALSE,86,TRUE,75,TRUE,100,TRUE,65,FALSE,100,TRUE,86,FALSE,86,FALSE,65,TRUE,65,TRUE,91,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,90,TRUE,81,FALSE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,0,-2,-2,2,-2,1,-1,0,1,-1,2,-1,0,0,2,2,2,3,2,1,1,3,-3,-2,2,-1,1,3,-1,1,2,1,2,1,-1,-1,-1,1,1,5,2,3,2,2,-1,3,-2,0,1,-2,-1,3,-1,1,1,1,2,2,0,0,1,2,2,4,FALSE,1,60,TRUE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,86,FALSE,1,65,TRUE,0,100,TRUE,1,100,FALSE,1,86,TRUE,1,75,TRUE,1,100,TRUE,0,65,FALSE,1,100,TRUE,0,86,FALSE,1,86,FALSE,0,65,TRUE,1,65,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,0,90,TRUE,1,81,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0.0196,0.0196,0.1225,0.0361,0,0.0625,0.1225,0.16,0,0.8281,0.2916,0.25,1,0.4225,0.0625,0.7396,0.0196,0.4225,0.25,0.25,0.16,1,0,0.81,1,0.287471429,0.11875,0.456192857,25,78.13,20,62.5,4,50,4,50,7,87.5,5,62.5,14,87.5,6,37.5,82.5,69.38,83.88,87.12,89.62,84.81,80.19,15.63,20,19.38,33.88,-0.38,27.12,-2.69,42.69,0,0,0,2,1,1,0,0,1,0,0,1,1,2,0,0,1,1,1,1,0,0,0,1,1,0,2,1,0,2,0,1,0,2,0,1,0,1,0,0,0.6,0.4,0.8,0.8,0.4,1,0.6,0.4,0.65,0.6,0.625,2.33,2.67,3,0.2,-0.6,0.2,0.4,-0.066666667,0,0,-1,1,-0.34,0,1,1,-1,1,1,-1,0,0,-1,1,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,70,I found the survey interesting,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,6,5,3,4,9,8,7,1,2,4,2,3,1 +89,R_7t6d6cFSLKTLPTS,60 - 66,,Canadian,Canadian,Male,Somewhat disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,3,5,1,2,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Somewhat Disagree,3,2,1,5,4,Somewhat disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,1,5,2,4,3,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,1,5,4,3,2,8,Neither agree nor disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Strongly disagree,4,5,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,2,4,5,1,3,0,Disagree,Agree,Agree,Disagree,Disagree,4,2,5,3,1,5,Agree,Disagree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,2,4,5,3,1,2,Neither agree nor disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,2,3,1,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,81,TRUE,59,FALSE,80,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,74,TRUE,100,FALSE,100,TRUE,50,FALSE,100,FALSE,74,TRUE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,50,TRUE,73,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,100,30,-1,0,2,2,0,-1,0,1,0,0,2,0,0,-2,-1,-1,-2,-2,0,-3,2,1,1,0,1,8,0,1,1,2,0,6,2,0,0,-1,0,3,0,-1,-2,0,-3,8,0,0,2,2,0,5,-2,2,2,-2,-2,0,2,-2,0,-3,0,5,0,-2,-2,0,-3,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,73,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,74,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,74,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,80,TRUE,0,59,TRUE,1,81,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.25,0,0.0676,0.0361,0,0.0729,0.25,0.25,0,0,0.25,0.04,0,0,0.25,0.25,0,0.0676,0.25,0,0,1,0,0.3481,0.25,0.129725,0.084042857,0.175407143,30,93.75,27,84.38,5,62.5,7,87.5,8,100,7,87.5,16,100,11,68.75,82.53,65.38,85.38,90.5,88.88,86.12,78.94,9.37,-1.85,2.88,-2.12,-9.5,1.38,-13.88,10.19,3,1,1,2,1,1,1,0,2,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,2,1,2,2,0,2,0,1,1,1,0,0,0,0,1.6,0.8,0.4,0.4,0.2,1.6,0.8,0.2,0.8,0.7,0.75,5.67,3.33,4.625,1.4,-0.8,-0.4,0.2,0.066666667,3,6,-2,6,2.34,2,2,1,-2,2,-2,2,-1,1,-2,2,0,20 cents,100 minutes,47 days,Male,University - Undergraduate,61,,1.5,0,0,1,0,1,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,9,5,3,4,8,6,7,1,2,2,3,4,1 +90,R_3HuGQO7ogFJUBJZ,67 - 73,American,,American,Female,Strongly disagree,Disagree,Agree,Somewhat disagree,Disagree,4,1,3,2,5,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Somewhat agree,5,4,2,3,1,Strongly Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly Agree,3,5,4,2,1,Strongly disagree,Disagree,Somewhat disagree,Agree,Strongly disagree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,2,3,4,1,1,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,1,3,2,4,5,1,Strongly Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,2,5,4,1,3,6,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,Strongly disagree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly disagree,Disagree,Agree,Neither agree nor disagree,Strongly disagree,3,1,5,2,4,2,Somewhat disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,2,Strongly agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly agree,1,5,4,2,3,6,Disagree,Disagree,Disagree,Agree,Strongly disagree,4,3,5,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,76,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,60,TRUE,50,FALSE,100,TRUE,50,TRUE,100,FALSE,81,TRUE,100,FALSE,50,TRUE,96,FALSE,50,TRUE,97,FALSE,76,FALSE,95,FALSE,50,TRUE,96,TRUE,81,FALSE,92,TRUE,95,FALSE,50,FALSE,81,TRUE,100,TRUE,87,22,-3,-2,2,-1,-2,0,-2,3,-2,1,3,0,2,-3,3,-3,-2,-1,2,-3,-3,-2,2,-1,0,1,1,-2,3,-2,2,1,3,1,2,-3,3,1,-1,2,1,1,-3,6,-3,-2,2,0,-3,1,-1,-2,1,0,0,2,3,0,2,-3,3,2,-2,-2,-2,2,-3,6,TRUE,0,87,TRUE,1,100,FALSE,1,81,FALSE,1,50,TRUE,1,95,FALSE,1,92,TRUE,1,81,TRUE,1,96,FALSE,0,50,FALSE,0,95,FALSE,1,76,TRUE,0,97,FALSE,0,50,TRUE,0,96,FALSE,0,50,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,76,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0016,0,0,0.0361,0,0.0064,0,0.9025,0,0.16,0,0.25,0.25,0.0576,0.0025,0,0,0.25,0.25,0,0.25,0.25,0.25,0.9216,0.0361,0.25,0.25,0.7569,0.0361,1,0.5776,0.9409,0.27315,0.134214286,0.412085714,22,68.75,21,65.63,4,50,6,75,4,50,7,87.5,11,68.75,10,62.5,80.09,59.5,80.5,89.88,90.5,79.81,80.38,3.12,14.46,9.5,5.5,39.88,3,11.06,17.88,0,0,0,0,2,1,0,0,0,1,0,1,0,0,0,2,4,2,1,0,0,0,0,1,1,1,0,2,2,1,0,0,0,0,0,1,0,1,0,0,0.4,0.4,0.2,1.8,0.4,1.2,0,0.4,0.7,0.5,0.6,1,1.67,2.5,0,-0.8,0.2,1.4,-0.2,0,-1,-1,0,-0.67,1,2,1,-2,2,-2,2,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,different,1.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,7,6,4,3,9,8,5,1,2,2,4,3,1 +91,R_3zYM8IjnxrPy43Y,67 - 73,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,3,4,1,5,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,4,1,3,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,5,1,3,4,Neither agree nor disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Agree,Agree,Somewhat agree,Strongly Agree,5,3,1,4,2,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,2,5,3,1,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,5,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,3,5,2,4,1,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,2,3,1,4,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,2,3,1,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,TRUE,85,TRUE,87,FALSE,100,FALSE,76,TRUE,65,FALSE,65,TRUE,90,TRUE,90,TRUE,73,TRUE,82,TRUE,65,TRUE,77,TRUE,92,TRUE,100,FALSE,50,FALSE,60,FALSE,50,TRUE,84,FALSE,60,FALSE,70,TRUE,74,TRUE,55,FALSE,72,TRUE,71,FALSE,70,TRUE,70,TRUE,50,FALSE,50,TRUE,73,TRUE,71,TRUE,50,TRUE,91,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,1,1,3,-1,1,1,-1,0,1,1,0,0,1,0,1,2,2,0,3,2,2,1,3,7,-1,0,0,1,-1,7,0,1,1,1,1,5,0,0,1,-1,1,5,3,2,1,1,3,4,0,0,1,-2,0,6,1,0,1,0,1,5,1,0,1,0,0,4,TRUE,0,85,TRUE,1,87,FALSE,1,100,FALSE,1,76,TRUE,1,65,FALSE,1,65,TRUE,1,90,TRUE,1,90,TRUE,1,73,TRUE,1,82,TRUE,0,65,TRUE,0,77,TRUE,1,92,TRUE,0,100,FALSE,0,50,FALSE,0,60,FALSE,1,50,TRUE,0,84,FALSE,1,60,FALSE,1,70,TRUE,1,74,TRUE,1,55,FALSE,1,72,TRUE,1,71,FALSE,1,70,TRUE,1,70,TRUE,0,50,FALSE,1,50,TRUE,0,73,TRUE,1,71,TRUE,1,50,TRUE,1,91,0.01,0.09,0.36,0.01,0.0081,0.1225,0.0841,0.0324,0.09,0.2025,0.0841,0.0064,0.0729,0.4225,0.1225,0.0169,0.0784,0.0576,0.25,0.09,0.0676,0.25,0.16,1,0.25,0.25,0.25,0.7225,0,0.7056,0.5329,0.5929,0.232942857,0.100064286,0.365821429,20,62.5,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,72.44,63.88,72.75,79.5,73.62,73.19,71.69,-9.38,0.56,1.38,-14.75,17,-1.38,-14.31,15.44,0,1,1,0,0,0,1,1,2,1,1,0,1,1,0,0,1,1,3,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,1,1,1,2,0,0.4,1,0.6,1.2,0.2,0.6,0.4,1,0.8,0.55,0.675,6.33,5,5.375,0.2,0.4,0.2,0.2,0.266666667,3,1,0,1,1.33,0,1,0,-1,1,0,0,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,Interesting multiple choice questions!,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,3,5,6,8,4,2,9,1,7,2,3,4,1 +92,R_3GxmlipNoWtF7t7,67 - 73,American,,American,Female,Agree,Somewhat agree,Strongly agree,Disagree,Strongly disagree,5,4,2,3,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,5,2,4,3,Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,4,5,2,3,Agree,Agree,Agree,Strongly Agree,Agree,5,1,2,3,4,Agree,Somewhat agree,Agree,Disagree,Strongly disagree,3,4,1,2,5,1,Agree,Strongly disagree,Strongly agree,Disagree,Agree,1,4,5,3,2,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,3,5,1,4,1,Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,1,4,3,5,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly disagree,3,2,1,5,4,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,4,3,2,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,5,2,1,3,1,Agree,Agree,Agree,Strongly Agree,Strongly Agree,2,1,3,5,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,95,TRUE,99,FALSE,91,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,60,FALSE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,70,FALSE,80,FALSE,100,TRUE,80,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,85,FALSE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,3,-2,-3,2,-3,3,-3,2,2,2,3,0,2,2,2,2,3,2,2,1,2,-2,-3,1,2,-3,3,-2,2,1,2,3,3,3,2,1,2,1,2,3,3,1,2,0,3,0,-3,2,1,-3,3,-3,2,2,3,3,3,2,3,1,2,2,2,3,3,3,TRUE,0,95,TRUE,1,99,FALSE,1,91,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,70,FALSE,1,80,FALSE,0,100,TRUE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,100,FALSE,0,85,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0.04,0.04,0.7225,0,0.0625,0,0.25,0.0001,0.25,0.25,0.25,0,1,0.25,0.09,0.36,0.25,0.25,0.25,0.9025,0.0081,0.25,1,1,0.266989286,0.115364286,0.418614286,25,78.13,22,68.75,6,75,5,62.5,5,62.5,6,75,11,68.75,11,68.75,80.78,68,81.25,85.62,88.25,86.81,74.75,9.38,12.03,-7,18.75,23.12,13.25,18.06,6,0,0,1,0,0,0,0,0,1,0,0,1,0,3,0,0,1,0,0,1,0,1,0,2,0,1,0,0,0,0,1,1,0,2,1,0,0,0,0,1,0.2,0.2,0.8,0.4,0.6,0.2,1,0.2,0.4,0.5,0.45,1,1.67,1.5,-0.4,0,-0.2,0.2,-0.2,-1,-1,0,-2,-0.67,-2,0,-2,-2,2,1,-1,2,-2,2,-2,1,10 cents,100 minutes,47 days,Female,High School (or equivalent),71,fun! I'd love to know the results,-0.75,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,5,8,3,4,7,6,9,1,2,2,4,3,1 +93,R_7luEeVGChG2wXTP,53 - 59,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,4,1,3,5,2,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,2,1,3,4,5,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Disagree,Agree,2,4,3,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Strongly Agree,Strongly Agree,Somewhat disagree,Agree,3,4,5,1,2,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,5,1,3,2,4,6,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,2,3,1,5,4,8,Agree,Somewhat agree,Strongly Agree,Agree,Strongly Agree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,5,1,3,2,4,2,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,1,2,4,3,4,Agree,Somewhat Agree,Somewhat Disagree,Strongly Disagree,Agree,4,5,3,1,2,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,3,5,TRUE,86,TRUE,86,TRUE,72,FALSE,50,TRUE,81,FALSE,50,TRUE,88,TRUE,100,TRUE,59,TRUE,88,FALSE,60,FALSE,89,TRUE,82,TRUE,90,TRUE,70,TRUE,84,TRUE,53,FALSE,76,FALSE,61,FALSE,89,TRUE,54,TRUE,63,FALSE,100,TRUE,68,TRUE,70,TRUE,73,TRUE,58,FALSE,69,TRUE,71,TRUE,78,FALSE,53,TRUE,96,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,1,1,-1,-2,2,-2,1,1,1,-1,-2,2,-1,1,1,1,-1,-1,3,3,-1,2,7,-1,-2,2,-2,1,1,2,2,1,-1,2,6,2,1,3,2,3,8,1,3,3,2,-1,3,0,-1,1,0,-1,2,2,1,-1,-3,2,4,-1,-1,1,1,1,6,TRUE,0,86,TRUE,1,86,TRUE,0,72,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,1,88,TRUE,1,100,TRUE,1,59,TRUE,1,88,FALSE,1,60,FALSE,1,89,TRUE,1,82,TRUE,0,90,TRUE,1,70,TRUE,1,84,TRUE,0,53,FALSE,1,76,FALSE,1,61,FALSE,1,89,TRUE,1,54,TRUE,1,63,FALSE,1,100,TRUE,1,68,TRUE,0,70,TRUE,1,73,TRUE,0,58,FALSE,1,69,TRUE,0,71,TRUE,1,78,FALSE,0,53,TRUE,1,96,0,0.0729,0.0256,0.0144,0.0016,0.25,0.1024,0.0144,0.0121,0.1369,0.0484,0.0324,0.1681,0.16,0.0361,0.0196,0,0.25,0.0961,0.49,0.2116,0.09,0.1521,0.81,0.2809,0.3364,0.2809,0.7396,0.5184,0.0576,0.5041,0.0121,0.207564286,0.088,0.327128571,24,75,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,73.97,62.12,73.38,79.25,81.12,76.44,71.5,0,-1.03,-12.88,-1.62,16.75,-6.38,-17.31,15.25,2,0,0,2,1,0,0,0,0,0,1,1,2,1,0,3,0,2,1,4,0,0,0,1,2,1,1,1,2,2,1,0,0,1,0,0,2,0,0,2,1,0,1,2,0.6,1.4,0.4,0.8,1,0.8,0.9,4.67,3,4.625,0.4,-1.4,0.6,1.2,-0.133333333,4,-1,2,2,1.67,1,2,2,-2,2,0,0,-1,1,-2,2,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,interesting,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,02DGEN,01DIR,9,3,7,5,4,6,8,1,2,4,3,2,1 +94,R_78PcOG5RrfRfqev,67 - 73,,Canadian,Canadian,Female,Somewhat agree,Disagree,Agree,Strongly disagree,Strongly agree,3,4,5,2,1,Neither agree nor disagree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,5,3,2,1,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,4,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,2,5,1,4,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Strongly Agree,1,5,2,3,4,1,Somewhat agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,3,2,1,4,5,1,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,3,1,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Disagree,Agree,Neither agree nor disagree,Strongly Agree,5,2,3,1,4,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,4,2,5,3,1,1,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,1,3,4,5,0,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,3,4,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,86,TRUE,88,TRUE,96,FALSE,57,FALSE,56,FALSE,92,TRUE,94,TRUE,93,TRUE,58,TRUE,94,FALSE,86,TRUE,92,TRUE,93,TRUE,94,TRUE,58,TRUE,96,FALSE,57,FALSE,92,TRUE,81,FALSE,92,FALSE,86,TRUE,86,TRUE,76,TRUE,80,FALSE,90,TRUE,92,FALSE,78,FALSE,89,TRUE,89,TRUE,90,TRUE,87,TRUE,96,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,-2,2,-3,3,0,2,3,0,1,2,0,3,-3,3,1,1,1,2,1,1,-3,2,-3,3,1,1,1,3,0,3,1,3,2,3,-3,3,1,0,0,1,0,0,4,2,-2,2,0,3,1,0,1,3,0,2,1,3,2,3,-3,3,0,2,0,1,1,1,2,TRUE,0,86,TRUE,1,88,TRUE,0,96,FALSE,1,57,FALSE,0,56,FALSE,1,92,TRUE,1,94,TRUE,1,93,TRUE,1,58,TRUE,1,94,FALSE,1,86,TRUE,0,92,TRUE,1,93,TRUE,0,94,TRUE,1,58,TRUE,1,96,FALSE,1,57,FALSE,1,92,TRUE,0,81,FALSE,1,92,FALSE,0,86,TRUE,1,86,TRUE,0,76,TRUE,1,80,FALSE,1,90,TRUE,1,92,FALSE,1,78,FALSE,1,89,TRUE,0,89,TRUE,1,90,TRUE,1,87,TRUE,1,96,0.0049,0.0064,0.0016,0.0036,0.0016,0.0064,0.04,0.0036,0.0064,0.0196,0.01,0.0049,0.1764,0.0196,0.3136,0.0144,0.5776,0.1849,0.0121,0.01,0.7396,0.1764,0.6561,0.8836,0.1849,0.0484,0.0169,0.7396,0.9216,0.0064,0.7921,0.8464,0.264753571,0.0985,0.431007143,24,75,23,71.88,7,87.5,4,50,6,75,6,75,14,87.5,9,56.25,84.19,74.12,80.62,91,91,84.19,84.19,3.12,12.31,-13.38,30.62,16,16,-3.31,27.94,0,1,0,0,0,1,1,0,0,2,1,2,0,0,0,1,1,0,2,1,1,0,0,3,0,0,1,0,0,1,1,2,0,0,0,1,1,0,1,0,0.2,0.8,0.6,1,0.8,0.4,0.6,0.6,0.65,0.6,0.625,1,0.67,1.375,-0.6,0.4,0,0.4,-0.066666667,0,0,1,2,0.33,-1,2,2,-2,2,0,0,-2,2,-2,2,-1,5 cents,5 minutes,47 days,Female,University - Undergraduate,73,No feedback.,1,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,2,9,7,5,6,4,8,1,3,2,4,3,1 +95,R_5Q1aVF0TWRgy34Z,67 - 73,American,Canadian,Both,Female,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,3,4,5,2,1,Disagree,Disagree,Agree,Disagree,Somewhat disagree,3,5,4,1,2,Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,1,2,4,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,2,1,5,3,4,Agree,Agree,Agree,Somewhat agree,Agree,1,3,2,5,4,6,Disagree,Neither agree nor disagree,Agree,Disagree,Somewhat disagree,3,2,4,1,5,6,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,4,1,3,2,4,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,5,1,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Strongly Agree,Neither agree nor disagree,3,1,2,4,5,7,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,2,4,1,3,5,8,Agree,Neither Agree nor Disagree,Disagree,Strongly Disagree,Neither Agree nor Disagree,1,3,2,4,5,9,Strongly disagree,Strongly disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,100,TRUE,93,FALSE,98,TRUE,50,TRUE,85,TRUE,93,TRUE,100,FALSE,100,TRUE,50,TRUE,74,FALSE,100,FALSE,82,FALSE,91,FALSE,100,TRUE,100,FALSE,74,TRUE,90,TRUE,100,FALSE,85,FALSE,94,TRUE,85,TRUE,50,TRUE,90,TRUE,100,FALSE,100,TRUE,50,FALSE,52,FALSE,100,TRUE,100,FALSE,100,25,3,0,0,2,-2,-2,-2,2,-2,-1,2,0,2,-2,2,0,1,1,2,0,2,2,2,1,2,6,-2,0,2,-2,-1,6,2,1,2,0,2,4,2,2,2,1,1,5,2,2,2,3,0,7,-2,0,0,0,-2,8,2,0,-2,-3,0,9,-3,-3,-2,0,0,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,50,TRUE,1,85,FALSE,1,94,FALSE,1,85,TRUE,1,100,TRUE,0,90,FALSE,0,74,TRUE,1,100,FALSE,1,100,FALSE,1,91,FALSE,1,82,FALSE,1,100,TRUE,1,74,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,93,TRUE,1,85,TRUE,0,50,FALSE,1,98,TRUE,0,93,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.01,0.0225,0,0,0,0,0,0.0225,0,0.25,0,0,0.25,0.0036,0.25,0,0,0.2304,0.0004,0.8649,0.0676,0.5476,0.0324,0.81,0,0.25,0.0625,0,0,0.0081,0.8649,0.0225,0.16205,0.071892857,0.252207143,25,78.13,27,84.38,6,75,7,87.5,6,75,8,100,15,93.75,12,75,86.28,72.12,89.62,86.75,96.62,83.31,89.25,-6.25,1.9,-2.88,2.12,11.75,-3.38,-10.44,14.25,1,2,2,1,4,0,2,0,0,0,0,1,0,2,0,2,1,1,1,1,1,2,2,1,2,0,2,2,2,1,0,0,4,1,2,3,4,3,2,0,2,0.4,0.6,1.2,1.6,1.4,1.4,2.4,1.05,1.7,1.375,5.33,8,6.875,0.4,-1,-0.8,-1.2,-0.466666667,-1,-2,-5,-5,-2.67,0,1,1,-2,2,-2,2,-1,1,-2,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,70,I am not good at math one little bit. ,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,5,8,6,4,2,9,7,1,3,4,3,2,1 +96,R_5P1hksMwlBeyIeH,60 - 66,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,3,4,5,2,1,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,4,5,1,Somewhat Disagree,Strongly Disagree,Strongly Agree,Disagree,Agree,5,3,2,4,1,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,5,4,2,Agree,Strongly Agree,Agree,Somewhat agree,Neither agree nor disagree,1,5,3,4,2,0,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,3,4,5,2,1,0,Somewhat Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Agree,1,5,4,3,2,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,1,3,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Neither agree nor disagree,1,3,2,4,5,0,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,4,1,5,3,1,Somewhat Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Agree,4,2,5,3,1,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,5,3,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,95,TRUE,100,FALSE,100,FALSE,50,TRUE,95,FALSE,100,TRUE,100,TRUE,100,TRUE,95,TRUE,100,TRUE,75,TRUE,85,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,FALSE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,80,FALSE,95,TRUE,100,TRUE,85,FALSE,100,TRUE,100,FALSE,100,TRUE,80,TRUE,100,31,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,1,0,-3,0,1,0,1,-1,-3,3,-2,2,-3,-2,-3,-3,-3,2,3,2,1,0,0,-3,0,1,0,2,0,-1,-3,3,-3,2,0,-3,-3,-3,-3,-3,1,1,3,2,1,0,0,-3,0,1,0,1,1,-1,-3,3,-3,2,0,-3,-3,-3,-3,-3,0,FALSE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,0,75,TRUE,0,85,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,95,TRUE,1,100,TRUE,0,85,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,80,TRUE,1,100,0,0,0,0,0,0,0.04,0,0,0,1,0,0.0025,0.5625,0.0025,0,0,0.25,0,0.0025,0,0.25,0.25,0,0,0.7225,0.04,0.0025,0,0,1,0.7225,0.173125,0.132678571,0.213571429,31,96.88,26,81.25,5,62.5,7,87.5,8,100,6,75,15,93.75,11,68.75,91.72,73.12,99.38,98.75,95.62,93.75,89.69,15.63,10.47,10.62,11.88,-1.25,20.62,0,20.94,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0.2,0.2,0.2,0.2,0,0.2,0.2,0.15,0.15,0.15,0,0.33,0.25,-0.2,0.2,0,0,0,0,-1,0,1,-0.33,0,1,2,-1,1,-2,2,-2,2,-1,1,1,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,63,,1.25,1,1,0,0,0,1,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,4,8,3,9,2,5,6,1,7,4,3,2,1 +97,R_5GlEaRuPX31tPTC,67 - 73,American,,American,Male,Agree,Agree,Disagree,Somewhat agree,Somewhat agree,5,3,2,4,1,Somewhat agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,2,4,5,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,1,2,3,5,4,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Disagree,Neither agree nor disagree,Somewhat agree,3,2,4,1,5,6,Somewhat agree,Disagree,Agree,Disagree,Agree,5,2,3,4,1,5,Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,5,4,1,2,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Disagree,Agree,Somewhat disagree,4,1,2,5,3,3,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,4,5,1,2,3,Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,2,5,1,4,6,Somewhat agree,Agree,Agree,Agree,Disagree,1,4,2,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,31,2,2,-2,1,1,1,-2,3,-3,3,2,-1,3,1,3,1,1,2,2,-2,2,2,-2,0,1,4,1,-2,2,-2,2,6,2,-1,2,1,2,5,1,1,1,1,-2,5,2,2,-2,2,-1,4,1,-2,1,-2,1,3,2,0,3,0,3,3,1,2,2,2,-2,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0.107142857,0,0.214285714,31,96.88,29,90.63,7,87.5,7,87.5,8,100,7,87.5,15,93.75,14,87.5,100,100,100,100,100,100,100,6.25,9.37,12.5,12.5,0,12.5,6.25,12.5,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,2,0,0,2,1,2,0,1,0,1,0,0,1,0,0,0,0.2,0.6,0.4,0.4,0.6,1,0.4,0.2,0.4,0.55,0.475,5,3.33,4.5,-0.4,-0.4,0,0.2,-0.266666667,0,3,2,-1,1.67,2,2,2,-2,2,1,-1,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),72,The survey was an interesting one. It would be nice to know what the outcome of this survey has.,1.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,7,6,5,2,3,4,8,1,9,2,4,3,1 +98,R_3ez3PwUo6gXjOzn,67 - 73,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,4,5,1,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,2,5,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Disagree,Strongly Agree,3,4,1,2,5,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,4,1,3,2,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,2,1,5,3,4,1,Somewhat Disagree,Somewhat Disagree,Agree,Disagree,Strongly Agree,3,4,5,2,1,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Agree,Somewhat agree,2,3,5,1,4,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,3,4,1,5,2,Somewhat Disagree,Somewhat Disagree,Agree,Disagree,Strongly agree,1,2,5,4,3,1,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,2,5,FALSE,100,TRUE,87,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,86,TRUE,100,FALSE,100,TRUE,100,TRUE,85,FALSE,100,TRUE,80,TRUE,100,TRUE,50,TRUE,90,TRUE,76,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,1,1,1,1,0,0,-1,1,-2,3,1,2,2,1,0,2,2,2,2,2,2,1,1,1,2,-1,1,-1,-1,2,-2,3,1,0,0,0,1,1,1,2,2,2,2,1,1,0,-1,1,0,-1,1,-1,-1,2,-2,3,2,1,2,1,1,1,1,FALSE,1,100,TRUE,1,87,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,85,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,50,TRUE,0,90,TRUE,0,76,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,1,0,0,0.0225,0.0196,0,0,0.0169,0,0.25,0,0,0,0.04,0.5776,0,0.25,0,1,0,0,0.81,0,1,0.187021429,0.111357143,0.262685714,26,81.25,24,75,5,62.5,6,75,7,87.5,6,75,15,93.75,9,56.25,92.31,84.88,85.62,98.75,100,96.12,88.5,6.25,17.31,22.38,10.62,11.25,25,2.37,32.25,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,2,2,0,1,0,0,0,0,1,1,2,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0.4,0.4,1.2,0.2,1,0.4,0.4,0.5,0.5,0.5,1.33,1.33,1.25,-0.2,-0.6,0,0.8,-0.266666667,1,0,-1,0,0,2,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,72,,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,9,5,3,6,7,4,8,1,2,3,2,4,1 +99,R_76hSlL9MwQGDYBQ,67 - 73,American,,American,Female,Strongly agree,Agree,Agree,Strongly agree,Agree,1,3,2,5,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly agree,Neither agree nor disagree,3,5,2,4,1,Strongly Agree,Agree,Agree,Somewhat Disagree,Agree,5,1,3,4,2,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,3,1,5,4,2,Agree,Agree,Agree,Agree,Agree,3,4,5,2,1,5,Neither agree nor disagree,Somewhat disagree,Agree,Agree,Somewhat agree,4,5,1,2,3,6,Strongly Agree,Agree,Somewhat Agree,Strongly Disagree,Agree,5,3,4,2,1,6,Strongly disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,4,2,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,7,Somewhat disagree,Somewhat disagree,Agree,Agree,Somewhat disagree,4,3,1,2,5,5,Strongly Agree,Agree,Agree,Strongly Disagree,Agree,2,4,5,1,3,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,4,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,72,TRUE,100,TRUE,72,FALSE,57,TRUE,63,TRUE,72,FALSE,55,TRUE,72,TRUE,55,TRUE,84,FALSE,52,FALSE,51,FALSE,53,TRUE,56,FALSE,51,TRUE,84,FALSE,55,TRUE,76,TRUE,63,TRUE,73,TRUE,51,TRUE,88,FALSE,51,TRUE,62,TRUE,73,FALSE,55,FALSE,53,TRUE,55,FALSE,55,TRUE,53,TRUE,61,18,3,2,2,3,2,0,0,2,3,0,3,2,2,-1,2,-2,-1,-1,-1,-3,2,2,2,2,2,5,0,-1,2,2,1,6,3,2,1,-3,2,6,-3,-2,0,0,-3,5,2,2,2,2,2,7,-1,-1,2,2,-1,5,3,2,2,-3,2,6,-3,-3,-3,-3,-3,6,TRUE,0,61,TRUE,1,53,FALSE,1,55,TRUE,0,55,FALSE,0,53,FALSE,1,55,TRUE,1,73,TRUE,1,62,FALSE,0,51,TRUE,1,88,TRUE,0,51,TRUE,0,73,TRUE,1,63,TRUE,0,76,FALSE,0,55,TRUE,1,84,FALSE,1,51,TRUE,0,56,FALSE,1,53,FALSE,1,51,FALSE,0,52,TRUE,1,84,TRUE,0,55,TRUE,1,72,FALSE,1,55,TRUE,1,72,TRUE,0,63,FALSE,1,57,TRUE,0,72,TRUE,1,100,TRUE,1,72,TRUE,1,100,0.1444,0.0784,0.0256,0.0729,0,0.2025,0.0784,0.0144,0.2401,0.0256,0,0.1369,0.2601,0.2601,0.2809,0.2209,0.3025,0.3025,0.1849,0.2025,0.2704,0.3025,0.2209,0.5776,0.2401,0.3969,0.0784,0.3721,0.2025,0.3136,0.5184,0.5329,0.240664286,0.166064286,0.315264286,18,56.25,19,59.38,3,37.5,4,50,5,62.5,7,87.5,12,75,7,43.75,64.78,56.62,62.62,70.62,69.25,70.88,58.69,-3.13,5.4,19.12,12.62,8.12,-18.25,-4.12,14.94,1,0,0,1,0,0,1,0,1,1,0,0,1,2,0,1,1,1,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,2,0,1,2,2,2,0,0.4,0.6,0.6,0.8,0.4,0.8,0.4,1.4,0.6,0.75,0.675,5.67,6,5.75,0,-0.2,0.2,-0.6,0,-2,1,0,-1,-0.33,0,0,0,-1,1,1,-1,1,-1,0,0,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,9,6,5,7,8,2,4,1,3,3,2,4,1 +100,R_7MXrK9TJaqNt8nC,60 - 66,American,,American,Female,Somewhat agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,5,4,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,2,3,5,4,Somewhat Agree,Strongly Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,5,1,4,2,3,Agree,Agree,Agree,Agree,Agree,3,4,2,5,1,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,2,3,4,5,1,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,1,4,2,3,5,2,Agree,Disagree,Somewhat Agree,Somewhat Agree,Agree,5,2,3,1,4,3,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,2,Somewhat agree,Disagree,Agree,Disagree,Agree,3,1,4,5,2,2,Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,4,5,3,1,2,2,Agree,Agree,Agree,Agree,Agree,4,2,3,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,65,TRUE,64,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,86,FALSE,100,FALSE,100,FALSE,100,TRUE,93,TRUE,100,FALSE,86,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,82,TRUE,92,TRUE,92,TRUE,95,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,0,0,1,-1,2,-2,1,1,-3,1,0,3,2,2,2,2,2,2,2,2,0,1,2,1,-2,2,-2,1,2,2,-2,1,1,2,3,2,2,2,2,2,3,2,2,2,0,0,2,1,-2,2,-2,2,2,2,-2,2,0,2,2,2,2,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,65,TRUE,0,64,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,86,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,93,TRUE,0,100,FALSE,0,86,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,82,TRUE,0,92,TRUE,1,92,TRUE,1,95,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0.0064,0.0049,0.0196,0,0,0,0,0.4096,0.0324,0,0,0.7396,0,1,0,0,0.0025,0,0.4225,1,0.8464,0,0.195853571,0.102892857,0.288814286,26,81.25,25,78.13,6,75,7,87.5,5,62.5,7,87.5,14,87.5,11,68.75,95.47,91.38,98.12,100,92.38,97,93.94,3.12,17.34,16.38,10.62,37.5,4.88,9.5,25.19,1,0,0,0,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,1,0,0,0,0,0,0.4,0.2,0.8,0,0.2,0.4,0.8,0,0.35,0.35,0.35,2.33,2,2.25,0.2,-0.2,0,0,0,0,0,1,1,0.33,1,1,0,-2,2,-1,1,0,0,-2,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,64,I do not have any feedback at this time.,0.875,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,2,6,8,9,4,3,7,1,5,4,2,3,1 +101,R_57D1Mby93xoTCpW,67 - 73,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,2,1,4,3,Somewhat disagree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat agree,3,5,4,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,3,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly disagree,5,4,1,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,3,4,2,1,3,Somewhat disagree,Strongly disagree,Strongly agree,Agree,Somewhat agree,5,1,3,2,4,3,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,1,5,2,3,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,2,3,4,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,1,5,3,4,2,3,Somewhat disagree,Strongly disagree,Strongly agree,Disagree,Neither agree nor disagree,4,2,1,3,5,2,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,3,1,5,2,4,2,Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly disagree,1,4,2,5,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,60,TRUE,100,FALSE,60,FALSE,55,FALSE,60,FALSE,55,TRUE,100,TRUE,100,TRUE,65,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,100,FALSE,55,TRUE,70,FALSE,55,TRUE,100,FALSE,100,FALSE,55,TRUE,55,TRUE,55,TRUE,100,TRUE,55,FALSE,55,TRUE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,100,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,0,3,-1,-3,3,1,1,3,3,3,0,3,3,3,3,2,-3,3,3,3,2,3,3,-1,-3,3,2,1,3,3,1,3,1,3,3,1,0,0,1,1,8,3,3,3,3,0,3,-1,-3,3,-2,0,2,3,1,3,-2,3,2,2,0,3,3,-3,7,FALSE,1,60,TRUE,1,100,FALSE,1,60,FALSE,1,55,FALSE,0,60,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,55,TRUE,0,70,FALSE,1,55,TRUE,0,100,FALSE,0,100,FALSE,0,55,TRUE,0,55,TRUE,1,55,TRUE,0,100,TRUE,1,55,FALSE,1,55,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0.2025,0,0,0,0.2025,0.2025,0,1,0.3025,0,0,0.1225,1,0.36,0,0.3025,0.2025,1,1,1,0.3025,0.2025,1,0.2025,0.2025,0.3025,0.16,0.16,0.49,1,1,0.418482143,0.263928571,0.573035714,15,46.88,18,56.25,5,62.5,4,50,4,50,5,62.5,11,68.75,7,43.75,78.75,67.5,78.12,80,89.38,81.25,76.25,-9.37,22.5,5,28.12,30,26.88,12.5,32.5,1,0,0,2,0,0,0,0,1,0,0,2,0,1,0,2,3,3,1,4,1,0,0,3,3,0,0,0,3,1,0,2,0,2,0,1,3,0,1,0,0.6,0.2,0.6,2.6,1.4,0.8,0.8,1,1,1,1,3,2.33,3.875,-0.8,-0.6,-0.2,1.6,-0.533333333,0,1,1,1,0.67,0,1,1,0,0,2,-2,0,0,-1,1,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),72,I enjoyed the survey. It really made me think of how life changes over time.,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,4,9,6,8,2,3,5,1,7,2,4,3,1 +102,R_1oyJxsrxJj0tKUF,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Neither agree nor disagree,Agree,Agree,Agree,3,4,5,2,1,Disagree,Somewhat agree,Strongly agree,Disagree,Neither agree nor disagree,1,5,2,4,3,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,3,1,5,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,4,1,2,Somewhat agree,Neither agree nor disagree,Agree,Agree,Agree,4,5,1,2,3,9,Disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,1,5,3,2,4,9,Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,4,2,5,1,3,9,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,2,3,1,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,1,5,2,3,4,6,Strongly disagree,Somewhat agree,Agree,Disagree,Disagree,1,4,3,5,2,7,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,2,1,3,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,5,1,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,70,TRUE,80,FALSE,53,FALSE,56,FALSE,50,TRUE,93,TRUE,60,TRUE,98,TRUE,50,TRUE,77,TRUE,75,FALSE,100,TRUE,64,TRUE,92,FALSE,53,TRUE,100,FALSE,55,TRUE,91,TRUE,100,TRUE,99,TRUE,71,TRUE,66,TRUE,82,TRUE,100,TRUE,100,FALSE,54,TRUE,50,FALSE,50,TRUE,84,FALSE,50,TRUE,65,20,1,0,2,2,2,-2,1,3,-2,0,2,0,3,-1,3,0,1,1,1,-1,1,0,2,2,2,9,-2,1,3,-2,1,9,2,0,3,-2,3,9,0,-1,1,1,-2,7,1,1,3,3,-1,6,-3,1,2,-2,-2,7,2,0,3,-3,3,8,0,0,0,1,-1,5,TRUE,0,65,FALSE,0,50,TRUE,0,84,FALSE,1,50,TRUE,1,50,FALSE,1,54,TRUE,1,100,TRUE,1,100,TRUE,1,82,TRUE,1,66,TRUE,0,71,TRUE,0,99,TRUE,1,100,TRUE,0,91,FALSE,0,55,TRUE,1,100,FALSE,1,53,TRUE,0,92,TRUE,0,64,FALSE,1,100,TRUE,1,75,TRUE,1,77,TRUE,0,50,TRUE,1,98,TRUE,0,60,TRUE,1,93,FALSE,1,50,FALSE,1,56,FALSE,1,53,TRUE,1,80,TRUE,1,70,TRUE,1,96,0,0.0049,0,0,0.0016,0.2116,0.0004,0.1156,0,0.0529,0.04,0,0.0324,0.5041,0.25,0.25,0.25,0.25,0.1936,0.36,0.0625,0.3025,0.4096,0.8281,0.2209,0.25,0.09,0.4225,0.7056,0.8464,0.2209,0.9801,0.280403571,0.1399,0.420907143,20,62.5,21,65.63,4,50,7,87.5,4,50,6,75,14,87.5,7,43.75,74.5,61.5,66.38,80.5,89.62,80.75,68.25,-3.13,8.87,11.5,-21.12,30.5,14.62,-6.75,24.5,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,2,0,0,1,0,1,1,1,3,1,0,1,0,2,0,0,0,2,0,0,1,1,0,0,0,0.2,0.2,0.6,1.2,0.8,0.4,0.4,0.25,0.7,0.475,9,7,7.5,-1.2,-0.6,-0.2,0.2,-0.666666667,3,2,1,2,2,1,1,2,-2,2,0,0,-1,1,-1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,72,,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,5,7,9,2,6,4,3,1,8,2,3,4,1 +103,R_3cBpKskAvNb0wUN,67 - 73,American,,American,Male,Strongly agree,Somewhat agree,Agree,Agree,Agree,2,1,4,5,3,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat disagree,4,5,2,3,1,Somewhat Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Disagree,4,5,1,2,3,Agree,Somewhat agree,Agree,Agree,Somewhat agree,3,4,5,2,1,Strongly Agree,Agree,Agree,Agree,Somewhat agree,3,1,2,4,5,7,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,3,2,4,1,6,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,2,4,6,Neither agree nor disagree,Somewhat agree,Agree,Agree,Somewhat agree,3,4,1,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly Agree,Somewhat agree,2,4,1,3,5,6,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,4,3,2,5,1,6,Neither Agree nor Disagree,Strongly Agree,Agree,Somewhat Agree,Disagree,3,5,2,1,4,3,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,3,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,65,TRUE,100,FALSE,82,FALSE,100,TRUE,69,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,76,TRUE,92,FALSE,100,TRUE,87,FALSE,92,FALSE,71,TRUE,100,TRUE,76,TRUE,100,FALSE,100,FALSE,100,FALSE,86,FALSE,100,TRUE,59,TRUE,100,TRUE,91,FALSE,97,FALSE,91,FALSE,87,TRUE,86,TRUE,100,FALSE,92,24,3,1,2,2,2,-2,0,3,1,-1,1,3,1,1,-2,2,1,2,2,1,3,2,2,2,1,7,1,1,-1,0,-1,6,1,-1,1,0,1,6,0,1,2,2,1,5,3,2,2,3,1,6,-3,1,2,1,-1,6,0,3,2,1,-2,3,1,2,0,0,1,8,FALSE,1,92,TRUE,1,100,TRUE,0,86,FALSE,1,87,FALSE,0,91,FALSE,1,97,TRUE,1,91,TRUE,1,100,TRUE,1,59,FALSE,0,100,FALSE,1,86,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,71,FALSE,1,92,TRUE,0,87,FALSE,1,100,TRUE,1,92,TRUE,1,76,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,69,FALSE,1,100,FALSE,1,82,TRUE,1,100,TRUE,1,65,TRUE,1,100,0,0,0,0.0081,0,0.0009,0,1,0,0.0576,0,1,0.1681,0.0196,0.8281,0,0,0.0169,0,1,0.0064,0.0576,0.7569,1,0.0841,0.4761,0.1225,0.0064,0.7396,0.0064,0.0324,0,0.263557143,0.2208,0.306314286,24,75,24,75,6,75,6,75,5,62.5,7,87.5,13,81.25,11,68.75,90.59,78.62,91.62,93.88,98.25,90.62,90.56,0,15.59,3.62,16.62,31.38,10.75,9.37,21.81,0,1,0,0,1,3,1,4,1,0,0,4,0,1,3,2,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,0,1,0,0,1,1,2,2,0,0.4,1.8,1.6,0.4,0.6,0.6,0.4,1.2,1.05,0.7,0.875,6.33,5,5.875,-0.2,1.2,1.2,-0.8,0.733333333,1,0,3,-3,1.33,1,1,1,-1,1,1,-1,-1,1,-1,1,0,10 cents,25 minutes,24 days,Male,University - Graduate (Masters),67,,0.625,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,2,7,8,4,3,9,6,1,5,4,3,2,1 +104,R_35WTDTUYDDCHJhT,67 - 73,American,,American,Male,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,5,2,4,3,1,Agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,1,5,4,3,2,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Agree,5,4,2,3,1,2,Agree,Somewhat agree,Strongly agree,Strongly disagree,Agree,1,5,2,4,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,4,3,1,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Agree,3,2,5,4,1,2,Somewhat agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,5,3,2,1,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,4,1,3,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,4,3,FALSE,64,TRUE,100,FALSE,100,FALSE,53,TRUE,52,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,52,TRUE,100,FALSE,100,FALSE,100,FALSE,66,FALSE,100,TRUE,62,TRUE,94,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,61,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,0,3,2,2,1,3,-3,1,3,2,3,1,3,1,1,1,1,1,3,3,-2,3,2,2,2,1,3,-3,2,2,3,3,3,2,3,2,1,1,1,1,1,2,3,3,-2,3,2,1,1,1,3,-3,1,2,3,3,3,1,3,1,0,0,1,1,1,2,FALSE,1,64,TRUE,1,100,FALSE,1,100,FALSE,1,53,TRUE,1,52,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,66,FALSE,1,100,TRUE,1,62,TRUE,1,94,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,61,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0036,0,0,0,0,0.2304,0,0,0.2209,0,0,0.1444,0.2304,0.1156,0,0,0.1521,0,0.1296,0,0,1,0,0.079535714,0.032492857,0.126578571,29,90.63,31,96.88,8,100,7,87.5,8,100,8,100,16,100,15,93.75,90.75,79,89.25,94.75,100,91.25,90.25,-6.25,-6.13,-21,1.75,-5.25,0,-8.75,-3.5,0,0,2,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0.4,0.2,0.4,0,0.4,0.2,0.2,0.4,0.25,0.3,0.275,2,1.33,1.75,0,0,0.2,-0.4,0.066666667,1,0,1,0,0.67,1,1,1,-1,1,2,-2,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),71,I enjoyed this survey. It was more like a fun test involving trivia,0.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,7,2,3,6,8,5,4,1,9,4,2,3,1 +105,R_6ZaZJqHovVAvk1r,60 - 66,,Canadian,Canadian,Male,Agree,Somewhat agree,Agree,Disagree,Strongly agree,4,2,5,1,3,Disagree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,3,4,1,2,5,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,1,2,5,Agree,Agree,Strongly Agree,Agree,Somewhat agree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Strongly Agree,Agree,Strongly disagree,Agree,4,3,1,2,5,5,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,4,2,3,1,5,4,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,4,2,3,5,3,Agree,Strongly Agree,Agree,Somewhat agree,Agree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Somewhat disagree,Agree,Agree,Neither agree nor disagree,2,5,4,1,3,3,Somewhat disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,1,3,5,4,4,Agree,Strongly agree,Neither Agree nor Disagree,Agree,Somewhat Agree,2,3,5,4,1,4,Agree,Somewhat disagree,Agree,Strongly Agree,Agree,3,1,5,2,4,TRUE,100,TRUE,86,TRUE,86,FALSE,50,TRUE,98,FALSE,100,TRUE,100,TRUE,96,FALSE,50,TRUE,92,FALSE,63,TRUE,81,FALSE,80,TRUE,100,FALSE,66,TRUE,100,TRUE,50,TRUE,100,FALSE,59,FALSE,100,FALSE,59,TRUE,91,FALSE,92,TRUE,60,FALSE,100,TRUE,85,FALSE,60,TRUE,88,FALSE,70,TRUE,87,TRUE,94,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,-2,3,-2,-3,3,-2,1,3,3,2,0,1,2,2,3,2,1,0,3,2,-3,2,2,0,-2,3,-3,1,5,3,3,2,0,2,4,2,3,2,1,2,3,2,-1,2,2,0,3,-1,-2,2,-1,0,3,2,3,0,2,1,4,2,-1,2,3,2,4,TRUE,0,100,TRUE,1,86,TRUE,0,86,FALSE,1,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,96,FALSE,0,50,TRUE,1,92,FALSE,1,63,TRUE,0,81,FALSE,0,80,TRUE,0,100,FALSE,0,66,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,59,FALSE,1,100,FALSE,0,59,TRUE,1,91,FALSE,1,92,TRUE,1,60,FALSE,1,100,TRUE,1,85,FALSE,1,60,TRUE,0,88,FALSE,1,70,TRUE,1,87,TRUE,1,94,TRUE,1,100,0.0016,0.0225,0,0,0,0,0.16,0.0064,0,0.0081,0.0169,0.64,0.25,0.1369,0.0004,0.0196,0.0064,0.25,0.7744,0,0.3481,0.4356,0.1681,1,0.25,0.16,0.0036,1,0.7396,1,0.09,0.6561,0.290007143,0.106764286,0.47325,23,71.88,21,65.63,6,75,5,62.5,5,62.5,5,62.5,12,75,9,56.25,82.59,66,81.12,96,87.25,84,81.19,6.25,16.96,-9,18.62,33.5,24.75,9,24.94,2,2,0,1,1,2,1,0,1,0,0,0,0,0,1,0,1,1,1,1,0,2,0,4,3,1,1,1,1,1,1,0,2,2,0,0,3,1,1,1,1.2,0.8,0.2,0.8,1.8,1,1,1.2,0.75,1.25,1,3.67,3.33,3.5,-0.6,-0.2,-0.8,-0.4,-0.533333333,-1,2,0,-1,0.34,1,2,1,-2,2,0,0,1,-1,-2,2,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,66,Very interesting and well done!!,0.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,6,8,4,5,7,2,3,1,9,3,4,2,1 +106,R_77lKBxK1DWYlmSQ,60 - 66,American,,American,Female,Strongly agree,Agree,Agree,Somewhat disagree,Strongly agree,3,1,4,2,5,Somewhat disagree,Disagree,Agree,Neither agree nor disagree,Somewhat disagree,5,4,2,1,3,Strongly Agree,Agree,Agree,Disagree,Agree,2,5,4,1,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,2,5,3,4,1,Strongly Agree,Strongly Agree,Agree,Disagree,Strongly Agree,1,4,3,2,5,1,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,4,1,3,5,4,Strongly Agree,Agree,Agree,Disagree,Agree,1,5,2,3,4,1,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,2,5,3,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat disagree,Strongly Agree,Agree,Somewhat disagree,5,2,3,4,1,6,Disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,3,4,1,2,1,Strongly Agree,Strongly Agree,Agree,Disagree,Agree,5,3,1,2,4,3,Disagree,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,2,3,4,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,56,TRUE,100,FALSE,99,TRUE,52,TRUE,69,FALSE,100,TRUE,100,TRUE,99,TRUE,60,TRUE,71,FALSE,99,TRUE,100,TRUE,95,TRUE,96,FALSE,51,TRUE,99,FALSE,63,FALSE,100,TRUE,60,FALSE,100,TRUE,55,TRUE,92,FALSE,89,TRUE,100,FALSE,89,TRUE,96,TRUE,58,FALSE,99,TRUE,96,TRUE,93,TRUE,51,TRUE,100,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-1,3,-1,-2,2,0,-1,3,2,2,-2,2,-3,0,0,1,-2,3,3,2,-2,3,1,-2,-2,1,0,-1,4,3,2,2,-2,2,1,-2,-1,-1,-1,-1,4,2,-1,3,2,-1,6,-2,-2,1,-1,-1,1,3,3,2,-2,2,3,-2,-2,-1,0,-2,3,TRUE,0,56,TRUE,1,100,FALSE,1,99,TRUE,0,52,TRUE,1,69,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,60,TRUE,1,71,FALSE,1,99,TRUE,0,100,TRUE,1,95,TRUE,0,96,FALSE,0,51,TRUE,1,99,FALSE,1,63,FALSE,1,100,TRUE,0,60,FALSE,1,100,TRUE,1,55,TRUE,1,92,FALSE,1,89,TRUE,1,100,FALSE,1,89,TRUE,1,96,TRUE,0,58,FALSE,1,99,TRUE,0,96,TRUE,1,93,TRUE,1,51,TRUE,1,100,0.0001,0.0016,0.0001,0,0,0,0,0.0841,0,0.0064,0.0049,0.0025,0.16,0.0001,0.0961,0,0.0121,0.2704,0.0001,0.0121,0.2025,0.2601,0.36,0.9216,0.1369,0.3364,0.2401,0.3136,0.0001,0,0.9216,1,0.190775,0.045471429,0.336078571,18,56.25,24,75,4,50,7,87.5,6,75,7,87.5,15,93.75,9,56.25,83.97,66.38,83.38,87.5,98.62,83.19,84.75,-18.75,8.97,16.38,-4.12,12.5,11.12,-10.56,28.5,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,1,1,2,1,1,3,1,3,4,1,0,1,1,0,0,1,0,0,0,1,2,1,1,0,0.4,0.4,0,1.2,2.4,0.6,0.2,1,0.5,1.05,0.775,2,3.33,2.875,-2,-0.2,-0.2,0.2,-0.8,-5,3,-2,1,-1.33,0,1,1,-1,1,0,0,2,-2,-1,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,8,5,6,4,9,7,3,1,2,2,4,3,1 +107,R_3zM72bExBqJJK2n,60 - 66,American,,American,Male,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,3,2,Agree,Disagree,Agree,Somewhat disagree,Agree,2,1,3,5,4,Somewhat Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,3,1,4,Agree,Agree,Strongly Agree,Strongly Agree,Agree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,4,2,5,1,3,9,Agree,Disagree,Agree,Disagree,Strongly agree,2,5,3,4,1,9,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,1,3,2,4,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,2,3,4,5,9,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,5,4,2,1,3,9,Somewhat Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,1,2,4,3,9,Somewhat agree,Agree,Agree,Agree,Agree,1,5,3,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,98,TRUE,100,TRUE,93,FALSE,100,TRUE,88,TRUE,100,FALSE,100,TRUE,97,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,82,FALSE,100,FALSE,100,TRUE,100,TRUE,68,TRUE,93,TRUE,98,TRUE,100,FALSE,100,TRUE,77,TRUE,90,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,57,FALSE,100,TRUE,100,TRUE,72,28,3,2,3,3,3,2,-2,2,-1,2,1,2,3,0,3,2,2,3,3,2,3,2,3,0,3,8,2,-2,2,-2,3,9,1,2,2,0,3,9,1,1,2,1,1,8,3,2,3,3,2,7,1,0,2,-1,1,9,1,3,3,0,3,9,1,2,2,2,2,9,TRUE,0,72,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,77,FALSE,1,100,TRUE,0,100,TRUE,1,98,TRUE,0,93,TRUE,1,68,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,82,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,98,TRUE,1,100,0,0,0,0,0,0,0.0009,0.0529,0,0,0,0.0004,0.01,0,0,0,0,0.1849,0,0,0,0.1024,0.6724,0.8649,0,0.7744,0.0004,0.5184,0,0,0.8649,1,0.180246429,0.017792857,0.3427,28,87.5,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,94.16,85.38,98.88,92.75,99.62,95.5,92.81,6.25,12.91,10.38,11.38,17.75,12.12,-4.5,30.31,0,0,0,3,0,0,0,0,1,1,0,0,1,0,0,1,1,1,2,1,0,0,0,0,1,1,2,0,0,1,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.2,1.2,0.2,0.8,0.2,0.6,0.6,0.45,0.525,8.67,8.33,8.5,0.4,-0.4,0,0.6,-1.85E-17,1,0,0,-1,0.34,1,2,1,-2,2,0,0,-1,1,-2,2,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),66,,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,2,3,9,4,8,5,6,1,7,2,4,3,1 +108,R_6S66IPNS1Xsnw0d,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,4,1,5,2,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,2,3,5,4,1,Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,4,2,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,4,2,1,5,3,Somewhat agree,Agree,Somewhat agree,Disagree,Somewhat agree,3,5,1,2,4,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,1,3,4,4,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,3,5,1,4,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,1,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,1,4,2,3,5,6,Disagree,Agree,Disagree,Somewhat agree,Disagree,4,3,2,5,1,6,Agree,Somewhat Disagree,Somewhat Agree,Disagree,Agree,1,2,4,5,3,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,1,3,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,66,FALSE,55,FALSE,64,FALSE,50,TRUE,72,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,55,TRUE,100,FALSE,100,FALSE,50,FALSE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,100,FALSE,75,TRUE,100,TRUE,76,TRUE,100,TRUE,78,FALSE,100,TRUE,76,TRUE,50,FALSE,100,TRUE,100,FALSE,100,24,1,1,1,-1,-1,-1,1,-1,0,-1,2,-1,2,-1,2,1,1,1,2,-1,1,2,1,-2,1,4,0,-1,1,-1,1,4,2,1,2,1,2,2,-1,-1,0,1,-1,6,1,1,1,0,-2,6,-2,2,-2,1,-2,6,2,-1,1,-2,2,3,-1,0,-1,1,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,76,FALSE,1,100,TRUE,1,78,TRUE,1,100,TRUE,1,76,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,55,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,72,FALSE,1,50,FALSE,1,64,FALSE,0,55,TRUE,1,66,TRUE,1,100,0,0,0,0.0484,0,0,0,0,0,0.2025,0.3025,0,0.0576,0.0625,0.0576,0,0,0.25,0.25,0,0,0.25,0.25,0,0,0.5184,0.1156,0,0,0,0.1296,0,0.087367857,0.066621429,0.108114286,24,75,29,90.63,6,75,8,100,8,100,7,87.5,15,93.75,14,87.5,84.91,67.38,92.5,91.62,88.12,84.75,85.06,-15.63,-5.72,-7.62,-7.5,-8.38,0.62,-9,-2.44,0,1,0,1,2,1,2,2,1,2,0,2,0,2,0,2,2,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,0,2,1,2,1,0,0.8,1.6,0.8,1.2,0.4,1,0.4,1.2,1.1,0.75,0.925,3.33,5,4.5,0.4,0.6,0.4,0,0.466666667,-2,-2,-1,1,-1.67,1,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),69,Some of the questions were strangely worded.,1.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,8,3,5,7,6,4,1,9,2,3,4,1 +109,R_7d3QuMhkCxFlQ42,60 - 66,,Canadian,Canadian,Female,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,5,4,2,3,1,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,3,2,5,4,1,Agree,Disagree,Agree,Somewhat Agree,Strongly Agree,1,2,4,3,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Agree,4,3,1,5,2,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,3,1,2,4,5,1,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,1,3,4,2,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,5,3,4,1,3,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,2,1,5,3,2,Agree,Somewhat Disagree,Agree,Somewhat Agree,Strongly agree,5,2,1,4,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,2,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,91,TRUE,100,FALSE,92,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,90,TRUE,98,TRUE,100,FALSE,71,FALSE,62,TRUE,97,FALSE,95,TRUE,99,FALSE,62,TRUE,92,TRUE,94,FALSE,94,FALSE,61,TRUE,100,TRUE,62,TRUE,73,TRUE,65,FALSE,82,TRUE,100,TRUE,59,FALSE,100,TRUE,100,FALSE,90,26,2,1,1,-1,2,-1,1,0,2,-1,2,-2,2,1,3,1,0,0,2,0,1,1,0,-1,2,1,-1,0,0,2,-1,1,2,-1,1,1,3,1,0,0,0,1,0,2,1,1,1,1,0,2,-1,1,0,1,0,3,2,-1,2,1,3,2,0,0,1,1,0,2,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,0,59,TRUE,1,100,FALSE,1,82,TRUE,1,65,TRUE,1,73,TRUE,1,62,TRUE,1,100,FALSE,1,61,FALSE,1,94,TRUE,1,94,TRUE,0,92,FALSE,0,62,TRUE,1,99,FALSE,1,95,TRUE,0,97,FALSE,1,62,FALSE,1,71,TRUE,1,100,TRUE,1,98,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,92,TRUE,0,100,TRUE,1,91,FALSE,0,50,TRUE,1,100,0.0729,0,0.0001,0.1225,0,0.0324,0,0,0.0841,0.0004,0.0081,0.0036,0.1444,0.1521,0,0,0.01,0.3481,0.0064,0,0,0.3844,0.1444,0.8464,0.0025,0,0.25,0.01,0,0.9409,1,0.0036,0.156135714,0.055942857,0.256328571,26,81.25,26,81.25,5,62.5,7,87.5,6,75,8,100,14,87.5,12,75,86.84,69.5,95.12,92.75,90,87.12,86.56,0,5.59,7,7.62,17.75,-10,-0.38,11.56,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,0,0,2,2,0,0,0,1,1,0,1,0,0,0,1,0,1,1,0,0.4,0.2,0.4,0.4,1,0.4,0.2,0.6,0.35,0.55,0.45,1,2.33,1.75,-0.6,-0.2,0.2,-0.2,-0.2,-1,-2,-1,0,-1.33,-1,2,2,-2,2,0,0,-1,1,-2,2,2,10 cents,100 minutes,47 days,Female,University - Undergraduate,64,Enjoyable,1.25,0,0,1,1,1,0,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,7,2,9,4,8,5,6,1,3,3,4,2,1 +110,R_5purQVlYG87drpx,39 - 45,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Agree,Strongly agree,5,3,2,1,4,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,5,2,1,4,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,5,1,3,Neither agree nor disagree,Agree,Agree,Somewhat agree,Strongly Agree,5,3,1,2,4,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,5,1,2,3,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,2,1,4,3,5,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,1,5,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Agree,Strongly Agree,2,4,5,1,3,2,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,5,1,2,3,4,3,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,3,5,2,1,4,3,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,3,5,4,1,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,90,TRUE,50,TRUE,100,TRUE,50,TRUE,50,FALSE,70,TRUE,90,TRUE,95,TRUE,50,TRUE,95,FALSE,65,TRUE,90,TRUE,80,TRUE,50,TRUE,50,TRUE,85,TRUE,50,TRUE,100,TRUE,70,TRUE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,95,TRUE,75,FALSE,50,FALSE,50,TRUE,50,TRUE,90,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,2,3,-2,-1,0,0,1,2,0,2,1,3,0,1,1,1,-1,0,2,2,1,3,2,-1,0,1,1,1,3,2,0,2,1,3,3,0,-1,1,1,-1,6,1,2,2,2,3,2,0,-1,1,0,2,3,2,1,2,0,3,3,2,1,2,2,-1,3,TRUE,0,90,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,70,TRUE,1,90,TRUE,1,95,TRUE,1,50,TRUE,1,95,FALSE,1,65,TRUE,0,90,TRUE,1,80,TRUE,0,50,TRUE,1,50,TRUE,1,85,TRUE,0,50,TRUE,0,100,TRUE,0,70,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,95,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.0025,0.0625,0.0225,0.01,0,0.09,0.25,0.0025,0.25,0.25,0.01,0.04,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.0025,1,0.25,0.49,0.25,0.25,0.25,0.25,0.81,1,1,0.25,0.81,0.325982143,0.161785714,0.490178571,16,50,17,53.13,5,62.5,4,50,4,50,4,50,12,75,5,31.25,70,54.38,68.75,80.62,76.25,72.5,67.5,-3.13,16.87,-8.12,18.75,30.62,26.25,-2.5,36.25,1,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,1,0,1,0,1,0,1,0,2,0,1,1,0,0.4,0.8,0,0.4,0,0.8,0.4,0.8,0.4,0.5,0.45,2.67,2.67,3.125,0.4,0,-0.4,-0.4,0,0,0,0,3,0,1,2,1,-2,2,1,-1,-1,1,-2,2,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),42,,1.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,6,4,3,2,8,5,9,1,7,2,4,3,1 +111,R_6O7c3GMsV8YPQkI,67 - 73,,Canadian,Canadian,Male,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Disagree,4,5,1,3,2,Disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat disagree,4,5,1,3,2,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Agree,5,1,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,2,1,4,5,3,2,Disagree,Disagree,Strongly agree,Somewhat disagree,Disagree,4,5,3,2,1,1,Agree,Disagree,Strongly Agree,Agree,Agree,2,5,4,3,1,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat disagree,Somewhat agree,Strongly Agree,Somewhat agree,Strongly disagree,5,4,3,1,2,1,Disagree,Disagree,Strongly agree,Disagree,Disagree,3,1,5,4,2,1,Agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Agree,2,3,4,5,1,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,4,1,FALSE,100,TRUE,75,FALSE,55,FALSE,55,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,60,FALSE,100,TRUE,50,TRUE,100,FALSE,60,TRUE,100,FALSE,100,TRUE,100,TRUE,60,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,1,2,0,-2,-2,-1,3,-1,-1,2,-1,3,1,2,0,0,2,2,0,-2,0,2,0,-2,2,-2,-2,3,-1,-2,2,2,-2,3,2,2,1,-1,0,1,0,0,3,-1,1,3,1,-3,1,-2,-2,3,-2,-2,1,2,0,3,1,2,1,0,0,1,1,1,1,FALSE,1,100,TRUE,1,75,FALSE,1,55,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,50,TRUE,0,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.25,0.25,0.16,0,0.0625,0,0.2025,0.25,0,0,0.36,0.36,1,0,1,1,0,0.2025,1,0,0,0.217767857,0.066071429,0.369464286,26,81.25,26,81.25,4,50,8,100,6,75,8,100,14,87.5,12,75,87.97,70,93.75,100,88.12,89.69,86.25,0,6.72,20,-6.25,25,-11.88,2.19,11.25,1,1,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,2,0,0,0,1,1,1,0,1,0,1,1,0,1,0,0,0,0,0,1,1,1,0.4,0.4,0.4,0.8,0.6,0.6,0.2,0.6,0.5,0.5,0.5,1.67,1,1.5,-0.2,-0.2,0.2,0.2,-0.066666667,1,1,0,2,0.67,1,1,2,-1,1,-1,1,-1,1,-2,2,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),70,,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,01DIR,7,8,6,4,3,2,5,1,9,3,2,4,1 +112,R_3paIdAavet2XfnF,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,4,5,1,3,2,Agree,Somewhat disagree,Agree,Disagree,Agree,3,4,1,2,5,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,5,1,3,2,4,Agree,Agree,Agree,Agree,Somewhat agree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,5,2,3,1,4,3,Agree,Disagree,Agree,Disagree,Somewhat agree,4,5,3,2,1,3,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,2,4,1,3,8,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,1,Agree,Strongly disagree,Agree,Disagree,Strongly agree,3,1,2,5,4,2,Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly agree,3,5,2,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,62,TRUE,100,FALSE,100,TRUE,100,TRUE,67,TRUE,100,TRUE,71,FALSE,100,TRUE,71,FALSE,77,TRUE,74,TRUE,100,TRUE,71,FALSE,100,TRUE,100,TRUE,100,FALSE,67,FALSE,100,TRUE,81,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,69,FALSE,100,TRUE,100,FALSE,71,26,3,3,2,2,3,2,-1,2,-2,2,2,0,2,1,3,2,2,2,2,1,3,3,2,2,3,5,2,-2,2,-2,1,3,2,0,3,1,3,3,1,1,2,-1,1,8,3,3,3,3,3,2,2,-3,2,-2,3,1,2,0,2,-2,3,2,3,3,3,3,2,2,FALSE,1,71,TRUE,1,100,FALSE,1,100,TRUE,0,69,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,81,FALSE,0,100,FALSE,1,67,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,74,FALSE,1,77,TRUE,0,71,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,67,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,62,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,1,0,0,0,0,0.0361,0.1089,0,0,0.4489,0.4761,0,0,0.0841,0.0841,0.5041,0,0.5476,0.3844,0,0.0841,0,0.0529,1,1,0.207546429,0.147857143,0.267235714,26,81.25,23,71.88,5,62.5,5,62.5,6,75,7,87.5,14,87.5,9,56.25,90.03,77.62,89,93.5,100,95.19,84.88,9.37,18.15,15.12,26.5,18.5,12.5,7.69,28.63,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,3,0,0,0,1,1,0,0,2,0,0,1,0,0,0,3,0,1,1,1,1,1,0,0.4,0.2,1,0.4,0.6,0.6,1,0.4,0.65,0.525,3.67,1.67,3.25,-0.4,-0.2,-0.4,0,-0.333333333,3,2,1,6,2,1,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,48,,1.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,3,9,2,6,4,5,8,1,7,3,2,4,1 +113,R_7LbZA9yEiDUHBsw,39 - 45,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Agree,Agree,4,5,3,1,2,Agree,Somewhat disagree,Strongly agree,Disagree,Disagree,5,2,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,4,3,5,1,Agree,Agree,Somewhat agree,Somewhat agree,Agree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,6,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,1,3,5,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,1,3,2,4,5,6,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,1,2,4,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,4,5,1,2,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,4,5,1,2,2,Somewhat agree,Somewhat agree,Agree,Agree,Agree,5,2,3,1,4,FALSE,50,TRUE,50,TRUE,57,FALSE,50,TRUE,50,FALSE,100,TRUE,86,TRUE,50,TRUE,50,TRUE,61,FALSE,50,TRUE,100,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,80,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,100,FALSE,50,FALSE,100,TRUE,84,FALSE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,2,2,-1,3,-2,-2,3,3,3,-3,3,2,2,1,1,2,3,3,3,3,3,5,3,-3,3,-3,0,6,3,3,3,-3,3,5,2,1,0,1,3,6,3,3,3,3,3,4,3,-3,3,-2,3,4,3,3,3,-3,3,2,1,1,2,2,2,2,FALSE,1,50,TRUE,1,50,TRUE,0,57,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,86,TRUE,1,50,TRUE,1,50,TRUE,1,61,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,80,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,84,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.0256,0.25,0.0196,0,0,0.25,0.1521,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.64,0.25,1,0.24525,0.171578571,0.318921429,16,50,23,71.88,6,75,7,87.5,7,87.5,3,37.5,13,81.25,10,62.5,63.06,50,68.75,70.12,63.38,61.31,64.81,-21.88,-8.82,-25,-18.75,-17.38,25.88,-19.94,2.31,1,0,0,1,1,1,2,0,1,2,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,2,0,0,5,0,0,0,0,0,1,1,1,1,0,0.6,1.2,0,0.6,0.6,1.6,0,0.8,0.6,0.75,0.675,5.33,3.33,4.25,0,-0.4,0,-0.2,-0.133333333,1,2,3,4,2,2,1,1,-1,1,2,-2,-1,1,-1,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),40,GREAT SURVEY,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,6,9,7,3,2,5,4,1,8,4,2,3,1 +114,R_3rqsHRxXmF3A9ah,60 - 66,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,3,1,5,2,4,Strongly disagree,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,4,5,3,1,2,Somewhat Agree,Agree,Strongly Agree,Disagree,Agree,3,5,4,2,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,5,1,3,4,Agree,Agree,Agree,Agree,Agree,2,5,4,3,1,0,Disagree,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,1,4,3,2,5,3,Somewhat Agree,Agree,Agree,Somewhat Disagree,Agree,1,2,5,4,3,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,4,2,1,5,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,3,1,2,4,5,0,Disagree,Neither agree nor disagree,Agree,Strongly agree,Somewhat disagree,1,5,3,2,4,1,Somewhat Agree,Agree,Agree,Disagree,Agree,2,1,5,4,3,0,Disagree,Disagree,Disagree,Somewhat disagree,Disagree,4,1,3,5,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,65,TRUE,54,FALSE,50,FALSE,50,TRUE,72,TRUE,55,TRUE,73,FALSE,64,TRUE,80,FALSE,50,FALSE,50,TRUE,63,TRUE,81,FALSE,50,TRUE,91,TRUE,54,TRUE,91,TRUE,58,TRUE,84,TRUE,66,TRUE,88,TRUE,66,TRUE,94,TRUE,93,TRUE,73,TRUE,83,TRUE,50,FALSE,100,TRUE,62,TRUE,70,16,2,2,2,2,2,-3,-1,1,2,0,1,2,3,-2,2,-1,-1,-1,1,-1,2,2,2,2,2,0,-2,-1,1,2,0,3,1,2,2,-1,2,1,-1,-1,-1,0,-1,2,2,2,2,2,2,0,-2,0,2,3,-1,1,1,2,2,-2,2,0,-2,-2,-2,-1,-2,1,TRUE,0,70,TRUE,1,62,FALSE,1,100,TRUE,0,50,TRUE,1,83,TRUE,0,73,TRUE,1,93,TRUE,1,94,TRUE,1,66,TRUE,1,88,TRUE,0,66,TRUE,0,84,TRUE,1,58,TRUE,0,91,TRUE,1,54,TRUE,1,91,FALSE,1,50,TRUE,0,81,TRUE,0,63,FALSE,1,50,FALSE,0,50,TRUE,1,80,FALSE,1,64,TRUE,1,73,TRUE,0,55,TRUE,1,72,FALSE,1,50,FALSE,1,50,TRUE,0,54,TRUE,1,65,FALSE,0,50,TRUE,1,100,0.0036,0.0784,0.0081,0.0049,0,0.5329,0.0729,0.0144,0.25,0.04,0.1225,0.1764,0.1156,0.4356,0.0289,0.1444,0.1296,0.25,0.25,0.3025,0.25,0.2116,0.3969,0.8281,0.25,0.25,0.25,0.49,0,0.6561,0.2916,0.7056,0.265914286,0.165228571,0.3666,16,50,20,62.5,4,50,5,62.5,4,50,7,87.5,14,87.5,6,37.5,69.69,57.62,66.5,78.75,75.88,73.69,65.69,-12.5,7.19,7.62,4,28.75,-11.62,-13.81,28.19,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,1,0,0,1,1,1,2,1,0,0.2,0.4,0.2,0,1,0.2,1.2,0.2,0.6,0.4,1.33,0.33,1,0,-0.8,0.2,-1,-0.2,0,2,1,1,1,1,1,0,-2,2,1,-1,1,-1,-1,1,-1,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,"This was a different survey for sure, and interesting. It kept my full attention throughout. :D",0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,7,2,3,9,5,8,6,1,4,4,2,3,1 +115,R_77kGdbqP662k2Ou,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Disagree,Neither agree nor disagree,2,3,5,4,1,Disagree,Disagree,Agree,Disagree,Somewhat disagree,4,5,3,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,5,4,1,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat disagree,2,5,3,4,1,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Somewhat agree,5,1,2,4,3,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Disagree,3,2,4,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,3,5,1,2,0,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,1,4,3,2,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Neither agree nor disagree,5,1,2,3,4,0,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Strongly disagree,1,4,5,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,4,1,5,0,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,2,1,3,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,TRUE,92,FALSE,50,FALSE,50,FALSE,96,TRUE,100,TRUE,100,TRUE,50,FALSE,85,FALSE,50,FALSE,91,FALSE,65,TRUE,76,FALSE,50,TRUE,100,FALSE,60,FALSE,92,TRUE,77,FALSE,83,TRUE,54,TRUE,92,FALSE,94,TRUE,50,TRUE,80,TRUE,75,FALSE,57,FALSE,94,TRUE,50,TRUE,92,FALSE,50,TRUE,73,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,-2,0,-2,-2,2,-2,-1,3,3,3,0,3,1,3,1,3,-1,3,3,1,-2,1,0,-3,-3,3,-3,-2,2,3,3,3,-2,3,0,1,3,3,3,-1,0,3,3,1,-2,0,0,-3,-3,3,-2,-3,1,3,3,3,-3,3,0,-1,0,1,2,-1,4,FALSE,1,100,FALSE,0,100,TRUE,0,92,FALSE,1,50,FALSE,0,50,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,85,FALSE,1,50,FALSE,1,91,FALSE,0,65,TRUE,0,76,FALSE,0,50,TRUE,1,100,FALSE,1,60,FALSE,1,92,TRUE,0,77,FALSE,1,83,TRUE,1,54,TRUE,1,92,FALSE,1,94,TRUE,1,50,TRUE,0,80,TRUE,1,75,FALSE,1,57,FALSE,1,94,TRUE,0,50,TRUE,1,92,FALSE,0,50,TRUE,1,73,0,0.0625,0,0,0.0729,0.0016,0.25,0.7225,0.0289,0.0064,0.0064,0.4225,0.25,0.25,0.25,1,0.0036,0.25,0.0036,0.64,0.2116,0.25,0.5929,0.5776,0.16,0.1849,0.25,0,0.8464,0.0064,0.25,0.0081,0.267725,0.251057143,0.284392857,22,68.75,21,65.63,4,50,5,62.5,5,62.5,7,87.5,10,62.5,11,68.75,75.88,60.5,67.75,87.5,87.75,74.12,77.62,3.12,10.25,10.5,5.25,25,0.25,11.62,8.87,0,0,0,0,1,1,1,1,1,1,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,1,1,1,0,2,0,0,0,3,0,2,3,0,1,0,0.2,1,0.4,0.4,0,1,0.6,1.2,0.5,0.7,0.6,0.67,0.33,0.875,0.2,0,-0.2,-0.8,0,0,1,0,-4,0.34,1,0,0,-2,2,1,-1,-1,1,0,0,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,54,I would’ve liked to have seen my score,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,4,2,7,5,9,6,8,1,3,2,4,3,1 +116,R_32l0Zm7J87O1e4G,60 - 66,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,1,2,4,5,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Agree,1,3,2,5,4,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,2,3,1,4,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Somewhat disagree,1,2,3,4,5,Agree,Somewhat agree,Somewhat disagree,Agree,Strongly Agree,3,2,1,4,5,7,Agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,1,5,4,2,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,2,1,5,3,4,4,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,2,3,4,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat disagree,4,2,1,3,5,3,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,1,3,4,2,5,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,4,2,3,5,1,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,1,4,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,53,FALSE,50,TRUE,58,FALSE,52,TRUE,67,TRUE,53,TRUE,80,TRUE,95,TRUE,97,TRUE,56,TRUE,51,TRUE,80,FALSE,56,FALSE,92,TRUE,100,TRUE,55,TRUE,96,TRUE,91,TRUE,96,TRUE,69,TRUE,97,FALSE,58,TRUE,99,TRUE,53,TRUE,99,TRUE,100,FALSE,54,FALSE,53,TRUE,54,FALSE,70,TRUE,53,TRUE,54,12,1,1,1,1,2,0,3,3,3,2,2,3,3,1,3,-3,-2,-3,-3,-1,2,1,-1,2,3,7,2,-1,3,0,3,10,3,3,2,3,3,4,-2,1,1,0,-2,8,2,1,2,3,-1,3,-2,0,0,1,0,5,1,2,0,-3,3,8,-3,-3,-3,-3,-3,1,TRUE,0,54,TRUE,1,53,FALSE,1,70,TRUE,0,54,FALSE,0,53,FALSE,1,54,TRUE,1,100,TRUE,1,99,TRUE,1,53,TRUE,1,99,FALSE,1,58,TRUE,0,97,TRUE,1,69,TRUE,0,96,TRUE,1,91,TRUE,1,96,TRUE,0,55,TRUE,0,100,FALSE,1,92,FALSE,1,56,TRUE,1,80,TRUE,1,51,TRUE,0,56,TRUE,1,97,TRUE,0,95,TRUE,1,80,TRUE,0,53,TRUE,0,67,FALSE,1,52,TRUE,1,58,FALSE,0,50,TRUE,1,53,0.0001,0.04,0.0016,0,0.2209,0.2116,0.0009,0.0001,0.1936,0.2401,0.1764,0.0961,0.2209,0.1764,0.2809,0.2209,0.3136,0.2916,0.4489,0.9025,0.04,0.0081,0.0064,0.9216,0.3025,0.2809,0.25,0.2916,0.09,1,0.2304,0.9409,0.298492857,0.188857143,0.408128571,12,37.5,20,62.5,5,62.5,5,62.5,4,50,6,75,14,87.5,6,37.5,71.59,63,59,84.38,80,73.88,69.31,-25,9.09,0.5,-3.5,34.38,5,-13.62,31.81,1,0,2,1,1,2,4,0,3,1,1,0,1,2,0,1,3,4,3,1,1,0,1,2,3,2,3,3,2,2,1,1,3,4,0,0,1,0,0,2,1,2,0.8,2.4,1.4,2.4,1.8,0.6,1.55,1.55,1.55,7,5.33,5.75,-0.4,-0.4,-1,1.8,-0.6,4,5,-4,7,1.67,1,2,1,-2,2,2,-2,-1,1,-2,2,-1,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,66,interesting,0.75,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,7,2,8,5,4,9,3,1,6,4,3,2,1 +117,R_3rJN39fpWBEuqvw,60 - 66,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,5,3,2,4,1,Somewhat agree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,4,5,1,3,2,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,5,4,3,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,5,4,3,1,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,3,1,5,2,4,2,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,5,3,4,2,1,2,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,2,4,3,1,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,1,5,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,5,1,4,2,3,2,Strongly agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,3,1,4,5,2,2,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,5,1,3,4,2,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,4,3,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,50,TRUE,100,TRUE,98,TRUE,50,TRUE,80,TRUE,99,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,65,FALSE,50,TRUE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,99,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,22,3,3,1,1,3,1,-3,1,-2,1,3,1,3,-3,0,1,1,1,1,-1,3,2,1,1,3,2,1,-3,1,-3,3,2,3,1,3,-3,0,2,1,1,1,1,-1,2,3,2,1,1,3,2,3,-3,1,-3,3,2,3,1,3,-3,0,2,1,1,1,1,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,75,FALSE,1,50,TRUE,1,65,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,0,80,TRUE,0,50,TRUE,0,98,TRUE,1,100,FALSE,0,50,TRUE,1,50,0,0.0001,0,0.0001,0.25,0.25,0,0.25,0.25,0,0,0,0.25,1,0,0,0.25,0.25,0.25,0.25,0.1225,0,0.5625,1,1,0.64,0.25,1,1,1,0.9604,1,0.420907143,0.196428571,0.645385714,22,68.75,17,53.13,2,25,6,75,4,50,5,62.5,13,81.25,4,25,81.75,75.62,76.62,87.25,87.5,85.19,78.31,15.62,28.62,50.62,1.62,37.25,25,3.94,53.31,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0.2,0.6,0,0,0.2,1,0,0,0.2,0.3,0.25,2,2,2,0,-0.4,0,0,-0.133333333,0,0,0,0,0,0,2,1,-2,2,-1,1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,63,The survey was interesting.,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,5,3,2,9,6,4,8,1,7,3,4,2,1 +118,R_6CeWh0LbhPXXLzg,60 - 66,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Disagree,2,1,4,3,5,Strongly disagree,Disagree,Agree,Agree,Agree,5,4,2,3,1,Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,4,3,1,2,5,Agree,Agree,Strongly Agree,Strongly Agree,Strongly disagree,2,1,3,5,4,Strongly Agree,Strongly Agree,Agree,Agree,Somewhat disagree,3,2,4,1,5,2,Strongly disagree,Agree,Strongly agree,Strongly agree,Somewhat agree,1,5,3,4,2,6,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,2,1,3,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Agree,3,2,4,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Agree,Strongly disagree,5,2,4,3,1,0,Strongly disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,5,4,1,3,2,2,Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,5,3,4,2,1,0,Agree,Strongly Agree,Strongly Agree,Agree,Disagree,1,3,4,2,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,72,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,80,FALSE,84,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,100,TRUE,64,FALSE,60,FALSE,71,TRUE,84,TRUE,100,TRUE,94,FALSE,100,TRUE,78,TRUE,63,TRUE,83,TRUE,81,FALSE,70,28,3,3,2,1,-2,-3,-2,2,2,2,2,-2,3,-2,3,2,2,3,3,-3,3,3,2,2,-1,2,-3,2,3,3,1,6,2,-2,3,-3,3,0,0,0,2,-2,2,4,3,3,2,2,-3,0,-3,-2,3,-1,1,2,2,-2,3,-2,3,0,2,3,3,2,-2,2,FALSE,1,70,TRUE,1,81,TRUE,0,83,TRUE,0,63,TRUE,1,78,FALSE,1,100,TRUE,1,94,TRUE,1,100,TRUE,1,84,FALSE,0,71,FALSE,1,60,TRUE,0,64,TRUE,1,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,84,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,72,TRUE,1,100,TRUE,1,100,0,0,0,0.0036,0,0,0,0.5041,0.04,0,0.0784,0,0.0256,0.16,0.0484,0.0361,0.25,0.3969,0,0,0,0.0625,0.0256,1,0,0.25,0,0.09,0.6889,1,1,0.4096,0.216646429,0.109964286,0.323328571,28,87.5,24,75,6,75,7,87.5,5,62.5,6,75,15,93.75,9,56.25,86.22,74.62,91,91.88,87.38,90.94,81.5,12.5,11.22,-0.38,3.5,29.38,12.38,-2.81,25.25,0,0,0,1,1,0,4,1,1,1,0,0,0,1,0,2,2,1,5,5,0,0,0,1,1,0,0,1,3,1,0,0,0,0,0,0,1,0,1,1,0.4,1.4,0.2,3,0.4,1,0,0.6,1.25,0.5,0.875,2.67,0.67,2,0,0.4,0.2,2.4,0.2,2,4,0,2,2,1,2,2,-2,2,-2,2,-1,1,-2,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,62,,1.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,7,5,3,8,4,2,6,1,9,3,2,4,1 +119,R_1OfCGJJDeaWfNGy,60 - 66,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,3,5,1,2,Agree,Agree,Strongly Agree,Agree,Strongly Agree,1,2,5,3,4,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,5,2,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,0,Agree,Strongly disagree,Strongly agree,Agree,Agree,5,2,4,1,3,1,Agree,Agree,Strongly Agree,Agree,Strongly Agree,4,3,5,2,1,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,1,5,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,1,2,1,Agree,Strongly disagree,Strongly agree,Agree,Agree,2,4,1,5,3,0,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,4,3,5,2,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,1,4,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,90,TRUE,100,TRUE,87,FALSE,84,TRUE,73,FALSE,85,TRUE,98,TRUE,96,FALSE,60,TRUE,100,TRUE,97,TRUE,96,TRUE,91,TRUE,95,FALSE,52,TRUE,100,FALSE,53,TRUE,95,TRUE,61,FALSE,54,TRUE,93,TRUE,86,FALSE,86,FALSE,62,TRUE,94,TRUE,89,FALSE,60,TRUE,92,TRUE,85,TRUE,95,FALSE,60,TRUE,99,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,-3,3,0,3,2,2,3,2,3,-3,-3,-2,-3,-3,3,3,3,3,3,0,2,-3,3,2,2,1,2,2,3,2,3,1,-3,-3,-3,-3,-3,1,3,3,3,3,3,1,2,-3,3,2,2,0,2,3,3,2,3,1,-3,-3,-3,-3,-3,1,TRUE,0,90,TRUE,1,100,TRUE,0,87,FALSE,1,84,TRUE,1,73,FALSE,1,85,TRUE,1,98,TRUE,1,96,FALSE,0,60,TRUE,1,100,TRUE,0,97,TRUE,0,96,TRUE,1,91,TRUE,0,95,FALSE,0,52,TRUE,1,100,FALSE,1,53,TRUE,0,95,TRUE,0,61,FALSE,1,54,TRUE,1,93,TRUE,1,86,FALSE,1,86,FALSE,0,62,TRUE,0,94,TRUE,1,89,FALSE,1,60,TRUE,0,92,TRUE,0,85,TRUE,1,95,FALSE,0,60,TRUE,1,99,0.0016,0.0121,0,0.0004,0.0001,0.0225,0.3844,0,0.2116,0.0196,0.0025,0.0081,0.36,0.9409,0.0729,0,0.0196,0.0256,0.8464,0.8836,0.0049,0.2704,0.3721,0.9025,0.2209,0.16,0.36,0.81,0.7569,0.9025,0.7225,0.9216,0.364360714,0.1477,0.581021429,9,28.13,18,56.25,3,37.5,7,87.5,4,50,4,50,12,75,6,37.5,83.38,71.75,83.12,93.38,85.25,84.62,82.12,-28.12,27.13,34.25,-4.38,43.38,35.25,9.62,44.62,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,2,1,0,1,0,0,0,0,0,1,0,0,0,0.8,0,0.2,0,0.8,0.2,0.2,0.25,0.3,0.275,0.67,0.67,0.75,0,0,-0.2,0,-0.066666667,-1,1,0,0,0,0,2,2,-2,2,2,-2,2,-2,2,-2,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),65,"I enjoy doing this survey +",0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,6,7,2,8,3,5,4,1,9,3,2,4,1 +120,R_1BDXOvYr3SMssDf,60 - 66,,Canadian,Canadian,Female,Somewhat agree,Agree,Strongly agree,Somewhat agree,Agree,4,2,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,3,5,4,2,Somewhat Agree,Agree,Somewhat Agree,Disagree,Somewhat Agree,4,2,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Agree,Strongly Agree,Neither agree nor disagree,Agree,5,1,3,2,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,2,1,5,3,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,2,5,3,4,1,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Somewhat agree,Agree,4,3,5,2,1,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,3,Somewhat Agree,Agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,1,4,2,5,3,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,4,2,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,50,TRUE,76,FALSE,77,TRUE,100,FALSE,50,TRUE,69,FALSE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,75,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,74,TRUE,74,TRUE,100,TRUE,100,FALSE,78,TRUE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,79,19,1,2,3,1,2,0,0,1,-1,0,1,2,1,-2,1,0,0,1,1,0,1,2,3,0,2,5,-1,0,1,1,-1,3,1,1,0,-1,1,3,0,1,0,0,-1,3,2,2,2,1,2,5,0,0,0,0,0,1,1,2,0,-2,1,3,0,1,1,1,0,1,TRUE,0,79,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,78,TRUE,1,100,TRUE,1,100,TRUE,1,74,TRUE,1,74,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,0,50,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,69,FALSE,1,50,TRUE,1,100,FALSE,1,77,TRUE,1,76,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.0576,0,0,0,0.0484,0,0.0676,0,0.0961,0,0.25,0.0676,0.25,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.25,0.25,1,0.5625,0.25,0.25,0.6241,1,1,1,1,0.331042857,0.109264286,0.552821429,19,59.38,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,76.62,59.25,69.12,84.38,93.75,77.69,75.56,-6.25,10.99,-3.25,6.62,21.88,18.75,-9.81,31.81,0,0,0,1,0,1,0,0,2,1,0,1,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0.2,0.8,0.6,0.8,0.4,0.4,0.2,0.2,0.6,0.3,0.45,3.67,3,3,-0.2,0.4,0.4,0.6,0.2,0,2,0,2,0.67,0,0,0,-1,1,1,-1,0,0,0,0,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,66,This survey was too long for the amount of incentive given.,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,2,7,9,5,6,8,3,1,4,3,2,4,1 +121,R_7HCeHrTpMN1UNBZ,53 - 59,,Canadian,Canadian,Male,Strongly agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,Disagree,Somewhat disagree,Agree,Disagree,Somewhat agree,5,4,2,1,3,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Somewhat Agree,2,1,5,4,3,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,4,2,3,1,5,6,Disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,3,1,4,5,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,2,1,5,3,7,Disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,5,1,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,2,5,3,4,1,7,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,5,4,2,1,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,2,3,1,5,4,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,4,5,3,2,TRUE,50,TRUE,69,TRUE,80,FALSE,80,FALSE,65,TRUE,58,TRUE,90,TRUE,80,TRUE,86,FALSE,92,FALSE,85,TRUE,95,FALSE,86,TRUE,89,FALSE,87,TRUE,85,TRUE,50,FALSE,65,FALSE,59,FALSE,100,FALSE,59,TRUE,91,TRUE,81,TRUE,93,FALSE,96,TRUE,91,TRUE,61,FALSE,100,FALSE,70,TRUE,80,FALSE,90,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,0,0,1,-2,-1,2,-2,1,1,-1,2,-2,1,-2,0,-2,-2,-2,2,1,1,-2,1,7,-2,-1,2,-1,1,6,1,1,1,1,0,5,-2,1,-1,-1,-2,7,3,1,0,0,2,3,-2,-2,1,-2,1,7,1,1,1,-3,1,3,1,1,1,1,-2,4,TRUE,0,50,TRUE,1,69,TRUE,0,80,FALSE,1,80,FALSE,0,65,TRUE,0,58,TRUE,1,90,TRUE,1,80,TRUE,1,86,FALSE,0,92,FALSE,1,85,TRUE,0,95,FALSE,0,86,TRUE,0,89,FALSE,0,87,TRUE,1,85,TRUE,0,50,FALSE,1,65,FALSE,1,59,FALSE,1,100,FALSE,0,59,TRUE,1,91,TRUE,0,81,TRUE,1,93,FALSE,1,96,TRUE,1,91,TRUE,0,61,FALSE,1,100,FALSE,1,70,TRUE,1,80,FALSE,0,90,TRUE,1,100,0.04,0.0081,0.0225,0.01,0,0.3364,0.0049,0.8464,0,0.0081,0.04,0.7396,0.0196,0.0225,0.4225,0.0961,0.6561,0.04,0,0.0016,0.3481,0.7569,0.1681,0.7921,0.25,0.3721,0.81,0.25,0.64,0.1225,0.09,0.9025,0.312003571,0.230871429,0.393135714,25,78.13,18,56.25,5,62.5,2,25,5,62.5,6,75,10,62.5,8,50,80.09,77.12,71.12,83,89.12,84,76.19,21.88,23.84,14.62,46.12,20.5,14.12,21.5,26.19,1,0,1,2,0,0,0,0,1,0,0,2,1,3,1,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,2,1,1,0,3,1,3,3,0,0.8,0.2,1.4,0.6,0.2,0.4,0.8,2,0.75,0.85,0.8,6,4.33,5.25,0.6,-0.2,0.6,-1.4,0.333333333,4,-1,2,3,1.67,1,1,1,-2,2,1,-1,-1,1,-2,2,0,5 cents,100 minutes,47 days,Male,University - Undergraduate,59,,0.875,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,8,7,2,6,3,4,5,1,9,2,4,3,1 +122,R_71oXpdwjBQQF0Hd,60 - 66,,Canadian,Canadian,Female,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Agree,5,3,4,2,1,Disagree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,1,2,4,5,3,Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,1,3,5,4,2,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Agree,1,3,4,2,5,5,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,4,2,5,1,7,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,1,3,2,4,5,6,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Agree,4,5,3,1,2,3,Strongly disagree,Strongly disagree,Agree,Somewhat disagree,Agree,1,3,5,2,4,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly agree,2,5,3,4,1,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,2,4,3,5,FALSE,100,TRUE,96,FALSE,100,FALSE,50,TRUE,91,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,91,FALSE,53,FALSE,100,TRUE,50,TRUE,100,FALSE,70,FALSE,60,TRUE,70,FALSE,58,TRUE,65,TRUE,91,FALSE,96,TRUE,97,FALSE,88,TRUE,95,FALSE,95,FALSE,98,FALSE,65,TRUE,90,FALSE,79,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,0,-3,2,-2,-3,3,-1,2,2,1,2,-2,3,-2,1,0,0,1,3,1,0,-3,2,6,-2,-2,3,0,3,5,2,1,1,0,3,7,-2,-1,-1,-1,-2,6,2,1,0,-3,2,1,-3,-3,2,-1,2,3,1,0,2,-3,3,5,-1,0,0,-1,0,5,FALSE,1,100,TRUE,1,96,FALSE,1,100,FALSE,1,50,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,91,FALSE,0,53,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,FALSE,1,60,TRUE,0,70,FALSE,1,58,TRUE,1,65,TRUE,1,91,FALSE,1,96,TRUE,1,97,FALSE,1,88,TRUE,1,95,FALSE,1,95,FALSE,1,98,FALSE,1,65,TRUE,1,90,FALSE,0,79,TRUE,1,100,0,0.0025,0,0,0,0,0.0009,0,0.1764,0.0081,0.01,0.2809,0.25,0,0.0081,0.0016,0.0016,0.25,0.0004,0.0144,0.1225,0.25,0.49,0,0.09,0.0025,0.6241,0,0,0.16,0.1225,0.8281,0.131860714,0.070542857,0.193178571,25,78.13,27,84.38,5,62.5,7,87.5,8,100,7,87.5,13,81.25,14,87.5,84.31,73.75,80,91.75,91.75,84.81,83.81,-6.25,-0.07,11.25,-7.5,-8.25,4.25,3.56,-3.69,1,1,0,0,0,0,1,0,1,1,0,0,1,2,0,0,2,1,1,3,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,0.4,0.6,0.6,1.4,0.2,0.4,0.6,0.8,0.75,0.5,0.625,6,3,4.75,0.2,0.2,0,0.6,0.133333333,5,2,2,1,3,0,2,0,-2,2,-1,1,0,0,-2,2,1,10 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),64,,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,5,9,6,7,8,4,3,1,2,4,3,2,1 +123,R_7Va42f92krLujmc,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Strongly agree,Strongly disagree,Somewhat agree,1,5,3,2,4,Strongly disagree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly disagree,2,5,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,1,2,5,3,4,Agree,Agree,Agree,Agree,Strongly disagree,2,3,4,5,1,Agree,Agree,Strongly Agree,Somewhat disagree,Somewhat agree,2,5,3,4,1,1,Strongly disagree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly disagree,3,1,5,2,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,2,4,1,3,0,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,5,2,4,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,5,3,1,2,4,1,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Strongly disagree,1,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,3,2,5,1,0,Agree,Agree,Agree,Strongly Agree,Agree,4,1,2,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,TRUE,70,TRUE,70,FALSE,50,FALSE,50,FALSE,70,TRUE,70,TRUE,95,TRUE,50,TRUE,100,FALSE,50,TRUE,95,TRUE,100,FALSE,90,TRUE,85,TRUE,85,FALSE,50,TRUE,100,TRUE,90,FALSE,50,FALSE,50,TRUE,75,FALSE,80,TRUE,95,FALSE,100,TRUE,96,TRUE,50,FALSE,80,TRUE,85,TRUE,95,FALSE,50,TRUE,90,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,-3,1,-3,-3,3,-1,-3,3,3,3,-3,3,2,2,2,2,-3,2,2,3,-1,1,1,-3,-3,3,-1,-3,1,3,3,3,-3,3,0,1,1,1,2,2,2,0,3,3,0,1,1,-3,-3,3,-2,-3,1,3,3,3,-3,3,0,2,2,2,3,2,1,TRUE,0,50,TRUE,1,70,TRUE,0,70,FALSE,1,50,FALSE,0,50,FALSE,1,70,TRUE,1,70,TRUE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,95,TRUE,1,100,FALSE,1,90,TRUE,1,85,TRUE,1,85,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,FALSE,0,50,TRUE,1,75,FALSE,1,80,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,0,50,FALSE,1,80,TRUE,0,85,TRUE,1,95,FALSE,0,50,TRUE,1,90,0.0025,0.0016,0.0225,0.09,0.01,0.09,0.0025,0,0.25,0.0625,0.0025,0,0.25,0.25,0.25,0.09,0.04,0.25,0.04,0,0.25,0.0225,0.81,0.01,0.25,0.25,0.25,0.25,0.49,1,0.7225,0.9025,0.242678571,0.110535714,0.374821429,22,68.75,22,68.75,5,62.5,5,62.5,6,75,6,75,13,81.25,9,56.25,75.5,61.88,71.88,85.12,83.12,78.5,72.5,0,6.75,-0.62,9.38,10.12,8.12,-2.75,16.25,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,5,2,1,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,5,0.4,0,0,1.6,1.2,0.2,0,1.2,0.5,0.65,0.575,0.67,0.67,0.875,-0.8,-0.2,0,0.4,-0.333333333,0,0,0,1,0,0,0,-2,-2,2,1,-1,0,0,0,0,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,59,It was an interesting survey,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,5,2,8,9,4,3,7,1,6,4,3,2,1 +124,R_3TE4Et8JPxD5E2d,53 - 59,,Canadian,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,4,3,5,2,Agree,Disagree,Neither agree nor disagree,Strongly disagree,Strongly agree,4,3,5,2,1,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,3,2,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,2,3,5,4,1,0,Strongly agree,Disagree,Agree,Strongly disagree,Strongly agree,5,3,1,2,4,0,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,5,2,4,1,0,Somewhat disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,4,1,3,2,0,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,Agree,4,1,2,3,5,5,Neither Agree nor Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,2,1,5,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,24,0,0,3,0,3,2,-2,0,-3,3,0,3,3,-3,3,3,3,3,3,1,3,0,3,0,3,0,3,-2,2,-3,3,0,0,3,3,-3,3,0,-1,-1,-3,-3,-3,0,3,0,3,0,3,1,1,-1,0,-3,2,0,0,3,3,-3,3,5,3,3,3,3,1,0,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0.25,0,0,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,1,0.25,0.285714286,0.178571429,0.392857143,24,75,15,46.88,3,37.5,3,37.5,3,37.5,6,75,13,81.25,2,12.5,67.19,56.25,62.5,81.25,68.75,71.88,62.5,28.12,20.31,18.75,25,43.75,-6.25,-9.37,50,3,0,0,0,0,1,0,2,0,0,0,0,0,0,0,4,4,6,6,4,3,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0.6,0.6,0,4.8,0.6,0.6,0,0,1.5,0.3,0.9,0,2,0.75,0,0,0,4.8,0,-1,0,-5,0,-2,2,2,2,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),56,the last skill testing questions were unfair to those that don't do math well and should be excluded from the survey,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,8,4,5,9,7,2,3,1,6,3,2,4,1 +125,R_7Cg6cPOKf5R6mch,67 - 73,,Canadian,Canadian,Male,Somewhat disagree,Strongly agree,Somewhat agree,Agree,Somewhat agree,4,2,3,1,5,Somewhat disagree,Disagree,Strongly agree,Disagree,Somewhat disagree,1,3,2,5,4,Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,5,4,3,1,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Strongly Agree,Somewhat agree,Strongly disagree,Somewhat agree,5,3,2,1,4,3,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,5,3,1,2,7,Somewhat Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,1,2,4,5,3,7,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat disagree,Disagree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat disagree,Strongly Agree,Agree,Strongly Agree,Agree,1,5,3,2,4,2,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Strongly disagree,1,3,4,5,2,2,Somewhat Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,3,1,2,4,5,4,Somewhat disagree,Disagree,Disagree,Somewhat agree,Somewhat disagree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,TRUE,73,TRUE,77,TRUE,50,TRUE,80,TRUE,50,TRUE,57,FALSE,59,FALSE,50,FALSE,50,TRUE,50,TRUE,89,FALSE,94,FALSE,50,TRUE,78,TRUE,50,TRUE,81,FALSE,50,FALSE,50,TRUE,69,FALSE,50,FALSE,50,FALSE,75,FALSE,50,TRUE,50,TRUE,62,FALSE,71,FALSE,50,TRUE,50,TRUE,70,TRUE,65,TRUE,54,24,-1,3,1,2,1,-1,-2,3,-2,-1,2,1,2,-2,1,1,0,1,1,1,-2,3,1,-3,1,2,-1,1,2,1,1,3,1,1,2,-2,1,7,-3,-3,-3,-1,-2,7,-1,3,2,3,2,4,-1,-2,1,1,-3,2,1,1,2,-2,1,2,-1,-2,-2,1,-1,4,TRUE,0,54,TRUE,1,65,TRUE,0,70,TRUE,0,50,FALSE,0,50,FALSE,1,71,TRUE,1,62,TRUE,1,50,FALSE,0,50,FALSE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,69,FALSE,1,50,FALSE,0,50,TRUE,1,81,TRUE,0,50,TRUE,0,78,FALSE,1,50,FALSE,1,94,TRUE,1,89,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,59,TRUE,1,57,TRUE,0,50,TRUE,0,80,TRUE,0,50,TRUE,1,77,TRUE,1,73,TRUE,1,97,0.25,0.1849,0.0361,0.1444,0.0009,0.0841,0.25,0.5625,0.0036,0.25,0.0529,0.0961,0.25,0.25,0.25,0.1225,0.25,0.25,0.64,0.1681,0.0121,0.25,0.25,0.25,0.25,0.25,0.0729,0.2916,0.49,0.6084,0.25,0.25,0.239489286,0.1909,0.288078571,24,75,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,62.53,54.75,65.75,60.62,69,65.31,59.75,15.62,3.15,4.75,3.25,-1.88,6.5,-3.44,9.75,1,0,0,5,0,0,3,1,3,2,1,0,0,0,0,4,3,4,2,3,0,0,1,1,1,0,0,2,3,2,1,0,0,0,0,2,2,3,0,2,1.2,1.8,0.2,3.2,0.6,1.4,0.2,1.8,1.6,1,1.3,4,2.67,3.875,0.6,0.4,0,1.4,0.333333333,-2,1,5,3,1.33,2,2,2,-1,1,-1,1,-2,2,-2,2,-2,10 cents,5 minutes,47 days,Male,University - Undergraduate,72,Should have given results in answering the 32 questions,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,5,9,8,6,4,2,3,1,7,3,2,4,1 +126,R_1EsdwdL2CMmGUmS,67 - 73,American,,American,Male,Agree,Agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,2,4,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,4,2,1,3,5,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,4,2,5,1,3,Strongly Agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly Agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,3,1,5,4,2,9,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,5,1,3,2,4,9,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,4,1,5,2,3,9,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Somewhat agree,Agree,Strongly Agree,3,2,4,5,1,9,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,1,2,3,4,5,9,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,1,2,3,4,5,9,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,3,1,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,81,TRUE,100,TRUE,100,FALSE,66,TRUE,100,TRUE,100,FALSE,58,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,75,TRUE,100,FALSE,59,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,100,FALSE,85,TRUE,90,TRUE,100,FALSE,59,FALSE,62,TRUE,100,TRUE,100,25,2,2,-1,0,3,0,0,3,-1,0,3,3,1,2,0,3,1,2,0,3,2,3,1,0,3,9,1,-1,2,-1,1,9,0,1,1,2,1,9,1,0,1,0,1,9,2,2,1,2,3,9,2,-1,3,-1,3,9,3,3,0,3,1,9,2,3,3,1,2,9,TRUE,0,100,TRUE,1,100,FALSE,1,62,FALSE,1,59,TRUE,1,100,TRUE,0,90,FALSE,0,85,TRUE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,59,TRUE,0,100,FALSE,0,75,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,58,TRUE,0,100,TRUE,0,100,FALSE,1,66,TRUE,1,100,TRUE,1,100,TRUE,1,81,0,0.3364,0,0.7225,0.0361,0.81,0,0,1,0,0,0,0.01,1,0,0,1,0.1681,1,1,0.5625,0,0.1681,1,1,1,0,1,0.1444,1,0.1156,1,0.464814286,0.287442857,0.642185714,25,78.13,17,53.13,6,75,4,50,2,25,5,62.5,13,81.25,4,25,91.41,88.5,89,92.88,95.25,93.06,89.75,25,38.28,13.5,39,67.88,32.75,11.81,64.75,0,1,2,0,0,1,1,1,0,1,3,2,0,0,1,2,1,1,0,2,0,0,2,2,0,2,1,0,0,3,0,0,1,1,1,1,2,1,1,1,0.6,0.8,1.2,1.2,0.8,1.2,0.6,1.2,0.95,0.95,0.95,9,9,9,-0.2,-0.4,0.6,0,0,0,0,0,0,0,0,1,0,1,-1,2,-2,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,University - PhD,72,"Great knowledge-enhancing information about different topics was provided in the survey, and I am very happy to have been a panelist.",-0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,6,9,2,5,8,3,4,1,7,4,3,2,1 +127,R_3flOdNLpKVbmtLi,67 - 73,American,,American,Female,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,4,1,3,2,Somewhat agree,Disagree,Agree,Somewhat disagree,Somewhat disagree,3,2,4,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Agree,1,2,3,4,5,Agree,Somewhat agree,Strongly Agree,Agree,Agree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,3,1,5,2,1,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,1,5,3,2,4,1,Strongly Agree,Strongly Agree,Somewhat Agree,Disagree,Agree,4,5,1,3,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,1,2,4,5,1,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,2,4,5,3,1,1,Strongly agree,Strongly agree,Agree,Disagree,Agree,4,2,5,3,1,2,Agree,Agree,Agree,Somewhat agree,Agree,4,5,3,1,2,TRUE,70,TRUE,80,FALSE,71,FALSE,50,TRUE,54,FALSE,55,TRUE,80,TRUE,90,TRUE,60,TRUE,70,FALSE,70,TRUE,91,TRUE,75,FALSE,50,TRUE,60,TRUE,92,FALSE,65,TRUE,91,FALSE,55,FALSE,90,TRUE,55,TRUE,55,FALSE,55,TRUE,60,FALSE,76,TRUE,71,FALSE,55,FALSE,76,TRUE,75,FALSE,75,FALSE,60,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,1,1,1,-2,2,-1,-1,3,3,3,-2,2,2,1,3,2,2,2,1,2,1,1,1,1,-2,2,-2,1,1,3,3,1,-2,2,1,1,1,1,2,2,1,2,1,2,1,1,2,1,-1,2,-1,-1,1,3,3,2,-2,2,1,2,2,2,1,2,2,TRUE,0,70,TRUE,1,80,FALSE,1,71,FALSE,1,50,TRUE,1,54,FALSE,1,55,TRUE,1,80,TRUE,1,90,TRUE,1,60,TRUE,1,70,FALSE,1,70,TRUE,0,91,TRUE,1,75,FALSE,1,50,TRUE,1,60,TRUE,1,92,FALSE,1,65,TRUE,0,91,FALSE,1,55,FALSE,1,90,TRUE,1,55,TRUE,1,55,FALSE,1,55,TRUE,1,60,FALSE,1,76,TRUE,1,71,FALSE,1,55,FALSE,1,76,TRUE,0,75,FALSE,0,75,FALSE,0,60,TRUE,1,100,0.01,0.0841,0.0064,0.04,0,0.2025,0.16,0.09,0.01,0.2025,0.5625,0.0625,0.16,0.09,0.2116,0.04,0.2025,0.25,0.0576,0.0576,0.2025,0.16,0.2025,0.25,0.1225,0.2025,0.36,0.49,0.0841,0.8281,0.5625,0.8281,0.237575,0.160292857,0.314857143,16,50,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,69.75,61.25,66.75,70.38,80.62,71.06,68.44,-31.25,-11.5,-26.25,-20.75,-4.62,5.62,-16.44,-6.56,0,0,0,0,0,0,0,0,1,2,0,0,2,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0.6,0.4,0.6,0,0.2,0.2,0.6,0.4,0.25,0.325,1,1.33,1.25,0,0.4,0.2,0,0.2,-1,0,0,-1,-0.33,0,-2,1,-2,2,0,0,0,0,1,-1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,I really liked this survey. Different from others I have taken,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,5,8,2,6,4,3,9,1,7,2,4,3,1 +128,R_3YXRM924PtBf6ux,32 - 38,,Canadian,Canadian,Male,Somewhat disagree,Strongly agree,Agree,Somewhat disagree,Strongly disagree,3,2,5,4,1,Disagree,Somewhat disagree,Disagree,Agree,Neither agree nor disagree,5,4,1,2,3,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,2,5,1,3,4,Strongly disagree,Disagree,Somewhat disagree,Disagree,Strongly disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,2,4,3,1,5,5,Neither agree nor disagree,Agree,Strongly disagree,Strongly agree,Somewhat agree,4,3,2,1,5,5,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,1,2,4,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,1,5,3,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,5,1,4,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,4,1,5,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,3,4,1,TRUE,60,FALSE,50,TRUE,60,FALSE,50,FALSE,60,FALSE,100,TRUE,65,TRUE,100,FALSE,50,FALSE,50,FALSE,60,FALSE,50,FALSE,70,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,70,TRUE,50,FALSE,50,FALSE,100,TRUE,65,TRUE,95,TRUE,60,FALSE,50,TRUE,95,TRUE,50,FALSE,50,TRUE,67,FALSE,91,FALSE,50,TRUE,71,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,2,-1,-3,-2,-1,-2,2,0,1,-1,3,-1,3,-3,-2,-1,-2,-3,1,3,3,0,-3,6,0,2,-3,3,1,5,0,-1,0,0,0,5,0,0,1,0,-1,4,0,2,2,0,2,5,0,0,0,0,0,5,0,-1,2,-1,3,4,0,0,0,0,-1,5,TRUE,0,60,FALSE,0,50,TRUE,0,60,FALSE,1,50,FALSE,0,60,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,60,FALSE,1,50,FALSE,0,70,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,50,FALSE,1,50,FALSE,0,100,TRUE,1,65,TRUE,0,95,TRUE,1,60,FALSE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,67,FALSE,0,91,FALSE,0,50,TRUE,1,71,0,0.0025,0,0.1225,0.0841,0,0.16,0.25,0.25,0.1225,0.8281,0.49,0.25,0.16,0.36,0.25,0.9025,0.25,0.25,0.25,1,0.25,0.25,0,0.25,0.25,0.25,0.36,0.36,0.49,0.4489,0.25,0.322003571,0.311228571,0.332778571,19,59.38,16,50,2,25,3,37.5,5,62.5,6,75,7,43.75,9,56.25,66.84,51.25,76.62,69.38,70.12,70.44,63.25,9.38,16.84,26.25,39.12,6.88,-4.88,26.69,7,2,0,1,1,0,2,3,1,1,1,1,0,3,1,3,3,2,2,2,2,1,1,0,1,5,2,1,2,2,0,1,0,1,0,0,3,2,1,2,2,0.8,1.6,1.6,2.2,1.6,1.4,0.4,2,1.55,1.35,1.45,5.33,4.67,4.875,-0.8,0.2,1.2,0.2,0.2,1,0,1,-1,0.66,0,1,1,-1,1,1,-1,0,0,-1,1,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),32,,0.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,01DIR,6,4,7,8,5,3,9,1,2,3,2,4,1 +129,R_12AaJXOVHjAjKCq,60 - 66,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,1,3,2,4,Agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,4,1,2,3,5,Somewhat Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,5,4,2,Agree,Agree,Strongly Agree,Agree,Neither agree nor disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Strongly Agree,Agree,Somewhat disagree,Agree,5,2,1,4,3,4,Agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,3,2,1,5,4,2,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,5,1,4,3,2,8,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Agree,Strongly Agree,Strongly Agree,Somewhat disagree,4,2,3,1,5,4,Somewhat disagree,Strongly disagree,Somewhat disagree,Strongly disagree,Somewhat disagree,5,3,4,1,2,2,Neither Agree nor Disagree,Agree,Agree,Strongly Disagree,Neither Agree nor Disagree,3,2,4,5,1,8,Strongly disagree,Disagree,Somewhat agree,Agree,Somewhat agree,2,1,5,3,4,TRUE,100,FALSE,64,TRUE,94,FALSE,51,FALSE,51,FALSE,69,TRUE,95,TRUE,87,TRUE,51,FALSE,96,FALSE,74,TRUE,91,TRUE,88,TRUE,55,FALSE,51,TRUE,96,TRUE,59,TRUE,65,TRUE,60,FALSE,76,FALSE,64,TRUE,81,TRUE,53,TRUE,71,FALSE,96,TRUE,92,TRUE,52,FALSE,99,TRUE,62,FALSE,86,TRUE,79,TRUE,100,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,1,3,2,-2,3,-1,3,1,2,3,0,1,2,2,3,2,0,0,3,2,-1,2,7,2,-1,2,0,2,4,0,2,2,1,0,2,-1,-2,-1,-1,-2,8,0,2,3,3,-1,7,-1,-3,-1,-3,-1,4,0,2,2,-3,0,2,-3,-2,1,2,1,8,TRUE,0,100,FALSE,0,64,TRUE,0,94,FALSE,1,51,FALSE,0,51,FALSE,1,69,TRUE,1,95,TRUE,1,87,TRUE,1,51,FALSE,0,96,FALSE,1,74,TRUE,0,91,TRUE,1,88,TRUE,0,55,FALSE,0,51,TRUE,1,96,TRUE,0,59,TRUE,0,65,TRUE,0,60,FALSE,1,76,FALSE,0,64,TRUE,1,81,TRUE,0,53,TRUE,1,71,FALSE,1,96,TRUE,1,92,TRUE,0,52,FALSE,1,99,TRUE,0,62,FALSE,0,86,TRUE,1,79,TRUE,1,100,0.0169,0.0064,0.0016,0.0025,0,0.0961,0.0841,0.9216,0.0576,0.0361,0.7396,0.0144,0.2401,0.0676,0.2601,0.4096,0.2809,0.2401,0.0001,0.0016,0.4096,0.2601,0.36,0.3025,0.3481,0.2704,0.0441,1,0.8836,0.4225,0.3844,0.8281,0.320107143,0.246278571,0.393935714,18,56.25,16,50,4,50,3,37.5,4,50,5,62.5,10,62.5,6,37.5,75.25,60.25,68.25,85,87.5,78.25,72.25,6.25,25.25,10.25,30.75,35,25,15.75,34.75,0,0,1,2,1,0,1,1,1,1,1,0,1,1,1,3,4,4,3,2,0,1,0,2,4,3,1,4,2,4,1,0,1,3,1,5,4,2,0,1,0.8,0.8,0.8,3.2,1.4,2.8,1.2,2.4,1.4,1.95,1.675,4.33,4.33,5.25,-0.6,-2,-0.4,0.8,-1,0,0,0,0,0,2,1,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),63,Difficult answers in my current mental state,1.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,3,4,9,6,7,2,8,1,5,4,2,3,1 +130,R_6VkvM4RwzyqX4xX,25 - 31,,Canadian,Canadian,Female,Agree,Somewhat agree,Agree,Somewhat agree,Agree,1,2,3,5,4,Somewhat disagree,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,1,2,4,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,4,3,5,1,2,Somewhat disagree,Somewhat disagree,Strongly disagree,Disagree,Disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Disagree,Strongly Agree,Somewhat agree,Disagree,Agree,3,5,2,1,4,6,Agree,Somewhat disagree,Disagree,Somewhat disagree,Agree,3,5,2,4,1,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,1,2,10,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,4,3,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Agree,Agree,Agree,1,2,4,5,3,6,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,3,1,2,4,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,1,5,4,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,TRUE,80,TRUE,50,TRUE,100,FALSE,52,TRUE,50,FALSE,53,TRUE,96,TRUE,75,FALSE,55,TRUE,100,TRUE,81,TRUE,100,TRUE,62,TRUE,55,FALSE,58,TRUE,76,TRUE,70,TRUE,80,FALSE,92,FALSE,67,FALSE,70,TRUE,83,TRUE,79,FALSE,82,FALSE,100,TRUE,80,FALSE,72,FALSE,79,FALSE,70,TRUE,81,TRUE,70,TRUE,71,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,1,2,-1,-2,-1,1,1,1,1,1,2,0,-1,-1,-3,-2,-2,-2,3,1,-2,2,5,2,-1,-2,-1,2,6,1,1,1,0,1,0,-2,-2,-1,-1,-2,10,1,1,2,2,2,6,1,-2,1,-2,1,6,1,1,1,1,1,1,1,1,0,0,0,4,TRUE,0,80,TRUE,1,50,TRUE,0,100,FALSE,1,52,TRUE,1,50,FALSE,1,53,TRUE,1,96,TRUE,1,75,FALSE,0,55,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,1,62,TRUE,0,55,FALSE,0,58,TRUE,1,76,TRUE,0,70,TRUE,0,80,FALSE,1,92,FALSE,1,67,FALSE,0,70,TRUE,1,83,TRUE,0,79,FALSE,0,82,FALSE,1,100,TRUE,1,80,FALSE,1,72,FALSE,1,79,FALSE,1,70,TRUE,1,81,TRUE,1,70,TRUE,1,71,0.0625,0.04,0.0576,0.0016,0.0841,0.2209,0.6724,0,0.1089,0.0289,0.0361,0.1444,0.3025,0.6561,0.25,0.25,0.6241,0.2304,0.0441,0,0.49,0.3364,0.0064,0.3025,0.49,0.0784,0.09,0.64,1,0.64,0.09,1,0.314878571,0.257771429,0.371985714,19,59.38,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,12,75,8,50,74.66,66.25,65.62,84.25,82.5,72.44,76.88,-3.12,12.16,3.75,3.12,21.75,20,-2.56,26.88,4,2,1,3,0,3,1,1,2,1,0,0,0,2,1,1,1,2,1,0,1,0,0,1,0,2,0,2,3,0,0,0,0,1,1,2,2,3,2,2,2,1.6,0.6,1,0.4,1.4,0.4,2.2,1.3,1.1,1.2,3.67,4.33,4.75,1.6,0.2,0.2,-1.2,0.666666667,-1,0,-1,6,-0.66,-1,1,0,-2,2,0,0,0,0,-2,2,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),29,,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,2,6,3,5,7,9,8,1,4,3,4,2,1 +131,R_7dCk3EV35G3hOnf,60 - 66,,Canadian,Canadian,Male,Agree,Agree,Agree,Agree,Somewhat agree,4,3,2,5,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Agree,5,4,3,1,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,5,3,2,1,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,5,2,3,Agree,Agree,Agree,Agree,Agree,5,2,3,1,4,2,Agree,Agree,Agree,Agree,Agree,4,3,5,2,1,3,Agree,Agree,Agree,Agree,Agree,1,3,2,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,4,5,2,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,3,Agree,Agree,Agree,Agree,Agree,2,1,4,3,5,3,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,3,5,1,2,3,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,99,TRUE,50,FALSE,68,FALSE,52,FALSE,50,TRUE,90,TRUE,89,TRUE,70,TRUE,64,TRUE,86,TRUE,82,TRUE,89,TRUE,87,FALSE,50,TRUE,96,FALSE,50,TRUE,90,FALSE,60,FALSE,98,FALSE,99,TRUE,50,TRUE,50,FALSE,50,TRUE,69,TRUE,86,TRUE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,81,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,1,1,0,3,1,2,3,2,3,3,2,1,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,0,0,0,1,1,2,3,3,2,3,3,3,2,2,2,2,2,3,2,3,2,3,3,3,2,1,2,1,1,3,TRUE,0,100,TRUE,1,99,TRUE,0,50,FALSE,1,68,FALSE,0,52,FALSE,1,50,TRUE,1,90,TRUE,1,89,TRUE,1,70,TRUE,1,64,TRUE,0,86,TRUE,0,82,TRUE,1,89,TRUE,0,87,FALSE,0,50,TRUE,1,96,FALSE,1,50,TRUE,0,90,FALSE,1,60,FALSE,1,98,FALSE,0,99,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,69,TRUE,1,86,TRUE,0,100,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,81,0.0121,0.0196,0.0016,0.01,0.0361,0.25,0.25,0.1296,0.0004,0.25,0,0.0121,0.09,0.7396,0.2704,0.0001,0.25,0.1024,0.25,0.4761,0.9801,0.25,0.16,0.7569,0.25,1,0.25,1,0.25,0.81,0.25,0.6724,0.347721429,0.17005,0.525392857,16,50,17,53.13,4,50,4,50,4,50,5,62.5,11,68.75,6,37.5,73.59,72.88,65.12,79.5,76.88,75.94,71.25,-3.13,20.46,22.88,15.12,29.5,14.38,7.19,33.75,0,0,0,0,1,1,2,1,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,1,2,1,2,1,1,0,1,1,1,0,1,1,1,1,0,0,0.2,1,0.6,0.4,1,1,0.8,0.6,0.55,0.85,0.7,2.33,3,2.625,-0.8,0,-0.2,-0.2,-0.333333333,-1,0,-1,-1,-0.67,1,1,2,0,0,1,-1,0,0,1,-1,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),63,none,0.25,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,9,4,3,6,8,5,7,1,2,4,3,2,1 +132,R_6fdhGMa008fFigW,67 - 73,American,,American,Female,Strongly agree,Agree,Agree,Somewhat agree,Agree,5,3,1,4,2,Somewhat disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,4,5,2,3,Agree,Agree,Agree,Somewhat Disagree,Agree,4,1,2,5,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,2,4,5,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,7,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,3,2,1,5,6,Agree,Agree,Agree,Somewhat Disagree,Agree,3,2,5,1,4,7,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,1,3,2,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,2,3,1,5,4,5,Disagree,Disagree,Agree,Disagree,Disagree,2,1,5,4,3,7,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,3,5,2,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,79,TRUE,95,TRUE,60,TRUE,68,TRUE,56,FALSE,100,TRUE,72,FALSE,100,TRUE,85,FALSE,84,FALSE,100,TRUE,78,TRUE,63,FALSE,100,TRUE,100,TRUE,65,TRUE,100,TRUE,96,TRUE,100,TRUE,72,FALSE,100,TRUE,92,TRUE,100,TRUE,100,FALSE,96,TRUE,100,TRUE,60,FALSE,100,TRUE,100,TRUE,84,23,3,2,2,1,2,-1,-2,3,-2,0,2,2,2,-1,2,-1,0,1,1,0,2,2,2,2,2,7,-1,-2,2,-2,0,6,2,2,2,-1,2,7,0,-1,1,0,-1,5,2,2,2,2,2,5,-2,-2,2,-2,-2,7,2,2,2,0,2,8,0,0,0,0,0,5,TRUE,0,84,TRUE,1,100,FALSE,1,100,TRUE,0,60,TRUE,1,100,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,92,FALSE,0,100,TRUE,0,72,TRUE,0,100,TRUE,1,96,TRUE,0,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,TRUE,0,63,TRUE,0,78,FALSE,1,100,FALSE,0,84,TRUE,1,85,FALSE,1,100,TRUE,1,72,FALSE,1,100,TRUE,1,56,TRUE,0,68,TRUE,0,60,TRUE,0,95,TRUE,1,79,TRUE,1,100,TRUE,1,100,0,0.1936,0,0,0,0.0016,0.0784,1,0,0.0225,0.0441,0.0016,0.0064,0.5184,0,0,0,0.36,0.36,0,0.7056,0.1225,0.6084,1,0,0.4624,0,0.7056,0,0.3969,0.9025,1,0.296317857,0.145214286,0.447421429,23,71.88,20,62.5,4,50,6,75,4,50,6,75,14,87.5,6,37.5,87.66,79.38,96.38,86,88.88,89.31,86,9.38,25.16,29.38,21.38,36,13.88,1.81,48.5,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,1,0,2,0,0,0,1,0,1,0,1,1,0,0.4,0.2,0,0.8,0.4,0.8,0.2,0.6,0.35,0.5,0.425,6.67,6.67,6.25,0,-0.6,-0.2,0.2,-0.266666667,2,-1,-1,0,0,0,0,0,-1,1,0,0,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),69,,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,6,7,3,4,8,2,5,1,9,4,3,2,1 +133,R_1jiy35s47l7pFP2,60 - 66,,Canadian,Canadian,Male,Disagree,Disagree,Somewhat disagree,Somewhat agree,Disagree,2,5,3,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,5,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,1,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,2,3,4,Disagree,Disagree,Disagree,Somewhat disagree,Disagree,3,4,5,1,2,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,1,5,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,5,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,2,1,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,5,4,2,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,64,TRUE,53,TRUE,91,TRUE,65,TRUE,53,TRUE,62,FALSE,62,TRUE,54,TRUE,69,TRUE,100,FALSE,65,TRUE,98,TRUE,57,FALSE,50,TRUE,50,TRUE,56,TRUE,61,TRUE,100,FALSE,54,TRUE,50,TRUE,56,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,89,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,-2,-1,1,-2,0,0,1,1,1,1,0,1,1,0,1,1,1,0,1,-2,-2,-2,-1,-2,3,1,0,1,0,0,5,1,1,1,0,1,6,0,0,0,0,0,6,0,0,0,0,0,5,1,0,0,0,1,5,1,1,1,0,1,5,1,1,0,0,0,5,FALSE,1,64,TRUE,1,53,TRUE,0,91,TRUE,0,65,TRUE,1,53,TRUE,0,62,FALSE,0,62,TRUE,1,54,TRUE,1,69,TRUE,1,100,FALSE,1,65,TRUE,0,98,TRUE,1,57,FALSE,1,50,TRUE,1,50,TRUE,1,56,TRUE,0,61,TRUE,0,100,FALSE,1,54,TRUE,0,50,TRUE,1,56,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,89,TRUE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.2116,0.0121,0.1936,0.3844,0,0.3844,0.25,0,0.25,0.25,0,0.1849,0.0961,0.1225,0.2209,0.2209,0.25,0.4225,1,0.25,0.1936,0.25,0.2116,0.25,0.3721,0.25,0.25,0.1296,0.8281,1,0.25,0.9604,0.315985714,0.189442857,0.442528571,19,59.38,19,59.38,6,75,5,62.5,4,50,4,50,14,87.5,5,31.25,65.91,57,61.12,70.62,74.88,65.56,66.25,0,6.53,-18,-1.38,20.62,24.88,-21.94,35,0,0,1,2,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,2,2,1,1,2,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0.6,0.6,0.6,0.8,1.6,0.6,0.6,0.4,0.65,0.8,0.725,4.67,5,5,-1,0,0,0.4,-0.333333333,-2,0,1,1,-0.33,0,-1,-1,1,-1,1,-1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),60,NO,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,8,3,4,5,2,7,9,1,6,2,4,3,1 +134,R_52nkx602HV2MbSm,67 - 73,American,,American,Female,Agree,Agree,Agree,Agree,Agree,3,1,5,4,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,5,4,1,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,4,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,5,2,1,3,4,5,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,1,5,4,3,2,5,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,4,5,1,2,3,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,1,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,5,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,5,1,2,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,TRUE,93,TRUE,92,FALSE,68,FALSE,55,FALSE,62,FALSE,100,FALSE,59,TRUE,83,TRUE,61,TRUE,62,TRUE,57,FALSE,90,FALSE,84,FALSE,92,TRUE,60,FALSE,52,FALSE,67,TRUE,91,TRUE,62,FALSE,100,FALSE,65,TRUE,62,TRUE,66,TRUE,85,FALSE,71,TRUE,66,TRUE,60,FALSE,68,TRUE,70,FALSE,65,FALSE,60,TRUE,100,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,1,0,1,0,1,2,2,2,0,1,0,1,1,1,0,1,1,0,-1,1,6,2,1,2,0,2,5,0,1,0,1,0,5,1,0,0,0,0,7,0,1,1,1,0,4,0,0,1,1,0,5,1,1,2,0,1,5,0,-1,0,0,0,5,TRUE,0,93,TRUE,1,92,FALSE,1,68,FALSE,1,55,FALSE,0,62,FALSE,1,100,FALSE,0,59,TRUE,1,83,TRUE,1,61,TRUE,1,62,TRUE,0,57,FALSE,1,90,FALSE,0,84,FALSE,1,92,TRUE,1,60,FALSE,0,52,FALSE,1,67,TRUE,0,91,TRUE,0,62,FALSE,1,100,FALSE,0,65,TRUE,1,62,TRUE,0,66,TRUE,1,85,FALSE,1,71,TRUE,1,66,TRUE,0,60,FALSE,1,68,TRUE,0,70,FALSE,0,65,FALSE,0,60,TRUE,1,100,0.0289,0.1156,0.2704,0.3481,0,0,0.0225,0.1444,0,0.1444,0.4225,0.7056,0.1521,0.3249,0.3844,0.0064,0.4356,0.2025,0.1024,0.0841,0.4225,0.16,0.3844,0.0064,0.1089,0.36,0.36,0.8649,0.1024,0.8281,0.49,0.01,0.258192857,0.210378571,0.306007143,13,40.63,18,56.25,4,50,3,37.5,5,62.5,6,75,9,56.25,9,56.25,72.75,63.38,76.75,74.5,76.38,69.88,75.62,-15.62,16.5,13.38,39.25,12,1.38,13.63,19.37,1,1,2,3,1,1,1,1,0,1,2,1,2,1,1,1,1,1,1,0,2,1,1,1,2,1,0,0,1,1,1,1,0,0,0,0,2,1,1,0,1.6,0.8,1.4,0.8,1.4,0.6,0.4,0.8,1.15,0.8,0.975,5.33,4.67,5.25,0.2,0.2,1,0,0.466666667,2,0,0,2,0.66,0,1,0,-1,1,1,-1,2,-2,-2,2,0,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,68,This was a unique and interesting survey ,0.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,9,6,8,7,4,3,2,1,5,3,4,2,1 +135,R_7nejt6E4wnCP4L3,67 - 73,,Canadian,Canadian,Female,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,1,4,5,3,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,2,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,5,3,1,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Agree,2,1,5,4,3,7,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,1,4,8,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,5,3,4,2,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,5,2,4,1,3,5,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,5,2,4,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,5,4,3,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,97,TRUE,92,TRUE,87,TRUE,75,TRUE,80,TRUE,75,TRUE,72,TRUE,66,TRUE,61,TRUE,94,TRUE,100,TRUE,72,TRUE,100,TRUE,81,TRUE,100,TRUE,100,FALSE,100,FALSE,68,FALSE,78,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,95,FALSE,82,TRUE,100,TRUE,100,FALSE,86,24,1,0,2,1,2,1,-1,1,-1,1,1,1,1,0,2,0,-1,1,0,0,0,0,2,1,2,7,0,-2,1,0,0,7,1,1,2,-1,1,8,1,1,1,1,-1,3,1,0,2,1,2,7,0,-2,1,-1,0,5,1,1,1,0,2,6,0,0,0,0,-1,6,FALSE,1,86,TRUE,1,100,TRUE,0,100,FALSE,1,82,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,78,FALSE,0,68,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,0,72,TRUE,0,100,TRUE,1,94,TRUE,1,61,TRUE,0,66,TRUE,1,72,TRUE,0,75,TRUE,1,80,TRUE,0,75,TRUE,0,87,TRUE,0,92,TRUE,1,97,TRUE,1,100,TRUE,1,100,0,0.04,0,0,0,0,0.0784,0,1,0.1521,0.0009,0.4624,0,1,0.0025,0,0.4356,0.0324,0.7569,0.5625,0.0036,0,0.5184,0,0.6561,0.5625,0,0.0196,1,1,0.8464,0.0484,0.326382143,0.226021429,0.426742857,24,75,20,62.5,5,62.5,4,50,6,75,5,62.5,15,93.75,5,31.25,89.41,91.12,87,87.75,91.75,91.69,87.12,12.5,26.91,28.62,37,12.75,29.25,-2.06,55.87,1,0,0,0,0,1,1,0,1,1,0,0,1,1,1,1,2,0,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,1,1,0,1,0.2,0.8,0.6,1,0,0.6,0,0.6,0.65,0.3,0.475,7.33,6,6.125,0.2,0.2,0.6,0.4,0.333333333,0,2,2,-3,1.33,1,1,2,-1,1,2,-2,0,0,-2,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),73,None,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,9,8,3,6,5,7,4,1,2,2,3,4,1 +136,R_6VvkzF78AK1eC8F,53 - 59,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Disagree,Neither agree nor disagree,4,5,2,1,3,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,5,4,3,1,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,1,4,2,5,Agree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,1,3,2,4,5,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,3,4,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,4,5,3,8,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Agree,4,5,2,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,8,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,3,5,6,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,4,2,5,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,4,5,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,61,TRUE,87,TRUE,91,TRUE,54,TRUE,53,TRUE,77,FALSE,88,TRUE,82,TRUE,59,TRUE,58,TRUE,51,TRUE,51,FALSE,55,TRUE,79,TRUE,54,TRUE,68,TRUE,53,TRUE,90,TRUE,63,TRUE,62,TRUE,53,TRUE,55,FALSE,53,TRUE,74,TRUE,64,FALSE,100,FALSE,50,FALSE,53,FALSE,100,FALSE,51,FALSE,52,18,1,2,2,-2,0,-1,1,2,0,0,2,1,2,1,2,-1,1,1,1,2,2,2,2,-1,0,7,-1,-1,1,1,0,6,1,1,1,1,1,8,-1,-1,-1,-1,2,8,2,1,2,0,0,8,-1,0,2,0,0,6,2,2,2,0,2,8,1,1,1,1,2,7,FALSE,1,52,FALSE,0,51,FALSE,1,100,FALSE,1,53,FALSE,0,50,FALSE,1,100,TRUE,1,64,TRUE,1,74,FALSE,0,53,TRUE,1,55,TRUE,0,53,TRUE,0,62,TRUE,1,63,TRUE,0,90,TRUE,1,53,TRUE,1,68,TRUE,0,54,TRUE,0,79,FALSE,1,55,TRUE,0,51,TRUE,1,51,TRUE,1,58,TRUE,0,59,TRUE,1,82,FALSE,1,88,TRUE,1,77,TRUE,0,53,TRUE,0,54,TRUE,0,91,TRUE,1,87,TRUE,1,61,TRUE,1,100,0.0676,0.0529,0.1024,0.1296,0,0,0.0324,0.2025,0.2601,0.1764,0.0169,0.1369,0.2809,0.2809,0.25,0.2601,0.3481,0.2209,0.2916,0.0144,0.2401,0.2209,0.2025,0.81,0.2916,0.2809,0.1521,0.2304,0,0.6241,0.8281,0.3844,0.251328571,0.17615,0.326507143,18,56.25,19,59.38,4,50,4,50,6,75,5,62.5,13,81.25,6,37.5,66.91,54,71,70.38,72.25,65.44,68.38,-3.13,7.53,4,21,-4.62,9.75,-15.81,30.88,1,0,0,1,0,0,2,1,1,0,1,0,1,0,1,0,2,2,2,0,1,1,0,2,0,0,1,0,0,0,0,1,0,1,0,2,0,0,0,0,0.4,0.8,0.6,1.2,0.8,0.2,0.4,0.4,0.75,0.45,0.6,7,7.33,7.25,-0.4,0.6,0.2,0.8,0.133333333,-1,0,0,1,-0.33,0,0,0,-1,1,-1,1,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),54,none at this time,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,2,3,5,6,9,7,8,1,4,3,4,2,1 +137,R_3SBOkbknaMoB7Mv,53 - 59,,Canadian,Canadian,Male,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,1,2,4,5,3,Disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Somewhat disagree,1,2,4,3,5,Agree,Agree,Agree,Disagree,Agree,4,2,5,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,4,1,3,Agree,Somewhat agree,Agree,Disagree,Agree,3,2,4,1,5,3,Disagree,Disagree,Agree,Disagree,Somewhat agree,2,1,3,4,5,2,Agree,Agree,Agree,Disagree,Agree,1,5,2,3,4,4,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,3,4,2,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Agree,Agree,3,5,2,1,4,2,Disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,5,4,2,1,3,2,Agree,Agree,Somewhat Agree,Disagree,Somewhat Agree,1,5,3,2,4,2,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,5,4,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,55,TRUE,60,TRUE,92,FALSE,54,TRUE,87,FALSE,51,TRUE,64,FALSE,66,FALSE,55,TRUE,53,TRUE,53,FALSE,55,TRUE,100,TRUE,58,TRUE,90,TRUE,83,FALSE,85,TRUE,63,FALSE,91,TRUE,96,TRUE,93,FALSE,54,FALSE,100,TRUE,53,TRUE,84,TRUE,100,FALSE,71,TRUE,67,FALSE,57,TRUE,100,TRUE,100,TRUE,76,23,2,1,3,1,2,-2,0,3,-1,-1,2,2,2,-2,2,1,1,1,1,1,2,1,2,-2,2,3,-2,-2,2,-2,1,2,2,2,2,-2,2,4,1,2,1,1,2,2,2,1,2,2,2,2,-2,-1,2,-1,-1,2,2,2,1,-2,1,2,1,0,2,1,1,6,TRUE,0,76,TRUE,1,100,TRUE,0,100,FALSE,1,57,TRUE,1,67,FALSE,1,71,TRUE,1,100,TRUE,1,84,TRUE,1,53,FALSE,0,100,FALSE,1,54,TRUE,0,93,TRUE,1,96,FALSE,1,91,TRUE,1,63,FALSE,0,85,TRUE,0,83,TRUE,0,90,TRUE,0,58,TRUE,0,100,FALSE,0,55,TRUE,1,53,TRUE,0,53,FALSE,0,55,FALSE,1,66,TRUE,1,64,FALSE,1,51,TRUE,0,87,FALSE,1,54,TRUE,1,92,TRUE,1,60,TRUE,1,55,0.0256,0.1296,0.7225,0,0.2025,0.0841,0.3025,1,1,0.2209,0.0064,0.0016,0.2209,0.2116,0.1089,0,0.2809,0.1849,0.7569,0.1156,0.3025,0.1369,0.3364,0.0081,0.6889,0.2401,0.16,0.5776,1,0.81,0.2116,0.8649,0.358382143,0.273228571,0.443535714,23,71.88,19,59.38,7,87.5,5,62.5,5,62.5,2,25,12,75,7,43.75,73.94,62,66.75,80,87,73.88,74,12.5,14.56,-25.5,4.25,17.5,62,-1.12,30.25,0,0,1,3,0,0,2,1,1,2,0,0,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,1,1,0,0,0.8,1.2,0,0.4,0.4,0.4,0.4,0.4,0.6,0.4,0.5,3,2,2.875,0.4,0.8,-0.4,0,0.266666667,1,0,2,-4,1,1,0,1,-2,2,2,-2,1,-1,-1,1,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,57,Will I see my results,0,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,4,7,9,5,8,6,3,1,2,2,4,3,1 +138,R_5OACV3KWceUn6UF,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,2,5,1,4,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,5,4,2,1,3,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,5,2,1,3,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Strongly disagree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat disagree,4,3,1,5,2,5,Strongly disagree,Somewhat agree,Somewhat disagree,Agree,Disagree,1,3,5,4,2,3,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,1,5,3,4,4,Disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,2,3,4,1,5,0,Disagree,Disagree,Strongly agree,Disagree,Strongly agree,5,4,1,3,2,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,1,5,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,3,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,79,TRUE,50,FALSE,50,TRUE,50,TRUE,75,TRUE,50,TRUE,80,FALSE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,81,TRUE,100,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,100,TRUE,91,FALSE,92,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,6,3,3,3,-2,3,-1,-2,3,0,3,3,0,3,-1,3,-1,1,2,0,-3,3,3,3,-3,-1,4,-3,1,-1,2,-2,5,2,0,0,0,1,3,-2,-2,-3,-2,-3,4,3,3,3,-2,3,2,-2,-2,3,-2,3,0,3,0,3,0,3,0,0,0,0,0,-2,3,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,92,TRUE,1,91,TRUE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,81,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,80,TRUE,0,50,TRUE,1,75,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,79,TRUE,1,50,TRUE,1,100,0,0.0625,0.25,0.0081,0,0.0064,0.04,0.25,0.25,0.25,0.0441,0,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.6561,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.214164286,0.149321429,0.279007143,6,18.75,18,56.25,3,37.5,6,75,4,50,5,62.5,14,87.5,4,25,62.44,50,74,62.12,63.62,67.19,57.69,-37.5,6.19,12.5,-1,12.12,1.12,-20.31,32.69,0,0,0,1,4,2,3,4,2,5,1,0,3,1,2,1,3,5,2,0,0,0,0,0,0,1,0,0,2,0,0,0,0,1,0,1,1,2,0,1,1,3.2,1.4,2.2,0,0.6,0.2,1,1.95,0.45,1.2,4,0.67,2.625,1,2.6,1.2,1.2,1.6,2,5,3,1,3.33,1,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,43,,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,2,8,5,3,9,7,4,1,6,2,4,3,1 +139,R_13Wi1nBilcnuUPc,67 - 73,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,5,1,4,2,3,Somewhat agree,Disagree,Somewhat disagree,Strongly agree,Somewhat agree,5,3,1,4,2,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,4,5,3,2,1,Somewhat agree,Agree,Somewhat agree,Strongly Agree,Somewhat agree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Agree,Somewhat agree,Strongly disagree,Strongly Agree,2,3,5,1,4,7,Somewhat agree,Disagree,Agree,Agree,Agree,4,1,3,2,5,6,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,3,1,5,4,8,Somewhat agree,Agree,Agree,Strongly Agree,Somewhat agree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Disagree,Strongly Agree,Agree,Strongly disagree,3,4,5,2,1,9,Somewhat disagree,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,4,5,3,1,2,5,Disagree,Agree,Somewhat Disagree,Somewhat Agree,Strongly agree,2,1,3,4,5,9,Disagree,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,5,4,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,90,TRUE,65,FALSE,56,FALSE,100,FALSE,53,TRUE,96,FALSE,95,FALSE,53,FALSE,73,TRUE,91,FALSE,75,FALSE,99,FALSE,55,FALSE,93,FALSE,56,TRUE,100,TRUE,54,TRUE,92,TRUE,88,TRUE,99,TRUE,66,FALSE,100,TRUE,63,TRUE,100,TRUE,99,FALSE,100,FALSE,79,FALSE,73,FALSE,87,TRUE,92,TRUE,86,19,3,1,3,-1,2,1,-2,-1,3,1,2,2,2,-1,3,1,2,1,3,1,3,2,1,-3,3,6,1,-2,2,2,2,7,1,3,3,2,3,6,1,2,2,3,1,8,3,-2,3,2,-3,9,-1,1,-3,3,-3,9,-2,2,-1,1,3,5,-2,-2,-2,0,1,9,TRUE,0,86,TRUE,1,92,FALSE,1,87,FALSE,1,73,FALSE,0,79,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,63,FALSE,0,100,TRUE,0,66,TRUE,0,99,TRUE,1,88,TRUE,0,92,TRUE,1,54,TRUE,1,100,FALSE,1,56,FALSE,1,93,FALSE,1,55,FALSE,1,99,FALSE,0,75,TRUE,1,91,FALSE,1,73,FALSE,0,53,FALSE,1,95,TRUE,1,96,FALSE,1,53,FALSE,1,100,FALSE,1,56,TRUE,1,65,TRUE,1,90,TRUE,1,100,0,0.0016,0,0.0001,0,0,0.2809,1,0.0001,0.0081,0.1225,0.0144,0.1369,0.4356,0.6241,0.0064,0.0729,0.0729,0,0.0025,0.5625,0.2116,0.2025,0.8464,0.1936,0.2209,0.01,0.7396,0.0169,0.0049,0.1936,0.9801,0.248567857,0.1982,0.298935714,19,59.38,24,75,7,87.5,6,75,5,62.5,6,75,12,75,12,75,82.12,68.25,78.38,94,87.88,84.06,80.19,-15.62,7.12,-19.25,3.38,31.5,12.88,9.06,5.19,0,1,2,2,1,0,0,3,1,1,1,1,1,3,0,0,0,1,0,0,0,3,0,3,5,2,3,2,0,4,4,0,3,2,0,3,4,3,3,0,1.2,1,1.2,0.2,2.2,2.2,1.8,2.6,0.9,2.2,1.55,6.33,7.67,7.375,-1,-1.2,-0.6,-2.4,-0.933333333,-3,-2,1,-1,-1.34,0,2,0,-1,1,1,-1,2,-2,1,-1,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),70,Waaaaay to long and confusing,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,4,5,3,2,8,9,7,1,6,4,2,3,1 +140,R_5OYQlm06tBC3oYW,67 - 73,,Canadian,Canadian,Male,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,4,3,5,1,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,5,1,3,2,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,2,4,5,Agree,Strongly Agree,Agree,Strongly Agree,Agree,1,5,3,2,4,Agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat disagree,5,4,3,2,1,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,2,5,4,1,1,Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Agree,5,2,4,3,1,2,Somewhat agree,Agree,Agree,Agree,Agree,3,1,5,4,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,1,5,4,3,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,2,5,4,1,2,Agree,Strongly Agree,Agree,Somewhat Disagree,Agree,3,1,4,5,2,1,Agree,Somewhat agree,Strongly Agree,Agree,Agree,3,4,1,5,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,86,FALSE,100,TRUE,60,TRUE,100,TRUE,100,TRUE,100,TRUE,85,TRUE,100,TRUE,100,FALSE,100,TRUE,95,TRUE,100,TRUE,65,TRUE,100,TRUE,90,TRUE,100,FALSE,96,FALSE,100,TRUE,75,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,28,3,0,0,1,-1,-2,0,1,-1,0,1,2,1,0,1,2,3,2,3,2,2,0,-2,0,-1,1,-1,-1,1,-1,-1,1,2,3,1,-1,2,2,1,2,2,2,2,2,2,1,-1,1,-1,3,0,-1,1,-1,-1,2,2,3,2,-1,2,1,2,1,3,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,FALSE,0,96,TRUE,0,100,TRUE,1,90,TRUE,1,100,TRUE,0,65,TRUE,0,100,TRUE,0,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,0,0,0,0,0.9216,0,0.5625,0,0,0.7225,0.25,0,1,0,0.01,0.9025,1,0.4225,0.36,0,1,1,1,0.7396,0,0.353257143,0.175471429,0.531042857,28,87.5,18,56.25,4,50,4,50,3,37.5,7,87.5,14,87.5,4,25,93.81,83.75,91.5,100,100,99.12,88.5,31.25,37.56,33.75,41.5,62.5,12.5,11.62,63.5,1,0,2,1,0,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,0,0,2,1,0,0,1,1,1,1,1,1,0,2,1,1,0,0.8,0.6,0.8,0.6,0.6,0.8,1,0.8,0.7,0.8,0.75,1.33,2,1.75,0.2,-0.2,-0.2,-0.2,-0.066666667,-2,-1,1,0,-0.67,0,0,0,0,0,-1,1,1,-1,1,-1,0,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),73,quiet enjoyable was glad to be able to take part best of luck with your study,-0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,6,5,7,2,9,4,3,1,8,3,4,2,1 +141,R_6JgOAENdUiQE35f,67 - 73,American,,American,Female,Strongly agree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly agree,3,2,1,5,4,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat disagree,2,1,3,5,4,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,2,5,3,4,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,5,3,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly Agree,3,2,5,4,1,2,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,2,4,1,5,3,4,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,4,2,3,5,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,4,5,1,2,3,5,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,5,2,3,4,1,6,Agree,Strongly agree,Strongly agree,Somewhat Agree,Agree,1,2,3,4,5,7,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,Agree,2,4,1,3,5,TRUE,96,TRUE,100,FALSE,100,TRUE,50,TRUE,96,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,76,FALSE,91,TRUE,100,TRUE,100,TRUE,100,FALSE,84,TRUE,100,TRUE,100,FALSE,100,TRUE,87,TRUE,100,TRUE,76,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,1,-1,3,-1,1,3,-1,-1,2,2,3,1,2,1,1,2,2,2,3,1,1,-1,3,6,-1,-1,3,1,0,2,2,3,3,1,2,4,1,1,1,1,1,5,3,1,1,1,2,6,-2,0,2,1,-1,5,2,3,3,1,2,6,1,-1,1,2,2,7,TRUE,0,96,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,96,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,FALSE,1,91,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,84,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,87,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0.5776,1,0,0,0,0,0.0081,0.0016,0,0,0.25,0,0,0.0576,0.7056,0.7569,1,1,0.25,0,0.9216,0,0,1,1,0.304607143,0.131235714,0.477978571,30,93.75,22,68.75,5,62.5,6,75,5,62.5,6,75,14,87.5,8,50,93.94,82.75,96.5,96.5,100,95.75,92.12,25,25.19,20.25,21.5,34,25,8.25,42.12,0,0,0,0,0,0,2,0,2,1,0,1,0,0,0,0,0,1,1,1,0,0,0,2,1,1,1,1,2,0,0,1,0,0,0,0,2,1,0,0,0,1,0.2,0.6,0.6,1,0.2,0.6,0.45,0.6,0.525,4,5.67,5.125,-0.6,0,0,0,-0.2,0,-3,-2,-2,-1.67,0,1,2,-2,2,1,-1,0,0,-2,2,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,7,3,4,9,6,5,2,1,8,4,3,2,1 +142,R_7PFea8DfeKrRjGW,67 - 73,American,,American,Male,Somewhat agree,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,2,1,3,4,5,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Somewhat agree,2,5,1,4,3,Strongly Agree,Agree,Agree,Somewhat Disagree,Somewhat Agree,5,4,2,1,3,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat disagree,5,3,4,1,2,Neither agree nor disagree,Strongly Agree,Agree,Somewhat agree,Agree,1,5,3,4,2,0,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,3,2,1,4,5,0,Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,4,2,1,3,5,3,Agree,Agree,Somewhat agree,Agree,Somewhat agree,4,5,1,2,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Somewhat agree,Disagree,5,3,2,4,1,1,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,5,1,3,2,4,1,Agree,Agree,Agree,Somewhat Agree,Agree,1,4,5,2,3,1,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,5,3,4,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,95,TRUE,100,TRUE,100,FALSE,57,FALSE,50,FALSE,74,TRUE,100,TRUE,85,TRUE,82,TRUE,93,FALSE,77,TRUE,84,TRUE,85,TRUE,73,FALSE,60,TRUE,100,FALSE,79,TRUE,86,TRUE,58,FALSE,100,TRUE,58,FALSE,57,FALSE,64,FALSE,61,TRUE,60,TRUE,98,FALSE,50,FALSE,74,TRUE,56,TRUE,95,TRUE,97,TRUE,81,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,1,0,0,-3,2,-2,1,3,2,2,-1,1,-1,1,2,2,-1,0,3,2,1,2,0,0,-2,2,-2,2,0,2,-1,2,1,2,3,2,2,1,2,1,1,1,2,2,1,-2,1,0,-2,2,-2,2,1,2,2,2,1,2,1,2,1,2,2,-1,4,TRUE,0,95,TRUE,1,100,TRUE,0,100,FALSE,1,57,FALSE,0,50,FALSE,1,74,TRUE,1,100,TRUE,1,85,TRUE,1,82,TRUE,1,93,FALSE,1,77,TRUE,0,84,TRUE,1,85,TRUE,0,73,FALSE,0,60,TRUE,1,100,FALSE,1,79,TRUE,0,86,TRUE,0,58,FALSE,1,100,TRUE,1,58,FALSE,0,57,FALSE,1,64,FALSE,0,61,TRUE,0,60,TRUE,1,98,FALSE,1,50,FALSE,1,74,TRUE,0,56,TRUE,1,95,TRUE,1,97,TRUE,1,81,0.0225,0.0004,0,0,0.0361,0.0676,0.3721,0.0049,0,0.3249,0.0025,0.0225,0.0324,0.0529,0.25,0,0.1296,0.1849,0.0676,0.36,0.1764,0.36,0.3364,0.5329,0.0441,0.25,0.0009,0.9025,1,0.7396,0.3136,0.7056,0.259642857,0.105742857,0.413542857,24,75,20,62.5,6,75,6,75,3,37.5,5,62.5,12,75,8,50,77.78,72.62,68.38,82.75,87.38,81.38,74.19,12.5,15.28,-2.38,-6.62,45.25,24.88,6.38,24.19,1,0,0,0,2,0,1,0,0,1,1,3,0,2,1,3,1,1,0,2,0,1,0,0,2,0,1,0,0,1,1,0,0,2,1,3,0,0,0,0,0.6,0.4,1.4,1.4,0.6,0.4,0.8,0.6,0.95,0.6,0.775,1,1,1.375,0,0,0.6,0.8,0.2,-1,-1,2,-3,0,1,2,2,-1,1,1,-1,-1,1,-1,1,1,10 cents,5 minutes,24 days,Male,Trade School (non-military),73,"Everything is going just fine so far. +",1,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,5,2,6,3,8,9,7,1,4,2,3,4,1 +143,R_7w7DRq89EHLmPTW,67 - 73,American,,American,Male,Strongly agree,Agree,Agree,Disagree,Neither agree nor disagree,2,1,5,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,2,4,1,3,5,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,3,2,5,4,Strongly Agree,Agree,Agree,Disagree,Somewhat agree,1,3,4,2,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,3,4,5,1,3,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,4,3,2,1,1,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,4,3,5,2,1,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,3,5,4,2,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,5,3,1,2,4,2,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,5,2,1,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,97,TRUE,96,FALSE,65,FALSE,59,TRUE,64,FALSE,87,TRUE,90,TRUE,80,TRUE,74,TRUE,73,FALSE,70,TRUE,85,TRUE,61,TRUE,87,FALSE,57,TRUE,97,FALSE,58,TRUE,61,TRUE,76,FALSE,100,TRUE,77,TRUE,80,FALSE,83,TRUE,84,TRUE,79,TRUE,82,TRUE,53,FALSE,91,TRUE,83,TRUE,83,FALSE,65,TRUE,66,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-2,0,-1,0,1,2,0,2,2,2,1,3,0,0,0,0,1,3,2,2,-2,1,2,0,0,0,1,-1,3,2,2,1,0,2,1,1,1,0,0,0,3,3,2,2,0,1,1,-1,-1,0,1,0,3,2,0,1,1,2,2,1,0,2,1,1,3,FALSE,1,97,TRUE,1,96,FALSE,1,65,FALSE,1,59,TRUE,1,64,FALSE,1,87,TRUE,1,90,TRUE,1,80,TRUE,1,74,TRUE,1,73,FALSE,1,70,TRUE,0,85,TRUE,1,61,TRUE,0,87,FALSE,0,57,TRUE,1,97,FALSE,1,58,TRUE,0,61,TRUE,0,76,FALSE,1,100,TRUE,1,77,TRUE,1,80,FALSE,1,83,TRUE,1,84,TRUE,0,79,TRUE,1,82,TRUE,0,53,FALSE,1,91,TRUE,0,83,TRUE,1,83,FALSE,0,65,TRUE,1,66,0.04,0.0324,0.0009,0.01,0.1156,0.0169,0.0256,0.0729,0,0.04,0.0289,0.1521,0.0676,0.09,0.1296,0.0016,0.0289,0.1681,0.0081,0.6241,0.0529,0.3249,0.5776,0.7569,0.1764,0.2809,0.4225,0.0009,0.1225,0.3721,0.6889,0.7225,0.21675,0.066985714,0.366514286,17,53.13,23,71.88,4,50,7,87.5,5,62.5,7,87.5,14,87.5,9,56.25,76.97,68.75,72.38,81.12,85.62,76.81,77.12,-18.75,5.09,18.75,-15.12,18.62,-1.88,-10.69,20.87,0,0,0,0,1,1,0,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,2,1,0,1,1,1,0,0,2,1,0,1,1,0,2,1,0,0.2,0.8,0.6,0.6,0.6,0.6,0.8,0.8,0.55,0.7,0.625,2,2,2.25,-0.4,0.2,-0.2,-0.2,-0.133333333,1,0,-1,0,0,1,1,1,-1,1,0,0,0,0,0,0,0,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,71,well done,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,4,3,6,8,2,5,9,1,7,3,2,4,1 +144,R_5guQAIjetvIDuH6,67 - 73,American,,American,Male,Somewhat disagree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,4,1,2,5,3,Agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,1,3,5,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,5,2,4,1,3,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat agree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,2,5,3,4,1,0,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,2,4,5,1,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,2,1,3,4,5,0,Agree,Agree,Agree,Agree,Agree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Strongly Agree,Agree,Strongly Agree,Disagree,2,1,5,4,3,7,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Disagree,4,5,1,2,3,7,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Neither Agree nor Disagree,3,2,5,4,1,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,1,4,5,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,100,TRUE,96,TRUE,98,FALSE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,96,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,90,FALSE,50,TRUE,50,TRUE,96,TRUE,92,FALSE,100,TRUE,97,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,98,FALSE,50,TRUE,97,23,-1,3,3,1,0,2,1,3,1,1,3,3,3,-3,0,2,1,2,3,1,0,3,3,1,0,2,3,1,3,1,-1,0,3,3,3,-3,0,0,2,2,2,2,2,0,2,3,2,3,-2,0,0,1,3,1,-2,7,3,3,1,-3,0,7,1,0,1,2,1,7,TRUE,0,97,FALSE,0,50,TRUE,0,98,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,97,FALSE,1,100,TRUE,0,92,TRUE,1,96,TRUE,0,50,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,98,TRUE,1,96,TRUE,1,100,TRUE,1,96,0,0,0.01,0,0.0016,0.25,0.25,0.0009,0.25,0.25,0.0016,0.0016,0.25,0,0.25,0.25,0.25,0.25,0,0.25,0.0016,0.25,0.25,0.25,0.25,0.25,0,0.9409,0.9604,1,0.9604,0.8464,0.302335714,0.161121429,0.44355,23,71.88,20,62.5,5,62.5,6,75,4,50,5,62.5,11,68.75,9,56.25,75.19,62.5,73.25,80.5,84.5,79.44,70.94,9.38,12.69,0,-1.75,30.5,22,10.69,14.69,1,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,1,1,3,0,1,2,2,2,0,0,0,3,0,0,2,0,0,1,1,1,1,0,0.2,0.6,0,0.6,1.6,1,0.4,0.8,0.35,0.95,0.65,0.67,4.67,2.875,-1.4,-0.4,-0.4,-0.2,-0.733333333,2,-7,-7,-7,-4,1,2,1,-2,2,1,-1,-1,1,-2,2,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),73,,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,8,4,9,3,7,2,5,1,6,4,3,2,1 +145,R_1Yb2YCDG83IHgrM,53 - 59,,Canadian,Canadian,Female,Agree,Somewhat agree,Neither agree nor disagree,Agree,Agree,3,2,5,4,1,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,5,1,4,2,3,Agree,Disagree,Agree,Agree,Strongly Agree,1,4,3,5,2,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,5,1,2,3,4,Agree,Agree,Somewhat agree,Somewhat disagree,Strongly Agree,4,5,2,3,1,5,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Disagree,1,3,4,2,5,4,Somewhat Agree,Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,1,5,3,4,2,3,Disagree,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,5,1,3,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,4,Strongly disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,4,2,5,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,1,5,2,4,3,3,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,1,2,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,TRUE,53,TRUE,89,TRUE,56,TRUE,54,TRUE,54,TRUE,54,TRUE,54,TRUE,53,TRUE,54,TRUE,87,TRUE,65,TRUE,62,FALSE,55,TRUE,79,TRUE,70,TRUE,80,TRUE,53,TRUE,53,TRUE,86,TRUE,80,TRUE,53,FALSE,53,FALSE,55,TRUE,53,TRUE,95,TRUE,54,TRUE,71,TRUE,53,TRUE,54,TRUE,54,FALSE,85,5,2,1,0,2,2,-3,0,2,-2,1,2,-2,2,2,3,-2,-1,-1,-1,-3,2,2,1,-1,3,5,-3,0,1,-1,-2,4,1,-2,1,3,1,3,-2,-3,-2,-3,-3,5,0,0,0,1,0,4,-3,-2,3,-2,0,2,0,0,0,-1,1,3,-2,-1,0,0,-3,5,FALSE,1,85,TRUE,1,54,TRUE,0,54,TRUE,0,53,TRUE,1,71,TRUE,0,54,TRUE,1,95,TRUE,1,53,FALSE,0,55,FALSE,0,53,TRUE,0,53,TRUE,0,80,TRUE,1,86,TRUE,0,53,TRUE,1,53,TRUE,1,80,TRUE,0,70,TRUE,0,79,FALSE,1,55,TRUE,0,62,TRUE,1,65,TRUE,1,87,TRUE,0,54,TRUE,1,53,TRUE,0,54,TRUE,1,54,TRUE,0,54,TRUE,0,54,TRUE,0,56,TRUE,1,89,TRUE,1,53,FALSE,0,50,0.2209,0.2116,0.04,0.0025,0.25,0.2916,0.2209,0.2809,0.3844,0.0169,0.0121,0.0196,0.3025,0.2809,0.0841,0.2116,0.2916,0.2809,0.2916,0.2916,0.1225,0.2209,0.2025,0.2809,0.49,0.2916,0.2209,0.0225,0.2916,0.6241,0.3136,0.64,0.258296429,0.209142857,0.30745,5,15.63,15,46.88,4,50,3,37.5,4,50,4,50,13,81.25,2,12.5,63.16,53.75,63.25,70,65.62,65.69,60.62,-31.25,16.28,3.75,25.75,20,15.62,-15.56,48.12,0,1,1,3,1,0,0,1,1,3,1,0,1,1,2,0,2,1,2,0,2,1,0,1,2,0,2,1,0,1,2,2,2,3,2,0,0,1,1,0,1.2,1,1,1,1.2,0.8,2.2,0.4,1.05,1.15,1.1,4,3,3.875,0,0.2,-1.2,0.6,-0.333333333,1,2,0,0,1,1,2,2,-2,2,0,0,-1,1,-2,2,1,5 cents,100 minutes,36 days,Female,High School (or equivalent),59,The survey is too long and questions are too competitive that will easily make people loosing patience in answering.,1.375,1,0,0,0,1,0,0.33,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,6,2,8,4,9,3,7,1,5,3,2,4,1 +146,R_5OOEIEnQs4N8XqD,60 - 66,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Somewhat disagree,Strongly agree,2,4,3,1,5,Somewhat agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,1,3,2,4,5,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Strongly Agree,1,2,3,5,4,Strongly Agree,Agree,Agree,Disagree,Somewhat agree,5,4,1,2,3,2,Agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,3,2,1,0,Somewhat Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,1,3,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,4,2,5,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Neither agree nor disagree,Agree,1,5,3,2,4,0,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,1,2,4,5,5,Neither Agree nor Disagree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,2,3,1,0,Somewhat agree,Somewhat agree,Strongly Agree,Strongly Agree,Disagree,4,3,2,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,76,TRUE,100,TRUE,92,TRUE,100,TRUE,77,TRUE,100,TRUE,91,TRUE,100,FALSE,81,TRUE,100,TRUE,91,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,80,FALSE,100,TRUE,100,TRUE,100,27,3,2,2,-1,3,1,1,3,-3,1,0,1,3,-3,3,0,0,0,3,3,3,2,2,-2,1,2,2,0,3,-3,3,0,1,2,3,-3,3,0,3,3,3,3,2,1,3,2,2,0,2,0,0,0,3,-3,0,5,0,2,3,-3,3,0,1,1,3,3,-2,3,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,81,TRUE,0,100,TRUE,1,91,TRUE,0,100,TRUE,1,77,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0081,0.0081,0.0361,0,0,0,0.04,0.25,0,0.25,0.0529,0.5776,1,0.8464,0.25,0.25,1,0,1,1,1,0.270328571,0.006592857,0.534064286,27,84.38,23,71.88,5,62.5,6,75,5,62.5,7,87.5,15,93.75,8,50,90.25,75.62,91.62,100,93.75,91.19,89.31,12.5,18.37,13.12,16.62,37.5,6.25,-2.56,39.31,0,0,0,1,2,1,1,0,0,2,1,1,0,0,0,3,3,3,0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,0,0,1,1,3,0,5,0.6,0.8,0.4,2,0.4,0.6,0.2,2,0.95,0.8,0.875,0.67,1.67,1.375,0.2,0.2,0.2,0,0.2,2,-5,0,-2,-1,0,2,0,-2,2,1,-1,0,0,-2,2,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,This was fun! I really enjoyed doing this survey.,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,7,3,4,8,2,9,6,1,5,2,4,3,1 +147,R_6KAyi2mZ8RoW8oh,60 - 66,,Canadian,Canadian,Male,Agree,Strongly agree,Somewhat disagree,Somewhat disagree,Agree,1,3,4,5,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,4,2,1,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,4,3,5,1,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,5,1,4,3,Agree,Strongly Agree,Somewhat disagree,Somewhat disagree,Agree,3,2,1,5,4,7,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,3,4,1,2,8,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Somewhat Agree,2,3,5,1,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat disagree,Somewhat disagree,Agree,5,1,3,4,2,9,Somewhat agree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,4,1,2,5,3,8,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Disagree,Agree,4,5,3,1,2,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,5,2,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,55,TRUE,64,TRUE,80,FALSE,50,TRUE,55,FALSE,85,TRUE,79,TRUE,76,TRUE,63,TRUE,69,FALSE,57,FALSE,91,FALSE,66,FALSE,61,FALSE,55,TRUE,100,FALSE,79,TRUE,73,TRUE,69,TRUE,100,FALSE,59,TRUE,61,TRUE,58,TRUE,100,FALSE,57,TRUE,75,TRUE,58,TRUE,70,TRUE,100,TRUE,100,FALSE,63,TRUE,89,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,-1,-1,2,1,-2,1,-2,0,1,0,2,-1,1,1,1,2,1,1,2,3,-1,-1,2,7,1,-2,1,-2,1,8,1,-1,2,-1,1,8,1,1,1,1,1,8,2,3,-1,-1,2,9,1,-2,1,-2,0,8,1,-1,1,-2,2,8,1,1,2,1,1,8,FALSE,1,55,TRUE,1,64,TRUE,0,80,FALSE,1,50,TRUE,1,55,FALSE,1,85,TRUE,1,79,TRUE,1,76,TRUE,1,63,TRUE,1,69,FALSE,1,57,FALSE,1,91,FALSE,0,66,FALSE,1,61,FALSE,0,55,TRUE,1,100,FALSE,1,79,TRUE,0,73,TRUE,0,69,TRUE,0,100,FALSE,0,59,TRUE,1,61,TRUE,0,58,TRUE,1,100,FALSE,1,57,TRUE,1,75,TRUE,0,58,TRUE,0,70,TRUE,0,100,TRUE,1,100,FALSE,0,63,TRUE,1,89,0.0576,0.0625,0,0.0441,0.0121,0.0225,0,0.0961,1,0.1521,0,0.4356,0.1369,0.1849,0.2025,0.1296,0.3364,0.25,0.49,0.1849,0.3481,0.3025,0.4761,0.1521,0.0441,0.3364,0.3969,0.2025,0.64,0.5329,1,0.0081,0.288332143,0.211335714,0.365328571,20,62.5,20,62.5,4,50,4,50,7,87.5,5,62.5,12,75,8,50,72.41,59.88,73.88,66.25,89.62,73.38,71.44,0,9.91,9.88,23.88,-21.25,27.12,-1.62,21.44,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0.2,0.2,0.2,0,0,0.8,0,0.15,0.2,0.175,7.67,8.33,8,0,0.2,-0.6,0.2,-0.133333333,-2,0,0,0,-0.66,0,1,1,-1,1,-1,1,-1,1,-1,1,-1,5 cents,5 minutes,47 days,Male,Trade School (non-military),62,no comment,0.625,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,7,5,8,9,6,4,1,2,3,2,4,1 +148,R_19xzfsLiRU0FSEh,53 - 59,,Canadian,Canadian,Female,Agree,Somewhat agree,Agree,Strongly disagree,Neither agree nor disagree,1,4,5,2,3,Somewhat agree,Disagree,Strongly agree,Disagree,Somewhat agree,3,4,1,5,2,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,3,4,5,Agree,Agree,Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Somewhat agree,Strongly disagree,Agree,3,2,1,4,5,1,Somewhat agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,5,3,2,1,4,1,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly Agree,4,2,3,1,5,3,Agree,Agree,Agree,Agree,Agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,3,2,1,4,5,0,Somewhat agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,3,4,1,5,2,0,Strongly agree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,4,3,2,1,Agree,Agree,Agree,Agree,Strongly Agree,1,4,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,85,TRUE,92,TRUE,100,FALSE,100,FALSE,50,TRUE,87,TRUE,60,FALSE,82,FALSE,100,TRUE,81,FALSE,75,FALSE,50,FALSE,59,TRUE,92,FALSE,50,TRUE,86,FALSE,50,FALSE,76,TRUE,70,TRUE,55,FALSE,50,TRUE,81,TRUE,85,TRUE,97,TRUE,81,FALSE,63,TRUE,70,FALSE,50,FALSE,100,FALSE,50,FALSE,50,17,2,1,2,-3,0,1,-2,3,-2,1,3,-1,3,-1,3,2,2,2,3,3,2,2,1,-3,2,4,1,-2,3,-2,0,1,3,0,2,-1,3,1,2,2,2,2,2,3,2,1,2,-2,0,1,1,-2,3,-2,0,0,3,-1,3,-1,3,0,2,2,2,2,3,1,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,70,FALSE,1,63,TRUE,1,81,TRUE,1,97,TRUE,1,85,TRUE,1,81,FALSE,1,50,TRUE,0,55,TRUE,1,70,FALSE,1,76,FALSE,0,50,TRUE,1,86,FALSE,1,50,TRUE,0,92,FALSE,1,59,FALSE,1,50,FALSE,0,75,TRUE,1,81,FALSE,1,100,FALSE,0,82,TRUE,0,60,TRUE,1,87,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,92,FALSE,0,85,TRUE,1,100,0.0009,0.0169,0.0196,0.0361,0,0.1369,0.6724,0.0361,0.25,0.0361,0.0064,0.09,0.0225,0.25,0.09,0.25,0,0.25,0,0.36,0.5625,0.25,0.1681,0.0576,0.25,0.25,0.7225,0.25,0,0.8464,1,0.3025,0.253928571,0.149314286,0.358542857,17,53.13,23,71.88,5,62.5,6,75,6,75,6,75,11,68.75,12,75,74.28,59.88,78.5,76,82.75,79.5,69.06,-18.75,2.4,-2.62,3.5,1,7.75,10.75,-5.94,0,1,1,0,2,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0.8,0.2,0.4,0.4,0.2,0.2,0,0.2,0.45,0.15,0.3,2,0.33,1.375,0.6,0,0.4,0.2,0.333333333,3,1,1,2,1.67,0,1,1,-2,2,-1,1,-1,1,-2,2,0,10 cents,5 minutes,36 days,Female,University - Graduate (Masters),57,"It was fun, thought provoking and made me realize that I don't know everything.",1,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,5,6,4,2,9,3,8,1,7,3,2,4,1 +149,R_3uTX9MGCaRJttCL,67 - 73,American,,American,Male,Strongly agree,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,4,5,1,3,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,5,4,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,4,1,3,2,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,2,1,5,4,3,3,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,5,4,2,3,1,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,2,4,3,5,1,6,Disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,2,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Neither agree nor disagree,Disagree,Agree,Disagree,2,1,3,4,5,2,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,1,5,2,4,2,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Strongly agree,4,5,2,1,3,4,Disagree,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,1,4,5,2,3,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,74,TRUE,100,FALSE,100,TRUE,86,TRUE,70,FALSE,100,TRUE,100,TRUE,82,FALSE,100,TRUE,87,FALSE,73,TRUE,100,FALSE,73,FALSE,65,TRUE,71,TRUE,82,TRUE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,0,-2,1,-1,-1,1,1,-1,1,1,0,2,-2,2,-1,0,1,1,-2,3,0,-1,2,0,2,-1,1,1,-1,2,3,1,0,2,-2,3,2,-2,-1,-1,0,-1,6,3,0,-2,2,-2,2,-2,0,1,-1,-1,2,1,-1,2,-2,3,2,-2,-2,0,2,-1,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,74,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,0,70,FALSE,1,100,TRUE,1,100,TRUE,1,82,FALSE,1,100,TRUE,1,87,FALSE,1,73,TRUE,1,100,FALSE,1,73,FALSE,1,65,TRUE,0,71,TRUE,1,82,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0169,0,0,0.0324,0.0324,1,0,0,0,0,0,0.25,0.1225,0.0729,0,0.5476,0.49,0,0,0.0729,0,0,1,0.7396,0.5041,0,0.174332143,0.095121429,0.253542857,24,75,26,81.25,6,75,6,75,7,87.5,7,87.5,14,87.5,12,75,91.03,83.38,96.38,92.62,91.75,95.31,86.75,-6.25,9.78,8.38,21.38,5.12,4.25,7.81,11.75,0,0,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,2,1,1,0,0,0,1,1,1,1,0,0,2,0,1,0,0,1,1,2,1,1,1,0.6,0.2,0.2,1.2,0.4,0.8,0.4,1.2,0.55,0.7,0.625,2.33,2,2.875,0.2,-0.6,-0.2,0,-0.2,0,1,0,2,0.33,0,2,2,-2,2,-2,2,0,0,-2,2,0,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),73,,1.25,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,2,9,4,8,3,6,7,1,5,3,2,4,1 +150,R_11dUwtt1T1ylv5a,67 - 73,American,,American,Male,Somewhat agree,Agree,Agree,Somewhat agree,Agree,5,3,1,4,2,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat disagree,3,5,2,1,4,Agree,Agree,Agree,Strongly Disagree,Agree,1,4,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,5,2,4,3,1,Somewhat agree,Agree,Agree,Somewhat disagree,Agree,2,5,1,3,4,1,Disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,3,1,5,2,4,3,Agree,Agree,Agree,Strongly Disagree,Agree,3,4,5,1,2,0,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,2,4,3,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Somewhat agree,Agree,Agree,4,1,5,3,2,2,Disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,2,5,4,3,1,4,Agree,Agree,Agree,Strongly Disagree,Agree,2,5,4,3,1,1,Agree,Somewhat agree,Agree,Agree,Somewhat agree,1,4,3,2,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,86,TRUE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,91,TRUE,100,FALSE,100,TRUE,90,TRUE,100,FALSE,100,TRUE,80,FALSE,75,TRUE,50,TRUE,100,TRUE,50,FALSE,91,TRUE,100,TRUE,96,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,95,FALSE,90,TRUE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,100,25,1,2,2,1,2,0,-2,2,-2,-1,2,2,2,-3,2,1,1,1,2,-1,1,2,2,-1,2,1,-2,-2,1,-2,-1,3,2,2,2,-3,2,0,1,1,1,2,-1,3,0,2,1,2,2,2,-2,-1,1,0,-2,4,2,2,2,-3,2,1,2,1,2,2,1,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,90,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,96,TRUE,1,100,FALSE,1,91,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,80,FALSE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,86,TRUE,1,100,0,0,0,0.0025,0,0.01,0,0,0,0.01,0,0,0,0,0,0,0,0.25,1,0.0081,0,0.25,0.64,0.0081,0.25,0.5625,0.0196,0,0,0.0625,1,0.9216,0.1783,0.019285714,0.337314286,25,78.13,26,81.25,6,75,6,75,8,100,6,75,16,100,10,62.5,91.22,80.12,92.5,92.75,99.5,95.06,87.38,-3.12,9.97,5.12,17.5,-7.25,24.5,-4.94,24.88,0,0,0,2,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,2,1,1,2,1,0,0,0,0,0,1,0,1,0,2,0.4,0.6,0,0,0.6,1.4,0,0.8,0.25,0.7,0.475,1.33,2.33,2.125,-0.2,-0.8,0,-0.8,-0.333333333,-1,-1,-1,0,-1,0,1,1,-2,2,1,-1,-1,1,-1,1,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,,0.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,02REV,2,5,6,3,8,4,9,1,7,2,4,3,1 +151,R_3pRrDsIC7Uswrr8,67 - 73,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Neither agree nor disagree,Strongly agree,5,3,1,2,4,Agree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,2,5,1,3,4,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,5,4,2,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,3,4,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Somewhat disagree,Agree,1,3,5,4,2,2,Agree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,1,4,2,5,3,4,Neither Agree nor Disagree,Somewhat Agree,Agree,Agree,Agree,3,4,5,2,1,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Somewhat agree,3,5,4,1,2,2,Agree,Disagree,Agree,Disagree,Neither agree nor disagree,2,1,3,4,5,5,Neither Agree nor Disagree,Agree,Strongly agree,Neither Agree nor Disagree,Agree,4,2,5,1,3,8,Somewhat disagree,Strongly disagree,Somewhat disagree,Somewhat disagree,Disagree,2,5,3,1,4,FALSE,86,TRUE,95,FALSE,100,FALSE,50,TRUE,60,FALSE,100,TRUE,91,TRUE,100,TRUE,50,TRUE,86,FALSE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,59,FALSE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,77,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,0,3,2,-2,3,-3,1,0,1,3,0,2,-1,-1,1,1,-2,2,2,2,-1,2,5,2,-2,3,-3,1,2,0,1,2,2,2,4,0,1,1,-1,-1,7,2,2,2,2,1,3,2,-2,2,-2,0,2,0,2,3,0,2,5,-1,-3,-1,-1,-2,8,FALSE,1,86,TRUE,1,95,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,50,TRUE,1,86,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,59,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,77,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0081,0,0,0,0.0196,0,0,0,0.25,0.25,0.25,0.16,0.0025,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.3481,0.5929,0,0.0196,0,0.25,1,1,0.201525,0.102292857,0.300757143,22,68.75,26,81.25,7,87.5,5,62.5,7,87.5,7,87.5,15,93.75,11,68.75,79.81,65.25,71.12,82.88,100,83.25,76.38,-12.5,-1.44,-22.25,8.62,-4.62,12.5,-10.5,7.63,1,0,0,1,1,0,0,0,0,0,0,0,1,2,0,1,2,0,2,1,1,0,0,2,2,0,0,1,1,1,0,1,0,0,0,0,2,2,2,0,0.6,0,0.6,1.2,1,0.6,0.2,1.2,0.6,0.75,0.675,3.67,3.33,4.5,-0.4,-0.6,0.4,0,-0.2,2,0,-1,-1,0.34,0,1,-1,-1,1,1,-1,2,-2,1,-1,-1,10 cents,5 minutes,24 days,Female,Trade School (non-military),72,Interesting and fun,-0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,6,2,3,7,8,5,9,1,4,3,2,4,1 +152,R_5OlIcdJP5TxlpQW,67 - 73,American,,American,Male,Agree,Agree,Agree,Agree,Somewhat agree,3,1,5,4,2,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,4,5,1,3,Strongly Agree,Strongly Agree,Agree,Disagree,Strongly Agree,4,2,1,5,3,Agree,Agree,Agree,Agree,Somewhat agree,5,4,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,4,3,2,5,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,4,2,1,5,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,3,5,2,4,0,Agree,Agree,Agree,Agree,Agree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Agree,Somewhat agree,2,4,1,5,3,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,1,4,3,5,0,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,1,5,3,0,Agree,Agree,Agree,Agree,Agree,2,1,3,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,100,16,2,2,2,2,1,0,-3,3,-3,0,3,3,2,-2,3,2,2,2,2,1,2,2,2,0,1,0,0,-3,3,-3,2,5,3,3,2,0,3,5,2,2,2,2,2,0,2,2,2,2,1,0,0,-3,3,-3,0,0,3,3,2,0,3,0,2,2,2,2,2,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0.25,0.25,0.25,0,0,0.25,0.25,0.25,0,0.25,0.25,0,1,1,1,0,0.1875,0.053571429,0.321428571,16,50,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,85.94,68.75,87.5,93.75,93.75,90.62,81.25,-31.25,4.69,-6.25,0,18.75,6.25,-9.38,18.75,0,0,0,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0.4,0.4,0.4,0.2,0,0,0.4,0.2,0.35,0.15,0.25,3.33,0,1.25,0.4,0.4,0,0,0.266666667,0,5,5,0,3.33,0,1,0,-2,2,-2,2,0,0,0,0,-2,10 cents,5 minutes,24 days,Male,Trade School (non-military),71,None,0.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,3,7,6,4,2,5,8,1,9,4,2,3,1 +153,R_3gGBNDpfcFEgBvr,60 - 66,American,,American,Female,Agree,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,1,5,3,2,4,Somewhat agree,Disagree,Strongly agree,Strongly disagree,Agree,5,2,1,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,4,5,3,Neither agree nor disagree,Agree,Agree,Agree,Disagree,5,1,3,4,2,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,3,1,2,Agree,Strongly disagree,Agree,Neither agree nor disagree,Agree,4,1,2,3,5,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,2,3,6,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,2,1,5,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Somewhat agree,5,4,2,1,3,7,Neither agree nor disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat agree,4,2,5,3,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,4,2,3,1,7,Agree,Disagree,Strongly Agree,Agree,Somewhat disagree,4,2,1,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,76,FALSE,50,FALSE,100,FALSE,50,TRUE,64,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,99,TRUE,100,TRUE,68,TRUE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,76,FALSE,100,TRUE,100,FALSE,59,TRUE,100,FALSE,100,TRUE,100,FALSE,56,FALSE,100,TRUE,100,TRUE,100,FALSE,58,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,3,3,3,1,-2,3,-3,2,3,3,3,2,3,0,2,2,2,-2,3,1,3,3,3,2,2,-3,2,0,2,6,3,3,3,3,3,6,-2,-2,1,0,-3,6,2,0,3,3,1,7,0,-3,2,-1,1,5,3,3,3,0,3,7,2,-2,3,2,-1,5,TRUE,0,76,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,64,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,99,TRUE,0,100,TRUE,1,68,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,76,FALSE,0,100,TRUE,1,100,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,56,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0,0,0,0,0,0,0,0.0576,0,0,0.1024,0.25,0.0001,0.1296,0.25,0.1681,0.25,0,0,1,0.25,0,1,0,0.1936,0.3364,0.5776,0,0,1,1,0.234478571,0.086271429,0.382685714,17,53.13,23,71.88,4,50,6,75,6,75,7,87.5,11,68.75,12,75,86.12,64.12,86.38,97,97,83.75,88.5,-18.75,14.24,14.12,11.38,22,9.5,15,13.5,1,0,0,0,0,1,1,1,3,0,0,0,0,1,0,2,4,1,2,1,0,1,0,0,2,1,1,1,2,1,0,0,0,2,0,2,4,1,0,1,0.2,1.2,0.2,2,0.6,1.2,0.4,1.6,0.9,0.95,0.925,4.67,6.33,5.5,-0.4,0,-0.2,0.4,-0.2,-5,1,-1,1,-1.66,1,0,0,-2,2,1,-1,0,0,-1,1,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,8,5,9,4,6,3,7,1,2,4,3,2,1 +154,R_7QVFkMHaSFHI6jL,67 - 73,,Canadian,Canadian,Male,Somewhat disagree,Agree,Strongly agree,Agree,Neither agree nor disagree,4,2,5,3,1,Neither agree nor disagree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,3,1,4,5,2,Somewhat Agree,Agree,Agree,Somewhat Disagree,Somewhat Agree,3,2,5,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,5,4,1,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,3,2,4,1,5,1,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,3,1,5,4,2,1,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,4,5,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,2,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Strongly Agree,Agree,Disagree,3,1,2,4,5,3,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,3,4,2,1,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,1,5,2,4,3,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,2,5,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,95,TRUE,95,TRUE,75,FALSE,72,FALSE,50,TRUE,88,FALSE,80,TRUE,85,TRUE,50,TRUE,55,TRUE,100,TRUE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,91,TRUE,98,TRUE,98,TRUE,75,TRUE,80,TRUE,50,TRUE,91,TRUE,76,TRUE,50,TRUE,50,TRUE,50,TRUE,99,TRUE,80,TRUE,83,25,-1,2,3,2,0,0,-1,2,-2,0,1,2,2,-1,1,1,1,1,1,1,1,2,1,0,2,1,0,-2,2,-2,1,1,1,2,2,0,1,1,1,1,1,1,1,1,-1,2,3,2,-2,3,-3,-1,1,0,-1,2,1,1,1,-3,1,3,0,-1,0,1,1,8,TRUE,0,83,TRUE,1,80,TRUE,0,99,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,76,TRUE,1,91,TRUE,1,50,TRUE,1,80,TRUE,0,75,TRUE,0,98,TRUE,1,98,TRUE,0,91,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,1,55,TRUE,0,50,TRUE,1,85,FALSE,1,80,TRUE,1,88,FALSE,1,50,FALSE,1,72,TRUE,0,75,TRUE,1,95,TRUE,1,95,TRUE,1,100,0.0081,0.0144,0,0.0576,0,0.25,0.0225,0.04,1,0.2025,0.0025,0.0004,0.25,0.5625,0.25,0.04,0.25,0.25,0.0784,0.04,0,0.25,0.25,0.8281,0.25,0.25,0.0025,0.6889,0.9801,0,0.5625,0.9604,0.295046429,0.222885714,0.367207143,25,78.13,20,62.5,4,50,5,62.5,6,75,5,62.5,15,93.75,5,31.25,77.06,62.5,71.62,81.62,92.5,80.81,73.31,15.63,14.56,12.5,9.12,6.62,30,-12.94,42.06,2,0,2,2,2,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,3,0,1,2,1,0,1,1,2,0,1,2,1,0,0,1.6,0.4,0.2,0,0.4,1.4,0.8,0.8,0.55,0.85,0.7,1,2.67,2.5,1.2,-1,-0.6,-0.8,-0.133333333,-2,-1,-2,-7,-1.67,1,1,1,0,0,2,-2,-1,1,-1,1,1,10 cents,5 minutes,47 days,Male,Trade School (non-military),70,Fun made me think,0.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,8,4,3,6,7,2,9,1,5,2,4,3,1 +155,R_3907jAvTB0WHfsM,60 - 66,,Canadian,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,4,1,2,5,3,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,3,2,4,5,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,3,1,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly Agree,1,5,3,4,2,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,3,5,4,1,2,8,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,3,2,5,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,2,3,4,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly Agree,3,2,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,4,1,3,2,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,3,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,4,2,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,70,FALSE,50,TRUE,85,FALSE,50,FALSE,75,FALSE,50,TRUE,76,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,75,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,65,TRUE,76,FALSE,50,TRUE,75,FALSE,50,TRUE,76,TRUE,64,FALSE,50,FALSE,50,FALSE,50,TRUE,60,FALSE,50,FALSE,50,16,0,2,1,0,-3,0,-2,1,0,-1,2,1,1,0,1,-1,0,1,0,3,0,2,0,0,-3,8,0,1,0,1,1,8,1,1,1,1,1,8,0,0,0,1,3,5,0,1,1,1,-3,6,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,6,FALSE,1,50,FALSE,0,50,TRUE,0,60,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,64,TRUE,1,76,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,76,TRUE,1,65,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,76,FALSE,1,50,FALSE,1,75,FALSE,1,50,TRUE,1,85,FALSE,0,50,TRUE,1,70,0.0576,0.0576,0.25,0.1296,0.09,0.25,0.25,0.0625,0.25,0.25,0.0225,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.36,0.5625,0.25,0.5776,0.245003571,0.199821429,0.290185714,16,50,22,68.75,4,50,7,87.5,6,75,5,62.5,9,56.25,13,81.25,57.72,50,54.38,61.25,65.25,60.06,55.38,-18.75,-11.03,0,-33.12,-13.75,2.75,3.81,-25.87,0,0,1,0,0,0,3,1,1,2,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,2,1,0,1,2,1,1,0,1,1,0,1,0,3,0.2,1.4,0.4,0.6,0.4,0.8,1,1,0.65,0.8,0.725,8,5.67,6.5,-0.2,0.6,-0.6,-0.4,-0.066666667,2,3,2,-1,2.33,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,25 minutes,47 days,Male,Trade School (non-military),60,,0,0,0,1,1,0,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,4,7,2,3,5,9,8,1,6,2,3,4,1 +156,R_5KpX417DipbCyIn,39 - 45,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Disagree,5,3,2,1,4,Strongly disagree,Agree,Somewhat agree,Somewhat agree,Agree,5,4,3,1,2,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,1,2,4,5,Disagree,Disagree,Disagree,Somewhat agree,Strongly disagree,2,5,4,3,1,Strongly Agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,2,1,5,4,3,0,Disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,2,5,1,3,4,0,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,3,1,5,0,Somewhat disagree,Disagree,Somewhat disagree,Somewhat agree,Strongly disagree,4,3,2,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly disagree,2,3,4,5,1,0,Strongly disagree,Agree,Somewhat agree,Agree,Agree,2,4,1,3,5,0,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,4,5,3,2,0,Disagree,Strongly disagree,Disagree,Somewhat agree,Strongly disagree,5,1,2,4,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,100,FALSE,70,TRUE,50,FALSE,55,FALSE,100,TRUE,65,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,98,FALSE,50,FALSE,50,FALSE,100,TRUE,99,FALSE,100,TRUE,100,FALSE,100,TRUE,92,FALSE,50,FALSE,50,TRUE,100,TRUE,50,FALSE,70,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,2,-2,-3,2,1,1,2,2,-3,3,-3,3,-2,-2,-2,1,-3,3,3,2,2,0,0,-2,2,2,0,3,0,2,-3,3,-3,3,0,-1,-2,-1,1,-3,4,3,3,2,3,-3,0,-3,2,1,2,2,0,2,-3,3,-3,3,0,-2,-3,-2,1,-3,2,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,0,70,TRUE,1,50,FALSE,1,55,FALSE,1,100,TRUE,1,65,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,98,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,0,70,TRUE,1,100,0,0.0064,0,0.25,0,0,0,0.25,0.25,0.0001,0.25,0.1225,0.49,0.2025,0.25,1,0,0.25,0.25,0,1,0.25,0.25,0,0.25,0.25,0.49,0,0,0.9604,1,0,0.277339286,0.218935714,0.335742857,24,75,25,78.13,4,50,6,75,7,87.5,8,100,11,68.75,14,87.5,78.09,61.88,83.12,86.12,81.25,77.88,78.31,-3.13,-0.04,11.88,8.12,-1.38,-18.75,9.13,-9.19,0,0,0,0,2,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0.4,0.8,0,0.4,0.4,0.2,0,0.2,0.4,0.2,0.3,0,0,0.75,0,0.6,0,0.2,0.2,0,0,0,2,0,0,2,2,-2,2,-2,2,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,University - Undergraduate,42,No real feedback except to say I really loved those true-or-false questions -- gave me a really good pause to think and try to remember what I actually know/remember.,1.75,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,7,8,3,2,5,9,6,1,4,4,3,2,1 +157,R_6tyUS9LOzy8825t,67 - 73,American,,American,Female,Agree,Agree,Agree,Neither agree nor disagree,Agree,2,4,3,5,1,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,4,2,3,1,5,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,5,1,4,2,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,2,3,1,5,4,2,Agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,3,4,5,1,2,1,Agree,Agree,Agree,Somewhat Agree,Agree,4,3,1,5,2,2,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,3,2,5,4,2,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,4,2,3,5,1,2,Agree,Agree,Agree,Agree,Agree,4,3,5,2,1,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,2,3,4,1,TRUE,95,TRUE,100,FALSE,100,FALSE,50,TRUE,85,FALSE,88,TRUE,88,TRUE,100,TRUE,92,TRUE,88,FALSE,55,FALSE,71,FALSE,66,TRUE,68,TRUE,63,TRUE,97,FALSE,97,TRUE,66,TRUE,72,FALSE,100,FALSE,65,TRUE,90,FALSE,100,TRUE,85,FALSE,70,TRUE,68,TRUE,70,FALSE,100,TRUE,94,TRUE,82,TRUE,83,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,0,2,2,0,2,-1,2,2,1,2,1,2,1,0,1,1,0,2,2,2,0,2,2,2,-1,2,0,1,2,2,2,2,1,2,1,0,1,0,1,-1,2,2,2,2,0,2,2,2,0,1,0,2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,2,TRUE,0,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,85,FALSE,1,88,TRUE,1,88,TRUE,1,100,TRUE,1,92,TRUE,1,88,FALSE,1,55,FALSE,1,71,FALSE,0,66,TRUE,0,68,TRUE,1,63,TRUE,1,97,FALSE,1,97,TRUE,0,66,TRUE,0,72,FALSE,1,100,FALSE,0,65,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,70,TRUE,1,68,TRUE,0,70,FALSE,1,100,TRUE,0,94,TRUE,1,82,TRUE,1,83,TRUE,1,100,0,0.1024,0.0009,0.0144,0,0.0144,0.0225,0.0144,0,0.01,0.0324,0.4356,0.0064,0.2025,0.0225,0,0,0.25,0,0.09,0.4225,0.1369,0.5184,0.4624,0.0009,0.49,0.0289,0.9025,0,0.4356,0.8836,0.0841,0.195232143,0.072192857,0.318271429,24,75,24,75,6,75,5,62.5,5,62.5,8,100,14,87.5,10,62.5,82.75,73.12,86.88,79.12,91.88,84.5,81,0,7.75,-1.88,24.38,16.62,-8.12,-3,18.5,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,2,1,2,2,1,0,0.6,0.2,0.8,0,0.4,0.4,1.6,0.4,0.6,0.5,1.67,2,1.875,0,0.2,-0.2,-0.8,0,0,0,-1,0,-0.33,0,1,1,-2,2,-2,2,0,0,-2,2,0,10 cents,100 minutes,24 days,Female,University - PhD,73,,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,7,2,5,9,4,6,8,1,3,4,3,2,1 +158,R_5kGqpY0ZTnPPebw,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,4,1,5,3,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,1,3,4,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,2,3,4,1,5,10,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,10,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,1,4,5,3,2,5,Somewhat agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,2,5,1,3,4,3,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,1,4,2,5,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,2,5,1,4,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,2,1,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,94,TRUE,77,TRUE,62,FALSE,72,TRUE,100,FALSE,73,TRUE,81,FALSE,100,FALSE,89,FALSE,90,FALSE,100,FALSE,74,FALSE,54,FALSE,61,FALSE,99,TRUE,67,TRUE,70,TRUE,81,FALSE,91,TRUE,61,TRUE,100,FALSE,85,TRUE,65,TRUE,86,TRUE,86,FALSE,73,TRUE,71,TRUE,87,FALSE,88,TRUE,100,FALSE,82,FALSE,74,17,3,3,1,3,3,3,-3,3,-3,3,2,3,3,0,3,3,3,3,3,3,3,3,1,3,3,9,0,-3,3,-3,3,10,2,1,1,0,3,10,1,3,0,3,3,5,3,3,1,3,3,10,0,-3,3,-3,3,3,2,2,2,0,3,5,3,3,3,3,1,10,FALSE,1,74,FALSE,0,82,TRUE,0,100,FALSE,1,88,TRUE,1,87,TRUE,0,71,FALSE,0,73,TRUE,1,86,TRUE,1,86,TRUE,1,65,FALSE,1,85,TRUE,0,100,TRUE,1,61,FALSE,1,91,TRUE,1,81,TRUE,1,70,TRUE,0,67,FALSE,1,99,FALSE,1,61,FALSE,1,54,FALSE,0,74,FALSE,0,100,FALSE,1,90,FALSE,0,89,FALSE,1,100,TRUE,1,81,FALSE,1,73,TRUE,0,100,FALSE,1,72,TRUE,1,62,TRUE,1,77,TRUE,1,94,0.0196,0.0361,0.09,0.5329,0.0036,0.5041,0.7921,0.1225,0.2116,1,0.1444,0.1521,0.0196,0.0225,0.0169,0.6724,0.01,0.0144,1,0,0.5476,0.0361,0.1521,0.0081,0.4489,0.0729,0.0529,0.0676,1,0.0001,0.0784,1,0.291103571,0.2633,0.318907143,17,53.13,22,68.75,7,87.5,5,62.5,6,75,4,50,11,68.75,11,68.75,81.03,79.12,77,85.38,82.62,79.25,82.81,-15.62,12.28,-8.38,14.5,10.38,32.62,10.5,14.06,0,0,0,0,0,3,0,0,0,0,0,2,2,0,0,2,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0.6,0.8,1,0,0.6,0.4,0.4,0.6,0.35,0.475,9.67,6,7.75,0,0,0.4,0.6,0.133333333,-1,7,5,-5,3.67,2,1,2,2,-2,1,-1,1,-1,2,-2,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,awesome!,0.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,3,9,2,6,4,7,5,1,8,4,2,3,1 +159,R_3qdPz2lU3zQiB3P,25 - 31,American,,American,Male,Strongly agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,3,4,2,5,1,Strongly agree,Somewhat agree,Agree,Agree,Agree,3,2,4,5,1,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,4,2,5,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,4,5,2,3,1,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,Agree,5,4,3,2,1,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,4,5,2,3,1,8,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,4,5,3,1,2,8,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,2,4,5,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,3,4,1,2,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,1,4,3,2,7,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,3,4,2,5,1,8,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,3,1,2,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,63,TRUE,82,TRUE,77,TRUE,85,TRUE,97,TRUE,86,TRUE,85,FALSE,84,TRUE,80,TRUE,98,TRUE,85,FALSE,82,TRUE,95,FALSE,84,TRUE,94,TRUE,91,FALSE,91,TRUE,89,TRUE,82,TRUE,88,TRUE,86,FALSE,96,FALSE,90,TRUE,84,TRUE,71,FALSE,83,TRUE,94,FALSE,93,TRUE,78,TRUE,86,FALSE,97,TRUE,99,23,3,1,3,2,1,3,1,2,2,2,2,1,1,2,2,3,3,3,2,1,1,3,2,0,2,8,1,1,0,2,1,8,1,1,0,1,2,8,2,2,2,1,1,9,1,-1,1,0,3,8,0,0,1,-1,1,7,1,0,0,2,1,8,-1,1,2,-1,1,5,TRUE,0,99,FALSE,0,97,TRUE,0,86,TRUE,0,78,FALSE,0,93,TRUE,0,94,FALSE,0,83,TRUE,1,71,TRUE,1,84,FALSE,0,90,FALSE,1,96,TRUE,0,86,TRUE,1,88,TRUE,0,82,TRUE,1,89,FALSE,0,91,TRUE,0,91,TRUE,0,94,FALSE,1,84,TRUE,0,95,FALSE,0,82,TRUE,1,85,TRUE,0,98,TRUE,1,80,FALSE,1,84,TRUE,1,85,TRUE,0,86,TRUE,0,97,TRUE,0,85,TRUE,1,77,TRUE,1,82,TRUE,1,63,0.0841,0.0225,0.8281,0.6889,0.1369,0.8836,0.04,0.81,0.9025,0.0225,0.0529,0.0144,0.0256,0.0016,0.8649,0.9409,0.9604,0.6084,0.9409,0.0256,0.6724,0.0121,0.0256,0.6724,0.8281,0.7396,0.0324,0.9801,0.7396,0.8836,0.7225,0.7396,0.509967857,0.447471429,0.572464286,23,71.88,13,40.63,5,62.5,2,25,3,37.5,3,37.5,10,62.5,3,18.75,86.72,87,86.75,87.75,85.38,83.75,89.69,31.25,46.09,24.5,61.75,50.25,47.88,21.25,70.94,2,2,1,2,1,2,0,2,0,1,1,0,1,1,0,1,1,1,1,0,2,2,2,2,2,3,1,1,3,1,1,1,1,0,1,4,2,1,3,0,1.6,1,0.6,0.8,2,1.8,0.8,2,1,1.65,1.325,8,7.67,7.625,-0.4,-0.8,-0.2,-1.2,-0.466666667,0,1,0,4,0.33,0,1,1,1,-1,0,0,1,-1,0,0,-1,10 cents,25 minutes,24 days,Male,University - Undergraduate,27,Thank you!,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,8,4,2,7,6,9,5,1,3,4,2,3,1 +160,R_7prnYqlq02LBnad,53 - 59,American,,American,Female,Strongly agree,Agree,Strongly agree,Somewhat disagree,Agree,3,1,4,2,5,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,3,5,1,4,2,Agree,Strongly Agree,Agree,Agree,Agree,2,3,5,1,4,Strongly Agree,Agree,Agree,Strongly Agree,Agree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Strongly Agree,Agree,Neither agree nor disagree,2,4,3,5,1,5,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,3,4,1,2,8,Agree,Somewhat Agree,Agree,Agree,Agree,4,2,5,1,3,2,Agree,Agree,Agree,Agree,Strongly Agree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,5,Somewhat agree,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,1,4,5,3,3,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,3,1,4,2,5,5,Neither agree nor disagree,Agree,Agree,Agree,Agree,1,2,3,4,5,FALSE,59,TRUE,100,TRUE,100,FALSE,87,TRUE,85,FALSE,100,TRUE,100,TRUE,100,FALSE,79,TRUE,98,FALSE,95,TRUE,100,TRUE,94,TRUE,100,TRUE,96,TRUE,92,TRUE,93,TRUE,85,FALSE,67,TRUE,89,TRUE,76,TRUE,75,TRUE,74,TRUE,100,TRUE,100,TRUE,100,TRUE,80,TRUE,79,TRUE,78,TRUE,93,FALSE,75,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,-1,2,1,-3,3,-2,2,2,3,2,2,2,3,2,2,3,2,2,2,3,2,0,3,3,-3,3,-1,0,5,2,1,2,2,2,8,2,2,2,2,3,2,2,2,3,0,0,4,1,-3,0,1,0,5,2,0,2,1,2,3,0,2,2,2,2,5,FALSE,1,59,TRUE,1,100,TRUE,0,100,FALSE,1,87,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,79,TRUE,1,98,FALSE,1,95,TRUE,0,100,TRUE,1,94,TRUE,0,100,TRUE,1,96,TRUE,1,92,TRUE,0,93,TRUE,0,85,FALSE,1,67,TRUE,0,89,TRUE,1,76,TRUE,1,75,TRUE,0,74,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,80,TRUE,0,79,TRUE,0,78,TRUE,1,93,FALSE,0,75,TRUE,1,100,0,0,0.0064,0,0,0,0,0.0004,0.7921,0.0625,0.0049,0.0036,0.6241,0.0025,0.0225,0,0.5476,0.0169,0.6241,1,0.0576,0.0016,0.1089,1,0.8649,0.64,0.5625,0.1681,1,0.7225,0.6084,1,0.372703571,0.148364286,0.597042857,23,71.88,19,59.38,5,62.5,5,62.5,5,62.5,4,50,14,87.5,5,31.25,89.03,84.88,87.5,89.62,94.12,91.44,86.62,12.5,29.65,22.38,25,27.12,44.12,3.94,55.37,1,0,0,3,2,2,0,0,1,2,0,2,0,0,0,1,0,0,1,1,1,0,0,1,2,0,0,3,3,2,0,3,0,1,0,3,0,0,1,0,1.2,1,0.4,0.6,0.8,1.6,0.8,0.8,0.8,1,0.9,5.33,4,4.375,0.4,-0.6,-0.4,-0.2,-0.2,-1,0,5,-3,1.33,1,2,2,-1,1,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),59,interesting,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,3,2,7,4,5,6,9,1,8,4,3,2,1 +161,R_6Vt3d1FpDEYtCxH,67 - 73,American,,American,Male,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,4,5,1,3,2,Somewhat disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,5,1,3,2,4,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,3,1,5,2,4,Agree,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,3,4,2,5,1,Neither agree nor disagree,Agree,Agree,Disagree,Somewhat agree,1,5,4,3,2,3,Disagree,Disagree,Agree,Disagree,Somewhat agree,1,4,5,3,2,2,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,2,Agree,Somewhat agree,Agree,Agree,Agree,5,2,3,1,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,5,3,4,2,1,3,Disagree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat disagree,4,1,3,2,5,3,Agree,Agree,Agree,Disagree,Agree,3,2,4,1,5,2,Somewhat agree,Neither agree nor disagree,Agree,Agree,Agree,1,5,2,4,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,95,TRUE,100,FALSE,88,TRUE,98,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,97,FALSE,100,TRUE,97,TRUE,100,TRUE,100,TRUE,61,TRUE,100,TRUE,91,FALSE,82,FALSE,88,FALSE,100,TRUE,99,TRUE,98,TRUE,62,TRUE,98,TRUE,72,TRUE,97,FALSE,50,FALSE,98,TRUE,97,TRUE,100,TRUE,93,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,2,0,1,-1,0,2,-2,1,2,3,3,1,2,2,1,3,3,1,0,2,2,-2,1,3,-2,-2,2,-2,1,2,2,2,2,2,2,2,2,1,2,2,2,3,1,0,2,1,0,3,-2,0,1,-2,-1,3,2,2,2,-2,2,2,1,0,2,2,2,3,TRUE,0,100,TRUE,1,95,TRUE,0,100,FALSE,1,88,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,97,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,100,TRUE,1,61,TRUE,1,100,TRUE,0,91,FALSE,1,82,FALSE,1,88,FALSE,1,100,TRUE,1,99,TRUE,1,98,TRUE,0,62,TRUE,1,98,TRUE,0,72,TRUE,1,97,FALSE,1,50,FALSE,1,98,TRUE,0,97,TRUE,1,100,TRUE,1,93,TRUE,1,100,0,0.0009,0,0,0,0,0.0004,0.0009,0,0.0004,0,0,0.25,0,0.0004,0.0025,0.3844,0.0144,0.0004,0.5184,0.0001,0.1521,0.0144,1,0.8281,0.25,0.0049,1,1,0.0324,0.9409,0.9409,0.262,0.046671429,0.477328571,28,87.5,24,75,8,100,5,62.5,5,62.5,6,75,16,100,8,50,90.97,78.12,93.38,93.25,99.12,92.88,89.06,12.5,15.97,-21.88,30.88,30.75,24.12,-7.12,39.06,1,1,0,2,0,1,2,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0,2,0,1,1,3,0,1,1,1,1,1,0.8,0.6,0.6,0.6,0.6,0.8,1,1,0.65,0.85,0.75,2.33,2.67,2.625,0.2,-0.2,-0.4,-0.4,-0.133333333,0,-1,0,0,-0.34,1,2,1,-1,1,0,0,-2,2,-2,2,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,73,This was very interesting and enjoyable,1.25,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,3,7,4,9,2,6,5,1,8,2,3,4,1 +162,R_1u9AK8gy2PrSuRz,60 - 66,,Canadian,Canadian,Female,Agree,Agree,Agree,Neither agree nor disagree,Agree,3,5,4,1,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,5,3,4,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,5,1,2,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Neither agree nor disagree,Agree,5,1,4,2,3,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,1,2,4,3,4,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,2,4,5,1,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,2,4,3,5,1,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,3,4,5,4,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,3,2,5,4,1,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,1,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,80,TRUE,91,TRUE,100,TRUE,100,FALSE,96,TRUE,86,TRUE,93,FALSE,100,TRUE,96,FALSE,92,TRUE,97,FALSE,76,FALSE,100,FALSE,72,TRUE,100,FALSE,96,TRUE,100,TRUE,50,FALSE,94,TRUE,100,TRUE,86,TRUE,94,TRUE,98,TRUE,81,TRUE,97,TRUE,95,FALSE,95,TRUE,86,FALSE,50,TRUE,94,TRUE,99,FALSE,95,17,2,2,2,0,2,-1,0,1,-1,1,2,2,1,0,2,-1,-1,0,0,-1,2,2,2,0,2,4,-1,-1,1,-1,1,4,2,2,2,0,2,4,-1,-1,0,-1,-1,5,2,2,2,0,1,4,-1,-1,1,-1,1,4,2,2,1,-1,2,4,-1,-1,0,-1,-1,5,FALSE,1,95,TRUE,1,99,TRUE,0,94,FALSE,1,50,TRUE,1,86,FALSE,1,95,TRUE,1,95,TRUE,1,97,TRUE,1,81,TRUE,1,98,TRUE,0,94,TRUE,0,86,TRUE,1,100,FALSE,1,94,TRUE,1,50,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,1,72,FALSE,1,100,FALSE,0,76,TRUE,1,97,FALSE,1,92,TRUE,1,96,FALSE,1,100,TRUE,1,93,TRUE,0,86,FALSE,1,96,TRUE,0,100,TRUE,1,100,TRUE,1,91,TRUE,1,80,0.0009,0.0049,0,0.0025,0.04,0.0025,0.0016,0.0004,0,0.0009,0,0,0.0361,0.8836,0.0196,0.0001,0.0064,0.25,0.0016,0,0.5776,0.25,0.0784,0.0036,0.0016,0.7396,0.0081,0.0025,0.8836,1,1,0.7396,0.233121429,0.088657143,0.377585714,17,53.13,25,78.13,6,75,6,75,7,87.5,6,75,15,93.75,10,62.5,90.28,77.88,90.62,96.5,96.12,89.94,90.62,-25,12.15,2.88,15.62,9,21.12,-3.81,28.12,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.15,0.2,0.175,4,4,4.25,-0.2,0,0,0,-0.066666667,0,0,0,0,0,0,2,1,0,0,1,-1,-1,1,-2,2,2,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,64,None,0.875,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,7,3,4,2,9,6,5,1,8,4,2,3,1 +163,R_7RvF7lBwedH2yB4,60 - 66,American,,American,Male,Somewhat agree,Agree,Agree,Somewhat disagree,Disagree,3,5,2,4,1,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,5,4,2,3,1,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,3,5,4,2,1,Agree,Agree,Agree,Strongly Agree,Somewhat agree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Agree,Agree,Disagree,Disagree,5,3,1,2,4,0,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,4,5,2,1,3,0,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,3,2,1,4,5,0,Agree,Agree,Agree,Agree,Somewhat agree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Disagree,1,4,3,2,5,0,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,3,5,1,4,2,0,Somewhat Agree,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,0,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,5,3,1,2,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,60,TRUE,100,FALSE,99,TRUE,100,TRUE,80,TRUE,100,FALSE,100,TRUE,86,FALSE,75,FALSE,100,TRUE,100,TRUE,100,TRUE,76,TRUE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,81,TRUE,100,TRUE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,-1,-2,0,-2,3,-2,0,1,2,3,1,1,2,2,2,3,1,0,2,2,-2,-2,0,0,-2,3,-2,0,0,1,2,3,1,1,0,2,2,2,2,1,0,0,2,2,-1,-2,0,0,-2,3,-2,0,0,1,2,3,1,1,0,2,2,3,3,1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,100,FALSE,0,99,TRUE,0,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,0,86,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.9801,0,0.36,0.25,0,0.5776,0.25,0,0,0,0.04,0.0625,1,0,0.5625,0,1,1,0.7396,0.6561,1,0.3028,0.172692857,0.432907143,24,75,22,68.75,6,75,5,62.5,5,62.5,6,75,15,93.75,7,43.75,91.62,80,88.25,98.25,100,95.56,87.69,6.25,22.87,5,25.75,35.75,25,1.81,43.94,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0,0.2,0.2,0,0,0.2,0.15,0.1,0.125,0,0,0,0.2,0,0,0,0.066666667,0,0,0,0,0,-2,0,0,2,-2,-2,2,2,-2,0,0,-2,10 cents,25 minutes,36 days,Male,College Diploma/Certificate,61,nothing comes to mind,-0.75,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,9,2,5,7,6,4,3,1,8,3,4,2,1 +164,R_7EGL2cPMFfL1fUE,67 - 73,,Canadian,Canadian,Male,Strongly agree,Agree,Agree,Somewhat disagree,Agree,3,5,4,1,2,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,3,2,5,1,Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,5,1,2,3,4,Agree,Agree,Agree,Agree,Strongly Agree,5,3,1,2,4,Strongly Agree,Somewhat agree,Agree,Strongly disagree,Agree,5,2,1,3,4,3,Agree,Strongly disagree,Agree,Disagree,Somewhat agree,5,3,1,2,4,3,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,4,3,2,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,4,1,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,4,5,1,2,3,2,Agree,Strongly disagree,Agree,Disagree,Somewhat agree,4,1,5,3,2,2,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,1,3,5,2,2,Agree,Agree,Agree,Agree,Strongly Agree,5,4,1,3,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,93,FALSE,99,TRUE,100,TRUE,100,TRUE,79,TRUE,100,FALSE,74,TRUE,88,TRUE,96,FALSE,100,TRUE,82,TRUE,100,FALSE,78,TRUE,100,TRUE,74,TRUE,100,TRUE,100,TRUE,100,FALSE,98,TRUE,100,TRUE,100,TRUE,96,TRUE,100,FALSE,86,FALSE,74,FALSE,67,TRUE,100,TRUE,100,TRUE,100,27,3,2,2,-1,2,2,-3,3,-3,3,2,1,2,1,3,2,2,2,2,3,3,1,2,-3,2,3,2,-3,2,-2,1,3,3,2,2,0,2,2,1,1,1,0,1,4,3,3,2,1,3,2,2,-3,2,-2,1,2,3,3,2,3,3,2,2,2,2,2,3,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,67,FALSE,0,74,FALSE,1,86,TRUE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,74,TRUE,1,100,FALSE,1,78,TRUE,0,100,TRUE,0,82,FALSE,1,100,TRUE,1,96,TRUE,1,88,FALSE,1,74,TRUE,1,100,TRUE,0,79,TRUE,1,100,TRUE,0,100,FALSE,1,99,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0016,0,0,0,0,0.0196,0,0,0,0.0144,0,0,0,0.0004,0.5476,0,0.0676,0.1089,0.0001,0.6241,0.0016,0.0676,0.6724,1,0.0484,1,0,1,1,1,0.0049,1,0.292057143,0.054178571,0.529935714,27,84.38,23,71.88,6,75,7,87.5,4,50,6,75,15,93.75,8,50,93.25,90.12,87.62,95.88,99.38,95.5,91,12.5,21.37,15.12,0.12,45.88,24.38,1.75,41,0,1,0,2,0,0,0,1,1,2,1,1,0,1,1,1,1,1,2,2,0,1,0,2,1,0,0,1,1,2,1,2,0,2,0,0,0,0,0,0,0.6,0.8,0.8,1.4,0.8,0.8,1,0,0.9,0.65,0.775,2.67,2,2.625,-0.2,0,-0.2,1.4,-0.133333333,1,1,0,1,0.67,2,2,2,-2,2,0,0,-1,1,-2,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,Very interesting,1.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,3,2,6,4,5,9,8,1,7,3,2,4,1 +165,R_3aQuHaDKpIOZR30,67 - 73,American,,American,Female,Strongly agree,Agree,Strongly agree,Disagree,Agree,2,4,5,3,1,Somewhat agree,Disagree,Agree,Disagree,Somewhat disagree,2,3,1,5,4,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,2,4,1,3,5,Somewhat agree,Agree,Agree,Agree,Somewhat disagree,4,2,3,5,1,Strongly Agree,Agree,Strongly Agree,Disagree,Agree,1,5,4,2,3,1,Somewhat agree,Disagree,Agree,Somewhat disagree,Somewhat disagree,1,3,5,2,4,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,4,1,2,5,3,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,4,5,2,1,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat disagree,5,2,3,1,4,2,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Disagree,Disagree,1,5,3,4,2,1,Somewhat Agree,Agree,Somewhat Agree,Disagree,Strongly Agree,1,4,3,2,5,0,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat disagree,4,5,2,3,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,53,TRUE,71,TRUE,72,FALSE,52,TRUE,50,FALSE,100,TRUE,82,TRUE,86,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,73,TRUE,100,TRUE,50,TRUE,60,FALSE,50,FALSE,60,TRUE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,63,TRUE,58,FALSE,50,FALSE,50,FALSE,60,TRUE,87,FALSE,50,TRUE,100,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,-2,2,1,-2,2,-2,-1,1,2,1,-1,3,1,2,2,2,-1,3,2,3,-2,2,1,1,-2,2,-1,-1,1,1,1,1,-1,3,1,1,1,2,1,-1,1,3,1,3,1,-1,2,0,-3,0,-2,-2,1,1,2,1,-2,3,0,1,-1,0,2,-1,1,TRUE,0,53,TRUE,1,71,TRUE,0,72,FALSE,1,52,TRUE,1,50,FALSE,1,100,TRUE,1,82,TRUE,1,86,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,73,TRUE,0,100,TRUE,1,50,TRUE,1,60,FALSE,1,50,FALSE,1,60,TRUE,0,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,63,TRUE,1,58,FALSE,1,50,FALSE,1,50,FALSE,1,60,TRUE,1,87,FALSE,0,50,TRUE,1,100,0.0196,0.1764,0.16,0.0324,0,0,0.25,0,0,0.25,0.0169,0.0729,0.25,0.25,0.25,0.0841,0.25,0.2304,0.25,0.3969,0.25,0.25,0.25,1,0.25,0.25,0.25,0.2809,0.5184,0.16,0.16,1,0.256089286,0.136021429,0.376157143,21,65.63,22,68.75,4,50,8,100,4,50,6,75,13,81.25,9,56.25,66.47,52.88,66.62,70.75,75.62,66.69,66.25,-3.12,-2.28,2.88,-33.38,20.75,0.62,-14.56,10,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,1,0,3,3,1,1,2,0,1,0,0,0,1,0,0,3,2,0,0,0,0.2,0.2,0.4,1.4,1,0.2,1,0.2,0.9,0.55,1,1,1,-1.4,-0.8,0,-0.6,-0.733333333,-1,0,1,0,0,-1,1,1,-1,1,1,-1,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),73,I loved this survey. It is better than most.,0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,8,7,3,9,6,5,2,1,4,2,3,4,1 +166,R_3b918O6l0IYvDd7,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,2,5,1,3,4,Somewhat disagree,Strongly disagree,Strongly agree,Disagree,Agree,4,5,1,2,3,Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,3,5,1,2,4,Agree,Agree,Agree,Strongly Agree,Somewhat agree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,Strongly Agree,2,5,4,3,1,7,Disagree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,4,1,5,2,3,0,Agree,Agree,Somewhat Agree,Somewhat Agree,Agree,3,1,5,2,4,6,Somewhat agree,Agree,Agree,Agree,Agree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,4,3,5,1,0,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,5,4,3,1,2,0,Agree,Agree,Strongly agree,Disagree,Agree,4,2,1,3,5,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly Agree,Neither agree nor disagree,3,2,5,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,51,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,52,TRUE,50,FALSE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,86,FALSE,100,TRUE,100,TRUE,60,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,57,TRUE,100,TRUE,100,TRUE,100,25,3,3,1,3,3,-1,-3,3,-2,2,2,1,3,-2,3,2,2,2,3,1,3,3,1,-1,3,0,-2,-3,3,1,3,7,2,2,1,1,2,0,1,2,2,2,2,6,3,3,3,3,2,0,1,-3,2,-2,2,0,2,2,3,-2,2,0,0,0,2,3,0,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,FALSE,1,52,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,51,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.2304,0,0,0,0.16,0,0,0,1,0.1849,0,0.2601,0,0,0.25,1,0.25,1,0,1,1,0,1,0.7396,0.288392857,0.112521429,0.464264286,25,78.13,23,71.88,6,75,6,75,5,62.5,6,75,16,100,7,43.75,90.81,83.38,93.75,93.88,92.25,97.5,84.12,6.25,18.93,8.38,18.75,31.38,17.25,-2.5,40.37,0,0,0,4,0,1,0,0,3,1,0,1,2,3,1,1,0,0,1,1,0,0,2,0,1,2,0,1,0,0,0,1,0,0,1,2,2,0,0,1,0.8,1,1.4,0.6,0.6,0.6,0.4,1,0.95,0.65,0.8,2.33,0,1.625,0.2,0.4,1,-0.4,0.533333333,0,7,0,6,2.33,2,1,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,67,,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,2,7,5,8,3,6,4,1,9,3,4,2,1 +167,R_6aM6vvxGj0PaJKp,67 - 73,,Canadian,Canadian,Female,Disagree,Agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,2,4,3,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,1,4,2,5,3,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,2,4,1,3,Disagree,Somewhat agree,Somewhat disagree,Agree,Strongly disagree,2,4,3,5,1,Strongly disagree,Somewhat agree,Strongly Agree,Strongly disagree,Strongly Agree,2,5,4,3,1,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Disagree,Neither agree nor disagree,2,4,1,3,5,7,Agree,Agree,Agree,Somewhat Disagree,Agree,2,5,1,3,4,2,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Disagree,5,2,4,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,3,2,5,4,1,2,Disagree,Disagree,Agree,Somewhat disagree,Somewhat disagree,4,5,1,3,2,1,Agree,Agree,Agree,Disagree,Agree,4,2,3,5,1,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,92,TRUE,50,TRUE,50,TRUE,50,FALSE,75,FALSE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,100,FALSE,50,FALSE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,100,16,-2,2,3,0,3,0,1,3,-2,1,2,1,2,0,2,-2,1,-1,2,-3,-3,1,3,-3,3,1,1,0,3,-2,0,7,2,2,2,-1,2,2,-1,1,-1,0,-2,5,-1,1,3,1,3,2,-2,-2,2,-1,-1,1,2,2,2,-2,2,1,-1,0,-1,0,0,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,0,100,FALSE,1,75,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,92,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,1,0,0,0,0,0,0.25,0,0.25,0,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0,0,0.25,0.25,0,0,0,0.8464,1,0.193175,0.142857143,0.243492857,16,50,25,78.13,6,75,6,75,8,100,5,62.5,14,87.5,11,68.75,81.78,62.5,80.25,90.62,93.75,81.25,82.31,-28.13,3.65,-12.5,5.25,-9.38,31.25,-6.25,13.56,1,1,0,3,0,1,1,0,0,1,0,1,0,1,0,1,0,0,2,1,1,1,0,1,0,2,3,1,1,2,0,1,0,2,0,1,1,0,2,3,1,0.6,0.4,0.8,0.6,1.8,0.6,1.4,0.7,1.1,0.9,3.33,1.33,3.25,0.4,-1.2,-0.2,-0.6,-0.333333333,-1,6,1,-2,2,1,2,1,-1,1,1,-1,0,0,0,0,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,Some questions were easy to answer...some I had to think about before answering.,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,6,2,3,4,8,9,5,1,7,2,4,3,1 +168,R_3wNRnLW5pNxtlMB,32 - 38,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly disagree,Somewhat agree,Somewhat agree,3,5,2,1,4,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,1,5,2,3,4,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,5,2,3,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Strongly Agree,5,2,1,3,4,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat agree,Agree,2,5,4,1,3,8,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,5,4,2,3,1,7,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,4,1,5,2,6,Disagree,Disagree,Strongly disagree,Disagree,Neither agree nor disagree,4,2,1,3,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,3,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,1,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,73,TRUE,87,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,75,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,74,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,-3,1,1,-1,1,2,0,1,0,1,3,0,2,0,0,1,2,3,3,3,-3,1,2,8,0,2,2,2,1,7,1,1,3,0,2,6,-2,-2,-3,-2,0,9,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,73,TRUE,1,87,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,75,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,74,0.25,0.0625,0.0169,0.25,0.0676,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.0729,0.25,0.25,0.25,0.25,0.25,0,1,0.25,0.25,1,0.272875,0.236971429,0.308778571,9,28.13,20,62.5,5,62.5,6,75,5,62.5,4,50,8,50,12,75,59.66,52.88,53,65.62,67.12,56.81,62.5,-34.37,-2.84,-9.62,-22,3.12,17.12,6.81,-12.5,1,0,0,0,1,1,1,0,2,0,1,0,0,0,0,2,2,4,4,3,2,3,3,1,1,1,1,2,0,1,0,1,3,0,2,0,0,1,2,3,0.4,0.8,0.2,3,2,1,1.2,1.2,1.1,1.35,1.225,7,5,6.25,-1.6,-0.2,-1,1.8,-0.933333333,3,2,1,4,2,2,1,1,-1,1,2,-2,0,0,0,0,2,5 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,,0.625,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,8,3,6,9,2,7,4,1,5,2,4,3,1 +169,R_3QnfACwTXTNSXlL,67 - 73,,Canadian,Canadian,Male,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,4,2,1,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,1,4,5,3,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,3,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,4,2,3,Somewhat disagree,Agree,Somewhat agree,Disagree,Agree,5,3,2,1,4,5,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,5,4,3,2,1,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,5,2,1,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,4,1,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,4,5,1,3,0,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,1,4,2,3,5,0,Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,5,1,4,2,3,0,Agree,Agree,Agree,Agree,Agree,1,3,5,2,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,97,TRUE,100,FALSE,84,FALSE,60,FALSE,56,FALSE,100,TRUE,98,TRUE,100,TRUE,92,TRUE,99,FALSE,99,TRUE,99,TRUE,95,FALSE,100,FALSE,73,TRUE,100,FALSE,94,TRUE,99,TRUE,58,FALSE,100,TRUE,100,FALSE,89,FALSE,50,FALSE,92,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,76,TRUE,92,TRUE,50,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,1,-1,1,0,-1,2,-1,1,1,1,1,0,1,1,1,1,1,1,-1,2,1,-2,2,5,1,0,2,-2,1,2,1,1,1,-1,1,1,1,1,1,1,0,6,-2,2,1,0,2,0,0,-1,2,-1,-1,0,2,2,1,2,1,0,2,2,2,2,2,3,FALSE,1,97,TRUE,1,100,FALSE,1,84,FALSE,1,60,FALSE,0,56,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,92,TRUE,1,99,FALSE,1,99,TRUE,0,99,TRUE,1,95,FALSE,1,100,FALSE,0,73,TRUE,1,100,FALSE,1,94,TRUE,0,99,TRUE,0,58,FALSE,1,100,TRUE,1,100,FALSE,0,89,FALSE,1,50,FALSE,0,92,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,76,TRUE,1,92,TRUE,1,50,TRUE,1,100,0,0,0,0.0004,0,0,0.8464,0.0001,0,0.7921,0.0064,0.0025,0.0064,0.0001,0.3136,0,0.25,0.16,0,0,0,0.5329,0.3364,0,0.0036,0.25,0.25,0.0009,0.0256,0.9801,0.5776,0.9801,0.225528571,0.169828571,0.281228571,27,84.38,23,71.88,5,62.5,6,75,6,75,6,75,12,75,11,68.75,87.56,72.75,83.88,97.75,95.88,89.75,85.38,12.5,15.68,10.25,8.88,22.75,20.88,14.75,16.63,0,0,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,2,1,1,0,2,0,1,1,1,1,1,0.4,0.6,0.2,0.2,0.6,0.4,0.8,1,0.35,0.7,0.525,2.67,0,2.125,-0.2,0.2,-0.6,-0.8,-0.2,5,2,1,3,2.67,-1,1,2,-2,2,1,-1,-2,2,-1,1,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,69,I think in some of the responses I read to much into the what if or questioning what you were referring to.,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,6,9,8,4,5,3,7,1,2,3,4,2,1 +170,R_32ilka2D1HBpF0Y,60 - 66,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,4,5,3,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,5,4,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,5,4,3,1,Somewhat agree,Agree,Somewhat agree,Agree,Agree,2,3,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,5,3,2,4,1,8,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,2,4,1,5,3,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,3,5,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,3,4,1,5,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,1,5,3,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,4,1,3,7,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,2,4,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,56,FALSE,95,TRUE,60,TRUE,100,FALSE,75,TRUE,100,FALSE,61,TRUE,100,FALSE,56,FALSE,91,TRUE,54,FALSE,100,TRUE,54,TRUE,100,FALSE,54,FALSE,52,FALSE,50,TRUE,83,TRUE,50,TRUE,100,TRUE,60,TRUE,100,TRUE,100,FALSE,80,FALSE,55,FALSE,57,FALSE,100,TRUE,62,FALSE,76,24,2,3,3,-1,3,0,1,1,1,1,2,2,2,0,3,1,2,1,2,2,3,3,3,-1,3,7,1,0,2,-1,1,8,1,1,1,1,1,7,1,1,1,2,1,8,3,3,3,1,2,8,1,1,1,1,1,8,1,1,1,1,1,8,1,0,2,0,-1,7,FALSE,1,76,TRUE,1,62,FALSE,1,100,FALSE,1,57,FALSE,0,55,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,50,TRUE,0,83,FALSE,0,50,FALSE,1,52,FALSE,0,54,TRUE,1,100,TRUE,0,54,FALSE,1,100,TRUE,0,54,FALSE,1,91,FALSE,0,56,TRUE,1,100,FALSE,1,61,TRUE,1,100,FALSE,1,75,TRUE,1,100,TRUE,0,60,FALSE,1,95,TRUE,0,56,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.04,0,0,0.0081,0,0,0.25,0.16,0.25,0.3025,0.1444,0.1521,0.1849,0.0025,0.0625,0.3136,0.2916,0.2916,0.2304,0.2916,0.36,0,0.0576,0,0,0.3136,0.6889,0.156996429,0.106571429,0.207421429,24,75,22,68.75,4,50,3,37.5,8,100,7,87.5,12,75,10,62.5,77.53,62.12,64,87.88,96.12,83.56,71.5,6.25,8.78,12.12,26.5,-12.12,8.62,8.56,9,1,0,0,0,0,1,1,1,2,0,1,1,1,1,2,0,1,0,0,1,1,0,0,2,1,1,0,0,0,0,1,1,1,1,2,0,2,1,2,3,0.2,1,1.2,0.4,0.8,0.2,1.2,1.6,0.7,0.95,0.825,7.33,8,7.625,-0.6,0.8,0,-1.2,0.066666667,-1,0,-1,1,-0.67,1,1,1,1,-1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,5,2,4,3,9,7,6,1,8,3,4,2,1 +171,R_3q3q3Q0nJoJN9XV,60 - 66,American,,American,Male,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,4,3,2,5,1,Agree,Disagree,Agree,Disagree,Strongly agree,1,3,5,2,4,Strongly Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,2,1,4,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Agree,5,1,3,4,2,1,Strongly agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,3,1,5,2,4,1,Strongly Agree,Strongly Agree,Agree,Somewhat Disagree,Strongly Agree,2,1,5,4,3,1,Strongly Agree,Agree,Agree,Agree,Strongly Agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,1,3,4,2,5,1,Agree,Disagree,Agree,Disagree,Strongly agree,4,3,2,5,1,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,5,2,3,1,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,3,2,FALSE,54,TRUE,87,FALSE,55,FALSE,52,TRUE,54,FALSE,63,TRUE,83,TRUE,70,TRUE,76,FALSE,96,FALSE,67,TRUE,91,TRUE,91,TRUE,55,TRUE,78,FALSE,62,TRUE,91,TRUE,94,FALSE,59,TRUE,63,TRUE,89,FALSE,63,TRUE,64,TRUE,67,TRUE,92,TRUE,93,TRUE,64,TRUE,93,FALSE,59,TRUE,98,FALSE,73,TRUE,97,11,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,2,2,2,1,2,-2,2,-2,3,3,2,3,-1,3,3,3,3,3,3,1,3,2,1,2,2,3,-1,3,-2,3,1,3,3,2,-1,3,1,3,2,2,2,3,1,1,3,2,3,0,1,2,-2,2,-2,3,1,3,3,3,-2,3,1,3,3,3,3,3,0,FALSE,1,54,TRUE,1,87,FALSE,1,55,FALSE,1,52,TRUE,1,54,FALSE,1,63,TRUE,1,83,TRUE,1,70,TRUE,1,76,FALSE,0,96,FALSE,1,67,TRUE,0,91,TRUE,1,91,TRUE,0,55,TRUE,1,78,FALSE,0,62,TRUE,0,91,TRUE,0,94,FALSE,1,59,TRUE,0,63,TRUE,1,89,FALSE,0,63,TRUE,0,64,TRUE,1,67,TRUE,0,92,TRUE,1,93,TRUE,0,64,TRUE,0,93,FALSE,1,59,TRUE,1,98,FALSE,0,73,TRUE,1,97,0.09,0.0049,0.3844,0.0289,0.0009,0.1369,0.1089,0.9216,0.3969,0.3969,0.0004,0.0081,0.0576,0.1089,0.2116,0.0169,0.4096,0.2304,0.8649,0.8464,0.0121,0.0484,0.1681,0.3025,0.8281,0.4096,0.5329,0.2116,0.2025,0.8836,0.1681,0.8281,0.332589286,0.214685714,0.450492857,11,34.38,19,59.38,6,75,6,75,3,37.5,4,50,12,75,7,43.75,74.78,69.5,76,78.75,74.88,79.81,69.75,-25,15.4,-5.5,1,41.25,24.88,4.81,26,1,1,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,0,1,1,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0.8,0.6,0.4,0.6,0.8,0,0.4,0,0.6,0.3,0.45,1.33,1,1,0,0.6,0,0.6,0.2,1,0,0,1,0.33,-1,-2,0,-1,1,1,-1,-1,1,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,66,none,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,2,8,7,9,6,5,3,1,4,2,3,4,1 +172,R_5aelI5mKEHjLTkn,53 - 59,,Canadian,Canadian,Male,Agree,Agree,Agree,Neither agree nor disagree,Agree,2,4,1,3,5,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,1,5,3,2,4,Agree,Agree,Agree,Agree,Neither Agree nor Disagree,4,5,1,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Disagree,Agree,3,5,2,4,1,2,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,3,1,5,2,4,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,2,5,4,3,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Neither agree nor disagree,Agree,5,4,1,3,2,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,2,5,4,3,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,3,2,4,5,2,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,4,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,75,TRUE,80,FALSE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,50,25,2,2,2,0,2,1,0,2,0,2,2,2,2,2,0,0,0,0,0,-2,2,2,2,-2,2,5,0,-1,2,0,2,2,2,1,2,2,1,4,0,1,1,0,0,2,2,2,2,0,2,4,1,0,1,0,1,3,2,1,2,2,1,3,1,0,0,1,1,2,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,80,TRUE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.04,0,0.25,0,0,0,0,0.25,1,0,0.25,0.25,0,0.5625,0,0,1,0,0,0.25,0,0.25,1,1,1,1,0.289375,0.145714286,0.433035714,25,78.13,21,65.63,5,62.5,6,75,5,62.5,5,62.5,15,93.75,6,37.5,89.22,81.25,93.75,90.62,91.25,98.75,79.69,12.5,23.59,18.75,18.75,28.12,28.75,5,42.19,0,0,0,2,0,1,1,0,0,0,0,1,0,0,1,0,1,1,0,2,0,0,0,0,0,0,0,1,0,1,0,1,0,0,1,1,0,0,1,3,0.4,0.4,0.4,0.8,0,0.4,0.4,1,0.5,0.45,0.475,3.67,3.33,3.125,0.4,0,0,-0.2,0.133333333,1,-1,1,0,0.34,0,0,0,0,0,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),58,thanks,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,2,5,8,9,6,4,7,1,3,2,4,3,1 +173,R_7j5jomYdBGGQDa9,25 - 31,American,,American,Male,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,3,1,5,2,Agree,Neither agree nor disagree,Agree,Disagree,Agree,4,5,1,2,3,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,1,5,3,2,4,Agree,Agree,Agree,Agree,Somewhat agree,2,4,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Agree,Strongly Agree,Somewhat agree,Agree,4,5,3,1,2,9,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,3,4,5,2,1,6,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,5,2,1,9,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,2,1,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,5,1,4,3,2,9,Agree,Somewhat agree,Agree,Strongly agree,Strongly agree,5,1,2,4,3,9,Agree,Strongly agree,Strongly agree,Agree,Agree,1,2,5,4,3,8,Somewhat agree,Agree,Agree,Somewhat agree,Agree,4,1,5,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,81,FALSE,90,FALSE,52,TRUE,75,FALSE,83,TRUE,98,FALSE,89,TRUE,83,TRUE,88,FALSE,81,FALSE,70,TRUE,73,TRUE,51,TRUE,76,TRUE,55,FALSE,75,TRUE,70,TRUE,87,FALSE,71,TRUE,88,TRUE,70,TRUE,93,FALSE,57,TRUE,63,FALSE,50,FALSE,50,FALSE,52,TRUE,51,FALSE,100,25,2,3,2,1,3,2,0,2,-2,2,3,2,3,2,3,2,2,2,2,1,2,2,3,1,2,10,1,1,0,2,1,9,2,1,1,1,1,6,-1,-1,0,-1,0,9,3,3,2,3,3,10,2,1,2,3,3,9,2,3,3,2,2,9,1,2,2,1,2,8,FALSE,1,100,TRUE,1,51,FALSE,1,52,FALSE,1,50,FALSE,0,50,TRUE,0,63,FALSE,0,57,TRUE,1,93,TRUE,1,70,TRUE,1,88,FALSE,1,71,TRUE,0,87,TRUE,1,70,FALSE,1,75,TRUE,1,55,TRUE,1,76,TRUE,0,51,TRUE,0,73,FALSE,1,70,FALSE,1,81,TRUE,1,88,TRUE,1,83,FALSE,1,89,TRUE,1,98,FALSE,1,83,TRUE,1,75,FALSE,1,52,FALSE,1,90,TRUE,0,81,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0049,0.0625,0.0576,0.3249,0,0.3969,0.0004,0.0144,0.0361,0.0289,0,0.09,0.09,0.0841,0.25,0.2401,0.0121,0.25,0.01,0.0289,0.0144,0.2025,0.09,0.0625,0.2601,0.2304,0,0,0.2304,0.5329,0.6561,0.7569,0.163146429,0.106642857,0.21965,25,78.13,25,78.13,8,100,4,50,6,75,7,87.5,14,87.5,11,68.75,75.69,64.88,74,79.25,84.62,78.38,73,0,-2.44,-35.12,24,4.25,-2.88,-9.12,4.25,0,1,1,0,1,1,1,2,4,1,1,1,2,1,2,3,3,2,3,1,1,0,0,2,0,0,1,0,5,1,1,1,0,0,1,1,0,0,1,1,0.6,1.8,1.4,2.4,0.6,1.4,0.6,0.6,1.55,0.8,1.175,8.33,9.33,8.75,0,0.4,0.8,1.8,0.4,0,0,-3,1,-1,1,1,2,1,-1,0,0,1,-1,1,-1,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),29,"Great survey, really taste me",0.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,8,4,7,5,2,9,3,1,6,3,4,2,1 +174,R_3OpLNshcHuBpHF9,46 - 52,,Canadian,Canadian,Female,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,1,5,4,3,2,Agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,2,5,1,3,4,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,5,4,1,3,2,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat agree,Agree,Agree,Agree,4,1,5,2,3,5,Agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,3,2,5,1,4,5,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,5,1,2,3,4,5,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,Disagree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,3,5,1,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,2,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Disagree,1,2,4,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,16,2,0,0,2,1,2,0,2,1,0,2,0,1,0,-1,2,0,1,0,-2,2,1,2,2,2,5,2,-1,2,-1,-1,5,2,2,2,0,-1,5,-1,-3,-2,-3,-2,5,1,1,0,2,1,5,0,0,0,0,0,5,1,1,1,0,-2,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,16,50,16,50,3,37.5,6,75,4,50,3,37.5,6,37.5,10,62.5,50,50,50,50,50,50,50,0,0,12.5,-25,0,12.5,12.5,-12.5,0,1,2,0,1,0,1,0,2,1,0,2,1,0,0,3,3,3,3,0,1,1,0,0,0,2,0,2,1,0,1,1,0,0,1,2,0,1,0,2,0.8,0.8,0.6,2.4,0.4,1,0.6,1,1.15,0.75,0.95,5,5,5,0.4,-0.2,0,1.4,0.066666667,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,20 cents,100 minutes,24 days,Female,University - Undergraduate,49,,-0.125,0,0,0,0,1,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,2,3,7,4,9,8,6,1,5,4,3,2,1 +175,R_72tu5iEDLN846PN,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,4,5,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,Strongly Agree,Strongly Agree,Agree,Somewhat Disagree,Somewhat Agree,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,5,2,1,Agree,Agree,Agree,Agree,Agree,4,2,1,5,3,0,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,4,1,3,2,Agree,Agree,Somewhat Disagree,Agree,Agree,3,2,1,5,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,5,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,5,1,1,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,1,5,4,3,1,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,5,2,1,4,1,Agree,Agree,Agree,Agree,Agree,4,3,2,5,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,61,TRUE,100,TRUE,100,TRUE,100,TRUE,79,TRUE,100,TRUE,100,TRUE,100,TRUE,91,TRUE,100,TRUE,91,TRUE,78,TRUE,88,TRUE,94,TRUE,86,TRUE,100,TRUE,86,TRUE,100,TRUE,87,TRUE,100,FALSE,75,TRUE,99,TRUE,83,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,71,FALSE,92,FALSE,78,TRUE,93,21,3,3,3,3,3,0,-1,2,1,1,3,3,2,-1,1,3,3,3,3,3,2,2,2,2,2,0,-1,-2,1,-1,0,2,2,2,-1,2,2,5,1,1,1,1,1,4,3,3,3,3,3,1,-1,-2,0,1,-1,1,1,2,1,0,2,1,2,2,2,2,2,1,TRUE,0,93,FALSE,0,78,FALSE,1,92,FALSE,1,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,99,FALSE,1,75,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,86,TRUE,1,100,TRUE,0,86,TRUE,0,94,TRUE,0,88,TRUE,0,78,TRUE,1,91,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,79,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,61,TRUE,1,100,0,0,0,0,0,0,0,0.0001,0.6084,0,0,0.0169,0.0289,0.0625,0,0.6084,0.8281,0.0841,1,1,0.0081,0.0196,0.7744,1,0.7396,0.6241,0.3721,0.8649,0.0064,0.8836,1,1,0.411792857,0.159814286,0.663771429,21,65.63,18,56.25,4,50,5,62.5,4,50,5,62.5,14,87.5,4,25,91.62,77.62,94.38,98.25,96.25,92.81,90.44,9.38,35.37,27.62,31.88,48.25,33.75,5.31,65.44,1,1,1,1,1,1,1,1,2,1,1,1,3,3,1,2,2,2,2,2,0,0,0,0,0,1,1,2,0,2,2,1,1,1,1,1,1,1,1,1,1,1.2,1.8,2,0,1.2,1.2,1,1.5,0.85,1.175,2.33,1,1.875,1,0,0.6,1,0.533333333,-1,1,4,3,1.33,-2,1,-2,-2,2,0,0,-1,1,-2,2,-2,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,Interesting ,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,5,7,6,2,8,4,9,1,3,3,4,2,1 +176,R_7Hz5Ri71s7av0sI,46 - 52,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,Agree,4,1,3,2,5,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,5,4,3,2,1,Neither Agree nor Disagree,Somewhat Disagree,Agree,Strongly Disagree,Agree,4,3,5,1,2,Agree,Agree,Agree,Strongly Agree,Agree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,Agree,2,4,5,3,1,1,Disagree,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,1,2,3,4,1,Neither Agree nor Disagree,Somewhat Disagree,Agree,Strongly Disagree,Agree,1,2,5,4,3,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,Agree,4,3,2,5,1,1,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,1,5,2,3,4,1,Neither Agree nor Disagree,Somewhat Disagree,Agree,Strongly Disagree,Agree,1,5,3,2,4,1,Agree,Agree,Agree,Agree,Agree,2,4,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,55,TRUE,91,TRUE,64,FALSE,100,FALSE,51,TRUE,58,FALSE,100,TRUE,52,FALSE,59,TRUE,100,TRUE,98,FALSE,51,TRUE,53,TRUE,96,TRUE,55,TRUE,96,TRUE,71,FALSE,96,TRUE,94,TRUE,91,FALSE,54,FALSE,63,TRUE,92,TRUE,100,TRUE,98,FALSE,100,TRUE,88,TRUE,51,FALSE,100,TRUE,69,FALSE,100,20,3,1,1,3,2,-1,-2,-1,-1,1,0,-1,2,-3,2,2,2,2,3,2,3,1,1,3,2,1,-2,-2,-1,1,-1,1,0,-1,2,-3,2,1,-1,-1,-1,-1,0,4,3,1,1,3,2,1,-2,-2,-1,-1,1,1,0,-1,2,-3,2,1,2,2,2,2,2,1,FALSE,1,100,TRUE,1,69,FALSE,1,100,TRUE,0,51,TRUE,1,88,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,92,FALSE,0,63,FALSE,1,54,TRUE,0,91,TRUE,1,94,FALSE,1,96,TRUE,1,71,TRUE,1,96,TRUE,0,55,TRUE,0,96,TRUE,0,53,FALSE,1,51,TRUE,1,98,TRUE,1,100,FALSE,1,59,TRUE,1,52,FALSE,1,100,TRUE,1,58,FALSE,1,51,FALSE,1,100,TRUE,0,64,TRUE,1,91,TRUE,1,55,TRUE,1,100,0,0.1764,0.0016,0.0004,0,0,0.2304,0.3969,0.2401,0,0.0081,0.0036,0.0064,0.2116,0.0144,0.0961,0.1681,0.2601,0,0,0.0004,0.0841,0.2809,0.0016,0.3025,0.2401,0.2025,0,0,0.9216,0.4096,0.8281,0.175257143,0.116842857,0.233671429,20,62.5,25,78.13,6,75,6,75,6,75,7,87.5,15,93.75,10,62.5,79.56,62,82.25,88.88,85.12,82.81,76.31,-15.63,1.43,-13,7.25,13.88,-2.38,-10.94,13.81,0,0,0,0,0,1,0,0,2,2,0,0,0,0,0,3,3,3,4,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,3,0,0.2,0,0.2,1,0.1,0.55,1,1,1.375,0,0.8,0,2.8,0.266666667,0,0,0,3,0,0,2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,5 minutes,47 days,Female,University - Undergraduate,52,,1.375,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,8,3,5,4,7,9,2,1,6,4,2,3,1 +177,R_7KwWl3ph6J35kk1,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,4,1,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,3,5,2,4,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,5,2,4,1,3,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,2,5,3,2,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,5,1,3,4,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,1,5,4,2,3,0,Disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,5,3,2,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,1,3,2,4,0,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,4,1,2,3,5,2,Agree,Agree,Agree,Agree,Somewhat agree,1,3,2,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,FALSE,95,FALSE,90,FALSE,100,FALSE,70,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,70,FALSE,100,FALSE,100,TRUE,100,FALSE,55,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,60,TRUE,80,TRUE,100,FALSE,100,22,3,3,3,3,3,0,-1,2,1,1,1,2,2,1,2,1,2,1,1,0,3,3,3,3,3,0,0,-1,2,-1,1,2,1,2,2,1,1,1,-2,0,-1,-2,-1,0,3,3,3,3,3,1,0,-2,2,-1,1,2,1,2,2,1,2,0,2,2,2,2,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,55,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,70,FALSE,1,100,FALSE,0,90,FALSE,0,95,TRUE,1,90,0,0,0,0,0.01,0,0,0,0,0,0.81,0,0,1,0,0,0,0.36,0.09,0,0.49,1,0,0,0.2025,1,0.9025,0,0.64,1,0,0,0.268035714,0.155714286,0.380357143,22,68.75,23,71.88,3,37.5,7,87.5,7,87.5,6,75,12,75,11,68.75,94.06,94.38,89.38,100,92.5,96.56,91.56,-3.13,22.18,56.88,1.88,12.5,17.5,21.56,22.81,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,3,2,2,3,1,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,1,1,1,0,0.4,0.2,2.2,0,0.6,0,0.8,0.7,0.35,0.525,1,1,1,0,-0.2,0.2,1.4,0,-1,0,1,-2,0,1,0,0,-1,1,0,0,1,-1,-1,1,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,37,N/A,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,02DGEN,02REV,4,8,2,5,9,7,3,1,6,4,3,2,1 +178,R_6VOqOlFTMz7RiZR,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly disagree,1,5,3,2,4,Somewhat agree,Somewhat disagree,Agree,Agree,Strongly agree,5,4,2,1,3,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,4,2,1,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,2,3,4,1,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,5,3,2,1,4,2,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,2,3,5,4,1,4,Agree,Agree,Agree,Agree,Agree,4,1,2,5,3,3,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,2,3,4,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Strongly disagree,1,4,3,2,5,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,4,3,2,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,5,1,3,4,6,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,2,3,5,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,68,TRUE,100,TRUE,82,FALSE,65,TRUE,79,TRUE,100,FALSE,100,TRUE,100,TRUE,61,TRUE,100,TRUE,76,TRUE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,92,TRUE,100,TRUE,100,TRUE,100,TRUE,69,TRUE,83,FALSE,63,TRUE,100,TRUE,100,TRUE,72,TRUE,100,TRUE,100,FALSE,69,TRUE,100,TRUE,100,16,1,3,3,2,-3,1,-1,2,2,3,2,2,3,1,3,0,-1,-1,1,-1,1,3,3,1,-3,2,1,-1,2,1,1,4,2,2,2,2,2,3,-1,-1,-2,1,-1,2,1,3,3,2,-3,2,-1,1,1,-1,-1,5,0,0,1,0,1,6,0,-1,-2,1,-1,5,TRUE,0,100,TRUE,1,100,FALSE,1,69,TRUE,0,100,TRUE,1,100,TRUE,0,72,TRUE,1,100,TRUE,1,100,FALSE,0,63,TRUE,1,83,TRUE,0,69,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,92,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,75,TRUE,1,76,TRUE,1,100,TRUE,0,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,79,FALSE,1,65,TRUE,0,82,TRUE,1,100,TRUE,1,68,TRUE,1,100,0,0,0,0,0,0.5184,0,0.0289,0.5625,0,0,0,0.3969,0.4761,0,0,0.3721,1,0.1225,0,0.0576,0.0064,1,1,1,0.6241,0.1024,1,0.0961,1,0.6724,1,0.394157143,0.239635714,0.548678571,16,50,18,56.25,3,37.5,4,50,5,62.5,6,75,15,93.75,3,18.75,89.19,83.88,86.38,97.88,88.62,92.62,85.75,-6.25,32.94,46.38,36.38,35.38,13.62,-1.13,67,0,0,0,1,0,0,0,0,1,2,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,2,2,1,3,4,2,2,2,1,2,0,0,1,0,0,0.2,0.6,0.6,0.4,0,2.4,1.8,0.2,0.45,1.1,0.775,3,4.33,3.625,0.2,-1.8,-1.2,0.2,-0.933333333,0,-1,-3,-3,-1.33,1,1,1,0,0,0,0,0,0,-1,1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,72,This was both enjoyable and challenging. Thank you for letting me participate.,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,6,5,4,8,7,9,2,1,3,3,4,2,1 +179,R_1nr8rXNvKWOPJUa,46 - 52,American,,American,Female,Strongly agree,Agree,Somewhat agree,Agree,Strongly agree,3,5,4,2,1,Disagree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,1,3,4,5,2,Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,2,1,4,3,Somewhat agree,Agree,Agree,Somewhat agree,Strongly Agree,1,2,4,3,5,Strongly Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,9,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,3,4,1,10,Strongly Agree,Strongly Agree,Agree,Agree,Agree,5,1,4,2,3,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly disagree,Agree,Strongly Agree,5,4,1,2,3,9,Agree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,5,1,2,4,3,9,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,5,4,3,2,1,10,Agree,Agree,Agree,Agree,Strongly Agree,1,4,3,2,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,79,TRUE,100,FALSE,77,TRUE,100,TRUE,91,TRUE,100,TRUE,73,FALSE,72,TRUE,100,TRUE,96,TRUE,100,TRUE,90,FALSE,67,TRUE,100,TRUE,100,TRUE,89,TRUE,100,FALSE,85,FALSE,59,FALSE,66,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,92,FALSE,66,TRUE,100,TRUE,100,TRUE,91,FALSE,66,TRUE,89,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,2,3,-2,1,3,-1,2,2,3,1,0,2,1,2,2,1,3,3,3,0,0,1,9,3,-3,3,0,3,10,3,3,2,2,2,8,3,3,3,3,3,8,3,3,-3,2,3,9,2,-2,3,-3,1,9,3,3,0,0,2,10,2,2,2,2,3,10,FALSE,1,100,FALSE,0,79,TRUE,0,100,FALSE,1,77,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,1,73,FALSE,0,72,TRUE,1,100,TRUE,0,96,TRUE,0,100,TRUE,1,90,FALSE,1,67,TRUE,1,100,TRUE,1,100,TRUE,0,89,TRUE,0,100,FALSE,1,85,FALSE,1,59,FALSE,0,66,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,66,TRUE,0,100,TRUE,0,100,TRUE,1,91,FALSE,0,66,TRUE,1,89,0.0729,0.0064,0,0,0.0121,0.8281,0,0,0.1681,0,0.0081,0.01,0.5184,0.9216,0,0.6241,1,0.0529,1,0,0.4356,0,0.0225,0.1089,0.7921,0.1156,0.4356,0,1,1,1,1,0.394775,0.295957143,0.493592857,23,71.88,19,59.38,4,50,3,37.5,7,87.5,5,62.5,12,75,7,43.75,89,80.12,90.62,94.88,90.38,88.62,89.38,12.5,29.62,30.12,53.12,7.38,27.88,13.62,45.63,0,1,1,2,2,5,4,0,1,1,1,0,1,2,0,2,1,1,2,0,0,1,4,0,0,4,3,0,2,1,1,0,1,0,0,1,0,0,1,0,1.2,2.2,0.8,1.2,1,2,0.4,0.4,1.35,0.95,1.15,9,9.33,9.125,0.2,0.2,0.4,0.8,0.266666667,0,1,-2,-2,-0.33,0,1,-1,-1,1,0,0,2,-2,-2,2,2,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),51,THis is a challening survey yet enjoyable. ,0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,8,9,7,5,6,4,3,1,2,4,3,2,1 +180,R_1lavWYwMBcrhkBT,67 - 73,American,,American,Male,Agree,Somewhat agree,Agree,Somewhat disagree,Agree,2,1,5,3,4,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,5,4,3,2,1,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,3,4,5,1,2,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,3,5,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Agree,Disagree,Strongly Agree,4,2,3,1,5,2,Agree,Disagree,Agree,Disagree,Agree,2,3,1,4,5,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Agree,3,4,2,1,5,2,Somewhat agree,Agree,Agree,Agree,Somewhat disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Somewhat agree,Agree,2,4,1,5,3,2,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Agree,2,5,4,1,3,2,Neither Agree nor Disagree,Disagree,Agree,Disagree,Agree,3,2,5,1,4,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,4,2,1,3,5,TRUE,81,FALSE,80,TRUE,90,FALSE,50,TRUE,81,FALSE,100,TRUE,100,TRUE,100,TRUE,60,FALSE,50,FALSE,81,TRUE,81,TRUE,81,FALSE,100,FALSE,81,TRUE,81,FALSE,100,TRUE,80,FALSE,86,FALSE,100,TRUE,100,TRUE,91,FALSE,81,FALSE,91,FALSE,50,TRUE,100,TRUE,50,FALSE,100,FALSE,100,FALSE,100,TRUE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,-1,2,0,-2,2,-2,2,1,-1,2,0,2,1,2,2,2,0,3,2,2,-2,3,2,2,-2,2,-2,2,2,1,0,2,2,2,2,1,2,2,2,-1,2,2,2,2,1,2,1,0,-2,2,0,2,2,0,-2,2,-2,2,2,0,0,2,2,-1,3,TRUE,0,81,FALSE,0,80,TRUE,0,90,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,FALSE,0,50,FALSE,1,81,TRUE,0,81,TRUE,1,81,FALSE,1,100,FALSE,0,81,TRUE,1,81,FALSE,1,100,TRUE,0,80,FALSE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,91,FALSE,1,81,FALSE,0,91,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,50,TRUE,1,100,0,0,0.0361,0,0,0,0.8281,0.25,0,0.0081,1,0.0361,0.16,0.0361,0.0361,0.64,0.0361,0.25,0,0.25,0,0.6561,0.0196,0,0,0.25,0.25,0.6561,0.81,0.64,0,0.6561,0.266732143,0.234328571,0.299135714,25,78.13,22,68.75,5,62.5,8,100,5,62.5,4,50,11,68.75,11,68.75,83.62,67.25,92.88,81.5,92.88,84.12,83.12,9.38,14.87,4.75,-7.12,19,42.88,15.37,14.37,1,1,0,1,1,2,0,0,0,0,0,1,0,2,0,0,0,0,0,1,0,1,0,2,0,0,0,0,2,0,1,1,0,2,0,1,2,0,0,1,0.8,0.4,0.6,0.2,0.6,0.4,0.8,0.8,0.5,0.65,0.575,2,1.67,2,0.2,0,-0.2,-0.6,0,1,0,0,-1,0.33,0,2,2,-2,2,-2,2,-2,2,-2,2,-1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),70,,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,3,5,6,8,4,9,7,1,2,2,4,3,1 +181,R_5hEr8txNV8G6XyV,67 - 73,,Canadian,Canadian,Female,Disagree,Disagree,Agree,Somewhat disagree,Strongly disagree,4,3,5,1,2,Disagree,Agree,Agree,Agree,Somewhat disagree,3,1,4,2,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,1,3,5,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Disagree,Somewhat agree,Disagree,Strongly disagree,3,4,5,2,1,1,Disagree,Somewhat agree,Agree,Agree,Disagree,3,2,5,4,1,1,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,3,5,4,2,1,1,Disagree,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Strongly disagree,5,3,1,2,4,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,1,3,5,2,4,1,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,4,5,1,3,2,0,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,2,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,FALSE,50,TRUE,85,TRUE,86,FALSE,75,FALSE,54,TRUE,91,TRUE,72,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,75,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,51,FALSE,65,TRUE,50,TRUE,62,FALSE,50,TRUE,90,TRUE,80,FALSE,76,FALSE,50,FALSE,50,FALSE,84,FALSE,50,TRUE,50,15,-2,-2,2,-1,-3,-2,2,2,2,-1,1,2,2,1,0,1,-1,1,1,-1,-2,-2,1,-2,-3,2,-2,1,2,2,-2,1,-1,2,1,1,-1,1,-2,-2,-1,0,-2,1,-3,-2,1,1,-3,0,-3,1,0,0,-3,1,1,2,-1,-1,-1,1,1,-1,1,1,-1,0,TRUE,0,50,FALSE,0,50,FALSE,1,84,FALSE,1,50,FALSE,0,50,FALSE,1,76,TRUE,1,80,TRUE,1,90,FALSE,0,50,TRUE,1,62,TRUE,0,50,FALSE,1,65,TRUE,1,51,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,72,TRUE,1,91,FALSE,1,54,FALSE,1,75,TRUE,0,86,TRUE,1,85,FALSE,0,50,TRUE,1,97,0.01,0.0081,0.25,0.04,0.0009,0.0576,0.25,0.1444,0.25,0.25,0.0225,0.2401,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.5184,0.25,0.25,0.25,0.25,0.25,0.2116,0.25,0.25,0.0256,0.0625,0.7396,0.1225,0.221721429,0.193964286,0.249478571,15,46.88,19,59.38,3,37.5,5,62.5,5,62.5,6,75,8,50,11,68.75,62.28,50.5,63.75,66.25,68.62,62.88,61.69,-12.5,2.9,13,1.25,3.75,-6.38,12.88,-7.06,0,0,1,1,0,0,1,0,0,1,2,0,1,0,1,3,1,2,1,1,1,0,1,2,0,1,1,2,2,2,0,0,3,2,1,0,0,0,0,0,0.4,0.4,0.8,1.6,0.8,1.6,1.2,0,0.8,0.9,0.85,1.33,0.67,0.875,-0.4,-1.2,-0.4,1.6,-0.666666667,2,0,0,1,0.66,1,1,0,-1,1,-1,1,1,-1,-1,1,-1,10 cents,100 minutes,47 days,Female,High School (or equivalent),69,This was interesting but it would be nice to know how many answers I got right,0.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,5,8,6,2,3,4,9,1,7,2,4,3,1 +182,R_3gOW8RvlAJODhim,67 - 73,,Canadian,Canadian,Male,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,Agree,2,1,3,5,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,Neither agree nor disagree,1,5,4,2,3,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,2,1,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,4,2,1,3,5,Somewhat disagree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,Strongly Agree,3,2,4,1,5,2,Somewhat agree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,5,2,1,4,3,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Strongly Agree,3,2,1,4,5,0,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Strongly Agree,Somewhat disagree,Agree,Neither agree nor disagree,4,2,1,5,3,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,Neither agree nor disagree,5,4,1,2,3,2,Somewhat Agree,Agree,Agree,Strongly Disagree,Strongly Agree,2,5,4,1,3,1,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,FALSE,50,TRUE,71,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,63,FALSE,50,TRUE,85,TRUE,62,FALSE,100,FALSE,62,FALSE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,69,TRUE,100,FALSE,87,FALSE,68,TRUE,100,TRUE,50,TRUE,96,FALSE,64,FALSE,50,TRUE,53,TRUE,50,TRUE,62,TRUE,50,FALSE,53,17,-1,3,-1,1,2,0,0,2,-3,0,1,2,2,0,2,0,0,1,2,1,-1,3,-1,0,3,2,1,-2,2,-3,0,1,1,2,2,1,3,0,1,0,1,0,1,2,-1,3,-1,2,0,6,0,0,-1,-3,0,2,1,2,2,-3,3,1,0,-2,1,1,1,7,FALSE,1,53,TRUE,1,50,TRUE,0,62,TRUE,0,50,TRUE,1,53,FALSE,1,50,FALSE,0,64,TRUE,1,96,TRUE,1,50,TRUE,1,100,FALSE,1,68,FALSE,1,87,TRUE,1,100,FALSE,1,69,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,62,FALSE,1,100,TRUE,1,62,TRUE,1,85,FALSE,1,50,TRUE,1,63,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,71,FALSE,0,50,TRUE,1,50,TRUE,1,100,0.0016,0,0,0.4096,0,0.25,0.1369,0,0,0.0225,0.25,0,0.25,0.1024,0.2209,0.25,0.25,0.25,0,1,0.1444,0.25,0.1444,0.0961,0.25,0.25,0.25,0.2209,0.3844,0,0.5041,0.0169,0.196210714,0.141621429,0.2508,17,53.13,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,71.72,53.75,67,83.88,82.25,73.31,70.12,-21.87,-3.28,-21.25,-8,8.88,7.25,-14.19,7.62,0,0,0,1,1,1,2,0,0,0,0,0,0,1,1,1,0,0,2,0,0,0,0,1,2,0,0,3,0,0,0,0,0,3,1,0,2,0,1,0,0.4,0.6,0.4,0.6,0.6,0.6,0.8,0.6,0.5,0.65,0.575,1,3,2.625,-0.2,0,-0.4,0,-0.2,-4,-1,-1,-5,-2,1,0,0,-1,1,-1,1,0,0,-1,1,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,71,the area covering beliefs was too general. Religious beliefs differ from other types of beliefs you may have,0.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,9,6,7,5,8,3,2,1,4,4,2,3,1 +183,R_6DOx4ZWfqkOgT71,53 - 59,American,,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,2,5,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,2,1,4,5,3,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,3,5,4,1,2,Disagree,Disagree,Disagree,Disagree,Strongly disagree,3,5,2,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,5,2,1,4,3,7,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Disagree,Strongly agree,3,2,4,1,5,5,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,1,3,2,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,Disagree,3,5,4,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,2,1,2,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,1,2,4,3,5,3,Somewhat Agree,Disagree,Agree,Disagree,Agree,2,3,4,1,5,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,4,2,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,83,TRUE,100,TRUE,87,TRUE,52,TRUE,95,FALSE,98,TRUE,87,TRUE,95,TRUE,89,TRUE,83,TRUE,83,TRUE,98,TRUE,95,FALSE,82,TRUE,77,TRUE,89,FALSE,76,TRUE,93,FALSE,83,FALSE,100,FALSE,73,TRUE,90,FALSE,69,TRUE,83,TRUE,81,TRUE,63,TRUE,73,FALSE,71,TRUE,69,TRUE,76,FALSE,74,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,3,3,-1,0,1,1,2,0,-1,2,1,1,-2,-2,-2,-2,-3,3,3,3,1,3,7,0,1,-1,-2,3,5,-1,-1,3,3,3,3,-1,0,1,-2,-2,4,3,3,3,3,3,2,-2,1,-1,1,1,3,1,-2,2,-2,2,2,0,1,1,1,-2,6,FALSE,1,83,TRUE,1,100,TRUE,0,87,TRUE,0,52,TRUE,1,95,FALSE,1,98,TRUE,1,87,TRUE,1,95,TRUE,1,89,TRUE,1,83,TRUE,0,83,TRUE,0,98,TRUE,1,95,FALSE,1,82,TRUE,1,77,TRUE,1,89,FALSE,1,76,TRUE,0,93,FALSE,1,83,FALSE,1,100,FALSE,0,73,TRUE,1,90,FALSE,1,69,TRUE,1,83,TRUE,0,81,TRUE,1,63,TRUE,0,73,FALSE,1,71,TRUE,0,69,TRUE,1,76,FALSE,0,74,TRUE,1,100,0.0025,0.1369,0.0121,0.0169,0,0.0004,0.0289,0.0289,0,0.01,0.0576,0.0025,0.0121,0.6889,0.0025,0,0.0961,0.2704,0.0841,0.6561,0.5329,0.0529,0.0289,0.0324,0.0576,0.5329,0.5476,0.0289,0.7569,0.8649,0.4761,0.9604,0.243246429,0.085592857,0.4009,26,81.25,22,68.75,4,50,6,75,6,75,6,75,14,87.5,8,50,83.34,78.88,84.38,82.75,87.38,85.56,81.12,12.5,14.59,28.88,9.38,7.75,12.38,-1.94,31.12,2,0,0,2,0,1,1,2,3,1,1,0,1,2,2,1,2,3,0,1,2,0,0,0,0,1,1,2,0,1,1,1,0,3,1,2,3,3,3,1,0.8,1.6,1.2,1.4,0.4,1,1.2,2.4,1.25,1.25,1.25,5,2.33,4,0.4,0.6,0,-1,0.333333333,5,2,1,-2,2.67,2,1,2,-1,1,2,-2,-1,1,-2,2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,53,I do not have any,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,6,2,3,8,4,5,9,1,7,3,4,2,1 +184,R_1TooM3xgnfa4iAN,67 - 73,American,,American,Female,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly agree,3,5,2,1,4,Strongly disagree,Disagree,Agree,Somewhat agree,Neither agree nor disagree,4,2,5,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,2,3,5,1,Agree,Agree,Strongly Agree,Strongly Agree,Agree,4,1,5,2,3,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,2,5,3,1,4,5,Strongly disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,2,4,1,3,5,0,Agree,Agree,Agree,Agree,Agree,2,3,5,4,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Disagree,Neither agree nor disagree,Agree,Agree,1,4,5,2,3,3,Strongly disagree,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,1,5,4,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,1,5,4,1,Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,5,3,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,TRUE,68,TRUE,100,TRUE,100,FALSE,95,TRUE,67,TRUE,97,FALSE,99,TRUE,100,FALSE,98,TRUE,94,FALSE,61,FALSE,82,TRUE,71,FALSE,97,FALSE,75,TRUE,100,TRUE,57,TRUE,92,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,87,TRUE,96,TRUE,90,FALSE,85,FALSE,58,FALSE,56,FALSE,100,TRUE,100,TRUE,77,13,1,0,1,1,3,-3,-2,2,1,0,3,3,3,-2,3,2,2,3,3,2,2,0,0,0,3,5,-3,-3,3,0,0,1,3,3,3,-2,3,0,2,2,2,2,2,2,0,-2,0,2,2,3,-3,-3,0,1,0,5,3,3,3,-3,3,1,2,2,3,3,2,1,TRUE,0,77,TRUE,1,100,FALSE,1,100,FALSE,1,56,FALSE,0,58,FALSE,1,85,TRUE,1,90,TRUE,1,96,TRUE,1,87,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,92,TRUE,1,57,TRUE,1,100,FALSE,1,75,FALSE,1,97,TRUE,0,71,FALSE,1,82,FALSE,0,61,TRUE,1,94,FALSE,1,98,TRUE,1,100,FALSE,1,99,TRUE,1,97,TRUE,0,67,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,68,TRUE,1,92,0.0016,0.0009,0,0.01,0.0064,0.0225,0,0,0.0324,0.0036,0,0,0.0169,0,0.3364,0,0.0004,0.1936,0.0025,0.0001,0.3721,0.1849,0.5041,0.8464,0.0625,0.4489,0.1024,0.5929,0,0.0009,1,1,0.204639286,0.043728571,0.36555,13,40.63,24,75,6,75,5,62.5,6,75,7,87.5,14,87.5,10,62.5,87.31,75.75,83.62,93.25,96.62,87.5,87.12,-34.37,12.31,0.75,21.12,18.25,9.12,0,24.62,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,0,1,2,1,1,1,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0.6,0.6,0,0.4,1.2,0.6,0.2,0,0.4,0.5,0.45,2,3,2.25,-0.6,0,-0.2,0.4,-0.266666667,2,-4,-1,1,-1,1,2,0,-2,2,0,0,-2,2,-2,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,71,very interesting questions much different than any other I have taken would take simmilar ones,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,3,4,8,7,9,5,1,6,2,4,3,1 +185,R_1EJn0lGnt7PpQmB,60 - 66,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,1,3,5,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,5,3,4,1,Strongly Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,2,5,3,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly disagree,3,2,4,5,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,4,1,2,Disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,3,4,5,2,1,3,Strongly Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,2,1,5,3,2,Somewhat agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly Agree,4,1,3,5,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,4,5,3,1,2,2,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,4,1,5,2,3,1,Strongly Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Agree,3,2,5,4,1,2,Strongly disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly disagree,5,4,2,3,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,60,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,75,TRUE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,50,FALSE,100,FALSE,50,TRUE,80,FALSE,100,TRUE,66,FALSE,80,TRUE,53,FALSE,100,FALSE,100,TRUE,50,TRUE,58,TRUE,50,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,3,-1,-1,1,0,1,3,-3,3,1,3,-1,1,-1,-1,-3,2,3,3,3,3,2,-2,-1,1,2,1,3,3,-3,3,1,3,2,1,-3,1,0,3,9,2,3,3,1,2,2,-3,-3,1,-3,0,1,3,-3,3,1,2,2,-3,1,-1,-1,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,60,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,75,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,66,FALSE,1,80,TRUE,1,53,FALSE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,58,TRUE,1,50,TRUE,1,100,0,0.2209,0,0,0,0,0.1156,0,0,0.04,0.1764,0,0.25,0.25,0,0,0,0.25,0,0.04,0.25,0.25,0.25,0.25,0.25,0,0.25,0,0.36,0.25,0.25,0.0625,0.126589286,0.077285714,0.175892857,27,84.38,27,84.38,6,75,6,75,8,100,7,87.5,14,87.5,13,81.25,75.69,62.5,81.25,76.62,82.38,78.56,72.81,0,-8.69,-12.5,6.25,-23.38,-5.12,-8.94,-8.44,0,0,0,2,0,1,0,0,2,0,0,0,0,0,0,2,4,2,1,6,0,0,0,0,1,2,2,0,3,1,0,0,0,0,1,2,0,0,0,0,0.4,0.6,0,3,0.2,1.6,0.2,0.4,1,0.6,0.8,2.33,1.67,3.25,0.2,-1,-0.2,2.6,-0.333333333,0,2,0,4,0.66,0,1,1,-2,2,-1,1,-1,1,-1,1,1,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,65,very interesting,1,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,5,6,4,9,8,2,3,1,7,4,3,2,1 +186,R_5BP5IvVmlpPoyuR,60 - 66,American,,American,Female,Disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Agree,2,3,4,5,1,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,2,1,4,5,3,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Neither agree nor disagree,Strongly Agree,Agree,Strongly Agree,2,3,1,4,5,4,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,3,Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,5,4,1,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,1,5,4,2,3,2,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,3,5,1,4,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,1,2,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,83,FALSE,50,TRUE,80,TRUE,50,TRUE,50,FALSE,50,TRUE,84,FALSE,82,TRUE,50,FALSE,50,TRUE,81,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,98,TRUE,50,TRUE,97,TRUE,73,TRUE,82,FALSE,50,TRUE,50,TRUE,83,TRUE,96,TRUE,87,FALSE,91,TRUE,50,FALSE,50,TRUE,89,TRUE,81,TRUE,88,25,-2,0,3,3,2,-2,0,1,0,0,2,1,2,-1,1,1,1,2,2,1,-2,0,3,2,3,4,-2,0,1,0,0,4,2,1,2,-1,1,3,1,1,1,1,1,5,-2,0,3,3,2,2,-2,0,1,0,0,2,2,1,2,-1,1,2,1,1,1,2,1,3,TRUE,0,88,TRUE,1,81,TRUE,0,89,FALSE,1,50,TRUE,1,50,FALSE,1,91,TRUE,1,87,TRUE,1,96,TRUE,1,83,TRUE,1,50,FALSE,1,50,TRUE,0,82,TRUE,1,73,TRUE,0,97,TRUE,1,50,TRUE,1,98,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,81,FALSE,1,50,TRUE,1,50,FALSE,1,82,TRUE,1,84,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,80,FALSE,0,50,TRUE,1,83,0.0016,0.0256,0.0004,0.0169,0.0289,0.0081,0.25,0.25,0.25,0.0361,0.04,0.0729,0.0289,0.25,0.25,0.0361,0.25,0.25,0.25,0.0324,0.25,0.25,0.25,0.9409,0.25,0.25,0.25,0.7744,0.7921,0.25,0.25,0.6724,0.266542857,0.142928571,0.390157143,25,78.13,23,71.88,7,87.5,6,75,5,62.5,5,62.5,15,93.75,8,50,67.97,58,62.12,77.38,74.38,71.62,64.31,6.25,-3.91,-29.5,-12.88,14.88,11.88,-22.13,14.31,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.4,0,0,0.4,0,0,0,0.2,0.2,0.05,0.125,3.67,2,3.125,0.4,0,0,0.2,0.133333333,2,2,1,2,1.67,1,1,1,-1,1,0,0,-1,1,-1,1,0,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,,0.75,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,9,6,7,8,3,2,4,1,5,3,4,2,1 +187,R_3zDeRIbcpMwUQ13,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Disagree,3,4,2,5,1,Disagree,Somewhat disagree,Agree,Strongly agree,Disagree,5,3,1,4,2,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,1,2,4,5,3,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,2,3,4,Agree,Agree,Somewhat disagree,Somewhat disagree,Agree,5,3,4,2,1,5,Disagree,Neither agree nor disagree,Disagree,Strongly agree,Somewhat agree,3,2,1,5,4,5,Agree,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,5,1,3,4,2,6,Somewhat disagree,Strongly disagree,Disagree,Disagree,Neither agree nor disagree,1,2,3,4,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Strongly Agree,Agree,Disagree,4,5,1,3,2,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,Somewhat disagree,2,1,3,4,5,4,Somewhat Agree,Agree,Strongly Disagree,Strongly Disagree,Somewhat Agree,3,2,1,5,4,4,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,4,1,2,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,82,TRUE,78,TRUE,100,FALSE,77,FALSE,69,TRUE,69,FALSE,100,TRUE,88,FALSE,58,TRUE,98,TRUE,82,FALSE,98,TRUE,100,TRUE,100,TRUE,71,TRUE,100,FALSE,61,TRUE,100,FALSE,91,FALSE,100,TRUE,80,TRUE,97,FALSE,76,TRUE,100,TRUE,67,TRUE,100,TRUE,72,FALSE,68,TRUE,100,TRUE,100,TRUE,100,TRUE,100,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,3,-2,-2,-2,-1,2,3,-2,1,2,-1,1,1,-2,-2,-1,-1,-1,2,2,-1,-1,2,5,-2,0,-2,3,1,5,2,1,2,3,1,6,-1,-3,-2,-2,0,8,2,1,3,2,-2,4,-3,-3,-3,3,-1,4,1,2,-3,-3,1,4,-1,-2,-1,-1,-1,2,TRUE,0,82,TRUE,1,78,TRUE,0,100,FALSE,1,77,FALSE,0,69,TRUE,0,69,FALSE,0,100,TRUE,1,88,FALSE,0,58,TRUE,1,98,TRUE,0,82,FALSE,1,98,TRUE,1,100,TRUE,0,100,TRUE,1,71,TRUE,1,100,FALSE,1,61,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,80,TRUE,1,97,FALSE,1,76,TRUE,1,100,TRUE,0,67,TRUE,1,100,TRUE,0,72,FALSE,1,68,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0144,0,0,1,0,0.4761,0,0.0004,0,0.0009,0,0,0.3364,0.6724,0.4761,0.0484,0.0576,0.0529,0.1024,0.4489,0.04,0.0841,0.0081,1,0.1521,0.5184,0,0.6724,1,1,1,0.0004,0.291,0.151514286,0.430485714,14,43.75,20,62.5,5,62.5,5,62.5,3,37.5,7,87.5,13,81.25,7,43.75,86.94,78.62,81.88,93,94.25,89.94,83.94,-18.75,24.44,16.12,19.38,55.5,6.75,8.69,40.19,1,1,4,1,4,0,1,4,0,3,1,1,3,2,0,1,1,1,1,1,1,0,0,4,0,1,2,5,0,1,0,0,2,4,0,1,0,0,0,0,2.2,1.6,1.4,1,1,1.8,1.2,0.2,1.55,1.05,1.3,5.33,4,4.75,1.2,-0.2,0.2,0.8,0.4,1,1,2,6,1.33,0,2,0,-2,2,-1,1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,I enjoyed taking this survey - it was different from many others I’ve completed. Thank you!,1.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,7,2,9,6,4,8,3,1,5,3,2,4,1 +188,R_6rrnCccLen5H6KZ,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Agree,Agree,Strongly disagree,Strongly agree,1,2,5,3,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Strongly agree,1,3,5,4,2,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Somewhat Agree,3,5,4,2,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,4,5,2,1,3,Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,3,1,4,5,2,5,Agree,Neither agree nor disagree,Agree,Disagree,Strongly agree,5,3,4,2,1,1,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,5,1,3,4,2,6,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Disagree,5,2,1,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,2,1,3,4,2,Agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,3,4,2,5,1,3,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,1,4,2,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,80,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,90,FALSE,80,TRUE,100,TRUE,95,FALSE,90,FALSE,100,TRUE,100,FALSE,100,TRUE,95,TRUE,100,TRUE,100,TRUE,99,FALSE,99,TRUE,100,FALSE,80,FALSE,50,TRUE,90,FALSE,100,16,1,2,2,-3,3,1,0,1,-2,3,-1,0,3,1,1,-1,0,0,1,-3,2,3,3,-3,3,5,2,0,2,-2,3,1,-1,0,3,3,0,6,-2,0,0,-1,-2,6,1,3,3,0,3,2,2,-1,0,-1,3,3,-1,0,3,0,1,2,0,0,0,0,0,3,FALSE,1,100,TRUE,1,90,FALSE,1,50,FALSE,1,80,TRUE,1,100,FALSE,1,99,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,90,TRUE,1,95,TRUE,1,100,FALSE,1,80,FALSE,1,90,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0001,0,0.0001,0,0.0025,0,0,1,1,0,0,0,0.01,0,0.04,1,0.04,0,0.0025,0,0.01,0.04,0,0,0,0.25,0.01,1,1,0.193039286,0.146614286,0.239464286,16,50,27,84.38,8,100,6,75,8,100,5,62.5,14,87.5,13,81.25,95.25,95.62,97.38,94.25,93.75,98.69,91.81,-34.38,10.87,-4.38,22.38,-5.75,31.25,11.19,10.56,1,1,1,0,0,1,0,1,0,0,0,0,0,2,1,1,0,0,2,1,0,1,1,3,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,3,0.6,0.4,0.6,0.8,1,0.8,0.2,1,0.6,0.75,0.675,4,2.33,3.5,-0.4,-0.4,0.4,-0.2,-0.133333333,3,-2,4,3,1.67,2,2,2,-1,1,0,0,-2,2,-2,2,2,10 cents,5 minutes,47 days,Male,High School (or equivalent),49,Very cool and interesting survey. (I loved it) - Nice job guys.,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,2,3,8,7,4,9,1,5,2,4,3,1 +189,R_6S8ENIP57PJHIsp,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,2,4,3,1,5,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,5,2,4,3,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,4,2,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly disagree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Strongly Agree,Agree,Agree,2,5,1,3,4,2,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,3,5,1,2,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,3,1,2,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Strongly Agree,Agree,Somewhat agree,3,4,1,2,5,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,3,2,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,3,5,1,2,7,Strongly disagree,Disagree,Disagree,Somewhat disagree,Strongly disagree,4,3,5,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,50,FALSE,66,TRUE,59,FALSE,70,TRUE,50,TRUE,74,TRUE,55,TRUE,86,TRUE,50,FALSE,50,FALSE,50,FALSE,89,FALSE,50,TRUE,50,FALSE,50,TRUE,91,TRUE,50,FALSE,90,TRUE,50,TRUE,50,FALSE,67,FALSE,50,FALSE,50,TRUE,62,TRUE,58,FALSE,50,TRUE,60,FALSE,50,FALSE,50,TRUE,80,TRUE,85,23,1,1,3,0,2,-1,1,2,1,1,0,-1,1,0,2,-1,-1,1,-1,-3,3,2,3,2,2,2,-2,1,1,1,1,2,-1,-1,1,0,2,2,-1,0,-1,0,-3,3,2,2,3,2,1,3,-1,1,1,1,1,4,0,0,1,0,2,4,-3,-2,-2,-1,-3,7,TRUE,0,85,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,60,FALSE,1,50,TRUE,1,58,TRUE,1,62,FALSE,0,50,FALSE,0,50,FALSE,1,67,TRUE,0,50,TRUE,1,50,FALSE,1,90,TRUE,1,50,TRUE,1,91,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,89,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,86,TRUE,0,55,TRUE,1,74,TRUE,0,50,FALSE,1,70,TRUE,0,59,FALSE,0,66,FALSE,0,50,TRUE,1,96,0.1444,0.0676,0.0081,0.1764,0.0016,0.25,0.0196,0.25,0.0121,0.25,0.4356,0.25,0.25,0.1089,0.16,0.04,0.25,0.25,0.09,0.3025,0.25,0.25,0.25,0.01,0.25,0.25,0.25,0.7225,0.25,0.25,0.3481,0.25,0.223246429,0.180557143,0.265935714,23,71.88,19,59.38,5,62.5,5,62.5,3,37.5,6,75,10,62.5,9,56.25,62.12,55.88,58.12,64,70.5,63.94,60.31,12.5,2.74,-6.62,-4.38,26.5,-4.5,1.44,4.06,2,1,0,2,0,1,0,1,0,0,1,0,0,0,0,0,1,2,1,0,1,1,0,2,1,0,0,1,0,0,0,1,0,0,0,2,1,3,0,0,1,0.4,0.2,0.8,1,0.2,0.2,1.2,0.6,0.65,0.625,2,3.67,3.375,0,0.2,0,-0.4,0.066666667,-1,-2,-2,-4,-1.67,0,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,61,would be interesting to know the answers to the questions in the survey.,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,3,6,4,8,7,9,2,1,5,3,2,4,1 +190,R_7KZu4HZPAvniCUw,60 - 66,American,,American,Female,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,1,2,3,5,4,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,4,3,2,1,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,4,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,4,5,2,Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,4,5,2,3,1,4,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,5,2,4,1,4,Agree,Agree,Agree,Agree,Somewhat Agree,1,5,4,2,3,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,3,4,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Agree,Somewhat agree,4,3,5,1,2,3,Somewhat disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,1,2,5,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,4,5,1,3,2,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,1,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,92,TRUE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,100,TRUE,96,TRUE,100,TRUE,100,TRUE,96,TRUE,100,FALSE,100,TRUE,85,TRUE,100,FALSE,92,TRUE,97,TRUE,90,TRUE,100,TRUE,100,TRUE,100,FALSE,93,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,100,TRUE,94,25,2,3,2,1,3,0,-2,2,-1,1,2,1,2,1,2,1,1,1,1,-1,2,3,2,1,3,4,0,-2,2,-1,1,4,2,2,2,2,1,6,0,1,1,1,-1,6,2,3,2,2,1,3,-1,-2,2,-1,0,5,1,1,1,0,2,2,1,2,1,1,1,5,TRUE,0,94,TRUE,1,100,TRUE,0,100,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,93,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,90,TRUE,1,97,FALSE,1,92,TRUE,0,100,TRUE,0,85,FALSE,1,100,TRUE,1,100,TRUE,1,96,TRUE,0,100,TRUE,1,100,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,0,0,0.0009,0,0,0,0,0,0,0.0016,0,0,0,0.0049,0,0,1,0.64,0.64,0.9216,0,0.01,0.7225,1,0.0064,1,0.0064,0.8836,1,1,1,1,0.387035714,0.117607143,0.656464286,25,78.13,20,62.5,5,62.5,6,75,4,50,5,62.5,16,100,4,25,96.72,92.5,99,98.25,97.12,98.44,95,15.63,34.22,30,24,48.25,34.62,-1.56,70,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,1,2,1,0,0,0,1,1,0,1,1,0,0,1,0,0,2,0,0,0.6,0.2,0.6,0.4,0.6,0.6,0.2,0.55,0.375,4.67,3.33,4.375,-0.6,-0.4,0,-0.4,-0.333333333,1,-1,4,1,1.34,1,1,0,-1,1,1,-1,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,6,9,3,2,8,7,5,1,4,4,2,3,1 +191,R_7uK8ncoM3QhZibI,60 - 66,American,,American,Female,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,4,3,1,2,Strongly agree,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat agree,5,4,1,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,4,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,1,3,2,Strongly disagree,Strongly disagree,Strongly Agree,Strongly disagree,Strongly Agree,5,3,4,1,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,1,2,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Disagree,Strongly Agree,Somewhat agree,Somewhat disagree,2,3,5,1,4,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,1,2,4,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,1,2,3,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,60,TRUE,85,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,50,FALSE,80,FALSE,85,FALSE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,50,FALSE,60,FALSE,100,FALSE,55,FALSE,100,FALSE,100,TRUE,50,FALSE,100,TRUE,65,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,75,FALSE,70,FALSE,90,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,-3,3,-3,2,3,-3,-3,-3,1,3,3,3,1,3,3,3,3,3,3,-3,-3,3,-3,3,0,3,-3,3,-3,3,0,3,3,3,3,3,2,3,3,3,3,3,0,-2,-2,3,1,-1,4,3,-3,3,-3,1,1,3,3,3,1,3,0,3,3,3,3,3,0,TRUE,0,60,TRUE,1,85,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,80,FALSE,1,85,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,60,FALSE,1,100,FALSE,1,55,FALSE,1,100,FALSE,0,100,TRUE,1,50,FALSE,1,100,TRUE,1,65,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,FALSE,0,70,FALSE,0,90,TRUE,1,100,0,0,0.25,0,0,0,0.1225,0.64,0,0.25,0.49,1,0.25,0.0225,0.25,0.0225,0,0.25,0,0,1,0.25,0.2025,1,0.16,0.25,0.81,0.36,1,0,0.5625,0,0.317589286,0.235535714,0.399642857,16,50,21,65.63,6,75,4,50,5,62.5,6,75,10,62.5,11,68.75,80.47,64.38,85.62,86.25,85.62,77.5,83.44,-15.63,14.84,-10.62,35.62,23.75,10.62,15,14.69,0,0,0,0,1,0,0,6,0,2,0,0,0,2,0,0,0,0,0,0,1,1,0,4,3,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0.2,1.6,0.4,0,1.8,1.2,0,0,0.55,0.75,0.65,0.67,1.67,0.875,-1.6,0.4,0.4,0,-0.266666667,-4,-1,2,0,-1,0,2,0,0,0,0,0,2,-2,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,60,Just curious about what this tells about me.,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,4,6,2,8,5,7,9,1,3,4,3,2,1 +192,R_717Qrjqx0Ht7egx,60 - 66,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Agree,Somewhat disagree,4,1,5,3,2,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Somewhat agree,5,1,3,4,2,Agree,Somewhat Disagree,Agree,Disagree,Strongly Agree,4,2,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Agree,Somewhat disagree,4,1,5,2,3,2,Somewhat agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,4,2,3,2,Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly Agree,1,4,3,5,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Agree,Disagree,5,3,4,2,1,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,3,2,1,5,0,Somewhat Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly agree,5,4,1,3,2,1,Strongly Agree,Agree,Strongly Agree,Agree,Agree,1,2,5,4,3,FALSE,81,TRUE,93,FALSE,100,FALSE,50,TRUE,85,FALSE,93,TRUE,94,TRUE,94,TRUE,100,TRUE,100,FALSE,86,FALSE,70,TRUE,92,TRUE,92,FALSE,71,TRUE,89,TRUE,75,TRUE,90,FALSE,94,FALSE,94,TRUE,96,TRUE,79,TRUE,59,TRUE,91,FALSE,95,TRUE,91,FALSE,63,FALSE,96,TRUE,78,TRUE,90,FALSE,59,TRUE,95,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,2,-1,1,-3,2,-1,1,2,-1,2,-2,3,3,3,3,3,3,2,2,2,2,-1,1,1,-1,3,0,1,2,2,0,2,-3,3,2,1,1,1,1,1,6,2,2,2,2,-2,1,1,-3,3,-3,1,0,1,0,2,-3,3,0,3,2,3,2,2,1,FALSE,1,81,TRUE,1,93,FALSE,1,100,FALSE,1,50,TRUE,1,85,FALSE,1,93,TRUE,1,94,TRUE,1,94,TRUE,1,100,TRUE,1,100,FALSE,1,86,FALSE,1,70,TRUE,1,92,TRUE,0,92,FALSE,0,71,TRUE,1,89,TRUE,0,75,TRUE,0,90,FALSE,1,94,FALSE,1,94,TRUE,1,96,TRUE,1,79,TRUE,0,59,TRUE,1,91,FALSE,1,95,TRUE,1,91,FALSE,1,63,FALSE,1,96,TRUE,0,78,TRUE,1,90,FALSE,0,59,TRUE,1,95,0.0036,0.0081,0.0121,0.0036,0.0025,0.0049,0.0081,0,0.0036,0.0441,0.01,0.0064,0,0.0196,0.0225,0.0049,0.3481,0.25,0.0016,0.0025,0.0016,0.5041,0.0036,0.8464,0.5625,0.1369,0.3481,0.0361,0,0.81,0.6084,0.09,0.167017857,0.051764286,0.282271429,27,84.38,25,78.13,6,75,5,62.5,6,75,8,100,14,87.5,11,68.75,85.47,77,84.12,90.25,90.5,88.69,82.25,6.25,7.34,2,21.62,15.25,-9.5,1.19,13.5,1,0,0,0,0,0,2,1,1,0,0,1,0,1,0,2,2,2,2,2,1,0,0,0,1,0,0,1,2,0,1,1,0,1,0,0,1,0,1,1,0.2,0.8,0.4,2,0.4,0.6,0.6,0.6,0.85,0.55,0.7,1.67,0.33,1.625,-0.2,0.2,-0.2,1.4,-0.066666667,0,2,2,5,1.34,1,1,2,-2,2,1,-1,1,-1,-1,1,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,"no issues, great questions",0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,9,8,7,6,5,3,2,1,4,2,4,3,1 +193,R_32AbkEeLXpIYgdH,60 - 66,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Disagree,Somewhat agree,5,3,4,1,2,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,5,1,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,3,1,4,Somewhat agree,Agree,Agree,Agree,Agree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,4,3,1,2,5,0,Somewhat disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,5,1,3,2,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,4,1,5,2,0,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,1,5,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Agree,Agree,Neither agree nor disagree,Agree,1,4,5,2,3,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,5,4,3,1,2,2,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,3,1,2,4,5,0,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat agree,1,2,4,5,3,TRUE,85,TRUE,100,TRUE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,90,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,89,TRUE,100,FALSE,79,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-2,1,-2,0,2,1,1,3,3,3,0,3,1,2,2,2,2,3,3,3,-1,0,3,-1,1,3,0,2,0,3,3,3,2,3,3,0,1,1,2,2,0,3,2,2,0,2,0,0,0,2,0,-1,0,3,3,3,-1,3,2,1,0,2,2,1,0,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,89,TRUE,1,100,FALSE,0,79,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,1,0.25,1,1,0,0.0625,1,1,0.81,0.25,0.6241,0.7225,1,1,0.7921,1,0.420042857,0.107142857,0.732942857,24,75,17,53.13,4,50,4,50,4,50,5,62.5,14,87.5,3,18.75,92.75,81.75,91.12,98.12,100,94,91.5,21.87,39.62,31.75,41.12,48.12,37.5,6.5,72.75,0,1,1,1,1,1,1,1,1,1,0,0,0,2,0,1,1,1,0,0,0,0,0,2,1,2,0,0,1,2,0,0,0,1,0,0,2,0,0,1,0.8,1,0.4,0.6,0.6,1,0.2,0.6,0.7,0.6,0.65,2,0.67,1,0.2,0,0.2,0,0.133333333,3,0,1,0,1.33,0,2,2,-2,2,1,-1,1,-1,-1,1,2,10 cents,5 minutes,24 days,Female,Trade School (non-military),65,Interesting,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,02DGEN,01DIR,7,8,6,9,4,2,5,1,3,2,4,3,1 +194,R_7EpfyyIfd3kset4,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,1,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,2,3,1,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,3,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,32,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,1,1,1,1,0.642857143,0.571428571,0.714285714,32,100,12,37.5,4,50,2,25,3,37.5,3,37.5,7,43.75,5,31.25,100,100,100,100,100,100,100,62.5,62.5,50,75,62.5,62.5,56.25,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,2,2,2,2,-2,2,-2,2,-2,2,-2,2,10 cents,5 minutes,47 days,Female,University - PhD,23,,0,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,6,9,4,5,2,3,8,1,7,2,4,3,1 +195,R_5s1fW4qD4ZuXL1M,53 - 59,,Canadian,Canadian,Male,Disagree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,2,5,1,3,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,5,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,3,1,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,Disagree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,1,3,2,4,5,0,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,2,5,3,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,3,1,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,1,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,2,5,1,3,4,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,1,3,4,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,2,3,1,2,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,97,FALSE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,50,FALSE,50,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,100,FALSE,100,FALSE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,2,1,3,0,2,1,0,1,0,0,0,0,0,1,0,0,0,0,-2,3,1,1,3,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,-2,3,0,1,3,1,0,1,1,1,1,1,0,0,0,0,0,2,1,0,0,0,0,2,TRUE,0,97,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0.25,1,0,0,0.25,0,0.25,1,0,0,0,0,0.25,0,0.25,0.25,0,0.25,0,0,1,0.25,0,1,0,0.25,0.25,0.9409,1,0,0.25,1,0.301460714,0.178571429,0.42435,24,75,16,50,3,37.5,5,62.5,4,50,4,50,5,31.25,11,68.75,82.72,62.5,81.25,99.62,87.5,75,90.44,25,32.72,25,18.75,49.62,37.5,43.75,21.69,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0,0.2,0.4,0.4,0,0,0.2,0.2,0.2,0.67,1.33,1.125,-0.2,0,0,0.2,-0.066666667,-1,0,-1,-1,-0.66,0,1,1,-2,2,0,0,0,0,-1,1,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,59,it made me think,0.625,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,6,5,9,7,3,4,8,1,2,4,3,2,1 +196,R_7W6fO2X8ztw1fhv,60 - 66,American,,American,Female,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Strongly agree,3,5,4,1,2,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,2,4,5,1,3,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,4,3,1,5,Agree,Agree,Agree,Agree,Agree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Somewhat agree,Strongly Agree,Disagree,Strongly Agree,4,2,5,1,3,7,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,3,4,1,5,2,9,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,2,4,3,5,6,Agree,Agree,Agree,Agree,Agree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Strongly Agree,1,3,2,4,5,5,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,5,2,1,4,3,0,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,1,5,3,8,Agree,Agree,Agree,Strongly Agree,Agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,75,TRUE,100,FALSE,76,FALSE,100,TRUE,74,TRUE,75,FALSE,100,TRUE,100,FALSE,76,TRUE,100,FALSE,78,FALSE,77,FALSE,76,TRUE,79,TRUE,83,TRUE,100,FALSE,74,FALSE,79,TRUE,100,TRUE,100,TRUE,71,TRUE,100,FALSE,82,TRUE,100,TRUE,100,FALSE,78,FALSE,73,FALSE,78,TRUE,100,FALSE,76,FALSE,79,16,0,1,2,-2,3,1,0,2,-2,1,3,3,2,0,3,2,2,2,2,2,0,1,3,-2,3,8,2,0,3,-1,2,7,3,3,2,0,2,9,2,2,2,2,2,6,0,2,2,0,3,5,3,0,3,0,2,5,3,3,2,0,3,0,2,2,2,3,2,8,FALSE,1,79,FALSE,0,76,TRUE,0,100,FALSE,1,78,FALSE,0,73,FALSE,1,78,TRUE,1,100,TRUE,1,100,FALSE,0,82,TRUE,1,100,TRUE,0,71,TRUE,0,100,TRUE,1,100,FALSE,1,79,FALSE,0,74,TRUE,1,100,TRUE,0,83,TRUE,0,79,FALSE,1,76,FALSE,1,77,FALSE,0,78,TRUE,1,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,74,FALSE,1,100,FALSE,1,76,TRUE,1,100,FALSE,0,75,TRUE,1,100,0,0.0625,0,0,0,0.0484,0,0,0.0529,0,0,0,0.6724,0.5041,0.5329,0.5776,0.0576,0.0484,0,0,0.6084,0.5476,0.0576,0.0441,0.6889,0.5476,0.5625,0.0441,1,0.6241,0.0576,1,0.2956,0.178164286,0.413035714,16,50,20,62.5,2,25,5,62.5,7,87.5,6,75,10,62.5,10,62.5,86.22,75.75,83,89,97.12,89.56,82.88,-12.5,23.72,50.75,20.5,1.5,22.12,27.06,20.38,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,2,0,2,0,1,2,1,0,0,0,0,0,0,0,0,1,0,0.2,0.8,0.2,0,0.6,1.2,0,0.2,0.3,0.5,0.4,8,3.33,6,-0.4,-0.4,0.2,-0.2,-0.2,3,2,9,-2,4.67,0,0,0,-2,2,1,-1,0,0,0,0,-1,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,61,none,0,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,4,9,2,5,6,7,3,1,8,2,4,3,1 +197,R_7zUz2CkLTb6URq7,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Agree,Strongly disagree,Strongly agree,3,4,1,5,2,Agree,Strongly disagree,Agree,Disagree,Strongly agree,5,4,2,3,1,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,2,4,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Agree,Disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly Agree,2,1,5,3,4,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,2,5,3,1,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,2,3,5,10,Strongly Agree,Agree,Strongly Agree,Agree,Agree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,4,1,3,2,5,0,Agree,Strongly disagree,Agree,Disagree,Strongly agree,3,5,4,1,2,0,Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,4,3,2,5,4,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,4,3,2,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,96,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,89,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,95,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,97,FALSE,100,28,3,3,2,-3,3,2,-3,2,-2,3,-2,-3,3,-3,3,0,-1,1,2,-2,3,3,1,-3,3,5,3,-3,3,-3,3,2,-2,-3,3,-3,3,1,3,2,3,2,2,10,3,3,1,-2,3,1,2,-3,2,-2,3,0,-2,-3,3,-3,3,0,2,3,3,3,-2,4,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,95,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,89,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,96,TRUE,1,100,1,0,0,1,0,0,0,1,0,0,0,1,0.0025,0,0,0.0009,0,0,0,1,1,0.7921,0,0,0,1,0.0016,0,0,0,1,0,0.242753571,0.1431,0.342407143,28,87.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,10,62.5,13,81.25,99.28,97.12,100,100,100,98.56,100,15.62,27.4,22.12,37.5,37.5,12.5,36.06,18.75,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,3,3,2,0,4,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,2,4,2,1,0,0.2,0.6,0,2.4,0.4,0,0,1.8,0.8,0.55,0.675,2.67,0.33,2.875,-0.2,0.6,0,0.6,0.133333333,4,2,1,6,2.34,0,2,2,-2,2,1,-1,2,-2,-2,2,2,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,62,Fun! I really had to put my thinking cap on for some of your questions.,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,9,7,3,6,4,8,5,1,2,2,4,3,1 +198,R_1ptXb6hcKwxf94N,67 - 73,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,1,4,3,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,1,2,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,3,2,1,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,1,3,5,4,2,0,Disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,1,4,5,2,0,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,1,3,4,5,2,1,Strongly Agree,Agree,Agree,Strongly Agree,Agree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,5,3,2,1,4,1,Disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,2,5,4,1,2,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,3,2,4,1,5,1,Agree,Agree,Strongly Agree,Strongly Agree,Agree,2,1,4,3,5,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,60,TRUE,100,FALSE,100,TRUE,100,TRUE,65,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,61,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,0,3,-2,-3,3,-3,1,1,1,1,-3,1,3,3,3,3,-1,3,3,3,-3,3,1,-2,-3,2,-3,1,0,1,1,2,-3,2,0,3,2,2,3,2,1,3,3,3,1,3,2,-2,-3,2,-3,1,1,2,1,2,-3,2,2,2,2,3,3,2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,65,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,61,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.25,0,0.3721,0,0.16,0.4225,1,0,1,0,0,1,1,1,0,0.257307143,0.089285714,0.425328571,30,93.75,24,75,6,75,7,87.5,4,50,7,87.5,15,93.75,9,56.25,94.88,84.38,100,95.12,100,97.5,92.25,18.75,19.88,9.38,12.5,45.12,12.5,3.75,36,0,0,0,3,0,0,0,1,0,0,0,0,1,0,1,0,1,1,0,3,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,1,1,0,0,3,0.6,0.2,0.4,1,0.2,0.2,0.6,1,0.55,0.5,0.525,0.33,1.67,1,0.4,0,-0.2,0,0.066666667,-1,-1,-2,0,-1.34,0,0,1,-2,2,-1,1,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,it was a very fun survey,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,8,7,9,2,6,5,3,1,4,3,4,2,1 +199,R_7jdIJPh0nOHF8jT,60 - 66,,Canadian,Canadian,Male,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,5,1,2,4,3,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,4,5,1,3,2,Somewhat Agree,Agree,Strongly Agree,Agree,Somewhat Agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,5,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,3,1,2,4,5,Agree,Agree,Strongly Agree,Agree,Agree,4,1,3,2,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,4,3,1,5,2,1,Somewhat agree,Strongly disagree,Somewhat agree,Somewhat disagree,Disagree,4,1,5,3,2,5,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,5,4,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,1,5,3,TRUE,75,FALSE,80,FALSE,80,TRUE,90,FALSE,55,FALSE,90,TRUE,77,TRUE,95,FALSE,50,FALSE,50,TRUE,50,TRUE,100,TRUE,79,FALSE,50,FALSE,50,TRUE,100,TRUE,82,FALSE,74,TRUE,89,FALSE,97,FALSE,100,FALSE,79,FALSE,77,TRUE,76,TRUE,100,TRUE,83,FALSE,62,FALSE,62,TRUE,70,FALSE,100,TRUE,67,FALSE,79,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,1,1,-1,2,1,-1,3,-1,0,1,2,3,2,1,1,1,1,1,0,-2,1,1,-1,1,5,1,-2,1,-2,1,5,2,2,3,2,2,5,1,1,1,1,1,5,-1,1,2,0,1,5,1,-3,1,-1,-2,1,2,2,2,0,1,5,1,1,1,1,1,5,TRUE,0,75,FALSE,0,80,FALSE,1,80,TRUE,0,90,FALSE,0,55,FALSE,1,90,TRUE,1,77,TRUE,1,95,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,100,TRUE,1,79,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,82,FALSE,1,74,TRUE,0,89,FALSE,1,97,FALSE,0,100,FALSE,0,79,FALSE,1,77,TRUE,1,76,TRUE,0,100,TRUE,1,83,FALSE,1,62,FALSE,1,62,TRUE,0,70,FALSE,0,100,TRUE,1,67,FALSE,0,79,0.0025,0.0289,0,0.0529,0.6241,0.01,0.0576,0.25,0.0009,0.6241,1,0.0441,0.25,0.25,0.3025,0.64,0.0529,0.81,0.1444,1,1,0.25,0.7921,0.25,0.6724,0.1444,0.1089,0.5625,0.04,0.0676,0.49,1,0.408517857,0.351157143,0.465878571,15,46.88,15,46.88,2,25,3,37.5,4,50,6,75,7,43.75,8,50,77.12,67.25,79,73.5,88.75,76.25,78,0,30.24,42.25,41.5,23.5,13.75,32.5,28,0,0,0,0,1,0,1,2,1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,2,2,0,2,1,0,1,2,0,0,0,0,0,1,0.2,1,0.4,0.2,0.8,1.2,0.8,0.2,0.45,0.75,0.6,5,3.67,4.5,-0.6,-0.2,-0.4,0,-0.4,0,4,0,0,1.33,0,1,0,-2,2,-1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,survey interresting,0.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,3,2,4,5,8,6,9,1,7,4,2,3,1 +200,R_1zTf0GDK4e5UVk5,53 - 59,American,,American,Female,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,1,4,2,3,5,Disagree,Disagree,Agree,Disagree,Agree,5,1,2,3,4,Agree,Disagree,Strongly Agree,Disagree,Agree,3,4,2,5,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Agree,5,4,2,1,3,Neither agree nor disagree,Agree,Somewhat agree,Agree,Agree,3,4,2,5,1,1,Disagree,Somewhat agree,Agree,Somewhat agree,Agree,4,1,3,2,5,3,Agree,Disagree,Strongly Agree,Disagree,Agree,2,4,1,5,3,0,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Agree,2,1,5,4,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,5,3,2,1,4,1,Disagree,Disagree,Agree,Disagree,Agree,4,5,1,2,3,0,Agree,Disagree,Strongly Agree,Disagree,Agree,2,3,5,1,4,0,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,55,TRUE,100,TRUE,75,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,65,FALSE,71,FALSE,100,TRUE,60,FALSE,100,TRUE,54,TRUE,100,FALSE,100,TRUE,100,TRUE,58,FALSE,100,TRUE,54,TRUE,100,TRUE,100,FALSE,100,TRUE,68,FALSE,51,FALSE,100,TRUE,100,FALSE,100,16,1,2,-1,0,2,-2,-2,2,-2,2,2,-2,3,-2,2,-1,0,-1,-1,2,0,2,1,2,2,1,-2,1,2,1,2,3,2,-2,3,-2,2,0,-1,-1,0,-1,2,1,1,2,-1,0,2,1,-2,-2,2,-2,2,0,2,-2,3,-2,2,0,2,2,2,2,2,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,51,TRUE,1,68,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,54,FALSE,0,100,TRUE,0,58,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,54,FALSE,0,100,TRUE,0,60,FALSE,1,100,FALSE,1,71,FALSE,1,65,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,55,TRUE,1,100,0,0,1,0,0,0,0,1,0.1225,0,0,1,0.2116,0.3364,0.1024,0,0,0.2401,0,0,1,0.2116,0.0841,1,0.36,0.25,0.2025,0,0,0,0.5625,1,0.274417857,0.215214286,0.333621429,16,50,23,71.88,7,87.5,4,50,6,75,6,75,12,75,11,68.75,86.28,61.62,87.88,100,95.62,89.44,83.12,-21.88,14.4,-25.88,37.88,25,20.62,14.44,14.37,1,0,2,2,0,0,3,0,3,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,3,3,0,1,1.2,0,0.4,0,0,0,2.2,0.65,0.55,0.6,1.33,0.33,1.375,1,1.2,0,-1.8,0.733333333,0,3,0,-4,1,0,2,1,-2,2,1,-1,-1,1,-1,1,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,56,Interesting questions.,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,8,3,6,9,4,5,7,1,2,3,2,4,1 +201,R_3pS9MbfPbpA5x10,60 - 66,American,,American,Female,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,1,5,3,4,Somewhat disagree,Disagree,Strongly agree,Disagree,Somewhat agree,3,2,1,4,5,Agree,Agree,Agree,Disagree,Agree,2,4,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,2,1,5,3,4,Strongly Agree,Agree,Agree,Somewhat disagree,Agree,3,5,4,1,2,2,Disagree,Disagree,Strongly agree,Disagree,Agree,4,5,3,1,2,1,Agree,Agree,Agree,Disagree,Agree,2,3,1,5,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,5,3,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,2,5,1,4,7,Disagree,Disagree,Strongly agree,Disagree,Somewhat agree,4,1,5,2,3,3,Agree,Agree,Agree,Disagree,Agree,1,5,3,2,4,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,1,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,99,FALSE,100,FALSE,62,TRUE,71,FALSE,100,TRUE,86,TRUE,100,TRUE,96,TRUE,100,FALSE,85,TRUE,92,TRUE,98,TRUE,100,TRUE,59,TRUE,97,FALSE,63,TRUE,100,TRUE,70,FALSE,55,FALSE,57,TRUE,56,FALSE,100,TRUE,97,FALSE,61,TRUE,99,TRUE,76,FALSE,74,TRUE,98,TRUE,97,TRUE,75,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,2,0,2,-1,-2,3,-2,1,2,2,2,-2,2,1,1,1,2,0,3,2,2,-1,2,2,-2,-2,3,-2,2,1,2,2,2,-2,2,1,1,1,1,1,0,7,2,1,2,2,0,7,-2,-2,3,-2,1,3,2,2,2,-2,2,0,0,0,1,1,0,6,TRUE,0,96,TRUE,1,99,FALSE,1,100,FALSE,1,62,TRUE,1,71,FALSE,1,100,TRUE,1,86,TRUE,1,100,TRUE,1,96,TRUE,1,100,FALSE,1,85,TRUE,0,92,TRUE,1,98,TRUE,0,100,TRUE,1,59,TRUE,1,97,FALSE,1,63,TRUE,0,100,TRUE,0,70,FALSE,1,55,FALSE,0,57,TRUE,1,56,FALSE,1,100,TRUE,1,97,FALSE,1,61,TRUE,1,99,TRUE,0,76,FALSE,1,74,TRUE,0,98,TRUE,1,97,TRUE,1,75,TRUE,1,100,0,0.0001,0.0009,0.0196,0,0,0.0009,0,0.2025,0.1936,0.0009,0.0004,0.0016,0.0225,0.0841,0.0001,0,0.1444,0.0676,0.1521,0.3249,0.1681,0.49,1,0.1369,0.5776,0.0625,0.9216,0,1,0.9604,0.8464,0.262825,0.0465,0.47915,25,78.13,24,75,6,75,6,75,5,62.5,7,87.5,15,93.75,9,56.25,84.97,77.75,85.88,87.25,89,86.69,83.25,3.13,9.97,2.75,10.88,24.75,1.5,-7.06,27,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,2,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0.4,0.4,0,0.2,1,0.2,0,0.6,0.25,0.45,0.35,1.33,3.33,3.375,-0.6,0.2,0,-0.4,-0.133333333,-5,-2,1,1,-2,0,1,1,-1,1,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),65,,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,4,8,3,9,2,7,5,1,6,3,4,2,1 +202,R_139l5pMR4M1ByHb,67 - 73,American,,American,Female,Agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,5,4,3,1,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,5,3,4,2,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,5,3,2,1,Neither agree nor disagree,Agree,Agree,Somewhat agree,Somewhat disagree,4,2,3,1,5,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,2,4,1,3,6,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,2,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,4,5,3,2,1,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,4,5,1,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,4,3,2,5,2,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Disagree,5,3,1,2,4,5,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,1,2,5,3,1,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,4,5,3,1,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,54,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,91,TRUE,100,FALSE,75,FALSE,100,TRUE,82,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,96,FALSE,90,FALSE,100,TRUE,100,TRUE,75,TRUE,75,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,3,1,3,1,-3,3,-3,1,2,-1,2,0,3,0,2,2,1,-1,3,2,3,0,3,6,2,-3,3,-3,3,2,2,1,2,0,3,1,-2,1,0,1,-2,6,3,2,3,3,1,2,0,-1,2,-1,-2,5,3,0,2,0,3,1,-1,0,2,1,0,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,54,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,82,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,75,0,0,0,0,0.0625,0.25,0,0,0,0,0,0,0,0,0.2116,0,0,0.25,0.01,0,0.0324,0.25,0.0625,1,0.0081,0.0016,0.0625,0,0,1,0,1,0.150042857,0.055292857,0.244792857,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,15,93.75,12,75,90.25,80.75,81.5,100,98.75,89.75,90.75,3.12,5.87,-6.75,-6,25,11.25,-4,15.75,1,1,0,1,0,1,0,0,0,2,0,2,0,0,0,2,1,2,0,1,1,1,0,2,2,1,2,1,2,3,1,1,0,0,0,1,2,0,0,1,0.6,0.6,0.4,1.2,1.2,1.8,0.4,0.8,0.7,1.05,0.875,3,2.67,3.125,-0.6,-1.2,0,0.4,-0.6,4,-3,0,4,0.33,0,1,2,-2,2,1,-1,-1,1,0,0,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,69,none,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,4,8,2,6,5,9,3,1,7,4,3,2,1 +203,R_5Ebv5xofP7yfolg,67 - 73,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,Strongly agree,2,3,4,1,5,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,5,4,2,1,3,Strongly Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,5,2,1,3,4,Agree,Agree,Agree,Agree,Agree,1,3,4,5,2,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Somewhat disagree,Strongly Agree,5,2,3,4,1,2,Somewhat agree,Disagree,Disagree,Somewhat disagree,Somewhat agree,4,3,5,1,2,2,Strongly Agree,Agree,Agree,Somewhat Agree,Strongly Agree,5,2,3,1,4,2,Agree,Agree,Somewhat agree,Agree,Agree,4,5,1,3,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Agree,3,2,4,1,5,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,2,3,1,5,2,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,Agree,3,2,5,1,4,2,Agree,Somewhat agree,Agree,Agree,Agree,3,1,5,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,81,FALSE,66,TRUE,100,FALSE,76,TRUE,66,TRUE,59,TRUE,100,TRUE,100,TRUE,83,TRUE,100,FALSE,84,TRUE,100,TRUE,100,TRUE,100,FALSE,68,TRUE,95,TRUE,71,TRUE,89,TRUE,72,TRUE,71,FALSE,93,FALSE,72,FALSE,64,TRUE,67,TRUE,100,TRUE,63,FALSE,65,FALSE,90,TRUE,85,TRUE,100,FALSE,98,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,-1,3,1,-1,2,-2,1,3,1,1,1,3,2,2,2,2,2,0,3,0,-1,3,2,1,-2,-2,-1,1,2,3,2,2,1,3,2,2,2,1,2,2,2,2,2,2,0,2,2,1,-1,0,-1,1,2,3,3,2,1,2,2,2,1,2,2,2,2,TRUE,0,81,FALSE,0,66,TRUE,0,100,FALSE,1,76,TRUE,1,66,TRUE,0,59,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,FALSE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,68,TRUE,1,95,TRUE,0,71,TRUE,0,89,TRUE,0,72,TRUE,0,71,FALSE,0,93,FALSE,0,72,FALSE,1,64,TRUE,1,67,TRUE,0,100,TRUE,1,63,FALSE,1,65,FALSE,1,90,TRUE,0,85,TRUE,1,100,FALSE,0,98,TRUE,1,100,0,0.1369,0.0025,0,0,0.3481,0.1089,0,0.5041,0.5184,0,0,0.0289,0.0256,0.1156,0.4356,0.1296,0.0576,0.01,1,0.8649,0.4624,0.5184,1,0.5041,0.1225,0.9604,0.6561,1,0.7921,0.7225,1,0.424492857,0.162314286,0.686671429,23,71.88,16,50,4,50,4,50,3,37.5,5,62.5,11,68.75,5,31.25,83.69,76.5,79.75,88.12,90.38,85.69,81.69,21.88,33.69,26.5,29.75,50.62,27.88,16.94,50.44,1,0,1,0,0,0,1,4,1,0,0,1,1,0,0,0,0,1,0,0,1,1,1,1,1,0,0,2,1,0,0,2,1,0,1,0,1,0,0,0,0.4,1.2,0.4,0.2,1,0.6,0.8,0.2,0.55,0.65,0.6,2,2,2,-0.6,0.6,-0.4,0,-0.133333333,0,0,0,0,0,1,1,1,-1,1,1,-1,0,0,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,Very different and interesting,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,3,6,5,4,8,2,9,1,7,3,2,4,1 +204,R_5C8AFC3Hsg4XcR3,39 - 45,American,,American,Male,Agree,Strongly agree,Agree,Strongly disagree,Somewhat agree,2,5,4,1,3,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,2,4,5,3,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,5,3,2,4,Strongly Agree,Agree,Agree,Strongly Agree,Neither agree nor disagree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,1,3,4,5,2,8,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,5,2,1,7,Agree,Disagree,Strongly Agree,Strongly Disagree,Agree,4,5,2,1,3,8,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Agree,Disagree,Agree,4,2,1,3,5,6,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,2,1,4,6,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,3,5,4,7,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,5,1,2,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,75,TRUE,85,TRUE,100,TRUE,70,TRUE,90,TRUE,100,FALSE,100,TRUE,100,TRUE,70,TRUE,90,TRUE,60,FALSE,60,TRUE,80,TRUE,70,TRUE,70,TRUE,100,TRUE,90,TRUE,100,TRUE,70,FALSE,70,FALSE,55,TRUE,55,TRUE,55,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,80,TRUE,80,TRUE,90,TRUE,90,20,2,3,2,-3,1,0,-3,3,-3,1,2,-2,3,-3,3,3,2,2,3,0,2,3,3,0,1,7,0,-3,3,-3,2,8,2,-2,3,-3,2,7,1,1,1,3,0,8,2,2,2,-2,2,7,1,-3,3,-3,2,6,2,-3,3,-3,3,6,3,2,3,3,0,7,TRUE,0,90,TRUE,1,90,TRUE,0,80,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,55,FALSE,1,55,FALSE,1,70,TRUE,1,70,TRUE,0,100,TRUE,1,90,TRUE,1,100,TRUE,0,70,TRUE,0,70,TRUE,0,80,FALSE,1,60,TRUE,1,60,TRUE,1,90,TRUE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,90,TRUE,0,70,TRUE,0,100,TRUE,1,85,FALSE,0,75,TRUE,1,100,0,0,0,0,0,0,0,0.2025,0.16,0.01,0.0225,0.09,0.2025,0.2025,0,0.01,0.49,0.04,0.49,0,0.16,0.01,0.64,1,0.49,0.81,0.5625,0.81,0.64,0.49,1,0.09,0.307946429,0.102142857,0.51375,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,15,93.75,6,37.5,82.97,76.88,83.75,88.12,83.12,85.62,80.31,-3.13,17.34,14.38,21.25,25.62,8.12,-8.13,42.81,0,0,1,3,0,0,0,0,0,1,0,0,0,0,1,2,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0.8,0.2,0.2,0.8,0.6,0.4,0.2,0.2,0.5,0.35,0.425,7.33,6.33,7,0.2,-0.2,0,0.6,1.85E-17,0,2,1,1,1,2,2,2,-2,2,0,0,-1,1,-2,2,2,10 cents,100 minutes,24 days,Male,Trade School (non-military),43,I've enjoyed the survey. Thank you very much!,1.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,9,7,5,8,3,6,2,1,4,4,3,2,1 +205,R_3Flzy7YelLpRL66,32 - 38,American,,American,Female,Strongly agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,4,1,3,5,2,Strongly disagree,Agree,Agree,Strongly agree,Somewhat agree,2,3,1,4,5,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,4,2,3,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,5,1,4,3,2,2,Strongly disagree,Agree,Strongly agree,Agree,Neither agree nor disagree,4,2,3,5,1,3,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,2,4,3,5,Disagree,Disagree,Disagree,Disagree,Disagree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Somewhat agree,Somewhat disagree,Agree,Agree,5,4,2,1,3,3,Strongly disagree,Agree,Strongly agree,Strongly agree,Somewhat agree,2,5,3,1,4,4,Strongly agree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,5,3,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,5,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,88,TRUE,50,TRUE,61,FALSE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,94,TRUE,75,FALSE,74,TRUE,100,TRUE,89,FALSE,50,TRUE,54,TRUE,99,TRUE,50,TRUE,100,FALSE,52,FALSE,100,TRUE,78,TRUE,54,FALSE,100,TRUE,92,TRUE,56,TRUE,100,TRUE,87,FALSE,63,TRUE,53,FALSE,52,TRUE,72,TRUE,54,TRUE,53,16,3,1,-1,1,1,-3,2,2,3,1,2,-1,3,0,3,1,-1,0,0,0,3,1,0,2,-1,3,-3,2,3,2,0,2,3,-1,3,0,3,3,-2,-2,-2,-2,-2,5,3,1,-1,2,2,5,-3,2,3,3,1,3,3,-1,3,0,3,4,0,0,0,1,1,6,TRUE,0,53,TRUE,1,54,TRUE,0,72,FALSE,1,52,TRUE,1,53,FALSE,1,63,TRUE,1,87,TRUE,1,100,TRUE,1,56,TRUE,1,92,FALSE,1,100,TRUE,0,54,TRUE,1,78,FALSE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,50,TRUE,0,99,TRUE,0,54,FALSE,1,50,TRUE,1,89,TRUE,1,100,FALSE,1,74,TRUE,1,75,FALSE,1,94,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,61,TRUE,1,50,TRUE,1,88,0,0,0,0.0169,0.0144,0.1369,0.0625,0.0064,0.25,0,0.1521,0.0484,0.1936,0,0.2209,0.2116,0.0676,0.2304,0.25,0.0036,0.0121,0.2704,0.2916,0,0.25,0.25,0.25,0.2809,0.5184,0.9801,0.25,0.2916,0.196196429,0.113914286,0.278478571,16,50,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,71.88,58.5,68.12,90.62,70.25,77.19,66.56,-28.13,-6.25,-16.5,-19.38,15.62,-4.75,-16.56,4.06,0,0,1,1,2,0,0,1,1,1,1,0,0,0,0,3,1,2,2,2,0,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0.8,0.6,0.2,2,0.4,0.2,0.2,0.8,0.9,0.4,0.65,2.67,4,3.875,0.4,0.4,0,1.2,0.266666667,-2,-1,-1,-1,-1.33,0,2,2,-2,2,0,0,-2,2,-2,2,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,38,None,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,5,9,8,4,3,6,2,1,7,3,4,2,1 +206,R_7DBVC3WDgttHfaH,46 - 52,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,1,2,5,Somewhat agree,Somewhat disagree,Strongly agree,Disagree,Somewhat agree,5,2,1,4,3,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,1,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Disagree,Agree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,5,3,7,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,4,5,1,2,7,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,1,5,2,4,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,7,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,1,3,4,2,6,Strongly agree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,4,5,2,3,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,81,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,57,FALSE,100,TRUE,87,TRUE,100,FALSE,80,TRUE,100,TRUE,100,TRUE,85,TRUE,90,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,25,3,3,3,3,3,1,-1,3,-2,1,3,1,3,-2,3,0,0,3,-2,2,3,3,3,3,3,8,1,-2,1,-1,0,7,3,1,3,-1,3,7,-1,-1,-1,-1,-1,7,3,3,3,3,3,7,1,-3,3,-3,0,7,3,1,3,-3,3,6,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,85,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,1,87,FALSE,1,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0225,0,0,0.01,0,0,0,0,0.6561,0,0,0.0169,0,0.04,0,0,0,0,1,0,0,0.3249,1,0,0,1,0,0,0,0,1,1,0.215639286,0.050928571,0.38035,25,78.13,25,78.13,5,62.5,7,87.5,8,100,5,62.5,15,93.75,10,62.5,96.25,92.12,98.38,98.75,95.75,94.94,97.56,0,18.12,29.62,10.88,-1.25,33.25,1.19,35.06,0,0,0,0,0,0,1,2,1,1,0,0,0,1,0,1,1,4,1,3,0,0,0,0,0,0,2,0,1,1,0,0,0,1,0,3,3,0,5,1,0,1,0.2,2,0,0.8,0.2,2.4,0.8,0.85,0.825,7.33,6.67,6.75,0,0.2,0,-0.4,0.066666667,1,0,1,2,0.66,0,2,1,-2,2,2,-2,-1,1,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),52,a very interesting survey,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,3,5,4,7,9,2,6,1,8,3,2,4,1 +207,R_3zhmgRSyA5EFlvz,67 - 73,American,,American,Male,Strongly agree,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,2,5,1,3,4,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,1,4,3,2,5,Agree,Agree,Agree,Somewhat Disagree,Somewhat Agree,3,1,5,4,2,Disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Agree,Strongly Agree,Agree,Agree,4,2,3,5,1,6,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,5,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,2,5,8,Disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,5,4,3,1,2,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,3,1,4,5,2,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,3,5,1,2,TRUE,88,TRUE,99,FALSE,84,FALSE,50,TRUE,95,FALSE,100,TRUE,99,TRUE,100,TRUE,98,TRUE,96,FALSE,78,TRUE,50,FALSE,75,FALSE,76,FALSE,64,TRUE,100,FALSE,98,TRUE,96,TRUE,84,FALSE,100,FALSE,50,TRUE,96,TRUE,96,TRUE,100,TRUE,89,TRUE,99,TRUE,94,FALSE,71,FALSE,77,TRUE,100,TRUE,95,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,3,0,-1,1,2,1,0,2,2,2,-1,1,-2,-2,-2,0,-3,3,2,3,2,2,7,0,0,2,0,0,6,1,2,2,0,0,5,-2,0,-1,0,-3,8,3,3,3,3,0,5,-1,0,0,0,0,5,1,1,1,-1,0,5,-1,0,0,0,-3,7,TRUE,0,88,TRUE,1,99,FALSE,1,84,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,98,TRUE,1,96,FALSE,1,78,TRUE,0,50,FALSE,0,75,FALSE,1,76,FALSE,0,64,TRUE,1,100,FALSE,1,98,TRUE,0,96,TRUE,0,84,FALSE,1,100,FALSE,0,50,TRUE,1,96,TRUE,0,96,TRUE,1,100,TRUE,0,89,TRUE,1,99,TRUE,0,94,FALSE,1,71,FALSE,1,77,TRUE,1,100,TRUE,1,95,TRUE,1,100,0,0.0001,0,0.0001,0,0,0,0.0016,0,0.0016,0,0.5625,0.0004,0.0484,0.0025,0.0001,0.9216,0.25,0.0841,0.7921,0.25,0.4096,0.7056,0.0576,0.0004,0.8836,0.0025,0.7744,0.0256,0.9216,0.0529,0.25,0.249953571,0.127764286,0.372142857,27,84.38,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,13,81.25,9,56.25,87.41,82.75,86.38,92.38,88.12,91.62,83.19,15.63,18.66,20.25,23.88,29.88,0.62,10.37,26.94,0,0,0,1,2,1,1,0,1,0,1,0,0,1,1,0,2,1,0,0,0,1,0,0,0,0,1,2,1,0,1,1,1,0,1,1,2,2,0,0,0.6,0.6,0.6,0.6,0.2,0.8,0.8,1,0.6,0.7,0.65,6,5,6,0.4,-0.2,-0.2,-0.4,0,2,1,0,1,1,0,1,0,-2,2,0,0,-2,2,-1,1,1,5 cents,5 minutes,47 days,Male,Trade School (non-military),70,,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,7,2,6,8,5,4,9,1,3,2,4,3,1 +208,R_6rGTb1zXAhIJ1wH,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Disagree,Somewhat disagree,1,2,3,5,4,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,2,3,1,4,5,Agree,Disagree,Agree,Disagree,Agree,2,4,5,1,3,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Somewhat disagree,3,2,5,1,4,3,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,4,1,2,5,3,4,Agree,Disagree,Agree,Disagree,Agree,5,3,4,2,1,2,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat disagree,1,5,2,4,3,2,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,3,5,4,2,4,Agree,Disagree,Agree,Disagree,Agree,3,1,4,2,5,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,3,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,55,FALSE,50,TRUE,65,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,65,FALSE,50,FALSE,55,TRUE,74,TRUE,50,TRUE,59,TRUE,50,TRUE,55,FALSE,65,TRUE,80,TRUE,50,FALSE,60,FALSE,50,TRUE,65,TRUE,55,FALSE,50,TRUE,50,FALSE,50,FALSE,73,FALSE,50,FALSE,50,3,3,3,3,-2,-1,-2,0,1,0,-2,2,-2,2,-2,2,-2,-1,-1,-1,-3,3,3,2,-1,-1,2,-2,1,1,0,-2,3,2,-2,2,-2,2,4,-2,-1,-1,-1,-3,2,3,3,2,0,-1,1,-2,0,1,0,-2,2,2,-2,2,-2,2,4,-1,0,0,0,-3,5,FALSE,1,50,FALSE,0,50,FALSE,1,73,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,55,TRUE,1,65,FALSE,0,50,FALSE,0,60,TRUE,0,50,TRUE,0,80,FALSE,0,65,TRUE,0,55,TRUE,1,50,TRUE,1,59,TRUE,0,50,TRUE,0,74,FALSE,1,55,FALSE,1,50,TRUE,1,65,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,65,FALSE,0,50,TRUE,1,55,0.1225,0.25,0.1681,0.2025,0.2025,0.25,0.25,0.36,0.25,0.25,0.1225,0.4225,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.1225,0.25,0.2025,0.3025,0.25,0.25,0.25,0.25,0.0729,0.5476,0.25,0.64,0.258767857,0.239821429,0.277714286,3,9.38,19,59.38,3,37.5,5,62.5,4,50,7,87.5,11,68.75,8,50,57.06,50.62,60.62,55.5,61.5,55.56,58.56,-50,-2.32,13.12,-1.88,5.5,-26,-13.19,8.56,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0.4,0.2,0,0,0.6,0,0,0.8,0.15,0.35,0.25,3,2.33,2.875,-0.2,0.2,0,-0.8,1.85E-17,1,1,0,-3,0.67,0,1,-1,-2,2,0,0,-1,1,0,0,-2,5 cents,5 minutes,47 days,Female,High School (or equivalent),36,,0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,2,5,8,9,4,3,7,1,6,2,3,4,1 +209,R_3FeZQo6wCs3ezdv,46 - 52,American,,American,Female,Somewhat disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,4,5,2,3,1,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,1,5,2,Somewhat Agree,Agree,Agree,Somewhat Disagree,Agree,4,1,2,5,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,2,5,3,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,6,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,3,5,2,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,3,4,5,8,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,2,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,1,3,5,4,2,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,3,5,1,5,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,5,4,3,1,2,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,2,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,70,FALSE,81,FALSE,85,TRUE,100,TRUE,100,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,-1,1,2,-1,-2,1,1,1,-1,1,2,2,-1,2,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,6,-1,-1,-1,-1,-1,5,1,1,1,1,1,8,-1,-1,-1,-1,-1,5,-1,-1,-1,0,-1,5,-1,-1,-1,-1,-1,5,-1,-1,-1,-1,-1,5,-1,-1,-1,-1,-1,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,70,FALSE,1,81,FALSE,1,85,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.25,0,0.0361,1,0,0.25,0,1,1,0.49,0,1,0,0,0.0225,1,0.251735714,0.089285714,0.414185714,27,84.38,24,75,6,75,6,75,5,62.5,7,87.5,16,100,8,50,94.88,90,91.88,100,97.62,96.88,92.88,9.38,19.88,15,16.88,37.5,10.12,-3.12,42.88,0,0,2,3,0,1,2,2,2,0,0,1,1,2,1,0,0,1,0,0,0,0,2,2,0,1,2,2,2,0,2,3,3,0,3,0,0,1,0,0,1,1.4,1,0.2,0.8,1.4,2.2,0.2,0.9,1.15,1.025,6.33,5,5.5,0.2,0,-1.2,0,-0.333333333,1,0,3,0,1.33,-1,0,-1,-2,2,-1,1,1,-1,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,9,5,8,4,6,7,2,1,3,4,2,3,1 +210,R_31QKekQaep1x2GI,60 - 66,American,,American,Female,Agree,Strongly agree,Somewhat agree,Somewhat agree,Disagree,5,1,3,4,2,Somewhat disagree,Disagree,Agree,Strongly disagree,Somewhat agree,3,4,1,5,2,Strongly Agree,Strongly Agree,Somewhat Agree,Disagree,Agree,4,3,1,2,5,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly Agree,Somewhat disagree,1,4,3,5,2,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Disagree,5,3,1,4,2,0,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,4,2,3,5,2,Strongly Agree,Strongly Agree,Somewhat Agree,Disagree,Somewhat Agree,2,5,3,4,1,0,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Somewhat disagree,1,3,4,5,2,1,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,5,3,4,2,1,1,Strongly Agree,Strongly Agree,Somewhat Agree,Disagree,Somewhat Agree,2,4,5,3,1,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,2,1,5,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,67,TRUE,98,FALSE,100,FALSE,61,TRUE,61,FALSE,99,TRUE,89,TRUE,99,TRUE,89,TRUE,94,FALSE,66,TRUE,99,FALSE,100,TRUE,98,FALSE,73,TRUE,69,TRUE,82,TRUE,100,TRUE,90,FALSE,85,TRUE,89,TRUE,80,FALSE,66,TRUE,64,FALSE,94,TRUE,85,TRUE,88,FALSE,92,TRUE,95,FALSE,87,FALSE,89,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,1,-2,-1,-2,2,-3,1,3,3,1,-2,2,1,-1,-1,3,-1,3,3,2,1,-2,0,-2,-3,3,-3,1,2,3,3,1,-2,1,0,3,2,3,3,3,7,3,3,2,3,-1,1,1,-3,1,-3,1,1,3,3,1,-2,1,1,-1,-1,-1,-1,-1,1,TRUE,0,67,TRUE,1,98,FALSE,1,100,FALSE,1,61,TRUE,1,61,FALSE,1,99,TRUE,1,89,TRUE,1,99,TRUE,1,89,TRUE,1,94,FALSE,1,66,TRUE,0,99,FALSE,0,100,TRUE,0,98,FALSE,0,73,TRUE,1,69,TRUE,0,82,TRUE,0,100,TRUE,0,90,FALSE,1,85,TRUE,1,89,TRUE,1,80,FALSE,1,66,TRUE,1,64,FALSE,1,94,TRUE,1,85,TRUE,0,88,FALSE,1,92,TRUE,0,95,FALSE,0,87,FALSE,0,89,TRUE,1,100,0.0001,0.0225,0.0961,0.0121,0,0.0001,0.1296,0.0036,0.0225,0.04,0.7569,1,0.0121,0.1156,0.1521,0.0004,0.1156,0.1521,0.0064,0.0036,0.0121,0.5329,0.81,0.9604,0.6724,0.7744,0.7921,0.4489,0,1,0.9025,0.9801,0.3713,0.178614286,0.563985714,26,81.25,20,62.5,4,50,5,62.5,5,62.5,6,75,12,75,8,50,85.88,81.75,86.5,88.38,86.88,85.38,86.38,18.75,23.38,31.75,24,25.88,11.88,10.38,36.38,1,0,1,0,0,1,1,1,0,0,0,0,0,0,1,2,3,4,0,4,1,0,1,2,1,2,1,1,0,0,0,0,0,0,1,2,0,0,4,0,0.4,0.6,0.2,2.6,1,0.8,0.2,1.2,0.95,0.8,0.875,0.67,1,1.625,-0.6,-0.2,0,1.4,-0.266666667,-1,1,-1,6,-0.33,-2,0,-1,-2,2,1,-1,1,-1,-2,2,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,none,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,3,2,7,6,5,8,4,1,9,4,3,2,1 +211,R_7xLsJucwczP9rR6,46 - 52,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,5,2,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,1,2,4,5,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,1,4,3,5,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,1,3,2,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,1,Agree,Disagree,Somewhat agree,Disagree,Agree,1,2,5,3,4,1,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,2,4,5,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,5,3,2,1,4,1,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,4,3,1,2,5,1,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,3,5,4,1,1,Agree,Agree,Agree,Agree,Agree,2,1,3,5,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,FALSE,50,TRUE,81,TRUE,75,TRUE,78,FALSE,77,TRUE,76,FALSE,75,FALSE,75,FALSE,50,FALSE,50,FALSE,50,FALSE,72,FALSE,78,TRUE,68,TRUE,78,TRUE,76,TRUE,70,TRUE,71,TRUE,70,TRUE,100,FALSE,70,TRUE,65,TRUE,80,TRUE,86,TRUE,81,FALSE,100,TRUE,72,FALSE,66,TRUE,58,TRUE,59,TRUE,100,9,1,1,1,1,1,2,-1,2,-1,0,2,2,1,0,2,0,-1,1,1,-1,2,2,2,2,2,1,2,-2,1,-2,2,1,2,2,2,0,2,1,0,0,0,0,0,5,2,2,2,2,2,1,0,-2,2,-2,2,1,2,2,0,0,2,1,2,2,2,2,2,1,TRUE,0,100,TRUE,1,59,TRUE,0,58,FALSE,1,66,TRUE,1,72,FALSE,1,100,TRUE,1,81,TRUE,1,86,TRUE,1,80,TRUE,1,65,FALSE,1,70,TRUE,0,100,TRUE,1,70,TRUE,0,71,TRUE,1,70,TRUE,1,76,TRUE,0,78,TRUE,0,68,FALSE,1,78,FALSE,1,72,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,75,FALSE,1,75,TRUE,1,76,FALSE,1,77,TRUE,0,78,TRUE,0,75,TRUE,1,81,FALSE,0,50,TRUE,1,75,0.0196,0.0576,0.0576,0.0361,0.0625,0,0.5625,0.1225,0.0784,0.25,0.0361,0.09,0.04,0.09,0.0784,0.1681,0.25,0.1156,0.6084,0.0625,0.25,0.09,0.0484,0.5041,0.6084,0.0529,0.25,1,0.3364,0.4624,0.5625,1,0.277860714,0.138864286,0.416857143,9,28.13,20,62.5,7,87.5,5,62.5,4,50,4,50,12,75,8,50,72.88,68.75,71.25,73.25,78.25,69.75,76,-34.37,10.38,-18.75,8.75,23.25,28.25,-5.25,26,1,1,1,1,1,0,1,1,1,2,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,2,1,0,1,2,0,0,1,0,0,2,3,1,1,3,1,1,0.2,0.8,1,1.2,0.2,2,0.75,1.1,0.925,1,1,1.5,0,-0.2,0,-1.2,-0.066666667,0,0,0,4,0,0,0,0,-2,2,1,-1,0,0,0,0,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,,-0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,4,6,9,2,7,5,8,1,3,3,4,2,1 +212,R_3jD4zQ9K1au3W7Z,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,Agree,2,3,5,1,4,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,1,3,4,5,2,Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Agree,5,3,2,1,4,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,1,5,2,3,4,3,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,1,5,3,2,4,4,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,Somewhat Disagree,5,4,3,2,1,2,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Disagree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat agree,Agree,5,1,4,3,2,0,Somewhat agree,Disagree,Strongly agree,Neither agree nor disagree,Agree,2,1,3,5,4,1,Agree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,3,4,2,1,5,1,Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,1,3,4,2,5,FALSE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,97,TRUE,100,TRUE,100,TRUE,96,TRUE,66,TRUE,83,TRUE,75,FALSE,100,TRUE,66,TRUE,100,FALSE,95,TRUE,100,FALSE,63,FALSE,77,FALSE,81,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,85,FALSE,75,FALSE,50,TRUE,70,TRUE,100,TRUE,72,TRUE,94,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,0,2,2,2,-1,3,-1,2,2,-3,3,1,2,2,3,2,3,1,3,3,2,-1,3,3,3,1,3,1,3,3,3,1,2,3,-1,4,-3,1,0,-3,-2,2,3,3,-1,1,2,2,1,-2,3,0,2,0,2,-3,3,-1,3,1,2,1,2,3,3,1,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,0,66,TRUE,0,83,TRUE,1,75,FALSE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,95,TRUE,0,100,FALSE,1,63,FALSE,1,77,FALSE,0,81,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,85,FALSE,1,75,FALSE,1,50,TRUE,0,70,TRUE,1,100,TRUE,1,72,TRUE,1,94,0,0.0225,0,0.0009,0.0036,0,0,0.0016,0.0529,0,0,0.0625,0,0.4356,0,0.25,0,0.25,0.25,0,0.6561,0.1156,0.1369,0,0.0025,0.0625,0.0784,0,0,1,0.49,0.6889,0.162039286,0.075442857,0.248635714,28,87.5,27,84.38,7,87.5,6,75,7,87.5,7,87.5,15,93.75,12,75,85.78,67.75,89.38,97.25,88.75,88.5,83.06,3.12,1.4,-19.75,14.38,9.75,1.25,-5.25,8.06,0,0,2,3,1,1,2,0,2,1,1,4,1,2,3,5,2,2,6,3,0,0,1,1,0,1,1,0,1,0,0,0,0,2,1,0,2,0,0,2,1.2,1.2,2.2,3.6,0.4,0.6,0.6,0.8,2.05,0.6,1.325,3.33,1,2,0.8,0.6,1.6,2.8,1,1,3,3,1,2.33,0,2,2,-2,2,1,-1,-1,1,1,-1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,"No additional feedback, thanks",0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,5,2,7,3,6,4,8,1,9,2,3,4,1 +213,R_7dT7VMMXH4xfwLX,67 - 73,American,,American,Male,Strongly agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Somewhat agree,3,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Agree,2,4,5,1,3,Strongly disagree,Strongly disagree,Disagree,Disagree,Disagree,5,4,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,3,2,5,4,1,1,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,2,4,3,5,1,1,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Agree,5,2,1,3,4,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,2,5,1,2,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,4,2,1,5,1,Neither Agree nor Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,1,2,3,1,Disagree,Disagree,Disagree,Disagree,Disagree,2,3,5,1,4,FALSE,99,TRUE,100,TRUE,85,FALSE,54,TRUE,100,FALSE,84,TRUE,100,TRUE,100,TRUE,100,TRUE,97,FALSE,65,FALSE,100,FALSE,89,TRUE,86,FALSE,73,TRUE,100,FALSE,94,TRUE,100,FALSE,85,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,84,FALSE,100,TRUE,100,FALSE,91,FALSE,100,FALSE,78,TRUE,100,TRUE,68,TRUE,63,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,1,0,0,-3,2,-2,1,0,0,2,-2,2,-3,-3,-2,-2,-2,3,2,2,1,0,1,1,-3,1,-3,2,1,1,-2,2,-1,2,1,-3,-3,-3,-3,-3,5,3,2,2,1,0,1,0,-3,2,-3,1,2,0,-1,2,0,2,1,-2,-2,-2,-2,-2,1,FALSE,1,99,TRUE,1,100,TRUE,0,85,FALSE,1,54,TRUE,1,100,FALSE,1,84,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,97,FALSE,1,65,FALSE,1,100,FALSE,0,89,TRUE,0,86,FALSE,0,73,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,84,FALSE,1,100,TRUE,1,100,FALSE,1,91,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,68,TRUE,1,63,0,0,0,0,0.1369,0.0256,0.0256,0.0009,0,0,0,0.7921,0,0.1225,0,0,0,0.2116,0,0,0,0.5329,0.0225,0.7396,0.0036,0.0081,0.1024,0.0001,0.7225,1,0.0484,0,0.160546429,0.093942857,0.22715,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,90.47,79.5,88.5,97.75,96.12,92.12,88.81,3.12,6.09,-8,1,22.75,8.62,4.62,7.56,0,0,1,0,0,1,0,1,1,1,1,2,0,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,1,0,2,0,1,1,0,0,0,0.2,0.8,0.8,0.6,0.2,0.2,0.6,0.4,0.6,0.35,0.475,1,1.33,1.625,0,0.6,0.2,0.2,0.266666667,0,-1,0,4,-0.33,1,2,1,-2,2,0,0,0,0,-2,2,1,5 cents,5 minutes,47 days,Male,High School (or equivalent),67,None,1.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,4,8,2,9,7,5,3,1,6,3,4,2,1 +214,R_3dH0X8NfSZ719Wz,60 - 66,American,,American,Female,Somewhat disagree,Agree,Somewhat agree,Strongly disagree,Strongly agree,1,5,2,4,3,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,2,4,3,1,Somewhat Agree,Strongly Agree,Agree,Disagree,Somewhat Agree,1,3,4,5,2,Disagree,Strongly disagree,Disagree,Somewhat disagree,Disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Strongly Agree,Somewhat agree,Strongly disagree,Somewhat agree,5,2,1,4,3,7,Agree,Somewhat disagree,Strongly agree,Disagree,Somewhat agree,1,5,4,3,2,7,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,Somewhat Agree,1,3,5,2,4,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Disagree,Agree,Agree,Neither agree nor disagree,Agree,1,4,3,5,2,3,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,5,2,4,4,Agree,Agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,5,3,1,4,2,4,Disagree,Strongly disagree,Disagree,Disagree,Disagree,2,4,1,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,FALSE,81,TRUE,83,FALSE,62,FALSE,81,FALSE,61,TRUE,92,FALSE,82,FALSE,61,FALSE,53,FALSE,54,FALSE,92,FALSE,66,FALSE,52,TRUE,92,TRUE,71,FALSE,81,FALSE,68,TRUE,88,TRUE,73,TRUE,89,TRUE,62,TRUE,97,FALSE,54,TRUE,90,TRUE,92,FALSE,59,FALSE,61,FALSE,61,FALSE,76,TRUE,81,TRUE,97,20,-1,2,1,-3,3,-1,1,2,1,0,1,3,2,-2,1,-2,-3,-2,-1,-2,0,3,1,-3,1,8,2,-1,3,-2,1,7,1,3,2,1,1,7,1,0,0,1,0,7,-2,2,2,0,2,3,-3,1,1,1,-1,3,2,2,0,-2,1,4,-2,-3,-2,-2,-2,4,TRUE,0,97,TRUE,1,81,FALSE,1,76,FALSE,1,61,FALSE,0,61,FALSE,1,59,TRUE,1,92,TRUE,1,90,FALSE,0,54,TRUE,1,97,TRUE,0,62,TRUE,0,89,TRUE,1,73,TRUE,0,88,FALSE,0,68,FALSE,0,81,TRUE,0,71,TRUE,0,92,FALSE,1,52,FALSE,1,66,FALSE,0,92,FALSE,0,54,FALSE,1,53,FALSE,0,61,FALSE,1,82,TRUE,1,92,FALSE,1,61,FALSE,1,81,FALSE,1,62,TRUE,1,83,FALSE,0,81,TRUE,1,99,0.01,0.0064,0.6561,0.0064,0.0001,0.1681,0.3721,0.0009,0.1156,0.2916,0.0289,0.0729,0.2916,0.3844,0.3721,0.0361,0.2209,0.1521,0.0361,0.0324,0.8464,0.4624,0.2304,0.7744,0.5041,0.1521,0.6561,0.9409,0.0576,0.8464,0.1444,0.7921,0.320828571,0.1791,0.462557143,20,62.5,18,56.25,4,50,5,62.5,4,50,5,62.5,8,50,10,62.5,75.34,65,71.25,86.75,78.38,78.69,72,6.25,19.09,15,8.75,36.75,15.88,28.69,9.5,1,1,0,0,2,3,2,1,3,1,0,0,0,3,0,3,3,2,2,2,1,0,1,3,1,2,0,1,0,1,1,1,2,0,0,0,0,0,1,0,0.8,2,0.6,2.4,1.2,0.8,0.8,0.2,1.45,0.75,1.1,7.33,3.33,5.375,-0.4,1.2,-0.2,2.2,0.2,5,4,3,3,4,0,0,0,1,-1,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,61,was fastinating,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,9,6,4,8,2,3,5,1,7,4,3,2,1 +215,R_74oY4mzWeayvNRg,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,1,5,4,2,3,Disagree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,1,2,5,4,3,Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,1,4,5,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,2,4,1,3,5,2,Strongly disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,2,5,4,1,3,Disagree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,1,5,4,3,3,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,Agree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,1,3,5,4,2,7,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,3,5,1,2,Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,4,1,2,3,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,5,3,1,2,4,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,75,TRUE,100,FALSE,50,TRUE,76,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,89,FALSE,100,TRUE,50,TRUE,61,TRUE,79,TRUE,77,TRUE,71,FALSE,50,FALSE,76,TRUE,50,TRUE,60,TRUE,50,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,1,3,-2,-3,3,-2,1,2,-3,3,-2,3,3,3,3,3,-2,3,3,1,-2,3,4,-3,-3,3,-1,1,2,-2,-2,3,-3,3,3,1,1,-1,-2,2,3,3,3,2,3,2,1,-3,-3,1,-1,1,7,-2,-3,3,-3,3,2,3,2,3,3,0,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,89,FALSE,0,100,TRUE,1,50,TRUE,0,61,TRUE,1,79,TRUE,0,77,TRUE,1,71,FALSE,1,50,FALSE,1,76,TRUE,0,50,TRUE,1,60,TRUE,1,50,TRUE,1,100,0,0.0841,0,0.0625,0,0,0.0441,0.0576,0.0121,0.25,0.16,0,0.25,0.25,0,0,0.3721,0.25,0.0576,0.5929,1,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,0.25,1,0.323085714,0.117564286,0.528607143,26,81.25,18,56.25,4,50,4,50,4,50,6,75,14,87.5,4,25,75.44,56.25,82.62,74.88,88,78.81,72.06,25,19.19,6.25,32.62,24.88,13,-8.69,47.06,0,0,0,3,0,1,0,0,1,0,4,1,0,1,0,2,2,4,5,4,0,0,1,2,1,1,0,2,1,0,4,0,0,1,0,0,1,0,0,2,0.6,0.4,1.2,3.4,0.8,0.8,1,0.6,1.4,0.8,1.1,3,3.33,3,-0.2,-0.4,0.2,2.8,-0.133333333,3,-5,1,1,-0.33,0,2,1,-2,2,1,-1,-1,1,-2,2,1,10 cents,100 minutes,15 days,Female,High School (or equivalent),68,Would love to know how many I got right,1,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,6,3,9,8,7,4,1,5,3,2,4,1 +216,R_6uRm1ocr1AINFPr,53 - 59,,Canadian,Canadian,Female,Strongly agree,Agree,Strongly agree,Agree,Strongly disagree,2,5,3,1,4,Strongly disagree,Somewhat disagree,Agree,Agree,Somewhat agree,2,3,1,4,5,Neither Agree nor Disagree,Strongly Disagree,Agree,Disagree,Agree,3,1,2,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Somewhat agree,Agree,Agree,Somewhat agree,1,3,5,4,2,7,Strongly disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,1,2,3,5,4,7,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Disagree,Agree,5,3,4,2,1,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Strongly Agree,Somewhat disagree,2,3,1,4,5,7,Disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,5,2,3,4,Disagree,Strongly Disagree,Agree,Disagree,Strongly agree,4,1,5,3,2,7,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,69,TRUE,91,TRUE,91,TRUE,70,TRUE,77,TRUE,65,TRUE,80,FALSE,71,TRUE,83,TRUE,71,TRUE,77,FALSE,65,TRUE,70,TRUE,72,TRUE,86,TRUE,67,TRUE,91,TRUE,64,TRUE,77,TRUE,82,TRUE,72,FALSE,73,TRUE,77,TRUE,77,TRUE,92,TRUE,92,FALSE,86,TRUE,87,TRUE,54,FALSE,98,TRUE,79,TRUE,92,23,3,2,3,2,-3,-3,-1,2,2,1,0,-3,2,-2,2,1,1,1,1,-3,2,1,2,2,1,6,-3,1,-1,1,-2,7,1,-1,-1,-2,2,7,1,0,1,0,0,7,2,2,2,3,-1,3,-2,-1,1,0,1,7,-2,-3,2,-2,3,4,0,-1,0,0,0,7,TRUE,0,92,TRUE,1,79,FALSE,1,98,TRUE,0,54,TRUE,1,87,FALSE,1,86,TRUE,1,92,TRUE,1,92,TRUE,1,77,TRUE,1,77,FALSE,1,73,TRUE,0,72,TRUE,1,82,TRUE,0,77,TRUE,1,64,TRUE,1,91,TRUE,0,67,TRUE,0,86,TRUE,0,72,TRUE,0,70,FALSE,0,65,TRUE,1,77,TRUE,0,71,TRUE,1,83,FALSE,1,71,TRUE,1,80,TRUE,0,65,TRUE,0,77,TRUE,0,70,TRUE,1,91,TRUE,1,91,TRUE,1,69,0.0064,0.04,0.0081,0.0064,0.0961,0.0196,0.0289,0.0529,0.49,0.0529,0.0081,0.0324,0.0529,0.0729,0.0169,0.0441,0.5041,0.2916,0.5929,0.0841,0.4225,0.1296,0.5184,0.5929,0.4489,0.4225,0.0081,0.8464,0.0004,0.7396,0.49,0.5184,0.270646429,0.125957143,0.415335714,23,71.88,19,59.38,5,62.5,4,50,5,62.5,5,62.5,15,93.75,4,25,78.06,71.88,74.62,81.5,84.25,81.06,75.06,12.5,18.68,9.38,24.62,19,21.75,-12.69,50.06,1,1,1,0,4,0,2,3,1,3,1,2,3,0,0,0,1,0,1,3,1,0,1,1,2,1,0,1,2,0,2,0,0,0,1,1,2,1,1,3,1.4,1.8,1.2,1,1,0.8,0.6,1.6,1.35,1,1.175,6.67,4.67,6,0.4,1,0.6,-0.6,0.666666667,3,0,3,0,2,2,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,58,,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,4,5,7,9,6,8,2,1,3,4,3,2,1 +217,R_6viaW1TKSDJLOgo,60 - 66,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,Agree,Disagree,Somewhat agree,Disagree,Agree,1,2,4,5,3,Disagree,Disagree,Strongly Agree,Disagree,Strongly Agree,3,2,1,4,5,Agree,Agree,Agree,Agree,Strongly Agree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,3,4,1,0,Strongly agree,Disagree,Somewhat agree,Somewhat disagree,Strongly agree,4,2,1,5,3,2,Disagree,Disagree,Agree,Disagree,Strongly Agree,2,5,4,1,3,2,Somewhat agree,Somewhat agree,Agree,Agree,Strongly Agree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,0,Strongly agree,Disagree,Somewhat agree,Somewhat disagree,Strongly agree,2,4,5,1,3,1,Disagree,Disagree,Agree,Disagree,Strongly agree,5,1,3,2,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,Somewhat agree,1,5,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,TRUE,92,TRUE,70,FALSE,86,TRUE,75,TRUE,96,FALSE,100,TRUE,79,FALSE,90,TRUE,70,FALSE,86,FALSE,100,TRUE,75,FALSE,97,FALSE,87,TRUE,82,FALSE,52,FALSE,83,FALSE,100,TRUE,96,FALSE,78,TRUE,100,TRUE,75,TRUE,100,TRUE,81,FALSE,100,TRUE,76,TRUE,54,FALSE,100,TRUE,100,TRUE,83,26,3,3,3,3,3,2,-2,1,-2,2,-2,-2,3,-2,3,2,2,2,2,3,3,3,3,3,3,1,3,-2,1,-1,3,0,-2,-2,2,-2,3,2,1,1,2,2,3,2,3,3,3,3,3,4,3,-2,1,-1,3,0,-2,-2,2,-2,3,1,1,1,1,3,1,2,TRUE,0,83,TRUE,1,100,FALSE,1,100,TRUE,0,54,TRUE,1,76,FALSE,1,100,TRUE,1,81,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,78,TRUE,0,96,FALSE,0,100,FALSE,1,83,FALSE,0,52,TRUE,1,82,FALSE,1,87,FALSE,1,97,TRUE,0,75,FALSE,1,100,FALSE,0,86,TRUE,1,70,FALSE,1,90,TRUE,1,79,FALSE,1,100,TRUE,1,96,TRUE,0,75,FALSE,1,86,TRUE,0,70,TRUE,1,92,FALSE,0,51,TRUE,1,100,0,0.0016,0.0324,0.0361,0,0,0.0441,0,0,0.09,0.0064,1,0.0625,0.0484,0.0576,0,0.01,0.2916,0.0196,0,0.7396,0.2704,0.5625,0.0289,0.0169,0.5625,0.2601,0.6889,0,0.0009,0.49,0.9216,0.220446429,0.115042857,0.32585,26,81.25,22,68.75,3,37.5,5,62.5,7,87.5,7,87.5,12,75,10,62.5,84.81,70,88.62,88.75,91.88,83.75,85.88,12.5,16.06,32.5,26.12,1.25,4.38,8.75,23.38,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,2,0,0.6,0.2,0.4,0,0.6,0.2,1.2,0.3,0.5,0.4,1,1.67,1.5,0,0,0,-0.8,0,-3,0,1,0,-0.67,2,0,1,-2,2,-1,1,0,0,-2,2,-1,10 cents,100 minutes,15 days,Female,University - Graduate (Masters),63,"I like it. Some good thinking has been required. Challenged my mind and beliefs. +",0.875,0,0,0,1,1,0,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,7,9,3,8,2,4,5,1,6,2,4,3,1 +218,R_310qWWe9FxZzRWc,60 - 66,American,,American,Female,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,5,2,4,1,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,2,4,1,3,5,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,3,2,4,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,2,4,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,3,5,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,4,1,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,2,5,4,3,1,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,5,3,4,1,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,3,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,81,FALSE,85,TRUE,100,TRUE,53,TRUE,71,FALSE,62,FALSE,77,TRUE,61,TRUE,73,TRUE,96,TRUE,100,TRUE,100,FALSE,85,TRUE,100,FALSE,72,TRUE,100,FALSE,90,TRUE,100,FALSE,82,FALSE,94,FALSE,100,FALSE,96,TRUE,84,TRUE,100,TRUE,87,TRUE,85,FALSE,90,TRUE,90,TRUE,89,TRUE,100,TRUE,100,FALSE,84,7,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,2,1,-3,-3,1,-3,-3,-1,-1,-1,-1,-1,1,1,1,1,1,1,0,1,1,1,7,1,0,1,1,1,5,1,1,0,1,1,6,1,0,1,1,1,5,0,0,1,0,1,7,0,0,1,0,-1,8,0,0,-1,0,0,7,0,1,1,1,1,6,TRUE,0,81,FALSE,0,85,TRUE,0,100,TRUE,0,53,TRUE,1,71,FALSE,1,62,FALSE,0,77,TRUE,1,61,TRUE,1,73,TRUE,1,96,TRUE,0,100,TRUE,0,100,FALSE,0,85,TRUE,0,100,FALSE,0,72,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,1,82,FALSE,1,94,FALSE,0,100,FALSE,0,96,TRUE,0,84,TRUE,1,100,TRUE,0,87,TRUE,1,85,FALSE,1,90,TRUE,0,90,TRUE,0,89,TRUE,1,100,TRUE,1,100,FALSE,0,84,0.1521,0.0225,0,0.5929,0.7056,0.1444,0,0.0016,0.0036,0.9216,0,0.7225,0.0729,1,0.0841,0.7225,0.7056,0.2809,0.81,0.7569,1,0.5184,0.0324,1,0.01,0.01,0,0.6561,1,1,0.7921,1,0.498257143,0.383235714,0.613278571,7,21.88,14,43.75,4,50,3,37.5,2,25,5,62.5,9,56.25,5,31.25,87.09,81.88,83.12,90.25,93.12,86.56,87.62,-21.87,43.34,31.88,45.62,65.25,30.62,30.31,56.37,0,2,0,1,0,4,3,0,4,4,2,2,1,2,2,0,1,0,0,0,1,2,0,2,0,3,3,0,3,2,1,1,0,1,1,1,0,0,0,0,0.6,3,1.8,0.2,1,2.2,0.8,0.2,1.4,1.05,1.225,6,7.33,6.375,-0.4,0.8,1,0,0.466666667,0,-3,-1,-1,-1.33,0,-1,1,-1,1,1,-1,0,0,-1,1,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),60,nothing,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,5,4,9,3,7,8,2,1,6,2,4,3,1 +219,R_3nMGogVXpl2Jq3x,25 - 31,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,3,2,4,1,5,Disagree,Disagree,Agree,Disagree,Disagree,2,5,3,1,4,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,3,4,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Agree,1,3,2,4,5,4,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,1,2,3,4,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,2,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,2,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,3,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,2,4,5,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,60,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,76,TRUE,59,FALSE,50,TRUE,72,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,-2,1,-2,-2,2,-2,-2,1,1,2,0,1,1,0,1,1,0,0,0,0,-2,2,4,-1,-1,2,0,-1,5,0,0,0,0,0,5,0,0,1,0,0,4,2,2,2,0,1,2,-1,-1,2,0,0,3,1,1,0,0,0,2,1,0,1,0,0,5,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,60,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,76,TRUE,1,59,FALSE,1,50,TRUE,1,72,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,0,0.0784,0,0.16,0.25,0,0.1681,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.5776,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.285560714,0.213978571,0.357142857,10,31.25,21,65.63,4,50,5,62.5,6,75,6,75,8,50,13,81.25,63.03,50,65.75,66.5,69.88,65.06,61,-34.38,-2.6,0,3.25,-8.5,-5.12,15.06,-20.25,1,1,1,0,1,1,1,0,2,1,1,1,2,0,1,1,0,0,1,0,1,1,1,2,0,1,1,0,2,2,0,0,2,0,1,0,0,0,1,0,0.8,1,1,0.4,1,1.2,0.6,0.2,0.8,0.75,0.775,4.67,2.33,3.75,-0.2,-0.2,0.4,0.2,0,2,2,3,-1,2.34,0,0,1,-2,2,1,-1,1,-1,-1,1,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),31,,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,5,7,3,8,9,2,6,1,4,2,4,3,1 +220,R_37at2W1uBdBvtUD,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,2,4,1,3,5,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,2,5,1,Somewhat Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,1,3,4,2,5,Disagree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Agree,1,5,3,4,2,Somewhat agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,1,2,4,3,2,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,2,1,4,1,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,3,5,4,2,2,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat agree,1,5,2,3,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,4,1,5,2,3,4,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,1,2,4,5,3,3,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,5,3,1,4,2,1,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,1,3,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,80,FALSE,100,TRUE,100,TRUE,100,TRUE,70,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,65,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,95,TRUE,100,TRUE,100,TRUE,64,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,3,1,-1,-3,3,-3,1,1,1,2,-2,3,-2,0,1,3,2,1,3,1,0,3,2,-1,-3,3,-3,2,1,1,1,3,0,3,2,-2,0,-2,1,1,7,1,3,1,3,0,4,-3,-3,3,-2,1,3,1,1,2,-3,3,1,-2,-2,0,1,-1,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,95,TRUE,0,100,TRUE,1,100,TRUE,1,64,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0625,0,0,0.09,0,0.04,0,0.1225,0.25,0.9025,0,0,0.25,0,0,0,0.25,0.1296,1,1,0,1,0,0.182039286,0.040357143,0.323721429,29,90.63,26,81.25,6,75,7,87.5,7,87.5,6,75,15,93.75,11,68.75,90.59,73,93.12,96.88,99.38,89.94,91.25,9.38,9.34,-2,5.62,9.38,24.38,-3.81,22.5,0,0,0,3,2,0,0,0,0,1,0,0,1,2,0,0,0,3,2,1,0,0,0,0,1,2,0,0,1,0,0,0,0,1,0,0,2,1,2,3,1,0.2,0.6,1.2,0.2,0.6,0.2,1.6,0.75,0.65,0.7,1.67,2.67,3.125,0.8,-0.4,0.4,-0.4,0.266666667,-2,-2,1,2,-1,1,2,2,-2,2,1,-1,0,0,-2,2,-1,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,,0.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,9,8,7,4,2,3,6,1,5,4,3,2,1 +221,R_7g6FXrNVvkYg5md,60 - 66,American,,American,Female,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,3,4,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,3,4,1,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,1,4,3,2,5,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,2,1,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,2,1,3,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,3,2,1,4,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,3,2,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,2,1,5,4,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,4,5,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,89,TRUE,96,TRUE,87,FALSE,95,TRUE,81,TRUE,90,FALSE,96,TRUE,86,FALSE,100,TRUE,83,FALSE,100,FALSE,100,FALSE,60,TRUE,92,FALSE,96,TRUE,100,TRUE,61,TRUE,65,TRUE,100,FALSE,88,FALSE,93,TRUE,55,TRUE,77,TRUE,93,TRUE,89,FALSE,100,TRUE,80,FALSE,51,FALSE,100,TRUE,89,TRUE,71,25,0,2,2,0,0,-2,-1,1,-1,0,1,0,2,0,2,0,1,2,0,-1,0,2,2,0,0,5,-1,-1,1,-1,0,7,0,0,2,0,2,4,0,1,1,0,0,3,0,2,2,0,0,6,-1,-1,1,-1,0,7,0,0,2,0,2,3,0,0,1,0,0,6,TRUE,0,71,TRUE,1,89,FALSE,1,100,FALSE,1,51,TRUE,1,80,FALSE,1,100,TRUE,1,89,TRUE,1,93,TRUE,1,77,TRUE,1,55,FALSE,1,93,FALSE,1,88,TRUE,1,100,TRUE,0,65,TRUE,1,61,TRUE,1,100,FALSE,1,96,TRUE,0,92,FALSE,1,60,FALSE,1,100,FALSE,0,100,TRUE,1,83,FALSE,1,100,TRUE,1,86,FALSE,1,96,TRUE,1,90,TRUE,0,81,FALSE,1,95,TRUE,0,87,TRUE,1,96,TRUE,1,89,TRUE,1,100,0.0049,0.01,0,0.0121,0,0,0.0196,0.2025,0,0.0289,0.0016,0,0.0529,0.0049,0.04,0.0121,0,0.2401,0.0025,0.0016,1,0.1521,0.16,0.4225,0.0016,0.6561,0.0121,0.5041,0,0.8464,0.7569,0.0144,0.183317857,0.043042857,0.323592857,25,78.13,26,81.25,7,87.5,6,75,5,62.5,8,100,15,93.75,11,68.75,86.34,75.12,95.38,80.12,94.75,86.75,85.94,-3.12,5.09,-12.38,20.38,17.62,-5.25,-7,17.19,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0.2,0.2,0.4,0,0.2,0.2,0.6,0.2,0.25,0.225,5.33,5.33,5.125,0,0,0,-0.2,0,-1,0,1,-3,0,1,1,0,-1,1,0,0,-1,1,-1,1,0,10 cents,5 minutes,24 days,Female,Professional Degree (ex. JD/MD),62,A bit on the long side. It would be nice to know how I did on the general knowlege portion.,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,5,7,4,3,9,6,2,1,8,4,2,3,1 +222,R_3k0uiZGeVT6n0a1,46 - 52,American,,American,Female,Agree,Agree,Agree,Strongly agree,Agree,1,3,2,5,4,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,4,5,2,Agree,Agree,Agree,Somewhat Disagree,Agree,5,2,1,3,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Agree,Agree,3,5,2,1,4,7,Agree,Disagree,Agree,Disagree,Agree,5,2,4,3,1,6,Agree,Agree,Agree,Agree,Agree,5,2,1,4,3,6,Somewhat agree,Somewhat disagree,Agree,Agree,Somewhat agree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Agree,Agree,5,2,4,1,3,7,Agree,Disagree,Agree,Disagree,Agree,1,4,2,3,5,7,Agree,Agree,Agree,Agree,Agree,2,1,3,5,4,5,Agree,Agree,Agree,Agree,Agree,1,2,5,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,85,TRUE,100,TRUE,79,TRUE,81,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,80,FALSE,100,FALSE,81,TRUE,79,TRUE,100,TRUE,90,TRUE,100,TRUE,86,TRUE,80,TRUE,99,TRUE,100,FALSE,79,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,74,FALSE,100,TRUE,100,TRUE,100,17,2,2,2,3,2,1,-1,1,-1,1,2,2,2,-1,2,1,0,1,1,0,2,2,2,2,2,6,2,-2,2,-2,2,7,2,2,2,2,2,6,1,-1,2,2,1,6,2,2,2,2,2,6,2,-2,2,-2,2,7,2,2,2,2,2,7,2,2,2,2,2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,79,TRUE,0,100,TRUE,1,99,TRUE,0,80,TRUE,1,86,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,79,FALSE,1,81,FALSE,0,100,TRUE,1,80,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,81,TRUE,0,79,TRUE,1,100,FALSE,0,85,TRUE,1,100,0,0,0,0,0,0,0,1,0.0361,0.04,0,0.0001,0,0.0441,0,0,0,0.0676,0.6561,0,1,0.0196,0.6241,0.64,0.81,0.25,0.7225,1,0,1,0.6241,1,0.340510714,0.08485,0.596171429,17,53.13,20,62.5,5,62.5,5,62.5,4,50,6,75,13,81.25,7,43.75,91.97,81.62,96,95,95.25,96.88,87.06,-9.37,29.47,19.12,33.5,45,20.25,15.63,43.31,0,0,0,1,0,1,1,1,1,1,0,0,0,3,0,0,1,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,0,3,0,1,2,1,1,2,0.2,1,0.6,0.8,0.2,1,0.6,1.4,0.65,0.8,0.725,6.33,6.67,6.25,0,0,0,-0.6,0,0,0,-1,1,-0.34,1,1,0,-1,1,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,49,,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,4,3,8,2,6,5,7,1,9,2,3,4,1 +223,R_7ojPyhcZ9OXZ470,60 - 66,American,,American,Female,Agree,Neither agree nor disagree,Agree,Agree,Disagree,4,2,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,4,1,5,2,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,5,4,1,3,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,5,3,1,4,9,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,3,5,1,6,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,3,2,5,4,1,5,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Agree,4,5,2,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Neither agree nor disagree,Agree,Agree,Disagree,3,1,5,2,4,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,4,5,3,1,6,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,3,2,5,1,4,3,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,Agree,1,3,2,4,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,TRUE,81,FALSE,50,TRUE,75,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,91,TRUE,100,TRUE,92,TRUE,100,TRUE,87,TRUE,100,TRUE,96,FALSE,93,FALSE,80,FALSE,64,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,75,FALSE,100,TRUE,100,TRUE,100,FALSE,95,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,2,2,-2,0,0,2,1,1,1,0,2,-2,2,1,0,1,1,1,1,1,1,-1,1,9,1,1,1,1,1,6,1,0,2,-2,2,5,0,-1,-1,1,2,8,1,0,2,2,-2,5,-1,0,0,2,0,6,1,0,2,-2,2,3,1,-1,1,2,2,2,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,75,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,TRUE,1,92,TRUE,0,100,TRUE,1,87,TRUE,1,100,TRUE,0,96,FALSE,1,93,FALSE,1,80,FALSE,1,64,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,95,TRUE,1,100,0,0,0,0,0,0,0,0,0.1296,0,0,0.0064,0.25,0.0081,0.25,0.0361,0,0.5625,0,1,1,0.0169,0.04,1,0.9216,0.0625,0.9025,0.25,0.25,0.0049,1,1,0.310396429,0.088764286,0.532028571,28,87.5,22,68.75,5,62.5,4,50,6,75,7,87.5,12,75,10,62.5,88.41,79.25,92.25,92.88,89.25,90.94,85.88,18.75,19.66,16.75,42.25,17.88,1.75,15.94,23.38,1,1,1,3,3,1,1,1,0,0,0,0,0,0,0,1,1,2,0,1,1,0,0,0,0,1,0,2,1,1,0,0,0,0,0,0,1,0,1,1,1.8,0.6,0,1,0.2,1,0,0.6,0.85,0.45,0.65,6.67,4.67,5.5,1.6,-0.4,0,0.4,0.4,4,0,2,6,2,0,0,-1,-2,2,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,Very interesting survey!,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,5,3,9,2,8,4,7,1,6,3,2,4,1 +224,R_3XdEnFjaTRbjdzR,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,2,3,4,5,Disagree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,2,5,4,1,3,Somewhat Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,2,3,5,4,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,4,3,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,1,3,4,8,Disagree,Disagree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,8,Somewhat Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,1,4,5,2,3,8,Disagree,Somewhat disagree,Somewhat agree,Agree,Agree,4,5,3,2,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,3,1,2,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,4,2,1,3,8,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,2,4,1,3,5,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,2,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,82,TRUE,74,TRUE,81,TRUE,76,TRUE,87,TRUE,80,TRUE,86,TRUE,87,TRUE,91,TRUE,100,FALSE,100,TRUE,100,FALSE,92,FALSE,100,TRUE,91,TRUE,100,FALSE,72,FALSE,90,FALSE,81,FALSE,85,FALSE,94,FALSE,83,FALSE,85,TRUE,100,FALSE,75,TRUE,79,FALSE,80,FALSE,91,TRUE,80,FALSE,89,TRUE,85,TRUE,100,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,-2,-3,3,3,3,-1,1,3,1,3,-3,-2,-3,-3,-3,-3,-3,-3,-3,-3,8,-2,-2,3,3,3,8,1,1,3,-2,3,8,-2,-1,1,2,2,9,-3,-3,-3,-3,-3,10,-3,-3,-3,-3,-3,8,-3,-3,-3,-3,-3,3,-3,-3,-3,-3,-3,7,TRUE,0,82,TRUE,1,74,TRUE,0,81,TRUE,0,76,TRUE,1,87,TRUE,0,80,TRUE,1,86,TRUE,1,87,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,92,FALSE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,72,FALSE,1,90,FALSE,1,81,FALSE,1,85,FALSE,0,94,FALSE,0,83,FALSE,1,85,TRUE,1,100,FALSE,1,75,TRUE,1,79,FALSE,1,80,FALSE,1,91,TRUE,0,80,FALSE,0,89,TRUE,1,85,TRUE,1,100,0.0169,0.0441,0,0.0196,0,0.64,0,0,0.0225,0.6889,0.7921,0.8464,0.0081,0,0.0169,0.0676,0.0225,0.5776,0.0081,0.0625,0.8836,0.0081,0.0361,0,0.0784,0.04,0.0225,0.6724,0.6561,0.01,0.64,1,0.278585714,0.263042857,0.294128571,18,56.25,22,68.75,7,87.5,4,50,6,75,5,62.5,12,75,10,62.5,87.38,84.75,86.25,86.88,91.62,89.88,84.88,-12.5,18.63,-2.75,36.25,11.88,29.12,14.88,22.38,6,6,6,5,6,0,1,0,0,0,2,0,0,3,0,1,1,4,5,5,6,6,6,5,6,1,0,6,6,6,2,4,6,4,6,0,1,0,0,0,5.8,0.2,1,3.2,5.8,3.8,4.4,0.2,2.55,3.55,3.05,8,7,7.625,0,-3.6,-3.4,3,-2.333333333,-2,0,5,2,1,2,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,51,I am not quite sure what is the point of asking many questions which involve knowledges of miscellaneous things about the world?,1.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,5,2,4,7,9,8,3,1,6,3,4,2,1 +225,R_3rCZdWPhxfYeoQI,60 - 66,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,1,4,5,3,Neither agree nor disagree,Disagree,Agree,Somewhat agree,Somewhat agree,5,2,4,1,3,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,1,2,5,3,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Disagree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,1,2,4,5,9,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,5,3,2,1,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,2,3,4,1,5,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,4,3,1,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,3,2,4,1,5,2,Somewhat Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,1,3,4,1,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Disagree,4,3,5,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,90,FALSE,60,FALSE,50,TRUE,80,TRUE,50,FALSE,75,TRUE,96,TRUE,65,FALSE,100,FALSE,70,TRUE,96,TRUE,65,TRUE,100,TRUE,50,TRUE,90,TRUE,100,TRUE,100,FALSE,95,TRUE,55,TRUE,90,TRUE,100,TRUE,100,FALSE,95,TRUE,70,FALSE,50,FALSE,95,TRUE,100,TRUE,100,24,3,3,3,3,2,0,-2,2,1,1,1,3,3,2,3,-1,1,2,1,-2,3,3,3,2,2,6,0,-2,1,1,0,9,1,3,3,-1,3,1,-1,1,1,1,-2,5,3,3,3,3,3,1,0,-1,2,0,1,1,1,3,3,0,3,2,1,2,1,1,-2,1,TRUE,0,100,TRUE,1,100,FALSE,1,95,FALSE,1,50,TRUE,1,70,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,55,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,90,TRUE,1,50,TRUE,1,100,TRUE,0,65,TRUE,0,96,FALSE,1,70,FALSE,1,100,TRUE,1,65,TRUE,1,96,FALSE,1,75,TRUE,1,50,TRUE,0,80,FALSE,0,50,FALSE,1,60,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.25,0,0,0,0.0025,0.25,0.2025,0,0.0016,0,0,0.01,0.0025,0.09,0,0.0625,0.25,0.81,0.64,0.1225,0.25,0.09,0.81,0.4225,0.16,0.25,1,0.0025,0.9216,0.25,1,0.271453571,0.062257143,0.48065,24,75,24,75,8,100,7,87.5,3,37.5,6,75,15,93.75,9,56.25,80.84,70.62,77.5,83.38,91.88,79.75,81.94,0,5.84,-29.38,-10,45.88,16.88,-14,25.69,0,0,0,1,0,0,0,1,0,1,0,0,0,3,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,2,0,2,1,1,0,0,0.2,0.4,0.6,0.2,0.2,0.4,0.4,0.8,0.35,0.45,0.4,5.33,1.33,3.25,0,0,0.2,-0.6,0.066666667,5,8,-1,4,4,2,2,2,-2,2,-1,1,-2,2,-2,2,-2,10 cents,25 minutes,15 days,Male,University - Graduate (Masters),61,,1.375,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,5,8,9,4,3,7,2,1,6,2,4,3,1 +226,R_5rwEoL80JtdSsdX,60 - 66,American,,American,Female,Disagree,Strongly agree,Agree,Strongly disagree,Agree,5,3,2,1,4,Agree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,5,1,2,4,3,Strongly Agree,Agree,Agree,Agree,Strongly Agree,3,4,2,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Strongly Agree,Neither agree nor disagree,Strongly disagree,Somewhat disagree,3,1,2,4,5,6,Agree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,4,3,5,2,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,1,4,2,8,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Strongly Agree,Agree,Disagree,Agree,1,5,3,2,4,2,Agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,1,5,2,4,3,7,Strongly agree,Agree,Strongly agree,Somewhat Disagree,Strongly agree,2,3,1,5,4,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,5,3,2,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,76,TRUE,50,TRUE,100,TRUE,100,TRUE,86,FALSE,50,FALSE,60,FALSE,50,TRUE,59,TRUE,74,FALSE,59,TRUE,50,TRUE,50,FALSE,100,TRUE,75,TRUE,63,11,-2,3,2,-3,2,2,-1,2,1,0,3,2,2,2,3,-1,1,1,-1,-2,-2,3,0,-3,-1,4,2,-1,-1,1,-1,6,1,1,1,0,0,7,-2,0,-2,-2,-2,8,0,3,2,-2,2,2,2,-1,2,0,-1,2,3,2,3,-1,3,7,1,0,1,1,-2,4,TRUE,0,63,TRUE,1,75,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,59,TRUE,1,74,TRUE,1,59,FALSE,0,50,FALSE,0,60,FALSE,1,50,TRUE,0,86,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,76,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.1681,0,0.0576,0.0676,0,0.1681,0.25,0.36,0,0.25,0,0,0.25,0.25,0.25,0.0625,0,0.25,0,1,0.25,0.25,1,1,0.25,0.25,0.25,0.3969,0,0,1,0.7396,0.302753571,0.149328571,0.456178571,11,34.38,21,65.63,4,50,7,87.5,3,37.5,7,87.5,12,75,9,56.25,75.06,59.38,76.12,80.88,83.88,68.38,81.75,-31.25,9.43,9.38,-11.38,43.38,-3.62,-6.62,25.5,0,0,2,0,3,0,0,3,0,1,2,1,1,2,3,1,1,3,1,0,2,0,0,1,0,0,0,0,1,1,0,0,1,3,0,2,1,0,2,0,1,0.8,1.8,1.2,0.6,0.4,0.8,1,1.2,0.7,0.95,5.67,3.67,5,0.4,0.4,1,0.2,0.6,2,4,0,4,2,0,1,1,0,0,0,0,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,This was kind of fun.,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,4,8,9,3,2,6,5,1,7,2,3,4,1 +227,R_6OVzbh3kj7EIBeq,53 - 59,,Canadian,Canadian,Female,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly agree,4,3,2,1,5,Somewhat disagree,Somewhat disagree,Agree,Disagree,Agree,1,5,2,4,3,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,5,4,2,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,3,1,5,2,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly Agree,1,4,2,3,5,0,Somewhat disagree,Disagree,Agree,Disagree,Agree,1,4,2,3,5,0,Agree,Agree,Strongly Agree,Agree,Agree,3,5,1,4,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,4,5,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly Agree,5,4,1,2,3,1,Somewhat disagree,Disagree,Agree,Disagree,Agree,2,4,5,1,3,0,Somewhat Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,2,1,3,4,5,1,Agree,Somewhat agree,Agree,Agree,Agree,3,5,4,2,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,92,FALSE,56,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,87,TRUE,100,TRUE,88,FALSE,75,TRUE,59,TRUE,100,FALSE,80,TRUE,100,FALSE,90,TRUE,97,TRUE,82,FALSE,70,FALSE,86,FALSE,81,FALSE,92,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,0,0,1,3,-1,-1,2,-2,2,1,3,3,1,2,1,1,1,2,1,3,0,0,1,3,0,-1,-2,2,-2,2,0,2,2,3,2,2,1,1,1,1,1,1,1,3,0,0,1,3,1,-1,-2,2,-2,2,0,1,2,3,0,2,1,2,1,2,2,2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,92,FALSE,0,56,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,88,FALSE,1,75,TRUE,1,59,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,90,TRUE,1,97,TRUE,0,82,FALSE,1,70,FALSE,1,86,FALSE,0,81,FALSE,0,92,TRUE,1,100,0,0.0009,0,0,0,0,0,0,0.0625,0,0.6561,0,0,0,0.3136,0,0.04,0.0064,0.09,0.01,0.1681,0,0.7744,0,0.7569,0.6724,0.8464,0,1,1,0.0196,1,0.264871429,0.077042857,0.4527,28,87.5,23,71.88,5,62.5,6,75,7,87.5,5,62.5,13,81.25,10,62.5,91.72,94.25,83.5,98.38,90.75,92.81,90.62,15.62,19.84,31.75,8.5,10.88,28.25,11.56,28.12,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0.2,0.6,0.2,0,0.2,0.4,0.6,0.25,0.3,0.275,0.33,0.67,0.625,0,0,0.2,-0.4,0.066666667,-1,0,0,0,-0.34,0,1,0,-2,2,0,0,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,9,3,4,7,5,2,8,1,6,2,4,3,1 +228,R_3CKv8BRmfzwHhXp,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,1,2,3,5,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,1,3,5,2,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,5,4,5,Somewhat agree,Disagree,Somewhat agree,Disagree,Agree,3,5,4,2,1,6,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Disagree,3,4,2,5,1,4,Agree,Agree,Agree,Agree,Agree,1,3,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,1,3,5,2,6,Somewhat disagree,Agree,Agree,Disagree,Somewhat agree,5,1,2,4,3,5,Agree,Agree,Agree,Somewhat Disagree,Somewhat Disagree,2,5,4,3,1,5,Agree,Agree,Agree,Agree,Agree,3,1,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,57,TRUE,87,TRUE,89,FALSE,100,TRUE,76,TRUE,90,TRUE,75,TRUE,89,FALSE,91,TRUE,65,FALSE,55,FALSE,58,TRUE,61,FALSE,59,TRUE,66,TRUE,86,TRUE,72,TRUE,80,TRUE,72,TRUE,78,FALSE,83,TRUE,80,TRUE,73,TRUE,87,TRUE,82,FALSE,55,TRUE,80,FALSE,62,TRUE,88,TRUE,87,FALSE,84,16,3,3,3,3,1,0,2,1,1,1,1,1,1,1,-1,-1,-1,1,-1,1,3,3,3,3,3,7,1,-2,1,-2,2,5,2,-1,1,-1,-2,6,2,2,2,2,2,4,3,3,3,3,2,5,-1,2,2,-2,1,6,2,2,2,-1,-1,5,2,2,2,2,2,5,FALSE,1,84,TRUE,1,87,TRUE,0,88,FALSE,1,62,TRUE,1,80,FALSE,1,55,TRUE,1,82,TRUE,1,87,TRUE,1,73,TRUE,1,80,FALSE,1,83,TRUE,0,78,TRUE,1,72,TRUE,0,80,TRUE,1,72,TRUE,1,86,TRUE,0,66,FALSE,1,59,TRUE,0,61,FALSE,1,58,FALSE,0,55,TRUE,1,65,FALSE,1,91,TRUE,1,89,TRUE,0,75,TRUE,1,90,TRUE,0,76,FALSE,1,100,TRUE,0,89,TRUE,1,87,FALSE,0,57,TRUE,1,95,0.0169,0.01,0.0196,0.0324,0.0025,0.2025,0.0121,0.04,0.1764,0.1225,0.0169,0.0784,0.0729,0.0289,0.04,0.0169,0.0081,0.1444,0,0.5625,0.3025,0.0784,0.3721,0.64,0.4356,0.5776,0.3249,0.0256,0.7744,0.1681,0.7921,0.6084,0.236596429,0.06875,0.404442857,16,50,22,68.75,5,62.5,5,62.5,6,75,6,75,14,87.5,8,50,76.94,71.38,75.38,76.88,84.12,78.56,75.31,-18.75,8.19,8.88,12.88,1.88,9.12,-8.94,25.31,0,0,0,0,2,1,4,0,3,1,1,2,0,2,1,3,3,1,3,1,0,0,0,0,1,1,0,1,3,0,1,1,1,2,0,3,3,1,3,1,0.4,1.8,1.2,2.2,0.2,1,1,2.2,1.4,1.1,1.25,6,5.33,5.375,0.2,0.8,0.2,0,0.4,2,-1,1,-1,0.67,1,1,1,-2,2,-1,1,-2,2,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),49,This was interesting.,1.25,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,9,7,4,8,5,3,1,6,3,4,2,1 +229,R_3lnLirb7cmoNtqp,39 - 45,American,,American,Female,Strongly agree,Agree,Somewhat agree,Strongly disagree,Strongly agree,3,4,5,1,2,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Agree,5,3,1,2,4,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,3,1,5,4,2,Strongly disagree,Strongly disagree,Disagree,Disagree,Neither agree nor disagree,4,5,3,1,2,Neither agree nor disagree,Agree,Somewhat agree,Strongly disagree,Strongly Agree,2,1,4,3,5,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,4,1,5,3,2,7,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,3,5,1,4,2,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,5,3,4,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Strongly disagree,Strongly Agree,3,1,2,4,5,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,1,4,3,5,1,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,4,1,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,FALSE,50,TRUE,75,TRUE,50,TRUE,95,FALSE,50,TRUE,97,TRUE,70,FALSE,50,TRUE,70,FALSE,50,TRUE,75,FALSE,50,TRUE,75,TRUE,60,TRUE,50,TRUE,75,TRUE,75,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,16,3,2,1,-3,3,0,1,3,1,2,3,0,3,-2,3,-3,-3,-2,-2,0,0,2,1,-3,3,1,0,0,3,-1,2,7,3,0,3,-2,3,0,0,0,1,-2,0,7,3,2,1,-3,3,1,0,1,3,0,1,1,3,0,3,-3,3,1,0,0,0,0,0,3,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,0,50,TRUE,0,60,TRUE,0,75,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,0,70,FALSE,0,50,TRUE,0,70,TRUE,1,97,FALSE,1,50,TRUE,0,95,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,75,0,0.0009,0.0625,0,0.0625,0,0.25,0,0.25,0.25,0.0625,0,0.25,0,0.25,0.25,0.49,0.25,0.9025,0.49,0.0625,0.0625,0.5625,0.25,0.25,0.25,0.25,0.25,1,0.36,0.25,1,0.296607143,0.168928571,0.424285714,16,50,17,53.13,4,50,5,62.5,4,50,4,50,12,75,5,31.25,71.62,62.5,71.25,72.12,80.62,73.25,70,-3.13,18.49,12.5,8.75,22.12,30.62,-1.75,38.75,3,0,0,0,0,0,1,0,2,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,3,3,2,2,0,0.6,0.6,0,1.8,0,0.4,0.2,2,0.75,0.65,0.7,2.67,1,2.625,0.6,0.2,-0.2,-0.2,0.2,0,6,-1,4,1.67,1,2,2,-2,2,-2,2,-2,2,-2,2,1,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),39,It was interesting but it definitely made me full very unintelligent.,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,02REV,8,6,4,7,2,5,9,1,3,2,3,4,1 +230,R_54iwi18tDXM5uP4,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,2,5,1,3,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,Agree,Agree,Agree,Somewhat Agree,Agree,2,4,1,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,2,3,5,4,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,2,4,5,1,3,Disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,2,3,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,5,2,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,5,3,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,4,2,3,5,2,Somewhat disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,5,2,1,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,3,2,5,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,1,4,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,90,TRUE,55,TRUE,60,FALSE,56,TRUE,100,TRUE,68,FALSE,54,FALSE,58,FALSE,63,FALSE,62,FALSE,65,FALSE,71,TRUE,64,TRUE,78,FALSE,59,FALSE,61,FALSE,54,TRUE,65,TRUE,100,TRUE,70,TRUE,100,FALSE,59,FALSE,55,TRUE,86,FALSE,100,FALSE,71,FALSE,61,TRUE,65,FALSE,63,TRUE,64,13,2,3,3,3,1,-1,1,3,-1,1,2,2,2,1,2,-1,-1,1,1,-1,2,3,3,3,2,3,-2,-1,3,-1,1,2,3,3,3,2,3,2,1,1,1,1,-1,3,1,3,3,3,1,2,-1,1,3,0,1,2,3,3,3,-1,3,3,1,1,1,1,-1,3,TRUE,0,64,FALSE,0,63,TRUE,0,65,FALSE,1,61,FALSE,0,71,FALSE,1,100,TRUE,1,86,FALSE,0,55,FALSE,0,59,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,1,65,FALSE,1,54,FALSE,0,61,FALSE,0,59,TRUE,0,78,TRUE,0,64,FALSE,1,71,FALSE,1,65,FALSE,0,62,FALSE,0,63,FALSE,1,58,FALSE,0,54,TRUE,0,68,TRUE,1,100,FALSE,1,56,TRUE,0,60,TRUE,0,55,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.3025,0,0.3481,0.0196,0,0,0.2916,0,0.1225,0.3969,0.01,0.1225,0.3481,0.49,0.5041,0.3969,0.1764,0.1521,0.36,0.4624,0.3844,0.3721,0.0841,0.2116,0.6084,0.1936,0.25,0.4096,0.4225,0.4096,0.3025,1,0.302925,0.215078571,0.390771429,13,40.63,13,40.63,3,37.5,4,50,4,50,2,25,6,37.5,7,43.75,69.59,61.38,73.62,74.88,68.5,71.12,68.06,0,28.96,23.88,23.62,24.88,43.5,33.62,24.31,0,0,0,0,1,1,2,0,0,0,1,1,1,1,1,2,2,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,2,1,2,2,0,0,0,0.2,0.6,1,0.8,0.2,0.2,1.2,0.8,0.65,0.6,0.625,2.33,2.33,2.5,0,0.4,-0.2,0,0.066666667,1,0,-1,0,0,1,1,1,-2,2,-1,1,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,50,,1,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,2,9,8,5,4,7,6,1,3,2,3,4,1 +231,R_7GqQFm5zoFfvVSt,60 - 66,American,,American,Female,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Agree,3,1,4,2,5,Agree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,4,5,2,3,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,5,2,3,4,1,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Agree,Agree,Disagree,Agree,5,4,1,2,3,2,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,2,5,3,4,1,2,Agree,Somewhat Agree,Agree,Disagree,Agree,2,5,1,4,3,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,5,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,Agree,4,5,1,3,2,2,Disagree,Disagree,Agree,Disagree,Somewhat agree,3,2,4,1,5,3,Agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,4,3,2,1,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,98,TRUE,96,TRUE,96,TRUE,98,TRUE,94,FALSE,94,TRUE,97,TRUE,97,TRUE,96,TRUE,83,TRUE,96,TRUE,96,FALSE,96,FALSE,98,FALSE,96,FALSE,95,TRUE,96,FALSE,91,TRUE,96,FALSE,91,TRUE,96,FALSE,83,TRUE,97,TRUE,96,TRUE,95,TRUE,96,FALSE,97,TRUE,96,FALSE,94,TRUE,94,TRUE,93,TRUE,98,30,0,2,1,-2,2,2,-2,2,-1,0,2,1,1,1,2,1,2,2,1,1,0,2,2,-2,2,4,1,-3,2,-3,1,2,2,1,2,-2,2,2,1,1,2,1,1,4,0,2,1,-1,2,8,-2,-2,2,-2,1,2,2,1,1,-2,2,3,1,1,1,1,1,8,TRUE,0,98,TRUE,1,93,TRUE,0,94,FALSE,1,94,TRUE,1,96,FALSE,1,97,TRUE,1,96,TRUE,1,95,TRUE,1,96,TRUE,1,97,FALSE,1,83,TRUE,0,96,FALSE,0,91,TRUE,0,96,FALSE,0,91,TRUE,1,96,FALSE,1,95,FALSE,1,96,FALSE,1,98,FALSE,1,96,TRUE,1,96,TRUE,1,96,TRUE,0,83,TRUE,1,96,TRUE,0,97,TRUE,1,97,FALSE,1,94,TRUE,0,94,TRUE,0,98,TRUE,1,96,TRUE,1,96,TRUE,1,98,0.0025,0.0009,0.0016,0.0016,0.0004,0.0009,0.0016,0.0009,0.0016,0.0016,0.0016,0.8281,0.0016,0.0289,0.0016,0.0049,0.6889,0.0036,0.8836,0.9409,0.0016,0.8281,0.0004,0.9216,0.0025,0.0036,0.0016,0.9604,0.8836,0.0016,0.9604,0.9216,0.317060714,0.111871429,0.52225,30,93.75,22,68.75,7,87.5,5,62.5,5,62.5,5,62.5,14,87.5,8,50,94.84,93.12,94.25,96.62,95.38,95.38,94.31,25,26.09,5.62,31.75,34.12,32.88,7.88,44.31,0,0,1,0,0,1,1,0,2,1,0,0,1,3,0,0,1,0,0,0,0,0,0,1,0,4,0,0,1,1,0,0,0,3,0,0,1,1,0,0,0.2,1,0.8,0.2,0.2,1.2,0.6,0.4,0.55,0.6,0.575,2.67,4.33,4.125,0,-0.2,0.2,-0.2,0,-4,0,-1,-4,-1.66,-1,1,1,-2,2,2,-2,-1,1,-1,1,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,none,0.625,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,4,6,7,5,2,8,3,1,9,4,3,2,1 +232,R_6zUDlbxSGcq66dq,60 - 66,American,,American,Female,Somewhat agree,Agree,Agree,Strongly disagree,Strongly agree,1,3,2,4,5,Neither agree nor disagree,Disagree,Agree,Strongly agree,Neither agree nor disagree,4,5,1,2,3,Somewhat Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,1,4,3,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Somewhat agree,Agree,Strongly disagree,Strongly Agree,2,3,1,4,5,7,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,4,5,1,2,7,Somewhat Agree,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,1,2,3,5,Disagree,Somewhat agree,Somewhat agree,Disagree,Strongly disagree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Somewhat agree,Agree,3,5,2,1,4,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat disagree,5,1,4,3,2,2,Neither Agree nor Disagree,Disagree,Somewhat Agree,Disagree,Somewhat Agree,5,3,1,4,2,8,Agree,Agree,Agree,Somewhat agree,Strongly disagree,2,5,1,4,3,FALSE,77,TRUE,88,FALSE,100,FALSE,54,FALSE,56,FALSE,100,TRUE,62,TRUE,100,TRUE,51,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,53,TRUE,89,FALSE,57,TRUE,100,TRUE,54,FALSE,66,TRUE,59,TRUE,55,FALSE,53,TRUE,95,FALSE,100,TRUE,84,TRUE,53,FALSE,100,TRUE,90,TRUE,100,FALSE,53,TRUE,100,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,-3,3,0,-2,2,3,0,-1,-1,2,0,1,-2,-1,0,0,-3,3,1,2,-3,3,7,1,-2,1,-1,1,7,1,-2,3,3,3,7,-2,1,1,-2,-3,5,2,2,2,1,2,4,1,-2,1,-2,-1,2,0,-2,1,-2,1,2,2,2,2,1,-3,8,FALSE,1,77,TRUE,1,88,FALSE,1,100,FALSE,1,54,FALSE,0,56,FALSE,1,100,TRUE,1,62,TRUE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,90,TRUE,1,53,TRUE,1,89,FALSE,1,57,TRUE,0,100,TRUE,0,54,FALSE,1,66,TRUE,1,59,TRUE,1,55,FALSE,1,53,TRUE,1,95,FALSE,1,100,TRUE,1,84,TRUE,0,53,FALSE,1,100,TRUE,0,90,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0.0256,0.0121,0.1444,0,0,0.0025,0,0.1156,0.2025,0,0,0.2401,0,0.3136,0.0144,0.2209,0.2116,0,0,0.1681,0.2209,0.2916,0.81,0.1849,0.2809,0.2809,0.0529,0,1,0.81,1,0.229335714,0.094371429,0.3643,21,65.63,24,75,5,62.5,6,75,6,75,7,87.5,14,87.5,10,62.5,79.34,63.25,76.88,83.5,93.75,77.81,80.88,-9.37,4.34,0.75,1.88,8.5,6.25,-9.69,18.38,2,1,0,0,0,1,0,1,4,1,2,1,1,3,2,0,2,1,2,0,1,0,0,4,1,1,0,1,5,1,1,1,1,2,0,4,3,2,1,0,0.6,1.4,1.8,1,1.2,1.6,1,2,1.2,1.45,1.325,7,2.67,5.25,-0.6,-0.2,0.8,-1,0,3,5,5,-3,4.33,0,0,0,-2,2,1,-1,-1,1,0,0,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,63,I hate the slider bar questions.,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,8,7,5,2,6,3,4,1,9,2,3,4,1 +233,R_5VLj8wSI5Etrp3X,53 - 59,American,,American,Female,Strongly agree,Somewhat agree,Somewhat agree,Strongly disagree,Disagree,5,2,1,4,3,Neither agree nor disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,2,5,4,3,1,Somewhat Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,5,2,1,4,3,Disagree,Disagree,Somewhat agree,Somewhat agree,Disagree,1,2,3,5,4,Strongly Agree,Agree,Somewhat agree,Disagree,Disagree,2,3,4,5,1,1,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,5,4,2,1,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,5,2,4,1,3,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Disagree,5,2,4,3,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Disagree,Disagree,1,2,3,4,5,1,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,2,1,4,5,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,4,5,3,2,1,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,1,4,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,90,FALSE,67,TRUE,92,FALSE,100,TRUE,96,TRUE,91,TRUE,50,TRUE,91,TRUE,100,TRUE,64,TRUE,99,TRUE,70,TRUE,100,TRUE,100,TRUE,50,FALSE,70,TRUE,76,TRUE,96,TRUE,100,TRUE,92,FALSE,78,TRUE,100,TRUE,77,FALSE,100,TRUE,90,FALSE,100,28,3,1,1,-3,-2,0,-3,1,-2,1,1,1,2,-2,1,-2,-2,1,1,-2,3,2,1,-2,-2,1,1,-2,1,-2,1,1,1,1,1,-3,1,1,0,-1,1,-1,-2,2,3,2,2,-2,-2,1,1,-2,1,-2,1,1,1,1,1,-2,1,1,-1,0,0,0,-1,1,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,77,TRUE,1,100,FALSE,1,78,TRUE,1,92,TRUE,1,100,TRUE,1,96,TRUE,1,76,FALSE,1,70,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,99,TRUE,0,64,TRUE,0,100,TRUE,0,91,TRUE,0,50,TRUE,1,91,TRUE,1,96,FALSE,1,100,TRUE,1,92,FALSE,1,67,TRUE,1,90,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,0,0.01,0.0001,0.0064,0.0081,0.0484,0.0064,0.0576,0.25,0.0016,0,0,0.0016,0.09,0,0.01,0,0.5929,0,0.1089,0.0081,0.09,0.8281,1,0.4096,0.25,0,0,0,1,1,0.25,0.214689286,0.076185714,0.353192857,28,87.5,23,71.88,5,62.5,6,75,6,75,6,75,16,100,7,43.75,86.88,80.5,90.5,90.12,86.38,92.69,81.06,15.62,15,18,15.5,15.12,11.38,-7.31,37.31,0,1,0,1,0,1,1,0,0,0,0,0,1,1,0,2,1,0,2,0,0,1,1,1,0,1,1,0,0,0,0,0,1,0,0,1,2,1,1,1,0.4,0.4,0.4,1,0.6,0.4,0.2,1.2,0.55,0.6,0.575,1,1,1.125,-0.2,0,0.2,-0.2,0,0,0,0,1,0,0,1,1,-1,1,0,0,0,0,-1,1,1,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,57,strange but fun ,0.625,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,4,5,9,3,7,6,2,1,8,2,3,4,1 +234,R_5j7L6CmlWnkapAw,46 - 52,,Canadian,Canadian,Female,Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,1,5,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,1,2,5,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Agree,Agree,Somewhat agree,Agree,5,1,2,4,3,0,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,1,2,3,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Strongly Disagree,3,1,2,4,5,10,Somewhat agree,Agree,Agree,Agree,Somewhat disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,4,3,2,5,1,1,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,2,3,5,1,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,1,5,4,0,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,4,1,2,3,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,93,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,1,0,-1,-2,0,-2,1,0,0,2,0,0,-2,-1,-1,-1,-1,2,2,2,1,2,10,-1,-2,0,-2,1,0,0,0,1,-1,-3,1,1,2,2,2,-1,10,2,1,2,2,0,0,-1,-1,0,-2,1,1,1,0,1,0,0,5,-1,-1,-1,-1,-1,0,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,93,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,1,1,0.8649,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0.209460714,0.276064286,0.142857143,30,93.75,26,81.25,5,62.5,7,87.5,7,87.5,7,87.5,11,68.75,15,93.75,99.78,100,99.12,100,100,99.56,100,12.5,18.53,37.5,11.62,12.5,12.5,30.81,6.25,0,1,0,0,2,0,0,0,0,0,0,0,1,1,3,3,3,3,3,0,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0.6,0,1,2.4,0.2,0.2,0.4,0.2,1,0.25,0.625,3.67,2,3.375,0.4,-0.2,0.6,2.2,0.266666667,10,-1,-4,10,1.67,0,2,0,-2,2,0,0,-2,2,-2,2,-2,5 cents,5 minutes,47 days,Female,University - Undergraduate,50,.,0.75,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,6,2,9,7,5,3,8,1,4,3,2,4,1 +235,R_1VKMbZSA4ZQ4nRL,60 - 66,American,,American,Female,Neither agree nor disagree,Somewhat disagree,Agree,Strongly agree,Strongly agree,5,4,3,2,1,Strongly disagree,Agree,Agree,Agree,Strongly agree,5,1,4,3,2,Somewhat Disagree,Somewhat Disagree,Agree,Strongly Disagree,Strongly Agree,2,3,4,1,5,Disagree,Strongly disagree,Disagree,Disagree,Somewhat disagree,1,3,2,4,5,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,5,3,2,1,4,3,Somewhat disagree,Strongly agree,Somewhat agree,Agree,Agree,4,2,5,3,1,3,Disagree,Somewhat Disagree,Agree,Strongly Disagree,Strongly Agree,5,3,1,4,2,2,Strongly disagree,Strongly disagree,Disagree,Disagree,Somewhat disagree,2,5,4,1,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,Agree,2,3,1,5,4,2,Disagree,Agree,Agree,Agree,Agree,2,1,3,4,5,2,Somewhat Disagree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,3,1,2,5,4,4,Disagree,Disagree,Disagree,Strongly disagree,Somewhat disagree,1,4,3,2,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,93,TRUE,100,TRUE,99,FALSE,50,TRUE,89,FALSE,100,TRUE,99,TRUE,100,TRUE,76,TRUE,87,FALSE,99,TRUE,82,TRUE,95,TRUE,79,TRUE,61,TRUE,100,FALSE,91,TRUE,87,TRUE,91,FALSE,100,TRUE,80,TRUE,86,FALSE,100,TRUE,98,FALSE,100,TRUE,96,TRUE,92,FALSE,76,TRUE,91,TRUE,94,FALSE,80,TRUE,94,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,-1,2,3,3,-3,2,2,2,3,-1,-1,2,-3,3,-2,-3,-2,-2,-1,2,0,1,1,2,3,-1,3,1,2,2,3,-2,-1,2,-3,3,2,-3,-3,-2,-2,-1,4,1,1,1,3,2,2,-2,2,2,2,2,2,-1,1,3,-2,3,4,-2,-2,-2,-3,-1,2,TRUE,0,93,TRUE,1,100,TRUE,0,99,FALSE,1,50,TRUE,1,89,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,76,TRUE,1,87,FALSE,1,99,TRUE,0,82,TRUE,1,95,TRUE,0,79,TRUE,1,61,TRUE,1,100,FALSE,1,91,TRUE,0,87,TRUE,0,91,FALSE,1,100,TRUE,1,80,TRUE,1,86,FALSE,1,100,TRUE,1,98,FALSE,1,100,TRUE,1,96,TRUE,0,92,FALSE,1,76,TRUE,0,91,TRUE,1,94,FALSE,0,80,TRUE,1,94,0,0.0016,0,0.0001,0.0036,0,0.0004,0.0169,0,0.0196,0.0036,0.0025,0.0576,0.0001,0.0121,0,0,0.25,0.0576,0,0.04,0.1521,0.8281,0.6241,0.0081,0.8464,0.64,0.8649,0.9801,0.7569,0.8281,0.6724,0.273757143,0.026171429,0.521342857,26,81.25,23,71.88,5,62.5,7,87.5,5,62.5,6,75,15,93.75,8,50,89.53,81.12,92.5,90.88,93.62,89.69,89.38,9.37,17.65,18.62,5,28.38,18.62,-4.06,39.38,2,1,1,2,1,2,1,1,0,1,1,0,0,0,0,1,0,0,0,0,1,2,1,0,1,1,0,0,0,1,0,2,1,1,0,0,1,0,1,0,1.4,1,0.2,0.2,1,0.4,0.8,0.4,0.7,0.65,0.675,2.67,2.67,2.75,0.4,0.6,-0.6,-0.2,0.133333333,1,1,-2,2,0,1,2,2,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,63,"interesting t/f questions, and overall raised my curiosity level",1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,4,9,3,2,5,6,8,1,7,4,3,2,1 +236,R_5qfba3NnReh8vR9,67 - 73,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly disagree,Strongly agree,2,1,3,5,4,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,2,1,4,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,2,5,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly Agree,1,4,3,2,5,0,Somewhat agree,Disagree,Strongly agree,Disagree,Strongly agree,2,3,1,5,4,1,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,5,1,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly Agree,5,3,1,2,4,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,5,4,3,0,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,5,2,4,3,0,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,2,3,5,4,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,82,TRUE,75,TRUE,93,TRUE,76,TRUE,92,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,77,TRUE,91,TRUE,50,TRUE,100,TRUE,50,TRUE,89,TRUE,72,TRUE,64,TRUE,50,FALSE,80,TRUE,91,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,91,TRUE,100,25,3,3,1,-3,3,0,-2,3,-3,3,2,-2,3,-3,3,3,3,3,3,3,3,3,1,-3,3,0,1,-2,3,-2,3,1,2,-3,3,-3,3,1,1,1,1,1,1,3,3,3,1,-3,3,0,1,-3,3,-3,3,0,2,-2,3,-3,3,0,3,3,2,3,2,1,TRUE,0,100,TRUE,1,91,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,80,TRUE,0,50,TRUE,0,64,TRUE,1,72,TRUE,0,89,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,91,TRUE,0,77,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,92,TRUE,0,76,TRUE,1,93,TRUE,0,75,TRUE,0,82,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.0049,0,0,0,0.25,0.0064,0.64,0,0.25,0,0.0784,0.0081,0.25,0,0.0081,0,0.25,0.6724,0.5776,0.25,0.25,0.5929,0.7921,0.25,0.5625,1,1,1,0.8281,1,0.4096,0.390221429,0.124357143,0.656085714,25,78.13,16,50,4,50,5,62.5,2,25,5,62.5,12,75,4,25,81.97,73,77.75,84.88,92.25,85.56,78.38,28.13,31.97,23,15.25,59.88,29.75,10.56,53.38,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,2,2,2,2,2,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0.4,0.2,2,0,0.4,0,0.4,0.65,0.2,0.425,0.67,0,0.75,0,0,0.2,1.6,0.066666667,0,1,1,2,0.67,1,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,47 days,Female,Trade School (non-military),72,,1.625,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,2,5,8,9,7,6,4,1,3,3,2,4,1 +237,R_5ds5A7mqBfTU6tT,53 - 59,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,4,1,5,2,3,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,1,3,2,4,5,Somewhat Disagree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,4,5,2,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Agree,5,2,1,3,4,Agree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,3,5,4,2,1,1,Somewhat agree,Disagree,Somewhat agree,Disagree,Strongly agree,4,5,1,2,3,1,Disagree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,1,2,3,4,0,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,1,4,2,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Disagree,3,4,2,5,1,1,Neither agree nor disagree,Strongly disagree,Somewhat disagree,Disagree,Somewhat agree,5,1,4,3,2,1,Disagree,Disagree,Agree,Disagree,Strongly Agree,1,3,5,4,2,1,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,5,2,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,91,TRUE,100,FALSE,100,FALSE,50,TRUE,77,FALSE,100,TRUE,100,TRUE,100,TRUE,85,FALSE,85,FALSE,76,FALSE,78,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,57,TRUE,97,FALSE,100,FALSE,100,TRUE,97,TRUE,100,FALSE,96,TRUE,99,FALSE,100,TRUE,88,TRUE,79,FALSE,60,FALSE,96,TRUE,100,TRUE,69,FALSE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,3,1,1,-2,2,-2,1,-1,-2,3,0,3,1,0,1,3,2,2,2,-1,0,2,1,1,-2,1,-2,3,1,-2,-2,3,-1,3,0,1,0,2,1,1,5,3,3,2,3,-2,1,0,-3,-1,-2,1,1,-2,-2,2,-2,3,1,-2,-1,1,1,0,6,FALSE,1,91,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,85,FALSE,1,76,FALSE,1,78,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,57,TRUE,0,97,FALSE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,96,TRUE,1,99,FALSE,1,100,TRUE,1,88,TRUE,0,79,FALSE,1,60,FALSE,1,96,TRUE,1,100,TRUE,1,69,FALSE,0,100,0,0.0144,0,0,1,0,0.0001,0.7225,0,0,0,0,0.0225,0.0576,0.0529,0,0.0016,0.25,0.16,0,0.0009,0.25,0,1,0.3249,0.6241,0.0961,0.0081,0,0.9409,0.0016,0.0484,0.19865,0.150514286,0.246785714,25,78.13,26,81.25,7,87.5,6,75,5,62.5,8,100,14,87.5,12,75,88.44,76.12,90.38,95.12,92.12,90.62,86.25,-3.12,7.19,-11.38,15.38,32.62,-7.88,3.12,11.25,1,1,2,3,1,0,0,1,0,2,1,0,0,1,0,0,0,1,2,1,0,0,1,0,3,1,1,3,0,0,1,0,1,2,0,3,1,0,2,2,1.6,0.6,0.4,0.8,0.8,1,0.8,1.6,0.85,1.05,0.95,0.67,1,2,0.8,-0.4,-0.4,-0.8,0,0,0,-1,-1,-0.33,0,2,0,-1,1,0,0,-1,1,-2,2,-1,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,59,please provide progress bar,0.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,5,9,4,3,8,6,7,1,2,2,3,4,1 +238,R_6o4LQv42EL708UR,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,1,5,3,2,4,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,1,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,1,4,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,4,3,5,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,5,1,3,4,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,1,4,5,2,3,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Agree,Agree,Somewhat disagree,Strongly Agree,4,2,1,5,3,6,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,7,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,2,5,1,4,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,1,3,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,69,FALSE,100,TRUE,100,TRUE,55,FALSE,54,TRUE,100,TRUE,79,TRUE,56,TRUE,67,FALSE,100,TRUE,100,FALSE,100,TRUE,58,FALSE,100,FALSE,81,TRUE,100,TRUE,100,TRUE,62,FALSE,70,FALSE,100,TRUE,100,FALSE,59,FALSE,67,TRUE,100,TRUE,74,TRUE,61,TRUE,73,TRUE,57,FALSE,59,FALSE,62,FALSE,59,FALSE,100,15,1,3,2,-1,3,-2,1,1,1,1,1,1,1,1,1,0,1,-1,1,-1,2,3,2,-1,3,4,0,0,1,1,0,5,2,1,0,2,1,4,1,1,0,1,1,5,1,2,2,-1,3,4,-2,1,1,1,1,6,2,1,1,0,1,7,-1,-2,-1,-1,0,4,FALSE,1,100,FALSE,0,59,FALSE,1,62,FALSE,1,59,TRUE,1,57,TRUE,0,73,TRUE,1,61,TRUE,1,74,TRUE,1,100,FALSE,0,67,FALSE,1,59,TRUE,0,100,FALSE,0,100,FALSE,1,70,TRUE,1,62,TRUE,1,100,TRUE,0,100,FALSE,1,81,FALSE,1,100,TRUE,0,58,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,67,TRUE,0,56,TRUE,1,79,TRUE,0,100,FALSE,1,54,TRUE,0,55,TRUE,1,100,FALSE,0,100,FALSE,0,69,0.0676,0.0441,0,0.1521,0.4761,0.5329,0.1089,0.4489,0.3364,0,0,1,0,0.1681,0.1849,0.3481,0,0.1681,0.2116,0.3136,1,0.1444,0,0.09,1,1,1,0,0.1444,0.0361,0.3025,1,0.357678571,0.269457143,0.4459,15,46.88,19,59.38,5,62.5,2,25,6,75,6,75,10,62.5,9,56.25,78.81,79.88,81.75,76.75,76.88,80.94,76.69,-12.5,19.43,17.38,56.75,1.75,1.88,18.44,20.44,1,0,0,0,0,2,1,0,0,1,1,0,1,1,0,1,0,1,0,2,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,3,0,2,1,0.2,0.8,0.6,0.8,0.2,0,0.4,1.4,0.6,0.5,0.55,4.33,5.67,4.875,0,0.8,0.2,-0.6,0.333333333,0,-1,-3,1,-1.34,1,0,1,-2,2,1,-1,1,-1,1,-1,1,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),62,"too long to be unbelievable, lack common sense of psycology",0.25,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,3,8,5,6,9,4,2,1,7,3,4,2,1 +239,R_5wvQyrUh6tDd2Fw,67 - 73,American,,American,Male,Somewhat agree,Agree,Strongly agree,Agree,Somewhat agree,3,4,1,5,2,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,2,3,1,5,Agree,Agree,Agree,Somewhat Agree,Agree,1,2,3,5,4,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Disagree,4,5,2,3,1,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,1,2,4,5,3,Agree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,5,2,3,4,1,3,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,4,1,2,5,3,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,2,1,5,4,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,3,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,3,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,1,4,5,3,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,1,3,5,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,62,TRUE,75,FALSE,100,FALSE,98,FALSE,80,FALSE,86,TRUE,85,TRUE,73,FALSE,78,FALSE,84,FALSE,96,TRUE,96,TRUE,92,FALSE,89,FALSE,73,TRUE,98,TRUE,83,TRUE,97,FALSE,88,FALSE,100,FALSE,71,FALSE,83,TRUE,81,TRUE,91,TRUE,89,TRUE,94,FALSE,89,FALSE,84,FALSE,87,TRUE,91,TRUE,97,TRUE,92,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,3,2,1,1,-1,2,-1,1,2,2,2,1,2,1,-1,1,-2,-2,1,2,1,0,1,3,2,-1,2,-2,0,3,2,2,2,0,2,3,1,1,-1,-1,0,3,1,2,2,1,1,3,1,-1,1,0,1,3,2,1,2,1,2,3,0,-1,0,0,-1,4,FALSE,1,62,TRUE,1,75,FALSE,1,100,FALSE,1,98,FALSE,0,80,FALSE,1,86,TRUE,1,85,TRUE,1,73,FALSE,0,78,FALSE,0,84,FALSE,1,96,TRUE,0,96,TRUE,1,92,FALSE,1,89,FALSE,0,73,TRUE,1,98,TRUE,0,83,TRUE,0,97,FALSE,1,88,FALSE,1,100,FALSE,0,71,FALSE,0,83,TRUE,0,81,TRUE,1,91,TRUE,0,89,TRUE,1,94,FALSE,1,89,FALSE,1,84,FALSE,1,87,TRUE,1,91,TRUE,1,97,TRUE,1,92,0.0729,0.0036,0.0004,0.0225,0.0064,0.0196,0.0081,0.7056,0,0.6889,0.0081,0.0064,0.6084,0.0016,0.64,0.0625,0.6561,0.0004,0.0256,0.7921,0.5041,0.5329,0.0144,0.0121,0.6889,0.0121,0.0009,0.1444,0,0.9409,0.0169,0.9216,0.286392857,0.243721429,0.329064286,24,75,21,65.63,6,75,4,50,4,50,7,87.5,10,62.5,11,68.75,86.94,86.75,84,85.38,91.62,84.81,89.06,9.37,21.31,11.75,34,35.38,4.12,22.31,20.31,0,0,2,2,0,1,0,0,1,1,0,0,0,1,0,0,2,2,1,2,0,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,2,1,0.8,0.6,0.2,1.4,0.4,0.4,0.2,1,0.75,0.5,0.625,3,3,3.125,0.4,0.2,0,0.4,0.2,0,0,0,-1,0,-1,1,2,0,0,1,-1,-1,1,-2,2,1,10 cents,75 minutes,24 days,Male,University - Undergraduate,68,Great survey ,0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,9,2,4,8,5,3,6,1,7,2,4,3,1 +240,R_7trHlNVY8Ujs9mp,53 - 59,American,,American,Female,Agree,Agree,Agree,Strongly agree,Strongly agree,1,2,3,5,4,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,1,2,3,5,4,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,5,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Strongly disagree,3,5,4,2,1,Somewhat agree,Agree,Agree,Strongly Agree,Strongly Agree,5,3,4,2,1,8,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,1,2,3,5,9,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,1,4,3,2,5,9,Somewhat agree,Somewhat disagree,Disagree,Disagree,Strongly disagree,1,2,4,3,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,9,Agree,Somewhat disagree,Agree,Somewhat agree,Agree,5,4,2,3,1,9,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,5,2,1,4,9,Agree,Agree,Agree,Agree,Somewhat agree,2,5,3,1,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,75,FALSE,75,FALSE,75,TRUE,100,FALSE,100,FALSE,100,TRUE,75,TRUE,75,TRUE,100,TRUE,100,TRUE,75,TRUE,75,TRUE,75,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,100,TRUE,100,FALSE,75,FALSE,75,TRUE,65,FALSE,100,FALSE,75,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,3,3,1,0,2,1,2,2,1,2,0,3,1,1,1,2,-3,1,2,2,3,3,8,2,1,0,0,1,9,-1,1,-1,1,-1,9,1,-1,-2,-2,-3,9,3,2,2,3,3,9,2,-1,2,1,2,9,3,2,3,-3,3,9,2,2,2,2,1,9,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,FALSE,0,75,FALSE,1,75,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,75,TRUE,0,75,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,75,TRUE,1,75,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,FALSE,1,75,TRUE,0,65,FALSE,0,100,FALSE,0,75,TRUE,1,100,1,0,0.0625,0,0,0.0625,0,0.0625,0,0,1,0,1,0.5625,0.5625,0,0.5625,0.0625,0.0625,0,0,0.0625,1,0.5625,1,0.0625,0.5625,0,0,1,0.4225,1,0.343214286,0.276785714,0.409642857,16,50,19,59.38,4,50,4,50,6,75,5,62.5,11,68.75,8,50,89.53,84.38,86.25,93.75,93.75,92.19,86.88,-9.38,30.15,34.38,36.25,18.75,31.25,23.44,36.88,1,0,0,0,0,1,1,2,1,1,3,0,3,1,4,0,2,3,4,0,1,0,0,0,0,1,1,0,0,0,1,1,1,3,0,1,1,1,0,4,0.2,1.2,2.2,1.8,0.2,0.4,1.2,1.4,1.35,0.8,1.075,8.67,9,8.875,0,0.8,1,0.4,0.6,-1,0,0,0,-0.33,-1,0,0,-2,2,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),58,Fun survey. Wish I knew where it was leading to.,0.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,5,4,8,6,7,9,3,1,2,2,3,4,1 +241,R_32WfQVSCfaI1ZCN,67 - 73,American,,American,Male,Agree,Agree,Agree,Agree,Agree,5,3,2,1,4,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,4,5,1,3,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,4,5,2,3,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,5,3,1,2,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,1,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,1,2,3,5,3,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Agree,4,5,1,3,2,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,5,3,1,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,2,5,4,3,1,0,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,5,1,3,4,2,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,5,4,2,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,5,2,4,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,FALSE,50,TRUE,100,TRUE,76,FALSE,84,FALSE,72,TRUE,94,FALSE,96,TRUE,92,FALSE,94,TRUE,94,FALSE,88,FALSE,100,TRUE,90,TRUE,97,FALSE,94,TRUE,100,TRUE,74,TRUE,90,FALSE,88,TRUE,90,FALSE,88,TRUE,85,TRUE,82,TRUE,96,TRUE,98,FALSE,86,TRUE,90,FALSE,89,FALSE,93,TRUE,95,TRUE,90,26,2,2,2,2,2,-1,1,0,-1,-1,1,-1,2,0,2,-1,0,0,-1,-1,2,2,2,2,2,1,-1,1,1,0,-1,3,-1,-1,0,-1,2,2,-1,-1,-1,-1,-1,3,2,2,2,2,2,0,-1,1,1,0,-1,2,-1,-1,1,0,2,2,0,0,0,0,-1,2,TRUE,0,90,TRUE,1,95,FALSE,1,93,FALSE,1,89,TRUE,1,90,FALSE,1,86,TRUE,1,98,TRUE,1,96,TRUE,1,82,TRUE,1,85,FALSE,1,88,TRUE,0,90,FALSE,0,88,TRUE,0,90,TRUE,1,74,TRUE,1,100,FALSE,1,94,TRUE,0,97,TRUE,0,90,FALSE,1,100,FALSE,0,88,TRUE,1,94,FALSE,1,94,TRUE,1,92,FALSE,1,96,TRUE,1,94,FALSE,1,72,FALSE,1,84,TRUE,0,76,TRUE,1,100,FALSE,0,50,TRUE,1,99,0.0016,0.0036,0,0.0004,0.0001,0.0196,0.0064,0.0225,0,0.0036,0,0.7744,0.0324,0.0144,0.01,0.0025,0.0036,0.0121,0.0256,0.0016,0.7744,0.0676,0.81,0.81,0.0036,0.0784,0.25,0.81,0.0049,0.9409,0.5776,0.81,0.245221429,0.0644,0.426042857,26,81.25,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,89.19,80,89.38,93,94.38,89.06,89.31,9.37,17.31,5,26.88,30.5,6.88,7.81,26.81,0,0,0,0,0,0,0,1,1,0,2,0,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,2,0,1,0,0,1,0,0,1,0,0,0.4,1,0.4,0,0.4,0.6,0.4,0.45,0.35,0.4,2,1.33,1.875,0,0,0.4,0,0.133333333,1,1,0,1,0.67,-1,0,2,-1,1,0,0,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,72,"I liked this survey, much different from other surveys",0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,9,6,7,3,5,8,2,1,4,4,2,3,1 +242,R_7NyRGAJKCMGNlQ2,60 - 66,American,,American,Male,Agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,4,5,2,1,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,3,2,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,4,3,5,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,4,5,3,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,10,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,1,3,4,10,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,3,4,1,5,2,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,2,1,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,96,FALSE,100,TRUE,50,TRUE,50,FALSE,100,TRUE,91,FALSE,100,TRUE,74,TRUE,55,FALSE,100,TRUE,54,TRUE,100,TRUE,100,TRUE,66,TRUE,100,FALSE,100,TRUE,100,TRUE,81,FALSE,100,FALSE,50,TRUE,81,FALSE,50,TRUE,89,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,80,TRUE,57,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,0,0,2,-1,1,1,1,0,3,0,3,3,-3,-3,-3,-3,-3,-3,3,3,1,0,0,10,-2,1,1,1,0,10,3,0,3,3,-3,10,-3,-3,-3,-3,-3,10,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,96,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,91,FALSE,0,100,TRUE,1,74,TRUE,1,55,FALSE,1,100,TRUE,0,54,TRUE,1,100,TRUE,0,100,TRUE,1,66,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,81,FALSE,1,100,FALSE,0,50,TRUE,1,81,FALSE,1,50,TRUE,1,89,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,80,TRUE,1,57,TRUE,1,100,1,0,0,0.0081,0,0,0.0121,0.2025,0,0.0361,0.04,0,0.0676,0,0.25,0.0016,0.25,0.25,1,0.25,0.25,0.1156,0.6561,1,0,0,0.1849,0,0,1,1,0.2916,0.244932143,0.079278571,0.410585714,23,71.88,22,68.75,6,75,6,75,5,62.5,5,62.5,14,87.5,8,50,83.56,78,81.25,84.62,90.38,80.56,86.56,3.13,14.81,3,6.25,22.12,27.88,-6.94,36.56,1,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,0,0,2,1,1,1,1,0,3,0,3,3,3,3,3,3,3,3,0.8,0.2,0,0,1.4,0.8,2.4,3,0.25,1.9,1.075,10,5,7.5,-0.6,-0.6,-2.4,-3,-1.2,5,5,5,5,5,0,2,0,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),61,A lot of assumptions being made that in the middle of the test,1.375,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,7,3,4,8,9,5,2,1,6,3,4,2,1 +243,R_3RlbqGMWL80DcgM,53 - 59,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,2,4,3,5,1,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Agree,5,3,2,4,1,Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Agree,5,4,3,1,2,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Neither agree nor disagree,Agree,3,1,5,2,4,2,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,1,3,4,5,2,3,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Somewhat agree,Agree,4,2,3,1,5,1,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,5,1,4,2,3,1,Agree,Neither Agree nor Disagree,Strongly agree,Disagree,Agree,1,5,2,4,3,1,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,60,TRUE,90,TRUE,95,FALSE,78,FALSE,55,TRUE,98,FALSE,99,TRUE,97,FALSE,100,TRUE,97,FALSE,59,FALSE,88,FALSE,59,TRUE,98,FALSE,91,TRUE,100,FALSE,55,TRUE,58,TRUE,93,TRUE,87,FALSE,56,TRUE,86,TRUE,73,TRUE,92,FALSE,75,FALSE,88,FALSE,57,FALSE,57,FALSE,58,TRUE,100,TRUE,100,16,3,2,2,1,3,-1,-1,2,1,2,2,0,3,-2,2,-2,-1,1,-1,-1,2,2,2,0,2,1,-1,-1,2,1,1,2,2,0,2,0,2,3,-1,-1,0,-1,-1,3,3,2,2,1,2,1,-1,0,2,0,1,1,2,0,3,-2,2,1,-1,-1,0,0,0,1,TRUE,0,100,TRUE,1,100,FALSE,1,58,FALSE,1,57,FALSE,0,57,FALSE,1,88,FALSE,0,75,TRUE,1,92,TRUE,1,73,TRUE,1,86,FALSE,1,56,TRUE,0,87,TRUE,1,93,TRUE,0,58,FALSE,0,55,TRUE,1,100,FALSE,1,91,TRUE,0,98,FALSE,1,59,FALSE,1,88,FALSE,0,59,TRUE,1,97,FALSE,1,100,TRUE,1,97,FALSE,1,99,TRUE,1,98,FALSE,1,55,FALSE,1,78,TRUE,0,95,TRUE,1,90,FALSE,0,60,TRUE,1,95,0.0064,0.0004,0,0.5625,0.0025,0.0144,0.0009,0.0196,0.0144,0.0009,0.01,0.0049,0.0729,0.1936,0.3249,0,0,0.1849,0.0484,0.0001,0.3481,0.3025,0.1681,0.3364,0.0081,0.2025,0.36,1,0.1764,0.9604,0.9025,0.7569,0.229082143,0.060278571,0.397885714,16,50,22,68.75,6,75,5,62.5,4,50,7,87.5,11,68.75,11,68.75,81.06,64.38,84.75,88.88,86.25,82.94,79.19,-18.75,12.31,-10.62,22.25,38.88,-1.25,14.19,10.44,1,0,0,1,1,0,0,0,0,1,0,0,1,2,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,1,1,1,0.6,0.2,0.6,0.4,0.2,0.6,0,0.8,0.45,0.4,0.425,2,1,1.625,0.4,-0.4,0.6,-0.4,0.2,0,1,2,2,1,1,1,1,-2,2,1,-1,0,0,-1,1,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,55,nothing at this time,0.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,9,5,8,2,3,6,7,1,4,4,3,2,1 +244,R_3NP9W6V4IxAnjR7,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,2,4,5,1,3,Agree,Disagree,Agree,Disagree,Agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,Somewhat agree,1,5,4,3,2,0,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,1,4,2,3,5,0,Agree,Disagree,Agree,Disagree,Strongly Agree,1,3,4,2,5,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,0,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,2,4,5,3,1,0,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,3,2,4,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,2,4,5,3,FALSE,100,TRUE,100,FALSE,100,FALSE,70,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,75,TRUE,100,TRUE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,75,TRUE,100,FALSE,100,TRUE,100,FALSE,75,TRUE,100,FALSE,100,FALSE,75,FALSE,75,TRUE,75,TRUE,75,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-3,0,0,-3,-3,2,-3,1,2,-2,2,-2,2,1,1,2,0,-2,3,3,-3,0,1,0,-3,-3,1,-3,2,0,2,-2,2,-2,3,0,-1,-1,-1,0,-1,3,3,3,-3,0,-1,0,-3,-3,1,-3,1,0,1,-3,2,-3,3,0,0,0,0,0,-2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,75,FALSE,1,75,TRUE,1,75,TRUE,1,75,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0.09,0.0625,0.0625,0.0625,0.5625,0.25,0,0.25,0,0.0625,0,0,0.25,0.0625,1,0.099196429,0.010892857,0.1875,28,87.5,29,90.63,7,87.5,7,87.5,8,100,7,87.5,15,93.75,14,87.5,88.91,83.75,87.5,90.62,93.75,93.75,84.06,-3.13,-1.72,-3.75,0,-9.38,6.25,0,-3.44,0,0,0,0,1,0,0,1,0,1,0,0,0,0,1,2,2,3,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,1,1,1,1,2,0,0,0.2,0.4,0.2,1.6,0.2,0.2,0.8,0.8,0.6,0.5,0.55,0,0,0.75,0,0.2,-0.6,0.8,-0.133333333,0,0,0,0,0,-2,2,0,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,66,"This one was a bit of a challenge, but it really made me think!",0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,2,7,4,5,8,3,6,1,9,4,2,3,1 +245,R_3sjJd1nWoml3n0t,67 - 73,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,3,5,1,2,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,4,3,5,2,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,2,5,1,3,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,2,1,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,4,3,2,2,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Agree,1,3,2,5,4,2,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,3,1,5,4,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,3,5,4,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,4,1,6,Strongly agree,Disagree,Agree,Somewhat disagree,Strongly agree,3,5,2,1,4,6,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,2,4,1,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,5,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,85,TRUE,100,FALSE,100,TRUE,65,TRUE,100,TRUE,62,TRUE,100,FALSE,82,TRUE,100,FALSE,61,FALSE,88,TRUE,78,FALSE,64,TRUE,60,TRUE,100,FALSE,65,TRUE,100,TRUE,79,TRUE,66,TRUE,96,TRUE,100,TRUE,68,TRUE,100,TRUE,100,TRUE,62,TRUE,85,TRUE,57,FALSE,76,TRUE,100,FALSE,55,17,3,3,3,1,3,3,0,3,0,3,2,-1,3,0,3,-2,-1,1,-1,0,3,3,3,3,3,2,3,-2,3,-1,2,2,2,3,3,3,3,4,0,-1,-1,-1,-1,9,3,3,3,3,3,6,3,-2,2,-1,3,6,2,-1,3,0,3,7,0,0,1,1,-1,6,FALSE,1,55,TRUE,1,100,FALSE,1,76,TRUE,0,57,TRUE,1,85,TRUE,0,62,TRUE,1,100,TRUE,1,100,TRUE,1,68,TRUE,1,100,TRUE,0,96,TRUE,0,66,TRUE,1,79,TRUE,0,100,FALSE,0,65,TRUE,1,100,TRUE,0,60,FALSE,1,64,TRUE,0,78,FALSE,1,88,FALSE,0,61,TRUE,1,100,FALSE,1,82,TRUE,1,100,TRUE,0,62,TRUE,1,100,TRUE,0,65,FALSE,1,100,TRUE,0,100,TRUE,1,85,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.3844,0,0,0.0144,0,0.0225,0.0441,0.1024,0.9216,0.0225,0,0.0324,0.3249,0,0.3844,0.3721,0.4225,0.6084,1,0.36,0.4225,0,0.2025,0.0576,0.1296,1,0.4356,0.259442857,0.133514286,0.385371429,17,53.13,20,62.5,3,37.5,4,50,6,75,7,87.5,14,87.5,6,37.5,82.94,78.62,78.62,85.12,89.38,90.19,75.69,-9.37,20.44,41.12,28.62,10.12,1.88,2.69,38.19,0,0,0,2,0,0,2,0,1,1,0,4,0,3,0,2,0,2,0,1,0,0,0,2,0,0,2,1,1,0,0,0,0,0,0,2,1,0,2,1,0.4,0.8,1.4,1,0.4,0.8,0,1.2,0.9,0.6,0.75,2.67,6.33,5.25,0,0,1.4,-0.2,0.466666667,-4,-4,-3,3,-3.66,2,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,good survey but long,2,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,9,3,5,6,4,8,7,1,2,2,4,3,1 +246,R_3WDVJ4iJx1Pk9SF,60 - 66,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Somewhat disagree,5,2,1,3,4,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,Strongly Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,3,1,2,4,Disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Disagree,1,3,5,2,4,7,Strongly disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,4,1,3,2,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,4,1,2,5,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Strongly Agree,Strongly disagree,2,4,3,1,5,4,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,3,5,1,4,4,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,1,5,4,3,2,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,4,1,5,3,2,FALSE,97,TRUE,100,FALSE,100,TRUE,50,TRUE,64,FALSE,100,TRUE,100,TRUE,100,TRUE,50,FALSE,100,FALSE,79,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,67,FALSE,100,TRUE,100,TRUE,97,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,68,FALSE,97,FALSE,93,TRUE,100,TRUE,77,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,-1,-3,1,1,1,0,3,2,3,0,3,-2,-2,-2,0,-3,3,3,3,0,-2,4,-3,0,2,1,-1,7,3,3,3,1,3,5,-1,-1,1,1,-2,6,2,2,2,3,-3,4,-3,1,1,1,0,4,3,1,2,-3,3,4,-1,-1,-1,-1,1,3,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,64,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,100,FALSE,1,79,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,67,FALSE,1,100,TRUE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,68,FALSE,1,97,FALSE,1,93,TRUE,1,100,TRUE,1,77,TRUE,1,100,0,0,0,0,0,0,0,1,0,0.0009,0,0,0.25,0.0441,0.1296,0,0,0.25,0.0009,0,0,0.25,0.4489,0,0,0.4624,0.0529,0.0009,0,1,0.0049,1,0.174839286,0.119614286,0.230064286,30,93.75,25,78.13,4,50,8,100,6,75,7,87.5,14,87.5,11,68.75,90.28,67.62,94.62,99.25,99.62,89.88,90.69,15.62,12.15,17.62,-5.38,24.25,12.12,2.38,21.94,1,1,1,2,1,0,1,1,0,1,0,1,0,1,0,1,1,3,1,1,0,0,0,1,2,0,0,0,0,0,0,1,1,3,0,1,1,1,1,4,1.2,0.6,0.4,1.4,0.6,0,1,1.6,0.9,0.8,0.85,5.33,4,4.625,0.6,0.6,-0.6,-0.2,0.2,0,3,1,3,1.33,2,2,2,-2,2,-1,1,-1,1,-2,2,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,64,,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,3,5,7,6,8,9,4,1,2,4,3,2,1 +247,R_7k16stDRcdmYSEP,67 - 73,American,,American,Female,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,3,4,5,2,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,2,1,4,5,Strongly disagree,Disagree,Disagree,Disagree,Strongly disagree,5,1,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Agree,Somewhat agree,Agree,3,5,2,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,5,3,2,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,4,3,5,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,1,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,4,1,2,5,Strongly disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,5,1,3,2,4,FALSE,58,TRUE,77,TRUE,80,TRUE,50,TRUE,96,FALSE,88,TRUE,96,TRUE,100,TRUE,100,TRUE,90,FALSE,89,FALSE,50,TRUE,90,TRUE,95,TRUE,91,TRUE,100,FALSE,50,TRUE,68,TRUE,50,FALSE,95,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,72,TRUE,53,TRUE,68,FALSE,60,TRUE,78,TRUE,100,TRUE,67,TRUE,87,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,1,0,0,0,0,-1,1,-1,0,-1,1,0,2,-3,-2,-2,-2,-3,2,2,2,1,2,7,1,0,1,0,1,5,0,0,0,0,0,5,0,0,1,-1,0,7,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,-3,-2,-1,-1,-2,5,FALSE,1,58,TRUE,1,77,TRUE,0,80,TRUE,0,50,TRUE,1,96,FALSE,1,88,TRUE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,89,FALSE,1,50,TRUE,1,90,TRUE,0,95,TRUE,1,91,TRUE,1,100,FALSE,1,50,TRUE,0,68,TRUE,0,50,FALSE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,72,TRUE,1,53,TRUE,0,68,FALSE,1,60,TRUE,0,78,TRUE,1,100,TRUE,1,67,TRUE,1,87,0,0.2209,0,0.0016,0.0169,0.0144,0,0.01,0.0025,0,0,0.01,0,0.0121,0.0016,0.0529,0,0.25,0.16,0.0784,0.25,0.0081,0.25,0.9025,0.25,0.4624,0.1089,0.1764,0.64,0.4624,0.6084,0.25,0.177782143,0.026457143,0.329107143,21,65.63,25,78.13,5,62.5,7,87.5,6,75,7,87.5,16,100,9,56.25,79.62,74,79.88,79,85.62,87.31,71.94,-12.5,1.49,11.5,-7.62,4,-1.88,-12.69,15.69,2,2,1,1,2,1,0,2,1,2,0,1,1,0,2,3,2,3,1,3,0,0,1,0,0,0,0,1,1,1,0,1,1,0,2,0,0,1,1,1,1.6,1.2,0.8,2.4,0.2,0.6,0.8,0.6,1.5,0.55,1.025,5.67,5,5.5,1.4,0.6,0,1.8,0.666666667,2,0,0,2,0.67,0,2,1,-1,1,-1,1,0,0,-2,2,1,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,69,"very unusual survey, but enjoyed it",1,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,4,7,3,9,5,8,2,1,6,2,4,3,1 +248,R_60VP0Bh1vQF50Tn,46 - 52,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Somewhat agree,Strongly agree,1,3,2,5,4,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,5,4,1,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Somewhat agree,Strongly Agree,3,2,5,4,1,1,Disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,1,4,2,5,3,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,2,3,4,5,1,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Somewhat agree,Agree,1,5,4,2,3,1,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,4,1,5,2,3,1,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,4,3,2,5,1,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,4,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,50,TRUE,80,TRUE,80,TRUE,90,FALSE,80,TRUE,85,FALSE,70,TRUE,80,FALSE,50,TRUE,100,TRUE,75,FALSE,50,FALSE,50,TRUE,70,FALSE,50,TRUE,70,TRUE,50,FALSE,50,TRUE,90,TRUE,89,FALSE,50,TRUE,79,TRUE,50,TRUE,85,TRUE,80,FALSE,50,TRUE,50,FALSE,50,TRUE,90,TRUE,50,FALSE,50,20,1,2,2,1,3,-2,0,2,0,1,2,1,2,-1,2,1,1,2,1,-1,2,2,2,1,3,1,-2,-1,2,-1,1,1,2,1,2,0,2,1,1,1,1,1,-1,1,2,2,2,1,2,1,-2,0,2,-1,1,1,2,1,2,-1,2,1,0,1,1,1,-1,2,FALSE,1,50,TRUE,1,50,TRUE,0,90,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,80,TRUE,1,85,TRUE,1,50,TRUE,1,79,FALSE,1,50,TRUE,0,89,TRUE,1,90,FALSE,1,50,TRUE,1,50,TRUE,1,70,FALSE,1,50,TRUE,0,70,FALSE,1,50,FALSE,1,50,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,1,80,FALSE,1,70,TRUE,1,85,FALSE,1,80,TRUE,0,90,TRUE,0,80,TRUE,1,80,TRUE,1,50,TRUE,1,90,0.0225,0.0225,0.09,0.04,0.01,0.25,0.04,0.0441,0.25,0,0.04,0.01,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.09,0.0625,0.25,0.25,0.25,0.25,0.04,0.25,0.25,0.81,0.49,0.64,0.7921,0.263525,0.15315,0.3739,20,62.5,27,84.38,8,100,7,87.5,7,87.5,5,62.5,16,100,11,68.75,68.22,53.75,66.88,73,79.25,72.75,63.69,-21.88,-16.16,-46.25,-20.62,-14.5,16.75,-27.25,-5.06,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0.2,0.4,0.2,0.2,0.4,0.2,0,0.4,0.25,0.25,0.25,1,1,1.125,-0.2,0.2,0.2,-0.2,0.066666667,0,0,0,-1,0,1,1,0,-1,1,1,-1,0,0,-1,1,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,51,,0.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,2,6,5,4,7,3,8,1,9,4,3,2,1 +249,R_5QK8rCRX1n6Hy71,39 - 45,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,5,1,2,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,2,3,4,1,Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,1,3,5,2,Somewhat agree,Somewhat agree,Agree,Disagree,Somewhat disagree,2,5,1,4,3,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,3,4,2,5,1,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,5,3,1,2,1,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,3,1,2,5,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,1,4,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,1,2,3,5,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,1,4,2,Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,3,4,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,1,5,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,90,TRUE,94,FALSE,65,FALSE,75,FALSE,80,FALSE,100,TRUE,90,TRUE,100,TRUE,91,TRUE,95,FALSE,80,TRUE,90,TRUE,100,TRUE,94,FALSE,51,TRUE,100,FALSE,70,TRUE,96,TRUE,87,FALSE,100,FALSE,81,TRUE,90,FALSE,100,TRUE,70,TRUE,76,TRUE,94,FALSE,63,FALSE,100,FALSE,59,TRUE,91,TRUE,100,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,3,2,-3,3,-3,2,2,1,3,-1,3,1,1,2,-2,-1,2,3,3,0,3,2,3,-3,3,-3,2,1,2,1,3,0,3,1,1,0,1,-1,-1,3,2,3,3,2,3,1,2,-3,3,-3,3,2,2,1,3,-1,3,2,1,1,1,0,-1,3,FALSE,1,90,TRUE,1,94,FALSE,1,65,FALSE,1,75,FALSE,0,80,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,91,TRUE,1,95,FALSE,1,80,TRUE,0,90,TRUE,1,100,TRUE,0,94,FALSE,0,51,TRUE,1,100,FALSE,1,70,TRUE,0,96,TRUE,0,87,FALSE,1,100,FALSE,0,81,TRUE,1,90,FALSE,1,100,TRUE,1,70,TRUE,0,76,TRUE,1,94,FALSE,1,63,FALSE,1,100,FALSE,1,59,TRUE,1,91,TRUE,1,100,TRUE,1,100,0,0.0036,0,0.01,0,0,0.09,0.0025,0,0.01,0.0081,0,0.0081,0.04,0.64,0.0036,0,0.0625,0,0.5776,0.6561,0.2601,0.7569,0.8836,0.09,0.1369,0,0.01,0.1225,0.9216,0.1681,0.81,0.223507143,0.061771429,0.385242857,22,68.75,24,75,6,75,6,75,5,62.5,7,87.5,13,81.25,11,68.75,86.62,80.12,86.25,90.62,89.5,89.19,84.06,-6.25,11.62,5.12,11.25,28.12,2,7.94,15.31,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,2,0,0.2,0.2,0.2,0.6,0.2,0.2,0,0.6,0.3,0.25,0.275,1.33,1.67,1.875,0,0,0.2,0,0.066666667,1,-1,-1,0,-0.34,1,1,2,-2,2,0,0,-2,2,-1,1,-1,5 cents,100 minutes,24 days,Male,University - Undergraduate,45,nothing to add,1,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,7,3,6,2,8,4,5,1,9,2,4,3,1 +250,R_5duLDrZ0Xpzbyop,53 - 59,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,2,1,3,5,4,Disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,4,5,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,1,2,3,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,5,2,3,Somewhat agree,Strongly Agree,Agree,Disagree,Agree,3,1,2,4,5,5,Neither agree nor disagree,Disagree,Agree,Somewhat agree,Somewhat agree,4,3,2,5,1,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,2,1,5,4,Agree,Somewhat agree,Agree,Agree,Agree,1,2,4,3,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,3,Strongly disagree,Strongly disagree,Neither agree nor disagree,Agree,Disagree,2,4,3,1,5,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,1,4,5,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,2,1,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,82,TRUE,97,FALSE,60,FALSE,58,TRUE,100,FALSE,55,TRUE,82,TRUE,76,TRUE,53,TRUE,95,FALSE,53,TRUE,89,FALSE,56,FALSE,94,TRUE,68,TRUE,100,TRUE,59,TRUE,89,TRUE,60,TRUE,59,TRUE,73,TRUE,96,FALSE,100,TRUE,100,TRUE,94,TRUE,97,FALSE,53,TRUE,71,TRUE,68,TRUE,76,FALSE,60,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,0,2,-2,-2,1,1,-1,1,0,2,0,1,1,-1,1,1,0,1,3,2,-2,2,5,0,-2,2,1,1,5,1,0,1,1,1,4,2,1,2,2,2,3,2,2,2,0,0,3,-3,-3,0,2,-2,4,1,1,1,0,1,2,1,0,1,1,0,1,TRUE,0,82,TRUE,1,97,FALSE,1,60,FALSE,1,58,TRUE,1,100,FALSE,1,55,TRUE,1,82,TRUE,1,76,TRUE,1,53,TRUE,1,95,FALSE,1,53,TRUE,0,89,FALSE,0,56,FALSE,1,94,TRUE,1,68,TRUE,1,100,TRUE,0,59,TRUE,0,89,TRUE,0,60,TRUE,0,59,TRUE,1,73,TRUE,1,96,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,1,97,FALSE,1,53,TRUE,0,71,TRUE,0,68,TRUE,1,76,FALSE,0,60,TRUE,1,100,0.0576,0.0009,0,0.0324,0,0.2025,0,0.0025,0.3481,0.0016,0.0576,0.3136,0.2209,0.2209,0,0.0009,0,0.1764,0.5041,0.8836,0.0729,0.1024,0.36,0.0036,0.3481,0.2209,0.36,0.6724,0.16,0.7921,0.4624,0.7921,0.259985714,0.110357143,0.409614286,22,68.75,21,65.63,6,75,5,62.5,5,62.5,5,62.5,14,87.5,7,43.75,77.28,62.75,76.38,91.12,78.88,83.06,71.5,3.12,11.65,-12.25,13.88,28.62,16.38,-4.44,27.75,1,0,0,2,0,2,0,1,0,2,0,0,1,1,0,1,2,1,1,2,0,1,0,0,2,1,1,1,1,1,0,1,1,0,0,0,1,0,0,0,0.6,1,0.4,1.4,0.6,1,0.4,0.2,0.85,0.55,0.7,4.67,3,3.375,0,0,0,1.2,0,2,1,2,2,1.67,0,1,0,-1,1,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,57,Interesting survey to complete,0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,4,5,9,8,7,6,2,1,3,2,4,3,1 +251,R_1KwqwJDsh0DTUJ2,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,5,3,1,2,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,1,3,5,2,4,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly Agree,4,1,5,3,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Strongly disagree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,3,4,5,2,10,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,4,5,1,3,2,0,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,4,1,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Agree,Somewhat agree,Strongly Agree,5,1,3,2,4,9,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,3,4,5,2,1,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly agree,4,1,5,3,2,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,4,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,77,TRUE,100,TRUE,90,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,75,FALSE,52,TRUE,89,TRUE,59,FALSE,74,TRUE,87,TRUE,89,FALSE,74,TRUE,100,FALSE,70,FALSE,100,FALSE,76,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,53,FALSE,65,FALSE,62,FALSE,100,28,3,3,2,1,3,-1,1,1,3,1,1,0,2,-1,3,-1,-1,-1,1,-3,3,3,2,2,3,10,0,1,3,2,0,10,2,0,0,0,2,0,0,0,0,0,0,2,3,2,2,1,3,5,-1,1,1,3,1,9,1,0,1,1,3,6,0,1,0,1,1,6,FALSE,1,100,FALSE,0,62,FALSE,1,65,FALSE,1,53,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,76,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,1,74,TRUE,1,89,TRUE,1,87,FALSE,1,74,TRUE,0,59,TRUE,0,89,FALSE,1,52,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,77,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.01,0.0169,0,0,0,0,0.5776,0.2304,0,0,0,1,0,0,0.3844,0,0.2209,0.0529,0,0.5625,0.0121,0.7921,0.0676,0.0676,1,1,0,0.1225,0.3481,1,0.09,0.268882143,0.172378571,0.365385714,28,87.5,23,71.88,3,37.5,6,75,6,75,8,100,11,68.75,12,75,87.25,86.62,93.62,87.38,81.38,92.44,82.06,15.62,15.37,49.12,18.62,12.38,-18.62,23.69,7.06,0,0,0,1,0,1,0,2,1,1,1,0,2,1,1,1,1,1,1,3,0,1,0,0,0,0,0,0,0,0,0,0,1,2,0,1,2,1,0,4,0.2,1,1,1.4,0.2,0,0.6,1.6,0.9,0.6,0.75,6.67,6.67,6,0,1,0.4,-0.2,0.466666667,5,1,-6,-4,0,1,1,2,-2,2,0,0,1,-1,0,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),44,It was normal,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,8,6,5,7,4,3,2,1,9,3,2,4,1 +252,R_7pAnaXoEVkzxNb7,60 - 66,American,,American,Male,Strongly agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,2,5,3,4,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,5,2,4,1,Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,3,5,4,2,1,Agree,Agree,Agree,Agree,Agree,4,1,5,3,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,2,3,5,1,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,5,4,2,1,1,Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,5,4,1,3,2,6,Somewhat agree,Neither agree nor disagree,Agree,Agree,Agree,2,1,4,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Agree,Agree,5,3,2,1,4,2,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,3,4,5,2,1,4,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,1,5,4,3,2,3,Strongly Agree,Agree,Strongly Agree,Agree,Agree,1,5,4,3,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,58,TRUE,84,TRUE,87,FALSE,56,FALSE,52,FALSE,50,TRUE,94,TRUE,57,TRUE,50,TRUE,83,FALSE,50,TRUE,95,TRUE,90,FALSE,50,TRUE,55,TRUE,90,FALSE,66,TRUE,100,FALSE,52,FALSE,56,TRUE,100,TRUE,93,FALSE,79,TRUE,65,FALSE,64,TRUE,96,TRUE,84,FALSE,100,TRUE,91,TRUE,100,TRUE,83,FALSE,50,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,1,0,0,-3,3,-3,0,2,0,2,-1,2,2,2,2,2,2,2,2,2,1,1,1,0,-3,2,-3,1,1,2,0,2,-2,2,6,1,0,2,2,2,1,3,2,2,2,2,2,-1,-3,2,-3,0,4,2,1,2,-1,2,3,3,2,3,2,2,4,TRUE,0,58,TRUE,1,84,TRUE,0,87,FALSE,1,56,FALSE,0,52,FALSE,1,50,TRUE,1,94,TRUE,1,57,TRUE,1,50,TRUE,1,83,FALSE,1,50,TRUE,0,95,TRUE,1,90,FALSE,1,50,TRUE,1,55,TRUE,1,90,FALSE,1,66,TRUE,0,100,FALSE,1,52,FALSE,1,56,TRUE,1,100,TRUE,1,93,FALSE,1,79,TRUE,1,65,FALSE,1,64,TRUE,1,96,TRUE,0,84,FALSE,1,100,TRUE,0,91,TRUE,1,100,TRUE,1,83,FALSE,0,50,0.1849,0.0016,0.01,0.0036,0.25,0.25,0.1225,0.0289,0.1936,0.0049,0,0.01,0.25,0.25,0.2704,0.0256,0.0441,0.1936,0,0.1296,0,0.2025,0.2304,0.25,0.1156,0.7056,0.0289,0.3364,0.7569,1,0.8281,0.9025,0.263575,0.135257143,0.391892857,18,56.25,24,75,7,87.5,5,62.5,6,75,6,75,14,87.5,10,62.5,74.38,64.25,72.25,79.75,81.25,77.62,71.12,-18.75,-0.62,-23.25,9.75,4.75,6.25,-9.88,8.62,1,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,2,0,0,0,0,0,1,1,2,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0.6,0.4,0.2,0.6,0.8,0.4,0.2,0.4,0.45,0.45,0.45,2.67,3,2.75,-0.2,0,0,0.2,-0.066666667,-1,-3,3,-3,-0.33,1,1,1,-2,2,1,-1,0,0,-2,2,0,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),63,Very interesting ,0.75,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,5,9,7,4,8,6,3,1,2,4,3,2,1 +253,R_3tAvwSUORjliA9U,53 - 59,,Canadian,Canadian,Male,Somewhat disagree,Somewhat agree,Agree,Agree,Disagree,4,1,3,2,5,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,4,3,1,2,Agree,Agree,Agree,Agree,Agree,1,2,3,5,4,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Somewhat agree,Agree,Agree,Disagree,5,2,3,1,4,0,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,5,4,3,1,2,1,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,2,3,5,7,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat disagree,1,2,5,3,4,1,Disagree,Disagree,Somewhat agree,Disagree,Disagree,3,5,2,4,1,0,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,2,5,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,93,FALSE,100,TRUE,91,FALSE,96,TRUE,67,FALSE,90,FALSE,87,TRUE,100,TRUE,95,FALSE,100,TRUE,100,FALSE,100,FALSE,72,TRUE,100,TRUE,100,TRUE,100,FALSE,79,FALSE,72,TRUE,100,TRUE,100,TRUE,100,FALSE,76,FALSE,76,TRUE,84,TRUE,100,TRUE,100,FALSE,75,FALSE,85,FALSE,77,TRUE,89,FALSE,70,TRUE,82,24,-1,1,2,2,-2,-2,-2,1,0,-1,2,2,2,2,2,2,1,2,2,-1,-2,1,2,2,-2,4,-1,-1,2,1,-1,0,2,1,1,1,1,1,-1,1,1,1,-2,7,-1,1,2,2,-1,2,-2,-2,1,-2,-2,1,2,2,0,0,0,0,1,1,2,2,2,1,TRUE,0,82,FALSE,0,70,TRUE,0,89,FALSE,1,77,FALSE,0,85,FALSE,1,75,TRUE,1,100,TRUE,1,100,TRUE,1,84,FALSE,0,76,FALSE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,72,FALSE,0,79,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,72,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,100,FALSE,0,87,FALSE,1,90,TRUE,0,67,FALSE,1,96,TRUE,1,91,FALSE,0,100,FALSE,0,93,0,0.7569,0.6241,0,0.8649,0.0625,0.0025,0.5776,0.0784,0,0.0081,0,0.0256,0.0576,0.7225,0.49,0,0.0529,0.4489,1,1,0.5184,1,1,1,0.01,1,0.6724,0.7921,1,0.0016,1,0.478071429,0.210185714,0.745957143,24,75,14,43.75,4,50,4,50,2,25,4,50,7,43.75,7,43.75,89.25,83.62,93.62,93.12,86.62,89.5,89,31.25,45.5,33.62,43.62,68.12,36.62,45.75,45.25,1,0,0,0,0,1,1,1,1,0,0,1,1,1,1,3,0,1,1,1,0,0,0,0,1,0,0,0,2,1,0,0,2,2,2,1,0,0,0,3,0.2,0.8,0.8,1.2,0.2,0.6,1.2,0.8,0.75,0.7,0.725,1.67,1,2,0,0.2,-0.4,0.4,-0.066666667,2,-1,1,6,0.67,1,0,0,-1,1,0,0,0,0,0,0,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,56,,0.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,5,3,4,2,7,8,9,1,6,2,3,4,1 +254,R_5oSF57Z2IEBUbXS,60 - 66,American,Canadian,Both,Female,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,3,2,4,1,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,1,4,5,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,4,3,1,2,Somewhat agree,Agree,Agree,Strongly Agree,Somewhat disagree,4,1,3,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,3,2,5,1,1,Disagree,Disagree,Strongly agree,Disagree,Somewhat agree,2,5,3,1,4,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,4,5,3,2,0,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,4,2,3,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,5,4,3,2,1,0,Disagree,Strongly disagree,Strongly agree,Disagree,Agree,1,5,3,2,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,3,5,2,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,3,4,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,67,TRUE,96,TRUE,100,TRUE,68,TRUE,100,TRUE,92,TRUE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,88,TRUE,99,TRUE,90,FALSE,79,FALSE,76,TRUE,100,FALSE,75,TRUE,100,TRUE,100,FALSE,100,TRUE,93,TRUE,100,FALSE,100,FALSE,74,TRUE,100,TRUE,96,FALSE,78,TRUE,78,TRUE,92,TRUE,96,FALSE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,-2,3,-1,1,3,-2,1,3,3,3,1,3,1,2,2,3,-1,3,3,3,-2,3,1,-2,-2,3,-2,1,4,3,3,3,2,3,0,3,3,3,1,-1,5,3,3,3,-2,3,0,-2,-3,3,-2,2,0,3,3,3,1,3,0,3,3,3,3,3,1,TRUE,0,67,TRUE,1,96,TRUE,0,100,TRUE,0,68,TRUE,1,100,TRUE,0,92,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,TRUE,0,88,TRUE,0,99,TRUE,1,90,FALSE,1,79,FALSE,0,76,TRUE,1,100,FALSE,1,75,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,0,74,TRUE,0,100,TRUE,1,96,FALSE,1,78,TRUE,0,78,TRUE,0,92,TRUE,1,96,FALSE,0,100,TRUE,1,100,0,0.0016,0,0,0,0.8464,0.5476,0,0,0,0.0016,0.01,0.0625,0.7744,0,0.0016,0,0.4624,0.6084,1,0.0049,0.5776,1,0.0441,0.0625,0.0484,1,0.4489,1,1,0.8464,0.9801,0.404564286,0.193321429,0.615807143,24,75,18,56.25,3,37.5,6,75,5,62.5,4,50,13,81.25,5,31.25,91,85.12,92.75,92.75,93.38,93.5,88.5,18.75,34.75,47.62,17.75,30.25,43.38,12.25,57.25,0,0,0,0,0,1,3,0,0,0,0,0,0,1,0,2,1,1,2,0,0,0,0,0,0,1,4,0,0,1,0,0,0,0,0,2,1,1,0,4,0,0.8,0.2,1.2,0,1.2,0,1.6,0.55,0.7,0.625,1.67,0,1.375,0,-0.4,0.2,-0.4,-0.066666667,1,4,0,4,1.67,2,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,60,Very different and interesting!,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,3,7,4,5,2,6,8,1,9,4,3,2,1 +255,R_3oS05I58MGLFdJc,60 - 66,American,,American,Male,Strongly agree,Strongly agree,Agree,Agree,Agree,1,4,3,5,2,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,5,4,3,2,1,Somewhat Agree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,5,3,4,2,Disagree,Somewhat disagree,Somewhat agree,Disagree,Disagree,2,5,4,3,1,Strongly Agree,Strongly Agree,Agree,Agree,Agree,1,4,2,3,5,0,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,4,5,1,2,3,0,Agree,Disagree,Strongly Agree,Agree,Strongly Agree,1,4,5,3,2,1,Disagree,Disagree,Disagree,Disagree,Disagree,2,1,5,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Agree,Agree,3,1,2,5,4,0,Agree,Strongly disagree,Agree,Strongly disagree,Agree,3,1,5,2,4,0,Somewhat Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,5,3,2,4,1,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Somewhat agree,2,3,4,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,80,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,100,FALSE,75,TRUE,75,TRUE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,100,FALSE,100,TRUE,50,FALSE,50,TRUE,75,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,2,2,1,-3,2,-3,3,1,-2,3,-1,3,-2,-1,1,-2,-2,3,3,2,2,2,0,1,-3,2,-3,2,0,2,-2,3,2,3,1,-2,-2,-2,-2,-2,5,3,3,2,2,2,0,2,-3,2,-3,2,0,1,-2,3,-2,3,1,0,0,2,2,1,5,TRUE,0,100,TRUE,1,100,FALSE,1,80,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,100,TRUE,1,50,FALSE,1,50,TRUE,1,75,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,1,0.0625,0,0,0.25,0,0,0,0.64,0,0,0.25,0.25,1,0.25,1,0.0625,0.25,0.0625,0.25,0.25,0.25,1,0.04,1,1,1,0.352410714,0.175178571,0.529642857,20,62.5,19,59.38,3,37.5,5,62.5,5,62.5,6,75,14,87.5,5,31.25,83.91,69.38,87.5,84.38,94.38,90.62,77.19,3.12,24.53,31.88,25,21.88,19.38,3.12,45.94,0,0,0,0,0,0,0,0,0,1,1,0,0,3,0,0,1,3,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,2,1,1,4,3,0,0.2,0.8,0.8,0,0.4,0.2,2.2,0.45,0.7,0.575,0.33,0.33,1.5,0,-0.2,0.6,-1.4,0.133333333,0,0,0,0,0,0,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,Survey was interesting and thought provoking,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,8,3,2,7,5,9,4,1,6,4,2,3,1 +256,R_3smjKTwBjkxUhgg,60 - 66,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,2,3,5,1,4,Strongly agree,Somewhat agree,Strongly agree,Disagree,Agree,4,2,1,3,5,Strongly Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,4,2,5,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Agree,2,1,3,4,5,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,3,4,5,1,1,Strongly agree,Agree,Strongly agree,Disagree,Agree,3,2,4,1,5,1,Strongly Agree,Strongly Disagree,Strongly Agree,Agree,Strongly Agree,3,5,4,1,2,1,Agree,Agree,Agree,Agree,Somewhat agree,3,2,1,5,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,1,5,4,2,3,2,Agree,Disagree,Agree,Disagree,Agree,1,5,3,4,2,2,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,3,4,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,Agree,1,3,2,4,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,76,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,96,FALSE,50,TRUE,100,FALSE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,77,FALSE,98,FALSE,54,TRUE,53,FALSE,76,TRUE,97,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,57,TRUE,59,TRUE,100,FALSE,53,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,2,3,3,1,3,-2,2,3,-3,3,0,3,1,3,2,3,2,3,3,2,2,3,1,3,2,3,-2,2,1,3,-3,3,2,3,1,2,2,2,2,1,1,3,3,2,3,3,2,2,-2,2,-2,2,2,3,-3,3,-3,3,2,0,0,2,2,2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,FALSE,0,76,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,96,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,77,FALSE,1,98,FALSE,1,54,TRUE,0,53,FALSE,0,76,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,100,FALSE,1,57,TRUE,0,59,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,1,0,0,0,0.25,0,0.0016,0.2809,0.0009,0,0.25,0,0.25,0.5776,0,0,0.25,0.1849,0,0.5776,0.25,0.2116,0,0.5929,1,0.2809,0,0,0.0004,0.3481,1,0.225264286,0.132928571,0.3176,25,78.13,21,65.63,5,62.5,3,37.5,7,87.5,6,75,11,68.75,10,62.5,82.69,69.62,73.5,98.88,88.75,87.38,78,12.5,17.06,7.12,36,11.38,13.75,18.63,15.5,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,1,1,0,1,1,0,0,0,1,0,1,3,1,0,0,0,0,0,3,0,1,3,0,1,0,0,0.2,0.4,0.8,0.2,1,0.6,1,0.35,0.7,0.525,1,2,1.625,-0.2,-0.8,-0.2,-0.2,-0.4,-1,-1,-1,-2,-1,2,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,63,I would love to know the answers please.,2,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,2,8,6,7,4,3,5,1,9,4,2,3,1 +257,R_3Ny3Vz7ahIARXLP,67 - 73,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,Agree,Disagree,Agree,Disagree,Agree,3,5,4,2,1,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,4,5,1,2,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,3,4,1,5,2,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,0,Agree,Disagree,Agree,Disagree,Agree,1,5,3,4,2,0,Somewhat Agree,Agree,Agree,Disagree,Agree,3,4,2,5,1,0,Disagree,Disagree,Disagree,Disagree,Disagree,2,5,1,4,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,0,Agree,Disagree,Agree,Disagree,Agree,3,5,4,2,1,0,Somewhat Agree,Agree,Agree,Agree,Agree,3,4,1,2,5,0,Agree,Agree,Agree,Agree,Somewhat disagree,4,2,3,5,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,51,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,24,2,2,2,2,2,2,-2,2,-2,2,1,2,2,0,2,2,1,2,2,-1,2,2,2,2,2,0,2,-2,2,-2,2,0,1,2,2,-2,2,0,-2,-2,-2,-2,-2,10,2,2,2,2,2,0,2,-2,2,-2,2,0,1,2,2,2,2,0,2,2,2,2,-1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,51,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0.25,0,0.25,0,0,0,0.25,1,0,0,1,0.25,1,1,0,0.25,0.2601,0.25,0.25,0.25,0,1,1,1,1,1,0.411075,0.232142857,0.590007143,24,75,19,59.38,4,50,6,75,5,62.5,4,50,13,81.25,6,37.5,84.41,68.88,87.5,93.75,87.5,90.62,78.19,15.62,25.03,18.88,12.5,31.25,37.5,9.37,40.69,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,3,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0.4,3.2,0,0,0.4,0.2,0.9,0.15,0.525,0,0,1.25,0,0,0,3,0,0,0,0,10,0,1,1,1,-2,2,1,-1,-1,1,-1,1,1,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),71,none,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,02REV,7,6,3,9,5,8,2,1,4,3,2,4,1 +258,R_5QzhtHCfdj5aZJi,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,1,3,4,Disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,2,3,1,5,4,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,5,4,1,3,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Strongly disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Somewhat agree,Somewhat agree,Agree,Disagree,Strongly disagree,3,2,5,4,1,10,Agree,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly disagree,4,1,2,3,5,10,Somewhat Disagree,Disagree,Disagree,Agree,Somewhat Disagree,4,3,1,5,2,7,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,5,2,3,4,5,Disagree,Disagree,Somewhat agree,Somewhat agree,Disagree,5,4,1,2,3,FALSE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,100,FALSE,100,TRUE,95,TRUE,100,TRUE,90,TRUE,95,FALSE,100,FALSE,100,TRUE,95,TRUE,100,TRUE,85,TRUE,100,FALSE,95,FALSE,95,TRUE,85,FALSE,100,FALSE,55,TRUE,80,FALSE,100,TRUE,95,TRUE,60,TRUE,60,FALSE,100,FALSE,97,TRUE,100,TRUE,100,FALSE,100,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,-2,-2,3,-2,0,2,3,3,3,2,1,-1,2,1,-3,1,1,2,-2,-3,10,2,0,1,3,-3,10,-1,-2,-2,2,-1,10,-3,-3,0,-3,-3,7,3,3,3,3,3,1,0,0,0,0,0,1,3,3,3,3,2,0,-2,-2,1,1,-2,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,95,FALSE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,100,TRUE,1,85,TRUE,1,100,FALSE,1,95,FALSE,1,95,TRUE,0,85,FALSE,1,100,FALSE,0,55,TRUE,1,80,FALSE,1,100,TRUE,1,95,TRUE,0,60,TRUE,1,60,FALSE,1,100,FALSE,1,97,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.16,0,0.0025,0,0,0.0025,0.0025,0,0.04,0,0.0025,0.01,0,0,0,0,0.2025,0.0009,0.36,0.3025,0.0225,0.7225,1,0.0025,0,1,0,1,0.0025,1,0,0.202621429,0.018571429,0.386671429,28,87.5,25,78.13,6,75,6,75,6,75,7,87.5,14,87.5,11,68.75,91.78,89.38,93.12,85.62,99,90.62,92.94,9.37,13.65,14.38,18.12,10.62,11.5,3.12,24.19,2,2,1,5,6,4,2,2,5,3,3,5,5,1,3,4,2,2,4,0,0,0,0,0,0,2,2,3,2,0,1,0,0,0,0,3,1,1,0,1,3.2,3.2,3.4,2.4,0,1.8,0.2,1.2,3.05,0.8,1.925,10,0.67,5.5,3.2,1.4,3.2,1.2,2.6,9,9,10,2,9.33,1,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,It was a very interesting and different survey and I enjoyed taking it!,1.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,5,9,7,3,2,4,8,1,6,4,2,3,1 +259,R_3ZZqKke6RXCTGTf,46 - 52,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Strongly agree,2,1,3,5,4,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,5,4,3,1,2,Disagree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,1,3,2,4,Strongly disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Somewhat agree,Strongly Agree,4,2,3,1,5,0,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Strongly agree,3,5,4,2,1,0,Disagree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,1,2,3,5,4,7,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Somewhat agree,Strongly Agree,3,2,4,5,1,0,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,1,3,5,4,2,0,Disagree,Strongly Disagree,Agree,Somewhat Disagree,Strongly agree,3,5,2,1,4,2,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Strongly disagree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,55,TRUE,70,FALSE,100,FALSE,50,TRUE,60,FALSE,100,TRUE,50,FALSE,75,TRUE,90,TRUE,55,FALSE,50,TRUE,50,TRUE,60,FALSE,50,TRUE,100,TRUE,50,FALSE,85,TRUE,96,FALSE,100,FALSE,100,TRUE,56,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,50,TRUE,50,FALSE,60,TRUE,97,10,2,2,2,1,3,0,-3,2,-3,2,-2,-3,2,0,3,-3,-2,-2,-3,-3,2,2,2,1,3,0,0,-3,2,-3,3,0,-2,-3,2,0,3,0,-3,1,-3,-3,-3,7,2,2,2,1,3,0,0,-3,2,-3,2,0,-2,-3,2,-1,3,0,-2,-1,-1,-2,-3,2,TRUE,0,97,FALSE,0,60,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,56,FALSE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,85,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,60,TRUE,0,50,FALSE,1,50,TRUE,1,55,TRUE,1,90,FALSE,1,75,TRUE,1,50,FALSE,1,100,TRUE,1,60,FALSE,1,50,FALSE,1,100,TRUE,0,70,TRUE,1,55,TRUE,1,50,TRUE,1,100,0,0.16,0,0,0,0,0.25,0.1936,0.25,0.01,0.2025,0.0016,0.25,0,0.25,0.36,0.0625,0.25,0,0,0.2025,0.25,0.25,0.0225,0.25,0.25,0.25,0.9409,0.25,0.36,0.49,0,0.199860714,0.148585714,0.251135714,10,31.25,26,81.25,6,75,7,87.5,6,75,7,87.5,15,93.75,11,68.75,72.16,57.5,74.5,81,75.62,70.12,74.19,-50,-9.09,-17.5,-13,6,-11.88,-23.63,5.44,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0.2,0,0.8,0,0,0.2,0.8,0.25,0.25,0.25,0,0,1.125,0,0.2,-0.2,0,0,0,0,0,5,0,1,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),49,Interesting. ,1.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,5,3,8,6,7,9,2,1,4,2,3,4,1 +260,R_3q7qGAiUw8YtYfI,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Agree,Agree,Somewhat agree,1,2,3,4,5,Somewhat disagree,Somewhat disagree,Agree,Strongly agree,Somewhat agree,1,3,2,5,4,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,3,2,4,Strongly disagree,Strongly disagree,Somewhat disagree,Disagree,Strongly disagree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,5,1,2,3,8,Somewhat agree,Disagree,Strongly agree,Somewhat disagree,Agree,1,4,2,5,3,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,1,4,3,8,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,3,5,1,4,7,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,4,3,5,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,5,3,9,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,2,5,3,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,93,FALSE,57,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,56,FALSE,100,FALSE,100,FALSE,97,FALSE,100,FALSE,100,TRUE,90,TRUE,59,TRUE,93,TRUE,93,TRUE,100,FALSE,88,TRUE,93,TRUE,96,TRUE,100,TRUE,100,FALSE,100,FALSE,74,FALSE,68,FALSE,75,TRUE,100,TRUE,100,27,3,3,2,2,1,-1,-1,2,3,1,3,3,2,2,3,-3,-3,-1,-2,-3,2,3,2,2,3,2,1,-2,3,-1,2,8,3,3,3,3,3,7,1,2,1,-1,1,8,3,3,3,3,1,3,-1,-1,2,-1,0,7,3,3,3,3,3,3,-1,-2,-1,-1,-2,9,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,68,FALSE,0,74,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,93,FALSE,1,88,TRUE,0,100,TRUE,1,93,TRUE,0,93,TRUE,1,59,TRUE,1,90,FALSE,1,100,FALSE,1,100,FALSE,1,97,FALSE,1,100,FALSE,0,100,TRUE,1,56,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,0,93,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.01,0,0,0,0,0.0049,0,0.1936,0,0.0049,0.0016,0.0144,0.5476,0,0,0.1024,0.1849,1,1,0.1681,0.0009,0.8649,0,0,0,1,0.0625,0,0.8649,1,0.250557143,0.0621,0.439014286,27,84.38,25,78.13,8,100,5,62.5,5,62.5,7,87.5,14,87.5,11,68.75,91.62,88.5,95,92.75,90.25,91.31,91.94,6.25,13.49,-11.5,32.5,30.25,2.75,3.81,23.19,1,0,0,0,2,2,1,1,4,1,0,0,1,1,0,4,5,2,1,4,0,0,1,1,0,0,0,0,4,1,0,0,1,1,0,2,1,0,1,1,0.6,1.8,0.4,3.2,0.4,1,0.4,1,1.5,0.7,1.1,5.67,4.33,5.875,0.2,0.8,0,2.2,0.333333333,-1,1,4,-1,1.34,2,2,-2,-2,2,-1,1,-1,1,-1,1,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,68,Some of the questions were repetitive,1,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,2,5,6,9,8,3,4,1,7,2,4,3,1 +261,R_5rNwdFvn0qIr1GV,46 - 52,American,,American,Male,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,2,5,3,1,4,Strongly disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,3,5,2,1,4,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,2,3,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,3,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,3,5,10,Strongly disagree,Agree,Agree,Agree,Strongly disagree,2,3,5,4,1,10,Strongly Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,5,4,2,1,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,3,2,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,1,3,10,Strongly disagree,Agree,Strongly agree,Strongly agree,Strongly disagree,1,3,2,5,4,10,Strongly Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,1,4,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,2,4,3,5,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,FALSE,50,FALSE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,50,FALSE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,50,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,50,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-3,3,0,-3,1,3,3,1,-2,-3,3,-3,3,-3,-3,-3,-3,-3,3,3,3,3,3,10,-3,2,2,2,-3,10,-3,-3,3,-3,3,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,10,-3,2,3,3,-3,10,-3,3,3,-3,3,10,3,3,3,3,-3,10,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,50,0,1,1,0,0.25,0.25,0.25,0,0,1,0,0,0.25,1,0,0.25,0.25,0,1,0,1,0.25,0.25,0.25,0,0,0.25,0.25,0,1,0.25,1,0.321428571,0.25,0.392857143,4,12.5,21,65.63,4,50,7,87.5,5,62.5,5,62.5,9,56.25,12,75,81.25,68.75,75,87.5,93.75,81.25,81.25,-53.13,15.62,18.75,-12.5,25,31.25,25,6.25,0,0,6,0,3,0,1,1,1,4,1,0,0,0,0,0,0,0,0,0,0,0,6,0,3,0,1,0,0,4,1,6,0,0,0,6,6,6,6,0,1.8,1.4,0.2,0,1.8,1,1.4,4.8,0.85,2.25,1.55,10,10,10,0,0.4,-1.2,-4.8,-0.266666667,0,0,0,0,0,2,2,0,-2,2,2,-2,0,0,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),49,NONE,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,8,4,7,2,9,5,6,1,3,3,2,4,1 +262,R_7cTcJgRvQCfuUdj,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Somewhat agree,Agree,5,4,2,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,3,1,Agree,Somewhat Agree,Strongly Agree,Disagree,Agree,3,1,5,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,2,4,1,3,Agree,Strongly Agree,Agree,Disagree,Agree,2,4,5,1,3,6,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,2,1,3,6,Agree,Somewhat Agree,Strongly Agree,Disagree,Agree,2,3,1,4,5,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,4,5,1,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Somewhat agree,5,1,2,4,3,4,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,3,5,1,4,Agree,Somewhat Agree,Strongly Agree,Disagree,Agree,1,4,2,3,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,5,4,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,86,FALSE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,96,FALSE,50,FALSE,100,FALSE,65,TRUE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,1,2,-2,0,1,1,1,2,1,3,-2,2,0,0,0,1,-1,2,3,2,-2,2,6,-2,0,1,1,1,6,2,1,3,-2,2,6,0,1,0,0,-1,6,1,3,2,1,1,4,-2,1,1,1,1,4,2,1,3,-2,2,2,0,0,0,0,-1,6,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,50,FALSE,1,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.0016,0,0,0,0,0,0,0,0,0,1,0.0625,0,0.0196,0,0,0.25,0,0,0,0.25,0,0,0,0.25,0,0,1,1,0.1225,0,0.141235714,0.09515,0.187321429,30,93.75,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,92.88,78.12,93.88,99.5,100,94.19,91.56,6.25,5.38,-9.38,6.38,12,12.5,6.69,4.06,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0.8,0,0,0.4,0.2,0.2,0,0.2,0.3,0.15,0.225,6,3.33,5,0.6,-0.2,0,0.2,0.133333333,2,2,4,0,2.67,1,2,2,-2,2,1,-1,0,0,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),61,,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,6,5,3,9,2,8,7,1,4,3,2,4,1 +263,R_57ZgjQtLkHOY40x,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,1,3,2,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,5,4,1,2,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,5,4,1,2,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,1,3,5,4,2,5,Disagree,Agree,Agree,Somewhat agree,Neither agree nor disagree,2,1,3,5,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,5,1,3,2,4,6,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,3,5,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,1,2,3,4,3,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,5,2,4,1,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Disagree,5,4,3,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,60,FALSE,60,TRUE,100,TRUE,85,TRUE,82,FALSE,60,TRUE,90,TRUE,55,TRUE,100,FALSE,100,FALSE,100,FALSE,55,FALSE,100,TRUE,80,FALSE,97,FALSE,94,TRUE,100,TRUE,76,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,98,TRUE,90,TRUE,100,TRUE,100,FALSE,95,TRUE,100,FALSE,55,FALSE,75,TRUE,95,TRUE,100,28,3,3,1,1,1,-1,1,2,1,1,1,1,0,1,2,-1,-1,1,1,-3,3,3,2,1,3,4,-2,2,2,1,0,5,1,1,1,1,2,3,-1,1,1,-1,-2,6,3,3,3,3,3,6,-1,-1,1,-2,0,2,1,1,3,1,3,3,-1,-1,1,-2,-2,5,TRUE,0,100,TRUE,1,95,FALSE,1,75,FALSE,1,55,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,98,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,76,TRUE,1,100,FALSE,1,94,FALSE,1,97,TRUE,0,80,FALSE,1,100,FALSE,0,55,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,55,TRUE,1,90,FALSE,1,60,TRUE,0,82,TRUE,0,85,TRUE,1,100,FALSE,0,60,TRUE,1,60,0,0.01,0,0,0.16,0.0025,0,0.0004,0,1,0,0,0.01,0,0,0.0025,0,0.2025,0.6724,0.3025,0.3025,0.0576,0.64,1,0.0036,0.16,0.36,1,0.0625,0.0009,0.7225,0,0.237942857,0.098421429,0.377464286,28,87.5,23,71.88,6,75,6,75,4,50,7,87.5,13,81.25,10,62.5,87.56,77,86.12,92.5,94.62,89,86.12,15.62,15.68,2,11.12,42.5,7.12,7.75,23.62,0,0,1,0,2,1,1,0,0,1,0,0,1,0,0,0,2,0,2,1,0,0,2,2,2,0,2,1,3,1,0,0,3,0,1,0,0,0,3,1,0.6,0.6,0.2,1,1.2,1.4,0.8,0.8,0.6,1.05,0.825,4,3.67,4.25,-0.6,-0.8,-0.6,0.2,-0.666666667,-2,3,0,1,0.33,-1,1,1,-1,1,1,-1,-1,1,-2,2,2,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),72,I hope it helps the research it is pertaining to.,0.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,02COC,01PAST,02DGEN,02REV,3,4,2,7,8,6,9,1,5,2,4,3,1 +264,R_710J4BbVCOc2iEF,53 - 59,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,1,3,4,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,1,3,5,2,4,Strongly Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,5,1,4,2,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,1,3,4,Agree,Agree,Agree,Agree,Strongly Agree,5,3,2,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,1,5,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,2,4,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,2,4,5,1,3,6,Agree,Neither agree nor disagree,Strongly agree,Disagree,Strongly agree,3,4,1,5,2,7,Strongly Agree,Agree,Agree,Strongly Agree,Agree,3,1,4,5,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,53,TRUE,64,TRUE,80,FALSE,58,FALSE,55,FALSE,58,TRUE,68,FALSE,59,FALSE,60,FALSE,90,TRUE,75,TRUE,79,TRUE,70,FALSE,63,FALSE,66,TRUE,80,TRUE,76,TRUE,96,TRUE,75,FALSE,78,FALSE,93,FALSE,79,FALSE,76,FALSE,67,TRUE,79,TRUE,84,FALSE,76,TRUE,82,FALSE,73,TRUE,93,FALSE,90,TRUE,98,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,1,-2,2,-2,1,3,1,2,2,1,-3,-3,-3,-3,-3,2,2,2,2,3,5,1,0,1,0,1,3,0,0,1,1,0,5,0,0,1,1,0,4,1,3,1,1,3,6,2,0,3,-2,3,7,3,2,2,3,2,4,3,3,3,3,3,10,FALSE,1,53,TRUE,1,64,TRUE,0,80,FALSE,1,58,FALSE,0,55,FALSE,1,58,TRUE,1,68,FALSE,0,59,FALSE,0,60,FALSE,0,90,TRUE,0,75,TRUE,0,79,TRUE,1,70,FALSE,1,63,FALSE,0,66,TRUE,1,80,TRUE,0,76,TRUE,0,96,TRUE,0,75,FALSE,1,78,FALSE,0,93,FALSE,0,79,FALSE,1,76,FALSE,0,67,TRUE,0,79,TRUE,1,84,FALSE,1,76,TRUE,0,82,FALSE,1,73,TRUE,1,93,FALSE,0,90,TRUE,1,98,0.3481,0.0256,0.04,0.1024,0.0004,0.1764,0.4489,0.81,0.0484,0.6241,0.0049,0.09,0.36,0.5625,0.3025,0.1296,0.0576,0.1764,0.6724,0.6241,0.8649,0.4356,0.5625,0.1369,0.5776,0.0576,0.81,0.2209,0.64,0.9216,0.0729,0.6241,0.393314286,0.270835714,0.515792857,10,31.25,15,46.88,3,37.5,5,62.5,4,50,3,37.5,7,43.75,8,50,74.78,70.5,74.88,76.5,77.25,76,73.56,-15.63,27.9,33,12.38,26.5,39.75,32.25,23.56,0,1,1,0,0,0,2,1,2,0,3,1,1,1,1,3,3,4,4,3,1,0,2,1,0,1,2,1,0,2,0,1,0,1,1,6,6,6,6,6,0.4,1,1.4,3.4,0.8,1.2,0.6,6,1.55,2.15,1.85,4.33,5.67,5.5,-0.4,-0.2,0.8,-2.6,0.066666667,-1,-4,1,-6,-1.34,0,0,-2,-1,1,0,0,1,-1,0,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),53,great survey,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,7,8,5,4,9,3,2,1,6,4,2,3,1 +265,R_6FGX2RDKjKb8wzD,53 - 59,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,1,5,2,4,3,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,2,1,4,5,3,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,4,3,2,5,1,Strongly disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,2,1,4,5,3,Neither agree nor disagree,Strongly Agree,Agree,Agree,Neither agree nor disagree,1,3,4,5,2,3,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Neither agree nor disagree,3,5,1,4,2,3,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,4,2,5,1,3,3,Strongly disagree,Disagree,Disagree,Strongly disagree,Disagree,5,2,4,3,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Agree,Agree,Neither agree nor disagree,1,5,4,2,3,2,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Neither agree nor disagree,2,5,1,3,4,2,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,5,1,2,3,4,2,Disagree,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,2,5,3,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,71,TRUE,92,TRUE,50,TRUE,50,FALSE,100,TRUE,92,TRUE,61,TRUE,99,TRUE,62,FALSE,76,TRUE,99,FALSE,77,TRUE,96,TRUE,50,TRUE,100,FALSE,76,TRUE,83,TRUE,79,FALSE,100,FALSE,100,TRUE,60,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,100,TRUE,90,TRUE,98,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,1,2,0,-1,1,3,-2,1,1,2,3,3,1,-3,-2,-2,0,-3,0,3,2,2,0,3,-1,1,3,-2,0,3,0,3,3,2,1,3,-3,-2,-2,-3,-2,3,0,3,2,2,0,2,-1,1,3,-2,0,2,0,3,3,3,1,2,-2,-3,-2,0,-3,2,TRUE,0,100,TRUE,1,71,TRUE,0,92,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,92,TRUE,1,61,TRUE,1,99,TRUE,1,62,FALSE,1,76,TRUE,0,99,FALSE,0,77,TRUE,0,96,TRUE,1,50,TRUE,1,100,FALSE,1,76,TRUE,0,83,TRUE,0,79,FALSE,1,100,FALSE,0,100,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,98,TRUE,1,100,0.1521,0,0,0.0064,0,0,0,0.1444,0,0.16,0.01,0.5929,0.0001,0.0576,0.25,0.0841,0,0.25,0,0,1,0.25,0.6241,0.9216,0.0576,0.25,0.0004,1,0.8464,0.6889,0,0.9801,0.291721429,0.11065,0.472792857,22,68.75,23,71.88,6,75,6,75,5,62.5,6,75,14,87.5,9,56.25,84.72,71.62,87.88,86.62,92.75,81.88,87.56,-3.13,12.84,-3.38,12.88,24.12,17.75,-5.62,31.31,0,0,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,3,1,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0.2,0.2,0.6,0.8,0.2,0.2,0.4,0.4,0.45,0.3,0.375,3,2,2.5,0,0,0.2,0.4,0.066666667,1,1,1,1,1,-1,2,0,-2,2,1,-1,0,0,-2,2,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),55,interesting,0.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,9,8,6,4,5,7,2,1,3,3,2,4,1 +266,R_5NnszuPXPUh3hpB,46 - 52,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Strongly agree,4,5,1,3,2,Somewhat agree,Agree,Agree,Somewhat disagree,Agree,3,4,1,5,2,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,1,5,2,4,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,4,3,2,6,Agree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,5,1,3,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,4,3,1,7,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,3,1,2,7,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,5,2,1,3,7,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,5,2,1,3,4,7,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,5,3,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,53,TRUE,52,TRUE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,85,TRUE,83,TRUE,89,TRUE,94,TRUE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,94,TRUE,100,TRUE,85,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,60,TRUE,100,TRUE,100,TRUE,100,FALSE,82,FALSE,84,TRUE,100,FALSE,67,TRUE,100,32,2,2,2,2,3,1,2,2,-1,2,1,2,0,2,1,1,1,2,1,2,1,2,1,1,0,7,2,1,2,2,1,6,0,0,1,1,1,6,1,2,2,0,1,7,2,1,2,2,1,8,1,2,0,1,1,7,2,0,1,1,2,7,1,2,0,1,0,7,TRUE,0,100,FALSE,0,67,TRUE,0,100,FALSE,1,84,FALSE,0,82,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,85,TRUE,1,100,TRUE,0,94,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,0,94,TRUE,1,89,TRUE,0,83,TRUE,1,85,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,52,FALSE,0,53,0,0.0225,0,0,0.2809,1,0.0121,0,0.25,0,0,0,0.16,0.25,0.6724,0.4489,0.8836,0.0256,0,0.6889,1,0.0225,1,1,0.8836,0.25,0.2304,1,1,1,0,1,0.466389286,0.284535714,0.648242857,32,100,18,56.25,6,75,2,25,4,50,6,75,12,75,6,37.5,86.81,68.5,90.38,96,92.38,85.81,87.81,43.75,30.56,-6.5,65.38,46,17.38,10.81,50.31,1,0,1,1,3,1,1,0,3,1,1,2,1,1,0,0,1,0,1,1,0,1,0,0,2,0,0,2,2,1,1,2,1,1,1,0,1,2,0,2,1.2,1.2,1,0.6,0.6,1,1.2,1,1,0.95,0.975,6.33,7.33,6.875,0.6,0.2,-0.2,-0.4,0.2,-1,-1,-1,0,-1,-2,-1,1,-2,2,-1,1,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,it was fun,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,5,2,6,4,3,7,9,1,8,3,2,4,1 +267,R_17PQ70EjmFqYYx8,46 - 52,American,,American,Female,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,1,3,4,2,5,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,Somewhat Agree,Strongly Agree,Agree,Disagree,Agree,4,5,3,2,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,5,2,4,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,2,4,5,3,1,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,1,Somewhat Agree,Strongly Agree,Agree,Disagree,Agree,3,5,2,1,4,0,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly Agree,4,1,5,2,3,1,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,5,Somewhat Agree,Strongly Agree,Agree,Disagree,Agree,2,3,1,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,3,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,52,TRUE,100,TRUE,66,TRUE,71,FALSE,50,TRUE,91,TRUE,70,TRUE,75,TRUE,52,FALSE,51,FALSE,100,FALSE,51,FALSE,51,TRUE,90,FALSE,52,TRUE,51,FALSE,51,TRUE,52,TRUE,68,TRUE,99,FALSE,52,TRUE,75,FALSE,51,TRUE,100,TRUE,75,FALSE,53,FALSE,50,FALSE,50,FALSE,90,FALSE,50,TRUE,75,6,1,1,2,0,3,-1,1,2,0,0,1,3,2,-2,2,0,-1,1,1,0,1,2,2,0,2,1,0,0,2,0,0,1,1,3,2,-2,2,0,0,-1,1,1,0,1,1,1,2,1,3,1,-1,0,2,0,0,5,1,3,2,-2,2,1,0,0,1,1,0,1,TRUE,0,75,FALSE,0,50,FALSE,1,90,FALSE,1,50,FALSE,0,50,FALSE,1,53,TRUE,1,75,TRUE,1,100,FALSE,0,51,TRUE,1,75,FALSE,1,52,TRUE,0,99,TRUE,1,68,TRUE,0,52,FALSE,0,51,TRUE,1,51,FALSE,1,52,TRUE,0,90,FALSE,1,51,FALSE,1,51,FALSE,0,100,FALSE,0,51,TRUE,0,52,TRUE,1,75,TRUE,0,70,TRUE,1,91,FALSE,1,50,TRUE,0,71,TRUE,0,66,TRUE,1,100,FALSE,0,52,TRUE,1,100,0,0.0081,0.2401,0.0625,0,0.2209,0.0625,0.0625,0.2401,0.2601,0,0.1024,0.2601,0.2304,0.25,0.25,0.2704,0.25,0.5041,0.49,1,0.2601,0.2401,0.2704,0.2304,0.25,0.2704,0.5625,0.01,0.81,0.4356,0.9801,0.313325,0.175671429,0.450978571,6,18.75,17,53.13,4,50,4,50,3,37.5,6,75,9,56.25,8,50,67.62,50.88,67.62,72.38,79.62,71.25,64,-34.38,14.49,0.88,17.62,34.88,4.62,15,14,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.4,0.4,0,0,0.2,0.2,0,0.2,0.2,0.15,0.175,0.67,2.33,1.375,0.2,0.2,0,-0.2,0.133333333,0,-4,-1,0,-1.66,-1,1,0,-1,1,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,The survey was good.,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,4,3,5,7,2,9,6,1,8,4,3,2,1 +268,R_5ocomYDlDwHAkjD,53 - 59,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,1,5,3,2,4,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,3,1,2,4,Disagree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,4,2,5,3,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Agree,Agree,5,2,1,3,4,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,5,3,1,2,4,3,Somewhat Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,5,2,3,1,4,3,Disagree,Disagree,Disagree,Disagree,Disagree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,4,5,2,3,1,2,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat disagree,5,1,4,2,3,2,Neither Agree nor Disagree,Agree,Agree,Disagree,Agree,1,5,4,3,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,69,TRUE,100,TRUE,65,FALSE,76,TRUE,74,TRUE,72,FALSE,100,TRUE,71,TRUE,64,TRUE,71,FALSE,86,FALSE,76,FALSE,62,TRUE,82,TRUE,70,TRUE,91,FALSE,64,FALSE,64,FALSE,70,TRUE,85,TRUE,73,TRUE,78,TRUE,74,TRUE,84,TRUE,78,FALSE,68,FALSE,60,FALSE,54,TRUE,90,TRUE,85,TRUE,89,16,1,2,2,1,1,-1,-2,1,-1,0,-2,0,2,-2,1,1,0,1,1,-1,2,2,2,2,2,4,-1,-1,-1,-2,1,2,-1,0,2,1,1,3,-2,-2,-2,-2,-2,3,2,2,2,2,2,2,-1,-2,0,-2,-1,2,0,2,2,-2,2,2,0,0,1,0,0,2,TRUE,0,89,TRUE,1,85,TRUE,0,90,FALSE,1,54,FALSE,0,60,FALSE,1,68,TRUE,1,78,TRUE,1,84,TRUE,1,74,TRUE,1,78,TRUE,0,73,TRUE,0,85,FALSE,0,70,FALSE,1,64,FALSE,0,64,TRUE,1,91,TRUE,0,70,TRUE,0,82,FALSE,1,62,FALSE,1,76,FALSE,0,86,TRUE,1,71,TRUE,0,64,TRUE,1,71,FALSE,1,100,TRUE,1,72,TRUE,0,74,FALSE,1,76,TRUE,0,65,TRUE,1,100,FALSE,0,69,TRUE,1,100,0.0256,0.0784,0.0081,0.0484,0,0.1024,0.0841,0.0484,0.0576,0.0841,0,0.49,0.0676,0.5329,0.36,0.0225,0.4096,0.2116,0.0576,0,0.7396,0.4096,0.1444,0.1296,0.49,0.5476,0.4761,0.7921,0.81,0.6724,0.4225,0.7225,0.317314286,0.176485714,0.458142857,16,50,18,56.25,4,50,2,25,6,75,6,75,11,68.75,7,43.75,76.41,69.38,72.88,79.25,84.12,78.31,74.5,-6.25,20.16,19.38,47.88,4.25,9.12,9.56,30.75,1,0,0,1,1,0,1,2,1,1,1,0,0,3,0,3,2,3,3,1,1,0,0,1,1,0,0,1,1,1,2,2,0,0,1,1,0,0,1,1,0.6,1,0.8,2.4,0.6,0.6,1,0.6,1.2,0.7,0.95,3,2,2.5,0,0.4,-0.2,1.8,0.066666667,2,0,1,1,1,0,0,1,-2,2,0,0,-1,1,-1,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),58,,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,5,4,8,9,3,6,7,1,2,2,3,4,1 +269,R_6keDxtnLDMK2iGd,39 - 45,,Canadian,Canadian,Female,Somewhat disagree,Strongly agree,Agree,Strongly agree,Agree,1,2,3,5,4,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,4,2,1,3,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,3,1,4,5,2,Disagree,Disagree,Disagree,Somewhat agree,Somewhat disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,5,4,2,3,1,5,Strongly disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,2,1,3,5,4,5,Strongly Agree,Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,4,2,3,1,5,8,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,5,3,2,1,5,Somewhat disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat disagree,4,2,5,3,1,5,Strongly agree,Agree,Strongly agree,Disagree,Strongly agree,5,3,1,4,2,10,Agree,Agree,Agree,Agree,Disagree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,80,TRUE,100,TRUE,60,TRUE,70,FALSE,50,TRUE,70,TRUE,85,TRUE,70,TRUE,50,TRUE,50,TRUE,95,FALSE,50,TRUE,85,TRUE,50,TRUE,70,TRUE,95,TRUE,50,FALSE,100,FALSE,100,TRUE,85,FALSE,50,TRUE,70,FALSE,50,TRUE,90,TRUE,100,FALSE,75,TRUE,50,FALSE,50,TRUE,100,TRUE,50,FALSE,100,13,-1,3,2,3,2,-1,-2,1,-2,-1,3,1,2,-1,3,-2,-2,-2,1,-1,1,3,1,3,2,6,-3,-3,2,-2,-1,5,3,2,1,-3,3,5,2,2,3,3,3,8,2,3,2,3,3,10,-1,-3,1,-2,-1,5,3,2,3,-2,3,5,2,2,2,2,-2,10,FALSE,1,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,75,TRUE,1,100,TRUE,1,90,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,0,85,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,70,TRUE,0,50,TRUE,0,85,FALSE,1,50,TRUE,1,95,TRUE,1,50,TRUE,0,50,TRUE,1,70,TRUE,0,85,TRUE,1,70,FALSE,1,50,TRUE,0,70,TRUE,0,60,TRUE,1,100,FALSE,0,80,TRUE,1,50,0.01,0.09,0.0025,0,0.25,0.0625,0.09,0.09,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.49,0.7225,0.0025,0.25,0.7225,0,0.49,0.25,0.64,0,1,0.25,0.36,0.7225,0.335446429,0.249464286,0.421428571,13,40.63,20,62.5,5,62.5,4,50,6,75,5,62.5,13,81.25,7,43.75,71.88,58.12,68.75,78.12,82.5,73.12,70.62,-21.87,9.38,-4.38,18.75,3.12,20,-8.13,26.87,2,0,1,0,0,2,1,1,0,0,0,1,1,2,0,4,4,5,2,4,3,0,0,0,1,0,1,0,0,0,0,1,1,1,0,4,4,4,1,1,0.6,0.8,0.8,3.8,0.8,0.2,0.6,2.8,1.5,1.1,1.3,5.33,6.67,6.75,-0.2,0.6,0.2,1,0.2,-4,0,0,-2,-1.34,-1,1,0,-2,2,-1,1,-1,1,-1,1,1,5 cents,5 minutes,47 days,Female,University - PhD,41,The last part tested my problem solving skills and I had to get help.,0.75,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,9,2,4,3,7,5,8,1,6,4,2,3,1 +270,R_7TWnEr6dY4HbC2B,60 - 66,American,,American,Female,Strongly agree,Agree,Agree,Disagree,Disagree,3,2,4,1,5,Agree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,4,2,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,2,1,Somewhat agree,Strongly disagree,Strongly disagree,Disagree,Somewhat disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,5,2,4,3,1,2,Strongly agree,Disagree,Somewhat agree,Strongly agree,Somewhat agree,3,4,1,2,5,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,1,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,4,1,5,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,2,4,FALSE,100,TRUE,84,TRUE,100,FALSE,50,FALSE,51,TRUE,64,TRUE,62,TRUE,100,TRUE,55,TRUE,74,TRUE,61,TRUE,100,TRUE,74,FALSE,50,FALSE,50,FALSE,50,TRUE,58,TRUE,100,TRUE,63,FALSE,57,TRUE,70,TRUE,58,FALSE,67,TRUE,59,TRUE,78,TRUE,65,TRUE,77,TRUE,75,TRUE,83,TRUE,100,FALSE,57,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-2,-2,2,-3,2,-1,-1,3,3,3,3,3,1,-3,-3,-2,-1,3,3,3,0,1,0,3,-2,1,3,1,2,3,3,3,3,3,8,1,0,1,1,-2,2,0,0,0,0,0,1,0,-3,0,0,0,1,3,3,3,3,3,5,0,0,0,0,0,10,FALSE,1,100,TRUE,1,84,TRUE,0,100,FALSE,1,50,FALSE,0,51,TRUE,0,64,TRUE,1,62,TRUE,1,100,TRUE,1,55,TRUE,1,74,TRUE,0,61,TRUE,0,100,TRUE,1,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,58,TRUE,0,100,TRUE,0,63,FALSE,1,57,TRUE,1,70,TRUE,1,58,FALSE,1,67,TRUE,1,59,TRUE,0,78,TRUE,1,65,TRUE,0,77,TRUE,0,75,TRUE,0,83,TRUE,1,100,FALSE,0,57,TRUE,1,100,0,0.1225,0.25,0.1444,0,0.4096,0.1681,0.0676,0.1849,0.1764,0,0.0676,0.2025,0.3721,0.2601,0.0256,0.1089,0.25,0.5625,0.6084,0.09,0.25,0.3969,0.25,0.3364,0.5929,0.3249,0,1,1,0.6889,1,0.335510714,0.163814286,0.507207143,23,71.88,17,53.13,3,37.5,4,50,6,75,4,50,12,75,5,31.25,71.62,62.12,70.88,73.38,80.12,69.31,73.94,18.75,18.49,24.62,20.88,-1.62,30.12,-5.69,42.69,0,1,1,2,3,1,1,1,4,2,0,0,0,0,0,0,3,4,3,1,3,2,2,2,2,2,0,2,1,1,0,0,0,0,0,1,3,3,2,1,1.4,1.8,0,2.2,2.2,1.2,0,2,1.35,1.35,1.35,3.33,2.33,3.625,-0.8,0.6,0,0.2,-0.066666667,-1,1,3,-8,1,2,-1,-1,-2,2,1,-1,2,-2,1,-1,-2,10 cents,100 minutes,24 days,Female,Trade School (non-military),62,It was a good survey,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,4,9,7,8,6,2,5,1,3,4,2,3,1 +271,R_5ksKzm2HPRTlWTu,67 - 73,American,,American,Female,Strongly agree,Agree,Agree,Strongly disagree,Disagree,2,4,5,1,3,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat disagree,1,5,4,3,2,Strongly Agree,Strongly Agree,Agree,Strongly Disagree,Strongly Agree,3,4,5,1,2,Somewhat disagree,Somewhat agree,Agree,Agree,Disagree,4,5,1,2,3,Strongly Agree,Agree,Agree,Strongly disagree,Disagree,4,2,1,3,5,1,Strongly disagree,Strongly disagree,Strongly agree,Agree,Somewhat disagree,5,4,3,1,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,4,1,3,5,1,Agree,Somewhat agree,Agree,Agree,Agree,1,5,2,4,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly disagree,Disagree,4,5,2,1,3,1,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat disagree,1,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,2,5,0,Agree,Somewhat agree,Agree,Agree,Disagree,2,5,4,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,57,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,91,TRUE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,83,FALSE,89,FALSE,96,FALSE,68,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,50,25,3,2,2,-3,-2,-3,-3,3,1,-1,3,3,2,-3,3,-1,1,2,2,-2,3,2,2,-3,-2,1,-3,-3,3,2,-1,1,3,3,3,2,3,1,2,1,2,2,2,1,3,2,2,-3,-2,1,-3,-3,3,1,-1,1,3,3,3,-3,3,0,2,1,2,2,-2,2,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,68,FALSE,1,96,FALSE,1,89,FALSE,1,83,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,91,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,57,TRUE,1,100,0,0,0,0,0,0,0,0,0.0289,0,0,0.25,0,0.25,0,0,0.25,0.25,0,0.8281,0.25,0.25,0.0121,1,0.1024,0.25,0.1849,0.25,0,0.0016,1,0,0.184214286,0.073492857,0.294935714,25,78.13,27,84.38,6,75,7,87.5,6,75,8,100,16,100,11,68.75,83.88,68.25,77.25,92.12,97.88,87.94,79.81,-6.25,-0.5,-6.75,-10.25,17.12,-2.12,-12.06,11.06,0,0,0,0,0,0,0,0,1,0,0,0,1,5,0,3,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0.2,1.2,1.4,0,0,0.2,0.6,0.7,0.2,0.45,1,0.67,1,0,0.2,1,0.8,0.4,0,0,1,-1,0.33,0,2,1,-2,2,1,-1,-2,2,-2,2,1,10 cents,25 minutes,24 days,Female,High School (or equivalent),73,this was a great survey,1.125,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,6,5,3,4,9,2,8,1,7,2,3,4,1 +272,R_1916rOSJUwEPADZ,46 - 52,,Canadian,Canadian,Male,Somewhat disagree,Agree,Agree,Strongly agree,Strongly agree,5,1,2,3,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,1,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,3,5,1,2,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,5,3,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,4,3,1,2,5,6,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,3,5,1,4,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,3,4,5,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,1,3,5,4,2,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,1,4,5,3,2,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,1,4,5,7,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,93,TRUE,90,TRUE,73,TRUE,62,FALSE,53,TRUE,57,TRUE,59,TRUE,52,TRUE,56,TRUE,58,TRUE,77,TRUE,73,FALSE,94,TRUE,54,TRUE,100,TRUE,76,TRUE,86,TRUE,55,TRUE,100,TRUE,73,TRUE,83,FALSE,66,TRUE,75,TRUE,99,TRUE,85,TRUE,90,FALSE,69,FALSE,63,FALSE,65,TRUE,74,TRUE,81,TRUE,88,24,-1,2,2,3,3,-1,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,6,0,0,0,-1,0,6,0,1,0,0,-1,6,0,0,0,0,1,8,-1,-1,-1,-2,-1,5,-1,-1,-1,-1,0,6,1,0,1,1,1,7,0,-1,0,0,1,5,TRUE,0,88,TRUE,1,81,TRUE,0,74,FALSE,1,65,FALSE,0,63,FALSE,1,69,TRUE,1,90,TRUE,1,85,TRUE,1,99,TRUE,1,75,FALSE,1,66,TRUE,0,83,TRUE,1,73,TRUE,0,100,TRUE,1,55,TRUE,1,86,TRUE,0,76,TRUE,0,100,TRUE,0,54,FALSE,1,94,TRUE,1,73,TRUE,1,77,TRUE,0,58,TRUE,1,56,TRUE,0,52,TRUE,1,59,TRUE,0,57,FALSE,1,53,TRUE,0,62,TRUE,1,73,TRUE,1,90,TRUE,1,93,0.0225,0.1681,0.0196,0.01,0.0049,0.0961,0.1936,0.0625,0.0036,0.0529,0.0729,0.0729,0.0001,0.1156,0.3969,0.0361,0.3364,0.1225,0.2209,0.2704,0.0729,0.2025,0.2916,1,0.5776,0.3249,0.01,0.7744,0.5476,1,0.3844,0.6889,0.283325,0.111928571,0.454721429,24,75,20,62.5,6,75,4,50,4,50,6,75,15,93.75,5,31.25,74.34,70.88,70.88,80.12,75.5,76.75,71.94,12.5,11.84,-4.12,20.88,30.12,0.5,-17,40.69,1,2,1,3,3,1,1,1,2,0,0,1,0,0,2,0,1,0,0,1,0,3,3,5,4,0,2,2,2,0,1,0,1,1,0,0,2,0,0,1,2,1,0.6,0.4,3,1.2,0.6,0.6,1,1.35,1.175,6,6,6.125,-1,-0.2,0,-0.2,-0.4,1,0,-1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),48,TOO LONG,0,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,02REV,6,7,9,3,8,4,2,1,5,4,2,3,1 +273,R_7K9iTpqYzeRz5ew,39 - 45,,Canadian,Canadian,Female,Strongly agree,Agree,Somewhat agree,Agree,Strongly agree,2,1,5,4,3,Disagree,Disagree,Agree,Disagree,Agree,4,3,2,5,1,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,3,4,5,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,5,4,3,2,Strongly Agree,Agree,Agree,Strongly disagree,Strongly Agree,3,4,1,2,5,7,Strongly disagree,Strongly disagree,Agree,Somewhat agree,Somewhat agree,1,2,3,5,4,8,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Agree,4,2,5,1,3,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,5,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Strongly Agree,Somewhat disagree,3,4,2,1,5,5,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,1,4,5,2,3,4,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Agree,4,3,2,1,5,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,62,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,57,TRUE,100,FALSE,100,FALSE,89,FALSE,100,FALSE,100,TRUE,100,TRUE,96,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,62,FALSE,100,TRUE,100,FALSE,100,24,3,2,1,2,3,-2,-2,2,-2,2,2,1,1,-3,3,-3,-3,-3,-3,-3,3,2,2,-3,3,7,-3,-3,2,1,1,8,-1,-2,3,-2,2,5,-3,-3,-3,-3,-3,8,2,2,1,3,-1,5,-3,-3,1,-3,0,4,1,0,3,-3,2,3,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,96,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,89,FALSE,1,100,TRUE,1,100,FALSE,0,57,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,62,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,1,0,0,0.3249,0,0,0,0,0,0,0,0.1444,0,0,0,0.0016,0.0121,1,0,0.3844,0,0,0,0,1,1,0.173835714,0.10495,0.242721429,24,75,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,95.81,88.62,100,94.62,100,97.06,94.56,-6.25,14.56,1.12,12.5,19.62,25,9.56,19.56,0,0,1,5,0,1,1,0,3,1,3,3,2,1,1,0,0,0,0,0,1,0,0,1,4,1,1,1,1,2,1,1,2,0,1,0,0,0,0,0,1.2,1.2,2,0,1.2,1.2,1,0,1.1,0.85,0.975,6.67,4,5.625,0,0,1,0,0.333333333,2,4,2,3,2.67,0,1,1,-1,1,0,0,-2,2,-2,2,0,15 cents,5 minutes,24 days,Female,University - Graduate (Masters),45,,0.875,0,1,0,0,0,1,0.33,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,2,8,9,4,5,3,1,7,4,2,3,1 +274,R_3PIfTQUOYJNg6P3,60 - 66,American,,American,Male,Somewhat disagree,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,5,4,2,3,1,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Strongly agree,2,4,3,1,5,Somewhat Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,2,3,5,Agree,Agree,Agree,Agree,Agree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Agree,Agree,Agree,Agree,1,5,2,4,3,1,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,5,2,1,4,3,0,Somewhat Agree,Agree,Agree,Agree,Agree,3,2,4,1,5,2,Agree,Agree,Agree,Strongly Agree,Agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat disagree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,0,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,4,2,5,1,3,0,Somewhat Agree,Strongly agree,Agree,Neither Agree nor Disagree,Agree,2,1,3,4,5,2,Agree,Agree,Agree,Agree,Strongly Agree,4,5,1,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,98,TRUE,95,FALSE,100,TRUE,100,FALSE,100,FALSE,63,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,93,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,92,FALSE,87,FALSE,100,TRUE,100,TRUE,91,28,-1,0,3,2,3,1,1,3,-2,3,1,3,2,0,1,2,2,2,2,2,1,2,2,2,2,2,2,1,3,1,2,1,1,2,2,2,2,0,2,2,2,3,2,2,-1,1,2,3,3,1,2,1,3,0,2,0,1,3,2,0,2,0,2,2,2,2,3,2,TRUE,0,91,TRUE,1,100,FALSE,1,100,FALSE,1,87,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,95,TRUE,1,98,0,0,0,0,0.0004,0,0,1,0,0,1,0,0,0,0.0064,0,0,0.0169,0,0,0,0.0049,1,0,0,0.1369,0.0025,0.8281,0,0,1,0,0.178432143,0.14455,0.212314286,28,87.5,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,97.47,92.25,98.75,98.88,100,98.62,96.31,3.12,13.09,4.75,11.25,23.88,12.5,11.12,15.06,2,2,1,0,1,1,0,0,3,1,0,1,0,2,1,0,0,0,1,0,0,1,1,1,0,1,0,0,2,1,0,0,0,0,1,0,0,0,0,1,1.2,1,0.8,0.2,0.6,0.8,0.2,0.2,0.8,0.45,0.625,1,0.33,1,0.6,0.2,0.6,0,0.466666667,1,1,0,0,0.67,1,-2,1,0,0,-1,1,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,66,Unique survey ,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,6,9,3,7,4,2,5,1,8,2,3,4,1 +275,R_624VMp6OYkzBtLP,67 - 73,American,,American,Female,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,4,5,1,3,2,Disagree,Disagree,Strongly agree,Disagree,Somewhat agree,3,1,4,2,5,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,3,4,2,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,3,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,4,3,1,2,7,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,2,4,5,3,7,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,4,1,2,3,7,Disagree,Disagree,Disagree,Somewhat agree,Disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,4,1,5,3,5,Disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,2,4,3,5,Agree,Agree,Strongly agree,Disagree,Strongly agree,1,3,5,2,4,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,5,1,3,4,2,FALSE,100,TRUE,90,FALSE,100,TRUE,60,TRUE,90,FALSE,100,TRUE,90,TRUE,100,TRUE,90,TRUE,90,TRUE,60,TRUE,75,TRUE,75,FALSE,75,TRUE,85,TRUE,100,FALSE,60,FALSE,75,FALSE,75,FALSE,100,TRUE,75,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,85,FALSE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,1,3,-2,-2,3,-2,1,3,1,3,-2,3,0,1,1,1,-2,3,3,1,0,3,7,-3,-3,3,-3,2,7,2,3,3,0,3,7,-2,-2,-2,1,-2,7,3,3,3,3,1,6,-2,-3,3,0,1,5,2,2,3,-2,3,5,-1,0,0,1,-2,5,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,90,TRUE,1,90,TRUE,0,60,TRUE,0,75,TRUE,1,75,FALSE,1,75,TRUE,1,85,TRUE,1,100,FALSE,1,60,FALSE,1,75,FALSE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,85,FALSE,1,75,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.01,0,0,0,0.01,0,0,0,0.0625,0.01,0.36,0.01,0.01,0,0.36,0.0625,0,0.0625,0.0225,0.0625,0.0625,0.16,0.0225,0,0,0,0.0625,1,0.5625,0.103660714,0.05875,0.148571429,16,50,28,87.5,6,75,7,87.5,8,100,7,87.5,16,100,12,75,88.28,80.62,87.5,91.25,93.75,92.81,83.75,-37.5,0.78,5.62,0,-8.75,6.25,-7.19,8.75,0,2,2,1,0,1,1,0,1,1,1,2,0,2,0,2,3,3,0,0,0,2,0,2,2,0,1,0,2,0,1,1,0,0,0,1,1,1,0,0,1,0.8,1,1.6,1.2,0.6,0.4,0.6,1.1,0.7,0.9,7,5.33,6.125,-0.2,0.2,0.6,1,0.2,1,2,2,2,1.67,0,0,1,-2,2,0,0,0,0,-2,2,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),69,"Interesting to ask us about past, present and future responses. Really made me think.",0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,8,7,3,2,6,4,9,1,5,4,2,3,1 +276,R_6Ec2nE6EMk7EaE9,32 - 38,American,,American,Female,Agree,Agree,Strongly agree,Somewhat disagree,Agree,3,1,4,5,2,Disagree,Disagree,Agree,Somewhat agree,Somewhat agree,4,2,5,3,1,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,5,3,2,1,4,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Agree,Strongly Agree,Somewhat disagree,Agree,2,4,3,5,1,1,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,4,3,1,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,4,2,5,3,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Strongly Agree,Somewhat disagree,Agree,4,5,3,1,2,1,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,3,2,1,4,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,3,2,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,66,TRUE,86,TRUE,77,FALSE,60,TRUE,50,TRUE,87,FALSE,95,TRUE,77,FALSE,75,TRUE,50,FALSE,60,FALSE,50,FALSE,50,TRUE,86,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,92,FALSE,60,FALSE,95,FALSE,50,TRUE,100,TRUE,85,FALSE,90,FALSE,50,FALSE,50,TRUE,100,TRUE,88,TRUE,70,12,2,2,3,-1,2,-2,-2,2,1,1,1,0,0,-1,1,-1,1,0,-1,0,1,2,3,-1,2,1,-1,-2,1,1,1,1,1,1,0,0,1,1,0,1,1,-1,1,1,2,2,3,-1,2,2,-1,-2,2,-1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,TRUE,0,70,TRUE,1,88,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,90,TRUE,1,85,TRUE,1,100,FALSE,0,50,FALSE,0,95,FALSE,1,60,FALSE,1,92,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,0,86,FALSE,1,50,FALSE,1,50,FALSE,0,60,TRUE,1,50,FALSE,1,75,TRUE,1,77,FALSE,1,95,TRUE,1,87,TRUE,0,50,FALSE,1,60,TRUE,0,77,TRUE,1,86,FALSE,0,66,TRUE,1,100,0,0.0169,0.25,0.0225,0,0.01,0.0529,0.9025,0.25,0.25,0.0196,0.25,0.25,0.16,0.25,0.0144,0.0625,0.25,0.16,0.0025,0.36,0.25,0.25,0.25,0.25,0.25,0.4356,0.49,1,0.7396,0.5929,0.0064,0.277103571,0.194421429,0.359785714,12,37.5,20,62.5,5,62.5,4,50,5,62.5,6,75,10,62.5,10,62.5,70.28,58,69,77.25,76.88,71.5,69.06,-25,7.78,-4.5,19,14.75,1.88,9,6.56,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,2,0,0,0,1,1,0,2,0,1,2,1,0.2,0.4,0.4,0.6,0,0.6,0.4,1.2,0.4,0.55,0.475,1,1.33,1.125,0.2,-0.2,0,-0.6,1.85E-17,-1,0,0,0,-0.33,1,2,1,-1,1,1,-1,-1,1,-1,1,-1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,37,,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,8,5,6,3,4,9,2,1,7,2,4,3,1 +277,R_13fH2HE7LMaeZmx,53 - 59,,Canadian,Canadian,Male,Disagree,Agree,Agree,Somewhat disagree,Strongly agree,5,3,4,1,2,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,3,5,1,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,5,1,2,Strongly disagree,Somewhat agree,Agree,Strongly disagree,Somewhat agree,4,2,5,3,1,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,5,1,3,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,2,4,3,5,5,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,5,2,3,6,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,5,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,4,1,2,5,3,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,4,5,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,85,TRUE,63,TRUE,90,TRUE,55,TRUE,84,FALSE,55,TRUE,88,FALSE,61,FALSE,56,FALSE,56,TRUE,80,FALSE,85,FALSE,86,TRUE,85,TRUE,91,TRUE,65,TRUE,95,FALSE,60,TRUE,81,FALSE,75,TRUE,86,FALSE,97,TRUE,92,FALSE,56,TRUE,91,TRUE,94,FALSE,68,FALSE,54,FALSE,64,TRUE,94,FALSE,54,TRUE,57,12,-2,2,2,-1,3,-1,1,1,0,1,0,1,1,1,0,-1,0,0,1,-1,-3,1,2,-3,1,6,0,1,0,1,0,5,0,0,0,1,0,5,-1,1,-1,0,-1,6,0,1,1,1,1,6,-1,0,0,0,0,5,2,0,0,-1,0,5,0,-1,0,1,-1,5,TRUE,0,57,FALSE,0,54,TRUE,0,94,FALSE,1,64,FALSE,0,54,FALSE,1,68,TRUE,1,94,TRUE,1,91,FALSE,0,56,TRUE,1,92,FALSE,1,97,TRUE,0,86,FALSE,0,75,TRUE,0,81,FALSE,0,60,TRUE,1,95,TRUE,0,65,TRUE,0,91,TRUE,0,85,FALSE,1,86,FALSE,0,85,TRUE,1,80,FALSE,1,56,FALSE,0,56,FALSE,1,61,TRUE,1,88,FALSE,1,55,TRUE,0,84,TRUE,0,55,TRUE,1,90,TRUE,1,63,FALSE,0,85,0.0081,0.0144,0.0025,0.0036,0.7225,0.1024,0.3136,0.0064,0.0196,0.04,0.01,0.5625,0.3136,0.0009,0.2916,0.2916,0.1936,0.1296,0.7056,0.1521,0.7225,0.36,0.7225,0.6561,0.4225,0.2025,0.1369,0.3249,0.8836,0.8281,0.3025,0.7396,0.362760714,0.214135714,0.511385714,12,37.5,15,46.88,4,50,2,25,5,62.5,4,50,8,50,7,43.75,75.09,66.75,67.88,80.5,85.25,76.12,74.06,-9.38,28.21,16.75,42.88,18,35.25,26.12,30.31,1,1,0,2,2,1,0,1,1,1,0,1,1,0,0,0,1,1,1,0,2,1,1,2,2,0,1,1,0,1,2,1,1,2,0,1,1,0,0,0,1.2,0.8,0.4,0.6,1.6,0.6,1.2,0.4,0.75,0.95,0.85,5.33,5.33,5.375,-0.4,0.2,-0.8,0.2,-0.333333333,0,0,0,1,0,-1,1,0,0,0,1,-1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),53,none,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,8,4,6,9,3,2,5,1,7,4,2,3,1 +278,R_3JdXuxYOg4c8Y35,53 - 59,American,,American,Female,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly disagree,5,4,1,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,5,3,1,Somewhat Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Disagree,3,5,1,2,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,1,5,2,4,3,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,3,1,5,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,3,4,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Somewhat agree,Agree,Strongly disagree,5,1,3,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,1,4,2,5,3,5,Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,5,3,2,1,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,2,4,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,92,TRUE,100,TRUE,100,FALSE,100,FALSE,52,TRUE,79,FALSE,100,FALSE,51,FALSE,100,TRUE,75,FALSE,100,FALSE,68,FALSE,53,TRUE,100,FALSE,67,TRUE,100,FALSE,50,TRUE,100,FALSE,52,FALSE,52,FALSE,52,FALSE,54,FALSE,54,TRUE,100,TRUE,91,FALSE,53,TRUE,55,TRUE,53,FALSE,100,TRUE,100,FALSE,55,17,0,-1,1,1,-3,0,0,1,1,0,-1,1,2,0,1,0,0,-3,0,-2,1,0,1,1,-2,5,0,1,1,0,0,5,-1,1,1,0,1,5,0,0,0,0,-2,6,2,0,1,2,-3,5,0,0,2,0,1,5,-2,1,2,0,2,6,0,1,0,1,0,5,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,0,53,TRUE,1,55,FALSE,1,53,TRUE,1,91,TRUE,1,100,FALSE,0,54,FALSE,0,54,FALSE,1,52,FALSE,1,52,FALSE,0,52,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,67,TRUE,0,100,FALSE,1,53,FALSE,1,68,FALSE,0,100,TRUE,1,75,FALSE,1,100,FALSE,0,51,FALSE,1,100,TRUE,1,79,FALSE,1,52,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,0,0.0441,0,0.0081,0,0.2209,0.2601,0.2916,0.1024,0.0625,0,0.2704,0.2916,0.2304,0.2025,0,0,0.2809,0,0,1,0.25,0.2209,1,0.1089,0.2304,0.0064,0.2025,0,1,1,0.2304,0.266528571,0.158092857,0.374964286,17,53.13,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,10,62.5,12,75,76.81,63.25,78.38,81.75,83.88,78.31,75.31,-15.62,8.06,0.75,15.88,19.25,-3.62,15.81,0.31,1,1,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,3,0,0,2,1,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1,3,1,2,0.6,0.4,0.2,0.6,0.8,0.6,0.4,1.4,0.45,0.8,0.625,5,5.33,5.25,-0.2,-0.2,-0.2,-0.8,-0.2,0,0,-1,1,-0.33,0,1,1,-1,1,0,0,-1,1,-1,1,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,,0.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,6,3,4,9,2,8,7,1,5,3,4,2,1 +279,R_5NmG2cp8T5XW0u0,67 - 73,American,,American,Female,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,3,5,4,1,Somewhat agree,Disagree,Agree,Somewhat agree,Neither agree nor disagree,5,4,2,3,1,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,5,2,1,4,3,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Neither agree nor disagree,5,2,3,1,4,6,Somewhat agree,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,3,5,1,2,4,6,Agree,Strongly Agree,Somewhat Agree,Disagree,Strongly Agree,4,1,3,2,5,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Somewhat disagree,Strongly Agree,Somewhat agree,Neither agree nor disagree,5,3,2,1,4,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,6,Agree,Agree,Agree,Disagree,Strongly agree,3,2,4,1,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,4,2,5,3,TRUE,100,TRUE,100,TRUE,92,FALSE,65,TRUE,87,FALSE,99,TRUE,100,TRUE,100,TRUE,86,FALSE,100,TRUE,76,TRUE,100,TRUE,84,TRUE,90,TRUE,92,TRUE,100,TRUE,89,FALSE,100,TRUE,90,FALSE,81,TRUE,81,TRUE,81,FALSE,100,TRUE,100,TRUE,100,TRUE,88,TRUE,80,FALSE,77,TRUE,99,TRUE,89,FALSE,58,TRUE,100,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,2,0,2,1,-2,2,1,0,2,1,0,1,3,1,2,1,2,1,1,0,2,-2,0,6,1,0,3,2,1,6,2,3,1,-2,3,6,0,0,0,1,0,8,0,-1,3,1,0,5,0,-1,1,0,0,4,2,2,2,-2,3,6,0,0,0,2,0,1,TRUE,0,100,TRUE,1,100,TRUE,0,92,FALSE,1,65,TRUE,1,87,FALSE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,86,FALSE,0,100,TRUE,0,76,TRUE,0,100,TRUE,1,84,TRUE,0,90,TRUE,1,92,TRUE,1,100,TRUE,0,89,FALSE,1,100,TRUE,0,90,FALSE,1,81,TRUE,1,81,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,88,TRUE,0,80,FALSE,1,77,TRUE,0,99,TRUE,1,89,FALSE,0,58,TRUE,1,100,0,0.0144,0,0,0,0.0001,0,1,0.0361,0.0361,0.0121,0.0256,0.0196,0.5776,0.0169,0,0,0.1225,0.0529,1,0.0361,0.0064,0.81,0.81,0.7921,0.64,0.3364,1,0.8464,0,0.9801,1,0.36275,0.1319,0.5936,21,65.63,20,62.5,4,50,6,75,4,50,6,75,14,87.5,6,37.5,90.12,80.88,92.38,94.88,92.38,90.38,89.88,3.13,27.62,30.88,17.38,44.88,17.38,2.88,52.38,0,1,0,2,2,0,2,1,1,1,0,2,1,3,0,1,2,1,1,1,1,2,1,1,2,1,1,1,1,0,0,1,2,3,0,1,2,1,0,1,1,1,1.2,1.2,1.4,0.8,1.2,1,1.1,1.1,1.1,6,5,5.25,-0.4,0.2,0,0.2,-0.066666667,1,2,0,7,1,0,1,1,-1,1,1,-1,-1,1,-2,2,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,71,Unusual ,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,9,5,8,6,3,7,1,4,2,4,3,1 +280,R_30diGYhBfh1dGSd,60 - 66,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,2,3,5,4,1,Disagree,Disagree,Agree,Somewhat agree,Disagree,4,2,1,5,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,4,3,2,1,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat disagree,Somewhat disagree,Strongly Agree,Agree,Agree,3,5,1,2,4,9,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,4,3,5,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,5,2,3,1,4,8,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,3,5,1,4,9,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,4,1,3,2,5,9,Disagree,Somewhat Agree,Disagree,Disagree,Agree,2,4,3,1,5,9,Disagree,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,3,5,2,1,TRUE,100,TRUE,100,TRUE,100,FALSE,77,FALSE,77,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,80,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,77,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,72,FALSE,100,FALSE,100,TRUE,100,TRUE,82,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,3,-2,1,-2,-2,2,1,-2,1,1,1,-1,2,-1,-1,1,1,1,-1,-1,3,2,2,9,-1,1,1,-1,1,9,1,1,1,1,2,8,-1,-1,1,1,1,8,1,1,2,1,-1,9,-2,1,0,1,-2,9,-2,1,-2,-2,2,9,-2,-3,0,-1,-1,9,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,77,FALSE,0,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,80,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,77,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,72,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0,0,0,0,0,0,0,1,0.0529,0,0,0,1,1,0.5929,0,0,0.0529,0,1,1,0.64,1,1,0,0.0784,0.0324,1,1,1,0,1,0.444625,0.264192857,0.625057143,24,75,19,59.38,4,50,6,75,3,37.5,6,75,11,68.75,8,50,95.78,88.88,97.12,100,97.12,96.19,95.38,15.62,36.4,38.88,22.12,62.5,22.12,27.44,45.38,2,2,0,4,1,1,3,1,2,3,0,0,0,2,0,0,0,0,0,0,0,0,1,3,2,0,3,2,0,0,3,0,3,1,0,1,2,1,2,2,1.8,2,0.4,0,1.2,1,1.4,1.6,1.05,1.3,1.175,8.67,9,8.75,0.6,1,-1,-1.6,0.2,0,0,-1,-1,-0.33,0,1,1,-1,1,1,-1,0,0,-1,1,1,5 cents,25 minutes,47 days,Female,University - Undergraduate,63,Excellent survey!,0.5,1,0,1,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,3,8,7,9,5,4,1,6,4,2,3,1 +281,R_7YY9n2jk9GxsOtB,60 - 66,American,,American,Female,Agree,Agree,Strongly agree,Agree,Agree,3,4,2,5,1,Strongly agree,Disagree,Agree,Neither agree nor disagree,Agree,3,4,1,5,2,Agree,Agree,Agree,Disagree,Somewhat Agree,4,2,3,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Agree,Agree,Agree,2,1,5,4,3,5,Agree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,3,4,5,1,5,Agree,Agree,Agree,Disagree,Agree,1,2,4,5,3,4,Agree,Disagree,Somewhat disagree,Disagree,Disagree,4,2,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Strongly Agree,Agree,Agree,2,3,1,5,4,5,Agree,Disagree,Agree,Somewhat agree,Agree,2,4,1,3,5,5,Agree,Agree,Agree,Disagree,Agree,1,5,3,2,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,4,2,5,3,1,TRUE,59,TRUE,95,TRUE,86,FALSE,54,TRUE,53,FALSE,96,TRUE,100,TRUE,96,FALSE,57,TRUE,100,FALSE,57,TRUE,100,TRUE,84,TRUE,92,FALSE,82,TRUE,100,FALSE,72,TRUE,100,TRUE,95,FALSE,100,TRUE,97,TRUE,74,FALSE,67,TRUE,95,FALSE,66,TRUE,89,FALSE,65,FALSE,82,TRUE,79,TRUE,100,FALSE,57,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,2,2,3,-2,2,0,2,2,2,2,-2,1,1,1,1,-1,1,3,3,2,2,2,5,2,-2,2,-1,1,5,2,2,2,-2,2,5,2,-2,-1,-2,-2,4,2,2,3,2,2,3,2,-2,2,1,2,5,2,2,2,-2,2,5,1,1,1,-2,1,5,TRUE,0,59,TRUE,1,95,TRUE,0,86,FALSE,1,54,TRUE,1,53,FALSE,1,96,TRUE,1,100,TRUE,1,96,FALSE,0,57,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,84,TRUE,0,92,FALSE,0,82,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,0,95,FALSE,1,100,TRUE,1,97,TRUE,1,74,FALSE,1,67,TRUE,1,95,FALSE,1,66,TRUE,1,89,FALSE,1,65,FALSE,1,82,TRUE,0,79,TRUE,1,100,FALSE,0,57,TRUE,1,100,0.0016,0.0121,0,0,0,0.0016,0.0025,0,0,0.0676,0,0.0256,0.3249,0.1849,0.2209,0.0025,0.1089,0.2116,0.0324,0.1156,0.0009,0.6724,0.9025,0.8464,0.0784,0.1225,0.3249,0.3481,0.7396,1,0.6241,1,0.284242857,0.082214286,0.486271429,22,68.75,22,68.75,4,50,7,87.5,5,62.5,6,75,13,81.25,9,56.25,82.78,70.25,81,85,94.88,86.19,79.38,0,14.03,20.25,-6.5,22.5,19.88,4.94,23.13,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,3,2,1,3,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0.6,0.6,0.2,2,0,0.4,0.2,0.2,0.85,0.2,0.525,5,4.33,4.625,0.6,0.2,0,1.8,0.266666667,2,0,0,-1,0.67,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),63,,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,4,7,3,9,2,5,6,1,8,2,4,3,1 +282,R_3GfymnrK9od8RuX,53 - 59,American,,American,Female,Agree,Somewhat agree,Agree,Agree,Somewhat agree,1,5,2,4,3,Strongly disagree,Disagree,Strongly agree,Strongly disagree,Somewhat disagree,2,1,3,5,4,Agree,Agree,Agree,Disagree,Agree,5,3,4,2,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,2,1,5,4,3,Strongly Agree,Somewhat disagree,Agree,Agree,Strongly Agree,1,3,5,4,2,9,Strongly disagree,Disagree,Agree,Strongly disagree,Somewhat agree,5,4,2,1,3,8,Agree,Agree,Agree,Disagree,Agree,5,4,2,1,3,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,2,1,3,4,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Somewhat agree,5,2,1,4,3,9,Strongly disagree,Disagree,Somewhat agree,Strongly disagree,Somewhat disagree,4,3,1,5,2,7,Agree,Strongly Agree,Agree,Strongly Disagree,Agree,2,1,4,3,5,8,Somewhat agree,Somewhat agree,Agree,Agree,Agree,1,2,3,4,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,98,TRUE,96,FALSE,98,FALSE,50,TRUE,76,FALSE,100,TRUE,88,TRUE,100,TRUE,50,TRUE,97,FALSE,87,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,75,FALSE,94,TRUE,50,TRUE,50,TRUE,90,TRUE,83,TRUE,91,TRUE,86,FALSE,100,TRUE,100,TRUE,50,FALSE,100,FALSE,87,TRUE,100,FALSE,50,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,2,1,-3,-2,3,-3,-1,2,2,2,-2,2,1,1,2,2,2,3,-1,2,2,3,9,-3,-2,2,-3,1,8,2,2,2,-2,2,8,1,1,2,1,2,7,2,0,3,3,1,9,-3,-2,1,-3,-1,7,2,3,2,-3,2,8,1,1,2,2,2,8,TRUE,0,98,TRUE,1,96,FALSE,1,98,FALSE,1,50,TRUE,1,76,FALSE,1,100,TRUE,1,88,TRUE,1,100,TRUE,1,50,TRUE,1,97,FALSE,1,87,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,94,TRUE,0,50,TRUE,0,50,TRUE,1,90,TRUE,1,83,TRUE,0,91,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,87,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0.0144,0,0,0.0196,0.0009,0.25,0.0289,0,0,0.25,0.0169,0.0576,0.0016,0.8281,0.25,0,0,0.01,0.25,0.25,0,0.0625,0.25,0.25,0.9604,0.0004,0.0036,0.0169,1,0.169907143,0.121685714,0.218128571,26,81.25,25,78.13,5,62.5,7,87.5,7,87.5,6,75,15,93.75,10,62.5,84.25,60.38,89.88,95,91.75,85.38,83.12,3.12,6.12,-2.12,2.38,7.5,16.75,-8.37,20.62,1,2,0,0,2,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,1,0.6,0,0.2,0.6,0.4,0.4,0,0.45,0.35,0.4,8.33,8,8,0.4,0.2,-0.4,0.2,0.066666667,0,1,0,-1,0.33,1,1,0,-1,1,1,-1,1,-1,-1,1,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,59,It was interesting,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,6,9,2,4,8,5,3,1,7,2,4,3,1 +283,R_3ASUzEPdUYTIVmB,60 - 66,,Canadian,Canadian,Male,Disagree,Agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,1,2,4,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,5,1,3,2,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,1,3,4,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Disagree,Agree,Agree,Disagree,Neither agree nor disagree,3,4,2,1,5,3,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,2,4,1,3,5,7,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,2,5,3,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Agree,Agree,Somewhat agree,Neither agree nor disagree,5,3,4,1,2,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,3,4,1,2,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,3,2,4,1,5,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,3,4,1,2,5,TRUE,100,FALSE,80,TRUE,100,FALSE,60,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,70,FALSE,100,TRUE,100,FALSE,70,FALSE,50,TRUE,100,FALSE,91,TRUE,100,FALSE,50,FALSE,100,FALSE,50,FALSE,91,TRUE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,0,1,0,-1,2,-1,1,1,1,2,0,2,-1,-1,1,1,-2,-2,2,2,-2,0,3,1,-2,2,-2,1,3,1,2,2,0,2,7,-1,-1,1,1,-2,7,0,2,2,1,0,4,0,-1,0,-1,0,5,1,1,1,-1,2,7,-1,-1,-1,0,-2,7,TRUE,0,100,FALSE,0,80,TRUE,0,100,FALSE,1,60,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,FALSE,0,70,FALSE,1,50,TRUE,1,100,FALSE,1,91,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,91,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.49,0.8281,0,0.25,0,0.25,0.64,0.25,0.16,0,0.0081,0,0.25,0.09,0.25,0,0.25,0,1,1,1,0.25,1,0.284507143,0.204864286,0.36415,24,75,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,10,62.5,12,75,84.75,70,81.25,88.88,98.88,86.94,82.56,6.25,16,7.5,-6.25,26.38,36.38,24.44,7.56,0,0,0,2,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,2,0,1,0,0,1,1,0,0,0,2,1,0,0.6,0.6,0.2,0,0.8,0.6,0.4,0.6,0.35,0.6,0.475,4.33,5.33,5.375,-0.2,0,-0.2,-0.6,-0.133333333,-1,-2,0,0,-1,0,1,1,0,0,-1,1,0,0,-1,1,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,65,N/A,0.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,9,4,5,3,2,7,8,1,6,3,2,4,1 +284,R_6NZYksdGLAmX51p,67 - 73,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Somewhat agree,5,2,4,1,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,4,1,2,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,3,1,2,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,4,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,4,5,3,2,1,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,4,1,5,2,2,Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,3,2,5,1,6,Agree,Agree,Agree,Somewhat agree,Agree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,5,1,3,2,4,8,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,1,2,4,5,3,3,Agree,Agree,Agree,Disagree,Strongly agree,3,5,4,2,1,3,Agree,Somewhat disagree,Neither agree nor disagree,Agree,Agree,5,2,3,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,60,TRUE,100,TRUE,100,FALSE,60,TRUE,55,TRUE,100,TRUE,100,TRUE,100,TRUE,60,TRUE,100,TRUE,80,FALSE,100,TRUE,100,TRUE,100,TRUE,80,TRUE,100,FALSE,55,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,53,TRUE,100,TRUE,100,FALSE,80,FALSE,53,FALSE,57,TRUE,100,TRUE,100,FALSE,59,20,3,3,2,2,1,1,0,1,0,1,2,1,3,0,3,-1,-1,1,1,-1,3,3,3,3,1,4,2,-1,3,-1,1,1,2,2,3,-1,3,2,2,2,2,1,2,6,3,3,3,3,-1,3,1,-1,2,0,1,8,2,2,2,-2,3,3,2,-1,0,2,2,3,FALSE,1,59,TRUE,1,100,TRUE,0,100,FALSE,1,57,FALSE,0,53,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,0,53,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,55,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0.04,0,0,0,0,0,0,0.2809,0,0.2809,0,0.36,0.1849,0.16,1,0.04,0.3025,1,1,0.64,0.3025,0.36,0.1681,1,1,1,1,0.361421429,0.081907143,0.640935714,20,62.5,18,56.25,3,37.5,4,50,5,62.5,6,75,12,75,6,37.5,86,72.5,81.62,94.88,95,87.56,84.44,6.25,29.75,35,31.62,32.38,20,12.56,46.94,0,0,1,1,0,1,1,2,1,0,0,1,0,1,0,3,3,1,0,3,0,0,1,1,2,0,1,1,0,0,0,1,1,2,0,3,0,1,1,3,0.4,1,0.4,2,0.8,0.4,0.8,1.6,0.95,0.9,0.925,2.33,4.67,3.75,-0.4,0.6,-0.4,0.4,-0.066666667,1,-7,-1,3,-2.34,0,2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),68,no comment,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,2,8,6,5,3,4,9,1,7,3,2,4,1 +285,R_5mEnAkIrRgTZ6SP,60 - 66,,Canadian,Canadian,Female,Neither agree nor disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,3,5,2,1,4,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Strongly agree,3,2,5,4,1,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,2,1,4,3,5,Somewhat agree,Agree,Agree,Strongly Agree,Agree,2,1,5,4,3,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,1,2,4,7,Strongly agree,Disagree,Neither agree nor disagree,Strongly disagree,Strongly agree,5,3,4,2,1,8,Agree,Agree,Somewhat Agree,Disagree,Agree,2,4,3,1,5,4,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,1,4,2,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Agree,Agree,Disagree,1,5,3,4,2,8,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,1,4,5,7,Somewhat Disagree,Somewhat Agree,Agree,Disagree,Somewhat Agree,5,2,3,1,4,7,Agree,Disagree,Agree,Strongly Agree,Agree,3,4,5,1,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,96,TRUE,95,FALSE,100,FALSE,62,TRUE,98,FALSE,100,TRUE,99,FALSE,100,TRUE,66,FALSE,100,TRUE,50,TRUE,98,FALSE,100,TRUE,87,TRUE,93,FALSE,52,FALSE,100,TRUE,70,TRUE,91,TRUE,91,TRUE,100,TRUE,90,TRUE,51,TRUE,100,FALSE,100,FALSE,86,FALSE,50,FALSE,100,TRUE,100,TRUE,92,27,0,1,3,-2,1,1,-2,1,-1,3,2,1,2,2,1,1,2,2,3,2,2,1,1,-1,1,7,3,-2,0,-3,3,8,2,2,1,-2,2,4,2,2,2,1,1,8,0,2,2,2,-2,8,2,1,1,1,0,7,-1,1,2,-2,1,7,2,-2,2,3,2,4,TRUE,0,92,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,86,FALSE,1,100,TRUE,1,100,TRUE,1,51,TRUE,1,90,TRUE,1,100,TRUE,0,91,TRUE,0,91,TRUE,1,70,FALSE,1,100,FALSE,0,52,TRUE,1,93,TRUE,0,87,FALSE,1,100,TRUE,0,98,TRUE,0,50,FALSE,0,100,TRUE,1,66,FALSE,1,100,TRUE,1,99,FALSE,1,100,TRUE,1,98,FALSE,1,62,FALSE,1,100,TRUE,0,95,FALSE,0,96,TRUE,1,100,TRUE,1,100,0.2401,0.0004,0.0049,0,0,0,0.0001,0,0.25,0.1156,0.9216,0.09,0.01,0.8281,0.7396,0,0,0.25,0,0,1,0.2704,0.9604,0,0.7569,0.1444,0,0.8464,0,0,0.9025,0.8281,0.318360714,0.228928571,0.407792857,27,84.38,21,65.63,5,62.5,4,50,7,87.5,5,62.5,12,75,9,56.25,88.03,80.38,92.25,94.5,85,87.56,88.5,18.75,22.4,17.88,42.25,7,22.5,12.56,32.25,2,0,2,1,0,2,0,1,2,0,0,1,1,4,1,1,0,0,2,1,0,1,1,4,3,1,3,0,2,3,3,0,0,4,0,1,4,0,0,0,1,1,1.4,0.8,1.8,1.8,1.4,1,1.05,1.5,1.275,6.33,7.33,6.625,-0.8,-0.8,0,-0.2,-0.533333333,-1,1,-3,4,-1,-1,1,1,-2,2,1,-1,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),60,,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,9,5,8,6,3,4,7,1,2,4,3,2,1 +286,R_3FhNNeBDsPUEbj5,53 - 59,American,,American,Male,Neither agree nor disagree,Agree,Agree,Disagree,Agree,4,2,1,5,3,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,3,4,2,Somewhat Agree,Disagree,Agree,Disagree,Agree,4,3,1,2,5,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,2,4,3,5,1,Somewhat disagree,Agree,Agree,Disagree,Agree,5,3,1,4,2,4,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,2,4,5,3,1,3,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Agree,1,3,4,5,2,4,Disagree,Disagree,Disagree,Disagree,Disagree,1,2,4,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,1,2,4,5,3,5,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,5,4,3,1,2,3,Somewhat Agree,Disagree,Agree,Disagree,Agree,1,3,5,4,2,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,4,1,5,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,70,FALSE,100,TRUE,60,TRUE,60,FALSE,100,TRUE,71,FALSE,100,25,0,2,2,-2,2,-2,1,1,1,1,1,-2,2,-2,2,-2,-1,-1,-1,-2,-1,2,2,-2,2,4,-2,1,-1,1,2,3,1,-2,2,-1,2,4,-2,-2,-2,-2,-2,6,0,1,1,0,2,5,-2,-1,-1,-1,1,3,1,-2,2,-2,2,2,-1,-1,-1,1,-1,5,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,0,60,TRUE,1,60,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,1,0,0.09,0,0,0,0,0,0,0,0,0,0,0.16,0.0841,0.25,0.36,0,1,0,0.25,0.25,0,0.25,1,0.25,0,0,0,1,1,0.209075,0.061007143,0.357142857,25,78.13,22,68.75,3,37.5,6,75,6,75,7,87.5,13,81.25,9,56.25,87.84,72.62,82.5,96.25,100,87.56,88.12,9.38,19.09,35.12,7.5,21.25,12.5,6.31,31.87,1,0,0,0,0,0,0,2,0,1,0,0,0,1,0,0,1,1,1,0,0,1,1,2,0,0,2,2,2,0,0,0,0,0,0,1,0,0,2,1,0.2,0.6,0.2,0.6,0.8,1.2,0,0.8,0.4,0.7,0.55,3.67,3.33,4,-0.6,-0.6,0.2,-0.2,-0.333333333,-1,0,2,1,0.34,1,2,2,-1,1,-1,1,-2,2,-2,2,1,10 cents,5 minutes,15 days,Male,College Diploma/Certificate,55,,1.5,0,1,0,1,0,0,0.33,0.33,03VLPfPs,02COC,02FUT,01ITEM,02REV,3,6,2,5,4,8,9,1,7,2,3,4,1 +287,R_7gdKYBE0dYWcE3j,60 - 66,American,,American,Female,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,3,4,2,5,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Strongly agree,2,1,3,4,5,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,4,5,1,Strongly disagree,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,3,5,4,1,2,5,Agree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,5,4,2,1,4,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,4,3,2,1,5,5,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,2,4,5,1,7,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,3,5,1,2,4,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,2,1,2,Disagree,Disagree,Neither agree nor disagree,Disagree,Strongly disagree,1,2,5,3,4,FALSE,99,TRUE,62,FALSE,100,FALSE,64,TRUE,65,FALSE,100,TRUE,82,TRUE,100,TRUE,76,TRUE,95,FALSE,84,TRUE,89,TRUE,99,FALSE,100,TRUE,73,TRUE,100,FALSE,91,FALSE,100,TRUE,100,TRUE,66,FALSE,90,TRUE,100,TRUE,100,TRUE,100,FALSE,92,FALSE,74,TRUE,88,TRUE,75,TRUE,100,FALSE,90,TRUE,97,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,1,3,1,-1,2,1,3,2,0,3,1,3,-3,-3,-2,0,-3,3,3,3,1,-1,1,2,-2,3,0,3,5,2,2,2,1,3,4,-3,-3,-3,1,-3,5,3,3,3,3,0,0,0,-3,0,-3,1,7,3,3,3,3,3,7,-2,-2,0,-2,-3,2,FALSE,1,99,TRUE,1,62,FALSE,1,100,FALSE,1,64,TRUE,1,65,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,76,TRUE,1,95,FALSE,1,84,TRUE,0,89,TRUE,1,99,FALSE,1,100,TRUE,1,73,TRUE,1,100,FALSE,1,91,FALSE,1,100,TRUE,0,100,TRUE,0,66,FALSE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,92,FALSE,0,74,TRUE,0,88,TRUE,0,75,TRUE,0,100,FALSE,0,90,TRUE,1,97,TRUE,1,100,0,0.5476,0,0.0324,0,0,0,0.0025,0.4356,0,0.81,0.0001,0.0576,0.0256,0.1225,0.1444,1,0.1296,0.5625,0.0064,0.81,0.0729,1,0,0.0081,0.7744,0.0009,0.0001,0,0,1,0.7921,0.276975,0.19485,0.3591,16,50,22,68.75,6,75,5,62.5,7,87.5,4,50,13,81.25,9,56.25,89.09,80.5,93.12,92.75,90,87.69,90.5,-18.75,20.34,5.5,30.62,5.25,40,6.44,34.25,2,0,0,0,4,1,1,1,1,0,0,2,1,0,0,0,0,1,1,0,2,0,0,2,3,1,2,2,4,2,1,3,0,2,0,1,1,2,2,0,1.2,0.8,0.6,0.4,1.4,2.2,1.2,1.2,0.75,1.5,1.125,3.33,4.67,3.875,-0.2,-1.4,-0.6,-0.8,-0.733333333,1,-2,-3,3,-1.34,2,1,2,-2,2,0,0,-2,2,-1,1,2,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,66, hard questions they could go either way,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,3,6,7,2,4,8,9,1,5,2,4,3,1 +288,R_1aftuJyleCr7sbn,67 - 73,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Somewhat disagree,5,3,1,2,4,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,1,5,4,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,3,2,4,5,Strongly disagree,Somewhat disagree,Disagree,Somewhat disagree,Disagree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly disagree,3,4,2,5,1,4,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,5,1,2,4,3,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,2,1,5,4,3,5,Disagree,Disagree,Disagree,Disagree,Disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,2,3,5,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,2,5,1,3,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Neither Agree nor Disagree,4,3,1,2,5,3,Disagree,Disagree,Disagree,Disagree,Disagree,1,5,4,2,3,TRUE,100,TRUE,66,FALSE,100,FALSE,100,TRUE,59,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,87,FALSE,100,FALSE,100,TRUE,59,TRUE,100,FALSE,100,TRUE,82,TRUE,89,FALSE,91,FALSE,95,TRUE,100,FALSE,90,TRUE,100,TRUE,100,TRUE,100,TRUE,88,FALSE,100,TRUE,81,FALSE,100,FALSE,100,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,1,-1,-1,-2,0,1,0,1,1,1,-1,1,-3,-1,-2,-1,-2,1,1,2,0,-3,2,-1,1,-1,1,-1,4,2,2,1,-1,2,3,-2,-2,-2,-2,-2,5,1,1,1,1,-2,2,0,0,1,1,-1,5,1,1,2,-1,0,3,-2,-2,-2,-2,-2,3,TRUE,0,100,TRUE,1,66,FALSE,1,100,FALSE,1,100,TRUE,1,59,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,87,FALSE,0,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,FALSE,1,100,TRUE,0,82,TRUE,0,89,FALSE,1,91,FALSE,0,95,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,TRUE,0,81,FALSE,0,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,1,0.0081,0,1,1,1,1,0.1681,0.1156,0.01,0,0,1,0.9025,0.1681,0.7921,0,0,0.7744,1,1,0,0.6724,0.6561,0.7569,0.465153571,0.3787,0.551607143,26,81.25,18,56.25,3,37.5,5,62.5,4,50,6,75,10,62.5,8,50,93.34,87.75,90.62,97.75,97.25,92.44,94.25,25,37.09,50.25,28.12,47.75,22.25,29.94,44.25,1,1,0,1,2,0,3,1,0,1,1,1,0,0,1,1,1,0,1,0,1,1,1,0,1,1,2,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0.6,0.6,0.8,1,0.4,0.6,0.8,0.7,0.75,3,3.33,3.375,0.2,0,0.2,0,0.133333333,0,-1,0,2,-0.33,1,1,0,-1,1,0,0,0,0,1,-1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),67,,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,8,6,5,2,9,3,7,1,4,3,2,4,1 +289,R_38UI4Nfo4ZxgWvT,60 - 66,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,5,1,2,4,3,Disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,2,5,1,4,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,1,3,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,1,4,2,3,5,3,Disagree,Disagree,Agree,Disagree,Somewhat agree,4,3,5,1,2,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,3,1,5,2,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,1,3,2,5,4,2,Disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,5,4,1,2,3,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,2,3,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,5,4,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,87,FALSE,90,TRUE,100,FALSE,100,TRUE,79,TRUE,95,FALSE,88,TRUE,89,TRUE,86,TRUE,95,FALSE,85,FALSE,100,FALSE,73,FALSE,81,FALSE,100,TRUE,100,TRUE,59,FALSE,100,TRUE,90,FALSE,88,TRUE,59,TRUE,92,TRUE,94,TRUE,70,TRUE,77,FALSE,91,TRUE,62,TRUE,57,TRUE,59,TRUE,85,TRUE,85,21,3,3,3,-1,1,-2,0,2,-2,1,1,0,2,0,0,1,1,2,1,1,3,3,3,-2,1,6,-2,-2,2,-2,1,3,1,0,2,1,0,2,-1,-1,-1,-1,0,3,3,3,3,0,1,3,-2,0,2,-2,1,2,1,0,2,0,0,2,1,1,1,1,0,2,TRUE,0,85,TRUE,1,85,TRUE,0,59,TRUE,0,57,TRUE,1,62,FALSE,1,91,TRUE,1,77,TRUE,1,70,TRUE,1,94,TRUE,1,92,TRUE,0,59,FALSE,1,88,TRUE,1,90,FALSE,1,100,TRUE,1,59,TRUE,1,100,FALSE,1,100,FALSE,1,81,FALSE,1,73,FALSE,1,100,FALSE,0,85,TRUE,1,95,TRUE,0,86,TRUE,1,89,FALSE,1,88,TRUE,1,95,TRUE,0,79,FALSE,1,100,TRUE,0,100,FALSE,0,90,TRUE,1,87,TRUE,1,100,0.09,0.0025,0,0.0529,0,0.0081,0.0121,0.0064,0,0.0025,0.81,0.01,0.0036,0.3481,0.1444,0.0225,0.7396,0.3249,0,0.0144,0.7225,0.1681,0.0729,0,0,0.6241,0.0169,0.7225,0.3481,0.0361,1,0.0144,0.220435714,0.173728571,0.267142857,21,65.63,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,84.88,74.12,89.25,89.12,87,85.62,84.12,-6.25,13,11.62,26.75,1.62,12,-1.88,27.87,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,2,2,3,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0.2,0.4,0.2,2,0.2,0,0,0.4,0.7,0.15,0.425,3.67,2.33,2.875,0,0.4,0.2,1.6,0.2,3,1,0,1,1.34,0,1,1,-2,2,1,-1,0,0,-2,2,0,5 cents,5 minutes,24 days,Male,University - Undergraduate,62,,0.625,1,1,0,0,0,1,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,02REV,5,6,4,8,7,9,2,1,3,3,2,4,1 +290,R_5wjoMyBPGjBVmtp,53 - 59,American,,American,Male,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,3,4,2,5,1,Agree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,5,3,4,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Somewhat agree,Agree,Disagree,Somewhat agree,1,3,5,4,2,4,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,2,1,5,4,2,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,3,2,1,4,5,8,Agree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Somewhat agree,Strongly disagree,Agree,Agree,3,1,2,4,5,6,Disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat disagree,1,5,4,3,2,4,Somewhat Agree,Agree,Agree,Disagree,Somewhat Agree,2,4,1,3,5,9,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,3,1,4,TRUE,100,TRUE,85,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,85,TRUE,65,FALSE,80,TRUE,60,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,70,TRUE,80,TRUE,50,FALSE,90,TRUE,100,TRUE,100,FALSE,70,TRUE,85,FALSE,90,TRUE,100,FALSE,50,TRUE,75,TRUE,70,TRUE,95,TRUE,75,TRUE,85,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,-1,0,3,2,-2,1,1,1,3,3,3,2,3,-2,-2,-2,-3,-3,3,1,2,-2,1,3,1,1,2,2,0,4,1,3,2,3,1,2,2,1,2,2,1,8,1,1,-3,2,2,4,-2,1,1,3,-1,6,1,2,2,-2,1,4,-3,-3,-3,-3,-3,9,TRUE,0,100,TRUE,1,85,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,85,TRUE,1,65,FALSE,1,80,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,70,TRUE,0,80,TRUE,0,50,FALSE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,70,TRUE,1,85,FALSE,1,90,TRUE,1,100,FALSE,1,50,TRUE,0,75,TRUE,0,70,TRUE,1,95,TRUE,1,75,TRUE,1,85,0,0,0,0,0.0225,0,0.0225,0.1225,0.01,0,0.0025,0,0.0225,0.04,0,0.0225,0.09,0.25,0.5625,0.01,0,0.25,0.25,0,0.09,0.25,0.0625,1,1,0.64,0.49,0.36,0.198928571,0.043214286,0.354642857,26,81.25,25,78.13,7,87.5,7,87.5,6,75,5,62.5,16,100,9,56.25,83.12,65.62,86.88,91.88,88.12,89.06,77.19,3.12,4.99,-21.88,-0.62,16.88,25.62,-10.94,20.94,1,0,3,2,2,1,3,1,1,1,2,0,1,1,2,4,3,4,5,4,1,0,2,2,1,4,3,0,2,2,2,1,1,4,2,1,1,1,0,0,1.6,1.4,1.2,4,1.2,2.2,2,0.6,2.05,1.5,1.775,3,4.67,5,0.4,-0.8,-0.8,3.4,-0.4,-1,-2,-2,-1,-1.67,1,2,2,-1,1,1,-1,-1,1,-2,2,2,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),55,,1.25,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,9,8,5,7,4,2,3,1,6,3,4,2,1 +291,R_7Pmtr9gYRDIqooh,67 - 73,,Canadian,Canadian,Female,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Agree,2,5,4,1,3,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Somewhat agree,2,3,1,4,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,5,1,3,2,4,Disagree,Disagree,Somewhat disagree,Strongly disagree,Strongly disagree,2,3,4,5,1,Strongly disagree,Somewhat agree,Strongly Agree,Strongly disagree,Agree,5,3,1,2,4,2,Neither agree nor disagree,Strongly disagree,Agree,Neither agree nor disagree,Agree,5,1,4,2,3,6,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,5,4,3,2,1,2,Disagree,Strongly disagree,Disagree,Disagree,Strongly disagree,3,5,2,4,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Neither agree nor disagree,Strongly Agree,Agree,Somewhat agree,1,5,3,4,2,8,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,8,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,2,4,1,3,5,1,Strongly disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,5,1,2,4,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,95,FALSE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,95,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,95,TRUE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,1,3,-3,2,0,-3,2,-2,1,3,1,2,1,3,-2,-2,-1,-3,-3,-3,1,3,-3,2,2,0,-3,2,0,2,6,3,1,3,2,3,2,-2,-3,-2,-2,-3,2,-3,0,3,2,1,8,0,-2,2,0,1,8,3,1,2,1,3,1,-3,-2,-2,-3,-3,9,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,95,FALSE,0,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,95,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,95,TRUE,1,50,TRUE,1,100,0.25,0.25,0,0.0025,0,0.25,0.25,0,0.25,0.25,0.0025,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9025,1,0.25,0.25,0.25,1,1,1,0.25,1,0.371607143,0.17875,0.564464286,25,78.13,16,50,5,62.5,4,50,4,50,3,37.5,12,75,4,25,68.28,55.62,62.5,80.62,74.38,68.12,68.44,28.13,18.28,-6.88,12.5,30.62,36.88,-6.88,43.44,0,0,0,0,0,0,0,0,2,1,0,0,1,1,0,0,1,1,1,0,0,1,0,5,1,0,1,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0.6,0.4,0.6,1.4,0.6,0,0.4,0.4,0.6,0.5,3.33,5.67,4.75,-1.4,0,0.4,0.2,-0.333333333,-6,-2,1,-7,-2.34,2,2,2,-2,2,0,0,0,0,-2,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,,1.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,4,9,7,3,8,2,5,1,6,3,2,4,1 +292,R_7lWWWaqjZyxbpRv,53 - 59,American,,American,Female,Somewhat agree,Strongly agree,Somewhat agree,Agree,Strongly agree,3,1,4,5,2,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,1,4,5,2,3,Agree,Somewhat Disagree,Agree,Somewhat Agree,Strongly Agree,4,5,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Disagree,3,4,1,2,5,Strongly Agree,Somewhat agree,Agree,Strongly disagree,Somewhat agree,1,2,3,4,5,7,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,1,4,3,2,5,8,Agree,Agree,Agree,Somewhat Agree,Agree,1,2,5,3,4,4,Disagree,Disagree,Disagree,Disagree,Disagree,4,5,3,1,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,4,2,3,5,1,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,3,2,5,1,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,1,2,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,1,3,4,5,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,93,FALSE,95,TRUE,65,FALSE,60,FALSE,99,TRUE,97,TRUE,96,FALSE,73,TRUE,98,TRUE,91,TRUE,96,TRUE,87,TRUE,97,TRUE,78,TRUE,79,FALSE,81,FALSE,94,TRUE,88,TRUE,73,FALSE,86,TRUE,91,FALSE,67,TRUE,92,TRUE,89,TRUE,96,FALSE,61,TRUE,83,FALSE,61,TRUE,89,FALSE,68,TRUE,98,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,2,3,3,-3,3,-2,3,2,-1,2,1,3,3,3,3,2,-2,3,1,2,-3,1,7,1,1,3,1,-1,8,2,2,2,1,2,4,-2,-2,-2,-2,-2,9,2,3,1,0,3,2,3,-3,3,-3,3,1,3,-1,3,1,3,1,3,3,3,2,-1,1,TRUE,0,70,TRUE,1,93,FALSE,1,95,TRUE,0,65,FALSE,0,60,FALSE,1,99,TRUE,1,97,TRUE,1,96,FALSE,0,73,TRUE,1,98,TRUE,0,91,TRUE,0,96,TRUE,1,87,TRUE,0,97,TRUE,1,78,TRUE,1,79,FALSE,1,81,FALSE,1,94,TRUE,0,88,TRUE,0,73,FALSE,0,86,TRUE,1,91,FALSE,1,67,TRUE,1,92,TRUE,0,89,TRUE,1,96,FALSE,1,61,TRUE,0,83,FALSE,1,61,TRUE,1,89,FALSE,0,68,TRUE,1,98,0.0016,0.0016,0.0441,0.0009,0.0004,0.0001,0.0064,0.0004,0.5329,0.0081,0.0121,0.0169,0.5329,0.8281,0.36,0.0049,0.1089,0.4225,0.6889,0.7921,0.7396,0.0484,0.7744,0.9409,0.0361,0.1521,0.4624,0.49,0.0025,0.0036,0.1521,0.9216,0.322832143,0.202471429,0.443192857,18,56.25,19,59.38,3,37.5,6,75,5,62.5,5,62.5,12,75,7,43.75,84.09,77.12,79.88,91.5,87.88,86.31,81.88,-3.13,24.71,39.62,4.88,29,25.38,11.31,38.13,2,2,1,5,2,2,4,0,3,4,0,3,0,0,1,5,5,5,4,0,1,0,0,2,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,2.4,2.6,0.8,3.8,0.6,0.2,0.4,0.2,2.4,0.35,1.375,6.33,1.33,4.125,1.8,2.4,0.4,3.6,1.533333333,5,7,3,8,5,2,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),57,,1.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,8,6,2,3,5,9,7,1,4,2,4,3,1 +293,R_63D332NuCPnFAOe,32 - 38,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,4,3,2,5,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,5,3,4,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,5,4,3,Agree,Somewhat agree,Disagree,Disagree,Somewhat disagree,1,2,4,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,6,Strongly agree,Neither agree nor disagree,Agree,Strongly disagree,Agree,5,4,3,1,2,3,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,4,2,5,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly disagree,Somewhat agree,3,4,5,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,2,5,0,Agree,Agree,Strongly agree,Agree,Agree,1,2,5,4,3,0,Agree,Strongly Agree,Agree,Somewhat Disagree,Strongly Agree,4,2,1,5,3,0,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Strongly disagree,2,1,5,3,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,50,FALSE,100,32,1,3,3,3,2,2,1,3,1,2,3,3,3,-1,3,2,1,-2,-2,-1,3,3,3,3,3,6,3,0,2,-3,2,3,2,3,3,-1,3,4,0,1,1,-3,1,5,3,3,3,3,3,0,2,2,3,2,2,0,2,3,2,-1,3,0,1,1,1,2,-3,0,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0.25,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0.25,1,0.232142857,0.160714286,0.303571429,32,100,25,78.13,8,100,4,50,7,87.5,6,75,15,93.75,10,62.5,96.88,93.75,93.75,100,100,96.88,96.88,21.87,18.75,-6.25,43.75,12.5,25,3.13,34.38,2,0,0,0,1,1,1,1,4,0,1,0,0,0,0,2,0,3,1,2,2,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,3,4,2,0.6,1.4,0.2,1.6,0.6,0.4,0.4,2,0.95,0.85,0.9,4.33,0,2.25,0,1,-0.2,-0.4,0.266666667,6,3,4,5,4.33,0,1,0,-2,2,2,-2,1,-1,-1,1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),35,N/A,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,5,6,4,9,8,7,2,1,3,2,3,4,1 +294,R_3v32TkdVqdL7noW,53 - 59,,Canadian,Canadian,Female,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,3,5,4,1,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,5,2,4,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,4,1,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,2,4,3,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,5,1,4,2,4,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,3,2,4,1,5,3,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,4,5,3,2,3,Disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,3,5,4,2,1,3,Agree,Agree,Agree,Somewhat Disagree,Agree,2,4,5,1,3,3,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,2,3,4,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,32,0,1,2,1,1,-2,0,1,0,1,2,2,1,0,2,1,1,1,1,0,0,2,2,2,1,3,0,0,2,0,2,3,2,0,0,0,2,4,1,1,0,0,0,3,0,1,2,1,1,4,-2,-2,2,0,1,3,2,2,2,-1,2,3,2,1,1,1,2,3,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0.178571429,0.071428571,0.285714286,32,100,27,84.38,8,100,5,62.5,8,100,6,75,15,93.75,12,75,100,100,100,100,100,100,100,15.62,15.62,0,37.5,0,25,6.25,25,0,1,0,1,0,2,0,1,0,1,0,2,1,0,0,0,0,1,1,0,0,0,0,0,0,0,2,1,0,0,0,0,1,1,0,1,0,0,0,2,0.4,0.8,0.6,0.4,0,0.6,0.4,0.6,0.55,0.4,0.475,3.33,3.33,3.25,0.4,0.2,0.2,-0.2,0.266666667,-1,0,1,0,0,1,2,2,-2,2,0,0,2,-2,-2,2,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,54,no comments,1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,7,9,8,3,6,4,5,1,2,2,3,4,1 +295,R_5J9jfdbOIc1QKDy,67 - 73,American,,American,Female,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,5,4,2,1,3,Somewhat disagree,Somewhat disagree,Agree,Disagree,Somewhat disagree,3,4,5,1,2,Strongly Agree,Strongly Agree,Agree,Agree,Agree,2,1,4,3,5,Somewhat disagree,Disagree,Somewhat disagree,Somewhat agree,Disagree,4,2,5,3,1,Agree,Neither agree nor disagree,Agree,Disagree,Disagree,2,4,1,3,5,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,3,1,2,4,1,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,5,1,2,3,0,Disagree,Strongly disagree,Disagree,Somewhat disagree,Strongly disagree,3,4,1,2,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,3,5,1,4,2,1,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,4,3,5,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,5,2,3,4,1,Disagree,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,5,1,2,3,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,96,TRUE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,60,TRUE,100,TRUE,69,FALSE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,81,TRUE,90,TRUE,90,FALSE,90,FALSE,90,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,50,FALSE,80,FALSE,80,TRUE,100,FALSE,70,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,-1,-1,-2,-1,-1,-1,2,-2,-1,3,3,2,2,2,-1,-2,-1,1,-2,2,0,2,-2,-2,1,0,0,3,-3,0,1,3,3,2,2,3,0,-2,-3,-2,-1,-3,6,0,0,0,-3,-3,1,0,-2,3,-2,0,1,3,3,3,2,3,1,-2,-3,-1,0,-3,1,FALSE,1,96,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,69,FALSE,1,100,FALSE,0,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,81,TRUE,0,90,TRUE,0,90,FALSE,1,90,FALSE,0,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,50,FALSE,1,80,FALSE,1,80,TRUE,1,100,FALSE,0,70,TRUE,1,100,0,1,0,0,0,0,0,0,0.01,0,0,1,0.16,0.4761,0.25,0,0,0.25,0.04,0,0.81,0.25,0.81,1,0.0361,0.25,0.49,0.0016,1,0.81,0.04,0,0.274421429,0.153292857,0.39555,25,78.13,21,65.63,3,37.5,6,75,5,62.5,7,87.5,11,68.75,10,62.5,87.38,67.38,87.62,98.25,96.25,88.75,86,12.5,21.75,29.88,12.62,35.75,8.75,20,23.5,1,1,3,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,2,1,1,1,1,1,2,1,1,1,0,1,0,0,1,0,1,1,1,0,1,1,1.2,1,0.2,1.2,1.2,0.8,0.4,0.8,0.9,0.8,0.85,0.67,1,1.5,0,0.2,-0.2,0.4,0,0,0,-1,5,-0.33,0,0,1,-2,2,-1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,Professional Degree (ex. JD/MD),68,,0.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,5,9,4,3,2,7,6,1,8,3,4,2,1 +296,R_1rzHjl5vvoGnMI1,67 - 73,American,,American,Male,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,5,1,4,2,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,1,4,3,2,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,4,2,3,1,Strongly disagree,Somewhat agree,Strongly Agree,Somewhat disagree,Strongly Agree,4,5,3,1,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,4,2,5,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,5,2,1,4,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Disagree,1,3,4,2,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Disagree,Strongly Agree,Somewhat agree,Strongly Agree,4,5,3,1,2,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,3,4,2,6,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,1,2,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,2,5,3,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,70,FALSE,100,FALSE,51,TRUE,70,FALSE,100,FALSE,60,TRUE,65,TRUE,100,FALSE,50,FALSE,100,FALSE,71,FALSE,85,FALSE,90,TRUE,95,FALSE,50,TRUE,60,TRUE,70,TRUE,70,TRUE,70,TRUE,70,TRUE,50,TRUE,65,TRUE,100,TRUE,65,FALSE,50,TRUE,50,TRUE,100,TRUE,70,TRUE,70,21,-3,0,3,1,3,0,1,1,1,1,0,2,2,0,2,-1,-1,0,0,-3,-3,1,3,-1,3,6,1,1,1,1,1,5,0,2,2,0,2,5,-1,-1,1,-1,-2,6,-3,-2,3,1,3,6,0,1,1,1,1,6,0,3,1,0,2,5,0,0,0,0,-3,6,TRUE,0,70,TRUE,1,70,TRUE,0,100,TRUE,0,50,FALSE,0,50,TRUE,0,65,TRUE,1,100,TRUE,1,65,TRUE,1,50,TRUE,1,70,TRUE,0,70,TRUE,0,70,TRUE,1,70,TRUE,0,60,FALSE,0,50,TRUE,1,95,FALSE,1,90,FALSE,1,85,FALSE,1,71,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,65,FALSE,0,60,FALSE,1,100,TRUE,1,70,FALSE,1,51,FALSE,1,100,TRUE,0,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.1225,0.09,0.0025,0,0,0.4225,0.36,0.09,0,0,0,0.09,0.25,0.49,0.25,0.09,0.4225,0.25,0,0,0.25,0.25,0.0841,0.36,0.01,0.2401,0,0.49,1,0.0225,0.49,0.49,0.228632143,0.193928571,0.263335714,21,65.63,19,59.38,5,62.5,3,37.5,6,75,5,62.5,12,75,7,43.75,75.53,64,70,81.88,86.25,75,76.06,6.25,16.15,1.5,32.5,6.88,23.75,0,32.31,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,2,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0.6,0.2,0,0.6,0.4,0,0.4,0.4,0.35,0.3,0.325,5.33,5.67,5.625,0.2,0.2,-0.4,0.2,0,0,-1,0,0,-0.34,0,0,0,-1,1,0,0,0,0,0,0,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),72,This was fun and interesting.,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,6,7,4,8,3,9,2,1,5,3,4,2,1 +297,R_6qkiecRf87DHC9F,67 - 73,American,,American,Male,Somewhat agree,Disagree,Agree,Disagree,Disagree,2,5,3,1,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,3,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,4,3,1,5,2,Agree,Somewhat agree,Agree,Agree,Agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat disagree,5,2,1,3,4,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,3,5,2,4,3,Agree,Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,3,5,4,2,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Disagree,Agree,Disagree,Strongly disagree,4,3,5,2,1,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,5,2,4,1,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,5,3,4,1,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,3,5,TRUE,100,TRUE,86,FALSE,100,FALSE,52,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,70,TRUE,79,TRUE,100,TRUE,90,TRUE,98,TRUE,50,TRUE,92,FALSE,50,TRUE,100,TRUE,53,TRUE,57,FALSE,90,FALSE,51,FALSE,100,TRUE,53,FALSE,100,TRUE,84,TRUE,52,TRUE,98,FALSE,50,TRUE,98,TRUE,51,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,-2,2,-2,-2,-1,-1,1,1,-1,1,1,1,-1,0,2,1,2,2,2,2,0,2,-1,-1,2,-1,-1,1,-1,0,2,2,2,1,-1,0,3,1,1,1,1,1,4,1,-2,2,-2,-3,2,-1,-1,1,0,-1,1,1,1,1,-1,1,1,0,0,1,1,1,1,TRUE,0,100,TRUE,1,86,FALSE,1,100,FALSE,1,52,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,70,TRUE,0,79,TRUE,0,100,TRUE,1,90,TRUE,0,98,TRUE,1,50,TRUE,1,92,FALSE,1,50,TRUE,0,100,TRUE,0,53,TRUE,0,57,FALSE,0,90,FALSE,0,51,FALSE,1,100,TRUE,1,53,FALSE,1,100,TRUE,1,84,TRUE,0,52,TRUE,0,98,FALSE,1,50,TRUE,1,98,TRUE,1,51,TRUE,1,100,0,0.0256,0.0064,0,0,0.25,0.2209,0.09,0.3249,0.2601,0.0004,0.01,0.25,0.6241,0.25,0.0196,0,0.2304,0.9604,0,0.81,0.25,0.2809,0.9604,0.25,0.2704,0.2401,1,0,1,0.25,1,0.350092857,0.180742857,0.519442857,23,71.88,19,59.38,4,50,6,75,4,50,5,62.5,12,75,7,43.75,76.69,59.12,72.5,87.88,87.25,75.94,77.44,12.5,17.31,9.12,-2.5,37.88,24.75,0.94,33.69,1,2,0,1,1,0,0,0,2,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,2,1,1,1,1,1,0.6,0.4,0.8,0.2,0.2,0.2,1.2,0.7,0.45,0.575,2.33,1.33,2,0.8,0.4,0.2,-0.4,0.466666667,0,1,2,3,1,1,0,1,-2,2,-1,1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),69,No comments ,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,2,6,8,7,3,4,9,1,5,2,3,4,1 +298,R_6HTUWXqRQKtiHdf,53 - 59,,Canadian,Canadian,Female,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,2,3,5,4,1,Neither agree nor disagree,Strongly disagree,Agree,Agree,Agree,4,2,5,3,1,Somewhat Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,1,4,5,Strongly disagree,Disagree,Strongly disagree,Disagree,Disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Disagree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,2,5,1,3,9,Agree,Strongly disagree,Agree,Neither agree nor disagree,Strongly agree,5,2,3,4,1,6,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,3,5,2,1,4,9,Disagree,Somewhat disagree,Disagree,Somewhat disagree,Strongly disagree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,2,3,4,8,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat agree,Agree,2,4,3,1,5,7,Agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,4,1,3,5,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,5,3,1,FALSE,100,TRUE,88,TRUE,100,FALSE,50,TRUE,91,FALSE,100,TRUE,98,TRUE,100,TRUE,100,TRUE,100,TRUE,97,TRUE,100,TRUE,80,TRUE,100,TRUE,87,TRUE,94,FALSE,76,TRUE,100,TRUE,95,TRUE,100,TRUE,98,TRUE,80,TRUE,82,TRUE,100,FALSE,86,TRUE,99,TRUE,100,TRUE,94,TRUE,90,FALSE,77,TRUE,100,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,2,0,3,0,-3,2,2,2,1,2,3,0,3,-3,-2,-3,-2,-2,-2,3,3,-2,3,8,2,-3,2,0,3,9,-1,0,0,1,2,6,-2,-1,-2,-1,-3,9,0,3,3,2,3,8,0,-3,3,1,2,8,2,1,3,0,3,7,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,88,TRUE,0,100,FALSE,1,50,TRUE,1,91,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,97,TRUE,0,100,TRUE,1,80,TRUE,0,100,TRUE,1,87,TRUE,1,94,FALSE,1,76,TRUE,0,100,TRUE,0,95,TRUE,0,100,TRUE,1,98,TRUE,1,80,TRUE,0,82,TRUE,1,100,FALSE,1,86,TRUE,1,99,TRUE,0,100,TRUE,0,94,TRUE,0,90,FALSE,0,77,TRUE,1,100,TRUE,1,100,0,0.0001,0.0036,0.0004,0,0,0,0,1,0.04,0.5929,0.04,0,0.9409,0.0081,0.0144,0.6724,0.25,0.8836,0.0196,0.0004,0.0169,0.9025,1,0.0576,1,0,0,1,1,0.81,1,0.401760714,0.254192857,0.549328571,26,81.25,20,62.5,5,62.5,6,75,6,75,3,37.5,15,93.75,5,31.25,92.56,89.62,89.62,95.38,95.62,93.25,91.88,18.75,30.06,27.12,14.62,20.38,58.12,-0.5,60.63,2,0,1,2,0,2,0,0,2,1,2,2,3,1,1,1,1,1,1,1,0,0,1,2,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,1,1,1.8,1,0.6,0.4,0.4,0.6,1.2,0.5,0.85,7.67,7.67,7.5,0.4,0.6,1.4,0.4,0.8,0,1,-1,4,0,2,1,1,-2,2,1,-1,1,-1,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,57,,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,5,3,7,2,6,8,4,1,9,4,3,2,1 +299,R_3q4JHgQQI86k13W,67 - 73,American,,American,Male,Somewhat agree,Strongly disagree,Disagree,Agree,Strongly disagree,5,1,3,2,4,Disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,4,3,1,2,5,Agree,Somewhat Agree,Agree,Disagree,Somewhat Disagree,5,2,4,1,3,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,1,2,3,5,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,4,1,3,2,10,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Disagree,2,5,4,3,1,10,Agree,Somewhat Agree,Agree,Disagree,Somewhat Disagree,3,2,5,4,1,8,Disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,3,1,2,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,1,5,4,2,3,8,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,1,3,2,5,8,Agree,Agree,Agree,Disagree,Somewhat Disagree,4,5,2,3,1,8,Strongly disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,3,1,4,2,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,32,1,-3,-2,2,-3,-2,-3,2,-2,-1,2,1,2,-2,-1,-1,-1,2,0,2,0,-1,-1,0,-1,10,-3,-3,3,-3,-2,10,2,1,2,-2,-1,8,-2,-2,0,-2,-2,10,2,0,0,2,-2,8,-3,-3,3,-3,-3,8,2,2,2,-2,-1,8,-3,-2,0,-2,-2,8,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,0,100,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0.464285714,0.642857143,0.285714286,32,100,19,59.38,4,50,4,50,5,62.5,6,75,4,25,15,93.75,100,100,100,100,100,100,100,40.62,40.62,50,50,37.5,25,75,6.25,1,2,1,2,2,1,0,1,1,1,0,0,0,0,0,1,1,2,2,4,1,3,2,0,1,1,0,1,1,2,0,1,0,0,0,2,1,2,2,4,1.6,0.8,0,2,1.4,1,0.2,2.2,1.1,1.2,1.15,9.33,8,8.75,0.2,-0.2,-0.2,-0.2,-0.066666667,2,2,0,2,1.33,-2,-1,-2,-1,1,-2,2,1,-1,-1,1,-1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),71,,-0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,2,3,9,7,8,6,5,1,4,4,3,2,1 +300,R_17KcLcxoWWcjhtD,18 - 24,American,,American,Male,Somewhat disagree,Strongly agree,Agree,Disagree,Strongly agree,1,3,4,5,2,Strongly agree,Somewhat disagree,Agree,Disagree,Strongly agree,1,4,2,5,3,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Strongly Agree,3,4,1,2,5,Somewhat agree,Agree,Strongly Agree,Agree,Strongly Agree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Somewhat agree,Disagree,Somewhat disagree,5,1,4,3,2,4,Disagree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,1,2,5,4,3,0,Somewhat Disagree,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,3,5,4,2,1,3,Agree,Strongly Agree,Somewhat disagree,Agree,Somewhat agree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat disagree,Agree,1,3,5,4,2,5,Disagree,Somewhat disagree,Somewhat agree,Strongly disagree,Agree,3,2,4,5,1,2,Agree,Agree,Somewhat Agree,Strongly agree,Somewhat Agree,4,2,3,1,5,3,Agree,Somewhat disagree,Strongly Agree,Somewhat agree,Agree,5,2,1,4,3,FALSE,81,TRUE,73,FALSE,71,FALSE,80,TRUE,100,FALSE,100,FALSE,73,FALSE,62,TRUE,78,FALSE,80,FALSE,100,FALSE,88,TRUE,87,FALSE,82,FALSE,85,TRUE,77,FALSE,95,FALSE,61,TRUE,72,FALSE,100,FALSE,100,FALSE,100,TRUE,67,FALSE,86,FALSE,71,FALSE,57,FALSE,83,FALSE,100,FALSE,76,TRUE,81,TRUE,76,FALSE,90,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,2,-2,3,3,-1,2,-2,3,1,0,3,2,3,1,2,3,2,3,2,1,1,-2,-1,4,-2,-2,3,-3,1,4,-1,1,2,3,1,0,2,3,-1,2,1,3,1,3,1,-1,2,7,-2,-1,1,-3,2,5,2,2,1,3,1,2,2,-1,3,1,2,3,FALSE,1,81,TRUE,1,73,FALSE,1,71,FALSE,1,80,TRUE,1,100,FALSE,1,100,FALSE,0,73,FALSE,0,62,TRUE,1,78,FALSE,0,80,FALSE,1,100,FALSE,1,88,TRUE,1,87,FALSE,1,82,FALSE,0,85,TRUE,1,77,FALSE,1,95,FALSE,1,61,TRUE,0,72,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,67,FALSE,0,86,FALSE,1,71,FALSE,0,57,FALSE,1,83,FALSE,1,100,FALSE,1,76,TRUE,1,81,TRUE,1,76,FALSE,0,90,0.3844,0.3249,0.0529,0.5329,0.81,0,0.7396,0.64,0,1,0.0361,0.0169,0.0484,0,0,0.0729,0.4489,0.04,0,0.0841,1,0.7225,0.5184,0.0324,0.0025,0.0289,0.0576,0.0361,0.0841,0.1521,0.0576,0.0144,0.237267857,0.2752,0.199335714,16,50,21,65.63,6,75,5,62.5,4,50,6,75,7,43.75,14,87.5,82.25,80.88,89.38,75.62,83.12,81.56,82.94,-15.63,16.62,5.88,26.88,25.62,8.12,37.81,-4.56,3,2,1,0,4,5,1,1,1,2,2,1,1,1,2,1,1,4,0,2,2,0,1,1,1,5,0,1,1,1,1,2,2,1,2,1,3,0,1,1,2,2,1.4,1.6,1,1.6,1.6,1.2,1.75,1.35,1.55,2.67,4.67,3.5,1,0.4,-0.2,0.4,0.4,-3,-1,-2,0,-2,0,1,2,-2,2,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),24,The survey was different and interesting,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,5,3,4,8,7,2,6,1,9,3,4,2,1 +301,R_6P0kamWHi489yyl,25 - 31,American,,American,Female,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,4,5,3,1,2,Disagree,Somewhat disagree,Agree,Disagree,Agree,3,2,5,1,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Agree,4,1,5,3,2,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,1,4,5,2,3,Agree,Agree,Agree,Strongly Agree,Agree,5,3,1,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,1,3,4,Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Agree,4,5,2,1,3,4,Agree,Strongly Agree,Agree,Agree,Somewhat agree,2,4,3,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly Agree,Strongly Agree,3,2,5,1,4,3,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,2,4,3,1,1,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,2,4,1,3,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,5,4,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,TRUE,100,FALSE,82,TRUE,100,FALSE,75,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,95,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,91,FALSE,90,FALSE,93,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,95,FALSE,100,TRUE,94,TRUE,100,TRUE,94,TRUE,100,FALSE,100,29,3,2,2,3,3,-2,-1,2,-2,2,1,1,3,-1,2,2,3,3,1,2,2,2,2,3,2,3,0,0,1,1,1,4,2,3,1,-1,2,4,2,3,2,2,1,4,3,2,2,3,3,3,2,1,0,1,0,1,0,1,1,1,0,3,3,3,3,3,2,9,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,93,FALSE,0,90,FALSE,1,91,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,95,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,100,FALSE,0,82,TRUE,1,100,TRUE,1,95,0,0,0,0.0025,0.0025,0,0,0,1,0,0.6724,0.81,0,0,0.0036,0,0,1,0.0625,0,1,0,0.0025,0.0081,0,0,0,0,0.8836,0,1,0.0049,0.230360714,0.249178571,0.211542857,29,90.63,25,78.13,7,87.5,5,62.5,8,100,5,62.5,13,81.25,12,75,97,99.38,97.38,98.25,93,97.25,96.75,12.5,18.87,11.88,34.88,-1.75,30.5,16,21.75,1,0,0,0,1,2,1,1,3,1,1,2,2,0,0,0,0,1,1,1,0,0,0,0,0,4,2,2,3,2,1,0,2,2,2,1,0,0,2,0,0.4,1.6,1,0.6,0,2.6,1.4,0.6,0.9,1.15,1.025,3.67,2.33,3.875,0.4,-1,-0.4,0,-0.333333333,0,3,1,-5,1.34,1,1,2,-2,2,1,-1,-1,1,-1,1,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),29,i like this survey very funny,1.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,8,7,4,3,5,9,6,1,2,3,4,2,1 +302,R_6hXuPjXu4GtwAxl,60 - 66,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,2,4,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly agree,5,3,1,4,2,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,5,2,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,2,1,Strongly disagree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,1,2,3,5,5,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,1,3,4,2,5,5,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,3,1,2,4,7,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Strongly Agree,5,3,4,2,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,1,4,3,1,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,4,1,5,2,8,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,3,4,2,5,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,3,3,3,-1,1,-1,1,3,1,1,3,0,2,3,3,3,3,3,-3,3,3,-2,3,5,2,1,2,0,2,5,1,2,2,0,2,7,-1,-1,0,-1,3,8,-3,3,3,3,3,1,2,0,3,0,3,8,2,1,2,0,2,7,3,3,3,3,3,1,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,1,0.535714286,0.428571429,0.642857143,25,78.13,16,50,2,25,4,50,5,62.5,5,62.5,10,62.5,6,37.5,100,100,100,100,100,100,100,28.13,50,75,50,37.5,37.5,37.5,62.5,0,0,0,5,0,3,0,3,1,1,0,1,1,0,0,4,4,3,4,0,0,0,0,0,0,3,1,4,1,0,1,0,1,0,0,0,0,0,0,0,1,1.6,0.4,3,0,1.8,0.4,0,1.5,0.55,1.025,5.67,5.33,5.25,1,-0.2,0,3,0.266666667,4,-3,0,7,0.34,1,1,2,-2,2,1,-1,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),63,,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,3,9,4,8,5,7,2,1,6,2,4,3,1 +303,R_7O3X2HkbSJtBspb,25 - 31,American,,American,Male,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Strongly agree,5,4,2,1,3,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,3,2,4,1,5,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,5,2,3,1,Agree,Strongly Agree,Agree,Strongly Agree,Strongly disagree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Disagree,Strongly Agree,Somewhat agree,Neither agree nor disagree,3,2,5,1,4,8,Strongly disagree,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,1,5,3,2,4,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,5,2,8,Somewhat disagree,Disagree,Strongly disagree,Somewhat disagree,Strongly disagree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Strongly Agree,1,2,3,5,4,2,Strongly agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,1,4,5,2,3,1,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,3,2,5,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,3,2,1,4,5,TRUE,75,FALSE,52,TRUE,55,TRUE,75,TRUE,57,TRUE,50,TRUE,75,TRUE,75,TRUE,80,TRUE,70,FALSE,50,TRUE,90,TRUE,86,FALSE,100,FALSE,70,TRUE,100,TRUE,80,TRUE,76,TRUE,86,FALSE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,65,TRUE,50,TRUE,60,FALSE,50,TRUE,70,TRUE,50,FALSE,50,TRUE,80,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,0,-3,3,1,-3,1,-3,3,0,-3,3,-3,3,2,3,2,3,-3,2,-2,3,1,0,5,-3,0,-2,1,0,8,0,-3,3,-3,3,2,-1,-2,-3,-1,-3,8,2,1,0,-3,3,5,3,-3,1,-3,3,2,0,-3,3,-3,3,1,3,3,3,3,-3,3,TRUE,0,75,FALSE,0,52,TRUE,0,55,TRUE,0,75,TRUE,1,57,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,1,80,TRUE,1,70,FALSE,1,50,TRUE,0,90,TRUE,1,86,FALSE,1,100,FALSE,0,70,TRUE,1,100,TRUE,0,80,TRUE,0,76,TRUE,0,86,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,65,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,0,70,TRUE,1,50,FALSE,0,50,TRUE,1,80,0.0625,0.25,0,0.0625,0.04,0.25,0,0.09,0,0,0.25,0.0196,0.04,0.25,0.1849,0.2704,0.25,0.5625,0.25,0.4225,0.25,0.49,0.7396,0,0.64,0.36,0.25,0.5625,0.3025,0.5776,0.49,0.81,0.298289286,0.157671429,0.438907143,10,31.25,16,50,2,25,3,37.5,5,62.5,6,75,12,75,4,25,71.16,65.38,65.38,76.38,77.5,71.56,70.75,-18.75,21.16,40.38,27.88,13.88,2.5,-3.44,45.75,0,3,3,4,3,4,3,3,4,3,0,0,0,0,0,3,5,5,4,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2.6,3.4,0,3.4,0,0.4,0,0.4,2.35,0.2,1.275,5,2.67,4.25,2.6,3,0,3,1.866666667,0,6,1,5,2.33,2,2,2,-2,2,0,0,-2,2,-2,2,0,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,30,That was an interesting survey. I wasn't really sure of my answers but I answered what I thought.,1.5,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,8,3,2,5,6,7,4,1,9,4,3,2,1 +304,R_71qUGxUVNF7HhaF,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,4,1,3,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,3,1,4,5,Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,2,1,3,5,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,3,5,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,2,5,3,4,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,5,1,2,3,3,Agree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,3,2,4,1,1,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,2,1,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,4,5,3,2,1,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,2,4,5,1,Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,4,2,1,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,4,1,2,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,76,TRUE,81,FALSE,100,TRUE,54,TRUE,87,TRUE,100,TRUE,91,FALSE,100,TRUE,81,FALSE,50,FALSE,53,TRUE,53,TRUE,76,TRUE,76,TRUE,91,TRUE,50,FALSE,100,TRUE,81,TRUE,82,TRUE,50,FALSE,100,TRUE,91,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,50,TRUE,87,TRUE,82,24,3,3,3,0,3,1,-3,3,-3,2,2,-3,3,0,3,0,2,2,2,0,3,3,3,0,3,2,1,-3,3,-3,3,3,2,-3,2,0,3,1,-1,1,0,-1,-1,5,3,3,3,1,3,2,1,-3,3,-3,2,1,2,-3,3,0,3,1,3,3,3,3,0,1,TRUE,0,82,TRUE,1,87,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,100,TRUE,0,50,TRUE,0,82,TRUE,1,81,FALSE,1,100,TRUE,1,50,TRUE,1,91,TRUE,0,76,TRUE,0,76,TRUE,0,53,FALSE,1,53,FALSE,0,50,TRUE,1,81,FALSE,1,100,TRUE,1,91,TRUE,0,100,TRUE,1,87,TRUE,0,54,FALSE,1,100,TRUE,0,81,TRUE,1,76,TRUE,1,50,TRUE,1,100,0,0.0169,0.0081,0,0,0,0.0081,1,0.2209,0.0361,0.0576,0.0361,0.0081,0.25,0,0.0169,0,0.25,0,1,0.25,0.25,0.2809,0,0.5776,0.2916,0.25,0.6724,0.25,0.5776,0.6561,0.6724,0.271871429,0.134557143,0.409185714,24,75,20,62.5,4,50,5,62.5,4,50,7,87.5,14,87.5,6,37.5,79.44,60.62,86,90.75,80.38,83.44,75.44,12.5,16.94,10.62,23.5,40.75,-7.12,-4.06,37.94,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,2,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,3,1,1,1,0,0,0.2,0.2,1.6,0.2,0,0,1.2,0.5,0.35,0.425,2,1.33,2,-0.2,0.2,0.2,0.4,0.066666667,0,2,0,4,0.67,0,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,"interesting, never took a survey like this before.",1.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,5,4,6,3,7,2,9,1,8,3,4,2,1 +305,R_7nhQXDvCukJnMvT,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,4,2,1,3,5,Agree,Disagree,Somewhat agree,Neither agree nor disagree,Agree,4,1,5,3,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,2,5,1,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Somewhat disagree,Somewhat agree,Somewhat agree,4,2,1,5,3,3,Strongly agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,2,3,3,Agree,Strongly Disagree,Strongly Agree,Agree,Strongly Agree,3,5,2,1,4,5,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,4,2,5,3,1,1,Agree,Strongly disagree,Agree,Neither agree nor disagree,Strongly agree,2,1,4,3,5,2,Somewhat Agree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,5,4,2,1,4,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,FALSE,100,FALSE,87,FALSE,100,TRUE,53,TRUE,100,FALSE,100,TRUE,96,TRUE,100,TRUE,76,TRUE,100,TRUE,100,TRUE,100,FALSE,67,FALSE,100,FALSE,100,TRUE,100,TRUE,81,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,76,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,2,3,2,-2,1,0,2,0,-3,3,1,3,2,2,2,2,0,2,3,-1,1,1,5,3,-1,1,1,1,3,2,-3,3,2,3,3,-1,0,-1,-1,-1,5,3,3,1,2,3,1,2,-3,2,0,3,1,1,-3,3,0,3,2,2,2,2,2,2,4,FALSE,1,100,FALSE,0,87,FALSE,1,100,TRUE,0,53,TRUE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,76,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,67,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,81,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,76,TRUE,1,100,0,0,0,0.0016,0,0,0,0,0,0,0,0.4489,0.0576,1,0,0.7569,0,0.2809,0,0,0,1,1,0,0.6561,1,0.5776,0,0,0,1,1,0.3135,0.181735714,0.445264286,28,87.5,21,65.63,1,12.5,5,62.5,8,100,7,87.5,12,75,9,56.25,94.88,86.5,93.5,99.5,100,93.88,95.88,21.87,29.25,74,31,-0.5,12.5,18.88,39.63,1,0,3,1,2,1,1,0,1,1,2,0,0,1,0,3,2,3,3,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,2,1.4,0.8,0.6,2.4,0.2,0.6,0.4,0.4,1.3,0.4,0.85,3.67,1.33,3,1.2,0.2,0.2,2,0.533333333,4,2,1,1,2.34,2,2,1,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,15 days,Female,University - Undergraduate,53,This was a very interesting survey!,1.625,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,2,4,5,6,3,8,9,1,7,3,2,4,1 +306,R_7pYaXLvoeSp5urG,39 - 45,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Agree,1,2,4,5,3,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,2,3,4,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,4,2,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Agree,4,5,3,2,1,1,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,3,2,1,5,4,1,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,1,3,2,4,5,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Agree,5,1,4,3,2,1,Somewhat agree,Disagree,Agree,Somewhat disagree,Strongly agree,2,4,5,3,1,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,4,5,2,1,3,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,1,2,4,5,FALSE,97,TRUE,96,FALSE,94,FALSE,50,TRUE,90,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,85,TRUE,50,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,88,TRUE,60,TRUE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,75,TRUE,100,TRUE,50,TRUE,94,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,0,2,1,-1,0,-1,3,0,0,3,0,3,0,1,1,0,-1,3,3,2,-1,2,2,2,1,0,0,3,1,-1,0,3,1,3,1,0,1,0,0,0,5,3,3,2,0,2,1,1,-2,2,-1,3,1,0,0,3,-2,3,0,2,2,2,1,1,2,FALSE,1,97,TRUE,1,96,FALSE,1,94,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,85,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,88,TRUE,0,60,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,TRUE,1,100,TRUE,1,50,TRUE,1,94,0,0,0,0,0.0036,0,0,0,0.25,0,0,0,0,0.0225,0.01,0.0016,0,0.25,0,0,0.25,0.25,0.36,0,0.25,0.25,0.25,0.0009,0.0036,0.7744,0.5625,0.25,0.133539286,0.038407143,0.228671429,22,68.75,24,75,6,75,5,62.5,7,87.5,6,75,15,93.75,9,56.25,83.72,67.62,82.38,98.12,86.75,89.38,78.06,-6.25,8.72,-7.38,19.88,10.62,11.75,-4.37,21.81,0,0,0,1,0,1,2,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,2,0,2,1,1,1,2,0.2,0.8,0.4,0.4,0,0.6,0.4,1.4,0.45,0.6,0.525,1.33,0.67,1.625,0.2,0.2,0,-1,0.133333333,1,0,1,3,0.66,1,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,5 minutes,47 days,Female,High School (or equivalent),44,,1.875,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,9,7,6,2,8,3,4,1,5,2,3,4,1 +307,R_3NxJttisIIAEUus,60 - 66,American,,American,Female,Strongly agree,Agree,Agree,Disagree,Agree,1,3,2,4,5,Disagree,Somewhat disagree,Agree,Disagree,Agree,4,3,5,2,1,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,2,1,5,4,Somewhat agree,Agree,Strongly Agree,Agree,Disagree,3,2,1,5,4,Strongly Agree,Agree,Agree,Strongly disagree,Agree,1,3,2,5,4,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,4,3,5,2,3,Somewhat Agree,Somewhat Agree,Agree,Strongly Agree,Agree,5,1,2,3,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,5,2,4,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Neither agree nor disagree,Strongly Agree,3,5,2,1,4,0,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Somewhat agree,3,5,1,2,4,0,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,1,2,5,4,0,Agree,Agree,Agree,Agree,Somewhat disagree,4,5,2,1,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,TRUE,99,TRUE,98,TRUE,98,TRUE,99,FALSE,86,TRUE,94,TRUE,90,TRUE,97,FALSE,100,TRUE,92,TRUE,100,FALSE,100,TRUE,88,FALSE,97,FALSE,100,TRUE,100,TRUE,81,TRUE,88,TRUE,90,FALSE,76,FALSE,100,TRUE,100,TRUE,97,TRUE,100,TRUE,100,FALSE,100,TRUE,80,FALSE,93,FALSE,100,FALSE,91,FALSE,98,29,3,2,2,-2,2,-2,-1,2,-2,2,2,1,2,1,2,1,2,3,2,-2,3,2,2,-3,2,2,0,0,3,0,1,3,1,1,2,3,2,1,0,0,0,1,-3,6,3,2,2,0,3,0,0,-2,3,-2,1,0,2,1,3,0,2,0,2,2,2,2,-1,1,FALSE,1,98,FALSE,0,91,FALSE,1,100,FALSE,1,93,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,100,FALSE,1,76,TRUE,1,90,TRUE,0,88,TRUE,1,81,TRUE,1,100,FALSE,1,100,FALSE,1,97,TRUE,0,88,FALSE,1,100,TRUE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,97,TRUE,0,90,TRUE,1,94,FALSE,1,86,TRUE,0,99,TRUE,0,98,TRUE,1,98,TRUE,1,99,TRUE,1,99,0,0.0036,0,0,0.0001,0,0.0009,0,0,0.0064,0.0004,0.01,0.0009,0,0.04,0.8281,0,0.0049,0.9801,0.81,0,0.0361,0.7744,0.7744,0,0.0196,0.0001,0.0004,0,0.0009,0.9604,0.0576,0.189489286,0.063692857,0.315285714,29,90.63,26,81.25,6,75,7,87.5,6,75,7,87.5,15,93.75,11,68.75,94.72,91.88,95.88,94.88,96.25,94.88,94.56,9.38,13.47,16.88,8.38,19.88,8.75,1.13,25.81,0,0,0,1,0,2,1,1,2,1,1,0,0,2,0,1,2,3,1,1,0,0,0,2,1,2,1,1,0,1,0,0,1,1,0,1,0,1,0,1,0.2,1.4,0.6,1.6,0.6,1,0.4,0.6,0.95,0.65,0.8,2,0,1.625,-0.4,0.4,0.2,1,0.066666667,2,3,1,5,2,1,1,1,-2,2,0,0,1,-1,-2,2,2,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),65,interesting questions,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,8,6,7,4,2,9,3,1,5,2,3,4,1 +308,R_3CEIGdrkYXHGlap,53 - 59,American,,American,Female,Strongly agree,Somewhat disagree,Agree,Agree,Strongly disagree,1,3,2,5,4,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,1,3,2,4,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,5,4,2,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,4,3,5,2,1,Strongly Agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,4,5,1,2,3,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,4,3,1,5,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,5,3,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat disagree,Agree,Agree,Strongly disagree,2,5,1,4,3,3,Disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,2,4,5,1,3,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,5,4,3,1,2,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,2,5,1,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,95,TRUE,85,TRUE,82,FALSE,87,FALSE,59,TRUE,60,TRUE,59,TRUE,86,FALSE,59,TRUE,87,FALSE,56,FALSE,100,TRUE,60,FALSE,96,FALSE,90,TRUE,99,TRUE,96,TRUE,100,TRUE,93,TRUE,93,FALSE,60,TRUE,97,TRUE,96,TRUE,99,TRUE,98,FALSE,54,TRUE,96,FALSE,54,FALSE,91,TRUE,99,FALSE,99,16,3,-1,2,2,-3,0,-2,1,-2,0,1,-1,1,-1,1,1,0,1,2,1,3,-1,2,0,-1,2,-1,1,1,-1,1,5,1,-1,1,0,1,2,0,0,1,0,0,4,3,-1,2,2,-3,3,-2,-2,0,-2,-2,3,1,0,0,-1,0,2,-1,0,-1,1,0,3,FALSE,1,99,TRUE,1,99,FALSE,1,91,FALSE,1,54,TRUE,1,96,FALSE,1,54,TRUE,1,98,TRUE,1,99,TRUE,1,96,TRUE,1,97,FALSE,1,60,TRUE,0,93,TRUE,1,93,TRUE,0,100,TRUE,1,96,TRUE,1,99,FALSE,1,90,FALSE,1,96,TRUE,0,60,FALSE,1,100,FALSE,0,56,TRUE,1,87,FALSE,1,59,TRUE,1,86,TRUE,0,59,TRUE,1,60,FALSE,1,59,FALSE,1,87,TRUE,0,82,TRUE,1,85,TRUE,1,95,TRUE,1,96,0.0001,0.16,0.0001,0.0004,0.0016,0.2116,0.0196,0.0009,0,0.0169,0.0225,0.0049,0.0016,0.16,0.0016,0.0001,0.1681,0.2116,0.0169,0.3481,0.3136,0.0016,0.36,1,0.01,0.1681,0.0025,0.0001,0.0081,0.0016,0.6724,0.8649,0.163889286,0.058642857,0.269135714,16,50,26,81.25,7,87.5,6,75,6,75,7,87.5,15,93.75,11,68.75,83.78,77.38,78.25,87,92.5,89.88,77.69,-31.25,2.53,-10.12,3.25,12,5,-3.87,8.94,0,0,0,2,2,1,3,0,1,1,0,0,0,1,0,1,0,0,2,1,0,0,0,0,0,2,0,1,0,2,0,1,1,0,1,2,0,2,1,1,0.8,1.2,0.2,0.8,0,1,0.6,1.2,0.75,0.7,0.725,3,2.67,3,0.8,0.2,-0.4,-0.4,0.2,-1,2,0,1,0.33,0,0,1,-2,2,-1,1,-1,1,-1,1,0,20 cents,100 minutes,15 days,Female,University - Undergraduate,55,so what are the answers,0.75,0,0,0,0,1,0,0,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,2,3,4,9,8,5,6,1,7,2,3,4,1 +309,R_3Vr7U3YMAjw2Ymt,25 - 31,,Canadian,Canadian,Female,Strongly disagree,Agree,Agree,Agree,Agree,1,4,2,3,5,Somewhat agree,Disagree,Agree,Somewhat agree,Somewhat agree,5,3,4,1,2,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Agree,2,4,3,1,5,Strongly disagree,Somewhat disagree,Disagree,Strongly disagree,Strongly disagree,4,1,2,5,3,Strongly disagree,Agree,Strongly Agree,Agree,Agree,5,2,4,3,1,2,Agree,Disagree,Strongly agree,Somewhat agree,Agree,2,4,1,5,3,0,Strongly Agree,Agree,Somewhat Disagree,Agree,Somewhat Agree,3,2,4,5,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,3,4,2,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,4,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Agree,5,1,3,4,2,4,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Agree,2,5,3,4,1,3,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,1,2,3,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,FALSE,54,FALSE,100,FALSE,57,TRUE,52,TRUE,58,TRUE,73,FALSE,79,FALSE,65,TRUE,56,FALSE,53,TRUE,70,FALSE,53,TRUE,52,TRUE,60,TRUE,50,TRUE,65,FALSE,50,TRUE,50,TRUE,54,TRUE,61,FALSE,51,FALSE,50,FALSE,50,TRUE,82,TRUE,89,FALSE,60,FALSE,50,TRUE,50,FALSE,62,FALSE,50,TRUE,66,4,-3,2,2,2,2,1,-2,2,1,1,2,-1,3,1,2,-3,-1,-2,-3,-3,-3,2,3,2,2,2,2,-2,3,1,2,0,3,2,-1,2,1,4,1,1,1,1,-2,3,-3,3,3,3,3,4,-1,-1,2,1,2,4,3,1,3,2,2,3,1,1,2,-1,-1,4,TRUE,0,66,FALSE,0,50,FALSE,1,62,TRUE,0,50,FALSE,0,50,FALSE,1,60,TRUE,1,89,TRUE,1,82,FALSE,0,50,FALSE,0,50,FALSE,1,51,TRUE,0,61,TRUE,1,54,TRUE,0,50,FALSE,0,50,TRUE,1,65,TRUE,0,50,TRUE,0,60,TRUE,0,52,FALSE,1,53,TRUE,1,70,FALSE,0,53,TRUE,0,56,FALSE,0,65,FALSE,1,79,TRUE,1,73,TRUE,0,58,TRUE,0,52,FALSE,1,57,FALSE,0,100,FALSE,0,54,FALSE,0,50,0.0324,0.0729,0.1225,0.0121,0.25,0.16,0.4225,0.25,0.2209,0.2809,1,0.2116,0.25,0.2401,0.25,0.25,0.3136,0.25,0.2704,0.0441,0.09,0.25,0.2704,0.25,0.25,0.3364,0.2916,0.4356,0.1444,0.36,0.1849,0.3721,0.282125,0.310685714,0.253564286,4,12.5,12,37.5,1,12.5,4,50,3,37.5,4,50,6,37.5,6,37.5,60.06,51.88,55.88,65,67.5,62.81,57.31,-25,22.56,39.38,5.88,27.5,17.5,25.31,19.81,0,0,1,0,0,1,0,1,0,1,1,3,4,1,1,4,2,3,4,1,0,1,1,1,1,2,1,0,0,1,1,2,0,1,0,4,2,4,2,2,0.2,0.6,2,2.8,0.8,0.8,0.8,2.8,1.4,1.3,1.35,2,3.67,3,-0.6,-0.2,1.2,0,0.133333333,-2,-4,1,-1,-1.67,0,2,2,-1,1,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,7,8,5,9,6,3,4,1,2,4,2,3,1 +310,R_2me4V9FQ08N57m5,46 - 52,American,,American,Female,Strongly agree,Agree,Agree,Somewhat agree,Agree,4,2,3,1,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,3,1,4,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,3,2,5,4,Agree,Agree,Agree,Agree,Somewhat disagree,4,3,1,5,2,Strongly Agree,Agree,Agree,Somewhat agree,Agree,4,5,2,3,1,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,3,1,5,4,0,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,5,4,1,0,Agree,Agree,Agree,Agree,Somewhat disagree,4,1,3,5,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Agree,Agree,4,5,3,1,2,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,2,4,3,1,0,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,4,3,2,0,Agree,Agree,Agree,Agree,Somewhat disagree,5,4,1,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,24,3,2,2,1,2,0,-3,3,-3,2,2,-3,3,-3,3,2,2,2,2,-1,3,2,2,1,2,0,0,-3,3,-3,2,0,2,-3,3,-3,3,0,2,2,2,2,-1,0,3,2,2,2,2,0,0,-3,3,-3,2,0,2,-3,3,-3,3,0,2,2,2,2,-1,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,0,0,0.25,0,1,0,0,0,0,0,0,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,1,1,1,1,0.294642857,0.107142857,0.482142857,24,75,22,68.75,6,75,6,75,5,62.5,5,62.5,11,68.75,11,68.75,84.38,68.75,87.5,87.5,93.75,87.5,81.25,6.25,15.63,-6.25,12.5,25,31.25,18.75,12.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0.05,0.025,0,0,0,-0.2,0,0,0,-0.066666667,0,0,0,0,0,2,2,2,-2,2,1,-1,-1,1,-2,2,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,no further comments,1.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,02REV,8,4,6,3,2,9,5,1,7,2,4,3,1 +311,R_731h46kt2EWVDLY,67 - 73,American,,American,Male,Disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,1,5,4,3,2,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Somewhat agree,5,1,4,2,3,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,4,2,3,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Disagree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,1,3,4,5,2,3,Agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,3,2,1,4,5,1,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,1,3,4,5,2,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Agree,Strongly Agree,Agree,Somewhat agree,2,3,5,4,1,3,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,3,5,1,2,5,Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly agree,1,3,4,5,2,6,Agree,Neither agree nor disagree,Agree,Somewhat agree,Disagree,2,3,4,1,5,TRUE,70,TRUE,100,FALSE,80,FALSE,50,TRUE,50,TRUE,70,TRUE,95,TRUE,80,TRUE,86,FALSE,90,TRUE,75,TRUE,91,TRUE,90,TRUE,80,TRUE,75,FALSE,80,FALSE,95,TRUE,100,FALSE,50,FALSE,100,TRUE,75,TRUE,50,FALSE,50,TRUE,90,FALSE,100,TRUE,70,FALSE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,0,3,0,-2,3,-2,1,2,1,3,0,3,1,1,2,1,-2,-1,1,1,-1,2,3,2,-2,3,-1,3,3,3,2,3,2,3,1,-1,0,-1,-1,-2,2,0,2,3,2,1,6,-1,-2,0,-1,-1,3,2,1,2,-1,3,5,2,0,2,1,-2,6,TRUE,0,70,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,50,TRUE,0,70,TRUE,1,95,TRUE,1,80,TRUE,1,86,FALSE,0,90,TRUE,0,75,TRUE,0,91,TRUE,1,90,TRUE,0,80,TRUE,1,75,FALSE,0,80,FALSE,1,95,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,50,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,70,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.04,0.09,0.64,0.0025,0,0.49,0.01,0.81,0,0.25,0,0.01,0.0196,0.5625,0.25,0,0.25,0.25,0,0,0.0625,0.0625,0.25,0.64,0.0025,0.25,0.25,0.49,0.04,1,0.25,0.8281,0.250989286,0.207292857,0.294685714,15,46.88,23,71.88,7,87.5,6,75,4,50,6,75,14,87.5,9,56.25,77.88,67,72.5,81.88,90.12,80.06,75.69,-25,6,-20.5,-2.5,31.88,15.12,-7.44,19.44,1,1,1,1,1,2,0,0,1,2,1,1,0,2,0,2,1,3,2,0,2,0,1,2,2,1,0,3,1,2,0,0,1,1,0,1,1,0,0,0,1,1,0.8,1.6,1.4,1.4,0.4,0.4,1.1,0.9,1,2.33,4.67,3.625,-0.4,-0.4,0.4,1.2,-0.133333333,-3,0,-4,-4,-2.34,0,2,2,-1,1,0,0,-1,1,-2,2,2,10 cents,25 minutes,36 days,Male,Trade School (non-military),67,"I have no Idea what I'll be in ten years, but I am pretty sure I won't be as energetic as I am like I am not now as I was 10 years ago. Thanks for reminding me I have more yesterdays than tomorrow's.",1.25,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,6,4,2,8,7,3,9,1,5,3,4,2,1 +312,R_7SoYnD9VhiT967v,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Agree,5,2,4,3,1,Disagree,Strongly disagree,Strongly agree,Agree,Somewhat agree,5,3,1,2,4,Somewhat Agree,Disagree,Agree,Agree,Strongly Agree,4,3,2,1,5,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Disagree,3,4,5,1,2,Strongly Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,5,1,2,4,3,2,Disagree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,5,2,1,3,4,4,Agree,Disagree,Agree,Strongly Agree,Strongly Agree,4,1,5,2,3,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,4,5,1,2,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,3,4,1,5,2,1,Disagree,Strongly disagree,Strongly agree,Agree,Agree,1,4,2,5,3,1,Agree,Disagree,Strongly Agree,Agree,Strongly Agree,5,4,3,2,1,2,Disagree,Disagree,Disagree,Disagree,Somewhat disagree,2,5,4,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,96,TRUE,85,FALSE,100,TRUE,50,TRUE,60,FALSE,100,TRUE,100,TRUE,100,TRUE,70,FALSE,65,TRUE,70,TRUE,66,TRUE,100,FALSE,60,TRUE,54,TRUE,100,FALSE,76,FALSE,97,FALSE,90,FALSE,100,TRUE,62,TRUE,85,FALSE,100,TRUE,100,FALSE,100,TRUE,96,FALSE,100,FALSE,100,TRUE,83,TRUE,100,TRUE,84,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,3,2,-2,-3,3,2,1,1,-2,2,2,3,-2,-1,-1,-2,-2,3,1,2,3,3,2,-2,-3,3,1,3,4,2,-2,2,3,3,3,-1,-1,-1,-1,-2,3,3,3,1,3,2,1,-2,-3,3,2,2,1,2,-2,3,2,3,2,-2,-2,-2,-2,-1,2,FALSE,1,96,TRUE,1,85,FALSE,1,100,TRUE,0,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,70,FALSE,0,65,TRUE,0,70,TRUE,0,66,TRUE,1,100,FALSE,1,60,TRUE,1,54,TRUE,1,100,FALSE,1,76,FALSE,1,97,FALSE,1,90,FALSE,1,100,TRUE,1,62,TRUE,1,85,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,96,FALSE,1,100,FALSE,1,100,TRUE,0,83,TRUE,1,100,TRUE,1,84,TRUE,1,100,0,0.0016,0,0,0,0,0,0.4225,0,0.0225,0,0,0.09,0.49,0.16,0.0225,0,0.25,0,0,0.1444,0.2116,0.01,0.16,0.0576,0,0.0256,0.0016,0,0.0009,0.6889,0.4356,0.114060714,0.104107143,0.124014286,28,87.5,27,84.38,6,75,7,87.5,7,87.5,7,87.5,15,93.75,12,75,85.91,75.38,85.12,87.38,95.75,85.06,86.75,3.12,1.53,0.38,-2.38,-0.12,8.25,-8.69,11.75,0,2,1,0,1,0,0,0,1,2,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0.8,0.6,0.4,0.4,0,0.2,0.4,0.6,0.55,0.3,0.425,3,1.33,2.25,0.8,0.4,0,-0.2,0.4,1,3,1,1,1.67,1,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,43,,1.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,2,5,4,6,7,3,9,1,8,2,4,3,1 +313,R_3h0yvrbnLX57zfm,67 - 73,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,2,4,1,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,5,4,1,1,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,5,1,2,4,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,2,1,1,Strongly Agree,Disagree,Strongly disagree,Strongly disagree,Strongly Agree,4,3,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,1,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,4,1,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,10,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,2,1,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,77,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,75,FALSE,97,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,88,FALSE,80,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,78,TRUE,100,FALSE,100,31,3,3,3,2,3,3,3,3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,-3,3,-2,3,1,3,3,3,3,3,1,3,-2,-3,-3,3,1,3,3,3,3,3,2,3,3,3,3,3,10,3,3,3,3,3,1,1,3,3,2,3,10,FALSE,1,100,TRUE,1,100,FALSE,1,78,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,88,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,97,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,77,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.5929,0,0,0,0,0,0,0,0,0,0,0,0.04,0,0,0,0,0,0,0,0,0.0625,1,0,0,0,0,0.0484,0.0009,1,0.7744,0.104507143,0.002857143,0.206157143,31,96.88,28,87.5,8,100,7,87.5,6,75,7,87.5,15,93.75,13,81.25,96.72,94.38,100,96.75,95.75,98.56,94.88,9.38,9.22,-5.62,12.5,21.75,8.25,4.81,13.63,0,0,0,1,0,0,6,0,3,0,0,1,0,0,0,0,5,6,6,0,0,0,0,1,0,0,0,0,2,0,0,1,0,0,0,2,0,0,1,0,0.2,1.8,0.2,3.4,0.2,0.4,0.2,0.6,1.4,0.35,0.875,1,4.33,3.375,0,1.4,0,2.8,0.466666667,-1,-9,0,-9,-3.33,-2,2,2,-2,2,-2,2,2,-2,-2,2,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,Quite simplistic,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,4,5,2,3,6,7,9,1,8,4,2,3,1 +314,R_1rV4mMwVSaPgDhP,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,3,2,4,1,5,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Disagree,1,2,4,5,3,Agree,Disagree,Strongly Agree,Strongly Disagree,Somewhat Disagree,3,4,2,1,5,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,2,5,1,3,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,5,3,2,4,1,0,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,3,5,2,1,4,8,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Somewhat Disagree,4,5,2,1,3,5,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Disagree,4,1,5,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,2,3,5,1,4,0,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Strongly disagree,3,1,4,2,5,0,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Disagree,4,5,3,2,1,0,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,3,5,2,4,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,72,TRUE,74,TRUE,76,TRUE,50,TRUE,75,FALSE,84,TRUE,98,TRUE,91,TRUE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,50,FALSE,50,FALSE,100,TRUE,75,TRUE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,99,TRUE,50,FALSE,50,FALSE,50,TRUE,71,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,3,3,0,-3,1,1,3,-2,2,-2,3,-3,-1,-3,-1,0,0,-1,3,1,3,3,-3,0,-3,3,-3,3,-3,8,2,-3,3,-3,-1,5,-2,1,-1,0,-2,5,3,1,3,3,-3,0,-3,1,1,3,-3,0,2,-3,3,-3,-2,0,-1,-1,0,-1,-2,0,TRUE,0,72,TRUE,1,74,TRUE,0,76,TRUE,0,50,TRUE,1,75,FALSE,1,84,TRUE,1,98,TRUE,1,91,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,75,TRUE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,71,FALSE,0,50,TRUE,1,100,0.0081,0.0001,0,0.0004,0,0.0256,0,0.25,0,0.25,0.0841,0,0.25,0.25,0.0625,0.0676,0,0.25,0.25,0,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,0.5776,0.25,0.25,0.25,0.183867857,0.106414286,0.261321429,16,50,24,75,4,50,7,87.5,6,75,7,87.5,14,87.5,10,62.5,70.78,53,79.25,71.12,79.75,77.06,64.5,-25,-4.22,3,-8.25,-3.88,-7.75,-10.44,2,2,0,0,0,3,0,2,4,0,1,0,1,0,0,0,1,2,1,0,1,2,0,0,0,3,0,0,0,0,1,0,1,0,0,1,2,0,0,1,1,1,1.4,0.2,1,1,0.2,0.4,0.8,0.9,0.6,0.75,4.33,0,2.25,0,1.2,-0.2,0.2,0.333333333,0,8,5,5,4.33,2,2,2,-2,2,-2,2,2,-2,-2,2,-2,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,63,,1,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,3,4,6,5,9,2,8,1,7,4,3,2,1 +315,R_52qO8tcxdz4rbj3,39 - 45,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,3,4,5,1,Disagree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,2,5,1,4,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,2,5,1,4,3,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,3,2,4,5,1,1,Disagree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,3,1,5,4,2,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Strongly Disagree,Strongly Agree,5,4,1,3,2,0,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Neither agree nor disagree,2,4,1,3,5,0,Disagree,Neither agree nor disagree,Agree,Disagree,Neither agree nor disagree,4,3,2,5,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,3,1,5,4,2,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,2,4,FALSE,100,FALSE,77,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,90,TRUE,100,TRUE,65,FALSE,60,FALSE,50,TRUE,57,FALSE,50,TRUE,82,TRUE,55,TRUE,75,FALSE,56,FALSE,50,TRUE,59,FALSE,100,FALSE,81,TRUE,67,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,71,FALSE,84,FALSE,92,TRUE,85,FALSE,50,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,-3,0,-2,1,2,-2,0,1,0,0,-3,3,1,3,3,3,1,3,3,3,-3,0,1,-2,1,2,-2,0,1,1,0,-1,-3,3,1,1,3,3,1,0,0,3,3,3,-2,0,1,-2,0,2,-2,0,0,0,0,1,-3,3,2,1,1,1,1,0,2,FALSE,1,100,FALSE,0,77,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,65,FALSE,0,60,FALSE,1,50,TRUE,0,57,FALSE,0,50,TRUE,0,82,TRUE,1,55,TRUE,1,75,FALSE,1,56,FALSE,1,50,TRUE,0,59,FALSE,1,100,FALSE,0,81,TRUE,1,67,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,FALSE,1,84,FALSE,1,92,TRUE,1,85,FALSE,0,50,TRUE,1,100,0,0,0.0625,0.01,0,0,0,0.36,0,0.1089,0.0225,0.25,0.1225,0.25,0,0.5929,0,0.25,0.0256,0,0.6561,0.2025,0.3481,0.6724,0.1936,0.5041,0.25,0,0,0.25,0.0064,0.3249,0.192517857,0.139771429,0.245264286,20,62.5,23,71.88,4,50,6,75,6,75,7,87.5,11,68.75,12,75,78.31,59.62,84.88,81.12,87.62,78.44,78.19,-9.38,6.43,9.62,9.88,6.12,0.12,9.69,3.19,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,2,2,2,1,0,0,0.2,0.6,0.2,0.2,0.4,1.4,0.2,0.55,0.375,1,1,1,-0.2,-0.2,-0.2,-0.8,-0.2,0,1,-1,-2,0,0,2,2,-2,2,-1,1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),45,,1.5,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,01DIR,4,5,6,7,2,9,3,1,8,3,4,2,1 +316,R_7dgvydr6nSPUpWq,53 - 59,American,,American,Female,Strongly agree,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,2,3,1,4,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,4,2,1,5,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,3,1,5,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,4,2,5,3,1,Strongly Agree,Agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,2,3,5,1,1,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,5,1,4,2,1,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,5,2,4,3,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,2,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,1,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,4,1,5,3,1,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,1,3,4,2,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,2,5,4,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,72,TRUE,95,TRUE,100,TRUE,96,TRUE,75,TRUE,100,TRUE,90,TRUE,99,TRUE,75,TRUE,87,TRUE,80,FALSE,100,TRUE,60,TRUE,100,FALSE,60,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,90,TRUE,60,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,96,TRUE,60,FALSE,50,TRUE,98,TRUE,73,FALSE,50,20,3,2,0,-1,-1,0,-1,2,-1,0,3,2,2,0,3,0,1,1,2,-1,3,2,1,-1,-1,1,0,-2,2,-2,0,1,3,2,2,0,3,1,0,1,1,1,-1,2,3,2,0,-1,-1,1,0,-2,2,-1,0,1,3,2,2,0,3,1,0,0,1,1,-1,3,FALSE,1,50,TRUE,1,73,TRUE,0,98,FALSE,1,50,TRUE,1,60,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,0,60,FALSE,1,100,TRUE,1,80,TRUE,1,87,TRUE,0,75,TRUE,1,99,TRUE,0,90,TRUE,1,100,TRUE,0,75,TRUE,0,96,TRUE,0,100,TRUE,1,95,TRUE,1,72,TRUE,1,100,0,0,0,0,0,0.0016,0.0001,0,0,0.0169,0.0025,0,0,0.36,0.16,0.0729,0.5625,0.25,0.9216,0.81,0.04,0.25,0.36,1,0.16,0.5625,0.0784,0.25,0.9604,1,1,0.81,0.343907143,0.101892857,0.585921429,20,62.5,21,65.63,5,62.5,6,75,5,62.5,5,62.5,16,100,5,31.25,84.88,67.5,83.88,90.88,97.25,88.5,81.25,-3.13,19.25,5,8.88,28.38,34.75,-11.5,50,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0.2,0.4,0,0.2,0,0.2,0,0.4,0.2,0.15,0.175,1,1,1.375,0.2,0.2,0,-0.2,0.133333333,0,0,0,-1,0,0,1,0,-2,2,0,0,0,0,-2,2,0,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,57,Nothing I can think of.,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,2,3,5,7,4,6,8,1,9,2,4,3,1 +317,R_3dcLGFPMgWZ26bY,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Strongly agree,Somewhat agree,Agree,3,2,1,5,4,Somewhat agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Agree,3,4,2,1,5,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,1,3,2,4,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,1,2,5,4,3,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat agree,Agree,1,5,2,4,3,4,Strongly Agree,Strongly Agree,Agree,Somewhat Disagree,Strongly Agree,4,3,1,2,5,1,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,2,3,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,5,2,3,1,4,1,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,3,2,5,1,4,1,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,4,2,3,1,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,2,3,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,TRUE,82,TRUE,92,TRUE,50,TRUE,81,TRUE,55,TRUE,77,TRUE,85,FALSE,74,TRUE,72,TRUE,50,FALSE,56,TRUE,50,TRUE,82,TRUE,87,FALSE,50,TRUE,50,TRUE,54,TRUE,50,TRUE,50,TRUE,82,TRUE,50,TRUE,50,TRUE,66,FALSE,50,TRUE,100,TRUE,60,TRUE,80,TRUE,77,TRUE,83,TRUE,50,TRUE,50,17,2,2,3,1,2,1,-3,3,0,2,3,2,2,0,3,1,2,3,1,-2,3,2,3,1,0,8,0,-3,3,1,2,5,3,3,2,-1,3,4,-1,-2,-1,-1,-3,1,3,3,3,1,2,2,1,-3,3,-2,1,1,3,2,2,0,3,1,1,1,1,1,2,7,TRUE,0,50,TRUE,1,50,TRUE,0,83,TRUE,0,77,TRUE,1,80,TRUE,0,60,TRUE,1,100,FALSE,0,50,TRUE,1,66,TRUE,1,50,TRUE,0,50,TRUE,0,82,TRUE,1,50,TRUE,0,50,TRUE,1,54,TRUE,1,50,FALSE,1,50,TRUE,0,87,TRUE,0,82,TRUE,0,50,FALSE,0,56,TRUE,1,50,TRUE,0,72,FALSE,0,74,TRUE,0,85,TRUE,1,77,TRUE,0,55,TRUE,0,81,TRUE,0,50,TRUE,1,92,TRUE,1,82,TRUE,1,50,0.25,0.0529,0.25,0,0.25,0.36,0.5476,0.25,0.25,0.25,0.0064,0.25,0.1156,0.25,0.04,0.25,0.5184,0.5929,0.6561,0.7225,0.3136,0.2116,0.6724,0.25,0.25,0.3025,0.0324,0.25,0.6889,0.7569,0.25,0.6724,0.355721429,0.280778571,0.430664286,17,53.13,14,43.75,4,50,4,50,4,50,2,25,13,81.25,1,6.25,65.47,64.5,58.5,68.62,70.25,64.44,66.5,9.38,21.72,14.5,8.5,18.62,45.25,-16.81,60.25,1,0,0,0,2,1,0,0,1,0,0,1,0,1,0,2,4,4,2,1,1,1,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,2,0,4,0.6,0.4,0.4,2.6,0.4,0.6,0,1.4,1,0.6,0.8,5.67,1.33,3.625,0.2,-0.2,0.4,1.2,0.133333333,6,4,3,-6,4.34,1,2,2,-2,2,-1,1,0,0,0,0,2,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),57,It’s a knowledgeable survey ,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,6,3,5,7,8,9,4,1,2,3,4,2,1 +318,R_5qgj0pp3cfHpCQo,67 - 73,American,,American,Female,Agree,Somewhat agree,Strongly agree,Disagree,Strongly disagree,5,4,3,2,1,Disagree,Somewhat disagree,Strongly agree,Strongly disagree,Somewhat agree,2,4,3,5,1,Strongly Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,1,5,4,3,2,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,4,2,3,5,Strongly Agree,Agree,Agree,Disagree,Strongly disagree,5,2,4,1,3,1,Disagree,Disagree,Strongly agree,Disagree,Agree,1,4,3,5,2,1,Strongly Agree,Disagree,Agree,Disagree,Strongly Agree,1,3,5,2,4,1,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,1,4,3,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Strongly Agree,Disagree,Strongly disagree,1,4,5,3,2,1,Disagree,Disagree,Agree,Disagree,Somewhat agree,2,3,1,5,4,1,Strongly Agree,Somewhat Disagree,Agree,Disagree,Strongly Agree,5,2,4,1,3,1,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,3,4,2,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,FALSE,70,TRUE,90,TRUE,75,FALSE,95,TRUE,60,TRUE,85,FALSE,95,TRUE,100,FALSE,100,TRUE,95,FALSE,50,FALSE,100,FALSE,95,TRUE,90,FALSE,85,TRUE,100,FALSE,50,TRUE,90,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,95,FALSE,100,TRUE,90,FALSE,50,FALSE,50,TRUE,100,FALSE,90,25,2,1,3,-2,-3,-2,-1,3,-3,1,3,-2,3,-2,3,2,2,2,2,0,3,2,2,-2,-3,1,-2,-2,3,-2,2,1,3,-2,2,-2,3,1,2,1,2,2,0,1,2,1,3,-2,-3,1,-2,-2,2,-2,1,1,3,-1,2,-2,3,1,2,2,2,2,0,8,FALSE,1,90,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,90,FALSE,0,50,TRUE,1,100,FALSE,1,85,TRUE,0,90,FALSE,1,95,FALSE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,85,TRUE,0,60,FALSE,1,95,TRUE,0,75,TRUE,1,90,FALSE,0,70,TRUE,1,90,0,0.0225,0,0.0025,0.01,0,0,0,0,0.0025,0.01,1,0,0,0.01,0,0,0.25,0.0025,0.0025,0.25,0.25,0.0025,0.81,0.0225,0.36,0.49,0.01,0.25,0.81,0.5625,0,0.182321429,0.091607143,0.273035714,25,78.13,24,75,5,62.5,5,62.5,6,75,8,100,12,75,12,75,87.19,78.12,86.25,92.5,91.88,88.44,85.94,3.13,12.19,15.62,23.75,17.5,-8.12,13.44,10.94,1,1,1,0,0,0,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0.6,0.6,0.2,0.2,0,0.6,0.4,0,0.4,0.25,0.325,1,1,1.875,0.6,0,-0.2,0.2,0.133333333,0,0,0,-7,0,1,2,2,-2,2,1,-1,-1,1,-1,1,2,10 cents,5 minutes,24 days,Female,University - PhD,68,I truly believe that understanding you might not be right about everything is the chief sign of intelligence.,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,9,3,6,5,7,4,2,1,8,3,2,4,1 +319,R_7Damdpe88cGpgRz,53 - 59,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,5,2,1,4,3,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Agree,3,5,4,2,1,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Agree,3,5,4,2,1,Agree,Agree,Agree,Agree,Agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Strongly Agree,Agree,Agree,4,5,1,2,3,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,3,1,2,4,1,Strongly Agree,Agree,Agree,Strongly Disagree,Strongly Agree,3,1,2,4,5,1,Agree,Somewhat agree,Agree,Agree,Agree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,1,2,5,3,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,1,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,2,3,5,1,4,1,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,TRUE,97,FALSE,100,FALSE,100,FALSE,76,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,91,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,95,FALSE,100,TRUE,100,FALSE,82,TRUE,100,FALSE,100,TRUE,100,FALSE,86,TRUE,100,TRUE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,0,2,-3,-3,3,-2,2,3,2,3,-3,2,2,2,2,2,2,2,3,3,2,2,2,-3,-3,3,-3,2,1,3,2,2,-3,3,1,2,1,2,2,2,1,3,3,3,2,3,1,-3,-3,3,-3,3,1,3,2,3,-3,3,1,2,2,2,2,2,1,TRUE,0,97,FALSE,0,100,FALSE,1,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,82,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0025,0,0,0,0,0,1,0,0.0576,1,0.0324,0,0,1,0,0,0,0,0.9409,0,1,0.0196,0.8281,0.210039286,0.075721429,0.344357143,24,75,26,81.25,6,75,8,100,6,75,6,75,15,93.75,11,68.75,97.72,97,98.25,96.75,98.88,99.69,95.75,-6.25,16.47,22,-1.75,21.75,23.88,5.94,27,0,0,1,2,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,2,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0.6,0.2,0.4,0.2,1,0.4,0.2,0,0.35,0.4,0.375,1.33,1,1.125,-0.4,-0.2,0.2,0.2,-0.133333333,1,0,0,0,0.33,2,2,2,-2,2,2,-2,0,0,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,A thought provoking survey,1.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,9,4,5,7,3,6,8,1,2,2,3,4,1 +320,R_7x2lXCwuRgtTlER,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,2,4,1,5,3,Somewhat disagree,Strongly agree,Strongly agree,Disagree,Somewhat disagree,3,5,2,1,4,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,3,1,4,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,1,5,2,3,4,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Agree,2,3,1,4,5,2,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,4,5,1,2,3,3,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,1,4,3,5,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Somewhat disagree,Agree,4,5,1,3,2,2,Disagree,Strongly agree,Strongly agree,Somewhat disagree,Disagree,2,4,3,5,1,5,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,3,2,5,1,4,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,2,1,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,65,FALSE,91,TRUE,69,FALSE,100,TRUE,50,TRUE,93,FALSE,58,FALSE,60,TRUE,59,TRUE,55,FALSE,94,FALSE,100,TRUE,75,FALSE,100,TRUE,77,TRUE,81,TRUE,50,TRUE,81,TRUE,92,FALSE,100,FALSE,100,TRUE,93,TRUE,57,TRUE,96,TRUE,84,FALSE,100,TRUE,53,TRUE,50,TRUE,100,TRUE,100,TRUE,97,10,3,3,3,-1,2,-1,3,3,-2,-1,1,3,3,-3,2,1,1,1,-1,-2,3,2,3,1,2,2,0,3,3,-1,1,4,3,3,3,1,2,3,-2,1,1,1,-3,8,3,2,3,-1,2,2,-2,3,3,-1,-2,5,1,3,3,-3,0,6,0,0,1,1,1,3,TRUE,0,97,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,53,FALSE,1,100,TRUE,1,84,TRUE,1,96,TRUE,1,57,TRUE,1,93,FALSE,1,100,FALSE,1,100,TRUE,1,92,TRUE,0,81,TRUE,1,50,TRUE,1,81,TRUE,0,77,FALSE,1,100,TRUE,0,75,FALSE,1,100,FALSE,0,94,TRUE,1,55,TRUE,0,59,FALSE,0,60,FALSE,1,58,TRUE,1,93,TRUE,0,50,FALSE,1,100,TRUE,0,69,FALSE,0,91,FALSE,0,65,TRUE,1,85,0.0016,0.0049,0.0361,0.0256,0.0225,0,0.36,0.0049,0,0.2025,0.8281,0.0064,0.1849,0,0.2209,0,0.3481,0.25,0,0.1764,0.8836,0.25,0.5625,0.6561,0.5929,0.25,0.4225,0.9409,1,0,0.4761,0,0.308546429,0.17345,0.443642857,10,31.25,19,59.38,4,50,4,50,6,75,5,62.5,12,75,7,43.75,80.16,68.38,78.62,82.62,91,78.06,82.25,-28.13,20.78,18.38,28.62,7.62,28.5,3.06,38.5,0,1,0,2,0,1,0,0,1,2,2,0,0,4,0,3,0,0,2,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,2,1,1,0,2,3,0.6,0.8,1.2,1.2,0.2,0.6,0.4,1.4,0.95,0.65,0.8,3,4.33,4.125,0.4,0.2,0.8,-0.2,0.466666667,0,-1,-3,5,-1.33,1,2,1,-2,2,1,-1,0,0,-1,1,-2,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,59,was very enjoyable,0.5,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,7,3,5,8,2,4,6,1,9,4,3,2,1 +321,R_7dS16cqOTMcqZNc,53 - 59,American,,American,Female,Strongly agree,Agree,Strongly agree,Strongly disagree,Somewhat agree,2,5,3,1,4,Disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat disagree,1,3,2,5,4,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,4,2,1,5,3,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,4,2,5,1,3,Strongly Agree,Agree,Strongly Agree,Strongly disagree,Somewhat agree,1,3,4,5,2,0,Strongly disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly disagree,3,5,1,2,4,5,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,5,2,3,1,4,2,Strongly disagree,Disagree,Strongly disagree,Somewhat disagree,Disagree,5,4,3,1,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,4,5,5,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,5,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,4,3,1,2,5,0,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,2,5,3,4,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,82,TRUE,100,FALSE,50,TRUE,79,FALSE,100,TRUE,50,TRUE,69,TRUE,50,FALSE,87,FALSE,50,TRUE,98,TRUE,67,TRUE,100,TRUE,50,TRUE,72,FALSE,50,TRUE,72,FALSE,50,FALSE,71,FALSE,100,TRUE,50,FALSE,96,TRUE,80,TRUE,50,TRUE,91,FALSE,50,FALSE,50,TRUE,53,TRUE,61,FALSE,50,TRUE,91,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,-3,1,-2,1,3,-1,-1,2,-3,2,-3,3,-3,0,1,1,-2,3,2,3,-3,1,0,-3,1,3,1,-3,5,2,-3,2,-3,3,2,-3,-2,-3,-1,-2,7,3,2,2,0,0,5,-2,-1,2,0,0,5,2,-3,2,-3,3,0,-1,0,0,1,-2,3,FALSE,1,100,TRUE,1,82,TRUE,0,100,FALSE,1,50,TRUE,1,79,FALSE,1,100,TRUE,1,50,TRUE,1,69,TRUE,1,50,FALSE,0,87,FALSE,1,50,TRUE,0,98,TRUE,1,67,TRUE,0,100,TRUE,1,50,TRUE,1,72,FALSE,1,50,TRUE,0,72,FALSE,1,50,FALSE,1,71,FALSE,0,100,TRUE,1,50,FALSE,1,96,TRUE,1,80,TRUE,0,50,TRUE,1,91,FALSE,1,50,FALSE,1,50,TRUE,0,53,TRUE,1,61,FALSE,0,50,TRUE,1,91,0.0961,0.0081,0.0784,0.25,0.0081,0,0.04,0.7569,0.0841,0.25,0.1521,0.1089,0.25,0.25,0.0441,0.0324,0.0016,0.25,0.25,0.25,1,0.25,0.25,1,0.25,0.25,0.25,0,1,0.5184,0.2809,0.9604,0.312067857,0.159157143,0.464978571,21,65.63,23,71.88,7,87.5,6,75,4,50,6,75,13,81.25,10,62.5,70.91,54,79.5,75,75.12,70.56,71.25,-6.25,-0.97,-33.5,4.5,25,0.12,-10.69,8.75,0,0,0,0,0,1,0,0,2,2,0,0,0,0,0,0,2,4,2,0,0,0,1,3,1,0,2,1,1,1,0,0,0,0,0,2,0,1,0,0,0,1,0,1.6,1,1,0,0.6,0.65,0.65,0.65,2.33,3.33,3.375,-1,0,0,1,-0.333333333,-5,0,2,4,-1,1,2,2,-2,2,-1,1,-2,2,-2,2,0,5 cents,100 minutes,24 days,Female,University - Undergraduate,53,,1.5,1,0,0,0,1,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,8,9,2,6,5,4,3,1,7,4,3,2,1 +322,R_5INxtYR8BYWS99W,32 - 38,,Canadian,Canadian,Female,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,4,5,3,1,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Agree,5,2,4,1,3,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,1,5,3,2,Somewhat agree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Somewhat disagree,Agree,3,5,1,4,2,5,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,2,5,3,4,1,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,3,4,1,2,5,10,Disagree,Disagree,Disagree,Disagree,Disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Agree,Agree,Agree,Agree,5,2,4,1,3,7,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,7,Agree,Agree,Agree,Agree,Somewhat Agree,5,2,3,4,1,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,2,5,TRUE,56,FALSE,55,FALSE,55,FALSE,55,TRUE,55,FALSE,55,TRUE,65,TRUE,55,FALSE,55,TRUE,55,TRUE,55,TRUE,55,TRUE,55,FALSE,55,FALSE,55,TRUE,70,FALSE,55,TRUE,70,TRUE,55,FALSE,55,TRUE,60,FALSE,55,FALSE,55,FALSE,55,TRUE,70,FALSE,55,FALSE,55,TRUE,80,TRUE,55,TRUE,56,FALSE,55,FALSE,55,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,1,1,-1,1,0,-1,-1,-1,2,1,2,1,1,1,1,-2,-1,-1,1,2,2,2,-1,2,6,1,0,-1,1,0,5,0,1,-1,-1,1,5,-2,-2,-2,-2,-2,10,0,2,2,2,2,8,0,0,2,0,0,7,2,2,2,2,1,7,0,0,1,1,0,7,TRUE,0,56,FALSE,0,55,FALSE,1,55,FALSE,1,55,TRUE,1,55,FALSE,1,55,TRUE,1,65,TRUE,1,55,FALSE,0,55,TRUE,1,55,TRUE,0,55,TRUE,0,55,TRUE,1,55,FALSE,1,55,FALSE,0,55,TRUE,1,70,FALSE,1,55,TRUE,0,70,TRUE,0,55,FALSE,1,55,TRUE,1,60,FALSE,0,55,FALSE,1,55,FALSE,0,55,TRUE,0,70,FALSE,0,55,FALSE,1,55,TRUE,0,80,TRUE,0,55,TRUE,1,56,FALSE,0,55,FALSE,0,55,0.2025,0.3025,0.09,0.1225,0.3025,0.2025,0.3025,0.2025,0.2025,0.3025,0.1936,0.2025,0.3025,0.3025,0.2025,0.3025,0.2025,0.2025,0.64,0.49,0.16,0.3025,0.3025,0.2025,0.2025,0.2025,0.3025,0.3136,0.2025,0.49,0.3025,0.3025,0.280078571,0.244721429,0.315435714,16,50,16,50,2,25,6,75,3,37.5,5,62.5,8,50,8,50,57.72,55,55.62,60.12,60.12,56.94,58.5,0,7.72,30,-19.38,22.62,-2.38,6.94,8.5,4,1,1,0,1,1,1,0,2,2,1,1,2,2,0,3,0,1,1,3,2,1,1,3,1,0,1,3,1,2,1,0,1,1,0,1,2,2,2,1,1.4,1.2,1.2,1.6,1.6,1.4,0.6,1.6,1.35,1.3,1.325,5.33,7.33,6.875,-0.2,-0.2,0.6,0,0.066666667,-2,-2,-2,3,-2,1,0,1,-2,2,1,-1,0,0,1,-1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,35,,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,7,3,4,5,8,9,2,1,6,3,4,2,1 +323,R_5yfj8xtjmhQoJvW,60 - 66,,Canadian,Canadian,Female,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,2,3,1,4,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,2,4,3,1,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,1,3,4,2,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,5,3,2,1,5,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,2,1,4,3,5,Somewhat Agree,Agree,Agree,Somewhat Disagree,Agree,3,1,4,2,5,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,2,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,5,1,3,2,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,1,5,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,100,TRUE,50,TRUE,80,FALSE,98,TRUE,100,FALSE,100,FALSE,50,TRUE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,80,TRUE,80,FALSE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,82,TRUE,50,TRUE,100,TRUE,91,FALSE,50,TRUE,50,TRUE,50,FALSE,100,TRUE,91,TRUE,100,25,2,1,2,1,1,0,-1,2,-1,-1,1,1,2,-1,1,-1,-1,0,-1,-1,2,2,2,1,1,5,0,-1,2,-1,0,5,1,2,2,-1,2,5,-1,-1,-1,0,-1,5,2,1,2,1,0,5,0,0,2,-1,0,5,1,1,1,-1,2,5,0,0,0,0,-1,5,TRUE,0,100,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,91,TRUE,1,100,TRUE,1,50,TRUE,1,82,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,80,TRUE,0,80,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,80,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0.04,0.04,0.0081,0,0.25,0,0.0324,0,0.25,0,0.25,0.25,0.25,0.25,0.0081,0,0.25,0,0.0004,0.25,0.25,0.25,0,0.64,0.25,0.25,1,0,0.25,0.25,1,0.220746429,0.127892857,0.3136,25,78.13,23,71.88,4,50,6,75,6,75,7,87.5,14,87.5,9,56.25,75.06,55.12,66.25,81.38,97.5,73.38,76.75,6.25,3.18,5.12,-8.75,6.38,10,-14.12,20.5,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0.2,0.2,0.4,0.4,0.2,0.4,0.4,0.6,0.3,0.4,0.35,5,5,5,0,-0.2,0,-0.2,-0.066666667,0,0,0,0,0,1,1,-1,-1,1,1,-1,0,0,-1,1,0,20 cents,75 minutes,36 days,Female,High School (or equivalent),62,the survey was interesting,0.25,0,0,0,0,0,0,0,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,8,9,2,6,5,7,4,1,3,2,4,3,1 +324,R_11QtYtoOyvRCpN0,53 - 59,,Canadian,Canadian,Male,Strongly agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,2,4,1,3,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,5,3,2,4,1,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,1,3,4,5,2,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Somewhat agree,Neither agree nor disagree,Disagree,Strongly Agree,3,2,5,4,1,3,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,3,1,5,4,2,Agree,Somewhat Disagree,Agree,Strongly Disagree,Strongly Agree,3,5,2,4,1,3,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,1,2,5,3,3,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,2,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,3,5,2,1,4,4,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,5,4,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,100,TRUE,100,TRUE,84,FALSE,74,TRUE,71,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,94,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,90,TRUE,90,TRUE,91,TRUE,70,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,90,TRUE,50,TRUE,89,FALSE,50,TRUE,100,28,3,0,2,0,2,-3,-1,2,-1,1,2,1,2,-3,2,0,1,2,1,-1,3,1,0,-2,3,4,-3,0,1,-1,1,3,2,-1,2,-3,3,2,-1,1,1,0,-1,3,3,1,2,1,1,3,-3,0,2,0,0,3,2,1,2,-3,2,2,0,-1,0,1,-1,4,TRUE,0,100,FALSE,0,50,TRUE,0,89,TRUE,0,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,70,TRUE,0,91,TRUE,1,90,FALSE,1,90,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,94,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,71,FALSE,1,74,TRUE,0,84,TRUE,1,100,TRUE,1,100,TRUE,1,96,0,0,0,0,0.0016,0,0,0,0.25,0,0,0.01,0,0.49,0.01,0.25,0,0.25,0.0676,0,0.25,0.25,0.0036,0.01,0.25,0.5041,0,1,0.7921,1,0.7056,0.8281,0.247239286,0.090114286,0.404364286,28,87.5,20,62.5,4,50,5,62.5,6,75,5,62.5,14,87.5,6,37.5,85.59,73.12,82.5,98.75,88,89.12,82.06,25,23.09,23.12,20,23.75,25.5,1.62,44.56,0,1,2,2,1,0,1,1,0,0,0,2,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,2,2,0,0,1.2,0.4,0.6,0.6,0.6,0.6,0,0.8,0.7,0.5,0.6,3,2.67,3,0.6,-0.2,0.6,-0.2,0.333333333,1,0,0,-1,0.33,1,2,0,-2,2,-1,1,0,0,-2,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,58,Interesting to know results :),1,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,7,8,4,2,3,9,6,1,5,4,3,2,1 +325,R_1FQe71JwkCj1JCd,39 - 45,American,,American,Female,Strongly agree,Disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,1,4,3,5,2,Strongly disagree,Somewhat agree,Agree,Neither agree nor disagree,Strongly disagree,1,4,3,5,2,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,2,3,4,1,5,Disagree,Disagree,Somewhat disagree,Disagree,Strongly disagree,3,5,2,4,1,Strongly Agree,Somewhat disagree,Disagree,Strongly disagree,Strongly disagree,3,2,5,1,4,2,Strongly disagree,Neither agree nor disagree,Agree,Somewhat disagree,Strongly disagree,1,2,4,5,3,3,Somewhat Agree,Strongly Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,4,2,3,5,1,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,2,3,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,1,2,3,4,5,1,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,4,1,3,2,5,1,Somewhat Agree,Strongly Disagree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,3,2,1,4,5,8,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Disagree,4,3,2,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,89,FALSE,50,TRUE,81,TRUE,50,FALSE,96,FALSE,50,TRUE,71,FALSE,58,TRUE,76,FALSE,65,TRUE,54,TRUE,62,FALSE,50,TRUE,50,TRUE,63,FALSE,52,TRUE,50,FALSE,50,TRUE,50,TRUE,61,FALSE,50,FALSE,50,TRUE,65,FALSE,56,TRUE,87,TRUE,57,FALSE,100,TRUE,85,FALSE,50,TRUE,91,TRUE,85,TRUE,50,16,3,-2,0,-1,-3,-3,1,2,0,-3,1,-1,0,-3,0,-2,-2,-1,-2,-3,3,-1,-2,-3,-3,2,-3,0,2,-1,-3,3,1,-3,0,0,-1,2,-1,0,0,0,-1,4,3,-2,-1,0,-3,1,-3,-1,1,0,-3,1,1,-3,0,-3,0,8,-1,0,0,-1,-2,5,TRUE,0,50,TRUE,1,85,TRUE,0,91,FALSE,1,50,TRUE,1,85,FALSE,1,100,TRUE,1,57,TRUE,1,87,FALSE,0,56,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,61,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,52,TRUE,0,63,TRUE,0,50,FALSE,1,50,TRUE,1,62,TRUE,1,54,FALSE,1,65,TRUE,1,76,FALSE,1,58,TRUE,1,71,FALSE,1,50,FALSE,1,96,TRUE,0,50,TRUE,1,81,FALSE,0,50,TRUE,1,89,0.0169,0.0841,0.25,0.1849,0.0121,0,0.0576,0.1225,0.25,0.2116,0.0361,0.1521,0.3136,0.25,0.0225,0.0225,0.1225,0.25,0.0016,0.1764,0.1444,0.25,0.25,0.25,0.2304,0.25,0.25,0.25,0.8281,0.3969,0.25,0.25,0.200032143,0.130221429,0.269842857,16,50,23,71.88,4,50,7,87.5,5,62.5,7,87.5,13,81.25,10,62.5,64.19,55.12,70.5,58.5,72.62,67.44,60.94,-21.88,-7.69,5.12,-17,-4,-14.88,-13.81,-1.56,0,1,2,2,0,0,1,0,1,0,0,2,0,3,1,1,2,1,2,2,0,0,1,1,0,0,2,1,0,0,0,2,0,0,0,1,2,1,1,1,1,0.4,1.2,1.6,0.4,0.6,0.4,1.2,1.05,0.65,0.85,2.33,3.33,3.25,0.6,-0.2,0.8,0.4,0.4,1,2,-6,-1,-1,0,1,1,-1,1,-1,1,-1,1,-2,2,-1,5 cents,5 minutes,47 days,Female,High School (or equivalent),42,Thanks. ,0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,4,2,8,6,7,5,9,1,3,4,2,3,1 +326,R_1KGAKS6dO4f3c4e,53 - 59,,Canadian,Canadian,Male,Agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,Disagree,Disagree,Agree,Disagree,Somewhat agree,2,1,4,5,3,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,3,4,1,5,Disagree,Disagree,Somewhat disagree,Disagree,Disagree,2,1,5,3,4,Agree,Strongly Agree,Agree,Somewhat agree,Agree,3,4,2,1,5,1,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,1,5,2,3,4,5,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,1,2,4,7,Strongly disagree,Disagree,Disagree,Disagree,Disagree,1,5,3,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,2,5,3,4,1,2,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,5,3,2,4,0,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,4,3,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,TRUE,60,TRUE,90,FALSE,50,TRUE,50,TRUE,50,TRUE,60,TRUE,80,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,85,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,85,TRUE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,75,FALSE,100,TRUE,50,FALSE,50,FALSE,100,TRUE,65,TRUE,100,FALSE,50,TRUE,60,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,1,1,-2,-2,2,-2,1,3,-3,3,-3,3,-2,-2,-1,-2,-2,2,3,2,1,2,1,-3,1,2,1,-1,5,2,1,3,0,1,7,-3,-2,-2,-2,-2,1,2,3,2,2,0,2,-3,-3,2,-3,1,0,3,-3,3,-3,3,0,0,0,0,0,0,0,TRUE,0,50,TRUE,1,60,TRUE,0,90,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,60,TRUE,1,80,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,85,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,85,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,75,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,100,TRUE,0,65,TRUE,1,100,FALSE,0,50,TRUE,1,60,0.04,0.25,0,0.16,0.16,0.25,0.0625,0,0,0,0,0.0225,0.25,0.25,0.25,0.16,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.7225,0.4225,1,0.245,0.136071429,0.353928571,16,50,20,62.5,4,50,4,50,6,75,6,75,13,81.25,7,43.75,69.06,51.25,57.5,74.38,93.12,70,68.12,-12.5,6.56,1.25,7.5,-0.62,18.12,-11.25,24.37,0,0,1,0,1,1,3,0,3,2,1,4,0,3,2,1,0,1,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,2,2,1,2,2,0.4,1.8,2,0.4,0.6,0.6,0,1.8,1.15,0.75,0.95,4.33,0.67,2,-0.2,1.2,2,-1.4,1,-1,5,7,1,3.66,1,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,57,"I enjoyed the survey but the original questions were about topics that I know little about, I hope my answers served the purpose of the survey!",1.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,6,5,3,7,4,8,2,1,9,4,2,3,1 +327,R_6c2i1T1GCjpPNC2,53 - 59,American,,American,Male,Agree,Strongly agree,Agree,Agree,Agree,3,1,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,5,4,2,Somewhat Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,5,2,4,3,1,Agree,Agree,Agree,Agree,Somewhat agree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Agree,5,3,4,1,2,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,1,5,3,2,2,Neither Agree nor Disagree,Disagree,Agree,Disagree,Strongly Agree,3,5,2,1,4,2,Agree,Agree,Agree,Agree,Somewhat agree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,5,4,3,1,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,2,4,1,5,2,Agree,Disagree,Agree,Agree,Agree,5,4,1,3,2,2,Agree,Agree,Agree,Agree,Agree,3,2,4,1,5,FALSE,100,TRUE,100,TRUE,100,FALSE,74,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,86,TRUE,88,TRUE,100,TRUE,95,TRUE,97,FALSE,100,TRUE,100,FALSE,91,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,95,FALSE,100,FALSE,68,TRUE,95,TRUE,91,TRUE,86,TRUE,100,FALSE,74,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,2,0,0,1,1,1,1,-2,3,-2,3,2,2,2,2,1,3,2,3,1,2,2,-1,0,0,1,1,3,0,-2,2,-2,3,2,2,2,2,2,1,2,2,2,2,2,2,2,1,1,1,1,2,3,2,-2,2,2,2,2,2,2,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,86,TRUE,1,88,TRUE,0,100,TRUE,1,95,TRUE,1,97,FALSE,1,100,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,100,FALSE,0,68,TRUE,0,95,TRUE,0,91,TRUE,0,86,TRUE,1,100,FALSE,0,74,TRUE,1,100,0,0.4624,0.0009,0,0,0,0.0025,0,0,0,0,0.0144,0,0,0,0,0,0.0676,0.8281,0,0,0.0025,0.0081,1,0,0.9025,0.5476,0,1,1,0.7396,0.7396,0.244732143,0.006035714,0.483428571,30,93.75,23,71.88,6,75,7,87.5,5,62.5,5,62.5,14,87.5,9,56.25,95,91.12,96.75,96,96.12,94.81,95.19,21.87,23.12,16.12,9.25,33.5,33.62,7.31,38.94,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,4,1,0,0,0,0,1,0.8,0.4,0.4,0,0.2,0.6,1.4,0.2,0.4,0.6,0.5,2.33,2.33,2.25,0.6,-0.2,-1,-0.2,-0.2,0,0,0,0,0,0,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,55,"it seems somewhat frivolous ,I do not see the point ",1.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,01DIR,7,4,8,9,2,5,3,1,6,2,3,4,1 +328,R_3e2fo9qBxt2z05U,25 - 31,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Somewhat agree,1,2,5,3,4,Somewhat disagree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,3,5,4,2,1,Somewhat Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,2,4,1,5,3,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Strongly Agree,Neither agree nor disagree,5,4,2,1,3,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Agree,2,4,5,1,3,10,Somewhat agree,Strongly agree,Agree,Somewhat disagree,Neither agree nor disagree,1,4,5,2,3,10,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Somewhat Agree,1,2,4,5,3,8,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat disagree,Strongly Agree,3,1,5,2,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Agree,Agree,2,3,5,4,1,6,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,1,4,3,2,5,8,Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,3,2,1,4,5,7,Agree,Somewhat disagree,Somewhat agree,Strongly Agree,Somewhat disagree,1,3,5,2,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,70,FALSE,52,TRUE,83,TRUE,67,FALSE,57,TRUE,63,TRUE,62,FALSE,72,FALSE,59,FALSE,67,FALSE,59,FALSE,65,TRUE,64,FALSE,67,TRUE,77,TRUE,66,TRUE,59,FALSE,67,FALSE,70,FALSE,65,TRUE,63,FALSE,77,FALSE,57,FALSE,65,FALSE,65,TRUE,64,FALSE,65,FALSE,59,FALSE,60,FALSE,65,FALSE,65,FALSE,64,12,3,3,2,3,1,-1,3,3,-1,-1,1,1,3,3,2,1,0,-1,3,0,1,3,3,2,2,10,1,3,2,-1,0,10,1,0,3,2,1,8,1,3,1,-1,3,7,2,2,3,2,2,6,3,2,2,1,3,8,-2,1,1,0,3,7,2,-1,1,3,-1,8,FALSE,1,64,FALSE,0,65,FALSE,1,65,FALSE,1,60,FALSE,0,59,FALSE,1,65,TRUE,1,64,FALSE,0,65,FALSE,0,65,FALSE,0,57,FALSE,1,77,TRUE,0,63,FALSE,0,65,FALSE,1,70,FALSE,0,67,TRUE,1,59,TRUE,0,66,TRUE,0,77,FALSE,1,67,TRUE,0,64,FALSE,0,65,FALSE,0,59,FALSE,1,67,FALSE,0,59,FALSE,1,72,TRUE,1,62,TRUE,0,63,FALSE,1,57,TRUE,0,67,TRUE,1,83,FALSE,0,52,TRUE,1,70,0.4225,0.1444,0.1681,0.1296,0.09,0.1225,0.3481,0.3249,0.4096,0.3481,0.0289,0.4225,0.4225,0.0529,0.3481,0.4225,0.1089,0.16,0.1849,0.0784,0.4225,0.4489,0.1089,0.09,0.4356,0.3969,0.2704,0.1296,0.1225,0.5929,0.4489,0.3969,0.276314286,0.257821429,0.294807143,12,37.5,15,46.88,3,37.5,3,37.5,5,62.5,4,50,5,31.25,10,62.5,65,64.5,65.5,65.62,64.38,63.5,66.5,-9.38,18.12,27,28,3.12,14.38,32.25,4,2,0,1,1,1,2,0,1,0,1,0,1,0,1,1,0,3,2,4,3,1,1,1,1,1,4,1,1,2,4,3,0,2,3,1,1,1,2,0,1,1,0.8,0.6,2.4,1,2.4,1.8,1,1.2,1.55,1.375,9.33,7,8,0,-1.6,-1.2,1.4,-0.933333333,4,2,1,-1,2.33,2,2,0,-1,1,-1,1,2,-2,2,-2,1,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,30,,0.375,0,1,0,1,0,0,0.33,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,7,5,2,4,9,3,1,8,4,2,3,1 +329,R_6P5ndp1vUxA8rGX,67 - 73,,Canadian,Canadian,Male,Somewhat disagree,Agree,Agree,Agree,Agree,2,1,5,4,3,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,5,2,1,3,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,2,5,3,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,5,1,3,2,Somewhat disagree,Agree,Agree,Agree,Agree,2,1,5,3,4,1,Somewhat disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,5,2,1,3,3,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,2,1,5,3,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,3,2,5,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Agree,Agree,Agree,5,2,4,1,3,2,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,5,4,2,3,3,Agree,Agree,Agree,Somewhat Agree,Agree,4,5,1,2,3,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,3,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,FALSE,90,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,95,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,95,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,95,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,2,2,2,0,-2,2,-2,0,2,2,3,1,2,0,0,1,1,-1,-1,2,2,2,2,1,-1,-2,2,-1,0,3,1,1,2,0,1,3,1,1,2,2,1,2,-1,2,2,2,2,2,0,-1,1,-2,0,3,2,2,2,1,2,2,1,0,1,1,0,3,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,95,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.9025,0,0,0,0,0,0.01,1,0.0025,1,0,0,0,1,0,0.9025,1,0,1,0,1,0.279196429,0.065178571,0.493214286,28,87.5,24,75,7,87.5,5,62.5,6,75,6,75,13,81.25,11,68.75,99.22,98.12,99.38,99.38,100,99.38,99.06,12.5,24.22,10.62,36.88,24.38,25,18.13,30.31,0,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1,1,1,1,2,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0.4,1,1.2,0,0.4,0.2,0.4,0.65,0.25,0.45,2.33,2.33,2.375,0,0,0.8,0.8,0.266666667,-1,0,1,-1,0,1,1,0,1,-1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),69,very interesting survey ,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,2,8,9,7,5,3,6,1,4,2,3,4,1 +330,R_138QJj22J0zRWVj,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,1,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,4,5,2,3,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,3,5,4,1,1,Agree,Somewhat agree,Somewhat agree,Disagree,Agree,2,3,5,1,4,1,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Strongly Agree,3,2,5,4,1,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,2,4,5,1,1,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Agree,3,2,4,1,5,1,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Strongly agree,5,4,3,2,1,6,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,1,4,3,2,TRUE,86,TRUE,70,TRUE,66,FALSE,54,TRUE,59,FALSE,100,TRUE,78,TRUE,100,TRUE,53,TRUE,71,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,52,TRUE,100,FALSE,64,TRUE,100,TRUE,63,FALSE,100,FALSE,57,TRUE,100,FALSE,100,TRUE,100,FALSE,64,TRUE,100,FALSE,54,FALSE,100,TRUE,100,FALSE,58,TRUE,100,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,1,1,1,1,0,0,2,1,-1,3,-1,3,0,0,1,1,-1,2,2,2,1,1,2,2,1,1,-2,2,1,1,-2,2,-1,3,1,0,-1,1,1,-1,6,2,2,2,2,0,6,1,0,-1,0,2,1,1,-1,2,-2,3,1,-1,-2,0,0,-2,6,TRUE,0,86,TRUE,1,70,TRUE,0,66,FALSE,1,54,TRUE,1,59,FALSE,1,100,TRUE,1,78,TRUE,1,100,TRUE,1,53,TRUE,1,71,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,64,TRUE,0,100,TRUE,0,63,FALSE,1,100,FALSE,0,57,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,64,TRUE,1,100,FALSE,1,54,FALSE,1,100,TRUE,0,100,FALSE,0,58,TRUE,1,100,TRUE,1,100,0,0,0,0.0484,0,0,0,0.0841,0,0,0.3364,0,0.2209,0,0.1681,0.09,0,0.2116,0,0.1296,0.3249,0.2304,0.3969,0,0.1296,0.2116,0,0.7396,0.4356,1,1,1,0.239617857,0.079364286,0.399871429,23,71.88,24,75,7,87.5,6,75,6,75,5,62.5,14,87.5,10,62.5,82.78,68.25,85,87.38,90.5,81.12,84.44,-3.12,7.78,-19.25,10,12.38,28,-6.38,21.94,1,0,1,0,0,1,0,1,2,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0,1,1,0,1,2,1,1,1,0.4,0.8,0.4,0.2,0.8,0.4,0.4,1.2,0.45,0.7,0.575,1.33,2.67,3,-0.4,0.4,0,-1,0,-4,0,0,0,-1.34,1,2,1,-2,2,0,0,-1,1,-2,2,2,10 cents,25 minutes,24 days,Male,High School (or equivalent),71,thank you,1.375,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,3,8,7,4,6,5,1,9,3,2,4,1 +331,R_1Cr08YEudxQc7a9,32 - 38,,Canadian,Canadian,Female,Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,2,1,5,3,4,Somewhat disagree,Disagree,Agree,Agree,Neither agree nor disagree,4,3,5,1,2,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,2,3,5,4,1,Agree,Strongly Agree,Agree,Agree,Strongly Agree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,4,5,2,3,1,5,Strongly agree,Somewhat agree,Somewhat agree,Strongly disagree,Strongly agree,3,2,4,5,1,2,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Agree,3,2,1,5,4,5,Strongly Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,3,5,4,1,2,5,Strongly disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,2,1,5,4,4,Strongly agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,3,2,5,1,4,7,Strongly Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,2,4,5,1,3,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,64,FALSE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,85,FALSE,50,FALSE,50,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,1,0,-1,-2,2,2,0,3,1,1,2,1,2,3,2,2,3,3,3,-2,3,3,6,3,1,1,-3,3,5,3,0,1,-1,2,2,3,0,2,0,1,5,3,3,-2,3,3,4,-3,-3,0,0,-1,5,3,1,1,-2,2,4,3,1,2,1,0,7,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,64,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,85,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0.0225,0,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.4096,0.25,0.25,0.25,0.25,1,1,0.25,1,0.327932143,0.23375,0.422114286,3,9.38,15,46.88,3,37.5,4,50,3,37.5,5,62.5,5,31.25,10,62.5,62.47,50,62.5,64.25,73.12,61.56,63.38,-37.5,15.59,12.5,12.5,26.75,10.62,30.31,0.88,1,2,4,2,3,4,3,1,5,3,0,1,0,3,1,1,3,0,2,2,1,2,4,2,3,2,1,2,2,1,0,0,0,4,1,1,2,0,1,3,2.4,3.2,1,1.6,2.4,1.6,1,1.4,2.05,1.6,1.825,4.33,4.33,4.75,0,1.6,0,0.2,0.533333333,2,0,-2,-2,0,0,1,1,-1,1,1,-1,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),33,Asking a series of 32 questions and then some skill questions near the end. Also quality checks to see if you are paying attention.,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,9,3,8,4,5,2,7,1,6,2,4,3,1 +332,R_1s6gTd5jGExqCag,39 - 45,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,2,1,3,5,4,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,4,2,1,5,3,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,Agree,Agree,Agree,Agree,Agree,4,5,1,2,3,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,9,Agree,Agree,Agree,Agree,Agree,1,5,3,4,2,9,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,5,2,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,1,3,2,5,4,10,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,1,2,4,3,10,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,10,Agree,Agree,Agree,Agree,Agree,3,5,4,2,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,67,TRUE,78,TRUE,88,TRUE,84,TRUE,77,TRUE,81,TRUE,75,TRUE,79,TRUE,76,TRUE,79,TRUE,83,TRUE,81,TRUE,82,TRUE,65,TRUE,95,TRUE,79,TRUE,75,TRUE,79,TRUE,85,TRUE,85,TRUE,64,TRUE,81,TRUE,90,TRUE,88,TRUE,75,TRUE,80,TRUE,73,TRUE,72,TRUE,84,TRUE,76,TRUE,87,TRUE,79,16,2,2,2,2,2,0,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,8,1,1,1,1,1,8,2,2,2,2,2,10,0,0,1,-1,1,10,1,1,1,1,1,10,2,2,2,2,2,10,TRUE,0,79,TRUE,1,87,TRUE,0,76,TRUE,0,84,TRUE,1,72,TRUE,0,73,TRUE,1,80,TRUE,1,75,TRUE,1,88,TRUE,1,90,TRUE,0,81,TRUE,0,64,TRUE,1,85,TRUE,0,85,TRUE,1,79,TRUE,1,75,TRUE,0,79,TRUE,0,95,TRUE,0,65,TRUE,0,82,TRUE,1,81,TRUE,1,83,TRUE,0,79,TRUE,1,76,TRUE,0,79,TRUE,1,75,TRUE,0,81,TRUE,0,77,TRUE,0,84,TRUE,1,88,TRUE,1,78,TRUE,1,67,0.0625,0.0625,0.0625,0.04,0.1089,0.5329,0.0576,0.01,0.6724,0.0289,0.0144,0.0225,0.0144,0.6561,0.0784,0.0169,0.6241,0.7056,0.5929,0.6241,0.0361,0.0441,0.4225,0.7225,0.6241,0.6561,0.0484,0.6241,0.5776,0.9025,0.7056,0.4096,0.376189286,0.253078571,0.4993,16,50,16,50,4,50,4,50,4,50,4,50,16,100,0,0,79.44,80.38,77.5,83.25,76.62,79.94,78.94,0,29.44,30.38,27.5,33.25,26.62,-20.06,78.94,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0.8,0,1,0,1,1,0,0.45,0.5,0.475,8.67,10,9.25,0,-0.2,-1,1,-0.4,-1,-1,-2,-2,-1.33,1,1,1,0,0,1,-1,1,-1,1,-1,1,10 cents,25 minutes,24 days,Female,Trade School (non-military),40,The survey was excellent.,0.125,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,9,4,6,3,8,2,5,1,7,4,2,3,1 +333,R_3GcvCyzqWXpEvn0,46 - 52,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,3,1,4,2,5,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,3,4,2,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,2,5,1,3,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,4,3,6,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,2,1,5,3,9,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,1,2,4,3,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,10,Agree,Somewhat disagree,Agree,Agree,Somewhat disagree,2,5,4,1,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,10,Disagree,Disagree,Disagree,Disagree,Strongly disagree,4,1,5,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,76,TRUE,96,TRUE,94,TRUE,100,FALSE,66,TRUE,95,FALSE,100,TRUE,100,FALSE,98,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,85,FALSE,100,FALSE,100,TRUE,100,FALSE,90,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,96,TRUE,100,TRUE,100,FALSE,100,28,3,3,2,3,2,3,-2,3,-3,3,3,3,2,2,3,-1,-2,-1,-1,-3,3,3,3,3,3,7,3,-3,3,-3,2,6,3,3,2,3,3,9,3,3,3,3,3,10,3,3,3,3,3,10,2,-1,2,2,-1,10,3,3,3,3,3,4,-2,-2,-2,-2,-3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,96,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,66,TRUE,0,100,TRUE,0,94,TRUE,1,96,TRUE,1,76,TRUE,1,100,0,0.0025,0,0,0,0,0,0,1,0,0.0016,1,0,0.01,0,0,0.0004,0.9216,1,0,0,0.0225,0,0,0,0.1156,0.0576,0,1,0,0.8836,1,0.250460714,0.209542857,0.291378571,28,87.5,25,78.13,7,87.5,6,75,8,100,4,50,15,93.75,10,62.5,96.75,89.12,99,99.38,99.5,97,96.5,9.37,18.62,1.62,24,-0.62,49.5,3.25,34,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,4,5,4,4,6,0,0,1,0,1,1,1,1,5,4,0,0,1,1,0,1,0,1,1,0,0.4,0.4,0.2,4.6,0.4,2.4,0.4,0.6,1.4,0.95,1.175,7.33,8,8.25,0,-2,-0.2,4,-0.733333333,-3,-4,5,0,-0.67,1,2,2,1,-1,-2,2,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,University - PhD,48,Interesting Survey would like to participate in more such Surveys.,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,7,4,8,2,6,9,3,1,5,2,3,4,1 +334,R_7PzgbNGfqCYPx9p,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,4,2,Strongly disagree,Somewhat disagree,Agree,Strongly agree,Somewhat disagree,2,5,1,4,3,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,5,2,3,4,1,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,1,3,0,Strongly disagree,Somewhat disagree,Agree,Strongly agree,Somewhat disagree,4,3,5,1,2,1,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,5,3,2,1,4,3,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,2,3,0,Strongly disagree,Somewhat disagree,Agree,Strongly agree,Somewhat disagree,1,5,4,3,2,1,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly agree,3,5,2,1,4,0,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,2,1,5,3,4,FALSE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,75,FALSE,70,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,85,TRUE,50,FALSE,100,TRUE,100,TRUE,78,FALSE,89,TRUE,85,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,-3,-1,2,3,-1,2,1,1,-3,3,1,2,1,2,1,3,3,3,3,3,5,-3,-1,2,3,-1,0,2,1,1,-3,3,1,1,2,1,1,1,3,3,3,3,3,3,1,-3,-1,2,3,-1,0,2,1,1,-3,3,1,1,2,1,2,1,0,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,1,70,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,85,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,78,FALSE,0,89,TRUE,1,85,0,0.0225,0,0,0.0225,0,0,0,0,0,0.0484,0.0625,0.25,0.25,0,0,0,0.25,0,0.5625,0.25,0.25,0.25,0.09,0.25,0.25,0.7921,0,0,0.25,1,0.25,0.181357143,0.0631,0.299614286,16,50,26,81.25,5,62.5,6,75,7,87.5,8,100,14,87.5,12,75,79.91,61.12,82.5,85,91,85.12,74.69,-31.25,-1.34,-1.38,7.5,-2.5,-9,-2.38,-0.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0.05,0,0.025,2,0.67,1.375,0,0,0,0.2,0,4,0,0,3,1.33,1,1,0,-2,2,0,0,0,0,-1,1,-1,10 cents,5 minutes,24 days,Female,University - Undergraduate,57,,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,02DGEN,01DIR,5,2,8,9,3,6,4,1,7,3,4,2,1 +335,R_3hEDoZrChL2qwgr,53 - 59,American,,American,Female,Neither agree nor disagree,Agree,Somewhat agree,Agree,Strongly agree,3,2,5,1,4,Strongly disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,4,2,3,1,5,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,2,3,1,5,4,Agree,Agree,Agree,Agree,Agree,4,1,3,5,2,Disagree,Agree,Somewhat agree,Agree,Strongly Agree,1,3,5,2,4,1,Disagree,Disagree,Agree,Disagree,Agree,4,3,2,5,1,0,Agree,Agree,Agree,Agree,Agree,5,3,1,2,4,1,Agree,Agree,Agree,Agree,Agree,3,1,4,2,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Somewhat agree,Somewhat agree,Agree,Agree,3,1,2,4,5,1,Disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,3,5,1,4,2,0,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,1,Agree,Agree,Agree,Agree,Agree,5,4,1,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,81,TRUE,91,FALSE,52,TRUE,100,FALSE,90,TRUE,100,TRUE,100,FALSE,50,FALSE,87,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,80,FALSE,54,FALSE,60,TRUE,74,FALSE,50,FALSE,50,TRUE,89,TRUE,85,TRUE,97,FALSE,59,FALSE,50,TRUE,54,TRUE,97,FALSE,82,TRUE,87,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,2,1,2,3,-3,-2,2,-1,1,1,2,1,1,0,2,2,2,2,2,-2,2,1,2,3,1,-2,-2,2,-2,2,0,2,2,2,2,2,1,2,2,2,2,2,0,-2,1,1,2,2,1,-2,-2,3,-2,0,0,2,2,2,2,2,1,2,2,2,2,2,0,TRUE,0,100,TRUE,1,81,TRUE,0,91,FALSE,1,52,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,87,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,80,FALSE,1,54,FALSE,1,60,TRUE,1,74,FALSE,0,50,FALSE,1,50,TRUE,1,89,TRUE,0,85,TRUE,1,97,FALSE,1,59,FALSE,1,50,TRUE,0,54,TRUE,1,97,FALSE,0,82,TRUE,1,87,0,0.0009,0,0,0.0169,0.01,0.0121,0.7569,0.16,0.25,0.0009,0,0.25,0.25,0,0.0361,0.25,0.2304,0.25,0.7225,0.0676,0.25,0.2116,1,0.25,0.1681,0.6724,1,0.8281,0.64,0.2916,1,0.341971429,0.158807143,0.525135714,24,75,20,62.5,5,62.5,7,87.5,2,25,6,75,11,68.75,9,56.25,77.16,59.75,75.62,87.38,85.88,84,70.31,12.5,14.66,-2.75,-11.88,62.38,10.88,15.25,14.06,2,0,0,0,0,1,0,0,1,1,1,0,1,1,2,0,0,0,0,0,2,1,0,0,1,1,0,1,1,1,1,0,1,1,2,0,0,0,0,0,0.4,0.6,1,0,0.8,0.8,1,0,0.5,0.65,0.575,0.67,0.67,0.5,-0.4,-0.2,0,0,-0.2,0,0,0,0,0,0,-2,1,-2,2,0,0,0,0,-2,2,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,54,none,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,9,5,7,6,8,4,1,2,2,3,4,1 +336,R_6JsgvtLboY690D4,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Strongly agree,Agree,Disagree,3,1,5,2,4,Somewhat disagree,Disagree,Strongly agree,Disagree,Somewhat agree,1,4,3,5,2,Agree,Disagree,Agree,Disagree,Strongly Agree,1,5,3,4,2,Strongly disagree,Disagree,Disagree,Disagree,Strongly disagree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Strongly Agree,Agree,Disagree,5,1,2,3,4,4,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,5,3,1,4,2,4,Agree,Disagree,Agree,Somewhat Agree,Strongly Agree,2,5,3,4,1,7,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Strongly Agree,Agree,Disagree,2,4,1,3,5,2,Disagree,Somewhat agree,Strongly agree,Disagree,Disagree,5,1,4,3,2,6,Agree,Disagree,Agree,Strongly Disagree,Strongly agree,3,1,5,2,4,7,Agree,Somewhat agree,Agree,Agree,Disagree,2,1,3,4,5,TRUE,86,TRUE,62,TRUE,91,FALSE,56,FALSE,53,FALSE,56,TRUE,76,TRUE,72,TRUE,51,TRUE,87,TRUE,52,TRUE,90,TRUE,59,TRUE,51,FALSE,51,TRUE,73,FALSE,51,TRUE,91,FALSE,52,FALSE,93,TRUE,58,FALSE,51,FALSE,53,TRUE,59,FALSE,67,TRUE,91,FALSE,52,FALSE,53,TRUE,61,FALSE,82,TRUE,89,TRUE,96,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,2,-2,-1,-2,3,-2,1,2,-2,2,-2,3,-3,-2,-2,-2,-3,2,2,3,2,-2,3,1,-2,3,-2,2,4,2,-2,2,1,3,4,-1,1,1,2,-2,7,2,2,3,2,-2,2,-2,1,3,-2,-2,2,2,-2,2,-3,3,6,2,1,2,2,-2,7,TRUE,0,86,TRUE,1,62,TRUE,0,91,FALSE,1,56,FALSE,0,53,FALSE,1,56,TRUE,1,76,TRUE,1,72,TRUE,1,51,TRUE,1,87,TRUE,0,52,TRUE,0,90,TRUE,1,59,TRUE,0,51,FALSE,0,51,TRUE,1,73,FALSE,1,51,TRUE,0,91,FALSE,1,52,FALSE,1,93,TRUE,1,58,FALSE,0,51,FALSE,1,53,TRUE,1,59,FALSE,1,67,TRUE,1,91,FALSE,1,52,FALSE,1,53,TRUE,0,61,FALSE,0,82,TRUE,1,89,TRUE,1,96,0.0784,0.0081,0.0729,0.0576,0.0016,0.1936,0.1681,0.0169,0.0049,0.2601,0.6724,0.1681,0.2401,0.2704,0.2809,0.1444,0.2209,0.1936,0.2209,0.1089,0.1764,0.2601,0.2304,0.2601,0.2401,0.2304,0.0121,0.7396,0.8281,0.8281,0.3721,0.81,0.291189286,0.202571429,0.379807143,8,25,21,65.63,6,75,6,75,4,50,5,62.5,12,75,9,56.25,67.66,58.12,60.88,75,76.62,69.38,65.94,-40.63,2.03,-16.88,-14.12,25,14.12,-5.62,9.69,0,0,0,0,0,2,0,0,0,1,0,0,0,3,0,2,3,3,4,1,0,0,0,0,0,1,3,0,0,3,0,0,0,1,0,5,3,4,4,1,0,0.6,0.6,2.6,0,1.4,0.2,3.4,0.95,1.25,1.1,3.67,3.33,4.375,0,-0.8,0.4,-0.8,-0.133333333,1,2,-2,0,0.34,0,2,1,-1,1,-1,1,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,Thank you ,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,6,9,8,7,3,2,5,1,4,2,3,4,1 +337,R_11XxjRTPru0bWxt,60 - 66,American,,American,Male,Disagree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,4,2,3,Disagree,Somewhat agree,Disagree,Somewhat agree,Disagree,1,3,5,4,2,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,5,2,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,3,4,5,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,9,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,8,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,4,1,3,5,10,Disagree,Somewhat disagree,Disagree,Disagree,Somewhat disagree,2,4,5,3,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,5,1,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,4,1,3,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,2,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,Strongly disagree,5,3,4,1,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,100,TRUE,80,TRUE,60,TRUE,50,TRUE,76,TRUE,50,TRUE,100,TRUE,76,TRUE,100,TRUE,50,FALSE,50,TRUE,50,TRUE,91,TRUE,91,TRUE,70,TRUE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,80,TRUE,100,FALSE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,50,25,-2,2,3,0,1,-2,1,-2,1,-2,0,1,2,0,1,-3,-3,-3,-3,-3,1,2,2,0,1,9,-1,1,1,1,0,8,0,1,2,1,0,10,-2,-1,-2,-2,-1,10,0,0,0,0,0,10,-3,-3,-3,-3,-3,10,0,0,0,0,0,5,1,1,1,-3,-3,10,TRUE,0,50,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,80,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,70,TRUE,0,91,TRUE,0,91,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,76,TRUE,1,100,TRUE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,60,TRUE,0,80,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.04,0.0576,0.09,0,0,0.25,0,0,0.25,0,0,0,0.25,0.25,0.25,0.25,0.5776,0.25,0.36,0.25,0.25,0.25,0.25,0.25,0.8281,0.25,0.0625,0.25,1,0.8281,0.64,1,0.314153571,0.166257143,0.46205,25,78.13,19,59.38,4,50,5,62.5,5,62.5,5,62.5,16,100,3,18.75,71.84,53.12,74.62,77.12,82.5,78.19,65.5,18.75,12.46,3.12,12.12,14.62,20,-21.81,46.75,3,0,1,0,0,1,0,3,0,2,0,0,0,1,1,1,2,1,1,2,2,2,3,0,1,1,4,1,4,1,0,1,2,0,1,4,4,4,0,0,0.8,1.2,0.4,1.4,1.6,2.2,0.8,2.4,0.95,1.75,1.35,9,8.33,9,-0.8,-1,-0.4,-1,-0.733333333,-1,-2,5,0,0.67,0,1,1,-2,2,0,0,-1,1,-2,2,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),61,Questions that I should have known I don't think I did,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,7,8,6,3,9,4,1,5,2,3,4,1 +338,R_6DTwiYnZ5g4Op84,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,4,3,5,1,Disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,1,5,3,2,Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,5,3,4,1,2,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,3,4,5,1,2,1,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Agree,2,3,5,4,1,1,Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,2,3,4,5,1,3,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Strongly Agree,Agree,Agree,3,2,4,5,1,1,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,2,1,3,5,1,Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,5,3,4,1,2,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,1,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,86,TRUE,100,TRUE,100,FALSE,62,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,96,FALSE,100,TRUE,100,TRUE,100,FALSE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,97,FALSE,95,TRUE,100,FALSE,100,31,3,3,3,1,3,-2,-2,3,-1,1,2,0,2,2,1,-3,-2,0,-3,-3,3,3,3,-2,3,1,-2,-2,3,0,2,1,2,0,2,2,1,1,-2,-2,0,-3,-3,3,3,2,3,2,2,1,-2,-1,2,0,2,1,2,0,2,2,1,1,-3,-3,-3,-3,-3,1,FALSE,1,100,TRUE,1,100,FALSE,1,95,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,99,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,96,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,0,100,TRUE,1,100,FALSE,0,86,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0001,0,0,0,0.0009,0.1444,0,0,0.9216,0,0,0,0,0.7396,0,0.0025,0,1,1,0.136039286,0.0000714,0.272007143,31,96.88,28,87.5,6,75,7,87.5,8,100,7,87.5,14,87.5,14,87.5,97.97,97.25,100,100,94.62,98.88,97.06,9.38,10.47,22.25,12.5,0,7.12,11.38,9.56,0,0,0,3,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,3,0,0,0.6,0.4,0,0.2,0.6,0.8,0,0.8,0.3,0.55,0.425,1,1,1.25,0,-0.4,0,-0.6,-0.133333333,0,0,0,2,0,0,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,9,3,4,2,8,7,5,1,6,2,4,3,1 +339,R_5jfujassAQJlmEo,46 - 52,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,3,5,Neither agree nor disagree,Strongly disagree,Disagree,Neither agree nor disagree,Strongly agree,3,2,1,4,5,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,1,4,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,3,5,2,7,Somewhat agree,Somewhat agree,Strongly disagree,Neither agree nor disagree,Strongly agree,1,2,3,4,5,10,Strongly Disagree,Disagree,Somewhat Agree,Agree,Somewhat Agree,5,1,3,4,2,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,1,3,3,Somewhat disagree,Strongly disagree,Strongly disagree,Disagree,Strongly agree,5,4,3,2,1,0,Strongly Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,1,2,4,3,10,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,2,5,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,75,TRUE,98,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,94,FALSE,100,FALSE,84,TRUE,60,TRUE,50,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,76,TRUE,100,FALSE,91,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,74,FALSE,100,25,2,3,3,3,3,0,-3,-2,0,3,-2,-3,3,-3,3,0,1,1,-1,-3,2,3,3,3,3,7,1,1,-3,0,3,7,-3,-2,1,2,1,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,4,-1,-3,-3,-2,3,3,-3,-3,3,-3,3,0,2,2,2,2,0,10,FALSE,1,100,TRUE,1,74,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,0,91,TRUE,1,100,TRUE,1,76,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,0,60,FALSE,1,84,FALSE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,98,FALSE,0,75,TRUE,1,100,0,0,0,0.8281,0,0,0,1,0.0256,0.0036,0.0004,0,0.0576,0,0,0.0676,0,0.25,0,0,1,0.25,0.36,0,0,0.25,0.5625,0,0,0.25,1,1,0.217046429,0.100342857,0.33375,25,78.13,23,71.88,5,62.5,6,75,5,62.5,7,87.5,12,75,11,68.75,89.12,66.88,100,91.88,97.75,91.12,87.12,6.25,17.24,4.38,25,29.38,10.25,16.12,18.37,0,0,0,0,0,1,4,1,0,0,1,1,2,5,2,3,4,4,2,0,1,0,0,0,0,1,0,1,2,0,1,0,0,0,0,2,1,1,3,3,0,1.2,2.2,2.6,0.2,0.8,0.2,2,1.5,0.8,1.15,8,2.33,6.375,-0.2,0.4,2,0.6,0.733333333,3,4,10,0,5.67,2,2,2,-2,2,2,-2,-1,1,-2,2,0,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,46,i dont have any,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,6,7,4,3,9,8,2,1,5,3,4,2,1 +340,R_7etxJyVTqqJqk6d,53 - 59,American,,American,Male,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,1,4,5,3,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,4,5,1,2,3,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,4,5,3,2,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,2,3,1,5,4,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,2,3,4,5,1,5,Disagree,Disagree,Agree,Disagree,Agree,5,1,4,3,2,3,Agree,Agree,Agree,Agree,Agree,1,3,4,2,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,3,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Agree,Strongly Agree,Neither agree nor disagree,3,1,2,4,5,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,3,5,2,4,5,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,2,4,1,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,2,4,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,97,TRUE,94,TRUE,99,FALSE,50,FALSE,50,FALSE,85,TRUE,100,TRUE,97,TRUE,91,TRUE,100,FALSE,100,TRUE,90,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,99,TRUE,98,FALSE,100,FALSE,50,TRUE,98,TRUE,100,TRUE,76,TRUE,73,TRUE,100,FALSE,50,FALSE,100,TRUE,59,TRUE,100,FALSE,50,TRUE,75,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,2,1,-1,-2,2,-2,1,1,2,2,0,2,0,1,2,-1,1,0,2,2,0,2,5,-2,-2,2,-2,2,3,2,2,2,2,2,1,0,0,0,0,-1,5,-1,2,2,3,0,2,-1,0,1,-2,0,5,2,2,2,0,2,1,0,0,0,0,-1,5,FALSE,1,97,TRUE,1,94,TRUE,0,99,FALSE,1,50,FALSE,0,50,FALSE,1,85,TRUE,1,100,TRUE,1,97,TRUE,1,91,TRUE,1,100,FALSE,1,100,TRUE,0,90,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,99,TRUE,0,98,FALSE,1,100,FALSE,0,50,TRUE,1,98,TRUE,0,100,TRUE,1,76,TRUE,0,73,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,59,TRUE,1,100,FALSE,0,50,TRUE,1,75,0.0009,0,0,0,0.0625,0.0225,0.0576,0,0,0.0004,0,0,0.0081,0,0.25,0.0036,1,0.25,0,0.5329,0.25,0.25,0.9604,1,0.25,0.25,0.25,0.0009,0.9801,0.9801,0.3481,0.81,0.304185714,0.118192857,0.490178571,22,68.75,21,65.63,6,75,4,50,5,62.5,6,75,13,81.25,8,50,83.78,72.88,71.12,95.88,95.25,83.19,84.38,3.12,18.15,-2.12,21.12,33.38,20.25,1.94,34.38,1,0,0,2,1,1,0,0,0,1,1,0,0,2,0,0,1,2,1,2,2,0,0,1,1,0,2,1,0,1,1,0,0,0,0,0,1,2,1,2,0.8,0.4,0.6,1.2,0.8,0.8,0.2,1.2,0.75,0.75,0.75,3,2.67,3.375,0,-0.4,0.4,0,0,3,-2,0,0,0.33,0,1,2,-1,1,0,0,2,-2,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,58,"I like this survey, it gave my mind a good workout.",0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,9,2,6,7,4,8,3,1,5,3,2,4,1 +341,R_77D4w3eu85U5Wqu,60 - 66,,Canadian,Canadian,Female,Neither agree nor disagree,Agree,Agree,Agree,Agree,1,5,4,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,1,4,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,4,1,3,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,3,4,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,3,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,3,5,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,6,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,5,3,1,2,6,Agree,Agree,Agree,Agree,Agree,1,4,2,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,TRUE,50,TRUE,76,FALSE,64,FALSE,66,FALSE,75,FALSE,61,FALSE,52,FALSE,50,TRUE,50,FALSE,50,TRUE,53,FALSE,53,FALSE,53,TRUE,53,FALSE,53,FALSE,50,FALSE,50,TRUE,50,TRUE,62,TRUE,67,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,98,15,0,2,2,2,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,0,0,0,0,2,6,0,0,0,0,0,5,1,1,1,1,1,6,1,1,1,1,1,5,0,0,0,0,0,7,0,0,0,0,0,5,0,1,0,1,1,6,2,2,2,2,2,6,TRUE,0,98,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,67,TRUE,1,62,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,53,TRUE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,53,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,52,FALSE,0,61,FALSE,1,75,FALSE,1,66,FALSE,1,64,TRUE,1,76,TRUE,1,50,FALSE,0,50,0.25,0.3721,0.25,0.25,0.25,0.25,0.25,0.25,0.2209,0.25,0.0576,0.1444,0.25,0.25,0.25,0.25,0.25,0.25,0.1156,0.2304,0.2209,0.25,0.2209,0.25,0.2209,0.0625,0.25,0.9604,0.25,0.2809,0.1296,0.4489,0.252282143,0.226635714,0.277928571,15,46.88,15,46.88,5,62.5,5,62.5,1,12.5,4,50,4,25,11,68.75,55.81,53.5,54,58,57.75,53.25,58.38,0,8.93,-9,-8.5,45.5,7.75,28.25,-10.37,0,2,2,2,0,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,0,2,2,2,2,1,1,1,2,1,1,0,1,0,1,1,1,1,1,1,1.2,1.2,0.2,0,1.6,1.2,0.6,1,0.65,1.1,0.875,5.67,6,5.75,-0.4,0,-0.4,-1,-0.266666667,-1,0,0,-1,-0.33,0,1,0,1,-1,-1,1,0,0,-1,1,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),63,none,0.25,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,6,3,4,9,2,8,7,1,5,2,3,4,1 +342,R_10Hwl0ASEOovzbj,53 - 59,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat disagree,5,3,4,1,2,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,4,1,5,3,Agree,Disagree,Strongly Agree,Strongly Agree,Agree,1,2,5,4,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,2,3,1,4,3,Strongly disagree,Somewhat agree,Agree,Agree,Agree,5,1,2,4,3,8,Agree,Disagree,Strongly Agree,Agree,Somewhat Disagree,5,4,3,2,1,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,3,5,2,4,3,Strongly disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,1,3,4,2,5,Strongly agree,Disagree,Strongly agree,Strongly agree,Agree,1,4,3,5,2,5,Disagree,Disagree,Disagree,Disagree,Strongly disagree,3,5,4,2,1,FALSE,100,TRUE,100,TRUE,90,FALSE,50,TRUE,100,TRUE,60,TRUE,100,TRUE,90,TRUE,100,TRUE,100,FALSE,50,TRUE,90,TRUE,100,FALSE,100,FALSE,80,TRUE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,50,TRUE,80,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,70,FALSE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,90,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,1,-1,-3,0,2,0,1,2,-2,3,3,2,-3,-3,-3,-3,-3,3,3,1,1,-1,5,-3,1,2,2,2,3,2,-2,3,2,-1,8,-3,-3,-3,-3,-3,6,3,3,0,2,0,5,-3,-2,2,-1,0,3,3,-2,3,3,2,5,-2,-2,-2,-2,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,0,60,TRUE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,90,TRUE,1,100,FALSE,1,100,FALSE,0,80,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,90,TRUE,0,50,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,FALSE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,90,0.01,0.09,0,0,0.01,0.36,0,0,0.25,0,0,0,0,0.25,0,0,0,0.25,0.25,0,0.04,0.64,0.81,0,1,0,0.25,0,0.81,1,1,0.81,0.276071429,0.08,0.472142857,28,87.5,23,71.88,6,75,5,62.5,7,87.5,5,62.5,15,93.75,8,50,87.19,77.5,91.25,96.25,83.75,91.25,83.12,15.62,15.31,2.5,28.75,8.75,21.25,-2.5,33.12,0,0,1,0,0,0,1,0,2,1,0,0,0,1,3,0,0,0,0,0,0,0,2,1,1,0,2,0,1,1,1,0,0,0,0,1,1,1,1,0,0.2,0.8,0.8,0,0.8,0.8,0.2,0.8,0.45,0.65,0.55,5.33,4.33,5,-0.6,0,0.6,-0.8,0,0,0,3,1,1,2,2,2,-2,2,-2,2,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,56,,2,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,7,2,6,4,5,8,9,1,3,3,2,4,1 +343,R_51WXEtmjXUZBgzu,60 - 66,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,1,5,2,4,3,Somewhat agree,Disagree,Agree,Somewhat disagree,Strongly agree,3,2,5,4,1,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly Agree,3,1,2,5,4,Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,3,1,2,5,4,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,3,5,2,4,1,2,Strongly agree,Somewhat disagree,Agree,Somewhat disagree,Agree,2,3,1,5,4,2,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,4,1,5,3,2,Strongly Agree,Agree,Strongly Agree,Agree,Agree,4,2,5,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,Agree,3,2,1,4,5,2,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Agree,5,4,2,3,1,2,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly Agree,2,4,1,3,5,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,5,1,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,63,TRUE,81,FALSE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,50,TRUE,96,FALSE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,90,TRUE,90,FALSE,100,FALSE,100,FALSE,50,TRUE,52,TRUE,88,TRUE,90,TRUE,100,FALSE,50,FALSE,100,TRUE,70,TRUE,100,TRUE,70,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,1,2,1,-2,2,-1,3,3,0,2,-1,3,2,1,2,3,3,3,3,2,1,3,2,3,-1,2,-1,2,2,3,1,2,0,3,2,3,2,3,2,2,2,3,3,0,2,2,2,3,-2,3,-1,2,2,3,0,2,-1,3,2,3,2,3,3,3,2,TRUE,0,63,TRUE,1,81,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,1,96,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,90,TRUE,0,90,FALSE,1,100,FALSE,0,100,FALSE,0,50,TRUE,0,52,TRUE,1,88,TRUE,0,90,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,70,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0,0.0144,0,0,0.25,0,0.0016,0.25,0.25,0.25,0.0361,0.2704,0.25,0,0.81,1,0.25,0.81,0,0.25,0.25,0.09,0.3969,0,0.01,0.49,0.25,0.220692857,0.112321429,0.329064286,17,53.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,79.38,61.38,77.25,86.62,92.25,83.44,75.31,-18.75,7.5,-13.62,14.75,24.12,4.75,2.19,12.81,0,0,0,0,1,2,1,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,2,1,0,2,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0.2,0.8,0.4,1,0.6,0.8,0,0.6,0.6,0.5,0.55,2,2,2,-0.4,0,0.4,0.4,0,0,0,0,0,0,2,2,2,-2,2,0,0,0,0,-2,2,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,good survey great things to think about,1.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,5,6,9,2,8,3,7,1,4,4,3,2,1 +344,R_7MFjmjTfEMufNe2,46 - 52,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Somewhat agree,Agree,Agree,3,2,1,4,5,Strongly disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,2,1,4,5,3,Somewhat Agree,Strongly Disagree,Strongly Agree,Disagree,Agree,2,4,3,5,1,Strongly disagree,Disagree,Disagree,Disagree,Somewhat disagree,5,4,3,2,1,Strongly Agree,Agree,Agree,Somewhat agree,Agree,5,4,3,2,1,0,Strongly disagree,Disagree,Agree,Disagree,Agree,1,2,4,5,3,2,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Agree,1,4,5,2,3,2,Disagree,Disagree,Disagree,Disagree,Disagree,3,2,1,5,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Agree,Somewhat agree,2,3,4,5,1,9,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,2,3,4,5,4,Strongly Agree,Strongly Disagree,Strongly Agree,Disagree,Agree,4,2,3,5,1,1,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,Disagree,3,1,5,4,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,TRUE,50,TRUE,63,FALSE,68,FALSE,83,TRUE,50,FALSE,50,FALSE,100,TRUE,68,FALSE,97,TRUE,96,TRUE,62,TRUE,50,TRUE,71,TRUE,66,FALSE,70,TRUE,87,FALSE,50,TRUE,83,FALSE,50,FALSE,86,FALSE,64,FALSE,55,TRUE,68,TRUE,92,TRUE,82,FALSE,50,TRUE,100,FALSE,50,FALSE,72,TRUE,90,FALSE,84,20,3,1,1,2,2,-3,0,2,-1,1,1,-3,3,-2,2,-3,-2,-2,-2,-1,3,2,2,1,2,0,-3,-2,2,-2,2,2,2,-3,3,-3,2,2,-2,-2,-2,-2,-2,2,3,2,2,2,1,9,-3,1,1,1,0,4,3,-3,3,-2,2,1,-3,-3,-2,-3,-2,3,FALSE,1,84,TRUE,1,90,FALSE,1,72,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,82,TRUE,1,92,TRUE,1,68,FALSE,0,55,FALSE,1,64,FALSE,1,86,FALSE,0,50,TRUE,0,83,FALSE,0,50,TRUE,1,87,FALSE,1,70,TRUE,0,66,TRUE,0,71,TRUE,0,50,TRUE,1,62,TRUE,1,96,FALSE,1,97,TRUE,1,68,FALSE,1,100,FALSE,0,50,TRUE,0,50,FALSE,1,83,FALSE,1,68,TRUE,1,63,TRUE,1,50,TRUE,1,75,0.0064,0.25,0.0169,0.0324,0.0625,0.25,0.1024,0.3025,0.25,0.0016,0.1369,0.25,0.1024,0.1296,0,0.01,0.0009,0.25,0.0289,0,0.1444,0.25,0.5041,0.6889,0.09,0.25,0.25,0.0256,0.0784,0.4356,0.1024,0.0196,0.168453571,0.132057143,0.20485,20,62.5,23,71.88,5,62.5,7,87.5,4,50,7,87.5,12,75,11,68.75,71.31,61.62,71.5,77,75.12,71.12,71.5,-9.38,-0.57,-0.88,-16,27,-12.38,-3.88,2.75,0,1,1,1,0,0,2,0,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,0,1,1,2,1,2,0,0,0,0,0,1,0,1,1,0.6,0.8,0.4,0.4,0.6,1,0.4,0.6,0.55,0.65,0.6,1.33,4.67,2.875,0,-0.2,0,-0.2,-0.066666667,-9,-2,1,-1,-3.34,1,2,2,-2,2,-1,1,-1,1,-2,2,1,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),48,The logic puzzles are hard.,1.5,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,6,5,9,4,7,8,3,1,2,4,3,2,1 +345,R_7g13iJm8PT5Lh2e,53 - 59,American,,American,Female,Agree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,1,4,2,Somewhat agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,1,5,3,2,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,3,1,4,2,5,Strongly disagree,Somewhat disagree,Strongly disagree,Somewhat agree,Strongly disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,4,3,1,5,2,7,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,4,2,1,3,5,8,Somewhat Disagree,Somewhat Agree,Strongly Agree,Disagree,Somewhat Agree,4,3,2,1,5,6,Disagree,Disagree,Disagree,Neither agree nor disagree,Disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Agree,Strongly Agree,Agree,Neither agree nor disagree,2,4,5,1,3,6,Somewhat agree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,2,4,1,3,5,5,Somewhat Agree,Strongly agree,Strongly agree,Agree,Somewhat Agree,5,4,3,1,2,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Disagree,1,4,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,60,TRUE,91,TRUE,50,TRUE,94,FALSE,50,FALSE,65,TRUE,70,FALSE,50,FALSE,50,TRUE,72,TRUE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,76,FALSE,98,FALSE,63,TRUE,75,FALSE,54,TRUE,94,FALSE,53,TRUE,100,FALSE,54,TRUE,100,TRUE,96,FALSE,50,FALSE,50,FALSE,56,TRUE,87,FALSE,54,TRUE,90,16,2,2,1,-1,1,1,2,3,3,-1,1,1,3,2,1,-3,-1,-3,1,-3,3,3,2,1,3,7,1,1,3,1,1,7,-1,1,3,-2,1,8,-2,-2,-2,0,-2,6,3,2,3,2,0,6,1,-2,0,-1,1,6,1,3,3,2,1,5,0,1,1,2,-2,5,TRUE,0,90,FALSE,0,54,TRUE,0,87,FALSE,1,56,FALSE,0,50,FALSE,1,50,TRUE,1,96,TRUE,1,100,FALSE,0,54,TRUE,1,100,FALSE,1,53,TRUE,0,94,FALSE,0,54,TRUE,0,75,FALSE,0,63,FALSE,0,98,TRUE,0,76,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,72,FALSE,1,50,FALSE,0,50,TRUE,0,70,FALSE,0,65,FALSE,1,50,TRUE,0,94,TRUE,0,50,TRUE,1,91,FALSE,0,60,TRUE,1,100,0,0.4225,0.9604,0.0016,0,0.25,0.25,0,0.25,0.0784,0.0081,0.2916,0.2916,0.2209,0.25,0.2916,0.25,0.1936,0.8836,0.49,0.25,0.3969,0.25,0.5625,0.5776,0.25,0.36,0.81,0.7569,1,0.25,0.8836,0.369532143,0.187557143,0.551507143,16,50,14,43.75,4,50,4,50,3,37.5,3,37.5,7,43.75,7,43.75,70.38,55,60,83.5,83,72.31,68.44,6.25,26.63,5,10,46,45.5,28.56,24.69,1,1,1,2,2,0,1,0,2,2,2,0,0,4,0,1,1,1,1,1,1,0,2,3,1,0,4,3,4,2,0,2,0,0,0,3,2,4,1,1,1.4,1,1.2,1,1.4,2.6,0.4,2.2,1.15,1.65,1.4,7.33,5.67,6.25,0,-1.6,0.8,-1.2,-0.266666667,1,1,3,1,1.66,1,1,1,-1,1,0,0,0,0,1,-1,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),55,,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,2,6,9,8,5,4,3,1,7,2,4,3,1 +346,R_3aK34IiIm2trdOD,60 - 66,American,,American,Female,Somewhat agree,Strongly agree,Disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,Disagree,Strongly disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,1,5,3,4,2,Somewhat Agree,Agree,Strongly Agree,Disagree,Strongly Agree,3,5,2,4,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Strongly disagree,Strongly disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat agree,Agree,2,4,1,3,5,8,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,1,2,4,5,3,8,Somewhat Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,2,3,5,8,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Strongly Agree,Somewhat disagree,Somewhat agree,Somewhat agree,5,2,1,4,3,8,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,3,4,1,5,2,8,Somewhat Agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,5,4,1,3,2,8,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,FALSE,63,FALSE,54,TRUE,89,TRUE,94,TRUE,61,TRUE,92,TRUE,92,TRUE,89,FALSE,62,FALSE,63,FALSE,64,FALSE,60,FALSE,58,TRUE,93,FALSE,57,TRUE,89,TRUE,94,TRUE,92,TRUE,89,TRUE,80,FALSE,60,TRUE,94,TRUE,63,TRUE,82,TRUE,84,FALSE,97,FALSE,70,FALSE,71,TRUE,73,FALSE,73,TRUE,85,17,1,3,-2,0,0,-2,-3,1,-3,0,1,2,3,-2,3,-1,-1,1,-3,-3,1,3,1,1,2,8,0,-3,1,-3,-3,8,-1,3,3,-3,3,8,0,-3,0,0,-3,8,1,3,-1,1,1,6,0,-3,2,-3,0,8,1,3,3,-3,3,8,1,0,1,1,0,8,TRUE,0,85,FALSE,0,73,TRUE,0,73,FALSE,1,71,FALSE,0,70,FALSE,1,97,TRUE,1,84,TRUE,1,82,TRUE,1,63,TRUE,1,94,FALSE,1,60,TRUE,0,80,TRUE,1,89,TRUE,0,92,TRUE,1,94,TRUE,1,89,FALSE,1,57,TRUE,0,93,FALSE,1,58,FALSE,1,60,FALSE,0,64,FALSE,0,63,FALSE,1,62,TRUE,1,89,TRUE,0,92,TRUE,1,92,TRUE,0,61,TRUE,0,94,TRUE,0,89,FALSE,0,54,FALSE,0,63,TRUE,1,91,0.0324,0.0064,0.0121,0.0256,0.0081,0.0009,0.0121,0.0036,0.16,0.3969,0.2916,0.0121,0.1369,0.16,0.49,0.5329,0.1444,0.0841,0.8836,0.8464,0.4096,0.0036,0.1764,0.8464,0.1849,0.3721,0.3969,0.7225,0.5329,0.8649,0.7921,0.64,0.360925,0.173828571,0.548021429,17,53.13,17,53.13,5,62.5,5,62.5,3,37.5,4,50,10,62.5,7,43.75,77.44,67.88,77.38,86.88,77.62,78.38,76.5,0,24.31,5.38,14.88,49.38,27.62,15.88,32.75,0,0,3,1,2,2,0,0,0,3,2,1,0,1,0,1,2,1,3,0,0,0,1,1,1,2,0,1,0,0,0,1,0,1,0,2,1,0,4,3,1.2,1,0.8,1.4,0.6,0.6,0.4,2,1.1,0.9,1,8,7.33,7.75,0.6,0.4,0.4,-0.6,0.466666667,2,0,0,0,0.67,0,1,0,-2,2,0,0,-1,1,-1,1,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),61,I enjoyed taking the survey it was fun and interested.,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,8,6,4,5,3,9,7,1,2,4,2,3,1 +347,R_6itlGcuLkBRlyOE,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Strongly disagree,Strongly agree,Neither agree nor disagree,2,4,3,1,5,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,5,2,3,4,1,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,4,2,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly Agree,4,2,1,5,3,Agree,Agree,Disagree,Agree,Neither agree nor disagree,3,5,4,1,2,5,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Disagree,1,2,4,5,3,2,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,3,5,5,Neither agree nor disagree,Disagree,Disagree,Agree,Agree,2,4,1,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,5,2,3,1,4,2,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,1,5,4,5,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,Agree,1,4,5,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,54,TRUE,75,TRUE,80,TRUE,60,FALSE,55,TRUE,69,FALSE,59,TRUE,100,FALSE,56,TRUE,100,TRUE,80,TRUE,70,TRUE,80,TRUE,90,FALSE,60,TRUE,80,FALSE,60,TRUE,80,TRUE,95,TRUE,70,FALSE,60,TRUE,70,FALSE,60,TRUE,100,TRUE,100,FALSE,70,FALSE,65,FALSE,60,TRUE,100,TRUE,80,FALSE,61,16,2,2,-3,3,0,2,0,0,3,0,0,3,3,0,0,2,0,0,2,3,2,2,-2,2,0,5,2,0,0,3,-2,2,0,2,2,0,0,5,0,-2,-2,2,2,5,2,2,-3,0,0,5,0,0,3,3,0,2,0,2,2,0,0,5,0,2,0,2,2,7,FALSE,1,61,TRUE,1,80,TRUE,0,100,FALSE,1,60,FALSE,0,65,FALSE,1,70,TRUE,1,100,TRUE,1,100,FALSE,0,60,TRUE,1,70,FALSE,1,60,TRUE,0,70,TRUE,1,95,TRUE,0,80,FALSE,0,60,TRUE,1,80,FALSE,1,60,TRUE,0,90,TRUE,0,80,TRUE,0,70,TRUE,1,80,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,59,TRUE,1,69,FALSE,1,55,TRUE,0,60,TRUE,0,80,TRUE,1,75,FALSE,0,54,TRUE,1,100,0,0.0961,0.04,0,0,0.09,0,0.09,0.49,0,0.0625,0.0025,0.36,0.16,0.4225,0.04,0.1936,0.16,0.36,0.1681,0.04,0.36,0.64,0.64,0.16,0.2025,0.2916,0.1521,1,0.81,0.64,0.49,0.286621429,0.147935714,0.425307143,16,50,20,62.5,4,50,6,75,6,75,4,50,12,75,8,50,74.97,63.62,75.75,78.62,81.88,80.5,69.44,-12.5,12.47,13.62,0.75,3.62,31.88,5.5,19.44,0,0,1,1,0,0,0,0,0,2,0,1,1,0,0,2,2,2,0,1,0,0,0,3,0,2,0,3,0,0,0,1,1,0,0,2,2,0,0,1,0.4,0.4,0.4,1.4,0.6,1,0.4,1,0.65,0.75,0.7,4,4,4.5,-0.2,-0.6,0,0.4,-0.266666667,0,0,0,-2,0,1,0,0,0,0,2,-2,0,0,1,-1,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,53,Thank you for allowing me to demonstrate my knowledge of probability and statistics during the course of this survey invitation.,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,3,7,8,2,5,6,4,1,9,4,3,2,1 +348,R_5DB7iEbTk4da9Pc,60 - 66,,Canadian,Canadian,Female,Agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,3,1,2,4,5,Disagree,Somewhat disagree,Agree,Agree,Neither agree nor disagree,5,2,3,4,1,Strongly Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,2,1,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,4,5,1,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Agree,1,3,4,5,2,1,Disagree,Somewhat disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,4,2,1,5,3,0,Strongly Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,1,4,2,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,5,2,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Agree,Somewhat agree,5,1,4,3,2,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,5,1,2,1,Strongly Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,2,4,1,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,3,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,96,FALSE,85,FALSE,55,TRUE,76,FALSE,80,TRUE,91,TRUE,100,TRUE,95,TRUE,55,FALSE,54,FALSE,100,FALSE,55,TRUE,100,TRUE,58,TRUE,100,TRUE,54,TRUE,100,FALSE,57,FALSE,68,FALSE,57,TRUE,58,FALSE,100,TRUE,84,FALSE,99,TRUE,94,TRUE,65,FALSE,55,TRUE,76,FALSE,55,FALSE,58,TRUE,95,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,3,1,3,-2,-1,2,2,0,3,1,1,0,2,1,1,1,1,1,1,2,3,1,2,1,-2,-1,1,3,0,0,3,1,1,0,2,1,1,1,1,1,1,1,2,2,3,2,1,2,-1,0,1,1,-1,1,3,1,1,0,2,2,1,1,1,1,1,1,TRUE,0,100,TRUE,1,96,FALSE,1,85,FALSE,1,55,TRUE,1,76,FALSE,1,80,TRUE,1,91,TRUE,1,100,TRUE,1,95,TRUE,1,55,FALSE,1,54,FALSE,1,100,FALSE,0,55,TRUE,0,100,TRUE,1,58,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,57,FALSE,1,68,FALSE,0,57,TRUE,1,58,FALSE,1,100,TRUE,1,84,FALSE,1,99,TRUE,1,94,TRUE,0,65,FALSE,1,55,TRUE,0,76,FALSE,0,55,FALSE,0,58,TRUE,1,95,0,0.0036,0,0.0081,0.0025,0.04,0.0256,0.2025,0.1024,0.1764,0.3025,0.3025,0.0025,0.2116,0.0576,0.0016,0,0.2025,0.2025,0.0001,0.3249,0.1764,0.1849,1,0.2916,0.4225,0.3364,1,0.0225,1,0.5776,0,0.256057143,0.116442857,0.395671429,21,65.63,22,68.75,6,75,4,50,5,62.5,7,87.5,12,75,10,62.5,77.34,67.25,74.12,87.12,80.88,76.69,78,-3.12,8.59,-7.75,24.12,24.62,-6.62,1.69,15.5,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0.6,0.4,0,0,0.8,1,0,0,0.25,0.45,0.35,0.67,1.67,1.125,-0.2,-0.6,0,0,-0.266666667,-1,-1,-1,0,-1,1,2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,62,,1.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,6,7,3,2,8,4,9,1,5,2,3,4,1 +349,R_3HnBfY0lIp3qaUp,46 - 52,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,5,2,4,1,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,Strongly Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,1,4,3,2,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,5,4,1,3,5,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,5,4,1,2,3,4,Agree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,1,4,3,2,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,5,2,4,3,1,4,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,2,5,3,1,4,5,Agree,Disagree,Strongly agree,Somewhat Disagree,Strongly agree,4,5,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,2,3,TRUE,97,TRUE,53,FALSE,69,FALSE,50,TRUE,85,FALSE,94,TRUE,90,TRUE,90,FALSE,50,TRUE,92,FALSE,50,TRUE,88,TRUE,66,FALSE,50,FALSE,50,TRUE,95,FALSE,50,TRUE,92,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,76,FALSE,50,TRUE,67,TRUE,71,FALSE,50,FALSE,55,TRUE,50,FALSE,50,FALSE,50,TRUE,61,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,2,3,-1,-1,2,0,0,3,-1,2,0,2,-1,0,0,-1,-1,2,3,3,2,3,5,1,-2,2,-2,1,5,2,-3,2,0,3,4,0,1,1,0,0,7,2,3,3,3,2,8,-1,0,2,1,0,4,2,-2,3,-1,3,5,0,0,0,0,0,5,TRUE,0,97,TRUE,1,53,FALSE,1,69,FALSE,1,50,TRUE,1,85,FALSE,1,94,TRUE,1,90,TRUE,1,90,FALSE,0,50,TRUE,1,92,FALSE,1,50,TRUE,0,88,TRUE,1,66,FALSE,1,50,FALSE,0,50,TRUE,1,95,FALSE,1,50,TRUE,0,92,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,76,FALSE,0,50,TRUE,0,67,TRUE,1,71,FALSE,1,50,FALSE,1,55,TRUE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,61,0.01,0.0841,0.0025,0.01,0.1521,0.0036,0.25,0.0064,0.25,0.25,0.25,0.1156,0.25,0.25,0.0225,0.2209,0.5776,0.25,0.2025,0.4489,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9409,0.0961,0.8464,0.25,0.7744,0.291353571,0.203478571,0.379228571,14,43.75,20,62.5,5,62.5,6,75,4,50,5,62.5,10,62.5,10,62.5,65.34,50.38,66.5,76.12,68.38,65.81,64.88,-18.75,2.84,-12.12,-8.5,26.12,5.88,3.31,2.38,1,0,0,0,0,2,1,0,2,1,1,2,0,0,1,1,1,1,1,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,0,0,1,1,0.2,1.2,0.8,1,0.6,0.4,1,0.6,0.8,0.65,0.725,4.67,5.67,5.375,-0.4,0.8,-0.2,0.4,0.066666667,-3,1,-1,2,-1,1,1,1,-1,1,0,0,-1,1,0,0,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,n/a,0.75,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,7,2,9,8,3,4,6,1,5,4,3,2,1 +350,R_7mLb9cbulVDWv7c,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,5,2,4,1,3,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,Neither Agree nor Disagree,Somewhat Disagree,Agree,Disagree,Somewhat Disagree,2,3,4,5,1,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat disagree,4,1,2,5,3,Agree,Somewhat agree,Agree,Disagree,Agree,5,2,1,3,4,7,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,1,4,3,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Disagree,2,3,5,1,4,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,1,3,5,2,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Somewhat agree,Disagree,1,5,4,3,2,7,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,5,3,1,4,2,6,Somewhat Disagree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,4,1,2,5,3,7,Agree,Somewhat agree,Agree,Agree,Disagree,2,5,1,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,75,FALSE,100,TRUE,75,TRUE,90,TRUE,100,TRUE,90,TRUE,65,FALSE,100,FALSE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,60,TRUE,100,FALSE,75,FALSE,100,TRUE,100,TRUE,80,TRUE,70,TRUE,100,FALSE,85,TRUE,100,TRUE,90,FALSE,100,TRUE,85,FALSE,81,TRUE,50,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,-1,2,-1,0,2,0,0,0,-1,2,-2,-1,1,1,2,2,-1,2,1,2,-2,2,7,-1,1,2,0,0,3,-1,-1,2,1,-1,5,-1,-1,0,-1,-2,7,2,1,2,1,-2,7,-2,0,2,-1,1,6,-1,0,2,-2,1,7,2,1,2,2,-2,6,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,TRUE,1,90,TRUE,1,100,TRUE,1,90,TRUE,0,65,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,60,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,80,TRUE,0,70,TRUE,1,100,FALSE,1,85,TRUE,1,100,TRUE,0,90,FALSE,1,100,TRUE,0,85,FALSE,0,81,TRUE,1,50,TRUE,1,100,0.01,0,0,0.0625,0,0,0,0.01,0,0.04,0.6561,1,0,0.4225,0.0625,0,0.49,0.25,0,0.0225,0,0.25,0.0625,0,0.36,0.81,0.25,0,0,1,0.7225,0,0.228878571,0.209364286,0.248392857,28,87.5,24,75,6,75,4,50,7,87.5,7,87.5,14,87.5,10,62.5,86.59,72.5,86.25,91.25,96.38,86.94,86.25,12.5,11.59,-2.5,36.25,3.75,8.88,-0.56,23.75,1,0,1,1,0,0,1,0,0,0,1,0,0,3,0,2,2,2,3,1,1,0,1,2,4,1,0,0,1,1,1,1,0,0,2,1,0,0,0,1,0.6,0.2,0.8,2,1.6,0.6,0.8,0.4,0.9,0.85,0.875,5,6.67,6,-1,-0.4,0,1.6,-0.466666667,0,-3,-2,1,-1.67,2,2,2,-1,1,1,-1,-2,2,-2,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,62,I thought tidal wave was the formal term for tidal wave. But at least my 100 machines didn't take 100 minutes this time.,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,6,3,8,2,7,9,4,1,5,2,3,4,1 +351,R_6MIObewhpcim2EF,53 - 59,American,,American,Male,Strongly agree,Agree,Somewhat agree,Agree,Somewhat agree,5,4,1,2,3,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,3,1,Neither Agree nor Disagree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,5,2,4,1,3,Disagree,Somewhat disagree,Disagree,Disagree,Disagree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Agree,2,3,1,4,5,8,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,3,1,6,Somewhat Disagree,Disagree,Agree,Disagree,Strongly Agree,4,5,1,3,2,8,Strongly disagree,Disagree,Disagree,Disagree,Strongly disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Agree,2,4,1,5,3,5,Somewhat disagree,Disagree,Agree,Somewhat agree,Somewhat disagree,3,5,2,1,4,4,Somewhat Disagree,Disagree,Agree,Strongly Disagree,Strongly agree,5,4,2,1,3,9,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,5,3,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,97,TRUE,99,TRUE,100,FALSE,77,TRUE,77,TRUE,100,TRUE,98,TRUE,100,TRUE,100,FALSE,96,TRUE,97,FALSE,100,FALSE,59,TRUE,94,TRUE,96,TRUE,99,TRUE,97,FALSE,100,TRUE,94,TRUE,100,TRUE,98,FALSE,94,TRUE,98,TRUE,86,TRUE,95,FALSE,100,TRUE,98,FALSE,58,TRUE,100,TRUE,100,FALSE,100,28,3,2,1,2,1,-2,-1,1,1,1,0,-3,2,-3,3,-2,-1,-2,-2,-2,2,2,2,2,2,3,-1,-2,1,1,1,8,-1,-2,2,-2,3,6,-3,-2,-2,-2,-3,8,2,2,2,2,2,5,-1,-2,2,1,-1,5,-1,-2,2,-3,3,4,0,0,1,0,-1,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,58,TRUE,1,98,FALSE,1,100,TRUE,1,95,TRUE,1,86,TRUE,1,98,FALSE,0,94,TRUE,0,98,TRUE,0,100,TRUE,1,94,FALSE,1,100,TRUE,1,97,TRUE,1,99,TRUE,0,96,TRUE,0,94,FALSE,1,59,FALSE,1,100,TRUE,1,97,FALSE,0,96,TRUE,0,100,TRUE,1,100,TRUE,0,98,TRUE,1,100,TRUE,0,77,FALSE,1,77,TRUE,0,100,TRUE,1,99,TRUE,1,97,TRUE,1,100,0.0196,0,0.0001,0.0025,0,0,0,0.8836,0,0.9216,0.0001,0.0036,0.0004,0.9604,0.0004,0,1,0.1764,0.0529,0.9604,0.0009,0.0009,0.1681,0,0.9216,0.5929,0.0009,0,1,0.8836,1,1,0.376025,0.281892857,0.470157143,28,87.5,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,93.97,85.5,98.12,97.12,95.12,96.88,91.06,21.87,28.34,10.5,35.62,47.12,20.12,9.38,47.31,1,0,1,0,1,1,1,0,0,0,1,1,0,1,0,1,1,0,0,1,1,0,1,0,1,1,1,1,0,2,1,1,0,0,0,2,1,3,2,1,0.6,0.4,0.6,0.6,0.6,1,0.4,1.8,0.55,0.95,0.75,5.67,4.67,6,0,-0.6,0.2,-1.2,-0.133333333,-2,3,2,-1,1,-1,1,1,-1,1,0,0,-1,1,-1,1,1,15 cents,25 minutes,24 days,Male,College Diploma/Certificate,54,,0.625,0,0,0,0,0,1,0,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,5,8,2,3,6,7,4,1,9,4,3,2,1 +352,R_1BWY1jkuOwgS7iB,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,Strongly agree,3,4,5,2,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly agree,3,2,4,1,5,Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,1,2,3,5,4,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Somewhat agree,Strongly disagree,Disagree,Strongly Agree,2,3,4,1,5,7,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,5,4,3,2,1,1,Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,3,4,2,1,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Somewhat agree,Strongly disagree,Somewhat agree,Strongly Agree,1,5,3,2,4,2,Strongly disagree,Agree,Somewhat agree,Agree,Strongly agree,3,2,4,5,1,2,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,4,3,1,2,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,2,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,60,FALSE,100,FALSE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,90,TRUE,100,FALSE,50,TRUE,90,TRUE,100,FALSE,50,TRUE,100,TRUE,60,FALSE,100,TRUE,90,FALSE,90,FALSE,100,FALSE,90,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,75,TRUE,75,TRUE,100,20,1,1,-2,1,3,-3,1,0,1,3,2,-3,3,1,3,-3,-3,-1,-3,-3,0,1,-3,-2,3,8,-3,1,1,1,3,7,2,-3,3,1,3,1,-3,-3,-3,-3,-3,6,0,1,-3,1,3,2,-3,2,1,2,3,2,2,-3,3,-3,3,2,-3,-3,-3,-3,-3,8,TRUE,0,100,TRUE,1,75,FALSE,1,75,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,90,FALSE,1,100,FALSE,1,90,TRUE,1,90,FALSE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,60,TRUE,1,90,0,0,0,0,0.01,0.25,0,0.81,0.25,0.01,1,0.01,0,0,0,0.0625,0,0.25,0,0,0,0.16,0.81,0,0.25,0.25,0.16,1,0.0625,1,0,0.01,0.226964286,0.189464286,0.264464286,20,62.5,26,81.25,6,75,8,100,5,62.5,7,87.5,14,87.5,12,75,86.25,73.12,85,97.5,89.38,90.94,81.56,-18.75,5,-1.88,-15,35,1.88,3.44,6.56,1,0,1,3,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0,4,0,0,0,2,0,0,1,0.2,0,0.4,0.4,0.6,0.8,0.4,0.4,0.55,0.475,5.33,2,4.5,0.6,-0.4,-0.8,0,-0.2,6,5,-1,-2,3.33,1,2,2,-2,2,0,0,-2,2,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,No additional feedback.,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,5,9,2,8,3,6,7,1,4,4,2,3,1 +353,R_3Sfsbnd8gP6qoou,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Strongly agree,3,1,4,2,5,Agree,Neither agree nor disagree,Strongly agree,Disagree,Strongly agree,1,4,3,2,5,Neither Agree nor Disagree,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,4,5,3,1,2,Somewhat agree,Agree,Agree,Agree,Somewhat agree,3,5,1,4,2,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,3,4,5,7,Agree,Agree,Agree,Disagree,Agree,1,3,4,5,2,8,Neither Agree nor Disagree,Agree,Agree,Agree,Agree,5,3,1,2,4,6,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,3,2,4,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,3,5,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,3,5,1,8,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,2,3,1,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,87,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,60,TRUE,100,FALSE,100,FALSE,63,FALSE,57,TRUE,100,TRUE,100,FALSE,100,FALSE,91,TRUE,100,FALSE,80,TRUE,100,TRUE,88,TRUE,50,TRUE,100,FALSE,89,FALSE,73,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,71,TRUE,77,TRUE,87,FALSE,69,TRUE,60,FALSE,100,27,1,0,1,2,3,2,0,3,-2,3,0,2,3,3,1,1,2,2,2,1,0,3,3,2,3,7,2,2,2,-2,2,8,0,2,2,2,2,6,3,2,3,3,2,5,0,0,0,0,0,6,3,3,3,3,3,8,-1,0,2,0,2,5,3,3,3,3,3,10,FALSE,1,100,TRUE,1,60,FALSE,1,69,TRUE,0,87,TRUE,1,77,FALSE,1,71,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,73,FALSE,1,89,TRUE,1,100,TRUE,0,50,TRUE,1,88,TRUE,1,100,FALSE,1,80,TRUE,0,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,57,FALSE,0,63,FALSE,1,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,FALSE,0,87,0,0,0,0,0.7569,0.0841,0.3969,0,0,0,0,0,0,0.0729,0.0529,0.16,0.1849,0.7569,0,0,0,0.0144,0.0081,0.25,0.04,0.36,1,0,0.0961,1,1,0.0121,0.223078571,0.176107143,0.27005,27,84.38,24,75,5,62.5,6,75,6,75,7,87.5,13,81.25,11,68.75,87.56,82.38,84,93.75,90.12,92.19,82.94,9.38,12.56,19.88,9,18.75,2.62,10.94,14.19,1,3,2,0,0,0,2,1,0,1,0,0,1,1,1,2,0,1,1,1,1,0,1,2,3,1,3,0,5,0,1,2,1,3,1,2,1,1,1,2,1.2,0.8,0.6,1,1.4,1.8,1.6,1.4,0.9,1.55,1.225,7,6.33,6.875,-0.2,-1,-1,-0.4,-0.733333333,1,0,1,-5,0.67,0,2,-2,0,0,0,0,2,-2,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,,-0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,7,8,9,3,6,2,4,1,5,3,4,2,1 +354,R_7qEzOyCILFOJjxu,53 - 59,,Canadian,Canadian,Female,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,3,2,1,4,5,Somewhat agree,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat disagree,1,4,5,3,2,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Strongly Agree,4,3,2,5,1,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,2,1,3,5,4,1,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,3,1,2,4,1,Agree,Somewhat Agree,Strongly Agree,Disagree,Agree,1,3,5,4,2,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,5,4,1,3,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly disagree,3,2,4,1,5,1,Agree,Strongly agree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,1,4,2,3,5,5,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,3,1,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,73,FALSE,53,TRUE,52,FALSE,52,FALSE,58,FALSE,51,FALSE,51,FALSE,51,FALSE,51,FALSE,51,FALSE,51,TRUE,53,FALSE,75,FALSE,53,TRUE,80,FALSE,55,FALSE,50,TRUE,54,FALSE,54,TRUE,90,TRUE,85,FALSE,60,TRUE,53,FALSE,58,FALSE,52,FALSE,51,FALSE,53,FALSE,54,FALSE,54,TRUE,66,FALSE,54,FALSE,55,17,0,1,3,2,0,1,-2,0,-3,-1,3,0,1,-2,3,2,0,1,0,-3,3,3,2,0,1,1,0,-3,0,-1,0,1,2,1,3,-2,2,1,-1,0,1,0,1,1,3,2,1,1,-1,1,0,-1,1,-1,-3,1,2,3,0,-3,3,1,0,-3,0,0,-2,5,FALSE,1,55,FALSE,0,54,TRUE,0,66,FALSE,1,54,FALSE,0,54,FALSE,1,53,FALSE,0,51,FALSE,0,52,FALSE,0,58,TRUE,1,53,FALSE,1,60,TRUE,0,85,TRUE,1,90,FALSE,1,54,TRUE,1,54,FALSE,0,50,FALSE,1,55,TRUE,0,80,FALSE,1,53,FALSE,1,75,TRUE,1,53,FALSE,0,51,FALSE,1,51,FALSE,0,51,FALSE,1,51,FALSE,0,51,FALSE,1,51,FALSE,1,58,FALSE,1,52,TRUE,1,52,FALSE,0,53,TRUE,1,73,0.2704,0.2601,0.25,0.2601,0.0729,0.2209,0.2601,0.2209,0.0625,0.2601,0.2304,0.01,0.3364,0.16,0.2916,0.2916,0.2401,0.2116,0.1764,0.2401,0.2209,0.2116,0.2209,0.2116,0.2025,0.2401,0.2809,0.2025,0.4356,0.64,0.2304,0.7225,0.253753571,0.204935714,0.302571429,17,53.13,19,59.38,5,62.5,7,87.5,4,50,3,37.5,6,37.5,13,81.25,57.91,54.62,60.12,55.75,61.12,56.25,59.56,-6.25,-1.47,-7.88,-27.38,5.75,23.62,18.75,-21.69,3,2,1,2,1,1,1,0,2,1,1,1,2,0,1,3,0,0,0,4,3,1,2,1,1,1,1,1,2,2,1,3,1,1,0,2,3,1,0,1,1.8,1,1,1.4,1.6,1.4,1.2,1.4,1.3,1.4,1.35,1,1,1.5,0.2,-0.4,-0.2,0,-0.133333333,0,0,0,-4,0,0,-2,-1,-2,2,1,-1,1,-1,-1,1,1,10 cents,100 minutes,15 days,Female,College Diploma/Certificate,53,great experience,-0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,3,8,5,4,9,6,7,1,2,2,4,3,1 +355,R_67NA8zgS1bPutTI,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat disagree,5,2,1,3,4,Somewhat disagree,Strongly disagree,Strongly agree,Somewhat agree,Disagree,3,1,5,2,4,Strongly Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,3,2,1,5,4,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Somewhat agree,Strongly Agree,Disagree,Somewhat agree,1,4,2,3,5,7,Somewhat agree,Agree,Somewhat agree,Strongly agree,Disagree,1,5,4,2,3,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,3,4,5,2,1,6,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,3,1,2,4,5,3,Disagree,Disagree,Strongly agree,Somewhat disagree,Strongly disagree,3,4,1,2,5,2,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,5,3,4,1,2,4,Somewhat disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,5,2,3,4,FALSE,100,TRUE,90,FALSE,100,FALSE,50,TRUE,75,FALSE,100,TRUE,90,TRUE,100,TRUE,85,TRUE,85,TRUE,80,FALSE,100,FALSE,50,FALSE,60,FALSE,50,TRUE,100,FALSE,50,TRUE,90,TRUE,60,FALSE,100,TRUE,65,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,70,TRUE,80,FALSE,55,TRUE,75,FALSE,70,FALSE,50,TRUE,100,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,-1,-1,-3,3,1,-2,3,1,2,-3,3,-3,-2,1,1,-1,3,1,3,-2,1,4,1,2,1,3,-2,7,3,1,2,-1,3,5,-3,-3,-3,-2,-3,6,3,3,3,3,-2,0,-2,-2,3,-1,-3,3,3,1,2,-3,3,2,-1,-3,1,0,-1,4,FALSE,1,100,TRUE,1,90,FALSE,1,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,85,TRUE,1,85,TRUE,0,80,FALSE,1,100,FALSE,0,50,FALSE,1,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,90,TRUE,0,60,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,80,FALSE,1,55,TRUE,0,75,FALSE,0,70,FALSE,0,50,TRUE,1,100,0,0.09,0,0.01,0,0,0,0.0225,0,0,0.49,0.25,0.0225,0.64,0.0625,0.01,0,0.25,0.2025,0,0.1225,0.25,0.36,0.16,0.25,0.64,0.25,0,0,0.81,0.5625,0,0.19125,0.124821429,0.257678571,21,65.63,23,71.88,3,37.5,6,75,7,87.5,7,87.5,12,75,11,68.75,80.62,68.12,76.88,86.88,90.62,80,81.25,-6.25,8.74,30.62,1.88,-0.62,3.12,5,12.5,0,2,0,4,2,2,5,2,2,0,0,0,0,2,0,0,1,4,3,2,0,0,0,1,1,1,1,0,2,1,0,0,0,0,0,2,1,0,1,0,1.6,2.2,0.4,2,0.4,1,0,0.8,1.55,0.55,1.05,5.33,1.67,3.875,1.2,1.2,0.4,1.2,0.933333333,4,4,3,2,3.66,2,1,1,-2,2,2,-2,1,-1,-1,1,-1,10 cents,100 minutes,15 days,Female,High School (or equivalent),55,"I found it really interesting, but I wish it would have told me how many multiple choice questions I actually got right.",0.375,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,02FUT,02DGEN,01DIR,8,4,9,3,5,6,7,1,2,4,2,3,1 +356,R_3wSrJ7Gl3snoC2d,60 - 66,,Canadian,Canadian,Female,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,1,4,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,1,4,3,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,4,1,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,3,1,5,2,Agree,Agree,Agree,Disagree,Strongly Agree,3,4,2,1,5,5,Neither agree nor disagree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,5,2,3,1,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,3,4,2,5,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,1,3,5,Agree,Neither Agree nor Disagree,Disagree,Somewhat Disagree,Neither Agree nor Disagree,1,4,3,2,5,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,5,4,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,82,TRUE,66,TRUE,98,FALSE,55,FALSE,55,TRUE,83,TRUE,86,TRUE,94,FALSE,68,TRUE,100,TRUE,71,TRUE,96,TRUE,60,FALSE,100,FALSE,67,TRUE,100,TRUE,90,TRUE,98,FALSE,57,TRUE,100,TRUE,91,FALSE,53,FALSE,79,TRUE,89,FALSE,100,TRUE,97,FALSE,57,TRUE,85,TRUE,86,TRUE,100,FALSE,59,TRUE,100,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,0,3,0,0,2,-2,1,3,3,3,0,3,0,0,1,0,1,2,2,2,-2,3,5,0,-1,2,-2,0,5,3,3,3,0,3,5,0,-1,1,0,0,7,2,2,2,2,2,7,0,0,1,0,0,5,2,0,-2,-1,0,4,0,0,1,1,1,6,TRUE,0,82,TRUE,1,66,TRUE,0,98,FALSE,1,55,FALSE,0,55,TRUE,0,83,TRUE,1,86,TRUE,1,94,FALSE,0,68,TRUE,1,100,TRUE,0,71,TRUE,0,96,TRUE,1,60,FALSE,1,100,FALSE,0,67,TRUE,1,100,TRUE,0,90,TRUE,0,98,FALSE,1,57,TRUE,0,100,TRUE,1,91,FALSE,0,53,FALSE,1,79,TRUE,1,89,FALSE,1,100,TRUE,1,97,FALSE,1,57,TRUE,0,85,TRUE,0,86,TRUE,1,100,FALSE,0,59,TRUE,1,100,0.0036,0.0009,0,0.0196,0,0.6889,0.0121,0,1,0.2809,0,0.16,0.4624,0.5041,0.3025,0.1156,0.0441,0.2025,0.7225,0,0.0081,0.4489,0.1849,0,0.81,0.1849,0.3481,0.6724,0.9604,0.9604,0.7396,0.9216,0.383389286,0.269507143,0.497271429,19,59.38,17,53.13,4,50,4,50,5,62.5,4,50,11,68.75,6,37.5,81.94,62.5,80.5,89.5,95.25,80.31,83.56,6.25,28.81,12.5,30.5,27,45.25,11.56,46.06,0,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,1,2,1,1,3,5,1,3,0,0,0,1,0,0.4,0.4,0,0.4,0.6,0.8,2.6,0.2,0.3,1.05,0.675,5,5.33,5.5,-0.2,-0.4,-2.6,0.2,-1.066666667,-2,0,1,1,-0.33,1,0,1,-2,2,1,-1,0,0,-1,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),65,,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,2,3,4,5,6,7,9,1,8,4,3,2,1 +357,R_7HiTKDTQv39yl5k,67 - 73,American,,American,Male,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,5,2,3,4,1,Neither agree nor disagree,Somewhat disagree,Agree,Disagree,Disagree,2,1,5,4,3,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,5,2,4,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,1,3,5,2,4,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Agree,3,4,5,2,1,1,Neither agree nor disagree,Disagree,Agree,Disagree,Disagree,5,1,3,2,4,1,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,1,2,3,4,5,0,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,1,5,3,4,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,5,3,1,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,2,4,3,5,1,3,Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Neither Agree nor Disagree,5,3,4,2,1,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,5,1,2,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,75,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,54,FALSE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,54,FALSE,100,TRUE,80,TRUE,100,28,-2,-1,-1,-2,1,0,-1,2,-2,-2,2,1,3,1,0,1,1,1,1,-3,-2,-1,0,-2,2,1,0,-2,2,-2,-2,1,2,1,3,1,0,0,-1,1,1,1,-3,9,-1,0,1,0,-1,1,0,0,0,0,-2,3,2,1,3,-1,0,1,0,0,0,1,-3,6,TRUE,0,100,TRUE,1,80,FALSE,1,100,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0.0625,0,0.04,0,0.2116,0,0,0,0.25,0,0,0,1,0,1,0,1,1,0.2116,0.172792857,0.0269,0.318685714,28,87.5,28,87.5,7,87.5,7,87.5,6,75,8,100,16,100,12,75,93.38,82.38,100,100,91.12,94.06,92.69,0,5.88,-5.12,12.5,25,-8.88,-5.94,17.69,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,2,2,2,0,1,2,2,0,0,0,0,2,0,1,1,1,0,0,0.4,0.2,0,0.4,1.6,1,0.4,0.6,0.25,0.9,0.575,0.67,1.67,2.75,-1.2,-0.8,-0.4,-0.2,-0.8,0,-2,-1,3,-1,-1,0,0,1,-1,0,0,1,-1,0,0,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,69,"Nice survey, easy to answer questions",-0.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,5,9,8,2,7,3,1,4,3,2,4,1 +358,R_7I9Od9hmN304V0k,39 - 45,,Canadian,Canadian,Male,Somewhat agree,Agree,Somewhat agree,Disagree,Strongly disagree,1,4,5,3,2,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat disagree,5,3,2,1,4,Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Somewhat Disagree,2,1,3,4,5,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,1,5,Somewhat disagree,Strongly Agree,Strongly Agree,Agree,Strongly disagree,4,2,3,5,1,7,Somewhat disagree,Strongly disagree,Neither agree nor disagree,Disagree,Disagree,3,4,2,5,1,5,Somewhat Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Somewhat Disagree,2,1,5,3,4,5,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Strongly Agree,5,1,2,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Disagree,Disagree,Disagree,Strongly disagree,2,4,3,1,5,7,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Disagree,5,2,1,3,4,3,Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Somewhat Disagree,3,1,5,2,4,3,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,3,4,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,75,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,100,FALSE,80,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,85,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,-2,-3,-3,1,3,-3,-1,-2,3,3,-3,-1,3,0,3,3,3,-1,3,3,2,-3,7,-1,-3,0,-2,-2,5,-1,3,3,-3,-1,5,-1,-1,-2,1,3,5,1,-2,-2,-2,-3,7,-3,3,3,-3,-2,3,-2,3,3,-3,-1,3,3,-2,3,3,3,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,85,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0625,0,0.5625,1,0,1,0.64,0.04,0.7225,0,1,1,1,1,0,0.286696429,0.004464286,0.568928571,30,93.75,23,71.88,6,75,6,75,4,50,7,87.5,15,93.75,8,50,96.72,95,97.5,94.38,100,100,93.44,21.87,24.84,20,22.5,44.38,12.5,6.25,43.44,2,1,2,4,0,2,4,3,1,1,1,0,0,0,0,4,1,5,2,0,0,4,3,0,0,0,2,0,0,1,0,0,0,0,0,0,2,0,0,0,1.8,2.2,0.2,2.4,1.4,0.6,0,0.4,1.65,0.6,1.125,5.67,4.33,4.75,0.4,1.6,0.2,2,0.733333333,0,2,2,2,1.34,-1,-1,-1,-1,1,2,-2,-1,1,-1,1,-1,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,42,,-0.375,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,3,8,4,6,7,5,9,1,2,4,3,2,1 +359,R_74eXLz4khUCjBgq,39 - 45,,Canadian,Canadian,Female,Neither agree nor disagree,Strongly agree,Agree,Agree,Strongly agree,3,5,1,2,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,1,3,4,2,5,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,1,3,2,Neither agree nor disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,4,5,2,3,1,8,Strongly agree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,3,1,2,4,9,Somewhat Agree,Somewhat Disagree,Agree,Strongly Agree,Agree,1,5,2,3,4,10,Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,3,5,2,1,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,9,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,3,4,2,10,Agree,Agree,Agree,Agree,Agree,2,5,1,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,60,TRUE,90,TRUE,90,FALSE,50,TRUE,60,TRUE,80,FALSE,100,TRUE,100,FALSE,100,TRUE,60,FALSE,55,TRUE,100,TRUE,70,FALSE,65,TRUE,100,TRUE,80,TRUE,60,FALSE,100,TRUE,100,TRUE,100,FALSE,60,TRUE,100,FALSE,55,TRUE,100,TRUE,100,FALSE,70,TRUE,100,FALSE,55,TRUE,75,TRUE,100,TRUE,100,22,0,3,2,2,3,0,-1,1,1,2,1,1,2,0,1,0,-1,-2,0,-2,2,3,1,2,3,7,3,2,3,1,3,8,1,-1,2,3,2,9,2,1,3,3,3,10,2,3,2,2,3,7,0,0,0,0,0,10,-1,0,2,0,1,9,2,2,2,2,2,10,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,1,55,TRUE,1,100,FALSE,1,70,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,TRUE,1,80,TRUE,0,100,FALSE,1,65,TRUE,0,70,TRUE,0,100,FALSE,0,55,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,0,60,FALSE,1,50,TRUE,0,90,TRUE,1,90,FALSE,0,60,TRUE,1,100,0,0.04,0.04,0,0,0.09,0,0,1,0.16,0.01,0,0.3025,0.16,0,0,0,0.2025,0.25,0,0.3025,0.16,0.49,0,1,0.36,0.36,1,0.5625,0.1225,0.81,1,0.297946429,0.1375,0.458392857,22,68.75,21,65.63,4,50,5,62.5,7,87.5,5,62.5,13,81.25,8,50,82.34,65,89.38,88.12,86.88,83.75,80.94,3.12,16.71,15,26.88,0.62,24.38,2.5,30.94,2,0,1,0,0,3,3,2,0,1,0,2,0,3,1,2,2,5,3,5,2,0,0,0,0,0,1,1,1,2,2,1,0,0,0,2,3,4,2,4,0.6,1.8,1.2,3.4,0.4,1,0.6,3,1.75,1.25,1.5,8,8.67,8.75,0.2,0.8,0.6,0.4,0.533333333,0,-2,0,0,-0.67,1,1,1,-1,1,1,-1,1,-1,-1,1,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,45,I thought this survey was really fun and interesting.,0.375,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,6,4,3,9,2,5,7,1,8,2,4,3,1 +360,R_3e714bzOWPS2ZBT,39 - 45,,Canadian,Canadian,Female,Strongly disagree,Agree,Somewhat agree,Strongly agree,Disagree,1,2,5,3,4,Disagree,Agree,Somewhat agree,Strongly agree,Somewhat agree,2,1,3,4,5,Somewhat Disagree,Disagree,Disagree,Somewhat Disagree,Neither Agree nor Disagree,2,5,4,3,1,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,1,3,5,4,2,Strongly disagree,Agree,Strongly Agree,Agree,Disagree,5,1,2,3,4,6,Somewhat agree,Agree,Somewhat agree,Strongly agree,Agree,3,2,5,1,4,7,Somewhat Disagree,Disagree,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,2,5,1,3,4,6,Disagree,Somewhat disagree,Disagree,Disagree,Disagree,1,4,5,2,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Somewhat agree,Agree,Strongly Agree,Neither agree nor disagree,4,3,5,1,2,6,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,4,2,5,3,6,Somewhat Disagree,Disagree,Disagree,Strongly Disagree,Disagree,2,1,5,4,3,6,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,4,1,3,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,FALSE,54,FALSE,54,FALSE,50,FALSE,54,FALSE,50,TRUE,81,FALSE,50,TRUE,73,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,54,FALSE,50,TRUE,59,TRUE,50,TRUE,58,TRUE,59,TRUE,50,TRUE,80,FALSE,50,FALSE,50,FALSE,50,FALSE,50,8,-3,2,1,3,-2,-2,2,1,3,1,-1,-2,-2,-1,0,-2,-2,-1,-1,-2,-3,2,3,2,-2,6,1,2,1,3,2,7,-1,-2,-1,-1,0,6,-2,-1,-2,-2,-2,4,-3,1,2,3,0,6,-3,1,1,1,-2,6,-1,-2,-2,-3,-2,6,-1,-2,-1,-1,-2,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,80,TRUE,0,50,TRUE,1,59,TRUE,1,58,TRUE,1,50,TRUE,1,59,FALSE,1,50,TRUE,0,54,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,73,FALSE,1,50,TRUE,1,81,FALSE,1,50,FALSE,1,54,FALSE,1,50,FALSE,0,54,FALSE,0,54,TRUE,1,90,0.1764,0.0361,0.25,0.1681,0.01,0.25,0.0729,0.1681,0.25,0.25,0.2916,0.25,0.25,0.25,0.04,0.25,0.25,0.25,0.2116,0.25,0.25,0.25,0.25,0,0.25,0.25,0.2916,0.25,0.25,0.25,0.25,0.2916,0.218835714,0.202328571,0.235342857,8,25,22,68.75,5,62.5,4,50,7,87.5,6,75,9,56.25,13,81.25,56.75,50.5,58.75,62.38,55.38,59.88,53.62,-43.75,-12,-12,8.75,-25.12,-19.62,3.63,-27.63,0,0,2,1,0,3,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,2,1,1,0,2,3,0,0,0,2,2,1,0,0,0,0,0.6,0.8,0.2,0.6,0.8,1.4,0.8,0.2,0.55,0.8,0.675,6.33,6,5.875,-0.2,-0.6,-0.6,0.4,-0.466666667,0,1,0,-2,0.33,0,1,1,-2,2,1,-1,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,43,,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,7,9,8,3,4,6,5,1,2,3,4,2,1 +361,R_5EtClCm5PQEaGv1,53 - 59,American,,American,Male,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,3,2,1,4,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,4,1,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,2,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,2,1,Strongly disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,2,3,4,1,5,0,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,3,5,4,2,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,5,4,1,0,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,1,5,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,2,1,4,5,3,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,4,2,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,4,2,5,0,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,75,TRUE,54,FALSE,100,TRUE,50,TRUE,100,TRUE,75,FALSE,52,FALSE,51,FALSE,78,TRUE,70,FALSE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,100,FALSE,61,TRUE,61,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,71,FALSE,100,TRUE,100,TRUE,100,TRUE,100,17,-3,3,3,-3,3,1,-3,3,-3,3,3,3,3,-1,3,3,3,3,3,3,-3,3,3,-3,3,0,-1,-3,3,-3,1,2,3,3,3,1,3,0,-1,-1,-1,-1,-1,10,-3,3,3,-3,3,0,1,-3,3,-3,3,0,3,3,3,1,3,0,3,0,3,3,3,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,61,FALSE,0,61,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,52,FALSE,1,100,TRUE,1,70,FALSE,0,78,FALSE,1,51,FALSE,0,52,TRUE,0,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,54,FALSE,0,75,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0.2704,0,0,0.6084,0.5625,1,0,0,0.0841,0,0.2401,0,0,0.5625,0.09,0.3721,0.2304,0.3721,0,0.25,0,1,1,1,0.2916,1,0.319078571,0.197535714,0.440621429,17,53.13,19,59.38,6,75,6,75,3,37.5,4,50,11,68.75,8,50,85.94,82.88,80.75,89.25,90.88,87.94,83.94,-6.25,26.56,7.88,5.75,51.75,40.88,19.19,33.94,0,0,0,0,0,2,0,0,0,2,0,0,0,2,0,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0.8,0.4,4,0,0,0.4,0.6,1.3,0.25,0.775,0.67,0,1.75,0,0.8,0,3.4,0.266666667,0,2,0,8,0.67,2,2,2,-2,2,1,-1,-2,2,-2,2,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),57,none,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,6,2,7,8,9,3,5,1,4,4,3,2,1 +362,R_5KThwaDWZxRmrux,32 - 38,American,,American,Female,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Agree,Strongly agree,2,3,1,5,4,Somewhat disagree,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,5,2,4,1,3,Strongly Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,5,4,2,1,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Somewhat disagree,Strongly Agree,Strongly Agree,Agree,1,2,5,4,3,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,7,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,4,5,3,1,2,4,Agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,5,3,2,1,7,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,8,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,5,2,3,1,4,7,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Strongly Agree,2,4,5,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,82,TRUE,86,TRUE,96,FALSE,50,FALSE,50,FALSE,99,TRUE,72,FALSE,100,TRUE,61,FALSE,74,FALSE,65,FALSE,64,TRUE,73,TRUE,86,TRUE,71,FALSE,50,TRUE,89,TRUE,91,TRUE,95,FALSE,59,FALSE,74,TRUE,90,TRUE,98,TRUE,98,TRUE,77,FALSE,53,FALSE,53,FALSE,54,TRUE,95,FALSE,85,12,0,-1,0,2,3,-1,-3,1,2,-1,3,1,-1,1,1,-1,0,0,1,-3,0,-1,3,3,2,6,-1,1,-1,0,1,6,1,1,-1,0,2,7,2,1,-1,-1,1,4,-3,0,1,-1,-1,6,0,-1,2,0,0,7,1,2,1,-1,2,8,2,0,-1,1,3,7,FALSE,1,85,TRUE,1,95,FALSE,1,54,FALSE,1,53,FALSE,0,53,TRUE,0,77,TRUE,1,98,TRUE,1,98,TRUE,1,90,FALSE,0,74,FALSE,1,59,TRUE,0,95,TRUE,1,91,TRUE,0,89,FALSE,0,50,TRUE,1,71,TRUE,0,86,TRUE,0,73,FALSE,1,64,FALSE,1,65,FALSE,0,74,TRUE,1,61,FALSE,1,100,TRUE,1,72,FALSE,1,99,FALSE,0,50,FALSE,1,50,TRUE,0,96,TRUE,0,86,TRUE,1,82,FALSE,0,50,TRUE,1,100,0.0004,0.25,0.0841,0.0004,0,0.5929,0.0784,0.5476,0.1225,0.1521,0.0324,0.0081,0.01,0.1681,0.2809,0.0025,0,0.2209,0.9216,0.0001,0.5476,0.25,0.1296,0.7921,0.7396,0.25,0.25,0.0225,0.2116,0.5329,0.7396,0.9025,0.303789286,0.158314286,0.449264286,12,37.5,19,59.38,6,75,3,37.5,4,50,6,75,10,62.5,9,56.25,76.25,63.88,83.38,78.62,79.12,75.56,76.94,-21.88,16.87,-11.12,45.88,28.62,4.12,13.06,20.69,0,0,3,1,1,0,4,2,2,2,2,0,0,1,1,3,1,1,2,4,3,1,1,3,4,1,2,1,2,1,2,1,2,2,1,3,0,1,0,6,1,2,0.8,2.2,2.4,1.4,1.6,2,1.5,1.85,1.675,6.33,7,6.375,-1.4,0.6,-0.8,0.2,-0.533333333,0,-1,-1,-3,-0.67,1,1,0,-1,1,-1,1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,4,9,5,7,3,2,8,1,6,3,4,2,1 +363,R_12sc5rnLHC24OZS,46 - 52,,Canadian,Canadian,Male,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,5,4,2,1,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Agree,3,4,5,1,2,Neither Agree nor Disagree,Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,3,4,2,5,1,Agree,Agree,Agree,Agree,Somewhat agree,2,3,4,1,5,Agree,Agree,Somewhat agree,Disagree,Agree,5,1,3,2,4,4,Agree,Somewhat agree,Agree,Agree,Agree,2,5,4,1,3,7,Somewhat Disagree,Disagree,Agree,Agree,Somewhat Agree,2,4,1,3,5,7,Agree,Agree,Agree,Agree,Somewhat agree,4,5,2,3,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly Agree,2,1,3,4,5,7,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,5,4,1,2,3,6,Neither Agree nor Disagree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,2,5,4,3,1,6,Agree,Agree,Agree,Strongly Agree,Somewhat agree,4,3,2,1,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,54,TRUE,58,TRUE,63,FALSE,52,TRUE,68,FALSE,55,TRUE,61,TRUE,75,TRUE,58,FALSE,53,TRUE,53,TRUE,71,TRUE,59,TRUE,59,TRUE,56,TRUE,100,TRUE,54,TRUE,53,TRUE,77,FALSE,53,FALSE,54,FALSE,53,FALSE,53,TRUE,54,FALSE,100,TRUE,100,FALSE,52,FALSE,100,FALSE,55,TRUE,55,FALSE,55,TRUE,61,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,2,0,2,-1,1,2,1,2,0,-2,2,1,0,2,2,2,2,1,2,2,1,-2,2,4,2,1,2,2,2,7,-1,-2,2,2,1,7,2,2,2,2,1,6,2,0,1,1,3,7,0,-1,2,-1,2,6,0,-2,2,-1,1,6,2,2,2,3,1,7,TRUE,0,54,TRUE,1,58,TRUE,0,63,FALSE,1,52,TRUE,1,68,FALSE,1,55,TRUE,1,61,TRUE,1,75,TRUE,1,58,FALSE,0,53,TRUE,0,53,TRUE,0,71,TRUE,1,59,TRUE,0,59,TRUE,1,56,TRUE,1,100,TRUE,0,54,TRUE,0,53,TRUE,0,77,FALSE,1,53,FALSE,0,54,FALSE,0,53,FALSE,1,53,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,52,FALSE,1,100,FALSE,1,55,TRUE,1,55,FALSE,0,55,TRUE,1,61,0.0625,0,0,0.1521,0.1521,0.2025,0.2116,0.2809,0.2209,0.2809,0.2025,0.1681,0.1764,0.2809,0.1024,0.1764,0.2209,0.2304,0,0,0.2916,0.1936,0.5929,0.3481,0.2916,0.2304,0.3025,0.2916,0.3969,0.2809,0.2025,0.5041,0.244057143,0.207635714,0.280478571,5,15.63,20,62.5,5,62.5,6,75,3,37.5,6,75,12,75,8,50,63.25,57.62,57.38,66.62,71.38,63.75,62.75,-46.87,0.75,-4.88,-17.62,29.12,-3.62,-11.25,12.75,0,2,1,2,0,3,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,2,0,2,0,0,0,0,2,1,0,0,0,1,0,1,0.8,0.6,0,0.6,1,0.6,0.2,0.6,0.6,0.6,6,6.33,6.25,0.4,-0.2,0,-0.2,0.066666667,-3,1,1,-1,-0.33,1,1,1,-2,2,0,0,-1,1,-2,2,1,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,51,,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,3,6,4,8,7,5,2,1,9,4,2,3,1 +364,R_57kAOyXKZLlEKxT,53 - 59,American,,American,Female,Strongly agree,Agree,Agree,Agree,Strongly agree,1,5,2,4,3,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,2,3,4,1,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,4,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,0,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Disagree,1,2,3,4,5,2,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,2,5,1,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,1,2,5,4,3,1,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,2,5,4,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,1,3,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,4,1,FALSE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,50,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,2,3,-3,-1,1,0,-1,2,1,2,-1,2,1,1,1,2,1,3,3,3,3,3,1,-3,-2,1,1,-2,0,1,1,-1,-1,1,2,1,1,1,1,1,2,2,2,2,2,2,2,-3,-1,1,1,-1,1,2,1,1,1,1,4,1,1,1,1,1,1,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,0,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.285714286,0.214285714,0.357142857,2,6.25,17,53.13,4,50,4,50,5,62.5,4,50,16,100,1,6.25,59.38,50,50,68.75,68.75,62.5,56.25,-46.88,6.25,0,0,6.25,18.75,-37.5,50,0,1,1,1,0,0,1,0,1,1,1,0,3,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,2,1,0,0,0,1,0,0.6,0.6,1,0.2,0.4,0.2,0.8,0.2,0.6,0.4,0.5,1,2.33,1.625,0.2,0.4,0.2,0,0.266666667,-1,-1,-2,1,-1.33,1,1,1,-2,2,1,-1,0,0,-1,1,0,5 cents,100 minutes,15 days,Female,College Diploma/Certificate,53,,0.625,1,0,0,0,1,0,0.33,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,4,7,8,3,6,5,9,1,2,3,4,2,1 +365,R_3PJEmvviwvNuAnL,32 - 38,,Canadian,Canadian,Female,Somewhat agree,Neither agree nor disagree,Disagree,Strongly disagree,Somewhat agree,1,5,3,2,4,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,4,2,1,5,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,3,5,4,1,2,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Strongly Agree,Agree,Strongly disagree,Neither agree nor disagree,2,3,1,5,4,10,Agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly agree,1,2,5,3,4,5,Disagree,Disagree,Strongly Agree,Strongly Agree,Somewhat Disagree,5,3,4,1,2,8,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Disagree,Strongly disagree,Strongly Agree,4,3,1,2,5,5,Somewhat agree,Strongly disagree,Agree,Disagree,Strongly agree,3,1,4,2,5,4,Somewhat Agree,Agree,Strongly agree,Disagree,Neither Agree nor Disagree,2,3,5,4,1,7,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,3,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,TRUE,59,FALSE,52,FALSE,51,FALSE,52,TRUE,55,TRUE,100,TRUE,60,TRUE,100,FALSE,59,FALSE,53,TRUE,61,FALSE,79,TRUE,62,TRUE,59,TRUE,65,FALSE,73,FALSE,58,TRUE,93,TRUE,100,TRUE,64,TRUE,91,FALSE,56,TRUE,100,TRUE,100,FALSE,94,TRUE,68,FALSE,69,FALSE,100,FALSE,54,FALSE,61,16,1,0,-2,-3,1,-2,-2,1,0,3,0,0,1,-1,0,-1,-2,0,0,-1,2,3,2,-3,0,6,2,0,0,-2,3,10,-2,-2,3,3,-1,5,2,1,2,1,1,8,3,2,-2,-3,3,3,1,-3,2,-2,3,5,1,2,3,-2,0,4,2,3,3,3,1,7,FALSE,1,61,FALSE,0,54,FALSE,1,100,FALSE,1,69,TRUE,1,68,FALSE,1,94,TRUE,1,100,TRUE,1,100,FALSE,0,56,TRUE,1,91,TRUE,0,64,TRUE,0,100,TRUE,1,93,FALSE,1,58,FALSE,0,73,TRUE,1,65,TRUE,0,59,TRUE,0,62,FALSE,1,79,TRUE,0,61,FALSE,0,53,FALSE,0,59,TRUE,0,100,TRUE,1,60,TRUE,0,100,TRUE,1,55,FALSE,1,52,FALSE,1,51,FALSE,1,52,TRUE,1,59,FALSE,0,51,TRUE,1,100,0,0.2025,0.1225,0,0,0.0036,0.16,0.0081,0.3721,0.3481,0.1681,0.0049,0.3136,0.4096,0.1024,0.2916,1,0.0961,0.2401,1,0.2809,0.5329,0.0441,0.1764,0.3481,0.2304,0.2601,0.1521,0,0.3844,0.2304,1,0.291360714,0.234157143,0.348564286,16,50,19,59.38,3,37.5,5,62.5,5,62.5,6,75,10,62.5,9,56.25,71.84,62.25,77.38,73.25,74.5,71.06,72.62,-9.38,12.46,24.75,14.88,10.75,-0.5,8.56,16.37,1,3,4,0,1,4,2,1,2,0,2,2,2,4,1,3,3,2,1,2,2,2,0,0,2,3,1,1,2,0,1,2,2,1,0,3,5,3,3,2,1.8,1.8,2.2,2.2,1.2,1.4,1.2,3.2,2,1.75,1.875,7,4,6,0.6,0.4,1,-1,0.666666667,3,5,1,1,3,0,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,37,,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,3,5,4,6,2,7,8,1,9,2,4,3,1 +366,R_5wvnZJXgfWFlJm5,39 - 45,American,,American,Male,Somewhat agree,Agree,Somewhat agree,Agree,Agree,3,2,1,5,4,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,3,4,2,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,2,4,3,1,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,5,2,3,4,1,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,2,1,5,4,3,8,Agree,Agree,Agree,Strongly agree,Somewhat agree,3,1,4,5,2,8,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,2,3,1,8,Somewhat agree,Somewhat agree,Agree,Agree,Agree,2,4,5,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat agree,Agree,Agree,1,2,3,5,4,8,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,2,1,4,3,8,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,4,2,3,5,1,8,Agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,5,4,3,2,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,88,TRUE,89,FALSE,76,FALSE,71,FALSE,76,FALSE,77,FALSE,82,FALSE,73,TRUE,84,FALSE,87,FALSE,98,TRUE,71,FALSE,75,TRUE,90,FALSE,72,TRUE,77,FALSE,75,TRUE,73,FALSE,75,FALSE,76,FALSE,88,FALSE,76,FALSE,85,FALSE,82,FALSE,87,FALSE,81,FALSE,85,FALSE,68,FALSE,80,TRUE,86,FALSE,80,FALSE,84,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,2,2,1,1,2,2,1,1,2,2,1,1,1,1,2,0,2,1,2,1,1,2,8,2,2,2,3,1,8,0,1,2,0,1,8,1,1,2,2,2,8,2,1,1,2,2,8,1,1,2,2,1,8,1,1,2,2,2,8,2,1,0,2,1,8,TRUE,0,88,TRUE,1,89,FALSE,1,76,FALSE,1,71,FALSE,0,76,FALSE,1,77,FALSE,0,82,FALSE,0,73,TRUE,1,84,FALSE,0,87,FALSE,1,98,TRUE,0,71,FALSE,0,75,TRUE,0,90,FALSE,0,72,TRUE,1,77,FALSE,1,75,TRUE,0,73,FALSE,1,75,FALSE,1,76,FALSE,0,88,FALSE,0,76,FALSE,1,85,FALSE,0,82,FALSE,1,87,FALSE,0,81,FALSE,1,85,FALSE,1,68,FALSE,1,80,TRUE,1,86,FALSE,0,80,FALSE,0,84,0.5329,0.6561,0.0529,0.6724,0.7056,0.0529,0.6724,0.7569,0.0576,0.5776,0.0196,0.5625,0.0256,0.0004,0.5776,0.0121,0.0225,0.0841,0.1024,0.0169,0.7744,0.5184,0.0625,0.81,0.0625,0.0225,0.64,0.7744,0.0576,0.5329,0.04,0.5041,0.323071429,0.294814286,0.351328571,18,56.25,16,50,6,75,4,50,1,12.5,5,62.5,4,25,12,75,80.22,81.75,80,83,76.12,80.75,79.69,6.25,30.22,6.75,30,70.5,13.62,55.75,4.69,0,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0,2,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,2,2,1,0.2,0.6,0.6,0.4,0.4,0,0.6,1.2,0.45,0.55,0.5,8,8,8,-0.2,0.6,0,-0.8,0.133333333,0,0,0,0,0,1,0,0,-1,1,0,0,0,0,0,0,-1,10 cents,5 minutes,36 days,Male,Trade School (non-military),41,It was fine.,0.125,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,5,2,9,8,6,4,3,1,7,3,4,2,1 +367,R_78UHVzrSM2g903q,67 - 73,,Canadian,Canadian,Male,Disagree,Somewhat agree,Agree,Disagree,Somewhat agree,3,4,2,1,5,Disagree,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Disagree,1,2,5,4,3,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,2,1,3,5,Disagree,Disagree,Disagree,Disagree,Disagree,2,5,3,4,1,Strongly disagree,Agree,Agree,Disagree,Agree,5,4,2,1,3,1,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat disagree,4,1,3,2,5,1,Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,4,3,5,2,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,4,2,3,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Agree,Agree,Disagree,Agree,5,4,2,1,3,1,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,4,5,1,2,2,Neither Agree nor Disagree,Agree,Agree,Disagree,Somewhat Agree,3,2,4,1,5,3,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,2,3,5,1,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,61,FALSE,96,FALSE,53,FALSE,53,FALSE,85,TRUE,91,TRUE,95,TRUE,54,TRUE,55,FALSE,56,FALSE,99,TRUE,96,TRUE,98,FALSE,60,FALSE,98,TRUE,54,TRUE,99,TRUE,80,TRUE,99,TRUE,100,FALSE,53,TRUE,53,TRUE,77,FALSE,55,TRUE,99,FALSE,53,FALSE,99,TRUE,52,TRUE,65,TRUE,68,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,1,2,-2,1,-2,-3,0,-1,-2,-1,1,1,0,2,-2,-2,-2,-2,-2,-3,2,2,-2,2,1,0,-2,0,-2,-1,1,-2,1,1,1,-1,2,-3,-3,-3,-2,-3,6,-2,2,2,-2,2,1,-1,-3,2,-3,1,2,0,2,2,-2,1,3,1,0,2,1,0,4,TRUE,0,96,TRUE,1,61,FALSE,1,96,FALSE,1,53,FALSE,0,53,FALSE,1,85,TRUE,1,91,TRUE,1,95,TRUE,1,54,TRUE,1,55,FALSE,1,56,FALSE,1,99,TRUE,1,96,TRUE,0,98,FALSE,0,60,FALSE,0,98,TRUE,0,54,TRUE,0,99,TRUE,0,80,TRUE,0,99,TRUE,1,100,FALSE,0,53,TRUE,0,53,TRUE,1,77,FALSE,1,55,TRUE,1,99,FALSE,1,53,FALSE,1,99,TRUE,0,52,TRUE,1,65,TRUE,1,68,TRUE,1,100,0.0025,0.0001,0.9604,0.0081,0,0.0225,0.0529,0.2025,0.9801,0.2809,0.1225,0.0016,0.2116,0.1936,0.2809,0.1521,0.2809,0.2209,0.0001,0.2025,0,0.36,0.64,0.9604,0.2916,0.2209,0.1024,0.9216,0.0016,0.9801,0.2704,0.0001,0.284096429,0.2145,0.353692857,28,87.5,20,62.5,6,75,4,50,4,50,6,75,12,75,8,50,76.62,60.62,74.12,80.75,91,76.56,76.69,25,14.12,-14.38,24.12,30.75,16,1.56,26.69,1,1,0,0,1,2,1,0,1,1,1,0,0,1,3,1,1,1,0,1,0,1,0,0,1,1,0,2,2,3,1,1,1,2,1,3,2,4,3,2,0.6,1,1,0.8,0.4,1.6,1.2,2.8,0.85,1.5,1.175,1.33,2,2.5,0.2,-0.6,-0.2,-2,-0.2,0,-1,-1,2,-0.67,0,1,1,-1,1,0,0,-1,1,-1,1,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),72,"not sure what this was about, but definitely different",0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,7,3,6,5,4,8,2,1,9,4,2,3,1 +368,R_7HOCctrM57A9aW5,46 - 52,American,,American,Female,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,2,1,5,3,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,2,4,5,1,Neither Agree nor Disagree,Somewhat Disagree,Agree,Agree,Agree,1,2,5,4,3,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat disagree,5,1,4,2,3,Somewhat agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,5,3,4,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,5,4,1,3,3,Somewhat Agree,Somewhat Disagree,Agree,Agree,Agree,3,2,5,4,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,3,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,2,4,3,1,5,2,Somewhat disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,4,1,5,2,3,2,Neither Agree nor Disagree,Somewhat Disagree,Agree,Agree,Agree,4,5,2,3,1,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,2,1,4,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,FALSE,91,TRUE,100,TRUE,92,FALSE,96,FALSE,64,TRUE,100,TRUE,99,TRUE,98,FALSE,96,TRUE,96,TRUE,96,FALSE,98,FALSE,65,TRUE,99,FALSE,91,TRUE,95,FALSE,64,TRUE,98,TRUE,98,TRUE,94,FALSE,93,FALSE,94,TRUE,97,TRUE,97,TRUE,97,FALSE,100,TRUE,99,FALSE,64,TRUE,98,FALSE,76,FALSE,100,27,1,2,2,0,1,-1,-1,2,-1,0,0,-1,2,2,2,1,2,1,2,-1,1,2,2,0,0,4,-1,-1,2,-1,1,3,1,-1,2,2,2,3,1,1,1,1,-1,3,1,2,2,1,1,2,-1,-1,2,1,-1,2,0,-1,2,2,2,2,0,1,1,0,-1,2,FALSE,1,100,FALSE,0,76,TRUE,0,98,FALSE,1,64,TRUE,1,99,FALSE,1,100,TRUE,1,97,TRUE,1,97,TRUE,1,97,FALSE,0,94,FALSE,1,93,TRUE,0,94,TRUE,1,98,TRUE,0,98,FALSE,0,64,TRUE,1,95,FALSE,1,91,TRUE,0,99,FALSE,1,65,FALSE,1,98,TRUE,1,96,TRUE,1,96,FALSE,1,96,TRUE,1,98,TRUE,0,99,TRUE,1,100,FALSE,1,64,FALSE,1,96,TRUE,0,92,TRUE,1,100,FALSE,0,91,TRUE,1,99,0.0009,0,0.0025,0.0009,0.0001,0,0.0004,0.8836,0.0004,0.0016,0,0.0004,0.0009,0.0049,0.0001,0.5776,0.0016,0.1296,0.0016,0.9801,0.0016,0.4096,0.1225,0.9604,0.0081,0.1296,0.8281,0,0.9604,0.9801,0.8464,0.8836,0.311189286,0.114371429,0.508007143,27,84.38,22,68.75,5,62.5,7,87.5,4,50,6,75,12,75,10,62.5,92,76.75,96.38,97.88,97,93.56,90.44,15.63,23.25,14.25,8.88,47.88,22,18.56,27.94,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,2,1,0,0,0,0,0,1,1,0,2,0,0.2,0.2,0.2,0.4,0.2,0.6,0,0.8,0.25,0.4,0.325,3.33,2,2.625,0,-0.4,0.2,-0.4,-0.066666667,2,1,1,1,1.33,2,2,2,-2,2,1,-1,0,0,-2,2,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,47,It was intriguing ,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,6,5,8,2,4,7,9,1,3,3,2,4,1 +369,R_3VJhpQnj11ZDfBI,67 - 73,American,,American,Female,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,Agree,2,4,3,5,1,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Strongly agree,4,5,3,2,1,Somewhat Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,1,4,5,3,2,Neither agree nor disagree,Somewhat agree,Agree,Agree,Disagree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Somewhat disagree,Somewhat agree,Agree,1,4,2,5,3,3,Neither agree nor disagree,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,5,2,3,1,4,6,Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly Agree,5,2,3,1,4,4,Strongly disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,2,5,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,2,4,1,3,5,1,Somewhat disagree,Disagree,Agree,Strongly disagree,Somewhat agree,5,4,2,1,3,1,Strongly Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,2,4,1,3,1,Disagree,Somewhat disagree,Agree,Agree,Strongly disagree,3,2,1,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,56,FALSE,65,TRUE,100,FALSE,100,TRUE,55,TRUE,78,FALSE,100,TRUE,86,FALSE,100,TRUE,81,FALSE,100,FALSE,63,TRUE,63,FALSE,100,FALSE,100,TRUE,75,FALSE,54,TRUE,100,TRUE,76,FALSE,81,FALSE,100,FALSE,100,TRUE,75,FALSE,100,TRUE,75,FALSE,100,TRUE,100,FALSE,60,FALSE,100,FALSE,76,FALSE,76,22,3,1,3,3,2,0,-2,2,-3,3,1,-2,3,-2,3,0,1,2,2,-2,3,2,-1,1,2,3,0,-2,-1,0,1,3,2,-1,2,-1,3,6,-3,-2,-3,-2,-3,4,3,2,3,3,2,2,-1,-2,2,-3,1,1,-3,-3,3,-3,3,1,-2,-1,2,2,-3,1,FALSE,1,76,FALSE,0,76,FALSE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,0,100,TRUE,1,75,FALSE,0,100,FALSE,1,100,FALSE,1,81,TRUE,1,76,TRUE,0,100,FALSE,0,54,TRUE,1,75,FALSE,1,100,FALSE,1,100,TRUE,0,63,FALSE,1,63,FALSE,0,100,TRUE,1,81,FALSE,1,100,TRUE,1,86,FALSE,1,100,TRUE,1,78,TRUE,0,55,FALSE,1,100,TRUE,0,100,FALSE,0,65,FALSE,0,56,FALSE,0,100,1,0.0484,0.0625,0.0625,1,0,0.0196,1,0.1369,0.0361,0.4225,0.0576,0.0625,0,0,0.5776,0,0.16,0,0,1,0.2916,0.3969,1,0,0.3025,0.3136,0.0576,0,0,1,0.0361,0.281110714,0.248057143,0.314164286,22,68.75,20,62.5,3,37.5,5,62.5,6,75,6,75,8,50,12,75,84.22,67.38,97,88.75,83.75,81.06,87.38,6.25,21.72,29.88,34.5,13.75,8.75,31.06,12.38,0,1,4,2,0,0,0,3,3,2,1,1,1,1,0,3,3,5,4,1,0,1,0,0,0,1,0,0,0,2,4,1,0,1,0,2,2,0,0,1,1.4,1.6,0.8,3.2,0.2,0.6,1.2,1,1.75,0.75,1.25,4,1.33,2.625,1.2,1,-0.4,2.2,0.6,1,2,5,3,2.67,0,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,71,It was interesting. I think it needed to add some questions about adverse events in your life and how that altered the person rather than just a change in years.,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,02REV,7,4,9,3,8,2,6,1,5,2,3,4,1 +370,R_3fQMosAnclVpbrP,25 - 31,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Somewhat disagree,Strongly agree,3,4,5,2,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,5,2,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,4,5,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,4,3,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,4,1,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,1,5,3,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,5,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,4,1,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,3,1,2,4,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,3,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,64,TRUE,65,TRUE,88,TRUE,68,TRUE,70,TRUE,70,TRUE,76,TRUE,74,FALSE,77,TRUE,74,FALSE,92,TRUE,95,FALSE,58,FALSE,61,FALSE,70,TRUE,87,FALSE,62,TRUE,84,TRUE,54,TRUE,63,TRUE,77,FALSE,58,TRUE,85,TRUE,69,FALSE,79,TRUE,62,FALSE,78,TRUE,66,TRUE,69,TRUE,76,FALSE,73,TRUE,69,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-1,3,-1,-1,1,-1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,6,1,1,1,1,1,6,1,1,1,1,1,6,0,0,1,-1,0,6,0,0,0,0,0,6,0,0,0,0,0,7,TRUE,0,64,TRUE,1,65,TRUE,0,88,TRUE,0,68,TRUE,1,70,TRUE,0,70,TRUE,1,76,TRUE,1,74,FALSE,0,77,TRUE,1,74,FALSE,1,92,TRUE,0,95,FALSE,0,58,FALSE,1,61,FALSE,0,70,TRUE,1,87,FALSE,1,62,TRUE,0,84,TRUE,0,54,TRUE,0,63,TRUE,1,77,FALSE,0,58,TRUE,0,85,TRUE,1,69,FALSE,1,79,TRUE,1,62,FALSE,1,78,TRUE,0,66,TRUE,0,69,TRUE,1,76,FALSE,0,73,TRUE,1,69,0.0676,0.1444,0.0169,0.0576,0.0961,0.49,0.0961,0.0676,0.3969,0.3364,0.0576,0.3364,0.5929,0.0064,0.09,0.1225,0.7225,0.4624,0.4356,0.0441,0.0529,0.49,0.2916,0.1521,0.1444,0.0484,0.5329,0.4096,0.7744,0.7056,0.4761,0.9025,0.333357143,0.2767,0.390014286,16,50,16,50,3,37.5,4,50,5,62.5,4,50,11,68.75,5,31.25,72.28,72.12,70,69.75,77.25,70.94,73.62,0,22.28,34.62,20,7.25,27.25,2.19,42.37,2,1,1,2,2,2,2,0,2,1,1,1,1,1,1,1,0,0,1,1,2,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1.6,1.4,1,0.6,1.6,0.4,0,0.4,1.15,0.6,0.875,6.67,6,6.375,0,1,1,0.2,0.666666667,1,1,0,-1,0.67,0,-1,0,-1,1,1,-1,0,0,0,0,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,29,it was too long and was repeatitive,0,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,4,9,6,3,2,8,7,1,5,3,4,2,1 +371,R_3VKJ5OzEbyaKuO0,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,4,2,5,1,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,1,3,2,5,Agree,Disagree,Agree,Disagree,Agree,5,4,1,2,3,Somewhat agree,Neither agree nor disagree,Agree,Agree,Agree,4,5,3,2,1,Agree,Agree,Agree,Agree,Agree,4,2,5,1,3,2,Agree,Disagree,Agree,Disagree,Agree,2,5,4,3,1,1,Agree,Disagree,Agree,Disagree,Agree,5,1,2,3,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,4,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,1,5,2,4,3,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,1,2,0,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,3,2,1,4,1,Agree,Agree,Agree,Agree,Agree,5,3,2,4,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,61,TRUE,100,TRUE,100,TRUE,61,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,83,TRUE,100,TRUE,100,TRUE,74,TRUE,58,TRUE,64,TRUE,64,TRUE,100,TRUE,62,FALSE,100,FALSE,75,TRUE,79,TRUE,75,TRUE,78,TRUE,77,TRUE,75,TRUE,81,TRUE,79,TRUE,100,TRUE,100,TRUE,82,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,0,2,-3,3,-3,2,2,-2,2,-2,2,1,0,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,1,2,-2,2,-2,2,1,1,1,1,1,1,2,2,2,2,2,2,1,3,-3,3,-3,3,0,3,0,2,0,3,1,2,2,2,2,2,0,FALSE,1,61,TRUE,1,100,TRUE,0,100,TRUE,0,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,83,TRUE,0,100,TRUE,1,100,TRUE,0,74,TRUE,1,58,TRUE,1,64,TRUE,0,64,TRUE,0,100,TRUE,0,62,FALSE,1,100,FALSE,0,75,TRUE,1,79,TRUE,0,75,TRUE,1,78,TRUE,0,77,TRUE,1,75,TRUE,0,81,TRUE,0,79,TRUE,0,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0,0.0625,0.1296,0,0,0,0.0484,0,0,0.0441,0,0,0,0.6889,0,0,0.5625,0.3721,0.6241,0.5929,0.5625,0.1764,0.3844,0.5476,0.4096,0.6561,0.0324,0.1521,1,1,1,1,0.351932143,0.122571429,0.581292857,27,84.38,18,56.25,4,50,4,50,5,62.5,5,62.5,15,93.75,3,18.75,85.25,78.38,89.25,83.25,90.12,88.19,82.31,28.13,29,28.38,39.25,20.75,27.62,-5.56,63.56,1,1,1,0,2,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,2,1,0,0,0,1,1,2,0,2,1,1,2,0,0,0,1,0.6,0,0.8,1,0.4,1.2,0.6,0.6,0.8,0.7,1.33,0.67,1,0,0.2,-1.2,0.2,-0.333333333,1,1,0,2,0.66,2,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),70,all great,1.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,6,3,4,8,5,2,7,1,9,3,4,2,1 +372,R_715Q1qPVNnSgfuk,60 - 66,,Canadian,Canadian,Female,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,Disagree,1,4,3,5,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,3,4,5,2,1,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,2,3,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,4,1,5,Strongly disagree,Somewhat agree,Strongly disagree,Disagree,Neither agree nor disagree,2,5,4,3,1,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,5,3,2,1,5,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,5,2,3,4,6,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,1,4,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Agree,Somewhat disagree,Disagree,Disagree,3,1,2,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,1,4,2,3,5,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,2,4,5,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,2,5,3,1,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,53,FALSE,55,TRUE,82,FALSE,53,FALSE,55,FALSE,81,FALSE,55,TRUE,77,TRUE,54,TRUE,85,FALSE,55,TRUE,100,TRUE,56,FALSE,54,FALSE,54,TRUE,55,FALSE,53,TRUE,95,FALSE,54,FALSE,55,FALSE,53,FALSE,54,FALSE,56,FALSE,54,FALSE,73,TRUE,65,FALSE,55,TRUE,87,FALSE,55,FALSE,54,FALSE,54,TRUE,73,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,1,-2,1,-2,-1,0,0,1,-3,3,3,2,0,2,0,0,1,0,1,-3,1,-3,-2,0,5,0,-1,0,1,-1,5,2,3,3,0,2,6,0,-1,0,0,2,5,-3,2,-1,-2,-2,5,0,0,0,1,1,5,3,3,2,0,2,5,0,0,1,1,2,5,FALSE,1,53,FALSE,0,55,TRUE,0,82,FALSE,1,53,FALSE,0,55,FALSE,1,81,FALSE,0,55,TRUE,1,77,TRUE,1,54,TRUE,1,85,FALSE,1,55,TRUE,0,100,TRUE,1,56,FALSE,1,54,FALSE,0,54,TRUE,1,55,FALSE,1,53,TRUE,0,95,FALSE,1,54,FALSE,1,55,FALSE,0,53,FALSE,0,54,FALSE,1,56,FALSE,0,54,FALSE,1,73,TRUE,1,65,FALSE,1,55,TRUE,0,87,FALSE,1,55,FALSE,0,54,FALSE,0,54,TRUE,1,73,0.0529,0.1225,0.2025,0.3025,0.0729,0.0361,0.2916,0.0225,0.2025,0.2916,0.2916,0.1936,0.2116,0.2025,0.3025,0.3025,0.1936,0.2209,0.7569,0.0729,0.2809,0.2916,0.2116,0.2116,0.2209,0.2025,0.2916,0.2209,0.6724,0.9025,0.2025,1,0.2991,0.202571429,0.395628571,9,28.13,19,59.38,5,62.5,6,75,5,62.5,3,37.5,7,43.75,12,75,62.94,54.25,60.25,66.75,70.5,59.56,66.31,-31.25,3.56,-8.25,-14.75,4.25,33,15.81,-8.69,0,0,1,3,2,1,1,0,0,2,1,0,1,0,0,0,1,1,0,1,0,1,1,3,0,1,0,0,0,4,0,0,0,0,0,0,0,0,1,1,1.2,0.8,0.4,0.6,1,1,0,0.4,0.75,0.6,0.675,5.33,5,5.125,0.2,-0.2,0.4,0.2,0.133333333,0,0,1,0,0.33,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,5,4,9,2,6,8,7,1,3,4,2,3,1 +373,R_3jy7lCRUyQvFSvx,53 - 59,American,,American,Female,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,2,3,5,1,Strongly disagree,Strongly disagree,Agree,Disagree,Somewhat agree,3,4,2,1,5,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Somewhat Agree,4,1,3,5,2,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,1,3,5,2,4,5,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,2,3,4,1,5,5,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,2,4,3,1,5,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Agree,Agree,Agree,1,3,2,4,5,5,Strongly disagree,Disagree,Agree,Disagree,Agree,5,1,2,3,4,5,Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Agree,4,1,3,2,5,10,Agree,Agree,Agree,Agree,Disagree,4,1,2,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,67,TRUE,80,FALSE,50,TRUE,50,TRUE,93,TRUE,75,TRUE,75,FALSE,100,FALSE,50,FALSE,50,FALSE,100,FALSE,73,FALSE,87,TRUE,68,TRUE,87,FALSE,50,TRUE,93,FALSE,50,FALSE,50,TRUE,50,TRUE,68,TRUE,70,TRUE,73,TRUE,88,FALSE,50,TRUE,97,FALSE,50,FALSE,100,TRUE,78,FALSE,100,16,3,3,2,0,2,-3,-3,2,-2,1,2,0,3,-1,1,-2,-3,-3,-3,-3,3,3,3,-1,3,5,-3,-1,0,1,2,5,2,0,2,0,2,5,0,0,0,1,-1,10,3,3,2,2,2,5,-3,-2,2,-2,2,5,2,0,2,-3,2,5,2,2,2,2,-2,10,FALSE,1,100,TRUE,1,78,FALSE,1,100,FALSE,1,50,TRUE,1,97,FALSE,1,50,TRUE,1,88,TRUE,1,73,TRUE,1,70,TRUE,1,68,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,93,FALSE,0,50,TRUE,1,87,TRUE,0,68,FALSE,1,87,FALSE,1,73,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,75,TRUE,0,75,TRUE,1,93,TRUE,0,50,FALSE,1,50,TRUE,0,80,TRUE,1,67,FALSE,0,50,TRUE,1,100,0.0729,0.0049,0.0169,0.0144,0,0.25,0.0625,0.1024,0,0.25,0.1089,0.25,0.09,0.25,0.0009,0.0484,0,0.25,0.25,0.5625,0.25,0.25,0.0729,0.8649,0.4624,0.25,0.25,0,0,0.0169,0.64,0.25,0.206525,0.118792857,0.294257143,16,50,21,65.63,4,50,4,50,5,62.5,8,100,11,68.75,10,62.5,72.56,58.88,74.38,81.75,75.25,71.62,73.5,-15.63,6.93,8.88,24.38,19.25,-24.75,2.87,11,0,0,1,1,1,0,2,2,3,1,0,0,1,1,1,2,3,3,4,2,0,0,0,2,0,0,1,0,0,1,0,0,1,2,1,4,5,5,5,1,0.6,1.6,0.6,2.8,0.4,0.4,0.8,4,1.4,1.4,1.4,5,5,6.25,0.2,1.2,-0.2,-1.2,0.4,0,0,0,0,0,0,0,-1,-1,1,1,-1,1,-1,0,0,-1,20 cents,5 minutes,47 days,Female,College Diploma/Certificate,55,I did not like that previous section. Never did like math-based problems.,-0.375,0,1,1,0,0,0,0.67,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,5,3,7,2,4,8,9,1,6,4,3,2,1 +374,R_5Cp3IxHCoFb1Vch,46 - 52,,Canadian,Canadian,Male,Disagree,Agree,Agree,Agree,Agree,5,2,4,3,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,3,1,4,2,5,Somewhat Disagree,Strongly Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,2,3,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,5,2,4,Disagree,Agree,Agree,Agree,Agree,1,2,4,5,3,10,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,1,2,3,4,10,Disagree,Strongly Agree,Agree,Agree,Strongly Agree,4,1,3,5,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Agree,Agree,Agree,Agree,2,4,1,5,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,1,2,3,4,7,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,2,1,3,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,81,FALSE,50,TRUE,100,FALSE,50,TRUE,59,TRUE,64,TRUE,100,TRUE,54,FALSE,50,FALSE,50,TRUE,70,TRUE,74,TRUE,95,FALSE,50,TRUE,60,TRUE,60,FALSE,50,TRUE,96,TRUE,54,FALSE,100,TRUE,100,TRUE,55,FALSE,100,TRUE,64,TRUE,100,FALSE,54,FALSE,50,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,2,2,-1,0,0,2,1,-1,3,2,0,0,-3,-3,-3,-3,-3,-2,2,2,2,2,10,2,0,2,0,2,10,-2,3,2,2,3,10,3,3,3,3,3,10,-2,2,2,2,2,7,0,0,0,1,0,7,-1,2,1,1,0,7,0,0,0,0,0,7,TRUE,0,100,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,81,FALSE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,59,TRUE,0,64,TRUE,0,100,TRUE,1,54,FALSE,1,50,FALSE,0,50,TRUE,1,70,TRUE,0,74,TRUE,0,95,FALSE,1,50,TRUE,0,60,TRUE,1,60,FALSE,0,50,TRUE,0,96,TRUE,1,54,FALSE,1,100,TRUE,1,100,TRUE,0,55,FALSE,1,100,TRUE,0,64,TRUE,1,100,FALSE,0,54,FALSE,0,50,0,0,0.09,0.25,0.25,0.0361,0.2116,0.1681,0.36,0.25,0,0.2116,0.25,0.4096,0.25,0.25,0.9216,0.25,0,0,0.16,0.25,0.25,0.25,0.5476,0.3025,0.2916,1,0,0.9025,0.4096,1,0.327942857,0.272757143,0.383128571,16,50,16,50,2,25,4,50,4,50,6,75,9,56.25,7,43.75,70,52.88,66.12,75.5,85.5,62.56,77.44,0,20,27.88,16.12,25.5,10.5,6.31,33.69,0,0,0,0,0,3,0,2,2,1,1,0,0,2,3,6,6,6,6,6,0,0,0,0,0,1,0,0,1,1,0,1,1,1,0,3,3,3,3,3,0,1.6,1.2,6,0,0.6,0.6,3,2.2,1.05,1.625,10,7,8.5,0,1,0.6,3,0.533333333,3,3,3,3,3,0,1,2,-2,2,1,-1,2,-2,0,0,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),48,was different and interesting,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,9,5,8,7,6,3,4,1,2,2,3,4,1 +375,R_6ODCd9pDC2ACPRv,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,3,4,2,1,Somewhat agree,Agree,Agree,Agree,Agree,4,2,5,1,3,Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,3,1,4,2,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,4,1,3,5,2,Strongly Agree,Strongly Agree,Neither agree nor disagree,Disagree,Agree,1,3,2,4,5,2,Agree,Somewhat agree,Strongly agree,Agree,Strongly agree,1,4,5,2,3,4,Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,5,4,3,1,2,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,5,1,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,5,3,2,4,1,Neither agree nor disagree,Agree,Agree,Agree,Agree,5,1,2,3,4,2,Disagree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,5,4,3,2,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly disagree,2,5,4,3,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,TRUE,65,TRUE,81,TRUE,86,FALSE,75,TRUE,90,FALSE,71,TRUE,65,TRUE,86,FALSE,96,TRUE,92,FALSE,70,TRUE,59,FALSE,61,FALSE,62,TRUE,63,TRUE,97,TRUE,74,FALSE,90,TRUE,86,FALSE,64,FALSE,69,TRUE,91,TRUE,80,TRUE,86,TRUE,88,FALSE,88,TRUE,92,FALSE,66,FALSE,87,TRUE,86,FALSE,89,22,3,3,0,0,2,1,2,2,2,2,-2,0,3,-1,3,-2,-2,-2,-3,-3,3,3,0,-2,2,2,2,1,3,2,3,4,-2,0,2,1,3,4,-3,-3,-3,-3,-3,7,3,3,0,0,2,1,0,2,2,2,2,2,-2,0,3,-2,3,2,0,0,0,-2,-3,5,FALSE,1,89,TRUE,1,86,FALSE,1,87,FALSE,1,66,TRUE,1,92,FALSE,1,88,TRUE,1,88,TRUE,1,86,TRUE,1,80,TRUE,1,91,FALSE,1,69,FALSE,1,64,TRUE,1,86,FALSE,1,90,TRUE,1,74,TRUE,1,97,TRUE,0,63,FALSE,1,62,FALSE,1,61,TRUE,0,59,FALSE,0,70,TRUE,1,92,FALSE,1,96,TRUE,1,86,TRUE,0,65,FALSE,0,71,TRUE,0,90,FALSE,1,75,TRUE,0,86,TRUE,1,81,TRUE,1,65,TRUE,1,91,0.0196,0.5041,0.0009,0.0144,0.0081,0.0144,0.0196,0.0081,0.3481,0.0064,0.0361,0.0196,0.04,0.0961,0.0064,0.0196,0.0016,0.1156,0.0625,0.4225,0.49,0.0676,0.1521,0.01,0.3969,0.81,0.1225,0.0121,0.0169,0.1444,0.7396,0.1296,0.154157143,0.052835714,0.255478571,22,68.75,25,78.13,7,87.5,5,62.5,6,75,7,87.5,14,87.5,11,68.75,79.56,73.88,84,81,79.38,83.5,75.62,-9.38,1.43,-13.62,21.5,6,-8.12,-4,6.87,0,0,0,2,0,1,1,1,0,1,0,0,1,2,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,2,2,1,0,0.4,0.8,0.6,0.6,0,0.2,0.2,1.4,0.6,0.45,0.525,3.33,1.67,3.375,0.4,0.6,0.4,-0.8,0.466666667,1,2,2,2,1.66,0,1,1,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),46,What an interesting and thought provoking survey. Curious to know what the researchers were seeking.,1.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,6,4,7,8,2,3,5,1,9,2,3,4,1 +376,R_6CIbrBjMX2IaGzx,32 - 38,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Agree,Agree,Strongly agree,5,2,1,3,4,Strongly agree,Agree,Agree,Somewhat agree,Agree,3,4,2,1,5,Agree,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,3,2,4,1,5,Somewhat agree,Agree,Agree,Agree,Agree,4,3,2,1,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,3,5,2,4,8,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,Agree,4,5,3,1,2,8,Strongly Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,1,4,3,5,2,8,Agree,Somewhat agree,Somewhat agree,Agree,Agree,5,3,1,4,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,1,5,3,4,2,8,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,4,1,5,3,8,Agree,Agree,Agree,Agree,Strongly Agree,5,3,2,1,4,8,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,2,1,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,66,TRUE,87,FALSE,88,TRUE,79,FALSE,82,FALSE,78,FALSE,87,TRUE,83,TRUE,84,FALSE,82,TRUE,96,TRUE,91,FALSE,89,FALSE,75,TRUE,97,TRUE,93,TRUE,91,FALSE,93,FALSE,95,FALSE,87,TRUE,97,FALSE,93,TRUE,98,TRUE,95,FALSE,90,TRUE,91,TRUE,90,FALSE,91,TRUE,90,FALSE,97,FALSE,90,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,2,2,3,3,2,2,1,2,2,2,3,3,0,1,2,2,2,2,1,2,2,2,1,8,1,2,0,3,2,8,3,2,1,2,1,8,2,1,1,2,2,7,0,3,1,3,3,8,3,2,3,0,1,8,2,2,2,2,3,8,2,2,2,2,0,8,TRUE,0,70,TRUE,1,66,TRUE,0,87,FALSE,1,88,TRUE,1,79,FALSE,1,82,FALSE,0,78,FALSE,0,87,TRUE,1,83,TRUE,1,84,FALSE,1,82,TRUE,0,96,TRUE,1,91,FALSE,1,89,FALSE,0,75,TRUE,1,97,TRUE,0,93,TRUE,0,91,FALSE,1,93,FALSE,1,95,FALSE,0,87,TRUE,1,97,FALSE,1,93,TRUE,1,98,TRUE,0,95,FALSE,0,90,TRUE,0,91,TRUE,0,90,FALSE,1,91,TRUE,1,90,FALSE,0,97,FALSE,0,90,0.7569,0.81,0.0009,0.6084,0.81,0.0324,0.0004,0.0256,0.0025,0.0009,0.01,0.0081,0.0289,0.0324,0.0441,0.1156,0.0049,0.0144,0.81,0.9025,0.7569,0.5625,0.0049,0.0121,0.8649,0.8281,0.9409,0.49,0.7569,0.8281,0.0081,0.9216,0.350632143,0.080728571,0.620535714,20,62.5,17,53.13,5,62.5,5,62.5,3,37.5,4,50,9,56.25,8,50,87.97,84.38,88.25,86.75,92.5,86.81,89.12,9.37,34.84,21.88,25.75,49.25,42.5,30.56,39.12,1,1,0,0,2,2,0,2,2,0,1,0,2,1,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,3,1,0,0,0,2,0.8,1.2,1,0.6,0.4,0.6,1,0.6,0.9,0.65,0.775,8,8,7.875,0.4,0.6,0,0,0.333333333,0,0,0,-1,0,1,1,1,1,-1,1,-1,1,-1,2,-2,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),36,very good survey,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,6,3,9,5,8,7,4,1,2,4,3,2,1 +377,R_3OAVX3Wn1zJHxFj,46 - 52,,Canadian,Canadian,Female,Somewhat agree,Agree,Disagree,Neither agree nor disagree,Agree,3,1,4,2,5,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Disagree,2,5,1,3,4,Strongly Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,4,5,1,2,3,Agree,Agree,Agree,Somewhat agree,Disagree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,Agree,5,3,2,4,1,6,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Disagree,5,1,4,3,2,5,Agree,Agree,Agree,Disagree,Agree,1,3,2,5,4,5,Agree,Agree,Agree,Agree,Agree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,4,5,1,3,5,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,4,5,3,5,Agree,Agree,Somewhat Agree,Agree,Agree,1,3,4,2,5,5,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,4,3,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,94,FALSE,95,TRUE,81,TRUE,83,TRUE,100,TRUE,59,TRUE,100,TRUE,84,FALSE,93,TRUE,81,TRUE,53,TRUE,91,FALSE,72,FALSE,83,TRUE,90,TRUE,100,FALSE,100,TRUE,52,TRUE,100,TRUE,100,TRUE,100,TRUE,55,TRUE,100,TRUE,91,TRUE,100,TRUE,91,FALSE,100,FALSE,71,TRUE,74,TRUE,100,TRUE,70,FALSE,92,16,1,2,-2,0,2,1,-3,3,-2,-2,3,1,1,0,3,2,2,2,1,-2,0,2,-1,1,2,5,0,-2,2,-1,-2,6,2,2,2,-2,2,5,2,2,2,2,2,5,1,2,0,0,1,5,-1,-2,1,-1,1,5,2,2,1,2,2,5,2,2,2,2,0,5,FALSE,1,92,TRUE,1,70,TRUE,0,100,TRUE,0,74,FALSE,0,71,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,0,55,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,52,FALSE,0,100,TRUE,0,100,TRUE,0,90,FALSE,1,83,FALSE,1,72,TRUE,1,91,TRUE,1,53,TRUE,0,81,FALSE,0,93,TRUE,0,84,TRUE,1,100,TRUE,0,59,TRUE,0,100,TRUE,0,83,TRUE,1,81,FALSE,0,95,TRUE,1,94,0,0,1,0.0081,0.0036,0,0.8649,0,0.0784,0.2209,0.0361,0,0.0081,0.3025,0.5041,0.09,0.6561,0.5476,1,0.7056,0.0081,0.2304,0.0289,1,1,0.3481,0.9025,0.0064,1,0.81,0.6889,1,0.430042857,0.236592857,0.623492857,16,50,16,50,4,50,4,50,5,62.5,3,37.5,12,75,4,25,86.09,72.38,90,88.75,93.25,86.38,85.81,0,36.09,22.38,40,26.25,55.75,11.38,60.81,1,0,1,1,0,1,1,1,1,0,1,1,1,2,1,0,0,0,1,4,0,0,2,0,1,2,1,2,1,3,1,1,0,2,1,0,0,0,1,2,0.6,0.8,1.2,1,0.6,1.8,1,0.6,0.9,1,0.95,5.33,5,5.125,0,-1,0.2,0.4,-0.266666667,0,1,0,0,0.33,1,1,0,1,-1,1,-1,1,-1,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,Great survey!,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,8,2,5,3,9,6,4,1,7,2,3,4,1 +378,R_7mdm9AY0zbSba49,18 - 24,American,,American,Female,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,3,2,5,1,Disagree,Somewhat disagree,Somewhat agree,Agree,Agree,1,2,5,3,4,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,2,1,5,3,Strongly disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,5,3,2,1,5,Strongly disagree,Disagree,Disagree,Somewhat disagree,Neither agree nor disagree,2,3,4,5,1,1,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,3,5,4,2,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,Somewhat agree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,2,1,3,5,4,4,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,4,2,3,1,5,0,Agree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,2,1,5,4,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,4,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,53,FALSE,74,TRUE,100,TRUE,62,TRUE,74,TRUE,100,FALSE,100,TRUE,99,FALSE,100,FALSE,55,FALSE,64,FALSE,85,TRUE,68,FALSE,80,FALSE,52,TRUE,100,FALSE,67,TRUE,63,TRUE,96,FALSE,50,FALSE,50,TRUE,80,TRUE,94,TRUE,99,TRUE,100,FALSE,100,TRUE,100,FALSE,52,FALSE,76,TRUE,52,FALSE,100,26,0,1,0,-1,1,-2,-1,1,2,2,2,-1,3,0,3,-3,-2,-2,-3,-3,3,2,0,1,0,5,-3,-2,-2,-1,0,5,2,-1,3,0,3,1,0,0,1,-3,1,8,1,1,1,-2,1,4,-1,-2,2,-1,1,4,2,-1,3,0,3,0,0,0,1,0,-1,8,FALSE,1,100,TRUE,1,52,FALSE,1,76,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,94,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,96,TRUE,0,63,FALSE,0,67,TRUE,1,100,FALSE,1,52,FALSE,1,80,TRUE,0,68,FALSE,1,85,FALSE,0,64,FALSE,0,55,FALSE,1,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,TRUE,0,74,TRUE,0,62,TRUE,0,100,FALSE,0,74,FALSE,0,53,FALSE,0,100,0.0001,0,0,0,1,0,0.0001,0.04,0.0225,0.3025,0.5476,0.0016,0.0036,0.25,0,0.2304,0,0.2304,0.3844,0,0.4096,0.4489,0.4624,0.3969,0.2304,0.5476,0.2809,0,0.0576,0.04,1,0.25,0.254907143,0.187764286,0.32205,26,81.25,21,65.63,4,50,5,62.5,6,75,6,75,10,62.5,11,68.75,79.53,63.75,89,84.75,80.62,83.31,75.75,15.62,13.9,13.75,26.5,9.75,5.62,20.81,7,3,1,0,2,1,1,1,3,3,2,0,0,0,0,0,3,2,3,0,4,1,0,1,1,0,1,1,1,3,1,0,0,0,0,0,3,2,3,3,2,1.4,2,0,2.4,0.6,1.4,0,2.6,1.45,1.15,1.3,3.67,2.67,4.375,0.8,0.6,0,-0.2,0.466666667,1,1,1,0,1,1,2,2,-2,2,1,-1,-1,1,-2,2,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,23,,1.125,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,8,3,2,6,7,5,9,1,4,2,3,4,1 +379,R_5KNnaSA3QeWeCr9,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,1,3,2,4,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,1,3,4,2,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,5,2,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,3,4,0,Strongly disagree,Agree,Somewhat agree,Agree,Strongly disagree,3,1,4,2,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,4,2,5,1,1,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,3,1,5,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,5,2,3,4,1,1,Strongly disagree,Agree,Somewhat agree,Agree,Strongly disagree,1,2,4,3,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,5,2,3,1,4,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,2,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,57,TRUE,100,TRUE,81,FALSE,57,TRUE,59,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,93,TRUE,85,FALSE,100,TRUE,84,TRUE,100,TRUE,83,TRUE,100,TRUE,74,TRUE,100,TRUE,73,TRUE,78,FALSE,100,TRUE,100,TRUE,95,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,67,TRUE,95,TRUE,90,FALSE,100,27,3,3,3,3,3,-3,1,1,1,-2,2,3,3,1,3,2,1,2,2,0,3,3,3,3,3,0,-3,2,1,2,-3,2,3,3,3,0,3,1,0,-1,0,0,-1,6,3,3,3,3,-1,1,-3,2,1,2,-3,0,3,3,3,-2,3,0,0,0,0,1,1,5,FALSE,1,100,TRUE,1,90,TRUE,0,95,FALSE,1,67,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,TRUE,0,78,TRUE,1,73,TRUE,0,100,TRUE,1,74,TRUE,1,100,TRUE,0,83,TRUE,0,100,TRUE,0,84,FALSE,1,100,TRUE,1,85,TRUE,1,93,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,59,FALSE,1,57,TRUE,0,81,TRUE,1,100,FALSE,0,57,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0049,0,0.0729,0.0025,0,0,0.01,1,0.1089,0.1849,0,0.0225,0.0676,0.7056,1,0.6889,0.3481,0.3249,0,0.9025,1,0.6561,0.6084,0.275310714,0.085657143,0.464964286,27,84.38,22,68.75,5,62.5,5,62.5,6,75,6,75,15,93.75,7,43.75,89.72,78.25,90.25,99.12,91.25,91.69,87.75,15.63,20.97,15.75,27.75,24.12,16.25,-2.06,44,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,2,2,2,2,1,0,0,0,0,4,0,1,0,1,1,1,0,0,3,0,2,1,2,1,1,0,0.6,0.4,1.8,0.8,0.6,0.8,1.4,0.7,0.9,0.8,1,0.33,1.875,-0.8,0,-0.4,0.4,-0.4,-1,2,1,1,0.67,2,2,1,-2,2,1,-1,-2,2,-2,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),63,,1.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,9,4,7,8,6,5,3,1,2,2,4,3,1 +380,R_3QFOR6F1kwh7Qjv,46 - 52,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Strongly agree,Agree,Agree,4,1,5,2,3,Strongly disagree,Strongly disagree,Agree,Disagree,Somewhat agree,1,5,4,3,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,5,2,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat agree,Strongly Agree,Agree,Agree,3,5,1,4,2,5,Strongly disagree,Strongly disagree,Agree,Disagree,Somewhat agree,2,1,5,4,3,2,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,1,5,4,3,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Somewhat agree,Strongly Agree,Agree,Agree,3,4,2,1,5,2,Strongly disagree,Strongly disagree,Agree,Disagree,Agree,4,1,5,3,2,2,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,5,2,1,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,4,2,3,FALSE,95,TRUE,98,FALSE,98,FALSE,50,TRUE,100,FALSE,100,TRUE,96,TRUE,97,TRUE,98,TRUE,92,FALSE,50,TRUE,100,TRUE,98,FALSE,54,FALSE,50,TRUE,100,FALSE,93,TRUE,100,FALSE,56,FALSE,50,TRUE,97,TRUE,96,FALSE,100,TRUE,91,FALSE,100,TRUE,95,FALSE,50,FALSE,50,TRUE,97,FALSE,50,FALSE,50,TRUE,97,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,2,2,-3,-3,2,-2,1,1,1,1,1,2,1,1,1,1,0,2,1,3,2,2,5,-3,-3,2,-2,1,5,1,1,2,2,2,2,1,1,1,1,0,3,3,1,3,2,2,4,-3,-3,2,-2,2,2,1,1,2,0,2,2,1,1,1,1,1,2,FALSE,1,95,TRUE,1,98,FALSE,1,98,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,97,TRUE,1,98,TRUE,1,92,FALSE,1,50,TRUE,0,100,TRUE,1,98,FALSE,1,54,FALSE,0,50,TRUE,1,100,FALSE,1,93,TRUE,0,100,FALSE,1,56,FALSE,1,50,TRUE,1,97,TRUE,1,96,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,95,FALSE,1,50,FALSE,1,50,TRUE,0,97,FALSE,0,50,FALSE,0,50,TRUE,1,97,0.0009,0.0025,0,0.0016,0.0009,0,0.0081,0.0064,0.25,0.0016,0.25,0.0004,0.0004,0.25,0,0.0004,0,0.25,0.25,0,0.0009,0.25,0.1936,0.2116,0.0049,0.25,0.25,0.0025,0.0004,1,0.9409,1,0.191892857,0.072728571,0.311057143,28,87.5,26,81.25,6,75,7,87.5,7,87.5,6,75,13,81.25,13,81.25,82.75,62.75,97.75,91,79.5,87.81,77.69,6.25,1.5,-12.25,10.25,3.5,4.5,6.56,-3.56,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0.2,0,0.4,0,0,0.2,0.4,0.2,0.15,0.2,0.175,4,2.67,3.125,0.2,-0.2,0,-0.2,0,1,3,0,1,1.33,-1,1,0,-1,1,0,0,-1,1,-1,1,-2,5 cents,5 minutes,47 days,Female,University - Undergraduate,48,I would have liked to know if I answered the questions correctly.,0.125,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,6,9,4,8,7,3,2,1,5,2,3,4,1 +381,R_5woH3iyCjf4hAY8,39 - 45,American,,American,Female,Strongly agree,Strongly disagree,Strongly disagree,Strongly disagree,Agree,4,3,2,5,1,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,5,2,3,1,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,2,4,1,Disagree,Disagree,Disagree,Disagree,Somewhat disagree,2,1,3,4,5,Strongly Agree,Somewhat agree,Somewhat agree,Strongly disagree,Agree,2,3,1,4,5,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,2,4,1,7,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,1,4,5,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,5,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Disagree,Strongly disagree,Strongly disagree,Strongly Agree,4,5,2,1,3,2,Agree,Disagree,Agree,Disagree,Somewhat agree,4,2,3,5,1,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,2,3,1,4,5,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,2,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,75,TRUE,94,FALSE,96,FALSE,80,TRUE,85,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,93,FALSE,75,TRUE,100,FALSE,65,FALSE,63,FALSE,65,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,55,FALSE,83,FALSE,59,TRUE,99,TRUE,86,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,-3,-3,-3,2,-1,-1,2,0,1,1,0,1,0,1,-2,-2,-2,-2,-1,3,1,1,-3,2,7,1,0,1,-1,1,7,2,1,0,-1,1,7,0,0,0,0,0,9,3,-2,-3,-3,3,2,2,-2,2,-2,1,3,1,-1,1,-1,0,2,1,0,1,1,1,8,TRUE,0,75,TRUE,1,94,FALSE,1,96,FALSE,1,80,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,0,93,FALSE,1,75,TRUE,0,100,FALSE,1,65,FALSE,1,63,FALSE,0,65,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,55,FALSE,1,83,FALSE,1,59,TRUE,1,99,TRUE,1,86,TRUE,1,100,0,0,0.8649,0,0,0,0,1,0.1369,0,0.0001,0,0,0,0.0225,0.0036,0,0.04,0.0289,0,0.4225,0.25,0.1225,0,0.0625,0.3025,0.0196,0.5625,0.0016,1,0.1681,1,0.183707143,0.085935714,0.281478571,20,62.5,24,75,6,75,7,87.5,5,62.5,6,75,12,75,12,75,88.22,78.75,85.5,96.88,91.75,92,84.44,-12.5,13.22,3.75,-2,34.38,16.75,17,9.44,0,4,4,0,0,2,1,1,1,0,1,1,1,1,0,2,2,2,2,1,0,1,0,0,1,3,1,0,2,0,0,1,0,1,1,3,2,3,3,2,1.6,1,0.8,1.8,0.4,1.2,0.6,2.6,1.3,1.2,1.25,7,2.33,5.625,1.2,-0.2,0.2,-0.8,0.4,5,4,5,1,4.67,0,1,1,-2,2,1,-1,0,0,0,0,0,10 cents,100 minutes,36 days,Female,High School (or equivalent),42,,0.375,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,3,7,9,5,6,4,2,1,8,4,2,3,1 +382,R_7vJeWfEssRlpo9r,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Disagree,Somewhat agree,5,4,3,1,2,Strongly agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,5,1,2,3,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,5,1,4,3,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,4,1,2,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,4,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,4,2,3,5,1,7,Strongly agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,3,2,1,5,4,8,Somewhat Agree,Agree,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,4,1,2,3,5,7,Somewhat agree,Somewhat agree,Agree,Agree,Agree,4,2,5,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,50,FALSE,50,TRUE,63,FALSE,50,TRUE,67,TRUE,92,TRUE,69,TRUE,100,FALSE,65,TRUE,100,TRUE,78,TRUE,50,TRUE,89,FALSE,100,FALSE,83,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,86,FALSE,76,TRUE,100,FALSE,55,FALSE,100,TRUE,50,TRUE,90,16,3,3,2,-2,1,3,1,1,2,1,3,1,2,1,0,-1,0,1,2,0,-2,3,3,-3,3,5,0,0,0,0,0,5,0,0,0,0,0,8,0,0,0,0,0,7,3,3,3,0,3,5,3,3,3,2,0,7,1,2,3,0,1,8,1,1,2,2,2,7,TRUE,0,90,TRUE,1,50,FALSE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,76,TRUE,1,86,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,83,FALSE,1,100,TRUE,0,89,TRUE,0,50,TRUE,1,78,TRUE,1,100,FALSE,1,65,TRUE,1,100,TRUE,0,69,TRUE,1,92,TRUE,0,67,FALSE,1,50,TRUE,0,63,FALSE,0,50,FALSE,0,50,TRUE,1,96,0,0.0064,0,0.0196,0.0016,0.0576,0,0,0.25,0,0.25,0,0,0.25,0,0.25,0.1225,0.2025,0.25,0.4761,0.0484,0,0.7921,1,0.0289,0.4489,0.25,0.81,0,0,0.3969,0,0.210196429,0.098871429,0.321521429,16,50,22,68.75,4,50,7,87.5,5,62.5,6,75,14,87.5,8,50,81.53,70.12,82.62,92.12,81.25,87.62,75.44,-18.75,12.78,20.12,-4.88,29.62,6.25,0.12,25.44,5,0,1,1,2,3,1,1,2,1,3,1,2,1,0,1,0,1,2,0,0,0,1,2,2,0,2,2,0,1,2,1,1,1,1,2,1,1,0,2,1.8,1.6,1.4,0.8,1,1,1.2,1.2,1.4,1.1,1.25,6,6.67,6.5,0.8,0.6,0.2,-0.4,0.533333333,0,-2,0,0,-0.67,1,-1,1,-1,1,1,-1,-2,2,-2,2,-2,10 cents,100 minutes,24 days,Female,University - Undergraduate,33,I hate excessively repetitive questions,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,3,8,5,9,7,4,2,1,6,2,3,4,1 +383,R_7cZeMbi0x1TzwVz,39 - 45,American,,American,Male,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,1,4,2,3,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,2,4,5,3,Strongly Agree,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,1,3,4,5,Agree,Agree,Strongly Agree,Agree,Somewhat disagree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,4,1,2,5,3,6,Agree,Strongly disagree,Agree,Disagree,Somewhat agree,3,1,5,4,2,4,Strongly Agree,Somewhat Disagree,Strongly Agree,Strongly Agree,Disagree,5,3,4,2,1,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,3,2,5,1,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,3,1,5,4,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Somewhat Agree,4,5,2,3,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,75,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,87,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,78,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,70,TRUE,74,FALSE,100,31,0,3,2,0,3,0,-3,3,-3,1,3,2,2,1,0,2,2,3,2,-1,-2,3,3,-1,3,4,2,-3,2,-2,1,6,3,-1,3,3,-2,4,1,0,1,1,-1,7,2,3,2,2,3,1,1,-3,3,-3,1,0,3,3,3,-2,1,0,3,3,3,3,3,2,FALSE,1,100,TRUE,1,74,FALSE,1,70,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,78,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,87,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,1,0,0,0,0,0,0,0,0,0,0,1,0.0484,0,0,0.0676,0,0,0.0625,0,0,0,0,0.0169,0,0,1,0,0.09,0,1,0,0.117335714,0.079714286,0.154957143,31,96.88,28,87.5,7,87.5,6,75,8,100,7,87.5,13,81.25,15,93.75,96.38,94,100,98.38,93.12,97,95.75,9.38,8.88,6.5,25,-1.62,5.62,15.75,2,2,0,1,1,0,2,0,1,1,0,0,3,1,2,2,1,2,2,1,0,2,0,0,2,0,1,0,0,0,0,0,1,1,3,1,1,1,0,1,4,0.8,0.8,1.6,1.2,0.8,0.2,1.2,1.4,1.1,0.9,1,4.67,0.33,3,0,0.6,0.4,-0.2,0.333333333,3,6,4,5,4.34,0,2,1,-2,2,0,0,-1,1,-2,2,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),44,Was a tad too long. Most people are going to lose interest. Cut it back to about 10 minutes max. ,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,3,6,7,5,9,4,8,1,2,2,3,4,1 +384,R_37dqDNnecMDxKoa,25 - 31,,Canadian,Canadian,Male,Agree,Strongly agree,Somewhat agree,Disagree,Strongly agree,1,3,5,2,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,4,5,1,2,3,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,5,4,2,3,1,Strongly disagree,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,1,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Neither agree nor disagree,Strongly Agree,1,4,3,2,5,5,Disagree,Disagree,Somewhat agree,Somewhat agree,Agree,2,3,4,1,5,7,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,4,2,1,3,5,4,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Agree,4,5,3,2,1,6,Somewhat agree,Somewhat disagree,Agree,Disagree,Agree,3,2,4,5,1,3,Somewhat Agree,Agree,Agree,Agree,Agree,1,4,3,2,5,8,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,2,1,4,3,FALSE,98,TRUE,50,TRUE,60,FALSE,50,TRUE,65,FALSE,98,TRUE,98,TRUE,98,TRUE,75,FALSE,75,FALSE,75,TRUE,99,TRUE,95,FALSE,95,FALSE,77,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,50,TRUE,97,TRUE,100,FALSE,100,TRUE,98,TRUE,55,TRUE,100,TRUE,50,FALSE,99,TRUE,76,FALSE,80,FALSE,60,TRUE,92,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,-2,3,-1,-1,1,0,2,1,2,2,1,2,-3,2,0,-1,-1,2,2,2,0,3,4,-2,-2,1,1,2,5,2,1,1,1,3,7,0,2,1,1,0,4,2,3,1,0,2,2,1,-1,2,-2,2,6,1,2,2,2,2,3,2,2,2,2,0,8,FALSE,1,98,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,65,FALSE,1,98,TRUE,1,98,TRUE,1,98,TRUE,1,75,FALSE,0,75,FALSE,1,75,TRUE,0,99,TRUE,1,95,FALSE,1,95,FALSE,0,77,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,98,TRUE,0,55,TRUE,1,100,TRUE,0,50,FALSE,1,99,TRUE,0,76,FALSE,0,80,FALSE,0,60,TRUE,1,92,0.0004,0,0,0.0004,0.0064,0.0004,0.0004,0.5625,0.25,0,0.64,0.0025,0.0625,0.0625,0.1225,0.25,0,0.25,0.0001,0.3025,0.0009,0.5929,0.25,0.0025,0.25,0.25,0.36,0.0004,0.36,1,0.5776,0.9801,0.254882143,0.157835714,0.351928571,24,75,20,62.5,4,50,6,75,5,62.5,5,62.5,12,75,8,50,80.16,60.88,84.12,90.12,85.5,85,75.31,12.5,17.66,10.88,9.12,27.62,23,10,25.31,0,1,1,2,0,1,1,0,1,0,1,1,1,0,1,3,0,1,2,1,0,0,0,2,1,2,0,1,2,0,0,0,0,1,0,5,0,2,3,1,0.8,0.6,0.8,1.4,0.6,1,0.2,2.2,0.9,1,0.95,5.33,3.67,4.875,0.2,-0.4,0.6,-0.8,0.133333333,2,-1,4,-4,1.66,1,1,1,0,0,0,0,-1,1,-1,1,-1,5 cents,5 minutes,47 days,Male,High School (or equivalent),26,Put all the profiling questions at the start.,0.5,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,6,9,4,8,2,5,7,1,3,4,2,3,1 +385,R_7B3ymhEs2PX8Sys,46 - 52,American,,American,Male,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,3,1,Somewhat disagree,Disagree,Somewhat agree,Neither agree nor disagree,Agree,2,1,4,3,5,Strongly Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,4,2,5,1,3,Somewhat agree,Somewhat agree,Agree,Agree,Strongly Agree,3,2,1,5,4,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,4,3,1,4,Disagree,Agree,Agree,Somewhat agree,Neither agree nor disagree,2,1,3,5,4,6,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,2,1,3,5,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,2,4,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,5,2,4,3,1,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,3,Strongly Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,2,1,3,5,4,0,Agree,Somewhat agree,Agree,Somewhat agree,Strongly Agree,1,3,2,4,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,50,TRUE,50,TRUE,50,FALSE,65,TRUE,90,TRUE,75,FALSE,50,TRUE,75,FALSE,50,TRUE,75,FALSE,75,TRUE,92,TRUE,50,TRUE,100,FALSE,50,TRUE,86,TRUE,76,FALSE,100,TRUE,100,TRUE,91,TRUE,50,TRUE,64,TRUE,50,TRUE,50,FALSE,50,FALSE,75,TRUE,50,TRUE,75,TRUE,75,TRUE,93,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,1,1,1,-1,-2,1,0,2,3,-2,3,-2,3,1,1,2,2,3,0,3,0,0,-1,4,-2,2,2,1,0,6,3,2,3,-2,3,3,3,3,3,3,3,3,0,2,0,1,1,1,-2,-1,2,0,0,3,3,-2,3,-2,3,0,2,1,2,1,3,0,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,65,TRUE,1,90,TRUE,1,75,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,75,FALSE,0,75,TRUE,0,92,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,86,TRUE,0,76,FALSE,1,100,TRUE,1,100,TRUE,1,91,TRUE,0,50,TRUE,1,64,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,75,TRUE,0,50,TRUE,1,75,TRUE,1,75,TRUE,1,93,0.0625,0.25,0,0.01,0.0049,0.1225,0.1296,0.0625,0,0.0081,0.0625,0.5625,0.25,0.25,0.25,0,0.25,0.25,0.0625,0.25,0,0.25,0.5776,0.8464,0.25,0.25,0.0625,1,0.25,0.7396,0.25,0.5625,0.269775,0.157328571,0.382221429,18,56.25,21,65.63,5,62.5,5,62.5,4,50,7,87.5,14,87.5,7,43.75,71.31,62.62,66.62,79.25,76.75,75.81,66.81,-9.38,5.68,0.12,4.12,29.25,-10.75,-11.69,23.06,1,0,1,1,2,1,4,1,1,2,0,4,0,0,0,2,2,1,1,0,1,1,1,0,0,1,1,1,0,2,0,0,0,0,0,1,0,0,1,0,1,1.8,0.8,1.2,0.6,1,0,0.4,1.2,0.5,0.85,4.33,1.33,2.5,0.4,0.8,0.8,0.8,0.666666667,3,3,3,3,3,2,2,2,-2,2,-1,1,0,0,-2,2,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,47,it showed me that there are many things that i do not know or not sure of.,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,9,3,8,2,6,5,7,1,4,3,4,2,1 +386,R_6TBfmZR2s5RGLyV,32 - 38,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,Agree,3,2,4,5,1,Agree,Agree,Strongly agree,Somewhat agree,Agree,4,1,5,2,3,Agree,Somewhat Agree,Strongly Agree,Agree,Agree,2,1,3,5,4,Agree,Agree,Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,Agree,Somewhat agree,Strongly Agree,Agree,Agree,3,2,4,5,1,8,Somewhat agree,Agree,Agree,Agree,Strongly agree,1,4,2,5,3,8,Strongly Agree,Agree,Somewhat Agree,Agree,Strongly Agree,4,2,1,5,3,7,Strongly Agree,Somewhat agree,Agree,Agree,Agree,4,1,5,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Somewhat agree,Agree,4,3,5,2,1,8,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,4,2,3,1,8,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,2,5,4,1,3,8,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Agree,5,4,1,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,85,TRUE,78,TRUE,74,TRUE,74,TRUE,62,TRUE,68,TRUE,77,TRUE,70,TRUE,81,TRUE,73,TRUE,74,TRUE,71,TRUE,68,TRUE,76,TRUE,83,TRUE,72,TRUE,67,TRUE,67,TRUE,70,TRUE,79,TRUE,69,FALSE,83,FALSE,77,TRUE,80,TRUE,74,TRUE,79,TRUE,66,TRUE,86,TRUE,69,TRUE,91,TRUE,79,TRUE,70,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,3,2,2,2,3,1,2,2,1,3,2,2,2,2,2,3,3,2,1,3,2,2,8,1,2,2,2,3,8,3,2,1,2,3,7,3,1,2,2,2,8,3,2,2,1,2,8,3,3,3,2,2,8,1,2,1,2,2,8,3,2,1,1,2,7,TRUE,0,85,TRUE,1,78,TRUE,0,74,TRUE,0,74,TRUE,1,62,TRUE,0,68,TRUE,1,77,TRUE,1,70,TRUE,1,81,TRUE,1,73,TRUE,0,74,TRUE,0,71,TRUE,1,68,TRUE,0,76,TRUE,1,83,TRUE,1,72,TRUE,0,67,TRUE,0,67,TRUE,0,70,TRUE,0,79,TRUE,1,69,FALSE,0,83,FALSE,1,77,TRUE,1,80,TRUE,0,74,TRUE,1,79,TRUE,0,66,TRUE,0,86,TRUE,0,69,TRUE,1,91,TRUE,1,79,TRUE,1,70,0.09,0.0441,0.0784,0.0529,0.09,0.4624,0.04,0.0729,0.6241,0.6889,0.0081,0.1024,0.0361,0.5476,0.1444,0.0484,0.0529,0.5476,0.7396,0.5476,0.0961,0.0289,0.49,0.5776,0.4489,0.4356,0.0441,0.7225,0.5476,0.4489,0.4761,0.5041,0.341907143,0.247557143,0.436257143,27,84.38,16,50,4,50,5,62.5,3,37.5,4,50,15,93.75,1,6.25,74.75,75.62,68.75,76.75,77.88,75.94,73.56,34.38,24.75,25.62,6.25,39.25,27.88,-17.81,67.31,1,0,0,1,0,1,0,1,1,1,1,1,2,0,1,1,1,0,1,1,0,1,1,2,0,1,1,0,1,0,1,1,2,0,0,1,0,1,2,1,0.4,0.8,1,0.8,0.8,0.6,0.8,1,0.75,0.8,0.775,7.67,8,7.75,-0.4,0.2,0.2,-0.2,0,0,0,-1,1,-0.33,1,1,1,1,-1,1,-1,2,-2,1,-1,1,10 cents,75 minutes,24 days,Female,College Diploma/Certificate,34,it was fun and entertaining ,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,3,6,4,7,2,9,5,1,8,3,2,4,1 +387,R_13pgamghMYPOZF4,67 - 73,American,,American,Male,Agree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,4,5,3,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,1,4,5,2,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,2,5,3,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,3,1,5,Agree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,5,1,4,2,3,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,5,1,4,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,3,5,2,4,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,1,2,4,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat disagree,Agree,Disagree,3,5,2,4,1,3,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,5,2,3,4,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,1,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,1,5,4,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,90,TRUE,92,TRUE,100,FALSE,59,TRUE,58,FALSE,95,TRUE,78,TRUE,95,TRUE,89,TRUE,82,FALSE,92,TRUE,96,FALSE,96,FALSE,94,FALSE,50,TRUE,94,FALSE,89,TRUE,98,FALSE,98,FALSE,98,TRUE,100,FALSE,90,TRUE,71,TRUE,69,FALSE,93,TRUE,100,TRUE,50,FALSE,88,TRUE,92,FALSE,97,FALSE,84,TRUE,90,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,0,2,0,-1,-1,0,-1,1,-1,0,1,0,2,0,0,1,-1,1,2,2,0,2,0,6,-1,-1,1,-2,0,2,0,0,0,0,1,4,0,0,2,1,1,1,2,2,-1,2,-2,3,-2,-1,1,-1,0,5,0,1,1,0,1,5,0,0,2,1,1,5,TRUE,0,90,TRUE,1,92,TRUE,0,100,FALSE,1,59,TRUE,1,58,FALSE,1,95,TRUE,1,78,TRUE,1,95,TRUE,1,89,TRUE,1,82,FALSE,1,92,TRUE,0,96,FALSE,0,96,FALSE,1,94,FALSE,0,50,TRUE,1,94,FALSE,1,89,TRUE,0,98,FALSE,1,98,FALSE,1,98,TRUE,1,100,FALSE,0,90,TRUE,0,71,TRUE,1,69,FALSE,1,93,TRUE,1,100,TRUE,0,50,FALSE,1,88,TRUE,0,92,FALSE,0,97,FALSE,0,84,TRUE,1,90,0.0025,0,0.0036,0.0484,0.01,0.0025,0.0961,0.0324,0.0004,0.81,0.9409,0.9216,0.0121,0.0064,0.1764,0.0064,0.5041,0.1681,0.0144,0.0049,0,0.25,0.0004,0.0036,0.0121,0.25,0.7056,0.81,1,0.9604,0.8464,0.9216,0.3381,0.263385714,0.412814286,17,53.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,11,68.75,9,56.25,86.47,76.75,86.38,90.62,92.12,85.25,87.69,-9.37,23.97,14.25,23.88,28.12,29.62,16.5,31.44,0,0,0,0,0,0,0,1,1,1,1,0,1,0,1,0,0,1,2,0,0,0,1,0,2,1,0,1,0,1,1,1,0,0,1,0,0,1,2,0,0,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.45,0.6,0.525,4,4.33,3.875,-0.6,0,0,0,-0.2,3,-3,-1,-4,-0.33,0,0,1,-1,1,0,0,0,0,-1,1,0,5 cents,5 minutes,47 days,Male,Trade School (non-military),71,,0.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,4,5,2,8,9,7,1,6,2,3,4,1 +388,R_5VvG2RgUCE91pSh,32 - 38,American,,American,Male,Agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,2,3,5,4,1,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,1,2,4,3,5,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,Somewhat Disagree,5,2,4,3,1,Somewhat agree,Agree,Agree,Strongly Agree,Somewhat agree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Somewhat agree,Somewhat agree,Agree,Agree,1,5,3,2,4,2,Agree,Agree,Somewhat agree,Somewhat agree,Agree,1,3,4,2,5,8,Strongly Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,2,5,1,4,3,3,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,Agree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Strongly Agree,Strongly disagree,3,2,5,4,1,1,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,1,5,4,2,3,2,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,2,3,4,1,5,3,Agree,Agree,Agree,Agree,Somewhat agree,2,5,3,1,4,TRUE,100,FALSE,76,FALSE,100,FALSE,100,FALSE,79,TRUE,85,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,83,TRUE,100,TRUE,85,FALSE,79,FALSE,84,FALSE,88,FALSE,78,TRUE,100,FALSE,80,TRUE,100,FALSE,79,FALSE,92,FALSE,67,TRUE,85,TRUE,78,TRUE,82,FALSE,91,TRUE,86,FALSE,78,TRUE,93,FALSE,81,FALSE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,3,-1,2,0,1,-2,2,0,2,2,1,-1,1,2,2,3,1,2,1,1,2,2,6,2,2,1,1,2,2,3,1,2,2,1,8,3,2,0,1,2,3,2,2,2,3,-3,3,1,0,0,1,2,1,1,-1,0,2,1,2,2,2,2,2,1,3,TRUE,0,100,FALSE,0,76,FALSE,1,100,FALSE,1,100,FALSE,0,79,TRUE,0,85,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,83,TRUE,0,100,TRUE,1,85,FALSE,1,79,FALSE,0,84,FALSE,0,88,FALSE,1,78,TRUE,0,100,FALSE,1,80,TRUE,0,100,FALSE,0,79,FALSE,0,92,FALSE,1,67,TRUE,1,85,TRUE,0,78,TRUE,1,82,FALSE,1,91,TRUE,0,86,FALSE,1,78,TRUE,1,93,FALSE,0,81,FALSE,0,100,0,0.0324,0.7744,0,1,0.7225,0.0225,0,1,0.8464,0.0049,0.0225,0.0625,0.0289,0.6241,0.5776,0.1089,0,0.7396,0.6084,0.6241,0.7056,0.04,0.0441,0.0484,0.0081,0.6561,1,0,1,0.0484,1,0.412271429,0.358628571,0.465914286,24,75,17,53.13,5,62.5,4,50,4,50,4,50,8,50,9,56.25,87.62,83.75,81.38,91.38,94,87.44,87.81,21.87,34.49,21.25,31.38,41.38,44,37.44,31.56,0,1,2,1,3,0,2,0,3,0,3,1,0,1,2,2,0,2,2,1,0,0,1,0,2,1,0,1,3,0,1,3,2,1,2,1,0,0,1,0,1.4,1,1.4,1.4,0.6,1,1.8,0.4,1.3,0.95,1.125,5.33,2,3.5,0.8,0,-0.4,1,0.133333333,3,1,6,0,3.33,2,1,1,1,-1,1,-1,1,-1,1,-1,2,10 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),36,N/A,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,8,3,7,4,2,9,5,1,6,4,3,2,1 +389,R_6SITLWWJmtAriTQ,67 - 73,American,,American,Female,Agree,Agree,Agree,Somewhat disagree,Agree,1,2,4,5,3,Disagree,Disagree,Strongly agree,Disagree,Somewhat agree,3,1,2,4,5,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,4,5,3,2,1,Agree,Agree,Agree,Agree,Agree,1,4,2,3,5,Agree,Agree,Agree,Disagree,Agree,5,1,2,4,3,0,Disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,3,2,5,1,4,0,Agree,Agree,Agree,Somewhat Disagree,Agree,4,2,3,5,1,0,Agree,Agree,Agree,Agree,Agree,4,3,1,2,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat disagree,Agree,5,1,2,4,3,0,Disagree,Disagree,Agree,Disagree,Agree,3,4,5,1,2,0,Agree,Agree,Agree,Somewhat Disagree,Agree,4,1,3,5,2,0,Agree,Agree,Agree,Agree,Agree,3,1,2,4,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,100,TRUE,81,TRUE,81,TRUE,100,TRUE,83,FALSE,92,FALSE,82,FALSE,100,FALSE,100,TRUE,84,TRUE,100,FALSE,100,TRUE,100,FALSE,82,TRUE,100,TRUE,100,TRUE,100,FALSE,73,TRUE,100,FALSE,78,FALSE,70,TRUE,100,FALSE,73,TRUE,76,FALSE,77,FALSE,100,TRUE,100,TRUE,98,13,2,2,2,-1,2,-2,-2,3,-2,1,2,2,2,-1,3,2,2,2,2,2,2,2,2,-2,2,0,-2,-1,2,-1,2,0,2,2,2,-1,2,0,2,2,2,2,2,0,2,2,2,-1,2,0,-2,-2,2,-2,2,0,2,2,2,-1,2,0,2,2,2,2,2,0,TRUE,0,98,TRUE,1,100,FALSE,1,100,FALSE,1,77,TRUE,1,76,FALSE,1,73,TRUE,1,100,FALSE,0,70,FALSE,0,78,TRUE,1,100,FALSE,1,73,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,82,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,84,FALSE,1,100,FALSE,0,100,FALSE,0,82,FALSE,1,92,TRUE,1,83,TRUE,0,100,TRUE,1,81,TRUE,0,81,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,52,TRUE,1,100,0.49,0.0361,0,0,0,0.0729,0.0289,0,0,0.6724,0,0,0.6084,0.0729,0.0576,0,0.0064,0.0529,1,1,1,0.6724,0.7056,1,0,0.6561,0.2704,0.9604,0,1,0,1,0.387046429,0.112314286,0.661778571,13,40.63,18,56.25,3,37.5,7,87.5,3,37.5,5,62.5,10,62.5,8,50,90.06,78.38,92.62,95.12,94.12,87.75,92.38,-15.62,33.81,40.88,5.12,57.62,31.62,25.25,42.38,0,0,0,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0.2,0.8,0.2,0,0,0.4,0.2,0,0.3,0.15,0.225,0,0,0,0.2,0.4,0,0,0.2,0,0,0,0,0,1,-1,-1,-2,2,0,0,-1,1,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,The survey was good.,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,5,7,8,4,9,3,2,1,6,3,2,4,1 +390,R_1L13XK3l1GnM7R3,60 - 66,,Canadian,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,1,4,2,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,4,2,1,5,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,4,3,1,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,5,1,3,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,2,4,5,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,1,5,4,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,2,4,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Somewhat disagree,4,1,5,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,2,1,4,3,5,4,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,2,1,3,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,5,3,4,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,TRUE,98,TRUE,86,TRUE,100,TRUE,63,TRUE,100,TRUE,86,TRUE,92,FALSE,56,TRUE,62,FALSE,100,TRUE,90,TRUE,75,TRUE,100,TRUE,91,TRUE,96,TRUE,77,FALSE,63,TRUE,67,TRUE,97,TRUE,69,TRUE,81,FALSE,66,TRUE,85,FALSE,55,FALSE,90,FALSE,67,FALSE,77,TRUE,95,FALSE,71,TRUE,67,18,0,0,0,-1,0,0,0,1,0,1,0,3,3,0,3,0,0,1,0,-1,1,0,1,1,1,6,0,0,0,0,0,5,0,3,3,0,3,5,0,1,0,0,-1,6,0,0,0,-2,-1,5,0,0,0,-1,0,4,0,3,3,0,3,5,0,-1,0,-1,-2,5,TRUE,0,67,FALSE,0,71,TRUE,0,95,FALSE,1,77,FALSE,0,67,FALSE,1,90,FALSE,0,55,TRUE,1,85,FALSE,0,66,TRUE,1,81,TRUE,0,69,TRUE,0,97,TRUE,1,67,FALSE,1,63,TRUE,1,77,TRUE,1,96,TRUE,0,91,TRUE,0,100,TRUE,0,75,TRUE,0,90,FALSE,0,100,TRUE,1,62,FALSE,1,56,TRUE,1,92,TRUE,0,86,TRUE,1,100,TRUE,0,63,TRUE,0,100,TRUE,0,86,TRUE,1,98,FALSE,0,51,TRUE,1,100,0.0225,0,0.0016,0.3025,0,0.01,0.0064,0.0361,0.81,0.1444,0.0004,0.1089,0.4356,0.4761,0.4489,0.5041,0.1936,0.0529,1,0.7396,1,0.0529,0.5625,0.1369,0.8281,0.3969,0.2601,0.4489,0.9025,1,0.7396,0.9409,0.437010714,0.230528571,0.643492857,18,56.25,14,43.75,2,25,4,50,4,50,4,50,10,62.5,4,25,80.41,68.62,82.12,76.75,94.12,79.25,81.56,12.5,36.66,43.62,32.12,26.75,44.12,16.75,56.56,1,0,1,2,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0.4,0,0.4,0.4,0.6,0,0.8,0.45,0.45,0.45,5.33,4.67,5.125,0.6,-0.2,0,-0.4,0.133333333,1,1,0,1,0.66,1,1,1,-1,1,1,-1,0,0,0,0,1,10 cents,5 minutes,47 days,Female,High School (or equivalent),61,,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,6,3,8,5,9,4,1,7,4,3,2,1 +391,R_1JquTUde1fPhKN1,53 - 59,American,,American,Female,Agree,Strongly agree,Strongly agree,Agree,Agree,5,2,3,1,4,Somewhat disagree,Somewhat disagree,Disagree,Strongly disagree,Somewhat agree,3,4,2,5,1,Somewhat Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,4,2,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,2,3,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,Neither agree nor disagree,2,3,5,1,4,3,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,4,2,3,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,1,4,5,Disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,Agree,5,2,4,3,1,2,Somewhat Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,3,4,1,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,TRUE,99,TRUE,75,TRUE,95,FALSE,85,TRUE,77,TRUE,69,FALSE,100,TRUE,89,FALSE,100,TRUE,97,FALSE,92,FALSE,100,FALSE,78,TRUE,92,TRUE,87,TRUE,90,TRUE,74,FALSE,93,TRUE,87,TRUE,86,FALSE,100,TRUE,96,TRUE,84,TRUE,100,FALSE,83,FALSE,98,TRUE,98,TRUE,55,FALSE,100,TRUE,98,TRUE,80,23,2,3,3,2,2,-1,-1,-2,-3,1,-1,-3,3,-3,3,0,-1,1,0,1,3,3,3,3,3,1,-1,-1,-1,-3,0,4,0,-3,3,-3,3,3,0,1,0,0,0,5,3,3,3,3,3,7,-2,-1,-1,-3,2,5,-1,-3,3,-3,3,2,0,0,0,0,0,7,TRUE,0,80,TRUE,1,98,FALSE,1,100,TRUE,0,55,TRUE,1,98,FALSE,1,98,FALSE,0,83,TRUE,1,100,TRUE,1,84,TRUE,1,96,FALSE,1,100,TRUE,0,86,TRUE,1,87,FALSE,1,93,TRUE,1,74,TRUE,1,90,TRUE,0,87,TRUE,0,92,FALSE,1,78,FALSE,1,100,FALSE,0,92,TRUE,1,97,FALSE,1,100,TRUE,1,89,FALSE,1,100,TRUE,1,69,TRUE,0,77,FALSE,1,85,TRUE,0,95,TRUE,1,75,TRUE,1,99,TRUE,1,99,0,0.0961,0.01,0.6889,0.0001,0.0004,0.0121,0.0016,0,0.0009,0.0625,0.0169,0.0256,0,0.0004,0.0004,0,0.3025,0.0225,0,0.8464,0.0676,0.0484,0.0049,0.7569,0.5929,0.0001,0.64,0,0.8464,0.9025,0.7396,0.210414286,0.030242857,0.390585714,23,71.88,23,71.88,6,75,5,62.5,5,62.5,7,87.5,14,87.5,9,56.25,89.25,83.12,94.5,88.75,90.62,89.38,89.12,0,17.37,8.12,32,26.25,3.12,1.88,32.87,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,1,1,0,1,0.6,0.4,0.2,0.8,0.6,0.6,0,0.6,0.5,0.45,0.475,2.67,4.67,4.25,0,-0.2,0.2,0.2,0,-6,-1,1,-2,-2,0,1,2,-2,2,-1,1,0,0,-1,1,1,10 cents,100 minutes,15 days,Female,University - Graduate (Masters),53,,1,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,6,4,9,3,5,7,2,1,8,2,3,4,1 +392,R_5HoRkWGs8yCWtI1,53 - 59,American,,American,Male,Disagree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,2,3,5,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Somewhat agree,2,1,3,4,5,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,4,2,3,1,Strongly disagree,Strongly Agree,Strongly Agree,Agree,Disagree,4,2,5,3,1,10,Strongly disagree,Somewhat agree,Agree,Strongly disagree,Strongly disagree,2,4,5,1,3,8,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,1,5,3,4,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,5,2,2,Agree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,10,Neither Agree nor Disagree,Agree,Agree,Agree,Agree,1,3,5,2,4,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,1,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,FALSE,99,FALSE,86,TRUE,100,TRUE,87,TRUE,100,TRUE,100,FALSE,64,FALSE,77,FALSE,66,FALSE,100,FALSE,100,TRUE,73,TRUE,100,FALSE,100,TRUE,91,FALSE,100,FALSE,100,FALSE,72,TRUE,98,FALSE,100,TRUE,100,TRUE,86,FALSE,82,FALSE,100,FALSE,99,FALSE,100,TRUE,69,FALSE,99,FALSE,71,TRUE,100,21,-2,3,3,2,3,1,0,3,-1,1,-2,3,3,3,2,0,0,2,0,2,-3,3,3,2,-2,10,-3,1,2,-3,-3,8,1,1,0,1,0,2,1,-1,0,0,1,5,-3,3,3,3,3,2,2,-1,2,0,0,10,0,2,2,2,2,4,3,3,3,3,3,9,TRUE,0,100,FALSE,0,71,FALSE,1,99,TRUE,0,69,FALSE,0,100,FALSE,1,99,FALSE,0,100,FALSE,0,82,TRUE,1,86,TRUE,1,100,FALSE,1,100,TRUE,0,98,FALSE,0,72,FALSE,1,100,FALSE,0,100,TRUE,1,91,FALSE,1,100,TRUE,0,100,TRUE,0,73,FALSE,1,100,FALSE,0,100,FALSE,0,66,FALSE,1,77,FALSE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,FALSE,1,86,FALSE,0,99,FALSE,0,100,TRUE,1,100,0.6724,0,0.0081,1,0,0.0001,0.4096,0,0,0.4356,0.9801,0.5184,0.0196,0,1,0.5041,0.0529,0.4761,1,1,1,1,0.5329,0,0,0.7569,1,1,0.0001,1,0.0196,0.9604,0.488085714,0.314035714,0.662135714,21,65.63,13,40.63,2,25,5,62.5,3,37.5,3,37.5,5,31.25,8,50,91.22,85.75,91.75,95.75,91.62,89.44,93,25,50.59,60.75,29.25,58.25,54.12,58.19,43,1,0,0,0,5,4,1,1,2,4,3,2,3,2,2,1,1,2,0,1,1,0,0,1,0,1,1,1,1,1,2,1,1,1,0,3,3,1,3,1,1.2,2.4,2.4,1,0.4,1,1,2.2,1.75,1.15,1.45,6.67,5.33,6.25,0.8,1.4,1.4,-1.2,1.2,8,-2,-2,-4,1.34,0,2,0,2,-2,2,-2,2,-2,1,-1,0,10 cents,75 minutes,47 days,Male,High School (or equivalent),56,it was to long and it was not good to me ,-0.625,0,0,1,1,0,0,0.33,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,8,5,6,3,2,9,7,1,4,4,2,3,1 +393,R_5rNELR6ehTmOSux,39 - 45,American,,American,Female,Neither agree nor disagree,Agree,Strongly agree,Agree,Strongly agree,1,4,5,3,2,Disagree,Agree,Neither agree nor disagree,Agree,Agree,2,3,1,5,4,Disagree,Strongly Disagree,Agree,Neither Agree nor Disagree,Agree,3,5,2,4,1,Strongly disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Strongly Agree,3,2,5,1,4,6,Disagree,Somewhat agree,Agree,Somewhat agree,Agree,4,5,2,3,1,5,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,3,1,2,7,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Agree,Agree,4,2,5,1,3,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,5,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Somewhat Agree,Agree,3,5,1,4,2,8,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,2,5,TRUE,90,TRUE,73,FALSE,100,FALSE,50,TRUE,99,FALSE,100,TRUE,96,TRUE,100,TRUE,91,TRUE,99,FALSE,50,TRUE,93,TRUE,97,TRUE,83,TRUE,50,TRUE,100,FALSE,50,TRUE,94,TRUE,82,FALSE,62,TRUE,76,TRUE,100,FALSE,100,FALSE,68,FALSE,100,TRUE,80,TRUE,59,FALSE,60,TRUE,72,TRUE,77,FALSE,58,TRUE,93,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,2,3,2,3,-2,2,0,2,2,-2,-3,2,0,2,-3,-3,-3,0,-3,2,2,2,2,3,5,-2,1,2,1,2,6,0,-3,3,0,0,5,-1,-1,0,1,-2,7,2,2,2,2,2,6,0,0,1,-1,1,6,0,-3,3,1,2,5,1,0,1,1,0,8,TRUE,0,90,TRUE,1,73,FALSE,1,100,FALSE,1,50,TRUE,1,99,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,1,91,TRUE,1,99,FALSE,1,50,TRUE,0,93,TRUE,1,97,TRUE,0,83,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,94,TRUE,0,82,FALSE,1,62,TRUE,1,76,TRUE,1,100,FALSE,1,100,FALSE,0,68,FALSE,1,100,TRUE,1,80,TRUE,0,59,FALSE,1,60,TRUE,0,72,TRUE,1,77,FALSE,0,58,TRUE,1,93,0,0.04,0,0.0016,0.0049,0,0.4624,0.0001,0.1444,0,0.0529,0.0009,0.0081,0.25,0.0001,0.0729,0,0.25,0.16,0,0.0576,0.25,0.6724,0.6889,0.25,0.3481,0.3364,0.81,0,0.8836,0.5184,0.8649,0.253107143,0.08905,0.417164286,23,71.88,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,81.31,64.12,85.88,92.75,82.5,84.81,77.81,0,9.43,1.62,-1.62,30.25,7.5,-2.69,21.56,2,0,1,0,0,0,1,2,1,0,2,0,1,0,2,2,2,3,1,1,2,0,1,0,1,2,2,1,3,1,2,0,1,1,0,4,3,4,1,3,0.6,0.8,1,1.8,0.8,1.8,0.8,3,1.05,1.6,1.325,5.33,5.67,6,-0.2,-1,0.2,-1.2,-0.333333333,-1,0,0,-1,-0.34,1,1,1,-1,1,0,0,-1,1,-1,1,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,39,,0.75,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,3,9,7,6,8,4,2,1,5,4,2,3,1 +394,R_3stWU9kNbJvpNuW,39 - 45,American,,American,Female,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,5,4,2,3,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,4,5,3,2,1,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly Agree,3,2,5,4,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,1,3,2,5,4,5,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,3,1,4,5,5,Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,5,4,3,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,5,3,2,1,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,4,2,3,1,5,5,Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,2,3,1,4,5,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,1,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,98,TRUE,100,TRUE,87,TRUE,100,TRUE,100,TRUE,100,TRUE,77,FALSE,100,TRUE,100,FALSE,70,FALSE,50,FALSE,50,TRUE,100,TRUE,81,TRUE,96,TRUE,98,FALSE,100,TRUE,67,TRUE,86,FALSE,50,TRUE,95,FALSE,76,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,96,TRUE,100,TRUE,100,16,2,3,2,1,3,0,1,3,1,1,1,-1,2,-1,3,0,1,1,1,0,2,3,2,1,3,7,2,0,3,0,1,5,2,-1,3,-1,3,5,0,1,1,0,0,5,2,3,2,2,3,5,0,1,3,1,0,5,2,0,1,-3,3,5,0,1,0,1,-1,6,TRUE,0,100,TRUE,1,100,TRUE,0,96,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,76,TRUE,1,95,FALSE,1,50,TRUE,0,86,TRUE,1,67,FALSE,1,100,TRUE,1,98,TRUE,1,96,TRUE,0,81,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,70,TRUE,1,100,FALSE,1,100,TRUE,1,77,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,87,TRUE,0,100,TRUE,1,98,FALSE,0,50,TRUE,1,100,0,0,0.0016,0,0,0,0.0529,0.0025,0.25,0,0.0004,0.1089,0.5776,0.25,0,0,0,0.25,0.7569,1,0.49,0.0004,0.25,0,0.6561,1,0.25,1,0.9216,1,1,0.7396,0.377032143,0.106592857,0.647471429,16,50,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,13,81.25,7,43.75,86.78,71.75,89.75,99.38,86.25,89.19,84.38,-12.5,24.28,9.25,27.25,36.88,23.75,7.94,40.63,0,0,0,0,0,2,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,2,0,0,0,1,0,1,0,0.8,0.4,0.2,0.2,0.2,1,0.4,0.35,0.45,0.4,5.67,5,5.375,-0.2,0.6,-0.6,-0.2,-0.066666667,2,0,0,-1,0.67,0,2,1,-2,2,0,0,-1,1,-2,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,44,I want to know what the right answers were ,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,9,3,4,6,8,2,7,1,5,2,4,3,1 +395,R_6ogKWHZARE6wFR9,53 - 59,American,,American,Male,Agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,1,3,2,5,4,Disagree,Disagree,Agree,Somewhat agree,Somewhat disagree,1,5,4,3,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,3,2,4,5,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Agree,Somewhat agree,Disagree,4,3,2,5,1,8,Disagree,Disagree,Agree,Agree,Somewhat disagree,2,5,3,4,1,3,Agree,Agree,Agree,Somewhat Agree,Agree,1,5,4,3,2,2,Disagree,Somewhat disagree,Disagree,Disagree,Disagree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,5,4,2,3,1,2,Disagree,Disagree,Agree,Somewhat agree,Somewhat agree,3,2,1,4,5,2,Somewhat Agree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Agree,1,2,5,3,4,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Disagree,4,5,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,93,TRUE,100,TRUE,97,FALSE,99,TRUE,56,TRUE,96,FALSE,97,TRUE,92,FALSE,100,TRUE,85,TRUE,70,FALSE,100,TRUE,76,FALSE,87,FALSE,90,TRUE,100,FALSE,50,TRUE,60,FALSE,55,FALSE,93,FALSE,82,TRUE,92,TRUE,97,TRUE,79,TRUE,81,FALSE,82,TRUE,79,FALSE,65,TRUE,81,TRUE,92,TRUE,81,26,2,1,3,1,-1,-2,-2,2,1,-1,1,1,2,1,2,-1,-2,1,1,-1,2,1,2,1,-2,4,-2,-2,2,2,-1,8,2,2,2,1,2,3,-2,-1,-2,-2,-2,2,2,1,2,2,-1,2,-2,-2,2,1,1,2,1,-1,3,-1,2,2,-1,-1,1,-1,-2,7,TRUE,0,81,TRUE,1,92,TRUE,0,81,FALSE,1,65,TRUE,1,79,FALSE,1,82,TRUE,1,81,TRUE,1,79,TRUE,1,97,TRUE,1,92,FALSE,1,82,FALSE,1,93,FALSE,0,55,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,90,FALSE,1,87,TRUE,0,76,FALSE,1,100,TRUE,1,70,TRUE,1,85,FALSE,1,100,TRUE,1,92,FALSE,1,97,TRUE,1,96,TRUE,0,56,FALSE,1,99,TRUE,0,97,TRUE,1,100,FALSE,0,93,TRUE,1,100,0.0441,0.0016,0,0.0361,0,0.0324,0.0064,0.0064,0,0.0225,0,0.3025,0.0009,0.0324,0.0441,0.0064,0,0.1225,0.0001,0.0009,0.09,0.25,0.5776,0.36,0.01,0.3136,0.8649,0.6561,0.6561,0.0169,0.9409,0.0049,0.189946429,0.041178571,0.338714286,26,81.25,23,71.88,4,50,6,75,6,75,7,87.5,13,81.25,10,62.5,84.59,76.38,84.12,84.88,93,85.06,84.12,9.37,12.71,26.38,9.12,9.88,5.5,3.81,21.62,0,0,1,0,1,0,0,0,1,0,1,1,0,0,0,1,1,3,3,1,0,0,1,1,0,0,0,0,0,2,0,2,1,2,0,0,1,0,2,1,0.4,0.2,0.4,1.8,0.4,0.4,1,0.8,0.7,0.65,0.675,5,2,3.75,0,-0.2,-0.6,1,-0.266666667,2,6,1,-5,3,2,2,1,-2,2,-1,1,-1,1,-2,2,-1,5 cents,5 minutes,47 days,Male,Trade School (non-military),57,,1.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,5,6,8,7,9,3,2,1,4,3,4,2,1 +396,R_3FCIkOBSK5YMuPo,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,1,3,5,4,2,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat disagree,4,3,2,1,5,Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,3,1,2,4,5,Strongly disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,1,3,2,4,5,1,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,2,1,5,4,3,1,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,4,3,5,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,1,3,4,5,2,2,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,4,5,2,1,3,1,Agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,3,5,2,1,4,7,Agree,Agree,Agree,Somewhat agree,Agree,1,3,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,58,TRUE,79,FALSE,100,TRUE,100,TRUE,78,TRUE,95,TRUE,83,FALSE,100,TRUE,96,FALSE,78,FALSE,67,TRUE,100,FALSE,59,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,60,TRUE,100,TRUE,100,FALSE,97,TRUE,100,FALSE,60,FALSE,100,TRUE,100,TRUE,100,24,3,3,3,1,-1,-3,-3,1,-3,-1,2,3,3,-2,3,-3,-2,-1,-1,-1,3,3,3,1,-1,0,-3,-3,1,-3,-3,1,2,3,3,-1,3,1,-3,-3,-3,-3,-3,1,3,3,3,1,-1,1,-3,-3,1,-3,0,2,2,3,3,-1,3,1,2,2,2,1,2,7,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,97,TRUE,1,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,FALSE,0,59,TRUE,1,100,FALSE,1,67,FALSE,1,78,TRUE,0,96,FALSE,1,100,TRUE,1,83,TRUE,1,95,TRUE,0,78,TRUE,1,100,FALSE,1,100,TRUE,1,79,FALSE,1,58,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0.0441,0,0,0,0.0009,0,0,0,0.0025,1,1,0.36,0,0,0,0.6084,0.16,0,0,0.0289,0.3481,0.9216,1,0.1089,0.1764,0,1,0,0.0484,1,1,0.313003571,0.2237,0.402307143,24,75,22,68.75,5,62.5,5,62.5,6,75,6,75,12,75,10,62.5,90.94,79.12,90.62,94,100,92.25,89.62,6.25,22.19,16.62,28.12,19,25,17.25,27.12,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,1,2,2,2,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,5,4,3,2,3,0,0.4,0.2,1.4,0,0.2,0.2,3.4,0.5,0.95,0.725,0.67,1.33,1.75,0,0.2,0,-2,0.066666667,-1,-1,0,-6,-0.66,1,1,1,-2,2,1,-1,-1,1,-1,1,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,68,I really don't like this survey.,0.625,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,3,2,7,9,4,5,6,1,8,4,3,2,1 +397,R_35HGnysLLLV4m2Z,25 - 31,American,,American,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,3,2,1,Agree,Disagree,Agree,Disagree,Agree,5,4,1,2,3,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,1,3,5,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,3,2,5,1,4,7,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,4,1,5,2,3,8,Disagree,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Disagree,2,5,3,1,4,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,3,Agree,Agree,Somewhat Agree,Agree,Agree,5,2,1,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,5,3,2,4,FALSE,90,TRUE,92,TRUE,84,FALSE,78,TRUE,85,FALSE,98,TRUE,88,TRUE,93,TRUE,78,TRUE,83,FALSE,76,FALSE,67,FALSE,86,TRUE,88,TRUE,80,TRUE,82,FALSE,77,FALSE,56,FALSE,75,FALSE,66,FALSE,66,TRUE,77,TRUE,66,TRUE,85,TRUE,88,TRUE,90,FALSE,62,FALSE,81,TRUE,84,TRUE,86,FALSE,76,TRUE,87,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,1,1,2,-2,2,-2,2,1,1,2,2,2,0,1,1,1,1,-2,1,1,-1,2,7,2,1,-1,1,2,7,-2,-1,1,2,-1,8,0,1,1,1,1,5,0,1,1,1,1,4,0,0,2,0,0,5,2,2,1,2,2,3,0,0,0,0,1,5,FALSE,1,90,TRUE,1,92,TRUE,0,84,FALSE,1,78,TRUE,1,85,FALSE,1,98,TRUE,1,88,TRUE,1,93,TRUE,1,78,TRUE,1,83,FALSE,1,76,FALSE,1,67,FALSE,0,86,TRUE,0,88,TRUE,1,80,TRUE,1,82,FALSE,1,77,FALSE,1,56,FALSE,1,75,FALSE,1,66,FALSE,0,66,TRUE,1,77,TRUE,0,66,TRUE,1,85,TRUE,0,88,TRUE,1,90,FALSE,1,62,FALSE,1,81,TRUE,0,84,TRUE,1,86,FALSE,0,76,TRUE,1,87,0.0049,0.01,0.0324,0.0144,0.0169,0.0004,0.0225,0.0289,0.1156,0.0529,0.0196,0.7396,0.0484,0.0576,0.0225,0.0064,0.4356,0.0484,0.0361,0.7744,0.4356,0.04,0.0625,0.7744,0.0529,0.1444,0.5776,0.01,0.7056,0.1936,0.7056,0.1089,0.222746429,0.115378571,0.330114286,21,65.63,24,75,7,87.5,4,50,6,75,7,87.5,13,81.25,11,68.75,80.31,77.12,81.12,82.5,80.5,83.38,77.25,-9.37,5.31,-10.38,31.12,7.5,-7,2.13,8.5,3,0,0,2,1,0,3,3,3,0,3,2,1,0,3,0,0,0,0,0,1,0,0,0,0,2,2,0,2,2,1,1,1,0,0,0,1,1,1,0,1.2,1.8,1.8,0,0.2,1.6,0.6,0.6,1.2,0.75,0.975,7.33,4,5.5,1,0.2,1.2,-0.6,0.8,3,2,5,0,3.33,1,1,1,-1,1,0,0,-1,1,-1,1,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,26,its interesting thank you,0.875,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,5,8,4,9,7,2,3,1,6,4,3,2,1 +398,R_3fkKyOckODVypDZ,53 - 59,American,,American,Male,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,3,4,2,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,1,5,2,3,4,Somewhat Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Neither Agree nor Disagree,2,5,3,4,1,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,1,3,5,Strongly disagree,Agree,Agree,Somewhat disagree,Disagree,5,4,1,3,2,6,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,Somewhat Disagree,4,3,2,1,5,8,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,5,Strongly disagree,Somewhat agree,Agree,Disagree,Disagree,3,4,2,5,1,6,Somewhat Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Disagree,5,3,1,4,2,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,TRUE,50,TRUE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,50,TRUE,52,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,83,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,57,TRUE,100,TRUE,50,TRUE,67,TRUE,50,TRUE,61,FALSE,100,TRUE,100,TRUE,100,TRUE,100,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,1,1,1,-3,1,2,-1,0,-1,0,2,-3,0,0,1,0,0,-1,2,-1,1,1,1,5,-3,2,2,-1,-2,5,0,2,1,2,-1,6,-1,-1,0,-1,0,8,2,2,2,2,2,5,-3,1,2,-2,-2,5,-1,0,2,-3,-2,6,0,0,1,0,0,8,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,52,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,83,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,57,TRUE,1,100,TRUE,0,50,TRUE,1,67,TRUE,0,50,TRUE,0,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.1089,0,0.2304,0,0.25,0,0,0,0,0,0,0,0,0.25,0.25,0.3249,0.25,0.3721,0.25,0.25,0.25,1,0,0,0.25,0,0.25,0,1,0,0.6889,0.201282143,0.094635714,0.307928571,13,40.63,22,68.75,5,62.5,6,75,5,62.5,6,75,14,87.5,8,50,80.31,75,75.88,77.38,93,82.44,78.19,-28.12,11.56,12.5,0.88,14.88,18,-5.06,28.19,0,1,0,0,0,0,1,0,0,2,1,2,1,5,1,1,2,0,1,1,0,2,1,1,1,0,0,0,1,2,0,0,0,0,2,0,1,1,0,1,0.2,0.6,2,1,1,0.6,0.4,0.6,0.95,0.65,0.8,5.33,5.33,6,-0.8,0,1.6,0.4,0.266666667,0,0,0,0,0,0,1,1,-1,1,1,-1,0,0,0,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,2,6,5,4,7,9,8,1,3,4,2,3,1 +399,R_6jizLscD9XqNAo9,39 - 45,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Somewhat agree,3,4,2,5,1,Agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,1,2,5,4,Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,2,4,1,5,3,Strongly Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,1,3,5,4,6,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,Strongly agree,1,4,3,2,5,9,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,2,3,1,4,5,10,Agree,Somewhat agree,Agree,Agree,Strongly Agree,2,4,1,5,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,5,4,3,2,1,6,Strongly agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,4,3,2,5,1,9,Strongly Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,4,1,5,3,2,8,Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,3,1,2,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,TRUE,83,TRUE,91,FALSE,63,TRUE,84,FALSE,79,TRUE,85,FALSE,86,FALSE,72,FALSE,80,FALSE,72,FALSE,68,TRUE,90,FALSE,72,TRUE,91,FALSE,72,FALSE,70,FALSE,80,FALSE,85,FALSE,65,TRUE,100,FALSE,72,FALSE,81,TRUE,69,TRUE,87,FALSE,69,FALSE,86,FALSE,71,TRUE,92,TRUE,100,FALSE,76,TRUE,93,19,3,3,2,2,1,2,3,2,0,1,3,1,2,1,2,2,3,1,2,3,3,2,2,1,1,6,0,3,2,1,3,9,1,0,0,1,2,10,2,1,2,2,3,7,2,3,3,2,1,6,3,2,1,2,0,9,3,0,2,2,1,8,2,2,3,1,1,7,TRUE,0,93,FALSE,0,76,TRUE,0,100,TRUE,0,92,FALSE,0,71,FALSE,1,86,FALSE,0,69,TRUE,1,87,TRUE,1,69,FALSE,0,81,FALSE,1,72,TRUE,0,100,FALSE,0,65,FALSE,1,85,FALSE,0,80,FALSE,0,70,FALSE,1,72,TRUE,0,91,FALSE,1,72,TRUE,0,90,FALSE,0,68,FALSE,0,72,FALSE,1,80,FALSE,0,72,FALSE,1,86,TRUE,1,85,FALSE,1,79,TRUE,0,84,FALSE,1,63,TRUE,1,91,TRUE,1,83,TRUE,1,85,0.0169,0.0225,0.49,0.4761,0.0225,0.0196,0.5184,0.6561,0.81,0.5184,0.0081,0.4225,0.0961,0.0784,0.5041,0.5776,0.04,0.8464,0.7056,0.0196,0.4624,0.64,0.0784,0.0225,0.0784,0.0441,0.0289,0.8649,1,0.8281,0.1369,1,0.393857143,0.365585714,0.422128571,19,59.38,15,46.88,5,62.5,5,62.5,3,37.5,2,25,6,37.5,9,56.25,80.28,77.88,73.75,82.75,86.75,76.5,84.06,12.5,33.4,15.38,11.25,45.25,61.75,39,27.81,0,1,0,1,0,2,0,0,1,2,2,1,2,0,0,0,2,1,0,0,1,0,1,0,0,1,1,1,2,1,0,1,0,1,1,0,1,2,1,2,0.4,1,1,0.6,0.4,1.2,0.6,1.2,0.75,0.85,0.8,8.33,7.67,7.75,0,-0.2,0.4,-0.6,0.066666667,0,0,2,0,0.66,0,0,0,0,0,2,-2,1,-1,1,-1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),40,,-0.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,3,4,2,7,8,6,5,1,9,3,2,4,1 +400,R_7G0P5PING61jNop,32 - 38,,Canadian,Canadian,Male,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,4,1,5,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Disagree,Somewhat Agree,3,5,4,1,2,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,1,5,2,4,3,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat disagree,2,3,4,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,5,1,5,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Agree,3,5,4,2,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,4,3,2,1,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,5,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Disagree,Agree,4,5,1,2,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,78,FALSE,50,TRUE,65,FALSE,50,FALSE,50,FALSE,57,FALSE,50,TRUE,90,TRUE,80,TRUE,75,FALSE,50,TRUE,85,FALSE,50,FALSE,93,FALSE,50,FALSE,50,FALSE,50,TRUE,78,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,73,TRUE,77,FALSE,50,FALSE,50,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,1,-1,-1,-1,0,0,0,0,0,-1,0,-2,1,0,-1,-1,0,-1,2,0,2,-1,-1,3,0,0,0,0,0,5,0,-1,0,-1,2,2,0,0,0,0,0,7,2,0,2,-1,0,2,-1,0,0,0,0,5,0,-1,0,-2,2,2,0,0,0,0,-1,5,FALSE,1,78,FALSE,0,50,TRUE,0,65,FALSE,1,50,FALSE,0,50,FALSE,1,57,FALSE,0,50,TRUE,1,90,TRUE,1,80,TRUE,1,75,FALSE,1,50,TRUE,0,85,FALSE,0,50,FALSE,1,93,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,78,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,73,TRUE,1,77,FALSE,0,50,FALSE,0,50,0.01,0.25,0.25,0.25,0.25,0.1849,0.25,0.0625,0.25,0.25,0.0529,0.25,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.0049,0.25,0.25,0.25,0.0484,0.4225,0.6084,0.5329,0.7225,0.256425,0.202878571,0.309971429,16,50,16,50,5,62.5,3,37.5,4,50,4,50,4,25,12,75,59.41,53.75,53.75,65.5,64.62,57.62,61.19,0,9.41,-8.75,16.25,15.5,14.62,32.62,-13.81,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0.2,0.2,0.4,0.6,0.4,0,0.2,0.4,0.35,0.25,0.3,3.33,3,3.875,-0.2,0.2,0.2,0.2,0.066666667,1,0,0,2,0.33,1,1,1,-2,2,0,0,0,0,-1,1,0,10 cents,5 minutes,36 days,Male,College Diploma/Certificate,37,Nothing really comes to mind.,0.75,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,5,3,4,2,9,8,6,1,7,4,3,2,1 +401,R_1QRtJlPZGiqAiX7,53 - 59,American,,American,Male,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,1,4,5,3,Disagree,Disagree,Somewhat agree,Disagree,Agree,4,1,5,3,2,Agree,Agree,Agree,Strongly Disagree,Strongly Agree,1,5,3,4,2,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,2,1,3,Somewhat agree,Agree,Agree,Agree,Agree,3,4,1,2,5,1,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,1,3,4,2,9,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,5,2,4,3,3,Disagree,Disagree,Disagree,Disagree,Disagree,4,1,3,2,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Agree,Agree,1,3,4,2,5,8,Somewhat disagree,Disagree,Agree,Disagree,Agree,2,4,5,3,1,7,Agree,Agree,Agree,Strongly Disagree,Strongly Agree,2,4,5,1,3,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,2,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,91,TRUE,91,FALSE,50,FALSE,50,FALSE,92,TRUE,91,TRUE,88,TRUE,61,TRUE,75,FALSE,94,FALSE,69,TRUE,58,TRUE,85,TRUE,50,TRUE,87,FALSE,50,TRUE,85,TRUE,83,FALSE,50,TRUE,59,TRUE,74,TRUE,65,TRUE,50,FALSE,61,TRUE,86,TRUE,50,FALSE,50,TRUE,71,TRUE,73,TRUE,84,TRUE,92,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,2,1,-2,-2,1,-2,2,2,2,2,-3,3,1,1,2,2,1,1,2,2,2,2,1,1,1,-1,1,-1,9,1,1,1,-1,1,3,-2,-2,-2,-2,-2,9,1,2,2,2,2,8,-1,-2,2,-2,2,7,2,2,2,-3,3,1,1,-1,1,1,1,1,TRUE,0,100,TRUE,1,91,TRUE,0,91,FALSE,1,50,FALSE,0,50,FALSE,1,92,TRUE,1,91,TRUE,1,88,TRUE,1,61,TRUE,1,75,FALSE,1,94,FALSE,1,69,TRUE,1,58,TRUE,0,85,TRUE,1,50,TRUE,1,87,FALSE,1,50,TRUE,0,85,TRUE,0,83,FALSE,1,50,TRUE,1,59,TRUE,1,74,TRUE,0,65,TRUE,1,50,FALSE,1,61,TRUE,1,86,TRUE,0,50,FALSE,1,50,TRUE,0,71,TRUE,1,73,TRUE,1,84,TRUE,1,92,0.0144,0.0196,0.0169,0.0081,0.0064,0.0064,0.25,0.0625,0.25,0.0676,0.0729,0.1764,0.1521,0.0036,0.25,0.0081,0.4225,0.25,0.25,0.1521,0.1681,0.25,0.6889,0.7225,0.25,0.25,0.0256,1,0.8281,0.7225,0.5041,0.0961,0.281660714,0.141321429,0.422,25,78.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,15,93.75,8,50,72.34,70.38,67.12,82.12,69.75,73.06,71.62,6.25,0.46,-4.62,4.62,19.62,-17.75,-20.69,21.62,0,0,0,0,1,3,3,2,3,3,1,1,1,2,2,3,3,4,4,3,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,1,1,0,0.2,2.8,1.4,3.4,0.2,0.4,0,0.8,1.95,0.35,1.15,4.33,5.33,4.875,0,2.4,1.4,2.6,1.266666667,-7,2,2,8,-1,0,1,0,-1,1,1,-1,1,-1,-1,1,0,10 cents,100 minutes,36 days,Male,College Diploma/Certificate,58,I really have nothing to add,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,4,3,9,8,2,5,7,1,6,2,3,4,1 +402,R_1GeNRkyQ5YVBNQQ,39 - 45,American,,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,2,5,4,1,3,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,5,4,2,1,3,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,5,3,4,2,1,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Disagree,Disagree,Strongly disagree,Somewhat disagree,1,2,4,3,5,6,Somewhat disagree,Agree,Strongly disagree,Somewhat agree,Somewhat disagree,1,5,2,3,4,6,Somewhat Disagree,Disagree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,4,3,5,1,2,7,Neither agree nor disagree,Strongly disagree,Disagree,Somewhat disagree,Somewhat disagree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Strongly Agree,Somewhat agree,Agree,Agree,2,3,4,1,5,7,Somewhat agree,Disagree,Somewhat disagree,Disagree,Somewhat agree,3,1,2,4,5,6,Neither Agree nor Disagree,Somewhat Disagree,Disagree,Disagree,Disagree,2,4,5,1,3,6,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Somewhat agree,1,3,2,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,86,TRUE,64,TRUE,100,FALSE,71,TRUE,62,TRUE,77,TRUE,100,TRUE,61,TRUE,71,TRUE,66,TRUE,68,FALSE,74,TRUE,78,TRUE,66,FALSE,100,TRUE,100,TRUE,65,TRUE,74,TRUE,79,TRUE,65,TRUE,100,TRUE,82,TRUE,82,TRUE,79,TRUE,92,TRUE,69,TRUE,74,TRUE,77,TRUE,71,TRUE,68,TRUE,80,TRUE,63,25,2,3,3,1,2,2,-1,3,-1,1,1,2,1,-1,3,3,2,1,1,1,0,-2,-2,-3,-1,5,-1,2,-3,1,-1,6,-1,-2,-1,1,-3,6,0,-3,-2,-1,-1,7,1,3,1,2,2,9,1,-2,-1,-2,1,7,0,-1,-2,-2,-2,6,3,3,1,2,1,6,TRUE,0,63,TRUE,1,80,TRUE,0,68,TRUE,0,71,TRUE,1,77,TRUE,0,74,TRUE,1,69,TRUE,1,92,TRUE,1,79,TRUE,1,82,TRUE,0,82,TRUE,0,100,TRUE,1,65,TRUE,0,79,TRUE,1,74,TRUE,1,65,TRUE,0,100,FALSE,1,100,TRUE,0,66,TRUE,0,78,FALSE,0,74,TRUE,1,68,TRUE,0,66,TRUE,1,71,TRUE,0,61,TRUE,1,100,TRUE,0,77,TRUE,0,62,FALSE,1,71,TRUE,1,100,TRUE,1,64,TRUE,1,86,0.0064,0,0.1225,0.0961,0.0196,0.5476,0.0841,0.0324,0.6084,0.1024,0,0.1225,0.0441,0.6724,0.0529,0.04,0.4356,0.5041,0.3844,0.3721,0.5476,0.0676,0.4356,0.6241,1,0.5929,0.1296,0.3969,0.4624,0,0.0841,1,0.334407143,0.233292857,0.435521429,25,78.13,17,53.13,4,50,4,50,5,62.5,4,50,15,93.75,2,12.5,77,74.12,76.62,77.75,79.5,77.88,76.12,25,23.87,24.12,26.62,15.25,29.5,-15.87,63.62,2,5,5,4,3,3,3,6,2,2,2,4,2,2,6,3,5,3,2,2,1,0,2,1,0,1,1,4,1,0,1,3,3,1,5,0,1,0,1,0,3.8,3.2,3.2,3,0.8,1.4,2.6,0.4,3.3,1.3,2.3,5.67,7.33,6.5,3,1.8,0.6,2.6,1.8,-4,-1,0,1,-1.66,0,0,-1,-1,1,0,0,-1,1,-1,1,1,5 cents,100 minutes,24 days,Male,University - Undergraduate,43,Great survey,0.375,1,0,0,0,1,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,2,3,4,8,6,9,5,1,7,2,3,4,1 +403,R_5gP0vwAfPWywdOx,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,Disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,1,3,4,2,5,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,4,1,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,2,3,1,5,4,Agree,Agree,Agree,Agree,Agree,2,3,1,5,4,0,Disagree,Disagree,Agree,Disagree,Somewhat disagree,5,2,1,4,3,0,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,3,2,0,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,3,5,1,4,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,3,2,4,1,5,0,Disagree,Disagree,Agree,Disagree,Somewhat disagree,3,1,5,2,4,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,4,1,0,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,2,3,4,5,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,87,FALSE,50,FALSE,80,FALSE,50,TRUE,85,FALSE,94,TRUE,74,TRUE,92,FALSE,54,FALSE,50,TRUE,80,TRUE,55,TRUE,65,FALSE,92,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,53,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,60,FALSE,100,TRUE,71,FALSE,91,FALSE,86,TRUE,59,TRUE,100,FALSE,50,TRUE,80,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,-2,-3,2,-2,-1,1,2,1,0,0,1,1,2,2,-2,2,2,2,2,2,0,-2,-2,2,-2,-1,0,1,2,1,0,0,0,1,1,2,2,-2,0,2,2,2,2,2,0,-2,-2,2,-2,-1,0,1,1,1,0,0,0,1,0,1,2,-1,1,FALSE,1,87,FALSE,0,50,FALSE,1,80,FALSE,1,50,TRUE,1,85,FALSE,1,94,TRUE,1,74,TRUE,1,92,FALSE,0,54,FALSE,0,50,TRUE,0,80,TRUE,0,55,TRUE,1,65,FALSE,1,92,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,53,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,FALSE,1,100,TRUE,1,71,FALSE,1,91,FALSE,1,86,TRUE,0,59,TRUE,1,100,FALSE,0,50,TRUE,1,80,0.0064,0.0841,0,0.0676,0.04,0.0036,0.16,0.25,0,0,0,0.1225,0.2916,0.64,0.0225,0.25,0,0.25,0.0196,0,1,0.25,0.2809,0.0064,0.25,0.0081,0.25,0.0169,0.04,0.25,0.3481,0.3025,0.180453571,0.145014286,0.215892857,22,68.75,22,68.75,2,25,6,75,7,87.5,7,87.5,10,62.5,12,75,75.25,59.75,79.12,78,84.12,73.81,76.69,0,6.5,34.75,4.12,-9.5,-3.38,11.31,1.69,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0.2,0,0,0,0.2,0.2,0.6,0.05,0.25,0.15,0,0,0.125,0,0,-0.2,-0.6,-0.066666667,0,0,0,-1,0,0,1,1,-2,2,-1,1,-1,1,-1,1,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),59,Thanks for the survey,0.875,1,1,0,0,0,1,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,6,3,8,5,9,7,2,1,4,2,4,3,1 +404,R_32KQgZLqx87Bq3m,67 - 73,,Canadian,Canadian,Male,Disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,2,4,5,3,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,1,3,4,2,5,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,4,3,2,5,1,Agree,Agree,Agree,Agree,Somewhat agree,5,1,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly disagree,Somewhat agree,Strongly Agree,Neither agree nor disagree,Agree,4,5,1,3,2,2,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,2,4,5,1,3,2,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,4,1,2,5,3,4,Agree,Agree,Agree,Agree,Agree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly disagree,Somewhat agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,4,3,1,5,2,2,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,4,3,5,1,2,2,Neither Agree nor Disagree,Strongly agree,Strongly agree,Agree,Somewhat Agree,4,2,1,3,5,5,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,2,5,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,90,TRUE,70,FALSE,60,TRUE,75,TRUE,100,FALSE,95,TRUE,75,FALSE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,70,TRUE,50,TRUE,90,TRUE,60,TRUE,100,TRUE,100,TRUE,90,TRUE,90,TRUE,75,TRUE,90,TRUE,50,TRUE,95,TRUE,100,FALSE,100,26,-2,1,3,0,1,1,1,3,1,1,0,3,3,3,1,2,2,2,2,1,-3,1,3,0,2,1,1,1,3,1,1,2,0,3,3,3,1,2,2,2,2,2,2,4,-3,1,3,1,0,2,1,1,3,1,1,2,0,3,3,2,1,2,1,1,2,2,2,5,FALSE,1,100,TRUE,1,100,TRUE,0,95,TRUE,0,50,TRUE,1,90,TRUE,0,75,TRUE,1,90,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,60,TRUE,0,90,TRUE,1,50,FALSE,1,70,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,95,TRUE,1,100,TRUE,0,75,FALSE,1,60,TRUE,0,70,TRUE,1,90,TRUE,1,50,TRUE,1,100,0.01,0,0,0.01,0,0.5625,0.0625,0,0,0,0.01,0.25,0,0.36,0.01,0,0,0.25,0.16,0.0025,0.25,0.0625,0,0.09,0,0.5625,0.25,0,0.9025,0,0.49,0.81,0.181607143,0.1075,0.255714286,26,81.25,24,75,5,62.5,5,62.5,8,100,6,75,15,93.75,9,56.25,84.38,76.25,79.38,94.38,87.5,85,83.75,6.25,9.38,13.75,16.88,-5.62,12.5,-8.75,27.5,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0.4,0,0,0.2,0.6,0,0.2,0.6,0.15,0.35,0.25,1.67,2,2.5,-0.2,0,-0.2,-0.4,-0.133333333,-1,0,0,-1,-0.33,1,1,1,0,0,0,0,0,0,-1,1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,68,it was fun,0.625,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,9,7,5,4,2,6,3,1,8,2,4,3,1 +405,R_37ouadzHvN5P8U9,46 - 52,American,,American,Female,Strongly disagree,Disagree,Neither agree nor disagree,Disagree,Strongly agree,1,2,5,3,4,Strongly disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,1,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Agree,5,2,1,4,3,Agree,Agree,Agree,Strongly Agree,Strongly Agree,1,5,3,4,2,Strongly disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,Strongly Agree,2,5,3,4,1,5,Strongly disagree,Strongly disagree,Agree,Neither agree nor disagree,Strongly disagree,4,2,3,5,1,1,Somewhat Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Agree,5,3,4,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,2,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,Agree,1,2,3,5,4,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,5,2,3,1,1,Somewhat Agree,Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,4,1,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,90,TRUE,90,TRUE,90,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,90,TRUE,100,FALSE,50,TRUE,80,TRUE,90,FALSE,100,FALSE,80,FALSE,100,FALSE,100,TRUE,90,FALSE,100,TRUE,80,TRUE,80,TRUE,100,FALSE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,-2,0,-2,3,-3,-2,2,0,0,1,1,3,-3,2,2,2,2,3,3,-3,0,1,-3,3,5,-3,-3,2,0,-3,1,1,1,3,-3,2,6,0,0,0,0,0,6,-3,-2,0,-3,2,5,-3,0,0,0,-3,1,1,2,3,-3,0,5,0,0,0,0,0,5,TRUE,0,100,FALSE,0,50,FALSE,1,90,TRUE,0,90,TRUE,1,90,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,TRUE,0,100,FALSE,0,50,TRUE,1,80,TRUE,0,90,FALSE,1,100,FALSE,1,80,FALSE,1,100,FALSE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,80,TRUE,0,80,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.04,1,0,0,0.04,0,0,0.01,0,0.01,0,0.25,0.01,0.25,0,0.81,0,0.64,1,0.25,0.04,1,0.81,0.25,0,1,0.01,0,0.25,1,0.2725,0.098571429,0.446428571,22,68.75,21,65.63,5,62.5,5,62.5,4,50,7,87.5,12,75,9,56.25,87.81,71.25,90,96.25,93.75,89.38,86.25,3.12,22.18,8.75,27.5,46.25,6.25,14.38,30,0,2,1,1,0,0,1,0,0,3,0,0,0,0,0,2,2,2,3,3,0,0,0,1,1,0,2,2,0,3,0,1,0,0,2,2,2,2,3,3,0.8,0.8,0,2.4,0.4,1.4,0.6,2.4,1,1.2,1.1,4,3.67,4.25,0.4,-0.6,-0.6,0,-0.266666667,0,0,1,1,0.33,0,0,0,-1,1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),50,I do not have any feedback to share.,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,6,5,2,8,9,4,7,1,3,4,3,2,1 +406,R_3e2Cal4Kzt5T3Tl,25 - 31,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Agree,Agree,2,5,3,4,1,Agree,Agree,Agree,Strongly agree,Strongly agree,3,1,4,2,5,Agree,Strongly Agree,Agree,Agree,Agree,5,2,4,3,1,Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,3,2,4,5,3,Somewhat disagree,Agree,Agree,Strongly agree,Neither agree nor disagree,5,1,2,3,4,3,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,2,5,1,4,8,Agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,3,4,2,3,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,2,3,1,4,5,2,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,1,5,2,3,7,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,73,TRUE,55,TRUE,100,TRUE,86,TRUE,55,FALSE,75,TRUE,55,TRUE,62,TRUE,100,TRUE,56,FALSE,100,TRUE,89,FALSE,77,FALSE,63,TRUE,100,TRUE,52,TRUE,100,TRUE,50,TRUE,85,TRUE,100,TRUE,77,TRUE,62,TRUE,78,TRUE,80,TRUE,68,TRUE,64,FALSE,83,TRUE,100,FALSE,58,FALSE,89,FALSE,57,FALSE,100,25,2,3,3,2,2,2,2,2,3,3,2,3,2,2,2,2,3,2,2,3,3,3,3,3,2,5,-1,2,2,3,0,3,3,2,3,2,3,3,2,0,1,2,1,8,2,3,2,2,3,6,0,-1,3,-1,2,3,3,3,2,3,3,2,3,2,3,3,3,7,FALSE,1,100,FALSE,0,57,FALSE,1,89,FALSE,1,58,TRUE,1,100,FALSE,1,83,TRUE,1,64,TRUE,1,68,TRUE,1,80,TRUE,1,78,TRUE,0,62,TRUE,0,77,TRUE,1,100,TRUE,0,85,TRUE,1,50,TRUE,1,100,TRUE,0,52,TRUE,0,100,FALSE,1,63,FALSE,1,77,TRUE,1,89,FALSE,0,100,TRUE,0,56,TRUE,1,100,TRUE,0,62,TRUE,1,55,FALSE,1,75,TRUE,0,55,TRUE,0,86,TRUE,1,100,TRUE,1,55,TRUE,1,73,0.1024,0.2025,0,0.1296,0.0729,0.0289,0,0.0484,0.0529,1,0,0,0.04,0.3844,0,0.3249,0.3136,0.1764,0.3025,0.3844,0.0121,0.25,0.1369,0.7225,0.2704,0.0625,0.2025,0,0.0121,1,0.7396,0.5929,0.254671429,0.174457143,0.334885714,25,78.13,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,76.53,62.5,79.88,80.5,83.25,79.31,73.75,12.5,10.9,-12.5,17.38,30.5,8.25,-8.19,30,1,0,0,1,0,3,0,0,0,3,1,1,1,0,1,0,3,1,0,2,0,0,1,0,1,2,3,1,4,1,1,0,0,1,1,1,1,1,1,0,0.4,1.2,0.8,1.2,0.4,2.2,0.6,0.8,0.9,1,0.95,3.67,3.67,4.625,0,-1,0.2,0.4,-0.266666667,-1,0,1,1,0,0,0,0,1,-1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,28,,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,3,4,2,6,7,5,9,1,8,4,2,3,1 +407,R_514Twbm6xuNkAVv,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Disagree,Somewhat agree,3,2,4,1,5,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,5,2,3,4,1,Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,2,3,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Disagree,2,1,5,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Agree,2,5,4,3,1,1,Strongly disagree,Disagree,Agree,Neither agree nor disagree,Agree,5,1,3,4,2,3,Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,5,3,1,1,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat disagree,Disagree,5,3,1,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Disagree,Agree,1,2,5,4,3,3,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,5,1,4,2,3,3,Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,2,3,4,5,1,Disagree,Disagree,Disagree,Disagree,Disagree,4,2,3,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,FALSE,55,TRUE,53,TRUE,94,TRUE,86,FALSE,52,TRUE,60,FALSE,98,TRUE,95,TRUE,65,TRUE,99,FALSE,52,FALSE,53,TRUE,54,TRUE,83,TRUE,83,TRUE,79,TRUE,53,FALSE,96,TRUE,92,TRUE,97,FALSE,92,TRUE,97,TRUE,52,TRUE,96,TRUE,100,FALSE,100,TRUE,94,FALSE,62,TRUE,91,FALSE,53,FALSE,74,18,3,3,1,-2,1,-3,0,3,-1,3,2,-2,3,0,3,-1,0,1,-1,-2,3,3,3,-3,2,1,-3,-2,2,0,2,3,2,-3,3,1,3,1,-1,0,-2,-1,-2,1,3,3,2,-2,2,3,-3,-1,2,-1,2,3,2,-2,3,0,3,1,-2,-2,-2,-2,-2,2,FALSE,1,74,FALSE,0,53,TRUE,0,91,FALSE,1,62,TRUE,1,94,FALSE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,52,TRUE,1,97,FALSE,1,92,TRUE,0,97,TRUE,1,92,FALSE,1,96,TRUE,1,53,TRUE,1,79,TRUE,0,83,TRUE,0,83,TRUE,0,54,FALSE,1,53,FALSE,0,52,TRUE,1,99,TRUE,0,65,TRUE,1,95,FALSE,1,98,TRUE,1,60,FALSE,1,52,TRUE,0,86,TRUE,0,94,TRUE,1,53,FALSE,0,55,TRUE,1,99,0.0016,0.16,0.0441,0,0.0001,0,0.0025,0.0009,0.2209,0.0001,0.2209,0.0064,0.2304,0.0064,0.0036,0.2809,0.4225,0.1444,0.7396,0.0004,0.2704,0.2209,0.2916,0.0016,0.6889,0.2304,0.3025,0.0676,0.8281,0.6889,0.8836,0.9409,0.274835714,0.11,0.439671429,18,56.25,21,65.63,5,62.5,4,50,7,87.5,5,62.5,13,81.25,8,50,78.41,59.12,84.88,88.38,81.25,76.81,80,-9.38,12.78,-3.38,34.88,0.88,18.75,-4.44,30,0,0,2,1,1,0,2,1,1,1,0,1,0,1,0,0,0,3,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,0,1,2,3,1,0,0.8,1,0.4,0.6,0.4,0.6,0,1.4,0.7,0.6,0.65,1.67,2.33,1.875,0.4,0.4,0.4,-0.8,0.4,-2,0,0,-1,-0.66,0,2,1,-1,1,0,0,-1,1,2,-2,1,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),48,,0.5,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,01ITEM,02REV,9,2,4,7,3,6,8,1,5,3,2,4,1 +408,R_6bHNp7BbzF4X5fT,46 - 52,,Canadian,Canadian,Female,Agree,Agree,Agree,Disagree,Agree,4,2,5,3,1,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,1,3,4,2,Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,1,2,3,5,4,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,5,2,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Disagree,Agree,1,2,3,5,4,3,Disagree,Disagree,Agree,Disagree,Somewhat disagree,2,3,1,4,5,3,Agree,Somewhat Agree,Agree,Disagree,Agree,2,4,5,3,1,4,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,2,4,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Disagree,Agree,4,2,5,3,1,2,Disagree,Disagree,Agree,Disagree,Disagree,3,4,5,2,1,2,Agree,Agree,Agree,Disagree,Agree,5,1,3,4,2,4,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,2,1,3,4,5,TRUE,96,TRUE,91,FALSE,100,TRUE,61,TRUE,52,FALSE,92,TRUE,99,TRUE,100,FALSE,86,TRUE,64,TRUE,65,TRUE,85,TRUE,73,TRUE,64,TRUE,59,TRUE,83,TRUE,75,TRUE,100,TRUE,60,FALSE,69,FALSE,100,FALSE,71,FALSE,100,TRUE,79,TRUE,78,TRUE,96,FALSE,76,FALSE,100,TRUE,72,FALSE,91,TRUE,80,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-2,2,-2,-2,2,-2,0,2,0,2,-2,2,-2,0,-2,0,-2,2,2,2,-2,2,2,-2,-2,2,-2,-1,3,2,1,2,-2,2,3,-2,0,0,-2,-2,4,2,2,2,-2,2,3,-2,-2,2,-2,-2,2,2,2,2,-2,2,2,-2,0,-2,-2,-2,4,TRUE,0,96,TRUE,1,91,FALSE,1,100,TRUE,0,61,TRUE,1,52,FALSE,1,92,TRUE,1,99,TRUE,1,100,FALSE,0,86,TRUE,1,64,TRUE,0,65,TRUE,0,85,TRUE,1,73,TRUE,0,64,TRUE,1,59,TRUE,1,83,TRUE,0,75,TRUE,0,100,TRUE,0,60,FALSE,1,69,FALSE,0,100,FALSE,0,71,FALSE,1,100,TRUE,1,79,TRUE,0,78,TRUE,1,96,FALSE,1,76,FALSE,1,100,TRUE,0,72,FALSE,0,91,TRUE,1,80,TRUE,1,100,0,0.0016,0.0289,0.0001,0,0.0064,0.0441,0.1296,0.0961,0.5041,0.8281,0.0729,0.7396,0.4225,0.2304,0.0081,0,0.3721,0,0.6084,1,0.1681,0.36,0.4096,0.5625,0.0576,0.04,0.9216,0,1,0.5184,0.7225,0.350810714,0.246714286,0.454907143,20,62.5,18,56.25,4,50,5,62.5,3,37.5,6,75,12,75,6,37.5,81.78,72.25,83,83.5,88.38,82.75,80.81,6.25,25.53,22.25,20.5,46,13.38,7.75,43.31,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,2,0,0,0.2,0.2,0.8,0,0.4,0.4,0.4,0.3,0.3,0.3,2.67,2.33,2.875,0,-0.2,-0.2,0.4,-0.133333333,-1,1,1,0,0.34,-1,1,1,-2,2,1,-1,0,0,-1,1,-1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,52,.,0.25,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,5,3,4,6,9,7,8,1,2,4,3,2,1 +409,R_3805DpetJfO3EJz,53 - 59,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,3,5,Strongly disagree,Disagree,Somewhat agree,Disagree,Agree,2,5,3,4,1,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,2,1,4,3,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,1,2,4,3,5,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,2,5,8,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,1,4,3,5,2,8,Neither Agree nor Disagree,Agree,Agree,Agree,Agree,5,2,4,3,1,9,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,1,4,3,5,2,7,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,1,3,2,4,5,2,Somewhat Agree,Somewhat Agree,Agree,Disagree,Agree,3,1,5,2,4,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,5,4,1,3,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,94,FALSE,94,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,51,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,52,TRUE,100,TRUE,100,TRUE,100,22,2,3,3,3,3,-3,-2,1,-2,2,0,1,1,-2,1,-1,-1,-1,0,-3,0,3,3,3,3,8,-3,-3,1,-3,2,8,0,2,2,2,2,9,2,2,2,2,2,10,2,3,1,3,2,7,-3,-3,0,-3,1,2,1,1,2,-2,2,2,-1,1,1,1,-3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,51,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,52,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,94,FALSE,0,94,0,0,0,0,0.8836,0,0,1,0,0,0,0,0,0,0,0,0,0.2304,0,1,1,0.25,0.2304,0.2401,0,1,0.8836,1,1,1,1,1,0.418503571,0.151,0.686007143,22,68.75,20,62.5,5,62.5,5,62.5,4,50,6,75,11,68.75,9,56.25,93.53,81,99.25,93.88,100,96.12,90.94,6.25,31.03,18.5,36.75,43.88,25,27.37,34.69,2,0,0,0,0,0,1,0,1,0,0,1,1,4,1,3,3,3,2,5,0,0,2,0,1,0,1,1,1,1,1,0,1,0,1,0,2,2,1,0,0.4,0.4,1.4,3.2,0.6,0.8,0.6,1,1.35,0.75,1.05,8.33,3.67,6.25,-0.2,-0.4,0.8,2.2,0.066666667,1,6,7,6,4.66,2,2,2,-2,2,1,-1,2,-2,-2,2,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),59,survey was fair and not too long,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,7,5,8,3,9,4,6,1,2,3,2,4,1 +410,R_5ezzYdogimJP8ky,53 - 59,American,,American,Male,Somewhat agree,Agree,Agree,Somewhat agree,Agree,3,2,4,1,5,Disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,4,2,5,3,1,Agree,Agree,Somewhat Agree,Somewhat Agree,Agree,1,5,3,2,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,3,2,5,1,4,2,Disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,2,4,1,5,1,Agree,Agree,Somewhat Agree,Somewhat Agree,Agree,5,1,4,2,3,2,Agree,Agree,Agree,Agree,Agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Agree,Agree,Somewhat agree,Agree,4,2,1,3,5,1,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,1,4,2,5,2,Agree,Agree,Somewhat Agree,Somewhat Agree,Agree,1,3,4,5,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,1,3,5,FALSE,100,TRUE,90,TRUE,80,TRUE,50,TRUE,60,FALSE,90,TRUE,90,TRUE,90,FALSE,70,TRUE,90,FALSE,60,FALSE,60,TRUE,70,TRUE,80,FALSE,60,TRUE,90,FALSE,90,TRUE,90,FALSE,70,FALSE,100,TRUE,60,TRUE,80,FALSE,60,TRUE,70,TRUE,60,TRUE,70,FALSE,60,FALSE,60,FALSE,60,TRUE,60,FALSE,60,TRUE,90,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,1,2,-2,-2,1,-2,-1,2,2,1,1,2,1,1,1,1,1,1,2,2,1,1,1,-2,-2,1,-1,-1,2,2,2,1,1,2,1,2,2,2,2,2,2,1,2,2,1,2,1,-2,-1,1,-1,-1,1,2,2,1,1,2,2,1,1,1,1,1,3,FALSE,1,100,TRUE,1,90,TRUE,0,80,TRUE,0,50,TRUE,1,60,FALSE,1,90,TRUE,1,90,TRUE,1,90,FALSE,0,70,TRUE,1,90,FALSE,1,60,FALSE,1,60,TRUE,1,70,TRUE,0,80,FALSE,0,60,TRUE,1,90,FALSE,1,90,TRUE,0,90,FALSE,1,70,FALSE,1,100,TRUE,1,60,TRUE,1,80,FALSE,1,60,TRUE,1,70,TRUE,0,60,TRUE,1,70,FALSE,1,60,FALSE,1,60,FALSE,1,60,TRUE,1,60,FALSE,0,60,TRUE,1,90,0.01,0.09,0.01,0.01,0.01,0.01,0.09,0.01,0,0.04,0.16,0.09,0.49,0.16,0.16,0.01,0.16,0.25,0.16,0.36,0.16,0.36,0.09,0.64,0.01,0.16,0.36,0,0.64,0.81,0.16,0.16,0.203928571,0.117142857,0.290714286,24,75,24,75,4,50,8,100,5,62.5,7,87.5,13,81.25,11,68.75,74.06,65,72.5,82.5,76.25,75,73.12,0,-0.94,15,-27.5,20,-11.25,-6.25,4.37,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,1,0,0.4,0,0,0.35,0.1,0.225,1.33,1.33,1.625,0.2,-0.2,0,1,0,0,1,-1,-1,0,1,1,1,-1,1,1,-1,-1,1,-1,1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,58,,0.625,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,5,4,7,6,9,8,2,1,3,3,4,2,1 +411,R_6Pp6q4gizO7hH7Q,46 - 52,,Canadian,Canadian,Male,Neither agree nor disagree,Agree,Agree,Agree,Somewhat disagree,5,4,1,2,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,2,4,1,3,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,4,3,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,5,3,4,1,Neither agree nor disagree,Somewhat agree,Agree,Agree,Somewhat disagree,5,4,1,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,3,4,7,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,3,2,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,5,4,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,2,4,1,3,7,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,3,1,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,5,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,86,FALSE,50,FALSE,50,TRUE,59,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,62,FALSE,92,FALSE,50,TRUE,62,FALSE,50,TRUE,57,TRUE,57,FALSE,58,FALSE,59,TRUE,61,TRUE,58,TRUE,59,TRUE,59,TRUE,64,TRUE,60,TRUE,58,FALSE,61,TRUE,60,TRUE,61,TRUE,69,TRUE,76,16,0,2,2,2,-1,0,0,1,-1,-1,2,2,1,0,1,1,1,2,1,1,0,1,2,2,-1,7,0,0,1,0,0,7,2,0,1,0,0,7,0,0,1,0,1,7,-1,1,1,0,0,7,0,0,0,-1,0,7,0,1,1,0,1,7,0,0,0,0,1,7,TRUE,0,76,TRUE,1,69,TRUE,0,61,TRUE,0,60,FALSE,0,61,TRUE,0,58,TRUE,1,60,TRUE,1,64,TRUE,1,59,TRUE,1,59,TRUE,0,58,TRUE,0,61,FALSE,0,59,FALSE,1,58,TRUE,1,57,TRUE,1,57,FALSE,1,50,TRUE,0,62,FALSE,1,50,FALSE,1,92,TRUE,1,62,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,1,50,TRUE,0,59,FALSE,0,50,FALSE,0,50,TRUE,1,86,0.1296,0.25,0.1849,0.16,0.0196,0.3364,0.25,0.1681,0.0064,0.25,0.25,0.3481,0.1681,0.3364,0.3721,0.0961,0.25,0.36,0.25,0.25,0.1444,0.1849,0.25,0.1764,0.25,0.25,0.25,0.5776,0.3721,0.3844,0.3481,0.3721,0.259689286,0.229378571,0.29,16,50,17,53.13,4,50,4,50,5,62.5,4,50,10,62.5,7,43.75,59,56.62,60.62,58.12,60.62,58.94,59.06,-3.13,5.87,6.62,10.62,-4.38,10.62,-3.56,15.31,0,1,0,0,0,0,0,0,1,1,0,2,0,0,1,1,1,1,1,0,1,1,1,2,1,0,0,1,0,1,2,1,0,0,0,1,1,2,1,0,0.2,0.4,0.6,0.8,1.2,0.4,0.6,1,0.5,0.8,0.65,7,7,7,-1,0,0,-0.2,-0.333333333,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,1,-1,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),49,i have nothing,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,7,8,3,5,9,2,4,1,6,3,2,4,1 +412,R_170Ug1Iq1gkth8K,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,Somewhat agree,1,5,2,3,4,Strongly Agree,Somewhat Agree,Agree,Agree,Agree,5,1,2,4,3,Agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,1,3,5,2,4,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,5,4,2,3,8,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,2,4,5,1,8,Strongly Agree,Agree,Agree,Agree,Strongly Agree,2,1,3,4,5,8,Somewhat agree,Agree,Neither agree nor disagree,Agree,Somewhat agree,1,2,4,3,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,4,5,10,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat agree,1,3,5,4,2,6,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,5,4,1,2,3,8,Strongly Agree,Strongly Agree,Agree,Agree,Agree,4,3,2,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,99,FALSE,50,FALSE,68,FALSE,58,TRUE,64,FALSE,73,TRUE,100,FALSE,55,TRUE,60,TRUE,98,FALSE,100,TRUE,100,FALSE,100,FALSE,54,TRUE,63,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,74,FALSE,60,FALSE,83,FALSE,60,FALSE,89,TRUE,70,FALSE,85,TRUE,100,FALSE,59,TRUE,100,TRUE,66,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,0,2,0,2,1,3,1,2,2,2,2,0,2,1,2,2,3,3,2,3,8,0,2,3,1,0,8,3,2,2,2,3,8,1,2,0,2,1,7,3,3,3,3,3,10,-1,1,2,2,1,6,3,3,2,3,2,8,3,3,2,2,2,6,FALSE,1,99,FALSE,0,50,FALSE,1,68,FALSE,1,58,TRUE,1,64,FALSE,1,73,TRUE,1,100,FALSE,0,55,TRUE,1,60,TRUE,1,98,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,54,TRUE,1,63,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,74,FALSE,0,60,FALSE,1,83,FALSE,0,60,FALSE,1,89,TRUE,1,70,FALSE,1,85,TRUE,0,100,FALSE,1,59,TRUE,1,100,TRUE,1,66,TRUE,1,100,0.3025,0.09,0,0,0,0.0729,0.36,0.0004,0,0.36,0,1,0.16,0,0.1296,0.25,0.0289,0.1764,1,0.0121,0.5476,0.1369,0,0.2116,1,0.0225,0.1156,0.0001,0.1024,1,0.1681,1,0.280539286,0.1813,0.379778571,16,50,22,68.75,7,87.5,5,62.5,6,75,4,50,10,62.5,12,75,80.88,72.75,81.62,83.75,85.38,76.25,85.5,-18.75,12.13,-14.75,19.12,8.75,35.38,13.75,10.5,1,0,0,1,0,0,0,3,1,1,0,1,0,0,1,1,2,2,1,1,0,0,0,0,0,1,1,2,0,0,0,2,0,1,0,1,3,0,1,0,0.4,1,0.4,1.4,0,0.8,0.6,1,0.8,0.6,0.7,8,8,7.625,0.4,0.2,-0.2,0.4,0.133333333,-2,2,0,1,0,1,1,0,-1,1,0,0,1,-1,0,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,intersting survey,0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,5,9,4,3,2,6,7,1,8,3,2,4,1 +413,R_1OrTLDR6rCD7Wpu,53 - 59,American,,American,Female,Strongly agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,5,1,4,2,Disagree,Somewhat agree,Agree,Disagree,Strongly agree,5,3,2,1,4,Agree,Somewhat Disagree,Strongly Agree,Agree,Agree,1,3,5,2,4,Agree,Agree,Agree,Agree,Agree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,4,1,2,3,1,Disagree,Somewhat agree,Strongly agree,Disagree,Strongly agree,1,5,4,3,2,1,Agree,Disagree,Strongly Agree,Agree,Agree,3,2,5,1,4,1,Agree,Agree,Agree,Agree,Agree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Disagree,Somewhat agree,Somewhat agree,Strongly Agree,3,4,1,5,2,0,Disagree,Somewhat agree,Agree,Disagree,Strongly agree,4,2,1,3,5,1,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,1,3,4,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,5,3,2,4,FALSE,97,TRUE,97,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,99,TRUE,100,TRUE,85,TRUE,91,FALSE,50,FALSE,100,TRUE,100,FALSE,99,FALSE,50,TRUE,95,FALSE,50,FALSE,72,TRUE,55,FALSE,50,FALSE,50,TRUE,96,FALSE,99,TRUE,97,FALSE,100,TRUE,97,TRUE,57,FALSE,96,TRUE,63,TRUE,75,FALSE,50,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,0,1,0,3,-2,1,2,-2,3,2,-1,3,2,2,2,2,2,2,2,3,0,1,0,3,0,-2,1,3,-2,3,1,2,-2,3,2,2,1,2,2,2,2,2,1,3,-2,1,1,3,3,-2,1,2,-2,3,0,2,-1,3,3,3,1,0,0,0,0,1,3,FALSE,1,97,TRUE,1,97,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,85,TRUE,1,91,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,1,99,FALSE,0,50,TRUE,1,95,FALSE,1,50,FALSE,1,72,TRUE,0,55,FALSE,1,50,FALSE,0,50,TRUE,1,96,FALSE,1,99,TRUE,1,97,FALSE,1,100,TRUE,1,97,TRUE,0,57,FALSE,1,96,TRUE,0,63,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.0009,0.0025,0.0001,0,0,0.0009,0.0081,0.25,0.0016,0.0625,0,0.0225,0.25,0,0.0009,0.0001,0.25,0.0016,0,0.25,0.25,0.3025,0.0001,0.25,0.3249,0.25,0.0009,0,0.0784,0.3969,0,0.105425,0.060471429,0.150378571,27,84.38,26,81.25,4,50,6,75,8,100,8,100,13,81.25,13,81.25,81.88,61.75,82.75,93.88,89.12,86.38,77.38,3.13,0.63,11.75,7.75,-6.12,-10.88,5.13,-3.87,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,1,0,0.2,0.2,0,0.6,0,0.4,1.8,0.1,0.7,0.4,0.67,1.33,1.25,-0.6,0.2,-0.2,-1.8,-0.2,-3,1,0,-2,-0.66,0,2,2,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,15 days,Female,University - PhD,56,Fun experiment Good luck with your study!,1.375,1,1,0,0,0,0,0.67,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,7,5,4,3,6,9,2,1,8,4,3,2,1 +414,R_3HuyZ0X8TIq41jw,53 - 59,,Canadian,Canadian,Male,Disagree,Agree,Somewhat agree,Disagree,Somewhat agree,2,4,5,1,3,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,4,2,1,5,3,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,Disagree,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Disagree,Agree,Neither agree nor disagree,Strongly disagree,Disagree,1,3,4,5,2,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat agree,4,3,2,1,5,8,Agree,Agree,Agree,Agree,Agree,2,4,3,5,1,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly disagree,Agree,Somewhat agree,Disagree,Somewhat agree,3,2,1,4,5,3,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,3,1,5,2,4,1,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,8,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,5,1,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,55,FALSE,86,TRUE,94,FALSE,84,TRUE,74,TRUE,100,TRUE,72,TRUE,88,TRUE,84,TRUE,80,TRUE,79,FALSE,100,TRUE,60,TRUE,78,TRUE,87,TRUE,100,TRUE,80,TRUE,70,TRUE,74,TRUE,86,TRUE,86,TRUE,90,TRUE,85,TRUE,100,TRUE,100,FALSE,80,TRUE,83,TRUE,74,TRUE,86,TRUE,96,TRUE,100,9,-2,2,1,-2,1,1,1,-1,-1,1,2,2,2,2,2,-2,-2,-1,0,-1,-2,2,0,-3,-2,8,1,0,1,-2,1,1,2,2,2,2,2,8,1,1,0,1,-1,8,-3,2,1,-2,1,5,1,-1,1,-2,1,3,2,2,2,2,2,1,1,0,2,1,1,8,TRUE,0,100,TRUE,1,96,TRUE,0,86,TRUE,0,74,TRUE,1,83,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,85,TRUE,1,90,TRUE,0,86,TRUE,0,86,TRUE,1,74,TRUE,0,70,TRUE,1,80,TRUE,1,100,TRUE,0,87,TRUE,0,78,TRUE,0,60,FALSE,1,100,TRUE,1,79,TRUE,1,80,TRUE,0,84,TRUE,1,88,TRUE,0,72,TRUE,1,100,TRUE,0,74,FALSE,1,84,TRUE,0,94,FALSE,0,86,FALSE,0,55,TRUE,1,100,0,0,0,0,0,0.04,0.0144,0.01,0,0.04,0.7396,0.0676,0.0225,0.7396,0.0289,0.0016,0.7056,0.5476,0.0256,0.5184,0.0441,0.04,0.36,0.49,0.7569,0.5476,0.3025,1,0.7396,0.6084,0.8836,0.7396,0.357632143,0.211242857,0.504021429,9,28.13,17,53.13,3,37.5,5,62.5,4,50,5,62.5,14,87.5,3,18.75,84.72,76.25,85.12,86.25,91.25,87.25,82.19,-25,31.59,38.75,22.62,36.25,28.75,-0.25,63.44,0,0,1,1,3,0,1,2,1,0,0,0,0,0,0,3,3,1,1,0,1,0,0,0,0,0,2,2,1,0,0,0,0,0,0,3,2,3,1,2,1,0.8,0,1.6,0.2,1,0,2.2,0.85,0.85,0.85,5.67,3,5.25,0.8,-0.2,0,-0.6,0.2,3,-2,7,0,2.67,1,1,1,-1,1,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,53,interesting,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,2,7,8,3,9,6,5,1,4,4,3,2,1 +415,R_7HUEOPWFPRuB995,60 - 66,,Canadian,Canadian,Female,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,1,3,4,2,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,4,3,1,Somewhat Disagree,Somewhat Agree,Agree,Disagree,Somewhat Agree,1,4,2,3,5,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,4,1,2,3,Disagree,Somewhat agree,Agree,Disagree,Disagree,2,1,4,5,3,2,Disagree,Disagree,Agree,Disagree,Disagree,1,2,5,3,4,2,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,5,3,4,2,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,1,4,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,1,5,3,4,2,2,Disagree,Neither agree nor disagree,Agree,Disagree,Somewhat disagree,1,3,2,4,5,2,Somewhat Disagree,Somewhat Agree,Agree,Disagree,Agree,1,2,5,3,4,2,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,5,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,99,FALSE,60,TRUE,92,FALSE,51,TRUE,95,FALSE,63,TRUE,92,TRUE,98,FALSE,53,TRUE,95,FALSE,97,TRUE,100,TRUE,98,FALSE,88,TRUE,70,TRUE,96,TRUE,77,TRUE,80,TRUE,87,FALSE,78,TRUE,52,TRUE,96,TRUE,65,TRUE,98,FALSE,78,TRUE,79,FALSE,83,TRUE,91,FALSE,83,FALSE,95,TRUE,51,TRUE,95,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,1,2,0,-1,-1,-1,1,-1,0,-1,1,2,-2,1,1,1,2,2,1,-2,1,2,-2,-2,2,-2,-2,2,-2,-2,2,-1,1,1,-2,1,2,1,1,1,1,1,2,-1,1,2,-1,-1,2,-2,0,2,-2,-1,2,-1,1,2,-2,2,2,2,1,1,1,1,2,FALSE,1,99,FALSE,0,60,TRUE,0,92,FALSE,1,51,TRUE,1,95,FALSE,1,63,TRUE,1,92,TRUE,1,98,FALSE,0,53,TRUE,1,95,FALSE,1,97,TRUE,0,100,TRUE,1,98,FALSE,1,88,TRUE,1,70,TRUE,1,96,TRUE,0,77,TRUE,0,80,TRUE,0,87,FALSE,1,78,TRUE,1,52,TRUE,1,96,TRUE,0,65,TRUE,1,98,FALSE,1,78,TRUE,1,79,FALSE,1,83,TRUE,0,91,FALSE,1,83,FALSE,0,95,TRUE,1,51,TRUE,1,95,0.0004,0.0441,0.0016,0.0064,0.0025,0.1369,0.0004,0.0025,0.0484,0.0016,0.9025,0.0004,0.2809,0.0009,0.0025,0.36,0.4225,0.2401,0.8281,0.0484,0.2304,0.09,0.7569,0.0144,0.5929,0.0289,0.2401,0.0001,0.8464,0.64,0.0289,1,0.2767,0.171578571,0.381821429,16,50,22,68.75,5,62.5,6,75,7,87.5,4,50,13,81.25,9,56.25,82.34,69,78.5,88.38,93.5,82.69,82,-18.75,13.59,6.5,3.5,0.88,43.5,1.44,25.75,2,0,0,2,1,1,1,1,1,2,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,0,1,1.2,0.2,0.4,0.4,1,0.2,0.6,0.7,0.55,0.625,2,2,2,0.6,0.2,0,-0.2,0.266666667,0,0,0,0,0,0,1,0,-2,2,1,-1,2,-2,-1,1,-1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),61,Thank you.,0,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,4,8,2,3,6,9,7,1,5,3,2,4,1 +416,R_1HkpOnFzZo2O7jl,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,1,4,5,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,5,4,3,2,1,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,5,3,4,1,2,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,3,4,2,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,4,5,1,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,3,1,5,4,2,5,Disagree,Somewhat Disagree,Disagree,Somewhat Agree,Agree,2,5,3,4,1,6,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,2,4,1,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,3,1,9,Agree,Disagree,Strongly agree,Strongly disagree,Agree,3,5,4,1,2,1,Somewhat Agree,Agree,Agree,Disagree,Strongly Agree,1,4,2,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,95,FALSE,59,TRUE,91,FALSE,86,TRUE,66,TRUE,50,TRUE,76,TRUE,65,FALSE,50,FALSE,50,TRUE,97,TRUE,96,FALSE,98,FALSE,50,TRUE,78,TRUE,60,TRUE,95,TRUE,50,TRUE,73,FALSE,62,TRUE,77,TRUE,50,TRUE,97,TRUE,50,TRUE,97,TRUE,97,TRUE,66,FALSE,50,FALSE,50,TRUE,76,FALSE,50,FALSE,50,20,1,3,3,2,3,1,-2,3,-2,2,2,2,2,-1,3,3,2,3,2,1,3,3,3,3,3,1,0,-3,0,-2,0,5,-2,-1,-2,1,2,6,-1,-1,-1,-1,-2,6,2,3,3,3,3,9,2,-2,3,-3,2,1,1,2,2,-2,3,1,3,3,3,3,3,1,FALSE,1,50,FALSE,0,50,TRUE,0,76,FALSE,1,50,FALSE,0,50,TRUE,0,66,TRUE,1,97,TRUE,1,97,TRUE,1,50,TRUE,1,97,TRUE,0,50,TRUE,0,77,FALSE,0,62,TRUE,0,73,TRUE,1,50,TRUE,1,95,TRUE,0,60,TRUE,0,78,FALSE,1,50,FALSE,1,98,TRUE,1,96,TRUE,1,97,FALSE,1,50,FALSE,0,50,TRUE,0,65,TRUE,1,76,TRUE,0,50,TRUE,0,66,FALSE,1,86,TRUE,1,91,FALSE,0,59,FALSE,0,95,0.0009,0.0576,0.0025,0.0009,0.9025,0.4356,0.25,0.0009,0.0004,0.0009,0.0081,0.3844,0.25,0.25,0.25,0.25,0.25,0.25,0.4356,0.4225,0.0016,0.25,0.25,0.5329,0.36,0.25,0.3481,0.25,0.5776,0.6084,0.0196,0.5929,0.299357143,0.248771429,0.349942857,20,62.5,16,50,4,50,3,37.5,5,62.5,4,50,10,62.5,6,37.5,70.53,51.12,70.62,79.12,81.25,75.75,65.31,12.5,20.53,1.12,33.12,16.62,31.25,13.25,27.81,2,0,0,1,0,1,1,3,0,2,4,3,4,2,1,4,3,4,3,3,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,2,0.6,1.4,2.8,3.4,0.4,0.4,0.4,0.8,2.05,0.5,1.275,4,3.67,3.75,0.2,1,2.4,2.6,1.2,-8,4,5,5,0.33,1,1,0,-2,2,-1,1,-1,1,-1,1,1,5 cents,5 minutes,24 days,Male,University - PhD,46,This is a unique and interesting study.,1,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,5,3,2,8,4,7,6,1,9,4,3,2,1 +417,R_3qkqjzWRZrcoqIx,39 - 45,American,,American,Female,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,2,1,5,4,3,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,1,3,2,4,Strongly Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,3,4,5,1,2,Agree,Somewhat agree,Agree,Agree,Agree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,4,1,5,2,3,2,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,2,4,5,1,2,Strongly Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,2,4,3,5,1,2,Agree,Agree,Agree,Agree,Agree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,1,5,4,2,3,2,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,4,3,2,1,5,3,Strongly agree,Agree,Agree,Somewhat Disagree,Strongly agree,2,5,4,3,1,3,Agree,Agree,Agree,Agree,Agree,3,4,2,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,FALSE,88,TRUE,97,FALSE,89,TRUE,93,TRUE,80,TRUE,97,FALSE,77,TRUE,77,TRUE,94,TRUE,91,TRUE,88,TRUE,88,TRUE,88,TRUE,99,TRUE,100,TRUE,96,TRUE,96,TRUE,91,TRUE,98,TRUE,100,TRUE,100,FALSE,74,TRUE,95,TRUE,100,TRUE,100,FALSE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,96,20,0,2,2,2,0,-1,-1,3,1,0,3,2,1,-1,3,2,1,2,2,2,0,2,2,2,1,2,-1,-1,3,1,0,2,3,2,1,-1,3,2,2,2,2,2,2,2,0,2,2,2,0,2,-1,-1,3,1,0,2,3,2,2,-1,3,3,2,2,2,2,2,3,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,FALSE,0,74,TRUE,0,100,TRUE,0,100,TRUE,1,98,TRUE,0,91,TRUE,1,96,TRUE,1,96,TRUE,0,100,TRUE,0,99,TRUE,0,88,TRUE,0,88,TRUE,1,88,TRUE,1,91,TRUE,0,94,TRUE,1,77,FALSE,1,77,TRUE,1,97,TRUE,0,80,TRUE,0,93,FALSE,1,89,TRUE,1,97,FALSE,0,88,TRUE,1,91,0,0.0009,0.0016,0,0.0081,0,0.0529,0.5476,0.7744,0.0081,0.0009,0.0004,0.0025,1,0.0001,0,0.8836,1,0.8649,0.0529,0.0144,0.0016,0.7744,0.8281,1,0.64,0.7744,0.9216,1,0.9801,0.0121,1,0.469396429,0.305614286,0.633178571,20,62.5,17,53.13,3,37.5,6,75,4,50,4,50,14,87.5,3,18.75,93.19,93.38,94.88,90.62,93.88,92.94,93.44,9.37,40.06,55.88,19.88,40.62,43.88,5.44,74.69,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.2,0,0,0.2,0,0,0.2,0.2,0.1,0.1,0.1,2,2.33,2.25,0.2,0,-0.2,0,0,0,0,-1,-1,-0.33,1,0,0,-1,1,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,41,It was fine.,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,5,2,4,8,6,7,9,1,3,3,4,2,1 +418,R_5qrd0tdCp9EcqTV,32 - 38,American,Canadian,Both,Female,Somewhat agree,Somewhat agree,Agree,Disagree,Disagree,5,2,3,1,4,Disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,4,5,3,2,1,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,Disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,4,2,5,3,1,Agree,Agree,Agree,Disagree,Disagree,3,1,2,5,4,3,Disagree,Somewhat agree,Agree,Agree,Disagree,1,3,5,2,4,4,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,1,5,4,3,2,3,Disagree,Disagree,Disagree,Disagree,Disagree,2,3,1,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Somewhat disagree,Disagree,4,1,2,3,5,3,Disagree,Somewhat agree,Agree,Agree,Disagree,1,5,2,3,4,3,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,2,Somewhat disagree,Somewhat disagree,Disagree,Disagree,Disagree,2,1,4,3,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,76,FALSE,89,TRUE,50,TRUE,89,FALSE,50,TRUE,91,TRUE,92,TRUE,94,TRUE,100,FALSE,50,TRUE,92,TRUE,95,TRUE,82,TRUE,51,TRUE,100,FALSE,50,FALSE,93,FALSE,50,FALSE,98,FALSE,51,TRUE,78,FALSE,50,TRUE,81,TRUE,88,TRUE,91,TRUE,88,TRUE,50,TRUE,94,TRUE,75,TRUE,84,TRUE,80,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,2,-2,-2,-2,1,1,2,-1,1,-1,1,1,1,-2,-1,-1,0,-1,2,2,2,-2,-2,3,-2,1,2,2,-2,4,1,-1,2,1,1,3,-2,-2,-2,-2,-2,4,2,1,2,-1,-2,3,-2,1,2,2,-2,3,1,-2,1,1,1,2,-1,-1,-2,-2,-2,7,FALSE,1,100,TRUE,1,76,FALSE,1,89,TRUE,0,50,TRUE,1,89,FALSE,1,50,TRUE,1,91,TRUE,1,92,TRUE,1,94,TRUE,1,100,FALSE,1,50,TRUE,0,92,TRUE,1,95,TRUE,0,82,TRUE,1,51,TRUE,1,100,FALSE,1,50,FALSE,1,93,FALSE,1,50,FALSE,1,98,FALSE,0,51,TRUE,1,78,FALSE,1,50,TRUE,1,81,TRUE,0,88,TRUE,1,91,TRUE,0,88,TRUE,0,50,TRUE,0,94,TRUE,1,75,TRUE,1,84,TRUE,1,80,0.0064,0.0081,0,0.0081,0.04,0.25,0.0361,0,0.0004,0.0484,0.0625,0.0025,0.0036,0.25,0.0121,0.0576,0.25,0.25,0.25,0.7744,0.2601,0.2401,0.25,0.6724,0.25,0.7744,0.0256,0,0.0121,0.0049,0.8836,0.8464,0.2324,0.090228571,0.374571429,8,25,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,78.19,67.88,69.88,90.38,84.62,83,73.38,-50,3.19,-7.12,-5.12,15.38,9.62,-10.75,17.13,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,2,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,2,1,0.4,0.4,0.2,1,0.4,0.4,0.2,1,0.5,0.5,0.5,3.33,2.67,3.625,0,0,0,0,0,0,1,1,-3,0.66,0,2,1,0,0,-1,1,-1,1,-1,1,0,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),36,Thanks.,0.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,3,6,8,4,2,5,7,1,9,4,3,2,1 +419,R_1LzFombgHpQ84me,46 - 52,American,,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,3,2,5,1,Somewhat agree,Disagree,Agree,Disagree,Agree,3,4,2,1,5,Strongly Agree,Agree,Agree,Agree,Strongly Agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Strongly Agree,Agree,Somewhat agree,3,4,1,2,5,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,5,1,2,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,1,3,7,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,5,2,3,4,0,Agree,Agree,Strongly Agree,Agree,Agree,3,2,1,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Agree,2,3,4,1,5,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,5,1,3,4,8,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,5,2,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,96,TRUE,98,FALSE,85,FALSE,70,TRUE,95,FALSE,95,TRUE,98,TRUE,100,TRUE,95,TRUE,98,FALSE,97,FALSE,85,FALSE,90,FALSE,95,TRUE,90,TRUE,100,FALSE,90,TRUE,95,FALSE,85,FALSE,95,TRUE,100,TRUE,99,FALSE,96,TRUE,100,FALSE,85,TRUE,100,FALSE,95,TRUE,90,FALSE,90,FALSE,95,TRUE,95,TRUE,95,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,1,-2,2,-2,2,3,2,2,2,3,1,1,3,2,1,1,1,2,2,2,7,1,1,1,0,0,7,-1,0,0,0,1,0,2,2,3,2,2,8,2,2,2,1,2,8,0,0,1,1,0,7,0,0,2,1,0,8,1,2,1,1,1,8,FALSE,1,96,TRUE,1,98,FALSE,1,85,FALSE,1,70,TRUE,1,95,FALSE,1,95,TRUE,1,98,TRUE,1,100,TRUE,1,95,TRUE,1,98,FALSE,1,97,FALSE,1,85,FALSE,0,90,FALSE,1,95,TRUE,1,90,TRUE,1,100,FALSE,1,90,TRUE,0,95,FALSE,1,85,FALSE,1,95,TRUE,1,100,TRUE,1,99,FALSE,1,96,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,1,95,TRUE,0,90,FALSE,1,90,FALSE,0,95,TRUE,1,95,TRUE,1,95,0,0,0,0.0004,0.0025,0.0025,0,0.0004,0.0025,0.0001,0.9025,0.81,0.0025,0.0009,0.0025,0.0004,0.0016,0.09,0.81,0.0225,0,0.01,0.0225,0.0025,0.01,0.0025,0.0025,0.0016,0.0225,0.9025,0.01,0.0225,0.130714286,0.129885714,0.131542857,32,100,28,87.5,8,100,7,87.5,7,87.5,6,75,14,87.5,14,87.5,93.5,90.62,93.88,95.75,93.75,96.75,90.25,12.5,6,-9.38,6.38,8.25,18.75,9.25,2.75,1,2,1,0,1,0,3,1,2,2,4,2,2,2,2,1,1,0,0,1,0,1,1,1,1,1,2,1,3,2,3,2,0,1,3,0,1,2,1,0,1,1.6,2.4,0.6,0.8,1.8,1.8,0.8,1.4,1.3,1.35,4.67,7.67,6.625,0.2,-0.2,0.6,-0.2,0.2,-1,0,-8,0,-3,2,2,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),47,"The survey was engaging and thought-provoking, with a good mix of logic and general knowledge questions that encouraged careful thinking.",1.875,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,9,3,2,8,5,6,7,1,4,4,3,2,1 +420,R_1SojIeCCuVQciPw,53 - 59,American,,American,Female,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly disagree,3,1,2,4,5,Somewhat disagree,Strongly disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,3,2,4,1,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,3,2,5,1,4,Disagree,Strongly disagree,Disagree,Disagree,Disagree,1,2,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Strongly disagree,Strongly disagree,5,3,4,2,1,2,Somewhat disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,3,1,2,4,5,1,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,4,5,3,1,2,5,Neither agree nor disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly disagree,2,5,3,1,4,1,Disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,2,1,3,5,4,1,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,2,5,3,4,1,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,2,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,75,TRUE,75,TRUE,75,TRUE,75,TRUE,75,TRUE,75,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,75,FALSE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,75,TRUE,85,TRUE,75,TRUE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,75,TRUE,50,23,0,0,3,-3,-3,-1,-3,1,-1,-1,3,1,2,0,3,-2,-3,-2,-2,-2,0,0,3,-3,-3,1,-1,-3,3,0,-1,2,2,2,2,-1,3,1,0,-2,0,0,-2,5,0,0,3,0,-3,1,-2,-3,2,-1,-1,1,2,1,0,-1,2,1,-1,-1,-1,-1,-1,2,TRUE,0,50,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,75,TRUE,1,85,TRUE,1,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,75,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,75,TRUE,1,75,TRUE,0,75,TRUE,0,75,TRUE,0,75,TRUE,1,75,TRUE,1,50,TRUE,1,100,0.0225,0.0625,0.25,0.0625,0,0.25,0.25,0,0.25,0.25,0.0625,0.25,0.0625,0.25,0.25,0.0625,0.25,0.25,0.5625,0.5625,0.25,0.25,0.25,1,0.25,0.5625,0.25,0.25,0.25,0.5625,0.5625,1,0.321428571,0.174107143,0.46875,23,71.88,22,68.75,7,87.5,5,62.5,4,50,6,75,16,100,6,37.5,65.16,59.38,59.38,75,66.88,66.25,64.06,3.13,-3.59,-28.12,-3.12,25,-8.12,-33.75,26.56,0,0,0,0,0,0,0,2,1,0,1,1,0,1,0,2,1,2,2,0,0,0,0,3,0,1,0,1,0,0,1,0,2,1,1,1,2,1,1,1,0,0.6,0.6,1.4,0.6,0.4,1,1.2,0.65,0.8,0.725,1.33,1,1.75,-0.6,0.2,-0.4,0.2,-0.266666667,0,1,0,3,0.33,0,1,0,-2,2,0,0,0,0,-2,2,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),57,I thought the survey was interesting and thought provoking.,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,4,9,5,8,2,6,7,1,3,4,2,3,1 +421,R_6YlMdPmRSe9svO9,53 - 59,American,,American,Male,Agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,3,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,2,4,3,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,4,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,1,4,2,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,1,5,4,2,3,6,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,3,2,5,0,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,3,2,1,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,5,4,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,3,1,4,2,5,9,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,3,4,2,8,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,5,2,1,0,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Somewhat agree,Strongly disagree,4,5,1,2,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,96,TRUE,50,FALSE,100,FALSE,59,FALSE,55,TRUE,54,FALSE,50,FALSE,100,TRUE,100,TRUE,92,FALSE,100,FALSE,61,FALSE,71,FALSE,71,TRUE,96,TRUE,50,FALSE,50,TRUE,96,TRUE,99,FALSE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,75,TRUE,100,TRUE,100,16,2,3,3,-3,3,-3,-3,3,-3,3,3,0,3,-3,3,-3,-3,-3,0,-3,3,3,3,-3,3,6,3,-3,3,-3,3,0,3,0,3,-3,3,0,-3,-3,-3,-3,-3,0,0,3,3,-3,3,9,0,-3,3,-3,3,8,3,0,3,-3,3,0,0,0,3,1,-3,3,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,99,TRUE,1,96,FALSE,1,50,TRUE,1,50,TRUE,1,96,FALSE,1,71,FALSE,1,71,FALSE,1,61,FALSE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,54,FALSE,0,55,FALSE,1,59,FALSE,1,100,TRUE,0,50,TRUE,1,96,FALSE,0,100,TRUE,1,100,0,0.3025,0.0016,0,0,0,0.25,0.25,0,0,0.0016,0.0016,0.25,0,0.25,0,0,0.25,0,0.2916,0.0064,0.25,0.1521,0.25,0.0841,0.1681,1,1,0.5625,0.0841,0.25,0.9801,0.22615,0.089514286,0.362785714,16,50,21,65.63,6,75,6,75,4,50,5,62.5,10,62.5,11,68.75,78.91,71.25,82.38,72.5,89.5,80.31,77.5,-15.63,13.28,-3.75,7.38,22.5,27,17.81,8.75,1,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,6,1,0,0.2,1.2,0,0.6,0.4,0.6,0,2.6,0.5,0.9,0.7,2,5.67,3.25,-0.2,0.6,0,-2,0.133333333,-3,-8,0,-3,-3.67,2,2,2,-2,2,2,-2,0,0,-2,2,2,10 cents,100 minutes,24 days,Male,Trade School (non-military),53,I thought it was good and interesting,1.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,4,6,5,9,2,7,8,1,3,4,3,2,1 +422,R_5QLUC9EzFyEQGLZ,67 - 73,,Canadian,Canadian,Female,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,3,2,4,5,1,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,2,4,5,3,1,Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,2,1,5,3,4,Agree,Agree,Strongly Agree,Agree,Agree,1,4,3,2,5,Somewhat agree,Neither agree nor disagree,Strongly Agree,Disagree,Strongly Agree,3,2,5,1,4,6,Somewhat disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,3,Agree,Agree,Agree,Disagree,Agree,1,4,2,3,5,2,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Agree,3,4,1,2,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Neither agree nor disagree,Agree,Strongly Agree,Neither agree nor disagree,3,4,2,1,5,9,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly disagree,4,2,1,3,5,5,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,3,5,2,1,Somewhat agree,Neither agree nor disagree,Agree,Strongly Agree,Agree,1,4,2,5,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,88,TRUE,100,TRUE,100,FALSE,58,TRUE,61,FALSE,100,TRUE,100,TRUE,100,FALSE,66,TRUE,95,FALSE,100,FALSE,93,TRUE,100,TRUE,100,FALSE,55,TRUE,100,FALSE,56,TRUE,100,FALSE,84,FALSE,100,TRUE,70,TRUE,89,FALSE,97,TRUE,100,FALSE,100,TRUE,99,TRUE,98,FALSE,78,TRUE,97,TRUE,100,FALSE,64,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,0,3,2,3,-1,-1,2,0,-1,2,2,3,0,2,2,2,3,2,2,1,0,3,-2,3,6,-1,-1,3,0,0,3,2,2,2,-2,2,2,1,1,2,-1,2,7,3,0,2,3,0,9,-2,0,2,0,-3,5,2,2,2,0,2,1,1,0,2,3,2,8,TRUE,0,88,TRUE,1,100,TRUE,0,100,FALSE,1,58,TRUE,1,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,66,TRUE,1,95,FALSE,1,100,FALSE,1,93,TRUE,1,100,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,56,TRUE,0,100,FALSE,1,84,FALSE,1,100,TRUE,1,70,TRUE,1,89,FALSE,1,97,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,0,98,FALSE,1,78,TRUE,0,97,TRUE,1,100,FALSE,0,64,TRUE,1,100,0,0.0001,0,0,0,0,0,0.0025,0,0.0121,0,0,0.4356,0,0.1521,0,0.0009,0.1764,0.0484,0,0.09,0.3025,0.0256,1,0.1936,0.9604,0.4096,0.7744,1,1,0.9409,0.0049,0.268925,0.055685714,0.482164286,24,75,23,71.88,4,50,7,87.5,5,62.5,7,87.5,13,81.25,10,62.5,89,78.12,85.12,96.38,96.38,87.44,90.56,3.12,17.12,28.12,-2.38,33.88,8.88,6.19,28.06,2,0,0,4,0,0,0,1,0,1,0,0,1,2,0,1,1,1,3,0,0,0,1,1,3,1,1,0,0,2,0,0,1,0,0,1,2,1,1,0,1.2,0.4,0.6,1.2,1,0.8,0.2,1,0.85,0.75,0.8,3.67,5,5.125,0.2,-0.4,0.4,0.2,0.066666667,-3,-2,1,-1,-1.33,0,-1,-1,1,-1,1,-1,1,-1,1,-1,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,72,it was very interesting and engaging,-0.625,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,4,6,2,7,3,8,5,1,9,4,2,3,1 +423,R_5rpijjmze8smW8X,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,4,3,5,Strongly disagree,Strongly agree,Strongly agree,Somewhat disagree,Strongly disagree,3,2,1,5,4,Strongly Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Disagree,5,3,1,4,2,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,2,4,1,1,Strongly disagree,Agree,Strongly agree,Agree,Strongly disagree,4,1,3,2,5,1,Strongly Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Disagree,1,5,2,4,3,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,Strongly disagree,1,4,5,3,2,0,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,2,5,3,1,0,Strongly Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly Disagree,1,2,4,3,5,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,5,3,2,4,FALSE,52,TRUE,56,TRUE,100,FALSE,50,FALSE,53,FALSE,54,TRUE,100,TRUE,73,TRUE,94,FALSE,76,FALSE,50,FALSE,53,FALSE,54,FALSE,100,FALSE,60,TRUE,100,FALSE,100,TRUE,95,FALSE,50,FALSE,100,TRUE,100,FALSE,55,FALSE,51,FALSE,53,FALSE,52,TRUE,100,FALSE,51,FALSE,100,FALSE,51,FALSE,52,FALSE,51,FALSE,53,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-3,-3,-3,-3,3,3,-1,-3,-3,3,3,-3,-3,-3,0,-3,-3,-3,3,3,-3,-3,-3,1,-3,2,3,2,-3,1,-3,3,3,-3,-3,1,-3,-3,-3,-3,-3,0,3,3,-3,-3,-3,0,-3,3,3,3,-3,0,-3,3,3,-3,-3,0,-3,-3,-3,-3,-3,0,FALSE,1,52,TRUE,1,56,TRUE,0,100,FALSE,1,50,FALSE,0,53,FALSE,1,54,TRUE,1,100,TRUE,1,73,TRUE,1,94,FALSE,0,76,FALSE,1,50,FALSE,1,53,FALSE,0,54,FALSE,1,100,FALSE,0,60,TRUE,1,100,FALSE,1,100,TRUE,0,95,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,55,FALSE,1,51,FALSE,0,53,FALSE,1,52,TRUE,1,100,FALSE,1,51,FALSE,1,100,FALSE,1,51,FALSE,0,52,FALSE,0,51,FALSE,0,53,0.0729,0,0,0,0.2809,0.2116,0.2809,0.5776,0,0.3025,0.2704,0.2916,0.0036,0.25,0.2809,0.1936,0.2401,0.25,0,0.2304,0,0.36,0.25,0,0,0.2401,0.2601,0.2304,1,0.9025,0.2401,0.2209,0.26315,0.245264286,0.281035714,13,40.63,21,65.63,6,75,5,62.5,5,62.5,5,62.5,7,43.75,14,87.5,69.97,57.75,64.5,78.75,78.88,70.62,69.31,-25,4.34,-17.25,2,16.25,16.38,26.87,-18.19,0,0,0,0,0,0,1,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,3,0,0,0,0,0.8,0,0.6,0,0.8,0,0.6,0.35,0.35,0.35,1,0,0.375,0,0,0,0,0,1,1,1,0,1,-2,0,-2,2,-2,1,-1,0,0,0,0,-2,10 cents,25 minutes,24 days,Male,High School (or equivalent),54,,-1.125,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,8,7,5,9,3,6,2,1,4,2,3,4,1 +424,R_3zqBtM41MgTa0Ok,67 - 73,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,2,3,Somewhat disagree,Agree,Neither agree nor disagree,Agree,Disagree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,5,3,0,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,2,5,4,3,10,Agree,Agree,Agree,Agree,Agree,1,5,4,2,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,1,3,5,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,1,5,4,2,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,3,2,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,32,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,-1,2,0,2,-2,3,3,3,3,3,10,2,-2,3,-2,0,0,2,2,2,2,2,10,3,3,3,3,3,10,3,3,3,3,3,10,3,0,0,-3,0,5,3,3,3,3,3,2,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.0001,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0.571428571,0.357142857,0.785714286,32,100,16,50,3,37.5,5,62.5,4,50,4,50,15,93.75,1,6.25,99.97,100,100,99.88,100,99.94,100,50,49.97,62.5,37.5,49.88,50,6.19,93.75,0,0,0,0,0,2,2,3,2,0,2,2,2,2,2,4,1,3,1,5,0,0,0,0,0,3,0,0,3,0,3,3,3,3,3,4,1,3,1,5,0,1.8,2,2.8,0,1.2,3,2.8,1.65,1.75,1.7,6.67,5.67,7.125,0,0.6,-1,0,-0.133333333,0,-5,8,0,1,0,0,0,0,0,2,-2,0,0,0,0,2,5 cents,100 minutes,47 days,Female,College Diploma/Certificate,73,NICE SURVEY GREAT MEMORY EXERCISE.,0,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,5,2,6,7,8,3,9,1,4,3,2,4,1 +425,R_5kWmAe2xL3wBJpn,53 - 59,American,,American,Male,Agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,2,3,4,5,1,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,3,1,4,2,Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Agree,5,3,2,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly Agree,5,3,4,2,1,Agree,Somewhat disagree,Strongly Agree,Somewhat agree,Strongly Agree,2,4,1,3,5,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,1,2,3,5,5,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,4,2,1,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Agree,Agree,Strongly Agree,1,3,4,5,2,5,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,1,3,5,4,8,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,5,1,2,4,3,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,65,TRUE,100,TRUE,100,FALSE,70,TRUE,50,TRUE,87,FALSE,100,TRUE,77,FALSE,100,TRUE,60,TRUE,62,FALSE,100,FALSE,55,TRUE,86,FALSE,90,TRUE,100,FALSE,54,TRUE,97,TRUE,97,TRUE,78,FALSE,55,TRUE,100,TRUE,66,TRUE,71,TRUE,72,FALSE,100,TRUE,100,TRUE,50,TRUE,53,TRUE,57,FALSE,81,26,2,1,2,0,3,-2,-3,3,-3,1,2,0,1,-2,2,0,0,1,1,3,2,-1,3,1,3,5,1,-3,3,-3,1,5,2,1,1,-1,3,5,0,0,0,0,0,5,2,0,2,2,3,5,-3,-3,3,-3,0,8,1,0,1,0,3,7,3,3,3,3,3,5,FALSE,1,81,TRUE,1,57,TRUE,0,53,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,72,TRUE,1,71,TRUE,1,66,TRUE,1,100,FALSE,1,55,TRUE,0,78,TRUE,1,97,TRUE,0,97,FALSE,0,54,TRUE,1,100,FALSE,1,90,TRUE,0,86,FALSE,1,55,FALSE,1,100,TRUE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,77,FALSE,1,100,TRUE,1,87,TRUE,0,50,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,0.0841,0.0169,0,0.0784,0,0,0.0529,0,0,0.16,0,0.0009,0.1156,0.2025,0,0.1849,0,0.25,0.09,0,0.1444,0.2916,0.2025,0.9409,0.01,0.25,0.1225,0.0361,0.2809,0.7396,1,0.6084,0.202989286,0.069057143,0.336921429,26,81.25,24,75,5,62.5,7,87.5,6,75,6,75,15,93.75,9,56.25,79.16,56.5,93.62,85.38,81.12,79.25,79.06,6.25,4.16,-6,6.12,10.38,6.12,-14.5,22.81,0,2,1,1,0,3,0,0,0,0,0,1,0,1,1,0,0,1,1,3,0,1,0,2,0,1,0,0,0,1,1,0,0,2,1,3,3,2,2,0,0.8,0.6,0.6,1,0.6,0.4,0.8,2,0.75,0.95,0.85,5,6.67,5.625,0.2,0.2,-0.2,-1,0.066666667,0,-3,-2,0,-1.67,1,1,1,-1,1,-1,1,-1,1,-1,1,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,58,None,0.875,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,01ITEM,02REV,7,2,5,4,3,6,9,1,8,4,2,3,1 +426,R_7Y1IbOapKud15Hb,67 - 73,,Canadian,Canadian,Male,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,4,2,3,5,1,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,3,5,2,4,1,Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,2,5,3,1,4,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Agree,Disagree,Agree,3,5,4,2,1,2,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,5,2,3,1,2,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,4,2,5,2,Agree,Agree,Strongly Agree,Agree,Strongly Agree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Agree,Disagree,Agree,3,1,5,2,4,2,Strongly disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,3,4,2,Agree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,3,5,2,1,4,2,Agree,Neither agree nor disagree,Agree,Agree,Strongly Agree,5,2,4,3,1,FALSE,94,TRUE,76,TRUE,96,FALSE,50,FALSE,92,FALSE,93,TRUE,50,TRUE,95,TRUE,50,TRUE,93,TRUE,50,FALSE,71,TRUE,93,FALSE,50,TRUE,50,TRUE,97,TRUE,50,FALSE,50,TRUE,61,FALSE,96,TRUE,69,TRUE,91,FALSE,50,TRUE,90,FALSE,50,TRUE,91,TRUE,59,FALSE,50,FALSE,50,TRUE,91,FALSE,50,TRUE,50,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,0,2,-3,1,2,-1,0,2,0,3,-2,3,3,2,3,3,3,3,2,2,-2,2,2,-3,1,2,1,1,2,2,0,3,0,3,2,2,2,3,2,3,2,3,2,2,-2,2,2,-3,2,2,0,0,2,2,0,3,-2,3,2,2,0,2,2,3,2,FALSE,1,94,TRUE,1,76,TRUE,0,96,FALSE,1,50,FALSE,0,92,FALSE,1,93,TRUE,1,50,TRUE,1,95,TRUE,1,50,TRUE,1,93,TRUE,0,50,FALSE,1,71,TRUE,1,93,FALSE,1,50,TRUE,1,50,TRUE,1,97,TRUE,0,50,FALSE,1,50,TRUE,0,61,FALSE,1,96,TRUE,1,69,TRUE,1,91,FALSE,1,50,TRUE,1,90,FALSE,1,50,TRUE,1,91,TRUE,0,59,FALSE,1,50,FALSE,1,50,TRUE,1,91,FALSE,0,50,TRUE,1,50,0.0025,0.0081,0.0009,0.25,0.25,0.0049,0.01,0.0049,0.0016,0.0081,0.0081,0.0049,0.25,0.25,0.8464,0.0576,0.25,0.25,0.25,0.25,0.0961,0.25,0.3721,0.25,0.25,0.3481,0.25,0.0036,0.9216,0.25,0.25,0.0841,0.215075,0.156892857,0.273257143,25,78.13,25,78.13,4,50,6,75,8,100,7,87.5,14,87.5,11,68.75,70.25,55.75,68.38,71.12,85.75,76.75,63.75,0,-7.88,5.75,-6.62,-28.88,-1.75,-10.75,-5,0,0,0,2,0,0,0,0,2,1,0,0,0,2,0,1,0,0,1,0,0,0,0,2,0,0,1,0,1,0,0,0,0,0,0,1,2,1,1,0,0.4,0.6,0.4,0.4,0.4,0.4,0,1,0.45,0.45,0.45,2,2,2,0,0.2,0.4,-0.6,0.2,0,0,0,0,0,0,1,2,-2,2,0,0,-1,1,-1,1,2,10 cents,25 minutes,15 days,Male,High School (or equivalent),70,interesting,1.125,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,7,9,8,6,3,4,5,1,2,4,3,2,1 +427,R_6PLPYhC0VFT9Oz7,39 - 45,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,5,1,2,3,4,Strongly disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,3,4,5,1,2,Agree,Strongly Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,5,4,2,1,3,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,1,3,4,5,Somewhat agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,4,2,3,5,1,1,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,5,4,1,Agree,Strongly Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,5,4,2,3,1,1,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,4,3,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,2,3,1,4,5,0,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,1,Agree,Strongly Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,5,4,1,3,2,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,3,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,75,TRUE,75,FALSE,50,TRUE,75,FALSE,100,TRUE,90,TRUE,90,TRUE,90,TRUE,90,FALSE,75,TRUE,90,TRUE,95,TRUE,90,FALSE,50,TRUE,100,TRUE,50,TRUE,75,TRUE,50,FALSE,90,TRUE,75,TRUE,90,FALSE,100,TRUE,90,FALSE,50,TRUE,60,FALSE,100,FALSE,60,TRUE,50,FALSE,50,TRUE,50,TRUE,60,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,0,-3,-3,0,1,-3,0,2,-3,1,0,3,2,2,2,1,1,1,3,1,0,-3,1,-3,0,1,0,0,1,2,-3,1,1,3,1,0,1,0,1,-1,3,1,3,1,0,-3,0,-3,0,1,0,0,1,2,-3,1,0,3,0,1,1,1,1,1,1,FALSE,1,100,TRUE,1,75,TRUE,0,75,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,90,TRUE,1,90,TRUE,1,90,TRUE,1,90,FALSE,1,75,TRUE,0,90,TRUE,1,95,TRUE,0,90,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,75,TRUE,0,50,FALSE,1,90,TRUE,1,75,TRUE,1,90,FALSE,1,100,TRUE,1,90,FALSE,1,50,TRUE,1,60,FALSE,1,100,FALSE,1,60,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,60,0.01,0.16,0,0.01,0.16,0,0.01,0.01,0.01,0.01,0.25,0.0025,0.01,0.0625,0.0625,0.0625,0,0.25,0.16,0.25,0.0625,0.25,0.25,0.81,0.25,0,0.25,0,0.5625,0.5625,0.25,0.81,0.191696429,0.064285714,0.319107143,24,75,23,71.88,6,75,6,75,6,75,5,62.5,14,87.5,9,56.25,76.09,67.5,75.62,80.62,80.62,76.88,75.31,3.12,4.21,-7.5,0.62,5.62,18.12,-10.62,19.06,0,0,0,0,0,0,0,0,3,0,0,0,0,1,0,2,1,2,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,1,1,0,0,0,0.6,0.2,1.4,0,0.6,0,0.6,0.55,0.3,0.425,1,0.33,1,0,0,0.2,0.8,0.066666667,1,0,1,2,0.67,1,2,2,0,0,-2,2,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,45,,1.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,4,7,8,3,5,6,2,1,9,2,3,4,1 +428,R_7XgJIuD2YuirCqG,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,1,4,2,5,3,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,1,5,3,2,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,2,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Somewhat disagree,Agree,1,5,2,3,4,5,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,3,1,5,4,2,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,3,2,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Agree,Disagree,Strongly Agree,4,5,3,2,1,5,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,2,3,4,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,2,4,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,2,4,5,TRUE,100,FALSE,54,TRUE,100,FALSE,62,FALSE,54,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,67,TRUE,100,TRUE,100,FALSE,70,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,65,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,-1,3,1,-3,2,-3,1,0,1,3,-1,3,0,0,0,0,0,2,2,2,-1,2,5,1,-3,1,-3,1,5,1,1,1,1,1,5,1,1,1,1,1,5,2,3,2,-2,3,5,0,-3,2,-3,1,5,1,1,1,1,1,2,1,1,1,1,1,4,TRUE,0,100,FALSE,0,54,TRUE,0,100,FALSE,1,62,FALSE,0,54,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,1,100,FALSE,1,70,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,0,0,0,1,0,0,0.1225,0,0,0,0,0.1089,0.2916,0.2916,1,0.1444,1,1,0,0,1,0.09,1,1,0.3025,1,1,1,1,1,0.476839286,0.211357143,0.742321429,22,68.75,17,53.13,4,50,3,37.5,5,62.5,5,62.5,13,81.25,4,25,91.47,79.75,94.25,96.25,95.62,91.44,91.5,15.62,38.34,29.75,56.75,33.75,33.12,10.19,66.5,0,1,0,0,1,0,0,1,0,0,1,0,2,2,2,1,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,0,2,2,2,1,1,1,1,1,0.4,0.2,1.4,1,0.2,0.2,1.4,1,0.75,0.7,0.725,5,4,4.5,0.2,0,0,0,0.066666667,0,0,3,1,1,1,2,2,-2,2,0,0,2,-2,-2,2,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,49,,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,4,2,9,5,6,7,8,1,3,4,2,3,1 +429,R_16XZ1yejBSDUIG5,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Disagree,Somewhat agree,2,1,3,5,4,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,1,4,3,2,5,Strongly Agree,Strongly Agree,Agree,Strongly Disagree,Strongly Agree,5,4,2,3,1,Agree,Somewhat disagree,Strongly Agree,Strongly Agree,Agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Strongly Agree,Strongly Agree,Strongly disagree,Agree,1,4,2,3,5,4,Agree,Disagree,Strongly agree,Somewhat agree,Agree,4,1,3,5,2,2,Somewhat Agree,Agree,Agree,Strongly Disagree,Agree,5,4,2,1,3,2,Agree,Disagree,Agree,Agree,Agree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat disagree,5,2,3,1,4,1,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,1,3,2,5,4,3,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,3,2,4,5,2,Agree,Somewhat disagree,Agree,Agree,Agree,5,2,3,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,65,FALSE,52,TRUE,99,TRUE,54,TRUE,67,FALSE,51,TRUE,71,FALSE,61,FALSE,84,TRUE,57,FALSE,52,TRUE,78,FALSE,56,TRUE,56,TRUE,100,TRUE,57,TRUE,59,TRUE,53,TRUE,91,TRUE,63,TRUE,100,FALSE,54,TRUE,100,TRUE,55,TRUE,100,TRUE,100,FALSE,68,TRUE,56,FALSE,52,FALSE,100,FALSE,55,TRUE,87,16,3,3,3,-2,1,1,-3,3,-2,2,3,3,2,-3,3,2,-1,3,3,2,-2,3,3,-3,2,4,2,-2,3,1,2,4,1,2,2,-3,2,2,2,-2,2,2,2,2,3,3,3,-3,-1,1,1,-3,3,-2,1,1,3,3,3,-2,3,3,2,-1,2,2,2,2,TRUE,0,87,FALSE,0,55,FALSE,1,100,FALSE,1,52,TRUE,1,56,FALSE,1,68,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,100,FALSE,1,54,TRUE,0,100,TRUE,1,63,TRUE,0,91,TRUE,1,53,TRUE,1,59,TRUE,0,57,TRUE,0,100,TRUE,0,56,FALSE,1,56,TRUE,1,78,FALSE,0,52,TRUE,0,57,FALSE,0,84,FALSE,1,61,TRUE,1,71,FALSE,1,51,TRUE,0,67,TRUE,0,54,TRUE,1,99,FALSE,0,52,TRUE,1,65,0,0.0841,0.1681,0,0.1225,0.1024,0.7056,0,0.1936,0.2704,0.0001,0.1369,0.2025,0.2116,0.1936,0.3025,0.3249,0.2304,0.4489,0.1521,0.0484,0.2209,0.3136,0.8281,0.3249,0.2401,0.2704,0.7569,0,1,0.2916,1,0.317603571,0.214071429,0.421135714,16,50,19,59.38,5,62.5,5,62.5,4,50,5,62.5,12,75,7,43.75,70.41,53.5,62.25,82.75,83.12,71.38,69.44,-9.38,11.03,-9,-0.25,32.75,20.62,-3.62,25.69,5,0,0,1,1,1,1,0,3,0,2,1,0,0,1,0,1,1,1,0,0,0,0,1,2,0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,1.4,1,0.8,0.6,0.6,0.2,0.4,0.4,0.95,0.4,0.675,3.33,1.67,2.375,0.8,0.8,0.4,0.2,0.666666667,3,3,-1,0,1.66,-1,-2,-1,-2,2,1,-1,0,0,-2,2,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),65,This was a fun survey to do.,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,4,7,9,5,6,2,3,1,8,4,2,3,1 +430,R_7W3Jss5Qy6jeZl7,60 - 66,American,,American,Female,Somewhat disagree,Agree,Neither agree nor disagree,Disagree,Disagree,4,1,2,5,3,Strongly disagree,Disagree,Strongly agree,Strongly agree,Disagree,2,1,5,3,4,Agree,Agree,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,3,5,1,2,4,Somewhat agree,Neither agree nor disagree,Agree,Agree,Disagree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Disagree,Agree,Somewhat disagree,1,2,4,5,3,7,Strongly disagree,Somewhat disagree,Agree,Strongly agree,Strongly disagree,3,1,5,2,4,4,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Disagree,Disagree,3,5,4,1,2,8,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,3,1,2,5,3,Strongly disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,1,5,3,4,2,7,Strongly agree,Strongly agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,2,3,4,1,5,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,4,1,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,62,TRUE,70,TRUE,53,TRUE,51,FALSE,50,TRUE,50,FALSE,50,TRUE,66,FALSE,100,TRUE,58,FALSE,53,FALSE,100,FALSE,55,TRUE,53,FALSE,53,TRUE,100,FALSE,55,TRUE,100,FALSE,54,FALSE,53,FALSE,58,FALSE,53,TRUE,100,TRUE,100,TRUE,81,FALSE,100,TRUE,54,TRUE,54,FALSE,55,TRUE,100,FALSE,100,14,-1,2,0,-2,-2,-3,-2,3,3,-2,2,2,0,-2,0,1,0,2,2,-2,2,2,-2,2,-1,5,-3,-1,2,3,-3,7,3,2,0,-3,-2,4,-1,-2,-1,-1,-2,8,2,2,1,-1,0,5,-3,0,3,3,-3,3,3,3,0,-2,1,7,0,-1,0,1,-2,5,FALSE,1,100,TRUE,1,100,FALSE,1,55,TRUE,0,54,TRUE,1,54,FALSE,1,100,TRUE,1,81,TRUE,1,100,TRUE,1,100,FALSE,0,53,FALSE,1,58,FALSE,1,53,FALSE,0,54,TRUE,0,100,FALSE,0,55,TRUE,1,100,FALSE,1,53,TRUE,0,53,FALSE,1,55,FALSE,1,100,FALSE,0,53,TRUE,1,58,FALSE,1,100,TRUE,1,66,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,51,TRUE,0,53,TRUE,1,70,FALSE,0,62,TRUE,1,100,0,0.25,0,0.0361,0,0,0.1156,0.2809,0,0.1764,0.09,0.2916,0,0.1764,0.2116,0,0,0.2916,0.2601,0.25,0.2809,0.3025,0.2025,1,0.2209,0.25,0.3844,0,0.2025,0.2809,0.2809,0.2209,0.206092857,0.116721429,0.295464286,14,43.75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,11,68.75,11,68.75,70.03,66.75,70.88,68.12,74.38,72.25,67.81,-25,1.28,4.25,8.38,5.62,-13.12,3.5,-0.94,3,0,2,4,1,0,1,1,0,1,1,0,0,1,2,2,2,3,3,0,3,0,1,1,2,0,2,0,0,1,1,1,0,0,1,1,1,2,1,0,2,0.6,0.8,2,1.4,0.6,0.6,1,1.35,0.9,1.125,5.33,5,5.5,0.6,0,0.2,1,0.266666667,0,4,-3,3,0.33,0,1,1,-2,2,0,0,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,61,none ,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,6,9,2,3,8,4,5,1,7,4,2,3,1 +431,R_1TAWadiw4jlO7Gg,67 - 73,American,,American,Female,Strongly agree,Agree,Disagree,Somewhat disagree,Somewhat agree,4,2,5,1,3,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Agree,2,4,5,3,1,Strongly Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,5,4,3,1,Disagree,Somewhat disagree,Disagree,Somewhat agree,Neither agree nor disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Neither agree nor disagree,Disagree,Somewhat agree,2,1,5,4,3,1,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Somewhat agree,2,5,3,4,1,1,Strongly Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,5,4,2,9,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Disagree,Disagree,Neither agree nor disagree,2,5,1,4,3,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,5,2,3,4,1,1,Strongly agree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,3,4,5,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,5,2,TRUE,92,TRUE,86,FALSE,100,TRUE,50,TRUE,85,FALSE,100,TRUE,65,TRUE,100,FALSE,92,TRUE,60,TRUE,67,TRUE,97,TRUE,77,TRUE,100,TRUE,50,TRUE,100,TRUE,78,TRUE,50,TRUE,66,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,95,TRUE,57,TRUE,98,TRUE,50,TRUE,50,TRUE,90,TRUE,93,TRUE,50,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,-2,-1,1,0,-3,2,-2,2,3,-3,3,1,3,-2,-1,-2,1,0,3,2,0,-2,1,1,0,-3,2,-2,1,1,3,-3,3,1,3,1,1,1,1,2,0,9,3,3,-2,-2,0,1,0,-3,2,-3,0,1,3,-3,3,1,3,1,0,0,0,0,0,5,TRUE,0,92,TRUE,1,86,FALSE,1,100,TRUE,0,50,TRUE,1,85,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,0,92,TRUE,1,60,TRUE,0,67,TRUE,0,97,TRUE,1,77,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,78,TRUE,0,50,TRUE,0,66,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,57,TRUE,1,98,TRUE,0,50,TRUE,0,50,TRUE,0,90,TRUE,1,93,TRUE,1,50,TRUE,1,100,0,0.0004,0,0.1225,0,0,0.0025,0.16,0,0,0.0049,0.0529,0.8464,0.4489,0.0225,0.0196,0,0.25,0.25,0.3249,0.25,0.25,0.4356,1,0.6084,0.25,0.25,0.8464,0,0.25,0.81,0.9409,0.295496429,0.129121429,0.461871429,24,75,19,59.38,3,37.5,6,75,4,50,6,75,15,93.75,4,25,79.62,63.88,85,77.75,91.88,81.31,77.94,15.62,20.24,26.38,10,27.75,16.88,-12.44,52.94,0,0,2,1,0,0,0,0,0,1,0,0,0,0,0,3,2,3,1,0,0,1,0,1,1,0,0,0,1,2,0,0,0,0,0,2,1,2,1,0,0.6,0.2,0,1.8,0.6,0.6,0,1.2,0.65,0.6,0.625,1,1,2.5,0,-0.4,0,0.6,-0.133333333,0,0,0,4,0,0,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,70,,1.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,8,5,9,7,3,6,2,1,4,3,2,4,1 +432,R_5meluxYLoVHhaVj,60 - 66,American,,American,Male,Agree,Strongly agree,Agree,Strongly disagree,Strongly agree,5,3,2,1,4,Agree,Disagree,Somewhat agree,Somewhat disagree,Agree,1,5,3,4,2,Agree,Somewhat Agree,Agree,Agree,Agree,3,4,1,2,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly Agree,Agree,4,3,1,5,2,Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly Agree,3,1,2,5,4,2,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,2,4,5,1,3,2,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,3,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,3,4,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,3,2,1,5,4,2,Agree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,2,5,1,4,2,Agree,Agree,Agree,Agree,Agree,1,2,5,4,3,2,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Agree,5,3,1,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,70,TRUE,100,TRUE,100,FALSE,100,TRUE,60,TRUE,100,FALSE,67,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,77,FALSE,100,FALSE,100,TRUE,100,TRUE,71,FALSE,100,TRUE,100,TRUE,93,FALSE,79,TRUE,100,TRUE,96,TRUE,100,TRUE,100,FALSE,68,TRUE,100,TRUE,50,TRUE,50,TRUE,100,FALSE,100,25,2,3,2,-3,3,2,-2,1,-1,2,2,1,2,2,2,0,1,1,3,2,2,3,1,-3,3,2,3,-2,3,-2,3,2,2,2,3,3,3,2,3,3,3,3,3,7,1,3,2,0,1,2,2,-2,1,-2,1,2,2,2,2,2,2,2,2,0,0,3,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,68,TRUE,1,100,TRUE,1,100,TRUE,1,96,TRUE,1,100,FALSE,1,79,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,67,TRUE,1,100,TRUE,0,60,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0.1024,0,0,0,0,0,0,0.0016,0.0441,0,0,0,0.25,0,0.1089,0,0.0841,0.0529,0,0,0.36,0.09,0,0.25,0,1,0.8649,0.114603571,0.028435714,0.200771429,25,78.13,27,84.38,6,75,7,87.5,8,100,6,75,16,100,11,68.75,90.03,75.38,96,95.88,92.88,96.06,84,-6.25,5.65,0.38,8.5,-4.12,17.88,-3.94,15.25,0,0,1,0,0,1,0,2,1,1,0,1,1,1,1,3,2,2,0,1,1,0,0,3,2,0,0,0,1,1,0,1,0,0,0,2,1,1,0,0,0.2,1,0.8,1.6,1.2,0.4,0.2,0.8,0.9,0.65,0.775,2,2,2.625,-1,0.6,0.6,0.8,0.066666667,0,0,0,5,0,0,2,2,-2,2,0,0,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),64,,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,5,3,6,2,4,8,9,1,7,2,3,4,1 +433,R_52QubOgVKMWofAS,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,4,5,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,3,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,5,4,3,1,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,2,5,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,2,3,5,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,2,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,3,2,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,5,3,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,4,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,1,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,81,TRUE,74,FALSE,69,FALSE,66,FALSE,66,FALSE,66,FALSE,64,FALSE,66,FALSE,64,FALSE,65,FALSE,63,TRUE,72,FALSE,100,FALSE,69,FALSE,61,TRUE,82,TRUE,100,FALSE,61,FALSE,56,TRUE,76,TRUE,100,FALSE,59,FALSE,56,TRUE,67,TRUE,86,FALSE,63,FALSE,64,FALSE,60,FALSE,59,FALSE,56,FALSE,56,TRUE,100,11,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,6,1,0,1,1,1,5,0,1,1,1,1,5,1,0,1,1,0,5,1,1,1,1,0,5,1,1,1,0,1,5,0,0,0,0,0,5,1,1,1,1,0,5,TRUE,0,100,FALSE,0,56,FALSE,1,56,FALSE,1,59,FALSE,0,60,FALSE,1,64,FALSE,0,63,TRUE,1,86,TRUE,1,67,FALSE,0,56,FALSE,1,59,TRUE,0,100,TRUE,1,76,FALSE,1,56,FALSE,0,61,TRUE,1,100,TRUE,0,82,FALSE,1,61,FALSE,1,69,FALSE,1,100,TRUE,1,72,FALSE,0,63,FALSE,1,65,FALSE,0,64,FALSE,1,66,FALSE,0,64,FALSE,1,66,FALSE,1,66,FALSE,1,66,FALSE,0,69,TRUE,1,74,FALSE,0,81,0.0196,0.4096,0,0.3969,0.6561,0.1296,0.4096,0.3136,0,0.3969,0.4761,0.0576,0.1089,0.1681,0.36,0.3136,0.1225,0.1681,0.1156,0.1156,0.0784,0.3721,0.0961,0.1936,0.6724,0.1156,0.0676,1,0.1936,0.1521,0.1156,1,0.284607143,0.262907143,0.306307143,11,34.38,19,59.38,6,75,5,62.5,3,37.5,5,62.5,6,37.5,13,81.25,70.22,63.88,70.75,66.12,80.12,69.5,70.94,-25,10.84,-11.12,8.25,28.62,17.62,32,-10.31,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,0.2,0.2,0.2,0.2,0.4,0.2,1,0.4,0.2,0.5,0.35,5.33,5,5.125,-0.2,0,-0.8,-0.2,-0.333333333,1,0,0,0,0.33,1,1,0,0,0,1,-1,0,0,0,0,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),62,,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,3,4,2,7,5,9,6,1,8,3,4,2,1 +434,R_3bU9o5xihZILjB9,67 - 73,American,,American,Male,Agree,Agree,Agree,Somewhat disagree,Agree,5,1,2,4,3,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,5,2,4,3,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,4,1,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,1,5,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Disagree,Agree,5,2,1,4,3,2,Agree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,4,5,3,2,2,Somewhat Agree,Agree,Agree,Agree,Agree,4,3,1,5,2,2,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat disagree,4,5,3,1,2,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,5,1,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,1,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,100,TRUE,60,FALSE,92,FALSE,56,TRUE,89,FALSE,91,TRUE,76,FALSE,95,TRUE,75,TRUE,76,FALSE,100,FALSE,75,FALSE,80,FALSE,70,TRUE,96,FALSE,57,FALSE,75,TRUE,65,FALSE,91,FALSE,75,TRUE,64,TRUE,68,TRUE,75,TRUE,70,FALSE,100,TRUE,75,FALSE,55,FALSE,76,FALSE,73,FALSE,71,22,2,2,2,-1,2,1,-1,2,-1,0,1,2,1,1,1,0,2,2,2,1,2,2,2,-2,2,2,2,-1,2,-2,1,2,1,2,2,2,2,2,1,2,1,1,1,2,2,1,1,0,0,2,1,-2,1,-2,-1,2,1,1,1,0,1,2,0,0,1,1,0,2,FALSE,1,71,FALSE,0,73,FALSE,1,76,FALSE,1,55,TRUE,1,75,FALSE,1,100,TRUE,1,70,TRUE,1,75,TRUE,1,68,TRUE,1,64,FALSE,1,75,FALSE,1,91,TRUE,1,65,FALSE,1,75,FALSE,0,57,TRUE,1,96,FALSE,1,70,FALSE,1,80,FALSE,1,75,FALSE,1,100,TRUE,1,76,TRUE,1,75,FALSE,1,95,TRUE,1,76,FALSE,1,91,TRUE,1,89,FALSE,1,56,FALSE,1,92,TRUE,0,60,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.0625,0.0121,0.0016,0.09,0,0,0.0576,0.1296,0,0.0625,0,0.1225,0.1024,0.0625,0.0625,0.5329,0.0025,0.2025,0.0064,0.0081,0.0576,0.3249,0.0625,0.0625,0.09,0.1936,0.0625,0.0841,0.0576,0.04,0.36,0.0081,0.098407143,0.095535714,0.101278571,22,68.75,29,90.63,6,75,7,87.5,8,100,8,100,14,87.5,15,93.75,78,66.75,80.12,76.88,88.25,77.12,78.88,-21.88,-12.63,-8.25,-7.38,-23.12,-11.75,-10.38,-14.87,0,0,0,1,0,1,0,0,1,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,2,0,1,1,1,1,0,1,0,1,0,0,2,1,1,1,0.2,0.6,0.6,0.6,1,0.8,0.4,1,0.5,0.8,0.65,2,2,2,-0.8,-0.2,0.2,-0.4,-0.266666667,0,0,0,0,0,0,2,1,-2,2,0,0,0,0,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),71,,1,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,5,4,7,2,6,3,9,1,8,2,3,4,1 +435,R_1RXvoqs6mVtuc0x,32 - 38,American,,American,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,4,5,1,3,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,3,2,4,1,5,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,3,5,2,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,3,5,4,2,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,3,2,4,1,1,Strongly agree,Agree,Strongly agree,Agree,Somewhat agree,1,3,5,2,4,2,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,1,3,5,4,8,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,3,5,1,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,2,1,5,4,1,Strongly agree,Agree,Strongly agree,Somewhat agree,Agree,5,4,2,1,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,4,2,3,0,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Disagree,4,5,1,2,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,75,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,75,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,100,FALSE,75,FALSE,75,TRUE,75,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,3,1,3,1,3,1,2,3,2,3,1,3,-1,-1,1,0,-2,2,3,3,3,1,1,3,2,3,2,1,2,3,2,3,1,3,8,-1,0,0,1,-2,2,2,3,3,3,1,1,3,2,3,1,2,1,3,3,3,2,3,0,1,1,1,2,-2,3,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,75,FALSE,0,100,TRUE,0,75,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,75,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,100,FALSE,0,75,FALSE,0,75,TRUE,1,75,0,0,0,0,0.0625,0.25,0,1,0,0,0.5625,1,0.0625,0.5625,0,0,0,0.25,0,0,1,0.0625,1,1,0.5625,0.5625,0.5625,1,1,1,1,1,0.482142857,0.267857143,0.696428571,25,78.13,17,53.13,4,50,4,50,4,50,5,62.5,11,68.75,6,37.5,90.62,78.12,87.5,100,96.88,92.19,89.06,25,37.49,28.12,37.5,50,34.38,23.44,51.56,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,2,2,0,2,0,0,0.6,0,0.6,0,0.2,0.4,1.2,0.3,0.45,0.375,3.67,0.67,2.25,0,0.4,-0.4,-0.6,0,0,1,8,-1,3,1,1,1,-2,2,2,-2,1,-1,-2,2,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,I think that this survey should be shorter.,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,2,9,4,7,5,6,8,1,3,2,4,3,1 +436,R_5L68C81K8u8zCKJ,46 - 52,American,,American,Male,Somewhat disagree,Strongly agree,Agree,Strongly agree,Somewhat agree,5,3,1,2,4,Somewhat agree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,1,5,3,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,5,4,3,1,2,Strongly Agree,Agree,Agree,Agree,Strongly Agree,4,5,1,3,2,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,3,2,4,1,4,Agree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,2,1,3,5,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,2,1,3,5,4,2,Somewhat agree,Agree,Agree,Strongly Agree,Strongly Agree,5,4,3,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,4,3,1,2,2,Strongly agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,3,5,2,1,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,4,5,2,1,5,Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,2,4,3,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,91,FALSE,74,FALSE,100,FALSE,95,FALSE,92,TRUE,100,FALSE,100,TRUE,81,FALSE,90,TRUE,55,TRUE,100,FALSE,100,FALSE,58,TRUE,100,FALSE,90,TRUE,100,TRUE,75,FALSE,90,FALSE,68,FALSE,95,FALSE,50,TRUE,60,TRUE,55,TRUE,80,TRUE,84,FALSE,100,TRUE,80,TRUE,50,FALSE,94,TRUE,65,FALSE,70,20,-1,3,2,3,1,1,-3,3,-1,2,3,3,3,1,2,3,2,2,2,3,-1,3,3,3,1,4,2,-3,3,-1,3,2,3,3,3,2,2,2,1,2,2,3,3,4,-1,3,3,3,1,2,3,-3,3,-2,1,1,3,3,3,2,2,5,2,1,2,3,3,4,FALSE,1,70,TRUE,1,65,FALSE,1,94,TRUE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,84,TRUE,1,80,TRUE,1,55,TRUE,1,60,FALSE,1,50,FALSE,1,95,FALSE,0,68,FALSE,1,90,TRUE,1,75,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,1,58,FALSE,1,100,TRUE,1,100,TRUE,1,55,FALSE,1,90,TRUE,1,81,FALSE,1,100,TRUE,1,100,FALSE,1,92,FALSE,1,95,FALSE,1,100,FALSE,0,74,TRUE,1,91,TRUE,1,96,0.04,0,0,0.0256,0.0016,0,0.0361,0.16,0,0.2025,0.5476,0.4624,0.2025,0.25,0.04,0.1225,0.01,0.25,0.0025,0,0,0.0625,0.1764,0.01,0.01,0.0064,0.0081,0.09,0.0036,1,0,0.0025,0.130614286,0.163228571,0.098,20,62.5,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,82.44,67,90.5,82.38,89.88,79,85.88,-25,-5.06,-20.5,3,-5.12,2.38,-8.5,-1.62,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,1,0,0,2,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0.2,0.4,0.2,0.6,0.2,0.8,0.2,0.6,0.35,0.45,0.4,2.67,2.67,3,0,-0.4,0,0,-0.133333333,2,1,-3,0,0,2,1,2,-2,2,2,-2,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),51,"it was engaging and very entertaining, i had fun completing this.",1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,5,6,4,2,7,9,3,1,8,3,4,2,1 +437,R_3ZF1F4uNVZMZuwx,46 - 52,American,,American,Female,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,3,1,5,4,2,Strongly disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,5,3,2,1,4,Somewhat Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,3,5,2,4,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,2,4,1,3,1,Disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,4,5,1,3,2,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,1,5,3,2,4,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,2,1,3,5,2,Strongly disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,1,3,4,2,5,2,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Agree,4,1,2,5,3,5,Disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,2,3,5,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,50,TRUE,60,TRUE,70,FALSE,50,FALSE,50,TRUE,70,TRUE,60,TRUE,65,FALSE,70,TRUE,70,FALSE,70,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,70,FALSE,50,FALSE,50,TRUE,64,TRUE,64,FALSE,50,TRUE,70,TRUE,70,TRUE,65,TRUE,70,FALSE,50,TRUE,65,FALSE,50,TRUE,75,TRUE,50,FALSE,50,10,3,2,1,0,2,-3,0,1,2,-1,1,-1,3,0,2,-1,0,0,-1,-1,2,2,1,0,3,2,-2,0,2,2,0,1,1,0,2,1,2,2,0,0,0,0,0,4,2,1,0,0,1,2,-3,0,1,2,0,2,1,0,3,0,2,2,-2,-2,0,-2,-2,5,FALSE,1,50,TRUE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,65,FALSE,1,50,TRUE,1,70,TRUE,1,65,TRUE,1,70,TRUE,1,70,FALSE,1,50,TRUE,0,64,TRUE,1,64,FALSE,1,50,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,70,TRUE,1,70,FALSE,1,70,TRUE,1,65,TRUE,0,60,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,70,TRUE,1,60,FALSE,0,50,TRUE,1,50,0.1225,0.09,0.09,0.09,0.25,0.25,0.1225,0.09,0.25,0.09,0.16,0.1296,0.09,0.25,0.1225,0.25,0.09,0.25,0.25,0.36,0.49,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5625,0.25,0.49,0.4096,0.248453571,0.171042857,0.325864286,10,31.25,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,59.31,52.5,61.12,61.25,62.38,63.06,55.56,-43.75,-15.69,-10,-13.88,-26.25,-12.62,-18.19,-13.19,1,0,0,0,1,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,2,0,1,1,0.4,0.6,0.6,0.6,0.8,0.2,0.2,1,0.55,0.55,0.55,1.67,2,2.5,-0.4,0.4,0.4,-0.4,0.133333333,0,-1,0,-1,-0.33,0,1,2,-1,1,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,No additional feedback,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,9,2,3,8,5,6,7,1,4,2,3,4,1 +438,R_7Ztgepj79DndxxD,46 - 52,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Agree,Strongly agree,3,5,4,2,1,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,4,5,2,1,3,Strongly Agree,Neither Agree nor Disagree,Agree,Agree,Strongly Agree,5,1,2,4,3,Strongly disagree,Disagree,Disagree,Somewhat disagree,Strongly disagree,3,2,4,1,5,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,3,5,2,1,4,3,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,2,3,1,4,5,2,Strongly Agree,Agree,Agree,Somewhat Agree,Agree,4,2,5,1,3,4,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,2,3,5,1,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Agree,Strongly Agree,4,2,1,3,5,1,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,5,4,1,2,3,2,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,5,3,4,1,3,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,2,1,5,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,70,TRUE,92,FALSE,94,TRUE,50,TRUE,81,FALSE,100,TRUE,87,TRUE,85,TRUE,75,TRUE,92,FALSE,60,TRUE,99,TRUE,90,FALSE,76,TRUE,71,TRUE,100,TRUE,50,TRUE,75,FALSE,60,FALSE,70,FALSE,50,TRUE,98,FALSE,100,TRUE,75,FALSE,80,TRUE,80,TRUE,70,FALSE,80,FALSE,79,FALSE,60,FALSE,60,TRUE,82,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,2,3,-3,-1,1,-1,2,3,0,2,2,3,-3,-2,-2,-1,-3,3,3,2,-1,3,3,-3,0,1,1,2,2,3,2,2,1,2,4,-2,0,0,-2,-2,6,3,2,2,2,3,1,-3,-1,2,-1,1,2,3,-1,3,0,3,3,-2,-1,0,0,-1,2,FALSE,1,70,TRUE,1,92,FALSE,1,94,TRUE,0,50,TRUE,1,81,FALSE,1,100,TRUE,1,87,TRUE,1,85,TRUE,1,75,TRUE,1,92,FALSE,1,60,TRUE,0,99,TRUE,1,90,FALSE,1,76,TRUE,1,71,TRUE,1,100,TRUE,0,50,TRUE,0,75,FALSE,1,60,FALSE,1,70,FALSE,0,50,TRUE,1,98,FALSE,1,100,TRUE,1,75,FALSE,1,80,TRUE,1,80,TRUE,0,70,FALSE,1,80,FALSE,1,79,FALSE,0,60,FALSE,0,60,TRUE,1,82,0.0225,0.04,0,0.0169,0.0324,0,0.0625,0.0064,0.09,0.0004,0.36,0.01,0.0625,0.16,0.0361,0.0064,0,0.25,0.04,0.04,0.25,0.0841,0.16,0.0576,0.25,0.49,0.36,0.09,0.0036,0.5625,0.0441,0.9801,0.160310714,0.076907143,0.243714286,20,62.5,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,77.84,67.25,79,82.25,82.88,79.88,75.81,-12.5,2.84,4.75,4,-5.25,7.88,-1.37,7.06,0,1,0,3,0,0,1,0,2,0,0,2,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,2,0,1,1,2,1,2,0.8,0.6,0.8,1.4,0,0.4,0.8,1.4,0.9,0.65,0.775,3,2,2.875,0.8,0.2,0,0,0.333333333,2,0,1,4,1,-1,2,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,25 minutes,36 days,Female,College Diploma/Certificate,48,,1.5,1,0,0,0,0,0,0.33,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,5,7,6,2,4,3,9,1,8,4,2,3,1 +439,R_3Jg6vBxakqFpzJ8,25 - 31,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Somewhat agree,Disagree,Agree,1,4,3,2,5,Strongly disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat disagree,2,4,5,1,3,Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,Disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,5,1,3,4,2,Somewhat disagree,Agree,Somewhat agree,Strongly disagree,Agree,3,5,1,2,4,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,5,1,4,2,3,1,Disagree,Disagree,Agree,Disagree,Somewhat Disagree,3,5,2,1,4,0,Strongly disagree,Disagree,Disagree,Disagree,Disagree,2,3,4,5,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Neither agree nor disagree,Somewhat disagree,Agree,2,1,4,3,5,2,Strongly disagree,Agree,Somewhat agree,Disagree,Neither agree nor disagree,1,5,2,4,3,1,Strongly Disagree,Disagree,Agree,Neither Agree nor Disagree,Somewhat Disagree,1,2,3,4,5,1,Disagree,Neither agree nor disagree,Disagree,Disagree,Strongly disagree,4,2,5,3,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,77,FALSE,57,TRUE,83,FALSE,54,TRUE,87,FALSE,61,TRUE,60,FALSE,54,TRUE,58,TRUE,95,FALSE,60,TRUE,91,FALSE,63,FALSE,60,FALSE,58,FALSE,57,TRUE,60,TRUE,98,FALSE,55,FALSE,56,FALSE,99,FALSE,52,TRUE,64,FALSE,53,FALSE,100,TRUE,84,FALSE,60,FALSE,62,FALSE,58,TRUE,69,FALSE,61,TRUE,94,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,-2,2,-3,1,1,-2,-1,-2,0,1,0,0,-2,-3,-3,-2,-3,-1,2,1,-3,2,1,-3,0,0,-2,0,1,-2,-2,2,-2,-1,0,-3,-2,-2,-2,-2,1,1,3,0,-1,2,2,-3,2,1,-2,0,1,-3,-2,2,0,-1,1,-2,0,-2,-2,-3,1,FALSE,1,77,FALSE,0,57,TRUE,0,83,FALSE,1,54,TRUE,1,87,FALSE,1,61,TRUE,1,60,FALSE,0,54,TRUE,1,58,TRUE,1,95,FALSE,1,60,TRUE,0,91,FALSE,0,63,FALSE,1,60,FALSE,0,58,FALSE,0,57,TRUE,0,60,TRUE,0,98,FALSE,1,55,FALSE,1,56,FALSE,0,99,FALSE,0,52,TRUE,0,64,FALSE,0,53,FALSE,1,100,TRUE,1,84,FALSE,1,60,FALSE,1,62,FALSE,1,58,TRUE,1,69,FALSE,0,61,TRUE,1,94,0.2916,0.0256,0.3249,0.16,0.0036,0.1521,0.2809,0.0025,0.1936,0.2704,0.0961,0.3969,0.1764,0.16,0.0169,0.3249,0.4096,0.2116,0.1444,0,0.9801,0.3364,0.2025,0.16,0.36,0.16,0.3721,0.0529,0.6889,0.9604,0.1764,0.8281,0.289917857,0.192535714,0.3873,5,15.63,18,56.25,5,62.5,4,50,6,75,3,37.5,7,43.75,11,68.75,68.75,57.88,73.25,78.25,65.62,68.81,68.69,-40.62,12.5,-4.62,23.25,3.25,28.12,25.06,-0.06,2,1,0,1,0,0,1,1,0,1,0,2,1,2,1,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,2,1,0,1,0,3,1,0,0,0.8,0.6,1.2,0.8,0.4,0.4,1,0.8,0.85,0.65,0.75,0.67,1.33,1,0.4,0.2,0.2,0,0.266666667,-1,0,-1,0,-0.66,0,0,-1,1,-1,0,0,0,0,0,0,0,10 cents,75 minutes,36 days,Female,High School (or equivalent),31,No comment.,-0.25,0,0,0,1,0,0,0,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,5,8,4,2,3,9,6,1,7,2,4,3,1 +440,R_3QD3B1WiwQy6b3X,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,3,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,1,3,4,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,2,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,4,2,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,3,5,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,81,TRUE,72,TRUE,86,TRUE,97,TRUE,96,TRUE,100,TRUE,86,TRUE,82,TRUE,82,TRUE,86,TRUE,82,TRUE,78,TRUE,76,TRUE,75,TRUE,69,TRUE,79,TRUE,68,TRUE,68,TRUE,75,TRUE,72,TRUE,86,TRUE,75,TRUE,87,TRUE,90,TRUE,75,TRUE,85,TRUE,80,TRUE,84,TRUE,85,TRUE,78,TRUE,79,TRUE,82,21,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,9,3,3,3,3,3,9,3,3,3,3,3,10,TRUE,0,82,TRUE,1,79,TRUE,0,78,TRUE,0,85,TRUE,1,84,TRUE,0,80,TRUE,1,85,TRUE,1,75,TRUE,1,90,TRUE,1,87,TRUE,0,75,TRUE,0,86,TRUE,1,72,TRUE,0,75,TRUE,1,68,TRUE,1,68,TRUE,0,79,TRUE,0,69,TRUE,0,75,TRUE,0,76,TRUE,1,78,TRUE,1,82,TRUE,0,86,TRUE,1,82,TRUE,0,82,TRUE,1,86,TRUE,0,100,TRUE,0,96,TRUE,0,97,TRUE,1,86,TRUE,1,72,TRUE,1,81,0.0625,0.0196,0.1024,0.0225,0.0361,0.64,0.0324,0.0169,0.5776,0.0324,0.0196,0.0784,0.01,0.5625,0.0256,0.0441,0.7396,0.7225,0.9216,0.6724,0.0484,0.1024,0.5625,0.5625,0.6241,1,0.0784,0.6724,0.6084,0.4761,0.9409,0.7396,0.412407143,0.252692857,0.572121429,21,65.63,16,50,4,50,4,50,4,50,4,50,16,100,0,0,81.12,80.5,82.12,81,80.88,79.69,82.56,15.63,31.12,30.5,32.12,31,30.88,-20.31,82.56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9.33,9.375,0,0,0,0,0,-1,0,0,0,-0.33,2,2,2,2,-2,2,-2,2,-2,2,-2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,3,8,4,2,9,5,7,1,6,2,3,4,1 +441,R_3geIBUArUehfBct,60 - 66,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,3,2,1,Somewhat agree,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,3,5,4,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,3,5,Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,3,1,4,5,8,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,4,2,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,3,1,4,2,5,8,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,5,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,5,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,5,4,0,Somewhat Agree,Somewhat Agree,Agree,Strongly Agree,Agree,1,2,3,5,4,8,Strongly Agree,Agree,Agree,Agree,Agree,3,1,4,2,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,86,FALSE,82,TRUE,82,TRUE,81,TRUE,80,TRUE,75,TRUE,77,FALSE,100,FALSE,78,TRUE,75,FALSE,73,TRUE,72,TRUE,82,FALSE,87,TRUE,79,TRUE,79,TRUE,87,FALSE,84,TRUE,76,TRUE,82,TRUE,85,TRUE,91,TRUE,98,TRUE,73,TRUE,90,FALSE,84,TRUE,80,FALSE,82,TRUE,80,TRUE,85,FALSE,90,TRUE,85,13,3,3,3,3,3,1,3,2,1,0,0,1,1,0,1,3,2,1,1,1,2,3,2,2,3,8,2,0,1,1,1,5,1,0,2,1,2,8,1,2,1,1,1,3,3,3,3,3,3,1,3,3,3,3,3,0,1,1,2,3,2,8,3,2,2,2,2,9,TRUE,0,85,FALSE,0,90,TRUE,0,85,TRUE,0,80,FALSE,0,82,TRUE,0,80,FALSE,0,84,TRUE,1,90,TRUE,1,73,TRUE,1,98,TRUE,0,91,TRUE,0,85,TRUE,1,82,TRUE,0,76,FALSE,0,84,TRUE,1,87,TRUE,0,79,TRUE,0,79,FALSE,1,87,TRUE,0,82,TRUE,1,72,FALSE,0,73,TRUE,0,75,FALSE,0,78,FALSE,1,100,TRUE,1,77,TRUE,0,75,TRUE,0,80,TRUE,0,81,TRUE,1,82,FALSE,0,82,FALSE,0,86,0.01,0.0529,0.0169,0.7056,0.7396,0.64,0.6084,0.0004,0.6724,0.5329,0.0324,0.0324,0.0729,0.8281,0.6724,0.81,0.5625,0.64,0.64,0,0.0784,0.7056,0.0169,0.5776,0.6241,0.5625,0.6724,0.7225,0.7225,0.6241,0.6561,0.7225,0.506057143,0.488885714,0.523228571,13,40.63,10,31.25,2,25,2,25,3,37.5,3,37.5,8,50,2,12.5,82.5,82.75,79.62,84,83.62,82.5,82.5,9.38,51.25,57.75,54.62,46.5,46.12,32.5,70,1,0,1,1,0,1,3,1,0,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,2,0,1,2,3,1,0,1,3,1,0,0,1,1,1,0.6,1.2,1,0.4,0,1.6,1.2,0.6,0.8,0.85,0.825,7,3,5.25,0.6,-0.4,-0.2,-0.2,0,7,5,0,-6,4,0,0,1,-2,2,2,-2,-1,1,0,0,1,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,63,,0.375,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,8,9,4,5,7,2,6,1,3,3,2,4,1 +442,R_57B2rYAOs6YLNGp,46 - 52,,Canadian,Canadian,Female,Agree,Somewhat agree,Neither agree nor disagree,Disagree,Somewhat agree,5,3,1,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,4,1,2,3,5,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,5,3,2,1,Disagree,Disagree,Somewhat disagree,Strongly disagree,Somewhat disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Agree,Disagree,Agree,4,1,5,3,2,1,Agree,Agree,Somewhat agree,Somewhat disagree,Agree,1,2,4,3,5,2,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Strongly Agree,2,5,4,3,1,7,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,2,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Somewhat agree,Disagree,Somewhat agree,5,3,4,2,1,1,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Agree,5,3,2,4,1,1,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,4,2,1,5,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,4,2,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,50,FALSE,65,TRUE,70,TRUE,65,TRUE,50,TRUE,65,FALSE,95,FALSE,65,FALSE,60,TRUE,75,TRUE,95,FALSE,60,TRUE,70,TRUE,80,FALSE,50,TRUE,90,TRUE,62,TRUE,70,TRUE,70,FALSE,50,FALSE,55,FALSE,65,TRUE,85,TRUE,95,TRUE,76,FALSE,91,TRUE,76,TRUE,50,TRUE,95,TRUE,80,FALSE,100,21,2,1,0,-2,1,0,1,1,-2,1,1,-1,3,-1,3,-2,-2,-1,-3,-1,3,2,2,-2,2,3,2,2,1,-1,2,1,1,-2,2,-1,3,2,2,2,2,2,0,7,2,2,1,-2,1,1,0,1,2,-2,2,1,1,-2,3,-2,3,1,0,0,0,-1,0,1,FALSE,1,100,TRUE,1,80,TRUE,0,95,TRUE,0,50,TRUE,1,76,FALSE,1,91,TRUE,1,76,TRUE,1,95,TRUE,1,85,FALSE,0,65,FALSE,1,55,FALSE,1,50,TRUE,1,70,TRUE,0,70,TRUE,1,62,TRUE,1,90,FALSE,1,50,TRUE,0,80,TRUE,0,70,FALSE,1,60,TRUE,1,95,TRUE,1,75,FALSE,1,60,FALSE,0,65,FALSE,1,95,TRUE,1,65,TRUE,0,50,TRUE,0,65,TRUE,0,70,FALSE,0,65,FALSE,0,50,TRUE,1,85,0.0025,0.1225,0.01,0.0576,0.0225,0.0081,0.4225,0.4225,0.16,0.0625,0.4225,0.09,0.0225,0.2025,0.0576,0.04,0.16,0.25,0.4225,0.0025,0.0025,0.1444,0.49,0.49,0.25,0.25,0.25,0,0.9025,0.64,0.49,0.25,0.247414286,0.167371429,0.327457143,21,65.63,20,62.5,4,50,7,87.5,5,62.5,4,50,12,75,8,50,72.19,62.75,74.62,78.25,73.12,74.94,69.44,3.13,9.69,12.75,-12.88,15.75,23.12,-0.06,19.44,1,1,2,0,1,2,1,0,1,1,0,1,1,0,0,4,4,3,5,1,0,1,1,0,0,0,0,1,0,1,0,1,0,1,0,2,2,1,2,1,1,1,0.4,3.4,0.4,0.4,0.4,1.6,1.45,0.7,1.075,2,1,2.125,0.6,0.6,0,1.8,0.4,2,0,1,6,1,0,2,2,-1,1,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),51,none,1.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,8,2,5,3,6,4,7,1,9,4,2,3,1 +443,R_6cOXunV51Bjkbjr,60 - 66,American,,American,Male,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,1,4,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,4,3,5,2,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,1,4,5,2,3,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,1,5,3,4,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,5,2,3,6,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,1,2,5,4,5,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Agree,3,2,4,1,5,5,Somewhat disagree,Disagree,Disagree,Somewhat disagree,Somewhat disagree,3,5,4,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,4,3,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,3,1,5,4,5,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,1,5,3,4,2,5,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,3,2,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,97,FALSE,98,TRUE,99,TRUE,100,TRUE,61,TRUE,75,TRUE,68,FALSE,94,FALSE,100,FALSE,97,FALSE,94,TRUE,100,FALSE,100,FALSE,100,FALSE,99,FALSE,100,TRUE,100,TRUE,94,FALSE,94,TRUE,100,FALSE,100,TRUE,100,TRUE,84,FALSE,100,TRUE,99,TRUE,100,TRUE,90,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,1,0,1,-1,0,0,-1,0,0,-1,2,-1,2,-2,-1,0,0,-1,-1,2,1,-1,1,6,-1,-1,0,-1,1,5,0,-1,1,-1,2,5,-1,-2,-2,-1,-1,4,-1,2,1,1,1,6,-1,-1,1,-1,1,5,0,-1,2,-1,2,5,-2,-2,-1,-1,-1,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,97,FALSE,1,98,TRUE,1,99,TRUE,1,100,TRUE,1,61,TRUE,1,75,TRUE,0,68,FALSE,1,94,FALSE,0,100,FALSE,1,97,FALSE,0,94,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,99,FALSE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,94,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,84,FALSE,1,100,TRUE,0,99,TRUE,1,100,TRUE,1,90,TRUE,1,100,0,0,0,0.0001,0,0.0004,0,0.0625,0,0.0036,0,1,0.1521,0.4624,0.0009,0,0.0036,0.25,0,0,0,0.8836,0.0001,0.0009,0,0.7056,0.01,0,1,0,0.9801,0.0036,0.197121429,0.13825,0.255992857,28,87.5,26,81.25,5,62.5,6,75,8,100,7,87.5,14,87.5,12,75,93.53,80.75,98.5,95.62,99.25,94.38,92.69,6.25,12.28,18.25,23.5,-4.38,11.75,6.88,17.69,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,2,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,1,1,0,0.2,0.4,0.2,1,0.2,0.6,0,0.6,0.45,0.35,0.4,5.33,5.33,5.125,0,-0.2,0.2,0.4,0,0,0,0,-1,0,2,2,1,-2,2,1,-1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),63,"Interesting, I would like to know the answers to the factual questions.",1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,5,3,9,2,7,8,4,1,6,4,3,2,1 +444,R_37Yheba8jAG5I0F,46 - 52,,Canadian,Canadian,Male,Agree,Somewhat agree,Disagree,Disagree,Neither agree nor disagree,2,4,3,1,5,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,1,5,4,2,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,1,2,3,5,4,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Disagree,Disagree,Somewhat disagree,3,5,2,4,1,2,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,1,5,4,3,2,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Somewhat Agree,4,5,3,1,2,3,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,2,4,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Disagree,Disagree,Neither agree nor disagree,3,5,2,4,1,2,Somewhat disagree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,2,5,4,1,3,2,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Somewhat Agree,5,4,2,3,1,1,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,1,4,3,2,FALSE,100,TRUE,100,FALSE,81,FALSE,59,TRUE,100,FALSE,100,TRUE,94,TRUE,76,TRUE,100,FALSE,100,TRUE,53,TRUE,55,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,52,TRUE,100,TRUE,65,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,55,FALSE,100,TRUE,100,FALSE,51,FALSE,51,TRUE,100,FALSE,100,FALSE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,-2,-2,0,-1,-2,2,-1,1,1,0,0,-1,1,1,2,2,1,0,2,2,-2,-2,-1,2,-1,-2,2,-2,1,2,0,0,0,-2,1,2,1,2,1,2,1,3,2,2,-2,-2,0,2,-1,-1,2,-2,0,2,1,0,0,-2,1,2,1,2,2,2,1,1,FALSE,1,100,TRUE,1,100,FALSE,1,81,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,94,TRUE,1,76,TRUE,1,100,FALSE,0,100,TRUE,0,53,TRUE,0,55,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,52,TRUE,0,100,TRUE,0,65,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,51,TRUE,0,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0.0576,0,0,0.0036,0,0,0.3025,1,0,0,1,0,0,0.2809,0,0,0,0.1681,0.2401,0,0,1,0.4225,0,0.2304,0.2401,1,0,0.0361,1,1,0.3025,0.293685714,0.196535714,0.390835714,25,78.13,22,68.75,4,50,7,87.5,6,75,5,62.5,11,68.75,11,68.75,87.25,78.5,94,99.25,77.25,95.31,79.19,9.38,18.5,28.5,6.5,24.25,14.75,26.56,10.44,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,1,0.4,0.2,0.4,0.6,0.2,0.6,0.2,0.4,0.4,0.35,0.375,2,2,2,0.2,-0.4,0.2,0.2,0,0,0,0,2,0,1,1,1,-2,2,0,0,1,-1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,47,I think I did pretty well,0.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,7,3,8,9,6,5,4,1,2,3,4,2,1 +445,R_5qQWvPnKhFCaiNv,60 - 66,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,3,5,4,2,1,Strongly disagree,Somewhat disagree,Strongly disagree,Somewhat agree,Somewhat disagree,4,5,1,2,3,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,3,5,1,2,4,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,4,3,5,2,Strongly Agree,Agree,Agree,Strongly Agree,Strongly disagree,4,1,3,5,2,2,Strongly disagree,Disagree,Strongly disagree,Somewhat agree,Strongly disagree,2,4,3,5,1,2,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,1,4,3,5,2,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,5,3,1,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly Agree,Strongly disagree,2,4,1,5,3,2,Strongly disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,4,5,3,1,2,5,Agree,Disagree,Agree,Disagree,Agree,3,2,4,1,5,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,1,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,FALSE,75,FALSE,100,TRUE,50,TRUE,100,FALSE,75,TRUE,50,FALSE,100,TRUE,75,TRUE,75,FALSE,100,TRUE,50,TRUE,75,FALSE,75,TRUE,100,FALSE,50,FALSE,50,TRUE,75,FALSE,50,FALSE,75,TRUE,100,TRUE,75,TRUE,100,TRUE,75,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,75,TRUE,100,8,3,3,3,3,-3,-3,-1,-3,1,-1,2,-1,2,0,2,-1,-1,0,-1,-1,3,2,2,3,-3,2,-3,-2,-3,1,-3,2,2,-1,2,0,2,2,1,1,1,0,-1,7,3,2,2,3,-3,2,-3,0,-3,1,-3,5,2,-2,2,-2,2,2,-1,-1,-1,-1,-1,5,TRUE,0,100,TRUE,1,75,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,75,FALSE,1,50,TRUE,1,75,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,0,75,TRUE,0,50,FALSE,1,100,TRUE,1,75,TRUE,1,75,FALSE,1,100,TRUE,1,50,FALSE,1,75,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,75,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0.0625,0,0,0.25,0,0,0.0625,0,0.0625,0.0625,0.0625,0,0.0625,0,0.25,0,0.0625,0.0625,0.25,0.25,0.25,0.0625,0.25,0.25,1,0,0.5625,0.0625,0.25,0.147321429,0.058035714,0.236607143,8,25,27,84.38,5,62.5,8,100,6,75,8,100,15,93.75,12,75,78.91,59.38,87.5,81.25,87.5,81.25,76.56,-59.38,-5.47,-3.12,-12.5,6.25,-12.5,-12.5,1.56,0,1,1,0,0,0,1,0,0,2,0,0,0,0,0,2,2,1,1,0,0,1,1,0,0,0,1,0,0,2,0,1,0,2,0,0,0,1,0,0,0.4,0.6,0,1.2,0.4,0.6,0.6,0.2,0.55,0.45,0.5,2,3,3.375,0,0,-0.6,1,-0.2,0,-3,0,2,-1,0,2,2,-2,2,0,0,-1,1,-2,2,2,5 cents,5 minutes,47 days,Female,Trade School (non-military),66,Interesting. Thanks.,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,7,4,9,5,6,8,2,1,3,2,4,3,1 +446,R_1EYu8MtTbarT1nO,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,2,5,1,4,3,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,3,1,5,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,2,4,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,3,4,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,4,5,2,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,5,2,1,3,1,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,3,2,4,5,1,6,Agree,Agree,Agree,Agree,Neither agree nor disagree,2,4,1,3,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,2,5,4,1,3,4,Agree,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,1,5,3,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,3,2,5,4,2,Strongly disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,4,1,5,3,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,93,FALSE,57,TRUE,100,TRUE,85,TRUE,100,TRUE,100,TRUE,92,TRUE,100,FALSE,76,TRUE,100,TRUE,100,TRUE,79,TRUE,65,TRUE,97,FALSE,64,TRUE,100,TRUE,74,FALSE,87,TRUE,74,TRUE,66,FALSE,100,FALSE,72,FALSE,100,FALSE,59,FALSE,61,FALSE,65,TRUE,93,TRUE,99,FALSE,57,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,2,3,2,3,3,2,3,3,3,0,3,-3,0,0,0,-3,3,3,3,3,3,2,3,3,3,2,3,1,3,1,3,1,1,6,2,2,2,2,0,10,3,3,3,2,1,4,2,2,3,3,0,4,3,3,3,-1,3,2,-3,-2,-3,-2,-3,10,TRUE,0,100,TRUE,1,100,TRUE,0,93,FALSE,1,57,TRUE,1,100,TRUE,0,85,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,79,TRUE,1,65,TRUE,1,97,FALSE,1,64,TRUE,0,100,TRUE,0,74,FALSE,1,87,TRUE,1,74,TRUE,1,66,FALSE,1,100,FALSE,0,72,FALSE,1,100,FALSE,0,59,FALSE,1,61,FALSE,1,65,TRUE,0,93,TRUE,1,99,FALSE,0,57,TRUE,1,100,0,0.3481,0.0009,0,0,0.7225,0.5184,0,0.0169,0.1156,0.0001,0,0.0064,0.0576,0,0,0,0.1849,0.1225,0,0.0676,0.1225,0.5476,0.6241,0.1296,0.1521,0.3249,1,0.8649,1,0.8649,1,0.301539286,0.115885714,0.487192857,23,71.88,21,65.63,6,75,6,75,4,50,5,62.5,13,81.25,8,50,84.84,72.75,89.5,88,89.12,86.31,83.38,6.25,19.21,-2.25,14.5,38,26.62,5.06,33.38,0,0,0,2,1,0,1,0,1,1,0,2,0,1,2,5,2,2,2,3,0,0,0,1,1,1,0,0,0,2,0,0,0,1,0,0,2,3,2,0,0.6,0.6,1,2.8,0.4,0.6,0.2,1.4,1.25,0.65,0.95,3,3.33,4.875,0.2,0,0.8,1.4,0.333333333,-2,-3,4,0,-0.33,1,2,2,-2,2,1,-1,0,0,-2,2,0,10 cents,75 minutes,24 days,Female,University - Undergraduate,52,it was thought provoking,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,7,8,9,6,5,3,4,1,2,2,3,4,1 +447,R_1FVW9WLvMYgNwug,46 - 52,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat disagree,Agree,4,3,2,5,1,Agree,Somewhat agree,Strongly agree,Disagree,Agree,4,1,3,5,2,Strongly Agree,Agree,Agree,Agree,Strongly Agree,1,4,5,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,3,5,1,Strongly Agree,Agree,Somewhat agree,Somewhat disagree,Agree,3,5,4,2,1,4,Strongly agree,Somewhat disagree,Agree,Strongly disagree,Strongly agree,3,1,2,4,5,4,Strongly Agree,Agree,Agree,Agree,Strongly Agree,3,5,2,4,1,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,4,2,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Agree,2,5,1,4,3,3,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,4,Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,1,2,4,5,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,5,2,4,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,85,TRUE,70,FALSE,50,TRUE,100,TRUE,72,TRUE,64,FALSE,50,TRUE,88,FALSE,55,FALSE,50,FALSE,54,TRUE,100,FALSE,56,TRUE,98,TRUE,73,FALSE,98,TRUE,92,TRUE,98,TRUE,90,FALSE,62,FALSE,54,TRUE,97,TRUE,97,FALSE,100,TRUE,97,FALSE,50,FALSE,57,FALSE,50,FALSE,60,27,2,2,2,-1,2,2,1,3,-2,2,3,2,2,2,3,1,1,1,1,-1,3,2,1,-1,2,4,3,-1,2,-3,3,4,3,2,2,2,3,1,0,1,1,1,-1,4,2,2,2,1,2,3,2,2,3,3,3,4,2,3,3,2,2,4,-1,0,1,2,0,6,FALSE,1,60,FALSE,0,50,FALSE,1,57,FALSE,1,50,TRUE,1,97,FALSE,1,100,TRUE,1,97,TRUE,1,97,FALSE,0,54,FALSE,0,62,TRUE,0,90,TRUE,0,98,TRUE,1,92,FALSE,1,98,TRUE,1,73,TRUE,1,98,FALSE,1,56,TRUE,0,100,FALSE,1,54,FALSE,1,50,FALSE,0,55,TRUE,1,88,FALSE,1,50,TRUE,1,64,TRUE,0,72,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,85,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0009,0,0.0004,0.0009,0,0,0.1296,0.3844,0.25,0.0144,0,0.0064,0.2916,0.81,0.0009,0.25,0.25,0.25,0.49,0.5184,0.3025,0.0729,0.2116,0.0004,0.1936,0.25,0.25,0.16,0.1849,1,0.7225,0.9604,0.284089286,0.188378571,0.3798,27,84.38,21,65.63,4,50,6,75,5,62.5,6,75,11,68.75,10,62.5,75.53,58.88,79.38,84.62,79.25,79.81,71.25,18.75,9.9,8.88,4.38,22.12,4.25,11.06,8.75,1,0,1,0,0,1,2,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,1,0,5,1,1,1,1,0,1,2,1,0,1,1,0.4,1.2,0,0.2,0.4,1.4,0.8,1,0.45,0.9,0.675,3,3.67,3.75,0,-0.2,-0.8,-0.8,-0.333333333,1,0,-3,-2,-0.67,0,2,2,-1,1,-2,2,-2,2,-2,2,-2,10 cents,100 minutes,24 days,Male,University - Undergraduate,52,nothing I want to add,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,8,3,7,2,5,4,9,1,6,3,2,4,1 +448,R_7GHD4KYhAazV2oh,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,3,1,2,5,Disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,5,3,2,Agree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,3,1,2,5,4,Agree,Agree,Agree,Agree,Somewhat disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,5,3,4,3,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,4,2,1,5,3,2,Agree,Somewhat Disagree,Agree,Disagree,Strongly Agree,4,3,2,1,5,3,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,1,2,4,2,Disagree,Disagree,Agree,Disagree,Somewhat agree,4,5,1,3,2,2,Agree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,5,1,2,3,4,1,Agree,Agree,Agree,Agree,Somewhat agree,1,4,3,5,2,TRUE,81,TRUE,96,TRUE,91,FALSE,50,TRUE,96,FALSE,100,TRUE,97,TRUE,100,TRUE,87,TRUE,93,FALSE,50,TRUE,50,TRUE,70,TRUE,60,TRUE,50,TRUE,92,TRUE,59,TRUE,92,FALSE,50,FALSE,96,TRUE,86,TRUE,77,FALSE,100,TRUE,75,FALSE,99,TRUE,81,TRUE,50,FALSE,61,TRUE,65,TRUE,96,FALSE,50,TRUE,51,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,-2,-2,1,-1,1,2,-1,3,-2,3,2,2,2,2,-1,3,3,3,2,3,4,-1,-2,1,-2,1,3,2,-1,2,-2,3,2,1,2,1,1,1,3,3,3,3,3,3,2,-2,-2,2,-2,1,2,2,-1,3,-2,3,2,2,2,2,2,1,1,TRUE,0,81,TRUE,1,96,TRUE,0,91,FALSE,1,50,TRUE,1,96,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,87,TRUE,1,93,FALSE,1,50,TRUE,0,50,TRUE,1,70,TRUE,0,60,TRUE,1,50,TRUE,1,92,TRUE,0,59,TRUE,0,92,FALSE,1,50,FALSE,1,96,TRUE,1,86,TRUE,1,77,FALSE,1,100,TRUE,1,75,FALSE,1,99,TRUE,1,81,TRUE,0,50,FALSE,1,61,TRUE,0,65,TRUE,1,96,FALSE,0,50,TRUE,1,51,0,0.0361,0.0064,0.0009,0.2401,0,0.0625,0.0049,0.0016,0.0529,0.0016,0.09,0.0169,0.25,0.0016,0.0016,0,0.25,0.1521,0.0001,0.0196,0.25,0.25,0.36,0.3481,0.25,0.25,0.6561,0.8281,0.8464,0.4225,0.25,0.209167857,0.06955,0.348785714,23,71.88,23,71.88,6,75,6,75,5,62.5,6,75,15,93.75,8,50,76.59,60.38,78.38,85,82.62,81.06,72.12,0,4.71,-14.62,3.38,22.5,7.62,-12.69,22.12,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,2,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,0,0.4,0.2,1,0.2,0.4,0,0.4,0.4,0.25,0.325,3,2,2.375,-0.2,0,0.2,0.6,0,2,1,0,2,1,2,1,1,-1,1,1,-1,-1,1,-1,1,2,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),51,,1,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,6,9,8,2,5,7,4,1,3,2,3,4,1 +449,R_5hhEfortNPO7U2k,46 - 52,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,3,2,Disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,3,4,1,5,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,4,2,5,3,1,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,2,4,3,5,1,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,1,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,3,5,1,2,4,1,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,2,4,3,5,1,Disagree,Disagree,Disagree,Disagree,Disagree,4,2,3,5,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,1,Strongly Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,3,4,5,2,1,1,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,Disagree,1,4,3,2,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,55,TRUE,77,FALSE,81,FALSE,51,TRUE,59,FALSE,100,TRUE,82,TRUE,100,TRUE,84,TRUE,87,FALSE,68,TRUE,55,TRUE,77,FALSE,88,FALSE,55,TRUE,67,FALSE,52,TRUE,81,TRUE,64,FALSE,61,FALSE,59,TRUE,75,FALSE,100,TRUE,100,FALSE,100,TRUE,75,TRUE,60,FALSE,100,TRUE,95,TRUE,65,FALSE,51,TRUE,97,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,3,3,-2,1,3,0,1,3,0,2,-1,2,-2,0,0,0,-2,3,1,3,3,3,1,1,1,3,1,1,1,3,1,2,1,2,1,-2,-2,-2,-2,-2,4,3,1,3,3,3,1,0,0,2,0,0,1,3,1,2,-2,3,1,1,1,0,-2,-2,1,FALSE,1,55,TRUE,1,77,FALSE,1,81,FALSE,1,51,TRUE,1,59,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,84,TRUE,1,87,FALSE,1,68,TRUE,0,55,TRUE,1,77,FALSE,1,88,FALSE,0,55,TRUE,1,67,FALSE,1,52,TRUE,0,81,TRUE,0,64,FALSE,1,61,FALSE,0,59,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,60,FALSE,1,100,TRUE,0,95,TRUE,1,65,FALSE,0,51,TRUE,1,97,0,0.0625,0.1089,0.0324,0.0009,0,0,0.0169,0.1521,0.0625,0.1225,0.0529,0.0256,0.1024,0.1681,0.0529,0,0.2401,0,0,0.3481,0.3025,0.4096,0.0144,0.2304,0.36,0.2601,0.2025,0.0361,0.6561,0.9025,0.3025,0.179346429,0.071207143,0.287485714,16,50,24,75,4,50,6,75,7,87.5,7,87.5,13,81.25,11,68.75,75.66,63.75,79.88,80.38,78.62,75.62,75.69,-25,0.66,13.75,4.88,-7.12,-8.88,-5.63,6.94,0,0,0,0,0,3,0,0,1,0,0,1,0,2,0,0,2,2,2,0,0,0,0,0,0,2,1,1,0,1,0,1,0,1,1,3,1,0,2,0,0,0.8,0.6,1.2,0,1,0.6,1.2,0.65,0.7,0.675,1,1,1.375,0,-0.2,0,0,-0.066666667,0,0,0,3,0,0,1,1,-1,1,-1,1,-1,1,-2,2,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,46,none,0.875,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,9,4,3,5,2,8,6,1,7,4,2,3,1 +450,R_17rJWLnwTMigMBt,60 - 66,,Canadian,Canadian,Male,Disagree,Somewhat agree,Agree,Disagree,Somewhat disagree,5,3,4,1,2,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,1,4,3,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,3,5,2,4,1,Disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,Somewhat disagree,Somewhat agree,Agree,Disagree,Disagree,2,5,1,3,4,6,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,5,3,1,7,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,2,3,5,1,4,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,3,5,1,2,4,7,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,4,2,3,8,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Strongly Agree,5,3,1,2,4,7,Disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,1,2,4,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,60,TRUE,100,TRUE,96,FALSE,86,FALSE,84,TRUE,98,FALSE,76,TRUE,92,FALSE,60,TRUE,67,TRUE,98,FALSE,57,FALSE,55,FALSE,85,FALSE,95,TRUE,100,TRUE,62,TRUE,96,FALSE,50,TRUE,64,FALSE,54,FALSE,69,TRUE,67,TRUE,75,TRUE,66,FALSE,58,TRUE,58,FALSE,72,TRUE,61,TRUE,69,FALSE,95,25,-2,1,2,-2,-1,-3,-2,1,1,0,1,-1,2,0,3,-2,-1,-1,0,0,-1,1,2,-2,-2,6,-3,-2,1,1,-1,7,1,-1,2,0,3,7,-1,-1,-1,0,0,6,-1,1,2,0,-1,7,-3,-1,1,1,0,8,1,-1,2,-2,3,7,-2,-1,-1,0,-1,6,FALSE,1,95,TRUE,1,69,TRUE,0,61,FALSE,1,72,TRUE,1,58,FALSE,1,58,TRUE,1,66,TRUE,1,75,TRUE,1,67,FALSE,0,69,FALSE,1,54,TRUE,0,64,FALSE,0,50,TRUE,0,96,TRUE,1,62,TRUE,1,100,FALSE,1,95,FALSE,1,85,FALSE,1,55,FALSE,1,57,TRUE,1,98,TRUE,1,67,FALSE,1,60,TRUE,1,92,FALSE,1,76,TRUE,1,98,FALSE,1,84,FALSE,1,86,TRUE,0,96,TRUE,1,100,FALSE,0,60,TRUE,1,96,0.0625,0.0004,0,0.1156,0.0016,0.1764,0.0064,0.4761,0.1849,0.1089,0,0.25,0.1089,0.2116,0.1764,0.0961,0.16,0.0784,0.0196,0.0576,0.0004,0.1444,0.2025,0.9216,0.0025,0.0256,0.36,0.0025,0.3721,0.0225,0.9216,0.4096,0.196364286,0.145407143,0.247321429,25,78.13,25,78.13,7,87.5,6,75,6,75,6,75,13,81.25,12,75,75.66,65.38,76.38,81.5,79.38,76.69,74.62,0,-2.47,-22.12,1.38,6.5,4.38,-4.56,-0.38,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,1,0.4,0.2,0,0.2,0.6,0.2,0.4,0.2,0.2,0.35,0.275,6.67,7.33,6.75,-0.2,0,-0.4,0,-0.2,-1,-1,0,0,-0.66,2,2,2,-2,2,-1,1,-2,2,-2,2,-2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),66,"Thought provoking, I hope I helped.",1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,3,6,5,9,8,7,2,1,4,4,3,2,1 +451,R_7hbkyFIQJB8GlLb,67 - 73,American,,American,Male,Agree,Agree,Agree,Disagree,Agree,3,5,1,2,4,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Somewhat disagree,5,2,1,3,4,Agree,Disagree,Strongly Agree,Disagree,Agree,5,1,4,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Disagree,Agree,4,5,1,3,2,0,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat disagree,3,2,4,5,1,0,Agree,Disagree,Strongly Agree,Disagree,Agree,3,2,5,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Disagree,Agree,2,4,3,1,5,0,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Somewhat disagree,4,1,2,3,5,0,Agree,Disagree,Strongly agree,Disagree,Agree,3,5,1,2,4,3,Disagree,Disagree,Neither agree nor disagree,Agree,Agree,1,2,4,3,5,FALSE,75,TRUE,100,TRUE,100,FALSE,50,TRUE,75,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,75,FALSE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-2,2,0,-2,2,-3,-1,2,-2,3,-2,2,0,0,1,1,2,2,2,2,-2,2,0,0,-3,2,-3,-1,0,2,-2,3,-2,2,0,0,0,2,0,2,5,2,2,2,-2,2,0,0,-2,2,-3,-1,0,2,-2,3,-2,2,0,-2,-2,0,2,2,3,FALSE,1,75,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.0625,0,0,0.25,0.25,0.0625,0,0,0.25,0,0,0,0.25,0.25,1,0.0625,0.25,0,0.0625,1,0,1,1,0.205357143,0.0625,0.348214286,24,75,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,87.5,62.5,93.75,93.75,100,90.62,84.38,-9.38,3.12,-25,6.25,6.25,25,-9.38,15.63,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,1,0,0,0.2,0,0.4,0,0,0,1.2,0.15,0.3,0.225,0,0,1,0,0.2,0,-0.8,0.066666667,0,0,0,2,0,0,2,2,-2,2,1,-1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,Trade School (non-military),71,,1.375,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,2,7,3,9,5,4,8,1,6,3,2,4,1 +452,R_7dENSqRpiTdY0TI,67 - 73,American,,American,Female,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,2,5,3,1,4,Somewhat disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,4,3,1,2,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,5,3,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Somewhat disagree,Strongly disagree,Disagree,4,3,1,2,5,4,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,3,5,4,2,6,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,1,3,5,2,4,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,1,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Disagree,Neither agree nor disagree,Strongly Agree,Strongly disagree,2,5,4,1,3,9,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,Strongly disagree,1,2,3,4,5,6,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,2,1,3,4,8,Somewhat disagree,Disagree,Somewhat disagree,Agree,Disagree,2,4,3,1,5,TRUE,90,TRUE,100,TRUE,64,FALSE,52,TRUE,92,FALSE,100,TRUE,100,TRUE,100,TRUE,92,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,94,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,85,FALSE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,2,0,-2,-1,0,3,-1,2,3,0,3,-3,3,1,1,1,1,-2,3,2,-1,-3,-2,5,-1,-3,3,-3,2,4,3,1,3,2,3,6,-1,1,1,1,-2,5,3,-2,0,3,-3,8,-3,2,0,1,-3,9,3,0,3,-3,3,6,-1,-2,-1,2,-2,8,TRUE,0,90,TRUE,1,100,TRUE,0,64,FALSE,1,52,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,94,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0,0.0064,0,0.0064,0,0,0.2304,0,0,0,0,0,0.0036,0,0,0,0.81,0.4096,0,0.0225,0,0.088889286,0.0888,0.088978571,30,93.75,29,90.63,8,100,8,100,7,87.5,6,75,15,93.75,14,87.5,95.91,93,97.12,98,95.5,99,92.81,3.12,5.28,-7,-2.88,10.5,20.5,5.25,5.31,1,2,3,3,0,0,3,0,2,0,0,1,0,5,0,2,0,0,0,0,1,2,2,3,1,2,2,3,2,5,0,0,0,0,0,2,3,2,1,0,1.8,1,1.2,0.4,1.8,2.8,0,1.6,1.1,1.55,1.325,5,7.67,6.375,0,-1.8,1.2,-1.2,-0.2,-3,-5,0,-3,-2.67,2,2,2,-2,2,-2,2,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,University - PhD,72,I have no comments at this time. ,2,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,4,6,8,3,7,5,2,1,9,2,4,3,1 +453,R_6lRKWj5nin6dJbr,67 - 73,American,,American,Male,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,2,1,3,5,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Agree,2,3,4,5,1,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Agree,1,2,3,5,4,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,3,4,2,5,Agree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,2,3,4,1,5,3,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat agree,1,4,3,5,2,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,5,2,1,4,3,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,5,3,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,1,5,2,2,Disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,3,2,1,5,3,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,3,2,4,5,1,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,78,TRUE,82,TRUE,77,TRUE,69,TRUE,74,TRUE,100,FALSE,92,TRUE,92,FALSE,100,TRUE,58,TRUE,87,FALSE,74,TRUE,57,FALSE,84,FALSE,95,TRUE,77,FALSE,62,FALSE,100,FALSE,73,FALSE,89,FALSE,68,TRUE,76,TRUE,61,TRUE,68,TRUE,72,FALSE,100,TRUE,60,FALSE,62,TRUE,67,TRUE,74,FALSE,100,20,2,2,2,1,0,-2,-1,0,-2,2,1,-1,2,-2,2,0,-1,0,1,-1,2,2,2,-1,0,3,-2,-1,0,-2,1,2,1,0,2,-1,2,3,-1,-1,-1,-1,-1,3,2,2,2,1,0,2,-2,-2,0,-2,1,3,1,-1,2,-1,2,1,0,0,0,0,-1,5,FALSE,1,100,TRUE,1,74,TRUE,0,67,FALSE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,72,TRUE,1,68,TRUE,1,61,TRUE,1,76,FALSE,1,68,FALSE,1,89,FALSE,0,73,FALSE,1,100,FALSE,0,62,TRUE,1,77,FALSE,1,95,FALSE,1,84,TRUE,0,57,FALSE,1,74,TRUE,1,87,TRUE,1,58,FALSE,1,100,TRUE,1,92,FALSE,1,92,TRUE,1,100,TRUE,0,74,TRUE,0,69,TRUE,0,77,TRUE,1,82,TRUE,1,78,TRUE,1,100,0.1024,0,0.0529,0.0784,0,0,0.0064,0.0576,0.0676,0.1764,0.0324,0.5329,0.1521,0.1024,0.16,0.0676,0,0.1444,0.4761,0.0064,0.0169,0.3844,0.3249,0,0.0025,0.5476,0.0484,0,0.4489,0.0256,0.5929,0.0121,0.156660714,0.107128571,0.206192857,20,62.5,25,78.13,5,62.5,6,75,8,100,6,75,14,87.5,11,68.75,79,67,86.5,85.25,77.25,76.25,81.75,-15.63,0.87,4.5,11.5,-14.75,2.25,-11.25,13,0,0,0,2,0,0,0,0,0,1,0,1,0,1,0,1,0,1,2,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0.4,0.2,0.4,0.8,0,0.4,0.2,0.4,0.45,0.25,0.35,2.67,2,2.75,0.4,-0.2,0.2,0.4,0.133333333,1,-1,2,-2,0.67,0,1,1,-2,2,-1,1,-1,1,-1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,73,I wonder how well I did on the first part...,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,3,5,9,6,7,8,4,1,2,4,3,2,1 +454,R_5CBR3UkagBtfDFr,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,5,1,4,2,3,Somewhat agree,Agree,Strongly agree,Agree,Neither agree nor disagree,2,1,5,3,4,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,4,5,3,2,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,1,3,5,4,10,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,5,3,4,2,1,4,Strongly Agree,Strongly Agree,Somewhat Disagree,Somewhat Disagree,Agree,5,4,2,3,1,8,Disagree,Disagree,Disagree,Somewhat agree,Disagree,3,2,4,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Agree,Somewhat disagree,4,1,3,2,5,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,4,1,2,5,7,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,3,2,4,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Agree,Strongly disagree,1,4,3,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,54,TRUE,90,TRUE,81,FALSE,59,TRUE,53,TRUE,85,FALSE,100,TRUE,100,FALSE,51,TRUE,54,FALSE,54,FALSE,53,FALSE,53,TRUE,100,TRUE,65,TRUE,53,TRUE,54,TRUE,84,TRUE,64,TRUE,100,FALSE,54,TRUE,100,FALSE,55,TRUE,100,TRUE,100,FALSE,100,TRUE,92,FALSE,56,TRUE,94,TRUE,55,TRUE,55,16,3,3,3,1,-1,1,2,3,2,0,3,1,3,3,3,0,0,0,1,-3,2,3,3,3,1,10,-1,3,1,3,-1,4,3,3,-1,-1,2,8,-2,-2,-2,1,-2,8,3,1,3,2,-1,5,-1,0,1,0,-1,7,1,0,1,0,1,4,-1,-1,-1,2,-3,5,TRUE,0,55,TRUE,1,55,TRUE,0,94,FALSE,1,56,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,FALSE,1,54,TRUE,0,100,TRUE,1,64,TRUE,0,84,TRUE,1,54,TRUE,1,53,TRUE,0,65,TRUE,0,100,FALSE,1,53,FALSE,1,53,FALSE,0,54,TRUE,1,54,FALSE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,85,TRUE,0,53,FALSE,1,59,TRUE,0,81,TRUE,1,90,FALSE,0,54,TRUE,1,100,0,0.0225,0.2209,0,0,0,0,0,0.2209,0.2116,0.01,0.1296,0.3025,0.2116,0.0064,0.2025,0.2401,0.1936,0.1681,0,0.2916,0.2116,0.2209,0.7056,0.4225,0.2809,0.2916,0.3025,0.8836,1,0.6561,1,0.291564286,0.123485714,0.459642857,16,50,21,65.63,5,62.5,5,62.5,5,62.5,6,75,13,81.25,8,50,74,54.25,75.88,84.75,81.12,75.62,72.38,-15.63,8.37,-8.25,13.38,22.25,6.12,-5.63,22.38,1,0,0,2,2,2,1,2,1,1,0,2,4,4,1,2,2,2,0,1,0,2,0,1,0,2,2,2,2,1,2,1,2,3,2,1,1,1,1,0,1,1.4,2.2,1.4,0.6,1.8,2,0.8,1.5,1.3,1.4,7.33,5.33,6.375,0.4,-0.4,0.2,0.6,0.066666667,5,-3,4,3,2,1,2,2,-1,1,1,-1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),43,n/a,1.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,5,2,6,4,3,7,9,1,8,2,3,4,1 +455,R_5HnHpmaeIsczeAQ,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Strongly agree,Somewhat agree,1,2,3,5,4,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,2,5,4,1,3,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,2,3,5,1,4,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,1,4,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,2,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,2,4,3,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,3,5,FALSE,68,FALSE,51,TRUE,51,TRUE,50,FALSE,51,TRUE,51,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,3,1,-2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,1,1,1,3,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,6,FALSE,1,68,FALSE,0,51,TRUE,0,51,TRUE,0,50,FALSE,0,51,TRUE,0,51,TRUE,1,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2601,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1024,0.2601,0.25,0.25,0.25,0.246171429,0.252164286,0.240178571,9,28.13,18,56.25,4,50,4,50,7,87.5,3,37.5,8,50,10,62.5,50.69,50.12,50.25,52.25,50.12,50.12,51.25,-28.12,-5.56,0.12,0.25,-35.25,12.62,0.12,-11.25,0,2,1,0,1,2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,1,3,2,3,1,2,0,0,0,0,1,1,0,2,1,2,1,1,1,1,0.8,0.4,1,1.2,2,0.4,1,1.2,0.85,1.15,1,6.33,7,6.625,-1.2,0,0,0,-0.4,0,-1,-1,1,-0.67,1,0,1,0,0,0,0,0,0,1,-1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,26,,0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,4,7,6,2,8,9,5,1,3,3,4,2,1 +456,R_7zLQPsiyRE1oW26,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Neither agree nor disagree,Agree,Somewhat agree,1,2,5,3,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,5,3,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Disagree,Somewhat agree,Disagree,Disagree,Strongly disagree,2,1,4,3,5,8,Somewhat disagree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,5,1,4,3,2,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,Disagree,4,5,1,3,2,8,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Agree,3,5,4,1,2,8,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,1,3,2,4,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,1,5,2,4,3,8,Agree,Agree,Strongly Agree,Somewhat agree,Strongly Agree,3,5,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,76,FALSE,64,TRUE,81,TRUE,100,FALSE,61,TRUE,100,TRUE,63,FALSE,100,TRUE,85,FALSE,100,TRUE,90,TRUE,65,FALSE,100,TRUE,67,TRUE,63,TRUE,82,TRUE,100,TRUE,57,TRUE,75,TRUE,100,TRUE,100,FALSE,58,TRUE,71,FALSE,63,TRUE,85,TRUE,74,TRUE,67,TRUE,100,TRUE,65,TRUE,89,FALSE,70,FALSE,100,16,2,2,0,2,1,-1,0,1,0,1,0,0,1,0,2,1,1,1,0,1,-2,1,-2,-2,-3,7,-1,2,0,2,0,8,1,1,1,3,-2,7,0,1,1,-1,2,8,2,3,0,3,2,7,1,-2,1,-1,1,8,0,0,2,1,1,7,2,2,3,1,3,8,FALSE,1,100,FALSE,0,70,TRUE,0,89,TRUE,0,65,TRUE,1,100,TRUE,0,67,TRUE,1,74,TRUE,1,85,FALSE,0,63,TRUE,1,71,FALSE,1,58,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,57,TRUE,1,100,TRUE,0,82,TRUE,0,63,TRUE,0,67,FALSE,1,100,TRUE,1,65,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,63,TRUE,0,100,FALSE,1,61,TRUE,0,100,TRUE,1,81,FALSE,0,64,TRUE,1,76,0.0225,0.1369,0,0.0676,0.0576,0.4489,0.0225,0.0841,0,0.01,0.0361,0,0.3969,0.1764,0,0.49,0,0.4225,0.1521,0,0.1225,0.1849,0.4489,0.5625,0.6724,1,0.4096,0,0.7921,0.3969,1,1,0.317389286,0.153214286,0.481564286,16,50,19,59.38,2,25,5,62.5,6,75,6,75,13,81.25,6,37.5,80.34,68,86.25,79.5,87.62,77.75,82.94,-9.38,20.96,43,23.75,4.5,12.62,-3.5,45.44,4,1,2,4,4,0,2,1,2,1,1,1,0,3,4,1,0,0,1,1,0,1,0,1,1,2,2,0,1,0,0,0,1,1,1,1,1,2,1,2,3,1.2,1.8,0.6,0.6,1,0.6,1.4,1.65,0.9,1.275,7.33,7.33,7.5,2.4,0.2,1.2,-0.8,1.266666667,0,0,0,0,0,0,0,1,-1,1,0,0,0,0,0,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,38,I don't have any,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,3,6,5,9,2,7,4,1,8,3,2,4,1 +457,R_3F5r2fdtLitN8uk,53 - 59,American,,American,Male,Strongly agree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,3,5,4,2,1,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,5,3,1,2,Strongly disagree,Strongly disagree,Disagree,Disagree,Strongly disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,5,1,3,2,4,5,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,5,3,1,2,4,3,Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,1,4,3,5,2,7,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,1,4,3,2,5,3,Disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,1,2,3,4,6,Agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,1,4,3,5,8,Disagree,Disagree,Somewhat disagree,Disagree,Strongly disagree,4,3,1,5,2,TRUE,100,TRUE,95,FALSE,100,FALSE,75,FALSE,85,FALSE,100,TRUE,100,TRUE,100,FALSE,65,TRUE,100,FALSE,75,FALSE,100,TRUE,90,FALSE,90,TRUE,55,TRUE,100,FALSE,85,FALSE,90,FALSE,85,FALSE,100,FALSE,98,TRUE,100,FALSE,75,TRUE,98,TRUE,75,TRUE,100,TRUE,75,FALSE,100,TRUE,95,TRUE,90,TRUE,85,FALSE,85,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,0,-1,-1,1,2,1,1,2,0,3,-1,3,-3,-3,-2,-2,-3,3,2,2,0,-1,1,-2,3,0,3,0,5,2,0,3,-2,3,3,-3,-3,-2,-3,-3,7,3,1,2,0,-1,2,-2,1,2,2,0,3,2,0,3,-3,3,6,-2,-2,-1,-2,-3,8,TRUE,0,100,TRUE,1,95,FALSE,1,100,FALSE,1,75,FALSE,0,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,1,90,FALSE,1,90,TRUE,1,55,TRUE,1,100,FALSE,1,85,FALSE,1,90,FALSE,1,85,FALSE,1,100,FALSE,0,98,TRUE,1,100,FALSE,1,75,TRUE,1,98,TRUE,0,75,TRUE,1,100,TRUE,0,75,FALSE,1,100,TRUE,0,95,TRUE,1,90,TRUE,1,85,FALSE,0,85,0,0,0,0,0.7225,0,0.0004,0,0,0,0.01,0.01,0.4225,0.0625,0.7225,0.0025,0.0625,0.0625,0,0.5625,0.9604,0.2025,0.0225,0.01,0.0225,0.5625,0.0225,1,0,0.01,0.9025,0,0.226992857,0.148421429,0.305564286,25,78.13,24,75,6,75,4,50,6,75,8,100,12,75,12,75,89.56,76.25,89.12,94.38,98.5,90.38,88.75,3.13,14.56,1.25,39.12,19.38,-1.5,15.38,13.75,0,0,0,0,0,1,2,2,2,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,0,0,0,2,0,1,1,1,0,0,0,1.6,0.2,0.2,0.2,0.6,0.4,0.6,0.5,0.45,0.475,3,3.67,4.375,-0.2,1,-0.2,-0.4,0.2,-1,2,-3,-1,-0.67,1,2,2,-2,2,-2,2,-1,1,-2,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,This was an interesting survey. I wish I was offered more like it. ,1.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,8,2,9,3,7,6,5,1,4,3,2,4,1 +458,R_1DP6m7WlbOvFoup,60 - 66,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Agree,Disagree,Agree,4,5,3,1,2,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,3,4,1,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,1,3,2,4,5,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,4,5,2,3,4,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,3,2,1,4,5,5,Agree,Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,3,5,4,1,2,3,Strongly disagree,Disagree,Disagree,Disagree,Disagree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Somewhat agree,Agree,5,2,4,1,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,3,2,5,4,Agree,Disagree,Agree,Disagree,Strongly agree,1,3,5,2,4,1,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,4,5,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,79,TRUE,91,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,81,TRUE,58,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,71,TRUE,85,TRUE,100,FALSE,50,FALSE,87,TRUE,84,FALSE,50,TRUE,100,TRUE,100,FALSE,100,25,1,1,2,-2,2,-1,0,2,0,1,1,0,2,-2,3,-2,-1,0,-1,-2,2,2,2,0,2,5,0,1,2,1,0,4,2,-2,2,0,3,5,-3,-2,-2,-2,-2,3,2,2,2,1,2,6,0,1,1,0,1,4,2,-2,2,-2,3,4,-2,-1,0,0,-2,1,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,84,FALSE,1,87,FALSE,0,50,TRUE,1,100,TRUE,1,85,TRUE,1,71,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,58,TRUE,1,81,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,91,TRUE,1,79,TRUE,1,100,0,0,0,0.25,0,0.0169,0,0.0841,0.25,0.0361,0.0081,0,0.0225,0.25,0.0256,0,0,0.25,0,0,0.1764,0.25,0.25,1,0.25,0.25,0.0441,0,1,0.25,1,0.25,0.202278571,0.067378571,0.337178571,25,78.13,22,68.75,4,50,7,87.5,5,62.5,6,75,14,87.5,8,50,79.25,64.25,84.88,81.5,86.38,84.31,74.19,9.38,10.5,14.25,-2.62,19,11.38,-3.19,24.19,1,1,0,2,0,1,1,0,1,1,1,2,0,2,0,1,1,2,1,0,1,1,0,3,0,1,1,1,0,0,1,2,0,0,0,0,0,0,1,0,0.8,0.8,1,1,1,0.6,0.6,0.2,0.9,0.6,0.75,4.67,4.67,4,-0.2,0.2,0.4,0.8,0.133333333,-1,0,1,2,0,1,2,2,-2,2,-1,1,-2,2,-2,2,0,10 cents,25 minutes,15 days,Female,College Diploma/Certificate,61,math is not my strong area,1.5,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,9,4,8,5,3,6,2,1,7,3,4,2,1 +459,R_1ar5XFCcTOQEkYV,32 - 38,American,,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,3,2,4,1,5,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,1,2,5,4,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,4,1,3,5,2,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat agree,3,2,1,4,5,Agree,Somewhat agree,Strongly Agree,Somewhat agree,Agree,5,1,2,4,3,8,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,2,4,5,3,1,8,Strongly Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,2,3,1,5,4,6,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,4,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Agree,Strongly Agree,3,4,1,5,2,5,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,4,1,5,3,5,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,Agree,2,5,3,1,4,8,Strongly Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,2,1,5,4,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,77,TRUE,87,FALSE,59,TRUE,100,TRUE,92,TRUE,62,FALSE,61,TRUE,65,FALSE,58,TRUE,69,TRUE,69,FALSE,71,TRUE,67,FALSE,59,TRUE,100,TRUE,77,FALSE,98,FALSE,71,FALSE,65,TRUE,86,FALSE,83,FALSE,73,TRUE,96,FALSE,75,TRUE,83,FALSE,88,TRUE,90,FALSE,83,TRUE,100,FALSE,70,TRUE,90,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,2,1,-1,2,-1,0,3,1,1,2,2,2,1,2,3,1,2,1,3,1,2,8,1,0,2,0,2,8,3,2,1,2,1,6,-1,1,1,1,0,9,2,1,2,2,3,5,0,2,1,-1,1,5,1,1,3,2,2,8,3,1,0,1,2,8,TRUE,0,100,FALSE,0,77,TRUE,0,87,FALSE,1,59,TRUE,1,100,TRUE,0,92,TRUE,1,62,FALSE,0,61,TRUE,1,65,FALSE,0,58,TRUE,0,69,TRUE,0,69,FALSE,0,71,TRUE,0,67,FALSE,0,59,TRUE,1,100,TRUE,0,77,FALSE,1,98,FALSE,1,71,FALSE,1,65,TRUE,1,86,FALSE,0,83,FALSE,1,73,TRUE,1,96,FALSE,1,75,TRUE,1,83,FALSE,1,88,TRUE,0,90,FALSE,1,83,TRUE,1,100,FALSE,0,70,TRUE,1,90,0.3721,0.0289,0,0.1444,0.01,0.8464,0.0016,0.3364,0.1225,0.6889,0,0.5041,0.1225,0.4761,0,0.5929,0.0729,0.1681,0.81,0.0625,0.0196,0.3481,0.0841,0.4489,0.5929,0.0144,0.49,1,0.7569,0.0004,0.0289,0.4761,0.324114286,0.2816,0.366628571,16,50,17,53.13,4,50,5,62.5,4,50,4,50,9,56.25,8,50,78.88,69.75,84,78.25,83.5,78.81,78.94,-3.13,25.75,19.75,21.5,28.25,33.5,22.56,28.94,0,2,0,0,0,0,1,0,1,2,0,1,0,0,1,3,0,1,2,1,0,2,1,1,1,1,3,1,0,1,2,0,2,0,0,1,0,2,2,1,0.4,0.8,0.4,1.4,1,1.2,0.8,1.2,0.75,1.05,0.9,7.33,6,7.125,-0.6,-0.4,-0.4,0.2,-0.466666667,3,3,-2,1,1.33,0,2,1,-2,2,0,0,0,0,1,-1,1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),36,It was a fun survey,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,2,6,3,4,8,7,9,1,5,3,2,4,1 +460,R_3ALShty7HyVU7Cj,18 - 24,American,,American,Male,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,1,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,3,1,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,4,1,2,3,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,3,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,4,3,1,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,5,3,8,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,3,4,2,5,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,2,4,3,TRUE,74,TRUE,81,TRUE,93,TRUE,85,TRUE,84,TRUE,78,TRUE,94,TRUE,82,FALSE,59,FALSE,71,FALSE,67,TRUE,80,FALSE,70,TRUE,74,FALSE,76,TRUE,73,TRUE,71,FALSE,86,TRUE,70,TRUE,83,TRUE,69,TRUE,69,TRUE,69,TRUE,68,TRUE,81,TRUE,69,TRUE,67,TRUE,76,TRUE,68,TRUE,72,TRUE,75,TRUE,80,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,1,1,1,1,1,8,1,1,0,1,0,8,1,1,1,1,1,8,0,0,0,0,0,9,1,1,0,0,1,8,0,0,1,1,0,8,TRUE,0,74,TRUE,1,81,TRUE,0,93,TRUE,0,85,TRUE,1,84,TRUE,0,78,TRUE,1,94,TRUE,1,82,FALSE,0,59,FALSE,0,71,FALSE,1,67,TRUE,0,80,FALSE,0,70,TRUE,0,74,FALSE,0,76,TRUE,1,73,TRUE,0,71,FALSE,1,86,TRUE,0,70,TRUE,0,83,TRUE,1,69,TRUE,1,69,TRUE,0,69,TRUE,1,68,TRUE,0,81,TRUE,1,69,TRUE,0,67,TRUE,0,76,TRUE,0,68,TRUE,1,72,TRUE,1,75,TRUE,1,80,0.0324,0.0961,0.0729,0.0036,0.04,0.6084,0.1024,0.5041,0.6889,0.0961,0.0784,0.49,0.3481,0.1089,0.0256,0.0361,0.4761,0.7225,0.5776,0.6561,0.0961,0.5776,0.49,0.5476,0.5041,0.4489,0.0625,0.5476,0.8649,0.0196,0.4624,0.64,0.38645,0.308971429,0.463928571,18,56.25,14,43.75,3,37.5,3,37.5,4,50,4,50,12,75,2,12.5,75.44,72.5,73.62,77.25,78.38,74.5,76.38,12.5,31.69,35,36.12,27.25,28.38,-0.5,63.88,0,0,0,0,1,0,0,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0.2,0.2,1,0.6,0.8,0.2,0.6,0.4,0.5,0.5,0.5,8.33,8.33,8.25,-0.6,0,0.4,0.2,-0.066666667,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,22,it was long,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,8,9,5,4,6,7,1,3,2,4,3,1 +461,R_5RHvl8v1OXQu9uV,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,2,4,5,1,3,Somewhat agree,Disagree,Agree,Somewhat disagree,Agree,3,4,2,1,5,Somewhat Agree,Disagree,Agree,Disagree,Agree,3,1,2,5,4,Agree,Somewhat agree,Agree,Agree,Agree,1,3,4,2,5,Somewhat agree,Strongly Agree,Agree,Strongly disagree,Somewhat agree,5,1,3,4,2,3,Agree,Disagree,Agree,Somewhat disagree,Agree,4,5,2,3,1,3,Somewhat Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,3,1,2,5,4,0,Agree,Agree,Somewhat agree,Agree,Agree,1,4,3,5,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Agree,Somewhat disagree,1,5,3,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,3,4,2,1,4,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Agree,5,3,2,1,4,4,Agree,Agree,Agree,Agree,Agree,3,2,5,4,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,28,2,3,3,-1,1,1,-2,2,-1,2,1,-2,2,-2,2,2,1,2,2,2,1,3,2,-3,1,3,2,-2,2,-1,2,3,1,1,2,-2,3,0,2,2,1,2,2,4,2,3,2,2,-1,5,0,0,1,-1,0,4,1,-1,2,-2,2,4,2,2,2,2,2,0,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,0,1,1,1,0.285714286,0,0.571428571,28,87.5,24,75,5,62.5,7,87.5,6,75,6,75,15,93.75,9,56.25,100,100,100,100,100,100,100,12.5,25,37.5,12.5,25,25,6.25,43.75,1,0,1,2,0,1,0,0,0,0,0,3,0,0,1,0,1,1,0,0,0,0,1,3,2,1,2,1,0,2,0,1,0,0,0,0,1,0,0,0,0.8,0.2,0.8,0.4,1.2,1.2,0.2,0.2,0.55,0.7,0.625,2,4.33,2.875,-0.4,-1,0.6,0.2,-0.266666667,-2,-1,-4,4,-2.33,2,2,-1,-2,2,-2,2,1,-1,-2,2,-2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,48,It's interesting to get opinions. Hard to know what the world is thinking without feedback. Surveys help with that process.,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,9,2,7,8,3,6,5,1,4,4,2,3,1 +462,R_1cs6UyRYsp5Jla9,46 - 52,American,,American,Female,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,5,2,4,1,3,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,4,1,3,2,5,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,5,3,2,1,Agree,Agree,Agree,Somewhat agree,Agree,3,5,1,4,2,Disagree,Agree,Agree,Agree,Agree,4,2,3,5,1,0,Somewhat agree,Disagree,Agree,Somewhat agree,Agree,1,3,5,4,2,0,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,4,2,3,1,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,3,4,5,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Agree,Agree,Agree,2,5,4,1,3,0,Agree,Disagree,Strongly agree,Somewhat agree,Agree,1,4,5,2,3,1,Agree,Agree,Agree,Strongly Agree,Strongly Agree,3,2,1,4,5,0,Agree,Agree,Agree,Agree,Agree,2,1,4,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,74,TRUE,87,TRUE,51,FALSE,76,FALSE,82,TRUE,59,FALSE,51,FALSE,53,FALSE,51,FALSE,54,FALSE,54,FALSE,53,FALSE,54,TRUE,55,FALSE,59,TRUE,52,TRUE,57,TRUE,100,TRUE,89,TRUE,100,FALSE,52,TRUE,100,TRUE,62,TRUE,95,TRUE,98,TRUE,70,TRUE,67,FALSE,72,TRUE,71,TRUE,74,TRUE,75,16,0,2,2,1,2,1,-3,3,-2,2,2,2,2,0,3,2,2,2,1,2,-2,2,2,2,2,0,1,-2,2,1,2,0,2,1,3,0,3,0,3,3,3,3,1,10,-1,2,2,2,2,0,2,-2,3,1,2,1,2,2,2,3,3,0,2,2,2,2,2,1,TRUE,0,75,TRUE,1,74,TRUE,0,71,FALSE,1,72,TRUE,1,67,TRUE,0,70,TRUE,1,98,TRUE,1,95,TRUE,1,62,TRUE,1,100,FALSE,1,52,TRUE,0,100,TRUE,1,89,TRUE,0,100,TRUE,1,57,TRUE,1,52,FALSE,1,59,TRUE,0,55,FALSE,1,54,FALSE,1,53,FALSE,0,54,FALSE,0,54,FALSE,1,51,FALSE,0,53,FALSE,1,51,TRUE,1,59,FALSE,1,82,FALSE,1,76,TRUE,0,51,TRUE,1,87,TRUE,1,74,TRUE,1,100,0.0025,0.1681,0.2304,0.0004,0,0.49,0.2809,0,0.2209,0.2916,0.0169,0.0121,0.1444,0.2304,0.1089,0.0676,0.2401,0.0784,0.0576,0.2401,0.2916,0.1849,0.2116,1,0.1681,0.0324,0.0676,0.5625,0.5041,0.3025,0.2601,1,0.252332143,0.155871429,0.348792857,16,50,22,68.75,8,100,5,62.5,4,50,5,62.5,13,81.25,9,56.25,70.22,65.88,67.62,74,73.38,73.44,67,-18.75,1.47,-34.12,5.12,24,10.88,-7.81,10.75,2,0,0,1,0,0,1,1,3,0,0,1,1,0,0,1,1,1,2,1,1,0,0,1,0,1,1,0,3,0,0,0,0,3,0,0,0,0,1,0,0.6,1,0.4,1.2,0.4,1,0.6,0.2,0.8,0.55,0.675,0,0.33,1.5,0.2,0,-0.2,1,0,0,-1,0,9,-0.33,2,2,2,-2,2,-1,1,-1,1,1,-1,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,50,I would like to know how Idid on the three questions.,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,5,7,8,3,4,6,9,1,2,3,2,4,1 +463,R_7EhzEr2Y4MmMbh1,18 - 24,,Canadian,Canadian,Male,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly disagree,3,1,2,4,5,Strongly agree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,5,2,3,1,Somewhat Agree,Strongly Disagree,Agree,Agree,Disagree,3,4,1,5,2,Disagree,Neither agree nor disagree,Agree,Strongly disagree,Somewhat agree,3,1,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly disagree,Somewhat disagree,Somewhat disagree,Strongly Agree,Agree,3,4,1,5,2,3,Disagree,Somewhat agree,Disagree,Somewhat agree,Strongly agree,5,1,2,4,3,3,Disagree,Neither Agree nor Disagree,Strongly Agree,Disagree,Agree,4,1,5,2,3,4,Disagree,Agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,3,2,4,5,1,4,Neither agree nor disagree,Disagree,Strongly agree,Somewhat agree,Agree,1,4,2,3,5,8,Strongly Disagree,Strongly agree,Agree,Somewhat Disagree,Disagree,5,2,4,1,3,5,Disagree,Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,3,2,4,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,58,TRUE,64,TRUE,82,FALSE,57,TRUE,91,TRUE,54,TRUE,87,FALSE,63,TRUE,64,FALSE,82,TRUE,90,FALSE,64,TRUE,87,TRUE,71,TRUE,93,FALSE,84,TRUE,80,TRUE,60,FALSE,65,TRUE,80,FALSE,69,TRUE,91,TRUE,60,FALSE,80,TRUE,69,FALSE,91,TRUE,70,FALSE,83,TRUE,93,FALSE,70,TRUE,87,FALSE,65,26,-2,0,3,1,-3,3,-2,2,-1,0,1,-3,2,2,-2,-2,0,2,-3,1,-3,-1,-1,3,2,6,-2,1,-2,1,3,3,-2,0,3,-2,2,3,-2,2,0,3,0,4,3,-1,1,-2,1,10,0,-2,3,1,2,4,-3,3,2,-1,-2,8,-2,2,3,0,1,5,FALSE,1,65,TRUE,1,87,FALSE,1,70,TRUE,0,93,FALSE,0,83,TRUE,0,70,FALSE,0,91,TRUE,1,69,FALSE,0,80,TRUE,1,60,TRUE,0,91,FALSE,1,69,TRUE,1,80,FALSE,1,65,TRUE,1,60,TRUE,1,80,FALSE,1,84,TRUE,0,93,TRUE,0,71,TRUE,0,87,FALSE,0,64,TRUE,1,90,FALSE,1,82,TRUE,1,64,FALSE,1,63,TRUE,1,87,TRUE,0,54,TRUE,0,91,FALSE,1,57,TRUE,1,82,TRUE,1,64,FALSE,0,58,0.0961,0.0169,0.04,0.8281,0.3364,0.49,0.1296,0.16,0.7569,0.01,0.0324,0.04,0.64,0.8281,0.6889,0.0169,0.0324,0.8649,0.8281,0.1369,0.4096,0.16,0.5041,0.1225,0.0256,0.2916,0.1296,0.1225,0.09,0.8649,0.1849,0.0961,0.321175,0.359035714,0.283314286,26,81.25,19,59.38,3,37.5,4,50,6,75,6,75,11,68.75,8,50,75.12,75,72.25,76.75,76.5,74.94,75.31,21.87,15.74,37.5,22.25,1.75,1.5,6.19,25.31,1,1,4,2,5,5,3,4,2,3,3,3,1,4,4,0,2,2,6,1,5,1,2,3,4,3,0,1,2,2,4,6,0,3,0,0,2,1,3,0,2.6,3.4,3,2.2,3,1.6,2.6,1.2,2.8,2.1,2.45,4,7.33,5.375,-0.4,1.8,0.4,1,0.6,-4,-1,-5,-1,-3.33,0,1,2,1,-1,-2,2,-1,1,2,-2,1,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,22,nice survey,0.5,0,0,0,1,0,0,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,3,2,5,9,8,6,7,1,4,4,2,3,1 +464,R_572QfiahRx8w0ez,46 - 52,American,,American,Male,Disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,2,3,4,5,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,5,1,2,4,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Somewhat Agree,4,1,2,3,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Disagree,Agree,Somewhat disagree,Disagree,Somewhat disagree,4,5,1,3,2,2,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,4,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Disagree,Neither Agree nor Disagree,5,2,1,3,4,8,Strongly disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Agree,3,5,4,1,2,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,4,5,3,2,2,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Somewhat Agree,2,5,1,3,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,96,TRUE,85,TRUE,50,FALSE,80,TRUE,50,TRUE,75,FALSE,50,TRUE,65,FALSE,50,TRUE,65,FALSE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,59,TRUE,100,FALSE,50,FALSE,65,TRUE,90,FALSE,65,FALSE,75,TRUE,55,FALSE,50,TRUE,85,TRUE,80,FALSE,65,FALSE,50,FALSE,50,TRUE,60,TRUE,60,FALSE,50,20,-2,1,1,-2,1,1,1,2,1,1,-1,-2,3,-2,1,1,1,2,1,1,-2,2,-1,-2,-1,3,2,1,1,1,-1,2,0,-1,3,-2,0,4,-3,-1,-1,1,-2,8,-2,1,-1,-1,2,1,2,-1,2,-1,0,1,-1,0,3,-3,1,2,1,1,1,2,2,3,FALSE,1,50,TRUE,1,60,TRUE,0,60,FALSE,1,50,FALSE,0,50,FALSE,1,65,TRUE,1,80,TRUE,1,85,FALSE,0,50,TRUE,1,55,FALSE,1,75,FALSE,1,65,TRUE,1,90,FALSE,1,65,FALSE,0,50,TRUE,1,100,FALSE,1,59,FALSE,1,50,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,65,FALSE,1,50,TRUE,1,65,FALSE,1,50,TRUE,1,75,TRUE,0,50,FALSE,1,80,TRUE,0,50,TRUE,1,85,TRUE,1,96,TRUE,1,90,0.0225,0.0625,0,0.04,0.01,0.1225,0.1225,0.2025,0,0.1225,0.0225,0.01,0.25,0.0625,0.25,0.16,0.25,0.25,0.04,0.25,0.25,0.25,0.25,0.1225,0.1681,0.25,0.0016,0.25,0.36,0.25,0.25,0.1225,0.166060714,0.131071429,0.20105,20,62.5,24,75,4,50,5,62.5,8,100,7,87.5,12,75,12,75,66.09,60.12,63,61.25,80,71.62,60.56,-12.5,-8.91,10.12,0.5,-38.75,-7.5,-3.38,-14.44,0,1,2,0,2,1,0,1,0,2,1,1,0,0,1,4,2,3,0,3,0,0,2,1,1,1,2,0,2,1,0,2,0,1,0,0,0,1,1,1,1,0.8,0.6,2.4,0.8,1.2,0.6,0.6,1.2,0.8,1,3,1.33,3,0.2,-0.4,0,1.8,-0.066666667,2,1,2,5,1.67,1,2,2,-2,2,-1,1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,Trade School (non-military),52,,1.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,9,2,4,8,7,5,3,1,6,2,3,4,1 +465,R_7KvDmDr5mNTxPd2,60 - 66,,Canadian,Canadian,Female,Strongly agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,3,4,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,4,2,3,1,5,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Disagree,2,4,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Disagree,3,5,2,4,1,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,4,2,3,1,5,6,Somewhat Agree,Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,4,1,5,3,2,8,Disagree,Disagree,Disagree,Disagree,Neither agree nor disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Agree,3,4,5,1,2,5,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,3,1,5,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Agree,5,3,2,1,4,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,2,4,FALSE,100,TRUE,85,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,91,TRUE,100,TRUE,100,TRUE,100,FALSE,71,FALSE,93,TRUE,82,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,100,FALSE,80,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,75,TRUE,50,FALSE,82,TRUE,89,TRUE,86,TRUE,50,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,1,1,-1,-1,1,0,1,0,0,2,-2,1,-1,0,-1,-1,-2,1,2,1,0,-2,8,0,0,1,2,-1,4,1,2,-1,0,2,6,-2,-2,-2,-2,0,8,2,3,0,1,2,4,0,-2,2,-1,0,5,0,0,2,-3,2,3,0,0,1,0,0,6,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,71,FALSE,1,93,TRUE,1,82,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,80,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,0,50,FALSE,1,82,TRUE,0,89,TRUE,1,86,TRUE,1,50,TRUE,1,100,0,0.0625,0,0.0081,0,0,0,0,0,0,0.0196,0.0324,0,0.0841,0,0.0225,0.25,0.25,0.0324,0,0.64,0.25,0.25,1,0.25,0.25,0.25,0,0,1,0.7921,0.0049,0.192071429,0.047042857,0.3371,22,68.75,26,81.25,7,87.5,5,62.5,6,75,8,100,15,93.75,11,68.75,83.88,63.25,81.38,95.75,95.12,87.44,80.31,-12.5,2.63,-24.25,18.88,20.75,-4.88,-6.31,11.56,2,0,0,1,3,1,1,0,2,2,1,2,3,2,1,1,2,1,1,2,1,1,1,0,1,1,1,1,1,1,0,0,0,1,1,1,0,2,1,2,1.2,1.2,1.8,1.4,0.8,1,0.4,1.2,1.4,0.85,1.125,6,4,5.5,0.4,0.2,1.4,0.2,0.666666667,4,-1,3,2,2,0,1,1,-1,1,-1,1,-1,1,-1,1,1,5 cents,5 minutes,24 days,Female,University - Undergraduate,66,"It's more difficult to project into the future since I'll be an older senior at that point, and I have no way of predicting many factors in that time range. ",0.875,1,1,0,0,0,1,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,8,7,3,6,5,4,2,1,9,4,2,3,1 +466,R_5MFNOcgzXAWhKb2,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,2,1,3,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,5,2,4,1,3,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,4,3,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,5,1,4,3,7,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat agree,1,4,2,3,5,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,5,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,1,4,3,5,Somewhat agree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,3,2,1,4,9,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,1,5,2,4,6,Strongly Agree,Agree,Agree,Agree,Agree,2,4,3,1,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,55,TRUE,63,TRUE,69,FALSE,50,TRUE,50,TRUE,66,TRUE,84,FALSE,50,TRUE,57,FALSE,50,FALSE,50,TRUE,55,TRUE,81,FALSE,50,TRUE,50,TRUE,86,TRUE,76,TRUE,100,FALSE,91,TRUE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,56,TRUE,65,FALSE,97,FALSE,50,TRUE,92,7,3,3,3,3,2,0,0,2,1,1,2,3,3,2,3,1,1,1,0,0,2,3,3,3,2,7,0,0,3,3,1,5,3,2,3,3,3,5,1,0,1,0,0,5,3,3,3,3,3,5,1,2,3,1,3,9,3,3,3,2,3,6,3,2,2,2,2,9,TRUE,0,92,FALSE,0,50,FALSE,1,97,TRUE,0,65,TRUE,1,56,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,91,TRUE,0,100,TRUE,1,76,TRUE,0,86,TRUE,1,50,FALSE,0,50,TRUE,0,81,TRUE,0,55,FALSE,1,50,FALSE,1,50,TRUE,1,57,FALSE,0,50,TRUE,0,84,TRUE,1,66,TRUE,0,50,FALSE,0,50,TRUE,0,69,TRUE,0,63,TRUE,0,55,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.25,0.25,0.25,0,0.25,0.1156,0,0.25,0.25,0,0.0576,0.25,0.0081,0.1936,0.25,0.7056,0.4225,0.3969,0.25,0.1849,0.25,0.25,0.7396,0.6561,0.4761,0.25,0.8464,0.0009,0.3025,0.3025,1,0.309246429,0.196642857,0.42185,7,21.88,14,43.75,3,37.5,5,62.5,1,12.5,5,62.5,9,56.25,5,31.25,66.97,59.38,69.88,66.62,72,62.81,71.12,-21.87,23.22,21.88,7.38,54.12,9.5,6.56,39.87,1,0,0,0,0,0,0,1,2,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,1,2,1,0,2,1,0,0,0,0,2,1,1,2,2,0.2,0.6,0.6,0.2,0.2,1.2,0.2,1.6,0.4,0.8,0.6,5.67,6.67,6.375,0,-0.6,0.4,-1.4,-0.066666667,2,-4,-1,-4,-1,1,2,1,-2,2,2,-2,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),36,thanks,0.5,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,9,2,6,8,5,3,7,1,4,2,4,3,1 +467,R_1nSHXHHFpEvrozL,25 - 31,,Canadian,Canadian,Female,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,1,4,5,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,3,1,2,4,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,1,4,2,5,3,Somewhat disagree,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,5,3,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat disagree,Agree,Somewhat agree,Agree,Strongly Agree,1,3,2,5,4,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,2,5,1,4,3,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Agree,1,2,5,4,3,4,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,Strongly disagree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,4,5,3,2,Disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,2,1,3,4,5,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,1,2,3,5,4,5,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,Strongly disagree,3,1,2,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,74,FALSE,50,FALSE,75,TRUE,59,TRUE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,92,FALSE,98,TRUE,69,FALSE,95,TRUE,50,FALSE,50,TRUE,79,FALSE,50,TRUE,100,FALSE,50,TRUE,50,TRUE,73,TRUE,76,FALSE,50,TRUE,50,FALSE,50,TRUE,99,TRUE,99,FALSE,50,TRUE,100,FALSE,74,TRUE,69,TRUE,50,TRUE,50,16,1,2,0,1,0,-1,0,0,1,0,1,0,2,1,2,-1,-1,-3,-2,-3,-1,2,1,2,3,3,-1,0,0,2,1,3,1,0,0,2,2,3,-1,-1,-2,-1,-3,4,2,2,0,1,1,0,-2,0,0,2,1,2,0,0,2,1,1,0,-1,-1,-2,-1,-3,5,TRUE,0,50,TRUE,1,50,TRUE,0,69,FALSE,1,74,TRUE,1,100,FALSE,1,50,TRUE,1,99,TRUE,1,99,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,76,TRUE,1,73,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,79,FALSE,1,50,TRUE,0,50,FALSE,0,95,TRUE,1,69,FALSE,1,98,TRUE,1,92,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,50,TRUE,0,59,FALSE,0,75,FALSE,0,50,FALSE,0,74,0.0001,0,0,0.0001,0.5476,0.25,0.0064,0.25,0.25,0.0961,0.5625,0.0729,0.25,0.25,0,0.25,0.0004,0.0676,0.25,0,0.9025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.4761,0.6241,0.3481,0.5776,0.277925,0.203821429,0.352028571,16,50,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,10,62.5,8,50,69.72,53,74.88,74.62,76.38,76.62,62.81,-6.25,13.47,-9.5,12.38,12.12,38.88,14.12,12.81,2,0,1,1,3,0,0,0,1,1,0,0,2,1,0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,1,1,0,1.4,0.4,0.6,0.4,0.4,0.6,0.4,0.4,0.7,0.45,0.575,3,0.67,2.5,1,-0.2,0.2,0,0.333333333,3,1,3,-1,2.33,0,1,0,0,0,0,0,0,0,-1,1,-1,10 cents,5 minutes,47 days,Female,High School (or equivalent),29,I kinda to know if I got the answers right. Two a lot of it depends on the situation I can't really make a call without more information ,0.125,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,6,4,5,9,7,8,3,1,2,2,3,4,1 +468,R_7mnrQ0GlaUV2Mkj,53 - 59,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,2,1,3,5,4,Somewhat agree,Strongly disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,2,3,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,5,2,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,3,1,Agree,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,5,4,2,1,3,4,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,4,2,3,1,5,2,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,2,5,3,4,1,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,3,4,2,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat agree,4,1,3,5,2,2,Somewhat agree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,3,4,2,5,1,2,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,4,1,2,3,2,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Agree,5,2,4,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,52,FALSE,56,FALSE,60,TRUE,76,TRUE,88,FALSE,61,FALSE,58,FALSE,58,TRUE,100,TRUE,83,FALSE,64,FALSE,63,TRUE,56,TRUE,60,FALSE,59,TRUE,85,TRUE,85,FALSE,64,TRUE,87,TRUE,64,TRUE,87,TRUE,65,TRUE,72,TRUE,76,TRUE,73,TRUE,75,TRUE,92,TRUE,57,TRUE,90,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,3,1,2,1,-3,1,-1,1,1,1,1,0,2,1,1,1,1,1,2,1,3,1,3,4,1,-2,1,-2,1,2,1,1,2,0,2,1,-1,-1,-1,-1,-1,9,1,1,3,1,1,2,1,-3,1,-2,1,2,1,1,2,0,2,2,1,3,3,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,52,FALSE,0,56,FALSE,1,60,TRUE,1,76,TRUE,1,88,FALSE,0,61,FALSE,0,58,FALSE,1,58,TRUE,0,100,TRUE,1,83,FALSE,1,64,FALSE,0,63,TRUE,1,56,TRUE,0,60,FALSE,1,59,TRUE,0,85,TRUE,0,85,FALSE,0,64,TRUE,1,87,TRUE,0,64,TRUE,1,87,TRUE,0,65,TRUE,1,72,TRUE,0,76,TRUE,0,73,TRUE,0,75,TRUE,1,92,TRUE,1,57,TRUE,1,90,0.0144,0.0784,0.1936,0.0576,0.01,0.16,0.0169,0.3364,0.7225,0.0169,0.0064,0.0289,0.3721,0.1764,0.3136,0,0.4096,0.2304,0.5329,0.4225,0.4096,0.3969,0.7225,0.1296,0.36,0.5776,0.1849,1,1,0.1681,0.5625,1,0.366685714,0.200007143,0.533364286,25,78.13,16,50,4,50,3,37.5,5,62.5,4,50,11,68.75,5,31.25,73.94,69,69,72.62,85.12,74.38,73.5,28.13,23.94,19,31.5,10.12,35.12,5.63,42.25,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,2,2,2,2,2,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,2,1,1,0.4,0.4,0.2,2,0.2,0.2,0.2,1.2,0.75,0.45,0.6,2.33,2,3,0.2,0.2,0,0.8,0.133333333,2,0,-1,7,0.33,1,2,0,-1,1,0,0,-1,1,-1,1,0,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,57,Thank you! Good work! Good time!,0.75,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,6,3,9,8,2,5,7,1,4,2,3,4,1 +469,R_11PSrb2DfJaoQKt,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Disagree,Agree,4,1,5,2,3,Somewhat disagree,Somewhat agree,Agree,Strongly agree,Somewhat agree,5,3,2,1,4,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,5,1,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,3,5,2,4,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat disagree,Agree,1,3,5,4,2,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,3,5,2,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,Somewhat agree,5,3,2,1,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,4,2,3,5,1,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,1,2,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,3,2,5,1,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,98,FALSE,77,TRUE,83,TRUE,85,FALSE,94,FALSE,66,TRUE,82,TRUE,100,FALSE,75,TRUE,79,TRUE,82,FALSE,71,TRUE,71,TRUE,78,FALSE,84,TRUE,78,TRUE,96,FALSE,77,TRUE,98,TRUE,94,TRUE,100,FALSE,82,TRUE,100,FALSE,79,TRUE,100,TRUE,97,FALSE,89,FALSE,78,FALSE,80,FALSE,50,TRUE,100,FALSE,69,17,3,3,0,-2,2,-1,1,2,3,1,3,1,3,0,3,-3,-3,-3,-3,-3,3,3,0,-1,2,5,1,0,0,0,0,5,3,0,3,0,3,5,1,1,1,-3,1,9,3,3,0,0,2,5,0,0,3,0,0,5,3,0,3,0,3,5,0,0,-1,0,-3,5,FALSE,1,69,TRUE,1,100,FALSE,1,50,FALSE,1,80,FALSE,0,78,FALSE,1,89,TRUE,1,97,TRUE,1,100,FALSE,0,79,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,94,TRUE,0,98,FALSE,0,77,TRUE,1,96,TRUE,0,78,FALSE,1,84,TRUE,0,78,TRUE,0,71,FALSE,0,71,TRUE,1,82,TRUE,0,79,FALSE,0,75,TRUE,0,100,TRUE,1,82,FALSE,1,66,FALSE,1,94,TRUE,0,85,TRUE,1,83,FALSE,0,77,TRUE,1,98,0,0.0324,0.0016,0.0009,0.0004,0.0121,0.5625,0,0.5041,0.0324,0.0289,0.0036,0.6241,0.0324,0.6084,0,0.6241,0.04,0.0036,1,0.5041,0.5929,0.6084,0.9604,0.6084,0.1156,0.5929,0.0961,0.25,0.0256,0.7225,1,0.362625,0.2195,0.50575,17,53.13,18,56.25,4,50,3,37.5,6,75,5,62.5,10,62.5,8,50,84.12,79.88,84,89,83.62,86.81,81.44,-3.12,27.87,29.88,46.5,14,21.12,24.31,31.44,0,0,0,1,0,2,1,2,3,1,0,1,0,0,0,4,4,4,0,4,0,0,0,2,0,1,1,1,3,1,0,1,0,0,0,3,3,2,3,0,0.2,1.8,0.2,3.2,0.4,1.4,0.2,2.2,1.35,1.05,1.2,5,5,5.5,-0.2,0.4,0,1,0.066666667,0,0,0,4,0,1,2,2,-2,2,0,0,-1,1,-1,1,2,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,46,I wish ther was a progress bar,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,6,8,5,4,3,7,9,1,2,2,4,3,1 +470,R_3LimH14pa2AtjvZ,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly disagree,Disagree,Strongly agree,1,4,3,5,2,Somewhat agree,Somewhat disagree,Agree,Disagree,Agree,3,1,2,4,5,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,5,3,4,2,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,3,4,1,2,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,Strongly Agree,3,5,1,2,4,2,Somewhat agree,Somewhat disagree,Agree,Disagree,Strongly agree,4,2,3,5,1,2,Strongly Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,3,1,5,2,2,Agree,Agree,Strongly Agree,Agree,Strongly Agree,4,3,2,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat disagree,Strongly Agree,3,2,4,1,5,2,Somewhat agree,Somewhat disagree,Agree,Disagree,Agree,3,5,4,1,2,2,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,1,3,2,2,Agree,Neither agree nor disagree,Strongly Agree,Agree,Strongly Agree,5,1,2,3,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,54,FALSE,100,FALSE,50,TRUE,87,FALSE,100,TRUE,100,TRUE,100,FALSE,54,TRUE,75,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,58,FALSE,74,FALSE,100,TRUE,100,TRUE,100,FALSE,52,TRUE,100,TRUE,57,FALSE,54,TRUE,100,FALSE,54,TRUE,82,TRUE,58,FALSE,64,TRUE,54,TRUE,100,FALSE,100,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-3,-2,3,1,-1,2,-2,2,3,1,3,-1,3,2,2,3,2,3,3,3,-3,-3,3,2,1,-1,2,-2,3,2,3,2,3,-1,3,2,2,2,3,2,3,2,3,3,-3,-1,3,2,1,-1,2,-2,2,2,3,2,3,-3,3,2,2,0,3,2,3,2,FALSE,1,100,TRUE,1,54,FALSE,1,100,FALSE,1,50,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,54,TRUE,1,75,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,58,FALSE,0,74,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,52,TRUE,1,100,TRUE,1,57,FALSE,1,54,TRUE,1,100,FALSE,1,54,TRUE,1,82,TRUE,0,58,FALSE,1,64,TRUE,0,54,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.0324,0.5476,0,0,0,0,0.0625,0.2304,0.1849,0,1,0.2916,0,0.0169,0.2116,0.2116,0.25,0.1296,0.2116,0,0.1764,1,1,0,0.3364,1,0,0,1,0.2916,1,0.307325,0.175678571,0.438971429,20,62.5,22,68.75,4,50,6,75,6,75,6,75,12,75,10,62.5,82.09,71.75,86.88,83.5,86.25,83.81,80.38,-6.25,13.34,21.75,11.88,8.5,11.25,8.81,17.88,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,2,0,0,0,0.2,0.2,0.2,0,0.2,0,0.6,0.4,0.15,0.3,0.225,2,2,2,0,0.2,-0.4,-0.4,-0.066666667,0,0,0,0,0,-1,1,2,-2,2,2,-2,-1,1,-1,1,-1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,49,,0.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,7,8,2,3,6,4,5,1,9,2,4,3,1 +471,R_3N3mzNU5d4yDSl5,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,5,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,3,4,2,5,Somewhat Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,1,2,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Strongly Agree,Agree,Disagree,Somewhat disagree,2,4,5,3,1,8,Agree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly agree,4,1,2,3,5,8,Somewhat Agree,Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,5,1,4,2,3,8,Strongly disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,Agree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,4,1,5,3,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,2,1,4,0,Somewhat Agree,Agree,Strongly agree,Strongly agree,Agree,1,5,2,4,3,4,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Strongly Agree,3,2,4,1,5,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,-3,3,-3,3,1,3,2,2,3,3,3,3,3,2,1,3,2,-2,-1,9,2,-3,0,-3,3,8,1,-2,1,2,0,8,-3,-1,-1,-3,2,8,1,2,2,2,1,5,3,-3,3,-3,3,4,1,2,3,3,2,0,3,2,3,1,3,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0.142857143,0.142857143,0.142857143,32,100,28,87.5,8,100,7,87.5,8,100,5,62.5,15,93.75,13,81.25,100,100,100,100,100,100,100,12.5,12.5,0,12.5,0,37.5,6.25,18.75,2,0,1,5,4,1,0,3,0,0,0,5,1,0,3,6,4,4,6,0,2,1,1,1,2,0,0,0,0,0,0,1,1,1,1,0,1,0,2,1,2.4,0.8,1.8,4,1.4,0,0.8,0.8,2.25,0.75,1.5,8.33,3,5.75,1,0.8,1,3.2,0.933333333,4,4,8,4,5.33,1,1,2,-2,2,0,0,-2,2,-2,2,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,32,n/a,1.25,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,9,5,4,8,6,7,2,1,3,4,3,2,1 +472,R_1lFXPYGgftyjMmR,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Agree,Agree,Disagree,Agree,5,1,3,2,4,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Somewhat agree,5,2,1,4,3,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,3,2,4,Agree,Agree,Agree,Agree,Agree,1,4,5,2,3,Neither agree nor disagree,Agree,Agree,Strongly disagree,Agree,5,4,2,3,1,3,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly disagree,Agree,1,4,5,2,3,4,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,5,4,3,1,2,Agree,Agree,Agree,Agree,Agree,3,5,2,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Neither agree nor disagree,Strongly Agree,1,2,4,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,2,5,1,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,1,3,2,4,2,Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,86,TRUE,100,TRUE,100,TRUE,86,FALSE,96,TRUE,84,TRUE,87,TRUE,79,TRUE,100,TRUE,75,TRUE,100,TRUE,100,FALSE,100,FALSE,95,TRUE,100,TRUE,91,TRUE,100,TRUE,78,FALSE,71,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,61,TRUE,84,TRUE,100,FALSE,54,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,25,1,2,2,-2,2,0,0,3,-3,1,0,-3,3,0,3,2,2,2,2,2,0,2,2,-3,2,3,0,1,3,-3,2,4,0,-3,3,1,3,2,2,2,2,2,2,2,1,2,2,0,3,2,0,0,3,-3,1,2,0,-3,3,1,3,2,2,2,2,2,2,2,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,54,TRUE,1,100,TRUE,1,84,FALSE,0,61,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,71,TRUE,1,78,TRUE,1,100,TRUE,0,91,TRUE,0,100,FALSE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,79,TRUE,1,87,TRUE,0,84,FALSE,1,96,TRUE,0,86,TRUE,1,100,TRUE,1,100,TRUE,1,86,0.0256,0.0169,0,0,0.0196,0.2116,0,0,0,0,0,0,0.3721,0,0.25,0.25,0.5625,0.25,0.0016,0.6241,0,0.0484,0.0025,0.0841,0.8281,0.7056,0,1,1,1,0.7396,1,0.319635714,0.136842857,0.502428571,25,78.13,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,86.78,77.25,80.25,92.12,97.5,87.25,86.31,12.5,21.15,14.75,17.75,29.62,22.5,-0.25,42.56,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.4,0.4,0.2,0,0.6,0,0.2,0,0.25,0.2,0.225,3,2,2.375,-0.2,0.4,0,0,0.066666667,1,2,0,0,1,2,2,2,-2,2,-1,1,-2,2,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,none,1.75,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,8,6,5,9,4,7,2,1,3,4,3,2,1 +473,R_6zcFZItVldhRnQz,32 - 38,American,,American,Male,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,4,2,3,5,1,Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,3,2,1,Strongly disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,2,4,1,5,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,2,3,1,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,1,4,2,5,3,5,Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,4,5,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,5,4,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,3,4,2,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,3,1,5,4,0,Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,4,5,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,50,TRUE,75,FALSE,50,FALSE,50,FALSE,50,TRUE,95,FALSE,75,TRUE,60,TRUE,60,TRUE,60,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,95,TRUE,50,FALSE,75,TRUE,60,FALSE,50,FALSE,75,TRUE,95,TRUE,50,TRUE,50,TRUE,75,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,16,-1,0,1,1,-1,0,0,2,0,1,2,3,1,0,0,-3,-2,-2,-3,-3,-1,0,1,1,0,0,0,0,-1,1,1,5,2,3,1,0,0,2,-3,-3,-3,-3,-3,4,-1,0,1,1,-1,0,0,0,2,0,1,0,2,3,1,0,0,0,0,0,0,0,0,5,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,75,TRUE,1,50,TRUE,1,50,TRUE,1,95,FALSE,1,75,FALSE,1,50,TRUE,1,60,FALSE,1,75,TRUE,1,50,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,TRUE,1,60,TRUE,0,60,TRUE,1,60,FALSE,1,75,TRUE,1,95,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,1,95,0.25,0.0025,0.0025,0.0625,0.0025,0.25,0.16,0.0025,0.25,0.16,0.0625,0.16,0.25,0.0625,0.25,0.25,0.36,0.25,0.25,0.0625,0.25,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.199821429,0.176428571,0.223214286,16,50,24,75,6,75,4,50,7,87.5,7,87.5,13,81.25,11,68.75,60.78,53.12,58.12,71.88,60,66.25,55.31,-25,-14.22,-21.88,8.12,-15.62,-27.5,-15,-13.44,0,0,0,0,1,0,0,3,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,2,3,3,0.2,0.8,0,0.4,0,0,0,2.6,0.35,0.65,0.5,2.33,0,2,0.2,0.8,0,-2.2,0.333333333,0,5,2,-1,2.33,0,0,-2,0,0,0,0,0,0,1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,4,6,8,7,2,5,3,1,9,3,4,2,1 +474,R_6KL8A5jQBqTMmlP,46 - 52,American,,American,Female,Agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,2,4,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Disagree,1,4,5,3,2,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,5,3,2,4,5,Strongly disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,4,2,3,1,5,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,5,1,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,4,3,5,Strongly disagree,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,5,3,2,1,4,5,Disagree,Somewhat Disagree,Agree,Disagree,Neither Agree nor Disagree,1,4,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,2,3,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,50,TRUE,94,FALSE,50,FALSE,50,TRUE,97,FALSE,50,TRUE,96,FALSE,100,FALSE,86,FALSE,90,FALSE,50,FALSE,82,FALSE,75,FALSE,66,TRUE,77,FALSE,69,TRUE,98,TRUE,88,TRUE,93,FALSE,54,TRUE,96,FALSE,58,TRUE,97,TRUE,94,FALSE,98,TRUE,95,FALSE,55,FALSE,91,FALSE,66,TRUE,98,25,2,1,2,0,1,-2,0,1,0,0,0,0,2,-1,-2,-2,0,1,0,-2,2,2,2,0,2,5,-3,-2,0,-1,0,5,-1,0,0,0,-3,5,0,0,-2,0,0,5,2,1,2,0,0,5,-3,-2,0,-2,0,5,-2,-1,2,-2,0,5,0,0,0,0,-2,5,TRUE,0,98,FALSE,0,66,FALSE,1,91,FALSE,1,55,TRUE,1,95,FALSE,1,98,TRUE,1,94,TRUE,1,97,FALSE,0,58,TRUE,1,96,FALSE,1,54,TRUE,0,93,TRUE,1,88,TRUE,0,98,FALSE,0,69,TRUE,1,77,FALSE,1,66,FALSE,1,75,FALSE,1,82,FALSE,1,50,FALSE,0,90,FALSE,0,86,FALSE,1,100,TRUE,1,96,FALSE,1,50,TRUE,1,97,FALSE,1,50,FALSE,1,50,TRUE,0,94,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0009,0.0009,0.0529,0.0036,0,0.0004,0.0016,0.0016,0.25,0.7396,0.25,0.0144,0.3364,0.2116,0.0025,0.4356,0,0.2025,0.25,0.25,0.81,0.4761,0.0324,0.9604,0.1156,0.25,0.25,0.9604,0.0081,0.0625,0.8836,0.8649,0.307864286,0.174728571,0.441,25,78.13,21,65.63,4,50,6,75,5,62.5,6,75,9,56.25,12,75,78.53,60.5,91.38,86.75,75.5,81.81,75.25,12.5,12.9,10.5,16.38,24.25,0.5,25.56,0.25,0,1,0,0,1,1,2,1,1,0,1,0,2,1,1,2,0,3,0,2,0,0,0,0,1,1,2,1,2,0,2,1,0,1,2,2,0,1,0,0,0.4,1,1,1.4,0.2,1.2,1.2,0.6,0.95,0.8,0.875,5,5,5,0.2,-0.2,-0.2,0.8,-0.066666667,0,0,0,0,0,0,1,1,-2,2,0,0,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,51,none,0.875,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,8,4,6,5,9,3,2,1,7,2,4,3,1 +475,R_6KUCD6O2Ur15fd7,46 - 52,American,,American,Female,Strongly agree,Agree,Agree,Somewhat disagree,Strongly agree,1,3,2,5,4,Somewhat agree,Disagree,Agree,Agree,Somewhat agree,1,5,3,4,2,Strongly Agree,Strongly Agree,Agree,Disagree,Strongly Agree,1,3,5,2,4,Agree,Agree,Agree,Strongly Agree,Agree,3,5,4,2,1,Agree,Agree,Somewhat agree,Strongly disagree,Strongly Agree,5,2,4,1,3,4,Somewhat agree,Strongly disagree,Strongly agree,Agree,Agree,5,2,4,3,1,5,Strongly Agree,Strongly Agree,Agree,Disagree,Strongly Agree,4,2,5,3,1,0,Agree,Agree,Agree,Agree,Agree,3,2,1,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Strongly Agree,4,2,5,1,3,5,Agree,Strongly disagree,Agree,Somewhat agree,Agree,1,4,2,3,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,5,2,1,4,3,3,Agree,Agree,Agree,Strongly Agree,Agree,5,4,3,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,82,TRUE,98,FALSE,84,TRUE,58,TRUE,95,FALSE,100,TRUE,96,TRUE,87,FALSE,77,TRUE,100,FALSE,75,TRUE,97,FALSE,70,FALSE,88,TRUE,91,TRUE,93,FALSE,75,TRUE,93,FALSE,96,FALSE,88,FALSE,82,TRUE,96,TRUE,80,TRUE,86,FALSE,78,TRUE,82,FALSE,89,FALSE,78,TRUE,94,TRUE,95,TRUE,90,TRUE,84,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-1,3,1,-2,2,2,1,3,3,2,-2,3,2,2,2,3,2,2,2,1,-3,3,4,1,-3,3,2,2,5,3,3,2,-2,3,0,2,2,2,2,2,5,2,2,2,1,3,5,2,-3,2,1,2,5,3,3,3,-2,3,3,2,2,2,3,2,5,FALSE,1,82,TRUE,1,98,FALSE,1,84,TRUE,0,58,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,1,87,FALSE,0,77,TRUE,1,100,FALSE,1,75,TRUE,0,97,FALSE,0,70,FALSE,1,88,TRUE,1,91,TRUE,1,93,FALSE,1,75,TRUE,0,93,FALSE,1,96,FALSE,1,88,FALSE,0,82,TRUE,1,96,TRUE,0,80,TRUE,1,86,FALSE,1,78,TRUE,1,82,FALSE,1,89,FALSE,1,78,TRUE,0,94,TRUE,1,95,TRUE,1,90,TRUE,1,84,0.0169,0.0324,0.0049,0.0016,0.0256,0,0.0196,0,0.0144,0.0016,0.0025,0.49,0.5929,0.0625,0.0025,0.0004,0.64,0.3364,0.0484,0.0484,0.6724,0.0081,0.0016,0.0144,0.0625,0.0121,0.01,0.0324,0.0256,0.8649,0.8836,0.9409,0.207632143,0.156314286,0.25895,21,65.63,24,75,6,75,4,50,7,87.5,7,87.5,13,81.25,11,68.75,86.78,84.25,85,89.38,88.5,88.88,84.69,-9.37,11.78,9.25,35,1.88,1,7.63,15.94,1,0,1,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0.8,0.6,0,0.2,0.6,0.8,0.2,0,0.4,0.4,0.4,3,4.33,4,0.2,-0.2,-0.2,0.2,-0.066666667,-1,0,-3,0,-1.33,1,1,1,-1,1,1,-1,0,0,-2,2,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,everything was great,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,4,9,2,5,3,6,7,1,8,4,3,2,1 +476,R_6NTYh5c7onoo8gK,60 - 66,American,,American,Female,Strongly agree,Agree,Disagree,Neither agree nor disagree,Disagree,3,2,5,4,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,3,5,1,Somewhat Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,4,2,1,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,Disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Disagree,Neither agree nor disagree,Strongly disagree,4,2,3,5,1,1,Strongly disagree,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,4,1,3,5,2,1,Somewhat Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,2,5,1,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,Disagree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Disagree,Neither agree nor disagree,Somewhat disagree,2,1,3,4,5,2,Disagree,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,5,1,4,2,3,2,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,2,1,4,5,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat disagree,2,1,4,5,3,FALSE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,90,TRUE,100,TRUE,50,TRUE,90,FALSE,75,TRUE,75,FALSE,75,FALSE,95,FALSE,50,TRUE,100,FALSE,75,TRUE,75,TRUE,50,FALSE,75,FALSE,50,TRUE,75,FALSE,100,TRUE,75,FALSE,50,FALSE,50,TRUE,75,FALSE,75,TRUE,75,TRUE,50,TRUE,75,FALSE,90,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,-2,0,-2,-1,-1,1,1,0,1,-2,3,-3,3,-1,1,1,-2,-2,3,2,-2,0,-3,2,-3,-3,0,2,0,1,1,-2,3,-3,3,1,-1,1,1,-2,-2,1,3,2,-2,0,-1,2,-2,-2,0,2,0,2,1,-2,3,-3,3,2,-1,-1,0,-2,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,90,TRUE,1,100,TRUE,1,50,TRUE,1,90,FALSE,1,75,TRUE,0,75,FALSE,0,75,FALSE,1,95,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,0,75,TRUE,0,50,FALSE,1,75,FALSE,0,50,TRUE,1,75,FALSE,1,100,TRUE,1,75,FALSE,1,50,FALSE,0,50,TRUE,0,75,FALSE,1,75,TRUE,0,75,TRUE,1,50,TRUE,1,75,FALSE,0,90,0,0.25,0,0.01,0.81,0.25,0.0625,0.01,0.0625,0.0625,0.25,0.5625,0.25,0.0625,0,0,0,0.25,0.0625,0.25,0.25,0.25,0.25,0.0025,0.0625,0.5625,0.0625,0,0,0.5625,0.5625,0.5625,0.216875,0.188035714,0.245714286,16,50,21,65.63,4,50,4,50,6,75,7,87.5,11,68.75,10,62.5,75.47,65.62,76.88,78.12,81.25,76.25,74.69,-15.63,9.84,15.62,26.88,3.12,-6.25,7.5,12.19,0,0,0,0,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,2,1,0,1,0.2,1.2,0,0,0.2,0.8,0,0.8,0.35,0.45,0.4,1.33,2,2,0,0.4,0,-0.8,0.133333333,0,-1,-1,-4,-0.67,0,2,2,-2,2,0,0,0,0,-2,2,0,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),61,HATE the sliders; so hard to get the number you want,1,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,9,3,6,5,8,2,4,1,7,3,4,2,1 +477,R_6zAqowkNLFILVl3,67 - 73,American,,American,Female,Strongly agree,Agree,Somewhat agree,Strongly agree,Strongly agree,3,2,1,5,4,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,5,1,3,2,4,Somewhat Agree,Agree,Strongly Agree,Disagree,Agree,3,2,4,5,1,Disagree,Disagree,Disagree,Somewhat agree,Disagree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,5,Agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,4,5,1,2,3,5,Somewhat Agree,Strongly Agree,Agree,Somewhat Disagree,Strongly Agree,4,5,1,3,2,5,Disagree,Disagree,Disagree,Disagree,Disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,4,3,1,5,2,5,Agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,4,2,1,5,3,5,Somewhat Agree,Strongly agree,Strongly agree,Disagree,Agree,1,4,3,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,80,TRUE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,90,TRUE,80,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,80,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,81,FALSE,100,FALSE,50,TRUE,80,FALSE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,80,TRUE,50,FALSE,100,TRUE,85,TRUE,80,25,3,2,1,3,3,1,-3,1,-3,1,1,2,3,-2,2,-2,-2,-2,1,-2,3,3,3,3,3,5,2,-3,1,-3,2,5,1,3,2,-1,3,5,-2,-2,-2,-2,-2,5,3,3,0,3,3,5,2,-3,1,-3,2,5,1,3,3,-2,2,5,0,0,0,0,0,5,TRUE,0,80,TRUE,1,85,FALSE,1,100,TRUE,0,50,TRUE,1,80,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,80,FALSE,1,50,FALSE,0,100,TRUE,0,81,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,80,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,80,TRUE,1,90,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,80,TRUE,1,100,0,0.01,0,0,0,0.25,0,0.25,0,0.25,0,1,0.25,0.64,0.04,0.0225,0,0.25,0,0.64,0.25,0.25,0.64,0.6561,0.25,0.25,0.04,0.64,0,1,0,0.25,0.279235714,0.210892857,0.347578571,25,78.13,21,65.63,5,62.5,6,75,2,25,8,100,12,75,9,56.25,79.25,65.62,78.75,78.88,93.75,80.31,78.19,12.5,13.62,3.12,3.75,53.88,-6.25,5.31,21.94,0,1,2,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,3,0,0,1,1,0,0,1,0,0,0,1,0,1,0,0,0,2,2,2,1,2,0.6,0.4,0.8,0.6,0.4,0.4,0.2,1.8,0.6,0.7,0.65,5,5,5,0.2,0,0.6,-1.2,0.266666667,0,0,0,0,0,0,2,1,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,71,definitely an interesting survey!,1.125,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,9,4,2,5,3,8,7,1,6,4,2,3,1 +478,R_6QFnQ6N0jk3RNgP,60 - 66,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,3,1,5,2,Agree,Disagree,Strongly agree,Disagree,Strongly agree,1,3,5,4,2,Somewhat Agree,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,2,3,1,Agree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,2,5,3,1,4,5,Agree,Disagree,Agree,Disagree,Agree,1,5,4,3,2,6,Somewhat Agree,Disagree,Agree,Somewhat Agree,Somewhat Agree,4,1,3,2,5,7,Somewhat agree,Agree,Agree,Agree,Agree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Strongly Agree,Agree,Agree,Strongly Agree,5,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,3,5,4,1,2,6,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,3,4,1,2,8,Agree,Agree,Agree,Somewhat agree,Agree,1,4,2,3,5,TRUE,92,TRUE,100,TRUE,100,TRUE,75,TRUE,82,FALSE,78,TRUE,100,TRUE,100,FALSE,55,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,79,FALSE,78,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,62,FALSE,94,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,2,1,3,2,-2,3,-2,3,1,2,2,1,0,2,3,3,2,0,-3,3,1,-2,3,7,2,-2,2,-2,2,5,1,-2,2,1,1,6,1,2,2,2,2,7,-3,3,2,2,3,7,0,0,1,2,0,5,1,2,1,1,0,6,2,2,2,1,2,8,TRUE,0,92,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,1,82,FALSE,1,78,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,79,FALSE,0,78,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,FALSE,1,62,FALSE,0,94,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0,0,0,0.25,0.0484,0.25,0,0.1444,0,0,0,0.3025,1,0.0324,0,0.25,0.5625,1,1,0.8836,0.6084,1,0.0441,0.25,0.25,0.25,0.8464,1,1,0.25,1,0.436525,0.202871429,0.670178571,23,71.88,17,53.13,2,25,6,75,5,62.5,4,50,10,62.5,7,43.75,82.66,76,69.25,96.38,89,84.94,80.38,18.75,29.53,51,-5.75,33.88,39,22.44,36.63,0,0,1,3,0,0,0,1,0,1,0,4,0,0,1,1,1,1,0,2,0,0,0,1,0,2,2,2,4,3,0,0,1,0,0,0,1,1,1,2,0.8,0.4,1,1,0.2,2.6,0.2,1,0.8,1,0.9,6,6,6.375,0.6,-2.2,0.8,0,-0.266666667,0,0,0,-1,0,2,0,2,-1,1,2,-2,1,-1,-1,1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,63,Hopefully swagbucks pays me for my time,0.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,01DIR,6,7,5,9,2,3,4,1,8,4,3,2,1 +479,R_6c2EeRUiwhKfUjU,60 - 66,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat disagree,Somewhat agree,3,5,2,1,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,2,1,3,4,5,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,5,3,1,4,2,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Somewhat agree,Strongly Agree,Agree,Disagree,4,5,1,2,3,9,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,1,2,4,5,9,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,3,4,1,2,5,9,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Somewhat agree,Agree,Agree,Strongly Agree,1,2,5,4,3,9,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,4,2,1,3,8,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,5,4,2,1,9,Agree,Agree,Agree,Strongly Agree,Somewhat agree,5,3,4,1,2,TRUE,91,FALSE,94,TRUE,98,FALSE,88,FALSE,61,FALSE,97,TRUE,96,TRUE,97,FALSE,58,FALSE,62,FALSE,61,TRUE,95,TRUE,94,FALSE,66,FALSE,62,TRUE,97,TRUE,94,TRUE,97,FALSE,67,FALSE,92,FALSE,64,FALSE,64,FALSE,61,TRUE,81,TRUE,94,TRUE,66,FALSE,64,TRUE,95,TRUE,91,TRUE,95,FALSE,63,FALSE,67,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-1,1,-1,-1,1,1,-2,1,1,3,1,2,1,1,2,2,0,2,1,3,2,-2,9,2,2,2,1,1,9,2,1,1,2,1,9,1,1,2,1,2,9,2,1,2,2,3,9,2,1,1,2,1,9,2,1,1,1,2,8,2,2,2,3,1,9,TRUE,0,91,FALSE,0,94,TRUE,0,98,FALSE,1,88,FALSE,0,61,FALSE,1,97,TRUE,1,96,TRUE,1,97,FALSE,0,58,FALSE,0,62,FALSE,1,61,TRUE,0,95,TRUE,1,94,FALSE,1,66,FALSE,0,62,TRUE,1,97,TRUE,0,94,TRUE,0,97,FALSE,1,67,FALSE,1,92,FALSE,0,64,FALSE,0,64,FALSE,1,61,TRUE,1,81,TRUE,0,94,TRUE,1,66,FALSE,1,64,TRUE,0,95,TRUE,0,91,TRUE,1,95,FALSE,0,63,FALSE,0,67,0.0009,0.1156,0.0009,0.0016,0.4489,0.0009,0.0361,0.3844,0.0064,0.4096,0.0025,0.0036,0.3364,0.1521,0.3721,0.8836,0.1521,0.0144,0.9025,0.8836,0.4096,0.3844,0.1089,0.1156,0.8836,0.1296,0.3969,0.8281,0.9604,0.9409,0.8281,0.9025,0.424207143,0.228792857,0.619621429,25,78.13,15,46.88,4,50,3,37.5,3,37.5,5,62.5,7,43.75,8,50,80.38,69.62,78.62,79.5,93.75,76.31,84.44,31.25,33.5,19.62,41.12,42,31.25,32.56,34.44,0,1,1,3,3,3,3,1,0,3,1,0,2,1,1,0,0,0,1,2,0,1,0,3,2,3,2,0,1,3,1,0,2,0,0,1,1,0,1,1,1.6,2,1,0.6,1.2,1.8,0.6,0.8,1.3,1.1,1.2,9,8.67,8.875,0.4,0.2,0.4,-0.2,0.333333333,0,0,1,0,0.33,0,0,1,-1,1,0,0,0,0,0,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,62,interesting,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,7,8,6,3,5,2,4,1,9,3,2,4,1 +480,R_1iR7JvUF5ip9eOn,60 - 66,,Canadian,Canadian,Male,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,2,3,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,4,1,5,Strongly disagree,Disagree,Disagree,Somewhat disagree,Strongly disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,3,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,3,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,2,3,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,76,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,1,3,0,0,1,0,0,0,0,0,0,0,-3,-2,-2,-1,-3,1,1,1,-1,1,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,0,TRUE,0,99,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0.25,1,1,1,0.5776,1,0.9801,1,1,1,1,0.493132143,0.285714286,0.70055,30,93.75,18,56.25,3,37.5,5,62.5,5,62.5,5,62.5,15,93.75,3,18.75,97.66,90.75,100,99.88,100,96.88,98.44,37.5,41.41,53.25,37.5,37.38,37.5,3.13,79.69,2,0,2,2,2,0,0,1,0,0,0,0,0,0,0,3,2,2,1,3,3,1,3,1,3,0,0,1,0,0,0,0,0,0,0,3,2,2,1,3,1.6,0.2,0,2.2,2.2,0.2,0,2.2,1,1.15,1.075,5,5.33,4.5,-0.6,0,0,0,-0.2,0,-1,0,5,-0.33,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,60,The sliders were tricky to move needs improvement ,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,3,9,2,8,4,7,5,1,6,2,3,4,1 +481,R_38Sz1L5x6DzjiHA,60 - 66,American,,American,Male,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,5,3,1,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,5,1,4,2,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Disagree,Agree,1,2,5,3,4,Disagree,Disagree,Disagree,Strongly Agree,Disagree,4,3,1,5,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,2,5,4,3,2,Disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,4,Somewhat Disagree,Agree,Agree,Disagree,Agree,2,4,3,5,1,2,Disagree,Disagree,Disagree,Strongly Agree,Disagree,4,2,3,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,1,2,4,3,5,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,3,5,2,1,2,Somewhat Disagree,Somewhat Agree,Agree,Disagree,Agree,4,1,2,5,3,2,Disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,5,3,1,4,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,TRUE,90,TRUE,98,FALSE,77,TRUE,92,FALSE,100,TRUE,100,TRUE,93,TRUE,76,TRUE,100,TRUE,97,TRUE,100,TRUE,99,TRUE,98,TRUE,76,TRUE,100,FALSE,100,TRUE,100,TRUE,96,FALSE,76,TRUE,100,TRUE,100,FALSE,97,TRUE,92,TRUE,75,TRUE,100,TRUE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,82,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,1,0,1,1,2,1,1,0,1,2,-1,2,-2,-2,-2,3,-2,2,2,2,1,1,2,-2,1,2,1,0,4,-1,2,2,-2,2,2,-2,-2,-2,3,-2,2,2,2,2,1,0,2,1,1,2,1,1,2,-1,1,2,-2,2,2,-2,0,0,2,-2,2,FALSE,1,50,TRUE,1,90,TRUE,0,98,FALSE,1,77,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,93,TRUE,1,76,TRUE,1,100,TRUE,0,97,TRUE,0,100,TRUE,1,99,TRUE,0,98,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,96,FALSE,1,76,TRUE,1,100,TRUE,1,100,FALSE,1,97,TRUE,1,92,TRUE,0,75,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,82,TRUE,1,100,0.0049,0,0,0,0,0,0.0064,0,0.0576,0,0,0.0001,0.0576,0.9409,0.0064,0.01,0.0009,0.0529,1,0.5625,0,0.0576,0.9216,0.9604,0,0.5625,0.0324,0.25,0.9604,1,1,1,0.33715,0.080914286,0.593385714,24,75,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,16,100,6,37.5,91.84,83.62,98.5,90.38,94.88,93.75,89.94,6.25,23.09,21.12,11,27.88,32.38,-6.25,52.44,0,0,0,0,1,3,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,2,2,1,0,0.2,0.8,0.6,0,0,0,0.4,1,0.4,0.35,0.375,2.67,2,2.25,0.2,0.8,0.2,-1,0.4,0,2,0,0,0.67,0,2,0,-2,2,-1,1,1,-1,0,0,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),66,none,0.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,5,6,4,3,8,9,7,1,2,4,2,3,1 +482,R_3wEUroxBZQ4qxNG,53 - 59,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,3,2,Somewhat disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,4,1,2,3,Agree,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,2,5,3,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,5,1,2,5,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat agree,1,3,5,4,2,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,2,1,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,2,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,1,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,1,5,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,80,TRUE,100,TRUE,93,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,69,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,74,TRUE,100,FALSE,100,TRUE,100,26,1,1,1,1,1,-1,1,2,2,0,2,1,2,2,0,1,1,1,1,1,1,1,1,1,1,5,-1,1,2,2,1,5,1,1,1,0,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,0,74,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,69,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,80,TRUE,1,100,0,0,0,0,0,0,0,0,0,1,0,0,0.0625,1,0,1,0,0.5476,0,0,1,0,0.4761,0,0,0.25,0.04,1,1,0,0.8649,1,0.330039286,0.257864286,0.402214286,26,81.25,21,65.63,3,37.5,6,75,6,75,6,75,13,81.25,8,50,95.03,81,99.12,100,100,97.19,92.88,15.62,29.4,43.5,24.12,25,25,15.94,42.88,0,0,0,0,0,0,0,0,0,1,1,0,1,2,1,0,0,0,0,0,0,0,0,0,0,2,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0.2,1,0,0,1,0.8,0,0.3,0.45,0.375,5,5,5,0,-0.8,0.2,0,-0.2,0,0,0,0,0,0,0,0,-1,1,1,-1,0,0,-1,1,0,15 cents,100 minutes,36 days,Male,University - Undergraduate,55,,0.125,0,0,0,0,1,0,0,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,5,7,6,2,9,4,3,1,8,4,2,3,1 +483,R_7GUCMjzxXfZ7UvT,60 - 66,,Canadian,Canadian,Male,Strongly disagree,Agree,Strongly agree,Strongly disagree,Somewhat agree,3,5,4,1,2,Somewhat disagree,Strongly disagree,Strongly agree,Disagree,Somewhat disagree,2,1,3,5,4,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,1,5,2,Somewhat agree,Agree,Strongly Agree,Agree,Somewhat disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly disagree,Strongly Agree,Agree,Strongly disagree,Somewhat agree,5,2,3,1,4,2,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,5,3,1,2,2,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Disagree,Strongly Agree,1,3,5,2,4,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Agree,Agree,Disagree,Agree,2,4,1,5,3,3,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,4,1,3,2,5,1,Agree,Disagree,Agree,Strongly Disagree,Strongly agree,1,5,2,3,4,3,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat disagree,4,1,5,2,3,TRUE,76,TRUE,97,TRUE,96,TRUE,50,TRUE,86,FALSE,64,TRUE,97,TRUE,100,TRUE,91,TRUE,100,FALSE,59,TRUE,100,TRUE,98,TRUE,100,TRUE,60,TRUE,98,TRUE,50,TRUE,59,TRUE,60,FALSE,50,TRUE,55,TRUE,93,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,59,FALSE,50,TRUE,91,TRUE,92,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,2,3,-3,1,-1,-3,3,-2,-1,2,-2,3,-3,3,1,2,3,2,-1,-3,3,2,-3,1,3,1,-1,3,-1,1,2,1,-2,1,-1,3,2,1,1,1,1,-1,4,-2,2,2,-2,2,1,-1,-2,2,-2,1,3,2,-2,2,-3,3,1,1,1,2,2,-1,3,TRUE,0,76,TRUE,1,97,TRUE,0,96,TRUE,0,50,TRUE,1,86,FALSE,1,64,TRUE,1,97,TRUE,1,100,TRUE,1,91,TRUE,1,100,FALSE,1,59,TRUE,0,100,TRUE,1,98,TRUE,0,100,TRUE,1,60,TRUE,1,98,TRUE,0,50,TRUE,0,59,TRUE,0,60,FALSE,1,50,TRUE,1,55,TRUE,1,93,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,59,FALSE,1,50,TRUE,1,91,TRUE,1,92,TRUE,1,100,0,0,0.0004,0.0009,0,0.1296,0,0,0.25,0.0049,0.0081,0.0004,0.0081,0.1681,0.0196,0.0009,0.25,0.25,0.1681,0,0.2025,0.16,0.36,1,0.25,0.25,0.0064,0.5776,0.9216,0.3481,0.25,1,0.235142857,0.077835714,0.39245,26,81.25,22,68.75,5,62.5,6,75,5,62.5,6,75,16,100,6,37.5,79.09,69.88,69.12,90.62,86.75,91.12,67.06,12.5,10.34,7.38,-5.88,28.12,11.75,-8.88,29.56,0,1,1,0,0,2,2,0,1,2,1,0,2,2,0,0,1,2,1,0,1,0,1,1,1,0,1,1,0,2,0,0,1,0,0,0,1,1,0,0,0.4,1.4,1,0.8,0.8,0.8,0.2,0.4,0.9,0.55,0.725,2.33,1.67,2.375,-0.4,0.6,0.8,0.4,0.333333333,2,-1,1,1,0.66,2,2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,62,Strange survey and too long for the reward,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,9,7,5,4,2,3,8,1,6,3,4,2,1 +484,R_5bx13hGQXN0QbyF,60 - 66,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Somewhat disagree,Somewhat agree,4,3,1,2,5,Disagree,Disagree,Agree,Neither agree nor disagree,Somewhat disagree,4,3,2,5,1,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,2,1,3,4,5,Agree,Agree,Agree,Strongly Agree,Somewhat agree,5,2,4,1,3,Agree,Strongly Agree,Agree,Somewhat disagree,Somewhat agree,5,2,4,3,1,3,Disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,2,5,2,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,1,2,3,4,5,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,5,3,4,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Somewhat disagree,4,2,3,1,5,3,Strongly disagree,Disagree,Agree,Somewhat disagree,Disagree,2,5,4,1,3,1,Agree,Somewhat Agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,1,4,2,5,3,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,2,5,4,3,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,82,FALSE,71,TRUE,70,FALSE,89,TRUE,64,TRUE,66,TRUE,62,TRUE,87,FALSE,87,TRUE,69,FALSE,94,FALSE,71,FALSE,61,TRUE,88,FALSE,61,TRUE,99,TRUE,50,TRUE,90,FALSE,67,FALSE,59,FALSE,58,TRUE,88,TRUE,59,TRUE,98,TRUE,95,FALSE,89,TRUE,88,TRUE,50,FALSE,100,TRUE,91,FALSE,69,25,2,3,2,-1,1,-2,-2,2,0,-1,1,1,0,-2,1,2,2,2,3,1,2,3,2,-1,1,3,-2,-2,2,0,0,2,2,1,0,1,1,4,1,1,0,1,1,3,3,3,2,-1,-1,3,-3,-2,2,-1,-2,1,2,1,0,-2,1,1,1,1,2,2,2,3,FALSE,1,69,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,88,FALSE,1,89,TRUE,1,95,TRUE,1,98,TRUE,1,59,TRUE,1,88,FALSE,1,58,FALSE,1,59,FALSE,0,67,TRUE,0,90,TRUE,1,50,TRUE,1,99,FALSE,1,61,TRUE,0,88,FALSE,1,61,FALSE,1,71,FALSE,0,94,TRUE,1,69,FALSE,1,87,TRUE,1,87,TRUE,0,62,TRUE,1,66,TRUE,0,64,FALSE,1,89,TRUE,0,70,FALSE,0,71,TRUE,1,82,TRUE,1,100,0.0004,0.1156,0.0001,0.0025,0,0.0121,0.0169,0.0144,0.0841,0.0961,0.5041,0.4489,0.1681,0.1764,0.0144,0.0081,0.0169,0.25,0.0121,0.3844,0.8836,0.25,0.1521,0.81,0.1521,0.4096,0.0324,0.0961,0,0.7744,0.49,0.1681,0.229478571,0.129321429,0.329635714,25,78.13,23,71.88,6,75,5,62.5,5,62.5,7,87.5,13,81.25,10,62.5,77.25,64.38,82,78.38,84.25,81.5,73,6.25,5.37,-10.62,19.5,15.88,-3.25,0.25,10.5,0,0,0,0,0,0,0,0,0,1,1,0,0,3,0,1,1,2,2,0,1,0,0,0,2,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,0,0.2,0.8,1.2,0.6,0.6,0.2,0.8,0.55,0.55,0.55,3,1.67,2.5,-0.6,-0.4,0.6,0.4,-0.133333333,0,1,3,0,1.33,1,1,1,-1,1,-1,1,-1,1,-1,1,0,10 cents,5 minutes,36 days,Female,High School (or equivalent),66,,0.875,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,9,7,3,8,4,6,1,5,2,4,3,1 +485,R_7rr9Lf4jp0qsiBP,60 - 66,American,,American,Female,Somewhat agree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,3,2,1,5,4,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,4,5,1,2,3,Strongly Agree,Somewhat Agree,Agree,Disagree,Agree,3,5,4,2,1,Somewhat agree,Somewhat disagree,Agree,Agree,Somewhat disagree,4,3,5,2,1,Neither agree nor disagree,Somewhat agree,Agree,Agree,Strongly disagree,2,3,5,4,1,7,Disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,4,2,5,1,6,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,2,3,4,7,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,4,1,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Strongly Agree,Disagree,3,4,2,1,5,7,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,4,3,5,1,2,7,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,5,1,4,2,3,8,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat disagree,1,3,5,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,93,FALSE,51,FALSE,70,TRUE,71,TRUE,57,TRUE,51,FALSE,52,FALSE,76,TRUE,61,TRUE,57,TRUE,82,TRUE,57,TRUE,58,FALSE,53,TRUE,73,TRUE,50,FALSE,51,TRUE,74,FALSE,70,FALSE,53,TRUE,72,TRUE,51,TRUE,52,FALSE,70,TRUE,52,TRUE,53,FALSE,51,TRUE,79,TRUE,92,FALSE,93,21,1,1,3,2,0,-2,0,2,0,1,3,1,2,-2,2,1,-1,2,2,-1,0,1,2,2,-3,7,-2,-1,1,0,1,6,2,1,1,1,1,7,1,1,2,0,2,6,2,2,3,3,-2,7,1,-1,1,-2,0,7,3,0,3,0,2,8,1,1,2,2,-1,5,FALSE,1,93,TRUE,1,92,TRUE,0,79,FALSE,1,51,TRUE,1,53,TRUE,0,52,FALSE,0,70,TRUE,1,52,TRUE,1,51,TRUE,1,72,FALSE,1,53,FALSE,1,70,TRUE,1,74,FALSE,1,51,TRUE,1,50,TRUE,1,73,FALSE,1,53,TRUE,0,58,TRUE,0,57,TRUE,0,82,TRUE,1,57,TRUE,1,61,FALSE,1,76,FALSE,0,52,TRUE,0,51,TRUE,1,57,TRUE,0,71,FALSE,1,70,FALSE,1,51,TRUE,1,93,FALSE,0,50,TRUE,1,100,0.2304,0.1849,0.0729,0.49,0,0.2704,0.2704,0.0784,0.6724,0.1521,0.0049,0.0676,0.2401,0.2209,0.2209,0.0064,0.0576,0.2401,0.09,0.2601,0.1849,0.25,0.3249,0.2401,0.2209,0.5041,0.25,0.0049,0.6241,0.3364,0.2401,0.09,0.218667857,0.178728571,0.258607143,21,65.63,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,13,81.25,9,56.25,64.84,59.38,64.5,64.12,71.38,66.06,63.62,-3.12,-3.91,-3.12,-23,1.62,8.88,-15.19,7.37,1,0,1,0,3,0,1,1,0,0,1,0,1,3,1,0,2,0,2,3,1,1,0,1,2,3,1,1,2,1,0,1,1,2,0,0,2,0,0,0,1,0.4,1.2,1.4,1,1.6,0.8,0.4,1,0.95,0.975,6.67,7.33,6.625,0,-1.2,0.4,1,-0.266666667,0,-1,-1,1,-0.66,1,2,1,-1,1,1,-1,-1,1,-2,2,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),66,,1,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,7,4,3,8,9,6,2,1,5,2,3,4,1 +486,R_7rvHiXsBZBwFJzB,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Agree,Strongly agree,Strongly agree,Somewhat agree,3,5,1,4,2,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,3,1,2,4,5,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,1,4,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,5,2,3,1,7,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,1,5,3,2,7,Strongly Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,4,3,5,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Strongly Agree,Agree,Somewhat agree,2,4,1,3,5,7,Disagree,Disagree,Somewhat agree,Disagree,Disagree,5,4,3,2,1,7,Strongly agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,3,2,1,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,1,3,5,4,TRUE,100,FALSE,51,TRUE,100,TRUE,54,FALSE,53,FALSE,75,TRUE,80,TRUE,100,TRUE,50,TRUE,100,FALSE,80,TRUE,94,TRUE,95,TRUE,76,TRUE,62,TRUE,100,FALSE,100,TRUE,99,FALSE,75,TRUE,100,TRUE,100,TRUE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,98,FALSE,53,FALSE,87,TRUE,99,TRUE,100,FALSE,53,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,3,3,1,0,-2,2,-2,1,3,0,1,0,1,-1,-1,0,1,-1,2,2,3,3,1,6,-2,-2,2,-2,0,7,3,-1,1,1,1,7,1,1,1,1,-1,7,2,2,3,2,1,8,-2,-2,1,-2,-2,7,3,-1,2,0,2,7,-1,-1,-1,-1,-1,7,TRUE,0,100,FALSE,0,51,TRUE,0,100,TRUE,0,54,FALSE,0,53,FALSE,1,75,TRUE,1,80,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,80,TRUE,0,94,TRUE,1,95,TRUE,0,76,TRUE,1,62,TRUE,1,100,FALSE,1,100,TRUE,0,99,FALSE,1,75,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,98,FALSE,1,53,FALSE,1,87,TRUE,0,99,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0.0004,0,0.04,0,0.0625,0,0,1,0,0,0.0025,0.25,0.04,0.2809,0.2601,0.2304,0.2916,0.0169,0,0,0.1444,0.0625,0.5776,0,0.2209,0.2809,1,1,0.9801,0.9801,0.8836,0.305892857,0.172714286,0.439071429,26,81.25,21,65.63,5,62.5,6,75,5,62.5,5,62.5,13,81.25,8,50,83.94,59.75,84.25,94.12,97.62,83.88,84,15.62,18.31,-2.75,9.25,31.62,35.12,2.63,34,1,0,0,0,0,2,0,0,0,1,0,1,0,1,0,2,2,1,0,0,1,0,0,1,0,2,0,1,0,3,0,1,1,0,1,0,0,1,2,0,0.2,0.6,0.4,1,0.4,1.2,0.6,0.6,0.55,0.7,0.625,6.67,7.33,7,-0.2,-0.6,-0.2,0.4,-0.333333333,-2,0,0,0,-0.66,0,2,2,-2,2,-2,2,-2,2,-2,2,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,interesting but repetitive survey,1.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,01DIR,6,2,3,9,5,4,8,1,7,2,4,3,1 +487,R_3cvFlRg40Ei120A,39 - 45,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,5,2,3,1,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,2,3,4,5,1,Agree,Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,5,2,4,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,3,1,5,2,Agree,Strongly Agree,Agree,Neither agree nor disagree,Strongly Agree,2,4,5,1,3,2,Strongly disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Agree,4,5,1,3,2,6,Strongly Agree,Disagree,Somewhat Agree,Agree,Strongly Agree,4,2,3,5,1,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Somewhat disagree,1,3,2,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,50,TRUE,75,FALSE,75,TRUE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,75,TRUE,100,FALSE,100,FALSE,100,TRUE,75,TRUE,50,TRUE,70,FALSE,75,FALSE,100,TRUE,50,FALSE,50,FALSE,75,FALSE,75,FALSE,100,20,2,3,2,1,3,-3,-1,2,-1,3,2,-2,1,1,3,0,0,0,-1,-1,2,3,2,0,3,2,-3,0,-2,0,2,6,3,-2,1,2,3,7,0,0,0,-2,-1,4,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,100,FALSE,0,75,FALSE,1,75,FALSE,1,50,TRUE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,70,TRUE,1,50,TRUE,1,75,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,75,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,50,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,75,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.09,0,0,0.5625,0,0,0,0.0625,0.25,0,0.25,0,0.25,0,0.25,0.5625,0,0.25,0.0625,1,0.0625,0.25,1,0.0625,0.25,0.25,0.25,0,0.0625,1,0.5625,0,0.238839286,0.133928571,0.34375,20,62.5,21,65.63,3,37.5,6,75,5,62.5,7,87.5,11,68.75,10,62.5,78.75,65.62,81.25,90.62,77.5,76.25,81.25,-3.13,13.12,28.12,6.25,28.12,-10,7.5,18.75,0,0,0,1,0,0,1,4,1,1,1,0,0,1,0,0,0,0,1,0,2,3,2,1,3,3,1,2,1,3,2,2,1,1,3,0,0,0,1,1,0.2,1.4,0.4,0.2,2.2,2,1.8,0.4,0.55,1.6,1.075,5,5,4.875,-2,-0.6,-1.4,-0.2,-1.333333333,-3,1,2,-1,0,-2,1,2,-2,2,1,-1,-2,2,-1,1,-2,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,Interesting survey. I realized that as I clicked next I got the lake question wrong lol,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,3,8,9,2,5,4,7,1,6,2,3,4,1 +488,R_5WNi0HR9SkD0VYR,60 - 66,American,,American,Female,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,5,2,4,3,Somewhat disagree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,1,3,5,4,2,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Agree,3,2,1,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,3,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,4,5,3,2,1,1,Somewhat disagree,Disagree,Agree,Neither agree nor disagree,Somewhat disagree,2,5,4,3,1,1,Agree,Strongly Agree,Agree,Strongly Disagree,Agree,5,1,2,3,4,1,Disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,5,2,1,3,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,3,1,2,4,5,3,Agree,Agree,Somewhat Agree,Strongly Disagree,Agree,4,3,1,2,5,1,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,3,4,2,1,5,TRUE,91,FALSE,56,FALSE,100,FALSE,50,TRUE,58,FALSE,100,TRUE,76,TRUE,100,TRUE,65,TRUE,100,FALSE,53,TRUE,99,TRUE,75,TRUE,59,TRUE,50,TRUE,71,FALSE,56,TRUE,70,FALSE,50,FALSE,53,TRUE,57,TRUE,55,FALSE,78,TRUE,74,FALSE,69,TRUE,97,FALSE,56,FALSE,55,TRUE,100,TRUE,81,FALSE,54,TRUE,79,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,0,1,-1,-1,2,-2,0,3,3,1,-1,2,1,1,1,1,-2,2,2,2,2,2,2,-1,-2,2,0,-1,1,2,3,2,-3,2,1,-2,-1,1,0,-2,1,2,2,2,0,2,4,0,-3,2,-3,0,1,2,2,1,-3,2,3,-1,-1,0,0,-3,1,TRUE,0,91,FALSE,0,56,FALSE,1,100,FALSE,1,50,TRUE,1,58,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,53,TRUE,0,99,TRUE,1,75,TRUE,0,59,TRUE,1,50,TRUE,1,71,FALSE,1,56,TRUE,0,70,FALSE,1,50,FALSE,1,53,TRUE,1,57,TRUE,1,55,FALSE,1,78,TRUE,1,74,FALSE,1,69,TRUE,1,97,FALSE,1,56,FALSE,1,55,TRUE,0,100,TRUE,1,81,FALSE,0,54,TRUE,1,79,0,0.0009,0.0841,0.0576,0.0441,0,0.0676,0,0.2209,0.2025,0.0361,0.0625,0.1225,0.2209,0.1764,0.3136,0.0484,0.25,0.2025,0.0961,0.1849,0.25,0.25,0.3481,0.1936,0.1936,0.2916,0.8281,0,0.49,1,0.9801,0.252646429,0.126107143,0.379185714,16,50,25,78.13,6,75,7,87.5,5,62.5,7,87.5,14,87.5,11,68.75,71.47,54.25,75.38,77.12,79.12,71.75,71.19,-28.13,-6.66,-20.75,-12.12,14.62,-8.38,-15.75,2.44,0,0,0,2,1,0,1,0,2,1,1,0,1,2,0,3,2,0,1,0,0,0,0,0,1,1,2,0,1,0,1,1,0,2,0,2,2,1,1,1,0.6,0.8,0.8,1.2,0.2,0.8,0.8,1.4,0.85,0.8,0.825,1.33,2.67,1.75,0.4,0,0,-0.2,0.133333333,-2,0,-2,0,-1.34,1,1,0,-1,1,-1,1,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,63,No feedback to share,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,5,3,7,8,6,4,2,1,9,2,3,4,1 +489,R_6MhAwx12zO2geZ5,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly disagree,2,4,5,3,1,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,3,2,1,4,5,Strongly Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,1,5,2,4,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,5,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,1,3,5,2,4,0,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,4,1,3,2,5,0,Strongly Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,4,5,1,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,1,4,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,2,4,5,1,3,0,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,2,5,4,3,1,0,Strongly Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,2,5,1,3,4,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,4,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,0,-3,0,3,-3,3,-3,-3,-3,3,-3,0,-3,-3,-3,-3,-3,3,3,3,0,-3,0,0,3,-3,3,-3,0,-3,-3,3,0,0,0,-3,-3,-3,-3,-3,0,3,3,3,0,-3,0,0,3,-3,3,-3,0,-3,-3,3,-3,0,0,-3,-3,-3,-3,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,1,1,1,1,0.223214286,0.035714286,0.410714286,24,75,24,75,4,50,7,87.5,7,87.5,6,75,15,93.75,9,56.25,85.94,62.5,87.5,93.75,100,90.62,81.25,0,10.94,12.5,0,6.25,25,-3.13,25,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0,0,0,0,0,0.15,0,0.075,0,0,0,0,0,0.6,0,0.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),59,interesting...,0,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,6,4,5,7,3,2,9,1,8,2,4,3,1 +490,R_7g8xvezOordk4nv,60 - 66,American,,American,Female,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,3,2,1,4,Disagree,Strongly disagree,Strongly agree,Disagree,Agree,1,5,2,4,3,Strongly Agree,Strongly Agree,Agree,Strongly Disagree,Agree,3,5,2,1,4,Agree,Agree,Strongly Agree,Strongly Agree,Agree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,2,4,1,3,2,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,5,2,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,1,2,3,4,5,6,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,1,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,5,2,1,3,4,1,Strongly disagree,Disagree,Strongly agree,Disagree,Agree,4,3,1,5,2,1,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Agree,3,4,2,1,5,1,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,3,4,5,FALSE,82,TRUE,93,FALSE,100,FALSE,55,TRUE,71,FALSE,100,TRUE,61,TRUE,100,TRUE,82,TRUE,81,FALSE,50,FALSE,63,TRUE,62,TRUE,100,TRUE,50,TRUE,57,FALSE,74,FALSE,100,TRUE,55,FALSE,98,FALSE,50,FALSE,50,FALSE,100,TRUE,76,FALSE,100,TRUE,80,TRUE,50,FALSE,100,FALSE,50,TRUE,81,FALSE,50,TRUE,90,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,-2,-3,3,-2,2,3,3,2,-3,2,2,2,3,3,2,2,3,3,2,3,2,-2,-3,3,-3,2,2,3,3,3,-3,2,1,2,2,3,2,3,6,2,3,3,3,-1,1,-3,-2,3,-2,2,1,3,3,1,-3,2,1,-1,1,0,1,1,1,FALSE,1,82,TRUE,1,93,FALSE,1,100,FALSE,1,55,TRUE,1,71,FALSE,1,100,TRUE,1,61,TRUE,1,100,TRUE,1,82,TRUE,1,81,FALSE,1,50,FALSE,1,63,TRUE,1,62,TRUE,0,100,TRUE,1,50,TRUE,1,57,FALSE,1,74,FALSE,1,100,TRUE,0,55,FALSE,1,98,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,100,TRUE,1,80,TRUE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,81,FALSE,0,50,TRUE,1,90,0,0.04,0.1849,0.1521,0.01,0,0.0576,0.0361,0.0004,0.25,0.0361,0.1444,0.0324,0.25,0.0841,0.0049,0,0.2025,0,0,0.25,0.25,0.3025,1,0.0676,0.25,0.25,0.0324,0,0,0.25,0.1369,0.139210714,0.079178571,0.199242857,25,78.13,26,81.25,5,62.5,7,87.5,6,75,8,100,13,81.25,13,81.25,75.34,60.62,74.62,81.75,84.38,70.88,79.81,-3.12,-5.91,-1.88,-12.88,6.75,-15.62,-10.37,-1.44,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,4,1,1,0,0,0,0,0,1,0,0,3,1,3,2,1,0,0.2,0.2,0.4,1,0.4,0.2,2,0.2,0.9,0.55,1.67,1,1.875,-1,-0.2,0,-1.6,-0.4,1,1,0,5,0.67,0,1,-1,-2,2,0,0,1,-1,0,0,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,63,,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,9,4,7,2,8,6,5,1,3,2,4,3,1 +491,R_3dFIVMPBxdyXYss,60 - 66,,Canadian,Canadian,Female,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,5,3,2,4,1,Somewhat disagree,Somewhat disagree,Agree,Strongly disagree,Somewhat agree,4,3,5,2,1,Agree,Disagree,Agree,Disagree,Strongly Agree,3,4,5,1,2,Agree,Agree,Agree,Agree,Agree,5,2,1,3,4,Agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,5,4,2,1,3,4,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,4,3,5,2,7,Agree,Disagree,Somewhat Disagree,Agree,Agree,3,4,1,2,5,6,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,3,4,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Agree,Agree,Agree,3,5,4,1,2,1,Disagree,Neither agree nor disagree,Agree,Strongly disagree,Somewhat disagree,4,2,1,5,3,2,Agree,Disagree,Agree,Strongly Disagree,Strongly Agree,3,2,4,5,1,1,Somewhat agree,Somewhat agree,Agree,Agree,Agree,4,2,3,5,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,60,TRUE,100,FALSE,100,TRUE,50,TRUE,65,FALSE,100,TRUE,60,TRUE,100,TRUE,50,TRUE,100,FALSE,75,FALSE,75,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,80,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,100,TRUE,75,FALSE,100,TRUE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,0,2,0,3,-1,-1,2,-3,1,2,-2,2,-2,3,2,2,2,2,2,2,0,2,1,2,4,-1,1,2,1,1,7,2,-2,-1,2,2,6,-1,0,1,-1,1,6,2,0,2,2,2,1,-2,0,2,-3,-1,2,2,-2,2,-3,3,1,1,1,2,2,2,2,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,65,FALSE,1,100,TRUE,1,60,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,75,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,75,FALSE,0,100,TRUE,1,50,TRUE,1,100,0,0,0,0.16,0,0,0,0,0.25,0.04,1,0,0.25,0.0625,0.1225,0,0,0.25,0,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.16,0,1,0.5625,0.0625,0.187857143,0.141071429,0.234642857,25,78.13,24,75,5,62.5,5,62.5,7,87.5,7,87.5,14,87.5,10,62.5,79.38,59.38,80,87.5,90.62,81.56,77.19,3.13,4.38,-3.12,17.5,0,3.12,-5.94,14.69,0,0,0,1,1,0,2,0,4,0,0,0,3,4,1,3,2,1,3,1,0,0,0,2,1,1,1,0,0,2,0,0,0,1,0,1,1,0,0,0,0.4,1.2,1.6,2,0.6,0.8,0.2,0.4,1.3,0.5,0.9,5.67,1.33,3.625,-0.2,0.4,1.4,1.6,0.533333333,3,5,5,4,4.34,1,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,66,,1.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,5,6,9,4,8,2,1,7,2,3,4,1 +492,R_1AFJJE4jeOYAfJc,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,Agree,Agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,2,1,3,5,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,Strongly disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,2,1,3,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,1,3,3,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,3,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,3,2,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,1,5,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,4,2,0,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,3,2,4,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,1,5,4,3,2,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,1,2,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,50,TRUE,100,FALSE,76,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,90,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,2,2,3,0,3,2,3,3,3,3,-3,0,-3,0,-3,3,3,3,3,3,3,1,3,3,3,3,2,3,3,3,3,3,3,-3,-3,-3,-3,-3,0,3,3,3,3,3,0,3,2,3,3,3,4,-2,3,3,3,-1,5,-1,0,0,0,-3,6,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.25,0.01,0,0,0,0,0,0,0.25,0,0,0,0,0,0,0.25,1,0.0576,1,0.25,0,0,1,1,0,0,1,0,1,1,1,1,0.350271429,0.111257143,0.589285714,28,87.5,20,62.5,5,62.5,6,75,6,75,3,37.5,13,81.25,7,43.75,92.69,90.75,100,92.5,87.5,93.12,92.25,25,30.19,28.25,25,17.5,50,11.87,48.5,0,0,0,0,0,1,1,0,3,0,1,0,0,0,0,0,3,0,3,0,0,0,0,0,0,1,0,0,3,0,4,0,0,0,4,2,0,3,0,0,0,1,0.2,1.2,0,0.8,1.6,1,0.6,0.85,0.725,2.67,3,2.875,0,0.2,-1.4,0.2,-0.4,3,-2,-2,-6,-0.33,2,2,2,-2,2,2,-2,-2,2,-1,1,2,10 cents,25 minutes,15 days,Male,High School (or equivalent),53,,1.375,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,9,3,8,7,4,5,2,1,6,2,3,4,1 +493,R_6DPoGEOTRfRezWV,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,3,5,1,2,Strongly disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,5,1,2,4,3,Strongly Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,1,5,4,2,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly disagree,Agree,Strongly disagree,Strongly Agree,4,3,2,1,5,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,2,3,5,4,1,1,Strongly Agree,Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,2,1,4,3,5,10,Agree,Agree,Agree,Agree,Somewhat agree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly disagree,Strongly Agree,Agree,Strongly Agree,3,2,1,4,5,1,Disagree,Neither agree nor disagree,Strongly agree,Agree,Somewhat disagree,5,1,3,2,4,1,Strongly agree,Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,4,1,2,3,5,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,2,4,5,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,97,TRUE,50,TRUE,50,TRUE,50,TRUE,90,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,74,TRUE,100,TRUE,75,TRUE,66,FALSE,50,TRUE,50,TRUE,95,TRUE,87,TRUE,100,FALSE,100,TRUE,80,FALSE,50,FALSE,68,FALSE,66,TRUE,85,23,3,-3,3,0,3,-3,1,3,3,-1,3,-1,1,1,3,-1,0,0,2,2,3,-3,2,-3,3,0,1,0,3,2,1,1,3,-2,0,1,1,1,2,2,2,2,1,10,3,-3,3,2,3,3,-2,0,3,2,-1,1,3,-2,0,-3,3,1,0,0,0,2,2,8,TRUE,0,85,FALSE,0,66,FALSE,1,68,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,87,TRUE,1,95,TRUE,1,50,FALSE,1,50,TRUE,0,66,TRUE,1,75,TRUE,0,100,TRUE,1,74,TRUE,1,100,TRUE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,50,TRUE,1,50,TRUE,0,50,FALSE,1,97,TRUE,0,75,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0169,0.25,0,0,0,0,0.01,0.25,0,0,0,0.0625,0.0025,0.25,0.04,0.4356,0,0.25,0.0009,0.25,0,0.0676,0.25,1,0.25,0.25,1,0.7225,0.1024,0.25,0.5625,0.4356,0.230075,0.0929,0.36725,23,71.88,21,65.63,4,50,6,75,4,50,7,87.5,14,87.5,7,43.75,78.38,66.88,85,73.12,88.5,85.44,71.31,6.25,12.75,16.88,10,23.12,1,-2.06,27.56,0,0,1,3,0,4,1,0,1,2,0,1,1,0,2,3,2,2,0,1,0,0,0,2,0,1,1,0,1,0,0,1,1,4,0,1,0,0,0,0,0.8,1.6,0.8,1.6,0.4,0.6,1.2,0.2,1.2,0.6,0.9,0.67,1.67,3.125,0.4,1,-0.4,1.4,0.333333333,-3,0,0,2,-1,0,2,2,-2,2,-2,2,-1,1,0,0,0,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),53,,1.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,5,7,8,4,3,2,9,1,6,4,2,3,1 +494,R_3F3tIXBjwMQ5kZi,53 - 59,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,5,4,2,3,1,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,5,4,2,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,2,4,1,5,2,Strongly agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Strongly agree,1,5,2,3,4,1,Agree,Agree,Strongly Agree,Agree,Strongly Agree,2,3,1,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,0,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,4,1,2,3,5,8,Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,1,2,4,5,3,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,4,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,96,FALSE,80,FALSE,64,FALSE,63,TRUE,60,TRUE,100,TRUE,70,FALSE,65,TRUE,77,TRUE,100,TRUE,97,TRUE,87,FALSE,65,TRUE,100,FALSE,87,FALSE,73,TRUE,86,FALSE,100,TRUE,85,TRUE,100,FALSE,66,TRUE,100,FALSE,100,TRUE,95,FALSE,79,FALSE,100,TRUE,87,TRUE,100,FALSE,96,TRUE,96,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,1,0,1,-2,2,2,1,3,1,3,2,3,3,3,3,3,3,3,2,3,2,3,0,1,-1,3,1,2,2,3,2,3,1,3,3,3,3,3,3,3,3,3,3,3,0,1,0,1,-2,2,8,2,1,3,2,3,9,3,3,3,3,3,9,TRUE,0,100,TRUE,1,100,TRUE,0,96,FALSE,1,80,FALSE,0,64,FALSE,1,63,TRUE,1,60,TRUE,1,100,TRUE,1,70,FALSE,0,65,TRUE,0,77,TRUE,0,100,TRUE,1,97,TRUE,0,87,FALSE,0,65,TRUE,1,100,FALSE,1,87,FALSE,1,73,TRUE,0,86,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,66,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,79,FALSE,1,100,TRUE,0,87,TRUE,1,100,FALSE,0,96,TRUE,1,96,0,0.0025,0,0.16,0.0016,0.1369,0,0.4225,0,0,0,0.0009,0.09,0.5929,0.4096,0,0.1156,0.04,0,0,0.0225,0.4225,0.7396,0.7569,0.0169,0.0441,0.9216,1,0.9216,0.0729,0.7569,1,0.303053571,0.129285714,0.476821429,20,62.5,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,86.69,81.62,80.62,85,99.5,87.06,86.31,-3.13,21.06,31.62,5.62,22.5,24.5,12.06,30.06,0,0,0,1,0,2,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.2,0.8,0.4,0.2,0,0,0.2,0.2,0.4,0.1,0.25,1.33,5.67,4.125,0.2,0.8,0.2,0,0.4,2,-7,-8,-6,-4.34,1,1,1,-2,2,-2,2,-1,1,1,-1,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,"this survey was great, thank you",1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,6,9,2,5,8,7,1,4,3,4,2,1 +495,R_12Y2xhiqWBwP4Mi,60 - 66,American,,American,Male,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Strongly disagree,2,4,5,3,1,Disagree,Strongly disagree,Agree,Disagree,Disagree,5,3,4,2,1,Strongly Agree,Somewhat Agree,Disagree,Strongly Disagree,Somewhat Agree,3,1,4,5,2,Agree,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Somewhat disagree,Agree,Strongly disagree,Neither agree nor disagree,3,2,4,1,5,1,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Disagree,5,2,4,1,3,1,Strongly Agree,Agree,Neither Agree nor Disagree,Disagree,Agree,5,1,3,2,4,1,Agree,Agree,Strongly Agree,Agree,Somewhat disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Strongly disagree,2,4,3,5,1,1,Strongly disagree,Somewhat disagree,Agree,Strongly disagree,Disagree,3,1,4,2,5,1,Strongly agree,Agree,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,4,2,5,3,1,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,2,3,4,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,75,TRUE,100,TRUE,90,TRUE,100,TRUE,51,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,88,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,98,FALSE,100,TRUE,96,FALSE,51,TRUE,100,TRUE,100,FALSE,100,FALSE,70,FALSE,54,FALSE,100,TRUE,100,FALSE,100,21,1,1,1,-2,-3,-2,-3,2,-2,-2,3,1,-2,-3,1,2,3,2,3,0,0,-1,2,-3,0,1,-3,-3,2,-3,-2,1,3,2,0,-2,2,1,2,2,3,2,-1,1,1,0,1,-2,-3,0,-3,-1,2,-3,-2,1,3,2,0,-3,1,1,3,3,3,3,0,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,54,FALSE,0,70,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,51,TRUE,1,96,FALSE,1,100,TRUE,0,98,FALSE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,51,TRUE,0,100,TRUE,0,90,TRUE,1,100,FALSE,0,75,TRUE,1,100,0,0,0,0,0,0,0,0.0016,0,0,0,1,0.2601,0,0.49,0,0,0.2116,1,0,0,0,0,1,0.7744,0.2601,0.5625,0,0,0,0.81,0.9604,0.261810714,0.140235714,0.383385714,21,65.63,22,68.75,5,62.5,4,50,7,87.5,6,75,12,75,10,62.5,92.91,78.88,93.5,99.5,99.75,93.25,92.56,-3.12,24.16,16.38,43.5,12,24.75,18.25,30.06,1,2,1,1,3,1,0,0,1,0,0,1,2,1,1,0,1,1,1,1,0,1,0,0,0,1,2,0,1,0,0,1,2,0,0,1,0,1,0,0,1.6,0.4,1,0.8,0.2,0.8,0.6,0.4,0.95,0.5,0.725,1,0.67,0.875,1.4,-0.4,0.4,0.4,0.466666667,1,0,0,0,0.33,0,1,1,-1,1,0,0,1,-1,-1,1,-2,5 cents,5 minutes,24 days,Male,University - Undergraduate,66,,0.125,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,7,4,6,9,2,8,3,1,5,4,3,2,1 +496,R_7eLg2r874DaAHXS,46 - 52,American,,American,Male,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,2,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,2,1,4,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,2,3,5,1,4,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,2,4,4,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,1,2,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,5,2,1,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,5,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,5,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,3,5,4,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,4,3,TRUE,97,TRUE,75,TRUE,95,TRUE,50,TRUE,50,TRUE,59,TRUE,90,TRUE,96,TRUE,50,TRUE,95,FALSE,57,TRUE,70,TRUE,94,TRUE,85,TRUE,50,TRUE,94,TRUE,50,FALSE,76,TRUE,60,TRUE,95,TRUE,90,TRUE,95,TRUE,60,TRUE,87,TRUE,60,TRUE,95,TRUE,60,FALSE,54,TRUE,52,TRUE,90,TRUE,90,TRUE,93,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,1,1,2,0,0,1,-1,1,1,1,2,1,1,0,1,2,1,-1,1,1,1,1,1,4,1,1,1,0,1,4,1,1,1,1,1,6,0,0,0,0,-1,7,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,1,1,1,1,1,5,TRUE,0,97,TRUE,1,75,TRUE,0,95,TRUE,0,50,TRUE,1,50,TRUE,0,59,TRUE,1,90,TRUE,1,96,TRUE,1,50,TRUE,1,95,FALSE,1,57,TRUE,0,70,TRUE,1,94,TRUE,0,85,TRUE,1,50,TRUE,1,94,TRUE,0,50,FALSE,1,76,TRUE,0,60,TRUE,0,95,TRUE,1,90,TRUE,1,95,TRUE,0,60,TRUE,1,87,TRUE,0,60,TRUE,1,95,TRUE,0,60,FALSE,1,54,TRUE,0,52,TRUE,1,90,TRUE,1,90,TRUE,1,93,0.0016,0.0025,0.0036,0.01,0.0049,0.3481,0.0169,0.0025,0.9025,0.0025,0.01,0.0036,0.25,0.1849,0.25,0.0625,0.36,0.25,0.2116,0.36,0.01,0.25,0.36,0.7225,0.25,0.36,0.01,0.9409,0.9025,0.0576,0.2704,0.49,0.280139286,0.189171429,0.371107143,25,78.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,16,100,3,18.75,75.44,61.5,68.5,86.62,85.12,83.38,67.5,18.75,16.06,-1,18.5,24.12,22.62,-16.62,48.75,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,0,1,2,1,0,1,0,0,0,1,1,1,0,2,0,0,0,1,0,0,1,0,1,0,2,0.4,0.6,0.2,0.8,0.4,0.8,0.2,0.8,0.5,0.55,0.525,4.67,5,5.125,0,-0.2,0,0,-0.066666667,-1,-1,1,2,-0.33,0,0,1,0,0,-1,1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),50,very interesting survey,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,3,5,2,6,8,4,7,1,9,2,3,4,1 +497,R_51EwmmhPhkag5zR,60 - 66,American,,American,Female,Strongly agree,Agree,Agree,Somewhat agree,Somewhat agree,2,5,4,1,3,Strongly disagree,Disagree,Agree,Disagree,Agree,2,5,3,1,4,Somewhat Agree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,3,4,5,2,Agree,Somewhat disagree,Agree,Agree,Somewhat disagree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat disagree,Strongly Agree,5,4,2,1,3,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,3,2,5,4,2,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,1,5,2,3,Disagree,Somewhat disagree,Disagree,Somewhat disagree,Neither agree nor disagree,2,1,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Disagree,5,1,3,4,2,4,Somewhat agree,Disagree,Agree,Disagree,Agree,3,1,5,4,2,4,Neither Agree nor Disagree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,1,5,3,2,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,5,1,4,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,70,TRUE,80,TRUE,85,FALSE,90,TRUE,70,TRUE,95,FALSE,80,TRUE,85,FALSE,100,FALSE,90,FALSE,100,FALSE,95,TRUE,85,TRUE,85,FALSE,70,TRUE,100,TRUE,65,FALSE,75,TRUE,50,TRUE,100,FALSE,50,TRUE,95,TRUE,50,TRUE,100,TRUE,90,FALSE,100,TRUE,95,TRUE,50,FALSE,90,TRUE,100,FALSE,100,25,3,2,2,1,1,-3,-2,2,-2,2,1,-1,3,-3,3,2,-1,2,2,-1,1,3,1,-1,3,7,1,1,1,1,2,8,0,-1,3,-3,3,2,-2,-1,-2,-1,0,3,2,2,2,2,-2,3,1,-2,2,-2,2,4,0,-2,3,-3,3,4,0,0,2,1,-1,4,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,0,50,TRUE,1,95,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,50,TRUE,1,95,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,75,TRUE,1,65,TRUE,1,100,FALSE,1,70,TRUE,0,85,TRUE,0,85,FALSE,1,95,FALSE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,85,FALSE,1,80,TRUE,1,95,TRUE,0,70,FALSE,1,90,TRUE,0,85,TRUE,1,80,FALSE,0,70,TRUE,1,95,0,0.0025,0,0.01,0.0025,0,0.0225,0.0025,0.0025,0.81,0.04,0.25,0.25,0.25,0.0025,0,0,0.25,0.01,0.04,1,0.1225,0.7225,0.0625,0.09,0.49,0.49,0,0.01,0.7225,0.7225,1,0.263035714,0.134464286,0.391607143,25,78.13,23,71.88,4,50,6,75,6,75,7,87.5,13,81.25,10,62.5,83.91,67.5,86.88,88.75,92.5,85,82.81,6.25,12.03,17.5,11.88,13.75,5,3.75,20.31,2,1,1,2,2,4,3,1,3,0,1,0,0,0,0,4,0,4,3,1,1,0,0,1,3,4,0,0,0,0,1,1,0,0,0,2,1,0,1,0,1.6,2.2,0.2,2.4,1,0.8,0.4,0.8,1.6,0.75,1.175,5.67,3.67,4.375,0.6,1.4,-0.2,1.6,0.6,4,4,-2,-1,2,0,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,No feedback. Very interesting survey!,1.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,5,3,6,9,2,4,7,1,8,4,2,3,1 +498,R_3hVZbhbk0TiHbhX,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,1,2,4,5,3,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,1,4,3,5,2,Strongly Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,4,1,5,3,2,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,4,5,1,2,3,Somewhat agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,1,4,5,2,3,8,Somewhat agree,Disagree,Strongly agree,Strongly disagree,Disagree,3,5,1,2,4,8,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,3,5,1,2,4,8,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,1,5,2,3,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,5,4,1,2,3,8,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,3,2,4,1,8,Strongly Agree,Agree,Strongly Agree,Disagree,Agree,4,2,5,3,1,8,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,5,2,4,1,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,65,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,52,TRUE,100,TRUE,100,FALSE,100,FALSE,53,FALSE,100,FALSE,100,TRUE,100,TRUE,100,25,1,3,2,-1,3,1,-3,3,-3,-1,3,1,2,-2,1,-1,1,1,2,-1,1,3,2,-1,3,8,1,-2,3,-3,-2,8,3,1,2,-1,3,8,-1,-1,0,-1,-2,8,1,2,2,0,2,8,1,-3,2,-3,1,8,3,2,3,-2,2,8,-1,-1,1,1,-2,7,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,53,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,52,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,65,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0.2704,0,0.2809,0,0,0,1,1,0,1,1,0,1,1,0,1,0,1,0.4225,1,0.356207143,0.039378571,0.673035714,25,78.13,20,62.5,4,50,5,62.5,5,62.5,6,75,13,81.25,7,43.75,95.94,94,89.75,100,100,94.06,97.81,15.63,33.44,44,27.25,37.5,25,12.81,54.06,0,0,0,0,0,0,1,0,0,1,0,0,0,1,2,0,2,1,3,1,0,1,0,1,1,0,0,1,0,2,0,1,1,0,1,0,2,0,1,1,0,0.4,0.6,1.4,0.6,0.6,0.6,0.8,0.6,0.65,0.625,8,8,7.875,-0.6,-0.2,0,0.6,-0.266666667,0,0,0,1,0,2,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,100 minutes,15 days,Male,High School (or equivalent),51,Very interesting survey that I enjoyed thanks,1.875,0,0,0,1,1,0,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,8,3,2,9,7,6,5,1,4,4,2,3,1 +499,R_5PdYf6o5pPhwHuN,60 - 66,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,Agree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,5,1,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,2,4,1,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,3,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,1,Agree,Strongly disagree,Strongly agree,Somewhat agree,Agree,1,3,5,4,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,1,5,3,1,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,3,4,2,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,4,2,3,5,1,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,4,5,2,1,2,Agree,Agree,Agree,Agree,Somewhat agree,4,3,2,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,68,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,28,2,3,3,3,3,2,-3,3,-1,2,3,3,3,0,3,2,2,3,3,1,2,3,3,3,3,1,2,-3,3,1,2,1,3,3,3,0,3,1,-1,1,-1,-1,-1,1,2,3,3,3,3,2,1,-3,3,-2,1,2,3,3,3,0,3,0,2,2,2,2,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,68,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0.1024,0,0,1,1,1,1,0.253657143,0.142857143,0.364457143,28,87.5,25,78.13,8,100,6,75,6,75,5,62.5,14,87.5,11,68.75,99,96,100,100,100,100,98,9.37,20.87,-4,25,25,37.5,12.5,29.25,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,4,4,2,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0.4,0,2.8,0,0.6,0,0.4,0.8,0.25,0.525,1,1.33,1.25,0,-0.2,0,2.4,-0.066666667,-1,-1,1,-1,-0.33,2,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,It was quite engaging for me.,1.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,8,7,4,5,3,6,9,1,2,4,2,3,1 +500,R_7CVPG5Jkd2rRrts,39 - 45,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,3,5,4,2,Agree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,2,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,2,4,5,1,3,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Strongly disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,2,4,1,3,5,1,Agree,Disagree,Agree,Agree,Somewhat agree,1,5,3,4,2,3,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,Agree,1,4,5,3,2,7,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,5,1,4,2,3,6,Strongly agree,Strongly disagree,Agree,Somewhat disagree,Agree,5,4,3,2,1,2,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,5,1,4,3,5,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,1,2,3,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,83,TRUE,75,TRUE,92,FALSE,80,FALSE,100,FALSE,85,TRUE,74,FALSE,93,TRUE,92,FALSE,100,TRUE,100,TRUE,80,FALSE,64,FALSE,81,FALSE,75,TRUE,91,TRUE,90,FALSE,57,FALSE,87,TRUE,100,TRUE,87,FALSE,86,TRUE,90,TRUE,96,TRUE,96,TRUE,100,FALSE,81,TRUE,90,FALSE,50,TRUE,97,TRUE,77,FALSE,84,16,1,3,3,-1,3,2,-2,1,1,1,0,1,1,1,2,-1,-2,1,1,-3,3,3,3,1,3,4,2,-2,2,2,1,1,0,2,1,2,2,3,-1,1,1,1,-1,7,2,3,3,1,3,3,3,-3,2,-1,2,6,0,1,2,-1,2,2,1,1,2,2,-2,5,FALSE,1,84,TRUE,1,77,TRUE,0,97,FALSE,1,50,TRUE,1,90,FALSE,1,81,TRUE,1,100,TRUE,1,96,TRUE,1,96,TRUE,1,90,FALSE,1,86,TRUE,0,87,TRUE,1,100,FALSE,1,87,FALSE,0,57,TRUE,1,90,TRUE,0,91,FALSE,1,75,FALSE,1,81,FALSE,1,64,TRUE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,92,FALSE,1,93,TRUE,1,74,FALSE,1,85,FALSE,1,100,FALSE,1,80,TRUE,1,92,TRUE,1,75,TRUE,1,83,0.0016,0.0676,0.01,0,0.0289,0.0361,0.0064,0.01,0.1296,0,0.0064,0,0.0016,0.0196,0.01,0.0529,0,0.25,0,0.0049,0.04,0.3249,0.0361,0.0169,0.8281,0.0225,0.0625,0.0256,0.9409,0.0625,0.04,0.7569,0.132617857,0.039392857,0.225842857,16,50,28,87.5,7,87.5,7,87.5,8,100,6,75,15,93.75,13,81.25,85.41,75.88,88.12,87.88,89.75,87,83.81,-37.5,-2.09,-11.62,0.62,-12.12,14.75,-6.75,2.56,2,0,0,2,0,0,0,1,1,0,0,1,0,1,0,0,3,0,0,2,1,0,0,2,0,1,1,1,2,1,0,0,1,2,0,2,3,1,1,1,0.8,0.4,0.4,1,0.6,1.2,0.6,1.6,0.65,1,0.825,2.67,3.67,3.875,0.2,-0.8,-0.2,-0.6,-0.266666667,1,-5,1,2,-1,0,2,2,-2,2,2,-2,-1,1,-2,2,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),45,,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,2,4,3,7,5,6,9,1,8,2,4,3,1 +501,R_57s4MotjUN6HqHz,60 - 66,American,,American,Female,Somewhat disagree,Strongly agree,Agree,Neither agree nor disagree,Disagree,1,3,4,2,5,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,4,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,4,1,2,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,1,5,3,2,4,Somewhat disagree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,2,4,3,1,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,3,1,2,4,5,7,Agree,Agree,Agree,Agree,Agree,1,3,2,5,4,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,3,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,1,4,3,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,4,1,2,3,7,Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,2,3,5,4,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,4,3,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,TRUE,100,FALSE,53,FALSE,66,FALSE,50,TRUE,60,FALSE,100,FALSE,52,FALSE,50,FALSE,51,TRUE,60,FALSE,53,FALSE,54,TRUE,60,TRUE,60,FALSE,60,FALSE,51,FALSE,50,FALSE,71,TRUE,76,FALSE,51,TRUE,82,FALSE,51,TRUE,84,TRUE,71,FALSE,51,FALSE,51,FALSE,50,TRUE,81,TRUE,100,TRUE,96,17,-1,3,2,0,-2,1,0,3,0,0,2,1,2,0,1,-2,0,0,0,-3,-1,3,1,0,-1,5,0,1,3,0,1,7,2,2,2,2,2,6,0,0,0,0,-1,6,-1,2,0,0,-1,6,0,0,0,0,-1,7,2,3,2,0,2,4,1,0,0,1,-1,6,TRUE,0,96,TRUE,1,100,TRUE,0,81,FALSE,1,50,FALSE,0,51,FALSE,1,51,TRUE,1,71,TRUE,1,84,FALSE,0,51,TRUE,1,82,FALSE,1,51,TRUE,0,76,FALSE,0,71,FALSE,1,50,FALSE,0,51,FALSE,0,60,TRUE,0,60,TRUE,0,60,FALSE,1,54,FALSE,1,53,TRUE,1,60,FALSE,0,51,FALSE,1,50,FALSE,0,52,FALSE,1,100,TRUE,1,60,FALSE,1,50,FALSE,1,66,FALSE,1,53,TRUE,1,100,FALSE,0,51,TRUE,1,100,0.0256,0.16,0.36,0.0841,0,0.2401,0.2704,0.0324,0.2209,0.2601,0,0.5041,0.2601,0.2401,0.2601,0,0.25,0.25,0.1156,0,0.16,0.2601,0.2116,0.25,0.36,0.25,0.2601,0.9216,0.6561,0.36,0.2209,0.5776,0.263996429,0.199164286,0.328828571,17,53.13,19,59.38,5,62.5,5,62.5,5,62.5,4,50,8,50,11,68.75,65.5,57.25,62,71.25,71.5,68.44,62.56,-6.25,6.12,-5.25,-0.5,8.75,21.5,18.44,-6.19,0,0,1,0,1,1,1,0,0,1,0,1,0,2,1,2,0,0,0,2,0,1,2,0,1,1,0,3,0,1,0,2,0,0,1,3,0,0,1,2,0.4,0.6,0.8,0.8,0.8,1,0.6,1.2,0.65,0.9,0.775,6,5.67,5.875,-0.4,-0.4,0.2,-0.4,-0.2,-1,0,2,0,0.33,1,0,0,-2,2,-1,1,1,-1,0,0,1,10 cents,25 minutes,15 days,Female,High School (or equivalent),65,it was ok to do but i think it took longer than 16 mins,0.5,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,01ITEM,02REV,8,6,3,2,4,9,7,1,5,4,2,3,1 +502,R_6EhRcpqkjSAlOt7,60 - 66,American,,American,Male,Agree,Agree,Neither agree nor disagree,Agree,Agree,1,5,4,3,2,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,3,5,2,1,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,1,2,3,4,Agree,Somewhat agree,Agree,Agree,Somewhat agree,3,1,2,4,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,4,2,5,1,0,Agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,5,2,3,4,1,0,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,3,1,4,5,2,0,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,5,3,4,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,0,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,5,4,2,1,3,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,5,1,2,3,0,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,5,4,3,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,100,32,2,2,0,2,2,-1,-2,2,-2,0,1,1,0,1,1,2,1,2,2,1,1,0,0,-1,-1,0,2,-1,0,1,-2,0,1,-1,0,-1,0,0,0,-1,1,0,-1,0,1,-1,1,0,0,0,-1,0,0,-1,1,0,1,1,1,1,1,0,0,-1,0,1,0,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.25,0,0,0,0,0,1,0,0.25,0,0,1,0,1,1,0.169642857,0.035714286,0.303571429,32,100,27,84.38,7,87.5,7,87.5,7,87.5,6,75,16,100,11,68.75,95.31,87.5,93.75,100,100,96.88,93.75,15.62,10.93,0,6.25,12.5,25,-3.12,25,1,2,0,3,3,3,1,2,3,2,0,2,0,2,1,2,2,1,2,2,1,3,1,2,2,0,2,2,1,1,0,0,1,0,0,2,2,2,1,1,1.8,2.2,1,1.8,1.8,1.2,0.2,1.6,1.7,1.2,1.45,0,0,0,0,1,0.8,0.2,0.6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,65,a stupidly long survey with asinine questions,0,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,3,6,7,2,5,4,9,1,8,4,3,2,1 +503,R_6Iu7tgW5S1KMdS6,39 - 45,,Canadian,Canadian,Female,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,5,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,2,5,1,4,3,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,2,4,2,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,2,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,4,2,3,5,1,2,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,1,2,3,2,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,3,4,5,2,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,2,4,5,3,1,6,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Strongly disagree,2,1,3,5,4,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,50,TRUE,55,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,1,0,0,-2,1,1,1,1,0,0,2,1,2,-2,-2,-2,-3,-3,0,3,1,0,0,3,-2,1,1,1,1,2,0,-1,1,1,2,2,-2,-2,-2,-3,-3,2,1,3,1,0,1,4,-1,1,2,0,2,2,0,0,2,1,2,3,-1,-1,-1,-2,-3,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,55,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.2025,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.232142857,0.232142857,0.232142857,8,25,17,53.13,4,50,4,50,5,62.5,4,50,6,37.5,11,68.75,53.28,50,56.25,56.25,50.62,50.31,56.25,-28.13,0.15,0,6.25,-6.25,0.62,12.81,-12.5,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0.4,0,0.4,0.8,0,0.8,0.1,0.5,0.3,2.33,3,3,-0.4,-0.8,0.4,-0.8,-0.266666667,-1,0,-1,-4,-0.67,1,1,1,-1,1,0,0,-1,1,-1,1,1,10 cents,5 minutes,47 days,Female,University - Undergraduate,41,i'm wondering what this survey was actually about...,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,01DIR,9,2,3,6,8,4,5,1,7,2,4,3,1 +504,R_67rL8jAOKD0ykKU,46 - 52,,Canadian,Canadian,Female,Somewhat agree,Agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,5,4,1,2,3,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,4,2,3,Agree,Agree,Agree,Agree,Agree,4,2,5,1,3,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,0,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,2,3,5,4,2,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,4,5,1,1,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,3,1,4,0,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,3,2,5,4,1,1,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Agree,4,2,1,3,5,1,Agree,Agree,Agree,Agree,Agree,4,1,5,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,75,TRUE,75,TRUE,75,FALSE,50,TRUE,90,FALSE,50,TRUE,91,TRUE,90,TRUE,100,TRUE,50,TRUE,50,TRUE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,50,TRUE,75,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,3,3,3,-3,0,2,0,-1,2,-1,2,0,1,2,2,2,2,2,2,2,3,3,3,0,1,0,3,1,0,2,3,0,2,0,1,1,2,2,2,2,2,0,1,2,3,3,3,0,-3,0,3,-1,0,1,3,0,3,1,2,1,2,2,2,2,2,0,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,75,TRUE,1,75,TRUE,1,75,FALSE,0,50,TRUE,1,90,FALSE,1,50,TRUE,0,91,TRUE,1,90,TRUE,0,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,1,100,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,100,0.0625,0,0.25,0.0625,0,0.0625,0,0.01,0.25,0.25,0.0625,0.01,0.25,0.25,0.25,0.25,0.25,0.25,0,0,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,1,0,0.25,0.8281,0.249039286,0.153214286,0.344864286,16,50,20,62.5,6,75,3,37.5,6,75,5,62.5,11,68.75,9,56.25,69.41,50,64.38,83.12,80.12,69.06,69.75,-12.5,6.91,-25,26.88,8.12,17.62,0.31,13.5,1,0,0,0,0,4,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0.2,1.4,0.4,0,0,0.6,1,0,0.5,0.4,0.45,1,0.67,0.625,0.2,0.8,-0.6,0,0.133333333,0,1,0,0,0.33,1,2,1,-2,2,0,0,-1,1,-2,2,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,46,None,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,4,8,3,9,7,6,2,1,5,3,4,2,1 +505,R_32DPnRQOpw7JI2X,60 - 66,American,,American,Male,Neither agree nor disagree,Agree,Agree,Somewhat agree,Somewhat agree,3,4,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,5,1,3,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,4,2,5,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,5,2,3,1,4,8,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,5,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,1,2,8,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,3,5,2,1,4,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,6,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,5,4,3,2,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,77,FALSE,60,TRUE,64,FALSE,62,TRUE,72,FALSE,60,TRUE,65,TRUE,67,TRUE,60,FALSE,64,TRUE,62,FALSE,65,FALSE,86,FALSE,65,FALSE,69,TRUE,63,FALSE,68,FALSE,58,TRUE,72,TRUE,65,TRUE,68,FALSE,60,FALSE,71,FALSE,61,TRUE,63,TRUE,68,FALSE,64,TRUE,57,TRUE,59,TRUE,81,TRUE,68,FALSE,68,12,0,2,2,1,1,0,0,1,1,0,2,1,1,0,1,0,-1,-1,0,0,0,2,2,1,2,5,1,-1,1,0,1,8,2,1,1,0,1,5,1,0,1,0,1,8,0,2,2,1,2,6,0,0,1,0,0,7,2,2,1,0,2,6,1,0,1,0,0,7,FALSE,1,68,TRUE,1,68,TRUE,0,81,TRUE,0,59,TRUE,1,57,FALSE,1,64,TRUE,1,68,TRUE,1,63,FALSE,0,61,FALSE,0,71,FALSE,1,60,TRUE,0,68,TRUE,1,65,TRUE,0,72,FALSE,0,58,FALSE,0,68,TRUE,0,63,FALSE,1,69,FALSE,1,65,FALSE,1,86,FALSE,0,65,TRUE,1,62,FALSE,1,64,TRUE,1,60,TRUE,0,67,TRUE,1,65,FALSE,1,60,TRUE,0,72,FALSE,1,62,TRUE,1,64,FALSE,0,60,TRUE,1,77,0.1369,0.1225,0.4624,0.1024,0.0529,0.1296,0.16,0.5041,0.0196,0.1444,0.1296,0.1225,0.3721,0.16,0.1849,0.1024,0.1296,0.3481,0.5184,0.4489,0.4225,0.3364,0.1225,0.5184,0.3969,0.16,0.36,0.1024,0.6561,0.0961,0.1444,0.4624,0.2609,0.182842857,0.338957143,12,37.5,19,59.38,4,50,6,75,5,62.5,4,50,10,62.5,9,56.25,66,61.38,64.62,67.75,70.25,64.5,67.5,-21.88,6.62,11.38,-10.38,5.25,20.25,2,11.25,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,1,1,2,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,2,0,0,0.2,0.8,0,1,0.2,0.2,0.4,0.8,0.5,0.4,0.45,6,6.33,6.5,0,0.6,-0.4,0.2,0.066666667,-1,1,-1,1,-0.33,0,0,1,-1,1,1,-1,0,0,-1,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),62,none it was good & informative,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,4,5,6,8,7,9,3,1,2,4,3,2,1 +506,R_3rrxpCpwguuOENK,53 - 59,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,2,1,5,3,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,3,5,4,1,2,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,3,5,1,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,5,3,1,4,2,10,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,4,3,5,1,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,2,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,3,4,1,5,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,5,1,2,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,2,1,3,FALSE,100,FALSE,76,TRUE,100,TRUE,50,TRUE,80,FALSE,54,TRUE,100,TRUE,100,FALSE,58,TRUE,100,TRUE,92,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,51,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,91,TRUE,87,TRUE,100,TRUE,91,TRUE,100,FALSE,100,TRUE,90,TRUE,100,TRUE,93,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,-3,3,-3,3,-3,-3,3,3,0,0,2,3,3,3,3,3,3,3,3,3,-3,0,3,-3,3,-3,0,10,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,-3,0,3,-3,3,-3,-3,0,3,3,3,3,3,0,3,3,3,3,3,0,FALSE,1,100,FALSE,0,76,TRUE,0,100,TRUE,0,50,TRUE,1,80,FALSE,1,54,TRUE,1,100,TRUE,1,100,FALSE,0,58,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,1,87,TRUE,0,100,TRUE,1,91,TRUE,0,100,FALSE,1,100,TRUE,0,90,TRUE,1,100,TRUE,1,93,TRUE,1,100,0,0.0081,0,0,0,0.2116,0.0169,0,0,0,0,0,0.3364,0.8464,0.04,0.5776,0.8281,0.25,0,1,0,0,1,1,0.2401,1,0.0049,0,1,0,0.81,1,0.362928571,0.221928571,0.503928571,27,84.38,20,62.5,2,25,6,75,6,75,6,75,14,87.5,6,37.5,91.03,83.62,83.25,98.88,98.38,92.81,89.25,21.88,28.53,58.62,8.25,23.88,23.38,5.31,51.75,0,0,0,0,0,0,0,0,0,3,0,0,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,1,0,0,0,0,0,0,0.6,1.4,0,0,0,1.4,0,0.5,0.35,0.425,3.33,0,1.25,0,0.6,0,0,0.2,0,10,0,0,3.33,2,1,0,-2,2,-2,2,-2,2,0,0,2,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,58,good survey,1.375,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,01DIR,2,6,8,7,5,4,9,1,3,4,3,2,1 +507,R_5p5z6fZrDuttTgw,53 - 59,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,3,2,5,1,4,Somewhat agree,Disagree,Strongly agree,Disagree,Somewhat agree,2,1,3,5,4,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,3,2,5,4,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,5,2,1,3,Agree,Agree,Agree,Agree,Agree,2,1,5,3,4,8,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,3,5,1,2,4,3,Agree,Agree,Agree,Somewhat Agree,Agree,4,5,3,1,2,7,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Disagree,1,3,2,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,3,4,5,1,2,8,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,4,3,2,5,1,8,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,5,3,2,8,Agree,Somewhat agree,Agree,Agree,Disagree,1,4,3,5,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,75,TRUE,65,TRUE,98,TRUE,90,TRUE,100,TRUE,50,TRUE,95,FALSE,95,TRUE,95,FALSE,97,TRUE,100,TRUE,93,FALSE,98,FALSE,87,FALSE,89,TRUE,85,TRUE,100,TRUE,88,TRUE,90,TRUE,77,TRUE,80,TRUE,100,TRUE,98,TRUE,100,TRUE,99,TRUE,100,FALSE,100,TRUE,98,FALSE,66,TRUE,87,FALSE,50,FALSE,52,25,1,1,2,2,1,1,-2,3,-2,1,2,1,2,1,2,1,-1,1,1,-1,2,2,2,2,2,8,1,-1,0,1,2,3,2,2,2,1,2,7,1,-1,1,-2,-2,7,2,2,2,2,2,8,1,-3,2,-3,2,8,2,2,3,1,3,8,2,1,2,2,-2,8,FALSE,1,52,FALSE,0,50,TRUE,0,87,FALSE,1,66,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,TRUE,1,98,TRUE,0,100,TRUE,0,80,TRUE,1,77,TRUE,0,90,TRUE,1,88,TRUE,1,100,TRUE,0,85,FALSE,1,89,FALSE,1,87,FALSE,1,98,TRUE,1,93,TRUE,1,100,FALSE,1,97,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,0,50,TRUE,0,100,TRUE,0,90,TRUE,1,98,TRUE,1,65,FALSE,0,75,0.0001,0.0025,0,0,0.5625,0,0.0025,0.0004,0.0004,0,0.0004,0.0529,0,1,0.0004,0.25,0.0009,0.1156,1,0.0025,0.0049,0.0144,0.0169,0.81,0.7225,0.25,0.1225,0.2304,0.7569,0.0121,0.81,0.64,0.263539286,0.141857143,0.385221429,25,78.13,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,14,87.5,8,50,87.41,75.75,89.38,89.88,94.62,89.44,85.38,9.38,18.66,13.25,26.88,2.38,32.12,1.94,35.38,1,1,0,0,1,0,1,3,3,1,0,1,0,0,0,0,0,0,3,1,1,1,0,0,1,0,1,1,1,1,0,1,1,0,1,1,2,1,1,1,0.6,1.6,0.2,0.8,0.6,0.8,0.6,1.2,0.8,0.8,0.8,6,8,7.125,0,0.8,-0.4,-0.4,0.133333333,0,-5,-1,-1,-2,1,1,1,-1,1,1,-1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,53,This survey is too long and a lot of repetitive questions. The compensation is low ,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,5,4,3,8,7,2,6,1,9,4,3,2,1 +508,R_1fdOXGrZjaVCOrT,53 - 59,,Canadian,Canadian,Male,Somewhat agree,Agree,Agree,Somewhat disagree,Strongly agree,4,1,2,5,3,Strongly agree,Disagree,Somewhat agree,Neither agree nor disagree,Agree,3,4,5,2,1,Agree,Disagree,Neither Agree nor Disagree,Strongly Agree,Agree,5,3,2,1,4,Somewhat agree,Somewhat agree,Agree,Agree,Agree,4,1,5,3,2,Somewhat agree,Agree,Agree,Disagree,Strongly Agree,2,5,3,1,4,2,Strongly agree,Disagree,Somewhat agree,Agree,Agree,2,3,4,1,5,4,Somewhat Agree,Disagree,Somewhat Agree,Strongly Agree,Agree,5,4,1,2,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,1,3,5,4,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Somewhat disagree,Strongly Agree,4,3,1,2,5,2,Agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,4,2,1,3,5,3,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Agree,Agree,3,2,5,4,1,4,Agree,Agree,Agree,Agree,Agree,4,3,5,1,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,90,TRUE,91,FALSE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,86,FALSE,50,FALSE,100,FALSE,90,TRUE,96,FALSE,95,TRUE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,50,FALSE,57,TRUE,100,FALSE,50,TRUE,85,TRUE,100,TRUE,82,TRUE,62,FALSE,50,TRUE,94,TRUE,92,FALSE,96,21,1,2,2,-1,3,3,-2,1,0,2,2,-2,0,3,2,1,1,2,2,2,1,2,2,-2,3,2,3,-2,1,2,2,4,1,-2,1,3,2,2,1,1,1,-1,2,6,1,2,2,-1,3,2,2,-1,1,-2,1,3,1,-1,-1,2,2,4,2,2,2,2,2,2,FALSE,1,96,TRUE,1,92,TRUE,0,94,FALSE,1,50,TRUE,1,62,TRUE,0,82,TRUE,1,100,TRUE,1,85,FALSE,0,50,TRUE,1,100,FALSE,1,57,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,95,TRUE,0,96,FALSE,1,90,FALSE,1,100,FALSE,0,50,TRUE,1,86,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,0,50,FALSE,1,100,TRUE,0,91,TRUE,1,90,TRUE,1,100,TRUE,1,100,0.0225,0.25,0,0,0,0.6724,0,0,0,0.0196,0.01,0,0.25,0.1849,0.1444,0.0064,0,0.25,0,1,0.25,0.25,0.01,0,0.0025,0.25,0,0.0016,0.8836,0.9216,0.8281,0.25,0.220896429,0.109835714,0.331957143,21,65.63,23,71.88,6,75,5,62.5,6,75,6,75,14,87.5,9,56.25,83.31,67.38,85,91,89.88,82.19,84.44,-6.25,11.43,-7.62,22.5,16,14.88,-5.31,28.19,0,0,0,1,0,0,0,0,2,0,1,0,1,0,0,0,0,1,3,0,0,0,0,0,0,1,1,0,2,1,1,1,1,1,0,1,1,0,0,0,0.2,0.4,0.4,0.8,0,1,0.8,0.4,0.45,0.55,0.5,2.67,3,3.125,0.2,-0.6,-0.4,0.4,-0.266666667,0,1,-2,4,-0.33,1,2,1,-2,2,0,0,-1,1,-2,2,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),58,This was actually a pretty cool survey. Thanks for having me take it!,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,6,2,3,5,4,9,7,1,8,4,2,3,1 +509,R_5pmS9Q29astWndN,39 - 45,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,4,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,1,4,3,2,5,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,5,4,3,2,1,Somewhat agree,Agree,Agree,Strongly Agree,Somewhat agree,4,2,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,4,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,1,4,3,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,2,1,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,3,2,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,5,2,1,2,Agree,Agree,Agree,Agree,Agree,3,4,1,2,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,89,TRUE,100,TRUE,92,FALSE,93,TRUE,53,TRUE,95,TRUE,63,TRUE,52,FALSE,100,TRUE,50,FALSE,60,FALSE,100,TRUE,60,FALSE,60,FALSE,50,TRUE,57,FALSE,50,FALSE,55,TRUE,100,TRUE,100,TRUE,50,TRUE,97,TRUE,52,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,98,TRUE,100,FALSE,92,28,1,3,3,1,3,0,0,2,1,1,1,1,3,1,2,1,2,2,3,1,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,5,1,1,1,1,1,7,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,6,FALSE,1,92,TRUE,1,100,TRUE,0,98,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,97,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,55,FALSE,0,50,TRUE,1,57,FALSE,1,50,FALSE,1,60,TRUE,0,60,FALSE,1,100,FALSE,0,60,TRUE,1,50,FALSE,1,100,TRUE,1,52,TRUE,0,63,TRUE,1,95,TRUE,0,53,FALSE,1,93,TRUE,0,92,TRUE,1,100,TRUE,1,89,TRUE,1,96,0,0.0025,0.1849,0,0.0016,0,0.2304,0.0009,0,0.25,0,0,0.2304,0.25,0,0,0,0.25,0.0049,0.3969,0.36,0.25,0.36,0.2025,0.25,0.2809,0.0121,0.0064,0.9604,0.16,0.8464,1,0.225135714,0.086664286,0.363607143,28,87.5,22,68.75,3,37.5,6,75,7,87.5,6,75,14,87.5,8,50,78.56,63,87.25,76.5,87.5,81.12,76,18.75,9.81,25.5,12.25,-11,12.5,-6.38,26,0,2,2,0,2,1,1,1,0,0,0,0,2,0,1,0,1,1,2,0,0,2,2,0,2,1,1,1,0,0,1,1,1,1,0,0,1,1,2,0,1.2,0.6,0.6,0.8,1.2,0.6,0.8,0.8,0.8,0.85,0.825,3,3.33,3.75,0,0,-0.2,0,-0.066666667,-4,2,1,-1,-0.33,1,1,1,-1,1,0,0,0,0,-1,1,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,44,Ridiculously long and repetitive,0.625,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,4,9,3,2,6,7,5,1,8,2,3,4,1 +510,R_5pASad3k0CB72dF,53 - 59,,Canadian,Canadian,Male,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,2,3,5,4,1,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Agree,5,3,2,1,4,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,4,2,5,1,3,Disagree,Disagree,Disagree,Somewhat disagree,Somewhat disagree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,3,4,2,5,1,6,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,3,5,4,2,1,4,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,4,2,3,1,5,8,Disagree,Disagree,Disagree,Disagree,Strongly disagree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,1,4,2,5,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,3,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,5,2,1,4,3,4,Somewhat disagree,Disagree,Somewhat disagree,Disagree,Somewhat disagree,1,5,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,80,FALSE,90,FALSE,50,FALSE,50,TRUE,50,TRUE,100,FALSE,100,TRUE,95,FALSE,50,TRUE,75,TRUE,100,TRUE,50,TRUE,50,TRUE,75,TRUE,70,TRUE,90,TRUE,50,TRUE,100,TRUE,70,TRUE,75,FALSE,50,TRUE,90,TRUE,75,TRUE,100,TRUE,85,FALSE,100,TRUE,75,FALSE,50,TRUE,60,TRUE,50,TRUE,70,18,0,1,1,1,3,0,-2,1,0,2,1,-2,2,-1,0,-2,-2,-2,-1,-1,1,1,2,1,2,3,0,-1,2,0,2,6,1,-1,2,-1,0,4,-2,-2,-2,-2,-3,8,1,1,1,1,2,3,0,-1,1,0,1,3,1,-1,2,-1,0,3,-1,-2,-1,-2,-1,4,TRUE,0,70,TRUE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,85,TRUE,1,100,TRUE,1,75,TRUE,1,90,FALSE,1,50,TRUE,0,75,TRUE,1,70,TRUE,0,100,TRUE,1,50,TRUE,1,90,TRUE,0,70,TRUE,0,75,TRUE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,75,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,90,TRUE,1,80,TRUE,1,100,0,0,0.01,0.0225,0,0,0.0025,0.01,0.25,0.0625,0.81,0.09,0.0625,0.25,0.0625,0.25,0.25,0.25,0.25,0,0,0.25,0.25,1,0.49,0.25,0.04,0.49,0.36,0.5625,0.25,0.5625,0.25375,0.167857143,0.339642857,18,56.25,22,68.75,6,75,7,87.5,5,62.5,4,50,15,93.75,7,43.75,74.22,56.88,76.88,86.88,76.25,82.81,65.62,-12.5,5.47,-18.12,-10.62,24.38,26.25,-10.94,21.87,1,0,1,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,1,2,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.2,0.6,0.4,0.4,0.2,0.6,0.45,0.4,0.425,4.33,3,4.25,0.2,0,0,0,0.066666667,0,3,1,4,1.33,1,1,1,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,53,,1.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,5,4,8,9,7,6,2,1,3,2,3,4,1 +511,R_3f1Xozb2iQRXGhm,39 - 45,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,1,5,4,2,3,Agree,Neither agree nor disagree,Agree,Agree,Agree,4,1,3,5,2,Agree,Somewhat Disagree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,3,4,5,1,Strongly Agree,Somewhat agree,Agree,Strongly disagree,Strongly Agree,4,3,2,1,5,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Disagree,Strongly agree,4,2,5,3,1,9,Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Agree,3,5,1,4,2,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,3,5,4,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,4,5,2,1,3,4,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,3,2,5,4,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,5,1,3,4,2,4,Agree,Agree,Agree,Agree,Agree,3,5,4,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,58,FALSE,53,TRUE,89,FALSE,51,FALSE,50,TRUE,73,TRUE,54,TRUE,86,FALSE,97,TRUE,94,FALSE,50,FALSE,100,TRUE,88,TRUE,96,TRUE,61,TRUE,95,FALSE,56,FALSE,97,TRUE,86,TRUE,81,FALSE,56,FALSE,93,FALSE,57,TRUE,97,TRUE,100,FALSE,100,TRUE,87,TRUE,72,FALSE,77,FALSE,62,TRUE,91,24,2,3,2,0,3,2,0,2,2,2,2,-1,3,3,3,-1,1,2,1,-1,3,1,2,-3,3,6,0,-1,1,-2,3,9,2,0,3,2,2,8,-3,-3,-3,-3,-3,8,3,3,3,0,3,4,1,0,2,0,3,4,0,0,3,0,2,4,2,2,2,2,2,7,TRUE,0,91,FALSE,0,62,FALSE,1,77,TRUE,0,72,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,1,97,FALSE,0,57,FALSE,0,93,FALSE,1,56,TRUE,0,81,TRUE,1,86,FALSE,1,97,FALSE,0,56,TRUE,1,95,TRUE,0,61,TRUE,0,96,TRUE,0,88,FALSE,1,100,FALSE,0,50,TRUE,1,94,FALSE,1,97,TRUE,1,86,TRUE,0,54,TRUE,1,73,FALSE,1,50,FALSE,1,51,TRUE,0,89,FALSE,0,53,FALSE,0,58,TRUE,1,100,0.0009,0.0729,0.0025,0,0,0,0.0196,0.8649,0,0.0036,0.2809,0.0196,0.3249,0.1936,0.0169,0.3844,0.0009,0.5184,0.2401,0.2916,0.25,0.3136,0.7744,0.0009,0.3721,0.25,0.3364,0.8281,0.0529,0.9216,0.7921,0.6561,0.310985714,0.187692857,0.434278571,24,75,17,53.13,2,25,5,62.5,4,50,6,75,9,56.25,8,50,78.34,62.38,83.75,87.25,80,77.94,78.75,21.87,25.21,37.38,21.25,37.25,5,21.69,28.75,1,2,0,3,0,2,1,1,4,1,0,1,0,1,1,2,4,5,4,2,1,0,1,0,0,1,0,0,2,1,2,1,0,3,1,3,1,0,1,3,1.2,1.8,0.6,3.4,0.4,0.8,1.4,1.6,1.75,1.05,1.4,7.67,4,6.25,0.8,1,-0.8,1.8,0.333333333,2,5,4,1,3.67,0,2,2,-2,2,2,-2,-2,2,-2,2,1,5 cents,5 minutes,24 days,Female,High School (or equivalent),42,,1.125,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,3,5,4,2,6,7,9,1,8,3,4,2,1 +512,R_6mgx9iUVweotOgY,39 - 45,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Somewhat agree,Somewhat agree,2,1,3,4,5,Somewhat disagree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,4,2,1,3,5,Strongly Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,3,1,2,4,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat disagree,Agree,Agree,Somewhat disagree,Somewhat disagree,1,4,3,2,5,4,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly disagree,Disagree,2,1,4,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,5,1,8,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,1,3,5,2,4,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,5,3,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,5,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,1,3,TRUE,96,TRUE,96,FALSE,93,TRUE,74,TRUE,94,TRUE,90,TRUE,100,TRUE,57,TRUE,85,TRUE,75,FALSE,87,TRUE,93,FALSE,83,TRUE,70,TRUE,50,TRUE,98,FALSE,64,TRUE,98,TRUE,50,FALSE,93,TRUE,62,TRUE,93,TRUE,50,TRUE,100,FALSE,88,TRUE,50,FALSE,69,TRUE,63,TRUE,81,TRUE,100,FALSE,56,TRUE,92,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,1,1,-1,-3,1,-3,1,3,2,3,0,3,1,1,2,2,-1,-1,2,2,-1,-1,1,-3,-3,-1,-3,-2,4,3,3,3,3,3,1,-1,-1,-1,-1,-1,8,2,3,3,1,2,1,0,-3,3,-3,3,1,3,3,3,3,3,1,3,3,3,3,3,5,TRUE,0,96,TRUE,1,96,FALSE,1,93,TRUE,0,74,TRUE,1,94,TRUE,0,90,TRUE,1,100,TRUE,1,57,TRUE,1,85,TRUE,1,75,FALSE,1,87,TRUE,0,93,FALSE,0,83,TRUE,0,70,TRUE,1,50,TRUE,1,98,FALSE,1,64,TRUE,0,98,TRUE,0,50,FALSE,1,93,TRUE,1,62,TRUE,1,93,TRUE,0,50,TRUE,1,100,FALSE,1,88,TRUE,1,50,FALSE,1,69,TRUE,0,63,TRUE,0,81,TRUE,1,100,FALSE,0,56,TRUE,1,92,0.1849,0.25,0.0004,0,0.0064,0.81,0,0.0625,0.0049,0.0049,0,0.6889,0.0225,0.0169,0.0036,0.0016,0.25,0.5476,0.3969,0.0144,0.1444,0.25,0.25,0.49,0.1296,0.0961,0.3136,0.9216,0.0049,0.9604,0.6561,0.8649,0.282596429,0.172842857,0.39235,25,78.13,20,62.5,5,62.5,4,50,5,62.5,6,75,14,87.5,6,37.5,79.69,70.88,77,83.75,87.12,80.69,78.69,15.63,17.19,8.38,27,21.25,12.12,-6.81,41.19,3,1,0,2,2,2,0,2,0,3,0,1,0,3,0,2,2,3,3,0,0,0,1,0,1,1,0,2,0,2,0,1,0,3,0,2,2,1,1,4,1.6,1.4,0.8,2,0.4,1,0.8,2,1.45,1.05,1.25,2,1,2.75,1.2,0.4,0,0,0.533333333,0,3,0,3,1,2,2,2,-2,2,2,-2,-1,1,-1,1,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,45,,1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,3,5,9,7,6,4,8,1,2,4,3,2,1 +513,R_5Eff3JIxO7fBkqd,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,5,2,1,3,4,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,4,5,3,1,Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,2,4,3,5,1,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,3,5,1,2,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,1,5,3,4,2,2,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,4,3,5,1,2,7,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,1,2,5,4,3,5,Strongly disagree,Somewhat agree,Strongly disagree,Disagree,Somewhat disagree,1,4,3,2,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Agree,5,2,3,1,4,1,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,2,4,5,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,4,3,5,2,3,Agree,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,2,4,5,1,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,FALSE,66,TRUE,51,TRUE,83,FALSE,95,FALSE,50,TRUE,50,FALSE,97,TRUE,78,FALSE,100,TRUE,74,FALSE,76,FALSE,62,FALSE,80,TRUE,76,TRUE,50,TRUE,85,FALSE,53,FALSE,50,TRUE,78,TRUE,83,FALSE,50,TRUE,59,FALSE,50,TRUE,77,TRUE,50,FALSE,50,TRUE,69,FALSE,50,TRUE,69,FALSE,50,TRUE,74,21,3,3,-1,3,1,-3,1,1,-1,0,2,3,3,-2,3,2,2,2,2,0,3,3,1,3,0,2,1,3,-1,3,0,7,-1,-1,2,1,0,5,-3,1,-3,-2,-1,7,3,3,-2,3,2,1,-3,-1,2,-1,0,5,3,3,3,-1,3,3,2,3,2,3,0,4,TRUE,0,74,FALSE,0,50,TRUE,0,69,FALSE,1,50,TRUE,1,69,FALSE,1,50,TRUE,1,50,TRUE,1,77,FALSE,0,50,TRUE,1,59,FALSE,1,50,TRUE,0,83,TRUE,1,78,FALSE,1,50,FALSE,0,53,TRUE,1,85,TRUE,0,50,TRUE,0,76,FALSE,1,80,FALSE,1,62,FALSE,0,76,TRUE,1,74,FALSE,1,100,TRUE,1,78,FALSE,1,97,TRUE,1,50,FALSE,1,50,FALSE,1,95,TRUE,0,83,TRUE,1,51,FALSE,0,66,TRUE,1,92,0.0529,0.25,0.0225,0.25,0.0064,0.25,0.0484,0.1681,0.1444,0.0676,0.2401,0.0484,0.25,0.25,0.0961,0.25,0,0.25,0.0025,0.0009,0.5776,0.2809,0.04,0.25,0.25,0.25,0.4356,0.5476,0.4761,0.5776,0.6889,0.6889,0.254860714,0.147821429,0.3619,21,65.63,21,65.63,4,50,5,62.5,6,75,6,75,11,68.75,10,62.5,68.03,56.12,74.75,66.25,75,66.12,69.94,0,2.4,6.12,12.25,-8.75,0,-2.63,7.44,0,0,2,0,1,4,2,2,4,0,3,4,1,3,3,5,1,5,4,1,0,0,1,0,1,0,2,1,0,0,1,0,0,1,0,0,1,0,1,0,0.6,2.4,2.8,3.2,0.4,0.6,0.4,0.4,2.25,0.45,1.35,4.67,3,4.25,0.2,1.8,2.4,2.8,1.466666667,1,2,2,3,1.67,1,1,1,-2,2,1,-1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,32,This survey made me question a lot about myself and brought up some uncomfortable reflections ,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,9,7,5,2,3,6,8,1,4,2,4,3,1 +514,R_6M0eRrQkHoeb5OD,39 - 45,,Canadian,Canadian,Male,Strongly agree,Agree,Agree,Disagree,Strongly agree,5,3,1,2,4,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly agree,3,2,1,5,4,Somewhat Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,2,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,2,1,5,Strongly Agree,Neither agree nor disagree,Disagree,Disagree,Strongly Agree,5,3,1,2,4,5,Disagree,Strongly disagree,Somewhat disagree,Disagree,Strongly agree,3,5,1,2,4,4,Somewhat Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,2,4,1,3,5,4,Strongly disagree,Disagree,Somewhat disagree,Strongly disagree,Somewhat disagree,1,3,4,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,1,2,5,4,3,3,Somewhat disagree,Disagree,Somewhat agree,Disagree,Strongly agree,1,3,4,5,2,3,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,5,2,3,4,1,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,4,3,2,5,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,74,TRUE,83,TRUE,74,FALSE,50,FALSE,50,TRUE,57,TRUE,72,TRUE,58,TRUE,65,TRUE,70,TRUE,59,TRUE,76,FALSE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,61,TRUE,91,TRUE,100,TRUE,55,TRUE,73,FALSE,62,TRUE,54,TRUE,80,FALSE,56,TRUE,73,FALSE,52,FALSE,100,TRUE,59,FALSE,72,FALSE,68,FALSE,62,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,-2,3,-2,-1,-1,-1,3,1,-3,3,-3,3,-3,-3,-3,-3,-3,3,0,-2,-2,3,5,-2,-3,-1,-2,3,4,1,-3,3,-2,3,4,-3,-2,-1,-3,-1,3,3,2,0,1,3,3,-1,-2,1,-2,3,3,0,-3,3,-3,3,1,-1,1,2,1,-3,4,TRUE,0,74,TRUE,1,83,TRUE,0,74,FALSE,1,50,FALSE,0,50,TRUE,0,57,TRUE,1,72,TRUE,1,58,TRUE,1,65,TRUE,1,70,TRUE,0,59,TRUE,0,76,FALSE,0,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,61,TRUE,0,91,TRUE,0,100,TRUE,0,55,TRUE,1,73,FALSE,0,62,TRUE,0,54,TRUE,1,80,FALSE,1,56,TRUE,1,73,FALSE,1,52,FALSE,1,100,TRUE,0,59,FALSE,0,72,FALSE,0,68,FALSE,0,62,0.1764,0.0729,0,0.0784,0.3844,0.3249,0.04,0.09,0.3025,0.3844,0.5184,1,0.1225,0.3481,0.25,0.0289,0.2916,0.25,0,0.1936,0.0729,0.25,1,0,0.1521,0.2304,0.4624,0.5476,0.5476,0.8281,0.3481,0.5776,0.340932143,0.309692857,0.372171429,16,50,16,50,5,62.5,2,25,5,62.5,4,50,10,62.5,6,37.5,70.5,65.88,64.5,74.75,76.88,71.12,69.88,0,20.5,3.38,39.5,12.25,26.88,8.62,32.38,0,2,4,0,0,0,2,0,1,0,0,0,0,1,0,0,1,2,0,2,0,0,2,3,0,1,1,2,1,0,1,0,0,0,0,2,4,5,4,0,1.2,0.6,0.2,1,1,1,0.2,3,0.75,1.3,1.025,4.33,2.33,3.375,0.2,-0.4,0,-2,-0.066666667,2,1,3,-1,2,0,2,1,-2,2,0,0,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,43,It was interesting and I wonder what it is for?,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,8,4,9,6,7,2,3,1,5,4,2,3,1 +515,R_34vzQKoASOHHcL9,32 - 38,,Canadian,Canadian,Female,Somewhat agree,Agree,Strongly agree,Strongly agree,Agree,1,2,5,4,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,Strongly agree,5,1,4,3,2,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Somewhat Agree,5,2,4,3,1,Strongly Agree,Disagree,Somewhat disagree,Agree,Strongly Agree,2,5,3,1,4,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,5,1,2,Strongly disagree,Strongly agree,Disagree,Strongly agree,Somewhat disagree,4,5,3,1,2,10,Strongly Agree,Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,5,1,3,2,5,Disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,1,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,1,2,5,4,4,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,1,2,7,Strongly Disagree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Somewhat Agree,3,4,2,5,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,5,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,70,TRUE,51,FALSE,92,TRUE,51,TRUE,90,FALSE,100,TRUE,78,TRUE,90,FALSE,50,TRUE,81,FALSE,52,TRUE,92,TRUE,50,FALSE,100,FALSE,75,TRUE,95,FALSE,58,TRUE,76,FALSE,66,FALSE,100,TRUE,100,TRUE,94,FALSE,67,TRUE,100,TRUE,50,TRUE,93,FALSE,55,FALSE,82,TRUE,85,TRUE,70,FALSE,81,TRUE,96,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,3,3,2,0,1,1,-2,3,-1,-2,3,-2,1,3,-2,-1,2,3,-2,3,3,3,3,2,-3,3,-2,3,-1,10,3,-2,3,1,3,5,-2,0,-3,-3,-3,7,-2,3,3,3,1,4,3,1,3,-3,3,7,-3,-1,1,-3,1,5,3,3,3,3,3,7,FALSE,1,70,TRUE,1,51,FALSE,1,92,TRUE,0,51,TRUE,1,90,FALSE,1,100,TRUE,1,78,TRUE,1,90,FALSE,0,50,TRUE,1,81,FALSE,1,52,TRUE,0,92,TRUE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,95,FALSE,1,58,TRUE,0,76,FALSE,1,66,FALSE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,67,TRUE,1,100,TRUE,0,50,TRUE,1,93,FALSE,1,55,FALSE,1,82,TRUE,0,85,TRUE,1,70,FALSE,0,81,TRUE,1,96,0.01,0.0049,0.0025,0.0484,0.0016,0,0,0.0361,0,0.0036,0.09,0.25,0.25,0.2304,0.01,0.2401,0.1089,0.2601,0.0324,0.25,0,0.5625,0.1156,0,0.1764,0.2025,0.6561,0.09,0.0064,0.5776,0.7225,0.8464,0.204257143,0.105771429,0.302742857,20,62.5,24,75,4,50,7,87.5,6,75,7,87.5,13,81.25,11,68.75,77.81,60.12,80.75,80.25,90.12,80.88,74.75,-12.5,2.81,10.12,-6.75,5.25,2.62,-0.37,6,3,1,0,0,1,3,2,3,5,4,4,0,0,3,2,5,2,2,5,6,3,1,0,0,1,3,0,2,1,0,2,1,2,1,0,0,5,4,1,0,1,3.4,1.8,4,1,1.2,1.2,2,2.55,1.35,1.95,5.67,5.33,5.875,0,2.2,0.6,2,0.933333333,-2,3,0,0,0.34,0,1,2,-2,2,2,-2,-1,1,-1,1,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,34,Fun survey.,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,2,7,9,4,6,5,8,1,3,2,4,3,1 +516,R_7lbgMntFFRBybCp,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,3,2,4,5,1,Disagree,Strongly agree,Agree,Neither agree nor disagree,Agree,3,2,5,4,1,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,1,4,2,5,Somewhat agree,Somewhat agree,Agree,Agree,Strongly disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,2,Strongly disagree,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,3,2,4,1,5,3,Strongly Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Agree,1,4,3,2,5,7,Somewhat agree,Agree,Agree,Somewhat agree,Strongly disagree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,3,4,2,1,5,2,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,1,4,2,5,8,Agree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,1,2,3,5,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,3,1,5,2,4,TRUE,100,TRUE,100,TRUE,85,TRUE,50,TRUE,92,FALSE,100,TRUE,85,TRUE,95,TRUE,96,TRUE,100,FALSE,80,TRUE,90,TRUE,98,TRUE,100,TRUE,50,TRUE,80,FALSE,50,TRUE,70,FALSE,50,FALSE,100,FALSE,100,TRUE,97,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,90,FALSE,89,TRUE,100,TRUE,91,TRUE,99,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,1,3,-2,3,2,0,2,1,0,3,-3,3,1,1,2,2,-3,3,3,2,0,1,2,-3,2,0,3,1,2,-3,0,3,-3,2,3,1,2,2,1,-3,7,2,3,1,2,3,0,-2,1,1,0,3,2,2,0,3,-2,3,8,1,1,1,0,-3,5,TRUE,0,100,TRUE,1,100,TRUE,0,85,TRUE,0,50,TRUE,1,92,FALSE,1,100,TRUE,1,85,TRUE,1,95,TRUE,1,96,TRUE,1,100,FALSE,1,80,TRUE,0,90,TRUE,1,98,TRUE,0,100,TRUE,1,50,TRUE,1,80,FALSE,1,50,TRUE,0,70,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,90,FALSE,1,89,TRUE,0,100,TRUE,1,91,TRUE,1,99,TRUE,1,100,0.0025,0,0.04,0.0225,0,0,0,0,0,0.0009,0.0081,0.0004,0.0016,0.04,0.0064,0,0,0.25,0.0121,0,1,0.25,0.25,1,0.25,0.81,0.0001,1,0.7225,0.49,1,0.81,0.282217857,0.021957143,0.542478571,28,87.5,23,71.88,6,75,6,75,5,62.5,6,75,15,93.75,8,50,88.66,76.88,92.5,94,91.25,92.69,84.62,15.62,16.78,1.88,17.5,31.5,16.25,-1.06,34.62,1,0,1,1,2,1,1,2,3,1,4,0,0,0,1,0,1,0,1,0,0,0,0,1,0,0,2,1,0,1,1,0,0,1,0,0,0,1,2,0,1,1.6,1,0.4,0.2,0.8,0.4,0.6,1,0.5,0.75,2.33,3.33,3.625,0.8,0.8,0.6,-0.2,0.733333333,2,0,-5,2,-1,2,2,0,-2,2,-1,1,1,-1,-2,2,1,5 cents,5 minutes,47 days,Male,High School (or equivalent),51,,1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,9,8,5,4,2,6,3,1,7,3,4,2,1 +517,R_31Mug8JPXfCCLlL,32 - 38,,Canadian,Canadian,Female,Agree,Agree,Agree,Somewhat agree,Strongly agree,5,1,4,3,2,Somewhat agree,Agree,Agree,Somewhat agree,Agree,2,4,1,3,5,Strongly Agree,Somewhat Agree,Agree,Agree,Agree,3,1,4,2,5,Agree,Strongly Agree,Somewhat agree,Agree,Agree,5,4,2,3,1,Somewhat agree,Agree,Somewhat agree,Agree,Agree,3,5,1,2,4,8,Agree,Agree,Somewhat agree,Strongly agree,Agree,5,4,1,3,2,9,Somewhat Agree,Agree,Agree,Strongly Agree,Agree,1,2,5,3,4,8,Agree,Agree,Somewhat agree,Strongly Agree,Agree,4,2,1,3,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,4,1,2,3,5,8,Somewhat agree,Strongly agree,Agree,Somewhat agree,Agree,1,5,3,2,4,8,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,5,1,2,4,6,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,3,4,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,66,TRUE,94,FALSE,60,TRUE,88,TRUE,94,TRUE,63,TRUE,78,FALSE,100,TRUE,100,FALSE,53,FALSE,54,TRUE,86,TRUE,91,TRUE,86,TRUE,99,TRUE,95,TRUE,97,TRUE,63,FALSE,54,TRUE,81,TRUE,100,TRUE,69,TRUE,90,FALSE,54,TRUE,100,TRUE,100,FALSE,59,FALSE,53,FALSE,55,TRUE,92,FALSE,53,FALSE,51,25,2,2,2,1,3,1,2,2,1,2,3,1,2,2,2,2,3,1,2,2,1,2,1,2,2,8,2,2,1,3,2,9,1,2,2,3,2,8,2,2,1,3,2,9,1,2,1,2,1,8,1,3,2,1,2,8,2,1,1,1,2,6,2,3,2,2,3,7,FALSE,1,51,FALSE,0,53,TRUE,0,92,FALSE,1,55,FALSE,0,53,FALSE,1,59,TRUE,1,100,TRUE,1,100,FALSE,0,54,TRUE,1,90,TRUE,0,69,TRUE,0,100,TRUE,1,81,FALSE,1,54,TRUE,1,63,TRUE,1,97,TRUE,0,95,TRUE,0,99,TRUE,0,86,TRUE,0,91,TRUE,1,86,FALSE,0,54,FALSE,1,53,TRUE,1,100,FALSE,1,100,TRUE,1,78,TRUE,0,63,TRUE,0,94,TRUE,0,88,FALSE,0,60,TRUE,1,94,TRUE,1,66,0,0.0484,0.0009,0,0.1156,0.1681,0,0.01,0.8281,0.2916,0.36,0.0361,0.2916,0.4761,0.2809,0.2809,0.2209,0.2025,0.8836,0,0.0196,0.1369,0.7396,0.2116,0.9025,0.3969,0.0036,0.2401,0.8464,0.9801,0.7744,1,0.382060714,0.254457143,0.509664286,25,78.13,17,53.13,3,37.5,5,62.5,6,75,3,37.5,11,68.75,6,37.5,77.44,67.12,72.62,78.25,91.75,76.81,78.06,25,24.31,29.62,10.12,3.25,54.25,8.06,40.56,1,0,1,1,1,1,0,1,2,0,2,1,0,1,0,0,1,0,1,0,1,0,1,1,2,0,1,0,0,0,1,0,1,1,0,0,0,1,0,1,0.8,0.8,0.8,0.4,1,0.2,0.6,0.4,0.7,0.55,0.625,8.33,7.33,7.875,-0.2,0.6,0.2,0,0.2,0,1,2,2,1,2,2,1,1,-1,2,-2,2,-2,1,-1,1,10 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),38,,0,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,4,2,9,3,7,8,5,1,6,2,3,4,1 +518,R_5nBn9uQByRCQc9N,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Agree,1,2,3,4,5,Disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,1,5,3,4,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,2,5,3,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,2,1,3,5,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,5,4,1,3,2,3,Strongly disagree,Disagree,Agree,Disagree,Agree,2,3,5,4,1,2,Agree,Somewhat Disagree,Strongly Agree,Agree,Strongly Agree,2,5,1,3,4,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,1,5,2,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Agree,4,2,3,5,1,4,Strongly disagree,Somewhat disagree,Agree,Disagree,Somewhat disagree,5,1,4,3,2,1,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,4,1,2,1,Agree,Agree,Agree,Agree,Somewhat agree,5,1,2,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,99,TRUE,65,FALSE,97,FALSE,80,TRUE,80,FALSE,95,TRUE,100,TRUE,90,TRUE,60,FALSE,90,FALSE,60,TRUE,60,TRUE,60,FALSE,98,FALSE,85,TRUE,98,FALSE,60,FALSE,75,FALSE,60,FALSE,58,TRUE,98,TRUE,85,FALSE,100,TRUE,85,TRUE,60,TRUE,75,FALSE,96,FALSE,85,TRUE,90,TRUE,76,TRUE,70,TRUE,90,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-1,-1,2,-2,-1,2,-1,1,2,-1,3,1,3,1,1,2,1,0,3,3,2,-1,3,3,-3,-2,2,-2,2,2,2,-1,3,2,3,1,-1,-1,-1,-2,1,7,3,3,1,2,2,4,-3,-1,2,-2,-1,1,2,-1,3,1,3,1,2,2,2,2,1,3,FALSE,1,99,TRUE,1,65,FALSE,1,97,FALSE,1,80,TRUE,1,80,FALSE,1,95,TRUE,1,100,TRUE,1,90,TRUE,1,60,FALSE,0,90,FALSE,1,60,TRUE,0,60,TRUE,1,60,FALSE,1,98,FALSE,0,85,TRUE,1,98,FALSE,1,60,FALSE,1,75,FALSE,1,60,FALSE,1,58,TRUE,1,98,TRUE,1,85,FALSE,1,100,TRUE,1,85,TRUE,0,60,TRUE,1,75,FALSE,1,96,FALSE,1,85,TRUE,0,90,TRUE,1,76,TRUE,1,70,TRUE,1,90,0.01,0.0625,0.0004,0,0.01,0.0025,0.0225,0.81,0.1764,0.0225,0.0576,0.16,0.16,0.16,0.04,0.1225,0,0.04,0.0225,0.36,0.0004,0.7225,0.16,0.0004,0.16,0.0016,0.09,0.0001,0.0009,0.0625,0.81,0.36,0.161960714,0.127428571,0.196492857,21,65.63,27,84.38,7,87.5,7,87.5,6,75,7,87.5,14,87.5,13,81.25,80.62,72,84.12,85.25,81.12,81.69,79.56,-18.75,-3.76,-15.5,-3.38,10.25,-6.38,-5.81,-1.69,0,0,3,0,1,1,1,0,1,1,0,0,0,1,0,2,2,3,3,1,0,0,2,3,0,1,0,0,1,2,0,0,0,0,0,1,1,0,1,1,0.8,0.8,0.2,2.2,1,0.8,0,0.8,1,0.65,0.825,2,2,2.75,-0.2,0,0.2,1.4,0,-1,1,0,4,0,1,2,1,-2,2,-2,2,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,47,Interesting survey! I would like to know how I scored on the questions.,1.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,2,5,3,9,7,6,4,1,8,2,3,4,1 +519,R_7D6WMp7DnNOxRaD,46 - 52,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,5,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,2,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,2,1,4,3,Strongly Agree,Somewhat agree,Agree,Strongly Agree,Agree,1,5,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,2,5,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,4,3,5,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,1,5,2,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,1,4,3,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,1,5,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,4,1,2,5,5,Strongly Agree,Agree,Strongly Agree,Agree,Agree,2,4,1,3,5,TRUE,73,FALSE,80,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,95,FALSE,100,TRUE,96,FALSE,82,TRUE,98,TRUE,89,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,95,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,94,TRUE,96,FALSE,100,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,3,3,3,-3,3,-3,3,3,3,3,-3,3,3,1,2,3,2,3,3,3,3,3,5,3,-3,3,-3,3,5,3,3,3,-3,3,5,3,2,3,3,3,5,2,3,3,3,3,5,3,-3,3,-3,3,5,3,3,3,-3,3,5,3,2,3,2,2,5,TRUE,0,73,FALSE,0,80,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,100,TRUE,0,96,FALSE,0,82,TRUE,1,98,TRUE,0,89,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,95,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,94,TRUE,1,96,FALSE,0,100,0,0,0.0004,0,1,0,0.0025,1,1,0,0.0036,1,1,0,0,0.64,1,1,1,1,0,0.6724,1,0.9216,0.7921,1,0.0016,0.5329,1,1,1,0.0025,0.627471429,0.54615,0.708792857,10,31.25,13,40.63,2,25,3,37.5,3,37.5,5,62.5,10,62.5,3,18.75,96.81,94.75,98.62,96.12,97.75,96.56,97.06,-9.38,56.18,69.75,61.12,58.62,35.25,34.06,78.31,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0.2,0,0,0.6,0,0,0,0.6,0.2,0.15,0.175,5,5,5,0.2,0,0,0,0.066666667,0,0,0,0,0,2,2,2,-2,2,2,-2,2,-2,1,-1,1,10 cents,100 minutes,47 days,Female,High School (or equivalent),51,yw thanks so much it helps alot,0.5,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,6,3,7,9,2,5,8,1,4,2,4,3,1 +520,R_1oMu1lsMXM4KW0p,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Somewhat disagree,1,3,2,5,4,Somewhat agree,Agree,Agree,Strongly agree,Agree,4,3,2,5,1,Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,4,5,1,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,5,4,2,Agree,Agree,Agree,Disagree,Somewhat disagree,4,3,2,1,5,2,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,5,3,1,2,4,4,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,1,4,3,2,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,1,5,4,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat agree,5,2,1,3,4,4,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,1,4,5,2,4,Strongly Agree,Somewhat Disagree,Agree,Agree,Agree,1,5,3,2,4,3,Agree,Agree,Agree,Strongly Agree,Agree,2,3,4,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,54,TRUE,71,FALSE,88,FALSE,65,TRUE,84,FALSE,76,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,67,TRUE,87,TRUE,79,TRUE,82,TRUE,70,TRUE,91,TRUE,70,TRUE,70,TRUE,92,FALSE,68,TRUE,74,TRUE,99,FALSE,100,TRUE,86,FALSE,100,TRUE,96,TRUE,86,FALSE,79,FALSE,100,TRUE,98,FALSE,67,TRUE,71,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,-1,-1,1,2,2,3,2,2,-1,2,1,2,1,1,1,1,-1,2,2,2,-2,-1,2,1,3,1,3,-1,4,1,1,-1,0,-1,5,1,1,1,0,1,2,3,3,3,-1,1,4,2,1,1,1,2,4,3,-1,2,2,2,3,2,2,2,3,2,6,FALSE,1,54,TRUE,1,71,FALSE,1,88,FALSE,1,65,TRUE,1,84,FALSE,1,76,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,67,TRUE,0,87,TRUE,1,79,TRUE,0,82,TRUE,1,70,TRUE,1,91,TRUE,0,70,TRUE,0,70,TRUE,0,92,FALSE,1,68,TRUE,1,74,TRUE,1,99,FALSE,1,100,TRUE,1,86,FALSE,1,100,TRUE,1,96,TRUE,0,86,FALSE,1,79,FALSE,1,100,TRUE,1,98,FALSE,0,67,TRUE,1,71,0,0.0016,0.0081,0,0.0841,0.0576,0.0196,0,0.1024,0.0001,0.0004,0.0441,0,0.1089,0.0256,0.0841,0,0.1225,0.0441,0,0.0676,0.09,0.8464,0.6724,0.49,0.7396,0.4489,0.2116,0.0144,0.49,0,0.7569,0.197189286,0.046385714,0.347992857,17,53.13,25,78.13,5,62.5,7,87.5,6,75,7,87.5,15,93.75,10,62.5,83.44,77.25,81.75,87.62,87.12,86.62,80.25,-25,5.31,14.75,-5.75,12.62,-0.38,-7.13,17.75,1,1,0,1,0,0,1,1,0,3,1,2,3,1,3,0,0,0,1,2,0,0,1,0,2,1,1,1,2,0,1,0,0,1,0,1,1,1,2,3,0.6,1,2,0.6,0.6,1,0.4,1.6,1.05,0.9,0.975,3.67,3.67,3.75,0,0,1.6,-1,0.533333333,-2,0,2,-4,0,1,1,1,-2,2,0,0,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,34,,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,2,8,6,9,7,4,5,1,3,3,2,4,1 +521,R_5OuF4lYJjPeZ2yf,46 - 52,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,5,3,4,1,2,Strongly disagree,Strongly disagree,Agree,Disagree,Strongly disagree,1,2,5,4,3,Agree,Agree,Agree,Agree,Agree,4,1,3,2,5,Agree,Agree,Agree,Agree,Agree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,6,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,4,1,3,5,6,Disagree,Strongly Disagree,Disagree,Disagree,Disagree,4,1,2,3,5,5,Agree,Agree,Agree,Agree,Agree,5,4,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,2,5,10,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,4,3,1,2,7,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Disagree,Agree,4,2,3,1,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,5,2,3,TRUE,78,TRUE,71,TRUE,82,TRUE,84,FALSE,80,TRUE,90,TRUE,78,TRUE,85,FALSE,82,TRUE,85,TRUE,76,TRUE,100,TRUE,100,TRUE,100,FALSE,74,TRUE,73,FALSE,98,TRUE,74,FALSE,86,FALSE,84,TRUE,100,FALSE,65,TRUE,100,TRUE,83,TRUE,100,TRUE,100,FALSE,78,TRUE,79,FALSE,86,TRUE,88,FALSE,78,TRUE,100,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,1,-3,-3,2,-2,-3,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,5,1,1,2,1,1,6,-2,-3,-2,-2,-2,6,2,2,2,2,2,5,1,1,1,1,1,5,-1,-1,-1,-1,-1,10,-1,-1,-1,-2,2,7,1,1,1,1,1,6,TRUE,0,78,TRUE,1,71,TRUE,0,82,TRUE,0,84,FALSE,0,80,TRUE,0,90,TRUE,1,78,TRUE,1,85,FALSE,0,82,TRUE,1,85,TRUE,0,76,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,74,TRUE,1,73,FALSE,1,98,TRUE,0,74,FALSE,1,86,FALSE,1,84,TRUE,1,100,FALSE,0,65,TRUE,0,100,TRUE,1,83,TRUE,0,100,TRUE,1,100,FALSE,1,78,TRUE,0,79,FALSE,1,86,TRUE,1,88,FALSE,0,78,TRUE,1,100,0.0225,0,0.0729,0.0484,0,0.81,0.0289,0.0225,0.0256,0.4225,0.0144,0,0.6724,0.5776,0.64,0.0841,1,0.7056,0.6241,1,0,0.5476,0.0196,1,0.0004,0.0484,0.6084,0.6084,0.6724,0.5476,0.0196,1,0.417860714,0.3574,0.478321429,19,59.38,16,50,3,37.5,5,62.5,3,37.5,5,62.5,11,68.75,5,31.25,85.53,78.62,94.25,85,84.25,83.88,87.19,9.38,35.53,41.12,31.75,47.5,21.75,15.13,55.94,1,2,2,0,0,4,4,0,3,4,4,5,4,4,4,0,0,0,0,0,1,2,2,0,0,2,2,3,1,2,3,3,3,4,0,1,1,1,1,1,1,3,4.2,0,1,2,2.6,1,2.05,1.65,1.85,5.67,7.33,6.25,0,1,1.6,-1,0.866666667,0,-4,-1,-1,-1.66,0,1,1,2,-2,2,-2,2,-2,0,0,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,47,,-0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,3,9,2,7,8,6,5,1,4,3,4,2,1 +522,R_3cx1Ajq8O3TIchj,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,5,2,4,3,1,Strongly agree,Disagree,Strongly agree,Strongly disagree,Somewhat disagree,1,5,3,4,2,Strongly Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,3,4,1,5,2,Somewhat agree,Strongly disagree,Disagree,Somewhat disagree,Strongly disagree,3,5,2,1,4,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,5,2,1,4,3,1,Strongly agree,Strongly disagree,Strongly agree,Disagree,Neither agree nor disagree,1,3,5,2,4,7,Strongly Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,5,1,2,3,4,4,Agree,Strongly disagree,Somewhat disagree,Somewhat agree,Strongly disagree,2,4,3,5,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,1,2,6,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,2,3,7,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,1,4,2,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,3,2,5,1,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,57,FALSE,57,FALSE,100,FALSE,54,FALSE,59,FALSE,100,TRUE,100,TRUE,97,TRUE,80,TRUE,99,FALSE,70,TRUE,100,TRUE,100,TRUE,91,TRUE,85,TRUE,100,TRUE,100,TRUE,76,TRUE,100,FALSE,100,TRUE,88,TRUE,80,FALSE,69,FALSE,60,TRUE,100,TRUE,100,FALSE,63,FALSE,100,TRUE,58,TRUE,100,FALSE,55,TRUE,100,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,3,3,3,-2,3,-3,-1,3,-2,3,-2,3,1,-3,-2,-1,-3,3,3,1,3,2,1,3,-3,3,-2,0,7,3,1,1,1,3,4,2,-3,-1,1,-3,10,3,3,3,3,3,6,3,-1,3,-3,3,7,3,0,3,-3,3,4,3,3,3,3,-3,10,TRUE,0,57,FALSE,0,57,FALSE,1,100,FALSE,1,54,FALSE,0,59,FALSE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,80,TRUE,1,99,FALSE,1,70,TRUE,0,100,TRUE,1,100,TRUE,0,91,TRUE,1,85,TRUE,1,100,TRUE,0,100,TRUE,0,76,TRUE,0,100,FALSE,1,100,TRUE,1,88,TRUE,1,80,FALSE,1,69,FALSE,0,60,TRUE,0,100,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,0,55,TRUE,1,100,0.0009,0,0,0,0,0,0.36,0.0001,0,0.04,0,0,0.04,0.09,0.3481,0.3249,0.0961,0.2116,0,1,0.0144,0.0225,1,0.8281,1,0.1369,0.3025,0.3249,0,0.5776,0.3364,1,0.287646429,0.107914286,0.467378571,3,9.38,20,62.5,5,62.5,5,62.5,4,50,6,75,12,75,8,50,84.31,70.5,84.25,87.88,94.62,85,83.62,-53.12,21.81,8,21.75,37.88,19.62,10,33.62,0,0,0,0,1,0,1,0,1,1,0,3,2,3,0,1,0,1,2,0,0,0,2,0,0,0,1,0,0,4,0,2,0,1,0,2,6,5,4,0,0.2,0.6,1.6,0.8,0.4,1,0.6,3.4,0.8,1.35,1.075,4,5.67,6.125,-0.2,-0.4,1,-2.6,0.133333333,-5,0,0,0,-1.67,1,2,0,-1,1,-1,1,-1,1,0,0,2,20 cents,25 minutes,24 days,Female,High School (or equivalent),40,This survey was long and hard and it should have been worth some monetary value.,1,0,0,0,0,0,1,0,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,6,3,2,7,4,5,9,1,8,4,2,3,1 +523,R_1pzBtlBUOMIdBlS,53 - 59,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,4,2,1,5,3,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,3,5,1,4,2,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,2,3,5,Somewhat agree,Agree,Somewhat agree,Strongly Agree,Somewhat disagree,4,2,1,5,3,Somewhat agree,Agree,Strongly Agree,Somewhat disagree,Strongly Agree,1,2,4,5,3,7,Strongly agree,Somewhat disagree,Strongly agree,Disagree,Agree,4,2,3,5,1,9,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,3,1,5,2,4,10,Agree,Somewhat agree,Somewhat agree,Agree,Agree,2,3,4,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat agree,Agree,Agree,1,4,3,2,5,9,Agree,Agree,Neither agree nor disagree,Agree,Agree,5,4,1,2,3,8,Somewhat Agree,Agree,Agree,Strongly Agree,Somewhat Agree,4,5,1,3,2,9,Agree,Strongly Agree,Agree,Strongly Agree,Agree,2,3,4,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,80,TRUE,98,TRUE,67,FALSE,57,FALSE,100,TRUE,97,FALSE,100,TRUE,96,FALSE,61,TRUE,80,TRUE,97,FALSE,71,FALSE,90,TRUE,100,TRUE,97,TRUE,88,TRUE,85,FALSE,99,TRUE,100,TRUE,100,FALSE,88,TRUE,100,TRUE,93,TRUE,91,TRUE,100,FALSE,72,TRUE,91,TRUE,70,FALSE,100,TRUE,89,FALSE,73,16,3,3,3,0,2,2,3,3,1,2,2,2,3,1,3,1,2,1,3,-1,1,2,3,-1,3,7,3,-1,3,-2,2,9,2,1,1,3,0,10,2,1,1,2,2,8,2,1,1,2,2,9,2,2,0,2,2,8,1,2,2,3,1,9,2,3,2,3,2,8,FALSE,1,73,TRUE,1,89,FALSE,1,100,TRUE,0,70,TRUE,1,91,FALSE,1,72,TRUE,1,100,TRUE,1,91,TRUE,1,93,TRUE,1,100,FALSE,1,88,TRUE,0,100,TRUE,1,100,FALSE,1,99,TRUE,1,85,TRUE,1,88,TRUE,0,97,TRUE,0,100,FALSE,1,90,FALSE,1,71,TRUE,1,97,TRUE,1,80,FALSE,1,61,TRUE,1,96,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,57,TRUE,0,67,TRUE,1,98,TRUE,1,80,TRUE,1,100,0.0081,0.0009,0.0144,0,0,0.0784,0.0016,0,0.0841,0.04,0.0004,0,0.0049,0.0144,0.0081,0.0121,0.1521,0.49,0.1849,0,0.0009,0.0225,0.01,0.0001,0.9409,0,0.04,0.0729,0,1,0.4489,1,0.164542857,0.063292857,0.265792857,16,50,27,84.38,7,87.5,6,75,7,87.5,7,87.5,16,100,11,68.75,88.44,86.88,85.62,93.62,87.62,92.81,84.06,-34.38,4.06,-0.62,10.62,6.12,0.12,-7.19,15.31,2,1,0,1,1,1,4,0,3,0,0,1,2,2,3,1,1,0,1,3,1,2,2,2,0,0,1,3,1,0,1,0,1,2,2,1,1,1,0,3,1,1.6,1.6,1.2,1.4,1,1.2,1.2,1.35,1.2,1.275,8.67,8.67,8.5,-0.4,0.6,0.4,0,0.2,-2,1,1,0,0,1,2,2,-2,2,1,-1,1,-1,0,0,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,56,this was a real good survey i enjoyed being able to answer all of the interesting questions. i enjoyed it very much. ,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,2,7,8,6,3,4,9,1,5,4,3,2,1 +524,R_5uxDugtohnaFA38,32 - 38,,Canadian,Canadian,Female,Neither agree nor disagree,Agree,Agree,Strongly agree,Somewhat agree,1,5,3,4,2,Somewhat disagree,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,4,1,2,3,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,2,5,4,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,3,5,4,Agree,Agree,Agree,Agree,Strongly Agree,1,2,3,4,5,5,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,2,5,4,3,1,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,4,1,5,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,4,2,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,4,1,3,2,5,6,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,2,1,4,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,3,4,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,53,FALSE,64,TRUE,75,TRUE,55,FALSE,54,TRUE,52,TRUE,88,FALSE,100,TRUE,77,FALSE,52,FALSE,50,TRUE,50,FALSE,50,FALSE,97,TRUE,72,FALSE,50,FALSE,50,FALSE,50,FALSE,71,TRUE,50,FALSE,52,FALSE,50,FALSE,50,TRUE,71,TRUE,67,TRUE,62,FALSE,95,FALSE,50,FALSE,50,TRUE,90,FALSE,50,TRUE,50,8,0,2,2,3,1,-1,1,2,3,0,1,0,1,0,1,-3,-2,-3,-3,-3,2,2,2,2,3,5,-1,1,0,2,1,7,1,1,1,1,1,3,1,0,1,1,0,9,2,2,2,2,2,6,-1,0,1,0,1,6,1,1,1,0,1,6,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,90,FALSE,1,50,FALSE,0,50,FALSE,1,95,TRUE,1,62,TRUE,1,67,TRUE,1,71,FALSE,0,50,FALSE,1,50,FALSE,1,52,TRUE,1,50,FALSE,1,71,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,72,FALSE,1,97,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,52,TRUE,1,77,FALSE,1,100,TRUE,1,88,TRUE,0,52,FALSE,1,54,TRUE,0,55,TRUE,1,75,FALSE,0,64,FALSE,0,53,0.1089,0.0144,0.25,0.1444,0.2809,0.0025,0.0529,0.25,0.25,0.25,0.0625,0.25,0.0841,0.25,0.25,0.25,0.2304,0.25,0.2116,0,0.25,0.25,0.0009,0.0841,0.25,0.2704,0.4096,0.25,0.81,0.5184,0.3025,0.2304,0.233971429,0.193807143,0.274135714,8,25,19,59.38,4,50,5,62.5,4,50,6,75,8,50,11,68.75,62.41,60.5,56.88,67.88,64.38,59.81,65,-34.38,3.03,10.5,-5.62,17.88,-10.62,9.81,-3.75,2,0,0,1,2,0,0,2,1,1,0,1,0,1,0,4,2,4,4,3,2,0,0,1,1,0,1,1,3,1,0,1,0,0,0,3,2,3,3,3,1,0.8,0.4,3.4,0.8,1.2,0.2,2.8,1.4,1.25,1.325,5,6,5.875,0.2,-0.4,0.2,0.6,0,-1,1,-3,4,-1,0,1,0,-1,1,0,0,1,-1,-1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,32,,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,3,2,9,8,7,6,4,1,5,2,3,4,1 +525,R_3LigOeEx4VwTQXD,39 - 45,,Canadian,Canadian,Female,Neither agree nor disagree,Agree,Disagree,Agree,Strongly agree,5,1,4,2,3,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,3,2,1,4,5,Somewhat Agree,Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,2,1,5,4,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,3,2,5,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,Strongly Agree,3,1,5,4,2,3,Somewhat agree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,2,5,4,3,1,1,Agree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,1,2,4,5,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,4,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Disagree,Agree,Strongly Agree,2,4,1,5,3,3,Strongly agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,4,3,1,2,5,2,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,4,1,3,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,1,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,71,FALSE,51,TRUE,54,FALSE,57,FALSE,56,FALSE,57,TRUE,69,TRUE,75,FALSE,55,FALSE,60,FALSE,57,FALSE,58,FALSE,56,FALSE,54,TRUE,83,FALSE,60,TRUE,90,FALSE,61,FALSE,60,TRUE,86,TRUE,87,FALSE,54,TRUE,59,FALSE,55,TRUE,61,FALSE,65,FALSE,63,FALSE,55,TRUE,56,FALSE,96,FALSE,72,TRUE,70,12,0,2,-2,2,3,2,0,2,0,-1,1,-2,0,1,1,1,0,1,1,0,0,2,-1,1,3,3,1,-1,2,-2,0,1,2,-2,1,0,2,2,-1,0,-1,-1,-1,2,0,3,-2,2,3,3,3,1,2,-2,0,2,1,-1,1,1,1,2,0,1,1,1,0,2,TRUE,0,70,FALSE,0,72,FALSE,1,96,TRUE,0,56,FALSE,0,55,FALSE,1,63,FALSE,0,65,TRUE,1,61,FALSE,0,55,TRUE,1,59,FALSE,1,54,TRUE,0,87,TRUE,1,86,FALSE,1,60,FALSE,0,61,TRUE,1,90,FALSE,1,60,TRUE,0,83,FALSE,1,54,FALSE,1,56,FALSE,0,58,FALSE,0,57,FALSE,1,60,FALSE,0,55,TRUE,0,75,TRUE,1,69,FALSE,1,57,FALSE,1,56,FALSE,1,57,TRUE,1,54,FALSE,0,51,FALSE,0,71,0.1521,0.0961,0.01,0.4225,0.5041,0.1369,0.3025,0.1681,0.1936,0.3249,0.2116,0.0196,0.3025,0.2116,0.3025,0.5184,0.16,0.3136,0.1936,0.5625,0.3364,0.3721,0.2116,0.16,0.16,0.1849,0.2601,0.49,0.0016,0.6889,0.1849,0.7569,0.29405,0.262135714,0.325964286,12,37.5,17,53.13,3,37.5,5,62.5,3,37.5,6,75,6,37.5,11,68.75,64.47,57.5,63.75,67.25,69.38,63.69,65.25,-15.63,11.34,20,1.25,29.75,-5.62,26.19,-3.5,0,0,1,1,0,1,1,0,2,1,1,0,1,1,1,2,0,2,2,1,0,1,0,0,0,1,1,0,2,1,0,1,1,0,0,1,1,0,0,0,0.4,1,0.8,1.4,0.2,1,0.4,0.4,0.9,0.5,0.7,2,2.33,2.125,0.2,0,0.4,1,0.2,0,-1,0,0,-0.33,0,1,-1,-1,1,0,0,-1,1,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,40,,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,4,9,7,5,8,6,2,1,3,4,2,3,1 +526,R_6K8v1R7OK8j51Mo,53 - 59,,Canadian,Canadian,Female,Somewhat disagree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,4,5,3,2,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,3,2,4,1,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly Agree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly disagree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,1,5,2,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,3,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,5,3,1,4,3,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,2,3,5,4,0,Somewhat agree,Agree,Strongly agree,Somewhat agree,Agree,3,2,5,1,4,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,3,2,1,5,7,Somewhat agree,Disagree,Somewhat agree,Somewhat agree,Agree,1,2,5,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,78,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,73,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,27,-1,3,3,2,1,2,2,3,3,3,3,3,3,0,3,2,-1,1,1,3,-3,3,3,-2,3,1,3,3,3,3,3,1,3,3,3,1,3,1,1,-1,1,1,2,3,-3,3,3,3,2,0,1,2,3,1,2,0,3,3,3,-2,3,0,1,-2,1,1,2,7,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,73,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.0484,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.5329,0,0,0,0,1,1,1,1,0.235046429,0.074885714,0.395207143,27,84.38,25,78.13,8,100,6,75,6,75,5,62.5,16,100,9,56.25,98.47,100,100,96.62,97.25,100,96.94,6.25,20.34,0,25,21.62,34.75,0,40.69,2,0,0,4,2,1,1,0,0,0,0,0,0,1,0,1,0,0,0,1,2,0,0,1,1,1,0,0,2,1,0,0,0,2,0,1,1,0,0,1,1.6,0.4,0.2,0.4,0.8,0.8,0.4,0.6,0.65,0.65,0.65,1,0,1.625,0.8,-0.4,-0.2,-0.2,0.066666667,1,1,1,-4,1,2,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,this is a very good survey and I had fun doing it,2,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,5,6,8,4,2,7,3,1,9,3,2,4,1 +527,R_3GOWhHu6d27W8q6,53 - 59,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Strongly agree,Agree,5,4,1,2,3,Agree,Disagree,Agree,Disagree,Somewhat agree,3,1,2,4,5,Agree,Somewhat Agree,Agree,Agree,Agree,1,4,2,3,5,Agree,Agree,Agree,Somewhat agree,Agree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Agree,Agree,Strongly Agree,4,3,1,5,2,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,1,4,3,2,1,Agree,Agree,Agree,Agree,Somewhat Agree,4,2,3,5,1,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,3,5,4,2,1,1,Somewhat agree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,1,2,3,4,5,1,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,4,5,1,3,2,7,Agree,Agree,Agree,Agree,Somewhat agree,3,5,2,4,1,FALSE,84,TRUE,79,TRUE,76,FALSE,76,TRUE,76,FALSE,77,TRUE,87,TRUE,92,TRUE,82,FALSE,78,FALSE,85,TRUE,87,FALSE,82,TRUE,82,FALSE,81,TRUE,86,TRUE,84,TRUE,87,FALSE,88,FALSE,87,FALSE,87,FALSE,87,FALSE,83,TRUE,87,FALSE,82,TRUE,86,FALSE,88,TRUE,83,FALSE,83,TRUE,86,FALSE,87,FALSE,91,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,2,2,-2,2,-2,1,2,1,2,2,2,2,2,2,1,2,3,2,2,2,3,2,1,-2,1,-2,1,2,2,2,2,2,1,1,1,1,1,1,2,1,1,1,2,2,1,2,1,-3,1,-2,1,1,2,1,1,2,2,1,2,2,2,2,1,7,FALSE,1,84,TRUE,1,79,TRUE,0,76,FALSE,1,76,TRUE,1,76,FALSE,1,77,TRUE,1,87,TRUE,1,92,TRUE,1,82,FALSE,0,78,FALSE,1,85,TRUE,0,87,FALSE,0,82,TRUE,0,82,FALSE,0,81,TRUE,1,86,TRUE,0,84,TRUE,0,87,FALSE,1,88,FALSE,1,87,FALSE,0,87,FALSE,0,87,FALSE,1,83,TRUE,1,87,FALSE,1,82,TRUE,1,86,FALSE,1,88,TRUE,0,83,FALSE,1,83,TRUE,1,86,FALSE,0,87,FALSE,0,91,0.0064,0.0196,0.0196,0.0169,0.8281,0.0529,0.0169,0.6084,0.0169,0.7569,0.0196,0.6724,0.0324,0.0225,0.0576,0.0441,0.0289,0.0576,0.6889,0.0324,0.7569,0.6561,0.0144,0.6724,0.7056,0.0144,0.7569,0.0256,0.5776,0.7569,0.0289,0.7569,0.344967857,0.229657143,0.460278571,26,81.25,19,59.38,6,75,4,50,4,50,5,62.5,9,56.25,10,62.5,83.94,83.25,82.88,84.12,85.5,84.62,83.25,21.87,24.56,8.25,32.88,34.12,23,28.37,20.75,1,1,0,1,1,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,1,2,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0.8,0.4,0.4,0.6,1,0.6,0.2,0.4,0.55,0.55,0.55,1.67,1.33,2.125,-0.2,-0.2,0.2,0.2,-0.066666667,0,1,0,-6,0.34,0,0,1,0,0,1,-1,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,58,great survey,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,9,2,4,7,3,5,8,1,6,2,4,3,1 +528,R_16gYUufnZvp69ln,39 - 45,,Canadian,Canadian,Female,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,4,3,5,1,Disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Neither Agree nor Disagree,3,4,5,2,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Disagree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,1,5,3,2,2,Somewhat disagree,Disagree,Somewhat agree,Agree,Somewhat agree,5,3,4,2,1,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,2,5,4,1,3,2,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,3,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,4,3,5,1,2,1,Disagree,Disagree,Agree,Somewhat agree,Somewhat agree,5,3,2,4,1,2,Somewhat Agree,Agree,Agree,Somewhat Disagree,Neither Agree nor Disagree,5,3,2,1,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Disagree,2,4,5,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,50,TRUE,90,FALSE,50,TRUE,75,FALSE,50,TRUE,65,TRUE,70,TRUE,75,FALSE,75,TRUE,50,FALSE,50,FALSE,50,TRUE,70,TRUE,90,TRUE,65,TRUE,100,FALSE,50,FALSE,50,TRUE,65,TRUE,95,FALSE,50,TRUE,100,TRUE,65,TRUE,100,TRUE,100,FALSE,100,TRUE,70,FALSE,50,FALSE,50,TRUE,65,TRUE,80,18,1,2,1,0,-1,-2,-2,1,1,1,1,1,2,-1,0,-1,0,-1,-2,-2,2,2,1,-1,0,3,-1,-2,1,2,1,2,1,0,2,1,1,3,0,1,-1,1,-1,2,2,2,2,-1,0,1,-2,-2,2,1,1,1,1,2,2,-1,0,2,0,0,0,-1,-2,3,TRUE,0,80,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,70,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,50,TRUE,0,95,TRUE,1,65,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,0,65,TRUE,0,90,TRUE,0,70,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,75,TRUE,1,75,TRUE,0,70,TRUE,1,65,FALSE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,85,0,0.1225,0,0,0.0225,0,0.0625,0,0.25,0.25,0.01,0.1225,0.1225,0.25,0.09,0.1225,0.0625,0.25,0.5625,0.49,0.25,0.25,0.49,0.25,0.4225,0.25,0.25,0.64,0.25,0.81,0.25,0.9025,0.274375,0.115357143,0.433392857,18,56.25,22,68.75,5,62.5,6,75,5,62.5,6,75,13,81.25,9,56.25,70.31,56.25,70,75.62,79.38,73.75,66.88,-12.5,1.56,-6.25,-5,13.12,4.38,-7.5,10.63,1,0,0,1,1,1,0,0,1,0,0,1,0,2,1,1,1,0,3,1,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0.6,0.4,0.8,1.2,0.8,0.2,0.2,0.6,0.75,0.45,0.6,2.67,1.33,2.125,-0.2,0.2,0.6,0.6,0.2,2,1,1,-1,1.34,0,2,2,-2,2,1,-1,-1,1,0,0,1,10 cents,25 minutes,24 days,Female,University - Undergraduate,42,,0.875,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,6,4,7,2,9,8,3,1,5,4,3,2,1 +529,R_7JFQ49rioJVFELu,46 - 52,,Canadian,Canadian,Female,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,4,1,2,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,1,4,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,2,5,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,4,2,1,5,6,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,6,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,3,5,4,1,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,2,4,1,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,4,3,1,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,1,5,4,3,2,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,4,2,5,3,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,FALSE,57,TRUE,88,TRUE,80,FALSE,62,FALSE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,13,1,0,1,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,6,0,1,-1,0,0,6,-1,1,0,1,0,6,0,1,0,-1,1,6,0,0,1,1,1,6,0,-1,1,0,1,6,0,1,1,0,-1,6,0,-1,1,1,2,6,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,62,TRUE,0,80,TRUE,1,88,FALSE,0,57,TRUE,1,91,0.25,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0.25,0.25,0.0144,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1444,0,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.25,0.25,0.25,0.64,0.25,0.23685,0.215892857,0.257807143,13,40.63,17,53.13,4,50,4,50,4,50,5,62.5,2,12.5,15,93.75,55.56,50.88,58.88,56.25,56.25,55.38,55.75,-12.5,2.43,0.88,8.88,6.25,-6.25,42.88,-38,1,0,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,0,1,0,1,0,0,0,1,1,2,1,0,1,0,1,0,0,2,0,2,1,1,1,0.4,0.4,1,0.2,0.4,1,0.6,1,0.5,0.75,0.625,6,6,6,0,-0.6,0.4,-0.8,-0.066666667,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,47,,0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,4,5,6,7,8,3,9,1,2,4,3,2,1 +530,R_3DqhW2ozlQPLiUG,39 - 45,,Canadian,Canadian,Male,Agree,Agree,Agree,Agree,Agree,2,4,1,3,5,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,3,5,1,Neither agree nor disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,6,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,4,2,5,5,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,1,4,5,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,2,4,5,3,1,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,1,5,6,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Disagree,4,3,5,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,2,5,3,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,TRUE,85,TRUE,100,TRUE,97,FALSE,100,TRUE,79,FALSE,77,FALSE,77,TRUE,81,FALSE,76,TRUE,100,TRUE,100,FALSE,80,FALSE,100,FALSE,62,TRUE,73,TRUE,100,TRUE,61,TRUE,62,TRUE,82,TRUE,85,FALSE,94,TRUE,83,TRUE,93,FALSE,81,FALSE,78,FALSE,73,TRUE,100,FALSE,62,TRUE,60,TRUE,65,FALSE,91,16,2,2,2,2,2,0,-2,2,0,0,1,2,1,0,1,0,-1,-2,0,0,1,1,1,1,1,5,2,1,1,1,1,6,-1,1,1,0,0,5,0,1,1,0,0,5,1,2,2,1,1,6,1,1,1,1,1,6,0,2,0,-1,-2,6,0,0,0,-1,0,6,FALSE,1,91,TRUE,1,65,TRUE,0,60,FALSE,1,62,TRUE,1,100,FALSE,1,73,FALSE,0,78,FALSE,0,81,TRUE,1,93,TRUE,1,83,FALSE,1,94,TRUE,0,85,TRUE,1,82,TRUE,0,62,TRUE,1,61,TRUE,1,100,TRUE,0,73,FALSE,1,62,FALSE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,100,FALSE,1,76,TRUE,1,81,FALSE,1,77,FALSE,0,77,TRUE,0,79,FALSE,1,100,TRUE,0,97,TRUE,1,100,TRUE,1,85,TRUE,1,75,0.6561,0.5929,0,0.6084,0.0625,0.0729,0.0361,0.0289,0.04,0,0,0.0324,0.0049,0.0036,0,0.1225,0.0576,0.1444,0,0.0529,0,0.1521,0,0.3844,0.5329,0.6241,0.0225,0.0081,0.36,0.1444,0.9409,0.7225,0.162521429,0.043271429,0.281771429,16,50,23,71.88,7,87.5,6,75,5,62.5,5,62.5,13,81.25,10,62.5,82.25,79.88,84.5,78.75,85.88,85.06,79.44,-21.88,10.37,-7.62,9.5,16.25,23.38,3.81,16.94,1,1,1,1,1,2,3,1,1,1,2,1,0,0,1,0,2,3,0,0,1,0,0,1,1,1,3,1,1,1,1,0,1,1,3,0,1,2,1,0,1,1.6,0.8,1,0.6,1.4,1.2,0.8,1.1,1,1.05,5.33,6,5.625,0.4,0.2,-0.4,0.2,0.066666667,-1,0,-1,-1,-0.67,0,1,0,-2,2,-1,1,1,-1,-2,2,2,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),42,This is the first time I do such an interesting survey,0.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,7,5,2,3,8,9,4,1,6,2,4,3,1 +531,R_601MBPZ8B6KePPS,53 - 59,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Somewhat agree,1,3,4,2,5,Disagree,Disagree,Agree,Agree,Somewhat disagree,5,4,1,3,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,4,2,3,5,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,2,5,3,4,1,Agree,Agree,Agree,Agree,Somewhat agree,1,2,3,5,4,2,Strongly disagree,Disagree,Somewhat agree,Somewhat agree,Disagree,4,1,2,5,3,4,Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,2,3,5,4,1,5,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,1,2,3,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Somewhat agree,1,4,3,2,5,3,Disagree,Disagree,Agree,Somewhat agree,Disagree,3,1,2,5,4,6,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,2,1,3,5,4,2,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,4,2,1,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,60,FALSE,50,TRUE,80,FALSE,50,FALSE,95,FALSE,50,TRUE,85,TRUE,100,TRUE,60,TRUE,100,TRUE,60,TRUE,100,TRUE,70,TRUE,85,TRUE,60,FALSE,65,FALSE,60,TRUE,100,TRUE,60,FALSE,70,TRUE,70,TRUE,55,FALSE,60,TRUE,70,TRUE,80,TRUE,60,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,60,TRUE,90,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,1,-2,-2,2,2,-1,2,1,2,-1,2,0,-1,1,-1,-1,2,2,2,2,1,2,-3,-2,1,1,-2,4,2,1,2,-1,1,5,-1,-2,0,-1,-1,7,2,2,2,2,1,3,-2,-2,2,1,-2,6,2,1,2,0,2,2,1,0,2,1,-1,5,FALSE,1,60,FALSE,0,50,TRUE,0,80,FALSE,1,50,FALSE,0,95,FALSE,1,50,TRUE,1,85,TRUE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,60,TRUE,0,100,TRUE,1,70,TRUE,0,85,TRUE,1,60,FALSE,0,65,FALSE,1,60,TRUE,0,100,TRUE,0,60,FALSE,1,70,TRUE,1,70,TRUE,1,55,FALSE,1,60,TRUE,1,70,TRUE,0,80,TRUE,1,60,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,60,TRUE,1,90,0,0.16,0.4225,0.0225,0.01,0.25,0.09,0,0.09,0.2025,0,0.09,0.16,0.36,0.9025,0.25,0.16,0.25,0.25,0.64,0.09,0.16,0.36,0.7225,0.16,0.25,0.16,0.16,0.64,1,0.25,1,0.309196429,0.201071429,0.417321429,23,71.88,22,68.75,5,62.5,7,87.5,5,62.5,5,62.5,13,81.25,9,56.25,70.47,56.25,68.12,78.12,79.38,74.38,66.56,3.13,1.72,-6.25,-19.38,15.62,16.88,-6.87,10.31,0,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,1,1,2,0,0,0.8,0.2,0.6,0,0.4,0.2,1,0.4,0.4,0.4,3.67,3.67,4.25,0,0.4,0,-0.4,0.133333333,-1,-2,3,2,0,1,1,1,-1,1,1,-1,1,-1,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,56,,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,7,4,5,8,6,2,1,9,3,4,2,1 +532,R_3PCAiCZh86iZFZL,67 - 73,,Canadian,Canadian,Male,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,1,5,2,4,3,Somewhat disagree,Somewhat agree,Agree,Strongly disagree,Somewhat agree,3,2,5,1,4,Somewhat Agree,Agree,Agree,Somewhat Disagree,Somewhat Agree,1,2,5,4,3,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,1,3,2,4,6,Disagree,Somewhat agree,Agree,Strongly disagree,Agree,1,4,5,3,2,4,Somewhat Agree,Agree,Strongly Agree,Somewhat Disagree,Somewhat Agree,2,1,3,5,4,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Somewhat agree,Agree,Strongly Agree,Somewhat disagree,3,2,1,5,4,7,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,2,5,1,3,8,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,3,1,2,5,4,4,Somewhat disagree,Disagree,Somewhat disagree,Agree,Disagree,3,5,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,71,TRUE,74,FALSE,90,TRUE,75,FALSE,87,TRUE,95,FALSE,62,FALSE,50,TRUE,95,TRUE,74,FALSE,57,TRUE,100,FALSE,60,TRUE,97,FALSE,98,FALSE,91,FALSE,100,TRUE,100,TRUE,58,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,76,TRUE,100,TRUE,100,TRUE,76,22,2,1,2,1,3,-1,1,2,-3,1,1,2,2,-1,1,1,-1,2,1,-2,1,2,1,0,3,3,-2,1,2,-3,2,6,1,2,3,-1,1,4,0,1,1,1,-1,4,0,1,2,3,-1,6,-1,2,0,1,-1,7,-1,1,1,-2,1,8,-1,-2,-1,2,-2,4,TRUE,0,76,TRUE,1,100,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,58,TRUE,1,100,FALSE,1,100,FALSE,1,91,FALSE,0,98,TRUE,0,97,FALSE,0,60,TRUE,1,100,FALSE,1,57,TRUE,0,74,TRUE,0,95,FALSE,1,50,FALSE,0,62,TRUE,1,95,FALSE,1,87,TRUE,1,75,FALSE,1,90,TRUE,1,74,TRUE,0,71,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,0,100,TRUE,1,92,0,0.0676,0,0,0.0064,0,0.0625,0,0.25,0.0025,1,0.9604,0.1764,0,0,0,0.0169,0.0576,1,0.01,0.3844,0.36,0.9025,0.9409,0.1849,0.5041,1,0.5776,1,0.5476,1,0.0081,0.391171429,0.180907143,0.601435714,22,68.75,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,86.81,82.5,87,88.25,89.5,88.38,85.25,9.37,27.43,32.5,24.5,25.75,27,19.63,35.25,1,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,2,1,0,1,2,0,0,2,4,0,1,2,4,2,2,1,1,1,0,2,1,3,1,0,0.8,0.4,0.2,1,1.6,1.8,1,1.4,0.6,1.45,1.025,4.33,7,5.25,-0.8,-1.4,-0.8,-0.4,-1,-3,-1,-4,0,-2.67,2,2,1,-1,1,1,-1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),69,I have no particuler additional comments or observations,0.875,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,5,8,6,9,4,3,7,1,2,4,2,3,1 +533,R_6khUynIGgapHzgG,46 - 52,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,2,1,4,3,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,4,5,3,1,2,Neither Agree nor Disagree,Strongly Disagree,Agree,Somewhat Disagree,Strongly Agree,2,5,1,4,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,4,5,2,3,1,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Agree,1,2,3,4,5,2,Neither Agree nor Disagree,Strongly Disagree,Agree,Somewhat Disagree,Strongly Agree,4,5,1,3,2,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,1,5,3,4,4,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Agree,5,1,4,2,3,1,Neither Agree nor Disagree,Strongly Disagree,Agree,Somewhat Disagree,Strongly agree,3,1,2,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,5,3,2,1,FALSE,100,FALSE,82,FALSE,68,FALSE,69,FALSE,72,FALSE,80,TRUE,84,TRUE,83,TRUE,77,TRUE,91,FALSE,78,TRUE,83,TRUE,77,TRUE,59,FALSE,62,TRUE,85,FALSE,56,TRUE,86,TRUE,62,FALSE,100,FALSE,78,TRUE,74,FALSE,100,TRUE,79,FALSE,50,TRUE,85,FALSE,52,FALSE,54,TRUE,70,TRUE,84,TRUE,61,TRUE,91,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,0,-1,-2,0,0,2,0,-3,2,-1,3,-1,-1,0,0,-2,3,3,3,3,2,2,-1,-2,0,-1,2,1,0,-3,2,-1,3,2,0,0,0,0,-2,2,3,3,3,3,2,1,0,-2,0,-1,2,4,0,-3,2,-1,3,1,0,0,0,0,-1,2,FALSE,1,100,FALSE,0,82,FALSE,1,68,FALSE,1,69,FALSE,0,72,FALSE,1,80,TRUE,1,84,TRUE,1,83,TRUE,1,77,TRUE,1,91,FALSE,1,78,TRUE,0,83,TRUE,1,77,TRUE,0,59,FALSE,0,62,TRUE,1,85,FALSE,1,56,TRUE,0,86,TRUE,0,62,FALSE,1,100,FALSE,0,78,TRUE,1,74,FALSE,1,100,TRUE,1,79,FALSE,1,50,TRUE,1,85,FALSE,1,52,FALSE,1,54,TRUE,0,70,TRUE,1,84,TRUE,1,61,TRUE,1,91,0.0289,0.0225,0.0225,0.0256,0.0081,0.04,0.0441,0.0081,0,0.0676,0.0256,0.0529,0.0529,0.0484,0.5184,0.6724,0,0.0961,0.2116,0.25,0.6084,0.3844,0.3844,0.3481,0.1936,0.2304,0.1521,0,0.1024,0.7396,0.49,0.6889,0.229232143,0.116757143,0.341707143,14,43.75,23,71.88,5,62.5,5,62.5,6,75,7,87.5,12,75,11,68.75,76,67.88,78,78.62,79.5,79.06,72.94,-28.13,4.12,5.38,15.5,3.62,-8,4.06,4.19,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0.4,0.2,0,0.4,0.4,0.4,0,0.6,0.25,0.35,0.3,1.67,2,1.875,0,-0.2,0,-0.2,-0.066666667,1,-3,1,0,-0.33,2,2,2,-2,2,0,0,-1,1,-1,1,2,15 cents,25 minutes,24 days,Male,High School (or equivalent),46,I enjoyed it. thanks.,1.5,0,0,0,0,0,1,0,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,9,2,5,3,8,6,7,1,4,4,3,2,1 +534,R_3wafSDodTn91koj,39 - 45,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Agree,Agree,4,1,3,2,5,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly disagree,Disagree,1,4,3,5,2,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,2,1,3,4,5,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,4,5,1,3,2,Agree,Strongly Agree,Strongly Agree,Agree,Agree,1,4,2,3,5,7,Somewhat agree,Disagree,Somewhat agree,Disagree,Strongly disagree,3,4,5,2,1,7,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,1,5,4,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Agree,2,1,3,4,5,3,Somewhat agree,Disagree,Strongly agree,Strongly disagree,Disagree,5,2,3,4,1,3,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,5,2,4,3,Agree,Agree,Agree,Agree,Somewhat agree,5,3,2,4,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,85,FALSE,75,TRUE,91,FALSE,100,TRUE,79,FALSE,92,TRUE,88,FALSE,76,FALSE,92,TRUE,100,FALSE,82,TRUE,100,TRUE,84,FALSE,87,FALSE,66,TRUE,92,TRUE,71,FALSE,91,FALSE,94,FALSE,100,TRUE,83,TRUE,89,FALSE,74,TRUE,93,FALSE,92,FALSE,77,FALSE,91,FALSE,76,TRUE,85,TRUE,100,FALSE,77,TRUE,80,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,2,1,-1,1,-3,-2,3,1,2,1,1,2,1,2,1,-1,2,3,3,2,2,7,1,-2,1,-2,-3,7,3,1,2,0,1,3,0,1,0,0,0,7,2,3,3,2,2,3,1,-2,3,-3,-2,3,3,1,2,0,1,3,2,2,2,2,1,7,TRUE,0,85,FALSE,0,75,TRUE,0,91,FALSE,1,100,TRUE,1,79,FALSE,1,92,TRUE,1,88,FALSE,0,76,FALSE,0,92,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,84,FALSE,1,87,FALSE,0,66,TRUE,1,92,TRUE,0,71,FALSE,1,91,FALSE,1,94,FALSE,1,100,TRUE,1,83,TRUE,1,89,FALSE,1,74,TRUE,1,93,FALSE,1,92,FALSE,0,77,FALSE,1,91,FALSE,1,76,TRUE,0,85,TRUE,1,100,FALSE,0,77,TRUE,1,80,0.5776,0.5929,0.0064,0.0144,0.04,0.0064,0.0049,0,0,0.0121,0,0.0256,0.8464,0.0324,0.0441,0.5625,0.0676,0,0.0576,0.0064,0.0289,0.4356,0.0036,0.0169,0.5041,0.0081,0.5929,0.7225,0.8281,0.0081,0.7225,1,0.234903571,0.117285714,0.352521429,16,50,21,65.63,4,50,6,75,6,75,5,62.5,10,62.5,11,68.75,86.31,84.62,81,88.62,91,84.44,88.19,-15.63,20.68,34.62,6,13.62,28.5,21.94,19.44,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,2,0,2,1,1,0,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,1,0,1,2,0,0.6,0.2,1.2,0,0.6,0.2,0.8,0.5,0.4,0.45,5.67,3,5,0,0,0,0.4,0,4,4,0,0,2.67,1,1,1,-1,1,0,0,0,0,-1,1,1,5 cents,100 minutes,24 days,Male,University - Undergraduate,42,,0.75,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,3,4,6,2,7,5,8,1,9,2,4,3,1 +535,R_5RsJ6LV9TQfp9At,60 - 66,American,,American,Female,Strongly agree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,2,1,4,3,Agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly agree,4,1,3,5,2,Strongly Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,1,2,4,5,3,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Disagree,2,1,5,4,3,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat agree,4,1,3,5,2,5,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,1,2,5,3,5,Agree,Somewhat Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,1,2,4,5,3,5,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Disagree,2,1,3,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Disagree,Somewhat agree,4,2,3,5,1,7,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Disagree,4,3,2,1,5,6,Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,4,2,1,5,3,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,1,4,2,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,70,TRUE,92,TRUE,89,FALSE,82,TRUE,76,TRUE,97,TRUE,87,TRUE,92,FALSE,85,TRUE,95,TRUE,82,FALSE,70,TRUE,93,FALSE,96,FALSE,87,TRUE,95,TRUE,61,TRUE,100,TRUE,99,TRUE,69,FALSE,83,FALSE,86,TRUE,79,TRUE,91,TRUE,88,FALSE,87,TRUE,80,FALSE,62,FALSE,100,TRUE,100,TRUE,100,24,3,2,3,1,0,2,1,-1,-1,3,3,0,2,2,1,1,2,0,1,-2,1,3,3,-1,1,5,1,-1,2,0,2,5,2,-1,1,3,0,5,-1,0,-1,-2,-2,7,2,2,2,-2,1,7,1,-3,2,-3,-2,6,-2,-2,2,0,2,5,1,-1,0,-2,-2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,62,TRUE,1,80,FALSE,1,87,TRUE,1,88,TRUE,1,91,TRUE,1,79,FALSE,0,86,FALSE,1,83,TRUE,0,69,TRUE,1,99,TRUE,0,100,TRUE,1,61,TRUE,1,95,FALSE,1,87,FALSE,1,96,TRUE,0,93,FALSE,1,70,TRUE,1,82,TRUE,1,95,FALSE,1,85,TRUE,1,92,TRUE,0,87,TRUE,1,97,TRUE,0,76,FALSE,1,82,TRUE,0,89,TRUE,1,92,FALSE,0,70,TRUE,1,100,0.0081,0.0009,0.0025,0.0144,0,0.0169,0.0064,0.7396,0.09,0.0025,0.0064,0.0001,0.0441,0.0289,0.04,0,0.0225,0.1444,0.0324,0.7569,0.0324,0.1521,0.8649,1,0.0169,0.5776,0.49,1,0,0.0016,0.7921,0.4761,0.261957143,0.081557143,0.442357143,24,75,23,71.88,5,62.5,7,87.5,4,50,7,87.5,14,87.5,9,56.25,86.66,78,88.62,93.62,86.38,87.94,85.38,3.12,14.78,15.5,1.12,43.62,-1.12,0.44,29.13,2,1,0,2,1,1,2,3,1,1,1,1,1,1,1,2,2,1,3,0,1,0,1,3,1,1,4,3,2,5,5,2,0,2,1,0,3,0,3,0,1.2,1.6,1,1.6,1.2,3,2,1.2,1.35,1.85,1.6,5,6,5.625,0,-1.4,-1,0.4,-0.8,-2,-1,0,2,-1,-1,1,2,-1,1,2,-2,-1,1,-1,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,Thinking about where I have been and where I think I will be in 10 years made me sad.,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,8,9,7,6,3,4,2,1,5,4,2,3,1 +536,R_52aH641n3e20uMV,39 - 45,American,,American,Female,Strongly agree,Agree,Somewhat agree,Somewhat agree,Agree,4,3,1,5,2,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,5,1,2,3,4,Agree,Agree,Strongly Agree,Somewhat Disagree,Somewhat Agree,2,3,1,5,4,Agree,Agree,Agree,Agree,Somewhat agree,1,2,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,4,5,1,3,2,7,Somewhat disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,2,3,1,5,4,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,2,4,3,5,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Strongly Agree,5,3,4,1,2,6,Neither agree nor disagree,Strongly disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,4,5,3,2,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,4,3,1,5,2,5,Agree,Agree,Agree,Agree,Agree,4,2,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,86,FALSE,50,TRUE,86,TRUE,89,FALSE,68,FALSE,63,TRUE,81,FALSE,94,FALSE,50,FALSE,92,TRUE,93,TRUE,92,FALSE,100,FALSE,50,TRUE,99,TRUE,94,TRUE,85,TRUE,87,TRUE,93,FALSE,89,TRUE,93,FALSE,73,FALSE,58,FALSE,54,TRUE,97,TRUE,91,FALSE,100,FALSE,50,FALSE,50,FALSE,63,TRUE,96,FALSE,81,17,3,2,1,1,2,-1,-3,2,-3,0,2,2,3,-1,1,2,2,2,2,1,3,3,2,-1,3,5,-1,-3,2,-2,-1,7,1,0,1,-1,0,5,1,0,1,0,1,5,3,3,2,0,3,5,0,-3,1,-2,0,6,1,0,2,-1,0,5,2,2,2,2,2,5,FALSE,1,81,TRUE,1,96,FALSE,1,63,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,91,TRUE,1,97,FALSE,0,54,FALSE,0,58,FALSE,1,73,TRUE,0,93,FALSE,0,89,TRUE,0,93,TRUE,1,87,TRUE,1,85,TRUE,0,94,TRUE,0,99,FALSE,1,50,FALSE,1,100,TRUE,1,92,TRUE,1,93,FALSE,1,92,FALSE,0,50,FALSE,1,94,TRUE,1,81,FALSE,1,63,FALSE,1,68,TRUE,0,89,TRUE,1,86,FALSE,0,50,TRUE,1,86,0.0009,0.0361,0.0225,0.0081,0.0196,0,0.25,0.3364,0,0.0049,0.0196,0.7921,0.2916,0.0729,0.25,0.0016,0.0064,0.25,0.1024,0.0036,0.0064,0.0169,0.25,0.8649,0.8836,0.1369,0.25,0.0361,0.1369,0.9801,0.7921,0.8649,0.272139286,0.163935714,0.380342857,17,53.13,21,65.63,6,75,4,50,5,62.5,6,75,10,62.5,11,68.75,79.59,65.38,86.5,86.25,80.25,77.81,81.38,-12.5,13.96,-9.62,36.5,23.75,5.25,15.31,12.63,0,1,1,2,1,0,0,0,1,1,1,2,2,0,1,1,2,1,2,0,0,1,1,1,1,1,0,1,1,0,1,2,1,0,1,0,0,0,0,1,1,0.4,1.2,1.2,0.8,0.6,1,0.2,0.95,0.65,0.8,5.67,5.33,5.375,0.2,-0.2,0.2,1,0.066666667,0,1,0,0,0.34,0,1,0,-2,2,0,0,0,0,0,0,0,10 cents,75 minutes,47 days,Female,College Diploma/Certificate,42,,0.375,0,0,1,1,0,0,0.33,0.33,04LPfPsV,02COC,02FUT,02DGEN,02REV,8,3,7,6,9,2,4,1,5,2,4,3,1 +537,R_6A8dwSRHTK7fgo9,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,1,4,2,5,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,2,3,4,1,Somewhat disagree,Strongly disagree,Disagree,Somewhat agree,Somewhat disagree,3,5,4,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,4,5,3,2,1,10,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,1,5,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,4,3,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,1,2,10,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,5,4,3,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,3,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,81,TRUE,70,TRUE,100,TRUE,77,TRUE,66,TRUE,100,TRUE,100,TRUE,100,TRUE,66,TRUE,100,TRUE,92,TRUE,100,TRUE,100,TRUE,100,TRUE,95,TRUE,90,TRUE,85,TRUE,100,TRUE,99,TRUE,75,TRUE,96,TRUE,99,TRUE,72,TRUE,76,TRUE,100,TRUE,100,TRUE,66,FALSE,63,TRUE,67,TRUE,100,FALSE,58,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,1,0,-1,3,0,1,1,1,3,-1,3,-1,-3,-2,1,-1,3,3,3,3,0,10,0,-1,3,0,0,10,3,3,3,-3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,0,-1,3,-1,1,10,3,3,3,-1,3,10,3,3,3,3,3,10,TRUE,0,81,TRUE,1,70,TRUE,0,100,TRUE,0,77,TRUE,1,66,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,66,TRUE,1,100,TRUE,0,92,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,95,TRUE,1,90,TRUE,0,85,TRUE,0,100,TRUE,0,99,TRUE,0,75,TRUE,1,96,TRUE,1,99,TRUE,0,72,TRUE,1,76,TRUE,0,100,TRUE,1,100,TRUE,0,66,FALSE,1,63,TRUE,0,67,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0,0.01,0,0,1,0.0576,0,0.5625,0.0001,0,0,0.1156,0.8464,0.1156,0.09,0.5184,0.5929,0.1369,1,0.0016,0.0025,0.9801,1,0.7225,0.4356,0.3364,0.6561,1,1,0.4489,1,0.450703571,0.278507143,0.6229,28,87.5,16,50,3,37.5,4,50,4,50,5,62.5,15,93.75,1,6.25,87.28,77.88,85.75,97.5,88,88.5,86.06,37.5,37.28,40.38,35.75,47.5,25.5,-5.25,79.81,0,0,0,0,1,0,0,0,0,1,2,2,0,2,0,4,6,5,2,4,0,0,0,0,2,0,0,0,1,0,2,2,0,0,0,4,6,5,2,4,0.2,0.2,1.2,4.2,0.4,0.2,0.8,4.2,1.45,1.4,1.425,10,10,10,-0.2,0,0.4,0,0.066666667,0,0,0,0,0,0,2,0,-1,1,2,-2,2,-2,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),47,"Thank you for the survey opportunity, I enjoyed every minute.",0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,9,3,2,6,7,8,5,1,4,2,4,3,1 +538,R_3wme3XCgzo0jj81,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,2,4,5,3,1,Agree,Disagree,Strongly agree,Disagree,Agree,4,1,5,2,3,Somewhat Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,1,3,2,5,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,3,1,5,4,2,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,1,2,5,4,3,3,Agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Agree,5,2,4,3,1,2,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,4,2,1,5,3,3,Disagree,Disagree,Somewhat disagree,Somewhat agree,Disagree,5,4,1,2,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,2,3,4,5,1,2,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,4,3,5,1,2,2,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,2,3,5,1,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,1,3,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,71,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,86,FALSE,50,TRUE,83,FALSE,100,TRUE,84,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,92,FALSE,50,FALSE,100,TRUE,100,FALSE,100,26,3,3,0,0,3,2,-2,3,-2,2,1,1,2,-2,3,0,0,1,2,-1,3,3,1,-2,3,3,2,-3,3,0,2,2,2,1,1,0,3,3,-2,-2,-1,1,-2,8,3,3,1,1,3,2,1,-2,2,0,1,2,1,0,3,-2,3,1,0,0,0,1,-1,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,84,FALSE,1,100,TRUE,0,83,FALSE,1,50,FALSE,0,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,71,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0.81,0.0064,0,0,0.25,0,0,0.7396,0.25,0.6889,1,0.7056,0,0.0841,0,0,0,1,1,0.251235714,0.111885714,0.390585714,26,81.25,25,78.13,6,75,5,62.5,7,87.5,7,87.5,15,93.75,10,62.5,90.81,74.25,95.25,100,93.75,90.56,91.06,3.12,12.68,-0.75,32.75,12.5,6.25,-3.19,28.56,0,0,1,2,0,0,1,0,2,0,1,0,1,2,0,2,2,2,1,1,0,0,1,1,0,1,0,1,2,1,0,1,1,0,0,0,0,1,1,0,0.6,0.6,0.8,1.6,0.4,1,0.4,0.4,0.9,0.55,0.725,2.67,1.67,3.25,0.2,-0.4,0.4,1.2,0.066666667,1,0,2,3,1,-1,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,58,It was interesting and fun and makes you want to see how accurate your answers were,1.375,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,7,6,2,4,3,9,8,1,5,3,4,2,1 +539,R_1lLGG34Y7Qr2q1x,53 - 59,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat agree,3,1,5,2,4,Strongly agree,Disagree,Strongly agree,Disagree,Somewhat disagree,3,1,4,5,2,Somewhat Disagree,Somewhat Agree,Strongly Agree,Strongly Disagree,Somewhat Agree,1,3,4,2,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Agree,Agree,Agree,2,1,3,4,5,4,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,1,2,5,3,4,3,Disagree,Somewhat Agree,Strongly Agree,Strongly Disagree,Somewhat Agree,3,1,5,4,2,10,Disagree,Strongly Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,1,5,2,3,0,Strongly agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,2,4,3,5,8,Somewhat Disagree,Somewhat Agree,Strongly agree,Strongly Disagree,Somewhat Agree,1,5,3,2,4,10,Agree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,3,2,5,1,4,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,100,TRUE,78,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,52,TRUE,86,FALSE,50,TRUE,100,FALSE,50,TRUE,100,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,1,3,-2,3,-2,-1,-1,1,3,-3,1,-1,0,1,0,1,3,3,2,2,2,2,3,1,3,1,2,4,-2,1,3,-3,1,3,-2,3,3,-3,0,10,3,3,3,3,2,0,3,-2,3,-2,0,0,-1,1,3,-3,1,8,2,0,2,2,-1,10,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,78,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,52,TRUE,0,86,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0.25,0.25,0,0,0.25,0,1,0.25,0.25,0.25,0.25,0.25,0.25,0.7396,1,0.0484,0.25,0.25,0.25,0.25,0.2304,0.25,1,1,1,0.25,1,0.384585714,0.232142857,0.537028571,10,31.25,18,56.25,4,50,6,75,4,50,4,50,8,50,10,62.5,73.94,50.25,66,87.5,92,76.75,71.12,-25,17.69,0.25,-9,37.5,42,26.75,8.62,0,0,1,0,1,0,3,0,3,3,1,0,0,0,0,1,3,2,3,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,3,0,1,2,2,0.4,1.8,0.2,2,0.4,0.2,0,1.6,1.1,0.55,0.825,3,2.67,4.625,0,1.6,0.2,0.4,0.6,2,4,-5,0,0.33,2,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,,1.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,8,5,2,6,7,3,4,1,9,2,3,4,1 +540,R_7bejcOOpN7kMZ8d,46 - 52,American,,American,Female,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,Agree,Agree,Agree,Agree,Agree,3,4,5,2,1,8,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,9,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,10,Agree,Agree,Agree,Agree,Agree,4,2,3,1,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,4,3,1,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,5,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,58,TRUE,55,TRUE,100,TRUE,89,FALSE,53,TRUE,57,TRUE,100,TRUE,100,TRUE,52,TRUE,53,FALSE,52,TRUE,100,TRUE,100,FALSE,52,TRUE,51,FALSE,50,FALSE,52,TRUE,100,TRUE,52,TRUE,52,TRUE,53,FALSE,52,FALSE,51,TRUE,51,TRUE,52,TRUE,52,FALSE,52,FALSE,55,TRUE,53,TRUE,54,FALSE,52,TRUE,51,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,10,2,2,2,2,2,9,2,2,2,2,2,7,0,0,0,0,0,8,0,0,0,0,0,7,3,3,3,3,3,10,FALSE,1,58,TRUE,1,55,TRUE,0,100,TRUE,0,89,FALSE,0,53,TRUE,0,57,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,53,FALSE,1,52,TRUE,0,100,TRUE,1,100,FALSE,1,52,TRUE,1,51,FALSE,0,50,FALSE,1,52,TRUE,0,100,TRUE,0,52,TRUE,0,52,TRUE,1,53,FALSE,0,52,FALSE,1,51,TRUE,1,51,TRUE,0,52,TRUE,1,52,FALSE,1,52,FALSE,1,55,TRUE,0,53,TRUE,1,54,FALSE,0,52,TRUE,1,51,0,0.2304,0.25,0,0.2401,0.3249,0.2401,0.2209,0.2704,0.2704,0.2116,0,0.2304,0.2304,0.2809,0.2025,0.2401,0.7921,0.2025,0.2704,0.2209,0.2401,0.2704,0.2304,0.2304,0.2304,0.2704,0.1764,1,1,0.2809,1,0.334928571,0.2682,0.401657143,25,78.13,19,59.38,5,62.5,5,62.5,5,62.5,4,50,12,75,7,43.75,62.69,56.88,58.75,64.88,70.25,61.19,64.19,18.75,3.31,-5.62,-3.75,2.38,20.25,-13.81,20.44,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,2,2,2,2,2,0,0,3,2,1.25,1.625,9,7.33,8.5,0,2,2,-1,1.333333333,1,1,3,-1,1.67,1,1,0,1,-1,1,-1,1,-1,1,-1,2,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,49,none,0,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,4,9,8,3,2,6,5,1,7,2,3,4,1 +541,R_5uZJkBhivI2UNcp,46 - 52,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Somewhat agree,Disagree,Agree,3,5,4,1,2,Disagree,Strongly disagree,Agree,Somewhat disagree,Agree,1,4,2,5,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Agree,2,4,5,1,3,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Agree,4,5,2,3,1,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Agree,3,5,1,4,2,4,Strongly disagree,Strongly disagree,Agree,Disagree,Agree,5,1,4,3,2,4,Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,2,4,3,1,5,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,4,5,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Disagree,Neither agree nor disagree,Agree,4,2,3,1,5,7,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,3,4,2,5,1,7,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Agree,2,4,5,3,1,7,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,70,TRUE,80,TRUE,90,TRUE,75,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,57,FALSE,100,TRUE,57,TRUE,100,TRUE,69,FALSE,100,TRUE,75,FALSE,58,TRUE,55,TRUE,77,TRUE,100,TRUE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,56,TRUE,66,TRUE,59,FALSE,100,26,3,3,1,-2,2,-2,-3,2,-1,2,2,0,1,-1,2,0,1,2,1,2,3,3,1,-2,2,4,-3,-3,2,-2,2,4,2,1,1,-2,1,4,-1,1,1,1,2,8,3,3,-2,0,2,7,-2,-1,2,0,1,7,2,0,0,-2,2,7,2,2,2,2,2,6,FALSE,1,100,TRUE,1,59,TRUE,0,66,TRUE,0,56,TRUE,1,100,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,77,TRUE,0,55,FALSE,1,58,TRUE,1,75,FALSE,1,100,TRUE,1,69,TRUE,1,100,TRUE,0,57,FALSE,1,100,FALSE,1,57,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,75,TRUE,0,90,TRUE,1,80,TRUE,1,70,TRUE,1,100,0,0,0,0,0,0.64,0,0.0529,0,0,0.04,0.0625,0,0.3025,0,0.1681,0,0.3136,0.5625,0,1,0.0961,0.1849,0,0.3249,1,0.09,0,0.4356,0,0.81,0.1764,0.223571429,0.112828571,0.334314286,26,81.25,23,71.88,5,62.5,4,50,8,100,6,75,15,93.75,8,50,85.12,70.75,87.75,97.12,84.88,89.38,80.88,9.37,13.24,8.25,37.75,-2.88,9.88,-4.37,30.88,0,0,0,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,3,2,0,0,2,0,1,1,0,0,1,1,0,2,1,0,1,0,0,0.4,0.6,0.4,1,0.8,0.4,0.8,0.35,0.75,0.55,4,7,5.875,-1,-0.4,0.2,-0.4,-0.4,-3,-3,-3,2,-3,1,1,1,-1,1,1,-1,0,0,-2,2,2,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),48,It was a fun survey that made me think more than usual.,0.875,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,8,9,7,3,5,4,2,1,6,4,2,3,1 +542,R_7JJSpreMxXWxp8d,60 - 66,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,2,1,4,Somewhat agree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat agree,4,5,2,3,1,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,2,4,3,1,Disagree,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Somewhat disagree,Strongly Agree,4,2,5,3,1,1,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,5,1,4,2,3,3,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,2,3,4,1,10,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Disagree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,5,2,1,7,Agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Agree,1,3,4,2,5,6,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,1,2,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,2,3,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,60,FALSE,50,TRUE,100,FALSE,50,FALSE,100,TRUE,75,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,75,TRUE,100,TRUE,89,FALSE,100,FALSE,86,TRUE,100,TRUE,60,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,0,1,1,-3,3,1,1,3,3,2,0,3,-2,-2,-2,0,-1,0,3,0,-1,3,5,1,-3,3,-2,2,1,3,3,3,0,3,3,0,2,2,0,-2,10,2,2,2,1,0,5,2,-3,3,0,2,7,3,3,3,0,3,6,0,0,0,0,0,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,50,TRUE,0,60,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,89,FALSE,1,100,FALSE,1,86,TRUE,1,100,TRUE,1,60,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0.25,0,0.25,0.25,0,0.25,0,0.25,0.25,0,0.5625,0.25,0.25,0.5625,0.36,0.25,0.7921,0.16,1,0,0,0.0196,1,0.248453571,0.125,0.371907143,24,75,19,59.38,4,50,5,62.5,4,50,6,75,10,62.5,9,56.25,79.53,71.75,67,85.62,93.75,78.75,80.31,15.62,20.15,21.75,4.5,35.62,18.75,16.25,24.06,1,2,1,1,2,0,0,0,3,1,0,0,1,0,0,2,4,4,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,0,0,2,2,2,0,1,1.4,0.8,0.2,2.2,1,0.6,0.2,1.4,1.15,0.8,0.975,3,6,5.25,0.4,0.2,0,0.8,0.2,0,-6,-3,5,-3,-1,0,0,0,0,1,-1,0,0,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,I enjoyed this survey very much. Really would like to know the results from this one Thanks.,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,6,7,4,9,3,8,5,1,2,3,4,2,1 +543,R_1TcIkOx0f3EjeRX,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Agree,Agree,Disagree,Agree,4,5,2,3,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,1,2,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,1,3,5,Disagree,Somewhat disagree,Disagree,Strongly disagree,Neither agree nor disagree,5,3,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,5,3,2,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,3,5,2,2,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,1,2,3,4,5,9,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,5,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,3,4,5,2,1,3,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,4,1,5,2,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,5,1,2,2,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Strongly disagree,2,5,1,4,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,93,TRUE,50,TRUE,100,FALSE,50,TRUE,58,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,57,FALSE,50,TRUE,57,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,95,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,66,TRUE,71,FALSE,60,FALSE,57,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,-2,2,0,0,2,0,2,0,0,0,0,0,-2,-1,-2,-3,0,3,3,3,0,3,1,1,1,1,0,1,2,-3,-3,-3,-3,-3,9,-3,-3,-3,-3,-3,2,3,3,1,3,3,3,0,0,3,0,3,2,0,0,0,0,0,2,1,-1,1,-2,-3,1,TRUE,0,93,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,58,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,57,FALSE,0,50,TRUE,1,57,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,66,TRUE,0,71,FALSE,0,60,FALSE,0,57,TRUE,1,100,0,0,0.1849,0,0,0,0,0,0,0.0025,0.36,1,0.25,0,0.1764,0.25,0,0.25,0.4356,0,0,0.25,0,0.3249,0,0.25,0.3249,0.8649,1,0,0.5041,1,0.258689286,0.163492857,0.353885714,25,78.13,22,68.75,6,75,6,75,6,75,4,50,12,75,10,62.5,83.25,63.38,91.12,93.12,85.38,79.81,86.69,9.38,14.5,-11.62,16.12,18.12,35.38,4.81,24.19,2,1,1,2,1,1,1,1,0,1,3,3,3,3,3,1,2,1,0,3,2,1,1,5,1,0,0,1,0,1,0,0,0,0,0,3,0,3,1,3,1.4,0.8,3,1.4,2,0.4,0,2,1.65,1.1,1.375,4,2.33,2.75,-0.6,0.4,3,-0.6,0.933333333,-2,0,7,1,1.67,0,2,1,-2,2,-1,1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,46,"It was really good, would like to know th results of the 32 questions",1.375,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,9,4,7,6,3,5,8,1,2,4,2,3,1 +544,R_1NWsBClOlYG35WF,39 - 45,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Agree,Somewhat disagree,Agree,5,4,1,2,3,Neither agree nor disagree,Agree,Strongly agree,Neither agree nor disagree,Agree,1,3,4,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,1,3,2,4,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,2,4,8,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,5,1,3,4,8,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,2,1,5,3,4,7,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,Agree,3,2,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Agree,Strongly Agree,2,4,3,1,5,7,Strongly agree,Agree,Somewhat agree,Strongly agree,Agree,5,3,2,4,1,8,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,3,2,5,4,1,8,Somewhat disagree,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,2,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,97,FALSE,100,TRUE,66,TRUE,100,TRUE,100,FALSE,95,TRUE,100,TRUE,100,FALSE,94,TRUE,100,TRUE,55,TRUE,50,TRUE,85,TRUE,97,FALSE,94,FALSE,64,TRUE,50,TRUE,100,TRUE,100,22,3,3,2,-1,2,0,2,3,0,2,0,0,1,3,1,1,0,1,0,0,0,1,1,1,0,8,1,0,0,0,1,8,1,0,0,-1,1,7,-1,1,0,2,2,5,1,3,2,2,3,7,3,2,1,3,2,8,0,-1,3,3,0,8,-1,0,3,3,3,8,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,1,64,FALSE,0,94,TRUE,0,97,TRUE,1,85,TRUE,1,50,TRUE,1,55,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,0,66,FALSE,1,100,TRUE,0,97,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0,0,0.0225,0,0.9409,0,0,1,0,0,0,0.2025,0.0036,0.8836,0,0,0.1296,0.25,1,0.25,0,0.9409,0.0025,0.4356,0.25,0.25,1,0.25,0,1,1,0.349614286,0.225728571,0.4735,22,68.75,20,62.5,6,75,3,37.5,6,75,5,62.5,13,81.25,7,43.75,85.84,76.25,88.38,97.5,81.25,86.5,85.19,6.25,23.34,1.25,50.88,22.5,18.75,5.25,41.44,3,2,1,2,2,1,2,3,0,1,1,0,1,4,0,2,1,1,2,2,2,0,0,3,1,3,0,2,3,0,0,1,2,0,1,2,0,2,3,3,2,1.4,1.2,1.6,1.2,1.6,0.8,2,1.55,1.4,1.475,7.67,7.67,7.375,0.8,-0.2,0.4,-0.4,0.333333333,1,0,-1,-3,0,2,1,2,-2,2,1,-1,2,-2,-2,2,2,10 cents,100 minutes,36 days,Male,University - Graduate (Masters),43,"it was much different than other surveys I have taken, and I sincerely hope it rewards me better as it was more involved and took much longer than I expected.",1,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,4,3,7,2,9,6,5,1,8,3,2,4,1 +545,R_5TmIC9FlspsxFG1,46 - 52,American,,American,Female,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,1,2,4,3,Agree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,3,5,1,4,2,Somewhat Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,1,4,2,5,3,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Neither agree nor disagree,Strongly Agree,2,1,5,3,4,4,Agree,Somewhat disagree,Agree,Disagree,Agree,5,2,3,4,1,6,Somewhat Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,1,2,5,4,3,5,Disagree,Somewhat agree,Agree,Somewhat disagree,Agree,4,3,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Agree,Agree,Neither agree nor disagree,Agree,5,2,1,3,4,6,Agree,Disagree,Agree,Disagree,Agree,3,2,5,1,4,2,Neither Agree nor Disagree,Agree,Agree,Agree,Agree,5,3,4,2,1,2,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Agree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,TRUE,100,FALSE,90,FALSE,91,FALSE,91,FALSE,95,TRUE,92,TRUE,50,TRUE,92,FALSE,100,TRUE,95,TRUE,96,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,97,TRUE,100,FALSE,92,TRUE,100,FALSE,100,TRUE,91,TRUE,95,TRUE,95,TRUE,96,FALSE,95,TRUE,100,FALSE,90,FALSE,100,TRUE,100,FALSE,100,25,1,3,3,0,3,2,-1,2,-2,0,-1,2,2,0,2,-3,0,-1,0,1,2,2,2,0,3,6,2,-1,2,-2,2,4,-1,2,2,0,2,6,-2,1,2,-1,2,5,3,2,2,0,2,4,2,-2,2,-2,2,6,0,2,2,2,2,2,-2,-2,0,-1,2,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,95,TRUE,1,96,TRUE,1,95,TRUE,1,95,TRUE,1,91,FALSE,1,100,TRUE,0,100,FALSE,0,92,TRUE,0,100,TRUE,1,97,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,96,TRUE,1,95,FALSE,1,100,TRUE,1,92,TRUE,0,50,TRUE,1,92,FALSE,1,95,FALSE,1,91,FALSE,1,91,FALSE,0,90,TRUE,1,100,TRUE,1,95,0.0025,0.0064,0,0.0016,0.0025,0.0025,0.0064,0.0081,0,0.0025,0.81,0.8464,0.0025,0,0,0,0,0.01,0.0081,0.25,0.0016,0.0009,0,1,1,0.0025,0,0,0,0,0.0081,1,0.177217857,0.120778571,0.233657143,25,78.13,26,81.25,8,100,6,75,6,75,6,75,14,87.5,12,75,94.94,97.12,96.12,90.5,96,95.38,94.5,-3.12,13.69,-2.88,21.12,15.5,21,7.88,19.5,1,1,1,0,0,0,0,0,0,2,0,0,0,0,0,1,1,3,1,1,2,1,1,0,1,0,1,0,0,2,1,0,0,2,0,1,2,1,1,1,0.6,0.4,0,1.4,1,0.6,0.6,1.2,0.6,0.85,0.725,5.33,4,4.375,-0.4,-0.2,-0.6,0.2,-0.4,2,-2,4,3,1.33,0,0,0,0,0,0,0,0,0,0,0,-1,10 cents,25 minutes,24 days,Female,University - Undergraduate,52,I think these questions were truly thinking questions,-0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,8,3,2,9,4,6,7,1,5,2,3,4,1 +546,R_5C7I2Ai9dXQSlDi,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,1,2,3,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,3,4,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,3,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,2,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,2,1,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,TRUE,100,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,99,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,99,TRUE,1,100,TRUE,1,100,TRUE,1,99,0,0,0,0.0001,0.0001,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,0.9801,1,0.9801,1,0.570010714,0.35715,0.782871429,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,99.88,100,99.75,99.88,99.88,99.88,99.88,50,49.88,50,49.75,49.88,49.88,-0.12,99.88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,2,2,2,2,-2,2,-2,2,-2,2,-2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,29,good survey,0,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,4,6,2,5,7,8,3,1,9,2,3,4,1 +547,R_7dzuwtiPAfCbbt7,60 - 66,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,4,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,4,1,2,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,1,3,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,2,1,3,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,5,2,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,5,2,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,4,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,4,1,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,3,1,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,3,5,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,95,TRUE,100,FALSE,100,FALSE,100,TRUE,91,TRUE,100,FALSE,100,TRUE,100,TRUE,98,TRUE,98,FALSE,94,TRUE,92,TRUE,96,TRUE,100,FALSE,89,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,92,TRUE,100,TRUE,100,FALSE,93,TRUE,100,TRUE,91,TRUE,100,TRUE,100,TRUE,96,25,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,2,2,1,1,1,1,1,1,8,1,1,1,1,1,8,0,0,0,0,0,8,1,1,1,1,1,9,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,TRUE,0,96,TRUE,1,100,TRUE,0,100,TRUE,0,91,TRUE,1,100,FALSE,1,93,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,89,TRUE,0,100,TRUE,0,96,TRUE,0,92,FALSE,0,94,TRUE,1,98,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,96,0,0,0,0,0.0016,0.0049,0,0,0.8464,0.0004,0,0,0.0064,1,0,0,0.9604,0.8281,0,0,0.8836,0,0.9216,1,0.0121,0.8281,0.0025,0.9216,1,1,0,1,0.400632143,0.260585714,0.540678571,25,78.13,20,62.5,4,50,6,75,5,62.5,5,62.5,15,93.75,5,31.25,97.53,95.62,96.25,99.25,99,98.44,96.62,15.63,35.03,45.62,21.25,36.75,36.5,4.69,65.37,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0.2,0,0,0.4,0.2,0,1,0.4,0.15,0.4,0.275,8,8,8.125,0,0,-1,0,-0.333333333,0,0,0,1,0,-1,1,1,1,-1,-1,1,1,-1,1,-1,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),63,none,0,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,3,8,6,2,9,7,5,1,4,3,2,4,1 +548,R_5KGw8CVCkXeVwY0,60 - 66,American,,American,Female,Agree,Somewhat agree,Agree,Agree,Agree,3,4,2,1,5,Somewhat agree,Disagree,Strongly agree,Disagree,Disagree,5,1,4,3,2,Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Agree,1,4,5,3,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,2,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Somewhat agree,Agree,5,3,1,2,4,4,Agree,Disagree,Agree,Somewhat agree,Disagree,2,4,3,5,1,4,Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,1,5,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,2,4,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Somewhat agree,Agree,Agree,Agree,1,2,3,4,5,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,5,2,1,4,3,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,5,1,2,4,3,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,1,3,2,5,4,FALSE,100,TRUE,100,TRUE,100,FALSE,55,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,99,TRUE,98,FALSE,80,TRUE,100,FALSE,100,TRUE,98,TRUE,95,TRUE,100,FALSE,85,FALSE,100,TRUE,90,FALSE,100,TRUE,90,TRUE,90,FALSE,90,TRUE,90,TRUE,85,TRUE,85,FALSE,65,FALSE,90,TRUE,90,TRUE,100,FALSE,70,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,2,2,1,-2,3,-2,-2,2,0,1,-2,2,0,1,1,1,-2,2,2,2,1,2,6,2,-2,2,1,-2,4,2,0,2,-2,2,4,0,0,0,0,-2,5,2,1,2,2,2,2,1,0,1,0,-3,2,1,1,1,-2,2,3,-1,-1,0,-1,-2,3,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,55,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,98,FALSE,1,80,TRUE,0,100,FALSE,0,100,TRUE,0,98,TRUE,1,95,TRUE,1,100,FALSE,1,85,FALSE,1,100,TRUE,0,90,FALSE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,90,TRUE,1,90,TRUE,0,85,TRUE,1,85,FALSE,1,65,FALSE,1,90,TRUE,0,90,TRUE,1,100,FALSE,0,70,TRUE,1,100,0,0.0225,0,0,0,0,0.01,0.0004,0,0.01,0,1,0.0001,0.04,1,0,0.01,0.2025,0.01,0.7225,0.01,0.0025,0.81,0.9604,0.0225,0.1225,0.49,0,1,0,0.81,1,0.29405,0.162357143,0.425742857,25,78.13,23,71.88,6,75,5,62.5,6,75,6,75,13,81.25,10,62.5,92.03,81.75,94.38,94.5,97.5,94.81,89.25,6.25,20.15,6.75,31.88,19.5,22.5,13.56,26.75,0,1,0,1,0,1,0,1,3,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,2,2,2,1,1,1,0,0,0,1,2,1,2,0,0.4,1,0.2,0.6,0,1.4,0.4,1.2,0.55,0.75,0.65,4.67,2.33,3.625,0.4,-0.4,-0.2,-0.6,-0.066666667,4,2,1,2,2.34,0,2,2,-2,2,-2,2,1,-1,2,-2,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),65,I enjoyed this survey. The questions were unique.,0.625,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,9,5,2,7,6,4,8,1,3,2,3,4,1 +549,R_5qZ4y6NaJUrH4kh,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,4,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,1,3,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,4,1,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,5,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,2,5,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,2,3,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,5,1,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,5,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,-3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,-3,-3,3,-3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,-3,-3,3,-3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,0.535714286,0.357142857,0.714285714,16,50,17,53.13,3,37.5,4,50,4,50,6,75,12,75,5,31.25,100,100,100,100,100,100,100,-3.13,46.87,62.5,50,50,25,25,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-2,-2,2,0,0,0,0,2,-2,-2,10 cents,100 minutes,24 days,Male,Trade School (non-military),58,way to long,-0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,5,8,6,3,9,2,4,1,7,4,2,3,1 +550,R_7KkIoV41qxnDucT,46 - 52,American,,American,Male,Agree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,3,4,1,2,5,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,5,4,1,Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,4,5,1,2,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,5,4,2,3,1,Agree,Agree,Agree,Agree,Disagree,5,3,4,2,1,3,Disagree,Neither agree nor disagree,Agree,Agree,Somewhat agree,2,5,4,1,3,3,Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,1,Somewhat disagree,Disagree,Somewhat disagree,Disagree,Disagree,4,5,2,1,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,1,3,2,5,4,2,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Disagree,1,5,3,4,2,3,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,3,5,2,4,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,1,4,5,3,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,52,TRUE,94,TRUE,91,TRUE,60,FALSE,96,TRUE,50,TRUE,70,TRUE,80,TRUE,90,TRUE,70,TRUE,96,TRUE,76,FALSE,100,TRUE,72,TRUE,92,TRUE,67,TRUE,100,TRUE,82,FALSE,100,FALSE,77,TRUE,100,FALSE,72,TRUE,60,TRUE,50,TRUE,92,TRUE,93,FALSE,98,TRUE,60,TRUE,50,TRUE,91,TRUE,92,TRUE,97,19,2,1,-1,2,-1,-2,0,1,1,-1,2,1,2,1,1,-1,-1,-1,1,-2,2,2,2,2,-2,3,-2,0,2,2,1,3,2,1,2,1,1,1,-1,-2,-1,-2,-2,1,2,2,1,2,0,2,-2,0,2,-1,-2,3,2,1,1,-1,1,2,-1,-1,0,-2,-2,2,TRUE,0,97,TRUE,1,92,TRUE,0,91,TRUE,0,50,TRUE,1,60,FALSE,1,98,TRUE,1,93,TRUE,1,92,TRUE,1,50,TRUE,1,60,FALSE,1,72,TRUE,0,100,FALSE,0,77,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,0,67,TRUE,0,92,TRUE,0,72,FALSE,1,100,TRUE,1,76,TRUE,1,96,TRUE,0,70,TRUE,1,90,TRUE,0,80,TRUE,1,70,TRUE,0,50,FALSE,1,96,TRUE,0,60,TRUE,1,91,TRUE,1,94,TRUE,1,52,0.0064,0.09,0,0.0049,0.2304,0.0004,0.01,0.16,0,0.0016,0.0081,0.5929,0.25,0.0784,0.16,0.0064,0.49,0.25,0.0016,0.64,0.0576,0.0324,0.5184,0,0.4489,0.25,0.0036,0.9409,0.8281,0.8464,0.36,1,0.291646429,0.159871429,0.423421429,19,59.38,20,62.5,5,62.5,4,50,5,62.5,6,75,15,93.75,5,31.25,80.31,70.25,70,86,95,79.69,80.94,-3.12,17.81,7.75,20,23.5,20,-14.06,49.69,0,1,3,0,1,0,0,1,1,2,0,0,0,0,0,0,1,0,3,0,0,1,2,0,1,0,0,1,2,1,0,0,1,2,0,0,0,1,3,0,1,0.8,0,0.8,0.8,0.8,0.6,0.8,0.65,0.75,0.7,2.33,2.33,2.125,0.2,0,-0.6,0,-0.133333333,1,0,-1,-1,0,1,1,1,-1,1,0,0,-1,1,-1,1,-1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,52,,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,8,3,4,6,7,5,1,9,3,4,2,1 +551,R_7HfprOKQHqsNliF,60 - 66,American,,American,Male,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,2,1,5,3,4,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,4,5,3,1,2,Somewhat Disagree,Disagree,Strongly Agree,Somewhat Disagree,Agree,5,4,2,1,3,Disagree,Disagree,Disagree,Somewhat agree,Disagree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Agree,5,3,2,4,1,0,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,4,1,2,0,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Agree,1,3,5,4,2,4,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,Somewhat agree,1,2,3,5,4,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,1,4,2,5,1,Disagree,Disagree,Agree,Strongly Disagree,Strongly agree,4,2,3,1,5,1,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,1,5,4,3,2,FALSE,100,TRUE,100,FALSE,100,FALSE,52,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,31,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,2,3,-1,0,2,-1,1,-1,-2,3,-1,2,-2,-2,-2,1,-2,2,2,2,2,2,3,-1,-2,1,-1,1,0,1,-2,2,-1,2,0,-2,-1,-1,-1,-1,4,3,3,0,2,1,0,-1,0,1,0,1,1,-2,-2,2,-3,3,1,-2,-2,-1,-1,-2,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2304,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0.079657143,0.016457143,0.142857143,31,96.88,30,93.75,7,87.5,8,100,7,87.5,8,100,15,93.75,15,93.75,98.5,94,100,100,100,100,97,3.13,4.75,6.5,0,12.5,0,6.25,3.25,1,1,1,0,1,0,2,1,0,0,2,0,1,0,0,0,1,1,2,1,0,0,1,0,2,0,0,1,1,0,1,0,1,2,1,0,0,1,2,0,0.8,0.6,0.6,1,0.6,0.4,1,0.6,0.75,0.65,0.7,1,0.67,1.25,0.2,0.2,-0.4,0.4,0,3,-1,-1,3,0.33,0,2,2,-2,2,-2,2,-2,2,-2,2,0,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,66,"No, thank you.",1.5,1,1,0,0,0,1,0.67,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,2,4,3,5,6,9,8,1,7,4,2,3,1 +552,R_12AnLzAROw0zlWt,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,3,5,1,2,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Agree,4,3,2,1,5,Neither Agree nor Disagree,Somewhat Agree,Agree,Disagree,Agree,1,2,3,5,4,Agree,Agree,Agree,Agree,Strongly Agree,5,2,1,4,3,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,3,2,5,4,5,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,5,2,4,3,1,8,Somewhat Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,4,2,5,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,2,5,3,4,1,5,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Agree,5,4,3,2,1,5,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,3,5,4,1,2,5,Agree,Agree,Agree,Agree,Agree,3,5,4,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,FALSE,50,TRUE,80,TRUE,50,FALSE,50,FALSE,85,TRUE,87,TRUE,100,FALSE,50,TRUE,91,FALSE,50,TRUE,100,TRUE,74,FALSE,88,TRUE,77,TRUE,73,TRUE,71,TRUE,91,FALSE,50,TRUE,59,TRUE,78,FALSE,50,TRUE,50,FALSE,50,TRUE,87,TRUE,100,FALSE,50,FALSE,88,FALSE,50,TRUE,88,TRUE,50,TRUE,98,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,0,1,-2,2,0,2,0,1,2,-2,2,2,2,2,2,3,2,2,2,2,0,5,-1,1,-1,1,2,8,-1,1,2,0,1,5,2,2,2,2,2,5,2,2,1,2,0,5,1,-2,2,0,2,5,0,1,2,0,2,5,2,2,2,2,2,5,TRUE,0,50,FALSE,0,50,TRUE,0,80,TRUE,0,50,FALSE,0,50,FALSE,1,85,TRUE,1,87,TRUE,1,100,FALSE,0,50,TRUE,1,91,FALSE,1,50,TRUE,0,100,TRUE,1,74,FALSE,1,88,TRUE,1,77,TRUE,1,73,TRUE,0,71,TRUE,0,91,FALSE,1,50,TRUE,0,59,TRUE,1,78,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,87,TRUE,1,100,FALSE,1,50,FALSE,1,88,FALSE,1,50,TRUE,1,88,TRUE,1,50,TRUE,1,98,0,0,0.0729,0.0169,0.0004,0.0225,0.25,0.0081,0.3481,0.25,0.0144,0.0676,0.25,0.25,0.25,0.25,0.25,0.25,0.0144,0.7569,0.0484,0.0529,0.25,0.0144,0.5041,0.25,0.25,0.25,0.64,0.8281,0.25,1,0.270367857,0.175792857,0.364942857,16,50,18,56.25,5,62.5,5,62.5,4,50,4,50,11,68.75,7,43.75,70.78,53.38,69.5,80.5,79.75,72.88,68.69,-6.25,14.53,-9.12,7,30.5,29.75,4.13,24.94,0,0,0,0,0,2,3,3,1,0,1,0,0,2,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,1.8,0.8,0.2,0.2,0,0.4,0.2,0.7,0.2,0.45,6,5,5.375,-0.2,1.8,0.4,0,0.666666667,0,3,0,0,1,0,0,0,-1,1,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),30,,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,4,2,7,6,8,3,5,1,9,4,3,2,1 +553,R_55HIwZfhomcRWEx,53 - 59,,Canadian,Canadian,Female,Strongly agree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,2,4,3,5,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,4,2,1,5,3,Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,3,2,5,4,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,5,2,4,1,3,Strongly Agree,Disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,3,5,4,2,8,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,1,4,2,5,3,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,1,5,3,2,4,3,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,3,2,1,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,4,5,3,2,4,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,2,5,1,3,4,Strongly Agree,Agree,Somewhat Agree,Disagree,Agree,2,5,3,1,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,2,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,79,TRUE,95,FALSE,58,TRUE,92,FALSE,100,FALSE,50,TRUE,99,TRUE,96,TRUE,68,FALSE,58,TRUE,78,TRUE,95,TRUE,59,FALSE,57,TRUE,88,TRUE,87,FALSE,54,FALSE,96,FALSE,57,FALSE,87,TRUE,92,TRUE,82,TRUE,100,TRUE,97,FALSE,92,TRUE,90,FALSE,97,TRUE,96,TRUE,94,FALSE,54,TRUE,53,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,-2,3,0,3,-2,-1,0,-1,0,2,2,0,-1,1,1,1,2,1,2,3,-2,3,0,3,8,-1,-1,0,-1,-1,3,3,1,0,-1,1,3,0,1,-1,-1,0,7,3,-2,3,0,3,4,-1,-1,0,-1,-1,4,3,2,1,-2,2,3,1,1,1,1,1,3,TRUE,0,100,FALSE,0,79,TRUE,0,95,FALSE,1,58,TRUE,1,92,FALSE,1,100,FALSE,0,50,TRUE,1,99,TRUE,1,96,TRUE,1,68,FALSE,1,58,TRUE,0,78,TRUE,1,95,TRUE,0,59,FALSE,0,57,TRUE,1,88,TRUE,0,87,FALSE,1,54,FALSE,1,96,FALSE,1,57,FALSE,0,87,TRUE,1,92,TRUE,0,82,TRUE,1,100,TRUE,0,97,FALSE,0,92,TRUE,0,90,FALSE,1,97,TRUE,0,96,TRUE,1,94,FALSE,0,54,TRUE,1,53,0.0001,0.8464,0.0144,0.25,0.2209,0,0,0.1024,0.1849,0.0064,0.0036,0.0025,0.0016,0.1764,0.0064,0.6241,0.6724,0.1764,0.0009,0.9409,0.7569,0.3249,0.0016,0.3481,0.7569,0.81,0.2916,1,0.9025,0.2116,0.9216,0.6084,0.359067857,0.155571429,0.562564286,26,81.25,17,53.13,4,50,4,50,3,37.5,6,75,10,62.5,7,43.75,81.25,73.5,86.5,76.5,88.5,81,81.5,28.12,28.12,23.5,36.5,39,13.5,18.5,37.75,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,3,2,2,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,0.4,0.4,1.6,0,0.4,0.8,0.4,0.6,0.4,0.5,4.67,3.67,4.375,0,0,-0.4,1.2,-0.133333333,4,-1,0,4,1,0,1,1,-2,2,1,-1,-1,1,0,0,-1,10 cents,25 minutes,24 days,Female,University - Undergraduate,57,i would like to know how questions have good ansers '',0.375,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,8,5,4,6,9,2,3,1,7,4,2,3,1 +554,R_6HYbTSeN4jWBDWB,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Somewhat agree,2,5,1,4,3,Somewhat agree,Strongly disagree,Somewhat disagree,Disagree,Somewhat disagree,1,4,5,3,2,Neither Agree nor Disagree,Strongly Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,2,5,4,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Agree,4,1,2,5,3,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,2,1,3,4,5,2,Strongly agree,Strongly disagree,Somewhat disagree,Disagree,Neither agree nor disagree,4,2,3,5,1,2,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,2,3,4,1,5,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,1,5,3,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,4,1,5,2,1,Agree,Strongly disagree,Neither agree nor disagree,Disagree,Disagree,3,1,5,4,2,2,Neither Agree nor Disagree,Strongly Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,2,3,1,2,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Agree,4,5,1,3,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,86,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,64,TRUE,99,TRUE,75,FALSE,50,TRUE,77,TRUE,69,TRUE,78,TRUE,70,TRUE,71,FALSE,62,TRUE,100,FALSE,57,FALSE,93,FALSE,59,FALSE,100,FALSE,57,TRUE,86,FALSE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,50,FALSE,73,FALSE,50,TRUE,90,FALSE,50,TRUE,88,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,2,1,1,-3,-1,-2,-1,0,3,2,0,0,0,-1,-1,0,2,2,3,3,1,1,2,3,-3,-1,-2,0,2,0,3,3,1,1,2,0,0,1,0,2,2,2,3,3,3,1,1,2,-3,0,-2,-2,2,0,3,2,0,1,2,0,-1,-1,0,2,2,TRUE,0,86,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,64,TRUE,1,99,TRUE,1,75,FALSE,0,50,TRUE,1,77,TRUE,0,69,TRUE,0,78,TRUE,1,70,TRUE,0,71,FALSE,0,62,TRUE,1,100,FALSE,1,57,FALSE,1,93,FALSE,1,59,FALSE,1,100,FALSE,0,57,TRUE,1,86,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,73,FALSE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,88,0.0625,0,0,0.0001,0.0144,0.1296,0.25,0.0529,0,0.0196,0.01,0.09,0.25,0.4761,0.25,0.25,0,0.25,0.0729,0,0.3249,0.3844,0.1681,0.5041,0.1849,0.25,0.25,0.7396,1,0.0049,0.25,0.6084,0.242314286,0.1459,0.338728571,25,78.13,20,62.5,3,37.5,6,75,6,75,5,62.5,9,56.25,11,68.75,73.56,55,67,89,83.25,72.12,75,15.63,11.06,17.5,-8,14,20.75,15.87,6.25,1,0,0,1,0,2,0,0,0,1,0,0,1,1,1,0,1,2,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0.4,0.6,0.6,0.6,0.4,0.6,0.2,0,0.55,0.3,0.425,2,1.67,1.875,0,0,0.4,0.6,0.133333333,1,0,0,0,0.33,0,-2,-2,0,0,1,-1,1,-1,1,-1,-2,10 cents,100 minutes,24 days,Male,High School (or equivalent),51,no thanks,-1.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,7,8,2,3,6,4,9,1,5,4,2,3,1 +555,R_7rPxckCG4wznxO3,53 - 59,American,,American,Male,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Strongly agree,2,1,5,3,4,Strongly agree,Somewhat agree,Somewhat disagree,Strongly disagree,Disagree,3,2,1,4,5,Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,4,5,1,3,Disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,Strongly Agree,4,5,1,3,2,5,Strongly agree,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,5,3,1,4,2,4,Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,5,1,4,2,3,6,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,3,5,4,2,4,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,5,3,2,4,1,5,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Disagree,2,5,4,3,1,4,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,1,5,4,2,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,74,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,91,FALSE,100,TRUE,94,FALSE,100,TRUE,99,TRUE,64,FALSE,100,FALSE,99,FALSE,86,FALSE,99,TRUE,100,TRUE,93,FALSE,91,TRUE,83,FALSE,93,FALSE,100,TRUE,100,TRUE,94,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,97,TRUE,99,FALSE,100,31,0,-1,-1,0,3,3,1,-1,-3,-2,-2,-1,0,1,1,-1,1,0,2,0,-2,-1,-1,-3,3,5,3,-2,0,-3,1,4,-2,1,0,-1,0,6,-1,-2,1,1,0,4,-2,0,1,1,-1,4,0,-1,2,1,0,5,-1,0,-1,1,-2,4,-1,0,-1,2,-1,10,FALSE,1,100,TRUE,1,99,TRUE,0,97,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,FALSE,1,100,FALSE,1,93,TRUE,1,83,FALSE,1,91,TRUE,1,93,TRUE,1,100,FALSE,1,99,FALSE,1,86,FALSE,1,99,FALSE,1,100,TRUE,1,64,TRUE,1,99,FALSE,1,100,TRUE,1,94,FALSE,1,100,TRUE,1,91,FALSE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,74,0,0.0081,0,0,0.0676,0,0.0036,0,0,0.0001,0,0.0289,0.0036,0,0,0.0001,0,0.25,0.25,0,0.1296,0.0049,0.0001,0.0081,0.0001,0,0,0,0.9409,0.0196,1,0.0049,0.096860714,0.025278571,0.168442857,31,96.88,30,93.75,8,100,7,87.5,8,100,7,87.5,16,100,14,87.5,92.38,91.88,90,95.88,91.75,93.19,91.56,3.13,-1.37,-8.12,2.5,-4.12,4.25,-6.81,4.06,2,0,0,3,0,0,3,1,0,3,0,2,0,2,1,0,3,1,1,0,2,1,2,1,4,3,2,3,4,2,1,1,1,0,3,0,1,1,0,1,1,1.4,1,1,2,2.8,1.2,0.6,1.1,1.65,1.375,5,4.33,5.25,-1,-1.4,-0.2,0.4,-0.866666667,1,-1,2,-6,0.67,1,2,2,-1,1,-2,2,0,0,-2,2,1,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),57,Kind of repetitive,1.375,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,9,5,6,7,4,3,8,1,2,2,3,4,1 +556,R_77jW0e7TZUzEM31,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,1,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,1,2,3,4,Strongly Agree,Agree,Somewhat Agree,Disagree,Agree,2,4,1,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,1,5,1,Somewhat agree,Somewhat agree,Agree,Disagree,Agree,1,4,2,5,3,4,Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,5,4,3,2,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,5,2,1,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,5,3,1,2,5,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,1,4,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,52,TRUE,75,TRUE,54,FALSE,54,FALSE,54,TRUE,85,FALSE,100,TRUE,81,FALSE,92,TRUE,75,TRUE,96,FALSE,100,FALSE,54,TRUE,100,TRUE,55,TRUE,100,TRUE,60,TRUE,81,TRUE,75,TRUE,100,FALSE,56,TRUE,100,TRUE,57,TRUE,100,TRUE,82,FALSE,100,TRUE,55,TRUE,60,TRUE,100,TRUE,100,FALSE,100,14,3,3,3,3,3,0,1,0,1,1,3,2,1,-2,2,0,1,1,1,-2,3,3,3,3,3,5,1,1,2,-2,2,1,2,2,1,-1,3,4,0,0,0,0,0,4,3,3,3,3,3,4,1,0,0,0,1,4,3,3,0,-3,3,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,55,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,57,TRUE,1,100,FALSE,1,56,TRUE,0,100,TRUE,1,75,TRUE,0,81,TRUE,1,60,TRUE,1,100,TRUE,0,55,TRUE,0,100,FALSE,1,54,FALSE,1,100,TRUE,1,96,TRUE,1,75,FALSE,1,92,TRUE,1,81,FALSE,1,100,TRUE,1,85,FALSE,1,54,FALSE,1,54,TRUE,0,54,TRUE,1,75,FALSE,0,52,TRUE,1,100,0,0.0225,0,0.0324,0,0,0.0361,0,0,0.0625,0.0625,0.0625,0.1849,0.1936,0.2025,0,0.0064,0.36,0.2116,0,0.0016,0.16,0.2116,0.6561,0.3025,0.2116,0.2704,0,1,1,0.2916,1,0.231714286,0.083642857,0.379785714,14,43.75,24,75,6,75,6,75,6,75,6,75,15,93.75,9,56.25,79.78,61.62,78.38,90.38,88.75,80.81,78.75,-31.25,4.78,-13.38,3.38,15.38,13.75,-12.94,22.5,0,0,0,0,0,1,0,2,3,1,1,0,0,1,1,0,1,1,1,2,0,0,0,0,0,1,1,0,1,0,0,1,1,1,1,0,1,1,1,2,0,1.4,0.6,1,0,0.6,0.8,1,0.75,0.6,0.675,3.33,4.33,4,0,0.8,-0.2,0,0.2,1,-3,-1,-1,-1,1,2,1,-2,2,1,-1,-2,2,-2,2,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,,1.25,0,0,0,1,0,1,0,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,5,2,6,3,7,4,8,1,9,4,2,3,1 +557,R_17yp9IsUhb29vup,39 - 45,,Canadian,Canadian,Male,Somewhat disagree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,5,3,4,1,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Strongly agree,1,3,4,2,5,Neither Agree nor Disagree,Disagree,Strongly Agree,Agree,Strongly Agree,3,2,4,5,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,3,4,5,2,1,7,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,1,4,5,2,3,0,Neither Agree nor Disagree,Disagree,Strongly Agree,Agree,Strongly Agree,2,3,4,5,1,6,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly Agree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,3,5,2,4,1,5,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,1,2,3,5,0,Neither Agree nor Disagree,Disagree,Strongly agree,Agree,Strongly agree,3,4,5,2,1,8,Agree,Agree,Agree,Agree,Strongly Agree,4,1,2,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,50,TRUE,100,FALSE,50,FALSE,80,TRUE,50,TRUE,65,TRUE,60,FALSE,70,FALSE,50,TRUE,50,FALSE,70,TRUE,50,TRUE,50,FALSE,60,FALSE,60,TRUE,100,TRUE,55,TRUE,60,TRUE,90,FALSE,90,FALSE,75,TRUE,70,TRUE,50,TRUE,50,TRUE,80,FALSE,70,TRUE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,60,20,-1,3,3,1,3,1,0,2,1,3,0,-2,3,2,3,-1,0,-1,0,1,0,3,2,1,3,2,2,0,3,-1,3,7,0,-2,3,2,3,0,1,1,2,1,3,6,1,3,1,2,3,4,1,-1,3,-1,1,5,0,-2,3,2,3,0,2,2,2,2,3,8,TRUE,0,60,FALSE,0,50,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,70,TRUE,1,80,TRUE,1,50,TRUE,1,50,TRUE,1,70,FALSE,1,75,FALSE,1,90,TRUE,1,90,TRUE,0,60,TRUE,1,55,TRUE,1,100,FALSE,1,60,FALSE,1,60,TRUE,0,50,TRUE,0,50,FALSE,0,70,TRUE,1,50,FALSE,1,50,FALSE,0,70,TRUE,0,60,TRUE,1,65,TRUE,0,50,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,85,0.25,0.1225,0,0.04,0.0225,0.09,0.49,0.09,0.25,0.25,0,0.01,0.25,0.0625,0.25,0.25,0.25,0.25,0.04,0.36,0.49,0.2025,0.25,0.36,0.16,0.25,0.25,0.36,1,0.16,0.25,0.01,0.237767857,0.179642857,0.295892857,20,62.5,20,62.5,3,37.5,7,87.5,5,62.5,5,62.5,12,75,8,50,65.62,53.75,65.62,63.12,80,67.81,63.44,0,3.12,16.25,-21.88,0.62,17.5,-7.19,13.44,1,0,1,0,0,1,0,1,2,0,0,0,0,0,0,2,1,3,1,2,2,0,2,1,0,0,1,1,2,2,0,0,0,0,0,3,2,3,2,2,0.4,0.8,0,1.8,1,1.2,0,2.4,0.75,1.15,0.95,3,3,4,-0.6,-0.4,0,-0.6,-0.333333333,-2,2,0,-2,0,1,2,2,-2,2,2,-2,-1,1,-2,2,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,39,,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,4,2,6,9,5,7,8,1,3,3,2,4,1 +558,R_7M6xdAfF4VEibhK,53 - 59,American,,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,1,2,3,4,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,5,3,2,4,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,1,2,3,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,3,1,2,5,1,Somewhat agree,Disagree,Agree,Strongly disagree,Somewhat agree,1,5,3,2,4,1,Agree,Agree,Somewhat Agree,Somewhat Agree,Agree,4,5,1,2,3,4,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,3,5,2,4,3,Agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,4,2,3,5,1,1,Agree,Strongly agree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,3,1,5,1,Agree,Agree,Agree,Strongly Agree,Agree,1,4,2,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,50,TRUE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,92,TRUE,75,TRUE,50,TRUE,63,TRUE,95,FALSE,50,TRUE,61,TRUE,80,TRUE,60,TRUE,75,TRUE,50,TRUE,100,TRUE,100,TRUE,82,FALSE,77,FALSE,75,TRUE,50,TRUE,100,TRUE,86,FALSE,100,TRUE,60,FALSE,50,TRUE,100,TRUE,100,TRUE,93,20,1,3,3,-3,3,1,-1,2,-2,1,2,2,1,-1,2,1,1,1,1,1,3,3,3,-2,3,1,1,-2,2,-3,1,1,2,2,1,1,2,1,0,-1,-1,1,0,4,3,3,3,1,3,1,2,-3,3,-2,1,3,2,3,2,0,3,1,2,2,2,3,2,1,TRUE,0,93,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,86,TRUE,1,100,TRUE,1,50,FALSE,0,75,FALSE,1,77,TRUE,0,82,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,75,TRUE,0,60,TRUE,0,80,TRUE,0,61,FALSE,1,50,TRUE,1,95,TRUE,1,63,TRUE,0,50,TRUE,1,75,FALSE,1,92,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,96,0,0,0.0625,0.0196,0.0016,0,0.0625,0.5625,0.25,0.1369,0,0,0.25,0.0529,0.16,0,0.25,0.25,0,0.0064,0.0025,0.25,0.3721,1,0.36,0.25,0.25,0.8649,1,0.64,0.25,0.6724,0.281953571,0.141171429,0.422735714,20,62.5,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,77.19,61,76.38,86.12,85.25,79.69,74.69,-3.13,11.56,-14,13.88,36.12,10.25,-7.81,30.94,2,0,0,1,0,0,1,0,1,0,0,0,0,2,0,1,2,2,0,1,2,0,0,4,0,1,2,1,0,0,0,1,1,1,1,1,1,1,2,1,0.6,0.4,0.4,1.2,1.2,0.8,0.8,1.2,0.65,1,0.825,1,1.67,1.625,-0.6,-0.4,-0.4,0,-0.466666667,0,-2,0,3,-0.67,-1,1,1,-2,2,0,0,0,0,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,54,no comment,0.625,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,8,3,5,7,6,9,2,1,4,4,2,3,1 +559,R_11l5p9v4Gsca74d,46 - 52,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,4,3,5,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,1,3,2,5,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,1,3,4,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,2,1,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,5,2,7,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,3,2,5,4,1,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,1,4,3,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,2,3,5,1,6,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,5,4,2,1,FALSE,88,TRUE,63,FALSE,65,TRUE,57,FALSE,58,FALSE,60,FALSE,62,TRUE,71,FALSE,67,TRUE,71,FALSE,62,TRUE,64,TRUE,66,FALSE,58,TRUE,69,TRUE,72,TRUE,66,TRUE,71,FALSE,62,FALSE,75,FALSE,73,FALSE,76,TRUE,61,FALSE,67,FALSE,100,TRUE,82,TRUE,61,FALSE,100,TRUE,79,TRUE,84,FALSE,69,TRUE,83,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,0,1,1,0,1,-1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,6,0,1,1,1,0,7,0,-1,1,1,0,7,0,1,1,0,0,6,1,1,1,1,0,7,1,1,0,0,1,4,0,1,0,1,1,3,1,0,0,1,0,6,FALSE,1,88,TRUE,1,63,FALSE,1,65,TRUE,0,57,FALSE,0,58,FALSE,1,60,FALSE,0,62,TRUE,1,71,FALSE,0,67,TRUE,1,71,FALSE,1,62,TRUE,0,64,TRUE,1,66,FALSE,1,58,TRUE,1,69,TRUE,1,72,TRUE,0,66,TRUE,0,71,FALSE,1,62,FALSE,1,75,FALSE,0,73,FALSE,0,76,TRUE,0,61,FALSE,0,67,FALSE,1,100,TRUE,1,82,TRUE,0,61,FALSE,1,100,TRUE,0,79,TRUE,1,84,FALSE,0,69,TRUE,1,83,0.0841,0.0324,0.0784,0.3844,0.0289,0.16,0.4489,0.0841,0.0625,0.5776,0.0256,0.1156,0.4489,0.1444,0.3364,0.1369,0.3721,0.3249,0,0,0.5329,0.0961,0.1444,0.1764,0.4356,0.3721,0.4761,0.0144,0.1225,0.5041,0.6241,0.4096,0.256253571,0.233342857,0.279164286,16,50,18,56.25,4,50,3,37.5,5,62.5,6,75,9,56.25,9,56.25,70.69,63.75,68.25,76,74.75,70.81,70.56,-6.25,14.44,13.75,30.75,13.5,-0.25,14.56,14.31,1,3,3,1,0,1,1,0,2,0,0,2,1,0,1,0,1,0,0,1,1,2,2,1,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1.6,0.8,0.8,0.4,1.4,0.8,0,0.8,0.9,0.75,0.825,6.67,4.67,5.75,0.2,0,0.8,-0.4,0.333333333,-1,3,4,0,2,0,1,0,-1,1,1,-1,0,0,1,-1,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),47,It was an interesting survey,0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,2,9,3,4,8,6,5,1,7,4,2,3,1 +560,R_7kch5BE6iz8any9,53 - 59,American,,American,Female,Disagree,Agree,Strongly agree,Somewhat agree,Agree,3,5,2,4,1,Disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,2,4,5,1,3,Agree,Somewhat Agree,Agree,Disagree,Agree,4,3,5,1,2,Agree,Somewhat agree,Agree,Agree,Somewhat agree,5,3,4,2,1,Strongly disagree,Agree,Strongly Agree,Somewhat disagree,Somewhat agree,1,3,2,4,5,4,Disagree,Strongly disagree,Strongly agree,Somewhat disagree,Disagree,5,4,2,3,1,4,Agree,Somewhat Agree,Agree,Disagree,Agree,1,3,2,4,5,3,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,2,5,4,3,1,3,Disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,2,5,4,1,3,3,Strongly Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,4,5,2,1,3,3,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,3,1,4,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,65,TRUE,90,FALSE,60,FALSE,70,FALSE,56,TRUE,70,TRUE,85,FALSE,71,FALSE,76,FALSE,76,TRUE,84,FALSE,65,FALSE,61,TRUE,91,FALSE,61,TRUE,81,FALSE,61,FALSE,56,TRUE,74,TRUE,84,FALSE,58,TRUE,89,TRUE,76,TRUE,79,TRUE,85,FALSE,66,FALSE,61,FALSE,60,TRUE,92,TRUE,100,TRUE,82,17,-2,2,3,1,2,-2,-3,2,-1,-1,2,1,2,-2,2,2,1,2,2,1,-3,2,3,-1,1,4,-2,-3,3,-1,-2,4,2,1,2,-2,2,3,1,2,2,1,1,4,-1,2,3,1,1,3,-2,-3,2,-2,-1,3,3,1,2,-2,3,3,2,2,2,1,1,4,TRUE,0,82,TRUE,1,100,TRUE,0,92,FALSE,1,60,FALSE,0,61,FALSE,1,66,TRUE,1,85,TRUE,1,79,TRUE,1,76,TRUE,1,89,FALSE,1,58,TRUE,0,84,TRUE,1,74,FALSE,1,56,FALSE,0,61,TRUE,1,81,FALSE,1,61,TRUE,0,91,FALSE,1,61,FALSE,1,65,TRUE,1,84,FALSE,0,76,FALSE,1,76,FALSE,0,71,TRUE,0,85,TRUE,1,70,FALSE,1,56,FALSE,1,70,FALSE,1,60,TRUE,1,90,FALSE,0,65,TRUE,1,85,0.0441,0.09,0.0361,0.0225,0.0225,0.1156,0.5041,0.0121,0.1225,0.5776,0.01,0.0676,0.0576,0.1764,0.3721,0,0.0576,0.16,0.09,0.7225,0.0256,0.3721,0.1521,0.1936,0.1521,0.1936,0.4225,0.6724,0.8464,0.8281,0.16,0.7056,0.278296429,0.161121429,0.395471429,17,53.13,22,68.75,6,75,7,87.5,4,50,5,62.5,11,68.75,11,68.75,74.06,67.12,70.88,79.25,79,77.94,70.19,-15.62,5.31,-7.88,-16.62,29.25,16.5,9.19,1.44,1,0,0,2,1,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0.8,0.4,0,0.6,0.4,0.2,0.4,0.4,0.45,0.35,0.4,3.67,3,3.5,0.4,0.2,-0.4,0.2,0.066666667,1,1,0,0,0.67,1,1,1,-2,2,0,0,1,-1,-1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,53,This was an interesting survey,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,2,3,9,4,5,8,6,1,7,2,3,4,1 +561,R_3sXwUwOwBrTijxx,39 - 45,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Somewhat disagree,Agree,3,4,2,5,1,Disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,2,3,4,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,1,3,5,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Agree,Disagree,Agree,2,3,4,5,1,5,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,3,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Somewhat Agree,5,1,3,4,2,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Agree,Neither agree nor disagree,Agree,2,4,5,1,3,5,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,1,5,2,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Agree,2,5,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,59,TRUE,100,TRUE,76,TRUE,71,TRUE,60,TRUE,86,FALSE,81,TRUE,70,FALSE,76,TRUE,60,FALSE,60,FALSE,59,TRUE,57,FALSE,100,FALSE,56,FALSE,58,FALSE,53,FALSE,57,TRUE,61,FALSE,59,FALSE,57,TRUE,81,TRUE,59,TRUE,71,TRUE,71,FALSE,65,FALSE,54,FALSE,54,TRUE,61,TRUE,59,TRUE,66,16,3,2,2,-1,2,-2,-1,1,-2,0,1,0,1,-1,1,-1,0,1,0,0,3,2,2,-2,2,5,-2,-2,2,-2,0,5,0,0,1,-2,1,5,-1,-1,0,-1,0,5,3,2,2,0,2,5,-2,-2,2,-2,0,5,0,0,1,-2,2,5,0,0,0,0,0,5,TRUE,0,66,TRUE,1,59,TRUE,0,61,FALSE,1,54,FALSE,0,54,FALSE,1,65,TRUE,1,71,TRUE,1,71,TRUE,1,59,TRUE,1,81,FALSE,1,57,FALSE,1,59,TRUE,1,61,FALSE,1,57,FALSE,0,53,FALSE,0,58,FALSE,1,56,FALSE,1,100,TRUE,0,57,FALSE,1,59,FALSE,0,60,TRUE,1,60,FALSE,1,76,TRUE,1,70,FALSE,1,81,TRUE,1,86,TRUE,0,60,TRUE,0,71,TRUE,0,76,TRUE,1,100,TRUE,1,59,TRUE,1,100,0.0841,0.0196,0.3364,0.0841,0,0.1225,0.09,0.0361,0.1681,0.16,0,0.1521,0.1681,0.1849,0.2916,0.1681,0.0576,0.2116,0.5041,0.0361,0.36,0.2809,0.3249,0.1849,0.1936,0.36,0.1681,0.4356,0.3721,0,0.5776,0.1681,0.206310714,0.129335714,0.283285714,16,50,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,12,75,10,62.5,67.41,57.25,68.5,75.25,68.62,68.88,65.94,-18.75,-1.34,-5.25,6,-12.25,6.12,-6.12,3.44,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0.2,0.4,0.4,0.6,0.2,0.4,0.6,0.4,0.4,0.4,0.4,5,5,5,0,0,-0.2,0.2,-0.066666667,0,0,0,0,0,-1,1,0,-1,1,0,0,0,0,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,45,no feedback,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,5,9,2,3,8,6,7,1,4,4,2,3,1 +562,R_73CmFL4triVTvWN,53 - 59,American,,American,Female,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,3,5,4,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,4,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,2,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,1,5,8,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,5,2,3,4,1,3,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,3,4,1,2,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,4,1,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,5,3,1,2,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,Disagree,3,1,2,5,4,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,1,5,3,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,4,2,5,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,93,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,50,TRUE,91,TRUE,50,TRUE,50,TRUE,93,FALSE,83,TRUE,94,TRUE,96,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,98,FALSE,63,FALSE,50,TRUE,89,TRUE,73,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,76,TRUE,89,FALSE,58,FALSE,50,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,1,1,1,1,-1,-2,1,-2,-1,1,1,1,-1,1,0,0,1,1,1,1,1,1,1,1,8,-1,-2,1,-2,-1,3,1,1,0,-1,1,2,0,0,0,1,1,3,0,1,1,1,-1,2,0,-2,1,-1,-2,2,1,1,1,-1,1,2,0,0,0,0,1,2,TRUE,0,93,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,91,TRUE,1,50,TRUE,1,50,TRUE,1,93,FALSE,1,83,TRUE,0,94,TRUE,1,96,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,98,FALSE,1,63,FALSE,1,50,TRUE,1,89,TRUE,1,73,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,0,76,TRUE,1,89,FALSE,0,58,FALSE,0,50,0.25,0.25,0,0.0081,0.25,0.25,0.25,0.0049,0.25,0.0729,0.0121,0.0016,0.25,0.0289,0.25,0.25,0.25,0.25,0.25,0.25,0.0121,0.25,0.1369,0.25,0.25,0.25,0.3364,0.8649,1,0.9604,0.5776,0.8836,0.308653571,0.169314286,0.447992857,12,37.5,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,10,62.5,8,50,67.06,56.75,63.88,74.75,72.88,68.06,66.06,-18.75,10.81,-5.75,26.38,12.25,10.38,5.56,16.06,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0.2,0,0.2,0.2,0.4,0.6,0,0.4,0.15,0.35,0.25,4.33,2,3,-0.2,-0.6,0.2,-0.2,-0.2,6,1,0,1,2.33,1,1,1,-1,1,0,0,-1,1,-2,2,1,5 cents,5 minutes,24 days,Female,High School (or equivalent),56,no feedback,1,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,2,6,5,7,4,8,3,1,9,4,3,2,1 +563,R_7KJYqqIU2QGldUt,53 - 59,American,,American,Female,Agree,Agree,Somewhat agree,Disagree,Strongly agree,4,5,1,2,3,Disagree,Disagree,Agree,Strongly agree,Neither agree nor disagree,4,3,1,5,2,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,3,5,1,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,2,3,1,5,4,Somewhat disagree,Agree,Somewhat agree,Strongly disagree,Strongly Agree,3,2,4,1,5,1,Disagree,Somewhat disagree,Agree,Strongly agree,Neither agree nor disagree,4,2,1,3,5,0,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,5,4,1,2,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,1,3,5,2,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,2,5,4,1,3,8,Disagree,Somewhat disagree,Agree,Agree,Neither agree nor disagree,3,1,4,2,5,1,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,4,5,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,1,5,4,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,TRUE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,63,TRUE,80,TRUE,100,FALSE,50,TRUE,57,TRUE,50,TRUE,100,TRUE,71,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,56,FALSE,50,FALSE,50,TRUE,68,FALSE,50,FALSE,50,TRUE,57,FALSE,50,TRUE,70,FALSE,50,FALSE,50,TRUE,50,TRUE,62,FALSE,50,TRUE,100,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,1,-2,3,-2,-2,2,3,0,2,-3,3,-3,3,-1,1,1,1,-3,-1,2,1,-3,3,1,-2,-1,2,3,0,0,2,-3,3,-3,3,2,-1,-1,-1,-1,-3,4,1,2,1,1,3,8,-2,-1,2,2,0,1,2,-3,3,-3,3,0,0,0,0,-1,-3,5,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,63,TRUE,1,80,TRUE,1,100,FALSE,0,50,TRUE,1,57,TRUE,0,50,TRUE,0,100,TRUE,1,71,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,56,FALSE,1,50,FALSE,1,50,TRUE,1,68,FALSE,0,50,FALSE,1,50,TRUE,1,57,FALSE,1,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,62,FALSE,0,50,TRUE,1,100,0,0.09,0,0.04,0,0.3969,0.1849,0.1849,0.25,0.25,0.1444,0.0841,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.1024,0.25,0.25,1,0.25,0.25,0.25,0.25,0,0.1936,0.25,1,0.251471429,0.178228571,0.324714286,15,46.88,23,71.88,5,62.5,5,62.5,6,75,7,87.5,13,81.25,10,62.5,66.69,56.25,69,64.12,77.38,72.81,60.56,-25,-5.19,-6.25,6.5,-10.88,-10.12,-8.44,-1.94,3,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,2,2,0,1,0,0,3,0,0,1,0,1,0,0,0,0,0,0,1,1,1,2,0,0.8,0.2,0,1.2,0.8,0.4,0,1,0.55,0.55,0.55,1,3,2.625,0,-0.2,0,0.2,-0.066666667,-7,-1,2,-1,-2,1,2,1,-2,2,1,-1,-2,2,-2,2,1,10 cents,100 minutes,24 days,Female,University - PhD,54,,1.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,3,8,4,2,9,7,6,1,5,4,2,3,1 +564,R_5DuA1HvIy5gY2vK,32 - 38,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,1,2,3,4,Neither Agree nor Disagree,Somewhat Disagree,Agree,Disagree,Somewhat Agree,2,5,1,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,5,4,6,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,5,4,1,3,5,Neither Agree nor Disagree,Somewhat Disagree,Agree,Disagree,Agree,2,4,1,3,5,5,Somewhat disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,5,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,5,2,1,3,5,Neither Agree nor Disagree,Somewhat Disagree,Agree,Disagree,Somewhat Agree,5,1,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,5,2,4,1,TRUE,76,TRUE,85,TRUE,97,FALSE,51,TRUE,64,FALSE,83,FALSE,53,TRUE,62,TRUE,71,TRUE,81,FALSE,50,TRUE,57,FALSE,51,FALSE,61,FALSE,50,TRUE,68,FALSE,50,TRUE,72,TRUE,54,FALSE,50,TRUE,82,TRUE,64,FALSE,67,TRUE,56,FALSE,84,TRUE,54,TRUE,50,FALSE,61,TRUE,50,FALSE,65,FALSE,52,TRUE,52,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,0,0,-3,-1,0,1,0,0,-1,2,-2,1,0,0,0,0,0,2,2,2,0,0,6,-3,0,0,2,0,6,0,-1,2,-2,2,5,-1,-1,-2,0,-2,5,1,1,1,0,0,6,-2,0,0,1,1,5,0,-1,2,-2,1,5,0,0,0,0,-1,5,TRUE,0,76,TRUE,1,85,TRUE,0,97,FALSE,1,51,TRUE,1,64,FALSE,1,83,FALSE,0,53,TRUE,1,62,TRUE,1,71,TRUE,1,81,FALSE,1,50,TRUE,0,57,FALSE,0,51,FALSE,1,61,FALSE,0,50,TRUE,1,68,FALSE,1,50,TRUE,0,72,TRUE,0,54,FALSE,1,50,TRUE,1,82,TRUE,1,64,FALSE,1,67,TRUE,1,56,FALSE,1,84,TRUE,1,54,TRUE,0,50,FALSE,1,61,TRUE,0,50,FALSE,0,65,FALSE,0,52,TRUE,1,52,0.1444,0.2116,0.1024,0.2809,0.2304,0.0289,0.1936,0.0361,0.25,0.1296,0.4225,0.2601,0.0841,0.25,0.1296,0.0225,0.1089,0.2401,0.1521,0.0256,0.0324,0.25,0.2916,0.1521,0.25,0.25,0.2704,0.5776,0.9409,0.5184,0.25,0.3249,0.2383,0.170457143,0.306142857,17,53.13,20,62.5,4,50,6,75,5,62.5,5,62.5,11,68.75,9,56.25,63.22,57.88,62.38,68.12,64.5,63.12,63.31,-9.37,0.72,7.88,-12.62,5.62,2,-5.63,7.06,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,2,0,2,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0.6,0.4,0.2,1.2,0,0.6,0,0.2,0.6,0.2,0.4,5.67,5.33,5.375,0.6,-0.2,0.2,1,0.2,0,1,0,0,0.34,0,1,1,-1,1,0,0,0,0,0,0,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,34,,0.5,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,5,3,8,9,2,6,7,1,4,3,4,2,1 +565,R_1rTcNI0ME0EkqHe,53 - 59,American,,American,Female,Agree,Agree,Strongly agree,Disagree,Somewhat agree,2,4,3,1,5,Somewhat disagree,Somewhat disagree,Agree,Disagree,Disagree,5,2,1,3,4,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,5,4,1,3,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Strongly Agree,Somewhat disagree,Agree,3,4,2,1,5,1,Disagree,Disagree,Agree,Somewhat disagree,Disagree,4,3,1,2,5,1,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,3,2,5,4,1,1,Agree,Agree,Agree,Agree,Agree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,4,3,5,1,2,1,Disagree,Disagree,Agree,Disagree,Disagree,2,4,5,1,3,1,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,4,5,3,1,0,Agree,Agree,Agree,Agree,Agree,2,3,5,4,1,FALSE,51,FALSE,50,FALSE,51,FALSE,50,FALSE,52,FALSE,89,TRUE,81,TRUE,89,FALSE,53,FALSE,50,FALSE,84,FALSE,51,TRUE,74,TRUE,75,FALSE,53,TRUE,77,FALSE,54,TRUE,84,TRUE,63,FALSE,83,TRUE,63,FALSE,58,FALSE,96,TRUE,82,FALSE,90,TRUE,87,TRUE,69,FALSE,89,TRUE,67,TRUE,78,FALSE,68,TRUE,67,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,-2,1,-1,-1,2,-2,-2,1,2,1,0,1,2,2,2,2,2,2,2,3,-1,2,1,-2,-2,2,-1,-2,1,1,2,-1,-1,1,1,2,2,2,2,2,1,2,2,3,1,1,1,-2,-2,2,-2,-2,1,1,2,1,0,2,1,2,2,2,2,2,0,FALSE,1,51,FALSE,0,50,FALSE,1,51,FALSE,1,50,FALSE,0,52,FALSE,1,89,TRUE,1,81,TRUE,1,89,FALSE,0,53,FALSE,0,50,FALSE,1,84,FALSE,1,51,TRUE,1,74,TRUE,0,75,FALSE,0,53,TRUE,1,77,FALSE,1,54,TRUE,0,84,TRUE,0,63,FALSE,1,83,TRUE,1,63,FALSE,0,58,FALSE,1,96,TRUE,1,82,FALSE,1,90,TRUE,1,87,TRUE,0,69,FALSE,1,89,TRUE,0,67,TRUE,1,78,FALSE,0,68,TRUE,1,67,0.0121,0.0169,0.0529,0.0361,0.1089,0.0121,0.0324,0.25,0.0289,0.3364,0.0484,0.0676,0.2809,0.0256,0.2704,0.25,0.0016,0.25,0.0121,0.01,0.1369,0.2809,0.3969,0.5625,0.2116,0.4761,0.4624,0.2401,0.2401,0.7056,0.4489,0.2401,0.228121429,0.140228571,0.316014286,16,50,20,62.5,2,25,6,75,4,50,8,100,9,56.25,11,68.75,69.62,61.25,70.25,72,75,67.62,71.62,-12.5,7.12,36.25,-4.75,22,-25,11.37,2.87,0,0,0,1,1,1,1,0,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0.4,0.6,0.6,0,0.6,0.4,0.2,0,0.4,0.3,0.35,1,1,0.875,-0.2,0.2,0.4,0,0.133333333,0,0,0,1,0,1,1,1,-1,1,1,-1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,57,,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,2,6,5,8,7,9,4,1,3,2,3,4,1 +566,R_6afONHtpQoqqCjf,53 - 59,American,,American,Female,Somewhat disagree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,1,3,2,Strongly disagree,Disagree,Agree,Disagree,Somewhat agree,5,2,4,1,3,Agree,Somewhat Agree,Agree,Disagree,Agree,4,3,2,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat disagree,Agree,Agree,Strongly disagree,Somewhat agree,3,4,2,1,5,5,Strongly disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,5,3,4,2,4,Agree,Agree,Agree,Somewhat Agree,Agree,1,5,2,3,4,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Agree,Agree,Somewhat disagree,Agree,1,4,5,2,3,4,Strongly disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,3,4,1,2,4,Agree,Agree,Agree,Somewhat Disagree,Agree,5,2,3,4,1,6,Somewhat agree,Somewhat agree,Agree,Agree,Agree,5,2,4,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,59,TRUE,71,TRUE,80,TRUE,50,TRUE,50,TRUE,76,FALSE,100,TRUE,100,FALSE,50,TRUE,71,FALSE,64,FALSE,100,FALSE,50,TRUE,64,FALSE,50,TRUE,75,FALSE,50,TRUE,59,TRUE,82,TRUE,64,FALSE,66,TRUE,63,FALSE,50,TRUE,94,TRUE,76,FALSE,100,TRUE,60,TRUE,50,FALSE,88,TRUE,70,FALSE,50,16,-1,2,2,1,1,-3,-2,2,-2,1,2,1,2,-2,2,0,1,1,1,-1,-1,2,2,-3,1,6,-3,-2,1,-1,1,5,2,2,2,1,2,4,-1,-1,-1,-1,-1,5,-1,2,2,-1,2,7,-3,-2,2,-2,0,4,2,2,2,-1,2,4,1,1,2,2,2,6,FALSE,1,50,TRUE,1,70,FALSE,1,88,TRUE,0,50,TRUE,1,60,FALSE,1,100,TRUE,1,76,TRUE,1,94,FALSE,0,50,TRUE,1,63,FALSE,1,66,TRUE,0,64,TRUE,1,82,TRUE,0,59,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,64,FALSE,1,50,FALSE,1,100,FALSE,0,64,TRUE,1,71,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,50,TRUE,0,50,TRUE,0,80,TRUE,1,71,FALSE,0,59,TRUE,1,100,0.0036,0.0576,0.0625,0.0576,0,0,0,0.1369,0,0.0841,0.0841,0.0324,0.25,0.1156,0.16,0.09,0.25,0.25,0.25,0,0.4096,0.25,0.25,0.3481,0.25,0.25,0.3481,0.25,0.0144,0.4096,0.64,0.4096,0.197589286,0.103792857,0.291385714,16,50,21,65.63,3,37.5,6,75,6,75,6,75,12,75,9,56.25,69.75,55.62,73.25,69.88,80.25,72.56,66.94,-15.63,4.12,18.12,-1.75,-5.12,5.25,-2.44,10.69,0,0,0,4,0,0,0,1,1,0,0,1,0,3,0,1,2,2,2,0,0,0,0,2,1,0,0,0,0,1,0,1,0,1,0,1,0,1,1,3,0.8,0.4,0.8,1.4,0.6,0.2,0.4,1.2,0.85,0.6,0.725,5,5,5.125,0.2,0.2,0.4,0.2,0.266666667,-1,1,0,-1,0,0,1,1,-2,2,0,0,0,0,-1,1,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),55,This survey was interesting.,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,9,7,3,8,4,2,5,1,6,4,2,3,1 +567,R_3LYIwChxV19BDIp,53 - 59,,Canadian,Canadian,Female,Strongly agree,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,4,2,5,1,3,Disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,1,2,4,5,3,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,1,5,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly Agree,Agree,1,4,2,5,3,Strongly Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,2,4,5,1,3,2,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,2,3,5,4,3,Agree,Agree,Agree,Disagree,Agree,2,4,5,3,1,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,3,5,1,4,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Strongly Agree,Somewhat disagree,4,3,2,5,1,6,Disagree,Disagree,Agree,Disagree,Somewhat disagree,1,3,5,4,2,2,Agree,Somewhat Agree,Agree,Disagree,Agree,5,1,3,4,2,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Agree,1,5,2,4,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,88,TRUE,100,FALSE,50,TRUE,50,FALSE,65,TRUE,87,TRUE,100,TRUE,84,TRUE,82,TRUE,52,TRUE,76,TRUE,77,FALSE,86,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,75,FALSE,50,FALSE,50,TRUE,85,FALSE,84,TRUE,92,FALSE,100,TRUE,88,TRUE,77,FALSE,56,TRUE,88,TRUE,100,TRUE,88,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,3,0,-2,-2,1,-2,-1,2,1,2,-3,2,0,0,2,3,2,3,2,1,2,0,2,-2,-2,2,-2,0,3,2,2,2,-2,2,2,0,1,1,2,2,3,3,2,1,3,-1,6,-2,-2,2,-2,-1,2,2,1,2,-2,2,0,0,0,1,3,2,3,FALSE,1,100,TRUE,1,88,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,65,TRUE,1,87,TRUE,1,100,TRUE,1,84,TRUE,1,82,TRUE,0,52,TRUE,0,76,TRUE,1,77,FALSE,1,86,FALSE,0,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,75,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,84,TRUE,1,92,FALSE,1,100,TRUE,1,88,TRUE,0,77,FALSE,1,56,TRUE,0,88,TRUE,1,100,TRUE,1,88,TRUE,1,100,0,0.0144,0,0.0169,0,0.1225,0.0064,0.0324,0.25,0.0225,0,0.0529,0.0256,0.2704,0.25,0.0144,0.0256,0.25,0.1936,0,0.25,0.25,0.5625,0.0196,0.25,0.5929,0.0144,0,1,1,0.7744,0.5776,0.243132143,0.094478571,0.391785714,24,75,22,68.75,4,50,5,62.5,7,87.5,6,75,14,87.5,8,50,79.06,70.5,70.5,91,84.25,82.56,75.56,6.25,10.31,20.5,8,3.5,9.25,-4.94,25.56,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0.2,0.4,0.4,0.6,0.2,0.2,0.2,0.2,0.4,0.2,0.3,2.33,2.67,2.625,0,0.2,0.2,0.4,0.133333333,-4,1,2,0,-0.34,0,1,1,-1,1,0,0,0,0,0,0,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,There seems to be some strange questions.,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,2,9,4,8,5,7,6,1,3,2,4,3,1 +568,R_3tth360TgaYpm1b,32 - 38,American,,American,Female,Strongly disagree,Agree,Agree,Somewhat disagree,Agree,2,5,3,1,4,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,5,1,3,4,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,4,2,3,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,1,5,2,4,Disagree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,5,3,2,1,5,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,4,5,2,1,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,2,5,1,3,4,4,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,2,5,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Agree,Agree,Neither agree nor disagree,Agree,2,5,3,1,4,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,3,5,1,7,Somewhat Agree,Agree,Agree,Agree,Agree,1,5,2,3,4,7,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,3,5,2,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,55,TRUE,100,FALSE,66,TRUE,65,FALSE,100,TRUE,100,TRUE,85,FALSE,56,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,75,TRUE,79,TRUE,100,TRUE,82,FALSE,100,TRUE,81,FALSE,74,FALSE,78,TRUE,90,TRUE,100,TRUE,100,FALSE,100,TRUE,87,TRUE,80,TRUE,85,TRUE,65,TRUE,81,TRUE,63,TRUE,99,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,2,2,-1,2,0,-1,2,1,0,0,1,1,2,1,1,1,1,2,1,-2,2,2,0,1,5,1,0,2,1,-1,6,1,1,1,1,0,4,-1,0,0,1,-1,5,-2,2,2,0,2,4,1,0,1,-1,1,7,1,2,2,2,2,7,2,2,2,2,0,7,TRUE,0,100,TRUE,1,55,TRUE,0,100,FALSE,1,66,TRUE,1,65,FALSE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,56,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,79,TRUE,1,100,TRUE,0,82,FALSE,1,100,TRUE,0,81,FALSE,1,74,FALSE,0,78,TRUE,1,90,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,TRUE,0,80,TRUE,0,85,TRUE,0,65,TRUE,1,81,TRUE,1,63,TRUE,1,99,0.0225,0.0169,0,0,0.0001,0,0,0,0.0676,0.01,0.0361,0,0.3136,0,0.1225,0.2025,1,0.1156,0.7225,0,0.6084,0.0441,0.6561,0.0625,0.6724,0.64,0.1369,1,1,0,0.4225,1,0.315478571,0.133428571,0.497528571,21,65.63,21,65.63,5,62.5,4,50,7,87.5,5,62.5,14,87.5,7,43.75,85.81,72.5,86.12,94,90.62,83.62,88,0,20.18,10,36.12,6.5,28.12,-3.88,44.25,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,2,1,1,1,2,1,0,0,1,0,1,1,1,2,1,1,1,1,0,1,1,1,1,0,1,0.6,0.6,0.6,1.4,0.4,1.2,0.8,0.8,0.8,0.8,0.8,5,6,5.625,0.2,-0.6,-0.2,0.6,-0.2,1,-1,-3,-2,-1,1,1,1,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),34,,1.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,2,3,8,5,4,9,6,1,7,4,3,2,1 +569,R_7i3mDGkJaiIUWAN,39 - 45,,Canadian,Canadian,Female,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,2,4,1,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,5,2,4,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,1,3,2,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,4,1,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,4,2,1,4,Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,1,2,5,1,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,5,4,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Somewhat agree,Agree,3,1,2,4,5,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,3,2,5,1,4,Strongly Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,4,2,3,1,5,2,Somewhat agree,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat disagree,5,4,1,3,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,70,TRUE,51,TRUE,100,TRUE,55,TRUE,55,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,62,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,89,TRUE,67,TRUE,100,TRUE,81,FALSE,66,TRUE,59,TRUE,71,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,58,FALSE,100,FALSE,61,TRUE,91,FALSE,58,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,-1,1,0,1,-1,-1,1,1,1,1,1,1,1,1,-1,1,4,-2,1,1,1,1,1,-1,2,-1,-1,-1,6,1,2,2,1,2,4,0,0,1,0,1,4,-3,1,3,1,2,2,1,1,3,1,-1,2,FALSE,1,70,TRUE,1,51,TRUE,0,100,TRUE,0,55,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,62,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,89,TRUE,0,67,TRUE,0,100,TRUE,0,81,FALSE,1,66,TRUE,1,59,TRUE,1,71,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,58,FALSE,1,100,FALSE,1,61,TRUE,1,91,FALSE,0,58,TRUE,1,100,0,0,0.0121,0,0,0,0,0,0.1156,0.0841,0.0081,0,1,0.3844,0.2025,0.2401,1,0.3025,0,0,0.1681,0,0.6561,0,0.4489,0.1764,0.3364,0.09,1,1,0.1521,1,0.298760714,0.238378571,0.359142857,22,68.75,22,68.75,3,37.5,6,75,7,87.5,6,75,14,87.5,8,50,84.19,70.62,80.25,92.62,93.25,85.88,82.5,0,15.44,33.12,5.25,5.12,18.25,-1.62,32.5,0,0,0,0,0,2,0,0,2,0,1,0,0,0,0,0,1,1,2,0,2,1,1,0,1,1,1,0,1,0,2,0,2,0,1,2,0,3,0,0,0,0.8,0.2,0.8,1,0.6,1,1,0.45,0.9,0.675,2,3.33,3,-1,0.2,-0.8,-0.2,-0.533333333,-3,0,-1,4,-1.33,2,1,1,-1,1,1,-1,0,0,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,41,,0.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,4,8,9,2,7,6,3,1,5,3,4,2,1 +570,R_6O1tML60LtMQHqe,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,5,3,1,2,4,Neither agree nor disagree,Somewhat disagree,Agree,Agree,Strongly agree,1,3,2,5,4,Neither Agree nor Disagree,Disagree,Agree,Somewhat Agree,Strongly Agree,5,3,4,1,2,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,3,4,1,Agree,Agree,Agree,Strongly Agree,Agree,3,1,5,2,4,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,5,2,4,1,3,7,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,1,4,3,5,2,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,4,5,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly Agree,Agree,2,1,3,5,4,7,Agree,Disagree,Agree,Neither agree nor disagree,Agree,5,4,3,1,2,6,Somewhat Agree,Disagree,Agree,Agree,Strongly Agree,3,4,2,1,5,5,Agree,Agree,Agree,Agree,Agree,4,1,2,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,75,TRUE,54,FALSE,100,FALSE,61,TRUE,75,FALSE,94,TRUE,95,TRUE,76,FALSE,60,TRUE,59,FALSE,56,TRUE,100,TRUE,75,FALSE,90,TRUE,72,TRUE,97,TRUE,83,TRUE,100,TRUE,88,FALSE,56,FALSE,92,TRUE,86,FALSE,91,TRUE,100,FALSE,96,TRUE,94,TRUE,88,FALSE,70,FALSE,82,FALSE,100,FALSE,50,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,0,-1,2,2,3,0,-2,2,1,3,0,1,0,0,0,2,2,2,3,2,6,1,0,1,0,2,7,1,-1,1,2,1,6,1,1,0,1,0,6,3,2,2,3,2,7,2,-2,2,0,2,6,1,-2,2,2,3,5,2,2,2,2,2,8,TRUE,0,75,TRUE,1,54,FALSE,1,100,FALSE,1,61,TRUE,1,75,FALSE,1,94,TRUE,1,95,TRUE,1,76,FALSE,0,60,TRUE,1,59,FALSE,1,56,TRUE,0,100,TRUE,1,75,FALSE,1,90,TRUE,1,72,TRUE,1,97,TRUE,0,83,TRUE,0,100,TRUE,0,88,FALSE,1,56,FALSE,0,92,TRUE,1,86,FALSE,1,91,TRUE,1,100,FALSE,1,96,TRUE,1,94,TRUE,0,88,FALSE,1,70,FALSE,1,82,FALSE,0,100,FALSE,0,50,TRUE,1,100,0.0576,0.0036,0.0009,0.0025,0,0.0036,0,0.1681,0.1936,0.0196,1,0.0625,0.36,0.1936,0.0625,0.2116,0.0081,0.1521,0.09,0.0016,0.8464,0.0784,0.7744,0.01,0.6889,0.7744,0.25,0.5625,0,1,0.0324,1,0.305153571,0.17395,0.436357143,20,62.5,22,68.75,4,50,6,75,6,75,6,75,12,75,10,62.5,81.72,66.12,86.5,86.88,87.38,80.31,83.12,-6.25,12.97,16.12,11.5,11.88,12.38,5.31,20.62,0,0,0,1,0,1,1,1,2,1,1,1,1,1,2,1,0,0,1,0,1,0,0,1,0,2,1,0,2,1,1,0,0,1,0,2,1,2,2,2,0.2,1.2,1.2,0.4,0.4,1.2,0.4,1.8,0.75,0.95,0.85,6.33,6,6.375,-0.2,0,0.8,-1.4,0.2,-1,1,1,-2,0.33,1,2,2,-2,2,1,-1,0,0,-2,2,2,10 cents,5 minutes,47 days,Female,University - Undergraduate,25,,1.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,7,3,8,2,5,4,9,1,6,2,3,4,1 +571,R_7jWcITvDBLPvHQR,32 - 38,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,3,2,5,4,1,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,1,5,4,2,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,2,5,1,Strongly disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,5,1,4,2,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,4,3,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,3,4,4,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,2,1,4,3,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,4,2,3,5,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Strongly agree,4,5,3,1,2,8,Strongly Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,1,4,3,2,5,Agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,4,2,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,FALSE,76,TRUE,50,TRUE,50,TRUE,50,TRUE,73,FALSE,100,TRUE,50,FALSE,54,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,8,3,1,3,0,2,-3,-1,0,0,2,3,0,1,0,0,-3,-1,-1,-1,-3,-3,0,0,0,0,5,-3,0,0,0,0,5,3,0,3,3,3,4,-1,0,0,-3,-3,2,3,0,3,0,3,5,-1,0,0,-3,3,8,3,-1,2,0,3,5,2,0,3,0,3,5,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,54,TRUE,1,50,FALSE,1,100,TRUE,1,73,TRUE,0,50,TRUE,0,50,TRUE,0,50,FALSE,0,76,TRUE,1,50,TRUE,1,100,0.25,0.0729,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.25,0.25,0.25,0.25,0.2116,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,1,1,0.25,1,0.3139,0.2528,0.375,8,25,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,62.59,50,56.75,77.88,65.75,59.31,65.88,-34.38,3.21,-12.5,6.75,2.88,15.75,-15.69,22.13,6,1,3,0,2,0,1,0,0,2,0,0,2,3,3,2,1,1,2,0,0,1,0,0,1,2,1,0,3,1,0,1,1,0,3,5,1,4,1,6,2.4,0.6,1.6,1.2,0.4,1.4,1,3.4,1.45,1.55,1.5,4.67,6,4.875,2,-0.8,0.6,-2.2,0.6,0,-3,-1,-3,-1.33,0,0,0,1,-1,0,0,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,33,,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,4,3,9,6,5,7,2,1,8,4,2,3,1 +572,R_3du9twEcINOyPCq,32 - 38,American,,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,5,2,4,1,3,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,1,3,2,4,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,5,2,3,4,Strongly disagree,Disagree,Somewhat disagree,Strongly disagree,Strongly disagree,3,1,5,2,4,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,1,5,4,2,5,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,2,1,4,3,5,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,1,3,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,1,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,3,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,4,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,5,1,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,100,TRUE,65,TRUE,100,TRUE,50,TRUE,60,TRUE,54,TRUE,54,FALSE,56,TRUE,53,TRUE,62,FALSE,95,TRUE,56,TRUE,100,TRUE,87,FALSE,54,TRUE,72,TRUE,77,TRUE,61,TRUE,100,FALSE,62,TRUE,100,TRUE,58,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,17,1,3,3,3,-3,2,2,0,0,2,2,2,3,1,3,-3,-2,-1,-3,-3,3,2,3,3,0,5,3,2,2,0,2,7,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,58,TRUE,1,100,FALSE,1,62,TRUE,0,100,TRUE,1,61,TRUE,0,77,TRUE,1,72,FALSE,0,54,TRUE,0,87,TRUE,0,100,TRUE,0,56,FALSE,1,95,TRUE,1,62,TRUE,1,53,FALSE,1,56,TRUE,1,54,TRUE,0,54,TRUE,1,60,TRUE,0,50,TRUE,0,100,TRUE,0,65,TRUE,1,100,TRUE,1,75,TRUE,1,100,0,0.16,0.2916,0,0,0,0.2116,0,0.0025,0.2209,0,0.1521,0.1764,0.1444,0,0,0.1936,0,1,0.2916,0.1444,0.0784,0.3136,0.5929,0.7569,0.25,0.0625,0,1,1,0.4225,1,0.286225,0.078678571,0.493771429,17,53.13,21,65.63,6,75,6,75,5,62.5,4,50,15,93.75,6,37.5,79.72,71.62,78.88,80.5,87.88,78.06,81.38,-12.5,14.09,-3.38,3.88,18,37.88,-15.69,43.88,2,1,0,0,3,1,0,2,0,0,1,1,0,2,0,6,5,4,6,6,2,0,0,0,6,1,1,3,3,1,1,1,0,2,0,6,5,4,6,6,1.2,0.6,0.8,5.4,1.6,1.8,0.8,5.4,2,2.4,2.2,7.33,10,9,-0.4,-1.2,0,0,-0.533333333,-5,-3,0,0,-2.67,2,1,1,-2,2,0,0,2,-2,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),36,No comments ,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,7,5,9,8,3,6,4,1,2,3,2,4,1 +573,R_5Gompk2q3VXsckp,25 - 31,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Strongly agree,Agree,Strongly agree,3,2,4,5,1,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,3,4,5,2,1,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,3,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Strongly Agree,Agree,Strongly Agree,2,5,1,4,3,9,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,3,2,4,5,1,9,Agree,Agree,Agree,Strongly Agree,Agree,4,3,1,2,5,8,Agree,Agree,Agree,Agree,Agree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Somewhat agree,Strongly Agree,Agree,Strongly Agree,3,1,2,5,4,8,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,5,3,1,2,8,Strongly agree,Strongly agree,Agree,Agree,Agree,2,1,3,4,5,7,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,4,2,5,3,TRUE,80,TRUE,75,FALSE,75,FALSE,70,TRUE,75,TRUE,90,TRUE,100,TRUE,90,TRUE,80,TRUE,100,TRUE,80,TRUE,100,TRUE,80,FALSE,60,TRUE,80,TRUE,100,TRUE,80,TRUE,90,FALSE,80,TRUE,90,TRUE,90,TRUE,90,FALSE,75,TRUE,85,FALSE,80,FALSE,75,TRUE,85,TRUE,80,TRUE,85,TRUE,85,TRUE,85,FALSE,80,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,3,2,3,2,-1,1,1,2,2,3,3,1,3,1,1,1,1,-1,2,2,3,2,3,9,2,2,2,0,3,9,2,2,2,3,2,9,2,2,2,2,2,8,1,1,3,2,3,8,2,0,2,0,2,8,3,3,2,2,2,8,1,2,2,2,1,7,TRUE,0,80,TRUE,1,75,FALSE,1,75,FALSE,1,70,TRUE,1,75,TRUE,0,90,TRUE,1,100,TRUE,1,90,TRUE,1,80,TRUE,1,100,TRUE,0,80,TRUE,0,100,TRUE,1,80,FALSE,1,60,TRUE,1,80,TRUE,1,100,TRUE,0,80,TRUE,0,90,FALSE,1,80,TRUE,0,90,TRUE,1,90,TRUE,1,90,FALSE,1,75,TRUE,1,85,FALSE,1,80,FALSE,0,75,TRUE,0,85,TRUE,0,80,TRUE,0,85,TRUE,1,85,TRUE,1,85,FALSE,0,80,0.01,0.5625,0,0,0.64,0.81,0.0225,0,0.81,0.01,0.0225,0.04,0.04,0.64,0.0625,0.0625,0.0625,0.09,0.64,0.04,0.01,0.04,0.04,0.16,0.64,0.7225,0.0225,0.64,0.0625,0.81,0.7225,1,0.316517857,0.236607143,0.396428571,25,78.13,20,62.5,6,75,4,50,5,62.5,5,62.5,14,87.5,6,37.5,83.44,79.38,81.88,84.38,88.12,85.62,81.25,15.63,20.94,4.38,31.88,21.88,25.62,-1.88,43.75,1,1,0,0,0,0,3,1,1,1,0,1,1,2,1,1,1,1,1,3,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1,0,1,1,1,2,0.4,1.2,1,1.4,0,0.6,0.8,1,1,0.6,0.8,9,8,8.25,0.4,0.6,0.2,0.4,0.4,1,1,1,1,1,1,1,0,-2,2,2,-2,1,-1,-1,1,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,27,I REALLY ENJOYED THIS SURVEY.,0.25,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,7,6,9,3,8,4,2,1,5,3,2,4,1 +574,R_5Y9q0BIpJ1p8sOl,46 - 52,,Canadian,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,4,1,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Agree,4,3,2,1,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,1,3,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,1,2,5,4,3,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,2,4,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,2,5,3,4,1,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,TRUE,100,TRUE,100,FALSE,64,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,73,FALSE,75,FALSE,90,TRUE,87,TRUE,61,FALSE,100,FALSE,51,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,77,TRUE,62,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,70,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,5,0,0,0,0,0,7,0,0,0,1,1,7,1,1,1,1,1,7,1,1,1,1,1,6,0,0,0,0,0,7,1,1,1,1,2,7,0,0,0,0,0,8,TRUE,0,100,TRUE,1,100,FALSE,1,64,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,73,FALSE,0,75,FALSE,1,90,TRUE,0,87,TRUE,1,61,FALSE,1,100,FALSE,0,51,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,77,TRUE,1,62,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,70,0,0.1444,0.25,0,0.09,0,0.25,0.5625,0.25,0.25,0.25,0.1521,0.0729,0.01,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.2601,0.25,0,0.25,0.25,0.25,1,0.1296,0.25,0.25,0.7569,0.244178571,0.188392857,0.299964286,16,50,22,68.75,6,75,6,75,5,62.5,5,62.5,8,50,14,87.5,65.94,64.25,60.12,76.75,62.62,65.12,66.75,-18.75,-2.81,-10.75,-14.88,14.25,0.12,15.12,-20.75,2,2,1,0,2,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,2,0,0,0,0,0,1.4,0,0.4,1,0.8,0,1.2,0,0.7,0.5,0.6,6.33,6.67,6.75,0.6,0,-0.8,1,-0.066666667,-1,0,0,-1,-0.34,-1,0,-1,0,0,0,0,0,0,0,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,47,I have none,-0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,2,4,6,9,7,5,3,1,8,3,2,4,1 +575,R_5l6J18fCm9PC8y4,39 - 45,American,,American,Male,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly agree,Strongly disagree,4,2,3,5,1,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Somewhat Agree,4,3,5,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,2,1,3,5,4,9,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,3,4,2,5,1,6,Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly Disagree,2,4,5,1,3,7,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,2,4,1,5,3,3,Strongly disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Strongly disagree,1,4,3,5,2,5,Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Disagree,Agree,3,2,1,5,4,7,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,77,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,5,0,0,2,3,-3,-3,-1,0,0,0,1,0,2,-3,1,-3,-3,-3,-3,-3,3,3,3,0,-3,8,0,0,-3,0,-3,9,2,0,2,-3,-3,6,-3,-3,-3,-3,-3,7,0,1,3,3,-3,7,-3,-1,-2,0,-3,3,2,0,1,-3,2,5,-3,-3,-3,-3,-3,7,FALSE,1,50,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,77,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.0529,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.225103571,0.178571429,0.271635714,5,15.63,24,75,5,62.5,8,100,4,50,7,87.5,10,62.5,14,87.5,61.78,56.25,62.5,65.88,62.5,62.5,61.06,-59.37,-13.22,-6.25,-37.5,15.88,-25,0,-26.44,3,3,1,3,0,3,1,3,0,3,1,0,0,0,4,0,0,0,0,0,0,1,1,0,0,0,0,2,0,3,1,0,1,0,1,0,0,0,0,0,2,2,1,0,0.4,1,0.6,0,1.25,0.5,0.875,7.67,5,6.5,1.6,1,0.4,0,1,1,6,1,0,2.67,0,0,0,-2,2,0,0,1,-1,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),45,n/a,0.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,8,5,4,3,2,7,6,1,9,4,2,3,1 +576,R_7jNc3fMFTZ2N9kN,25 - 31,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,1,2,3,4,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Disagree,3,2,1,4,5,Strongly Agree,Agree,Agree,Disagree,Strongly Agree,1,4,2,3,5,Disagree,Disagree,Agree,Somewhat disagree,Disagree,4,5,3,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,3,5,4,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,2,5,3,4,1,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,1,4,3,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,3,2,5,1,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,2,1,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,5,1,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,74,TRUE,72,TRUE,50,TRUE,50,FALSE,82,TRUE,60,TRUE,100,TRUE,66,TRUE,70,TRUE,72,TRUE,100,TRUE,71,FALSE,84,FALSE,72,FALSE,57,TRUE,59,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,79,TRUE,81,TRUE,75,TRUE,67,TRUE,50,TRUE,64,TRUE,64,TRUE,98,TRUE,100,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,-2,-3,3,-3,-2,3,2,2,-2,3,-2,-2,2,-1,-2,3,3,3,2,3,1,-3,-3,3,-3,-3,1,3,3,3,-3,3,1,1,1,1,1,1,5,3,3,3,2,3,1,-3,-3,3,-3,-3,1,3,3,3,3,3,1,3,3,3,3,3,6,TRUE,0,100,TRUE,1,74,TRUE,0,72,TRUE,0,50,TRUE,1,50,FALSE,1,82,TRUE,1,60,TRUE,1,100,TRUE,1,66,TRUE,1,70,TRUE,0,72,TRUE,0,100,TRUE,1,71,FALSE,1,84,FALSE,0,72,FALSE,0,57,TRUE,0,59,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,79,TRUE,0,81,TRUE,1,75,TRUE,0,67,TRUE,0,50,TRUE,0,64,TRUE,1,64,TRUE,1,98,TRUE,1,100,0,0.0625,0.3249,0.16,0,0.0324,0.0441,0.09,0,0,0.1296,0.0841,0.1156,0.5184,0.25,0.0676,0.25,0.25,0.25,0.6561,0,0.5184,0,0.0256,0.3481,0.4489,0.0004,1,0.5184,0,0.4096,1,0.250260714,0.130842857,0.369678571,15,46.88,20,62.5,4,50,6,75,6,75,4,50,14,87.5,6,37.5,77.09,74.88,72,83.75,77.75,77.25,76.94,-15.62,14.59,24.88,-3,8.75,27.75,-10.25,39.44,1,0,0,0,0,1,0,0,0,1,0,1,1,1,0,3,3,1,2,3,1,0,0,0,0,1,0,0,0,1,0,1,1,5,0,5,5,1,4,5,0.2,0.4,0.6,2.4,0.2,0.4,1.4,4,0.9,1.5,1.2,1,1,2.125,0,0,-0.8,-1.6,-0.266666667,0,0,0,-1,0,0,1,1,-2,2,-1,1,-2,2,-1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,30,,1.125,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,3,6,7,9,5,4,8,1,2,3,4,2,1 +577,R_7E5JIhztzOZfm1J,53 - 59,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,5,3,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,3,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,5,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,2,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,3,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,1,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,32,100,17,53.13,5,62.5,4,50,4,50,4,50,15,93.75,2,12.5,100,100,100,100,100,100,100,46.87,46.87,37.5,50,50,50,6.25,87.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,3,0,0,0,3,0.75,0.75,0.75,10,10,10,0,0,0,0,0,0,0,0,0,0,2,2,2,2,-2,2,-2,2,-2,2,-2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),54,I like the survey,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,3,2,9,4,5,7,6,1,8,4,3,2,1 +578,R_32JklZgbFSYGk4g,25 - 31,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,3,5,2,1,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,2,4,3,1,5,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,5,4,1,3,2,Somewhat disagree,Somewhat agree,Strongly disagree,Somewhat agree,Disagree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Neither agree nor disagree,Agree,Strongly Agree,5,2,4,1,3,8,Strongly disagree,Strongly agree,Agree,Strongly agree,Disagree,1,3,2,4,5,10,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,4,3,2,5,1,10,Somewhat agree,Somewhat agree,Agree,Strongly Agree,Disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Neither agree nor disagree,Agree,Strongly Agree,3,2,5,4,1,10,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,1,4,5,3,4,Strongly agree,Strongly agree,Agree,Somewhat Disagree,Strongly agree,4,3,2,1,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,5,2,4,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,55,TRUE,78,TRUE,100,TRUE,69,TRUE,100,TRUE,100,TRUE,78,TRUE,100,FALSE,62,TRUE,100,FALSE,75,FALSE,59,FALSE,61,TRUE,90,TRUE,64,FALSE,52,FALSE,54,FALSE,55,TRUE,98,TRUE,100,TRUE,93,FALSE,53,FALSE,59,TRUE,100,FALSE,63,TRUE,59,FALSE,61,TRUE,100,TRUE,100,FALSE,70,TRUE,84,12,3,3,1,2,3,1,1,2,1,2,2,3,1,3,3,-1,1,-3,1,-2,2,3,0,2,3,5,-3,3,2,3,-2,8,3,3,-3,3,0,10,1,1,2,3,-2,10,2,3,0,2,3,2,0,-3,3,-3,1,10,3,3,2,-1,3,4,3,3,3,1,1,5,TRUE,0,84,FALSE,0,70,TRUE,0,100,TRUE,0,100,FALSE,0,61,TRUE,0,59,FALSE,0,63,TRUE,1,100,FALSE,0,59,FALSE,0,53,TRUE,0,93,TRUE,0,100,TRUE,1,98,FALSE,1,55,FALSE,0,54,FALSE,0,52,TRUE,0,64,TRUE,0,90,FALSE,1,61,FALSE,1,59,FALSE,0,75,TRUE,1,100,FALSE,1,62,TRUE,1,100,TRUE,0,78,TRUE,1,100,TRUE,0,100,TRUE,0,69,TRUE,0,100,TRUE,1,78,FALSE,0,55,TRUE,1,100,0,0,0.2704,0.3969,0,0.3481,0,0.2809,0.1681,0,0.0484,0.0004,0.3481,0.8649,0.3721,0.49,0.1444,1,0.4761,0.6084,0.5625,0.2916,0.1521,0.2025,0.4096,1,0.3025,0.7056,1,0.81,1,1,0.449510714,0.290385714,0.608635714,12,37.5,11,34.38,1,12.5,3,37.5,3,37.5,4,50,7,43.75,4,25,77.88,74,77.38,77.88,82.25,76.12,79.62,3.12,43.5,61.5,39.88,40.38,32.25,32.37,54.62,1,0,1,0,0,4,2,0,2,4,1,0,4,0,3,2,0,5,2,0,1,0,1,0,0,1,4,1,4,1,1,0,1,4,0,4,2,6,0,3,0.4,2.4,1.6,1.8,0.4,2.2,1.2,3,1.55,1.7,1.625,7.67,5.33,6.75,0,0.2,0.4,-1.2,0.2,3,-2,6,5,2.34,2,2,0,-1,1,2,-2,0,0,0,0,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),29,"It was . an interesting one, thank you.",0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,9,2,5,4,7,6,3,1,8,4,3,2,1 +579,R_6Bxhobb9ECeIrNB,39 - 45,American,,American,Female,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,3,4,1,2,5,Strongly disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,Somewhat Agree,Agree,Agree,Agree,Strongly Disagree,4,5,2,1,3,Agree,Somewhat agree,Agree,Agree,Agree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Agree,Strongly Agree,Agree,Strongly Agree,5,2,4,3,1,2,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,1,4,3,5,2,0,Somewhat Agree,Agree,Agree,Agree,Strongly Disagree,2,4,3,1,5,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly Agree,4,3,2,1,5,4,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Disagree,5,2,4,1,3,5,Somewhat Agree,Agree,Agree,Agree,Strongly Disagree,5,1,2,4,3,4,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,5,4,TRUE,52,TRUE,81,TRUE,83,TRUE,50,FALSE,50,FALSE,100,TRUE,79,TRUE,89,TRUE,50,TRUE,55,TRUE,52,TRUE,67,TRUE,68,TRUE,100,TRUE,85,FALSE,65,FALSE,65,TRUE,81,TRUE,82,FALSE,61,TRUE,50,TRUE,54,TRUE,60,TRUE,88,TRUE,56,TRUE,60,TRUE,50,FALSE,79,TRUE,56,TRUE,67,FALSE,51,TRUE,81,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,0,3,-3,1,3,1,-1,1,2,2,2,-3,2,1,2,2,2,-1,2,3,2,3,5,-3,1,2,1,-3,2,1,2,2,2,-3,0,0,0,-1,-1,0,8,1,1,2,1,3,2,-3,1,2,1,-2,4,1,2,2,2,-3,5,-1,0,0,0,0,4,TRUE,0,52,TRUE,1,81,TRUE,0,83,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,79,TRUE,1,89,TRUE,1,50,TRUE,1,55,TRUE,0,52,TRUE,0,67,TRUE,1,68,TRUE,0,100,TRUE,1,85,FALSE,0,65,FALSE,1,65,TRUE,0,81,TRUE,0,82,FALSE,1,61,TRUE,1,50,TRUE,1,54,TRUE,0,60,TRUE,1,88,TRUE,0,56,TRUE,1,60,TRUE,0,50,FALSE,1,79,TRUE,0,56,TRUE,1,67,FALSE,0,51,TRUE,1,81,0.0121,0.16,0.4225,0.0441,0.0361,0,0.0144,0.2025,0.1521,0.2116,0.1089,0.1024,0.25,0.2704,0.25,0.0361,0.36,0.25,0.0441,0.3136,0.25,0.0225,0.6724,1,0.1225,0.25,0.2601,0.2704,0.6889,0.6561,0.3136,0.4489,0.269914286,0.160321429,0.379507143,21,65.63,17,53.13,3,37.5,5,62.5,4,50,5,62.5,13,81.25,4,25,67.72,62.62,66.25,67.12,74.88,67.06,68.38,12.5,14.59,25.12,3.75,17.12,12.38,-14.19,43.38,4,1,0,2,0,0,0,1,0,2,0,0,0,0,0,2,1,3,3,2,2,0,1,1,0,0,0,1,0,1,0,0,0,0,0,3,1,2,2,2,1.4,0.6,0,2.2,0.8,0.4,0,2,1.05,0.8,0.925,2.33,3.67,3.75,0.6,0.2,0,0.2,0.266666667,3,-2,-5,4,-1.34,1,0,2,-1,1,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,45,,1,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,3,7,5,9,6,2,8,1,4,2,3,4,1 +580,R_3yONc4fAkV08keZ,60 - 66,American,,American,Female,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,1,5,4,3,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,3,2,4,1,5,Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Agree,1,3,4,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,3,1,4,2,Agree,Agree,Agree,Somewhat disagree,Somewhat agree,4,5,3,1,2,0,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,5,3,4,1,1,Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Agree,4,2,5,1,3,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,5,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,4,5,2,1,0,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,1,2,4,1,Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Agree,5,1,2,4,3,0,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,1,3,2,4,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,90,TRUE,75,FALSE,100,FALSE,50,TRUE,85,FALSE,100,TRUE,90,FALSE,100,TRUE,100,FALSE,75,FALSE,50,TRUE,75,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,90,FALSE,65,TRUE,70,TRUE,85,TRUE,50,TRUE,100,TRUE,92,FALSE,100,TRUE,80,FALSE,50,FALSE,93,TRUE,100,TRUE,92,16,2,2,2,1,1,1,0,2,-1,1,2,1,3,-3,2,1,1,1,-1,-1,2,2,2,-1,1,0,2,2,2,1,1,1,2,1,3,-3,2,0,1,1,1,1,-1,0,2,2,2,2,0,0,0,1,2,0,1,1,2,1,3,-3,2,0,1,1,1,0,-1,0,TRUE,0,92,TRUE,1,100,FALSE,1,93,FALSE,1,50,TRUE,1,80,FALSE,1,100,TRUE,1,92,TRUE,1,100,TRUE,1,50,TRUE,1,85,TRUE,0,70,FALSE,1,65,FALSE,0,90,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,75,FALSE,1,50,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,85,FALSE,1,50,FALSE,1,100,TRUE,0,75,TRUE,1,90,FALSE,0,50,TRUE,1,100,0,0.0225,0,0.0064,0,0,0.01,0.0225,0.25,0,0.01,0.81,0.25,0.49,0.04,0,0,0.25,0,0,0.5625,0.25,0.5625,1,0.25,0.25,0.25,0.8464,0.0049,0,0.5625,0.1225,0.242635714,0.152321429,0.33295,16,50,23,71.88,4,50,5,62.5,6,75,8,100,12,75,11,68.75,81.47,61.88,83.75,94.25,86,83.56,79.38,-21.88,9.59,11.88,21.25,19.25,-14,8.56,10.63,0,0,0,2,0,1,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0.4,1,0,0.4,0.4,0.6,0,0.2,0.45,0.3,0.375,0.33,0.33,0.25,0,0.4,0,0.2,0.133333333,0,0,0,0,0,1,2,0,-2,2,1,-1,0,0,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),60,was interesting and easy to use,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,5,4,3,8,2,7,9,1,6,4,2,3,1 +581,R_6sWLSoBqWdsAvER,46 - 52,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,5,1,2,4,3,Somewhat agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,2,1,3,5,4,Somewhat Agree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,2,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,5,4,1,3,2,3,Somewhat agree,Disagree,Strongly agree,Strongly disagree,Agree,3,1,5,2,4,2,Agree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,4,1,3,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,3,5,1,2,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,3,5,4,2,2,Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,5,4,3,1,2,Agree,Agree,Agree,Agree,Agree,4,5,2,1,3,TRUE,100,TRUE,100,FALSE,100,FALSE,55,TRUE,99,FALSE,55,TRUE,100,TRUE,100,TRUE,98,TRUE,100,TRUE,57,TRUE,100,TRUE,69,TRUE,100,TRUE,73,TRUE,100,TRUE,70,FALSE,75,TRUE,96,FALSE,100,FALSE,98,TRUE,94,FALSE,100,TRUE,100,TRUE,87,TRUE,80,TRUE,100,FALSE,99,TRUE,99,TRUE,100,TRUE,65,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,1,3,1,-1,3,-2,3,1,-1,3,-3,3,1,2,2,2,1,3,3,2,1,3,3,1,-2,3,-3,2,3,2,-1,3,-3,3,2,1,1,2,1,1,2,3,3,2,2,3,3,1,-3,3,-3,3,2,2,-2,3,-3,3,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,55,TRUE,1,99,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,TRUE,0,57,TRUE,0,100,TRUE,1,69,TRUE,0,100,TRUE,1,73,TRUE,1,100,TRUE,0,70,FALSE,1,75,TRUE,0,96,FALSE,1,100,FALSE,0,98,TRUE,1,94,FALSE,1,100,TRUE,1,100,TRUE,0,87,TRUE,1,80,TRUE,0,100,FALSE,1,99,TRUE,0,99,TRUE,1,100,TRUE,1,65,TRUE,1,100,0,0.04,0,0,0,0.2025,0,0,0,0.0036,0,0.0961,0.0004,0.3249,0.0001,0,0,0.2025,0.0001,0.7569,0.9604,0.0729,0.9216,1,0.49,1,0.1225,1,0,0.0625,0.9801,1,0.328467857,0.059292857,0.597642857,25,78.13,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,15,93.75,7,43.75,89.66,80.5,86.25,92,99.88,92.25,87.06,9.38,20.91,18,23.75,29.5,12.38,-1.5,43.31,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,2,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0.6,0.2,0.4,0.2,0.6,0.4,0.4,0.3,0.4,0.35,2.67,2.33,2.375,-0.2,0,-0.2,0,-0.133333333,0,1,0,0,0.34,0,1,2,-2,2,0,0,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,48,Interesting survey,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,01DIR,5,7,8,3,6,2,4,1,9,4,3,2,1 +582,R_5P7eU8tKjWbiexA,39 - 45,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,1,2,5,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,3,1,4,2,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,5,1,2,Agree,Agree,Strongly Agree,Agree,Agree,5,2,3,1,4,Strongly Agree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,5,2,1,3,4,7,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,1,3,2,5,6,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,1,5,3,4,7,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Strongly Agree,4,2,3,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,1,3,5,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,1,4,5,3,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,1,4,2,3,2,Somewhat agree,Somewhat agree,Agree,Agree,Agree,1,4,3,2,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,50,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,61,FALSE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,98,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,73,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,16,3,2,2,0,1,2,-3,3,-3,1,2,0,2,0,3,2,2,3,2,2,3,2,2,-1,0,7,3,-3,3,-3,1,6,3,1,3,1,3,7,1,-1,2,-1,3,5,3,2,3,0,0,5,2,-3,3,-3,1,5,3,0,3,0,3,2,1,1,2,2,2,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,73,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,98,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,61,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.25,0,0.0729,0,0,1,0,0,0,0,0,1,0.25,0,0,0,0.25,0,0,0.25,0.25,0.1521,1,0,0.25,0,0,1,0,1,0.9604,0.262946429,0.178571429,0.347321429,16,50,24,75,6,75,6,75,7,87.5,5,62.5,12,75,12,75,88.5,70.12,93.75,90.38,99.75,88.94,88.06,-25,13.5,-4.88,18.75,2.88,37.25,13.94,13.06,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1,3,1,3,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,0.4,0.2,0.8,1.8,0.4,0,0.4,0.6,0.8,0.35,0.575,6.67,4,4.875,0,0.2,0.4,1.2,0.2,2,1,5,3,2.67,0,1,2,-2,2,-1,1,-2,2,-2,2,0,10 cents,5 minutes,15 days,Female,University - Undergraduate,41,,1.25,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,8,2,4,5,7,3,6,1,9,2,3,4,1 +583,R_3cjduHlfZVXi9FU,39 - 45,,Canadian,Canadian,Male,Agree,Agree,Somewhat agree,Agree,Strongly agree,4,2,5,1,3,Somewhat disagree,Disagree,Strongly agree,Disagree,Strongly agree,5,3,2,4,1,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,5,3,4,2,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,2,3,4,1,5,8,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,4,1,8,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,2,3,1,4,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,3,4,5,1,2,6,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,4,5,2,8,Strongly agree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,3,1,2,5,4,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,5,1,4,2,TRUE,99,TRUE,100,TRUE,100,TRUE,50,TRUE,86,FALSE,96,TRUE,100,TRUE,100,TRUE,88,FALSE,98,FALSE,79,FALSE,75,FALSE,87,FALSE,100,TRUE,87,TRUE,100,FALSE,50,FALSE,73,TRUE,65,FALSE,76,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,88,FALSE,74,TRUE,89,FALSE,50,TRUE,100,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,1,2,3,-1,-2,3,-2,3,3,-1,3,0,2,0,1,1,1,-1,-1,2,3,-1,0,8,-1,0,1,1,1,8,3,0,2,1,2,8,0,1,1,0,1,7,2,3,1,2,3,7,-2,-3,3,-3,3,6,3,-1,3,-2,3,8,0,0,1,1,-1,6,TRUE,0,99,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,86,FALSE,1,96,TRUE,1,100,TRUE,1,100,TRUE,1,88,FALSE,0,98,FALSE,1,79,FALSE,1,75,FALSE,0,87,FALSE,1,100,TRUE,1,87,TRUE,1,100,FALSE,1,50,FALSE,1,73,TRUE,0,65,FALSE,1,76,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,0,88,FALSE,1,74,TRUE,0,89,FALSE,0,50,TRUE,1,100,TRUE,1,100,0,0.25,0,0,0,0.0016,0,0.9604,0.0576,0,0.25,0.7569,0.0144,0.0441,0.0196,0,0,0.25,0.0676,0,0,0.0169,0.4225,0,0.25,0.7744,0,0.9801,1,0.0729,0.7921,0.0625,0.242628571,0.168185714,0.317071429,23,71.88,22,68.75,5,62.5,6,75,5,62.5,6,75,12,75,10,62.5,86.25,82.12,88.5,90,84.38,90.38,82.12,3.13,17.5,19.62,13.5,27.5,9.38,15.38,19.62,3,0,2,3,3,0,2,2,3,2,0,1,1,1,0,0,0,0,1,2,0,1,0,0,0,1,1,0,1,0,0,0,0,2,1,0,1,0,0,0,2.2,1.8,0.6,0.6,0.2,0.6,0.6,0.2,1.3,0.4,0.85,8,7,7.25,2,1.2,0,0.4,1.066666667,1,2,0,1,1,2,2,2,-2,2,1,-1,-2,2,-2,2,1,5 cents,100 minutes,47 days,Male,University - Undergraduate,40,No,1.5,1,0,1,0,1,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,4,9,8,6,7,5,3,1,2,4,3,2,1 +584,R_37Hk3LKZJ0Cghx7,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,4,3,2,5,1,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,5,2,1,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,3,4,1,2,5,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,3,2,5,4,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,2,4,3,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly agree,Disagree,1,4,2,5,3,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly Agree,2,3,5,4,1,4,Disagree,Disagree,Strongly disagree,Strongly disagree,Disagree,5,1,3,4,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,1,2,3,5,4,3,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,1,3,5,0,Disagree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,1,3,5,0,Strongly Agree,Somewhat agree,Strongly Agree,Agree,Strongly Agree,1,3,4,5,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,97,TRUE,100,TRUE,99,FALSE,50,TRUE,83,FALSE,82,FALSE,50,TRUE,100,TRUE,89,TRUE,100,TRUE,52,TRUE,50,TRUE,92,FALSE,94,FALSE,50,TRUE,96,FALSE,50,TRUE,97,FALSE,50,TRUE,50,TRUE,50,TRUE,65,FALSE,100,TRUE,100,FALSE,100,TRUE,76,TRUE,50,FALSE,50,TRUE,57,TRUE,100,FALSE,50,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,0,1,-1,-3,3,-3,2,0,-1,3,-2,3,-2,1,0,1,0,3,3,1,0,0,3,-3,-3,0,3,-2,6,0,0,2,-1,3,4,-2,-2,-3,-3,-2,8,3,3,1,0,3,3,1,-3,3,-3,3,0,-2,-2,3,-3,3,0,3,1,3,2,3,1,TRUE,0,97,TRUE,1,100,TRUE,0,99,FALSE,1,50,TRUE,1,83,FALSE,1,82,FALSE,0,50,TRUE,1,100,TRUE,1,89,TRUE,1,100,TRUE,0,52,TRUE,0,50,TRUE,1,92,FALSE,1,94,FALSE,0,50,TRUE,1,96,FALSE,1,50,TRUE,0,97,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,65,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,0,50,FALSE,1,50,TRUE,0,57,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.0576,0.0016,0.25,0,0.0324,0,0,0.25,0.1225,0,0.0064,0.0121,0.2704,0.0289,0,0,0.25,0.25,0,0.25,0.25,0.25,0.0036,0.25,0.25,0.25,0.9409,0.9801,0.9409,0.3249,0.25,0.220110714,0.069478571,0.370742857,20,62.5,21,65.63,4,50,7,87.5,5,62.5,5,62.5,13,81.25,8,50,75.91,61.38,76.75,84.88,80.62,81.31,70.5,-3.13,10.28,11.38,-10.75,22.38,18.12,0.06,20.5,0,0,1,0,1,2,0,3,6,4,0,1,1,1,0,0,3,3,4,2,0,0,1,0,2,2,0,0,0,1,2,1,0,1,0,5,0,3,1,3,0.4,3,0.6,2.4,0.6,0.6,0.8,2.4,1.6,1.1,1.35,4.33,1,3.125,-0.2,2.4,-0.2,0,0.666666667,0,6,4,7,3.33,1,2,2,-2,2,-1,1,1,-1,0,0,1,5 cents,100 minutes,24 days,Male,University - Undergraduate,42,,1,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,4,6,5,9,3,2,8,1,7,2,4,3,1 +585,R_5O8gYBMH1PFssNw,46 - 52,,Canadian,Canadian,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,2,4,3,1,5,Strongly disagree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,1,3,5,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,2,1,4,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,1,5,4,3,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,2,5,1,3,4,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,3,1,4,2,3,Neither Agree nor Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,1,2,3,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,2,3,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Agree,Neither agree nor disagree,3,1,4,2,5,2,Strongly disagree,Strongly disagree,Agree,Disagree,Neither agree nor disagree,4,5,1,3,2,1,Neither Agree nor Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,1,3,5,2,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,4,1,5,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,75,TRUE,88,TRUE,94,TRUE,100,FALSE,100,TRUE,93,FALSE,85,TRUE,57,TRUE,90,FALSE,60,FALSE,56,TRUE,100,TRUE,50,TRUE,100,TRUE,61,TRUE,100,FALSE,51,TRUE,92,TRUE,71,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,95,27,3,2,3,3,-1,-3,-2,3,-3,0,0,-3,3,-2,3,3,3,3,3,2,3,2,3,1,1,3,-3,-3,3,-3,1,3,0,-3,2,-2,3,1,0,0,1,1,1,7,2,2,3,2,0,2,-3,-3,2,-2,0,1,0,-3,2,-2,3,1,0,0,0,2,2,0,FALSE,1,95,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,92,FALSE,1,51,TRUE,0,100,TRUE,1,61,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,56,FALSE,1,60,TRUE,0,90,TRUE,0,57,FALSE,0,85,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,0,94,TRUE,1,88,TRUE,0,75,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0.0144,0,0,0,0,0,0.0064,0.3249,0.0049,0,0.1521,0.0841,0.2401,0,0,0,0.25,0.25,0.8836,0.7225,0.25,0.81,1,0.1936,0.5625,0.25,0.0025,1,0.16,1,1,0.326685714,0.075892857,0.577478571,27,84.38,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,83.38,67.12,87.75,90.25,88.38,86.88,79.88,15.63,14.63,4.62,12.75,15.25,25.88,-0.62,29.88,0,0,0,2,2,0,1,0,0,1,0,0,1,0,0,3,3,2,2,1,1,0,0,1,1,0,1,1,1,0,0,0,1,0,0,3,3,3,1,0,0.8,0.4,0.2,2.2,0.6,0.6,0.2,2,0.9,0.85,0.875,2.33,1.33,2.25,0.2,-0.2,0,0.2,3.7E-17,1,2,0,7,1,2,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,,1.75,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,7,3,9,5,2,6,4,1,8,4,2,3,1 +586,R_6P5D4RUzUfkrJ9g,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Strongly agree,Somewhat agree,Agree,3,2,5,4,1,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,5,2,1,4,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,1,3,4,5,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,5,2,4,3,1,7,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,3,4,1,5,7,Strongly Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,2,4,3,1,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,3,5,4,1,2,7,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,2,3,1,4,6,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,5,3,2,4,1,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,4,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,32,2,2,3,1,2,-2,-2,1,-2,1,3,2,3,-2,3,-1,-1,1,1,-1,3,3,3,1,3,6,-2,-3,3,-3,1,7,3,1,2,-3,3,7,1,1,1,-1,1,6,2,3,3,1,3,6,0,-3,3,-3,1,7,3,2,3,-3,3,6,1,1,1,1,-1,6,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0.107142857,0.071428571,0.142857143,32,100,29,90.63,8,100,6,75,8,100,7,87.5,15,93.75,14,87.5,100,100,100,100,100,100,100,9.37,9.37,0,25,0,12.5,6.25,12.5,1,1,0,0,1,0,1,2,1,0,0,1,1,1,0,2,2,0,2,2,0,1,0,0,1,2,1,2,1,0,0,0,0,1,0,2,2,0,0,0,0.6,0.8,0.6,1.6,0.4,1.2,0.2,0.8,0.9,0.65,0.775,6.67,6.33,6.375,0.2,-0.4,0.4,0.8,0.066666667,0,0,1,0,0.34,1,2,1,-2,2,2,-2,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,I thought it was a fun and interesting survey to participate in,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,7,5,3,8,6,2,9,1,4,2,3,4,1 +587,R_1wQsp7UmZK6dseF,39 - 45,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Somewhat agree,Agree,5,1,3,2,4,Disagree,Disagree,Strongly agree,Strongly agree,Somewhat agree,2,4,5,1,3,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,4,2,1,5,3,Strongly disagree,Somewhat disagree,Disagree,Strongly disagree,Strongly disagree,3,4,5,2,1,Agree,Strongly Agree,Agree,Somewhat agree,Agree,3,2,4,5,1,2,Disagree,Disagree,Strongly agree,Strongly agree,Somewhat agree,4,5,3,2,1,2,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,4,5,1,3,2,2,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,2,3,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Somewhat agree,Agree,5,1,3,2,4,2,Disagree,Disagree,Strongly agree,Strongly agree,Somewhat agree,1,2,4,3,5,2,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,3,2,5,4,1,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,3,1,4,2,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,TRUE,100,TRUE,79,TRUE,71,FALSE,100,FALSE,51,TRUE,100,TRUE,53,FALSE,69,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,80,TRUE,100,TRUE,76,TRUE,100,FALSE,59,FALSE,56,FALSE,100,FALSE,60,TRUE,59,TRUE,100,FALSE,55,TRUE,63,TRUE,56,FALSE,82,TRUE,100,TRUE,87,TRUE,69,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,1,2,-2,-2,3,3,1,1,3,3,2,0,-3,-1,-2,-3,-3,2,3,2,1,2,2,-2,-2,3,3,1,2,1,3,3,2,0,2,-3,-1,-3,-3,-3,2,2,3,2,1,2,2,-2,-2,3,3,1,2,1,3,3,2,0,1,-1,0,0,0,-2,6,FALSE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,79,TRUE,1,71,FALSE,1,100,FALSE,0,51,TRUE,1,100,TRUE,1,53,FALSE,0,69,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,76,TRUE,0,100,FALSE,1,59,FALSE,1,56,FALSE,0,100,FALSE,0,60,TRUE,0,59,TRUE,1,100,FALSE,1,55,TRUE,1,63,TRUE,0,56,FALSE,1,82,TRUE,0,100,TRUE,1,87,TRUE,1,69,TRUE,1,100,0,0.1369,0,0.2601,0,0,0,0.4761,0.1936,0.36,0.0169,0,0.2209,0,0.0841,1,0.3481,0.6241,0.0324,0.2025,1,0.04,0.1681,0,0.5776,0.3136,0.0961,0,1,1,1,1,0.348360714,0.237414286,0.459307143,16,50,19,59.38,5,62.5,4,50,4,50,6,75,11,68.75,8,50,82.03,74.5,88.25,74.75,90.62,81.44,82.62,-9.38,22.65,12,38.25,24.75,15.62,12.69,32.62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,3,1,0,0,0,0.2,0,0,0,1.8,0.05,0.45,0.25,2,1.67,2.375,0,0,0,-1.6,0,0,0,1,-4,0.33,-1,1,1,-1,1,2,-2,2,-2,0,0,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,44,Too long and very repetitive questions. ,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,3,7,8,9,6,4,5,1,2,4,3,2,1 +588,R_5fYQJRqkZWFGWR4,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Agree,Neither agree nor disagree,Agree,Agree,1,4,2,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,2,3,4,1,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,5,2,1,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Disagree,Neither agree nor disagree,Strongly Agree,Strongly Agree,3,1,2,5,4,9,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,2,5,3,7,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,1,3,4,2,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Disagree,3,5,2,4,1,6,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,6,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,4,3,5,2,1,7,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,FALSE,68,TRUE,60,TRUE,100,FALSE,63,TRUE,81,FALSE,67,TRUE,65,FALSE,100,TRUE,65,TRUE,81,TRUE,72,TRUE,100,FALSE,73,FALSE,100,TRUE,65,TRUE,97,TRUE,100,TRUE,84,TRUE,86,FALSE,92,TRUE,93,TRUE,100,TRUE,92,TRUE,100,TRUE,72,TRUE,100,TRUE,85,FALSE,89,TRUE,93,FALSE,86,TRUE,86,FALSE,93,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,0,2,2,1,1,1,1,-2,1,1,2,0,1,1,2,1,1,1,2,-2,0,3,3,6,-1,0,1,1,-1,9,1,-1,1,1,0,7,3,3,3,-3,3,6,2,3,0,3,-2,6,1,1,1,0,1,6,0,1,0,1,-1,6,2,2,3,3,3,7,FALSE,1,68,TRUE,1,60,TRUE,0,100,FALSE,1,63,TRUE,1,81,FALSE,1,67,TRUE,1,65,FALSE,0,100,TRUE,1,65,TRUE,1,81,TRUE,0,72,TRUE,0,100,FALSE,0,73,FALSE,1,100,TRUE,1,65,TRUE,1,97,TRUE,0,100,TRUE,0,84,TRUE,0,86,FALSE,1,92,TRUE,1,93,TRUE,1,100,TRUE,0,92,TRUE,1,100,TRUE,0,72,TRUE,1,100,TRUE,0,85,FALSE,1,89,TRUE,0,93,FALSE,0,86,TRUE,1,86,FALSE,0,93,1,0,0.0009,0.1225,0.8649,0.1089,0,0.0361,0.0064,0,0.7396,0.5329,0.1225,0.5184,0.0361,0.16,0.8464,0.1369,0.0121,0.5184,0.0049,0.1225,0.7396,0,1,0.7225,0.0196,0.1024,1,0.7056,0.8649,1,0.390057143,0.293507143,0.486607143,32,100,18,56.25,5,62.5,3,37.5,6,75,4,50,12,75,6,37.5,84.62,72.75,86.5,83.75,95.5,84.06,85.19,43.75,28.37,10.25,49,8.75,45.5,9.06,47.69,1,4,0,1,1,2,1,0,0,1,0,2,1,1,1,2,1,2,4,2,1,1,0,1,4,0,0,0,1,3,1,0,2,1,2,1,0,2,2,2,1.4,0.8,1,2.2,1.4,0.8,1.2,1.4,1.35,1.2,1.275,7.33,6,6.625,0,0,-0.2,0.8,-0.066666667,0,3,1,-1,1.33,1,1,0,1,-1,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),20,it was good!,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,01DIR,8,5,7,9,3,2,6,1,4,4,2,3,1 +589,R_1H2iF1BXiFFOtRi,32 - 38,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Disagree,Strongly agree,5,4,2,1,3,Agree,Disagree,Disagree,Disagree,Agree,4,1,3,5,2,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,2,1,4,3,5,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Disagree,1,4,3,5,2,Agree,Strongly Agree,Agree,Disagree,Strongly Agree,1,4,2,3,5,3,Agree,Disagree,Agree,Disagree,Agree,4,1,5,3,2,4,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,4,5,3,1,2,3,Disagree,Strongly disagree,Disagree,Disagree,Disagree,4,5,1,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Disagree,Strongly Agree,4,2,3,5,1,7,Agree,Disagree,Disagree,Disagree,Agree,3,2,4,1,5,7,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,2,1,5,3,4,7,Agree,Agree,Agree,Agree,Disagree,3,2,5,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,73,TRUE,89,FALSE,87,FALSE,92,FALSE,89,FALSE,91,TRUE,92,FALSE,91,TRUE,92,FALSE,93,TRUE,91,TRUE,92,FALSE,96,FALSE,94,TRUE,100,FALSE,97,TRUE,100,TRUE,97,FALSE,98,FALSE,97,TRUE,100,FALSE,96,TRUE,100,TRUE,100,TRUE,97,TRUE,95,FALSE,100,TRUE,100,TRUE,98,FALSE,96,TRUE,98,FALSE,99,26,2,3,2,-2,3,2,-2,-2,-2,2,2,2,2,1,3,-1,-2,1,-1,-2,2,3,2,-2,3,3,2,-2,2,-2,2,4,2,2,2,1,3,3,-2,-3,-2,-2,-2,7,2,3,2,-2,3,7,2,-2,-2,-2,2,7,2,2,2,1,3,7,2,2,2,2,-2,7,FALSE,1,99,TRUE,1,98,FALSE,1,96,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,97,TRUE,1,100,TRUE,1,100,FALSE,1,96,TRUE,0,100,FALSE,0,97,FALSE,1,98,TRUE,1,97,TRUE,1,100,FALSE,1,97,TRUE,0,100,FALSE,1,94,FALSE,1,96,TRUE,1,92,TRUE,1,91,FALSE,1,93,TRUE,1,92,FALSE,1,91,TRUE,1,92,FALSE,1,91,FALSE,1,89,FALSE,1,92,FALSE,0,87,TRUE,1,89,TRUE,1,73,0.0009,0.0064,0,0.0025,0.0729,0,0.0064,0,0.0016,0.0081,0.7569,0.9409,0,0.0016,0,0.0004,0.0049,0.9604,0.0121,0.0081,0.0064,0.0009,0.0036,0.0004,0.0009,0.0081,0.0121,0.0001,0.0016,1,0.0064,1,0.171957143,0.196721429,0.147192857,26,81.25,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,94.69,95.38,93,95.75,94.62,93.75,95.62,-3.13,10.31,7.88,5.5,8.25,19.62,6.25,14.37,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,1,3,0,0,0.8,0,1.2,0,0,0,2.2,0.5,0.55,0.525,3.33,7,5.625,0,0.8,0,-1,0.266666667,-4,-3,-4,0,-3.67,1,1,0,-1,1,-1,1,1,-1,-1,1,1,5 cents,5 minutes,47 days,Male,High School (or equivalent),33,"I loved the survey! It was engaging, and I appreciate the opportunity to provide feedback. Keep up the great work!",0.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,7,6,2,3,9,5,4,1,8,3,4,2,1 +590,R_1VyXet4YO7WSVtn,32 - 38,,Canadian,Canadian,Female,Disagree,Strongly agree,Agree,Disagree,Neither agree nor disagree,3,5,1,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,4,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,3,1,4,2,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,2,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,2,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,76,FALSE,50,FALSE,100,TRUE,100,FALSE,50,TRUE,94,FALSE,50,FALSE,50,FALSE,50,TRUE,68,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,2,-2,0,0,0,0,0,-1,0,0,2,-2,3,-1,0,0,-1,-2,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,4,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,76,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,94,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,68,0.25,0,0.25,0.25,0.1024,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.8836,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.314771429,0.245,0.384542857,4,12.5,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,8,50,10,62.5,60.56,50,55.5,75,61.75,57.38,63.75,-43.75,4.31,-12.5,-7,12.5,24.25,7.38,1.25,2,3,2,2,0,0,0,0,0,1,0,0,2,2,3,1,0,0,1,2,2,3,2,2,0,0,0,0,0,1,0,0,2,2,3,1,0,0,1,2,1.8,0.2,1.4,0.8,1.8,0.2,1.4,0.8,1.05,1.05,1.05,4.67,5,4.875,0,0,0,0,0,0,0,-1,0,-0.33,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),38,,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,7,6,3,5,8,4,2,1,9,3,4,2,1 +591,R_5I5irZ0eBE0gODo,46 - 52,American,,American,Male,Agree,Strongly disagree,Strongly agree,Agree,Disagree,2,3,1,5,4,Strongly disagree,Disagree,Agree,Somewhat agree,Somewhat agree,5,3,4,1,2,Agree,Strongly Agree,Agree,Disagree,Agree,3,5,4,2,1,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Disagree,Agree,Agree,Disagree,3,4,2,5,1,0,Strongly disagree,Agree,Somewhat agree,Strongly agree,Agree,4,1,2,5,3,0,Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,4,2,1,3,5,6,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Strongly disagree,Strongly Agree,Agree,Disagree,1,2,3,5,4,1,Strongly disagree,Neither agree nor disagree,Agree,Agree,Agree,1,3,4,2,5,10,Agree,Agree,Agree,Strongly Disagree,Agree,1,2,3,5,4,0,Strongly disagree,Strongly disagree,Strongly disagree,Agree,Strongly disagree,3,5,2,1,4,TRUE,100,TRUE,52,TRUE,100,FALSE,50,TRUE,81,FALSE,100,TRUE,100,TRUE,100,TRUE,71,FALSE,100,FALSE,87,FALSE,70,TRUE,94,FALSE,59,TRUE,100,TRUE,100,TRUE,98,TRUE,100,FALSE,53,FALSE,74,TRUE,98,TRUE,70,FALSE,59,TRUE,81,TRUE,84,TRUE,85,FALSE,55,FALSE,57,TRUE,88,TRUE,79,TRUE,100,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,-3,3,2,-2,-3,-2,2,1,1,2,3,2,-2,2,-3,-3,-3,1,-3,2,-2,2,2,-2,0,-3,2,1,3,2,0,2,3,3,-3,2,0,-3,-3,-3,1,-3,6,2,-3,3,2,-2,0,-3,0,2,2,2,1,2,2,2,-3,2,10,-3,-3,-3,2,-3,0,TRUE,0,100,TRUE,1,52,TRUE,0,100,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,FALSE,0,100,FALSE,1,87,FALSE,1,70,TRUE,1,94,FALSE,1,59,TRUE,1,100,TRUE,1,100,TRUE,0,98,TRUE,0,100,FALSE,1,53,FALSE,1,74,TRUE,1,98,TRUE,1,70,FALSE,1,59,TRUE,1,81,TRUE,0,84,TRUE,1,85,FALSE,1,55,FALSE,1,57,TRUE,0,88,TRUE,1,79,TRUE,1,100,TRUE,1,100,0,0.0225,0,0,0,0,0.0361,1,0.0676,0.09,0.0441,0.0036,0.0841,0.0169,0.0361,0.2304,0.1681,0.25,0.1849,0.7056,0.0004,0,0.2209,0.1681,0.9604,0.2025,0,1,1,1,0.7744,0.09,0.29765,0.144785714,0.450514286,17,53.13,25,78.13,8,100,6,75,4,50,7,87.5,15,93.75,10,62.5,82.66,71,89.75,87.25,82.62,88.19,77.12,-25,4.53,-29,14.75,37.25,-4.88,-5.56,14.62,0,1,1,0,0,0,4,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,1,0,1,0,1,0,0,0,0,1,0,0.4,1.6,0.4,0,0,0.8,0.4,0.2,0.6,0.35,0.475,0,3.67,2.125,0.4,0.8,0,-0.2,0.4,0,-1,-10,6,-3.67,0,1,1,0,0,1,-1,1,-1,-1,1,1,10 cents,75 minutes,24 days,Male,High School (or equivalent),48,none,0.25,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,3,8,9,4,7,2,5,1,6,4,2,3,1 +592,R_6qy0KJnYzppG2b4,46 - 52,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,4,2,5,1,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,2,5,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,3,1,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,50,FALSE,100,FALSE,79,TRUE,100,TRUE,100,TRUE,91,TRUE,100,FALSE,83,TRUE,50,TRUE,50,FALSE,84,TRUE,50,TRUE,100,TRUE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,3,0,0,-3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,0,50,FALSE,1,100,FALSE,1,79,TRUE,1,100,TRUE,1,100,TRUE,0,91,TRUE,1,100,FALSE,1,83,TRUE,1,50,TRUE,0,50,FALSE,1,84,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,0.25,0.25,0,0,0,0.25,0,0,0.0441,0,0,0,0.25,0.25,0.25,0.25,0.8281,0.25,0.0256,0.0289,0,0,0,1,0.25,0.25,0.25,1,0.25,0.25,0.25,1,0.247382143,0.169442857,0.325321429,16,50,20,62.5,5,62.5,4,50,5,62.5,6,75,16,100,4,25,76.16,62.5,73.88,85.38,82.88,81.25,71.06,-12.5,13.66,0,23.88,22.88,7.88,-18.75,46.06,0,0,3,0,0,3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0.6,1,0.2,0,0.6,1,0.2,0,0.45,0.45,0.45,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,51,,0,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,8,3,2,4,6,5,9,1,7,4,2,3,1 +593,R_7tCl8IW1fbG8MeJ,39 - 45,,Canadian,Canadian,Male,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,2,1,5,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,5,4,1,2,3,Somewhat Agree,Disagree,Agree,Somewhat Agree,Strongly Agree,4,1,5,3,2,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,3,4,5,1,2,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,3,2,4,5,1,4,Disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,5,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,1,5,2,4,3,4,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Disagree,3,2,1,4,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Agree,Agree,Agree,3,2,1,5,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,6,Agree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,1,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,1,3,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,64,FALSE,53,TRUE,59,FALSE,53,TRUE,65,TRUE,65,FALSE,54,FALSE,62,FALSE,54,TRUE,65,TRUE,100,TRUE,83,TRUE,96,TRUE,68,TRUE,100,TRUE,95,TRUE,68,TRUE,86,TRUE,58,FALSE,57,TRUE,100,TRUE,62,TRUE,100,TRUE,70,FALSE,59,TRUE,87,FALSE,57,FALSE,59,FALSE,56,TRUE,72,19,0,1,2,1,1,-1,-1,1,-2,1,1,-2,2,1,3,-3,-3,-3,-2,-3,0,2,2,1,2,4,-2,1,2,0,0,5,3,0,2,0,2,4,-1,1,2,0,-2,8,0,2,2,2,2,2,0,0,0,0,0,6,2,2,2,0,0,5,0,0,0,0,-3,5,TRUE,0,72,FALSE,0,56,FALSE,1,59,FALSE,1,57,TRUE,1,87,FALSE,1,59,TRUE,1,70,TRUE,1,100,TRUE,1,62,TRUE,1,100,FALSE,1,57,TRUE,0,58,TRUE,1,86,TRUE,0,68,TRUE,1,95,TRUE,1,100,TRUE,0,68,TRUE,0,96,TRUE,0,83,TRUE,0,100,TRUE,1,65,FALSE,0,54,FALSE,1,62,FALSE,0,54,TRUE,0,65,TRUE,1,65,FALSE,1,53,TRUE,0,59,FALSE,1,53,TRUE,1,64,FALSE,0,50,TRUE,1,100,0,0.1225,0,0.09,0,0.1681,0.2916,0,1,0.2916,0.1296,0.0196,0.1444,0.1849,0.0169,0.3136,0.1444,0.1849,0.3481,0.4225,0.1225,0.0025,0.6889,0.4624,0.4624,0.2209,0.25,0.5184,0.1681,0.9216,0.2209,0.3364,0.286971429,0.2064,0.367542857,19,59.38,19,59.38,5,62.5,7,87.5,3,37.5,4,50,12,75,7,43.75,71.16,64.12,72.5,73.75,74.25,75.5,66.81,0,11.78,1.62,-15,36.25,24.25,0.5,23.06,0,1,0,0,1,1,2,1,2,1,2,2,0,1,1,2,4,5,2,1,0,1,0,1,1,1,1,1,2,1,1,4,0,1,3,3,3,3,2,0,0.4,1.4,1.2,2.8,0.6,1.2,1.8,2.2,1.45,1.45,1.45,4.33,4.33,4.875,-0.2,0.2,-0.6,0.6,-0.2,2,-1,-1,3,0,1,2,2,-2,2,-1,1,-2,2,-2,2,0,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),43,,1.5,1,0,1,0,1,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,4,8,7,3,2,6,5,1,9,4,2,3,1 +594,R_3vaz9NIWdwJZZHb,39 - 45,,Canadian,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,4,1,3,2,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,4,5,1,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,2,5,3,4,1,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,6,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,3,4,1,2,5,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,1,5,2,6,Disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Strongly disagree,4,2,3,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,1,4,5,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,5,1,2,3,4,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,2,5,4,5,Agree,Agree,Agree,Agree,Disagree,2,1,5,4,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,50,FALSE,80,FALSE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,80,FALSE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,90,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,80,TRUE,91,TRUE,85,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,11,0,2,1,0,1,-2,1,0,-2,0,1,0,1,0,1,-2,0,0,-1,-3,1,2,1,0,1,6,-2,1,0,-2,0,3,1,0,1,0,1,6,-2,0,-1,-2,-3,3,1,2,1,0,1,3,0,1,0,-2,0,5,1,0,1,0,1,5,2,2,2,2,-2,8,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,85,TRUE,1,91,TRUE,1,80,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,90,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,100,FALSE,1,80,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0225,0.25,0.01,0.25,0,0.25,0.04,0.04,0.25,0.25,0.25,0.25,0.0081,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.04,0.25,0.183146429,0.167007143,0.199285714,11,34.38,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,6,37.5,16,100,62.69,55.12,66.25,60,69.38,64.12,61.25,-34.37,-6.06,-7.38,3.75,-2.5,-18.12,26.62,-38.75,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,4,2,2,3,1,0.2,0,0,0.4,0.2,0.4,0,2.4,0.15,0.75,0.45,5,4.33,4.875,0,-0.4,0,-2,-0.133333333,3,-2,1,-5,0.67,1,1,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,,0.25,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,4,3,2,6,7,9,8,1,5,2,3,4,1 +595,R_1R1uDnYCf5JJcuL,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,1,4,3,2,5,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,1,4,5,Somewhat Disagree,Agree,Strongly Agree,Agree,Strongly Agree,5,1,4,3,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,1,2,3,5,4,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,3,2,4,1,Somewhat agree,Agree,Somewhat agree,Strongly agree,Disagree,3,1,2,4,5,8,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,2,5,1,4,3,8,Strongly disagree,Somewhat agree,Somewhat disagree,Strongly disagree,Somewhat agree,2,4,1,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat disagree,Strongly Agree,Strongly Agree,3,5,2,1,4,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,4,2,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,1,4,5,Agree,Somewhat agree,Strongly Agree,Agree,Somewhat disagree,3,4,5,1,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,95,FALSE,93,TRUE,80,TRUE,100,FALSE,100,TRUE,99,TRUE,90,TRUE,100,TRUE,100,FALSE,100,FALSE,95,FALSE,100,FALSE,99,FALSE,94,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,3,-2,-3,3,-3,3,-1,2,3,2,3,-1,-1,-1,-2,-1,1,3,3,3,3,1,1,2,1,3,-2,8,3,3,-2,3,3,8,-3,1,-1,-3,1,8,2,3,-1,3,3,3,-3,-3,3,-3,2,3,3,3,3,3,3,5,2,1,3,2,-1,8,FALSE,1,100,FALSE,0,95,FALSE,1,93,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,99,TRUE,1,90,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,95,FALSE,0,100,FALSE,1,99,FALSE,0,94,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0.01,1,0,0.0001,0,0,1,0,0,1,1,1,0,0,0,0.9025,0,0.64,0,0,1,0.8836,0,0.0001,0,0,1,0,0.0049,0,0,0.0025,0.3012,0.395892857,0.206507143,25,78.13,22,68.75,4,50,6,75,6,75,6,75,7,43.75,15,93.75,98.28,96.12,100,99.75,97.25,98.62,97.94,9.38,29.53,46.12,25,24.75,22.25,54.87,4.19,1,0,1,0,0,3,5,2,6,5,4,1,5,1,0,2,2,0,1,2,0,0,3,0,0,1,0,0,0,1,4,1,0,1,0,3,2,4,4,0,0.4,4.2,2.2,1.4,0.6,0.4,1.2,2.6,2.05,1.2,1.625,5.67,3.67,5.5,-0.2,3.8,1,-1.2,1.533333333,-2,5,3,0,2,-1,2,0,-2,2,1,-1,0,0,-1,1,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,47,great survey,0.625,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,8,5,2,6,4,9,3,1,7,3,4,2,1 +596,R_5jVXDLirMWeFO7r,32 - 38,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Agree,Strongly agree,3,1,5,4,2,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,5,1,2,4,Strongly Agree,Agree,Agree,Agree,Strongly Agree,4,5,1,3,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Somewhat disagree,1,5,3,4,2,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Agree,4,2,5,1,3,9,Somewhat agree,Strongly agree,Agree,Somewhat disagree,Agree,1,4,3,2,5,8,Strongly Agree,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,1,3,2,4,5,9,Somewhat agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,5,1,2,3,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Somewhat agree,Agree,2,5,4,1,3,9,Agree,Agree,Agree,Somewhat disagree,Somewhat agree,4,3,2,5,1,8,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,2,4,5,3,8,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,1,4,2,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,73,TRUE,89,FALSE,73,FALSE,91,TRUE,90,TRUE,94,FALSE,90,TRUE,87,TRUE,85,FALSE,89,TRUE,87,TRUE,78,TRUE,100,TRUE,74,TRUE,71,TRUE,76,TRUE,88,TRUE,79,FALSE,91,TRUE,79,FALSE,82,TRUE,95,FALSE,83,TRUE,84,FALSE,50,TRUE,79,TRUE,71,TRUE,68,TRUE,85,TRUE,58,FALSE,66,FALSE,79,11,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,3,1,3,3,2,3,3,2,2,2,3,3,2,3,3,-1,3,3,2,0,2,9,1,3,2,-1,2,8,3,3,2,2,0,9,1,3,2,2,0,9,2,2,3,1,2,9,2,2,2,-1,1,8,2,3,2,2,3,8,2,3,2,3,3,8,TRUE,0,73,TRUE,1,89,FALSE,1,73,FALSE,1,91,TRUE,1,90,TRUE,0,94,FALSE,0,90,TRUE,1,87,TRUE,1,85,FALSE,0,89,TRUE,0,87,TRUE,0,78,TRUE,1,100,TRUE,0,74,TRUE,1,71,TRUE,1,76,TRUE,0,88,TRUE,0,79,FALSE,1,91,TRUE,0,79,FALSE,0,82,TRUE,1,95,FALSE,1,83,TRUE,1,84,FALSE,1,50,TRUE,1,79,TRUE,0,71,TRUE,0,68,TRUE,0,85,TRUE,1,58,FALSE,0,66,FALSE,0,79,0.0169,0.0441,0.0576,0.81,0.6241,0.8836,0.0256,0.7921,0.6241,0.0025,0.1764,0,0.0225,0.7569,0.01,0.0121,0.0289,0.0081,0.4624,0.25,0.6724,0.0841,0.0081,0.5476,0.7744,0.5041,0.4356,0.5329,0.0729,0.6241,0.7225,0.6084,0.366657143,0.28335,0.449964286,11,34.38,16,50,5,62.5,3,37.5,3,37.5,5,62.5,11,68.75,5,31.25,80.75,81.38,87.62,78.62,75.38,82.5,79,-15.62,30.75,18.88,50.12,41.12,12.88,13.75,47.75,1,0,0,2,1,0,0,1,3,1,0,1,0,0,3,2,1,1,1,1,0,1,1,1,1,1,1,1,3,2,1,1,0,0,0,1,1,1,0,4,0.8,1,0.8,1.2,0.8,1.6,0.4,1.4,0.95,1.05,1,8.67,8.33,8.5,0,-0.6,0.4,-0.2,-0.066666667,0,0,1,1,0.34,1,1,2,-1,1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),37,greawt,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,2,5,9,8,4,7,6,1,3,2,4,3,1 +597,R_5d2frsq8ebtA2fn,53 - 59,American,,American,Male,Agree,Agree,Agree,Agree,Disagree,2,1,3,5,4,Disagree,Disagree,Agree,Disagree,Agree,5,4,1,3,2,Disagree,Disagree,Agree,Disagree,Agree,4,2,5,1,3,Disagree,Disagree,Disagree,Disagree,Disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Agree,Agree,Disagree,4,1,5,2,3,0,Disagree,Disagree,Agree,Disagree,Agree,5,3,2,4,1,0,Disagree,Disagree,Agree,Disagree,Agree,5,4,1,3,2,1,Disagree,Disagree,Disagree,Disagree,Disagree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Agree,Disagree,4,5,2,1,3,1,Disagree,Disagree,Agree,Disagree,Agree,4,5,1,3,2,1,Disagree,Disagree,Agree,Disagree,Agree,2,3,4,5,1,1,Disagree,Disagree,Disagree,Disagree,Disagree,3,1,4,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,72,TRUE,98,TRUE,93,FALSE,63,FALSE,100,TRUE,97,FALSE,100,TRUE,100,FALSE,100,TRUE,99,FALSE,83,FALSE,100,FALSE,77,TRUE,100,TRUE,77,FALSE,90,FALSE,74,FALSE,100,FALSE,86,FALSE,100,FALSE,84,FALSE,100,FALSE,95,TRUE,100,TRUE,86,FALSE,100,TRUE,100,FALSE,79,FALSE,98,TRUE,100,FALSE,94,24,2,2,2,2,-2,-2,-2,2,-2,2,-2,-2,2,-2,2,-2,-2,-2,-2,-2,2,2,2,2,-2,0,-2,-2,2,-2,2,0,-2,-2,2,-2,2,0,-2,-2,-2,-2,-2,1,2,2,2,2,-2,1,-2,-2,2,-2,2,1,-2,-2,2,-2,2,1,-2,-2,-2,-2,-2,1,FALSE,1,94,TRUE,1,100,FALSE,1,98,FALSE,1,79,TRUE,1,100,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,0,95,FALSE,0,100,FALSE,1,84,FALSE,1,100,FALSE,0,86,FALSE,1,100,FALSE,0,74,FALSE,0,90,TRUE,0,77,TRUE,0,100,FALSE,1,77,FALSE,1,100,FALSE,0,83,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,97,FALSE,1,100,FALSE,1,63,TRUE,0,93,TRUE,1,98,TRUE,1,72,TRUE,1,100,0,0.0009,0.81,0.0196,0,0,0,1,0,0.0001,0.0004,0.7396,0.9025,0.0256,0,0,0,0.0441,0.1369,0,0.6889,0.5476,0.0529,0,0.5929,0,0.0784,0.0036,0.0004,1,0.8649,0,0.238528571,0.193735714,0.283321429,24,75,23,71.88,6,75,4,50,6,75,7,87.5,10,62.5,13,81.25,92.03,85.12,92.38,97,93.62,92.5,91.56,3.12,20.15,10.12,42.38,22,6.12,30,10.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0.625,0,0,0,0,0,-1,-1,-1,0,-1,1,2,1,-2,2,-1,1,-1,1,-2,2,-1,20 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,,1.125,0,0,0,0,1,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,4,5,7,3,9,8,6,1,2,2,3,4,1 +598,R_7oA5PsZawq3t9en,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,5,4,3,1,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Agree,4,2,5,1,3,Somewhat Agree,Disagree,Strongly Agree,Somewhat Disagree,Agree,5,4,1,3,2,Disagree,Disagree,Disagree,Disagree,Strongly disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Disagree,2,4,5,3,1,6,Strongly disagree,Disagree,Somewhat disagree,Somewhat agree,Disagree,1,3,4,5,2,5,Somewhat Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,4,3,2,5,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,3,5,1,2,4,2,Neither agree nor disagree,Disagree,Strongly agree,Somewhat disagree,Agree,2,5,1,3,4,1,Agree,Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,4,5,3,1,8,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,4,1,2,3,TRUE,81,FALSE,50,TRUE,94,FALSE,50,TRUE,71,FALSE,85,TRUE,55,TRUE,86,TRUE,75,TRUE,90,FALSE,50,TRUE,83,TRUE,53,FALSE,52,FALSE,52,FALSE,53,FALSE,53,TRUE,72,FALSE,51,FALSE,52,FALSE,94,FALSE,51,FALSE,50,TRUE,92,FALSE,51,TRUE,95,FALSE,51,FALSE,52,TRUE,95,FALSE,52,FALSE,70,TRUE,98,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,1,-1,0,0,-2,2,0,2,1,-2,3,-1,2,-2,-2,-2,-2,-3,3,3,3,-2,-2,3,-3,-2,-1,1,-2,6,-1,-2,1,-1,1,5,-3,-3,-3,-3,-3,8,2,2,2,1,0,3,0,-2,3,-1,2,2,2,-2,3,-1,3,1,-2,-1,0,0,-1,8,TRUE,0,81,FALSE,0,50,TRUE,0,94,FALSE,1,50,TRUE,1,71,FALSE,1,85,TRUE,1,55,TRUE,1,86,TRUE,1,75,TRUE,1,90,FALSE,1,50,TRUE,0,83,TRUE,1,53,FALSE,1,52,FALSE,0,52,FALSE,0,53,FALSE,1,53,TRUE,0,72,FALSE,1,51,FALSE,1,52,FALSE,0,94,FALSE,0,51,FALSE,1,50,TRUE,1,92,FALSE,1,51,TRUE,1,95,FALSE,1,51,FALSE,1,52,TRUE,0,95,FALSE,0,52,FALSE,0,70,TRUE,1,98,0.0196,0.0025,0.2809,0.2025,0.0004,0.0225,0.0064,0.01,0.2304,0.2601,0.2704,0.2209,0.0625,0.25,0.0841,0.25,0.25,0.25,0.2304,0.2401,0.8836,0.2704,0.2401,0.2304,0.2209,0.2401,0.49,0.6561,0.8836,0.5184,0.9025,0.6889,0.316542857,0.154835714,0.47825,20,62.5,20,62.5,5,62.5,6,75,5,62.5,4,50,9,56.25,11,68.75,67.47,56.12,74.88,68.38,70.5,71.06,63.88,0,4.97,-6.38,-0.12,5.88,20.5,14.81,-4.87,1,1,2,1,2,3,0,3,1,4,2,0,2,0,1,1,1,1,1,0,0,0,1,2,0,0,0,1,1,0,1,0,0,0,1,0,1,2,2,2,1.4,2.2,1,0.8,0.6,0.4,0.4,1.4,1.35,0.7,1.025,4.67,2,4.5,0.8,1.8,0.6,-0.6,1.066666667,0,4,4,0,2.67,0,2,2,-2,2,0,0,0,0,-2,2,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,30,Interesting questions. Good luck with your research.,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,4,7,6,2,9,8,5,1,3,4,3,2,1 +599,R_7B3gNZyQnJYWSeO,39 - 45,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,5,4,3,1,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,5,3,1,4,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,1,4,2,3,Strongly disagree,Disagree,Disagree,Disagree,Somewhat disagree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,1,4,3,2,5,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,4,5,2,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,5,3,2,1,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,1,3,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,4,5,2,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,56,TRUE,96,TRUE,94,TRUE,65,FALSE,55,TRUE,78,FALSE,90,FALSE,50,TRUE,66,FALSE,50,FALSE,83,FALSE,87,FALSE,50,TRUE,88,FALSE,54,TRUE,87,FALSE,50,FALSE,83,TRUE,81,TRUE,77,FALSE,50,TRUE,70,TRUE,59,TRUE,93,TRUE,87,FALSE,57,TRUE,74,FALSE,50,FALSE,78,TRUE,90,FALSE,82,25,0,0,2,-2,1,0,0,1,0,2,1,0,1,1,0,-3,-2,-2,-2,-1,-1,-1,2,-1,2,5,1,0,0,0,1,5,1,1,1,1,1,5,-1,0,0,0,0,5,0,0,2,0,2,5,0,0,0,0,0,5,1,0,1,0,0,5,0,0,0,0,0,8,FALSE,1,82,TRUE,1,90,FALSE,1,78,FALSE,1,50,TRUE,1,74,FALSE,1,57,TRUE,1,87,TRUE,1,93,TRUE,1,59,TRUE,1,70,FALSE,1,50,TRUE,0,77,TRUE,1,81,FALSE,1,83,FALSE,0,50,TRUE,1,87,FALSE,1,54,TRUE,0,88,FALSE,1,50,FALSE,1,87,FALSE,0,83,FALSE,0,50,TRUE,0,66,FALSE,0,50,FALSE,1,90,TRUE,1,78,FALSE,1,55,TRUE,0,65,TRUE,0,94,TRUE,1,96,FALSE,0,56,TRUE,1,100,0.0049,0.0484,0.0169,0.0169,0,0.1849,0.25,0.09,0.0169,0.25,0.0016,0.0361,0.1681,0.25,0.0676,0.01,0.4356,0.25,0.4225,0.01,0.6889,0.25,0.25,0.0289,0.2116,0.2025,0.3136,0.0324,0.0484,0.7744,0.8836,0.5929,0.240017857,0.143628571,0.336407143,25,78.13,22,68.75,6,75,5,62.5,6,75,5,62.5,11,68.75,11,68.75,72.81,57.5,76.12,78.5,79.12,75.25,70.38,9.38,4.06,-17.5,13.62,3.5,16.62,6.5,1.63,1,1,0,1,1,1,0,1,0,1,0,1,0,0,1,2,2,2,2,1,0,0,0,2,1,0,0,1,0,2,0,0,0,1,0,3,2,2,2,1,0.8,0.6,0.4,1.8,0.6,0.6,0.2,2,0.9,0.85,0.875,5,5,5.375,0.2,0,0.2,-0.2,0.133333333,0,0,0,-3,0,1,1,1,-2,2,0,0,0,0,-1,1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,41,it was ok ,0.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,02REV,7,8,4,5,2,3,6,1,9,4,3,2,1 +600,R_6tldWtJsPKe7ccx,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,2,5,3,Strongly agree,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,3,1,5,4,2,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,Agree,Somewhat disagree,Disagree,Strongly Agree,Strongly Agree,2,5,1,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,5,3,2,4,10,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Strongly agree,3,5,1,2,4,10,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,2,5,3,1,5,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,2,5,1,4,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,2,5,3,4,10,Neither agree nor disagree,Somewhat disagree,Agree,Agree,Agree,5,2,3,1,4,3,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,3,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,5,2,1,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,98,TRUE,87,TRUE,79,TRUE,81,TRUE,69,TRUE,74,TRUE,75,TRUE,83,TRUE,65,TRUE,76,TRUE,100,FALSE,99,TRUE,70,TRUE,75,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,94,TRUE,99,TRUE,100,TRUE,100,FALSE,100,TRUE,88,TRUE,100,TRUE,99,FALSE,99,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,3,-1,3,3,3,2,0,3,3,3,2,-1,-2,3,3,3,3,3,2,3,10,1,0,1,2,3,10,0,3,3,-1,3,5,3,2,3,0,3,10,3,3,3,1,3,10,0,-1,2,2,2,3,1,3,3,3,3,10,3,3,3,3,-3,10,TRUE,0,100,TRUE,1,98,TRUE,0,87,TRUE,0,79,TRUE,1,81,TRUE,0,69,TRUE,1,74,TRUE,1,75,TRUE,1,83,TRUE,1,65,TRUE,0,76,TRUE,0,100,FALSE,0,99,TRUE,0,70,TRUE,1,75,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,94,TRUE,1,99,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,88,TRUE,0,100,TRUE,1,99,FALSE,0,99,TRUE,1,100,0.0625,0,0,0.0676,0,0.4761,0.0001,0.1225,0,0,0.0001,0.9801,0.0289,0.5776,0.0361,0.0004,0.8836,0.6241,0.7744,1,1,0.0625,0,0.49,0,0,0.9801,1,0.7569,0,1,1,0.421196429,0.2664,0.575992857,16,50,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,13,81.25,5,31.25,90.94,88.75,92.88,88.62,93.5,90.44,91.44,-6.25,34.69,26.25,55.38,26.12,31,9.19,60.19,0,0,0,0,0,2,1,2,1,0,2,3,0,4,0,1,3,5,3,0,0,0,0,1,0,3,0,1,1,1,1,3,0,0,0,1,4,5,0,6,0,1.2,1.8,2.4,0.2,1.2,0.8,3.2,1.35,1.35,1.35,8.33,7.67,8.5,-0.2,0,1,-0.8,0.266666667,0,7,-5,0,0.66,-1,2,1,-2,2,1,-1,2,-2,2,-2,2,10 cents,25 minutes,36 days,Female,College Diploma/Certificate,38,satisafactory,0.125,0,0,0,1,0,0,0,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,2,4,8,7,3,6,9,1,5,4,3,2,1 +601,R_1Kf4u6wyxvfsiK5,32 - 38,,Canadian,Canadian,Female,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,4,1,2,3,5,Neither agree nor disagree,Disagree,Agree,Somewhat agree,Somewhat agree,3,4,1,2,5,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,2,3,5,1,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,3,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,5,Strongly Agree,Agree,Agree,Agree,Agree,1,5,2,4,3,7,Agree,Agree,Agree,Agree,Agree,5,4,3,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly Agree,Strongly Agree,5,1,3,4,2,7,Neither agree nor disagree,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,3,2,1,5,4,7,Agree,Agree,Agree,Somewhat Disagree,Agree,2,5,4,1,3,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,80,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,75,TRUE,75,FALSE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,70,FALSE,50,TRUE,70,TRUE,70,FALSE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,85,TRUE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,50,16,0,1,1,3,3,0,-2,2,1,1,2,2,2,2,2,1,1,2,1,2,0,1,1,1,1,7,0,0,0,0,0,5,3,2,2,2,2,7,2,2,2,2,2,7,0,0,2,3,3,7,0,-3,2,0,1,7,2,2,2,-1,2,8,3,3,3,3,3,8,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,85,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,70,TRUE,0,70,FALSE,0,50,TRUE,1,70,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,75,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,0,80,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,0.0225,0.25,0.09,0,0,0,0.25,0.25,0.25,0.5625,0.25,0.09,0.25,0.25,0.25,0.25,0.25,0.25,0.64,1,0.0625,0.25,0.25,0.49,0.25,0.25,0.25,0.25,0,0,0.25,0,0.253392857,0.225178571,0.281607143,16,50,19,59.38,4,50,7,87.5,3,37.5,5,62.5,6,37.5,13,81.25,66.41,50,68.12,74.38,73.12,64.06,68.75,-9.38,7.03,0,-19.38,36.88,10.62,26.56,-12.5,0,0,0,2,2,0,2,2,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,3,0,2,2,1,2,1,0.8,1.2,0.2,0.6,0.4,0.4,0.6,1.6,0.7,0.75,0.725,6.33,7.33,7,0.4,0.8,-0.4,-1,0.266666667,0,-2,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,37,,0,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,6,8,3,4,2,9,7,1,5,4,3,2,1 +602,R_3dgnEiy0SXxuaGA,25 - 31,,Canadian,Canadian,Male,Agree,Agree,Somewhat disagree,Agree,Strongly agree,2,1,5,4,3,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,2,5,1,4,3,Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,1,3,4,2,5,Agree,Strongly Agree,Agree,Agree,Agree,1,5,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Somewhat disagree,Somewhat agree,Strongly Agree,3,2,4,1,5,0,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,3,5,1,2,4,0,Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,4,2,3,5,1,1,Agree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat agree,Agree,Disagree,Somewhat agree,Strongly Agree,5,3,1,2,4,1,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,1,3,4,5,2,0,Disagree,Strongly Disagree,Agree,Agree,Strongly agree,4,5,2,3,1,0,Agree,Somewhat agree,Agree,Agree,Agree,3,5,2,1,4,FALSE,95,TRUE,90,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,50,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,-1,2,3,2,-3,2,-3,3,-2,-3,2,-2,3,2,3,2,2,2,2,2,-1,1,3,0,2,-3,2,-3,3,0,-2,-3,2,-2,3,0,2,1,2,2,1,1,1,2,-2,1,3,0,2,-3,2,-3,3,1,-2,-3,2,2,3,0,2,1,2,2,2,0,FALSE,1,95,TRUE,1,90,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,0,50,FALSE,0,100,TRUE,1,50,TRUE,1,50,0,0.25,0,0,0.25,0.25,0.25,0,0,0,1,0,0,0,0,0.01,0,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,1,0.25,0.0025,0.25,0.25,0.25,1,0.232589286,0.143571429,0.321607143,20,62.5,24,75,6,75,6,75,7,87.5,5,62.5,12,75,12,75,76.09,73.75,68.75,80.62,81.25,80.62,71.56,-12.5,1.09,-1.25,-6.25,-6.88,18.75,5.62,-3.44,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,4,0,0,2,0,0,0,0.2,0,0,0.6,0.6,0,0.8,0.4,0.2,0.45,0.325,0,0.33,0.25,-0.4,0,-0.8,0.2,-0.4,0,-1,0,1,-0.33,1,1,2,-2,2,-1,1,-1,1,-2,2,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,30,stimulating!,1.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,9,8,3,4,5,6,2,1,7,2,3,4,1 +603,R_1NayeAJIS2Angtt,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,3,4,2,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,2,1,4,3,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,5,1,2,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,2,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,2,3,1,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,5,2,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,TRUE,77,TRUE,72,TRUE,71,TRUE,79,TRUE,89,TRUE,79,TRUE,85,TRUE,80,TRUE,79,TRUE,85,TRUE,78,TRUE,91,TRUE,88,TRUE,78,TRUE,88,TRUE,82,TRUE,78,TRUE,70,TRUE,78,TRUE,88,TRUE,81,TRUE,66,TRUE,72,TRUE,74,TRUE,79,TRUE,75,TRUE,76,TRUE,75,TRUE,77,TRUE,80,TRUE,75,27,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,0,3,6,3,3,3,3,3,7,3,3,3,3,3,7,3,3,3,3,3,6,3,3,3,3,3,6,3,3,3,3,3,8,3,3,3,3,3,7,TRUE,0,75,TRUE,1,80,TRUE,0,77,TRUE,0,75,TRUE,1,76,TRUE,0,75,TRUE,1,79,TRUE,1,74,TRUE,1,72,TRUE,1,66,TRUE,0,81,TRUE,0,88,TRUE,1,78,TRUE,0,70,TRUE,1,78,TRUE,1,82,TRUE,0,88,TRUE,0,78,TRUE,0,88,TRUE,0,91,TRUE,1,78,TRUE,1,85,TRUE,0,79,TRUE,1,80,TRUE,0,85,TRUE,1,79,TRUE,0,89,TRUE,0,79,TRUE,0,71,TRUE,1,72,TRUE,1,77,TRUE,1,85,0.0676,0.0441,0.0324,0.0441,0.0225,0.5625,0.04,0.1156,0.8281,0.0225,0.0784,0.0484,0.0784,0.6561,0.0576,0.04,0.6241,0.5625,0.6241,0.7225,0.0484,0.0484,0.7744,0.49,0.7744,0.7921,0.0529,0.5625,0.5929,0.6084,0.5041,0.7744,0.39665,0.266907143,0.526392857,27,84.38,16,50,4,50,4,50,4,50,4,50,16,100,0,0,79.06,80,78.75,77.12,80.38,77.56,80.56,34.38,29.06,30,28.75,27.12,30.38,-22.44,80.56,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0,0,0,0,0.3,0,0.15,5,6.67,6.125,0,1.2,0,0,0.4,-4,0,-1,0,-1.67,1,1,1,1,-1,1,-1,0,0,1,-1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,30,They survey was straightfoward and clear with well strucutred questions that tested criticla thinking skills.,0,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,01ITEM,02REV,3,7,4,6,8,2,9,1,5,4,2,3,1 +604,R_5cAaW06IpPj9KAZ,46 - 52,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Disagree,Strongly agree,2,5,4,1,3,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,1,4,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,1,3,2,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,5,4,3,1,2,Agree,Strongly Agree,Agree,Disagree,Strongly Agree,4,5,1,3,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Strongly agree,5,3,1,2,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,1,5,3,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,5,2,4,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Neither agree nor disagree,Strongly Agree,5,2,3,1,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,2,4,3,5,1,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,2,3,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,2,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,FALSE,50,TRUE,70,TRUE,50,FALSE,50,TRUE,50,TRUE,99,FALSE,50,TRUE,70,FALSE,50,TRUE,85,FALSE,50,FALSE,50,TRUE,50,FALSE,86,TRUE,50,TRUE,90,TRUE,50,TRUE,50,TRUE,97,FALSE,97,FALSE,50,FALSE,50,TRUE,50,TRUE,81,TRUE,75,FALSE,97,TRUE,50,TRUE,50,FALSE,75,TRUE,59,FALSE,50,26,2,3,2,-2,3,0,2,1,0,3,0,0,3,0,3,-2,-1,0,-1,-2,2,3,2,-2,3,2,0,0,1,-1,3,2,0,0,3,0,3,2,1,1,1,0,-2,9,2,3,2,0,3,2,0,0,0,0,2,1,0,3,3,0,3,1,0,0,0,0,0,3,FALSE,1,50,TRUE,1,59,FALSE,1,75,TRUE,0,50,TRUE,1,50,FALSE,1,97,TRUE,1,75,TRUE,1,81,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,97,TRUE,1,97,TRUE,0,50,TRUE,1,50,TRUE,1,90,TRUE,0,50,FALSE,1,86,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,85,FALSE,1,50,TRUE,1,70,FALSE,1,50,TRUE,1,99,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,FALSE,0,50,TRUE,1,91,0.0361,0.0001,0.01,0.0625,0.0081,0.0009,0.09,0.25,0.25,0.0225,0.09,0.0009,0.25,0.25,0.25,0.1681,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.0625,0.0196,0.25,0.0009,0.177267857,0.152178571,0.202357143,26,81.25,23,71.88,4,50,5,62.5,6,75,8,100,13,81.25,10,62.5,64.75,51.12,66.88,68.12,72.88,69.81,59.69,9.37,-7.13,1.12,4.38,-6.88,-27.12,-11.44,-2.81,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,3,2,1,1,0,0,0,0,2,0,0,2,1,0,1,0,3,0,0,0,2,1,0,1,2,0,0.6,0,1.4,0.4,0.8,0.6,1.2,0.5,0.75,0.625,2,1.33,2.75,-0.4,-0.2,-0.6,0.2,-0.4,0,1,1,6,0.67,1,2,2,-2,2,0,0,-1,1,-2,2,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,48,none,1.375,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,6,7,4,2,5,8,3,1,9,4,3,2,1 +605,R_5Hk8AWYo2ec0omN,53 - 59,American,,American,Female,Agree,Agree,Agree,Agree,Somewhat agree,2,4,5,1,3,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,4,1,2,3,5,Agree,Strongly Disagree,Agree,Disagree,Agree,1,5,2,4,3,Agree,Agree,Agree,Agree,Disagree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Agree,Somewhat agree,Disagree,Somewhat agree,4,5,2,3,1,9,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat disagree,2,5,4,3,1,6,Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Somewhat Agree,1,2,5,4,3,10,Strongly disagree,Disagree,Strongly disagree,Somewhat disagree,Strongly disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,4,2,3,1,1,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,2,4,1,3,5,2,Agree,Strongly Disagree,Agree,Strongly Disagree,Agree,5,2,4,3,1,2,Agree,Somewhat agree,Agree,Agree,Strongly disagree,2,3,4,1,5,TRUE,100,TRUE,100,TRUE,100,TRUE,77,TRUE,84,FALSE,100,TRUE,98,TRUE,100,TRUE,88,TRUE,99,FALSE,72,TRUE,100,TRUE,100,FALSE,100,FALSE,60,TRUE,98,FALSE,54,TRUE,100,TRUE,76,FALSE,100,TRUE,66,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,1,1,-3,2,-2,2,2,-3,2,-2,2,2,2,2,2,-2,2,2,1,-2,1,10,1,-3,2,-3,-1,9,2,-3,3,1,1,6,-3,-2,-3,-1,-3,10,2,2,3,2,3,3,2,-3,2,-3,3,1,2,-3,2,-3,2,2,2,1,2,2,-3,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,77,TRUE,1,84,FALSE,1,100,TRUE,1,98,TRUE,1,100,TRUE,1,88,TRUE,1,99,FALSE,1,72,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,60,TRUE,1,98,FALSE,1,54,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0.0004,0.0004,0,0,0,0.0001,0,0,0,0,0.0144,0.0784,0.0256,0,0,0.5929,0,0,0.1156,0.36,0.5776,0,0.2116,1,1,1,1,1,1,1,0.320578571,0.050814286,0.590342857,24,75,22,68.75,3,37.5,7,87.5,6,75,6,75,14,87.5,8,50,92.88,84.12,88,99.62,99.75,93.31,92.44,6.25,24.13,46.62,0.5,24.62,24.75,5.81,42.44,0,0,1,4,0,0,0,0,1,3,0,0,1,3,1,5,4,5,3,1,0,0,1,0,2,1,0,0,1,1,0,0,0,1,0,0,1,0,0,1,1,0.8,1,3.6,0.6,0.6,0.2,0.4,1.6,0.45,1.025,8.33,2,5.375,0.4,0.2,0.8,3.2,0.466666667,7,8,4,8,6.33,1,2,2,-1,1,2,-2,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,56,interesting,1,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,8,3,9,4,6,5,1,7,3,4,2,1 +606,R_7JXftDKPzQjEhGI,39 - 45,American,,American,Male,Strongly disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly disagree,4,1,5,3,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,3,1,2,4,5,Agree,Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,2,4,3,5,1,Agree,Agree,Neither agree nor disagree,Strongly Agree,Agree,2,3,1,4,5,Strongly disagree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,2,4,3,5,1,4,Strongly agree,Agree,Agree,Agree,Agree,1,3,5,2,4,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,5,3,1,4,2,5,Agree,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,1,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Agree,Strongly disagree,4,1,5,2,3,7,Strongly agree,Neither agree nor disagree,Agree,Agree,Agree,4,1,2,5,3,7,Agree,Strongly Agree,Agree,Somewhat Agree,Agree,5,3,4,1,2,8,Agree,Agree,Agree,Strongly Agree,Agree,3,4,5,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,55,TRUE,100,FALSE,50,TRUE,55,FALSE,94,FALSE,50,FALSE,50,TRUE,50,TRUE,86,FALSE,100,FALSE,95,FALSE,55,TRUE,100,FALSE,50,TRUE,50,FALSE,53,FALSE,50,TRUE,50,TRUE,56,FALSE,52,FALSE,50,FALSE,67,TRUE,62,FALSE,100,TRUE,71,FALSE,50,TRUE,53,FALSE,53,TRUE,64,TRUE,50,TRUE,100,7,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,3,0,-3,1,0,1,1,2,2,2,3,1,-1,2,2,0,3,2,-3,3,3,0,-3,4,3,2,2,2,2,6,1,1,1,2,1,5,2,3,1,1,1,5,-3,3,3,2,-3,7,3,0,2,2,2,7,2,3,2,1,2,8,2,2,2,3,2,5,TRUE,0,100,TRUE,1,55,TRUE,0,100,FALSE,1,50,TRUE,1,55,FALSE,1,94,FALSE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,86,FALSE,1,100,FALSE,1,95,FALSE,0,55,TRUE,0,100,FALSE,0,50,TRUE,1,50,FALSE,1,53,FALSE,1,50,TRUE,0,50,TRUE,0,56,FALSE,0,52,FALSE,0,50,FALSE,1,67,TRUE,1,62,FALSE,1,100,TRUE,1,71,FALSE,1,50,TRUE,0,53,FALSE,1,53,TRUE,1,64,TRUE,1,50,TRUE,1,100,0.25,0.0841,0.25,0.25,0,0.0036,0.1444,0.0196,0.3136,0.25,0.1296,0.3025,0.25,0,0.2025,0.2025,0.1089,0.25,0.2809,0,0.2704,0.25,0.25,1,0.2209,0.25,0.25,1,1,0.25,0.2209,0.0025,0.2651,0.155514286,0.374685714,7,21.88,20,62.5,6,75,6,75,4,50,4,50,10,62.5,10,62.5,66.28,56.88,66.12,75.88,66.25,59.38,73.19,-40.62,3.78,-18.12,-8.88,25.88,16.25,-3.12,10.69,0,0,0,0,0,2,2,1,1,0,1,1,2,1,2,0,1,1,2,1,0,0,0,2,0,2,0,1,1,0,0,1,1,0,3,0,0,2,0,0,0,1.2,1.4,1,0.4,0.8,1,0.4,0.9,0.65,0.775,5,7.33,5.875,-0.4,0.4,0.4,0.6,0.133333333,-3,-1,-3,0,-2.33,0,0,1,1,-1,-1,1,-2,2,0,0,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),43,none,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,7,8,3,6,4,9,5,1,2,3,4,2,1 +607,R_5ckmxcbDinSRtHz,46 - 52,American,,American,Male,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,5,4,3,1,2,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,2,3,1,Agree,Neither Agree nor Disagree,Strongly Disagree,Strongly Disagree,Agree,2,4,1,3,5,Agree,Agree,Agree,Agree,Agree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,1,5,4,3,2,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,2,3,1,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,4,1,3,1,Agree,Agree,Agree,Somewhat agree,Agree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,2,3,4,1,5,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,3,2,4,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Agree,1,4,5,2,3,1,Agree,Agree,Agree,Agree,Agree,4,5,2,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,83,FALSE,99,TRUE,53,TRUE,100,FALSE,100,TRUE,100,FALSE,56,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,82,FALSE,100,TRUE,100,FALSE,58,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,99,TRUE,100,FALSE,100,TRUE,56,FALSE,57,FALSE,100,TRUE,100,FALSE,58,23,3,1,1,1,3,0,-3,3,-3,3,2,0,-3,-3,2,2,2,2,2,2,3,2,1,1,3,1,1,-3,3,-3,3,1,3,0,3,-3,3,1,2,2,2,1,2,1,3,3,1,1,3,1,1,-3,3,-3,3,1,3,0,3,-3,2,1,2,2,2,2,2,1,FALSE,1,58,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,1,56,FALSE,1,100,TRUE,1,100,TRUE,1,99,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,58,TRUE,1,100,FALSE,1,100,FALSE,1,82,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,99,TRUE,0,83,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0001,0,0,0,0,0,0,1,0,0,0,0,1,0,0.1936,0,0.1936,0.1849,0.0001,0,0,0.3364,1,1,0,0.2809,1,0.1764,0,0.0324,0.6889,1,0.288828571,0.183721429,0.393935714,23,71.88,23,71.88,3,37.5,7,87.5,6,75,7,87.5,12,75,11,68.75,90.66,83.5,86.88,92.5,99.75,94.56,86.75,0,18.78,46,-0.62,17.5,12.25,19.56,18,0,1,0,0,0,1,0,0,0,0,1,0,6,0,1,0,0,0,1,0,0,2,0,0,0,1,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0.2,0.2,1.6,0.2,0.4,0.2,1.4,0,0.55,0.5,0.525,1,1,1,-0.2,0,0.2,0.2,0,0,0,0,0,0,0,1,0,-1,1,0,0,0,0,-1,1,-1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),50,it was an interesting survey,0.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,4,8,2,3,5,7,6,1,9,2,4,3,1 +608,R_6nacRReK5I8yOn7,46 - 52,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,4,3,2,1,Agree,Disagree,Agree,Somewhat Disagree,Agree,1,3,2,5,4,Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,Agree,Agree,Agree,Agree,Agree,4,1,2,5,3,5,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,1,5,4,3,6,Agree,Disagree,Agree,Disagree,Agree,3,1,4,2,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,1,3,2,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,5,Somewhat disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,2,1,4,5,5,Agree,Disagree,Agree,Somewhat Disagree,Agree,2,5,1,4,3,6,Agree,Agree,Agree,Agree,Agree,4,1,5,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,-1,-2,2,-1,1,2,-2,2,-1,2,2,2,2,2,2,2,2,2,2,2,5,-1,-2,2,-1,1,6,2,-2,2,-2,2,5,1,1,1,1,2,6,2,2,2,2,2,5,-1,-2,2,-1,0,5,2,-2,2,-1,2,6,2,2,2,2,2,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,0,1,1,1,1,1,0.464285714,0.142857143,0.785714286,30,93.75,19,59.38,5,62.5,4,50,5,62.5,5,62.5,14,87.5,5,31.25,100,100,100,100,100,100,100,34.37,40.62,37.5,50,37.5,37.5,12.5,68.75,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.8,0,0.2,0,0,0.25,0.05,0.15,5.33,5.33,5.375,0,-0.2,0.2,0.8,0,0,1,-1,1,0,0,2,2,-2,2,2,-2,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,52,,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,4,9,3,8,6,7,2,1,5,2,4,3,1 +609,R_51j4STDFM37GFno,32 - 38,American,,American,Female,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,4,1,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,3,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,3,1,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,1,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,100,TRUE,50,TRUE,50,FALSE,100,FALSE,76,TRUE,76,TRUE,73,TRUE,100,TRUE,73,TRUE,100,TRUE,100,FALSE,74,FALSE,78,TRUE,100,FALSE,100,TRUE,100,FALSE,75,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,78,FALSE,50,TRUE,72,FALSE,75,TRUE,100,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,-3,-3,-3,-3,-3,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,75,TRUE,0,100,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,0,76,TRUE,1,76,TRUE,1,73,TRUE,1,100,TRUE,0,73,TRUE,0,100,TRUE,1,100,FALSE,1,74,FALSE,0,78,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,75,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,78,FALSE,1,50,TRUE,0,72,FALSE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.0576,0.0484,0,0.5776,0,0,0.25,0,0.25,0.25,0,0,0.0729,0.5329,0.25,0.0625,0.25,0.25,0.5184,0,0,0.6084,0.0625,0.0676,0,0.25,0.25,1,1,1,0.0625,1,0.285275,0.154878571,0.415671429,16,50,20,62.5,4,50,8,100,4,50,4,50,11,68.75,9,56.25,78.91,65.5,84.38,84.75,81,78.5,79.31,-12.5,16.41,15.5,-15.62,34.75,31,9.75,23.06,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,2.4,0,0,3,2.4,0,0,3,1.35,1.35,1.35,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,2,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,nothing,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,5,6,3,8,9,2,7,1,4,4,2,3,1 +610,R_1Ez47sYA4mD0iDD,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,3,4,5,1,2,Strongly disagree,Somewhat disagree,Agree,Disagree,Disagree,2,4,3,1,5,Somewhat Agree,Strongly Agree,Agree,Disagree,Somewhat Agree,5,4,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,2,3,1,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat disagree,2,3,5,4,1,1,Strongly disagree,Disagree,Strongly agree,Disagree,Disagree,3,4,1,5,2,2,Somewhat Agree,Strongly Agree,Agree,Disagree,Somewhat Agree,4,2,3,5,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,Disagree,2,4,3,5,1,1,Strongly disagree,Somewhat disagree,Agree,Disagree,Disagree,5,4,3,1,2,1,Somewhat Agree,Strongly Agree,Agree,Disagree,Somewhat Agree,1,5,4,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,74,FALSE,95,FALSE,71,TRUE,98,FALSE,87,TRUE,59,TRUE,97,FALSE,98,TRUE,93,FALSE,76,TRUE,90,TRUE,90,TRUE,73,FALSE,87,FALSE,97,TRUE,82,TRUE,85,TRUE,85,TRUE,81,TRUE,73,FALSE,85,FALSE,75,TRUE,94,TRUE,76,TRUE,92,TRUE,85,FALSE,95,TRUE,62,TRUE,57,FALSE,100,TRUE,83,TRUE,91,14,3,3,-1,3,0,-3,-1,2,-2,-2,1,3,2,-2,1,3,3,3,3,3,3,3,1,3,-1,1,-3,-2,3,-2,-2,2,1,3,2,-2,1,2,3,3,3,3,3,1,3,3,-1,3,-2,1,-3,-1,2,-2,-2,1,1,3,2,-2,1,1,3,3,3,3,3,1,TRUE,0,91,TRUE,1,83,FALSE,1,100,TRUE,0,57,TRUE,1,62,FALSE,1,95,TRUE,1,85,TRUE,1,92,TRUE,1,76,TRUE,1,94,FALSE,1,75,FALSE,1,85,TRUE,1,73,TRUE,0,81,TRUE,1,85,TRUE,1,85,TRUE,0,82,FALSE,1,97,FALSE,1,87,TRUE,0,73,TRUE,1,90,TRUE,1,90,FALSE,1,76,TRUE,1,93,FALSE,1,98,TRUE,1,97,TRUE,0,59,FALSE,1,87,TRUE,0,98,FALSE,0,71,FALSE,0,95,FALSE,0,74,0.0064,0.0009,0.0225,0.0225,0.5476,0.0025,0.0049,0.0036,0.5329,0.01,0.5041,0.0729,0.0576,0.0625,0.1444,0.0289,0.0576,0.3249,0.0169,0.0004,0.01,0.0225,0.0169,0.6561,0.6724,0.3481,0.9025,0.8281,0,0.0009,0.9604,0.0225,0.243289286,0.168171429,0.318407143,14,43.75,22,68.75,5,62.5,5,62.5,6,75,6,75,13,81.25,9,56.25,83.94,77.12,81.25,91.62,85.75,84.06,83.81,-25,15.19,14.62,18.75,16.62,10.75,2.81,27.56,0,0,2,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6,0.4,0,0,0.4,0,0,0,0.25,0.1,0.175,1.67,1,1.25,0.2,0.4,0,0,0.2,0,1,1,0,0.67,0,1,0,0,0,0,0,1,-1,-1,1,2,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,47,"This was a different, interesting kind of survey.",0.375,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,2,3,6,8,5,7,9,1,4,4,2,3,1 +611,R_1dMxnugtrZ4FKc4,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,4,3,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,2,5,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,5,4,3,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,5,1,4,7,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,4,3,1,10,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,4,2,3,10,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,1,3,2,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,8,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Agree,3,4,1,2,5,TRUE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,81,TRUE,78,TRUE,80,TRUE,92,TRUE,100,TRUE,83,TRUE,81,TRUE,100,TRUE,50,TRUE,50,TRUE,63,TRUE,50,TRUE,50,TRUE,51,TRUE,50,TRUE,50,TRUE,68,TRUE,89,TRUE,94,TRUE,81,TRUE,100,TRUE,85,TRUE,96,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,3,2,3,2,3,3,3,9,2,3,3,3,3,7,1,3,3,3,3,10,2,3,2,3,3,10,3,3,3,2,2,8,3,3,3,3,3,10,3,3,3,3,3,10,3,3,2,1,2,8,TRUE,0,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,1,50,TRUE,1,50,TRUE,1,81,TRUE,0,78,TRUE,0,80,TRUE,1,92,TRUE,0,100,TRUE,1,83,TRUE,1,81,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,0,63,TRUE,1,50,TRUE,1,50,TRUE,0,51,TRUE,1,50,TRUE,0,50,TRUE,1,68,TRUE,0,89,TRUE,0,94,TRUE,0,81,TRUE,1,100,TRUE,1,85,TRUE,1,96,0.25,0.1024,0.0361,0,0.0016,0.25,0.25,0.0361,0.3969,0.25,0,0.0064,0.25,0.6084,0,0.25,0.2601,1,0.8836,0.25,0.25,0.0289,0.25,1,1,0.7921,0.0225,0.25,1,0.25,0.6561,0.64,0.386882143,0.25425,0.519514286,29,90.63,15,46.88,3,37.5,4,50,4,50,4,50,15,93.75,0,0,74.12,73.12,77.5,68.62,77.25,74.12,74.12,43.75,27.24,35.62,27.5,18.62,27.25,-19.63,74.12,0,1,0,0,0,1,0,0,1,0,2,0,0,0,1,1,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,2,0,0.2,0.4,0.6,0.6,0.4,0.2,0.2,0.6,0.45,0.35,0.4,8.67,9.33,9,-0.2,0.2,0.4,0,0.133333333,1,-3,0,2,-0.66,2,2,2,2,-2,2,-2,2,-2,2,-2,2,5 cents,100 minutes,36 days,Male,College Diploma/Certificate,35,,0,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,2,3,4,9,7,5,8,1,6,2,3,4,1 +612,R_5fASb8KCbKFlqxD,46 - 52,American,,American,Female,Agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,5,2,1,4,3,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,3,2,Somewhat Agree,Disagree,Agree,Disagree,Agree,5,2,4,1,3,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,5,4,3,1,2,5,Disagree,Disagree,Disagree,Somewhat agree,Somewhat agree,1,3,2,4,5,5,Somewhat Agree,Disagree,Agree,Disagree,Strongly Agree,1,3,4,2,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Agree,1,3,4,2,5,5,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,3,1,5,4,5,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,4,5,2,1,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,1,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,82,TRUE,50,FALSE,69,TRUE,50,TRUE,100,TRUE,58,TRUE,61,FALSE,100,TRUE,77,TRUE,100,FALSE,50,FALSE,100,FALSE,100,TRUE,57,TRUE,61,FALSE,50,TRUE,77,TRUE,76,TRUE,71,FALSE,100,TRUE,96,TRUE,62,FALSE,65,TRUE,80,FALSE,100,TRUE,55,TRUE,55,TRUE,81,TRUE,63,FALSE,100,20,2,3,3,-1,2,-2,-1,1,1,1,1,-2,2,-2,2,1,1,-1,-1,-2,3,3,3,-2,1,7,-2,-2,-2,1,1,5,1,-2,2,-2,3,5,1,1,1,1,-1,6,3,3,3,-1,2,5,-1,-1,2,-1,1,5,3,-1,2,-2,3,5,1,1,1,-1,-1,5,FALSE,1,100,TRUE,1,63,TRUE,0,81,TRUE,0,55,TRUE,1,55,FALSE,1,100,TRUE,1,80,FALSE,0,65,TRUE,1,62,TRUE,1,96,FALSE,1,100,TRUE,0,71,TRUE,1,76,TRUE,0,77,FALSE,0,50,TRUE,1,61,TRUE,0,57,FALSE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,77,FALSE,1,100,TRUE,1,61,TRUE,0,58,TRUE,1,100,TRUE,0,50,FALSE,1,69,TRUE,0,50,TRUE,1,82,TRUE,1,50,TRUE,1,100,0.4225,0,0.1521,0.04,0,0,0.1521,0.0016,0.25,0.0529,0.0324,0.0576,0.1444,0,0.2025,0.1369,0,0.3025,0.0961,0.3364,0,0.25,0,0.5929,0.3249,0.25,0.25,0,0.6561,0,0.25,0.5041,0.172978571,0.095207143,0.25075,20,62.5,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,74.88,66.25,79.75,86,67.5,73.62,76.12,-6.25,6.13,3.75,4.75,11,5,-13.88,26.12,1,0,0,1,1,0,1,3,0,0,0,0,0,0,1,0,0,2,2,1,1,0,0,0,0,1,0,1,2,0,2,1,0,0,1,0,0,2,0,1,0.6,0.8,0.2,1,0.2,0.8,0.8,0.6,0.65,0.6,0.625,5.67,5,5.375,0.4,0,-0.6,0.4,-0.066666667,2,0,0,1,0.67,-1,0,0,-2,2,-1,1,-1,1,2,-2,1,10 cents,25 minutes,24 days,Female,High School (or equivalent),50,i enjoyed this survey. ,0.25,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,2,5,6,8,4,3,7,1,9,4,3,2,1 +613,R_7D7xN24lmXDg2r9,46 - 52,American,,American,Male,Neither agree nor disagree,Agree,Strongly agree,Agree,Agree,3,5,4,2,1,Agree,Strongly agree,Agree,Strongly agree,Agree,4,3,1,5,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,1,2,5,4,3,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,1,4,3,5,2,Neither agree nor disagree,Agree,Strongly Agree,Strongly Agree,Agree,2,1,4,3,5,5,Somewhat agree,Agree,Agree,Agree,Agree,4,1,3,5,2,6,Strongly Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,4,5,3,2,6,Agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,1,3,2,5,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,3,2,1,4,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,4,1,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,4,1,5,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,3,4,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,88,FALSE,63,TRUE,100,TRUE,61,FALSE,90,TRUE,94,TRUE,98,TRUE,78,FALSE,72,FALSE,100,TRUE,80,TRUE,74,FALSE,97,TRUE,84,FALSE,100,TRUE,69,TRUE,58,TRUE,68,TRUE,90,TRUE,70,FALSE,76,TRUE,77,FALSE,82,TRUE,83,TRUE,79,TRUE,100,FALSE,86,FALSE,72,FALSE,86,TRUE,100,FALSE,77,TRUE,98,24,0,2,3,2,2,2,3,2,3,2,0,1,1,2,1,1,-1,0,1,-2,0,2,3,3,2,5,1,2,2,2,2,6,-3,0,0,1,0,6,2,3,2,2,0,9,1,1,0,1,0,6,1,0,1,0,1,6,1,1,1,1,1,6,1,1,0,1,1,6,TRUE,0,98,FALSE,0,77,TRUE,0,100,FALSE,1,86,FALSE,0,72,FALSE,1,86,TRUE,1,100,TRUE,1,79,TRUE,1,83,FALSE,0,82,TRUE,0,77,FALSE,1,76,TRUE,1,70,TRUE,0,90,TRUE,1,68,TRUE,1,58,TRUE,0,69,FALSE,1,100,TRUE,0,84,FALSE,1,97,TRUE,1,74,TRUE,1,80,FALSE,1,100,FALSE,0,72,TRUE,0,78,TRUE,1,98,TRUE,0,94,FALSE,1,90,TRUE,0,61,TRUE,1,100,FALSE,0,63,TRUE,1,88,0.0441,0.0004,0.1764,0,0.0144,0.0196,0.5184,0.6724,0.0009,0.04,0,0.09,0.0289,0.5929,0.5184,0.5929,0,0.0196,0.01,0.6084,0.0676,0.1024,0.7056,0.81,0.4761,0.8836,0.3969,0.9604,1,0,0.3721,0.0576,0.341396429,0.222028571,0.460764286,24,75,18,56.25,3,37.5,5,62.5,4,50,6,75,11,68.75,7,43.75,82.81,79,77.5,90.75,84,79,86.62,18.75,26.56,41.5,15,40.75,9,10.25,42.87,0,0,0,1,0,1,1,0,1,0,3,1,1,1,1,1,4,2,1,2,1,1,3,1,2,1,3,1,3,1,1,0,0,1,0,0,2,0,0,3,0.2,0.6,1.4,2,1.6,1.8,0.4,1,1.05,1.2,1.125,5.67,6,6.25,-1.4,-1.2,1,1,-0.533333333,-1,0,0,3,-0.33,0,2,2,2,-2,2,-2,1,-1,1,-1,2,10 cents,5 minutes,24 days,Male,University - PhD,46,I really liked this survey it was fun to take.,0,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,7,2,3,9,8,6,5,1,4,4,3,2,1 +614,R_3CUEy5WMiVcl5hL,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,2,3,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,3,5,1,2,4,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly Agree,3,5,2,1,4,Agree,Agree,Agree,Strongly Agree,Agree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,5,4,1,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,4,1,5,3,2,1,Somewhat Agree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,3,4,2,1,4,Agree,Somewhat agree,Agree,Strongly Agree,Agree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,3,2,4,5,1,Strongly disagree,Disagree,Agree,Disagree,Strongly agree,4,1,3,2,5,1,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,5,2,1,4,3,4,Agree,Somewhat agree,Agree,Strongly Agree,Agree,3,5,4,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,74,TRUE,90,TRUE,100,FALSE,94,TRUE,70,TRUE,100,FALSE,100,TRUE,92,FALSE,100,TRUE,98,TRUE,100,FALSE,100,TRUE,71,TRUE,100,FALSE,92,TRUE,92,TRUE,88,FALSE,95,TRUE,98,TRUE,86,FALSE,94,TRUE,98,TRUE,98,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,75,TRUE,76,FALSE,100,27,3,3,3,3,3,-3,-1,1,-1,3,1,-1,2,-1,3,2,2,2,3,2,3,3,3,3,3,0,-3,-1,2,-1,3,1,1,-2,3,-1,3,1,2,1,2,3,2,4,2,3,3,3,2,1,-3,-2,2,-2,3,1,1,-2,3,-2,3,1,2,1,2,3,2,4,FALSE,1,100,TRUE,1,76,FALSE,1,75,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,98,FALSE,1,94,TRUE,0,86,TRUE,1,98,FALSE,1,95,TRUE,1,88,TRUE,1,92,FALSE,1,92,TRUE,0,100,TRUE,0,71,FALSE,1,100,TRUE,1,100,TRUE,1,98,FALSE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,0,70,FALSE,1,94,TRUE,0,100,TRUE,1,90,TRUE,1,74,TRUE,1,100,0,0,0.0064,0,0,0,0.0064,0.0004,0,0.0004,0.01,0.0004,0.0004,0.0036,0,0.0576,0,0.25,0.0036,0,0,0.0144,0.5041,0.0025,0.0064,0.49,0.0676,0,0.0625,1,1,0.7396,0.150710714,0.023514286,0.277907143,27,84.38,26,81.25,5,62.5,7,87.5,7,87.5,7,87.5,16,100,10,62.5,91.59,77.62,98.75,98.88,91.12,94,89.19,3.13,10.34,15.12,11.25,11.38,3.62,-6,26.69,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,0,0.2,0.4,0.2,0.4,0.6,0.6,0.2,0.2,0.45,0.325,0.67,1,1.625,-0.4,-0.4,-0.2,0,-0.333333333,-1,0,0,0,-0.33,1,2,2,-2,2,1,-1,1,-1,-2,2,2,5 cents,5 minutes,47 days,Female,University - Undergraduate,51,I want to know how many I got right! But this survey was fun and unique.,1.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,9,5,6,8,3,2,4,1,7,2,4,3,1 +615,R_7DA0CusRVJLhNBr,39 - 45,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,3,1,5,2,4,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,4,3,1,5,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,1,4,5,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,5,1,2,Agree,Agree,Somewhat agree,Somewhat agree,Strongly disagree,4,5,1,2,3,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,3,2,1,4,5,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,Disagree,Somewhat Agree,3,1,2,4,5,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,1,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,5,4,5,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,2,4,1,5,5,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,2,3,4,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,52,TRUE,52,FALSE,50,FALSE,50,TRUE,53,TRUE,51,TRUE,51,TRUE,78,TRUE,50,TRUE,50,TRUE,51,TRUE,54,TRUE,50,TRUE,53,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,52,TRUE,50,6,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,1,-3,-2,0,1,0,1,0,-1,1,-1,1,-3,-3,-3,-3,-3,2,2,1,1,-3,5,-3,0,0,0,1,5,0,-3,1,-2,1,5,-3,-3,-3,-3,-3,5,1,1,1,1,1,5,-2,0,0,0,1,5,-1,-1,1,-1,0,5,0,0,0,0,0,5,TRUE,0,52,TRUE,1,52,FALSE,1,50,FALSE,1,50,TRUE,1,53,TRUE,0,51,TRUE,1,51,TRUE,1,78,TRUE,1,50,TRUE,1,50,TRUE,0,51,TRUE,0,54,TRUE,1,50,TRUE,0,53,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,52,TRUE,1,50,0.0484,0.25,0.25,0.2401,0.25,0.2601,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2601,0.2209,0.2304,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.25,0.25,0.2304,0.2704,0.25,0.25,0.25,0.2916,0.2516,0.247964286,0.255235714,6,18.75,22,68.75,6,75,5,62.5,5,62.5,6,75,16,100,6,37.5,51.47,50.62,50.5,50.75,54,52.25,50.69,-50,-17.28,-24.38,-12,-11.75,-21,-47.75,13.19,1,1,0,0,0,1,0,1,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,4,0,0,1,0,0,1,0,0,0,1,3,3,3,3,3,0.4,0.4,0.6,0,0.8,0.2,0.4,3,0.35,1.1,0.725,5,5,5,-0.4,0.2,0.2,-3,0,0,0,0,0,0,1,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),39,it was ok,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,3,7,2,4,5,8,9,1,6,3,4,2,1 +616,R_5OjN5p4s72spH8M,39 - 45,,Canadian,Canadian,Male,Agree,Agree,Somewhat agree,Disagree,Somewhat agree,4,3,1,5,2,Somewhat agree,Disagree,Agree,Disagree,Agree,3,1,5,2,4,Disagree,Disagree,Agree,Disagree,Somewhat Agree,3,4,1,2,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Disagree,Agree,4,1,2,3,5,2,Somewhat agree,Disagree,Agree,Disagree,Agree,1,5,2,3,4,2,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Disagree,Somewhat Agree,4,5,1,2,3,2,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Somewhat disagree,Somewhat agree,5,1,4,2,3,2,Agree,Disagree,Agree,Disagree,Agree,4,5,2,1,3,2,Somewhat Disagree,Somewhat Disagree,Agree,Strongly Disagree,Somewhat Agree,2,3,4,1,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,3,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,85,TRUE,100,TRUE,100,FALSE,95,TRUE,93,TRUE,95,FALSE,100,FALSE,95,FALSE,98,TRUE,100,TRUE,90,FALSE,96,FALSE,84,FALSE,89,TRUE,97,TRUE,100,FALSE,62,TRUE,100,TRUE,100,TRUE,89,FALSE,91,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,84,TRUE,100,TRUE,100,TRUE,100,29,2,2,1,-2,1,1,-2,2,-2,2,-2,-2,2,-2,1,1,1,2,1,-1,2,2,2,-2,2,1,1,-2,2,-2,2,2,-1,-1,2,-1,1,2,0,2,1,0,-1,2,2,2,2,-1,1,2,2,-2,2,-2,2,2,-1,-1,2,-3,1,2,1,1,1,1,-1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,91,TRUE,0,89,TRUE,1,100,TRUE,0,100,FALSE,0,62,TRUE,1,100,TRUE,0,97,FALSE,1,89,FALSE,1,84,FALSE,1,96,TRUE,1,90,TRUE,1,100,FALSE,1,98,FALSE,0,95,FALSE,1,100,TRUE,1,95,TRUE,0,93,FALSE,1,95,TRUE,0,100,TRUE,1,100,TRUE,1,85,TRUE,1,100,0,0.0025,0,0,0,0,0.9025,0,0.0016,0,0,0,0,0.0081,0,0,0.0004,0.7056,0.0025,0,0.01,0.3844,0.0256,1,0.9409,0.8649,0.0225,1,1,0.0121,1,0.7921,0.309757143,0.115585714,0.503928571,29,90.63,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,95.09,87.38,98.12,98,96.88,95.44,94.75,21.88,26.34,24.88,23.12,23,34.38,7.94,44.75,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,0.4,0,0.6,0.8,0.4,0.2,0.6,0.2,0.45,0.35,0.4,1.67,2,1.875,0,-0.2,0,0.6,-0.066666667,-1,0,0,0,-0.33,2,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),42,"I have no real feedback except for the fact that, I first attempted to simply skip this question I am dealing with now, only to find a 'warning' popped up. This warning pop up device could prove misleading to some, and therefor should be abandoned in order to protect the validity of the research, as the pop up itself is good and valid reason for someone to question it, as leading.",1.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,6,5,9,2,7,8,3,1,4,2,3,4,1 +617,R_3KZ8crIbT1lOYdB,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,1,3,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,5,1,3,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,3,1,2,5,4,Somewhat agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,4,1,2,3,5,Strongly Agree,Agree,Agree,Agree,Strongly Agree,1,3,4,2,5,10,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Agree,4,1,5,3,2,9,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,4,1,3,2,5,8,Agree,Somewhat agree,Strongly Agree,Agree,Somewhat agree,5,4,1,2,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,9,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,5,1,3,10,Somewhat Agree,Agree,Agree,Agree,Strongly Agree,4,2,5,3,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,1,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,60,TRUE,100,TRUE,100,TRUE,100,FALSE,51,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,69,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,99,FALSE,93,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,1,0,1,1,1,1,2,2,1,1,1,3,2,2,0,3,2,2,2,3,10,0,2,1,1,2,9,1,3,1,2,1,8,2,1,3,2,1,8,3,2,3,3,3,9,3,-3,3,-3,3,10,1,2,2,2,3,10,3,3,3,3,3,10,TRUE,0,100,FALSE,0,60,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,51,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,69,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,99,FALSE,0,93,TRUE,1,100,0,0,0,0,0,0.2401,1,1,0,0,0.0001,0,0,0,0,0.36,0,1,1,0,1,0,0,0.0961,0,0,0.8649,1,1,1,1,1,0.4129,0.257157143,0.568642857,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,96,94.12,93.88,96.12,99.88,97,95,-12.5,33.5,31.62,18.88,33.62,49.88,28.25,38.75,0,1,1,0,0,1,2,0,0,1,0,1,1,1,0,1,2,1,0,1,0,1,0,1,0,2,3,2,4,2,0,0,0,1,2,2,0,1,1,3,0.4,0.8,0.6,1,0.4,2.6,0.6,1.4,0.7,1.25,0.975,9,9.67,9.25,0,-1.8,0,-0.4,-0.6,1,-1,-2,-2,-0.67,2,2,1,-1,1,2,-2,1,-1,1,-1,1,15 cents,100 minutes,24 days,Female,University - Undergraduate,34,i love learning thank you for this experience,0.375,0,0,0,0,1,1,0,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,6,9,3,2,8,5,4,1,7,2,4,3,1 +618,R_1Gic3Mg1IiLYIzn,39 - 45,American,,American,Male,Somewhat disagree,Agree,Strongly agree,Agree,Somewhat agree,2,4,1,3,5,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,5,2,4,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,1,4,2,5,3,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,2,4,1,5,3,2,Agree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,4,3,1,2,5,Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,3,4,5,4,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,4,2,3,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,1,3,5,2,7,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,5,1,3,6,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,1,2,4,5,3,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,3,2,4,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,72,FALSE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,100,FALSE,100,TRUE,63,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,3,2,1,1,-2,1,0,0,2,0,3,-1,3,-1,-1,-1,0,-2,0,3,3,2,0,2,2,-2,1,-1,0,5,2,2,3,-1,3,4,-1,0,0,0,-2,6,0,3,3,3,2,7,2,-1,1,1,0,6,3,3,3,-2,3,4,1,1,0,1,-1,7,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,72,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,0,50,FALSE,1,100,FALSE,1,100,TRUE,1,63,FALSE,0,50,TRUE,1,100,0,0.25,0,0,0,0,0.25,0.0784,0,0,0.1369,0,0,0.25,0,0,0,0.25,0,0,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0,0.25,0.150546429,0.06895,0.232142857,16,50,24,75,4,50,8,100,6,75,6,75,13,81.25,11,68.75,77.66,62.5,93.75,71.5,82.88,83.44,71.88,-25,2.66,12.5,-6.25,-3.5,7.88,2.19,3.13,1,1,0,0,1,1,0,0,1,0,0,2,0,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,1,0,1,3,0,1,0,2,2,1,1,1,0.6,0.4,0.4,0.4,0.8,0.6,1,1.4,0.45,0.95,0.7,3.67,5.67,5.125,-0.2,-0.2,-0.6,-1,-0.333333333,-5,-1,0,-1,-2,2,2,1,-2,2,0,0,-2,2,-2,2,0,5 cents,5 minutes,24 days,Male,High School (or equivalent),42,"I enjoyed that the survey tested my brain. I am not sure how many I got right but regardless, it was fun doing something that took more thought process than most surveys.",1.375,1,1,0,0,0,1,0.67,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,8,9,5,3,2,4,7,1,6,4,3,2,1 +619,R_74ocXQ0S1nX87vz,46 - 52,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,4,1,3,2,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,3,1,5,2,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,5,3,4,2,1,9,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,3,5,2,10,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,2,5,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,1,2,9,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,2,3,5,1,10,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,5,2,10,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,FALSE,96,TRUE,100,TRUE,70,FALSE,69,FALSE,64,FALSE,58,FALSE,69,TRUE,67,FALSE,60,FALSE,59,FALSE,60,TRUE,100,TRUE,96,TRUE,100,FALSE,67,TRUE,79,FALSE,87,FALSE,73,FALSE,67,TRUE,69,FALSE,69,TRUE,66,FALSE,70,FALSE,66,TRUE,74,TRUE,69,TRUE,83,TRUE,70,TRUE,74,30,3,3,3,2,3,3,3,3,2,3,2,2,3,3,3,2,3,3,3,3,3,3,2,3,3,10,3,3,3,2,3,9,3,2,3,3,3,10,3,3,3,3,2,10,3,2,3,3,3,10,3,3,3,2,3,9,3,2,3,3,3,10,2,3,3,3,3,10,TRUE,0,74,TRUE,1,70,TRUE,0,83,TRUE,0,69,TRUE,1,74,FALSE,1,66,FALSE,0,70,TRUE,1,66,FALSE,0,69,TRUE,1,69,FALSE,1,67,FALSE,1,73,FALSE,0,87,TRUE,0,79,FALSE,0,67,TRUE,1,100,TRUE,0,96,TRUE,0,100,FALSE,1,60,FALSE,1,59,FALSE,0,60,TRUE,1,67,FALSE,1,69,FALSE,0,58,FALSE,1,64,FALSE,0,69,TRUE,0,70,TRUE,0,100,FALSE,1,96,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.1156,0.4761,0,0.49,0,0.1156,0.3364,0.0961,0.1681,0.1089,0,0.7569,0.4761,0.1089,0.0676,0.09,0.0961,0.4761,1,0.1296,0.36,0.4489,0.16,0.6241,0.9216,0.49,1,0.5476,0.6889,1,0.0016,0.0729,0.369357143,0.206914286,0.5318,30,93.75,16,50,3,37.5,5,62.5,3,37.5,5,62.5,8,50,8,50,76.59,71.5,81,74,79.88,76.62,76.56,43.75,26.59,34,18.5,36.5,17.38,26.62,26.56,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.4,0,0.2,0.4,0.4,0,0.2,0,0.25,0.15,0.2,9.67,9.67,9.75,0,0,0,0.4,0,0,0,0,0,0,2,1,1,2,-2,1,-1,2,-2,2,-2,2,10 cents,75 minutes,15 days,Male,High School (or equivalent),46,easy survey,-0.125,0,0,0,1,0,0,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,4,2,7,3,5,8,9,1,6,3,4,2,1 +620,R_7V9lOXSXlzNyyzL,46 - 52,American,,American,Male,Somewhat agree,Neither agree nor disagree,Strongly disagree,Somewhat agree,Somewhat agree,5,3,2,4,1,Strongly disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,1,5,2,3,4,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,3,2,4,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,3,2,1,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,3,1,4,Strongly disagree,Strongly disagree,Agree,Strongly agree,Neither agree nor disagree,2,5,4,1,3,5,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,5,3,2,4,1,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,4,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Neither agree nor disagree,Strongly disagree,Strongly Agree,Somewhat agree,3,2,1,4,5,4,Strongly disagree,Strongly disagree,Agree,Agree,Neither agree nor disagree,3,2,4,1,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Agree,5,2,1,3,4,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,1,2,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,80,TRUE,100,FALSE,100,FALSE,50,TRUE,90,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,80,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,77,TRUE,90,TRUE,100,TRUE,100,TRUE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,0,-3,1,1,-3,0,2,1,0,2,3,3,0,2,-3,-3,-3,-3,-3,-1,2,1,1,1,4,-3,-3,2,3,0,5,3,1,3,2,3,5,-3,-3,-3,-3,-3,2,1,0,-3,3,1,4,-3,-3,2,2,0,3,3,3,3,-2,2,2,-3,-3,-3,-3,-3,3,TRUE,0,80,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,77,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0.01,0,0,0.25,0.81,0,0,0,0.64,1,0,0.5929,0,0.64,0,1,1,0,0.221175,0.036428571,0.405921429,25,78.13,25,78.13,6,75,7,87.5,5,62.5,7,87.5,16,100,9,56.25,94.28,82.12,98.75,97.5,98.75,99.38,89.19,0,16.15,7.12,11.25,35,11.25,-0.62,32.94,2,2,4,0,0,0,3,0,2,0,1,2,0,2,1,0,0,0,0,0,0,0,0,2,0,0,3,0,1,0,1,0,0,2,0,0,0,0,0,0,1.6,1,1.2,0,0.4,0.8,0.6,0,0.95,0.45,0.7,4.67,3,3.5,1.2,0.2,0.6,0,0.666666667,0,2,3,-1,1.67,0,-2,2,0,0,-2,2,2,-2,-2,2,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,50,no feedback.,0.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,7,9,2,8,5,3,4,1,6,4,3,2,1 +621,R_6oB9NiPV5S5aljA,32 - 38,American,,American,Male,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,4,2,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,1,3,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,3,1,4,2,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,2,4,3,1,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,1,5,3,2,7,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,2,5,3,1,4,9,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Agree,1,2,3,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Agree,Strongly Agree,Neither agree nor disagree,2,5,1,4,3,8,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,2,4,1,5,7,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,4,2,1,3,5,8,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,1,5,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,91,TRUE,79,TRUE,80,TRUE,83,FALSE,87,TRUE,80,TRUE,85,TRUE,68,TRUE,72,FALSE,78,TRUE,72,FALSE,73,TRUE,75,TRUE,78,TRUE,77,TRUE,76,TRUE,78,FALSE,77,TRUE,75,TRUE,81,TRUE,88,TRUE,71,FALSE,75,TRUE,88,TRUE,72,FALSE,76,TRUE,76,TRUE,74,FALSE,69,TRUE,73,TRUE,67,FALSE,88,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,0,1,0,1,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,-1,2,-1,0,7,1,2,0,0,0,7,0,0,2,0,2,9,1,0,0,3,2,7,0,2,2,3,0,8,1,0,2,0,2,7,3,1,0,0,3,8,1,2,2,1,0,7,TRUE,0,91,TRUE,1,79,TRUE,0,80,TRUE,0,83,FALSE,0,87,TRUE,0,80,TRUE,1,85,TRUE,1,68,TRUE,1,72,FALSE,0,78,TRUE,0,72,FALSE,1,73,TRUE,1,75,TRUE,0,78,TRUE,1,77,TRUE,1,76,TRUE,0,78,FALSE,1,77,TRUE,0,75,TRUE,0,81,TRUE,1,88,TRUE,1,71,FALSE,1,75,TRUE,1,88,TRUE,0,72,FALSE,0,76,TRUE,0,76,TRUE,0,74,FALSE,1,69,TRUE,1,73,TRUE,1,67,FALSE,0,88,0.1024,0.5776,0.0576,0.0225,0.7744,0.64,0.0144,0.6084,0.6561,0.0841,0.0729,0.0625,0.0784,0.5184,0.7569,0.0441,0.0625,0.6889,0.5476,0.5184,0.0144,0.0529,0.5625,0.6084,0.6084,0.5776,0.1089,0.8281,0.64,0.0529,0.0961,0.0729,0.369682143,0.361571429,0.377792857,17,53.13,16,50,4,50,4,50,3,37.5,5,62.5,12,75,4,25,77.56,75.12,80,78.5,76.62,78,77.12,3.13,27.56,25.12,30,41,14.12,3,52.12,2,3,2,2,0,0,2,1,0,1,0,0,2,1,0,0,1,0,3,0,3,0,2,2,0,0,0,1,0,1,3,1,0,1,1,0,1,2,1,2,1.8,0.8,0.6,0.8,1.4,0.4,1.2,1.2,1,1.05,1.025,7.67,7.67,7.5,0.4,0.4,-0.6,-0.4,0.066666667,-1,0,1,0,0,2,1,1,1,-1,0,0,2,-2,1,-1,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,34,none,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,8,4,6,5,7,3,2,1,9,2,4,3,1 +622,R_1ovEWvomQ23gvPv,53 - 59,American,,American,Female,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,4,3,Somewhat agree,Disagree,Agree,Somewhat agree,Somewhat agree,1,2,3,4,5,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,2,5,3,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Somewhat agree,Somewhat agree,Agree,4,1,3,5,2,6,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,4,2,1,5,3,6,Agree,Agree,Agree,Somewhat Agree,Agree,1,5,4,2,3,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Somewhat agree,Agree,Agree,3,2,5,1,4,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,1,5,6,Agree,Agree,Agree,Somewhat Agree,Agree,2,3,4,5,1,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,2,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,76,TRUE,73,TRUE,86,TRUE,91,FALSE,80,FALSE,91,TRUE,91,FALSE,95,TRUE,92,FALSE,89,FALSE,87,FALSE,69,FALSE,90,TRUE,86,FALSE,91,FALSE,82,TRUE,89,TRUE,57,TRUE,85,TRUE,73,TRUE,77,TRUE,71,FALSE,73,TRUE,78,TRUE,83,TRUE,80,FALSE,79,FALSE,55,FALSE,57,FALSE,58,TRUE,65,FALSE,87,20,2,2,1,1,1,1,-2,2,1,1,2,1,2,0,2,0,-1,1,-1,-2,2,2,1,1,2,5,1,0,2,1,1,6,2,2,2,1,2,6,-1,-1,1,0,-2,6,2,2,1,2,2,6,1,-1,1,1,1,6,2,2,2,1,2,6,1,1,0,1,-1,6,FALSE,1,87,TRUE,1,65,FALSE,1,58,FALSE,1,57,FALSE,0,55,FALSE,1,79,TRUE,1,80,TRUE,1,83,TRUE,1,78,FALSE,0,73,TRUE,0,71,TRUE,0,77,TRUE,1,73,TRUE,0,85,TRUE,1,57,TRUE,1,89,FALSE,1,82,FALSE,1,91,TRUE,0,86,FALSE,1,90,FALSE,0,69,FALSE,0,87,FALSE,1,89,TRUE,1,92,FALSE,1,95,TRUE,1,91,FALSE,1,91,FALSE,1,80,TRUE,0,91,TRUE,1,86,TRUE,1,73,TRUE,1,76,0.0289,0.0081,0.0121,0.04,0.0576,0.0441,0.0064,0.5329,0.01,0.7569,0.0196,0.0729,0.0484,0.5041,0.3025,0.1225,0.0121,0.1849,0.04,0.0025,0.4761,0.1849,0.7396,0.7225,0.0324,0.0081,0.0729,0.0169,0.1764,0.0081,0.8281,0.5929,0.234867857,0.191064286,0.278671429,20,62.5,23,71.88,6,75,5,62.5,5,62.5,7,87.5,12,75,11,68.75,79.25,72.25,76.75,86.12,81.88,76.69,81.81,-9.38,7.37,-2.75,14.25,23.62,-5.62,1.69,13.06,0,0,0,0,1,0,2,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,0,1,2,1,2,1,0.2,0.4,0.4,0.4,0.4,0.4,0.4,1.4,0.35,0.65,0.5,5.67,6,5.875,-0.2,0,0,-1,-0.066666667,-1,0,0,0,-0.33,1,1,1,-2,2,1,-1,0,0,-1,1,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,54,,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,8,6,9,4,5,2,3,1,7,3,2,4,1 +623,R_6NUiy7iyoMSnmYM,53 - 59,American,,American,Female,Disagree,Somewhat agree,Agree,Strongly agree,Somewhat disagree,3,5,4,1,2,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,3,1,2,5,4,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Neither agree nor disagree,Strongly Agree,Disagree,Agree,2,4,1,3,5,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,5,4,3,2,3,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,4,1,5,3,2,8,Disagree,Strongly disagree,Disagree,Somewhat disagree,Somewhat disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Somewhat agree,Agree,Strongly Agree,Somewhat disagree,3,5,2,1,4,2,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,2,3,1,5,4,2,Agree,Agree,Agree,Somewhat Disagree,Strongly agree,5,1,2,3,4,3,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,2,1,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,98,TRUE,52,TRUE,92,TRUE,93,TRUE,56,FALSE,50,TRUE,96,TRUE,66,TRUE,87,TRUE,91,TRUE,95,TRUE,88,FALSE,57,FALSE,74,FALSE,100,FALSE,73,TRUE,81,TRUE,50,TRUE,98,TRUE,94,TRUE,96,FALSE,61,TRUE,90,TRUE,81,TRUE,100,TRUE,95,FALSE,98,TRUE,50,TRUE,50,FALSE,100,TRUE,71,FALSE,88,20,-2,1,2,3,-1,-1,1,2,0,-1,2,2,2,-1,3,1,1,2,1,1,-3,0,3,-2,2,7,1,1,2,1,1,2,1,1,3,1,2,3,-2,-3,-2,-1,-1,8,-2,1,2,3,-1,2,-2,-1,2,0,-1,2,2,2,2,-1,3,2,2,1,2,1,1,3,FALSE,1,88,TRUE,1,71,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,98,TRUE,1,95,TRUE,1,100,TRUE,1,81,TRUE,1,90,FALSE,1,61,TRUE,0,96,TRUE,1,94,TRUE,0,98,TRUE,1,50,TRUE,1,81,FALSE,1,73,FALSE,1,100,FALSE,1,74,FALSE,1,57,TRUE,1,88,TRUE,1,95,TRUE,0,91,TRUE,1,87,TRUE,0,66,TRUE,1,96,FALSE,1,50,TRUE,0,56,TRUE,0,93,TRUE,1,92,TRUE,1,52,TRUE,1,98,0,0.0016,0.0361,0.0025,0.0004,0.0004,0.0169,0.01,0.1849,0.0025,0.0064,0.0036,0.0361,0.1521,0.25,0.0841,0.8281,0.25,0.3136,0.4356,0.0144,0.25,0.0676,0.9604,0.0729,0.25,0.2304,0.0144,0,0,0.8649,0.9216,0.222189286,0.130392857,0.313985714,20,62.5,25,78.13,7,87.5,6,75,6,75,6,75,16,100,9,56.25,80.34,61.12,85.62,91,83.62,82.5,78.19,-15.63,2.21,-26.38,10.62,16,8.62,-17.5,21.94,1,1,1,5,3,2,0,0,1,2,1,1,1,2,1,3,4,4,2,2,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,2.2,1,1.2,3,0,0.6,0,0.2,1.85,0.2,1.025,4,2,3.625,2.2,0.4,1.2,2.8,1.266666667,5,0,1,5,2,0,2,1,-2,2,1,-1,-2,2,-1,1,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,I want to know the answers now.,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,3,2,4,7,5,9,8,1,6,4,3,2,1 +624,R_1TsHqwdlsg8NyRI,60 - 66,American,,American,Female,Strongly agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,3,4,1,5,2,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,5,1,3,2,4,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,5,3,1,2,4,Neither agree nor disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,3,5,2,4,1,Strongly Agree,Agree,Agree,Neither agree nor disagree,Disagree,5,4,2,3,1,1,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,4,3,2,1,5,1,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,5,4,1,2,3,1,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Disagree,3,1,2,5,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Somewhat agree,Somewhat disagree,4,2,5,1,3,1,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Disagree,3,5,1,4,2,2,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,1,4,3,5,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,2,3,5,1,4,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,65,TRUE,70,FALSE,95,FALSE,52,TRUE,53,FALSE,100,TRUE,97,TRUE,100,TRUE,60,TRUE,100,FALSE,98,TRUE,100,FALSE,99,TRUE,95,TRUE,55,TRUE,91,TRUE,95,TRUE,99,TRUE,97,FALSE,100,FALSE,75,TRUE,85,FALSE,54,TRUE,90,FALSE,100,TRUE,97,TRUE,58,FALSE,95,TRUE,90,TRUE,98,FALSE,70,TRUE,97,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,1,0,-2,0,2,0,-2,3,2,3,-2,3,0,-2,0,0,-2,3,2,2,0,-2,1,-3,1,1,1,-3,1,3,2,3,-2,3,1,-3,-3,-3,-2,-2,1,3,2,2,1,-1,1,-2,-1,1,-1,-2,2,3,2,3,-2,3,1,0,0,0,0,-2,1,TRUE,0,65,TRUE,1,70,FALSE,1,95,FALSE,1,52,TRUE,1,53,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,60,TRUE,1,100,FALSE,1,98,TRUE,0,100,FALSE,0,99,TRUE,0,95,TRUE,1,55,TRUE,1,91,TRUE,0,95,TRUE,0,99,TRUE,0,97,FALSE,1,100,FALSE,0,75,TRUE,1,85,FALSE,1,54,TRUE,1,90,FALSE,1,100,TRUE,1,97,TRUE,0,58,FALSE,1,95,TRUE,0,90,TRUE,1,98,FALSE,0,70,TRUE,1,97,0,0.0009,0.0081,0.0009,0.0009,0,0.01,0,0,0.0225,0.0004,0.9801,0.16,0.0004,0.2209,0.09,0.2116,0.2304,0.0025,0,0.5625,0.2025,0.9409,0.9025,0.9025,0.3364,0.49,0.4225,0.0025,0.9801,0.81,1,0.338646429,0.137657143,0.539635714,18,56.25,21,65.63,5,62.5,4,50,5,62.5,7,87.5,13,81.25,8,50,85.31,70,82.88,92.25,96.12,83.56,87.06,-9.38,19.68,7.5,32.88,29.75,8.62,2.31,37.06,0,0,0,1,2,1,1,1,1,1,0,0,0,0,0,3,1,3,2,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0.6,1,0,1.8,0.2,0.6,0,0.4,0.85,0.3,0.575,1,1.33,1.125,0.4,0.4,0,1.4,0.266666667,0,-1,0,0,-0.33,-2,0,-2,-2,2,0,0,0,0,-2,2,-2,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,Can't think of anything.,-0.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,4,7,5,9,6,2,3,1,8,2,4,3,1 +625,R_1scbTlFE5WDcKLq,53 - 59,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,4,2,3,1,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,3,4,5,1,2,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,2,3,Agree,Agree,Agree,Agree,Somewhat disagree,4,3,1,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,1,2,5,4,1,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,2,1,4,1,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,1,5,1,Agree,Strongly Agree,Agree,Agree,Disagree,2,3,4,1,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,4,3,2,5,1,Agree,Disagree,Strongly agree,Disagree,Strongly agree,4,5,2,1,3,1,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,1,4,5,2,2,Agree,Agree,Agree,Agree,Somewhat disagree,4,1,3,5,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,90,TRUE,79,FALSE,77,FALSE,61,TRUE,78,FALSE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,92,TRUE,81,FALSE,76,FALSE,92,TRUE,70,TRUE,86,FALSE,82,TRUE,92,FALSE,50,FALSE,100,TRUE,90,TRUE,73,FALSE,69,TRUE,85,FALSE,84,TRUE,68,FALSE,54,FALSE,63,FALSE,51,FALSE,86,FALSE,53,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,1,-2,3,-2,2,3,1,3,3,3,2,2,2,2,-1,3,3,3,2,3,1,3,-2,3,-3,3,1,3,2,3,3,3,1,2,3,2,2,-2,1,3,3,3,2,3,1,2,-2,3,-2,3,1,3,2,3,2,3,2,2,2,2,2,-1,9,FALSE,1,90,TRUE,1,79,FALSE,1,77,FALSE,1,61,TRUE,1,78,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,92,TRUE,0,81,FALSE,0,76,FALSE,1,92,TRUE,1,70,TRUE,1,86,FALSE,1,82,TRUE,0,92,FALSE,1,50,FALSE,1,100,TRUE,1,90,TRUE,1,73,FALSE,1,69,TRUE,1,85,FALSE,1,84,TRUE,1,68,FALSE,1,54,FALSE,1,63,FALSE,1,51,FALSE,0,86,FALSE,0,53,TRUE,1,100,0,0.1024,0.0196,0,0,0,0.0225,0,0,0.0729,0.7396,0.5776,0.0625,0.0064,0.0484,0.0441,0.0961,0.1521,0.1369,0.0256,0.01,0.09,0.25,0.0064,0.0324,0.2116,0.2809,0.01,0.0529,0.8464,0.2401,0.6561,0.166839286,0.130157143,0.203521429,25,78.13,27,84.38,7,87.5,7,87.5,7,87.5,6,75,13,81.25,14,87.5,79.91,66.75,80.75,87.38,84.75,82.44,77.38,-6.25,-4.47,-20.75,-6.75,-0.12,9.75,1.19,-10.12,0,0,0,0,0,2,0,0,1,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0.8,0.2,0.4,0,0.4,0.4,0,0.35,0.2,0.275,1,1.33,2.125,0,0.4,-0.2,0.4,0.066666667,0,0,-1,-8,-0.33,0,1,1,-2,2,1,-1,-1,1,-1,1,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,58,"It took longer to complete than was stated. It was thought provoking, that accounts for the additional time, I think.it was interesting. ",0.625,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,8,5,7,4,6,2,9,1,3,4,3,2,1 +626,R_37pd9qapjRdtkJa,46 - 52,American,,American,Female,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,5,3,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,5,3,4,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Disagree,Agree,5,4,1,2,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,3,4,3,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,2,1,5,3,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,5,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,1,2,2,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,4,2,3,5,1,Disagree,Agree,Agree,Disagree,Agree,2,3,5,1,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,77,FALSE,90,TRUE,75,TRUE,82,FALSE,100,TRUE,84,TRUE,92,TRUE,91,FALSE,76,TRUE,80,TRUE,80,FALSE,90,TRUE,90,FALSE,100,TRUE,76,TRUE,80,FALSE,74,TRUE,100,TRUE,80,TRUE,100,TRUE,60,TRUE,80,TRUE,90,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,16,0,2,2,0,0,-2,-2,2,-2,0,0,1,1,-2,2,0,0,2,0,0,0,0,0,0,0,5,-2,-2,2,-2,0,3,0,1,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,5,-2,-2,2,-2,0,2,-2,2,2,-2,2,1,0,0,0,0,0,2,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,80,TRUE,0,60,TRUE,0,100,TRUE,1,80,TRUE,0,100,FALSE,0,74,TRUE,1,80,TRUE,0,76,FALSE,1,100,TRUE,0,90,FALSE,1,90,TRUE,1,80,TRUE,1,80,FALSE,1,76,TRUE,1,91,TRUE,0,92,TRUE,1,84,FALSE,1,100,TRUE,0,82,TRUE,0,75,FALSE,0,90,FALSE,0,77,TRUE,1,100,0,0.0256,0.04,0,0,0,0.0081,0.04,0.01,0.04,0.81,0.04,0.01,0.36,0.25,0.25,0.0576,0.25,0.6724,0.8464,0.04,0.5476,0.81,1,0.5776,0,0.5929,1,1,0,0.5625,1,0.384825,0.151835714,0.617814286,16,50,18,56.25,3,37.5,6,75,5,62.5,4,50,12,75,6,37.5,84.28,73.88,79.62,92,91.62,81.62,86.94,-6.25,28.03,36.38,4.62,29.5,41.62,6.62,49.44,0,2,2,0,0,0,0,0,0,0,0,0,1,2,2,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,2,1,1,0,0,0,0,2,0,0,0.8,0,1,0.4,0.8,0,0.8,0.4,0.55,0.5,0.525,3.67,2.67,3.25,0,0,0.2,0,0.066666667,0,1,2,3,1,0,1,1,-1,1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),50,,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,9,4,8,2,6,3,5,1,7,4,3,2,1 +627,R_6RYM8XZDS6nkhGh,46 - 52,,Canadian,Canadian,Male,Strongly disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,5,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,5,Strongly Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,1,2,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,2,1,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,5,3,1,2,4,5,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,5,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,84,TRUE,55,TRUE,100,TRUE,100,TRUE,70,FALSE,50,TRUE,81,FALSE,50,TRUE,100,FALSE,73,TRUE,81,FALSE,50,FALSE,50,FALSE,50,TRUE,80,TRUE,76,FALSE,50,TRUE,50,TRUE,50,TRUE,66,TRUE,100,TRUE,50,TRUE,95,TRUE,81,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,66,FALSE,50,TRUE,100,5,-3,2,0,0,2,0,0,0,0,0,0,2,0,0,0,-3,-3,-3,-3,-3,0,2,2,0,0,5,0,2,0,0,0,5,-3,0,0,0,0,5,-3,-3,-3,-3,-3,5,-3,0,0,0,2,5,0,0,0,2,0,5,0,2,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,FALSE,0,50,TRUE,0,66,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,81,TRUE,1,95,TRUE,0,50,TRUE,0,100,TRUE,1,66,TRUE,0,50,TRUE,1,50,FALSE,0,50,TRUE,0,76,TRUE,0,80,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,81,FALSE,1,73,TRUE,1,100,FALSE,1,50,TRUE,1,81,FALSE,1,50,TRUE,0,70,TRUE,0,100,TRUE,1,100,TRUE,1,55,TRUE,1,84,0.25,0.0361,0.25,0,0.0256,0.25,0,0.0025,0.25,0.0361,0,0.1156,0.0361,0.25,0.25,0.25,0.0729,0.25,0.49,0.25,0.25,0.25,0.25,0.25,0.5776,0.25,0.2025,1,0.4356,0.64,1,1,0.308375,0.127771429,0.488978571,5,15.63,18,56.25,6,75,4,50,5,62.5,3,37.5,11,68.75,7,43.75,69,54.5,68.62,79.62,73.25,71.44,66.56,-40.62,12.75,-20.5,18.62,17.12,35.75,2.69,22.81,3,0,2,0,2,0,2,0,0,0,3,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,3,3,3,3,3,1.4,0.4,1,0,0.4,0.4,0,3,0.7,0.95,0.825,5,5,5,1,0,1,-3,0.666666667,0,0,0,0,0,0,1,0,-2,2,0,0,1,-1,0,0,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,47,Great!,0.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,02REV,6,7,9,4,5,3,2,1,8,4,3,2,1 +628,R_3r97C10hrmEY6lU,39 - 45,American,,American,Female,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,2,1,5,3,4,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Disagree,2,4,5,3,1,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,1,5,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Agree,Agree,Strongly disagree,Strongly disagree,1,5,2,3,4,9,Agree,Disagree,Agree,Agree,Agree,4,5,2,1,3,2,Strongly Disagree,Strongly Disagree,Agree,Agree,Agree,2,1,4,5,3,9,Agree,Agree,Somewhat disagree,Agree,Somewhat disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,3,2,5,4,1,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,4,3,5,2,1,Strongly Disagree,Strongly Disagree,Agree,Agree,Agree,2,1,5,4,3,9,Agree,Agree,Agree,Agree,Agree,1,3,5,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,100,FALSE,100,TRUE,98,FALSE,100,FALSE,51,FALSE,98,FALSE,61,TRUE,92,FALSE,84,TRUE,100,TRUE,100,FALSE,54,FALSE,52,TRUE,100,FALSE,53,FALSE,80,TRUE,60,FALSE,100,FALSE,54,TRUE,100,FALSE,94,TRUE,100,TRUE,100,FALSE,51,TRUE,99,FALSE,75,TRUE,50,FALSE,51,FALSE,50,FALSE,50,TRUE,100,16,0,3,-3,3,-3,-3,3,-3,3,-2,-1,-1,1,1,1,-3,-3,-3,-3,-3,2,2,2,-3,-3,10,2,-2,2,2,2,9,-3,-3,2,2,2,2,2,2,-1,2,-1,9,3,3,3,3,-3,10,-3,-3,-3,-3,-3,10,-3,-3,2,2,2,1,2,2,2,2,2,9,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,1,51,TRUE,1,50,FALSE,1,75,TRUE,1,99,FALSE,0,51,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,0,54,FALSE,1,100,TRUE,1,60,FALSE,0,80,FALSE,1,53,TRUE,0,100,FALSE,1,52,FALSE,1,54,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,92,FALSE,1,61,FALSE,0,98,FALSE,1,51,FALSE,1,100,TRUE,0,98,FALSE,0,100,FALSE,0,100,TRUE,1,96,0.2601,0.9604,0.64,0.0001,0.0016,0.0625,0.0064,0,0.2116,0,1,0.2916,0,0.0036,0.25,0.25,0.0256,0.2401,0,0.1521,0,0.16,0.2304,0,0.2209,0.2401,1,1,0.25,1,0.9604,1,0.305603571,0.167357143,0.44385,16,50,21,65.63,6,75,6,75,5,62.5,4,50,9,56.25,12,75,79.78,69.75,76.25,94.75,78.38,83.12,76.44,-15.63,14.15,-5.25,1.25,32.25,28.38,26.87,1.44,2,1,5,6,0,5,5,5,1,4,2,2,1,1,1,5,5,2,5,2,3,0,6,0,0,0,6,0,6,1,2,2,1,1,1,5,5,5,5,5,2.8,4,1.4,3.8,1.8,2.6,1.4,5,3,2.7,2.85,7,7,7.5,1,1.4,0,-1.2,0.8,0,-1,1,0,0,0,2,1,-2,2,-2,2,0,0,-2,2,2,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,45,i dont get why i was supposed to do this but it was interesting i guess? im so confused bro,1.375,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,8,7,9,6,3,2,4,1,5,3,4,2,1 +629,R_3x3YdUaKFiS8CEF,46 - 52,,Canadian,Canadian,Female,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,5,1,2,3,4,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,1,4,3,5,2,Agree,Somewhat Disagree,Strongly Agree,Disagree,Somewhat Agree,4,1,5,3,2,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,1,4,5,2,3,Agree,Somewhat agree,Somewhat agree,Disagree,Agree,5,1,4,3,2,3,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,2,3,1,5,4,2,Agree,Somewhat Disagree,Strongly Agree,Disagree,Neither Agree nor Disagree,1,4,5,3,2,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,5,1,2,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat agree,Disagree,Agree,4,2,1,3,5,4,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,2,1,4,5,Agree,Somewhat Disagree,Strongly Agree,Disagree,Neither Agree nor Disagree,3,5,2,4,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,3,2,4,5,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,95,FALSE,100,FALSE,90,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,90,FALSE,100,TRUE,80,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,75,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,1,-1,2,1,-1,1,-1,2,2,-1,3,-2,1,0,-1,0,1,-2,2,1,1,-2,2,3,1,-1,1,-1,2,2,2,-1,3,-2,0,2,-1,-1,-1,0,-2,6,2,1,1,-2,2,4,0,-2,1,-1,1,5,2,-1,3,-2,0,5,1,1,1,1,-2,7,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,95,FALSE,1,100,FALSE,0,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,0,75,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,1,0,0.81,0,0,0,0,0,0,1,0.81,0,0,0.9025,1,0,0,0,0,0,0.04,0,0,0,0.5625,0,0,0,0,0,1,0.189821429,0.265178571,0.114464286,20,62.5,24,75,6,75,6,75,6,75,6,75,10,62.5,14,87.5,97.81,94.38,98.12,98.75,100,97.19,98.44,-12.5,22.81,19.38,23.12,23.75,25,34.69,10.94,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,2,1,0,0,0.2,0,0.2,0.6,0.2,0.6,0.2,0.8,0.25,0.45,0.35,2.33,4.67,4.25,0,-0.6,0,-0.2,-0.2,-1,-3,-3,-1,-2.34,2,2,2,-2,2,0,0,0,0,-2,2,2,5 cents,5 minutes,47 days,Female,University - Undergraduate,49,"Interesting survey as I probably never made the comparisons from now to 10 years before, so I learned something new about myself today.",1.5,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,6,7,9,3,4,5,2,1,8,3,2,4,1 +630,R_5yNgKYnVHrBUF21,39 - 45,,Canadian,Canadian,Male,Strongly agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,3,2,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,5,4,2,Agree,Agree,Strongly Agree,Agree,Neither agree nor disagree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,2,4,3,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,5,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,1,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,5,1,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,1,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,1,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,5,2,FALSE,53,FALSE,52,FALSE,54,FALSE,52,FALSE,56,FALSE,51,FALSE,53,FALSE,52,FALSE,52,FALSE,52,FALSE,53,FALSE,50,FALSE,51,FALSE,52,FALSE,53,FALSE,52,FALSE,51,FALSE,51,FALSE,51,FALSE,51,FALSE,51,FALSE,51,FALSE,51,FALSE,53,FALSE,52,FALSE,53,FALSE,52,FALSE,52,FALSE,51,FALSE,52,FALSE,51,FALSE,52,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,0,2,0,3,0,0,0,0,0,3,0,0,0,0,2,2,3,2,0,3,1,3,0,3,5,0,0,0,0,0,6,3,0,0,0,0,5,0,0,0,0,0,5,2,0,0,0,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,2,0,0,5,FALSE,1,53,FALSE,0,52,FALSE,1,54,FALSE,1,52,FALSE,0,56,FALSE,1,51,FALSE,0,53,FALSE,0,52,FALSE,0,52,FALSE,0,52,FALSE,1,53,FALSE,1,50,FALSE,0,51,FALSE,1,52,FALSE,0,53,FALSE,0,52,FALSE,1,51,FALSE,1,51,FALSE,1,51,FALSE,1,51,FALSE,0,51,FALSE,0,51,FALSE,1,51,FALSE,0,53,FALSE,1,52,FALSE,0,53,FALSE,1,52,FALSE,1,52,FALSE,1,51,FALSE,0,52,FALSE,0,51,FALSE,0,52,0.2704,0.2809,0.2704,0.2809,0.2704,0.2401,0.2809,0.2704,0.2401,0.2601,0.2704,0.2601,0.2704,0.2209,0.3136,0.2704,0.2401,0.2304,0.2304,0.2304,0.2601,0.2809,0.2401,0.2304,0.2401,0.2304,0.2601,0.2209,0.2116,0.2401,0.2401,0.25,0.250139286,0.259878571,0.2404,16,50,16,50,4,50,4,50,4,50,4,50,0,0,16,100,51.97,52,51.75,52.12,52,52.25,51.69,0,1.97,2,1.75,2.12,2,52.25,-48.31,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,2,3,2,0,1,0,2,0,1,0,0,0,0,0,3,0,0,0,0,2,2,1,2,0,0.4,0,0,1.8,0.8,0,0.6,1.4,0.55,0.7,0.625,5.33,5,5.125,-0.4,0,-0.6,0.4,-0.333333333,0,1,0,0,0.33,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,40,great,0,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,9,3,7,4,6,8,5,1,2,2,3,4,1 +631,R_71n1inSBq85hYMV,32 - 38,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,1,4,2,3,5,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,4,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,5,4,2,1,Agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,2,3,4,5,1,6,Agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,1,2,3,5,4,7,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,3,1,4,5,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,1,4,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,Strongly Agree,2,3,5,1,4,9,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,7,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,2,3,1,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,2,5,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,71,TRUE,64,FALSE,65,TRUE,74,TRUE,67,FALSE,100,TRUE,70,TRUE,100,TRUE,58,FALSE,68,FALSE,68,TRUE,83,TRUE,88,TRUE,95,FALSE,68,TRUE,82,FALSE,67,TRUE,66,FALSE,68,TRUE,66,FALSE,92,FALSE,60,TRUE,85,FALSE,75,FALSE,61,TRUE,84,FALSE,67,TRUE,75,FALSE,71,TRUE,85,FALSE,70,FALSE,91,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,0,1,1,-1,2,-1,1,2,1,2,0,3,1,1,1,1,-1,2,3,2,0,1,6,2,-1,2,-1,1,7,3,1,3,2,1,7,0,0,0,-1,-1,7,1,3,2,0,3,9,0,-1,2,0,1,7,2,0,2,0,3,7,0,0,0,-1,-1,8,FALSE,1,71,TRUE,1,64,FALSE,1,65,TRUE,0,74,TRUE,1,67,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,58,FALSE,0,68,FALSE,1,68,TRUE,0,83,TRUE,1,88,TRUE,0,95,FALSE,0,68,TRUE,1,82,FALSE,1,67,TRUE,0,66,FALSE,1,68,TRUE,0,66,FALSE,0,92,FALSE,0,60,TRUE,0,85,FALSE,0,75,FALSE,1,61,TRUE,1,84,FALSE,1,67,TRUE,0,75,FALSE,1,71,TRUE,1,85,FALSE,0,70,FALSE,0,91,0,0.0256,0.0324,0.09,0.8281,0,0.5625,0.4624,0.4356,0.36,0.0225,0.0144,0.1764,0.1024,0.1089,0.1296,0.7225,0.5476,0.5625,0.1521,0.8464,0.4624,0.1024,0.9025,0.1089,0.1089,0.49,0.0841,0.1225,0.4356,0.0841,0.6889,0.343721429,0.319492857,0.36795,22,68.75,18,56.25,5,62.5,5,62.5,4,50,4,50,9,56.25,9,56.25,75.12,67.12,82.62,71.88,78.88,76.38,73.88,12.5,18.87,4.62,20.12,21.88,28.88,20.13,17.63,0,0,0,0,0,1,0,0,0,0,1,0,1,2,2,1,1,1,2,0,1,0,0,0,2,1,0,0,1,0,0,1,0,0,0,1,1,1,2,0,0,0.2,1.2,1,0.6,0.4,0.2,1,0.6,0.55,0.575,6.67,7.67,7.25,-0.6,-0.2,1,0,0.066666667,-3,0,0,-1,-1,-1,-1,1,-2,2,2,-2,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,34,great survey,-0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,7,9,5,2,4,3,8,1,6,4,3,2,1 +632,R_5MXNHq2DCzPe2cS,46 - 52,,Canadian,Canadian,Male,Agree,Agree,Strongly agree,Somewhat agree,Strongly agree,2,1,4,3,5,Agree,Somewhat agree,Agree,Disagree,Strongly agree,3,2,4,5,1,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,1,2,3,4,5,Disagree,Neither agree nor disagree,Disagree,Agree,Strongly disagree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,4,3,8,Strongly agree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,1,3,5,2,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Disagree,Neither Agree nor Disagree,5,4,2,3,1,8,Strongly disagree,Disagree,Somewhat agree,Strongly disagree,Strongly disagree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,4,2,3,5,1,7,Agree,Neither agree nor disagree,Agree,Strongly disagree,Somewhat agree,1,3,2,5,4,6,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,5,1,5,Somewhat agree,Agree,Agree,Strongly Agree,Somewhat agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,86,TRUE,74,TRUE,100,FALSE,64,TRUE,86,FALSE,54,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,72,FALSE,100,TRUE,100,TRUE,72,TRUE,100,FALSE,100,FALSE,100,FALSE,86,FALSE,100,FALSE,89,TRUE,100,FALSE,100,FALSE,100,TRUE,86,FALSE,100,FALSE,80,FALSE,74,FALSE,58,FALSE,59,FALSE,100,22,2,2,3,1,3,2,1,2,-2,3,2,1,1,2,1,-2,0,-2,2,-3,-1,3,3,3,3,7,3,-3,0,0,1,8,0,0,-2,-2,0,7,-3,-2,1,-3,-3,8,1,3,3,1,3,7,2,0,2,-3,1,7,1,0,0,0,0,6,1,2,2,3,1,5,FALSE,1,100,FALSE,0,59,FALSE,1,58,FALSE,1,74,FALSE,0,80,FALSE,1,100,TRUE,1,86,FALSE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,89,FALSE,1,100,FALSE,0,86,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,72,TRUE,0,100,FALSE,1,100,FALSE,1,72,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,54,TRUE,0,86,FALSE,1,64,TRUE,1,100,TRUE,1,74,FALSE,0,86,1,0,0,0.0196,0.7396,0,0,0,0.0784,0,0,0.7396,1,0.0121,0.64,0.3481,0,0.0676,0.7396,0,0,1,0,0,0.5184,0.2116,0.0676,0,0.1764,1,0.1296,0,0.266735714,0.258957143,0.274514286,22,68.75,22,68.75,5,62.5,4,50,7,87.5,6,75,9,56.25,13,81.25,88.75,81.25,86,98.25,89.5,91.94,85.56,0,20,18.75,36,10.75,14.5,35.69,4.31,3,1,0,2,0,1,4,2,2,2,2,1,3,4,1,1,2,3,5,0,1,1,0,0,0,0,1,0,1,2,1,1,1,2,1,3,2,4,1,4,1.2,2.2,2.2,2.2,0.4,0.8,1.2,2.8,1.95,1.3,1.625,7.33,6.67,6.875,0.8,1.4,1,-0.6,1.066666667,0,1,1,3,0.66,2,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,5 minutes,47 days,Male,Professional Degree (ex. JD/MD),49,"this is a strange survey, but it's interesting.",1.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,4,3,5,7,9,2,6,1,8,4,3,2,1 +633,R_7ZEzyZBvyiJaXvH,32 - 38,American,,American,Male,Strongly agree,Agree,Strongly agree,Agree,Agree,5,2,4,1,3,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,4,1,3,2,5,Agree,Agree,Somewhat Agree,Agree,Agree,1,5,4,3,2,Agree,Agree,Agree,Agree,Agree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,1,4,5,2,6,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,2,1,3,5,7,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,5,4,3,2,1,6,Somewhat agree,Agree,Agree,Somewhat agree,Agree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,1,3,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,1,3,2,4,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,1,5,2,6,Somewhat agree,Agree,Agree,Somewhat agree,Agree,4,5,1,3,2,TRUE,87,TRUE,50,TRUE,54,FALSE,57,FALSE,54,FALSE,52,FALSE,52,TRUE,53,FALSE,57,TRUE,56,FALSE,53,TRUE,75,TRUE,83,FALSE,52,TRUE,86,TRUE,73,TRUE,60,TRUE,60,TRUE,61,TRUE,54,TRUE,60,TRUE,79,TRUE,54,FALSE,55,TRUE,67,FALSE,50,FALSE,53,TRUE,88,FALSE,50,FALSE,50,TRUE,50,TRUE,50,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,2,2,2,1,1,-1,2,2,2,1,2,2,2,2,2,2,2,2,2,2,1,1,6,2,1,2,1,1,6,2,1,1,1,2,7,1,2,2,1,2,6,1,1,2,2,1,6,1,1,1,-2,1,6,1,1,1,1,1,6,1,2,2,1,2,6,TRUE,0,87,TRUE,1,50,TRUE,0,54,FALSE,1,57,FALSE,0,54,FALSE,1,52,FALSE,0,52,TRUE,1,53,FALSE,0,57,TRUE,1,56,FALSE,1,53,TRUE,0,75,TRUE,1,83,FALSE,1,52,TRUE,1,86,TRUE,1,73,TRUE,0,60,TRUE,0,60,TRUE,0,61,TRUE,0,54,TRUE,1,60,TRUE,1,79,TRUE,0,54,FALSE,0,55,TRUE,0,67,FALSE,0,50,FALSE,1,53,TRUE,0,88,FALSE,1,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,0.2209,0.25,0.0729,0.2704,0.25,0.2304,0.3025,0.1936,0.2916,0.0441,0.25,0.0289,0.3249,0.2209,0.2916,0.25,0.2916,0.1849,0.7744,0.4489,0.16,0.0196,0.3721,0.2304,0.36,0.2209,0.25,0.7569,0.2916,0.36,0.25,0.5625,0.293296429,0.225357143,0.361235714,17,53.13,16,50,6,75,5,62.5,3,37.5,2,25,10,62.5,6,37.5,60.47,58.38,57.88,62.88,62.75,59.88,61.06,3.13,10.47,-16.62,-4.62,25.38,37.75,-2.62,23.56,1,0,1,1,1,0,0,1,2,1,0,1,0,1,0,1,0,0,1,0,2,1,1,0,1,1,0,0,1,1,1,1,0,1,1,1,0,0,1,0,0.8,0.8,0.4,0.4,1,0.6,0.8,0.4,0.6,0.7,0.65,6.33,6,6.125,-0.2,0.2,-0.4,0,-0.133333333,0,0,1,0,0.33,0,0,2,0,0,1,-1,1,-1,1,-1,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),34,it was very good ,0,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,6,3,8,9,5,7,2,1,4,4,2,3,1 +634,R_3KkEy6EPkKoHwd3,53 - 59,American,,American,Male,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,1,3,Neither agree nor disagree,Agree,Strongly agree,Agree,Agree,1,4,5,2,3,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,2,5,3,4,1,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,3,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,4,5,3,1,2,4,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,5,2,2,Disagree,Disagree,Disagree,Disagree,Disagree,5,4,1,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,1,2,3,Neither agree nor disagree,Agree,Strongly agree,Agree,Agree,3,1,4,5,2,3,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,4,2,2,Disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,4,2,5,1,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,100,FALSE,100,TRUE,80,FALSE,100,FALSE,100,TRUE,100,FALSE,100,30,-2,3,3,3,3,0,2,3,2,2,3,0,3,3,3,-2,0,-2,0,-2,-1,3,3,3,3,3,-1,1,3,1,3,4,3,0,3,3,3,2,-2,-2,-2,-2,-2,2,0,3,3,3,3,3,0,2,3,2,2,3,3,1,3,3,3,2,-2,-2,0,-2,-2,2,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0.0625,0,0.04,0,0,0,0,0,0,0.0625,0,0,0,0,0,0,0,1,0,1,0.077321429,0.007321429,0.147321429,30,93.75,30,93.75,8,100,8,100,7,87.5,7,87.5,16,100,14,87.5,97.81,93.75,97.5,100,100,95.62,100,0,4.06,-6.25,-2.5,12.5,12.5,-4.38,12.5,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,2,2,0,0.2,0.8,0,0.8,0.4,0,0.2,1.2,0.45,0.45,0.45,3,2.67,2.625,-0.2,0.8,-0.2,-0.4,0.133333333,0,1,0,0,0.33,2,2,2,-2,2,1,-1,-2,2,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),59,None.,1.5,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,6,4,7,9,5,3,2,1,8,2,4,3,1 +635,R_79j5xsAlxQdKxqx,25 - 31,American,,American,Male,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,2,3,4,1,5,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,1,5,3,2,4,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Strongly Agree,2,1,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly disagree,2,3,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,2,1,5,3,4,3,Disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,1,4,5,2,3,8,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,1,3,5,4,2,3,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,1,4,2,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,2,4,5,3,1,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,3,2,1,5,3,Strongly Agree,Neither Agree nor Disagree,Agree,Strongly Agree,Strongly Agree,5,1,3,4,2,3,Agree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,4,3,5,1,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,55,TRUE,71,FALSE,60,TRUE,100,TRUE,68,TRUE,100,FALSE,65,TRUE,74,FALSE,56,FALSE,61,TRUE,100,FALSE,56,FALSE,63,TRUE,77,TRUE,71,TRUE,100,TRUE,67,FALSE,100,FALSE,81,FALSE,100,TRUE,72,TRUE,60,TRUE,65,TRUE,100,TRUE,100,FALSE,57,TRUE,62,TRUE,62,TRUE,71,FALSE,59,TRUE,60,16,2,2,0,0,2,3,-3,3,-1,3,3,0,1,3,3,0,0,0,-2,-3,3,3,3,0,3,3,-2,-3,2,-3,0,8,3,0,0,3,3,3,0,-3,1,-3,-3,8,3,3,0,0,2,3,2,-3,3,-3,3,3,3,0,2,3,3,3,2,1,2,1,-3,3,TRUE,0,60,FALSE,0,59,TRUE,0,71,TRUE,0,62,TRUE,1,62,FALSE,1,57,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,60,TRUE,0,72,FALSE,1,100,FALSE,0,81,FALSE,1,100,TRUE,1,67,TRUE,1,100,TRUE,0,71,TRUE,0,77,FALSE,1,63,FALSE,1,56,TRUE,1,100,FALSE,0,61,FALSE,1,56,TRUE,1,74,FALSE,1,65,TRUE,1,100,TRUE,0,68,TRUE,0,100,FALSE,1,60,TRUE,1,71,TRUE,1,55,TRUE,1,100,0,0,0,0,0,0.1849,0.0676,0.16,0.1936,0.3721,0.0841,0.6561,0.1225,0.5184,0.1444,0.3481,0.1936,0.3844,1,0.1225,0,0.1089,0.1369,0,0.5041,0.4624,0.2025,0.36,0.5041,0.5929,0.16,0,0.270860714,0.244985714,0.296735714,16,50,21,65.63,4,50,6,75,5,62.5,6,75,13,81.25,8,50,74.78,63.88,73.38,77.88,84,78.44,71.12,-15.63,9.15,13.88,-1.62,15.38,9,-2.81,21.12,1,1,3,0,1,5,0,1,2,3,0,0,1,0,0,0,3,1,1,0,1,1,0,0,0,1,0,0,2,0,0,0,1,0,0,2,1,2,3,0,1.2,2.2,0.2,1,0.4,0.6,0.2,1.6,1.15,0.7,0.925,4.67,3,4.25,0.8,1.6,0,-0.6,0.8,0,5,0,5,1.67,0,2,0,-1,1,0,0,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,30,It was quite a tough survey. I enjoyed it though.,0.625,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,7,4,3,2,5,9,8,1,6,3,4,2,1 +636,R_60MjAJsX7YGSw6k,32 - 38,American,,American,Male,Agree,Agree,Strongly agree,Agree,Strongly agree,1,4,2,3,5,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Agree,2,5,1,4,3,Strongly Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,1,2,3,Somewhat agree,Agree,Agree,Strongly Agree,Somewhat agree,5,2,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Somewhat agree,Strongly Agree,Somewhat agree,2,4,5,3,1,8,Somewhat agree,Agree,Agree,Strongly agree,Somewhat agree,1,4,2,3,5,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,3,4,2,1,5,9,Agree,Somewhat agree,Strongly Agree,Somewhat agree,Agree,5,4,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Strongly Agree,Agree,Agree,Somewhat agree,3,5,2,4,1,7,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,5,2,3,1,9,Agree,Agree,Agree,Somewhat Agree,Agree,3,1,4,5,2,8,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Somewhat agree,5,2,1,3,4,TRUE,89,FALSE,95,TRUE,90,FALSE,95,FALSE,88,TRUE,69,FALSE,92,FALSE,68,TRUE,94,FALSE,72,TRUE,96,FALSE,67,TRUE,91,TRUE,89,TRUE,96,TRUE,85,FALSE,67,TRUE,93,TRUE,88,TRUE,92,TRUE,93,TRUE,89,TRUE,86,TRUE,95,TRUE,94,TRUE,90,FALSE,66,TRUE,88,TRUE,93,TRUE,92,TRUE,93,TRUE,92,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,2,3,1,-1,1,-2,2,3,2,2,1,1,1,2,2,3,1,2,2,1,3,1,9,1,2,2,3,1,8,1,2,2,1,1,5,2,1,3,1,2,9,1,3,2,2,1,9,2,2,2,1,1,7,2,2,2,1,2,9,3,3,1,2,1,8,TRUE,0,89,FALSE,0,95,TRUE,0,90,FALSE,1,95,FALSE,0,88,TRUE,0,69,FALSE,0,92,FALSE,0,68,TRUE,1,94,FALSE,0,72,TRUE,0,96,FALSE,1,67,TRUE,1,91,TRUE,0,89,TRUE,1,96,TRUE,1,85,FALSE,1,67,TRUE,0,93,TRUE,0,88,TRUE,0,92,TRUE,1,93,TRUE,1,89,TRUE,0,86,TRUE,1,95,TRUE,0,94,TRUE,1,90,FALSE,1,66,TRUE,0,88,TRUE,0,93,TRUE,1,92,TRUE,1,93,TRUE,1,92,0.4624,0.01,0.0225,0.8464,0.0064,0.4761,0.0025,0.5184,0.8464,0.0121,0.0064,0.0081,0.0036,0.9216,0.7744,0.9025,0.7396,0.0025,0.7744,0.8836,0.0049,0.0016,0.7744,0.7921,0.1089,0.1156,0.0049,0.7921,0.81,0.8649,0.8649,0.1089,0.432921429,0.3729,0.492942857,22,68.75,15,46.88,5,62.5,4,50,2,25,4,50,11,68.75,4,25,87.09,90.38,84.88,88.5,84.62,89.06,85.12,21.87,40.21,27.88,34.88,63.5,34.62,20.31,60.12,0,0,2,1,2,0,3,1,5,1,2,0,0,0,0,1,1,1,2,1,1,1,1,0,2,1,3,1,3,1,1,0,0,0,1,2,1,1,1,0,1,2,0.4,1.2,1,1.8,0.4,1,1.15,1.05,1.1,7.33,8.33,8,0,0.2,0,0.2,0.066666667,0,1,-4,1,-1,-1,1,1,2,-2,1,-1,2,-2,1,-1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,"enjoyed the survery, very easy to follow and understand",-0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,01DIR,2,5,4,9,3,8,7,1,6,2,3,4,1 +637,R_5YEzxFVFQAp2Krn,32 - 38,,Canadian,Canadian,Female,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,5,4,3,1,Strongly disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,2,5,4,1,3,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,2,4,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly disagree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,3,5,4,1,5,Strongly disagree,Disagree,Strongly agree,Agree,Somewhat agree,1,3,2,4,5,4,Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,1,5,4,2,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,4,3,5,9,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,2,1,5,3,4,5,Agree,Somewhat Agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,6,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,3,2,1,4,5,FALSE,100,TRUE,91,TRUE,86,TRUE,75,TRUE,64,FALSE,80,TRUE,86,TRUE,100,TRUE,86,TRUE,91,FALSE,69,TRUE,91,FALSE,75,FALSE,86,TRUE,86,TRUE,70,FALSE,65,TRUE,100,FALSE,70,FALSE,80,TRUE,86,FALSE,71,TRUE,75,TRUE,65,TRUE,91,TRUE,100,FALSE,65,TRUE,71,TRUE,81,TRUE,97,FALSE,60,TRUE,91,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,3,3,1,-3,-1,1,2,-1,2,2,3,1,3,1,1,1,-1,-3,-1,3,3,3,2,5,-3,-2,3,2,1,5,2,2,3,-1,3,4,-1,1,1,1,-2,4,-3,-3,3,3,3,7,1,-2,3,-2,2,9,2,1,3,3,3,5,-1,1,2,1,-1,6,FALSE,1,100,TRUE,1,91,TRUE,0,86,TRUE,0,75,TRUE,1,64,FALSE,1,80,TRUE,1,86,TRUE,1,100,TRUE,1,86,TRUE,1,91,FALSE,1,69,TRUE,0,91,FALSE,0,75,FALSE,1,86,TRUE,1,86,TRUE,1,70,FALSE,1,65,TRUE,0,100,FALSE,1,70,FALSE,1,80,TRUE,1,86,FALSE,0,71,TRUE,0,75,TRUE,1,65,TRUE,0,91,TRUE,1,100,FALSE,1,65,TRUE,0,71,TRUE,0,81,TRUE,1,97,FALSE,0,60,TRUE,1,91,0,0,0.09,0.0196,0.0081,0.04,0.1225,0.0081,0.04,0.5041,0.0009,0.5625,0.0196,0.0961,0.1296,0.0081,0.5625,0.5625,0.5041,0.8281,0.0196,0.0196,0.09,0.0196,0.1225,0.1225,0.36,0,0.7396,1,0.6561,0.8281,0.2848,0.190328571,0.379271429,16,50,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,81.38,75.25,77.12,90.62,82.5,82.44,80.31,-15.63,15.75,0.25,14.62,28.12,20,1.19,30.31,2,0,0,0,1,0,1,2,0,2,0,0,0,2,0,2,0,0,2,1,0,6,0,0,2,4,1,2,4,3,0,1,0,2,0,2,0,1,2,2,0.6,1,0.4,1,1.6,2.8,0.6,1.4,0.75,1.6,1.175,4.67,7,5.625,-1,-1.8,-0.2,-0.4,-1,-2,-4,-1,-2,-2.33,1,-1,-1,-2,2,2,-2,1,-1,0,0,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,No feedbacks,-0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,6,9,2,5,8,4,7,1,3,3,2,4,1 +638,R_1JvZO0PUMVo7krx,39 - 45,,Canadian,Canadian,Female,Somewhat disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,3,4,1,5,Disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,2,1,5,3,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat disagree,Strongly Agree,Agree,Somewhat agree,Somewhat agree,4,1,5,3,2,7,Disagree,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat agree,1,5,4,2,3,6,Strongly Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,4,1,5,3,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Disagree,1,5,4,3,2,2,Strongly disagree,Neither agree nor disagree,Somewhat agree,Strongly agree,Disagree,3,5,1,4,2,4,Strongly agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,3,2,1,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,5,4,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,66,TRUE,100,FALSE,57,FALSE,54,TRUE,51,TRUE,100,TRUE,100,TRUE,51,TRUE,86,TRUE,51,TRUE,50,TRUE,51,TRUE,51,TRUE,100,TRUE,50,TRUE,78,TRUE,51,TRUE,51,TRUE,82,FALSE,76,FALSE,86,TRUE,79,TRUE,70,TRUE,100,TRUE,89,FALSE,64,TRUE,100,FALSE,51,TRUE,100,TRUE,62,TRUE,100,18,-1,3,0,0,-1,-2,0,-1,3,0,2,1,1,1,1,-2,-1,-1,1,-2,-1,3,2,1,1,3,-2,1,-1,3,1,7,3,1,1,1,1,6,-1,-1,-1,0,0,3,1,3,0,1,-2,2,-3,0,1,3,-2,2,3,1,2,1,1,4,-1,-1,0,1,0,5,TRUE,0,100,TRUE,1,62,TRUE,0,100,FALSE,1,51,TRUE,1,100,FALSE,1,64,TRUE,1,89,TRUE,1,100,TRUE,1,70,TRUE,1,79,FALSE,1,86,FALSE,1,76,TRUE,1,82,TRUE,0,51,TRUE,1,51,TRUE,1,78,TRUE,0,50,TRUE,0,100,TRUE,0,51,TRUE,0,51,TRUE,1,50,TRUE,1,51,TRUE,0,86,TRUE,1,51,TRUE,0,100,TRUE,1,100,TRUE,0,51,FALSE,1,54,FALSE,1,57,TRUE,1,100,FALSE,0,66,TRUE,1,100,0,0,0.0484,0.0121,0,0.1296,0.2401,0.0441,0.2601,0.2401,0,0.0324,0.09,0.0196,0,0.1444,0.7396,0.2401,0.2116,1,0.25,0.2401,0.2601,0.2601,0.25,0.2601,0.4356,1,1,1,0.1849,0.0576,0.306792857,0.155721429,0.457864286,18,56.25,21,65.63,5,62.5,6,75,4,50,6,75,15,93.75,6,37.5,73.66,61,73.62,83.75,76.25,76.81,70.5,-9.38,8.03,-1.5,-1.38,33.75,1.25,-16.94,33,0,0,2,1,2,0,1,0,0,1,1,0,0,0,0,1,0,0,1,2,2,0,0,1,1,1,0,2,0,2,1,0,1,0,0,1,0,1,0,2,1,0.4,0.2,0.8,0.8,1,0.4,0.8,0.6,0.75,0.675,5.33,2.67,4,0.2,-0.6,-0.2,0,-0.2,1,5,2,-2,2.66,0,1,-1,-1,1,2,-2,1,-1,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,39,very interesting - thank you,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,9,7,2,4,3,8,6,1,5,4,3,2,1 +639,R_7pWJcjCxgY1ukTe,46 - 52,,Canadian,Canadian,Male,Agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,5,3,4,2,1,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,3,1,5,2,4,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,5,4,1,3,2,1,Neither agree nor disagree,Somewhat disagree,Agree,Disagree,Agree,5,2,3,4,1,1,Neither Agree nor Disagree,Disagree,Agree,Somewhat Agree,Agree,2,4,1,3,5,1,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,3,5,2,4,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,1,2,4,3,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,1,5,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,5,1,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,FALSE,57,TRUE,75,TRUE,89,FALSE,100,TRUE,50,TRUE,76,FALSE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,82,TRUE,79,TRUE,89,TRUE,98,TRUE,86,TRUE,90,TRUE,50,FALSE,70,TRUE,58,TRUE,66,18,2,1,1,2,0,0,-1,2,-1,1,0,0,2,0,2,0,2,2,2,1,2,2,1,2,0,1,0,-1,2,-2,2,1,0,-2,2,1,2,1,1,2,2,1,1,1,2,1,1,2,1,1,1,-1,1,-1,1,1,0,0,2,0,3,1,1,1,1,1,1,1,TRUE,0,66,TRUE,1,58,FALSE,1,70,TRUE,0,50,TRUE,1,90,TRUE,0,86,TRUE,1,98,TRUE,1,89,TRUE,1,79,TRUE,1,82,TRUE,0,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,76,TRUE,0,50,FALSE,1,100,TRUE,0,89,TRUE,1,75,FALSE,0,57,TRUE,1,92,0.0121,0.0576,0,0.0004,0.0064,0.7396,0.25,0.0324,0.25,0.25,0.0625,0,0.0441,0.25,0.01,0.1764,0.25,0.25,0,0,0,0,0.25,1,1,0.25,0.3249,0.4356,0.09,1,0.7921,1,0.311214286,0.183671429,0.438757143,18,56.25,18,56.25,3,37.5,5,62.5,4,50,6,75,14,87.5,4,25,78.34,61.75,88.38,84,79.25,81,75.69,0,22.09,24.25,25.88,34,4.25,-6.5,50.69,0,1,0,0,0,0,0,0,1,1,0,2,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0.2,0.4,0.6,0.4,0.2,0.4,0.2,0.8,0.4,0.4,0.4,1,1,1,0,0,0.4,-0.4,0.133333333,0,0,0,0,0,0,2,1,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,50,Fun survey!,1.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,3,8,4,6,7,5,2,1,9,3,2,4,1 +640,R_6CsOtPiUGljnF6x,46 - 52,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Disagree,2,3,1,4,5,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,1,4,5,3,2,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Somewhat Disagree,4,1,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Disagree,3,4,5,1,2,7,Somewhat agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Somewhat agree,4,3,1,2,5,8,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Somewhat Agree,4,1,3,5,2,10,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,1,5,3,4,2,9,Disagree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,1,3,5,2,7,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,10,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,4,5,3,1,2,FALSE,100,TRUE,100,TRUE,86,FALSE,59,TRUE,86,FALSE,65,TRUE,100,TRUE,91,TRUE,86,TRUE,100,TRUE,76,TRUE,100,FALSE,85,TRUE,100,TRUE,59,TRUE,100,FALSE,75,TRUE,100,FALSE,70,FALSE,100,TRUE,90,TRUE,100,TRUE,100,TRUE,100,TRUE,84,TRUE,100,TRUE,77,TRUE,94,TRUE,95,TRUE,85,TRUE,75,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,-2,-3,0,2,-2,1,3,-1,3,1,-1,0,0,-1,-1,0,3,3,3,0,-2,10,1,0,3,-3,1,7,3,0,3,3,1,8,0,1,1,1,-2,10,3,3,3,2,0,10,-2,-2,3,-3,0,9,3,0,3,3,3,7,1,1,0,3,-1,10,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,59,TRUE,1,86,FALSE,1,65,TRUE,1,100,TRUE,1,91,TRUE,1,86,TRUE,1,100,TRUE,0,76,TRUE,0,100,FALSE,0,85,TRUE,0,100,TRUE,1,59,TRUE,1,100,FALSE,1,75,TRUE,0,100,FALSE,1,70,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,84,TRUE,1,100,TRUE,0,77,TRUE,0,94,TRUE,0,95,TRUE,1,85,TRUE,1,75,TRUE,1,100,0.0081,0,0,0,0,0.1225,0,0,0,0,0.0225,0.7225,0.0196,0.5776,0.0196,0,1,0.1681,0.8836,0.7056,0.01,0.1681,0.09,1,0.0625,0.5929,0.0625,0,0.7396,1,0.9025,1,0.352489286,0.189457143,0.515521429,23,71.88,21,65.63,6,75,5,62.5,5,62.5,5,62.5,15,93.75,6,37.5,88.69,75.25,87,98,94.5,91.06,86.31,6.25,23.06,0.25,24.5,35.5,32,-2.69,48.81,0,0,0,1,0,4,0,1,1,0,0,1,0,2,2,0,1,2,2,2,0,0,0,1,2,1,2,1,1,1,0,1,0,2,4,1,1,1,4,1,0.2,1.2,1,1.4,0.6,1.2,1.4,1.6,0.95,1.2,1.075,8.33,8.67,8.875,-0.4,0,-0.4,-0.2,-0.266666667,0,-2,1,0,-0.34,1,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,47 days,Male,High School (or equivalent),46,great work,1.625,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,8,3,7,5,4,9,2,1,6,4,3,2,1 +641,R_5JPSmdojOMKyeDn,46 - 52,American,,American,Male,Agree,Agree,Agree,Disagree,Agree,3,2,1,4,5,Agree,Disagree,Agree,Disagree,Agree,2,1,5,4,3,Agree,Neither Agree nor Disagree,Agree,Agree,Agree,1,2,3,4,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Agree,Agree,Disagree,Somewhat disagree,2,3,5,1,4,0,Agree,Disagree,Agree,Disagree,Agree,3,1,5,4,2,6,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,1,2,4,5,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Disagree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Disagree,Agree,1,5,4,2,3,3,Agree,Disagree,Agree,Disagree,Agree,5,4,1,3,2,1,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,4,5,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,5,1,3,2,4,TRUE,100,TRUE,97,TRUE,100,FALSE,50,TRUE,81,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-2,2,2,-2,2,-2,2,2,0,2,2,2,1,0,0,1,-1,0,2,2,-2,-1,8,2,-2,2,-2,2,0,2,1,2,1,2,6,-1,-1,1,-1,-2,7,2,2,2,-2,2,3,2,-2,2,-2,2,3,2,0,2,0,2,1,0,0,1,1,-2,5,TRUE,0,100,TRUE,1,97,TRUE,0,100,FALSE,1,50,TRUE,1,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0.0361,0.0009,0.25,0.25,0,1,0,0.25,1,1,0.25,1,0,1,1,1,1,0,0.331678571,0.056214286,0.607142857,29,90.63,22,68.75,6,75,5,62.5,4,50,7,87.5,16,100,6,37.5,91.5,80.88,85.12,100,100,95.5,87.5,21.88,22.75,5.88,22.62,50,12.5,-4.5,50,2,0,0,0,3,0,0,0,0,0,0,1,0,1,0,2,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,1,0,1,1,0,0.4,1.4,0,0,0.4,0.6,0.7,0.25,0.475,4.67,2.33,4.125,1,0,0,0.8,0.333333333,5,-3,5,2,2.34,1,1,1,-2,2,0,0,0,0,-1,1,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,46,none,0.75,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,3,6,8,2,4,5,7,1,9,4,3,2,1 +642,R_66fHMN8Wm3HAbGa,39 - 45,,Canadian,Canadian,Male,Strongly agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,5,3,1,2,4,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,5,1,3,2,4,Somewhat Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,3,2,4,1,5,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,4,3,1,5,2,1,Disagree,Disagree,Agree,Somewhat agree,Somewhat agree,4,1,2,3,5,2,Somewhat Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,1,2,4,3,5,2,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,4,2,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Disagree,Somewhat disagree,3,5,4,1,2,2,Disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,2,5,1,3,4,2,Somewhat Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,4,2,3,5,1,2,Disagree,Somewhat disagree,Disagree,Disagree,Disagree,1,3,2,5,4,FALSE,95,TRUE,60,TRUE,90,FALSE,60,TRUE,95,FALSE,100,TRUE,95,TRUE,95,TRUE,55,TRUE,95,FALSE,50,TRUE,56,FALSE,65,FALSE,100,FALSE,56,TRUE,95,FALSE,65,TRUE,100,FALSE,56,FALSE,50,TRUE,100,TRUE,92,FALSE,92,TRUE,94,FALSE,100,TRUE,80,FALSE,50,FALSE,80,FALSE,75,TRUE,85,TRUE,74,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,2,-2,0,-2,0,2,1,1,1,-2,2,0,2,-2,0,-2,-2,-2,2,1,2,-2,0,1,-2,-2,2,1,1,1,1,-2,2,0,2,2,-2,0,-2,-2,-2,2,2,2,2,-2,-1,2,-2,-1,2,1,1,2,1,-2,2,0,2,2,-2,-1,-2,-2,-2,2,FALSE,1,95,TRUE,1,60,TRUE,0,90,FALSE,1,60,TRUE,1,95,FALSE,1,100,TRUE,1,95,TRUE,1,95,TRUE,1,55,TRUE,1,95,FALSE,1,50,TRUE,0,56,FALSE,0,65,FALSE,1,100,FALSE,0,56,TRUE,1,95,FALSE,1,65,TRUE,0,100,FALSE,1,56,FALSE,1,50,TRUE,1,100,TRUE,1,92,FALSE,1,92,TRUE,1,94,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,1,80,FALSE,1,75,TRUE,1,85,TRUE,1,74,TRUE,1,100,0.0025,0.04,0.0025,0.0025,0,0,0.0036,0.0025,0.25,0.0064,0.0225,0.4225,0.2025,0.25,0.0025,0.16,0.0064,0.16,0.04,0,0,0.3136,0.1936,0,0.1225,0.25,0.0676,0.0025,0.81,1,0.0625,0.3136,0.1666,0.10635,0.22685,23,71.88,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,79.84,57.62,86.5,94.62,80.62,83.5,76.19,-12.5,-4.54,-29.88,-1,7.12,5.62,-4,-5.06,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0.2,0.4,0,0,0.6,0.2,0,0.2,0.15,0.25,0.2,1.33,2,1.75,-0.4,0.2,0,-0.2,-0.066666667,-1,-1,0,0,-0.67,1,2,2,-1,1,0,0,-2,2,-2,2,2,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,42,Too long for the reward offered.,1.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,5,4,6,2,7,8,9,1,3,2,3,4,1 +643,R_731ZPU2UTKGHQaQ,39 - 45,,Canadian,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,1,4,5,3,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,2,5,4,3,1,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,1,5,2,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,8,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,2,3,4,1,5,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,2,1,5,7,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,1,5,2,3,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,4,2,1,3,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,3,4,2,1,5,6,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,2,1,5,8,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,1,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,50,FALSE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,58,TRUE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,80,TRUE,50,TRUE,62,FALSE,69,FALSE,58,TRUE,83,TRUE,88,TRUE,89,TRUE,82,TRUE,50,TRUE,50,TRUE,71,TRUE,50,FALSE,50,TRUE,84,FALSE,100,FALSE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,100,17,0,2,1,0,2,1,-1,1,-1,3,0,-1,1,1,1,0,1,1,1,0,-1,1,-1,0,0,8,2,0,2,0,3,8,0,0,1,1,1,7,1,1,2,2,1,7,0,1,0,0,1,7,1,-1,1,-1,3,6,0,-1,1,1,1,8,1,1,2,2,1,6,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,84,FALSE,0,50,TRUE,1,50,TRUE,1,71,TRUE,0,50,TRUE,0,50,TRUE,1,82,TRUE,0,89,TRUE,1,88,TRUE,1,83,FALSE,1,58,FALSE,1,69,TRUE,0,62,TRUE,0,50,TRUE,1,80,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,58,FALSE,1,50,FALSE,1,100,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,1,50,0.25,0.1764,0.0289,0.0256,0.25,0,0,0.0841,0.25,0,1,0.0324,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.04,0.0144,0.3844,0.7921,0.1764,0.25,0.25,0,0.25,0.0961,0.25,0.25,0.218567857,0.222607143,0.214528571,17,53.13,19,59.38,4,50,6,75,6,75,3,37.5,12,75,7,43.75,67.94,56.25,65,77.62,72.88,71.62,64.25,-6.25,8.56,6.25,-10,2.62,35.38,-3.38,20.5,1,1,2,0,2,1,1,1,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1.2,0.8,0.2,0.8,0.6,0,0,0.8,0.75,0.35,0.55,7.67,7,7.125,0.6,0.8,0.2,0,0.533333333,1,2,-1,1,0.67,2,2,2,-2,2,-1,1,-2,2,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),43,interesting,1.75,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,6,3,9,2,7,5,4,1,8,3,2,4,1 +644,R_1dDRjpFlZ4n0twm,46 - 52,,Canadian,Canadian,Male,Strongly disagree,Agree,Agree,Agree,Disagree,4,3,5,1,2,Disagree,Somewhat agree,Agree,Agree,Strongly disagree,3,1,2,5,4,Agree,Agree,Agree,Agree,Strongly Disagree,2,3,5,4,1,Strongly disagree,Somewhat disagree,Disagree,Somewhat disagree,Disagree,5,3,4,2,1,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,5,1,2,3,4,Disagree,Somewhat agree,Agree,Somewhat agree,Disagree,4,1,2,3,5,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,4,3,2,1,4,Disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,2,3,5,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Agree,Agree,Agree,Somewhat disagree,5,1,3,2,4,1,Strongly disagree,Agree,Neither agree nor disagree,Agree,Strongly disagree,5,1,4,2,3,1,Agree,Strongly Agree,Agree,Agree,Disagree,3,1,2,5,4,2,Strongly disagree,Disagree,Disagree,Disagree,Disagree,3,2,4,1,5,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,90,TRUE,90,TRUE,95,FALSE,60,FALSE,50,TRUE,100,FALSE,100,TRUE,90,FALSE,100,TRUE,85,TRUE,100,FALSE,50,TRUE,65,FALSE,100,TRUE,60,TRUE,85,TRUE,95,FALSE,100,TRUE,85,FALSE,60,TRUE,60,TRUE,100,FALSE,55,TRUE,100,TRUE,100,FALSE,65,FALSE,60,FALSE,50,FALSE,100,FALSE,50,FALSE,80,20,-3,2,2,2,-2,-2,1,2,2,-3,2,2,2,2,-3,-3,-1,-2,-1,-2,-2,0,2,-1,0,4,-2,1,2,1,-2,4,1,1,1,1,0,4,-2,-2,-2,0,-3,2,-2,2,2,2,-1,1,-3,2,0,2,-3,1,2,3,2,2,-2,2,-3,-2,-2,-2,-2,1,FALSE,1,80,FALSE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,60,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,TRUE,0,60,FALSE,1,60,TRUE,1,85,FALSE,1,100,TRUE,1,95,TRUE,1,85,TRUE,0,60,FALSE,1,100,TRUE,0,65,FALSE,1,50,TRUE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,60,TRUE,0,95,TRUE,1,90,FALSE,0,90,TRUE,1,100,0,0,0.0225,0,0,0.1225,0.01,0,0.25,0.0225,0.01,0.0225,0.3025,0.36,0.36,0.25,0,0.25,0.16,0,0,0.0025,0.4225,0,0.36,0.25,0.81,0.04,0,0,0.9025,0.16,0.180982143,0.14,0.221964286,20,62.5,24,75,3,37.5,5,62.5,8,100,8,100,12,75,12,75,80.62,64.38,83.12,95.62,79.38,86.56,74.69,-12.5,5.62,26.88,20.62,-4.38,-20.62,11.56,-0.31,1,2,0,3,2,0,0,0,1,1,1,1,1,1,3,1,1,0,1,1,1,0,0,0,1,1,1,2,0,0,0,1,0,0,1,0,1,0,1,0,1.6,0.4,1.4,0.8,0.4,0.8,0.4,0.4,1.05,0.5,0.775,4,1.33,2.375,1.2,-0.4,1,0.4,0.6,3,3,2,1,2.67,1,1,1,-2,2,-1,1,-1,1,-1,1,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,48,,1,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,8,5,6,9,7,3,4,1,2,2,3,4,1 +645,R_6I70FHN36RzXTsR,46 - 52,American,,American,Male,Neither agree nor disagree,Strongly agree,Disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,5,3,4,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,3,1,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,1,2,4,3,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,3,2,5,1,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,0,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Agree,3,1,2,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,3,2,4,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Disagree,Somewhat agree,Neither agree nor disagree,4,2,3,1,5,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,2,1,5,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,4,3,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,FALSE,50,FALSE,50,TRUE,75,FALSE,75,TRUE,50,TRUE,75,FALSE,90,TRUE,75,FALSE,75,TRUE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,75,FALSE,75,TRUE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,70,TRUE,100,TRUE,70,FALSE,100,TRUE,75,FALSE,50,TRUE,70,TRUE,80,TRUE,60,16,0,3,-2,0,0,-3,0,0,0,-2,1,0,2,0,2,-1,-1,0,-1,-1,1,3,1,-1,0,3,-3,0,0,0,0,0,1,0,2,2,2,2,0,0,1,0,-1,7,0,3,-2,1,0,1,-3,0,0,0,0,1,1,0,2,0,3,1,-1,0,0,-1,-1,5,TRUE,0,60,TRUE,1,80,TRUE,0,70,FALSE,1,50,TRUE,1,75,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,70,FALSE,0,50,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,FALSE,1,75,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,75,TRUE,1,75,FALSE,1,90,TRUE,1,75,TRUE,0,50,FALSE,1,75,TRUE,0,75,FALSE,0,50,FALSE,0,50,TRUE,1,75,0,0.0625,0,0.09,0.0625,0,0.0625,0.25,0.25,0,0.25,0,0.09,0.25,0.0625,0.04,0.0625,0.25,0.0625,0.01,0.25,0.25,0.25,0.25,0.0625,0.25,0.25,0.36,0.49,0.0625,0.5625,0,0.169285714,0.116428571,0.222142857,16,50,21,65.63,5,62.5,6,75,5,62.5,5,62.5,11,68.75,10,62.5,70.78,56.25,78.12,71.25,77.5,73.12,68.44,-15.63,5.15,-6.25,3.12,8.75,15,4.37,5.94,1,0,3,1,0,0,0,0,0,2,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,1,0,1,0,0,0,1,0.4,0.4,0.8,0.2,0.4,0.2,0.2,0.65,0.25,0.45,1.67,1,2.5,0.8,0,0.2,0.6,0.333333333,2,-1,1,2,0.67,1,2,0,-2,2,0,0,0,0,-1,1,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,49,none,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,5,4,8,9,3,7,2,1,6,2,4,3,1 +646,R_7KrrcA7c2ET46vs,46 - 52,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,1,2,3,4,5,Disagree,Agree,Disagree,Strongly agree,Somewhat agree,2,1,3,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,3,5,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,5,2,1,3,4,3,Agree,Somewhat disagree,Strongly agree,Agree,Strongly agree,3,5,4,1,2,7,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,5,2,3,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,1,2,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,5,2,6,Agree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,5,4,1,3,2,7,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,2,5,4,3,1,7,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,3,1,5,2,TRUE,100,FALSE,100,TRUE,84,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,64,TRUE,100,FALSE,57,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,59,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,2,-2,2,-2,3,1,3,3,3,-2,3,-3,-3,-3,-1,-3,3,3,3,0,2,5,2,-1,3,2,3,3,3,3,3,1,3,7,-1,-1,-1,-2,-1,7,3,3,3,3,3,3,2,-1,2,-1,3,6,3,3,3,-3,3,7,-2,-1,0,0,-3,7,TRUE,0,100,FALSE,0,100,TRUE,0,84,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,64,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,59,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.25,0,0,0,0,0,0,0,1,0,1,0,0.25,0,0.5625,0,0.1296,1,1,0.1849,0.3481,0,1,0.7056,1,1,0,0.336810714,0.178571429,0.49505,25,78.13,22,68.75,4,50,7,87.5,4,50,7,87.5,15,93.75,7,43.75,91.84,84.12,88.38,96.88,98,97.75,85.94,9.38,23.09,34.12,0.88,46.88,10.5,4,42.19,0,0,0,1,0,4,3,5,1,2,0,0,0,3,0,2,2,2,1,2,0,0,0,2,1,4,3,4,4,2,0,0,0,1,0,1,2,3,1,0,0.2,3,0.6,1.8,0.6,3.4,0.2,1.4,1.4,1.4,1.4,5,5.33,5.625,-0.4,-0.4,0.4,0.4,-0.133333333,2,-3,0,0,-0.33,2,2,1,-2,2,-1,1,-1,1,-2,2,1,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),51,None ,1.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,8,9,4,2,5,6,7,1,3,2,3,4,1 +647,R_7BW7avPLZO34zke,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,4,3,1,5,2,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,1,3,2,5,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,1,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Somewhat disagree,3,5,2,1,4,5,Disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,4,Neither Agree nor Disagree,Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,3,4,2,6,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,4,5,1,3,2,5,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,1,2,5,4,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,5,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,70,TRUE,80,TRUE,59,TRUE,55,TRUE,55,TRUE,60,FALSE,60,TRUE,65,FALSE,75,TRUE,90,FALSE,70,FALSE,70,FALSE,65,TRUE,75,TRUE,55,TRUE,75,TRUE,55,TRUE,55,TRUE,60,FALSE,60,TRUE,60,TRUE,65,TRUE,60,TRUE,75,TRUE,70,TRUE,65,TRUE,65,TRUE,55,TRUE,55,TRUE,65,FALSE,85,8,1,0,-2,1,-2,-3,0,0,0,-1,-1,1,1,0,1,1,1,1,0,0,0,1,2,-2,-1,6,-2,0,-1,0,0,5,0,-2,1,1,1,4,-2,1,0,-1,0,6,0,0,-2,0,-2,4,-2,0,0,0,-1,5,0,1,1,0,1,6,0,0,0,0,0,5,FALSE,1,85,TRUE,1,65,TRUE,0,55,TRUE,0,55,TRUE,1,65,TRUE,0,65,TRUE,1,70,TRUE,1,75,TRUE,1,60,TRUE,1,65,TRUE,0,60,FALSE,1,60,TRUE,1,60,TRUE,0,55,TRUE,1,55,TRUE,1,75,TRUE,0,55,TRUE,0,75,FALSE,1,65,FALSE,1,70,FALSE,0,70,TRUE,1,90,FALSE,1,75,TRUE,1,65,FALSE,1,60,TRUE,1,60,TRUE,0,55,TRUE,0,55,TRUE,0,59,TRUE,1,80,FALSE,0,70,TRUE,1,85,0.0625,0.16,0.0625,0.09,0.0225,0.4225,0.1225,0.1225,0.09,0.01,0.04,0.16,0.16,0.36,0.1225,0.1225,0.0625,0.3025,0.3025,0.16,0.49,0.2025,0.1225,0.3025,0.3025,0.3025,0.49,0.0225,0.3025,0.5625,0.3481,0.16,0.221092857,0.151428571,0.290757143,8,25,20,62.5,4,50,4,50,6,75,6,75,14,87.5,6,37.5,66.06,60.62,66.75,70,66.88,69.38,62.75,-37.5,3.56,10.62,16.75,-5,-8.12,-18.12,25.25,1,1,4,3,1,1,0,1,0,1,1,3,0,1,0,3,0,1,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,1,1,0,0,2,0.6,1,1,0.4,0.2,0.2,0.6,1.15,0.35,0.75,5,5,5.125,1.6,0.4,0.8,0.4,0.933333333,2,0,-2,1,0,1,0,1,0,0,0,0,0,0,0,0,0,5 cents,5 minutes,24 days,Male,University - Undergraduate,35,,0.25,1,1,0,0,0,1,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,02REV,9,7,8,2,6,4,5,1,3,3,2,4,1 +648,R_6P05gacJmqYglwn,32 - 38,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,2,4,1,5,3,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Agree,2,5,1,4,3,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,5,3,2,4,Strongly Agree,Agree,Agree,Agree,Agree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Agree,Strongly Agree,Agree,4,5,1,3,2,8,Somewhat agree,Disagree,Somewhat agree,Strongly disagree,Agree,2,3,5,4,1,8,Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,5,4,2,3,8,Agree,Somewhat agree,Agree,Agree,Strongly Agree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,2,3,4,5,8,Agree,Somewhat agree,Agree,Strongly disagree,Somewhat agree,1,2,3,4,5,8,Agree,Agree,Somewhat Agree,Agree,Agree,4,1,2,3,5,8,Agree,Agree,Agree,Strongly Agree,Agree,1,5,4,3,2,TRUE,76,TRUE,66,TRUE,64,FALSE,83,TRUE,98,FALSE,95,TRUE,67,TRUE,96,TRUE,74,TRUE,96,FALSE,100,TRUE,92,FALSE,92,FALSE,88,FALSE,87,TRUE,96,TRUE,93,FALSE,86,TRUE,93,FALSE,91,FALSE,96,FALSE,88,FALSE,97,FALSE,92,FALSE,81,TRUE,91,FALSE,95,FALSE,96,TRUE,85,FALSE,84,FALSE,86,FALSE,87,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,2,0,-2,2,-1,2,3,3,2,0,2,3,2,2,2,2,2,3,2,3,2,8,1,-2,1,-3,2,8,2,3,2,0,2,8,2,1,2,2,3,8,2,3,2,2,3,8,2,1,2,-3,1,8,2,2,1,2,2,8,2,2,2,3,2,8,TRUE,0,76,TRUE,1,66,TRUE,0,64,FALSE,1,83,TRUE,1,98,FALSE,1,95,TRUE,1,67,TRUE,1,96,TRUE,1,74,TRUE,1,96,FALSE,1,100,TRUE,0,92,FALSE,0,92,FALSE,1,88,FALSE,0,87,TRUE,1,96,TRUE,0,93,FALSE,1,86,TRUE,0,93,FALSE,1,91,FALSE,0,96,FALSE,0,88,FALSE,1,97,FALSE,0,92,FALSE,1,81,TRUE,1,91,FALSE,1,95,FALSE,1,96,TRUE,0,85,FALSE,0,84,FALSE,0,86,FALSE,0,87,0.0016,0.0081,0.0016,0.1089,0.7569,0.0025,0.8464,0.0016,0.0081,0.7744,0.7056,0.8464,0.0676,0,0.0004,0.1156,0.0009,0.0289,0.0016,0.0361,0.9216,0.7569,0.8649,0.0144,0.8649,0.0025,0.7396,0.5776,0.4096,0.0196,0.7225,0.8464,0.390482143,0.296807143,0.484157143,23,71.88,18,56.25,5,62.5,3,37.5,6,75,4,50,8,50,10,62.5,87.84,85.5,92.88,84.12,88.88,87.25,88.44,15.63,31.59,23,55.38,9.12,38.88,37.25,25.94,1,0,1,1,0,1,0,1,2,0,1,0,0,0,0,1,1,0,0,1,1,0,1,0,1,2,3,0,2,1,1,1,1,2,0,1,0,0,1,0,0.6,0.8,0.2,0.6,0.6,1.6,1,0.4,0.55,0.9,0.725,8,8,8,0,-0.8,-0.8,0.2,-0.533333333,0,0,0,0,0,1,0,1,-1,1,0,0,0,0,0,0,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),37,,0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,3,8,6,5,4,2,9,1,7,4,3,2,1 +649,R_7XuMXfNpMkp9lJf,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Disagree,Neither agree nor disagree,3,5,1,4,2,Strongly agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,1,2,4,3,5,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,1,4,2,5,3,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,1,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Disagree,4,2,5,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,3,5,4,2,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,5,2,0,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,2,5,4,3,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,5,2,3,4,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,5,3,1,2,0,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,5,4,2,3,1,0,Agree,Disagree,Strongly Agree,Strongly Agree,Agree,1,5,4,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,93,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,51,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,64,FALSE,97,FALSE,50,TRUE,91,FALSE,50,FALSE,50,FALSE,50,FALSE,95,FALSE,54,FALSE,86,TRUE,50,TRUE,52,FALSE,100,28,1,3,2,-2,0,3,-3,2,-3,0,3,2,3,2,3,1,3,1,1,1,3,3,3,-3,-2,0,3,3,3,3,0,0,3,3,3,3,3,0,3,2,1,1,3,0,1,3,3,-3,-3,0,0,0,0,-1,-1,0,2,3,0,-3,3,0,2,-2,3,3,2,8,FALSE,1,100,TRUE,1,52,TRUE,0,50,FALSE,1,86,FALSE,0,54,FALSE,1,95,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,91,FALSE,1,50,FALSE,1,97,TRUE,1,64,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,51,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,93,0.25,0.25,0.25,0.25,0.0049,0.0025,0.25,0.0081,0.25,0.25,0.25,0.1296,0.25,0.25,0.2916,0.2304,0,0.0196,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.2601,0.25,0.0009,0.185632143,0.156192857,0.215071429,28,87.5,16,50,5,62.5,6,75,3,37.5,2,25,4,25,12,75,60.41,54.75,69.5,61.5,55.88,56.5,64.31,37.5,10.41,-7.75,-5.5,24,30.88,31.5,-10.69,2,0,1,1,2,0,6,1,6,0,0,1,0,1,0,2,1,0,0,2,0,0,1,1,3,3,3,2,2,1,1,1,3,5,0,1,5,2,2,1,1.2,2.6,0.4,1,1,2.2,2,2.2,1.3,1.85,1.575,0,0,1,0.2,0.4,-1.6,-1.2,-0.333333333,0,0,0,-8,0,2,2,-2,-2,2,2,-2,-2,2,-2,2,2,5 cents,100 minutes,47 days,Male,High School (or equivalent),35,Cool survey; the math problems were fun!,1,1,0,1,0,1,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,8,7,6,9,3,5,2,1,4,2,3,4,1 +650,R_7BbvZqPsCnAtPHL,53 - 59,American,,American,Male,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,3,2,5,4,1,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,1,4,2,5,3,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,4,5,1,2,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,2,3,5,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,3,4,2,1,7,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,2,4,5,1,3,7,Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,2,5,1,3,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,4,5,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,5,1,4,2,3,7,Somewhat disagree,Disagree,Agree,Disagree,Agree,1,2,5,3,4,4,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,2,3,1,5,4,7,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,3,5,1,2,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,88,FALSE,60,FALSE,93,FALSE,91,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,90,TRUE,100,FALSE,99,FALSE,58,TRUE,100,FALSE,95,FALSE,100,TRUE,97,FALSE,91,FALSE,100,TRUE,100,FALSE,55,TRUE,75,TRUE,89,TRUE,100,FALSE,55,FALSE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,3,2,1,2,-3,2,-3,3,1,-3,2,-3,3,-3,-3,-3,-3,-3,2,1,1,-1,-1,7,3,2,2,1,3,7,-2,-3,2,-2,3,7,1,1,1,1,-2,8,3,1,3,3,-3,7,-1,-2,2,-2,2,4,2,-3,2,-3,3,7,-3,-3,0,-3,-3,9,TRUE,0,100,TRUE,1,100,TRUE,0,88,FALSE,1,60,FALSE,0,93,FALSE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,90,TRUE,1,100,FALSE,1,99,FALSE,0,58,TRUE,1,100,FALSE,1,95,FALSE,1,100,TRUE,0,97,FALSE,1,91,FALSE,0,100,TRUE,1,100,FALSE,1,55,TRUE,1,75,TRUE,0,89,TRUE,1,100,FALSE,1,55,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,100,0,0,0,0,0,0.0081,0.0625,0,0.0081,0,0,0,0,0.5625,0.8649,0,0.2025,0.16,0,0.7921,1,0.3364,0.9409,0.0001,0.0025,0.2025,0.3025,1,0.7744,0,1,0.81,0.3225,0.133471429,0.511528571,24,75,21,65.63,4,50,5,62.5,6,75,6,75,12,75,9,56.25,89.56,75,91.75,98.5,93,92.56,86.56,9.37,23.93,25,29.25,23.5,18,17.56,30.31,2,1,2,3,2,1,5,0,4,0,3,0,0,1,0,4,4,4,4,1,3,1,0,1,4,3,1,0,1,1,1,0,0,0,0,0,0,3,0,0,2,2,0.8,3.4,1.8,1.2,0.2,0.6,2.05,0.95,1.5,7,6,7,0.2,0.8,0.6,2.8,0.533333333,0,3,0,-1,1,2,2,2,-2,2,-2,2,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),59,This was a very interesting survey.,2,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,5,6,2,3,4,9,7,1,8,2,4,3,1 +651,R_3ClE7IcIuk4W5XQ,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Agree,1,4,5,3,2,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,3,1,4,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,3,1,4,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,4,3,2,1,5,3,Disagree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,5,4,3,1,5,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,2,4,1,5,8,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,1,2,3,5,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,3,1,4,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,2,3,4,1,5,8,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,2,1,5,3,4,FALSE,100,TRUE,90,TRUE,100,FALSE,54,TRUE,100,FALSE,76,TRUE,94,TRUE,98,TRUE,87,TRUE,98,FALSE,95,TRUE,98,FALSE,79,TRUE,79,TRUE,77,TRUE,99,TRUE,69,FALSE,85,FALSE,92,FALSE,99,FALSE,73,TRUE,84,FALSE,98,TRUE,92,FALSE,60,TRUE,98,FALSE,94,FALSE,93,TRUE,86,TRUE,92,FALSE,50,TRUE,98,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,0,2,-1,-2,1,-1,1,0,1,2,0,2,0,0,1,1,-3,3,3,1,-2,3,7,-2,0,1,-2,0,3,2,1,2,1,2,5,1,2,1,1,2,8,3,3,0,1,0,5,-1,-1,1,-2,0,3,0,0,2,0,2,5,-1,-1,-1,-1,-3,8,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,54,TRUE,1,100,FALSE,1,76,TRUE,1,94,TRUE,1,98,TRUE,1,87,TRUE,1,98,FALSE,1,95,TRUE,0,98,FALSE,0,79,TRUE,0,79,TRUE,1,77,TRUE,1,99,TRUE,0,69,FALSE,1,85,FALSE,1,92,FALSE,1,99,FALSE,0,73,TRUE,1,84,FALSE,1,98,TRUE,1,92,FALSE,1,60,TRUE,1,98,FALSE,1,94,FALSE,1,93,TRUE,0,86,TRUE,1,92,FALSE,0,50,TRUE,1,98,0.0004,0.0004,0.0001,0.0036,0.0004,0.0576,0.0064,0.0004,0.0001,0.0256,0.0064,0.6241,0.0169,0.0025,0,0.01,0.0004,0.2116,0.0049,0.16,0.5329,0.0529,0.0064,0.6241,0.4761,0.0036,0.25,0,1,0.0225,0.7396,0.9604,0.206992857,0.068742857,0.345242857,24,75,24,75,7,87.5,4,50,7,87.5,6,75,13,81.25,11,68.75,87.09,79.88,84.88,87.25,96.38,88.06,86.12,0,12.09,-7.62,34.88,-0.25,21.38,6.81,17.37,0,0,1,2,1,1,2,0,1,1,2,0,0,1,0,1,2,0,0,5,0,0,2,1,2,0,1,0,1,1,0,1,0,0,0,1,1,2,2,0,0.8,1,0.6,1.6,1,0.6,0.2,1.2,1,0.75,0.875,5,4.33,5.5,-0.2,0.4,0.4,0.4,0.2,2,0,0,0,0.67,1,-2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),57,none,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,6,8,2,7,3,5,4,1,9,3,2,4,1 +652,R_7vk59A621u2tiiO,46 - 52,American,,American,Male,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Disagree,Agree,4,5,1,3,2,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat disagree,5,2,3,4,1,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,3,4,2,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,2,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,1,3,2,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,3,1,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,3,4,2,5,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,55,TRUE,56,FALSE,68,FALSE,54,FALSE,50,FALSE,57,FALSE,55,FALSE,55,FALSE,56,FALSE,77,TRUE,65,FALSE,81,FALSE,87,FALSE,54,TRUE,85,TRUE,71,FALSE,56,FALSE,53,TRUE,52,TRUE,73,TRUE,87,FALSE,55,TRUE,97,FALSE,53,FALSE,54,TRUE,52,FALSE,57,FALSE,52,FALSE,78,TRUE,72,FALSE,54,FALSE,77,10,1,0,-1,-2,2,-2,0,3,1,-1,3,0,1,1,0,-1,-1,1,1,-1,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,6,0,-1,0,-2,1,6,0,0,0,0,0,6,0,0,0,0,1,6,0,0,0,0,0,5,FALSE,1,77,FALSE,0,54,TRUE,0,72,FALSE,1,78,FALSE,0,52,FALSE,1,57,TRUE,1,52,FALSE,0,54,FALSE,0,53,TRUE,1,97,FALSE,1,55,TRUE,0,87,TRUE,1,73,TRUE,0,52,FALSE,0,53,FALSE,0,56,TRUE,0,71,TRUE,0,85,FALSE,1,54,FALSE,1,87,FALSE,0,81,TRUE,1,65,FALSE,1,77,FALSE,0,56,FALSE,1,55,FALSE,0,55,FALSE,1,57,FALSE,1,50,FALSE,1,54,FALSE,0,68,TRUE,1,56,FALSE,0,55,0.2916,0.3025,0.3136,0.2304,0.3025,0.1849,0.3136,0.0009,0.0169,0.1225,0.4624,0.0729,0.2809,0.2025,0.2704,0.2916,0.0529,0.0484,0.25,0.2025,0.6561,0.2809,0.2116,0.2704,0.5041,0.1849,0.1936,0.0529,0.5184,0.7225,0.2116,0.7569,0.272846429,0.187378571,0.358314286,10,31.25,16,50,5,62.5,4,50,5,62.5,2,25,5,31.25,11,68.75,64,57.5,65,67.25,66.25,61.25,66.75,-18.75,14,-5,15,4.75,41.25,30,-2,1,0,1,2,2,2,0,3,1,1,3,0,1,1,0,1,1,1,1,1,1,1,1,0,1,2,0,3,1,1,3,0,1,1,1,1,1,1,1,1,1.2,1.4,1,1,0.8,1.4,1.2,1,1.15,1.1,1.125,5.33,6,5.625,0.4,0,-0.2,0,0.066666667,0,-1,-1,1,-0.67,-1,1,1,-1,1,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,51,No feeback,0.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,6,8,9,2,3,5,4,1,7,4,2,3,1 +653,R_5AqyTyOrKkGLL4R,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,1,5,2,Somewhat agree,Disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,4,3,1,2,5,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,Strongly Agree,2,4,3,1,5,Somewhat agree,Neither agree nor disagree,Agree,Agree,Agree,2,3,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,3,Somewhat disagree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,2,5,3,4,5,Strongly Agree,Strongly Agree,Agree,Somewhat Disagree,Somewhat Agree,4,3,2,5,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,6,Neither agree nor disagree,Disagree,Strongly agree,Neither agree nor disagree,Agree,2,4,5,1,3,6,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,Strongly agree,1,2,4,5,3,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,1,3,4,5,TRUE,73,TRUE,70,TRUE,61,FALSE,76,FALSE,53,TRUE,57,TRUE,90,TRUE,78,FALSE,53,TRUE,82,FALSE,82,FALSE,77,FALSE,80,TRUE,61,FALSE,58,TRUE,62,FALSE,77,FALSE,74,FALSE,54,FALSE,62,FALSE,100,TRUE,60,FALSE,59,TRUE,59,TRUE,65,TRUE,80,TRUE,68,FALSE,70,TRUE,62,TRUE,100,TRUE,70,FALSE,76,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,1,-2,3,1,0,3,3,2,1,3,1,0,2,2,2,3,3,3,3,3,2,-1,-2,3,-3,0,3,3,3,2,-1,1,5,1,1,1,1,0,3,3,3,3,3,3,5,0,-2,3,0,2,6,3,3,2,0,3,6,1,1,2,1,1,5,TRUE,0,73,TRUE,1,70,TRUE,0,61,FALSE,1,76,FALSE,0,53,TRUE,0,57,TRUE,1,90,TRUE,1,78,FALSE,0,53,TRUE,1,82,FALSE,1,82,FALSE,1,77,FALSE,0,80,TRUE,0,61,FALSE,0,58,TRUE,1,62,FALSE,1,77,FALSE,1,74,FALSE,1,54,FALSE,1,62,FALSE,0,100,TRUE,1,60,FALSE,1,59,TRUE,1,59,TRUE,0,65,TRUE,1,80,TRUE,0,68,FALSE,1,70,TRUE,0,62,TRUE,1,100,TRUE,1,70,FALSE,0,76,0.0484,0.04,0.1444,0.01,0.5776,0.3249,0.1681,0.0324,0.1444,0.16,0,0.64,0.2809,0.0324,0.2809,0.09,0.1681,0.0576,0.09,0.4225,1,0.3364,0.2116,0.3721,0.0529,0.4624,0.09,0.5329,0.3721,0.0676,0.3844,0.0529,0.264467857,0.211235714,0.3177,15,46.88,19,59.38,5,62.5,2,25,5,62.5,7,87.5,10,62.5,9,56.25,70.28,66.38,70.5,73.12,71.12,73.19,67.38,-12.5,10.9,3.88,45.5,10.62,-16.38,10.69,11.13,0,0,0,0,0,2,0,0,4,0,0,0,0,2,2,0,1,1,1,2,0,0,0,0,0,1,0,0,1,2,0,0,0,1,0,0,1,0,1,1,0,1.2,0.8,1,0,0.8,0.2,0.6,0.75,0.4,0.575,3.33,5.67,4.375,0,0.4,0.6,0.4,0.333333333,-3,-3,-1,-2,-2.34,0,2,0,-2,2,2,-2,-2,2,0,0,1,10 cents,75 minutes,24 days,Male,Trade School (non-military),55,,0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,01DIR,4,3,2,7,6,9,5,1,8,4,3,2,1 +654,R_7uOZIAqY9LEalrz,39 - 45,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,2,1,4,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,1,3,4,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,2,4,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,1,4,8,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,3,4,1,2,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,2,3,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,4,3,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,3,2,5,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,1,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,70,TRUE,70,TRUE,91,FALSE,70,TRUE,91,FALSE,69,FALSE,69,FALSE,68,TRUE,65,FALSE,67,TRUE,74,FALSE,79,TRUE,71,FALSE,64,FALSE,67,TRUE,69,TRUE,78,FALSE,65,TRUE,76,TRUE,73,TRUE,72,FALSE,69,TRUE,72,FALSE,67,FALSE,66,FALSE,70,FALSE,73,TRUE,73,TRUE,77,TRUE,74,TRUE,76,FALSE,69,20,0,0,0,0,2,-1,-1,1,-1,-1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,8,-1,-1,-1,-1,-1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,1,1,1,1,1,8,FALSE,1,69,TRUE,1,76,TRUE,0,74,TRUE,0,77,TRUE,1,73,FALSE,1,73,FALSE,0,70,FALSE,0,66,FALSE,0,67,TRUE,1,72,FALSE,1,69,TRUE,0,72,TRUE,1,73,TRUE,0,76,FALSE,0,65,TRUE,1,78,TRUE,0,69,FALSE,1,67,FALSE,1,64,TRUE,0,71,FALSE,0,79,TRUE,1,74,FALSE,1,67,TRUE,1,65,FALSE,1,68,FALSE,0,69,FALSE,1,69,TRUE,0,91,FALSE,1,70,TRUE,1,91,TRUE,1,70,FALSE,0,70,0.4356,0.4761,0.0484,0.49,0.49,0.0729,0.1225,0.0784,0.5041,0.0676,0.0081,0.0729,0.4489,0.0961,0.0729,0.0576,0.1089,0.5929,0.8281,0.1024,0.6241,0.4225,0.1296,0.5776,0.4761,0.0961,0.09,0.0961,0.5476,0.1089,0.09,0.5184,0.267903571,0.199557143,0.33625,20,62.5,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,9,56.25,9,56.25,72,69.62,71.75,70.62,76,72.38,71.62,6.25,15.75,7.12,9.25,8.12,38.5,16.13,15.37,1,1,1,1,1,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,2,2,0,2,2,0,0,0,0,1,0,0,0,0,0,1,0.4,0.2,0,1,1.6,0.2,0,0.4,0.7,0.55,8,8,8,0,-1.2,0,0,-0.4,0,0,0,0,0,1,1,1,1,-1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,15 days,Male,University - Undergraduate,40,not sure,0,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,3,7,5,8,9,4,6,1,2,2,4,3,1 +655,R_1w66l8DC239XPIO,39 - 45,,Canadian,Canadian,Male,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Agree,4,1,5,3,2,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,2,4,3,1,Strongly Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Agree,2,5,1,3,4,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,4,5,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly disagree,Somewhat agree,Disagree,Strongly Agree,Strongly Agree,4,2,1,3,5,8,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,3,4,5,1,2,7,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Disagree,Agree,2,4,5,3,1,8,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly disagree,Agree,Neither agree nor disagree,Strongly Agree,Agree,2,1,5,3,4,8,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,1,2,3,5,7,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Agree,2,4,3,1,5,9,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,5,1,4,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,53,TRUE,54,TRUE,75,FALSE,50,FALSE,93,FALSE,53,TRUE,82,TRUE,91,FALSE,53,TRUE,69,TRUE,94,FALSE,63,FALSE,74,FALSE,92,TRUE,100,FALSE,69,TRUE,100,TRUE,76,FALSE,59,TRUE,86,TRUE,100,FALSE,57,TRUE,92,TRUE,84,FALSE,59,TRUE,93,TRUE,87,TRUE,91,FALSE,65,TRUE,96,TRUE,97,FALSE,80,9,-3,1,0,3,2,0,-3,2,-3,1,3,0,2,-3,2,-1,1,1,0,-3,-3,1,-2,3,3,8,0,-3,1,-3,2,8,3,1,0,-3,2,7,1,1,2,2,-2,8,-3,2,0,3,2,5,0,-3,2,-3,1,8,3,0,0,-3,2,7,1,1,2,2,-2,9,FALSE,1,80,TRUE,1,97,TRUE,0,96,FALSE,1,65,TRUE,1,91,TRUE,0,87,TRUE,1,93,FALSE,0,59,TRUE,1,84,TRUE,1,92,FALSE,1,57,TRUE,0,100,TRUE,1,86,FALSE,1,59,TRUE,1,76,TRUE,1,100,FALSE,1,69,TRUE,0,100,FALSE,1,92,FALSE,1,74,FALSE,0,63,TRUE,1,94,TRUE,0,69,FALSE,0,53,TRUE,0,91,TRUE,1,82,FALSE,1,53,FALSE,1,93,FALSE,1,50,TRUE,1,75,TRUE,1,54,TRUE,1,53,0.3481,0.0324,0,0.0049,0.2209,0.7569,0.2809,0.0064,0.0676,0.0036,0.0625,0.0196,0.0256,0.1849,0.0081,0.0009,0.4761,0.1225,0.0049,0.8281,0.3969,0.0576,0.0064,0.1681,0.0961,0.2209,0.2116,0.04,0.9216,1,0.25,1,0.265667857,0.15975,0.371585714,9,28.13,23,71.88,8,100,5,62.5,6,75,4,50,13,81.25,10,62.5,77.72,72.25,71,86.38,81.25,78.25,77.19,-43.75,5.84,-27.75,8.5,11.38,31.25,-3,14.69,0,0,2,0,1,0,0,1,0,1,0,1,2,0,0,2,0,1,2,1,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,1,2,1,0.6,0.4,0.6,1.2,0.2,0,0.4,1.2,0.7,0.45,0.575,7.67,6.67,7.5,0.4,0.4,0.2,0,0.333333333,3,0,0,-1,1,-1,0,1,-1,1,2,-2,0,0,1,-1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,45,it was a fun survey,-0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,2,7,6,9,5,8,4,1,3,3,4,2,1 +656,R_6nUsAJTWZgp44VO,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,1,5,3,2,Somewhat agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,5,4,1,2,3,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,2,5,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,5,1,4,2,3,Disagree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,5,1,4,3,2,8,Disagree,Disagree,Somewhat agree,Disagree,Agree,2,3,4,5,1,7,Disagree,Disagree,Agree,Agree,Agree,5,4,2,1,3,7,Strongly Agree,Agree,Agree,Agree,Strongly Agree,3,5,4,1,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,2,5,1,3,4,Agree,Disagree,Agree,Disagree,Agree,3,4,2,1,5,7,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,1,4,5,2,8,Agree,Somewhat agree,Agree,Agree,Agree,1,3,2,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,69,TRUE,60,FALSE,76,TRUE,80,FALSE,54,TRUE,82,TRUE,86,FALSE,56,TRUE,62,TRUE,84,FALSE,82,TRUE,85,FALSE,81,FALSE,85,TRUE,88,TRUE,74,FALSE,79,TRUE,72,TRUE,85,FALSE,89,TRUE,79,TRUE,84,FALSE,77,TRUE,81,FALSE,74,TRUE,79,TRUE,78,TRUE,100,FALSE,86,TRUE,92,FALSE,64,TRUE,93,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,2,3,1,-2,3,-1,3,0,1,3,0,2,0,1,1,2,-1,-2,3,3,1,-1,8,-2,-2,1,-2,2,7,-2,-2,2,2,2,7,3,2,2,2,3,8,2,2,2,1,1,4,2,-2,2,-2,2,7,1,1,2,1,2,8,2,1,2,2,2,8,FALSE,1,69,TRUE,1,60,FALSE,1,76,TRUE,0,80,FALSE,0,54,TRUE,0,82,TRUE,1,86,FALSE,0,56,TRUE,1,62,TRUE,1,84,FALSE,1,82,TRUE,0,85,FALSE,0,81,FALSE,1,85,TRUE,1,88,TRUE,1,74,FALSE,1,79,TRUE,0,72,TRUE,0,85,FALSE,1,89,TRUE,1,79,TRUE,1,84,FALSE,1,77,TRUE,1,81,FALSE,1,74,TRUE,1,79,TRUE,0,78,TRUE,0,100,FALSE,1,86,TRUE,1,92,FALSE,0,64,TRUE,1,93,0.3136,0.0441,0.0676,0.0196,0.0049,0.6724,0.0361,0.0256,0.0121,0.0256,0.0064,0.6561,0.1444,0.0324,0.2916,0.16,0.0529,0.64,1,0.0676,0.0441,0.0144,0.7225,0.0225,0.0441,0.6084,0.4096,0.0961,0.0576,0.5184,0.0196,0.7225,0.253853571,0.197178571,0.310528571,15,46.88,21,65.63,4,50,5,62.5,7,87.5,5,62.5,12,75,9,56.25,78.62,74.88,78.88,79.12,81.62,76.06,81.19,-18.75,12.99,24.88,16.38,-8.38,19.12,1.06,24.94,3,0,0,1,4,3,0,2,1,1,2,3,1,2,0,3,1,1,0,4,1,1,1,1,2,1,0,1,1,1,1,0,1,1,0,2,0,1,0,3,1.6,1.4,1.6,1.8,1.2,0.8,0.6,1.2,1.6,0.95,1.275,7.33,6.33,7.125,0.4,0.6,1,0.6,0.666666667,4,0,-1,0,1,-1,1,2,1,-1,2,-2,1,-1,1,-1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,"I think that having belief in yourself is important in order to keep learning as you go through life. You may not always be right, but you do have the right to choose, and as well, the most important lesson of all: the right to learn.",-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,9,3,4,6,7,8,5,1,2,4,2,3,1 +657,R_8yfGtl8dxbEotbe,39 - 45,American,,American,Male,Somewhat disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,2,4,1,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,4,2,3,1,5,Agree,Neither Agree nor Disagree,Disagree,Agree,Somewhat Disagree,5,4,1,2,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Agree,Disagree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Disagree,Agree,Neither agree nor disagree,Agree,1,2,4,5,3,5,Somewhat agree,Disagree,Somewhat disagree,Somewhat disagree,Strongly agree,3,1,2,5,4,8,Disagree,Strongly Disagree,Somewhat Agree,Somewhat Agree,Disagree,2,3,1,5,4,6,Disagree,Agree,Neither agree nor disagree,Agree,Disagree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Disagree,Neither agree nor disagree,Strongly disagree,1,4,2,5,3,7,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Disagree,Neither agree nor disagree,5,2,4,3,1,8,Neither Agree nor Disagree,Strongly Disagree,Agree,Agree,Neither Agree nor Disagree,2,3,5,4,1,3,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Agree,4,1,3,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,56,TRUE,65,TRUE,84,FALSE,60,TRUE,86,FALSE,61,FALSE,73,FALSE,88,FALSE,57,TRUE,83,TRUE,76,TRUE,89,FALSE,67,TRUE,75,FALSE,83,TRUE,90,TRUE,88,FALSE,77,TRUE,92,FALSE,61,FALSE,59,TRUE,77,TRUE,88,TRUE,66,TRUE,66,TRUE,62,FALSE,78,FALSE,64,TRUE,57,TRUE,96,FALSE,83,FALSE,66,13,-1,3,3,0,1,1,0,1,-2,0,2,0,-2,2,-1,-1,0,-1,2,-2,2,-2,2,0,2,3,1,-2,-1,-1,3,5,-2,-3,1,1,-2,8,-2,2,0,2,-2,6,2,1,-2,0,-3,4,0,-1,-1,-2,0,7,0,-3,2,2,0,8,1,1,2,-1,2,3,FALSE,1,66,FALSE,0,83,TRUE,0,96,TRUE,0,57,FALSE,0,64,FALSE,1,78,TRUE,1,62,TRUE,1,66,TRUE,1,66,TRUE,1,88,TRUE,0,77,FALSE,1,59,FALSE,0,61,TRUE,0,92,FALSE,0,77,TRUE,1,88,TRUE,0,90,FALSE,1,83,TRUE,0,75,FALSE,1,67,TRUE,1,89,TRUE,1,76,TRUE,0,83,FALSE,0,57,FALSE,1,88,FALSE,0,73,FALSE,1,61,TRUE,0,86,FALSE,1,60,TRUE,1,84,TRUE,1,65,FALSE,0,56,0.1156,0.5329,0.0144,0.1444,0.3136,0.0484,0.3249,0.0144,0.1089,0.0576,0.0256,0.3721,0.1156,0.5929,0.4096,0.6889,0.6889,0.3249,0.7396,0.0144,0.0121,0.5929,0.5625,0.8464,0.81,0.1521,0.1225,0.1156,0.9216,0.0289,0.16,0.1681,0.333321429,0.291878571,0.374764286,13,40.63,17,53.13,3,37.5,3,37.5,6,75,5,62.5,9,56.25,8,50,74.16,70.12,72.62,78.5,75.38,72.19,76.12,-12.5,21.03,32.62,35.12,3.5,12.88,15.94,26.12,3,5,1,0,1,0,2,2,1,3,4,3,3,1,1,1,2,1,0,0,3,2,5,0,4,1,1,2,0,0,2,3,4,0,1,2,1,3,3,4,2,1.6,2.4,0.8,2.8,0.8,2,2.6,1.7,2.05,1.875,5.33,6.33,5.5,-0.8,0.8,0.4,-1.8,0.133333333,-1,-2,0,3,-1,0,1,-1,-2,2,2,-2,1,-1,1,-1,-1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),44,The questions were hard but interesting.,-0.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,2,8,4,7,6,9,3,1,5,3,2,4,1 +658,R_64RW0hFTd5hbqhP,32 - 38,,Canadian,Canadian,Male,Agree,Somewhat agree,Agree,Somewhat agree,Agree,4,3,2,5,1,Agree,Somewhat agree,Somewhat agree,Disagree,Agree,5,1,4,2,3,Strongly Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,1,4,2,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,2,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,5,4,1,2,3,1,Strongly agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,1,5,4,3,2,1,Strongly Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,2,4,1,5,4,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Somewhat agree,Agree,4,3,1,5,2,1,Strongly agree,Disagree,Somewhat agree,Somewhat disagree,Strongly agree,5,4,2,1,3,1,Strongly Disagree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,2,3,4,2,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,3,5,2,FALSE,60,TRUE,55,TRUE,66,FALSE,70,TRUE,90,FALSE,93,TRUE,74,TRUE,54,TRUE,78,FALSE,51,FALSE,71,TRUE,62,TRUE,72,FALSE,89,TRUE,53,TRUE,97,FALSE,59,TRUE,85,FALSE,51,FALSE,99,TRUE,51,FALSE,51,FALSE,71,TRUE,78,FALSE,97,FALSE,59,FALSE,51,FALSE,52,FALSE,51,FALSE,52,FALSE,52,FALSE,58,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,1,2,2,1,1,-2,2,-3,-3,3,-1,3,0,0,1,-1,-1,2,1,2,0,2,1,3,-1,0,-1,3,1,-3,-3,3,-1,3,1,0,-1,0,-1,-1,4,2,2,2,1,2,1,3,-2,1,-1,3,1,-3,-3,3,-1,3,1,0,-1,1,1,-1,2,FALSE,1,60,TRUE,1,55,TRUE,0,66,FALSE,1,70,TRUE,1,90,FALSE,1,93,TRUE,1,74,TRUE,1,54,TRUE,1,78,FALSE,0,51,FALSE,1,71,TRUE,0,62,TRUE,1,72,FALSE,1,89,TRUE,1,53,TRUE,1,97,FALSE,1,59,TRUE,0,85,FALSE,1,51,FALSE,1,99,TRUE,1,51,FALSE,0,51,FALSE,1,71,TRUE,1,78,FALSE,1,97,FALSE,0,59,FALSE,1,51,FALSE,1,52,FALSE,1,51,FALSE,0,52,FALSE,0,52,FALSE,0,58,0.2116,0.3481,0.0009,0.0676,0.3364,0.0049,0.0484,0.2601,0.0001,0.2601,0.2704,0.0784,0.0484,0.0841,0.01,0.2025,0.0841,0.09,0.2304,0.0009,0.2401,0.2209,0.2401,0.0121,0.1681,0.2401,0.2704,0.16,0.4356,0.7225,0.2401,0.3844,0.190842857,0.126992857,0.254692857,25,78.13,23,71.88,7,87.5,7,87.5,4,50,5,62.5,10,62.5,13,81.25,67.25,60.12,68.12,70.75,70,64.06,70.44,6.25,-4.63,-27.38,-19.38,20.75,7.5,1.56,-10.81,0,0,0,1,0,1,2,1,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,1,3,0,1,1,0,0,0,0,0,0,1,0,2,0,0.2,1.2,0,0.4,0.2,1.2,0,0.6,0.45,0.5,0.475,1,1,1.5,0,0,0,-0.2,0,0,0,0,2,0,1,2,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,fun,1.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,5,4,3,8,2,7,9,1,6,3,2,4,1 +659,R_5lGxOvHem88IAP7,18 - 24,,Canadian,Canadian,Male,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,4,3,5,2,1,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Agree,5,2,4,1,3,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,1,3,2,4,5,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Disagree,Strongly Agree,Strongly disagree,Agree,1,5,2,4,3,8,Disagree,Somewhat agree,Somewhat disagree,Disagree,Disagree,2,4,3,1,5,7,Agree,Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,2,1,5,3,4,1,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Agree,3,5,2,1,4,3,Somewhat agree,Disagree,Strongly agree,Strongly disagree,Agree,4,2,5,1,3,2,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly agree,5,3,2,4,1,1,Agree,Agree,Agree,Agree,Agree,4,2,5,1,3,FALSE,100,FALSE,60,TRUE,100,TRUE,60,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,65,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,80,TRUE,86,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,60,TRUE,100,TRUE,60,TRUE,100,TRUE,100,FALSE,100,FALSE,60,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,0,2,1,0,2,-2,2,2,0,2,1,3,2,2,2,2,2,3,-2,3,-3,2,8,-2,1,-1,-2,-2,8,2,2,-1,0,2,7,2,2,2,2,2,1,3,2,1,1,2,3,1,-2,3,-3,2,3,2,-1,2,0,3,2,2,2,2,2,2,1,FALSE,1,100,FALSE,0,60,TRUE,0,100,TRUE,0,60,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,65,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,80,TRUE,0,86,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,60,TRUE,1,100,TRUE,0,60,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,0,60,TRUE,1,100,0,0,0,0,0,0,1,0,0.7396,0,1,0,0.1225,1,0.25,0.36,0,0.36,1,0.16,0,0,0.64,1,1,0.36,0.36,0,1,1,1,1,0.476860714,0.34515,0.608571429,24,75,16,50,2,25,6,75,6,75,2,25,12,75,4,25,90.03,73.12,93.75,95,98.25,89.69,90.38,25,40.03,48.12,18.75,20,73.25,14.69,65.38,0,4,2,3,0,3,1,3,0,4,0,2,3,1,1,0,0,0,0,0,0,0,0,1,0,0,2,1,1,0,0,1,0,1,0,0,0,0,0,0,1.8,2.2,1.4,0,0.2,0.8,0.4,0,1.35,0.35,0.85,7.67,2.67,4.125,1.6,1.4,1,0,1.333333333,5,5,5,0,5,1,1,2,-2,2,0,0,0,0,-2,2,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),18,,1.125,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,3,6,5,4,9,8,1,7,2,3,4,1 +660,R_5WZnCnA5ZMfjqh1,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Somewhat agree,Agree,Strongly agree,5,1,4,3,2,Somewhat agree,Agree,Agree,Somewhat agree,Agree,3,1,4,2,5,Somewhat Agree,Agree,Strongly Agree,Agree,Agree,3,5,2,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,4,1,2,5,3,Agree,Strongly Agree,Agree,Agree,Strongly Agree,5,3,1,4,2,8,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,4,1,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,4,1,3,2,5,8,Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,5,1,2,3,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Agree,Strongly Agree,3,5,2,1,4,7,Somewhat agree,Agree,Strongly agree,Somewhat agree,Agree,3,1,5,4,2,7,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,Agree,5,1,3,4,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,5,4,1,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,50,TRUE,70,TRUE,61,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,85,TRUE,85,TRUE,100,TRUE,88,FALSE,75,FALSE,100,TRUE,85,FALSE,85,TRUE,81,TRUE,82,TRUE,81,TRUE,80,FALSE,100,TRUE,90,FALSE,64,FALSE,90,TRUE,70,FALSE,100,18,2,2,1,2,3,1,2,2,1,2,1,2,3,2,2,1,1,1,2,0,2,3,2,2,3,8,2,3,3,3,3,5,0,0,2,1,2,8,2,2,3,1,1,8,2,2,1,2,3,7,1,2,3,1,2,7,1,2,3,3,2,6,1,1,1,2,0,7,FALSE,1,100,TRUE,1,70,FALSE,1,90,FALSE,1,64,TRUE,1,90,FALSE,1,100,TRUE,1,80,TRUE,1,81,TRUE,1,82,TRUE,1,81,FALSE,1,85,TRUE,0,85,FALSE,0,100,FALSE,1,75,TRUE,1,88,TRUE,1,100,TRUE,0,85,TRUE,0,85,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,61,TRUE,0,70,FALSE,0,50,TRUE,1,100,TRUE,1,100,0.0361,0,0,0.04,0,0,0,0.0361,0,0,0.25,1,0.0324,0.0225,0.01,0.09,0,0.1296,0.3721,0,0,0.0144,0,0.0625,0.7225,0,0,0,0.01,0.7225,0.49,0.7225,0.167396429,0.112185714,0.222607143,18,56.25,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,88.19,86.12,93.12,90.12,83.38,88.88,87.5,-21.88,10.06,-13.88,30.62,2.62,20.88,1.38,18.75,0,1,1,0,0,1,1,1,2,1,1,2,1,1,0,1,1,2,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0.4,1.2,1,1.2,0,0.2,0.2,0,0.95,0.1,0.525,7,6.67,7,0.4,1,0.8,1.2,0.733333333,1,-2,2,1,0.33,1,2,2,-1,1,0,0,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - PhD,35,I liked the questions. They were pretty amusing. ,1.5,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,9,2,3,4,7,8,6,1,5,4,3,2,1 +661,R_7hYZBL2Y9z6VkLq,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,Agree,1,2,4,5,3,Strongly agree,Somewhat agree,Agree,Somewhat agree,Agree,2,1,3,4,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,4,5,2,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly Agree,Agree,4,1,2,5,3,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Agree,4,3,5,1,2,6,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,2,3,1,6,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,Somewhat Agree,4,3,5,2,1,7,Strongly Agree,Somewhat agree,Somewhat agree,Agree,Agree,2,1,5,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Neither agree nor disagree,Somewhat agree,Agree,3,5,2,4,1,8,Agree,Agree,Agree,Strongly agree,Neither agree nor disagree,4,1,3,5,2,8,Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,3,5,1,4,2,8,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Agree,5,4,1,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,53,TRUE,71,FALSE,53,FALSE,50,FALSE,50,TRUE,58,FALSE,50,FALSE,53,TRUE,60,TRUE,83,TRUE,100,TRUE,75,FALSE,54,FALSE,57,TRUE,88,TRUE,75,TRUE,91,FALSE,56,TRUE,53,FALSE,90,TRUE,100,TRUE,64,TRUE,92,TRUE,75,TRUE,74,FALSE,80,FALSE,76,FALSE,59,FALSE,76,FALSE,52,FALSE,52,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,0,2,2,3,1,2,1,2,1,1,2,1,2,0,1,1,3,2,1,3,2,1,2,6,2,3,1,0,1,6,0,2,2,1,1,7,3,1,1,2,2,7,2,2,0,1,2,8,2,2,2,3,0,8,2,2,1,1,-1,8,1,2,1,-1,2,8,TRUE,0,100,FALSE,0,53,TRUE,0,71,FALSE,1,53,FALSE,0,50,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,0,53,TRUE,1,60,TRUE,0,83,TRUE,0,100,TRUE,1,75,FALSE,1,54,FALSE,0,57,TRUE,1,88,TRUE,0,75,TRUE,0,91,FALSE,1,56,TRUE,0,53,FALSE,0,90,TRUE,1,100,TRUE,0,64,TRUE,1,92,TRUE,0,75,TRUE,1,74,FALSE,1,80,FALSE,1,76,FALSE,1,59,FALSE,0,76,FALSE,0,52,FALSE,0,52,0.25,0.0676,0.0144,0.1764,0.2704,0.25,0.0064,0.16,0.2809,0,0.5776,0.0625,0.2809,0.6889,0.25,0.2809,0.4096,0.2209,0.0576,0.5625,0.81,0.3249,0.1936,0.2116,0.5625,0.04,0.2704,1,0.5041,0.8281,0.1681,1,0.366871429,0.267071429,0.466671429,25,78.13,14,43.75,3,37.5,3,37.5,5,62.5,3,37.5,7,43.75,7,43.75,69.38,60.88,64.38,76.5,75.75,67.5,71.25,34.38,25.63,23.38,26.88,14,38.25,23.75,27.5,0,0,2,1,0,1,2,1,1,1,1,1,0,0,1,3,0,0,1,0,1,1,0,1,0,1,1,0,2,2,1,1,1,0,3,1,1,0,4,0,0.6,1.2,0.6,0.8,0.6,1.2,1.2,1.2,0.8,1.05,0.925,6.33,8,7.25,0,0,-0.6,-0.4,-0.2,-2,-2,-1,-1,-1.67,0,1,1,-2,2,1,-1,1,-1,0,0,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),23,,0.375,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,3,5,9,8,4,6,7,1,2,4,3,2,1 +662,R_6e4P4G7XkW3QdTX,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,2,4,3,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,1,5,3,4,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,1,3,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,3,5,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,1,3,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,1,4,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,3,4,5,2,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,5,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,4,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,75,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,71,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,76,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,75,TRUE,100,FALSE,76,TRUE,100,TRUE,100,FALSE,100,16,1,1,1,-1,-1,-1,-1,0,1,0,0,-1,1,1,1,1,0,1,1,1,1,1,1,-1,1,0,0,0,0,0,0,10,0,0,1,1,1,6,1,1,1,1,1,5,1,1,1,-1,-1,0,0,0,0,0,0,5,0,-1,1,1,1,5,0,0,0,0,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,76,TRUE,1,100,FALSE,1,75,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,76,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,75,TRUE,0,100,TRUE,0,100,TRUE,0,71,TRUE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,1,0,0.0625,0,0,0.5041,0,0,0,0,0.0576,0,0,0,0.0576,0,1,0.0625,1,1,0,0.5625,0.0625,1,0,1,1,1,0,0.298903571,0.0487,0.549107143,16,50,22,68.75,5,62.5,6,75,5,62.5,6,75,13,81.25,9,56.25,94.47,90.88,90.62,100,96.38,98.44,90.5,-18.75,25.72,28.38,15.62,37.5,21.38,17.19,34.25,0,0,0,0,2,1,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,1,1,0.4,0.6,0.2,0.2,0,0.6,0,0.8,0.35,0.35,0.35,5.33,3.33,4.5,0.4,0,0.2,-0.6,0.2,0,5,1,0,2,1,1,1,-1,1,-1,1,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),27,I don't have any feedback to give.,0.875,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,3,8,5,7,2,9,6,1,4,4,3,2,1 +663,R_3cAmHE8UALSr7bz,18 - 24,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Disagree,Agree,Somewhat disagree,5,3,1,4,2,Somewhat agree,Strongly disagree,Somewhat agree,Disagree,Strongly agree,4,2,1,3,5,Agree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,3,2,5,4,1,Agree,Agree,Agree,Somewhat agree,Strongly disagree,2,5,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Disagree,Disagree,Somewhat disagree,2,3,1,4,5,2,Strongly disagree,Somewhat disagree,Strongly disagree,Agree,Agree,5,4,1,3,2,7,Strongly Agree,Somewhat Agree,Disagree,Agree,Agree,4,5,1,3,2,3,Somewhat agree,Somewhat agree,Strongly disagree,Somewhat disagree,Strongly disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Disagree,Agree,Somewhat agree,2,3,1,4,5,3,Somewhat disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,2,3,1,5,4,6,Strongly agree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,1,3,4,5,8,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Disagree,3,2,1,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,70,TRUE,50,TRUE,100,FALSE,90,FALSE,100,TRUE,50,TRUE,100,FALSE,95,TRUE,96,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,60,FALSE,100,TRUE,70,TRUE,100,FALSE,80,TRUE,80,TRUE,50,TRUE,95,TRUE,100,FALSE,80,TRUE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,100,26,3,3,-2,2,-1,1,-3,1,-2,3,2,-1,3,-2,3,2,2,2,1,-3,3,3,-2,-2,-1,2,-3,-1,-3,2,2,2,3,1,-2,2,2,7,1,1,-3,-1,-3,3,3,3,-2,2,1,4,-1,-3,1,-3,2,3,3,-1,3,-3,3,6,1,2,1,1,-2,8,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,1,80,TRUE,1,100,TRUE,1,95,TRUE,1,50,TRUE,1,80,FALSE,1,80,TRUE,0,100,TRUE,1,70,FALSE,1,100,TRUE,1,60,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,0,100,TRUE,1,96,FALSE,1,95,TRUE,1,100,TRUE,0,50,FALSE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,50,FALSE,0,70,0.0025,0,0,0,0.49,0.04,0.0016,0.04,0.25,0.25,0,0.09,0.25,0.04,0.25,0.25,1,0.25,0,0.0025,0,0.16,0.25,0,1,0.25,0.25,1,1,0,0.01,1,0.290146429,0.228685714,0.351607143,26,81.25,25,78.13,7,87.5,5,62.5,7,87.5,6,75,15,93.75,10,62.5,80.19,55,82.5,90.62,92.62,76.31,84.06,3.12,2.06,-32.5,20,3.12,17.62,-17.44,21.56,0,0,0,4,0,4,2,4,4,1,1,2,5,4,1,1,1,5,2,0,0,0,0,0,2,2,0,0,1,1,1,0,0,1,0,1,0,1,0,1,0.8,3,2.6,1.8,0.4,0.8,0.4,0.6,2.05,0.55,1.3,3.67,4.33,4.375,0.4,2.2,2.2,1.2,1.6,-2,-1,1,-5,-0.66,2,2,2,-2,2,-1,1,0,0,-2,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,22,,1.625,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,4,6,5,3,2,9,8,1,7,3,4,2,1 +664,R_6G9EWfU6MX8l8ZE,32 - 38,,Canadian,Canadian,Male,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,1,4,5,2,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Disagree,3,4,5,1,2,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,2,1,3,5,4,Neither agree nor disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,4,2,1,3,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,2,1,5,4,2,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,4,2,1,5,4,Somewhat Disagree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,4,1,2,2,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,1,5,4,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Strongly Agree,Strongly Agree,Agree,5,4,3,2,1,2,Strongly disagree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,2,4,1,5,3,1,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Strongly Agree,3,4,1,5,2,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,5,4,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,80,TRUE,100,TRUE,50,TRUE,50,FALSE,50,FALSE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,50,FALSE,100,FALSE,50,FALSE,100,TRUE,70,TRUE,50,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,1,2,1,0,-3,-3,3,-3,-2,-1,0,2,0,3,0,1,2,2,0,-2,3,3,3,0,2,-1,-3,3,-3,0,4,-1,-2,3,0,3,2,-2,0,-2,-2,-2,7,0,1,3,3,2,2,-3,-2,2,-3,0,1,-1,-2,3,-2,3,1,0,0,1,1,-1,4,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,80,TRUE,0,100,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,0,100,TRUE,0,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,TRUE,1,70,TRUE,1,50,0,1,0.25,0,0.25,0,0,0,0.25,0,1,0.64,0.25,0,0.25,0.25,0,0.25,0,0.25,0,0.25,0,1,0.25,0.25,0.09,0.25,1,0,0.25,1,0.276071429,0.224285714,0.327857143,12,37.5,22,68.75,6,75,6,75,5,62.5,5,62.5,11,68.75,11,68.75,78.12,65,72.5,87.5,87.5,78.12,78.12,-31.25,9.37,-10,-2.5,25,25,9.37,9.37,1,2,1,2,0,2,0,0,0,2,0,2,1,0,0,2,1,4,4,2,1,0,1,2,2,0,1,1,0,2,0,2,1,2,0,0,1,1,1,1,1.2,0.8,0.6,2.6,1.2,0.8,1,0.8,1.3,0.95,1.125,2.67,1.33,2.875,0,0,-0.4,1.8,-0.133333333,0,3,1,3,1.34,0,2,2,-2,2,0,0,-2,2,-2,2,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,36,This was a fun survey!,1.125,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,8,2,3,6,5,9,7,1,4,2,3,4,1 +665,R_5mC07SFhmdZHbH7,39 - 45,American,,American,Male,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,5,4,3,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,4,5,1,3,2,Neither Agree nor Disagree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,5,3,4,1,Somewhat disagree,Disagree,Somewhat disagree,Disagree,Disagree,5,1,4,3,2,Agree,Strongly Agree,Strongly Agree,Agree,Agree,1,2,4,5,3,1,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,5,3,2,1,2,Neither Agree nor Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,4,3,2,5,2,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,1,5,3,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,5,1,4,2,2,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,2,5,4,3,2,Neither Agree nor Disagree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,4,5,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,58,TRUE,80,FALSE,53,TRUE,71,FALSE,57,TRUE,85,FALSE,100,FALSE,54,FALSE,60,FALSE,65,FALSE,87,FALSE,85,FALSE,61,TRUE,82,TRUE,65,TRUE,88,FALSE,59,FALSE,57,TRUE,57,TRUE,100,FALSE,58,TRUE,81,FALSE,63,TRUE,77,TRUE,76,FALSE,55,FALSE,56,FALSE,58,TRUE,76,FALSE,56,FALSE,100,16,2,3,3,2,1,-1,-1,-1,-2,1,0,-2,1,0,1,-1,-2,-1,-2,-2,2,3,3,2,2,1,-1,-2,0,-2,1,2,0,-2,1,-1,1,2,-1,-2,-1,-1,-1,3,2,3,3,2,2,2,-1,-2,1,-2,1,2,0,-2,1,0,1,2,1,1,1,1,0,5,FALSE,1,100,FALSE,0,56,TRUE,0,76,FALSE,1,58,FALSE,0,56,FALSE,1,55,TRUE,1,76,TRUE,1,77,FALSE,0,63,TRUE,1,81,FALSE,1,58,TRUE,0,100,TRUE,1,57,FALSE,1,57,FALSE,0,59,TRUE,1,88,TRUE,0,65,TRUE,0,82,FALSE,1,61,FALSE,1,85,FALSE,0,87,FALSE,0,65,FALSE,1,60,FALSE,0,54,FALSE,1,100,TRUE,1,85,FALSE,1,57,TRUE,0,71,FALSE,1,53,TRUE,1,80,FALSE,0,58,TRUE,1,85,0.0529,0.0225,0.0144,0.0576,0.0225,0.2025,0.2916,0.0361,0.0225,0.4225,0.04,0.1849,0.3969,0.1764,0.3136,0.3136,0.16,0.1764,0.5041,0,0.7569,0.3481,0.1521,0.1849,0.4225,0.1849,0.3364,0,0.5776,0.6724,0.2209,1,0.290010714,0.197107143,0.382914286,16,50,19,59.38,4,50,5,62.5,6,75,4,50,8,50,11,68.75,70.78,58.75,64.75,80.75,78.88,70.44,71.12,-9.38,11.4,8.75,2.25,5.75,28.88,20.44,2.37,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,2,0,0,0,0,0,0,0,2,3,2,3,2,0.2,0.4,0.2,0.4,0.2,0.6,0,2.4,0.3,0.8,0.55,1.67,2,2.375,0,-0.2,0.2,-2,0,-1,0,0,-2,-0.33,0,0,0,-1,1,1,-1,-1,1,-1,1,0,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,45,Thanks for the survey. ,0.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,9,6,4,7,2,3,5,1,8,4,3,2,1 +666,R_1yl8kaxHTWxt6lM,53 - 59,American,,American,Male,Strongly agree,Agree,Strongly agree,Somewhat disagree,Somewhat disagree,2,5,1,3,4,Strongly disagree,Somewhat disagree,Strongly agree,Somewhat agree,Strongly disagree,1,2,5,4,3,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,4,3,5,2,Strongly disagree,Neither agree nor disagree,Disagree,Disagree,Strongly disagree,1,3,4,2,5,Somewhat agree,Agree,Strongly Agree,Disagree,Somewhat disagree,3,2,4,1,5,1,Strongly disagree,Somewhat agree,Strongly agree,Agree,Disagree,3,5,1,2,4,6,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,5,1,3,2,4,1,Disagree,Disagree,Disagree,Disagree,Strongly disagree,3,1,4,5,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Disagree,Somewhat disagree,3,5,4,2,1,2,Disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,3,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,1,3,5,2,4,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,4,5,3,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,FALSE,51,TRUE,70,TRUE,81,FALSE,54,TRUE,56,TRUE,92,FALSE,91,FALSE,56,FALSE,100,TRUE,76,FALSE,82,FALSE,100,TRUE,55,FALSE,100,FALSE,77,TRUE,82,TRUE,88,FALSE,62,TRUE,75,TRUE,60,FALSE,56,TRUE,96,TRUE,90,TRUE,60,TRUE,76,FALSE,100,TRUE,100,FALSE,52,TRUE,96,TRUE,98,TRUE,91,24,3,2,3,-1,-1,-3,-1,3,1,-3,2,1,2,0,3,-3,0,-2,-2,-3,1,2,3,-2,-1,1,-3,1,3,2,-2,6,2,2,0,1,3,1,-2,-2,-2,-2,-3,2,3,2,3,-2,-1,2,-2,-1,3,0,-1,3,2,2,2,-1,3,3,-1,-1,-1,-1,-2,4,TRUE,0,91,TRUE,1,98,TRUE,0,96,FALSE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,1,60,TRUE,1,90,TRUE,1,96,FALSE,1,56,TRUE,0,60,TRUE,1,75,FALSE,1,62,TRUE,1,88,TRUE,1,82,FALSE,1,77,FALSE,1,100,TRUE,0,55,FALSE,1,100,FALSE,0,82,TRUE,1,76,FALSE,1,100,FALSE,0,56,FALSE,1,91,TRUE,1,92,TRUE,0,56,FALSE,1,54,TRUE,0,81,TRUE,1,70,FALSE,0,51,TRUE,1,97,0.16,0.0064,0.0324,0.0576,0.0009,0,0.3136,0.0016,0,0.0576,0.09,0.0625,0.01,0.1936,0,0.0004,0,0.2304,0.2116,0.0081,0.6724,0.0144,0.3025,0.1444,0.0529,0.3136,0.2601,0.8281,0.9216,0,0.6561,0.36,0.2038,0.068614286,0.338985714,24,75,23,71.88,5,62.5,6,75,7,87.5,5,62.5,13,81.25,10,62.5,78.75,68.25,89,85.5,72.25,80.56,76.94,3.12,6.87,5.75,14,-2,9.75,-0.69,14.44,2,0,0,1,0,0,2,0,1,1,0,1,2,1,0,1,2,0,0,0,0,0,0,1,0,1,0,0,1,2,0,1,0,1,0,2,1,1,1,1,0.6,0.8,0.8,0.6,0.2,0.8,0.4,1.2,0.7,0.65,0.675,2.67,2.67,2.75,0.4,0,0.4,-0.6,0.266666667,-1,3,-2,-2,0,1,2,0,-1,1,0,0,0,0,-2,2,1,5 cents,100 minutes,15 days,Male,High School (or equivalent),53,This survey really made me think about my life and how i view myself in the past and future. The other sections made me use my brain. Some questions were interesting. Some brainteasers,0.875,1,0,0,0,1,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,9,6,4,8,5,2,3,1,7,3,2,4,1 +667,R_3HvAsPu6RolGbO9,46 - 52,,Canadian,Canadian,Male,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,4,2,1,5,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,3,5,2,4,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Disagree,3,4,5,1,2,Disagree,Disagree,Disagree,Disagree,Disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Disagree,Agree,Somewhat agree,Disagree,Agree,2,4,3,5,1,4,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,1,4,3,3,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,1,3,4,2,5,6,Disagree,Disagree,Disagree,Disagree,Disagree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,4,3,1,2,5,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,3,5,2,1,3,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,1,2,3,5,4,3,Disagree,Disagree,Disagree,Disagree,Strongly disagree,3,5,4,2,1,TRUE,90,TRUE,100,TRUE,59,TRUE,50,TRUE,50,FALSE,86,TRUE,100,TRUE,92,FALSE,60,TRUE,98,FALSE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,50,TRUE,90,FALSE,50,FALSE,81,FALSE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,91,FALSE,55,TRUE,54,FALSE,50,FALSE,100,TRUE,83,TRUE,69,FALSE,50,TRUE,80,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,1,0,-1,1,-2,1,1,-1,0,-1,1,2,-1,-1,-2,-2,-2,-2,-2,-2,2,1,-2,2,3,-2,1,1,-1,1,4,-1,1,0,-1,-1,3,-2,-2,-2,-2,-2,6,-2,1,0,1,2,3,-1,-1,-1,-1,-1,4,-1,-1,-1,0,-1,3,-2,-2,-2,-2,-3,3,TRUE,0,90,TRUE,1,100,TRUE,0,59,TRUE,0,50,TRUE,1,50,FALSE,1,86,TRUE,1,100,TRUE,1,92,FALSE,0,60,TRUE,1,98,FALSE,1,50,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,90,FALSE,1,50,FALSE,1,81,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,55,TRUE,1,54,FALSE,1,50,FALSE,1,100,TRUE,0,83,TRUE,1,69,FALSE,0,50,TRUE,1,80,0.0064,0.2116,0.01,0,0.04,0.0196,0.0081,0.0004,0,0,0.0961,0,0.36,0.25,0.25,0,0,0.25,0,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.3481,0.0361,0.6889,0.25,0.191421429,0.091014286,0.291828571,28,87.5,24,75,5,62.5,6,75,7,87.5,6,75,13,81.25,11,68.75,73.06,57.5,74.88,78.5,81.38,77.12,69,12.5,-1.94,-5,-0.12,-9,6.38,-4.13,0.25,0,1,1,1,1,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,2,1,1,2,2,0,1,0,2,3,1,0,0,0,0,0,1,0.8,0.2,0.4,0,0.6,1.2,1.2,0.2,0.35,0.8,0.575,3.33,3.33,3.625,0.2,-1,-0.8,-0.2,-0.533333333,0,0,0,3,0,-1,2,1,-2,2,0,0,-2,2,-2,2,1,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,2,6,7,4,8,3,9,1,5,2,3,4,1 +668,R_16arDcHSBUmfHjw,25 - 31,,Canadian,Canadian,Male,Agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,5,3,2,1,4,Neither agree nor disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,5,3,2,1,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,3,2,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,4,2,1,5,3,Agree,Strongly Agree,Agree,Strongly Agree,Agree,4,1,2,3,5,9,Somewhat disagree,Disagree,Agree,Strongly agree,Strongly agree,5,3,1,2,4,9,Strongly Agree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,2,3,4,1,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,4,2,3,5,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat agree,Disagree,Agree,2,3,4,5,1,8,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Agree,1,2,5,3,4,8,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Agree,4,5,3,2,1,6,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,5,2,3,1,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,88,FALSE,100,FALSE,85,FALSE,74,TRUE,100,TRUE,96,TRUE,100,FALSE,71,TRUE,100,FALSE,84,TRUE,100,TRUE,100,FALSE,100,FALSE,91,FALSE,100,TRUE,94,TRUE,100,TRUE,100,TRUE,87,FALSE,96,TRUE,88,FALSE,61,TRUE,100,TRUE,88,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,27,2,3,1,1,2,0,-2,3,-1,1,2,-1,2,0,3,3,3,3,2,2,2,3,2,3,2,9,-1,-2,2,3,3,9,3,-3,2,0,3,7,1,1,1,3,0,9,2,3,1,-2,2,8,-2,-2,3,0,2,8,3,-1,3,-1,2,6,3,3,3,2,0,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,88,TRUE,1,100,FALSE,1,61,TRUE,0,88,FALSE,0,96,TRUE,0,87,TRUE,1,100,TRUE,1,100,TRUE,0,94,FALSE,1,100,FALSE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,100,FALSE,1,71,TRUE,1,100,TRUE,0,96,TRUE,0,100,FALSE,1,74,FALSE,0,85,FALSE,0,100,FALSE,0,88,0,0,0,0,0.7744,0,0,0,0,0,0.7225,0.9216,0.0144,0.1521,0,0,0.0256,0,1,0.0841,0,0,0.0081,0.7569,0.8836,0.9216,1,0,1,0,0.0676,0.7744,0.325246429,0.186471429,0.464021429,27,84.38,22,68.75,6,75,5,62.5,7,87.5,4,50,12,75,10,62.5,93.84,92,92,94.75,96.62,97.31,90.38,15.63,25.09,17,29.5,7.25,46.62,22.31,27.88,0,0,1,2,0,1,0,1,4,2,1,2,0,0,0,2,2,2,1,2,0,0,0,3,0,2,0,0,1,1,1,0,1,1,1,0,0,0,0,2,0.6,1.6,0.6,1.8,0.6,0.8,0.8,0.4,1.15,0.65,0.9,8.33,7.33,8,0,0.8,-0.2,1.4,0.2,1,1,1,1,1,-1,1,0,-1,1,2,-2,1,-1,1,-1,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,30,THANK YOU,-0.25,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,6,5,9,8,4,2,3,1,7,3,2,4,1 +669,R_7mOk6ToUgjkheRH,46 - 52,,Canadian,Canadian,Male,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,2,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,1,2,3,Somewhat disagree,Strongly disagree,Disagree,Disagree,Strongly disagree,2,3,4,1,5,Strongly disagree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,2,3,4,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,5,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Agree,Agree,Agree,Neither agree nor disagree,1,2,3,4,5,5,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,3,2,4,5,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,4,1,2,5,3,5,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,5,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,55,TRUE,50,TRUE,70,TRUE,50,TRUE,52,TRUE,54,TRUE,51,TRUE,53,TRUE,70,TRUE,51,TRUE,50,TRUE,51,TRUE,50,FALSE,51,TRUE,67,TRUE,52,TRUE,52,TRUE,54,TRUE,51,TRUE,52,TRUE,65,FALSE,50,TRUE,61,TRUE,55,TRUE,52,TRUE,56,FALSE,50,TRUE,51,TRUE,51,TRUE,54,FALSE,53,TRUE,50,8,-1,2,0,1,0,0,0,1,0,0,0,0,1,0,0,-1,-3,-2,-2,-3,-3,2,1,1,0,5,-1,0,0,0,0,5,0,0,0,1,1,5,-3,-3,-3,-3,-3,5,-3,2,2,2,0,5,-2,0,-1,1,0,5,0,0,0,-1,0,5,-2,-3,-3,-3,-3,5,TRUE,0,50,FALSE,0,53,TRUE,0,54,TRUE,0,51,TRUE,1,51,FALSE,1,50,TRUE,1,56,TRUE,1,52,TRUE,1,55,TRUE,1,61,FALSE,1,50,TRUE,0,65,TRUE,1,52,TRUE,0,51,TRUE,1,54,TRUE,1,52,TRUE,0,52,TRUE,0,67,FALSE,1,51,TRUE,0,50,TRUE,1,51,TRUE,1,50,TRUE,0,51,TRUE,1,70,TRUE,0,53,TRUE,1,51,TRUE,0,54,TRUE,0,52,TRUE,0,50,TRUE,1,70,TRUE,1,50,TRUE,1,55,0.2304,0.2401,0.2304,0.1936,0.2025,0.25,0.09,0.1521,0.25,0.25,0.09,0.2304,0.2025,0.25,0.2401,0.2809,0.2601,0.2601,0.2704,0.2809,0.2401,0.2116,0.2401,0.2601,0.2704,0.2916,0.25,0.25,0.2916,0.4489,0.25,0.4225,0.249532143,0.214907143,0.284157143,8,25,18,56.25,5,62.5,5,62.5,4,50,4,50,15,93.75,3,18.75,54.19,52.25,51.5,54.88,58.12,55.19,53.19,-31.25,-2.06,-10.25,-11,4.88,8.12,-38.56,34.44,2,0,1,0,0,1,0,1,0,0,0,0,1,1,1,2,0,1,1,0,2,0,2,1,0,2,0,2,1,0,0,0,1,1,0,1,0,1,1,0,0.6,0.4,0.6,0.8,1,1,0.4,0.6,0.6,0.75,0.675,5,5,5,-0.4,-0.6,0.2,0.2,-0.266666667,0,0,0,0,0,1,1,0,-2,2,1,-1,-1,1,0,0,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),50,interesting,0.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,02REV,8,3,7,2,5,9,4,1,6,2,3,4,1 +670,R_5mnUZGp5jKWAttn,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,1,2,3,4,5,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,2,4,5,3,1,Strongly Agree,Agree,Agree,Somewhat Agree,Strongly Agree,4,5,3,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Agree,Strongly Agree,3,4,2,5,1,1,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,4,3,5,1,2,1,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Agree,5,1,3,2,4,5,Disagree,Disagree,Strongly disagree,Disagree,Somewhat disagree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,2,1,4,3,5,10,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,5,3,1,4,10,Agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,1,2,3,4,5,9,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat disagree,3,1,5,4,2,FALSE,79,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,90,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,95,TRUE,97,TRUE,98,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,98,FALSE,100,FALSE,100,TRUE,100,FALSE,96,FALSE,100,FALSE,100,TRUE,100,TRUE,99,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,2,3,3,-3,3,-1,1,3,2,2,1,3,0,0,0,-1,-1,3,2,2,2,3,1,1,-3,1,-3,2,1,3,3,1,-1,2,1,-2,-2,-3,-2,-1,5,3,3,2,3,3,10,1,-3,3,-3,1,10,2,3,3,-1,3,10,3,3,1,3,-1,9,FALSE,1,79,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,95,TRUE,1,97,TRUE,1,98,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,98,FALSE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,99,TRUE,1,100,0,0,0.0004,0,0,0.01,1,0,0,1,0,1,0,0,0,0,0.0004,0,0,0,0,0.0009,0,0.0025,1,0.0016,0.0001,0.0441,1,0,0,1,0.216414286,0.215028571,0.2178,16,50,26,81.25,8,100,6,75,7,87.5,5,62.5,13,81.25,13,81.25,98.5,99,98.5,96.75,99.75,99.62,97.38,-31.25,17.25,-1,23.5,9.25,37.25,18.37,16.13,0,1,1,0,0,2,0,2,2,1,0,1,1,2,1,2,2,3,1,0,0,0,1,1,0,2,0,0,2,0,1,1,1,2,0,3,3,1,4,0,0.4,1.4,1,1.6,0.4,0.8,1,2.2,1.1,1.1,1.1,1,10,5.875,0,0.6,0,-0.6,0.2,-9,-9,-9,-4,-9,1,-2,2,-2,2,0,0,0,0,0,0,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),30,"Though the survey was interesting, it was rather lengthy",0.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,9,5,7,2,8,3,6,1,4,4,3,2,1 +671,R_5gUeZWBb9NLCH7P,46 - 52,,Canadian,Canadian,Male,Agree,Strongly agree,Somewhat agree,Strongly disagree,Somewhat agree,3,5,2,1,4,Agree,Disagree,Strongly agree,Strongly disagree,Agree,3,1,2,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly Agree,5,3,2,1,4,Somewhat agree,Agree,Agree,Neither agree nor disagree,Strongly Agree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,Somewhat agree,2,1,3,4,5,2,Agree,Disagree,Agree,Strongly disagree,Strongly agree,3,1,4,2,5,1,Neither Agree nor Disagree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,1,4,3,5,2,7,Disagree,Neither agree nor disagree,Disagree,Somewhat disagree,Strongly Agree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,1,Agree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,4,3,5,2,1,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Strongly agree,2,5,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly Agree,5,4,3,2,1,FALSE,100,FALSE,50,FALSE,60,FALSE,50,TRUE,50,FALSE,60,TRUE,85,TRUE,65,TRUE,55,TRUE,52,FALSE,50,TRUE,65,FALSE,55,FALSE,80,TRUE,90,TRUE,100,TRUE,69,TRUE,58,TRUE,65,FALSE,100,FALSE,50,TRUE,70,FALSE,50,TRUE,95,TRUE,60,TRUE,50,FALSE,50,FALSE,70,FALSE,50,FALSE,50,FALSE,50,FALSE,50,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,-3,1,2,-2,3,-3,2,0,0,2,-3,3,1,2,2,0,3,3,3,1,-3,1,1,2,-2,2,-3,3,2,0,1,2,-3,3,1,-2,0,-2,-1,3,7,1,3,1,0,0,2,2,-2,2,-3,0,1,0,0,2,-3,3,1,0,0,2,0,3,5,FALSE,1,100,FALSE,0,50,FALSE,1,60,FALSE,1,50,TRUE,1,50,FALSE,1,60,TRUE,1,85,TRUE,1,65,TRUE,1,55,TRUE,1,52,FALSE,1,50,TRUE,0,65,FALSE,0,55,FALSE,1,80,TRUE,1,90,TRUE,1,100,TRUE,0,69,TRUE,0,58,TRUE,0,65,FALSE,1,100,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,1,95,TRUE,0,60,TRUE,1,50,FALSE,1,50,FALSE,1,70,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.1225,0.25,0,0.0225,0.25,0.16,0.0025,0.2304,0,0.09,0.25,0.3025,0.2025,0.25,0.25,0.25,0.25,0.25,0.09,0.36,0.25,0.01,0.4225,0.04,0.4761,0.25,0.25,0,0.16,0.3364,0.25,0.4225,0.216264286,0.195564286,0.236964286,12,37.5,21,65.63,5,62.5,4,50,6,75,6,75,10,62.5,11,68.75,64.19,57.5,54.25,69.38,75.62,63.56,64.81,-28.13,-1.44,-5,4.25,-5.62,0.62,1.06,-3.94,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,3,2,4,1,0,1,0,0,3,1,0,0,1,0,2,0,0,0,0,0,1,2,0,0,0,0.2,0.4,0.2,2,1,0.6,0,0.6,0.7,0.55,0.625,1.33,1.33,2.5,-0.8,-0.2,0.2,1.4,-0.266666667,-1,1,0,2,0,2,2,2,-2,2,0,0,-2,2,-2,2,2,5 cents,5 minutes,15 days,Male,College Diploma/Certificate,50,Interesting,1.75,1,1,0,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,6,7,2,8,3,4,9,1,5,4,2,3,1 +672,R_3mihKaMDHI1tKwN,53 - 59,American,,American,Male,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,4,1,3,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,1,4,3,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,2,4,1,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,1,5,4,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,3,5,4,2,1,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,2,4,1,3,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,2,3,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,3,4,1,2,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,1,5,2,4,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,3,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,4,3,2,1,2,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,1,5,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,89,TRUE,88,FALSE,54,TRUE,60,FALSE,81,TRUE,81,TRUE,74,TRUE,80,TRUE,89,TRUE,60,FALSE,97,FALSE,89,FALSE,100,TRUE,66,TRUE,80,FALSE,60,FALSE,85,FALSE,55,FALSE,100,TRUE,66,TRUE,70,FALSE,100,TRUE,72,TRUE,63,TRUE,66,TRUE,70,FALSE,76,TRUE,78,TRUE,67,TRUE,69,TRUE,83,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,2,1,1,-1,0,1,-1,0,1,1,1,0,2,-1,0,0,0,-1,1,1,2,1,2,3,0,0,1,0,1,3,2,2,1,0,2,1,0,0,-1,0,-1,4,1,1,2,1,1,1,0,-1,1,-1,1,3,1,2,1,-1,1,2,0,-1,0,0,-1,2,TRUE,0,96,TRUE,1,89,TRUE,0,88,FALSE,1,54,TRUE,1,60,FALSE,1,81,TRUE,1,81,TRUE,1,74,TRUE,1,80,TRUE,1,89,TRUE,0,60,FALSE,1,97,FALSE,0,89,FALSE,1,100,TRUE,1,66,TRUE,1,80,FALSE,1,60,FALSE,1,85,FALSE,1,55,FALSE,1,100,TRUE,1,66,TRUE,1,70,FALSE,1,100,TRUE,1,72,TRUE,0,63,TRUE,1,66,TRUE,0,70,FALSE,1,76,TRUE,0,78,TRUE,1,67,TRUE,1,69,TRUE,1,83,0.0676,0.1156,0.04,0.0361,0.0289,0.0361,0.0784,0.0121,0,0.09,0.1089,0.7921,0.04,0.36,0.16,0.0121,0,0.2116,0.0576,0.3969,0.1156,0.1156,0.2025,0,0.16,0.49,0.0961,0.9216,0.7744,0.0225,0.6084,0.0009,0.210439286,0.137871429,0.283007143,22,68.75,25,78.13,6,75,6,75,6,75,7,87.5,15,93.75,10,62.5,77,67.88,77.12,81.25,81.75,75.06,78.94,-9.38,-1.13,-7.12,2.12,6.25,-5.75,-18.69,16.44,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,1,1,0,0,0,0.2,0.6,0.4,0.4,0,0.6,0.6,0.4,0.4,0.4,0.4,2.33,2,2.375,0.2,0,-0.2,0,0,2,0,-1,2,0.33,1,1,2,-1,1,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,55,none,0.875,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,8,6,7,2,9,4,3,1,5,4,2,3,1 +673,R_5OPaqVxNTufwlYx,46 - 52,,Canadian,Canadian,Male,Disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,4,5,2,3,1,Strongly disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,2,4,1,5,3,Strongly Agree,Somewhat Disagree,Neither Agree nor Disagree,Strongly Disagree,Agree,2,4,1,3,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,3,5,2,4,1,3,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,3,5,2,3,Strongly Agree,Somewhat Disagree,Neither Agree nor Disagree,Strongly Disagree,Agree,3,5,4,2,1,8,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,5,4,3,1,2,3,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,2,5,1,4,3,3,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Strongly Disagree,Agree,1,2,4,3,5,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,1,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,88,TRUE,59,FALSE,55,TRUE,68,FALSE,89,TRUE,51,TRUE,61,FALSE,83,TRUE,69,FALSE,99,TRUE,66,TRUE,82,FALSE,57,FALSE,50,TRUE,50,FALSE,50,TRUE,78,TRUE,58,FALSE,91,FALSE,100,TRUE,59,FALSE,50,TRUE,60,TRUE,50,TRUE,90,TRUE,82,FALSE,79,TRUE,57,TRUE,50,FALSE,60,TRUE,54,TRUE,69,8,-2,-3,-3,0,-3,-3,-1,1,2,-1,3,-1,0,-3,2,-3,-3,-3,-3,-3,-2,-2,-2,0,-3,3,-3,-1,1,1,-1,3,3,-1,0,-3,2,3,-2,-1,-1,-1,-1,8,-2,-3,-3,0,-3,2,-3,-1,1,1,-2,3,3,-1,0,-3,2,3,-3,-3,-3,-3,-3,1,TRUE,0,69,TRUE,1,54,FALSE,1,60,TRUE,0,50,TRUE,1,57,FALSE,1,79,TRUE,1,82,TRUE,1,90,TRUE,1,50,TRUE,1,60,FALSE,1,50,TRUE,0,59,FALSE,0,100,FALSE,1,91,TRUE,1,58,TRUE,1,78,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,57,TRUE,1,82,TRUE,1,66,FALSE,1,99,TRUE,1,69,FALSE,1,83,TRUE,1,61,TRUE,0,51,FALSE,1,89,TRUE,0,68,FALSE,0,55,TRUE,1,59,TRUE,1,88,0.01,0.1521,0.0484,0.0324,0.0144,0.0441,0.0961,0.16,0.1849,0.1156,0.3025,1,0.25,0.25,0.1849,0.2116,0.0001,0.25,0.0121,0.0289,0.0324,0.1764,0.25,0.0081,0.25,0.2601,0.1681,0.4761,0.16,0.25,0.4624,0.3481,0.212389286,0.218871429,0.205907143,8,25,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,67.62,52.75,77.88,70.25,69.62,69.31,65.94,-50,-7.38,-22.25,2.88,-4.75,-5.38,-18.19,3.44,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,2,2,2,2,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0.4,0.2,0,1.8,0,0.4,0,0,0.6,0.1,0.35,3,2.67,3.25,0.4,-0.2,0,1.8,0.066666667,1,0,0,7,0.33,1,2,2,-2,2,0,0,-2,2,-2,2,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,48,"No comment, thank you.",1.375,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,2,6,9,5,3,8,7,1,4,2,3,4,1 +674,R_7Kd549Jv3m2lNUW,46 - 52,American,,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,3,5,1,Strongly disagree,Somewhat agree,Somewhat agree,Strongly disagree,Agree,1,4,2,3,5,Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,1,5,4,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,Disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,2,5,1,Disagree,Agree,Somewhat agree,Strongly disagree,Agree,1,3,2,5,4,4,Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,4,1,5,3,2,9,Disagree,Disagree,Disagree,Disagree,Disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,1,5,1,Somewhat agree,Agree,Agree,Strongly disagree,Agree,4,5,2,1,3,1,Agree,Disagree,Agree,Disagree,Strongly agree,3,1,5,4,2,1,Disagree,Disagree,Disagree,Disagree,Disagree,3,1,2,4,5,TRUE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,74,TRUE,100,TRUE,100,TRUE,84,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,78,TRUE,89,TRUE,88,TRUE,100,TRUE,77,TRUE,92,FALSE,50,TRUE,83,FALSE,73,TRUE,79,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,72,TRUE,85,FALSE,50,TRUE,98,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,-3,1,1,-3,2,2,-3,3,1,3,-3,-3,-2,-3,-2,2,3,3,3,3,1,-2,2,1,-3,2,1,2,-2,3,-2,3,4,-2,-2,-2,-2,-2,9,2,3,3,3,3,1,1,2,2,-3,2,1,2,-2,2,-2,3,1,-2,-2,-2,-2,-2,1,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,0,74,TRUE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,78,TRUE,1,89,TRUE,0,88,TRUE,0,100,TRUE,0,77,TRUE,0,92,FALSE,0,50,TRUE,1,83,FALSE,1,73,TRUE,1,79,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,72,TRUE,1,85,FALSE,0,50,TRUE,1,98,0,0,0.0121,0,0.0004,0.5476,0.0441,0,0.8464,0.0289,0.0225,0,0.0256,0,0.25,0.25,0.0729,0.25,0,1,0.25,0.0484,0.5929,0.25,0.7744,0.25,0.25,0.25,1,1,0.5184,1,0.340089286,0.167028571,0.51315,24,75,19,59.38,6,75,3,37.5,5,62.5,5,62.5,13,81.25,6,37.5,80.38,67.38,75.62,85.38,93.12,81,79.75,15.62,21,-7.62,38.12,22.88,30.62,-0.25,42.25,0,0,0,1,0,1,1,0,0,0,0,1,0,3,0,1,1,0,1,0,0,0,0,1,0,4,1,1,0,0,0,1,1,3,0,1,1,0,1,0,0.2,0.4,0.8,0.6,0.2,1.2,1,0.6,0.5,0.75,0.625,2,1,2.375,0,-0.8,-0.2,0,-0.333333333,0,0,3,8,1,0,1,1,-2,2,0,0,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),47,Good,1.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,6,2,9,5,4,3,8,1,7,3,4,2,1 +675,R_3Of8EufxfaIEqoV,46 - 52,,Canadian,Canadian,Male,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,4,5,2,3,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,4,1,3,5,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,4,2,5,1,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,4,5,3,1,2,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,5,3,2,7,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,5,2,1,4,3,7,Neither agree nor disagree,Agree,Somewhat agree,Agree,Somewhat agree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,5,3,2,1,4,8,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,8,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,4,2,3,1,5,7,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,5,4,1,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,74,TRUE,79,FALSE,59,TRUE,62,FALSE,100,TRUE,100,FALSE,65,TRUE,100,TRUE,100,TRUE,70,TRUE,100,TRUE,88,FALSE,100,FALSE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,74,TRUE,74,TRUE,93,TRUE,100,FALSE,100,TRUE,100,TRUE,83,TRUE,100,TRUE,100,FALSE,100,TRUE,61,FALSE,68,TRUE,100,FALSE,64,FALSE,100,16,1,0,1,0,-1,1,1,2,0,2,2,1,1,1,2,-1,-2,-1,-1,-1,1,0,0,2,1,8,0,1,1,1,0,6,1,0,-1,0,1,7,0,2,1,2,1,7,1,1,1,2,2,7,1,1,2,0,0,8,-1,0,0,2,1,8,1,1,2,1,2,7,FALSE,1,100,FALSE,0,64,TRUE,0,100,FALSE,1,68,TRUE,1,61,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,93,TRUE,0,74,TRUE,1,74,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,75,FALSE,1,100,TRUE,1,88,TRUE,1,100,TRUE,0,70,TRUE,1,100,TRUE,0,100,FALSE,0,65,TRUE,0,100,FALSE,1,100,TRUE,0,62,FALSE,0,59,TRUE,1,79,TRUE,1,74,0,0.4225,0,0,0.0676,0,0,0,0,0,0.3481,0.0049,0.0289,0,0.1521,0.4096,0.49,0.1024,0,1,0.0144,0.0676,0.0625,0.5476,1,1,0.0441,0,1,1,0.3844,1,0.311578571,0.114542857,0.508614286,16,50,20,62.5,6,75,5,62.5,4,50,5,62.5,13,81.25,7,43.75,87.16,80.38,81,92.38,94.88,83.75,90.56,-12.5,24.66,5.38,18.5,42.38,32.38,2.5,46.81,0,0,1,2,2,1,0,1,1,2,1,1,2,1,1,1,4,2,3,2,0,1,0,2,3,0,0,0,0,2,3,1,1,1,1,2,3,3,2,3,1,1,1.2,2.4,1.2,0.4,1.4,2.6,1.4,1.4,1.4,7,7.67,7.25,-0.2,0.6,-0.2,-0.2,0.066666667,1,-2,-1,0,-0.67,1,1,0,1,-1,0,0,1,-1,1,-1,0,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,47,PAY,-0.125,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,7,5,9,8,2,4,6,1,3,2,3,4,1 +676,R_73q19pg52KZaZZn,39 - 45,American,,American,Male,Agree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,2,3,1,4,5,Disagree,Disagree,Agree,Neither agree nor disagree,Agree,5,2,1,3,4,Strongly Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Disagree,2,4,5,1,3,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Strongly disagree,5,2,1,3,4,Somewhat disagree,Neither agree nor disagree,Strongly Agree,Disagree,Agree,1,4,5,3,2,7,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Disagree,4,5,2,1,3,4,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Disagree,Strongly Agree,3,1,2,4,5,1,Disagree,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,3,4,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Disagree,Disagree,Somewhat agree,Somewhat agree,5,2,3,1,4,2,Neither agree nor disagree,Disagree,Neither agree nor disagree,Agree,Disagree,3,2,1,5,4,3,Agree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,4,3,5,2,1,2,Disagree,Somewhat disagree,Disagree,Agree,Somewhat agree,3,2,5,1,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,82,TRUE,64,TRUE,100,FALSE,84,TRUE,62,FALSE,84,FALSE,60,TRUE,88,TRUE,87,TRUE,95,FALSE,85,TRUE,61,FALSE,62,TRUE,85,FALSE,53,TRUE,52,TRUE,93,FALSE,56,FALSE,52,TRUE,85,FALSE,56,TRUE,73,TRUE,81,FALSE,57,FALSE,63,FALSE,56,TRUE,63,TRUE,58,FALSE,88,TRUE,54,TRUE,86,FALSE,75,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,-2,2,0,1,-2,-2,2,0,2,3,-1,1,1,-2,1,-1,2,0,-3,-1,0,3,-2,2,7,-1,1,3,1,-2,4,1,1,-3,-1,3,1,-2,2,0,-1,-1,5,2,-2,-2,1,1,2,0,-2,0,2,-2,3,2,0,2,-2,1,2,-2,-1,-2,2,1,8,FALSE,1,82,TRUE,1,64,TRUE,0,100,FALSE,1,84,TRUE,1,62,FALSE,1,84,FALSE,0,60,TRUE,1,88,TRUE,1,87,TRUE,1,95,FALSE,1,85,TRUE,0,61,FALSE,0,62,TRUE,0,85,FALSE,0,53,TRUE,1,52,TRUE,0,93,FALSE,1,56,FALSE,1,52,TRUE,0,85,FALSE,0,56,TRUE,1,73,TRUE,0,81,FALSE,0,57,FALSE,1,63,FALSE,0,56,TRUE,0,63,TRUE,0,58,FALSE,1,88,TRUE,1,54,TRUE,1,86,FALSE,0,75,0.0144,0.3136,0.2304,0.36,0.5625,0.0256,0.3249,0.0025,0.7225,0.0729,0.2116,0.3844,0.0169,0.0225,0.1444,0.1296,0.6561,0.0256,0.3364,0.1369,0.3136,0.2809,0.2304,0.7225,0.8649,0.3969,0.0196,0.0324,1,0.1936,0.0144,0.3721,0.29345,0.235857143,0.351042857,19,59.38,17,53.13,6,75,3,37.5,5,62.5,3,37.5,9,56.25,8,50,71.88,71.75,75.12,71.25,69.38,67.5,76.25,6.25,18.75,-3.25,37.62,8.75,31.88,11.25,26.25,3,2,1,2,1,1,3,1,1,4,2,2,4,2,5,3,3,2,1,2,0,0,4,1,0,2,0,2,2,4,1,1,1,3,3,3,0,4,2,4,1.8,2,3,2.2,1,2,1.8,2.6,2.25,1.85,2.05,4,2.33,4,0.8,0,1.2,-0.4,0.666666667,5,1,-1,-3,1.67,1,-1,1,-1,1,-1,1,0,0,1,-1,1,10 cents,5 minutes,15 days,Male,University - Graduate (Masters),41,None,0.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,01ITEM,01DIR,4,2,8,3,6,9,5,1,7,3,4,2,1 +677,R_7ISuO9yeWcD34BP,25 - 31,,Canadian,Canadian,Male,Disagree,Strongly agree,Neither agree nor disagree,Disagree,Strongly agree,4,3,1,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,2,5,1,4,3,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,3,1,2,4,7,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,3,5,2,1,7,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,1,3,2,4,5,6,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Disagree,Strongly Agree,Disagree,Disagree,Strongly Agree,1,4,3,5,2,2,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,3,5,2,1,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,3,4,5,5,Agree,Agree,Agree,Agree,Somewhat agree,3,4,2,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,90,TRUE,100,FALSE,50,FALSE,90,FALSE,50,FALSE,50,TRUE,80,TRUE,60,FALSE,100,TRUE,60,FALSE,100,FALSE,100,FALSE,75,FALSE,60,TRUE,50,TRUE,100,TRUE,50,TRUE,60,TRUE,80,TRUE,80,FALSE,60,TRUE,95,TRUE,50,FALSE,60,TRUE,80,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,75,TRUE,70,20,-2,3,0,-2,3,1,1,1,1,2,1,1,2,1,1,-1,0,1,1,0,-1,1,1,-1,0,3,0,-1,1,1,-1,7,1,0,1,2,1,7,1,1,2,-1,1,6,-2,3,-2,-2,3,7,0,-1,1,0,1,2,1,1,1,1,1,6,2,2,2,2,1,5,TRUE,0,70,TRUE,1,75,FALSE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,80,FALSE,0,60,TRUE,1,50,TRUE,1,95,FALSE,1,60,TRUE,0,80,TRUE,1,80,TRUE,0,60,TRUE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,60,FALSE,1,75,FALSE,1,100,FALSE,0,100,TRUE,1,60,FALSE,1,100,TRUE,1,60,TRUE,0,80,FALSE,0,50,FALSE,1,50,FALSE,1,90,FALSE,1,50,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.36,0.25,0,0.04,0,0.25,0.16,0.0025,0,0.16,0,0.04,0.25,0.16,0.25,0.0625,0,0.25,0.01,0.64,1,0.25,0.0625,0.36,0.25,0.25,0.01,0.49,0.25,0.16,0.25,0.64,0.221696429,0.113214286,0.330178571,20,62.5,22,68.75,7,87.5,5,62.5,4,50,6,75,13,81.25,9,56.25,71.09,62.5,72.5,69.38,80,75,67.19,-6.25,2.34,-25,10,19.38,5,-6.25,10.94,1,2,1,1,3,1,2,0,0,3,0,1,1,1,0,2,1,1,2,1,0,0,2,0,0,1,2,0,1,1,0,0,1,0,0,3,2,1,1,1,1.6,1.2,0.6,1.4,0.4,1,0.2,1.6,1.2,0.8,1,5.67,5,5.375,1.2,0.2,0.4,-0.2,0.6,-4,5,1,1,0.67,2,1,1,-2,2,1,-1,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,27,,0.875,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,3,5,8,6,4,9,2,1,7,2,3,4,1 +678,R_7z6DP671COc8ph6,53 - 59,American,,American,Male,Somewhat disagree,Agree,Strongly agree,Strongly agree,Somewhat disagree,2,5,4,3,1,Agree,Neither agree nor disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,4,2,1,3,5,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,1,5,2,4,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,3,4,5,1,Agree,Agree,Agree,Agree,Somewhat agree,4,1,3,2,5,5,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,3,5,2,4,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,1,3,4,5,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Disagree,4,2,1,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Agree,Agree,Agree,Somewhat disagree,5,3,4,2,1,6,Somewhat agree,Strongly disagree,Neither agree nor disagree,Disagree,Somewhat disagree,3,1,5,2,4,7,Somewhat Agree,Agree,Strongly Agree,Disagree,Neither Agree nor Disagree,1,3,5,4,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,2,1,5,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,92,TRUE,95,TRUE,97,FALSE,67,TRUE,62,FALSE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,100,FALSE,57,TRUE,99,FALSE,65,TRUE,55,TRUE,100,FALSE,56,TRUE,100,FALSE,58,TRUE,91,TRUE,99,TRUE,100,FALSE,100,FALSE,52,FALSE,100,TRUE,99,FALSE,55,FALSE,100,TRUE,58,TRUE,86,FALSE,57,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,3,3,-1,2,0,1,-3,0,3,0,2,-1,1,0,1,1,1,0,2,2,2,2,1,5,1,1,-1,-1,0,5,0,0,-1,1,1,5,1,0,1,-1,-2,6,-1,2,2,2,-1,6,1,-3,0,-2,-1,7,1,2,3,-2,0,7,0,0,0,1,1,6,TRUE,0,92,TRUE,1,95,TRUE,0,97,FALSE,1,67,TRUE,1,62,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,100,FALSE,1,100,FALSE,1,57,TRUE,1,99,FALSE,1,65,TRUE,1,55,TRUE,1,100,FALSE,1,56,TRUE,0,100,FALSE,1,58,TRUE,0,91,TRUE,1,99,TRUE,1,100,FALSE,1,100,FALSE,0,52,FALSE,1,100,TRUE,1,99,FALSE,1,55,FALSE,1,100,TRUE,0,58,TRUE,1,86,FALSE,0,57,TRUE,1,100,0,0.0001,0,0,0,0,0.2704,1,0.8281,0,0.0196,0.0001,0.25,0,0.1444,0.0025,0,0.1089,0,0,0.0001,0.2025,0.1764,0.1225,0.1936,0.2025,0.3249,0.8464,0.9409,1,0.3364,0.1849,0.255539286,0.187428571,0.32365,24,75,23,71.88,6,75,7,87.5,5,62.5,5,62.5,12,75,11,68.75,82.81,67.12,84.25,94.5,85.38,84.62,81,3.12,10.93,-7.88,-3.25,32,22.88,9.62,12.25,3,0,1,1,2,1,1,2,2,0,3,0,3,2,0,1,1,0,2,2,0,0,1,1,0,1,3,1,1,1,2,2,1,1,1,0,1,1,0,1,1.4,1.2,1.6,1.2,0.4,1.4,1.4,0.6,1.35,0.95,1.15,5,6.67,5.875,1,-0.2,0.2,0.6,0.333333333,-1,-2,-2,0,-1.67,-1,0,-2,-2,2,-1,1,2,-2,0,0,-2,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,53,,-0.5,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,01DIR,7,5,9,4,3,2,6,1,8,4,2,3,1 +679,R_1JgWJdUQWW0nn6V,39 - 45,American,,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,2,5,1,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,2,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,3,4,1,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,5,4,10,Strongly Agree,Strongly Agree,Agree,Agree,Agree,5,4,2,1,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Agree,Agree,Agree,4,3,1,2,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,1,2,5,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,1,2,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,94,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,32,2,3,3,2,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,2,2,2,10,3,3,3,3,3,10,2,2,2,2,2,9,1,1,1,0,1,8,3,3,3,3,3,10,3,3,3,3,3,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,1,0,1,0,0,0,0.0036,0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,1,1,1,0.500128571,0.3574,0.642857143,32,100,18,56.25,5,62.5,3,37.5,6,75,4,50,14,87.5,4,25,99.81,99.25,100,100,100,99.62,100,43.75,43.56,36.75,62.5,25,50,12.12,75,1,0,0,1,0,0,6,0,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,1,2,4,2,3,2,0,0,0,0,0,0,0,0,0,0,0.4,2.4,0.6,0,0.6,2.6,0,0,0.85,0.8,0.825,10,9,9.5,-0.2,-0.2,0.6,0,0.066666667,1,2,0,1,1,2,-2,-2,-2,2,-2,2,-2,2,-2,2,-2,10 cents,100 minutes,24 days,Male,University - Undergraduate,43,nothing thank you,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,2,9,3,6,5,4,7,1,8,2,4,3,1 +680,R_5LtUa8bqZ8QlyAI,25 - 31,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,4,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,1,3,5,4,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,2,1,3,5,Agree,Agree,Somewhat agree,Agree,Somewhat agree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,1,3,2,9,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,1,5,3,4,2,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,3,5,2,4,1,9,Agree,Agree,Strongly Agree,Somewhat agree,Agree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,4,5,2,1,3,8,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,5,2,4,1,3,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,3,1,5,9,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,5,4,3,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,87,TRUE,100,TRUE,98,FALSE,99,TRUE,97,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,89,TRUE,88,TRUE,86,TRUE,93,FALSE,93,FALSE,94,FALSE,88,TRUE,100,16,1,3,3,3,3,1,1,1,-2,1,1,1,1,1,0,2,2,1,2,1,1,3,3,3,3,9,1,0,-1,-1,1,9,0,0,-1,-1,0,9,2,2,3,1,2,9,0,3,3,-3,3,9,0,-2,0,-2,0,8,0,0,0,0,0,9,-1,0,0,-2,-2,9,TRUE,0,100,FALSE,0,88,FALSE,1,94,FALSE,1,93,TRUE,1,93,TRUE,0,86,TRUE,1,88,TRUE,1,89,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,97,FALSE,1,99,TRUE,0,98,TRUE,1,100,TRUE,1,87,TRUE,1,100,0.0121,0,0,0.0144,0,0.7396,0,0,0,0,0,0,0,1,0.0049,0.7744,1,0.0049,0.0001,1,1,0,0,1,1,0.9409,0.0169,1,0.0036,1,0.9604,1,0.444489286,0.2517,0.637278571,16,50,19,59.38,5,62.5,3,37.5,4,50,7,87.5,14,87.5,5,31.25,97.25,95.62,97.12,98.5,97.75,96.56,97.94,-9.38,37.87,33.12,59.62,48.5,10.25,9.06,66.69,0,0,0,0,0,0,1,2,1,0,1,1,2,2,0,0,0,2,1,1,1,0,0,6,0,1,3,1,0,1,1,1,1,1,0,3,2,1,4,3,0,0.8,1.2,0.8,1.4,1.2,0.8,2.6,0.7,1.5,1.1,9,8.67,8.875,-1.4,-0.4,0.4,-1.8,-0.466666667,0,1,0,0,0.33,0,0,0,0,0,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,25,great survey,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,02REV,7,2,6,4,3,5,9,1,8,3,2,4,1 +681,R_1me0UE09DCXstD6,39 - 45,,Canadian,Canadian,Male,Somewhat disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,4,1,2,3,5,Disagree,Disagree,Somewhat disagree,Disagree,Somewhat agree,3,1,4,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,2,5,3,4,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,2,1,3,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,3,1,5,2,4,2,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,4,2,5,1,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,4,1,2,5,1,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,5,1,3,4,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat disagree,Somewhat disagree,Agree,Agree,4,2,3,5,1,2,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,2,3,4,5,1,Agree,Agree,Somewhat Agree,Agree,Agree,4,3,5,2,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,3,2,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,60,TRUE,60,FALSE,95,TRUE,65,FALSE,99,FALSE,55,TRUE,75,TRUE,90,TRUE,80,FALSE,50,FALSE,50,TRUE,75,FALSE,99,FALSE,50,TRUE,99,FALSE,60,FALSE,85,TRUE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,60,FALSE,100,TRUE,99,TRUE,50,FALSE,80,FALSE,60,FALSE,70,FALSE,50,TRUE,99,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,-1,1,2,1,-2,-2,-1,-2,1,1,1,1,1,2,-3,-3,-3,-3,-3,1,-1,2,1,2,2,-2,-2,1,-2,1,1,1,1,1,1,2,1,-2,0,-1,-1,1,6,-1,-1,-1,2,2,2,-2,-2,1,-2,1,1,2,2,1,2,2,2,0,0,0,0,-2,7,TRUE,0,70,TRUE,1,60,TRUE,0,60,FALSE,1,95,TRUE,1,65,FALSE,1,99,FALSE,0,55,TRUE,1,75,TRUE,1,90,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,1,99,FALSE,0,50,TRUE,1,99,FALSE,1,60,FALSE,1,85,TRUE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,60,FALSE,1,100,TRUE,1,99,TRUE,0,50,FALSE,1,80,FALSE,1,60,FALSE,0,70,FALSE,0,50,TRUE,1,99,0.0625,0.0001,0.0001,0.3025,0.0001,0.0001,0.36,0.04,0.25,0,0.49,0.0625,0.01,0.25,0.1225,0.16,0,0.0025,0.04,0,0,0.25,0.25,0.0001,0.16,0.25,0.25,0.49,0.36,0.0225,0.16,0.25,0.151082143,0.124835714,0.177328571,24,75,23,71.88,4,50,8,100,6,75,5,62.5,11,68.75,12,75,74.53,61.88,82.25,86,68,76.69,72.38,3.12,2.65,11.88,-17.75,11,5.5,7.94,-2.62,2,0,1,1,1,0,0,2,0,0,0,0,0,0,0,1,3,2,2,4,0,0,2,0,1,0,0,2,0,0,1,1,0,1,0,3,3,3,3,1,1,0.4,0,2.4,0.6,0.4,0.6,2.6,0.95,1.05,1,1.33,1.67,2.75,0.4,0,-0.6,-0.2,-0.066666667,0,0,-1,-1,-0.34,0,2,1,-1,1,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,42,This survey was fun and interesting.,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,5,7,2,9,4,8,6,1,3,4,3,2,1 +682,R_1N9ylwpvLg7lFLl,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,2,3,5,1,4,Agree,Disagree,Somewhat agree,Disagree,Agree,2,3,4,5,1,Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,5,1,4,2,3,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,3,4,2,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,5,3,4,8,Agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,4,3,5,2,8,Agree,Somewhat Agree,Somewhat Disagree,Disagree,Somewhat Agree,1,4,3,2,5,5,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,5,4,2,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Agree,Strongly Agree,5,3,1,2,4,8,Agree,Somewhat disagree,Agree,Disagree,Somewhat agree,3,4,5,1,2,8,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Agree,Agree,3,2,5,4,1,5,Agree,Somewhat disagree,Agree,Agree,Somewhat disagree,3,4,1,5,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,74,FALSE,66,TRUE,71,FALSE,93,FALSE,59,FALSE,54,FALSE,64,FALSE,56,TRUE,80,TRUE,90,TRUE,70,TRUE,90,TRUE,90,FALSE,70,FALSE,80,TRUE,90,FALSE,57,TRUE,100,FALSE,72,FALSE,52,FALSE,60,FALSE,70,FALSE,70,FALSE,80,TRUE,70,TRUE,90,FALSE,70,FALSE,100,FALSE,70,TRUE,100,FALSE,62,FALSE,54,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,2,3,2,-2,1,-2,2,2,2,1,-1,-1,0,1,-1,2,-1,-1,1,1,-1,1,8,2,-2,1,-1,-1,8,2,1,-1,-2,1,5,-1,1,-1,2,-1,8,1,3,2,2,3,8,2,-1,2,-2,1,8,-1,-1,-1,2,2,5,2,-1,2,2,-1,8,FALSE,1,74,FALSE,0,66,TRUE,0,71,FALSE,1,93,FALSE,0,59,FALSE,1,54,FALSE,0,64,FALSE,0,56,TRUE,1,80,TRUE,1,90,TRUE,0,70,TRUE,0,90,TRUE,1,90,FALSE,1,70,FALSE,0,80,TRUE,1,90,FALSE,1,57,TRUE,0,100,FALSE,1,72,FALSE,1,52,FALSE,0,60,FALSE,0,70,FALSE,1,70,FALSE,0,80,TRUE,0,70,TRUE,1,90,FALSE,1,70,FALSE,1,100,FALSE,1,70,TRUE,1,100,FALSE,0,62,FALSE,0,54,0.3136,0.01,0.01,0.4096,0.2916,0.2116,0.64,0.01,0.2304,0.49,0,0.01,0.04,0.49,0.3481,0.4356,0.09,0.0049,0,0.49,0.36,0.64,0.0784,0.09,0.1849,0.09,0.3844,0.0676,0.5041,1,0.09,0.81,0.288628571,0.235157143,0.3421,20,62.5,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,74.19,74.12,64.25,78.5,79.88,74.44,73.94,9.37,21.06,24.12,1.75,28.5,29.88,36.94,5.19,2,2,1,3,2,0,0,0,1,3,0,1,2,1,2,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,3,3,2,3,3,2,2,3,0,0,2,0.8,1.2,0.2,0,0.6,2.8,1.4,1.05,1.2,1.125,7,7,7.25,2,0.2,-1.6,-1.2,0.2,0,0,0,0,0,1,1,1,-1,1,1,-1,1,-1,-1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,21,I loved this survey,0.5,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,3,5,9,2,8,7,6,1,4,2,3,4,1 +683,R_5wcNlag6ceIUjS7,25 - 31,American,,American,Male,Agree,Agree,Agree,Agree,Agree,1,2,3,4,5,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,Agree,Agree,Agree,Agree,Agree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Agree,Agree,Strongly Agree,4,3,5,1,2,9,Agree,Agree,Agree,Agree,Agree,1,2,5,3,4,8,Agree,Agree,Agree,Agree,Agree,3,2,1,5,4,9,Agree,Agree,Agree,Agree,Agree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,9,Agree,Agree,Agree,Agree,Agree,2,5,4,3,1,9,Agree,Agree,Agree,Agree,Agree,1,2,3,4,5,9,Agree,Agree,Agree,Agree,Agree,1,2,5,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,93,TRUE,92,TRUE,93,TRUE,90,TRUE,91,TRUE,89,TRUE,83,FALSE,89,TRUE,82,TRUE,81,TRUE,77,TRUE,80,TRUE,83,TRUE,82,TRUE,86,TRUE,82,TRUE,82,TRUE,81,TRUE,89,TRUE,85,TRUE,100,TRUE,88,TRUE,88,TRUE,85,TRUE,86,TRUE,83,TRUE,86,TRUE,81,TRUE,84,TRUE,87,TRUE,87,TRUE,88,23,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,9,2,2,2,2,2,9,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,2,2,2,2,2,9,TRUE,0,88,TRUE,1,87,TRUE,0,87,TRUE,0,84,TRUE,1,81,TRUE,0,86,TRUE,1,83,TRUE,1,86,TRUE,1,85,TRUE,1,88,TRUE,0,88,TRUE,0,100,TRUE,1,85,TRUE,0,89,TRUE,1,81,TRUE,1,82,TRUE,0,82,TRUE,0,86,TRUE,0,82,TRUE,0,83,TRUE,1,80,TRUE,1,77,TRUE,0,81,TRUE,1,82,FALSE,1,89,TRUE,1,83,TRUE,0,89,TRUE,0,91,TRUE,0,90,TRUE,1,93,TRUE,1,92,TRUE,1,93,0.0196,0.0289,0.0324,0.0289,0.0049,0.7396,0.0324,0.0144,0.6889,0.0529,0.0049,0.0225,0.0225,0.7744,0.0361,0.0169,0.6561,0.7056,0.8281,0.0121,0.04,0.0361,0.6724,0.7921,0.6724,0.7921,0.0064,0.7744,0.7569,0.7396,0.81,1,0.418025,0.269435714,0.566614286,23,71.88,17,53.13,4,50,4,50,5,62.5,4,50,16,100,1,6.25,86.03,86,84.75,85.38,88,84.88,87.19,18.75,32.9,36,34.75,22.88,38,-15.12,80.94,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0,0,0.05,0,0.025,8.67,9,8.875,0.2,0,0,0,0.066666667,0,0,-1,0,-0.33,0,1,0,0,0,0,0,0,0,0,0,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,27,it was educative,0.25,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,3,5,8,6,4,2,9,1,7,4,3,2,1 +684,R_3GOLclcTglSIaGV,39 - 45,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Agree,Somewhat agree,5,4,1,2,3,Disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,4,1,3,2,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,1,2,5,4,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Somewhat agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,3,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,4,2,5,3,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,3,4,5,2,1,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Disagree,5,3,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,1,5,3,2,4,2,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,2,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,3,2,5,1,4,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,1,4,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,70,FALSE,86,TRUE,100,TRUE,96,FALSE,95,FALSE,50,TRUE,64,FALSE,91,TRUE,52,TRUE,70,FALSE,50,FALSE,50,FALSE,100,TRUE,90,FALSE,80,FALSE,54,TRUE,74,FALSE,53,FALSE,98,TRUE,99,TRUE,97,FALSE,99,FALSE,90,TRUE,50,FALSE,50,TRUE,98,FALSE,100,FALSE,79,FALSE,53,TRUE,91,FALSE,57,TRUE,61,23,1,3,2,2,1,-2,1,2,1,0,2,0,1,1,2,0,1,1,0,-2,0,1,3,0,0,4,-2,0,1,1,0,3,2,1,1,2,2,3,-1,0,-1,-2,-2,1,3,3,2,3,2,3,-2,0,2,1,0,2,2,-1,1,1,2,2,-1,0,0,0,-1,5,TRUE,0,61,FALSE,0,57,TRUE,0,91,FALSE,1,53,FALSE,0,79,FALSE,1,100,TRUE,1,98,FALSE,0,50,TRUE,1,50,FALSE,0,90,FALSE,1,99,TRUE,0,97,TRUE,1,99,FALSE,1,98,FALSE,0,53,TRUE,1,74,FALSE,1,54,FALSE,1,80,TRUE,0,90,FALSE,1,100,FALSE,0,50,FALSE,0,50,TRUE,0,70,TRUE,1,52,FALSE,1,91,TRUE,1,64,FALSE,1,50,FALSE,1,95,TRUE,0,96,TRUE,1,100,FALSE,0,86,TRUE,1,70,0.25,0.1296,0.0676,0.0004,0.09,0,0.2304,0.81,0,0.25,0,0.0001,0.25,0.0001,0.6241,0.3249,0.49,0.2209,0.0025,0.0081,0.25,0.2809,0.81,0.0004,0.2116,0.25,0.7396,0.3721,0.8281,0.04,0.9216,0.9409,0.319510714,0.235035714,0.403985714,23,71.88,18,56.25,4,50,4,50,5,62.5,5,62.5,8,50,10,62.5,76.47,67.25,77.25,79,82.38,70.12,82.81,15.63,20.22,17.25,27.25,16.5,19.88,20.12,20.31,1,2,1,2,1,0,1,1,0,0,0,1,0,1,0,1,1,2,2,0,2,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,1,1,0,1,1.4,0.4,0.4,1.2,0.8,0.2,0.2,0.8,0.85,0.5,0.675,3.33,2.33,2.875,0.6,0.2,0.2,0.4,0.333333333,1,1,1,-4,1,1,2,2,-1,1,-1,1,-1,1,-1,1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,43,,1.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,4,9,3,2,8,7,6,1,5,3,2,4,1 +685,R_78Gq86eg0MMuGTO,25 - 31,,Canadian,Canadian,Male,Strongly disagree,Agree,Strongly agree,Disagree,Strongly agree,3,5,1,4,2,Agree,Agree,Neither agree nor disagree,Agree,Agree,5,2,3,1,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,3,4,2,5,1,Agree,Agree,Agree,Somewhat agree,Somewhat disagree,3,4,5,2,1,Strongly disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,5,4,3,1,2,1,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,4,1,5,3,2,8,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,5,3,1,4,2,9,Somewhat disagree,Disagree,Disagree,Neither agree nor disagree,Strongly disagree,3,1,2,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,2,3,1,4,2,Agree,Agree,Neither agree nor disagree,Somewhat disagree,Agree,3,1,5,2,4,2,Somewhat Agree,Agree,Strongly Agree,Agree,Agree,3,5,1,4,2,2,Agree,Somewhat agree,Agree,Strongly Agree,Agree,3,2,5,1,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,83,FALSE,50,FALSE,50,FALSE,87,FALSE,50,TRUE,64,TRUE,60,TRUE,90,FALSE,70,TRUE,94,TRUE,98,TRUE,73,FALSE,55,TRUE,80,TRUE,90,TRUE,100,FALSE,50,FALSE,100,FALSE,100,TRUE,80,FALSE,50,TRUE,75,FALSE,50,TRUE,90,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,61,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,2,3,-2,3,2,2,0,2,2,1,1,3,3,2,2,2,2,1,-1,-3,3,3,-3,3,1,-1,3,-1,3,0,8,0,-1,0,3,0,9,-1,-2,-2,0,-3,10,-1,3,3,0,3,2,2,2,0,-1,2,2,1,2,3,2,2,2,2,1,2,3,2,2,TRUE,0,100,FALSE,0,50,TRUE,0,83,FALSE,1,50,FALSE,0,50,FALSE,1,87,FALSE,0,50,TRUE,1,64,TRUE,1,60,TRUE,1,90,FALSE,1,70,TRUE,0,94,TRUE,1,98,TRUE,0,73,FALSE,0,55,TRUE,1,80,TRUE,0,90,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,80,FALSE,1,50,TRUE,1,75,FALSE,1,50,TRUE,1,90,FALSE,1,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,61,0.1296,0.01,0.04,0.25,0.1521,0.0169,0.0625,0.01,0,0.04,0,0.0004,0.16,0.09,0.25,0.25,0.25,0.25,0,0.25,1,0.3025,0.25,0.5329,0.81,0.25,1,1,0.6889,1,1,0.8836,0.374992857,0.109421429,0.640564286,17,53.13,19,59.38,5,62.5,4,50,4,50,6,75,10,62.5,9,56.25,76.56,60.62,79.5,79.12,87,75.19,77.94,-6.25,17.18,-1.88,29.5,29.12,12,12.69,21.69,0,1,0,1,0,3,1,1,1,2,1,2,3,0,2,3,4,4,1,2,2,1,0,2,0,0,0,0,3,0,0,1,0,1,0,0,1,0,2,3,0.4,1.6,1.6,2.8,1,0.6,0.4,1.2,1.6,0.8,1.2,6,2,4.5,-0.6,1,1.2,1.6,0.533333333,-1,6,7,8,4,1,1,1,-2,2,0,0,-1,1,0,0,-1,10 cents,5 minutes,47 days,Male,University - Undergraduate,30,It was fun!,0.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,3,5,2,6,4,7,8,1,9,4,2,3,1 +686,R_1LMC5Teu1zXZQGs,39 - 45,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,3,1,2,5,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,4,5,2,3,Somewhat Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,5,3,4,Somewhat disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,4,3,1,5,2,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,0,Agree,Agree,Agree,Agree,Strongly Agree,5,3,4,2,1,10,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,5,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,2,4,0,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,3,1,4,0,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,1,2,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,TRUE,95,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,75,TRUE,100,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,80,16,0,0,1,1,2,0,1,1,-1,0,1,2,3,0,0,-1,-1,-2,0,-2,1,1,1,1,2,0,0,0,0,0,0,8,2,2,2,2,3,0,0,-1,0,0,0,10,0,0,0,0,0,0,1,1,1,1,1,8,2,1,1,1,1,0,-1,-1,-1,-1,-1,0,TRUE,0,80,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,95,FALSE,0,100,0.25,0,0,0.25,1,0,0,0,0.25,0.25,0,0,0.25,0.25,0.25,0.25,0.25,0.25,1,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.0025,0.64,0.25,1,1,0.25,0.32875,0.214285714,0.443214286,16,50,20,62.5,6,75,5,62.5,3,37.5,6,75,9,56.25,11,68.75,70.31,55.62,75,75.62,75,74.69,65.94,-12.5,7.81,-19.38,12.5,38.12,0,18.44,-2.81,1,1,0,0,0,0,1,1,1,0,1,0,1,2,3,1,0,2,0,2,0,0,1,1,2,1,0,0,2,1,1,1,2,1,1,0,0,1,1,1,0.4,0.6,1.4,1,0.8,0.8,1.2,0.6,0.85,0.85,0.85,2.67,2.67,3.25,-0.4,-0.2,0.2,0.4,-0.133333333,0,0,0,10,0,2,0,1,-1,1,-2,2,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),44,,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,6,9,7,8,4,3,5,1,2,3,4,2,1 +687,R_3rGc9083GRoB6jR,46 - 52,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,2,5,3,4,1,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,3,2,4,1,5,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,5,1,4,2,3,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,4,1,2,3,5,1,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,3,5,1,2,4,1,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,3,5,1,2,4,1,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Agree,Agree,4,5,1,3,2,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,5,4,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly agree,5,3,4,2,1,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,1,5,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,84,TRUE,100,TRUE,88,FALSE,93,TRUE,50,TRUE,92,TRUE,86,TRUE,77,FALSE,70,TRUE,52,FALSE,53,FALSE,89,TRUE,53,FALSE,93,TRUE,57,TRUE,89,FALSE,50,FALSE,97,TRUE,90,FALSE,97,FALSE,93,TRUE,80,FALSE,52,TRUE,66,TRUE,91,FALSE,80,TRUE,89,FALSE,52,FALSE,78,TRUE,73,FALSE,76,25,1,3,3,-1,3,1,-1,-1,-1,1,-1,-1,1,-3,3,1,1,2,2,2,1,3,3,1,3,1,1,1,-1,-1,1,1,-1,0,1,-3,3,1,2,2,2,2,2,1,2,3,3,2,2,1,1,-1,1,1,1,1,1,1,1,-3,3,1,1,1,1,2,1,1,FALSE,1,76,TRUE,1,73,FALSE,1,78,FALSE,1,52,TRUE,1,89,FALSE,1,80,TRUE,1,91,TRUE,1,66,FALSE,0,52,TRUE,1,80,FALSE,1,93,FALSE,1,97,TRUE,1,90,FALSE,1,97,FALSE,0,50,TRUE,1,89,TRUE,0,57,FALSE,1,93,TRUE,0,53,FALSE,1,89,FALSE,0,53,TRUE,1,52,FALSE,1,70,TRUE,1,77,TRUE,0,86,TRUE,1,92,TRUE,0,50,FALSE,1,93,TRUE,0,88,TRUE,1,100,TRUE,1,84,TRUE,1,100,0.1156,0.0064,0.0121,0.0081,0,0.04,0.0529,0.04,0.0121,0.2304,0,0.01,0.2704,0.0049,0.0121,0.0729,0.09,0.2304,0.0049,0.7396,0.2809,0.25,0.2809,0.0009,0.3249,0.25,0.0256,0.0576,0.0484,0.0049,0.7744,0.0009,0.146785714,0.07615,0.217421429,25,78.13,24,75,4,50,5,62.5,7,87.5,8,100,13,81.25,11,68.75,77.81,63.38,78.38,83.38,86.12,77.38,78.25,3.13,2.81,13.38,15.88,-4.12,-13.88,-3.87,9.5,0,0,0,2,0,0,2,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,3,1,0,0,2,2,0,2,2,0,0,0,0,0,1,0,1,0.4,0.4,0.2,0.4,1,0.8,0.8,0.4,0.35,0.75,0.55,1,1,1,-0.6,-0.4,-0.6,0,-0.533333333,0,0,0,0,0,0,1,1,-2,2,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,52,none,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,6,3,9,2,8,4,7,1,5,2,4,3,1 +688,R_7YS8TYsC6D8Qr2F,53 - 59,American,,American,Male,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,4,5,1,3,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,4,2,1,5,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,5,3,2,4,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,3,2,1,5,Agree,Agree,Agree,Agree,Agree,5,1,4,3,2,0,Somewhat agree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,5,2,1,4,2,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,1,3,5,4,2,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,1,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,2,1,4,5,3,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,3,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,2,1,5,4,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,2,4,3,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,TRUE,65,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,81,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,72,TRUE,50,TRUE,50,TRUE,87,TRUE,50,TRUE,72,TRUE,50,FALSE,79,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,75,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,1,1,0,-2,2,-1,1,2,2,2,-1,3,-1,-1,1,0,-1,2,2,2,2,2,0,1,-2,2,-1,1,2,2,2,2,-1,3,2,0,0,0,0,-1,3,2,2,2,2,2,0,0,0,0,0,0,3,2,2,2,-1,3,1,0,0,0,0,-1,4,TRUE,0,50,TRUE,1,65,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,81,TRUE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,72,TRUE,0,50,TRUE,1,50,TRUE,1,87,TRUE,0,50,TRUE,0,72,TRUE,0,50,FALSE,1,79,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,75,TRUE,0,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,0.25,0.0625,0.0169,0.0361,0.25,0.25,0.25,0.25,0.0441,0.25,0.25,0.0784,0.25,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,0.25,0.25,0.24155,0.213928571,0.269171429,23,71.88,19,59.38,5,62.5,5,62.5,4,50,5,62.5,14,87.5,5,31.25,55.66,51.88,52.75,59.75,58.25,58.12,53.19,12.5,-3.72,-10.62,-9.75,9.75,-4.25,-29.38,21.94,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,2,2,1,1,0,0,0,0,0,1,1,1,0,0,0.4,0.2,0,0.6,0.4,1.2,0,0.6,0.3,0.55,0.425,1.33,1.33,1.875,0,-1,0,0,-0.333333333,0,-1,1,-1,0,1,1,2,-2,2,0,0,0,0,-1,1,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,,1.125,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,8,7,3,4,6,9,2,1,5,2,3,4,1 +689,R_5ctjaI2kk0V2XEM,53 - 59,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,5,1,2,3,4,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,3,4,2,5,Agree,Disagree,Agree,Somewhat Agree,Strongly Agree,4,1,2,5,3,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Agree,Somewhat agree,Somewhat disagree,3,2,1,4,5,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,1,3,4,2,3,Somewhat Agree,Disagree,Agree,Somewhat Agree,Strongly Agree,4,2,3,5,1,3,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,3,2,5,4,1,2,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,3,1,2,4,5,2,Agree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,3,1,5,2,2,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,5,4,3,2,TRUE,100,TRUE,100,TRUE,100,FALSE,70,TRUE,100,FALSE,64,TRUE,75,TRUE,87,TRUE,93,TRUE,100,FALSE,82,TRUE,100,TRUE,87,TRUE,100,TRUE,58,TRUE,100,TRUE,87,TRUE,100,TRUE,90,FALSE,100,FALSE,85,TRUE,62,FALSE,97,TRUE,100,FALSE,92,TRUE,100,TRUE,76,FALSE,77,TRUE,92,FALSE,71,FALSE,60,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,-1,1,-1,2,-2,1,2,-2,2,1,3,2,1,2,1,1,2,3,2,1,-1,2,-1,1,1,-1,-1,4,1,-2,2,1,3,3,0,1,2,1,1,3,3,3,3,3,-1,2,-1,-1,2,-1,1,2,2,-1,3,0,3,2,2,1,2,1,1,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,70,TRUE,1,100,FALSE,1,64,TRUE,1,75,TRUE,1,87,TRUE,1,93,TRUE,1,100,FALSE,1,82,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,58,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,90,FALSE,1,100,FALSE,0,85,TRUE,1,62,FALSE,1,97,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,0,76,FALSE,1,77,TRUE,0,92,FALSE,0,71,FALSE,0,60,TRUE,1,100,0.0169,0,0,0.0625,0,0.1296,0,0,0,0.1444,0.5041,0.0169,0.0049,0.0324,0,0,0.0009,0.09,0.0529,0.0064,0.7225,0.1764,0.81,1,0.7569,0.5776,0.36,1,1,1,0.8464,1,0.365439286,0.065942857,0.664935714,23,71.88,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,13,81.25,7,43.75,87.66,78.62,89,91.12,91.88,86.12,89.19,9.38,25.16,16.12,26.5,28.62,29.38,4.87,45.44,1,0,1,2,0,2,2,1,1,2,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0.8,1.6,0.2,0.4,0,0.6,0.6,0,0.75,0.3,0.525,3,2,2.5,0.8,1,-0.4,0.4,0.466666667,0,2,1,1,1,1,2,2,-2,2,1,-1,-1,1,-2,2,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,56,none,1.25,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,7,9,4,5,6,3,8,1,2,4,3,2,1 +690,R_1IJDBdArUJMY0PT,32 - 38,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly disagree,Strongly disagree,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,4,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,1,3,Strongly disagree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,3,5,4,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,5,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,3,5,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,82,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,50,TRUE,50,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,0,-3,-3,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,-3,3,3,0,-3,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,-3,3,0,0,-3,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,82,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.6724,0.25,0.25,0.318657143,0.25,0.387314286,15,46.88,17,53.13,4,50,5,62.5,4,50,4,50,6,37.5,11,68.75,54.12,50,50,54,62.5,50,58.25,-6.25,0.99,0,-12.5,4,12.5,12.5,-10.5,0,0,3,3,0,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,1,3,0,3,0,0,0,0,0,1.2,0,1.6,0,0.6,0,1.6,0,0.7,0.55,0.625,5,5,5,0.6,0,0,0,0.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),38,,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,2,4,8,3,9,7,6,1,5,3,2,4,1 +691,R_7NJaYdxng6i1y05,53 - 59,American,,American,Male,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,5,3,1,2,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,4,5,2,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,3,5,1,4,2,Somewhat disagree,Strongly disagree,Disagree,Neither agree nor disagree,Disagree,5,2,4,1,3,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,4,2,1,3,5,0,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,1,3,2,5,4,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Agree,3,2,4,5,1,3,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,1,5,4,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,2,1,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,2,3,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,1,4,2,3,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,1,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,28,1,1,2,1,0,-2,0,3,1,0,0,0,3,0,2,-1,-3,-2,0,-2,1,2,2,2,0,0,-1,0,2,1,0,0,0,0,2,-2,2,3,0,-1,-1,0,-2,2,1,1,2,2,2,2,0,0,2,0,0,1,0,0,2,0,2,0,0,0,0,0,0,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0.25,0,0,0,0,0,1,0,0.25,0,0,1,1,1,1,0.232142857,0.089285714,0.375,28,87.5,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,96.88,87.5,100,100,100,100,93.75,9.37,18.75,12.5,12.5,25,25,6.25,31.25,0,1,0,1,0,1,0,1,0,0,0,0,1,2,0,1,2,1,0,0,0,0,0,1,2,2,0,1,1,0,0,0,1,0,0,1,3,2,0,2,0.4,0.4,0.6,0.8,0.6,0.8,0.2,1.6,0.55,0.8,0.675,1,1,1,-0.2,-0.4,0.4,-0.8,-0.066666667,-2,-1,3,2,0,0,2,0,-2,2,0,0,-2,2,-2,2,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),54,,1,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,7,4,8,9,3,5,1,6,3,2,4,1 +692,R_5oyuDdGaXGNSoGB,39 - 45,,Canadian,Canadian,Male,Agree,Disagree,Strongly agree,Agree,Strongly disagree,5,4,3,2,1,Strongly disagree,Disagree,Somewhat agree,Agree,Disagree,4,1,2,3,5,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,3,1,2,4,5,Agree,Agree,Agree,Agree,Agree,4,3,5,2,1,Agree,Disagree,Strongly Agree,Agree,Strongly disagree,5,3,4,1,2,0,Strongly disagree,Disagree,Agree,Agree,Disagree,5,2,4,3,1,0,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,5,2,4,3,1,0,Agree,Agree,Agree,Agree,Agree,2,3,5,4,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Disagree,Strongly Agree,Agree,Strongly disagree,5,4,2,3,1,0,Strongly disagree,Disagree,Agree,Agree,Disagree,1,4,3,2,5,0,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly Agree,1,4,3,5,2,0,Agree,Agree,Agree,Agree,Agree,3,5,4,2,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,75,TRUE,100,TRUE,95,FALSE,50,TRUE,50,TRUE,95,FALSE,50,TRUE,95,TRUE,50,FALSE,100,TRUE,99,TRUE,99,FALSE,50,TRUE,50,TRUE,90,TRUE,95,TRUE,95,FALSE,95,TRUE,95,FALSE,50,TRUE,100,TRUE,100,TRUE,99,25,2,-2,3,2,-3,-3,-2,1,2,-2,2,1,1,-3,3,2,2,2,2,2,2,-2,3,2,-3,0,-3,-2,2,2,-2,0,2,1,1,-3,3,0,2,2,2,2,2,0,2,-2,3,2,-3,0,-3,-2,2,2,-2,0,2,1,1,-3,3,0,2,2,2,2,2,0,TRUE,0,99,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,95,FALSE,1,95,TRUE,1,95,TRUE,1,95,TRUE,1,90,TRUE,1,50,FALSE,1,50,TRUE,0,99,TRUE,1,99,FALSE,1,100,TRUE,1,50,TRUE,1,95,FALSE,1,50,TRUE,0,95,TRUE,0,50,FALSE,1,50,TRUE,1,95,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.0025,0,0.0025,0.0025,0,0.0025,0,0.25,0.25,0,0,0.0001,0.01,0.25,0.0025,0,0.5625,0.25,0,0,0.0025,0.25,0.25,0,0.25,0.25,1,0.9801,1,0.9025,0,0.9801,0.265814286,0.112685714,0.418942857,25,78.13,25,78.13,6,75,7,87.5,6,75,6,75,15,93.75,10,62.5,85.22,67.5,88.62,92.38,92.38,91.5,78.94,0,7.09,-7.5,1.12,17.38,17.38,-2.25,16.44,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0.2,0,0,0.05,0.05,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,2,1,-2,2,-2,2,-1,1,-2,2,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),44,stupid survey,1.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,6,3,4,7,9,8,2,1,5,2,4,3,1 +693,R_6pMPYhEviIc7du6,32 - 38,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Disagree,Agree,5,4,2,1,3,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly agree,3,4,5,1,2,Disagree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,2,4,1,3,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Agree,Disagree,Somewhat agree,5,2,1,3,4,4,Disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,2,3,1,4,5,1,Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,1,2,4,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Disagree,Agree,3,1,4,2,5,2,Somewhat disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,5,1,2,3,1,Disagree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,2,5,4,3,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,FALSE,100,TRUE,86,TRUE,90,FALSE,50,TRUE,100,FALSE,100,TRUE,50,TRUE,75,TRUE,90,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,80,TRUE,100,FALSE,100,FALSE,100,FALSE,70,FALSE,100,TRUE,100,TRUE,90,FALSE,100,TRUE,100,FALSE,100,TRUE,95,TRUE,60,FALSE,100,FALSE,100,FALSE,70,FALSE,75,TRUE,70,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,-2,2,-2,1,0,1,3,-2,-3,2,0,3,-3,-2,-3,-3,-3,2,3,2,-2,1,2,-2,0,3,-1,3,4,-2,-3,3,0,3,1,-3,-3,-3,-3,-3,5,3,3,2,-2,2,3,-1,-3,3,0,3,2,-2,-3,3,0,3,1,0,1,0,0,0,5,FALSE,1,100,TRUE,1,86,TRUE,0,90,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,75,TRUE,1,90,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,60,FALSE,1,100,FALSE,1,100,FALSE,0,70,FALSE,0,75,TRUE,1,70,0.0625,0.0025,0,0.25,0.09,0,0,0,0,0.01,0.49,0.25,0.01,0.25,0,0.0196,0,0.25,0,0,0,0.04,0.09,0,0,0.36,0.5625,0,0.81,0,0,0.25,0.124360714,0.097828571,0.150892857,24,75,27,84.38,6,75,7,87.5,8,100,6,75,13,81.25,14,87.5,84.41,70.12,90,91.88,85.62,83.19,85.62,-9.38,0.03,-4.88,2.5,-8.12,10.62,1.94,-1.88,0,0,0,0,1,0,1,3,2,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,4,3,1,0,0,0,1,0,0,3,3,3,3,3,0.2,1.2,0.2,0.2,0.2,1.8,0.2,3,0.45,1.3,0.875,2.33,2,2.875,0,-0.6,0,-2.8,-0.2,-1,2,0,0,0.33,0,1,2,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,33,"None, thanks for asking.",1.25,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,2,4,7,5,3,9,8,1,6,3,2,4,1 +694,R_77cXVuCUiJzau8Z,39 - 45,,Canadian,Canadian,Male,Somewhat disagree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,2,3,1,4,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,2,5,4,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,2,5,3,1,4,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Agree,Agree,Somewhat agree,Strongly Agree,2,1,3,5,4,7,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,2,1,4,3,5,5,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,5,1,4,3,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Disagree,Agree,Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,7,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,4,5,1,3,7,Somewhat Agree,Somewhat Agree,Agree,Agree,Strongly agree,4,3,5,2,1,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,1,5,3,2,FALSE,91,FALSE,52,TRUE,87,FALSE,54,TRUE,97,FALSE,51,TRUE,98,TRUE,56,TRUE,53,TRUE,99,FALSE,51,TRUE,96,TRUE,99,FALSE,52,TRUE,50,TRUE,100,FALSE,51,TRUE,53,TRUE,83,FALSE,55,TRUE,53,TRUE,100,TRUE,75,TRUE,96,FALSE,91,TRUE,51,FALSE,51,TRUE,50,TRUE,79,TRUE,71,FALSE,50,TRUE,74,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,3,1,3,1,-3,3,-3,0,1,0,2,1,3,-1,-1,0,1,0,0,2,2,1,3,7,1,-3,2,-2,2,7,1,-1,2,1,2,5,1,1,1,1,0,7,-2,2,2,3,3,7,0,2,0,1,-1,7,1,1,2,2,3,7,-1,0,0,0,-2,7,FALSE,1,91,FALSE,0,52,TRUE,0,87,FALSE,1,54,TRUE,1,97,FALSE,1,51,TRUE,1,98,TRUE,1,56,TRUE,1,53,TRUE,1,99,FALSE,1,51,TRUE,0,96,TRUE,1,99,FALSE,1,52,TRUE,1,50,TRUE,1,100,FALSE,1,51,TRUE,0,53,TRUE,0,83,FALSE,1,55,TRUE,1,53,TRUE,1,100,TRUE,0,75,TRUE,1,96,FALSE,1,91,TRUE,1,51,FALSE,1,51,TRUE,0,50,TRUE,0,79,TRUE,1,71,FALSE,0,50,TRUE,1,74,0.1936,0.2401,0,0.0004,0.0676,0.2401,0.0016,0.0001,0.2025,0,0.0841,0.0001,0.2209,0.2401,0.0009,0.2704,0.5625,0.2116,0.25,0.0081,0.2209,0.25,0.6889,0.2304,0.2401,0.2401,0.25,0.0081,0.7569,0.2809,0.6241,0.9216,0.252592857,0.150178571,0.355007143,24,75,23,71.88,5,62.5,6,75,7,87.5,5,62.5,14,87.5,9,56.25,70.91,55.5,72.38,79.38,76.38,74.94,66.88,3.12,-0.97,-7,-2.62,-8.12,13.88,-12.56,10.63,1,0,1,0,0,0,0,1,1,2,0,1,0,0,1,2,2,1,0,0,1,0,1,2,0,1,5,3,4,1,0,1,0,1,0,0,1,0,1,2,0.4,0.8,0.4,1,0.8,2.8,0.4,0.8,0.65,1.2,0.925,6.33,7,6.75,-0.4,-2,0,0.2,-0.8,0,0,-2,0,-0.67,2,2,2,0,0,2,-2,1,-1,-1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,42,,0.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,02DGEN,01DIR,7,3,2,9,8,5,4,1,6,2,4,3,1 +695,R_1uZoR76C6abtr4B,32 - 38,,Canadian,Canadian,Prefer not to say,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,3,1,5,2,Disagree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,2,3,1,4,5,Somewhat Agree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Agree,4,2,5,1,3,Disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,Somewhat disagree,5,3,4,2,1,Somewhat disagree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,1,4,5,2,3,4,Somewhat disagree,Agree,Somewhat disagree,Agree,Neither agree nor disagree,4,3,1,2,5,5,Somewhat Agree,Strongly Disagree,Strongly Agree,Disagree,Agree,3,5,4,2,1,2,Neither agree nor disagree,Somewhat disagree,Disagree,Disagree,Disagree,1,2,3,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,4,1,5,3,7,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,5,1,3,2,4,6,Somewhat Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,4,3,2,5,1,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,3,4,2,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,93,FALSE,70,FALSE,100,TRUE,60,TRUE,95,FALSE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,70,FALSE,60,TRUE,100,TRUE,90,FALSE,100,TRUE,59,FALSE,55,TRUE,70,FALSE,100,FALSE,56,FALSE,53,TRUE,76,TRUE,100,FALSE,100,TRUE,88,FALSE,100,TRUE,93,FALSE,51,FALSE,57,FALSE,95,TRUE,80,FALSE,62,TRUE,90,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,2,1,0,-1,-2,1,-1,2,-1,1,-3,3,-1,2,-2,-1,-1,-3,-1,-1,3,3,1,-1,4,-1,2,-1,2,0,5,1,-3,3,-2,2,2,0,-1,-2,-2,-2,5,1,3,0,0,-1,7,-1,2,-1,1,0,6,1,-3,3,-2,3,1,-1,-1,-1,0,-1,3,TRUE,0,93,FALSE,0,70,FALSE,1,100,TRUE,0,60,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,70,FALSE,1,60,TRUE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,59,FALSE,0,55,TRUE,0,70,FALSE,1,100,FALSE,1,56,FALSE,1,53,TRUE,1,76,TRUE,1,100,FALSE,1,100,TRUE,1,88,FALSE,1,100,TRUE,1,93,FALSE,1,51,FALSE,1,57,FALSE,1,95,TRUE,1,80,FALSE,0,62,TRUE,1,90,0,0.0049,0.3025,0,0.01,0,0.0144,0.09,0.2209,0,0.04,0.01,0.01,0.16,0.0025,0.49,0,0.36,0.1849,0,0.0576,0.1681,0.1936,0,0.49,0.2401,0.3844,0.8649,0,0,0.0025,1,0.178353571,0.100557143,0.25615,17,53.13,25,78.13,5,62.5,7,87.5,7,87.5,6,75,13,81.25,12,75,81.66,63.5,89.5,94.5,79.12,82.38,80.94,-25,3.53,1,2,7,4.12,1.13,5.94,1,1,2,1,0,1,1,0,0,1,0,0,0,1,0,2,0,1,1,1,1,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,3,0,1,0.6,0.2,1,0.6,0.8,0.4,0.8,0.7,0.65,0.675,3.67,4.67,4.125,0.4,-0.2,-0.2,0.2,0,-3,-1,1,2,-1,1,2,2,-2,2,1,-1,-1,1,-2,2,1,10 cents,5 minutes,47 days,Prefer not to say,University - Undergraduate,35,,1.25,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,8,9,6,4,5,7,2,1,3,4,2,3,1 +696,R_59nVyrToJ79uzG8,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,5,2,3,1,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,4,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,2,1,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Agree,5,4,3,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,3,5,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Agree,Agree,Agree,3,5,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,3,1,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,90,TRUE,95,TRUE,95,FALSE,75,TRUE,50,TRUE,50,FALSE,95,TRUE,50,FALSE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,75,TRUE,50,TRUE,75,TRUE,70,TRUE,95,TRUE,75,TRUE,95,TRUE,50,TRUE,95,TRUE,50,TRUE,95,TRUE,95,FALSE,100,TRUE,100,TRUE,50,FALSE,75,TRUE,95,FALSE,100,20,1,2,0,0,1,0,-1,0,0,0,0,0,0,0,0,-1,-1,0,0,-1,2,2,2,2,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,2,3,2,2,2,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,3,FALSE,1,100,TRUE,1,95,FALSE,1,75,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,95,TRUE,1,50,TRUE,1,95,TRUE,0,50,TRUE,0,95,TRUE,1,75,TRUE,0,95,TRUE,1,70,TRUE,1,75,TRUE,0,50,TRUE,0,75,TRUE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,FALSE,1,95,TRUE,1,50,TRUE,0,50,FALSE,1,75,TRUE,0,95,TRUE,1,95,FALSE,0,90,TRUE,1,85,0.0025,0.25,0.0625,0.0025,0.0225,0,0.25,0.0025,0.25,0.25,0.0025,0.0625,0.25,0.25,0,0.0025,0,0.25,0.0625,0.0025,0.25,0.09,0.25,0.9025,0.25,0.25,0.81,0,0.0625,0.5625,0.9025,0.9025,0.246071429,0.11375,0.378392857,20,62.5,21,65.63,3,37.5,5,62.5,6,75,7,87.5,14,87.5,7,43.75,75.78,63.12,81.88,81.88,76.25,76.25,75.31,-3.13,10.15,25.62,19.38,6.88,-11.25,-11.25,31.56,1,0,2,2,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,2,2,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1.2,0.2,0,0.6,1.4,0.2,0,0.6,0.5,0.55,0.525,5,5,4.75,-0.2,0,0,0,-0.066666667,0,0,0,2,0,1,1,1,-1,1,1,-1,1,-1,-1,1,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),33,,0.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,3,8,6,5,4,2,9,1,7,2,3,4,1 +697,R_7gXzr1kaUlmsUSt,46 - 52,American,,American,Male,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,5,3,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,1,5,2,4,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,4,3,2,5,Agree,Agree,Agree,Somewhat agree,Agree,1,2,4,5,3,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,5,4,1,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,2,1,5,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,2,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Somewhat agree,4,5,1,2,3,0,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,1,3,5,4,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,1,Disagree,Disagree,Disagree,Disagree,Agree,1,3,2,5,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,83,TRUE,84,FALSE,59,TRUE,80,FALSE,77,TRUE,91,TRUE,91,TRUE,91,FALSE,100,FALSE,87,TRUE,93,TRUE,100,FALSE,74,TRUE,83,TRUE,100,FALSE,96,FALSE,100,FALSE,86,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,88,TRUE,100,FALSE,76,FALSE,100,TRUE,94,TRUE,100,TRUE,90,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,1,1,-1,1,1,-1,1,1,1,2,1,1,-1,-1,-1,1,-1,2,2,2,1,2,1,-1,0,1,-1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,2,2,2,2,1,0,-2,1,0,1,0,6,1,1,1,1,1,1,-2,-2,-2,-2,2,9,FALSE,1,100,TRUE,1,83,TRUE,0,84,FALSE,1,59,TRUE,1,80,FALSE,1,77,TRUE,1,91,TRUE,1,91,TRUE,1,91,FALSE,0,100,FALSE,1,87,TRUE,0,93,TRUE,1,100,FALSE,1,74,TRUE,1,83,TRUE,1,100,FALSE,1,96,FALSE,1,100,FALSE,1,86,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,88,TRUE,1,100,FALSE,1,76,FALSE,1,100,TRUE,0,94,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.0081,0,0,0.0081,0,0.0529,0,1,0,0,0,0,0.0081,0.0169,0.04,0.0289,0,0.1681,0,0.7744,0,0.0289,0.0196,0.0676,0.0016,0.0576,0.01,0,0.7056,0,0.8836,0.8649,0.168882143,0.093921429,0.243842857,27,84.38,27,84.38,8,100,7,87.5,6,75,6,75,15,93.75,12,75,91.34,81.88,93.38,94.12,96,94.31,88.38,0,6.96,-18.12,5.88,19.12,21,0.56,13.38,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,2,2,2,0,2,0,0,0,1,0,1,0,1,2,1,0,0,1,0,0,1,1,1,3,3,0.2,0.4,0.2,1.6,0.2,1,0.2,1.8,0.6,0.8,0.7,0.67,2.33,2.25,0,-0.6,0,-0.2,-0.2,1,-5,-1,-9,-1.66,1,0,1,0,0,1,-1,0,0,-1,1,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),51,,0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,8,5,4,7,9,2,6,1,3,2,3,4,1 +698,R_5IXegawSCFWVBBL,53 - 59,American,,American,Male,Somewhat disagree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,3,2,1,5,Agree,Disagree,Disagree,Disagree,Agree,1,3,4,5,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,3,2,4,Agree,Agree,Agree,Agree,Somewhat agree,1,2,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Somewhat agree,2,1,3,4,5,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,5,1,4,3,2,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,3,5,2,1,4,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Agree,Agree,Somewhat agree,Somewhat agree,5,1,4,2,3,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,2,4,3,5,5,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,3,5,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,86,TRUE,100,FALSE,100,TRUE,50,TRUE,54,TRUE,50,FALSE,57,FALSE,100,TRUE,54,TRUE,100,TRUE,58,TRUE,100,TRUE,58,TRUE,79,FALSE,100,TRUE,68,FALSE,100,TRUE,57,TRUE,57,TRUE,100,TRUE,100,FALSE,58,TRUE,52,TRUE,50,TRUE,54,TRUE,100,TRUE,100,21,-1,2,3,0,1,2,-2,-2,-2,2,1,0,2,0,1,2,2,2,2,1,0,2,2,0,1,7,1,0,1,-1,2,7,1,0,1,1,0,4,1,1,1,1,1,6,-1,2,2,1,1,5,1,-1,0,-1,1,5,1,-1,1,0,1,5,1,1,1,1,1,5,TRUE,0,100,TRUE,1,100,TRUE,0,54,TRUE,0,50,TRUE,1,52,FALSE,1,58,TRUE,1,100,TRUE,1,100,TRUE,1,57,TRUE,1,57,FALSE,1,100,TRUE,0,68,FALSE,0,100,TRUE,0,79,TRUE,1,58,TRUE,1,100,TRUE,0,58,TRUE,0,100,TRUE,0,54,FALSE,1,100,FALSE,0,57,TRUE,1,50,TRUE,0,54,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,0,86,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.1764,0.25,0.1849,0,0.25,0,1,0.1849,0,0.2304,0,0.2916,0.25,0,0,0.3249,0.1764,0.2916,0.6241,0.3364,0.7396,0,1,0.2916,1,1,0.4624,0.323757143,0.2013,0.446214286,21,65.63,19,59.38,5,62.5,3,37.5,5,62.5,6,75,14,87.5,5,31.25,79.44,75.62,72.38,85.75,84,80.06,78.81,6.25,20.06,13.12,34.88,23.25,9,-7.44,47.56,1,0,1,0,0,1,2,3,1,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,1,1,2,1,1,0,1,1,0,0,1,1,1,1,0,0.4,1.4,0.6,0.8,0.4,1.2,0.4,0.8,0.8,0.7,0.75,6,5,5.5,0,0.2,0.2,0,0.133333333,2,2,-1,1,1,2,2,1,-2,2,-1,1,-2,2,-2,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,57,it was fun,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,5,8,9,6,2,3,4,1,7,4,3,2,1 +699,R_3ozIW9Bv45r1Lyh,32 - 38,,Canadian,Canadian,Male,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Strongly agree,4,2,3,1,5,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,4,2,1,5,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,3,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,4,5,1,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,1,2,5,4,3,5,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,3,5,2,4,1,4,Neither Agree nor Disagree,Somewhat Disagree,Agree,Agree,Neither Agree nor Disagree,2,4,1,5,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,4,5,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Agree,Somewhat agree,Agree,1,2,3,4,5,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,3,5,1,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,4,1,2,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,4,2,5,1,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,64,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,65,FALSE,50,FALSE,50,TRUE,80,FALSE,50,FALSE,50,TRUE,75,FALSE,54,FALSE,73,FALSE,81,FALSE,50,FALSE,86,TRUE,75,FALSE,50,TRUE,68,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,68,FALSE,50,FALSE,50,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,1,0,3,-1,0,2,1,1,1,1,1,0,1,1,1,1,1,-1,-2,1,1,0,2,5,-1,1,1,0,2,4,0,-1,2,2,0,7,0,0,0,-1,1,6,0,3,2,1,2,2,0,1,1,1,0,3,1,1,1,0,1,2,1,1,1,2,0,3,FALSE,1,64,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,50,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,75,FALSE,1,54,FALSE,1,73,FALSE,1,81,FALSE,1,50,FALSE,0,86,TRUE,1,75,FALSE,1,50,TRUE,1,68,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,68,FALSE,0,50,FALSE,0,50,0.25,0.25,0.0625,0.25,0.25,0.25,0.1024,0.1225,0.25,0.0625,0.1024,0.04,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.7396,0.25,0.0361,0.25,0.2116,0.25,0.25,0.1296,0.25,0.0729,0.25,0.25,0.218557143,0.191414286,0.2457,3,9.38,22,68.75,4,50,5,62.5,6,75,7,87.5,6,37.5,16,100,57.47,53.88,58.75,59.62,57.62,60.44,54.5,-59.37,-11.28,3.88,-3.75,-15.38,-29.88,22.94,-45.5,1,1,0,0,1,0,1,1,1,1,1,2,1,2,1,1,1,1,2,2,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,1,1,0.6,0.8,1.4,1.4,1,0.8,0,0.4,1.05,0.55,0.8,5.33,2.33,4,-0.4,0,1.4,1,0.333333333,3,1,5,3,3,-1,0,1,-1,1,0,0,0,0,1,-1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,Tricky questions but interesting,0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,2,7,8,3,6,4,5,1,9,4,2,3,1 +700,R_6YX2sTgwzQSA3lu,53 - 59,American,,American,Male,Disagree,Strongly agree,Strongly agree,Agree,Agree,2,5,4,3,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,3,4,5,1,2,Strongly Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,2,1,3,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,3,2,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,3,2,4,1,5,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,5,1,2,3,0,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,5,1,3,2,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,4,2,5,1,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,5,4,3,2,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,3,4,1,2,5,0,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,2,1,4,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,100,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,90,TRUE,100,TRUE,70,FALSE,50,TRUE,100,FALSE,100,TRUE,99,TRUE,61,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,3,2,2,-3,-3,3,-3,-1,3,-2,3,-3,3,-3,-3,-3,-3,-3,3,3,3,-3,3,0,-3,-3,3,-3,-3,0,3,-3,3,-3,3,0,1,1,1,1,-3,7,-3,3,3,3,-3,0,-3,-3,3,-3,-3,0,3,-3,3,-3,3,0,-3,-3,-3,-3,-3,5,TRUE,0,70,TRUE,1,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,1,70,FALSE,0,50,TRUE,0,100,FALSE,1,100,TRUE,0,99,TRUE,0,61,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0.25,0,0,0.25,0,0,0.3721,0,0,0.01,0.25,0.25,0.25,0,1,0.25,0.25,0.25,0.25,0.09,0.9801,1,1,0.25,0,0.49,1,0,1,1,0.364007143,0.188007143,0.540007143,20,62.5,18,56.25,5,62.5,3,37.5,6,75,4,50,12,75,6,37.5,80.94,71.12,80,90,82.62,85,76.88,6.25,24.69,8.62,42.5,15,32.62,10,39.38,5,0,0,5,1,0,0,0,0,2,0,1,0,0,0,4,4,4,4,0,1,0,0,1,5,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,2.2,0.4,0.2,3.2,1.4,0.4,0.2,0,1.5,0.5,1,0,0,1.5,0.8,0,0,3.2,0.266666667,0,0,0,2,0,0,2,2,-2,2,-1,1,-2,2,-2,2,-2,10 cents,5 minutes,24 days,Male,High School (or equivalent),57,,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,2,3,9,8,4,5,7,1,6,3,4,2,1 +701,R_7tx5RrfukbAwIJr,46 - 52,American,,American,Male,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Strongly disagree,4,3,5,2,1,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,5,4,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,5,3,Agree,Agree,Agree,Agree,Agree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Disagree,Agree,Agree,Neither agree nor disagree,Disagree,3,2,1,4,5,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,0,Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,3,4,2,5,1,0,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,1,2,3,5,0,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,0,Agree,Agree,Agree,Agree,Neither Agree nor Disagree,5,3,2,4,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,100,TRUE,75,TRUE,51,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,56,FALSE,100,FALSE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,13,0,2,1,1,-3,1,0,2,0,1,3,3,3,3,3,2,2,2,2,2,-2,2,2,0,-2,0,0,0,2,0,0,0,2,2,1,2,1,0,2,2,2,2,0,0,0,0,0,0,-1,0,2,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,50,FALSE,0,50,FALSE,0,100,FALSE,1,56,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,100,TRUE,1,51,TRUE,0,75,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,0,100,TRUE,1,100,1,1,1,0,0,1,0.2401,0,0.25,0.25,1,0,0,0.25,0.25,0,1,1,1,0.5625,0.25,0.25,0,0.25,0.1936,0.25,1,1,1,1,0.25,1,0.473078571,0.374292857,0.571864286,13,40.63,12,37.5,4,50,4,50,2,25,2,25,7,43.75,5,31.25,82.25,81.25,75.75,84.38,87.62,84.44,80.06,3.13,44.75,31.25,25.75,59.38,62.62,40.69,48.81,2,0,1,1,1,1,0,0,0,1,1,1,2,1,2,0,0,0,0,2,0,2,1,1,2,1,0,2,0,1,1,1,1,1,3,2,2,2,2,2,1,0.4,1.4,0.4,1.2,0.8,1.4,2,0.8,1.35,1.075,0,0,0,-0.2,-0.4,0,-1.6,-0.2,0,0,0,0,0,2,2,0,-2,2,2,-2,2,-2,2,-2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),48,This has been a fun and interesting survey.,0,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,8,2,4,6,5,3,9,1,7,3,2,4,1 +702,R_5sGDbJBH9foLL7X,39 - 45,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,1,3,4,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,1,2,3,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,3,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,4,3,2,1,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,4,5,3,5,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,5,1,2,2,Somewhat agree,Somewhat agree,Disagree,Disagree,Agree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,5,2,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,2,3,1,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,5,3,1,2,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,3,4,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,73,TRUE,100,TRUE,100,FALSE,90,TRUE,50,TRUE,100,FALSE,73,TRUE,91,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,73,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,25,3,3,3,3,3,0,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,2,3,3,3,0,3,5,1,-3,3,-3,3,5,3,-3,3,-3,3,5,1,1,-2,-2,2,2,3,3,3,3,3,0,0,-3,3,-3,3,0,3,-3,3,-3,3,0,3,3,3,3,-3,0,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,73,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,91,FALSE,1,73,TRUE,1,100,TRUE,0,50,FALSE,1,90,TRUE,0,100,TRUE,1,100,TRUE,1,73,TRUE,1,100,0,0,0,0,0,0,0.0081,0,1,0,0,0,0,1,0,0,1,1,0.01,0.0729,0,0.0729,1,1,1,0.25,0.0729,1,1,1,1,1,0.445957143,0.286292857,0.605621429,25,78.13,19,59.38,4,50,5,62.5,5,62.5,5,62.5,16,100,3,18.75,95.31,87,100,96.62,97.62,96.06,94.56,18.75,35.93,37,37.5,34.12,35.12,-3.94,75.81,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,2,2,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0.6,0.2,0,2.8,0,0,0,1,0.9,0.25,0.575,5,0,2.125,0.6,0.2,0,1.8,0.266666667,5,5,5,2,5,2,2,2,-2,2,-2,2,-2,2,-2,2,2,5 cents,5 minutes,24 days,Male,High School (or equivalent),44,It was interesting,2,1,1,0,0,0,1,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,6,7,2,8,9,3,5,1,4,3,4,2,1 +703,R_1rpsJJpEBZlalKj,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,4,5,1,2,Agree,Agree,Strongly agree,Strongly disagree,Strongly agree,1,4,5,3,2,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,3,1,5,4,Agree,Strongly Agree,Strongly Agree,Agree,Agree,2,1,5,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,3,4,2,9,Agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,1,5,2,4,3,10,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,2,1,4,5,10,Agree,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,2,5,4,1,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,5,3,1,4,10,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,3,1,4,5,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,1,4,2,3,5,9,Agree,Strongly Agree,Agree,Strongly Agree,Agree,3,4,5,2,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,83,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,94,FALSE,51,FALSE,51,FALSE,50,FALSE,51,TRUE,94,TRUE,100,FALSE,50,FALSE,100,FALSE,86,FALSE,75,TRUE,98,TRUE,95,FALSE,100,TRUE,100,FALSE,91,TRUE,97,FALSE,96,FALSE,94,FALSE,97,FALSE,96,FALSE,99,TRUE,97,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,3,2,2,3,-3,3,2,3,3,3,2,2,3,3,2,2,3,3,3,2,3,9,2,1,3,-3,3,10,3,2,3,2,3,10,2,3,3,2,-1,10,3,3,3,2,3,10,3,3,2,-3,2,10,3,3,3,2,2,9,2,3,2,3,2,10,TRUE,0,83,FALSE,0,50,TRUE,0,100,TRUE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,94,FALSE,1,51,FALSE,1,51,FALSE,0,50,FALSE,1,51,TRUE,1,94,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,86,FALSE,1,75,TRUE,1,98,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,1,97,FALSE,1,96,FALSE,1,94,FALSE,1,97,FALSE,0,96,FALSE,0,99,TRUE,1,97,0,0.0009,0,0,0.0009,0.25,0,0.0036,0.0625,0.0025,0.9216,0.25,0,0.2401,0.25,0.25,0,1,0.0036,0.0081,0.0004,0.0036,0.0196,0.2401,0.25,0.0016,0.9801,0.6889,1,0,0.0009,0.2401,0.23815,0.2308,0.2455,28,87.5,24,75,5,62.5,6,75,7,87.5,6,75,11,68.75,13,81.25,84.22,84.5,74,88.88,89.5,88.75,79.69,12.5,9.22,22,-1,1.38,14.5,20,-1.56,0,0,0,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,0,3,0,0,0,1,0,1,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0.2,0.2,0.8,0.6,0.2,0.8,0.4,0.4,0.45,0.45,0.45,9.67,9.67,9.75,0,-0.6,0.4,0.2,-0.066666667,-1,0,1,0,0,2,2,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),42,Honestly it was catch my eye.,1.875,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,2,7,5,9,8,3,6,1,4,3,2,4,1 +704,R_1L0iPBv1CXiyvPF,53 - 59,American,,American,Male,Agree,Agree,Agree,Agree,Disagree,4,2,5,3,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Disagree,4,5,3,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,4,1,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Somewhat disagree,3,2,4,5,1,3,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,1,5,2,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,1,5,4,3,Disagree,Disagree,Disagree,Disagree,Disagree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,4,2,1,3,3,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,2,3,5,4,1,2,Agree,Agree,Agree,Somewhat Disagree,Agree,3,1,2,5,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,55,TRUE,96,TRUE,89,FALSE,89,FALSE,57,TRUE,100,FALSE,95,TRUE,95,TRUE,79,TRUE,97,FALSE,62,FALSE,83,FALSE,57,TRUE,99,TRUE,90,TRUE,99,FALSE,62,FALSE,77,TRUE,90,FALSE,100,FALSE,76,TRUE,65,TRUE,91,TRUE,93,TRUE,98,FALSE,77,TRUE,71,TRUE,73,TRUE,99,TRUE,97,FALSE,81,25,2,2,2,2,-2,-1,-1,1,-2,-2,1,1,1,0,1,-2,-1,-1,-1,-3,2,2,2,2,-1,3,-2,-2,1,-2,0,3,1,1,1,1,1,3,-2,-2,-2,-2,-2,3,2,2,2,2,0,3,0,-2,2,-2,0,3,2,2,2,-1,2,2,1,1,1,1,0,3,FALSE,1,81,TRUE,1,97,TRUE,0,99,TRUE,0,73,TRUE,1,71,FALSE,1,77,TRUE,1,98,TRUE,1,93,TRUE,1,91,TRUE,1,65,FALSE,1,76,FALSE,1,100,TRUE,1,90,FALSE,1,77,FALSE,0,62,TRUE,1,99,TRUE,0,90,TRUE,0,99,FALSE,1,57,FALSE,1,83,FALSE,0,62,TRUE,1,97,TRUE,0,79,TRUE,1,95,FALSE,1,95,TRUE,1,100,FALSE,1,57,FALSE,1,89,TRUE,0,89,TRUE,1,96,FALSE,0,55,TRUE,1,100,0.0049,0,0.0001,0.0004,0,0.0529,0.0025,0.1225,0.0289,0.0009,0.0016,0.01,0.0081,0.0576,0.0841,0.0009,0.6241,0.5329,0.0121,0.0025,0.3844,0.3844,0.1849,0.0529,0.81,0.1849,0.3025,0.0361,0.9801,0.9801,0.7921,0,0.236928571,0.109071429,0.364785714,25,78.13,23,71.88,5,62.5,4,50,7,87.5,7,87.5,13,81.25,10,62.5,84.12,71,82.25,89,94.25,85.69,82.56,6.25,12.24,8.5,32.25,1.5,6.75,4.44,20.06,0,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,1,1,1,1,0,0,0,0,2,1,1,1,0,2,1,1,1,1,1,3,2,2,2,3,0.2,0.8,0.2,0.8,0.4,1,1,2.4,0.5,1.2,0.85,3,2.67,2.875,-0.2,-0.2,-0.8,-1.6,-0.4,0,0,1,0,0.33,1,1,0,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,I have nothing to say,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,4,9,2,7,8,3,6,1,5,2,3,4,1 +705,R_1ILfv5LW2t6taE3,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Agree,Agree,Agree,Strongly disagree,5,1,4,2,3,Strongly disagree,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,4,2,1,3,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,2,1,Disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat agree,3,5,4,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,4,1,5,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,4,2,3,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Strongly disagree,3,2,5,4,1,7,Strongly disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,5,4,1,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,5,3,4,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,95,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,95,TRUE,91,TRUE,100,TRUE,93,TRUE,94,TRUE,91,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,90,TRUE,100,TRUE,94,TRUE,63,FALSE,50,TRUE,100,TRUE,75,TRUE,88,TRUE,57,FALSE,100,TRUE,90,TRUE,90,TRUE,90,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,2,-3,-3,-3,0,-1,0,1,2,2,0,1,-2,0,-1,-2,1,1,1,1,1,-3,7,0,0,0,0,0,6,1,1,1,1,1,6,1,0,1,0,0,7,1,3,2,1,-3,7,-3,-3,0,0,0,1,1,1,2,0,0,9,0,0,0,0,0,7,FALSE,1,95,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,91,TRUE,1,100,TRUE,0,93,TRUE,0,94,TRUE,1,91,TRUE,0,100,TRUE,1,50,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,90,TRUE,0,100,TRUE,1,94,TRUE,1,63,FALSE,1,50,TRUE,1,100,TRUE,0,75,TRUE,1,88,TRUE,0,57,FALSE,1,100,TRUE,0,90,TRUE,1,90,TRUE,1,90,TRUE,1,100,0.0025,0.0144,0,0,0,0,0,0,1,0.1369,0.01,0.0081,0.0081,0.8649,0,0,0.25,0.25,0,0.5625,0.0036,0.25,0.81,1,0.25,0.3249,0.01,0.0025,1,1,0.81,0.8836,0.336967857,0.180571429,0.493364286,22,68.75,20,62.5,4,50,6,75,5,62.5,5,62.5,16,100,4,25,87.38,77.62,84.38,90.12,97.38,90.75,84,6.25,24.88,27.62,9.38,27.62,34.88,-9.25,59,0,1,1,1,0,3,3,0,1,0,0,1,1,1,0,3,0,2,2,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,1,2,0,1,2,1,0.6,1.4,0.6,1.6,0.4,0.2,0.4,1.2,1.05,0.55,0.8,6.33,5.67,6.25,0.2,1.2,0.2,0.4,0.533333333,0,5,-3,0,0.66,1,2,2,1,-1,0,0,0,0,-2,2,1,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,37,No feedback,0.875,0,0,0,1,0,0,0,0.33,02PsVLPf,02COC,02FUT,01ITEM,01DIR,8,9,7,6,3,2,5,1,4,3,2,4,1 +706,R_1xKnFWKG19g38RR,25 - 31,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,5,1,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,2,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,3,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,3,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,3,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,32,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.535714286,0.285714286,0.785714286,32,100,17,53.13,4,50,5,62.5,4,50,4,50,16,100,1,6.25,100,100,100,100,100,100,100,46.87,46.87,50,37.5,50,50,0,93.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,2,2,2,2,-2,2,-2,2,-2,2,-2,2,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,28,It’s a good survey I like it.,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,5,6,8,7,3,2,9,1,4,3,2,4,1 +707,R_6CUhgLMp2tRMApz,32 - 38,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Disagree,5,2,4,3,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,3,1,2,4,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,2,1,4,5,3,Disagree,Disagree,Disagree,Somewhat disagree,Strongly disagree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,3,4,2,5,1,3,Disagree,Disagree,Disagree,Disagree,Disagree,2,3,5,4,1,2,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,1,4,3,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Disagree,3,2,1,4,5,4,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Disagree,3,2,5,1,4,7,Strongly agree,Neither Agree nor Disagree,Agree,Strongly agree,Strongly agree,3,1,4,5,2,2,Disagree,Disagree,Disagree,Disagree,Strongly disagree,3,4,5,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,66,TRUE,81,TRUE,71,TRUE,100,TRUE,50,TRUE,61,FALSE,100,TRUE,100,TRUE,50,TRUE,76,TRUE,100,FALSE,50,TRUE,60,TRUE,100,TRUE,50,TRUE,100,TRUE,70,FALSE,51,TRUE,100,TRUE,100,TRUE,51,TRUE,55,TRUE,54,TRUE,74,TRUE,51,TRUE,55,TRUE,52,TRUE,52,FALSE,64,TRUE,56,TRUE,81,10,2,3,3,3,-2,-1,0,0,1,1,3,1,2,3,3,-2,-2,-2,-1,-3,-2,3,3,3,-2,2,-2,-2,-2,-2,-2,3,0,-3,0,0,0,2,2,3,2,2,3,3,1,3,2,3,-2,2,0,1,2,1,-2,4,3,0,2,3,3,7,-2,-2,-2,-2,-3,2,TRUE,0,81,TRUE,1,56,FALSE,1,64,TRUE,0,52,TRUE,1,52,TRUE,0,55,TRUE,1,51,TRUE,1,74,TRUE,1,54,TRUE,1,55,TRUE,0,51,TRUE,0,100,TRUE,1,100,FALSE,1,51,TRUE,1,70,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,60,FALSE,1,50,TRUE,1,100,TRUE,1,76,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,61,TRUE,0,50,TRUE,0,100,TRUE,0,71,TRUE,1,81,FALSE,0,66,TRUE,1,100,0.0676,0.1521,0,0.2401,0,0.3025,0,0.2025,0.25,0.0576,0.0361,0,0.2116,0.2601,0.2304,0.1936,0.25,0.2704,1,0,0,0.09,0.36,0.2401,0.25,0.25,0.4356,0.6561,0.1296,1,0.5041,1,0.292153571,0.161771429,0.422535714,10,31.25,19,59.38,3,37.5,4,50,6,75,6,75,15,93.75,4,25,71.28,57.38,72.25,71.88,83.62,74.75,67.81,-28.13,11.9,19.88,22.25,-3.12,8.62,-19,42.81,4,0,0,0,0,1,2,2,3,3,3,4,2,3,3,4,5,4,3,6,1,0,1,0,0,1,1,2,0,3,0,1,0,0,0,0,0,0,1,0,0.8,2.2,3,4.4,0.4,1.4,0.2,0.2,2.6,0.55,1.575,2.33,4.33,3.125,0.4,0.8,2.8,4.2,1.333333333,0,-1,-5,1,-2,-2,2,2,-2,2,-1,1,-2,2,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,32,slider needs to be more user friendly.. its annoying,1.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,4,3,7,9,2,5,8,1,6,2,3,4,1 +708,R_1o6n2BEn75fNXkS,53 - 59,American,,American,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,1,5,4,3,2,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,1,5,3,2,4,Strongly Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,5,4,1,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,5,2,3,1,4,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,5,2,4,3,1,7,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,3,5,4,1,2,6,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,4,5,3,2,1,6,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,2,4,3,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,4,5,1,3,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,2,Strongly Agree,Somewhat Agree,Agree,Agree,Agree,5,1,2,4,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,56,FALSE,50,TRUE,100,FALSE,50,TRUE,63,FALSE,96,TRUE,91,TRUE,100,TRUE,96,FALSE,77,FALSE,96,TRUE,97,TRUE,50,TRUE,80,FALSE,54,TRUE,90,FALSE,59,FALSE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,77,FALSE,100,FALSE,71,TRUE,91,TRUE,100,FALSE,62,FALSE,70,FALSE,55,TRUE,98,FALSE,58,TRUE,99,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,0,2,3,-2,3,-2,3,3,2,1,0,2,2,3,3,3,2,1,3,3,-3,0,7,2,0,2,-1,2,6,2,2,2,1,1,6,-1,1,1,1,-1,7,2,3,3,2,3,5,3,-3,3,-3,3,2,3,1,2,2,2,2,3,3,3,3,3,3,TRUE,0,56,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,63,FALSE,1,96,TRUE,1,91,TRUE,1,100,TRUE,1,96,FALSE,0,77,FALSE,1,96,TRUE,0,97,TRUE,1,50,TRUE,0,80,FALSE,0,54,TRUE,1,90,FALSE,1,59,FALSE,1,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,FALSE,0,77,FALSE,1,100,FALSE,0,71,TRUE,0,91,TRUE,1,100,FALSE,1,62,FALSE,1,70,FALSE,1,55,TRUE,1,98,FALSE,0,58,TRUE,1,99,0,0,0.01,0.0081,0.0001,0.0016,0.5041,0.5929,0,0.5929,0.0004,0.25,0.0016,0.0016,0.1369,0.25,0,0.25,0.09,0.8281,0,0.2916,0.25,0.64,0.1681,0.1444,0.3364,0.3136,1,0,0.2025,0.9409,0.278132143,0.184435714,0.371828571,23,71.88,21,65.63,5,62.5,8,100,3,37.5,5,62.5,10,62.5,11,68.75,79.25,64.5,77.75,84,90.75,79.62,78.88,6.25,13.62,2,-22.25,46.5,28.25,17.12,10.13,1,0,0,3,2,1,2,1,1,1,1,0,1,1,1,3,2,2,2,3,2,0,0,2,1,0,1,0,1,0,0,1,1,2,0,1,0,0,0,1,1.2,1.2,0.8,2.4,1,0.4,0.8,0.4,1.4,0.65,1.025,6.33,3,4.75,0.2,0.8,0,2,0.333333333,2,4,4,4,3.33,2,1,1,-2,2,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,had fun doing this survey,0.75,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,4,2,7,8,3,9,5,1,6,4,2,3,1 +709,R_5M02t0GA7k6Eymg,39 - 45,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,3,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat agree,1,5,2,3,4,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,5,4,3,2,1,Agree,Somewhat agree,Agree,Somewhat agree,Disagree,4,2,5,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,4,2,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,2,5,1,7,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,2,1,4,5,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,1,2,3,5,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,5,4,3,1,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,8,Agree,Agree,Agree,Agree,Agree,1,5,2,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,81,FALSE,82,FALSE,80,TRUE,50,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,82,FALSE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,79,TRUE,81,FALSE,100,FALSE,73,TRUE,100,FALSE,71,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,80,TRUE,100,FALSE,50,TRUE,100,TRUE,79,TRUE,100,TRUE,100,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,1,0,1,-2,1,1,3,3,1,1,2,1,2,1,-2,3,3,3,3,3,2,1,1,1,1,1,6,1,1,1,1,1,7,1,1,2,2,1,3,3,3,3,3,3,5,2,0,3,0,3,5,3,3,3,3,3,8,2,2,2,2,2,5,TRUE,0,81,FALSE,0,82,FALSE,1,80,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,82,FALSE,0,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,79,TRUE,1,81,FALSE,0,100,FALSE,1,73,TRUE,0,100,FALSE,1,71,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,79,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,1,0,0,0,0,1,0,0,0,0,0.0324,0.25,0.25,0.6724,0,0.25,1,0.04,1,0.0361,0.0841,0.0441,0.0729,0.25,0,0.6561,0.04,1,0.6241,1,0.296507143,0.175342857,0.417671429,26,81.25,22,68.75,6,75,6,75,5,62.5,5,62.5,12,75,10,62.5,87.12,70.75,87.75,92.5,97.5,93.44,80.81,12.5,18.37,-4.25,12.75,30,35,18.44,18.31,0,0,0,0,0,0,1,0,3,0,0,2,2,0,0,1,0,0,1,3,0,0,0,0,0,1,0,2,2,2,2,0,0,2,2,0,1,0,1,4,0,0.8,0.8,1,0,1.4,1.2,1.2,0.65,0.95,0.8,5,6,5.125,0,-0.6,-0.4,-0.2,-0.333333333,-3,1,-1,-2,-1,1,2,1,-1,1,2,-2,1,-1,1,-1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,43,Thank you,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,9,5,6,3,8,2,4,1,7,4,2,3,1 +710,R_1xwnkrmdgUDTVa9,39 - 45,American,,American,Male,Strongly agree,Agree,Strongly agree,Somewhat agree,Strongly agree,2,1,3,5,4,Somewhat disagree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,5,2,3,1,4,Somewhat Agree,Somewhat Disagree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,Somewhat agree,Somewhat agree,Strongly Agree,Somewhat agree,Agree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Agree,Strongly Agree,Strongly Agree,Agree,3,4,5,2,1,8,Strongly agree,Agree,Somewhat agree,Agree,Agree,4,1,2,5,3,8,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,7,Agree,Agree,Agree,Strongly Agree,Agree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,1,2,4,3,8,Agree,Somewhat agree,Somewhat agree,Agree,Strongly agree,2,3,1,4,5,9,Strongly agree,Agree,Somewhat Agree,Agree,Strongly agree,4,3,2,1,5,8,Strongly Agree,Agree,Somewhat agree,Strongly Agree,Agree,1,2,5,4,3,FALSE,100,TRUE,98,FALSE,100,FALSE,79,TRUE,95,FALSE,100,TRUE,100,TRUE,100,FALSE,93,TRUE,100,FALSE,90,FALSE,84,FALSE,81,FALSE,100,TRUE,100,TRUE,100,TRUE,50,FALSE,70,TRUE,89,FALSE,98,FALSE,91,TRUE,80,TRUE,86,TRUE,100,TRUE,86,FALSE,80,TRUE,100,FALSE,72,TRUE,86,FALSE,93,TRUE,82,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,1,3,-1,3,3,1,-1,1,-1,3,3,3,1,1,3,1,2,0,2,3,3,2,4,3,2,1,2,2,8,2,1,3,0,2,8,2,2,2,3,2,7,2,2,3,3,1,7,2,1,1,2,3,8,3,2,1,2,3,9,3,2,1,3,2,8,FALSE,1,100,TRUE,1,98,FALSE,1,100,FALSE,1,79,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,93,TRUE,1,100,FALSE,1,90,FALSE,1,84,FALSE,0,81,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,70,TRUE,0,89,FALSE,1,98,FALSE,0,91,TRUE,1,80,TRUE,0,86,TRUE,1,100,TRUE,0,86,FALSE,0,80,TRUE,0,100,FALSE,1,72,TRUE,0,86,FALSE,0,93,TRUE,1,82,TRUE,1,100,0,0.64,0,0,0,0,0,0,0.0004,0.04,0.8649,0.6561,0.8649,0.01,0.0025,0.0004,0.7396,0.0441,0.0784,0.7396,0.8281,0,0.7921,0,0.25,1,0.0324,0,0,0.09,0.7396,0.0256,0.278525,0.230207143,0.326842857,23,71.88,21,65.63,5,62.5,3,37.5,6,75,7,87.5,11,68.75,10,62.5,90.09,91.38,86.12,89.5,93.38,93.31,86.88,6.25,24.46,28.88,48.62,14.5,5.88,24.56,24.38,3,0,0,2,1,4,1,2,1,3,1,2,0,3,1,1,1,1,2,0,1,0,0,2,2,3,2,2,1,4,2,3,2,1,0,2,1,2,2,0,1.2,2.2,1.4,1,1,2.4,1.6,1.4,1.45,1.6,1.525,6.67,8,7.375,0.2,-0.2,-0.2,-0.4,-0.066666667,-3,0,-1,-1,-1.33,2,-1,1,0,0,-1,1,1,-1,1,-1,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,The survey was engaging and covered a good range of topics,0.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,9,7,6,8,3,5,2,1,4,4,2,3,1 +711,R_7YzQfRm2q7nhZW9,39 - 45,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,2,3,1,5,4,Disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,2,4,1,3,Somewhat Agree,Strongly Disagree,Somewhat Agree,Somewhat Disagree,Strongly Agree,1,5,3,2,4,Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,4,3,2,5,1,3,Strongly disagree,Somewhat agree,Somewhat disagree,Disagree,Agree,4,3,2,5,1,6,Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Agree,2,1,5,3,4,3,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,5,1,3,2,4,3,Strongly disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,4,1,2,3,5,3,Somewhat Agree,Strongly Disagree,Agree,Disagree,Strongly agree,2,1,4,5,3,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,50,TRUE,74,TRUE,93,FALSE,54,TRUE,63,TRUE,81,TRUE,75,TRUE,93,FALSE,100,TRUE,94,FALSE,78,FALSE,100,TRUE,65,TRUE,98,FALSE,96,TRUE,100,FALSE,65,FALSE,100,TRUE,100,TRUE,89,FALSE,60,TRUE,96,TRUE,91,TRUE,99,FALSE,62,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,95,24,3,3,3,-3,3,-2,1,2,0,1,1,-3,1,-1,3,2,2,3,3,2,3,3,3,-3,3,3,-3,1,-1,-2,2,3,2,-1,-1,-1,2,6,2,3,3,2,3,3,3,3,3,-3,3,2,-3,1,2,0,2,3,1,-3,2,-2,3,3,3,2,3,3,2,2,FALSE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,FALSE,0,62,TRUE,1,99,TRUE,1,91,TRUE,1,96,FALSE,1,60,TRUE,0,89,TRUE,1,100,FALSE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,96,TRUE,0,98,TRUE,0,65,FALSE,1,100,FALSE,0,78,TRUE,1,94,FALSE,1,100,TRUE,1,93,TRUE,0,75,TRUE,1,81,TRUE,0,63,FALSE,1,54,TRUE,0,93,TRUE,1,74,FALSE,0,50,TRUE,1,95,0.0001,0.0361,0,0.3844,0.0025,0,0.0049,0.0016,0,0.0036,0.0676,0,0.0081,0.16,0,0,0,0.25,0.2116,0.5625,0.6084,0.4225,0.4225,0,0.0016,0.3969,0.25,0.0025,0,0.9604,0.8649,0.7921,0.214078571,0.035592857,0.392564286,24,75,22,68.75,4,50,6,75,5,62.5,7,87.5,12,75,10,62.5,84.88,68,95.25,87.62,88.62,86.12,83.62,6.25,16.13,18,20.25,25.12,1.12,11.12,21.12,0,0,0,0,0,1,0,3,2,1,1,2,2,0,1,0,1,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1.4,1.2,0.6,0,0.4,0.4,0.2,0.8,0.25,0.525,4,2.67,3.125,0,1,0.8,0.4,0.6,1,0,3,1,1.33,2,2,2,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),39,,1.625,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,5,3,9,4,2,8,7,1,6,4,3,2,1 +712,R_5obSekahAU98dbX,25 - 31,,Canadian,Canadian,Male,Agree,Agree,Somewhat disagree,Somewhat agree,Agree,5,2,4,3,1,Agree,Somewhat agree,Agree,Disagree,Somewhat agree,2,4,5,1,3,Disagree,Strongly Agree,Agree,Somewhat Agree,Disagree,5,1,2,3,4,Disagree,Disagree,Somewhat disagree,Disagree,Disagree,4,5,3,1,2,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,2,5,3,4,5,Agree,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,2,1,4,5,3,4,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,3,Agree,Somewhat agree,Somewhat agree,Disagree,Agree,5,4,2,1,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,1,4,2,3,5,2,Strongly agree,Somewhat disagree,Agree,Strongly disagree,Somewhat disagree,3,4,1,5,2,1,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,Strongly Disagree,5,4,1,3,2,0,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat disagree,1,5,3,2,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,89,TRUE,90,TRUE,100,FALSE,85,TRUE,84,FALSE,76,TRUE,100,TRUE,86,TRUE,66,TRUE,71,FALSE,80,FALSE,75,TRUE,96,FALSE,96,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,66,FALSE,88,FALSE,75,TRUE,100,FALSE,100,TRUE,85,FALSE,90,TRUE,86,TRUE,50,FALSE,91,FALSE,90,FALSE,80,FALSE,91,TRUE,80,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,-1,1,2,2,1,2,-2,1,-2,3,2,1,-2,-2,-2,-1,-2,-2,3,1,1,1,2,5,2,-1,-2,1,1,4,2,-1,1,1,1,3,2,1,1,-2,2,7,2,1,-1,1,2,2,3,-1,2,-3,-1,1,1,3,1,2,-3,0,1,1,2,2,-1,5,TRUE,0,89,TRUE,1,90,TRUE,0,100,FALSE,1,85,TRUE,1,84,FALSE,1,76,TRUE,1,100,TRUE,1,86,TRUE,1,66,TRUE,1,71,FALSE,1,80,FALSE,1,75,TRUE,1,96,FALSE,1,96,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,66,FALSE,1,88,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,85,FALSE,1,90,TRUE,1,86,TRUE,0,50,FALSE,1,91,FALSE,1,90,FALSE,0,80,FALSE,0,91,TRUE,1,80,0.0196,0.0196,0,0,0.04,0.0576,0.0225,0.0841,0.0144,0,0.64,0.0016,0.1156,0.04,0.0256,0.01,0,0.0225,0.0081,0.01,0.5625,1,0.4356,0.0016,0.25,0.25,0.8281,0.7921,1,1,0.01,0.0625,0.260157143,0.076707143,0.443607143,25,78.13,23,71.88,4,50,7,87.5,6,75,6,75,12,75,11,68.75,84.88,78.5,81.38,91.5,88.12,86.88,82.88,6.25,13,28.5,-6.12,16.5,13.12,11.88,14.13,1,1,2,0,0,0,2,4,3,0,4,4,1,0,3,4,3,2,0,4,0,1,0,0,0,1,2,0,1,2,3,0,1,1,1,3,3,3,4,1,0.8,1.8,2.4,2.6,0.2,1.2,1.2,2.8,1.9,1.35,1.625,4,1,3.375,0.6,0.6,1.2,-0.2,0.8,3,3,3,2,3,-1,1,1,1,-1,1,-1,2,-2,1,-1,-2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),28,"Could have used a bit more information on the dollar question, and I would have enjoyed more avenues to express why I feel things in my life have changed, and to have an opportunity to attribute it to my choices, government policy, outside pressures, etc. Overall an interesting and engaging survey.",-0.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,01DIR,7,8,4,5,2,9,3,1,6,2,4,3,1 +713,R_7Z0VCH5qavegU2R,25 - 31,,Canadian,Canadian,Male,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat disagree,Agree,4,3,1,5,2,Somewhat disagree,Somewhat agree,Disagree,Agree,Somewhat agree,4,3,2,5,1,Strongly Disagree,Disagree,Strongly Agree,Agree,Agree,3,2,5,1,4,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat disagree,Strongly disagree,5,4,1,3,2,Strongly disagree,Strongly Agree,Strongly disagree,Strongly disagree,Disagree,4,3,5,1,2,9,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,2,5,3,1,4,7,Somewhat Agree,Strongly Disagree,Disagree,Agree,Strongly Disagree,3,1,5,4,2,8,Strongly disagree,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,4,1,5,2,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Neither agree nor disagree,Agree,Agree,4,3,2,5,1,8,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,2,1,5,4,4,Somewhat Disagree,Strongly Disagree,Agree,Disagree,Somewhat Agree,1,4,3,5,2,6,Somewhat agree,Agree,Agree,Somewhat agree,Disagree,2,4,5,3,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,54,FALSE,56,TRUE,74,TRUE,100,TRUE,91,FALSE,65,TRUE,76,TRUE,70,TRUE,100,TRUE,100,FALSE,100,TRUE,59,TRUE,100,TRUE,53,TRUE,97,TRUE,86,FALSE,53,TRUE,52,TRUE,100,FALSE,100,TRUE,82,TRUE,54,TRUE,100,FALSE,51,FALSE,100,TRUE,87,TRUE,100,FALSE,52,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,1,-1,2,-1,1,-2,2,1,-3,-2,3,2,2,0,-1,-2,-1,-3,-3,3,-3,-3,-2,9,-3,3,-3,3,-3,7,1,-3,-2,2,-3,8,-3,-1,-3,-2,-3,8,1,3,0,2,2,8,-2,-1,1,-1,0,4,-1,-3,2,-2,1,6,1,2,2,1,-2,7,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,54,FALSE,0,56,TRUE,0,74,TRUE,1,100,TRUE,1,91,FALSE,0,65,TRUE,1,76,TRUE,0,70,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,TRUE,0,53,TRUE,0,97,TRUE,0,86,FALSE,1,53,TRUE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,82,TRUE,0,54,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,87,TRUE,1,100,FALSE,0,52,TRUE,1,100,0.0081,0,0,0,0,0.5476,0.0324,0.0576,0.2209,0,0,0,0.4225,0.49,0.3136,0,0,0.2916,0,0.2916,0.2304,0.1681,0.7396,0,0.2809,0.2401,0.2704,1,1,0.9409,0.7569,1,0.331967857,0.169728571,0.494207143,25,78.13,18,56.25,3,37.5,4,50,5,62.5,6,75,13,81.25,5,31.25,81.62,67.12,77.75,90.88,90.75,83.31,79.94,21.88,25.37,29.62,27.75,28.38,15.75,2.06,48.69,2,0,4,2,4,2,2,1,1,4,4,1,5,0,5,3,0,1,1,0,2,0,1,3,0,1,2,3,3,1,2,1,1,4,1,1,3,4,2,1,2.4,2,3,1,1.2,2,1.8,2.2,2.1,1.8,1.95,8,6,7.125,1.2,0,1.2,-1.2,0.8,1,3,2,1,2,1,2,1,-2,2,2,-2,-1,1,-2,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,28,It was fun! I've unemployed for the last five months and my mental health has been fickle at best. This survey definitely helped with my perspective on my life,1,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,5,8,6,7,3,4,9,1,2,2,4,3,1 +714,R_1OTP4KVeTkcmHWa,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Strongly agree,Agree,Neither agree nor disagree,1,5,3,2,4,Agree,Somewhat agree,Agree,Agree,Agree,4,2,5,3,1,Agree,Agree,Agree,Agree,Agree,5,3,2,4,1,Agree,Somewhat agree,Agree,Agree,Agree,4,2,3,5,1,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,1,2,3,4,5,7,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,3,1,2,4,5,6,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,4,1,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,1,4,3,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Agree,Agree,2,4,1,3,5,7,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,4,2,3,1,7,Agree,Agree,Somewhat Agree,Agree,Agree,3,5,2,1,4,7,Agree,Somewhat agree,Agree,Agree,Agree,5,3,4,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,84,TRUE,100,TRUE,100,FALSE,70,FALSE,100,TRUE,100,TRUE,81,TRUE,77,TRUE,100,FALSE,100,TRUE,100,FALSE,78,FALSE,67,TRUE,85,TRUE,98,FALSE,100,TRUE,67,FALSE,72,TRUE,73,TRUE,78,FALSE,80,TRUE,77,TRUE,83,FALSE,83,TRUE,83,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,2,0,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,1,2,1,1,2,7,2,1,1,-1,2,6,1,2,1,1,1,7,1,1,1,2,2,7,1,2,2,2,2,7,1,1,2,1,1,7,2,2,1,2,2,7,2,1,2,2,2,7,TRUE,0,100,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,TRUE,1,100,FALSE,1,70,FALSE,1,100,TRUE,1,100,TRUE,0,81,TRUE,1,77,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,78,FALSE,1,67,TRUE,1,85,TRUE,1,98,FALSE,1,100,TRUE,1,67,FALSE,1,72,TRUE,1,73,TRUE,0,78,FALSE,1,80,TRUE,0,77,TRUE,1,83,FALSE,0,83,TRUE,1,83,0.0256,0.0729,0,0,0.0289,0,0.1089,0,0.1089,0.0004,0.0289,0,0,0.09,0,0.25,0,0.25,0.04,0.0784,0.0225,0.0529,0.0484,0.6561,0,0.6084,0.6889,1,1,1,0.5929,0,0.237660714,0.061857143,0.413464286,23,71.88,24,75,5,62.5,7,87.5,5,62.5,7,87.5,15,93.75,9,56.25,85.5,73.25,93.12,90.5,85.12,86.44,84.56,-3.12,10.5,10.75,5.62,28,-2.38,-7.31,28.31,1,0,2,1,2,0,0,1,3,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,2,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1.2,0.8,0.8,0.4,0.8,0.6,0.2,0,0.8,0.4,0.6,6.67,7,6.875,0.4,0.2,0.6,0.4,0.4,0,-1,0,0,-0.33,1,1,1,-1,1,0,0,0,0,1,-1,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,38,,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,6,9,2,8,5,4,3,1,7,4,2,3,1 +715,R_7qg4gPN4iucazxe,53 - 59,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,4,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,1,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,5,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,3,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,2,5,3,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,4,1,2,3,1,Somewhat agree,Strongly disagree,Strongly agree,Somewhat agree,Agree,3,1,2,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,4,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,4,2,3,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,85,TRUE,100,TRUE,100,FALSE,100,FALSE,90,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,87,FALSE,67,FALSE,92,TRUE,100,FALSE,76,TRUE,100,FALSE,76,FALSE,91,TRUE,100,TRUE,100,FALSE,91,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,94,FALSE,61,FALSE,59,TRUE,100,TRUE,100,FALSE,68,25,1,3,3,3,3,0,3,3,3,3,3,3,3,3,3,-3,-3,-3,-3,-3,3,3,3,3,3,1,3,3,3,3,3,4,3,3,3,3,3,1,0,0,0,0,-3,10,1,3,3,3,1,1,1,-3,3,1,2,1,3,3,3,3,3,1,3,3,3,3,-3,8,FALSE,1,68,TRUE,1,100,TRUE,0,100,FALSE,1,59,FALSE,0,61,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,91,TRUE,0,100,TRUE,1,100,FALSE,1,91,FALSE,0,76,TRUE,1,100,FALSE,1,76,TRUE,0,100,FALSE,1,92,FALSE,1,67,FALSE,0,87,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,85,TRUE,1,100,0,0,0,0,0,0.0036,0,1,0.1089,0,0,0,0,0.0081,0.3721,0,0,0.1681,0,0,0.7569,0.5776,0.0064,0.0081,0.0576,0.01,0.7225,0.1024,1,1,1,1,0.282225,0.118628571,0.445821429,25,78.13,23,71.88,6,75,5,62.5,6,75,6,75,11,68.75,12,75,91.78,86.62,89.75,94.88,95.88,94.31,89.25,6.25,19.9,11.62,27.25,19.88,20.88,25.56,14.25,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,2,1,6,0,2,1,0,0,0,0,0,6,6,6,6,0,0.4,0.6,0,2.4,0.4,2,0,4.8,0.85,1.8,1.325,2,1,3.375,0,-1.4,0,-2.4,-0.466666667,0,3,0,2,1,1,0,2,-2,2,0,0,2,-2,-2,2,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,,0.875,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,7,9,6,2,4,3,5,1,8,4,3,2,1 +716,R_6cjwQtHPkI4LZLd,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,1,5,2,4,3,Somewhat agree,Strongly agree,Agree,Agree,Somewhat agree,3,1,2,4,5,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,1,2,4,3,5,Strongly Agree,Somewhat agree,Agree,Agree,Agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Agree,Somewhat agree,Agree,Agree,3,4,1,2,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,4,1,2,5,8,Somewhat Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,1,3,4,5,2,7,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Agree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,2,4,5,3,8,Agree,Agree,Somewhat agree,Strongly agree,Somewhat agree,2,4,1,5,3,8,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,3,4,2,1,5,8,Strongly Agree,Somewhat agree,Agree,Agree,Somewhat agree,5,3,2,4,1,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,74,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,2,3,1,3,2,2,1,2,3,2,3,1,3,1,2,2,2,1,2,1,2,2,7,1,1,1,2,2,8,1,1,3,3,2,8,1,3,2,3,2,7,1,2,3,3,1,8,2,2,1,3,1,8,1,1,2,1,3,8,3,1,2,2,1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,74,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0.25,0,0.25,0,0,0.0676,0,0,0,0,0,0,0,1,0.25,0,0,0,0,1,0,1,1,0,0,1,1,1,1,0.305985714,0.111971429,0.5,27,84.38,23,71.88,6,75,5,62.5,6,75,6,75,15,93.75,8,50,94.5,93.75,93.75,93.75,96.75,96.88,92.12,12.5,22.62,18.75,31.25,18.75,21.75,3.13,42.12,0,1,1,0,1,0,2,1,0,1,1,2,1,0,1,2,2,0,1,0,0,1,1,1,2,1,1,1,1,0,1,2,0,2,2,0,0,0,0,1,0.6,0.8,1,1,1,0.8,1.4,0.2,0.85,0.85,0.85,7.67,8,7.75,-0.4,0,-0.4,0.8,-0.266666667,-1,0,0,-1,-0.33,2,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,29,This was intriguing.,1.625,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,7,8,2,3,9,5,4,1,6,3,4,2,1 +717,R_65ZVP5XDElZvCWG,25 - 31,,Canadian,Canadian,Male,Agree,Agree,Somewhat agree,Somewhat agree,Agree,5,4,2,3,1,Agree,Agree,Somewhat agree,Somewhat agree,Agree,4,5,3,2,1,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,3,4,1,2,5,Agree,Agree,Agree,Agree,Somewhat agree,3,5,2,1,4,Agree,Agree,Somewhat agree,Strongly Agree,Somewhat agree,3,2,4,5,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,5,2,3,1,4,8,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,4,2,1,5,3,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,4,2,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Strongly Agree,Neither agree nor disagree,Agree,3,2,1,4,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,5,1,2,3,8,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,2,4,1,5,8,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,2,3,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,71,TRUE,83,TRUE,73,TRUE,67,TRUE,85,FALSE,84,TRUE,76,FALSE,84,FALSE,80,TRUE,85,FALSE,73,TRUE,78,FALSE,74,TRUE,93,TRUE,89,TRUE,85,TRUE,91,FALSE,73,TRUE,90,TRUE,86,FALSE,83,FALSE,88,FALSE,83,TRUE,83,TRUE,81,FALSE,76,TRUE,79,FALSE,81,FALSE,93,TRUE,89,FALSE,74,FALSE,90,16,2,2,1,1,2,2,2,1,1,2,1,1,2,1,1,2,2,2,2,1,2,2,1,3,1,8,1,1,1,2,0,8,1,1,2,2,1,8,1,1,1,2,2,8,1,2,3,0,2,7,1,1,1,0,1,8,1,1,2,2,1,8,2,1,1,1,2,8,FALSE,1,90,FALSE,0,74,TRUE,0,89,FALSE,1,93,FALSE,0,81,TRUE,0,79,FALSE,0,76,TRUE,1,81,TRUE,1,83,FALSE,0,83,FALSE,1,88,FALSE,1,83,TRUE,1,86,TRUE,0,90,FALSE,0,73,TRUE,1,91,TRUE,0,85,TRUE,0,89,TRUE,0,93,FALSE,1,74,TRUE,1,78,FALSE,0,73,TRUE,0,85,FALSE,0,80,FALSE,1,84,TRUE,1,76,FALSE,1,84,TRUE,0,85,TRUE,0,67,TRUE,1,73,TRUE,1,83,FALSE,0,71,0.0361,0.0576,0.0081,0.5776,0.5041,0.6241,0.64,0.6889,0.0676,0.5329,0.0729,0.0196,0.0289,0.0144,0.6561,0.5476,0.7225,0.0049,0.7225,0.0256,0.0484,0.5329,0.8649,0.81,0.7225,0.0256,0.0289,0.01,0.7921,0.7921,0.4489,0.0289,0.392064286,0.366035714,0.418092857,16,50,15,46.88,5,62.5,2,25,3,37.5,5,62.5,8,50,7,43.75,81.88,83.88,79,82.62,82,78.88,84.88,3.12,35,21.38,54,45.12,19.5,28.88,41.13,0,0,0,2,1,1,1,0,1,2,0,0,0,1,0,1,1,1,0,1,1,0,2,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,1,0.6,1,0.2,0.8,0.8,0.8,0.2,0.8,0.65,0.65,0.65,8,7.67,7.875,-0.2,0.2,0,0,-3.7E-17,1,0,0,0,0.33,0,1,1,0,0,1,-1,1,-1,1,-1,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),27,Nice Survey,0,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,3,7,6,2,4,5,9,1,8,4,2,3,1 +718,R_5RG0avAu55kmmoV,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Agree,Agree,Strongly agree,2,4,3,1,5,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,4,2,1,3,5,Agree,Somewhat Disagree,Strongly Agree,Agree,Somewhat Agree,2,5,3,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,3,2,5,1,4,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Agree,5,3,2,1,4,7,Agree,Neither agree nor disagree,Somewhat disagree,Agree,Strongly agree,5,4,1,2,3,7,Somewhat Disagree,Strongly Disagree,Neither Agree nor Disagree,Disagree,Strongly Agree,1,4,3,2,5,5,Disagree,Disagree,Disagree,Disagree,Disagree,3,1,5,4,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,3,1,5,6,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,3,2,1,4,5,Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Agree,2,4,5,3,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,TRUE,56,TRUE,58,FALSE,54,FALSE,76,FALSE,68,FALSE,63,FALSE,65,TRUE,72,FALSE,71,FALSE,76,FALSE,91,FALSE,92,TRUE,90,TRUE,95,FALSE,92,TRUE,92,TRUE,80,TRUE,85,TRUE,83,TRUE,100,FALSE,96,TRUE,99,FALSE,98,TRUE,98,TRUE,93,TRUE,82,FALSE,57,TRUE,56,TRUE,97,FALSE,58,TRUE,75,11,2,2,2,2,3,0,-2,3,-2,2,2,-1,3,2,1,3,3,3,1,1,2,3,0,3,2,7,2,0,-1,2,3,7,-1,-3,0,-2,3,5,-2,-2,-2,-2,-2,10,3,3,3,3,3,6,0,-3,3,-3,1,5,2,0,3,2,2,5,3,3,3,3,3,5,TRUE,0,75,FALSE,0,58,TRUE,0,97,TRUE,0,56,FALSE,0,57,TRUE,0,82,TRUE,1,93,TRUE,1,98,FALSE,0,98,TRUE,1,99,FALSE,1,96,TRUE,0,100,TRUE,1,83,TRUE,0,85,TRUE,1,80,TRUE,1,92,FALSE,1,92,TRUE,0,95,TRUE,0,90,FALSE,1,92,FALSE,0,91,FALSE,0,76,FALSE,1,71,TRUE,1,72,FALSE,1,65,FALSE,0,63,FALSE,1,68,FALSE,1,76,FALSE,1,54,TRUE,1,58,TRUE,1,56,TRUE,1,91,0.0004,0.3969,0.0064,0.0049,0.0081,0.6724,0.0784,0.0001,0.0064,0.5776,0.1764,0.0289,0.9604,0.0016,0.3249,0.3364,0.0841,0.3136,0.0576,0.1225,0.8281,0.04,0.81,0.7225,0.0064,0.1024,0.1936,0.5625,0.9409,0.9025,0.2116,1,0.359639286,0.25495,0.464328571,11,34.38,18,56.25,4,50,5,62.5,3,37.5,6,75,10,62.5,8,50,79.97,75.25,77.62,81.38,85.62,79.06,80.88,-21.87,23.72,25.25,15.12,43.88,10.62,16.56,30.88,0,1,2,1,1,2,2,4,4,1,3,2,3,4,2,5,5,5,3,3,1,1,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,2,2,1,2.6,2.8,4.2,0.8,0.6,0.4,0.8,2.65,0.65,1.65,6.33,5.33,6.25,0.2,2,2.4,3.4,1.533333333,1,2,0,5,1,1,2,2,-2,2,1,-1,0,0,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,,1,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,2,4,6,9,3,8,5,1,7,2,4,3,1 +719,R_7fek83LkP4smdCV,32 - 38,American,,American,Male,Agree,Agree,Agree,Agree,Agree,3,5,4,1,2,Agree,Agree,Agree,Agree,Agree,3,2,5,1,4,Agree,Agree,Agree,Agree,Agree,1,2,4,5,3,Agree,Agree,Agree,Agree,Agree,1,4,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Agree,Somewhat agree,Agree,Agree,2,5,4,3,1,8,Agree,Agree,Agree,Agree,Agree,3,1,5,2,4,9,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,4,1,3,2,5,8,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,2,4,5,3,1,8,Agree,Agree,Agree,Agree,Agree,3,2,4,5,1,9,Agree,Agree,Agree,Agree,Agree,2,1,5,4,3,8,Agree,Agree,Agree,Agree,Agree,3,5,4,2,1,TRUE,74,TRUE,75,TRUE,87,TRUE,79,TRUE,84,TRUE,76,TRUE,81,TRUE,79,TRUE,81,TRUE,80,TRUE,79,TRUE,77,TRUE,80,TRUE,77,TRUE,79,TRUE,80,TRUE,74,TRUE,81,TRUE,92,TRUE,70,TRUE,83,TRUE,75,TRUE,89,TRUE,72,TRUE,81,TRUE,78,FALSE,70,TRUE,65,FALSE,78,TRUE,71,TRUE,74,TRUE,82,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,7,2,2,2,2,2,8,2,2,2,1,1,9,1,2,2,2,1,8,2,2,2,2,2,8,2,2,2,2,2,8,2,2,2,2,2,9,2,2,2,2,2,8,TRUE,0,74,TRUE,1,75,TRUE,0,87,TRUE,0,79,TRUE,1,84,TRUE,0,76,TRUE,1,81,TRUE,1,79,TRUE,1,81,TRUE,1,80,TRUE,0,79,TRUE,0,77,TRUE,1,80,TRUE,0,77,TRUE,1,79,TRUE,1,80,TRUE,0,74,TRUE,0,81,TRUE,0,92,TRUE,0,70,TRUE,1,83,TRUE,1,75,TRUE,0,89,TRUE,1,72,TRUE,0,81,TRUE,1,78,FALSE,1,70,TRUE,0,65,FALSE,1,78,TRUE,1,71,TRUE,1,74,TRUE,1,82,0.0441,0.0484,0.04,0.0361,0.0324,0.5776,0.0784,0.04,0.49,0.0625,0.0841,0.04,0.0361,0.6241,0.0256,0.0625,0.7921,0.6241,0.4225,0.6561,0.0289,0.0441,0.8464,0.5929,0.5476,0.09,0.0676,0.5476,0.7569,0.6561,0.0484,0.5929,0.338125,0.254964286,0.421285714,19,59.38,18,56.25,5,62.5,5,62.5,4,50,4,50,16,100,2,12.5,78.22,78.62,80.75,78.38,75.12,78.38,78.06,3.13,21.97,16.12,18.25,28.38,25.12,-21.62,65.56,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.4,0,0.4,0.4,0,0,0,0,0.3,0,0.15,8,8.33,8.125,0.4,0,0.4,0.4,0.266666667,-1,0,0,0,-0.33,1,1,2,2,-2,1,-1,2,-2,1,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),34,Good one,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,8,7,2,9,5,4,6,1,3,3,4,2,1 +720,R_7wlVNalzLhBlkyZ,18 - 24,American,,American,Male,Agree,Strongly agree,Agree,Disagree,Agree,4,1,2,3,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,2,4,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,4,1,3,5,2,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Agree,4,1,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Disagree,Strongly Agree,Agree,Disagree,Agree,1,5,3,4,2,3,Agree,Disagree,Agree,Disagree,Agree,5,3,2,4,1,3,Agree,Agree,Agree,Disagree,Agree,4,3,1,5,2,5,Agree,Agree,Agree,Agree,Agree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Neither agree nor disagree,Agree,3,5,2,4,1,5,Agree,Disagree,Agree,Disagree,Somewhat agree,4,1,3,2,5,5,Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,1,3,5,2,4,3,Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,FALSE,76,FALSE,76,TRUE,83,TRUE,86,TRUE,75,TRUE,100,FALSE,100,TRUE,90,TRUE,100,FALSE,50,TRUE,75,FALSE,100,FALSE,50,TRUE,100,TRUE,80,TRUE,76,FALSE,70,TRUE,64,TRUE,97,TRUE,76,FALSE,100,TRUE,100,FALSE,64,TRUE,78,FALSE,50,FALSE,71,FALSE,50,TRUE,88,FALSE,94,FALSE,50,FALSE,98,12,2,3,2,-2,2,1,0,1,1,1,2,1,2,-1,2,1,2,3,1,2,-2,3,2,-2,2,6,2,-2,2,-2,2,3,2,2,2,-2,2,3,2,2,2,2,2,5,2,2,2,0,2,4,2,-2,2,-2,1,5,2,1,1,-2,1,5,2,2,2,2,2,3,FALSE,1,98,FALSE,0,50,FALSE,1,94,TRUE,0,88,FALSE,0,50,FALSE,1,71,FALSE,0,50,TRUE,1,78,FALSE,0,64,TRUE,1,100,FALSE,1,100,TRUE,0,76,TRUE,1,97,TRUE,0,64,FALSE,0,70,TRUE,1,76,TRUE,0,80,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,75,FALSE,0,50,TRUE,0,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,0,75,TRUE,0,86,TRUE,0,83,FALSE,0,76,FALSE,0,76,TRUE,1,90,0.0484,0,0.0576,0.25,0.01,0.0841,0.01,0,0,0.25,0.5776,0.0009,0.4096,0,0.25,0.25,1,0.7744,0.7396,0,0.0625,0.49,0.25,0.4096,0.64,0.5625,0.5776,0.0004,0.0036,1,0.6889,0.5776,0.343532143,0.258328571,0.428735714,12,37.5,15,46.88,2,25,4,50,4,50,5,62.5,8,50,7,43.75,79.91,71.62,80.75,82.75,84.5,74.5,85.31,-9.38,33.03,46.62,30.75,32.75,22,24.5,41.56,4,0,0,0,0,1,2,1,3,1,0,1,0,1,0,1,0,1,1,0,0,1,0,2,0,1,2,1,3,0,0,0,1,1,1,1,0,1,1,0,0.8,1.6,0.4,0.6,0.6,1.4,0.6,0.6,0.85,0.8,0.825,4,4.67,4.25,0.2,0.2,-0.2,0,0.066666667,2,-2,-2,2,-0.67,2,2,1,-1,1,1,-1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),23,it was a good survey,1.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,7,6,8,9,3,5,2,1,4,2,3,4,1 +721,R_3U1U4COkEtoP4Kl,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,Disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat disagree,2,3,1,4,5,Somewhat Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,2,4,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,5,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,5,2,4,3,1,5,Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,3,2,1,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,5,Strongly disagree,Strongly disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,2,4,1,5,5,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,4,5,3,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,1,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,66,TRUE,82,TRUE,100,TRUE,100,TRUE,70,TRUE,100,FALSE,100,TRUE,100,TRUE,71,TRUE,100,TRUE,76,FALSE,100,TRUE,76,TRUE,100,TRUE,100,TRUE,100,TRUE,73,FALSE,69,TRUE,73,TRUE,90,TRUE,68,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,87,TRUE,100,TRUE,73,TRUE,100,16,3,3,3,0,0,-2,-3,1,-2,-1,1,-3,3,0,2,0,0,0,0,0,3,3,3,0,0,5,-3,-3,0,-3,0,5,2,-3,3,0,2,5,0,0,0,0,0,5,3,3,3,0,0,5,-3,-3,1,-2,0,5,2,0,3,0,2,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,73,TRUE,0,100,FALSE,1,87,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,68,TRUE,0,90,TRUE,1,73,FALSE,1,69,TRUE,1,73,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,76,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,0,71,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,100,TRUE,1,82,FALSE,0,66,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0.0324,0.0729,0,0.4624,0,0.0729,0.5041,0.0169,1,0,0.0576,0.0729,0.5776,0.0961,1,0.49,0.4356,1,1,1,1,0.81,0.346478571,0.082971429,0.609985714,16,50,20,62.5,4,50,5,62.5,6,75,5,62.5,15,93.75,5,31.25,89.81,76.62,90,96.12,96.5,90.19,89.44,-12.5,27.31,26.62,27.5,21.12,34,-3.56,58.19,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,3,0,0,0,0,0,0,0,0,0,0.8,0.2,0,0,0.4,0.8,0,0.25,0.3,0.275,5,5,5,0,0.4,-0.6,0,-0.066666667,0,0,0,0,0,0,2,1,-2,2,1,-1,-1,1,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),25,very good survey,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,02REV,7,5,6,4,8,2,3,1,9,2,3,4,1 +722,R_1qvUo44vR7P53GI,53 - 59,American,,American,Male,Somewhat disagree,Agree,Agree,Somewhat agree,Agree,4,3,5,1,2,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,1,3,5,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,1,4,5,2,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,1,3,4,3,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,3,1,4,5,3,Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,4,3,1,2,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,5,2,3,4,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,2,4,5,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,3,1,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,4,1,5,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,97,TRUE,99,TRUE,50,TRUE,50,FALSE,100,TRUE,97,TRUE,97,TRUE,50,FALSE,100,TRUE,50,FALSE,50,TRUE,50,TRUE,62,TRUE,50,TRUE,50,FALSE,50,FALSE,99,TRUE,50,FALSE,100,TRUE,62,TRUE,50,FALSE,97,FALSE,50,TRUE,92,TRUE,77,FALSE,50,FALSE,72,TRUE,50,TRUE,62,FALSE,50,TRUE,98,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,2,1,2,-1,-2,1,-1,1,2,2,2,0,2,-1,-2,-1,-1,-1,-2,1,1,1,1,3,-2,-2,1,-2,0,3,2,2,1,-1,1,2,-1,-1,-1,-1,0,6,-2,1,1,1,1,5,-1,-1,2,0,0,2,2,2,2,0,2,5,0,0,0,0,-1,5,TRUE,0,96,TRUE,1,97,TRUE,0,99,TRUE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,97,TRUE,1,97,TRUE,1,50,FALSE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,62,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,99,TRUE,0,50,FALSE,1,100,TRUE,1,62,TRUE,1,50,FALSE,1,97,FALSE,0,50,TRUE,0,92,TRUE,1,77,FALSE,1,50,FALSE,1,72,TRUE,0,50,TRUE,1,62,FALSE,0,50,TRUE,1,98,0.0009,0.0529,0.25,0.0009,0.0004,0,0.25,1,0,0.25,0.1444,0.25,0.25,0.25,0.25,0.0009,0.0009,0.25,0.0784,0.8464,0.1444,0.25,0.25,0.3844,0.25,0.25,0.25,0.9216,0.9801,0.0001,0.25,0.25,0.285785714,0.2069,0.364671429,17,53.13,21,65.63,4,50,7,87.5,4,50,6,75,13,81.25,8,50,70.53,55.88,69.62,84.12,72.5,68.12,72.94,-12.5,4.9,5.88,-17.88,34.12,-2.5,-13.13,22.94,1,1,1,0,1,1,0,0,1,1,0,0,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,1,1,1,0,0,0,0,0,1,2,1,1,0,0.8,0.6,0.6,0.4,0.8,0.8,0,1,0.6,0.65,0.625,2.67,4,3.875,0,-0.2,0.6,-0.6,0.133333333,-2,1,-3,1,-1.33,1,1,2,-2,2,0,0,0,0,-2,2,1,10 cents,100 minutes,15 days,Male,High School (or equivalent),59,WAS FUN,1.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,9,6,4,3,8,7,2,1,5,3,4,2,1 +723,R_7wH4KDYIOiyWbXS,32 - 38,American,,American,Male,Neither agree nor disagree,Agree,Agree,Somewhat agree,Somewhat agree,3,4,2,5,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,3,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Somewhat Agree,4,1,5,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,1,2,3,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,5,2,3,1,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,1,4,2,5,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,5,2,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,2,3,1,5,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,3,1,4,2,5,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,90,TRUE,100,FALSE,75,FALSE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,100,FALSE,50,FALSE,75,FALSE,100,TRUE,75,TRUE,100,TRUE,100,FALSE,100,TRUE,75,TRUE,75,FALSE,75,FALSE,100,FALSE,75,FALSE,75,FALSE,100,FALSE,50,FALSE,50,FALSE,75,FALSE,50,TRUE,100,FALSE,100,24,0,2,2,1,1,0,0,1,-1,2,0,0,1,-2,1,1,1,1,1,0,0,1,1,-2,0,8,0,0,0,0,-1,5,1,1,0,-2,1,5,0,0,0,-1,0,7,0,1,1,1,0,5,0,-1,0,-1,1,3,1,1,1,-1,0,5,1,0,1,1,0,5,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,75,FALSE,0,50,FALSE,1,50,FALSE,0,100,FALSE,0,75,FALSE,0,75,FALSE,0,100,FALSE,1,75,TRUE,0,75,TRUE,1,75,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,100,FALSE,1,75,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,75,TRUE,1,100,TRUE,1,90,TRUE,1,100,0.5625,0,0,1,0,0.25,0.25,1,0.25,0,0,0.0625,0.5625,0.0625,0.25,0,0.25,0.0625,0,0,1,0,0.0625,0,0.5625,0.25,0.01,0,0.25,0,0.0625,0.5625,0.205714286,0.214285714,0.197142857,24,75,23,71.88,7,87.5,5,62.5,6,75,5,62.5,9,56.25,14,87.5,81.72,80,71.88,100,75,88.44,75,3.12,9.84,-7.5,9.38,25,12.5,32.19,-12.5,0,1,1,3,1,0,0,1,1,3,1,1,1,0,0,1,1,1,2,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,1,0,0,0,1.2,1,0.6,1,0.6,0.6,0.8,0.2,0.95,0.55,0.75,6,4.33,5.375,0.6,0.4,-0.2,0.8,0.266666667,3,2,0,2,1.67,1,0,1,-1,1,0,0,1,-1,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,36,I enjoyed taking this survey,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,7,8,2,9,3,6,5,1,4,3,2,4,1 +724,R_52DoAZyuOZpaNXC,46 - 52,American,,American,Male,Somewhat disagree,Strongly agree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,5,1,3,4,Disagree,Strongly disagree,Somewhat agree,Disagree,Strongly agree,5,3,2,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,3,4,2,5,Disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Strongly disagree,1,5,4,2,3,Disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Agree,1,2,3,4,5,0,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,2,4,3,1,5,4,Somewhat Disagree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,5,3,1,1,Strongly disagree,Somewhat disagree,Disagree,Disagree,Strongly disagree,4,2,1,5,3,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,4,3,2,1,5,3,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Agree,4,3,1,5,2,2,Somewhat Disagree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,1,4,5,0,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,4,3,5,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,84,FALSE,99,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,85,TRUE,100,FALSE,100,FALSE,61,TRUE,100,TRUE,70,TRUE,100,TRUE,86,FALSE,100,FALSE,100,TRUE,91,TRUE,50,FALSE,59,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,79,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,0,2,0,-2,-3,1,-2,3,0,0,3,-3,3,-2,-1,-2,0,-3,-2,3,0,3,2,0,-3,-3,1,-3,3,4,-1,1,3,-3,3,1,-3,-1,-2,-2,-3,1,1,3,0,2,0,3,-3,-3,2,-3,2,2,-1,-2,3,-3,3,0,-1,0,0,-1,-3,6,FALSE,1,100,TRUE,1,84,FALSE,1,99,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,100,FALSE,0,61,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,0,86,FALSE,1,100,FALSE,0,100,TRUE,1,91,TRUE,0,50,FALSE,0,59,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,79,TRUE,1,100,0,0,0,0,0,0,0.3481,0,0,0.0081,0,0,0.25,0,0.25,0.0256,0.25,0.25,1,1,1,0.3721,0.7396,0,0.49,0.25,0.0441,0,0.0001,1,1,0.7225,0.321435714,0.0987,0.544171429,25,78.13,20,62.5,6,75,3,37.5,6,75,5,62.5,12,75,8,50,86.38,70,83.75,98.88,92.88,85.88,86.88,15.63,23.88,-5,46.25,23.88,30.38,10.88,36.88,1,0,0,1,2,1,0,0,1,0,1,1,0,0,0,1,0,0,2,0,2,0,0,0,0,1,0,1,1,1,1,2,0,0,0,1,1,2,1,0,0.8,0.4,0.4,0.6,0.4,0.8,0.6,1,0.55,0.7,0.625,1.67,1.67,2.125,0.4,-0.4,-0.2,-0.4,-0.066666667,-3,2,1,-5,0,2,2,2,-2,2,-1,1,-2,2,-2,2,-2,10 cents,100 minutes,47 days,Male,University - Undergraduate,52,,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,8,9,7,2,5,3,6,1,4,4,3,2,1 +725,R_3EGhMJk2zWyGk3T,32 - 38,American,,American,Male,Agree,Agree,Strongly agree,Disagree,Somewhat disagree,3,1,2,4,5,Somewhat agree,Somewhat agree,Agree,Disagree,Agree,3,4,2,1,5,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,5,4,1,2,3,Agree,Agree,Strongly Agree,Somewhat agree,Agree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,3,2,5,4,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,4,2,5,1,5,Disagree,Strongly Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,2,1,4,3,5,8,Somewhat disagree,Strongly disagree,Disagree,Somewhat disagree,Somewhat disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat disagree,3,1,4,5,2,1,Agree,Agree,Strongly agree,Somewhat disagree,Agree,2,3,5,1,4,2,Strongly agree,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,3,4,2,1,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,2,3,TRUE,54,FALSE,72,TRUE,73,FALSE,85,TRUE,84,FALSE,100,TRUE,67,TRUE,73,FALSE,67,TRUE,68,TRUE,71,FALSE,79,TRUE,65,TRUE,71,FALSE,76,TRUE,60,FALSE,78,TRUE,71,FALSE,66,FALSE,100,FALSE,80,TRUE,76,TRUE,73,FALSE,73,FALSE,100,TRUE,100,FALSE,71,FALSE,80,TRUE,91,FALSE,77,FALSE,83,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,-2,-1,1,1,2,-2,2,1,3,2,1,0,2,2,3,1,2,2,3,3,-3,-3,10,1,1,1,1,2,5,-2,3,3,1,0,5,-1,-3,-2,-1,-1,8,2,3,3,0,-1,1,2,2,3,-1,2,1,3,3,3,2,0,2,3,3,3,3,3,1,TRUE,0,54,FALSE,0,72,TRUE,0,73,FALSE,1,85,TRUE,1,84,FALSE,1,100,TRUE,1,67,TRUE,1,73,FALSE,0,67,TRUE,1,68,TRUE,0,71,FALSE,1,79,TRUE,1,65,TRUE,0,71,FALSE,0,76,TRUE,1,60,FALSE,1,78,TRUE,0,71,FALSE,1,66,FALSE,1,100,FALSE,0,80,TRUE,1,76,TRUE,0,73,FALSE,0,73,FALSE,1,100,TRUE,1,100,FALSE,1,71,FALSE,1,80,TRUE,0,91,FALSE,0,77,FALSE,0,83,TRUE,1,100,0.0729,0,0.16,0.1089,0,0,0.5329,0.1024,0,0.0576,0.5929,0.1225,0.4489,0.5041,0.0256,0.5184,0.5329,0.0225,0.04,0,0.64,0.5776,0.1156,0.5041,0.0484,0.0841,0.6889,0.2916,0.5329,0.5041,0.8281,0.0441,0.298578571,0.247192857,0.349964286,22,68.75,18,56.25,3,37.5,5,62.5,5,62.5,5,62.5,9,56.25,9,56.25,77.62,73.88,83.88,75.88,76.88,76.31,78.94,12.5,21.37,36.38,21.38,13.38,14.38,20.06,22.69,0,1,0,1,2,0,0,1,3,0,3,0,1,0,0,3,5,5,2,3,0,1,0,2,0,1,1,1,1,0,2,0,1,1,0,1,1,0,2,1,0.8,0.8,0.8,3.6,0.6,0.8,0.8,1,1.5,0.8,1.15,6.67,1.33,4.125,0.2,0,0,2.6,0.066666667,9,4,3,7,5.34,1,2,1,-1,1,1,-1,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,9,2,6,3,5,8,4,1,7,2,3,4,1 +726,R_11zHvASS8qAPqBa,32 - 38,American,,American,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Agree,Strongly disagree,4,2,5,3,1,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,5,1,2,3,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,3,5,4,2,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,3,2,5,4,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,2,5,1,4,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,3,2,5,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,3,5,1,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,2,3,5,4,TRUE,80,FALSE,77,TRUE,74,TRUE,76,FALSE,75,TRUE,88,TRUE,82,FALSE,77,TRUE,77,TRUE,100,FALSE,81,TRUE,80,TRUE,79,FALSE,80,FALSE,76,TRUE,76,TRUE,80,TRUE,100,FALSE,80,TRUE,50,FALSE,50,TRUE,88,TRUE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,50,TRUE,100,FALSE,90,TRUE,100,FALSE,50,TRUE,100,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,2,-3,0,1,0,0,0,1,1,0,1,0,1,1,0,0,1,0,0,0,0,0,5,0,0,0,1,-1,5,1,1,0,1,0,5,1,0,0,1,0,5,0,1,1,0,-1,5,1,0,1,0,1,5,0,1,1,0,0,5,1,1,0,0,2,5,TRUE,0,80,FALSE,0,77,TRUE,0,74,TRUE,0,76,FALSE,0,75,TRUE,0,88,TRUE,1,82,FALSE,0,77,TRUE,1,77,TRUE,1,100,FALSE,1,81,TRUE,0,80,TRUE,1,79,FALSE,1,80,FALSE,0,76,TRUE,1,76,TRUE,0,80,TRUE,0,100,FALSE,1,80,TRUE,0,50,FALSE,0,50,TRUE,1,88,TRUE,0,50,TRUE,1,50,TRUE,0,100,FALSE,0,50,TRUE,0,50,TRUE,0,100,FALSE,1,90,TRUE,1,100,FALSE,0,50,TRUE,1,100,0.5929,0.25,0.0576,0.0324,0,0.7744,0.25,0,0.25,0.0144,0,0.0441,0.0529,0.0361,0.5625,0.5929,0.25,0.5776,1,1,0.25,0.5776,0.04,0.04,0.64,0.25,0.25,0.64,0.5476,1,0.01,0.64,0.367503571,0.243207143,0.4918,18,56.25,13,40.63,3,37.5,3,37.5,4,50,3,37.5,9,56.25,4,25,77.06,70.88,76.5,85,75.88,75.44,78.69,15.62,36.43,33.38,39,35,38.38,19.19,53.69,0,3,3,2,3,0,1,0,1,1,0,0,0,0,0,0,1,0,1,1,0,2,2,2,2,1,1,1,0,1,1,0,1,1,0,0,0,0,0,1,2.2,0.6,0,0.6,1.6,0.8,0.6,0.2,0.85,0.8,0.825,5,5,5,0.6,-0.2,-0.6,0.4,-0.066666667,0,0,0,0,0,1,2,0,2,-2,-1,1,0,0,1,-1,2,10 cents,25 minutes,24 days,Male,University - Undergraduate,33,,0.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,3,6,2,8,7,5,4,1,9,4,3,2,1 +727,R_31SgCoAYXD3306B,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,3,1,Agree,Disagree,Strongly agree,Disagree,Agree,4,2,1,3,5,Agree,Agree,Agree,Agree,Strongly Agree,3,5,2,1,4,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Disagree,Agree,Agree,Agree,Agree,1,3,5,4,2,9,Disagree,Somewhat disagree,Disagree,Agree,Disagree,3,5,4,2,1,9,Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,5,3,2,1,4,9,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,4,3,5,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,4,1,2,5,Agree,Strongly agree,Agree,Somewhat Agree,Strongly agree,4,5,1,3,2,10,Agree,Strongly Agree,Agree,Agree,Agree,3,1,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,72,TRUE,96,TRUE,75,TRUE,100,TRUE,50,TRUE,52,TRUE,60,TRUE,100,TRUE,60,TRUE,83,FALSE,58,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,64,FALSE,53,FALSE,100,21,3,3,3,3,3,2,-2,3,-2,2,2,2,2,2,3,0,-1,-1,-1,-1,-2,2,2,2,2,8,-2,-1,-2,2,-2,9,-2,-1,0,1,-2,9,-3,-3,-3,-3,-3,9,3,3,3,3,3,7,2,-3,3,-3,2,3,2,3,2,1,3,5,2,3,2,2,2,10,FALSE,1,100,FALSE,0,53,TRUE,0,64,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,58,TRUE,1,83,TRUE,0,60,TRUE,1,100,TRUE,0,60,TRUE,1,52,TRUE,0,50,TRUE,0,100,TRUE,0,75,TRUE,1,96,FALSE,0,72,FALSE,0,100,0,0.2304,0,0,1,0,0,0,0,0.0289,0.0016,1,0,0,0,0.2809,0.36,0,1,0.36,0.3364,1,0,0,0,0.25,0.5184,0,0.4096,0,0.5625,1,0.289582143,0.190814286,0.38835,21,65.63,19,59.38,4,50,3,37.5,7,87.5,5,62.5,10,62.5,9,56.25,88.22,84.38,86.62,86.88,95,88.38,88.06,6.25,28.84,34.38,49.12,-0.62,32.5,25.88,31.81,5,1,1,1,1,4,1,5,4,4,4,3,2,1,5,3,2,2,2,2,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,2,4,3,3,3,1.8,3.6,3,2.2,0,0.4,0.4,3,2.65,0.95,1.8,8.67,5,7.5,1.8,3.2,2.6,-0.8,2.533333333,1,6,4,-1,3.67,-1,2,1,-2,2,-1,1,-2,2,-2,2,2,5 cents,100 minutes,24 days,Male,University - Undergraduate,36,It was an entertaining survey.,1.375,1,0,0,0,1,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,9,6,2,7,8,4,1,3,2,4,3,1 +728,R_3k196ZmlVAouPwp,53 - 59,American,,American,Male,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,3,5,1,2,4,Disagree,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,3,2,5,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Agree,2,4,3,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,2,3,4,1,5,Somewhat disagree,Strongly Agree,Agree,Disagree,Neither agree nor disagree,2,4,5,1,3,5,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,4,3,2,1,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,3,4,5,1,2,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,4,1,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat disagree,Strongly Agree,Agree,4,1,3,2,5,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,5,3,1,1,Somewhat Agree,Strongly Agree,Strongly Agree,Disagree,Agree,1,3,2,5,4,1,Neither agree nor disagree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,1,5,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,75,FALSE,100,FALSE,75,TRUE,50,TRUE,92,FALSE,100,TRUE,80,FALSE,100,TRUE,85,FALSE,65,FALSE,100,FALSE,60,TRUE,95,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,100,FALSE,70,TRUE,100,FALSE,91,TRUE,100,TRUE,80,FALSE,100,TRUE,100,FALSE,50,FALSE,80,TRUE,100,FALSE,91,20,-1,3,1,3,1,-2,-2,1,1,0,0,3,3,0,2,0,1,1,2,-1,-1,3,2,-2,0,5,-2,1,0,-1,-1,6,1,0,1,2,0,6,-1,-1,1,-2,0,5,1,2,-1,3,2,3,-1,0,1,1,-1,1,1,3,3,-2,2,1,0,2,2,1,0,2,FALSE,1,91,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,0,91,TRUE,1,100,FALSE,1,70,FALSE,1,100,FALSE,0,50,TRUE,0,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,95,FALSE,1,60,FALSE,1,100,FALSE,0,65,TRUE,1,85,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,92,TRUE,0,50,FALSE,1,75,FALSE,1,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,0,0.0064,0,0.04,0,0,0.04,0,0,0.0225,0.0625,0.25,0.8281,0.09,0,0,0,0.25,0.0625,0,0.4225,0.25,0.16,1,0.25,0.25,0.25,0.0081,0.04,0.9025,0,0,0.183525,0.110221429,0.256828571,20,62.5,24,75,4,50,6,75,6,75,8,100,11,68.75,13,81.25,82.47,65.12,83.12,92.88,88.75,82.38,82.56,-12.5,7.47,15.12,8.12,17.88,-11.25,13.63,1.31,0,0,1,5,1,0,3,1,2,1,1,3,2,2,2,1,2,0,4,1,2,1,2,0,1,1,2,0,0,1,1,0,0,2,0,0,1,1,1,1,1.4,1.4,2,1.6,1.2,0.8,0.6,0.8,1.6,0.85,1.225,5.67,1.67,3.625,0.2,0.6,1.4,0.8,0.733333333,2,5,5,3,4,0,1,2,-2,2,0,0,-2,2,-2,2,1,15 cents,5 minutes,36 days,Male,College Diploma/Certificate,54,Really enjoyed the true false section. would like to have seen my results,1.25,0,1,0,0,0,0,0.33,0,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,8,5,6,9,3,2,7,1,4,2,4,3,1 +729,R_3cTHsSlgIh4LWv9,25 - 31,,Canadian,Canadian,Male,Agree,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,3,1,4,5,2,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,5,3,2,1,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,1,4,2,3,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,4,3,1,5,2,Somewhat agree,Strongly disagree,Agree,Somewhat agree,Strongly disagree,2,3,5,4,1,6,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,5,1,2,4,3,6,Agree,Strongly Disagree,Somewhat Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,2,4,5,3,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly disagree,Disagree,Agree,Agree,5,3,2,4,1,6,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,5,3,2,1,6,Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,5,1,3,4,2,6,Agree,Somewhat agree,Agree,Agree,Agree,3,1,2,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,87,TRUE,87,TRUE,87,FALSE,87,FALSE,87,TRUE,87,TRUE,87,FALSE,87,TRUE,87,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,50,24,2,-3,1,2,-1,-2,-1,-1,1,1,1,1,3,1,3,-1,1,2,-1,-1,1,-3,2,1,-3,6,-3,1,1,1,-3,6,2,-3,1,3,3,6,-1,-1,1,-2,1,4,2,-3,-2,2,2,6,1,-2,1,-1,1,6,2,1,3,2,3,6,2,1,2,2,2,5,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,FALSE,1,87,TRUE,1,87,TRUE,0,87,FALSE,1,87,FALSE,1,87,TRUE,1,87,TRUE,1,87,FALSE,0,87,0,0.0169,0,0,0.7569,0,0.0169,0,0,0,0.0169,0,1,0,0.25,0,0,0.25,0.0169,0.0169,0,1,0,0,0,0.7569,0.0169,0.25,1,1,0.0169,1,0.263042857,0.163621429,0.362464286,24,75,23,71.88,4,50,6,75,7,87.5,6,75,12,75,11,68.75,91.66,90.5,90.5,90.5,95.12,92.81,90.5,3.12,19.78,40.5,15.5,3,20.12,17.81,21.75,1,0,1,1,2,1,2,2,0,4,1,4,2,2,0,0,2,1,1,2,0,0,3,0,3,3,1,2,2,0,1,0,0,1,0,3,0,0,3,3,1,1.8,1.8,1.2,1.2,1.6,0.4,1.8,1.45,1.25,1.35,6,6,5.625,-0.2,0.2,1.4,-0.6,0.466666667,0,0,0,-1,0,1,1,1,-1,1,0,0,-1,1,-2,2,1,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),28,N/A,1,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,3,2,5,7,6,8,4,1,9,4,2,3,1 +730,R_5Hod50BeirlFVba,53 - 59,American,,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,3,5,2,4,Strongly disagree,Somewhat agree,Disagree,Strongly agree,Agree,1,2,5,3,4,Strongly Agree,Strongly Disagree,Agree,Disagree,Strongly Agree,2,5,4,3,1,Somewhat disagree,Somewhat disagree,Disagree,Disagree,Strongly disagree,2,1,5,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,1,2,4,5,3,Strongly disagree,Agree,Strongly disagree,Strongly agree,Somewhat disagree,2,1,3,4,5,8,Strongly Agree,Strongly Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,3,5,1,4,2,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,1,5,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,2,4,1,5,5,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,1,2,5,5,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,5,4,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Strongly disagree,1,3,4,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,0,-3,1,-2,3,2,3,-3,2,-2,3,-1,-1,-2,-2,-3,3,3,3,3,0,3,-3,2,-3,3,-1,8,3,-3,1,-3,3,6,-3,-3,-3,-3,-3,3,3,3,3,3,0,5,-1,1,0,1,1,5,3,-3,3,-3,3,5,0,0,-2,0,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,1,0,0,0.25,0.25,1,0,0,0,0,1,1,1,0.25,0.214285714,0.017857143,0.410714286,28,87.5,26,81.25,8,100,7,87.5,6,75,5,62.5,16,100,10,62.5,93.75,81.25,100,100,93.75,96.88,90.62,6.25,12.5,-18.75,12.5,25,31.25,-3.12,28.12,1,0,0,2,0,0,1,1,0,3,0,0,1,1,0,2,2,1,1,0,1,0,0,2,0,2,0,2,2,1,0,0,1,1,0,1,1,0,2,0,0.6,1,0.4,1.2,0.6,1.4,0.4,0.8,0.8,0.8,0.8,5.67,5,5,0,-0.4,0,0.4,-0.133333333,-2,3,1,-2,0.67,1,2,2,-2,2,-1,1,-2,2,2,-2,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),55,I have nothing further to say,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,6,9,8,3,5,7,2,1,4,4,3,2,1 +731,R_7rP0sO1BbSPkG9A,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,2,1,4,3,Strongly disagree,Agree,Somewhat disagree,Strongly agree,Somewhat agree,3,1,2,4,5,Agree,Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,1,3,2,5,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,2,1,3,5,4,4,Somewhat disagree,Neither agree nor disagree,Agree,Strongly agree,Agree,3,5,2,1,4,8,Agree,Strongly Disagree,Neither Agree nor Disagree,Strongly Agree,Agree,4,2,3,1,5,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,5,1,4,3,2,6,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,5,2,1,3,4,3,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,Agree,4,1,5,2,3,8,Somewhat agree,Somewhat agree,Agree,Agree,Strongly disagree,2,1,3,5,4,TRUE,90,FALSE,50,FALSE,89,FALSE,50,TRUE,95,FALSE,91,TRUE,50,TRUE,92,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,70,FALSE,80,FALSE,50,TRUE,52,FALSE,55,TRUE,80,TRUE,50,FALSE,50,TRUE,50,TRUE,60,FALSE,60,TRUE,88,FALSE,90,TRUE,87,FALSE,50,TRUE,50,FALSE,50,FALSE,64,FALSE,50,FALSE,60,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,-2,3,-3,2,-1,3,1,2,-2,0,1,1,-2,1,-1,1,-3,3,3,3,-3,3,3,-1,0,2,3,2,4,2,-3,0,3,2,8,-1,0,0,2,-1,7,3,3,3,0,3,2,0,1,2,2,2,6,3,-1,0,2,2,3,1,1,2,2,-3,8,TRUE,0,90,FALSE,0,50,FALSE,1,89,FALSE,1,50,TRUE,1,95,FALSE,1,91,TRUE,1,50,TRUE,1,92,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,FALSE,1,80,FALSE,0,50,TRUE,1,52,FALSE,1,55,TRUE,0,80,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,60,FALSE,1,60,TRUE,1,88,FALSE,1,90,TRUE,1,87,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,0,64,FALSE,0,50,FALSE,0,60,0.0064,0.0169,0.2304,0.25,0.36,0.0081,0.0144,0.25,0.25,0.16,0.4096,0.09,0.25,0.25,0.0025,0.25,0.16,0.25,0.25,0.01,0.25,0.25,0.25,0.04,0.2025,0.25,0.25,0.81,0.0121,0.64,0.25,0.25,0.229257143,0.193185714,0.265328571,14,43.75,22,68.75,4,50,7,87.5,6,75,5,62.5,11,68.75,11,68.75,64.16,50,66.38,73.38,66.88,63.62,64.69,-25,-4.59,0,-21.12,-1.62,4.38,-5.13,-4.06,0,0,0,1,0,2,2,3,0,1,0,1,0,2,1,1,1,1,1,2,0,0,0,2,0,3,1,3,1,1,1,1,0,1,1,3,0,3,1,0,0.2,1.6,0.8,1.2,0.4,1.8,0.8,1.4,0.95,1.1,1.025,5,3.67,5.125,-0.2,-0.2,0,-0.2,-0.133333333,1,-2,5,-1,1.33,2,2,1,-1,1,0,0,-1,1,-1,1,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),21,No feedback,1.125,1,1,1,0,0,0,1,0,04LPfPsV,02COC,01PAST,02DGEN,01DIR,3,6,5,9,8,7,4,1,2,4,2,3,1 +732,R_1cRGwOJjIklBBmb,46 - 52,American,,American,Male,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,3,2,1,5,4,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,4,5,2,1,Somewhat agree,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,2,3,5,4,1,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,5,2,0,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Agree,4,5,3,2,1,1,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,2,1,4,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,4,2,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,2,5,0,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,4,5,1,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,5,2,3,4,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,3,5,2,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,55,FALSE,90,TRUE,100,FALSE,50,FALSE,70,TRUE,100,FALSE,100,FALSE,57,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,54,TRUE,96,FALSE,100,FALSE,67,FALSE,56,FALSE,100,FALSE,53,TRUE,100,FALSE,100,FALSE,58,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,3,3,3,-2,0,1,2,1,1,3,3,2,3,1,2,3,3,0,-2,3,3,3,3,0,-1,0,1,2,2,1,1,3,3,2,3,0,3,3,3,3,2,3,-2,3,3,3,3,0,-1,0,1,1,1,1,1,3,3,2,3,0,3,3,3,3,2,2,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,55,FALSE,1,90,TRUE,1,100,FALSE,1,50,FALSE,0,70,TRUE,1,100,FALSE,1,100,FALSE,1,57,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,0,54,TRUE,1,96,FALSE,1,100,FALSE,0,67,FALSE,1,56,FALSE,1,100,FALSE,1,53,TRUE,1,100,FALSE,0,100,FALSE,0,58,0,0.4489,0,0,0.3364,1,0.0016,0,0,0,0,0,0,0.2025,0,0.25,0.2916,0.25,0,0,1,0.49,1,0.25,0,0.1936,1,1,1,0.1849,0.2209,0.01,0.310053571,0.166578571,0.453528571,25,78.13,22,68.75,5,62.5,4,50,6,75,7,87.5,11,68.75,11,68.75,84.56,72.62,83.12,84.25,98.25,90.06,79.06,9.38,15.81,10.12,33.12,9.25,10.75,21.31,10.31,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,2,1,0,0,2,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,2,1,0,0,2,0,0.4,0,1,0,0.4,0,1,0.35,0.35,0.35,0.33,0.33,0.875,0,0,0,0,0,0,0,0,1,0,-2,1,1,1,-1,2,-2,1,-1,1,-1,1,10 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),47,is very funny survey I enjoy with it,-0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,2,7,6,3,5,8,9,1,4,2,4,3,1 +733,R_3NywKajIQG0QJbF,32 - 38,American,,American,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,2,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,1,4,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Disagree,Neither agree nor disagree,Agree,Agree,Somewhat agree,4,5,3,2,1,9,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,5,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,3,2,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,3,5,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,2,4,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,2,1,6,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,3,1,4,2,6,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,2,5,4,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,77,FALSE,51,TRUE,85,FALSE,51,FALSE,78,TRUE,75,TRUE,100,FALSE,100,FALSE,50,TRUE,67,TRUE,72,TRUE,64,FALSE,100,TRUE,77,TRUE,100,FALSE,52,FALSE,54,FALSE,55,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,80,TRUE,68,TRUE,100,FALSE,100,FALSE,79,FALSE,79,FALSE,100,FALSE,60,TRUE,100,16,1,1,1,1,2,0,0,1,0,1,1,-2,1,-1,1,1,1,1,1,2,-2,0,2,2,1,10,1,1,-1,0,0,9,-1,0,0,0,0,5,0,0,0,1,2,10,1,1,1,1,1,7,0,0,0,0,0,7,2,0,2,0,2,6,0,2,2,2,0,6,TRUE,0,100,FALSE,0,60,FALSE,1,100,FALSE,1,79,FALSE,0,79,FALSE,1,100,TRUE,1,100,TRUE,1,68,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,55,FALSE,0,54,FALSE,1,52,TRUE,0,100,TRUE,0,77,FALSE,1,100,TRUE,1,64,TRUE,1,72,TRUE,0,67,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,1,78,FALSE,1,51,TRUE,1,85,FALSE,0,51,TRUE,1,77,0.1024,0,0.2916,0,0.0529,0,0.25,0,0,0.0784,0.0225,0,0.04,0,0.6241,0.36,0.4489,0.0441,0.0484,0,0.1296,0.3025,0.5929,0,0.2304,0.5625,0.2601,1,0,1,0.2401,0,0.22455,0.137207143,0.311892857,16,50,21,65.63,3,37.5,6,75,6,75,6,75,10,62.5,11,68.75,80.44,72.12,73.75,96.5,79.38,74.69,86.19,-15.63,14.81,34.62,-1.25,21.5,4.38,12.19,17.44,3,1,1,1,1,1,1,2,0,1,2,2,1,1,1,1,1,1,0,0,0,0,0,0,1,0,0,1,0,1,1,2,1,1,1,1,1,1,1,2,1.4,1,1.4,0.6,0.2,0.4,1.2,1.2,1.1,0.75,0.925,8,6.67,7.5,1.2,0.6,0.2,-0.6,0.666666667,3,2,-1,4,1.33,2,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,,1.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,7,6,4,2,8,3,9,1,5,4,2,3,1 +734,R_192GcY4ARIi5d6N,46 - 52,American,,American,Male,Neither agree nor disagree,Strongly agree,Agree,Strongly disagree,Somewhat disagree,1,5,3,4,2,Disagree,Disagree,Strongly agree,Disagree,Agree,2,1,5,4,3,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,1,4,5,3,2,Disagree,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly disagree,Disagree,2,3,4,5,1,5,Somewhat disagree,Disagree,Agree,Disagree,Agree,5,2,1,4,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,5,4,1,3,6,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Agree,Agree,Strongly disagree,Disagree,1,3,2,4,5,4,Somewhat disagree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,4,1,2,3,5,3,Strongly agree,Neither Agree nor Disagree,Strongly agree,Agree,Strongly agree,4,2,3,5,1,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,96,FALSE,51,FALSE,100,FALSE,51,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,51,FALSE,100,FALSE,100,FALSE,100,FALSE,53,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,51,TRUE,100,TRUE,100,TRUE,100,26,0,3,2,-3,-1,-2,-2,3,-2,2,2,0,3,1,3,-2,-1,-3,-2,-3,-1,3,3,-3,-2,4,-1,-2,2,-2,2,5,3,3,3,1,3,5,-3,0,0,-3,-3,6,-1,2,2,-3,-2,5,-1,-3,3,-2,1,4,3,0,3,2,3,3,-1,0,0,0,0,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,51,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,51,FALSE,1,100,FALSE,1,51,TRUE,1,96,FALSE,0,50,TRUE,1,100,1,0,0,0,0,0,0,0,0,0,0.0016,1,0,0.2209,0,0,0.25,0.2401,0,0,0,0.2601,0.25,0,0,0.2401,0.25,1,1,1,0.2401,0,0.212603571,0.122328571,0.302878571,26,81.25,25,78.13,6,75,7,87.5,6,75,6,75,12,75,13,81.25,87.59,63.25,87.62,100,99.5,93.56,81.62,3.12,9.46,-11.75,0.12,25,24.5,18.56,0.37,1,0,1,0,1,1,0,1,0,0,1,3,0,0,0,1,1,3,1,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,1,1,3,2,3,0.6,0.4,0.8,1.2,0.6,0.6,0.4,2,0.75,0.9,0.825,4.67,4,4.625,0,-0.2,0.4,-0.8,0.066666667,-1,1,2,1,0.67,2,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,51,none,1.5,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,5,2,9,4,6,7,3,1,8,4,3,2,1 +735,R_63xcflDzFQ1r20D,25 - 31,American,,American,Male,Agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Agree,2,1,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,4,5,1,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,5,3,2,4,1,Strongly disagree,Disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,5,4,1,2,3,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,7,Somewhat agree,Agree,Somewhat disagree,Agree,Somewhat disagree,2,4,3,5,1,8,Somewhat Disagree,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,2,3,4,1,5,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,1,5,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Agree,Strongly Agree,3,2,4,5,1,6,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,1,3,4,5,6,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,1,4,2,3,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,3,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,59,TRUE,50,TRUE,67,FALSE,52,TRUE,100,FALSE,57,FALSE,54,TRUE,65,TRUE,52,FALSE,84,FALSE,52,TRUE,57,TRUE,83,FALSE,68,TRUE,71,TRUE,84,FALSE,56,TRUE,67,FALSE,68,TRUE,65,TRUE,81,TRUE,82,FALSE,100,FALSE,63,FALSE,57,FALSE,58,TRUE,64,FALSE,76,TRUE,78,TRUE,73,FALSE,55,TRUE,92,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,-1,0,2,0,0,0,0,2,0,0,0,-1,3,-3,-2,-1,-1,-3,3,3,0,1,0,7,1,2,-1,2,-1,8,-1,1,2,2,0,7,0,0,-1,-1,-1,6,3,2,1,2,3,6,1,-1,2,-1,1,6,1,0,0,-1,3,6,1,1,1,1,1,8,TRUE,0,59,TRUE,1,50,TRUE,0,67,FALSE,1,52,TRUE,1,100,FALSE,1,57,FALSE,0,54,TRUE,1,65,TRUE,1,52,FALSE,0,84,FALSE,1,52,TRUE,0,57,TRUE,1,83,FALSE,1,68,TRUE,1,71,TRUE,1,84,FALSE,1,56,TRUE,0,67,FALSE,1,68,TRUE,0,65,TRUE,1,81,TRUE,1,82,FALSE,1,100,FALSE,0,63,FALSE,1,57,FALSE,0,58,TRUE,0,64,FALSE,1,76,TRUE,0,78,TRUE,1,73,FALSE,0,55,TRUE,1,92,0.1225,0.3364,0.0256,0.2916,0.0064,0.1849,0.3969,0.7056,0.4225,0.0324,0.0729,0.0289,0.2304,0.2304,0,0.25,0,0.2304,0.0576,0.1849,0.0361,0.0841,0.1024,0.1024,0.1936,0.4096,0.3025,0.3481,0.4489,0.4489,0.6084,0.3249,0.230146429,0.199407143,0.260885714,14,43.75,20,62.5,6,75,7,87.5,3,37.5,4,50,11,68.75,9,56.25,68.44,58,80.88,66.12,68.75,71.69,65.19,-18.75,5.94,-17,-6.62,28.62,18.75,2.94,8.94,1,0,1,1,2,1,2,1,2,3,1,1,2,3,3,3,2,0,0,2,1,1,2,2,1,1,1,2,1,1,1,0,0,0,0,4,3,2,2,4,1,1.8,2,1.4,1.4,1.2,0.2,3,1.55,1.45,1.5,7.33,6,6.75,-0.4,0.6,1.8,-1.6,0.666666667,1,2,1,-2,1.33,1,2,1,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,31,Good survey.,1.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,01DIR,7,9,5,2,3,6,8,1,4,4,3,2,1 +736,R_1Yg2RfkDojgKcX1,18 - 24,,Canadian,Canadian,Female,Strongly agree,Somewhat agree,Somewhat agree,Strongly disagree,Strongly agree,4,5,1,3,2,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,1,4,5,3,2,Agree,Strongly Disagree,Strongly Agree,Agree,Neither Agree nor Disagree,4,5,2,3,1,Somewhat disagree,Strongly disagree,Somewhat agree,Somewhat agree,Disagree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,4,5,2,6,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Disagree,2,1,3,4,5,6,Strongly Agree,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Strongly Agree,3,4,5,2,1,7,Agree,Agree,Strongly Agree,Agree,Agree,5,4,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Neither agree nor disagree,Somewhat disagree,Strongly Agree,1,5,4,3,2,6,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,2,5,1,3,4,6,Agree,Strongly Disagree,Agree,Somewhat Disagree,Agree,2,3,1,4,5,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,2,3,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,81,FALSE,87,TRUE,89,TRUE,100,TRUE,87,FALSE,50,TRUE,100,FALSE,100,TRUE,62,TRUE,50,TRUE,98,TRUE,63,FALSE,52,FALSE,100,TRUE,100,TRUE,56,TRUE,100,TRUE,52,FALSE,50,TRUE,100,TRUE,75,FALSE,61,TRUE,97,TRUE,52,TRUE,100,TRUE,89,FALSE,58,TRUE,99,FALSE,53,FALSE,100,TRUE,50,TRUE,61,6,3,1,1,-3,3,-2,-1,-1,-2,-1,2,-3,3,2,0,-1,-3,1,1,-2,3,2,1,-1,1,2,2,1,0,-3,-2,6,3,1,-1,-1,3,6,2,2,3,2,2,7,3,2,0,-1,3,5,1,-1,2,-2,1,6,2,-3,2,-1,2,6,1,-1,1,1,-1,7,TRUE,0,61,TRUE,1,50,FALSE,1,100,FALSE,1,53,TRUE,1,99,FALSE,1,58,TRUE,1,89,TRUE,1,100,TRUE,1,52,TRUE,1,97,FALSE,1,61,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,1,52,TRUE,1,100,TRUE,0,56,TRUE,0,100,FALSE,1,100,FALSE,1,52,TRUE,1,63,TRUE,1,98,TRUE,0,50,TRUE,1,62,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,87,TRUE,0,100,TRUE,1,89,FALSE,0,87,FALSE,0,81,0,0,0,0.0121,0.6561,0.1764,0.1444,0.0009,0.2304,0.0004,0.0121,0,0.2304,0.1521,0.0001,0.25,0.25,0.2209,0.7569,0,0.1369,0.2304,0,0.25,0.3136,0.25,0.7569,0.3721,0,1,1,0.5625,0.284053571,0.166014286,0.402092857,6,18.75,23,71.88,7,87.5,4,50,6,75,6,75,14,87.5,9,56.25,77.25,63.12,75.88,86.88,83.12,82.44,72.06,-53.13,5.37,-24.38,25.88,11.88,8.12,-5.06,15.81,0,1,0,2,2,4,2,1,1,1,1,4,4,3,3,3,5,2,1,4,0,1,1,2,0,3,0,3,0,2,0,0,1,3,2,2,2,0,0,1,1,1.8,3,3,0.8,1.6,1.2,1,2.2,1.15,1.675,4.67,5.67,5.625,0.2,0.2,1.8,2,0.733333333,-3,0,0,0,-1,1,2,2,-2,2,0,0,-1,1,-1,1,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),18,This survey was really fun.,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,3,9,8,6,4,2,5,1,7,2,4,3,1 +737,R_3eWO2HE3Av3N3e0,46 - 52,American,,American,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,1,3,2,4,5,Strongly agree,Somewhat agree,Strongly agree,Agree,Strongly agree,3,4,5,2,1,Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,5,1,4,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,4,2,1,5,Somewhat disagree,Somewhat disagree,Agree,Strongly disagree,Strongly Agree,5,3,2,1,4,5,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,Somewhat agree,4,2,1,3,5,8,Somewhat Disagree,Agree,Disagree,Agree,Disagree,2,3,4,5,1,7,Neither agree nor disagree,Strongly disagree,Agree,Somewhat disagree,Agree,5,1,4,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,2,4,1,3,6,Agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,5,1,3,2,4,6,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,3,2,4,5,1,6,Agree,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,2,4,5,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,72,FALSE,95,TRUE,77,TRUE,78,FALSE,57,TRUE,69,TRUE,65,FALSE,51,FALSE,53,TRUE,67,FALSE,60,TRUE,54,TRUE,61,FALSE,57,TRUE,62,FALSE,100,FALSE,60,TRUE,63,FALSE,60,TRUE,63,TRUE,73,TRUE,63,FALSE,64,TRUE,100,TRUE,57,FALSE,71,TRUE,66,FALSE,100,TRUE,71,FALSE,72,TRUE,100,TRUE,79,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,1,3,3,1,3,2,3,2,3,2,2,3,3,2,3,3,1,-1,-1,2,-3,3,5,1,2,-1,-1,1,8,-1,2,-2,2,-2,7,0,-3,2,-1,2,6,3,2,3,2,3,6,2,3,3,1,1,6,3,0,2,1,3,6,2,2,3,1,0,9,TRUE,0,72,FALSE,0,95,TRUE,0,77,TRUE,0,78,FALSE,0,57,TRUE,0,69,TRUE,1,65,FALSE,0,51,FALSE,0,53,TRUE,1,67,FALSE,1,60,TRUE,0,54,TRUE,1,61,FALSE,1,57,TRUE,1,62,FALSE,0,100,FALSE,1,60,TRUE,0,63,FALSE,1,60,TRUE,0,63,TRUE,1,73,TRUE,1,63,FALSE,1,64,TRUE,1,100,TRUE,0,57,FALSE,0,71,TRUE,0,66,FALSE,1,100,TRUE,0,71,FALSE,0,72,TRUE,1,100,TRUE,1,79,0.2601,0.5041,1,0.1225,0.0441,0.4761,0,0.1089,0.3969,0.1369,0.5184,0.1521,0.2809,0.16,0.3249,0.9025,0.1296,0.6084,0,0.3249,0.0729,0.1444,0.16,0.1849,0.16,0.4356,0,0.5184,0.5929,0.3969,0.5041,0.2916,0.286653571,0.302835714,0.270471429,10,31.25,15,46.88,4,50,5,62.5,4,50,2,25,9,56.25,6,37.5,70,71.75,66.75,64.38,77.12,73.06,66.94,-15.63,23.12,21.75,4.25,14.38,52.12,16.81,29.44,4,4,0,4,0,2,1,4,3,2,3,1,4,0,5,3,5,1,4,1,0,1,1,1,0,1,2,0,1,2,1,3,0,1,0,1,0,0,2,1,2.4,2.4,2.6,2.8,0.6,1.2,1,0.8,2.55,0.9,1.725,6.67,6,6.625,1.8,1.2,1.6,2,1.533333333,-1,2,1,-3,0.67,-1,2,0,0,0,0,0,1,-1,-1,1,0,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),49,Very fun.,0.125,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,7,4,2,5,6,9,3,1,8,2,4,3,1 +738,R_5q9yojkPnsuJB2B,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Disagree,Disagree,3,5,4,2,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,5,1,3,2,Somewhat Disagree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,3,2,1,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,3,2,4,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Somewhat disagree,1,2,5,4,3,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,1,4,5,2,3,Somewhat Disagree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,1,5,3,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Somewhat disagree,2,1,3,5,4,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,1,5,3,2,1,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Strongly Agree,2,3,5,4,1,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,4,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,65,FALSE,74,TRUE,79,TRUE,100,FALSE,80,TRUE,100,TRUE,94,TRUE,94,TRUE,86,FALSE,88,FALSE,97,TRUE,88,TRUE,90,TRUE,71,TRUE,100,TRUE,50,TRUE,100,TRUE,86,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,85,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,-2,-2,-3,-3,3,-3,1,-1,-2,3,-3,3,-1,-1,-1,0,-2,3,3,3,-2,-1,1,1,-3,3,-3,1,3,-1,-2,3,-3,3,2,0,1,1,0,1,6,3,3,3,-2,-1,1,0,-3,3,-3,0,1,-1,-2,3,-2,3,1,0,1,1,1,1,7,TRUE,0,96,TRUE,1,65,FALSE,1,74,TRUE,0,79,TRUE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,94,TRUE,1,94,TRUE,1,86,FALSE,1,88,FALSE,1,97,TRUE,1,88,TRUE,0,90,TRUE,1,71,TRUE,1,100,TRUE,0,50,TRUE,0,100,TRUE,0,86,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,85,TRUE,1,100,0.0036,0,0,0,0,0.04,0,0.0196,0,0,0.25,0.0144,0.0036,0.0144,0,0.1225,0,0.6241,0,0,0.25,0.0841,0.7396,0.81,0.25,1,0.0225,0.9216,0.0676,1,1,0.0009,0.258389286,0.077757143,0.439021429,24,75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,14,87.5,8,50,88.22,83.5,83.5,96.5,89.38,86.44,90,6.25,19.47,21,21,34,1.88,-1.06,40,0,0,0,0,1,4,0,0,0,0,0,0,0,0,0,1,2,2,0,3,0,0,0,0,1,3,0,0,0,1,0,0,0,1,0,1,2,2,1,3,0.2,0.8,0,1.6,0.2,0.8,0.2,1.8,0.65,0.75,0.7,2,1,2.75,0,0,-0.2,-0.2,-0.066666667,0,2,1,-1,1,1,2,2,-2,2,0,0,-2,2,-2,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,No comment.,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,6,2,4,3,7,9,5,1,8,2,4,3,1 +739,R_7JR3NaQJDhjIYbS,39 - 45,American,,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,1,4,2,5,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,Agree,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,5,2,3,4,1,Disagree,Somewhat disagree,Somewhat agree,Strongly Agree,Strongly disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Neither agree nor disagree,Strongly Agree,Disagree,Neither agree nor disagree,3,4,1,5,2,5,Agree,Strongly disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,7,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,4,2,3,5,1,7,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat agree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Strongly Agree,Agree,Strongly disagree,Neither agree nor disagree,3,2,4,1,5,6,Agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,3,2,5,7,Agree,Agree,Somewhat Agree,Disagree,Agree,5,2,1,3,4,7,Somewhat agree,Somewhat disagree,Agree,Agree,Somewhat agree,4,5,3,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,69,FALSE,83,TRUE,100,FALSE,57,TRUE,100,FALSE,55,TRUE,100,FALSE,100,TRUE,100,FALSE,56,TRUE,100,FALSE,100,FALSE,100,FALSE,79,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,88,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,58,FALSE,55,FALSE,64,FALSE,84,FALSE,57,11,2,3,3,1,0,2,1,3,0,0,2,1,2,3,3,-2,-1,1,3,-3,2,0,3,-2,0,8,2,-3,2,0,0,5,1,0,2,2,1,7,1,0,2,2,1,7,1,3,2,-3,0,6,2,-3,1,0,1,6,2,2,1,-2,2,7,1,-1,2,2,1,7,FALSE,1,57,FALSE,0,84,FALSE,1,64,FALSE,1,55,FALSE,0,58,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,88,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,79,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,55,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,0,83,FALSE,0,69,0,0,0,0,0.4761,1,0,0,0,0,0,0.0144,0,0.9801,0.3364,0.7056,0.1936,0.2025,1,0,1,0,0.0441,1,1,0.2025,0.6889,0.1849,0.1296,1,0.1849,1,0.405128571,0.279192857,0.531064286,11,34.38,20,62.5,5,62.5,3,37.5,6,75,6,75,11,68.75,9,56.25,87.62,81.88,78.5,94.62,95.5,92.62,82.62,-28.12,25.12,19.38,41,19.62,20.5,23.87,26.37,0,3,0,3,0,0,4,1,0,0,1,1,0,1,2,3,1,1,1,4,1,0,1,4,0,0,4,2,0,1,0,1,1,5,1,3,0,1,1,4,1.2,1,1,2,1.2,1.4,1.6,1.8,1.3,1.5,1.4,6.67,6.33,6.625,0,-0.4,-0.6,0.2,-0.333333333,2,-1,0,0,0.34,2,1,0,-2,2,-1,1,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,44,"no comments at the moment,",0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,3,8,4,5,6,9,7,1,2,3,2,4,1 +740,R_7tjJuhM7HFKgeVb,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,5,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,1,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,2,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,2,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,5,4,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,3,1,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,4,3,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,3,1,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,3,4,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,32,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0.571428571,0.357142857,0.785714286,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,100,100,100,100,100,100,100,50,50,50,50,50,50,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,2,1,2,1,-1,2,-2,2,-2,2,-2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),30,,0,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,3,4,9,7,2,8,6,1,5,4,3,2,1 +741,R_7u1VMhlvNjxgYrD,18 - 24,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Somewhat agree,Agree,Agree,4,5,2,3,1,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,2,4,5,1,3,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,2,5,3,1,4,Somewhat agree,Somewhat agree,Agree,Agree,Agree,1,3,2,4,5,7,Agree,Neither agree nor disagree,Agree,Agree,Somewhat agree,5,3,4,1,2,8,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,5,1,2,7,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,4,1,2,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,Strongly Agree,1,2,4,5,3,5,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,3,2,4,5,8,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,1,2,4,5,3,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,4,3,5,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,90,FALSE,81,TRUE,100,FALSE,100,TRUE,76,FALSE,80,TRUE,79,TRUE,89,TRUE,90,FALSE,68,FALSE,84,TRUE,100,TRUE,100,TRUE,74,TRUE,86,TRUE,81,TRUE,93,FALSE,89,TRUE,92,FALSE,82,FALSE,89,TRUE,89,FALSE,85,TRUE,80,FALSE,84,TRUE,85,FALSE,95,TRUE,82,TRUE,71,TRUE,78,FALSE,79,TRUE,79,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,2,2,2,0,2,-1,2,1,0,3,1,3,0,0,0,3,-1,1,1,2,2,2,7,2,0,2,2,1,8,3,2,3,1,3,7,1,2,1,2,1,8,3,3,-2,1,3,5,1,0,3,0,3,8,2,2,1,1,3,3,3,3,3,3,1,10,TRUE,0,90,FALSE,0,81,TRUE,0,100,FALSE,1,100,TRUE,1,76,FALSE,1,80,TRUE,1,79,TRUE,1,89,TRUE,1,90,FALSE,0,68,FALSE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,74,TRUE,1,86,TRUE,1,81,TRUE,0,93,FALSE,1,89,TRUE,0,92,FALSE,1,82,FALSE,0,89,TRUE,1,89,FALSE,1,85,TRUE,1,80,FALSE,1,84,TRUE,1,85,FALSE,1,95,TRUE,0,82,TRUE,0,71,TRUE,1,78,FALSE,0,79,TRUE,1,79,0.0121,0.0225,0.0361,0.0441,0.0441,0.04,0.04,0.4624,0.0324,0.0121,0.0484,0,0.01,0.0256,0.0576,0.6561,0.0225,0,0.6724,0.0256,0.7921,0.0196,0.8464,0.5476,0.8649,0.0025,0.6241,0.81,1,0.0121,0.5041,1,0.327592857,0.103657143,0.551528571,25,78.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,12,75,8,50,85.31,88.38,84.12,82.25,86.5,83.06,87.56,15.63,22.81,25.88,21.62,19.75,24,8.06,37.56,2,2,1,0,0,0,0,0,3,1,2,2,0,0,0,1,2,1,1,2,0,0,3,1,1,1,0,1,1,1,1,2,2,0,0,3,3,3,0,2,1,0.8,0.8,1.4,1,0.8,1,2.2,1,1.25,1.125,7.33,5.33,7,0,0,-0.2,-0.8,-0.066666667,2,0,4,-2,2,1,2,2,-1,1,1,-1,0,0,1,-1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,24,The survey was great and easy to follow through,0.625,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,2,4,3,9,5,6,8,1,7,4,2,3,1 +742,R_3zUtl7DoAFOU12F,25 - 31,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Strongly agree,Agree,3,2,5,4,1,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,1,4,5,3,2,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,3,4,2,1,5,Disagree,Strongly disagree,Strongly disagree,Somewhat disagree,Disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Agree,Agree,2,1,3,5,4,7,Somewhat agree,Somewhat disagree,Disagree,Strongly agree,Somewhat disagree,2,5,1,3,4,8,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,5,3,1,4,2,9,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat disagree,Disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,3,5,8,Somewhat agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,1,3,4,2,5,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,5,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,73,FALSE,50,TRUE,69,TRUE,54,TRUE,97,TRUE,50,TRUE,55,FALSE,97,TRUE,83,TRUE,50,TRUE,50,FALSE,53,TRUE,56,TRUE,50,FALSE,54,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,88,TRUE,50,TRUE,93,FALSE,50,TRUE,100,TRUE,55,FALSE,50,FALSE,50,TRUE,53,TRUE,100,TRUE,50,TRUE,72,16,3,2,2,3,2,1,2,1,2,1,2,2,1,1,3,-2,-3,-3,-1,-2,2,2,2,2,2,6,1,-1,-2,3,-1,7,1,2,2,1,2,8,-3,-3,-3,-1,-2,9,3,2,3,3,3,8,1,-1,3,-2,3,8,3,3,3,3,3,8,3,3,3,3,1,7,TRUE,0,72,TRUE,1,50,TRUE,0,100,TRUE,0,53,FALSE,0,50,FALSE,1,50,TRUE,1,55,TRUE,1,100,FALSE,0,50,TRUE,1,93,TRUE,0,50,TRUE,0,88,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,54,TRUE,0,50,TRUE,0,56,FALSE,0,53,TRUE,1,50,TRUE,0,50,TRUE,1,83,FALSE,1,97,TRUE,1,55,TRUE,0,50,TRUE,0,97,TRUE,0,54,TRUE,1,69,FALSE,0,50,TRUE,1,73,0,0.2025,0.25,0.2025,0.0729,0.25,0.0289,0.0049,0.3136,0.25,0.0961,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.9409,0.0009,0.2809,0.25,0.25,0.25,0.25,0.25,0.25,0.5184,1,0.2116,0.2916,0.7744,0.297,0.199807143,0.394192857,16,50,15,46.88,1,12.5,4,50,6,75,4,50,11,68.75,4,25,62.56,50.38,53.75,65.75,80.38,61.31,63.81,3.12,15.68,37.88,3.75,-9.25,30.38,-7.44,38.81,1,0,0,1,0,0,3,3,1,2,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1,0,3,2,4,2,1,1,2,2,0,5,6,6,4,3,0.4,1.8,0.6,0.2,0.4,2.2,1.2,4.8,0.75,2.15,1.45,7,8,7.625,0,-0.4,-0.6,-4.6,-0.333333333,-2,-1,0,2,-1,-1,-1,-1,-2,2,2,-2,2,-2,1,-1,-2,10 cents,5 minutes,47 days,Female,University - Undergraduate,25,"it was interesting, a little long and time consuming.",-1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,4,5,9,7,6,2,8,1,3,4,3,2,1 +743,R_6lQW45S27ysSd3j,46 - 52,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,3,2,4,5,1,Agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,2,4,5,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,5,2,1,3,4,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Disagree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat agree,3,1,5,4,2,4,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,1,2,5,4,6,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,5,2,4,3,1,9,Strongly disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Agree,Agree,Agree,1,4,2,3,5,4,Strongly agree,Disagree,Agree,Disagree,Somewhat agree,2,4,3,1,5,2,Somewhat Agree,Agree,Strongly agree,Agree,Somewhat Agree,3,5,1,2,4,9,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,4,1,2,5,3,FALSE,100,TRUE,100,TRUE,100,FALSE,60,TRUE,84,FALSE,100,TRUE,89,TRUE,100,TRUE,97,TRUE,93,FALSE,100,TRUE,93,TRUE,100,FALSE,100,TRUE,97,TRUE,100,FALSE,62,TRUE,100,TRUE,77,FALSE,100,TRUE,70,TRUE,100,FALSE,100,TRUE,100,TRUE,94,FALSE,75,TRUE,91,FALSE,100,TRUE,84,FALSE,70,TRUE,89,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,1,1,2,-1,1,0,1,-1,-1,3,1,0,1,1,2,0,-2,3,3,3,-1,1,7,3,-3,3,-1,1,4,1,2,1,2,1,6,-3,-2,-3,-2,-3,9,3,3,2,2,2,4,3,-2,2,-2,1,4,1,2,3,2,1,2,2,3,3,3,-3,9,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,60,TRUE,1,84,FALSE,1,100,TRUE,1,89,TRUE,1,100,TRUE,1,97,TRUE,1,93,FALSE,1,100,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,FALSE,1,62,TRUE,0,100,TRUE,0,77,FALSE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,94,FALSE,0,75,TRUE,0,91,FALSE,1,100,TRUE,0,84,FALSE,0,70,TRUE,1,89,TRUE,1,100,0,0.5625,0,0.0121,0,0,0,0.0049,0,0,0.49,0,0.0009,0,0.0256,0,0,0.16,0,0.8836,0.09,0.0009,0.5929,0,0.1444,0.8281,0.0121,0,1,1,0.7056,0.8649,0.242996429,0.048671429,0.437321429,27,84.38,23,71.88,6,75,7,87.5,5,62.5,5,62.5,14,87.5,9,56.25,91.41,88.88,87.5,93.88,95.38,91.5,91.31,12.5,19.53,13.88,0,31.38,32.88,4,35.06,0,0,0,2,0,1,2,2,1,0,2,3,2,1,1,4,3,5,2,1,0,0,1,1,1,1,1,1,2,0,2,3,0,1,1,1,2,1,3,1,0.4,1.2,1.8,3,0.6,1,1.4,1.6,1.6,1.15,1.375,5.67,3.33,5.625,-0.2,0.2,0.4,1.4,0.133333333,3,0,4,0,2.34,0,1,0,-2,2,1,-1,2,-2,-2,2,1,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),49,,0.375,1,0,0,0,1,1,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,01DIR,2,6,7,8,5,3,9,1,4,4,3,2,1 +744,R_7FwXOfwfi0MRCgW,25 - 31,,Canadian,Canadian,Male,Strongly agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,1,3,2,4,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Somewhat Agree,3,4,5,1,2,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,Disagree,4,1,2,3,5,Agree,Agree,Agree,Strongly disagree,Agree,4,5,3,1,2,7,Somewhat agree,Disagree,Somewhat agree,Strongly disagree,Somewhat agree,2,3,1,4,5,6,Strongly Agree,Strongly Disagree,Somewhat Agree,Disagree,Neither Agree nor Disagree,5,4,1,3,2,6,Disagree,Disagree,Disagree,Disagree,Somewhat agree,2,5,3,1,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,2,4,1,5,4,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Agree,2,3,4,1,5,3,Strongly Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,3,4,2,1,5,3,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,1,4,5,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,89,TRUE,93,TRUE,92,FALSE,74,TRUE,93,FALSE,94,TRUE,98,TRUE,85,TRUE,76,TRUE,84,FALSE,95,TRUE,95,FALSE,91,FALSE,65,TRUE,90,TRUE,86,FALSE,94,FALSE,83,FALSE,95,FALSE,69,TRUE,96,TRUE,78,FALSE,82,TRUE,96,FALSE,98,TRUE,91,FALSE,63,FALSE,97,FALSE,78,TRUE,84,FALSE,83,TRUE,94,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,0,-1,0,0,1,-2,1,-1,0,0,-3,3,-3,1,-2,-2,0,1,-2,2,2,2,-3,2,7,1,-2,1,-3,1,6,3,-3,1,-2,0,6,-2,-2,-2,-2,1,6,2,1,0,0,2,4,0,-2,2,-3,2,3,3,-3,2,-3,3,3,1,1,2,1,-3,5,TRUE,0,89,TRUE,1,93,TRUE,0,92,FALSE,1,74,TRUE,1,93,FALSE,1,94,TRUE,1,98,TRUE,1,85,TRUE,1,76,TRUE,1,84,FALSE,1,95,TRUE,0,95,FALSE,0,91,FALSE,1,65,TRUE,1,90,TRUE,1,86,FALSE,1,94,FALSE,1,83,FALSE,1,95,FALSE,1,69,TRUE,1,96,TRUE,1,78,FALSE,1,82,TRUE,1,96,FALSE,1,98,TRUE,1,91,FALSE,1,63,FALSE,1,97,FALSE,1,78,TRUE,1,84,FALSE,0,83,TRUE,1,94,0.0225,0.0081,0.0196,0.0004,0.0036,0.0036,0.0016,0.0256,0.0961,0.0484,0.0256,0.8281,0.0576,0.0025,0.0049,0.0049,0.0324,0.0676,0.0009,0.0004,0.0016,0.01,0.0025,0.1225,0.0036,0.1369,0.6889,0.7921,0.8464,0.0289,0.0484,0.9025,0.171003571,0.085892857,0.256114286,21,65.63,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,86.91,83.62,90.25,85.75,88,88.62,85.19,-18.75,2.53,-3.88,2.75,-1.75,13,1.12,3.94,1,2,3,3,2,0,0,0,2,1,3,0,2,1,1,0,0,2,3,3,1,1,1,0,2,1,0,1,2,2,3,0,1,0,2,3,3,2,0,1,2.2,0.6,1.4,1.6,1,1.2,1.2,1.8,1.45,1.3,1.375,6.33,3.33,5,1.2,-0.6,0.2,-0.2,0.266666667,3,3,3,1,3,-2,1,-1,-2,2,1,-1,2,-2,2,-2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,26,VERY INTERESTING STUDY IT WAS ENJOYABLE,-0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,4,6,9,2,7,5,8,1,3,4,2,3,1 +745,R_73fMUnCCOSljM6A,46 - 52,American,,American,Male,Agree,Agree,Somewhat agree,Somewhat agree,Agree,4,3,2,1,5,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,5,1,4,2,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,1,2,3,4,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,1,2,5,4,3,6,Neither agree nor disagree,Agree,Agree,Strongly disagree,Agree,4,3,2,5,1,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,4,5,3,2,1,9,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,5,2,4,1,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,3,5,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,2,3,4,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,4,5,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,100,TRUE,100,TRUE,74,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,64,TRUE,100,TRUE,100,FALSE,95,FALSE,100,TRUE,79,FALSE,100,TRUE,100,TRUE,87,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,85,TRUE,100,TRUE,100,FALSE,100,27,2,2,1,1,2,-2,1,0,0,1,2,0,2,0,3,-3,-3,-3,-3,-3,2,2,1,1,3,10,0,2,2,-3,2,6,1,0,1,2,1,5,1,1,1,2,0,9,0,0,0,0,1,5,-1,0,1,1,0,5,0,0,0,0,0,5,-3,-3,-2,-3,-3,4,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,85,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,87,TRUE,1,100,FALSE,1,100,TRUE,0,79,FALSE,1,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,50,TRUE,0,74,TRUE,1,100,FALSE,0,100,FALSE,0,100,0,0,0,0,1,0,0,0,0.0025,0,0,0,0,0,0,0,0.4096,0.7225,0.25,0,0,0.0169,0,0,0,1,1,0,1,0.6241,0.5476,1,0.270471429,0.152471429,0.388471429,27,84.38,22,68.75,5,62.5,5,62.5,7,87.5,5,62.5,14,87.5,8,50,94.81,96.5,92.25,97.38,93.12,99.19,90.44,15.63,26.06,34,29.75,9.88,30.62,11.69,40.44,0,0,0,0,1,2,1,2,3,1,1,0,1,2,2,4,4,4,5,3,2,2,1,1,1,1,1,1,1,1,2,0,2,0,3,0,0,1,0,0,0.2,1.8,1.2,4,1.4,1,1.4,0.2,1.8,1,1.4,7,5,6.125,-1.2,0.8,-0.2,3.8,-0.2,5,1,0,5,2,0,2,1,-1,1,-2,2,0,0,-1,1,0,5 cents,5 minutes,47 days,Male,University - PhD,48,it's better to have the status bar,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,7,3,2,4,6,8,5,1,9,4,3,2,1 +746,R_3awXX1EJ7go8pt7,25 - 31,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly disagree,Disagree,Disagree,Neither agree nor disagree,2,3,1,5,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Strongly disagree,3,4,2,5,1,Somewhat Agree,Disagree,Somewhat Disagree,Somewhat Agree,Disagree,3,2,5,4,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,4,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Strongly disagree,Somewhat agree,Agree,Neither agree nor disagree,4,1,2,5,3,2,Somewhat disagree,Disagree,Strongly agree,Disagree,Disagree,3,4,2,1,5,5,Disagree,Disagree,Strongly Disagree,Disagree,Disagree,1,3,4,5,2,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,4,3,2,5,1,3,Somewhat disagree,Strongly disagree,Neither agree nor disagree,Disagree,Somewhat disagree,2,5,3,1,4,3,Strongly Disagree,Strongly Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,2,3,1,5,4,8,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,5,2,3,1,4,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,61,TRUE,87,FALSE,56,TRUE,100,FALSE,58,TRUE,50,TRUE,89,TRUE,57,FALSE,50,FALSE,50,TRUE,67,FALSE,100,TRUE,62,FALSE,68,TRUE,58,FALSE,57,FALSE,61,FALSE,57,FALSE,52,FALSE,89,FALSE,50,TRUE,58,FALSE,50,FALSE,50,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,-3,-2,-2,0,-1,-1,1,-2,-3,1,-2,-1,1,-2,1,0,1,1,-1,-1,-3,1,2,0,8,-1,-2,3,-2,-2,2,-2,-2,-3,-2,-2,5,-1,-1,-1,-1,-2,3,-3,-2,0,-2,-2,5,-1,-3,0,-2,-1,3,-3,-3,-1,-1,-1,3,-1,0,-2,-2,-2,8,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,61,TRUE,1,87,FALSE,1,56,TRUE,0,100,FALSE,0,58,TRUE,0,50,TRUE,1,89,TRUE,1,57,FALSE,1,50,FALSE,1,50,TRUE,0,67,FALSE,1,100,TRUE,1,62,FALSE,0,68,TRUE,0,58,FALSE,0,57,FALSE,1,61,FALSE,0,57,FALSE,1,52,FALSE,1,89,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,0,50,0.25,0.3249,0.1849,0.25,0.25,0.25,0.3249,0.0169,0,0.4624,0.1764,0.3364,0.1521,0.1936,0.25,0.25,0.3364,0.25,0.0121,0.1521,0.1444,0.0121,0.4489,0.25,0.25,0.2304,0.25,0.25,0.25,0.25,0.25,1,0.249967857,0.232078571,0.267857143,4,12.5,18,56.25,5,62.5,4,50,4,50,5,62.5,6,37.5,12,75,60.53,59.38,53.5,59.12,70.12,59.62,61.44,-43.75,4.28,-3.12,3.5,9.12,7.62,22.12,-13.56,1,0,3,4,0,0,1,2,0,1,3,0,2,3,0,2,1,2,2,1,3,1,2,0,2,0,2,1,0,2,4,1,0,2,1,2,0,3,3,1,1.6,0.8,1.6,1.6,1.6,1,1.6,1.8,1.4,1.5,1.45,5,3.67,4.625,0,-0.2,0,-0.2,-0.066666667,3,-1,2,-5,1.33,0,0,0,-1,1,0,0,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,25,Good,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,6,5,7,4,3,2,9,1,8,4,2,3,1 +747,R_7oBG7d9UTEDu1Fa,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,2,4,3,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,4,2,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,1,4,5,3,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,Somewhat agree,2,4,1,3,5,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,4,3,1,2,5,Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,3,2,4,1,5,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,4,2,1,3,5,4,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Agree,3,4,2,1,5,3,Agree,Somewhat Disagree,Agree,Disagree,Agree,1,3,5,4,2,7,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,2,4,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,59,FALSE,52,FALSE,53,TRUE,50,FALSE,83,FALSE,50,TRUE,60,FALSE,92,TRUE,60,FALSE,58,TRUE,68,TRUE,57,FALSE,50,FALSE,87,TRUE,53,TRUE,50,TRUE,95,FALSE,50,FALSE,60,FALSE,52,TRUE,65,FALSE,52,TRUE,54,FALSE,50,FALSE,61,FALSE,50,FALSE,99,TRUE,73,FALSE,50,TRUE,67,FALSE,59,FALSE,97,6,1,3,3,2,2,-1,1,1,1,1,2,-1,2,0,2,-1,-1,1,1,-1,0,0,3,-1,1,6,-1,-1,-1,1,-1,4,2,-1,0,1,0,5,1,2,1,1,1,7,2,2,2,2,2,2,1,1,2,-1,2,4,2,-1,2,-2,2,3,2,1,2,2,0,7,FALSE,1,97,FALSE,0,59,TRUE,0,67,FALSE,1,50,TRUE,1,73,FALSE,1,99,FALSE,0,50,FALSE,0,61,FALSE,0,50,TRUE,1,54,FALSE,1,52,TRUE,0,65,FALSE,0,52,FALSE,1,60,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,0,53,FALSE,1,87,FALSE,1,50,TRUE,1,57,TRUE,1,68,FALSE,1,58,TRUE,1,60,FALSE,1,92,TRUE,1,60,FALSE,1,50,FALSE,1,83,TRUE,0,50,FALSE,0,53,FALSE,0,52,TRUE,1,59,0.3721,0.16,0.0025,0.25,0.1681,0.0001,0.16,0.2116,0.25,0.1024,0.2809,0.2704,0.25,0.2304,0.0729,0.3481,0.1764,0.25,0.0289,0.0064,0.1849,0.25,0.0169,0.16,0.25,0.25,0.2704,0.0009,0.4489,0.2809,0.25,0.4225,0.199714286,0.19795,0.201478571,6,18.75,19,59.38,4,50,5,62.5,6,75,4,50,8,50,11,68.75,63,56.25,62.25,66.75,66.75,59.56,66.44,-40.63,3.62,6.25,-0.25,-8.25,16.75,9.56,-2.31,1,3,0,3,1,0,2,2,0,2,0,0,2,1,2,2,3,0,0,2,1,1,1,0,0,2,0,1,2,1,0,0,0,2,0,3,2,1,1,1,1.6,1.2,1,1.4,0.6,1.2,0.4,1.6,1.3,0.95,1.125,5,3,4.75,1,0,0.6,-0.2,0.533333333,4,0,2,0,2,0,1,1,-2,2,1,-1,-1,1,-1,1,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),21,,0.5,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,4,8,6,2,9,5,7,1,3,4,2,3,1 +748,R_1mjyLE3w9JQjVyd,46 - 52,American,,American,Male,Somewhat agree,Agree,Somewhat agree,Agree,Agree,4,2,5,1,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,2,5,3,4,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,1,4,3,Neither agree nor disagree,Agree,Somewhat agree,Agree,Agree,4,1,2,3,5,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,4,1,5,5,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,2,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,Agree,2,3,1,5,4,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,1,2,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,4,1,5,2,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,94,TRUE,86,TRUE,85,FALSE,65,TRUE,100,FALSE,86,TRUE,97,TRUE,91,TRUE,85,TRUE,86,FALSE,63,TRUE,74,FALSE,80,TRUE,86,TRUE,84,TRUE,97,TRUE,75,TRUE,87,TRUE,74,FALSE,87,TRUE,64,TRUE,89,FALSE,79,TRUE,75,FALSE,76,TRUE,82,TRUE,72,FALSE,74,TRUE,81,TRUE,81,FALSE,61,TRUE,89,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,2,2,1,0,1,-1,1,1,1,2,0,2,0,0,1,1,0,0,2,1,2,2,6,1,-1,1,-1,1,5,1,1,2,0,1,5,1,0,1,1,1,6,0,2,0,2,2,5,1,-1,1,-1,1,6,1,1,1,0,2,6,0,1,1,0,0,6,TRUE,0,94,TRUE,1,86,TRUE,0,85,FALSE,1,65,TRUE,1,100,FALSE,1,86,TRUE,1,97,TRUE,1,91,TRUE,1,85,TRUE,1,86,FALSE,1,63,TRUE,0,74,FALSE,0,80,TRUE,0,86,TRUE,1,84,TRUE,1,97,TRUE,0,75,TRUE,0,87,TRUE,0,74,FALSE,1,87,TRUE,1,64,TRUE,1,89,FALSE,1,79,TRUE,1,75,FALSE,1,76,TRUE,1,82,TRUE,0,72,FALSE,1,74,TRUE,0,81,TRUE,1,81,FALSE,0,61,TRUE,1,89,0.0081,0.0324,0.0009,0.0009,0.0121,0.0196,0.0625,0.0196,0.0169,0.0121,0.0361,0.64,0.0225,0.1369,0,0.0196,0.0441,0.1225,0.0676,0.0576,0.1296,0.0256,0.5476,0.7396,0.5625,0.5184,0.3721,0.8836,0.7225,0.7569,0.6561,0.5476,0.27685,0.083178571,0.470521429,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,14,87.5,7,43.75,81.41,73.75,81.75,87.12,83,84.19,78.62,-3.13,15.78,11.25,19.25,24.62,8,-3.31,34.87,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0.2,0.2,0.2,0.4,0.4,0.2,0.2,0.4,0.25,0.3,0.275,5.33,5.67,5.625,-0.2,0,0,0,-0.066666667,1,-1,-1,0,-0.34,1,1,2,-1,1,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,49,n/a,0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,01DIR,8,6,7,4,9,5,2,1,3,2,4,3,1 +749,R_5QL9v7f7GSirI4c,32 - 38,American,,American,Male,Somewhat disagree,Agree,Agree,Somewhat disagree,Somewhat agree,5,2,3,4,1,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,1,2,5,3,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,3,4,5,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,2,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat disagree,Agree,Agree,Disagree,Agree,1,2,5,3,4,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,4,5,3,2,1,2,Agree,Agree,Agree,Disagree,Agree,3,4,5,1,2,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Agree,3,5,1,2,4,3,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,4,5,2,1,2,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,2,3,5,4,1,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,3,1,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,76,TRUE,69,FALSE,100,TRUE,78,TRUE,92,TRUE,100,FALSE,84,FALSE,100,FALSE,86,TRUE,81,FALSE,100,FALSE,72,TRUE,100,FALSE,65,TRUE,100,FALSE,76,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,93,TRUE,100,TRUE,73,FALSE,100,TRUE,100,FALSE,60,TRUE,100,TRUE,94,TRUE,100,21,-1,2,2,-1,1,-2,-2,2,-2,0,2,1,2,0,2,1,-1,0,1,-1,-1,2,2,-2,2,2,-1,-2,2,-2,1,1,2,2,2,-2,2,2,-1,-1,1,0,-2,5,0,2,2,-1,2,7,-2,-2,2,-2,0,3,2,2,1,-1,2,2,-1,0,-1,0,-1,1,TRUE,0,100,TRUE,1,94,TRUE,0,100,FALSE,1,60,TRUE,1,100,FALSE,1,100,TRUE,1,73,TRUE,1,100,TRUE,1,93,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,76,TRUE,1,100,FALSE,1,65,TRUE,0,100,FALSE,1,72,FALSE,1,100,TRUE,1,81,FALSE,0,86,FALSE,1,100,FALSE,0,84,TRUE,0,100,TRUE,1,92,TRUE,0,78,FALSE,1,100,TRUE,0,69,FALSE,0,76,TRUE,1,100,TRUE,1,100,0,0.0064,0,0.0729,0,0,0.7056,0,0,0.7396,0.5776,0,0.0049,0,0,0.0036,0,0.16,0,1,0.0361,0.5776,0.0784,0,0.1225,0.6084,0,1,1,1,0.4761,0,0.288942857,0.156521429,0.421364286,21,65.63,22,68.75,6,75,7,87.5,4,50,5,62.5,12,75,10,62.5,90.59,84.12,89.38,93.88,95,90.94,90.25,-3.12,21.84,9.12,1.88,43.88,32.5,15.94,27.75,0,0,0,1,1,1,0,0,0,1,0,1,0,2,0,2,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,1,1,0,2,1,1,1,0,0.4,0.4,0.6,1,0.4,0,0.6,1,0.6,0.5,0.55,1.67,4,2.875,0,0.4,0,0,0.133333333,-5,-2,0,4,-2.33,0,1,1,-1,1,2,-2,-1,1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,good survey makes you think about life,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,9,6,3,4,8,5,7,1,2,4,3,2,1 +750,R_1Y5HzVbWajCz5o8,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,1,4,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,2,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,4,3,1,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,1,2,4,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,4,1,7,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,1,2,3,5,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,1,2,5,8,Agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,4,1,3,5,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,1,4,5,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,2,5,3,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,1,2,5,3,8,Strongly Agree,Agree,Somewhat agree,Strongly Agree,Agree,4,2,3,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,89,TRUE,68,TRUE,79,FALSE,58,FALSE,59,FALSE,58,TRUE,77,FALSE,55,TRUE,85,TRUE,70,FALSE,81,TRUE,76,TRUE,71,FALSE,63,TRUE,67,TRUE,57,FALSE,59,TRUE,59,FALSE,56,FALSE,56,TRUE,60,TRUE,62,FALSE,58,TRUE,60,FALSE,56,TRUE,64,FALSE,58,TRUE,57,FALSE,56,TRUE,65,FALSE,58,TRUE,60,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,7,0,1,-1,0,1,8,1,1,1,1,1,8,2,1,1,2,0,7,1,1,1,0,1,7,1,-1,1,1,0,8,1,1,1,1,0,8,3,2,1,3,2,8,FALSE,1,89,TRUE,1,68,TRUE,0,79,FALSE,1,58,FALSE,0,59,FALSE,1,58,TRUE,1,77,FALSE,0,55,TRUE,1,85,TRUE,1,70,FALSE,1,81,TRUE,0,76,TRUE,1,71,FALSE,1,63,TRUE,1,67,TRUE,1,57,FALSE,1,59,TRUE,0,59,FALSE,1,56,FALSE,1,56,TRUE,1,60,TRUE,1,62,FALSE,1,58,TRUE,1,60,FALSE,1,56,TRUE,1,64,FALSE,1,58,TRUE,0,57,FALSE,1,56,TRUE,1,65,FALSE,0,58,TRUE,1,60,0.3025,0.1296,0.1849,0.0529,0.16,0.1764,0.16,0.09,0.1936,0.1444,0.1225,0.0841,0.0225,0.0361,0.3481,0.1024,0.1764,0.1764,0.3249,0.1936,0.16,0.1089,0.1936,0.1369,0.1681,0.1764,0.3364,0.0121,0.6241,0.3481,0.1936,0.5776,0.198114286,0.14235,0.253878571,16,50,25,78.13,7,87.5,7,87.5,7,87.5,4,50,13,81.25,12,75,64.28,66.38,60.12,67.5,63.12,64.88,63.69,-28.13,-13.85,-21.12,-27.38,-20,13.12,-16.37,-11.31,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,0,2,1,0,0,0,0,1,2,0,1,2,1,0,1.2,0,1,0.2,0.6,0.2,1.2,0.55,0.55,0.55,7.67,7.67,7.625,-0.2,0.6,-0.2,-0.2,0.066666667,0,0,0,-1,0,0,0,0,-2,2,1,-1,0,0,0,0,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),22,,0.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,5,9,6,8,3,4,7,1,2,3,4,2,1 +751,R_5tDmr9134UaAzgP,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,2,5,4,3,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,5,4,3,2,1,Somewhat Agree,Disagree,Agree,Somewhat Agree,Somewhat Agree,3,1,2,5,4,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Agree,Agree,Disagree,Somewhat agree,3,1,5,4,2,6,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,1,2,5,4,4,Agree,Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,1,5,3,4,2,7,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Strongly Agree,Somewhat agree,Somewhat disagree,Somewhat agree,1,2,4,5,3,4,Somewhat disagree,Disagree,Somewhat agree,Neither agree nor disagree,Agree,5,1,2,3,4,3,Somewhat Agree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,5,3,1,4,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat disagree,2,3,1,5,4,TRUE,66,TRUE,50,FALSE,88,TRUE,50,FALSE,50,FALSE,60,TRUE,50,TRUE,60,TRUE,65,TRUE,87,TRUE,60,TRUE,75,FALSE,70,FALSE,81,TRUE,50,TRUE,50,FALSE,56,TRUE,80,FALSE,54,FALSE,53,TRUE,65,TRUE,95,FALSE,87,TRUE,82,FALSE,96,TRUE,70,TRUE,50,FALSE,96,TRUE,81,TRUE,65,FALSE,71,TRUE,70,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,-1,1,-1,-2,-1,-1,1,1,1,-2,2,1,1,-1,-1,0,-1,-2,3,2,2,-2,1,6,0,0,2,1,1,6,2,-2,1,3,1,4,1,1,0,1,1,7,2,3,1,-1,1,4,-1,-2,1,0,2,4,1,-2,1,0,1,3,1,1,2,2,-1,4,TRUE,0,66,TRUE,1,50,FALSE,1,88,TRUE,0,50,FALSE,0,50,FALSE,1,60,TRUE,1,50,TRUE,1,60,TRUE,1,65,TRUE,1,87,TRUE,0,60,TRUE,0,75,FALSE,0,70,FALSE,1,81,TRUE,1,50,TRUE,1,50,FALSE,1,56,TRUE,0,80,FALSE,1,54,FALSE,1,53,TRUE,1,65,TRUE,1,95,FALSE,1,87,TRUE,1,82,FALSE,1,96,TRUE,1,70,TRUE,0,50,FALSE,1,96,TRUE,0,81,TRUE,1,65,FALSE,0,71,TRUE,1,70,0.16,0.09,0.25,0.25,0.09,0.16,0.0324,0.0169,0.2209,0.0025,0.1225,0.49,0.1225,0.36,0.25,0.25,0.0169,0.25,0.0016,0.0016,0.1225,0.25,0.2116,0.0361,0.1936,0.25,0.5041,0.4356,0.0144,0.64,0.6561,0.5625,0.223725,0.170328571,0.277121429,16,50,22,68.75,4,50,5,62.5,6,75,7,87.5,13,81.25,9,56.25,68.22,56.25,67.38,78.12,71.12,65.62,70.81,-18.75,-0.53,6.25,4.88,3.12,-16.38,-15.63,14.56,1,1,3,3,2,2,1,3,0,0,1,0,1,2,0,2,2,0,2,3,0,0,2,2,2,1,1,2,1,1,0,0,1,1,0,2,2,2,3,1,2,1.2,0.8,1.8,1.2,1.2,0.4,2,1.45,1.2,1.325,5.33,3.67,4.75,0.8,0,0.4,-0.2,0.4,2,2,1,3,1.66,1,2,2,-1,1,-1,1,0,0,-2,2,2,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,,1.375,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,9,2,3,5,7,6,8,1,4,2,3,4,1 +752,R_5WnDdxhOf2TFPpf,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,1,4,3,2,Strongly agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,3,5,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,4,5,3,1,2,Strongly Agree,Agree,Agree,Agree,Agree,1,5,2,4,3,Agree,Agree,Agree,Agree,Agree,2,5,3,1,4,10,Agree,Strongly agree,Somewhat agree,Strongly agree,Agree,4,5,1,2,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,10,Agree,Agree,Somewhat agree,Agree,Agree,4,2,1,5,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,3,2,5,1,4,8,Strongly agree,Somewhat agree,Strongly agree,Agree,Agree,5,2,3,1,4,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,1,4,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,92,TRUE,100,TRUE,91,TRUE,100,FALSE,80,TRUE,100,TRUE,97,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,90,TRUE,100,TRUE,80,FALSE,88,TRUE,100,TRUE,76,TRUE,92,TRUE,97,FALSE,76,TRUE,95,TRUE,97,TRUE,77,TRUE,100,FALSE,100,TRUE,77,FALSE,70,TRUE,100,TRUE,84,TRUE,88,24,3,3,3,3,1,3,1,2,1,3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,10,2,3,1,3,2,10,3,3,3,3,3,10,2,2,1,2,2,9,2,2,2,2,2,8,3,1,3,2,2,9,3,3,3,3,3,9,3,3,3,3,3,10,TRUE,0,88,TRUE,1,84,TRUE,0,100,FALSE,1,70,TRUE,1,77,FALSE,1,100,TRUE,1,100,TRUE,1,77,TRUE,1,97,TRUE,1,95,FALSE,1,76,TRUE,0,97,TRUE,1,92,TRUE,0,76,TRUE,1,100,FALSE,0,88,TRUE,0,80,TRUE,0,100,FALSE,1,90,FALSE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,0,97,TRUE,1,100,FALSE,1,80,TRUE,0,100,TRUE,0,91,TRUE,1,100,FALSE,0,92,TRUE,1,100,0.0529,0,0.7744,0,0,0,0,0.0025,0,1,0,0.0064,0.0009,0.0576,0.0529,0.0256,0,0.09,1,0.9409,1,0,0.01,0.5776,0.64,0.04,0.8464,0.7744,1,1,0.8281,0.9409,0.386935714,0.088278571,0.685592857,24,75,19,59.38,7,87.5,5,62.5,3,37.5,4,50,12,75,7,43.75,92.09,86.12,92.5,94.5,95.25,93.88,90.31,15.62,32.71,-1.38,30,57,45.25,18.88,46.56,1,1,1,1,1,1,2,1,2,1,0,0,0,1,1,1,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,1,1,1,1,1.4,0.4,0.4,1,0.6,0.4,0.8,0.8,0.7,0.75,10,8.67,9.375,0,0.8,0,-0.4,0.266666667,2,1,1,-1,1.33,2,1,2,0,0,2,-2,1,-1,1,-1,2,10 cents,75 minutes,36 days,Male,University - Undergraduate,43,very good testing questions,0.375,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,02REV,2,4,5,7,6,3,9,1,8,3,2,4,1 +753,R_5oFdNv3wDUJVbDH,25 - 31,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,2,4,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,2,5,4,1,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,2,5,4,3,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,5,2,3,1,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,4,5,1,2,3,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,5,2,1,3,5,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,3,2,4,1,5,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,4,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,1,4,3,5,2,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,4,2,1,3,5,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,5,3,1,4,2,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,81,TRUE,75,FALSE,79,TRUE,57,TRUE,73,FALSE,71,FALSE,57,TRUE,75,TRUE,57,TRUE,55,FALSE,59,TRUE,51,FALSE,73,FALSE,77,FALSE,53,TRUE,57,FALSE,53,FALSE,51,TRUE,54,TRUE,61,TRUE,55,TRUE,61,TRUE,53,TRUE,73,FALSE,74,TRUE,72,TRUE,55,TRUE,55,TRUE,57,FALSE,57,TRUE,55,TRUE,91,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,1,2,0,0,0,-1,1,0,1,0,-1,1,-1,0,0,0,-1,0,1,0,1,2,5,1,-1,0,0,1,5,-1,0,0,-1,-1,5,0,1,0,1,0,5,1,1,0,1,2,5,1,-1,0,0,1,5,0,1,0,-1,0,5,0,1,1,1,0,5,FALSE,1,81,TRUE,1,75,FALSE,1,79,TRUE,0,57,TRUE,1,73,FALSE,1,71,FALSE,0,57,TRUE,1,75,TRUE,1,57,TRUE,1,55,FALSE,1,59,TRUE,0,51,FALSE,0,73,FALSE,1,77,FALSE,0,53,TRUE,1,57,FALSE,1,53,FALSE,1,51,TRUE,0,54,TRUE,0,61,TRUE,1,55,TRUE,1,61,TRUE,0,53,TRUE,1,73,FALSE,1,74,TRUE,1,72,TRUE,0,55,TRUE,0,55,TRUE,0,57,FALSE,0,57,TRUE,1,55,TRUE,1,91,0.0625,0.0784,0.1849,0.3249,0.0081,0.0841,0.0729,0.2025,0.3721,0.1521,0.3249,0.5329,0.1849,0.1681,0.0729,0.0625,0.2809,0.3249,0.3025,0.0676,0.2025,0.2809,0.2916,0.0529,0.2209,0.3025,0.2025,0.0361,0.0441,0.2401,0.3249,0.2601,0.202607143,0.203128571,0.202085714,17,53.13,20,62.5,4,50,5,62.5,7,87.5,4,50,12,75,8,50,63.34,58.12,65.75,66,63.5,64.94,61.75,-9.37,0.84,8.12,3.25,-21.5,13.5,-10.06,11.75,1,0,1,0,0,1,1,0,1,0,1,1,0,0,2,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,1,1,0.4,0.6,0.8,0.8,0.2,0.6,0.2,1,0.65,0.5,0.575,5,5,5,0.2,0,0.6,-0.2,0.266666667,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,-1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,"it was fun, some question was a little bit hard ",0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,5,6,8,2,9,4,7,1,3,3,2,4,1 +754,R_7d0MjTxC7gmGqE1,39 - 45,American,,American,Male,Somewhat agree,Agree,Strongly agree,Agree,Strongly agree,3,5,1,2,4,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,5,4,1,3,2,Strongly Agree,Agree,Somewhat Agree,Strongly Agree,Agree,3,2,5,1,4,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,1,4,3,2,5,10,Agree,Somewhat agree,Strongly agree,Strongly agree,Agree,2,5,1,4,3,10,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,2,5,4,1,3,10,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,5,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Agree,Somewhat agree,Strongly Agree,Agree,4,5,3,1,2,10,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,5,4,1,2,3,9,Agree,Agree,Somewhat Agree,Strongly agree,Strongly agree,4,2,5,1,3,9,Strongly Agree,Agree,Strongly Agree,Somewhat agree,Agree,1,5,4,3,2,FALSE,100,TRUE,94,FALSE,95,TRUE,74,TRUE,97,FALSE,99,TRUE,100,TRUE,95,TRUE,94,TRUE,98,FALSE,100,TRUE,85,TRUE,95,FALSE,100,FALSE,87,TRUE,100,TRUE,89,TRUE,90,FALSE,96,FALSE,86,TRUE,100,TRUE,92,FALSE,100,TRUE,100,FALSE,96,FALSE,99,FALSE,99,FALSE,94,FALSE,96,FALSE,93,TRUE,95,TRUE,91,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,3,2,3,1,1,3,3,1,3,2,1,3,2,2,1,2,3,1,3,2,3,2,1,10,2,1,3,3,2,10,2,2,3,3,1,10,2,2,3,3,1,10,3,2,1,3,2,10,2,3,3,2,1,10,2,2,1,3,3,9,3,2,3,1,2,9,FALSE,1,100,TRUE,1,94,FALSE,1,95,TRUE,0,74,TRUE,1,97,FALSE,1,99,TRUE,1,100,TRUE,1,95,TRUE,1,94,TRUE,1,98,FALSE,1,100,TRUE,0,85,TRUE,1,95,FALSE,1,100,FALSE,0,87,TRUE,1,100,TRUE,0,89,TRUE,0,90,FALSE,1,96,FALSE,1,86,TRUE,1,100,TRUE,1,92,FALSE,1,100,TRUE,1,100,FALSE,1,96,FALSE,0,99,FALSE,1,99,FALSE,1,94,FALSE,1,96,FALSE,0,93,TRUE,1,95,TRUE,1,91,0.0025,0.9801,0,0,0.0081,0.0001,0,0.0004,0.0196,0.0064,0.8649,0.0025,0.0036,0,0.0009,0.0036,0,0.5476,0.0036,0.0016,0,0.7569,0.0016,0,0.7921,0.0001,0.0025,0,0.0025,0.81,0.0016,0.7225,0.162596429,0.104121429,0.221071429,32,100,25,78.13,6,75,7,87.5,6,75,6,75,13,81.25,12,75,94.66,92.38,95.88,96.88,93.5,95.62,93.69,21.87,16.53,17.38,8.38,21.88,18.5,14.37,18.69,2,0,0,0,2,1,0,0,0,1,1,0,2,0,1,0,1,1,0,0,2,0,2,1,1,1,2,0,1,0,1,0,0,0,1,1,1,1,2,1,0.8,0.4,0.8,0.4,1.2,0.8,0.4,1.2,0.6,0.9,0.75,10,9.67,9.75,-0.4,-0.4,0.4,-0.8,-0.133333333,0,0,1,1,0.33,2,1,2,2,-2,2,-2,1,-1,2,-2,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,41,nice survey i like it very much,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,5,6,7,3,2,8,4,1,9,4,3,2,1 +755,R_30cvYfnM8L8PEKS,18 - 24,,Canadian,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,1,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,3,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,4,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,85,FALSE,63,TRUE,95,TRUE,87,TRUE,95,FALSE,69,TRUE,96,FALSE,88,TRUE,76,TRUE,75,FALSE,74,TRUE,91,FALSE,79,TRUE,88,FALSE,85,TRUE,87,TRUE,76,FALSE,84,TRUE,85,TRUE,85,TRUE,92,FALSE,64,TRUE,82,TRUE,94,TRUE,84,TRUE,74,FALSE,92,FALSE,83,FALSE,72,TRUE,79,TRUE,89,FALSE,68,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,FALSE,1,68,TRUE,1,89,TRUE,0,79,FALSE,1,72,FALSE,0,83,FALSE,1,92,TRUE,1,74,TRUE,1,84,TRUE,1,94,TRUE,1,82,FALSE,1,64,TRUE,0,92,TRUE,1,85,TRUE,0,85,FALSE,0,84,TRUE,1,76,TRUE,0,87,FALSE,1,85,TRUE,0,88,FALSE,1,79,TRUE,1,91,FALSE,0,74,TRUE,0,75,TRUE,1,76,FALSE,1,88,TRUE,1,96,FALSE,1,69,TRUE,0,95,TRUE,0,87,TRUE,1,95,FALSE,0,63,FALSE,0,85,0.0256,0.0016,0.0576,0.0676,0.7225,0.0064,0.0576,0.0324,0.0441,0.5476,0.0025,0.0225,0.0036,0.1296,0.6889,0.0121,0.5625,0.0784,0.9025,0.0144,0.0081,0.7056,0.7744,0.7225,0.7569,0.0961,0.3969,0.1024,0.6241,0.0225,0.7569,0.8464,0.3443,0.207907143,0.480692857,26,81.25,19,59.38,5,62.5,3,37.5,6,75,5,62.5,11,68.75,8,50,82.38,77.88,85.62,81.5,84.5,83.19,81.56,21.87,23,15.38,48.12,6.5,22,14.44,31.56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6.33,6,0,0,0,0,0,-1,0,0,-1,-0.33,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,23,,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,9,8,4,3,5,7,2,1,6,2,3,4,1 +756,R_5hWQ8LJnGFnQkcP,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,1,4,Neither agree nor disagree,Disagree,Somewhat agree,Agree,Agree,4,1,5,3,2,Agree,Somewhat Disagree,Strongly Agree,Agree,Strongly Agree,2,1,3,5,4,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly disagree,Somewhat agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,1,5,3,2,4,2,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,Agree,1,2,3,4,5,6,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,2,4,5,10,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,4,5,3,8,Somewhat agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,3,2,4,5,1,2,Agree,Disagree,Strongly agree,Agree,Strongly agree,5,3,4,1,2,10,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,3,2,4,5,FALSE,85,FALSE,50,TRUE,70,FALSE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,96,TRUE,50,TRUE,100,FALSE,60,TRUE,50,TRUE,100,FALSE,100,TRUE,50,TRUE,65,FALSE,50,TRUE,92,TRUE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,63,FALSE,62,TRUE,50,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,3,3,0,-2,1,2,2,2,-1,3,2,3,-1,2,-1,1,-1,-3,1,3,-3,0,5,-3,1,-3,3,2,2,1,0,2,0,1,6,1,-1,2,-2,1,10,2,3,3,3,3,8,1,-2,3,-1,3,8,2,-2,3,2,3,2,2,2,2,2,0,10,FALSE,1,85,FALSE,0,50,TRUE,0,70,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,50,TRUE,1,96,TRUE,1,50,TRUE,1,100,FALSE,1,60,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,65,FALSE,1,50,TRUE,0,92,TRUE,0,50,FALSE,1,50,FALSE,0,100,FALSE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,0,63,FALSE,0,62,TRUE,1,50,0.0016,0.25,0.1225,0.25,0.25,0,0.25,0,0.25,0.25,0.3969,0,0.25,0.16,0.25,0.25,1,0.25,0.25,0.25,1,0.25,0.25,0,0.25,0.25,0.3844,0.0225,0.49,0.8464,0.25,0.25,0.296435714,0.254064286,0.338807143,13,40.63,19,59.38,4,50,6,75,5,62.5,4,50,11,68.75,8,50,65.41,52.75,75,72.12,61.75,64.75,66.06,-18.75,6.03,2.75,0,9.62,11.75,-4,16.06,5,2,0,6,3,3,3,4,1,0,1,1,1,2,2,2,3,3,3,2,0,0,0,0,0,1,0,2,3,1,0,1,0,0,0,3,0,3,1,1,3.2,2.2,1.4,2.6,0,1.4,0.2,1.6,2.35,0.8,1.575,4.33,6,6.375,3.2,0.8,1.2,1,1.733333333,-3,-6,4,0,-1.67,2,0,1,-2,2,1,-1,2,-2,-2,2,1,15 cents,5 minutes,15 days,Female,High School (or equivalent),18,I wish I could see my progress throughout the survey (progress bar),0.625,0,1,0,0,0,0,0.33,0,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,6,3,2,9,7,8,4,1,5,3,4,2,1 +757,R_52VDrdvaO5dhjEE,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,5,2,4,3,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,5,2,3,1,4,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Somewhat Agree,2,3,4,5,1,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,2,1,4,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,5,1,4,3,1,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,4,3,5,2,1,3,Agree,Strongly Agree,Agree,Somewhat Disagree,Agree,5,3,2,4,1,5,Somewhat disagree,Agree,Agree,Neither agree nor disagree,Agree,4,2,3,5,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,1,Strongly agree,Agree,Strongly agree,Somewhat disagree,Strongly agree,1,3,4,2,5,8,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,2,3,1,5,4,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,5,4,3,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,92,TRUE,75,FALSE,100,TRUE,51,TRUE,72,FALSE,100,TRUE,83,TRUE,85,TRUE,57,TRUE,62,FALSE,62,FALSE,92,FALSE,76,FALSE,54,TRUE,75,TRUE,59,FALSE,56,TRUE,65,FALSE,51,FALSE,52,TRUE,60,TRUE,52,TRUE,61,TRUE,52,FALSE,99,TRUE,90,TRUE,58,FALSE,58,FALSE,51,TRUE,100,TRUE,55,TRUE,79,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,1,0,2,2,2,1,2,-1,3,1,1,-2,0,-1,1,0,3,3,3,3,2,1,0,-1,0,-1,3,3,2,3,2,-1,2,5,-1,2,2,0,2,7,2,3,2,3,3,1,3,2,3,-1,3,8,3,-1,3,0,2,6,3,3,3,3,2,10,FALSE,1,92,TRUE,1,75,FALSE,1,100,TRUE,0,51,TRUE,1,72,FALSE,1,100,TRUE,1,83,TRUE,1,85,TRUE,1,57,TRUE,1,62,FALSE,1,62,FALSE,1,92,FALSE,0,76,FALSE,1,54,TRUE,1,75,TRUE,1,59,FALSE,1,56,TRUE,0,65,FALSE,1,51,FALSE,1,52,TRUE,1,60,TRUE,1,52,TRUE,0,61,TRUE,1,52,FALSE,1,99,TRUE,1,90,TRUE,0,58,FALSE,1,58,FALSE,1,51,TRUE,1,100,TRUE,1,55,TRUE,1,79,0.0225,0.01,0.1681,0.0289,0.0441,0,0.2304,0.1444,0.2304,0.2304,0,0.5776,0.1849,0.1444,0.0784,0.0625,0.3721,0.2601,0.1764,0.0001,0.16,0.0625,0.2401,0.2116,0.1936,0.3364,0.2025,0.0064,0,0.4225,0.2401,0.0064,0.172082143,0.182835714,0.161328571,16,50,27,84.38,6,75,6,75,7,87.5,8,100,15,93.75,12,75,69.81,60.5,69.38,74.62,74.75,70.75,68.88,-34.38,-14.57,-14.5,-5.62,-12.88,-25.25,-23,-6.12,0,0,0,0,1,0,3,2,3,2,0,4,1,2,1,1,2,3,1,2,1,0,1,0,2,3,0,1,3,2,1,0,0,1,1,5,3,4,2,2,0.2,2,1.6,1.8,0.8,1.8,0.6,3.2,1.4,1.6,1.5,3,5,5.125,-0.6,0.2,1,-1.4,0.2,0,-5,-1,-3,-2,2,1,0,-2,2,1,-1,-1,1,-1,1,1,10 cents,25 minutes,15 days,Female,High School (or equivalent),19,n/a :),0.875,0,0,0,1,0,0,0,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,6,7,3,8,5,9,4,1,2,2,3,4,1 +758,R_3OeHvPqMYqgioPE,25 - 31,,Canadian,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,3,5,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,4,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,4,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,76,TRUE,50,TRUE,58,FALSE,50,TRUE,63,FALSE,50,TRUE,84,FALSE,50,TRUE,70,FALSE,76,FALSE,50,TRUE,58,FALSE,50,FALSE,50,TRUE,71,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,54,FALSE,55,TRUE,55,TRUE,54,FALSE,57,TRUE,58,FALSE,57,FALSE,59,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,59,FALSE,0,57,TRUE,0,58,FALSE,1,57,TRUE,1,54,TRUE,0,55,FALSE,0,55,FALSE,0,54,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,71,FALSE,1,50,FALSE,1,50,TRUE,1,58,FALSE,0,50,FALSE,1,76,TRUE,1,70,FALSE,1,50,TRUE,1,84,FALSE,1,50,TRUE,0,63,FALSE,1,50,TRUE,1,58,TRUE,1,50,TRUE,1,76,0.2916,0.0256,0.25,0.3025,0.0576,0.3025,0.09,0.25,0.25,0.25,0.1764,0.25,0.25,0.25,0.2116,0.3249,0.0576,0.1849,0.3969,0.25,0.1764,0.25,0.25,0.25,0.25,0.25,0.25,0.1681,0.3364,0.5041,0.25,0.25,0.240621429,0.207535714,0.273707143,11,34.38,19,59.38,5,62.5,6,75,4,50,4,50,7,43.75,12,75,56.41,51.75,58.62,58.62,56.62,57.25,55.56,-25,-2.97,-10.75,-16.38,8.62,6.62,13.5,-19.44,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0,0,0.05,0,0.025,5,5,5,0.2,0,0,0,0.066666667,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 cents,100 minutes,24 days,Female,High School (or equivalent),26,,0,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,3,6,9,4,5,8,2,1,7,4,3,2,1 +759,R_1B3q9bSFF0Y7SCZ,18 - 24,,Canadian,Canadian,Female,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,Agree,2,3,4,1,5,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,1,3,4,5,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,2,1,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,1,3,2,5,4,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,1,5,2,4,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,5,3,4,2,1,8,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,2,1,4,5,3,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,4,1,5,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,3,2,3,Disagree,Agree,Agree,Strongly agree,Agree,1,5,4,3,2,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,5,3,1,3,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,50,FALSE,68,FALSE,63,TRUE,60,FALSE,63,TRUE,83,FALSE,60,FALSE,62,TRUE,70,FALSE,71,TRUE,60,TRUE,71,FALSE,64,FALSE,81,TRUE,92,FALSE,76,TRUE,67,FALSE,62,FALSE,59,TRUE,64,TRUE,64,TRUE,50,TRUE,74,FALSE,68,TRUE,66,FALSE,63,FALSE,59,FALSE,58,TRUE,67,FALSE,68,FALSE,64,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,1,3,2,-3,1,1,3,1,1,0,2,0,0,-3,-3,-3,-3,-2,0,3,3,3,0,5,1,-1,0,1,-2,8,2,3,1,3,1,5,-3,-3,-3,-3,-2,2,1,3,3,3,3,3,-2,2,2,3,2,7,0,0,1,1,1,3,2,0,1,0,0,4,TRUE,0,70,TRUE,1,50,FALSE,1,68,FALSE,1,63,TRUE,1,60,FALSE,1,63,TRUE,1,83,FALSE,0,60,FALSE,0,62,TRUE,1,70,FALSE,1,71,TRUE,0,60,TRUE,1,71,FALSE,1,64,FALSE,0,81,TRUE,1,92,FALSE,1,76,TRUE,0,67,FALSE,1,62,FALSE,1,59,TRUE,1,64,TRUE,1,64,TRUE,0,50,TRUE,1,74,FALSE,1,68,TRUE,1,66,FALSE,1,63,FALSE,1,59,FALSE,1,58,TRUE,1,67,FALSE,0,68,FALSE,0,64,0.36,0.1156,0.0064,0.0289,0.4096,0.1369,0.0676,0.09,0.1681,0.1296,0.1089,0.0841,0.3844,0.0841,0.16,0.25,0.25,0.1369,0.1681,0.1024,0.1296,0.6561,0.1444,0.1296,0.0576,0.1369,0.4624,0.49,0.1024,0.4489,0.1764,0.36,0.215178571,0.175728571,0.254628571,32,100,23,71.88,5,62.5,6,75,6,75,6,75,11,68.75,12,75,66.16,65,63.25,69,67.38,68.5,63.81,28.12,-5.72,2.5,-11.75,-6,-7.62,-0.25,-11.19,0,0,2,0,2,4,2,1,2,3,1,3,1,3,1,0,0,0,0,0,1,0,2,0,1,1,1,1,0,1,1,0,1,1,1,5,3,4,3,2,0.8,2.4,1.8,0,0.8,0.8,0.8,3.4,1.25,1.45,1.35,6,4.33,4.625,0,1.6,1,-3.4,0.866666667,2,1,2,-2,1.67,1,2,1,-1,1,1,-1,1,-1,2,-2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),20,no,0.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,8,6,3,4,7,9,5,1,2,2,4,3,1 +760,R_7dfOXQgqKbzUjGY,25 - 31,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,2,5,3,1,4,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,1,4,3,5,Agree,Agree,Agree,Somewhat Agree,Agree,5,4,1,3,2,Somewhat agree,Disagree,Agree,Agree,Disagree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,3,4,5,2,1,8,Disagree,Disagree,Agree,Disagree,Somewhat agree,1,4,2,3,5,8,Agree,Agree,Agree,Agree,Agree,5,2,1,4,3,0,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,2,5,4,3,1,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,4,5,3,2,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,5,1,3,4,2,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,2,1,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,80,TRUE,80,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,80,FALSE,100,TRUE,80,FALSE,80,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,25,1,3,2,-1,3,0,-2,2,-1,0,2,2,2,1,2,1,-2,2,2,-2,2,3,3,-2,3,7,-2,-2,2,-2,1,8,2,2,2,2,2,8,-1,0,1,1,0,0,2,1,1,1,2,4,1,0,0,1,0,4,1,0,2,1,0,5,2,1,0,0,1,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,FALSE,1,80,TRUE,0,80,FALSE,1,100,FALSE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,80,FALSE,1,80,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,0.25,0,0,0,0,0.25,0,0,0,0,1,0.04,1,0.64,0.25,0.64,1,1,0.64,1,0,1,0.04,1,1,0.383928571,0.107142857,0.660714286,25,78.13,18,56.25,2,25,5,62.5,5,62.5,6,75,11,68.75,7,43.75,92.19,82.5,97.5,91.25,97.5,89.38,95,21.88,35.94,57.5,35,28.75,22.5,20.63,51.25,1,0,1,1,0,2,0,0,1,1,0,0,0,1,0,2,2,1,1,2,1,2,1,2,1,1,2,2,2,0,1,2,0,0,2,1,3,2,2,3,0.6,0.8,0.2,1.6,1.4,1.4,1,2.2,0.8,1.5,1.15,7.67,4.33,4.75,-0.8,-0.6,-0.8,-0.6,-0.733333333,3,4,3,-2,3.34,0,1,1,-1,1,2,-2,1,-1,-1,1,0,10 cents,100 minutes,36 days,Female,Professional Degree (ex. JD/MD),25,thank you ,0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,8,4,6,3,9,2,5,1,7,2,4,3,1 +761,R_5lF9fKPJczQMLnL,39 - 45,American,,American,Male,Agree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,1,4,5,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Somewhat Agree,2,5,1,4,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,1,4,2,2,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,4,2,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Strongly Agree,Somewhat agree,Agree,Neither agree nor disagree,1,4,5,2,3,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,4,5,3,1,1,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Agree,Somewhat Agree,1,2,4,3,5,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,3,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,52,FALSE,76,TRUE,91,FALSE,80,TRUE,73,TRUE,94,FALSE,100,TRUE,72,FALSE,90,TRUE,100,TRUE,95,FALSE,100,TRUE,80,TRUE,93,TRUE,75,TRUE,100,FALSE,87,FALSE,96,FALSE,100,TRUE,94,FALSE,88,FALSE,100,TRUE,100,TRUE,100,TRUE,94,FALSE,100,TRUE,100,TRUE,68,FALSE,95,FALSE,81,FALSE,96,28,2,3,1,1,0,1,0,2,0,1,0,0,3,1,1,0,0,1,1,0,3,2,2,1,0,5,0,0,1,0,1,4,0,-1,3,0,1,2,1,1,0,0,0,4,1,3,1,2,0,3,0,0,2,0,1,2,0,-1,3,2,1,1,0,0,1,1,0,4,FALSE,1,96,FALSE,0,81,FALSE,1,95,TRUE,0,68,TRUE,1,100,FALSE,1,100,TRUE,1,94,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,88,TRUE,0,94,FALSE,0,100,FALSE,1,96,FALSE,0,87,TRUE,1,100,TRUE,0,75,TRUE,0,93,TRUE,0,80,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,90,TRUE,1,72,FALSE,1,100,TRUE,1,94,TRUE,0,73,FALSE,1,80,TRUE,0,91,FALSE,0,76,FALSE,0,52,TRUE,1,100,0,0.0036,0,0.0036,0,0,0.0784,1,0,0,0.5776,1,0,0.0144,0,0.6561,0.01,0.4624,0.04,0,0.0025,0.7569,0.64,0.0016,0.5625,0.5329,0.2704,0.0016,0.0025,0.8649,0.8281,0.8836,0.328085714,0.27135,0.384821429,28,87.5,19,59.38,2,25,5,62.5,6,75,6,75,10,62.5,9,56.25,89.69,78.62,93.88,96.62,89.62,90.69,88.69,28.12,30.31,53.62,31.38,21.62,14.62,28.19,32.44,1,1,1,0,0,1,0,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0.6,0.4,0.4,0.8,0.4,0.2,0.4,0,0.55,0.25,0.4,3.67,2,3.125,0.2,0.2,0,0.8,0.133333333,2,2,1,0,1.67,1,2,1,0,0,-1,1,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,44,,1.25,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,7,6,4,9,2,5,8,1,3,3,2,4,1 +762,R_5Mz0tsSQPdptHFL,46 - 52,American,,American,Male,Somewhat disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,4,3,1,2,5,Strongly disagree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,5,4,2,3,1,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Neither Agree nor Disagree,3,2,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly Agree,5,3,4,2,1,Strongly disagree,Somewhat agree,Strongly Agree,Somewhat disagree,Somewhat agree,2,5,1,3,4,6,Somewhat agree,Somewhat agree,Agree,Strongly agree,Somewhat disagree,2,3,4,5,1,3,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,4,2,1,5,Somewhat disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly Agree,5,1,3,2,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Strongly Agree,Strongly Agree,Agree,1,4,2,5,3,4,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,5,2,1,4,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,3,4,2,5,1,6,Somewhat agree,Neither agree nor disagree,Agree,Agree,Strongly Agree,4,2,1,5,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,52,TRUE,76,TRUE,61,FALSE,63,FALSE,64,TRUE,100,TRUE,78,TRUE,63,FALSE,53,FALSE,60,TRUE,75,TRUE,64,TRUE,80,FALSE,54,TRUE,65,FALSE,65,TRUE,79,FALSE,69,FALSE,73,TRUE,75,FALSE,56,FALSE,72,TRUE,69,TRUE,75,TRUE,72,TRUE,66,TRUE,60,TRUE,65,TRUE,66,TRUE,70,TRUE,100,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,1,3,3,1,-3,1,3,2,0,1,1,2,-1,0,0,0,1,0,3,-3,1,3,-1,1,6,1,1,2,3,-1,3,3,2,2,0,1,5,-1,-3,0,-3,3,6,-1,1,3,3,2,4,2,3,3,3,-1,2,3,3,3,2,1,6,1,0,2,2,3,4,TRUE,0,100,TRUE,1,52,TRUE,0,76,TRUE,0,61,FALSE,0,63,FALSE,1,64,TRUE,1,100,TRUE,1,78,TRUE,1,63,FALSE,0,53,FALSE,1,60,TRUE,0,75,TRUE,1,64,TRUE,0,80,FALSE,0,54,TRUE,1,65,FALSE,1,65,TRUE,0,79,FALSE,1,69,FALSE,1,73,TRUE,1,75,FALSE,0,56,FALSE,1,72,TRUE,1,69,TRUE,0,75,TRUE,1,72,TRUE,0,66,TRUE,0,60,TRUE,0,65,TRUE,1,66,TRUE,1,70,TRUE,1,100,0.0484,0.0784,0.1225,0,0,0.1296,0.0961,0.2809,0.0729,0.3136,0.1156,0.1296,0.1369,0.16,0.3969,0.2304,0.0784,0.3721,0.36,0.5625,0.0625,0.2916,0.0961,0.64,0.1225,0.4356,0.09,1,0.5776,0.6241,0.4225,0.5625,0.298589286,0.1795,0.417678571,10,31.25,18,56.25,5,62.5,6,75,2,25,5,62.5,12,75,6,37.5,70,61.88,71,76.88,70.25,68.75,71.25,-25,13.75,-0.62,-4,51.88,7.75,-6.25,33.75,2,0,0,4,0,4,0,1,1,1,2,1,0,1,1,1,3,1,3,0,0,0,0,0,1,5,2,0,1,1,2,2,1,3,1,1,0,1,2,0,1.2,1.4,1,1.6,0.2,1.8,1.8,0.8,1.3,1.15,1.225,4.67,4,4.5,1,-0.4,-0.8,0.8,-0.066666667,2,1,-1,2,0.67,-1,-1,-1,0,0,1,-1,0,0,0,0,-1,10 cents,25 minutes,24 days,Male,High School (or equivalent),51,,-0.625,0,0,0,1,0,1,0,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,6,8,9,4,5,2,3,1,7,4,3,2,1 +763,R_6ixPXVWXRaYMHnt,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,3,5,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,2,1,4,5,3,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,4,1,2,5,10,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,1,4,2,3,5,7,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,4,5,10,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,4,2,5,1,8,Agree,Agree,Strongly agree,Strongly agree,Agree,1,5,2,3,4,10,Strongly Agree,Somewhat agree,Agree,Strongly Agree,Disagree,2,4,1,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,32,3,3,3,3,3,1,1,3,-2,1,1,3,3,3,3,3,3,3,3,3,3,3,2,2,3,6,1,3,3,3,3,10,3,3,3,1,1,10,3,3,2,3,2,7,3,3,3,3,3,10,2,3,3,1,3,10,2,2,3,3,2,8,3,1,2,3,-2,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0.071428571,0.071428571,0.071428571,32,100,30,93.75,8,100,7,87.5,7,87.5,8,100,15,93.75,15,93.75,100,100,100,100,100,100,100,6.25,6.25,0,12.5,12.5,0,6.25,6.25,0,0,1,1,0,0,2,0,5,2,2,0,0,2,2,0,0,1,0,1,0,0,0,0,0,1,2,0,3,2,1,1,0,0,1,0,2,1,0,5,0.4,1.8,1.2,0.4,0,1.6,0.6,1.6,0.95,0.95,0.95,8.67,9.33,8.875,0.4,0.2,0.6,-1.2,0.4,-4,0,2,-3,-0.66,2,1,2,2,-2,2,-2,2,-2,2,-2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),39,the survey was clear and well-organized. I appreciated the mix of factual and reflective questions.,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,02REV,4,6,3,5,2,7,8,1,9,4,3,2,1 +764,R_32E5t5jnIUY070h,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,1,2,3,5,Agree,Agree,Strongly agree,Agree,Somewhat agree,3,2,1,4,5,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,4,3,5,2,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,5,3,4,2,1,Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,4,2,1,5,10,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,2,4,3,5,1,9,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Agree,Strongly Agree,4,1,3,2,5,9,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly disagree,Somewhat disagree,4,1,5,2,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,5,3,1,2,8,Somewhat disagree,Disagree,Strongly agree,Strongly disagree,Agree,5,1,4,2,3,8,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,1,4,3,5,2,8,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,1,3,4,5,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,80,TRUE,97,TRUE,96,FALSE,96,FALSE,91,FALSE,89,TRUE,92,TRUE,96,FALSE,77,TRUE,91,FALSE,80,TRUE,86,FALSE,96,FALSE,93,FALSE,76,TRUE,98,FALSE,100,FALSE,100,FALSE,91,FALSE,92,TRUE,100,TRUE,70,FALSE,51,FALSE,100,FALSE,92,TRUE,93,FALSE,92,FALSE,91,FALSE,89,FALSE,100,FALSE,55,FALSE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,3,2,2,3,2,1,3,1,3,-1,3,2,3,3,1,-2,2,3,3,2,2,10,3,3,2,1,2,9,1,-1,1,2,3,9,-1,1,1,-3,-1,9,3,3,3,-2,3,8,-1,-2,3,-3,2,8,3,3,3,-2,3,8,3,3,3,2,-1,2,FALSE,1,80,TRUE,1,97,TRUE,0,96,FALSE,1,96,FALSE,0,91,FALSE,1,89,TRUE,1,92,TRUE,1,96,FALSE,0,77,TRUE,1,91,FALSE,1,80,TRUE,0,86,FALSE,0,96,FALSE,1,93,FALSE,0,76,TRUE,1,98,FALSE,1,100,FALSE,1,100,FALSE,1,91,FALSE,1,92,TRUE,1,100,TRUE,1,70,FALSE,1,51,FALSE,0,100,FALSE,1,92,TRUE,1,93,FALSE,1,92,FALSE,1,91,FALSE,1,89,FALSE,0,100,FALSE,0,55,FALSE,0,100,0.0016,0.0049,0.0004,0.0064,1,0.0121,1,0.0081,0.0064,0.09,1,0.9216,0.5929,0.04,0.8281,0.0009,0.2401,0.0016,0.0081,0.0064,0,0.5776,0.0081,0.0049,0,0.0064,0.3025,0.04,0.9216,0,0.0121,0.7396,0.298896429,0.410128571,0.187664286,17,53.13,22,68.75,5,62.5,5,62.5,8,100,4,50,8,50,14,87.5,89.06,83,89.5,88.88,94.88,89.5,88.62,-15.62,20.31,20.5,27,-11.12,44.88,39.5,1.12,1,0,0,0,1,1,1,1,1,1,2,2,2,3,0,3,2,2,4,1,0,0,0,4,0,3,4,0,5,1,0,2,0,1,0,1,0,0,1,1,0.4,1,1.8,2.4,0.8,2.6,0.6,0.6,1.4,1.15,1.275,9.33,8,7.875,-0.4,-1.6,1.2,1.8,-0.266666667,2,1,1,7,1.33,0,0,-1,-1,1,1,-1,-1,1,-1,1,2,10 cents,25 minutes,24 days,Male,University - Undergraduate,41,Fantastic survey,0.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,7,6,9,3,8,2,5,1,4,4,3,2,1 +765,R_3g2bx0A4YCg9BM7,25 - 31,,Canadian,Canadian,Male,Disagree,Strongly agree,Agree,Strongly agree,Somewhat agree,5,1,2,3,4,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,1,2,5,4,Agree,Agree,Strongly Agree,Somewhat Disagree,Agree,5,3,2,4,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,5,3,2,4,1,Disagree,Strongly Agree,Neither agree nor disagree,Agree,Somewhat disagree,3,4,1,5,2,3,Somewhat disagree,Somewhat disagree,Disagree,Agree,Somewhat disagree,2,3,1,5,4,9,Disagree,Disagree,Disagree,Disagree,Disagree,4,5,2,1,3,10,Agree,Agree,Agree,Agree,Agree,3,2,5,1,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,1,3,5,2,4,4,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,2,3,1,4,5,5,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,2,Agree,Strongly Agree,Strongly Agree,Agree,Disagree,1,5,2,4,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,FALSE,90,TRUE,100,TRUE,95,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,70,TRUE,83,FALSE,50,FALSE,92,FALSE,50,TRUE,95,FALSE,50,FALSE,50,TRUE,77,FALSE,50,FALSE,50,TRUE,95,TRUE,100,TRUE,83,FALSE,50,FALSE,50,TRUE,90,TRUE,95,FALSE,89,TRUE,72,FALSE,50,FALSE,50,TRUE,68,TRUE,92,16,-2,3,2,3,1,1,0,2,1,1,2,2,3,-1,2,-1,-1,-1,-1,0,-2,3,0,2,-1,3,-1,-1,-2,2,-1,9,-2,-2,-2,-2,-2,10,2,2,2,2,2,8,-2,3,2,3,3,4,3,3,3,-1,2,5,2,2,2,2,2,2,2,3,3,2,-2,2,TRUE,0,92,TRUE,1,68,FALSE,1,50,FALSE,1,50,TRUE,1,72,FALSE,1,89,TRUE,1,95,TRUE,1,90,FALSE,0,50,FALSE,0,50,TRUE,0,83,TRUE,0,100,TRUE,1,95,FALSE,1,50,FALSE,0,50,TRUE,1,77,FALSE,1,50,FALSE,1,50,TRUE,0,95,FALSE,1,50,FALSE,0,92,FALSE,0,50,TRUE,0,83,TRUE,1,70,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,0,95,TRUE,1,100,FALSE,0,90,FALSE,0,50,0.01,0.25,0.0529,0.0025,0.25,0.0121,0.09,0.25,0.25,0.25,0,0.0025,0.25,0.6889,0.0784,0.1024,0.6889,0.25,1,0.25,0.8464,0.25,0.9025,0.25,0.25,0.25,0.81,0.8464,0.25,0.25,0.9025,1,0.40075,0.225942857,0.575557143,16,50,17,53.13,3,37.5,4,50,4,50,6,75,8,50,9,56.25,71.44,67,78.25,60.88,79.62,71.81,71.06,-3.13,18.31,29.5,28.25,10.88,4.62,21.81,14.81,0,0,2,1,2,2,1,4,1,2,4,4,5,1,4,3,3,3,3,2,0,0,0,0,2,2,3,1,2,1,0,0,1,3,0,3,4,4,3,2,1,2,3.6,2.8,0.4,1.8,0.8,3.2,2.35,1.55,1.95,7.33,3.67,5.375,0.6,0.2,2.8,-0.4,1.2,-1,4,8,6,3.66,1,1,2,-2,2,1,-1,-1,1,1,-1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),28,It was a good one. I enjoyed it,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,5,8,6,4,2,9,3,1,7,3,2,4,1 +766,R_70ZQmEKkRKoUQPk,46 - 52,American,,American,Male,Strongly agree,Agree,Agree,Agree,Agree,2,4,1,5,3,Agree,Agree,Agree,Agree,Somewhat agree,5,3,1,4,2,Agree,Strongly Agree,Agree,Agree,Agree,4,3,2,5,1,Agree,Somewhat agree,Agree,Agree,Agree,2,1,3,5,4,Strongly Agree,Agree,Agree,Agree,Somewhat agree,3,2,1,5,4,7,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,2,5,1,4,7,Somewhat Agree,Agree,Agree,Agree,Strongly Agree,4,1,5,2,3,5,Strongly Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Agree,Somewhat agree,2,1,5,3,4,7,Agree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,3,2,8,Agree,Agree,Somewhat Agree,Agree,Agree,4,5,3,2,1,7,Agree,Agree,Agree,Somewhat agree,Agree,1,3,5,2,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,90,TRUE,100,TRUE,100,FALSE,95,TRUE,90,TRUE,90,TRUE,90,TRUE,100,FALSE,100,TRUE,100,FALSE,85,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,85,TRUE,90,TRUE,100,TRUE,100,TRUE,80,TRUE,100,TRUE,100,TRUE,90,TRUE,100,16,3,2,2,2,2,2,2,2,2,1,2,3,2,2,2,2,1,2,2,2,3,2,2,2,1,7,-2,-2,1,-2,1,7,1,2,2,2,3,5,3,2,2,2,2,6,2,2,1,2,1,7,2,-2,1,1,1,8,2,2,1,2,2,7,2,2,2,1,2,3,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,0,100,TRUE,1,80,TRUE,0,100,TRUE,1,100,TRUE,1,90,TRUE,1,85,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,0,90,TRUE,0,90,TRUE,0,90,FALSE,0,95,TRUE,1,100,TRUE,0,100,FALSE,0,90,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0.01,0,1,0,0,1,0.81,0,0.81,0,0,0,0.0225,1,0.04,0.01,1,1,1,0,0.9025,0,0.81,0.0225,1,1,1,1,1,0.81,1,1,0.579910714,0.406607143,0.753214286,16,50,14,43.75,3,37.5,3,37.5,6,75,2,25,12,75,2,12.5,96.41,95.62,96.88,96.88,96.25,95.62,97.19,6.25,52.66,58.12,59.38,21.88,71.25,20.62,84.69,0,0,0,0,1,4,4,1,4,0,1,1,0,0,1,1,1,0,0,0,1,0,1,0,1,0,4,1,1,0,0,1,1,0,0,0,1,0,1,0,0.2,2.6,0.6,0.4,0.6,1.2,0.4,0.4,0.95,0.65,0.8,6.33,7.33,6.25,-0.4,1.4,0.2,0,0.4,0,-1,-2,3,-1,1,1,1,-1,1,2,-2,2,-2,1,-1,1,5 cents,25 minutes,47 days,Male,High School (or equivalent),49,The survey was alright,0,1,0,1,0,0,0,0.67,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,4,6,5,9,7,8,2,1,3,4,2,3,1 +767,R_3aXLDtWCm56JVH5,46 - 52,American,,American,Male,Somewhat agree,Strongly agree,Somewhat agree,Agree,Agree,4,1,2,3,5,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Strongly agree,4,2,5,1,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,4,1,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,5,1,3,4,9,Agree,Somewhat disagree,Strongly agree,Strongly disagree,Strongly agree,3,5,4,1,2,9,Agree,Somewhat Disagree,Somewhat Agree,Agree,Agree,4,5,1,2,3,10,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Agree,2,1,3,4,5,6,Agree,Strongly disagree,Agree,Strongly disagree,Agree,1,5,2,3,4,2,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Strongly agree,4,1,2,3,5,3,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,3,4,TRUE,96,TRUE,50,FALSE,97,FALSE,96,FALSE,50,FALSE,97,TRUE,55,TRUE,73,FALSE,50,FALSE,100,FALSE,66,TRUE,84,FALSE,74,FALSE,50,FALSE,50,TRUE,98,FALSE,50,FALSE,50,FALSE,82,FALSE,100,FALSE,50,TRUE,75,TRUE,75,TRUE,94,FALSE,97,TRUE,94,FALSE,50,FALSE,98,FALSE,97,FALSE,96,FALSE,50,FALSE,50,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,2,2,0,-2,3,-2,3,2,0,1,0,2,3,3,3,3,2,2,3,2,2,3,9,2,-1,3,-3,3,9,2,-1,1,2,2,9,-1,1,1,0,-1,10,2,2,2,2,2,3,2,-3,2,-3,2,6,2,1,0,3,3,2,2,2,3,3,3,3,TRUE,0,96,TRUE,1,50,FALSE,1,97,FALSE,1,96,FALSE,0,50,FALSE,1,97,TRUE,1,55,TRUE,1,73,FALSE,0,50,FALSE,0,100,FALSE,1,66,TRUE,0,84,FALSE,0,74,FALSE,1,50,FALSE,0,50,TRUE,1,98,FALSE,1,50,FALSE,1,50,FALSE,1,82,FALSE,1,100,FALSE,0,50,TRUE,1,75,TRUE,0,75,TRUE,1,94,FALSE,1,97,TRUE,1,94,FALSE,1,50,FALSE,1,98,FALSE,1,97,FALSE,0,96,FALSE,0,50,FALSE,0,50,0.0729,0.0036,0.0004,0.2025,0.25,0.0009,0.0036,1,0,0.0625,0.9216,0.5476,0.25,0.1156,0.25,0.25,0.5625,0.0016,0.0004,0.0009,0.25,0.25,0.0324,0.25,0.25,0.25,0.25,0.9216,0.0009,0.25,0.0009,0.7056,0.27245,0.301135714,0.243764286,8,25,20,62.5,5,62.5,3,37.5,6,75,6,75,7,43.75,13,81.25,74.81,61.75,67.88,77.12,92.5,69.31,80.31,-37.5,12.31,-0.75,30.38,2.12,17.5,25.56,-0.94,1,0,1,0,1,2,1,0,1,0,0,1,0,2,0,4,2,2,3,3,1,1,1,0,0,2,1,1,1,1,0,1,1,3,1,1,1,0,0,1,0.6,0.8,0.6,2.8,0.6,1.2,1.2,0.6,1.2,0.9,1.05,9,3.67,6.375,0,-0.4,-0.6,2.2,-0.333333333,6,3,7,7,5.33,1,1,0,-2,2,0,0,1,-1,0,0,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,48,,0.375,0,0,1,1,1,0,0.33,0.67,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,7,3,5,8,2,6,4,1,9,2,3,4,1 +768,R_79TkYrC8fTkZ9hn,39 - 45,American,,American,Male,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,2,3,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,5,1,3,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,4,1,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,3,5,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,4,3,1,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,5,2,4,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,2,1,3,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,4,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,3,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,68,FALSE,96,FALSE,64,FALSE,55,FALSE,100,FALSE,53,TRUE,90,TRUE,72,TRUE,91,TRUE,93,TRUE,83,FALSE,97,FALSE,88,FALSE,76,TRUE,93,FALSE,66,TRUE,99,TRUE,81,FALSE,56,TRUE,87,TRUE,100,FALSE,56,TRUE,98,TRUE,92,TRUE,100,TRUE,100,FALSE,87,TRUE,100,FALSE,64,TRUE,94,TRUE,97,TRUE,90,25,1,2,2,1,1,0,-1,1,-1,1,1,0,1,0,1,-1,0,0,0,-1,1,1,1,1,1,3,-1,-1,1,-1,1,3,1,0,1,0,1,3,-1,-1,0,0,0,3,1,1,1,1,1,3,0,0,1,0,1,3,1,0,2,0,1,3,0,0,0,0,0,3,TRUE,0,90,TRUE,1,97,TRUE,0,94,FALSE,1,64,TRUE,1,100,FALSE,1,87,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,98,FALSE,1,56,TRUE,0,100,TRUE,1,87,FALSE,1,56,TRUE,1,81,TRUE,1,99,FALSE,1,66,TRUE,0,93,FALSE,1,76,FALSE,1,88,FALSE,0,97,TRUE,1,83,TRUE,0,93,TRUE,1,91,TRUE,0,72,TRUE,1,90,FALSE,1,53,FALSE,1,100,FALSE,1,55,FALSE,0,64,FALSE,0,96,FALSE,0,68,0,0.01,0.0001,0,0.4624,0.0169,0.0081,0.0004,0.0144,0.0289,0.4096,0.0169,0.0064,0.1936,0,0.0009,0.8649,0.1296,0,0.5184,0.9409,0.0361,0.0576,0.1936,0.1156,0.2209,0.9216,0.81,0.8836,0.8649,0.2025,1,0.318525,0.153785714,0.483264286,25,78.13,22,68.75,7,87.5,5,62.5,5,62.5,5,62.5,12,75,10,62.5,83.94,76.88,81.62,85.25,92,90.19,77.69,9.38,15.19,-10.62,19.12,22.75,29.5,15.19,15.19,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0.4,0.2,0,0.4,0.4,0.4,0.2,0.4,0.25,0.35,0.3,3,3,3,0,-0.2,-0.2,0,-0.133333333,0,0,0,0,0,1,1,0,-1,1,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,39,,0.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,5,6,4,9,7,3,8,1,2,4,2,3,1 +769,R_6QE36qxNx5mVK4C,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,1,5,2,3,Agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Agree,3,2,5,1,4,Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,3,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,5,4,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,4,1,2,3,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,3,4,5,1,10,Neither Agree nor Disagree,Strongly Disagree,Somewhat Disagree,Strongly Agree,Disagree,2,3,1,4,5,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,4,2,5,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,4,5,2,1,3,6,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,2,4,5,1,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,TRUE,73,TRUE,100,TRUE,81,TRUE,75,TRUE,77,TRUE,100,FALSE,65,TRUE,70,TRUE,68,TRUE,82,TRUE,100,FALSE,92,TRUE,100,TRUE,100,TRUE,100,TRUE,63,TRUE,82,TRUE,90,TRUE,92,TRUE,100,FALSE,83,TRUE,83,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,83,TRUE,91,TRUE,96,TRUE,83,26,1,3,3,3,1,2,-1,3,0,2,2,3,3,-3,3,1,1,1,1,3,-1,-1,-1,-1,-1,10,-1,-1,-1,-1,-1,5,0,-3,-1,3,-2,10,-3,-3,-3,-3,-3,10,3,3,3,3,3,6,3,0,3,-3,3,5,3,3,3,-3,3,6,3,3,3,3,3,7,TRUE,0,83,TRUE,1,96,TRUE,0,91,TRUE,0,83,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,83,FALSE,1,83,TRUE,0,100,TRUE,1,92,TRUE,0,90,TRUE,1,82,TRUE,1,63,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,92,TRUE,1,100,TRUE,1,82,TRUE,0,68,TRUE,1,70,FALSE,1,65,TRUE,1,100,TRUE,0,77,TRUE,0,75,TRUE,0,81,TRUE,1,100,TRUE,1,73,FALSE,0,100,0,0,0.1369,0,1,1,0.09,0.0289,0.0064,0.0324,0,0.0064,0,0.0289,0,0.0016,0.4624,0.6889,0.5625,0.1225,0,0.0324,1,0.81,1,0.5929,0.0729,0.6889,0.8281,1,0.6561,1,0.418292857,0.238992857,0.597592857,26,81.25,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,15,93.75,3,18.75,88.41,86.75,92.62,87.88,86.38,90.06,86.75,25,32.16,24.25,55.12,25.38,23.88,-3.69,68,2,4,4,4,2,3,0,4,1,3,2,6,4,6,5,4,4,4,4,6,2,0,0,0,2,1,1,0,3,1,1,0,0,0,0,2,2,2,2,0,3.2,2.2,4.6,4.4,0.8,1.2,0.2,1.6,3.6,0.95,2.275,8.33,5.67,7.375,2.4,1,4.4,2.8,2.6,4,0,4,3,2.66,-1,2,2,-1,1,2,-2,0,0,0,0,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,24,this was a great survey.,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,5,4,7,8,3,6,2,1,9,4,2,3,1 +770,R_3ozpWk0WXkPDv2J,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,1,4,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,2,3,5,Agree,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,4,2,5,1,3,Neither agree nor disagree,Strongly Agree,Agree,Agree,Strongly disagree,3,1,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,1,3,7,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Strongly agree,4,2,5,3,1,4,Agree,Strongly Agree,Agree,Somewhat Agree,Agree,2,3,4,5,1,8,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,Disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,1,4,2,5,Agree,Agree,Agree,Disagree,Agree,5,4,3,1,2,9,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,4,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,5,1,3,4,2,FALSE,65,TRUE,83,TRUE,100,FALSE,50,FALSE,85,TRUE,68,TRUE,89,TRUE,67,TRUE,82,TRUE,100,FALSE,64,TRUE,89,TRUE,69,TRUE,73,FALSE,68,FALSE,64,FALSE,58,TRUE,94,FALSE,71,FALSE,53,TRUE,71,FALSE,54,TRUE,86,TRUE,93,FALSE,68,TRUE,67,TRUE,64,FALSE,63,TRUE,93,TRUE,90,FALSE,74,TRUE,100,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,0,0,1,1,0,2,1,3,2,1,0,3,2,2,-3,3,3,3,3,3,5,-1,0,-1,-2,3,7,2,3,2,1,2,4,1,-1,-1,-2,-2,8,3,3,3,3,3,3,2,2,2,-2,2,5,3,2,3,3,3,9,3,3,3,3,1,4,FALSE,1,65,TRUE,1,83,TRUE,0,100,FALSE,1,50,FALSE,0,85,TRUE,0,68,TRUE,1,89,TRUE,1,67,TRUE,1,82,TRUE,1,100,FALSE,1,64,TRUE,0,89,TRUE,1,69,TRUE,0,73,FALSE,0,68,FALSE,0,64,FALSE,1,58,TRUE,0,94,FALSE,1,71,FALSE,1,53,TRUE,1,71,FALSE,0,54,TRUE,0,86,TRUE,1,93,FALSE,1,68,TRUE,1,67,TRUE,0,64,FALSE,1,63,TRUE,0,93,TRUE,1,90,FALSE,0,74,TRUE,1,100,0.1089,0.1089,0.4096,0.0121,0,0.4624,0.0049,0,0.2209,0.2916,0.01,0.0961,0.0324,0.1296,0.7225,0.0289,0.7396,0.25,0.1369,0.1024,0.0841,0.4624,0.0841,0.5329,0.1764,0.4096,0.5476,0.1225,1,0.8836,0.8649,0.7921,0.328157143,0.213492857,0.442821429,9,28.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,11,68.75,8,50,75.47,69.5,78.75,76.25,77.38,78.5,72.44,-31.25,16.09,7,28.75,13.75,14.88,9.75,22.44,1,1,1,1,1,1,0,2,3,3,0,2,1,1,1,1,4,3,4,1,1,1,1,1,1,2,2,1,3,2,1,1,0,1,2,3,0,1,1,4,1,1.8,1,2.6,1,2,1,1.8,1.6,1.45,1.525,5.33,5.67,5.625,0,-0.2,0,0.8,-0.066666667,2,2,-5,4,-0.34,-1,-1,-1,-2,2,0,0,1,-1,-1,1,-1,10 cents,25 minutes,24 days,Female,High School (or equivalent),27,,-0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,5,9,8,6,4,3,7,1,2,3,2,4,1 +771,R_6qCttAVyouSxM4S,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,3,5,1,4,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Strongly agree,3,5,2,1,4,Somewhat Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,5,1,3,2,4,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,2,3,5,1,Somewhat agree,Disagree,Disagree,Somewhat agree,Strongly agree,3,1,4,5,2,1,Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,5,2,4,1,3,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,4,3,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,2,4,3,1,5,1,Somewhat agree,Disagree,Agree,Somewhat agree,Strongly agree,5,3,1,4,2,0,Somewhat Disagree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,3,1,2,4,6,Somewhat agree,Strongly Agree,Agree,Agree,Somewhat agree,1,3,5,4,2,FALSE,75,FALSE,50,TRUE,96,FALSE,50,TRUE,80,FALSE,55,TRUE,91,TRUE,60,TRUE,55,TRUE,93,FALSE,50,TRUE,55,TRUE,70,FALSE,50,FALSE,50,TRUE,57,TRUE,54,TRUE,56,FALSE,50,TRUE,50,TRUE,52,TRUE,71,FALSE,100,TRUE,50,FALSE,95,TRUE,60,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,85,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,-1,3,1,-1,0,1,3,-1,-3,3,-2,3,0,1,2,0,-2,-1,3,3,3,3,1,1,-2,-2,1,3,1,-2,-3,3,-2,3,1,-1,-1,-1,-1,-2,1,3,3,3,-2,3,1,1,-2,2,1,3,1,-1,-3,3,-1,3,0,1,3,2,2,1,6,FALSE,1,75,FALSE,0,50,TRUE,0,96,FALSE,1,50,TRUE,1,80,FALSE,1,55,TRUE,1,91,TRUE,1,60,TRUE,1,55,TRUE,1,93,FALSE,1,50,TRUE,0,55,TRUE,1,70,FALSE,1,50,FALSE,0,50,TRUE,1,57,TRUE,0,54,TRUE,0,56,FALSE,1,50,TRUE,0,50,TRUE,1,52,TRUE,1,71,FALSE,1,100,TRUE,1,50,FALSE,1,95,TRUE,1,60,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,85,0.16,0.16,0.1849,0.0081,0.0225,0.2025,0.25,0.0049,0.25,0.0841,0.25,0.09,0.2025,0.25,0.04,0.25,0,0.25,0.25,0.0025,0.2304,0.25,0.25,0.25,0.2916,0.25,0.25,0.0625,0.9216,0.3136,0.25,0.3025,0.215042857,0.153321429,0.276764286,14,43.75,23,71.88,5,62.5,7,87.5,7,87.5,4,50,12,75,11,68.75,62.81,50.62,68.25,73.88,58.5,64,61.62,-28.13,-9.07,-11.88,-19.25,-13.62,8.5,-11,-7.13,4,0,0,4,0,0,1,2,0,0,1,0,0,0,0,1,2,3,1,0,0,0,0,1,0,0,1,2,0,0,0,0,0,1,0,1,2,0,2,3,1.6,0.6,0.2,1.4,0.2,0.6,0.2,1.6,0.95,0.65,0.8,1,0.67,1.5,1.4,0,0,-0.2,0.466666667,0,0,1,-5,0.33,1,2,2,-2,2,-1,1,-2,2,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),28,nothing to say,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,2,9,6,5,7,8,3,1,4,3,2,4,1 +772,R_3KUgGNSeDtsAYzX,18 - 24,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,5,1,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,1,2,5,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,5,1,2,3,4,Agree,Agree,Agree,Agree,Agree,2,1,5,3,4,0,Disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,1,2,4,3,5,3,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,1,2,3,5,4,3,Disagree,Somewhat agree,Disagree,Disagree,Disagree,1,3,4,2,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Agree,Agree,3,1,2,5,4,1,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,4,3,2,5,1,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,1,3,4,2,5,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,3,2,4,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,TRUE,50,TRUE,75,TRUE,50,TRUE,50,FALSE,50,TRUE,90,FALSE,100,TRUE,80,FALSE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,80,TRUE,50,TRUE,50,TRUE,75,FALSE,85,TRUE,80,FALSE,50,FALSE,50,TRUE,75,FALSE,50,TRUE,90,TRUE,50,TRUE,50,TRUE,75,FALSE,50,TRUE,50,FALSE,50,TRUE,90,16,2,2,2,2,2,0,0,1,0,1,0,0,1,1,1,-2,1,-1,0,-3,2,2,2,2,2,0,-2,0,1,2,0,3,1,1,0,1,1,3,-2,1,-2,-2,-2,2,2,2,1,2,2,1,0,-2,3,-2,2,7,0,0,2,1,2,6,3,3,3,3,2,9,TRUE,0,90,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,75,TRUE,0,50,TRUE,1,50,TRUE,1,90,FALSE,0,50,TRUE,1,75,FALSE,1,50,FALSE,1,50,TRUE,1,80,FALSE,1,85,TRUE,1,75,TRUE,1,50,TRUE,0,50,TRUE,0,80,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,90,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,75,TRUE,1,50,TRUE,1,50,0.01,0.01,0.25,0.25,0.25,0.25,0.04,0.0625,0.25,0.25,0.0625,0.04,0.25,0.25,0.0625,0.25,0,0.25,0.25,0,0.25,0.0625,0.25,0.0225,0.25,0.25,0.25,0.81,0.25,0.64,0.25,0.25,0.216160714,0.161964286,0.270357143,16,50,22,68.75,6,75,5,62.5,5,62.5,6,75,13,81.25,9,56.25,63.91,53.12,63.12,77.5,61.88,65,62.81,-18.75,-4.84,-21.88,0.62,15,-13.12,-16.25,6.56,0,0,0,0,0,2,0,0,2,1,1,1,1,0,0,0,0,1,2,1,0,0,1,0,0,0,2,2,2,1,0,0,1,0,1,5,2,4,3,5,0,1,0.6,0.8,0.2,1.4,0.4,3.8,0.6,1.45,1.025,2,4.67,3.875,-0.2,-0.4,0.2,-3,-0.133333333,-1,-4,-3,-7,-2.67,0,1,0,-1,1,0,0,0,0,-1,1,1,10 cents,100 minutes,47 days,Female,University - Undergraduate,23,I enjoyed this!,0.5,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,8,7,6,2,5,4,9,1,3,4,2,3,1 +773,R_5jZ4qTpkKjrfANY,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Disagree,Agree,2,4,1,5,3,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,1,4,2,5,3,Neither Agree nor Disagree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,4,1,5,Disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,5,2,1,4,3,2,Strongly disagree,Strongly agree,Disagree,Strongly agree,Agree,5,2,3,4,1,1,Disagree,Strongly Disagree,Agree,Somewhat Disagree,Agree,5,1,4,2,3,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Neither agree nor disagree,Somewhat disagree,Strongly Agree,4,5,3,1,2,3,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,3,2,4,1,5,2,Neither Agree nor Disagree,Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,4,2,3,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,1,4,5,3,2,FALSE,75,TRUE,75,FALSE,82,TRUE,50,TRUE,91,FALSE,70,TRUE,91,TRUE,79,TRUE,95,TRUE,96,FALSE,61,TRUE,100,TRUE,61,FALSE,75,FALSE,50,FALSE,55,TRUE,58,FALSE,92,TRUE,50,FALSE,50,TRUE,50,FALSE,55,FALSE,64,TRUE,75,TRUE,64,TRUE,71,TRUE,50,FALSE,59,TRUE,59,FALSE,62,FALSE,50,TRUE,75,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,-2,2,-3,1,1,3,3,0,-2,3,0,3,-2,-2,-3,-2,-3,3,3,1,3,2,3,-3,3,-2,3,2,2,-2,-3,2,-1,2,1,-3,-3,-3,-3,-3,5,3,3,0,-1,3,2,0,-1,2,-1,3,3,0,-2,3,0,3,2,0,0,0,1,-2,7,FALSE,1,75,TRUE,1,75,FALSE,1,82,TRUE,0,50,TRUE,1,91,FALSE,1,70,TRUE,1,91,TRUE,1,79,TRUE,1,95,TRUE,1,96,FALSE,1,61,TRUE,0,100,TRUE,1,61,FALSE,1,75,FALSE,0,50,FALSE,0,55,TRUE,0,58,FALSE,1,92,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,55,FALSE,1,64,TRUE,1,75,TRUE,0,64,TRUE,1,71,TRUE,0,50,FALSE,1,59,TRUE,0,59,FALSE,0,62,FALSE,0,50,TRUE,1,75,0.0441,0.0841,0.3025,0.0081,0.0625,0.09,0.0625,0.0016,0.25,0.3025,0.3844,0.1521,0.0025,0.1521,0.0081,0.0625,0.1296,0.25,0.1681,0.4096,0.25,0.25,0.25,0.0625,0.3364,0.25,0.25,0.0625,0.0324,0.0064,0.3481,1,0.199514286,0.136457143,0.262571429,17,53.13,20,62.5,3,37.5,6,75,6,75,5,62.5,11,68.75,9,56.25,68.44,60.12,66,77.38,70.25,70.69,66.19,-9.37,5.94,22.62,-9,2.38,7.75,1.94,9.94,0,0,0,5,0,0,2,3,0,1,2,1,1,1,1,1,1,0,1,0,0,0,1,1,1,3,2,1,4,0,0,0,0,0,0,2,2,3,3,1,1,1.2,1.2,0.6,0.6,2,0,2.2,1,1.2,1.1,2,2.33,3.125,0.4,-0.8,1.2,-1.6,0.266666667,1,-1,-1,-2,-0.33,2,2,2,-1,1,0,0,-2,2,-2,2,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),29,,1.375,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,2,4,3,5,9,7,6,1,8,2,4,3,1 +774,R_76PXZknRmvT7F2p,18 - 24,,Canadian,Canadian,Female,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,Strongly agree,4,5,3,2,1,Somewhat disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,4,1,2,3,5,Disagree,Disagree,Somewhat disagree,Disagree,Strongly disagree,5,1,3,2,4,Strongly disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,1,2,4,5,3,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,1,3,5,4,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,4,2,3,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,4,5,1,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat disagree,Strongly Agree,5,2,4,1,3,9,Strongly agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,5,2,4,1,3,9,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,1,2,3,4,6,Agree,Agree,Agree,Agree,Somewhat agree,4,1,2,5,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,75,FALSE,66,TRUE,84,TRUE,80,FALSE,58,FALSE,61,TRUE,57,TRUE,100,TRUE,100,FALSE,53,FALSE,75,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,70,TRUE,76,TRUE,90,TRUE,74,TRUE,85,FALSE,62,FALSE,100,12,-3,1,-3,3,3,-1,-3,3,0,0,2,1,3,2,3,-2,-2,-1,-2,-3,-3,-3,0,0,-3,6,1,1,1,1,-1,4,0,1,1,3,0,3,0,0,2,1,-1,5,3,1,3,-1,3,9,3,-2,3,-2,0,9,3,1,3,-1,3,6,2,2,2,2,1,8,FALSE,1,100,FALSE,0,62,TRUE,0,85,TRUE,0,74,TRUE,1,90,TRUE,0,76,TRUE,1,70,FALSE,0,55,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,75,FALSE,1,53,TRUE,1,100,TRUE,0,100,TRUE,1,57,FALSE,1,61,FALSE,1,58,TRUE,0,80,TRUE,1,84,FALSE,0,66,FALSE,0,75,0.3025,0.1849,0,0.09,0.5625,0.5776,0,0,0,0.5625,0.0256,1,0,0,0.01,0.3844,0.2209,0.5476,0.1764,1,0,0,0,0,1,0.1521,0.4356,0,0.7225,1,0.64,0,0.322060714,0.277935714,0.366185714,12,37.5,19,59.38,5,62.5,3,37.5,5,62.5,6,75,10,62.5,9,56.25,85.03,82.88,84.25,87.75,85.25,83.38,86.69,-21.88,25.65,20.38,46.75,25.25,10.25,20.88,30.44,0,4,3,3,6,2,4,2,1,1,2,0,2,1,3,2,2,3,3,2,6,0,6,4,0,4,1,0,2,0,1,0,0,3,0,4,4,3,4,4,3.2,2,1.6,2.4,3.2,1.4,0.8,3.8,2.3,2.3,2.3,4.33,8,6.25,0,0.6,0.8,-1.4,0.466666667,-3,-5,-3,-3,-3.67,0,2,2,0,0,0,0,0,0,-2,2,2,5 cents,5 minutes,47 days,Female,University - Undergraduate,20,,1,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,7,9,3,4,8,5,2,1,6,4,3,2,1 +775,R_5rBPsTH1rZzRdio,25 - 31,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Agree,Strongly agree,1,5,4,3,2,Agree,Agree,Agree,Somewhat agree,Strongly agree,1,2,5,4,3,Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,4,2,3,5,1,Agree,Agree,Agree,Agree,Somewhat agree,5,3,2,4,1,Agree,Strongly Agree,Agree,Somewhat disagree,Agree,1,5,4,3,2,5,Somewhat disagree,Somewhat agree,Agree,Strongly agree,Agree,5,4,3,2,1,6,Strongly Agree,Disagree,Agree,Somewhat Disagree,Strongly Agree,3,2,5,1,4,2,Disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,2,4,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,2,1,4,5,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,2,4,1,5,3,2,Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,5,3,2,4,1,3,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,80,FALSE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,75,TRUE,50,TRUE,100,TRUE,50,TRUE,50,FALSE,60,FALSE,100,TRUE,65,TRUE,90,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,65,TRUE,50,TRUE,50,FALSE,70,TRUE,50,FALSE,75,TRUE,50,TRUE,60,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,3,2,2,2,1,3,2,-2,3,-2,3,2,2,2,2,1,2,3,2,-1,2,5,-1,1,2,3,2,6,3,-2,2,-1,3,2,-2,1,-1,-1,-1,9,2,3,2,2,3,2,3,3,3,-2,3,2,2,-3,3,-2,3,3,2,2,2,2,2,5,TRUE,0,80,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,100,TRUE,1,50,TRUE,1,75,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,FALSE,0,60,FALSE,0,100,TRUE,0,65,TRUE,0,90,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,65,TRUE,1,50,TRUE,0,50,FALSE,1,70,TRUE,0,50,FALSE,0,75,TRUE,1,50,TRUE,1,60,1,0.25,1,0.25,0.16,0.25,0.25,0.0625,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.09,0.4225,0.25,0.36,0.25,0.25,0.4225,0.25,0.25,0.64,0,0.81,0.25,1,0.313571429,0.2525,0.374642857,13,40.63,16,50,4,50,5,62.5,4,50,3,37.5,10,62.5,6,37.5,62.19,51.25,53.12,63.75,80.62,60.62,63.75,-9.37,12.19,1.25,-9.38,13.75,43.12,-1.88,26.25,0,0,0,3,1,3,1,0,2,1,1,0,1,1,0,4,1,3,3,2,0,0,0,0,0,1,1,1,3,0,0,1,0,0,0,0,0,0,0,1,0.8,1.4,0.6,2.6,0,1.2,0.2,0.2,1.35,0.4,0.875,4.33,2.33,4.25,0.8,0.2,0.4,2.4,0.466666667,3,4,-1,4,2,0,1,0,-2,2,0,0,1,-1,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,N/A,0.625,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,3,2,7,9,4,6,8,1,5,3,2,4,1 +776,R_3exVCA64WEpktJn,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,5,2,1,3,4,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Agree,5,2,1,4,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,5,4,3,2,1,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,3,4,1,2,Strongly Agree,Neither agree nor disagree,Strongly Agree,Disagree,Strongly Agree,1,5,4,2,3,4,Somewhat disagree,Strongly agree,Somewhat agree,Disagree,Somewhat agree,3,4,2,5,1,4,Agree,Disagree,Agree,Strongly Agree,Agree,1,2,5,4,3,1,Somewhat agree,Strongly Agree,Neither agree nor disagree,Agree,Agree,3,2,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,1,3,4,5,2,4,Disagree,Somewhat agree,Agree,Disagree,Agree,2,1,5,3,4,3,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Agree,Strongly Agree,5,3,1,2,4,2,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,2,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,100,FALSE,64,TRUE,74,TRUE,68,FALSE,84,TRUE,69,FALSE,100,TRUE,64,FALSE,99,TRUE,99,TRUE,75,FALSE,93,FALSE,94,TRUE,95,FALSE,93,TRUE,95,TRUE,95,TRUE,92,TRUE,59,FALSE,90,FALSE,91,TRUE,98,TRUE,83,TRUE,100,TRUE,99,FALSE,89,TRUE,54,FALSE,52,FALSE,98,TRUE,54,TRUE,97,15,3,3,1,1,2,-2,1,0,-1,2,0,0,2,1,3,-1,1,-1,-1,-1,3,0,3,-2,3,4,-1,3,1,-2,1,4,2,-2,2,3,2,1,1,3,0,2,2,5,3,3,0,3,3,4,-2,1,2,-2,2,3,0,-1,2,1,3,2,1,2,2,1,0,8,TRUE,0,97,TRUE,1,54,FALSE,1,98,FALSE,1,52,TRUE,1,54,FALSE,1,89,TRUE,1,99,TRUE,1,100,TRUE,1,83,TRUE,1,98,FALSE,1,91,FALSE,1,90,TRUE,1,59,TRUE,0,92,TRUE,1,95,TRUE,1,95,FALSE,1,93,TRUE,0,95,FALSE,1,94,FALSE,1,93,TRUE,1,75,TRUE,1,99,FALSE,1,99,TRUE,1,64,FALSE,1,100,TRUE,1,69,FALSE,1,84,TRUE,0,68,TRUE,0,74,FALSE,0,64,TRUE,1,100,TRUE,1,90,0,0.0961,0.0025,0.0001,0.01,0.0121,0.1296,0.0004,0.0049,0.0001,0.4096,0.1681,0.0289,0.0081,0.2116,0.2116,0.0001,0.2304,0.4624,0,0.0625,0.0025,0.0036,0.8464,0.0049,0.0256,0,0.9409,0.0004,0.9025,0.5476,0.01,0.186957143,0.101821429,0.272092857,15,46.88,26,81.25,8,100,7,87.5,5,62.5,6,75,15,93.75,11,68.75,84.59,81.62,79.12,93.62,84,81.12,88.06,-34.37,3.34,-18.38,-8.38,31.12,9,-12.63,19.31,0,3,2,3,1,1,2,1,1,1,2,2,0,2,1,2,2,1,3,3,0,0,1,2,1,0,0,2,1,0,0,1,0,0,0,2,1,3,2,1,1.8,1.2,1.4,2.2,0.8,0.6,0.2,1.8,1.65,0.85,1.25,3,3,3.875,1,0.6,1.2,0.4,0.933333333,0,1,-1,-3,0,0,1,1,-1,1,1,-1,0,0,-1,1,0,5 cents,100 minutes,47 days,Female,High School (or equivalent),18,,0.375,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,5,2,9,4,6,7,3,1,8,2,4,3,1 +777,R_7Ecs2WhisNDf65d,39 - 45,American,,American,Male,Somewhat agree,Agree,Somewhat disagree,Agree,Strongly agree,3,1,5,2,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,5,1,3,4,Agree,Agree,Strongly Agree,Agree,Agree,3,5,1,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Neither agree nor disagree,Agree,Strongly Agree,2,1,3,4,5,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,1,4,3,5,4,Agree,Strongly Agree,Agree,Agree,Agree,2,1,3,4,5,4,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Agree,Neither agree nor disagree,Agree,Strongly Agree,5,3,4,2,1,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Disagree,Agree,4,3,5,1,2,3,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,4,2,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,75,TRUE,100,FALSE,54,FALSE,100,FALSE,90,TRUE,100,FALSE,81,TRUE,100,FALSE,100,TRUE,54,TRUE,100,FALSE,100,FALSE,55,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,78,TRUE,83,FALSE,80,TRUE,100,TRUE,100,TRUE,92,TRUE,97,FALSE,99,TRUE,54,FALSE,78,FALSE,100,FALSE,100,TRUE,53,27,1,2,-1,2,3,0,0,2,0,1,2,2,3,2,2,0,0,0,0,-1,2,2,0,2,3,9,0,-1,0,0,1,5,2,3,2,2,2,4,0,-1,-1,-1,-1,4,1,2,0,2,3,8,0,-1,1,-2,2,4,2,2,2,2,2,3,1,1,1,1,0,5,TRUE,0,53,FALSE,0,100,FALSE,1,100,FALSE,1,78,TRUE,1,54,FALSE,1,99,TRUE,1,97,TRUE,1,92,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,0,83,TRUE,1,78,TRUE,0,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,81,TRUE,1,100,FALSE,1,90,FALSE,1,100,FALSE,1,54,TRUE,1,100,TRUE,1,75,TRUE,1,100,0.0064,0,0,0.0009,0,0.0001,0,0,0,0.2116,0,0.0484,0,0.04,0.2116,1,0,0.0484,0,0.0361,0,1,0.2025,1,0,0.01,0.0625,0.2809,0,0,0.2116,0.6889,0.18045,0.111435714,0.249464286,27,84.38,27,84.38,6,75,8,100,6,75,7,87.5,14,87.5,13,81.25,88.22,84.75,85.62,85.62,96.88,90.62,85.81,0,3.84,9.75,-14.38,10.62,9.38,3.12,4.56,1,0,1,0,0,0,1,2,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,1,1,2,1,0,0,1,0,0,1,1,1,1,1,0.4,0.6,0.4,0.6,0.2,1,0.2,1,0.5,0.6,0.55,6,5,5.25,0.2,-0.4,0.2,-0.4,0,1,1,1,-1,1,0,0,2,2,-2,1,-1,1,-1,0,0,2,10 cents,5 minutes,47 days,Male,High School (or equivalent),42,,0,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,5,4,3,9,2,8,7,1,6,3,2,4,1 +778,R_5H1xr9LBPdaX84h,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Strongly disagree,Agree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,Disagree,Strongly disagree,Agree,Somewhat agree,Agree,1,4,5,3,2,Somewhat Agree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Agree,2,5,1,3,4,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,Strongly Agree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,2,4,5,3,10,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,5,2,3,4,1,10,Strongly Disagree,Agree,Disagree,Somewhat Agree,Strongly Disagree,3,2,1,4,5,10,Agree,Disagree,Agree,Agree,Strongly disagree,3,1,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Strongly disagree,Agree,Agree,Agree,1,4,2,5,3,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,4,2,3,1,2,Agree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Somewhat Agree,4,5,1,2,3,10,Agree,Somewhat agree,Agree,Agree,Strongly Agree,2,5,1,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,65,TRUE,85,FALSE,95,FALSE,100,TRUE,50,TRUE,85,TRUE,90,TRUE,99,TRUE,50,TRUE,100,TRUE,90,FALSE,75,FALSE,62,TRUE,90,TRUE,92,TRUE,100,TRUE,50,FALSE,100,FALSE,95,TRUE,90,TRUE,50,TRUE,95,TRUE,50,TRUE,100,TRUE,95,FALSE,80,TRUE,50,TRUE,50,FALSE,100,TRUE,80,TRUE,100,22,1,-3,2,1,0,-2,-3,2,1,2,1,-1,3,-3,2,1,-1,-1,-2,3,2,3,3,3,2,5,3,3,-3,3,3,10,-3,2,-2,1,-3,10,2,-2,2,2,-3,10,1,-3,2,2,2,2,1,-3,3,-3,1,2,2,-1,1,-3,1,2,2,1,2,2,3,10,TRUE,0,100,TRUE,1,80,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,80,TRUE,1,95,TRUE,1,100,TRUE,1,50,TRUE,1,95,TRUE,0,50,TRUE,0,90,FALSE,0,95,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,92,TRUE,0,90,FALSE,1,62,FALSE,1,75,TRUE,1,90,TRUE,1,100,TRUE,0,50,TRUE,1,99,TRUE,0,90,TRUE,1,85,TRUE,0,50,FALSE,1,100,FALSE,1,95,TRUE,1,85,TRUE,1,65,TRUE,1,100,0,0.0225,0,0.0025,0,0.04,0.0001,0.0025,0.0625,0,0.0225,0.9025,0.25,0.25,0.25,0.04,0.25,0.25,0,0.81,0.01,0.25,0.1444,0,0.8464,0.25,0.1225,1,0,0.81,0.0025,0.81,0.263425,0.165721429,0.361128571,22,68.75,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,15,93.75,7,43.75,81.66,57.12,81.5,94.38,93.62,83.69,79.62,0,12.91,-5.38,19,31.88,6.12,-10.06,35.87,1,6,1,2,2,5,6,5,2,1,4,3,5,4,5,1,1,3,4,6,0,0,0,1,2,3,0,1,4,1,1,0,2,0,1,1,2,3,4,0,2.4,3.8,4.2,3,0.6,1.8,0.8,2,3.35,1.3,2.325,8.33,2,6.375,1.8,2,3.4,1,2.4,3,8,8,0,6.33,2,2,-1,-2,2,-1,1,0,0,-2,2,1,10 cents,100 minutes,47 days,Male,High School (or equivalent),21,I liked it,1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,2,6,3,8,4,7,9,1,5,4,2,3,1 +779,R_5mkDxdKw1vi4gyK,39 - 45,American,,American,Male,Agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,4,3,5,1,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,5,4,1,3,Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,3,2,1,4,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,4,1,3,2,Agree,Somewhat agree,Agree,Disagree,Somewhat disagree,2,5,1,4,3,4,Strongly disagree,Disagree,Somewhat disagree,Somewhat agree,Disagree,2,1,5,4,3,5,Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,4,2,2,Somewhat agree,Somewhat disagree,Disagree,Disagree,Strongly disagree,4,2,1,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,2,1,3,2,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,2,5,4,3,2,Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,2,4,5,3,2,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,3,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,TRUE,95,TRUE,100,FALSE,66,FALSE,100,TRUE,88,TRUE,100,FALSE,100,TRUE,92,FALSE,51,TRUE,100,TRUE,72,FALSE,100,TRUE,75,TRUE,100,TRUE,90,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,53,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,91,FALSE,100,27,2,1,2,0,1,-2,-2,0,1,-1,2,3,1,0,2,1,1,-1,1,-1,2,1,2,-2,-1,4,-3,-2,-1,1,-2,5,2,3,0,0,0,2,1,-1,-2,-2,-3,5,2,1,2,2,1,2,-2,-2,1,0,-1,2,2,3,2,0,2,2,2,2,1,1,-1,3,FALSE,1,100,TRUE,1,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,90,TRUE,0,100,TRUE,0,75,FALSE,1,100,TRUE,1,72,TRUE,1,100,FALSE,1,51,TRUE,1,92,FALSE,1,100,TRUE,1,100,TRUE,0,88,FALSE,1,100,FALSE,1,66,TRUE,1,100,TRUE,1,95,TRUE,1,97,0,0,0,0,0.0009,0,0.0064,0,0,0,0,0,0,0.2209,0,0.0081,0.2401,0,0,0,0.0784,0,0.5625,0,0.81,0.7744,0.0025,0,0,1,0.1156,0,0.136421429,0.034028571,0.238814286,27,84.38,28,87.5,6,75,7,87.5,7,87.5,8,100,16,100,12,75,92.81,87.75,84.5,100,99,96.69,88.94,-3.12,5.31,12.75,-3,12.5,-1,-3.31,13.94,0,0,0,2,2,1,0,1,0,1,0,0,1,0,2,0,2,1,3,2,0,0,0,2,0,0,0,1,1,0,0,0,1,0,0,1,1,2,0,0,0.8,0.6,0.6,1.6,0.4,0.4,0.2,0.8,0.9,0.45,0.675,3.67,2,3.125,0.4,0.2,0.4,0.8,0.333333333,2,3,0,2,1.67,1,1,2,-1,1,-1,1,-1,1,-2,2,-2,10 cents,5 minutes,15 days,Male,University - Undergraduate,44,"This survey is finding out one's behavior, choices and intelligence. I appreciate this and made me think about aspect of my life I would like to change.",0.875,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,4,9,2,5,7,8,6,1,3,3,2,4,1 +780,R_3uOaBsaam5UC3KN,25 - 31,,Canadian,Canadian,Male,Agree,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Agree,4,5,1,2,3,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,5,3,2,1,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,4,2,3,1,5,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Somewhat disagree,Somewhat disagree,Agree,5,2,1,4,3,9,Neither agree nor disagree,Strongly disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,2,4,1,5,7,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,3,5,1,4,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,1,2,4,6,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,5,1,3,4,6,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,1,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,2,5,TRUE,100,TRUE,64,TRUE,100,FALSE,61,FALSE,66,FALSE,100,TRUE,100,TRUE,100,FALSE,69,TRUE,100,FALSE,57,TRUE,100,TRUE,100,FALSE,75,TRUE,66,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,59,FALSE,76,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,65,TRUE,100,TRUE,90,FALSE,100,FALSE,61,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,-3,-1,0,2,0,-3,2,-3,1,2,2,2,1,1,0,1,2,1,0,2,2,-1,-1,2,8,0,-3,1,-2,0,9,2,2,2,1,1,7,1,1,1,2,-1,7,2,-3,1,0,1,7,1,-1,2,-1,0,6,2,2,0,0,1,6,1,1,1,1,1,8,TRUE,0,100,TRUE,1,64,TRUE,0,100,FALSE,1,61,FALSE,0,66,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,69,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,100,FALSE,1,75,TRUE,1,66,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,59,FALSE,0,76,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,65,TRUE,0,100,TRUE,0,90,FALSE,0,100,FALSE,0,61,TRUE,1,100,0,0,0,0,0,0,0,0,0.1681,0,1,0,0.4761,0.1849,0.4356,0.1296,0,0.1521,1,1,0.5776,0.1156,1,0.0625,1,0.1225,0.3721,1,1,1,0.81,1,0.450239286,0.181885714,0.718592857,26,81.25,18,56.25,5,62.5,4,50,5,62.5,4,50,11,68.75,7,43.75,87.78,67.88,91.5,96.88,94.88,87.62,87.94,25,31.53,5.38,41.5,34.38,44.88,18.87,44.19,0,5,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,1,0,0,2,0,1,1,2,0,2,1,0,0,2,1,0,1,0,1,0,1,1.2,0.6,0,0.8,0.6,1.2,0.6,0.6,0.65,0.75,0.7,8,6.33,7.25,0.6,-0.6,-0.6,0.2,-0.2,1,3,1,-1,1.67,1,0,0,-2,2,2,-2,2,-2,0,0,1,5 cents,25 minutes,36 days,Male,University - Graduate (Masters),29,,0,1,0,0,0,0,0,0.33,0,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,3,8,4,6,7,2,5,1,9,4,3,2,1 +781,R_6cUDOClbgaba5re,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Agree,2,1,4,5,3,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,5,1,2,3,Strongly Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,1,4,3,2,5,Disagree,Disagree,Disagree,Disagree,Strongly disagree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Strongly Agree,Agree,Agree,Somewhat agree,3,2,5,1,4,9,Agree,Somewhat disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,4,3,1,2,8,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,1,3,5,2,4,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,Somewhat disagree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,Disagree,1,4,3,5,2,5,Strongly disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,3,2,4,1,5,Strongly Disagree,Disagree,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,3,5,2,4,1,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,3,5,4,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,74,FALSE,100,FALSE,86,TRUE,83,TRUE,100,TRUE,70,FALSE,100,TRUE,75,TRUE,91,FALSE,100,TRUE,100,TRUE,88,FALSE,100,FALSE,76,TRUE,87,FALSE,100,TRUE,100,TRUE,83,FALSE,100,FALSE,100,FALSE,100,FALSE,76,TRUE,76,FALSE,100,FALSE,100,TRUE,87,FALSE,100,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,-1,2,0,-1,3,0,3,-3,-3,3,-2,3,-2,-2,-2,-2,-3,0,3,2,2,1,5,2,-1,3,-3,0,9,1,-2,1,1,3,8,-1,-1,0,-3,-1,5,3,3,-2,1,-2,5,-3,0,3,0,1,5,-3,-2,-1,0,3,5,-3,-3,-3,-3,-3,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,74,FALSE,1,100,FALSE,0,86,TRUE,1,83,TRUE,1,100,TRUE,1,70,FALSE,1,100,TRUE,0,75,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,88,FALSE,1,100,FALSE,1,76,TRUE,0,87,FALSE,1,100,TRUE,1,100,TRUE,1,83,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,76,TRUE,0,76,FALSE,1,100,FALSE,1,100,TRUE,1,87,FALSE,0,100,TRUE,1,100,0.0289,0.5776,0.0144,0.7396,0,0,1,0.09,0,0.0289,0.0169,0.0081,0,0,0.0676,0,0,0.25,0,0,0,0,0.7569,0,0,0.5776,1,0,1,0.0576,0,0.5625,0.193432143,0.104392857,0.282471429,22,68.75,24,75,5,62.5,8,100,6,75,5,62.5,12,75,12,75,90.69,89.12,95.62,86.38,91.62,89.88,91.5,-6.25,15.69,26.62,-4.38,11.38,29.12,14.88,16.5,3,0,1,3,1,2,0,0,3,3,4,1,2,3,0,1,1,2,1,2,0,0,3,2,4,3,1,0,0,2,0,1,4,2,0,1,1,1,1,0,1.6,1.6,2,1.4,1.8,1.2,1.4,0.8,1.65,1.3,1.475,7.33,5,5.875,-0.2,0.4,0.6,0.6,0.266666667,0,4,3,0,2.33,1,1,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,45,I can't think of any feedback for this survey.,1.625,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,01DIR,7,2,8,9,3,5,4,1,6,4,3,2,1 +782,R_3xs0n15eFOtlXix,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Disagree,Strongly agree,Strongly agree,3,2,5,4,1,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,4,5,1,2,3,Somewhat Agree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Agree,4,2,3,1,5,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,4,3,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,4,2,3,5,1,5,Neither agree nor disagree,Agree,Strongly disagree,Strongly agree,Strongly agree,4,5,2,3,1,3,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Agree,Somewhat Disagree,2,1,5,4,3,6,Strongly Agree,Strongly Agree,Agree,Agree,Disagree,4,5,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Neither agree nor disagree,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,1,3,5,4,2,4,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,1,4,2,5,3,4,Somewhat Agree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,4,2,5,3,1,6,Agree,Agree,Agree,Strongly Agree,Disagree,2,3,5,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,63,TRUE,100,TRUE,60,FALSE,82,FALSE,100,TRUE,50,TRUE,93,FALSE,100,TRUE,100,FALSE,70,TRUE,90,TRUE,90,FALSE,50,TRUE,79,TRUE,100,TRUE,57,TRUE,100,TRUE,70,FALSE,100,TRUE,64,TRUE,70,FALSE,86,TRUE,90,TRUE,90,TRUE,100,TRUE,55,FALSE,54,TRUE,100,FALSE,50,FALSE,80,TRUE,100,TRUE,70,17,1,3,-2,3,3,-1,1,-1,1,2,1,-3,3,-1,2,-2,1,0,-1,-3,1,3,1,3,3,3,0,2,-3,3,3,5,-1,0,3,2,-1,3,3,3,2,2,-2,6,0,3,-2,3,3,2,1,-1,1,-1,3,4,1,-3,3,-2,3,4,2,2,2,3,-2,6,TRUE,0,70,TRUE,1,100,FALSE,1,80,FALSE,1,50,TRUE,1,100,FALSE,1,54,TRUE,1,55,TRUE,1,100,TRUE,1,90,TRUE,1,90,FALSE,1,86,TRUE,0,70,TRUE,1,64,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,57,TRUE,0,100,TRUE,0,79,FALSE,1,50,TRUE,1,90,TRUE,1,90,FALSE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,0,50,FALSE,1,100,FALSE,1,82,TRUE,1,60,TRUE,1,100,TRUE,1,63,0,0.0049,0,0.2025,0.1369,0.2116,0,0.01,0.25,0.01,0.16,0.1296,0.01,0.0196,0,0,0.09,0.25,0,0,0.01,0.09,0.6241,0,0.3249,0.25,0,0.49,0.04,1,0.0324,0.49,0.165325,0.091264286,0.239385714,17,53.13,26,81.25,6,75,7,87.5,6,75,7,87.5,16,100,10,62.5,80.09,78.12,72.5,87.25,82.5,85.31,74.88,-28.12,-1.16,3.12,-15,12.25,-5,-14.69,12.38,0,0,3,0,0,1,1,2,2,1,2,3,0,3,3,5,2,2,3,1,1,0,0,0,0,2,2,2,2,1,0,0,0,1,1,4,1,2,4,1,0.6,1.4,2.2,2.6,0.2,1.8,0.4,2.4,1.7,1.2,1.45,3.67,3.33,4.125,0.4,-0.4,1.8,0.2,0.6,1,1,-1,0,0.34,1,2,2,-1,1,0,0,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),27,,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,01PAST,02DGEN,02REV,6,2,9,8,4,3,5,1,7,3,4,2,1 +783,R_7c7xaPs4lZKH7zH,32 - 38,American,,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,1,4,5,3,Agree,Somewhat disagree,Disagree,Disagree,Agree,4,5,2,1,3,Somewhat Agree,Agree,Agree,Somewhat Agree,Strongly Agree,5,1,2,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,5,4,2,1,3,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,2,5,1,4,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,4,5,3,2,1,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,2,3,1,5,4,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,1,5,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,1,2,3,4,5,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,2,1,5,4,3,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,1,3,2,5,4,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,4,5,1,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,80,FALSE,94,TRUE,69,TRUE,94,TRUE,62,FALSE,57,TRUE,89,FALSE,97,TRUE,97,FALSE,71,TRUE,82,FALSE,84,FALSE,88,FALSE,82,TRUE,93,TRUE,67,TRUE,95,FALSE,69,TRUE,84,TRUE,71,FALSE,80,FALSE,80,TRUE,73,TRUE,75,TRUE,99,FALSE,73,FALSE,64,TRUE,87,FALSE,61,TRUE,89,FALSE,76,FALSE,88,23,2,3,3,2,3,2,-1,-2,-2,2,1,2,2,1,3,1,1,1,2,-1,2,3,3,2,3,5,1,-1,1,-1,2,5,1,2,2,1,2,5,0,1,1,2,1,5,2,2,3,2,3,5,2,-1,2,-1,2,5,1,2,2,1,2,5,1,2,2,2,1,5,FALSE,1,88,FALSE,0,76,TRUE,0,89,FALSE,1,61,TRUE,1,87,FALSE,1,64,FALSE,0,73,TRUE,1,99,TRUE,1,75,TRUE,1,73,FALSE,1,80,FALSE,1,80,TRUE,1,71,TRUE,0,84,FALSE,0,69,TRUE,1,95,TRUE,0,67,TRUE,0,93,FALSE,1,82,FALSE,1,88,FALSE,0,84,TRUE,1,82,FALSE,1,71,TRUE,1,97,FALSE,1,97,TRUE,1,89,FALSE,1,57,TRUE,0,62,TRUE,0,94,TRUE,1,69,FALSE,0,94,TRUE,1,80,0.0001,0.0121,0.0025,0.5329,0.04,0.1296,0.0009,0.0729,0.0144,0.0324,0.0961,0.0841,0.0625,0.04,0.0169,0.5776,0.0841,0.1521,0.3844,0.0009,0.7056,0.4761,0.0324,0.7056,0.4489,0.1849,0.8836,0.0144,0.7921,0.8649,0.8836,0.04,0.279321429,0.100257143,0.458385714,23,71.88,21,65.63,5,62.5,5,62.5,5,62.5,6,75,11,68.75,10,62.5,80.31,74.25,77.25,84.88,84.88,82.06,78.56,6.25,14.68,11.75,14.75,22.38,9.88,13.31,16.06,0,0,0,0,0,1,0,3,1,0,0,0,0,0,1,1,0,0,0,2,0,1,0,0,0,0,0,4,1,0,0,0,0,0,1,0,1,1,0,2,0,1,0.2,0.6,0.2,1,0.2,0.8,0.45,0.55,0.5,5,5,5,-0.2,0,0,-0.2,-0.066666667,0,0,0,0,0,1,1,1,-1,1,1,-1,1,-1,-1,1,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,32,good survey ,0.5,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,02REV,4,7,6,5,9,2,3,1,8,2,4,3,1 +784,R_3opUSXehbAHNJwG,18 - 24,,Canadian,Canadian,Male,Disagree,Strongly agree,Neither agree nor disagree,Agree,Agree,2,5,1,3,4,Agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,1,4,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,2,1,4,5,3,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Neither agree nor disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly disagree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,5,2,3,4,6,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,1,4,3,5,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,4,5,3,2,8,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,4,1,3,5,2,5,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,5,1,4,3,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,1,4,2,5,6,Somewhat agree,Agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,3,4,1,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,53,FALSE,53,TRUE,74,TRUE,60,TRUE,100,TRUE,69,TRUE,61,FALSE,54,TRUE,88,FALSE,53,TRUE,78,FALSE,58,FALSE,55,FALSE,57,TRUE,73,TRUE,94,FALSE,60,TRUE,60,FALSE,56,TRUE,72,TRUE,100,FALSE,64,FALSE,60,FALSE,62,TRUE,100,TRUE,100,TRUE,75,TRUE,77,FALSE,63,TRUE,96,FALSE,67,FALSE,63,5,-2,3,0,2,2,2,1,2,0,1,0,0,2,1,1,-1,-1,-2,1,0,-3,2,2,0,1,6,2,1,0,1,2,6,0,0,1,-1,1,6,-3,0,0,-2,-3,8,0,3,0,0,3,5,3,0,3,-1,3,5,1,1,1,1,2,6,1,2,1,3,0,6,FALSE,1,63,FALSE,0,67,TRUE,0,96,FALSE,1,63,TRUE,1,77,TRUE,0,75,TRUE,1,100,TRUE,1,100,FALSE,0,62,FALSE,0,60,FALSE,1,64,TRUE,0,100,TRUE,1,72,FALSE,1,56,TRUE,1,60,FALSE,0,60,TRUE,0,94,TRUE,0,73,FALSE,1,57,FALSE,1,55,FALSE,0,58,TRUE,1,78,FALSE,1,53,TRUE,1,88,FALSE,1,54,TRUE,1,61,TRUE,0,69,TRUE,0,100,TRUE,0,60,TRUE,1,74,FALSE,0,53,FALSE,0,53,0,0.1521,0.36,0,0.2809,0.5625,0.0144,0.36,0.2025,0.0484,0.0676,0.0784,0.3844,0.1296,0.0529,0.4489,0.2209,0.1369,1,0.2116,0.3364,0.16,0.1849,0.1936,0.8836,0.4761,0.2809,0.1369,0.9216,0.5329,0.36,1,0.345242857,0.21345,0.477035714,5,15.63,17,53.13,4,50,3,37.5,6,75,4,50,9,56.25,8,50,70.47,61.88,67.75,68.12,84.12,70.19,70.75,-37.5,17.34,11.88,30.25,-6.88,34.12,13.94,20.75,1,1,2,2,1,0,0,2,1,1,0,0,1,2,0,2,1,2,3,3,2,0,0,2,1,1,1,1,1,2,1,1,1,0,1,2,3,3,2,0,1.4,0.8,0.6,2.2,1,1.2,0.8,2,1.25,1.25,1.25,6,5.33,6,0.4,-0.4,-0.2,0.2,-0.066666667,1,1,0,2,0.67,1,2,1,-2,2,1,-1,0,0,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),22,,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,6,2,8,9,5,3,7,1,4,4,3,2,1 +785,R_6GITWb0bS6KmYsZ,18 - 24,,Canadian,Canadian,Male,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,1,5,2,3,4,Somewhat disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,2,5,1,4,3,Strongly Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Agree,1,2,3,5,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,2,1,5,Strongly disagree,Agree,Strongly Agree,Somewhat agree,Agree,5,1,3,4,2,7,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,5,1,4,3,2,9,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,Disagree,Strongly Agree,3,2,5,1,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,3,1,5,4,2,1,Somewhat disagree,Strongly disagree,Agree,Disagree,Strongly agree,1,5,2,4,3,3,Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,4,3,2,5,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,5,4,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,96,TRUE,91,FALSE,100,TRUE,50,TRUE,100,FALSE,63,TRUE,100,TRUE,100,TRUE,86,TRUE,60,FALSE,59,FALSE,75,TRUE,100,TRUE,100,TRUE,87,TRUE,100,FALSE,76,FALSE,94,FALSE,91,FALSE,50,TRUE,100,TRUE,91,FALSE,100,TRUE,90,FALSE,95,TRUE,100,FALSE,50,FALSE,100,TRUE,97,FALSE,55,FALSE,50,TRUE,90,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,1,1,3,-1,-3,1,0,3,-3,-3,3,-1,2,-1,1,1,-1,1,-3,2,3,1,2,7,-1,-1,-2,1,-1,9,3,-3,0,-2,3,10,3,3,3,3,3,10,1,3,1,1,3,1,-1,-3,2,-2,3,3,-2,-3,3,-2,3,3,1,1,1,0,2,6,FALSE,1,96,TRUE,1,91,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,63,TRUE,1,100,TRUE,1,100,TRUE,1,86,TRUE,1,60,FALSE,1,59,FALSE,1,75,TRUE,1,100,TRUE,0,100,TRUE,1,87,TRUE,1,100,FALSE,1,76,FALSE,1,94,FALSE,1,91,FALSE,1,50,TRUE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,90,FALSE,1,95,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,97,FALSE,0,55,FALSE,0,50,TRUE,1,90,0,0,0,0,0.01,0.1369,0.01,0.16,0.25,0.0081,0.3025,0,0.0196,0.1681,0,0.0081,0,0.25,0,0.0025,0,0.0169,0.0081,1,0.0576,0.25,0.25,0.0016,0,0.0036,0.9409,0.0625,0.139892857,0.094521429,0.185264286,25,78.13,27,84.38,6,75,7,87.5,7,87.5,7,87.5,14,87.5,13,81.25,84.25,70.5,90.75,92,83.75,87.5,81,-6.25,-0.13,-4.5,3.25,4.5,-3.75,0,-0.25,2,1,2,0,1,0,2,3,1,4,6,0,3,1,1,4,2,2,4,2,2,0,0,0,0,0,0,1,2,0,1,0,0,1,1,2,0,0,1,1,1.2,2,2.2,2.8,0.4,0.6,0.6,0.8,2.05,0.6,1.325,8.67,2.33,6.125,0.8,1.4,1.6,2,1.266666667,6,6,7,4,6.34,2,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,I dont have anything to say,1.75,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,9,4,3,6,5,7,2,1,8,3,4,2,1 +786,R_5DO6PvIpItaY44V,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,2,1,3,4,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat agree,1,2,3,5,4,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,2,5,4,3,1,Strongly disagree,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Agree,Agree,Somewhat agree,Somewhat disagree,3,5,4,2,1,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,3,2,1,4,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,2,1,3,4,5,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,5,2,4,3,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,3,Neither Agree nor Disagree,Disagree,Agree,Somewhat Agree,Strongly agree,2,5,1,3,4,6,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,4,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,82,TRUE,50,TRUE,76,TRUE,50,FALSE,58,TRUE,50,TRUE,92,TRUE,50,TRUE,65,FALSE,67,TRUE,72,TRUE,84,TRUE,50,TRUE,50,TRUE,96,TRUE,59,TRUE,81,TRUE,75,FALSE,50,TRUE,98,TRUE,74,FALSE,50,TRUE,87,TRUE,62,TRUE,100,TRUE,100,FALSE,81,TRUE,50,FALSE,50,TRUE,72,TRUE,69,TRUE,57,13,1,3,3,3,2,1,1,-1,3,1,0,-1,1,1,2,-3,-1,-3,-2,-3,3,2,2,1,-1,4,1,-1,1,1,-1,5,1,1,-1,2,1,4,0,1,1,2,1,4,2,3,3,3,2,3,1,0,1,0,1,3,0,-2,2,1,3,3,2,1,2,1,-1,6,TRUE,0,57,TRUE,1,69,TRUE,0,72,FALSE,1,50,TRUE,1,50,FALSE,1,81,TRUE,1,100,TRUE,1,100,TRUE,1,62,TRUE,1,87,FALSE,1,50,TRUE,0,74,TRUE,1,98,FALSE,1,50,TRUE,1,75,TRUE,1,81,TRUE,0,59,TRUE,0,96,TRUE,0,50,TRUE,0,50,TRUE,1,84,TRUE,1,72,FALSE,1,67,TRUE,1,65,TRUE,0,50,TRUE,1,92,TRUE,0,50,FALSE,1,58,TRUE,0,50,TRUE,1,76,TRUE,1,50,TRUE,1,82,0,0.0064,0.0361,0,0.0324,0.0361,0.1225,0.0169,0.25,0.0784,0.0576,0.0004,0.1444,0.25,0.25,0.0961,0.1089,0.25,0.1764,0.25,0.0256,0.0625,0.25,0.25,0.3481,0.25,0.25,0.3249,0.5184,0.9216,0.25,0.5476,0.218528571,0.120978571,0.316078571,13,40.63,22,68.75,6,75,6,75,5,62.5,5,62.5,16,100,6,37.5,68.97,57,71.38,75.5,72,77.69,60.25,-28.12,0.22,-18,-3.62,13,9.5,-22.31,22.75,2,1,1,2,3,0,2,2,2,2,1,2,2,1,1,3,2,4,4,4,1,0,0,0,0,0,1,2,3,0,0,1,1,0,1,5,2,5,3,2,1.8,1.6,1.4,3.4,0.2,1.2,0.6,3.4,2.05,1.35,1.7,4.33,3,4,1.6,0.4,0.8,0,0.933333333,1,2,1,-2,1.33,1,2,2,-2,2,-1,1,-1,1,-2,2,2,10 cents,5 minutes,47 days,Female,High School (or equivalent),21,no,1.625,0,1,1,1,0,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,9,3,2,4,8,7,5,1,6,4,2,3,1 +787,R_1mb2WqGSgK3tz69,39 - 45,American,,American,Male,Agree,Agree,Agree,Disagree,Agree,2,1,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,3,2,5,4,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,4,1,2,3,5,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,2,3,5,1,4,Agree,Agree,Agree,Disagree,Agree,4,2,1,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,1,4,3,5,2,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,5,3,1,2,4,3,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,5,4,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Disagree,Agree,1,3,4,5,2,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Neither agree nor disagree,1,4,5,3,2,3,Neither Agree nor Disagree,Somewhat Disagree,Agree,Strongly Disagree,Strongly Agree,3,5,2,1,4,4,Agree,Agree,Agree,Agree,Agree,5,4,2,3,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,70,TRUE,96,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,82,TRUE,58,TRUE,91,TRUE,82,FALSE,50,TRUE,71,TRUE,100,TRUE,60,TRUE,50,TRUE,60,TRUE,60,TRUE,91,TRUE,50,FALSE,92,FALSE,50,TRUE,71,FALSE,91,TRUE,82,TRUE,60,TRUE,60,TRUE,50,FALSE,81,FALSE,60,TRUE,60,FALSE,50,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-2,2,0,0,2,-1,2,1,0,2,-2,3,2,1,2,2,-1,2,2,2,-2,2,2,0,0,2,-1,2,2,0,0,2,-2,3,3,1,-1,1,0,-2,5,2,2,2,-2,2,1,0,0,2,-2,0,3,0,-1,2,-3,3,4,2,2,2,2,2,2,FALSE,1,70,TRUE,1,96,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,82,TRUE,1,58,TRUE,1,91,TRUE,1,82,FALSE,1,50,TRUE,0,71,TRUE,1,100,TRUE,0,60,TRUE,1,50,TRUE,1,60,TRUE,0,60,TRUE,0,91,TRUE,0,50,FALSE,1,92,FALSE,0,50,TRUE,1,71,FALSE,1,91,TRUE,1,82,TRUE,0,60,TRUE,1,60,TRUE,0,50,FALSE,1,81,FALSE,1,60,TRUE,1,60,FALSE,0,50,TRUE,1,100,0.1764,0.16,0.16,0.0324,0,0.25,0.0324,0.0324,0.0064,0.0841,0.16,0,0.0081,0.25,0.25,0.0016,0.0081,0.25,0.0361,0.36,0.25,0.25,0.25,0.36,0.36,0.25,0.25,0.09,0.25,0.8281,0.16,0.5041,0.19755,0.095221429,0.299878571,22,68.75,23,71.88,5,62.5,6,75,5,62.5,7,87.5,14,87.5,9,56.25,68.06,60.88,70.12,72,69.25,71.38,64.75,-3.13,-3.82,-1.62,-4.88,9.5,-18.25,-16.12,8.5,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,2,1,2,1,0,0,0,0,0,0,0,0,1,2,1,1,0,1,0,0,1,0,0,3,0,0,0.2,1.4,0,0.6,0.6,0.8,0.4,0.5,0.45,2.33,2.67,2.75,0,-0.6,-0.4,0.6,-0.333333333,1,-1,-1,3,-0.34,1,2,2,-2,2,-1,1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,41,I cannot think of anything to add. ,1.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,6,7,2,4,8,9,3,1,5,2,4,3,1 +788,R_7LtcDJJsu3A12Iz,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,4,3,5,2,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,5,1,4,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,1,5,4,2,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,4,1,5,3,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,5,3,4,1,2,10,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,1,4,5,3,2,9,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,1,4,2,3,9,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,3,4,5,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,4,1,3,2,9,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,1,2,3,4,5,9,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,2,3,4,9,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,4,5,2,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,83,FALSE,91,TRUE,72,TRUE,89,TRUE,95,TRUE,88,TRUE,91,TRUE,99,TRUE,92,FALSE,81,TRUE,89,TRUE,78,TRUE,96,TRUE,83,FALSE,86,TRUE,95,TRUE,85,TRUE,94,TRUE,81,FALSE,88,TRUE,97,TRUE,93,FALSE,81,FALSE,90,FALSE,90,TRUE,95,TRUE,92,TRUE,89,TRUE,89,TRUE,97,TRUE,87,TRUE,88,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,3,2,2,3,3,3,2,2,3,3,3,2,2,3,3,3,2,3,2,3,3,2,10,3,3,3,2,2,9,3,3,3,2,2,9,3,2,3,3,2,9,3,3,3,2,2,9,3,2,2,3,3,9,3,3,2,2,3,9,3,3,2,2,3,9,TRUE,0,83,FALSE,0,91,TRUE,0,72,TRUE,0,89,TRUE,1,95,TRUE,0,88,TRUE,1,91,TRUE,1,99,TRUE,1,92,FALSE,0,81,TRUE,0,89,TRUE,0,78,TRUE,1,96,TRUE,0,83,FALSE,0,86,TRUE,1,95,TRUE,0,85,TRUE,0,94,TRUE,0,81,FALSE,1,88,TRUE,1,97,TRUE,1,93,FALSE,1,81,FALSE,0,90,FALSE,1,90,TRUE,1,95,TRUE,0,92,TRUE,0,89,TRUE,0,89,TRUE,1,97,TRUE,1,87,TRUE,1,88,0.0001,0.0025,0.0025,0.0081,0.0144,0.7744,0.81,0.6561,0.0144,0.0049,0.0009,0.0016,0.0064,0.7921,0.0025,0.8281,0.0361,0.7921,0.7921,0.01,0.0009,0.7396,0.6561,0.6889,0.7225,0.8464,0.0169,0.6889,0.5184,0.8836,0.7921,0.6084,0.453528571,0.338142857,0.568914286,27,84.38,15,46.88,2,25,5,62.5,4,50,4,50,12,75,3,18.75,88.88,88.38,89.88,88.75,88.5,92.06,85.69,37.5,42,63.38,27.38,38.75,38.5,17.06,66.94,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,1,0.4,0.4,0.4,0.4,0.4,0.8,0.8,0.8,0.4,0.7,0.55,9.33,9,9.125,0,-0.4,-0.4,-0.4,-0.266666667,1,0,0,0,0.33,2,1,1,2,-2,1,-1,1,-1,2,-2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,no additional feedback,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,6,9,5,8,7,2,4,1,3,3,2,4,1 +789,R_1qvpvPkUq3A7QHL,25 - 31,American,,American,Male,Agree,Agree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,5,4,3,2,Strongly disagree,Disagree,Agree,Disagree,Somewhat agree,5,4,3,1,2,Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,2,3,5,1,4,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,4,1,5,3,Somewhat agree,Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,1,2,5,4,3,5,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat disagree,Agree,5,4,3,1,2,3,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,1,3,4,5,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,2,5,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,4,5,3,1,2,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,5,2,3,1,0,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,4,2,1,5,3,2,Agree,Agree,Agree,Agree,Agree,2,1,5,3,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,89,TRUE,100,TRUE,100,FALSE,50,TRUE,68,FALSE,50,FALSE,100,TRUE,77,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,100,FALSE,75,TRUE,88,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,50,FALSE,100,TRUE,100,TRUE,76,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,-3,0,-3,-2,2,-2,1,2,1,3,-2,3,-2,1,2,1,1,1,2,3,-3,0,5,-3,-3,1,-1,2,3,3,2,3,-3,3,0,-3,-3,-3,-3,-3,10,2,2,3,-3,0,2,-3,-3,3,-3,3,0,3,3,3,-2,3,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,89,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,68,FALSE,1,50,FALSE,1,100,TRUE,1,77,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,FALSE,1,100,FALSE,0,75,TRUE,1,88,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,1,76,0,0,0,0,0.0576,0.0121,0,0.1024,0,0.0144,1,0.0529,0.25,0.25,0.25,0.25,0,0.25,0,0,0.5625,0.25,0.25,0,0.25,0.25,0,1,1,1,0.25,0,0.260782143,0.177814286,0.34375,20,62.5,24,75,6,75,6,75,6,75,6,75,11,68.75,13,81.25,80.41,56.25,70.88,94.5,100,80.25,80.56,-12.5,5.41,-18.75,-4.12,19.5,25,11.5,-0.69,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,4,5,4,4,0,0,0,0,0,0,1,1,1,2,1,2,0,0,0,4,1,0,1,1,0.2,0.8,0.6,3.6,0,1,0.6,1.4,1.3,0.75,1.025,2.67,1.33,3,0.2,-0.2,0,2.2,1.85E-17,3,3,-2,8,1.34,0,2,2,-1,1,-1,1,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),30,,1.375,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,9,5,6,4,2,3,7,1,8,3,4,2,1 +790,R_1LHZwuv3ArwDt97,18 - 24,American,,American,Male,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,Strongly disagree,5,2,4,3,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,1,3,2,4,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,3,2,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,1,5,4,2,3,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,4,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,1,3,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,50,TRUE,50,TRUE,70,FALSE,55,TRUE,68,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,75,FALSE,84,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,55,FALSE,50,FALSE,65,FALSE,50,TRUE,50,FALSE,100,TRUE,71,FALSE,100,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,64,FALSE,50,TRUE,56,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,-3,0,-3,-3,0,0,1,0,-1,-1,3,0,3,0,0,0,-1,-3,0,3,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,3,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,5,TRUE,0,50,TRUE,1,50,TRUE,0,70,FALSE,1,55,TRUE,1,68,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,75,FALSE,1,84,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,55,FALSE,1,50,FALSE,1,65,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,71,FALSE,1,100,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,64,FALSE,0,50,TRUE,1,56,0.25,0.25,0.25,0.25,0.1936,0.25,0.0841,0.5625,0.1225,0.25,0.1296,0.25,0.25,0.0256,0.1024,0.25,0,0.2025,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.49,0.3025,0.25,1,0.248760714,0.190914286,0.306607143,2,6.25,20,62.5,6,75,4,50,5,62.5,5,62.5,10,62.5,10,62.5,59.78,54.88,59.25,60,65,55.25,64.31,-56.25,-2.72,-20.12,9.25,-2.5,2.5,-7.25,1.81,3,0,3,0,3,3,0,0,1,0,1,1,3,0,3,0,0,0,1,3,3,3,3,0,3,3,0,0,1,0,1,1,3,0,3,0,0,0,1,3,1.8,0.8,1.6,0.8,2.4,0.8,1.6,0.8,1.25,1.4,1.325,4.33,4.67,4.625,-0.6,0,0,0,-0.2,0,0,-1,0,-0.34,2,1,0,-2,2,1,-1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,19,This was an interesting survey.,0.75,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,4,6,5,3,8,7,9,1,2,3,4,2,1 +791,R_3O3zMA225SHV2Kb,32 - 38,American,,American,Male,Somewhat agree,Disagree,Neither agree nor disagree,Disagree,Strongly disagree,5,3,1,2,4,Disagree,Somewhat disagree,Somewhat agree,Disagree,Somewhat disagree,4,5,3,1,2,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Disagree,Agree,3,4,2,1,5,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,5,2,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Disagree,Somewhat agree,Disagree,Strongly disagree,2,1,4,3,5,2,Disagree,Disagree,Somewhat disagree,Disagree,Disagree,4,5,3,1,2,2,Somewhat Disagree,Agree,Neither Agree nor Disagree,Disagree,Somewhat Agree,4,2,3,1,5,5,Disagree,Disagree,Disagree,Disagree,Disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Strongly disagree,3,5,1,4,2,2,Strongly disagree,Disagree,Agree,Disagree,Disagree,1,5,3,2,4,2,Somewhat Disagree,Agree,Somewhat Agree,Disagree,Agree,3,2,4,1,5,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,1,5,2,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,76,TRUE,75,TRUE,80,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,70,FALSE,100,FALSE,82,TRUE,90,TRUE,52,TRUE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,100,FALSE,76,TRUE,80,TRUE,71,TRUE,100,TRUE,100,FALSE,100,TRUE,51,FALSE,52,FALSE,65,FALSE,70,FALSE,91,20,1,-2,0,-2,-3,-2,-1,1,-2,-1,-1,1,0,-2,2,0,-1,1,1,-2,2,-2,1,-2,-3,2,-2,-2,-1,-2,-2,2,-1,2,0,-2,1,2,-2,-2,-2,-2,-2,5,1,-1,1,-2,-3,2,-3,-2,2,-2,-2,2,-1,2,1,-2,2,2,-1,-1,-1,-1,-2,2,FALSE,1,91,FALSE,0,70,FALSE,1,65,FALSE,1,52,TRUE,1,51,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,71,TRUE,1,80,FALSE,1,76,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,0,52,TRUE,0,90,FALSE,1,82,FALSE,1,100,TRUE,1,70,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,80,TRUE,1,75,TRUE,1,76,TRUE,1,100,0,0,0,0,0,0,0,0.04,0,0,0.0625,0,0.0841,0.0576,0.2401,0.49,0,0.2304,0,0,0.09,0.25,0.0324,0,0.2704,0.25,0.0576,0.0081,0.1225,0.81,0.64,0,0.133417857,0.08605,0.180785714,20,62.5,27,84.38,6,75,6,75,7,87.5,8,100,15,93.75,12,75,83.78,65.88,81.62,95.12,92.5,83.94,83.62,-21.88,-0.6,-9.12,6.62,7.62,-7.5,-9.81,8.62,1,0,1,0,0,0,1,2,0,1,0,1,0,0,1,2,1,3,3,0,0,1,1,0,0,1,1,1,0,1,0,1,1,0,0,1,0,2,2,0,0.4,0.8,0.4,1.8,0.4,0.8,0.4,1,0.85,0.65,0.75,2,2,2.375,0,0,0,0.8,0,0,0,0,3,0,0,2,-1,-1,1,-1,1,-1,1,-1,1,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),38,,0.75,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,02DGEN,02REV,2,6,8,9,3,5,7,1,4,3,4,2,1 +792,R_1ZO4Z0bMP1CCwKt,18 - 24,,Canadian,Canadian,Female,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,4,1,5,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Strongly agree,1,2,4,3,5,Agree,Somewhat Agree,Agree,Agree,Strongly Agree,5,1,2,4,3,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,1,2,5,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Disagree,5,1,4,3,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,3,1,2,4,5,6,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,5,1,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,5,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,4,1,3,7,Agree,Somewhat agree,Agree,Somewhat agree,Agree,4,3,2,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,53,FALSE,53,TRUE,100,TRUE,80,TRUE,93,FALSE,59,TRUE,90,TRUE,82,TRUE,59,TRUE,55,FALSE,60,FALSE,100,FALSE,70,FALSE,60,TRUE,80,TRUE,60,FALSE,57,TRUE,100,FALSE,64,FALSE,61,TRUE,100,FALSE,62,TRUE,78,FALSE,59,FALSE,56,TRUE,76,FALSE,56,TRUE,75,TRUE,75,TRUE,100,FALSE,59,TRUE,64,16,-1,2,1,-1,1,2,0,1,-2,3,2,1,2,2,3,0,2,1,1,0,1,1,0,1,1,6,0,0,-1,-1,-2,8,0,0,0,-1,1,6,-1,1,1,1,1,6,1,1,1,1,1,7,1,0,1,1,1,7,1,1,1,0,0,5,2,1,2,1,2,7,TRUE,0,64,FALSE,0,59,TRUE,0,100,TRUE,0,75,TRUE,1,75,FALSE,1,56,TRUE,1,76,FALSE,0,56,FALSE,0,59,TRUE,1,78,FALSE,1,62,TRUE,0,100,FALSE,0,61,FALSE,1,64,TRUE,1,100,FALSE,0,57,TRUE,0,60,TRUE,0,80,FALSE,1,60,FALSE,1,70,FALSE,0,100,FALSE,0,60,TRUE,0,55,TRUE,1,59,TRUE,0,82,TRUE,1,90,FALSE,1,59,TRUE,0,93,TRUE,0,80,TRUE,1,100,FALSE,0,53,FALSE,0,53,0.3136,0.01,0.3249,0.0576,0.2809,0.1936,0.1681,0.0484,0.09,0.36,0,0.3721,0.3481,0.1444,0.0625,0.3481,0.3025,0.5625,0.8649,0.6724,1,0,0.16,0.1296,0.36,0.1681,0.2809,0.4096,1,0.64,0.64,1,0.378810714,0.234371429,0.52325,16,50,13,40.63,4,50,2,25,4,50,3,37.5,7,43.75,6,37.5,71.75,65.88,67.5,74.25,79.38,71,72.5,9.37,31.12,15.88,42.5,24.25,41.88,27.25,35,2,1,1,2,0,2,0,2,1,5,2,1,2,3,2,1,1,0,0,1,2,1,0,2,0,1,0,0,3,2,1,0,1,2,3,2,1,1,0,2,1.2,2,2,0.6,1,1.2,1.4,1.2,1.45,1.2,1.325,6.67,6.33,6.5,0.2,0.8,0.6,-0.6,0.533333333,-1,1,1,-1,0.34,1,0,0,1,-1,1,-1,0,0,0,0,1,10 cents,75 minutes,47 days,Female,University - Undergraduate,20,none,0,0,0,1,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,9,2,6,4,8,5,7,1,3,4,2,3,1 +793,R_3ht32nKfhP8a70Z,39 - 45,American,,American,Male,Agree,Agree,Agree,Agree,Agree,1,2,5,3,4,Agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,3,2,5,4,1,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,1,2,4,3,5,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Agree,Agree,3,2,5,1,4,5,Agree,Neither agree nor disagree,Agree,Disagree,Agree,3,1,2,5,4,0,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,4,1,3,5,5,Agree,Neither agree nor disagree,Agree,Agree,Agree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,3,1,2,4,5,2,Agree,Neither agree nor disagree,Agree,Disagree,Agree,5,1,4,3,2,2,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,5,3,1,4,2,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,5,3,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,70,TRUE,100,FALSE,78,FALSE,100,FALSE,74,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,81,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,26,2,2,2,2,2,2,0,3,-3,2,2,0,0,0,2,1,2,2,2,0,2,2,2,2,2,1,2,0,2,-2,2,5,2,2,0,0,2,0,2,0,2,2,2,5,2,2,2,2,2,2,2,0,2,-2,2,2,2,2,0,0,2,2,2,2,2,1,0,2,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,81,FALSE,0,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,1,100,FALSE,1,78,TRUE,1,100,TRUE,1,70,TRUE,1,100,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0.0361,1,1,1,0.0676,0.09,1,1,0,0.0484,1,0.330075,0.142857143,0.517292857,26,81.25,22,68.75,5,62.5,6,75,6,75,5,62.5,14,87.5,8,50,96.97,90.62,97.25,100,100,96.94,97,12.5,28.22,28.12,22.25,25,37.5,9.44,47,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,1,2,0,0,2,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,1,0,0,1,0,0,0.4,0.4,1,0,0.4,0.4,0.4,0.45,0.3,0.375,2,2,2.375,0,0,0,0.6,0,-1,3,-2,3,0,0,2,0,-2,2,0,0,-2,2,-2,2,2,10 cents,5 minutes,15 days,Male,High School (or equivalent),43,,1.25,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,3,8,4,6,7,2,9,1,5,2,3,4,1 +794,R_6KvJr2tX3MpsurF,39 - 45,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,Agree,Disagree,Agree,Disagree,Agree,1,3,4,2,5,Agree,Agree,Agree,Agree,Agree,4,2,1,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,4,3,5,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,4,2,5,Agree,Somewhat disagree,Agree,Disagree,Agree,4,2,3,1,5,5,Agree,Agree,Somewhat Agree,Agree,Agree,3,2,4,1,5,5,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,3,Agree,Disagree,Agree,Disagree,Agree,3,5,1,4,2,5,Agree,Agree,Agree,Agree,Agree,3,4,5,1,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,81,TRUE,100,TRUE,100,FALSE,84,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,3,3,2,-2,2,-2,2,2,2,2,2,2,3,3,3,3,3,1,3,3,3,3,5,2,-1,2,-2,2,5,2,2,1,2,2,5,3,3,2,3,3,5,1,3,3,3,3,3,2,-2,2,-2,2,5,2,2,2,2,2,5,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,100,FALSE,1,84,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0.6561,0,1,1,0,0,0,0,0.0256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.095775,0.19155,0,29,90.63,29,90.63,8,100,7,87.5,8,100,6,75,14,87.5,15,93.75,98.91,100,98,100,97.62,100,97.81,0,8.28,0,10.5,0,22.62,12.5,4.06,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0.2,0,0,0,0,0.15,0,0.075,5,4.33,4.75,0,0.2,0.2,0.2,0.133333333,2,0,0,0,0.67,2,2,2,2,-2,2,-2,2,-2,1,-1,1,5 cents,5 minutes,47 days,Male,University - PhD,39,Bad survey. too long,0,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,6,9,7,8,3,5,4,1,2,4,2,3,1 +795,R_1CTlUoqH71ssoqs,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,5,2,4,3,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,4,5,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,4,2,1,5,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,10,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,1,3,2,5,10,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Agree,Strongly Agree,Agree,Agree,Agree,1,2,3,4,5,8,Strongly agree,Strongly agree,Agree,Agree,Agree,5,2,1,3,4,10,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,3,5,10,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,4,1,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,81,TRUE,81,TRUE,81,FALSE,88,FALSE,97,FALSE,92,TRUE,87,TRUE,83,FALSE,100,FALSE,92,FALSE,80,FALSE,82,TRUE,92,TRUE,87,TRUE,100,TRUE,82,TRUE,100,TRUE,84,FALSE,82,FALSE,96,FALSE,100,TRUE,92,TRUE,92,TRUE,91,FALSE,98,TRUE,98,FALSE,82,FALSE,89,FALSE,94,TRUE,91,TRUE,100,18,3,3,2,3,2,3,2,3,3,3,2,3,2,3,3,2,3,3,3,3,2,2,3,3,3,9,2,2,3,3,3,10,3,3,3,2,3,10,2,3,3,2,3,10,2,3,2,2,2,10,3,3,2,2,2,8,2,2,3,3,3,10,2,3,2,3,3,10,TRUE,0,100,TRUE,1,91,FALSE,1,94,FALSE,1,89,FALSE,0,82,TRUE,0,98,FALSE,0,98,TRUE,1,91,TRUE,1,92,TRUE,1,92,FALSE,1,100,FALSE,1,96,FALSE,0,82,TRUE,0,84,TRUE,1,100,TRUE,1,82,TRUE,0,100,TRUE,0,87,TRUE,0,92,FALSE,1,82,FALSE,0,80,FALSE,0,92,FALSE,1,100,TRUE,1,83,TRUE,0,87,FALSE,0,92,FALSE,1,97,FALSE,1,88,TRUE,0,81,TRUE,1,81,TRUE,1,81,TRUE,1,100,0.0081,0.8464,0.0324,0.9604,0,0.9604,0.0289,0.0064,0.0324,0.8464,0.0361,0.6724,0.0064,0,0.6724,0.0081,0,0.0121,0.0144,0.7569,0.64,0,0.8464,0.7056,1,0.0009,0.0361,1,0.0036,0.7569,0.6561,0.0016,0.346446429,0.234428571,0.458464286,18,56.25,18,56.25,7,87.5,2,25,1,12.5,8,100,10,62.5,8,50,90.44,92.75,90.38,91.5,87.12,88.69,92.19,0,34.19,5.25,65.38,79,-12.88,26.19,42.19,1,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,1,0,0,0,0,1,0,0,0.8,0.2,0.6,0.2,0.4,0.8,0.4,0.2,0.45,0.45,0.45,9.67,9.33,9.625,0.4,-0.6,0.2,0,0,-1,2,0,0,0.34,1,1,2,2,-2,1,-1,2,-2,1,-1,2,10 cents,100 minutes,24 days,Male,University - PhD,35,"Is very excellent, thanks for this invitation in all aspect",0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,3,2,8,9,6,7,5,1,4,3,2,4,1 +796,R_3rTYmI54D4bgnwY,25 - 31,,Canadian,Canadian,Female,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,3,4,5,1,2,Somewhat agree,Neither agree nor disagree,Disagree,Agree,Somewhat agree,5,2,4,3,1,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,1,2,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,Somewhat agree,4,1,3,5,2,7,Somewhat agree,Agree,Strongly agree,Somewhat agree,Somewhat agree,3,2,1,4,5,6,Neither Agree nor Disagree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,4,5,3,1,2,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Agree,Somewhat agree,Agree,3,4,2,1,5,7,Somewhat agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,2,5,1,4,3,7,Somewhat Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,2,3,5,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,2,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,64,FALSE,78,TRUE,83,FALSE,78,FALSE,79,FALSE,85,FALSE,85,FALSE,72,FALSE,94,TRUE,79,FALSE,82,TRUE,100,FALSE,86,FALSE,84,TRUE,81,FALSE,65,FALSE,86,TRUE,90,FALSE,84,FALSE,73,TRUE,100,FALSE,78,TRUE,82,FALSE,72,TRUE,76,FALSE,73,FALSE,79,FALSE,78,FALSE,75,TRUE,87,FALSE,73,TRUE,87,20,-1,2,1,0,2,1,0,-2,2,1,0,1,0,1,1,0,1,1,1,-1,2,1,0,3,1,7,1,2,3,1,1,7,0,-2,1,0,-1,6,0,1,1,0,2,6,2,1,2,1,2,7,1,2,1,2,0,7,-1,2,0,0,1,7,1,1,1,0,1,7,TRUE,0,87,FALSE,0,73,TRUE,0,87,FALSE,1,75,FALSE,0,78,FALSE,1,79,FALSE,0,73,TRUE,1,76,FALSE,0,72,TRUE,1,82,FALSE,1,78,TRUE,0,100,FALSE,0,73,FALSE,1,84,TRUE,1,90,FALSE,0,86,FALSE,1,65,TRUE,0,81,FALSE,1,84,FALSE,1,86,TRUE,1,100,FALSE,0,82,TRUE,0,79,FALSE,0,94,FALSE,1,72,FALSE,0,85,FALSE,1,85,FALSE,1,79,FALSE,1,78,TRUE,1,83,FALSE,0,78,FALSE,0,64,0.0576,0.7225,0.7396,0.5329,0.4096,0.0441,0.8836,0.0324,0.0196,0.6724,0.0289,0.5329,0.5184,0.0484,0.6084,0.5329,0.6241,0.0625,0.0441,0.0784,0,0.01,0.0256,0.0256,0.1225,0.0225,0.6084,0.7569,0.7569,0.6561,0.0484,1,0.327628571,0.358442857,0.296814286,20,62.5,16,50,5,62.5,4,50,3,37.5,4,50,5,31.25,11,68.75,80.88,79.38,77,80.75,86.38,80.56,81.19,12.5,30.88,16.88,27,43.25,36.38,49.31,12.44,3,1,1,3,1,0,2,5,1,0,0,3,1,1,2,0,0,0,1,3,3,1,1,1,0,0,2,3,0,1,1,1,0,1,0,1,0,0,1,2,1.8,1.6,1.4,0.8,1.2,1.2,0.6,0.8,1.4,0.95,1.175,6.67,7,6.75,0.6,0.4,0.8,0,0.6,0,0,-1,-1,-0.33,0,0,0,1,-1,0,0,0,0,1,-1,0,5 cents,5 minutes,47 days,Female,University - Undergraduate,26,it was a good survey ,-0.25,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,4,9,5,3,8,7,2,1,6,4,2,3,1 +797,R_5Bo1X3nIGzcQF1q,25 - 31,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,2,1,4,5,3,Strongly disagree,Disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,Agree,Disagree,Agree,Disagree,Strongly Agree,4,1,5,3,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,5,2,4,3,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat agree,3,5,4,1,2,6,Strongly disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Disagree,5,4,1,2,3,1,Agree,Strongly Disagree,Agree,Disagree,Strongly Agree,2,5,3,1,4,2,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,3,4,2,1,3,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,5,2,1,4,3,4,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,2,3,1,5,3,Disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,3,2,5,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,51,TRUE,50,TRUE,80,TRUE,50,FALSE,74,FALSE,50,TRUE,80,TRUE,59,TRUE,92,FALSE,50,TRUE,69,TRUE,56,FALSE,50,TRUE,50,TRUE,50,TRUE,66,TRUE,59,TRUE,62,FALSE,50,TRUE,55,FALSE,57,FALSE,50,TRUE,63,TRUE,50,TRUE,93,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,62,FALSE,50,TRUE,79,9,2,3,3,1,2,-3,-2,3,0,0,2,-2,2,-2,3,-1,-1,0,0,-2,1,3,3,-1,1,6,-3,-3,3,0,-2,1,2,-3,2,-2,3,2,-1,1,1,0,1,7,3,3,3,2,2,3,-2,-2,3,0,-1,4,2,-3,3,-3,3,3,-2,-2,0,0,-2,7,TRUE,0,79,FALSE,0,50,TRUE,0,62,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,93,TRUE,1,50,TRUE,1,63,FALSE,1,50,FALSE,1,57,TRUE,1,55,FALSE,1,50,TRUE,1,62,TRUE,1,59,TRUE,0,66,TRUE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,56,TRUE,1,69,FALSE,1,50,TRUE,1,92,TRUE,0,59,TRUE,1,80,FALSE,1,50,FALSE,1,74,TRUE,0,50,TRUE,1,80,TRUE,1,50,TRUE,1,51,0.0049,0.04,0.1681,0.25,0.2401,0.25,0.0064,0.1369,0.25,0.0961,0.04,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.0676,0.3481,0.1936,0.1444,0.25,0.25,0.4356,0.25,0.25,0.6241,0.3844,0.25,0.25,0.1849,0.235882143,0.194428571,0.277335714,9,28.13,22,68.75,5,62.5,6,75,4,50,7,87.5,14,87.5,8,50,59.59,51.5,53.5,62.5,70.88,63.12,56.06,-40.62,-9.16,-11,-21.5,12.5,-16.62,-24.38,6.06,1,0,0,2,1,0,1,0,0,2,0,1,0,0,0,0,2,1,0,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0.8,0.6,0.2,1.2,0.4,0.4,0.6,0.4,0.7,0.45,0.575,3,3.33,4.125,0.4,0.2,-0.4,0.8,0.066666667,3,-3,-1,0,-0.33,2,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,,1.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,2,4,5,6,8,7,9,1,3,3,4,2,1 +798,R_7E6OiTDqe7hlo19,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,3,1,5,2,Agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,5,1,3,4,2,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,1,2,4,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,4,2,3,1,Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,3,2,5,4,1,7,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Agree,1,5,4,2,3,4,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,3,1,5,4,2,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,4,5,1,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,2,3,1,4,5,7,Agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,3,4,1,3,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,3,5,1,2,3,Somewhat agree,Strongly Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,4,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,85,TRUE,90,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,95,TRUE,90,FALSE,100,TRUE,70,TRUE,100,FALSE,75,TRUE,60,TRUE,100,FALSE,50,TRUE,80,TRUE,75,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,95,FALSE,98,TRUE,100,TRUE,70,FALSE,50,TRUE,85,FALSE,65,FALSE,100,TRUE,96,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,0,3,2,0,2,1,2,2,0,3,0,3,0,1,2,1,0,2,3,3,-1,3,7,0,-1,2,1,2,4,2,0,2,1,2,2,0,1,1,-1,0,2,2,3,3,0,3,7,2,-1,3,0,3,3,2,-1,3,0,3,3,1,3,1,1,0,6,TRUE,0,85,TRUE,1,90,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,90,FALSE,1,100,TRUE,0,70,TRUE,1,100,FALSE,1,75,TRUE,1,60,TRUE,1,100,FALSE,1,50,TRUE,0,80,TRUE,0,75,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,98,TRUE,1,100,TRUE,0,70,FALSE,1,50,TRUE,0,85,FALSE,0,65,FALSE,0,100,TRUE,1,96,0,0,0,0,0.0016,0,0.0025,0.01,0.25,0,0.4225,0,0.0025,0,0,0.01,0,0.25,0.25,0.0004,0,0.16,0.5625,0.0625,0.25,0.49,1,0.7225,0,0.64,0.7225,0.49,0.224982143,0.067792857,0.382171429,26,81.25,24,75,5,62.5,7,87.5,6,75,6,75,14,87.5,10,62.5,85.28,80,91.38,91,78.75,93.19,77.38,6.25,10.28,17.5,3.88,16,3.75,5.69,14.88,0,0,0,1,0,2,1,0,0,0,0,0,1,1,1,0,0,1,2,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,2,1,0,0,0.2,0.6,0.6,0.6,0,0.8,0.2,0.8,0.5,0.45,0.475,4.33,4.33,4.25,0.2,-0.2,0.4,-0.2,0.133333333,0,1,-1,-4,0,1,1,1,-2,2,0,0,2,-2,-1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,4,8,5,2,9,6,3,1,7,2,4,3,1 +799,R_3mhdoEs0UVczlc4,18 - 24,,Canadian,Canadian,Female,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Agree,5,1,3,4,2,Strongly agree,Strongly agree,Agree,Agree,Somewhat agree,3,1,4,5,2,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat Disagree,3,1,4,5,2,Disagree,Agree,Somewhat disagree,Agree,Neither agree nor disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,3,1,4,2,5,10,Somewhat agree,Disagree,Disagree,Agree,Neither agree nor disagree,3,1,4,5,2,9,Somewhat Disagree,Somewhat Disagree,Agree,Disagree,Somewhat Agree,2,5,1,4,3,9,Agree,Agree,Somewhat disagree,Agree,Somewhat agree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,4,2,1,3,5,10,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,1,5,3,2,4,5,Strongly agree,Strongly agree,Somewhat Disagree,Agree,Strongly agree,5,1,2,3,4,9,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Agree,5,2,3,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,83,TRUE,100,TRUE,74,FALSE,59,FALSE,60,TRUE,86,FALSE,55,TRUE,54,FALSE,100,FALSE,54,FALSE,54,FALSE,100,FALSE,55,FALSE,100,FALSE,55,TRUE,64,FALSE,66,TRUE,68,FALSE,59,TRUE,76,FALSE,55,TRUE,55,FALSE,55,FALSE,56,TRUE,58,TRUE,59,FALSE,57,FALSE,68,TRUE,55,FALSE,55,FALSE,100,4,-3,3,3,3,2,3,3,2,2,1,2,3,2,3,-1,-2,2,-1,2,0,1,-1,-1,0,-3,8,1,-2,-2,2,0,10,-1,-1,2,-2,1,9,2,2,-1,2,1,9,-1,0,2,-2,1,8,-2,1,2,1,-1,10,3,3,-1,2,3,5,-2,0,-1,1,2,9,FALSE,1,100,FALSE,0,55,TRUE,0,55,FALSE,1,68,FALSE,0,57,TRUE,0,59,TRUE,1,58,FALSE,0,56,FALSE,0,55,TRUE,1,55,FALSE,1,55,TRUE,0,76,FALSE,0,59,TRUE,0,68,FALSE,0,66,TRUE,1,64,FALSE,1,55,FALSE,1,100,FALSE,1,55,FALSE,1,100,FALSE,0,54,FALSE,0,54,FALSE,1,100,TRUE,1,54,FALSE,1,55,TRUE,1,86,FALSE,1,60,FALSE,1,59,TRUE,0,74,TRUE,1,100,FALSE,0,83,TRUE,1,100,0.3136,0.0196,0.1296,0.1764,0,0.3481,0.2116,0.2025,0,0.2916,0,0.3481,0.3025,0.2025,0.3249,0.3025,0,0.1024,0.1681,0.2025,0.2916,0.4356,0.2025,0.4624,0.2025,0.16,0.6889,0,0.3025,0,0.5476,0.5776,0.245660714,0.188335714,0.302985714,4,12.5,18,56.25,4,50,3,37.5,6,75,5,62.5,7,43.75,11,68.75,68.59,62.12,69.75,72,70.5,66,71.19,-43.75,12.34,12.12,32.25,-3,8,22.25,2.44,4,4,4,3,5,2,5,4,0,1,3,4,0,5,2,4,0,0,0,1,2,3,1,5,1,5,2,0,1,2,1,0,3,1,4,0,2,0,1,2,4,2.4,2.8,1,2.4,2,1.8,1,2.55,1.8,2.175,9,7.67,8.5,1.6,0.4,1,0,1,0,0,4,0,1.33,-1,2,0,-1,1,1,-1,-1,1,1,-1,2,15 cents,100 minutes,15 days,Female,College Diploma/Certificate,24,Thank you maybe add some more images that would make it more interesting,0.375,0,0,0,0,1,0,0,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,5,3,2,8,9,6,7,1,4,2,3,4,1 +800,R_5KOpAvIfnlnAQTG,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Agree,Somewhat disagree,Agree,4,1,3,5,2,Somewhat disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,4,2,5,1,Somewhat Agree,Strongly Disagree,Agree,Strongly Agree,Agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,5,2,Agree,Agree,Agree,Strongly Agree,Neither agree nor disagree,1,3,5,4,2,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,5,2,4,1,3,5,Somewhat Agree,Strongly Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,2,5,4,3,1,6,Disagree,Disagree,Disagree,Disagree,Disagree,3,4,1,2,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Somewhat disagree,Strongly Agree,1,3,2,5,4,0,Somewhat disagree,Disagree,Agree,Disagree,Agree,3,4,5,1,2,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Strongly Agree,Agree,4,2,1,3,5,1,Agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,3,4,2,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,FALSE,50,FALSE,100,TRUE,50,TRUE,63,FALSE,100,TRUE,85,TRUE,79,FALSE,50,TRUE,62,FALSE,52,TRUE,52,TRUE,77,FALSE,100,FALSE,61,TRUE,90,TRUE,65,TRUE,65,TRUE,50,FALSE,50,TRUE,70,TRUE,72,TRUE,50,TRUE,77,FALSE,89,TRUE,100,FALSE,50,FALSE,68,TRUE,50,FALSE,65,FALSE,60,TRUE,84,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-1,2,-1,-2,3,-1,1,1,-3,2,3,2,1,1,1,1,0,2,2,2,3,0,4,-1,-1,-1,3,0,5,1,-3,-1,-1,1,6,-2,-2,-2,-2,-2,7,3,2,2,-1,3,0,-1,-2,2,-2,2,2,0,-3,3,3,2,1,2,3,2,2,0,4,TRUE,0,70,FALSE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,63,FALSE,1,100,TRUE,1,85,TRUE,1,79,FALSE,0,50,TRUE,1,62,FALSE,1,52,TRUE,0,52,TRUE,1,77,FALSE,1,100,FALSE,0,61,TRUE,1,90,TRUE,0,65,TRUE,0,65,TRUE,0,50,FALSE,1,50,TRUE,1,70,TRUE,1,72,TRUE,0,50,TRUE,1,77,FALSE,1,89,TRUE,1,100,FALSE,1,50,FALSE,1,68,TRUE,0,50,FALSE,0,65,FALSE,0,60,TRUE,1,84,0.0441,0,0.01,0.0225,0.0256,0,0.0529,0.1444,0.25,0.0784,0.4225,0.0529,0.25,0.2304,0.1369,0.25,0.25,0.25,0.1024,0.0121,0.09,0.3721,0.25,0,0.4225,0.25,0.36,0.49,0,0.4225,0.25,0.2704,0.203071429,0.171,0.235142857,12,37.5,19,59.38,2,25,5,62.5,6,75,6,75,11,68.75,8,50,68.94,52.88,69.88,80.38,72.62,71.56,66.31,-21.88,9.56,27.88,7.38,5.38,-2.38,2.81,16.31,0,0,0,4,2,0,1,4,4,1,0,0,3,4,1,3,3,3,3,2,1,0,0,0,1,0,0,1,1,1,1,0,1,0,0,1,2,1,1,0,1.2,2,1.6,2.8,0.4,0.6,0.4,1,1.9,0.6,1.25,5,1,3.625,0.8,1.4,1.2,1.8,1.133333333,4,3,5,3,4,1,2,2,-2,2,-2,2,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),31,,1.875,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,2,9,3,4,8,5,7,1,6,4,2,3,1 +801,R_7DOLfyoA3NG45QB,18 - 24,,Canadian,Canadian,Female,Disagree,Agree,Somewhat disagree,Agree,Somewhat disagree,5,1,4,2,3,Strongly disagree,Agree,Strongly disagree,Strongly agree,Somewhat agree,1,3,2,4,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,4,1,2,5,3,Disagree,Somewhat agree,Strongly disagree,Strongly disagree,Strongly disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat disagree,Agree,Agree,Somewhat disagree,Somewhat agree,2,4,1,5,3,6,Somewhat disagree,Somewhat agree,Strongly disagree,Strongly agree,Somewhat agree,5,2,3,4,1,5,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Strongly Agree,Agree,1,4,5,3,2,8,Somewhat agree,Agree,Disagree,Somewhat agree,Strongly disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat disagree,Agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,4,5,1,2,3,3,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,3,2,5,4,1,3,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,3,2,5,1,4,8,Disagree,Disagree,Disagree,Disagree,Strongly disagree,1,5,3,2,4,TRUE,97,FALSE,65,FALSE,70,FALSE,60,TRUE,76,FALSE,53,FALSE,98,FALSE,65,TRUE,53,TRUE,60,FALSE,50,TRUE,99,TRUE,51,FALSE,100,FALSE,52,TRUE,60,FALSE,50,TRUE,52,TRUE,55,FALSE,53,FALSE,50,TRUE,100,TRUE,81,FALSE,65,TRUE,85,TRUE,98,FALSE,50,FALSE,57,TRUE,51,FALSE,57,TRUE,50,FALSE,59,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,-1,2,-1,-3,2,-3,3,1,1,1,2,1,3,-2,1,-3,-3,-3,-1,2,2,-1,1,4,-1,1,-3,3,1,6,-1,-1,1,3,2,5,1,2,-2,1,-3,8,-1,2,1,3,0,4,-1,1,1,2,-1,3,1,2,2,1,2,3,-2,-2,-2,-2,-3,8,TRUE,0,97,FALSE,0,65,FALSE,1,70,FALSE,1,60,TRUE,1,76,FALSE,1,53,FALSE,0,98,FALSE,0,65,TRUE,1,53,TRUE,1,60,FALSE,1,50,TRUE,0,99,TRUE,1,51,FALSE,1,100,FALSE,0,52,TRUE,1,60,FALSE,1,50,TRUE,0,52,TRUE,0,55,FALSE,1,53,FALSE,0,50,TRUE,1,100,TRUE,0,81,FALSE,0,65,TRUE,0,85,TRUE,1,98,FALSE,1,50,FALSE,1,57,TRUE,0,51,FALSE,0,57,TRUE,1,50,FALSE,0,59,0.4225,0.0004,0.16,0.9604,0.3481,0.2209,0.4225,0.16,0.2209,0,0.3249,0.2401,0.2209,0.25,0.0576,0.4225,0.6561,0.16,0.1849,0.7225,0.25,0.2704,0.3025,0,0.25,0.25,0.25,0.9409,0.09,0.2704,0.2601,0.9801,0.311653571,0.264607143,0.3587,20,62.5,17,53.13,5,62.5,4,50,4,50,4,50,8,50,9,56.25,66.31,54.38,58.88,86.25,65.75,66.19,66.44,9.37,13.18,-8.12,8.88,36.25,15.75,16.19,10.19,1,0,3,3,2,2,1,0,0,0,2,2,1,2,1,3,1,1,4,0,1,0,2,1,1,2,1,4,1,2,0,1,0,0,1,0,3,1,1,0,1.8,0.6,1.6,1.8,1,2,0.4,1,1.45,1.1,1.275,5,3.33,5.125,0.8,-1.4,1.2,0.8,0.2,0,3,2,0,1.67,0,1,1,-2,2,-1,1,0,0,-1,1,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),21,"I wish I could see what I did wrong. Also the three questions like 48 lily pads, 100 widgets, 5 cents baseball were all questions I did before.",0.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,2,9,3,8,4,5,6,1,7,4,2,3,1 +802,R_7rS7ENCwiu74QgF,32 - 38,American,,American,Male,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,3,4,5,2,1,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,4,5,2,3,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,1,4,5,2,3,Disagree,Agree,Agree,Somewhat agree,Agree,2,4,5,3,1,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Agree,Agree,2,1,3,4,5,3,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,3,1,2,Strongly disagree,Disagree,Disagree,Strongly disagree,Disagree,5,2,4,1,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,4,2,3,2,Disagree,Disagree,Neither agree nor disagree,Disagree,Agree,2,1,4,3,5,6,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,3,4,1,2,5,Agree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat agree,1,3,4,2,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,TRUE,91,TRUE,94,TRUE,91,FALSE,88,FALSE,50,TRUE,96,TRUE,50,TRUE,93,FALSE,83,TRUE,96,FALSE,50,FALSE,99,FALSE,91,FALSE,91,FALSE,50,TRUE,99,TRUE,87,FALSE,76,TRUE,66,TRUE,65,TRUE,69,TRUE,93,TRUE,50,TRUE,86,TRUE,78,FALSE,93,TRUE,98,FALSE,94,TRUE,88,FALSE,50,TRUE,50,28,0,2,2,1,2,-3,-1,0,1,1,1,2,3,3,3,-1,1,1,1,-3,-2,2,2,1,2,3,-1,-1,1,2,2,3,2,2,3,3,3,2,-3,-2,-2,-3,-2,9,1,3,2,2,3,2,-2,-2,0,-2,2,6,1,1,3,-1,3,5,2,3,1,3,1,8,TRUE,0,50,FALSE,0,50,TRUE,0,88,FALSE,1,94,TRUE,1,98,FALSE,1,93,TRUE,1,78,TRUE,1,86,TRUE,1,50,TRUE,1,93,TRUE,0,69,TRUE,0,65,TRUE,1,66,FALSE,1,76,TRUE,1,87,TRUE,1,99,FALSE,1,50,FALSE,1,91,FALSE,1,91,FALSE,1,99,FALSE,0,50,TRUE,1,96,FALSE,1,83,TRUE,1,93,TRUE,0,50,TRUE,1,96,FALSE,1,50,FALSE,1,88,TRUE,0,91,TRUE,1,94,TRUE,1,91,TRUE,1,99,0.0196,0.0016,0.0001,0.0484,0.0001,0.0049,0.0049,0.0049,0.0001,0.0016,0.0036,0.1156,0.25,0.4761,0.0004,0.25,0.0289,0.0036,0.0144,0.25,0.25,0.0169,0.0081,0.0576,0.25,0.25,0.0081,0.25,0.7744,0.0081,0.8281,0.4225,0.161889286,0.081764286,0.242014286,28,87.5,24,75,6,75,6,75,6,75,6,75,14,87.5,10,62.5,79.81,72.75,78.75,78.75,89,82.88,76.75,12.5,4.81,-2.25,3.75,3.75,14,-4.62,14.25,2,0,0,0,0,2,0,1,1,1,1,0,0,0,0,2,3,3,4,1,1,1,0,1,1,1,1,0,3,1,0,1,0,4,0,3,2,0,2,4,0.4,1,0.2,2.6,0.8,1.2,1,2.2,1.05,1.3,1.175,2.67,4.33,4.75,-0.4,-0.2,-0.8,0.4,-0.466666667,1,-3,-3,1,-1.66,1,1,-1,-2,2,-1,1,-1,1,0,0,-1,5 cents,100 minutes,24 days,Male,University - Undergraduate,32,It was a bit stressful but it was fun.,0.5,1,0,0,0,1,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,7,5,9,4,6,8,2,1,3,2,3,4,1 +803,R_5poqvhw8eRGOHLk,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,5,2,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,4,2,1,3,Agree,Strongly Agree,Agree,Agree,Somewhat agree,3,5,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,2,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,2,1,5,4,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,2,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,4,2,3,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,1,3,4,2,5,2,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,5,4,3,2,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,FALSE,97,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,97,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,31,3,3,3,3,3,3,0,3,-1,2,3,3,3,0,3,2,3,2,2,1,3,3,3,3,3,2,1,-1,2,0,2,2,3,3,3,3,3,2,3,3,2,3,1,2,3,3,3,3,3,1,1,-1,3,-1,3,3,3,3,3,0,3,2,3,3,3,3,3,2,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,97,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,97,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0.9409,0,0,0,1,1,0.0009,1,0.283635714,0.214285714,0.352985714,31,96.88,23,71.88,8,100,5,62.5,6,75,4,50,12,75,11,68.75,99.81,100,99.25,100,100,100,99.62,25,27.93,0,36.75,25,50,25,30.87,0,0,0,0,0,2,1,1,1,0,0,0,0,3,0,1,0,0,1,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,1,0,1,1,2,0,1,0.6,0.4,0,0.8,0,1,0.5,0.45,0.475,2,2,2,0,0.2,0.6,-0.6,0.266666667,1,-1,0,0,0,-1,1,1,-1,1,1,-1,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),38,none,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,4,3,7,8,9,5,2,1,6,4,3,2,1 +804,R_1OSX13Su1EVLJut,32 - 38,American,,American,Male,Agree,Agree,Strongly agree,Somewhat agree,Somewhat agree,1,2,5,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,1,4,5,2,3,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,1,2,4,5,Strongly Agree,Agree,Somewhat agree,Agree,Somewhat agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat agree,4,2,1,3,5,7,Strongly agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,5,4,8,Agree,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,5,3,4,1,2,7,Strongly Agree,Somewhat agree,Agree,Somewhat agree,Agree,3,5,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,5,2,3,1,4,4,Agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,4,5,3,2,1,8,Agree,Strongly agree,Somewhat Agree,Strongly agree,Agree,5,4,1,3,2,9,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,1,3,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,TRUE,78,FALSE,62,TRUE,80,TRUE,92,FALSE,57,TRUE,66,TRUE,62,TRUE,65,TRUE,73,TRUE,61,TRUE,81,FALSE,92,TRUE,80,FALSE,71,TRUE,67,TRUE,70,FALSE,61,TRUE,83,TRUE,65,FALSE,64,TRUE,64,TRUE,74,FALSE,66,TRUE,64,TRUE,55,TRUE,71,FALSE,66,TRUE,77,TRUE,63,FALSE,75,TRUE,76,21,2,2,3,1,1,1,1,1,0,2,1,1,2,2,1,3,2,1,2,1,2,1,2,3,1,8,3,2,1,1,1,7,2,1,3,2,1,8,3,1,2,1,2,7,3,0,2,1,2,6,2,0,2,1,1,4,2,3,1,3,2,8,2,1,2,1,1,9,TRUE,0,76,FALSE,0,75,TRUE,0,63,TRUE,0,77,FALSE,0,66,TRUE,0,71,TRUE,1,55,TRUE,1,64,FALSE,0,66,TRUE,1,74,TRUE,0,64,FALSE,1,64,TRUE,1,65,TRUE,0,83,FALSE,0,61,TRUE,1,70,TRUE,0,67,FALSE,1,71,TRUE,0,80,FALSE,1,92,TRUE,1,81,TRUE,1,61,TRUE,0,73,TRUE,1,65,TRUE,0,62,TRUE,1,66,FALSE,1,57,TRUE,0,92,TRUE,0,80,FALSE,0,62,TRUE,1,78,TRUE,1,75,0.1296,0.1156,0.09,0.2025,0.0625,0.5041,0.1225,0.0676,0.0064,0.1521,0.3844,0.1225,0.4356,0.4096,0.4356,0.5625,0.5329,0.5929,0.8464,0.3844,0.0361,0.3721,0.64,0.6889,0.4489,0.1849,0.0484,0.5776,0.3969,0.0841,0.64,0.1296,0.352482143,0.313657143,0.391307143,21,65.63,15,46.88,2,25,3,37.5,5,62.5,5,62.5,11,68.75,4,25,70.5,69.75,72.25,68.5,71.5,67.75,73.25,18.75,23.62,44.75,34.75,6,9,-1,48.25,0,1,1,2,0,2,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,2,1,0,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,0,0.8,1,0.4,0.8,1,1,1.2,0.8,0.75,1,0.875,7.67,6,7.125,-0.2,0,-0.8,0,-0.333333333,2,3,0,-2,1.67,0,1,1,1,-1,0,0,2,-2,1,-1,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,34,perfect no improvement needed ,-0.125,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,02FUT,02DGEN,02REV,4,6,5,2,9,7,8,1,3,4,3,2,1 +805,R_7I3ZKe8VLaN9gvc,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,5,1,4,3,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,2,1,5,3,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,3,2,4,5,Somewhat agree,Agree,Agree,Somewhat agree,Strongly Agree,2,5,3,4,1,Agree,Agree,Somewhat agree,Agree,Somewhat agree,5,1,2,3,4,7,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,4,3,1,5,6,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,3,2,1,5,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,1,3,2,4,5,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,5,1,2,3,8,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,2,1,4,5,3,9,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,4,1,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,98,FALSE,55,FALSE,100,FALSE,60,TRUE,84,FALSE,100,FALSE,83,TRUE,100,FALSE,72,FALSE,75,FALSE,75,TRUE,64,TRUE,92,FALSE,91,TRUE,67,TRUE,89,TRUE,61,FALSE,79,TRUE,58,TRUE,70,FALSE,62,TRUE,64,TRUE,65,TRUE,79,TRUE,65,TRUE,100,TRUE,67,TRUE,57,FALSE,73,TRUE,50,FALSE,78,TRUE,100,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,3,3,2,2,2,1,1,2,1,2,2,1,1,2,2,1,3,2,2,1,2,1,7,0,1,2,1,1,6,1,-2,2,-1,1,7,1,1,1,0,0,8,1,1,0,2,1,5,0,1,0,1,1,8,1,0,0,2,1,9,2,1,1,2,1,8,TRUE,0,98,FALSE,0,55,FALSE,1,100,FALSE,1,60,TRUE,1,84,FALSE,1,100,FALSE,0,83,TRUE,1,100,FALSE,0,72,FALSE,0,75,FALSE,1,75,TRUE,0,64,TRUE,1,92,FALSE,1,91,TRUE,1,67,TRUE,1,89,TRUE,0,61,FALSE,1,79,TRUE,0,58,TRUE,0,70,FALSE,0,62,TRUE,1,64,TRUE,0,65,TRUE,1,79,TRUE,0,65,TRUE,1,100,TRUE,0,67,TRUE,0,57,FALSE,1,73,TRUE,1,50,FALSE,0,78,TRUE,1,100,0,0,0.0121,0.6889,0,0,0.0441,0.5625,0.49,0.1296,0.25,0.0064,0.5184,0.0625,0.0256,0.3025,0.4225,0.16,0.3249,0.4225,0.3844,0.1089,0.3364,0.0081,0.3721,0.4489,0.6084,0.9604,0,0.0441,0.0729,0.4096,0.266989286,0.212435714,0.321542857,12,37.5,17,53.13,3,37.5,5,62.5,4,50,5,62.5,10,62.5,7,43.75,76.03,66.5,79.62,81.88,76.12,78.12,73.94,-15.63,22.9,29,17.12,31.88,13.62,15.62,30.19,1,1,1,1,2,2,1,0,0,0,1,3,0,3,0,0,1,1,1,3,2,2,2,1,2,2,1,2,0,0,1,1,2,0,0,1,1,1,1,2,1.2,0.6,1.4,1.2,1.8,1,0.8,1.2,1.1,1.2,1.15,6.67,7.33,7.25,-0.6,-0.4,0.6,0,-0.133333333,2,-2,-2,0,-0.66,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,-1,10 cents,25 minutes,36 days,Male,University - Undergraduate,39,,0,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,8,2,6,9,5,3,7,1,4,2,4,3,1 +806,R_7RQGYuJcznE1sTy,25 - 31,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,3,2,1,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,5,4,1,2,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,4,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,1,5,3,4,2,2,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,3,1,5,4,5,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,1,4,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,1,3,5,4,2,2,Somewhat agree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,5,1,4,3,4,Agree,Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,1,2,5,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,69,FALSE,85,TRUE,81,FALSE,76,FALSE,75,TRUE,84,FALSE,85,TRUE,89,FALSE,96,TRUE,82,TRUE,83,FALSE,61,FALSE,69,TRUE,76,FALSE,60,TRUE,77,FALSE,63,FALSE,64,FALSE,65,FALSE,61,FALSE,74,TRUE,83,FALSE,69,TRUE,71,TRUE,75,FALSE,65,FALSE,72,FALSE,64,TRUE,73,FALSE,65,TRUE,70,13,2,3,3,1,0,0,0,1,-1,0,1,-1,0,0,1,0,0,1,1,0,3,3,3,1,0,5,-1,-2,1,-1,0,2,1,-1,0,0,1,5,0,0,1,0,0,5,2,3,3,2,0,5,1,-2,2,-1,1,2,2,-2,0,-1,0,4,0,0,1,0,0,5,TRUE,0,70,FALSE,0,65,TRUE,0,73,FALSE,1,64,FALSE,0,72,FALSE,1,65,TRUE,1,75,TRUE,1,71,FALSE,0,69,TRUE,1,83,FALSE,1,74,FALSE,1,61,FALSE,0,65,FALSE,1,64,FALSE,0,63,TRUE,1,77,FALSE,1,60,TRUE,0,76,FALSE,1,69,FALSE,1,61,TRUE,1,83,TRUE,1,82,FALSE,1,96,TRUE,1,89,FALSE,1,85,TRUE,1,84,FALSE,1,75,FALSE,1,76,TRUE,0,81,FALSE,0,85,TRUE,1,69,TRUE,1,96,0.0841,0.0256,0.0529,0.0625,0.0016,0.1225,0.0121,0.0289,0.1521,0.0324,0.7225,0.4225,0.4761,0.0676,0.5184,0.4225,0.0016,0.1296,0.0576,0.0225,0.0289,0.3969,0.0961,0.1296,0.16,0.0625,0.0961,0.49,0.5329,0.5776,0.6561,0.1521,0.234617857,0.222171429,0.247064286,13,40.63,22,68.75,5,62.5,5,62.5,6,75,6,75,10,62.5,12,75,74.31,68.5,77.25,77.38,74.12,76.75,71.88,-28.12,5.56,6,14.75,2.38,-0.88,14.25,-3.12,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,2,1,0,1,1,1,0,1,1,0,0,0,1,0,0.2,0.6,0,0.2,0.2,1,0.8,0.2,0.25,0.55,0.4,4,3.67,4.125,0,-0.4,-0.8,0,-0.4,0,0,1,0,0.33,0,0,0,-1,1,1,-1,0,0,0,0,1,15 cents,100 minutes,47 days,Female,College Diploma/Certificate,31,,0.125,0,0,1,0,1,0,0.33,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,4,6,7,5,9,3,8,1,2,2,4,3,1 +807,R_6uDtRv1gSz16lK6,25 - 31,American,,American,Male,Somewhat disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,5,1,3,2,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly agree,1,2,4,3,5,Strongly Disagree,Strongly Disagree,Disagree,Strongly Disagree,Strongly Agree,5,4,2,1,3,Disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Somewhat agree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,4,3,1,10,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,10,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,Strongly Disagree,3,5,1,4,2,10,Somewhat agree,Strongly disagree,Somewhat agree,Somewhat agree,Strongly disagree,3,4,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly disagree,Neither agree nor disagree,Strongly Agree,5,2,1,3,4,9,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,3,1,5,3,Strongly Disagree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,4,1,3,5,2,10,Somewhat disagree,Disagree,Strongly Agree,Strongly Agree,Somewhat agree,5,1,3,2,4,TRUE,95,FALSE,57,TRUE,91,FALSE,56,TRUE,82,TRUE,71,TRUE,69,TRUE,68,TRUE,71,TRUE,100,TRUE,73,TRUE,96,TRUE,75,TRUE,66,FALSE,55,FALSE,60,TRUE,93,TRUE,99,TRUE,57,TRUE,63,FALSE,57,TRUE,60,TRUE,74,TRUE,100,TRUE,57,TRUE,63,FALSE,51,TRUE,82,TRUE,93,FALSE,60,FALSE,61,TRUE,100,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,-3,3,-3,1,0,1,3,3,-3,-3,-2,-3,3,-2,-2,-3,-3,-3,3,1,-3,-3,-3,5,3,-3,3,3,3,10,3,3,-3,0,-3,10,1,-3,1,1,-3,10,3,3,-3,0,3,6,3,-3,3,-3,3,9,-3,-3,3,-1,3,3,-1,-2,3,3,1,10,TRUE,0,95,FALSE,0,57,TRUE,0,91,FALSE,1,56,TRUE,1,82,TRUE,0,71,TRUE,1,69,TRUE,1,68,TRUE,1,71,TRUE,1,100,TRUE,0,73,TRUE,0,96,TRUE,1,75,TRUE,0,66,FALSE,0,55,FALSE,0,60,TRUE,0,93,TRUE,0,99,TRUE,0,57,TRUE,0,63,FALSE,0,57,TRUE,1,60,TRUE,0,74,TRUE,1,100,TRUE,0,57,TRUE,1,63,FALSE,1,51,TRUE,0,82,TRUE,0,93,FALSE,0,60,FALSE,0,61,TRUE,1,100,0.1024,0.1369,0.36,0.0961,0,0.5041,0,0,0.3969,0.16,0.36,0.0625,0.0841,0.5329,0.0324,0.3249,0.5476,0.1936,0.6724,0.3249,0.3249,0.3025,0.3249,0.4356,0.8649,0.2401,0.3721,0.9025,0.8281,0.9801,0.8649,0.9216,0.412803571,0.2285,0.597107143,23,71.88,12,37.5,3,37.5,3,37.5,4,50,2,25,10,62.5,2,12.5,73.59,60.12,80.62,76.12,77.5,71.12,76.06,34.38,36.09,22.62,43.12,26.12,52.5,8.62,63.56,4,2,0,6,0,2,3,2,0,0,6,6,1,3,6,3,1,4,4,0,4,0,0,3,6,2,3,2,6,0,0,0,5,2,0,1,0,6,6,4,2.4,1.4,4.4,2.4,2.6,2.6,1.4,3.4,2.65,2.5,2.575,8.33,6,7.875,-0.2,-1.2,3,-1,0.533333333,-1,1,7,0,2.33,2,-2,2,-2,2,-2,2,-2,2,-2,2,0,5 cents,100 minutes,47 days,Male,High School (or equivalent),25,wonder what this is for ,1.25,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,5,3,4,6,2,8,7,1,9,4,3,2,1 +808,R_37uBEKEHZ4l6BaN,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,5,4,2,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,5,3,4,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,3,1,8,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,2,5,1,7,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,2,1,5,3,6,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,1,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,3,1,5,2,7,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,5,3,2,4,7,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,1,3,4,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,3,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,91,TRUE,80,TRUE,86,FALSE,87,TRUE,68,FALSE,77,TRUE,80,TRUE,74,FALSE,79,FALSE,76,FALSE,82,TRUE,82,FALSE,78,TRUE,86,TRUE,71,TRUE,79,FALSE,85,FALSE,75,TRUE,76,TRUE,87,FALSE,80,TRUE,81,FALSE,81,TRUE,84,FALSE,77,FALSE,100,FALSE,82,FALSE,74,FALSE,74,FALSE,75,FALSE,77,TRUE,82,16,2,2,1,1,1,0,1,0,0,2,1,1,1,0,1,0,1,1,2,2,0,0,1,1,1,8,0,1,0,1,1,8,1,1,0,1,1,7,1,1,1,0,2,6,1,1,0,0,-1,8,1,1,0,0,1,7,1,0,1,0,0,7,0,0,1,1,0,6,TRUE,0,82,FALSE,0,77,FALSE,1,75,FALSE,1,74,FALSE,0,74,FALSE,1,82,FALSE,0,100,FALSE,0,77,TRUE,1,84,FALSE,0,81,TRUE,0,81,FALSE,1,80,TRUE,1,87,TRUE,0,76,FALSE,0,75,FALSE,0,85,TRUE,0,79,TRUE,0,71,TRUE,0,86,FALSE,1,78,TRUE,1,82,FALSE,0,82,FALSE,1,76,FALSE,0,79,TRUE,0,74,TRUE,1,80,FALSE,1,77,TRUE,0,68,FALSE,1,87,TRUE,1,86,TRUE,1,80,FALSE,0,91,0.5929,0.04,0.7225,1,0.8281,0.0324,0.6241,0.6561,0.0484,0.6724,0.0196,0.0169,0.0256,0.6561,0.5476,0.5929,0.0576,0.0676,0.4624,0.5476,0.0324,0.5625,0.7396,0.5776,0.6241,0.0529,0.04,0.6724,0.0625,0.5041,0.0169,0.04,0.3493,0.3461,0.3525,16,50,14,43.75,4,50,5,62.5,1,12.5,4,50,6,37.5,8,50,80.19,79.25,82.25,80.75,78.5,82.5,77.88,6.25,36.44,29.25,19.75,68.25,28.5,45,27.88,2,2,0,0,0,0,0,0,1,1,0,0,1,1,0,1,0,0,2,0,1,1,1,1,2,1,0,0,0,1,0,1,0,0,1,0,1,0,1,2,0.8,0.4,0.4,0.6,1.2,0.4,0.4,0.8,0.55,0.7,0.625,7.67,7.33,7.125,-0.4,0,0,-0.2,-0.133333333,0,1,0,0,0.34,1,1,1,0,0,1,-1,-1,1,1,-1,1,10 cents,75 minutes,24 days,Female,University - Undergraduate,31,,0.375,0,0,0,1,0,1,0,0.67,03VLPfPs,02COC,01PAST,02DGEN,02REV,5,7,2,4,8,3,9,1,6,4,2,3,1 +809,R_5PgAbxytNTVLYM9,25 - 31,,Canadian,Canadian,Female,Disagree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,2,5,4,3,Strongly agree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,5,2,3,4,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,2,3,1,5,4,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,5,4,3,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,1,3,5,4,2,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,3,5,3,Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,4,2,5,1,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,1,2,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,3,5,2,Disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,4,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,1,5,2,3,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,1,2,4,5,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,86,FALSE,50,TRUE,100,TRUE,67,FALSE,53,FALSE,100,TRUE,96,TRUE,83,FALSE,54,FALSE,81,FALSE,59,TRUE,98,FALSE,61,TRUE,58,FALSE,56,TRUE,87,TRUE,81,TRUE,83,FALSE,50,FALSE,52,TRUE,66,FALSE,62,FALSE,100,TRUE,61,TRUE,76,FALSE,56,FALSE,58,TRUE,73,TRUE,75,FALSE,69,TRUE,69,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,3,-1,3,3,-1,2,1,1,1,0,2,-2,2,2,1,1,1,-2,-1,-1,-1,1,1,5,1,-1,1,1,1,3,-2,-1,1,1,-1,5,1,1,1,-1,1,6,-2,-1,1,1,1,2,-2,-2,1,-1,1,4,1,1,-1,2,1,5,1,1,1,2,-1,6,TRUE,0,86,FALSE,0,50,TRUE,0,100,TRUE,0,67,FALSE,0,53,FALSE,1,100,TRUE,1,96,TRUE,1,83,FALSE,0,54,FALSE,0,81,FALSE,1,59,TRUE,0,98,FALSE,0,61,TRUE,0,58,FALSE,0,56,TRUE,1,87,TRUE,0,81,TRUE,0,83,FALSE,1,50,FALSE,1,52,TRUE,1,66,FALSE,0,62,FALSE,1,100,TRUE,1,61,TRUE,0,76,FALSE,0,56,FALSE,1,58,TRUE,0,73,TRUE,0,75,FALSE,0,69,TRUE,1,69,TRUE,1,100,0.0289,0.3136,0.0169,0.0016,0,0,0.1521,0.6561,0.2304,0.3844,0.4761,0.3721,0.2916,0.1681,0.2809,0.25,0,0.4489,0.5329,0.5776,0.1156,0.3136,0.25,0.3364,0.6561,0.1764,0.0961,0.7396,1,0.6889,0.5625,0.9604,0.382742857,0.26505,0.500435714,16,50,13,40.63,4,50,4,50,1,12.5,4,50,7,43.75,6,37.5,72.5,57.88,79.5,74.75,77.88,69,76,9.37,31.87,7.88,29.5,62.25,27.88,25.25,38.5,1,4,4,2,2,2,0,1,0,0,3,1,1,3,3,1,0,0,2,3,0,4,2,2,2,5,1,1,2,0,0,1,3,4,1,1,0,0,1,1,2.6,0.6,2.2,1.2,2,1.8,1.8,0.6,1.65,1.55,1.6,4.33,3.67,4.5,0.6,-1.2,0.4,0.6,-0.066666667,3,-1,0,0,0.66,0,1,1,-2,2,1,-1,-1,1,1,-1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,26,"I enjoyed testing my knowledge on general knowledge questions, it was fun. Thanks",0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,9,5,7,2,6,3,4,1,8,4,3,2,1 +810,R_3pQtt2jkjulJS6g,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,2,4,3,5,1,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,5,2,4,1,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,5,2,3,1,4,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Somewhat agree,4,3,1,5,2,5,Agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,3,1,4,5,2,5,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,3,5,2,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,2,3,1,4,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,5,4,1,6,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,5,4,3,5,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,Agree,5,2,3,1,4,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,5,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,65,TRUE,70,TRUE,76,TRUE,72,TRUE,77,TRUE,81,TRUE,70,TRUE,66,TRUE,74,TRUE,72,TRUE,78,TRUE,68,TRUE,65,TRUE,67,TRUE,65,TRUE,59,TRUE,69,TRUE,59,TRUE,59,TRUE,65,TRUE,64,TRUE,60,TRUE,57,TRUE,63,TRUE,67,TRUE,65,TRUE,67,TRUE,68,TRUE,59,TRUE,76,TRUE,62,TRUE,81,29,3,3,3,3,3,2,0,0,-1,3,3,0,2,0,2,1,2,2,2,0,3,3,0,3,1,5,2,3,1,1,3,5,1,2,1,1,0,5,0,0,1,1,2,4,3,3,3,3,3,6,3,3,0,1,1,5,0,2,2,1,2,5,1,1,0,0,0,6,TRUE,0,81,TRUE,1,62,TRUE,0,76,TRUE,0,59,TRUE,1,68,TRUE,0,67,TRUE,1,65,TRUE,1,67,TRUE,1,63,TRUE,1,57,TRUE,0,60,TRUE,0,64,TRUE,1,65,TRUE,0,59,TRUE,1,59,TRUE,1,69,TRUE,0,59,TRUE,0,65,TRUE,0,67,TRUE,0,65,TRUE,1,68,TRUE,1,78,TRUE,0,72,TRUE,1,74,TRUE,0,66,TRUE,1,70,TRUE,0,81,TRUE,0,77,TRUE,0,72,TRUE,1,76,TRUE,1,70,TRUE,1,65,0.1089,0.09,0.0961,0.1225,0.1225,0.4489,0.0676,0.1849,0.4225,0.0484,0.0576,0.1225,0.1369,0.36,0.1024,0.1444,0.5184,0.3481,0.5929,0.4356,0.1024,0.1681,0.4489,0.3481,0.3481,0.6561,0.09,0.6561,0.5776,0.4225,0.5184,0.4096,0.316410714,0.220364286,0.412457143,29,90.63,16,50,4,50,4,50,4,50,4,50,16,100,0,0,67.69,65.12,67,67.62,71,67.25,68.12,40.63,17.69,15.12,17,17.62,21,-32.75,68.12,0,0,3,0,2,0,3,1,2,0,2,2,1,1,2,1,2,1,1,2,0,0,0,0,0,1,3,0,2,2,3,2,0,1,0,0,1,2,2,0,1,1.2,1.6,1.4,0,1.6,1.2,1,1.3,0.95,1.125,5,5.33,5.125,1,-0.4,0.4,0.4,0.333333333,-1,0,0,-2,-0.33,2,2,2,2,-2,1,-1,2,-2,2,-2,2,10 cents,25 minutes,24 days,Male,Professional Degree (ex. JD/MD),34,Best Survey Ever!!! ,0.125,0,0,0,1,0,1,0,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,9,4,8,5,7,6,2,1,3,3,4,2,1 +811,R_123oEnenHpDVSrq,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,4,2,5,1,3,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,1,4,3,2,5,Agree,Strongly Disagree,Somewhat Agree,Somewhat Agree,Agree,4,2,3,5,1,Neither agree nor disagree,Somewhat agree,Agree,Agree,Disagree,1,2,5,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Disagree,3,5,2,4,1,6,Strongly agree,Strongly disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,4,3,2,1,5,9,Strongly Agree,Disagree,Strongly Disagree,Strongly Disagree,Somewhat Agree,1,5,2,3,4,8,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,3,2,4,5,1,6,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,5,4,8,Strongly Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,4,5,2,1,3,4,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,4,2,5,3,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,91,TRUE,50,TRUE,98,FALSE,50,TRUE,100,FALSE,85,TRUE,50,TRUE,50,TRUE,50,TRUE,73,TRUE,51,TRUE,80,TRUE,50,FALSE,87,FALSE,50,FALSE,50,FALSE,64,TRUE,75,TRUE,50,FALSE,50,FALSE,88,FALSE,50,FALSE,66,FALSE,50,TRUE,96,TRUE,58,FALSE,50,FALSE,50,FALSE,50,FALSE,94,FALSE,51,TRUE,100,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,-1,3,2,0,3,1,1,2,-3,1,1,2,0,1,2,2,-2,3,3,3,-3,-2,6,3,-3,-3,1,0,9,3,-2,-3,-3,1,8,-3,0,1,0,0,5,3,3,3,1,3,6,0,2,1,1,1,8,3,0,2,-2,3,4,2,1,1,2,-1,6,TRUE,0,91,TRUE,1,50,TRUE,0,98,FALSE,1,50,TRUE,1,100,FALSE,1,85,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,73,TRUE,0,51,TRUE,0,80,TRUE,1,50,FALSE,1,87,FALSE,0,50,FALSE,0,50,FALSE,1,64,TRUE,0,75,TRUE,0,50,FALSE,1,50,FALSE,0,88,FALSE,0,50,FALSE,1,66,FALSE,0,50,TRUE,0,96,TRUE,1,58,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,94,FALSE,0,51,TRUE,1,100,0.25,0.1764,0.25,0.25,0,0.0225,0.25,0.0729,0.25,0.25,0.8836,0.25,0.25,0.2601,0,0.25,0.1156,0.25,0.25,0.9216,0.7744,0.25,0.25,0.0169,0.1296,0.25,0.2601,0.8281,0.9604,0.5625,0.25,0.64,0.337439286,0.221764286,0.453114286,14,43.75,18,56.25,4,50,7,87.5,4,50,3,37.5,9,56.25,9,56.25,65.84,50.25,75.38,72.5,65.25,63.38,68.31,-12.5,9.59,0.25,-12.12,22.5,27.75,7.13,12.06,0,0,0,2,5,1,3,6,0,1,1,1,4,4,1,3,1,1,2,2,0,0,0,2,0,2,2,2,0,0,1,3,1,3,1,2,0,1,0,1,1.4,2.2,2.2,1.8,0.4,1.2,1.8,0.8,1.9,1.05,1.475,7.67,6,6.5,1,1,0.4,1,0.8,0,1,4,-1,1.67,0,1,1,-2,2,-1,1,-2,2,0,0,0,10 cents,25 minutes,15 days,Female,University - Graduate (Masters),27,,0.875,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,7,9,6,5,2,4,8,1,3,2,3,4,1 +812,R_5G30NJQga0bbt5f,18 - 24,American,,American,Male,Strongly agree,Agree,Agree,Agree,Agree,2,3,5,1,4,Strongly agree,Somewhat agree,Agree,Somewhat agree,Agree,1,3,4,2,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,1,5,2,Agree,Somewhat agree,Agree,Agree,Agree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,5,1,2,4,3,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,5,3,2,3,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,5,2,1,3,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Agree,Agree,Agree,1,5,4,3,2,4,Agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,5,3,4,1,2,4,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,3,1,5,4,2,6,Agree,Strongly Agree,Agree,Agree,Agree,2,4,5,3,1,TRUE,100,TRUE,71,TRUE,89,FALSE,86,TRUE,98,FALSE,100,TRUE,100,TRUE,97,TRUE,100,TRUE,98,TRUE,88,TRUE,79,TRUE,92,FALSE,70,TRUE,84,TRUE,87,FALSE,80,TRUE,100,FALSE,94,FALSE,98,TRUE,95,TRUE,96,TRUE,93,TRUE,99,FALSE,93,TRUE,91,FALSE,65,TRUE,88,TRUE,90,TRUE,90,TRUE,66,TRUE,95,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,2,2,3,1,2,1,2,3,2,3,3,3,2,1,2,2,2,1,2,1,2,1,3,-1,1,1,1,1,3,2,1,2,1,2,3,1,1,1,2,2,8,3,3,2,2,2,2,2,1,3,1,3,4,3,2,3,2,3,4,2,3,2,2,2,6,TRUE,0,100,TRUE,1,71,TRUE,0,89,FALSE,1,86,TRUE,1,98,FALSE,1,100,TRUE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,98,TRUE,0,88,TRUE,0,79,TRUE,1,92,FALSE,1,70,TRUE,1,84,TRUE,1,87,FALSE,1,80,TRUE,0,100,FALSE,1,94,FALSE,1,98,TRUE,1,95,TRUE,1,96,TRUE,0,93,TRUE,1,99,FALSE,1,93,TRUE,1,91,FALSE,1,65,TRUE,0,88,TRUE,0,90,TRUE,1,90,TRUE,1,66,TRUE,1,95,0.0009,0.0081,0.0169,0,0.0025,0,0.0001,0.0004,0.0004,0.0016,0.01,0.0064,0,0.7744,0.0004,0.0841,0.8649,0.0196,0.7744,0.0049,0.0025,0.0256,0.0036,0.09,0.04,0.1225,0.1156,1,0.7921,1,0.81,0.6241,0.256075,0.126057143,0.386092857,25,78.13,24,75,7,87.5,6,75,6,75,5,62.5,16,100,8,50,89.75,81.75,92.88,93.5,90.88,91.19,88.31,3.13,14.75,-5.75,17.88,18.5,28.38,-8.81,38.31,2,0,1,0,1,4,0,1,0,1,1,1,1,2,1,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,2,0,0,0,0.8,1.2,1.2,0.4,0.2,0.6,0.2,0.4,0.9,0.35,0.625,3,3.33,4.125,0.6,0.6,1,0,0.733333333,1,-1,-1,2,-0.33,2,2,2,-2,2,2,-2,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),19,"A progress bar is recommended, thank you for the survey,",1.5,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,4,9,8,6,3,5,1,7,4,3,2,1 +813,R_7N4mmETX5ChvFfP,25 - 31,,Canadian,Canadian,Male,Agree,Agree,Agree,Agree,Somewhat disagree,3,4,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,2,4,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,2,4,1,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,2,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,1,4,2,5,Somewhat disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat disagree,2,1,3,4,5,7,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,4,1,5,3,2,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,4,3,2,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,3,5,1,2,6,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,2,1,3,5,6,Agree,Agree,Agree,Agree,Agree,4,3,5,1,2,6,Agree,Agree,Agree,Agree,Strongly Agree,2,4,3,5,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,80,TRUE,92,TRUE,92,FALSE,54,TRUE,55,FALSE,100,FALSE,64,TRUE,100,FALSE,100,TRUE,54,FALSE,100,FALSE,85,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,80,TRUE,94,TRUE,100,FALSE,100,26,2,2,2,2,-1,0,0,1,1,1,1,1,1,2,1,1,1,1,1,1,-1,0,1,1,-1,5,-1,-1,-2,0,-1,7,-1,0,-1,1,1,7,-1,-1,-1,-1,-1,8,2,3,3,3,1,6,0,1,2,1,1,6,2,2,2,2,2,6,2,2,2,2,3,6,FALSE,1,100,TRUE,1,100,TRUE,0,94,FALSE,1,80,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,0,100,TRUE,1,54,FALSE,1,100,TRUE,1,100,FALSE,1,64,FALSE,0,100,TRUE,0,55,FALSE,1,54,TRUE,0,92,TRUE,1,92,TRUE,1,80,TRUE,1,100,0,1,0,0,0,0,0,0,0.0225,0.2116,0.0064,1,0,0,0,0,0,0.04,0.2116,0.1296,1,0,0,0,0,0.3025,0.04,0,0.8836,0,0.8464,0,0.16765,0.091464286,0.243835714,26,81.25,26,81.25,7,87.5,5,62.5,7,87.5,7,87.5,13,81.25,13,81.25,92.19,89.38,99,89.75,90.62,95.38,89,0,10.94,1.88,36.5,2.25,3.12,14.13,7.75,3,2,1,1,0,1,1,3,1,2,2,1,2,1,0,2,2,2,2,2,0,1,1,1,2,0,1,1,0,0,1,1,1,0,1,1,1,1,1,2,1.4,1.6,1.2,2,1,0.4,0.8,1.2,1.55,0.85,1.2,6.33,6,6.375,0.4,1.2,0.4,0.8,0.666666667,-1,1,1,2,0.33,1,2,2,-2,2,1,-1,0,0,-1,1,0,10 cents,5 minutes,47 days,Male,High School (or equivalent),29,"i found this to be odd, but kind of fun.",0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,2,6,3,8,5,4,7,1,9,2,3,4,1 +814,R_5EXqrTpgDzX2xJk,25 - 31,,Canadian,Canadian,Female,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,3,4,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,3,1,4,2,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,3,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,5,4,1,3,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,3,4,1,5,2,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,2,1,4,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,4,3,2,5,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,2,4,1,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,4,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,94,FALSE,74,TRUE,90,TRUE,64,FALSE,68,FALSE,55,TRUE,89,FALSE,87,FALSE,77,FALSE,84,FALSE,67,FALSE,65,FALSE,52,FALSE,63,TRUE,68,FALSE,67,FALSE,67,FALSE,65,FALSE,61,FALSE,69,TRUE,69,FALSE,69,TRUE,68,FALSE,65,TRUE,64,TRUE,63,TRUE,63,TRUE,67,FALSE,61,TRUE,58,TRUE,56,TRUE,57,16,-1,0,1,1,0,1,0,0,1,1,0,0,1,-1,1,1,0,0,1,0,1,1,1,0,0,6,1,1,0,1,0,6,1,0,-1,0,1,6,1,1,0,0,1,6,0,1,0,-1,1,6,0,0,0,1,1,6,0,1,1,0,1,6,0,1,1,1,0,6,TRUE,0,57,TRUE,1,56,TRUE,0,58,FALSE,1,61,TRUE,1,67,TRUE,0,63,TRUE,1,63,TRUE,1,64,FALSE,0,65,TRUE,1,68,FALSE,1,69,TRUE,0,69,FALSE,0,69,FALSE,1,61,FALSE,0,65,FALSE,0,67,FALSE,1,67,TRUE,0,68,FALSE,1,63,FALSE,1,52,FALSE,0,65,FALSE,0,67,FALSE,1,84,FALSE,0,77,FALSE,1,87,TRUE,1,89,FALSE,1,55,FALSE,1,68,TRUE,0,64,TRUE,1,90,FALSE,0,74,TRUE,1,94,0.1296,0.0121,0.4489,0.1369,0.0036,0.3969,0.5929,0.1024,0.2304,0.4489,0.01,0.4761,0.4225,0.0961,0.1089,0.1936,0.0256,0.1521,0.1024,0.0169,0.4225,0.4225,0.1369,0.1521,0.1089,0.2025,0.5476,0.3249,0.3364,0.4624,0.4096,0.4761,0.263632143,0.232857143,0.294407143,16,50,18,56.25,5,62.5,4,50,5,62.5,4,50,8,50,10,62.5,68.31,63.5,71.62,70,68.12,71.25,65.38,-6.25,12.06,1,21.62,7.5,18.12,21.25,2.88,2,1,0,1,0,0,1,0,0,1,1,0,2,1,0,0,1,0,1,1,1,1,1,2,1,1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0.8,0.4,0.8,0.6,1.2,0.2,0.4,0.6,0.65,0.6,0.625,6,6,6,-0.4,0.2,0.4,0,0.066666667,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,-1,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,30,,0.25,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,02FUT,02DGEN,02REV,6,7,3,4,9,8,2,1,5,4,2,3,1 +815,R_5RrN123xKRLl9vD,18 - 24,,Canadian,Canadian,Female,Somewhat disagree,Strongly agree,Agree,Strongly agree,Agree,5,1,2,4,3,Strongly agree,Agree,Strongly agree,Somewhat agree,Somewhat agree,2,1,3,4,5,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,1,2,3,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,3,5,2,4,Agree,Somewhat agree,Strongly Agree,Somewhat disagree,Somewhat agree,2,3,1,4,5,4,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,1,2,4,5,3,7,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,1,2,5,4,3,6,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Agree,4,1,3,2,5,3,Strongly agree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,2,4,1,3,4,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,4,5,1,5,Agree,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,3,5,4,1,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,73,FALSE,50,FALSE,100,TRUE,50,TRUE,86,TRUE,50,TRUE,100,TRUE,74,FALSE,50,FALSE,100,FALSE,50,TRUE,62,FALSE,50,TRUE,50,TRUE,100,TRUE,56,FALSE,100,FALSE,100,FALSE,100,TRUE,79,TRUE,50,FALSE,87,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,84,FALSE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,79,13,-1,3,2,3,2,3,2,3,1,1,3,-1,3,1,3,-1,1,1,1,-2,2,1,3,-1,1,4,1,-1,1,3,1,7,3,1,3,2,3,6,-1,1,-2,1,0,7,1,3,2,3,2,3,3,2,3,1,3,4,3,-1,3,0,3,5,2,3,2,3,0,6,TRUE,0,79,FALSE,0,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,84,TRUE,1,50,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,87,TRUE,0,50,TRUE,1,79,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,0,56,TRUE,0,100,TRUE,0,50,FALSE,1,50,TRUE,1,62,FALSE,0,50,FALSE,1,100,FALSE,0,50,TRUE,0,74,TRUE,1,100,TRUE,0,50,TRUE,0,86,TRUE,0,50,FALSE,0,100,FALSE,0,50,TRUE,1,73,0,0,1,0.25,0.0729,0.0256,0.25,0,0.25,0.25,1,0.0441,0.25,0.0169,0.25,0.25,0,0.25,0.7396,0.5476,0.1444,1,0.25,0,0.3136,0.25,0.25,0.6241,1,1,0.25,0.25,0.340314286,0.207821429,0.472807143,13,40.63,14,43.75,3,37.5,5,62.5,4,50,2,25,8,50,6,37.5,72.81,60.88,69.25,81.62,79.5,72.75,72.88,-3.12,29.06,23.38,6.75,31.62,54.5,22.75,35.38,3,2,1,4,1,2,3,2,2,0,0,2,0,1,0,0,0,3,0,2,2,0,0,0,0,0,0,0,0,2,0,0,0,1,0,3,2,1,2,2,2.2,1.8,0.6,1,0.4,0.4,0.2,2,1.4,0.75,1.075,5.67,4,5.25,1.8,1.4,0.4,-1,1.2,1,3,1,1,1.67,-1,1,1,-2,2,-1,1,1,-1,-1,1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,good,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,02REV,6,9,3,5,7,4,8,1,2,2,3,4,1 +816,R_62lx4D4mSWS2N0p,39 - 45,American,,American,Male,Agree,Strongly agree,Agree,Agree,Strongly agree,1,3,2,4,5,Agree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,1,5,4,2,3,Agree,Neither Agree nor Disagree,Agree,Agree,Agree,4,3,1,2,5,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,2,3,4,5,1,9,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat agree,1,5,2,3,4,9,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,2,4,5,3,9,Neither agree nor disagree,Agree,Somewhat agree,Agree,Somewhat disagree,1,3,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Agree,Agree,Agree,1,2,5,4,3,9,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,1,4,3,2,8,Agree,Agree,Agree,Agree,Somewhat Agree,1,5,3,2,4,9,Strongly Agree,Agree,Agree,Agree,Strongly Agree,3,1,4,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,87,TRUE,96,TRUE,73,FALSE,58,TRUE,77,FALSE,57,TRUE,72,TRUE,63,FALSE,60,FALSE,57,FALSE,60,TRUE,63,FALSE,59,FALSE,57,TRUE,57,TRUE,80,TRUE,60,TRUE,76,TRUE,61,TRUE,77,TRUE,91,TRUE,60,TRUE,61,TRUE,56,TRUE,58,FALSE,60,TRUE,69,FALSE,58,TRUE,58,TRUE,58,FALSE,58,TRUE,100,16,2,3,2,2,3,2,1,3,-1,3,2,0,2,2,2,2,2,1,2,0,3,2,2,-1,0,8,1,0,2,2,1,9,2,1,1,1,2,9,0,2,1,2,-1,9,2,3,2,2,2,8,1,0,2,0,2,9,2,2,2,2,1,8,3,2,2,2,3,9,TRUE,0,100,FALSE,0,58,TRUE,0,58,TRUE,0,58,FALSE,0,58,TRUE,0,69,FALSE,0,60,TRUE,1,58,TRUE,1,56,TRUE,1,61,TRUE,0,60,TRUE,0,91,TRUE,1,77,TRUE,0,61,TRUE,1,76,TRUE,1,60,TRUE,0,80,TRUE,0,57,FALSE,1,57,FALSE,1,59,TRUE,1,63,FALSE,0,60,FALSE,1,57,FALSE,0,60,TRUE,0,63,TRUE,1,72,FALSE,1,57,TRUE,0,77,FALSE,1,58,TRUE,1,73,TRUE,1,96,TRUE,1,87,0.1764,0.0784,0.16,0.36,0.0169,0.4761,0.36,0.1521,0.1681,0.36,0.0729,0.0529,0.1936,0.36,0.3364,0.3364,0.1849,0.3364,0.5929,0.3969,0.1369,0.0576,0.1849,0.3721,0.64,0.1849,0.0016,1,0.3364,0.3249,0.1764,0.8281,0.308582143,0.243335714,0.373828571,16,50,16,50,5,62.5,5,62.5,2,25,4,50,11,68.75,5,31.25,66.78,64.75,68.62,66.75,67,67.19,66.38,0,16.78,2.25,6.12,41.75,17,-1.56,35.13,1,1,0,3,3,1,1,1,3,2,0,1,1,1,0,2,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,2,0,0,1,1,0,1,0,3,1.6,1.6,0.6,0.6,0.2,1,0.6,1,1.1,0.7,0.9,8.67,8.33,8.625,1.4,0.6,0,-0.4,0.666666667,0,0,1,0,0.34,1,2,0,1,-1,1,-1,0,0,1,-1,0,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),41,i am okay wiht the survey,0,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,2,6,5,3,9,7,8,1,4,2,4,3,1 +817,R_7dLFcejCIvzD4qy,32 - 38,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,4,5,3,1,2,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,2,3,1,5,Agree,Agree,Agree,Agree,Agree,2,4,1,5,3,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,4,3,2,5,7,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,5,3,2,1,8,Strongly Agree,Agree,Agree,Agree,Neither Agree nor Disagree,4,5,3,2,1,6,Agree,Agree,Agree,Agree,Agree,1,2,4,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,3,4,7,Agree,Agree,Agree,Neither agree nor disagree,Agree,5,3,4,1,2,6,Agree,Agree,Agree,Agree,Agree,3,1,5,4,2,7,Agree,Agree,Agree,Agree,Agree,3,5,1,2,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,100,FALSE,95,TRUE,92,TRUE,76,FALSE,77,TRUE,100,FALSE,100,TRUE,97,FALSE,100,FALSE,60,FALSE,93,FALSE,95,FALSE,100,TRUE,100,FALSE,100,TRUE,91,FALSE,86,FALSE,83,TRUE,86,TRUE,87,TRUE,92,FALSE,79,TRUE,90,FALSE,93,TRUE,100,FALSE,85,TRUE,78,FALSE,70,TRUE,82,FALSE,98,TRUE,100,16,1,3,3,2,2,2,0,2,0,2,2,2,2,2,2,2,2,2,2,2,1,3,3,2,3,7,2,2,2,0,2,8,3,2,2,2,0,6,2,2,2,2,2,8,1,3,3,3,3,7,2,2,2,0,2,6,2,2,2,2,2,7,2,2,2,2,2,6,TRUE,0,100,FALSE,0,98,TRUE,0,82,FALSE,1,70,TRUE,1,78,FALSE,1,85,TRUE,1,100,FALSE,0,93,TRUE,1,90,FALSE,0,79,TRUE,0,92,TRUE,0,87,TRUE,1,86,FALSE,1,83,FALSE,0,86,TRUE,1,91,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,93,FALSE,0,60,FALSE,1,100,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,77,TRUE,0,76,TRUE,0,92,FALSE,0,95,FALSE,0,100,TRUE,1,96,0.8649,0,0.0081,0,0.0016,0.0225,0.0009,0.6241,0.0025,0.36,0.9025,0.0196,0.01,0.8464,0.0484,0.9604,0,0.09,0.5776,0,0.8649,0.7396,0,0.0289,0,0.0529,1,1,0.6724,1,0.8464,0.7569,0.408160714,0.277778571,0.538542857,16,50,17,53.13,4,50,6,75,4,50,3,37.5,8,50,9,56.25,90.03,89.12,91.25,90.25,89.5,90.12,89.94,-3.13,36.9,39.12,16.25,40.25,52,40.12,33.69,0,0,0,0,1,0,2,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,1,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.4,0.6,0,0.4,0.4,0,0,0.3,0.2,0.25,7,6.67,6.875,-0.2,0,0.6,0,0.133333333,0,2,-1,2,0.33,0,1,1,-1,1,1,-1,2,-2,0,0,-2,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,none,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,9,3,7,2,5,8,1,4,2,3,4,1 +818,R_6w6U2sqxn4Hih1I,39 - 45,American,,American,Male,Agree,Agree,Agree,Neither agree nor disagree,Agree,3,1,4,2,5,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,1,2,5,3,Agree,Agree,Strongly Agree,Somewhat Disagree,Agree,4,2,3,5,1,Somewhat agree,Agree,Agree,Somewhat agree,Strongly Agree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,5,1,3,4,2,7,Agree,Agree,Agree,Strongly agree,Agree,4,5,3,2,1,7,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,Agree,2,3,5,4,1,8,Somewhat agree,Somewhat agree,Agree,Agree,Strongly Agree,3,5,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,4,1,3,5,7,Disagree,Disagree,Agree,Neither agree nor disagree,Agree,4,5,2,3,1,8,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,1,5,4,2,3,6,Somewhat agree,Agree,Strongly Agree,Agree,Strongly Agree,3,2,5,4,1,FALSE,93,TRUE,88,FALSE,93,TRUE,86,TRUE,62,FALSE,87,TRUE,87,TRUE,83,TRUE,88,TRUE,87,FALSE,89,FALSE,90,FALSE,92,FALSE,82,FALSE,90,TRUE,87,FALSE,92,TRUE,90,FALSE,84,FALSE,88,TRUE,91,TRUE,96,FALSE,94,TRUE,89,FALSE,88,TRUE,93,FALSE,87,FALSE,92,FALSE,87,TRUE,87,TRUE,87,TRUE,89,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,0,2,1,-1,2,0,2,2,2,3,-1,2,1,2,2,1,3,1,3,3,1,2,6,2,2,2,3,2,7,2,2,0,3,2,7,1,1,2,2,3,8,2,3,2,2,3,8,-2,-2,2,0,2,7,3,-1,0,-1,1,8,1,2,3,2,3,6,FALSE,1,93,TRUE,1,88,FALSE,1,93,TRUE,0,86,TRUE,1,62,FALSE,1,87,TRUE,1,87,TRUE,1,83,TRUE,1,88,TRUE,1,87,FALSE,1,89,FALSE,1,90,FALSE,0,92,FALSE,1,82,FALSE,0,90,TRUE,1,87,FALSE,1,92,TRUE,0,90,FALSE,1,84,FALSE,1,88,TRUE,1,91,TRUE,1,96,FALSE,1,94,TRUE,1,89,FALSE,1,88,TRUE,1,93,FALSE,1,87,FALSE,1,92,FALSE,1,87,TRUE,1,87,TRUE,1,87,TRUE,1,89,0.0289,0.0049,0.0169,0.0169,0.0121,0.0169,0.0121,0.0169,0.0144,0.0016,0.0169,0.8464,0.0144,0.0121,0.1444,0.0144,0.0036,0.7396,0.0064,0.0144,0.0081,0.81,0.0256,0.0324,0.0064,0.0169,0.0169,0.0049,0.0049,0.81,0.0169,0.01,0.130342857,0.133271429,0.127414286,29,90.63,28,87.5,6,75,7,87.5,7,87.5,8,100,14,87.5,14,87.5,88.06,87.38,86.75,89.5,88.62,87.25,88.88,3.13,0.56,12.38,-0.75,2,-11.38,-0.25,1.38,1,1,1,1,0,1,3,0,3,0,0,0,3,4,0,0,1,0,1,0,0,1,0,2,1,3,1,0,0,0,1,3,3,0,1,0,0,1,1,0,0.8,1.4,1.4,0.4,0.8,0.8,1.6,0.4,1,0.9,0.95,6.67,7.67,7.125,0,0.6,-0.2,0,0.133333333,-2,0,-1,2,-1,1,2,2,2,-2,1,-1,1,-1,1,-1,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),44,very lovely,0.25,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,9,2,4,3,6,8,5,1,7,2,4,3,1 +819,R_6nQ22abOSqXFXJk,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,5,4,2,1,3,Agree,Somewhat agree,Somewhat agree,Disagree,Agree,5,1,2,4,3,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,1,2,5,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,4,3,2,5,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,Agree,5,1,3,2,4,4,Neither agree nor disagree,Somewhat disagree,Disagree,Disagree,Neither agree nor disagree,4,5,2,3,1,7,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,5,3,4,7,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,4,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,3,4,1,5,7,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,2,4,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,5,3,4,9,Agree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,4,3,5,2,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,59,TRUE,71,TRUE,80,TRUE,100,TRUE,67,FALSE,55,TRUE,91,TRUE,88,TRUE,100,FALSE,62,TRUE,60,TRUE,79,TRUE,94,TRUE,94,TRUE,89,FALSE,80,FALSE,84,TRUE,65,TRUE,69,FALSE,71,TRUE,87,TRUE,59,TRUE,94,TRUE,55,TRUE,81,TRUE,97,FALSE,75,TRUE,100,FALSE,57,TRUE,95,TRUE,63,FALSE,71,15,3,3,1,1,2,2,1,1,-2,2,3,2,3,2,3,-3,-3,-3,-3,-3,1,3,3,-1,2,4,0,-1,-2,-2,0,7,0,-1,1,0,0,7,0,-3,-3,-3,-3,8,3,3,3,2,3,7,3,-1,3,-3,3,5,3,3,3,2,3,9,2,1,2,1,-3,9,FALSE,1,71,TRUE,1,63,TRUE,0,95,FALSE,1,57,TRUE,1,100,FALSE,1,75,TRUE,1,97,TRUE,1,81,TRUE,1,55,TRUE,1,94,TRUE,0,59,TRUE,0,87,FALSE,0,71,TRUE,0,69,TRUE,1,65,FALSE,0,84,FALSE,1,80,TRUE,0,89,TRUE,0,94,TRUE,0,94,TRUE,1,79,TRUE,1,60,FALSE,1,62,TRUE,1,100,TRUE,0,88,TRUE,1,91,FALSE,1,55,TRUE,0,67,TRUE,0,100,TRUE,1,80,TRUE,1,71,FALSE,0,59,0.0361,0.0081,0.7056,0.0009,0.3481,0.0625,0,0.0036,0.8836,0.16,0.04,0.5041,0.2025,0.3481,0,0.1369,0.1444,0.1849,0.4489,0.7744,0.0441,0.1225,0.8836,0.4761,0.04,0.2025,0.0841,0.0841,0.9025,0.7921,1,0.7569,0.343946429,0.215621429,0.472271429,15,46.88,19,59.38,6,75,5,62.5,5,62.5,3,37.5,13,81.25,6,37.5,77.88,64.88,78.25,82.38,86,78.12,77.62,-12.5,18.5,-10.12,15.75,19.88,48.5,-3.13,40.12,2,0,2,2,0,2,2,3,0,2,3,3,2,2,3,3,0,0,0,0,0,0,2,1,1,1,2,2,1,1,0,1,0,0,0,5,4,5,4,0,1.2,1.8,2.6,0.6,0.8,1.4,0.2,3.6,1.55,1.5,1.525,6,7,7,0.4,0.4,2.4,-3,1.066666667,-3,2,-2,-1,-1,0,-1,0,-2,2,1,-1,1,-1,-2,2,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),19,I was confused as to why there were math questions involved.,0.125,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,9,5,7,6,4,8,2,1,3,2,4,3,1 +820,R_5jiUES1850eL6yD,39 - 45,American,,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,2,4,1,3,Neither agree nor disagree,Strongly disagree,Agree,Somewhat disagree,Agree,5,4,3,2,1,Strongly Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,1,3,2,Strongly disagree,Disagree,Somewhat disagree,Strongly disagree,Strongly disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Strongly Agree,Strongly Agree,Agree,Agree,2,5,3,4,1,5,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,1,2,4,5,3,7,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,1,2,4,3,5,8,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,Strongly disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,2,4,3,5,5,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Agree,4,2,3,5,1,8,Strongly agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,4,1,2,5,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,1,5,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,90,TRUE,65,TRUE,68,FALSE,67,FALSE,70,FALSE,56,FALSE,53,FALSE,50,TRUE,69,FALSE,59,TRUE,74,TRUE,86,FALSE,93,FALSE,54,TRUE,98,FALSE,51,TRUE,76,FALSE,70,FALSE,58,TRUE,50,TRUE,100,FALSE,80,TRUE,55,FALSE,50,FALSE,52,TRUE,93,TRUE,66,FALSE,50,TRUE,73,TRUE,90,FALSE,59,FALSE,78,11,2,3,3,1,2,0,-3,2,-1,2,3,2,3,0,3,-3,-2,-1,-3,-3,2,3,3,2,2,6,0,-2,3,-2,2,5,3,1,2,0,3,7,-2,1,0,-2,-3,8,3,3,3,1,3,7,0,-2,1,-2,2,5,3,2,3,0,3,8,0,0,0,0,-3,9,FALSE,1,78,FALSE,0,59,TRUE,0,90,TRUE,0,73,FALSE,0,50,TRUE,0,66,TRUE,1,93,FALSE,0,52,FALSE,0,50,TRUE,1,55,FALSE,1,80,TRUE,0,100,TRUE,1,50,FALSE,1,58,FALSE,0,70,TRUE,1,76,FALSE,1,51,TRUE,0,98,FALSE,1,54,FALSE,1,93,TRUE,1,86,TRUE,1,74,FALSE,1,59,TRUE,1,69,FALSE,1,50,FALSE,0,53,FALSE,1,56,FALSE,1,70,FALSE,1,67,TRUE,1,68,TRUE,1,65,FALSE,0,90,0.2704,0.2809,0.0576,0.0049,0.81,0.4356,0.0961,0.2025,0.0049,0.0676,0.1024,0.25,0.25,0.04,0.25,0.3481,0.1681,0.5329,0.09,0.25,0.0196,0.49,0.2116,0.1764,0.2401,0.1936,0.1225,0.0484,0.81,0.9604,0.1089,1,0.295703571,0.254157143,0.33725,11,34.38,20,62.5,4,50,5,62.5,6,75,5,62.5,9,56.25,11,68.75,68.84,63.38,64.88,69.88,77.25,66.25,71.44,-28.12,6.34,13.38,2.38,-5.12,14.75,10,2.69,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,3,1,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,3,2,1,3,0,0.2,0.6,0.4,1.2,0.4,0.6,0,1.8,0.6,0.7,0.65,6,6.67,6.875,-0.2,0,0.4,-0.6,0.066666667,-1,0,-1,-1,-0.67,0,0,2,-2,2,1,-1,-1,1,0,0,2,10 cents,25 minutes,36 days,Male,High School (or equivalent),43,This survey was exceptional.,0.75,0,0,0,1,0,0,0,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,7,8,3,6,9,4,5,1,2,2,3,4,1 +821,R_50JdB3gPcLim8aj,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Disagree,Somewhat disagree,Somewhat agree,3,4,2,5,1,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Agree,3,5,1,2,4,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,2,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,2,4,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,2,3,4,5,Strongly disagree,Strongly disagree,Somewhat agree,Strongly agree,Somewhat agree,5,1,3,2,4,3,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Strongly Agree,1,2,3,4,5,10,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,2,3,1,4,2,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,3,5,4,1,2,4,Agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,3,1,4,10,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,2,5,4,3,1,TRUE,70,FALSE,53,TRUE,65,TRUE,70,TRUE,80,FALSE,90,TRUE,93,TRUE,87,FALSE,52,TRUE,72,TRUE,60,TRUE,64,TRUE,63,FALSE,73,TRUE,72,FALSE,62,TRUE,73,FALSE,100,TRUE,52,TRUE,51,FALSE,52,FALSE,52,TRUE,52,TRUE,64,FALSE,96,TRUE,98,TRUE,51,FALSE,67,TRUE,68,TRUE,70,FALSE,51,TRUE,51,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-2,-1,1,-1,1,3,1,2,2,3,3,-1,3,0,0,0,0,-3,3,3,2,2,3,3,-3,-3,1,3,1,5,3,0,3,2,3,3,-1,-3,-3,-3,-3,10,2,2,0,0,2,3,-1,1,2,-1,1,2,2,1,3,0,3,4,1,1,1,1,-3,10,TRUE,0,70,FALSE,0,53,TRUE,0,65,TRUE,0,70,TRUE,1,80,FALSE,1,90,TRUE,1,93,TRUE,1,87,FALSE,0,52,TRUE,1,72,TRUE,0,60,TRUE,0,64,TRUE,1,63,FALSE,1,73,TRUE,1,72,FALSE,0,62,TRUE,0,73,FALSE,1,100,TRUE,0,52,TRUE,0,51,FALSE,0,52,FALSE,0,52,TRUE,0,52,TRUE,1,64,FALSE,1,96,TRUE,1,98,TRUE,0,51,FALSE,1,67,TRUE,0,68,TRUE,1,70,FALSE,0,51,TRUE,1,51,0.0169,0.0004,0.3844,0.0049,0.2401,0.01,0.1296,0.0784,0.2601,0.2704,0.09,0.1369,0.2704,0.36,0.04,0.2809,0.2704,0.49,0.1089,0.0016,0.2704,0.0784,0.2704,0.0729,0.5329,0.2601,0.2601,0.49,0.4225,0,0.4624,0.4096,0.23455,0.209085714,0.260014286,5,15.63,15,46.88,1,12.5,4,50,6,75,4,50,10,62.5,5,31.25,67.94,57.62,66.12,81.75,66.25,67,68.88,-31.25,21.06,45.12,16.12,6.75,16.25,4.5,37.63,0,0,4,3,2,2,4,2,2,1,1,3,0,3,0,1,3,3,3,0,1,1,2,1,1,0,0,1,2,1,0,2,0,1,0,1,1,1,1,0,1.8,2.2,1.4,2,1.2,0.8,0.6,0.8,1.85,0.85,1.35,3.67,3,5,0.6,1.4,0.8,1.2,0.933333333,0,3,-1,0,0.67,0,0,2,-1,1,-1,1,1,-1,-2,2,0,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,N/A,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,3,2,9,5,7,4,8,1,6,2,3,4,1 +822,R_6LsULTfUjm0kP9T,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Agree,Strongly agree,1,4,3,5,2,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Strongly agree,2,3,1,5,4,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,5,2,4,3,1,Agree,Agree,Somewhat agree,Agree,Agree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,5,3,4,Strongly agree,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,4,1,2,5,3,3,Agree,Strongly Disagree,Strongly Agree,Strongly Agree,Disagree,5,3,4,1,2,4,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,1,5,4,2,3,Agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,3,5,4,2,3,Somewhat Agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,5,1,3,4,2,2,Somewhat agree,Somewhat agree,Agree,Agree,Agree,1,2,5,3,4,FALSE,50,TRUE,50,TRUE,98,TRUE,54,FALSE,50,TRUE,70,TRUE,88,FALSE,50,TRUE,65,FALSE,59,TRUE,52,TRUE,99,FALSE,100,FALSE,86,FALSE,50,TRUE,58,TRUE,63,TRUE,100,TRUE,53,TRUE,83,TRUE,100,TRUE,91,FALSE,77,TRUE,50,FALSE,50,TRUE,76,FALSE,51,FALSE,100,TRUE,54,TRUE,100,FALSE,50,FALSE,68,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,1,2,3,1,0,2,-1,3,1,0,3,0,2,2,2,1,2,2,-3,1,3,3,3,7,3,-3,-1,1,0,4,2,-3,3,3,-2,3,2,2,3,3,3,4,2,3,2,3,3,4,2,3,3,-1,3,3,1,-1,3,1,0,3,1,1,2,2,2,2,FALSE,1,50,TRUE,1,50,TRUE,0,98,TRUE,0,54,FALSE,0,50,TRUE,0,70,TRUE,1,88,FALSE,0,50,TRUE,1,65,FALSE,0,59,TRUE,0,52,TRUE,0,99,FALSE,0,100,FALSE,1,86,FALSE,0,50,TRUE,1,58,TRUE,0,63,TRUE,0,100,TRUE,0,53,TRUE,0,83,TRUE,1,100,TRUE,1,91,FALSE,1,77,TRUE,1,50,FALSE,1,50,TRUE,1,76,FALSE,1,51,FALSE,1,100,TRUE,0,54,TRUE,1,100,FALSE,0,50,FALSE,0,68,0.25,0.0576,0.1764,0.0144,0.4624,0.49,0.25,0.3481,0.6889,0.0081,0,1,0.1225,0.2704,0.25,0.25,0.0529,0.2916,0,0.25,0,0.25,0.2809,0.0196,0.3969,0.2401,0.25,0.25,0.9604,1,0.2916,0.9801,0.344803571,0.32035,0.369257143,12,37.5,15,46.88,3,37.5,2,25,6,75,4,50,9,56.25,6,37.5,70.16,53.12,72.75,75,79.75,69.06,71.25,-9.38,23.28,15.62,47.75,0,29.75,12.81,33.75,4,2,2,1,0,2,3,3,2,3,1,3,0,3,4,0,0,2,1,1,1,0,1,1,0,1,3,1,0,0,0,1,0,1,2,1,1,1,0,0,1.8,2.6,2.2,0.8,0.6,1,0.8,0.6,1.85,0.75,1.3,4.67,3.33,3.75,1.2,1.6,1.4,0.2,1.4,3,1,0,2,1.34,0,2,2,-2,2,0,0,-1,1,-2,2,2,5 cents,100 minutes,36 days,Male,University - Undergraduate,23,Too have the ability to go back to a previous question.,1.375,1,0,0,0,1,0,0.33,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,4,2,9,5,6,8,7,1,3,2,3,4,1 +823,R_3L1API9vGOPA5Md,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,Somewhat agree,1,2,3,5,4,Disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,4,1,3,2,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,3,1,2,5,4,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,2,5,1,Agree,Agree,Agree,Strongly Agree,Strongly Agree,3,4,1,5,2,4,Strongly disagree,Agree,Somewhat disagree,Strongly agree,Disagree,3,2,4,5,1,6,Strongly Agree,Strongly Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,1,5,4,2,3,7,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,5,3,4,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,3,2,4,5,1,7,Agree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,2,4,3,5,1,7,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,3,4,1,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,65,FALSE,57,FALSE,74,TRUE,54,FALSE,87,FALSE,55,TRUE,83,FALSE,100,TRUE,81,FALSE,65,FALSE,54,TRUE,79,FALSE,51,FALSE,51,TRUE,85,FALSE,52,FALSE,52,FALSE,51,FALSE,55,TRUE,51,TRUE,90,FALSE,51,TRUE,85,FALSE,59,FALSE,60,TRUE,52,FALSE,100,FALSE,52,FALSE,52,TRUE,100,FALSE,54,TRUE,76,8,1,3,-1,1,1,-2,1,1,3,1,3,1,2,1,3,-2,-1,1,1,0,2,2,2,3,3,4,-3,2,-1,3,-2,6,3,3,-1,0,2,7,1,0,2,1,2,5,2,3,1,0,3,7,2,1,2,-1,3,7,3,1,3,2,3,3,3,3,3,3,3,8,TRUE,0,76,FALSE,0,54,TRUE,0,100,FALSE,1,52,FALSE,0,52,FALSE,1,100,TRUE,1,52,FALSE,0,60,FALSE,0,59,TRUE,1,85,FALSE,1,51,TRUE,0,90,TRUE,1,51,FALSE,1,55,FALSE,0,51,FALSE,0,52,FALSE,1,52,TRUE,0,85,FALSE,1,51,FALSE,1,51,TRUE,1,79,FALSE,0,54,FALSE,1,65,TRUE,1,81,FALSE,1,100,TRUE,1,83,FALSE,1,55,FALSE,1,87,TRUE,0,54,FALSE,0,74,FALSE,0,57,TRUE,1,65,0.36,0.0289,0.2704,0.2304,0.1225,0,0.0361,0.0225,0.2401,0.2916,0.5476,0.2401,0.3481,0.2401,0.2704,0.2916,0.1225,0.2304,0.0169,0,0.0441,0.2601,0.2401,0.2025,0.2304,0.2025,0.3249,0.5776,1,0.7225,0.2916,0.81,0.2831,0.214542857,0.351657143,8,25,18,56.25,4,50,6,75,5,62.5,3,37.5,7,43.75,11,68.75,66.66,53.75,64.75,73.75,74.38,63.06,70.25,-31.25,10.41,3.75,-10.25,11.25,36.88,19.31,1.5,1,1,3,2,2,1,1,2,0,3,0,2,3,1,1,3,1,1,0,2,1,0,2,1,2,4,0,1,4,2,0,0,1,1,0,5,4,2,2,3,1.8,1.4,1.4,1.4,1.2,2.2,0.4,3.2,1.5,1.75,1.625,5.67,5.67,5.875,0.6,-0.8,1,-1.8,0.266666667,-3,-1,4,-3,0,-1,2,2,-2,2,1,-1,1,-1,-2,2,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),18,,0.625,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,9,6,2,7,8,4,3,1,5,2,3,4,1 +824,R_1lDrQCEn5qubXel,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,3,1,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,3,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,3,2,4,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,3,2,4,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,5,2,1,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,3,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,1,2,10,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,3,1,2,5,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,-3,3,-3,3,5,3,3,3,3,3,0,-3,-3,-3,-3,-3,10,3,3,3,3,3,10,3,-3,3,3,3,10,3,3,3,3,3,0,3,3,3,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,0,100,0,1,0,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0.214285714,0.357142857,0.071428571,32,100,25,78.13,8,100,5,62.5,6,75,6,75,10,62.5,15,93.75,100,100,100,100,100,100,100,21.87,21.87,0,37.5,25,25,37.5,6.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,1.2,0,0,1.5,0.3,0.9,1.67,6.67,5,0,-1.2,0,6,-0.4,-10,-5,0,5,-5,0,2,2,0,0,-2,2,2,-2,-2,2,2,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),38,No feedback.,1,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,01DIR,7,9,4,8,2,5,6,1,3,2,4,3,1 +825,R_7CPiwAiwByBo9QO,39 - 45,American,,American,Male,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,3,4,5,1,2,Strongly agree,Somewhat agree,Agree,Strongly agree,Agree,4,3,5,1,2,Strongly Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,1,5,2,4,3,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,1,2,4,5,3,Agree,Agree,Somewhat agree,Strongly Agree,Strongly Agree,5,2,3,1,4,10,Agree,Strongly agree,Agree,Strongly agree,Somewhat agree,5,1,2,4,3,10,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,Agree,3,5,1,4,2,10,Strongly Agree,Somewhat agree,Agree,Agree,Strongly Agree,4,3,5,2,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,1,4,5,2,3,10,Strongly agree,Agree,Agree,Strongly agree,Somewhat agree,4,2,5,1,3,10,Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,5,3,1,2,4,10,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,1,2,5,4,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,93,TRUE,96,FALSE,95,FALSE,94,FALSE,100,TRUE,99,FALSE,97,TRUE,97,FALSE,100,TRUE,99,TRUE,99,FALSE,100,FALSE,98,TRUE,99,FALSE,97,TRUE,99,TRUE,95,FALSE,93,FALSE,100,TRUE,100,FALSE,98,TRUE,97,TRUE,96,TRUE,98,TRUE,99,FALSE,99,TRUE,97,TRUE,99,FALSE,100,TRUE,100,FALSE,100,32,1,3,2,3,2,3,1,2,3,2,3,2,2,1,1,3,2,3,2,1,2,2,1,3,3,10,2,3,2,3,1,10,1,2,3,3,2,10,3,1,2,2,3,10,3,2,3,2,1,10,3,2,2,3,1,10,2,1,3,2,3,10,3,2,3,2,1,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,99,TRUE,1,97,FALSE,1,99,TRUE,1,99,TRUE,1,98,TRUE,1,96,TRUE,1,97,FALSE,1,98,TRUE,0,100,FALSE,0,100,FALSE,1,93,TRUE,1,95,TRUE,1,99,FALSE,1,97,TRUE,0,99,FALSE,1,98,FALSE,1,100,TRUE,1,99,TRUE,1,99,FALSE,1,100,TRUE,1,97,FALSE,1,97,TRUE,1,99,FALSE,1,100,FALSE,1,94,FALSE,1,95,TRUE,1,96,TRUE,1,93,TRUE,1,100,0.0004,0.0001,0.0001,0.0001,0,0.0001,0.0009,0.0009,0,0.0001,0.0016,1,0.0016,0.0004,0.0009,0,0,0.9801,0.0036,0.0009,0.0001,0.0025,0.0004,0.0049,0.0009,0,0.0049,0,0,0.9801,0.0025,1,0.142407143,0.1419,0.142914286,32,100,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,15,93.75,13,81.25,97.91,97.38,98.38,97.88,98,97.75,98.06,12.5,10.41,9.88,10.88,10.38,10.5,4,16.81,1,1,1,0,1,1,2,0,0,1,2,0,1,2,1,0,1,1,0,2,2,1,1,1,1,0,1,0,0,1,1,1,1,1,2,0,0,0,0,0,0.8,0.8,1.2,0.8,1.2,0.4,1.2,0,0.9,0.7,0.8,10,10,10,-0.4,0.4,0,0.8,3.7E-17,0,0,0,0,0,1,2,2,2,-2,1,-1,2,-2,2,-2,2,15 cents,25 minutes,24 days,Male,University - Graduate (Masters),43,Thank you! I am very satisfied for this survey,0,0,0,0,0,0,1,0,0.33,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,6,8,9,3,5,7,4,1,2,2,3,4,1 +826,R_5FWZQLK0B9joAw1,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,1,4,5,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,3,1,5,2,4,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,1,2,3,5,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,2,4,5,3,3,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,4,3,1,5,5,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,5,3,4,2,1,6,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,2,1,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,4,3,5,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,5,1,3,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,3,2,4,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,4,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,87,FALSE,67,FALSE,73,TRUE,100,FALSE,50,TRUE,67,TRUE,64,FALSE,63,TRUE,50,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,82,FALSE,50,TRUE,100,TRUE,78,TRUE,92,FALSE,67,FALSE,100,FALSE,67,FALSE,58,FALSE,50,FALSE,50,FALSE,50,FALSE,64,FALSE,50,FALSE,100,FALSE,50,FALSE,89,FALSE,50,FALSE,58,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,0,1,0,1,0,-1,0,-1,-1,2,1,0,0,-1,1,0,0,0,1,0,1,-1,3,-2,-1,-1,1,-1,5,0,-1,0,1,0,6,-1,-1,-1,-1,-1,4,1,2,0,1,1,5,1,0,1,-1,1,6,0,0,1,1,1,6,1,1,1,1,0,5,FALSE,1,87,FALSE,0,67,FALSE,1,73,TRUE,0,100,FALSE,0,50,TRUE,0,67,TRUE,1,64,FALSE,0,63,TRUE,1,50,FALSE,0,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,82,FALSE,0,50,TRUE,1,100,TRUE,0,78,TRUE,0,92,FALSE,1,67,FALSE,1,100,FALSE,0,67,FALSE,0,58,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,64,FALSE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,89,FALSE,0,50,FALSE,0,58,0.3969,0.4096,0,0.1296,0.3364,0.4489,0.25,0.25,0,0.3364,0.7921,0,0.25,1,0.25,0.4489,0.25,1,0,0.25,0.4489,0.25,0.1089,0.0324,0.6084,0.25,0.25,0.0169,0.0729,0.8464,0.25,1,0.357053571,0.400907143,0.3132,15,46.88,14,43.75,3,37.5,3,37.5,4,50,4,50,4,25,10,62.5,71.12,66.75,65,68.38,84.38,64.38,77.88,3.13,27.37,29.25,27.5,18.38,34.38,39.38,15.38,1,1,1,1,2,2,2,1,2,1,1,0,2,0,0,1,0,2,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,0,1,1,2,0,1,0,1.2,1.6,0.6,1,0.4,0.8,0.8,0.8,1.1,0.7,0.9,4.67,5.67,5,0.8,0.8,-0.2,0.2,0.466666667,-2,-1,0,-1,-1,2,-1,1,-1,1,0,0,-1,1,-2,2,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,27,,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,01ITEM,01DIR,7,9,4,6,2,5,8,1,3,2,4,3,1 +827,R_3PdTdTVt4EZ5LdO,25 - 31,American,,American,Male,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Agree,1,5,2,4,3,Agree,Agree,Agree,Strongly Agree,Strongly Agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Strongly Agree,Neither agree nor disagree,Strongly disagree,Strongly Agree,4,5,3,2,1,4,Neither agree nor disagree,Strongly disagree,Agree,Neither agree nor disagree,Strongly agree,3,4,1,2,5,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,1,4,2,5,8,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,4,3,2,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,1,4,3,5,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,3,5,1,4,2,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,2,5,TRUE,67,FALSE,50,TRUE,100,TRUE,50,FALSE,58,FALSE,100,TRUE,83,FALSE,66,TRUE,59,TRUE,71,TRUE,64,TRUE,76,TRUE,84,TRUE,69,TRUE,57,TRUE,68,TRUE,69,TRUE,95,TRUE,91,TRUE,64,TRUE,80,FALSE,50,TRUE,75,FALSE,50,TRUE,75,TRUE,80,FALSE,50,TRUE,60,FALSE,50,TRUE,63,TRUE,80,FALSE,50,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,0,1,1,-1,2,-1,2,2,2,2,3,3,1,1,1,1,0,-1,3,0,-3,3,5,0,-3,2,0,3,4,3,3,3,3,2,6,-1,2,1,0,0,8,2,3,1,0,1,3,1,-3,3,-3,2,0,3,3,3,-1,3,5,3,3,3,3,3,8,TRUE,0,67,FALSE,0,50,TRUE,0,100,TRUE,0,50,FALSE,0,58,FALSE,1,100,TRUE,1,83,FALSE,0,66,TRUE,1,59,TRUE,1,71,TRUE,0,64,TRUE,0,76,TRUE,1,84,TRUE,0,69,TRUE,1,57,TRUE,1,68,TRUE,0,69,TRUE,0,95,TRUE,0,91,TRUE,0,64,TRUE,1,80,FALSE,0,50,TRUE,0,75,FALSE,0,50,TRUE,0,75,TRUE,1,80,FALSE,1,50,TRUE,0,60,FALSE,1,50,TRUE,1,63,TRUE,1,80,FALSE,0,50,0.4356,0.04,0.1024,0.0289,0.25,0,0.25,0.0841,0.4096,0.25,0.1369,0.0256,0.1681,0.4096,0.3364,0.25,0.5625,0.25,0.36,0.5625,0.04,0.1849,0.8281,0.4761,0.4761,0.25,0.04,0.4489,1,0.9025,0.25,0.5776,0.349267857,0.241628571,0.456907143,19,59.38,13,40.63,4,50,4,50,3,37.5,2,25,10,62.5,3,18.75,68.88,62.62,70.75,73.75,68.38,65.56,72.19,18.75,28.25,12.62,20.75,36.25,43.38,3.06,53.44,2,0,2,3,2,1,2,0,1,1,1,1,1,0,1,2,1,0,1,0,1,0,1,0,0,0,2,1,2,0,1,1,1,4,0,2,2,2,2,3,1.8,1,0.8,0.8,0.4,1,1.4,2.2,1.1,1.25,1.175,5,2.67,4.875,1.4,0,-0.6,-1.4,0.266666667,2,4,1,0,2.33,0,2,1,-1,1,1,-1,-1,1,-2,2,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,30,i have no feedback,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,02DGEN,01DIR,5,9,2,7,8,4,3,1,6,2,4,3,1 +828,R_5aS6ebRQYuxR6vz,25 - 31,American,,American,Male,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,4,5,1,2,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,5,1,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,2,4,3,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Disagree,Strongly Agree,Neither agree nor disagree,Disagree,Somewhat disagree,2,3,4,1,5,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,2,5,1,8,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,1,2,5,7,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,5,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,3,2,5,6,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,1,2,3,5,9,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,1,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,76,FALSE,61,TRUE,87,FALSE,56,TRUE,51,TRUE,57,TRUE,96,FALSE,56,FALSE,57,FALSE,59,TRUE,59,FALSE,90,FALSE,70,TRUE,90,TRUE,88,FALSE,84,TRUE,88,TRUE,89,TRUE,90,TRUE,86,TRUE,89,FALSE,86,FALSE,85,FALSE,87,TRUE,86,TRUE,90,FALSE,88,FALSE,88,FALSE,75,TRUE,88,FALSE,82,TRUE,88,16,-1,1,0,-1,-1,0,-1,1,1,1,-1,0,1,-1,1,-1,-1,0,0,-1,-2,3,0,-2,-1,5,1,0,1,1,1,6,1,0,1,0,0,8,1,1,-1,-1,1,7,-1,1,-1,-1,-2,7,0,0,1,0,1,5,-1,1,1,0,2,6,1,1,1,1,-2,9,TRUE,0,88,FALSE,0,82,TRUE,0,88,FALSE,1,75,FALSE,0,88,FALSE,1,88,TRUE,1,90,TRUE,1,86,FALSE,0,87,FALSE,0,85,FALSE,1,86,TRUE,0,89,TRUE,1,86,TRUE,0,90,TRUE,1,89,TRUE,1,88,FALSE,1,84,TRUE,0,88,TRUE,0,90,FALSE,1,70,FALSE,0,90,TRUE,1,59,FALSE,1,59,FALSE,0,57,FALSE,1,56,TRUE,1,96,TRUE,0,57,TRUE,0,51,FALSE,1,56,TRUE,1,87,FALSE,0,61,TRUE,1,76,0.0196,0.0016,0.0144,0.01,0.0576,0.0144,0.3249,0.7225,0.09,0.1681,0.0169,0.0196,0.7569,0.0196,0.7744,0.6724,0.1681,0.0625,0.2601,0.1936,0.81,0.0121,0.81,0.81,0.0256,0.3249,0.3721,0.7744,0.7744,0.7744,0.1936,0.7921,0.385542857,0.276278571,0.494807143,16,50,17,53.13,3,37.5,6,75,4,50,4,50,9,56.25,8,50,78.81,78.38,78.38,81.5,77,81.69,75.94,-3.13,25.68,40.88,3.38,31.5,27,25.44,25.94,1,2,0,1,0,1,1,0,0,0,2,0,0,1,1,2,2,1,1,2,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,2,2,1,1,1,0.8,0.4,0.8,1.6,0.4,0.4,0.6,1.4,0.9,0.7,0.8,6.33,6,6.625,0.4,0,0.2,0.2,0.2,-2,1,2,-2,0.33,1,0,0,-1,1,0,0,0,0,1,-1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),29,It was great ,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,6,5,4,2,8,7,3,1,9,4,2,3,1 +829,R_7jU8vCajvbsV8BA,18 - 24,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Agree,Agree,2,4,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,Agree,5,3,4,2,1,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,2,5,4,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,1,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Agree,Agree,5,2,4,1,3,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,1,2,4,7,Agree,Agree,Agree,Somewhat Agree,Agree,1,5,4,2,3,3,Strongly Agree,Agree,Agree,Agree,Agree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Strongly Agree,Agree,Agree,Agree,3,1,5,2,4,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,Agree,5,2,3,4,1,4,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,2,5,1,3,5,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,FALSE,90,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,55,TRUE,50,TRUE,55,FALSE,55,TRUE,60,FALSE,65,TRUE,70,TRUE,75,TRUE,65,FALSE,55,TRUE,90,TRUE,70,TRUE,75,TRUE,65,FALSE,60,FALSE,95,TRUE,65,TRUE,60,FALSE,50,TRUE,60,TRUE,55,TRUE,55,TRUE,70,TRUE,65,TRUE,75,FALSE,55,FALSE,60,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,2,0,0,1,-3,2,2,2,2,0,1,1,2,2,2,1,2,2,2,2,2,3,-1,0,1,-1,1,5,2,2,2,1,2,7,3,2,2,2,2,3,2,3,2,2,2,4,0,0,2,-3,2,2,2,2,2,0,2,4,2,2,2,2,2,5,FALSE,1,90,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,0,55,TRUE,1,50,TRUE,1,55,FALSE,0,55,TRUE,1,60,FALSE,1,65,TRUE,0,70,TRUE,1,75,TRUE,0,65,FALSE,0,55,TRUE,1,90,TRUE,0,70,TRUE,0,75,TRUE,0,65,FALSE,1,60,FALSE,0,95,TRUE,1,65,TRUE,0,60,FALSE,0,50,TRUE,0,60,TRUE,1,55,TRUE,0,55,TRUE,0,70,TRUE,0,65,TRUE,1,75,FALSE,0,55,FALSE,0,60,0.2025,0.2025,0.01,0.25,0.36,0.3025,0.25,0.16,0.16,0.1225,0.0625,0.0625,0.3025,0.1225,0.25,0.25,0.36,0.25,0.49,0.36,0.9025,0.3025,0.4225,0.4225,0.49,0.3025,0.3025,0.01,0.25,0.5625,0.4225,0.49,0.312321429,0.215357143,0.409285714,12,37.5,14,43.75,3,37.5,1,12.5,5,62.5,5,62.5,9,56.25,5,31.25,63.12,56.25,66.25,65,65,62.19,64.06,-6.25,19.37,18.75,53.75,2.5,2.5,5.94,32.81,0,1,0,0,0,1,0,0,2,1,0,0,0,1,1,2,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0.2,0.8,0.4,0.6,0,0.2,0.2,0.4,0.5,0.2,0.35,5,3.33,4.125,0.2,0.6,0.2,0.2,0.333333333,-1,3,3,-2,1.67,0,1,1,0,0,1,-1,1,-1,0,0,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,20,"Interesting survey, I had fun with it. I'd like to participate more like these surveys.",0.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,9,7,5,4,6,2,3,1,8,3,2,4,1 +830,R_6JRPravQkDHvdZn,32 - 38,American,,American,Male,Agree,Agree,Agree,Strongly agree,Agree,4,3,2,5,1,Strongly disagree,Somewhat disagree,Disagree,Somewhat agree,Disagree,4,2,3,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,1,4,5,2,3,Strongly disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,5,3,4,1,2,Strongly Agree,Agree,Strongly Agree,Agree,Agree,2,5,3,4,1,9,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat agree,2,1,5,3,4,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,5,1,4,9,Disagree,Disagree,Neither agree nor disagree,Disagree,Disagree,1,3,4,5,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,2,5,7,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,3,1,2,4,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,3,5,2,1,4,7,Somewhat agree,Strongly Agree,Agree,Agree,Neither agree nor disagree,4,5,1,3,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,55,TRUE,90,TRUE,90,TRUE,60,TRUE,75,TRUE,55,TRUE,90,TRUE,55,FALSE,90,TRUE,100,TRUE,60,FALSE,50,TRUE,70,TRUE,70,TRUE,55,TRUE,100,TRUE,60,FALSE,60,TRUE,90,TRUE,80,FALSE,50,TRUE,90,TRUE,60,TRUE,90,TRUE,90,TRUE,70,TRUE,60,TRUE,60,FALSE,50,TRUE,60,TRUE,50,20,2,2,2,3,2,-3,-1,-2,1,-2,0,0,2,-2,1,-3,-1,-1,0,-2,3,2,3,2,2,9,-2,0,-2,1,1,9,0,0,3,0,1,9,-2,-2,0,-2,-2,10,3,3,3,3,3,7,0,-2,2,-2,0,7,0,0,3,0,2,7,1,3,2,2,0,10,TRUE,0,50,TRUE,1,60,FALSE,1,50,TRUE,0,60,TRUE,1,60,TRUE,0,70,TRUE,1,90,TRUE,1,90,TRUE,1,60,TRUE,1,90,FALSE,1,50,TRUE,0,80,TRUE,1,90,FALSE,1,60,TRUE,1,60,TRUE,1,100,TRUE,0,55,TRUE,0,70,TRUE,0,70,FALSE,1,50,TRUE,1,60,TRUE,1,100,FALSE,1,90,TRUE,1,55,TRUE,0,90,TRUE,1,55,TRUE,0,75,TRUE,0,60,TRUE,0,90,TRUE,1,90,TRUE,1,55,TRUE,1,90,0.01,0.2025,0,0.01,0.01,0.49,0.2025,0.01,0.25,0,0.01,0.01,0.16,0.25,0.16,0.16,0.01,0.36,0.36,0.81,0.16,0.16,0.49,0.16,0.3025,0.5625,0.2025,0.25,0.25,0.49,0.81,0.64,0.276071429,0.14875,0.403392857,20,62.5,21,65.63,5,62.5,5,62.5,5,62.5,6,75,16,100,5,31.25,71.09,61.25,75.62,75.62,71.88,75.31,66.88,-3.13,5.46,-1.25,13.12,13.12,-3.12,-24.69,35.63,1,0,1,1,0,1,1,0,0,3,0,0,1,2,0,1,1,1,2,0,1,1,1,0,1,3,1,4,3,2,0,0,1,2,1,4,4,3,2,2,0.6,1,0.6,1,0.8,2.6,0.8,3,0.8,1.8,1.3,9,7,8.5,-0.2,-1.6,-0.2,-2,-0.666666667,2,2,2,0,2,1,2,1,-2,2,0,0,-2,2,-1,1,1,10 cents,100 minutes,47 days,Male,High School (or equivalent),38,It was an interesting survey.,1.25,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,01ITEM,02REV,2,4,5,7,3,6,9,1,8,3,2,4,1 +831,R_37aADac832DvBND,32 - 38,American,,American,Male,Agree,Agree,Agree,Agree,Agree,3,4,5,2,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,4,3,5,2,1,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Agree,Agree,Agree,4,3,2,1,5,9,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,9,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,4,3,1,5,8,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,4,2,1,3,5,4,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,1,2,5,5,Agree,Agree,Agree,Agree,Somewhat agree,3,2,1,5,4,FALSE,95,TRUE,79,FALSE,74,FALSE,75,TRUE,100,FALSE,75,TRUE,90,TRUE,94,TRUE,92,TRUE,96,FALSE,92,TRUE,86,FALSE,81,FALSE,86,TRUE,86,TRUE,85,TRUE,93,TRUE,71,FALSE,69,TRUE,73,TRUE,100,TRUE,100,FALSE,85,TRUE,87,FALSE,87,TRUE,90,FALSE,89,FALSE,83,TRUE,72,FALSE,85,TRUE,81,TRUE,83,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,-1,-1,1,-1,3,2,2,2,2,2,-1,0,0,2,-1,2,2,2,2,2,7,0,1,1,1,0,9,1,1,1,1,1,9,-1,0,0,0,-1,8,2,2,2,2,2,8,0,0,2,0,1,4,2,1,2,0,1,4,2,2,2,2,1,5,FALSE,1,95,TRUE,1,79,FALSE,1,74,FALSE,1,75,TRUE,1,100,FALSE,1,75,TRUE,1,90,TRUE,1,94,TRUE,1,92,TRUE,1,96,FALSE,1,92,TRUE,0,86,FALSE,0,81,FALSE,1,86,TRUE,1,86,TRUE,1,85,TRUE,0,93,TRUE,0,71,FALSE,1,69,TRUE,0,73,TRUE,1,100,TRUE,1,100,FALSE,1,85,TRUE,1,87,FALSE,1,87,TRUE,1,90,FALSE,1,89,FALSE,1,83,TRUE,0,72,FALSE,0,85,TRUE,1,81,TRUE,1,83,0.0036,0.01,0.0225,0.01,0.0289,0.0625,0.0169,0.0016,0.5329,0,0.7225,0.6561,0.0064,0.0064,0,0.0441,0.0225,0.0625,0.0289,0.0169,0,0.0196,0.0961,0.0196,0.8649,0.0121,0.0361,0.0025,0.0676,0.5041,0.5184,0.7396,0.181775,0.154521429,0.209028571,26,81.25,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,85.44,82.88,86.12,89.38,83.38,89.31,81.56,3.12,7.31,-17.12,23.62,1.88,20.88,1.81,12.81,0,0,0,0,0,1,2,0,2,3,1,1,1,1,1,0,0,0,2,0,0,0,0,0,0,1,1,1,1,2,0,1,0,2,1,3,2,2,0,2,0,1.6,1,0.4,0,1.2,0.8,1.8,0.75,0.95,0.85,8.33,5.33,6.75,0,0.4,0.2,-1.4,0.2,-1,5,5,3,3,0,0,0,-1,1,0,0,2,-2,0,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,32,liked it for sure smart survey ,0,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,01DIR,2,4,3,6,9,8,5,1,7,2,3,4,1 +832,R_1GQif6oeHhhHPwm,39 - 45,,Canadian,Canadian,Male,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,5,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,1,2,5,4,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,1,2,4,5,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,1,4,5,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,4,3,1,0,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,2,4,3,1,5,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,4,5,2,3,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,4,3,1,2,0,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,5,2,3,4,1,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,3,5,1,TRUE,85,TRUE,100,FALSE,56,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,0,3,1,3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,0,-3,-3,-3,-3,-3,10,TRUE,0,85,TRUE,1,100,FALSE,1,56,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.7225,0.1936,0.25,0.25,0.25,0.255932143,0.232142857,0.279721429,5,15.63,17,53.13,6,75,5,62.5,3,37.5,3,37.5,6,37.5,11,68.75,52.84,56.25,50,54.38,50.75,53.12,52.56,-37.5,-0.29,-18.75,-12.5,16.88,13.25,15.62,-16.19,0,3,6,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.8,0,0,0,3.8,0,0,0,0.95,0.95,0.95,0,0,1.25,0,0,0,0,0,0,0,0,-10,0,-2,-2,-2,-2,2,-1,1,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),40,,0,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,6,9,7,8,2,4,3,1,5,4,2,3,1 +833,R_1uJQeGZjWt5MvwB,25 - 31,American,,American,Male,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,2,3,4,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,1,3,2,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,5,4,3,2,1,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,3,4,Somewhat agree,Somewhat agree,Agree,Agree,Agree,5,1,4,3,2,7,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,1,5,2,3,8,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,3,4,1,2,5,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,2,3,4,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,3,2,5,1,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,1,5,2,4,8,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,1,5,3,2,4,6,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,4,3,5,2,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,76,TRUE,66,TRUE,74,FALSE,72,TRUE,78,TRUE,87,TRUE,78,TRUE,86,TRUE,76,TRUE,80,TRUE,84,TRUE,83,TRUE,80,FALSE,60,TRUE,77,TRUE,79,TRUE,73,TRUE,84,TRUE,75,TRUE,76,TRUE,79,TRUE,64,TRUE,80,TRUE,85,TRUE,72,TRUE,76,TRUE,75,TRUE,79,TRUE,74,TRUE,78,TRUE,69,TRUE,79,29,1,2,1,0,1,1,2,1,0,1,2,1,1,2,1,2,2,1,1,1,1,1,2,2,2,7,2,1,1,2,1,8,1,2,1,2,1,7,1,2,1,1,2,6,1,2,1,1,2,7,1,1,1,2,2,8,1,2,1,2,1,6,1,2,2,1,1,5,TRUE,0,79,TRUE,1,69,TRUE,0,78,TRUE,0,74,TRUE,1,79,TRUE,0,75,TRUE,1,76,TRUE,1,72,TRUE,1,85,TRUE,1,80,TRUE,0,64,TRUE,0,79,TRUE,1,76,TRUE,0,75,TRUE,1,84,TRUE,1,73,TRUE,0,79,TRUE,0,77,FALSE,1,60,TRUE,0,80,TRUE,1,83,TRUE,1,84,TRUE,0,80,TRUE,1,76,TRUE,0,86,TRUE,1,78,TRUE,0,87,TRUE,0,78,FALSE,1,72,TRUE,1,74,TRUE,1,66,TRUE,1,76,0.0784,0.0484,0.0729,0.0576,0.0576,0.5625,0.0576,0.04,0.64,0.0256,0.0676,0.0576,0.0225,0.4096,0.0441,0.0961,0.64,0.5476,0.6084,0.7396,0.0289,0.0256,0.16,0.5625,0.6241,0.7569,0.1156,0.6241,0.6084,0.5929,0.0784,0.6241,0.336353571,0.233457143,0.43925,29,90.63,18,56.25,5,62.5,5,62.5,4,50,4,50,16,100,2,12.5,76.69,73.62,77.5,79.38,76.25,76.94,76.44,34.38,20.44,11.12,15,29.38,26.25,-23.06,63.94,0,1,1,2,1,1,1,0,2,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,1,0,2,1,1,1,0,0,0,1,0,1,0,0,1,0.8,0.4,0.4,0.4,0.8,0.4,0.4,0.65,0.5,0.575,7.33,7,6.75,0.6,0,0,0,0.2,0,0,1,1,0.33,1,1,1,1,-1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,15 days,Male,University - PhD,30,GOOD,0,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,9,2,8,5,3,6,4,1,7,2,4,3,1 +834,R_3dG7OKXUX6VUzWF,25 - 31,American,,American,Male,Somewhat disagree,Agree,Strongly agree,Strongly agree,Agree,4,5,2,3,1,Strongly agree,Agree,Agree,Disagree,Strongly agree,2,4,1,5,3,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,5,3,1,4,Agree,Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Agree,Strongly Agree,Agree,Strongly Agree,2,1,3,5,4,8,Strongly agree,Agree,Strongly agree,Strongly disagree,Agree,3,1,5,2,4,7,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Agree,4,3,2,5,1,6,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,4,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Agree,Strongly Agree,Strongly Agree,Agree,3,1,2,5,4,5,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,5,4,3,2,1,7,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,3,4,5,2,1,8,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,5,1,3,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,79,FALSE,65,FALSE,85,TRUE,100,FALSE,70,FALSE,81,FALSE,100,FALSE,77,TRUE,95,FALSE,80,TRUE,95,FALSE,100,FALSE,88,FALSE,76,TRUE,100,FALSE,77,TRUE,100,FALSE,68,TRUE,90,TRUE,80,FALSE,70,FALSE,86,FALSE,66,FALSE,76,TRUE,79,TRUE,86,FALSE,85,FALSE,100,FALSE,70,FALSE,84,FALSE,87,TRUE,76,15,-1,2,3,3,2,3,2,2,-2,3,1,3,3,3,2,2,2,3,3,1,0,2,3,2,3,4,3,2,3,-3,2,8,3,1,3,2,2,7,2,3,3,3,2,6,0,2,3,3,2,7,3,3,2,-3,2,5,3,2,3,3,2,7,3,3,3,2,1,8,TRUE,0,76,FALSE,0,87,FALSE,1,84,FALSE,1,70,FALSE,0,100,FALSE,1,85,TRUE,1,86,TRUE,1,79,FALSE,0,76,FALSE,0,66,FALSE,1,86,FALSE,1,70,TRUE,1,80,TRUE,0,90,FALSE,0,68,TRUE,1,100,FALSE,1,77,TRUE,0,100,FALSE,1,76,FALSE,1,88,FALSE,0,100,TRUE,1,95,FALSE,1,80,TRUE,1,95,FALSE,1,77,FALSE,0,100,FALSE,1,81,FALSE,1,70,TRUE,0,100,FALSE,0,85,FALSE,0,65,FALSE,0,79,0.0441,1,0,0.0196,0.6241,0.0225,0.0025,0.4356,0.0144,0.0025,0.7225,0.04,0.5776,0.0196,1,0.7569,0.04,0.09,0.09,0.0529,1,0.4624,0.0576,0.81,0.0529,0.0361,0.4225,0.5776,0.0256,1,1,0.09,0.358064286,0.310585714,0.405542857,15,46.88,18,56.25,4,50,4,50,3,37.5,7,87.5,6,37.5,12,75,83.47,76.12,87.62,86.25,83.88,85.06,81.88,-9.37,27.22,26.12,37.62,48.75,-3.62,47.56,6.88,1,0,0,1,1,0,0,1,1,1,2,2,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,2,1,0,0,0,1,1,0,1,0,0.6,0.6,1,0.4,0.2,0.6,0.6,0.6,0.65,0.5,0.575,6.33,6.33,6.5,0.4,0,0.4,-0.2,0.266666667,-3,3,0,-2,0,2,1,1,-2,2,-1,1,1,-1,0,0,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,26,,1,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,02DGEN,02REV,4,9,6,8,3,2,7,1,5,2,4,3,1 +835,R_1GU2LMYusQivyVR,39 - 45,American,,American,Male,Agree,Agree,Somewhat agree,Somewhat agree,Agree,5,3,2,1,4,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,Agree,3,2,1,4,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,5,1,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,5,4,10,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,1,2,3,4,10,Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,4,2,1,3,10,Agree,Somewhat agree,Somewhat agree,Agree,Agree,3,2,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,4,1,3,5,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,5,4,1,3,9,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,5,4,2,3,1,10,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,2,5,4,1,FALSE,100,TRUE,95,FALSE,95,FALSE,90,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,95,TRUE,100,FALSE,100,FALSE,95,FALSE,90,FALSE,100,TRUE,95,TRUE,100,FALSE,95,TRUE,90,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,85,TRUE,87,FALSE,96,TRUE,77,TRUE,96,TRUE,100,TRUE,76,TRUE,75,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,1,1,2,1,2,3,0,2,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,9,2,1,2,1,1,10,2,2,1,1,1,10,2,1,1,2,2,10,2,1,1,1,2,9,1,1,1,0,1,8,1,1,1,2,1,9,1,2,1,2,1,10,FALSE,1,100,TRUE,1,95,FALSE,1,95,FALSE,1,90,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,95,FALSE,0,90,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,95,TRUE,0,90,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,85,TRUE,1,87,FALSE,1,96,TRUE,0,77,TRUE,0,96,TRUE,1,100,TRUE,1,76,TRUE,1,75,0,0.0169,0,0,0.0625,0,0,0,0,0,0,0.81,0.0025,0,0,0.0025,0,0.01,0.5929,0.7225,0,0.0025,0,0,0.0025,0.0016,0.0576,0,0.0025,0.81,0.9216,0.0025,0.142989286,0.063392857,0.222585714,32,100,27,84.38,8,100,6,75,6,75,7,87.5,15,93.75,12,75,94.75,93.38,94.5,95.25,95.88,94.56,94.94,15.62,10.37,-6.62,19.5,20.25,8.38,0.81,19.94,1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,2,0,1,0,0,1,1,1,0,1,0,1,0,0.6,1,0.8,0.6,0.2,0.8,0.6,0.4,0.75,0.5,0.625,9.67,8.67,9.375,0.4,0.2,0.2,0.2,0.266666667,0,2,1,0,1,2,1,1,2,-2,2,-2,1,-1,1,-1,1,5 cents,5 minutes,47 days,Male,University - PhD,44,"Best asked me +",-0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,01DIR,3,7,5,9,2,6,4,1,8,2,4,3,1 +836,R_19om6KG1zhLsRrh,39 - 45,American,,American,Male,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,1,2,5,3,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,4,1,3,2,Somewhat Agree,Strongly Agree,Agree,Agree,Strongly Agree,5,2,1,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,5,4,3,1,2,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,1,5,3,4,2,8,Agree,Agree,Agree,Somewhat agree,Strongly agree,1,5,3,2,4,9,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,1,3,5,2,4,8,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,1,4,5,3,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Somewhat agree,Agree,1,3,5,2,4,9,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,5,4,1,2,3,10,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,2,1,3,5,4,9,Agree,Somewhat agree,Agree,Agree,Strongly Agree,1,2,4,5,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,70,TRUE,70,TRUE,100,FALSE,59,FALSE,73,FALSE,60,FALSE,68,TRUE,57,TRUE,62,TRUE,69,FALSE,64,TRUE,100,FALSE,63,FALSE,62,FALSE,68,FALSE,69,FALSE,67,TRUE,72,FALSE,78,FALSE,81,TRUE,73,FALSE,79,FALSE,68,TRUE,65,TRUE,69,TRUE,70,FALSE,76,TRUE,75,FALSE,87,TRUE,93,FALSE,77,TRUE,75,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,-1,3,-1,2,1,1,0,0,1,1,3,2,2,3,1,1,1,2,0,2,2,2,1,0,8,2,2,2,1,3,9,-1,-1,0,1,1,8,2,1,2,2,0,10,2,3,2,1,2,9,3,2,2,1,3,10,0,2,1,1,-1,9,2,1,2,2,3,9,FALSE,1,70,TRUE,1,70,TRUE,0,100,FALSE,1,59,FALSE,0,73,FALSE,1,60,FALSE,0,68,TRUE,1,57,TRUE,1,62,TRUE,1,69,FALSE,1,64,TRUE,0,100,FALSE,0,63,FALSE,1,62,FALSE,0,68,FALSE,0,69,FALSE,1,67,TRUE,0,72,FALSE,1,78,FALSE,1,81,TRUE,1,73,FALSE,0,79,FALSE,1,68,TRUE,1,65,TRUE,0,69,TRUE,1,70,FALSE,1,76,TRUE,0,75,FALSE,1,87,TRUE,1,93,FALSE,0,77,TRUE,1,75,0.1849,0.09,0.4761,0.4624,0.0625,0.16,0.1225,0.0961,0.0361,0.6241,0.0049,0.3969,0.1444,0.1296,0.5329,0.09,0.1024,0.1681,0.5625,0.4761,0.0729,0.4624,0.0484,0.1444,0.1089,0.0576,0.5929,0.09,1,0.5184,0.0169,1,0.279353571,0.19075,0.367957143,19,59.38,20,62.5,6,75,6,75,4,50,4,50,9,56.25,11,68.75,72.47,69.25,70.75,69.88,80,70.69,74.25,-3.12,9.97,-5.75,-4.25,19.88,30,14.44,5.5,2,3,1,2,2,1,1,2,1,2,2,4,2,1,2,1,0,1,0,0,2,4,1,2,0,2,1,2,1,2,1,1,1,1,4,1,0,1,0,3,2,1.4,2.2,0.4,1.8,1.6,1.6,1,1.5,1.5,1.5,8.33,9.33,9,0.2,-0.2,0.6,-0.6,0.2,-1,-1,-1,1,-1,1,0,1,1,-1,1,-1,1,-1,1,-1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,IT WAS LONG BUT IT WAS GOOD I LIKE IT,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,2,5,9,6,4,7,3,1,8,4,2,3,1 +837,R_6sKu4twJjm42oXT,39 - 45,American,,American,Male,Strongly agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,1,3,5,2,4,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,3,4,2,1,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,1,3,5,4,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Disagree,Agree,Somewhat disagree,Strongly Agree,5,1,2,3,4,10,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,3,2,1,4,10,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,4,3,1,10,Agree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,5,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Agree,5,3,1,4,2,5,Neither agree nor disagree,Agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,2,3,1,4,5,Somewhat Disagree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,1,4,2,5,3,5,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Disagree,2,3,5,1,4,TRUE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,90,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,99,FALSE,100,FALSE,100,TRUE,100,TRUE,100,31,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,-1,1,-1,3,0,2,3,1,0,-1,-1,3,-2,3,-1,-1,0,-1,-1,3,-2,2,-1,3,1,0,3,3,3,0,10,-1,-1,3,3,3,10,2,-3,-3,-3,-3,10,3,-1,-1,-1,2,6,0,2,3,-1,0,5,-1,-1,3,-2,3,5,1,0,-1,0,-2,5,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,99,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0.81,0,0,0,0,0,0.25,0.9801,0,0,0,0,0,1,0.25,0,1,0,1,0,0,0.224646429,0.147142857,0.30215,31,96.88,25,78.13,7,87.5,6,75,6,75,6,75,14,87.5,11,68.75,96.53,87.5,98.75,100,99.88,99.38,93.69,18.75,18.4,0,23.75,25,24.88,11.88,24.94,0,1,1,0,0,0,1,0,2,0,0,0,0,5,0,3,2,3,2,2,0,0,2,0,1,0,0,0,2,0,0,0,0,0,0,2,1,1,1,1,0.4,0.6,1,2.4,0.6,0.4,0,1.2,1.1,0.55,0.825,7,5.33,6.5,-0.2,0.2,1,1.2,0.333333333,-5,5,5,5,1.67,2,2,2,-2,2,-2,2,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,42,"Overall, I found the survey interesting and thought-provoking. It made me reflect on my preferences, values, and self-perceptions. The questions were clear, and I appreciated the opportunity to consider different aspects of myself. +Thank you for the opportunity to participate!.",2,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,6,5,4,2,3,8,7,1,9,4,3,2,1 +838,R_1LUz4Ap00xqEBFe,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Disagree,Agree,Strongly agree,1,4,5,2,3,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,1,2,4,3,5,Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,3,2,4,1,5,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Disagree,Strongly Agree,Strongly Agree,Strongly disagree,Agree,5,1,3,4,2,8,Agree,Agree,Disagree,Somewhat agree,Strongly agree,2,3,4,1,5,9,Strongly Disagree,Disagree,Agree,Agree,Agree,3,4,1,2,5,8,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,4,3,2,1,5,0,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,5,4,3,1,Strongly agree,Strongly agree,Disagree,Strongly Disagree,Strongly agree,3,4,2,1,5,0,Agree,Agree,Strongly Agree,Agree,Strongly Agree,1,4,3,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,FALSE,90,TRUE,96,TRUE,99,TRUE,99,TRUE,97,TRUE,100,FALSE,96,TRUE,99,TRUE,100,TRUE,100,FALSE,98,TRUE,97,TRUE,96,TRUE,95,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,32,3,3,-2,2,3,1,-3,2,-3,3,2,0,3,-2,3,-2,-2,1,0,-2,-2,3,3,-3,2,8,2,2,-2,1,3,8,-3,-2,2,2,2,9,-2,-2,-2,-3,-3,8,3,3,0,3,3,2,-2,-3,3,-3,3,0,3,3,-2,-3,3,1,2,2,3,2,3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,99,TRUE,0,95,TRUE,0,96,TRUE,0,97,FALSE,0,98,TRUE,1,100,TRUE,0,100,TRUE,1,99,FALSE,1,96,TRUE,1,100,TRUE,0,97,TRUE,0,99,TRUE,0,99,TRUE,1,96,FALSE,0,90,TRUE,1,99,0,0,0,0,0.0001,1,0.0001,0,0.9409,0,0.0016,0,0,0.9801,0,0,1,1,0.9801,0.0016,0.9604,0,0.9216,1,0.9801,0.9409,0.81,0,1,0.9025,0.9801,1,0.550003571,0.351628571,0.748378571,32,100,16,50,3,37.5,3,37.5,6,75,4,50,14,87.5,2,12.5,98.72,97.75,99.38,98.88,98.88,98.88,98.56,50,48.72,60.25,61.88,23.88,48.88,11.38,86.06,5,0,5,5,1,1,5,4,4,0,5,2,1,4,1,0,0,3,3,1,0,0,2,1,0,3,0,1,0,0,1,3,5,1,0,4,4,2,2,5,3.2,2.8,2.6,1.4,0.6,0.8,2,3.4,2.5,1.7,2.1,8.33,1,4.5,2.6,2,0.6,-2,1.733333333,6,8,8,8,7.33,2,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,45,Engaging and interesting,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,4,6,2,5,8,9,3,1,7,4,3,2,1 +839,R_5FROcjSqTWns2vu,25 - 31,American,,American,Male,Agree,Strongly agree,Agree,Agree,Agree,5,4,2,1,3,Agree,Agree,Agree,Strongly agree,Strongly agree,4,3,1,5,2,Strongly Agree,Agree,Agree,Strongly Agree,Agree,3,4,1,5,2,Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,2,1,4,5,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,6,Agree,Somewhat agree,Somewhat agree,Agree,Agree,1,2,5,4,3,4,Agree,Somewhat Agree,Agree,Agree,Agree,4,1,5,2,3,6,Somewhat agree,Agree,Agree,Agree,Agree,3,5,1,2,4,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,4,5,3,1,2,2,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,2,4,1,5,3,8,Agree,Agree,Somewhat Agree,Agree,Agree,4,2,3,5,1,6,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,83,TRUE,82,FALSE,63,TRUE,83,TRUE,80,TRUE,93,TRUE,78,TRUE,85,FALSE,58,TRUE,64,TRUE,55,TRUE,78,FALSE,56,TRUE,59,TRUE,61,TRUE,59,TRUE,55,FALSE,76,TRUE,54,TRUE,58,TRUE,57,TRUE,59,TRUE,57,TRUE,61,FALSE,85,FALSE,65,TRUE,55,TRUE,73,FALSE,83,FALSE,70,TRUE,68,TRUE,62,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,2,2,2,2,3,3,3,2,2,3,2,2,3,2,2,3,2,2,2,2,2,6,2,1,1,2,2,4,2,1,2,2,2,6,1,2,2,2,2,2,3,3,1,3,2,2,3,3,2,3,2,8,2,2,1,2,2,6,2,3,3,3,3,10,TRUE,0,83,TRUE,1,82,FALSE,1,63,TRUE,0,83,TRUE,1,80,TRUE,0,93,TRUE,1,78,TRUE,1,85,FALSE,0,58,TRUE,1,64,TRUE,0,55,TRUE,0,78,FALSE,0,56,TRUE,0,59,TRUE,1,61,TRUE,1,59,TRUE,0,55,FALSE,1,76,TRUE,0,54,TRUE,0,58,TRUE,1,57,TRUE,1,59,TRUE,0,57,TRUE,1,61,FALSE,1,85,FALSE,0,65,TRUE,0,55,TRUE,0,73,FALSE,1,83,FALSE,0,70,TRUE,1,68,TRUE,1,62,0.0225,0.4225,0.1681,0.0484,0.1444,0.8649,0.1521,0.1296,0.3364,0.1681,0.49,0.3136,0.3364,0.3025,0.04,0.0324,0.3249,0.6889,0.5329,0.0225,0.1849,0.1521,0.2916,0.3481,0.3025,0.3025,0.1024,0.6889,0.1369,0.0576,0.0289,0.6084,0.288728571,0.308871429,0.268585714,20,62.5,16,50,3,37.5,4,50,5,62.5,4,50,12,75,4,25,67.97,64.5,67.88,71.12,68.38,66.56,69.38,12.5,17.97,27,17.88,8.62,18.38,-8.44,44.38,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0.2,0.8,0.6,0.6,0.6,0.6,0.6,0.4,0.55,0.55,0.55,5.33,5.33,5.5,-0.4,0.2,0,0.2,-0.066666667,4,-4,0,-8,0,1,1,2,1,-1,1,-1,2,-2,1,-1,2,5 cents,100 minutes,24 days,Male,University - Graduate (Masters),30,"No, thank you.",0.125,1,0,0,0,1,1,0.33,0.67,03VLPfPs,02COC,01PAST,01ITEM,01DIR,6,9,7,2,4,5,8,1,3,4,2,3,1 +840,R_3QilYYtmKHDOMlb,32 - 38,American,,American,Male,Agree,Strongly agree,Agree,Strongly agree,Agree,3,5,4,1,2,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,3,4,5,Agree,Somewhat agree,Agree,Somewhat agree,Strongly Agree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Agree,Agree,Strongly Agree,Somewhat agree,1,2,5,4,3,8,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,10,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,5,1,4,3,2,8,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,2,5,3,1,5,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,1,3,5,4,2,5,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,3,5,1,4,2,8,Agree,Agree,Strongly Agree,Agree,Strongly Agree,2,1,5,3,4,TRUE,76,TRUE,100,TRUE,77,FALSE,84,TRUE,100,FALSE,95,FALSE,89,TRUE,100,TRUE,100,TRUE,100,FALSE,79,TRUE,87,TRUE,100,FALSE,79,TRUE,82,TRUE,100,TRUE,100,TRUE,88,FALSE,96,FALSE,100,FALSE,88,FALSE,93,FALSE,81,TRUE,65,FALSE,100,TRUE,90,FALSE,76,TRUE,100,TRUE,97,TRUE,100,FALSE,100,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,2,3,1,3,0,0,3,3,3,2,3,2,1,2,1,3,-1,2,2,3,1,5,1,3,1,0,0,8,-1,1,-1,0,-1,10,1,3,2,3,3,8,3,3,3,3,1,7,3,0,3,0,2,5,3,2,3,2,3,5,2,2,3,2,3,8,TRUE,0,76,TRUE,1,100,TRUE,0,77,FALSE,1,84,TRUE,1,100,FALSE,1,95,FALSE,0,89,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,79,TRUE,0,87,TRUE,1,100,FALSE,1,79,TRUE,1,82,TRUE,1,100,TRUE,0,100,TRUE,0,88,FALSE,1,96,FALSE,1,100,FALSE,0,88,FALSE,0,93,FALSE,1,81,TRUE,1,65,FALSE,1,100,TRUE,1,90,FALSE,1,76,TRUE,0,100,TRUE,0,97,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.01,0,0.7921,0,0.0025,0.1225,0,0,0.8649,0,0,0,0.0441,0,0,0.0361,0.0256,1,0,0.7744,0.0324,0.0016,0.0441,1,0.0576,1,0.5776,0.5929,0.7744,0.9409,0.7569,0.308875,0.078264286,0.539485714,28,87.5,21,65.63,7,87.5,5,62.5,4,50,5,62.5,12,75,9,56.25,91.31,89.62,95.12,89.38,91.12,94.19,88.44,21.87,25.68,2.12,32.62,39.38,28.62,19.19,32.19,3,1,0,0,1,2,2,2,0,0,4,2,4,2,4,1,2,0,2,0,1,0,1,0,1,0,1,0,0,2,0,1,0,0,0,0,1,1,1,0,1,1.2,3.2,1,0.6,0.6,0.2,0.6,1.6,0.5,1.05,7.67,5.67,7,0.4,0.6,3,0.4,1.333333333,-2,3,5,0,2,1,2,2,-1,1,0,0,0,0,-1,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,it was a useful survey,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,6,4,7,3,9,8,5,1,2,4,2,3,1 +841,R_5ZIfIu4LYO9gDKY,39 - 45,American,,American,Male,Agree,Agree,Agree,Agree,Agree,2,3,1,5,4,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,3,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,2,5,3,4,Agree,Agree,Somewhat agree,Somewhat agree,Agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Agree,Agree,Strongly Agree,Agree,4,2,1,3,5,9,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,3,1,8,Somewhat Agree,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,1,5,2,3,4,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Strongly Agree,Strongly Agree,1,3,2,5,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,9,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,4,2,1,8,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Agree,3,1,4,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,82,TRUE,87,TRUE,87,TRUE,87,TRUE,83,TRUE,71,TRUE,74,TRUE,90,TRUE,75,TRUE,78,TRUE,88,TRUE,84,TRUE,81,TRUE,85,TRUE,80,TRUE,81,TRUE,87,TRUE,78,TRUE,82,TRUE,85,TRUE,80,TRUE,78,TRUE,81,TRUE,85,TRUE,86,TRUE,88,TRUE,78,TRUE,78,TRUE,87,TRUE,82,TRUE,87,TRUE,86,28,2,2,2,2,2,1,3,1,1,1,3,2,3,3,2,2,2,1,1,2,3,2,2,3,2,8,1,1,1,1,1,9,1,1,2,3,1,8,3,3,3,3,3,8,1,1,1,3,3,7,1,1,1,1,1,7,1,1,1,1,1,9,3,3,0,3,2,8,TRUE,0,86,TRUE,1,87,TRUE,0,82,TRUE,0,87,TRUE,1,78,TRUE,0,78,TRUE,1,88,TRUE,1,86,TRUE,1,85,TRUE,1,81,TRUE,0,78,TRUE,0,80,TRUE,1,85,TRUE,0,82,TRUE,1,78,TRUE,1,87,TRUE,0,81,TRUE,0,80,TRUE,0,85,TRUE,0,81,TRUE,1,84,TRUE,1,88,TRUE,0,78,TRUE,1,75,TRUE,0,90,TRUE,1,74,TRUE,0,71,TRUE,0,83,TRUE,0,87,TRUE,1,87,TRUE,1,87,TRUE,1,82,0.0196,0.0676,0.0169,0.0144,0.0324,0.6084,0.0625,0.0361,0.6561,0.0144,0.0169,0.0225,0.0225,0.6084,0.0484,0.0169,0.6084,0.7569,0.6889,0.81,0.0256,0.0484,0.7225,0.6724,0.6561,0.5041,0.0169,0.7396,0.6724,0.64,0.7569,0.64,0.396592857,0.250771429,0.542414286,28,87.5,16,50,4,50,4,50,4,50,4,50,16,100,0,0,82.53,82.25,81.62,83.62,82.62,83.25,81.81,37.5,32.53,32.25,31.62,33.62,32.62,-16.75,81.81,1,0,0,1,0,0,2,0,0,0,2,1,1,0,1,1,1,2,2,1,1,1,1,1,1,0,2,0,0,0,2,1,2,2,1,1,1,1,2,0,0.4,0.4,1,1.4,1,0.4,1.6,1,0.8,1,0.9,8.33,7.67,8,-0.6,0,-0.6,0.4,-0.4,1,2,-1,0,0.66,2,2,1,1,-1,1,-1,1,-1,1,-1,1,5 cents,25 minutes,15 days,Male,University - Graduate (Masters),42,well,0.25,1,0,0,0,0,0,0.33,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,7,4,6,2,8,9,3,1,5,3,4,2,1 +842,R_1UbbhiHgu7q1d7S,25 - 31,American,,American,Male,Somewhat disagree,Agree,Agree,Somewhat agree,Somewhat agree,4,2,1,5,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,5,1,4,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,2,1,3,4,5,Somewhat agree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Agree,4,5,3,1,2,Agree,Agree,Agree,Disagree,Agree,3,1,2,4,5,8,Agree,Neither agree nor disagree,Disagree,Somewhat disagree,Disagree,2,5,4,1,3,8,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,5,3,1,2,4,8,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,1,4,3,5,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,4,3,1,5,2,7,Agree,Disagree,Somewhat agree,Somewhat disagree,Agree,1,4,5,2,3,9,Agree,Agree,Somewhat Agree,Agree,Agree,3,2,5,1,4,8,Somewhat agree,Somewhat agree,Agree,Agree,Agree,5,4,3,1,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,TRUE,75,TRUE,85,FALSE,61,FALSE,91,FALSE,89,TRUE,86,FALSE,92,FALSE,73,FALSE,91,TRUE,87,TRUE,81,FALSE,65,FALSE,91,FALSE,91,FALSE,81,TRUE,95,TRUE,87,FALSE,74,TRUE,92,TRUE,67,FALSE,75,TRUE,99,TRUE,98,TRUE,100,TRUE,69,FALSE,99,TRUE,98,FALSE,98,TRUE,75,TRUE,73,FALSE,87,24,-1,2,2,1,1,0,-1,1,0,1,2,0,2,0,2,1,0,3,0,2,2,2,2,-2,2,8,2,0,-2,-1,-2,8,2,1,1,1,2,8,0,-1,2,1,0,8,-1,1,1,-1,2,7,2,-2,1,-1,2,9,2,2,1,2,2,8,1,1,2,2,2,8,FALSE,1,87,TRUE,1,73,TRUE,0,75,FALSE,1,98,TRUE,1,98,FALSE,1,99,TRUE,1,69,TRUE,1,100,TRUE,1,98,TRUE,1,99,FALSE,1,75,TRUE,0,67,TRUE,1,92,FALSE,1,74,TRUE,1,87,TRUE,1,95,FALSE,1,81,FALSE,1,91,FALSE,1,91,FALSE,1,65,TRUE,1,81,TRUE,1,87,FALSE,1,91,FALSE,0,73,FALSE,1,92,TRUE,1,86,FALSE,1,89,FALSE,1,91,FALSE,1,61,TRUE,1,85,TRUE,1,75,TRUE,1,91,0,0.0196,0.0025,0.0961,0.0081,0.0001,0.5329,0.0001,0.1225,0.0169,0.0225,0.0064,0.0004,0.0625,0.0004,0.0729,0.0081,0.0004,0.0081,0.0064,0.0361,0.0169,0.0081,0.0676,0.0361,0.0121,0.0625,0.0169,0.5625,0.0081,0.1521,0.4489,0.082021429,0.061014286,0.103028571,24,75,29,90.63,8,100,8,100,8,100,5,62.5,15,93.75,14,87.5,84.88,85.75,86.75,85.62,81.38,86.81,82.94,-15.63,-5.75,-14.25,-13.25,-14.38,18.88,-6.94,-4.56,3,0,0,3,1,2,1,3,1,3,0,1,1,1,0,1,1,1,1,2,0,1,1,2,1,2,1,0,1,1,0,2,1,2,0,0,1,1,2,0,1.4,2,0.6,1.2,1,1,1,0.8,1.3,0.95,1.125,8,8,8,0.4,1,-0.4,0.4,0.333333333,1,-1,0,0,0,1,2,1,0,0,0,0,0,0,-1,1,2,5 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),27,,0.875,1,0,0,0,1,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,3,5,9,4,7,6,2,1,8,2,3,4,1 +843,R_1hG7SPwTVGonzr7,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,5,1,3,4,2,Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,1,2,5,3,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,3,4,2,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,4,3,3,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,1,5,4,2,3,1,Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,4,5,2,2,Somewhat agree,Somewhat agree,Agree,Strongly Agree,Agree,3,4,5,1,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,3,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,3,Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,2,1,3,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,1,2,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,81,TRUE,91,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,97,FALSE,100,TRUE,93,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,78,FALSE,96,TRUE,100,FALSE,100,TRUE,97,TRUE,100,29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,0,3,1,3,2,-3,3,0,3,-1,1,-1,1,0,3,3,3,3,3,3,3,0,3,2,3,1,2,-3,3,0,3,2,1,1,2,3,2,8,3,3,3,3,3,3,3,0,3,3,3,3,2,-3,3,0,3,2,-3,-3,-3,-3,-3,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,81,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,97,FALSE,1,100,TRUE,1,93,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,78,FALSE,1,96,TRUE,0,100,FALSE,0,100,TRUE,1,97,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,0.0009,0,0,0.0081,0,0,0.0361,0.0016,0,0,0.0049,0,0,1,0.6084,0.0009,0,1,1,1,1,0.237889286,0.07465,0.401128571,29,90.63,25,78.13,7,87.5,6,75,7,87.5,5,62.5,15,93.75,10,62.5,97.91,93.62,98.5,100,99.5,98.62,97.19,12.5,19.78,6.12,23.5,12.5,37,4.87,34.69,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,3,2,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,4,2,4,3,0,0.2,0,1.8,0,0.4,0,3,0.5,0.85,0.675,2,2.67,4,0,-0.2,0,-1.2,-0.066666667,0,-2,0,-2,-0.67,2,2,2,-2,2,0,0,0,0,-2,2,1,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,34,I'm terrible at math lol,1.375,0,0,0,1,0,1,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,6,7,5,2,8,4,9,1,3,3,2,4,1 +844,R_7VC9MkNQAU53tAJ,25 - 31,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,1,3,5,4,2,Agree,Neither agree nor disagree,Strongly agree,Disagree,Strongly agree,2,4,5,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,5,3,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,2,1,Strongly disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,2,3,1,5,4,9,Strongly disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,4,5,2,3,1,9,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,4,3,5,1,8,Disagree,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly Agree,3,1,5,4,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Somewhat agree,1,2,5,4,3,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,4,5,1,5,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,2,4,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,3,4,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,90,TRUE,95,TRUE,100,FALSE,52,FALSE,52,FALSE,100,TRUE,100,FALSE,61,TRUE,55,TRUE,96,FALSE,52,TRUE,100,TRUE,80,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,69,FALSE,50,TRUE,100,TRUE,73,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,79,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,0,2,0,3,-2,3,0,0,3,0,3,2,3,3,3,3,-3,3,3,-3,-3,9,-3,0,-3,1,-3,9,3,-3,3,-3,3,8,-2,-3,-1,-3,3,10,0,3,0,3,1,4,3,-3,3,-3,3,5,0,3,3,1,3,4,3,3,3,3,3,4,FALSE,1,90,TRUE,1,95,TRUE,0,100,FALSE,1,52,FALSE,0,52,FALSE,1,100,TRUE,1,100,FALSE,0,61,TRUE,1,55,TRUE,1,96,FALSE,1,52,TRUE,0,100,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,50,TRUE,1,69,FALSE,1,50,TRUE,1,100,TRUE,0,73,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,79,TRUE,1,100,0.3721,0,0.25,0,0,0,0,0.0016,0.25,0.0961,0.25,0.04,0.2025,0.2304,0.2704,0.0025,0.25,0.2304,0.25,0.5329,0.25,0.25,1,0.25,0.25,0.25,0.0441,0.01,1,1,0.25,1,0.291460714,0.130278571,0.452642857,16,50,22,68.75,6,75,6,75,6,75,4,50,11,68.75,11,68.75,72,66.62,66.5,84.75,70.12,74.19,69.81,-18.75,3.25,-8.38,-8.5,9.75,20.12,5.44,1.06,5,0,1,6,3,5,0,6,3,6,3,3,0,3,0,4,6,4,6,0,2,0,2,0,1,1,3,0,1,0,0,3,0,1,0,1,0,0,0,0,3,4,1.8,4,1,1,0.8,0.2,3.2,0.75,1.975,8.67,4.33,6.625,2,3,1,3.8,2,5,4,4,6,4.34,0,2,0,-2,2,2,-2,-2,2,-2,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,It was a very engaging survey not what I expected at all,1,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,7,8,3,5,9,2,6,1,4,4,2,3,1 +845,R_5lPlbGTB3MWad44,18 - 24,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,5,1,3,4,2,Agree,Disagree,Somewhat agree,Disagree,Strongly agree,1,4,3,2,5,Somewhat Agree,Disagree,Agree,Somewhat Agree,Strongly Agree,4,1,5,2,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,3,1,4,2,5,Agree,Strongly Agree,Strongly Agree,Strongly disagree,Agree,1,4,3,2,5,0,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,2,5,3,1,4,1,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,5,3,2,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,2,1,5,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,1,2,5,4,3,1,Agree,Disagree,Agree,Strongly disagree,Strongly agree,2,3,5,1,4,2,Somewhat Agree,Somewhat Disagree,Agree,Agree,Strongly Agree,1,3,5,4,2,2,Agree,Agree,Agree,Agree,Somewhat agree,4,2,5,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,FALSE,67,FALSE,95,TRUE,90,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,60,TRUE,65,FALSE,100,TRUE,95,TRUE,100,TRUE,96,FALSE,100,TRUE,95,TRUE,95,TRUE,90,TRUE,99,TRUE,100,TRUE,100,TRUE,100,FALSE,97,TRUE,100,FALSE,58,TRUE,75,FALSE,80,TRUE,100,25,2,3,3,-1,2,2,-2,1,-2,3,1,-2,2,1,3,-1,-1,1,1,2,2,3,3,-3,2,0,2,-3,2,-3,3,1,2,1,1,0,3,2,3,3,3,1,3,3,2,3,3,1,3,1,2,-2,2,-3,3,2,1,-1,2,2,3,2,2,2,2,2,1,8,TRUE,0,100,FALSE,0,80,TRUE,0,75,FALSE,1,58,TRUE,1,100,FALSE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,0,90,TRUE,0,95,TRUE,1,95,FALSE,1,100,TRUE,1,96,TRUE,1,100,TRUE,0,95,FALSE,1,100,TRUE,0,65,FALSE,1,60,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,90,FALSE,0,95,FALSE,0,67,TRUE,1,99,0,0,0,0,0.0001,0.0009,0,0.0001,0.16,0,0.9025,0.0025,0,0.81,0,0.64,0,0.1764,0,0,0,0.0016,0.4225,0,0.9025,0.25,0.4489,1,0.5625,0,0.81,0.9025,0.285464286,0.192321429,0.378607143,25,78.13,21,65.63,3,37.5,6,75,7,87.5,5,62.5,13,81.25,8,50,90.81,75.75,97,99.88,90.62,95.69,85.94,12.5,25.18,38.25,22,12.38,28.12,14.44,35.94,0,0,0,2,0,0,1,1,1,0,1,3,1,1,0,4,4,2,0,1,0,0,0,2,1,0,0,1,1,0,0,1,0,1,0,3,3,1,1,1,0.4,0.6,1.2,2.2,0.6,0.4,0.4,1.8,1.1,0.8,0.95,1,1.67,2.375,-0.2,0.2,0.8,0.4,0.266666667,-1,-1,0,-5,-0.67,0,2,2,-2,2,0,0,2,-2,-2,2,2,10 cents,100 minutes,47 days,Male,University - Undergraduate,24,,1,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,7,9,4,3,5,8,1,6,2,3,4,1 +846,R_12KBIr7QMRhgQ9J,18 - 24,American,,American,Male,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,Agree,4,5,1,2,3,Agree,Somewhat agree,Disagree,Somewhat disagree,Neither agree nor disagree,1,2,4,5,3,Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,4,5,3,1,2,Somewhat disagree,Agree,Disagree,Somewhat agree,Neither agree nor disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat disagree,5,2,4,1,3,8,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,2,3,1,4,5,3,Somewhat Disagree,Somewhat Disagree,Disagree,Disagree,Somewhat Agree,3,4,2,1,5,3,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat agree,Agree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,2,3,4,1,5,4,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Agree,1,3,2,5,4,5,Agree,Somewhat Disagree,Somewhat Agree,Strongly agree,Somewhat Agree,4,1,2,5,3,6,Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,2,3,4,1,5,TRUE,100,FALSE,100,FALSE,100,TRUE,52,TRUE,79,FALSE,54,TRUE,90,TRUE,77,TRUE,100,TRUE,100,TRUE,80,TRUE,52,TRUE,100,FALSE,100,FALSE,59,TRUE,100,FALSE,58,TRUE,100,TRUE,100,FALSE,55,FALSE,54,FALSE,54,FALSE,100,TRUE,100,TRUE,64,TRUE,100,FALSE,62,FALSE,59,TRUE,100,FALSE,100,FALSE,63,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,0,1,2,2,1,-2,-1,0,2,3,1,-1,0,-1,2,-2,1,0,1,-2,0,-3,-1,4,2,0,2,0,-1,8,-1,-1,-2,-2,1,3,0,-1,-2,1,2,3,-1,0,1,-2,2,6,-1,1,0,-1,2,4,2,-1,1,3,1,5,2,3,3,2,1,6,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,0,52,TRUE,1,79,FALSE,1,54,TRUE,1,90,TRUE,1,77,TRUE,1,100,TRUE,1,100,TRUE,0,80,TRUE,0,52,TRUE,1,100,FALSE,1,100,FALSE,0,59,TRUE,1,100,FALSE,1,58,TRUE,0,100,TRUE,0,100,FALSE,1,55,FALSE,0,54,FALSE,0,54,FALSE,1,100,TRUE,1,100,TRUE,0,64,TRUE,1,100,FALSE,1,62,FALSE,1,59,TRUE,0,100,FALSE,0,100,FALSE,0,63,TRUE,1,100,0.0529,0,0,0.01,0,0.2116,0,0,0.2025,0.2916,1,0,0,0.64,0.0441,1,0,0.2704,0.1681,0.4096,0.2916,0.3481,1,0,0.1764,0.1444,0.3969,1,0,1,1,0.2704,0.352346429,0.261442857,0.44325,22,68.75,18,56.25,2,25,6,75,4,50,6,75,10,62.5,8,50,81.62,77,80.62,88.5,80.38,86,77.25,12.5,25.37,52,5.62,38.5,5.38,23.5,27.25,2,4,0,4,3,0,1,4,1,1,3,4,3,1,1,1,3,0,0,2,4,2,1,3,0,3,0,2,0,2,0,4,0,4,1,3,1,5,1,1,2.6,1.4,2.4,1.2,2,1.4,1.8,2.2,1.9,1.85,1.875,5,5,4.875,0.6,0,0.6,-1,0.4,-2,4,-2,-3,0,-1,0,1,2,-2,-1,1,2,-2,1,-1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,,-0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,7,9,6,2,3,8,5,1,4,4,2,3,1 +847,R_3O6paGKu9Eu6TGz,18 - 24,American,,American,Male,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,4,2,3,5,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly agree,4,2,3,5,1,Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,5,3,1,2,4,Disagree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,Somewhat disagree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,3,1,5,4,2,1,Neither agree nor disagree,Disagree,Somewhat disagree,Somewhat agree,Agree,2,4,1,5,3,1,Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,2,1,4,3,5,3,Somewhat disagree,Somewhat agree,Strongly Agree,Somewhat agree,Disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,3,4,2,5,1,1,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Strongly agree,5,1,2,4,3,1,Strongly Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,3,1,2,4,5,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,4,3,2,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,55,FALSE,90,FALSE,80,FALSE,60,TRUE,90,TRUE,50,TRUE,60,FALSE,90,TRUE,75,TRUE,50,TRUE,50,TRUE,95,FALSE,50,TRUE,75,TRUE,60,TRUE,50,TRUE,50,TRUE,50,TRUE,55,FALSE,70,TRUE,90,FALSE,50,TRUE,60,TRUE,90,TRUE,55,TRUE,75,TRUE,50,TRUE,50,TRUE,50,TRUE,60,TRUE,50,FALSE,60,24,1,2,0,0,3,-1,-1,-1,-1,3,-2,-3,3,-2,3,-2,0,3,-1,-1,-1,1,1,0,2,2,0,-2,-1,1,2,1,-2,-3,2,-2,3,1,-1,1,3,1,-2,3,1,2,0,0,3,1,0,-1,-1,0,3,1,-3,-3,3,-3,3,1,0,1,2,1,-1,5,FALSE,1,60,TRUE,1,50,TRUE,0,60,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,75,TRUE,1,55,TRUE,1,90,TRUE,1,60,FALSE,1,50,TRUE,0,90,FALSE,0,70,TRUE,0,55,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,60,TRUE,0,75,FALSE,1,50,TRUE,1,95,TRUE,1,50,TRUE,0,50,TRUE,1,75,FALSE,1,90,TRUE,1,60,TRUE,0,50,TRUE,0,90,FALSE,1,60,FALSE,0,80,FALSE,0,90,TRUE,1,55,0.2025,0.16,0.25,0.0625,0.2025,0.25,0.0625,0.16,0.25,0.25,0.64,0.49,0.01,0.25,0.25,0.25,0.25,0.25,0.81,0.01,0.0025,0.25,0.5625,0.3025,0.25,0.25,0.81,0.16,0.36,0.36,0.16,0.81,0.309375,0.254642857,0.364107143,24,75,18,56.25,4,50,4,50,6,75,4,50,13,81.25,5,31.25,63.91,63.12,60,63.75,68.75,65.94,61.88,18.75,7.66,13.12,10,-11.25,18.75,-15.31,30.63,2,1,1,0,1,1,1,0,2,1,0,0,1,0,0,1,1,0,2,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,2,1,1,2,0,1,1,0.2,1,0,0.4,0.4,1.2,0.8,0.5,0.65,1.33,1,1.875,1,0.6,-0.2,-0.2,0.466666667,1,0,0,-2,0.33,1,2,1,0,0,1,-1,0,0,-2,2,1,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,,0.75,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,02REV,2,5,4,3,9,6,7,1,8,4,3,2,1 +848,R_19b31cGhKIE1KVF,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,1,3,2,4,Somewhat agree,Agree,Strongly agree,Disagree,Strongly agree,3,1,4,2,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,3,5,2,4,1,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,1,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,0,Strongly agree,Strongly disagree,Somewhat agree,Disagree,Strongly agree,2,4,3,5,1,2,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,5,1,2,0,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Agree,4,2,1,3,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,5,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,3,2,4,0,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,5,4,2,1,3,7,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,4,2,5,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,95,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,100,FALSE,90,TRUE,100,FALSE,50,TRUE,94,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,50,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,2,1,2,3,-2,3,3,1,2,-1,3,2,1,0,0,-2,3,3,3,3,3,0,3,-3,1,-2,3,2,3,1,2,0,3,0,-1,1,-1,-1,2,2,3,2,3,3,3,1,3,-3,3,-3,3,0,3,0,2,1,3,7,2,3,0,3,-1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,100,FALSE,1,90,TRUE,0,100,FALSE,0,50,TRUE,0,94,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,50,TRUE,0,100,FALSE,0,50,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0.25,0.25,0.25,0.01,0.01,0,0,0.25,0.0025,0.25,0,0,0,0.25,0.8836,0,0,0.25,0,1,0,1,1,0.210932143,0.090892857,0.330971429,28,87.5,23,71.88,7,87.5,6,75,6,75,4,50,13,81.25,10,62.5,86.53,84.38,87.5,93,81.25,86.88,86.19,15.62,14.65,-3.12,12.5,18,31.25,5.63,23.69,0,0,0,1,1,2,5,2,0,0,0,0,0,1,0,3,0,1,1,4,0,1,0,1,1,2,5,0,1,0,0,1,0,2,0,0,2,0,3,1,0.4,1.8,0.2,1.8,0.6,1.6,0.6,1.2,1.05,1,1.025,0.67,2.67,2.5,-0.2,0.2,-0.4,0.6,-0.133333333,-1,2,-7,-6,-2,1,2,2,-2,2,2,-2,2,-2,-2,2,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,30,The survey is positive in many aspects,0.75,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,4,8,7,2,5,6,3,1,9,2,3,4,1 +849,R_3BAOztTRoiGCqad,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,2,4,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,1,2,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,4,2,3,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,1,3,5,2,4,Agree,Agree,Agree,Agree,Agree,5,2,1,4,3,6,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Agree,2,5,4,1,3,9,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,3,5,2,1,8,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,3,4,2,1,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,1,3,9,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,3,5,4,2,1,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,10,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Disagree,2,4,3,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,82,TRUE,82,TRUE,80,FALSE,88,TRUE,100,TRUE,64,TRUE,82,TRUE,76,TRUE,80,TRUE,76,TRUE,74,TRUE,99,TRUE,71,FALSE,100,TRUE,87,TRUE,82,FALSE,92,FALSE,86,TRUE,83,TRUE,87,FALSE,92,TRUE,85,TRUE,99,FALSE,82,TRUE,78,FALSE,94,TRUE,86,TRUE,86,TRUE,86,TRUE,86,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,-3,3,-3,3,3,2,3,3,2,3,3,3,3,-1,2,2,2,2,2,6,1,1,3,-2,2,9,1,1,1,1,0,8,2,3,3,1,2,9,3,3,3,3,3,9,1,-3,2,-3,3,9,3,3,3,3,3,10,0,3,3,2,-2,8,TRUE,0,100,TRUE,1,100,TRUE,0,82,TRUE,0,82,TRUE,1,80,FALSE,1,88,TRUE,1,100,TRUE,1,64,TRUE,1,82,TRUE,1,76,TRUE,0,80,TRUE,0,76,TRUE,1,74,TRUE,0,99,TRUE,1,71,FALSE,0,100,TRUE,0,87,TRUE,0,82,FALSE,1,92,FALSE,1,86,TRUE,1,83,TRUE,1,87,FALSE,1,92,TRUE,1,85,TRUE,0,99,FALSE,0,82,TRUE,0,78,FALSE,1,94,TRUE,0,86,TRUE,1,86,TRUE,1,86,TRUE,1,86,0.1296,0.6724,1,0,0.0196,0.0144,0.0225,0.0576,0.0196,0.0169,0.0196,0.0676,0.0324,0.64,0.04,0,0.0064,0.6724,0.0036,0.9801,0.0289,0.0841,0.0064,0.9801,0.7569,0.6084,0.0196,1,0.6724,0.6724,0.7396,0.5776,0.312825,0.116357143,0.509292857,17,53.13,19,59.38,5,62.5,6,75,3,37.5,5,62.5,14,87.5,5,31.25,85.78,83.88,84.5,90.62,84.12,83.88,87.69,-6.25,26.4,21.38,9.5,53.12,21.62,-3.62,56.44,1,1,1,1,1,2,4,0,1,1,2,1,2,2,2,1,0,0,2,3,0,0,0,0,0,2,0,1,0,0,0,1,0,0,1,3,0,0,1,1,1,1.6,1.8,1.2,0,0.6,0.4,1,1.4,0.5,0.95,7.67,9.33,8.5,1,1,1.4,0.2,1.133333333,-3,0,-2,1,-1.66,1,2,1,2,-2,2,-2,2,-2,2,-2,1,5 cents,100 minutes,24 days,Male,University - Undergraduate,40,,-0.375,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,8,6,5,2,4,9,7,1,3,3,2,4,1 +850,R_1vL5akX2XeXP55L,25 - 31,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,5,4,2,3,1,Disagree,Somewhat agree,Somewhat agree,Strongly agree,Agree,2,4,3,5,1,Agree,Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,3,1,4,5,Disagree,Agree,Disagree,Disagree,Somewhat disagree,4,5,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Strongly Agree,Agree,Somewhat disagree,Agree,1,5,4,3,2,9,Disagree,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,1,4,3,5,9,Agree,Disagree,Agree,Agree,Strongly Agree,3,2,1,4,5,7,Disagree,Agree,Disagree,Somewhat disagree,Somewhat disagree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Agree,Agree,Agree,1,3,2,5,4,7,Disagree,Somewhat agree,Agree,Agree,Strongly agree,4,3,5,2,1,3,Agree,Disagree,Strongly agree,Agree,Strongly agree,5,2,1,4,3,8,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,54,TRUE,100,TRUE,100,TRUE,90,TRUE,97,TRUE,100,TRUE,75,TRUE,100,TRUE,97,TRUE,100,TRUE,61,FALSE,50,TRUE,88,TRUE,100,TRUE,52,TRUE,100,FALSE,51,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,56,TRUE,100,TRUE,90,FALSE,100,28,3,3,1,1,2,-2,1,1,3,2,2,-2,3,1,3,-2,2,-2,-2,-1,2,3,2,-1,2,9,-2,-1,0,2,0,9,2,-2,2,2,3,9,-2,2,-2,-1,-1,7,3,3,2,2,2,7,-2,1,2,2,3,7,2,-2,3,2,3,3,-1,-1,0,1,1,8,FALSE,1,100,TRUE,1,90,TRUE,0,100,FALSE,1,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,51,TRUE,1,100,TRUE,0,52,TRUE,0,100,TRUE,0,88,FALSE,1,50,TRUE,1,61,TRUE,1,100,TRUE,0,97,TRUE,1,100,TRUE,0,75,TRUE,1,100,TRUE,0,97,TRUE,0,90,TRUE,0,100,TRUE,1,100,TRUE,1,54,TRUE,1,100,0,0,0,0,0,0,0,0,0.25,0,0,0,0.25,0.25,0,0.01,0.9409,0.1936,0.81,0.5625,0.1521,0.2601,0.7744,0,0.2704,0.9409,0.2116,0,1,1,1,1,0.352732143,0.135321429,0.570142857,28,87.5,21,65.63,5,62.5,5,62.5,6,75,5,62.5,15,93.75,6,37.5,86.28,67,88.75,96.88,92.5,87.88,84.69,21.87,20.65,4.5,26.25,21.88,30,-5.87,47.19,1,0,1,2,0,0,2,1,1,2,0,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,3,2,3,2,0.8,1.2,0.4,0.2,0.4,0.6,0.2,2.2,0.65,0.85,0.75,9,5.67,7.375,0.4,0.6,0.2,-2,0.4,2,2,6,-1,3.33,0,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,31,I do not have feedback,1.375,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,9,7,3,8,6,5,4,1,2,4,3,2,1 +851,R_51dYvxwyn1qXXSF,25 - 31,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Strongly disagree,Neither agree nor disagree,2,1,3,4,5,Strongly disagree,Somewhat disagree,Agree,Agree,Somewhat agree,3,5,2,1,4,Agree,Disagree,Agree,Disagree,Strongly Agree,2,5,1,4,3,Neither agree nor disagree,Somewhat agree,Strongly disagree,Strongly disagree,Neither agree nor disagree,4,2,3,5,1,Strongly Agree,Strongly Agree,Agree,Strongly disagree,Neither agree nor disagree,3,2,4,1,5,7,Strongly disagree,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,3,4,2,5,1,6,Strongly Agree,Strongly Disagree,Strongly Disagree,Disagree,Strongly Agree,3,5,2,4,1,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,3,1,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Strongly disagree,Somewhat agree,1,4,3,5,2,3,Strongly disagree,Somewhat disagree,Agree,Somewhat agree,Agree,2,1,4,3,5,5,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,1,4,3,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,2,4,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,82,FALSE,50,TRUE,63,FALSE,50,TRUE,56,FALSE,56,TRUE,58,TRUE,76,FALSE,72,TRUE,57,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,57,FALSE,50,FALSE,74,TRUE,69,FALSE,50,TRUE,64,FALSE,50,FALSE,74,FALSE,50,FALSE,50,FALSE,50,FALSE,59,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,-3,0,-3,-1,2,2,1,2,-2,2,-2,3,0,1,-3,-3,0,3,3,2,-3,0,7,-3,-3,1,3,-3,6,3,-3,-3,-2,3,3,-3,-3,-3,-3,-3,8,1,2,2,-3,1,3,-3,-1,2,1,2,5,2,-3,3,-3,3,3,1,1,1,1,1,7,TRUE,0,82,FALSE,0,50,TRUE,0,63,FALSE,1,50,TRUE,1,56,FALSE,1,56,TRUE,1,58,TRUE,1,76,FALSE,0,72,TRUE,1,57,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,57,FALSE,0,50,FALSE,1,74,TRUE,1,69,FALSE,1,50,TRUE,1,64,FALSE,1,50,FALSE,1,74,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,59,0.0576,0.1296,0.25,0.1764,0.3481,0.1936,0.0961,0.1849,0.25,0.25,0.25,0.25,0.5184,0.25,0.1936,0.25,0.0676,0.25,0.0676,0.25,0.3249,0.25,0.25,0.25,0.25,0.25,0.25,0.6724,0.3969,0.25,0.25,0.25,0.261217857,0.23945,0.282985714,5,15.63,20,62.5,4,50,5,62.5,6,75,5,62.5,6,37.5,14,87.5,56.78,52.75,56.5,57.62,60.25,57.38,56.19,-46.87,-5.72,2.75,-6,-17.38,-2.25,19.88,-31.31,1,0,0,0,0,0,2,1,1,4,1,1,5,0,0,3,4,0,0,3,1,1,0,0,1,0,0,0,1,1,0,1,1,1,0,1,0,4,4,1,0.2,1.6,1.4,2,0.6,0.4,0.6,2,1.3,0.9,1.1,5.33,3.67,5.25,-0.4,1.2,0.8,0,0.533333333,4,1,0,1,1.66,0,2,2,-2,2,0,0,-2,2,-2,2,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,25,,1.375,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,9,3,4,6,8,7,5,1,2,3,4,2,1 +852,R_1guzVEXB7Tff2yU,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,Strongly agree,4,5,3,1,2,Somewhat agree,Agree,Strongly agree,Agree,Strongly agree,4,1,5,2,3,Strongly Agree,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,3,1,4,Somewhat agree,Strongly Agree,Agree,Agree,Somewhat disagree,1,3,5,2,4,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,4,5,2,1,7,Disagree,Strongly agree,Somewhat disagree,Strongly agree,Disagree,5,4,2,1,3,8,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,Strongly Agree,1,4,5,3,2,7,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,2,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat disagree,Strongly Agree,2,4,3,1,5,2,Agree,Disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,4,5,2,Strongly Agree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,3,4,2,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,3,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,64,TRUE,50,TRUE,100,TRUE,58,TRUE,100,FALSE,58,TRUE,90,TRUE,90,TRUE,50,TRUE,96,TRUE,51,TRUE,64,TRUE,68,FALSE,71,FALSE,51,TRUE,100,TRUE,70,TRUE,74,TRUE,50,FALSE,51,TRUE,64,TRUE,54,TRUE,60,TRUE,100,FALSE,100,TRUE,81,TRUE,50,TRUE,63,TRUE,100,TRUE,87,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-1,1,3,1,2,3,2,3,3,-2,3,3,3,1,3,2,2,-1,3,3,2,2,3,7,-2,3,-1,3,-2,8,3,3,-1,3,3,7,-3,-1,-3,-3,-3,9,3,3,-1,-1,3,2,2,-2,3,1,3,2,3,-2,3,-1,3,1,3,3,3,3,3,4,FALSE,1,64,TRUE,1,50,TRUE,0,100,TRUE,0,58,TRUE,1,100,FALSE,1,58,TRUE,1,90,TRUE,1,90,TRUE,1,50,TRUE,1,96,TRUE,0,51,TRUE,0,64,TRUE,1,68,FALSE,1,71,FALSE,0,51,TRUE,1,100,TRUE,0,70,TRUE,0,74,TRUE,0,50,FALSE,1,51,TRUE,1,64,TRUE,1,54,TRUE,0,60,TRUE,1,100,FALSE,1,100,TRUE,1,81,TRUE,0,50,TRUE,0,63,TRUE,0,100,TRUE,1,87,FALSE,0,50,TRUE,1,100,0.01,0.0361,0,0.01,0,0.1764,0,0.0016,0.2401,0.2116,0.0169,0.1024,0.25,0.2601,0,0.25,0.36,0.3364,0.3969,0,0.1296,0.2601,0.25,0.0841,0.49,0.25,0.25,0.1296,1,0.5476,1,0.4096,0.264392857,0.157535714,0.37125,16,50,19,59.38,2,25,5,62.5,7,87.5,5,62.5,14,87.5,5,31.25,72.34,51.25,77.5,78.75,81.88,76.94,67.75,-9.38,12.96,26.25,15,-8.75,19.38,-10.56,36.5,0,0,3,1,0,3,1,4,1,5,0,5,4,0,0,4,4,5,5,2,0,0,0,2,0,1,4,0,1,0,0,0,0,4,0,2,0,1,1,4,0.8,2.8,1.8,4,0.4,1.2,0.8,1.6,2.35,1,1.675,7.33,1.67,5,0.4,1.6,1,2.4,1,5,6,6,5,5.66,2,2,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,High School (or equivalent),18,I hope you get what you need for the survey!,1.875,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,01ITEM,01DIR,2,5,8,3,6,4,7,1,9,2,3,4,1 +853,R_7rTUGoYyHM1m3DX,25 - 31,American,,American,Female,Agree,Strongly agree,Strongly agree,Agree,Agree,1,3,2,5,4,Agree,Disagree,Agree,Disagree,Agree,4,5,1,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,4,2,1,3,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Strongly Agree,Agree,Agree,Agree,3,5,1,4,2,8,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,1,5,4,2,7,Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,1,5,4,3,2,8,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,1,4,4,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,2,3,1,4,5,6,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,5,1,3,2,4,8,Agree,Agree,Agree,Strongly Agree,Strongly Agree,5,4,3,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,76,FALSE,66,TRUE,53,TRUE,76,TRUE,100,TRUE,68,FALSE,55,TRUE,79,TRUE,66,TRUE,57,TRUE,100,TRUE,100,TRUE,71,FALSE,89,TRUE,100,TRUE,86,TRUE,100,TRUE,62,FALSE,63,TRUE,72,TRUE,100,FALSE,83,FALSE,100,TRUE,73,TRUE,100,TRUE,65,FALSE,100,FALSE,98,TRUE,77,TRUE,100,TRUE,74,TRUE,83,18,2,3,3,2,2,2,-2,2,-2,2,3,3,3,2,2,2,3,3,2,3,-1,3,2,2,2,7,1,-2,1,-2,1,8,2,3,3,-2,3,7,1,-1,1,-1,-1,8,3,3,3,3,3,7,3,0,3,-3,2,4,2,3,3,1,3,6,2,2,2,3,3,8,TRUE,0,83,TRUE,1,74,TRUE,0,100,TRUE,0,77,FALSE,0,98,FALSE,1,100,TRUE,1,65,TRUE,1,100,TRUE,1,73,FALSE,0,100,FALSE,1,83,TRUE,0,100,TRUE,1,72,FALSE,1,63,TRUE,1,62,TRUE,1,100,TRUE,0,86,TRUE,0,100,FALSE,1,89,TRUE,0,71,TRUE,1,100,TRUE,1,100,TRUE,0,57,TRUE,1,66,TRUE,0,79,FALSE,0,55,TRUE,0,68,TRUE,0,100,TRUE,0,76,TRUE,1,53,FALSE,0,66,TRUE,1,76,0,0.3025,0,0.1225,0.0576,0,0.1156,1,0.5041,0,0.2209,0.0784,0.0729,0.0289,0.9604,0.0676,0.3249,0.5929,1,0.6241,0,0.1444,0.0121,0.1369,0.7396,0.4624,0.4356,0.6889,1,1,0.5776,1,0.423064286,0.287442857,0.558685714,18,56.25,16,50,5,62.5,4,50,3,37.5,4,50,12,75,4,25,81,74,83.12,80.62,86.25,78.75,83.25,6.25,31,11.5,33.12,43.12,36.25,3.75,58.25,3,0,1,0,0,1,0,1,0,1,1,0,0,4,1,1,4,2,3,4,1,0,0,1,1,1,2,1,1,0,1,0,0,1,1,0,1,1,1,0,0.8,0.6,1.2,2.8,0.6,1,0.6,0.6,1.35,0.7,1.025,7.33,5.67,6.875,0.2,-0.4,0.6,2.2,0.133333333,0,4,1,0,1.66,0,2,1,-2,2,1,-1,1,-1,-1,1,-1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,31,was easy,0.375,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,5,2,4,8,3,9,6,1,7,2,3,4,1 +854,R_7OTvOoQC0biSLms,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,3,4,2,1,5,Agree,Neither agree nor disagree,Agree,Somewhat agree,Strongly agree,4,1,5,2,3,Neither Agree nor Disagree,Agree,Agree,Strongly Agree,Somewhat Agree,1,5,3,4,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly Agree,Strongly Agree,3,5,4,2,1,Neither agree nor disagree,Somewhat agree,Strongly Agree,Agree,Agree,1,3,4,2,5,7,Agree,Somewhat agree,Neither agree nor disagree,Agree,Strongly agree,5,3,1,2,4,9,Somewhat Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,1,4,7,Agree,Somewhat agree,Strongly Agree,Agree,Somewhat agree,5,2,3,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,2,4,5,3,1,7,Agree,Somewhat agree,Somewhat agree,Strongly agree,Agree,4,1,2,5,3,7,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,1,2,7,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,79,TRUE,59,TRUE,100,FALSE,70,TRUE,66,FALSE,69,TRUE,64,FALSE,55,TRUE,65,FALSE,64,FALSE,62,TRUE,84,FALSE,63,TRUE,86,TRUE,60,FALSE,75,FALSE,56,TRUE,82,TRUE,70,TRUE,63,TRUE,92,TRUE,66,FALSE,100,TRUE,90,FALSE,63,TRUE,80,TRUE,66,TRUE,100,TRUE,65,TRUE,100,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,1,3,2,0,2,1,3,0,2,2,3,1,0,1,1,3,3,0,1,3,2,2,7,2,1,0,2,3,9,1,3,2,0,1,7,2,1,3,2,1,5,2,3,3,1,0,7,2,1,1,3,2,7,3,2,2,0,1,7,2,3,1,0,1,10,FALSE,1,100,TRUE,1,100,TRUE,0,79,TRUE,0,59,TRUE,1,100,FALSE,1,70,TRUE,1,66,FALSE,0,69,TRUE,1,64,FALSE,0,55,TRUE,0,65,FALSE,1,64,FALSE,0,62,TRUE,0,84,FALSE,0,63,TRUE,1,86,TRUE,0,60,FALSE,1,75,FALSE,1,56,TRUE,0,82,TRUE,1,70,TRUE,1,63,TRUE,0,92,TRUE,1,66,FALSE,1,100,TRUE,1,90,FALSE,1,63,TRUE,0,80,TRUE,0,66,TRUE,1,100,TRUE,1,65,TRUE,1,100,0.4761,0.01,0.0196,0.1156,0,0.09,0.1156,0.3025,0.6724,0.1369,0,0.3844,0.1296,0.4225,0,0,0.8464,0.3481,0.64,0,0.09,0.3969,0.1936,0.7056,0.36,0.1369,0.1225,0,0.6241,0.0625,0.4356,0.1296,0.262346429,0.246314286,0.278378571,24,75,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,75.44,66.88,77.5,79.12,78.25,76.19,74.69,15.62,16.06,4.38,27.5,4.12,28.25,1.19,30.94,3,2,1,1,1,0,1,2,1,0,1,1,0,3,0,2,0,2,1,2,1,0,1,0,3,0,1,1,2,1,3,0,0,3,0,2,2,0,3,2,1.6,0.8,1,1.4,1,1,1.2,1.8,1.2,1.25,1.225,7.67,7,7.375,0.6,-0.2,-0.2,-0.4,0.066666667,0,2,0,-5,0.67,0,0,1,1,-1,0,0,0,0,1,-1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,great work,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,8,3,5,4,9,2,7,1,6,2,4,3,1 +855,R_551EH1NZAgKO3YJ,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,4,5,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Strongly agree,1,4,3,5,2,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,3,4,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,4,1,3,5,2,9,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,5,4,1,3,2,7,Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Strongly Agree,4,5,2,1,3,8,Agree,Somewhat agree,Strongly Agree,Somewhat agree,Agree,5,2,3,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,5,1,2,0,Disagree,Strongly disagree,Strongly agree,Somewhat agree,Agree,3,4,5,2,1,0,Somewhat Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,4,1,2,3,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,2,5,1,4,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,62,FALSE,55,FALSE,60,FALSE,62,TRUE,79,TRUE,64,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,79,FALSE,66,TRUE,76,TRUE,74,FALSE,59,TRUE,65,TRUE,56,FALSE,100,TRUE,61,TRUE,72,FALSE,58,TRUE,100,TRUE,100,TRUE,82,TRUE,86,FALSE,96,TRUE,92,FALSE,63,TRUE,86,TRUE,64,TRUE,63,19,2,3,3,3,3,-1,0,2,1,3,1,0,3,0,3,1,1,2,1,1,3,3,3,3,0,9,1,3,1,3,0,7,2,0,3,2,3,8,2,1,3,1,2,7,3,3,3,3,3,0,-2,-3,3,1,2,0,-1,-3,3,-2,3,2,3,3,3,3,0,4,TRUE,0,63,TRUE,1,64,TRUE,0,86,FALSE,1,63,TRUE,1,92,FALSE,1,96,TRUE,1,86,TRUE,1,82,TRUE,1,100,TRUE,1,100,FALSE,1,58,TRUE,0,72,TRUE,1,61,FALSE,1,100,TRUE,1,56,TRUE,1,65,FALSE,1,59,TRUE,0,74,TRUE,0,76,FALSE,1,66,TRUE,1,79,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,64,TRUE,0,79,FALSE,1,62,FALSE,1,60,FALSE,0,55,FALSE,0,62,TRUE,1,100,0.0324,0.1296,0.1225,0.0196,0,0.0016,0,0,0.1156,0,0.3025,0.1521,0,0.1764,0.0064,0.1296,0,0.1369,0.1444,0,0.0441,0.1936,0.5776,0,0.1681,0.6241,0.3844,0.3969,0.7396,0.5476,0.16,0.5184,0.197139286,0.072935714,0.321342857,19,59.38,24,75,5,62.5,8,100,6,75,5,62.5,14,87.5,10,62.5,77.5,69.75,80.88,85.88,73.5,79.12,75.88,-15.62,2.5,7.25,-19.12,10.88,11,-8.38,13.38,1,0,0,0,3,2,3,1,2,3,1,0,0,2,0,1,0,1,0,1,1,0,0,0,0,1,3,1,0,1,2,3,0,2,0,2,2,1,2,1,0.8,2.2,0.6,0.6,0.2,1.2,1.4,1.6,1.05,1.1,1.075,8,0.67,4.625,0.6,1,-0.8,-1,0.266666667,9,7,6,3,7.33,1,2,2,-2,2,1,-1,1,-1,-2,2,0,10 cents,5 minutes,36 days,Female,College Diploma/Certificate,21,,0.875,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,7,6,5,9,3,8,4,1,2,3,2,4,1 +856,R_7Ofyp1ai5hRQU7L,25 - 31,American,,American,Male,Somewhat agree,Agree,Agree,Somewhat agree,Agree,4,5,1,3,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,2,3,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,2,5,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,3,4,2,1,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,2,5,4,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,1,5,3,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Agree,Agree,Somewhat agree,Agree,1,5,4,2,3,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,3,1,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,2,3,1,6,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,4,3,5,2,FALSE,100,TRUE,89,TRUE,100,FALSE,56,TRUE,55,FALSE,100,TRUE,100,TRUE,100,TRUE,68,FALSE,72,FALSE,65,FALSE,95,TRUE,100,TRUE,83,TRUE,60,TRUE,100,FALSE,63,FALSE,100,TRUE,85,FALSE,68,TRUE,68,TRUE,94,FALSE,63,TRUE,100,FALSE,100,TRUE,100,FALSE,78,FALSE,89,TRUE,88,FALSE,79,TRUE,86,TRUE,91,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,1,2,1,-1,1,-1,1,1,1,1,0,1,0,0,2,1,1,1,2,2,2,1,2,1,-1,1,-1,1,2,1,0,1,1,1,2,1,1,0,1,1,5,1,2,2,1,2,2,1,-1,1,-1,1,2,1,1,1,0,1,2,1,1,2,1,1,6,FALSE,1,100,TRUE,1,89,TRUE,0,100,FALSE,1,56,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,68,FALSE,0,72,FALSE,1,65,FALSE,1,95,TRUE,1,100,TRUE,0,83,TRUE,1,60,TRUE,1,100,FALSE,1,63,FALSE,1,100,TRUE,0,85,FALSE,1,68,TRUE,1,68,TRUE,1,94,FALSE,1,63,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,78,FALSE,1,89,TRUE,0,88,FALSE,0,79,TRUE,1,86,TRUE,1,91,0,0,0,0,0.0081,0,0,0.5184,0.1024,0.0036,0.6241,0,0.1024,0.1225,0.2025,0.0121,0.1369,0.1936,0.0121,0,0.1024,0.16,0.7225,0.6889,0.1369,0.0484,0.0196,0,1,0,0.7744,0.0025,0.203367857,0.144757143,0.261978571,13,40.63,26,81.25,7,87.5,7,87.5,6,75,6,75,14,87.5,12,75,84.22,73.38,78.5,93.62,91.38,85.12,83.31,-40.62,2.97,-14.12,-9,18.62,16.38,-2.38,8.31,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0.4,0,0.4,0.8,0,0,0,0.4,0.4,0.1,0.25,2,2,2.875,0.4,0,0.4,0.4,0.266666667,0,0,0,-1,0,0,1,1,-1,1,-1,1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),27,Fun and enjoyable to take,0.5,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,02DGEN,01DIR,3,6,5,8,2,4,9,1,7,2,4,3,1 +857,R_3k7yDhUCnYMqSNm,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,1,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,4,1,2,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,5,1,2,4,10,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,3,4,1,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,3,1,2,4,5,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,3,1,4,5,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,4,3,5,2,10,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,5,3,2,4,1,10,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,84,TRUE,100,TRUE,98,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,98,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,32,3,3,3,3,3,3,3,3,-3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,2,2,10,2,3,3,2,3,10,3,3,2,3,2,10,3,3,2,3,2,10,3,3,2,3,2,10,3,3,3,3,2,10,3,3,2,2,3,10,3,2,3,3,2,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,84,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0004,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0.0004,0,0,0.0256,0,0,0,0,1,0,0,0.072371429,0.071457143,0.073285714,32,100,30,93.75,8,100,7,87.5,7,87.5,8,100,15,93.75,15,93.75,99.38,99.75,97.75,100,100,99.88,98.88,6.25,5.63,-0.25,10.25,12.5,0,6.13,5.13,0,0,0,1,1,1,0,0,5,0,0,0,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,6,1,0,0,1,0,0,1,1,0,0,1,0.4,1.2,0.6,0.6,0.4,1.4,0.2,0.6,0.7,0.65,0.675,10,10,10,0,-0.2,0.4,0,0.066666667,0,0,0,0,0,1,2,1,1,-1,1,-1,1,-1,2,-2,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,24,none,0,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,02DGEN,02REV,3,5,8,2,6,7,9,1,4,4,3,2,1 +858,R_1WuuZPODn5sL2k0,18 - 24,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,3,5,2,Disagree,Neither agree nor disagree,Agree,Disagree,Strongly disagree,2,5,4,1,3,Strongly Agree,Strongly Agree,Agree,Agree,Somewhat Agree,1,4,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Strongly Agree,Somewhat agree,Agree,Somewhat agree,5,3,2,4,1,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly disagree,4,3,5,1,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,Disagree,5,3,2,1,4,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Strongly Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,3,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,5,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,1,5,3,4,2,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,3,4,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,84,TRUE,84,FALSE,73,TRUE,76,TRUE,86,TRUE,89,TRUE,100,FALSE,100,TRUE,100,TRUE,95,TRUE,100,TRUE,100,TRUE,100,TRUE,77,TRUE,84,FALSE,100,TRUE,86,FALSE,88,TRUE,89,TRUE,92,TRUE,89,TRUE,88,TRUE,87,TRUE,88,TRUE,85,TRUE,85,TRUE,78,FALSE,83,TRUE,86,TRUE,94,TRUE,84,TRUE,90,17,1,3,3,2,3,-2,0,2,-2,-3,3,3,2,2,1,0,0,1,1,0,0,3,1,2,1,8,1,0,0,-2,-3,7,0,0,-2,0,-2,6,0,0,1,2,0,6,0,3,1,1,0,5,0,0,1,0,0,5,0,0,0,1,1,4,1,0,0,1,0,7,TRUE,0,90,TRUE,1,84,TRUE,0,94,TRUE,0,86,FALSE,0,83,TRUE,0,78,TRUE,1,85,TRUE,1,85,TRUE,1,88,TRUE,1,87,TRUE,0,88,TRUE,0,89,TRUE,1,92,TRUE,0,89,FALSE,0,88,TRUE,1,86,FALSE,1,100,TRUE,0,84,TRUE,0,77,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,89,TRUE,0,86,TRUE,0,76,FALSE,0,73,TRUE,1,84,TRUE,1,84,0.0225,0,0.0196,0.0225,0.0256,0.6084,0,0.0169,1,0,0.5329,0.0064,0.0144,0.7744,0.6889,0.0256,0.9025,0.7396,0.7396,0,0,0.7744,0.5929,0.7921,0,0.7921,0.0256,0.81,0.8836,0.7056,0.5776,0.7921,0.4579,0.381114286,0.534685714,17,53.13,15,46.88,3,37.5,4,50,5,62.5,3,37.5,13,81.25,2,12.5,88.75,85.5,88.5,91.88,89.12,88.69,88.81,6.25,41.87,48,38.5,29.38,51.62,7.44,76.31,1,0,2,0,2,3,0,2,0,0,3,3,4,2,3,0,0,0,1,0,1,0,2,1,3,2,0,1,2,3,3,3,2,1,0,1,0,1,0,0,1,1,3,0.2,1.4,1.6,1.8,0.4,1.3,1.3,1.3,7,4.67,6,-0.4,-0.6,1.2,-0.2,0.066666667,3,2,2,-1,2.33,1,1,0,2,-2,1,-1,1,-1,0,0,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,I liked it somewhat just make it a bit shorter next time,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,9,2,4,6,8,7,3,1,5,4,2,3,1 +859,R_3OJ91rDlvOTOUrH,18 - 24,American,,American,Female,Strongly agree,Agree,Agree,Neither agree nor disagree,Strongly agree,4,2,5,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,2,1,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,1,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,3,5,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,4,5,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,2,4,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,5,4,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,60,FALSE,50,TRUE,100,TRUE,90,TRUE,75,FALSE,60,TRUE,100,FALSE,85,TRUE,100,TRUE,90,FALSE,50,TRUE,64,TRUE,95,FALSE,68,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,82,TRUE,100,FALSE,64,TRUE,100,FALSE,50,TRUE,50,FALSE,93,FALSE,92,FALSE,82,FALSE,50,TRUE,100,TRUE,76,TRUE,100,16,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,TRUE,0,100,TRUE,1,76,TRUE,0,100,FALSE,1,50,FALSE,0,82,FALSE,1,92,FALSE,0,93,TRUE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,64,TRUE,0,100,FALSE,0,82,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,68,TRUE,0,95,TRUE,1,64,FALSE,0,50,TRUE,0,90,TRUE,1,100,FALSE,1,85,TRUE,1,100,FALSE,1,60,TRUE,0,75,TRUE,0,90,TRUE,1,100,FALSE,0,50,TRUE,1,60,0.25,0,0,0.8649,0.16,0.0064,0,0,0.9025,0.25,0,0.6724,0.25,0.1296,0.6724,0.0576,0.81,0.25,0.5625,0.0225,0.1296,0.25,0.1024,0,1,0.16,0.25,1,1,1,0.81,1,0.408853571,0.297207143,0.5205,16,50,16,50,5,62.5,3,37.5,4,50,4,50,9,56.25,7,43.75,80.5,58.5,82.5,91,90,75.44,85.56,0,30.5,-4,45,41,40,19.19,41.81,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,3,2,2,0,3,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,2,0,1,0,2,0,1,0,0.75,0.75,0.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,1,-1,1,15 cents,100 minutes,24 days,Female,College Diploma/Certificate,22,,-0.25,0,0,0,0,1,1,0,0.67,03VLPfPs,02COC,01PAST,02DGEN,02REV,8,7,6,9,4,2,3,1,5,4,2,3,1 +860,R_6Y9x4iu9imBy3ct,18 - 24,American,,American,Female,Agree,Strongly agree,Somewhat agree,Agree,Agree,3,5,2,4,1,Strongly agree,Somewhat disagree,Disagree,Strongly disagree,Agree,4,3,2,5,1,Somewhat Disagree,Disagree,Agree,Agree,Somewhat Agree,1,5,4,3,2,Neither agree nor disagree,Somewhat agree,Agree,Agree,Disagree,5,3,4,2,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,4,2,5,1,6,Strongly disagree,Strongly disagree,Somewhat agree,Disagree,Agree,3,5,1,2,4,8,Strongly Agree,Somewhat Agree,Disagree,Agree,Agree,1,5,4,2,3,8,Disagree,Somewhat agree,Agree,Somewhat agree,Strongly Agree,5,4,3,1,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Somewhat disagree,Strongly Agree,Agree,4,2,1,5,3,2,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Agree,1,4,5,2,3,1,Somewhat Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,3,2,1,4,5,1,Agree,Disagree,Neither agree nor disagree,Somewhat agree,Disagree,5,1,2,4,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,65,FALSE,50,TRUE,70,FALSE,100,TRUE,90,TRUE,90,TRUE,100,FALSE,100,FALSE,54,TRUE,94,TRUE,60,TRUE,73,FALSE,52,TRUE,53,TRUE,50,TRUE,76,FALSE,67,FALSE,50,TRUE,64,TRUE,59,TRUE,80,TRUE,95,TRUE,63,TRUE,95,TRUE,50,FALSE,50,TRUE,60,FALSE,69,FALSE,75,TRUE,95,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,2,2,3,-1,-2,-3,2,-1,-2,2,2,1,0,1,2,2,-2,2,3,3,3,1,6,-3,-3,1,-2,2,8,3,1,-2,2,2,8,-2,1,2,1,3,6,2,3,-1,3,2,2,3,0,0,-2,2,1,-1,-2,2,0,2,1,2,-2,0,1,-2,8,TRUE,0,100,TRUE,1,50,TRUE,0,65,FALSE,1,50,TRUE,1,70,FALSE,1,100,TRUE,1,90,TRUE,1,90,TRUE,1,100,FALSE,0,100,FALSE,1,54,TRUE,0,94,TRUE,1,60,TRUE,0,73,FALSE,0,52,TRUE,1,53,TRUE,0,50,TRUE,0,76,FALSE,1,67,FALSE,1,50,TRUE,1,64,TRUE,1,59,TRUE,0,80,TRUE,1,95,TRUE,0,63,TRUE,1,95,TRUE,0,50,FALSE,1,50,TRUE,0,60,FALSE,0,69,FALSE,0,75,TRUE,1,95,0.01,0.0025,0.2209,0.01,0.0025,0,0.0025,1,0.25,0.1681,0.4761,0.16,0,0.2116,0.09,0.25,0.64,0.25,0.25,0.3969,0.1296,0.2704,0.1089,0.5329,0.25,0.25,0.5625,1,0.4225,0.5776,0.36,0.8836,0.339132143,0.250057143,0.428207143,13,40.63,18,56.25,5,62.5,5,62.5,3,37.5,5,62.5,12,75,6,37.5,71.84,62.25,72.38,82,70.75,76.06,67.62,-15.62,15.59,-0.25,9.88,44.5,8.25,1.06,30.12,0,0,2,1,1,6,2,3,1,0,4,3,4,0,1,2,0,0,1,5,0,0,2,1,0,0,1,2,1,0,0,0,0,2,1,2,3,2,1,0,0.8,2.4,2.4,1.6,0.6,0.8,0.6,1.6,1.8,0.9,1.35,7.33,1.33,5,0.2,1.6,1.8,0,1.2,4,7,7,-2,6,0,2,1,-2,2,1,-1,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,,0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,5,9,6,8,7,4,2,1,3,2,4,3,1 +861,R_3O2lLNh3P30DMHf,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,2,5,3,4,Agree,Somewhat agree,Strongly agree,Strongly agree,Agree,3,5,1,2,4,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,1,5,4,3,Agree,Agree,Somewhat agree,Agree,Agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,2,1,3,4,3,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,2,3,5,1,4,7,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,5,1,2,4,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Somewhat agree,Agree,Agree,Somewhat agree,2,4,3,1,5,6,Agree,Agree,Strongly agree,Agree,Strongly agree,5,3,2,4,1,8,Somewhat Agree,Agree,Strongly agree,Agree,Somewhat Agree,4,1,2,3,5,7,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,2,3,4,5,1,FALSE,65,FALSE,67,FALSE,71,TRUE,57,FALSE,54,FALSE,68,FALSE,69,FALSE,68,FALSE,61,FALSE,66,FALSE,71,FALSE,72,FALSE,69,FALSE,65,FALSE,64,FALSE,61,FALSE,61,FALSE,57,TRUE,71,FALSE,71,FALSE,63,TRUE,63,TRUE,59,FALSE,53,TRUE,66,TRUE,66,FALSE,61,FALSE,62,FALSE,58,FALSE,74,FALSE,75,TRUE,61,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,3,2,2,1,3,3,2,2,2,1,0,2,2,2,1,2,2,2,1,1,1,2,5,1,1,2,2,1,3,2,3,1,3,2,7,1,1,1,2,2,5,2,1,2,2,1,3,2,2,3,2,3,6,1,2,3,2,1,8,2,1,1,0,3,7,FALSE,1,65,FALSE,0,67,FALSE,1,71,TRUE,0,57,FALSE,0,54,FALSE,1,68,FALSE,0,69,FALSE,0,68,FALSE,0,61,FALSE,0,66,FALSE,1,71,FALSE,1,72,FALSE,0,69,FALSE,1,65,FALSE,0,64,FALSE,0,61,FALSE,1,61,FALSE,1,57,TRUE,0,71,FALSE,1,71,FALSE,0,63,TRUE,1,63,TRUE,0,59,FALSE,0,53,TRUE,0,66,TRUE,1,66,FALSE,1,61,FALSE,1,62,FALSE,1,58,FALSE,0,74,FALSE,0,75,TRUE,1,61,0.4624,0.1156,0.3721,0.4761,0.1521,0.1024,0.2809,0.4356,0.0841,0.1369,0.5476,0.4761,0.3721,0.0841,0.2916,0.4489,0.3481,0.3249,0.1444,0.4356,0.3969,0.4096,0.5041,0.1225,0.1521,0.1521,0.5625,0.1225,0.0841,0.1849,0.1764,0.0784,0.271839286,0.291814286,0.251864286,18,56.25,15,46.88,2,25,4,50,5,62.5,4,50,3,18.75,12,75,64.66,65.88,61.62,64.62,66.5,64.62,64.69,9.37,17.78,40.88,11.62,2.12,16.5,45.87,-10.31,1,2,1,2,0,1,0,1,1,1,0,1,0,3,0,1,1,0,0,0,1,2,0,1,1,0,1,0,1,1,1,0,2,2,1,0,1,0,2,1,1.2,0.8,0.8,0.4,1,0.6,1.2,0.8,0.8,0.9,0.85,5,5.67,5.5,0.2,0.2,-0.4,-0.4,0,2,-3,-1,-2,-0.67,0,-1,0,0,0,0,0,0,0,1,-1,0,5 cents,100 minutes,47 days,Female,High School (or equivalent),21,,-0.25,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,5,2,6,3,7,9,4,1,8,4,2,3,1 +862,R_3costSOlw5ZSWJj,18 - 24,American,,American,Female,Agree,Strongly agree,Strongly disagree,Neither agree nor disagree,Somewhat agree,4,3,5,1,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Agree,1,3,2,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Strongly Agree,Neither agree nor disagree,Strongly disagree,Strongly Agree,5,3,4,1,2,9,Disagree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,1,2,4,5,3,9,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,4,2,5,1,3,10,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,Strongly Agree,5,4,2,1,3,4,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,2,5,3,1,7,Strongly agree,Somewhat Agree,Strongly agree,Agree,Agree,1,4,3,2,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,5,3,2,4,1,FALSE,100,TRUE,58,TRUE,100,FALSE,60,TRUE,100,FALSE,55,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,53,TRUE,50,TRUE,100,FALSE,50,TRUE,67,TRUE,100,TRUE,100,FALSE,100,TRUE,64,FALSE,65,TRUE,100,TRUE,100,FALSE,100,TRUE,71,TRUE,52,TRUE,83,TRUE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,52,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,-3,0,1,0,0,1,0,0,3,1,3,2,2,1,1,1,1,-3,1,3,0,-3,3,3,-2,3,1,3,1,9,3,1,3,1,1,9,-3,-1,-3,-3,-3,10,3,3,-2,1,3,2,1,0,3,0,1,4,3,1,3,2,2,7,3,3,3,3,-1,10,FALSE,1,100,TRUE,1,58,TRUE,0,100,FALSE,1,60,TRUE,1,100,FALSE,1,55,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,53,TRUE,0,50,TRUE,1,100,FALSE,1,50,TRUE,1,67,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,64,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,0,52,TRUE,1,83,TRUE,0,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,FALSE,0,52,TRUE,1,100,0,0.0289,0,0,0,0.2025,0.0841,0,0.1225,0,1,0,0,0.2209,0,0.1764,0,0.16,0.25,0.2704,0,0.1089,0.4096,0.25,1,1,0.2704,0,1,0,1,0.25,0.277703571,0.140457143,0.41495,16,50,23,71.88,5,62.5,6,75,7,87.5,5,62.5,14,87.5,9,56.25,82.19,69.25,94.38,85.62,79.5,89.44,74.94,-21.88,10.31,6.75,19.38,-1.88,17,1.94,18.69,1,0,3,3,2,2,3,0,3,1,0,0,0,1,1,4,2,4,4,0,1,0,1,1,2,1,0,2,0,1,0,0,0,0,0,2,2,2,2,2,1.8,1.8,0.4,2.8,1,0.8,0,2,1.7,0.95,1.325,7,4.33,6.75,0.8,1,0.4,0.8,0.733333333,1,5,2,0,2.67,0,1,2,-2,2,2,-2,2,-2,-1,1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,I can't come up with anything.,0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,9,8,2,3,7,6,4,1,5,2,4,3,1 +863,R_5dYvNycLhDsBzDo,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,3,4,1,5,2,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,5,1,4,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,1,5,2,4,3,2,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,3,2,1,4,5,3,Strongly Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,1,5,3,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,3,4,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,3,4,2,1,5,2,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,1,2,5,3,4,2,Strongly agree,Agree,Strongly agree,Somewhat Disagree,Strongly agree,5,2,4,1,3,2,Agree,Agree,Agree,Agree,Agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,FALSE,58,TRUE,86,TRUE,54,TRUE,97,TRUE,50,TRUE,81,TRUE,86,TRUE,75,FALSE,100,TRUE,91,FALSE,64,TRUE,54,TRUE,81,TRUE,87,TRUE,70,FALSE,70,TRUE,59,TRUE,61,TRUE,87,TRUE,87,FALSE,70,TRUE,97,TRUE,75,TRUE,92,TRUE,65,FALSE,100,TRUE,65,FALSE,60,TRUE,100,TRUE,58,FALSE,98,16,3,3,2,0,3,0,1,2,0,0,2,1,3,0,3,2,0,0,1,-1,1,3,3,3,1,2,1,-1,2,1,0,2,3,2,3,0,3,3,-1,0,-1,0,-1,3,3,3,2,-1,3,3,0,-1,3,-1,2,2,3,2,3,-1,3,2,2,2,2,2,2,2,FALSE,1,98,TRUE,1,58,TRUE,0,100,FALSE,1,60,TRUE,1,65,FALSE,1,100,TRUE,1,65,TRUE,1,92,TRUE,1,75,TRUE,1,97,FALSE,1,70,TRUE,0,87,TRUE,1,87,TRUE,0,61,TRUE,1,59,FALSE,0,70,TRUE,0,70,TRUE,0,87,TRUE,0,81,TRUE,0,54,FALSE,0,64,TRUE,1,91,FALSE,1,100,TRUE,1,75,TRUE,0,86,TRUE,1,81,TRUE,0,50,TRUE,0,97,TRUE,0,54,TRUE,1,86,FALSE,0,58,TRUE,1,96,0.0064,0.0361,0.49,0.1225,0.0016,0,0.0625,0.0009,0.2916,0.0081,0.0196,0.0169,0.0625,0.09,0.1225,0.1764,0,0.16,0.9409,0.7396,0.4096,0.1681,0.6561,0.3721,0.49,0.25,0.3364,0.0004,1,0.7569,0.2916,0.7569,0.292185714,0.072328571,0.512042857,16,50,18,56.25,5,62.5,5,62.5,5,62.5,3,37.5,13,81.25,5,31.25,77.31,63.88,79.5,83.25,82.62,76.19,78.44,-6.25,21.06,1.38,17,20.75,45.12,-5.06,47.19,2,0,1,3,2,1,2,0,1,0,1,1,0,0,0,3,0,1,1,0,0,0,0,1,0,0,2,1,1,2,1,1,0,1,0,0,2,2,1,3,1.6,0.8,0.4,1,0.2,1.2,0.6,1.6,0.95,0.9,0.925,2.33,2.33,2.375,1.4,-0.4,-0.2,-0.6,0.266666667,-1,0,1,1,0,0,1,0,-1,1,1,-1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,28,,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,6,5,4,7,9,2,8,1,3,4,3,2,1 +864,R_3r4jCd87S8QXS9z,18 - 24,American,,American,Male,Strongly disagree,Disagree,Strongly agree,Disagree,Strongly disagree,5,3,1,4,2,Strongly disagree,Disagree,Somewhat agree,Strongly agree,Strongly disagree,1,4,2,3,5,Agree,Agree,Agree,Disagree,Strongly Agree,4,5,3,2,1,Agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,3,1,4,2,5,Strongly disagree,Agree,Agree,Strongly disagree,Strongly disagree,2,5,3,1,4,0,Strongly disagree,Disagree,Disagree,Disagree,Disagree,2,1,3,4,5,1,Somewhat Disagree,Agree,Somewhat Disagree,Disagree,Somewhat Disagree,3,5,1,2,4,10,Agree,Agree,Agree,Agree,Strongly disagree,5,2,3,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Disagree,Neither agree nor disagree,Disagree,Disagree,Strongly disagree,5,4,2,1,3,0,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,1,4,2,3,5,2,Disagree,Agree,Agree,Agree,Agree,1,3,5,4,2,0,Agree,Agree,Agree,Agree,Disagree,2,3,1,4,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,60,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,65,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,2,-3,-2,3,-2,-3,-3,-2,1,3,-3,2,2,2,-2,3,2,3,3,1,-3,-3,2,2,-3,-3,0,-3,-2,-2,-2,-2,1,-1,2,-1,-2,-1,10,2,2,2,2,-3,5,-2,0,-2,-2,-3,0,-2,-2,1,0,-3,2,-2,2,2,2,2,0,2,2,2,2,-2,0,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,60,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.36,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.253928571,0.25,0.257857143,2,6.25,19,59.38,4,50,4,50,5,62.5,6,75,3,18.75,16,100,50.78,50,51.25,50,51.88,51.56,50,-53.13,-8.6,0,1.25,-12.5,-23.12,32.81,-50,0,4,1,1,0,0,0,3,5,1,3,0,3,0,4,0,1,1,1,0,1,2,5,0,0,1,0,0,3,0,4,0,0,4,1,0,1,1,1,1,1.2,1.8,2,0.6,1.6,0.8,1.8,0.8,1.4,1.25,1.325,3.67,0.67,2.25,-0.4,1,0.2,-0.2,0.266666667,0,-1,10,5,3,-2,2,1,-2,2,0,0,2,-2,-2,2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,23,I thought the survey was too long.,0.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,5,7,4,8,6,3,2,1,9,2,4,3,1 +865,R_1X5UXxlbHryt7c7,25 - 31,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,1,4,2,5,Strongly disagree,Strongly agree,Agree,Agree,Somewhat agree,1,2,5,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,3,2,4,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,2,1,4,5,Neither agree nor disagree,Strongly Agree,Agree,Agree,Strongly Agree,5,1,4,2,3,8,Agree,Agree,Strongly agree,Somewhat agree,Strongly agree,2,3,1,4,5,8,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,3,1,5,2,1,Somewhat agree,Agree,Strongly Agree,Agree,Strongly Agree,1,5,4,2,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,5,2,3,1,6,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,3,2,5,1,4,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,1,5,2,4,5,Somewhat agree,Somewhat agree,Agree,Agree,Agree,4,2,5,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,64,TRUE,89,FALSE,74,FALSE,87,TRUE,79,FALSE,98,TRUE,88,TRUE,78,TRUE,94,TRUE,88,FALSE,66,TRUE,97,TRUE,82,FALSE,70,TRUE,85,TRUE,92,FALSE,83,FALSE,100,FALSE,90,FALSE,86,TRUE,100,TRUE,80,FALSE,100,TRUE,93,FALSE,84,TRUE,86,FALSE,70,TRUE,94,FALSE,78,TRUE,85,FALSE,72,FALSE,67,11,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,3,2,-3,3,2,2,1,3,3,3,2,3,0,2,1,1,-1,0,3,2,2,3,8,2,2,3,1,3,8,3,3,2,3,3,1,1,2,3,2,3,9,2,3,3,3,1,6,0,1,3,1,3,4,3,3,3,2,3,5,1,1,2,2,2,5,TRUE,0,64,TRUE,1,89,FALSE,1,74,FALSE,1,87,TRUE,1,79,FALSE,1,98,TRUE,1,88,TRUE,1,78,TRUE,1,94,TRUE,1,88,FALSE,1,66,TRUE,0,97,TRUE,1,82,FALSE,1,70,TRUE,1,85,TRUE,1,92,FALSE,1,83,FALSE,1,100,FALSE,1,90,FALSE,1,86,TRUE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,93,FALSE,1,84,TRUE,1,86,FALSE,1,70,TRUE,0,94,FALSE,1,78,TRUE,1,85,FALSE,0,72,FALSE,0,67,0.0484,0.0196,0.0064,0.0144,0.4489,0.0004,0.0049,0.0144,0.0196,0.04,0.0225,0.0324,0.0036,0.1156,0.0441,0.0121,0,0.0169,0.8836,0.0256,0,0.0225,0.01,0.09,0.0289,0.09,0.5184,0.4096,0.0676,0,0.0484,0.9409,0.139675,0.055385714,0.223964286,11,34.38,27,84.38,7,87.5,7,87.5,7,87.5,6,75,14,87.5,13,81.25,84.34,81.62,85.88,82.5,87.38,84.88,83.81,-50,-0.04,-5.88,-1.62,-5,12.38,-2.62,2.56,2,0,1,1,1,5,1,1,1,2,0,0,1,1,0,1,0,2,1,4,0,0,0,0,1,3,2,1,1,2,0,0,0,0,0,1,1,1,1,3,1,2,0.4,1.6,0.2,1.8,0,1.4,1.25,0.85,1.05,5.67,5,5.75,0.8,0.2,0.4,0.2,0.466666667,2,4,-4,4,0.67,1,1,1,-1,1,1,-1,1,-1,1,-1,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,28,,0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,9,5,4,8,7,3,2,1,6,4,3,2,1 +866,R_6e5t08ZY1L6J1vb,18 - 24,American,,American,Female,Disagree,Agree,Agree,Agree,Disagree,1,5,4,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Agree,2,3,4,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Agree,4,3,2,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,1,4,3,0,Agree,Disagree,Neither agree nor disagree,Disagree,Disagree,1,4,3,5,2,4,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,5,2,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,5,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,Agree,4,3,5,1,2,5,Agree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,2,5,1,5,Agree,Agree,Strongly Agree,Agree,Strongly Agree,2,4,5,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,62,FALSE,67,TRUE,90,FALSE,82,FALSE,87,TRUE,80,FALSE,76,TRUE,67,FALSE,70,TRUE,86,TRUE,81,TRUE,83,TRUE,84,FALSE,67,FALSE,71,FALSE,63,FALSE,69,TRUE,80,FALSE,86,FALSE,78,FALSE,78,FALSE,76,FALSE,83,FALSE,68,FALSE,79,TRUE,76,FALSE,74,TRUE,88,FALSE,86,TRUE,92,FALSE,87,FALSE,72,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,2,-2,0,0,0,2,2,3,3,3,0,2,3,3,3,3,3,3,3,3,3,3,0,2,-2,0,-2,-2,4,3,0,2,0,0,4,3,3,3,3,3,3,0,0,0,0,0,5,0,-2,0,-2,2,5,2,2,2,0,0,5,2,2,3,2,3,6,FALSE,1,62,FALSE,0,67,TRUE,0,90,FALSE,1,82,FALSE,0,87,TRUE,0,80,FALSE,0,76,TRUE,1,67,FALSE,0,70,TRUE,1,86,TRUE,0,81,TRUE,0,83,TRUE,1,84,FALSE,1,67,FALSE,0,71,FALSE,0,63,FALSE,1,69,TRUE,0,80,FALSE,1,86,FALSE,1,78,FALSE,0,78,FALSE,0,76,FALSE,1,83,FALSE,0,68,FALSE,1,79,TRUE,1,76,FALSE,1,74,TRUE,0,88,FALSE,1,86,TRUE,1,92,FALSE,0,87,FALSE,0,72,0.1089,0.0576,0.3969,0.5776,0.5184,0.64,0.4624,0.0196,0.0484,0.5776,0.0064,0.0256,0.49,0.6561,0.7569,0.4489,0.0289,0.0324,0.7744,0.0441,0.6084,0.5041,0.0196,0.1089,0.0961,0.0676,0.7569,0.1444,0.81,0.64,0.0196,0.6889,0.35695,0.336542857,0.377357143,16,50,15,46.88,3,37.5,4,50,5,62.5,3,37.5,5,31.25,10,62.5,77.75,77.25,79.88,75.25,78.62,76.25,79.25,3.12,30.87,39.75,29.88,12.75,41.12,45,16.75,5,1,1,1,5,2,2,0,4,4,0,3,1,0,2,0,0,0,0,0,2,2,2,2,2,0,2,0,4,0,1,1,1,0,2,1,1,0,1,0,2.6,2.4,1.2,0,2,1.2,1,0.6,1.55,1.2,1.375,2.67,5,4,0.6,1.2,0.2,-0.6,0.666666667,-5,-1,-1,-3,-2.33,1,2,1,-2,2,0,0,0,0,0,0,-1,5 cents,5 minutes,47 days,Female,High School (or equivalent),23,I don't have any feedback.,0.625,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,01ITEM,01DIR,9,5,7,3,6,4,2,1,8,2,4,3,1 +867,R_3IRFJSyzunHLkEK,25 - 31,American,,American,Female,Agree,Agree,Somewhat agree,Agree,Somewhat agree,2,4,1,5,3,Agree,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,3,5,1,4,2,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,1,5,4,3,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,5,4,2,1,Neither agree nor disagree,Somewhat disagree,Strongly Agree,Strongly Agree,Somewhat agree,4,3,1,2,5,7,Somewhat agree,Agree,Somewhat disagree,Agree,Somewhat agree,4,1,3,5,2,8,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,2,5,4,1,3,6,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,Somewhat agree,2,5,4,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Agree,4,1,3,2,5,8,Strongly agree,Strongly disagree,Agree,Somewhat disagree,Strongly agree,2,5,4,3,1,8,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,4,1,5,2,9,Agree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat disagree,3,4,1,5,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,32,2,2,1,2,1,2,-1,3,1,3,2,2,2,1,3,-1,1,1,1,-1,0,-1,3,3,1,7,1,2,-1,2,1,8,1,0,1,1,3,6,-1,0,-2,-2,1,9,1,1,0,2,2,8,3,-3,2,-1,3,8,3,3,2,2,3,9,2,3,1,3,-1,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0.25,0.142857143,0.357142857,32,100,25,78.13,6,75,6,75,8,100,5,62.5,15,93.75,10,62.5,100,100,100,100,100,100,100,21.87,21.87,25,25,0,37.5,6.25,37.5,2,3,2,1,0,1,3,4,1,2,1,2,1,0,0,0,1,3,3,2,1,1,1,0,1,1,2,1,2,0,1,1,0,1,0,3,2,0,2,0,1.6,2.2,0.8,1.8,0.8,1.2,0.6,1.4,1.6,1,1.3,7,8.33,8.125,0.8,1,0.2,0.4,0.666666667,-1,0,-3,-1,-1.33,-1,-2,2,-2,2,1,-1,0,0,-2,2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,30,the survey was mind blowing,0.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,7,3,4,2,5,6,9,1,8,4,3,2,1 +868,R_7aOhb3G82QkZXON,25 - 31,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Disagree,Agree,5,3,2,1,4,Agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,2,1,3,4,5,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Strongly Agree,1,3,2,5,4,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,5,2,4,3,1,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat disagree,Agree,2,5,3,4,1,2,Agree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,4,5,1,3,2,4,Disagree,Disagree,Agree,Disagree,Strongly Agree,5,1,2,3,4,4,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Disagree,3,2,4,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,1,2,4,3,5,8,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,1,3,5,2,4,7,Disagree,Disagree,Strongly Agree,Disagree,Strongly Agree,1,2,5,3,4,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,90,TRUE,60,TRUE,85,FALSE,65,TRUE,70,FALSE,55,TRUE,80,FALSE,60,TRUE,50,TRUE,80,FALSE,90,TRUE,90,TRUE,80,FALSE,50,TRUE,55,TRUE,70,TRUE,50,TRUE,70,FALSE,50,TRUE,60,FALSE,50,TRUE,50,FALSE,75,TRUE,70,FALSE,75,TRUE,80,TRUE,50,FALSE,50,TRUE,50,TRUE,75,FALSE,50,TRUE,90,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,-2,2,2,1,3,2,1,-1,-2,3,-2,3,-1,1,-1,0,-1,1,3,3,-1,2,2,2,1,-1,2,-1,4,-2,-2,2,-2,3,4,-3,-2,-3,-3,-2,8,2,3,3,-1,3,8,3,-2,3,-3,3,7,-2,-2,3,-2,3,8,3,3,3,3,3,7,TRUE,0,90,TRUE,1,60,TRUE,0,85,FALSE,1,65,TRUE,1,70,FALSE,1,55,TRUE,1,80,FALSE,0,60,TRUE,1,50,TRUE,1,80,FALSE,1,90,TRUE,0,90,TRUE,1,80,FALSE,1,50,TRUE,1,55,TRUE,1,70,TRUE,0,50,TRUE,0,70,FALSE,1,50,TRUE,0,60,FALSE,0,50,TRUE,1,50,FALSE,1,75,TRUE,1,70,FALSE,1,75,TRUE,1,80,TRUE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,75,FALSE,0,50,TRUE,1,90,0.36,0.04,0.09,0.04,0.01,0.2025,0.09,0.04,0.36,0.25,0.0625,0.04,0.25,0.01,0.09,0.16,0.0625,0.1225,0.25,0.0625,0.25,0.2025,0.25,0.25,0.25,0.25,0.25,0.81,0.7225,0.49,0.25,0.81,0.244553571,0.125,0.364107143,15,46.88,21,65.63,6,75,5,62.5,6,75,4,50,13,81.25,8,50,66.41,58.75,65,71.88,70,66.88,65.94,-18.75,0.78,-16.25,2.5,-3.12,20,-14.37,15.94,0,0,0,1,0,0,0,4,0,2,1,0,1,0,0,2,3,2,3,1,1,0,0,1,1,1,3,0,5,2,1,0,0,0,0,4,2,4,3,4,0.2,1.2,0.4,2.2,0.6,2.2,0.2,3.4,1,1.6,1.3,3.33,7.67,6,-0.4,-1,0.2,-1.2,-0.4,-6,-3,-4,1,-4.34,1,2,1,-2,2,1,-1,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),29,"None, thank you for the opportunity.",0.875,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,01DIR,2,4,3,5,9,7,6,1,8,4,3,2,1 +869,R_5SfD2exjwMqMkgW,25 - 31,American,,American,Female,Strongly disagree,Strongly agree,Agree,Strongly agree,Agree,3,4,2,5,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,4,3,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,5,2,1,4,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,3,2,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,1,4,2,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,2,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,4,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,2,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,32,-3,3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,3,3,10,3,3,3,3,3,0,3,3,3,3,3,0,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,32,100,16,50,4,50,4,50,4,50,4,50,16,100,0,0,50,50,50,50,50,50,50,50,0,0,0,0,0,-50,50,6,0,1,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2.4,0,0,0,1.6,0,0,0,0.6,0.4,0.5,0,3.33,1.25,0.8,0,0,0,0.266666667,0,-10,0,0,-3.33,2,2,2,2,-2,2,-2,2,-2,2,-2,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),27,Good Survey,0,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,5,9,6,8,3,4,7,1,2,3,2,4,1 +870,R_3ErRfDkZXc00MMA,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,2,4,1,5,3,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,2,3,1,5,4,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,2,1,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,3,2,5,4,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,1,3,4,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,Agree,2,5,4,3,1,7,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,3,Somewhat disagree,Agree,Disagree,Agree,Disagree,5,2,1,3,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,5,1,4,3,1,Somewhat agree,Somewhat agree,Agree,Strongly disagree,Strongly agree,1,2,4,5,3,4,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,2,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,2,1,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,55,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,51,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,75,FALSE,54,TRUE,100,TRUE,51,TRUE,100,FALSE,52,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,70,TRUE,52,TRUE,100,FALSE,51,FALSE,100,TRUE,65,FALSE,100,FALSE,59,TRUE,55,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,1,3,-1,1,2,-1,3,2,2,3,3,3,1,2,2,2,1,3,3,2,2,3,2,1,1,1,3,2,7,2,2,3,3,3,3,-1,2,-2,2,-2,8,3,3,2,2,3,1,1,1,2,-3,3,4,2,2,3,3,3,2,3,3,2,3,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,55,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,51,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,75,FALSE,0,54,TRUE,1,100,TRUE,0,51,TRUE,0,100,FALSE,1,52,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,52,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,65,FALSE,0,100,FALSE,0,59,TRUE,1,55,0,0,0,0,0.2025,0,0.09,0,0,0,1,0,0.2601,0,0,0,0,0.2025,0,0.2704,0,0.2916,0.2304,0.5625,0.2601,0.2401,0.3481,0,0,1,0.4225,0,0.192171429,0.125364286,0.258978571,12,37.5,23,71.88,5,62.5,6,75,5,62.5,7,87.5,12,75,11,68.75,84.06,65.25,83.88,90.88,96.25,86.81,81.31,-34.38,12.18,2.75,8.88,28.38,8.75,11.81,12.56,0,0,0,1,0,2,0,1,4,1,0,0,0,0,0,2,0,4,0,3,0,0,0,1,0,2,0,0,2,0,0,0,0,0,0,2,1,0,1,2,0.2,1.6,0,1.8,0.2,0.8,0,1.2,0.9,0.55,0.725,4,2.33,4,0,0.8,0,0.6,0.266666667,1,3,1,3,1.67,2,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),31,It'd be great to learn whether or not the general knowledge answers were correct in order to learn something new (or to not reinforce incorrect learnings)!,1.875,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,8,6,3,4,2,7,5,1,9,3,2,4,1 +871,R_5oQGSysi5uvMM2w,25 - 31,American,,American,Female,Neither agree nor disagree,Agree,Agree,Strongly agree,Strongly agree,4,3,1,2,5,Somewhat disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,1,4,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,5,3,1,Agree,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,2,4,1,4,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,1,5,3,2,4,8,Agree,Agree,Agree,Somewhat Agree,Agree,2,4,1,3,5,2,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Agree,Agree,Agree,Strongly Agree,5,3,1,4,2,4,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Agree,1,4,3,5,2,4,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Agree,5,3,4,2,1,3,Strongly Agree,Neither agree nor disagree,Agree,Agree,Agree,1,4,3,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,FALSE,50,TRUE,79,TRUE,65,FALSE,55,FALSE,50,TRUE,95,TRUE,95,TRUE,95,TRUE,70,FALSE,52,TRUE,80,TRUE,90,TRUE,65,TRUE,99,FALSE,59,TRUE,69,TRUE,59,TRUE,52,TRUE,71,TRUE,95,TRUE,70,TRUE,100,FALSE,55,TRUE,87,TRUE,100,FALSE,100,TRUE,55,TRUE,56,TRUE,100,FALSE,55,TRUE,88,14,0,2,2,3,3,-1,-2,3,-1,1,3,3,3,1,3,2,1,3,3,1,1,3,3,3,3,4,-2,0,3,1,3,4,2,2,2,1,2,8,1,3,3,1,2,2,0,2,2,2,3,3,0,-2,2,0,2,4,3,3,3,-1,2,4,3,0,2,2,2,3,TRUE,0,88,FALSE,0,55,TRUE,0,100,TRUE,0,56,TRUE,1,55,FALSE,1,100,TRUE,1,100,TRUE,1,87,FALSE,0,55,TRUE,1,100,TRUE,0,70,TRUE,0,95,TRUE,1,71,TRUE,0,52,TRUE,1,59,TRUE,1,69,FALSE,1,59,TRUE,0,99,TRUE,0,65,TRUE,0,90,TRUE,1,80,FALSE,0,52,TRUE,0,70,TRUE,1,95,TRUE,0,95,TRUE,1,95,FALSE,1,50,FALSE,1,55,TRUE,0,65,TRUE,1,79,FALSE,0,50,TRUE,1,75,0.0169,0.0025,0.0961,0,0.0625,0,0.0025,0,0.81,0.2704,0.0441,0.0841,0.3025,0.49,0.2025,0.3025,0.49,0.3136,0.2025,0.9025,0.04,0.1681,0.4225,0.2704,0.1681,0.25,0.25,0.7744,1,0.9801,0.4225,0.9025,0.361725,0.24105,0.4824,14,43.75,16,50,2,25,6,75,3,37.5,5,62.5,12,75,4,25,74.56,57.5,71.88,85.12,83.75,73.56,75.56,-6.25,24.56,32.5,-3.12,47.62,21.25,-1.44,50.56,1,1,1,0,0,1,2,0,2,2,1,1,1,0,1,1,2,0,2,1,0,0,0,1,0,1,0,1,1,1,0,0,0,2,1,1,1,1,1,1,0.6,1.4,0.8,1.2,0.2,0.8,0.6,1,1,0.65,0.825,5.33,3.67,4,0.4,0.6,0.2,0.2,0.4,1,0,4,-1,1.66,-1,-1,2,-2,2,2,-2,-1,1,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,Survey was very interesting ,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,9,7,3,4,2,5,8,1,6,3,2,4,1 +872,R_3qVx10RPM0TI7Du,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,5,2,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,3,1,4,5,2,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,2,3,4,1,5,Agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Somewhat agree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,4,2,3,1,5,8,Strongly agree,Somewhat agree,Agree,Somewhat agree,Agree,1,3,2,4,5,8,Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,4,5,2,1,3,7,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Agree,2,5,4,3,1,6,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Strongly agree,1,2,4,3,5,10,Somewhat Agree,Somewhat Agree,Agree,Agree,Strongly agree,5,1,4,2,3,7,Agree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,Somewhat agree,4,2,5,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,66,FALSE,55,TRUE,59,FALSE,62,FALSE,60,TRUE,66,FALSE,62,TRUE,59,TRUE,68,TRUE,79,FALSE,72,FALSE,65,FALSE,58,FALSE,69,TRUE,79,TRUE,63,TRUE,59,TRUE,63,FALSE,65,FALSE,72,TRUE,64,FALSE,79,TRUE,71,FALSE,67,TRUE,66,FALSE,80,TRUE,72,FALSE,62,TRUE,68,FALSE,64,TRUE,65,FALSE,65,24,3,3,3,3,3,1,3,2,3,2,2,1,0,3,1,2,0,1,3,1,0,1,0,1,2,7,3,1,2,1,2,8,2,1,3,3,2,8,0,1,0,1,2,7,3,3,2,1,2,9,-1,0,2,1,3,6,1,1,2,2,3,10,2,0,3,-1,1,7,FALSE,1,65,TRUE,1,65,FALSE,1,64,TRUE,0,68,FALSE,0,62,TRUE,0,72,FALSE,0,80,TRUE,1,66,FALSE,0,67,TRUE,1,71,FALSE,1,79,TRUE,0,64,FALSE,0,72,FALSE,1,65,TRUE,1,63,TRUE,1,59,TRUE,0,63,TRUE,0,79,FALSE,1,69,FALSE,1,58,FALSE,0,65,FALSE,0,72,TRUE,0,79,TRUE,1,68,TRUE,0,59,FALSE,0,62,TRUE,0,66,FALSE,1,60,FALSE,1,62,TRUE,1,59,FALSE,0,55,TRUE,1,66,0.1156,0.3844,0.1681,0.64,0.1156,0.5184,0.1024,0.0841,0.1764,0.5184,0.1681,0.5184,0.4489,0.0441,0.3844,0.1225,0.6241,0.4624,0.16,0.3481,0.4225,0.1369,0.0961,0.1225,0.3969,0.4356,0.3025,0.1225,0.1296,0.6241,0.1444,0.4096,0.290696429,0.3063,0.275092857,24,75,16,50,4,50,2,25,3,37.5,7,87.5,8,50,8,50,66.38,66.5,67.62,69.12,62.25,65.75,67,25,16.38,16.5,42.62,31.62,-25.25,15.75,17,3,2,3,2,1,2,2,0,2,0,0,0,3,0,1,2,1,1,2,1,0,0,1,2,1,2,3,0,2,1,1,0,2,1,2,0,0,2,4,0,2.2,1.2,0.8,1.4,0.8,1.6,1.2,1.2,1.4,1.2,1.3,7.67,8.33,7.75,1.4,-0.4,-0.4,0.2,0.2,-2,2,-2,0,-0.66,-1,0,-2,0,0,1,-1,2,-2,1,-1,-1,10 cents,100 minutes,24 days,Female,University - PhD,24,no,-1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,3,5,7,8,6,2,9,1,4,2,4,3,1 +873,R_7HCrIcsRpIc8QZX,18 - 24,American,,American,Male,Neither agree nor disagree,Somewhat agree,Strongly disagree,Strongly agree,Strongly agree,3,4,5,1,2,Strongly disagree,Neither agree nor disagree,Agree,Strongly disagree,Strongly agree,1,4,2,5,3,Disagree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,2,3,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Agree,Strongly Agree,2,1,5,3,4,Agree,Somewhat disagree,Somewhat agree,Strongly Agree,Somewhat disagree,4,1,2,3,5,10,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,4,3,2,5,1,10,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Disagree,Strongly Disagree,5,3,1,4,2,10,Neither agree nor disagree,Strongly disagree,Strongly disagree,Agree,Strongly disagree,5,3,4,1,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Strongly Agree,Strongly disagree,Strongly Agree,Strongly Agree,2,4,1,3,5,3,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,5,2,1,4,3,2,Strongly Disagree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,4,3,2,5,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,1,4,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,50,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,70,TRUE,90,TRUE,54,FALSE,100,FALSE,100,TRUE,100,FALSE,55,FALSE,100,TRUE,100,TRUE,60,FALSE,100,FALSE,53,FALSE,100,TRUE,100,TRUE,75,FALSE,100,TRUE,100,FALSE,60,TRUE,100,FALSE,56,FALSE,82,FALSE,75,FALSE,100,FALSE,100,FALSE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,1,-3,3,3,-3,0,2,-3,3,-2,-1,3,0,3,0,0,-1,2,3,2,-1,1,3,-1,10,-3,3,-3,3,-3,10,-3,3,-3,-3,-3,10,0,-3,-3,2,-3,10,-1,3,-3,3,3,3,-3,-3,0,-3,0,2,-3,-1,3,-3,3,2,-3,-3,-3,-3,-3,4,TRUE,0,70,TRUE,1,50,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,70,TRUE,1,90,TRUE,1,54,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,55,FALSE,0,100,TRUE,1,100,TRUE,0,60,FALSE,1,100,FALSE,1,53,FALSE,1,100,TRUE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,100,FALSE,1,60,TRUE,1,100,FALSE,1,56,FALSE,1,82,FALSE,1,75,FALSE,0,100,FALSE,0,100,FALSE,0,100,0.09,0,0,1,1,0,0,0.2116,0,0.0625,1,0,0.01,0,0,0.25,0,0,0.0324,0.16,0,1,0.2209,0.2025,0.36,0.1936,1,0.49,0,0,0.0625,0,0.223428571,0.181007143,0.26585,22,68.75,25,78.13,6,75,6,75,6,75,7,87.5,11,68.75,14,87.5,85.94,81.12,91.88,76.75,94,89.94,81.94,-9.38,7.81,6.12,16.88,1.75,6.5,21.19,-5.56,2,2,4,0,4,0,3,5,6,6,1,4,6,3,6,0,3,2,0,6,1,2,0,0,0,0,3,2,0,3,1,0,0,3,0,3,3,2,5,6,2.4,4,4,2.2,0.6,1.6,0.8,3.8,3.15,1.7,2.425,10,2.33,6.375,1.8,2.4,3.2,-1.6,2.466666667,7,8,8,6,7.67,2,2,0,-2,2,0,0,0,0,-2,2,1,5 cents,100 minutes,47 days,Male,High School (or equivalent),20,"no, thank you.",1.125,1,0,1,0,1,0,0.67,0.33,03VLPfPs,02COC,02FUT,01ITEM,01DIR,3,9,5,6,2,7,8,1,4,4,3,2,1 +874,R_6VPc11udpjyq5Td,18 - 24,,Canadian,Canadian,Female,Neither agree nor disagree,Agree,Agree,Strongly agree,Neither agree nor disagree,4,5,1,2,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Disagree,5,3,2,4,1,Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,1,2,5,Neither agree nor disagree,Agree,Somewhat agree,Strongly Agree,Somewhat disagree,5,1,4,3,2,5,Somewhat agree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,3,2,4,5,1,5,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Agree,Strongly Disagree,2,1,4,3,5,4,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,4,5,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,5,3,2,1,6,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,4,3,5,2,6,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,5,3,4,2,1,6,Strongly Agree,Strongly Agree,Agree,Agree,Somewhat agree,5,1,3,4,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,FALSE,92,TRUE,100,FALSE,93,TRUE,63,FALSE,77,TRUE,97,FALSE,75,TRUE,66,FALSE,82,FALSE,75,TRUE,95,TRUE,86,FALSE,100,TRUE,86,FALSE,59,TRUE,82,FALSE,95,FALSE,85,TRUE,65,TRUE,78,FALSE,67,TRUE,73,TRUE,66,TRUE,66,TRUE,67,FALSE,67,FALSE,92,TRUE,71,TRUE,93,FALSE,74,FALSE,87,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,2,2,3,0,-1,-1,1,0,0,1,1,1,1,-2,2,1,2,1,0,0,2,1,3,-1,5,1,0,2,2,0,5,0,-1,2,1,-3,4,1,2,1,0,1,6,2,3,3,3,1,6,2,1,0,-1,1,6,1,1,0,0,-3,6,3,3,2,2,1,5,TRUE,0,70,FALSE,0,92,TRUE,0,100,FALSE,1,93,TRUE,1,63,FALSE,1,77,TRUE,1,97,FALSE,0,75,TRUE,1,66,FALSE,0,82,FALSE,1,75,TRUE,0,95,TRUE,1,86,FALSE,1,100,TRUE,1,86,FALSE,0,59,TRUE,0,82,FALSE,1,95,FALSE,1,85,TRUE,0,65,TRUE,1,78,FALSE,0,67,TRUE,0,73,TRUE,1,66,TRUE,0,66,TRUE,1,67,FALSE,1,67,FALSE,1,92,TRUE,0,71,TRUE,1,93,FALSE,0,74,FALSE,0,87,0.5625,0.1089,0.3481,0.0009,0.7569,0.0529,0.1156,0.6724,0.4225,0.4489,0.0049,0.0196,0.1156,0.0625,0.1369,0.8464,0.5329,0.0049,0.0064,0.4356,0.0484,0.0196,0.0225,0,0.6724,0.1089,0.5476,0.49,1,0.0025,0.5041,0.9025,0.319764286,0.299492857,0.340035714,17,53.13,17,53.13,6,75,4,50,4,50,3,37.5,9,56.25,8,50,79.5,79.75,77.12,80.5,80.62,77.38,81.62,0,26.37,4.75,27.12,30.5,43.12,21.13,31.62,0,0,1,0,1,2,1,1,2,0,1,2,1,0,1,1,1,1,1,1,2,1,1,0,1,3,2,1,1,1,0,0,1,1,1,1,2,0,1,1,0.4,1.2,1,1,1,1.6,0.6,1,0.9,1.05,0.975,4.67,6,5.375,-0.6,-0.4,0.4,0,-0.2,-1,-1,-2,1,-1.33,1,2,1,0,0,0,0,1,-1,1,-1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,19,good,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,01DIR,4,2,7,9,5,3,6,1,8,4,2,3,1 +875,R_1VL3zORMuDfKsNo,25 - 31,American,,American,Female,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,5,4,1,3,Somewhat disagree,Disagree,Agree,Neither agree nor disagree,Somewhat disagree,4,2,5,1,3,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,4,5,2,1,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,2,5,4,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat agree,Strongly disagree,3,4,1,2,5,5,Disagree,Agree,Somewhat disagree,Agree,Somewhat disagree,5,1,4,3,2,9,Somewhat Disagree,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,2,3,5,1,4,10,Somewhat agree,Strongly Agree,Agree,Agree,Somewhat agree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Strongly Agree,Somewhat agree,Agree,Strongly disagree,2,4,3,5,1,7,Strongly disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,2,5,1,4,3,4,Strongly agree,Strongly agree,Somewhat Agree,Somewhat Disagree,Strongly agree,4,5,3,1,2,9,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,4,1,3,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,FALSE,50,TRUE,68,FALSE,75,FALSE,100,TRUE,100,FALSE,84,TRUE,93,FALSE,50,TRUE,50,TRUE,89,FALSE,100,FALSE,55,TRUE,81,TRUE,54,TRUE,68,FALSE,50,TRUE,70,TRUE,79,TRUE,74,FALSE,72,TRUE,100,TRUE,50,TRUE,50,TRUE,94,FALSE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,97,FALSE,100,15,1,3,0,-1,-1,-1,-2,2,0,-1,3,3,1,1,3,0,0,1,1,-2,3,3,-3,1,-3,5,-2,2,-1,2,-1,5,-1,2,3,3,-1,9,1,3,2,2,1,10,1,3,1,2,-3,5,-3,0,1,2,0,7,3,3,1,-1,3,4,-1,0,0,1,-3,9,FALSE,1,100,TRUE,1,97,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,94,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,72,TRUE,0,74,TRUE,1,79,TRUE,0,70,FALSE,0,50,TRUE,1,68,TRUE,0,54,TRUE,0,81,FALSE,1,55,FALSE,1,100,TRUE,1,89,TRUE,1,50,FALSE,1,50,TRUE,1,93,FALSE,1,84,TRUE,1,100,FALSE,1,100,FALSE,1,75,TRUE,0,68,FALSE,0,50,TRUE,1,50,TRUE,1,100,0.25,0,0.1024,0.0036,0,0,0.0049,0,0,0.25,0.25,0.0441,0.25,0.0784,0.25,0.0009,0.25,0.25,0.0625,0.0256,0.0121,0.25,0.2025,0.49,0.2916,0,0.25,0,1,0.6561,0.4624,0.5476,0.209953571,0.116307143,0.3036,15,46.88,23,71.88,7,87.5,5,62.5,6,75,5,62.5,13,81.25,10,62.5,75.09,65.5,73.75,84.88,76.25,73.12,77.06,-25,3.21,-22,11.25,9.88,13.75,-8.13,14.56,2,0,3,2,2,1,4,3,2,0,4,1,2,2,4,1,3,1,1,3,0,0,1,3,2,2,2,1,2,1,0,0,0,2,0,1,0,1,0,1,1.8,2,2.6,1.8,1.2,1.6,0.4,0.6,2.05,0.95,1.5,6.33,5.33,6.75,0.6,0.4,2.2,1.2,1.066666667,0,-2,5,1,1,0,2,1,-1,1,0,0,-2,2,-2,2,0,10 cents,100 minutes,15 days,Female,High School (or equivalent),28,I wish that we could see our results I'm curious about what I got right or wrong,1,0,0,0,1,1,0,0,0.67,02PsVLPf,02COC,02FUT,02DGEN,02REV,7,5,2,4,3,9,8,1,6,2,4,3,1 +876,R_5zc474LXAVKaI4f,25 - 31,American,,American,Female,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,3,5,2,Agree,Agree,Agree,Strongly agree,Strongly agree,3,4,5,1,2,Somewhat Agree,Agree,Agree,Agree,Somewhat Agree,1,5,3,2,4,Strongly disagree,Disagree,Strongly disagree,Somewhat disagree,Disagree,1,5,3,4,2,Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,1,2,5,4,3,5,Disagree,Agree,Agree,Disagree,Agree,4,5,3,2,1,7,Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,1,3,5,7,Strongly Agree,Strongly disagree,Agree,Agree,Somewhat agree,3,1,4,2,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,4,2,5,3,8,Somewhat agree,Strongly agree,Strongly agree,Agree,Somewhat agree,3,5,4,1,2,9,Agree,Somewhat Disagree,Agree,Strongly Agree,Somewhat Disagree,4,3,1,5,2,1,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,1,4,5,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,53,TRUE,100,TRUE,67,FALSE,72,TRUE,65,TRUE,100,TRUE,71,FALSE,64,FALSE,55,TRUE,54,FALSE,100,FALSE,53,FALSE,53,TRUE,99,TRUE,54,TRUE,71,FALSE,66,FALSE,100,FALSE,55,FALSE,55,TRUE,58,TRUE,54,TRUE,56,FALSE,54,TRUE,76,FALSE,54,TRUE,55,FALSE,56,TRUE,91,TRUE,56,FALSE,54,5,-3,-3,-3,-3,-3,2,2,2,3,3,1,2,2,2,1,-3,-2,-3,-1,-2,2,2,3,1,1,5,-2,2,2,-2,2,7,2,3,3,0,3,7,3,-3,2,2,1,6,0,3,3,2,3,8,1,3,3,2,1,9,2,-1,2,3,-1,1,1,2,3,1,0,7,FALSE,1,54,TRUE,1,56,TRUE,0,91,FALSE,1,56,TRUE,1,55,FALSE,1,54,TRUE,1,76,FALSE,0,54,TRUE,1,56,TRUE,1,54,TRUE,0,58,FALSE,1,55,FALSE,0,55,FALSE,1,100,FALSE,0,66,TRUE,1,71,TRUE,0,54,TRUE,0,99,FALSE,1,53,FALSE,1,53,FALSE,0,100,TRUE,1,54,FALSE,1,55,FALSE,0,64,TRUE,0,71,TRUE,1,100,TRUE,0,65,FALSE,1,72,TRUE,0,67,TRUE,1,100,TRUE,1,53,TRUE,1,100,0.2916,0,0.0841,0.0576,0,0.2116,0.4096,0.2116,0.2209,0.2116,0,0.3025,0.1936,0.3364,0.2025,0.1936,0.2025,0.1936,0.0784,0.5041,1,0.4356,0.2209,0,0.2916,0.4225,0.2209,0.2116,0.8281,0.9801,0.4489,0.2025,0.311971429,0.206428571,0.417514286,5,15.63,20,62.5,5,62.5,4,50,6,75,5,62.5,11,68.75,9,56.25,67.84,57.88,67.5,76,70,69.62,66.06,-46.87,5.34,-4.62,17.5,1,7.5,0.87,9.81,5,5,6,4,4,4,0,0,5,1,1,1,1,2,2,6,1,5,3,3,3,6,6,5,6,1,1,1,1,2,1,3,0,1,2,4,4,6,2,2,4.8,2,1.4,3.6,5.2,1.2,1.4,3.6,2.95,2.85,2.9,6.33,6,6.25,-0.4,0.8,0,0,0.133333333,-3,-2,6,-1,0.33,0,0,1,1,-1,1,-1,1,-1,1,-1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,Thanks alot,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,5,3,2,6,9,4,7,1,8,3,4,2,1 +877,R_3LXMNqKDKNC3lNT,25 - 31,American,,American,Female,Agree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,4,3,5,1,2,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,3,5,1,4,2,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,5,1,4,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,9,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,2,5,3,4,8,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,1,5,9,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Neither agree nor disagree,Disagree,Agree,1,3,4,2,5,10,Strongly agree,Disagree,Strongly agree,Disagree,Somewhat agree,2,1,5,3,4,10,Strongly agree,Agree,Strongly agree,Agree,Somewhat Agree,4,1,3,5,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,3,2,5,1,TRUE,95,FALSE,50,TRUE,77,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,55,FALSE,50,TRUE,80,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,57,FALSE,50,TRUE,91,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,50,FALSE,100,TRUE,100,FALSE,50,FALSE,50,TRUE,89,TRUE,75,FALSE,50,TRUE,93,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,0,2,0,0,2,2,2,0,3,1,3,1,2,0,0,0,0,-2,3,3,2,0,1,7,-3,0,1,0,-2,9,2,0,0,0,0,8,0,1,1,0,-3,9,3,3,0,-2,2,10,3,-2,3,-2,1,10,3,2,3,2,1,10,3,3,3,3,2,10,TRUE,0,95,FALSE,0,50,TRUE,0,77,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,55,FALSE,0,50,TRUE,1,80,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,1,57,FALSE,1,50,TRUE,0,91,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,50,TRUE,0,89,TRUE,1,75,FALSE,0,50,TRUE,1,93,0.2025,0,0.1849,0.25,0.0049,0.25,0.25,0.04,0.25,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.9025,0.5929,0.8281,0.7921,1,0.311535714,0.186242857,0.436828571,16,50,17,53.13,4,50,4,50,4,50,5,62.5,6,37.5,11,68.75,64.44,50,66.5,77,64.25,60,68.88,-3.13,11.31,0,16.5,27,1.75,22.5,0.13,1,1,2,2,1,3,2,1,2,2,1,1,3,1,2,0,1,1,0,1,1,1,0,4,2,3,4,1,4,1,0,1,0,1,1,3,3,3,3,4,1.4,2,1.6,0.6,1.6,2.6,0.6,3.2,1.4,2,1.7,8,10,9.125,-0.2,-0.6,1,-2.6,0.066666667,-3,-1,-2,-1,-2,1,1,0,0,0,0,0,0,0,-2,2,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),31,This was an interesting survey; it had me think critically about my answers.,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,8,5,7,3,6,4,2,1,9,3,2,4,1 +878,R_5Hqcf3bOOCH1Sq5,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,4,3,Neither agree nor disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,3,1,Strongly Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,3,1,4,5,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,1,2,4,5,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,TRUE,75,FALSE,50,TRUE,62,FALSE,60,FALSE,56,FALSE,60,TRUE,66,TRUE,70,FALSE,50,TRUE,84,FALSE,67,FALSE,70,FALSE,67,FALSE,57,FALSE,59,TRUE,100,FALSE,55,FALSE,50,FALSE,50,FALSE,50,TRUE,68,TRUE,74,FALSE,100,FALSE,50,FALSE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,60,TRUE,66,TRUE,50,TRUE,100,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,1,1,0,3,-1,0,0,-3,-2,2,0,2,-1,0,-1,0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,-3,0,0,0,5,TRUE,0,75,FALSE,0,50,TRUE,0,62,FALSE,1,60,FALSE,0,56,FALSE,1,60,TRUE,1,66,TRUE,1,70,FALSE,0,50,TRUE,1,84,FALSE,1,67,FALSE,1,70,FALSE,0,67,FALSE,1,57,FALSE,0,59,TRUE,1,100,FALSE,1,55,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,68,TRUE,1,74,FALSE,1,100,FALSE,0,50,FALSE,1,100,FALSE,0,50,FALSE,1,50,FALSE,1,50,TRUE,0,60,TRUE,1,66,TRUE,1,50,TRUE,1,100,0.09,0.25,0,0.1156,0,0.16,0.25,0.0256,0.25,0.0676,0.1156,0.4489,0.25,0.1089,0.3136,0.25,0,0.16,0.25,0,0.1024,0.3481,0.25,0.1849,0.2025,0.25,0.25,0.5625,0.3844,0.25,0.36,0.09,0.210178571,0.171442857,0.248914286,8,25,22,68.75,5,62.5,5,62.5,6,75,6,75,9,56.25,13,81.25,64.88,54.5,70.75,69.5,64.75,66.25,63.5,-43.75,-3.87,-8,8.25,-5.5,-10.25,10,-17.75,1,1,1,1,1,0,3,1,0,0,3,2,2,0,2,1,0,1,0,0,1,1,1,1,1,0,3,1,0,0,3,2,2,0,2,1,3,1,0,0,1,0.8,1.8,0.4,1,0.8,1.8,1,1,1.15,1.075,6,5,5.375,0,0,0,-0.6,0,0,1,2,0,1,0,1,1,-2,2,0,0,0,0,-2,2,1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,20,It was a odd survey. Felt kind of stupid afterword's lol.,0.875,0,0,0,1,1,0,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,4,3,6,9,8,7,2,1,5,4,3,2,1 +879,R_5JyjqEE5uYRgVqe,18 - 24,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Strongly agree,3,2,1,5,4,Somewhat agree,Disagree,Agree,Somewhat agree,Somewhat agree,1,4,3,2,5,Somewhat Agree,Disagree,Agree,Disagree,Somewhat Agree,4,1,5,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,5,3,1,2,4,Somewhat agree,Agree,Agree,Disagree,Somewhat disagree,4,1,2,3,5,6,Strongly agree,Somewhat disagree,Agree,Strongly disagree,Somewhat disagree,2,4,1,3,5,4,Strongly Agree,Disagree,Disagree,Somewhat Agree,Disagree,1,2,4,3,5,7,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Somewhat agree,Strongly Agree,5,3,1,2,4,2,Agree,Strongly disagree,Strongly agree,Disagree,Agree,5,4,1,2,3,4,Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Agree,1,4,2,3,5,2,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,4,3,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,91,FALSE,54,TRUE,91,TRUE,59,TRUE,85,FALSE,100,TRUE,70,TRUE,70,FALSE,51,TRUE,97,FALSE,76,TRUE,60,TRUE,96,FALSE,100,TRUE,86,TRUE,75,TRUE,65,FALSE,100,FALSE,54,FALSE,81,FALSE,97,FALSE,50,FALSE,92,TRUE,92,FALSE,92,TRUE,99,TRUE,55,FALSE,74,FALSE,65,FALSE,59,FALSE,50,TRUE,99,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,3,1,-2,2,1,1,1,-2,2,-2,1,1,1,1,2,2,1,2,2,-2,-1,6,3,-1,2,-3,-1,4,3,-2,-2,1,-2,7,2,2,2,2,2,3,3,2,2,1,3,2,2,-3,3,-2,2,4,2,-1,3,-1,2,2,2,2,3,2,3,5,TRUE,0,91,FALSE,0,54,TRUE,0,91,TRUE,0,59,TRUE,1,85,FALSE,1,100,TRUE,1,70,TRUE,1,70,FALSE,0,51,TRUE,1,97,FALSE,1,76,TRUE,0,60,TRUE,1,96,FALSE,1,100,TRUE,1,86,TRUE,1,75,TRUE,0,65,FALSE,1,100,FALSE,1,54,FALSE,1,81,FALSE,0,97,FALSE,0,50,FALSE,1,92,TRUE,1,92,FALSE,1,92,TRUE,1,99,TRUE,0,55,FALSE,1,74,FALSE,1,65,FALSE,0,59,FALSE,0,50,TRUE,1,99,0.09,0.0001,0.0625,0.09,0.0001,0,0.0064,0.0009,0.0361,0.25,0.3481,0.0016,0.2601,0.0576,0.0225,0.2916,0.0064,0.3481,0.0676,0.0064,0.9409,0.0196,0.2116,0,0.4225,0.3025,0.25,0.8281,0.8281,0,0.1225,0.36,0.213903571,0.116392857,0.311414286,21,65.63,20,62.5,3,37.5,6,75,6,75,5,62.5,10,62.5,10,62.5,77.66,60.62,87.38,87.38,75.25,76.88,78.44,3.13,15.16,23.12,12.38,12.38,12.75,14.38,15.94,1,0,0,4,4,2,1,0,4,2,2,0,4,3,3,1,1,1,0,0,1,0,0,1,0,1,1,1,3,1,1,1,1,1,1,1,1,2,0,1,1.8,1.8,2.4,0.6,0.4,1.4,1,1,1.65,0.95,1.3,5.67,2.67,4.125,1.4,0.4,1.4,-0.4,1.066666667,4,0,5,-2,3,1,2,2,-2,2,-1,1,-2,2,-2,2,1,10 cents,5 minutes,15 days,Female,University - Undergraduate,21,,1.625,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,6,4,7,9,3,2,8,1,5,3,2,4,1 +880,R_7XiaGit9PpgYp8Y,25 - 31,American,,American,Male,Strongly agree,Agree,Agree,Agree,Strongly agree,1,5,3,2,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,5,1,4,3,2,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,4,5,2,3,1,Agree,Somewhat agree,Agree,Strongly Agree,Agree,2,4,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,2,1,4,3,5,8,Somewhat agree,Agree,Somewhat agree,Agree,Strongly agree,5,1,2,4,3,9,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,4,1,2,5,3,8,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Somewhat agree,Strongly Agree,Agree,Agree,1,2,3,5,4,9,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,5,3,2,1,4,9,Strongly agree,Agree,Somewhat Agree,Agree,Somewhat Agree,5,3,4,1,2,9,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,2,3,5,1,4,TRUE,84,TRUE,85,TRUE,91,TRUE,76,TRUE,64,TRUE,71,TRUE,71,TRUE,70,FALSE,93,TRUE,100,TRUE,85,FALSE,89,TRUE,76,TRUE,92,TRUE,87,TRUE,79,FALSE,96,TRUE,81,FALSE,74,TRUE,90,FALSE,82,TRUE,79,TRUE,82,FALSE,90,TRUE,88,TRUE,81,FALSE,92,TRUE,87,TRUE,92,FALSE,87,TRUE,83,FALSE,89,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,2,3,-1,0,1,2,-1,2,1,1,3,2,2,1,2,3,2,1,3,2,3,1,9,1,2,1,2,3,8,2,2,1,1,3,9,2,1,2,0,2,8,2,1,3,2,2,9,1,3,2,3,2,9,3,2,1,2,1,9,1,3,1,3,2,9,TRUE,0,84,TRUE,1,85,TRUE,0,91,TRUE,0,76,TRUE,1,64,TRUE,0,71,TRUE,1,71,TRUE,1,70,FALSE,0,93,TRUE,1,100,TRUE,0,85,FALSE,1,89,TRUE,1,76,TRUE,0,92,TRUE,1,87,TRUE,1,79,FALSE,1,96,TRUE,0,81,FALSE,1,74,TRUE,0,90,FALSE,0,82,TRUE,1,79,TRUE,0,82,FALSE,0,90,TRUE,0,88,TRUE,1,81,FALSE,1,92,TRUE,0,87,TRUE,0,92,FALSE,0,87,TRUE,1,83,FALSE,0,89,0.09,0.0361,0.0441,0.0841,0.7921,0.5041,0.81,0,0.81,0.0441,0.7569,0.0576,0.8649,0.7225,0.1296,0.0225,0.6724,0.5776,0.7569,0.7744,0.6724,0.0169,0.0676,0.8464,0.0016,0.0064,0.0289,0.7056,0.8281,0.6561,0.8464,0.0121,0.463717857,0.483164286,0.444271429,27,84.38,15,46.88,5,62.5,3,37.5,4,50,3,37.5,11,68.75,4,25,83.94,84.38,81.5,84.5,85.38,82.25,85.62,37.5,37.06,21.88,44,34.5,47.88,13.5,60.62,2,1,0,1,2,2,2,0,0,4,0,1,0,2,1,0,0,0,3,0,1,1,1,0,1,2,3,1,1,3,1,1,0,1,1,1,2,1,0,0,1.2,1.6,0.8,0.6,0.8,2,0.8,0.8,1.05,1.1,1.075,8.67,9,8.75,0.4,-0.4,0,-0.2,0,0,-1,0,-1,-0.33,1,1,0,0,0,1,-1,1,-1,0,0,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),26,i dont really know,0.125,0,1,0,1,0,1,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,3,5,9,4,6,8,7,1,2,3,4,2,1 +881,R_3T8yCDUypN1CDZL,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,1,5,4,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,3,2,5,Strongly Agree,Agree,Agree,Strongly Agree,Strongly Agree,1,2,4,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,10,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,2,4,5,9,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,2,3,1,10,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,5,1,3,4,2,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,4,5,9,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,2,3,5,4,10,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,4,3,2,7,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,1,2,5,4,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,84,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,99,TRUE,100,FALSE,97,32,3,3,3,3,3,3,-3,3,-3,3,3,2,3,3,3,3,2,2,3,3,3,3,3,3,3,10,3,-3,3,-3,3,9,3,2,3,3,3,10,2,3,3,3,2,9,2,2,3,3,3,9,3,-3,3,-3,3,10,3,3,2,2,3,7,3,2,3,2,1,9,FALSE,1,97,TRUE,1,100,TRUE,0,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,84,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.0256,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0.0009,0.9801,0,0,0,0.106464286,0.071428571,0.1415,32,100,29,90.63,8,100,7,87.5,8,100,6,75,15,93.75,14,87.5,99.38,100,100,99.62,97.88,99,99.75,9.37,8.75,0,12.5,-0.38,22.88,5.25,12.25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,2,0,0,0,0.8,0.4,0,0.6,0.8,0.2,0.45,0.325,9.67,8.67,9.125,-0.4,0,-0.6,0,-0.333333333,1,-1,3,0,1,-2,2,2,-2,2,0,0,1,-1,-2,2,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),25,"I loved it +",0.625,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,01ITEM,02REV,7,4,3,9,5,2,8,1,6,2,4,3,1 +882,R_1mfxtXmWuzrRwfr,25 - 31,,Canadian,Canadian,Female,Agree,Agree,Agree,Disagree,Agree,1,3,4,5,2,Strongly agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,5,1,3,4,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,4,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,5,4,1,2,3,Strongly disagree,Somewhat disagree,Strongly Agree,Strongly disagree,Strongly Agree,2,1,4,3,5,7,Somewhat disagree,Disagree,Agree,Strongly agree,Strongly agree,3,1,5,2,4,5,Strongly Agree,Neither Agree nor Disagree,Disagree,Strongly Agree,Strongly Disagree,5,4,3,1,2,7,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Strongly disagree,Disagree,1,2,5,4,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,3,4,1,2,5,3,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,2,1,5,4,3,2,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,3,4,5,1,2,4,Agree,Neither agree nor disagree,Agree,Agree,Strongly Agree,4,2,3,1,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,60,TRUE,50,FALSE,100,TRUE,50,FALSE,75,FALSE,100,TRUE,50,TRUE,100,TRUE,80,FALSE,75,TRUE,50,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,85,TRUE,96,FALSE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,80,TRUE,70,FALSE,100,FALSE,50,TRUE,50,TRUE,85,TRUE,75,TRUE,100,FALSE,50,FALSE,50,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,-2,2,3,1,2,1,1,0,3,3,3,2,0,0,-1,0,1,-3,-1,3,-3,3,7,-1,-2,2,3,3,5,3,0,-2,3,-3,7,0,3,0,-3,-2,6,2,0,2,1,0,3,3,1,3,0,-1,2,0,3,3,3,1,4,2,0,2,2,3,7,FALSE,1,60,TRUE,1,50,FALSE,1,100,TRUE,0,50,FALSE,0,75,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,1,80,FALSE,0,75,TRUE,0,50,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,85,TRUE,0,96,FALSE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,80,TRUE,1,70,FALSE,1,100,FALSE,0,50,TRUE,0,50,TRUE,0,85,TRUE,0,75,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0.25,0,0.25,0.25,0,0.09,0.5625,0.25,0,0,0,0.04,0.25,0.5625,0.25,0.04,0.25,0.7225,0,0,0.25,0.25,0,0.7225,0.25,0.25,0.16,0,0.9216,0.5625,1,0.272646429,0.181785714,0.363507143,10,31.25,17,53.13,3,37.5,4,50,5,62.5,5,62.5,10,62.5,7,43.75,75.97,53.75,83.12,78.88,88.12,75,76.94,-21.88,22.84,16.25,33.12,16.38,25.62,12.5,33.19,5,3,1,1,1,4,3,0,2,2,3,3,5,0,5,0,3,1,3,3,0,2,0,3,2,0,0,1,1,2,0,0,0,0,1,2,0,3,2,2,2.2,2.2,3.2,2,1.4,0.8,0.2,1.8,2.4,1.05,1.725,6.33,3,5.125,0.8,1.4,3,0.2,1.733333333,4,3,3,-1,3.33,0,1,0,-2,2,2,-2,0,0,-1,1,0,10 cents,100 minutes,47 days,Female,University - Undergraduate,25,,0.25,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,8,6,4,2,3,7,5,1,9,2,3,4,1 +883,R_35WM3rWzxA5ZeWL,18 - 24,,Canadian,Canadian,Female,Agree,Agree,Somewhat disagree,Strongly agree,Strongly agree,5,1,2,3,4,Agree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,1,4,2,5,3,Strongly Agree,Strongly Disagree,Agree,Strongly Agree,Somewhat Disagree,3,1,2,4,5,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly disagree,3,5,1,2,4,10,Disagree,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,3,4,5,2,1,7,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Disagree,Strongly Disagree,4,3,2,1,5,5,Strongly disagree,Somewhat agree,Strongly disagree,Strongly Agree,Strongly disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Strongly Agree,Disagree,Somewhat agree,Strongly Agree,1,5,4,2,3,3,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,2,5,4,1,3,1,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Disagree,5,1,2,3,4,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,5,1,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,60,FALSE,50,TRUE,53,TRUE,100,TRUE,50,TRUE,50,TRUE,80,FALSE,100,TRUE,65,FALSE,50,FALSE,50,TRUE,51,FALSE,50,TRUE,55,TRUE,100,TRUE,50,TRUE,64,TRUE,50,FALSE,50,FALSE,50,TRUE,84,FALSE,53,TRUE,66,TRUE,81,TRUE,57,FALSE,50,TRUE,53,TRUE,70,TRUE,50,TRUE,54,FALSE,50,TRUE,78,9,2,2,-1,3,3,2,3,3,-1,1,3,-3,2,3,-1,3,1,3,3,0,3,2,3,3,-3,5,-2,3,-1,3,-3,10,1,3,1,-3,-3,7,-3,1,-3,3,-3,5,2,3,-2,1,3,3,2,0,3,-1,3,3,3,-3,3,3,-2,1,3,3,3,2,1,4,TRUE,0,78,FALSE,0,50,TRUE,0,54,TRUE,0,50,TRUE,1,70,TRUE,0,53,FALSE,0,50,TRUE,1,57,TRUE,1,81,TRUE,1,66,FALSE,1,53,TRUE,0,84,FALSE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,64,TRUE,0,50,TRUE,0,100,TRUE,0,55,FALSE,1,50,TRUE,1,51,FALSE,0,50,FALSE,1,50,TRUE,1,65,FALSE,1,100,TRUE,1,80,TRUE,0,50,TRUE,0,50,TRUE,0,100,TRUE,1,53,FALSE,0,50,TRUE,1,60,0.1849,0.04,0.1296,0.25,0.16,0.2809,0.1225,0.1156,0.25,0.25,0.2209,0.25,0.0361,0.2209,0.09,0.25,0.25,0.25,0.25,0,0.2401,0.25,0.3025,0.25,0.25,0.25,0.25,0.6084,0.2916,1,1,0.7056,0.299825,0.196207143,0.403442857,9,28.13,16,50,3,37.5,4,50,4,50,5,62.5,11,68.75,5,31.25,61.69,54.88,60.5,71.75,59.62,59.19,64.19,-21.87,11.69,17.38,10.5,21.75,-2.88,-9.56,32.94,1,0,4,0,6,4,0,4,4,4,2,6,1,6,2,6,0,6,0,3,0,1,1,2,0,0,3,0,0,2,0,0,1,0,1,0,2,0,1,1,2.2,3.2,3.4,3,0.8,1,0.4,0.8,2.95,0.75,1.85,7.33,2.33,4.75,1.4,2.2,3,2.2,2.2,2,7,6,1,5,0,1,1,1,-1,0,0,1,-1,-2,2,-1,10 cents,5 minutes,47 days,Female,University - Undergraduate,21,"I really liked this, it was engaging",0.125,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,02DGEN,02REV,2,6,5,4,9,7,8,1,3,3,2,4,1 +884,R_7ReKyF7BtGzjQc0,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Neither agree nor disagree,2,4,5,3,1,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly agree,Somewhat agree,1,2,4,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,2,5,4,1,3,Strongly disagree,Disagree,Disagree,Strongly disagree,Somewhat disagree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,1,5,2,1,Somewhat disagree,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,2,3,5,4,1,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,4,2,5,1,3,1,Disagree,Disagree,Disagree,Disagree,Disagree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,3,4,3,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,2,1,3,4,3,Agree,Agree,Agree,Strongly Disagree,Agree,4,2,3,5,1,0,Disagree,Disagree,Disagree,Disagree,Disagree,5,4,3,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,89,TRUE,94,TRUE,97,FALSE,94,FALSE,50,TRUE,66,FALSE,93,TRUE,82,FALSE,100,FALSE,60,FALSE,100,FALSE,80,FALSE,59,TRUE,83,TRUE,92,TRUE,91,FALSE,91,FALSE,86,TRUE,89,TRUE,94,FALSE,93,TRUE,100,FALSE,89,TRUE,98,TRUE,85,FALSE,100,TRUE,87,FALSE,89,TRUE,72,FALSE,63,TRUE,93,8,3,3,2,-1,0,0,-3,1,3,1,1,1,1,-3,1,-3,-2,-2,-3,-1,3,2,1,1,0,3,-1,-3,-1,1,0,1,1,1,1,-3,1,2,-2,-2,-2,-2,-2,1,2,3,2,0,0,2,0,-3,0,1,1,3,2,2,2,-3,2,3,-2,-2,-2,-2,-2,0,TRUE,0,93,FALSE,0,63,TRUE,0,72,FALSE,1,89,TRUE,1,87,FALSE,1,100,TRUE,1,85,TRUE,1,98,FALSE,0,89,TRUE,1,100,FALSE,1,93,TRUE,0,94,TRUE,1,89,FALSE,1,86,FALSE,0,91,TRUE,1,91,TRUE,0,92,TRUE,0,83,FALSE,1,59,FALSE,1,80,FALSE,0,100,FALSE,0,60,FALSE,1,100,TRUE,1,82,FALSE,1,93,TRUE,1,66,FALSE,1,50,FALSE,1,94,TRUE,0,97,TRUE,1,94,FALSE,0,89,TRUE,1,100,0.0004,0.1156,0.0081,0.0225,0,0,0.0324,0,0.04,0.36,0.0036,0.0121,0.7921,0.0049,0.0169,0.3969,0,0.0121,0.0036,0.0049,1,0.8281,0.1681,0.0196,0.8464,0.25,0.7921,0.8649,0.5184,0.6889,0.9409,0.8836,0.338589286,0.119357143,0.557821429,8,25,20,62.5,4,50,5,62.5,5,62.5,6,75,10,62.5,10,62.5,86.22,77.88,95.62,83.25,88.12,86.5,85.94,-37.5,23.72,27.88,33.12,20.75,13.12,24,23.44,0,1,1,2,0,1,0,2,2,1,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0,0,0,1,2,0,1,1,1,0,1,1,0,0,1,1,0.8,1.2,0,0.6,0.4,0.6,0.8,0.6,0.65,0.6,0.625,2,2.67,1.875,0.4,0.6,-0.8,0,0.066666667,1,-2,-1,1,-0.67,-1,-1,1,-2,2,1,-1,-1,1,-1,1,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,it was good,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,4,2,6,5,7,9,8,1,3,2,3,4,1 +885,R_1zSef5kmP9u9TPo,25 - 31,American,,American,Prefer not to say,Agree,Agree,Agree,Agree,Agree,1,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,5,1,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,1,2,3,5,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,1,4,3,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Agree,2,5,4,3,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Agree,Agree,4,3,1,2,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,1,2,4,3,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,4,2,1,5,3,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,3,5,2,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,55,FALSE,100,TRUE,53,TRUE,100,FALSE,100,TRUE,53,TRUE,100,TRUE,100,FALSE,71,TRUE,53,TRUE,100,TRUE,100,TRUE,69,TRUE,65,TRUE,100,TRUE,63,FALSE,100,FALSE,100,TRUE,57,TRUE,60,TRUE,64,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,65,FALSE,61,TRUE,100,TRUE,100,FALSE,60,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,0,0,2,0,2,0,0,2,0,2,0,0,0,0,0,3,3,3,3,3,1,0,0,2,1,2,3,0,0,2,2,2,1,0,0,0,0,0,1,3,3,3,3,3,3,0,0,2,0,2,1,0,0,2,1,2,1,-1,-1,-1,-1,-1,1,FALSE,1,100,FALSE,0,55,FALSE,1,100,TRUE,0,53,TRUE,1,100,FALSE,1,100,TRUE,1,53,TRUE,1,100,TRUE,1,100,FALSE,0,71,TRUE,0,53,TRUE,0,100,TRUE,1,100,TRUE,0,69,TRUE,1,65,TRUE,1,100,TRUE,0,63,FALSE,1,100,FALSE,1,100,TRUE,0,57,TRUE,1,60,TRUE,1,64,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,65,FALSE,1,61,TRUE,0,100,TRUE,1,100,FALSE,0,60,TRUE,1,100,0,0,0,0.2209,0,0,0,0.5041,0.3249,0.1296,0,0,0,0.2809,0,0.3025,0,0.2809,0.1521,0,0.16,0.1225,0,0.4761,0.3969,0.4225,0.36,0,0,0,1,1,0.211178571,0.130207143,0.29215,16,50,21,65.63,3,37.5,6,75,6,75,6,75,13,81.25,8,50,82.78,68.88,90.38,82.12,89.75,83,82.56,-15.63,17.15,31.38,15.38,7.12,14.75,1.75,32.56,1,1,1,1,1,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0.2,0.4,0,1,0,0.2,1,0.4,0.55,0.475,1.67,1.67,1.5,0,0.2,0.2,-1,0.133333333,-2,2,0,0,0,2,2,2,-2,2,0,0,0,0,-2,2,2,10 cents,100 minutes,24 days,Prefer not to say,University - Graduate (Masters),31,Interesting survey unsure of what the actual reason is for ,1.5,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,8,5,9,3,6,4,7,1,2,3,4,2,1 +886,R_5yaxFqyivv3pIQM,18 - 24,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,3,5,4,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,3,5,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,6,Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,5,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly disagree,2,4,3,5,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,2,4,4,Strongly Agree,Agree,Agree,Strongly Agree,Strongly Agree,4,5,1,2,3,4,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,61,TRUE,84,TRUE,83,TRUE,79,TRUE,67,TRUE,81,TRUE,74,TRUE,86,FALSE,89,FALSE,83,TRUE,82,FALSE,65,FALSE,68,TRUE,77,FALSE,79,FALSE,76,FALSE,75,FALSE,58,FALSE,72,TRUE,89,FALSE,79,TRUE,76,TRUE,83,FALSE,72,TRUE,68,TRUE,80,FALSE,73,FALSE,85,TRUE,72,TRUE,100,FALSE,61,24,2,3,3,-3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,-3,5,0,0,0,0,0,6,2,1,3,3,3,5,3,3,3,3,3,4,3,3,3,-3,-3,3,3,3,3,3,3,4,3,2,2,3,3,4,0,0,3,0,0,3,FALSE,1,61,TRUE,1,100,TRUE,0,72,FALSE,1,85,FALSE,0,73,TRUE,0,80,TRUE,1,68,FALSE,0,72,TRUE,1,83,TRUE,1,76,FALSE,1,79,TRUE,0,89,FALSE,0,72,FALSE,1,58,FALSE,0,75,FALSE,0,76,FALSE,1,79,TRUE,0,77,FALSE,1,68,FALSE,1,65,TRUE,1,82,FALSE,0,83,FALSE,1,89,TRUE,1,86,TRUE,0,74,TRUE,1,81,TRUE,0,67,TRUE,0,79,TRUE,0,83,TRUE,1,84,TRUE,1,61,TRUE,1,100,0.5184,0.0361,0.5776,0.1024,0,0.64,0.0196,0.0576,0.1225,0.6889,0.0256,0.5184,0.0289,0.0441,0.5329,0,0.0121,0.0225,0.6241,0.5476,0.0324,0.5625,0.1024,0.1764,0.0441,0.4489,0.1521,0.1521,0.5184,0.5929,0.6889,0.7921,0.291,0.193792857,0.388207143,24,75,18,56.25,6,75,4,50,5,62.5,3,37.5,10,62.5,8,50,77.41,77.25,82.25,72.25,77.88,79.5,75.31,18.75,21.16,2.25,32.25,9.75,40.38,17,25.31,0,0,0,6,0,3,3,3,3,3,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,3,3,0,3,3,1.2,3,0.6,0,0.2,0,0.4,2.4,1.2,0.75,0.975,5.33,3.67,4.25,1,3,0.2,-2.4,1.4,2,2,1,1,1.66,1,0,-2,0,0,-1,1,1,-1,2,-2,-2,20 cents,100 minutes,36 days,Female,High School (or equivalent),23,cool,-0.625,0,0,0,0,1,0,0,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,4,6,8,5,3,9,7,1,2,4,2,3,1 +887,R_6UVBLYH5Wp8n5Ci,32 - 38,American,,American,Female,Agree,Strongly agree,Agree,Agree,Strongly agree,2,5,1,3,4,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,3,2,5,4,1,Strongly Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,4,3,2,Agree,Agree,Agree,Agree,Agree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Somewhat agree,Agree,5,2,4,1,3,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,2,5,4,1,1,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,2,3,5,1,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Agree,Agree,Agree,3,2,5,4,1,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,4,3,1,5,1,Strongly agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,1,2,5,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,1,5,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,2,3,2,-1,2,-1,2,3,2,3,0,3,2,2,2,2,2,2,2,2,1,2,1,1,0,1,-1,-1,1,3,1,2,0,2,1,-1,0,0,1,-1,1,2,2,2,2,2,1,2,-1,2,-1,1,1,3,1,2,0,2,1,1,1,1,1,1,1,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0.25,0.142857143,0.357142857,27,84.38,25,78.13,8,100,5,62.5,7,87.5,5,62.5,14,87.5,11,68.75,100,100,100,100,100,100,100,6.25,21.87,0,37.5,12.5,37.5,12.5,31.25,0,1,0,1,1,1,1,1,0,3,0,1,1,0,1,3,2,2,1,3,0,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0.6,1.2,0.6,2.2,0.4,0.2,0.6,1,1.15,0.55,0.85,1,1,1,0.2,1,0,1.2,0.4,0,0,0,0,0,1,1,1,-2,2,0,0,1,-1,-1,1,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),32,,0.75,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,02DGEN,01DIR,6,8,5,3,2,7,9,1,4,3,2,4,1 +888,R_7gbZbs5pz5pzmpN,18 - 24,American,,American,Male,Somewhat disagree,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,2,1,5,4,3,Agree,Disagree,Strongly agree,Disagree,Somewhat agree,2,3,4,1,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Agree,3,2,5,1,4,Somewhat agree,Somewhat agree,Disagree,Disagree,Disagree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Somewhat agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,1,4,3,5,2,8,Disagree,Somewhat disagree,Strongly disagree,Agree,Agree,4,3,1,5,2,7,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,5,3,1,2,4,7,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,4,1,5,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Somewhat agree,Strongly Agree,Somewhat agree,Agree,Somewhat agree,4,5,3,1,2,3,Strongly agree,Disagree,Agree,Strongly disagree,Agree,2,4,1,5,3,7,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Strongly agree,3,1,4,5,2,7,Agree,Agree,Agree,Strongly Agree,Neither agree nor disagree,1,2,5,3,4,FALSE,100,TRUE,75,FALSE,80,FALSE,50,TRUE,91,FALSE,50,TRUE,55,FALSE,80,TRUE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,75,FALSE,70,TRUE,50,TRUE,100,TRUE,70,TRUE,75,TRUE,50,FALSE,70,TRUE,75,TRUE,100,TRUE,80,TRUE,100,FALSE,100,TRUE,80,TRUE,50,FALSE,50,TRUE,75,TRUE,90,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,1,2,0,2,-2,3,-2,1,1,0,2,2,2,1,1,-2,-2,-2,0,1,3,-1,0,8,-2,-1,-3,2,2,8,1,2,0,-1,2,7,-3,-1,-3,-3,0,7,1,3,1,2,1,10,3,-2,2,-3,2,3,1,0,2,2,3,7,2,2,2,3,0,7,FALSE,1,100,TRUE,1,75,FALSE,1,80,FALSE,1,50,TRUE,1,91,FALSE,1,50,TRUE,1,55,FALSE,0,80,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,75,FALSE,1,70,TRUE,1,50,TRUE,1,100,TRUE,0,70,TRUE,0,75,TRUE,0,50,FALSE,1,70,TRUE,1,75,TRUE,1,100,TRUE,0,80,TRUE,1,100,FALSE,1,100,TRUE,1,80,TRUE,0,50,FALSE,1,50,TRUE,0,75,TRUE,1,90,FALSE,0,50,TRUE,1,100,0.64,0.04,0,0.2025,0,0.25,0,0,0.09,0,0.01,0.0625,0.25,0.25,0.0081,0.0625,0.64,0.25,0.25,0,0.0625,0.25,0.25,0.09,0.49,0.25,0.25,0,0.04,0.5625,0.5625,1,0.211807143,0.133792857,0.289821429,16,50,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,74.72,53.12,77,85,83.75,79.44,70,-21.88,2.84,-9.38,14.5,-2.5,8.75,-8.06,13.75,1,2,2,3,0,4,1,6,4,1,0,2,2,3,0,4,2,1,1,2,2,0,0,0,1,1,0,1,1,1,0,0,0,0,1,1,1,4,5,2,1.6,3.2,1.4,2,0.6,0.8,0.2,2.6,2.05,1.05,1.55,7.67,6.67,7.125,1,2.4,1.2,-0.6,1.533333333,-2,5,0,0,1,2,2,1,-2,2,0,0,-1,1,-2,2,2,10 cents,100 minutes,36 days,Male,High School (or equivalent),21,"Your trick questions were fun,the true vs false statements were interesting. I do wish I could see which ones I was correct on however!",1.5,0,0,0,1,1,0,0,0.67,04LPfPsV,02COC,01PAST,02DGEN,01DIR,9,4,7,2,5,3,8,1,6,3,2,4,1 +889,R_6VmrmE3nt3lx2jj,25 - 31,American,,American,Female,Agree,Strongly agree,Agree,Strongly agree,Strongly disagree,1,4,5,3,2,Strongly disagree,Disagree,Somewhat agree,Agree,Disagree,4,3,2,5,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,4,2,1,3,Disagree,Disagree,Disagree,Disagree,Disagree,4,5,2,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,5,1,3,2,4,1,Strongly disagree,Strongly disagree,Disagree,Strongly agree,Strongly disagree,4,2,5,1,3,1,Agree,Agree,Agree,Somewhat Disagree,Agree,2,3,5,4,1,1,Disagree,Disagree,Disagree,Disagree,Disagree,5,3,2,4,1,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Strongly Agree,Strongly disagree,4,2,1,3,5,1,Disagree,Strongly disagree,Somewhat agree,Agree,Disagree,2,5,3,4,1,1,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,4,1,2,3,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,4,3,5,2,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,82,TRUE,95,TRUE,100,FALSE,90,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,54,FALSE,56,TRUE,97,FALSE,55,TRUE,70,TRUE,100,TRUE,53,TRUE,95,FALSE,50,TRUE,54,TRUE,70,TRUE,100,TRUE,70,TRUE,100,TRUE,70,TRUE,100,TRUE,100,FALSE,94,TRUE,96,FALSE,56,TRUE,94,FALSE,53,TRUE,100,25,2,3,2,3,-3,-3,-2,1,2,-2,2,1,2,0,2,-2,-2,-2,-2,-2,3,3,3,3,-3,1,-3,-3,-2,3,-3,1,2,2,2,-1,2,1,-2,-2,-2,-2,-2,1,3,2,2,3,-3,1,-2,-3,1,2,-2,1,2,2,2,0,2,1,1,0,1,1,-2,8,TRUE,0,100,FALSE,0,53,TRUE,0,94,FALSE,1,56,TRUE,1,96,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,70,TRUE,1,100,TRUE,0,70,TRUE,0,100,TRUE,1,70,TRUE,0,54,FALSE,0,50,TRUE,1,95,TRUE,0,53,TRUE,0,100,TRUE,0,70,FALSE,1,55,TRUE,1,97,FALSE,0,56,FALSE,1,54,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,90,TRUE,0,100,TRUE,1,95,FALSE,0,82,TRUE,1,95,0,0,0.0025,0,0.0025,0.0036,0,0,0.2025,0.3136,0.0025,0.09,0.09,0.49,0.0016,0.2809,0.2116,0.1936,0.01,0,0.0009,0.25,0.49,0.2916,0.2809,0.25,0.6724,1,0.8836,1,1,1,0.32185,0.134457143,0.509242857,25,78.13,18,56.25,2,25,6,75,4,50,6,75,12,75,6,37.5,81.22,62.62,82.38,88.75,91.12,84.94,77.5,21.88,24.97,37.62,7.38,38.75,16.12,9.94,40,1,0,1,0,0,0,1,3,1,1,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,3,2,3,3,0,0.4,1.2,0.4,0,0.4,0.4,0.2,2.2,0.5,0.8,0.65,1,1,1.875,0,0.8,0.2,-2.2,0.333333333,0,0,0,-7,0,2,2,0,-2,2,0,0,2,-2,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),27,Nothing really,1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,7,9,2,4,5,6,8,1,3,2,3,4,1 +890,R_1j8rDeHXUGqOs1B,25 - 31,American,,American,Female,Agree,Agree,Agree,Agree,Strongly agree,3,4,5,1,2,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Agree,2,3,4,1,5,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Agree,4,3,2,5,1,Somewhat disagree,Somewhat disagree,Strongly disagree,Disagree,Disagree,4,3,5,1,2,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Somewhat agree,2,5,4,3,1,4,Agree,Agree,Strongly agree,Agree,Somewhat agree,4,1,3,5,2,4,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,2,1,5,4,3,5,Agree,Agree,Strongly Agree,Agree,Somewhat agree,2,1,4,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Strongly Agree,1,4,2,3,5,0,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,1,5,4,3,2,4,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,4,3,1,2,5,0,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,2,4,5,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,60,FALSE,50,FALSE,85,TRUE,55,FALSE,60,TRUE,50,TRUE,60,FALSE,100,TRUE,75,FALSE,100,TRUE,60,FALSE,70,FALSE,60,TRUE,50,TRUE,60,FALSE,50,FALSE,50,TRUE,60,TRUE,50,TRUE,50,TRUE,60,FALSE,50,TRUE,85,TRUE,50,FALSE,60,TRUE,60,FALSE,100,TRUE,50,FALSE,50,FALSE,65,FALSE,50,FALSE,50,16,2,2,2,2,3,1,1,0,2,2,3,2,3,1,2,-1,-1,-3,-2,-2,0,2,2,-1,1,4,2,2,3,2,1,4,3,3,0,3,3,5,2,2,3,2,1,6,2,2,2,2,3,0,2,0,2,0,2,4,2,2,3,1,2,0,2,2,2,2,0,4,FALSE,1,50,FALSE,0,50,FALSE,1,65,FALSE,1,50,TRUE,1,50,FALSE,1,100,TRUE,1,60,FALSE,0,60,TRUE,1,50,TRUE,1,85,FALSE,1,50,TRUE,0,60,TRUE,1,50,TRUE,0,50,TRUE,1,60,FALSE,0,50,FALSE,1,50,TRUE,0,60,TRUE,0,50,FALSE,1,60,FALSE,0,70,TRUE,1,60,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,60,TRUE,0,50,FALSE,1,60,TRUE,0,55,FALSE,0,85,FALSE,0,50,TRUE,1,60,0.36,0.16,0.25,0.16,0.16,0,0.0625,0.0225,0.16,0.16,0.7225,0.25,0.25,0.25,0.25,0.25,0,0.25,0.16,0,0.49,0.16,0.25,0.25,0.25,0.25,0.25,0.25,0.1225,0.36,0.3025,0.36,0.222946429,0.199107143,0.246785714,16,50,20,62.5,4,50,6,75,6,75,4,50,10,62.5,10,62.5,62.03,51.25,66.88,65.62,64.38,60.94,63.12,-12.5,-0.47,1.25,-8.12,-9.38,14.38,-1.56,0.62,2,0,0,3,2,1,1,3,0,1,0,1,3,2,1,3,3,6,4,3,0,0,0,0,0,1,1,2,2,0,1,0,0,0,0,3,3,5,4,2,1.4,1.2,1.4,3.8,0,1.2,0.2,3.4,1.95,1.2,1.575,4.33,1.33,3.375,1.4,0,1.2,0.4,0.866666667,4,0,5,2,3,1,1,2,-1,1,1,-1,1,-1,-1,1,-1,10 cents,100 minutes,47 days,Female,University - Undergraduate,27,,0.375,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,02REV,9,2,3,7,6,4,5,1,8,2,4,3,1 +891,R_3Jq5MA8WvQoLH6T,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,Strongly agree,3,1,2,4,5,Disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,4,1,5,3,2,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Agree,1,2,5,3,4,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,2,1,4,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,3,5,1,4,4,Strongly disagree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,5,1,4,2,3,7,Somewhat Disagree,Disagree,Somewhat Agree,Agree,Agree,2,4,1,3,5,4,Neither agree nor disagree,Disagree,Somewhat disagree,Disagree,Somewhat disagree,2,5,3,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,5,2,4,1,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,3,2,5,1,4,4,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,2,4,3,5,1,2,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,4,5,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,50,FALSE,91,TRUE,100,TRUE,93,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,86,TRUE,57,TRUE,53,FALSE,58,TRUE,60,TRUE,81,TRUE,83,FALSE,93,TRUE,63,FALSE,92,TRUE,100,FALSE,62,FALSE,75,TRUE,100,TRUE,66,TRUE,100,TRUE,93,FALSE,100,TRUE,100,FALSE,59,TRUE,100,FALSE,52,FALSE,73,21,3,3,0,1,3,-2,1,2,0,2,2,-1,3,1,2,-1,1,-1,-1,-2,3,3,3,3,1,4,-3,2,0,2,0,7,-1,-2,1,2,2,4,0,-2,-1,-2,-1,7,3,3,1,2,3,1,-2,0,1,-1,2,4,2,-1,3,0,2,2,2,1,2,1,1,7,FALSE,1,73,FALSE,0,52,TRUE,0,100,FALSE,1,59,TRUE,1,100,FALSE,1,100,TRUE,1,93,TRUE,1,100,TRUE,1,66,TRUE,1,100,FALSE,1,75,FALSE,1,62,TRUE,1,100,FALSE,1,92,TRUE,1,63,FALSE,0,93,TRUE,0,83,TRUE,0,81,TRUE,0,60,FALSE,1,58,TRUE,1,53,TRUE,1,57,FALSE,1,86,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,93,TRUE,0,100,FALSE,0,91,FALSE,0,50,FALSE,0,100,0,0,0.8649,0.0049,1,0,0,0,0.1764,0.1849,0.8281,0,0.1156,0.0625,0,0.2704,0.0196,0.1681,0.8649,0,0.2209,0.1369,0.36,0.0064,0.6889,0.25,0.25,0.0729,1,0.6561,1,0.1444,0.30275,0.201828571,0.403671429,21,65.63,21,65.63,5,62.5,5,62.5,7,87.5,4,50,11,68.75,10,62.5,80.94,59.38,90.25,87,87.12,82.38,79.5,0,15.31,-3.12,27.75,-0.5,37.12,13.63,17,0,0,3,2,2,1,1,2,2,2,3,1,2,1,0,1,3,0,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0,3,0,3,2,3,1.4,1.6,1.4,1.2,0.4,0.6,0.2,2.2,1.4,0.85,1.125,5,2.33,4.5,1,1,1.2,-1,1.066666667,3,3,2,0,2.67,0,2,2,-2,2,1,-1,-1,1,-2,2,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),25,I feel like it was worded well and flowed in a way that made sense,1.25,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,6,2,9,3,7,4,5,1,8,4,2,3,1 +892,R_77OGSdkLT2ZcOzu,25 - 31,American,,American,Male,Somewhat agree,Strongly agree,Somewhat agree,Agree,Somewhat disagree,3,5,2,4,1,Disagree,Agree,Somewhat disagree,Agree,Somewhat disagree,2,3,4,1,5,Somewhat Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,4,5,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,3,2,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat disagree,Agree,Strongly Agree,Agree,Somewhat disagree,2,3,5,1,4,5,Disagree,Somewhat disagree,Strongly disagree,Somewhat agree,Somewhat disagree,4,1,3,2,5,7,Strongly Agree,Somewhat Agree,Somewhat Disagree,Agree,Strongly Agree,1,2,4,5,3,5,Somewhat disagree,Disagree,Disagree,Somewhat agree,Disagree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,3,4,5,1,2,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,5,1,3,6,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,2,4,3,1,7,Agree,Agree,Agree,Strongly Agree,Somewhat agree,5,2,3,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,FALSE,90,TRUE,80,FALSE,50,TRUE,65,TRUE,65,FALSE,75,FALSE,75,FALSE,100,TRUE,100,TRUE,80,FALSE,100,FALSE,60,FALSE,100,FALSE,55,TRUE,100,TRUE,75,FALSE,100,TRUE,90,FALSE,100,FALSE,60,TRUE,90,TRUE,100,TRUE,100,TRUE,100,FALSE,75,TRUE,95,FALSE,76,TRUE,80,TRUE,100,FALSE,100,16,1,3,1,2,-1,-2,2,-1,2,-1,1,-3,3,0,3,-1,-1,-1,-1,-2,-1,2,3,2,-1,6,-2,-1,-3,1,-1,5,3,1,-1,2,3,7,-1,-2,-2,1,-2,5,3,3,1,1,3,6,1,-1,1,1,1,6,0,-3,3,-1,3,6,2,2,2,3,1,7,FALSE,1,100,TRUE,1,100,TRUE,0,80,FALSE,1,76,TRUE,1,95,FALSE,1,75,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,FALSE,1,60,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,100,FALSE,1,55,FALSE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,80,TRUE,1,100,FALSE,1,100,FALSE,0,75,FALSE,1,75,TRUE,1,65,TRUE,0,65,FALSE,1,50,TRUE,0,80,FALSE,0,90,TRUE,1,50,TRUE,1,100,0,0.1225,0,0,0,0.0625,0.5625,0.01,0,0,0.81,0.01,0,0.16,0.0025,0,0,0.0576,0.25,0.0625,0.04,0.0625,0.16,0,0.2025,0.4225,0.25,0,0.64,0,0.64,0,0.157325,0.11965,0.195,16,50,27,84.38,7,87.5,7,87.5,8,100,5,62.5,14,87.5,13,81.25,83.94,73.25,84.38,91.25,86.88,88.12,79.75,-34.38,-0.44,-14.25,-3.12,-8.75,24.38,0.62,-1.5,2,1,2,0,0,0,3,2,1,0,2,4,4,2,0,0,1,1,2,0,2,0,0,1,4,3,3,2,1,2,1,0,0,1,0,3,3,3,4,3,1,1.2,2.4,0.8,1.4,2.2,0.4,3.2,1.35,1.8,1.575,6,6,6,-0.4,-1,2,-2.4,0.2,0,-1,1,-2,0,2,2,2,-2,2,2,-2,1,-1,-2,2,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,26,I have no feedback.,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,9,7,6,8,2,4,3,1,5,2,4,3,1 +893,R_5nUWBF6DV3W816R,25 - 31,American,,American,Female,Somewhat agree,Agree,Agree,Agree,Strongly agree,4,1,5,2,3,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,Agree,2,3,1,5,4,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,4,3,1,2,5,Neither agree nor disagree,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,1,3,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,2,3,5,1,4,7,Neither agree nor disagree,Disagree,Somewhat agree,Strongly disagree,Strongly disagree,1,2,3,5,4,6,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,4,5,3,2,1,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Somewhat disagree,Neither agree nor disagree,Strongly Agree,2,3,1,4,5,8,Agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,4,2,1,8,Agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,1,4,2,3,8,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,3,4,1,2,5,FALSE,83,TRUE,94,TRUE,99,FALSE,95,TRUE,96,FALSE,73,TRUE,55,TRUE,98,TRUE,94,TRUE,99,FALSE,90,TRUE,98,TRUE,93,FALSE,56,TRUE,81,TRUE,98,TRUE,80,TRUE,96,TRUE,79,FALSE,89,TRUE,64,FALSE,50,TRUE,82,TRUE,53,FALSE,93,TRUE,98,TRUE,99,TRUE,98,TRUE,97,FALSE,86,FALSE,66,FALSE,99,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,2,3,-1,1,-1,2,2,0,1,0,1,3,0,-3,-2,0,-3,-2,-1,2,1,-1,7,0,-2,1,-3,-3,7,1,-1,-1,-1,1,6,-3,-3,-3,-3,-3,5,2,2,-1,0,3,7,2,-2,3,-3,3,8,2,2,3,0,3,8,3,3,2,3,2,8,FALSE,1,83,TRUE,1,94,TRUE,0,99,FALSE,1,95,TRUE,1,96,FALSE,1,73,TRUE,1,55,TRUE,1,98,TRUE,1,94,TRUE,1,99,FALSE,1,90,TRUE,0,98,TRUE,1,93,FALSE,1,56,TRUE,1,81,TRUE,1,98,TRUE,0,80,TRUE,0,96,TRUE,0,79,FALSE,1,89,TRUE,1,64,FALSE,0,50,TRUE,0,82,TRUE,1,53,FALSE,1,93,TRUE,1,98,TRUE,0,99,TRUE,0,98,TRUE,0,97,FALSE,0,86,FALSE,0,66,FALSE,0,99,0.0004,0.0004,0.0004,0.2025,0.9801,0.0729,0.2209,0.0001,0.0121,0.25,0.7396,0.0049,0.0036,0.01,0.0016,0.0036,0.6724,0.0025,0.9604,0.0049,0.1296,0.0361,0.6241,0.1936,0.64,0.9801,0.4356,0.0289,0.9801,0.9216,0.9409,0.9604,0.386092857,0.21245,0.559735714,21,65.63,19,59.38,5,62.5,4,50,6,75,4,50,12,75,7,43.75,85.34,87.25,85.5,78.75,89.88,82.75,87.94,6.25,25.96,24.75,35.5,3.75,39.88,7.75,44.19,3,3,0,1,4,1,3,2,5,5,1,2,1,2,2,3,0,1,3,0,1,0,3,2,0,3,3,4,5,1,2,1,3,1,0,3,6,4,3,5,2.2,3.2,1.6,1.4,1.2,3.2,1.4,4.2,2.1,2.5,2.3,6.67,7.67,7,1,0,0.2,-2.8,0.4,0,-1,-2,-3,-1,2,1,1,-2,2,2,-2,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),29,"The survey felt like a quick mental exercise, and i found the test questions towards the end quite thrilling.",0.75,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,01DIR,9,5,8,2,3,7,4,1,6,3,2,4,1 +894,R_7rq1ZFhgbVbpRQm,25 - 31,American,,American,Male,Somewhat agree,Strongly agree,Agree,Somewhat agree,Strongly agree,2,4,3,1,5,Somewhat agree,Somewhat disagree,Agree,Disagree,Agree,4,2,5,3,1,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,4,1,5,2,3,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,3,5,1,2,4,Disagree,Disagree,Disagree,Disagree,Disagree,2,4,1,5,3,10,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,1,4,3,5,2,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,Strongly Agree,2,1,3,5,4,8,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,2,3,5,10,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,2,3,4,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,TRUE,100,FALSE,63,TRUE,100,FALSE,52,TRUE,100,TRUE,71,FALSE,51,FALSE,51,FALSE,59,TRUE,100,FALSE,53,FALSE,57,TRUE,100,FALSE,54,FALSE,52,TRUE,52,FALSE,100,TRUE,100,TRUE,100,FALSE,82,TRUE,91,TRUE,85,FALSE,57,TRUE,100,TRUE,62,FALSE,56,TRUE,72,TRUE,99,FALSE,58,TRUE,100,21,1,3,2,1,3,1,-1,2,-2,2,-1,1,2,-1,1,-1,1,2,2,1,3,3,3,2,3,10,-2,-2,-2,-2,-2,4,-3,-3,-3,-3,-3,10,0,0,0,0,0,10,3,3,-1,3,3,9,3,-2,3,-3,3,8,3,3,3,-2,3,10,3,3,3,3,3,10,TRUE,0,100,FALSE,0,58,TRUE,0,99,TRUE,0,72,FALSE,0,56,TRUE,0,62,TRUE,1,100,FALSE,0,57,TRUE,1,85,TRUE,1,91,FALSE,1,82,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,52,FALSE,0,52,FALSE,1,54,TRUE,0,100,FALSE,1,57,FALSE,1,53,TRUE,1,100,FALSE,0,59,FALSE,1,51,FALSE,0,51,TRUE,0,71,TRUE,1,100,FALSE,1,52,TRUE,0,100,FALSE,1,63,TRUE,1,100,FALSE,0,51,TRUE,1,100,0.3249,0,0.2704,0,0,0.3844,0.2601,0.0081,0.2209,0.3481,0,0,0.0225,0.0324,0.3136,0.3364,0.2401,0.5184,1,0.5041,0,0.2304,0.1849,0,0.2116,0.2304,0.2601,1,0.9801,1,0.1369,1,0.336553571,0.191785714,0.481321429,21,65.63,17,53.13,5,62.5,6,75,4,50,2,25,9,56.25,8,50,75.88,63.62,73.25,90.12,76.5,75.75,76,12.5,22.75,1.12,-1.75,40.12,51.5,19.5,26,2,0,1,1,0,3,1,4,0,4,2,4,5,2,4,1,1,2,2,1,2,0,3,2,0,2,1,1,1,1,4,2,1,1,2,4,2,1,1,2,0.8,2.4,3.4,1.4,1.4,1.2,2,2,2,1.65,1.825,8,9,8.875,-0.6,1.2,1.4,-0.6,0.666666667,1,-4,0,0,-1,0,1,-1,-1,1,1,-1,1,-1,0,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),26,,-0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,2,5,8,7,6,9,3,1,4,2,4,3,1 +895,R_1duwX3m2RzUdeij,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly disagree,Agree,2,5,1,4,3,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,5,4,3,1,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,3,5,2,1,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,4,5,3,1,2,Somewhat agree,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat disagree,3,1,5,4,2,4,Disagree,Strongly agree,Disagree,Agree,Somewhat disagree,2,1,4,3,5,6,Somewhat Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,5,4,1,7,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat disagree,1,2,4,5,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat agree,2,3,5,4,1,6,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,1,2,3,4,5,6,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,5,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,85,TRUE,50,TRUE,100,TRUE,50,TRUE,96,FALSE,100,TRUE,50,TRUE,96,TRUE,70,TRUE,50,FALSE,70,FALSE,50,TRUE,100,FALSE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,95,TRUE,50,TRUE,59,TRUE,50,TRUE,96,FALSE,50,FALSE,60,TRUE,100,FALSE,100,FALSE,50,TRUE,86,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,-3,2,-1,1,0,2,1,0,-3,3,-1,3,-1,1,0,-1,-3,1,3,3,-3,-1,4,-2,3,-2,2,-1,6,1,-3,3,1,3,7,1,2,2,1,-1,6,2,3,3,-3,1,6,-2,1,1,0,3,6,0,-3,3,1,3,5,0,0,0,0,0,5,TRUE,0,85,TRUE,1,50,TRUE,0,100,TRUE,0,50,TRUE,1,96,FALSE,1,100,TRUE,1,50,TRUE,1,96,TRUE,1,70,TRUE,1,50,FALSE,1,70,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,95,TRUE,0,50,TRUE,1,59,TRUE,0,50,TRUE,1,96,FALSE,1,50,FALSE,1,60,TRUE,0,100,FALSE,0,100,FALSE,0,50,TRUE,1,86,0.0016,0.0016,0,0.25,0.0196,0,0.1681,0.25,0.25,0.0025,1,0,0.09,0.09,0.0016,0.25,0.25,0.25,0.16,0.25,0.25,0.25,0,0,0.25,0.25,0.25,0.7225,1,1,1,0.25,0.294796429,0.187271429,0.402321429,22,68.75,22,68.75,6,75,5,62.5,5,62.5,6,75,13,81.25,9,56.25,73.84,61.25,79,78.25,76.88,74.88,72.81,0,5.09,-13.75,16.5,15.75,1.88,-6.37,16.56,1,0,0,0,3,1,2,2,0,2,1,0,0,2,0,2,1,2,2,2,0,0,0,0,1,1,0,1,2,2,0,0,0,2,0,1,1,0,1,3,0.8,1.4,0.6,1.8,0.2,1.2,0.4,1.2,1.15,0.75,0.95,5.67,5.67,5.625,0.6,0.2,0.2,0.6,0.333333333,-2,0,2,1,0,2,2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,22,"It was an interesting survey, different from other formats I've taken part in. ",1.625,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,3,8,6,2,4,7,5,1,9,2,4,3,1 +896,R_7CEILV5bRV86Hvl,18 - 24,American,,American,Female,Agree,Strongly agree,Agree,Somewhat agree,Agree,5,3,2,4,1,Agree,Somewhat disagree,Strongly agree,Somewhat agree,Agree,1,2,5,3,4,Somewhat Disagree,Agree,Agree,Agree,Somewhat Agree,4,1,3,2,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,2,3,4,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,4,3,5,1,4,Somewhat agree,Somewhat agree,Strongly agree,Agree,Agree,1,3,4,5,2,4,Somewhat Agree,Agree,Somewhat Disagree,Agree,Agree,4,1,3,5,2,5,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Agree,3,2,5,4,1,1,Agree,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,3,5,1,2,4,4,Somewhat Disagree,Somewhat Agree,Agree,Agree,Somewhat Agree,5,2,1,3,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,4,3,2,5,TRUE,74,FALSE,60,TRUE,86,TRUE,61,TRUE,91,FALSE,95,TRUE,87,TRUE,92,TRUE,51,FALSE,100,FALSE,65,FALSE,70,TRUE,75,FALSE,70,TRUE,70,TRUE,91,FALSE,55,TRUE,58,FALSE,56,FALSE,57,TRUE,70,TRUE,71,TRUE,69,FALSE,58,FALSE,97,TRUE,75,TRUE,68,FALSE,64,TRUE,82,TRUE,67,FALSE,64,TRUE,92,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,1,2,2,-1,3,1,2,-1,2,2,2,1,3,2,3,3,2,3,3,2,2,3,4,1,1,3,2,2,4,1,2,-1,2,2,4,-1,1,-1,-1,-2,5,3,3,1,2,2,3,2,-1,3,1,1,1,-1,1,2,2,1,4,3,3,3,3,2,1,TRUE,0,74,FALSE,0,60,TRUE,0,86,TRUE,0,61,TRUE,1,91,FALSE,1,95,TRUE,1,87,TRUE,1,92,TRUE,1,51,FALSE,0,100,FALSE,1,65,FALSE,1,70,TRUE,1,75,FALSE,1,70,TRUE,1,70,TRUE,1,91,FALSE,1,55,TRUE,0,58,FALSE,1,56,FALSE,1,57,TRUE,1,70,TRUE,1,71,TRUE,0,69,FALSE,0,58,FALSE,1,97,TRUE,1,75,TRUE,0,68,FALSE,1,64,TRUE,0,82,TRUE,1,67,FALSE,0,64,TRUE,1,92,0.0064,0.0625,0.0081,0.0169,0.0064,0.0025,0.3364,1,0.1849,0.0841,0.1089,0.0625,0.2401,0.1225,0.0081,0.36,0.4761,0.3721,0.1296,0.0009,0.09,0.09,0.1936,0.09,0.2025,0.4624,0.4096,0.5476,0.7396,0.3364,0.6724,0.09,0.264971429,0.240328571,0.289614286,20,62.5,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,73.16,61.88,78.62,79,73.12,75.88,70.44,-3.13,7.53,11.88,3.62,16.5,-1.88,0.88,14.19,1,0,0,1,1,1,2,0,1,0,2,0,3,0,1,4,1,4,4,4,1,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0.6,0.8,1.2,3.4,0.6,0.2,0.2,0.2,1.5,0.3,0.9,4,2.67,3.25,0,0.6,1,3.2,0.533333333,1,3,0,4,1.33,1,1,1,-1,1,0,0,-1,1,-2,2,0,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,,0.875,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,6,8,3,9,5,2,7,1,4,4,2,3,1 +897,R_6IB94fVqlSmayPv,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,3,4,1,2,Agree,Somewhat agree,Agree,Agree,Strongly agree,1,5,2,3,4,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,2,1,4,Somewhat agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,2,4,3,1,5,Strongly Agree,Strongly Agree,Agree,Disagree,Agree,2,5,3,1,4,5,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,2,4,3,5,1,2,Somewhat Agree,Somewhat Agree,Agree,Strongly Agree,Strongly Agree,1,5,2,3,4,4,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,5,3,2,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,1,4,2,5,1,Agree,Agree,Agree,Agree,Strongly agree,3,1,2,4,5,1,Strongly Agree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,4,2,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,1,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,59,TRUE,90,TRUE,85,FALSE,51,TRUE,100,FALSE,70,TRUE,60,TRUE,64,TRUE,51,TRUE,91,TRUE,54,TRUE,75,TRUE,55,FALSE,60,TRUE,52,TRUE,70,TRUE,59,TRUE,100,FALSE,51,TRUE,95,TRUE,73,TRUE,83,TRUE,51,TRUE,87,FALSE,63,TRUE,96,TRUE,51,FALSE,52,TRUE,57,TRUE,100,TRUE,56,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,1,3,2,1,2,2,3,3,-1,3,1,3,1,1,2,3,3,3,3,2,-2,2,5,2,1,1,2,1,2,1,1,2,3,3,4,-1,-1,-2,1,-1,7,3,3,3,2,3,1,2,2,2,2,3,1,3,-2,3,-1,3,2,3,3,3,3,3,4,TRUE,0,59,TRUE,1,90,TRUE,0,85,FALSE,1,51,TRUE,1,100,FALSE,1,70,TRUE,1,60,TRUE,1,64,TRUE,1,51,TRUE,1,91,TRUE,0,54,TRUE,0,75,TRUE,1,55,FALSE,1,60,TRUE,1,52,TRUE,1,70,TRUE,0,59,TRUE,0,100,FALSE,1,51,TRUE,0,95,TRUE,1,73,TRUE,1,83,TRUE,0,51,TRUE,1,87,FALSE,1,63,TRUE,1,96,TRUE,0,51,FALSE,1,52,TRUE,0,57,TRUE,1,100,TRUE,1,56,TRUE,1,100,0.1296,0.0016,0.09,0.16,0,0.09,0.0169,0.0081,0.9025,0.0289,0,0.2025,0.2401,0.2916,0,0.01,0.2601,0.2401,0.2304,0.1369,0.0729,0.2304,0.2401,0.16,0.3481,0.2601,0.1936,0.3481,0.7225,1,0.3249,0.5625,0.254332143,0.163628571,0.345035714,17,53.13,22,68.75,6,75,5,62.5,6,75,5,62.5,16,100,6,37.5,70.66,57,70.62,76.5,78.5,76.75,64.56,-15.62,1.91,-18,8.12,1.5,16,-23.25,27.06,1,0,1,3,1,0,0,1,0,2,2,2,1,2,0,2,2,4,2,4,1,0,0,1,0,0,1,0,0,0,0,1,0,2,0,2,2,1,0,0,1.2,0.6,1.4,2.8,0.4,0.2,0.6,1,1.5,0.55,1.025,3.67,1.33,3.25,0.8,0.4,0.8,1.8,0.666666667,4,1,2,3,2.34,1,-2,0,-2,2,-1,1,1,-1,-1,1,-1,10 cents,5 minutes,24 days,Female,High School (or equivalent),20,The survey was quite insightful and was very well organized. It very clearly demonstrated what would occur.,0.125,0,1,0,1,0,1,0.33,0.67,03VLPfPs,02COC,02FUT,01ITEM,01DIR,2,9,8,3,7,5,4,1,6,4,3,2,1 +898,R_16eDFK5gNmiumwF,18 - 24,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,3,5,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Strongly Agree,3,5,2,4,1,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,1,2,5,3,4,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,1,Neither agree nor disagree,Agree,Somewhat agree,Agree,Disagree,5,1,4,2,3,7,Agree,Agree,Agree,Disagree,Strongly Agree,2,3,4,1,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,3,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Disagree,Agree,4,1,5,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,5,2,6,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,72,TRUE,100,FALSE,78,TRUE,67,TRUE,60,TRUE,81,FALSE,90,FALSE,53,TRUE,67,FALSE,62,FALSE,100,FALSE,63,TRUE,60,TRUE,100,FALSE,59,TRUE,76,FALSE,66,TRUE,77,TRUE,55,TRUE,100,FALSE,100,FALSE,100,TRUE,58,FALSE,97,FALSE,65,FALSE,100,TRUE,70,TRUE,67,TRUE,100,FALSE,62,FALSE,59,10,2,3,3,3,3,-1,1,1,1,-1,1,0,2,2,3,0,-1,-1,2,0,2,3,3,3,3,1,0,2,1,2,-2,7,2,2,2,-2,3,5,3,3,3,3,3,8,3,3,3,3,3,1,0,0,3,-2,2,4,3,3,3,3,3,6,2,2,2,2,2,5,FALSE,1,59,FALSE,0,62,TRUE,0,100,TRUE,0,67,TRUE,1,70,FALSE,1,100,FALSE,0,65,FALSE,0,97,TRUE,1,58,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,55,TRUE,0,77,FALSE,0,66,TRUE,1,76,FALSE,1,59,TRUE,0,100,TRUE,0,60,FALSE,1,63,FALSE,0,100,FALSE,0,62,TRUE,0,67,FALSE,0,53,FALSE,1,90,TRUE,1,81,TRUE,0,60,TRUE,0,67,FALSE,1,78,TRUE,1,100,FALSE,0,72,TRUE,1,100,0.9409,0.0361,0.0576,0.4225,0,0,0.2809,1,0.1369,0.3844,0,0.2025,0.1764,0,0.09,0.3844,0.4489,0.4489,0.4489,0.01,1,0.4356,0.36,0.5929,0.1681,0.36,0.5184,0.1681,1,1,0.0484,1,0.380846429,0.253807143,0.507885714,10,31.25,14,43.75,2,25,6,75,3,37.5,3,37.5,7,43.75,7,43.75,77,68.12,78.62,79.25,82,76.06,77.94,-12.5,33.25,43.12,3.62,41.75,44.5,32.31,34.19,0,0,0,0,0,1,1,0,1,1,1,2,0,4,0,3,4,4,1,3,1,0,0,0,0,1,1,2,3,3,2,3,1,1,0,2,3,3,0,2,0,0.8,1.4,3,0.2,2,1.4,2,1.3,1.4,1.35,4.33,3.67,4.625,-0.2,-1.2,0,1,-0.466666667,0,3,-1,3,0.66,-1,2,2,-2,2,2,-2,-1,1,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,Great survey!,0.5,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,4,8,6,9,5,2,7,1,3,3,4,2,1 +899,R_5YRfud4tR7Cg3Kq,25 - 31,American,,American,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,4,1,3,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,1,4,3,Somewhat Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,1,2,5,4,3,Strongly Agree,Agree,Agree,Agree,Neither agree nor disagree,1,5,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,2,4,5,3,3,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,5,4,3,1,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,1,2,4,0,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,3,1,2,4,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,1,4,5,1,Somewhat Disagree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,5,3,1,4,0,Strongly disagree,Strongly disagree,Strongly Agree,Strongly disagree,Strongly disagree,4,3,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,93,TRUE,100,TRUE,100,FALSE,100,TRUE,88,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,27,2,3,3,3,2,1,-3,3,-3,3,1,2,3,-3,3,3,2,2,2,0,3,3,3,0,3,0,1,-3,3,-3,3,3,3,1,3,-3,3,1,-1,-3,-3,-3,-3,0,3,3,3,2,3,1,1,-3,3,-3,3,2,-1,-3,3,1,3,1,-3,-3,3,-3,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,88,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0.8649,0.25,0,0,0,0,0.7744,1,0,1,0.25,0,1,0,1,1,0.263903571,0.097492857,0.430314286,27,84.38,24,75,5,62.5,6,75,7,87.5,6,75,15,93.75,9,56.25,94.72,79.75,99.12,100,100,96.88,92.56,9.38,19.72,17.25,24.12,12.5,25,3.13,36.31,1,0,0,3,1,0,0,0,0,0,2,1,0,0,0,4,5,5,5,3,1,0,0,1,1,0,0,0,0,0,2,5,0,4,0,6,5,1,5,3,1,0,0.6,4.4,0.6,0,2.2,4,1.5,1.7,1.6,1.33,1.33,1,0.4,0,-1.6,0.4,-0.4,-1,1,0,0,0,2,2,2,-2,2,-2,2,2,-2,-2,2,1,20 cents,5 minutes,47 days,Male,University - PhD,29,"an interesting one, I wish I knew how many of the questions I got right.",1.375,0,1,1,0,0,0,0.67,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,7,2,6,5,9,3,4,1,8,4,3,2,1 +900,R_1nOdNjrTBRvM0PV,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Somewhat agree,4,1,2,5,3,Strongly agree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,4,2,5,1,3,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,5,2,1,3,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,5,4,1,2,Strongly Agree,Strongly Agree,Agree,Agree,Somewhat disagree,1,5,2,4,3,4,Strongly agree,Strongly agree,Disagree,Strongly agree,Somewhat disagree,5,2,3,1,4,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,Agree,3,4,2,5,1,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,2,1,3,5,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Agree,Agree,1,3,4,2,5,1,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,4,3,2,1,5,3,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Somewhat Agree,2,1,5,4,3,3,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,1,5,3,2,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,97,FALSE,58,TRUE,75,FALSE,56,FALSE,58,FALSE,56,TRUE,55,TRUE,89,TRUE,67,TRUE,95,FALSE,64,FALSE,90,FALSE,54,TRUE,90,TRUE,91,FALSE,58,TRUE,100,TRUE,96,FALSE,53,FALSE,54,TRUE,58,TRUE,90,TRUE,78,FALSE,65,FALSE,94,TRUE,87,FALSE,55,FALSE,65,FALSE,54,TRUE,91,FALSE,98,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,3,1,3,1,3,2,0,2,1,3,1,3,1,-1,1,0,-1,3,3,2,2,-1,4,3,3,-2,3,-1,3,0,1,1,2,2,3,0,-1,0,-2,-2,3,3,3,2,2,2,1,2,1,1,0,2,3,1,0,3,2,1,3,0,1,2,0,1,6,TRUE,0,97,FALSE,0,58,TRUE,0,75,FALSE,1,56,FALSE,0,58,FALSE,1,56,TRUE,1,55,TRUE,1,89,TRUE,1,67,TRUE,1,95,FALSE,1,64,FALSE,1,90,FALSE,0,54,TRUE,0,90,TRUE,1,91,FALSE,0,58,TRUE,0,100,TRUE,0,96,FALSE,1,53,FALSE,1,54,TRUE,1,58,TRUE,1,90,TRUE,0,78,FALSE,0,65,FALSE,1,94,TRUE,1,87,FALSE,1,55,FALSE,1,65,FALSE,1,54,TRUE,1,91,FALSE,0,98,TRUE,1,100,0.0121,0.0169,0.3364,0.2025,0,0.1936,0.4225,0.0025,0.2116,0.01,0.0081,0.2916,0.1089,0.1296,0.3364,0.3364,0.6084,0.1936,0.1225,0.0036,0.1764,0.0081,0.2209,0.81,1,0.2025,0.9604,0.9409,0.5625,0.9216,0.2116,0.01,0.321578571,0.2038,0.439357143,22,68.75,20,62.5,6,75,4,50,5,62.5,5,62.5,10,62.5,10,62.5,74.72,67.75,69.75,88,73.38,75.88,73.56,6.25,12.22,-7.25,19.75,25.5,10.88,13.38,11.06,0,0,0,1,2,0,2,5,1,1,2,0,2,1,1,1,0,1,2,1,0,0,0,1,1,1,0,2,2,2,1,1,0,1,2,1,2,1,0,2,0.6,1.8,1.2,1,0.4,1.4,1,1.2,1.15,1,1.075,3.33,2.33,3.25,0.2,0.4,0.2,-0.2,0.266666667,3,0,0,-3,1,0,2,-1,-2,2,1,-1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,19,,0.25,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,5,2,6,8,4,7,3,1,9,2,3,4,1 +901,R_7TvfjtO0ztEIfay,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly agree,1,5,3,2,4,Somewhat disagree,Agree,Neither agree nor disagree,Agree,Somewhat agree,2,1,3,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,4,2,3,1,5,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,4,5,3,2,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Agree,1,5,3,4,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,4,3,5,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,5,1,5,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Disagree,5,4,2,1,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,1,2,3,4,5,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,4,1,2,3,5,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,2,1,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,59,FALSE,50,TRUE,89,FALSE,50,TRUE,72,FALSE,95,TRUE,92,TRUE,71,TRUE,54,TRUE,82,FALSE,100,FALSE,58,TRUE,100,FALSE,100,TRUE,64,TRUE,57,TRUE,73,TRUE,78,FALSE,55,FALSE,57,FALSE,68,TRUE,76,FALSE,62,FALSE,61,FALSE,50,TRUE,58,FALSE,57,TRUE,74,TRUE,57,TRUE,67,TRUE,78,FALSE,52,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,-1,1,3,-1,2,0,2,1,0,0,1,2,1,-3,0,-3,-3,-3,-1,1,-1,-1,2,4,0,0,0,0,0,5,-1,0,0,0,0,5,-2,-1,-1,-2,-2,3,0,1,0,1,3,5,0,1,0,1,1,5,1,0,0,0,1,5,0,-1,0,1,0,5,FALSE,1,59,FALSE,0,50,TRUE,0,89,FALSE,1,50,TRUE,1,72,FALSE,1,95,TRUE,1,92,TRUE,1,71,TRUE,1,54,TRUE,1,82,FALSE,1,100,FALSE,1,58,TRUE,1,100,FALSE,1,100,TRUE,1,64,TRUE,1,57,TRUE,0,73,TRUE,0,78,FALSE,1,55,FALSE,1,57,FALSE,0,68,TRUE,1,76,FALSE,1,62,FALSE,0,61,FALSE,1,50,TRUE,1,58,FALSE,1,57,TRUE,0,74,TRUE,0,57,TRUE,1,67,TRUE,1,78,FALSE,0,52,0.0841,0.1764,0.1849,0.0064,0.2704,0.0025,0.3721,0.0324,0.1849,0.0576,0.1089,0,0.2116,0,0.0784,0.25,0.1444,0.25,0.5476,0.25,0.4624,0.1296,0.2025,0,0.5329,0.1849,0.0484,0.1681,0.7921,0.6084,0.3249,0.1764,0.228264286,0.140228571,0.3163,12,37.5,23,71.88,7,87.5,4,50,7,87.5,5,62.5,12,75,11,68.75,69.25,63.5,72.38,74.38,66.75,68.88,69.62,-34.38,-2.63,-24,22.38,-13.12,4.25,-6.12,0.87,2,0,0,2,1,1,2,0,2,1,1,0,1,2,1,1,1,2,1,1,1,0,1,0,0,1,1,0,1,0,1,0,1,2,0,3,1,3,4,3,1,1.2,1,1.2,0.4,0.6,0.8,2.8,1.1,1.15,1.125,4.67,5,4.625,0.6,0.6,0.2,-1.6,0.466666667,-1,0,0,-2,-0.33,0,1,1,-2,2,2,-2,1,-1,1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,9,2,5,3,6,7,8,1,4,3,2,4,1 +902,R_1k7msazkdMzLZEI,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,Agree,4,5,2,1,3,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,2,1,4,3,5,Somewhat Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,2,5,1,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,2,3,4,1,5,7,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,2,1,3,4,5,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,4,5,3,2,7,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Strongly Agree,Disagree,Somewhat agree,Agree,1,4,3,5,2,3,Somewhat agree,Agree,Agree,Somewhat disagree,Agree,4,1,5,2,3,4,Disagree,Somewhat Agree,Strongly agree,Somewhat Disagree,Strongly agree,2,4,5,3,1,8,Agree,Agree,Agree,Strongly Agree,Agree,3,4,2,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,60,TRUE,54,TRUE,58,TRUE,86,FALSE,50,FALSE,100,TRUE,64,FALSE,100,TRUE,59,FALSE,81,TRUE,50,TRUE,64,FALSE,67,FALSE,50,TRUE,81,FALSE,56,TRUE,100,TRUE,64,TRUE,53,FALSE,50,TRUE,53,TRUE,89,TRUE,80,TRUE,100,TRUE,50,TRUE,62,FALSE,56,TRUE,74,FALSE,58,FALSE,74,TRUE,50,FALSE,100,10,1,3,-1,1,2,-1,1,1,0,3,-1,1,3,0,3,0,1,1,-1,-2,2,-2,2,-3,0,5,1,1,-1,-1,1,7,1,1,2,1,2,5,3,2,3,0,3,7,1,3,-2,1,2,3,1,2,2,-1,2,3,-2,1,3,-1,3,4,2,2,2,3,2,8,FALSE,1,100,TRUE,1,50,FALSE,1,74,FALSE,1,58,TRUE,1,74,FALSE,1,56,TRUE,1,62,TRUE,1,50,TRUE,1,100,TRUE,1,80,TRUE,0,89,TRUE,0,53,FALSE,0,50,TRUE,0,53,TRUE,1,64,TRUE,1,100,FALSE,1,56,TRUE,0,81,FALSE,1,50,FALSE,1,67,TRUE,1,64,TRUE,1,50,FALSE,1,81,TRUE,1,59,FALSE,1,100,TRUE,1,64,FALSE,1,100,FALSE,1,50,TRUE,0,86,TRUE,1,58,TRUE,1,54,FALSE,0,60,0.25,0.1296,0,0.1444,0.36,0.1936,0.1681,0.04,0.1089,0.25,0.1764,0.25,0,0.7921,0.0676,0.25,0.0361,0.1764,0.25,0,0.1296,0.1296,0.25,0.2809,0.1936,0,0.2116,0,0.0676,0.6561,0.7396,0.2809,0.216382143,0.204942857,0.227821429,10,31.25,25,78.13,7,87.5,5,62.5,6,75,7,87.5,14,87.5,11,68.75,68.53,70.62,65.88,73.75,63.88,64.94,72.12,-46.88,-9.6,-16.88,3.38,-1.25,-23.62,-22.56,3.37,1,5,3,4,2,2,0,2,1,2,2,0,1,1,1,3,1,2,1,5,0,0,1,0,0,2,1,1,1,1,1,0,0,1,0,2,1,1,4,4,3,1.4,1,2.4,0.2,1.2,0.4,2.4,1.95,1.05,1.5,5.67,3.33,5.25,2.8,0.2,0.6,0,1.2,2,4,1,-1,2.34,-1,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,100 minutes,47 days,Female,High School (or equivalent),18,"pretty good survey, ",1.125,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,01PAST,02DGEN,02REV,8,9,3,6,4,5,7,1,2,2,4,3,1 +903,R_6U3KmYdeqoSlheG,18 - 24,,Canadian,Canadian,Female,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,3,5,4,2,1,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,3,4,5,Neither Agree nor Disagree,Strongly Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,3,5,1,4,2,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,1,5,2,4,3,10,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,1,3,5,4,2,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,5,4,1,3,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,5,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,2,4,1,5,3,3,Disagree,Disagree,Agree,Neither agree nor disagree,Agree,3,1,4,2,5,2,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,3,1,2,5,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,5,2,3,1,TRUE,67,TRUE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,60,TRUE,59,FALSE,69,FALSE,85,TRUE,100,TRUE,95,TRUE,91,TRUE,87,FALSE,91,FALSE,77,TRUE,69,TRUE,78,TRUE,93,TRUE,50,FALSE,50,TRUE,79,FALSE,50,FALSE,50,TRUE,100,FALSE,72,TRUE,100,FALSE,50,TRUE,59,TRUE,62,FALSE,80,FALSE,59,TRUE,96,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,0,3,2,-2,0,0,1,0,0,-3,2,1,0,0,2,-1,0,-3,2,1,2,-2,0,4,-3,0,0,2,-3,10,0,0,0,1,0,7,1,0,1,-2,0,2,2,3,1,3,3,2,-2,-2,2,0,2,3,0,-3,3,1,0,2,3,3,3,3,1,1,TRUE,0,67,TRUE,1,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,60,TRUE,1,59,FALSE,0,69,FALSE,0,85,TRUE,1,100,TRUE,0,95,TRUE,0,91,TRUE,1,87,FALSE,1,91,FALSE,0,77,TRUE,1,69,TRUE,0,78,TRUE,0,93,TRUE,0,50,FALSE,1,50,TRUE,1,79,FALSE,0,50,FALSE,1,50,TRUE,1,100,FALSE,1,72,TRUE,1,100,FALSE,1,50,TRUE,0,59,TRUE,0,62,FALSE,0,80,FALSE,0,59,TRUE,1,96,0.4761,0,0.0961,0.1681,0.0016,0.16,0,0,0.25,0.25,0.64,0.0169,0.7225,0.9025,0,0.25,0.25,0.25,0.3481,0.0784,0.0441,0.5929,0.25,0.0081,0.6084,0.25,0.3481,0.4489,0,0.8649,0.3844,0.8281,0.312425,0.263821429,0.361028571,20,62.5,18,56.25,3,37.5,6,75,5,62.5,4,50,10,62.5,8,50,74.31,64.5,76.5,79,77.25,78.75,69.88,6.25,18.06,27,1.5,16.5,27.25,16.25,19.88,4,2,2,5,2,1,0,0,1,3,0,3,2,0,0,1,2,2,2,3,4,0,1,0,1,0,2,2,1,2,0,0,1,0,0,3,1,4,3,4,3,1,1,2,1.2,1.4,0.2,3,1.75,1.45,1.6,7,2.33,3.875,1.8,-0.4,0.8,-1,0.733333333,2,7,5,1,4.67,2,2,2,-2,2,1,-1,0,0,-2,2,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,24,No feedback. This was a strange survey.,1.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,01DIR,5,6,7,3,8,4,9,1,2,3,2,4,1 +904,R_3fJEhsjBdt5E5AT,18 - 24,American,,American,Male,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,2,4,1,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,2,4,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,3,5,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0.321428571,0.142857143,0.5,30,93.75,23,71.88,5,62.5,7,87.5,8,100,3,37.5,14,87.5,9,56.25,100,100,100,100,100,100,100,21.87,28.12,37.5,12.5,0,62.5,12.5,43.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,22,thank you,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,5,8,9,2,6,7,4,1,3,4,2,3,1 +905,R_5jTF8jxiUSm42md,18 - 24,American,,American,Female,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,4,5,1,2,3,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,5,3,1,4,2,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,5,1,2,Neither agree nor disagree,Agree,Agree,Somewhat agree,Strongly disagree,5,2,3,1,4,Strongly disagree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,1,2,5,4,3,8,Strongly disagree,Disagree,Neither agree nor disagree,Strongly agree,Disagree,4,1,3,5,2,9,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,1,3,4,5,2,10,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,1,3,2,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly disagree,Strongly Agree,Strongly Agree,4,5,2,1,3,5,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,5,1,3,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,5,3,10,Agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,1,3,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,52,TRUE,57,TRUE,100,TRUE,76,TRUE,69,TRUE,50,TRUE,100,TRUE,100,TRUE,84,FALSE,58,FALSE,57,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,89,FALSE,78,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,55,TRUE,100,TRUE,100,TRUE,96,FALSE,60,16,-3,3,-3,3,3,3,1,3,1,3,3,2,3,1,3,0,2,2,1,-3,-3,3,3,-1,3,8,-3,-2,0,3,-2,9,3,1,0,3,3,10,-3,-1,0,-3,-3,10,-3,3,-3,3,3,5,3,3,2,3,3,10,3,3,3,3,3,10,2,2,1,1,0,10,FALSE,1,60,TRUE,1,96,TRUE,0,100,TRUE,0,100,TRUE,1,55,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,1,78,TRUE,1,89,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,57,FALSE,1,58,TRUE,1,84,TRUE,0,100,TRUE,1,100,TRUE,0,50,TRUE,0,69,TRUE,0,76,TRUE,1,100,TRUE,1,57,TRUE,1,52,0,0,0,0,0.2304,1,0.0256,0,1,0.3249,0,0,0,1,0.2025,0.0016,0.1764,1,0.4761,1,0,0.0121,1,0.0484,1,0.25,0.1849,0.16,1,1,0.5776,1,0.452517857,0.354385714,0.55065,16,50,18,56.25,4,50,5,62.5,5,62.5,4,50,15,93.75,3,18.75,86.91,86.5,80.12,86.88,94.12,86.88,86.94,-6.25,30.66,36.5,17.62,24.38,44.12,-6.87,68.19,0,0,6,4,0,6,3,3,2,5,0,1,3,2,0,3,3,2,4,0,0,0,0,0,0,0,2,1,2,0,0,1,0,2,0,2,0,1,0,3,2,3.8,1.2,2.4,0,1,0.6,1.2,2.35,0.7,1.525,9,8.33,9,2,2.8,0.6,1.2,1.8,3,-1,0,0,0.67,-1,2,1,2,-2,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,Trade School (non-military),20,,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,7,4,8,3,9,2,6,1,5,3,4,2,1 +906,R_7wGM92UfF3Vd7Rk,18 - 24,American,,American,Male,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly disagree,5,4,3,2,1,Agree,Agree,Agree,Somewhat agree,Agree,2,4,3,1,5,Somewhat Disagree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,5,1,4,2,3,Strongly Agree,Disagree,Somewhat agree,Somewhat disagree,Agree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly disagree,1,4,3,2,5,10,Agree,Disagree,Agree,Agree,Somewhat disagree,3,1,4,5,2,7,Strongly Agree,Strongly Disagree,Somewhat Disagree,Agree,Strongly Agree,1,3,2,5,4,6,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Agree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,1,4,5,2,3,8,Strongly agree,Strongly agree,Agree,Somewhat disagree,Agree,5,3,4,1,2,3,Somewhat Disagree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,3,4,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,3,4,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,TRUE,55,TRUE,95,TRUE,51,TRUE,75,TRUE,55,TRUE,60,FALSE,80,FALSE,65,TRUE,54,FALSE,80,TRUE,99,FALSE,80,FALSE,53,TRUE,70,TRUE,80,TRUE,90,TRUE,58,TRUE,70,TRUE,95,TRUE,95,FALSE,65,TRUE,60,FALSE,65,TRUE,80,TRUE,60,TRUE,75,TRUE,57,TRUE,70,TRUE,95,TRUE,60,TRUE,99,7,1,3,2,3,-3,2,2,2,1,2,-1,3,3,-2,3,3,-2,1,-1,2,2,3,3,-1,-3,7,2,-2,2,2,-1,10,3,-3,-1,2,3,7,0,2,2,-1,2,6,3,3,3,3,-2,1,3,3,2,-1,2,8,-1,3,3,-1,3,3,1,1,1,1,2,7,TRUE,0,99,TRUE,1,60,TRUE,0,95,TRUE,0,70,TRUE,1,57,TRUE,0,75,TRUE,1,60,TRUE,1,80,FALSE,0,65,TRUE,1,60,FALSE,1,65,TRUE,0,95,TRUE,1,95,TRUE,0,70,TRUE,1,58,TRUE,1,90,TRUE,0,80,TRUE,0,70,FALSE,1,53,FALSE,1,80,TRUE,1,99,FALSE,0,80,TRUE,0,54,FALSE,0,65,FALSE,1,80,TRUE,1,60,TRUE,0,55,TRUE,0,75,TRUE,0,51,TRUE,1,95,TRUE,1,55,TRUE,1,99,0.04,0.16,0.01,0.16,0.0001,0.5625,0.4225,0.16,0.04,0.64,0.0025,0.0025,0.4225,0.1225,0.1849,0.16,0.2916,0.49,0.5625,0.04,0.0001,0.1764,0.2209,0.49,0.64,0.3025,0.2025,0.9801,0.9025,0.49,0.2601,0.9025,0.345417857,0.250114286,0.440721429,7,21.88,17,53.13,5,62.5,4,50,4,50,4,50,13,81.25,4,25,73.28,60.12,76.25,72.38,84.38,73.62,72.94,-31.25,20.15,-2.38,26.25,22.38,34.38,-7.63,47.94,1,0,1,4,0,0,4,0,1,3,4,6,4,4,0,3,4,1,0,0,2,0,1,0,1,1,1,0,2,0,0,0,0,1,0,2,3,0,2,0,1.2,1.6,3.6,1.6,0.8,0.8,0.2,1.4,2,0.8,1.4,8,4,6.125,0.4,0.8,3.4,0.2,1.533333333,6,2,4,-1,4,1,2,1,-2,2,1,-1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,22,I like the survey but am not really sure the purpose of it...,1.125,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,4,9,8,2,7,5,6,1,3,3,4,2,1 +907,R_3l4abEHSRGvw1GI,18 - 24,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,3,2,4,5,1,Somewhat Agree,Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,4,1,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,4,5,3,2,1,7,Disagree,Somewhat agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,1,4,5,2,3,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Agree,4,3,2,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,8,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,3,1,2,5,4,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,3,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,79,TRUE,93,FALSE,63,TRUE,59,FALSE,61,TRUE,50,TRUE,55,TRUE,95,FALSE,50,TRUE,50,FALSE,59,TRUE,77,TRUE,85,TRUE,81,FALSE,50,TRUE,82,TRUE,64,FALSE,50,TRUE,63,TRUE,90,FALSE,77,TRUE,89,TRUE,72,TRUE,72,FALSE,61,TRUE,61,FALSE,57,TRUE,89,FALSE,50,TRUE,50,TRUE,60,24,0,0,0,0,0,-1,0,-1,0,1,1,-2,0,-1,1,0,0,0,0,1,1,0,1,0,-2,6,-2,1,3,-1,0,7,0,0,0,2,2,8,0,0,1,0,-1,5,-2,1,2,0,-1,5,1,2,2,0,1,8,0,0,0,0,0,6,0,0,0,0,0,5,TRUE,0,60,TRUE,1,50,FALSE,1,50,TRUE,0,89,FALSE,0,57,TRUE,0,61,FALSE,0,61,TRUE,1,72,TRUE,1,72,TRUE,1,89,FALSE,1,77,TRUE,0,90,TRUE,1,63,FALSE,1,50,TRUE,1,64,TRUE,1,82,FALSE,1,50,TRUE,0,81,TRUE,0,85,TRUE,0,77,FALSE,0,59,TRUE,1,50,FALSE,1,50,TRUE,1,95,TRUE,0,55,TRUE,1,50,FALSE,1,61,TRUE,0,59,FALSE,1,63,TRUE,1,93,FALSE,0,79,FALSE,0,100,0.0784,0.25,0.0324,0.3721,1,0.3721,0.0025,0.0121,0.5929,0.25,0.0049,0.1369,0.0784,0.0529,0.3249,0.25,0.25,0.7921,0.3481,0.3025,0.3481,0.1296,0.7225,0.25,0.25,0.1521,0.6241,0.36,0.25,0.6561,0.1369,0.81,0.337846429,0.294264286,0.381428571,24,75,18,56.25,5,62.5,4,50,4,50,5,62.5,11,68.75,7,43.75,68.56,72.12,62.88,62,77.25,71,66.12,18.75,12.31,9.62,12.88,12,14.75,2.25,22.37,1,0,1,0,2,1,1,4,1,1,1,2,0,3,1,0,0,1,0,2,2,1,2,0,1,2,2,3,0,0,1,2,0,1,1,0,0,0,0,1,0.8,1.6,1.4,0.6,1.2,1.4,1,0.2,1.1,0.95,1.025,7,6.33,6.25,-0.4,0.2,0.4,0.4,0.066666667,1,-1,2,0,0.67,0,0,0,0,0,0,0,0,0,0,0,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,ok,0,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,8,5,2,9,4,3,6,1,7,2,4,3,1 +908,R_3bE5SzkOxAqHxRL,18 - 24,American,,American,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,3,5,4,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,4,1,5,2,3,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,2,5,3,4,1,Agree,Somewhat agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,5,2,1,4,Somewhat agree,Somewhat agree,Strongly Agree,Strongly disagree,Strongly Agree,3,2,4,1,5,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,3,2,5,4,1,7,Neither Agree nor Disagree,Strongly Agree,Agree,Agree,Strongly Disagree,1,5,2,4,3,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Strongly disagree,4,2,3,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Strongly disagree,Strongly Agree,2,1,3,5,4,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,3,2,1,5,4,5,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,4,1,2,5,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,2,3,5,1,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,91,TRUE,100,TRUE,100,FALSE,90,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,0,3,-3,-3,-3,-3,3,1,3,2,3,-3,2,1,3,3,0,1,1,3,-3,3,8,-3,-3,-3,-3,3,7,0,3,2,2,-3,9,0,0,0,3,-3,6,0,3,3,-3,3,10,-3,-3,-3,-3,3,5,-3,3,0,0,-3,5,3,3,3,3,0,10,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,100,FALSE,1,90,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,TRUE,1,100,0.0081,0,0,0,0,0.25,0,0,0.25,0,1,0,0,0.01,0,0,0,0.25,1,0,0,0,0,0,1,0,0,0,0,1,0,0.25,0.178928571,0.125714286,0.232142857,25,78.13,28,87.5,8,100,7,87.5,7,87.5,6,75,15,93.75,13,81.25,93.16,92.5,93.75,100,86.38,99.44,86.88,-9.37,5.66,-7.5,6.25,12.5,11.38,5.69,5.63,1,2,0,3,0,0,0,0,0,0,1,0,0,1,0,2,1,3,0,3,0,0,0,3,0,0,0,0,0,0,4,0,2,3,0,1,2,0,0,0,1.2,0,0.4,1.8,0.6,0,1.8,0.6,0.85,0.75,0.8,8,6.67,7.5,0.6,0,-1.4,1.2,-0.266666667,-2,2,4,-4,1.33,2,0,0,0,0,2,-2,0,0,-2,2,2,10 cents,100 minutes,47 days,Male,University - Graduate (Masters),19,Very nice survey I like this option.,0.5,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,5,2,4,7,6,9,3,1,8,4,3,2,1 +909,R_3eIQtfq2u3vKgHa,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Agree,Strongly agree,4,5,2,3,1,Somewhat disagree,Somewhat agree,Agree,Strongly agree,Somewhat agree,4,3,2,1,5,Agree,Agree,Agree,Agree,Agree,4,5,2,3,1,Agree,Agree,Agree,Agree,Somewhat disagree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,4,5,1,3,2,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,1,2,4,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,4,1,2,3,4,Agree,Agree,Agree,Agree,Agree,2,5,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,4,1,2,5,2,Agree,Agree,Somewhat agree,Strongly agree,Somewhat agree,5,2,4,1,3,3,Agree,Agree,Agree,Agree,Agree,5,2,1,3,4,3,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,3,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,62,FALSE,59,TRUE,60,TRUE,67,TRUE,66,TRUE,71,TRUE,63,TRUE,65,TRUE,62,FALSE,66,TRUE,62,TRUE,63,TRUE,63,FALSE,67,TRUE,81,FALSE,59,FALSE,63,TRUE,66,TRUE,67,TRUE,62,TRUE,81,TRUE,57,TRUE,58,TRUE,63,TRUE,65,TRUE,64,TRUE,63,FALSE,62,FALSE,59,TRUE,65,TRUE,60,TRUE,59,11,2,3,2,2,3,-1,1,2,3,1,2,2,2,2,2,2,2,2,2,-1,1,3,3,1,3,5,1,1,1,2,1,2,1,1,1,1,1,2,2,2,2,2,2,4,3,3,3,2,2,6,2,2,1,3,1,2,2,2,2,2,2,3,2,2,1,1,1,3,TRUE,0,59,TRUE,1,60,TRUE,0,65,FALSE,1,59,FALSE,0,62,TRUE,0,63,TRUE,1,64,TRUE,1,65,TRUE,1,63,TRUE,1,58,TRUE,0,57,TRUE,0,81,TRUE,1,62,TRUE,0,67,TRUE,1,66,FALSE,0,63,FALSE,1,59,TRUE,0,81,FALSE,1,67,TRUE,0,63,TRUE,1,63,TRUE,1,62,FALSE,1,66,TRUE,1,62,TRUE,0,65,TRUE,1,63,TRUE,0,71,TRUE,0,66,TRUE,0,67,TRUE,1,60,FALSE,0,59,TRUE,1,62,0.1225,0.1369,0.3969,0.1296,0.1444,0.3969,0.1444,0.1764,0.3969,0.1444,0.16,0.1444,0.1369,0.3249,0.3844,0.16,0.1156,0.1681,0.4356,0.4225,0.1369,0.1156,0.1089,0.4489,0.1681,0.5041,0.3481,0.3481,0.4225,0.6561,0.4489,0.6561,0.293503571,0.214121429,0.372885714,11,34.38,17,53.13,5,62.5,5,62.5,4,50,3,37.5,13,81.25,4,25,64.06,62.75,63,64.88,65.62,62.12,66,-18.75,10.93,0.25,0.5,14.88,28.12,-19.13,41,1,0,1,1,0,2,0,1,1,0,1,1,1,1,1,0,0,0,0,3,1,0,1,0,1,3,1,1,0,0,0,0,0,0,0,0,0,1,1,2,0.6,0.8,1,0.6,0.6,1,0,0.8,0.75,0.6,0.675,3,3.67,3.375,0,-0.2,1,-0.2,0.266666667,-1,0,-1,1,-0.67,0,-1,0,-1,1,1,-1,1,-1,1,-1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,3,8,6,2,4,5,9,1,7,3,2,4,1 +910,R_5Id4nGbfP5nTMTD,18 - 24,,Canadian,Canadian,Female,Agree,Agree,Somewhat disagree,Strongly disagree,Agree,4,5,2,3,1,Agree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,2,5,1,4,3,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Agree,Strongly Agree,5,3,1,2,4,Agree,Somewhat agree,Agree,Agree,Strongly disagree,1,3,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,5,1,2,3,4,8,Disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,4,1,5,3,2,9,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,3,2,4,1,5,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly disagree,Agree,Strongly Agree,1,3,4,2,5,5,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,2,3,7,Disagree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,3,5,1,2,4,7,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,1,4,2,FALSE,60,TRUE,50,FALSE,80,FALSE,51,TRUE,85,FALSE,92,TRUE,65,TRUE,95,TRUE,51,TRUE,65,FALSE,51,TRUE,60,TRUE,53,FALSE,93,TRUE,52,TRUE,51,TRUE,51,TRUE,87,TRUE,51,TRUE,51,TRUE,51,TRUE,87,TRUE,65,TRUE,77,TRUE,76,TRUE,92,TRUE,51,FALSE,60,TRUE,52,TRUE,81,FALSE,52,TRUE,91,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,-1,-3,2,2,1,3,-1,3,0,-3,3,2,3,2,1,2,2,-3,3,3,3,-2,3,4,-2,3,-3,3,-3,8,3,3,-1,3,0,9,-3,-3,-3,-3,-3,10,3,3,-3,2,3,8,0,-2,3,-3,3,5,-2,-3,3,-2,3,7,3,3,3,3,3,7,FALSE,1,60,TRUE,1,50,FALSE,1,80,FALSE,1,51,TRUE,1,85,FALSE,1,92,TRUE,1,65,TRUE,1,95,TRUE,1,51,TRUE,1,65,FALSE,1,51,TRUE,0,60,TRUE,1,53,FALSE,1,93,TRUE,1,52,TRUE,1,51,TRUE,0,51,TRUE,0,87,TRUE,0,51,TRUE,0,51,TRUE,1,51,TRUE,1,87,TRUE,0,65,TRUE,1,77,TRUE,0,76,TRUE,1,92,TRUE,0,51,FALSE,1,60,TRUE,0,52,TRUE,1,81,FALSE,0,52,TRUE,1,91,0.0025,0.0064,0.2401,0.1225,0.0081,0.0064,0.0529,0.1225,0.2601,0.0169,0.0361,0.2209,0.2401,0.2401,0.0225,0.25,0.4225,0.2401,0.16,0.5776,0.2401,0.2304,0.2601,0.0049,0.2601,0.2601,0.2704,0.16,0.04,0.7569,0.2704,0.36,0.213935714,0.1528,0.275071429,8,25,22,68.75,5,62.5,5,62.5,6,75,6,75,15,93.75,7,43.75,66.53,51.12,67.5,78.12,69.38,68.62,64.44,-43.75,-2.22,-11.38,5,3.12,-5.62,-25.13,20.69,1,1,4,1,1,4,2,6,4,6,3,6,4,1,3,5,4,5,5,0,1,1,2,5,1,2,3,0,2,0,2,0,0,4,0,1,2,1,1,6,1.6,4.4,3.4,3.8,2,1.4,1.2,2.2,3.3,1.7,2.5,7,6.67,7.25,-0.4,3,2.2,1.6,1.6,-4,3,2,3,0.33,0,2,2,-2,2,-1,1,-1,1,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,This survey was easy to read and understand and fun to take,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,7,6,8,3,9,2,5,1,4,2,3,4,1 +911,R_3GdmyJ2yUqxO7YT,18 - 24,American,,American,Female,Disagree,Agree,Somewhat agree,Strongly agree,Agree,1,3,2,4,5,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,3,4,2,5,1,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,4,3,2,5,1,Agree,Somewhat agree,Agree,Agree,Agree,2,3,1,4,5,Disagree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat disagree,1,3,5,2,4,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,5,2,4,1,3,8,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,1,3,4,2,5,8,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,5,2,1,3,7,Somewhat agree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,2,4,3,5,1,6,Agree,Agree,Somewhat Agree,Strongly Agree,Agree,5,4,2,3,1,6,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,4,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,80,FALSE,54,TRUE,100,FALSE,59,TRUE,69,FALSE,100,TRUE,84,TRUE,66,TRUE,77,FALSE,79,FALSE,56,TRUE,68,FALSE,66,FALSE,59,TRUE,80,TRUE,94,TRUE,62,FALSE,88,FALSE,65,FALSE,55,FALSE,71,TRUE,93,FALSE,87,TRUE,78,FALSE,100,TRUE,84,FALSE,58,FALSE,97,TRUE,67,TRUE,65,FALSE,59,TRUE,86,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,1,3,2,1,1,3,1,2,1,1,2,2,2,2,1,2,2,2,-2,3,1,3,-1,4,1,1,2,1,-1,8,3,3,-1,3,1,8,2,-1,1,1,1,7,-1,3,2,3,3,7,1,1,3,-1,2,6,2,2,1,3,2,6,3,3,3,3,3,8,TRUE,0,80,FALSE,0,54,TRUE,0,100,FALSE,1,59,TRUE,1,69,FALSE,1,100,TRUE,1,84,TRUE,1,66,TRUE,1,77,FALSE,0,79,FALSE,1,56,TRUE,0,68,FALSE,0,66,FALSE,1,59,TRUE,1,80,TRUE,1,94,TRUE,0,62,FALSE,1,88,FALSE,1,65,FALSE,1,55,FALSE,0,71,TRUE,1,93,FALSE,1,87,TRUE,1,78,FALSE,1,100,TRUE,1,84,FALSE,1,58,FALSE,1,97,TRUE,0,67,TRUE,1,65,FALSE,0,59,TRUE,1,86,0.1156,0.0256,0.0036,0.0256,0.0196,0,0.0484,0.6241,0.2025,0.0049,0.1225,0.4356,0.0529,0.1936,0.0961,0.2916,0.0169,0.1681,0.0009,0,0.5041,0.04,0.1225,0.1681,0.3844,0.1764,0.3481,0.64,1,0.0144,0.4489,0.4624,0.23525,0.162628571,0.307871429,24,75,22,68.75,6,75,4,50,6,75,6,75,11,68.75,11,68.75,75.19,63.5,76,83.38,77.88,75.31,75.06,6.25,6.44,-11.5,26,8.38,2.88,6.56,6.31,0,1,0,0,3,0,0,1,0,3,2,2,3,1,1,0,2,1,1,1,1,1,1,0,1,0,0,0,2,0,1,1,1,1,0,1,2,1,1,1,0.8,0.8,1.8,1,0.8,0.4,0.8,1.2,1.1,0.8,0.95,6.67,6.33,6.75,0,0.4,1,-0.2,0.466666667,-3,2,2,-1,0.34,1,1,1,1,-1,2,-2,2,-2,1,-1,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),24,Very inciteful,-0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,01DIR,8,6,4,9,5,2,3,1,7,3,4,2,1 +912,R_7oYZmtoO8ONj4I1,18 - 24,American,,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,5,4,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,1,5,2,4,3,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,1,5,4,3,Agree,Agree,Somewhat agree,Agree,Somewhat agree,1,4,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,4,2,1,3,5,8,Strongly agree,Agree,Agree,Strongly agree,Agree,5,3,1,4,2,8,Agree,Strongly Agree,Strongly Agree,Agree,Agree,3,2,5,4,1,8,Agree,Strongly Agree,Agree,Agree,Agree,4,2,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,4,3,5,2,7,Agree,Agree,Strongly agree,Strongly agree,Agree,5,4,3,2,1,7,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,1,4,5,2,7,Agree,Somewhat agree,Somewhat agree,Agree,Agree,3,1,2,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,80,TRUE,76,TRUE,89,TRUE,85,FALSE,66,TRUE,86,FALSE,98,TRUE,77,TRUE,79,FALSE,84,TRUE,85,TRUE,83,FALSE,88,TRUE,95,TRUE,100,FALSE,84,TRUE,81,FALSE,87,TRUE,80,TRUE,85,TRUE,86,FALSE,75,TRUE,78,FALSE,90,FALSE,88,TRUE,88,FALSE,82,TRUE,86,FALSE,84,TRUE,81,TRUE,81,TRUE,81,23,2,3,3,1,3,2,1,3,1,2,2,1,2,1,2,2,2,1,2,1,3,2,3,2,3,8,3,2,2,3,2,8,2,3,3,2,2,8,2,3,2,2,2,8,2,3,3,2,3,7,2,2,3,3,2,7,2,1,2,2,1,7,2,1,1,2,2,7,TRUE,0,81,TRUE,1,81,TRUE,0,81,FALSE,1,84,TRUE,1,86,FALSE,1,82,TRUE,1,88,FALSE,0,88,FALSE,0,90,TRUE,1,78,FALSE,1,75,TRUE,0,86,TRUE,1,85,TRUE,0,80,FALSE,0,87,TRUE,1,81,FALSE,1,84,TRUE,0,100,TRUE,0,95,FALSE,1,88,TRUE,1,83,TRUE,1,85,FALSE,1,84,TRUE,1,79,TRUE,0,77,FALSE,0,98,TRUE,0,86,FALSE,1,66,TRUE,0,85,TRUE,1,89,TRUE,1,76,FALSE,0,80,0.7744,0.9604,0.0361,0.0144,0.64,0.0324,0.0441,0.0484,0.0144,0.0225,0.0121,0.0225,0.81,0.0625,0.0196,0.0361,0.0256,0.0256,0.1156,0.5929,0.0289,0.7569,0.9025,0.64,0.0256,0.7396,0.0576,0.6561,0.6561,1,0.7225,0.7396,0.337489286,0.1297,0.545278571,23,71.88,18,56.25,4,50,6,75,3,37.5,5,62.5,11,68.75,7,43.75,84,84.25,83.62,85.88,82.25,84.62,83.38,15.63,27.75,34.25,8.62,48.38,19.75,15.87,39.63,1,1,0,1,0,1,1,1,2,0,0,2,1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,2,0,0,0,0,1,1,0,1,0,0,1,0.6,1,0.8,0.6,0.2,0.6,0.4,0.4,0.75,0.4,0.575,8,7,7.5,0.4,0.4,0.4,0.2,0.4,1,1,1,1,1,0,0,2,1,-1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),22,this is a fun survey wish to have more like this,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,2,8,9,5,6,4,3,1,7,3,2,4,1 +913,R_1DooZXB2EuSAKJu,18 - 24,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Somewhat disagree,Disagree,Agree,4,3,1,2,5,Strongly disagree,Agree,Disagree,Neither agree nor disagree,Strongly agree,5,2,1,3,4,Agree,Somewhat Agree,Agree,Disagree,Neither Agree nor Disagree,2,4,3,1,5,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,5,2,1,4,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly Agree,3,4,2,5,1,10,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,1,4,2,5,10,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,3,5,1,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,3,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,3,2,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,2,3,8,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,FALSE,50,FALSE,75,FALSE,50,FALSE,50,FALSE,50,TRUE,90,TRUE,100,TRUE,83,FALSE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,90,TRUE,100,FALSE,50,TRUE,100,TRUE,57,FALSE,100,TRUE,100,TRUE,79,FALSE,50,TRUE,100,FALSE,50,TRUE,78,TRUE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,62,FALSE,50,FALSE,65,16,-3,3,-1,-2,2,-3,2,-2,0,3,2,1,2,-2,0,-3,-2,-3,-3,-3,1,0,2,0,3,10,3,0,0,-1,1,10,2,0,0,1,0,10,3,3,3,3,3,10,0,3,0,0,0,8,0,0,0,0,0,8,2,0,0,0,0,5,0,0,0,0,0,5,FALSE,1,65,FALSE,0,50,TRUE,0,62,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,50,TRUE,1,78,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,79,TRUE,1,100,FALSE,1,100,TRUE,1,57,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,90,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,100,TRUE,1,83,TRUE,0,100,TRUE,1,90,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,0,75,FALSE,0,50,FALSE,0,50,0.0484,0.01,0,0.25,0.25,0,0.0289,0,0.25,0.25,0.5625,0,0.25,0.25,0.25,0.25,0,0.25,0.25,1,0.25,0.1849,0.81,0,0.25,0.25,0.25,0.1225,0.3844,1,0.25,0.6241,0.293475,0.1851,0.40185,16,50,19,59.38,4,50,5,62.5,5,62.5,5,62.5,8,50,11,68.75,69.66,55.88,68.75,81.88,72.12,67.69,71.62,-9.38,10.28,5.88,6.25,19.38,9.62,17.69,2.87,4,3,3,2,1,6,2,2,1,2,0,1,2,3,0,6,5,6,6,6,3,0,1,2,2,3,2,2,0,3,0,1,2,2,0,3,2,3,3,3,2.6,2.6,1.2,5.8,1.6,2,1,2.8,3.05,1.85,2.45,10,7,8.25,1,0.6,0.2,3,0.6,2,2,5,5,3,2,2,2,-2,2,0,0,2,-2,0,0,2,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,none,1,0,1,1,1,0,0,0.67,0.33,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,9,5,3,2,4,7,8,1,6,4,3,2,1 +914,R_3ASFLRx5pg2eAMM,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Strongly agree,Agree,Disagree,Neither agree nor disagree,5,1,2,3,4,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,3,4,2,Somewhat Agree,Strongly Disagree,Agree,Somewhat Disagree,Strongly Agree,4,1,3,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Agree,Strongly Agree,Strongly disagree,Somewhat agree,1,5,4,3,2,3,Somewhat agree,Strongly agree,Somewhat disagree,Disagree,Somewhat agree,5,2,4,3,1,3,Somewhat Disagree,Disagree,Strongly Agree,Agree,Agree,3,5,2,4,1,1,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Strongly Agree,Agree,Neither agree nor disagree,Somewhat agree,3,1,5,2,4,1,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,1,Somewhat Agree,Strongly Disagree,Agree,Disagree,Strongly agree,5,3,1,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,4,3,5,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,50,FALSE,95,FALSE,60,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,91,TRUE,91,FALSE,58,FALSE,60,TRUE,100,FALSE,65,TRUE,100,TRUE,53,FALSE,100,FALSE,64,FALSE,71,FALSE,54,TRUE,92,TRUE,91,TRUE,65,FALSE,55,FALSE,91,TRUE,85,FALSE,70,TRUE,54,TRUE,64,FALSE,96,21,1,3,2,-2,0,-2,1,1,1,1,1,-3,2,-1,3,1,1,1,0,-2,3,2,3,-3,1,2,1,3,-1,-2,1,3,-1,-2,3,2,2,3,2,3,3,2,3,1,2,3,2,0,1,0,-1,0,2,0,0,1,1,-3,2,-2,3,1,0,0,1,0,-2,3,FALSE,1,96,TRUE,1,64,TRUE,0,54,FALSE,1,70,TRUE,1,85,FALSE,1,91,FALSE,0,55,TRUE,1,65,TRUE,1,91,TRUE,1,92,FALSE,1,54,FALSE,1,71,FALSE,0,64,FALSE,1,100,TRUE,1,53,TRUE,1,100,FALSE,1,65,TRUE,0,100,FALSE,1,60,FALSE,1,58,TRUE,1,91,TRUE,1,91,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,FALSE,1,60,FALSE,0,95,TRUE,1,50,TRUE,1,90,0.1225,0,0,0.3025,0.01,0.0081,0,0.0064,0.1764,0.0081,0.9025,0.4096,0.0081,0.2116,0.0225,0.1296,0,0.09,0,0,0.0081,0.2209,0.16,0,0.1225,0.25,0.25,0.0016,0.2916,1,0.16,0.0841,0.161846429,0.141635714,0.182057143,21,65.63,27,84.38,8,100,7,87.5,6,75,6,75,13,81.25,14,87.5,78.59,61.5,80.75,91.75,80.38,80.38,76.81,-18.75,-5.79,-38.5,-6.75,16.75,5.38,-0.87,-10.69,2,1,1,1,1,3,2,2,3,0,2,1,1,3,1,1,2,2,2,5,1,0,0,2,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,0,1.2,2,1.6,2.4,0.8,1,0.2,0.4,1.8,0.6,1.2,2.67,0.67,1.75,0.4,1,1.4,2,0.933333333,2,2,2,-2,2,1,1,1,-2,2,0,0,-1,1,-1,1,2,5 cents,100 minutes,47 days,Female,University - Undergraduate,22,,1.125,1,0,1,0,1,0,0.67,0.33,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,3,7,4,9,6,8,5,1,2,2,4,3,1 +915,R_1fjs7QwhfJ2SNCa,18 - 24,American,,American,Female,Somewhat disagree,Somewhat agree,Disagree,Disagree,Disagree,2,1,5,4,3,Strongly disagree,Somewhat agree,Disagree,Agree,Somewhat disagree,1,3,2,4,5,Somewhat Disagree,Disagree,Somewhat Agree,Strongly Disagree,Somewhat Agree,3,4,1,5,2,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,5,2,3,4,1,Strongly Agree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,3,2,1,4,9,Disagree,Somewhat disagree,Strongly disagree,Disagree,Somewhat disagree,4,2,5,1,3,4,Strongly Agree,Disagree,Somewhat Disagree,Agree,Somewhat Disagree,4,2,3,1,5,7,Somewhat disagree,Disagree,Disagree,Disagree,Strongly Agree,3,2,4,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,2,4,3,7,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,1,2,3,4,5,5,Somewhat Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,2,5,4,3,0,Disagree,Disagree,Somewhat disagree,Disagree,Somewhat agree,1,4,3,2,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,90,FALSE,70,FALSE,70,FALSE,95,FALSE,60,FALSE,50,FALSE,50,FALSE,91,TRUE,95,FALSE,50,TRUE,70,TRUE,75,FALSE,50,TRUE,70,TRUE,69,TRUE,70,FALSE,50,FALSE,50,FALSE,50,FALSE,78,FALSE,88,FALSE,50,TRUE,61,FALSE,50,FALSE,82,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,58,FALSE,50,TRUE,69,14,-1,1,-2,-2,-2,-3,1,-2,2,-1,-1,-2,1,-3,1,-3,-3,-2,-3,-3,3,-1,1,-2,0,9,-2,-1,-3,-2,-1,4,3,-2,-1,2,-1,7,-1,-2,-2,-2,3,3,1,1,1,1,1,7,-2,0,-1,1,1,5,-1,-2,1,-1,1,0,-2,-2,-1,-2,1,3,TRUE,0,69,FALSE,0,50,FALSE,1,58,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,82,FALSE,0,50,TRUE,1,61,FALSE,1,50,FALSE,1,88,FALSE,0,78,FALSE,1,50,FALSE,0,50,FALSE,0,50,TRUE,0,70,TRUE,0,69,TRUE,0,70,FALSE,1,50,TRUE,1,75,TRUE,1,70,FALSE,1,50,TRUE,1,95,FALSE,1,91,FALSE,0,50,FALSE,1,50,FALSE,1,60,FALSE,1,95,FALSE,0,70,FALSE,0,70,FALSE,0,90,0.6724,0.25,0.25,0.25,0.81,0.25,0.0025,0.1521,0.25,0.09,0.49,0.6084,0.25,0.25,0.25,0.25,0.25,0.25,0.16,0.0081,0.0625,0.25,0.49,0.25,0.49,0.25,0.49,0.4761,0.1764,0.4761,0.0025,0.0144,0.276753571,0.296642857,0.256864286,14,43.75,16,50,3,37.5,4,50,4,50,5,62.5,4,25,12,75,64.41,55,69.75,63.75,69.12,65.06,63.75,-6.25,14.41,17.5,19.75,13.75,6.62,40.06,-11.25,4,2,3,0,2,1,2,1,4,0,4,0,2,5,2,2,1,0,1,6,2,0,3,3,3,1,1,1,1,2,0,0,0,2,0,1,1,1,1,4,2.2,1.6,2.6,2,2.2,1.2,0.4,1.6,2.1,1.35,1.725,6.67,4,4.75,0,0.4,2.2,0.4,0.866666667,2,-1,7,0,2.67,1,1,1,-2,2,-1,1,-1,1,-2,2,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,"What's with the ""With respect to biological sex, are you -"" stuff? It seems creepy +",1.25,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,6,3,8,7,2,4,5,1,9,4,3,2,1 +916,R_7xPgAa1XuVBzGtQ,18 - 24,American,,American,Male,Agree,Agree,Agree,Agree,Agree,4,3,2,5,1,Agree,Strongly disagree,Agree,Strongly disagree,Agree,3,2,1,5,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,3,5,2,4,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,9,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,3,5,1,2,4,7,Somewhat Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,8,Agree,Agree,Agree,Agree,Agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,3,2,4,5,1,8,Agree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,2,1,3,4,5,8,Agree,Agree,Agree,Agree,Somewhat Agree,2,4,1,3,5,8,Agree,Agree,Agree,Agree,Agree,3,2,5,4,1,FALSE,70,TRUE,96,FALSE,61,FALSE,78,FALSE,71,FALSE,72,TRUE,92,FALSE,75,TRUE,72,TRUE,73,TRUE,78,TRUE,87,TRUE,85,FALSE,82,FALSE,80,TRUE,75,FALSE,76,TRUE,79,FALSE,86,FALSE,88,FALSE,79,TRUE,84,FALSE,83,TRUE,75,FALSE,78,FALSE,87,FALSE,82,TRUE,78,FALSE,80,TRUE,79,FALSE,80,FALSE,81,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,2,-3,2,-3,2,1,1,1,1,1,2,2,2,1,1,2,2,2,2,2,8,1,-3,1,-3,1,9,1,2,2,2,2,7,2,2,2,2,2,8,2,2,2,2,2,8,2,-3,1,-3,1,8,2,2,2,2,1,8,2,2,2,2,2,8,FALSE,1,70,TRUE,1,96,FALSE,1,61,FALSE,1,78,FALSE,0,71,FALSE,1,72,TRUE,1,92,FALSE,0,75,TRUE,1,72,TRUE,1,73,TRUE,0,78,TRUE,0,87,TRUE,1,85,FALSE,1,82,FALSE,0,80,TRUE,1,75,FALSE,1,76,TRUE,0,79,FALSE,1,86,FALSE,1,88,FALSE,0,79,TRUE,1,84,FALSE,1,83,TRUE,1,75,FALSE,1,78,FALSE,0,87,FALSE,1,82,TRUE,0,78,FALSE,1,80,TRUE,1,79,FALSE,0,80,FALSE,0,81,0.5625,0.7569,0.0625,0.0064,0.6561,0.0784,0.0625,0.0729,0.0144,0.0256,0.0441,0.0225,0.0784,0.6084,0.5041,0.0016,0.0289,0.0484,0.6084,0.0484,0.6241,0.64,0.0196,0.0324,0.0576,0.0324,0.64,0.09,0.1521,0.6241,0.04,0.7569,0.236153571,0.16045,0.311857143,10,31.25,21,65.63,5,62.5,5,62.5,6,75,5,62.5,9,56.25,12,75,79.44,81.5,78.38,80.62,77.25,80.25,78.62,-34.38,13.81,19,15.88,5.62,14.75,24,3.62,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,0.6,0.8,0.4,0,0.4,0.8,0.4,0.45,0.4,0.425,8,8,8,0,0.2,0,0,0.066666667,0,1,-1,0,0,1,1,1,-2,2,1,-1,1,-1,1,-1,1,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,23,,0.375,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,8,2,5,4,9,3,6,1,7,3,4,2,1 +917,R_3H1nqNEp9z9PHTX,18 - 24,American,,American,Male,Strongly agree,Strongly agree,Agree,Disagree,Disagree,1,5,2,4,3,Disagree,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,5,2,1,3,4,Agree,Disagree,Somewhat Agree,Somewhat Disagree,Strongly Agree,3,2,1,4,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Somewhat agree,Strongly Agree,Disagree,Agree,5,3,4,1,2,3,Neither agree nor disagree,Disagree,Disagree,Agree,Somewhat disagree,5,1,2,4,3,6,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,5,4,1,2,3,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,4,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,1,5,2,4,2,Agree,Disagree,Agree,Disagree,Strongly agree,1,5,3,4,2,6,Agree,Somewhat agree,Strongly Agree,Somewhat agree,Agree,5,1,3,2,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,56,TRUE,65,TRUE,61,TRUE,82,FALSE,65,FALSE,50,TRUE,87,FALSE,59,TRUE,66,FALSE,71,TRUE,96,TRUE,99,TRUE,57,TRUE,66,TRUE,56,FALSE,67,TRUE,96,FALSE,68,TRUE,78,TRUE,92,TRUE,82,TRUE,50,FALSE,56,TRUE,65,TRUE,81,TRUE,75,FALSE,59,TRUE,88,FALSE,52,FALSE,64,TRUE,59,FALSE,82,19,3,3,2,-2,-2,-2,-3,-1,1,1,2,-2,1,-1,3,-1,1,1,-1,-2,2,1,3,-2,2,8,0,-2,-2,2,-1,3,-1,-1,1,2,1,6,-1,-1,1,1,-2,7,1,2,3,1,0,3,1,-3,2,-1,0,4,2,-2,2,-2,3,2,2,1,3,1,2,6,FALSE,1,82,TRUE,1,59,FALSE,1,64,FALSE,1,52,TRUE,1,88,FALSE,1,59,TRUE,1,75,TRUE,1,81,TRUE,1,65,FALSE,0,56,TRUE,0,50,TRUE,0,82,TRUE,1,92,TRUE,0,78,FALSE,0,68,TRUE,1,96,FALSE,1,67,TRUE,0,56,TRUE,0,66,TRUE,0,57,TRUE,1,99,TRUE,1,96,FALSE,1,71,TRUE,1,66,FALSE,1,59,TRUE,1,87,FALSE,1,50,FALSE,1,65,TRUE,0,82,TRUE,1,61,TRUE,1,65,TRUE,1,56,0.0361,0.0169,0.0016,0.0625,0.1936,0.1681,0.1156,0.3136,0.3249,0.0016,0.1521,0.0064,0.1225,0.25,0.0144,0.1681,0.0841,0.2304,0.1225,0.1681,0.0001,0.4624,0.4356,0.6084,0.1089,0.25,0.1225,0.0324,0.1296,0.3136,0.6724,0.6724,0.223010714,0.153242857,0.292778571,19,59.38,23,71.88,5,62.5,7,87.5,5,62.5,6,75,14,87.5,9,56.25,70.31,59.38,76.75,73.62,71.5,75.62,65,-12.5,-1.57,-3.12,-10.75,11.12,-3.5,-11.88,8.75,1,2,1,0,4,2,1,1,1,2,3,1,0,3,2,0,2,0,2,0,2,1,1,3,2,3,0,3,2,1,0,0,1,1,0,3,0,2,2,4,1.6,1.4,1.8,0.8,1.8,1.8,0.4,2.2,1.4,1.55,1.475,5.67,3,4.875,-0.2,-0.4,1.4,-1.4,0.266666667,5,-1,4,1,2.67,1,1,1,-2,2,1,-1,-1,1,-1,1,0,5 cents,5 minutes,24 days,Male,University - Undergraduate,20,,0.75,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,6,4,5,3,9,2,7,1,8,3,2,4,1 +918,R_1qz22AVCAwv76bk,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,Strongly disagree,Strongly disagree,Somewhat agree,Strongly agree,Disagree,5,1,3,4,2,Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,2,5,3,1,4,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,4,3,5,1,2,3,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,2,3,1,5,4,3,Disagree,Strongly Disagree,Somewhat Agree,Agree,Strongly Agree,5,1,2,4,3,8,Agree,Agree,Agree,Agree,Strongly Agree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Agree,Agree,Somewhat agree,Strongly Agree,3,2,5,1,4,2,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,3,5,2,Agree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,5,4,3,2,1,8,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,4,1,3,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,98,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,70,TRUE,100,FALSE,95,TRUE,100,FALSE,80,TRUE,100,FALSE,100,FALSE,50,FALSE,50,TRUE,76,TRUE,50,TRUE,60,TRUE,60,FALSE,93,TRUE,92,TRUE,81,FALSE,50,TRUE,67,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,100,TRUE,90,TRUE,100,25,3,3,3,3,3,-3,-3,1,3,-2,2,-3,3,-2,3,-2,0,1,1,-2,3,3,3,3,-2,4,-3,-3,-3,3,-3,3,-2,-3,1,2,3,3,2,2,2,2,3,8,2,2,2,1,3,7,-3,-3,1,1,1,2,2,-3,3,-2,3,2,2,2,2,2,0,8,TRUE,0,100,TRUE,1,90,TRUE,0,100,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,67,FALSE,1,50,TRUE,0,81,TRUE,1,92,FALSE,1,93,TRUE,1,60,TRUE,1,60,TRUE,0,50,TRUE,0,76,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,80,TRUE,1,100,FALSE,1,95,TRUE,1,100,TRUE,0,70,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,98,0,0,0.16,0,0.0004,0,0,0.1089,0.25,0,0,0.0064,0.25,0.25,0,0.01,0.04,0.25,0,0.0025,1,0.16,0.25,0.0049,0.25,0.49,0.25,1,1,0.5776,1,0.6561,0.278814286,0.083264286,0.474364286,25,78.13,22,68.75,5,62.5,5,62.5,6,75,6,75,14,87.5,8,50,81.62,58.75,90,91.38,86.38,85.44,77.81,9.38,12.87,-3.75,27.5,16.38,11.38,-2.06,27.81,0,0,0,0,5,0,0,4,0,1,4,0,2,4,0,4,2,1,1,5,1,1,1,2,0,0,0,0,2,3,0,0,0,0,0,4,2,1,1,2,1,1,2,2.6,1,1,0,2,1.65,1,1.325,3.33,3.67,4.625,0,0,2,0.6,0.666666667,-3,1,1,0,-0.34,2,2,2,-2,2,0,0,-2,2,-2,2,2,10 cents,25 minutes,24 days,Female,University - Undergraduate,23,Nice survey,1.75,0,0,0,1,0,1,0,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,3,8,7,4,2,6,5,1,9,3,4,2,1 +919,R_18ZeIdwMss8AtrQ,18 - 24,American,,American,Female,Somewhat agree,Agree,Strongly agree,Somewhat agree,Strongly agree,1,2,4,5,3,Agree,Somewhat disagree,Agree,Somewhat agree,Agree,2,3,5,1,4,Somewhat Agree,Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,3,1,5,4,Agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,4,3,5,2,1,Disagree,Agree,Agree,Disagree,Agree,2,5,3,1,4,7,Strongly agree,Disagree,Somewhat disagree,Strongly agree,Strongly agree,3,5,4,1,2,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,1,4,5,2,3,5,Strongly Agree,Strongly Agree,Agree,Agree,Agree,5,4,1,3,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Somewhat agree,Agree,Strongly Agree,5,2,1,4,3,3,Agree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,4,5,1,2,3,2,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Somewhat Agree,2,4,1,3,5,6,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,1,3,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,75,TRUE,50,TRUE,90,FALSE,50,TRUE,60,FALSE,100,TRUE,90,TRUE,70,TRUE,50,FALSE,80,FALSE,50,TRUE,90,TRUE,60,FALSE,100,TRUE,80,TRUE,50,TRUE,57,TRUE,100,FALSE,50,TRUE,54,TRUE,91,TRUE,91,FALSE,90,TRUE,70,FALSE,65,TRUE,91,FALSE,50,TRUE,54,FALSE,50,FALSE,50,FALSE,50,FALSE,50,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,3,1,3,2,-1,2,1,2,1,-2,2,1,0,2,2,3,1,1,-2,2,2,-2,2,7,3,-2,-1,3,3,4,1,1,1,2,0,5,3,3,2,2,2,1,2,2,1,2,3,3,2,-2,2,0,1,2,2,0,3,-1,1,6,2,3,3,3,1,3,TRUE,0,75,TRUE,1,50,TRUE,0,90,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,90,TRUE,1,70,TRUE,1,50,FALSE,0,80,FALSE,1,50,TRUE,0,90,TRUE,1,60,FALSE,1,100,TRUE,1,80,TRUE,1,50,TRUE,0,57,TRUE,0,100,FALSE,1,50,TRUE,0,54,TRUE,1,91,TRUE,1,91,FALSE,1,90,TRUE,1,70,FALSE,1,65,TRUE,1,91,FALSE,1,50,TRUE,0,54,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.09,0.0081,0.25,0.01,0.25,0,0.09,0.64,0.2916,0.0081,0.25,0.16,0.25,0.25,0.16,0.25,0.01,0.25,0.2916,0.1225,0.0081,0.04,0.25,0,0.3249,0.25,0.25,0.5625,0.81,1,0.25,0.81,0.279617857,0.204264286,0.354971429,10,31.25,21,65.63,7,87.5,6,75,5,62.5,3,37.5,12,75,9,56.25,69,53.75,69.75,86.5,66,67.69,70.31,-34.38,3.37,-33.75,-5.25,24,28.5,-7.31,14.06,3,0,1,3,1,1,1,3,2,1,0,3,1,1,0,1,1,1,1,1,1,0,2,1,0,0,1,0,1,1,1,2,1,2,1,0,1,0,2,0,1.6,1.6,1,1,0.8,0.6,1.4,0.6,1.3,0.85,1.075,5.33,3.67,3.875,0.8,1,-0.4,0.4,0.466666667,4,2,-1,-2,1.66,1,1,2,-2,2,-1,1,-2,2,-2,2,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,21,,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,01DIR,9,7,2,6,4,3,8,1,5,2,3,4,1 +920,R_7Pq8WMBPdLAwPMa,18 - 24,American,,American,Female,Strongly disagree,Agree,Strongly agree,Strongly agree,Strongly agree,4,5,3,2,1,Disagree,Somewhat agree,Agree,Disagree,Somewhat agree,3,4,5,2,1,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,4,1,2,5,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly disagree,1,2,5,4,3,Somewhat agree,Somewhat disagree,Strongly Agree,Agree,Strongly Agree,3,2,4,5,1,1,Somewhat disagree,Strongly disagree,Somewhat disagree,Strongly disagree,Disagree,3,5,2,4,1,3,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,Somewhat Agree,2,5,1,3,4,2,Agree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,5,3,4,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Somewhat disagree,Strongly Agree,4,2,1,3,5,1,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,4,1,2,5,3,3,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,4,2,1,1,Agree,Agree,Agree,Somewhat agree,Agree,4,5,3,2,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,TRUE,75,TRUE,94,TRUE,63,FALSE,65,FALSE,50,TRUE,61,FALSE,50,TRUE,89,FALSE,50,FALSE,50,FALSE,97,FALSE,50,TRUE,67,TRUE,99,TRUE,61,TRUE,80,TRUE,100,FALSE,50,TRUE,84,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,75,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,73,TRUE,50,FALSE,87,10,-3,2,3,3,3,-2,1,2,-2,1,3,1,3,2,3,-1,0,1,1,-3,1,-1,3,2,3,1,-1,-3,-1,-3,-2,3,3,3,1,2,1,2,2,1,2,1,-3,6,0,3,3,-1,3,1,0,2,2,0,2,3,3,1,3,3,3,1,2,2,2,1,2,6,FALSE,1,87,TRUE,1,50,TRUE,0,73,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,75,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,84,FALSE,1,50,TRUE,1,100,TRUE,1,80,TRUE,0,61,TRUE,0,99,TRUE,0,67,FALSE,1,50,FALSE,0,97,FALSE,0,50,FALSE,1,50,TRUE,1,89,FALSE,1,50,TRUE,1,61,FALSE,1,50,FALSE,1,65,TRUE,0,63,TRUE,1,94,TRUE,1,75,FALSE,0,50,0.0625,0.1521,0.04,0,0.25,0.25,0.0121,0,0.25,0.25,0.0036,0.0256,0.25,0.25,0.25,0.25,0.25,0.25,0.1225,0.25,0.9409,0,0.4489,0.25,0.3721,0.25,0.0625,0.0169,0.5329,0.9801,0.3969,1,0.291607143,0.181521429,0.401692857,10,31.25,21,65.63,6,75,3,37.5,6,75,6,75,11,68.75,10,62.5,69.38,61.5,63.12,74.62,78.25,75.31,63.44,-34.38,3.75,-13.5,25.62,-0.38,3.25,6.56,0.94,4,3,0,1,0,1,4,3,1,3,0,2,2,0,2,3,1,1,0,0,3,1,0,4,0,2,1,0,2,1,0,0,0,1,0,3,2,1,0,5,1.6,2.4,1.2,1,1.6,1.2,0.2,2.2,1.55,1.3,1.425,2,1.67,2.875,0,1.2,1,-1.2,0.733333333,0,0,1,0,0.33,2,2,2,0,0,1,-1,1,-1,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,,1,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,01ITEM,02REV,7,6,8,5,9,2,3,1,4,4,3,2,1 +921,R_7IoZsPxWNX6p412,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,4,3,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,2,5,1,3,4,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,4,3,5,2,1,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Somewhat disagree,2,3,5,4,1,Agree,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,4,1,2,3,5,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Disagree,Somewhat agree,2,4,5,1,3,6,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,4,5,1,3,2,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,3,2,5,1,4,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,4,5,2,1,5,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,2,3,1,5,5,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,68,FALSE,74,FALSE,68,FALSE,67,TRUE,76,FALSE,62,TRUE,84,TRUE,67,FALSE,67,FALSE,68,TRUE,64,TRUE,66,TRUE,67,TRUE,65,FALSE,73,TRUE,73,FALSE,64,TRUE,74,TRUE,74,TRUE,74,FALSE,80,FALSE,68,FALSE,78,TRUE,70,FALSE,65,FALSE,80,TRUE,63,FALSE,76,TRUE,69,FALSE,72,TRUE,82,TRUE,76,12,1,2,1,0,-1,0,0,0,2,1,0,1,1,0,-1,1,2,3,1,-1,2,-1,1,2,1,6,0,1,0,-2,1,6,1,0,0,2,1,6,1,0,1,1,1,7,3,2,1,0,2,6,1,1,1,1,-1,5,0,2,1,-1,1,5,-1,1,2,0,1,7,TRUE,0,76,TRUE,1,82,FALSE,1,72,TRUE,0,69,FALSE,0,76,TRUE,0,63,FALSE,0,80,FALSE,0,65,TRUE,1,70,FALSE,0,78,FALSE,1,68,FALSE,1,80,TRUE,1,74,TRUE,0,74,TRUE,1,74,FALSE,0,64,TRUE,0,73,FALSE,1,73,TRUE,0,65,TRUE,0,67,TRUE,1,66,TRUE,1,64,FALSE,1,68,FALSE,0,67,TRUE,0,67,TRUE,1,84,FALSE,1,62,TRUE,0,76,FALSE,1,67,FALSE,0,68,FALSE,0,74,TRUE,1,68,0.4225,0.0256,0.4096,0.64,0.1024,0.3969,0.4489,0.6084,0.4489,0.1296,0.4624,0.0676,0.09,0.1024,0.5776,0.0324,0.1024,0.4761,0.5776,0.4489,0.1156,0.0676,0.4225,0.5476,0.5329,0.1444,0.5476,0.5776,0.0784,0.0729,0.1089,0.04,0.297446429,0.289,0.305892857,12,37.5,15,46.88,5,62.5,5,62.5,3,37.5,2,25,8,50,7,43.75,71.06,70.5,69.38,74.5,69.88,72.12,70,-9.38,24.18,8,6.88,37,44.88,22.12,26.25,1,3,0,2,2,0,1,0,4,0,1,1,1,2,2,0,2,2,0,2,2,0,0,0,3,1,1,1,1,2,0,1,0,1,2,2,1,1,1,2,1.6,1,1.4,1.2,1,1.2,0.8,1.4,1.3,1.1,1.2,6,5.33,6,0.6,-0.2,0.6,-0.2,0.333333333,0,1,1,0,0.67,2,1,0,-1,1,0,0,0,0,1,-1,0,10 cents,100 minutes,36 days,Female,University - Undergraduate,23,,0.375,0,0,0,1,1,0,0,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,9,3,4,8,7,5,6,1,2,4,2,3,1 +922,R_5ivTq3ppmJ52lcS,18 - 24,American,,American,Female,Somewhat agree,Strongly agree,Agree,Somewhat agree,Agree,5,2,3,1,4,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,5,3,Somewhat Agree,Strongly Disagree,Somewhat Agree,Disagree,Strongly Agree,1,5,3,4,2,Strongly disagree,Strongly disagree,Strongly disagree,Agree,Strongly disagree,3,4,5,1,2,Strongly Agree,Strongly Agree,Disagree,Disagree,Neither agree nor disagree,1,5,2,3,4,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,5,4,1,2,3,8,Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,1,2,4,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,3,5,4,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Somewhat agree,Agree,2,5,1,4,3,1,Disagree,Neither agree nor disagree,Agree,Disagree,Strongly agree,5,2,1,4,3,6,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,1,5,2,3,4,2,Agree,Agree,Agree,Agree,Disagree,3,5,1,2,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,52,FALSE,100,TRUE,52,TRUE,52,FALSE,80,TRUE,75,TRUE,98,TRUE,52,TRUE,64,FALSE,56,FALSE,53,TRUE,53,TRUE,53,TRUE,53,TRUE,53,TRUE,53,TRUE,60,TRUE,54,TRUE,53,FALSE,54,TRUE,54,TRUE,71,TRUE,53,TRUE,53,TRUE,68,TRUE,53,TRUE,69,TRUE,72,FALSE,63,FALSE,53,TRUE,67,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,1,2,-3,-1,1,1,1,1,-3,1,-2,3,-3,-3,-3,2,-3,3,3,-2,-2,0,3,-3,0,0,3,-1,8,-2,-3,3,-3,3,2,-3,-3,-3,-3,-3,2,2,3,2,1,2,1,-2,0,2,-2,3,6,2,-3,2,-3,3,2,2,2,2,2,-2,10,TRUE,0,96,TRUE,1,52,FALSE,1,100,TRUE,0,52,TRUE,1,52,FALSE,1,80,TRUE,1,75,TRUE,1,98,TRUE,1,52,TRUE,1,64,FALSE,1,56,FALSE,1,53,TRUE,1,53,TRUE,0,53,TRUE,1,53,TRUE,1,53,TRUE,0,53,TRUE,0,60,TRUE,0,54,TRUE,0,53,FALSE,0,54,TRUE,1,54,TRUE,0,71,TRUE,1,53,TRUE,0,53,TRUE,1,68,TRUE,0,53,TRUE,0,69,TRUE,0,72,FALSE,0,63,FALSE,0,53,TRUE,1,67,0.0004,0.1024,0.2209,0.0625,0.1089,0.04,0.2209,0.1296,0.2809,0.2116,0.3969,0.2209,0.2304,0.1936,0.2304,0.2304,0.5041,0.2704,0.4761,0.2809,0.2916,0.2209,0.2916,0.2809,0.2809,0.2809,0.2809,0.9216,0,0.36,0.5184,0.2209,0.284807143,0.2335,0.336114286,9,28.13,17,53.13,4,50,4,50,4,50,5,62.5,13,81.25,4,25,62.25,53.12,62.75,65.38,67.75,60.25,64.25,-25,9.12,3.12,12.75,15.38,5.25,-21,39.25,2,0,4,3,2,0,1,1,2,2,3,0,2,1,0,0,0,0,5,0,1,0,0,0,0,1,1,1,3,2,1,0,1,1,0,5,5,5,0,1,2.2,1.2,1.2,1,0.2,1.6,0.6,3.2,1.4,1.4,1.4,4.33,3,4.25,2,-0.4,0.6,-2.2,0.733333333,2,2,0,-8,1.33,1,2,2,-2,2,2,-2,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,N/A,1.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,01ITEM,01DIR,3,8,9,6,4,5,2,1,7,3,2,4,1 +923,R_7gphfUsWbSINllm,18 - 24,American,,American,Female,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,5,1,3,4,2,Disagree,Somewhat agree,Agree,Agree,Somewhat agree,2,3,5,1,4,Somewhat Agree,Agree,Agree,Agree,Strongly Agree,4,1,2,5,3,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,4,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,3,4,5,2,1,9,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly disagree,3,2,4,5,1,4,Agree,Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,4,5,2,1,3,3,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Agree,Agree,Strongly Agree,5,1,2,3,4,4,Somewhat agree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,2,3,5,4,1,1,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,5,3,4,1,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,3,5,FALSE,70,TRUE,53,TRUE,95,FALSE,58,TRUE,54,FALSE,100,FALSE,55,TRUE,55,FALSE,54,TRUE,95,FALSE,95,TRUE,55,TRUE,53,FALSE,52,TRUE,56,FALSE,54,TRUE,54,TRUE,100,FALSE,53,FALSE,52,FALSE,84,FALSE,62,FALSE,57,TRUE,54,TRUE,85,TRUE,94,FALSE,61,TRUE,87,FALSE,72,TRUE,66,TRUE,76,TRUE,100,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,0,2,-2,1,2,2,1,1,2,2,2,3,2,2,2,1,1,-3,-1,1,-2,1,7,-3,1,1,-1,-3,9,2,2,-1,3,-1,4,1,2,2,1,1,3,3,2,2,2,3,3,1,1,3,-1,2,4,2,3,3,1,3,1,3,3,3,3,3,3,FALSE,1,70,TRUE,1,53,TRUE,0,95,FALSE,1,58,TRUE,1,54,FALSE,1,100,FALSE,0,55,TRUE,1,55,FALSE,0,54,TRUE,1,95,FALSE,1,95,TRUE,0,55,TRUE,1,53,FALSE,1,52,TRUE,1,56,FALSE,0,54,TRUE,0,54,TRUE,0,100,FALSE,1,53,FALSE,1,52,FALSE,0,84,FALSE,0,62,FALSE,1,57,TRUE,1,54,TRUE,0,85,TRUE,1,94,FALSE,1,61,TRUE,0,87,FALSE,1,72,TRUE,1,66,TRUE,1,76,TRUE,1,100,0.2025,0.0036,0.2916,0.3025,0,0,0.2116,0.0025,0.2304,0.3844,0.1156,0.2209,0.2916,0.0025,0.2116,0.2209,0.1849,0.1764,0.7569,0.7225,0.7056,0.1936,0.2209,0.2304,0.2916,0.1521,0.0576,0.09,0.9025,1,0.0784,0.3025,0.284210714,0.16095,0.407471429,5,15.63,21,65.63,7,87.5,6,75,4,50,4,50,11,68.75,10,62.5,69.09,63.25,71.75,76.62,64.75,66.56,71.62,-50,3.46,-24.25,-3.25,26.62,14.75,-2.19,9.12,6,3,1,2,1,1,0,1,3,4,1,0,3,1,4,1,0,0,0,0,0,0,0,2,1,3,0,1,3,1,1,1,1,1,0,1,1,1,2,2,2.6,1.8,1.8,0.2,0.6,1.6,0.8,1.4,1.6,1.1,1.35,6.67,2.67,4.25,2,0.2,1,-1.2,1.066666667,4,5,3,0,4,1,2,1,-1,1,1,-1,-1,1,-2,2,-1,5 cents,100 minutes,24 days,Female,High School (or equivalent),19,,0.75,1,0,0,0,1,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,3,5,4,2,9,7,8,1,6,3,2,4,1 +924,R_3EzTfT7zZ08JSaM,18 - 24,American,,American,Female,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,1,4,5,2,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,1,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,4,3,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,5,2,4,1,3,8,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,3,1,2,4,7,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,2,4,1,8,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,4,5,2,1,7,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,2,1,5,4,7,Somewhat Agree,Somewhat Agree,Agree,Disagree,Agree,4,1,5,3,2,7,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,FALSE,81,FALSE,61,TRUE,100,FALSE,91,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,93,TRUE,91,FALSE,100,TRUE,90,TRUE,89,TRUE,97,FALSE,100,FALSE,100,FALSE,78,FALSE,75,TRUE,97,FALSE,100,TRUE,100,FALSE,83,TRUE,100,FALSE,85,FALSE,100,TRUE,100,FALSE,100,TRUE,79,TRUE,79,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,1,2,-1,-1,1,-1,1,1,1,1,-1,1,1,1,1,1,1,-1,2,-1,1,0,6,1,-1,-1,1,-1,8,1,-1,1,1,1,7,-1,-1,-1,-1,-1,8,2,1,1,1,2,7,-2,-2,2,-2,0,7,1,1,2,-2,2,7,2,2,2,2,2,7,FALSE,1,81,FALSE,0,61,TRUE,0,100,FALSE,1,91,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,0,100,FALSE,1,100,FALSE,1,93,TRUE,1,91,FALSE,1,100,TRUE,1,90,TRUE,1,89,TRUE,0,97,FALSE,1,100,FALSE,1,100,FALSE,1,78,FALSE,0,75,TRUE,1,97,FALSE,1,100,TRUE,1,100,FALSE,1,83,TRUE,1,100,FALSE,1,85,FALSE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,79,TRUE,1,79,0,0,0.0121,0,0.0441,0,0,1,0.0484,0.0009,1,0.0081,1,0,0,0.3721,0,0.0081,0,0.0289,0.5625,0.01,0,0,0.9409,0.0225,0.0441,0.0361,1,0,1,0.0049,0.2547,0.248692857,0.260707143,24,75,24,75,6,75,5,62.5,7,87.5,6,75,11,68.75,13,81.25,92.78,88.25,92.75,95.12,95,91.31,94.25,0,17.78,13.25,30.25,7.62,20,22.56,13,2,0,2,0,2,2,0,2,2,2,0,2,0,2,0,2,2,2,2,2,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1.2,1.6,0.8,2,0.4,1,0.6,1,1.4,0.75,1.075,7,7,7.125,0.8,0.6,0.2,1,0.533333333,-1,1,0,1,0,1,1,1,-1,1,0,0,-1,1,-1,1,1,10 cents,100 minutes,47 days,Female,University - Undergraduate,24,It was an interesting survey,0.875,0,0,1,1,1,0,0.33,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,8,6,7,2,5,4,3,1,9,2,3,4,1 +925,R_35VRsLfQRg6h0D7,18 - 24,American,,American,Female,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,4,2,5,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,5,2,3,1,4,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,3,5,1,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,5,4,3,5,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,2,1,3,4,5,3,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,3,2,4,0,Agree,Agree,Strongly Agree,Strongly Agree,Agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,3,5,4,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,2,5,3,4,1,2,Strongly agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,2,3,5,4,5,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,1,2,5,3,4,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,95,TRUE,100,FALSE,90,TRUE,90,FALSE,70,FALSE,100,TRUE,90,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,-1,-3,2,-3,0,3,1,3,0,3,2,2,2,2,2,1,3,3,2,3,8,0,-3,0,-3,1,5,3,1,3,0,3,3,2,2,3,3,2,0,2,3,3,2,3,9,0,-3,2,-3,2,1,3,2,3,0,3,2,1,2,2,2,0,5,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,90,TRUE,0,90,FALSE,1,70,FALSE,0,100,TRUE,1,90,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0.81,0.0025,0,0,0,0,0,0.01,0.01,0,1,1,0.09,1,0.247232143,0.214285714,0.280178571,26,81.25,25,78.13,7,87.5,7,87.5,7,87.5,4,50,14,87.5,11,68.75,97.97,97.5,96.25,99.38,98.75,99.38,96.56,3.12,19.84,10,8.75,11.88,48.75,11.88,27.81,1,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0,1,0,0,0,2,0.2,0.8,0,0.4,0,0.6,0.2,0.6,0.35,0.35,0.35,5.33,4,4.125,0.2,0.2,-0.2,-0.2,0.066666667,-1,4,1,-5,1.33,1,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,Add a progress bar,1.5,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,8,6,3,2,7,4,9,1,5,4,3,2,1 +926,R_5pX9PNrzfuK4xW9,18 - 24,American,,American,Female,Strongly agree,Somewhat agree,Agree,Disagree,Somewhat agree,1,4,3,5,2,Disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,3,1,2,4,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,5,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Neither agree nor disagree,Agree,Strongly disagree,Agree,5,2,4,1,3,4,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,4,2,5,3,4,Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,3,5,4,2,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,5,2,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Agree,Somewhat agree,Disagree,Agree,2,5,4,3,1,2,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Agree,3,1,5,4,2,3,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,2,4,1,5,3,5,Agree,Agree,Somewhat agree,Agree,Somewhat agree,5,4,1,3,2,TRUE,85,TRUE,72,FALSE,100,FALSE,55,TRUE,60,FALSE,76,TRUE,92,TRUE,56,FALSE,60,TRUE,100,TRUE,62,TRUE,100,TRUE,79,FALSE,52,FALSE,50,TRUE,83,TRUE,66,TRUE,100,FALSE,50,FALSE,50,TRUE,52,TRUE,100,FALSE,100,TRUE,95,TRUE,65,TRUE,70,FALSE,50,FALSE,60,TRUE,90,FALSE,55,FALSE,53,TRUE,75,15,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,2,-2,1,-2,-2,0,0,1,1,1,2,-3,2,0,1,0,-1,1,2,0,2,-3,2,3,-2,-2,0,-1,-1,4,2,0,-1,1,0,4,3,3,3,2,3,2,3,2,1,-2,2,3,-2,-2,0,-1,2,2,1,1,2,-3,2,3,2,2,1,2,1,5,TRUE,0,85,TRUE,1,72,FALSE,1,100,FALSE,1,55,TRUE,1,60,FALSE,1,76,TRUE,1,92,TRUE,1,56,FALSE,0,60,TRUE,1,100,TRUE,0,62,TRUE,0,100,TRUE,1,79,FALSE,1,52,FALSE,0,50,TRUE,1,83,TRUE,0,66,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,52,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,65,TRUE,1,70,FALSE,1,50,FALSE,1,60,TRUE,0,90,FALSE,0,55,FALSE,0,53,TRUE,1,75,0.1936,0.09,0.0289,0.0064,0.0625,0.0576,0.0025,0,0.25,0,0.3025,0.0441,0.36,0.3844,0.16,0.0784,0,0.2025,0.16,0.4225,0.2304,0.25,0.25,0.2304,0.4356,0.25,0.2809,0.7225,0,1,0.81,1,0.283814286,0.136035714,0.431592857,15,46.88,21,65.63,4,50,6,75,5,62.5,6,75,12,75,9,56.25,72.28,56.5,74.75,83,74.88,72,72.56,-18.75,6.65,6.5,-0.25,20.5,-0.12,-3,16.31,1,1,0,1,1,0,0,0,1,2,1,1,3,4,2,3,2,3,3,2,0,1,1,0,1,0,0,0,1,1,0,0,0,0,0,2,1,1,3,0,0.8,0.6,2.2,2.6,0.6,0.4,0,1.4,1.55,0.6,1.075,3.67,2.67,3.25,0.2,0.2,2.2,1.2,0.866666667,0,2,1,-3,1,1,2,1,-2,2,-1,1,0,0,-2,2,-1,5 cents,5 minutes,47 days,Female,High School (or equivalent),20,"I really enjoyed these questions; some of them really made me think about my life and how I really feel. Also I put 100 for confidence on the crochet question because I crochet, and I don't consider each stitch to be a knot; to me, it's more like interlocking loops in strategic ways. I can see why some people would call the stitches ""knots"", though, but my first though at seeing ""knots"" was macrame.",1,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,7,3,8,9,2,5,4,1,6,4,2,3,1 +927,R_6ydvWA8a9X2tSeZ,18 - 24,American,,American,Male,Agree,Somewhat agree,Strongly agree,Agree,Strongly agree,5,4,2,3,1,Somewhat agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,4,5,2,1,3,Somewhat Agree,Strongly Agree,Agree,Agree,Somewhat Agree,5,4,3,2,1,Agree,Strongly Agree,Strongly Agree,Agree,Agree,1,3,2,5,4,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,5,2,1,3,4,8,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,1,2,4,3,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,5,2,1,4,3,4,Agree,Strongly Agree,Somewhat agree,Agree,Agree,1,4,5,2,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Somewhat agree,Agree,Strongly Agree,4,1,5,2,3,7,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,1,2,4,5,3,5,Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,3,5,2,1,4,7,Agree,Strongly Agree,Agree,Agree,Somewhat agree,4,3,2,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,67,FALSE,65,TRUE,68,FALSE,51,FALSE,54,FALSE,58,FALSE,53,FALSE,52,FALSE,50,FALSE,51,FALSE,50,FALSE,50,FALSE,71,FALSE,50,TRUE,55,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,83,FALSE,50,FALSE,50,FALSE,52,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,22,2,1,3,2,3,1,3,-1,0,1,1,3,2,2,1,2,3,3,2,2,2,3,2,3,1,8,0,0,2,0,1,6,1,1,1,3,2,4,2,3,1,2,2,8,1,2,1,2,3,7,1,1,3,1,2,5,2,1,2,1,3,7,2,3,2,2,1,5,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,0,52,FALSE,0,50,FALSE,1,50,TRUE,0,83,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,55,FALSE,1,50,FALSE,1,71,FALSE,0,50,FALSE,0,50,FALSE,1,51,FALSE,0,50,FALSE,1,52,FALSE,0,53,FALSE,1,58,FALSE,1,54,FALSE,1,51,TRUE,1,68,FALSE,0,65,TRUE,1,67,0.25,0.2809,0.25,0.25,0.1089,0.25,0.25,0.25,0.0841,0.25,0.1024,0.25,0.2704,0.25,0.25,0.25,0.2401,0.25,0.2116,0.2304,0.25,0.25,0.25,0.25,0.25,0.1764,0.4225,0.25,0.25,0.3025,0.2401,0.6889,0.252796429,0.218278571,0.287314286,22,68.75,16,50,4,50,5,62.5,3,37.5,4,50,2,12.5,14,87.5,54.06,53.12,52.38,51.25,59.5,53.44,54.69,18.75,4.06,3.12,-10.12,13.75,9.5,40.94,-32.81,0,2,1,1,2,1,3,3,0,0,0,2,1,1,1,0,0,2,0,0,1,1,2,0,0,0,2,4,1,1,1,2,0,1,2,0,0,1,0,1,1.2,1.4,1,0.4,0.8,1.6,1.2,0.4,1,1,1,6,6.33,6.25,0.4,-0.2,-0.2,0,-7.4E-17,1,1,-3,3,-0.33,2,0,2,2,-2,1,-1,2,-2,2,-2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,great,-0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,9,8,5,2,4,6,7,1,3,2,3,4,1 +928,R_3IlTfmR9FgPMBaL,18 - 24,American,,American,Female,Agree,Agree,Strongly agree,Strongly agree,Agree,4,3,2,1,5,Strongly disagree,Agree,Strongly agree,Somewhat agree,Agree,1,3,5,4,2,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,4,3,1,5,2,Somewhat disagree,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,5,3,4,1,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,1,4,5,3,2,9,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,3,5,4,2,1,6,Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,2,4,3,7,Somewhat agree,Agree,Somewhat agree,Agree,Agree,2,5,1,3,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,4,1,2,10,Agree,Agree,Agree,Agree,Agree,5,2,4,3,1,9,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,4,2,3,5,1,8,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,1,4,3,5,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,79,TRUE,56,TRUE,100,FALSE,62,TRUE,79,FALSE,100,TRUE,63,FALSE,57,TRUE,71,TRUE,69,FALSE,62,TRUE,100,TRUE,93,FALSE,65,TRUE,71,TRUE,78,FALSE,86,TRUE,100,TRUE,67,FALSE,65,TRUE,87,FALSE,56,TRUE,95,TRUE,75,TRUE,87,FALSE,54,TRUE,73,TRUE,100,TRUE,100,TRUE,100,FALSE,55,TRUE,76,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,3,3,2,-3,2,3,1,2,1,1,3,2,3,-1,-2,-1,1,-1,2,3,2,3,1,9,2,2,1,2,0,6,2,1,-1,0,0,7,1,2,1,2,2,8,2,3,3,3,3,10,2,2,2,2,2,9,2,1,1,2,2,8,3,3,2,3,1,10,TRUE,0,79,TRUE,1,56,TRUE,0,100,FALSE,1,62,TRUE,1,79,FALSE,1,100,TRUE,1,63,FALSE,0,57,TRUE,1,71,TRUE,1,69,FALSE,1,62,TRUE,0,100,TRUE,1,93,FALSE,1,65,TRUE,1,71,TRUE,1,78,FALSE,1,86,TRUE,0,100,TRUE,0,67,FALSE,1,65,TRUE,1,87,FALSE,0,56,TRUE,0,95,TRUE,1,75,TRUE,0,87,FALSE,0,54,TRUE,0,73,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,55,TRUE,1,76,0.3249,0.2916,0.0484,0.1369,0.0576,0,0.0625,0.0961,0.1225,0.3136,0,0.0049,0.0841,0.1444,0.0441,0.1936,0.9025,0.1444,1,0.7569,0.0169,0.0841,0.4489,0.1225,0.0196,0.5329,0.3025,0.6241,1,1,1,1,0.359953571,0.155021429,0.564885714,16,50,18,56.25,5,62.5,6,75,3,37.5,4,50,12,75,6,37.5,77.53,64.62,89.5,71.62,84.38,71.25,83.81,-6.25,21.28,2.12,14.5,34.12,34.38,-3.75,46.31,0,1,1,0,1,5,0,2,1,2,1,0,4,2,3,2,4,2,1,3,0,1,0,0,1,5,0,1,1,0,1,0,2,0,1,4,5,3,2,2,0.6,2,2,2.4,0.4,1.4,0.8,3.2,1.75,1.45,1.6,7.33,9,8.375,0.2,0.6,1.2,-0.8,0.666666667,-1,-3,-1,-2,-1.67,0,0,1,-2,2,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,it was kinda silly but made me think about my morals and values,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,3,5,8,7,6,4,2,1,9,3,4,2,1 +929,R_5O2CRKNvSbJ9R8m,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,2,3,Neither agree nor disagree,Agree,Agree,Strongly disagree,Strongly agree,5,4,3,2,1,Strongly Agree,Agree,Agree,Agree,Strongly Agree,1,4,3,5,2,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,1,2,4,3,5,2,Neither agree nor disagree,Agree,Agree,Strongly disagree,Strongly agree,1,3,5,4,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,2,4,5,Agree,Agree,Agree,Agree,Agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,4,3,2,Neither agree nor disagree,Agree,Agree,Strongly disagree,Strongly agree,2,5,1,4,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,5,Agree,Agree,Agree,Agree,Agree,3,4,1,2,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,70,FALSE,80,FALSE,50,FALSE,70,FALSE,80,TRUE,90,FALSE,100,TRUE,75,FALSE,100,TRUE,100,TRUE,100,FALSE,85,FALSE,80,TRUE,90,TRUE,81,TRUE,100,TRUE,65,FALSE,65,FALSE,65,TRUE,75,FALSE,65,TRUE,100,TRUE,60,TRUE,62,TRUE,63,FALSE,90,TRUE,94,FALSE,84,FALSE,100,TRUE,71,FALSE,100,16,3,3,3,3,3,0,2,2,-3,3,3,2,2,2,3,2,2,2,2,2,3,3,3,2,3,5,0,2,2,-3,3,2,3,3,3,3,3,3,2,2,2,2,2,5,3,3,3,3,3,5,0,2,2,-3,3,2,3,3,3,3,3,2,2,2,2,2,2,5,FALSE,1,100,TRUE,1,71,FALSE,1,100,FALSE,1,84,TRUE,1,94,FALSE,1,90,TRUE,1,63,TRUE,1,62,TRUE,1,60,TRUE,1,100,FALSE,1,65,TRUE,0,75,FALSE,0,65,FALSE,1,65,TRUE,1,65,TRUE,1,100,TRUE,0,81,TRUE,0,90,FALSE,1,80,FALSE,1,85,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,75,FALSE,1,100,TRUE,1,90,FALSE,1,80,FALSE,1,70,FALSE,1,50,FALSE,0,80,TRUE,1,70,TRUE,1,100,0.1444,0.01,0,0.1369,0,0.01,0.0625,0,0.0225,0,0.64,0.4225,0.16,0.1225,0.0036,0.0841,0,0.0256,0.09,0,0,0.1225,0.04,0.1225,0.6561,0.04,0.09,0,0,0.81,0.25,0.5625,0.154889286,0.11095,0.198828571,16,50,27,84.38,8,100,6,75,7,87.5,6,75,14,87.5,13,81.25,81.56,71.88,85,88.5,80.88,80.94,82.19,-34.38,-2.82,-28.12,10,1,5.88,-6.56,0.94,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0.2,0,0.6,0,0,0,0.6,0,0.2,0.15,0.175,3.33,3,3.625,0.2,0,0,0,0.066666667,0,0,1,0,0.33,2,2,2,-2,2,1,-1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,High School (or equivalent),23,n/a,1.625,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,5,6,9,4,7,3,8,1,2,2,4,3,1 +930,R_5rGyFnKQ45RTsh0,18 - 24,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,1,5,3,4,2,Strongly disagree,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,5,1,4,3,2,Strongly Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,2,4,1,3,5,Strongly disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,5,1,3,4,2,Somewhat disagree,Somewhat agree,Agree,Strongly disagree,Agree,3,2,5,4,1,8,Agree,Strongly disagree,Somewhat agree,Somewhat disagree,Agree,1,2,3,4,5,10,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,Agree,5,3,1,4,2,10,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,2,3,1,4,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,3,2,5,1,4,7,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,5,1,2,3,10,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,5,1,3,2,10,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,5,3,4,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,80,FALSE,50,FALSE,60,TRUE,60,FALSE,50,TRUE,70,TRUE,60,FALSE,100,TRUE,71,TRUE,50,TRUE,60,TRUE,55,FALSE,100,TRUE,55,TRUE,85,FALSE,60,TRUE,95,FALSE,50,FALSE,100,TRUE,59,TRUE,95,FALSE,55,TRUE,50,TRUE,60,TRUE,90,TRUE,90,FALSE,50,TRUE,81,TRUE,50,TRUE,85,TRUE,60,FALSE,50,16,2,3,3,3,-1,-3,2,0,3,0,3,-2,3,-2,3,-3,-2,-2,-3,-3,-1,1,2,-3,2,8,2,-3,1,-1,2,10,3,3,-1,3,2,10,1,1,2,2,0,10,3,3,1,2,3,7,1,-3,3,-3,2,10,2,-2,3,-3,3,10,3,2,3,3,2,10,FALSE,1,50,TRUE,1,60,TRUE,0,85,TRUE,0,50,TRUE,1,81,FALSE,1,50,TRUE,1,90,TRUE,1,90,TRUE,1,60,TRUE,1,50,FALSE,1,55,TRUE,0,95,TRUE,1,59,FALSE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,60,TRUE,0,85,TRUE,0,55,FALSE,1,100,TRUE,1,55,TRUE,1,60,TRUE,0,50,TRUE,1,71,FALSE,1,100,TRUE,1,60,TRUE,0,70,FALSE,1,50,TRUE,0,60,FALSE,0,60,FALSE,0,50,FALSE,0,80,0.01,0.16,0.0025,0.01,0.64,0.25,0.0841,0.25,0,0.16,0.36,0.1681,0.16,0.2025,0.0361,0.16,0.25,0.25,0.25,0,0.2025,0.25,0.3025,0,0.16,0.49,0.25,0.25,0.7225,0.7225,0.36,0.9025,0.279760714,0.2122,0.347321429,16,50,20,62.5,3,37.5,5,62.5,7,87.5,5,62.5,12,75,8,50,68.31,56.25,61.88,74.38,80.75,66.94,69.69,-12.5,5.81,18.75,-0.62,-13.12,18.25,-8.06,19.69,3,2,1,6,3,5,5,1,4,2,0,5,4,5,1,4,3,4,5,3,1,0,2,1,4,4,5,3,6,2,1,0,0,1,0,6,4,5,6,5,3,3.4,3,3.8,1.6,4,0.4,5.2,3.3,2.8,3.05,9.33,9,9.375,1.4,-0.6,2.6,-1.4,1.133333333,1,0,0,0,0.33,-1,1,2,-2,2,1,-1,0,0,-2,2,1,10 cents,25 minutes,47 days,Female,High School (or equivalent),21,,0.75,0,0,1,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,8,6,9,3,4,7,5,1,2,4,3,2,1 +931,R_5l4fedH1LanuIcI,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,2,3,5,1,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,5,4,1,3,2,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Agree,5,3,2,4,1,Disagree,Neither agree nor disagree,Disagree,Strongly Agree,Disagree,3,1,4,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,4,2,1,3,5,6,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,4,5,3,1,2,5,Strongly Agree,Strongly Disagree,Strongly Disagree,Somewhat Agree,Neither Agree nor Disagree,4,2,1,3,5,8,Agree,Agree,Agree,Strongly Agree,Strongly disagree,5,4,3,1,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,1,2,5,4,6,Neither agree nor disagree,Agree,Somewhat agree,Agree,Neither agree nor disagree,2,3,4,1,5,2,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,4,5,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,3,1,2,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,64,FALSE,61,TRUE,100,FALSE,94,FALSE,50,TRUE,89,FALSE,93,TRUE,96,FALSE,75,FALSE,50,TRUE,68,FALSE,56,TRUE,67,TRUE,100,TRUE,84,TRUE,100,FALSE,67,FALSE,81,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,78,TRUE,90,TRUE,83,TRUE,84,FALSE,70,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,-1,0,1,0,3,1,2,0,3,-3,2,-2,0,-2,3,-2,3,3,3,2,2,6,3,3,-3,3,0,5,3,-3,-3,1,0,8,2,2,2,3,-3,7,3,3,3,3,0,6,0,2,1,2,0,2,2,2,0,0,0,4,0,0,0,0,-2,4,TRUE,0,100,FALSE,0,50,FALSE,1,64,FALSE,1,61,TRUE,1,100,FALSE,1,94,FALSE,0,50,TRUE,1,89,FALSE,0,93,TRUE,1,96,FALSE,1,75,FALSE,1,50,TRUE,1,68,FALSE,1,56,TRUE,1,67,TRUE,1,100,TRUE,0,84,TRUE,0,100,FALSE,1,67,FALSE,1,81,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,78,TRUE,0,90,TRUE,0,83,TRUE,1,84,FALSE,0,70,TRUE,1,100,0.0121,0,0,0.25,0,0.0036,0,0.0016,0.0361,0,0.0256,0.1024,0.8649,0.0625,0,0.25,0,0.1521,0.81,0,1,0.1089,0.1089,0.1936,0.7056,0.0484,0.49,1,0.1296,1,0.6889,0.25,0.286882143,0.107057143,0.466707143,16,50,22,68.75,5,62.5,5,62.5,5,62.5,7,87.5,11,68.75,11,68.75,82.81,70.12,91.12,87.75,82.25,85.44,80.19,-18.75,14.06,7.62,28.62,25.25,-5.25,16.69,11.44,0,0,0,1,3,3,2,3,0,1,1,3,6,4,2,4,2,4,0,1,0,0,0,0,1,0,1,1,1,1,0,2,3,3,2,2,0,2,3,0,0.8,1.8,3.2,2.2,0.2,0.8,2,1.4,2,1.1,1.55,6.33,4,5.25,0.6,1,1.2,0.8,0.933333333,0,3,4,3,2.33,0,1,2,0,0,1,-1,1,-1,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,None,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,6,4,5,8,9,3,7,1,2,2,4,3,1 +932,R_5fK8cmWCYY7Cy84,18 - 24,American,,American,Male,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,3,2,4,5,1,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,4,3,2,1,5,Somewhat Disagree,Strongly Disagree,Agree,Agree,Strongly Agree,1,2,3,4,5,Strongly disagree,Somewhat disagree,Disagree,Strongly disagree,Disagree,4,3,1,5,2,Agree,Agree,Agree,Disagree,Disagree,4,3,2,1,5,4,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,1,3,5,2,5,Agree,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,3,2,1,5,4,8,Agree,Agree,Agree,Agree,Agree,2,1,5,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat agree,Agree,Disagree,1,5,2,4,3,2,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,5,1,2,3,1,Somewhat Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,1,3,5,4,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,3,1,5,4,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,85,TRUE,50,TRUE,90,TRUE,50,TRUE,50,TRUE,60,TRUE,70,TRUE,60,TRUE,50,TRUE,50,FALSE,55,TRUE,100,TRUE,65,FALSE,60,TRUE,70,TRUE,100,FALSE,50,TRUE,80,TRUE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,75,TRUE,90,FALSE,70,TRUE,75,FALSE,50,FALSE,80,TRUE,60,TRUE,55,TRUE,50,TRUE,70,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,0,2,-1,-2,-1,-1,1,1,-1,-3,2,2,3,-3,-1,-2,-3,-2,2,2,2,-2,-2,4,-2,-2,-1,-1,-1,5,2,1,-1,2,1,8,2,2,2,2,2,10,2,1,1,2,-2,2,-2,-2,0,1,1,1,-1,-3,3,1,3,1,-1,-1,-1,-1,0,3,FALSE,1,85,TRUE,1,50,TRUE,0,90,TRUE,0,50,TRUE,1,50,TRUE,0,60,TRUE,1,70,TRUE,1,60,TRUE,1,50,TRUE,1,50,FALSE,1,55,TRUE,0,100,TRUE,1,65,FALSE,1,60,TRUE,1,70,TRUE,1,100,FALSE,1,50,TRUE,0,80,TRUE,0,50,FALSE,1,50,TRUE,1,100,TRUE,1,50,TRUE,0,75,TRUE,1,90,FALSE,1,70,TRUE,1,75,FALSE,1,50,FALSE,1,80,TRUE,0,60,TRUE,1,55,TRUE,1,50,TRUE,1,70,0.16,0.0625,0,0.09,0.09,0.36,0.01,0.25,0.25,0.25,0.2025,0.1225,0.25,0.2025,0.25,0.25,0.5625,0.25,0.04,0.09,0,0.09,0.25,0.16,0.25,0.25,0.25,0.0225,0.81,0.64,0.36,1,0.268303571,0.235714286,0.300892857,13,40.63,24,75,6,75,5,62.5,7,87.5,6,75,16,100,8,50,66.25,53.12,66.25,67.5,78.12,65.94,66.56,-34.37,-8.75,-21.88,3.75,-20,3.12,-34.06,16.56,1,1,2,4,1,0,1,0,2,2,3,4,3,0,2,5,3,4,5,4,1,0,1,0,1,0,1,1,0,0,0,0,1,1,0,2,0,1,2,2,1.8,1,2.4,4.2,0.6,0.4,0.4,1.4,2.35,0.7,1.525,5.67,1.33,4.25,1.2,0.6,2,2.8,1.266666667,2,4,7,7,4.34,1,2,2,-2,2,0,0,-2,2,-2,2,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,21,,1.375,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,01ITEM,01DIR,3,4,2,6,9,8,5,1,7,2,4,3,1 +933,R_1afQb6ELZHqScFz,18 - 24,American,,American,Female,Somewhat agree,Strongly agree,Agree,Agree,Agree,4,3,2,1,5,Agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,1,3,4,2,5,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,Strongly Agree,2,1,4,5,3,Agree,Somewhat agree,Agree,Strongly Agree,Somewhat disagree,1,2,4,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,Neither agree nor disagree,4,5,2,3,1,6,Disagree,Strongly agree,Agree,Strongly disagree,Disagree,3,1,5,4,2,9,Somewhat Disagree,Disagree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,3,5,4,1,2,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,4,1,2,3,5,2,Strongly agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,3,4,1,5,2,2,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,4,2,1,5,4,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,5,2,1,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,54,TRUE,82,FALSE,95,TRUE,90,FALSE,73,FALSE,96,TRUE,100,FALSE,91,TRUE,86,FALSE,75,TRUE,100,TRUE,100,FALSE,100,FALSE,85,FALSE,100,FALSE,100,FALSE,100,TRUE,73,FALSE,100,FALSE,96,FALSE,100,FALSE,84,TRUE,100,TRUE,88,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,25,1,3,2,2,2,2,1,3,1,1,3,3,2,1,3,2,1,2,3,-1,-3,1,-3,-3,0,7,-2,3,2,-3,-2,6,-1,-2,-1,3,-1,9,-3,-3,-3,-3,-3,10,1,2,1,0,3,3,3,-1,3,-1,3,2,3,3,3,1,3,2,3,3,2,3,3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,88,TRUE,1,100,FALSE,1,84,FALSE,1,100,FALSE,0,96,FALSE,1,100,TRUE,1,73,FALSE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,TRUE,1,86,FALSE,1,91,TRUE,1,100,FALSE,1,96,FALSE,1,73,TRUE,0,90,FALSE,0,95,TRUE,1,82,FALSE,0,54,0,0,1,0,0.2916,0,0.0196,0,0,0,0.9025,0.9216,0.0144,0.0256,0,0,0.0625,0,0.0729,0.0081,0,0.0729,0.0225,0,0,0.0016,0.0324,1,1,0,0.81,0,0.187792857,0.159842857,0.215742857,25,78.13,25,78.13,8,100,5,62.5,7,87.5,5,62.5,12,75,13,81.25,92.75,88.5,89.38,98.88,94.25,92.12,93.38,0,14.62,-11.5,26.88,11.38,31.75,17.12,12.13,4,2,5,5,2,4,2,1,4,3,4,5,3,2,4,5,4,5,6,2,0,1,1,2,1,1,2,0,2,2,0,0,1,0,0,1,2,0,0,4,3.6,2.8,3.6,4.4,1,1.4,0.2,1.4,3.6,1,2.3,7.33,2.33,5.375,2.6,1.4,3.4,3,2.466666667,4,4,7,6,5,0,0,1,-2,2,1,-1,2,-2,0,0,-1,5 cents,5 minutes,47 days,Female,University - Undergraduate,23,,-0.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,3,2,9,5,6,8,4,1,7,3,2,4,1 +934,R_6xasPwdSClR7OZb,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,Agree,5,3,1,2,4,Strongly disagree,Somewhat agree,Agree,Agree,Agree,3,5,1,4,2,Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,3,5,1,Strongly disagree,Strongly disagree,Disagree,Somewhat disagree,Disagree,5,2,4,1,3,Strongly Agree,Agree,Agree,Strongly disagree,Somewhat disagree,1,2,3,5,4,3,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,5,3,2,1,8,Somewhat Agree,Somewhat Disagree,Strongly Agree,Agree,Strongly Agree,3,4,5,1,2,9,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat agree,2,3,5,1,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,Agree,3,5,4,1,2,3,Strongly disagree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,2,1,5,3,4,7,Somewhat Disagree,Disagree,Strongly Agree,Disagree,Strongly Agree,5,4,1,3,2,4,Strongly Agree,Agree,Agree,Strongly Agree,Somewhat agree,2,5,4,3,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,88,FALSE,53,FALSE,67,FALSE,51,FALSE,100,TRUE,100,TRUE,89,TRUE,50,TRUE,100,TRUE,64,TRUE,100,TRUE,100,TRUE,89,TRUE,67,TRUE,86,TRUE,79,FALSE,100,TRUE,82,FALSE,85,TRUE,70,TRUE,99,TRUE,50,TRUE,87,FALSE,100,TRUE,100,TRUE,50,FALSE,92,TRUE,62,FALSE,60,FALSE,50,TRUE,87,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-1,3,2,-3,1,2,2,2,-2,0,3,0,3,-3,-3,-2,-1,-2,3,2,2,-3,-1,3,-3,-3,0,3,1,8,1,-1,3,2,3,9,-3,-3,-3,-3,1,4,3,3,0,2,2,3,-3,-2,3,-1,3,7,-1,-2,3,-2,3,4,3,2,2,3,1,10,TRUE,0,100,TRUE,1,88,FALSE,1,53,FALSE,1,67,FALSE,0,51,FALSE,1,100,TRUE,1,100,TRUE,1,89,TRUE,1,50,TRUE,1,100,TRUE,0,64,TRUE,0,100,TRUE,1,100,TRUE,0,89,TRUE,1,67,TRUE,1,86,TRUE,0,79,FALSE,1,100,TRUE,0,82,FALSE,1,85,TRUE,1,70,TRUE,1,99,TRUE,0,50,TRUE,1,87,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,92,TRUE,0,62,FALSE,0,60,FALSE,0,50,TRUE,1,87,0.0121,0,0.0196,0,0.0169,0,0.0169,0,0.0225,0.0001,0.36,0,0.25,0.4096,0.2601,0.0144,0.25,0.1089,0.0064,0,0.09,0.1089,0.6724,0.7921,0.6241,0.25,0.25,1,0.2209,0,0.3844,1,0.253878571,0.1221,0.385657143,23,71.88,20,62.5,4,50,4,50,6,75,6,75,13,81.25,7,43.75,79.91,64.75,74.88,98.5,81.5,80.25,79.56,9.38,17.41,14.75,24.88,23.5,6.5,-1,35.81,0,1,3,6,3,0,4,2,1,1,3,1,0,2,0,0,0,1,2,3,0,0,1,1,0,0,3,1,3,1,1,2,0,2,0,6,5,4,4,3,2.6,1.6,1.2,1.2,0.4,1.6,1,4.4,1.65,1.85,1.75,6.67,4.67,6,2.2,0,0.2,-3.2,0.8,0,1,5,-6,2,2,2,2,-2,2,1,-1,1,-1,-2,2,1,10 cents,5 minutes,47 days,Female,High School (or equivalent),19,"This was a good, clear survey. All I have to say.",1.125,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,6,7,9,5,4,3,8,1,2,2,3,4,1 +935,R_3gIrdCqFac5ou6L,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,Strongly agree,3,4,5,2,1,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,4,5,3,1,2,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,2,4,5,1,3,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,5,1,2,4,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,5,4,1,2,4,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,3,5,1,4,6,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,5,1,4,3,2,6,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,1,5,2,3,5,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,3,4,5,1,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,5,1,4,3,TRUE,100,TRUE,80,TRUE,59,FALSE,50,TRUE,64,FALSE,60,FALSE,61,TRUE,82,FALSE,66,TRUE,93,TRUE,68,TRUE,100,FALSE,56,FALSE,72,FALSE,61,TRUE,83,TRUE,60,TRUE,64,FALSE,70,TRUE,95,FALSE,71,FALSE,74,FALSE,58,FALSE,59,FALSE,63,FALSE,65,FALSE,58,FALSE,54,FALSE,67,FALSE,64,FALSE,58,TRUE,94,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,-1,-1,1,3,1,0,-1,1,0,1,-1,0,2,0,0,-1,2,1,0,-1,1,1,0,-1,7,-1,0,0,1,0,5,0,-1,0,1,0,4,-1,1,0,-1,1,6,1,1,-1,1,0,5,-1,1,1,0,-1,6,0,-1,0,1,-1,5,0,1,1,0,-1,4,TRUE,0,100,TRUE,1,80,TRUE,0,59,FALSE,1,50,TRUE,1,64,FALSE,1,60,FALSE,0,61,TRUE,1,82,FALSE,0,66,TRUE,1,93,TRUE,0,68,TRUE,0,100,FALSE,0,56,FALSE,1,72,FALSE,0,61,TRUE,1,83,TRUE,0,60,TRUE,0,64,FALSE,1,70,TRUE,0,95,FALSE,0,71,FALSE,0,74,FALSE,1,58,FALSE,0,59,FALSE,1,63,FALSE,0,65,FALSE,1,58,FALSE,1,54,FALSE,1,67,FALSE,0,64,FALSE,0,58,TRUE,1,94,0.0324,0.4225,0.0289,0.3721,0.0036,0.16,0.3481,0.0049,0.9025,0.5476,0.4096,0.3136,0.4356,0.4624,0.1296,0.04,0.1764,0.25,0.2116,0.1369,0.5041,0.3721,0.09,0.0784,0.36,0.1764,0.3364,1,0.3481,0.4096,0.1089,1,0.332728571,0.29885,0.366607143,18,56.25,15,46.88,4,50,5,62.5,3,37.5,3,37.5,6,37.5,9,56.25,69.66,63.88,66.25,74,74.5,70.69,68.62,9.37,22.78,13.88,3.75,36.5,37,33.19,12.37,2,2,2,1,4,2,0,1,0,0,1,0,0,1,0,1,2,2,2,1,0,2,0,0,3,2,1,2,1,1,1,0,0,1,1,0,2,1,1,1,2.2,0.6,0.4,1.6,1,1.4,0.6,1,1.2,1,1.1,5.33,5.33,5.25,1.2,-0.8,-0.2,0.6,0.066666667,2,-1,-1,2,0,1,1,-1,1,-1,1,-1,0,0,0,0,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,mp,0.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,4,9,7,3,8,2,5,1,6,2,4,3,1 +936,R_7osZtna6c3BVmZn,18 - 24,American,,American,Female,Somewhat agree,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly agree,4,1,5,3,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Neither agree nor disagree,4,3,5,2,1,Neither Agree nor Disagree,Somewhat Disagree,Disagree,Agree,Agree,4,5,3,1,2,Somewhat agree,Disagree,Strongly Agree,Somewhat agree,Strongly disagree,5,1,3,2,4,Strongly disagree,Agree,Strongly disagree,Strongly Agree,Somewhat disagree,3,5,1,2,4,6,Agree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,4,1,5,2,3,5,Strongly Disagree,Strongly Disagree,Strongly Disagree,Agree,Strongly Agree,3,1,5,2,4,9,Strongly disagree,Strongly Agree,Somewhat agree,Strongly disagree,Agree,3,4,5,1,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,5,Disagree,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,3,5,2,4,1,9,Strongly Disagree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,1,3,2,5,4,5,Agree,Strongly disagree,Strongly disagree,Agree,Disagree,5,4,1,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,75,TRUE,55,FALSE,59,TRUE,56,FALSE,80,FALSE,73,TRUE,68,TRUE,69,FALSE,72,TRUE,85,TRUE,64,FALSE,82,FALSE,61,TRUE,62,FALSE,92,TRUE,71,TRUE,73,FALSE,61,TRUE,63,FALSE,80,TRUE,70,TRUE,65,FALSE,59,FALSE,77,TRUE,73,FALSE,63,FALSE,62,TRUE,83,FALSE,81,TRUE,60,TRUE,63,FALSE,76,16,1,-3,-3,-1,3,-1,0,-1,-2,0,0,-1,-2,2,2,1,-2,3,1,-3,-3,2,-3,3,-1,6,2,-3,-3,0,-3,5,-3,-3,-3,2,3,9,-3,3,1,-3,2,2,3,0,-3,0,-1,5,-2,-3,3,3,-3,9,-3,-1,1,-3,3,5,2,-3,-3,2,-2,6,FALSE,1,76,TRUE,1,63,TRUE,0,60,FALSE,1,81,TRUE,1,83,FALSE,1,62,FALSE,0,63,TRUE,1,73,FALSE,0,77,FALSE,0,59,TRUE,0,65,TRUE,0,70,FALSE,0,80,TRUE,0,63,FALSE,0,61,TRUE,1,73,TRUE,0,71,FALSE,1,92,TRUE,0,62,FALSE,1,61,FALSE,0,82,TRUE,1,64,TRUE,0,85,FALSE,0,72,TRUE,0,69,TRUE,1,68,FALSE,1,73,FALSE,1,80,TRUE,0,56,FALSE,0,59,TRUE,1,55,FALSE,0,75,0.0729,0.1024,0.0729,0.3969,0.5625,0.1444,0.5184,0.3481,0.1521,0.1296,0.3481,0.64,0.5929,0.4225,0.0289,0.1369,0.7225,0.0361,0.04,0.4761,0.6724,0.3721,0.3844,0.3969,0.5041,0.0729,0.2025,0.0576,0.36,0.0064,0.3136,0.49,0.326142857,0.341642857,0.310642857,16,50,14,43.75,4,50,2,25,4,50,4,50,7,43.75,7,43.75,69.78,67.12,74.25,69.25,68.5,69.19,70.38,6.25,26.03,17.12,49.25,19.25,18.5,25.44,26.63,4,5,0,4,4,3,3,2,2,3,3,2,1,0,1,4,5,2,4,5,2,3,0,1,4,1,3,4,5,3,3,0,3,5,1,1,1,6,1,1,3.4,2.6,1.4,4,2,3.2,2.4,2,2.85,2.4,2.625,6.67,6.33,5.875,1.4,-0.6,-1,2,-0.066666667,1,-4,4,-4,0.34,-2,0,-1,0,0,0,0,-2,2,-1,1,1,15 cents,75 minutes,15 days,Female,High School (or equivalent),19,I loved the surveys ,0.125,0,0,0,0,0,0,0,0,03VLPfPs,02COC,02FUT,01ITEM,02REV,7,9,8,4,6,2,5,1,3,3,2,4,1 +937,R_1QqwFfTsxP1c6g9,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,1,5,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,3,4,1,2,5,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,Somewhat agree,Somewhat agree,Agree,Agree,Agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat disagree,5,2,4,1,3,6,Somewhat agree,Agree,Somewhat agree,Agree,Strongly agree,5,2,1,4,3,7,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,4,5,1,3,2,7,Agree,Somewhat agree,Agree,Agree,Agree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,1,2,5,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,2,5,1,4,3,7,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,3,4,2,7,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,3,4,2,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,74,TRUE,79,TRUE,98,FALSE,83,TRUE,75,FALSE,64,TRUE,82,FALSE,65,TRUE,72,FALSE,81,TRUE,68,TRUE,74,FALSE,81,FALSE,76,TRUE,73,FALSE,56,TRUE,69,TRUE,65,FALSE,70,TRUE,67,TRUE,66,FALSE,71,TRUE,71,TRUE,68,TRUE,62,TRUE,67,FALSE,60,TRUE,69,FALSE,59,TRUE,67,TRUE,69,FALSE,67,22,1,1,1,1,1,1,-1,1,-2,1,2,2,2,2,2,1,1,2,2,2,1,2,2,1,-1,8,1,2,1,2,3,6,2,1,1,1,2,7,2,1,2,2,2,7,2,1,1,1,1,7,1,2,1,1,2,7,1,2,1,1,1,7,1,2,2,1,1,7,FALSE,1,67,TRUE,1,69,TRUE,0,67,FALSE,1,59,TRUE,1,69,FALSE,1,60,TRUE,1,67,TRUE,1,62,TRUE,1,68,TRUE,1,71,FALSE,1,71,TRUE,0,66,TRUE,1,67,FALSE,1,70,TRUE,1,65,TRUE,1,69,FALSE,1,56,TRUE,0,73,FALSE,1,76,FALSE,1,81,TRUE,1,74,TRUE,1,68,FALSE,1,81,TRUE,1,72,FALSE,1,65,TRUE,1,82,FALSE,1,64,TRUE,0,75,FALSE,1,83,TRUE,1,98,TRUE,1,79,TRUE,1,74,0.1444,0.0324,0.0961,0.1089,0.0676,0.16,0.0784,0.0841,0.0361,0.1024,0.0004,0.1089,0.1024,0.0841,0.0961,0.0961,0.0361,0.1681,0.5625,0.1225,0.0676,0.1225,0.0576,0.09,0.1936,0.1296,0.0441,0.1089,0.4489,0.5329,0.0289,0.4356,0.148785714,0.0872,0.210371429,22,68.75,28,87.5,8,100,8,100,7,87.5,5,62.5,16,100,12,75,70.88,68.88,70.5,70.38,73.75,72.12,69.62,-18.75,-16.62,-31.12,-29.5,-17.12,11.25,-27.88,-5.38,0,1,1,0,2,0,3,0,4,2,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,3,0,3,1,1,0,1,1,1,0,1,0,1,1,0.8,1.8,0.6,0.2,0.2,1.4,0.8,0.6,0.85,0.75,0.8,7,7,7,0.6,0.4,-0.2,-0.4,0.266666667,1,-1,0,0,0,0,-1,1,-2,2,0,0,-1,1,0,0,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),19,,0.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,9,2,5,6,4,3,8,1,7,4,2,3,1 +938,R_10ursrLnikZBqVE,18 - 24,American,,American,Female,Agree,Strongly agree,Somewhat agree,Strongly agree,Agree,2,1,3,5,4,Agree,Somewhat agree,Strongly agree,Strongly agree,Agree,2,3,1,5,4,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,2,1,3,5,4,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Agree,1,5,3,2,4,Agree,Somewhat agree,Agree,Strongly Agree,Strongly Agree,4,3,2,1,5,10,Agree,Agree,Strongly agree,Somewhat agree,Strongly agree,4,2,1,3,5,10,Somewhat Agree,Agree,Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,9,Agree,Agree,Strongly Agree,Somewhat agree,Strongly Agree,2,4,1,3,5,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Agree,1,5,4,3,2,10,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,1,2,4,3,5,9,Somewhat Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,5,4,2,1,8,Somewhat agree,Agree,Strongly Agree,Agree,Strongly Agree,3,2,5,4,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,97,TRUE,93,FALSE,89,FALSE,79,TRUE,98,FALSE,95,TRUE,91,TRUE,85,TRUE,100,TRUE,98,FALSE,93,FALSE,91,FALSE,86,FALSE,82,TRUE,88,TRUE,93,FALSE,100,FALSE,96,FALSE,92,FALSE,88,TRUE,83,TRUE,77,FALSE,83,TRUE,91,FALSE,100,TRUE,96,FALSE,91,FALSE,86,FALSE,82,TRUE,87,FALSE,92,TRUE,97,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,3,2,2,1,3,3,2,2,3,1,3,2,3,3,1,2,2,2,1,2,3,3,10,2,2,3,1,3,10,1,2,2,3,3,9,2,2,3,1,3,8,3,3,2,1,2,10,3,2,2,1,3,9,1,3,2,2,3,8,1,2,3,2,3,7,FALSE,1,97,TRUE,1,93,FALSE,1,89,FALSE,1,79,TRUE,1,98,FALSE,1,95,TRUE,1,91,TRUE,1,85,TRUE,1,100,TRUE,1,98,FALSE,1,93,FALSE,1,91,FALSE,0,86,FALSE,1,82,TRUE,1,88,TRUE,1,93,FALSE,1,100,FALSE,1,96,FALSE,1,92,FALSE,1,88,TRUE,1,83,TRUE,1,77,FALSE,1,83,TRUE,1,91,FALSE,1,100,TRUE,1,96,FALSE,1,91,FALSE,1,86,FALSE,1,82,TRUE,1,87,FALSE,0,92,TRUE,1,97,0.0225,0.0016,0.0049,0.0081,0.0009,0.0025,0.0081,0.0004,0.0144,0.0529,0.0169,0.7396,0,0.0049,0.0004,0.0049,0.0289,0.0441,0.0196,0,0.0289,0.0144,0.0064,0.0324,0,0.0081,0.8464,0.0009,0.0121,0.0016,0.0324,0.0081,0.068935714,0.065635714,0.072235714,32,100,30,93.75,7,87.5,7,87.5,8,100,8,100,14,87.5,16,100,90.59,91,90.5,92.12,88.75,90.94,90.25,6.25,-3.16,3.5,3,-7.88,-11.25,3.44,-9.75,0,2,1,0,1,0,1,0,2,1,1,1,1,0,1,1,1,2,1,1,1,0,1,2,0,1,1,1,2,1,1,0,1,1,1,2,1,2,0,1,0.8,0.8,0.8,1.2,0.8,1.2,0.8,1.2,0.9,1,0.95,9.67,9,8.875,0,-0.4,0,0,-0.133333333,0,1,1,1,0.67,2,2,2,1,-1,1,-1,1,-1,2,-2,1,5 cents,5 minutes,47 days,Female,University - PhD,22, The questions were easy to understand and didn't require excessive reading.,0.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,4,5,8,6,2,9,3,1,7,3,2,4,1 +939,R_3iJtRquYbpjVhgV,18 - 24,American,Canadian,Both,Female,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,2,5,4,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,2,3,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,2,5,4,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Somewhat agree,Agree,Strongly disagree,Strongly Agree,5,3,2,1,4,7,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,4,5,3,1,2,7,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,1,2,4,3,5,8,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,3,1,4,5,2,4,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,4,2,1,5,3,4,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,3,2,4,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,4,5,3,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,53,TRUE,100,TRUE,100,FALSE,75,TRUE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,78,TRUE,100,TRUE,100,FALSE,65,FALSE,50,FALSE,69,FALSE,59,TRUE,100,FALSE,62,FALSE,58,TRUE,100,FALSE,100,TRUE,50,TRUE,68,TRUE,50,TRUE,100,TRUE,100,FALSE,57,TRUE,100,FALSE,57,TRUE,100,FALSE,50,FALSE,53,24,3,3,1,0,2,-2,0,1,0,1,1,1,3,0,2,1,1,2,1,-1,3,1,2,-3,3,8,1,-1,1,-2,1,7,1,2,1,1,3,7,2,2,2,1,1,8,3,3,1,3,2,4,-1,0,2,-1,1,4,1,0,3,0,3,4,1,1,1,0,-2,5,FALSE,1,53,FALSE,0,50,TRUE,0,100,FALSE,1,57,TRUE,1,100,FALSE,1,57,TRUE,1,100,TRUE,1,100,TRUE,1,50,TRUE,1,68,TRUE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,58,FALSE,0,62,TRUE,1,100,FALSE,1,59,FALSE,1,69,FALSE,1,50,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,78,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,53,TRUE,1,100,0,0,0,0,0,0.1849,0,0.1024,0.1225,0,0,0,0.25,0.25,0,0.25,0.0484,0.1849,0.0625,0,0,0.3844,0.25,0.1764,0.1681,0.25,0.2809,0.2209,1,0.0961,1,0,0.188657143,0.099507143,0.277807143,24,75,25,78.13,3,37.5,7,87.5,8,100,7,87.5,13,81.25,12,75,78.25,52.75,86.75,81,92.5,86.44,70.06,-3.13,0.12,15.25,-0.75,-19,5,5.19,-4.94,0,2,1,3,1,3,1,0,2,0,0,1,2,1,1,1,1,0,0,2,0,0,0,3,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1,1,1.4,1.2,1,0.8,0.6,0.6,0.4,0.6,1.1,0.55,0.825,7.33,4,5.875,0.8,0.6,0.6,0.2,0.666666667,4,3,3,3,3.33,1,2,2,-1,1,-1,1,0,0,-2,2,1,10 cents,5 minutes,47 days,Female,High School (or equivalent),18,"This was a really fun survey, though I wish I could find out which of the general knowledge and skill testing questions I got right.",1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,02REV,4,5,7,3,9,8,6,1,2,4,2,3,1 +940,R_1t0tg6QnXe9S4xz,18 - 24,American,,American,Male,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,3,1,4,2,5,Strongly disagree,Agree,Strongly disagree,Agree,Strongly disagree,1,4,3,5,2,Disagree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,4,5,3,2,Somewhat agree,Strongly disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Strongly Agree,Agree,Strongly Agree,Neither agree nor disagree,2,5,1,3,4,5,Strongly agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,1,4,3,2,5,9,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,3,4,2,1,0,Agree,Agree,Agree,Agree,Agree,4,3,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Neither agree nor disagree,Strongly Agree,Somewhat agree,Strongly Agree,Agree,2,5,4,3,1,9,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,3,4,2,1,9,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,9,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,51,TRUE,62,FALSE,58,TRUE,63,TRUE,78,TRUE,100,FALSE,50,FALSE,100,TRUE,50,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,16,-3,3,1,3,0,-3,2,-3,2,-3,-2,2,3,0,2,1,-3,0,1,-3,1,3,2,3,0,5,3,-3,1,-3,2,5,2,0,2,0,2,9,2,2,2,2,2,0,0,3,1,3,2,9,-3,-3,3,-3,2,9,2,3,3,3,3,9,2,2,2,2,2,9,FALSE,1,50,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,50,FALSE,1,100,FALSE,0,50,TRUE,1,100,TRUE,0,78,TRUE,1,63,FALSE,1,58,TRUE,1,62,FALSE,1,51,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0.25,0.1444,0,0,0,0,0.1369,0.25,0,0,0,0,0.25,0.25,0,0.25,0.6084,0.25,1,0.1764,0.25,0.25,0.25,0.25,0.25,0.2401,0,0.25,1,1,1,1,0.318278571,0.142521429,0.494035714,16,50,20,62.5,4,50,5,62.5,7,87.5,4,50,11,68.75,9,56.25,75.38,56.38,84.75,71.25,89.12,76.56,74.19,-12.5,12.88,6.38,22.25,-16.25,39.12,7.81,17.94,4,0,1,0,0,6,5,4,5,5,4,2,1,0,0,1,5,2,1,5,3,0,0,0,2,0,5,6,5,5,4,1,0,3,1,1,5,2,1,5,1,5,1.4,2.8,1,4.2,1.8,2.8,2.55,2.45,2.5,6.33,9,6.875,0,0.8,-0.4,0,0.133333333,-4,-4,0,-9,-2.67,0,0,0,-2,2,-2,2,0,0,-2,2,-2,10 cents,100 minutes,24 days,Male,High School (or equivalent),19,,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,5,6,9,3,2,4,8,1,7,4,2,3,1 +941,R_1JCtnfb1srdcz8M,18 - 24,,Canadian,Canadian,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat agree,Agree,3,4,2,1,5,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,Agree,2,4,5,3,1,Agree,Strongly Agree,Agree,Somewhat Disagree,Strongly Agree,3,4,2,5,1,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,2,5,3,4,1,Agree,Somewhat disagree,Strongly Agree,Strongly Agree,Agree,3,1,2,5,4,2,Agree,Disagree,Strongly disagree,Strongly disagree,Somewhat agree,4,3,2,5,1,8,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,5,4,1,2,3,3,Agree,Agree,Agree,Disagree,Somewhat agree,3,5,4,1,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,4,1,3,2,5,3,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,1,5,3,4,10,Agree,Agree,Somewhat Agree,Disagree,Strongly Agree,3,4,5,1,2,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,1,5,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,75,FALSE,50,FALSE,100,FALSE,50,TRUE,100,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,100,FALSE,69,TRUE,79,TRUE,96,FALSE,52,TRUE,50,FALSE,62,TRUE,92,FALSE,94,FALSE,50,FALSE,89,FALSE,50,TRUE,53,TRUE,50,TRUE,89,TRUE,94,TRUE,82,FALSE,50,TRUE,50,TRUE,50,TRUE,100,FALSE,50,TRUE,97,12,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,1,2,-2,3,-1,1,2,2,3,2,-1,3,-3,-3,-3,-2,-3,2,-1,3,3,2,2,2,-2,-3,-3,1,8,2,2,2,-1,3,3,2,2,2,-2,1,8,3,3,1,3,3,3,3,3,3,0,3,10,2,2,1,-2,3,8,3,3,3,3,3,10,TRUE,0,75,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,100,FALSE,1,69,TRUE,0,79,TRUE,1,96,FALSE,1,52,TRUE,1,50,FALSE,0,62,TRUE,0,92,FALSE,1,94,FALSE,1,50,FALSE,1,89,FALSE,0,50,TRUE,1,53,TRUE,0,50,TRUE,1,89,TRUE,0,94,TRUE,1,82,FALSE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,0,50,TRUE,1,97,0.25,0.0324,0.3844,0.25,0.0009,0.25,0.0121,0,0.0121,0.2209,0,0.0016,0.25,0.0961,0,0.25,0.25,0.25,0.25,0.8836,0.25,0.25,0.25,0.2304,0.8464,0.25,0.25,0.5625,0,0.0036,0.25,0.6241,0.231939286,0.113835714,0.350042857,12,37.5,19,59.38,6,75,3,37.5,5,62.5,5,62.5,11,68.75,8,50,69.47,52.38,73.12,75,77.38,70.56,68.38,-21.88,10.09,-22.62,35.62,12.5,14.88,1.81,18.38,2,4,0,2,0,4,5,2,4,1,0,1,0,0,0,5,5,5,0,4,3,0,2,2,1,5,0,4,1,1,0,1,1,1,0,6,6,6,5,6,1.6,3.2,0.2,3.8,1.6,2.2,0.6,5.8,2.2,2.55,2.375,4.33,7,6.5,0,1,-0.4,-2,0.2,-1,-2,-5,-2,-2.67,0,1,2,-2,2,1,-1,2,-2,-1,1,1,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,i enjoyed testing my knowledge and finding out im a complete idiot so thanks for the reality check,0.5,1,0,0,0,1,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,3,5,8,7,9,6,2,1,4,3,2,4,1 +942,R_6nDFxsYs7n40BOO,18 - 24,American,,American,Female,Somewhat disagree,Strongly agree,Strongly agree,Agree,Agree,5,3,2,1,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly agree,4,2,1,5,3,Somewhat Disagree,Disagree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,2,3,4,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,4,2,3,5,1,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,4,2,1,3,5,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,5,4,4,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,2,5,1,3,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,5,1,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,2,3,5,4,1,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,4,1,7,Neither Agree nor Disagree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,2,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,61,FALSE,52,TRUE,100,FALSE,56,TRUE,59,TRUE,51,TRUE,80,TRUE,52,TRUE,51,TRUE,100,FALSE,54,TRUE,73,TRUE,51,FALSE,100,FALSE,56,TRUE,50,TRUE,55,TRUE,63,TRUE,63,FALSE,51,TRUE,73,TRUE,76,FALSE,100,TRUE,75,TRUE,52,TRUE,82,TRUE,62,TRUE,55,TRUE,61,FALSE,57,FALSE,53,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,3,2,2,0,1,0,1,3,-1,-2,3,0,0,-2,-1,-1,-1,-2,-2,3,3,3,1,1,1,-1,1,1,1,4,2,0,1,1,1,3,-2,-1,1,-1,-1,5,1,3,2,1,3,3,2,-3,3,-3,3,7,0,-2,3,0,3,5,3,3,3,3,3,10,FALSE,1,61,FALSE,0,52,TRUE,0,100,FALSE,1,56,TRUE,1,59,TRUE,0,51,TRUE,1,80,TRUE,1,52,TRUE,1,51,TRUE,1,100,FALSE,1,54,TRUE,0,73,TRUE,1,51,FALSE,1,100,FALSE,0,56,TRUE,1,50,TRUE,0,55,TRUE,0,63,TRUE,0,63,FALSE,1,51,TRUE,1,73,TRUE,1,76,FALSE,1,100,TRUE,1,75,TRUE,0,52,TRUE,1,82,TRUE,0,62,TRUE,0,55,TRUE,0,61,FALSE,0,57,FALSE,0,53,TRUE,1,100,0.2304,0.0324,0.25,0.04,0,0.2601,0.0625,0,0.2401,0.0576,0.3249,0.2401,0.2401,0.2116,0.1681,0.2704,0,0.1936,0.3025,0.2704,0.0729,0.3136,0.3969,0,0.3025,0.3844,0.2809,0.1521,1,0.3969,0.3721,0.5329,0.251685714,0.162078571,0.341292857,16,50,18,56.25,3,37.5,5,62.5,6,75,4,50,12,75,6,37.5,66.38,55.88,68.75,76.75,64.12,66.69,66.06,-6.25,10.13,18.38,6.25,1.75,14.12,-8.31,28.56,1,0,0,1,1,1,2,1,0,2,3,2,2,1,1,0,0,2,0,1,2,0,1,1,1,2,4,3,4,0,1,0,0,0,3,5,4,4,4,5,0.6,1.2,1.8,0.6,1,2.6,0.8,4.4,1.05,2.2,1.625,2.67,5,4.75,-0.4,-1.4,1,-3.8,-0.266666667,-2,-3,-2,-5,-2.33,1,2,2,-2,2,1,-1,0,0,-2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,,1.25,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,01ITEM,01DIR,3,4,9,2,6,8,7,1,5,4,3,2,1 +943,R_5LcMh2B9OVA3yV7,18 - 24,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Agree,3,2,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,3,2,1,5,4,Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,1,2,5,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,2,1,5,3,4,Somewhat disagree,Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,2,1,3,4,5,3,Agree,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat agree,2,4,1,3,5,4,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,5,4,1,2,3,5,Disagree,Disagree,Agree,Somewhat agree,Disagree,5,4,1,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,2,5,4,0,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,2,3,5,4,1,4,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,5,3,2,1,3,Agree,Strongly Agree,Strongly Agree,Agree,Agree,2,4,3,5,1,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,100,TRUE,81,FALSE,51,FALSE,51,TRUE,100,TRUE,80,FALSE,59,TRUE,73,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,93,FALSE,70,TRUE,98,FALSE,53,FALSE,100,TRUE,100,FALSE,78,FALSE,100,TRUE,57,FALSE,100,TRUE,93,TRUE,100,TRUE,100,FALSE,64,FALSE,66,TRUE,79,TRUE,100,FALSE,56,TRUE,51,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,1,2,1,0,1,1,2,2,1,2,-2,3,1,1,1,2,-1,-1,2,3,-1,0,3,2,0,-1,3,1,4,1,2,1,2,2,5,-2,-2,2,1,-2,5,2,3,3,3,3,0,1,-1,2,1,2,4,3,1,3,-1,3,3,2,3,3,2,2,3,TRUE,0,70,TRUE,1,100,TRUE,0,81,FALSE,1,51,FALSE,0,51,TRUE,0,100,TRUE,1,80,FALSE,0,59,TRUE,1,73,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,93,FALSE,0,70,TRUE,1,98,FALSE,1,53,FALSE,1,100,TRUE,0,100,FALSE,1,78,FALSE,0,100,TRUE,1,57,FALSE,1,100,TRUE,1,93,TRUE,0,100,TRUE,1,100,FALSE,1,64,FALSE,1,66,TRUE,0,79,TRUE,1,100,FALSE,0,56,TRUE,1,51,0.3481,0,0.0004,0.04,0.2401,1,0.0049,0,0.0484,0.1849,0,0,0.0729,0,0.2601,0,0,0.2401,0.1156,1,1,0.49,1,0.0049,0.2209,0.1296,0.3136,0.49,0.6561,0,0.6241,0,0.28915,0.146528571,0.431771429,18,56.25,21,65.63,5,62.5,4,50,6,75,6,75,11,68.75,10,62.5,81.97,76.75,79.25,87.5,84.38,80.5,83.44,-9.38,16.34,14.25,29.25,12.5,9.38,11.75,20.94,2,1,0,2,2,1,0,2,2,1,1,1,1,4,1,3,3,1,1,1,1,0,0,2,1,0,1,1,0,0,1,0,1,1,0,1,2,2,0,3,1.4,1.2,1.6,1.8,0.8,0.4,0.6,1.6,1.5,0.85,1.175,4,2.33,3.375,0.6,0.8,1,0.2,0.8,3,0,2,2,1.67,2,1,2,-2,2,1,-1,0,0,-2,2,0,5 cents,5 minutes,24 days,Male,High School (or equivalent),21,"This was fun to do, thanks!",1,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,4,7,6,8,2,5,3,1,9,3,2,4,1 +944,R_6juHRUsdd4czYwf,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Agree,Agree,Agree,1,3,2,5,4,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,3,1,4,2,5,Strongly Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,4,3,1,2,5,Strongly Agree,Agree,Somewhat agree,Agree,Somewhat disagree,4,5,3,2,1,Neither agree nor disagree,Strongly Agree,Strongly Agree,Disagree,Agree,5,1,4,2,3,9,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,5,4,3,10,Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Agree,3,5,2,1,4,10,Somewhat agree,Neither agree nor disagree,Strongly Agree,Agree,Agree,1,4,5,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Neither agree nor disagree,Strongly Agree,Agree,5,4,1,3,2,7,Somewhat agree,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,4,1,5,2,3,8,Strongly Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Agree,3,1,5,4,2,8,Somewhat agree,Somewhat agree,Strongly Agree,Somewhat agree,Agree,5,3,1,4,2,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,96,TRUE,96,FALSE,100,FALSE,58,TRUE,80,FALSE,70,TRUE,100,TRUE,69,FALSE,74,FALSE,91,FALSE,75,FALSE,50,TRUE,58,FALSE,63,TRUE,86,FALSE,58,FALSE,100,TRUE,82,FALSE,100,FALSE,58,FALSE,55,FALSE,59,TRUE,68,TRUE,89,TRUE,65,FALSE,50,FALSE,60,FALSE,75,FALSE,62,TRUE,55,12,3,3,2,2,2,3,-3,3,-1,3,3,-3,3,-2,3,3,2,1,2,-1,0,3,3,-2,2,9,0,-2,0,1,0,10,2,0,3,2,2,10,1,0,3,2,2,8,2,2,0,3,2,7,1,-2,0,-2,0,8,3,0,-1,2,1,8,1,1,3,1,2,10,TRUE,0,55,FALSE,0,62,FALSE,1,75,FALSE,1,60,FALSE,0,50,TRUE,0,65,TRUE,1,89,TRUE,1,68,FALSE,0,59,FALSE,0,55,FALSE,1,58,FALSE,1,100,TRUE,1,82,FALSE,1,100,FALSE,0,58,TRUE,1,86,FALSE,1,63,TRUE,0,58,FALSE,1,50,FALSE,1,75,FALSE,0,91,FALSE,0,74,TRUE,0,69,TRUE,1,100,FALSE,1,70,TRUE,1,80,FALSE,1,58,FALSE,1,100,TRUE,0,96,FALSE,0,96,FALSE,0,50,TRUE,1,100,0.1024,0.04,0.0196,0.0121,0,0.4225,0,0.3025,0.0625,0.5476,0.9216,0.0324,0.3481,0.1764,0.25,0.3844,0.4761,0.16,0,0.09,0.8281,0.3364,0.25,0,0.1369,0.1764,0.25,0.3025,0.0625,0.3364,0.9216,0,0.277675,0.291721429,0.263628571,12,37.5,18,56.25,4,50,3,37.5,4,50,7,87.5,7,43.75,11,68.75,73.5,56.88,77,72.62,87.5,75,72,-18.75,17.25,6.88,39.5,22.62,0,31.25,3.25,3,0,1,4,0,3,1,3,2,3,1,3,0,4,1,2,2,2,0,3,1,1,2,1,0,2,1,3,1,3,0,3,4,4,2,2,1,2,1,3,1.6,2.4,1.8,1.8,1,2,2.6,1.8,1.9,1.85,1.875,9.67,7.67,8.75,0.6,0.4,-0.8,0,0.066666667,2,2,2,-2,2,1,0,0,-2,2,2,-2,-2,2,-2,2,-1,10 cents,75 minutes,47 days,Male,High School (or equivalent),25,,0.5,0,0,1,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,3,6,9,8,2,5,7,1,4,2,3,4,1 +945,R_7ZVbWzAeDIxHUR1,18 - 24,American,,American,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,5,3,4,2,Strongly disagree,Somewhat disagree,Agree,Strongly disagree,Neither agree nor disagree,4,2,3,5,1,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,5,3,4,2,1,Agree,Strongly Agree,Agree,Somewhat disagree,Disagree,4,1,3,2,5,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,5,1,2,3,4,8,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,1,4,5,3,2,7,Strongly Agree,Strongly Agree,Somewhat Disagree,Agree,Somewhat Disagree,1,2,5,4,3,8,Strongly disagree,Disagree,Strongly Agree,Strongly disagree,Strongly disagree,2,4,5,1,3,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,2,3,4,1,4,Somewhat agree,Disagree,Somewhat agree,Strongly disagree,Agree,4,1,5,3,2,6,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,2,1,3,5,4,2,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,1,2,4,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,TRUE,99,FALSE,100,FALSE,76,TRUE,100,FALSE,89,TRUE,100,FALSE,75,TRUE,85,FALSE,95,TRUE,61,TRUE,100,FALSE,61,FALSE,83,FALSE,69,TRUE,96,TRUE,92,FALSE,54,TRUE,71,TRUE,86,TRUE,77,FALSE,84,TRUE,84,TRUE,70,TRUE,86,TRUE,85,FALSE,93,TRUE,81,FALSE,50,FALSE,86,TRUE,81,TRUE,100,28,1,3,3,-3,3,-3,-1,2,-3,0,3,1,3,3,1,2,3,2,-1,-2,-3,1,0,3,-1,8,1,-3,3,-2,2,7,3,3,-1,2,-1,8,-3,-2,3,-3,-3,10,0,3,3,2,3,4,1,-2,1,-3,2,6,3,2,3,3,2,2,2,1,1,1,-1,4,TRUE,0,100,TRUE,1,81,FALSE,1,86,FALSE,1,50,TRUE,1,81,FALSE,1,93,TRUE,1,85,TRUE,1,86,TRUE,1,70,TRUE,1,84,FALSE,1,84,TRUE,0,77,TRUE,1,86,TRUE,0,71,FALSE,0,54,TRUE,1,92,TRUE,0,96,FALSE,1,69,FALSE,1,83,FALSE,1,61,TRUE,1,100,TRUE,1,61,FALSE,1,95,TRUE,1,85,FALSE,1,75,TRUE,1,100,FALSE,1,89,TRUE,0,100,FALSE,1,76,FALSE,0,100,TRUE,1,99,TRUE,1,97,0.0196,0,0.0064,0.0225,0.0009,0.0049,0.0225,0.0256,0.1521,0.1521,1,0.0196,0.09,0.0256,0.0361,0.0361,0.0025,0.25,1,0.0625,0,0.2916,0.0289,0.5041,0.9216,0.0121,0.0001,1,0.0196,0.0961,0.0576,0.5929,0.228753571,0.129857143,0.32765,28,87.5,25,78.13,7,87.5,7,87.5,6,75,5,62.5,14,87.5,11,68.75,83.31,76.25,90.5,80.62,85.88,85.06,81.56,9.37,5.18,-11.25,3,5.62,23.38,-2.44,12.81,4,2,3,6,4,4,2,1,1,2,0,2,4,1,2,5,5,1,2,1,1,0,0,5,0,4,1,1,0,2,0,1,0,0,1,0,2,1,2,1,3.8,2,1.8,2.8,1.2,1.6,0.4,1.2,2.6,1.1,1.85,7.67,4,6.125,2.6,0.4,1.4,1.6,1.466666667,4,1,6,6,3.67,0,2,1,-2,2,0,0,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),21,Great!,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,01ITEM,02REV,6,7,8,9,3,2,5,1,4,3,4,2,1 +946,R_5RvKlNPfLIW6A3n,18 - 24,,Canadian,Canadian,Female,Somewhat agree,Agree,Agree,Agree,Agree,4,3,5,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,4,5,3,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,2,5,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Somewhat agree,Strongly Agree,Somewhat disagree,Somewhat agree,4,3,2,5,1,10,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,1,2,4,5,10,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,1,5,2,3,4,8,Strongly disagree,Somewhat disagree,Disagree,Disagree,Neither agree nor disagree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Agree,1,3,2,4,5,4,Agree,Neither agree nor disagree,Agree,Disagree,Agree,5,4,3,1,2,5,Neither Agree nor Disagree,Disagree,Agree,Somewhat Disagree,Agree,2,1,5,4,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,3,2,4,FALSE,80,TRUE,50,TRUE,75,FALSE,50,TRUE,61,FALSE,50,TRUE,93,FALSE,50,TRUE,89,TRUE,97,FALSE,50,TRUE,70,TRUE,80,FALSE,50,TRUE,97,TRUE,90,TRUE,50,TRUE,77,TRUE,50,FALSE,50,FALSE,65,TRUE,59,FALSE,57,TRUE,50,FALSE,80,FALSE,50,FALSE,50,TRUE,65,TRUE,50,FALSE,50,TRUE,54,TRUE,85,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,2,2,1,1,1,0,1,0,0,1,1,1,-1,0,0,0,2,-1,1,3,-1,1,8,-1,0,-1,1,-1,10,-1,2,-1,0,1,10,-3,-1,-2,-2,0,8,2,2,2,2,2,2,2,0,2,-2,2,4,0,-2,2,-1,2,5,3,3,3,3,3,10,FALSE,1,80,TRUE,1,50,TRUE,0,75,FALSE,1,50,TRUE,1,61,FALSE,1,50,TRUE,1,93,FALSE,0,50,TRUE,1,89,TRUE,1,97,FALSE,1,50,TRUE,0,70,TRUE,1,80,FALSE,1,50,TRUE,1,97,TRUE,1,90,TRUE,0,50,TRUE,0,77,TRUE,0,50,FALSE,1,50,FALSE,0,65,TRUE,1,59,FALSE,1,57,TRUE,1,50,FALSE,1,80,FALSE,0,50,FALSE,1,50,TRUE,0,65,TRUE,0,50,FALSE,0,50,TRUE,1,54,TRUE,1,85,0.25,0.25,0.01,0.0049,0.0225,0.25,0.25,0.0009,0.25,0.1681,0.25,0.04,0.0121,0.25,0.1521,0.25,0.1849,0.25,0.4225,0.04,0.4225,0.0009,0.25,0.25,0.25,0.25,0.2116,0.04,0.5625,0.5929,0.25,0.49,0.227267857,0.166471429,0.288064286,16,50,21,65.63,7,87.5,5,62.5,6,75,3,37.5,12,75,9,56.25,64.81,61.25,62.25,73.25,62.5,70,59.62,-15.63,-0.82,-26.25,-0.25,-1.75,25,-5,3.37,2,1,1,3,1,2,1,2,1,2,1,2,2,1,0,2,1,2,2,2,1,0,0,0,0,1,1,1,2,1,0,2,1,2,1,4,3,3,3,1,1.6,1.6,1.2,1.8,0.2,1.2,1.2,2.8,1.55,1.35,1.45,9.33,3.67,7.125,1.4,0.4,0,-1,0.6,6,6,5,-2,5.66,0,1,1,-1,1,2,-2,0,0,0,0,0,5 cents,100 minutes,47 days,Female,University - Undergraduate,24,please share how far along progress wise people are in the survey to show them how much is left,0.125,1,0,1,0,1,0,0.67,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,5,2,4,6,9,8,3,1,7,4,2,3,1 +947,R_3FGNFRLm8W2mWmB,32 - 38,American,,American,Male,Neither agree nor disagree,Strongly agree,Agree,Agree,Strongly agree,4,1,3,2,5,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,5,1,3,4,2,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Somewhat Disagree,4,5,1,2,3,Neither agree nor disagree,Somewhat agree,Agree,Agree,Disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Agree,1,4,5,2,3,8,Agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,3,4,1,2,5,8,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,5,1,2,4,3,6,Agree,Somewhat agree,Somewhat disagree,Strongly Agree,Somewhat agree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Neither agree nor disagree,Agree,Strongly Agree,5,3,4,1,2,8,Agree,Somewhat disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,4,5,1,3,2,6,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,5,2,1,3,4,4,Agree,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,2,1,3,4,5,FALSE,100,TRUE,93,TRUE,72,FALSE,73,TRUE,96,FALSE,85,TRUE,82,TRUE,100,TRUE,94,TRUE,83,FALSE,100,TRUE,68,FALSE,87,FALSE,75,FALSE,63,TRUE,100,FALSE,97,TRUE,72,FALSE,100,FALSE,91,TRUE,95,TRUE,74,TRUE,64,TRUE,91,TRUE,88,TRUE,74,FALSE,100,FALSE,96,TRUE,86,TRUE,57,TRUE,92,FALSE,92,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,2,2,3,1,0,2,-1,1,1,0,3,1,-1,0,1,2,2,-2,0,0,1,3,2,7,2,1,2,0,3,8,0,1,-1,3,1,8,2,1,-1,3,1,6,2,3,0,2,3,7,2,-1,1,3,0,8,0,2,-1,1,-1,6,2,2,3,3,0,4,FALSE,1,100,TRUE,1,93,TRUE,0,72,FALSE,1,73,TRUE,1,96,FALSE,1,85,TRUE,1,82,TRUE,1,100,TRUE,1,94,TRUE,1,83,FALSE,1,100,TRUE,0,68,FALSE,0,87,FALSE,1,75,FALSE,0,63,TRUE,1,100,FALSE,1,97,TRUE,0,72,FALSE,1,100,FALSE,1,91,TRUE,1,95,TRUE,1,74,TRUE,0,64,TRUE,1,91,TRUE,0,88,TRUE,1,74,FALSE,1,100,FALSE,1,96,TRUE,0,86,TRUE,1,57,TRUE,1,92,FALSE,0,92,0,0.0676,0,0.0324,0.8464,0.0225,0.0081,0.0289,0.0081,0.0676,0.1849,0.7569,0.0036,0,0.0016,0.0049,0.4096,0.0729,0.0016,0.7744,0.0025,0.3969,0,0.0625,0.0009,0,0.0064,0,0.5184,0.5184,0.7396,0.4624,0.210714286,0.172571429,0.248857143,25,78.13,23,71.88,7,87.5,4,50,6,75,6,75,13,81.25,10,62.5,85.62,89.38,87.75,81,84.38,85.81,85.44,6.25,13.74,1.88,37.75,6,9.38,4.56,22.94,0,3,1,1,1,1,1,0,1,2,1,1,4,2,2,2,0,3,1,3,2,0,2,0,0,1,1,1,4,1,1,2,4,0,0,2,1,1,1,2,1.2,1,2,1.8,0.8,1.6,1.4,1.4,1.5,1.3,1.4,7.67,7,6.75,0.4,-0.6,0.6,0.4,0.133333333,0,0,2,2,0.67,0,0,0,-1,1,1,-1,0,0,1,-1,1,10 cents,100 minutes,47 days,Male,High School (or equivalent),35,It became hard in some parts but I had a good time,0,0,0,1,1,1,0,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,8,6,9,3,5,2,4,1,7,2,3,4,1 +948,R_3djZmCukYTMNCKZ,18 - 24,,Canadian,Canadian,Male,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,3,5,1,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,5,2,3,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,1,5,3,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,1,3,5,4,2,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,1,4,3,5,2,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,4,3,5,1,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,1,4,8,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Agree,2,1,3,5,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,5,3,1,4,2,7,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,1,2,4,5,3,8,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,4,2,5,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,5,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,55,FALSE,60,FALSE,75,FALSE,55,FALSE,50,TRUE,55,TRUE,100,FALSE,65,FALSE,60,TRUE,65,FALSE,50,TRUE,100,TRUE,100,TRUE,75,FALSE,65,TRUE,75,TRUE,75,TRUE,100,TRUE,100,FALSE,65,TRUE,100,TRUE,100,FALSE,75,FALSE,65,FALSE,75,FALSE,50,FALSE,55,FALSE,55,FALSE,55,TRUE,100,TRUE,100,FALSE,50,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,1,0,2,1,0,0,-1,1,1,0,1,1,1,1,2,1,2,1,1,-1,2,0,1,6,0,1,0,1,1,5,0,1,1,1,1,8,0,1,2,1,2,7,2,1,-1,0,1,7,0,-1,2,1,1,8,0,1,1,0,1,6,0,1,1,1,1,5,FALSE,1,55,FALSE,0,60,FALSE,1,75,FALSE,1,55,FALSE,0,50,TRUE,0,55,TRUE,1,100,FALSE,0,65,FALSE,0,60,TRUE,1,65,FALSE,1,50,TRUE,0,100,TRUE,1,100,TRUE,0,75,FALSE,0,65,TRUE,1,75,TRUE,0,75,TRUE,0,100,TRUE,0,100,FALSE,1,65,TRUE,1,100,TRUE,1,100,FALSE,1,75,FALSE,0,65,FALSE,1,75,FALSE,0,50,FALSE,1,55,FALSE,1,55,FALSE,1,55,TRUE,1,100,TRUE,1,100,FALSE,0,50,0.4225,0.25,0.0625,0,0.25,0.3025,0.4225,0.1225,0.1225,0,0,0,0.36,0.25,0.25,0.36,0.0625,0.2025,0.2025,0.0625,0,0.4225,1,0.5625,0.5625,0.2025,0,0.2025,0.0625,1,0.2025,1,0.292410714,0.193214286,0.391607143,20,62.5,18,56.25,4,50,4,50,5,62.5,5,62.5,8,50,10,62.5,72.66,68.12,70,77.5,75,75.31,70,6.25,16.41,18.12,20,15,12.5,25.31,7.5,0,3,1,0,1,1,1,0,2,0,1,1,0,0,0,1,1,1,1,1,1,1,2,0,1,1,1,2,2,0,1,1,0,1,0,1,1,0,1,0,1,0.8,0.4,1,1,1.2,0.6,0.6,0.8,0.85,0.825,6.33,7,6.5,0,-0.4,-0.2,0.4,-0.2,-1,-3,2,2,-0.67,0,0,1,-1,1,1,-1,0,0,1,-1,0,10 cents,100 minutes,47 days,Male,High School (or equivalent),24,,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,8,5,9,6,7,2,4,1,3,2,3,4,1 +949,R_5mXGwTbhFQ345Db,18 - 24,,Canadian,Canadian,Female,Agree,Strongly agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,5,2,3,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,3,5,2,4,Somewhat Agree,Disagree,Somewhat Agree,Disagree,Agree,3,5,1,2,4,Disagree,Disagree,Disagree,Somewhat disagree,Disagree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,3,5,2,1,4,6,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,3,1,5,4,2,5,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Disagree,Agree,1,3,2,4,5,3,Disagree,Somewhat disagree,Disagree,Somewhat disagree,Disagree,5,1,4,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Strongly Agree,Somewhat agree,Somewhat agree,Agree,1,5,3,4,2,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,3,5,4,2,2,Somewhat Agree,Disagree,Agree,Disagree,Agree,5,3,2,4,1,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,4,1,3,2,TRUE,100,FALSE,50,FALSE,100,FALSE,50,TRUE,50,FALSE,75,TRUE,85,FALSE,70,FALSE,50,TRUE,70,FALSE,50,TRUE,80,TRUE,50,FALSE,75,TRUE,60,TRUE,50,TRUE,50,TRUE,90,TRUE,50,FALSE,50,FALSE,60,FALSE,50,FALSE,70,TRUE,50,TRUE,50,TRUE,80,FALSE,50,FALSE,75,TRUE,50,FALSE,75,FALSE,50,FALSE,60,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,-1,1,-2,1,-1,1,-1,1,-2,1,-2,2,-2,-2,-2,-1,-2,2,1,2,-2,0,4,1,0,-1,-1,1,6,1,-1,1,-2,2,5,-2,-1,-2,-1,-2,3,2,3,1,1,2,2,-1,0,1,-1,1,3,1,-2,2,-2,2,2,1,0,1,1,-1,4,TRUE,0,100,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,50,FALSE,1,75,TRUE,1,85,FALSE,0,70,FALSE,0,50,TRUE,1,70,FALSE,1,50,TRUE,0,80,TRUE,1,50,FALSE,1,75,TRUE,1,60,TRUE,1,50,TRUE,0,50,TRUE,0,90,TRUE,0,50,FALSE,1,50,FALSE,0,60,FALSE,0,50,FALSE,1,70,TRUE,1,50,TRUE,0,50,TRUE,1,80,FALSE,1,50,FALSE,1,75,TRUE,0,50,FALSE,0,75,FALSE,0,50,FALSE,0,60,0.49,0.04,0.25,0.0225,0.36,0.0625,0.25,0.09,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.25,0.09,0.25,0.0625,0.25,0.36,0.16,0.25,0.0625,0.25,0.25,0.25,1,0,0.81,0.25,0.64,0.286071429,0.243928571,0.328214286,10,31.25,17,53.13,4,50,4,50,4,50,5,62.5,8,50,9,56.25,63.28,51.25,58.12,75,68.75,60,66.56,-21.88,10.15,1.25,8.12,25,6.25,10,10.31,0,2,1,1,1,3,1,0,2,2,0,1,0,0,0,0,1,0,0,0,0,0,0,2,1,1,1,2,2,2,0,0,1,0,0,3,2,3,2,1,1,1.6,0.2,0.2,0.6,1.6,0.2,2.2,0.75,1.15,0.95,5,2.33,3.625,0.4,0,0,-2,0.133333333,2,3,3,-1,2.67,0,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,23,"i enjoyed the survey and found it easy to navigate and interesting to explore my thoughts. however, i found the sliding scale a bit difficult to move around.",1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,4,5,9,7,8,6,2,1,3,3,4,2,1 +950,R_3ruEKS7o2pKeasF,60 - 66,,Canadian,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Strongly agree,2,4,5,3,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,5,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,2,5,4,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,2,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,1,2,4,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,4,5,2,3,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,2,4,1,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,6,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,4,3,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,5,2,1,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,94,FALSE,92,TRUE,93,FALSE,93,TRUE,94,TRUE,100,TRUE,94,TRUE,96,TRUE,98,TRUE,96,TRUE,95,FALSE,98,FALSE,99,TRUE,94,TRUE,94,TRUE,100,FALSE,77,FALSE,92,TRUE,99,TRUE,100,FALSE,94,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,73,FALSE,77,TRUE,100,TRUE,100,TRUE,100,TRUE,100,25,0,0,1,2,3,-1,-1,1,1,1,1,1,1,1,-1,1,1,1,1,1,1,1,1,1,0,3,1,1,1,0,0,4,1,1,1,1,1,4,0,1,0,1,-2,4,2,2,2,1,1,7,0,0,0,0,0,6,1,0,0,1,1,6,0,0,1,-1,-1,5,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,100,FALSE,0,77,TRUE,0,73,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,99,FALSE,1,92,FALSE,0,77,TRUE,1,100,TRUE,0,94,TRUE,0,94,FALSE,1,99,FALSE,1,98,TRUE,1,95,TRUE,1,96,TRUE,0,98,TRUE,1,96,TRUE,0,94,TRUE,1,100,TRUE,0,94,FALSE,1,93,TRUE,0,93,FALSE,0,92,TRUE,1,94,TRUE,1,90,0,0,0,0,0.01,0.5329,0.0016,0,0.0004,0.0016,0.8464,0.0001,0,0.0036,0.5929,0,0.9604,1,0.0049,0.8836,0.0025,0.5929,0.0001,0.0064,0.8836,0.8836,0.0036,1,1,0.8836,0.8649,1,0.427128571,0.282135714,0.572121429,25,78.13,18,56.25,5,62.5,3,37.5,5,62.5,5,62.5,13,81.25,5,31.25,94.75,94.75,89.88,97,97.38,94.75,94.75,21.88,38.5,32.25,52.38,34.5,34.88,13.5,63.5,1,1,0,1,3,2,2,0,1,1,0,0,0,0,2,1,0,1,0,3,2,2,1,1,2,1,1,1,1,1,0,1,1,0,2,1,1,0,2,2,1.2,1.2,0.4,1,1.6,1,0.8,1.2,0.95,1.15,1.05,3.67,6.33,4.875,-0.4,0.2,-0.4,-0.2,-0.2,-4,-2,-2,-1,-2.66,0,1,-1,-1,1,0,0,1,-1,-1,1,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),60,none,0.25,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,02FUT,01ITEM,02REV,9,8,7,5,3,6,2,1,4,3,4,2,1 +951,R_6V58PWU0Reztyhz,60 - 66,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Disagree,3,2,1,5,4,Strongly disagree,Strongly disagree,Strongly agree,Agree,Somewhat disagree,1,2,5,4,3,Strongly Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,3,5,4,1,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat disagree,Strongly disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Disagree,Strongly Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,3,2,4,5,3,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,1,2,4,5,3,5,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,2,5,3,1,4,10,Agree,Agree,Agree,Agree,Somewhat agree,5,4,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Somewhat agree,Strongly Agree,Somewhat agree,Disagree,Agree,5,4,2,3,1,8,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,2,3,4,5,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,4,5,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,4,3,2,1,5,FALSE,100,FALSE,75,TRUE,100,FALSE,54,TRUE,75,FALSE,54,TRUE,100,TRUE,100,TRUE,51,TRUE,100,FALSE,72,TRUE,100,TRUE,89,TRUE,82,FALSE,80,TRUE,100,FALSE,51,FALSE,100,TRUE,94,FALSE,100,FALSE,93,TRUE,100,TRUE,59,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,94,FALSE,100,TRUE,100,TRUE,61,TRUE,91,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,-3,-2,-3,-3,3,2,-1,3,-2,3,-3,3,-3,-3,-3,-1,-3,-2,3,1,-1,0,9,1,-3,3,-2,2,3,3,2,3,-2,3,5,2,2,2,2,1,10,1,3,1,-2,2,10,2,-3,3,-3,3,8,3,-3,3,-3,3,0,3,3,3,3,-3,10,FALSE,1,100,FALSE,0,75,TRUE,0,100,FALSE,1,54,TRUE,1,75,FALSE,1,54,TRUE,1,100,TRUE,1,100,TRUE,1,51,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,1,89,TRUE,0,82,FALSE,0,80,TRUE,1,100,FALSE,1,51,FALSE,1,100,TRUE,0,94,FALSE,1,100,FALSE,0,93,TRUE,1,100,TRUE,0,59,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,0,94,FALSE,1,100,TRUE,1,100,TRUE,1,61,TRUE,1,91,0,0,0,0,0.0081,0.2116,0,0,0,0,0,0.0121,0.2401,0.0784,0.0625,0.5625,0.3481,0.2116,0.8836,1,0.8649,0.64,0.8836,0.6724,0.2401,1,0.1521,0,1,0,0,1,0.359703571,0.123928571,0.595478571,27,84.38,21,65.63,4,50,6,75,6,75,5,62.5,13,81.25,8,50,86.72,73.38,76.5,97.75,99.25,88.44,85,18.75,21.09,23.38,1.5,22.75,36.75,7.19,35,3,0,2,2,2,4,0,0,4,3,0,4,0,1,0,5,5,5,3,4,0,0,2,1,4,5,0,0,5,4,0,1,0,0,0,6,6,6,4,0,1.8,2.2,1,4.4,1.4,2.8,0.2,4.4,2.35,2.2,2.275,5.67,6,6.875,0.4,-0.6,0.8,0,0.2,-1,-5,5,0,-0.33,0,2,2,-2,2,1,-1,1,-1,-2,2,2,5 cents,100 minutes,15 days,Male,High School (or equivalent),66,I am embarrassed that I could not confidently answer the math questions! ,1,1,0,0,0,1,0,0.33,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,01DIR,2,7,5,6,3,4,8,1,9,2,3,4,1 +952,R_1P7HFMubSLxJSWR,67 - 73,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,2,4,3,5,Somewhat agree,Somewhat disagree,Strongly agree,Strongly disagree,Somewhat agree,1,2,4,5,3,Agree,Agree,Strongly Agree,Somewhat Disagree,Agree,1,2,4,5,3,Neither agree nor disagree,Agree,Somewhat agree,Agree,Disagree,3,1,4,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,4,2,5,1,0,Agree,Disagree,Strongly agree,Disagree,Strongly agree,5,4,3,2,1,4,Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,3,2,4,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,3,4,5,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,2,1,3,5,0,Agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,4,5,2,1,3,0,Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Agree,4,2,3,5,1,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,2,4,3,1,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,75,TRUE,90,TRUE,75,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,87,TRUE,100,TRUE,82,TRUE,100,TRUE,87,TRUE,100,FALSE,79,FALSE,86,TRUE,99,TRUE,100,TRUE,100,TRUE,93,TRUE,100,FALSE,78,TRUE,100,TRUE,100,TRUE,100,30,3,3,3,3,2,1,-1,3,-3,1,2,2,3,-1,2,0,2,1,2,-2,3,3,3,3,2,0,2,-2,3,-2,3,4,2,2,3,0,2,4,1,1,1,1,-2,4,3,3,3,3,2,0,2,-3,3,-2,3,0,2,2,3,0,2,4,1,1,2,1,-3,4,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,78,TRUE,1,100,TRUE,0,93,TRUE,1,100,TRUE,1,100,TRUE,1,99,FALSE,0,86,FALSE,1,79,TRUE,0,100,TRUE,1,87,TRUE,0,100,TRUE,1,82,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,75,TRUE,1,90,TRUE,0,75,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.01,0,0,0,0.8649,0,0.7396,1,0,0,0.0169,0.0001,0.0441,0,0,1,0.0484,0,0.5625,0,0.0324,1,1,0.7569,0.5625,0,1,1,1,1,1,0.451010714,0.265285714,0.636735714,30,93.75,18,56.25,6,75,4,50,3,37.5,5,62.5,15,93.75,3,18.75,94.72,89.12,95.88,93.88,100,96.5,92.94,37.5,38.47,14.12,45.88,56.38,37.5,2.75,74.19,0,0,0,0,0,1,1,0,1,2,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,2,0,1,2,0,0,0,1,0,1,1,1,1,1,0,1,0.2,0.6,0,1.2,0.2,1,0.45,0.6,0.525,2.67,1.33,2.5,0,-0.2,0,-0.4,-0.066666667,0,4,0,0,1.34,0,1,2,-2,2,-1,1,-2,2,-2,2,-1,10 cents,5 minutes,24 days,Male,University - Undergraduate,73,Survey is a bit too long....,1.125,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,02FUT,01ITEM,02REV,9,3,2,4,8,6,5,1,7,3,2,4,1 +953,R_3rzpThwNkJJajg5,67 - 73,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Agree,Strongly disagree,Neither agree nor disagree,5,4,2,1,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,1,3,5,4,Agree,Somewhat Agree,Strongly Agree,Disagree,Somewhat Agree,5,4,2,1,3,Somewhat disagree,Somewhat agree,Agree,Agree,Disagree,1,2,4,3,5,Agree,Strongly Agree,Agree,Strongly disagree,Neither agree nor disagree,4,3,2,5,1,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,5,1,2,3,0,Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Somewhat Agree,2,5,1,4,3,0,Disagree,Somewhat agree,Agree,Somewhat agree,Disagree,5,4,1,2,3,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Strongly disagree,3,1,5,2,4,4,Strongly disagree,Disagree,Neither agree nor disagree,Disagree,Strongly disagree,4,3,1,2,5,6,Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Somewhat Agree,5,2,3,1,4,0,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,2,4,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,50,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,70,TRUE,100,TRUE,50,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,50,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,100,TRUE,50,FALSE,100,TRUE,50,TRUE,50,FALSE,100,TRUE,50,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,-3,0,-3,-3,3,-3,1,2,1,3,-2,1,-1,1,2,2,-2,2,3,2,-3,0,0,-3,-3,3,-3,1,0,2,1,3,-3,1,0,-2,1,2,1,-2,2,2,3,3,2,-3,4,-3,-2,0,-2,-3,6,2,1,3,-3,1,0,-2,-2,1,0,-2,6,FALSE,1,50,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,70,TRUE,1,100,TRUE,1,50,FALSE,0,100,FALSE,1,50,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,50,TRUE,1,100,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,0,50,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,50,TRUE,1,50,FALSE,0,100,TRUE,1,50,0,0,0,0.09,0.25,0,0,1,0,0.25,0.25,1,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,1,0.25,0.25,1,0.25,1,0.25,0.25,1,0.375,0.303571429,0.446428571,16,50,20,62.5,6,75,3,37.5,5,62.5,6,75,11,68.75,9,56.25,70.94,56.25,62.5,71.25,93.75,73.12,68.75,-12.5,8.44,-18.75,25,8.75,18.75,4.37,12.5,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,1,5,3,0,1,3,1,4,0,0,0,1,0,1,3,1,2,0,0.2,0,0.2,0.4,2,1.8,0.2,1.4,0.2,1.35,0.775,0,3.33,2.25,-1.8,-1.8,0,-1,-1.2,-4,-6,0,-4,-3.33,1,2,2,-2,2,-2,2,-2,2,-2,2,0,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,68,fun survey,1.625,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,01DIR,8,3,7,2,5,6,9,1,4,3,2,4,1 +954,R_1plDXanV8kNHLlK,67 - 73,,Canadian,Canadian,Male,Disagree,Somewhat disagree,Agree,Agree,Agree,2,5,1,3,4,Strongly disagree,Somewhat agree,Somewhat agree,Disagree,Disagree,5,2,4,1,3,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Agree,5,2,1,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat disagree,Disagree,Agree,Neither agree nor disagree,Strongly Agree,5,2,1,4,3,3,Strongly disagree,Somewhat agree,Somewhat agree,Disagree,Disagree,4,5,2,1,3,2,Disagree,Somewhat Agree,Somewhat Agree,Disagree,Agree,3,4,1,2,5,7,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,1,4,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Disagree,Agree,Strongly Agree,Neither agree nor disagree,4,5,1,2,3,2,Strongly disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,5,3,2,1,4,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Agree,1,4,3,5,2,7,Disagree,Disagree,Somewhat agree,Somewhat agree,Strongly disagree,5,2,4,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,98,TRUE,98,TRUE,76,TRUE,99,TRUE,70,TRUE,62,TRUE,100,TRUE,54,TRUE,99,FALSE,52,TRUE,96,TRUE,95,FALSE,100,FALSE,52,TRUE,62,FALSE,68,TRUE,100,FALSE,53,TRUE,93,TRUE,96,FALSE,53,FALSE,53,FALSE,53,TRUE,55,TRUE,92,TRUE,53,FALSE,97,TRUE,53,TRUE,53,TRUE,93,TRUE,92,FALSE,98,26,-2,-1,2,2,2,-3,1,1,-2,-2,2,1,1,-3,2,0,1,1,1,-2,-1,-2,2,0,3,5,-3,1,1,-2,-2,3,-2,1,1,-2,2,2,-2,-1,-1,1,-2,7,-2,-2,2,3,0,4,-3,1,1,0,-2,2,1,1,1,-3,2,2,-2,-2,1,1,-3,7,FALSE,1,98,TRUE,1,92,TRUE,0,93,TRUE,0,53,TRUE,1,53,FALSE,1,97,TRUE,1,53,TRUE,1,92,TRUE,1,55,FALSE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,96,TRUE,0,93,FALSE,0,53,TRUE,1,100,FALSE,1,68,TRUE,0,62,FALSE,1,52,FALSE,1,100,TRUE,1,95,TRUE,1,96,FALSE,1,52,TRUE,1,99,TRUE,0,54,TRUE,1,100,TRUE,0,62,TRUE,0,70,TRUE,0,99,TRUE,1,76,TRUE,1,98,TRUE,1,98,0.0064,0,0,0.2209,0.0004,0.0009,0.0001,0.2809,0,0.0016,0.0576,0.0016,0.2025,0.2209,0.2209,0.0064,0.2304,0.2809,0.49,0.2916,0.0025,0.2809,0.2304,0.8649,0.1024,0.3844,0.0004,0.0004,0.8649,0.3844,0.9801,0.2209,0.235832143,0.107507143,0.364157143,26,81.25,22,68.75,5,62.5,7,87.5,4,50,6,75,14,87.5,8,50,77.12,64.75,82.25,76.12,85.38,81.81,72.44,12.5,8.37,2.25,-5.25,26.12,10.38,-5.69,22.44,1,1,0,2,1,0,0,0,0,0,4,0,0,1,0,2,2,2,0,0,0,1,0,1,2,0,0,0,2,0,1,0,0,0,0,2,3,0,0,1,1,0,1,1.2,0.8,0.4,0.2,1.2,0.8,0.65,0.725,3.33,2.67,4,0.2,-0.4,0.8,0,0.2,1,1,0,0,0.66,2,2,2,-1,1,1,-1,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),71,nothing to add,1.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,6,5,8,9,7,3,2,1,4,3,2,4,1 +955,R_58HsVEeLBESJcI1,18 - 24,American,,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,4,1,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,3,4,2,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,3,5,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,3,1,7,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,4,5,2,1,3,7,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,5,2,3,4,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,4,1,3,2,5,5,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,4,5,3,2,1,5,Neither Agree nor Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,3,2,1,5,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,4,2,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,50,FALSE,81,TRUE,59,TRUE,80,FALSE,50,FALSE,75,FALSE,100,TRUE,50,TRUE,76,TRUE,76,FALSE,75,FALSE,50,FALSE,50,TRUE,93,TRUE,77,TRUE,64,FALSE,50,TRUE,86,TRUE,77,TRUE,85,FALSE,94,TRUE,86,TRUE,82,TRUE,95,TRUE,83,FALSE,78,TRUE,82,FALSE,50,TRUE,80,TRUE,50,FALSE,88,17,1,1,1,1,1,1,0,1,1,1,1,-1,1,1,1,0,-1,-1,-1,-1,1,1,1,1,1,7,-1,0,2,1,0,7,1,1,0,0,1,7,0,0,0,0,0,7,1,1,0,0,2,5,2,0,2,-1,2,5,0,-2,2,0,2,5,2,1,2,2,0,5,FALSE,1,88,TRUE,1,50,TRUE,0,80,FALSE,1,50,TRUE,1,82,FALSE,1,78,TRUE,1,83,TRUE,1,95,TRUE,1,82,TRUE,1,86,FALSE,1,94,TRUE,0,85,TRUE,1,77,TRUE,0,86,FALSE,0,50,TRUE,1,64,TRUE,0,77,TRUE,0,93,FALSE,1,50,FALSE,1,50,FALSE,0,75,TRUE,1,76,TRUE,0,76,TRUE,1,50,FALSE,1,100,FALSE,0,75,FALSE,1,50,TRUE,0,80,TRUE,0,59,FALSE,0,81,FALSE,0,50,TRUE,1,100,0.0025,0.5625,0.1296,0.0289,0,0.0484,0.25,0.0196,0.25,0.0576,0.6561,0.0529,0.0324,0.0036,0.0324,0.25,0.5776,0.25,0.64,0,0.5625,0.25,0.25,0.7396,0.5929,0.25,0.25,0.0144,0.64,0.8649,0.3481,0.7225,0.307339286,0.177185714,0.437492857,17,53.13,19,59.38,6,75,4,50,5,62.5,4,50,11,68.75,8,50,74.12,59.5,78,85.88,73.12,73.5,74.75,-6.25,14.74,-15.5,28,23.38,23.12,4.75,24.75,0,0,0,0,0,2,0,1,0,1,0,2,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,1,2,1,1,1,1,1,1,2,2,3,3,1,0,0.8,0.8,0.8,0.6,1,1,2.2,0.6,1.2,0.9,7,5,6,-0.6,-0.2,-0.2,-1.4,-0.333333333,2,2,2,2,2,1,1,2,-2,2,1,-1,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,24,I don't have any feedback about this survey that I would like to share,1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,5,2,6,9,7,4,3,1,8,4,3,2,1 +956,R_62OCFs2732b3GKJ,67 - 73,,Canadian,Canadian,Male,Strongly disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,2,5,3,1,Strongly disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,2,5,3,1,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,3,5,4,Somewhat agree,Agree,Agree,Agree,Strongly disagree,4,1,2,3,5,Strongly disagree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,2,4,5,3,0,Strongly disagree,Disagree,Strongly agree,Disagree,Agree,1,3,2,4,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,1,2,3,0,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Strongly disagree,3,1,4,5,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,1,2,4,5,3,0,Strongly disagree,Disagree,Strongly agree,Disagree,Agree,5,4,2,1,3,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,5,4,0,Agree,Somewhat agree,Agree,Strongly Agree,Strongly disagree,5,3,4,1,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,100,TRUE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,50,13,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-3,3,3,0,3,-3,-2,2,-2,0,3,2,3,3,3,1,2,2,2,-3,-3,3,3,0,3,0,-3,-2,3,-2,2,0,3,3,3,3,3,0,0,2,1,1,-3,0,-3,3,3,0,2,0,-3,-2,3,-2,2,0,3,3,3,3,3,0,2,1,2,3,-3,0,TRUE,0,100,TRUE,1,50,TRUE,0,100,FALSE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,TRUE,1,50,FALSE,0,50,FALSE,1,50,TRUE,0,100,TRUE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,FALSE,1,50,FALSE,0,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,0,50,0,0.25,0,1,0.25,0.25,0,0.25,0.25,0.25,0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1,0.25,1,0.25,0,0.25,0.25,1,1,1,0.25,1,0.383928571,0.214285714,0.553571429,13,40.63,18,56.25,5,62.5,5,62.5,2,25,6,75,8,50,10,62.5,68.75,56.25,62.5,68.75,87.5,68.75,68.75,-15.62,12.5,-6.25,0,43.75,12.5,18.75,6.25,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,2,0,1,0,0,0,1,1,0,1,0,0,0.6,0.2,0.6,0.2,0.6,0.2,0.6,0.35,0.4,0.375,0,0,0,-0.2,0,0,0,-0.066666667,0,0,0,0,0,0,0,1,-1,1,0,0,0,0,-1,1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,67,,0.375,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,5,7,2,3,4,8,6,1,9,3,4,2,1 +957,R_1tEglXSyMh9qA5o,39 - 45,,Canadian,Canadian,Male,Agree,Agree,Somewhat agree,Strongly agree,Agree,5,4,3,2,1,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,5,2,4,3,1,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,2,1,3,5,4,Strongly disagree,Somewhat disagree,Disagree,Strongly disagree,Strongly disagree,5,2,3,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,2,1,5,1,Disagree,Strongly disagree,Strongly disagree,Disagree,Agree,1,3,4,2,5,3,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,5,2,3,1,4,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,2,5,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Strongly Agree,Agree,1,5,2,4,3,3,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,5,2,3,4,1,2,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,4,1,2,3,5,1,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,4,2,5,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,FALSE,71,TRUE,91,TRUE,64,TRUE,55,FALSE,56,TRUE,100,TRUE,89,TRUE,84,TRUE,100,FALSE,53,TRUE,89,FALSE,96,FALSE,88,TRUE,72,TRUE,99,FALSE,58,TRUE,91,FALSE,99,FALSE,100,FALSE,99,TRUE,100,FALSE,65,FALSE,72,FALSE,62,TRUE,87,TRUE,80,FALSE,71,FALSE,100,TRUE,100,TRUE,94,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,1,3,2,1,-3,3,-2,2,3,1,3,1,2,-3,-1,-2,-3,-3,3,3,3,3,3,1,-2,-3,-3,-2,2,3,1,1,2,-1,3,4,-3,-3,-3,-3,-3,6,3,2,1,3,2,3,1,-3,3,-2,3,2,3,1,3,3,2,1,1,3,3,3,-2,8,FALSE,1,100,FALSE,0,71,TRUE,0,91,TRUE,0,64,TRUE,1,55,FALSE,1,56,TRUE,1,100,TRUE,1,89,TRUE,1,84,TRUE,1,100,FALSE,1,53,TRUE,0,89,FALSE,0,96,FALSE,1,88,TRUE,1,72,TRUE,1,99,FALSE,1,58,TRUE,0,91,FALSE,1,99,FALSE,1,100,FALSE,0,99,TRUE,1,100,FALSE,1,65,FALSE,0,72,FALSE,1,62,TRUE,1,87,TRUE,0,80,FALSE,1,71,FALSE,1,100,TRUE,1,100,TRUE,1,94,TRUE,1,100,0.0121,0.0169,0.0001,0,0,0.1936,0.5184,0,0,0,0,0.9216,0.0256,0.2209,0.2025,0.5041,0.1225,0.4096,0.0841,0.1444,0.9801,0.0784,0.0001,0.0144,0.1764,0.64,0.0036,0,0.8281,0.8281,0,0.7921,0.274592857,0.222771429,0.326414286,20,62.5,23,71.88,5,62.5,6,75,7,87.5,5,62.5,12,75,11,68.75,83.91,77.12,78.62,91,88.88,88.62,79.19,-9.38,12.03,14.62,3.62,3.5,26.38,13.62,10.44,1,1,2,0,1,3,0,6,0,0,2,0,1,2,1,0,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,2,0,4,4,5,6,1,1,1.8,1.2,0.6,0.2,0.2,0.4,4,1.15,1.2,1.175,2.67,2,3.5,0.8,1.6,0.8,-3.4,1.066666667,-2,1,3,-2,0.67,2,1,2,-2,2,0,0,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,39,,1.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,02FUT,01ITEM,01DIR,4,7,8,3,9,5,2,1,6,2,3,4,1 +958,R_34TAmNpBoVjFjsR,67 - 73,,Canadian,Canadian,Male,Strongly disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Disagree,1,5,3,4,2,Disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,2,1,4,5,Strongly Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,2,3,5,1,4,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,4,2,1,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly disagree,Agree,Strongly Agree,Strongly Agree,Strongly disagree,5,1,2,4,3,0,Disagree,Somewhat disagree,Strongly agree,Agree,Agree,1,2,5,3,4,4,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,5,4,1,2,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,1,3,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly disagree,Agree,Strongly Agree,Strongly Agree,Disagree,3,5,4,1,2,6,Disagree,Disagree,Strongly agree,Somewhat disagree,Agree,1,4,2,5,3,5,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,1,5,4,3,2,7,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,4,3,5,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,79,TRUE,100,TRUE,87,TRUE,100,FALSE,50,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,59,TRUE,100,TRUE,86,FALSE,100,TRUE,100,TRUE,100,FALSE,60,TRUE,100,TRUE,78,TRUE,100,TRUE,100,FALSE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,25,-3,1,3,0,-2,-2,-2,3,-1,1,3,2,3,-1,3,1,1,2,2,0,-3,2,3,3,-3,0,-2,-1,3,2,2,0,3,3,3,2,3,4,1,1,2,1,0,8,-3,2,3,3,-2,5,-2,-2,3,-1,2,6,3,3,3,-1,3,5,3,1,3,3,0,7,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,78,TRUE,1,100,FALSE,1,60,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,86,TRUE,1,100,FALSE,1,59,TRUE,0,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,0,50,FALSE,1,50,TRUE,1,100,TRUE,0,87,TRUE,1,100,TRUE,0,79,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,50,TRUE,1,100,0,0,0,0,0,0,0,0,0,0.25,0,0,0.0484,0.16,0.25,0,0.25,0,0,0.7569,0,0.0196,1,0,0.1681,0.6241,0.25,1,1,1,1,1,0.313467857,0.068457143,0.558478571,25,78.13,23,71.88,6,75,7,87.5,4,50,6,75,15,93.75,8,50,89.03,81.62,82.38,92.12,100,88.38,89.69,6.25,17.15,6.62,-5.12,42.12,25,-5.37,39.69,0,1,0,3,1,0,1,0,3,1,0,1,0,3,0,0,0,0,1,0,0,1,0,3,0,0,0,0,0,1,0,1,0,0,0,2,0,1,1,0,1,1,0.8,0.2,0.8,0.2,0.2,0.8,0.75,0.5,0.625,1.33,5.33,4.375,0.2,0.8,0.6,-0.6,0.533333333,-5,-6,-1,1,-4,2,2,2,-2,2,0,0,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),68,very different and interesting survey,1.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,6,2,5,8,3,4,9,1,7,2,4,3,1 +959,R_5UBRUCddWy4RBzH,18 - 24,American,,American,Male,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,5,3,4,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,3,5,2,4,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,1,4,2,Disagree,Disagree,Disagree,Disagree,Strongly disagree,2,4,1,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,2,5,4,9,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,4,5,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,5,2,9,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,5,3,2,4,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,4,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,8,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,1,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,5,4,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,60,TRUE,80,FALSE,50,FALSE,50,TRUE,62,FALSE,100,FALSE,52,TRUE,100,FALSE,58,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,70,FALSE,50,FALSE,100,TRUE,71,FALSE,64,TRUE,72,TRUE,78,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,2,0,2,-1,0,0,1,0,0,1,1,0,0,-2,-2,-2,-2,-3,1,1,1,0,1,9,-2,0,0,0,0,8,0,0,0,0,0,9,-1,-1,-1,-1,-3,8,2,2,2,0,2,5,0,0,0,0,0,8,0,2,1,0,0,7,0,0,0,0,1,7,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,60,TRUE,1,80,FALSE,1,50,FALSE,1,50,TRUE,1,62,FALSE,1,100,FALSE,0,52,TRUE,1,100,FALSE,1,58,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,70,FALSE,1,50,FALSE,1,100,TRUE,0,71,FALSE,0,64,TRUE,1,72,TRUE,1,78,0,0.49,0,0,0.0484,0.25,0,0.04,0,0,0.4096,0.1444,0.16,0.25,0,0,0,0.25,0,0,0,0.2704,0,0,0.1764,0.25,0.0784,0,0,0,0.5041,0.25,0.110060714,0.110885714,0.109235714,16,50,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,13,81.25,15,93.75,81.78,66.75,77.38,93.75,89.25,83.62,79.94,-37.5,-5.72,-20.75,-10.12,6.25,1.75,2.37,-13.81,1,0,1,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,2,2,2,2,4,0.6,0.4,0.4,0.8,0.2,0.4,0.2,2.4,0.55,0.8,0.675,8.67,6.67,7.625,0.4,0,0.2,-1.6,0.2,4,0,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),23,,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,7,6,8,9,4,2,5,1,3,4,2,3,1 +960,R_7GKtwk4AIdHKva9,18 - 24,American,,American,Male,Somewhat disagree,Strongly agree,Strongly agree,Agree,Agree,4,5,1,3,2,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,3,2,1,4,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,1,5,2,3,4,Agree,Agree,Strongly Agree,Strongly Agree,Agree,5,4,1,2,3,Neither agree nor disagree,Somewhat disagree,Strongly Agree,Somewhat agree,Strongly Agree,3,5,1,4,2,8,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,5,2,3,4,7,Strongly Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,5,2,3,4,1,7,Agree,Somewhat agree,Somewhat disagree,Strongly Agree,Agree,1,3,5,2,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Agree,Agree,Strongly Agree,4,1,3,2,5,7,Strongly agree,Disagree,Agree,Neither agree nor disagree,Strongly agree,4,1,3,2,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,3,2,5,4,7,Agree,Somewhat agree,Strongly Agree,Agree,Strongly Agree,3,2,4,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,96,TRUE,100,FALSE,80,TRUE,85,TRUE,100,TRUE,100,TRUE,100,TRUE,70,TRUE,75,TRUE,100,FALSE,65,TRUE,100,TRUE,100,FALSE,65,TRUE,88,TRUE,100,TRUE,90,TRUE,100,FALSE,56,TRUE,63,FALSE,75,TRUE,100,FALSE,100,TRUE,70,TRUE,83,TRUE,76,FALSE,65,TRUE,100,TRUE,85,FALSE,100,FALSE,68,TRUE,80,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,3,3,2,2,2,-1,2,-1,2,3,1,2,-1,2,2,2,3,3,2,0,-1,3,1,3,8,1,1,-1,1,-1,7,3,2,1,2,1,7,2,1,-1,3,2,5,1,3,2,2,3,7,3,-2,2,0,3,2,3,3,3,1,3,7,2,1,3,2,3,6,FALSE,1,96,TRUE,1,100,FALSE,1,80,TRUE,0,85,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,70,TRUE,1,75,TRUE,1,100,FALSE,1,65,TRUE,0,100,TRUE,1,100,FALSE,1,65,TRUE,1,88,TRUE,1,100,TRUE,0,90,TRUE,0,100,FALSE,1,56,TRUE,0,63,FALSE,0,75,TRUE,1,100,FALSE,1,100,TRUE,1,70,TRUE,0,83,TRUE,1,76,FALSE,1,65,TRUE,0,100,TRUE,0,85,FALSE,0,100,FALSE,0,68,TRUE,1,80,0.09,0.0576,0,0,0.04,1,0.09,0,0.3969,0,1,0,0.0625,0.1225,0,0,0,0.7225,1,0.6889,0.5625,0.0144,0.1936,0.1225,0.81,0.1225,0.4624,0.0016,0.04,1,0.7225,1,0.363403571,0.245314286,0.481492857,18,56.25,20,62.5,6,75,4,50,6,75,4,50,13,81.25,7,43.75,85.47,75.25,91.25,90,85.38,87.62,83.31,-6.25,22.97,0.25,41.25,15,35.38,6.37,39.56,1,4,0,1,1,1,2,3,2,3,0,1,1,3,1,0,1,4,0,0,2,0,1,0,1,1,1,0,1,1,0,2,1,2,1,0,1,0,1,1,1.4,2.2,1.2,1,0.8,0.8,1.2,0.6,1.45,0.85,1.15,7.33,5.33,6.125,0.6,1.4,0,0.4,0.666666667,1,5,0,-1,2,1,1,0,-2,2,2,-2,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,"I really enjoyed this survey, it was very fun! ",0.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,3,8,2,5,7,6,4,1,9,4,2,3,1 +961,R_7BDrO6b7AbW3qiB,18 - 24,American,,American,Male,Somewhat agree,Agree,Agree,Disagree,Somewhat disagree,1,4,3,2,5,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,Strongly agree,5,1,3,2,4,Disagree,Strongly Disagree,Agree,Somewhat Agree,Agree,2,4,5,3,1,Somewhat agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Somewhat agree,Strongly Agree,Disagree,Agree,4,3,5,1,2,7,Somewhat agree,Disagree,Strongly disagree,Somewhat disagree,Disagree,4,3,5,2,1,6,Strongly Disagree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,4,1,5,2,3,4,Neither agree nor disagree,Disagree,Somewhat disagree,Somewhat agree,Strongly disagree,3,1,5,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,5,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,4,3,1,5,5,Strongly Disagree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Agree,2,1,4,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,5,4,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,FALSE,53,FALSE,65,TRUE,50,FALSE,73,TRUE,50,TRUE,88,TRUE,59,TRUE,70,TRUE,54,TRUE,90,FALSE,55,FALSE,56,TRUE,70,TRUE,97,FALSE,95,TRUE,71,TRUE,50,FALSE,91,TRUE,83,TRUE,76,FALSE,50,TRUE,80,FALSE,57,FALSE,66,TRUE,66,FALSE,67,TRUE,96,FALSE,55,TRUE,98,FALSE,65,TRUE,99,16,1,2,2,-2,-1,1,1,-1,2,3,-2,-3,2,1,2,1,-1,-1,0,0,2,1,3,-2,2,6,1,-2,-3,-1,-2,7,-3,1,1,2,1,6,0,-2,-1,1,-3,4,1,2,1,0,0,5,1,2,1,0,2,5,-3,-3,3,0,2,5,0,0,0,0,2,5,TRUE,0,99,FALSE,0,65,TRUE,0,98,FALSE,1,55,TRUE,1,96,FALSE,1,67,TRUE,1,66,FALSE,0,66,FALSE,0,57,TRUE,1,80,FALSE,1,50,TRUE,0,76,TRUE,1,83,FALSE,1,91,TRUE,1,50,TRUE,1,71,FALSE,1,95,TRUE,0,97,TRUE,0,70,FALSE,1,56,FALSE,0,55,TRUE,1,90,TRUE,0,54,TRUE,1,70,TRUE,0,59,TRUE,1,88,TRUE,0,50,FALSE,1,73,TRUE,0,50,FALSE,0,65,FALSE,0,53,TRUE,1,90,0.4356,0.0144,0.0841,0.1156,0.01,0.1089,0.09,0.04,0.1936,0.01,0.4225,0.0289,0.3249,0.25,0.0016,0.4225,0.2916,0.2025,0.0729,0.3481,0.3025,0.25,0.49,0.0081,0.0025,0.25,0.2809,0.9801,0.9604,0.9409,0.25,0.5776,0.289678571,0.171214286,0.408142857,16,50,17,53.13,3,37.5,5,62.5,5,62.5,4,50,10,62.5,7,43.75,71.41,56.25,73.75,83.75,71.88,71.56,71.25,-3.13,18.28,18.75,11.25,21.25,21.88,9.06,27.5,1,1,1,0,3,0,3,2,3,5,1,4,1,1,1,1,1,0,1,3,0,0,1,2,1,0,1,2,2,1,1,0,1,1,0,1,1,1,0,2,1.2,2.6,1.6,1.2,0.8,1.2,0.6,1,1.65,0.9,1.275,6.33,5,5.375,0.4,1.4,1,0.2,0.933333333,1,2,1,-1,1.33,2,0,0,-2,2,1,-1,0,0,-1,1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),18,I enjoyed this study I feel it is important to bring up the topic of self awareness. in this time it feels as if humanity is fading away into a world of delusions.,0.375,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,4,2,6,5,7,3,8,1,9,4,2,3,1 +962,R_6H2c8x72JVggldp,18 - 24,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,2,5,1,Somewhat agree,Neither agree nor disagree,Agree,Agree,Strongly agree,3,5,4,1,2,Agree,Disagree,Strongly Agree,Agree,Strongly Agree,4,1,3,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,2,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,5,3,3,Strongly agree,Disagree,Somewhat agree,Disagree,Strongly agree,3,1,5,2,4,2,Strongly Agree,Somewhat Disagree,Somewhat Agree,Strongly Agree,Strongly Agree,1,4,5,3,2,7,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,5,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,2,5,3,1,4,2,Agree,Strongly Disagree,Strongly agree,Agree,Strongly agree,3,5,2,4,1,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,2,3,1,5,4,FALSE,65,TRUE,50,TRUE,95,FALSE,50,TRUE,75,FALSE,65,TRUE,85,FALSE,50,TRUE,60,TRUE,95,FALSE,50,TRUE,98,TRUE,80,FALSE,63,TRUE,61,TRUE,80,TRUE,50,TRUE,90,TRUE,50,FALSE,50,TRUE,50,TRUE,98,FALSE,100,TRUE,100,FALSE,100,TRUE,95,FALSE,50,TRUE,50,TRUE,100,TRUE,80,TRUE,50,TRUE,80,19,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,1,0,2,2,3,2,-2,3,2,3,1,0,1,1,0,3,3,3,3,3,0,3,-2,1,-2,3,3,3,-1,1,3,3,2,0,2,2,0,0,7,3,3,3,3,3,0,3,-2,3,-2,3,5,2,-3,3,2,3,2,3,3,3,3,-2,8,FALSE,1,65,TRUE,1,50,TRUE,0,95,FALSE,1,50,TRUE,1,75,FALSE,1,65,TRUE,1,85,FALSE,0,50,TRUE,1,60,TRUE,1,95,FALSE,1,50,TRUE,0,98,TRUE,1,80,FALSE,1,63,TRUE,1,61,TRUE,1,80,TRUE,0,50,TRUE,0,90,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,95,FALSE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,80,TRUE,1,50,TRUE,1,80,0.25,0.0025,0.04,0.0225,0.04,0.1225,0,0.0025,0.25,0.0004,0.04,0.04,0.16,0.25,0.0625,0.25,0,0.25,0.25,0,0.25,0.1521,0.25,0.1369,0.25,0.25,0.25,0.1225,0.9025,0.81,1,0.9604,0.251867857,0.10485,0.398885714,19,59.38,24,75,7,87.5,6,75,7,87.5,4,50,15,93.75,9,56.25,72.34,52.62,75,86.38,75.38,74.31,70.38,-15.62,-2.66,-34.88,0,-1.12,25.38,-19.44,14.13,0,0,0,0,0,2,2,1,4,0,1,1,2,1,0,1,2,1,1,0,0,0,0,0,0,2,2,1,4,0,0,1,0,0,0,2,3,2,2,2,0,1.8,1,1,0,1.8,0.2,2.2,0.95,1.05,1,1.67,2.33,3.375,0,0,0.8,-1.2,0.266666667,0,-2,0,-1,-0.66,0,2,1,-2,2,1,-1,-1,1,-2,2,0,10 cents,5 minutes,47 days,Female,High School (or equivalent),20,I liked the survey. It was very enjoyable.,0.875,0,1,1,1,0,0,0.67,0.33,02PsVLPf,02COC,01PAST,02DGEN,01DIR,6,8,2,3,7,4,9,1,5,3,2,4,1 +963,R_7VJC3dAZp5t5i8H,18 - 24,American,,American,Male,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,Neither Agree nor Disagree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,5,2,4,1,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,4,2,1,3,5,Disagree,Somewhat agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,4,2,1,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,3,2,4,5,1,4,Somewhat agree,Agree,Agree,Somewhat agree,Strongly disagree,5,2,3,4,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,4,3,5,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,3,2,5,1,5,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,2,3,5,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,97,FALSE,56,FALSE,69,FALSE,77,FALSE,85,FALSE,71,TRUE,81,FALSE,58,FALSE,61,TRUE,68,TRUE,73,TRUE,75,FALSE,61,FALSE,55,FALSE,55,TRUE,57,TRUE,100,TRUE,66,FALSE,54,TRUE,61,TRUE,53,FALSE,53,FALSE,55,TRUE,63,TRUE,68,TRUE,72,FALSE,60,FALSE,53,FALSE,54,TRUE,62,FALSE,57,TRUE,63,11,0,3,0,0,1,-2,0,0,0,0,0,-2,1,0,2,-2,0,-3,1,-3,-2,1,3,-1,0,5,0,0,0,0,0,5,0,0,-1,-1,-1,4,1,2,2,1,-3,9,0,3,1,1,1,5,-2,0,1,0,0,4,0,0,1,0,2,5,-1,0,-1,0,-3,5,TRUE,0,63,FALSE,0,57,TRUE,0,62,FALSE,1,54,FALSE,0,53,FALSE,1,60,TRUE,1,72,TRUE,1,68,TRUE,1,63,FALSE,0,55,FALSE,1,53,TRUE,0,53,TRUE,1,61,FALSE,1,54,TRUE,1,66,TRUE,1,100,TRUE,0,57,FALSE,1,55,FALSE,1,55,FALSE,1,61,TRUE,1,75,TRUE,1,73,TRUE,0,68,FALSE,0,61,FALSE,1,58,TRUE,1,81,FALSE,1,71,FALSE,1,85,FALSE,1,77,FALSE,0,69,FALSE,0,56,TRUE,1,97,0.1024,0.0361,0,0.0784,0.0009,0.16,0.3721,0.3025,0.1521,0.0729,0.4761,0.1521,0.1369,0.2209,0.2809,0.3249,0.4624,0.2116,0.0225,0.1764,0.0625,0.1156,0.2025,0.2116,0.3249,0.0841,0.3136,0.3969,0.3844,0.2025,0.0529,0.2809,0.219914286,0.237592857,0.202235714,11,34.38,21,65.63,6,75,5,62.5,6,75,4,50,10,62.5,11,68.75,65.41,59.38,68.5,63.88,69.88,69.19,61.62,-31.25,-0.22,-15.62,6,-11.12,19.88,6.69,-7.13,2,2,3,1,1,2,0,0,0,0,0,2,2,1,3,3,2,5,0,0,0,0,1,1,0,0,0,1,0,0,0,2,0,0,0,1,0,2,1,0,1.8,0.4,1.6,2,0.4,0.2,0.4,0.8,1.45,0.45,0.95,4.67,4.67,5.25,1.4,0.2,1.2,1.2,0.933333333,0,1,-1,4,0,2,1,1,-2,2,1,-1,1,-1,0,0,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,19,nothing in particular,0.5,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,3,8,2,7,9,5,6,1,4,4,2,3,1 +964,R_7r6L1MPWM8BL8Wv,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Disagree,3,4,5,1,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,5,3,2,1,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,3,2,1,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,1,3,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,5,3,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,3,2,7,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,3,1,5,4,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,TRUE,90,TRUE,94,TRUE,80,TRUE,87,TRUE,83,TRUE,87,TRUE,79,TRUE,93,TRUE,83,TRUE,91,TRUE,81,TRUE,84,TRUE,88,TRUE,89,TRUE,86,TRUE,75,TRUE,79,TRUE,84,TRUE,83,TRUE,83,TRUE,86,TRUE,83,TRUE,79,TRUE,90,TRUE,75,TRUE,88,TRUE,76,TRUE,75,TRUE,75,TRUE,80,TRUE,81,16,2,2,2,1,-2,1,-1,0,-1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,7,1,1,1,0,1,7,1,1,1,0,1,8,1,1,1,1,2,7,0,0,0,0,0,5,0,0,0,0,0,7,1,0,0,1,1,7,1,1,1,1,1,6,TRUE,0,81,TRUE,1,80,TRUE,0,75,TRUE,0,75,TRUE,1,76,TRUE,0,88,TRUE,1,75,TRUE,1,90,TRUE,1,79,TRUE,1,83,TRUE,0,86,TRUE,0,83,TRUE,1,83,TRUE,0,84,TRUE,1,79,TRUE,1,75,TRUE,0,86,TRUE,0,89,TRUE,0,88,TRUE,0,84,TRUE,1,81,TRUE,1,91,TRUE,0,83,TRUE,1,93,TRUE,0,79,TRUE,1,87,TRUE,0,83,TRUE,0,87,TRUE,0,80,TRUE,1,94,TRUE,1,90,TRUE,1,92,0.01,0.0169,0.0625,0.0625,0.0064,0.7744,0.0049,0.0289,0.7056,0.0081,0.0036,0.0289,0.0441,0.7396,0.0576,0.04,0.6889,0.5625,0.7569,0.6241,0.0361,0.0441,0.7744,0.7056,0.7396,0.6889,0.01,0.6561,0.5625,0.7921,0.64,0.6889,0.4076,0.263821429,0.551378571,16,50,16,50,4,50,4,50,4,50,4,50,16,100,0,0,83.72,82.5,83.62,83.62,85.12,84.25,83.19,0,33.72,32.5,33.62,33.62,35.12,-15.75,83.19,1,2,1,1,3,0,2,1,1,0,0,0,0,1,0,0,0,0,0,1,2,2,2,1,2,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,1.6,0.8,0.2,0.2,1.8,0.8,0.4,0,0.7,0.75,0.725,7.33,6.33,6.75,-0.2,0,-0.2,0.2,-0.133333333,2,0,1,1,1,0,0,1,0,0,0,0,1,-1,0,0,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,37,,0.125,0,1,0,1,0,0,0.33,0.33,01PfPsVL,02COC,02FUT,02DGEN,02REV,4,9,3,5,7,6,2,1,8,2,3,4,1 +965,R_5l8R2oWrQLP0fHr,39 - 45,,Canadian,Canadian,Male,Somewhat agree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,1,3,4,2,5,Strongly disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,4,2,1,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,4,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Somewhat agree,Strongly disagree,3,2,5,4,1,1,Strongly disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat disagree,3,4,1,5,2,6,Somewhat Agree,Disagree,Somewhat Agree,Agree,Strongly Agree,5,2,4,1,3,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,4,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Neither agree nor disagree,Agree,Strongly Agree,Somewhat disagree,1,3,5,2,4,1,Strongly disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,4,1,5,2,3,Strongly Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,1,5,3,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,3,2,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,81,TRUE,100,TRUE,100,FALSE,65,TRUE,53,TRUE,100,FALSE,100,TRUE,76,FALSE,100,TRUE,85,TRUE,100,FALSE,78,FALSE,65,TRUE,90,FALSE,63,TRUE,100,TRUE,85,FALSE,100,TRUE,73,FALSE,69,FALSE,59,TRUE,100,TRUE,100,TRUE,87,TRUE,100,FALSE,100,TRUE,100,FALSE,73,FALSE,69,TRUE,63,FALSE,78,27,1,0,2,2,-1,-3,-1,2,0,0,-2,-3,3,1,3,-3,-3,-3,-3,-3,0,0,3,1,-3,1,-3,-3,1,-2,-1,6,1,-2,1,2,3,6,-3,-3,-3,-3,-3,5,1,0,2,3,-1,1,-3,-1,3,-1,1,3,-3,-3,3,0,3,2,-3,-3,-3,-3,-3,2,FALSE,1,78,TRUE,1,63,FALSE,1,69,FALSE,1,73,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,87,TRUE,1,100,TRUE,1,100,FALSE,1,59,FALSE,1,69,TRUE,1,73,FALSE,1,100,TRUE,1,85,TRUE,1,100,FALSE,1,63,TRUE,0,90,FALSE,1,65,FALSE,1,78,TRUE,1,100,TRUE,1,85,FALSE,1,100,TRUE,1,76,FALSE,1,100,TRUE,1,100,TRUE,0,53,FALSE,1,65,TRUE,0,100,TRUE,1,100,TRUE,1,81,TRUE,1,100,0.0169,0,0,0,0,0,0.0576,0,0.0484,0.0225,0,0.0729,0,0.1681,0,0.1369,0,0.0729,0.1225,0,0,0.0225,0.1225,0,0.1369,0.2809,0.0361,0.0484,0.0961,0.81,1,0.0961,0.119689286,0.041378571,0.198,27,84.38,29,90.63,7,87.5,7,87.5,7,87.5,8,100,16,100,13,81.25,84.75,72.38,92,94.12,80.5,90.62,78.88,-6.25,-5.88,-15.12,4.5,6.62,-19.5,-9.38,-2.37,1,0,1,1,2,0,2,1,2,1,3,1,2,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,1,1.2,1.4,0,0.2,0.6,0.4,0,0.9,0.3,0.6,4.33,2,3.25,0.8,0.6,1,0,0.8,0,3,4,3,2.33,2,2,2,-2,2,-2,2,-2,2,-2,2,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,39,,1.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,02FUT,01ITEM,02REV,9,3,5,4,6,7,8,1,2,3,2,4,1 +966,R_53dWX4p2nUU2svX,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,4,3,5,2,1,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat disagree,4,2,3,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,5,2,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,3,4,1,5,2,5,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,1,2,4,3,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,2,4,3,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,3,5,1,4,5,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,3,1,2,5,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,2,3,4,5,5,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,3,2,5,4,1,FALSE,50,FALSE,65,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,72,TRUE,69,FALSE,50,TRUE,75,FALSE,71,TRUE,75,TRUE,76,FALSE,50,FALSE,53,TRUE,72,FALSE,57,TRUE,67,FALSE,50,TRUE,70,FALSE,65,FALSE,61,FALSE,62,TRUE,74,TRUE,69,TRUE,67,FALSE,63,FALSE,66,FALSE,62,TRUE,65,FALSE,56,TRUE,80,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,0,2,-1,-2,0,-2,-1,1,1,1,-1,1,1,1,1,1,1,1,2,2,0,2,3,-2,-2,1,-2,0,5,1,1,1,-2,1,3,1,1,1,1,1,3,1,1,2,0,2,5,-1,-1,0,1,0,5,1,1,1,-1,1,4,1,2,1,1,2,5,FALSE,1,50,FALSE,0,65,FALSE,1,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,72,TRUE,1,69,FALSE,0,50,TRUE,1,75,FALSE,1,71,TRUE,0,75,TRUE,1,76,FALSE,1,50,FALSE,0,53,TRUE,1,72,FALSE,1,57,TRUE,0,67,FALSE,1,50,TRUE,0,70,FALSE,0,65,FALSE,0,61,FALSE,1,62,TRUE,1,74,TRUE,0,69,TRUE,1,67,FALSE,1,63,FALSE,1,66,FALSE,1,62,TRUE,1,65,FALSE,0,56,TRUE,1,80,0.0961,0.1089,0.0784,0.0784,0.04,0.25,0.0676,0.0625,0.49,0.3721,0.1225,0.0576,0.25,0.0841,0.25,0.4225,0.1444,0.25,0.1156,0.4761,0.4225,0.2809,0.25,0.25,0.1849,0.1369,0.3136,0.25,0.25,0.4489,0.1444,0.5625,0.2482,0.204521429,0.291878571,16,50,21,65.63,4,50,6,75,5,62.5,6,75,9,56.25,12,75,62.88,57.25,62.75,63.88,67.62,65.62,60.12,-15.63,-2.75,7.25,-12.25,1.38,-7.38,9.37,-14.88,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,3,1,0,0,0,0,0,0,1,0,0,1,0,0.6,0.2,0,0.2,1,0,0.4,0.2,0.4,0.3,3.67,4.67,4.125,-0.2,-0.4,0.2,-0.4,-0.133333333,-2,0,-1,-2,-1,0,0,0,1,-1,0,0,0,0,0,0,0,10 cents,100 minutes,36 days,Male,College Diploma/Certificate,34,nothing,-0.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,4,6,7,9,5,8,2,1,3,2,3,4,1 +967,R_7rfzIX6Dhq7YeKq,32 - 38,,Canadian,Canadian,Male,Agree,Strongly agree,Agree,Agree,Strongly agree,3,1,2,5,4,Agree,Disagree,Agree,Disagree,Strongly agree,3,1,4,5,2,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,2,4,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Somewhat agree,Agree,Agree,Somewhat agree,3,1,5,2,4,7,Agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,5,1,4,3,2,7,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,Strongly Agree,1,4,5,2,3,7,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,Disagree,2,1,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Strongly Agree,Agree,Agree,Strongly Agree,1,2,3,5,4,9,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,5,4,1,4,Agree,Strongly agree,Agree,Agree,Strongly agree,3,1,4,5,2,4,Strongly Agree,Agree,Agree,Agree,Somewhat disagree,1,2,3,5,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,100,FALSE,85,TRUE,60,FALSE,61,TRUE,79,FALSE,56,FALSE,80,FALSE,100,FALSE,69,FALSE,90,TRUE,74,FALSE,62,FALSE,80,FALSE,67,FALSE,100,TRUE,100,TRUE,85,TRUE,89,FALSE,74,FALSE,75,TRUE,90,FALSE,69,TRUE,84,TRUE,86,TRUE,100,TRUE,85,TRUE,75,FALSE,59,TRUE,67,TRUE,100,TRUE,69,FALSE,56,16,2,3,2,2,3,2,-2,2,-2,3,2,3,2,2,3,1,1,1,1,-2,3,1,2,2,1,8,2,0,1,2,1,7,3,1,1,2,3,7,-1,-1,0,-3,-2,7,1,3,2,2,3,4,1,-3,3,-3,3,9,2,3,2,2,3,4,3,2,2,2,-1,4,FALSE,1,56,TRUE,1,69,TRUE,0,100,TRUE,0,67,FALSE,0,59,TRUE,0,75,TRUE,1,85,TRUE,1,100,TRUE,1,86,TRUE,1,84,FALSE,1,69,TRUE,0,90,FALSE,0,75,FALSE,1,74,TRUE,1,89,TRUE,1,85,TRUE,0,100,FALSE,1,100,FALSE,1,67,FALSE,1,80,FALSE,0,62,TRUE,1,74,FALSE,1,90,FALSE,0,69,FALSE,1,100,FALSE,0,80,FALSE,1,56,TRUE,0,79,FALSE,1,61,TRUE,1,60,FALSE,0,85,FALSE,0,100,0,0.64,0.0225,0.0225,1,0.5625,0.4761,0.0256,0.04,0.0676,0.16,0.5625,0.0196,0.0961,0.3481,0.0961,0.01,0.4489,0.6241,0,0.3844,0.0121,0.1089,0.0676,1,0.1936,0.7225,0.1936,1,0,0.1521,0.81,0.327928571,0.279507143,0.37635,16,50,19,59.38,6,75,2,25,7,87.5,4,50,9,56.25,10,62.5,78.94,73.5,77.75,81.62,82.88,78.88,79,-9.38,19.56,-1.5,52.75,-5.88,32.88,22.63,16.5,1,2,0,0,2,0,2,1,4,2,1,2,1,0,0,2,2,1,4,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,2,1,1,1,1,1,1.8,0.8,1.8,0.2,0.8,0,1.2,1.35,0.55,0.95,7.33,5.67,6.25,0.8,1,0.8,0.6,0.866666667,4,-2,3,3,1.66,0,2,2,-2,2,-2,2,1,-1,-1,1,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),34,none,1.25,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,8,9,6,5,4,7,3,1,2,3,4,2,1 +968,R_1njzHccnsMcDWUe,32 - 38,American,,American,Male,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Agree,4,2,5,1,3,Strongly disagree,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,3,4,1,2,5,Strongly Agree,Agree,Agree,Agree,Agree,4,1,2,5,3,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,4,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Somewhat agree,Strongly Agree,Agree,Agree,1,5,3,2,4,8,Agree,Agree,Agree,Agree,Agree,4,2,1,3,5,9,Agree,Somewhat Disagree,Somewhat Disagree,Agree,Agree,5,2,1,3,4,10,Agree,Agree,Somewhat disagree,Agree,Somewhat agree,3,1,4,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat disagree,4,2,3,1,5,8,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,3,4,2,1,5,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,2,4,10,Strongly disagree,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,5,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,59,TRUE,66,FALSE,50,FALSE,50,TRUE,55,TRUE,55,TRUE,52,TRUE,52,FALSE,100,TRUE,77,FALSE,100,TRUE,55,FALSE,62,TRUE,53,TRUE,100,TRUE,100,FALSE,52,FALSE,54,TRUE,100,FALSE,53,FALSE,51,TRUE,79,FALSE,55,TRUE,64,TRUE,83,FALSE,100,FALSE,52,FALSE,54,FALSE,84,TRUE,55,TRUE,53,8,-1,1,3,-2,2,-3,-1,1,3,-2,3,2,2,2,2,-3,-2,-3,-3,-3,2,1,3,2,2,8,2,2,2,2,2,8,2,-1,-1,2,2,9,2,2,-1,2,1,10,3,2,3,2,-1,9,-3,-3,3,3,-3,8,3,3,3,3,3,8,-3,-2,-3,-3,-3,10,TRUE,0,53,TRUE,1,55,FALSE,1,84,FALSE,1,54,FALSE,0,52,FALSE,1,100,TRUE,1,83,TRUE,1,64,FALSE,0,55,TRUE,1,79,FALSE,1,51,FALSE,1,53,TRUE,1,100,FALSE,1,54,FALSE,0,52,TRUE,1,100,TRUE,0,100,TRUE,0,53,FALSE,1,62,TRUE,0,55,FALSE,0,100,TRUE,1,77,FALSE,1,100,TRUE,1,52,TRUE,0,52,TRUE,1,55,TRUE,0,55,FALSE,1,50,FALSE,1,50,TRUE,1,66,FALSE,0,59,TRUE,1,100,0.1296,0.2025,0,0.0289,0,0,0.2304,0.0441,0.3025,0.0529,0.1156,0,0.3025,0.2401,0.2704,0.2025,0,0.2116,0.25,0.2704,1,0.2704,0.1444,0.2116,1,0.3025,0.3481,0.2809,0.0256,0.2809,0.25,0.2209,0.243867857,0.1409,0.346835714,8,25,21,65.63,4,50,5,62.5,5,62.5,7,87.5,11,68.75,10,62.5,67.97,55.38,87.75,63.25,65.5,71.81,64.12,-40.63,2.34,5.38,25.25,0.75,-22,3.06,1.62,3,0,0,4,0,5,3,1,1,4,1,3,3,0,0,5,4,2,5,4,4,1,0,4,3,0,2,2,0,1,0,1,1,1,1,0,0,0,0,0,1.4,2.8,1.4,4,2.4,1,0.8,0,2.4,1.05,1.725,8.33,8.33,8.75,-1,1.8,0.6,4,0.466666667,-1,0,1,0,0,1,2,2,-2,2,2,-2,-1,1,-2,2,1,10 cents,100 minutes,15 days,Male,University - Undergraduate,38,None,1.125,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,8,2,6,7,9,3,4,1,5,3,4,2,1 +969,R_7BrnO4eAWl04uwP,60 - 66,American,,American,Male,Disagree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,2,1,4,5,3,Disagree,Strongly disagree,Disagree,Disagree,Disagree,5,1,4,3,2,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,1,3,2,4,Disagree,Disagree,Disagree,Somewhat disagree,Disagree,1,2,3,5,4,Neither agree nor disagree,Strongly Agree,Agree,Agree,Neither agree nor disagree,2,1,3,4,5,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,5,1,7,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,2,1,3,4,5,6,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,Disagree,1,3,5,2,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,1,2,4,5,3,1,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Disagree,5,3,4,2,1,3,Somewhat Agree,Strongly Agree,Somewhat Agree,Disagree,Somewhat Agree,5,2,4,3,1,0,Strongly disagree,Strongly disagree,Disagree,Disagree,Disagree,3,5,2,4,1,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,75,FALSE,84,FALSE,100,FALSE,50,TRUE,100,FALSE,85,TRUE,95,TRUE,100,TRUE,71,TRUE,63,FALSE,50,TRUE,92,TRUE,89,TRUE,89,FALSE,50,TRUE,88,FALSE,50,FALSE,50,FALSE,50,FALSE,95,TRUE,51,TRUE,100,FALSE,100,TRUE,95,TRUE,91,FALSE,83,TRUE,90,FALSE,86,TRUE,58,TRUE,62,TRUE,100,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,3,3,-1,-2,-3,-2,-2,-2,1,2,1,-1,1,-2,-2,-2,-1,-2,0,3,2,2,0,4,1,1,0,0,0,7,-1,1,2,1,0,6,-1,-2,-1,-1,-2,5,-3,3,3,3,-1,1,-2,-2,0,-1,-2,3,1,3,1,-2,1,0,-3,-3,-2,-2,-2,0,FALSE,1,75,FALSE,0,84,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,85,TRUE,1,95,TRUE,1,100,TRUE,1,71,TRUE,1,63,FALSE,1,50,TRUE,0,92,TRUE,1,89,TRUE,0,89,FALSE,0,50,TRUE,1,88,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,95,TRUE,1,51,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,0,91,FALSE,0,83,TRUE,0,90,FALSE,1,86,TRUE,0,58,TRUE,1,62,TRUE,1,100,TRUE,1,100,0,0.6889,0.0144,0.0025,0,0.0225,0.0025,0.1369,0.0025,0,0.1444,0.0121,0.0841,0.25,0,0.7056,0,0.25,0.0196,0.8281,0.2401,0.25,0.25,0.7921,0.25,0.81,0,0.0625,0,0.25,0.3364,0.8464,0.233778571,0.115042857,0.352514286,16,50,24,75,5,62.5,7,87.5,5,62.5,7,87.5,13,81.25,11,68.75,79.44,68.12,79.12,80.75,89.75,83.19,75.69,-25,4.44,5.62,-8.38,18.25,2.25,1.94,6.94,2,0,1,1,1,3,4,2,2,2,2,1,1,2,1,1,0,1,0,0,1,0,0,0,0,0,1,2,1,0,0,1,0,1,0,1,1,0,1,0,1,2.6,1.4,0.4,0.2,0.8,0.4,0.6,1.35,0.5,0.925,5.67,1.33,3.25,0.8,1.8,1,-0.2,1.2,3,4,6,5,4.34,0,1,1,-1,1,0,0,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,It made me realize that my past beliefs and feelings are different from my current and future beliefs and feelings.,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,7,2,6,9,8,3,4,1,5,2,4,3,1 +970,R_1soecjnBRZ7oNeX,32 - 38,American,,American,Male,Strongly agree,Agree,Agree,Somewhat disagree,Strongly agree,3,5,4,1,2,Somewhat disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly agree,1,2,4,3,5,Somewhat Agree,Disagree,Somewhat Agree,Agree,Strongly Agree,3,1,5,2,4,Somewhat agree,Somewhat agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Disagree,Somewhat disagree,Disagree,Disagree,Disagree,5,1,4,2,3,4,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,2,5,6,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,1,4,2,5,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Somewhat agree,Disagree,Strongly Agree,2,3,5,1,4,2,Disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,1,4,3,5,2,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,3,4,1,5,0,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,1,2,4,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,FALSE,54,TRUE,100,FALSE,100,FALSE,50,TRUE,86,FALSE,50,TRUE,97,TRUE,69,TRUE,100,FALSE,56,FALSE,100,FALSE,67,TRUE,100,TRUE,61,TRUE,100,TRUE,59,FALSE,100,FALSE,100,TRUE,88,TRUE,93,TRUE,100,TRUE,100,TRUE,90,TRUE,93,FALSE,100,TRUE,85,FALSE,90,TRUE,69,FALSE,73,TRUE,100,22,3,2,2,-1,3,-1,3,1,0,3,1,-2,1,2,3,1,1,3,3,0,-2,-1,-2,-2,-2,9,-1,2,0,0,0,4,3,0,3,0,1,6,3,3,3,-1,0,1,2,2,1,-2,3,5,-2,-2,0,0,3,2,1,-1,1,0,2,3,3,2,3,3,0,0,TRUE,0,100,FALSE,0,73,TRUE,0,69,FALSE,1,90,TRUE,1,85,FALSE,1,100,TRUE,1,93,TRUE,1,90,TRUE,1,100,TRUE,1,100,TRUE,0,93,TRUE,0,88,FALSE,0,100,FALSE,1,100,TRUE,1,59,TRUE,1,100,TRUE,0,61,TRUE,0,100,FALSE,1,67,FALSE,1,100,FALSE,0,56,TRUE,1,100,TRUE,0,69,TRUE,1,97,FALSE,1,50,TRUE,1,86,FALSE,1,50,FALSE,1,100,TRUE,0,100,FALSE,0,54,FALSE,0,51,TRUE,1,100,0.01,0.0196,0,0.0049,0,0,0.0009,0,0,0,0.2916,1,0,0.8649,0.0225,0.5329,0.4761,0.01,0,0.25,0.3136,0.1681,0.1089,0,0.3721,0.25,0.2601,1,0.4761,1,1,0.7744,0.327578571,0.228492857,0.426664286,22,68.75,19,59.38,5,62.5,3,37.5,6,75,5,62.5,11,68.75,8,50,83.78,72.88,83.88,91.12,87.25,84,83.56,9.37,24.4,10.38,46.38,16.12,24.75,15.25,33.56,5,3,4,1,5,0,1,1,0,3,2,2,2,2,2,2,2,0,4,0,1,0,1,1,0,1,5,1,0,0,0,1,0,2,1,2,1,0,0,0,3.6,1,2,1.6,0.6,1.4,0.8,0.6,2.05,0.85,1.45,6.33,3.33,3.75,3,-0.4,1.2,1,1.266666667,4,2,3,1,3,0,1,0,-1,1,-1,1,1,-1,-2,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,33,,0.75,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,9,6,3,8,7,2,5,1,4,4,2,3,1 +971,R_5kum2RlXl1Pxv4g,32 - 38,American,,American,Male,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,3,4,5,2,1,Disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat disagree,1,5,4,3,2,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,1,5,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Strongly disagree,5,2,4,1,3,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Strongly Agree,3,2,5,1,4,8,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Agree,4,3,1,5,2,9,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,Agree,3,5,1,4,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,2,5,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Agree,Somewhat agree,Strongly Agree,4,2,5,3,1,1,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,1,4,2,5,3,10,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,5,1,4,2,3,10,Agree,Agree,Somewhat agree,Somewhat agree,Agree,5,2,3,1,4,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,59,FALSE,56,TRUE,92,FALSE,50,FALSE,61,FALSE,52,TRUE,90,TRUE,100,FALSE,52,TRUE,100,TRUE,91,TRUE,100,TRUE,100,TRUE,100,FALSE,68,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,84,TRUE,100,TRUE,85,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,64,TRUE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,2,1,3,-2,-3,3,-1,-1,3,3,1,1,3,1,1,1,2,-3,1,2,3,1,3,8,0,1,2,1,2,9,3,3,1,2,2,8,1,1,1,1,1,9,1,2,2,1,3,1,-2,-1,1,1,2,10,3,3,1,1,3,10,2,2,1,1,2,9,FALSE,1,59,FALSE,0,56,TRUE,0,92,FALSE,1,50,FALSE,0,61,FALSE,1,52,TRUE,1,90,TRUE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,91,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,0,68,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,TRUE,0,84,TRUE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,64,TRUE,1,100,0,0,0,0.01,0,0.2304,0,0,0.25,0,0,0,0.2704,0.8281,0.3721,0.3136,0.7056,0.25,1,0.7225,0,0.4624,1,1,1,0.25,0.4096,0.1681,0.8464,1,1,1,0.467114286,0.230014286,0.704214286,20,62.5,16,50,2,25,4,50,5,62.5,5,62.5,11,68.75,5,31.25,84.5,66.38,87.12,91.75,92.75,86.94,82.06,12.5,34.5,41.38,37.12,29.25,30.25,18.19,50.81,0,1,1,0,0,2,4,1,2,3,0,0,0,1,1,0,0,0,1,4,0,1,0,0,0,0,2,2,2,3,0,0,0,0,0,1,1,0,1,5,0.4,2.4,0.4,1,0.2,1.8,0,1.6,1.05,0.9,0.975,8.33,7,8,0.2,0.6,0.4,-0.6,0.4,7,-1,-2,0,1.33,0,0,1,-1,1,2,-2,2,-2,0,0,1,5 cents,5 minutes,36 days,Male,College Diploma/Certificate,33,There is none,-0.125,1,1,0,0,0,0,0.67,0,02PsVLPf,01EOHI,01PAST,01ITEM,01DIR,2,5,9,4,6,3,8,1,7,2,4,3,1 +972,R_7hQpBSC0FLY69a6,46 - 52,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,4,5,2,1,Disagree,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,3,5,2,4,1,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly Agree,3,2,1,5,4,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Disagree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,5,3,1,4,5,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,Agree,2,1,5,3,4,3,Disagree,Disagree,Agree,Disagree,Strongly Agree,2,1,5,3,4,8,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,3,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,4,3,2,1,5,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,1,4,3,2,5,7,Somewhat Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,1,3,4,2,5,8,Agree,Agree,Agree,Agree,Somewhat agree,4,2,3,1,5,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,80,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,98,TRUE,100,FALSE,100,TRUE,76,TRUE,100,FALSE,72,TRUE,100,TRUE,75,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,59,TRUE,95,FALSE,100,FALSE,97,TRUE,100,TRUE,92,FALSE,70,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,2,-2,2,0,3,1,-1,-1,2,-1,3,-2,-1,-1,-2,-2,3,3,3,2,3,2,0,2,-1,1,2,5,-2,-2,2,-2,3,3,-1,0,1,-1,0,8,3,3,3,2,2,3,-1,0,1,-2,2,5,-1,-1,3,-1,3,7,2,2,2,2,1,8,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,50,TRUE,0,98,TRUE,1,100,FALSE,1,100,TRUE,1,76,TRUE,1,100,FALSE,1,72,TRUE,0,100,TRUE,0,75,FALSE,1,100,FALSE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,59,TRUE,1,95,FALSE,1,100,FALSE,1,97,TRUE,0,100,TRUE,1,92,FALSE,0,70,TRUE,1,100,0,0.0025,0,0,0,0.04,0,1,0,0,0.0064,0,0,0.25,0,0,0,0.25,0.0009,0.3481,0.25,0.0576,0.5625,0,0.0784,0,0.49,0,1,1,1,0.9604,0.260510714,0.110457143,0.410564286,26,81.25,23,71.88,6,75,6,75,5,62.5,6,75,13,81.25,10,62.5,89.5,77.62,87.75,94.25,98.38,92.69,86.31,9.37,17.62,2.62,12.75,31.75,23.38,11.44,23.81,0,0,0,0,1,2,0,1,2,1,1,1,0,1,0,1,1,2,1,2,0,0,0,0,0,1,2,1,5,1,0,0,1,0,0,4,3,3,4,3,0.2,1.2,0.6,1.4,0,2,0.2,3.4,0.85,1.4,1.125,3.33,5,5.125,0.2,-0.8,0.4,-2,-0.066666667,-1,0,-4,0,-1.67,2,2,2,-2,2,1,-1,-2,2,-2,2,0,10 cents,5 minutes,15 days,Male,High School (or equivalent),46,no comment,1.375,0,1,0,1,0,0,0.33,0.33,04LPfPsV,01EOHI,02FUT,02DGEN,01DIR,2,7,4,6,8,9,5,1,3,2,3,4,1 +973,R_6zwj7FoNzv6n4el,60 - 66,American,,American,Male,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,3,2,1,5,4,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,2,4,1,3,5,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,1,3,2,5,Agree,Agree,Agree,Agree,Agree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Neither agree nor disagree,Strongly Agree,Agree,Somewhat agree,Strongly Agree,5,2,3,1,4,2,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Agree,4,5,2,3,1,2,Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,5,2,1,4,3,2,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Strongly Agree,Agree,Agree,Strongly Agree,4,1,3,5,2,2,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,2,1,3,5,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,3,5,4,1,2,2,Agree,Agree,Agree,Agree,Agree,2,5,4,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,TRUE,55,FALSE,50,TRUE,54,FALSE,95,FALSE,60,TRUE,75,FALSE,75,TRUE,60,FALSE,65,FALSE,71,TRUE,75,FALSE,100,FALSE,65,TRUE,100,FALSE,80,TRUE,100,TRUE,85,FALSE,70,TRUE,85,TRUE,100,FALSE,85,TRUE,100,TRUE,80,TRUE,80,TRUE,95,FALSE,85,TRUE,80,FALSE,80,TRUE,80,TRUE,100,TRUE,100,18,1,3,2,2,3,1,-1,2,-1,1,2,1,2,0,2,2,2,2,2,2,0,3,2,1,3,1,1,-1,2,-1,2,2,2,2,2,-1,3,2,2,2,2,2,2,2,1,3,2,2,3,1,1,-1,2,-1,1,2,2,1,2,-1,2,2,2,2,2,2,2,2,TRUE,0,100,TRUE,1,100,TRUE,0,80,FALSE,1,80,TRUE,1,80,FALSE,1,85,TRUE,1,95,TRUE,1,80,TRUE,1,80,TRUE,1,100,FALSE,1,85,TRUE,0,100,TRUE,1,85,FALSE,1,70,TRUE,1,85,TRUE,1,100,FALSE,1,80,TRUE,0,100,FALSE,1,65,FALSE,1,100,TRUE,1,75,FALSE,0,71,FALSE,1,65,TRUE,1,60,FALSE,1,75,TRUE,1,75,FALSE,1,60,FALSE,1,95,TRUE,0,54,FALSE,0,50,TRUE,1,55,TRUE,1,85,0.04,0.0625,0,0.0025,0.0225,0.0225,0.16,0,0,0.5041,0.25,0.0225,0.04,0.0225,0.04,0,0.1225,0.04,0.0025,0.0625,0.0625,0.0225,0.1225,0.09,0.04,0.16,0.2025,1,0.64,1,0.2916,1,0.212257143,0.089042857,0.335471429,18,56.25,25,78.13,8,100,7,87.5,5,62.5,5,62.5,14,87.5,11,68.75,80.31,76.25,76.12,85.75,83.12,79.75,80.88,-21.88,2.18,-23.75,-11.38,23.25,20.62,-7.75,12.13,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.4,0.2,0.6,0,0,0,0.2,0,0.3,0.05,0.175,1.67,1.67,1.75,0.4,0.2,0.4,0,0.333333333,0,0,0,0,0,1,1,1,-1,1,0,0,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,Fun although may have flailed on trivia,0.75,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,02DGEN,02REV,6,9,2,5,4,8,3,1,7,4,2,3,1 +974,R_7tYy85r3076itb3,39 - 45,American,,American,Male,Somewhat agree,Agree,Agree,Somewhat disagree,Agree,4,2,5,3,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,4,3,1,5,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,3,1,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,3,2,5,4,3,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,1,2,4,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,1,2,5,4,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,2,3,4,5,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,5,4,3,3,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,5,2,3,1,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,2,1,4,3,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,67,TRUE,74,TRUE,80,FALSE,62,TRUE,62,FALSE,72,TRUE,72,TRUE,72,FALSE,56,TRUE,88,FALSE,70,FALSE,60,TRUE,84,FALSE,68,FALSE,58,TRUE,85,FALSE,58,TRUE,66,TRUE,68,FALSE,80,TRUE,73,TRUE,75,FALSE,85,TRUE,58,FALSE,73,TRUE,78,FALSE,55,FALSE,63,TRUE,60,TRUE,65,FALSE,63,TRUE,72,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,-1,2,-1,0,1,0,1,1,1,2,2,2,-1,-1,-1,-1,-1,1,1,1,-1,-1,3,-2,1,1,1,0,3,0,1,1,-1,1,3,-1,-1,-1,-1,-1,2,1,1,1,0,1,3,0,-1,1,0,1,3,1,1,2,0,3,2,-1,-1,-1,-1,-1,4,TRUE,0,67,TRUE,1,74,TRUE,0,80,FALSE,1,62,TRUE,1,62,FALSE,1,72,TRUE,1,72,TRUE,1,72,FALSE,0,56,TRUE,1,88,FALSE,1,70,FALSE,1,60,TRUE,1,84,FALSE,1,68,FALSE,0,58,TRUE,1,85,FALSE,1,58,TRUE,0,66,TRUE,0,68,FALSE,1,80,TRUE,1,73,TRUE,1,75,FALSE,1,85,TRUE,1,58,FALSE,1,73,TRUE,1,78,FALSE,1,55,FALSE,1,63,TRUE,0,60,TRUE,1,65,FALSE,0,63,TRUE,1,72,0.0784,0.0484,0.0225,0.0784,0.0784,0.0784,0.1764,0.0144,0.04,0.0625,0.1225,0.0256,0.3136,0.09,0.1444,0.0676,0.0225,0.1444,0.1369,0.0729,0.0729,0.3364,0.4624,0.1024,0.1764,0.2025,0.3969,0.4489,0.64,0.4356,0.36,0.16,0.192317857,0.098621429,0.286014286,24,75,24,75,4,50,7,87.5,6,75,7,87.5,13,81.25,11,68.75,69.44,63.25,70.75,73.38,70.38,70.94,67.94,0,-5.56,13.25,-16.75,-1.62,-17.12,-10.31,-0.81,0,1,1,0,3,1,1,0,1,1,1,0,1,3,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,2,1,0,0,0,0,0,1,0.8,1.2,0,0.8,0.4,0.6,0,0.75,0.45,0.6,3,2.67,2.875,0.2,0.4,0.6,0,0.4,0,0,1,-2,0.33,1,1,1,-1,1,0,0,1,-1,1,-1,-1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,44,"This was an unusual survey to take about the perspectives you have in life, but it was interesting to take.",0.125,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,5,7,4,9,3,2,8,1,6,3,4,2,1 +975,R_5qIt91B3oLYyRHh,39 - 45,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,3,5,4,1,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Agree,2,3,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,4,5,3,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,1,2,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,2,1,5,Agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,1,4,2,3,5,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,1,2,3,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,2,3,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,1,2,0,Agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,1,2,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,3,2,7,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,5,3,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,96,TRUE,90,FALSE,90,FALSE,95,FALSE,96,TRUE,100,FALSE,95,TRUE,100,FALSE,100,TRUE,95,TRUE,100,FALSE,100,FALSE,100,TRUE,91,FALSE,95,TRUE,100,TRUE,98,FALSE,100,FALSE,95,FALSE,90,FALSE,100,TRUE,100,TRUE,95,TRUE,100,TRUE,95,FALSE,100,TRUE,100,TRUE,95,FALSE,91,TRUE,100,FALSE,100,30,3,3,3,2,3,-3,3,3,-3,2,3,3,3,2,3,3,2,3,3,3,2,3,3,3,3,5,2,3,3,-2,3,5,2,3,3,3,3,8,3,3,3,3,3,5,3,3,3,3,3,0,2,0,3,-3,3,5,3,3,3,3,3,7,3,3,3,2,3,5,FALSE,1,100,TRUE,1,100,FALSE,1,91,TRUE,0,95,TRUE,1,100,FALSE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,95,FALSE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,95,TRUE,0,91,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,95,FALSE,1,100,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,96,FALSE,1,95,FALSE,1,90,TRUE,1,90,TRUE,1,96,TRUE,1,100,0,0,0,0.0025,0,0,0,0,0,0.0025,0.01,0.9025,0.0025,0,0,0,0,0.9025,0.0025,0.0025,0,0.0004,0,0,0.0025,0.0016,0.0016,0,0.0081,0.8281,0.01,0.01,0.095975,0.13,0.06195,30,93.75,29,90.63,7,87.5,7,87.5,7,87.5,8,100,15,93.75,14,87.5,96.94,97.5,97.5,97,95.75,97.75,96.12,3.12,6.31,10,10,9.5,-4.25,4,8.62,1,0,0,1,0,5,0,0,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,5,3,0,0,1,0,0,0,1,0,0,1,0,1,0,0.4,1.4,0.4,0.2,0.2,1.8,0.2,0.4,0.6,0.65,0.625,6,4,5,0.2,-0.4,0.2,-0.2,0,5,0,1,0,2,1,-1,1,-2,2,-1,1,-1,1,0,0,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,40,it was a great survey,0.875,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,02FUT,01ITEM,02REV,4,2,9,7,8,5,6,1,3,4,3,2,1 +976,R_3PuL0KDwfjj4sQp,46 - 52,American,,American,Male,Agree,Agree,Agree,Strongly agree,Agree,1,3,5,2,4,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,4,5,1,2,3,Somewhat Disagree,Agree,Agree,Agree,Agree,2,1,4,3,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,5,3,1,4,Somewhat agree,Agree,Strongly Agree,Agree,Agree,3,2,5,1,4,6,Agree,Somewhat agree,Agree,Somewhat agree,Agree,2,3,4,1,5,8,Neither Agree nor Disagree,Agree,Agree,Agree,Strongly Agree,1,3,4,5,2,9,Disagree,Disagree,Strongly disagree,Disagree,Disagree,3,5,2,4,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,5,3,1,2,4,7,Disagree,Agree,Agree,Somewhat agree,Somewhat agree,5,1,2,3,4,8,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Strongly Agree,3,4,2,5,1,9,Disagree,Disagree,Disagree,Disagree,Strongly disagree,2,5,1,3,4,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,96,TRUE,100,FALSE,100,FALSE,98,FALSE,97,FALSE,98,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,22,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,3,2,-2,0,2,1,1,-1,2,2,2,2,-3,-3,-3,-3,-3,1,2,3,2,2,6,2,1,2,1,2,8,0,2,2,2,3,9,-2,-2,-3,-2,-2,8,2,2,2,2,2,7,-2,2,2,1,1,8,1,-2,2,-1,3,9,-2,-2,-2,-2,-3,5,TRUE,0,96,TRUE,1,100,FALSE,1,100,FALSE,1,98,FALSE,0,97,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,0,100,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.0004,1,0,0,0,0,0,0,0,0.9409,0,1,0.0004,0,1,0,1,0,1,1,1,1,0.9216,0,0,1,0,0.387975,0.210121429,0.565828571,22,68.75,21,65.63,5,62.5,4,50,5,62.5,7,87.5,12,75,9,56.25,99.66,99.75,99.38,99.5,100,99.81,99.5,3.12,34.03,37.25,49.38,37,12.5,24.81,43.25,1,0,1,1,0,4,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,0,0,1,0,0,2,0,0,0,2,4,0,3,1,1,1,1,1,0,0.6,1.2,0.4,0.8,0.2,0.4,2,0.8,0.75,0.85,0.8,7.67,8,7.5,0.4,0.8,-1.6,0,-0.133333333,-1,0,0,3,-0.33,0,2,2,-2,2,1,-1,-2,2,-2,2,2,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,47,This was fun,1.375,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,5,8,9,7,2,3,6,1,4,4,2,3,1 +977,R_7OjN6oZfNkfvps9,18 - 24,American,,American,Male,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly disagree,Strongly agree,2,5,4,3,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,5,1,2,4,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Agree,5,3,1,2,4,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,2,5,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Neither agree nor disagree,Strongly Agree,Somewhat disagree,Strongly Agree,1,4,2,5,3,8,Agree,Somewhat agree,Disagree,Somewhat disagree,Somewhat disagree,1,2,5,4,3,8,Somewhat Agree,Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,5,3,4,2,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,Strongly Agree,3,2,4,1,5,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,5,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,5,2,3,1,4,6,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,3,1,5,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,61,TRUE,85,TRUE,97,FALSE,88,TRUE,50,TRUE,87,FALSE,100,FALSE,54,FALSE,92,TRUE,100,TRUE,100,TRUE,53,TRUE,87,TRUE,100,FALSE,60,TRUE,86,TRUE,70,FALSE,53,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,92,TRUE,88,TRUE,100,FALSE,88,TRUE,100,TRUE,83,FALSE,100,FALSE,57,FALSE,58,24,-1,3,-1,-3,3,-1,0,0,1,1,2,-1,3,1,2,-2,-1,-1,-1,-2,0,0,3,-1,3,3,2,1,-2,-1,-1,8,1,-2,0,3,0,8,1,1,1,1,0,2,0,2,0,2,3,3,-1,-1,1,0,1,3,2,-1,3,2,3,5,1,1,1,2,2,6,FALSE,1,58,FALSE,0,57,FALSE,1,100,TRUE,0,83,TRUE,1,100,FALSE,1,88,TRUE,1,100,TRUE,1,88,TRUE,1,92,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,53,TRUE,1,70,TRUE,1,86,FALSE,1,60,TRUE,0,100,TRUE,0,87,TRUE,0,53,TRUE,1,100,TRUE,1,100,FALSE,1,92,FALSE,0,54,FALSE,1,100,TRUE,1,87,TRUE,0,50,FALSE,1,88,TRUE,0,97,TRUE,1,85,FALSE,0,61,TRUE,1,100,0.0144,0.0169,0.0196,0,0,0.0144,0.2916,0,0.2809,0,0.0225,0,0.0064,0,0,0.3249,0.0064,0.6889,0.0144,0,0,0.09,0.7569,0.2209,0.16,0.25,0.3721,0.1764,0,1,0.9409,1,0.236342857,0.116857143,0.355828571,24,75,22,68.75,3,37.5,7,87.5,7,87.5,5,62.5,13,81.25,9,56.25,84.03,75,92.12,87.25,81.75,86.25,81.81,6.25,15.28,37.5,4.62,-0.25,19.25,5,25.56,1,3,4,2,0,3,1,2,2,2,1,1,3,2,2,3,2,2,2,2,1,1,1,5,0,0,1,1,1,0,0,0,0,1,1,3,2,2,3,4,2,2,1.8,2.2,1.6,0.6,0.4,2.8,2,1.35,1.675,6.33,3.67,4.75,0.4,1.4,1.4,-0.6,1.066666667,0,5,3,-4,2.66,1,2,1,0,0,0,0,2,-2,-1,1,2,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,This was an interesting survey. One of the more interesting ones I've answered recently.,0.625,0,1,1,1,0,0,0.67,0.33,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,6,9,3,5,7,2,8,1,4,2,4,3,1 +978,R_7Ei9VuEs5TkiVa5,25 - 31,American,,American,Male,Strongly agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,5,3,2,4,1,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,3,2,1,5,4,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,5,1,3,Strongly Agree,Agree,Agree,Strongly Agree,Agree,3,1,2,5,4,Strongly Agree,Somewhat agree,Strongly Agree,Agree,Agree,5,1,2,4,3,7,Agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,3,4,5,1,2,7,Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,5,4,3,1,2,5,Agree,Strongly Agree,Somewhat agree,Somewhat agree,Agree,2,3,5,1,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Strongly Agree,Neither agree nor disagree,Agree,4,1,5,2,3,8,Agree,Somewhat agree,Somewhat agree,Agree,Strongly agree,2,1,3,5,4,7,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,5,1,4,2,3,7,Strongly Agree,Agree,Somewhat agree,Agree,Somewhat agree,3,5,4,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,FALSE,80,FALSE,100,FALSE,50,TRUE,60,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,50,TRUE,60,TRUE,100,TRUE,65,TRUE,65,TRUE,100,TRUE,70,TRUE,100,TRUE,100,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,2,1,3,1,2,0,2,2,2,3,1,3,3,2,2,3,2,3,1,3,2,2,7,2,3,1,1,2,7,2,3,1,1,2,5,2,3,1,1,2,7,1,1,3,0,2,8,2,1,1,2,3,7,1,1,2,1,3,7,3,2,1,2,1,7,TRUE,0,100,FALSE,0,80,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,50,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,60,TRUE,0,100,TRUE,1,65,TRUE,0,65,TRUE,0,100,TRUE,0,70,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0.1225,1,0,0,0,0.16,0,0.25,0,0,0,0,0,0.16,0.64,0.25,0.25,1,1,1,0.25,0.25,0.25,0.25,0.4225,0,1,0,1,0.49,1,0.343660714,0.122142857,0.565178571,17,53.13,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,82.81,74.38,78.75,89.38,88.75,88.44,77.19,-12.5,17.18,-0.62,16.25,26.88,26.25,7.19,27.19,0,0,0,0,1,1,2,1,1,0,0,1,2,0,1,1,1,1,2,0,2,0,0,2,1,1,0,1,2,1,1,1,1,0,0,0,0,1,1,1,0.2,1,0.8,1,1,1,0.6,0.6,0.75,0.8,0.775,6.33,7.33,6.875,-0.8,0,0.2,0.4,-0.2,-1,0,-2,0,-1,-1,1,1,0,0,1,-1,2,-2,-1,1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),31,,0,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,6,7,4,3,8,2,9,1,5,4,3,2,1 +979,R_3Ow9i9lNAkypVYS,39 - 45,American,,American,Male,Disagree,Disagree,Somewhat disagree,Strongly disagree,Agree,2,5,3,4,1,Disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat disagree,4,5,1,2,3,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Agree,3,4,5,2,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Disagree,Disagree,Somewhat disagree,Strongly disagree,Somewhat disagree,1,5,2,3,4,3,Disagree,Somewhat agree,Strongly agree,Disagree,Disagree,3,5,4,1,2,2,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Disagree,Agree,4,5,1,3,2,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Disagree,Strongly disagree,Disagree,Strongly disagree,Agree,2,4,3,5,1,2,Disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,2,3,4,1,5,2,Somewhat Agree,Somewhat Disagree,Strongly agree,Disagree,Agree,1,3,4,5,2,7,Somewhat agree,Somewhat agree,Agree,Agree,Disagree,3,2,5,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,80,TRUE,51,TRUE,75,FALSE,50,FALSE,89,FALSE,50,TRUE,87,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,95,FALSE,100,FALSE,54,FALSE,100,FALSE,92,TRUE,100,TRUE,65,FALSE,100,TRUE,100,TRUE,56,FALSE,52,TRUE,100,TRUE,92,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,97,TRUE,100,FALSE,55,16,-2,-2,-1,-3,2,-2,1,3,-1,-1,-1,-1,3,-1,2,0,0,1,1,-2,-2,-2,-1,-3,-1,2,-2,1,3,-2,-2,3,-1,-1,3,-2,2,2,-1,-1,1,0,-2,4,-2,-3,-2,-3,2,1,-2,1,3,-2,1,2,1,-1,3,-2,2,2,1,1,2,2,-2,7,FALSE,1,55,TRUE,1,100,FALSE,1,97,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,92,TRUE,1,100,FALSE,1,52,TRUE,0,56,TRUE,1,100,FALSE,1,100,TRUE,1,65,TRUE,1,100,FALSE,1,92,FALSE,1,100,FALSE,1,54,FALSE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,50,TRUE,1,87,FALSE,1,50,FALSE,1,89,FALSE,1,50,TRUE,1,75,TRUE,1,51,TRUE,1,80,0,0.0169,0,0,0.04,0,0,0,0,0,0.0625,0,0.0064,0.2304,0,0,0,0.25,0.0121,0.25,0.0025,0.1225,0.2116,0,0.0064,0.25,0.2401,0.2025,0.0009,0,0.25,0.3136,0.087553571,0.042092857,0.133014286,16,50,30,93.75,8,100,8,100,7,87.5,7,87.5,16,100,14,87.5,82.5,64.25,89.62,86.5,89.62,90.31,74.69,-43.75,-11.25,-35.75,-10.38,-1,2.12,-9.69,-12.81,0,0,0,0,3,0,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,2,2,0,0,1,0,1,1,1,1,0,0.6,0.4,0.2,0.6,0.4,0.6,0.6,0.8,0.45,0.6,0.525,2.33,1.67,2.875,0.2,-0.2,-0.4,-0.2,-0.133333333,1,1,0,-3,0.66,2,2,2,-2,2,-1,1,-2,2,-2,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,44,,1.875,1,1,1,0,0,0,1,0,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,5,9,2,7,3,8,6,1,4,3,2,4,1 +980,R_70JVQdKTDYuklKp,32 - 38,American,,American,Male,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,1,3,5,Disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,3,5,2,1,4,Neither Agree nor Disagree,Disagree,Agree,Somewhat Disagree,Agree,4,5,1,3,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,3,5,2,1,4,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,5,1,4,4,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,4,3,1,6,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,3,5,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,5,4,3,2,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,4,5,3,2,1,4,Somewhat Disagree,Disagree,Agree,Somewhat Disagree,Agree,1,2,4,3,5,2,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,2,3,4,1,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,95,TRUE,75,TRUE,70,FALSE,55,TRUE,90,TRUE,60,TRUE,75,TRUE,75,TRUE,80,TRUE,65,FALSE,55,FALSE,90,TRUE,60,FALSE,65,FALSE,55,TRUE,90,TRUE,65,TRUE,80,FALSE,60,FALSE,100,TRUE,75,TRUE,85,FALSE,100,TRUE,65,FALSE,80,TRUE,75,FALSE,55,FALSE,65,TRUE,65,TRUE,70,FALSE,60,TRUE,75,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,1,1,1,-1,-2,-1,2,1,1,0,-2,2,-1,2,1,-1,0,-1,-2,-2,1,1,1,-1,4,-2,-1,2,0,1,3,1,-1,1,0,1,6,2,1,1,1,-1,7,-1,1,1,1,-1,2,-1,-1,2,0,1,4,-1,-2,2,-1,2,2,1,0,0,1,-2,6,FALSE,1,95,TRUE,1,75,TRUE,0,70,FALSE,1,55,TRUE,1,90,TRUE,0,60,TRUE,1,75,TRUE,1,75,TRUE,1,80,TRUE,1,65,FALSE,1,55,FALSE,1,90,TRUE,1,60,FALSE,1,65,FALSE,0,55,TRUE,1,90,TRUE,0,65,TRUE,0,80,FALSE,1,60,FALSE,1,100,TRUE,1,75,TRUE,1,85,FALSE,1,100,TRUE,1,65,FALSE,1,80,TRUE,1,75,FALSE,1,55,FALSE,1,65,TRUE,0,65,TRUE,1,70,FALSE,0,60,TRUE,1,75,0.0625,0.0625,0.01,0.0625,0.0625,0.36,0.1225,0.1225,0,0.0225,0.09,0.16,0.04,0.2025,0.01,0.0625,0,0.2025,0.1225,0.04,0.0625,0.3025,0.16,0.1225,0.4225,0.2025,0.36,0.0025,0.49,0.64,0.4225,0.01,0.172053571,0.104107143,0.24,25,78.13,25,78.13,6,75,5,62.5,7,87.5,7,87.5,14,87.5,11,68.75,72.81,61.88,73.75,77.5,78.12,73.12,72.5,0,-5.32,-13.12,11.25,-10,-9.38,-14.38,3.75,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,2,1,2,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,2,0,0,0.2,1,1.4,0.2,0.4,0.2,0.6,0.65,0.35,0.5,4.33,2.67,4.25,-0.2,-0.2,0.8,0.8,0.133333333,2,-1,4,1,1.66,1,2,2,-1,1,-1,1,-2,2,-2,2,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,37,"Nothing comes to mind, no.",1.375,1,1,1,0,0,0,1,0,03VLPfPs,02COC,02FUT,01ITEM,01DIR,2,4,3,5,7,6,8,1,9,2,4,3,1 +981,R_5rPbbE9CjOffOO5,25 - 31,American,,American,Male,Agree,Agree,Strongly agree,Somewhat agree,Agree,3,5,4,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,1,5,4,2,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,4,3,5,1,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Strongly disagree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Somewhat disagree,Agree,Strongly Agree,Agree,Agree,3,5,4,2,1,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,4,1,2,3,2,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,3,4,5,2,1,3,Strongly disagree,Disagree,Disagree,Disagree,Strongly disagree,3,1,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Agree,Agree,2,5,3,1,4,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,4,1,2,0,Neither Agree nor Disagree,Agree,Strongly agree,Somewhat Agree,Agree,3,5,1,4,2,10,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,5,3,2,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,FALSE,71,TRUE,83,TRUE,69,FALSE,100,FALSE,61,TRUE,100,FALSE,100,TRUE,100,FALSE,92,TRUE,100,TRUE,51,TRUE,61,FALSE,71,TRUE,93,TRUE,72,TRUE,100,TRUE,71,FALSE,100,TRUE,100,TRUE,100,FALSE,71,TRUE,83,TRUE,77,TRUE,100,TRUE,82,FALSE,100,TRUE,71,TRUE,61,TRUE,77,TRUE,93,FALSE,100,16,2,2,3,1,2,0,0,0,-1,1,0,1,3,1,2,-1,0,-1,-2,-3,-1,2,3,2,2,0,-1,-1,-1,1,-1,1,1,2,0,-1,0,2,-3,-2,-2,-2,-3,3,2,2,2,2,2,4,0,-1,1,0,1,1,0,2,3,1,2,0,2,2,2,2,0,10,FALSE,1,100,TRUE,1,93,TRUE,0,77,TRUE,0,61,TRUE,1,71,FALSE,1,100,TRUE,1,82,TRUE,1,100,TRUE,1,77,TRUE,1,83,FALSE,1,71,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,71,TRUE,1,100,TRUE,0,72,TRUE,0,93,FALSE,1,71,TRUE,0,61,TRUE,1,51,TRUE,1,100,FALSE,1,92,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,61,FALSE,1,100,TRUE,0,69,TRUE,1,83,FALSE,0,71,TRUE,1,91,0,0,0,0.0324,0.0081,0,0,0.0289,0.3721,0,0.0289,0,0.0529,0.0841,0.0841,0.0049,0.0064,0.3721,0,0,0.2401,0.0841,0.0841,0,0.5184,0.1521,0.5041,0,0.5929,0.8649,0.4761,1,0.198546429,0.074464286,0.322628571,16,50,24,75,6,75,6,75,7,87.5,5,62.5,15,93.75,9,56.25,84.41,72,80.75,94.75,90.12,85.81,83,-25,9.41,-3,5.75,7.25,27.62,-7.94,26.75,3,0,0,1,0,1,1,1,2,2,1,1,3,2,2,2,2,1,0,0,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,3,2,3,4,3,0.8,1.4,1.8,1,0.4,0.6,0.2,3,1.25,1.05,1.15,1,1.67,2.625,0.4,0.8,1.6,-2,0.933333333,-4,0,2,-7,-0.67,0,1,1,-1,1,0,0,-1,1,-1,1,0,10 cents,5 minutes,24 days,Male,Trade School (non-military),30,"Kind of a long survey. Also, I would love to know how many of those questions I got right.",0.625,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,02DGEN,02REV,5,9,2,3,6,7,8,1,4,3,4,2,1 +982,R_50oD9rRW7qLSVOW,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,3,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,5,1,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,3,2,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,1,5,10,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,4,3,5,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,2,4,5,FALSE,100,TRUE,86,TRUE,100,TRUE,61,TRUE,100,TRUE,77,TRUE,100,TRUE,100,TRUE,95,TRUE,100,TRUE,86,TRUE,100,TRUE,100,TRUE,89,TRUE,96,TRUE,100,TRUE,85,TRUE,85,TRUE,83,TRUE,82,TRUE,94,TRUE,93,TRUE,93,TRUE,100,FALSE,100,TRUE,100,TRUE,76,TRUE,83,TRUE,80,TRUE,96,TRUE,58,TRUE,83,32,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,3,3,3,3,3,2,3,-2,3,-3,3,10,3,3,3,3,3,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,86,TRUE,0,100,TRUE,0,61,TRUE,1,100,TRUE,0,77,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,0,86,TRUE,0,100,TRUE,1,100,TRUE,0,89,TRUE,1,96,TRUE,1,100,TRUE,0,85,TRUE,0,85,TRUE,0,83,TRUE,0,82,TRUE,1,94,TRUE,1,93,TRUE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,76,TRUE,0,83,TRUE,0,80,TRUE,1,96,TRUE,1,58,TRUE,1,83,0,0,0,0,0.0289,0.5929,0,0,0.6724,0.0049,0.0016,0,0.0025,0.7396,0,0.0196,0.8649,0.3721,0.6889,0,0.0036,0.0016,0.6889,0.7921,0.7225,0.5776,0.1764,0,1,0.7225,0.64,1,0.368339286,0.235671429,0.501007143,32,100,18,56.25,4,50,4,50,6,75,4,50,16,100,2,12.5,90.03,80.12,89,95.88,95.12,93.81,86.25,43.75,33.78,30.12,39,20.88,45.12,-6.19,73.75,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0,0,0,0,0,1.2,0,0,0,1.4,0,0,0.3,0.35,0.325,10,7.33,9,0,-0.2,0,0,-0.066666667,8,0,0,0,2.67,2,1,2,2,-2,2,-2,2,-2,2,-2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),37,none,-0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,5,3,8,4,7,9,6,1,2,4,2,3,1 +983,R_6DOyq2DXNKHvkSw,46 - 52,American,,American,Male,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,5,1,4,2,3,Agree,Disagree,Agree,Disagree,Somewhat agree,5,4,3,2,1,Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,5,1,2,4,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,3,1,5,2,Somewhat disagree,Agree,Somewhat agree,Disagree,Strongly Agree,4,5,3,1,2,5,Agree,Disagree,Strongly agree,Disagree,Agree,2,1,4,3,5,2,Agree,Agree,Agree,Disagree,Strongly Agree,2,5,1,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,1,4,5,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Agree,Disagree,Strongly Agree,1,3,4,5,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,4,1,1,Agree,Agree,Agree,Strongly Disagree,Strongly Agree,5,1,2,4,3,1,Somewhat agree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,5,4,3,1,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,86,TRUE,55,TRUE,100,TRUE,51,TRUE,80,FALSE,100,TRUE,91,TRUE,100,TRUE,57,FALSE,100,FALSE,100,TRUE,100,TRUE,88,TRUE,91,FALSE,61,TRUE,100,FALSE,68,TRUE,100,FALSE,59,FALSE,71,FALSE,100,TRUE,71,TRUE,88,TRUE,59,TRUE,96,FALSE,91,FALSE,62,FALSE,96,TRUE,66,TRUE,86,TRUE,82,TRUE,91,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,1,3,-1,3,2,-2,2,-2,1,2,1,2,-1,3,1,0,1,0,-1,-1,2,1,-2,3,5,2,-2,3,-2,2,2,2,2,2,-2,3,2,1,1,1,2,-1,7,3,2,2,-2,3,1,3,-3,3,-3,3,1,2,2,2,-3,3,1,1,0,2,2,0,3,TRUE,0,86,TRUE,1,55,TRUE,0,100,TRUE,0,51,TRUE,1,80,FALSE,1,100,TRUE,1,91,TRUE,1,100,TRUE,1,57,FALSE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,88,TRUE,0,91,FALSE,0,61,TRUE,1,100,FALSE,1,68,TRUE,0,100,FALSE,1,59,FALSE,1,71,FALSE,0,100,TRUE,1,71,TRUE,0,88,TRUE,1,59,TRUE,0,96,FALSE,0,91,FALSE,1,62,FALSE,1,96,TRUE,0,66,TRUE,1,86,TRUE,1,82,TRUE,1,91,0,0.8281,0,0.0081,0.0081,0,0.1681,1,0.0841,0.0841,0.0196,0.0144,0.1849,0,0.04,0.2025,0.7744,0.2601,0.0016,0.9216,1,0.3721,0.1681,0.8281,0.1024,0.1444,0.0324,0.7396,1,1,0.4356,1,0.378078571,0.202878571,0.553278571,17,53.13,19,59.38,6,75,5,62.5,2,25,6,75,12,75,7,43.75,82.69,65.88,85.12,90.75,89,82,83.38,-6.25,23.31,-9.12,22.62,65.75,14,7,39.63,4,1,2,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,2,0,0,1,1,1,0,1,1,1,1,2,0,1,0,2,0,0,0,1,2,1,1.6,0.4,0.4,0.6,0.6,1.2,0.6,0.8,0.75,0.8,0.775,3,1,2.75,1,-0.8,-0.2,-0.2,0,4,1,1,4,2,1,2,2,-2,2,0,0,-2,2,-2,2,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,52,This was an intriguing survey and I enhjoye it. ,1.5,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,6,4,9,3,2,5,8,1,7,2,3,4,1 +984,R_132nTZp6t0IpNeS,25 - 31,American,,American,Male,Disagree,Agree,Agree,Somewhat agree,Agree,3,5,4,2,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,4,3,2,1,5,Somewhat Agree,Somewhat Agree,Agree,Agree,Strongly Agree,5,1,4,3,2,Strongly disagree,Strongly disagree,Disagree,Somewhat disagree,Disagree,4,5,3,2,1,Disagree,Strongly Agree,Agree,Somewhat disagree,Agree,3,1,5,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,3,4,1,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,4,5,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Agree,Agree,Somewhat agree,Agree,1,5,2,4,3,2,Disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,4,3,5,2,1,2,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,3,2,4,2,Somewhat disagree,Strongly disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,1,3,2,4,5,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,31,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,1,2,-1,-1,1,1,2,1,1,2,2,3,-3,-3,-2,-1,-2,-2,3,2,-1,2,3,0,0,0,0,0,5,3,0,3,3,3,4,0,0,0,0,0,0,-3,2,2,1,2,2,-2,-1,2,1,1,2,3,3,2,2,3,2,-1,-3,-1,-1,-3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0.178571429,0.071428571,0.285714286,31,96.88,27,84.38,6,75,7,87.5,7,87.5,7,87.5,12,75,15,93.75,100,100,100,100,100,100,100,12.5,15.62,25,12.5,12.5,12.5,25,6.25,0,1,0,2,0,1,1,1,1,2,2,1,1,1,0,3,3,2,1,2,1,0,0,0,0,1,0,1,0,1,2,2,0,0,0,2,0,1,0,1,0.6,1.2,1,2.2,0.2,0.6,0.8,0.8,1.25,0.6,0.925,4,2,2.25,0.4,0.6,0.2,1.4,0.4,1,3,2,0,2,2,2,1,-2,2,1,-1,-1,1,-2,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,28,this was fun,1.125,1,1,1,0,0,0,1,0,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,7,8,3,6,4,9,5,1,2,3,4,2,1 +985,R_1jpGmGiqzWyZRy0,39 - 45,American,,American,Male,Agree,Strongly agree,Disagree,Disagree,Somewhat agree,2,3,5,1,4,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,3,4,1,5,Somewhat Disagree,Strongly Disagree,Strongly Agree,Disagree,Agree,3,4,5,1,2,Strongly disagree,Strongly disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,5,3,4,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,Somewhat agree,3,2,4,1,5,1,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,1,3,5,4,2,0,Disagree,Strongly Disagree,Strongly Agree,Disagree,Agree,2,4,1,3,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Disagree,Somewhat agree,Somewhat agree,1,4,2,3,5,1,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,2,1,5,4,3,1,Somewhat Disagree,Strongly Disagree,Strongly agree,Disagree,Agree,2,5,3,4,1,1,Strongly disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,5,3,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,70,FALSE,60,TRUE,80,TRUE,95,FALSE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,90,TRUE,60,TRUE,100,TRUE,80,FALSE,100,TRUE,60,TRUE,75,TRUE,65,TRUE,95,FALSE,50,FALSE,70,TRUE,90,TRUE,100,FALSE,50,TRUE,100,TRUE,80,TRUE,95,TRUE,100,FALSE,100,TRUE,95,FALSE,50,FALSE,100,TRUE,85,FALSE,100,28,2,3,-2,-2,1,-2,1,-1,1,-1,-1,-3,3,-2,2,-3,-3,-3,0,-3,3,3,-2,1,1,1,-2,1,-1,1,1,1,-2,-3,3,-2,2,0,0,1,1,1,-3,7,3,3,-2,1,1,0,-2,1,-1,1,1,1,-1,-3,3,-2,2,1,-3,-2,-3,-2,-3,1,FALSE,1,100,TRUE,1,85,FALSE,1,100,FALSE,1,50,TRUE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,80,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,90,FALSE,1,70,FALSE,0,50,TRUE,1,95,TRUE,0,65,TRUE,0,75,TRUE,0,60,FALSE,1,100,TRUE,1,80,TRUE,1,100,TRUE,0,60,TRUE,1,90,FALSE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,100,TRUE,0,95,TRUE,1,80,FALSE,0,60,TRUE,1,70,0.0025,0,0.0025,0,0.09,0,0.01,0,0,0,0.04,0.01,0.04,0.25,0.0025,0.0225,0.36,0.25,0,0,0.04,0.25,0.36,0.09,0.4225,0.25,0.36,0,0,0.5625,0.9025,1,0.189732143,0.076785714,0.302678571,28,87.5,24,75,5,62.5,5,62.5,7,87.5,7,87.5,14,87.5,10,62.5,82.66,60.62,81.88,93.12,95,85.62,79.69,12.5,7.66,-1.88,19.38,5.62,7.5,-1.88,17.19,1,0,0,3,0,0,0,0,0,2,1,0,0,0,0,3,4,4,1,0,1,0,0,3,0,0,0,0,0,2,0,0,0,0,0,0,1,0,2,0,0.8,0.4,0.2,2.4,0.8,0.4,0,0.6,0.95,0.45,0.7,0.67,0.67,1.5,0,0,0.2,1.8,0.066666667,1,0,-1,6,0,2,2,2,-2,2,-2,2,-2,2,-2,2,1,10 cents,100 minutes,47 days,Male,High School (or equivalent),39,kinda neet,1.875,0,0,1,1,1,0,0.33,0.67,02PsVLPf,02COC,01PAST,02DGEN,02REV,9,2,5,7,3,4,6,1,8,2,3,4,1 +986,R_5WxvAQUGMBVUqZE,46 - 52,American,,American,Male,Somewhat agree,Agree,Strongly agree,Agree,Agree,2,5,3,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,2,4,5,1,Strongly Agree,Agree,Agree,Somewhat Agree,Strongly Agree,2,4,3,1,5,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Agree,Agree,Strongly Agree,Agree,Agree,3,2,1,4,5,0,Agree,Strongly disagree,Agree,Strongly disagree,Agree,5,3,1,2,4,0,Strongly Agree,Agree,Agree,Somewhat Agree,Strongly Agree,1,3,2,4,5,2,Agree,Somewhat agree,Agree,Agree,Agree,2,3,1,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Agree,Strongly Agree,Agree,Agree,2,5,3,1,4,0,Agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,4,2,3,1,1,Strongly agree,Agree,Agree,Agree,Strongly agree,2,1,5,4,3,2,Agree,Somewhat agree,Agree,Agree,Somewhat agree,4,5,3,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,99,TRUE,91,TRUE,93,TRUE,74,FALSE,92,FALSE,59,TRUE,91,TRUE,84,TRUE,65,TRUE,50,FALSE,50,TRUE,50,FALSE,100,FALSE,50,FALSE,77,TRUE,50,TRUE,77,TRUE,50,TRUE,77,TRUE,57,TRUE,95,FALSE,50,FALSE,93,TRUE,92,TRUE,92,TRUE,92,TRUE,65,FALSE,50,FALSE,50,TRUE,98,TRUE,100,FALSE,60,16,1,2,3,2,2,1,-3,2,-3,1,3,2,2,1,3,1,1,2,2,1,2,2,3,2,2,0,2,-3,2,-3,2,0,3,2,2,1,3,0,2,1,2,2,2,2,2,2,3,2,2,1,2,-3,2,-3,1,0,3,2,2,2,3,1,2,1,2,2,1,2,FALSE,1,60,TRUE,1,100,TRUE,0,98,FALSE,1,50,FALSE,0,50,TRUE,0,65,TRUE,1,92,TRUE,1,92,TRUE,1,92,FALSE,0,93,FALSE,1,50,TRUE,0,95,TRUE,1,57,TRUE,0,77,TRUE,1,50,TRUE,1,77,TRUE,0,50,FALSE,1,77,FALSE,1,50,FALSE,1,100,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,65,TRUE,0,84,TRUE,1,91,FALSE,1,59,FALSE,1,92,TRUE,0,74,TRUE,1,93,TRUE,1,91,TRUE,1,99,0.0064,0.0081,0.0529,0.0064,0.0001,0.4225,0.1225,0.8649,0,0.25,0.0049,0.1849,0.0064,0.25,0.25,0,0.25,0.25,0.0064,0.7056,0.25,0.25,0.25,0.5929,0.25,0.1681,0.0081,0.16,0.9604,0.0529,0.5476,0.9025,0.284310714,0.204014286,0.364607143,16,50,21,65.63,8,100,3,37.5,4,50,6,75,13,81.25,8,50,74.16,67.75,61.88,78,89,77.62,70.69,-15.63,8.53,-32.25,24.38,28,14,-3.63,20.69,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0.2,0.4,0,0.4,0.2,0.2,0.2,0.2,0.25,0.2,0.225,0,0.67,0.75,0,0.2,-0.2,0.2,0,-1,0,-1,0,-0.67,0,-1,0,-2,2,1,-1,0,0,-1,1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,51,very interesting survey!! thank you!!,0.125,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,9,7,4,5,2,3,8,1,6,2,3,4,1 +987,R_6I6RwbbZOOms5xI,39 - 45,American,,American,Male,Agree,Agree,Agree,Agree,Somewhat agree,5,4,2,1,3,Agree,Strongly agree,Agree,Somewhat agree,Agree,4,2,5,3,1,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,Agree,2,3,5,1,4,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Somewhat agree,Agree,Somewhat agree,5,4,2,1,3,7,Neither agree nor disagree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,1,3,5,9,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,3,2,5,9,Somewhat agree,Agree,Somewhat agree,Agree,Agree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,1,4,5,3,2,9,Neither agree nor disagree,Somewhat agree,Agree,Agree,Somewhat agree,2,4,1,5,3,8,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,2,3,4,8,Somewhat agree,Agree,Strongly Agree,Agree,Somewhat agree,5,1,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,60,TRUE,59,FALSE,73,FALSE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,52,TRUE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,55,TRUE,50,FALSE,50,TRUE,50,28,2,2,2,2,1,2,3,2,1,2,1,3,1,2,2,1,2,2,2,1,2,2,1,2,1,9,0,1,2,2,1,7,2,2,1,0,1,9,1,2,1,2,2,9,2,2,2,1,0,9,0,1,2,2,1,9,2,3,1,1,1,8,1,2,3,2,1,8,TRUE,0,50,FALSE,0,50,TRUE,0,50,FALSE,1,55,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,TRUE,1,50,TRUE,1,52,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,0,73,TRUE,1,59,TRUE,1,60,0.25,0.25,0.25,0.25,0.16,0.25,0.25,0.2304,0.25,0.25,0.5329,0.25,0.25,0.25,0.25,0.25,0.25,0.2025,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1681,0.25,0.25,0.25,0.25,0.25,0.251567857,0.258985714,0.24415,28,87.5,18,56.25,6,75,5,62.5,3,37.5,4,50,11,68.75,7,43.75,51.53,51.75,51.25,50.25,52.88,52.75,50.31,31.25,-4.72,-23.25,-11.25,12.75,2.88,-16,6.56,0,0,1,0,0,2,2,0,1,1,1,1,0,2,1,0,0,1,0,1,0,0,0,1,1,2,2,0,1,1,1,0,0,1,1,0,0,1,0,0,0.2,1.2,1,0.4,0.4,1.2,0.6,0.2,0.7,0.6,0.65,8.33,8.67,8.5,-0.2,0,0.4,0.2,0.066666667,0,-2,1,1,-0.34,0,0,1,1,-1,2,-2,1,-1,1,-1,1,15 cents,75 minutes,24 days,Male,University - Graduate (Masters),44,Lovely Experience,-0.375,0,0,0,0,0,1,0,0.33,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,6,2,5,8,3,7,4,1,9,4,3,2,1 +988,R_1XWui7pnTtQMTm1,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,2,1,5,4,3,Strongly agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,3,1,2,5,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,3,5,2,1,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,5,2,1,3,4,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,3,4,5,2,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,3,1,2,5,Strongly Agree,Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,2,3,4,1,6,Somewhat disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat disagree,1,5,2,4,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,1,4,5,3,6,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,1,2,3,5,4,7,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,5,4,3,5,Agree,Agree,Agree,Agree,Somewhat disagree,5,2,4,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,90,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,82,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,92,TRUE,100,FALSE,100,TRUE,100,TRUE,98,TRUE,100,TRUE,100,FALSE,94,TRUE,100,FALSE,86,FALSE,88,TRUE,80,FALSE,99,29,3,3,2,1,3,3,-1,2,-1,1,3,1,3,-1,3,-1,-2,1,-2,-1,3,3,2,2,3,5,3,-3,3,-3,3,5,3,2,3,-1,3,6,-1,-3,1,-2,-1,9,3,3,2,2,3,6,3,-3,3,-2,3,7,3,1,3,-1,3,5,2,2,2,2,-1,8,FALSE,1,99,TRUE,1,80,FALSE,1,88,FALSE,1,86,TRUE,1,100,FALSE,1,94,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,0,92,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,0,82,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0.0036,0,0,0.6724,0,0.01,0.8464,0.0004,0,0,0.04,0,0.0196,1,0,0,0,0,0,1,0,0,0.0001,0.0144,0,0,1,0.164532143,0.113742857,0.215321429,29,90.63,27,84.38,8,100,6,75,8,100,5,62.5,15,93.75,12,75,97.16,95.5,98.25,99.88,95,97.5,96.81,6.25,12.78,-4.5,23.25,-0.12,32.5,3.75,21.81,0,0,0,1,0,0,2,1,2,2,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,2,1,1,2,0,0,0,0,0,3,4,1,4,0,0.2,1.4,0.2,0.2,0.2,1.2,0,2.4,0.5,0.95,0.725,5.33,6,6.375,0,0.2,0.2,-2.2,0.133333333,-1,-2,1,1,-0.67,1,2,2,-2,2,2,-2,-1,1,-2,2,2,5 cents,5 minutes,24 days,Male,University - Undergraduate,33,the survey took long than expected,1.25,1,1,0,0,0,1,0.67,0.33,04LPfPsV,01EOHI,02FUT,01ITEM,02REV,6,7,8,4,5,2,9,1,3,4,3,2,1 +989,R_5QtmX2yqA5EsiEq,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,2,1,4,5,3,Strongly agree,Agree,Strongly agree,Strongly disagree,Agree,1,4,2,5,3,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,2,1,4,5,3,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,5,1,4,3,2,10,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,Agree,2,5,1,4,3,10,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,2,1,5,4,10,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,Agree,4,3,2,1,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,2,4,5,3,1,10,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,5,2,3,1,10,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,3,2,1,5,10,Strongly Agree,Strongly Agree,Somewhat agree,Agree,Strongly Agree,2,5,3,4,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,95,TRUE,98,FALSE,90,FALSE,85,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,95,TRUE,100,FALSE,100,FALSE,90,FALSE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,95,TRUE,100,FALSE,95,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,90,TRUE,100,FALSE,100,FALSE,100,FALSE,90,FALSE,100,TRUE,100,FALSE,90,30,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,2,2,3,2,3,-3,2,3,1,3,3,3,3,3,3,3,2,1,3,3,3,2,10,3,1,3,3,2,10,2,3,3,3,2,10,3,1,3,3,2,10,2,3,2,3,3,10,3,3,2,1,3,10,3,1,3,3,3,10,3,3,1,2,3,10,FALSE,1,95,TRUE,1,98,FALSE,1,90,FALSE,1,85,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,95,TRUE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,95,TRUE,0,100,FALSE,1,95,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,90,FALSE,0,100,TRUE,1,100,FALSE,0,90,0,0,0,0,0.81,0,0,0,0,0,1,1,0.0025,0,0,0.0004,0,0.0225,0,0.01,0,0,0.0025,0,0.0025,0,0,0.0025,0.01,1,0.01,0.01,0.138675,0.202528571,0.074821429,30,93.75,28,87.5,8,100,6,75,7,87.5,7,87.5,13,81.25,15,93.75,97.28,96.62,96.88,98.12,97.5,98.94,95.62,6.25,9.78,-3.38,21.88,10.62,10,17.69,1.87,2,0,0,1,0,0,1,0,6,0,1,2,0,0,1,0,2,0,0,0,1,0,1,1,1,0,1,1,4,1,0,0,0,0,0,0,0,2,1,1,0.6,1.4,0.8,0.4,0.8,1.4,0,0.8,0.8,0.75,0.775,10,10,10,-0.2,0,0.8,-0.4,0.2,0,0,0,0,0,2,1,2,1,-1,2,-2,2,-2,1,-1,2,5 cents,5 minutes,47 days,Male,University - PhD,33,"Thank you, it was an interesting survey.",0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,3,2,7,6,5,9,8,1,4,4,3,2,1 +990,R_7MyBVy2Q21iHRZn,39 - 45,American,,American,Male,Strongly agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,1,3,2,4,5,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,4,2,5,1,Agree,Agree,Strongly Agree,Agree,Strongly Agree,4,3,1,5,2,Disagree,Strongly disagree,Disagree,Neither agree nor disagree,Strongly disagree,5,3,4,1,2,Strongly Agree,Somewhat agree,Strongly Agree,Agree,Neither agree nor disagree,5,4,2,1,3,3,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Agree,1,2,5,4,3,4,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,2,4,3,1,1,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,5,2,3,4,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat agree,5,2,3,1,4,2,Somewhat agree,Disagree,Agree,Disagree,Agree,2,3,5,4,1,5,Agree,Agree,Strongly Agree,Strongly Agree,Agree,5,3,4,1,2,3,Strongly Agree,Strongly disagree,Strongly Agree,Strongly Agree,Disagree,3,2,5,4,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,32,3,1,2,2,0,0,1,2,1,1,2,2,3,2,3,-2,-3,-2,0,-3,3,1,3,2,0,3,-1,1,2,1,2,4,2,2,3,2,3,1,-2,-2,-2,-3,-3,5,3,2,3,2,1,2,1,-2,2,-2,2,5,2,2,3,3,2,3,3,-3,3,3,-2,9,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0.142857143,0,0.285714286,32,100,28,87.5,8,100,7,87.5,7,87.5,6,75,16,100,12,75,100,100,100,100,100,100,100,12.5,12.5,0,12.5,12.5,25,0,25,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,3,0,0,1,1,0,1,1,3,0,3,1,0,0,0,1,1,5,0,5,3,1,0.2,0.4,0,0.8,0.6,1.6,0.4,2.8,0.35,1.35,0.85,2.67,3.33,4,-0.4,-1.2,-0.4,-2,-0.666666667,1,-1,-2,-4,-0.66,2,2,2,-2,2,0,0,0,0,-2,2,2,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),42,No additional comments,1.5,1,0,1,0,1,0,0.67,0.33,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,3,7,8,4,5,2,1,9,2,3,4,1 +991,R_5EzyVLZGMVzRU7F,32 - 38,American,,American,Male,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,1,2,3,4,5,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat agree,Agree,2,4,1,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,1,2,3,5,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Strongly Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,2,1,3,4,6,Disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,1,5,4,2,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,1,4,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,2,3,1,4,5,5,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,4,1,2,5,3,5,Disagree,Disagree,Disagree,Disagree,Disagree,5,2,1,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,FALSE,50,FALSE,50,TRUE,54,FALSE,50,TRUE,55,TRUE,53,FALSE,74,TRUE,50,FALSE,100,TRUE,87,FALSE,100,FALSE,100,FALSE,50,FALSE,50,FALSE,59,TRUE,58,FALSE,50,TRUE,58,FALSE,52,FALSE,50,TRUE,53,TRUE,74,TRUE,77,TRUE,60,TRUE,75,FALSE,100,TRUE,90,FALSE,64,TRUE,60,TRUE,70,FALSE,100,21,2,3,2,0,2,-1,-2,0,1,2,0,0,2,0,2,-3,-3,-3,-3,-3,2,3,0,0,2,5,-2,-2,0,0,0,6,1,0,2,0,2,5,-3,-3,-3,-3,-3,8,2,2,0,0,2,5,0,0,0,0,2,5,-1,0,0,-2,0,5,-2,-2,-2,-2,-2,5,FALSE,1,100,TRUE,1,70,TRUE,0,60,FALSE,1,64,TRUE,1,90,FALSE,1,100,TRUE,1,75,TRUE,1,60,TRUE,1,77,TRUE,1,74,TRUE,0,53,FALSE,1,50,FALSE,0,52,TRUE,0,58,FALSE,0,50,TRUE,1,58,FALSE,1,59,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,100,TRUE,1,87,FALSE,1,100,TRUE,1,50,FALSE,1,74,TRUE,1,53,TRUE,0,55,FALSE,1,50,TRUE,0,54,FALSE,0,50,FALSE,0,50,FALSE,0,50,0.16,0.2209,0.1764,0.0625,0.25,0,0.25,0.0676,0,0.0169,0.25,0.2704,0.0529,0.2809,0.01,0.09,0,0.1296,0.25,0.0676,1,0.25,0.25,0.3364,0.1681,0.3025,0.25,0,0.36,0.25,0.2916,0.25,0.203375,0.119164286,0.287585714,21,65.63,21,65.63,4,50,4,50,7,87.5,6,75,10,62.5,11,68.75,66.34,58.62,75.62,71.38,59.75,65.38,67.31,0,0.71,8.62,25.62,-16.12,-15.25,2.88,-1.44,0,0,2,0,0,1,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,1,2,0,0,1,2,0,1,0,1,0,2,2,2,1,1,1,1,1,0.4,0.8,0.2,0,0.6,0.8,1.4,1,0.35,0.95,0.65,5.33,5,5.5,-0.2,0,-1.2,-1,-0.466666667,0,1,0,3,0.33,1,2,2,-1,1,0,0,0,0,-1,1,1,10 cents,5 minutes,15 days,Male,University - Undergraduate,36,"Make surveys much shorter, much less repetitive, with much bigger payouts.",1,0,1,0,1,0,0,0.33,0.33,02PsVLPf,02COC,01PAST,02DGEN,02REV,8,7,4,3,2,9,5,1,6,2,3,4,1 +992,R_6SpHjdxlfnt9ea5,32 - 38,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,2,3,1,4,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,4,2,5,Neither agree nor disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,4,2,5,1,3,7,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Somewhat agree,5,2,4,3,1,9,Somewhat Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,5,4,1,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,1,5,3,9,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,8,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,2,3,1,4,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,5,2,4,3,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,100,FALSE,90,FALSE,90,FALSE,90,TRUE,100,FALSE,95,TRUE,100,FALSE,86,TRUE,100,TRUE,100,FALSE,88,FALSE,90,TRUE,100,FALSE,94,TRUE,100,TRUE,100,FALSE,95,FALSE,100,FALSE,95,FALSE,92,TRUE,100,TRUE,100,TRUE,95,TRUE,100,FALSE,92,TRUE,100,TRUE,100,FALSE,94,TRUE,100,FALSE,93,30,3,3,3,3,3,3,-2,3,-1,0,1,-1,3,1,3,0,1,2,2,0,3,1,3,1,3,6,3,0,3,-1,1,7,1,1,3,2,3,9,0,0,0,-1,0,7,3,3,3,3,3,9,1,0,1,0,1,9,3,0,3,1,3,8,3,3,3,3,0,8,FALSE,1,93,TRUE,1,100,FALSE,1,94,TRUE,0,100,TRUE,1,100,FALSE,1,92,TRUE,1,100,TRUE,1,95,TRUE,1,100,TRUE,1,100,FALSE,1,92,FALSE,1,95,FALSE,0,100,FALSE,1,95,TRUE,1,100,TRUE,1,100,FALSE,1,94,TRUE,0,100,FALSE,1,90,FALSE,1,88,TRUE,1,100,TRUE,1,100,FALSE,1,86,TRUE,1,100,FALSE,1,95,TRUE,1,100,FALSE,1,90,FALSE,1,90,FALSE,1,90,FALSE,0,100,TRUE,1,100,TRUE,1,100,0.0025,0,0,0,0,0.0064,0,0,0.0144,0,1,1,0,0.0064,0,0,0.0196,1,0.01,0.0025,0,0,0.01,0.0025,0.0036,0.01,0,0.0049,0.0036,1,0.01,0.0025,0.146657143,0.217628571,0.075685714,30,93.75,28,87.5,7,87.5,7,87.5,7,87.5,7,87.5,14,87.5,14,87.5,96.22,96.5,95.25,97.88,95.25,99.69,92.75,6.25,8.72,9,7.75,10.38,7.75,12.19,5.25,0,2,0,2,0,0,2,0,0,1,0,2,0,1,0,0,1,2,3,0,0,0,0,0,0,2,2,2,1,1,2,1,0,0,0,3,2,1,1,0,0.8,0.6,0.6,1.2,0,1.6,0.6,1.4,0.8,0.9,0.85,7.33,8.67,7.875,0.8,-1,0,-0.2,-0.066666667,-3,-2,1,-1,-1.34,1,1,2,-1,1,0,0,-2,2,-2,2,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,IT WAS EXCITING,1.25,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,02DGEN,02REV,7,9,5,4,6,2,3,1,8,3,2,4,1 +993,R_7QAPX4pUQYDqIST,18 - 24,American,,American,Male,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,2,3,5,4,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,2,5,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,1,2,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,5,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,3,1,2,4,5,4,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,2,5,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,3,5,1,4,Strongly Agree,Somewhat agree,Agree,Agree,Strongly Agree,4,1,3,2,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,2,3,4,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,1,3,4,5,6,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,4,2,1,6,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,4,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,57,TRUE,64,FALSE,64,FALSE,100,FALSE,50,TRUE,67,FALSE,50,TRUE,100,FALSE,64,TRUE,100,FALSE,100,TRUE,69,FALSE,62,FALSE,52,FALSE,62,FALSE,59,FALSE,60,TRUE,100,FALSE,57,FALSE,100,TRUE,64,FALSE,65,FALSE,66,TRUE,58,FALSE,85,TRUE,100,TRUE,54,FALSE,100,TRUE,58,TRUE,100,FALSE,53,FALSE,100,20,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,0,2,2,-3,3,-3,3,3,3,3,0,3,3,3,3,2,3,3,3,3,0,2,4,2,-3,3,-3,2,4,3,3,3,0,3,4,3,1,2,2,3,4,3,3,3,2,3,5,3,-3,3,-3,2,6,3,3,3,0,3,6,3,3,3,2,3,5,FALSE,1,57,TRUE,1,64,FALSE,1,64,FALSE,1,100,FALSE,0,50,TRUE,0,67,FALSE,0,50,TRUE,1,100,FALSE,0,64,TRUE,1,100,FALSE,1,100,TRUE,0,69,FALSE,0,62,FALSE,1,52,FALSE,0,62,FALSE,0,59,FALSE,1,60,TRUE,0,100,FALSE,1,57,FALSE,1,100,TRUE,1,64,FALSE,0,65,FALSE,1,66,TRUE,1,58,FALSE,1,85,TRUE,1,100,TRUE,0,54,FALSE,1,100,TRUE,0,58,TRUE,1,100,FALSE,0,53,FALSE,0,100,0,0,0.3481,0.25,1,0.4489,0.1764,0,0,0.4225,0,0.3844,0.4096,0,0.25,0.1296,0.1156,0,0,0.0225,0.1296,0.3844,0.1849,0.2304,0.16,0.2916,0.2809,0.1849,0.1296,1,0.3364,0.4761,0.255296429,0.238357143,0.272235714,20,62.5,18,56.25,4,50,3,37.5,5,62.5,6,75,7,43.75,11,68.75,73.12,69.25,65.88,76.12,81.25,71.94,74.31,6.25,16.87,19.25,28.38,13.62,6.25,28.19,5.56,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,1,0,0,2,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,0.6,0.8,0.4,0,0,0.25,0.3,0.275,4,5.67,4.75,-0.6,-0.2,0,0.6,-0.266666667,-1,-2,-2,-1,-1.67,0,2,1,-1,1,1,-1,0,0,-1,1,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),23,,0.75,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,8,2,7,9,5,6,4,1,3,3,4,2,1 +994,R_62f44m0U1ZadJSw,25 - 31,American,,American,Male,Strongly agree,Agree,Strongly agree,Agree,Agree,3,5,2,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,1,2,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,4,3,1,2,Agree,Agree,Agree,Agree,Agree,5,2,1,4,3,10,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,3,2,4,5,1,10,Agree,Agree,Neither Agree nor Disagree,Agree,Agree,3,5,2,4,1,10,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,3,5,1,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,1,2,3,4,5,Agree,Agree,Agree,Disagree,Strongly agree,2,5,3,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,5,4,2,3,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,5,3,4,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,50,TRUE,50,TRUE,70,TRUE,100,FALSE,55,FALSE,57,TRUE,100,FALSE,63,TRUE,100,TRUE,100,FALSE,70,FALSE,100,TRUE,79,FALSE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,3,2,2,3,3,3,3,3,3,3,3,0,2,3,3,3,3,3,2,2,2,2,2,10,2,2,2,0,3,10,2,2,0,2,2,10,2,3,3,2,3,10,3,2,3,2,3,5,2,2,2,-2,3,5,3,3,3,3,2,10,3,3,3,3,3,10,FALSE,1,100,TRUE,1,50,TRUE,0,50,TRUE,0,70,TRUE,1,100,FALSE,1,55,FALSE,0,57,TRUE,1,100,FALSE,0,63,TRUE,1,100,TRUE,0,100,FALSE,1,70,FALSE,0,100,TRUE,0,79,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,0,50,FALSE,0,100,TRUE,1,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0,0,0.3249,0,0.2025,0,0,0.25,0,0,1,0.3969,1,0,0.25,0.25,0.49,1,1,1,1,0.25,0.6241,0.25,0.25,1,0,0.25,1,1,0.09,0.448339286,0.274242857,0.622435714,16,50,17,53.13,3,37.5,5,62.5,4,50,5,62.5,10,62.5,7,43.75,82.62,72.88,81.88,92,83.75,91.88,73.38,-3.13,29.49,35.38,19.38,42,21.25,29.38,29.63,1,0,1,0,0,1,1,1,3,0,1,1,3,2,0,1,0,0,1,0,0,0,0,0,1,1,1,1,5,0,0,0,0,3,0,0,0,0,0,0,0.4,1.2,1.4,0.4,0.2,1.6,0.6,0,0.85,0.6,0.725,10,6.67,8.75,0.2,-0.4,0.8,0.4,0.2,5,5,0,0,3.33,2,1,1,-1,1,1,-1,2,-2,-1,1,1,20 cents,100 minutes,24 days,Male,University - Undergraduate,26,,0.5,0,0,0,0,1,1,0,0.67,04LPfPsV,02COC,02FUT,01ITEM,01DIR,3,9,4,7,8,6,2,1,5,2,3,4,1 +995,R_3dTGyvdnzxdRvIB,39 - 45,,Canadian,Canadian,Male,Strongly agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,4,2,3,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,3,4,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,3,4,2,5,1,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,4,1,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,3,5,2,1,4,7,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,1,4,3,5,5,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,4,1,5,3,Disagree,Disagree,Somewhat disagree,Disagree,Disagree,5,4,1,2,3,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,2,5,3,1,1,Disagree,Strongly disagree,Agree,Somewhat agree,Somewhat agree,1,5,3,4,2,4,Somewhat Agree,Strongly Agree,Agree,Somewhat Disagree,Agree,2,5,4,1,3,3,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat disagree,4,5,1,2,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,88,FALSE,93,TRUE,82,FALSE,80,TRUE,66,FALSE,100,FALSE,68,FALSE,84,FALSE,55,FALSE,95,FALSE,91,TRUE,83,TRUE,75,FALSE,100,FALSE,100,FALSE,70,TRUE,87,FALSE,88,TRUE,84,FALSE,68,TRUE,100,FALSE,80,FALSE,76,TRUE,100,TRUE,74,TRUE,100,FALSE,63,FALSE,91,TRUE,74,TRUE,81,FALSE,67,TRUE,79,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,1,1,1,0,-2,1,-1,1,1,1,1,0,3,-1,1,1,1,1,1,0,1,1,2,7,-1,1,0,1,0,5,1,1,2,0,1,3,-2,-2,-1,-2,-2,9,2,3,3,3,2,1,-2,-3,2,1,1,4,1,3,2,-1,2,3,-1,0,-1,-2,-1,7,FALSE,1,88,FALSE,0,93,TRUE,0,82,FALSE,1,80,TRUE,1,66,FALSE,1,100,FALSE,0,68,FALSE,0,84,FALSE,0,55,FALSE,0,95,FALSE,1,91,TRUE,0,83,TRUE,1,75,FALSE,1,100,FALSE,0,100,FALSE,0,70,TRUE,0,87,FALSE,1,88,TRUE,0,84,FALSE,1,68,TRUE,1,100,FALSE,0,80,FALSE,1,76,TRUE,1,100,TRUE,0,74,TRUE,1,100,FALSE,1,63,FALSE,1,91,TRUE,0,74,TRUE,1,81,FALSE,0,67,TRUE,1,79,0.7056,0,0.49,0.4624,0.0441,0,0,0.9025,0.1024,0.64,0.0361,0.0625,0.3025,0.0081,0.1156,0.8649,0.0576,0.04,0.0081,0.5476,0,1,0.7056,0,0.7569,0.1369,0.4489,0.0144,0.6724,0.0144,0.5476,0.6889,0.311357143,0.226878571,0.395835714,21,65.63,17,53.13,3,37.5,6,75,4,50,4,50,7,43.75,10,62.5,82.56,79.12,82.12,86.62,82.38,82.06,83.06,12.5,29.43,41.62,7.12,36.62,32.38,38.31,20.56,2,2,0,0,1,1,3,1,2,1,0,0,1,0,2,1,3,2,3,3,1,1,2,2,1,2,1,1,2,0,0,2,1,1,1,0,1,2,3,2,1,1.6,0.6,2.4,1.4,1.2,1,1.6,1.4,1.3,1.35,5,2.67,4.875,-0.4,0.4,-0.4,0.8,-0.133333333,6,1,0,2,2.33,1,1,1,-2,2,-1,1,0,0,-2,2,-1,10 cents,5 minutes,47 days,Male,University - Undergraduate,39,,0.875,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,01ITEM,01DIR,3,6,2,8,5,4,9,1,7,3,2,4,1 +996,R_5OkLALUWGKdFYrn,39 - 45,,Canadian,Canadian,Male,Strongly disagree,Agree,Agree,Somewhat agree,Strongly disagree,1,3,2,4,5,Strongly disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,4,2,5,1,Strongly Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,4,5,2,1,3,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Disagree,Strongly disagree,3,2,1,4,5,Strongly disagree,Strongly Agree,Somewhat disagree,Somewhat disagree,Strongly disagree,2,1,3,5,4,1,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,2,4,1,3,1,Somewhat Agree,Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,4,1,3,5,2,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Disagree,4,1,5,3,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly disagree,Strongly Agree,Agree,Agree,Disagree,4,1,2,3,5,0,Strongly disagree,Neither agree nor disagree,Agree,Agree,Somewhat disagree,1,5,3,4,2,0,Strongly Agree,Neither Agree nor Disagree,Agree,Agree,Agree,5,2,1,3,4,1,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,5,1,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,82,TRUE,82,FALSE,65,TRUE,100,TRUE,91,FALSE,100,FALSE,100,FALSE,53,FALSE,52,FALSE,54,FALSE,51,FALSE,100,FALSE,62,TRUE,100,TRUE,76,TRUE,85,FALSE,59,FALSE,85,TRUE,86,TRUE,100,FALSE,55,TRUE,100,FALSE,51,FALSE,84,TRUE,100,FALSE,89,TRUE,80,TRUE,87,TRUE,100,FALSE,82,FALSE,87,8,-3,2,2,1,-3,-3,1,1,2,0,3,0,-1,0,3,0,1,-1,-2,-3,-3,3,-1,-1,-3,1,-3,-1,1,1,-1,1,1,-2,-1,-1,1,5,0,2,2,0,-2,7,-3,3,2,2,-2,0,-3,0,2,2,-1,0,3,0,2,2,2,1,2,2,2,2,0,1,FALSE,1,87,FALSE,0,82,TRUE,0,100,TRUE,0,87,TRUE,1,80,FALSE,1,89,TRUE,1,100,FALSE,0,84,FALSE,0,51,TRUE,1,100,FALSE,1,55,TRUE,0,100,TRUE,1,86,FALSE,1,85,FALSE,0,59,TRUE,1,85,TRUE,0,76,TRUE,0,100,FALSE,1,62,FALSE,1,100,FALSE,0,51,FALSE,0,54,FALSE,1,52,FALSE,0,53,FALSE,1,100,FALSE,0,100,TRUE,0,91,TRUE,0,100,FALSE,1,65,TRUE,1,82,FALSE,0,82,TRUE,1,100,0.7056,1,0.0225,0,0,0.0121,0.2809,0,0,0.2916,0.0324,0.0196,0.2601,0.2025,0.04,0.6724,0.2304,0.7569,1,0,0.2601,0.3481,0.1444,0.0225,0.5776,0.8281,0.6724,0.0169,1,1,0.1225,1,0.349696429,0.199921429,0.499471429,8,25,16,50,2,25,6,75,5,62.5,3,37.5,7,43.75,9,56.25,81.19,71.12,74.88,90.75,88,78.06,84.31,-25,31.19,46.12,-0.12,28.25,50.5,34.31,28.06,0,1,3,2,0,0,2,0,1,1,2,2,0,1,2,0,1,3,2,1,0,1,0,1,1,0,1,1,0,1,0,0,3,2,1,2,1,3,4,3,1.2,0.8,1.4,1.4,0.6,0.6,1.2,2.6,1.2,1.25,1.225,2.33,0.33,2,0.6,0.2,0.2,-1.2,0.333333333,1,1,4,6,2,-2,2,1,-2,2,-1,1,-1,1,-2,2,1,10 cents,5 minutes,15 days,Male,High School (or equivalent),39,,1,0,1,0,1,0,0,0.33,0.33,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,6,7,3,8,9,5,1,4,3,4,2,1 +997,R_5dhs4Es7Ep0gGwt,39 - 45,American,,American,Female,Agree,Agree,Agree,Agree,Strongly disagree,2,4,5,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,4,1,2,Neither Agree nor Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,2,1,5,3,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Strongly disagree,5,2,4,3,1,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,2,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,3,5,4,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Strongly disagree,2,4,3,1,5,2,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,2,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,4,3,1,2,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,5,2,1,TRUE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,58,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,57,TRUE,50,TRUE,50,TRUE,50,TRUE,58,TRUE,57,TRUE,60,FALSE,60,TRUE,57,TRUE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,63,TRUE,50,9,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,-3,-2,0,1,0,1,0,-1,2,0,2,-3,-3,-3,-3,-3,2,2,2,2,-3,2,-1,0,1,0,1,2,0,-1,1,1,1,2,-3,-3,-3,-3,-3,2,2,2,2,2,-3,5,-3,0,1,0,1,2,0,-1,1,-1,1,2,-3,-3,-3,-3,-3,2,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,58,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,57,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,58,TRUE,0,57,TRUE,1,60,FALSE,1,60,TRUE,1,57,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,50,TRUE,1,63,TRUE,1,50,0.1764,0.1849,0.25,0.25,0.25,0.25,0.16,0.25,0.25,0.1764,0.25,0.25,0.25,0.25,0.25,0.25,0.3249,0.25,0.25,0.16,0.25,0.25,0.25,0.25,0.25,0.25,0.1369,0.25,0.25,0.3249,0.25,0.25,0.242253571,0.243664286,0.240842857,9,28.13,19,59.38,5,62.5,4,50,5,62.5,5,62.5,16,100,3,18.75,52.19,51.62,50.88,54,52.25,52.88,51.5,-31.25,-7.19,-10.88,0.88,-8.5,-10.25,-47.12,32.75,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0.2,0.6,0,0,0.2,0.6,0,0.2,0.2,0.2,2,3,2.375,0,0,0,0,0,-3,0,0,0,-1,1,2,1,-1,1,0,0,-2,2,-2,2,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),39,it was good,1.375,0,1,0,1,0,1,0.33,0.67,04LPfPsV,02COC,02FUT,02DGEN,01DIR,7,8,9,2,5,4,3,1,6,4,3,2,1 +998,R_1SbmUbaWtqakKk1,39 - 45,American,,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,2,3,4,5,1,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly disagree,2,5,3,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,4,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,3,2,4,5,0,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,4,3,1,2,5,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,1,2,5,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,3,2,5,4,0,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,2,5,3,1,4,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,3,1,5,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,FALSE,50,TRUE,50,FALSE,100,TRUE,100,FALSE,100,FALSE,50,TRUE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,50,FALSE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,100,FALSE,50,TRUE,100,16,1,3,3,3,-3,-3,0,1,1,-3,3,3,3,0,3,1,1,1,1,1,3,3,3,3,-3,0,-3,-3,1,-3,-3,0,1,1,1,1,1,0,1,1,1,1,1,0,3,3,3,3,-3,0,-3,-3,1,-3,1,0,1,1,1,1,1,0,1,1,1,1,1,0,TRUE,0,100,FALSE,0,50,TRUE,0,100,FALSE,1,50,TRUE,1,50,TRUE,0,50,TRUE,1,50,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,TRUE,0,100,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,0,100,TRUE,0,50,TRUE,0,100,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,50,FALSE,1,50,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,0,100,TRUE,1,100,0,0.25,1,0.25,0,0.25,0,0,0.25,0.25,0,0,0,0.25,0.25,0.25,0,0.25,1,0,0,0.25,0.25,0.25,0.25,0.25,1,1,1,1,0.25,1,0.330357143,0.125,0.535714286,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,76.56,62.5,75,75,93.75,81.25,71.88,-12.5,14.06,0,0,12.5,43.75,12.5,15.63,2,0,0,0,0,0,3,0,4,0,2,2,2,1,2,0,0,0,0,0,2,0,0,0,0,0,3,0,4,4,2,2,2,1,2,0,0,0,0,0,0.4,1.4,1.8,0,0.4,2.2,1.8,0,0.9,1.1,1,0,0,0,0,-0.8,0,0,-0.266666667,0,0,0,0,0,0,0,0,-2,2,-1,1,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,40,,0.375,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,6,2,8,9,7,3,4,1,5,4,2,3,1 +999,R_5B2M5p5U6Ucv4KH,46 - 52,American,,American,Female,Strongly agree,Agree,Disagree,Disagree,Strongly agree,5,3,2,1,4,Agree,Disagree,Strongly agree,Disagree,Disagree,2,4,1,5,3,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,3,2,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,5,2,Strongly Agree,Agree,Somewhat agree,Disagree,Strongly Agree,2,1,3,5,4,4,Agree,Somewhat disagree,Strongly agree,Somewhat agree,Disagree,5,2,1,4,3,6,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,3,1,5,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,4,2,1,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Agree,Somewhat agree,Somewhat agree,Strongly Agree,4,2,1,3,5,3,Somewhat agree,Disagree,Strongly agree,Disagree,Disagree,1,3,5,4,2,1,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,3,4,5,2,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,5,1,4,2,1,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,70,TRUE,100,TRUE,83,FALSE,52,TRUE,100,FALSE,93,TRUE,91,TRUE,100,FALSE,56,TRUE,78,FALSE,81,TRUE,100,TRUE,100,TRUE,87,FALSE,50,TRUE,100,TRUE,84,FALSE,83,FALSE,50,FALSE,50,FALSE,50,TRUE,87,FALSE,100,TRUE,91,TRUE,100,TRUE,87,FALSE,50,FALSE,50,TRUE,100,FALSE,50,FALSE,56,TRUE,100,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,-2,-2,3,2,-2,3,-2,-2,3,2,3,1,3,3,3,3,3,3,3,2,1,-2,3,4,2,-1,3,1,-2,6,3,3,3,2,3,2,1,1,1,1,1,7,3,2,1,1,3,3,1,-2,3,-2,-2,1,3,2,3,-2,3,2,3,3,3,3,3,1,TRUE,0,70,TRUE,1,100,TRUE,0,83,FALSE,1,52,TRUE,1,100,FALSE,1,93,TRUE,1,91,TRUE,1,100,FALSE,0,56,TRUE,1,78,FALSE,1,81,TRUE,0,100,TRUE,1,100,TRUE,0,87,FALSE,0,50,TRUE,1,100,TRUE,0,84,FALSE,1,83,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,87,FALSE,1,100,TRUE,1,91,TRUE,0,100,TRUE,1,87,FALSE,1,50,FALSE,1,50,TRUE,0,100,FALSE,0,50,FALSE,0,56,TRUE,1,100,0,0.0169,0,0.0081,0,0.0049,0.0081,0.0484,0.25,0.0169,0.25,0,0.3136,0.0361,0,0,0,0.2304,0.25,1,0.25,0.25,0.25,0.7569,0.7056,0.25,0.3136,0.49,0.6889,0.0289,1,1,0.299725,0.082742857,0.516707143,17,53.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,11,68.75,9,56.25,79.03,61.88,90.88,85.38,78,81,77.06,-9.37,16.53,-0.62,28.38,22.88,15.5,12.25,20.81,0,0,3,0,0,0,1,0,3,0,0,1,0,1,0,2,2,2,2,2,0,0,3,3,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0.6,0.8,0.4,2,1.2,0.2,0.6,0,0.95,0.5,0.725,4,2,3.25,-0.6,0.6,-0.2,2,-0.066666667,1,5,0,6,2,2,2,2,-2,2,0,0,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),50,I am sure I got those last 3 questions wrong…seems like they were trick questions…and I’m taking this on a Saturday afternoon after a very long week so my brain was not ready for trick questions!,1.375,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,2,8,9,3,4,5,6,1,7,2,3,4,1 +1000,R_52Lyabi3ByuaRHU,39 - 45,American,,American,Female,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,5,2,1,4,3,Strongly disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat disagree,1,5,3,2,4,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,5,1,2,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,2,3,5,Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Agree,3,1,4,5,2,2,Strongly disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat disagree,2,1,4,5,3,2,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,2,3,1,5,0,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,1,4,3,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,3,2,5,1,4,0,Disagree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,1,5,4,2,3,1,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly Agree,1,3,5,4,2,3,Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,3,2,4,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,85,FALSE,50,TRUE,92,FALSE,50,FALSE,50,FALSE,100,TRUE,78,TRUE,99,FALSE,50,TRUE,60,FALSE,50,TRUE,87,TRUE,58,TRUE,89,TRUE,50,TRUE,56,TRUE,59,TRUE,70,FALSE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,79,TRUE,85,FALSE,76,TRUE,57,TRUE,50,FALSE,72,TRUE,57,FALSE,50,FALSE,51,TRUE,77,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,3,-1,1,-3,-2,3,-1,-1,3,1,3,-2,3,1,1,1,1,-1,2,3,3,0,2,2,-3,-2,3,-1,-1,2,3,1,3,-1,3,0,1,1,1,2,-1,3,1,1,2,1,2,0,-2,-1,1,-2,1,1,3,1,2,-1,3,3,2,3,3,2,2,2,TRUE,0,85,FALSE,0,50,TRUE,0,92,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,78,TRUE,1,99,FALSE,0,50,TRUE,1,60,FALSE,1,50,TRUE,0,87,TRUE,1,58,TRUE,0,89,TRUE,1,50,TRUE,1,56,TRUE,0,59,TRUE,0,70,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,79,TRUE,1,85,FALSE,1,76,TRUE,1,57,TRUE,0,50,FALSE,1,72,TRUE,0,57,FALSE,0,50,FALSE,0,51,TRUE,1,77,0.0001,0.1849,0.1936,0.0484,0.0529,0,0.0225,0.16,0.25,0.25,0.25,0.1764,0.25,0.25,0.25,0.25,0.0441,0.25,0.0784,0.0576,0.25,0.25,0.25,0.7921,0.3481,0.25,0.2601,0.7225,0.8464,0.49,0.3249,0.7569,0.290460714,0.175421429,0.4055,16,50,19,59.38,4,50,5,62.5,5,62.5,5,62.5,11,68.75,8,50,65.22,50.12,66.25,70.62,73.88,60.69,69.75,-9.38,5.84,0.12,3.75,8.12,11.38,-8.06,19.75,2,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,2,1,2,1,1,1,2,1,2,0,0,1,1,0,1,2,2,1,3,0.8,0,0.2,0.2,1.4,1.4,0.4,1.8,0.3,1.25,0.775,1.33,1.33,1.625,-0.6,-1.4,-0.2,-1.6,-0.733333333,2,1,-3,1,0,0,1,2,-2,2,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,42,It was an interesting survey.,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,01DIR,9,3,2,4,6,8,5,1,7,3,4,2,1 +1001,R_60y1sHUREAIPW25,39 - 45,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,4,2,5,1,3,Agree,Neither agree nor disagree,Strongly agree,Disagree,Agree,5,3,4,2,1,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,5,3,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,5,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Agree,Somewhat agree,Agree,5,2,1,3,4,1,Agree,Neither agree nor disagree,Agree,Disagree,Agree,5,2,1,3,4,1,Agree,Strongly Agree,Agree,Somewhat Agree,Agree,3,1,4,5,2,2,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,2,3,4,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Agree,Strongly Agree,Agree,Somewhat agree,Somewhat agree,3,2,5,4,1,7,Agree,Neither agree nor disagree,Strongly agree,Disagree,Agree,5,2,4,3,1,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Agree,4,5,2,3,1,2,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,50,TRUE,50,TRUE,50,FALSE,65,TRUE,50,FALSE,50,FALSE,50,TRUE,76,FALSE,79,TRUE,58,TRUE,50,FALSE,66,TRUE,54,TRUE,86,FALSE,83,TRUE,58,TRUE,50,25,2,3,3,1,2,2,0,3,-2,2,2,3,3,1,3,1,1,2,1,1,2,3,2,1,2,1,2,0,2,-2,2,1,2,3,2,1,2,1,1,2,2,2,1,2,2,3,2,1,1,1,2,0,3,-2,2,7,3,3,3,1,2,1,2,2,2,2,2,2,TRUE,0,50,TRUE,1,58,FALSE,1,83,TRUE,0,86,TRUE,1,54,FALSE,1,66,TRUE,1,50,TRUE,1,58,FALSE,0,79,TRUE,1,76,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,65,TRUE,1,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,0.1764,0.25,0.25,0.25,0.25,0.1156,0.25,0.0576,0.25,0.25,0.25,0.25,0.6241,0.25,0.2116,0.1764,0.25,0.7396,0.25,0.25,0.25,0.25,0.25,0.1225,0.25,0.25,0.25,0.25,0.0289,0.25,0.25,0.25,0.252725,0.28035,0.2251,25,78.13,24,75,6,75,5,62.5,6,75,7,87.5,13,81.25,11,68.75,55.47,59.12,52.5,55.12,55.12,54.69,56.25,3.13,-19.53,-15.88,-10,-19.88,-32.38,-26.56,-12.5,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1,0.2,0.2,0.4,0.4,0.4,0,0.4,0.8,0.3,0.4,0.35,1,3,2,-0.2,0.2,0,-0.4,0,0,-6,0,0,-2,0,2,2,-1,1,1,-1,1,-1,0,0,1,5 cents,5 minutes,47 days,Male,University - PhD,43,GREAT,0.5,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,3,4,7,9,8,6,2,1,5,3,4,2,1 +1002,R_306qNPdQLqQWswA,46 - 52,American,,American,Female,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,1,5,2,3,4,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,2,5,Strongly Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,3,2,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,3,4,2,5,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,5,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,2,5,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,1,4,5,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,60,TRUE,84,TRUE,78,TRUE,75,FALSE,53,TRUE,97,TRUE,87,FALSE,64,TRUE,71,FALSE,68,TRUE,83,FALSE,56,TRUE,60,TRUE,73,FALSE,57,FALSE,56,TRUE,63,FALSE,65,TRUE,56,TRUE,82,FALSE,58,TRUE,89,FALSE,60,FALSE,70,TRUE,76,TRUE,86,FALSE,55,TRUE,71,TRUE,100,TRUE,69,TRUE,100,14,3,2,1,0,-3,-3,-1,0,0,0,3,-1,0,1,0,0,0,0,0,0,0,0,0,0,-3,4,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,-3,6,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,100,TRUE,1,69,TRUE,0,100,TRUE,0,71,FALSE,0,55,TRUE,0,86,TRUE,1,76,FALSE,0,70,FALSE,0,60,TRUE,1,89,FALSE,1,58,TRUE,0,82,TRUE,1,56,FALSE,1,65,TRUE,1,63,FALSE,0,56,FALSE,1,57,TRUE,0,73,TRUE,0,60,FALSE,1,56,TRUE,1,83,FALSE,0,68,TRUE,0,71,FALSE,0,64,TRUE,0,87,TRUE,1,97,FALSE,1,53,TRUE,0,75,TRUE,0,78,TRUE,1,84,TRUE,1,60,TRUE,1,100,0.49,0.0009,0.3136,0.0576,0,0.7396,0.4096,0.0121,0.1936,0.4624,0.0256,0.1936,0.36,0.1764,0.3025,0.0961,0.5041,0.5041,0.5625,0.7569,0.0289,0.1369,0.36,0.1225,0.1849,0.2209,0.16,1,1,0.5329,0.6084,0.6724,0.368817857,0.284264286,0.453371429,14,43.75,15,46.88,5,62.5,4,50,4,50,2,25,10,62.5,5,31.25,72.56,61.75,73.25,81.88,73.38,71.88,73.25,-3.13,25.68,-0.75,23.25,31.88,48.38,9.38,42,3,2,1,0,0,3,1,0,0,0,3,1,0,1,0,0,0,0,0,0,3,2,1,0,0,3,1,0,0,0,3,1,0,1,0,0,0,0,0,0,1.2,0.8,1,0,1.2,0.8,1,0,0.75,0.75,0.75,5,6,5.5,0,0,0,0,0,-2,-1,0,1,-1,0,1,1,0,0,2,-2,0,0,-1,1,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,,0.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,02DGEN,02REV,9,7,4,6,3,2,8,1,5,2,4,3,1 +1003,R_7DJ8cRP3DHtga9x,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly disagree,Strongly agree,1,5,3,4,2,Disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Agree,3,4,5,2,1,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,1,4,2,5,Somewhat agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,3,5,4,2,1,Strongly Agree,Strongly Agree,Somewhat agree,Strongly disagree,Strongly Agree,3,5,1,2,4,2,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,Agree,2,5,4,1,3,1,Somewhat Disagree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,2,5,1,4,0,Disagree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,5,1,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Somewhat agree,Disagree,Strongly Agree,2,3,5,1,4,2,Disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,2,5,2,Somewhat Disagree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,5,3,1,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,3,5,4,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,99,TRUE,100,TRUE,66,FALSE,50,TRUE,100,FALSE,100,TRUE,97,TRUE,100,TRUE,100,TRUE,100,FALSE,75,TRUE,76,TRUE,92,FALSE,87,TRUE,84,TRUE,100,TRUE,71,TRUE,100,TRUE,69,FALSE,50,FALSE,50,TRUE,98,FALSE,100,TRUE,100,FALSE,100,TRUE,81,TRUE,69,FALSE,99,TRUE,99,TRUE,76,FALSE,50,TRUE,100,28,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,1,-3,3,-2,-1,3,0,2,0,-1,3,-1,3,1,2,1,2,0,3,3,1,-3,3,2,-1,-2,3,0,2,1,-1,-2,3,-1,3,0,-2,-2,-1,-1,-1,5,3,3,1,-2,3,2,-2,-2,2,0,0,2,-1,-2,3,-1,3,1,0,0,0,1,0,4,FALSE,1,99,TRUE,1,100,TRUE,0,66,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,97,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,75,TRUE,0,76,TRUE,1,92,FALSE,1,87,TRUE,1,84,TRUE,1,100,TRUE,0,71,TRUE,0,100,TRUE,0,69,FALSE,1,50,FALSE,0,50,TRUE,1,98,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,81,TRUE,0,69,FALSE,1,99,TRUE,0,99,TRUE,1,76,FALSE,0,50,TRUE,1,100,0,0.0361,0,0.0009,0,0,0,0,0.25,0.0004,0.0576,0.0064,0,0.0625,0,0,0,0.25,0.0001,0,0.25,0.0256,0.4761,0.0169,0.5041,0.4761,0.25,0.0001,0.4356,1,0.9801,0.5776,0.200685714,0.044778571,0.356592857,28,87.5,23,71.88,5,62.5,5,62.5,7,87.5,6,75,14,87.5,9,56.25,85.56,74.62,89,95.25,83.38,89.25,81.88,15.62,13.68,12.12,26.5,7.75,8.38,1.75,25.63,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,3,4,2,3,1,0,0,0,1,0,0,1,1,0,2,1,1,0,0,0,1,2,1,1,0,0,0.4,0.4,2.6,0.2,0.8,0.4,1,0.85,0.6,0.725,1,1.67,2.125,-0.2,-0.4,0,1.6,-0.2,0,-1,-1,1,-0.67,2,2,2,-2,2,0,0,-2,2,-2,2,2,5 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),51,It all worked well and was worded in a way that was easy to complete.,1.75,1,1,1,0,0,0,1,0,02PsVLPf,02COC,01PAST,01ITEM,01DIR,2,6,9,3,8,4,5,1,7,3,4,2,1 +1004,R_33vBuSq1T7samS8,46 - 52,American,,American,Female,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,4,1,5,2,3,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,2,3,4,5,Agree,Disagree,Agree,Agree,Strongly Agree,5,1,2,3,4,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Agree,Agree,Agree,1,5,2,4,3,8,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,2,4,1,5,7,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,2,5,3,4,1,3,Disagree,Disagree,Disagree,Disagree,Disagree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Agree,Agree,Agree,Agree,5,1,4,3,2,6,Disagree,Disagree,Disagree,Disagree,Neither agree nor disagree,4,2,5,3,1,5,Agree,Strongly agree,Agree,Agree,Strongly agree,3,2,5,4,1,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,60,FALSE,83,TRUE,100,FALSE,80,FALSE,65,FALSE,68,TRUE,85,TRUE,83,FALSE,67,FALSE,71,FALSE,75,FALSE,61,FALSE,70,FALSE,67,TRUE,78,FALSE,83,TRUE,60,FALSE,68,TRUE,62,FALSE,63,TRUE,94,FALSE,73,TRUE,68,TRUE,64,TRUE,93,TRUE,91,FALSE,100,FALSE,59,FALSE,65,TRUE,96,FALSE,73,FALSE,76,19,2,1,1,0,2,-2,-2,2,-2,0,2,-2,2,2,3,2,0,0,0,-3,2,2,2,2,2,5,-2,0,2,0,2,8,0,1,1,1,2,7,-2,-2,-2,-2,-2,3,2,2,2,2,2,6,-2,-2,-2,-2,0,6,2,3,2,2,3,5,0,0,0,0,0,7,FALSE,1,76,FALSE,0,73,TRUE,0,96,FALSE,1,65,FALSE,0,59,FALSE,1,100,TRUE,1,91,TRUE,1,93,TRUE,1,64,TRUE,1,68,FALSE,1,73,TRUE,0,94,FALSE,0,63,TRUE,0,62,FALSE,0,68,TRUE,1,60,FALSE,1,83,TRUE,0,78,FALSE,1,67,FALSE,1,70,FALSE,0,61,FALSE,0,75,FALSE,1,71,FALSE,0,67,TRUE,0,83,TRUE,1,85,FALSE,1,68,FALSE,1,65,FALSE,1,80,TRUE,1,100,FALSE,0,83,FALSE,0,60,0.0049,0.0225,0.16,0.0081,0.36,0,0.4489,0.1024,0.09,0.5625,0,0.3969,0.1296,0.0729,0.3481,0.5329,0.0841,0.1225,0.1225,0.6889,0.3721,0.4624,0.1089,0.3844,0.0289,0.1024,0.6889,0.0576,0.9216,0.6084,0.04,0.8836,0.311478571,0.2322,0.390757143,19,59.38,18,56.25,5,62.5,4,50,4,50,5,62.5,7,43.75,11,68.75,75.03,70.12,72.12,77.25,80.62,73.12,76.94,3.13,18.78,7.62,22.12,27.25,18.12,29.37,8.19,0,1,1,2,0,0,2,0,2,2,2,3,1,1,1,4,2,2,2,1,0,1,1,2,0,0,0,4,0,0,0,5,0,0,0,2,0,0,0,3,0.8,1.2,1.6,2.2,0.8,0.8,1,1,1.45,0.9,1.175,6.67,5.67,5.875,0,0.4,0.6,1.2,0.333333333,-1,2,2,-4,1,1,1,1,-1,1,-1,1,-1,1,-1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,gREAT SURVEY,0.875,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,02REV,7,4,2,3,5,8,9,1,6,4,3,2,1 +1005,R_5RTXrTAVifP2iB0,32 - 38,American,,American,Female,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,Agree,3,1,2,5,4,Somewhat disagree,Strongly agree,Agree,Somewhat agree,Somewhat agree,2,5,4,1,3,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,2,5,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Strongly Agree,Somewhat disagree,Somewhat disagree,Strongly Agree,1,4,3,2,5,6,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,4,3,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,1,3,2,4,10,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,1,5,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Agree,Strongly Agree,Neither agree nor disagree,Strongly Agree,Strongly Agree,1,3,5,4,2,4,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,5,3,1,2,4,3,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,1,2,5,3,10,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Somewhat disagree,2,1,4,3,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,50,FALSE,58,TRUE,69,FALSE,83,FALSE,74,FALSE,57,TRUE,83,FALSE,63,TRUE,53,TRUE,61,FALSE,59,TRUE,60,FALSE,100,FALSE,64,TRUE,93,FALSE,60,TRUE,66,TRUE,60,TRUE,67,TRUE,82,TRUE,73,FALSE,82,FALSE,97,TRUE,76,TRUE,83,TRUE,95,FALSE,94,FALSE,64,FALSE,67,TRUE,100,TRUE,57,TRUE,64,15,1,3,0,2,2,-1,3,2,1,1,2,2,2,1,3,0,0,1,0,-1,1,3,-1,-1,3,4,0,3,3,3,3,6,2,3,3,3,3,1,3,3,3,0,3,10,2,3,0,3,3,6,0,3,3,-1,3,4,2,3,3,0,3,3,3,3,2,1,-1,10,TRUE,0,64,TRUE,1,57,TRUE,0,100,FALSE,1,67,FALSE,0,64,FALSE,1,94,TRUE,1,95,TRUE,1,83,TRUE,1,76,FALSE,0,97,FALSE,1,82,TRUE,0,73,TRUE,1,82,TRUE,0,67,TRUE,1,60,TRUE,1,66,FALSE,1,60,TRUE,0,93,FALSE,1,64,FALSE,1,100,TRUE,1,60,FALSE,0,59,TRUE,0,61,TRUE,1,53,FALSE,1,63,TRUE,1,83,FALSE,1,57,FALSE,1,74,FALSE,1,83,TRUE,1,69,FALSE,0,58,TRUE,1,50,0.0289,0.0289,0.1156,0.0025,0.25,0.0036,0.2209,0.9409,0,0.3481,0.0961,0.0324,0.0576,0.0324,0.4096,0.1849,0.3721,0.1089,0.0676,0.1369,0.16,0.16,0.1296,0.4489,0.16,0.1849,0.3364,0.4096,1,0.8649,0.0289,0.5329,0.274217857,0.218392857,0.330042857,15,46.88,22,68.75,7,87.5,6,75,3,37.5,6,75,12,75,10,62.5,72.31,65.12,69.25,77.62,77.25,69.5,75.12,-21.87,3.56,-22.38,-5.75,40.12,2.25,-5.5,12.62,0,0,1,3,1,1,0,1,2,2,0,1,1,2,0,3,3,2,0,4,1,0,0,1,1,1,0,1,2,2,0,1,1,1,0,3,3,1,1,0,1,1.2,0.8,2.4,0.6,1.2,0.6,1.6,1.35,1,1.175,3.67,4.33,5.5,0.4,0,0.2,0.8,0.2,-2,2,-2,0,-0.66,0,1,1,-2,2,2,-2,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,,0.375,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,02REV,8,7,2,3,4,5,9,1,6,3,2,4,1 +1006,R_7qNLAeIrEpq97X5,39 - 45,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,3,1,Somewhat disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,4,1,5,2,Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,4,3,2,Agree,Somewhat agree,Agree,Strongly Agree,Neither agree nor disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,3,5,2,1,4,5,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,3,5,4,1,6,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,5,1,2,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,0,Somewhat Agree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,1,3,5,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,3,4,5,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,65,TRUE,100,TRUE,100,FALSE,100,TRUE,56,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,56,FALSE,51,TRUE,77,TRUE,100,TRUE,62,TRUE,99,FALSE,50,FALSE,100,TRUE,100,TRUE,77,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,28,3,3,3,3,3,-1,0,3,1,0,2,-1,3,0,3,2,1,2,3,0,3,3,3,3,3,0,0,0,3,2,1,5,3,1,3,1,3,5,0,0,-2,0,0,6,3,3,3,3,3,0,-2,-2,3,0,1,2,1,-1,3,0,3,0,3,3,3,3,3,1,TRUE,0,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,100,FALSE,1,100,TRUE,0,77,TRUE,1,100,FALSE,1,100,FALSE,0,50,TRUE,1,99,TRUE,0,62,TRUE,0,100,TRUE,0,77,FALSE,1,51,FALSE,0,56,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,56,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,65,TRUE,1,100,0,0,0.0001,0,0,0,0,1,0.2401,0,0,0,0,0,0,0,0,0.25,0,1,0.3136,0.25,0.5929,0,0.3844,0.3136,0.4225,1,1,1,1,0.5929,0.334285714,0.106435714,0.562135714,28,87.5,19,59.38,4,50,5,62.5,4,50,6,75,12,75,7,43.75,88.84,74.75,89.75,100,90.88,91.88,85.81,28.12,29.46,24.75,27.25,50,15.88,16.88,42.06,0,0,0,0,0,1,0,0,1,1,1,2,0,1,0,2,1,4,3,0,0,0,0,0,0,1,2,0,1,1,1,0,0,0,0,1,2,1,0,3,0,0.6,0.8,2,0,1,0.2,1.4,0.85,0.65,0.75,3.33,0.67,2.375,0,-0.4,0.6,0.6,0.066666667,0,3,5,5,2.66,-1,2,1,-1,1,1,-1,0,0,2,-2,1,5 cents,5 minutes,24 days,Female,University - Graduate (Masters),45,fun!,0.125,1,1,0,0,0,1,0.67,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,02REV,9,7,3,8,5,6,2,1,4,3,4,2,1 +1007,R_6tYHn1xjiofoT6h,46 - 52,American,,American,Female,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,5,2,4,3,1,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,1,5,2,4,3,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,2,5,3,1,Somewhat agree,Agree,Agree,Agree,Neither agree nor disagree,2,5,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Strongly Agree,Agree,Somewhat disagree,Strongly Agree,3,5,2,1,4,2,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,2,4,3,1,5,2,Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,1,3,5,4,2,7,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat agree,Strongly Agree,5,2,1,4,3,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,1,2,4,2,Agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,4,1,3,2,3,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,56,TRUE,100,TRUE,100,TRUE,73,FALSE,100,TRUE,90,FALSE,100,TRUE,80,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,80,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,75,FALSE,100,FALSE,100,TRUE,91,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,61,FALSE,68,TRUE,72,FALSE,100,18,3,3,2,0,3,1,-3,2,-2,2,2,0,3,0,3,1,2,2,2,0,2,3,2,-1,3,3,1,-3,2,-2,2,2,2,0,2,-2,3,2,1,1,2,1,0,7,3,3,1,1,3,3,0,-3,3,-3,2,1,2,0,3,-3,3,2,2,1,1,1,1,3,FALSE,1,100,TRUE,1,72,FALSE,1,68,FALSE,1,61,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,91,FALSE,0,100,FALSE,1,100,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,80,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,0,73,TRUE,0,100,TRUE,1,100,TRUE,1,56,TRUE,1,100,0,0.01,0,0,0,0,0.04,1,0,0,0,0,0.0081,0,0,0.0784,0,0.1521,0.5329,0,0,0,0,0,0.04,0,0.1936,0,0.1024,0,1,0.0625,0.114642857,0.091328571,0.137957143,18,56.25,29,90.63,8,100,7,87.5,7,87.5,7,87.5,15,93.75,14,87.5,92.06,85,97.5,98.75,87,93.06,91.06,-34.38,1.43,-15,10,11.25,-0.5,-0.69,3.56,1,0,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,1,0,0,0,1,1,0,1,0,1,1,0,0,0,0,3,0,1,1,1,1,1,0.4,0,0.6,0.4,0.4,0.6,0.6,1,0.35,0.65,0.5,2.33,2,2.875,0,-0.6,0,-0.6,-0.2,0,1,0,4,0.33,1,2,2,-2,2,0,0,-1,1,-2,2,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,52,I have none. ,1.25,0,1,1,1,0,0,0.67,0.33,04LPfPsV,02COC,01PAST,02DGEN,02REV,5,9,2,3,6,8,4,1,7,3,4,2,1 +1008,R_7nj844TBfQvT4C0,18 - 24,American,,American,Female,Disagree,Agree,Strongly disagree,Strongly disagree,Strongly agree,4,3,1,5,2,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,Somewhat Agree,Disagree,Strongly Disagree,Agree,Strongly Agree,5,3,2,1,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,2,3,5,Somewhat disagree,Agree,Agree,Disagree,Strongly Agree,5,1,4,2,3,4,Agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,4,5,2,3,1,3,Agree,Disagree,Disagree,Strongly Agree,Agree,3,5,1,4,2,1,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,2,4,3,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Agree,Disagree,Somewhat agree,Strongly Agree,2,4,3,1,5,2,Somewhat agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,2,5,4,1,1,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Strongly Agree,5,4,3,2,1,2,Agree,Strongly Agree,Agree,Agree,Strongly disagree,2,5,4,3,1,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,50,TRUE,69,TRUE,100,TRUE,52,FALSE,100,TRUE,94,TRUE,95,TRUE,75,FALSE,51,TRUE,52,FALSE,51,TRUE,92,TRUE,51,FALSE,100,TRUE,92,FALSE,100,FALSE,51,TRUE,57,FALSE,65,TRUE,86,TRUE,93,FALSE,51,TRUE,51,TRUE,96,TRUE,99,TRUE,100,TRUE,81,TRUE,85,FALSE,53,TRUE,100,TRUE,100,TRUE,90,5,-2,2,-3,-3,3,1,3,3,3,3,1,-2,-3,2,3,-3,-3,-3,-3,-3,-1,2,2,-2,3,4,2,3,3,-1,3,3,2,-2,-2,3,2,1,2,3,3,3,3,9,1,2,-2,1,3,2,1,3,3,-2,3,1,1,-2,2,-1,3,2,2,3,2,2,-3,9,TRUE,0,90,TRUE,1,100,TRUE,0,100,FALSE,1,53,TRUE,1,85,TRUE,0,81,TRUE,1,100,TRUE,1,99,TRUE,1,96,TRUE,1,51,FALSE,1,51,TRUE,0,93,TRUE,1,86,FALSE,1,65,TRUE,1,57,FALSE,0,51,FALSE,1,100,TRUE,0,92,FALSE,1,100,TRUE,0,51,TRUE,1,92,FALSE,0,51,TRUE,0,52,FALSE,0,51,TRUE,0,75,TRUE,1,95,TRUE,0,94,FALSE,1,100,TRUE,0,52,TRUE,1,100,TRUE,1,69,FALSE,0,50,0.0001,0.0025,0.2601,0,0.25,0.6561,0.2601,0.2401,0.2601,0.2601,0,0.0196,0.0016,0.2401,0.0225,0,0.2704,0.2209,0,0.5625,0.0064,0.1849,0,0.1225,0,0.8836,0.0961,0.81,1,0.8464,0.2704,0.8649,0.298189286,0.192971429,0.403407143,5,15.63,18,56.25,7,87.5,4,50,4,50,3,37.5,12,75,6,37.5,77.56,77.5,74.75,77.38,80.62,77.06,78.06,-40.62,21.31,-10,24.75,27.38,43.12,2.06,40.56,1,0,5,1,0,1,0,0,4,0,1,0,1,1,1,5,6,6,6,6,3,0,1,4,0,0,0,0,5,0,0,0,5,3,0,5,6,5,5,0,1.4,1,0.8,5.8,1.6,1,1.6,4.2,2.25,2.1,2.175,2.67,1.67,3.875,-0.2,0,-0.8,1.6,-0.333333333,2,2,-1,0,1,2,2,2,-2,2,-2,2,-2,2,-2,2,1,10 cents,5 minutes,24 days,Female,University - Undergraduate,24,none,1.875,0,1,0,1,0,1,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,7,2,4,9,5,6,3,1,8,4,3,2,1 +1009,R_36v6o7qFq7ACuwF,39 - 45,,Canadian,Canadian,Male,Disagree,Agree,Agree,Neither agree nor disagree,Agree,3,4,1,5,2,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,5,4,3,2,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,5,2,4,1,Neither agree nor disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Disagree,Agree,Agree,Disagree,Agree,5,2,4,1,3,2,Disagree,Neither agree nor disagree,Agree,Disagree,Agree,4,1,3,2,5,7,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,4,2,1,5,Strongly disagree,Strongly disagree,Neither agree nor disagree,Disagree,Strongly disagree,5,3,1,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Disagree,Agree,Agree,Disagree,Agree,2,4,3,1,5,4,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Agree,3,5,2,4,1,3,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,4,5,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,1,2,3,4,TRUE,75,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,75,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,FALSE,90,FALSE,50,TRUE,50,FALSE,50,TRUE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,TRUE,70,TRUE,50,FALSE,50,8,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,0,2,-3,0,0,0,2,3,1,3,0,2,0,-1,-3,-3,-3,-2,2,2,-2,2,4,-2,0,2,-2,2,2,2,2,2,0,2,7,-3,-3,0,-2,-3,5,-2,2,2,-2,2,7,0,-2,2,-3,2,4,2,2,2,0,2,3,0,0,0,0,-2,5,TRUE,0,75,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,TRUE,0,50,FALSE,0,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,TRUE,1,75,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,50,FALSE,1,100,FALSE,0,90,FALSE,0,50,TRUE,0,50,FALSE,0,50,TRUE,0,50,TRUE,1,50,FALSE,1,50,FALSE,1,50,TRUE,0,50,TRUE,1,70,TRUE,1,50,FALSE,0,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0,0.25,0.09,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.81,0.25,0.25,0.25,0.25,0.25,0.25,0.5625,0.25,0.25,0.25,0.25,0.259821429,0.207321429,0.312321429,8,25,17,53.13,6,75,3,37.5,3,37.5,5,62.5,8,50,9,56.25,55,50,58.12,53.12,58.75,55.31,54.69,-28.13,1.87,-25,20.62,15.62,-3.75,5.31,-1.56,0,0,0,2,0,1,0,2,2,0,1,1,1,0,0,3,2,3,1,0,0,0,0,2,0,3,2,2,3,0,1,1,1,0,0,0,1,3,3,1,0.4,1,0.6,1.8,0.4,2,0.6,1.6,0.95,1.15,1.05,4.33,4.67,4.625,0,-1,0,0.2,-0.333333333,-3,-2,4,0,-0.34,-2,2,2,-2,2,-2,2,-2,2,-2,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,41,,1.375,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,2,5,8,4,7,3,9,1,6,2,3,4,1 +1010,R_7PTUw4FzGaZ5mzi,32 - 38,American,,American,Female,Agree,Agree,Somewhat agree,Somewhat agree,Strongly agree,3,4,2,5,1,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Strongly Agree,2,5,4,3,1,Strongly disagree,Somewhat disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,Disagree,1,4,2,3,5,10,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,3,1,2,5,8,Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Strongly Disagree,2,3,4,1,5,10,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,2,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Strongly Agree,Disagree,Disagree,Strongly Agree,Strongly Agree,5,1,3,4,2,10,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,3,5,2,4,8,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,65,FALSE,50,TRUE,100,FALSE,50,FALSE,50,FALSE,50,TRUE,75,TRUE,76,FALSE,50,FALSE,50,FALSE,50,TRUE,75,TRUE,50,TRUE,55,TRUE,94,TRUE,91,TRUE,70,TRUE,71,TRUE,70,FALSE,55,TRUE,90,FALSE,54,TRUE,56,FALSE,50,TRUE,98,TRUE,93,FALSE,90,TRUE,60,TRUE,50,TRUE,95,FALSE,50,TRUE,75,9,2,2,1,1,3,-3,-2,3,1,3,0,0,3,3,3,-3,-1,-3,-3,-3,3,3,-2,3,-2,10,0,-3,3,-3,-3,10,-2,-3,3,-1,-3,8,2,1,1,2,1,10,3,-2,-2,3,3,10,2,-3,3,-3,3,10,3,-3,3,3,3,8,3,3,3,3,3,10,TRUE,0,75,FALSE,0,50,TRUE,0,95,TRUE,0,50,TRUE,1,60,FALSE,1,90,TRUE,1,93,TRUE,1,98,FALSE,0,50,TRUE,1,56,FALSE,1,54,TRUE,0,90,FALSE,0,55,TRUE,0,70,TRUE,1,71,TRUE,1,70,TRUE,0,91,TRUE,0,94,TRUE,0,55,TRUE,0,50,TRUE,1,75,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,76,TRUE,1,75,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,100,FALSE,0,50,TRUE,1,65,0.0004,0.0625,0.09,0.0049,0.1225,0.01,0.25,0.1936,0.25,0.25,0,0.3025,0.25,0.2116,0.16,0.25,0.25,0.25,0.25,0.5776,0.0625,0.0841,0.3025,0.49,0.8281,0.25,0.25,0.5625,0.9025,0.8836,0.25,0.81,0.330485714,0.196442857,0.464528571,9,28.13,16,50,3,37.5,6,75,3,37.5,4,50,10,62.5,6,37.5,67.44,53.75,67,73.62,75.38,66.75,68.12,-21.87,17.44,16.25,-8,36.12,25.38,4.25,30.62,1,1,3,2,5,3,1,0,4,6,2,3,0,4,6,5,2,4,5,4,1,4,3,2,0,5,1,0,4,0,3,3,0,0,0,6,4,6,6,6,2.4,2.8,3,4,2,2,1.2,5.6,3.05,2.7,2.875,9.33,9.33,9.5,0.4,0.8,1.8,-1.6,1,0,0,0,0,0,1,2,2,-2,2,2,-2,0,0,-2,2,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),33,This survey was different and interesting. Makes me want to go brush up on some things from school.,1.125,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,01PAST,02DGEN,02REV,9,7,5,6,8,2,3,1,4,2,3,4,1 +1011,R_3P2dJHTAgH47mGE,32 - 38,American,,American,Female,Somewhat disagree,Agree,Agree,Strongly agree,Strongly disagree,1,3,5,2,4,Strongly disagree,Strongly disagree,Agree,Agree,Somewhat agree,3,5,2,1,4,Somewhat Disagree,Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,1,4,2,Strongly disagree,Disagree,Disagree,Disagree,Strongly disagree,4,5,1,2,3,Agree,Agree,Agree,Agree,Somewhat agree,1,2,3,4,5,4,Strongly disagree,Strongly disagree,Somewhat agree,Strongly agree,Disagree,2,5,3,4,1,4,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Agree,2,5,3,1,4,8,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,1,5,3,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Agree,Agree,Somewhat agree,4,2,1,3,5,5,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Agree,3,2,1,4,5,7,Somewhat Disagree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,3,4,2,5,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,1,5,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,75,FALSE,50,TRUE,100,TRUE,100,FALSE,75,FALSE,50,FALSE,100,FALSE,75,TRUE,75,TRUE,100,TRUE,100,TRUE,80,FALSE,50,FALSE,75,TRUE,100,TRUE,70,TRUE,100,TRUE,65,TRUE,100,TRUE,100,FALSE,50,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,60,FALSE,50,FALSE,100,FALSE,50,TRUE,50,16,-1,2,2,3,-3,-3,-3,2,2,1,-1,-2,3,1,3,-3,-2,-2,-2,-3,2,2,2,2,1,4,-3,-3,1,3,-2,4,3,3,-3,3,3,8,-3,-3,-3,-3,-3,6,0,2,2,2,1,5,-3,-3,3,-2,2,7,-1,-2,3,-1,3,3,-1,-1,-1,-1,-1,3,TRUE,0,50,FALSE,0,50,FALSE,1,100,FALSE,1,50,TRUE,1,60,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,0,100,TRUE,1,65,TRUE,1,100,TRUE,0,70,TRUE,0,100,FALSE,1,75,FALSE,1,50,TRUE,1,80,TRUE,1,100,TRUE,0,100,TRUE,1,75,FALSE,1,75,FALSE,0,100,FALSE,1,50,FALSE,1,75,TRUE,0,100,TRUE,1,100,FALSE,0,50,TRUE,1,75,0,1,0,0,0.0625,0,0.0625,0,0.25,0,0,0,0,1,0.16,0.25,1,0.25,0.0625,0.0625,0.04,0.1225,0.0625,1,0.49,0.25,0.25,0.25,0,1,1,0.25,0.28125,0.216785714,0.345714286,16,50,22,68.75,5,62.5,5,62.5,4,50,8,100,13,81.25,9,56.25,81.25,67.5,85.62,90.62,81.25,84.69,77.81,-18.75,12.5,5,23.12,40.62,-18.75,3.44,21.56,3,0,0,1,4,0,0,1,1,3,4,5,6,2,0,0,1,1,1,0,1,0,0,1,4,0,0,1,4,1,0,0,0,2,0,2,1,1,1,2,1.6,1,3.4,0.6,1.2,1.2,0.4,1.4,1.65,1.05,1.35,5.33,5,5,0.4,-0.2,3,-0.8,1.066666667,-1,-3,5,3,0.33,0,2,2,-2,2,1,-1,-2,2,-2,2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),35,"It was one of the more engaging and interesting surveys that I've taken lately. I wish I could find out how many of the questions I got correct, I'm curious!",1,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,01ITEM,02REV,7,5,8,6,2,9,4,1,3,4,2,3,1 +1012,R_1VIW1mgSS6FAif9,18 - 24,American,,American,Female,Strongly agree,Agree,Strongly agree,Agree,Agree,1,4,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Agree,1,3,2,5,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,3,4,5,Agree,Agree,Agree,Somewhat agree,Agree,3,4,5,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,2,5,4,3,1,7,Somewhat agree,Agree,Somewhat agree,Strongly agree,Somewhat agree,1,3,5,2,4,10,Agree,Agree,Agree,Somewhat Agree,Agree,3,2,5,1,4,10,Disagree,Disagree,Somewhat disagree,Strongly disagree,Strongly disagree,2,4,1,3,5,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,2,3,5,1,10,Somewhat agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,3,1,4,10,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,2,5,4,3,1,10,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,3,4,2,5,1,10,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,64,TRUE,100,TRUE,72,TRUE,87,FALSE,59,TRUE,67,FALSE,100,TRUE,59,FALSE,59,TRUE,61,TRUE,79,TRUE,57,TRUE,59,TRUE,93,TRUE,84,FALSE,56,TRUE,61,TRUE,100,TRUE,61,TRUE,100,TRUE,66,FALSE,55,TRUE,59,TRUE,60,TRUE,88,TRUE,72,TRUE,56,TRUE,66,TRUE,100,FALSE,63,TRUE,68,12,3,2,3,2,2,0,0,1,2,2,1,0,1,1,1,2,2,2,1,2,3,3,3,3,1,7,1,2,1,3,1,10,2,2,2,1,2,10,-2,-2,-1,-3,-3,10,2,3,3,2,3,10,1,1,3,0,3,10,1,3,3,2,1,10,3,3,3,3,1,10,TRUE,0,68,FALSE,0,63,TRUE,0,100,TRUE,0,66,TRUE,1,56,TRUE,0,72,TRUE,1,88,TRUE,1,60,TRUE,1,59,FALSE,0,55,TRUE,0,66,TRUE,0,100,TRUE,1,61,TRUE,0,100,TRUE,1,61,FALSE,0,56,TRUE,0,84,TRUE,0,93,TRUE,0,59,TRUE,0,57,TRUE,1,79,TRUE,1,61,FALSE,1,59,TRUE,1,59,FALSE,1,100,TRUE,1,67,FALSE,1,59,TRUE,0,87,TRUE,0,72,TRUE,1,100,TRUE,1,64,TRUE,1,100,0.16,0.1089,0.3136,0.0144,0,0.5184,0.1681,0.3025,0.3249,0.1521,0,0.1521,0.1681,0.4356,0.1936,0.3969,0.1681,0.4356,0.7569,0,0.0441,0.1521,0.3481,1,0.7056,0.1681,0.1296,0.4624,1,0.8649,0.5184,1,0.377364286,0.244,0.510728571,12,37.5,16,50,4,50,5,62.5,4,50,3,37.5,13,81.25,3,18.75,72.84,62.12,72.88,79,77.38,68.06,77.62,-12.5,22.84,12.12,10.38,29,39.88,-13.19,58.87,0,1,0,1,1,1,2,0,1,1,1,2,1,0,1,4,4,3,4,5,1,1,0,0,1,1,1,2,2,1,0,3,2,1,0,1,1,1,2,1,0.6,1,1,4,0.6,1.4,1.2,1.2,1.65,1.1,1.375,9,10,9.625,0,-0.4,-0.2,2.8,-0.2,-3,0,0,0,-1,0,2,2,0,0,2,-2,2,-2,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),23,None,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,01ITEM,02REV,3,8,9,4,6,5,7,1,2,4,3,2,1 +1013,R_7EFdT2zk09C5KRq,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,4,5,3,2,1,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,4,1,3,2,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Agree,Agree,4,2,5,1,3,Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,1,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,5,1,2,3,4,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,5,4,3,2,0,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,Agree,Strongly Agree,4,1,5,3,2,0,Agree,Agree,Agree,Agree,Strongly Agree,2,5,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Disagree,5,4,1,2,3,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,3,4,5,2,0,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Agree,Agree,2,5,3,4,1,0,Agree,Agree,Agree,Agree,Strongly Agree,2,3,1,5,4,TRUE,85,FALSE,59,TRUE,80,FALSE,50,FALSE,50,FALSE,50,TRUE,62,TRUE,50,TRUE,50,TRUE,84,TRUE,50,TRUE,100,TRUE,71,FALSE,50,TRUE,50,TRUE,50,TRUE,80,TRUE,61,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,100,TRUE,76,FALSE,50,TRUE,72,FALSE,50,TRUE,85,FALSE,50,TRUE,100,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,-1,-2,-3,3,-3,2,0,-3,3,2,2,2,2,3,2,3,3,3,3,3,-2,0,-3,-3,3,-3,1,0,0,-3,3,2,3,0,2,2,2,2,3,0,3,3,3,3,-2,0,-3,-3,3,-3,0,0,0,-3,3,2,2,0,2,2,2,2,3,0,TRUE,0,85,FALSE,0,59,TRUE,0,80,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,62,TRUE,1,50,TRUE,1,50,TRUE,1,84,TRUE,0,50,TRUE,0,100,TRUE,1,71,FALSE,1,50,TRUE,1,50,TRUE,1,50,TRUE,0,80,TRUE,0,61,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,FALSE,1,50,TRUE,0,72,FALSE,1,50,TRUE,1,85,FALSE,0,50,TRUE,1,100,0.25,0.0576,0.25,0.1444,0,0.25,0.25,0.0256,0.25,0.25,0.0225,0.0841,0.25,0.25,0.25,0.3481,0.25,0.25,0.5184,0,0.25,0.25,0.25,0.25,0.64,0.25,0.25,0.7225,0.64,0.3721,0.25,1,0.299046429,0.195021429,0.403071429,16,50,20,62.5,5,62.5,6,75,5,62.5,4,50,11,68.75,9,56.25,62.97,51.12,62.62,71,67.12,61.69,64.25,-12.5,0.47,-11.38,-12.38,8.5,17.12,-7.06,8,0,0,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0.2,0.4,0.2,0.2,0.2,0.6,0,0.2,0.25,0.25,0.25,0,0,0,0,-0.2,0.2,0,0,0,0,0,0,0,-2,-2,-1,0,0,0,0,2,-2,0,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,35,no additional comments,-1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,01DIR,3,5,7,8,4,9,2,1,6,3,4,2,1 +1014,R_1Rw3ETd8Vs3nQjm,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,3,2,5,4,Neither agree nor disagree,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,2,4,5,1,3,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,2,4,1,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,5,4,1,2,3,Strongly Agree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,3,4,5,2,1,4,Strongly agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,3,4,5,1,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,2,4,5,4,Disagree,Somewhat disagree,Disagree,Disagree,Disagree,2,5,4,1,3,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Strongly Agree,Agree,1,4,3,5,2,6,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,1,4,5,3,2,6,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,3,4,2,1,5,5,Disagree,Disagree,Disagree,Somewhat disagree,Disagree,2,3,4,1,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,TRUE,72,TRUE,78,TRUE,100,FALSE,63,TRUE,50,TRUE,88,FALSE,100,FALSE,58,FALSE,100,TRUE,96,TRUE,90,FALSE,50,FALSE,66,FALSE,64,TRUE,50,TRUE,100,FALSE,52,FALSE,100,TRUE,67,FALSE,50,FALSE,67,FALSE,73,TRUE,50,TRUE,84,TRUE,62,FALSE,100,TRUE,100,FALSE,50,FALSE,93,TRUE,79,FALSE,100,24,3,3,3,3,2,0,-2,-1,1,1,1,1,2,2,1,-1,0,0,-1,-3,3,1,1,2,-1,4,3,-2,1,-1,1,4,2,1,1,1,1,4,-2,-1,-2,-2,-2,3,2,2,2,3,2,6,-1,1,1,3,1,6,-1,1,2,1,0,5,-2,-2,-2,-1,-2,5,FALSE,1,100,TRUE,1,79,FALSE,1,93,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,62,TRUE,1,84,TRUE,1,50,FALSE,0,73,FALSE,1,67,FALSE,1,50,TRUE,1,67,FALSE,1,100,FALSE,0,52,TRUE,1,100,TRUE,0,50,FALSE,1,64,FALSE,1,66,FALSE,1,50,TRUE,1,90,TRUE,1,96,FALSE,1,100,FALSE,0,58,FALSE,1,100,TRUE,1,88,TRUE,0,50,FALSE,1,63,TRUE,0,100,TRUE,1,78,TRUE,1,72,TRUE,1,95,0.0256,0.0144,0,0.1444,0.0025,0,0.3364,0.5329,0.25,0.0016,0.0484,0.1089,0.25,0.1089,0,0.0441,0,0.25,0.1369,0,0.01,0.2704,0.1156,0,0.25,0.25,0.0784,0,0.0049,0.1296,1,0.25,0.158196429,0.138121429,0.178271429,24,75,26,81.25,6,75,6,75,7,87.5,7,87.5,13,81.25,13,81.25,76.47,60.75,87.75,85.38,72,77.75,75.19,-6.25,-4.78,-14.25,12.75,-2.12,-15.5,-3.5,-6.06,0,2,2,1,3,3,0,2,2,0,1,0,1,1,0,1,1,2,1,1,1,1,1,0,0,1,3,2,2,0,2,0,0,1,1,1,2,2,0,1,1.6,1.4,0.6,1.2,0.6,1.6,0.8,1.2,1.2,1.05,1.125,4,5.67,4.625,1,-0.2,-0.2,0,0.2,-2,-2,-1,-2,-1.67,0,1,0,-1,1,-1,1,-1,1,-1,1,-2,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,29,It was weird,0.375,0,0,0,1,1,0,0,0.67,01PfPsVL,02COC,02FUT,01ITEM,02REV,5,6,8,7,4,3,2,1,9,4,3,2,1 +1015,R_1d6tdK2seeQDtXb,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,5,4,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,4,1,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,2,4,3,1,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,3,4,2,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,3,4,2,1,5,6,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,5,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,2,5,3,1,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,3,4,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,5,Somewhat disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,4,2,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,5,4,2,1,TRUE,100,FALSE,50,FALSE,75,TRUE,50,TRUE,91,FALSE,100,TRUE,100,TRUE,100,FALSE,50,TRUE,75,FALSE,50,TRUE,75,TRUE,97,TRUE,95,FALSE,50,TRUE,91,TRUE,82,TRUE,88,FALSE,50,FALSE,50,FALSE,100,TRUE,100,FALSE,100,TRUE,90,TRUE,95,TRUE,91,FALSE,50,FALSE,98,TRUE,74,TRUE,80,FALSE,50,TRUE,88,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,-1,0,0,-2,-1,1,-1,1,0,0,2,0,3,-1,-1,0,-1,-1,3,3,-1,-1,0,4,-2,1,-1,0,0,6,-1,0,2,0,3,5,-1,-1,-1,-1,-1,5,3,3,-1,0,0,5,-1,-2,1,0,0,5,0,0,3,0,3,6,0,0,0,0,-1,5,TRUE,0,100,FALSE,0,50,FALSE,1,75,TRUE,0,50,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,TRUE,1,75,FALSE,1,50,TRUE,0,75,TRUE,1,97,TRUE,0,95,FALSE,0,50,TRUE,1,91,TRUE,0,82,TRUE,0,88,FALSE,1,50,FALSE,1,50,FALSE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,90,TRUE,0,95,TRUE,1,91,FALSE,1,50,FALSE,1,98,TRUE,0,74,TRUE,1,80,FALSE,0,50,TRUE,1,88,0,0.0081,0.0081,0,0.0144,0,0.01,0.0625,0.25,0,0.04,0.0009,0.25,0.25,0.0081,0.25,0,0.25,0.0004,0.9025,1,0.25,0.25,0.9025,0.6724,0.25,0.25,1,0.0625,0.7744,0.5476,0.5625,0.314667857,0.098992857,0.530342857,17,53.13,19,59.38,3,37.5,5,62.5,4,50,7,87.5,11,68.75,8,50,79.22,50,91.5,93,82.38,81.44,77,-6.25,19.84,12.5,29,43,-5.12,12.69,27,0,0,0,1,0,0,2,2,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0.2,1.2,0.2,0.2,0,0.8,0.2,0.6,0.45,0.4,0.425,5,5.33,5.125,0.2,0.4,0,-0.4,0.2,-1,1,-1,0,-0.33,1,1,1,-2,2,0,0,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,"Interesting survey, i just wish you'd share the answers to the questions with the person taking the survey",1,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,2,5,4,7,3,8,9,1,6,2,3,4,1 +1016,R_7g17tPigzefh9gq,32 - 38,American,,American,Female,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,5,1,2,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,1,4,3,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,3,2,1,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,5,1,4,3,4,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,1,4,2,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,5,4,3,8,Strongly disagree,Disagree,Disagree,Disagree,Disagree,4,5,3,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Somewhat agree,Somewhat disagree,Agree,5,2,4,3,1,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,5,1,2,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,5,4,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,4,3,2,TRUE,89,TRUE,77,TRUE,92,TRUE,50,TRUE,70,FALSE,82,TRUE,91,TRUE,94,TRUE,50,TRUE,82,FALSE,50,TRUE,85,TRUE,76,FALSE,60,TRUE,60,TRUE,82,TRUE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,71,TRUE,92,FALSE,82,TRUE,83,TRUE,50,TRUE,50,TRUE,50,TRUE,92,TRUE,50,TRUE,86,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,1,1,-1,1,-3,1,1,1,0,1,1,1,1,1,-2,0,0,0,-1,1,1,1,0,-1,4,-3,1,1,1,-1,4,1,1,1,1,1,3,-3,-2,-2,-2,-2,8,2,2,1,-1,2,4,0,0,1,1,1,2,1,0,1,1,1,3,1,1,1,1,0,8,TRUE,0,89,TRUE,1,77,TRUE,0,92,TRUE,0,50,TRUE,1,70,FALSE,1,82,TRUE,1,91,TRUE,1,94,TRUE,1,50,TRUE,1,82,FALSE,1,50,TRUE,0,85,TRUE,1,76,FALSE,1,60,TRUE,1,60,TRUE,1,82,TRUE,0,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,71,TRUE,1,92,FALSE,1,82,TRUE,1,83,TRUE,0,50,TRUE,0,50,TRUE,0,50,TRUE,1,92,TRUE,1,50,TRUE,1,86,0.0036,0.0289,0.0324,0.0081,0.0196,0.0324,0.0064,0.0324,0.25,0.25,0.0064,0.0576,0.25,0.25,0.09,0.0529,0.0841,0.25,0.25,0.0324,0.25,0.16,0.25,0.16,0.25,0.25,0.25,0.7921,0.8464,0.25,0.25,0.7225,0.226614286,0.116557143,0.336671429,27,84.38,22,68.75,6,75,5,62.5,6,75,5,62.5,15,93.75,7,43.75,68.62,54.62,66.88,73.38,79.62,74.06,63.19,15.63,-0.13,-20.38,4.38,-1.62,17.12,-19.69,19.44,1,0,0,1,2,0,0,0,0,1,0,0,0,0,0,1,2,2,2,1,0,1,0,0,1,3,1,0,0,1,0,1,0,0,0,3,1,1,1,1,0.8,0.2,0,1.6,0.4,1,0.2,1.4,0.65,0.75,0.7,3.67,3,4.5,0.4,-0.8,-0.2,0.2,-0.2,0,2,0,0,0.67,1,1,1,-1,1,1,-1,-1,1,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,No comments,0.75,0,0,0,1,1,1,0,1,03VLPfPs,02COC,01PAST,02DGEN,01DIR,6,3,5,8,9,7,4,1,2,4,3,2,1 +1017,R_7rAlOlV8H83Wb4g,32 - 38,American,,American,Female,Strongly agree,Strongly agree,Agree,Agree,Agree,3,2,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,2,5,4,3,1,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,2,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,5,3,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,4,1,2,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,1,3,5,2,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,4,5,1,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,3,1,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,2,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,57,TRUE,59,TRUE,100,FALSE,55,TRUE,59,FALSE,56,TRUE,78,TRUE,100,TRUE,100,TRUE,100,FALSE,57,TRUE,100,TRUE,96,FALSE,54,TRUE,57,TRUE,58,TRUE,59,TRUE,100,TRUE,64,FALSE,100,FALSE,52,FALSE,55,FALSE,100,TRUE,58,TRUE,83,TRUE,77,FALSE,53,TRUE,57,TRUE,83,TRUE,100,FALSE,58,TRUE,100,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,2,2,0,0,3,0,2,2,0,3,0,3,0,0,0,0,0,3,3,3,3,3,5,0,0,0,0,3,5,0,0,3,0,3,5,-3,-3,-3,-3,-3,5,3,3,3,3,3,5,0,0,3,0,3,5,0,0,3,0,3,5,0,0,0,0,0,5,FALSE,1,57,TRUE,1,59,TRUE,0,100,FALSE,1,55,TRUE,1,59,FALSE,1,56,TRUE,1,78,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,57,TRUE,0,100,TRUE,1,96,FALSE,1,54,TRUE,1,57,TRUE,1,58,TRUE,0,59,TRUE,0,100,TRUE,0,64,FALSE,1,100,FALSE,0,52,FALSE,0,55,FALSE,1,100,TRUE,1,58,TRUE,0,83,TRUE,1,77,FALSE,1,53,TRUE,0,57,TRUE,0,83,TRUE,1,100,FALSE,0,58,TRUE,1,100,0,0.0529,0.1764,0.0484,0,0.1936,0.1764,0,0,0.3025,0,0.0016,0,0.1849,0.1681,0.1681,0,0.2025,0.3249,0.6889,0.2704,0.1849,0.4096,0.2116,0.3481,0.2209,0.3364,0.1849,1,1,0.6889,1,0.295257143,0.099835714,0.490678571,4,12.5,21,65.63,6,75,5,62.5,5,62.5,5,62.5,13,81.25,8,50,74.53,62.88,75.62,75.5,84.12,75.44,73.62,-53.13,8.9,-12.12,13.12,13,21.62,-5.81,23.62,0,0,1,1,1,0,0,3,0,1,2,0,0,0,0,3,3,3,3,3,0,0,1,1,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0.6,0.8,0.4,3,0.6,0.2,0.4,0,1.2,0.3,0.75,5,5,5,0,0.6,0,3,0.2,0,0,0,0,0,2,2,0,0,0,0,0,2,-2,-2,2,2,10 cents,5 minutes,24 days,Female,Professional Degree (ex. JD/MD),37,N/A,0.75,0,1,0,1,0,1,0.33,0.67,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,9,2,5,4,8,6,7,1,3,2,4,3,1 +1018,R_7LXDbn4zZiDJuc9,32 - 38,American,,American,Female,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,3,2,5,1,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,3,1,5,2,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,2,1,4,5,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,5,3,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Somewhat agree,Agree,Strongly Agree,Strongly Agree,Agree,4,2,3,1,5,3,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,5,1,2,4,3,Strongly Agree,Agree,Strongly Agree,Agree,Somewhat Agree,5,4,1,2,3,9,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,3,1,4,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,1,3,7,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,5,2,3,4,5,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,1,5,3,2,6,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,4,1,2,3,FALSE,100,FALSE,91,TRUE,79,FALSE,77,TRUE,99,FALSE,99,TRUE,100,TRUE,100,TRUE,91,TRUE,99,FALSE,99,TRUE,100,TRUE,83,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,99,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,91,TRUE,100,FALSE,98,TRUE,98,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,3,2,3,3,3,2,3,2,3,2,3,2,3,3,2,3,1,2,3,3,2,4,3,3,3,2,2,3,3,2,3,2,1,3,3,3,2,3,2,9,2,2,3,3,3,5,3,3,2,3,2,7,2,3,3,3,2,5,3,2,3,2,3,6,FALSE,1,100,FALSE,0,91,TRUE,0,79,FALSE,1,77,TRUE,1,99,FALSE,1,99,TRUE,1,100,TRUE,1,100,TRUE,1,91,TRUE,1,99,FALSE,1,99,TRUE,0,100,TRUE,1,83,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,0,100,TRUE,1,99,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,91,TRUE,1,100,FALSE,0,98,TRUE,1,98,0,0,0,0,0.0004,0.0001,0.0001,0.0001,1,0,0,0.0289,0.0081,0.0001,0.0001,0.8281,1,0.0529,1,0,0,0,0,1,0,0,0.9604,0,0.6241,1,0.0081,1,0.303982143,0.208492857,0.399471429,25,78.13,23,71.88,6,75,7,87.5,6,75,4,50,14,87.5,9,56.25,96.97,94.5,96.25,99.88,97.25,97.38,96.56,6.25,25.09,19.5,8.75,24.88,47.25,9.88,40.31,1,1,1,0,1,1,0,0,1,0,0,0,0,0,2,1,0,1,1,1,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,1,0,0,0,0.8,0.4,0.4,0.8,0.4,0.4,0.8,0.4,0.6,0.5,0.55,3.33,5.67,5.25,0.4,0,-0.4,0.4,0,-1,-4,-2,3,-2.34,0,1,1,1,-1,1,-1,2,-2,2,-2,0,10 cents,25 minutes,47 days,Female,High School (or equivalent),37,,-0.5,0,0,1,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,8,3,5,9,4,6,7,1,2,3,4,2,1 +1019,R_1aQckAe7IKkR5Sh,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Agree,Strongly agree,Agree,Strongly disagree,1,2,3,5,4,Disagree,Somewhat agree,Disagree,Agree,Neither agree nor disagree,4,2,3,1,5,Somewhat Agree,Strongly Agree,Somewhat Agree,Somewhat Disagree,Agree,2,1,5,3,4,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Strongly disagree,2,5,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,4,2,3,5,6,Strongly disagree,Somewhat disagree,Strongly disagree,Somewhat agree,Strongly disagree,5,2,4,1,3,0,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,3,1,4,5,2,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,5,2,4,1,3,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,4,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,2,1,3,4,5,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,5,2,1,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,71,FALSE,82,FALSE,83,FALSE,70,TRUE,51,TRUE,92,FALSE,74,TRUE,97,FALSE,66,TRUE,70,TRUE,100,FALSE,86,FALSE,81,FALSE,95,FALSE,100,TRUE,99,TRUE,85,TRUE,100,TRUE,53,FALSE,83,FALSE,100,TRUE,97,TRUE,84,TRUE,67,TRUE,92,FALSE,81,TRUE,62,FALSE,55,FALSE,79,TRUE,88,TRUE,73,26,1,2,3,2,-3,-2,1,-2,2,0,1,3,1,-1,2,-1,0,-1,1,-3,2,2,2,2,0,2,-3,-1,-3,1,-3,6,1,3,0,0,2,0,-1,-1,-1,-1,-1,2,2,3,2,3,1,4,0,1,0,1,0,3,1,2,2,0,2,4,-1,-1,-1,1,-1,4,TRUE,0,73,TRUE,1,88,FALSE,1,79,FALSE,1,55,TRUE,1,62,FALSE,1,81,TRUE,1,92,TRUE,1,67,TRUE,1,84,TRUE,1,97,FALSE,1,100,FALSE,1,83,TRUE,1,53,TRUE,0,100,TRUE,1,85,TRUE,1,99,FALSE,1,100,FALSE,1,95,FALSE,1,81,FALSE,1,86,TRUE,1,100,TRUE,1,70,FALSE,1,66,TRUE,1,97,FALSE,1,74,TRUE,1,92,TRUE,0,51,FALSE,1,70,FALSE,1,83,FALSE,0,82,FALSE,0,71,TRUE,1,100,0.1089,0.0064,0.0001,0.0064,0,0.0361,0.0009,0.0009,0.0196,0.09,0.6724,0.2209,0.0256,0,0.1444,0.0144,0.1156,0.2025,0.09,0.0676,0,0.0225,0.0361,1,0,0.2601,0.5041,0.5329,0.0441,0.0025,0.0289,0.0289,0.148607143,0.110235714,0.186978571,26,81.25,27,84.38,6,75,8,100,6,75,7,87.5,14,87.5,13,81.25,81.75,76.88,80.62,86.62,82.88,83.69,79.81,-3.13,-2.63,1.88,-19.38,11.62,-4.62,-3.81,-1.44,1,0,1,0,3,1,2,1,1,3,0,0,1,1,0,0,1,0,2,2,1,1,1,1,4,2,0,2,1,0,0,1,1,1,0,0,1,0,0,2,1,1.6,0.4,1,1.6,1,0.6,0.6,1,0.95,0.975,2.67,3.67,3.125,-0.6,0.6,-0.2,0.4,-0.066666667,-2,3,-4,-2,-1,-1,2,1,2,-2,1,-1,2,-2,-2,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,25,Survey helped me remember my roots.,-0.125,1,1,1,0,0,0,1,0,02PsVLPf,02COC,02FUT,02DGEN,02REV,3,6,2,7,5,4,8,1,9,2,3,4,1 +1020,R_1dXtGZIn3kCFmTt,32 - 38,American,,American,Female,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,2,1,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,2,1,4,5,3,Somewhat agree,Somewhat agree,Agree,Strongly Agree,Strongly disagree,5,2,4,1,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Disagree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,5,4,1,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,4,3,10,Strongly Disagree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,2,4,1,3,5,10,Somewhat disagree,Disagree,Somewhat agree,Strongly disagree,Strongly Agree,4,5,2,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,1,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Neither agree nor disagree,4,5,1,3,2,4,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,4,3,5,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,1,5,2,4,3,TRUE,50,TRUE,50,FALSE,100,FALSE,50,FALSE,50,FALSE,100,TRUE,76,TRUE,100,TRUE,50,TRUE,100,FALSE,71,TRUE,100,TRUE,75,TRUE,50,FALSE,50,TRUE,76,TRUE,50,TRUE,100,TRUE,80,FALSE,50,TRUE,71,TRUE,50,FALSE,50,TRUE,100,TRUE,85,TRUE,100,FALSE,50,TRUE,76,TRUE,80,TRUE,100,FALSE,50,TRUE,85,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,3,3,3,-1,-2,0,0,1,0,-3,1,0,3,1,1,2,3,-3,-2,3,3,-2,3,10,1,1,1,1,1,5,-3,3,3,3,-3,10,-1,-2,1,-3,3,10,3,3,3,3,3,5,0,0,2,-2,0,5,0,-3,1,0,1,4,3,3,3,3,-3,5,TRUE,0,50,TRUE,1,50,FALSE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,76,TRUE,1,100,TRUE,1,50,TRUE,1,100,FALSE,1,71,TRUE,0,100,TRUE,1,75,TRUE,0,50,FALSE,0,50,TRUE,1,76,TRUE,0,50,TRUE,0,100,TRUE,0,80,FALSE,1,50,TRUE,1,71,TRUE,1,50,FALSE,1,50,TRUE,1,100,TRUE,0,85,TRUE,1,100,FALSE,1,50,TRUE,0,76,TRUE,0,80,TRUE,1,100,FALSE,0,50,TRUE,1,85,0,0,0.0576,0.0576,0.0225,0,0,0,0.25,0.25,0,0.0625,0.25,0.0841,0.25,0.25,0.25,0.25,0.5776,0.7225,0.0841,0.25,0.64,0.25,0.25,0.25,0.25,0.25,0,1,0.64,1,0.288689286,0.137078571,0.4403,16,50,20,62.5,5,62.5,5,62.5,4,50,6,75,13,81.25,7,43.75,72.66,56.38,70.12,76.38,87.75,73.94,71.38,-12.5,10.16,-6.12,7.62,26.38,12.75,-7.31,27.63,3,2,0,5,0,2,3,1,1,0,3,6,2,3,6,2,3,1,6,6,2,2,0,0,0,1,2,2,2,1,0,0,0,0,2,2,2,1,0,0,2,1.4,4,3.6,0.8,1.6,0.4,1,2.75,0.95,1.85,8.33,4.67,6.75,1.2,-0.2,3.6,2.6,1.533333333,5,0,6,5,3.66,0,2,0,-1,1,2,-2,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),36,,0.125,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,01DIR,3,9,4,6,7,2,5,1,8,4,3,2,1 +1021,R_1rkBy9CAGranra9,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,4,1,3,Somewhat agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,1,5,2,4,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly Agree,2,5,4,3,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,3,5,2,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,5,1,4,3,4,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,2,5,1,3,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,4,2,5,1,4,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,4,2,3,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,5,3,4,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,3,2,4,5,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Disagree,3,5,2,4,1,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,85,FALSE,50,FALSE,55,FALSE,50,TRUE,65,FALSE,65,TRUE,55,TRUE,60,FALSE,50,TRUE,65,FALSE,50,FALSE,70,TRUE,55,FALSE,90,TRUE,55,TRUE,98,FALSE,55,TRUE,70,TRUE,55,FALSE,60,TRUE,90,TRUE,85,FALSE,50,TRUE,50,FALSE,55,FALSE,55,TRUE,50,FALSE,55,FALSE,50,FALSE,60,FALSE,50,TRUE,80,18,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,1,1,0,1,1,-1,-1,0,1,0,0,1,1,3,-1,0,0,1,-2,1,1,1,0,1,4,0,-1,0,0,1,3,0,1,1,1,2,4,2,0,0,0,-1,5,1,1,1,1,0,4,0,1,0,1,0,5,0,1,1,1,2,4,-1,-1,-1,0,-2,6,TRUE,0,85,FALSE,0,50,FALSE,1,55,FALSE,1,50,TRUE,1,65,FALSE,1,65,TRUE,1,55,TRUE,1,60,FALSE,0,50,TRUE,1,65,FALSE,1,50,FALSE,1,70,TRUE,1,55,FALSE,1,90,TRUE,1,55,TRUE,1,98,FALSE,1,55,TRUE,0,70,TRUE,0,55,FALSE,1,60,TRUE,1,90,TRUE,1,85,FALSE,1,50,TRUE,1,50,FALSE,1,55,FALSE,0,55,TRUE,0,50,FALSE,1,55,FALSE,1,50,FALSE,0,60,FALSE,0,50,TRUE,1,80,0.16,0.3025,0.0004,0.2025,0.04,0.1225,0.25,0.1225,0.16,0.0225,0.36,0.2025,0.25,0.25,0.1225,0.25,0.25,0.25,0.2025,0.2025,0.01,0.2025,0.3025,0.01,0.2025,0.25,0.25,0.7225,0.2025,0.49,0.25,0.09,0.215714286,0.189464286,0.241964286,18,56.25,23,71.88,3,37.5,8,100,5,62.5,7,87.5,11,68.75,12,75,62.12,51.25,63.75,70,63.5,63.94,60.31,-15.63,-9.76,13.75,-36.25,7.5,-24,-4.81,-14.69,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,3,0,0,1,1,0,0,0,1,1,1,2,1,1,1,0,1,0,0,1,0,1,1,1,0,0,0.4,0.4,1,0.4,1.2,0.4,0.6,0.45,0.65,0.55,3.67,4.33,4.375,-0.4,-0.8,0,0.4,-0.4,0,-2,0,-1,-0.66,1,2,0,-2,2,-1,1,-1,1,-2,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,37,"I found this survey very interesting! If such information can be shared, I would be curious to see my own results, as well as the purpose of the study, and what the study found. Thank-you! I3T.",1.125,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,01ITEM,01DIR,2,8,3,5,6,4,7,1,9,4,3,2,1 +1022,R_6p3WA5U38zr1qOW,32 - 38,American,,American,Female,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,5,2,3,1,Strongly disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,3,1,5,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,1,3,4,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,5,2,4,1,Agree,Strongly Agree,Agree,Somewhat agree,Somewhat agree,3,1,4,5,2,5,Strongly disagree,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,5,3,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,2,5,3,5,Somewhat disagree,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,1,3,2,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Strongly Agree,Agree,Neither agree nor disagree,Agree,4,3,5,1,2,5,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,3,4,5,2,1,5,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,1,2,4,5,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,4,1,2,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,53,FALSE,50,TRUE,86,FALSE,59,TRUE,50,FALSE,100,FALSE,50,TRUE,85,TRUE,64,TRUE,100,FALSE,62,TRUE,81,TRUE,80,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,80,FALSE,50,FALSE,50,TRUE,75,FALSE,50,TRUE,74,FALSE,50,FALSE,50,TRUE,85,FALSE,50,TRUE,69,FALSE,50,TRUE,50,FALSE,50,FALSE,50,6,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,2,2,1,0,-3,0,2,2,0,0,0,2,0,2,1,0,1,0,-1,2,3,2,1,1,5,-3,0,1,3,0,5,0,0,1,0,1,5,-1,-1,-3,-2,-3,5,0,3,2,0,2,5,-2,0,2,1,0,5,0,2,2,0,2,5,2,0,1,1,0,5,TRUE,0,53,FALSE,0,50,TRUE,0,86,FALSE,1,59,TRUE,1,50,FALSE,1,100,FALSE,0,50,TRUE,1,85,TRUE,1,64,TRUE,1,100,FALSE,1,62,TRUE,0,81,TRUE,1,80,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,80,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,0,74,FALSE,0,50,FALSE,1,50,TRUE,1,85,FALSE,1,50,TRUE,0,69,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,0,50,0.0225,0.0225,0.25,0.25,0.25,0,0.25,0,0.25,0.25,0.25,0.04,0.1296,0.1444,0.25,0.25,0.5476,0.1681,0.4761,0.25,0.0625,0.25,0.25,0.25,0.25,0.25,0.25,0.2809,0.7396,0.64,0.25,0.6561,0.272675,0.19855,0.3468,6,18.75,19,59.38,5,62.5,6,75,4,50,4,50,9,56.25,10,62.5,62.59,54.38,66.12,64.75,65.12,61.81,63.38,-40.63,3.21,-8.12,-8.88,14.75,15.12,5.56,0.88,1,1,0,0,1,0,0,1,1,0,0,0,1,0,1,2,1,4,2,2,1,1,0,1,2,1,0,0,1,0,0,2,0,0,0,1,0,0,1,1,0.6,0.4,0.4,2.2,1,0.4,0.4,0.6,0.9,0.6,0.75,5,5,5,-0.4,0,0,1.6,-0.133333333,0,0,0,0,0,1,1,0,-1,1,2,-2,0,0,0,0,-1,10 cents,100 minutes,47 days,Female,High School (or equivalent),32,this was a cool survey,0,0,0,1,1,1,0,0.33,0.67,01PfPsVL,01EOHI,02FUT,01ITEM,01DIR,2,4,5,7,3,9,6,1,8,3,4,2,1 +1023,R_5jqsnVaFyqCV394,32 - 38,American,,American,Female,Agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat disagree,3,1,4,2,5,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,5,2,1,4,3,Somewhat Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,2,3,5,Strongly disagree,Disagree,Strongly disagree,Disagree,Strongly disagree,5,1,2,3,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly disagree,Somewhat agree,1,2,3,5,4,6,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,Somewhat agree,4,1,2,5,3,5,Agree,Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,2,5,1,3,8,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,2,4,1,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Somewhat disagree,4,5,1,2,3,3,Strongly disagree,Disagree,Agree,Strongly disagree,Agree,4,5,3,1,2,3,Disagree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,4,2,1,3,10,Agree,Agree,Strongly Agree,Strongly Agree,Disagree,5,4,1,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,55,FALSE,76,FALSE,60,FALSE,76,FALSE,50,TRUE,80,FALSE,100,TRUE,100,FALSE,75,TRUE,70,TRUE,86,FALSE,50,TRUE,73,TRUE,68,FALSE,70,TRUE,91,TRUE,72,TRUE,78,TRUE,75,TRUE,100,FALSE,67,TRUE,90,TRUE,96,TRUE,93,TRUE,100,FALSE,74,TRUE,100,TRUE,70,TRUE,67,FALSE,68,FALSE,100,21,2,3,3,-3,-1,-3,0,-1,-1,1,-1,-3,3,1,3,-3,-2,-3,-2,-3,3,3,3,-3,1,4,-3,1,-2,1,1,6,2,-2,3,1,3,5,-3,-3,-3,1,-3,8,3,3,3,1,-1,2,-3,-2,2,-3,2,3,-2,-2,3,1,3,3,2,2,3,3,-2,10,FALSE,1,100,FALSE,0,68,TRUE,0,67,TRUE,0,70,TRUE,1,100,FALSE,1,74,TRUE,1,100,TRUE,1,93,TRUE,1,96,TRUE,1,90,FALSE,1,67,TRUE,0,100,TRUE,1,75,TRUE,0,78,TRUE,1,72,TRUE,1,91,FALSE,1,70,TRUE,0,68,TRUE,0,73,FALSE,1,50,TRUE,1,86,TRUE,1,70,FALSE,1,75,TRUE,1,100,FALSE,1,100,TRUE,1,80,FALSE,1,50,FALSE,1,76,FALSE,1,60,FALSE,0,76,FALSE,0,55,TRUE,1,100,0.0049,0.04,0.0081,0,0,0.0676,0,0.01,0.25,0.09,0.5776,0.0625,0.0016,0.1089,0,0.4624,0.0625,0.49,0.0576,0,0.0196,0.0784,0.5329,0.6084,0.09,0.25,0.3025,0,0.4489,0.4624,0.16,1,0.221207143,0.155935714,0.286478571,21,65.63,23,71.88,4,50,8,100,6,75,5,62.5,13,81.25,10,62.5,79.06,68.88,80,85.75,81.62,84.5,73.62,-6.25,7.18,18.88,-20,10.75,19.12,3.25,11.12,1,0,0,0,2,0,1,1,2,0,3,1,0,0,0,0,1,0,3,0,1,0,0,4,0,0,2,3,2,1,1,1,0,0,0,5,4,6,5,1,0.6,0.8,0.8,0.8,1,1.6,0.4,4.2,0.75,1.8,1.275,5,2.67,5.125,-0.4,-0.8,0.4,-3.4,-0.266666667,2,3,2,-2,2.33,0,0,1,-2,2,-1,1,-1,1,-2,2,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,33,This survey could be shorter.,0.75,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,02REV,4,7,9,2,3,5,6,1,8,3,4,2,1 +1024,R_7DZP5dCxwcF7leI,32 - 38,American,,American,Female,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,1,2,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,1,4,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,2,4,Agree,Strongly Agree,Agree,Neither agree nor disagree,Agree,3,1,2,5,4,4,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,3,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,3,5,1,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Neither agree nor disagree,Agree,2,1,3,4,5,2,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,3,4,1,2,3,Agree,Agree,Agree,Somewhat Disagree,Agree,3,5,4,1,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,56,TRUE,50,FALSE,69,FALSE,50,TRUE,61,FALSE,100,TRUE,66,TRUE,65,TRUE,50,TRUE,61,FALSE,50,TRUE,66,TRUE,50,FALSE,88,TRUE,50,TRUE,99,TRUE,54,FALSE,50,TRUE,54,FALSE,50,FALSE,50,TRUE,50,FALSE,100,TRUE,91,FALSE,93,TRUE,64,FALSE,50,FALSE,50,TRUE,67,TRUE,53,FALSE,50,TRUE,100,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,1,0,1,-1,-1,0,0,0,1,1,2,-1,2,0,0,0,0,0,2,3,2,0,2,4,-1,-1,0,0,0,3,2,1,2,-1,2,3,0,0,0,0,0,4,2,2,2,0,2,2,0,-1,0,0,1,3,2,2,2,-1,2,3,0,0,0,0,0,4,TRUE,0,56,TRUE,1,50,FALSE,1,69,FALSE,1,50,TRUE,1,61,FALSE,1,100,TRUE,1,66,TRUE,1,65,TRUE,1,50,TRUE,1,61,FALSE,1,50,TRUE,0,66,TRUE,1,50,FALSE,1,88,TRUE,1,50,TRUE,1,99,TRUE,0,54,FALSE,1,50,TRUE,0,54,FALSE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,100,TRUE,1,91,FALSE,1,93,TRUE,1,64,FALSE,1,50,FALSE,1,50,TRUE,0,67,TRUE,1,53,FALSE,0,50,TRUE,1,100,0.1225,0.1296,0.0001,0.1156,0,0,0.0081,0.1521,0.25,0.25,0.2209,0.25,0.25,0.25,0.1521,0.25,0,0.25,0.25,0.0049,0.25,0.25,0.2916,0.0144,0.2916,0.25,0.25,0.3136,0.0961,0.25,0.4489,0.4356,0.202853571,0.163085714,0.242621429,14,43.75,25,78.13,6,75,5,62.5,7,87.5,7,87.5,14,87.5,11,68.75,64.28,50.5,72.75,66,67.88,63.12,65.44,-34.38,-13.85,-24.5,10.25,-21.5,-19.62,-24.38,-3.31,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0.4,0,0.2,0,0.6,0.4,0.4,0,0.15,0.35,0.25,3.33,2.67,3.25,-0.2,-0.4,-0.2,0,-0.266666667,2,0,0,0,0.66,0,0,0,-1,1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,none,0.125,0,0,0,1,1,1,0,1,01PfPsVL,02COC,02FUT,01ITEM,01DIR,8,4,7,5,2,6,9,1,3,3,4,2,1 +1025,R_5WmT9o59K4UskO5,25 - 31,American,,American,Female,Strongly agree,Somewhat agree,Agree,Strongly agree,Strongly agree,2,3,5,1,4,Strongly agree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,3,2,4,1,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,2,4,1,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,2,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,2,3,5,0,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,3,5,4,1,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,3,2,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,0,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,3,4,1,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,4,5,0,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,98,TRUE,100,TRUE,60,TRUE,100,TRUE,100,FALSE,100,32,3,1,2,3,3,3,2,3,1,3,3,2,3,3,3,3,2,3,3,3,3,3,3,3,3,0,3,3,3,2,3,0,3,3,3,2,3,1,3,3,3,3,3,1,3,3,3,3,3,0,3,3,3,2,3,0,3,3,3,3,3,0,3,3,3,3,3,0,FALSE,1,100,TRUE,1,100,TRUE,0,100,TRUE,0,60,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,100,FALSE,0,100,TRUE,1,100,0,0,0,0,0,0.0004,0,0,0,0,1,0,0,0,0,0,0,0.36,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0.191442857,0.097171429,0.285714286,32,100,26,81.25,6,75,8,100,7,87.5,5,62.5,14,87.5,12,75,98.69,95,99.75,100,100,100,97.38,18.75,17.44,20,-0.25,12.5,37.5,12.5,22.38,0,2,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,2,1,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0.6,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0.4,0.35,0.375,0.33,0,0.25,0,0,0.2,0,0.066666667,0,0,1,1,0.33,-2,2,2,-2,2,0,0,2,-2,0,0,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),26,THE SURVEY WAS EDUCATIVE I HAVE REALLY ENJOYED IT,0.5,0,0,0,1,1,1,0,1,03VLPfPs,02COC,02FUT,02DGEN,02REV,6,5,9,3,2,8,7,1,4,2,4,3,1 +1026,R_6exAZhaAxlvYZc2,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat disagree,Agree,5,1,3,2,4,Somewhat agree,Disagree,Agree,Somewhat disagree,Somewhat agree,1,3,2,4,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,2,1,3,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,5,2,4,3,Agree,Agree,Agree,Disagree,Agree,1,2,3,5,4,6,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,3,4,5,1,2,6,Agree,Somewhat Agree,Agree,Agree,Agree,2,1,3,5,4,7,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,3,4,5,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat disagree,Agree,4,5,2,1,3,6,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,2,5,3,1,6,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,5,4,2,3,6,Agree,Agree,Agree,Agree,Somewhat agree,2,3,5,1,4,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,68,FALSE,79,TRUE,70,FALSE,100,FALSE,50,TRUE,92,FALSE,100,FALSE,50,FALSE,50,TRUE,100,TRUE,70,FALSE,50,FALSE,50,FALSE,100,TRUE,59,TRUE,100,TRUE,70,TRUE,100,TRUE,100,TRUE,91,TRUE,85,TRUE,100,TRUE,62,TRUE,100,TRUE,100,FALSE,100,TRUE,85,FALSE,50,TRUE,76,FALSE,50,TRUE,81,23,2,2,2,-1,2,1,-2,2,-1,1,1,2,2,1,1,1,2,2,2,1,2,2,2,-2,2,6,1,-2,2,0,1,6,2,1,2,2,2,7,-1,2,1,-1,-1,8,2,2,2,-1,2,6,1,-1,2,-1,1,6,2,1,2,0,2,6,2,2,2,2,1,6,TRUE,0,81,FALSE,0,50,TRUE,0,76,FALSE,1,50,TRUE,1,85,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,62,TRUE,1,100,TRUE,0,85,TRUE,0,91,TRUE,1,100,TRUE,0,100,TRUE,1,70,TRUE,1,100,TRUE,0,59,FALSE,1,100,FALSE,1,50,FALSE,1,50,TRUE,1,70,TRUE,1,100,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,92,FALSE,1,50,FALSE,1,100,TRUE,0,70,FALSE,0,79,TRUE,1,68,TRUE,1,100,0,0.0064,0,0,0,0,0.25,0,0.25,0,0.6241,0,0.1444,0.7225,0.0225,0.25,0.25,0.25,0,0,0.09,0.09,0.25,1,0.3481,0.25,0.1024,0.6561,0.5776,0,0.49,0.8281,0.265921429,0.197392857,0.33445,23,71.88,22,68.75,6,75,6,75,6,75,4,50,13,81.25,9,56.25,79.31,60.62,79.25,96.62,80.75,82.88,75.75,3.13,10.56,-14.38,4.25,21.62,30.75,1.63,19.5,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,2,0,1,3,2,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0.2,0.2,0.8,1.6,0,0.2,0.8,0.2,0.7,0.3,0.5,6.33,6,6.375,0.2,0,0,1.4,0.066666667,0,0,1,2,0.33,0,2,1,-1,1,0,0,-1,1,-2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,32,,1,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,01PAST,01ITEM,02REV,2,8,3,6,5,4,7,1,9,2,4,3,1 +1027,R_7xJjBlv5ONJ8eTV,32 - 38,,Canadian,Canadian,Male,Disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,2,1,4,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,1,3,5,4,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,1,3,5,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,Disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,2,3,1,5,4,2,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,2,5,4,1,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,4,1,5,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,1,3,5,2,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,1,2,5,4,3,2,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,2,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,1,4,5,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,75,TRUE,100,FALSE,60,TRUE,81,TRUE,66,TRUE,66,FALSE,70,TRUE,73,TRUE,67,FALSE,74,TRUE,61,FALSE,61,TRUE,71,FALSE,64,TRUE,64,TRUE,74,FALSE,63,TRUE,81,TRUE,63,TRUE,76,FALSE,67,TRUE,83,FALSE,77,TRUE,76,TRUE,74,FALSE,73,FALSE,66,FALSE,64,FALSE,70,FALSE,73,TRUE,73,17,-2,1,1,2,0,-1,-1,1,-2,0,1,-1,1,0,0,0,-1,-1,0,0,-2,1,2,2,0,2,-2,-2,1,-2,0,2,1,0,1,0,1,3,-1,-1,-1,-1,-1,4,-1,0,2,2,0,2,0,-2,1,0,1,3,0,0,0,0,0,2,0,0,0,0,-1,2,TRUE,0,73,FALSE,0,73,FALSE,1,70,FALSE,1,64,FALSE,0,66,FALSE,1,73,TRUE,1,74,TRUE,1,76,FALSE,0,77,TRUE,1,83,FALSE,1,67,TRUE,0,76,TRUE,1,63,TRUE,0,81,FALSE,0,63,TRUE,1,74,TRUE,0,64,FALSE,1,64,TRUE,0,71,FALSE,1,61,TRUE,1,61,FALSE,0,74,TRUE,0,67,TRUE,1,73,FALSE,1,70,TRUE,1,66,TRUE,0,66,TRUE,0,81,FALSE,1,60,TRUE,1,100,FALSE,0,75,TRUE,1,100,0.0576,0.1156,0.0676,0.0676,0,0.0729,0.0729,0.0289,0.1521,0.5476,0,0.1369,0.5929,0.1089,0.4356,0.5329,0.4489,0.1296,0.6561,0.09,0.1521,0.3969,0.5041,0.6561,0.4096,0.4356,0.5625,0.5329,0.09,0.1296,0.16,0.5776,0.307614286,0.232864286,0.382364286,17,53.13,18,56.25,2,25,5,62.5,5,62.5,6,75,10,62.5,8,50,72.06,69.5,69.25,73.12,76.38,74.88,69.25,-3.12,15.81,44.5,6.75,10.62,1.38,12.38,19.25,0,0,1,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,1,1,1,1,0,0,1,1,0,2,1,1,1,1,0,0,0,1,1,0,1,0.2,0.4,0.4,0.6,0.6,1,0.6,0.6,0.4,0.7,0.55,2.33,2.33,2.5,-0.4,-0.6,-0.2,0,-0.4,0,-1,1,2,0,0,0,1,-1,1,1,-1,-1,1,-1,1,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,37,NONE,0.25,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,01ITEM,02REV,2,7,5,3,4,6,9,1,8,2,3,4,1 +1028,R_5UadrYih4hlHoMK,25 - 31,American,,American,Female,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,1,2,5,4,3,Somewhat disagree,Strongly agree,Agree,Somewhat disagree,Agree,4,1,5,3,2,Strongly Agree,Strongly Agree,Agree,Somewhat Agree,Strongly Agree,3,5,4,1,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat disagree,Strongly Agree,Strongly Agree,Strongly Agree,Neither agree nor disagree,3,4,5,1,2,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,8,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,1,5,2,3,8,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,5,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Somewhat disagree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,4,1,2,5,7,Agree,Agree,Strongly agree,Somewhat disagree,Agree,5,2,4,3,1,7,Strongly agree,Strongly agree,Agree,Somewhat Agree,Somewhat Agree,5,4,2,1,3,6,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,1,5,2,4,FALSE,94,TRUE,94,TRUE,99,FALSE,68,TRUE,66,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,99,TRUE,100,TRUE,100,TRUE,72,FALSE,91,TRUE,60,TRUE,89,TRUE,55,TRUE,78,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,87,TRUE,68,TRUE,67,TRUE,68,FALSE,62,FALSE,75,TRUE,100,TRUE,69,TRUE,84,TRUE,100,21,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,2,3,2,-1,3,2,-1,2,3,3,2,1,3,-1,-1,0,0,-1,-1,3,3,3,0,7,1,-1,1,1,1,7,1,1,2,0,3,8,1,0,1,1,0,8,-1,3,3,2,3,8,2,2,3,-1,2,7,3,3,2,1,1,7,2,1,1,2,1,6,FALSE,1,94,TRUE,1,94,TRUE,0,99,FALSE,1,68,TRUE,1,66,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,99,TRUE,0,100,TRUE,0,100,TRUE,1,72,FALSE,1,91,TRUE,1,60,TRUE,1,89,TRUE,0,55,TRUE,0,78,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,87,TRUE,1,68,TRUE,0,67,TRUE,1,68,FALSE,1,62,FALSE,1,75,TRUE,0,100,TRUE,1,69,TRUE,1,84,TRUE,1,100,0,0.1024,0.0121,0,0,0,0.1024,0.0001,1,0,0.0961,0.0784,0,1,0.1156,0.0036,0.0169,0.1024,0.0625,0.4489,0,0.16,1,0.0081,0.3025,0.1444,0.0256,0.0036,0.9801,0.6084,1,1,0.294985714,0.179678571,0.410292857,21,65.63,23,71.88,6,75,6,75,6,75,5,62.5,16,100,7,43.75,85.78,83.5,85,87.12,87.5,85.56,86,-6.25,13.9,8.5,10,12.12,25,-14.44,42.25,2,0,1,0,2,2,4,1,2,1,2,2,0,1,0,2,1,1,1,1,2,0,1,1,1,3,1,1,0,0,0,0,0,0,2,3,2,1,2,2,1,2,1,1.2,1,1,0.4,2,1.3,1.1,1.2,7.33,7.33,7.25,0,1,0.6,-0.8,0.533333333,-1,0,1,2,0,-1,1,1,-2,2,2,-2,1,-1,1,-1,1,5 cents,5 minutes,47 days,Female,Professional Degree (ex. JD/MD),29,i liked this survey .,0,1,1,1,0,0,0,1,0,04LPfPsV,02COC,02FUT,02DGEN,01DIR,8,4,3,6,5,2,9,1,7,2,4,3,1 +1029,R_71XWLkqv67mo4XO,18 - 24,American,,American,Female,Disagree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,5,2,3,4,1,Neither agree nor disagree,Agree,Strongly disagree,Strongly agree,Somewhat agree,2,3,4,5,1,Strongly Disagree,Somewhat Disagree,Strongly Agree,Strongly Agree,Somewhat Agree,3,2,4,5,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Somewhat agree,Strongly Agree,Agree,Strongly disagree,Strongly Agree,1,2,3,5,4,10,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,3,2,5,1,4,10,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,4,2,1,3,5,10,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly disagree,Strongly Agree,Strongly Agree,Somewhat disagree,Somewhat agree,4,1,2,5,3,7,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,3,4,5,1,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,3,5,2,1,7,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Somewhat disagree,5,1,2,4,3,FALSE,100,TRUE,64,FALSE,89,TRUE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,74,FALSE,50,TRUE,50,TRUE,50,TRUE,85,FALSE,50,TRUE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,60,FALSE,100,FALSE,100,TRUE,50,FALSE,100,TRUE,100,FALSE,87,FALSE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,3,3,-1,3,0,2,-3,3,1,-3,-1,3,3,1,-3,-3,-3,-3,-3,1,3,2,-3,3,10,3,3,-3,3,3,10,-3,3,-3,3,-3,10,1,0,0,-3,-3,10,-3,3,3,-1,1,2,0,2,-1,0,2,7,0,0,2,1,0,6,0,2,1,-2,-1,7,FALSE,1,100,TRUE,1,64,FALSE,1,89,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,0,50,FALSE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,100,FALSE,1,74,FALSE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,85,FALSE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,60,FALSE,1,100,FALSE,0,100,TRUE,0,50,FALSE,1,100,TRUE,0,100,FALSE,0,87,FALSE,0,50,TRUE,1,100,0,1,0.25,0,0,0,0.16,1,0.25,0,0.7569,0,0.25,0.25,0,0.1296,0,0.25,0,0,0,0.25,0.25,0.0676,0.25,0.25,0.25,0,0.0121,0.7225,1,0,0.217810714,0.217607143,0.218014286,25,78.13,19,59.38,2,25,6,75,5,62.5,6,75,10,62.5,9,56.25,79.97,51.75,93.75,94.88,79.5,81.94,78,18.75,20.59,26.75,18.75,32.38,4.5,19.44,21.75,3,0,1,2,0,3,1,0,0,2,0,4,6,0,4,4,3,3,0,0,1,0,0,0,2,0,0,2,3,1,3,1,1,2,1,3,5,4,1,2,1.2,1.2,2.8,2,0.6,1.2,1.6,3,1.8,1.6,1.7,10,5,7.75,0.6,0,1.2,-1,0.6,8,3,4,3,5,2,2,0,-2,2,0,0,-1,1,-2,2,2,5 cents,5 minutes,47 days,Female,High School (or equivalent),22,na,1.375,1,1,1,0,0,0,1,0,01PfPsVL,02COC,02FUT,02DGEN,01DIR,7,2,3,4,9,5,6,1,8,3,2,4,1 +1030,R_3PjaFDfG3yfrr8e,32 - 38,American,,American,Female,Strongly disagree,Agree,Agree,Neither agree nor disagree,Somewhat agree,2,3,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,2,4,5,3,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly disagree,Agree,Somewhat agree,Neither agree nor disagree,Strongly Agree,4,2,3,5,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,5,3,2,1,4,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,4,5,3,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,2,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,5,2,4,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,TRUE,74,TRUE,54,TRUE,100,FALSE,100,TRUE,81,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,93,TRUE,71,FALSE,75,TRUE,100,TRUE,54,TRUE,100,TRUE,66,FALSE,100,TRUE,78,FALSE,71,FALSE,94,TRUE,100,FALSE,65,TRUE,100,TRUE,81,FALSE,100,FALSE,61,FALSE,62,FALSE,100,FALSE,68,FALSE,64,14,-3,2,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,-2,0,-3,2,1,0,3,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,4,FALSE,1,64,FALSE,0,68,FALSE,1,100,FALSE,1,62,FALSE,0,61,FALSE,1,100,TRUE,1,81,TRUE,1,100,FALSE,0,65,TRUE,1,100,FALSE,1,94,FALSE,1,71,TRUE,1,78,FALSE,1,100,TRUE,1,66,TRUE,1,100,TRUE,0,54,TRUE,0,100,FALSE,1,75,TRUE,0,71,FALSE,0,93,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,81,FALSE,1,100,TRUE,0,100,TRUE,0,54,TRUE,1,74,TRUE,1,100,TRUE,1,100,0,0.0361,0,0.0361,0,0,0,0,0.5041,0,0.0676,0.0484,0.4225,0.0036,0.3721,0.4624,0,0.1444,1,0,0.8649,0.1156,0.0625,0,0.2916,0,0,0.1296,0,1,0.2916,0.0841,0.209464286,0.14465,0.274278571,14,43.75,23,71.88,6,75,4,50,7,87.5,6,75,12,75,11,68.75,84.75,78.75,80,90.75,89.5,85.44,84.06,-28.13,12.87,3.75,30,3.25,14.5,10.44,15.31,0,0,1,0,2,0,0,0,3,0,0,0,1,0,0,0,0,0,2,0,3,2,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0.6,0.6,0.2,0.4,1.6,0,0.2,0.4,0.45,0.55,0.5,0,6.67,3,-1,0.6,0,0,-0.133333333,0,-10,-10,-4,-6.67,0,0,0,-2,2,0,0,0,0,2,-2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),34,nothing.,0,0,0,0,1,1,1,0,1,02PsVLPf,01EOHI,01PAST,02DGEN,02REV,4,6,2,8,9,5,7,1,3,2,3,4,1 +1031,R_1CKeGCl62iyVvge,18 - 24,,Canadian,Canadian,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,3,1,5,Somewhat disagree,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,3,5,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,3,4,5,2,1,Disagree,Strongly disagree,Somewhat disagree,Somewhat disagree,Agree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,2,3,5,1,4,5,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,5,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,4,2,1,5,3,5,Disagree,Strongly disagree,Somewhat disagree,Disagree,Neither agree nor disagree,3,4,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,5,4,1,3,2,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,2,4,3,1,5,8,Strongly agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,3,4,1,2,5,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,Somewhat disagree,1,2,4,5,3,TRUE,100,TRUE,75,TRUE,80,FALSE,75,FALSE,50,TRUE,80,TRUE,90,FALSE,50,FALSE,70,FALSE,50,TRUE,80,TRUE,90,TRUE,85,FALSE,50,FALSE,50,TRUE,90,TRUE,75,TRUE,75,FALSE,64,FALSE,50,TRUE,75,TRUE,80,TRUE,75,FALSE,50,FALSE,50,TRUE,70,FALSE,50,FALSE,50,FALSE,50,TRUE,80,TRUE,80,TRUE,85,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,3,2,3,-1,2,0,3,1,3,3,3,1,1,-2,-3,-1,-1,2,1,2,2,0,2,5,1,0,2,0,1,5,3,1,1,2,2,5,-2,-3,-1,-2,0,5,2,1,2,0,2,4,-1,0,0,3,1,7,3,1,2,1,1,8,-2,-3,-3,-3,-1,5,TRUE,0,100,TRUE,1,75,TRUE,0,80,FALSE,1,75,FALSE,0,50,TRUE,0,80,TRUE,1,90,FALSE,0,50,FALSE,0,70,FALSE,0,50,TRUE,0,80,TRUE,0,90,TRUE,1,85,FALSE,1,50,FALSE,0,50,TRUE,1,90,TRUE,0,75,TRUE,0,75,FALSE,1,64,FALSE,1,50,TRUE,1,75,TRUE,1,80,TRUE,0,75,FALSE,0,50,FALSE,1,50,TRUE,1,70,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,80,TRUE,1,80,TRUE,1,85,0.25,0.09,0.01,0.01,0.0225,0.64,0.25,0.25,0.25,0.04,0.04,0.0225,0.49,0.64,0.25,0.0625,0.5625,0.0625,0.25,0.25,0.0625,0.25,0.1296,0.25,0.5625,0.25,0.04,1,0.64,0.5625,0.25,0.81,0.317485714,0.255892857,0.379078571,16,50,18,56.25,5,62.5,4,50,5,62.5,4,50,10,62.5,8,50,69.5,68,71.88,70.62,67.5,70.62,68.38,-6.25,13.25,5.5,21.88,8.12,17.5,8.12,18.38,1,1,1,2,1,2,2,2,3,0,0,2,2,1,1,0,0,0,1,2,0,2,1,2,1,0,2,0,0,0,0,2,1,0,0,0,0,2,2,3,1.2,1.8,1.2,0.6,1.2,0.4,0.6,1.4,1.2,0.9,1.05,5,6.33,5.5,0,1.4,0.6,-0.8,0.666666667,1,-2,-3,0,-1.33,2,2,1,2,-2,0,0,1,-1,1,-1,1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,20,thank you,0.25,0,1,1,1,0,0,0.67,0.33,03VLPfPs,02COC,02FUT,02DGEN,01DIR,8,2,9,3,7,4,5,1,6,4,3,2,1 +1032,R_6GOyOOfukQvdlML,32 - 38,,Canadian,Canadian,Male,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,2,1,3,4,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,1,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Somewhat Disagree,Somewhat Agree,3,5,1,2,4,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,4,1,5,2,3,7,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,1,4,5,2,10,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,3,1,5,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,4,5,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat agree,3,4,5,1,2,6,Neither agree nor disagree,Somewhat disagree,Disagree,Agree,Somewhat disagree,5,3,2,4,1,7,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,1,3,4,5,2,6,Somewhat agree,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,5,1,4,3,2,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,77,FALSE,76,TRUE,88,FALSE,74,FALSE,73,TRUE,79,FALSE,67,TRUE,87,FALSE,71,TRUE,90,TRUE,85,FALSE,91,FALSE,67,FALSE,90,FALSE,90,TRUE,80,TRUE,79,TRUE,79,TRUE,73,FALSE,69,TRUE,83,TRUE,81,FALSE,53,TRUE,91,TRUE,79,TRUE,93,FALSE,84,FALSE,72,TRUE,78,TRUE,90,TRUE,68,TRUE,87,17,-1,1,1,2,1,0,-1,0,0,1,0,0,-2,-1,1,-1,2,1,0,0,0,1,1,2,-1,7,0,1,-1,1,-1,10,1,-1,2,0,0,8,1,1,0,-1,0,8,-1,1,2,2,1,6,0,-1,-2,2,-1,7,0,1,0,-1,1,6,1,-1,-1,2,0,8,TRUE,0,87,TRUE,1,68,TRUE,0,90,TRUE,0,78,FALSE,0,72,FALSE,1,84,TRUE,1,93,TRUE,1,79,TRUE,1,91,FALSE,0,53,TRUE,0,81,TRUE,0,83,FALSE,0,69,TRUE,0,73,TRUE,1,79,TRUE,1,79,TRUE,0,80,FALSE,1,90,FALSE,1,90,FALSE,1,67,FALSE,0,91,TRUE,1,85,TRUE,0,90,FALSE,0,71,TRUE,0,87,FALSE,0,67,TRUE,0,79,FALSE,1,73,FALSE,1,74,TRUE,1,88,FALSE,0,76,TRUE,1,77,0.0441,0.4489,0.0441,0.0049,0.0529,0.0256,0.5041,0.2809,0.1089,0.0225,0.0144,0.4761,0.0081,0.6561,0.5184,0.1024,0.81,0.6084,0.0729,0.7569,0.8281,0.0441,0.01,0.5329,0.64,0.6241,0.5776,0.7569,0.81,0.01,0.0676,0.6889,0.378885714,0.2992,0.458571429,17,53.13,15,46.88,4,50,3,37.5,3,37.5,5,62.5,9,56.25,6,37.5,79.5,80.25,79.62,79.38,78.75,77.38,81.62,6.25,32.62,30.25,42.12,41.88,16.25,21.13,44.12,1,0,0,0,2,0,2,1,1,2,1,1,4,1,1,2,1,1,1,0,0,0,1,0,0,0,0,2,2,2,0,1,2,0,0,2,3,2,2,0,0.6,1.2,1.6,1,0.2,1.2,0.6,1.8,1.1,0.95,1.025,8.33,6.33,7.5,0.4,0,1,-0.8,0.466666667,1,3,2,0,2,-1,1,1,0,0,0,0,1,-1,0,0,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,36,Too complicated sorry to answer may be wrong answers,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,01ITEM,02REV,5,6,4,3,9,2,8,1,7,2,4,3,1 +1033,R_7EiGpRFWemTNEuI,32 - 38,,Canadian,Canadian,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,1,2,4,5,Agree,Agree,Agree,Agree,Somewhat agree,4,1,5,2,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,2,5,4,1,Disagree,Disagree,Disagree,Disagree,Disagree,3,5,1,2,4,Strongly Agree,Agree,Agree,Agree,Agree,3,4,2,1,5,7,Agree,Agree,Strongly agree,Strongly agree,Somewhat agree,1,4,2,3,5,8,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,3,1,2,5,8,Agree,Agree,Agree,Somewhat agree,Strongly Agree,2,1,4,5,3,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,1,4,2,5,10,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,2,5,3,1,8,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,1,2,3,9,Agree,Agree,Somewhat agree,Agree,Strongly Agree,3,2,1,4,5,9,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,65,FALSE,100,TRUE,100,FALSE,97,TRUE,65,FALSE,78,TRUE,77,TRUE,100,TRUE,100,TRUE,100,FALSE,96,FALSE,95,FALSE,100,TRUE,100,FALSE,82,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,98,TRUE,100,TRUE,100,FALSE,55,TRUE,89,TRUE,76,FALSE,83,FALSE,93,FALSE,92,TRUE,53,TRUE,100,16,3,3,2,3,3,2,2,2,2,1,1,1,1,1,2,-2,-2,-2,-2,-2,3,2,2,2,2,7,2,2,3,3,1,8,2,3,3,3,2,8,2,2,2,1,3,7,2,3,3,3,2,10,2,3,3,2,3,8,1,3,2,1,1,9,2,2,1,2,3,9,TRUE,0,100,TRUE,1,53,FALSE,1,92,FALSE,1,93,FALSE,0,83,TRUE,0,76,TRUE,1,89,FALSE,0,55,TRUE,1,100,TRUE,1,100,FALSE,1,98,TRUE,0,100,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,FALSE,1,82,TRUE,0,100,FALSE,1,100,FALSE,1,95,FALSE,0,96,TRUE,1,100,TRUE,0,100,TRUE,1,100,TRUE,0,77,FALSE,0,78,TRUE,0,65,FALSE,1,97,TRUE,0,100,FALSE,0,100,TRUE,1,65,TRUE,1,100,0.3025,0.6084,0,0.0121,0,0.5776,0,0,0.0025,0,1,0,0,0.0004,0.6889,0.2209,1,0.0049,0.0009,0.5929,0.9216,0,0,1,0.0324,0.4225,0.1225,1,0.0064,1,1,1,0.378371429,0.249657143,0.507085714,16,50,18,56.25,7,87.5,3,37.5,3,37.5,5,62.5,11,68.75,7,43.75,90.44,84.25,92.12,93,92.38,88.69,92.19,-6.25,34.19,-3.25,54.62,55.5,29.88,19.94,48.44,0,1,0,1,1,0,0,1,1,0,1,2,2,2,0,4,4,4,3,5,1,0,1,0,1,0,1,1,0,2,0,2,1,0,1,4,4,3,4,5,0.6,0.4,1.4,4,0.6,0.8,0.8,4,1.6,1.55,1.575,7.67,9,8.25,0,-0.4,0.6,0,0.066666667,-3,0,-1,-2,-1.33,-1,2,-1,-2,2,-2,2,-1,1,1,-1,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),35,it all good,0.625,1,1,1,0,0,0,1,0,03VLPfPs,02COC,01PAST,01ITEM,02REV,6,8,4,7,5,2,9,1,3,3,2,4,1 +1034,R_3a12hokuEVApex3,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,Strongly agree,Disagree,Agree,Disagree,Strongly agree,4,3,5,2,1,Agree,Agree,Strongly Agree,Strongly Agree,Agree,3,4,5,1,2,Agree,Agree,Agree,Strongly disagree,Strongly Agree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly disagree,Agree,Agree,Disagree,Strongly Agree,1,3,4,2,5,9,Disagree,Strongly disagree,Strongly disagree,Agree,Disagree,2,1,4,3,5,3,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,2,4,5,3,1,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,4,5,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,9,Somewhat disagree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,5,1,4,2,8,Agree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,3,4,2,1,8,Agree,Agree,Agree,Strongly agree,Strongly agree,1,3,5,2,4,9,Agree,Agree,Agree,Strongly disagree,Strongly Agree,3,2,5,4,1,TRUE,88,TRUE,73,FALSE,63,FALSE,91,TRUE,88,TRUE,86,TRUE,82,TRUE,74,TRUE,97,TRUE,100,FALSE,96,FALSE,100,TRUE,100,FALSE,83,FALSE,64,TRUE,98,TRUE,100,TRUE,100,FALSE,75,FALSE,100,FALSE,81,FALSE,100,FALSE,94,TRUE,88,TRUE,100,TRUE,100,FALSE,67,TRUE,100,TRUE,97,TRUE,100,FALSE,100,TRUE,86,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,3,3,3,-2,2,-2,3,2,2,3,3,2,2,2,2,-3,3,-3,2,2,-2,3,1,-2,-3,-3,2,-2,9,1,2,1,2,1,3,-3,-3,-3,-3,-2,4,-1,3,2,3,3,9,2,-2,1,-2,1,8,2,2,2,3,3,8,2,2,2,-3,3,9,TRUE,0,88,TRUE,1,73,FALSE,1,63,FALSE,1,91,TRUE,1,88,TRUE,0,86,TRUE,1,82,TRUE,1,74,TRUE,1,97,TRUE,1,100,FALSE,1,96,FALSE,1,100,TRUE,1,100,FALSE,1,83,FALSE,0,64,TRUE,1,98,TRUE,0,100,TRUE,0,100,FALSE,1,75,FALSE,1,100,FALSE,0,81,FALSE,0,100,FALSE,1,94,TRUE,1,88,TRUE,0,100,TRUE,1,100,FALSE,1,67,TRUE,0,100,TRUE,0,97,TRUE,1,100,FALSE,0,100,TRUE,1,86,0.0676,0,0.0004,0.0324,0.0196,0.7396,0.0144,0,0,1,0,0,0.0009,0.0016,0.0144,0.0729,0.0036,0.0081,1,1,0.6561,0.4096,0.0625,0.0289,1,0.1089,1,0.7744,0.1369,1,0.9409,0,0.356903571,0.133935714,0.579871429,17,53.13,21,65.63,6,75,4,50,4,50,7,87.5,12,75,9,56.25,89.72,82.88,91.5,94.12,90.38,89.44,90,-12.5,24.09,7.88,41.5,44.12,2.88,14.44,33.75,4,1,1,5,0,5,1,5,4,5,1,0,2,1,1,5,5,5,0,5,2,0,1,0,0,1,0,1,0,2,0,0,1,0,1,0,0,0,0,0,2.2,4,1,4,0.6,0.8,0.4,0,2.8,0.45,1.625,4.33,8.33,6.375,1.6,3.2,0.6,4,1.8,-8,1,-5,-5,-4,2,2,2,-2,2,-1,1,-1,1,1,-1,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,33,No feedback for me,1.25,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,2,4,9,5,6,7,3,1,8,2,4,3,1 +1035,R_7l0EFONzd5EiPzE,25 - 31,American,,American,Female,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,4,1,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,4,3,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,2,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,2,3,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,5,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,4,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,2,1,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,4,1,2,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,1,4,TRUE,85,TRUE,84,TRUE,65,FALSE,81,TRUE,83,TRUE,80,TRUE,88,TRUE,88,TRUE,91,TRUE,88,TRUE,90,TRUE,89,TRUE,91,TRUE,88,TRUE,87,TRUE,89,TRUE,88,TRUE,85,TRUE,85,TRUE,85,FALSE,90,TRUE,90,TRUE,87,TRUE,85,FALSE,90,FALSE,83,TRUE,85,FALSE,88,TRUE,92,TRUE,84,FALSE,87,TRUE,89,27,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,2,TRUE,0,85,TRUE,1,84,TRUE,0,65,FALSE,1,81,TRUE,1,83,TRUE,0,80,TRUE,1,88,TRUE,1,88,TRUE,1,91,TRUE,1,88,TRUE,0,90,TRUE,0,89,TRUE,1,91,TRUE,0,88,TRUE,1,87,TRUE,1,89,TRUE,0,88,TRUE,0,85,TRUE,0,85,TRUE,0,85,FALSE,0,90,TRUE,1,90,TRUE,0,87,TRUE,1,85,FALSE,1,90,FALSE,0,83,TRUE,0,85,FALSE,1,88,TRUE,0,92,TRUE,1,84,FALSE,0,87,TRUE,1,89,0.0144,0.6889,0.0121,0.0144,0.0121,0.64,0.0225,0.0144,0.7225,0.01,0.0256,0.0081,0.0081,0.81,0.0289,0.0256,0.7569,0.0361,0.0144,0.01,0.81,0.0169,0.7225,0.7744,0.7744,0.7225,0.7569,0.7225,0.4225,0.7225,0.8464,0.7921,0.401028571,0.222914286,0.579142857,27,84.38,16,50,4,50,3,37.5,4,50,5,62.5,13,81.25,3,18.75,86.25,86.25,87.5,87.12,84.12,87.31,85.19,34.38,36.25,36.25,50,37.12,21.62,6.06,66.44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4.33,8,5.125,0,0,0,0,0,0,-5,-6,0,-3.67,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,29,it has been great,0,0,0,0,1,1,1,0,1,01PfPsVL,01EOHI,02FUT,02DGEN,01DIR,9,8,6,3,2,7,5,1,4,3,4,2,1 +1036,R_5spLTuDdtfqvVE7,25 - 31,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,3,5,Agree,Agree,Neither agree nor disagree,Somewhat agree,Agree,5,1,4,2,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,2,1,4,3,Neither agree nor disagree,Agree,Strongly Agree,Agree,Somewhat agree,2,5,4,1,3,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,1,2,3,5,4,4,Disagree,Agree,Somewhat disagree,Agree,Somewhat disagree,2,5,1,4,3,8,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,5,3,1,2,4,7,Somewhat disagree,Agree,Disagree,Somewhat agree,Neither agree nor disagree,2,5,1,3,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Somewhat agree,Strongly Agree,Somewhat agree,Strongly Agree,Strongly Agree,4,5,1,3,2,7,Disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,2,1,3,5,8,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,3,4,1,5,2,7,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Agree,Agree,5,1,3,2,4,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,78,FALSE,63,TRUE,75,FALSE,66,TRUE,66,TRUE,75,TRUE,75,FALSE,58,FALSE,50,TRUE,82,FALSE,54,FALSE,59,TRUE,100,FALSE,68,FALSE,50,TRUE,100,TRUE,59,TRUE,80,FALSE,70,FALSE,61,TRUE,66,FALSE,63,FALSE,60,TRUE,87,FALSE,56,TRUE,84,FALSE,65,FALSE,73,FALSE,65,TRUE,77,FALSE,63,FALSE,65,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,3,3,3,3,2,2,0,1,2,2,0,1,-1,1,0,2,3,2,1,1,3,3,2,1,4,-2,2,-1,2,-1,8,1,-1,2,1,1,7,-1,2,-2,1,0,3,1,3,1,3,3,7,-2,2,0,1,1,8,0,1,-1,0,2,7,0,-1,1,2,2,7,TRUE,0,78,FALSE,0,63,TRUE,0,75,FALSE,1,66,TRUE,1,66,TRUE,0,75,TRUE,1,75,FALSE,0,58,FALSE,0,50,TRUE,1,82,FALSE,1,54,FALSE,1,59,TRUE,1,100,FALSE,1,68,FALSE,0,50,TRUE,1,100,TRUE,0,59,TRUE,0,80,FALSE,1,70,FALSE,1,61,TRUE,1,66,FALSE,0,63,FALSE,1,60,TRUE,1,87,FALSE,1,56,TRUE,1,84,FALSE,1,65,FALSE,1,73,FALSE,1,65,TRUE,1,77,FALSE,0,63,FALSE,0,65,0.3364,0.0256,0,0.0625,0.4225,0.5625,0.0169,0.0324,0.1521,0.3969,0.0529,0,0.25,0.2116,0.1156,0.3969,0.16,0.1156,0.0729,0.1936,0.1156,0.25,0.09,0.1024,0.3481,0.1225,0.3969,0.6084,0.5625,0.64,0.1225,0.1681,0.23855,0.206135714,0.270964286,10,31.25,20,62.5,4,50,5,62.5,5,62.5,6,75,9,56.25,11,68.75,69.16,60.12,69.5,73.25,73.75,71.81,66.5,-31.25,6.66,10.12,7,10.75,-1.25,15.56,-2.25,0,0,0,1,2,4,0,1,1,3,1,1,1,2,0,1,0,5,1,1,0,0,2,0,0,4,0,0,0,1,2,1,2,1,1,0,3,2,0,1,0.6,1.8,1,1.6,0.4,1,1.4,1.2,1.25,1,1.125,6.33,7.33,6.375,0.2,0.8,-0.4,0.4,0.2,-3,0,0,-4,-1,1,2,0,1,-1,1,-1,-1,1,-2,2,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,25,,0.75,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,01DIR,6,4,9,5,7,3,2,1,8,4,3,2,1 +1037,R_7ovZUoxdrCKde3V,32 - 38,,Canadian,Canadian,Male,Neither agree nor disagree,Agree,Strongly agree,Agree,Strongly agree,5,2,4,3,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,1,2,4,5,3,Strongly Agree,Agree,Agree,Somewhat Agree,Strongly Agree,1,4,3,2,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly disagree,2,1,5,3,4,Somewhat agree,Strongly Agree,Strongly Agree,Agree,Agree,5,3,1,2,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,2,5,1,3,5,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Agree,Agree,2,5,3,4,1,4,Neither agree nor disagree,Strongly Agree,Somewhat agree,Disagree,Agree,5,4,2,1,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,1,4,2,3,7,Strongly agree,Agree,Somewhat agree,Agree,Somewhat agree,4,3,2,1,5,5,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,4,1,2,5,6,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,1,3,5,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,90,TRUE,95,FALSE,60,TRUE,80,FALSE,50,TRUE,96,TRUE,80,TRUE,93,TRUE,98,TRUE,60,TRUE,54,TRUE,100,FALSE,54,TRUE,90,TRUE,97,TRUE,97,TRUE,93,TRUE,79,TRUE,100,TRUE,86,TRUE,100,FALSE,65,FALSE,58,FALSE,69,TRUE,92,TRUE,100,FALSE,76,FALSE,86,FALSE,95,FALSE,56,TRUE,74,TRUE,90,10,0,2,3,2,3,-1,0,1,0,2,3,2,2,1,3,0,1,0,1,-3,1,3,3,2,2,2,1,1,1,2,1,5,0,3,1,2,2,4,0,3,1,-2,2,8,2,3,3,2,2,7,3,2,1,2,1,5,2,1,2,1,2,6,-1,-1,0,-1,-1,6,TRUE,0,90,TRUE,1,74,FALSE,1,56,FALSE,1,95,FALSE,0,86,FALSE,1,76,TRUE,1,100,TRUE,1,92,FALSE,0,69,FALSE,0,58,FALSE,1,65,TRUE,0,100,TRUE,1,86,TRUE,0,100,TRUE,1,79,TRUE,1,93,TRUE,0,97,TRUE,0,97,TRUE,0,90,FALSE,1,54,TRUE,1,100,TRUE,1,54,TRUE,0,60,TRUE,1,98,TRUE,0,93,TRUE,1,80,TRUE,0,96,FALSE,1,50,TRUE,0,80,FALSE,0,60,TRUE,1,95,TRUE,1,90,0.0064,0.04,0.0049,0,0.01,0.0576,0.0004,0.3364,0.2116,0.2116,0.36,0.0196,0.4761,0.1225,0.7396,0.0676,0.36,0.0025,0.25,0.8649,0,0.0441,0.81,1,0.9409,0.9216,0.0025,0.81,0.1936,0.9409,0.64,1,0.406928571,0.212535714,0.601321429,10,31.25,18,56.25,5,62.5,4,50,3,37.5,6,75,12,75,6,37.5,81.66,82.88,84.38,84,75.38,82.12,81.19,-25,25.41,20.38,34.38,46.5,0.38,7.12,43.69,1,1,0,0,1,2,1,0,2,1,3,1,1,1,1,0,2,1,3,5,2,1,0,0,1,4,2,0,2,1,1,1,0,0,1,1,2,0,2,2,0.6,1.2,1.4,2.2,0.8,1.8,0.6,1.4,1.35,1.15,1.25,3.67,6,5.375,-0.2,-0.6,0.8,0.8,0,-5,0,-2,2,-2.33,0,1,2,0,0,1,-1,-1,1,-2,2,1,10 cents,25 minutes,24 days,Male,University - Undergraduate,35,it was a good mind boggling survey,0.75,0,0,0,1,0,1,0,0.67,04LPfPsV,02COC,01PAST,01ITEM,02REV,9,3,6,5,7,2,8,1,4,3,4,2,1 +1038,R_3VvzQjSV4swk1yE,32 - 38,,Canadian,Canadian,Male,Somewhat disagree,Agree,Strongly agree,Agree,Neither agree nor disagree,2,1,3,4,5,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,2,1,4,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,5,4,1,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,4,5,2,1,3,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,5,1,4,3,2,2,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,4,5,1,1,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,1,5,3,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,2,3,4,1,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,5,1,4,2,3,0,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,4,2,1,2,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,2,4,5,3,1,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,4,3,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,68,TRUE,90,FALSE,63,TRUE,50,TRUE,93,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,50,FALSE,61,TRUE,87,FALSE,88,TRUE,68,TRUE,100,TRUE,72,TRUE,100,TRUE,75,FALSE,100,TRUE,74,TRUE,62,TRUE,63,TRUE,100,TRUE,62,TRUE,64,TRUE,58,TRUE,74,TRUE,100,TRUE,90,TRUE,50,TRUE,83,24,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-1,2,3,2,0,-1,1,0,1,0,2,0,1,0,1,-2,-1,0,-1,-1,0,2,2,2,0,2,-1,1,0,1,0,1,2,0,1,0,1,1,-1,-1,-1,-1,-1,2,0,2,2,2,0,0,0,1,1,1,0,2,2,0,2,0,2,1,-1,-1,-1,-1,-1,0,FALSE,1,68,TRUE,1,90,FALSE,1,63,TRUE,0,50,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,50,FALSE,1,61,TRUE,1,87,FALSE,1,88,TRUE,1,68,TRUE,1,100,TRUE,0,72,TRUE,0,100,TRUE,0,75,FALSE,1,100,TRUE,1,74,TRUE,1,62,TRUE,0,63,TRUE,1,100,TRUE,0,62,TRUE,1,64,TRUE,0,58,TRUE,0,74,TRUE,0,100,TRUE,1,90,TRUE,1,50,TRUE,1,83,0,0.1296,0,0,0.0289,0,0,0,0,0.1444,0.01,0.0169,0,0.25,0.0049,0.01,0.3969,0.25,0.5476,0.3844,0.0676,0.1024,0.5625,0.0144,0.5184,0.3364,0.25,0.1024,0.1369,1,1,0.1521,0.224539286,0.079428571,0.36965,24,75,23,71.88,5,62.5,5,62.5,6,75,7,87.5,16,100,7,43.75,79.53,67.62,84,80.5,86,85.06,74,3.12,7.65,5.12,21.5,5.5,-1.5,-14.94,30.25,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0.4,0,0,0.4,0.4,0.4,0.4,0.4,0.2,0.4,0.3,1.33,1,1.125,0,-0.4,-0.4,0,-0.266666667,2,-1,0,2,0.33,0,1,1,-1,1,0,0,-1,1,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),34,,0.5,0,1,0,1,0,1,0.33,0.67,02PsVLPf,02COC,01PAST,01ITEM,01DIR,7,9,6,8,4,2,5,1,3,2,3,4,1 +1039,R_7OxcsWq1kON7Wl5,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,4,5,2,1,Strongly agree,Somewhat agree,Agree,Strongly disagree,Agree,1,3,5,4,2,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,2,3,1,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat agree,Agree,3,2,5,4,1,9,Somewhat agree,Agree,Agree,Strongly agree,Neither agree nor disagree,4,1,3,5,2,9,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,4,5,2,3,1,9,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,1,2,3,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Agree,Strongly Agree,Agree,Somewhat agree,Agree,4,5,2,3,1,10,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat agree,2,3,1,4,5,7,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,3,5,1,4,2,10,Strongly Agree,Strongly Agree,Agree,Somewhat agree,Somewhat agree,1,5,3,4,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,95,FALSE,98,FALSE,91,TRUE,99,FALSE,100,TRUE,100,FALSE,100,TRUE,77,TRUE,100,FALSE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,99,FALSE,76,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,97,FALSE,93,FALSE,53,TRUE,81,TRUE,100,TRUE,100,FALSE,98,TRUE,100,FALSE,99,TRUE,100,FALSE,96,FALSE,100,30,3,3,3,1,3,3,1,2,-3,2,3,2,3,1,1,1,1,1,1,-2,3,3,3,1,2,8,1,2,2,3,0,9,1,3,1,3,1,9,1,2,1,2,1,9,2,3,2,1,2,7,-1,1,2,2,1,10,3,2,2,3,3,7,3,3,2,1,1,10,FALSE,1,100,FALSE,0,96,TRUE,0,100,FALSE,1,99,TRUE,1,100,FALSE,1,98,TRUE,1,100,TRUE,1,100,TRUE,1,81,FALSE,0,53,FALSE,1,93,TRUE,0,97,FALSE,0,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,76,FALSE,1,99,FALSE,1,100,TRUE,0,100,TRUE,1,100,FALSE,0,100,TRUE,0,100,TRUE,1,77,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,0,99,FALSE,1,91,FALSE,0,98,TRUE,1,95,TRUE,1,100,0,0,0,0,0,0.0004,0.0529,0.2809,1,1,0.9604,1,0.0361,0.0049,0,0.9216,1,0.0001,0.9801,0,0,0,0,0,0.0576,0,0.0025,0,1,0.0001,0.0081,0.9409,0.330235714,0.44695,0.213521429,30,93.75,22,68.75,7,87.5,6,75,6,75,3,37.5,11,68.75,11,68.75,95.38,95.5,95.62,94,96.38,93.75,97,25,26.63,8,20.62,19,58.88,25,28.25,0,0,0,0,1,2,1,0,6,2,2,1,2,2,0,0,1,0,1,3,1,0,1,0,1,4,0,0,5,1,0,0,1,2,2,2,2,1,0,3,0.2,2.2,1.4,1,0.6,2,1,1.6,1.2,1.3,1.25,8.67,8,8.625,-0.4,0.2,0.4,-0.6,0.066666667,1,-1,2,-1,0.67,2,-1,0,0,0,0,0,1,-1,1,-1,0,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),25,no feedback was interesting to take ,-0.125,1,1,1,0,0,0,1,0,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,9,7,3,5,4,8,6,1,2,2,3,4,1 +1040,R_6xjOsURNNhM7ELD,25 - 31,American,,American,Male,Agree,Neither agree nor disagree,Somewhat agree,Agree,Agree,5,1,2,3,4,Agree,Agree,Agree,Agree,Somewhat agree,3,1,2,5,4,Agree,Somewhat Agree,Agree,Agree,Agree,3,5,1,4,2,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,5,1,3,4,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Agree,Agree,Somewhat agree,Strongly Agree,Strongly Agree,2,4,3,1,5,5,Neither agree nor disagree,Somewhat disagree,Agree,Strongly agree,Somewhat agree,3,4,2,1,5,7,Strongly Agree,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,1,4,2,5,3,6,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,6,Somewhat agree,Agree,Strongly Agree,Somewhat agree,Somewhat agree,5,2,1,4,3,8,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,9,Strongly agree,Disagree,Somewhat Agree,Strongly Disagree,Somewhat Disagree,5,2,4,1,3,7,Agree,Neither agree nor disagree,Somewhat agree,Strongly Agree,Somewhat agree,2,4,3,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,78,FALSE,78,FALSE,77,TRUE,80,TRUE,79,TRUE,51,FALSE,74,TRUE,50,TRUE,63,TRUE,72,FALSE,71,TRUE,61,TRUE,75,FALSE,80,TRUE,71,TRUE,70,TRUE,79,TRUE,75,FALSE,74,FALSE,91,TRUE,96,TRUE,71,TRUE,68,FALSE,68,TRUE,66,TRUE,84,FALSE,89,FALSE,76,FALSE,86,TRUE,71,TRUE,50,TRUE,77,17,2,0,1,2,2,2,2,2,2,1,2,1,2,2,2,0,2,2,1,2,2,2,1,3,3,5,0,-1,2,3,1,5,3,1,2,2,0,7,1,2,1,0,2,6,1,2,3,1,1,6,2,0,3,1,-1,8,3,-2,1,-3,-1,9,2,0,1,3,1,7,TRUE,0,77,TRUE,1,50,TRUE,0,71,FALSE,1,86,FALSE,0,76,FALSE,1,89,TRUE,1,84,TRUE,1,66,FALSE,0,68,TRUE,1,68,TRUE,0,71,TRUE,0,96,FALSE,0,91,FALSE,1,74,TRUE,1,75,TRUE,1,79,TRUE,0,70,TRUE,0,71,FALSE,1,80,TRUE,0,75,TRUE,1,61,FALSE,0,71,TRUE,0,72,TRUE,1,63,TRUE,0,50,FALSE,0,74,TRUE,0,51,TRUE,0,79,TRUE,0,80,FALSE,0,77,FALSE,0,78,TRUE,1,78,0.1156,0.5476,0.0441,0.0256,0.0484,0.0121,0.1369,0.1024,0.5625,0.5041,0.5929,0.8281,0.4624,0.5041,0.5776,0.25,0.5184,0.0196,0.6241,0.25,0.1521,0.0625,0.04,0.0676,0.49,0.2601,0.6084,0.5929,0.5041,0.5041,0.64,0.9216,0.387035714,0.365678571,0.408392857,17,53.13,13,40.63,4,50,3,37.5,3,37.5,3,37.5,9,56.25,4,25,73.47,69.88,77.12,71.12,75.75,72.44,74.5,12.5,32.84,19.88,39.62,33.62,38.25,16.19,49.5,0,2,0,1,1,2,3,0,1,0,1,0,0,0,2,1,0,1,1,0,1,2,2,1,1,0,2,1,1,2,1,3,1,5,3,2,2,1,2,1,0.8,1.2,0.6,0.6,1.4,1.2,2.6,1.6,0.8,1.7,1.25,5.67,7.67,6.625,-0.6,0,-2,-1,-0.866666667,-1,-3,-2,-1,-2,0,-1,1,1,-1,0,0,1,-1,1,-1,0,10 cents,25 minutes,36 days,Male,University - Graduate (Masters),27,none,-0.375,0,0,0,1,0,0,0,0.33,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,4,7,2,6,8,9,5,1,3,4,3,2,1 +1041,R_39cvBVBZ3VzfSRW,25 - 31,American,,American,Female,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,1,2,3,5,Disagree,Disagree,Agree,Neither agree nor disagree,Agree,5,2,3,1,4,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,1,2,5,3,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,4,1,3,5,2,Somewhat agree,Agree,Somewhat agree,Disagree,Agree,3,5,2,1,4,6,Disagree,Disagree,Agree,Neither agree nor disagree,Agree,4,5,1,2,3,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Strongly Agree,1,5,4,3,2,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,4,2,3,5,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,5,2,4,1,3,2,Disagree,Disagree,Agree,Somewhat disagree,Agree,3,1,5,4,2,2,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,4,2,3,1,5,2,Somewhat agree,Agree,Somewhat agree,Agree,Agree,4,3,1,5,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,92,TRUE,70,FALSE,75,TRUE,92,FALSE,56,FALSE,50,TRUE,98,TRUE,93,TRUE,100,TRUE,76,TRUE,61,TRUE,50,FALSE,100,FALSE,60,FALSE,100,TRUE,50,TRUE,95,FALSE,50,FALSE,95,TRUE,90,FALSE,100,TRUE,50,TRUE,75,TRUE,50,TRUE,90,TRUE,90,FALSE,85,TRUE,85,FALSE,50,TRUE,65,TRUE,100,FALSE,70,10,0,1,3,0,1,-2,-2,2,0,2,2,0,2,0,3,0,0,1,1,2,1,2,1,-2,2,6,-2,-2,2,0,2,5,1,0,1,2,3,6,1,0,1,0,-1,6,0,1,2,2,2,2,-2,-2,2,-1,2,2,2,0,2,1,3,2,1,2,1,2,2,2,FALSE,1,70,TRUE,1,100,TRUE,0,65,FALSE,1,50,TRUE,1,85,FALSE,1,85,TRUE,1,90,TRUE,1,90,TRUE,1,50,TRUE,1,75,TRUE,0,50,FALSE,1,100,TRUE,1,90,FALSE,1,95,FALSE,0,50,TRUE,1,95,TRUE,0,50,FALSE,1,100,FALSE,1,60,FALSE,1,100,TRUE,1,50,TRUE,1,61,TRUE,0,76,TRUE,1,100,TRUE,0,93,TRUE,1,98,FALSE,1,50,FALSE,1,56,TRUE,0,92,FALSE,0,75,TRUE,1,70,TRUE,1,92,0.01,0.0004,0.0025,0.01,0.0064,0.0225,0,0.0625,0,0.1521,0.5625,0.01,0.25,0.25,0.0225,0,0.5776,0.25,0.1936,0.8649,0.25,0.25,0.16,0.0025,0.25,0.25,0.09,0.09,0.4225,0,0.8464,0,0.208428571,0.154721429,0.262135714,10,31.25,24,75,6,75,5,62.5,7,87.5,6,75,14,87.5,10,62.5,76.97,60,77.5,85.25,85.12,79.44,74.5,-43.75,1.97,-15,15,-2.25,10.12,-8.06,12,1,1,2,2,1,0,0,0,0,0,1,0,1,2,0,1,0,0,1,3,0,0,1,2,1,0,0,0,1,0,0,0,0,1,0,1,2,0,1,0,1.4,0,0.8,1,0.8,0.2,0.2,0.8,0.8,0.5,0.65,5.67,2,3.875,0.6,-0.2,0.6,0.2,0.333333333,4,3,4,4,3.67,2,2,2,-2,2,0,0,0,0,-2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,I thoroughly enjoyed this survey! Thank you!,1.5,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,2,7,6,5,8,4,9,1,3,2,4,3,1 +1042,R_7s0cfU8ooQnpkW2,25 - 31,American,,American,Female,Agree,Strongly agree,Agree,Strongly agree,Agree,5,1,3,4,2,Somewhat agree,Disagree,Strongly agree,Somewhat agree,Strongly agree,3,1,4,2,5,Agree,Strongly Agree,Agree,Somewhat Disagree,Strongly Agree,5,3,2,4,1,Somewhat agree,Agree,Strongly Agree,Agree,Disagree,2,3,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,2,4,1,3,5,Agree,Disagree,Strongly agree,Agree,Agree,2,4,5,3,1,0,Strongly Agree,Agree,Agree,Disagree,Strongly Agree,5,3,2,4,1,10,Somewhat agree,Somewhat agree,Agree,Disagree,Disagree,5,4,1,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,0,Strongly Agree,Agree,Strongly Agree,Agree,Agree,4,3,2,5,1,0,Agree,Disagree,Strongly agree,Somewhat agree,Agree,1,5,2,4,3,0,Strongly agree,Agree,Somewhat Agree,Disagree,Agree,5,4,1,2,3,9,Agree,Agree,Strongly Agree,Agree,Agree,1,2,3,4,5,FALSE,100,TRUE,87,TRUE,100,FALSE,86,TRUE,93,TRUE,80,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,87,TRUE,100,TRUE,97,TRUE,90,TRUE,100,TRUE,89,TRUE,100,FALSE,100,FALSE,89,FALSE,64,TRUE,99,TRUE,96,TRUE,86,TRUE,85,TRUE,87,TRUE,96,TRUE,96,TRUE,97,TRUE,80,TRUE,86,TRUE,76,FALSE,82,23,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,3,2,1,-2,3,1,3,2,3,2,-1,3,1,2,3,2,-2,3,3,3,2,2,0,2,-2,3,2,2,5,3,2,2,-2,3,0,1,1,2,-2,-2,10,3,2,3,2,2,0,2,-2,3,1,2,0,3,2,1,-2,2,0,2,2,3,2,2,9,FALSE,1,100,TRUE,1,87,TRUE,0,100,FALSE,1,86,TRUE,1,93,TRUE,0,80,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,87,TRUE,0,100,TRUE,1,97,TRUE,0,90,TRUE,1,100,TRUE,1,89,TRUE,0,100,FALSE,1,100,FALSE,1,89,FALSE,1,64,TRUE,1,99,TRUE,1,96,TRUE,0,86,TRUE,1,85,TRUE,0,87,TRUE,1,96,TRUE,0,96,TRUE,0,97,TRUE,0,80,TRUE,1,86,TRUE,1,76,FALSE,0,82,0,0.0016,0.0121,0,0.6724,0.64,0.0225,0,0.1296,0.0016,0.0196,0.0009,0,0.7569,0.0049,0.0169,0.7396,0.0196,0.9409,0.7569,0.0001,0,0.0121,0.81,1,0.9216,0.0576,0,1,0,0.64,1,0.362989286,0.216035714,0.509942857,23,71.88,20,62.5,6,75,3,37.5,6,75,5,62.5,15,93.75,5,31.25,91.5,90.12,89.62,96.12,90.12,92.88,90.12,9.38,29,15.12,52.12,21.12,27.62,-0.87,58.87,1,0,1,1,0,1,0,0,1,1,1,1,0,1,0,0,1,1,4,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,4,0.6,0.6,0.6,1.2,0.8,0.4,1,1,0.75,0.8,0.775,1.67,0,3,-0.2,0.2,-0.4,0.2,-0.133333333,0,5,0,1,1.67,1,-1,1,-1,1,1,-1,1,-1,1,-1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,25,I don't have any further comments,0,0,0,0,1,1,1,0,1,02PsVLPf,02COC,01PAST,02DGEN,01DIR,9,7,3,4,8,2,6,1,5,2,4,3,1 +1043,R_7lacZSWPPugloS0,25 - 31,American,,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,4,5,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,5,4,2,1,3,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,1,4,2,5,Disagree,Neither agree nor disagree,Disagree,Disagree,Disagree,5,1,4,3,2,Disagree,Agree,Agree,Disagree,Agree,5,4,3,2,1,8,Somewhat agree,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,5,4,3,2,1,8,Disagree,Disagree,Agree,Agree,Agree,4,2,3,1,5,8,Somewhat disagree,Disagree,Agree,Disagree,Somewhat disagree,1,3,5,4,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,3,1,10,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,Agree,3,4,5,1,2,10,Somewhat Agree,Disagree,Strongly Agree,Strongly Agree,Strongly Agree,1,5,4,2,3,10,Agree,Agree,Agree,Agree,Agree,3,2,1,5,4,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,TRUE,100,TRUE,100,FALSE,59,TRUE,57,TRUE,56,FALSE,91,TRUE,100,TRUE,100,TRUE,55,TRUE,96,FALSE,64,TRUE,100,TRUE,59,TRUE,62,FALSE,54,TRUE,53,TRUE,65,TRUE,100,FALSE,54,FALSE,52,FALSE,100,TRUE,78,FALSE,54,TRUE,52,FALSE,100,TRUE,100,TRUE,83,TRUE,84,TRUE,68,TRUE,63,FALSE,56,TRUE,56,10,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,-1,3,1,1,3,2,3,3,3,2,-2,0,-2,-2,-2,-2,2,2,-2,2,8,1,-1,-2,3,0,8,-2,-2,2,2,2,8,-1,-2,2,-2,-1,6,3,3,3,3,3,10,3,-1,3,-3,2,10,1,-2,3,3,3,10,2,2,2,2,2,8,TRUE,0,100,TRUE,1,100,FALSE,1,59,TRUE,0,57,TRUE,1,56,FALSE,1,91,TRUE,1,100,TRUE,1,100,TRUE,1,55,TRUE,1,96,FALSE,1,64,TRUE,0,100,TRUE,1,59,TRUE,0,62,FALSE,0,54,TRUE,1,53,TRUE,0,65,TRUE,0,100,FALSE,1,54,FALSE,1,52,FALSE,0,100,TRUE,1,78,FALSE,1,54,TRUE,1,52,FALSE,1,100,TRUE,1,100,TRUE,0,83,TRUE,0,84,TRUE,0,68,TRUE,1,63,FALSE,0,56,TRUE,1,56,0,0,0.2209,0,0.1936,0.0081,0.2304,0.0016,0.2304,0.0484,0.1369,0.1681,0.2025,0.1296,0.1936,0,0.2116,0.3249,0.7056,0,1,0.2916,0.2116,0.3844,0.4225,0.6889,0.3136,1,0.1681,1,0.4624,1,0.347442857,0.14855,0.546335714,10,31.25,20,62.5,4,50,5,62.5,5,62.5,6,75,13,81.25,7,43.75,74.09,65.38,68.62,92,70.38,73.62,74.56,-31.25,11.59,15.38,6.12,29.5,-4.62,-7.63,30.81,5,1,1,5,1,2,4,3,2,3,4,5,1,1,0,1,2,4,0,1,0,0,0,0,0,4,4,2,4,1,1,5,0,0,1,4,2,4,4,4,2.6,2.8,2.2,1.6,0,3,1.4,3.6,2.3,2,2.15,8,10,8.5,2.6,-0.2,0.8,-2,1.066666667,-2,-2,-2,-2,-2,1,2,1,-2,2,2,-2,1,-1,0,0,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),29,i liekd this very much thank you,0.5,0,0,0,1,1,1,0,1,01PfPsVL,02COC,01PAST,01ITEM,01DIR,6,7,9,4,8,2,5,1,3,4,3,2,1 +1044,R_6lTVn2VOOfAGtTX,25 - 31,American,,American,Male,Somewhat agree,Agree,Agree,Agree,Agree,2,4,1,5,3,Neither agree nor disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,4,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,Somewhat agree,Agree,Agree,Agree,Agree,4,5,1,3,2,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,3,5,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,1,3,5,4,8,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,2,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,4,5,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,4,2,5,3,8,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,1,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,2,5,3,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,96,TRUE,94,TRUE,89,TRUE,92,TRUE,87,TRUE,89,TRUE,55,TRUE,66,TRUE,79,FALSE,64,TRUE,64,TRUE,72,TRUE,74,TRUE,73,TRUE,64,TRUE,65,TRUE,72,TRUE,65,TRUE,71,TRUE,77,TRUE,98,TRUE,67,TRUE,73,TRUE,85,TRUE,77,TRUE,77,TRUE,88,TRUE,78,TRUE,82,TRUE,76,TRUE,79,TRUE,72,24,1,2,2,2,2,0,-2,0,0,0,1,0,0,0,0,0,1,1,0,0,1,2,2,2,2,8,0,0,0,0,0,8,0,0,0,1,0,8,0,-1,0,0,0,8,0,1,1,1,1,8,0,0,0,-1,0,8,1,0,0,0,0,8,1,1,1,1,1,8,TRUE,0,72,TRUE,1,79,TRUE,0,76,TRUE,0,82,TRUE,1,78,TRUE,0,88,TRUE,1,77,TRUE,1,77,TRUE,1,85,TRUE,1,73,TRUE,0,67,TRUE,0,98,TRUE,1,77,TRUE,0,71,TRUE,1,65,TRUE,1,72,TRUE,0,65,TRUE,0,64,TRUE,0,73,TRUE,0,74,TRUE,1,72,TRUE,1,64,FALSE,1,64,TRUE,1,79,TRUE,0,66,TRUE,1,55,TRUE,0,89,TRUE,0,87,TRUE,0,92,TRUE,1,89,TRUE,1,94,TRUE,1,96,0.0529,0.2025,0.0784,0.0529,0.0016,0.7744,0.0441,0.0729,0.5476,0.1296,0.0121,0.0529,0.0225,0.4489,0.0484,0.0441,0.1296,0.6724,0.7569,0.4356,0.0784,0.1225,0.5329,0.5041,0.4225,0.7921,0.0036,0.5184,0.5776,0.4096,0.8464,0.9604,0.355789286,0.214364286,0.497214286,24,75,17,53.13,4,50,5,62.5,4,50,4,50,16,100,1,6.25,76.88,79.25,79,67.75,81.5,77,76.75,21.87,23.75,29.25,16.5,17.75,31.5,-23,70.5,0,0,0,0,0,0,2,0,0,0,1,0,0,1,0,0,2,1,0,0,1,1,1,1,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0.4,0.4,0.6,1,0.6,0,0.6,0.35,0.55,0.45,8,8,8,-1,-0.2,0.4,0,-0.266666667,0,0,0,0,0,2,1,1,1,-1,1,-1,1,-1,1,-1,1,5 cents,5 minutes,36 days,Male,University - Undergraduate,30,no,0.125,1,1,0,0,0,0,0.67,0,04LPfPsV,02COC,02FUT,01ITEM,02REV,3,2,5,8,9,4,6,1,7,3,4,2,1 +1045,R_5fJDjeqC29H2TE5,25 - 31,American,,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,Somewhat agree,Disagree,Somewhat disagree,Strongly disagree,Strongly disagree,5,3,2,1,4,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,4,3,2,5,Agree,Strongly Agree,Agree,Agree,Strongly Agree,3,2,4,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,4,2,3,1,5,9,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat agree,3,4,2,5,1,8,Agree,Agree,Strongly Agree,Agree,Strongly Agree,3,2,5,1,4,8,Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,2,3,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,3,1,5,7,Agree,Agree,Agree,Agree,Strongly agree,5,2,1,4,3,7,Agree,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,2,5,4,1,3,8,Agree,Strongly Agree,Agree,Agree,Agree,5,4,1,2,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,82,TRUE,89,FALSE,93,FALSE,83,FALSE,90,FALSE,86,TRUE,90,FALSE,82,TRUE,87,TRUE,71,TRUE,86,TRUE,85,FALSE,90,FALSE,85,TRUE,88,TRUE,86,TRUE,86,TRUE,88,FALSE,90,FALSE,86,FALSE,63,FALSE,82,TRUE,85,TRUE,79,TRUE,83,TRUE,89,FALSE,91,TRUE,89,FALSE,54,FALSE,92,TRUE,94,FALSE,87,26,3,3,3,3,3,1,-2,-1,-3,-3,2,1,3,1,3,2,3,2,2,3,3,3,2,3,2,8,2,0,1,-2,1,9,2,2,3,2,3,8,2,2,3,2,3,8,3,3,3,3,3,8,2,2,2,2,3,7,2,2,3,3,0,7,2,3,2,2,2,8,FALSE,1,87,TRUE,1,94,FALSE,1,92,FALSE,1,54,TRUE,1,89,FALSE,1,91,TRUE,1,89,TRUE,1,83,TRUE,1,79,TRUE,1,85,FALSE,1,82,FALSE,1,63,FALSE,0,86,FALSE,1,90,TRUE,1,88,TRUE,1,86,TRUE,0,86,TRUE,0,88,FALSE,1,85,FALSE,1,90,TRUE,1,85,TRUE,1,86,TRUE,0,71,TRUE,1,87,FALSE,1,82,TRUE,1,90,FALSE,1,86,FALSE,1,90,FALSE,1,83,FALSE,0,93,TRUE,1,89,TRUE,1,82,0.0289,0.01,0.0196,0.0121,0.0324,0.0081,0.0169,0.0225,0.01,0.0196,0.8649,0.7396,0.0441,0.0324,0.0121,0.0036,0.5041,0.2116,0.01,0.0324,0.0225,0.0144,0.0225,0.01,0.7396,0.0196,0.0121,0.0169,0.0064,0.7744,0.0289,0.1369,0.156017857,0.180135714,0.1319,26,81.25,27,84.38,8,100,5,62.5,7,87.5,7,87.5,14,87.5,13,81.25,84.72,82.12,84.12,87.12,85.5,86.94,82.5,-3.13,0.34,-17.88,21.62,-0.38,-2,-0.56,1.25,0,0,1,0,1,1,2,2,1,4,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,4,3,5,6,0,1,0,2,3,0,0,0,0,1,0.4,2,0.4,0.4,0,3.8,1.2,0.2,0.8,1.3,1.05,8.33,7.33,7.875,0.4,-1.8,-0.8,0.2,-0.733333333,0,2,1,0,1,1,2,2,-2,2,0,0,0,0,-1,1,2,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),29,thank you,1.25,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,4,6,3,8,2,9,5,1,7,2,4,3,1 +1046,R_5QBdYcwQpZ3JBiV,32 - 38,,Canadian,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,4,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,2,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,4,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,57,FALSE,50,TRUE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,FALSE,50,FALSE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,FALSE,50,TRUE,50,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,TRUE,0,50,FALSE,0,50,TRUE,0,50,FALSE,1,50,TRUE,1,57,FALSE,1,50,TRUE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,0,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,FALSE,1,50,FALSE,0,50,FALSE,1,50,TRUE,1,50,FALSE,1,50,TRUE,0,50,FALSE,1,50,TRUE,1,50,FALSE,0,50,TRUE,1,50,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.1849,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.247675,0.24535,0.25,16,50,19,59.38,4,50,7,87.5,5,62.5,3,37.5,8,50,11,68.75,50.22,50,50.88,50,50,50.44,50,-9.38,-9.16,0,-36.62,-12.5,12.5,0.44,-18.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),37,,0,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,6,7,8,2,4,9,5,1,3,2,3,4,1 +1047,R_7axCMgMstvJ4z3X,25 - 31,American,,American,Male,Neither agree nor disagree,Strongly agree,Agree,Somewhat disagree,Neither agree nor disagree,3,1,2,4,5,Disagree,Somewhat agree,Strongly disagree,Somewhat agree,Agree,1,2,4,5,3,Disagree,Somewhat Agree,Strongly Agree,Agree,Agree,4,3,2,5,1,Disagree,Disagree,Somewhat disagree,Disagree,Somewhat disagree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,10,Somewhat agree,Strongly Agree,Strongly Agree,Somewhat agree,Neither agree nor disagree,3,5,4,2,1,9,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Strongly agree,3,1,5,2,4,10,Somewhat Disagree,Strongly Agree,Agree,Strongly Agree,Agree,3,5,1,4,2,10,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,7,Somewhat agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,3,1,2,4,5,5,Agree,Disagree,Strongly agree,Disagree,Agree,4,2,5,1,3,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Strongly agree,Agree,3,1,4,2,5,8,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,TRUE,100,FALSE,63,FALSE,100,FALSE,53,TRUE,91,FALSE,100,TRUE,100,TRUE,100,TRUE,52,TRUE,100,FALSE,65,TRUE,57,FALSE,65,TRUE,85,FALSE,60,FALSE,59,FALSE,57,FALSE,100,TRUE,58,TRUE,64,TRUE,62,TRUE,60,FALSE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,57,FALSE,100,TRUE,81,TRUE,100,TRUE,69,TRUE,72,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,3,2,-1,0,-2,1,-3,1,2,-2,1,3,2,2,-2,-2,-1,-2,-1,1,3,3,1,0,10,1,1,0,-1,3,9,-1,3,2,3,2,10,1,1,1,0,1,10,1,3,3,3,2,7,2,-2,3,-2,2,5,1,0,2,3,2,5,3,3,3,3,3,8,TRUE,0,100,FALSE,0,63,FALSE,1,100,FALSE,1,53,TRUE,1,91,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,52,TRUE,1,100,FALSE,1,65,TRUE,0,57,FALSE,0,65,TRUE,0,85,FALSE,0,60,FALSE,0,59,FALSE,1,57,FALSE,1,100,TRUE,0,58,TRUE,0,64,TRUE,1,62,TRUE,1,60,FALSE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,57,FALSE,1,100,TRUE,0,81,TRUE,1,100,TRUE,1,69,TRUE,1,72,0,0,0.3481,0,0.0784,0,0,0,0.4096,0.16,0,0.4225,0.2304,0.1225,0.0081,0.3969,0,0.2209,0,0,0.1444,0.36,0.3364,0.7225,0.1849,0.1849,0.0961,1,0,0,0.6561,0.3249,0.216410714,0.146378571,0.286442857,16,50,22,68.75,5,62.5,6,75,6,75,5,62.5,12,75,10,62.5,79.06,59.62,78.5,93.12,85,78.31,79.81,-18.75,10.31,-2.88,3.5,18.12,22.5,3.31,17.31,1,0,1,2,0,3,0,3,2,1,1,2,1,1,0,3,3,2,2,2,1,0,1,4,2,4,3,6,3,0,3,1,1,1,0,5,5,4,5,4,0.8,1.8,1,2.4,1.6,3.2,1.2,4.6,1.5,2.65,2.075,9.67,5.67,8,-0.8,-1.4,-0.2,-2.2,-0.8,3,4,5,2,4,1,2,1,0,0,1,-1,0,0,-1,1,2,10 cents,100 minutes,47 days,Male,High School (or equivalent),31,,0.75,0,0,1,1,1,0,0.33,0.67,03VLPfPs,01EOHI,01PAST,02DGEN,01DIR,6,9,3,5,8,7,4,1,2,3,2,4,1 +1048,R_5npjApQ2bVvcQA0,25 - 31,American,,American,Female,Agree,Agree,Agree,Agree,Agree,1,4,3,2,5,Strongly agree,Somewhat disagree,Agree,Somewhat agree,Strongly agree,5,2,4,3,1,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,3,2,4,1,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Agree,Agree,3,4,1,2,5,4,Agree,Neither agree nor disagree,Agree,Agree,Agree,2,3,1,4,5,4,Agree,Agree,Agree,Agree,Agree,4,5,1,2,3,4,Agree,Agree,Agree,Agree,Agree,4,1,2,5,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Agree,Agree,Agree,Agree,Agree,1,4,5,2,3,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Agree,1,5,3,2,4,4,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,1,4,3,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,5,1,3,TRUE,65,FALSE,58,FALSE,87,FALSE,54,TRUE,59,FALSE,54,TRUE,55,TRUE,50,FALSE,54,FALSE,54,TRUE,55,TRUE,56,FALSE,55,TRUE,53,FALSE,52,TRUE,53,TRUE,54,TRUE,53,FALSE,53,FALSE,53,TRUE,52,FALSE,57,FALSE,54,TRUE,52,FALSE,53,TRUE,53,FALSE,56,TRUE,54,FALSE,53,TRUE,57,FALSE,55,TRUE,53,11,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,2,2,3,-1,2,1,3,3,0,2,1,2,1,0,1,0,1,2,2,2,2,2,4,2,0,2,2,2,4,2,2,2,2,2,4,2,2,2,2,2,4,2,2,2,2,2,4,0,0,2,1,2,4,3,0,3,1,3,4,1,1,1,1,1,4,TRUE,0,65,FALSE,0,58,FALSE,1,87,FALSE,1,54,TRUE,1,59,FALSE,1,54,TRUE,1,55,TRUE,1,50,FALSE,0,54,FALSE,0,54,TRUE,0,55,TRUE,0,56,FALSE,0,55,TRUE,0,53,FALSE,0,52,TRUE,1,53,TRUE,0,54,TRUE,0,53,FALSE,1,53,FALSE,1,53,TRUE,1,52,FALSE,0,57,FALSE,1,54,TRUE,1,52,FALSE,1,53,TRUE,1,53,FALSE,1,56,TRUE,0,54,FALSE,1,53,TRUE,1,57,FALSE,0,55,TRUE,1,53,0.25,0.2209,0.2209,0.2025,0.2209,0.2116,0.2304,0.2916,0.2209,0.3249,0.1849,0.3025,0.2916,0.3025,0.1681,0.3364,0.2116,0.2116,0.2916,0.2209,0.2304,0.2704,0.2209,0.2809,0.2916,0.1936,0.3025,0.4225,0.0169,0.2809,0.2209,0.3136,0.252396429,0.250678571,0.254114286,11,34.38,18,56.25,3,37.5,6,75,3,37.5,6,75,9,56.25,9,56.25,55.5,54.62,54.25,55.38,57.75,54.31,56.69,-21.87,-0.75,17.12,-20.75,17.88,-17.25,-1.94,0.44,0,0,0,0,0,1,1,0,1,1,1,2,0,1,0,1,2,1,2,1,0,0,0,0,0,3,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0.8,0.8,1.4,0,1,0.4,0.4,0.75,0.45,0.6,4,4,4,0,-0.2,0.4,1,0.066666667,0,0,0,0,0,1,1,0,0,0,1,-1,1,-1,0,0,1,10 cents,25 minutes,24 days,Female,High School (or equivalent),29,,0.125,0,0,0,1,0,1,0,0.67,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,8,7,2,6,4,3,5,1,9,4,3,2,1 +1049,R_7JOviwR13qNO3cP,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,5,3,1,2,4,Strongly disagree,Strongly disagree,Agree,Somewhat disagree,Agree,5,1,4,3,2,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,4,3,5,2,1,Disagree,Neither agree nor disagree,Agree,Strongly Agree,Agree,2,1,3,4,5,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Strongly Agree,5,2,4,3,1,6,Strongly agree,Disagree,Agree,Neither agree nor disagree,Agree,1,5,4,3,2,6,Strongly Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,4,1,5,3,2,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,2,4,1,3,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Agree,1,2,3,4,5,6,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,1,2,5,3,4,5,Strongly Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,4,3,2,1,5,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Strongly Agree,5,4,3,1,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,85,FALSE,52,TRUE,100,TRUE,56,TRUE,70,FALSE,50,TRUE,100,TRUE,75,TRUE,59,FALSE,52,TRUE,69,TRUE,81,FALSE,58,TRUE,76,TRUE,100,TRUE,73,TRUE,72,TRUE,61,FALSE,54,TRUE,66,TRUE,81,TRUE,59,TRUE,85,TRUE,64,TRUE,90,TRUE,90,FALSE,63,TRUE,60,FALSE,59,TRUE,81,TRUE,80,TRUE,66,17,3,3,1,0,2,-3,-3,2,-1,2,2,3,3,3,2,-2,0,2,3,2,3,3,2,0,3,6,3,-2,2,0,2,6,3,2,2,-1,3,6,0,1,1,1,-2,6,3,3,2,0,2,6,0,-2,2,0,1,5,3,1,2,-1,1,6,1,0,1,2,3,5,TRUE,0,66,TRUE,1,80,TRUE,0,81,FALSE,1,59,TRUE,1,60,FALSE,1,63,TRUE,1,90,TRUE,1,90,TRUE,1,64,TRUE,1,85,TRUE,0,59,TRUE,0,81,TRUE,1,66,FALSE,1,54,TRUE,1,61,TRUE,1,72,TRUE,0,73,TRUE,0,100,TRUE,0,76,FALSE,1,58,TRUE,1,81,TRUE,1,69,FALSE,1,52,TRUE,1,59,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,0,70,TRUE,0,56,TRUE,1,100,FALSE,0,52,TRUE,1,85,0.01,0,0.0784,0.01,0.0225,0.1369,0.1681,0.0225,0.1764,0.0961,0,0.1156,0.1296,0.3481,0.16,0.04,0.2304,0.1681,0.49,0.5625,0.0361,0.1521,0.5776,0.2116,0.5329,0.25,0.2704,0.4356,0.6561,1,0.3136,0.6561,0.284246429,0.129592857,0.4389,17,53.13,21,65.63,5,62.5,6,75,5,62.5,5,62.5,15,93.75,6,37.5,71.47,62.62,67,79.88,76.38,75.88,67.06,-12.5,5.84,0.12,-8,17.38,13.88,-17.87,29.56,0,0,1,0,1,6,1,0,1,0,1,1,1,4,1,2,1,1,2,4,0,0,1,0,0,3,1,0,1,1,1,2,1,4,1,3,0,1,1,1,0.4,1.6,1.6,2,0.2,1.2,1.8,1.2,1.4,1.1,1.25,6,5.67,5.75,0.2,0.4,-0.2,0.8,0.133333333,0,1,0,1,0.33,1,2,-1,-1,1,1,-1,2,-2,0,0,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),35,"Great survey, thanks",0.125,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,01PAST,01ITEM,02REV,6,3,7,8,5,9,2,1,4,2,3,4,1 +1050,R_63DxfW1B20fS2bN,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Somewhat agree,5,3,2,4,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,3,2,4,5,1,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Agree,4,2,1,3,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,1,4,5,3,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,4,Strongly Agree,Agree,Agree,Somewhat disagree,Somewhat agree,2,3,4,5,1,3,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Agree,1,5,2,4,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,4,1,5,2,5,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Strongly disagree,Somewhat disagree,5,2,3,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,2,5,3,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Disagree,Neither Agree nor Disagree,2,5,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,FALSE,90,FALSE,75,FALSE,90,FALSE,50,TRUE,75,FALSE,80,TRUE,75,TRUE,100,FALSE,50,TRUE,95,FALSE,95,TRUE,100,TRUE,90,FALSE,90,TRUE,50,FALSE,90,FALSE,80,TRUE,60,FALSE,50,FALSE,50,TRUE,95,TRUE,90,FALSE,95,TRUE,75,FALSE,95,TRUE,90,FALSE,50,FALSE,50,TRUE,60,FALSE,95,TRUE,50,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,2,-1,1,0,0,2,0,1,0,1,3,-1,2,0,1,1,0,-2,3,2,2,-1,1,4,-3,1,1,3,2,3,3,3,3,1,3,1,-3,0,-1,-3,-1,5,3,3,2,0,0,2,0,-2,2,0,0,3,0,0,3,-2,0,1,0,0,0,0,0,5,FALSE,1,90,FALSE,0,75,FALSE,1,90,FALSE,1,50,TRUE,1,75,FALSE,1,80,TRUE,1,75,TRUE,1,100,FALSE,0,50,TRUE,1,95,FALSE,1,95,TRUE,0,100,TRUE,1,90,FALSE,1,90,TRUE,1,50,FALSE,0,90,FALSE,1,80,TRUE,0,60,FALSE,1,50,FALSE,1,50,TRUE,1,95,TRUE,1,90,FALSE,1,95,TRUE,1,75,FALSE,1,95,TRUE,1,90,FALSE,1,50,FALSE,1,50,TRUE,0,60,FALSE,0,95,TRUE,1,50,TRUE,1,100,0,0.01,0.81,0.0625,0,0.04,0.0625,0.0025,0.25,0.01,0.9025,0.01,0.25,0.0025,0.0625,0.5625,0.0025,0.25,0.25,0.0025,0.0025,0.25,0.25,0.01,0.04,0.25,0.25,0.01,0.01,0.36,0.36,1,0.194732143,0.171964286,0.2175,25,78.13,25,78.13,6,75,7,87.5,7,87.5,5,62.5,12,75,13,81.25,77.5,58.75,84.38,85.62,81.25,80.94,74.06,0,-0.63,-16.25,-3.12,-1.88,18.75,5.94,-7.19,0,1,0,0,0,3,1,1,3,1,3,2,0,2,1,3,1,2,3,1,0,0,0,1,1,0,2,0,0,1,0,1,0,1,2,0,1,1,0,2,0.2,1.8,1.6,2,0.4,0.6,0.8,0.8,1.4,0.65,1.025,2.67,2,3,-0.2,1.2,0.8,1.2,0.6,2,0,0,0,0.67,1,0,-2,-1,1,2,-2,0,0,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,Very interesting survey. ,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,01PAST,02DGEN,01DIR,5,7,8,3,2,6,4,1,9,2,4,3,1 +1051,R_50ctFWHn1sR6MOg,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,5,2,4,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,2,4,3,5,1,Strongly Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,3,1,2,5,Neither agree nor disagree,Agree,Agree,Somewhat agree,Somewhat disagree,3,5,4,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,1,5,2,4,6,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,1,2,3,5,4,6,Strongly Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,5,3,2,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,2,1,4,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Somewhat agree,Agree,1,5,3,4,2,5,Agree,Strongly disagree,Agree,Strongly disagree,Agree,2,5,1,4,3,5,Strongly Agree,Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,4,1,3,2,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,93,FALSE,57,TRUE,98,TRUE,87,TRUE,91,TRUE,63,TRUE,88,FALSE,61,TRUE,98,FALSE,68,TRUE,95,FALSE,72,FALSE,90,FALSE,71,TRUE,90,FALSE,67,TRUE,98,FALSE,72,TRUE,100,FALSE,68,TRUE,88,FALSE,96,TRUE,90,FALSE,71,TRUE,100,FALSE,100,FALSE,99,TRUE,77,FALSE,67,TRUE,99,TRUE,86,TRUE,87,22,3,3,3,2,3,1,-3,2,-3,2,3,-2,3,0,3,0,2,2,1,-1,3,3,3,2,3,6,1,-3,1,-3,2,6,3,-3,3,1,3,6,0,0,1,0,-1,5,2,2,2,1,2,5,2,-3,2,-3,2,5,3,-2,3,-1,3,2,0,0,0,0,0,5,TRUE,0,87,TRUE,1,86,TRUE,0,99,FALSE,1,67,TRUE,1,77,FALSE,1,99,FALSE,0,100,TRUE,1,100,FALSE,0,71,TRUE,1,90,FALSE,1,96,TRUE,0,88,FALSE,0,68,TRUE,0,100,FALSE,0,72,TRUE,1,98,FALSE,1,67,TRUE,0,90,FALSE,1,71,FALSE,1,90,FALSE,0,72,TRUE,1,95,FALSE,1,68,TRUE,1,98,FALSE,1,61,TRUE,1,88,TRUE,0,63,TRUE,0,91,TRUE,0,87,TRUE,1,98,FALSE,0,57,TRUE,1,93,0,0.0144,0.0004,1,0.0049,0.0001,0.0004,0.01,0.01,0.0025,0.0004,0.4624,0.5041,0.0016,0.0529,0.0196,0.1024,0.1089,0.8281,0.1521,0.5184,0.5184,0.0841,1,0.1089,0.3969,0.3249,0.7569,0.9801,0.81,0.7569,0.7744,0.331796429,0.091442857,0.57215,22,68.75,18,56.25,4,50,5,62.5,4,50,5,62.5,10,62.5,8,50,83.97,72.88,78.88,88.88,95.25,85.19,82.75,12.5,27.72,22.88,16.38,38.88,32.75,22.69,32.75,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,2,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,2,2,1,1,0,0.2,0.4,0.8,1,0.2,0.2,1.2,0.35,0.65,0.5,6,4,5,-1,0,0.2,-0.4,-0.266666667,1,1,4,0,2,0,2,2,-2,2,0,0,-1,1,-2,2,1,10 cents,100 minutes,36 days,Female,University - PhD,38,This was too long,1.25,0,0,0,1,1,0,0,0.67,03VLPfPs,01EOHI,02FUT,01ITEM,02REV,8,6,3,4,7,9,5,1,2,3,4,2,1 +1052,R_7zVcxc8cgaWuoj3,18 - 24,,Canadian,Canadian,Female,Neither agree nor disagree,Somewhat agree,Disagree,Strongly disagree,Agree,3,4,5,2,1,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Agree,2,5,3,4,1,Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Disagree,5,1,4,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,5,1,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,1,3,2,4,5,3,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Agree,4,3,2,5,1,1,Strongly Disagree,Disagree,Strongly Agree,Neither Agree nor Disagree,Disagree,4,2,3,5,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,1,5,4,3,2,6,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Somewhat agree,Disagree,Disagree,Somewhat agree,1,5,4,2,3,4,Strongly disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,2,3,4,5,1,4,Strongly Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Disagree,4,2,5,3,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,95,FALSE,50,TRUE,76,FALSE,58,FALSE,55,FALSE,50,TRUE,92,FALSE,91,TRUE,82,FALSE,96,TRUE,95,TRUE,58,FALSE,82,TRUE,89,TRUE,55,TRUE,55,TRUE,94,TRUE,69,TRUE,50,TRUE,66,TRUE,96,FALSE,50,TRUE,93,TRUE,96,TRUE,91,TRUE,77,FALSE,50,TRUE,96,FALSE,54,TRUE,78,TRUE,88,TRUE,61,22,0,1,-2,-3,2,-3,1,3,-3,2,-2,-1,2,0,-1,1,1,1,0,0,1,0,0,-3,-3,3,-3,1,3,-3,2,1,-3,-2,3,0,-2,2,0,0,0,-2,0,6,0,1,-2,-2,1,4,-3,0,3,-3,2,4,-3,0,3,0,-2,3,1,1,1,1,0,3,TRUE,0,61,TRUE,1,88,TRUE,0,78,FALSE,1,54,TRUE,1,96,FALSE,1,50,TRUE,1,77,TRUE,1,91,TRUE,1,96,TRUE,1,93,FALSE,1,50,TRUE,0,96,TRUE,1,66,TRUE,0,50,TRUE,1,69,TRUE,1,94,TRUE,0,55,TRUE,0,55,TRUE,0,89,FALSE,1,82,TRUE,1,58,TRUE,1,95,FALSE,1,96,TRUE,1,82,FALSE,1,91,TRUE,1,92,FALSE,1,50,FALSE,1,55,FALSE,1,58,TRUE,1,76,FALSE,0,50,TRUE,1,95,0.0081,0.0064,0.0036,0.0529,0.0025,0.25,0.0324,0.0049,0.0324,0.0025,0.0576,0.1156,0.0016,0.25,0.0016,0.0144,0.0016,0.2116,0.2025,0.0081,0.1764,0.0961,0.7921,0.25,0.3025,0.25,0.25,0.3721,0.6084,0.3025,0.1764,0.9216,0.203121429,0.069907143,0.336335714,22,68.75,24,75,6,75,7,87.5,5,62.5,6,75,15,93.75,9,56.25,74.62,68.25,71.75,76.75,81.75,82.38,66.88,-6.25,-0.38,-6.75,-15.75,14.25,6.75,-11.37,10.63,1,1,2,0,5,0,0,0,0,0,1,1,1,0,1,1,1,1,2,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1.8,0,0.8,1,0.4,0.2,0.8,0.2,0.9,0.4,0.65,2,3.67,3.25,1.4,-0.2,0,0.8,0.4,-1,-3,-1,3,-1.67,2,2,2,-1,1,0,0,-2,2,-2,2,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,24,,1.375,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,01PAST,01ITEM,02REV,2,4,6,9,3,5,7,1,8,4,3,2,1 +1053,R_7Wm0ehpn1dyWifT,32 - 38,,Canadian,Canadian,Female,Disagree,Somewhat disagree,Somewhat agree,Agree,Strongly agree,3,5,1,4,2,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,4,2,1,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,2,4,1,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,3,2,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Neither agree nor disagree,Disagree,Somewhat disagree,Strongly disagree,Neither agree nor disagree,1,2,4,3,5,6,Somewhat disagree,Agree,Agree,Strongly agree,Strongly agree,2,4,1,3,5,6,Somewhat Disagree,Strongly Disagree,Neither Agree nor Disagree,Strongly Agree,Disagree,1,5,4,2,3,5,Agree,Strongly Agree,Strongly Agree,Agree,Somewhat agree,5,3,2,4,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Strongly Agree,5,2,4,3,1,6,Somewhat agree,Somewhat disagree,Strongly agree,Disagree,Somewhat agree,2,3,5,1,4,3,Agree,Agree,Strongly agree,Neither Agree nor Disagree,Agree,5,3,4,2,1,7,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,5,2,1,4,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,53,FALSE,50,TRUE,92,TRUE,51,TRUE,53,TRUE,50,TRUE,92,TRUE,82,TRUE,55,FALSE,52,FALSE,53,TRUE,64,FALSE,50,FALSE,70,TRUE,100,TRUE,82,TRUE,58,TRUE,54,TRUE,59,TRUE,62,FALSE,100,TRUE,55,TRUE,79,FALSE,53,TRUE,60,TRUE,100,TRUE,55,FALSE,50,TRUE,55,TRUE,74,FALSE,50,TRUE,94,18,-2,-1,1,2,3,-1,-2,3,0,1,1,0,1,1,1,-1,-1,-1,-1,-2,0,-2,-1,-3,0,3,-1,2,2,3,3,6,-1,-3,0,3,-2,6,2,3,3,2,1,5,1,-1,2,1,3,5,1,-1,3,-2,1,6,2,2,3,0,2,3,-1,-1,-1,-1,-2,7,TRUE,0,94,FALSE,0,50,TRUE,0,74,TRUE,0,55,FALSE,0,50,TRUE,0,55,TRUE,1,100,TRUE,1,60,FALSE,0,53,TRUE,1,79,TRUE,0,55,FALSE,1,100,TRUE,1,62,TRUE,0,59,TRUE,1,54,TRUE,1,58,TRUE,0,82,TRUE,0,100,FALSE,1,70,FALSE,1,50,TRUE,1,64,FALSE,0,53,FALSE,1,52,TRUE,1,55,TRUE,0,82,TRUE,1,92,TRUE,0,50,TRUE,0,53,TRUE,0,51,TRUE,1,92,FALSE,0,50,FALSE,0,53,0.16,0.0064,0.1764,0,0.2809,0.3025,0.2025,0.0441,0.25,0.2809,0.0064,0.1444,0.2809,0.3025,0.25,0.25,0.2304,0.3025,0.2809,0.6724,0.1296,0.2116,0.09,0.3481,0.6724,0.25,0.25,0.8836,0.5476,1,0.2601,0,0.311582143,0.223428571,0.399735714,18,56.25,14,43.75,2,25,3,37.5,3,37.5,6,75,10,62.5,4,25,65.84,54.62,58.62,82.38,67.75,64.06,67.62,12.5,22.09,29.62,21.12,44.88,-7.25,1.56,42.62,2,1,2,5,3,0,4,1,3,2,2,3,1,2,3,3,4,4,3,3,3,0,1,1,0,2,1,0,2,0,1,2,2,1,1,0,0,0,0,0,2.6,2,2.2,3.4,1,1,1.4,0,2.55,0.85,1.7,5,4.67,5.125,1.6,1,0.8,3.4,1.133333333,-2,0,3,-2,0.33,1,2,1,-2,2,-1,1,-1,1,0,0,-1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),36,"I really enjoyed this survey and would love to know the results/findings of this survey though I know that’s impossible. + +Regarding the ten years from now questions, I feel that what I wanted my life to be ten years from now is different from what I think my life would be ten years from now so I was a little unsure doing that section. ",0.875,1,1,1,0,0,0,1,0,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,7,5,2,3,8,6,4,1,9,3,4,2,1 +1054,R_14AiiVMvOeu3nV1,32 - 38,,Canadian,Canadian,Female,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,5,3,4,1,2,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,5,1,2,3,4,Agree,Somewhat Disagree,Somewhat Agree,Disagree,Agree,4,1,2,3,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,4,3,5,1,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Somewhat disagree,Agree,2,4,3,5,1,1,Somewhat agree,Strongly disagree,Agree,Disagree,Somewhat agree,2,5,4,1,3,1,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Agree,2,5,1,4,3,1,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,3,1,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Agree,Agree,Neither agree nor disagree,Agree,4,1,2,3,5,1,Somewhat agree,Strongly disagree,Agree,Disagree,Neither agree nor disagree,1,4,3,5,2,0,Agree,Somewhat Disagree,Agree,Disagree,Agree,2,5,1,3,4,3,Agree,Agree,Agree,Agree,Somewhat agree,2,5,1,4,3,FALSE,99,TRUE,89,FALSE,88,FALSE,57,TRUE,93,FALSE,100,TRUE,100,TRUE,100,TRUE,98,TRUE,100,FALSE,92,TRUE,100,TRUE,89,FALSE,97,TRUE,89,TRUE,100,TRUE,96,FALSE,98,FALSE,88,FALSE,92,FALSE,81,TRUE,88,FALSE,98,TRUE,100,FALSE,94,TRUE,100,FALSE,80,FALSE,100,FALSE,72,TRUE,98,FALSE,63,TRUE,100,26,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,2,2,0,2,1,-3,3,-2,1,2,-1,1,-2,2,1,2,2,2,1,3,2,2,-1,2,1,1,-3,2,-2,1,1,2,-1,1,-1,2,1,2,2,2,1,1,1,3,2,2,0,2,1,1,-3,2,-2,0,1,2,-1,2,-2,2,0,2,2,2,2,1,3,FALSE,1,99,TRUE,1,89,FALSE,1,88,FALSE,1,57,TRUE,1,93,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,98,TRUE,1,100,FALSE,1,92,TRUE,0,100,TRUE,1,89,FALSE,1,97,TRUE,1,89,TRUE,1,100,TRUE,0,96,FALSE,1,98,FALSE,1,88,FALSE,1,92,FALSE,0,81,TRUE,1,88,FALSE,1,98,TRUE,1,100,FALSE,1,94,TRUE,1,100,FALSE,1,80,FALSE,1,100,FALSE,1,72,TRUE,1,98,FALSE,0,63,TRUE,1,100,0,0,0,0,0,0,0,0,0.0064,0.0144,0.0004,0.0121,0.0004,0.0064,0.0049,0.0121,0.0004,0.1849,0,0.0036,0.6561,0.0121,0.0144,0.0009,0.9216,0.04,0.3969,0.0001,0.0144,0.0004,0.0784,1,0.120760714,0.017314286,0.224207143,26,81.25,28,87.5,7,87.5,6,75,8,100,7,87.5,14,87.5,14,87.5,91.84,82,91.12,97,97.25,93,90.69,-6.25,4.34,-5.5,16.12,-3,9.75,5.5,3.19,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0.2,0.2,0.2,0.4,0,0.4,0.2,0.2,0.25,0.2,0.225,1,0.67,1.125,0.2,-0.2,0,0.2,0,0,0,1,-2,0.33,1,2,1,-2,2,0,0,-2,2,-2,2,1,10 cents,5 minutes,15 days,Female,University - Undergraduate,35,interesting. trying to figure out what it was trying to achieve,1.375,0,1,0,1,0,0,0.33,0.33,02PsVLPf,01EOHI,02FUT,02DGEN,01DIR,5,7,6,3,4,8,9,1,2,2,4,3,1 +1055,R_7iUqK9XSmc5WjKy,32 - 38,,Canadian,Canadian,Female,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,5,4,3,2,1,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,4,1,3,5,2,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Agree,1,4,5,3,2,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,3,4,Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,4,5,2,3,4,Agree,Somewhat agree,Agree,Agree,Strongly agree,1,3,5,4,2,3,Agree,Agree,Agree,Agree,Strongly Agree,1,4,5,2,3,3,Agree,Somewhat agree,Agree,Somewhat agree,Agree,1,3,4,5,2,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,6,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,1,5,2,4,8,Strongly Agree,Agree,Strongly Agree,Agree,Agree,1,2,3,5,4,4,Agree,Strongly Agree,Agree,Strongly Agree,Disagree,3,2,4,5,1,8,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,68,FALSE,57,TRUE,100,FALSE,55,TRUE,72,FALSE,54,TRUE,99,TRUE,100,FALSE,63,FALSE,59,TRUE,66,TRUE,97,TRUE,96,TRUE,78,TRUE,79,TRUE,96,TRUE,69,TRUE,64,TRUE,89,FALSE,66,TRUE,79,TRUE,80,TRUE,92,TRUE,97,TRUE,74,TRUE,94,FALSE,62,TRUE,78,TRUE,74,TRUE,84,FALSE,64,FALSE,83,17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,3,2,1,3,2,1,3,1,2,3,2,3,3,2,2,1,1,1,1,2,3,3,3,2,4,2,1,2,2,3,3,2,2,2,2,3,3,2,1,2,1,2,3,3,3,2,3,3,6,2,2,2,1,1,8,3,2,3,2,2,4,2,3,2,3,-2,8,FALSE,1,68,FALSE,0,57,TRUE,0,100,FALSE,1,55,TRUE,1,72,FALSE,1,54,TRUE,1,99,TRUE,1,100,FALSE,0,63,FALSE,0,59,TRUE,0,66,TRUE,0,97,TRUE,1,96,TRUE,0,78,TRUE,1,79,TRUE,1,96,TRUE,0,69,TRUE,0,64,TRUE,0,89,FALSE,1,66,TRUE,1,79,TRUE,1,80,TRUE,0,92,TRUE,1,97,TRUE,0,74,TRUE,1,94,FALSE,1,62,TRUE,0,78,TRUE,0,74,TRUE,1,84,FALSE,0,64,FALSE,0,83,0,0.0036,0.0016,0.0001,0.6889,0.2116,0.0009,0.3481,0.1156,0.04,0.0256,0.0016,0.3969,0.4356,0.0784,0.3249,0.8464,0.2025,0.6084,0.5476,0.0441,0.0441,0.7921,0.6084,0.4761,0.1444,0.4096,0.1024,1,0.4096,0.5476,0.9409,0.371153571,0.2655,0.476807143,17,53.13,16,50,3,37.5,4,50,4,50,5,62.5,11,68.75,5,31.25,77.75,66.88,77.38,77,89.75,81.38,74.12,3.13,27.75,29.38,27.38,27,27.25,12.63,42.87,0,0,1,2,1,0,0,1,1,1,1,0,1,1,1,0,0,1,0,1,1,0,0,2,0,0,1,1,0,1,0,0,0,1,0,0,2,1,2,3,0.8,0.6,0.8,0.4,0.6,0.6,0.2,1.6,0.65,0.75,0.7,3.33,6,4.875,0.2,0,0.6,-1.2,0.266666667,-2,-5,-1,-5,-2.67,1,1,2,1,-1,2,-2,-1,1,-1,1,1,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),35,It was fascinating answering the questions critically,0.5,0,1,0,1,0,1,0.33,0.67,01PfPsVL,02COC,02FUT,01ITEM,01DIR,7,9,3,5,4,6,2,1,8,3,2,4,1 +1056,R_10jBeCnb04zrIat,32 - 38,,Canadian,Canadian,Male,Disagree,Agree,Agree,Disagree,Agree,3,1,2,4,5,Somewhat disagree,Somewhat disagree,Strongly agree,Disagree,Agree,4,2,5,1,3,Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,5,3,4,1,2,Agree,Agree,Agree,Agree,Somewhat agree,4,1,5,2,3,Strongly disagree,Agree,Strongly Agree,Disagree,Agree,1,4,3,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,5,1,3,4,2,2,Disagree,Strongly Disagree,Strongly Agree,Agree,Strongly Agree,1,2,5,4,3,3,Agree,Agree,Agree,Agree,Agree,5,4,1,3,2,2,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Neither agree nor disagree,Agree,Agree,Agree,Agree,4,1,3,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Disagree,Neither agree nor disagree,1,4,3,2,5,2,Strongly Disagree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,2,3,4,1,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,4,5,2,3,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,70,TRUE,50,TRUE,81,FALSE,50,FALSE,50,FALSE,90,TRUE,92,FALSE,76,FALSE,70,TRUE,76,FALSE,75,TRUE,80,FALSE,50,TRUE,91,FALSE,50,TRUE,81,FALSE,50,TRUE,80,FALSE,90,FALSE,100,FALSE,70,FALSE,50,FALSE,50,FALSE,50,TRUE,75,TRUE,91,FALSE,50,FALSE,50,FALSE,50,TRUE,75,FALSE,50,TRUE,50,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,-2,2,2,-2,2,-1,-1,3,-2,2,-2,-3,3,-2,3,2,2,2,2,1,-3,2,3,-2,2,3,0,0,3,-3,2,2,-2,-3,3,2,3,3,2,2,2,2,2,2,0,2,2,2,2,2,0,0,3,-2,0,2,-3,-3,3,-2,3,1,0,0,0,2,0,5,FALSE,1,70,TRUE,1,50,TRUE,0,81,FALSE,1,50,FALSE,0,50,FALSE,1,90,TRUE,1,92,FALSE,0,76,FALSE,0,70,TRUE,1,76,FALSE,1,75,TRUE,0,80,FALSE,0,50,TRUE,0,91,FALSE,0,50,TRUE,1,81,FALSE,1,50,TRUE,0,80,FALSE,1,90,FALSE,1,100,FALSE,0,70,FALSE,0,50,FALSE,1,50,FALSE,0,50,TRUE,0,75,TRUE,1,91,FALSE,1,50,FALSE,1,50,FALSE,1,50,TRUE,1,75,FALSE,0,50,TRUE,1,50,0.5776,0.0081,0.0361,0.0064,0.25,0.01,0.25,0.0576,0,0.25,0.0625,0.25,0.49,0.0625,0.25,0.25,0.25,0.25,0.25,0.5625,0.49,0.25,0.01,0.8281,0.25,0.25,0.25,0.09,0.6561,0.64,0.25,0.64,0.289260714,0.191614286,0.386907143,5,15.63,18,56.25,5,62.5,5,62.5,4,50,4,50,7,43.75,11,68.75,67.59,60.62,57.5,78.12,74.12,64.44,70.75,-40.62,11.34,-1.88,-5,28.12,24.12,20.69,2,1,0,1,0,0,1,1,0,1,0,0,0,0,4,0,0,0,0,0,1,2,0,0,4,0,1,1,0,0,2,1,0,0,0,0,2,2,2,0,1,0.4,0.6,0.8,0.2,1.2,0.8,0.2,1.4,0.5,0.9,0.7,2.67,1.67,2.5,-0.8,-0.2,0.6,-1.2,-0.133333333,1,0,2,-3,1,2,2,2,-2,2,-1,1,-2,2,-2,2,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,36,,1.875,0,1,0,1,0,1,0.33,0.67,03VLPfPs,01EOHI,01PAST,01ITEM,01DIR,3,2,8,7,4,5,6,1,9,3,2,4,1 +1057,R_5gXU659OXdRsSdG,32 - 38,,Canadian,Canadian,Female,Agree,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,2,3,5,4,Disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,4,1,2,5,Agree,Somewhat Disagree,Somewhat Agree,Disagree,Strongly Agree,5,3,1,2,4,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,3,4,5,1,Somewhat disagree,Agree,Agree,Strongly disagree,Agree,5,4,2,1,3,5,Strongly disagree,Neither agree nor disagree,Somewhat agree,Agree,Agree,3,5,2,1,4,3,Agree,Agree,Somewhat Disagree,Somewhat Agree,Agree,1,4,3,2,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,1,2,5,4,3,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,5,2,4,3,1,3,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,4,3,5,2,2,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,1,4,3,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat disagree,4,3,2,5,1,4,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,100,TRUE,75,TRUE,100,FALSE,51,TRUE,90,FALSE,100,TRUE,100,TRUE,100,TRUE,90,TRUE,50,TRUE,70,TRUE,90,TRUE,75,FALSE,60,FALSE,100,TRUE,100,TRUE,90,TRUE,52,TRUE,100,FALSE,50,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,90,TRUE,91,TRUE,50,TRUE,75,TRUE,100,TRUE,100,FALSE,60,FALSE,91,16,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,0,-1,-1,-2,1,1,2,0,2,-1,1,-2,3,-1,-1,-1,1,-1,-1,2,2,-3,2,5,-3,0,1,2,2,3,2,2,-1,1,2,4,1,1,1,2,0,3,2,1,0,2,-1,3,-2,1,1,0,1,2,1,0,3,-3,3,3,0,-1,0,2,-1,4,FALSE,1,100,TRUE,1,75,TRUE,0,100,FALSE,1,51,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,90,TRUE,1,50,TRUE,0,70,TRUE,0,90,TRUE,1,75,FALSE,1,60,FALSE,0,100,TRUE,1,100,TRUE,0,90,TRUE,0,52,TRUE,0,100,FALSE,1,50,TRUE,1,100,TRUE,1,100,FALSE,1,100,TRUE,1,100,FALSE,1,90,TRUE,1,91,TRUE,0,50,TRUE,0,75,TRUE,0,100,TRUE,1,100,FALSE,0,60,FALSE,0,91,0,0.0081,0,0,0.8281,0,0,0.25,0.25,0,0,0.0625,0.01,0.49,0.01,0.0625,0,0.2401,0.5625,0.01,0,1,1,0.16,0.81,0.25,0.36,0,1,0.2704,1,0.81,0.337003571,0.157371429,0.516635714,16,50,20,62.5,3,37.5,5,62.5,7,87.5,5,62.5,13,81.25,7,43.75,84.38,74.5,93.25,80.38,89.38,88.88,79.88,-12.5,21.88,37,30.75,-7.12,26.88,7.63,36.13,3,0,2,2,3,1,1,0,0,2,0,3,2,3,1,2,2,2,1,1,0,1,0,3,0,0,0,0,2,1,1,1,2,1,0,1,0,1,1,0,2,0.8,1.8,1.6,0.8,0.6,1,0.6,1.55,0.75,1.15,4,2.67,3.375,1.2,0.2,0.8,1,0.733333333,2,1,1,-1,1.33,-1,2,1,-1,1,-1,1,-1,1,0,0,1,10 cents,5 minutes,47 days,Female,High School (or equivalent),32,very interesting subject,0.75,0,1,1,1,0,0,0.67,0.33,01PfPsVL,02COC,02FUT,01ITEM,01DIR,8,4,3,7,9,5,2,1,6,3,4,2,1 +1058,R_75Fb2p82PhEaCGb,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Agree,Disagree,Disagree,3,1,4,2,5,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,5,2,4,3,1,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,2,1,3,4,5,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,Disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Somewhat agree,Strongly Agree,Agree,Somewhat agree,Disagree,4,3,1,5,2,3,Somewhat agree,Agree,Somewhat disagree,Agree,Somewhat agree,5,1,4,3,2,1,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,3,4,5,2,1,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly disagree,Disagree,3,5,2,1,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,1,Strongly Agree,Strongly Agree,Agree,Neither agree nor disagree,Disagree,2,5,4,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,5,1,3,4,1,Strongly agree,Neither Agree nor Disagree,Agree,Agree,Strongly agree,2,3,4,1,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,2,3,5,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,91,TRUE,60,FALSE,50,TRUE,70,FALSE,100,TRUE,50,TRUE,100,FALSE,100,TRUE,90,FALSE,100,TRUE,85,TRUE,80,FALSE,100,FALSE,90,TRUE,100,FALSE,100,TRUE,100,TRUE,50,FALSE,95,FALSE,85,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,TRUE,100,FALSE,50,FALSE,100,TRUE,75,FALSE,100,28,3,3,2,-2,-2,-2,1,-1,1,1,3,0,2,1,3,-2,1,0,-2,-2,1,3,2,1,-2,1,1,2,-1,2,1,3,3,0,1,0,3,1,0,1,1,-3,-2,2,3,3,2,0,-2,1,0,0,1,0,1,4,3,0,2,2,3,1,1,1,1,1,-2,6,FALSE,1,100,TRUE,1,75,FALSE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,FALSE,0,85,FALSE,1,95,TRUE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,FALSE,1,90,FALSE,1,100,TRUE,1,80,TRUE,1,85,FALSE,1,100,TRUE,1,90,FALSE,1,100,TRUE,1,100,TRUE,0,50,FALSE,1,100,TRUE,0,70,FALSE,0,50,TRUE,1,60,TRUE,1,91,0,0,0,0,0.0081,0,0.01,0,0,0.0225,0.25,0.7225,0,0,0,0.0625,0,0.25,0,0,0.04,0.25,0.01,0.0025,0,0.25,0.16,0,0,1,0.49,0,0.126003571,0.094685714,0.157321429,28,87.5,27,84.38,7,87.5,6,75,7,87.5,7,87.5,14,87.5,13,81.25,88.16,71.88,90.75,97.5,92.5,85.38,90.94,3.12,3.78,-15.62,15.75,10,5,-2.12,9.69,2,0,0,3,0,3,1,0,1,0,0,0,1,1,0,2,0,1,1,0,0,0,0,2,0,2,1,2,1,0,0,0,0,1,0,3,0,1,3,0,1,1,0.4,0.8,0.4,1.2,0.2,1.4,0.8,0.8,0.8,1.67,2,2.375,0.6,-0.2,0.2,-0.6,0.2,0,-1,0,-4,-0.33,0,2,2,-2,2,-1,1,-1,1,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),33,Interesting survey.,1.25,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,02DGEN,02REV,6,4,7,3,9,2,8,1,5,2,3,4,1 +1059,R_15F05olnqxr8h3U,32 - 38,,Canadian,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Somewhat disagree,3,2,1,4,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,5,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,3,4,2,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,2,1,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Somewhat disagree,Somewhat disagree,2,4,3,5,1,3,Disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,5,3,1,4,2,3,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,2,3,1,5,4,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,4,5,1,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,3,Agree,Agree,Agree,Somewhat agree,Somewhat disagree,1,5,4,3,2,4,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,3,1,3,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,4,2,5,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,3,1,2,TRUE,86,TRUE,51,TRUE,60,FALSE,51,TRUE,60,FALSE,75,TRUE,59,TRUE,60,TRUE,79,TRUE,60,FALSE,51,TRUE,54,TRUE,70,TRUE,55,FALSE,70,TRUE,80,TRUE,51,TRUE,60,FALSE,51,FALSE,51,FALSE,60,TRUE,60,FALSE,90,TRUE,70,TRUE,55,TRUE,65,TRUE,52,FALSE,52,TRUE,59,TRUE,60,TRUE,51,TRUE,60,14,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,2,2,2,1,-1,-1,-1,1,1,1,2,1,1,1,2,-1,1,1,-1,-1,2,2,2,-1,-1,3,-2,-2,1,1,-1,3,2,1,1,2,1,3,-1,1,-1,-1,-1,6,2,2,2,1,-1,3,-1,-2,1,1,1,4,2,1,1,1,2,3,1,1,1,1,1,4,TRUE,0,86,TRUE,1,51,TRUE,0,60,FALSE,1,51,TRUE,1,60,FALSE,1,75,TRUE,1,59,TRUE,1,60,TRUE,1,79,TRUE,1,60,FALSE,1,51,TRUE,0,54,TRUE,1,70,TRUE,0,55,FALSE,0,70,TRUE,1,80,TRUE,0,51,TRUE,0,60,FALSE,1,51,FALSE,1,51,FALSE,0,60,TRUE,1,60,FALSE,1,90,TRUE,1,70,TRUE,0,55,TRUE,1,65,TRUE,0,52,FALSE,1,52,TRUE,0,59,TRUE,1,60,TRUE,1,51,TRUE,1,60,0.16,0.1225,0.04,0.1681,0.16,0.0625,0.09,0.16,0.2401,0.16,0.16,0.09,0.0441,0.2401,0.16,0.2401,0.01,0.2401,0.2304,0.3025,0.36,0.49,0.2401,0.3025,0.2601,0.2704,0.2401,0.7396,0.36,0.36,0.3481,0.2916,0.244728571,0.146928571,0.342528571,14,43.75,21,65.63,6,75,5,62.5,4,50,6,75,14,87.5,7,43.75,61.5,57,65.62,62.5,60.88,63.44,59.56,-21.88,-4.13,-18,3.12,12.5,-14.12,-24.06,15.81,0,0,0,2,0,1,1,0,0,2,0,0,0,1,1,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,2,2,0.4,0.8,0.4,0.4,0,0.2,0,1.2,0.5,0.35,0.425,3,3.33,3.625,0.4,0.6,0.4,-0.8,0.466666667,0,-1,0,2,-0.33,1,2,2,-1,1,1,-1,-1,1,-1,1,1,10 cents,25 minutes,47 days,Male,College Diploma/Certificate,36,Straightforward and clear survey,1,0,0,1,1,0,0,0.33,0.33,02PsVLPf,01EOHI,01PAST,02DGEN,01DIR,9,7,6,8,4,2,5,1,3,2,3,4,1 +1060,R_3k0Wezenu6zwiKK,32 - 38,,Canadian,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,2,3,4,5,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Agree,3,4,1,2,5,Agree,Agree,Agree,Agree,Agree,4,5,1,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,3,2,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,2,3,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,3,4,5,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,4,1,2,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Agree,Agree,Agree,Agree,Agree,2,5,3,1,4,6,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,8,Agree,Agree,Agree,Agree,Agree,2,3,1,4,5,7,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,TRUE,81,TRUE,100,TRUE,86,TRUE,100,TRUE,100,TRUE,100,TRUE,69,TRUE,100,FALSE,77,TRUE,69,TRUE,80,FALSE,100,TRUE,50,TRUE,100,TRUE,81,TRUE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,100,TRUE,50,TRUE,50,TRUE,54,TRUE,100,TRUE,50,FALSE,100,TRUE,100,TRUE,50,TRUE,50,TRUE,50,TRUE,50,16,1,3,3,3,2,1,1,2,-1,2,2,2,2,2,2,0,0,1,0,0,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,2,2,2,2,2,6,2,2,2,2,2,8,1,1,1,1,1,8,2,2,2,2,2,7,TRUE,0,50,TRUE,1,50,TRUE,0,50,TRUE,0,50,TRUE,1,100,FALSE,1,100,TRUE,1,50,TRUE,1,100,TRUE,1,54,TRUE,1,50,TRUE,0,50,TRUE,0,100,TRUE,1,50,TRUE,0,50,TRUE,1,100,TRUE,1,100,TRUE,0,81,TRUE,0,100,TRUE,0,50,FALSE,1,100,TRUE,1,80,TRUE,1,69,FALSE,1,77,TRUE,1,100,TRUE,0,69,TRUE,1,100,TRUE,0,100,TRUE,0,100,TRUE,0,86,TRUE,1,100,TRUE,1,81,TRUE,1,100,0,0,0,0.25,0,0,0,0.25,0,0.0961,0,0.25,0.2116,0.25,0,0.25,0.0529,0.25,1,0.4761,0.04,0,0.25,0.25,0.6561,1,0.0361,0.25,0.25,1,0.7396,1,0.305660714,0.115042857,0.496278571,16,50,19,59.38,4,50,6,75,4,50,5,62.5,16,100,3,18.75,78.03,66.88,84.25,67.25,93.75,80.25,75.81,-9.38,18.65,16.88,9.25,17.25,31.25,-19.75,57.06,0,2,2,2,1,0,0,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,3,0,1,1,1,1,1,2,2,1,2,2,1.4,0.8,1,0.8,0.8,1,1,1.8,1,1.15,1.075,7,7.33,7.125,0.6,-0.2,0,-1,0.133333333,1,-1,-1,0,-0.33,0,0,0,0,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,32,It was okay.,0,0,0,0,1,1,1,0,1,04LPfPsV,02COC,02FUT,01ITEM,02REV,4,8,6,2,7,5,9,1,3,3,2,4,1 +1061,R_5aXOQw00ax7DfeZ,32 - 38,,Canadian,Canadian,Female,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,2,4,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,4,3,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,2,3,5,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,4,1,8,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,2,5,1,8,Agree,Agree,Agree,Strongly disagree,Strongly disagree,1,3,2,5,4,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,8,Agree,Agree,Agree,Agree,Agree,5,3,1,2,4,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,5,4,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,1,4,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,FALSE,51,FALSE,52,FALSE,53,FALSE,52,FALSE,52,FALSE,52,TRUE,59,TRUE,51,TRUE,53,TRUE,54,TRUE,59,TRUE,53,FALSE,51,FALSE,51,FALSE,52,TRUE,51,TRUE,51,TRUE,53,FALSE,51,TRUE,64,TRUE,51,FALSE,51,TRUE,51,FALSE,52,TRUE,52,FALSE,52,FALSE,81,TRUE,52,FALSE,51,TRUE,81,FALSE,51,TRUE,51,1,2,2,2,2,2,0,0,0,0,0,3,0,0,0,0,-3,-3,-3,-3,-3,2,2,2,2,2,8,0,0,0,0,0,8,3,0,0,0,0,8,2,2,2,-3,-3,8,2,2,2,2,2,8,0,0,0,0,0,8,0,0,0,0,0,8,0,0,0,0,0,8,TRUE,0,51,FALSE,0,51,TRUE,0,81,FALSE,1,51,TRUE,1,52,FALSE,1,81,FALSE,0,52,TRUE,1,52,FALSE,0,52,TRUE,1,51,FALSE,1,51,TRUE,0,51,TRUE,1,64,FALSE,1,51,TRUE,1,53,TRUE,1,51,TRUE,0,51,FALSE,1,52,FALSE,1,51,FALSE,1,51,TRUE,1,53,TRUE,1,59,TRUE,0,54,TRUE,1,53,TRUE,0,51,TRUE,1,59,FALSE,1,52,FALSE,1,52,FALSE,1,52,FALSE,0,53,FALSE,0,52,FALSE,0,51,0.2304,0.1681,0.2401,0.2704,0.2601,0.0361,0.2209,0.2401,0.2401,0.1681,0.2809,0.1296,0.2704,0.2401,0.2304,0.2601,0.2916,0.2401,0.2304,0.2601,0.2209,0.2209,0.2401,0.2401,0.2601,0.2304,0.2704,0.2601,0.6561,0.2304,0.2304,0.2601,0.247110714,0.222042857,0.272178571,1,3.13,20,62.5,5,62.5,5,62.5,5,62.5,5,62.5,10,62.5,10,62.5,54.41,51.62,57.25,53.25,55.5,53.62,55.19,-59.37,-8.09,-10.88,-5.25,-9.25,-7,-8.88,-7.31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,3,3,3,3,3,0,0,0,3,0,0,0.6,3,0.75,0.9,0.825,8,8,8,0,0,-0.6,0,-0.2,0,0,0,0,0,1,1,1,-1,1,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),38,"No comments, thank you.",0.5,0,0,0,1,1,1,0,1,04LPfPsV,01EOHI,01PAST,02DGEN,02REV,4,3,7,2,9,5,6,1,8,2,4,3,1 +1062,R_6aaSjwMz2a04kQ9,32 - 38,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,5,2,4,Strongly agree,Strongly disagree,Strongly agree,Disagree,Neither agree nor disagree,5,2,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,2,1,3,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,1,5,2,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,1,5,4,0,Agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Agree,5,3,4,1,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,1,5,4,2,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,1,3,4,2,0,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,2,5,2,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,3,1,4,2,5,9,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,4,5,1,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,1,4,3,5,2,5,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,FALSE,80,TRUE,100,TRUE,64,FALSE,50,FALSE,50,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,FALSE,100,FALSE,100,TRUE,91,FALSE,100,TRUE,90,TRUE,100,TRUE,100,FALSE,100,FALSE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,75,TRUE,100,FALSE,50,TRUE,100,FALSE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,TRUE,100,25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,3,3,3,3,3,3,-3,3,-2,0,3,3,3,0,3,1,-1,0,0,-3,3,3,3,3,3,0,2,-3,1,0,2,4,3,3,3,0,3,2,-3,-3,-3,-3,-3,0,3,3,3,3,3,2,1,-3,3,-2,2,9,3,3,3,0,3,9,0,0,0,0,-2,5,FALSE,1,80,TRUE,1,100,TRUE,0,64,FALSE,1,50,FALSE,0,50,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,91,FALSE,1,100,TRUE,1,90,TRUE,1,100,TRUE,0,100,FALSE,1,100,FALSE,1,100,FALSE,1,100,TRUE,1,100,TRUE,1,100,TRUE,0,75,TRUE,1,100,FALSE,1,50,TRUE,1,100,FALSE,1,100,TRUE,0,100,TRUE,0,100,TRUE,1,100,TRUE,1,100,TRUE,1,100,0,0,0,0,0,0,0,0,0,0,0,0.0081,0,0,0.25,0,0.5625,0.25,1,0.25,0,0.01,0,0,1,0,0,0.04,0.4096,0,1,0,0.170721429,0.076471429,0.264971429,25,78.13,26,81.25,8,100,4,50,8,100,6,75,15,93.75,11,68.75,92.19,92.5,89.5,91.25,95.5,95.69,88.69,-3.12,10.94,-7.5,39.5,-8.75,20.5,1.94,19.94,0,0,0,0,0,1,0,2,2,2,0,0,0,0,0,4,2,3,3,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,1,0,0,1,0,1.4,0,2.4,0,0.8,0,0.6,0.95,0.35,0.65,2,6.67,3.875,0,0.6,0,1.8,0.2,-2,-5,-7,-5,-4.67,2,2,2,-1,1,2,-2,-2,2,-2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,No feedback,1.375,0,0,0,1,1,1,0,1,02PsVLPf,02COC,02FUT,01ITEM,01DIR,7,9,4,8,6,2,5,1,3,4,2,3,1 +1063,R_1TFlsEbpSCpaLq9,18 - 24,,Canadian,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,2,4,5,3,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly agree,Strongly agree,2,4,3,1,5,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Agree,4,2,5,1,3,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,5,4,3,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,2,Strongly Agree,Strongly Agree,Somewhat agree,Strongly Agree,Somewhat agree,4,2,1,5,3,6,Disagree,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,1,4,5,3,2,4,Strongly Disagree,Somewhat Agree,Disagree,Strongly Agree,Disagree,1,3,4,5,2,10,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,Strongly disagree,4,3,1,5,2,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,,,,,,NA,NA,NA,NA,NA,NA,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,1,3,2,5,3,Agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,4,5,3,1,2,3,Neither Agree nor Disagree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,2,3,4,1,8,Agree,Strongly Agree,Agree,Strongly Agree,Somewhat agree,2,1,4,5,3,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,TRUE,100,FALSE,51,TRUE,91,TRUE,65,TRUE,52,TRUE,55,TRUE,91,FALSE,52,TRUE,60,FALSE,100,FALSE,54,TRUE,51,FALSE,52,TRUE,53,TRUE,100,TRUE,62,FALSE,52,FALSE,53,TRUE,59,FALSE,52,TRUE,100,FALSE,54,TRUE,63,TRUE,75,TRUE,100,FALSE,54,FALSE,65,TRUE,53,FALSE,54,TRUE,100,FALSE,52,TRUE,82,17,3,3,1,-1,0,1,1,-1,3,3,1,2,3,1,2,-2,1,1,1,-1,3,3,1,3,1,2,-2,3,-3,3,-1,6,-3,1,-2,3,-2,4,-3,-3,-3,-2,-3,10,3,3,3,2,3,5,2,-1,3,-2,3,3,0,3,3,-1,3,3,2,3,2,3,1,8,TRUE,0,82,FALSE,0,52,TRUE,0,100,FALSE,1,54,TRUE,1,53,FALSE,1,65,FALSE,0,54,TRUE,1,100,TRUE,1,75,TRUE,1,63,FALSE,1,54,TRUE,0,100,FALSE,0,52,TRUE,0,59,FALSE,0,53,FALSE,0,52,TRUE,0,62,TRUE,0,100,TRUE,0,53,FALSE,1,52,TRUE,1,51,FALSE,0,54,FALSE,1,100,TRUE,1,60,FALSE,1,52,TRUE,1,91,TRUE,0,55,TRUE,0,52,TRUE,0,65,TRUE,1,91,FALSE,0,51,TRUE,1,100,0,0.0081,0.2704,0.2916,0,0.1225,0.16,0.1369,0.2304,0.2916,0.0081,0.2704,0.0625,0.2116,0.2209,0.2704,0,0.2116,0.2704,0.2304,0.2401,0.2809,0.2809,0.3481,0.3844,0.3025,0.2601,0.6724,1,1,0.4225,1,0.317485714,0.156921429,0.47805,17,53.13,15,46.88,3,37.5,5,62.5,3,37.5,4,50,9,56.25,6,37.5,67.41,55.88,68.5,69.38,75.88,65.75,69.06,6.25,20.53,18.38,6,31.88,25.88,9.5,31.56,0,0,0,4,1,3,2,2,0,4,4,1,5,2,4,1,4,4,3,2,0,0,2,3,3,1,2,4,5,0,1,1,0,2,1,4,2,1,2,2,1,2.2,3.2,2.8,1.6,2.4,1,2.2,2.3,1.8,2.05,4,3.67,5.125,-0.6,-0.2,2.2,0.6,0.466666667,-3,3,1,2,0.33,-1,0,0,-2,2,1,-1,1,-1,-1,1,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,It was fun ish,-0.25,0,0,0,1,1,1,0,1,03VLPfPs,01EOHI,02FUT,02DGEN,02REV,7,6,5,3,9,2,4,1,8,2,3,4,1 diff --git a/eohi1/exp1_TF_descriptives.csv b/eohi1/exp1_TF_descriptives.csv new file mode 100644 index 0000000..cf16d12 --- /dev/null +++ b/eohi1/exp1_TF_descriptives.csv @@ -0,0 +1,33 @@ +variable,accuracy,TF,n_total,n_correct,prop_correct,match_difficulty,Table A1,Table A2,match_difficulty,,,,,,, +gest_75_T,75,T,1063,952,0.89558,NO,0.75,0.9,M,,,,,,, +dors_55_T,55,T,1063,949,0.89276,NO,0.64,0.96,M,,,,,,, +chur_75_T,75,T,1063,947,0.89087,NO,0.83,0.9,M,,,,,,, +mons_55_T,55,T,1063,944,0.88805,NO,0.55,0.82,H,,,,,,, +lock_35_T,35,T,1063,923,0.8683,NO,0.45,0.9,M,,,,,,, +hume_35_F,35,F,1063,873,0.82126,NO,0.43,0.94,M,,,,,,, +papy_75_T,75,T,1063,873,0.82126,YES,0.78,0.92,M,,,,,,, +sham_55_T,55,T,1063,860,0.80903,NO,0.57,1,M,,,,,,,0.665565 +list_75_F,75,F,1063,855,0.80433,YES,0.85,0.96,L,,,,,,, +cons_55_T,55,T,1063,816,0.76764,NO,0.57,0.9,M,,,,,,, +tsun_75_T,75,T,1063,813,0.76482,YES,0.8,0.96,L,,,,,,, +pana_35_T,35,T,1063,805,0.75729,NO,0.37,0.65,H,,,,,,, +kabu_15_T,15,T,1063,791,0.74412,NO,0.25,0.76,M,,,,,,, +gulf_15_F,15,F,1063,773,0.72719,NO,0.16,0.24,H,,,,,,, +oedi_35_T,35,T,1063,767,0.72154,NO,0.43,0.88,M,,,,,,, +vaud_15_T,15,T,1063,766,0.7206,NO,0.24,0.41,H,,,,,,, +mont_35_F,35,F,1063,748,0.70367,NO,0.36,0.78,M,,,,,,, +demo_15_F,15,F,1063,727,0.68391,NO,0.19,0.39,H,,,,,,, +spee_75_F,75,F,1063,688,0.64722,NO,0.78,0.98,L,,,,,,, +dwar_55_F,55,F,1063,663,0.62371,YES,0.64,0.76,L,,,,,,, +carb_35_T,35,T,1063,629,0.59172,NO,0.39,0.31,H,,,,,,, +bohr_15_T,15,T,1063,626,0.5889,NO,0.16,0.37,H,,,,,,, +gang_15_F,15,F,1063,572,0.5381,NO,0.21,0.39,H,,,,,,, +vitc_55_F,55,F,1063,556,0.52305,NO,0.63,0.84,L,,,,,,, +hert_35_F,35,F,1063,551,0.51834,NO,0.41,0.65,M,,,,,,, +pucc_15_F,15,F,1063,543,0.51082,NO,0.15,0.22,H,,,,,,, +troy_15_T,15,T,1063,504,0.47413,NO,0.22,0.49,M,,,,,,, +moza_55_F,55,F,1063,500,0.47037,NO,0.59,0.71,L,,,,,,, +croc_75_F,75,F,1063,433,0.40734,NO,0.76,0.88,L,,,,,,, +gees_55_F,55,F,1063,324,0.3048,NO,0.57,0.84,L,,,,,,, +lute_35_F,35,F,1063,322,0.30292,NO,0.46,0.67,L,,,,,,, +memo_75_F,75,F,1063,265,0.24929,NO,0.83,0.88,L,,,,,,, diff --git a/eohi1/interaction_DGEN_assumptions.png b/eohi1/interaction_DGEN_assumptions.png new file mode 100644 index 0000000..90ae238 Binary files /dev/null and b/eohi1/interaction_DGEN_assumptions.png differ diff --git a/eohi1/interaction_domain_assumptions.png b/eohi1/interaction_domain_assumptions.png new file mode 100644 index 0000000..2b60a0a Binary files /dev/null and b/eohi1/interaction_domain_assumptions.png differ diff --git a/eohi1/linearity_plots.pdf b/eohi1/linearity_plots.pdf new file mode 100644 index 0000000..aebf7e6 Binary files /dev/null and b/eohi1/linearity_plots.pdf differ diff --git a/eohi1/mixed anova - DGEN.r b/eohi1/mixed anova - DGEN.r new file mode 100644 index 0000000..e27e36e --- /dev/null +++ b/eohi1/mixed anova - DGEN.r @@ -0,0 +1,875 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment Data Analysis - DGEN Level Analysis +# Variables: pastPref_DGEN, pastPers_DGEN, pastVal_DGEN, pastLife_DGEN +# futPref_DGEN, futPers_DGEN, futVal_DGEN, futLife_DGEN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Verify the specific variables we need +required_vars <- c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("pastPref_DGEN", "pastPers_DGEN", "pastVal_DGEN", "pastLife_DGEN", + "futPref_DGEN", "futPers_DGEN", "futVal_DGEN", "futLife_DGEN"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and DOMAIN:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and DOMAIN:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and DOMAIN:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME:") +print(homogeneity_domain) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print("=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × DOMAIN combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(DGEN_SCORE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(DGEN_SCORE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +print("=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, DGEN_SCORE), "TEMPORAL_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + cat("\n=== CORRECTED F-TESTS ===\n") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print("Generalized Eta Squared:") +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN +print("\nMain Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print("Estimated Marginal Means:") +print(domain_emmeans) +print("\nPairwise Contrasts:") +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of TEMPORAL_DO +print("\nMain Effect of TEMPORAL_DO:") +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + +# TEMPORAL_DO × TIME Interaction +print("\n=== TEMPORAL_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) +print("Estimated Marginal Means:") +print(temporal_time_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO:") +temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_time_simple) + +print("\nSimple Effects of TEMPORAL_DO within each TIME:") +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# TIME × DOMAIN Interaction +print("\n=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print("Estimated Marginal Means:") +print(time_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TIME:") +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) + +print("\nSimple Effects of TIME within each DOMAIN:") +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TEMPORAL_DO × DOMAIN Interaction +print("\n=== TEMPORAL_DO × DOMAIN INTERACTION ===") +temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) +print("Estimated Marginal Means:") +print(temporal_domain_emmeans) + +print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") +temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") +print(temporal_domain_simple) + +print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") +temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(temporal_domain_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + +print("\n=== THREE-WAY INTERACTION ANALYSIS ===") +three_way_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * DOMAIN) +print("Estimated Marginal Means:") +print(three_way_emmeans) + +print("\nSimple Effects of TIME within each TEMPORAL_DO × DOMAIN combination:") +three_way_contrasts <- pairs(three_way_emmeans, by = c("TEMPORAL_DO", "DOMAIN"), adjust = "bonferroni") +print(three_way_contrasts) + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# ============================================================================= +# 1. TEMPORAL_DO × TIME INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × TIME INTERACTION ===") + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "DGEN_SCORE") + +# Get simple effects of TEMPORAL_DO within each TIME +temporal_time_simple2_df <- as.data.frame(temporal_time_simple2) +calculate_cohens_d_for_pairs(temporal_time_simple2_df, long_data_clean, "TEMPORAL_DO", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each DOMAIN +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TIME +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +# ============================================================================= +# 3. TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +print("\n=== COHEN'S D FOR TEMPORAL_DO × DOMAIN INTERACTION ===") + +# Get simple effects of TEMPORAL_DO within each DOMAIN +temporal_domain_simple2_df <- as.data.frame(temporal_domain_simple2) +calculate_cohens_d_for_pairs(temporal_domain_simple2_df, long_data_clean, "TEMPORAL_DO", "DOMAIN", "DGEN_SCORE") + +# Get simple effects of DOMAIN within each TEMPORAL_DO +temporal_domain_simple_df <- as.data.frame(temporal_domain_simple) +calculate_cohens_d_for_pairs(temporal_domain_simple_df, long_data_clean, "DOMAIN", "TEMPORAL_DO", "DGEN_SCORE") + +# ============================================================================= +# 4. THREE-WAY INTERACTION COHEN'S D +# ============================================================================= + +print("\n=== COHEN'S D FOR THREE-WAY INTERACTION ===") + +# Get pairwise comparisons for the three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +print("The pairwise comparisons show the TIME effects within each TEMPORAL_DO × DOMAIN combination:") +print(three_way_contrasts_df) + +# Calculate Cohen's d for significant three-way interaction effects +print("\nCohen's d calculations for significant TIME effects within each TEMPORAL_DO × DOMAIN combination:") + +# Extract significant comparisons (p < 0.05) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this TEMPORAL_DO × DOMAIN combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("TEMPORAL_DO = %s, DOMAIN = %s:\n", temporal_do_level, domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant TIME effects found within any TEMPORAL_DO × DOMAIN combination.\n") +} + +# ============================================================================= +# INTERACTION PLOTS +# ============================================================================= + +print("=== INTERACTION PLOTS ===") + +# Define color palette for DOMAIN (4 levels) +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# TEMPORAL_DO × DOMAIN INTERACTION PLOT +# Create estimated marginal means for TEMPORAL_DO × DOMAIN +emm_temporal_domain <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +# Prepare emmeans data frame +emmeans_temporal_domain <- emm_temporal_domain %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Prepare raw data for plotting +iPlot_temporal_domain <- long_data_clean %>% + dplyr::select(pID, TEMPORAL_DO, DOMAIN, DGEN_SCORE) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")) + ) + +# Create TEMPORAL_DO × DOMAIN interaction plot - clean line plot with distribution +# Convert to numeric x-axis and add position offsets for dodging +dodge_width <- 0.6 +iPlot_temporal_domain <- iPlot_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +emmeans_temporal_domain <- emmeans_temporal_domain %>% + mutate( + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +interaction_plot_temporal_domain <- ggplot() + + # Distribution layer - violins (completely separated) + geom_violin( + data = iPlot_temporal_domain, + aes(x = x_dodged, y = DGEN_SCORE, fill = DOMAIN, group = interaction(x_pos, DOMAIN)), + alpha = 0.4, + color = NA, + trim = FALSE, + scale = "width", + width = dodge_width / 4 + ) + + # Emmeans error bars + geom_errorbar( + data = emmeans_temporal_domain, + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper), + width = 0.08, + linewidth = 0.8, + color = "black" + ) + + # Emmeans points + geom_point( + data = emmeans_temporal_domain, + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 4, + stroke = 1, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × DOMAIN Interaction" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(0, 10), + breaks = seq(0, 10, 2) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_temporal_domain) + +# ============================================================================= +# EMMEANS-ONLY PLOT: TEMPORAL_DO × DOMAIN INTERACTION +# ============================================================================= + +# Create fresh emmeans data for emmeans-only plot +emm_temporal_domain_simple <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + +emmeans_temporal_domain_simple <- emm_temporal_domain_simple %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + x_pos = as.numeric(TEMPORAL_DO), + domain_offset = (as.numeric(DOMAIN) - 2.5) * (dodge_width / 4), + x_dodged = x_pos + domain_offset + ) + +# Create emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_domain_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = DOMAIN), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = DOMAIN, shape = DOMAIN), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Absolute difference from the present", + title = "TEMPORAL_DO × DOMAIN Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.4, 2.6) + ) + + scale_y_continuous( + limits = c(3, 6), + breaks = seq(0, 10, 1) + ) + + scale_color_manual(name = "Domain", values = domain_colors) + + scale_fill_manual(name = "Domain", values = domain_colors) + + scale_shape_manual(name = "Domain", values = c(21, 22, 23, 24)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars Only) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create TIME main-effect plot (style aligned with existing emmeans-only plot) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/eohi1/mixed anova - domain means.r b/eohi1/mixed anova - domain means.r new file mode 100644 index 0000000..db70ef8 --- /dev/null +++ b/eohi1/mixed anova - domain means.r @@ -0,0 +1,769 @@ +# Mixed ANOVA Analysis for Domain Means +# EOHI Experiment Data Analysis - Domain Level Analysis +# Variables: NPast_mean_pref, NPast_mean_pers, NPast_mean_val, NPast_mean_life +# NFut_mean_pref, NFut_mean_pers, NFut_mean_val, NFut_mean_life + +library(tidyverse) +library(ez) +library(car) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations +library(ggplot2) # For plotting + +options(scipen = 999) + +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +required_vars <- c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life") + +# Define domain mapping +domain_mapping <- data.frame( + variable = c("NPast_mean_pref", "NPast_mean_pers", "NPast_mean_val", "NPast_mean_life", + "NFut_mean_pref", "NFut_mean_pers", "NFut_mean_val", "NFut_mean_life"), + time = c(rep("Past", 4), rep("Future", 4)), + domain = rep(c("Preferences", "Personality", "Values", "Life"), 2), + stringsAsFactors = FALSE +) + +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'domain' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values", "Life")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, DOMAIN, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +# Overall descriptive statistics by TIME and DOMAIN +desc_stats <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, DOMAIN) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print(desc_stats_by_temporal) + +# ASSUMPTION TESTING + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print(missing_summary) + +# Create clean dataset (long_data is already filtered for NA values) +long_data_clean <- long_data + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + median = median(MEAN_DIFFERENCE), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print(normality_results) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME +homogeneity_domain <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print(homogeneity_domain) + +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × DOMAIN) + +print(unique(long_data_clean$TEMPORAL_DO)) +print(table(long_data_clean$TEMPORAL_DO)) + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN combination +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# MIXED ANOVA ANALYSIS + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(complete_cases) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# MIXED ANOVA WITH SPHERICITY CORRECTIONS + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (4 levels: Preferences, Personality, Values, Life) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + between = TEMPORAL_DO, + within = .(TIME, DOMAIN), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Between-subjects effects (no sphericity corrections needed) + between_effects <- c("TEMPORAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + cat(sprintf("%s: F(%d, %d) = %.3f, p = %.6f\n", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + cat(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)\n", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (4 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + cat(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f\n", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# COHEN'S D FOR MAIN EFFECTS + +# Create aov model for emmeans +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * DOMAIN + Error(pID/(TIME * DOMAIN)), + data = long_data_clean) + +# Main Effect of TIME +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) + +time_main_contrast <- pairs(time_emmeans, adjust = "Bonferroni") + +time_main_df <- as.data.frame(time_main_contrast) +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + cat("\nCohen's d for TIME main effect:\n") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + cat(sprintf("Past vs Future: n1 = %d, n2 = %d\n", length(time_past_data), length(time_future_data))) + cat(sprintf("Cohen's d: %.5f\n", time_cohens_d$estimate)) + cat(sprintf("Effect size interpretation: %s\n", time_cohens_d$magnitude)) + cat(sprintf("p-value: %.5f\n", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (significant: p < 0.001) +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + cat("\nCohen's d for significant DOMAIN contrasts:\n") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + cat(sprintf("Comparison: %s\n", contrast_name)) + cat(sprintf(" n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", domain_cohens_d$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", domain_cohens_d$magnitude)) + cat(sprintf(" p-value: %.5f\n", significant_domain$p.value[i])) + cat("\n") + } + } + } +} + +# SIMPLE EFFECTS AND PAIRWISE COMPARISONS FOR INTERACTIONS + +# 1. TEMPORAL_DO × TIME INTERACTION - Simple effects of TIME within each TEMPORAL_DO +temporal_time_emmeans <- emmeans(aov_model, ~ TIME | TEMPORAL_DO) +temporal_time_simple <- pairs(temporal_time_emmeans, adjust = "bonferroni") +print(temporal_time_simple) + +# 2. TIME × DOMAIN INTERACTION - Simple effects of DOMAIN within each TIME +time_domain_emmeans <- emmeans(aov_model, ~ DOMAIN | TIME) +time_domain_simple <- pairs(time_domain_emmeans, adjust = "bonferroni") +print(time_domain_simple) + +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# 1. TEMPORAL_DO × TIME INTERACTION + +# Get simple effects of TIME within each TEMPORAL_DO +temporal_time_simple_df <- as.data.frame(temporal_time_simple) +calculate_cohens_d_for_pairs(temporal_time_simple_df, long_data_clean, "TIME", "TEMPORAL_DO", "MEAN_DIFFERENCE") + +# 2. TIME × DOMAIN INTERACTION + +# Get simple effects of TIME within each DOMAIN (Past vs Future contrasts for each domain) +time_domain_simple_by_domain <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +time_domain_simple_df <- as.data.frame(time_domain_simple_by_domain) +print("=== TIME × DOMAIN INTERACTION: Simple Effects of TIME within each DOMAIN ===") +print("Past vs Future contrasts for each domain:") +print(time_domain_simple_df) + +# Calculate Cohen's d for Past vs Future contrasts within each domain +print("\n=== COHEN'S D FOR TIME CONTRASTS WITHIN EACH DOMAIN ===") +significant_time_domain <- time_domain_simple_df[time_domain_simple_df$p.value < 0.05, ] + +if(nrow(significant_time_domain) > 0) { + print("Significant Past vs Future contrasts within domains (p < 0.05):") + print(significant_time_domain) + + print("\nCohen's d calculations for Past vs Future within each domain:") + + for(i in seq_len(nrow(time_domain_simple_df))) { + comparison <- time_domain_simple_df[i, ] + domain_level <- as.character(comparison$DOMAIN) + + # Get data for Past and Future within this domain + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("Domain: %s\n", domain_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } +} else { + cat("No significant Past vs Future contrasts found within any domain.\n") +} + +# INTERACTION PLOTS + +# Define color palettes +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") +domain_colors <- c("Preferences" = "#648FFF", "Personality" = "#DC267F", + "Values" = "#FFB000", "Life" = "#FE6100") + +# Define TIME levels (Past, Future order) +time_levels <- c("Past", "Future") + + + +# ============================================================ +# PLOT 3: TEMPORAL_DO × TIME INTERACTION (Emmeans only) +# ============================================================ + +# Create fresh emmeans data for Plot 3 +emm_temporal_time_plot3 <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + +emmeans_temporal_time_simple <- emm_temporal_time_plot3 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.3, + x_dodged = x_pos + time_offset + ) + +# Create simple emmeans-only plot +interaction_plot_emmeans_only <- ggplot(emmeans_temporal_time_simple) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Order", + y = "Mean absolute difference from present", + title = "TEMPORAL_DO × TIME Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_emmeans_only) + +# ============================================================ +# PLOT 4: TIME × DOMAIN INTERACTION (TIME on y-axis, DOMAIN on x-axis) +# ============================================================ + +# Create estimated marginal means for TIME × DOMAIN (reusing existing emmeans) +emm_time_domain_plot4 <- emmeans(aov_model, ~ TIME * DOMAIN) + +# Prepare emmeans data frame for Plot 4 +emmeans_time_domain_plot4 <- emm_time_domain_plot4 %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels) + ) + +# Prepare raw data for plotting with position offsets +dodge_width_plot4 <- 0.2 +iPlot_plot4 <- long_data_clean %>% + dplyr::select(pID, DOMAIN, TIME, MEAN_DIFFERENCE) %>% + mutate( + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values", "Life")), + TIME = factor(TIME, levels = time_levels), + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +emmeans_time_domain_plot4 <- emmeans_time_domain_plot4 %>% + mutate( + x_pos = as.numeric(DOMAIN), + time_offset = (as.numeric(TIME) - 1.5) * dodge_width_plot4, + x_dodged = x_pos + time_offset + ) + +# Create TIME × DOMAIN interaction plot (Domain on x-axis, TIME as groups) - EMMeans only +interaction_plot_time_domain_plot4 <- ggplot(emmeans_time_domain_plot4) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Domain", + y = "Mean absolute difference from present", + title = "TIME × DOMAIN Interaction (Domain on x-axis) - Estimated Marginal Means" + ) + + scale_x_continuous( + breaks = c(1, 2, 3, 4), + labels = c("Preferences", "Personality", "Values", "Life"), + limits = c(0.5, 4.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.text.x = element_text(angle = 45, hjust = 1), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(interaction_plot_time_domain_plot4) + +# ============================================================ +# PLOT 5: TIME MAIN EFFECT (Emmeans + Error Bars Only) +# ============================================================ + +# Prepare emmeans data frame for TIME main effect +time_main_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with existing emmeans-only plots) +time_main_plot <- ggplot(time_main_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/eohi1/mixed anova - personality.r b/eohi1/mixed anova - personality.r new file mode 100644 index 0000000..70d9919 --- /dev/null +++ b/eohi1/mixed anova - personality.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Personality Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pers_extravert, NPastDiff_pers_critical, NPastDiff_pers_dependable, NPastDiff_pers_anxious, NPastDiff_pers_complex +# NFutDiff_pers_extravert, NFutDiff_pers_critical, NFutDiff_pers_dependable, NFutDiff_pers_anxious, NFutDiff_pers_complex + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required personality item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", "NPastDiff_pers_anxious", "NPastDiff_pers_complex", + "NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", "NFutDiff_pers_anxious", "NFutDiff_pers_complex"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("extravert", "critical", "dependable", "anxious", "complex"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("extravert", "critical", "dependable", "anxious", "complex")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/eohi1/mixed anova - preferences.r b/eohi1/mixed anova - preferences.r new file mode 100644 index 0000000..57d9e96 --- /dev/null +++ b/eohi1/mixed anova - preferences.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Preference Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_pref_read, NPastDiff_pref_music, NPastDiff_pref_tv, NPastDiff_pref_nap, NPastDiff_pref_travel +# NFutDiff_pref_read, NFutDiff_pref_music, NFutDiff_pref_tv, NFutDiff_pref_nap, NFutDiff_pref_travel + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required preference item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", "NPastDiff_pref_nap", "NPastDiff_pref_travel", + "NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", "NFutDiff_pref_nap", "NFutDiff_pref_travel"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("read", "music", "tv", "nap", "travel"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("read", "music", "tv", "nap", "travel")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/eohi1/mixed anova - values.r b/eohi1/mixed anova - values.r new file mode 100644 index 0000000..84de04b --- /dev/null +++ b/eohi1/mixed anova - values.r @@ -0,0 +1,765 @@ +# Mixed ANOVA Analysis for Values Items +# EOHI Experiment Data Analysis - Item Level Analysis +# Variables: NPastDiff_val_obey, NPastDiff_val_trad, NPastDiff_val_opinion, NPastDiff_val_performance, NPastDiff_val_justice +# NFutDiff_val_obey, NFutDiff_val_trad, NFutDiff_val_opinion, NFutDiff_val_performance, NFutDiff_val_justice + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +# Read the data +data <- read.csv("exp1.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$pID)))) + +# Verify the specific variables we need +required_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required values item variables found!") +} + +# Define item mapping +item_mapping <- data.frame( + variable = c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", "NPastDiff_val_performance", "NPastDiff_val_justice", + "NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", "NFutDiff_val_performance", "NFutDiff_val_justice"), + time = c(rep("Past", 5), rep("Future", 5)), + item = rep(c("obey", "trad", "opinion", "performance", "justice"), 2), + stringsAsFactors = FALSE +) + +# Item mapping created + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(pID, ResponseId, TEMPORAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(item_mapping, by = "variable") %>% + # Convert to factors with proper levels (note: columns are 'time' and 'item' from mapping) + mutate( + TIME = factor(time, levels = c("Past", "Future")), + ITEM = factor(item, levels = c("obey", "trad", "opinion", "performance", "justice")), + pID = as.factor(pID), + TEMPORAL_DO = as.factor(TEMPORAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$pID)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME and ITEM +desc_stats <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME and ITEM:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_temporal <- long_data %>% + group_by(TEMPORAL_DO, TIME, ITEM) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TEMPORAL_DO, TIME, and ITEM:") +print(desc_stats_by_temporal) + + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, ITEM) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME and ITEM:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test (streamlined) +normality_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each ITEM +homogeneity_time <- long_data_clean %>% + group_by(ITEM) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each ITEM:") +print(homogeneity_time) + +# Test homogeneity across ITEM within each TIME +homogeneity_item <- long_data_clean %>% + group_by(TIME) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ ITEM)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across ITEM within each TIME:") +print(homogeneity_item) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# ============================================================================= +# CALCULATE OBSERVED F-MAX RATIOS FOR MIXED ANOVA +# ============================================================================= + +# For mixed ANOVA: Test homogeneity across BETWEEN-SUBJECTS factor (TEMPORAL_DO) +# within each combination of within-subjects factors (TIME × ITEM) + +# First, let's check what values TEMPORAL_DO actually has +print("=== CHECKING TEMPORAL_DO VALUES ===") +print("Unique TEMPORAL_DO values:") +print(unique(long_data_clean$TEMPORAL_DO)) +print("TEMPORAL_DO value counts:") +print(table(long_data_clean$TEMPORAL_DO)) + +print("\n=== OBSERVED F-MAX RATIOS: TEMPORAL_DO within each TIME × ITEM combination ===") + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this TIME × DOMAIN combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, ITEM, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!sym(group_var)) %>% + dplyr::summarise(var = var(!!sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × ITEM combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, ITEM) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(TEMPORAL_DO, MEAN_DIFFERENCE), "TEMPORAL_DO", "MEAN_DIFFERENCE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, ITEM, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check for missing data patterns +table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM, useNA = "ifany") + +# Check data balance +xtabs(~ pID + TIME + ITEM, data = long_data_clean) + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$pID)))) +print(paste("Number of TIME levels:", length(levels(long_data_clean$TIME)))) +print(paste("Number of ITEM levels:", length(levels(long_data_clean$ITEM)))) +print(paste("Number of TEMPORAL_DO levels:", length(levels(long_data_clean$TEMPORAL_DO)))) + +# Check for complete cases +complete_cases <- long_data_clean[complete.cases(long_data_clean), ] +print(paste("Complete cases:", nrow(complete_cases), "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$ITEM) + +print(summary(as.vector(design_balance))) + +# Check for any participants with missing combinations +missing_combos <- long_data_clean %>% + group_by(pID) %>% + summarise( + n_combinations = n(), + expected_combinations = 10, # 2 TIME × 5 ITEM = 10 + missing_combinations = 10 - n_combinations, + .groups = 'drop' + ) + +print("Missing combinations per participant:") +print(missing_combos[missing_combos$missing_combinations > 0, ]) + +# Mixed ANOVA using aov() - Traditional approach +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) +# Within-subjects: TIME (2 levels: Past, Future) × ITEM (5 levels: read, music, tv, nap, travel) + +mixed_anova_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * TIME * ITEM + Error(pID/(TIME * ITEM)), + data = long_data_clean) + +print("Mixed ANOVA Results (aov):") +print(summary(mixed_anova_model)) + +# Alternative: Using afex::aov_ez for cleaner output (optional) +print("\n=== ALTERNATIVE: AFEX AOV_EZ RESULTS ===") +mixed_anova_afex <- aov_ez(id = "pID", + dv = "MEAN_DIFFERENCE", + data = long_data_clean, + between = "TEMPORAL_DO", + within = c("TIME", "ITEM")) + +print("Mixed ANOVA Results (afex):") +print(mixed_anova_afex) + +# ============================================================================= +# SPHERICITY TESTS FOR WITHIN-SUBJECTS FACTORS +# ============================================================================= + +# Sphericity tests using ezANOVA (library already loaded) + +print("\n=== SPHERICITY TESTS ===") + +# Test sphericity for ITEM (5 levels - within-subjects) +print("Mauchly's Test of Sphericity for ITEM:") +tryCatch({ + # Create a temporary data frame for ezANOVA + temp_data <- long_data_clean + temp_data$id <- as.numeric(as.factor(temp_data$pID)) + + # Run ezANOVA to get sphericity tests + ez_item <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = ITEM, + type = 3, + detailed = TRUE) + + print("ITEM Sphericity Test:") + print(ez_item$Mauchly) + +}, error = function(e) { + print(paste("Error in ITEM sphericity test:", e$message)) +}) + +# Test sphericity for TIME (2 levels - within-subjects) +print("\nMauchly's Test of Sphericity for TIME:") +tryCatch({ + ez_time <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = TIME, + type = 3, + detailed = TRUE) + + print("TIME Sphericity Test:") + print(ez_time$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME sphericity test:", e$message)) +}) + +# Test sphericity for TIME × ITEM interaction +print("\nMauchly's Test of Sphericity for TIME × ITEM Interaction:") +tryCatch({ + ez_interaction <- ezANOVA(data = temp_data, + dv = MEAN_DIFFERENCE, + wid = id, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + + print("TIME × ITEM Sphericity Test:") + print(ez_interaction$Mauchly) + +}, error = function(e) { + print(paste("Error in TIME × ITEM sphericity test:", e$message)) +}) + +# ============================================================================= +# CORRECTED ANOVA RESULTS WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("\n=== CORRECTED ANOVA RESULTS (with sphericity corrections) ===") + +# Get corrected results from ezANOVA +ez_corrected <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = pID, + within = .(TIME, ITEM), + type = 3, + detailed = TRUE) + +print("Corrected ANOVA Results with Sphericity Corrections:") +print(ez_corrected$ANOVA) + +# Show epsilon values for sphericity corrections +print("\nEpsilon Values for Sphericity Corrections:") +print(ez_corrected$Mauchly) + +# Show sphericity-corrected results +print("\nSphericity-Corrected Results:") +print("Available elements in ez_corrected object:") +print(names(ez_corrected)) + +# Check if sphericity corrections are available +if(!is.null(ez_corrected$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(ez_corrected$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + cat("\n=== CORRECTED DEGREES OF FREEDOM ===\n") + + # Get the sphericity corrections + sphericity_corr <- ez_corrected$`Sphericity Corrections` + + # Extract original degrees of freedom from ANOVA table + anova_table <- ez_corrected$ANOVA + + # Calculate corrected degrees of freedom + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + # Also show the corrected F-values and p-values with degrees of freedom + cat("\n=== CORRECTED F-TESTS WITH DEGREES OF FREEDOM ===\n") + for(i in 1:nrow(corrected_df)) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + cat(sprintf("\n%s:\n", effect)) + cat(sprintf(" Original: F(%d, %d) = %.3f\n", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + cat(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + cat(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f\n", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections may not be displayed if sphericity is met") + print("Check the Mauchly's test p-values above to determine if corrections are needed") +} + +# ============================================================================= +# ALTERNATIVE: SPHERICITY CORRECTIONS USING CAR PACKAGE +# ============================================================================= + +print("\n=== SPHERICITY CORRECTIONS USING CAR PACKAGE ===") + +# Create a wide-format data for car package (library already loaded) + +tryCatch({ + # Convert to wide format for car package + wide_data <- long_data_clean %>% + select(pID, TEMPORAL_DO, TIME, ITEM, MEAN_DIFFERENCE) %>% + pivot_wider(names_from = c(TIME, ITEM), + values_from = MEAN_DIFFERENCE, + names_sep = "_") + + # Create the repeated measures design + within_vars <- c("Past_Preferences", "Past_Personality", "Past_Values", "Past_Life", + "Future_Preferences", "Future_Personality", "Future_Values", "Future_Life") + + # Check if all columns exist + missing_cols <- within_vars[!within_vars %in% colnames(wide_data)] + if(length(missing_cols) > 0) { + print(paste("Missing columns for car analysis:", paste(missing_cols, collapse = ", "))) + } else { + # Create the repeated measures design + rm_design <- as.matrix(wide_data[, within_vars]) + + # Calculate epsilon values + print("Epsilon Values from car package:") + epsilon_gg <- epsilon(rm_design, type = "Greenhouse-Geisser") + epsilon_hf <- epsilon(rm_design, type = "Huynh-Feldt") + + print(paste("Greenhouse-Geisser epsilon:", round(epsilon_gg, 4))) + print(paste("Huynh-Feldt epsilon:", round(epsilon_hf, 4))) + + # Interpretation + if(epsilon_gg < 0.75) { + print("Recommendation: Use Greenhouse-Geisser correction (epsilon < 0.75)") + } else if(epsilon_hf > 0.75) { + print("Recommendation: Use Huynh-Feldt correction (epsilon > 0.75)") + } else { + print("Recommendation: Use Greenhouse-Geisser correction (conservative)") + } + + # ============================================================================= + # MANUAL SPHERICITY CORRECTIONS + # ============================================================================= + + print("\n=== MANUAL SPHERICITY CORRECTIONS ===") + + # Apply corrections to the original ANOVA results + print("Applying Greenhouse-Geisser corrections to ITEM effects:") + + # ITEM main effect (DFn = 4, DFd = 4244) + item_df_corrected_gg <- 4 * epsilon_gg + item_df_corrected_hf <- 4 * epsilon_hf + + print(paste("ITEM: Original df = 4, 4244")) + print(paste("ITEM: GG corrected df =", round(item_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("ITEM: HF corrected df =", round(item_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # TIME × ITEM interaction (DFn = 4, DFd = 4244) + interaction_df_corrected_gg <- 4 * epsilon_gg + interaction_df_corrected_hf <- 4 * epsilon_hf + + print(paste("TIME × ITEM: Original df = 4, 4244")) + print(paste("TIME × ITEM: GG corrected df =", round(interaction_df_corrected_gg, 2), ",", round(4244 * epsilon_gg, 2))) + print(paste("TIME × ITEM: HF corrected df =", round(interaction_df_corrected_hf, 2), ",", round(4244 * epsilon_hf, 2))) + + # Note: You would need to recalculate p-values with these corrected dfs + print("\nNote: To get corrected p-values, you would need to recalculate F-tests with corrected degrees of freedom") + print("The ezANOVA function should handle this automatically, but may not display the corrections") + } + +}, error = function(e) { + print(paste("Error in manual epsilon calculation:", e$message)) +}) + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +# Effect size calculations (library already loaded) + +print("\n=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Calculate generalized eta squared for the aov model +print("Effect Sizes from aov() model:") +tryCatch({ + # Extract effect sizes from aov model + aov_effects <- eta_squared(mixed_anova_model, partial = TRUE, generalized = TRUE) + print(round(aov_effects, 5)) +}, error = function(e) { + print(paste("Error calculating effect sizes from aov:", e$message)) +}) + +# Calculate effect sizes for ezANOVA model +print("\nEffect Sizes from ezANOVA model:") +tryCatch({ + # ezANOVA provides partial eta squared, convert to generalized + ez_effects <- ez_corrected$ANOVA + ez_effects$ges <- ez_effects$ges # ezANOVA already provides generalized eta squared + print("Generalized Eta Squared from ezANOVA:") + print(round(ez_effects[, c("Effect", "ges")], 5)) +}, error = function(e) { + print(paste("Error extracting effect sizes from ezANOVA:", e$message)) +}) + +# Extract effect sizes (generalized eta squared) +# For aov() objects, we need to extract from the summary +anova_summary <- summary(mixed_anova_model) + +# ============================================================================= +# NOTE: MIXED MODELS (LMER) NOT NEEDED +# ============================================================================= + +# For this balanced repeated measures design, Type III ANOVA with proper +# sphericity corrections (implemented above) is the most appropriate approach. +# Mixed models (lmer) are typically used for: +# - Unbalanced designs +# - Missing data patterns +# - Nested random effects +# - Large, complex datasets +# +# Your design is balanced and complete, making Type III ANOVA optimal. + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans +print("\n=== POST-HOC COMPARISONS ===") + +# Main effect of TIME +print("Main Effect of TIME:") +time_emmeans <- emmeans(mixed_anova_model, ~ TIME) +print("Estimated Marginal Means:") +print(time_emmeans) +print("\nPairwise Contrasts:") +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of ITEM +print("\nMain Effect of ITEM:") +item_emmeans <- emmeans(mixed_anova_model, ~ ITEM) +print("Estimated Marginal Means:") +print(item_emmeans) +print("\nPairwise Contrasts:") +item_contrasts <- pairs(item_emmeans, adjust = "bonferroni") +print(item_contrasts) + + +# ============================================================================= +# INTERACTION EXPLORATIONS +# ============================================================================= + + +# TIME × ITEM Interaction +print("\n=== TIME × ITEM INTERACTION ===") +time_item_emmeans <- emmeans(mixed_anova_model, ~ TIME * ITEM) +print("Estimated Marginal Means:") +print(time_item_emmeans) + +print("\nSimple Effects of ITEM within each TIME:") +time_item_simple <- pairs(time_item_emmeans, by = "TIME", adjust = "bonferroni") +print(time_item_simple) + +print("\nSimple Effects of TIME within each ITEM:") +time_item_simple2 <- pairs(time_item_emmeans, by = "ITEM", adjust = "bonferroni") +print(time_item_simple2) + + +# ============================================================================= +# COMPREHENSIVE THREE-WAY INTERACTION ANALYSIS +# ============================================================================= + + +# ============================================================================= +# COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS +# ============================================================================= + +# Cohen's d calculations (library already loaded) + +print("\n=== COHEN'S D FOR SIGNIFICANT TWO-WAY INTERACTIONS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + cat("Significant pairwise comparisons (p < 0.05):\n") + print(significant_pairs) + + cat("\nCohen's d calculated from raw data:\n") + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + cat(sprintf("Comparison: %s", contrast_name)) + if(group2_var %in% colnames(comparison)) { + cat(sprintf(" | %s", group2_level)) + } + cat(sprintf("\n n1 = %d, n2 = %d\n", length(data1), length(data2))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat("\n") + } + } + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + + +# ============================================================================= +# 2. TIME × DOMAIN INTERACTION (SIGNIFICANT: p = 0.012) +# ============================================================================= + +print("\n=== COHEN'S D FOR TIME × DOMAIN INTERACTION ===") + +# Get simple effects of TIME within each ITEM +time_item_simple2_df <- as.data.frame(time_item_simple2) +calculate_cohens_d_for_pairs(time_item_simple2_df, long_data_clean, "TIME", "ITEM", "MEAN_DIFFERENCE") + +# Get simple effects of ITEM within each TIME +time_item_simple_df <- as.data.frame(time_item_simple) +calculate_cohens_d_for_pairs(time_item_simple_df, long_data_clean, "ITEM", "TIME", "MEAN_DIFFERENCE") + + diff --git a/eohi1/normality_plots.pdf b/eohi1/normality_plots.pdf new file mode 100644 index 0000000..78628c6 Binary files /dev/null and b/eohi1/normality_plots.pdf differ diff --git a/eohi1/pearson_correlations.csv b/eohi1/pearson_correlations.csv new file mode 100644 index 0000000..08ad61d --- /dev/null +++ b/eohi1/pearson_correlations.csv @@ -0,0 +1,10 @@ +"","NPast_mean_total","NFut_mean_total","DGEN_past_mean","DGEN_fut_mean","domain_mean","DGEN_mean","AOT_total","CRT_correct","CRT_int" +"NPast_mean_total",1,0.58407,0.37645,0.19034,0.91767,0.33077,0.04531,-0.00144,-0.01053 +"NFut_mean_total",0.58407,1,0.31658,0.32376,0.85851,0.37059,-0.04928,-0.074,0.05859 +"DGEN_past_mean",0.37645,0.31658,1,0.77074,0.3928,0.92613,-0.20675,-0.04166,0.0038 +"DGEN_fut_mean",0.19034,0.32376,0.77074,1,0.27874,0.92466,-0.28285,-0.0818,0.03967 +"domain_mean",0.91767,0.85851,0.3928,0.27874,1,0.39038,0.0045,-0.03713,0.02203 +"DGEN_mean",0.33077,0.37059,0.92613,0.92466,0.39038,1,-0.23213,-0.05422,0.01483 +"AOT_total",0.04531,-0.04928,-0.20675,-0.28285,0.0045,-0.23213,1,0.24279,-0.20318 +"CRT_correct",-0.00144,-0.074,-0.04166,-0.0818,-0.03713,-0.05422,0.24279,1,-0.89661 +"CRT_int",-0.01053,0.05859,0.0038,0.03967,0.02203,0.01483,-0.20318,-0.89661,1 diff --git a/eohi1/regression e1 - edu x ehi.r b/eohi1/regression e1 - edu x ehi.r new file mode 100644 index 0000000..bcd295f --- /dev/null +++ b/eohi1/regression e1 - edu x ehi.r @@ -0,0 +1,232 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_edu) %>% + mutate(demo_edu = as.factor(demo_edu)) + +# examine data object +str(data) +colSums(is.na(data)) +sapply(data, class) +levels(data$demo_edu) + +data$demo_edu <- factor(data$demo_edu, levels = c( + "High School (or equivalent)", + "Trade School (non-military)", + "College Diploma/Certificate", + "University - Undergraduate", + "University - Graduate (Masters)", + "University - PhD", + "Professional Degree (ex. JD/MD)" +)) + +levels(data$demo_edu) +# Create dummy variables +dummy_vars <- model.matrix(~ demo_edu - 1, data = data) +dummy_df <- as.data.frame(dummy_vars) + +# Rename columns with meaningful names (excluding reference level) +colnames(dummy_df) <- c( + "edu_highschool", # reference level (will be dropped) + "edu_trade", + "edu_college", + "edu_uni_undergrad", + "edu_uni_masters", + "edu_uni_phd", + "edu_prof" +) +# Add to your data +data <- cbind(data, dummy_df) + +data <- data %>% select(-starts_with("edu_highschool")) + +#### MODEL 1 - DGEN #### + +model_DGEN <- lm(eohiDGEN_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# Model 1 diagnostics +par(mfrow = c(2, 2)) +plot(model_DGEN, which = 1) # Residuals vs Fitted +plot(model_DGEN, which = 2) # Normal Q-Q, normality +hist(residuals(model_DGEN), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_DGEN)) + +plot(model_DGEN, which = 3) # Scale-Location +plot(model_DGEN, which = 4) # Cook's Distance + +# Model 1 specific tests +vif(model_DGEN) # Multicollinearity +dwtest(model_DGEN) # Independence +outlierTest(model_DGEN) # Outliers + +# Look at the specific influential cases +data[c(670, 388, 760), ] + +# 6 outliers: 670, 388, 760, 258, 873, 1030; acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# no autocorrelation (samples are independent) + +#results +print(summary(model_DGEN)) +print(AIC(model_DGEN)) + +# Create a nice formatted table +stargazer(model_DGEN, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", + add.lines = list(c("AIC", round(AIC(model_DGEN), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDGEN_robust <- coeftest(model_DGEN, vcov = vcovHC(model_DGEN, type = "HC3")) + +stargazer(modelDGEN_robust, type = "text", + title = "Regression Results: Education and EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + + +#### MODEL 2 - DOMAIN #### + +model_domain <- lm(ehi_global_mean ~ edu_trade + edu_college + edu_uni_undergrad + + edu_uni_masters + edu_uni_phd + edu_prof, data = data) + +# ASSUMPTION CHECKING FOR MODEL 2 (model_domain) +plot(model_domain, which = 1) # Residuals vs Fitted + +plot(model_domain, which = 2) # Normal Q-Q, normality +hist(residuals(model_domain), main = "Histogram of Residuals", xlab = "Residuals") +shapiro.test(residuals(model_domain)) + +plot(model_domain, which = 3) # Scale-Location +plot(model_domain, which = 4) # Cook's Distance + +# Model 2 specific tests +vif(model_domain) # Multicollinearity +dwtest(model_domain) # Independence +outlierTest(model_domain) # Outliers + +# Check if the autocorrelation is real or artifactual +# Plot residuals against observation order +plot(residuals(model_domain), type = "l") +abline(h = 0, col = "red") + + +# 6 outliers: acknoledge their presence but also they represent ~0.58% of total sample size, which is well below the 5% of outliers that would be considered acceptable. +# heterescedasticity: may be d/t binary vars creating discrete clusters, or d/t real heteroscedasticity. +# normality violated but sample size is robust to violation +# no multicollinearity +# auto correlation is significant, may be due to aggregated measure of multiple repeated measures + +# Reset plotting to 1x1 +# par(mfrow = c(1, 1)) + +print(summary(model_domain)) +print(AIC(model_domain)) + +stargazer(model_domain, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp", # This shows coefficients, SEs, and p-values + add.lines = list(c("AIC", round(AIC(model_domain), 2)))) + +# Use robust standard errors (doesn't change coefficients, just SEs) +modelDOMAIN_robust <- coeftest(model_domain, vcov = vcovHC(model_domain, type = "HC3")) + +stargazer(modelDOMAIN_robust, type = "text", + title = "Regression Results: Education and EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Trade School", "College", "University Undergrad", + "University Masters", "University PhD", "Professional Degree"), + report = "vcsp") + +#### PLOTS #### + +library(ggplot2) +library(dplyr) + +# Calculate means and confidence intervals for EOHI-DGEN +edu_summary_DGEN <- data %>% + group_by(demo_edu) %>% + summarise( + mean_DGEN = mean(eohiDGEN_mean, na.rm = TRUE), + n = n(), + se_DGEN = sd(eohiDGEN_mean, na.rm = TRUE) / sqrt(n()), + ci_lower_DGEN = mean_DGEN - 1.96 * se_DGEN, + ci_upper_DGEN = mean_DGEN + 1.96 * se_DGEN + ) + +# Calculate means and confidence intervals for EHI Domain +edu_summary_domain <- data %>% + group_by(demo_edu) %>% + summarise( + mean_domain = mean(ehi_global_mean, na.rm = TRUE), + n = n(), + se_domain = sd(ehi_global_mean, na.rm = TRUE) / sqrt(n()), + ci_lower_domain = mean_domain - 1.96 * se_domain, + ci_upper_domain = mean_domain + 1.96 * se_domain + ) + +# Plot 1: EOHI-DGEN means with confidence intervals +p1 <- ggplot(edu_summary_DGEN, aes(x = demo_edu, y = mean_DGEN)) + + geom_point(size = 3, color = "steelblue") + + geom_errorbar(aes(ymin = ci_lower_DGEN, ymax = ci_upper_DGEN), + width = 0.1, color = "steelblue", linewidth = 1) + + labs( + title = "Mean EOHI-DGEN by Education Level", + subtitle = "Error bars show 95% confidence intervals", + x = "Education Level", + y = "Mean EOHI-DGEN Score" + ) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, face = "bold"), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Plot 2: EHI Domain means with confidence intervals +p2 <- ggplot(edu_summary_domain, aes(x = demo_edu, y = mean_domain)) + + geom_point(size = 3, color = "darkgreen") + + geom_errorbar(aes(ymin = ci_lower_domain, ymax = ci_upper_domain), + width = 0.1, color = "darkgreen", linewidth = 1) + + labs( + title = "Mean EHI Domain by Education Level", + subtitle = "Error bars show 95% confidence intervals", + x = "Education Level", + y = "Mean EHI Domain Score" + ) + + theme_minimal() + + theme( + axis.text.x = element_text(angle = 45, hjust = 1), + plot.title = element_text(size = 14, face = "bold"), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Display the plots +print(p1) +print(p2) + +# Save the plots +ggsave("education_DGEN_means.png", p1, width = 10, height = 6, dpi = 300) +ggsave("education_domain_means.png", p2, width = 10, height = 6, dpi = 300) \ No newline at end of file diff --git a/eohi1/regression e1 - ehi x sex x age.r b/eohi1/regression e1 - ehi x sex x age.r new file mode 100644 index 0000000..e7db6aa --- /dev/null +++ b/eohi1/regression e1 - ehi x sex x age.r @@ -0,0 +1,320 @@ +options(scipen = 999) + +library(dplyr) +library(car) +library(lmtest) +library(stargazer) +library(sandwich) +library(lmtest) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi1") + +df <- read.csv("ehi1.csv") + +data <- df %>% + select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>% + filter(demo_sex != "Prefer not to say") + +str(data) +colSums(is.na(data)) +sapply(data, class) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + +# Center demo_age_1 (subtract the mean) +data$age_centered <- data$demo_age_1 - mean(data$demo_age_1, na.rm = TRUE) + +# Verify the centering +print(summary(data$age_centered)) + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +#### REGRESSION MODELS #### +# MODEL 1: Age only - EOHI +age_DGEN <- lm(eohiDGEN_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_DGEN) +print(shapiro.test(residuals(age_DGEN))) +print(summary(age_DGEN)) +print(AIC(age_DGEN)) + +# MODEL 1: Age only - EHI +age_domain <- lm(ehi_global_mean ~ age_centered, data = data) +par(mfrow = c(2, 2)) +plot(age_domain) +print(shapiro.test(residuals(age_domain))) +print(summary(age_domain)) +print(AIC(age_domain)) + +# MODEL 2: Sex only - EOHI +sex_DGEN <- lm(eohiDGEN_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_DGEN) +print(shapiro.test(residuals(sex_DGEN))) +print(summary(sex_DGEN)) +print(AIC(sex_DGEN)) +# P1 (res vs fitted) + P3 (scale location): test for homoscedasticity. relatively flat red line = homoscedasticity. relatively scattered points = homoscedasticity. this assumption is met. +# P2 (qq plot): test for normality. points scattered around a relatively straight line = normality. this assumption is violated but large sample is robust. +# P4 (residuals vs leverage): test for outliers. high leverage points = outliers. leverage > 2p/n. + # p = parameters; for this model p = 2 (intercept + sex_dummy). n = 1061 (removed prefer not to say). threshold = 2*2/1061 = 0.00377. maximum leverage in plot is ~ 0.002 therefore no points have concerning leverage. +# across the plots, there are 3 outliers: 258, 670, 872. this represents 0.28% of the data (much less than the acceptable threshold of 5%). therefore, analysis can proceed. + +# MODEL 2: Sex only - EHI +sex_domain <- lm(ehi_global_mean ~ sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(sex_domain) +print(shapiro.test(residuals(sex_domain))) +print(summary(sex_domain)) +print(AIC(sex_domain)) + +# MODEL 3: Age + Sex + Interaction - EOHI +interaction_DGEN <- lm(eohiDGEN_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_DGEN) +print(shapiro.test(residuals(interaction_DGEN))) +vif_DGEN <- vif(interaction_DGEN) +print(vif_DGEN) +print(summary(interaction_DGEN)) +print(AIC(interaction_DGEN)) + +# MODEL 3: Age + Sex + Interaction - EHI +interaction_domain <- lm(ehi_global_mean ~ age_centered + sex_dummy + age_centered:sex_dummy, data = data) +par(mfrow = c(2, 2)) +plot(interaction_domain) +print(shapiro.test(residuals(interaction_domain))) +vif_domain <- vif(interaction_domain) +print(vif_domain) +print(summary(interaction_domain)) +print(AIC(interaction_domain)) + +#### troubleshooting #### +# Clear any existing plots +# dev.off() + + +#### PLOTS #### + +# Create visual figures for age models +library(ggplot2) + +# Figure 1: age_DGEN model +p1 <- ggplot(data, aes(x = age_centered, y = eohiDGEN_mean)) + + geom_point(alpha = 0.6, color = "steelblue") + + geom_smooth(method = "lm", se = TRUE, color = "red", linewidth = 1) + + labs( + title = "Age and EOHI-DGEN Relationship", + x = "Age (centered)", + y = "EOHI-DGEN Mean", + subtitle = paste("R² =", round(summary(age_DGEN)$r.squared, 3), + ", p < 0.001") + ) + + theme_minimal() + + theme( + plot.title = element_text(size = 14, face = "bold"), + axis.title = element_text(size = 12), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Figure 2: age_domain model +p2 <- ggplot(data, aes(x = age_centered, y = ehi_global_mean)) + + geom_point(alpha = 0.6, color = "darkgreen") + + geom_smooth(method = "lm", se = TRUE, color = "red", linewidth = 1) + + labs( + title = "Age and EHI Domain Relationship", + x = "Age (centered)", + y = "EHI Domain Mean", + subtitle = paste("R² =", round(summary(age_domain)$r.squared, 3), + ", p < 0.001") + ) + + theme_minimal() + + theme( + plot.title = element_text(size = 14, face = "bold"), + axis.title = element_text(size = 12), + plot.subtitle = element_text(size = 10, color = "gray60") + ) + +# Save the plots +ggsave("age_DGEN_plot.png", p1, width = 8, height = 6, dpi = 300) +ggsave("age_domain_plot.png", p2, width = 8, height = 6, dpi = 300) + +# Display the plots +print(p1) +print(p2) + +#### HTML file #### + +# Create comprehensive HTML report grouped by model +library(htmltools) + +# Start HTML document +html_content <- htmltools::div( + htmltools::h1("Regression Analysis: Age and Sex Effects on EOHI-DGEN and EHI Domain"), + + # EOHI-DGEN Models Section + htmltools::h2("EOHI-DGEN Models"), + + # Age Model + htmltools::h3("1. Age Model (age_DGEN)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + age_DGEN, + type = "html", + title = "Age Model: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Age (centered)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(age_DGEN), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "age_DGEN_assumptions.png", style = "width: 100%; max-width: 800px;"), + htmltools::h4("Model Visualization"), + htmltools::img(src = "age_DGEN_plot.png", style = "width: 100%; max-width: 800px;") + ), + + # Sex Model + htmltools::h3("2. Sex Model (sex_DGEN)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + sex_DGEN, + type = "html", + title = "Sex Model: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Sex (dummy)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(sex_DGEN), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "sex_DGEN_assumptions.png", style = "width: 100%; max-width: 800px;") + ), + + # Interaction Model + htmltools::h3("3. Interaction Model (interaction_DGEN)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + interaction_DGEN, + type = "html", + title = "Interaction Model: EOHI-DGEN", + dep.var.labels = "EOHI-DGEN Mean", + covariate.labels = c("Age (centered)", "Sex (dummy)", "Age x Sex"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(interaction_DGEN), 2)), + c("Max VIF", max_vif_DGEN) + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "interaction_DGEN_assumptions.png", style = "width: 100%; max-width: 800px;") + ), + + # EHI Domain Models Section + htmltools::h2("EHI Domain Models"), + + # Age Model + htmltools::h3("1. Age Model (age_domain)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + age_domain, + type = "html", + title = "Age Model: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Age (centered)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(age_domain), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "age_domain_assumptions.png", style = "width: 100%; max-width: 800px;"), + htmltools::h4("Model Visualization"), + htmltools::img(src = "age_domain_plot.png", style = "width: 100%; max-width: 800px;") + ), + + # Sex Model + htmltools::h3("2. Sex Model (sex_domain)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + sex_domain, + type = "html", + title = "Sex Model: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Sex (dummy)"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(sex_domain), 2)), + c("Max VIF", "N/A") + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "sex_domain_assumptions.png", style = "width: 100%; max-width: 800px;") + ), + + # Interaction Model + htmltools::h3("3. Interaction Model (interaction_domain)"), + htmltools::div( + style = "margin-bottom: 30px;", + htmltools::h4("Model Results, AIC, and VIF"), + htmltools::HTML( + stargazer( + interaction_domain, + type = "html", + title = "Interaction Model: EHI Domain", + dep.var.labels = "EHI Domain Mean", + covariate.labels = c("Age (centered)", "Sex (dummy)", "Age x Sex"), + report = "vcsp*", + add.lines = list( + c("AIC", round(AIC(interaction_domain), 2)), + c("Max VIF", max_vif_domain) + ) + ) + ), + htmltools::h4("Assumption Diagnostic Plots"), + htmltools::img(src = "interaction_domain_assumptions.png", style = "width: 100%; max-width: 800px;") + ) +) + +# Save HTML content +htmltools::save_html(html_content, "regression_analysis_report.html") + +print("HTML report created: regression_analysis_report.html") \ No newline at end of file diff --git a/eohi1/regression_DGEN_models.html b/eohi1/regression_DGEN_models.html new file mode 100644 index 0000000..add6ee7 --- /dev/null +++ b/eohi1/regression_DGEN_models.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Regression Models: EOHI-DGEN
Dependent variable:
EOHI-DGEN Mean
(1)(2)(3)
Age (centered)-0.015-0.018
(0.003)(0.005)
p = 0.00002***p = 0.0004***
Sex (dummy)0.0990.103
(0.107)(0.106)
p = 0.355p = 0.331
Age x Sex0.006
(0.007)
p = 0.402
Constant0.4170.3670.364
(0.053)(0.076)(0.075)
p = 0.000***p = 0.00001***p = 0.00001***
AIC4174.084192.484176.42
Max VIFN/AN/A2.22
Observations1,0611,0611,061
R20.0180.0010.020
Adjusted R20.017-0.00010.017
Residual Std. Error1.727 (df = 1059)1.742 (df = 1059)1.727 (df = 1057)
F Statistic19.407*** (df = 1; 1059)0.859 (df = 1; 1059)7.017*** (df = 3; 1057)
Note:*p<0.1; **p<0.05; ***p<0.01
diff --git a/eohi1/regression_EHI_domain_models.html b/eohi1/regression_EHI_domain_models.html new file mode 100644 index 0000000..5c4105c --- /dev/null +++ b/eohi1/regression_EHI_domain_models.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Regression Models: EHI Domain
Dependent variable:
EHI Domain Mean
(1)(2)(3)
Age (centered)-0.007-0.006
(0.001)(0.001)
p = 0.000***p = 0.00001***
Sex (dummy)0.0310.033
(0.031)(0.030)
p = 0.311p = 0.274
Age x Sex-0.0003
(0.002)
p = 0.883
Constant0.1370.1210.120
(0.015)(0.022)(0.021)
p = 0.000***p = 0.00000***p = 0.00000***
AIC1515.751562.881518.52
Max VIFNANA2.22
Observations1,0611,0611,061
R20.0440.0010.045
Adjusted R20.0430.000030.043
Residual Std. Error0.493 (df = 1059)0.504 (df = 1059)0.494 (df = 1057)
F Statistic49.178*** (df = 1; 1059)1.029 (df = 1; 1059)16.789*** (df = 3; 1057)
Note:*p<0.1; **p<0.05; ***p<0.01
diff --git a/eohi1/regression_EOHI_models.html b/eohi1/regression_EOHI_models.html new file mode 100644 index 0000000..add6ee7 --- /dev/null +++ b/eohi1/regression_EOHI_models.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Regression Models: EOHI-DGEN
Dependent variable:
EOHI-DGEN Mean
(1)(2)(3)
Age (centered)-0.015-0.018
(0.003)(0.005)
p = 0.00002***p = 0.0004***
Sex (dummy)0.0990.103
(0.107)(0.106)
p = 0.355p = 0.331
Age x Sex0.006
(0.007)
p = 0.402
Constant0.4170.3670.364
(0.053)(0.076)(0.075)
p = 0.000***p = 0.00001***p = 0.00001***
AIC4174.084192.484176.42
Max VIFN/AN/A2.22
Observations1,0611,0611,061
R20.0180.0010.020
Adjusted R20.017-0.00010.017
Residual Std. Error1.727 (df = 1059)1.742 (df = 1059)1.727 (df = 1057)
F Statistic19.407*** (df = 1; 1059)0.859 (df = 1; 1059)7.017*** (df = 3; 1057)
Note:*p<0.1; **p<0.05; ***p<0.01
diff --git a/eohi1/regression_analysis_report.html b/eohi1/regression_analysis_report.html new file mode 100644 index 0000000..5ecb2eb --- /dev/null +++ b/eohi1/regression_analysis_report.html @@ -0,0 +1,62 @@ + + + + + + + + + +
+

Regression Analysis: Age and Sex Effects on EOHI-DGEN and EHI Domain

+

EOHI-DGEN Models

+

1. Age Model (age_DGEN)

+
+

Model Results, AIC, and VIF

+
Age Model: EOHI-DGEN
Dependent variable:
EOHI-DGEN Mean
Age (centered)-0.015
(0.003)
p = 0.00002***
Constant0.417
(0.053)
p = 0.000***
AIC4174.08
Max VIFN/A
Observations1,061
R20.018
Adjusted R20.017
Residual Std. Error1.727 (df = 1059)
F Statistic19.407*** (df = 1; 1059)
Note:*p<0.1; **p<0.05; ***p<0.01
+

Assumption Diagnostic Plots

+ +

Model Visualization

+ +
+

2. Sex Model (sex_DGEN)

+
+

Model Results, AIC, and VIF

+
Sex Model: EOHI-DGEN
Dependent variable:
EOHI-DGEN Mean
Sex (dummy)0.099
(0.107)
p = 0.355
Constant0.367
(0.076)
p = 0.00001***
AIC4192.48
Max VIFN/A
Observations1,061
R20.001
Adjusted R2-0.0001
Residual Std. Error1.742 (df = 1059)
F Statistic0.859 (df = 1; 1059)
Note:*p<0.1; **p<0.05; ***p<0.01
+

Assumption Diagnostic Plots

+ +
+

3. Interaction Model (interaction_DGEN)

+
+

Model Results, AIC, and VIF

+
Interaction Model: EOHI-DGEN
Dependent variable:
EOHI-DGEN Mean
Age (centered)-0.018
(0.005)
p = 0.0004***
Sex (dummy)0.103
(0.106)
p = 0.331
Age x Sex0.006
(0.007)
p = 0.402
Constant0.364
(0.075)
p = 0.00001***
AIC4176.42
Max VIF2.22
Observations1,061
R20.020
Adjusted R20.017
Residual Std. Error1.727 (df = 1057)
F Statistic7.017*** (df = 3; 1057)
Note:*p<0.1; **p<0.05; ***p<0.01
+

Assumption Diagnostic Plots

+ +
+

EHI Domain Models

+

1. Age Model (age_domain)

+
+

Model Results, AIC, and VIF

+
Age Model: EHI Domain
Dependent variable:
EHI Domain Mean
Age (centered)-0.007
(0.001)
p = 0.000***
Constant0.137
(0.015)
p = 0.000***
AIC1515.75
Max VIFN/A
Observations1,061
R20.044
Adjusted R20.043
Residual Std. Error0.493 (df = 1059)
F Statistic49.178*** (df = 1; 1059)
Note:*p<0.1; **p<0.05; ***p<0.01
+

Assumption Diagnostic Plots

+ +

Model Visualization

+ +
+

2. Sex Model (sex_domain)

+
+

Model Results, AIC, and VIF

+
Sex Model: EHI Domain
Dependent variable:
EHI Domain Mean
Sex (dummy)0.031
(0.031)
p = 0.311
Constant0.121
(0.022)
p = 0.00000***
AIC1562.88
Max VIFN/A
Observations1,061
R20.001
Adjusted R20.00003
Residual Std. Error0.504 (df = 1059)
F Statistic1.029 (df = 1; 1059)
Note:*p<0.1; **p<0.05; ***p<0.01
+

Assumption Diagnostic Plots

+ +
+

3. Interaction Model (interaction_domain)

+
+

Model Results, AIC, and VIF

+
Interaction Model: EHI Domain
Dependent variable:
EHI Domain Mean
Age (centered)-0.006
(0.001)
p = 0.00001***
Sex (dummy)0.033
(0.030)
p = 0.274
Age x Sex-0.0003
(0.002)
p = 0.883
Constant0.120
(0.021)
p = 0.00000***
AIC1518.52
Max VIF2.22
Observations1,061
R20.045
Adjusted R20.043
Residual Std. Error0.494 (df = 1057)
F Statistic16.789*** (df = 3; 1057)
Note:*p<0.1; **p<0.05; ***p<0.01
+

Assumption Diagnostic Plots

+ +
+
+ + diff --git a/eohi1/reliability_analysis_cronbach_alpha.r b/eohi1/reliability_analysis_cronbach_alpha.r new file mode 100644 index 0000000..f3fa96f --- /dev/null +++ b/eohi1/reliability_analysis_cronbach_alpha.r @@ -0,0 +1,204 @@ +# Cronbach's Alpha Reliability Analysis +# For 4 domains (preferences, personality, values, life satisfaction) at 2 time points +# 5 items per domain per time point + +# Load required libraries +library(psych) +library(dplyr) +library(tidyr) + +# Read the data +data <- read.csv("exp1.csv") + +# Define the scale variables for each domain and time point +# Past time point scales +past_pref_vars <- c("NPastDiff_pref_read", "NPastDiff_pref_music", "NPastDiff_pref_tv", + "NPastDiff_pref_nap", "NPastDiff_pref_travel") + +past_pers_vars <- c("NPastDiff_pers_extravert", "NPastDiff_pers_critical", "NPastDiff_pers_dependable", + "NPastDiff_pers_anxious", "NPastDiff_pers_complex") + +past_val_vars <- c("NPastDiff_val_obey", "NPastDiff_val_trad", "NPastDiff_val_opinion", + "NPastDiff_val_performance", "NPastDiff_val_justice") + +past_life_vars <- c("NPastDiff_life_ideal", "NPastDiff_life_excellent", "NPastDiff_life_satisfied", + "NPastDiff_life_important", "NPastDiff_life_change") + +# Future time point scales +fut_pref_vars <- c("NFutDiff_pref_read", "NFutDiff_pref_music", "NFutDiff_pref_tv", + "NFutDiff_pref_nap", "NFutDiff_pref_travel") + +fut_pers_vars <- c("NFutDiff_pers_extravert", "NFutDiff_pers_critical", "NFutDiff_pers_dependable", + "NFutDiff_pers_anxious", "NFutDiff_pers_complex") + +fut_val_vars <- c("NFutDiff_val_obey", "NFutDiff_val_trad", "NFutDiff_val_opinion", + "NFutDiff_val_performance", "NFutDiff_val_justice") + +fut_life_vars <- c("NFutDiff_life_ideal", "NFutDiff_life_excellent", "NFutDiff_life_satisfied", + "NFutDiff_life_important", "NFutDiff_life_change") + +# Function to calculate Cronbach's alpha and return detailed results +calc_cronbach_alpha <- function(data, var_names, scale_name) { + # Check for missing values + scale_data <- data[, var_names] + missing_info <- data.frame( + Variable = var_names, + Missing_Count = colSums(is.na(scale_data)), + Missing_Percent = round(colSums(is.na(scale_data)) / nrow(scale_data) * 100, 2) + ) + + # Remove rows with any missing values for reliability analysis + complete_data <- scale_data[complete.cases(scale_data), ] + + cat("\n", "="*60, "\n") + cat("SCALE:", scale_name, "\n") + cat("="*60, "\n") + + cat("Sample size for reliability analysis:", nrow(complete_data), "\n") + cat("Original sample size:", nrow(data), "\n") + cat("Cases removed due to missing data:", nrow(data) - nrow(complete_data), "\n\n") + + cat("Missing data summary:\n") + print(missing_info) + + if(nrow(complete_data) < 3) { + cat("\nWARNING: Insufficient complete cases for reliability analysis\n") + return(NULL) + } + + # Calculate Cronbach's alpha + alpha_result <- alpha(complete_data, check.keys = TRUE) + + cat("\nCronbach's Alpha Results:\n") + cat("Raw alpha:", round(alpha_result$total$raw_alpha, 4), "\n") + cat("Standardized alpha:", round(alpha_result$total$std.alpha, 4), "\n") + cat("Average inter-item correlation:", round(alpha_result$total$average_r, 4), "\n") + cat("Number of items:", alpha_result$total$nvar, "\n") + + # Item statistics + cat("\nItem Statistics:\n") + item_stats <- data.frame( + Item = var_names, + Alpha_if_deleted = round(alpha_result$alpha.drop$raw_alpha, 4), + Item_total_correlation = round(alpha_result$item.stats$r.drop, 4), + Mean = round(alpha_result$item.stats$mean, 4), + SD = round(alpha_result$item.stats$sd, 4) + ) + print(item_stats) + + # Check assumptions + cat("\nAssumption Checks:\n") + + # 1. Check for sufficient sample size (minimum 30 recommended) + sample_size_ok <- nrow(complete_data) >= 30 + cat("Sample size adequate (≥30):", sample_size_ok, "\n") + + # 2. Check for adequate inter-item correlations (should be > 0.30) + inter_item_cors <- cor(complete_data) + inter_item_cors[lower.tri(inter_item_cors)] <- NA + diag(inter_item_cors) <- NA + inter_item_cors_flat <- as.vector(inter_item_cors) + inter_item_cors_flat <- inter_item_cors_flat[!is.na(inter_item_cors_flat)] + adequate_cors <- sum(inter_item_cors_flat > 0.30) / length(inter_item_cors_flat) + cat("Proportion of inter-item correlations > 0.30:", round(adequate_cors, 4), "\n") + + # 3. Check for negative correlations (concerning for unidimensionality) + negative_cors <- sum(inter_item_cors_flat < 0, na.rm = TRUE) + cat("Number of negative inter-item correlations:", negative_cors, "\n") + + # 4. Check item variances (should be roughly similar) + item_vars <- apply(complete_data, 2, var) + var_ratio <- max(item_vars) / min(item_vars) + cat("Ratio of highest to lowest item variance:", round(var_ratio, 4), "\n") + + return(alpha_result) +} + +# Calculate Cronbach's alpha for all scales +cat("CRONBACH'S ALPHA RELIABILITY ANALYSIS") +cat("\nData: exp1.csv") +cat("\nTotal sample size:", nrow(data)) + +# Past time point analyses +past_pref_alpha <- calc_cronbach_alpha(data, past_pref_vars, "Past Preferences") +past_pers_alpha <- calc_cronbach_alpha(data, past_pers_vars, "Past Personality") +past_val_alpha <- calc_cronbach_alpha(data, past_val_vars, "Past Values") +past_life_alpha <- calc_cronbach_alpha(data, past_life_vars, "Past Life Satisfaction") + +# Future time point analyses +fut_pref_alpha <- calc_cronbach_alpha(data, fut_pref_vars, "Future Preferences") +fut_pers_alpha <- calc_cronbach_alpha(data, fut_pers_vars, "Future Personality") +fut_val_alpha <- calc_cronbach_alpha(data, fut_val_vars, "Future Values") +fut_life_alpha <- calc_cronbach_alpha(data, fut_life_vars, "Future Life Satisfaction") + +# Summary table +cat("\n", "="*80, "\n") +cat("SUMMARY OF CRONBACH'S ALPHA COEFFICIENTS") +cat("\n", "="*80, "\n") + +summary_results <- data.frame( + Scale = c("Past Preferences", "Past Personality", "Past Values", "Past Life Satisfaction", + "Future Preferences", "Future Personality", "Future Values", "Future Life Satisfaction"), + Alpha = c( + if(!is.null(past_pref_alpha)) round(past_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_pers_alpha)) round(past_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_val_alpha)) round(past_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(past_life_alpha)) round(past_life_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pref_alpha)) round(fut_pref_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_pers_alpha)) round(fut_pers_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_val_alpha)) round(fut_val_alpha$total$raw_alpha, 4) else NA, + if(!is.null(fut_life_alpha)) round(fut_life_alpha$total$raw_alpha, 4) else NA + ), + Items = rep(5, 8), + Interpretation = c( + if(!is.null(past_pref_alpha)) { + alpha_val <- past_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_pers_alpha)) { + alpha_val <- past_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_val_alpha)) { + alpha_val <- past_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(past_life_alpha)) { + alpha_val <- past_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pref_alpha)) { + alpha_val <- fut_pref_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_pers_alpha)) { + alpha_val <- fut_pers_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_val_alpha)) { + alpha_val <- fut_val_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data", + if(!is.null(fut_life_alpha)) { + alpha_val <- fut_life_alpha$total$raw_alpha + if(alpha_val >= 0.90) "Excellent" else if(alpha_val >= 0.80) "Good" else if(alpha_val >= 0.70) "Acceptable" else if(alpha_val >= 0.60) "Questionable" else "Poor" + } else "Insufficient data" + ) +) + +print(summary_results) + +# Save results to CSV +write.csv(summary_results, "cronbach_alpha_summary.csv", row.names = FALSE) +cat("\nSummary results saved to: cronbach_alpha_summary.csv\n") + +cat("\n", "="*80, "\n") +cat("INTERPRETATION GUIDE FOR CRONBACH'S ALPHA") +cat("\n", "="*80, "\n") +cat("α ≥ 0.90: Excellent reliability\n") +cat("α ≥ 0.80: Good reliability\n") +cat("α ≥ 0.70: Acceptable reliability\n") +cat("α ≥ 0.60: Questionable reliability\n") +cat("α < 0.60: Poor reliability\n") + + diff --git a/eohi1/residual_plots.pdf b/eohi1/residual_plots.pdf new file mode 100644 index 0000000..d857b10 Binary files /dev/null and b/eohi1/residual_plots.pdf differ diff --git a/eohi1/results - exp1 - mixed anova DGEN.md b/eohi1/results - exp1 - mixed anova DGEN.md new file mode 100644 index 0000000..f3b52af Binary files /dev/null and b/eohi1/results - exp1 - mixed anova DGEN.md differ diff --git a/eohi1/results exp1 - mixed anova - domain means.md b/eohi1/results exp1 - mixed anova - domain means.md new file mode 100644 index 0000000..2d20a9c Binary files /dev/null and b/eohi1/results exp1 - mixed anova - domain means.md differ diff --git a/eohi1/sex_DGEN_assumptions.png b/eohi1/sex_DGEN_assumptions.png new file mode 100644 index 0000000..0d3a936 Binary files /dev/null and b/eohi1/sex_DGEN_assumptions.png differ diff --git a/eohi1/sex_domain_assumptions.png b/eohi1/sex_domain_assumptions.png new file mode 100644 index 0000000..67ca844 Binary files /dev/null and b/eohi1/sex_domain_assumptions.png differ diff --git a/eohi1/spearman_correlations.csv b/eohi1/spearman_correlations.csv new file mode 100644 index 0000000..7aae668 --- /dev/null +++ b/eohi1/spearman_correlations.csv @@ -0,0 +1,14 @@ +"","eohiDGEN_pref","eohiDGEN_pers","eohiDGEN_val","eohiDGEN_life","eohiDGEN_mean","ehi_pref_mean","ehi_pers_mean","ehi_val_mean","ehi_life_mean","ehi_global_mean","AOT_total","CRT_correct","CRT_int" +"eohiDGEN_pref",1,0.27683,0.23964,0.24515,0.66949,0.22538,0.09704,0.08007,0.12507,0.21415,0.06836,0.05361,-0.05819 +"eohiDGEN_pers",0.27683,1,0.31901,0.18576,0.70868,0.21513,0.18684,0.13159,0.12199,0.26738,0.0916,0.02566,-0.01732 +"eohiDGEN_val",0.23964,0.31901,1,0.13719,0.68261,0.14816,0.12424,0.23448,0.06907,0.21756,0.10396,0.07479,-0.06044 +"eohiDGEN_life",0.24515,0.18576,0.13719,1,0.25499,0.02053,0.06528,0.04652,0.29721,0.23854,0.11795,0.03949,-0.0013 +"eohiDGEN_mean",0.66949,0.70868,0.68261,0.25499,1,0.26963,0.17831,0.19688,0.1283,0.31052,0.11102,0.06665,-0.05731 +"ehi_pref_mean",0.22538,0.21513,0.14816,0.02053,0.26963,1,0.23765,0.19925,0.0625,0.51305,0.0504,0.06892,-0.06473 +"ehi_pers_mean",0.09704,0.18684,0.12424,0.06528,0.17831,0.23765,1,0.22369,0.12488,0.5826,0.03132,0.05133,-0.04906 +"ehi_val_mean",0.08007,0.13159,0.23448,0.04652,0.19688,0.19925,0.22369,1,0.02752,0.51294,0.01519,0.00599,-0.03791 +"ehi_life_mean",0.12507,0.12199,0.06907,0.29721,0.1283,0.0625,0.12488,0.02752,1,0.59399,0.07295,0.01639,-0.00581 +"ehi_global_mean",0.21415,0.26738,0.21756,0.23854,0.31052,0.51305,0.5826,0.51294,0.59399,1,0.0849,0.05133,-0.05746 +"AOT_total",0.06836,0.0916,0.10396,0.11795,0.11102,0.0504,0.03132,0.01519,0.07295,0.0849,1,0.2609,-0.20963 +"CRT_correct",0.05361,0.02566,0.07479,0.03949,0.06665,0.06892,0.05133,0.00599,0.01639,0.05133,0.2609,1,-0.87087 +"CRT_int",-0.05819,-0.01732,-0.06044,-0.0013,-0.05731,-0.06473,-0.04906,-0.03791,-0.00581,-0.05746,-0.20963,-0.87087,1 diff --git a/eohi2/EHI reliability.html b/eohi2/EHI reliability.html new file mode 100644 index 0000000..13ffd8d --- /dev/null +++ b/eohi2/EHI reliability.html @@ -0,0 +1,145 @@ +EHI Reliability Analysis

EHI Reliability Analysis

Cronbach's Alpha

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
0.5709145 0.6860723 0.6450534 0.3533207 2.185446 0.0229978 0.138301 0.8228433 0.3517941

Split-Half Reliability

Maximum split half reliability: 0.77987

Item-Level Statistics

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
n raw.r std.r r.cor r.drop mean sd
ehiDGEN_5_mean 489 0.7653498 0.6789150 0.5035473 0.4480613 0.0620314 1.4573526
ehiDGEN_10_mean 489 0.8686359 0.7381306 0.6097580 0.5098844 0.3006135 1.8924455
ehi5_global_mean 489 0.5032176 0.7114339 0.5651807 0.3871421 0.0675187 0.4620107
ehi10_global_mean 489 0.5705196 0.7420342 0.6269733 0.4474763 0.1230402 0.5252241

Alpha if Item Dropped

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
ehiDGEN_5_mean 0.4125021 0.6576471 0.5754825 0.3903632 1.920963 0.0273016 0.0105384 0.4162485
ehiDGEN_10_mean 0.4091906 0.6003996 0.5190903 0.3337035 1.502500 0.0345773 0.0161841 0.2873396
ehi5_global_mean 0.5572211 0.6271436 0.5440163 0.3592479 1.681998 0.0259296 0.0113815 0.4162485
ehi10_global_mean 0.5282880 0.5963510 0.5041975 0.3299683 1.477400 0.0271341 0.0068450 0.2873396
diff --git a/eohi2/README_Variable_Creation.txt b/eohi2/README_Variable_Creation.txt new file mode 100644 index 0000000..e5821a2 --- /dev/null +++ b/eohi2/README_Variable_Creation.txt @@ -0,0 +1,1047 @@ +================================================================================ +EOHI2 DATA PROCESSING PIPELINE - VARIABLE CREATION DOCUMENTATION +================================================================================ + +This README documents the complete data processing pipeline for eohi2.csv. +All processing scripts should be run in the order listed below. + +Source File: eohi2.csv +Processing Scripts: dataP 01 through datap 16 + +================================================================================ +SCRIPT 01: dataP 01 - recode and combine past & future vars.r +================================================================================ + +PURPOSE: + Combines responses from two survey versions (01 and 02) and recodes Likert + scale text responses to numeric values for past and future time periods. + +VARIABLES CREATED: 60 total (15 items × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefItem_1 through 01fut10ValItem_5 (60 columns) + - Set B: 02past5PrefItem_1 through 02fut10ValItem_5 (60 columns) + +TARGET VARIABLES: + Past 5 Years (15 variables): + - past_5_pref_read, past_5_pref_music, past_5_pref_TV, past_5_pref_nap, + past_5_pref_travel + - past_5_pers_extravert, past_5_pers_critical, past_5_pers_dependable, + past_5_pers_anxious, past_5_pers_complex + - past_5_val_obey, past_5_val_trad, past_5_val_opinion, + past_5_val_performance, past_5_val_justice + + Past 10 Years (15 variables): + - past_10_pref_read, past_10_pref_music, past_10_pref_TV, past_10_pref_nap, + past_10_pref_travel + - past_10_pers_extravert, past_10_pers_critical, past_10_pers_dependable, + past_10_pers_anxious, past_10_pers_complex + - past_10_val_obey, past_10_val_trad, past_10_val_opinion, + past_10_val_performance, past_10_val_justice + + Future 5 Years (15 variables): + - fut_5_pref_read, fut_5_pref_music, fut_5_pref_TV, fut_5_pref_nap, + fut_5_pref_travel + - fut_5_pers_extravert, fut_5_pers_critical, fut_5_pers_dependable, + fut_5_pers_anxious, fut_5_pers_complex + - fut_5_val_obey, fut_5_val_trad, fut_5_val_opinion, + fut_5_val_performance, fut_5_val_justice + + Future 10 Years (15 variables): + - fut_10_pref_read, fut_10_pref_music, fut_10_pref_TV, fut_10_pref_nap, + fut_10_pref_travel + - fut_10_pers_extravert, fut_10_pers_critical, fut_10_pers_dependable, + fut_10_pers_anxious, fut_10_pers_complex + - fut_10_val_obey, fut_10_val_trad, fut_10_val_opinion, + fut_10_val_performance, fut_10_val_justice + +TRANSFORMATION LOGIC: + Step 1: Combine responses from Set A (01) and Set B (02) + - If Set A has a value, use Set A + - If Set A is empty, use Set B + + Step 2: Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +ITEM DOMAINS: + - Preferences (pref): Reading, Music, TV, Nap, Travel + - Personality (pers): Extravert, Critical, Dependable, Anxious, Complex + - Values (val): Obey, Tradition, Opinion, Performance, Justice + + +================================================================================ +SCRIPT 02: dataP 02 - recode present VARS.r +================================================================================ + +PURPOSE: + Recodes present-time Likert scale text responses to numeric values. + +VARIABLES CREATED: 15 total + +SOURCE COLUMNS: + - prePrefItem_1 through prePrefItem_5 (5 columns) + - prePersItem_1 through prePersItem_5 (5 columns) + - preValItem_1 through preValItem_5 (5 columns) + +TARGET VARIABLES: + Present Time (15 variables): + - present_pref_read, present_pref_music, present_pref_tv, present_pref_nap, + present_pref_travel + - present_pers_extravert, present_pers_critical, present_pers_dependable, + present_pers_anxious, present_pers_complex + - present_val_obey, present_val_trad, present_val_opinion, + present_val_performance, present_val_justice + +TRANSFORMATION LOGIC: + Recode text responses to numeric values: + "Strongly Disagree" → -3 + "Disagree" → -2 + "Somewhat Disagree" → -1 + "Neither Agree nor Disagree" → 0 + "Somewhat Agree" → 1 + "Agree" → 2 + "Strongly Agree" → 3 + Empty/Missing → NA + +SPECIAL NOTE: + Present time uses "present_pref_tv" (lowercase) while past/future use + "past_5_pref_TV" (uppercase). This is intentional and preserved from the + original data structure. + + +================================================================================ +SCRIPT 03: dataP 03 - recode DGEN vars.r +================================================================================ + +PURPOSE: + Combines DGEN (domain general) responses from two survey versions (01 and 02). + These are single-item measures for each domain/time combination. + NO RECODING - just copies numeric values as-is. + +VARIABLES CREATED: 12 total (3 domains × 4 time periods) + +SOURCE COLUMNS: + - Set A: 01past5PrefDGEN_1, 01past5PersDGEN_1, 01past5ValDGEN_1, etc. + - Set B: 02past5PrefDGEN_1, 02past5PersDGEN_1, 02past5ValDGEN_1, etc. + +TARGET VARIABLES: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TRANSFORMATION LOGIC: + - If Set A (01) has a value, use Set A + - If Set A is empty, use Set B (02) + - NO RECODING: Values are copied directly as numeric + +SPECIAL NOTES: + - Future columns in raw data use "_8" suffix for Pref/Pers items + - Future Val columns use "ValuesDGEN" spelling in Set A, "ValDGEN" in Set B + + +================================================================================ +SCRIPT 04: dataP 04 - DGEN means.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging the three domain scores (Preferences, + Personality, Values) for each time period. + +VARIABLES CREATED: 4 total (1 per time period) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + - DGEN_past_5_mean + - DGEN_past_10_mean + - DGEN_fut_5_mean + - DGEN_fut_10_mean + +TRANSFORMATION LOGIC: + Each mean = (Pref + Pers + Val) / 3 + - NA values are excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 05: dataP 05 - recode scales VARS.r +================================================================================ + +PURPOSE: + Processes two cognitive scales: + 1. AOT (Actively Open-minded Thinking): 8-item scale with reverse coding + 2. CRT (Cognitive Reflection Test): 3-item test with correct/intuitive scoring + +VARIABLES CREATED: 3 total + +SOURCE COLUMNS: + AOT Scale: + - aot_1, aot_2, aot_3, aot_4, aot_5, aot_6, aot_7, aot_8 + + CRT Test: + - crt_1, crt_2, crt_3 + +TARGET VARIABLES: + - aot_total (mean of 8 items with reverse coding) + - crt_correct (proportion of correct answers) + - crt_int (proportion of intuitive/incorrect answers) + +TRANSFORMATION LOGIC: + + AOT Scale (aot_total): + 1. Items 4, 5, 6, 7 are reverse coded by multiplying by -1 + 2. Calculate mean of all 8 items (with reverse coding applied) + 3. Original source values are NOT modified in the dataframe + 4. NA values excluded from calculation (na.rm = TRUE) + + CRT Correct (crt_correct): + Correct answers: + - crt_1: "5 cents" + - crt_2: "5 minutes" + - crt_3: "47 days" + Calculation: (Number of correct answers) / (Number of non-missing answers) + + CRT Intuitive (crt_int): + Intuitive (common incorrect) answers: + - crt_1: "10 cents" + - crt_2: "100 minutes" + - crt_3: "24 days" + Calculation: (Number of intuitive answers) / (Number of non-missing answers) + +SPECIAL NOTES: + - CRT scoring is case-insensitive and trims whitespace + - Both CRT scores are proportions (0.00 to 1.00) + - Empty/missing CRT responses are excluded from denominator + + +================================================================================ +SCRIPT 06: dataP 06 - time interval differences.r +================================================================================ + +PURPOSE: + Calculates absolute differences between time intervals to measure perceived + change across time periods for all 15 items. + +VARIABLES CREATED: 90 total (6 difference types × 15 items) + +SOURCE COLUMNS: + - present_pref_read through present_val_justice (15 columns) + - past_5_pref_read through past_5_val_justice (15 columns) + - past_10_pref_read through past_10_val_justice (15 columns) + - fut_5_pref_read through fut_5_val_justice (15 columns) + - fut_10_pref_read through fut_10_val_justice (15 columns) + +TARGET VARIABLES (by difference type): + + NPast_5 (Present vs Past 5 years) - 15 variables: + Formula: |present - past_5| + - NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, NPast_5_pref_nap, + NPast_5_pref_travel + - NPast_5_pers_extravert, NPast_5_pers_critical, NPast_5_pers_dependable, + NPast_5_pers_anxious, NPast_5_pers_complex + - NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice + + NPast_10 (Present vs Past 10 years) - 15 variables: + Formula: |present - past_10| + - NPast_10_pref_read, NPast_10_pref_music, NPast_10_pref_TV, + NPast_10_pref_nap, NPast_10_pref_travel + - NPast_10_pers_extravert, NPast_10_pers_critical, NPast_10_pers_dependable, + NPast_10_pers_anxious, NPast_10_pers_complex + - NPast_10_val_obey, NPast_10_val_trad, NPast_10_val_opinion, + NPast_10_val_performance, NPast_10_val_justice + + NFut_5 (Present vs Future 5 years) - 15 variables: + Formula: |present - fut_5| + - NFut_5_pref_read, NFut_5_pref_music, NFut_5_pref_TV, NFut_5_pref_nap, + NFut_5_pref_travel + - NFut_5_pers_extravert, NFut_5_pers_critical, NFut_5_pers_dependable, + NFut_5_pers_anxious, NFut_5_pers_complex + - NFut_5_val_obey, NFut_5_val_trad, NFut_5_val_opinion, + NFut_5_val_performance, NFut_5_val_justice + + NFut_10 (Present vs Future 10 years) - 15 variables: + Formula: |present - fut_10| + - NFut_10_pref_read, NFut_10_pref_music, NFut_10_pref_TV, NFut_10_pref_nap, + NFut_10_pref_travel + - NFut_10_pers_extravert, NFut_10_pers_critical, NFut_10_pers_dependable, + NFut_10_pers_anxious, NFut_10_pers_complex + - NFut_10_val_obey, NFut_10_val_trad, NFut_10_val_opinion, + NFut_10_val_performance, NFut_10_val_justice + + 5.10past (Past 5 vs Past 10 years) - 15 variables: + Formula: |past_5 - past_10| + - 5.10past_pref_read, 5.10past_pref_music, 5.10past_pref_TV, + 5.10past_pref_nap, 5.10past_pref_travel + - 5.10past_pers_extravert, 5.10past_pers_critical, 5.10past_pers_dependable, + 5.10past_pers_anxious, 5.10past_pers_complex + - 5.10past_val_obey, 5.10past_val_trad, 5.10past_val_opinion, + 5.10past_val_performance, 5.10past_val_justice + + 5.10fut (Future 5 vs Future 10 years) - 15 variables: + Formula: |fut_5 - fut_10| + - 5.10fut_pref_read, 5.10fut_pref_music, 5.10fut_pref_TV, 5.10fut_pref_nap, + 5.10fut_pref_travel + - 5.10fut_pers_extravert, 5.10fut_pers_critical, 5.10fut_pers_dependable, + 5.10fut_pers_anxious, 5.10fut_pers_complex + - 5.10fut_val_obey, 5.10fut_val_trad, 5.10fut_val_opinion, + 5.10fut_val_performance, 5.10fut_val_justice + +TRANSFORMATION LOGIC: + All calculations use absolute differences: + - NPast_5: |present_[item] - past_5_[item]| + - NPast_10: |present_[item] - past_10_[item]| + - NFut_5: |present_[item] - fut_5_[item]| + - NFut_10: |present_[item] - fut_10_[item]| + - 5.10past: |past_5_[item] - past_10_[item]| + - 5.10fut: |fut_5_[item] - fut_10_[item]| + + Result: Always positive values representing magnitude of change + Missing values in either source column result in NA + +SPECIAL NOTES: + - Present time uses "pref_tv" (lowercase) while past/future use "pref_TV" + (uppercase), so script handles this naming inconsistency + - All values are absolute differences (non-negative) + + +================================================================================ +SCRIPT 07: dataP 07 - domain means.r +================================================================================ + +PURPOSE: + Calculates domain-level means by averaging the 5 items within each domain + (Preferences, Personality, Values) for each of the 6 time interval difference + types. + +VARIABLES CREATED: 18 total (6 time intervals × 3 domains) + +SOURCE COLUMNS: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + - 5.10past_pref_read through 5.10past_val_justice (15 columns) + - 5.10fut_pref_read through 5.10fut_val_justice (15 columns) + Total: 90 difference columns (created in Script 06) + +TARGET VARIABLES: + NPast_5 Domain Means (3 variables): + - NPast_5_pref_MEAN (mean of 5 preference items) + - NPast_5_pers_MEAN (mean of 5 personality items) + - NPast_5_val_MEAN (mean of 5 values items) + + NPast_10 Domain Means (3 variables): + - NPast_10_pref_MEAN + - NPast_10_pers_MEAN + - NPast_10_val_MEAN + + NFut_5 Domain Means (3 variables): + - NFut_5_pref_MEAN + - NFut_5_pers_MEAN + - NFut_5_val_MEAN + + NFut_10 Domain Means (3 variables): + - NFut_10_pref_MEAN + - NFut_10_pers_MEAN + - NFut_10_val_MEAN + + 5.10past Domain Means (3 variables): + - 5.10past_pref_MEAN + - 5.10past_pers_MEAN + - 5.10past_val_MEAN + + 5.10fut Domain Means (3 variables): + - 5.10fut_pref_MEAN + - 5.10fut_pers_MEAN + - 5.10fut_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for NPast_5_pref_MEAN: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel) + + Example for NFut_10_pers_MEAN: + = mean(NFut_10_pers_extravert, NFut_10_pers_critical, + NFut_10_pers_dependable, NFut_10_pers_anxious, + NFut_10_pers_complex) + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF DOMAIN MEANS: + - Provides higher-level summary of perceived change by domain + - Reduces item-level noise by aggregating across related items + - Enables domain-level comparisons across time intervals + - Parallel to Script 04 (DGEN means) but for difference scores instead of + raw DGEN ratings + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - Creates domain-level aggregates of absolute difference scores + - All means are averages of non-negative values (absolute differences) + + +================================================================================ +SCRIPT 08: dataP 08 - DGEN 510 vars.r +================================================================================ + +PURPOSE: + Calculates absolute differences between 5-year and 10-year DGEN ratings for + both Past and Future time directions. These variables measure the perceived + difference in domain-general change between the two time intervals. + +VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + Total: 12 DGEN columns (created in Script 03) + +TARGET VARIABLES: + Past Direction (3 variables): + - X5_10DGEN_past_pref (|DGEN_past_5_Pref - DGEN_past_10_Pref|) + - X5_10DGEN_past_pers (|DGEN_past_5_Pers - DGEN_past_10_Pers|) + - X5_10DGEN_past_val (|DGEN_past_5_Val - DGEN_past_10_Val|) + + Future Direction (3 variables): + - X5_10DGEN_fut_pref (|DGEN_fut_5_Pref - DGEN_fut_10_Pref|) + - X5_10DGEN_fut_pers (|DGEN_fut_5_Pers - DGEN_fut_10_Pers|) + - X5_10DGEN_fut_val (|DGEN_fut_5_Val - DGEN_fut_10_Val|) + +TRANSFORMATION LOGIC: + Formula: |DGEN_5 - DGEN_10| + + All calculations use absolute differences: + - Past Preferences: |DGEN_past_5_Pref - DGEN_past_10_Pref| + - Past Personality: |DGEN_past_5_Pers - DGEN_past_10_Pers| + - Past Values: |DGEN_past_5_Val - DGEN_past_10_Val| + - Future Preferences: |DGEN_fut_5_Pref - DGEN_fut_10_Pref| + - Future Personality: |DGEN_fut_5_Pers - DGEN_fut_10_Pers| + - Future Values: |DGEN_fut_5_Val - DGEN_fut_10_Val| + + Result: Always positive values representing magnitude of difference + Missing values in either source column result in NA + +SPECIAL NOTES: + - Variable names use "X" prefix because R automatically adds it to column + names starting with numbers (5_10 becomes X5_10) + - This script depends on Script 03 being run first + - Measures interval effects within time direction (past vs future) + - Parallel to Script 06's 5.10past and 5.10fut variables but for DGEN scores + + +================================================================================ +SCRIPT 09: dataP 09 - interval x direction means.r +================================================================================ + +PURPOSE: + Calculates comprehensive mean scores by averaging item-level differences + across intervals and directions. Creates both narrow-scope means (single + time interval) and broad-scope global means (combining multiple intervals). + +VARIABLES CREATED: 11 total (6 narrow-scope + 5 global-scope) + +SOURCE COLUMNS: + All 90 difference variables created in Script 06: + - NPast_5_[domain]_[item] (15 variables) + - NPast_10_[domain]_[item] (15 variables) + - NFut_5_[domain]_[item] (15 variables) + - NFut_10_[domain]_[item] (15 variables) + - X5.10past_[domain]_[item] (15 variables) + - X5.10fut_[domain]_[item] (15 variables) + +TARGET VARIABLES: + + Narrow-Scope Means (15 source items each): + - NPast_5_mean (mean across all 15 NPast_5 items) + - NPast_10_mean (mean across all 15 NPast_10 items) + - NFut_5_mean (mean across all 15 NFut_5 items) + - NFut_10_mean (mean across all 15 NFut_10 items) + - X5.10past_mean (mean across all 15 X5.10past items) + - X5.10fut_mean (mean across all 15 X5.10fut items) + + Global-Scope Means (30 source items each): + - NPast_global_mean (NPast_5 + NPast_10: all past intervals) + - NFut_global_mean (NFut_5 + NFut_10: all future intervals) + - X5.10_global_mean (X5.10past + X5.10fut: all 5-vs-10 intervals) + - N5_global_mean (NPast_5 + NFut_5: all 5-year intervals) + - N10_global_mean (NPast_10 + NFut_10: all 10-year intervals) + +TRANSFORMATION LOGIC: + + Narrow-Scope Means (15 items each): + Each mean averages all 15 difference items within one time interval + + Example for NPast_5_mean: + = mean(NPast_5_pref_read, NPast_5_pref_music, NPast_5_pref_TV, + NPast_5_pref_nap, NPast_5_pref_travel, + NPast_5_pers_extravert, NPast_5_pers_critical, + NPast_5_pers_dependable, NPast_5_pers_anxious, + NPast_5_pers_complex, + NPast_5_val_obey, NPast_5_val_trad, NPast_5_val_opinion, + NPast_5_val_performance, NPast_5_val_justice) + + Global-Scope Means (30 items each): + Each mean averages 30 difference items across two related intervals + + Example for NPast_global_mean: + = mean(all 15 NPast_5 items + all 15 NPast_10 items) + Represents overall perceived change from present to any past timepoint + + Example for N5_global_mean: + = mean(all 15 NPast_5 items + all 15 NFut_5 items) + Represents overall perceived change at 5-year interval regardless of + direction + + NA values excluded from calculation (na.rm = TRUE) + +PURPOSE OF INTERVAL × DIRECTION MEANS: + - Narrow-scope means: Single-interval summaries across all domains and items + - Global-scope means: Cross-interval summaries for testing: + * Direction effects (past vs future) + * Interval effects (5-year vs 10-year) + * Combined temporal distance effects + - Enables comprehensive analysis of temporal self-perception patterns + - Reduces item-level and domain-level noise through broad aggregation + +QUALITY ASSURANCE: + - Script includes automated QA checks for first 5 rows + - Manually recalculates each mean and verifies against stored values + - Prints TRUE/FALSE match status for each variable + - Ensures calculation accuracy before further analysis + +SPECIAL NOTES: + - This script depends on Script 06 being run first + - All means are averages of absolute difference scores (non-negative) + - Global means provide the broadest temporal self-perception summaries + - Naming convention uses "global" for 30-item means, no suffix for 15-item + + +================================================================================ +SCRIPT 10: dataP 10 - DGEN mean vars.r +================================================================================ + +PURPOSE: + Calculates mean DGEN scores by averaging across different time combinations. + Creates means for Past, Future, and interval-based (5-year, 10-year) groupings. + +VARIABLES CREATED: 6 total + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + Direction-Based Means (2 variables): + - DGEN_past_mean (mean of past_5_mean and past_10_mean) + - DGEN_fut_mean (mean of fut_5_mean and fut_10_mean) + + Interval-Based Means (2 variables): + - DGEN_5_mean (mean of past_5_mean and fut_5_mean) + - DGEN_10_mean (mean of past_10_mean and fut_10_mean) + + Domain-Based Means (2 variables): + - DGEN_pref_mean (mean across all 4 time periods for Preferences) + - DGEN_pers_mean (mean across all 4 time periods for Personality) + +TRANSFORMATION LOGIC: + Direction-based: + - DGEN_past_mean = mean(DGEN_past_5_mean, DGEN_past_10_mean) + - DGEN_fut_mean = mean(DGEN_fut_5_mean, DGEN_fut_10_mean) + + Interval-based: + - DGEN_5_mean = mean(DGEN_past_5_mean, DGEN_fut_5_mean) + - DGEN_10_mean = mean(DGEN_past_10_mean, DGEN_fut_10_mean) + + Domain-based: + - DGEN_pref_mean = mean across all 4 Pref scores + - DGEN_pers_mean = mean across all 4 Pers scores + + NA values excluded from calculation (na.rm = TRUE) + + +================================================================================ +SCRIPT 11: dataP 11 - CORRECT ehi vars.r +================================================================================ + +PURPOSE: + Creates Enduring Hedonic Impact (EHI) variables by calculating differences + between Past and Future responses for each item across different time intervals. + Formula: NPast - NFut (positive values indicate greater past-present change) + +VARIABLES CREATED: 45 total (15 items × 3 time intervals) + +SOURCE COLUMNS: + 5-year intervals: + - NPast_5_pref_read through NPast_5_val_justice (15 columns) + - NFut_5_pref_read through NFut_5_val_justice (15 columns) + + 10-year intervals: + - NPast_10_pref_read through NPast_10_val_justice (15 columns) + - NFut_10_pref_read through NFut_10_val_justice (15 columns) + + 5-10 year change: + - X5.10past_pref_read through X5.10past_val_justice (15 columns) + - X5.10fut_pref_read through X5.10fut_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year EHI Variables (15 variables): + - ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, ehi5_pref_nap, + ehi5_pref_travel + - ehi5_pers_extravert, ehi5_pers_critical, ehi5_pers_dependable, + ehi5_pers_anxious, ehi5_pers_complex + - ehi5_val_obey, ehi5_val_trad, ehi5_val_opinion, ehi5_val_performance, + ehi5_val_justice + + 10-Year EHI Variables (15 variables): + - ehi10_pref_read, ehi10_pref_music, ehi10_pref_TV, ehi10_pref_nap, + ehi10_pref_travel + - ehi10_pers_extravert, ehi10_pers_critical, ehi10_pers_dependable, + ehi10_pers_anxious, ehi10_pers_complex + - ehi10_val_obey, ehi10_val_trad, ehi10_val_opinion, ehi10_val_performance, + ehi10_val_justice + + 5-10 Year Change EHI Variables (15 variables): + - ehi5.10_pref_read, ehi5.10_pref_music, ehi5.10_pref_TV, ehi5.10_pref_nap, + ehi5.10_pref_travel + - ehi5.10_pers_extravert, ehi5.10_pers_critical, ehi5.10_pers_dependable, + ehi5.10_pers_anxious, ehi5.10_pers_complex + - ehi5.10_val_obey, ehi5.10_val_trad, ehi5.10_val_opinion, + ehi5.10_val_performance, ehi5.10_val_justice + +TRANSFORMATION LOGIC: + Formula: NPast - NFut + + All calculations use signed differences: + - ehi5_[item] = NPast_5_[item] - NFut_5_[item] + - ehi10_[item] = NPast_10_[item] - NFut_10_[item] + - ehi5.10_[item] = X5.10past_[item] - X5.10fut_[item] + + Result: Positive = greater past change, Negative = greater future change + Missing values in either source column result in NA + +QUALITY ASSURANCE: + - Comprehensive QA checks for all 45 variables across all rows + - First 5 rows displayed with detailed calculations showing source values, + computed differences, and stored values + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 12: dataP 12 - CORRECT DGEN ehi vars.r +================================================================================ + +PURPOSE: + Creates domain-general EHI variables by calculating differences between Past + and Future DGEN responses. These are the domain-general parallel to Script 11's + domain-specific EHI variables. + +VARIABLES CREATED: 6 total (3 domains × 2 time intervals) + +SOURCE COLUMNS: + - DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val + - DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val + - DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val + - DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val + +TARGET VARIABLES: + 5-Year DGEN EHI (3 variables): + - ehiDGEN_5_Pref + - ehiDGEN_5_Pers + - ehiDGEN_5_Val + + 10-Year DGEN EHI (3 variables): + - ehiDGEN_10_Pref + - ehiDGEN_10_Pers + - ehiDGEN_10_Val + +TRANSFORMATION LOGIC: + Formula: DGEN_past - DGEN_fut + + All calculations use signed differences: + - ehiDGEN_5_Pref = DGEN_past_5_Pref - DGEN_fut_5_Pref + - ehiDGEN_5_Pers = DGEN_past_5_Pers - DGEN_fut_5_Pers + - ehiDGEN_5_Val = DGEN_past_5_Val - DGEN_fut_5_Val + - ehiDGEN_10_Pref = DGEN_past_10_Pref - DGEN_fut_10_Pref + - ehiDGEN_10_Pers = DGEN_past_10_Pers - DGEN_fut_10_Pers + - ehiDGEN_10_Val = DGEN_past_10_Val - DGEN_fut_10_Val + + Result: Positive = greater past change, Negative = greater future change + +QUALITY ASSURANCE: + - QA checks for all 6 variables across all rows + - First 5 rows displayed with detailed calculations + - Pass/Fail status for each variable reported + + +================================================================================ +SCRIPT 13: datap 13 - ehi domain specific means.r +================================================================================ + +PURPOSE: + Calculates domain-level mean EHI scores by averaging the 5 items within each + domain (Preferences, Personality, Values) for each time interval. + +VARIABLES CREATED: 9 total (3 domains × 3 time intervals) + +SOURCE COLUMNS: + - ehi5_pref_read through ehi5_val_justice (15 columns) + - ehi10_pref_read through ehi10_val_justice (15 columns) + - ehi5.10_pref_read through ehi5.10_val_justice (15 columns) + +TARGET VARIABLES: + 5-Year Domain Means (3 variables): + - ehi5_pref_MEAN (mean of 5 preference items) + - ehi5_pers_MEAN (mean of 5 personality items) + - ehi5_val_MEAN (mean of 5 values items) + + 10-Year Domain Means (3 variables): + - ehi10_pref_MEAN + - ehi10_pers_MEAN + - ehi10_val_MEAN + + 5-10 Year Change Domain Means (3 variables): + - ehi5.10_pref_MEAN + - ehi5.10_pers_MEAN + - ehi5.10_val_MEAN + +TRANSFORMATION LOGIC: + Each domain mean = average of 5 items within that domain + + Example for ehi5_pref_MEAN: + = mean(ehi5_pref_read, ehi5_pref_music, ehi5_pref_TV, + ehi5_pref_nap, ehi5_pref_travel) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - Comprehensive QA for all 9 variables across all rows + - First 5 rows displayed for multiple domain means + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 14: datap 14 - all ehi global means.r +================================================================================ + +PURPOSE: + Calculates global EHI means by averaging domain-level means. Creates the + highest-level summary scores for EHI across both domain-general and + domain-specific measures. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val + - ehiDGEN_10_Pref, ehiDGEN_10_Pers, ehiDGEN_10_Val + - ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN + - ehi10_pref_MEAN, ehi10_pers_MEAN, ehi10_val_MEAN + - ehi5.10_pref_MEAN, ehi5.10_pers_MEAN, ehi5.10_val_MEAN + +TARGET VARIABLES: + DGEN Global Means (2 variables): + - ehiDGEN_5_mean (mean of 3 DGEN domains for 5-year) + - ehiDGEN_10_mean (mean of 3 DGEN domains for 10-year) + + Domain-Specific Global Means (3 variables): + - ehi5_global_mean (mean of 3 domain means for 5-year) + - ehi10_global_mean (mean of 3 domain means for 10-year) + - ehi5.10_global_mean (mean of 3 domain means for 5-10 change) + +TRANSFORMATION LOGIC: + Each global mean = average of 3 domain-level scores + + Example for ehiDGEN_5_mean: + = mean(ehiDGEN_5_Pref, ehiDGEN_5_Pers, ehiDGEN_5_Val) + + Example for ehi5_global_mean: + = mean(ehi5_pref_MEAN, ehi5_pers_MEAN, ehi5_val_MEAN) + + NA values excluded from calculation (na.rm = TRUE) + +QUALITY ASSURANCE: + - QA for all 5 global means across all rows + - First 5 rows displayed with detailed calculations + - Values shown with 5 decimal precision + - Pass/Fail status for each variable + + +================================================================================ +SCRIPT 15: datap 15 - education recoded ordinal 3.r +================================================================================ + +PURPOSE: + Recodes raw education categories (`demo_edu`) into an ordered 3-level factor + for analyses requiring an ordinal education variable. + +VARIABLES CREATED: 1 total + +SOURCE COLUMNS: + - demo_edu + +TARGET VARIABLES: + - edu3 (ordered factor with 3 levels) + +TRANSFORMATION LOGIC: + Map `demo_edu` to 3 ordered levels and store as an ordered factor: + - "HS_TS": High School (or equivalent), Trade School (non-military) + - "C_Ug": College Diploma/Certificate, University - Undergraduate + - "grad_prof": University - Graduate (Masters), University - PhD, Professional Degree (ex. JD/MD) + + Levels and order: + edu3 = factor(edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) + +QUALITY ASSURANCE: + - Prints frequency table for `edu3` and a cross-tab of `demo_edu` × `edu3` to + verify correct mapping and absence of unintended NAs. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SCRIPT 16: datap 16 - ehi vars standardized .r +================================================================================ + +PURPOSE: + Standardizes key EHI summary variables (z-scores) and creates a composite + standardized EHI mean (`stdEHI_mean`) for use in correlational and regression + analyses. + +VARIABLES CREATED: 5 total + +SOURCE COLUMNS: + - ehiDGEN_5_mean, ehiDGEN_10_mean + - ehi5_global_mean, ehi10_global_mean + +TARGET VARIABLES: + - stdDGEN_5 = z(ehiDGEN_5_mean) + - stdDGEN_10 = z(ehiDGEN_10_mean) + - stdDS_5 = z(ehi5_global_mean) + - stdDS_10 = z(ehi10_global_mean) + - stdEHI_mean = mean(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), row-wise + +TRANSFORMATION LOGIC: + Standardize each source variable using sample mean and SD (na.rm = TRUE): + stdX = (X - mean(X)) / sd(X) + + Then compute row-wise average across the four standardized variables: + stdEHI_mean = rowMeans(cbind(stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10), + na.rm = TRUE) + +CHECKS/QA: + - Prints pre-standardization means/SDs and post-standardization means/SDs to + confirm ~0 mean and ~1 SD for each standardized variable (allowing for NAs). + - Spot-checks random rows by recomputing standardized values and comparing to + stored columns. + - Saves updated dataset to `eohi2.csv`. + + +================================================================================ +SUMMARY OF ALL CREATED VARIABLES +================================================================================ + +Total Variables Created: 291 + +By Script: + - Script 01: 60 variables (past/future recoded items) + - Script 02: 15 variables (present recoded items) + - Script 03: 12 variables (DGEN domain scores) + - Script 04: 4 variables (DGEN time period means) + - Script 05: 3 variables (AOT & CRT scales) + - Script 06: 90 variables (time interval differences) + - Script 07: 18 variables (domain means for differences) + - Script 08: 6 variables (DGEN 5-vs-10 differences) + - Script 09: 11 variables (interval × direction means) + - Script 10: 6 variables (DGEN combined means) + - Script 11: 45 variables (domain-specific EHI scores) + - Script 12: 6 variables (DGEN EHI scores) + - Script 13: 9 variables (EHI domain means) + - Script 14: 5 variables (EHI global means) + - Script 15: 1 variable (education ordinal factor) + - Script 16: 5 variables (standardized EHI summaries and composite) + +By Category: + - Time Period Items (75 total): + * Present: 15 items + * Past 5: 15 items + * Past 10: 15 items + * Future 5: 15 items + * Future 10: 15 items + + - DGEN Variables (28 total): + * Domain scores: 12 (3 domains × 4 time periods) + * Time period means: 4 (1 per time period) + * 5-vs-10 differences: 6 (3 domains × 2 directions) + * Combined means: 6 (past, future, interval-based, domain-based) + + - Cognitive Scales (3 total): + * AOT total + * CRT correct + * CRT intuitive + + - Time Differences (90 total): + * NPast_5: 15 differences + * NPast_10: 15 differences + * NFut_5: 15 differences + * NFut_10: 15 differences + * 5.10past: 15 differences + * 5.10fut: 15 differences + + - Domain Means for Differences (18 total): + * NPast_5: 3 domain means + * NPast_10: 3 domain means + * NFut_5: 3 domain means + * NFut_10: 3 domain means + * 5.10past: 3 domain means + * 5.10fut: 3 domain means + + - Interval × Direction Means (11 total): + * Narrow-scope means: 6 (NPast_5, NPast_10, NFut_5, NFut_10, + X5.10past, X5.10fut) + * Global-scope means: 5 (NPast_global, NFut_global, X5.10_global, + N5_global, N10_global) + + - EHI Variables (60 total): + * Domain-specific EHI: 45 (15 items × 3 time intervals) + * DGEN EHI: 6 (3 domains × 2 time intervals) + * Domain means: 9 (3 domains × 3 time intervals) + * Global means: 5 (2 DGEN + 3 domain-specific) + - Standardized EHI Variables (5 total): + * stdDGEN_5, stdDGEN_10, stdDS_5, stdDS_10, stdEHI_mean + + +================================================================================ +DATA PROCESSING NOTES +================================================================================ + +1. PROCESSING ORDER: + Scripts MUST be run in numerical order (01 → 16) as later scripts depend + on variables created by earlier scripts. + + Key Dependencies: + - Script 03 required before Script 04, 08, 10, 12 (DGEN scores) + - Script 04 required before Script 10 (DGEN time period means) + - Script 06 required before Script 07, 09, 11 (time interval differences) + - Script 11 required before Script 13 (domain-specific EHI items) + - Script 12 required before Script 14 (DGEN EHI scores) + - Script 13 required before Script 14 (EHI domain means) + - Script 14 required before Script 16 (uses ehiDGEN_5/10_mean, ehi5/10_global_mean) + - Script 15 can run anytime after raw `demo_edu` is present; run before + analyses needing `edu3` + +2. SURVEY VERSION HANDLING: + - Two survey versions (01 and 02) were used + - Scripts 01 and 03 combine these versions + - Preference given to version 01 when both exist + +3. MISSING DATA: + - Empty cells and NA values are preserved throughout processing + - Calculations use na.rm=TRUE to exclude missing values from means + - Difference calculations result in NA if either source value is missing + +4. QUALITY ASSURANCE: + - Each script includes QA checks with row verification + - Manual calculation checks confirm proper transformations + - Column existence checks prevent errors from missing source data + - Scripts 09-16 include comprehensive QA with first 5 rows displayed + - All EHI scripts (11-14, 16) verify calculations against stored values + - Pass/Fail status reported for all variables in QA-enabled scripts + +5. FILE SAVING: + - Most scripts save directly to eohi2.csv + - Scripts 04, 06, and 07 have commented-out write commands for review + - Scripts 08 and 09 save directly to eohi2.csv + - Each script overwrites existing target columns if present + +6. SPECIAL NAMING CONVENTIONS: + - "pref_tv" vs "pref_TV" inconsistency maintained from source data + - DGEN variables use underscores (DGEN_past_5_Pref) + - Difference variables use descriptive prefixes (NPast_5_, 5.10past_) + - "X" prefix added to variables starting with numbers (X5.10past_mean) + - Global means use "_global_" to distinguish from narrow-scope means + + +================================================================================ +ITEM REFERENCE GUIDE +================================================================================ + +15 Core Items (Used across all time periods): + +PREFERENCES (5 items): + 1. pref_read - Reading preferences + 2. pref_music - Music preferences + 3. pref_TV/tv - TV watching preferences (note case variation) + 4. pref_nap - Napping preferences + 5. pref_travel - Travel preferences + +PERSONALITY (5 items): + 6. pers_extravert - Extraverted personality + 7. pers_critical - Critical thinking personality + 8. pers_dependable - Dependable personality + 9. pers_anxious - Anxious personality + 10. pers_complex - Complex personality + +VALUES (5 items): + 11. val_obey - Value of obedience + 12. val_trad - Value of tradition + 13. val_opinion - Value of expressing opinions + 14. val_performance - Value of performance + 15. val_justice - Value of justice + + +================================================================================ +EHI CONCEPT AND INTERPRETATION +================================================================================ + +ENDURING HEDONIC IMPACT (EHI): + EHI measures the asymmetry between perceived past and future change in + psychological attributes. The concept is based on the premise that people + may perceive their past and future selves differently, even when considering + equivalent time distances. + +KEY EHI VARIABLES: + - Domain-Specific EHI (Scripts 11, 13, 14): + Calculated from item-level differences between past and future responses + Formula: NPast - NFut + * Positive values: Greater perceived change from past to present + * Negative values: Greater perceived change from present to future + * Zero: Symmetric perception of past and future change + + - Domain-General EHI (Scripts 12, 14): + Calculated from DGEN single-item responses + Formula: DGEN_past - DGEN_fut + * Measures broader temporal self-perception without item-level detail + +HIERARCHICAL STRUCTURE: + Level 1: Item-level EHI (45 domain-specific, 6 DGEN) + Level 2: Domain means (9 domain-specific, combining 5 items each) + Level 3: Global means (5 highest-level summaries) + +INTERPRETATION: + - EHI > 0: "Past asymmetry" - Person perceives greater change from past + - EHI < 0: "Future asymmetry" - Person perceives greater change to future + - EHI ≈ 0: "Temporal symmetry" - Balanced perception of past/future change + + +================================================================================ +END OF DOCUMENTATION +================================================================================ +Last Updated: October 29, 2025 +Processing Pipeline: Scripts 01-16 + diff --git a/eohi2/RMD - mixed anova DGEN.rmd b/eohi2/RMD - mixed anova DGEN.rmd new file mode 100644 index 0000000..e69de29 diff --git a/eohi2/Rplots.pdf b/eohi2/Rplots.pdf new file mode 100644 index 0000000..8b816eb Binary files /dev/null and b/eohi2/Rplots.pdf differ diff --git a/eohi2/STD_EHI_correlation_matrix.csv b/eohi2/STD_EHI_correlation_matrix.csv new file mode 100644 index 0000000..4c0780e --- /dev/null +++ b/eohi2/STD_EHI_correlation_matrix.csv @@ -0,0 +1,7 @@ +,stdEHI_mean,sex_dummy,demo_age_1,edu_num,aot_total,crt_correct +sex_dummy,0.079,,,,, +demo_age_1,-0.22***,-0.028,,,, +edu_num,-0.027,0.0094,-0.078,,, +aot_total,-0.028,-0.072,-0.20***,0.10*,, +crt_correct,0.11*,-0.16***,-0.0044,0.12**,-0.037, +crt_int,-0.12**,0.14**,0.028,-0.11*,-0.011,-0.88*** diff --git a/eohi2/STD_EHI_correlation_pvalues.csv b/eohi2/STD_EHI_correlation_pvalues.csv new file mode 100644 index 0000000..48931e8 --- /dev/null +++ b/eohi2/STD_EHI_correlation_pvalues.csv @@ -0,0 +1,7 @@ +,stdEHI_mean,sex_dummy,demo_age_1,edu_num,aot_total,crt_correct +sex_dummy,0.080650819,,,,, +demo_age_1,1.40537E-06,0.536013997,,,, +edu_num,0.551130545,0.835590798,0.086262901,,, +aot_total,0.545115793,0.112852544,5.87906E-06,0.025659604,, +crt_correct,0.011928378,0.000483116,0.923101803,0.00884239,0.4122211, +crt_int,0.007552737,0.001816488,0.533287266,0.012949289,0.810348767,9.5293E-160 diff --git a/eohi2/correlation matrix 2 - std ehi.r b/eohi2/correlation matrix 2 - std ehi.r new file mode 100644 index 0000000..4e5e2c6 --- /dev/null +++ b/eohi2/correlation matrix 2 - std ehi.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(stdEHI_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(stdEHI_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "STD_EHI_correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "STD_EHI_correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to STD_EHI_correlation_matrix.csv") +print("P-values saved to STD_EHI_correlation_pvalues.csv") \ No newline at end of file diff --git a/eohi2/correlationCORRECT_exp2.csv b/eohi2/correlationCORRECT_exp2.csv new file mode 100644 index 0000000..f1c50d2 --- /dev/null +++ b/eohi2/correlationCORRECT_exp2.csv @@ -0,0 +1,63 @@ +Variable1,Variable2,Spearman_r,P_value +ehiDGEN_5_Pers,aot_total,-0.136252077,0.002533005 +ehi5_global_mean,crt_int,-0.111415172,0.013696124 +ehi5_pref_MEAN,crt_int,-0.111269786,0.013820353 +ehi5_pref_MEAN,crt_correct,0.092043471,0.041901166 +ehi5_global_mean,crt_correct,0.091771139,0.042513801 +,,, +ehi10_global_mean,crt_correct,0.086125328,0.057016745 +ehi10_global_mean,crt_int,-0.077752437,0.085875618 +ehi10_global_mean,aot_total,0.038353442,0.397405642 +ehi10_pers_MEAN,crt_int,-0.078358781,0.083451324 +ehi10_pers_MEAN,crt_correct,0.062086308,0.170454491 +ehi10_pers_MEAN,aot_total,0.008627548,0.849074663 +ehi10_pref_MEAN,crt_correct,0.076608495,0.090603647 +ehi10_pref_MEAN,crt_int,-0.020948272,0.64400852 +ehi10_pref_MEAN,aot_total,-0.006633556,0.883671698 +ehi10_val_MEAN,crt_correct,0.05989196,0.186098498 +ehi10_val_MEAN,crt_int,-0.057978747,0.200580439 +ehi10_val_MEAN,aot_total,-0.003835901,0.932573186 +ehi5.10_global_mean,crt_correct,0.033565462,0.458964083 +ehi5.10_global_mean,aot_total,-0.031442998,0.487869173 +ehi5.10_global_mean,crt_int,-0.023334683,0.606722562 +ehi5.10_pers_MEAN,crt_correct,0.030973863,0.494387766 +ehi5.10_pers_MEAN,crt_int,-0.02351475,0.603948546 +ehi5.10_pers_MEAN,aot_total,-0.006387901,0.887950695 +ehi5.10_pref_MEAN,aot_total,-0.012595122,0.781151691 +ehi5.10_pref_MEAN,crt_correct,-0.011596204,0.798118255 +ehi5.10_pref_MEAN,crt_int,0.00927269,0.837939503 +ehi5.10_val_MEAN,crt_int,-0.02343742,0.60513915 +ehi5.10_val_MEAN,aot_total,-0.01868822,0.680165418 +ehi5.10_val_MEAN,crt_correct,0.016882557,0.709594395 +ehi5_global_mean,aot_total,-0.012144664,0.788790373 +ehi5_pers_MEAN,crt_correct,0.041879574,0.35541717 +ehi5_pers_MEAN,crt_int,-0.038984568,0.38967884 +ehi5_pers_MEAN,aot_total,-0.002320273,0.959183882 +ehi5_pref_MEAN,aot_total,-0.009156402,0.839944313 +ehi5_val_MEAN,crt_int,-0.060691086,0.180283214 +ehi5_val_MEAN,aot_total,-0.043640227,0.335537257 +ehi5_val_MEAN,crt_correct,0.038349744,0.397451186 +ehiDGEN_10_mean,crt_int,-0.060692684,0.180271722 +ehiDGEN_10_mean,crt_correct,0.048693261,0.282530257 +ehiDGEN_10_mean,aot_total,-0.007003919,0.877226879 +ehiDGEN_10_Pers,crt_int,-0.08321639,0.065963243 +ehiDGEN_10_Pers,crt_correct,0.062811394,0.165507368 +ehiDGEN_10_Pers,aot_total,-0.005213733,0.908446087 +ehiDGEN_10_Pref,crt_correct,0.056920022,0.208938511 +ehiDGEN_10_Pref,crt_int,-0.054154647,0.231949195 +ehiDGEN_10_Pref,aot_total,0.012229383,0.787352177 +ehiDGEN_10_Val,crt_correct,-0.046875479,0.300907385 +ehiDGEN_10_Val,aot_total,-0.041722577,0.35722513 +ehiDGEN_10_Val,crt_int,0.029931685,0.509033307 +ehiDGEN_5_mean,aot_total,-0.068430961,0.130753688 +ehiDGEN_5_mean,crt_correct,0.047639811,0.293085717 +ehiDGEN_5_mean,crt_int,-0.042472828,0.348637399 +ehiDGEN_5_Pers,crt_correct,0.061428736,0.175035746 +ehiDGEN_5_Pers,crt_int,-0.038746148,0.392587023 +ehiDGEN_5_Pref,crt_int,-0.042178047,0.351995885 +ehiDGEN_5_Pref,aot_total,-0.038691604,0.393254174 +ehiDGEN_5_Pref,crt_correct,0.033401162,0.461166903 +ehiDGEN_5_Val,aot_total,-0.080834838,0.074119126 +ehiDGEN_5_Val,crt_int,-0.024116805,0.594715088 +ehiDGEN_5_Val,crt_correct,0.02187202,0.629462582 +,,, diff --git a/eohi2/correlation_matrix.csv b/eohi2/correlation_matrix.csv new file mode 100644 index 0000000..b6dd5e9 --- /dev/null +++ b/eohi2/correlation_matrix.csv @@ -0,0 +1,14 @@ +,ehiDGEN_5_mean,ehiDGEN_10_mean,ehi5_global_mean,ehi10_global_mean,sex_dummy,demo_age_1,edu_num,aot_total,crt_correct +ehiDGEN_10_mean,0.42***,,,,,,,, +ehi5_global_mean,0.21***,0.21***,,,,,,, +ehi10_global_mean,0.19***,0.37***,0.43***,,,,,, +sex_dummy,0.074,0.053,0.023,0.051,,,,, +demo_age_1,-0.053,-0.22***,-0.21***,-0.26***,-0.028,,,, +edu_num,-0.031,-0.037,0.083,-0.073,0.0094,-0.078,,, +aot_total,-0.064,-0.0067,-0.0032,0.050,-0.072,-0.20***,0.10*,, +crt_correct,0.045,0.053,0.093*,0.090*,-0.16***,-0.0044,0.12**,-0.037, +crt_int,-0.041,-0.065,-0.11*,-0.083,0.14*,0.028,-0.11*,-0.011,-0.88*** +,,,,,,,,, +*p<0.05,,,,,,,,, +**p<0.01,,,,,,,,, +***p<0.001,,,,,,,,, diff --git a/eohi2/correlation_plot_domain_general_vars_spearman.pdf b/eohi2/correlation_plot_domain_general_vars_spearman.pdf new file mode 100644 index 0000000..2ac90ec Binary files /dev/null and b/eohi2/correlation_plot_domain_general_vars_spearman.pdf differ diff --git a/eohi2/correlation_plot_domain_vars_pearson.pdf b/eohi2/correlation_plot_domain_vars_pearson.pdf new file mode 100644 index 0000000..a01c519 Binary files /dev/null and b/eohi2/correlation_plot_domain_vars_pearson.pdf differ diff --git a/eohi2/correlation_plot_domain_vars_spearman.pdf b/eohi2/correlation_plot_domain_vars_spearman.pdf new file mode 100644 index 0000000..73c8a0d Binary files /dev/null and b/eohi2/correlation_plot_domain_vars_spearman.pdf differ diff --git a/eohi2/correlation_plot_scales_spearman.pdf b/eohi2/correlation_plot_scales_spearman.pdf new file mode 100644 index 0000000..e028ad3 Binary files /dev/null and b/eohi2/correlation_plot_scales_spearman.pdf differ diff --git a/eohi2/correlation_pvalues.csv b/eohi2/correlation_pvalues.csv new file mode 100644 index 0000000..fde7700 --- /dev/null +++ b/eohi2/correlation_pvalues.csv @@ -0,0 +1,10 @@ +,ehiDGEN_5_mean,ehiDGEN_10_mean,ehi5_global_mean,ehi10_global_mean,sex_dummy,demo_age_1,edu_num,aot_total,crt_correct +ehiDGEN_10_mean,2.9929E-22,,,,,,,, +ehi5_global_mean,4.14491E-06,3.02E-06,,,,,,, +ehi10_global_mean,1.61573E-05,1.66719E-17,1.63546E-23,,,,,, +sex_dummy,0.104170333,0.245085093,0.606827914,0.260991884,,,,, +demo_age_1,0.239362544,1.57395E-06,4.57184E-06,5.31327E-09,0.536013997,,,, +edu_num,0.489059792,0.41328311,0.067372333,0.10843647,0.835590798,0.086262901,,, +aot_total,0.156912095,0.882372703,0.943759329,0.269428383,0.112852544,5.87906E-06,0.025659604,, +crt_correct,0.319158511,0.24026811,0.039792024,0.047593264,0.000483116,0.923101803,0.00884239,0.4122211, +crt_int,0.365601388,0.150705909,0.01133869,0.065890723,0.001816488,0.533287266,0.012949289,0.810348767,9.5293E-160 diff --git a/eohi2/correlations - domain general vars.csv b/eohi2/correlations - domain general vars.csv new file mode 100644 index 0000000..3dd4c97 --- /dev/null +++ b/eohi2/correlations - domain general vars.csv @@ -0,0 +1,34 @@ +Variable1,Variable2,Spearman_r,P_value +DGEN_10_global_mean,aot_total,0.393039545,0 +DGEN_5_global_mean,aot_total,0.401732294,0 +DGEN_fut_10_mean,aot_total,0.372705919,0 +DGEN_fut_5_mean,aot_total,0.400202502,0 +DGEN_past_10_mean,aot_total,0.368847521,0 +DGEN_past_5_mean,aot_total,0.376820454,0 +DGENfut_global_mean,aot_total,0.382481063,0 +DGENpast_global_mean,aot_total,0.369258554,0 +DGEN_fut_5_mean,crt_correct,-0.08823341,0.051182461 +DGENfut_global_mean,crt_correct,-0.086607229,0.05563658 +DGEN_5_global_mean,crt_correct,-0.079087177,0.080612427 +DGEN_fut_10_mean,crt_correct,-0.073786402,0.103162718 +DGEN_fut_5.10_mean,aot_total,0.06505662,0.150871574 +DGEN_10_global_mean,crt_correct,-0.060769258,0.17972166 +DGEN_5.10_global_mean,aot_total,0.058102985,0.199615824 +DGEN_past_5_mean,crt_correct,-0.057080059,0.207659218 +DGEN_fut_5.10_mean,crt_correct,-0.052644919,0.245242874 +DGEN_past_5.10_mean,aot_total,0.050343754,0.266514845 +DGEN_fut_5.10_mean,crt_int,0.049423543,0.275365524 +DGENpast_global_mean,crt_correct,-0.048081298,0.288630365 +DGEN_past_10_mean,crt_int,-0.042776663,0.345197086 +DGEN_5.10_global_mean,crt_correct,-0.036910124,0.415418734 +DGENpast_global_mean,crt_int,-0.035697633,0.430916171 +DGEN_past_10_mean,crt_correct,-0.035562484,0.432664043 +DGEN_past_5_mean,crt_int,-0.031740856,0.483754572 +DGEN_10_global_mean,crt_int,-0.019205703,0.671817818 +DGEN_past_5.10_mean,crt_int,-0.015826279,0.727015617 +DGEN_5_global_mean,crt_int,-0.014881366,0.742720553 +DGEN_past_5.10_mean,crt_correct,-0.013651301,0.763324994 +DGEN_5.10_global_mean,crt_int,0.011869586,0.793465063 +DGENfut_global_mean,crt_int,0.009764448,0.829473295 +DGEN_fut_10_mean,crt_int,0.002368134,0.95834271 +DGEN_fut_5_mean,crt_int,-0.0005323,0.990632398 diff --git a/eohi2/correlations - domain general vars.r b/eohi2/correlations - domain general vars.r new file mode 100644 index 0000000..e56d8aa --- /dev/null +++ b/eohi2/correlations - domain general vars.r @@ -0,0 +1,175 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("DGEN_past_5_mean", "DGEN_past_10_mean", "DGEN_fut_5_mean", "DGEN_fut_10_mean", + "DGEN_past_5.10_mean", "DGEN_fut_5.10_mean", "DGENpast_global_mean", + "DGENfut_global_mean", "DGEN_5_global_mean", "DGEN_10_global_mean", "DGEN_5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + + +# Visual normality checks +pdf("normality_plots_domain_general_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_general_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate Spearman correlation matrix only +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot for Spearman only +pdf("correlation_plot_domain_general_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-General Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_general_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_general_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain general vars.csv", row.names = FALSE) diff --git a/eohi2/correlations - domain specific vars.csv b/eohi2/correlations - domain specific vars.csv new file mode 100644 index 0000000..75c87cb --- /dev/null +++ b/eohi2/correlations - domain specific vars.csv @@ -0,0 +1,34 @@ +Variable1,Variable2,Spearman_r,P_value +N10_global_mean,aot_total,0.150441363,0.000846088 +N5_global_mean,aot_total,0.185910923,3.52323E-05 +NFut_10_mean,aot_total,0.155140023,0.000575829 +NFut_5_mean,aot_total,0.199536342,8.75208E-06 +NFut_global_mean,aot_total,0.185343328,3.72583E-05 +NPast_10_mean,aot_total,0.143227088,0.001495728 +NPast_5_mean,aot_total,0.150454018,0.000845224 +NPast_global_mean,aot_total,0.148341676,0.001001318 +X5.10_global_mean,aot_total,0.206551087,4.11273E-06 +X5.10fut_mean,aot_total,0.208127536,3.45821E-06 +X5.10past_mean,aot_total,0.168898536,0.000175189 +NFut_5_mean,crt_correct,-0.055312717,0.222103555 +NPast_5_mean,crt_int,-0.053658543,0.236260102 +NPast_global_mean,crt_int,-0.043976695,0.33182097 +NPast_10_mean,crt_int,-0.043338736,0.33888983 +NFut_global_mean,crt_correct,-0.036977473,0.414567649 +X5.10fut_mean,crt_int,-0.030131358,0.506209892 +NPast_5_mean,crt_correct,0.028880988,0.524024755 +NFut_5_mean,crt_int,0.027093379,0.550039031 +X5.10_global_mean,crt_int,-0.025449064,0.574514939 +NPast_10_mean,crt_correct,0.021023332,0.642821387 +NPast_global_mean,crt_correct,0.020816029,0.646102235 +NFut_10_mean,crt_correct,-0.020486277,0.651335162 +X5.10past_mean,crt_int,-0.018645297,0.680859581 +N5_global_mean,crt_correct,-0.018075161,0.690105495 +N10_global_mean,crt_int,-0.016544862,0.71514808 +NFut_10_mean,crt_int,-0.009395086,0.835830518 +NFut_global_mean,crt_int,0.008419817,0.852666611 +N10_global_mean,crt_correct,-0.008133995,0.857613839 +N5_global_mean,crt_int,-0.007330571,0.87154938 +X5.10fut_mean,crt_correct,-0.005165193,0.909294754 +X5.10_global_mean,crt_correct,-0.004538036,0.920269031 +X5.10past_mean,crt_correct,0.003021813,0.94685912 diff --git a/eohi2/correlations - domain specific vars.r b/eohi2/correlations - domain specific vars.r new file mode 100644 index 0000000..cf25054 --- /dev/null +++ b/eohi2/correlations - domain specific vars.r @@ -0,0 +1,197 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp2_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("NPast_5_mean", "NPast_10_mean", "NFut_5_mean", "NFut_10_mean", + "X5.10past_mean", "X5.10fut_mean", "NPast_global_mean", + "NFut_global_mean", "X5.10_global_mean", "N5_global_mean", "N10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp2_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality (n < 5000) +for(var in names(correlation_data)) { + if(length(na.omit(correlation_data[[var]])) <= 5000) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) + } +} + +# Kolmogorov-Smirnov test for normality +for(var in names(correlation_data)) { + ks_result <- ks.test(correlation_data[[var]], "pnorm", + mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)) + cat(sprintf("%s: KS p = %.5f %s\n", + var, ks_result$p.value, + ifelse(ks_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots_domain_vars.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 21, cex = 0.6, bg = "lightblue", col = "black") + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.5f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots_domain_vars.pdf", width = 15, height = 10) +par(mfrow = c(4, 3)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 21, cex = 0.6, bg = "lightblue", col = "black") + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrices (both Pearson and Spearman) +cor_matrix_pearson <- cor(correlation_data, method = "pearson") +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Use Spearman as primary method +cor_matrix <- cor_matrix_spearman + +# Print correlation matrices with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plots for both methods +pdf("correlation_plot_domain_vars_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +pdf("correlation_plot_domain_vars_pearson.pdf", width = 10, height = 8) +corrplot(cor_matrix_pearson, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Pearson Correlation Matrix: Domain-Specific Vars vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations_domain_vars.csv") +write.csv(round(cor_matrix_pearson, 5), "pearson_correlations_domain_vars.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics_domain_vars.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlations - domain specific vars.csv", row.names = FALSE) + diff --git a/eohi2/correlations CORRECT - ehi + DGEN x scales.r b/eohi2/correlations CORRECT - ehi + DGEN x scales.r new file mode 100644 index 0000000..2c5729e --- /dev/null +++ b/eohi2/correlations CORRECT - ehi + DGEN x scales.r @@ -0,0 +1,176 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load required libraries +library(corrplot) +library(Hmisc) +library(psych) + +# Load the data +exp1_data <- read.csv("eohi2.csv") + +# Define the two sets of variables +set1_vars <- c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val", + "ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val", + "ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN", + "ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN", + "ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN", + "ehiDGEN_5_mean", "ehiDGEN_10_mean", + "ehi5_global_mean", "ehi10_global_mean", "ehi5.10_global_mean") +set2_vars <- c("aot_total", "crt_correct", "crt_int") + +# Create subset with only the variables of interest +correlation_data <- exp1_data[, c(set1_vars, set2_vars)] + +# ===== NORMALITY CHECKS ===== +# Shapiro-Wilk tests for normality +for(var in names(correlation_data)) { + shapiro_result <- shapiro.test(correlation_data[[var]]) + cat(sprintf("%s: Shapiro-Wilk p = %.5f %s\n", + var, shapiro_result$p.value, + ifelse(shapiro_result$p.value < 0.05, "(NOT normal)", "(normal)"))) +} + +# Visual normality checks +pdf("normality_plots.pdf", width = 12, height = 8) +par(mfrow = c(2, 4)) +for(var in names(correlation_data)) { + # Histogram with normal curve overlay + hist(correlation_data[[var]], main = paste("Histogram:", var), + xlab = var, freq = FALSE) + curve(dnorm(x, mean = mean(correlation_data[[var]], na.rm = TRUE), + sd = sd(correlation_data[[var]], na.rm = TRUE)), + add = TRUE, col = "red", lwd = 2) + + # Q-Q plot + qqnorm(correlation_data[[var]], main = paste("Q-Q Plot:", var)) + qqline(correlation_data[[var]], col = "red", lwd = 2) +} +dev.off() + +# ===== LINEARITY CHECKS ===== +# Check linearity between variable pairs +pdf("linearity_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + # Scatter plot with regression line + plot(correlation_data[[var1]], correlation_data[[var2]], + main = paste(var1, "vs", var2), + xlab = var1, ylab = var2, pch = 16, cex = 0.6) + + # Add linear regression line + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + abline(lm_fit, col = "red", lwd = 2) + + # Add LOESS smooth line for non-linear pattern detection + loess_fit <- loess(correlation_data[[var2]] ~ correlation_data[[var1]]) + x_seq <- seq(min(correlation_data[[var1]], na.rm = TRUE), + max(correlation_data[[var1]], na.rm = TRUE), length = 100) + loess_pred <- predict(loess_fit, x_seq) + lines(x_seq, loess_pred, col = "blue", lwd = 2, lty = 2) + + # Calculate R-squared for linear fit + r_squared <- summary(lm_fit)$r.squared + cat(sprintf("%s vs %s: R² = %.4f\n", var1, var2, r_squared)) + } +} +dev.off() + +# Residual analysis for linearity +pdf("residual_plots.pdf", width = 15, height = 10) +par(mfrow = c(3, 5)) +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + + lm_fit <- lm(correlation_data[[var2]] ~ correlation_data[[var1]]) + residuals <- residuals(lm_fit) + fitted <- fitted(lm_fit) + + plot(fitted, residuals, + main = paste("Residuals:", var1, "vs", var2), + xlab = "Fitted Values", ylab = "Residuals", pch = 16, cex = 0.6) + abline(h = 0, col = "red", lwd = 2) + + # Add smooth line to residuals + lines(lowess(fitted, residuals), col = "blue", lwd = 2) + } +} +dev.off() + + +# Calculate correlation matrix (Spearman only) +cor_matrix_spearman <- cor(correlation_data, method = "spearman") + +# Print correlation matrix with 5 decimal places +print(round(cor_matrix_spearman, 5)) + +# Separate correlations between the two sets (Spearman) +set1_set2_cor <- cor_matrix_spearman[set1_vars, set2_vars] +print(round(set1_set2_cor, 5)) + +# Calculate correlations within each set (Spearman) +set1_within_cor <- cor_matrix_spearman[set1_vars, set1_vars] +set2_within_cor <- cor_matrix_spearman[set2_vars, set2_vars] + +# Statistical significance tests (Spearman) +cor_test_results_spearman <- rcorr(as.matrix(correlation_data), type = "spearman") + +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + p_val <- cor_test_results_spearman$P[var1, var2] + cat(sprintf("%s vs %s: p = %.5f\n", var1, var2, p_val)) + } +} + +# Create correlation plot (Spearman only) +pdf("correlation_plot_scales_spearman.pdf", width = 10, height = 8) +corrplot(cor_matrix_spearman, method = "color", type = "upper", + order = "hclust", tl.cex = 0.8, tl.col = "black", + addCoef.col = "black", number.cex = 0.7, + title = "Spearman Correlation Matrix: EOHI/DGEN vs Cognitive Measures") +dev.off() + +# Summary statistics +desc_stats <- describe(correlation_data) +print(round(desc_stats, 5)) + +# Save results to CSV files +write.csv(round(cor_matrix_spearman, 5), "spearman_correlations.csv") +write.csv(round(desc_stats, 5), "descriptive_statistics.csv") + +# Save correlation results in a formatted table +cor_results <- data.frame( + Variable1 = character(), + Variable2 = character(), + Spearman_r = numeric(), + P_value = numeric(), + stringsAsFactors = FALSE +) + +# Extract significant correlations between sets +for(i in 1:length(set1_vars)) { + for(j in 1:length(set2_vars)) { + var1 <- set1_vars[i] + var2 <- set2_vars[j] + r_val <- cor_matrix_spearman[var1, var2] + p_val <- cor_test_results_spearman$P[var1, var2] + + cor_results <- rbind(cor_results, data.frame( + Variable1 = var1, + Variable2 = var2, + Spearman_r = r_val, + P_value = p_val, + stringsAsFactors = FALSE + )) + } +} + +write.csv(cor_results, "correlationCORRECT_exp2.csv", row.names = FALSE) \ No newline at end of file diff --git a/eohi2/dataP 01 - recode and combine past & future vars.r b/eohi2/dataP 01 - recode and combine past & future vars.r new file mode 100644 index 0000000..de1332d --- /dev/null +++ b/eohi2/dataP 01 - recode and combine past & future vars.r @@ -0,0 +1,266 @@ +# Script to combine and recode Likert scale items in eohi2.csv +# Combines 01 and 02 versions of items, then recodes text to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings="" keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source column pairs (Set A and Set B) +source_cols_A <- c( + "01past5PrefItem_1", "01past5PrefItem_2", "01past5PrefItem_3", "01past5PrefItem_4", "01past5PrefItem_5", + "01past5PersItem_1", "01past5PersItem_2", "01past5PersItem_3", "01past5PersItem_4", "01past5PersItem_5", + "01past5ValItem_1", "01past5ValItem_2", "01past5ValItem_3", "01past5ValItem_4", "01past5ValItem_5", + "01past10PrefItem_1", "01past10PrefItem_2", "01past10PrefItem_3", "01past10PrefItem_4", "01past10PrefItem_5", + "01past10PersItem_1", "01past10PersItem_2", "01past10PersItem_3", "01past10PersItem_4", "01past10PersItem_5", + "01past10ValItem_1", "01past10ValItem_2", "01past10ValItem_3", "01past10ValItem_4", "01past10ValItem_5", + "01fut5PrefItem_1", "01fut5PrefItem_2", "01fut5PrefItem_3", "01fut5PrefItem_4", "01fut5PrefItem_5", + "01fut5PersItem_1", "01fut5PersItem_2", "01fut5PersItem_3", "01fut5PersItem_4", "01fut5PersItem_5", + "01fut5ValItem_1", "01fut5ValItem_2", "01fut5ValItem_3", "01fut5ValItem_4", "01fut5ValItem_5", + "01fut10PrefItem_1", "01fut10PrefItem_2", "01fut10PrefItem_3", "01fut10PrefItem_4", "01fut10PrefItem_5", + "01fut10PersItem_1", "01fut10PersItem_2", "01fut10PersItem_3", "01fut10PersItem_4", "01fut10PersItem_5", + "01fut10ValItem_1", "01fut10ValItem_2", "01fut10ValItem_3", "01fut10ValItem_4", "01fut10ValItem_5" +) + +source_cols_B <- c( + "02past5PrefItem_1", "02past5PrefItem_2", "02past5PrefItem_3", "02past5PrefItem_4", "02past5PrefItem_5", + "02past5PersItem_1", "02past5PersItem_2", "02past5PersItem_3", "02past5PersItem_4", "02past5PersItem_5", + "02past5ValItem_1", "02past5ValItem_2", "02past5ValItem_3", "02past5ValItem_4", "02past5ValItem_5", + "02past10PrefItem_1", "02past10PrefItem_2", "02past10PrefItem_3", "02past10PrefItem_4", "02past10PrefItem_5", + "02past10PersItem_1", "02past10PersItem_2", "02past10PersItem_3", "02past10PersItem_4", "02past10PersItem_5", + "02past10ValItem_1", "02past10ValItem_2", "02past10ValItem_3", "02past10ValItem_4", "02past10ValItem_5", + "02fut5PrefItem_1", "02fut5PrefItem_2", "02fut5PrefItem_3", "02fut5PrefItem_4", "02fut5PrefItem_5", + "02fut5PersItem_1", "02fut5PersItem_2", "02fut5PersItem_3", "02fut5PersItem_4", "02fut5PersItem_5", + "02fut5ValItem_1", "02fut5ValItem_2", "02fut5ValItem_3", "02fut5ValItem_4", "02fut5ValItem_5", + "02fut10PrefItem_1", "02fut10PrefItem_2", "02fut10PrefItem_3", "02fut10PrefItem_4", "02fut10PrefItem_5", + "02fut10PersItem_1", "02fut10PersItem_2", "02fut10PersItem_3", "02fut10PersItem_4", "02fut10PersItem_5", + "02fut10ValItem_1", "02fut10ValItem_2", "02fut10ValItem_3", "02fut10ValItem_4", "02fut10ValItem_5" +) + +# Define target column names +target_cols <- c( + "past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel", + "past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex", + "past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice", + "past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel", + "past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex", + "past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice", + "fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel", + "fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex", + "fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice", + "fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel", + "fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex", + "fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 60 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 30 || length(missing_B) > 30) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns +for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Recode to numeric + df[[target_col]] <- recode_likert(combined) + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 60 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 60 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 60 pairs + for (i in 1:60) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_text <- val_A + } else if (has_val_B) { + source_used <- "B" + original_text <- val_B + } else { + source_used <- "NONE" + original_text <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 60 new columns added to eohi2.csv\n") + diff --git a/eohi2/dataP 02 - recode present VARS.r b/eohi2/dataP 02 - recode present VARS.r new file mode 100644 index 0000000..6adcf6d --- /dev/null +++ b/eohi2/dataP 02 - recode present VARS.r @@ -0,0 +1,192 @@ +# Script to recode present-time Likert scale items in eohi2.csv +# Recodes prePrefItem, prePersItem, and preValItem to numeric values + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the mapping function +recode_likert <- function(x) { + case_when( + tolower(x) == "strongly disagree" ~ -3, + tolower(x) == "disagree" ~ -2, + tolower(x) == "somewhat disagree" ~ -1, + tolower(x) == "neither agree nor disagree" ~ 0, + tolower(x) == "somewhat agree" ~ 1, + tolower(x) == "agree" ~ 2, + tolower(x) == "strongly agree" ~ 3, + TRUE ~ NA_real_ + ) +} + +# Define source columns (15 columns total) +source_cols <- c( + "prePrefItem_1", "prePrefItem_2", "prePrefItem_3", "prePrefItem_4", "prePrefItem_5", + "prePersItem_1", "prePersItem_2", "prePersItem_3", "prePersItem_4", "prePersItem_5", + "preValItem_1", "preValItem_2", "preValItem_3", "preValItem_4", "preValItem_5" +) + +# Define target column names (15 columns total) +target_cols <- c( + "present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel", + "present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex", + "present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_source) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + for (miss_col in missing_source) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 7) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Check if target columns exist in the dataframe +cat("\n=== CHECKING TARGET COLUMNS ===\n") +existing_targets <- target_cols[target_cols %in% df_cols] +missing_targets <- target_cols[!target_cols %in% df_cols] + +cat("Target Columns:\n") +cat(" Expected: 15 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with recoded values.\n") +} +cat("\n") + +# Process each column (overwrite existing target columns with recoded values) +for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values from source column, handling missing columns + source_vals <- if (source_col %in% names(df)) df[[source_col]] else rep(NA, nrow(df)) + + # Recode to numeric and overwrite existing target column + df[[target_col]] <- recode_likert(source_vals) + + # Print progress + cat("Processed:", target_col, "\n") +} + +cat("\n=== RECODING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 15 columns + for (i in 1:15) { + source_col <- source_cols[i] + target_col <- target_cols[i] + + # Get values + source_val <- if (source_col %in% names(df)) df[random_row, source_col] else "" + target_val <- df[random_row, target_col] + + # Determine if source has a value + has_val <- !is.na(source_val) && source_val != "" + + original_text <- if (has_val) source_val else "(empty)" + + # Print the info + cat(sprintf("Column %2d:\n", i)) + cat(sprintf(" Source: %-30s\n", source_col)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Original text: '%s'\n", original_text)) + cat(sprintf(" Numeric value: %s\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 189 to save changes.\n") +cat("\nProcessing complete! 15 new columns created (not yet saved to file).\n") diff --git a/eohi2/dataP 03 - recode DGEN vars.r b/eohi2/dataP 03 - recode DGEN vars.r new file mode 100644 index 0000000..abcc128 --- /dev/null +++ b/eohi2/dataP 03 - recode DGEN vars.r @@ -0,0 +1,253 @@ +# Script to combine DGEN variables in eohi2.csv +# Combines 01 and 02 versions of DGEN items (no recoding, just copying values) + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source column pairs (Set A and Set B) +# NOTE: fut5/fut10 columns use _8 suffix and "Values" spelling based on CSV header +source_cols_A <- c( + "01past5PrefDGEN_1", + "01past5PersDGEN_1", + "01past5ValDGEN_1", + "01past10PrefDGEN_1", + "01past10PersDGEN_1", + "01past10ValDGEN_1", + "01fut5PrefDGEN_8", + "01fut5PersDGEN_8", + "01fut5ValuesDGEN_1", + "01fut10PrefDGEN_8", + "01fut10PersDGEN_8", + "01fut10ValuesDGEN_1" +) + +source_cols_B <- c( + "02past5PrefDGEN_1", + "02past5PersDGEN_1", + "02past5ValDGEN_1", + "02past10PrefDGEN_1", + "02past10PersDGEN_1", + "02past10ValDGEN_1", + "02fut5PrefDGEN_8", + "02fut5PersDGEN_8", + "02fut5ValDGEN_1", + "02fut10PrefDGEN_8", + "02fut10PersDGEN_8", + "02fut10ValDGEN_1" +) + +# Define target column names +target_cols <- c( + "DGEN_past_5_Pref", + "DGEN_past_5_Pers", + "DGEN_past_5_Val", + "DGEN_past_10_Pref", + "DGEN_past_10_Pers", + "DGEN_past_10_Val", + "DGEN_fut_5_Pref", + "DGEN_fut_5_Pers", + "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", + "DGEN_fut_10_Pers", + "DGEN_fut_10_Val" +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Print first 30 actual column names for debugging +cat("First 30 actual column names in CSV:\n") +for (i in 1:min(30, length(df_cols))) { + cat(sprintf(" %2d. '%s' (length: %d)\n", i, df_cols[i], nchar(df_cols[i]))) +} +cat("\n") + +# Check Source A columns +missing_A <- source_cols_A[!source_cols_A %in% df_cols] +existing_A <- source_cols_A[source_cols_A %in% df_cols] + +cat("Source Set A:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_A), "columns\n") +cat(" Missing:", length(missing_A), "columns\n") + +if (length(missing_A) > 0) { + cat("\n Missing columns from Set A:\n") + for (col in missing_A) { + cat(" -", col, "\n") + } +} + +# Check Source B columns +missing_B <- source_cols_B[!source_cols_B %in% df_cols] +existing_B <- source_cols_B[source_cols_B %in% df_cols] + +cat("\nSource Set B:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_B), "columns\n") +cat(" Missing:", length(missing_B), "columns\n") + +if (length(missing_B) > 0) { + cat("\n Missing columns from Set B:\n") + for (col in missing_B) { + cat(" -", col, "\n") + } +} + +# Check for columns with similar names (potential typos/spaces) +if (length(missing_A) > 0 || length(missing_B) > 0) { + cat("\n\n=== CHECKING FOR SIMILAR COLUMN NAMES ===\n") + all_missing <- c(missing_A, missing_B) + for (miss_col in all_missing) { + # Find columns that start with similar pattern + pattern <- substr(miss_col, 1, 10) + similar <- grep(pattern, df_cols, value = TRUE, ignore.case = TRUE) + if (length(similar) > 0) { + cat("\nLooking for:", miss_col) + cat("\n Similar columns found:\n") + for (sim in similar) { + cat(" - '", sim, "' (length:", nchar(sim), ")\n", sep = "") + } + } + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_A) > 6 || length(missing_B) > 6) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# Process each pair of columns (just copy values, no recoding) +for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values from columns, handling missing columns + vals_A <- if (col_A %in% names(df)) df[[col_A]] else rep(NA, nrow(df)) + vals_B <- if (col_B %in% names(df)) df[[col_B]] else rep(NA, nrow(df)) + + # Coalesce: take value from vals_A if present, otherwise from vals_B + # No recoding - just copy the value directly + combined <- ifelse(!is.na(vals_A) & vals_A != "", + vals_A, + vals_B) + + # Copy directly to target column (no recoding) + df[[target_col]] <- combined + + # Print progress + cat("Processed:", target_col, "\n") +} + +# ============= VERIFY TARGET COLUMNS WERE CREATED ============= +cat("\n\n=== VERIFYING TARGET COLUMNS ===\n\n") + +# Get updated column names +df_cols_after <- trimws(names(df)) + +# Check which target columns exist +existing_targets <- target_cols[target_cols %in% df_cols_after] +missing_targets <- target_cols[!target_cols %in% df_cols_after] + +cat("Target Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Created:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n WARNING: The following target columns were NOT created:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } + stop("\nERROR: Not all target columns were created successfully!") +} else { + cat("\n SUCCESS: All 12 target columns created successfully!\n") +} + +cat("\n=== END VERIFICATION ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 12 pairs + for (i in 1:12) { + col_A <- source_cols_A[i] + col_B <- source_cols_B[i] + target_col <- target_cols[i] + + # Get values + val_A <- if (col_A %in% names(df)) df[random_row, col_A] else "" + val_B <- if (col_B %in% names(df)) df[random_row, col_B] else "" + target_val <- df[random_row, target_col] + + # Determine which source had the value + has_val_A <- !is.na(val_A) && val_A != "" + has_val_B <- !is.na(val_B) && val_B != "" + + if (has_val_A) { + source_used <- "A" + original_value <- val_A + } else if (has_val_B) { + source_used <- "B" + original_value <- val_B + } else { + source_used <- "NONE" + original_value <- "(empty)" + } + + # Print the info + cat(sprintf("Pair %2d:\n", i)) + cat(sprintf(" Source A: %-30s\n", col_A)) + cat(sprintf(" Source B: %-30s\n", col_B)) + cat(sprintf(" Target: %-30s\n", target_col)) + cat(sprintf(" Value found in: Source %s\n", source_used)) + cat(sprintf(" Original value: '%s'\n", original_value)) + cat(sprintf(" Target value: '%s'\n", ifelse(is.na(target_val), "NA", as.character(target_val)))) + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\nProcessing complete! 12 new columns added to eohi2.csv\n") diff --git a/eohi2/dataP 04 - DGEN means.r b/eohi2/dataP 04 - DGEN means.r new file mode 100644 index 0000000..3d454c8 --- /dev/null +++ b/eohi2/dataP 04 - DGEN means.r @@ -0,0 +1,183 @@ +# Script to calculate DGEN means by time period in eohi2.csv +# Averages the 3 domain scores (Pref, Pers, Val) for each time period + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns (12 total) +source_cols <- c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +) + +# Define target columns (4 total) +target_cols <- c( + "DGEN_past_5_mean", + "DGEN_past_10_mean", + "DGEN_fut_5_mean", + "DGEN_fut_10_mean" +) + +# Define groupings: each target gets 3 source columns +source_groups <- list( + DGEN_past_5_mean = c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val"), + DGEN_past_10_mean = c("DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val"), + DGEN_fut_5_mean = c("DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val"), + DGEN_fut_10_mean = c("DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 12 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 4 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 6) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE MEANS ============= +cat("Calculating DGEN means by time period...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate each target as the mean of its 3 source columns +for (target in target_cols) { + source_group <- source_groups[[target]] + + # Get the columns that exist + existing_cols <- source_group[source_group %in% names(df)] + + if (length(existing_cols) > 0) { + # Calculate row means across the 3 domain columns + df[[target]] <- rowMeans(df[, existing_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", target, "\n") + } else { + cat(" WARNING: No source columns found for", target, "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # Check each of the 4 target columns + for (target in target_cols) { + source_group <- source_groups[[target]] + + cat(sprintf("Target: %s\n", target)) + cat(" Source columns:\n") + + # Get values from source columns + values <- numeric(3) + for (i in 1:3) { + col <- source_group[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target] + + cat(sprintf("\n Calculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", paste(valid_values, collapse = " + "), sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target value: %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 163 to save changes.\n") +cat("\nProcessing complete! 4 DGEN mean columns calculated (not yet saved to file).\n") diff --git a/eohi2/dataP 05 - recode scales VARS.r b/eohi2/dataP 05 - recode scales VARS.r new file mode 100644 index 0000000..2861737 --- /dev/null +++ b/eohi2/dataP 05 - recode scales VARS.r @@ -0,0 +1,298 @@ +# Script to compute AOT and CRT scales in eohi2.csv +# AOT: Reverse codes items 4-7, then averages all 8 items +# CRT: Calculates proportion of correct and intuitive responses + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define source columns +aot_cols <- c("aot_1", "aot_2", "aot_3", "aot_4", "aot_5", "aot_6", "aot_7", "aot_8") +crt_cols <- c("crt_1", "crt_2", "crt_3") + +# Define target columns +target_cols <- c("aot_total", "crt_correct", "crt_int") + +# Define correct and intuitive CRT answers +crt_correct_answers <- c("5 cents", "5 minutes", "47 days") +crt_intuitive_answers <- c("10 cents", "100 minutes", "24 days") + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check AOT columns +missing_aot <- aot_cols[!aot_cols %in% df_cols] +existing_aot <- aot_cols[aot_cols %in% df_cols] + +cat("AOT Source Columns:\n") +cat(" Expected: 8 columns\n") +cat(" Found:", length(existing_aot), "columns\n") +cat(" Missing:", length(missing_aot), "columns\n") + +if (length(missing_aot) > 0) { + cat("\n Missing AOT columns:\n") + for (col in missing_aot) { + cat(" -", col, "\n") + } +} + +# Check CRT columns +missing_crt <- crt_cols[!crt_cols %in% df_cols] +existing_crt <- crt_cols[crt_cols %in% df_cols] + +cat("\nCRT Source Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_crt), "columns\n") +cat(" Missing:", length(missing_crt), "columns\n") + +if (length(missing_crt) > 0) { + cat("\n Missing CRT columns:\n") + for (col in missing_crt) { + cat(" -", col, "\n") + } +} + +# Check target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 3 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Missing target columns:\n") + for (col in missing_targets) { + cat(" -", col, "\n") + } +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_aot) > 4 || length(missing_crt) > 1 || length(missing_targets) > 1) { + stop("ERROR: Too many columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= PROCESS AOT SCALE ============= +cat("Processing AOT scale...\n") + +# Convert AOT columns to numeric (handling any non-numeric values) +for (col in aot_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate average with reverse coding (WITHOUT modifying original values) +# Items 4, 5, 6, 7 are reverse coded for calculation only +df$aot_total <- apply(df[, aot_cols[aot_cols %in% names(df)], drop = FALSE], 1, function(row) { + # Create a copy for calculation + values <- as.numeric(row) + + # Reverse items 4, 5, 6, 7 (positions in aot_cols vector) + reverse_positions <- c(4, 5, 6, 7) + values[reverse_positions] <- values[reverse_positions] * -1 + + # Return mean (na.rm = TRUE handles missing values) + mean(values, na.rm = TRUE) +}) + +cat(" AOT total scores calculated (items 4-7 reverse coded for calculation only).\n") +cat(" Original AOT item values preserved in dataframe.\n\n") + +# ============= PROCESS CRT SCALES ============= +cat("Processing CRT scales...\n") + +# Initialize CRT columns +df$crt_correct <- NA +df$crt_int <- NA + +# Process each row +for (i in 1:nrow(df)) { + # CRT Correct + crt_correct_count <- 0 + crt_correct_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + correct_answer <- tolower(crt_correct_answers[j]) + + if (!is.na(response) && response != "") { + crt_correct_n <- crt_correct_n + 1 + if (response == correct_answer) { + crt_correct_count <- crt_correct_count + 1 + } + } + } + } + + # Calculate proportion correct + if (crt_correct_n > 0) { + df$crt_correct[i] <- crt_correct_count / crt_correct_n + } + + # CRT Intuitive + crt_int_count <- 0 + crt_int_n <- 0 + + for (j in 1:3) { + col <- crt_cols[j] + if (col %in% names(df)) { + response <- trimws(tolower(as.character(df[i, col]))) + intuitive_answer <- tolower(crt_intuitive_answers[j]) + + if (!is.na(response) && response != "") { + crt_int_n <- crt_int_n + 1 + if (response == intuitive_answer) { + crt_int_count <- crt_int_count + 1 + } + } + } + } + + # Calculate proportion intuitive + if (crt_int_n > 0) { + df$crt_int[i] <- crt_int_count / crt_int_n + } +} + +cat(" CRT correct and intuitive scores calculated.\n\n") + +cat("=== PROCESSING COMPLETE ===\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW CHECK ============= +# This function can be run multiple times to check different random rows + +qa_check_random_row <- function() { + # Pick a random row + random_row <- sample(1:nrow(df), 1) + + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + cat("========================================\n\n") + + # AOT Check + cat("--- AOT SCALE ---\n") + cat("Source values (original in CSV):\n") + aot_original <- numeric(8) + aot_for_calc <- numeric(8) + + for (i in 1:8) { + col <- aot_cols[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + aot_original[i] <- val + + # Apply reversal for items 4-7 + if (i %in% 4:7) { + aot_for_calc[i] <- val * -1 + cat(sprintf(" %s: %s (reversed to %s for calculation)\n", + col, + ifelse(is.na(val), "NA", as.character(val)), + ifelse(is.na(val), "NA", as.character(val * -1)))) + } else { + aot_for_calc[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", as.character(val)))) + } + } + + # Manual calculation check + valid_aot <- aot_for_calc[!is.na(aot_for_calc)] + if (length(valid_aot) > 0) { + expected_mean <- mean(valid_aot) + actual_value <- df$aot_total[random_row] + cat(sprintf("\nCalculation check:\n")) + cat(sprintf(" Sum of reversed values: %s\n", paste(valid_aot, collapse = " + "))) + cat(sprintf(" Average of %d valid items: %.5f\n", length(valid_aot), expected_mean)) + cat(sprintf(" Target value (aot_total): %.5f\n", actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat("\n No valid AOT values to calculate.\n") + } + + # CRT Check + cat("\n--- CRT SCALE ---\n") + cat("Source values:\n") + crt_correct_count <- 0 + crt_int_count <- 0 + crt_n <- 0 + + for (i in 1:3) { + col <- crt_cols[i] + val <- if (col %in% names(df)) as.character(df[random_row, col]) else "" + val_trimmed <- trimws(tolower(val)) + + correct_ans <- crt_correct_answers[i] + intuitive_ans <- crt_intuitive_answers[i] + + is_correct <- val_trimmed == tolower(correct_ans) + is_intuitive <- val_trimmed == tolower(intuitive_ans) + + if (val_trimmed != "" && !is.na(val_trimmed)) { + crt_n <- crt_n + 1 + if (is_correct) crt_correct_count <- crt_correct_count + 1 + if (is_intuitive) crt_int_count <- crt_int_count + 1 + } + + cat(sprintf(" %s: '%s'\n", col, val)) + cat(sprintf(" Correct answer: '%s' -> %s\n", correct_ans, ifelse(is_correct, "CORRECT ✓", "Not correct"))) + cat(sprintf(" Intuitive answer: '%s' -> %s\n", intuitive_ans, ifelse(is_intuitive, "INTUITIVE ✓", "Not intuitive"))) + } + + cat("\nCalculation check:\n") + if (crt_n > 0) { + expected_correct <- crt_correct_count / crt_n + expected_int <- crt_int_count / crt_n + actual_correct <- df$crt_correct[random_row] + actual_int <- df$crt_int[random_row] + + cat(sprintf(" Correct: %d out of %d = %.5f\n", crt_correct_count, crt_n, expected_correct)) + cat(sprintf(" Target value (crt_correct): %.5f\n", actual_correct)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_correct - actual_correct) < 0.0001, "YES ✓", "NO ✗"))) + + cat(sprintf("\n Intuitive: %d out of %d = %.5f\n", crt_int_count, crt_n, expected_int)) + cat(sprintf(" Target value (crt_int): %.5f\n", actual_int)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_int - actual_int) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid CRT responses to calculate.\n") + } + + cat("\n========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on first random row +cat("\n\n") +qa_check_random_row() + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER RANDOM ROW ***\n") +cat("Run this command in R console:\n") +cat(" qa_check_random_row()\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 253 to save changes.\n") +cat("\nProcessing complete! AOT and CRT scales calculated (not yet saved to file).\n") diff --git a/eohi2/dataP 06 - time interval differences.r b/eohi2/dataP 06 - time interval differences.r new file mode 100644 index 0000000..16b6670 --- /dev/null +++ b/eohi2/dataP 06 - time interval differences.r @@ -0,0 +1,292 @@ +# Script to calculate absolute differences between time intervals in eohi2.csv +# Compares present vs past/future, and 5-year vs 10-year intervals + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Note: present uses lowercase "tv", others use uppercase "TV" +items_present <- c( + "pref_read", "pref_music", "pref_tv", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define all source columns (75 total) +source_cols <- c( + paste0("present_", items_present), + paste0("past_5_", items), + paste0("past_10_", items), + paste0("fut_5_", items), + paste0("fut_10_", items) +) + +# Define all target columns (90 total = 6 calculation types × 15 items) +target_NPast_5 <- paste0("NPast_5_", items) +target_NPast_10 <- paste0("NPast_10_", items) +target_NFut_5 <- paste0("NFut_5_", items) +target_NFut_10 <- paste0("NFut_10_", items) +target_5_10past <- paste0("5.10past_", items) +target_5_10fut <- paste0("5.10fut_", items) + +target_cols <- c( + target_NPast_5, + target_NPast_10, + target_NFut_5, + target_NFut_10, + target_5_10past, + target_5_10fut +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 75 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 10) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 10) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 30) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DIFFERENCES ============= +cat("Calculating time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Helper function to calculate absolute difference +calc_abs_diff <- function(col1, col2) { + val1 <- if (col1 %in% names(df)) df[[col1]] else NA + val2 <- if (col2 %in% names(df)) df[[col2]] else NA + abs(val1 - val2) +} + +# Calculate NPast_5: |present - past_5| +cat(" Calculating NPast_5 differences (present vs past 5 years)...\n") +for (i in 1:15) { + target <- target_NPast_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NPast_10: |present - past_10| +cat(" Calculating NPast_10 differences (present vs past 10 years)...\n") +for (i in 1:15) { + target <- target_NPast_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_5: |present - fut_5| +cat(" Calculating NFut_5 differences (present vs future 5 years)...\n") +for (i in 1:15) { + target <- target_NFut_5[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_5_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate NFut_10: |present - fut_10| +cat(" Calculating NFut_10 differences (present vs future 10 years)...\n") +for (i in 1:15) { + target <- target_NFut_10[i] + source1 <- paste0("present_", items_present[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10past: |past_5 - past_10| +cat(" Calculating 5.10past differences (past 5 vs past 10 years)...\n") +for (i in 1:15) { + target <- target_5_10past[i] + source1 <- paste0("past_5_", items[i]) + source2 <- paste0("past_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +# Calculate 5.10fut: |fut_5 - fut_10| +cat(" Calculating 5.10fut differences (future 5 vs future 10 years)...\n") +for (i in 1:15) { + target <- target_5_10fut[i] + source1 <- paste0("fut_5_", items[i]) + source2 <- paste0("fut_10_", items[i]) + df[[target]] <- calc_abs_diff(source1, source2) +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 90 difference columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & ITEM CHECK ============= +# This function can be run multiple times to check different random rows and items + +qa_check_random_row <- function(row_num = NULL, item_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random item or use specified item + if (is.null(item_num)) { + test_item_idx <- sample(1:15, 1) + cat("Random Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } else { + if (item_num < 1 || item_num > 15) { + cat("ERROR: Item number must be between 1 and 15\n") + return() + } + test_item_idx <- item_num + cat("Specified Item #", test_item_idx, ": ", items[test_item_idx], "\n") + } + + cat("========================================\n\n") + + calculations <- list( + list(name = "NPast_5", target = target_NPast_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_5_", items[test_item_idx]), + desc = "|present - past_5|"), + list(name = "NPast_10", target = target_NPast_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|present - past_10|"), + list(name = "NFut_5", target = target_NFut_5[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_5_", items[test_item_idx]), + desc = "|present - fut_5|"), + list(name = "NFut_10", target = target_NFut_10[test_item_idx], + source1 = paste0("present_", items_present[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|present - fut_10|"), + list(name = "5.10past", target = target_5_10past[test_item_idx], + source1 = paste0("past_5_", items[test_item_idx]), + source2 = paste0("past_10_", items[test_item_idx]), + desc = "|past_5 - past_10|"), + list(name = "5.10fut", target = target_5_10fut[test_item_idx], + source1 = paste0("fut_5_", items[test_item_idx]), + source2 = paste0("fut_10_", items[test_item_idx]), + desc = "|fut_5 - fut_10|") + ) + + for (calc in calculations) { + cat(sprintf("--- %s ---\n", calc$name)) + cat(sprintf("Formula: %s\n", calc$desc)) + + val1 <- if (calc$source1 %in% names(df)) df[random_row, calc$source1] else NA + val2 <- if (calc$source2 %in% names(df)) df[random_row, calc$source2] else NA + target_val <- df[random_row, calc$target] + + cat(sprintf(" %s: %s\n", calc$source1, ifelse(is.na(val1), "NA", as.character(val1)))) + cat(sprintf(" %s: %s\n", calc$source2, ifelse(is.na(val2), "NA", as.character(val2)))) + + if (!is.na(val1) && !is.na(val2)) { + expected_diff <- abs(val1 - val2) + cat(sprintf("\n Calculation: |%.5f - %.5f| = %.5f\n", val1, val2, expected_diff)) + cat(sprintf(" Target (%s): %.5f\n", calc$target, target_val)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_diff - target_val) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" Cannot calculate (missing values)\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random item +cat("\n\n") +qa_check_random_row() # Leave blank for random row & item; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/ITEM ***\n") +cat("For random row AND random item, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random item:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific item (e.g., item 5 = pref_travel):\n") +cat(" qa_check_random_row(item_num = 5)\n") +cat("\nFor specific row AND specific item:\n") +cat(" qa_check_random_row(118, 5)\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +# write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 243 to save changes.\n") +cat("\nProcessing complete! 90 difference columns calculated (not yet saved to file).\n") diff --git a/eohi2/dataP 07 - domain means.r b/eohi2/dataP 07 - domain means.r new file mode 100644 index 0000000..eead82b --- /dev/null +++ b/eohi2/dataP 07 - domain means.r @@ -0,0 +1,265 @@ +# Script to calculate domain means for time interval differences in eohi2.csv +# Averages the 5 items within each domain (pref, pers, val) for each time interval type + +# Load necessary library +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data (with check.names=FALSE to preserve original column names) +# na.strings=NULL keeps empty cells as empty strings instead of converting to NA +df <- read.csv("eohi2.csv", stringsAsFactors = FALSE, check.names = FALSE, na.strings = NULL) + +# Define the 15 item names (same order for all time periods) +items <- c( + "pref_read", "pref_music", "pref_TV", "pref_nap", "pref_travel", + "pers_extravert", "pers_critical", "pers_dependable", "pers_anxious", "pers_complex", + "val_obey", "val_trad", "val_opinion", "val_performance", "val_justice" +) + +# Define domain groupings (indices in items vector) +pref_indices <- 1:5 +pers_indices <- 6:10 +val_indices <- 11:15 + +# Define time interval prefixes +time_prefixes <- c("NPast_5", "NPast_10", "NFut_5", "NFut_10", "X5.10past", "X5.10fut") + +# Define domain names +domain_names <- c("pref", "pers", "val") + +# Define all source columns (90 total) +source_cols <- c( + paste0("NPast_5_", items), + paste0("NPast_10_", items), + paste0("NFut_5_", items), + paste0("NFut_10_", items), + paste0("X5.10past_", items), + paste0("X5.10fut_", items) +) + +# Define all target columns (18 total = 6 time intervals × 3 domains) +target_cols <- c( + paste0("NPast_5_", domain_names, "_MEAN"), + paste0("NPast_10_", domain_names, "_MEAN"), + paste0("NFut_5_", domain_names, "_MEAN"), + paste0("NFut_10_", domain_names, "_MEAN"), + paste0("X5.10past_", domain_names, "_MEAN"), + paste0("X5.10fut_", domain_names, "_MEAN") +) + +# ============= TROUBLESHOOTING: CHECK COLUMN EXISTENCE ============= +cat("\n=== COLUMN EXISTENCE CHECK ===\n\n") + +# Get actual column names from dataframe (trimmed) +df_cols <- trimws(names(df)) + +# Check Source columns +missing_source <- source_cols[!source_cols %in% df_cols] +existing_source <- source_cols[source_cols %in% df_cols] + +cat("Source Columns:\n") +cat(" Expected: 90 columns\n") +cat(" Found:", length(existing_source), "columns\n") +cat(" Missing:", length(missing_source), "columns\n") + +if (length(missing_source) > 0 && length(missing_source) <= 20) { + cat("\n Missing source columns:\n") + for (col in missing_source) { + cat(" -", col, "\n") + } +} else if (length(missing_source) > 20) { + cat("\n Too many missing to list individually (", length(missing_source), "missing)\n") +} + +# Check Target columns +missing_targets <- target_cols[!target_cols %in% df_cols] +existing_targets <- target_cols[target_cols %in% df_cols] + +cat("\nTarget Columns:\n") +cat(" Expected: 18 columns\n") +cat(" Found:", length(existing_targets), "columns\n") +cat(" Missing:", length(missing_targets), "columns\n") + +if (length(missing_targets) > 0) { + cat("\n Target columns do NOT exist yet - will create them.\n") + if (length(existing_targets) > 0) { + cat(" WARNING: Some target columns already exist and will be overwritten.\n") + } +} else { + cat(" All target columns exist - will overwrite with calculated values.\n") +} + +cat("\n=== END CHECK ===\n\n") + +# Stop if critical columns are missing +if (length(missing_source) > 45) { + stop("ERROR: Too many source columns missing! Please check column names in CSV file.") +} + +cat("Proceeding with processing...\n\n") + +# ============= CALCULATE DOMAIN MEANS ============= +cat("Calculating domain means for time interval differences...\n") + +# Convert source columns to numeric +for (col in source_cols) { + if (col %in% names(df)) { + df[[col]] <- as.numeric(df[[col]]) + } +} + +# Calculate means for each time interval × domain combination +for (time_prefix in time_prefixes) { + # Preferences mean + pref_cols <- paste0(time_prefix, "_", items[pref_indices]) + existing_pref_cols <- pref_cols[pref_cols %in% names(df)] + if (length(existing_pref_cols) > 0) { + df[[paste0(time_prefix, "_pref_MEAN")]] <- rowMeans(df[, existing_pref_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pref_MEAN"), "\n") + } + + # Personality mean + pers_cols <- paste0(time_prefix, "_", items[pers_indices]) + existing_pers_cols <- pers_cols[pers_cols %in% names(df)] + if (length(existing_pers_cols) > 0) { + df[[paste0(time_prefix, "_pers_MEAN")]] <- rowMeans(df[, existing_pers_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_pers_MEAN"), "\n") + } + + # Values mean + val_cols <- paste0(time_prefix, "_", items[val_indices]) + existing_val_cols <- val_cols[val_cols %in% names(df)] + if (length(existing_val_cols) > 0) { + df[[paste0(time_prefix, "_val_MEAN")]] <- rowMeans(df[, existing_val_cols, drop = FALSE], na.rm = TRUE) + cat(" Processed:", paste0(time_prefix, "_val_MEAN"), "\n") + } +} + +cat("\n=== CALCULATION COMPLETE ===\n") +cat(" 18 domain mean columns created.\n\n") + + +# ============= QUALITY ASSURANCE: RANDOM ROW & TIME INTERVAL CHECK ============= +# This function can be run multiple times to check different random rows and time intervals + +qa_check_random_row <- function(row_num = NULL, time_interval_num = NULL) { + # Pick a random row or use specified row + if (is.null(row_num)) { + random_row <- sample(seq_len(nrow(df)), 1) + cat("\n========================================\n") + cat("QA CHECK: Random Row #", random_row, "\n") + } else { + if (row_num < 1 || row_num > nrow(df)) { + cat("ERROR: Row number must be between 1 and", nrow(df), "\n") + return() + } + random_row <- row_num + cat("\n========================================\n") + cat("QA CHECK: Specified Row #", random_row, "\n") + } + + # Pick a random time interval or use specified interval + if (is.null(time_interval_num)) { + test_interval_idx <- sample(1:6, 1) + cat("Random Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } else { + if (time_interval_num < 1 || time_interval_num > 6) { + cat("ERROR: Time interval number must be between 1 and 6\n") + cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5, 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") + return() + } + test_interval_idx <- time_interval_num + cat("Specified Time Interval #", test_interval_idx, ": ", time_prefixes[test_interval_idx], "\n") + } + + cat("========================================\n\n") + + time_prefix <- time_prefixes[test_interval_idx] + + # Check each of the 3 domains + for (domain_idx in 1:3) { + domain_name <- domain_names[domain_idx] + + # Get the appropriate item indices + if (domain_idx == 1) { + item_indices <- pref_indices + domain_label <- "Preferences" + } else if (domain_idx == 2) { + item_indices <- pers_indices + domain_label <- "Personality" + } else { + item_indices <- val_indices + domain_label <- "Values" + } + + cat(sprintf("--- %s: %s ---\n", time_prefix, domain_label)) + + # Get source column names + source_cols_domain <- paste0(time_prefix, "_", items[item_indices]) + target_col <- paste0(time_prefix, "_", domain_name, "_MEAN") + + # Get values + values <- numeric(5) + cat("Source values:\n") + for (i in 1:5) { + col <- source_cols_domain[i] + val <- if (col %in% names(df)) df[random_row, col] else NA + values[i] <- val + cat(sprintf(" %s: %s\n", col, ifelse(is.na(val), "NA", sprintf("%.5f", val)))) + } + + # Calculate expected mean + valid_values <- values[!is.na(values)] + if (length(valid_values) > 0) { + expected_mean <- mean(valid_values) + actual_value <- df[random_row, target_col] + + cat(sprintf("\nCalculation:\n")) + cat(sprintf(" Sum: %s = %.5f\n", + paste(sprintf("%.5f", valid_values), collapse = " + "), + sum(valid_values))) + cat(sprintf(" Average of %d values: %.5f\n", length(valid_values), expected_mean)) + cat(sprintf(" Target (%s): %.5f\n", target_col, actual_value)) + cat(sprintf(" Match: %s\n", ifelse(abs(expected_mean - actual_value) < 0.0001, "YES ✓", "NO ✗"))) + } else { + cat(" No valid values to calculate mean.\n") + } + cat("\n") + } + + cat("========================================\n") + cat("END QA CHECK\n") + cat("========================================\n\n") +} + +# Run QA check on random row and random time interval +cat("\n\n") +qa_check_random_row() # Leave blank for random row & interval; specify parameters as needed (see examples below) + +# Instructions for running additional checks +cat("\n") +cat("*** TO CHECK ANOTHER ROW/TIME INTERVAL ***\n") +cat("For random row AND random time interval, run:\n") +cat(" qa_check_random_row()\n") +cat("\nFor specific row (e.g., row 118) with random interval:\n") +cat(" qa_check_random_row(118)\n") +cat("\nFor random row with specific interval (e.g., 3 = NFut_5):\n") +cat(" qa_check_random_row(time_interval_num = 3)\n") +cat("\nFor specific row AND specific interval:\n") +cat(" qa_check_random_row(118, 3)\n") +cat("\n") +cat("Time Interval Numbers:\n") +cat(" 1 = NPast_5, 2 = NPast_10, 3 = NFut_5\n") +cat(" 4 = NFut_10, 5 = X5.10past, 6 = X5.10fut\n") +cat("\n") + + +# Save the modified dataframe back to CSV +# na="" writes NA values as empty cells instead of "NA" text +# COMMENTED OUT FOR REVIEW - Uncomment when ready to save +write.csv(df, "eohi2.csv", row.names = FALSE, na = "") + +cat("\n*** WRITE TO FILE IS COMMENTED OUT ***\n") +cat("Review the output above, then uncomment line 234 to save changes.\n") +cat("\nProcessing complete! 18 domain mean columns calculated (not yet saved to file).\n") diff --git a/eohi2/dataP 08 - DGEN 510 vars.r b/eohi2/dataP 08 - DGEN 510 vars.r new file mode 100644 index 0000000..d50239d --- /dev/null +++ b/eohi2/dataP 08 - DGEN 510 vars.r @@ -0,0 +1,95 @@ +# Script 08: Create 5_10 DGEN Variables +# PURPOSE: Calculate absolute differences between 5-year and 10-year DGEN ratings +# for both Past and Future directions +# VARIABLES CREATED: 6 total (3 domains × 2 time directions) + +library(tidyverse) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify source columns exist +source_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val") + +missing_vars <- source_vars[!source_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + stop(paste("ERROR: Missing source variables:", paste(missing_vars, collapse = ", "))) +} + +print("All source DGEN variables found!") + +# Calculate 5_10 DGEN variables (absolute differences between 5-year and 10-year) +# Formula: |DGEN_5 - DGEN_10| +# NOTE: Using X prefix because R adds it to column names starting with numbers + +# PAST direction +data$X5_10DGEN_past_pref <- abs(data$DGEN_past_5_Pref - data$DGEN_past_10_Pref) +data$X5_10DGEN_past_pers <- abs(data$DGEN_past_5_Pers - data$DGEN_past_10_Pers) +data$X5_10DGEN_past_val <- abs(data$DGEN_past_5_Val - data$DGEN_past_10_Val) + +# FUTURE direction +data$X5_10DGEN_fut_pref <- abs(data$DGEN_fut_5_Pref - data$DGEN_fut_10_Pref) +data$X5_10DGEN_fut_pers <- abs(data$DGEN_fut_5_Pers - data$DGEN_fut_10_Pers) +data$X5_10DGEN_fut_val <- abs(data$DGEN_fut_5_Val - data$DGEN_fut_10_Val) + +# Verify variables were created +target_vars <- c("X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +print("\n=== VARIABLES CREATED ===") +print(target_vars) + +# Check for missing values +for(var in target_vars) { + n_missing <- sum(is.na(data[[var]])) + pct_missing <- round(100 * n_missing / nrow(data), 2) + print(sprintf("%s: %d missing (%.2f%%)", var, n_missing, pct_missing)) +} + +# Quality check: Display sample rows +print("\n=== QUALITY CHECK: Sample Calculations ===") +sample_rows <- sample(1:nrow(data), min(5, nrow(data))) + +for(i in sample_rows) { + print(sprintf("\nRow %d:", i)) + print(sprintf(" DGEN_past_5_Pref = %.2f, DGEN_past_10_Pref = %.2f", + data$DGEN_past_5_Pref[i], data$DGEN_past_10_Pref[i])) + print(sprintf(" → X5_10DGEN_past_pref = %.2f (expected: %.2f)", + data$X5_10DGEN_past_pref[i], + abs(data$DGEN_past_5_Pref[i] - data$DGEN_past_10_Pref[i]))) + + print(sprintf(" DGEN_fut_5_Pers = %.2f, DGEN_fut_10_Pers = %.2f", + data$DGEN_fut_5_Pers[i], data$DGEN_fut_10_Pers[i])) + print(sprintf(" → X5_10DGEN_fut_pers = %.2f (expected: %.2f)", + data$X5_10DGEN_fut_pers[i], + abs(data$DGEN_fut_5_Pers[i] - data$DGEN_fut_10_Pers[i]))) +} + +# Descriptive statistics +print("\n=== DESCRIPTIVE STATISTICS ===") +desc_stats <- data %>% + summarise(across(all_of(target_vars), + list(n = ~sum(!is.na(.)), + mean = ~round(mean(., na.rm = TRUE), 5), + sd = ~round(sd(., na.rm = TRUE), 5), + min = ~round(min(., na.rm = TRUE), 5), + max = ~round(max(., na.rm = TRUE), 5)), + .names = "{.col}_{.fn}")) + +print(t(desc_stats)) + +# Save to CSV +write.csv(data, "eohi2.csv", row.names = FALSE) + +print("\n=== PROCESSING COMPLETE ===") +print("Data saved to eohi2.csv") +print(paste("Total columns now:", ncol(data))) + diff --git a/eohi2/dataP 09 - interval x direction means.r b/eohi2/dataP 09 - interval x direction means.r new file mode 100644 index 0000000..6bd02b7 --- /dev/null +++ b/eohi2/dataP 09 - interval x direction means.r @@ -0,0 +1,223 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: NPast_5_mean (15 variables) +data$NPast_5_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" +)], na.rm = TRUE) + +# Set 2: NPast_10_mean (15 variables) +data$NPast_10_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 3: NFut_5_mean (15 variables) +data$NFut_5_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 4: NFut_10_mean (15 variables) +data$NFut_10_mean <- rowMeans(data[, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 5: X5.10past_mean (15 variables) +data$X5.10past_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" +)], na.rm = TRUE) + +# Set 6: X5.10fut_mean (15 variables) +data$X5.10fut_mean <- rowMeans(data[, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 7: NPast_global_mean (30 variables - NPast_5 + NPast_10) +data$NPast_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" +)], na.rm = TRUE) + +# Set 8: NFut_global_mean (30 variables - NFut_5 + NFut_10) +data$NFut_global_mean <- rowMeans(data[, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Set 9: X5.10_global_mean (30 variables - X5.10past + X5.10fut) +data$X5.10_global_mean <- rowMeans(data[, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" +)], na.rm = TRUE) + +# Set 10: N5_global_mean (30 variables - NPast_5 + NFut_5) +data$N5_global_mean <- rowMeans(data[, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" +)], na.rm = TRUE) + +# Set 11: N10_global_mean (30 variables - NPast_10 + NFut_10) +data$N10_global_mean <- rowMeans(data[, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: NPast_5_mean + calc1 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice" + )]), na.rm = TRUE) + cat("NPast_5_mean: Calculated =", calc1, "| Stored =", data$NPast_5_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$NPast_5_mean[i])), "\n") + + # Set 2: NPast_10_mean + calc2 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_10_mean: Calculated =", calc2, "| Stored =", data$NPast_10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$NPast_10_mean[i])), "\n") + + # Set 3: NFut_5_mean + calc3 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("NFut_5_mean: Calculated =", calc3, "| Stored =", data$NFut_5_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$NFut_5_mean[i])), "\n") + + # Set 4: NFut_10_mean + calc4 <- mean(as.numeric(data[i, c( + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_10_mean: Calculated =", calc4, "| Stored =", data$NFut_10_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$NFut_10_mean[i])), "\n") + + # Set 5: X5.10past_mean + calc5 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice" + )]), na.rm = TRUE) + cat("X5.10past_mean: Calculated =", calc5, "| Stored =", data$X5.10past_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$X5.10past_mean[i])), "\n") + + # Set 6: X5.10fut_mean + calc6 <- mean(as.numeric(data[i, c( + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10fut_mean: Calculated =", calc6, "| Stored =", data$X5.10fut_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$X5.10fut_mean[i])), "\n") + + # Set 7: NPast_global_mean + calc7 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice" + )]), na.rm = TRUE) + cat("NPast_global_mean: Calculated =", calc7, "| Stored =", data$NPast_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$NPast_global_mean[i])), "\n") + + # Set 8: NFut_global_mean + calc8 <- mean(as.numeric(data[i, c( + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("NFut_global_mean: Calculated =", calc8, "| Stored =", data$NFut_global_mean[i], + "| Match:", isTRUE(all.equal(calc8, data$NFut_global_mean[i])), "\n") + + # Set 9: X5.10_global_mean + calc9 <- mean(as.numeric(data[i, c( + "X5.10past_pref_read", "X5.10past_pref_music", "X5.10past_pref_TV", "X5.10past_pref_nap", "X5.10past_pref_travel", + "X5.10past_pers_extravert", "X5.10past_pers_critical", "X5.10past_pers_dependable", "X5.10past_pers_anxious", "X5.10past_pers_complex", + "X5.10past_val_obey", "X5.10past_val_trad", "X5.10past_val_opinion", "X5.10past_val_performance", "X5.10past_val_justice", + "X5.10fut_pref_read", "X5.10fut_pref_music", "X5.10fut_pref_TV", "X5.10fut_pref_nap", "X5.10fut_pref_travel", + "X5.10fut_pers_extravert", "X5.10fut_pers_critical", "X5.10fut_pers_dependable", "X5.10fut_pers_anxious", "X5.10fut_pers_complex", + "X5.10fut_val_obey", "X5.10fut_val_trad", "X5.10fut_val_opinion", "X5.10fut_val_performance", "X5.10fut_val_justice" + )]), na.rm = TRUE) + cat("X5.10_global_mean: Calculated =", calc9, "| Stored =", data$X5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc9, data$X5.10_global_mean[i])), "\n") + + # Set 10: N5_global_mean + calc10 <- mean(as.numeric(data[i, c( + "NPast_5_pref_read", "NPast_5_pref_music", "NPast_5_pref_TV", "NPast_5_pref_nap", "NPast_5_pref_travel", + "NPast_5_pers_extravert", "NPast_5_pers_critical", "NPast_5_pers_dependable", "NPast_5_pers_anxious", "NPast_5_pers_complex", + "NPast_5_val_obey", "NPast_5_val_trad", "NPast_5_val_opinion", "NPast_5_val_performance", "NPast_5_val_justice", + "NFut_5_pref_read", "NFut_5_pref_music", "NFut_5_pref_TV", "NFut_5_pref_nap", "NFut_5_pref_travel", + "NFut_5_pers_extravert", "NFut_5_pers_critical", "NFut_5_pers_dependable", "NFut_5_pers_anxious", "NFut_5_pers_complex", + "NFut_5_val_obey", "NFut_5_val_trad", "NFut_5_val_opinion", "NFut_5_val_performance", "NFut_5_val_justice" + )]), na.rm = TRUE) + cat("N5_global_mean: Calculated =", calc10, "| Stored =", data$N5_global_mean[i], + "| Match:", isTRUE(all.equal(calc10, data$N5_global_mean[i])), "\n") + + # Set 11: N10_global_mean + calc11 <- mean(as.numeric(data[i, c( + "NPast_10_pref_read", "NPast_10_pref_music", "NPast_10_pref_TV", "NPast_10_pref_nap", "NPast_10_pref_travel", + "NPast_10_pers_extravert", "NPast_10_pers_critical", "NPast_10_pers_dependable", "NPast_10_pers_anxious", "NPast_10_pers_complex", + "NPast_10_val_obey", "NPast_10_val_trad", "NPast_10_val_opinion", "NPast_10_val_performance", "NPast_10_val_justice", + "NFut_10_pref_read", "NFut_10_pref_music", "NFut_10_pref_TV", "NFut_10_pref_nap", "NFut_10_pref_travel", + "NFut_10_pers_extravert", "NFut_10_pers_critical", "NFut_10_pers_dependable", "NFut_10_pers_anxious", "NFut_10_pers_complex", + "NFut_10_val_obey", "NFut_10_val_trad", "NFut_10_val_opinion", "NFut_10_val_performance", "NFut_10_val_justice" + )]), na.rm = TRUE) + cat("N10_global_mean: Calculated =", calc11, "| Stored =", data$N10_global_mean[i], + "| Match:", isTRUE(all.equal(calc11, data$N10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/eohi2/dataP 10 - DGEN mean vars.r b/eohi2/dataP 10 - DGEN mean vars.r new file mode 100644 index 0000000..2e5647b --- /dev/null +++ b/eohi2/dataP 10 - DGEN mean vars.r @@ -0,0 +1,115 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Set 1: DGEN_past_5.10_mean (3 variables) +data$DGEN_past_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 2: DGEN_fut_5.10_mean (3 variables) +data$DGEN_fut_5.10_mean <- rowMeans(data[, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 3: DGENpast_global_mean (9 variables) +data$DGENpast_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" +)], na.rm = TRUE) + +# Set 4: DGENfut_global_mean (9 variables) +data$DGENfut_global_mean <- rowMeans(data[, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Set 5: DGEN_5_global_mean (6 variables) +data$DGEN_5_global_mean <- rowMeans(data[, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" +)], na.rm = TRUE) + +# Set 6: DGEN_10_global_mean (6 variables) +data$DGEN_10_global_mean <- rowMeans(data[, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" +)], na.rm = TRUE) + +# Set 7: DGEN_5.10_global_mean (6 variables) +data$DGEN_5.10_global_mean <- rowMeans(data[, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" +)], na.rm = TRUE) + +# Save the data +write.csv(data, "eohi2.csv", row.names = FALSE) + +# ===== QA CODE: Check first 5 rows ===== +cat("\n=== QUALITY ASSURANCE: Checking calculations for first 5 rows ===\n\n") + +for (i in 1:min(5, nrow(data))) { + cat("--- Row", i, "---\n") + + # Set 1: DGEN_past_5.10_mean + calc1 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGEN_past_5.10_mean: Calculated =", calc1, "| Stored =", data$DGEN_past_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc1, data$DGEN_past_5.10_mean[i])), "\n") + + # Set 2: DGEN_fut_5.10_mean + calc2 <- mean(as.numeric(data[i, c( + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_fut_5.10_mean: Calculated =", calc2, "| Stored =", data$DGEN_fut_5.10_mean[i], + "| Match:", isTRUE(all.equal(calc2, data$DGEN_fut_5.10_mean[i])), "\n") + + # Set 3: DGENpast_global_mean + calc3 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_10_Pref", "X5_10DGEN_past_pref", + "DGEN_past_5_Pers", "DGEN_past_10_Pers", "X5_10DGEN_past_pers", + "DGEN_past_5_Val", "DGEN_past_10_Val", "X5_10DGEN_past_val" + )]), na.rm = TRUE) + cat("DGENpast_global_mean: Calculated =", calc3, "| Stored =", data$DGENpast_global_mean[i], + "| Match:", isTRUE(all.equal(calc3, data$DGENpast_global_mean[i])), "\n") + + # Set 4: DGENfut_global_mean + calc4 <- mean(as.numeric(data[i, c( + "DGEN_fut_5_Pref", "DGEN_fut_10_Pref", "X5_10DGEN_fut_pref", + "DGEN_fut_5_Pers", "DGEN_fut_10_Pers", "X5_10DGEN_fut_pers", + "DGEN_fut_5_Val", "DGEN_fut_10_Val", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGENfut_global_mean: Calculated =", calc4, "| Stored =", data$DGENfut_global_mean[i], + "| Match:", isTRUE(all.equal(calc4, data$DGENfut_global_mean[i])), "\n") + + # Set 5: DGEN_5_global_mean + calc5 <- mean(as.numeric(data[i, c( + "DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val" + )]), na.rm = TRUE) + cat("DGEN_5_global_mean: Calculated =", calc5, "| Stored =", data$DGEN_5_global_mean[i], + "| Match:", isTRUE(all.equal(calc5, data$DGEN_5_global_mean[i])), "\n") + + # Set 6: DGEN_10_global_mean + calc6 <- mean(as.numeric(data[i, c( + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val" + )]), na.rm = TRUE) + cat("DGEN_10_global_mean: Calculated =", calc6, "| Stored =", data$DGEN_10_global_mean[i], + "| Match:", isTRUE(all.equal(calc6, data$DGEN_10_global_mean[i])), "\n") + + # Set 7: DGEN_5.10_global_mean + calc7 <- mean(as.numeric(data[i, c( + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val" + )]), na.rm = TRUE) + cat("DGEN_5.10_global_mean: Calculated =", calc7, "| Stored =", data$DGEN_5.10_global_mean[i], + "| Match:", isTRUE(all.equal(calc7, data$DGEN_5.10_global_mean[i])), "\n\n") +} + +cat("=== QA CHECK COMPLETE ===\n") diff --git a/eohi2/dataP 11 - CORRECT ehi vars.r b/eohi2/dataP 11 - CORRECT ehi vars.r new file mode 100644 index 0000000..96e4994 --- /dev/null +++ b/eohi2/dataP 11 - CORRECT ehi vars.r @@ -0,0 +1,235 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create EHI difference variables (NPast - NFut) for different time intervals + +# === 5-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi5_pref_read <- data$NPast_5_pref_read - data$NFut_5_pref_read +data$ehi5_pref_music <- data$NPast_5_pref_music - data$NFut_5_pref_music +data$ehi5_pref_TV <- data$NPast_5_pref_TV - data$NFut_5_pref_TV +data$ehi5_pref_nap <- data$NPast_5_pref_nap - data$NFut_5_pref_nap +data$ehi5_pref_travel <- data$NPast_5_pref_travel - data$NFut_5_pref_travel + +# Personality +data$ehi5_pers_extravert <- data$NPast_5_pers_extravert - data$NFut_5_pers_extravert +data$ehi5_pers_critical <- data$NPast_5_pers_critical - data$NFut_5_pers_critical +data$ehi5_pers_dependable <- data$NPast_5_pers_dependable - data$NFut_5_pers_dependable +data$ehi5_pers_anxious <- data$NPast_5_pers_anxious - data$NFut_5_pers_anxious +data$ehi5_pers_complex <- data$NPast_5_pers_complex - data$NFut_5_pers_complex + +# Values +data$ehi5_val_obey <- data$NPast_5_val_obey - data$NFut_5_val_obey +data$ehi5_val_trad <- data$NPast_5_val_trad - data$NFut_5_val_trad +data$ehi5_val_opinion <- data$NPast_5_val_opinion - data$NFut_5_val_opinion +data$ehi5_val_performance <- data$NPast_5_val_performance - data$NFut_5_val_performance +data$ehi5_val_justice <- data$NPast_5_val_justice - data$NFut_5_val_justice + +# === 10-YEAR PAST-FUTURE PAIRS === +# Preferences +data$ehi10_pref_read <- data$NPast_10_pref_read - data$NFut_10_pref_read +data$ehi10_pref_music <- data$NPast_10_pref_music - data$NFut_10_pref_music +data$ehi10_pref_TV <- data$NPast_10_pref_TV - data$NFut_10_pref_TV +data$ehi10_pref_nap <- data$NPast_10_pref_nap - data$NFut_10_pref_nap +data$ehi10_pref_travel <- data$NPast_10_pref_travel - data$NFut_10_pref_travel + +# Personality +data$ehi10_pers_extravert <- data$NPast_10_pers_extravert - data$NFut_10_pers_extravert +data$ehi10_pers_critical <- data$NPast_10_pers_critical - data$NFut_10_pers_critical +data$ehi10_pers_dependable <- data$NPast_10_pers_dependable - data$NFut_10_pers_dependable +data$ehi10_pers_anxious <- data$NPast_10_pers_anxious - data$NFut_10_pers_anxious +data$ehi10_pers_complex <- data$NPast_10_pers_complex - data$NFut_10_pers_complex + +# Values +data$ehi10_val_obey <- data$NPast_10_val_obey - data$NFut_10_val_obey +data$ehi10_val_trad <- data$NPast_10_val_trad - data$NFut_10_val_trad +data$ehi10_val_opinion <- data$NPast_10_val_opinion - data$NFut_10_val_opinion +data$ehi10_val_performance <- data$NPast_10_val_performance - data$NFut_10_val_performance +data$ehi10_val_justice <- data$NPast_10_val_justice - data$NFut_10_val_justice + +# === 5-10 YEAR CHANGE VARIABLES === +# Preferences +data$ehi5.10_pref_read <- data$X5.10past_pref_read - data$X5.10fut_pref_read +data$ehi5.10_pref_music <- data$X5.10past_pref_music - data$X5.10fut_pref_music +data$ehi5.10_pref_TV <- data$X5.10past_pref_TV - data$X5.10fut_pref_TV +data$ehi5.10_pref_nap <- data$X5.10past_pref_nap - data$X5.10fut_pref_nap +data$ehi5.10_pref_travel <- data$X5.10past_pref_travel - data$X5.10fut_pref_travel + +# Personality +data$ehi5.10_pers_extravert <- data$X5.10past_pers_extravert - data$X5.10fut_pers_extravert +data$ehi5.10_pers_critical <- data$X5.10past_pers_critical - data$X5.10fut_pers_critical +data$ehi5.10_pers_dependable <- data$X5.10past_pers_dependable - data$X5.10fut_pers_dependable +data$ehi5.10_pers_anxious <- data$X5.10past_pers_anxious - data$X5.10fut_pers_anxious +data$ehi5.10_pers_complex <- data$X5.10past_pers_complex - data$X5.10fut_pers_complex + +# Values +data$ehi5.10_val_obey <- data$X5.10past_val_obey - data$X5.10fut_val_obey +data$ehi5.10_val_trad <- data$X5.10past_val_trad - data$X5.10fut_val_trad +data$ehi5.10_val_opinion <- data$X5.10past_val_opinion - data$X5.10fut_val_opinion +data$ehi5.10_val_performance <- data$X5.10past_val_performance - data$X5.10fut_val_performance +data$ehi5.10_val_justice <- data$X5.10past_val_justice - data$X5.10fut_val_justice + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5_pref_read = %g %s\n", + data$NPast_5_pref_read[i], data$NFut_5_pref_read[i], + data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i], + data$ehi5_pref_read[i], + ifelse(abs((data$NPast_5_pref_read[i] - data$NFut_5_pref_read[i]) - data$ehi5_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5_pref_music = %g %s\n", + data$NPast_5_pref_music[i], data$NFut_5_pref_music[i], + data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i], + data$ehi5_pref_music[i], + ifelse(abs((data$NPast_5_pref_music[i] - data$NFut_5_pref_music[i]) - data$ehi5_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5_pers_extravert = %g %s\n", + data$NPast_5_pers_extravert[i], data$NFut_5_pers_extravert[i], + data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i], + data$ehi5_pers_extravert[i], + ifelse(abs((data$NPast_5_pers_extravert[i] - data$NFut_5_pers_extravert[i]) - data$ehi5_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi10_pref_read = %g %s\n", + data$NPast_10_pref_read[i], data$NFut_10_pref_read[i], + data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i], + data$ehi10_pref_read[i], + ifelse(abs((data$NPast_10_pref_read[i] - data$NFut_10_pref_read[i]) - data$ehi10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi10_pref_music = %g %s\n", + data$NPast_10_pref_music[i], data$NFut_10_pref_music[i], + data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i], + data$ehi10_pref_music[i], + ifelse(abs((data$NPast_10_pref_music[i] - data$NFut_10_pref_music[i]) - data$ehi10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi10_pers_extravert = %g %s\n", + data$NPast_10_pers_extravert[i], data$NFut_10_pers_extravert[i], + data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i], + data$ehi10_pers_extravert[i], + ifelse(abs((data$NPast_10_pers_extravert[i] - data$NFut_10_pers_extravert[i]) - data$ehi10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 5-10 YEAR CHANGE VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" pref_read: %g - %g = %g | ehi5.10_pref_read = %g %s\n", + data$X5.10past_pref_read[i], data$X5.10fut_pref_read[i], + data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i], + data$ehi5.10_pref_read[i], + ifelse(abs((data$X5.10past_pref_read[i] - data$X5.10fut_pref_read[i]) - data$ehi5.10_pref_read[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pref_music: %g - %g = %g | ehi5.10_pref_music = %g %s\n", + data$X5.10past_pref_music[i], data$X5.10fut_pref_music[i], + data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i], + data$ehi5.10_pref_music[i], + ifelse(abs((data$X5.10past_pref_music[i] - data$X5.10fut_pref_music[i]) - data$ehi5.10_pref_music[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" pers_extravert: %g - %g = %g | ehi5.10_pers_extravert = %g %s\n", + data$X5.10past_pers_extravert[i], data$X5.10fut_pers_extravert[i], + data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i], + data$ehi5.10_pers_extravert[i], + ifelse(abs((data$X5.10past_pers_extravert[i] - data$X5.10fut_pers_extravert[i]) - data$ehi5.10_pers_extravert[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year pairs + list(npast = "NPast_5_pref_read", nfut = "NFut_5_pref_read", target = "ehi5_pref_read"), + list(npast = "NPast_5_pref_music", nfut = "NFut_5_pref_music", target = "ehi5_pref_music"), + list(npast = "NPast_5_pref_TV", nfut = "NFut_5_pref_TV", target = "ehi5_pref_TV"), + list(npast = "NPast_5_pref_nap", nfut = "NFut_5_pref_nap", target = "ehi5_pref_nap"), + list(npast = "NPast_5_pref_travel", nfut = "NFut_5_pref_travel", target = "ehi5_pref_travel"), + list(npast = "NPast_5_pers_extravert", nfut = "NFut_5_pers_extravert", target = "ehi5_pers_extravert"), + list(npast = "NPast_5_pers_critical", nfut = "NFut_5_pers_critical", target = "ehi5_pers_critical"), + list(npast = "NPast_5_pers_dependable", nfut = "NFut_5_pers_dependable", target = "ehi5_pers_dependable"), + list(npast = "NPast_5_pers_anxious", nfut = "NFut_5_pers_anxious", target = "ehi5_pers_anxious"), + list(npast = "NPast_5_pers_complex", nfut = "NFut_5_pers_complex", target = "ehi5_pers_complex"), + list(npast = "NPast_5_val_obey", nfut = "NFut_5_val_obey", target = "ehi5_val_obey"), + list(npast = "NPast_5_val_trad", nfut = "NFut_5_val_trad", target = "ehi5_val_trad"), + list(npast = "NPast_5_val_opinion", nfut = "NFut_5_val_opinion", target = "ehi5_val_opinion"), + list(npast = "NPast_5_val_performance", nfut = "NFut_5_val_performance", target = "ehi5_val_performance"), + list(npast = "NPast_5_val_justice", nfut = "NFut_5_val_justice", target = "ehi5_val_justice"), + + # 10-year pairs + list(npast = "NPast_10_pref_read", nfut = "NFut_10_pref_read", target = "ehi10_pref_read"), + list(npast = "NPast_10_pref_music", nfut = "NFut_10_pref_music", target = "ehi10_pref_music"), + list(npast = "NPast_10_pref_TV", nfut = "NFut_10_pref_TV", target = "ehi10_pref_TV"), + list(npast = "NPast_10_pref_nap", nfut = "NFut_10_pref_nap", target = "ehi10_pref_nap"), + list(npast = "NPast_10_pref_travel", nfut = "NFut_10_pref_travel", target = "ehi10_pref_travel"), + list(npast = "NPast_10_pers_extravert", nfut = "NFut_10_pers_extravert", target = "ehi10_pers_extravert"), + list(npast = "NPast_10_pers_critical", nfut = "NFut_10_pers_critical", target = "ehi10_pers_critical"), + list(npast = "NPast_10_pers_dependable", nfut = "NFut_10_pers_dependable", target = "ehi10_pers_dependable"), + list(npast = "NPast_10_pers_anxious", nfut = "NFut_10_pers_anxious", target = "ehi10_pers_anxious"), + list(npast = "NPast_10_pers_complex", nfut = "NFut_10_pers_complex", target = "ehi10_pers_complex"), + list(npast = "NPast_10_val_obey", nfut = "NFut_10_val_obey", target = "ehi10_val_obey"), + list(npast = "NPast_10_val_trad", nfut = "NFut_10_val_trad", target = "ehi10_val_trad"), + list(npast = "NPast_10_val_opinion", nfut = "NFut_10_val_opinion", target = "ehi10_val_opinion"), + list(npast = "NPast_10_val_performance", nfut = "NFut_10_val_performance", target = "ehi10_val_performance"), + list(npast = "NPast_10_val_justice", nfut = "NFut_10_val_justice", target = "ehi10_val_justice"), + + # 5-10 year change pairs + list(npast = "X5.10past_pref_read", nfut = "X5.10fut_pref_read", target = "ehi5.10_pref_read"), + list(npast = "X5.10past_pref_music", nfut = "X5.10fut_pref_music", target = "ehi5.10_pref_music"), + list(npast = "X5.10past_pref_TV", nfut = "X5.10fut_pref_TV", target = "ehi5.10_pref_TV"), + list(npast = "X5.10past_pref_nap", nfut = "X5.10fut_pref_nap", target = "ehi5.10_pref_nap"), + list(npast = "X5.10past_pref_travel", nfut = "X5.10fut_pref_travel", target = "ehi5.10_pref_travel"), + list(npast = "X5.10past_pers_extravert", nfut = "X5.10fut_pers_extravert", target = "ehi5.10_pers_extravert"), + list(npast = "X5.10past_pers_critical", nfut = "X5.10fut_pers_critical", target = "ehi5.10_pers_critical"), + list(npast = "X5.10past_pers_dependable", nfut = "X5.10fut_pers_dependable", target = "ehi5.10_pers_dependable"), + list(npast = "X5.10past_pers_anxious", nfut = "X5.10fut_pers_anxious", target = "ehi5.10_pers_anxious"), + list(npast = "X5.10past_pers_complex", nfut = "X5.10fut_pers_complex", target = "ehi5.10_pers_complex"), + list(npast = "X5.10past_val_obey", nfut = "X5.10fut_val_obey", target = "ehi5.10_val_obey"), + list(npast = "X5.10past_val_trad", nfut = "X5.10fut_val_trad", target = "ehi5.10_val_trad"), + list(npast = "X5.10past_val_opinion", nfut = "X5.10fut_val_opinion", target = "ehi5.10_val_opinion"), + list(npast = "X5.10past_val_performance", nfut = "X5.10fut_val_performance", target = "ehi5.10_val_performance"), + list(npast = "X5.10past_val_justice", nfut = "X5.10fut_val_justice", target = "ehi5.10_val_justice") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/eohi2/datap 12 - CORRECT DGEN ehi vars.r b/eohi2/datap 12 - CORRECT DGEN ehi vars.r new file mode 100644 index 0000000..5274cdd --- /dev/null +++ b/eohi2/datap 12 - CORRECT DGEN ehi vars.r @@ -0,0 +1,118 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Create DGEN EHI difference variables (Past - Future) for different time intervals + +# === 5-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_5_Pref <- data$DGEN_past_5_Pref - data$DGEN_fut_5_Pref +data$ehiDGEN_5_Pers <- data$DGEN_past_5_Pers - data$DGEN_fut_5_Pers +data$ehiDGEN_5_Val <- data$DGEN_past_5_Val - data$DGEN_fut_5_Val + +# === 10-YEAR DGEN PAST-FUTURE PAIRS === +data$ehiDGEN_10_Pref <- data$DGEN_past_10_Pref - data$DGEN_fut_10_Pref +data$ehiDGEN_10_Pers <- data$DGEN_past_10_Pers - data$DGEN_fut_10_Pers +data$ehiDGEN_10_Val <- data$DGEN_past_10_Val - data$DGEN_fut_10_Val + +# QA: Verify calculations - FIRST 5 ROWS with detailed output +cat("\n=== QUALITY ASSURANCE CHECK - FIRST 5 ROWS ===\n\n") + +cat("--- 5-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_5_Pref = %g %s\n", + data$DGEN_past_5_Pref[i], data$DGEN_fut_5_Pref[i], + data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i], + data$ehiDGEN_5_Pref[i], + ifelse(abs((data$DGEN_past_5_Pref[i] - data$DGEN_fut_5_Pref[i]) - data$ehiDGEN_5_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_5_Pers = %g %s\n", + data$DGEN_past_5_Pers[i], data$DGEN_fut_5_Pers[i], + data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i], + data$ehiDGEN_5_Pers[i], + ifelse(abs((data$DGEN_past_5_Pers[i] - data$DGEN_fut_5_Pers[i]) - data$ehiDGEN_5_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_5_Val = %g %s\n", + data$DGEN_past_5_Val[i], data$DGEN_fut_5_Val[i], + data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i], + data$ehiDGEN_5_Val[i], + ifelse(abs((data$DGEN_past_5_Val[i] - data$DGEN_fut_5_Val[i]) - data$ehiDGEN_5_Val[i]) < 1e-10, "✓", "✗"))) +} + +cat("\n--- 10-YEAR DGEN VARIABLES ---\n") +for (i in 1:5) { + cat(sprintf("\nRow %d:\n", i)) + cat(sprintf(" Pref: %g - %g = %g | ehiDGEN_10_Pref = %g %s\n", + data$DGEN_past_10_Pref[i], data$DGEN_fut_10_Pref[i], + data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i], + data$ehiDGEN_10_Pref[i], + ifelse(abs((data$DGEN_past_10_Pref[i] - data$DGEN_fut_10_Pref[i]) - data$ehiDGEN_10_Pref[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Pers: %g - %g = %g | ehiDGEN_10_Pers = %g %s\n", + data$DGEN_past_10_Pers[i], data$DGEN_fut_10_Pers[i], + data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i], + data$ehiDGEN_10_Pers[i], + ifelse(abs((data$DGEN_past_10_Pers[i] - data$DGEN_fut_10_Pers[i]) - data$ehiDGEN_10_Pers[i]) < 1e-10, "✓", "✗"))) + cat(sprintf(" Val: %g - %g = %g | ehiDGEN_10_Val = %g %s\n", + data$DGEN_past_10_Val[i], data$DGEN_fut_10_Val[i], + data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i], + data$ehiDGEN_10_Val[i], + ifelse(abs((data$DGEN_past_10_Val[i] - data$DGEN_fut_10_Val[i]) - data$ehiDGEN_10_Val[i]) < 1e-10, "✓", "✗"))) +} + +# Full QA check for all rows and all variables +cat("\n\n=== OVERALL QA CHECK (ALL ROWS, ALL VARIABLES) ===\n") + +qa_pairs <- list( + # 5-year DGEN pairs + list(npast = "DGEN_past_5_Pref", nfut = "DGEN_fut_5_Pref", target = "ehiDGEN_5_Pref"), + list(npast = "DGEN_past_5_Pers", nfut = "DGEN_fut_5_Pers", target = "ehiDGEN_5_Pers"), + list(npast = "DGEN_past_5_Val", nfut = "DGEN_fut_5_Val", target = "ehiDGEN_5_Val"), + + # 10-year DGEN pairs + list(npast = "DGEN_past_10_Pref", nfut = "DGEN_fut_10_Pref", target = "ehiDGEN_10_Pref"), + list(npast = "DGEN_past_10_Pers", nfut = "DGEN_fut_10_Pers", target = "ehiDGEN_10_Pers"), + list(npast = "DGEN_past_10_Val", nfut = "DGEN_fut_10_Val", target = "ehiDGEN_10_Val") +) + +all_checks_passed <- TRUE + +for (pair in qa_pairs) { + # Calculate expected difference + expected_diff <- data[[pair$npast]] - data[[pair$nfut]] + + # Get actual value in target variable + actual_value <- data[[pair$target]] + + # Compare (allowing for floating point precision issues) + discrepancies <- which(abs(expected_diff - actual_value) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s\n", pair$target)) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + + # Show first discrepancy details + row_num <- discrepancies[1] + cat(sprintf(" Example (row %d): %s (%g) - %s (%g) = %g, but %s = %g\n", + row_num, + pair$npast, data[[pair$npast]][row_num], + pair$nfut, data[[pair$nfut]][row_num], + expected_diff[row_num], + pair$target, actual_value[row_num])) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s (n = %d)\n", pair$target, nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/eohi2/datap 13 - ehi domain specific means.r b/eohi2/datap 13 - ehi domain specific means.r new file mode 100644 index 0000000..e655492 --- /dev/null +++ b/eohi2/datap 13 - ehi domain specific means.r @@ -0,0 +1,161 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate domain-specific mean scores for EHI variables across time intervals + +# === 5-YEAR MEANS === +data$ehi5_pref_MEAN <- rowMeans(data[, c("ehi5_pref_read", "ehi5_pref_music", + "ehi5_pref_TV", "ehi5_pref_nap", + "ehi5_pref_travel")], na.rm = TRUE) + +data$ehi5_pers_MEAN <- rowMeans(data[, c("ehi5_pers_extravert", "ehi5_pers_critical", + "ehi5_pers_dependable", "ehi5_pers_anxious", + "ehi5_pers_complex")], na.rm = TRUE) + +data$ehi5_val_MEAN <- rowMeans(data[, c("ehi5_val_obey", "ehi5_val_trad", + "ehi5_val_opinion", "ehi5_val_performance", + "ehi5_val_justice")], na.rm = TRUE) + +# === 10-YEAR MEANS === +data$ehi10_pref_MEAN <- rowMeans(data[, c("ehi10_pref_read", "ehi10_pref_music", + "ehi10_pref_TV", "ehi10_pref_nap", + "ehi10_pref_travel")], na.rm = TRUE) + +data$ehi10_pers_MEAN <- rowMeans(data[, c("ehi10_pers_extravert", "ehi10_pers_critical", + "ehi10_pers_dependable", "ehi10_pers_anxious", + "ehi10_pers_complex")], na.rm = TRUE) + +data$ehi10_val_MEAN <- rowMeans(data[, c("ehi10_val_obey", "ehi10_val_trad", + "ehi10_val_opinion", "ehi10_val_performance", + "ehi10_val_justice")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE MEANS === +data$ehi5.10_pref_MEAN <- rowMeans(data[, c("ehi5.10_pref_read", "ehi5.10_pref_music", + "ehi5.10_pref_TV", "ehi5.10_pref_nap", + "ehi5.10_pref_travel")], na.rm = TRUE) + +data$ehi5.10_pers_MEAN <- rowMeans(data[, c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", + "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", + "ehi5.10_pers_complex")], na.rm = TRUE) + +data$ehi5.10_val_MEAN <- rowMeans(data[, c("ehi5.10_val_obey", "ehi5.10_val_trad", + "ehi5.10_val_opinion", "ehi5.10_val_performance", + "ehi5.10_val_justice")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI domain-specific mean calculations\n\n") + +cat("--- FIRST 5 ROWS: 5-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_read[i], data$ehi5_pref_music[i], + data$ehi5_pref_TV[i], data$ehi5_pref_nap[i], + data$ehi5_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR PERSONALITY MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pers_extravert[i], data$ehi5_pers_critical[i], + data$ehi5_pers_dependable[i], data$ehi5_pers_anxious[i], + data$ehi5_pers_complex[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_pers_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_read[i], data$ehi10_pref_music[i], + data$ehi10_pref_TV[i], data$ehi10_pref_nap[i], + data$ehi10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE PREFERENCES MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_read[i], data$ehi5.10_pref_music[i], + data$ehi5.10_pref_TV[i], data$ehi5.10_pref_nap[i], + data$ehi5.10_pref_travel[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_pref_MEAN[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], vals[4], vals[5], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # 5-year means + list(vars = c("ehi5_pref_read", "ehi5_pref_music", "ehi5_pref_TV", "ehi5_pref_nap", "ehi5_pref_travel"), + target = "ehi5_pref_MEAN", name = "5-Year Preferences"), + list(vars = c("ehi5_pers_extravert", "ehi5_pers_critical", "ehi5_pers_dependable", "ehi5_pers_anxious", "ehi5_pers_complex"), + target = "ehi5_pers_MEAN", name = "5-Year Personality"), + list(vars = c("ehi5_val_obey", "ehi5_val_trad", "ehi5_val_opinion", "ehi5_val_performance", "ehi5_val_justice"), + target = "ehi5_val_MEAN", name = "5-Year Values"), + + # 10-year means + list(vars = c("ehi10_pref_read", "ehi10_pref_music", "ehi10_pref_TV", "ehi10_pref_nap", "ehi10_pref_travel"), + target = "ehi10_pref_MEAN", name = "10-Year Preferences"), + list(vars = c("ehi10_pers_extravert", "ehi10_pers_critical", "ehi10_pers_dependable", "ehi10_pers_anxious", "ehi10_pers_complex"), + target = "ehi10_pers_MEAN", name = "10-Year Personality"), + list(vars = c("ehi10_val_obey", "ehi10_val_trad", "ehi10_val_opinion", "ehi10_val_performance", "ehi10_val_justice"), + target = "ehi10_val_MEAN", name = "10-Year Values"), + + # 5-10 year change means + list(vars = c("ehi5.10_pref_read", "ehi5.10_pref_music", "ehi5.10_pref_TV", "ehi5.10_pref_nap", "ehi5.10_pref_travel"), + target = "ehi5.10_pref_MEAN", name = "5-10 Year Change Preferences"), + list(vars = c("ehi5.10_pers_extravert", "ehi5.10_pers_critical", "ehi5.10_pers_dependable", "ehi5.10_pers_anxious", "ehi5.10_pers_complex"), + target = "ehi5.10_pers_MEAN", name = "5-10 Year Change Personality"), + list(vars = c("ehi5.10_val_obey", "ehi5.10_val_trad", "ehi5.10_val_opinion", "ehi5.10_val_performance", "ehi5.10_val_justice"), + target = "ehi5.10_val_MEAN", name = "5-10 Year Change Values") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/eohi2/datap 14 - all ehi global means.r b/eohi2/datap 14 - all ehi global means.r new file mode 100644 index 0000000..d1fa875 --- /dev/null +++ b/eohi2/datap 14 - all ehi global means.r @@ -0,0 +1,140 @@ +options(scipen = 999) +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Load data +data <- read.csv("eohi2.csv") + +# Calculate global mean scores for EHI variables across time intervals + +# === DGEN 5-YEAR GLOBAL MEAN === +data$ehiDGEN_5_mean <- rowMeans(data[, c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", + "ehiDGEN_5_Val")], na.rm = TRUE) + +# === DGEN 10-YEAR GLOBAL MEAN === +data$ehiDGEN_10_mean <- rowMeans(data[, c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", + "ehiDGEN_10_Val")], na.rm = TRUE) + +# === 5-YEAR GLOBAL MEAN === +data$ehi5_global_mean <- rowMeans(data[, c("ehi5_pref_MEAN", "ehi5_pers_MEAN", + "ehi5_val_MEAN")], na.rm = TRUE) + +# === 10-YEAR GLOBAL MEAN === +data$ehi10_global_mean <- rowMeans(data[, c("ehi10_pref_MEAN", "ehi10_pers_MEAN", + "ehi10_val_MEAN")], na.rm = TRUE) + +# === 5-10 YEAR CHANGE GLOBAL MEAN === +data$ehi5.10_global_mean <- rowMeans(data[, c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", + "ehi5.10_val_MEAN")], na.rm = TRUE) + +# QA: Verify mean calculations +cat("\n=== QUALITY ASSURANCE CHECK ===\n") +cat("Verifying EHI global mean calculations\n\n") + +cat("--- FIRST 5 ROWS: DGEN 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_5_Pref[i], data$ehiDGEN_5_Pers[i], + data$ehiDGEN_5_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_5_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: DGEN 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehiDGEN_10_Pref[i], data$ehiDGEN_10_Pers[i], + data$ehiDGEN_10_Val[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehiDGEN_10_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%g, %g, %g] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5_pref_MEAN[i], data$ehi5_pers_MEAN[i], + data$ehi5_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 10-YEAR GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi10_pref_MEAN[i], data$ehi10_pers_MEAN[i], + data$ehi10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +cat("\n--- FIRST 5 ROWS: 5-10 YEAR CHANGE GLOBAL MEAN ---\n") +for (i in 1:5) { + vals <- c(data$ehi5.10_pref_MEAN[i], data$ehi5.10_pers_MEAN[i], + data$ehi5.10_val_MEAN[i]) + calc_mean <- mean(vals, na.rm = TRUE) + actual_mean <- data$ehi5.10_global_mean[i] + match <- abs(calc_mean - actual_mean) < 1e-10 + cat(sprintf("Row %d: [%.5f, %.5f, %.5f] → Calculated: %.5f | Actual: %.5f %s\n", + i, vals[1], vals[2], vals[3], + calc_mean, actual_mean, ifelse(match, "✓", "✗"))) +} + +# Overall QA check for all rows +cat("\n--- OVERALL QA CHECK (ALL ROWS) ---\n") + +qa_checks <- list( + # DGEN global means + list(vars = c("ehiDGEN_5_Pref", "ehiDGEN_5_Pers", "ehiDGEN_5_Val"), + target = "ehiDGEN_5_mean", name = "DGEN 5-Year Global"), + list(vars = c("ehiDGEN_10_Pref", "ehiDGEN_10_Pers", "ehiDGEN_10_Val"), + target = "ehiDGEN_10_mean", name = "DGEN 10-Year Global"), + + # Domain-specific global means + list(vars = c("ehi5_pref_MEAN", "ehi5_pers_MEAN", "ehi5_val_MEAN"), + target = "ehi5_global_mean", name = "5-Year Global"), + list(vars = c("ehi10_pref_MEAN", "ehi10_pers_MEAN", "ehi10_val_MEAN"), + target = "ehi10_global_mean", name = "10-Year Global"), + list(vars = c("ehi5.10_pref_MEAN", "ehi5.10_pers_MEAN", "ehi5.10_val_MEAN"), + target = "ehi5.10_global_mean", name = "5-10 Year Change Global") +) + +all_checks_passed <- TRUE + +for (check in qa_checks) { + calc_mean <- rowMeans(data[, check$vars], na.rm = TRUE) + actual_mean <- data[[check$target]] + discrepancies <- which(abs(calc_mean - actual_mean) > 1e-10) + + if (length(discrepancies) > 0) { + cat(sprintf("FAIL: %s mean (n_vars = %d)\n", check$name, length(check$vars))) + cat(sprintf(" Found %d discrepancies in rows: %s\n", + length(discrepancies), + paste(head(discrepancies, 10), collapse = ", "))) + all_checks_passed <- FALSE + } else { + cat(sprintf("PASS: %s mean (n_vars = %d, n_rows = %d)\n", + check$name, length(check$vars), nrow(data))) + } +} + +cat("\n") +if (all_checks_passed) { + cat("*** ALL QA CHECKS PASSED ***\n") +} else { + cat("*** SOME QA CHECKS FAILED - REVIEW ABOVE ***\n") +} + +# Save updated dataset +write.csv(data, "eohi2.csv", row.names = FALSE) +cat("\nDataset saved to eohi2.csv\n") \ No newline at end of file diff --git a/eohi2/datap 15 - education recoded ordinal 3.r b/eohi2/datap 15 - education recoded ordinal 3.r new file mode 100644 index 0000000..33ae8e7 --- /dev/null +++ b/eohi2/datap 15 - education recoded ordinal 3.r @@ -0,0 +1,38 @@ +options(scipen = 999) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +data <- read.csv("eohi2.csv") + +# Check the levels of the demo_edu variable +print(levels(factor(data$demo_edu))) + +# Also show the unique values and their frequencies +print("\nUnique values and frequencies:") +print(table(data$demo_edu, useNA = "ifany")) + +# Recode demo_edu into 3 ordinal levels +data$edu3 <- NA + +# HS_TS: High School and Trade School +data$edu3[data$demo_edu %in% c("High School (or equivalent)", "Trade School (non-military)")] <- "HS_TS" + +# C_Ug: College and University - Undergraduate +data$edu3[data$demo_edu %in% c("College Diploma/Certificate", "University - Undergraduate")] <- "C_Ug" + +# grad_prof: University - Graduate, University - PhD, and Professional Degree +data$edu3[data$demo_edu %in% c("University - Graduate (Masters)", "University - PhD", "Professional Degree (ex. JD/MD)")] <- "grad_prof" + +# Convert to ordered factor +data$edu3 <- factor(data$edu3, + levels = c("HS_TS", "C_Ug", "grad_prof"), + ordered = TRUE) + +# Check the recoded variable +print(table(data$edu3, useNA = "ifany")) + +# Verify the recoding +print(table(data$demo_edu, data$edu3, useNA = "ifany")) + +# Save the updated dataset with the new edu3 variable +write.csv(data, "eohi2.csv", row.names = FALSE) \ No newline at end of file diff --git a/eohi2/datap 16 - ehi vars standardized .r b/eohi2/datap 16 - ehi vars standardized .r new file mode 100644 index 0000000..01e0592 --- /dev/null +++ b/eohi2/datap 16 - ehi vars standardized .r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +# Display means and standard deviations of non-standardized variables for manual checking +print(round(mean(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_5_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehiDGEN_10_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi5_global_mean, na.rm = TRUE), 5)) +print(round(mean(df$ehi10_global_mean, na.rm = TRUE), 5)) +print(round(sd(df$ehi10_global_mean, na.rm = TRUE), 5)) + +# Calculate means and standard deviations for standardization +mean_DGEN_5 <- mean(df$ehiDGEN_5_mean, na.rm = TRUE) +sd_DGEN_5 <- sd(df$ehiDGEN_5_mean, na.rm = TRUE) + +mean_DGEN_10 <- mean(df$ehiDGEN_10_mean, na.rm = TRUE) +sd_DGEN_10 <- sd(df$ehiDGEN_10_mean, na.rm = TRUE) + +mean_DS_5 <- mean(df$ehi5_global_mean, na.rm = TRUE) +sd_DS_5 <- sd(df$ehi5_global_mean, na.rm = TRUE) + +mean_DS_10 <- mean(df$ehi10_global_mean, na.rm = TRUE) +sd_DS_10 <- sd(df$ehi10_global_mean, na.rm = TRUE) + +# Create standardized variables +df$stdDGEN_5 <- (df$ehiDGEN_5_mean - mean_DGEN_5) / sd_DGEN_5 +df$stdDGEN_10 <- (df$ehiDGEN_10_mean - mean_DGEN_10) / sd_DGEN_10 +df$stdDS_5 <- (df$ehi5_global_mean - mean_DS_5) / sd_DS_5 +df$stdDS_10 <- (df$ehi10_global_mean - mean_DS_10) / sd_DS_10 + +# Check that variables have been standardized +print(round(mean(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDGEN_10, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_5, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_5, na.rm = TRUE), 5)) +print(round(mean(df$stdDS_10, na.rm = TRUE), 5)) +print(round(sd(df$stdDS_10, na.rm = TRUE), 5)) + +# Calculate mean of standardized variables +df$stdEHI_mean <- rowMeans(df[, c("stdDGEN_5", "stdDGEN_10", "stdDS_5", "stdDS_10")], na.rm = TRUE) + +#### check random 10 rows + +# Check 10 random rows to verify calculations +set.seed(123) # For reproducible random selection +random_rows <- sample(nrow(df), 10) + +cat("Checking 10 random rows:\n") +cat("Row | ehiDGEN_5_mean | stdDGEN_5 | Calculation | ehiDGEN_10_mean | stdDGEN_10 | Calculation\n") +cat("----|----------------|-----------|-------------|-----------------|------------|------------\n") + +for(i in random_rows) { + orig_5 <- df$ehiDGEN_5_mean[i] + std_5 <- df$stdDGEN_5[i] + calc_5 <- (orig_5 - mean_DGEN_5) / sd_DGEN_5 + + orig_10 <- df$ehiDGEN_10_mean[i] + std_10 <- df$stdDGEN_10[i] + calc_10 <- (orig_10 - mean_DGEN_10) / sd_DGEN_10 + + cat(sprintf("%3d | %13.5f | %9.5f | %11.5f | %15.5f | %10.5f | %11.5f\n", + i, orig_5, std_5, calc_5, orig_10, std_10, calc_10)) +} + +cat("\nRow | ehi5_global_mean | stdDS_5 | Calculation | ehi10_global_mean | stdDS_10 | Calculation\n") +cat("----|------------------|---------|-------------|-------------------|----------|------------\n") + +for(i in random_rows) { + orig_5 <- df$ehi5_global_mean[i] + std_5 <- df$stdDS_5[i] + calc_5 <- (orig_5 - mean_DS_5) / sd_DS_5 + + orig_10 <- df$ehi10_global_mean[i] + std_10 <- df$stdDS_10[i] + calc_10 <- (orig_10 - mean_DS_10) / sd_DS_10 + + cat(sprintf("%3d | %16.5f | %8.5f | %11.5f | %17.5f | %9.5f | %11.5f\n", + i, orig_5, std_5, calc_5, orig_10, std_10, calc_10)) +} + +# Show the final stdEHI_mean for these rows +cat("\nRow | stdEHI_mean | Manual calc\n") +cat("----|-------------|------------\n") +for(i in random_rows) { + manual_mean <- -0.042564413 -0.158849227 -1.444812436 -0.23426232 -0.470122099 +mean(c(df$stdDGEN_5[i], df$stdDGEN_10[i], df$stdDS_5[i], df$stdDS_10[i]), na.rm = TRUE) + cat(sprintf("%3d | %11.5f | %11.5f\n", i, df$stdEHI_mean[i], manual_mean)) +} + +# Write to CSV +write.csv(df, "eohi2.csv", row.names = FALSE) \ No newline at end of file diff --git a/eohi2/descriptive_statistics.csv b/eohi2/descriptive_statistics.csv new file mode 100644 index 0000000..940e6b8 --- /dev/null +++ b/eohi2/descriptive_statistics.csv @@ -0,0 +1,24 @@ +"","vars","n","mean","sd","median","trimmed","mad","min","max","range","skew","kurtosis","se" +"ehiDGEN_5_Pref",1,489,0.06339,1.9954,0,0.03308,1.4826,-9,9,18,0.27576,4.00366,0.09024 +"ehiDGEN_5_Pers",2,489,0.09816,1.85725,0,0.1145,1.4826,-9,7,16,-0.18711,3.23028,0.08399 +"ehiDGEN_5_Val",3,489,0.02454,2.16042,0,0.06361,1.4826,-9,10,19,0.1765,4.44483,0.0977 +"ehiDGEN_10_Pref",4,489,0.20245,2.29618,0,0.18575,1.4826,-10,9,19,0.01558,3.90242,0.10384 +"ehiDGEN_10_Pers",5,489,0.29448,2.34328,0,0.24936,1.4826,-9,10,19,0.06997,2.70639,0.10597 +"ehiDGEN_10_Val",6,489,0.40491,2.32319,0,0.32061,1.4826,-8,10,18,0.37025,2.73426,0.10506 +"ehi5_pref_MEAN",7,489,0.07607,0.64562,0,0.05954,0.29652,-4.4,4,8.4,0.13291,10.10075,0.0292 +"ehi5_pers_MEAN",8,489,0.07454,0.74495,0,0.05267,0.59304,-2.4,3.6,6,0.58141,3.07505,0.03369 +"ehi5_val_MEAN",9,489,0.05194,0.58562,0,0.02748,0.29652,-2.6,3,5.6,0.62482,5.46128,0.02648 +"ehi10_pref_MEAN",10,489,0.10348,0.69093,0,0.09059,0.59304,-3.6,3.6,7.2,0.02685,4.20962,0.03124 +"ehi10_pers_MEAN",11,489,0.12168,0.75889,0,0.09389,0.59304,-3.6,3.8,7.4,0.14345,3.87988,0.03432 +"ehi10_val_MEAN",12,489,0.14397,0.71372,0,0.08193,0.29652,-2.4,4,6.4,1.25911,5.60017,0.03228 +"ehi5.10_pref_MEAN",13,489,0.13538,0.70635,0,0.12214,0.29652,-5.2,2.6,7.8,-0.87659,8.98815,0.03194 +"ehi5.10_pers_MEAN",14,489,0.18773,0.77513,0,0.16489,0.59304,-3.6,3.4,7,0.18903,2.50653,0.03505 +"ehi5.10_val_MEAN",15,489,0.12229,0.73027,0,0.08193,0.29652,-2.8,3.6,6.4,0.68131,4.79817,0.03302 +"ehiDGEN_5_mean",16,489,0.06203,1.45735,0,0.06361,0.9884,-7.66667,5.66667,13.33333,-0.33245,3.67417,0.0659 +"ehiDGEN_10_mean",17,489,0.30061,1.89245,0,0.28329,0.9884,-8,9,17,0.01127,3.38489,0.08558 +"ehi5_global_mean",18,489,0.06752,0.46201,0,0.0486,0.29652,-1.93333,3.33333,5.26667,0.93595,7.08224,0.02089 +"ehi10_global_mean",19,489,0.12304,0.52522,0,0.08494,0.29652,-2.46667,2.33333,4.8,0.55734,3.94213,0.02375 +"ehi5.10_global_mean",20,489,0.14847,0.50536,0.06667,0.12231,0.29652,-1.93333,2.8,4.73333,0.67593,4.05776,0.02285 +"aot_total",21,489,0.20475,0.50227,0.125,0.18861,0.37065,-2,1.75,3.75,0.06455,1.92235,0.02271 +"crt_correct",22,489,0.26858,0.35082,0,0.21204,0,0,1,1,0.97116,-0.45636,0.01586 +"crt_int",23,489,0.67212,0.3564,0.66667,0.71416,0.4942,0,1,1,-0.65482,-0.92392,0.01612 diff --git a/eohi2/descriptive_statistics_domain_general_vars.csv b/eohi2/descriptive_statistics_domain_general_vars.csv new file mode 100644 index 0000000..79ad922 --- /dev/null +++ b/eohi2/descriptive_statistics_domain_general_vars.csv @@ -0,0 +1,15 @@ +"","vars","n","mean","sd","median","trimmed","mad","min","max","range","skew","kurtosis","se" +"DGEN_past_5_mean",1,489,3.70279,2.64159,3.33333,3.57422,2.9652,0,10,10,0.33519,-0.92598,0.11946 +"DGEN_past_10_mean",2,489,4.12747,2.69248,4,4.07209,3.4594,0,10,10,0.15303,-1.06997,0.12176 +"DGEN_fut_5_mean",3,489,3.64076,2.72097,3,3.47498,2.9652,0,10,10,0.45879,-0.91272,0.12305 +"DGEN_fut_10_mean",4,489,3.82686,2.67605,3.33333,3.6743,2.9652,0,10,10,0.41341,-0.85159,0.12101 +"DGEN_past_5.10_mean",5,489,1.10907,1.14357,0.66667,0.93384,0.9884,0,6.66667,6.66667,1.38388,2.20547,0.05171 +"DGEN_fut_5.10_mean",6,489,1.03272,1.16269,0.66667,0.83885,0.9884,0,7.33333,7.33333,1.82686,4.61137,0.05258 +"DGENpast_global_mean",7,489,2.97978,1.86338,3.11111,2.96409,2.30627,0,6.66667,6.66667,0.05122,-1.1105,0.08427 +"DGENfut_global_mean",8,489,2.83345,1.86526,2.66667,2.76788,2.30627,0,6.66667,6.66667,0.25867,-1.05797,0.08435 +"DGEN_5_global_mean",9,489,3.67178,2.58067,3.16667,3.53859,2.9652,0,10,10,0.38068,-0.90478,0.1167 +"DGEN_10_global_mean",10,489,3.97716,2.51197,3.83333,3.89992,2.9652,0,10,10,0.23861,-0.92036,0.1136 +"DGEN_5.10_global_mean",11,489,1.07089,0.95646,0.83333,0.95335,0.9884,0,5,5,1.13335,1.28416,0.04325 +"aot_total",12,489,0.20475,0.50227,0.125,0.18861,0.37065,-2,1.75,3.75,0.06455,1.92235,0.02271 +"crt_correct",13,489,0.26858,0.35082,0,0.21204,0,0,1,1,0.97116,-0.45636,0.01586 +"crt_int",14,489,0.67212,0.3564,0.66667,0.71416,0.4942,0,1,1,-0.65482,-0.92392,0.01612 diff --git a/eohi2/descriptive_statistics_domain_vars.csv b/eohi2/descriptive_statistics_domain_vars.csv new file mode 100644 index 0000000..c9ff937 --- /dev/null +++ b/eohi2/descriptive_statistics_domain_vars.csv @@ -0,0 +1,15 @@ +"","vars","n","mean","sd","median","trimmed","mad","min","max","range","skew","kurtosis","se" +"NPast_5_mean",1,489,0.76277,0.55533,0.66667,0.69835,0.4942,0,4.8,4.8,2.01066,8.11149,0.02511 +"NPast_10_mean",2,489,0.88733,0.6263,0.73333,0.80824,0.4942,0,4.6,4.6,1.41399,3.09844,0.02832 +"NFut_5_mean",3,489,0.69532,0.48193,0.6,0.63745,0.39536,0,4.06667,4.06667,1.85189,6.68172,0.02179 +"NFut_10_mean",4,489,0.76426,0.49828,0.66667,0.71194,0.39536,0,3.4,3.4,1.45198,3.7343,0.02253 +"X5.10past_mean",5,489,0.65167,0.52985,0.53333,0.58168,0.4942,0,2.93333,2.93333,1.36314,2.1647,0.02396 +"X5.10fut_mean",6,489,0.5032,0.45323,0.4,0.43885,0.39536,0,3,3,1.767,4.60138,0.0205 +"NPast_global_mean",7,489,0.82505,0.55947,0.7,0.76187,0.4942,0,4.7,4.7,1.66241,5.70101,0.0253 +"NFut_global_mean",8,489,0.72979,0.46389,0.63333,0.6788,0.39536,0,3.63333,3.63333,1.46414,4.00179,0.02098 +"X5.10_global_mean",9,489,0.57744,0.42336,0.5,0.52824,0.39536,0,2.13333,2.13333,1.20869,1.65839,0.01914 +"N5_global_mean",10,489,0.72904,0.46587,0.63333,0.68113,0.39536,0,4.43333,4.43333,1.8537,8.65629,0.02107 +"N10_global_mean",11,489,0.8258,0.50129,0.73333,0.77934,0.44478,0,3.9,3.9,1.26506,3.40645,0.02267 +"aot_total",12,489,0.20475,0.50227,0.125,0.18861,0.37065,-2,1.75,3.75,0.06455,1.92235,0.02271 +"crt_correct",13,489,0.26858,0.35082,0,0.21204,0,0,1,1,0.97116,-0.45636,0.01586 +"crt_int",14,489,0.67212,0.3564,0.66667,0.71416,0.4942,0,1,1,-0.65482,-0.92392,0.01612 diff --git a/eohi2/e2 - correlation matrix.r b/eohi2/e2 - correlation matrix.r new file mode 100644 index 0000000..755cd29 --- /dev/null +++ b/eohi2/e2 - correlation matrix.r @@ -0,0 +1,100 @@ +options(scipen = 999) + +library(dplyr) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +df <- read.csv("eohi2.csv") + +data <- df %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, demo_sex, demo_age_1, edu3, aot_total, crt_correct, crt_int) %>% + filter(demo_sex != "Prefer not to say") + +print(colSums(is.na(data))) +print(sapply(data, class)) + +# Create dummy variable for sex (0 = Male, 1 = Female) +data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0) + +# Verify the dummy coding +print(table(data$demo_sex, data$sex_dummy)) + +#descriptives + +# Descriptives for age +print(summary(data$demo_age_1)) +print(sd(data$demo_age_1, na.rm = TRUE)) + + +# Descriptives for sex (frequency table) +print(table(data$demo_sex)) +print(prop.table(table(data$demo_sex))) + +# Descriptives for sex dummy variable +print(table(data$sex_dummy)) + +# Convert edu3 to numeric factor for correlations (1, 2, 3) +# First ensure edu3 is a factor, then convert to numeric +data$edu3 <- factor(data$edu3, levels = c("HS_TS", "C_Ug", "grad_prof"), ordered = TRUE) +data$edu_num <- as.numeric(data$edu3) + +# Check the numeric conversion +print(table(data$edu_num, useNA = "ifany")) + +# Verify the conversion +print(table(data$edu3, data$edu_num, useNA = "ifany")) + +####correlation matrix #### + +# Select numeric variables for correlation matrix +numeric_vars <- data %>% + select(ehiDGEN_5_mean, ehiDGEN_10_mean, ehi5_global_mean, ehi10_global_mean, sex_dummy, demo_age_1, edu_num, aot_total, crt_correct, crt_int) + +# Create Spearman correlation matrix +cor_matrix <- cor(numeric_vars, use = "complete.obs", method = "spearman") + +# Print correlation matrix +print(round(cor_matrix, 3)) + +# Get significance tests for correlations using psych package +library(psych) + +# Create correlation matrix with significance tests +cor_test <- corr.test(numeric_vars, method = "spearman", adjust = "none") + +# Print correlation matrix +print(round(cor_test$r, 3)) + +# Print p-values +print(round(cor_test$p, 3)) + +# Print all correlations with r and p values (for reporting) +for(i in 1:nrow(cor_test$r)) { + for(j in 1:ncol(cor_test$r)) { + if(i != j) { # Skip diagonal + cat(colnames(numeric_vars)[i], "vs", colnames(numeric_vars)[j], + ": r =", round(cor_test$r[i, j], 3), + ", p =", round(cor_test$p[i, j], 3), "\n") + } + } +} + +# Also print significant correlations summary +sig_cors <- which(cor_test$p < 0.05 & cor_test$p != 0, arr.ind = TRUE) +if(nrow(sig_cors) > 0) { + for(i in 1:nrow(sig_cors)) { + row_idx <- sig_cors[i, 1] + col_idx <- sig_cors[i, 2] + if(row_idx != col_idx) { # Skip diagonal + cat(colnames(numeric_vars)[row_idx], "vs", colnames(numeric_vars)[col_idx], + ": r =", round(cor_test$r[row_idx, col_idx], 3), + ", p =", round(cor_test$p[row_idx, col_idx], 3), "\n") + } + } +} + +# Save correlation matrix and p-values to CSV files +write.csv(cor_test$r, "correlation_matrix.csv", row.names = TRUE) +write.csv(cor_test$p, "correlation_pvalues.csv", row.names = TRUE) +print("Correlation matrix saved to correlation_matrix.csv") +print("P-values saved to correlation_pvalues.csv") \ No newline at end of file diff --git a/eohi2/eohi2 - Copy.csv b/eohi2/eohi2 - Copy.csv new file mode 100644 index 0000000..99045d3 --- /dev/null +++ b/eohi2/eohi2 - Copy.csv @@ -0,0 +1,490 @@ +pID,ResponseId,taq_age,Citizenship,taq_sex,demo_sex,demo_edu,demo_age_1,GROUP,TEMPORAL_DO,INTERVAL_DO,ITEM_DO,aot_total,crt_correct,crt_int,present_pref_read,present_pref_music,present_pref_tv,present_pref_nap,present_pref_travel,present_pers_extravert,present_pers_critical,present_pers_dependable,present_pers_anxious,present_pers_complex,present_val_obey,present_val_trad,present_val_opinion,present_val_performance,present_val_justice,past_5_pref_read,past_5_pref_music,past_5_pref_TV,past_5_pref_nap,past_5_pref_travel,past_5_pers_extravert,past_5_pers_critical,past_5_pers_dependable,past_5_pers_anxious,past_5_pers_complex,past_5_val_obey,past_5_val_trad,past_5_val_opinion,past_5_val_performance,past_5_val_justice,past_10_pref_read,past_10_pref_music,past_10_pref_TV,past_10_pref_nap,past_10_pref_travel,past_10_pers_extravert,past_10_pers_critical,past_10_pers_dependable,past_10_pers_anxious,past_10_pers_complex,past_10_val_obey,past_10_val_trad,past_10_val_opinion,past_10_val_performance,past_10_val_justice,fut_5_pref_read,fut_5_pref_music,fut_5_pref_TV,fut_5_pref_nap,fut_5_pref_travel,fut_5_pers_extravert,fut_5_pers_critical,fut_5_pers_dependable,fut_5_pers_anxious,fut_5_pers_complex,fut_5_val_obey,fut_5_val_trad,fut_5_val_opinion,fut_5_val_performance,fut_5_val_justice,fut_10_pref_read,fut_10_pref_music,fut_10_pref_TV,fut_10_pref_nap,fut_10_pref_travel,fut_10_pers_extravert,fut_10_pers_critical,fut_10_pers_dependable,fut_10_pers_anxious,fut_10_pers_complex,fut_10_val_obey,fut_10_val_trad,fut_10_val_opinion,fut_10_val_performance,fut_10_val_justice,DGEN_past_5_Pref,DGEN_past_5_Pers,DGEN_past_5_Val,DGEN_past_10_Pref,DGEN_past_10_Pers,DGEN_past_10_Val,DGEN_fut_5_Pref,DGEN_fut_5_Pers,DGEN_fut_5_Val,DGEN_fut_10_Pref,DGEN_fut_10_Pers,DGEN_fut_10_Val,NPast_5_pref_read,NPast_5_pref_music,NPast_5_pref_TV,NPast_5_pref_nap,NPast_5_pref_travel,NPast_5_pers_extravert,NPast_5_pers_critical,NPast_5_pers_dependable,NPast_5_pers_anxious,NPast_5_pers_complex,NPast_5_val_obey,NPast_5_val_trad,NPast_5_val_opinion,NPast_5_val_performance,NPast_5_val_justice,NPast_10_pref_read,NPast_10_pref_music,NPast_10_pref_TV,NPast_10_pref_nap,NPast_10_pref_travel,NPast_10_pers_extravert,NPast_10_pers_critical,NPast_10_pers_dependable,NPast_10_pers_anxious,NPast_10_pers_complex,NPast_10_val_obey,NPast_10_val_trad,NPast_10_val_opinion,NPast_10_val_performance,NPast_10_val_justice,NFut_5_pref_read,NFut_5_pref_music,NFut_5_pref_TV,NFut_5_pref_nap,NFut_5_pref_travel,NFut_5_pers_extravert,NFut_5_pers_critical,NFut_5_pers_dependable,NFut_5_pers_anxious,NFut_5_pers_complex,NFut_5_val_obey,NFut_5_val_trad,NFut_5_val_opinion,NFut_5_val_performance,NFut_5_val_justice,NFut_10_pref_read,NFut_10_pref_music,NFut_10_pref_TV,NFut_10_pref_nap,NFut_10_pref_travel,NFut_10_pers_extravert,NFut_10_pers_critical,NFut_10_pers_dependable,NFut_10_pers_anxious,NFut_10_pers_complex,NFut_10_val_obey,NFut_10_val_trad,NFut_10_val_opinion,NFut_10_val_performance,NFut_10_val_justice,X5.10past_pref_read,X5.10past_pref_music,X5.10past_pref_TV,X5.10past_pref_nap,X5.10past_pref_travel,X5.10past_pers_extravert,X5.10past_pers_critical,X5.10past_pers_dependable,X5.10past_pers_anxious,X5.10past_pers_complex,X5.10past_val_obey,X5.10past_val_trad,X5.10past_val_opinion,X5.10past_val_performance,X5.10past_val_justice,X5.10fut_pref_read,X5.10fut_pref_music,X5.10fut_pref_TV,X5.10fut_pref_nap,X5.10fut_pref_travel,X5.10fut_pers_extravert,X5.10fut_pers_critical,X5.10fut_pers_dependable,X5.10fut_pers_anxious,X5.10fut_pers_complex,X5.10fut_val_obey,X5.10fut_val_trad,X5.10fut_val_opinion,X5.10fut_val_performance,X5.10fut_val_justice,ehi_buffer,ehi5_pref_read,ehi5_pref_music,ehi5_pref_TV,ehi5_pref_nap,ehi5_pref_travel,ehi5_pers_extravert,ehi5_pers_critical,ehi5_pers_dependable,ehi5_pers_anxious,ehi5_pers_complex,ehi5_val_obey,ehi5_val_trad,ehi5_val_opinion,ehi5_val_performance,ehi5_val_justice,ehi10_pref_read,ehi10_pref_music,ehi10_pref_TV,ehi10_pref_nap,ehi10_pref_travel,ehi10_pers_extravert,ehi10_pers_critical,ehi10_pers_dependable,ehi10_pers_anxious,ehi10_pers_complex,ehi10_val_obey,ehi10_val_trad,ehi10_val_opinion,ehi10_val_performance,ehi10_val_justice,ehi5.10_pref_read,ehi5.10_pref_music,ehi5.10_pref_TV,ehi5.10_pref_nap,ehi5.10_pref_travel,ehi5.10_pers_extravert,ehi5.10_pers_critical,ehi5.10_pers_dependable,ehi5.10_pers_anxious,ehi5.10_pers_complex,ehi5.10_val_obey,ehi5.10_val_trad,ehi5.10_val_opinion,ehi5.10_val_performance,ehi5.10_val_justice,buffer_ehiDGEN,ehiDGEN_5_Pref,ehiDGEN_5_Pers,ehiDGEN_5_Val,ehiDGEN_10_Pref,ehiDGEN_10_Pers,ehiDGEN_10_Val,buffer_ehi_means,ehi5_pref_MEAN,ehi5_pers_MEAN,ehi5_val_MEAN,ehi10_pref_MEAN,ehi10_pers_MEAN,ehi10_val_MEAN,ehi5.10_pref_MEAN,ehi5.10_pers_MEAN,ehi5.10_val_MEAN,buffer_globalMEANS,ehiDGEN_5_mean,ehiDGEN_10_mean,ehi5_global_mean,ehi10_global_mean,ehi5.10_global_mean,buffer_missingVARS,X5_10DGEN_past_pref,X5_10DGEN_past_pers,X5_10DGEN_past_val,X5_10DGEN_fut_pref,X5_10DGEN_fut_pers,X5_10DGEN_fut_val,NPast_5_pref_MEAN,NPast_5_pers_MEAN,NPast_5_val_MEAN,NPast_10_pref_MEAN,NPast_10_pers_MEAN,NPast_10_val_MEAN,NFut_5_pref_MEAN,NFut_5_pers_MEAN,NFut_5_val_MEAN,NFut_10_pref_MEAN,NFut_10_pers_MEAN,NFut_10_val_MEAN,X5.10past_pref_MEAN,X5.10past_pers_MEAN,X5.10past_val_MEAN,X5.10fut_pref_MEAN,X5.10fut_pers_MEAN,X5.10fut_val_MEAN,buffer_transformed,edu3 +1,R_72xzGlUXksmRobU,67 - 73,Canadian,Male,Male,University - Undergraduate,71,02PsVPf,02FUT,5,02DGEN,0.25,0,1,3,3,3,2,3,0,-3,3,-1,1,3,3,3,3,3,3,3,3,2,3,1,-3,3,-3,2,3,3,3,3,3,3,3,3,3,3,1,-3,3,-3,2,3,3,3,3,3,3,3,3,2,3,1,-3,3,0,2,3,3,3,3,3,3,3,3,2,3,2,-3,3,-2,2,2,2,2,3,3,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,1,1,1,0,0,buffer,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,1,0,-1,-1,-1,0,0,0,0,0,1,0,-1,0,0,-2,0,-1,-1,-1,0,0,buffer,1,0,0,0,0,0,buffer,0,0.2,0,0.2,0,-0.6,0.2,-0.6,-0.6,buffer,0.333333333,0,0.066666667,-0.133333333,-0.333333333,buffer,0,0,0,1,0,0,0,0.8,0,0.2,0.8,0,0,0.6,0,0,0.8,0.6,0.2,0,0,0,0.6,0.6,buffer,C_Ug +2,R_5OVzMaCE4iAqExQ,25 - 31,Canadian,Male,Male,Professional Degree (ex. JD/MD),25,03VPfPs,01PAST,10,02DGEN,0.125,0.666666667,0.333333333,1,1,0,0,1,0,1,0,1,0,1,1,0,0,1,0,0,0,0,1,0,-1,-1,1,0,0,0,-1,0,-1,-1,0,0,0,0,0,0,0,1,-1,0,-1,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,1,-1,1,1,0,1,0,6,6,3,6,7,7,7,7,7,7,7,6,1,1,0,0,0,0,2,1,0,0,1,1,1,0,2,2,1,0,0,1,0,1,0,0,1,1,2,0,1,1,2,1,0,0,1,0,1,0,1,0,1,1,0,0,1,1,1,0,0,1,0,2,1,0,1,0,0,0,1,1,1,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,buffer,-1,0,0,0,-1,0,1,1,-1,0,0,0,1,0,1,1,0,0,0,0,0,-1,-1,0,0,1,2,0,0,0,0,0,0,0,1,0,0,0,-1,0,-1,0,1,0,1,buffer,-1,-1,-4,-1,0,1,buffer,-0.4,0.2,0.4,0.2,-0.4,0.6,0.2,-0.2,0.2,buffer,-2,0,0.066666667,0.133333333,0.066666667,buffer,0,1,4,0,0,1,0.4,0.6,1,0.8,0.4,1,0.8,0.4,0.6,0.6,0.8,0.4,0.4,0.6,0.8,0.2,0.8,0.6,buffer,grad_prof +3,R_3NwGJkmZsE685Vf,67 - 73,Canadian,Male,Male,High School (or equivalent),73,02PsVPf,01PAST,5,02DGEN,0.125,0.333333333,0.666666667,2,2,3,0,2,-1,-2,1,-1,0,0,2,2,-2,1,2,2,2,2,2,-2,-2,2,-2,0,1,2,2,-2,2,2,2,2,-1,2,0,1,1,1,1,1,2,1,-2,2,2,2,2,3,1,0,0,0,0,0,1,2,1,-2,2,2,1,2,2,0,0,0,0,0,0,2,2,2,-2,2,2,3,6,8,6,7,3,2,5,6,5,5,0,0,1,2,0,1,0,1,1,0,1,0,0,0,1,0,0,1,1,0,1,3,0,2,1,1,0,1,0,1,0,0,1,3,1,1,2,1,1,0,1,0,1,0,1,0,1,1,2,2,1,2,1,1,0,2,0,0,0,1,0,0,0,3,0,2,3,1,3,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,1,0,1,0,0,buffer,0,0,0,-1,-1,0,-2,0,0,0,0,0,-1,0,0,0,-1,0,-1,-2,0,1,-1,1,1,-1,0,1,0,0,0,-1,0,2,-1,2,3,1,3,1,-1,0,0,0,0,buffer,-1,1,1,2,1,2,buffer,-0.4,-0.4,-0.2,-0.8,0.4,0,0,2,-0.2,buffer,0.333333333,1.666666667,-0.333333333,-0.133333333,0.6,buffer,6,3,1,3,3,0,0.6,0.6,0.4,0.4,1.4,0.6,1,1,0.6,1.2,1,0.6,0.6,2,0.2,0.6,0,0.4,buffer,HS_TS +4,R_7PdeFviF2kbNled,46 - 52,Canadian,Female,Female,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0,0,1,3,3,0,-1,2,-2,1,3,3,1,3,0,3,0,3,3,3,-1,-1,1,2,-1,3,-2,1,3,0,1,-2,3,3,3,-1,-1,0,1,-1,3,-2,1,3,2,0,0,3,3,3,0,0,3,-1,0,3,0,1,3,2,3,-1,3,3,3,0,0,3,-3,0,3,0,1,3,2,3,-2,3,4,7,8,4,6,6,3,6,5,2,2,3,0,0,1,0,1,4,2,0,5,0,0,0,2,2,0,0,0,1,0,2,3,2,0,5,0,0,2,3,0,0,0,0,0,1,1,1,1,0,3,0,0,2,0,1,0,0,0,0,1,1,1,1,0,3,0,0,2,0,2,0,0,0,0,0,1,1,0,0,0,0,0,2,1,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,buffer,0,0,1,-1,0,3,1,0,2,0,0,-2,2,1,0,0,0,1,-1,1,2,1,0,2,0,0,0,3,-2,0,0,0,0,0,1,-1,0,0,0,0,0,2,1,1,0,buffer,1,1,3,2,4,3,buffer,0,1.2,0.2,0.2,1,0.2,0.2,-0.2,0.8,buffer,1.666666667,3,0.466666667,0.466666667,0.266666667,buffer,0,1,2,1,4,2,0.4,2.2,0.8,0.6,2,1,0.4,1,0.6,0.4,1,0.8,0.2,0.2,1,0,0.4,0.2,buffer,C_Ug +5,R_1g74XahwnlCiayZ,39 - 45,Canadian,Male,Male,Professional Degree (ex. JD/MD),45,01PfPsV,02FUT,5,02DGEN,0.625,0,0.666666667,1,2,3,2,3,0,0,-1,1,1,2,1,2,2,2,1,2,3,3,3,0,1,0,1,1,1,2,2,1,1,2,2,3,3,2,3,0,3,3,3,1,2,1,2,1,2,3,3,3,3,3,2,1,3,3,1,1,2,2,2,3,3,3,3,3,1,0,0,2,1,2,2,3,2,2,5,4,5,3,9,8,6,6,5,6,5,5,0,0,0,1,0,0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,3,0,4,2,2,1,1,1,0,1,1,1,0,1,0,3,2,2,2,2,1,0,0,0,0,2,1,0,1,0,1,0,1,1,0,0,1,1,0,0,1,0,0,0,1,3,1,3,2,2,0,0,1,1,0,1,0,0,0,0,2,2,1,1,2,1,1,1,0,0,buffer,-1,-1,0,0,0,-3,-1,-1,-2,-2,0,1,0,1,1,-1,-1,0,0,1,2,0,3,1,2,1,0,0,0,1,0,0,0,0,1,1,-1,2,1,0,-1,-1,0,1,0,buffer,-1,-2,0,-3,4,3,buffer,-0.4,-1.8,0.6,-0.2,1.6,0.4,0.2,0.6,-0.2,buffer,-1,1.333333333,-0.533333333,0.6,0.2,buffer,2,5,3,0,1,0,0.2,0.4,0.8,0.6,2.2,0.8,0.6,2.2,0.2,0.8,0.6,0.4,0.4,2.2,0.4,0.2,1.6,0.6,buffer,grad_prof +6,R_6fe14R7rESSUJN8,39 - 45,Canadian,Male,Male,University - Graduate (Masters),40,03VPfPs,01PAST,10,02DGEN,0.75,0.666666667,0.333333333,3,2,2,1,2,1,0,-2,0,1,2,3,2,2,2,2,2,1,2,2,3,1,2,1,2,2,2,2,2,1,2,1,1,2,0,3,1,2,2,2,2,2,1,2,1,1,2,2,3,2,2,3,1,2,3,1,2,1,3,2,2,2,2,3,1,2,2,3,2,1,2,3,1,2,2,7,7,7,6,7,7,7,8,8,8,8,7,1,0,1,1,0,2,1,4,1,1,0,1,0,0,1,1,1,1,1,2,2,1,4,2,1,0,1,1,0,1,2,0,0,2,0,1,3,3,2,2,1,1,1,1,0,1,0,0,2,1,1,2,5,2,0,0,0,1,0,0,0,1,0,0,2,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,1,2,0,2,1,1,0,1,0,buffer,-1,0,1,-1,0,1,-2,1,-1,-1,-1,0,-1,-1,1,0,1,1,-1,1,1,-1,-1,0,1,0,1,0,0,1,-1,1,0,0,1,0,-1,-2,1,-2,-1,-1,1,-1,0,buffer,0,-1,-1,-2,-1,0,buffer,-0.2,-0.4,-0.4,0.4,0,0.4,0.2,-0.8,-0.4,buffer,-0.666666667,-1,-0.333333333,0.266666667,-0.333333333,buffer,1,0,0,1,0,1,0.6,1.8,0.4,1.2,2,0.6,0.8,2.2,0.8,0.8,2,0.2,0.6,0.2,0.2,0.4,1,0.6,buffer,grad_prof +7,R_7Pui4pm8cmzgDXj,60 - 66,American,Female,Female,High School (or equivalent),63,02PsVPf,01PAST,5,02DGEN,1,0,0.666666667,1,3,2,1,-3,0,-1,0,0,0,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,1,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,0,0,2,3,2,2,2,0,0,0,0,0,0,2,0,0,0,2,3,2,2,2,0,0,0,0,0,0,1,0,0,0,2,3,2,2,2,0,0,0,0,0,0,1,0,0,0,2,3,2,2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,0,0,0.2,0,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.2,2.2,0,0.4,2.2,0,0.2,2.2,0,0.2,2.2,0,0.2,0,0,0,0,0,buffer,HS_TS +8,R_1Wu9n4mwQfPZt70,53 - 59,Canadian,Male,Male,College Diploma/Certificate,54,01PfPsV,02FUT,10,02DGEN,-0.25,0,1,0,2,2,1,-1,-1,-2,1,-3,1,1,1,2,-2,2,-2,2,2,2,-2,1,-2,2,-2,1,2,1,2,-2,2,-1,2,2,1,-1,1,-2,1,-2,1,2,1,1,-2,2,-1,2,2,2,-2,1,-2,1,-2,1,2,1,2,-2,1,-1,1,2,2,-2,0,-3,1,-2,1,2,1,1,-3,2,2,2,3,2,3,3,3,3,3,4,2,4,2,0,0,1,1,2,0,1,1,0,1,0,0,0,0,1,0,0,0,0,2,0,0,1,0,1,0,1,0,0,1,0,0,1,1,2,0,0,1,0,1,0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,1,1,buffer,1,0,0,0,0,0,0,1,0,0,0,0,0,0,-1,0,-1,0,-1,-1,1,-1,0,0,0,0,0,0,-1,0,1,-1,0,1,1,-1,-1,1,0,0,0,0,0,-1,-1,buffer,-1,-1,0,-2,1,-1,buffer,0.2,0.2,-0.2,-0.6,0,-0.2,0.4,-0.2,-0.4,buffer,-0.666666667,-0.666666667,0.066666667,-0.266666667,-0.066666667,buffer,0,1,0,1,1,1,0.8,0.8,0.2,0.2,0.6,0.4,0.6,0.6,0.4,0.8,0.6,0.6,0.6,0.2,0.2,0.2,0.4,0.6,buffer,C_Ug +9,R_6i2zpvwYiLG1DQB,67 - 73,Canadian,Female,Female,College Diploma/Certificate,70,03VPfPs,01PAST,5,02DGEN,0.125,0,1,3,3,2,-1,3,2,-3,2,-2,2,1,2,2,0,2,3,2,2,-2,3,2,-3,2,-3,2,2,2,2,0,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,-1,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,0,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,-1,2,3,2,2,2,2,2,2,1,2,2,1,2,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,1,-1,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,buffer,1,1,0,0,1,0,buffer,0,0,0,0,0,0,0.4,0.4,0,buffer,0.666666667,0.333333333,0,0,0.266666667,buffer,1,0,0,0,0,0,0.4,0.2,0.2,0.4,0.2,0.4,0.4,0.2,0.2,0.4,0.2,0.4,0.4,0.4,0.2,0,0,0.2,buffer,C_Ug +10,R_3RUgu1bPops7kT4,53 - 59,Canadian,Female,Female,University - Undergraduate,53,02PsVPf,02FUT,10,02DGEN,0.25,0.333333333,0.666666667,2,3,-3,2,0,1,0,0,2,0,-3,2,2,0,2,2,2,2,2,0,1,2,0,3,0,-2,3,2,1,2,2,3,0,2,0,2,2,0,3,0,0,3,2,-2,2,0,3,-3,2,0,2,0,0,3,0,0,3,2,2,2,2,3,-3,2,0,0,0,0,3,0,0,2,-2,2,2,7,2,8,1,1,1,1,1,7,5,5,5,0,1,5,0,0,0,2,0,1,0,1,1,0,1,0,0,0,3,0,0,1,2,0,1,0,3,1,0,2,0,2,0,0,0,0,1,0,0,1,0,3,1,0,2,0,0,0,0,0,0,1,0,0,1,0,3,0,4,2,0,0,1,2,0,0,1,0,0,0,0,2,0,0,3,0,2,0,0,0,0,2,0,0,0,0,0,1,4,0,0,buffer,-2,1,5,0,0,-1,2,0,0,0,-2,0,0,-1,0,0,0,3,0,0,0,2,0,0,0,0,1,-4,0,0,-2,1,2,0,0,-1,0,0,0,0,2,-1,-4,3,0,buffer,6,1,1,-4,-4,-4,buffer,0.8,0.2,-0.6,0.6,0.4,-0.6,0.2,-0.2,0,buffer,2.666666667,-4,0.133333333,0.133333333,0,buffer,6,1,7,4,4,2,1.2,0.6,0.6,0.6,0.8,1.2,0.4,0.4,1.2,0,0.4,1.8,0.6,0.2,1,0.4,0.4,1,buffer,C_Ug +11,R_6V7RxG1JjWlv3jk,60 - 66,Canadian,Female,Female,College Diploma/Certificate,65,03VPfPs,02FUT,5,02DGEN,0.5,0,1,3,3,3,3,3,2,-3,3,1,2,3,1,3,2,3,3,3,3,3,3,3,-3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,2,2,3,3,3,3,3,3,3,3,3,3,2,-3,3,2,2,3,3,3,2,3,1,1,1,1,1,1,2,2,2,1,1,1,0,0,0,0,0,1,0,0,0,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,0,0,2,0,1,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,-1,0,0,1,0,0,0,0,-1,0,buffer,-1,-1,-1,0,0,0,buffer,0,0,0,0,0.4,0.2,0,0,-0.2,buffer,-1,0,0,0.2,-0.066666667,buffer,0,0,0,1,1,1,0,0.4,0.6,0,0.6,0.6,0,0.4,0.6,0,0.2,0.4,0,0.2,0,0,0.2,0.2,buffer,C_Ug +12,R_1ikIQD6LGveLkIh,67 - 73,American,Female,Female,College Diploma/Certificate,68,01PfPsV,01PAST,5,02DGEN,-0.125,0.333333333,0.333333333,3,2,3,1,-1,-1,-3,2,-2,0,2,3,3,-1,3,3,3,3,-1,-1,-2,-3,2,-2,-1,2,3,3,-1,3,3,3,3,-2,-1,-2,-3,2,-3,-1,2,3,3,-1,3,3,3,3,2,-1,-1,-3,2,-3,-1,2,3,3,0,3,3,3,3,2,0,-2,-3,2,-3,-1,2,3,3,0,3,1,2,1,1,1,1,1,1,1,1,1,1,0,1,0,2,0,1,0,0,0,1,0,0,0,0,0,0,1,0,3,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,1,1,1,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,1,0,0,-1,0,0,0,0,-1,0,0,0,0,2,-1,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,-1,-1,0,0,1,0,0,0,0,0,0,buffer,0,1,0,0,0,0,buffer,0.2,0,-0.2,0.2,0,-0.2,0,0,0,buffer,0.333333333,0,0,0,0,buffer,0,1,0,0,0,0,0.6,0.4,0,0.8,0.6,0,0.4,0.4,0.2,0.6,0.6,0.2,0.2,0.2,0,0.2,0.2,0,buffer,C_Ug +13,R_5QuIeM0sAhThWni,67 - 73,American,Female,Female,High School (or equivalent),67,01PfPsV,02FUT,10,02DGEN,0.375,0,1,2,2,2,-2,-2,0,-2,2,-3,1,2,2,2,0,2,2,2,2,2,-3,0,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,-3,2,2,2,2,2,2,7,8,8,7,7,7,7,7,7,6,7,7,0,0,0,4,1,0,0,0,5,1,0,0,0,2,0,0,0,0,4,4,2,4,0,5,1,0,0,0,0,0,0,0,0,4,4,2,4,0,5,1,0,0,0,2,0,0,0,0,4,0,2,0,0,0,1,0,0,0,2,0,0,0,0,0,5,2,4,0,0,0,0,0,0,2,0,0,0,0,0,4,0,4,0,5,0,0,0,0,0,0,buffer,0,0,0,0,-3,-2,-4,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,5,0,0,0,0,-2,0,0,0,0,0,1,2,0,0,-5,0,0,0,0,2,0,buffer,0,1,1,1,0,0,buffer,-0.6,-1.2,0,0.8,1.8,-0.4,0.2,-0.6,0.4,buffer,0.666666667,0.333333333,-0.6,0.733333333,1.85E-17,buffer,0,1,1,1,0,0,1,1.2,0.4,1.6,2.4,0,1.6,2.4,0.4,0.8,0.6,0.4,1,1.2,0.4,0.8,1.8,0,buffer,HS_TS +14,R_5GjMpIE4fiRenKy,67 - 73,American,Female,Female,College Diploma/Certificate,68,01PfPsV,02FUT,10,02DGEN,-0.625,0,1,-2,2,2,-2,3,2,-2,3,-3,1,2,2,2,-2,0,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-2,2,-2,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,1,1,1,1,1,1,5,0,0,6,5,5,0,0,0,0,1,0,1,1,0,1,0,0,0,0,2,0,0,0,0,1,0,0,1,1,1,0,0,0,0,2,0,0,0,0,1,0,1,1,0,1,0,0,0,0,2,0,0,0,0,1,0,1,1,0,1,0,0,0,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,buffer,-4,1,1,-5,-4,-4,buffer,0,0,0,0,0,0,0,0.4,0,buffer,-0.666666667,-4.333333333,0,0,0.133333333,buffer,0,0,0,1,5,5,0.2,0.6,0.4,0.2,0.6,0.4,0.2,0.6,0.4,0.2,0.6,0.4,0,0.4,0,0,0,0,buffer,C_Ug +15,R_1Dtp6HBUUIvqJ34,60 - 66,Canadian,Female,Female,High School (or equivalent),64,03VPfPs,02FUT,5,01ITEM,-0.25,0.333333333,0.666666667,1,2,3,-1,-3,-3,0,2,1,1,1,-1,3,0,3,3,3,3,-1,-3,-2,2,3,3,-2,2,1,3,-3,3,3,3,3,0,-3,-2,1,2,2,0,2,2,2,-3,3,1,2,3,1,-3,-2,2,-1,2,-3,0,1,-1,-2,3,1,2,3,2,-3,-3,3,2,3,-2,1,3,3,-3,3,3,1,1,2,3,1,2,3,5,2,6,1,2,1,0,0,0,1,2,1,2,3,1,2,0,3,0,2,1,0,1,0,1,1,0,1,1,1,3,1,3,0,0,0,0,2,0,1,2,3,1,4,1,2,4,2,0,0,0,0,3,0,0,3,0,2,3,0,4,0,3,0,0,0,0,1,0,0,1,1,1,2,0,1,1,0,0,0,0,0,1,0,1,1,3,1,1,1,2,4,1,0,buffer,2,1,0,-2,0,0,0,-2,1,-1,0,0,-4,1,0,2,1,0,-2,0,1,-2,0,-1,-2,1,-1,1,0,0,0,0,0,0,0,-1,0,-2,0,1,-1,-1,-3,-1,0,buffer,1,-2,-4,0,-3,0,buffer,0.2,-0.4,-0.6,0.2,-0.8,0.2,0,-0.4,-1.2,buffer,-1.666666667,-1,-0.266666667,-0.133333333,-0.533333333,buffer,1,2,0,0,3,4,0.6,1.8,1.2,0.8,0.8,1.6,0.4,2.2,1.8,0.6,1.6,1.4,0.2,1,0.4,0.2,1.4,1.6,buffer,HS_TS +16,R_1ktjEcLLJRW45MZ,53 - 59,Canadian,Female,Female,University - Undergraduate,54,01PfPsV,01PAST,10,01ITEM,-0.5,0.333333333,0.666666667,3,2,2,2,1,3,-3,1,-1,2,3,-2,3,-3,3,3,3,2,1,2,3,-3,-3,-3,3,1,-2,3,-3,3,3,3,-2,-3,3,3,-3,-2,-3,3,-2,-2,3,-2,3,3,-1,3,2,-2,3,-3,-3,-3,3,3,-3,3,-3,3,3,-2,3,3,-2,2,-3,-2,-3,3,3,-2,3,-3,3,2,1,1,7,2,4,3,0,0,6,1,1,0,1,0,1,1,0,0,4,2,1,2,0,0,0,0,0,1,4,5,2,0,0,3,2,1,5,0,0,1,0,0,3,1,0,3,0,0,4,2,1,0,1,0,0,0,0,4,1,1,3,1,0,3,2,1,0,0,0,0,0,0,0,4,4,1,0,0,1,0,0,3,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,buffer,0,-2,-1,1,-2,0,0,0,0,0,2,-1,0,0,0,0,-3,3,4,-1,-1,0,0,0,0,5,0,0,1,0,0,-1,4,3,1,-1,0,0,0,0,3,-1,0,1,0,buffer,-1,1,1,1,1,3,buffer,-0.8,0,0.2,0.6,-0.2,1.2,1.4,-0.2,0.6,buffer,0.333333333,1.666666667,-0.2,0.533333333,0.6,buffer,5,1,3,3,1,1,0.6,1.4,0.4,2.4,1.2,1.2,1.4,1.4,0.2,1.8,1.4,0,1.8,0.2,0.8,0.4,0.4,0.2,buffer,C_Ug +17,R_1z96qjJwdFG3cnD,60 - 66,Canadian,Female,Female,University - Undergraduate,61,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,-2,-2,-2,-2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,4,4,5,5,8,7,8,5,6,5,3,3,3,3,3,5,1,5,1,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,0,0,0,2,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,3,0,3,0,3,3,3,1,3,buffer,0,0,0,0,0,2,1,2,1,2,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-1,2,-1,2,-3,-3,-3,-1,-3,buffer,-3,-2,-4,-1,-1,0,buffer,0,1.6,2.6,0,0,0,0,0.8,-2.6,buffer,-3,-0.666666667,1.4,0,-0.6,buffer,1,0,1,3,1,3,3,3.4,3,3,3,3,3,1.8,0.4,3,3,3,0,2,0,0,1.2,2.6,buffer,C_Ug +18,R_3rO0N9nfawPgMdW,60 - 66,Canadian,Female,Female,University - Undergraduate,60,02PsVPf,01PAST,5,01ITEM,0,0.666666667,0.333333333,-1,1,3,-1,1,1,-3,2,-3,1,1,1,1,1,1,0,0,0,0,0,1,-3,1,-3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,1,1,3,1,1,0,0,1,0,0,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,1,1,1,1,1,0,0,0,0,0,1,3,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-1,-3,-1,-3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,1,3,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-1.8,0,0,0,0,0,1.8,0,buffer,0,0,-0.6,0,0.6,buffer,0,0,0,0,0,0,1.4,0.2,1,1.4,2,1,1.4,2,1,1.4,2,1,0,1.8,0,0,0,0,buffer,C_Ug +19,R_11oBW0skPXtpXIv,53 - 59,Canadian,Female,Female,University - Graduate (Masters),57,03VPfPs,02FUT,10,01ITEM,0,0.666666667,0.333333333,3,2,2,1,2,-3,-2,2,1,1,2,-2,3,0,3,2,2,3,0,1,-3,-2,2,1,0,2,-1,2,0,2,2,2,3,0,2,-3,-2,2,2,0,2,-1,2,1,2,3,2,2,1,2,-3,-3,2,0,1,2,-2,3,-2,3,3,2,2,1,1,-3,-2,1,-2,1,2,0,3,0,3,1,1,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,0,0,0,0,1,0,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,2,0,0,0,0,0,1,0,0,1,3,0,0,2,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,1,2,0,0,2,0,2,0,buffer,1,0,1,1,1,0,-1,0,-1,1,0,1,1,-2,1,1,0,1,1,-1,0,0,-1,-2,1,0,-1,1,1,1,0,0,0,0,0,0,-1,-1,-1,0,0,-2,0,-1,0,buffer,1,0,1,0,0,1,buffer,0.8,-0.2,0.2,0.4,-0.4,0.4,0,-0.6,-0.6,buffer,0.666666667,0.333333333,0.266666667,0.133333333,-0.4,buffer,0,0,0,1,0,0,0.8,0.2,0.6,0.6,0.4,0.8,0,0.4,0.4,0.2,0.8,0.4,0.2,0.2,0.2,0.2,0.8,0.8,buffer,grad_prof +20,R_7Cqyd4rdpJbp2XA,39 - 45,Canadian,Male,Male,College Diploma/Certificate,40,02PsVPf,02FUT,5,01ITEM,0.375,0.666666667,0.333333333,2,3,2,-1,3,-3,-3,1,-3,2,2,0,3,1,2,3,3,3,0,3,2,-3,3,-3,3,3,2,2,3,2,3,3,3,0,3,2,-3,3,-3,3,2,2,3,2,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,3,3,3,0,2,1,-3,3,-3,2,3,3,3,3,3,0,2,2,1,1,1,0,0,1,2,2,0,1,0,1,1,0,5,0,2,0,1,1,2,1,2,0,1,0,1,1,0,5,0,2,0,1,0,2,0,1,1,1,0,1,1,0,3,3,1,3,2,2,0,3,1,2,1,0,1,1,1,4,0,2,0,0,1,3,0,2,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,3,3,3,2,3,3,3,3,3,buffer,0,0,0,0,0,2,-3,1,-3,-1,-1,2,-2,1,-2,0,0,0,0,-1,1,0,0,0,1,-1,-1,0,-1,0,0,0,0,0,-1,-1,-3,-3,-3,-2,-2,-3,-2,-2,-2,buffer,0,2,1,-1,-1,1,buffer,0,-0.8,-0.4,-0.2,0.4,-0.6,-0.2,-2.4,-2.2,buffer,1,-0.333333333,-0.4,-0.133333333,-1.6,buffer,1,1,1,2,2,1,0.6,1.6,1.2,0.6,1.6,0.8,0.6,2.4,1.6,0.8,1.2,1.4,0,0,0.8,0.2,2.4,3,buffer,C_Ug +21,R_3GWBRFzkpJqGUh3,60 - 66,Canadian,Female,Female,University - Undergraduate,63,03VPfPs,01PAST,10,02DGEN,0.5,0.333333333,0.666666667,2,2,3,1,2,-1,-1,1,-1,-1,2,2,2,2,2,-1,2,3,3,-1,-1,-1,2,-1,-1,2,2,2,2,2,-1,-1,3,3,-1,-1,-1,2,-1,-1,2,2,2,2,2,2,2,2,3,-1,-1,-1,1,-1,-1,2,2,2,2,2,2,2,2,3,-1,-1,1,1,-1,-1,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5,5,5,3,0,0,2,3,0,0,1,0,0,0,0,0,0,0,3,3,0,2,3,0,0,1,0,0,0,0,0,0,0,0,0,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,buffer,3,0,-1,0,0,0,0,1,0,0,0,0,0,0,0,3,3,-1,0,0,0,-2,1,0,0,0,0,0,0,0,0,3,0,0,0,0,-2,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.4,0.2,0,1,-0.2,0,0.6,-0.4,0,buffer,0,0,0.2,0.266666667,0.066666667,buffer,0,0,0,0,0,0,1.6,0.2,0,2.2,0.2,0,1.2,0,0,1.2,0.4,0,0.6,0,0,0,0.4,0,buffer,C_Ug +22,R_51YHqKEJJENxnsT,67 - 73,Canadian,Female,Female,College Diploma/Certificate,72,01PfPsV,01PAST,5,02DGEN,0.125,0,1,2,3,3,2,3,0,0,2,0,0,1,0,1,0,3,2,3,3,2,3,0,0,2,0,0,2,0,0,0,2,2,3,3,2,3,0,0,2,0,0,2,2,0,0,3,2,3,3,3,2,0,0,0,0,0,2,0,0,0,3,3,3,3,3,2,0,0,2,0,0,2,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,0,0,2,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,buffer,0,0,0,-1,-1,0,0,-2,0,0,0,0,0,0,1,-1,0,0,-1,-1,0,0,0,0,0,0,2,0,0,0,-1,0,0,0,0,0,0,-2,0,0,0,2,0,0,1,buffer,0,0,0,0,0,0,buffer,-0.4,-0.4,0.2,-0.6,0,0.4,-0.2,-0.4,0.6,buffer,0,0,-0.2,-0.066666667,-1.85E-17,buffer,0,0,0,0,0,0,0,0,0.6,0,0,0.8,0.4,0.4,0.4,0.6,0,0.4,0,0,0.6,0.2,0.4,0,buffer,C_Ug +23,R_1knRqoe1tDTO7yI,60 - 66,Canadian,Male,Male,High School (or equivalent),65,01PfPsV,01PAST,10,02DGEN,0,0.333333333,0.666666667,1,1,1,1,1,0,1,1,-1,0,0,0,0,0,0,1,1,1,1,1,-1,0,1,-1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,-1,0,0,0,0,0,0,1,1,1,1,-1,0,0,-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,4,4,4,5,4,3,4,4,4,4,3,4,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,buffer,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,-1,0,0,1,0,1,0,0,0,0,0,buffer,0,0,0,1,1,-1,buffer,-0.2,-0.2,0,-0.4,0.2,0,-0.2,0.4,0,buffer,0,0.333333333,-0.133333333,-0.066666667,0.066666667,buffer,1,0,1,0,1,0,0,0.4,0,0,0.8,0,0.2,0.6,0,0.4,0.6,0,0,0.8,0,0.2,0.4,0,buffer,HS_TS +25,R_16kmB5kTriqlNwl,60 - 66,Canadian,Male,Male,High School (or equivalent),64,01PfPsV,02FUT,10,02DGEN,0.5,0,1,-1,1,1,-1,1,1,-2,1,0,-2,1,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,-2,1,3,0,3,1,0,2,1,-2,1,1,1,1,1,-3,0,3,1,1,0,1,1,0,-2,1,1,2,1,1,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,2,0,0,3,0,1,3,0,1,2,1,0,2,0,1,2,0,0,3,0,1,3,0,1,2,1,0,1,0,2,1,2,0,2,1,1,0,0,1,2,1,0,2,1,2,2,0,1,3,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,2,1,1,1,1,0,0,0,1,0,0,buffer,1,0,-2,1,-2,0,1,-1,0,3,0,0,0,0,0,0,-1,-1,0,0,-1,0,0,1,3,0,0,1,0,0,-1,-1,1,-1,-2,-1,-1,-1,-1,0,0,0,-1,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0.6,0,-0.4,0.6,0.2,-0.8,-0.8,-0.2,buffer,0,0,0.066666667,0.133333333,-0.6,buffer,0,0,0,0,0,0,0.8,1.4,0.8,1,1.4,0.8,1.2,0.8,0.8,1.4,0.8,0.6,0.2,0,0,1,0.8,0.2,buffer,HS_TS +26,R_178SNJMlkqAz6qK,60 - 66,Canadian,Female,Female,High School (or equivalent),63,03VPfPs,02FUT,10,01ITEM,0.5,0.666666667,0.333333333,0,1,2,2,2,1,1,2,2,1,2,2,2,2,2,0,1,1,2,2,1,1,1,1,1,1,1,1,1,1,0,1,1,2,2,1,1,1,2,1,2,2,2,2,2,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,1,2,3,1,1,1,1,1,2,2,2,2,2,7,7,7,7,7,7,7,7,7,7,7,7,0,0,1,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,buffer,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,-1,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0,-0.2,-0.2,0,-0.4,0.2,0,buffer,0,0,-0.066666667,-0.133333333,-0.066666667,buffer,0,0,0,0,0,0,0.2,0.4,1,0.2,0.2,0,0.4,0.4,1,0.4,0.4,0,0,0.2,1,0.4,0,1,buffer,HS_TS +27,R_5TWWxJFZ6ORvZKs,67 - 73,Canadian,Female,Female,University - Graduate (Masters),67,03VPfPs,01PAST,5,02DGEN,-0.125,1,0,3,1,1,-3,1,0,-3,2,-3,1,2,-2,3,2,3,2,2,1,-3,1,1,-2,2,-2,1,2,-2,3,2,2,3,1,1,-3,2,2,-3,2,-3,2,2,-1,2,2,2,3,2,2,-2,2,1,-3,2,-2,2,2,-2,3,3,3,3,2,2,-2,1,1,-3,2,-3,2,2,-1,3,2,3,6,6,4,7,7,7,3,2,6,2,2,2,1,1,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,2,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,buffer,1,0,-1,-1,-1,0,1,0,0,-1,0,0,0,-1,1,0,-1,-1,-1,1,1,0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,-1,0,buffer,3,4,-2,5,5,5,buffer,-0.4,0,0,-0.4,0.2,0.4,0.4,0.6,0,buffer,1.666666667,5,-0.133333333,0.066666667,0.333333333,buffer,1,1,3,1,0,4,0.4,0.6,0.2,0.2,0.6,0.6,0.8,0.6,0.2,0.6,0.4,0.2,0.6,0.8,0.4,0.2,0.2,0.4,buffer,grad_prof +28,R_3OsrskvBYHuEQZX,39 - 45,Canadian,Male,Male,University - Graduate (Masters),42,02PsVPf,01PAST,10,01ITEM,0.75,0.333333333,0.666666667,-2,2,2,-2,2,0,1,2,0,3,0,1,2,0,1,-2,2,1,-2,0,0,0,2,-1,0,0,0,2,0,1,-2,2,1,-2,0,0,-2,2,-1,2,0,0,2,0,1,-2,2,2,-2,2,0,0,2,-2,2,1,0,2,-1,2,-2,2,2,-2,2,0,0,2,-2,2,1,0,2,-1,2,3,4,3,3,4,4,3,3,3,3,3,3,0,0,1,0,2,0,1,0,1,3,0,1,0,0,0,0,0,1,0,2,0,3,0,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,2,1,1,1,0,1,1,0,0,0,0,0,0,1,0,2,1,1,1,0,1,1,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,1,0,2,0,0,0,-1,2,-1,0,0,-1,-1,0,0,1,0,2,0,2,0,-1,0,-1,0,0,-1,-1,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,buffer,0,1,0,0,1,1,buffer,0.6,0.2,-0.6,0.6,0.2,-0.6,0,0.8,0,buffer,0.333333333,0.666666667,0.066666667,0.066666667,0.266666667,buffer,0,0,1,0,0,0,0.6,1,0.2,0.6,1,0.2,0,0.8,0.8,0,0.8,0.8,0,0.8,0,0,0,0,buffer,grad_prof +29,R_72UXwfr2cJYIU81,67 - 73,Canadian,Male,Male,College Diploma/Certificate,71,01PfPsV,01PAST,10,02DGEN,-0.25,1,0,-1,1,3,-1,1,-2,-3,3,-3,0,3,1,3,-3,3,-1,1,3,-1,1,-3,-3,3,-3,0,3,2,3,-3,3,-1,1,3,-1,3,-3,-3,3,-3,1,3,2,3,-3,3,0,0,2,1,0,-3,0,1,-3,0,3,1,2,-3,3,0,1,3,1,-1,0,0,-1,0,0,3,0,3,-3,3,0,0,0,1,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,1,0,1,0,0,0,1,1,1,2,1,1,3,2,0,0,0,0,1,0,0,1,0,0,2,2,2,3,4,3,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,3,0,2,3,0,0,1,1,0,0,buffer,-1,-1,-1,-2,-1,0,-3,-2,0,0,0,1,-1,0,0,-1,0,0,-2,0,-1,-3,-4,-3,1,0,0,0,0,0,0,-1,-1,0,1,-3,0,-2,-3,1,0,-1,-1,0,0,buffer,0,0,0,1,0,5,buffer,-1.2,-1,0,-0.6,-2,0,-0.2,-1.4,-0.4,buffer,0,2,-0.733333333,-0.866666667,-0.666666667,buffer,1,0,5,0,0,0,0,0.2,0.2,0.4,0.4,0.2,1.2,1.2,0.2,1,2.4,0.2,0.4,0.2,0,0.6,1.6,0.4,buffer,C_Ug +30,R_1EbeN9UHK0dbvBg,67 - 73,Canadian,Male,Male,Trade School (non-military),71,01PfPsV,01PAST,5,01ITEM,0.5,0.333333333,0.666666667,1,3,3,2,1,1,1,1,0,1,2,2,2,2,2,2,2,2,2,0,1,1,1,0,1,2,2,1,0,1,2,3,3,2,0,1,1,0,1,2,2,2,2,2,2,3,3,3,3,1,1,1,1,1,1,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,1,1,1,1,1,8,8,7,6,9,6,8,9,5,9,8,8,1,1,1,0,1,0,0,0,0,0,0,0,1,2,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,0,2,0,0,1,0,0,0,0,1,0,2,2,2,2,2,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,0,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,buffer,-1,1,1,-1,1,0,0,0,-1,0,-2,-2,-1,0,-1,0,-1,-1,0,0,-1,-1,0,1,0,-1,-1,-1,-1,-1,-1,0,0,-1,-1,-1,-1,0,0,0,-1,-1,0,1,0,buffer,0,-1,2,-3,1,-2,buffer,0.2,-0.2,-1.2,-0.4,-0.2,-1,-0.6,-0.4,-0.2,buffer,0.333333333,-1.333333333,-0.4,-0.533333333,-0.4,buffer,2,1,1,1,1,3,0.8,0,0.8,0.4,0.6,0,0.6,0.2,2,0.8,0.8,1,0.4,0.6,0.8,1,1,1,buffer,HS_TS +31,R_6E0JAaiEmjZbWTn,67 - 73,Canadian,Female,Female,High School (or equivalent),67,03VPfPs,02FUT,5,02DGEN,0.25,0,0.333333333,3,3,3,-3,2,2,-2,0,-3,-1,3,3,3,-1,1,3,3,3,-3,1,3,-3,2,-3,0,3,3,3,-1,1,3,3,3,-3,2,3,-3,0,-3,0,3,3,3,1,1,3,3,3,-3,-1,3,-3,2,-3,0,3,3,3,-1,1,3,3,3,-3,-1,3,-3,3,-3,0,3,3,3,-1,0,2,2,2,3,2,2,1,2,8,2,2,2,0,0,0,0,1,1,1,2,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,2,0,0,0,0,0,3,1,1,2,0,1,0,0,0,0,0,0,0,0,0,3,1,1,3,0,1,0,0,0,0,1,0,0,0,0,1,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,buffer,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,-3,0,0,0,0,0,2,-1,0,0,0,0,1,0,0,1,0,0,0,0,0,2,-1,buffer,1,0,-6,1,0,0,buffer,-0.4,0,0,-0.6,-0.6,0.2,0.2,0.2,0.2,buffer,-1.666666667,0.333333333,-0.133333333,-0.333333333,0.2,buffer,1,0,0,1,0,6,0.2,1,0,0,0.6,0.4,0.6,1,0,0.6,1.2,0.2,0.2,0.4,0.4,0,0.2,0.2,buffer,HS_TS +32,R_3GqfnDGO35wRWf0,67 - 73,Canadian,Male,Male,University - Undergraduate,71,02PsVPf,02FUT,10,02DGEN,-0.625,0.333333333,0.666666667,3,1,3,1,-3,1,-2,2,3,1,2,2,1,-2,0,2,2,2,2,0,-2,0,-1,3,-2,2,2,2,0,1,2,2,2,1,1,1,-2,3,1,2,3,3,3,3,2,2,2,3,2,-2,1,-2,2,3,-2,2,2,2,-2,1,3,3,3,3,-3,-2,-3,1,3,-2,2,2,2,-2,2,2,3,1,4,9,5,4,0,1,2,3,5,1,1,1,1,3,3,2,3,0,3,0,0,1,2,1,1,1,1,0,4,0,0,1,2,1,1,1,2,5,2,1,1,0,1,1,0,0,0,0,3,0,0,1,0,1,0,2,0,2,0,3,1,1,0,3,0,0,1,0,2,0,0,0,1,1,3,2,4,2,4,1,1,1,3,1,1,1,0,1,1,3,1,1,0,0,0,0,0,0,1,buffer,0,0,1,0,2,3,2,3,0,0,0,0,0,2,0,1,-1,1,-2,4,-3,-1,0,2,-2,1,1,1,5,0,-1,-1,0,0,0,0,1,3,2,4,1,1,1,3,0,buffer,-2,3,0,2,6,0,buffer,0.6,1.6,0.4,0.6,-0.8,1.6,-0.4,2,1.2,buffer,0.333333333,2.666666667,0.866666667,0.466666667,0.933333333,buffer,2,6,4,2,3,4,1.4,2.2,0.8,1.4,0.8,2.2,0.8,0.6,0.4,0.8,1.6,0.6,0.4,3,1.4,0.8,1,0.2,buffer,C_Ug +33,R_1roQArTUr5xbbQs,53 - 59,Canadian,Male,Male,High School (or equivalent),56,01PfPsV,02FUT,5,01ITEM,0,0.333333333,0.333333333,1,3,1,1,3,1,1,2,0,2,1,1,2,0,3,1,3,-1,-1,3,2,2,2,-1,2,1,2,2,1,-1,1,3,1,-1,3,2,2,2,-1,2,1,2,2,1,-1,1,3,1,1,3,2,1,2,1,2,1,2,2,0,-1,1,3,2,2,3,1,1,2,0,2,1,2,2,0,-1,7,5,4,3,3,3,3,3,3,3,3,3,0,0,2,2,0,1,1,0,1,0,0,1,0,1,4,0,0,0,2,0,1,1,0,1,0,0,1,0,1,4,0,0,0,0,0,1,0,0,1,0,0,1,0,0,4,0,0,1,1,0,0,0,0,0,0,0,1,0,0,4,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,buffer,0,0,2,2,0,0,1,0,0,0,0,0,0,1,0,0,0,-1,1,0,1,1,0,1,0,0,0,0,1,0,0,0,1,-1,0,-1,0,0,-1,0,0,0,0,0,0,buffer,4,2,1,0,0,0,buffer,0.8,0.2,0.2,0,0.6,0.2,0,-0.4,0,buffer,2.333333333,0,0.4,0.266666667,-0.133333333,buffer,4,2,1,0,0,0,0.8,0.6,1.2,0.4,0.6,1.2,0,0.4,1,0.4,0,1,0.4,0,0,0.4,0.4,0,buffer,HS_TS +34,R_7VJf8j0xeT8tSlX,67 - 73,Canadian,Male,Male,University - Undergraduate,69,03VPfPs,02FUT,10,02DGEN,1.125,0.333333333,0.333333333,2,2,2,2,2,-2,-2,-2,-1,1,1,2,2,-2,2,2,2,2,2,2,0,-2,2,-2,1,0,2,2,0,2,2,2,2,2,2,0,-2,2,0,2,0,2,1,1,2,2,2,2,2,2,-2,-2,1,-2,1,0,2,2,0,2,2,2,2,2,2,0,-2,1,-2,1,-2,2,2,0,2,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,2,0,4,1,0,1,0,0,2,0,0,0,0,0,0,2,0,4,1,1,1,0,1,3,0,0,0,0,0,0,0,0,3,1,0,1,0,0,2,0,0,0,0,0,0,2,0,3,1,0,3,0,0,2,0,0,0,0,0,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,buffer,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,-2,0,1,1,0,0,0,0,0,0,-2,0,0,2,1,-2,0,1,1,0,buffer,0,0,0,0,0,0,buffer,0,0.6,0,0,0.4,0,0,0.2,0,buffer,0,0,0.2,0.133333333,0.066666667,buffer,0,0,0,0,0,0,0,1.4,0.6,0,1.6,1,0,0.8,0.6,0,1.2,1,0,0.6,0.4,0,0.4,0.4,buffer,C_Ug +35,R_3R5dVDIQi5KNKvv,39 - 45,Canadian,Male,Male,University - Undergraduate,40,02PsVPf,01PAST,5,02DGEN,-0.125,0,0.333333333,0,0,0,-1,1,-1,0,1,1,0,1,0,-1,2,0,0,0,1,-1,-1,0,1,1,0,-1,1,-1,0,-1,1,0,0,1,-1,-1,0,1,0,-1,-1,-1,1,0,-1,0,0,-1,0,0,1,1,-1,1,0,0,-1,-1,0,0,1,1,0,0,0,-1,1,-1,1,0,-2,0,1,2,-2,-1,6,2,7,8,5,7,4,8,5,5,1,6,0,0,1,0,2,1,1,0,1,1,0,1,1,3,1,0,0,1,0,2,1,1,1,2,1,2,1,1,3,0,0,1,0,1,0,2,1,0,1,0,2,1,1,2,1,1,0,0,1,2,2,1,0,1,2,1,1,3,4,1,0,0,0,0,0,0,0,1,1,0,2,2,0,0,1,1,1,0,0,2,0,0,0,0,2,1,2,2,2,2,buffer,0,-1,1,-1,2,-1,0,0,0,1,-2,0,0,1,0,-1,0,1,-1,0,-1,0,1,1,-1,1,0,-2,-1,-1,-1,-1,0,0,-2,0,0,1,1,-2,1,0,-2,-2,-1,buffer,2,-6,2,3,4,1,buffer,0.2,0,-0.2,-0.2,0,-0.6,-0.8,0,-0.8,buffer,-0.666666667,2.666666667,0,-0.266666667,-0.533333333,buffer,2,3,0,1,7,1,0.6,0.8,1.2,0.6,1.2,1.4,0.4,0.8,1.4,0.8,1.2,2,0,0.4,1,0.8,0.4,1.8,buffer,C_Ug +36,R_71YoY39t8fQWagj,67 - 73,Canadian,Male,Male,Trade School (non-military),67,01PfPsV,02FUT,5,02DGEN,0.25,0,1,1,1,2,1,-2,0,-1,1,-1,0,2,2,1,-1,1,2,2,2,-1,-3,-1,-1,1,-1,1,1,2,1,-1,1,2,2,2,-2,-3,-1,-1,1,-1,1,2,2,1,-1,0,1,1,2,1,-2,-1,-1,1,0,-1,1,1,1,-1,1,1,1,2,1,-2,1,-1,1,-1,1,2,1,1,-1,1,2,3,2,2,6,5,1,1,4,2,2,2,1,1,0,2,1,1,0,0,0,1,1,0,0,0,0,1,1,0,3,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,2,0,0,1,2,1,0,0,0,0,buffer,1,1,0,2,1,0,0,0,-1,0,0,-1,0,0,0,1,1,0,3,1,0,0,0,0,0,0,-1,0,0,1,0,0,0,1,0,-2,0,0,-1,-2,0,0,0,0,1,buffer,1,2,-2,0,4,3,buffer,1,-0.2,-0.2,1.2,0,0,0.2,-1,0.2,buffer,0.333333333,2.333333333,0.2,0.4,-0.2,buffer,0,3,3,1,1,2,1,0.4,0.2,1.2,0.4,0.2,0,0.6,0.4,0,0.4,0.2,0.2,0,0.4,0,1,0.2,buffer,HS_TS +37,R_7cuR9hbpAq3nAnE,39 - 45,Canadian,Female,Female,University - Graduate (Masters),41,02PsVPf,01PAST,10,01ITEM,1,0,1,3,3,3,2,3,0,-3,1,-1,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,2,2,2,3,3,2,3,3,2,2,2,2,2,2,2,2,-1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,6,6,6,6,5,6,6,6,6,6,6,6,0,0,0,1,0,3,6,2,4,3,0,0,0,0,0,1,0,0,0,0,2,5,1,3,2,0,0,1,0,0,1,1,1,0,1,2,5,1,0,2,1,1,1,1,1,0,0,0,1,0,3,6,2,4,3,0,0,0,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,4,1,1,1,1,1,1,buffer,-1,-1,-1,1,-1,1,1,1,4,1,-1,-1,-1,-1,-1,1,0,0,-1,0,-1,-1,-1,-1,-1,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,-3,0,-1,-1,0,-1,-1,buffer,0,0,0,0,-1,0,buffer,-0.6,1.6,-1,0,-1,0.2,-0.6,-0.6,-0.8,buffer,0,-0.333333333,3.70E-17,-0.266666667,-0.666666667,buffer,0,1,0,0,0,0,0.2,3.6,0,0.2,2.6,0.2,0.8,2,1,0.2,3.6,0,0.4,1,0.2,1,1.6,1,buffer,grad_prof +38,R_1pmqJMM4oQ6npwW,67 - 73,Canadian,Female,Female,High School (or equivalent),68,03VPfPs,02FUT,10,02DGEN,0.125,0,1,1,0,1,0,1,-2,-1,1,0,0,3,2,0,-3,3,2,1,2,2,3,-2,-2,1,-2,0,3,3,1,-3,3,2,1,2,2,2,-2,-2,2,-1,0,3,3,1,-3,3,2,1,2,2,1,-2,-2,1,0,0,3,3,1,-3,3,2,1,2,1,0,-3,-1,-1,1,-3,3,3,1,-3,3,0,1,1,1,0,0,1,0,0,2,1,6,1,1,1,2,2,0,1,0,2,0,0,1,1,0,0,1,1,1,2,1,0,1,1,1,0,0,1,1,0,0,1,1,1,2,0,0,1,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0,2,1,3,0,1,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,2,1,3,0,0,0,0,0,buffer,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,-1,1,-1,0,-3,0,0,0,0,0,0,0,0,-1,0,-1,-1,-1,0,-3,0,0,0,0,0,buffer,-1,1,1,-1,-1,-6,buffer,0.4,0.4,0,0.2,-0.8,0,-0.2,-1.2,0,buffer,0.333333333,-2.666666667,0.266666667,-0.2,-0.466666667,buffer,1,1,1,1,1,6,1.4,0.6,0.4,1.2,0.6,0.4,1,0.2,0.4,1,1.4,0.4,0.2,0.4,0,0.4,1.6,0,buffer,HS_TS +39,R_7uZCyK6Aaj5UCUp,46 - 52,Canadian,Male,Male,University - Undergraduate,47,03VPfPs,02FUT,10,02DGEN,0.5,0,1,0,1,1,2,3,0,1,1,-1,0,1,1,2,0,0,-1,1,1,0,3,0,1,1,-1,0,0,0,1,0,1,-1,2,1,0,3,0,1,1,-1,1,0,0,1,1,1,-1,1,-1,0,3,0,1,1,-1,1,0,0,1,1,0,-1,1,-1,0,3,0,1,1,-1,0,-1,0,2,1,0,6,7,6,6,6,6,5,6,5,6,6,7,1,0,0,2,0,0,0,0,0,0,1,1,1,0,1,1,1,0,2,0,0,0,0,0,1,1,1,1,1,1,1,0,2,2,0,0,0,0,0,1,1,1,1,1,0,1,0,2,2,0,0,0,0,0,0,2,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,buffer,0,0,-2,0,0,0,0,0,0,-1,0,0,0,-1,1,0,1,-2,0,0,0,0,0,0,1,-1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,-1,0,-1,1,0,buffer,1,1,1,0,0,-1,buffer,-0.4,-0.2,0,-0.2,0.2,0.2,0.2,0,-0.2,buffer,1,-0.333333333,-0.2,0.066666667,0,buffer,0,1,0,1,0,2,0.6,0,0.8,0.8,0.2,1,1,0.2,0.8,1,0,0.8,0.2,0.2,0.2,0,0.2,0.4,buffer,C_Ug +40,R_1LC0QxEHI6yw8Wv,60 - 66,Canadian,Male,Male,College Diploma/Certificate,64,02PsVPf,01PAST,10,02DGEN,0.125,0,1,-2,1,3,-1,3,-1,-3,2,-3,0,3,1,3,1,3,-2,2,3,-1,3,0,-3,2,-3,1,3,2,2,2,3,-2,2,3,-2,3,-1,-3,2,-1,1,3,1,1,3,3,-2,1,3,2,1,-1,1,1,1,-1,3,2,0,-1,3,-3,1,3,3,1,-2,1,2,1,-2,2,1,-1,-2,3,5,6,5,5,6,5,6,6,6,6,7,7,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,0,0,2,1,0,0,2,2,0,0,0,0,3,2,0,4,1,4,1,0,1,3,2,0,1,0,0,4,2,1,4,0,4,2,1,0,4,3,0,0,0,0,1,0,1,0,0,2,0,0,1,1,1,0,1,0,0,1,0,1,0,1,0,1,1,1,1,1,0,buffer,0,1,0,-3,-2,1,-4,-1,-4,0,0,0,-2,-1,0,-1,1,0,-3,-2,-1,-4,0,-2,-1,-1,0,-2,-1,0,-1,0,0,0,0,0,0,-1,2,-1,-1,0,0,0,0,buffer,-1,0,-1,-1,-1,-2,buffer,-0.8,-1.6,-0.6,-1,-1.6,-0.8,-0.2,0,-0.2,buffer,-0.666666667,-1.333333333,-1,-1.133333333,-0.133333333,buffer,0,0,0,0,1,1,0.2,0.4,0.6,0.4,0.6,0.8,1,2,1.2,1.4,2.2,1.6,0.2,0.6,0.6,0.4,0.6,0.8,buffer,C_Ug +41,R_6C9AQLLL5nQzlxj,67 - 73,Canadian,Female,Female,University - Undergraduate,68,01PfPsV,02FUT,10,01ITEM,0,0.333333333,0.666666667,3,3,2,1,3,3,-2,3,-1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,-2,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-2,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-2,3,3,0,3,-1,3,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,2,0,0,5,0,4,0,1,5,0,3,0,0,0,1,2,0,0,5,0,4,0,0,0,0,0,0,0,0,1,2,0,0,5,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,1,0,0,3,0,4,0,0,0,0,0,0,0,0,0,0,0,1,5,0,3,0,0,0,0,0,0,0,6,0,0,0,0,3,0,4,0,buffer,0,0,0,0,0,0,0,0,3,0,1,5,0,3,0,0,0,0,0,0,0,4,0,3,0,0,-3,0,-4,0,0,0,0,0,0,0,-6,0,0,0,1,2,0,-1,0,buffer,0,0,0,-1,-1,0,buffer,0,0.6,1.8,0,1.4,-1.4,0,-1.2,0.4,buffer,0,-0.666666667,0.8,0,-0.266666667,buffer,0,0,0,1,1,0,0.6,1.8,1.8,0.6,1.8,0,0.6,1.2,0,0.6,0.4,1.4,0,0,1.8,0,1.2,1.4,buffer,C_Ug +42,R_5jx1hmHr7WuUxA1,67 - 73,Canadian,Female,Female,High School (or equivalent),70,02PsVPf,01PAST,10,02DGEN,0.125,0,1,3,2,0,2,-3,0,0,2,0,0,1,1,0,0,2,3,0,0,0,-3,0,0,0,0,0,2,2,2,1,2,3,2,1,1,-2,-1,0,1,1,0,1,2,0,0,2,3,2,0,1,-3,0,0,0,0,0,2,2,2,2,2,3,1,1,1,-3,-1,0,1,0,1,1,1,1,0,1,7,5,4,6,5,5,6,5,3,5,6,7,0,2,0,2,0,0,0,2,0,0,1,1,2,1,0,0,0,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,1,1,2,2,0,0,1,1,1,0,1,0,1,0,1,0,0,1,0,1,0,2,1,1,1,1,0,1,1,0,1,0,2,1,0,0,1,1,0,0,1,0,1,0,1,1,1,1,2,1,buffer,0,2,0,1,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,1,0,0,0,1,-1,0,1,-1,0,-1,0,1,0,1,1,0,0,0,1,-1,0,-1,1,-1,-1,buffer,1,0,1,1,-1,-2,buffer,0.6,0,-0.2,0,0,-0.2,0.6,0,-0.4,buffer,0.666666667,-0.666666667,0.133333333,-0.066666667,0.066666667,buffer,1,0,1,1,1,4,0.8,0.4,1,0.6,0.6,0.2,0.2,0.4,1.2,0.6,0.6,0.4,1,0.6,0.8,0.4,0.6,1.2,buffer,HS_TS +43,R_5NCl33fWpDZKrBX,60 - 66,Canadian,Female,Female,College Diploma/Certificate,64,01PfPsV,02FUT,5,01ITEM,0.125,0.333333333,0.666666667,1,2,3,3,-3,-3,-1,2,1,-1,3,1,2,0,3,3,3,3,0,-3,-3,2,3,3,-3,3,3,2,1,3,3,3,3,0,-3,-3,-1,2,1,2,3,2,2,2,3,1,2,3,3,-3,-3,2,0,1,-1,3,2,2,-3,2,-1,-1,3,3,-3,-3,2,0,1,-2,2,1,2,-3,2,6,6,6,7,7,6,7,7,4,3,7,6,2,1,0,3,0,0,3,1,2,2,0,2,0,1,0,2,1,0,3,0,0,0,0,0,3,0,1,0,2,0,0,0,0,0,0,0,3,2,0,0,0,1,0,3,1,2,3,0,0,0,0,3,2,0,1,1,0,0,3,1,0,0,0,0,0,0,3,1,2,5,0,1,0,1,0,2,3,0,0,0,0,0,0,0,1,1,1,0,0,0,buffer,2,1,0,3,0,0,0,-1,2,2,0,1,0,-2,-1,0,-2,0,3,0,0,-3,-2,0,2,-1,1,0,-1,-1,-2,-3,0,0,0,0,3,1,2,4,-1,0,0,1,0,buffer,-1,-1,2,4,0,0,buffer,1.2,0.6,-0.4,0.2,-0.6,-0.4,-1,2,0,buffer,0,1.333333333,0.466666667,-0.266666667,0.333333333,buffer,1,1,0,4,0,2,1.2,1.6,0.6,1.2,0.6,0.6,0,1,1,1,1.2,1,0,2.2,0.4,1,0.2,0.4,buffer,C_Ug +44,R_5bshrQuHqvVktBn,67 - 73,Canadian,Male,Male,High School (or equivalent),71,03VPfPs,01PAST,5,02DGEN,0.125,0,0.666666667,2,2,1,1,1,1,1,1,-1,1,0,-2,2,-2,2,2,3,2,1,1,2,0,1,-2,0,1,-1,2,-1,3,2,2,1,1,1,2,0,2,-2,2,1,-1,2,-1,3,2,3,2,2,2,2,0,1,-1,2,1,-1,2,-2,3,2,2,2,2,2,1,0,1,-1,1,1,-1,2,-1,3,5,5,5,5,5,5,5,5,5,5,6,5,0,1,1,0,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,buffer,0,0,0,-1,-1,0,0,0,1,0,0,0,0,1,0,0,0,-1,-1,-1,1,0,1,1,1,0,0,0,0,0,0,0,1,0,0,-1,0,1,0,1,0,0,0,-1,0,buffer,0,0,0,0,-1,0,buffer,-0.4,0.2,0.2,-0.6,0.8,0,0.2,0.2,-0.2,buffer,0,-0.333333333,0,0.066666667,0.066666667,buffer,0,0,0,0,1,0,0.4,0.8,0.8,0,1,0.8,0.8,0.6,0.6,0.6,0.2,0.8,0.4,0.6,0,0.2,0.4,0.2,buffer,HS_TS +45,R_539NZp5Iy0ntBF7,60 - 66,Canadian,Female,Female,College Diploma/Certificate,62,03VPfPs,02FUT,10,02DGEN,0.375,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,1,0,-2,1,-2,1,1,1,1,1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,7,8,7,8,8,8,7,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,3,0,3,0,0,0,0,0,0,0,0,0,0,0,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,3,0,3,0,0,0,0,0,0,0,0,0,0,0,2,2,0,2,0,0,0,0,0,0,buffer,0,0,0,0,0,-2,-2,0,-2,0,0,0,0,0,0,0,1,1,1,0,1,3,0,3,0,0,0,0,0,0,0,1,1,1,0,-1,1,0,1,0,0,0,0,0,0,buffer,0,0,0,0,-1,0,buffer,0,-1.2,0,0.6,1.4,0,0.6,0.2,0,buffer,0,-0.333333333,-0.4,0.666666667,0.266666667,buffer,0,1,1,0,0,1,0,0,0,0.6,1.4,0,0,1.2,0,0,0,0,0.6,1.4,0,0,1.2,0,buffer,C_Ug +46,R_1OTmhMegKLREAOR,60 - 66,Canadian,Female,Female,High School (or equivalent),63,03VPfPs,02FUT,5,01ITEM,0,0,1,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,HS_TS +47,R_62sPBPIuEjdbMtZ,46 - 52,Canadian,Female,Female,College Diploma/Certificate,50,02PsVPf,01PAST,5,01ITEM,0.5,0.333333333,0.666666667,0,0,3,1,3,2,-3,2,-2,2,3,3,1,2,3,0,0,3,1,3,2,-3,3,-3,3,3,3,2,3,3,0,0,3,1,3,1,-3,3,-3,2,3,3,2,2,3,0,0,3,1,3,2,-3,2,-3,2,3,3,2,2,3,0,0,3,1,3,2,-3,2,-3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,buffer,0,0.4,0.2,0,0.2,0,0,0.2,0.2,buffer,0,0,0.2,0.066666667,0.133333333,buffer,0,0,0,0,0,0,0,0.6,0.4,0,0.6,0.2,0,0.2,0.2,0,0.4,0.2,0,0.4,0.2,0,0.2,0,buffer,C_Ug +48,R_5EveSLgf170LhxT,67 - 73,Canadian,Female,Female,High School (or equivalent),67,01PfPsV,01PAST,10,02DGEN,0.25,0,1,3,3,3,3,2,1,1,3,2,1,3,-1,1,0,3,1,3,3,-1,3,2,1,3,1,1,3,-1,1,-1,3,1,3,3,-1,3,3,1,3,1,1,3,-1,2,2,3,3,2,3,3,-1,-1,1,1,1,-2,3,-2,1,-3,3,3,3,3,3,2,0,1,1,1,-1,3,-2,1,-3,3,1,5,2,7,2,1,6,4,4,1,4,4,2,0,0,4,1,1,0,0,1,0,0,0,0,1,0,2,0,0,4,1,2,0,0,1,0,0,0,1,2,0,0,1,0,0,3,2,0,2,1,3,0,1,0,3,0,0,0,0,0,0,1,0,2,1,2,0,1,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,1,3,0,0,1,0,0,3,1,0,0,0,1,0,0,0,0,0,buffer,2,-1,0,4,-2,-1,0,-2,0,-3,0,-1,0,-2,0,2,0,0,4,1,1,0,-2,0,-2,0,-1,1,-1,0,0,-1,0,0,-3,0,0,0,0,-1,0,0,1,3,0,buffer,-5,1,-2,6,-2,-3,buffer,0.6,-1.2,-0.6,1.4,-0.6,-0.2,-0.8,-0.2,0.8,buffer,-2,0.333333333,-0.4,0.2,-0.066666667,buffer,6,3,1,5,0,0,1.4,0.4,0.2,1.4,0.6,0.6,0.8,1.6,0.8,0,1.2,0.8,0,0.2,0.8,0.8,0.4,0,buffer,HS_TS +49,R_3Pu9IZ9Xbl6mTKK,46 - 52,Canadian,Male,Male,University - Graduate (Masters),51,01PfPsV,02FUT,5,02DGEN,0.375,0.666666667,0.333333333,0,3,3,-3,3,2,-2,2,-3,2,1,3,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,6,5,5,5,5,5,5,5,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0.333333333,0,0,0,buffer,0,1,0,0,0,0,2.4,2.2,1.2,2.4,2.2,1.2,2.4,2.2,1.2,2.4,2.2,1.2,0,0,0,0,0,0,buffer,grad_prof +50,R_7CPbhi1vrmwrSEc,67 - 73,Canadian,Female,Female,Trade School (non-military),68,02PsVPf,01PAST,10,01ITEM,0,0.333333333,0.666666667,0,2,1,1,0,-1,-2,1,-2,-1,1,1,1,-1,2,1,2,2,1,1,-1,-2,1,-2,-1,1,1,1,-1,3,1,2,3,-2,3,-2,-2,3,-2,2,1,2,1,-1,1,1,3,3,3,-1,-2,-1,0,-1,-2,2,2,1,-1,3,1,3,3,3,-1,-2,-1,0,1,-2,2,2,1,0,3,1,2,2,4,3,2,4,4,4,5,4,4,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,2,3,3,1,0,2,0,3,0,1,0,0,1,1,1,2,2,1,1,1,1,1,1,1,1,0,0,1,1,1,2,2,1,1,1,1,3,1,1,1,0,1,1,0,0,1,3,2,1,0,2,0,3,0,1,0,0,2,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,buffer,0,-1,-1,-2,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,-1,0,1,2,0,-1,1,-3,2,-1,0,0,-1,0,0,0,1,3,2,1,0,2,-2,3,0,1,0,-1,2,buffer,-3,-2,-2,-1,-1,-2,buffer,-0.8,-1,-0.4,0.4,-0.2,-0.4,1.2,0.8,0.4,buffer,-2.333333333,-1.333333333,-0.733333333,-0.066666667,0.8,buffer,3,1,0,1,0,0,0.6,0,0.2,1.8,1.2,0.4,1.4,1,0.6,1.4,1.4,0.8,1.2,1.2,0.6,0,0.4,0.2,buffer,HS_TS +51,R_7rSftG0Xht8WNHc,60 - 66,Canadian,Male,Male,University - Undergraduate,61,03VPfPs,01PAST,5,02DGEN,-0.375,0.333333333,0.666666667,0,2,2,2,0,0,-1,0,1,0,2,0,1,0,2,2,2,2,2,0,0,0,2,3,0,2,0,1,0,2,2,2,2,2,1,0,0,2,1,0,2,0,1,0,2,0,2,2,3,0,-2,-2,2,0,0,2,0,2,-1,2,0,2,2,3,0,-1,2,2,0,-1,2,0,1,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,2,2,0,0,0,0,0,0,2,0,0,0,1,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,2,1,2,1,0,0,0,1,1,0,0,0,0,1,0,1,3,2,1,1,0,0,0,2,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,4,0,0,1,0,0,1,1,0,buffer,2,0,0,-1,0,-2,0,0,1,0,0,0,-1,-1,0,2,0,0,-1,1,-1,-2,0,-1,-1,0,0,0,-2,0,0,0,0,0,1,-1,-4,0,2,-1,0,0,-1,-1,0,buffer,0,0,0,0,0,0,buffer,0.2,-0.2,-0.4,0.4,-1,-0.4,0.2,-0.8,-0.4,buffer,0,0,-0.133333333,-0.333333333,-0.333333333,buffer,0,0,0,0,0,0,0.4,1,0,0.6,0.6,0,0.2,1.2,0.4,0.2,1.6,0.4,0.2,0.4,0,0,1.2,0.4,buffer,C_Ug +52,R_5QGhSZ8VB5JKDJ8,60 - 66,Canadian,Female,Female,University - Undergraduate,60,01PfPsV,02FUT,5,02DGEN,0,0,1,3,3,3,3,-3,0,0,2,-1,0,3,1,2,0,1,3,3,3,3,-3,0,-2,3,0,3,2,2,2,3,2,3,3,3,3,-3,3,-2,2,-1,0,3,2,2,2,3,3,3,3,3,-3,0,-3,3,-1,1,3,3,3,0,2,3,3,3,3,-3,0,-2,3,0,3,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,2,1,1,3,1,1,0,3,1,0,0,0,0,0,3,2,0,0,0,0,1,0,2,2,0,0,0,0,0,0,3,1,0,1,0,2,1,0,1,0,0,0,0,0,0,2,1,1,3,0,2,1,3,2,0,0,0,0,0,3,0,1,1,3,1,0,0,1,1,0,0,0,0,0,0,1,0,1,2,0,0,0,3,1,buffer,0,0,0,0,0,0,-1,0,1,2,1,-1,-1,3,0,0,0,0,0,0,3,0,-1,-1,-3,0,-1,-1,-1,0,0,0,0,0,0,3,-1,1,0,1,1,0,0,-2,0,buffer,0,0,0,0,0,0,buffer,0,0.4,0.4,0,-0.4,-0.6,0,0.8,-0.2,buffer,0,0,0.266666667,-0.333333333,0.2,buffer,0,0,0,0,0,0,0,1.4,1.2,0,1,1,0,1,0.8,0,1.4,1.6,0,1.6,0.6,0,0.8,0.8,buffer,C_Ug +53,R_7179WZWFoIZAFKe,25 - 31,Canadian,Female,Female,High School (or equivalent),30,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,2,2,2,0,1,-2,2,-1,2,-1,1,2,0,2,2,2,2,2,0,2,-2,2,0,2,0,2,2,2,2,2,2,2,2,0,1,2,0,1,1,1,1,1,1,2,2,2,1,2,0,2,-2,2,-1,1,0,1,2,-1,2,2,2,2,1,0,2,-2,2,0,2,1,1,1,0,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,1,0,0,1,0,1,1,0,2,0,0,0,0,0,0,0,4,2,2,1,2,0,1,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1,0,0,1,0,2,0,1,0,0,0,0,0,0,0,1,4,2,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,0,buffer,0,0,-1,0,0,0,0,0,1,-1,0,1,0,1,0,0,0,0,-1,0,-1,4,2,1,1,0,0,0,1,0,0,0,-1,-1,0,1,4,2,0,0,0,1,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0.4,-0.2,1.4,0.2,-0.4,1.4,0.2,buffer,0,0,0.066666667,0.466666667,0.4,buffer,0,0,0,0,0,0,0,0.4,0.8,0,1.8,0.8,0.2,0.4,0.4,0.2,0.4,0.6,0,1.8,0.8,0.4,0.4,0.6,buffer,HS_TS +54,R_6Q5tReiI71WewEz,53 - 59,Canadian,Female,Female,High School (or equivalent),55,02PsVPf,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,3,3,3,2,-2,-1,-2,2,1,0,3,2,3,-2,3,3,2,2,2,-2,-2,2,1,3,-1,3,2,1,1,3,3,1,3,2,-1,-1,2,1,3,1,3,2,2,1,3,3,3,3,2,-2,-3,-2,2,-1,-1,3,1,1,-3,3,3,2,2,3,-3,-3,-2,2,-1,1,3,2,2,-3,3,5,5,2,4,10,2,0,0,3,1,3,1,0,1,1,0,0,1,4,1,2,1,0,0,2,3,0,0,2,0,0,1,0,4,1,2,1,0,0,1,3,0,0,0,0,0,0,2,0,0,2,1,0,1,2,1,0,0,1,1,1,1,2,0,0,2,1,0,0,1,1,0,0,1,1,0,1,1,0,0,0,2,0,0,1,0,0,0,1,1,1,1,0,0,0,0,2,0,1,1,0,0,buffer,0,1,1,0,0,-1,4,1,0,0,0,-1,0,2,0,0,1,-1,-1,0,-2,4,1,0,0,0,0,0,2,0,0,0,0,-1,0,1,0,0,0,0,0,-1,0,0,0,buffer,5,5,-1,3,7,1,buffer,0.4,0.8,0.2,-0.2,0.6,0.4,-0.2,0.2,-0.2,buffer,3,3.666666667,0.466666667,0.266666667,-0.066666667,buffer,1,5,0,1,3,2,0.4,1.8,1,0.6,1.6,0.8,0,1,0.8,0.8,1,0.4,0.6,0.6,0.2,0.8,0.4,0.4,buffer,HS_TS +55,R_3LvNOREN9MEEAAl,53 - 59,Canadian,Female,Female,High School (or equivalent),59,01PfPsV,02FUT,5,02DGEN,0,0,1,3,2,0,3,-1,-3,-2,1,-2,0,1,1,2,-3,2,3,2,0,3,-1,-2,-2,1,-2,-1,2,2,2,-2,2,3,2,0,3,-1,-2,-2,1,-2,0,2,2,2,-2,2,3,2,0,3,-1,-2,-2,1,-2,-1,2,2,2,-2,2,3,2,0,3,-1,-2,-2,2,-2,-1,2,2,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,-0.4,0,0,0,0,buffer,0,0,0,-0.133333333,0,buffer,0,0,0,0,0,0,0,0.4,0.6,0,0.2,0.6,0,0.4,0.6,0,0.6,0.6,0,0.2,0,0,0.2,0,buffer,HS_TS +56,R_6StnFLZFYnlx0Qh,39 - 45,Canadian,Female,Female,University - Undergraduate,43,01PfPsV,02FUT,10,02DGEN,1,0,0.666666667,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,1,1,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,1,0,0,1,1,1,1,0,1,1,0,0,0,0,0,2,0,0,0,0,0,1,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-1,0,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,buffer,0,0,0,0,0,0,buffer,0,0.2,0.8,0,0,0.6,0,0.6,0.6,buffer,0,0,0.333333333,0.2,0.4,buffer,0,0,0,0,0,0,0,0.6,0.8,0,0.4,0.6,0,0.4,0,0,0.4,0,0,0.6,0.6,0,0,0,buffer,C_Ug +57,R_3LXPr6n0smAwMBm,39 - 45,Canadian,Male,Male,University - Graduate (Masters),41,02PsVPf,02FUT,5,02DGEN,-0.125,0.666666667,0,1,2,1,1,0,1,-2,2,-1,0,1,1,2,1,2,2,2,2,2,2,0,-2,2,-2,2,2,2,2,2,2,2,2,2,1,1,0,-2,2,-2,1,2,2,2,2,2,2,1,1,1,1,0,-3,2,-2,2,2,2,2,2,1,3,3,2,2,2,-1,-2,2,-2,2,3,3,3,2,3,7,7,6,7,6,6,6,6,7,7,7,6,1,0,1,1,2,1,0,0,1,2,1,1,0,1,0,1,0,1,0,1,1,0,0,1,1,1,1,0,1,0,1,1,0,0,1,1,1,0,1,2,1,1,0,1,1,2,1,1,1,2,2,0,0,1,2,2,2,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,2,1,1,1,1,1,0,0,0,1,1,1,0,2,buffer,0,-1,1,1,1,0,-1,0,0,0,0,0,0,0,-1,-1,-1,0,-1,-1,-1,0,0,0,-1,-1,-1,-1,0,-1,-1,-2,-1,0,0,-1,-1,0,0,1,-1,-1,-1,0,-2,buffer,1,1,-1,0,-1,0,buffer,0.4,-0.2,-0.2,-0.8,-0.4,-0.8,-0.8,-0.2,-1,buffer,0.333333333,-0.333333333,0,-0.666666667,-0.666666667,buffer,0,1,0,1,1,1,1,0.8,0.6,0.6,0.6,0.6,0.6,1,0.8,1.4,1,1.4,0.4,0.2,0,1.2,0.4,1,buffer,grad_prof +58,R_7E0xTaALb4X6BIP,25 - 31,Canadian,Male,Male,University - Undergraduate,29,01PfPsV,01PAST,10,01ITEM,0.875,0,0.333333333,3,1,0,3,2,2,2,1,3,0,3,2,1,3,0,3,0,3,2,2,0,1,3,3,1,0,-2,-3,-3,2,2,0,1,-1,-1,3,0,1,0,2,-1,1,1,2,0,3,0,3,2,1,3,1,-2,-2,-1,2,1,2,0,1,-1,2,1,0,3,2,1,3,0,1,0,1,0,2,2,8,4,7,7,6,8,8,8,8,7,8,8,0,1,3,1,0,2,1,2,0,1,3,4,4,6,2,1,1,1,4,3,1,2,0,3,2,4,1,0,1,0,0,1,3,1,1,1,1,3,5,1,1,1,1,3,1,4,1,1,3,1,0,1,2,3,1,3,1,1,1,2,1,0,2,3,3,3,1,2,3,1,1,3,4,5,2,4,2,2,2,2,1,0,5,2,2,2,0,2,2,1,buffer,0,0,0,0,-1,1,0,-1,-5,0,2,3,3,3,1,-3,0,0,1,2,1,1,-2,0,1,1,0,-1,0,-2,-3,-2,0,1,1,2,1,-3,1,-1,-1,3,2,3,1,buffer,0,-4,-1,0,-2,0,buffer,-0.2,-1,2.4,0,0.2,-0.4,-0.6,0,1.6,buffer,-1.666666667,-0.666666667,0.4,-0.066666667,0.333333333,buffer,1,2,1,1,0,0,1,1.2,3.8,2,1.6,1.2,1.2,2.2,1.4,2,1.4,1.6,1.8,2,3,2.4,2,1.4,buffer,C_Ug +59,R_68jv8Bf5MKjNTCp,67 - 73,Canadian,Female,Female,High School (or equivalent),69,03VPfPs,02FUT,10,01ITEM,-0.75,0,0.666666667,3,3,3,-1,0,0,-3,3,-1,-2,3,0,3,-3,3,3,3,3,-3,0,3,-3,3,-1,0,3,2,2,-3,3,3,3,3,-3,2,2,-3,3,-1,0,3,2,2,-3,3,3,3,3,0,0,1,-3,3,-1,0,3,2,2,-3,3,3,3,3,2,-2,0,0,2,0,-2,3,1,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,0,0,0,2,0,2,1,0,0,0,0,0,2,2,2,0,0,0,2,0,2,1,0,0,0,0,0,1,0,1,0,0,0,2,0,2,1,0,0,0,0,0,3,2,0,3,1,1,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,3,1,1,2,0,1,1,0,0,buffer,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,2,-3,-1,-1,2,0,1,1,0,0,0,0,0,-2,0,0,-3,-1,-1,-2,0,-1,-1,0,0,buffer,0,0,0,0,0,0,buffer,0.2,0.4,0,-0.2,-0.2,0.4,-0.4,-1.4,-0.4,buffer,0,0,0.2,0,-0.733333333,buffer,0,0,0,0,0,0,0.4,1,0.6,0.8,0.8,0.6,0.2,0.6,0.6,1,1,0.2,0.4,0.2,0,0.8,1.6,0.4,buffer,HS_TS +60,R_3r1TAD5xtoumLWg,67 - 73,Canadian,Male,Male,College Diploma/Certificate,67,01PfPsV,01PAST,5,02DGEN,0,0.333333333,0.666666667,3,3,2,2,2,0,-2,2,-1,1,1,-1,3,-2,3,3,3,2,1,0,-1,1,3,1,0,2,-1,3,3,3,3,3,1,-1,0,0,1,3,1,1,2,-1,3,2,3,3,2,2,3,1,0,-1,2,-1,1,1,-1,3,-1,3,3,3,2,3,0,1,-2,2,-2,1,1,-1,3,-2,3,2,3,3,3,5,4,3,1,4,2,4,4,0,0,0,1,2,1,3,1,2,1,1,0,0,5,0,0,0,1,3,2,0,3,1,2,0,1,0,0,4,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,2,1,0,0,1,0,0,0,0,0,0,0,0,1,2,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,1,0,0,0,0,1,0,buffer,0,-1,0,0,1,1,2,1,2,1,1,0,0,4,0,0,0,1,2,0,-1,3,1,1,0,1,0,0,4,0,0,-1,1,2,-1,0,-1,0,-1,1,0,0,0,0,0,buffer,-1,2,-1,1,1,0,buffer,0,1.4,1,0.6,0.8,1,0.2,-0.2,0,buffer,0,0.666666667,0.8,0.8,0,buffer,1,2,1,1,3,0,0.6,1.6,1.2,1.2,1.2,1,0.6,0.2,0.2,0.6,0.4,0,0.6,0.4,0.2,0.4,0.6,0.2,buffer,C_Ug +61,R_3SAHrS0GQBJ4N6c,60 - 66,Canadian,Male,Male,High School (or equivalent),60,03VPfPs,01PAST,5,02DGEN,0.5,0.333333333,0.666666667,2,2,2,1,3,1,-1,2,1,2,2,3,2,0,3,0,2,2,-2,3,1,1,2,-1,2,2,2,2,1,2,-1,2,2,-2,3,0,2,2,1,2,2,2,2,1,2,2,2,2,2,3,-1,-2,1,1,2,2,3,2,-2,3,1,2,2,2,2,-1,-3,2,1,1,2,2,2,-2,3,7,8,7,8,7,7,8,7,8,7,8,7,2,0,0,3,0,0,2,0,2,0,0,1,0,1,1,3,0,0,3,0,1,3,0,0,0,0,1,0,1,1,0,0,0,1,0,2,1,1,0,0,0,0,0,2,0,1,0,0,1,1,2,2,0,0,1,0,1,0,2,0,1,0,0,0,0,1,1,0,2,0,0,0,0,0,0,1,0,0,0,1,0,1,1,0,1,0,1,0,0,0,buffer,2,0,0,2,0,-2,1,-1,2,0,0,1,0,-1,1,2,0,0,2,-1,-1,1,0,0,-1,0,0,0,-1,1,0,0,0,0,-1,1,0,-1,2,-1,0,-1,0,0,0,buffer,-1,1,-1,1,-1,0,buffer,0.8,0,0.2,0.6,-0.2,0,-0.2,0.2,-0.2,buffer,-0.333333333,0,0.333333333,0.133333333,-0.066666667,buffer,1,1,0,1,1,1,1,0.8,0.6,1.2,0.8,0.6,0.2,0.8,0.4,0.6,1,0.6,0.2,0.8,0,0.4,0.6,0.2,buffer,HS_TS +62,R_5t0gKO3C7BnFyCn,67 - 73,Canadian,Male,Male,University - Graduate (Masters),67,01PfPsV,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,3,3,2,-2,1,1,-3,3,-3,2,2,1,2,-1,2,3,3,2,-3,1,1,-3,3,-3,2,2,2,2,1,3,3,3,2,-3,2,1,-3,3,-3,2,2,2,2,1,2,3,3,2,-2,1,1,-3,2,-3,2,2,2,2,-1,3,3,3,2,0,1,1,-3,2,-3,2,2,2,2,0,3,0,0,0,0,0,0,1,1,1,3,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,2,1,0,0,0,1,1,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,2,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,1,0,0,0,-1,0,0,0,0,0,2,0,0,0,0,-1,1,0,0,-1,0,0,0,0,0,1,-1,0,0,0,-2,1,0,0,0,0,0,0,0,0,-1,1,buffer,-1,-1,-1,-3,-1,-1,buffer,0.2,-0.2,0.4,0,-0.2,0,-0.2,0,0,buffer,-1,-1.666666667,0.133333333,-0.066666667,-0.066666667,buffer,0,0,0,2,0,0,0.2,0,0.8,0.4,0,0.6,0,0.2,0.4,0.4,0.2,0.6,0.2,0,0.2,0.4,0,0.2,buffer,grad_prof +63,R_3oL0DPh0524TOG2,46 - 52,Canadian,Female,Female,High School (or equivalent),47,03VPfPs,02FUT,10,02DGEN,0,0,1,3,3,3,2,1,-3,-3,1,1,2,2,-1,3,1,3,3,3,3,-1,3,-3,-3,1,1,2,2,-1,3,1,3,3,3,3,-1,3,-3,-3,1,1,2,2,-1,3,2,3,3,3,3,3,3,-3,-3,3,1,3,2,-1,3,2,3,3,3,3,3,3,-3,-3,3,1,3,2,-1,3,2,3,2,2,2,2,2,2,2,2,1,2,2,2,0,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,0,0,0,0,0,0,0,0,1,0,0,0,0,1,2,0,0,2,0,1,0,0,0,1,0,0,0,0,1,2,0,0,2,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,2,0,0,0,-2,0,-1,0,0,0,-1,0,0,0,0,2,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,1,0,0,0,buffer,0.4,-0.6,-0.2,0.4,-0.6,0,0,0,0.2,buffer,0.333333333,0,-0.133333333,-0.066666667,0.066666667,buffer,0,0,0,0,0,1,1,0,0,1,0,0.2,0.6,0.6,0.2,0.6,0.6,0.2,0,0,0.2,0,0,0,buffer,HS_TS +64,R_3E2CRTzXTCzrQc1,67 - 73,Canadian,Male,Male,High School (or equivalent),71,03VPfPs,01PAST,5,01ITEM,0.5,0,1,-3,3,3,-3,-1,-3,1,2,0,2,-2,1,3,0,0,-3,3,3,-3,-3,-3,1,2,-1,-3,-2,0,3,-2,0,-3,3,3,-3,1,-3,0,2,-2,2,-2,1,3,-2,0,-3,3,3,-3,-3,-3,1,1,-1,2,-2,0,3,-3,0,-3,3,3,-3,-3,-3,1,1,1,2,-2,0,3,-3,0,3,3,2,3,3,3,3,3,3,2,3,3,0,0,0,0,2,0,0,0,1,5,0,1,0,2,0,0,0,0,0,2,0,1,0,2,0,0,0,0,2,0,0,0,0,0,2,0,0,1,1,0,0,1,0,3,0,0,0,0,0,2,0,0,1,1,0,0,1,0,3,0,0,0,0,0,4,0,1,0,1,5,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,-1,0,5,0,0,0,-1,0,0,0,0,0,0,0,1,-1,1,0,0,-1,0,-1,0,0,0,0,0,4,0,1,0,-1,5,0,1,0,0,0,buffer,0,0,-1,1,0,0,buffer,0,0.8,-0.2,0,0.2,-0.4,0.8,1,0.2,buffer,-0.333333333,0.333333333,0.2,-0.066666667,0.666666667,buffer,0,0,1,1,0,0,0.4,1.2,0.6,0.4,0.6,0.4,0.4,0.4,0.8,0.4,0.4,0.8,0.8,1.4,0.2,0,0.4,0,buffer,HS_TS +65,R_5j2R74rQQ9YqFt4,60 - 66,Canadian,Male,Male,College Diploma/Certificate,61,01PfPsV,02FUT,10,02DGEN,0,0,1,3,2,-1,1,1,-1,0,1,1,0,1,0,1,0,2,3,3,-1,0,1,1,0,1,2,0,2,0,1,1,1,3,3,0,0,2,-1,0,1,3,0,2,0,1,0,1,3,1,-1,1,1,-1,1,2,1,0,2,1,1,0,1,3,2,-1,1,1,-1,0,2,1,0,2,1,2,1,2,3,4,4,2,5,3,2,2,2,2,2,2,0,1,0,1,0,2,0,0,1,0,1,0,0,1,1,0,1,1,1,1,0,0,0,2,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,1,0,1,2,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,buffer,0,0,0,1,0,2,-1,-1,1,0,0,-1,0,1,0,0,1,1,1,1,0,0,-1,2,0,0,-1,-1,-1,1,0,-1,1,0,1,2,-1,0,1,0,0,0,-1,0,-1,buffer,1,2,2,0,3,1,buffer,0.2,0.2,0,0.8,0.2,-0.4,0.2,0.4,-0.4,buffer,1.666666667,1.333333333,0.133333333,0.2,0.066666667,buffer,1,1,1,0,0,0,0.4,0.6,0.6,0.8,0.4,0.4,0.2,0.4,0.6,0,0.2,0.8,0.4,0.6,0.2,0.2,0.2,0.6,buffer,C_Ug +66,R_5nNIGXYxFlgHVtL,67 - 73,Canadian,Female,Female,University - Graduate (Masters),72,01PfPsV,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,3,2,-1,-3,3,-1,-3,2,-3,2,0,0,2,-1,1,3,2,0,-3,3,0,-3,2,-3,2,0,0,2,-1,1,3,2,-1,-3,3,-1,-3,2,-3,2,0,0,2,-1,1,3,2,-2,-3,2,0,-3,2,-3,2,0,0,3,-1,1,3,2,-1,-3,2,-1,-3,2,-3,2,0,0,2,-1,1,3,2,2,2,2,2,3,3,2,2,2,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,buffer,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,buffer,0,-1,0,0,0,0,buffer,-0.2,0,-0.2,-0.2,0,0,0,0,-0.2,buffer,-0.333333333,0,-0.133333333,-0.066666667,-0.066666667,buffer,1,0,0,1,1,0,0.2,0.2,0,0,0,0,0.4,0.2,0.2,0.2,0,0,0.2,0.2,0,0.2,0.2,0.2,buffer,grad_prof +67,R_66hGIGe1BIkkXFL,32 - 38,Canadian,Female,Female,University - Undergraduate,38,03VPfPs,02FUT,5,01ITEM,-0.125,0,1,2,2,2,-2,-1,-1,2,2,2,-1,1,1,1,1,1,2,2,2,-2,-2,-2,2,2,2,1,1,1,1,1,1,2,2,2,-2,-2,-1,2,2,2,1,1,1,1,1,1,2,2,2,-1,-1,-1,2,2,2,1,1,1,2,1,1,2,2,2,-2,-1,-1,1,1,2,1,1,1,2,1,1,2,2,2,3,3,2,2,2,2,2,2,2,0,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,1,1,0,2,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,buffer,0,0,0,-1,1,1,0,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,-1,-1,0,0,0,0,-1,0,0,0,0,0,-1,0,1,-1,-1,0,0,0,0,0,0,0,buffer,0,0,0,1,1,0,buffer,0,0.2,-0.2,0.2,-0.4,-0.2,-0.2,-0.2,0,buffer,0,0.666666667,0,-0.133333333,-0.133333333,buffer,1,1,0,0,0,0,0.2,0.6,0,0.2,0.4,0,0.2,0.4,0.2,0,0.8,0.2,0,0.2,0,0.2,0.4,0,buffer,C_Ug +68,R_710tZm0P99iy1aj,39 - 45,Canadian,Male,Male,College Diploma/Certificate,45,03VPfPs,01PAST,10,02DGEN,1.125,0,0.333333333,3,2,1,2,1,3,3,1,3,1,2,3,2,2,3,0,0,3,0,1,3,2,2,1,0,0,0,0,2,1,3,3,2,3,2,2,2,1,3,3,3,3,0,2,2,2,2,3,3,1,1,1,2,2,0,2,2,2,2,3,2,2,1,3,2,0,1,2,0,1,2,3,1,1,2,8,8,8,9,7,8,7,6,7,7,8,7,3,2,2,2,0,0,1,1,2,1,2,3,2,0,2,0,1,1,1,1,1,1,0,0,2,1,0,2,0,1,1,0,2,1,0,2,2,1,1,1,0,1,0,0,0,1,0,0,1,1,3,2,1,3,0,0,0,1,1,1,3,3,1,3,1,1,0,1,2,3,3,3,0,0,1,0,0,2,0,1,1,0,0,2,1,0,1,1,1,1,buffer,2,2,0,1,0,-2,-1,0,1,0,2,2,2,0,2,-1,1,1,0,0,-2,-1,-1,-3,2,1,0,1,-1,0,3,3,-1,3,0,0,0,1,0,2,3,2,-1,-1,0,buffer,1,2,1,2,-1,1,buffer,1,-0.4,1.6,0.2,-1,0.2,1.6,0.6,0.6,buffer,1.333333333,0.666666667,0.733333333,-0.2,0.933333333,buffer,1,1,0,0,2,0,1.8,1,1.8,0.8,0.8,0.8,0.8,1.4,0.2,0.6,1.8,0.6,2.2,1.4,1.4,0.6,0.8,0.8,buffer,C_Ug +69,R_3MDTqWL1rduC3Z9,60 - 66,Canadian,Male,Male,Trade School (non-military),65,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,-3,3,3,-2,2,2,-3,3,-3,1,2,2,3,1,2,-3,2,2,-2,2,3,-3,3,-3,2,2,2,2,1,2,-2,2,2,-2,3,3,-3,2,-3,2,2,2,2,1,2,-3,2,2,-2,1,2,-3,3,-3,-2,2,2,3,-1,2,-3,2,2,-2,-1,2,-3,2,-3,1,2,2,2,-1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,1,1,0,1,0,0,0,0,3,0,0,0,2,0,0,1,1,0,3,0,0,1,0,0,0,0,1,2,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,3,0,0,1,0,0,buffer,0,0,0,0,-1,1,0,0,0,-2,0,0,1,-2,0,1,0,0,0,-2,1,0,0,0,1,0,0,0,-2,0,1,0,0,0,-1,0,0,0,0,-3,0,0,-1,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,-0.2,-0.2,-0.2,0.4,-0.4,0,-0.6,-0.2,buffer,0,0,-0.2,-0.066666667,-0.266666667,buffer,0,0,0,0,0,0,0.4,0.4,0.2,0.8,0.6,0.2,0.6,0.6,0.4,1,0.2,0.6,0.4,0.2,0,0.4,0.8,0.2,buffer,HS_TS +70,R_5ZQEKXDbhs4GA3k,67 - 73,Canadian,Male,Male,Trade School (non-military),72,02PsVPf,01PAST,10,02DGEN,0,0,1,1,1,3,-1,2,3,-3,2,-2,2,3,1,3,1,3,1,1,2,-2,2,3,-3,3,-3,1,3,1,1,1,3,2,1,2,-3,2,3,-3,3,-2,1,3,2,2,3,3,1,2,3,0,0,2,-2,2,-2,1,3,1,1,0,3,1,1,2,0,0,2,-1,0,-1,0,3,0,2,0,3,5,5,5,5,5,5,5,5,5,6,5,7,0,0,1,1,0,0,0,1,1,1,0,0,2,0,0,1,0,1,2,0,0,0,1,0,1,0,1,1,2,0,0,1,0,1,2,1,1,0,0,1,0,0,2,1,0,0,0,1,1,2,1,2,2,1,2,0,1,1,1,0,1,0,0,1,0,0,0,0,1,0,0,1,1,2,0,0,1,1,0,0,0,1,2,1,1,0,1,1,0,0,buffer,0,-1,1,0,-2,-1,-1,1,1,0,0,0,0,-1,0,1,0,0,1,-2,-1,-2,-1,-1,-1,0,0,0,1,0,1,-1,-1,1,0,0,-1,-2,0,-1,0,0,0,2,0,buffer,0,0,0,-1,0,-2,buffer,-0.4,0,-0.2,0,-1.2,0.2,0,-0.8,0.4,buffer,0,-1,-0.2,-0.333333333,-0.133333333,buffer,0,0,0,1,0,2,0.4,0.6,0.4,0.8,0.4,0.8,0.8,0.6,0.6,0.8,1.6,0.6,0.4,0.2,0.8,0.4,1,0.4,buffer,HS_TS +71,R_5HSsu68tAVKiXWN,53 - 59,Canadian,Male,Male,University - Undergraduate,55,03VPfPs,01PAST,5,02DGEN,0.375,0.666666667,0.333333333,-2,2,3,3,-2,-2,2,2,3,-1,2,-2,3,-1,2,-1,3,3,2,-2,-3,3,1,3,1,1,-3,2,1,2,0,1,2,1,-2,0,2,1,2,1,1,-2,2,1,2,0,2,2,3,0,1,1,2,1,2,3,-1,3,1,2,0,1,2,3,0,2,0,2,0,2,3,1,3,2,2,2,2,3,3,3,3,2,2,3,3,3,3,1,1,0,1,0,1,1,1,0,2,1,1,1,2,0,2,1,1,2,0,2,0,1,1,2,1,0,1,2,0,2,0,1,0,2,3,1,0,2,3,1,1,0,2,0,2,1,1,0,2,4,2,0,3,3,1,3,0,3,0,1,2,1,1,0,3,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,2,0,1,0,buffer,-1,1,-1,1,-2,-2,0,1,-2,-1,0,0,1,0,0,0,0,0,2,-2,-2,-2,1,-2,-1,0,-3,1,-1,0,1,1,1,1,0,2,0,0,0,0,0,-1,0,-1,0,buffer,0,0,0,0,0,0,buffer,-0.4,-0.8,0.2,0,-1.2,-0.6,0.8,0.4,-0.4,buffer,0,0,-0.333333333,-0.6,0.266666667,buffer,1,1,0,1,1,0,0.6,1,1,1.2,1.2,0.8,1,1.8,0.8,1.2,2.4,1.4,1,1,0.2,0.2,0.6,0.6,buffer,C_Ug +72,R_1HS2ohbQHYfy7o6,67 - 73,Canadian,Female,Female,College Diploma/Certificate,72,01PfPsV,02FUT,5,02DGEN,-0.25,0,1,3,2,2,1,2,0,-3,2,-2,0,0,1,2,0,0,3,3,3,1,3,0,-3,2,-3,0,0,1,0,-3,0,3,3,3,1,2,0,-3,2,-3,0,0,1,0,0,0,3,3,3,2,2,0,-3,0,-3,0,0,2,0,-3,0,2,2,3,3,0,0,-3,0,0,0,0,0,0,-3,0,5,1,1,2,2,2,1,1,5,5,5,5,0,1,1,0,1,0,0,0,1,0,0,0,2,3,0,0,1,1,0,0,0,0,0,1,0,0,0,2,0,0,0,1,1,1,0,0,0,2,1,0,0,1,2,3,0,1,0,1,2,2,0,0,2,2,0,0,1,2,3,0,0,0,0,0,1,0,0,0,0,0,0,0,0,3,0,1,1,0,1,2,0,0,0,3,0,0,2,0,0,0,buffer,0,0,0,-1,1,0,0,-2,0,0,0,-1,0,0,0,-1,1,0,-2,-2,0,0,-2,-1,0,0,-1,0,-3,0,-1,-1,0,-1,-1,0,0,0,-3,0,0,-2,0,3,0,buffer,4,0,-4,-3,-3,-3,buffer,0,-0.4,-0.2,-0.8,-0.6,-0.8,-0.8,-0.6,0.2,buffer,0,-3,-0.2,-0.733333333,-0.4,buffer,3,1,1,4,4,0,0.6,0.2,1,0.4,0.2,0.4,0.6,0.6,1.2,1.2,0.8,1.2,0.2,0,0.6,1,0.6,0.4,buffer,C_Ug +73,R_6bVkNb48YbCZPws,39 - 45,Canadian,Male,Male,University - Undergraduate,45,01PfPsV,02FUT,5,02DGEN,0.5,0,1,2,3,1,2,3,-2,-1,1,1,0,0,1,1,-1,1,0,0,2,0,3,0,0,0,1,-1,1,2,0,1,1,1,2,2,1,3,-1,0,2,1,-1,0,-1,-1,-1,0,2,3,1,0,3,-1,-3,1,1,1,0,1,2,-1,1,2,3,1,2,3,-1,-1,-2,2,0,0,1,0,-2,0,3,4,4,6,6,6,4,6,5,5,5,3,2,3,1,2,0,2,1,1,0,1,1,1,1,2,0,1,1,1,1,0,1,1,1,0,1,0,2,2,0,1,0,0,0,2,0,1,2,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,3,1,0,0,0,1,1,1,1,2,0,1,0,1,0,2,0,0,1,3,1,2,1,0,0,0,2,0,0,2,3,1,1,0,0,2,1,1,buffer,2,3,1,0,0,1,-1,1,0,0,1,1,0,2,0,1,1,1,1,0,0,1,-2,-1,1,0,2,1,-1,0,1,2,0,-1,0,1,-2,-1,-1,-1,1,3,-1,1,0,buffer,-1,-2,-1,1,1,3,buffer,1.2,0.2,0.8,0.8,-0.2,0.4,0.4,-0.8,0.8,buffer,-1.333333333,1.666666667,0.733333333,0.333333333,0.133333333,buffer,3,2,2,1,1,2,1.6,1,1,0.8,0.8,1,0.4,0.8,0.2,0,1,0.6,0.8,0.6,1.6,0.4,1.4,0.8,buffer,C_Ug +74,R_3uyZAa5KYYe7wna,46 - 52,Canadian,Male,Male,Trade School (non-military),48,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,-2,2,2,1,2,0,0,1,1,0,-2,3,2,0,2,0,1,1,1,2,0,0,-1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,5,6,5,5,5,7,5,7,8,6,6,6,2,1,1,0,0,0,0,2,1,0,2,3,2,0,2,2,2,2,1,2,0,0,1,1,0,2,3,2,0,2,2,2,2,1,2,0,0,1,1,0,3,2,1,1,1,2,2,2,1,0,0,0,1,1,0,2,3,2,0,2,0,1,1,1,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,1,1,1,1,buffer,0,-1,-1,-1,-2,0,0,1,0,0,-1,1,1,-1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,2,0,-1,-1,-1,-1,-1,buffer,0,-1,-3,-1,-1,1,buffer,-1,0.2,0.2,0.4,0,0,0.6,0.6,-1,buffer,-1.333333333,-0.333333333,-0.2,0.133333333,0.066666667,buffer,0,1,2,1,1,2,0.8,0.6,1.8,1.8,0.4,1.8,1.8,0.4,1.6,1.4,0.4,1.8,1,0.6,0,0.4,0,1,buffer,HS_TS +75,R_1QAc22IlPnNyRse,39 - 45,Canadian,Female,Female,High School (or equivalent),41,03VPfPs,01PAST,10,01ITEM,0,0.333333333,0.666666667,1,1,0,3,-1,-2,0,1,2,1,3,2,3,-3,3,0,1,3,0,-2,-3,0,-2,3,-3,3,2,2,-3,3,3,3,3,1,2,1,0,1,2,1,2,1,2,-3,3,0,0,0,2,0,0,0,0,2,1,3,2,3,-3,3,0,0,0,0,0,0,-1,1,2,2,3,1,3,-3,3,1,8,0,5,1,0,5,4,5,5,5,1,1,0,3,3,1,1,0,3,1,4,0,0,1,0,0,2,2,3,2,3,3,0,0,0,0,1,1,1,0,0,1,1,0,1,1,2,0,1,0,0,0,0,0,0,0,1,1,0,3,1,2,1,0,0,1,0,1,0,0,0,3,2,0,1,4,4,0,3,1,4,1,1,0,0,0,0,0,0,2,0,0,1,1,0,1,0,1,0,0,0,buffer,0,-1,3,2,0,-1,0,2,1,4,0,0,1,0,0,1,1,3,-1,2,1,-1,0,0,-1,1,0,1,0,0,3,2,0,-1,4,4,-1,2,1,3,1,0,0,0,0,buffer,-4,4,-5,0,-4,-1,buffer,0.8,1.2,0.2,1.2,-0.2,0.4,1.6,1.8,0.2,buffer,-1.666666667,-1.666666667,0.733333333,0.466666667,1.2,buffer,4,7,0,0,1,4,1.6,1.8,0.2,2.4,0.6,0.6,0.8,0.6,0,1.2,0.8,0.2,2,2.4,0.4,0.4,0.6,0.2,buffer,HS_TS +76,R_11FTFBt6zepQQIF,53 - 59,Canadian,Female,Female,University - Undergraduate,58,01PfPsV,02FUT,5,01ITEM,0.75,0,1,0,2,3,1,2,2,-3,3,1,1,3,2,2,0,3,1,3,3,2,2,3,-1,3,2,3,3,3,3,1,3,1,3,2,1,2,3,-1,3,1,2,3,3,3,2,3,0,2,3,2,2,1,-2,1,1,0,3,2,2,0,2,0,2,3,2,2,1,-2,1,1,0,3,2,2,0,2,6,6,3,5,6,2,2,3,3,4,5,3,1,1,0,1,0,1,2,0,1,2,0,1,1,1,0,1,1,1,0,0,1,2,0,0,1,0,1,1,2,0,0,0,0,1,0,1,1,2,0,1,0,0,0,0,1,0,0,0,1,0,1,1,2,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,1,1,0,0,0,0,1,-2,1,1,0,1,1,1,-1,1,1,1,-1,0,0,1,-2,0,0,0,1,1,2,-1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,buffer,4,3,0,1,1,-1,buffer,0.4,0.2,0.4,0.4,-0.2,0.6,0.4,0.4,0.2,buffer,2.333333333,0.333333333,0.333333333,0.266666667,0.333333333,buffer,1,0,1,2,2,0,0.6,1.2,0.6,0.6,0.8,0.8,0.2,1,0.2,0.2,1,0.2,0.4,0.4,0.2,0,0,0,buffer,C_Ug +77,R_3MFPx3kdqR4ypoB,67 - 73,Canadian,Male,Male,University - Undergraduate,68,02PsVPf,01PAST,10,02DGEN,-0.375,0.333333333,0.333333333,-3,0,2,-2,2,-2,-1,2,-2,-1,2,3,3,-1,-1,-3,0,2,-3,2,-3,0,2,-1,-2,2,3,3,0,-2,-3,0,2,-2,3,-2,1,1,1,-1,2,3,3,0,-1,-3,0,2,-2,2,-2,-2,2,-2,-2,2,3,3,0,-2,-3,0,2,-2,2,-2,-2,2,-2,-2,2,3,3,0,-2,3,5,4,3,8,2,1,2,1,1,1,2,0,0,0,1,0,1,1,0,1,1,0,0,0,1,1,0,0,0,0,1,0,2,1,3,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,3,-1,0,0,0,0,-1,0,0,0,1,1,1,1,1,2,1,0,0,0,0,1,buffer,2,3,3,2,7,0,buffer,0.2,0.4,0,0.2,0.8,-0.2,0.4,1.2,0.2,buffer,2.666666667,3,0.2,0.266666667,0.6,buffer,0,3,2,0,1,1,0.2,0.8,0.4,0.2,1.2,0.2,0,0.4,0.4,0,0.4,0.4,0.4,1.2,0.2,0,0,0,buffer,C_Ug +78,R_5aOV0H9YEdzgt0d,53 - 59,Canadian,Female,Female,University - Undergraduate,54,03VPfPs,01PAST,10,01ITEM,0.25,0,1,2,2,2,0,3,1,-2,1,-1,2,1,-1,2,0,2,2,2,1,-1,2,2,-1,2,-2,1,2,-1,2,0,2,1,1,1,-1,2,2,-2,2,-1,2,2,-1,0,0,2,1,1,1,0,1,1,-2,0,-2,2,1,0,1,-1,2,2,2,1,1,2,0,-2,0,-1,0,1,0,2,2,2,1,1,1,1,1,1,2,2,2,4,4,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,1,0,0,1,0,2,0,0,1,1,1,0,2,0,0,1,1,0,0,1,1,1,0,0,0,1,1,1,1,0,1,0,2,0,1,0,2,0,1,1,0,0,0,0,1,0,1,1,0,0,2,0,0,1,1,0,1,1,1,0,0,1,2,0,0,1,3,0,buffer,-1,-1,0,1,-1,1,1,0,0,1,1,-1,-1,-1,0,1,1,0,0,0,0,0,0,0,-2,1,-1,2,-2,0,0,0,0,-1,-1,-1,1,0,0,-1,0,0,1,-3,0,buffer,-1,-1,-1,-3,-3,1,buffer,-0.4,0.6,-0.4,0.4,-0.4,0,-0.4,-0.2,-0.4,buffer,-1,-1.666666667,-0.066666667,0,-0.333333333,buffer,0,0,0,2,2,2,0.6,1,0.2,1,0.4,0.6,1,0.4,0.6,0.6,0.8,0.6,0.4,0.6,0.4,0.8,0.8,0.8,buffer,C_Ug +79,R_6Sb39w9yGO8b2tr,39 - 45,Canadian,Male,Male,High School (or equivalent),41,02PsVPf,02FUT,5,02DGEN,0.25,0,1,0,2,1,1,1,-2,1,0,-2,1,0,0,1,0,0,1,2,1,1,0,0,1,0,0,0,0,0,1,0,0,0,2,2,0,0,0,1,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0,0,0,0,0,0,1,0,0,0,2,1,1,1,-1,0,0,0,0,0,0,1,0,0,4,5,5,6,5,5,5,6,5,3,5,5,1,0,0,0,1,2,0,0,2,1,0,0,0,0,0,0,0,1,1,1,2,0,0,2,1,0,0,0,0,0,0,0,1,0,1,2,1,0,2,1,0,0,0,0,0,0,0,0,0,0,1,1,0,2,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,buffer,1,0,-1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,-1,0,0,0,0,0,0,0,0,1,0,0,1,-1,-1,0,0,0,0,0,0,0,0,0,buffer,-1,-1,0,3,0,0,buffer,0,-0.2,0,0.6,0,0,0.2,-0.2,0,buffer,-0.666666667,1,-0.066666667,0.2,0,buffer,2,0,0,2,1,0,0.4,1,0,0.6,1,0,0.4,1.2,0,0,1,0,0.6,0,0,0.4,0.2,0,buffer,HS_TS +80,R_5rvjBhurZlcbMCl,60 - 66,Canadian,Female,Female,College Diploma/Certificate,65,01PfPsV,02FUT,5,01ITEM,-0.125,0.333333333,0.666666667,-1,2,2,0,1,-2,-1,2,-2,1,1,-3,3,-2,2,1,2,2,1,0,-2,-2,2,-2,2,1,-2,2,-3,2,1,2,2,1,1,-2,-2,2,-2,2,1,-2,2,-3,3,1,2,2,0,2,-2,-2,2,-2,2,1,-2,2,-3,2,1,2,2,0,1,-2,-2,2,-2,1,1,-2,3,-3,3,2,1,1,2,1,1,4,1,1,1,1,1,2,0,0,1,1,0,1,0,0,1,0,1,1,1,0,2,0,0,1,0,0,1,0,0,1,0,1,1,1,1,2,0,0,0,1,0,1,0,0,1,0,1,1,1,0,2,0,0,0,0,0,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,buffer,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,buffer,-2,0,0,1,0,0,buffer,0.2,0,0,0.2,0.2,0.2,0,-0.2,-0.2,buffer,-0.666666667,0.333333333,0.066666667,0.2,-0.133333333,buffer,0,0,0,3,0,0,0.8,0.4,0.6,0.6,0.4,0.8,0.6,0.4,0.6,0.4,0.2,0.6,0.2,0,0.2,0.2,0.2,0.4,buffer,C_Ug +81,R_3D6LmFgArFfRzSD,67 - 73,Canadian,Male,Male,University - Graduate (Masters),67,03VPfPs,01PAST,10,02DGEN,0.5,0,1,3,3,2,-3,0,2,-2,3,-2,0,2,1,2,0,3,3,3,2,-3,0,2,-3,3,-3,2,3,2,2,0,3,3,3,2,-3,2,2,-3,3,-3,0,3,2,2,2,3,3,3,2,-3,1,1,-3,3,-3,1,3,2,2,0,3,3,3,2,-3,0,1,-3,3,-3,0,3,2,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,0,0,0,0,0,0,0,2,0,1,0,1,0,1,1,0,2,0,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,-1,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,-1,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,1,0,0,0,2,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0,0.4,-0.2,0.4,0.2,0.2,0.4,buffer,0,0,-0.066666667,0.2,0.266666667,buffer,0,0,0,0,0,0,0,0.8,0.4,0.4,0.4,0.8,0.2,0.8,0.4,0,0.6,0.4,0.4,0.4,0.4,0.2,0.2,0,buffer,grad_prof +82,R_7lXoOL9NeElQKtz,39 - 45,Canadian,Male,Male,University - Graduate (Masters),43,03VPfPs,02FUT,10,02DGEN,0.375,1,0,2,3,3,3,3,1,-3,3,-2,2,3,3,3,3,3,0,3,3,3,3,3,-2,3,-1,3,3,3,3,3,2,0,3,3,3,3,3,-3,3,-1,3,3,2,3,3,3,2,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,2,2,0,0,0,0,2,1,0,1,1,0,0,0,0,1,2,0,0,0,0,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,1,0,0,0,0,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,buffer,0,0,0,0,0,-1,buffer,0.4,0.2,0.2,0.2,0,0.2,-0.2,0.2,0.4,buffer,0,-0.333333333,0.266666667,0.133333333,0.133333333,buffer,0,0,0,0,0,1,0.4,1,0.2,0.4,0.8,0.2,0,0.8,0,0.2,0.8,0,0,0.2,0.4,0.2,0,0,buffer,grad_prof +83,R_5mMnxA0qm1YoyQh,60 - 66,Canadian,Male,Male,High School (or equivalent),65,01PfPsV,01PAST,5,01ITEM,0.375,0,1,-3,1,3,3,-3,1,-1,3,-1,-3,3,1,1,-1,2,-3,2,3,3,-3,2,-2,3,-3,0,3,1,1,-2,1,-3,2,2,2,-3,2,-2,2,-2,-2,2,2,2,-2,2,-3,2,3,2,-3,2,-2,2,-2,2,3,2,2,-2,2,-3,2,2,2,-3,2,-2,2,-2,2,3,2,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,2,3,0,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,0,1,0,1,0,1,1,1,1,5,0,1,1,1,0,0,1,1,1,0,1,1,1,1,5,0,1,1,1,0,0,0,1,1,0,0,0,1,1,2,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,-1,1,-2,0,-1,-1,0,1,0,0,0,0,0,0,0,0,0,-4,1,0,0,0,0,0,0,0,1,0,0,0,1,1,2,1,1,1,0,1,buffer,0,0,0,0,0,0,buffer,-0.2,-0.4,-0.2,0,-0.8,0.2,0.2,0.8,0.8,buffer,0,0,-0.266666667,-0.2,0.6,buffer,0,0,0,0,0,0,0.2,1.4,0.4,0.6,1,0.8,0.4,1.8,0.6,0.6,1.8,0.6,0.4,0.8,0.8,0.2,0,0,buffer,HS_TS +84,R_5UcqKFTRjoYaLZq,39 - 45,Canadian,Female,Female,College Diploma/Certificate,40,02PsVPf,02FUT,5,01ITEM,0.5,0,0.666666667,2,2,2,2,2,-1,-1,0,-1,2,2,2,2,2,2,2,2,2,2,2,2,2,0,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,-1,2,0,2,2,2,2,2,2,2,2,2,2,2,2,-1,2,-1,2,0,2,2,2,0,9,8,9,8,9,9,8,9,8,9,9,9,0,0,0,0,0,3,3,0,1,0,0,0,0,0,0,0,0,0,0,0,3,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,0,2,4,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,2,0,0,0,2,buffer,0,0,0,0,0,3,3,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,3,0,-2,0,0,0,-2,0,0,0,0,0,-3,0,2,3,0,-2,0,0,0,-2,buffer,1,-1,1,-1,0,0,buffer,0,0.8,0,0,1.2,-0.8,0,0.4,-0.8,buffer,0.333333333,-0.333333333,0.266666667,0.133333333,-0.133333333,buffer,1,1,0,1,0,1,0,1.4,0,0,2.2,0,0,0.6,0,0,1,0.8,0,1.2,0,0,0.8,0.8,buffer,C_Ug +85,R_3X4mhvm0v0rxhKp,60 - 66,Canadian,Female,Female,Trade School (non-military),64,03VPfPs,01PAST,10,02DGEN,-0.375,0,1,2,2,3,1,2,-1,-2,1,2,1,1,2,2,-3,1,2,2,2,1,2,-2,-1,1,1,0,1,2,2,-2,1,2,2,2,1,2,-2,0,1,1,0,1,2,2,-2,1,2,2,2,2,1,1,0,1,1,0,1,2,2,-1,1,2,2,2,2,1,-2,0,1,2,0,1,2,2,-2,1,2,2,2,1,2,2,2,2,3,2,3,2,0,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,0,0,1,2,0,1,1,0,0,0,1,0,0,0,1,1,1,2,2,0,1,1,0,0,0,2,0,0,0,1,1,1,1,2,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,1,0,buffer,0,0,0,-1,-1,-1,-1,0,0,0,0,0,0,-1,0,0,0,0,-1,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-3,1,0,-1,0,0,0,0,-1,0,buffer,0,0,-1,-1,-1,0,buffer,-0.4,-0.4,-0.2,-0.4,0.2,0,0,-0.6,-0.2,buffer,-0.333333333,-0.666666667,-0.333333333,-0.066666667,-0.266666667,buffer,1,0,0,0,1,1,0.2,0.8,0.2,0.2,1,0.2,0.6,1.2,0.4,0.6,0.8,0.2,0,0.2,0,0,0.8,0.2,buffer,HS_TS +86,R_6IAzGCzsa3PoCCG,67 - 73,Canadian,Male,Male,University - Undergraduate,71,01PfPsV,01PAST,10,02DGEN,0.375,0,0.666666667,-1,3,3,-3,2,3,-3,3,-3,3,3,3,3,3,3,-1,3,3,-1,2,3,-3,3,-3,3,3,3,3,3,3,-1,3,3,-1,2,3,-3,3,-3,3,3,3,3,3,3,0,3,3,0,0,3,0,3,0,3,3,3,3,3,3,-1,3,3,-1,-1,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,3,2,0,3,0,3,0,0,0,0,0,0,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,3,0,3,0,0,0,0,0,0,buffer,-1,0,0,-1,-2,0,-3,0,-3,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,-1,0,-3,0,-3,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.8,-1.2,0,-0.6,0,0,-0.6,-1.2,0,buffer,0,0,-0.666666667,-0.2,-0.6,buffer,0,0,0,0,0,0,0.4,0,0,0.4,0,0,1.2,1.2,0,1,0,0,0,0,0,0.6,1.2,0,buffer,C_Ug +87,R_5cSs5A3Faexro8h,53 - 59,Canadian,Female,Female,University - Undergraduate,56,03VPfPs,02FUT,10,01ITEM,-0.75,0,1,-1,2,3,-2,0,1,-1,2,1,2,0,0,2,-2,2,-2,2,2,-2,0,1,0,2,2,0,0,0,2,-3,-1,-1,2,2,-2,0,0,1,2,2,0,1,0,2,-3,0,0,2,2,-2,2,0,-1,2,0,2,0,0,2,-3,0,0,2,2,0,2,0,-1,2,-1,2,0,2,2,-3,2,4,5,4,3,5,4,4,4,2,5,4,2,1,0,1,0,0,0,1,0,1,2,0,0,0,1,3,0,0,1,0,0,1,2,0,1,2,1,0,0,1,2,1,0,1,0,2,1,0,0,1,0,0,0,0,1,2,1,0,1,2,2,1,0,0,2,0,0,2,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,1,0,0,2,0,0,2,buffer,0,0,0,0,-2,-1,1,0,0,2,0,0,0,0,1,-1,0,0,-2,-2,0,2,0,-1,2,1,-2,0,0,2,1,0,0,-2,0,1,1,0,-1,0,1,-2,0,0,-1,buffer,0,1,2,-2,1,2,buffer,-0.4,0.4,0.2,-1,0.6,0.2,-0.2,0.2,-0.4,buffer,1,0.333333333,0.066666667,-0.066666667,-0.133333333,buffer,1,0,0,1,0,0,0.4,0.8,0.8,0.2,1.2,0.8,0.8,0.4,0.6,1.2,0.6,0.6,0.2,0.4,0.4,0.4,0.2,0.8,buffer,C_Ug +88,R_60xql6imXyVUikx,67 - 73,Canadian,Female,Female,High School (or equivalent),69,01PfPsV,02FUT,5,02DGEN,0.375,0,0.666666667,2,2,3,3,2,-3,1,1,3,-1,3,3,3,0,3,3,3,3,3,1,-3,0,2,0,0,3,3,3,-1,3,2,3,2,0,3,1,-3,3,-3,3,3,3,3,0,3,2,3,2,3,1,0,0,1,0,-1,3,2,2,-3,3,2,3,3,3,0,-3,0,1,0,1,3,2,3,-3,3,6,7,9,3,4,9,5,7,8,9,5,8,1,1,0,0,1,0,1,1,3,1,0,0,0,1,0,0,1,1,3,1,4,4,2,6,4,0,0,0,0,0,0,1,1,0,1,3,1,0,3,0,0,1,1,3,0,0,1,0,0,2,0,1,0,3,2,0,1,0,3,0,1,0,1,3,2,4,3,1,3,3,0,0,0,1,0,0,0,1,0,1,3,0,0,0,2,0,0,1,0,0,buffer,1,0,-1,0,0,-3,0,1,0,1,0,-1,-1,-2,0,0,0,1,3,-1,4,3,2,3,2,0,-1,0,-3,0,1,0,0,3,1,1,3,1,3,1,0,0,-1,1,0,buffer,1,0,1,-6,-1,1,buffer,0,-0.2,-0.8,0.6,2.8,-0.8,1,1.8,0,buffer,0.666666667,-2,-0.333333333,0.866666667,0.933333333,buffer,3,3,0,4,2,0,0.6,1.2,0.2,1.2,4,0,0.6,1.4,1,0.6,1.2,0.8,1.4,2.8,0.2,0.4,1,0.2,buffer,HS_TS +89,R_6b2iZyTt1bVtPxv,60 - 66,Canadian,Female,Female,High School (or equivalent),61,02PsVPf,01PAST,10,01ITEM,0.375,0.333333333,0.666666667,3,3,2,2,2,2,-2,3,-1,2,3,0,2,-2,3,2,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,2,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,3,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,3,2,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,2,2,2,3,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,0,buffer,0.2,0,0,0,0,0,-0.2,0,0,buffer,0,0.333333333,0.066666667,0,-0.066666667,buffer,1,0,0,0,0,0,0.2,0.4,0.2,0.2,0.4,0.2,0,0.4,0.2,0.2,0.4,0.2,0,0,0,0.2,0,0,buffer,HS_TS +90,R_1ou8VSpmQSa7eI9,53 - 59,Canadian,Male,Male,College Diploma/Certificate,58,02PsVPf,01PAST,5,02DGEN,0.25,0.333333333,0.666666667,3,3,3,3,-1,2,-2,1,-2,3,-1,-1,3,-3,3,3,3,3,3,-1,0,1,0,1,-1,-1,-1,3,-2,3,3,3,3,3,1,2,1,2,1,3,-1,-1,3,-2,3,3,3,3,3,0,0,-2,1,0,0,-2,-1,3,-3,3,3,3,3,3,0,1,-3,2,-1,1,-2,-1,3,-3,3,6,5,3,6,7,8,5,4,3,5,5,3,0,0,0,0,0,2,3,1,3,4,0,0,0,1,0,0,0,0,0,2,0,3,1,3,0,0,0,0,1,0,0,0,0,0,1,2,0,0,2,3,1,0,0,0,0,0,0,0,0,1,1,1,1,1,2,1,0,0,0,0,0,0,0,0,2,2,0,2,0,4,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,buffer,0,0,0,0,-1,0,3,1,1,1,-1,0,0,1,0,0,0,0,0,1,-1,2,0,2,-2,-1,0,0,1,0,0,0,0,0,2,1,-1,1,-1,3,0,0,0,0,0,buffer,1,1,0,1,2,5,buffer,-0.2,1.2,0,0.2,0.2,0,0.4,0.6,0,buffer,0.666666667,2.666666667,0.333333333,0.133333333,0.333333333,buffer,0,2,5,0,1,0,0,2.6,0.2,0.4,1.4,0.2,0.2,1.4,0.2,0.2,1.2,0.2,0.4,1.6,0,0,1,0,buffer,C_Ug +91,R_7qwBlahEjkF7Cmd,18 - 24,Canadian,Female,Female,High School (or equivalent),24,01PfPsV,02FUT,5,02DGEN,0,0,1,-1,2,0,3,-3,-3,0,1,1,0,0,0,0,0,0,-1,3,3,3,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,2,3,3,-3,-3,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,1,3,0,0,3,0,1,1,0,0,0,0,0,0,1,2,0,3,3,3,0,1,1,0,0,0,0,0,0,1,1,3,0,2,3,0,1,1,0,0,0,0,0,0,1,0,3,0,0,0,0,1,1,0,0,0,0,0,0,1,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,3,0,0,0,0,0,0,0,0,0,buffer,-1,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,2,-3,3,3,3,0,0,0,0,0,0,0,0,0,1,2,3,3,1,-3,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.6,0,0,1,0.6,0,2,-0.6,0,buffer,0,0,-0.2,0.533333333,0.466666667,buffer,0,0,0,0,0,0,0.8,1,0,1.8,1,0,1.4,1,0,0.8,0.4,0,2.6,0,0,0.6,0.6,0,buffer,HS_TS +92,R_7e1PRGSYfQHV8jE,39 - 45,Canadian,Male,Male,University - Graduate (Masters),43,03VPfPs,01PAST,10,01ITEM,0.125,0,0.666666667,0,1,0,1,0,0,0,1,-1,2,0,2,0,1,1,0,1,-1,0,2,3,1,3,2,2,-1,3,-2,0,-1,0,3,0,1,-2,0,0,-2,0,-1,-1,0,-1,-1,3,1,0,0,0,0,0,-1,3,0,-1,0,0,-2,1,0,0,-1,1,0,0,1,-1,-1,-1,0,2,0,-2,-1,-1,8,7,7,6,8,7,8,7,6,6,5,7,0,0,1,1,2,3,1,2,3,0,1,1,2,1,2,0,2,0,0,2,0,0,3,1,3,1,2,1,2,2,1,1,0,1,0,0,1,2,1,3,0,2,2,0,1,0,2,1,1,0,1,1,2,0,2,2,2,2,2,2,0,2,1,1,4,3,1,5,2,3,0,3,1,1,4,1,1,1,0,0,1,0,4,1,1,2,0,0,2,1,buffer,-1,-1,1,0,2,3,0,0,2,-3,1,-1,0,1,1,0,0,-1,-1,2,-1,-1,1,1,1,-1,0,-1,0,0,-1,1,0,1,4,2,1,1,1,2,-2,3,1,-1,3,buffer,0,0,1,0,3,0,buffer,0.2,0.4,0.4,0,0.2,-0.4,1,1.4,0.8,buffer,0.333333333,1,0.333333333,-0.066666667,1.066666667,buffer,2,1,0,2,2,1,0.8,1.8,1.4,0.8,1.4,1.6,0.6,1.4,1,0.8,1.2,2,1.6,2.8,1.8,0.6,1.4,1,buffer,grad_prof +93,R_1tnEBgFYQxHMmhO,53 - 59,Canadian,Female,Female,Trade School (non-military),59,02PsVPf,02FUT,10,01ITEM,0.25,0,1,1,0,3,1,3,-2,-1,3,0,-1,2,1,1,1,0,0,0,3,1,3,-1,-1,3,0,-1,2,0,0,2,0,0,0,3,1,3,-1,-1,3,-1,0,3,1,1,1,0,1,0,3,1,3,-1,-1,3,0,0,2,2,1,0,0,1,0,3,0,3,-1,-2,3,0,0,2,2,1,0,0,1,2,2,2,1,2,1,2,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,buffer,1,0,0,0,0,0,0,0,0,-1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,1,0,1,-1,0,-1,0,0,0,0,-1,0,0,-1,0,1,1,1,1,1,1,0,buffer,0,0,1,1,0,1,buffer,0.2,-0.2,0.2,0,0,-0.2,-0.2,0.2,0.8,buffer,0.333333333,0.666666667,0.066666667,-0.066666667,0.266666667,buffer,1,1,0,0,1,0,0.2,0.2,0.6,0.2,0.6,0.2,0,0.4,0.4,0.2,0.6,0.4,0,0.4,0.8,0.2,0.2,0,buffer,HS_TS +94,R_3VCRksFU2bgDkbo,32 - 38,Canadian,Female,Female,College Diploma/Certificate,36,01PfPsV,01PAST,5,02DGEN,0.875,0.333333333,0.666666667,3,2,-3,1,0,0,1,2,2,2,0,0,1,0,1,3,2,-3,2,1,0,2,1,2,2,0,0,2,0,1,3,2,-3,1,1,0,3,0,3,1,0,0,0,0,0,3,3,-3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,4,3,9,9,5,5,5,5,5,5,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,2,2,1,1,0,0,1,0,1,0,1,0,0,1,0,1,2,2,2,0,0,1,0,1,3,2,3,1,0,0,1,2,2,2,0,0,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,2,0,1,3,3,3,1,1,0,0,0,0,0,0,0,0,0,0,buffer,0,-1,0,1,0,0,0,-1,-2,-2,0,0,0,0,-1,-3,-2,-3,-1,1,0,1,0,-1,-1,0,0,0,0,0,-3,-3,-3,0,-1,0,1,1,1,1,0,0,2,0,1,buffer,1,2,-1,-2,4,4,buffer,0,-1,-0.2,-1.6,-0.2,0,-2,0.8,0.6,buffer,0.666666667,2,-0.4,-0.6,-0.2,buffer,3,2,5,0,0,0,0.4,0.4,0.2,0.2,1.2,0.4,0.4,1.4,0.4,1.8,1.4,0.4,0.2,0.8,0.6,2.2,0,0,buffer,C_Ug +95,R_31Ut9uRDCwBurrX,39 - 45,Canadian,Female,Female,College Diploma/Certificate,42,03VPfPs,01PAST,5,01ITEM,-0.125,0,1,2,1,3,3,3,-3,-1,2,-1,-2,2,2,2,-2,1,2,2,3,3,2,-3,-2,1,2,-2,2,2,3,-3,-1,3,3,3,3,1,-1,-3,1,-2,2,2,2,2,-2,1,-2,-1,3,3,3,1,-2,3,-2,3,2,2,2,-2,-2,-2,-2,3,3,1,1,-3,2,-2,-1,2,2,2,-3,-2,2,3,2,4,5,3,7,8,6,7,7,8,0,1,0,0,1,0,1,1,3,0,0,0,1,1,2,1,2,0,0,2,2,2,1,1,4,0,0,0,0,0,4,2,0,0,0,4,1,1,1,5,0,0,0,0,3,4,3,0,0,2,4,2,0,1,1,0,0,0,1,3,1,1,0,0,1,2,1,0,4,4,0,0,1,1,2,0,1,0,0,2,0,1,1,0,4,0,0,0,1,0,buffer,-4,-1,0,0,1,-4,0,0,2,-5,0,0,1,1,-1,-3,-1,0,0,0,-2,0,1,0,3,0,0,0,-1,-3,1,0,0,0,-1,2,0,-1,4,0,0,0,1,0,2,buffer,-5,-5,-4,-3,-2,-5,buffer,-0.8,-1.4,0.2,-0.8,0.4,-0.8,0,1,0.6,buffer,-4.666666667,-3.333333333,-0.666666667,-0.4,0.533333333,buffer,2,2,1,0,1,2,0.4,1,0.8,1,2,0,1.2,2.4,0.6,1.8,1.6,0.8,0.6,2.2,0.8,0.6,1.2,0.2,buffer,C_Ug +96,R_50wkiWI4Nvojx78,67 - 73,Canadian,Female,Female,College Diploma/Certificate,67,03VPfPs,02FUT,10,02DGEN,0.375,0,1,3,3,3,1,3,-3,-3,0,0,-2,3,3,2,-2,3,3,3,3,1,3,-3,-3,2,1,0,3,3,3,-2,3,3,3,3,1,3,-3,-3,2,1,0,3,3,3,-2,3,3,3,3,1,3,-3,-3,3,1,0,3,3,3,0,3,3,3,3,2,3,-3,-3,1,1,0,3,3,3,0,3,1,1,1,1,1,1,1,1,1,1,1,5,0,0,0,0,0,0,0,2,1,2,0,0,1,0,0,0,0,0,0,0,0,0,2,1,2,0,0,1,0,0,0,0,0,0,0,0,0,3,1,2,0,0,1,2,0,0,0,0,1,0,0,0,1,1,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,-1,0,0,0,0,0,-2,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,-2,0,0,0,0,-1,0,0,0,-2,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-4,buffer,0,-0.2,-0.4,-0.2,0.2,-0.4,-0.2,-0.4,0,buffer,0,-1.333333333,-0.2,-0.133333333,-0.2,buffer,0,0,0,0,0,4,0,1,0.2,0,1,0.2,0,1.2,0.6,0.2,0.8,0.6,0,0,0,0.2,0.4,0,buffer,C_Ug +97,R_7AdBPV3ZL8M0zjH,53 - 59,Canadian,Female,Female,University - Graduate (Masters),57,01PfPsV,01PAST,10,01ITEM,1.125,0.333333333,0.666666667,2,2,3,2,2,-1,-3,3,1,1,3,3,3,-1,3,3,3,3,1,1,2,-3,3,-1,3,3,3,3,-2,3,3,3,2,2,2,2,-2,3,2,3,3,3,3,0,3,3,3,3,2,3,2,-3,3,-2,3,3,3,3,-2,3,3,3,3,2,3,2,-3,3,-2,3,3,3,3,-2,3,7,7,7,5,5,5,8,7,8,9,9,8,1,1,0,1,1,3,0,0,2,2,0,0,0,1,0,1,1,1,0,0,3,1,0,1,2,0,0,0,1,0,1,1,0,0,1,3,0,0,3,2,0,0,0,1,0,1,1,0,0,1,3,0,0,3,2,0,0,0,1,0,0,0,1,1,1,0,1,0,3,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,1,0,-1,0,1,0,-2,0,0,0,0,0,0,0,0,1,1,1,0,1,0,3,0,0,0,0,2,0,buffer,-1,0,-1,-4,-4,-3,buffer,0.2,-0.2,0,0,-0.2,0,0.6,0.8,0.4,buffer,-0.666666667,-3.666666667,0,-0.066666667,0.6,buffer,2,2,2,1,2,0,0.8,1.4,0.2,0.6,1.4,0.2,0.6,1.6,0.2,0.6,1.6,0.2,0.6,0.8,0.4,0,0,0,buffer,grad_prof +98,R_6MupnsimpiL9sv5,67 - 73,American,Female,Female,College Diploma/Certificate,71,02PsVPf,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,1,2,2,0,0,-1,0,0,0,1,1,0,2,0,2,2,2,2,0,0,0,0,0,0,0,1,0,1,0,3,2,2,2,0,0,1,0,0,0,0,1,0,1,0,3,2,2,2,0,0,-1,0,0,0,0,1,0,1,0,3,2,2,2,0,0,-2,0,0,0,0,1,0,1,0,3,2,1,3,2,1,4,1,0,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,2,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,1,1,2,1,0,3,buffer,0,0.2,0,0,0.2,0,0,0,0,buffer,1.333333333,1.333333333,0.066666667,0.066666667,0,buffer,0,0,1,0,1,0,0.2,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0.4,0.2,0.4,0.4,0,0.2,0,0,0.2,0,buffer,C_Ug +99,R_38IEmEQGL9k2F8J,53 - 59,Canadian,Female,Female,College Diploma/Certificate,58,03VPfPs,02FUT,5,01ITEM,-0.25,0,1,1,1,1,0,3,0,-1,1,1,1,2,2,2,0,1,2,2,2,0,3,0,0,2,0,2,2,2,2,0,2,2,2,2,0,3,0,0,2,0,2,2,2,2,0,2,2,2,2,1,3,0,0,2,0,1,2,2,2,0,2,2,2,2,1,3,0,0,2,0,2,2,2,2,0,2,3,6,4,6,4,4,2,2,1,3,3,3,1,1,1,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,buffer,1,4,3,3,1,1,buffer,-0.2,0.2,0,-0.2,0,0,0,-0.2,0,buffer,2.666666667,1.666666667,0,-0.066666667,-0.066666667,buffer,3,2,0,1,1,2,0.6,0.8,0.2,0.6,0.8,0.2,0.8,0.6,0.2,0.8,0.8,0.2,0,0,0,0,0.2,0,buffer,C_Ug +100,R_1kHpDuYWtSWKU9i,60 - 66,Canadian,Female,Female,High School (or equivalent),61,01PfPsV,01PAST,10,02DGEN,1.125,0,1,-3,1,-3,-2,-1,0,1,1,1,-1,3,3,2,0,2,-3,0,-3,-3,-3,1,0,1,1,0,3,2,2,1,3,-3,3,1,-1,0,1,0,1,0,-1,3,3,2,0,3,-3,1,-3,-3,-3,2,3,3,3,2,3,3,3,3,3,-3,2,-1,-3,-1,2,3,2,2,2,3,3,3,2,3,1,1,1,4,2,2,1,1,1,1,1,1,0,1,0,1,2,1,1,0,0,1,0,1,0,1,1,0,2,4,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,2,2,2,2,2,3,0,0,1,3,1,0,1,2,1,0,2,2,1,1,3,0,0,1,2,1,0,3,4,2,3,0,0,0,1,1,0,1,0,1,0,0,1,2,0,2,0,0,1,1,0,0,0,0,1,0,buffer,0,1,0,0,0,-1,-1,-2,-2,-2,0,1,-1,-2,0,0,1,2,0,1,-1,-1,-1,0,-3,0,0,-1,-2,0,0,2,2,2,1,0,0,-1,0,1,0,1,0,0,0,buffer,0,0,0,3,1,1,buffer,0.2,-1.6,-0.4,0.8,-1.2,-0.6,1.4,0,0.2,buffer,0,1.666666667,-0.6,-0.333333333,0.533333333,buffer,3,1,1,0,0,0,0.8,0.6,0.6,1.6,0.6,0.2,0.6,2.2,1,0.8,1.8,0.8,2.4,0.4,0.4,1,0.4,0.2,buffer,HS_TS +101,R_3wS43W1JVNrzX1L,67 - 73,Canadian,Male,Male,College Diploma/Certificate,70,03VPfPs,02FUT,10,02DGEN,0.25,0,0.666666667,2,1,2,1,1,2,2,1,1,1,1,1,2,1,1,1,2,1,1,2,2,-1,2,-1,1,2,1,0,1,1,1,1,2,2,1,1,2,1,-1,1,2,1,1,2,1,1,1,2,2,1,1,1,2,1,2,1,1,2,1,2,1,0,1,1,2,1,1,2,1,2,1,1,0,1,0,6,6,4,5,5,5,5,5,5,5,5,5,1,1,1,0,1,0,3,1,2,0,1,0,2,0,0,1,0,0,1,0,1,0,0,2,0,1,0,1,1,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,0,2,0,1,0,1,1,1,1,1,3,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,2,0,2,buffer,0,1,1,-1,1,-1,2,0,2,-1,1,0,2,0,-1,0,-1,-1,1,-1,0,-1,-1,2,-1,1,0,-1,1,-1,0,0,0,0,0,1,3,1,0,0,0,0,-1,1,-2,buffer,1,1,-1,0,0,0,buffer,0.4,0.4,0.4,-0.4,-0.2,0,0,1,-0.4,buffer,0.333333333,0,0.4,-0.2,0.2,buffer,1,1,1,0,0,0,0.8,1.2,0.6,0.4,0.6,0.6,0.4,0.8,0.2,0.8,0.8,0.6,0.8,1,0.4,0.8,0,0.8,buffer,C_Ug +102,R_714Noev150iyC8S,67 - 73,Canadian,Male,Male,College Diploma/Certificate,67,01PfPsV,01PAST,5,01ITEM,1.5,0,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,-2,3,-3,3,3,-3,3,-3,3,3,-3,3,3,3,3,3,-3,3,-3,3,3,3,-3,-3,3,3,3,-3,3,1,1,3,3,-3,0,3,3,3,0,3,3,3,-3,3,10,0,10,10,0,5,10,5,5,5,5,5,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,5,0,6,0,0,6,0,6,0,0,6,0,0,0,0,0,6,0,6,0,0,0,6,6,0,0,0,6,0,2,2,0,0,6,3,0,0,0,3,0,0,0,6,0,0,5,0,6,0,0,0,0,0,0,0,6,0,0,0,2,2,6,0,0,3,0,0,6,3,0,0,0,0,0,buffer,0,0,-6,0,-6,0,6,0,0,-6,0,0,0,-6,0,-2,3,0,6,-6,-3,6,0,6,-3,0,6,0,-6,0,-2,3,-6,6,0,-3,0,0,-6,-3,0,6,0,0,0,buffer,0,-5,5,5,-5,0,buffer,-2.4,0,-1.2,0.2,1.2,0,0.2,-2.4,1.2,buffer,0,0,-1.2,0.466666667,-0.333333333,buffer,0,0,5,5,0,0,0,2.4,0,2.2,2.4,1.2,2.4,2.4,1.2,2,1.2,1.2,2.2,0,1.2,2,2.4,0,buffer,C_Ug +103,R_3ePLhpK1NKfkB2N,60 - 66,Canadian,Male,Male,University - Undergraduate,62,03VPfPs,01PAST,10,01ITEM,0.125,0.666666667,0.333333333,3,3,2,0,0,-3,-2,2,-2,0,0,0,2,0,0,3,3,2,-1,0,-3,-2,2,-3,0,0,0,2,0,1,3,3,2,-1,0,-3,-2,2,-3,0,0,0,2,0,0,3,3,2,-1,1,-3,-2,2,-2,0,1,0,2,-1,0,2,2,2,0,1,-3,-2,2,-2,0,1,0,2,0,0,8,8,8,7,8,7,8,8,8,7,8,8,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,-1,0,0,0,1,0,-1,0,0,-1,1,-1,-1,0,1,-1,0,0,0,1,0,-1,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,0,0,0,-1,1,buffer,0,0,0,0,0,-1,buffer,-0.2,0.2,-0.2,-0.4,0.2,-0.2,-0.6,0,0,buffer,0,-0.333333333,-0.066666667,-0.133333333,-0.2,buffer,1,0,1,1,0,0,0.2,0.2,0.2,0.2,0.2,0,0.4,0,0.4,0.6,0,0.2,0,0,0.2,0.6,0,0.2,buffer,C_Ug +104,R_5gUHoJeCdaBVT7l,46 - 52,Canadian,Female,Female,High School (or equivalent),51,01PfPsV,01PAST,5,01ITEM,0.25,0,1,-1,2,3,3,-1,-3,-2,-1,2,-3,3,-1,-1,-3,3,-1,3,3,3,-2,-3,-1,-1,3,-3,3,-1,-1,-3,3,1,1,2,1,-2,-3,1,-3,3,-3,3,-2,1,1,3,1,1,3,3,1,-2,-3,1,1,1,3,-2,2,1,3,2,2,3,2,2,1,-1,1,1,1,3,-2,2,1,3,2,3,1,3,5,6,7,6,6,6,6,7,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,2,1,1,2,1,0,3,2,1,0,0,1,2,4,0,2,1,0,0,2,1,1,2,1,4,0,1,3,4,0,3,0,0,1,3,4,1,2,1,4,0,1,3,4,0,2,2,1,2,0,0,2,2,0,0,0,1,2,4,0,1,1,0,1,1,3,2,0,0,0,0,0,0,0,0,buffer,-2,0,0,0,-1,-1,0,-2,0,-4,0,-1,-3,-4,0,-1,1,1,1,-2,-4,2,0,0,-4,0,0,-1,0,0,1,1,1,1,-1,-3,0,2,0,0,0,1,2,4,0,buffer,-5,-3,-5,-3,-1,-1,buffer,-0.6,-1.4,-1.6,0,-1.2,-0.2,0.6,-0.2,1.4,buffer,-4.333333333,-1.666666667,-1.2,-0.466666667,0.6,buffer,1,2,5,1,0,1,0.4,0.4,0,1.4,1.2,1.4,1,1.8,1.6,1.4,2.4,1.6,1.4,0.8,1.4,0.8,1,0,buffer,HS_TS +105,R_1EfA786ISA23pMn,25 - 31,Canadian,Male,Male,University - Undergraduate,29,02PsVPf,02FUT,5,02DGEN,-0.375,0,1,2,2,1,1,2,1,1,1,-1,2,1,1,2,0,1,-1,0,1,1,-1,3,-2,-1,-1,1,0,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,1,1,1,3,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,4,3,3,3,2,2,2,2,2,2,3,2,0,0,3,2,3,2,0,1,1,0,1,1,0,3,3,2,2,3,2,2,2,0,3,2,2,3,1,2,0,1,0,0,1,0,0,0,2,1,1,0,1,1,0,1,1,0,0,1,0,0,0,2,1,0,0,1,1,0,0,1,2,2,0,4,1,0,0,2,1,2,2,0,2,1,0,0,0,2,0,0,0,0,0,1,0,0,0,0,buffer,3,1,0,0,2,2,3,2,-2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,-2,2,2,2,2,0,2,-1,1,2,2,-2,4,1,0,0,2,0,2,2,0,2,buffer,3,3,2,1,1,1,buffer,1.2,1,0,2,1.2,1.6,0.4,1.4,1.2,buffer,2.666666667,1,0.733333333,1.6,1,buffer,2,2,1,0,0,0,1.6,1.6,0.6,2.6,1.8,2,0.4,0.6,0.6,0.6,0.6,0.4,1,1.4,1.4,0.6,0,0.2,buffer,C_Ug +106,R_7m3R1BTrRSjTZpB,46 - 52,Canadian,Male,Male,High School (or equivalent),48,02PsVPf,02FUT,5,01ITEM,1.125,0,1,1,3,-1,3,-3,2,1,3,2,1,2,3,3,2,3,3,3,-3,-1,1,-1,3,0,3,-1,3,3,3,-1,3,3,3,3,3,2,0,3,0,3,-2,3,3,-1,-3,3,3,3,-3,3,-3,2,3,3,3,1,3,3,3,3,3,3,3,-1,3,3,1,3,3,3,1,3,3,3,3,3,10,8,7,7,8,8,2,2,4,5,3,0,2,0,2,4,4,3,2,3,1,2,1,0,0,3,0,2,0,4,0,5,2,2,3,1,3,1,0,4,5,0,2,0,2,0,0,0,2,0,1,0,1,0,0,1,0,2,0,0,0,6,1,2,0,1,0,1,0,0,1,0,0,0,6,4,1,1,0,0,0,1,0,0,4,2,0,0,0,2,0,6,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,4,4,3,0,3,0,2,0,0,0,2,0,0,0,4,0,-1,1,0,3,0,3,0,0,4,4,0,0,0,4,4,-5,0,0,0,0,1,0,0,4,2,0,buffer,8,6,3,2,5,8,buffer,1.6,1.6,0.4,0.6,1.4,1.6,0.6,0.2,1.2,buffer,5.666666667,5,1.2,1.2,0.666666667,buffer,3,0,1,3,1,4,2.4,2.2,0.8,2.2,2.2,2,0.8,0.6,0.4,1.6,0.8,0.4,2.2,0.4,1.2,1.6,0.2,0,buffer,HS_TS +107,R_57zt0ILImxjmtGh,53 - 59,Canadian,Female,Female,University - Graduate (Masters),58,01PfPsV,01PAST,10,02DGEN,0,0.333333333,0.666666667,3,2,2,3,3,0,-2,2,-1,-2,2,2,3,2,2,2,1,2,2,2,0,1,2,3,-2,3,2,3,1,2,2,2,2,2,2,-1,2,2,3,-2,3,3,3,3,2,3,2,2,3,3,0,0,2,-2,0,3,2,3,-2,2,3,2,2,3,3,0,1,2,-2,-2,3,2,3,-1,2,0,1,1,3,1,1,1,1,0,0,1,1,1,1,0,1,1,0,3,0,4,0,1,0,0,1,0,1,0,0,1,1,1,4,0,4,0,1,1,0,1,0,0,0,0,0,0,0,2,0,1,2,1,0,0,4,0,0,0,0,0,0,0,3,0,1,0,1,0,0,3,0,0,1,0,0,0,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,1,0,0,2,0,0,0,1,0,buffer,1,1,0,1,1,0,1,0,3,-2,0,0,0,-3,0,1,0,0,1,1,1,1,0,3,0,0,1,0,-2,0,0,1,0,0,0,1,0,0,0,-2,0,1,0,1,0,buffer,-1,0,1,3,0,0,buffer,0.8,0.4,-0.6,0.6,1,-0.2,0.2,-0.2,0.4,buffer,0,1,0.2,0.466666667,0.133333333,buffer,3,0,0,1,0,1,0.8,1.4,0.4,0.6,1.8,0.6,0,1,1,0,0.8,0.8,0.2,0.4,0.6,0,0.6,0.2,buffer,grad_prof +108,R_7rBJSZZGplyzifl,53 - 59,Canadian,Female,Female,High School (or equivalent),58,03VPfPs,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,HS_TS +109,R_7Rym0Fc7Nb4IVHx,39 - 45,Canadian,Male,Male,College Diploma/Certificate,40,02PsVPf,01PAST,5,01ITEM,0.375,0,0.666666667,3,2,2,1,3,-3,-3,-3,-3,-3,3,1,1,3,1,3,2,2,1,3,-3,-3,-3,-3,-3,2,1,1,1,0,1,1,1,1,3,-3,-3,-3,-3,-3,1,1,2,1,1,3,1,1,0,3,-3,-3,-3,-3,-3,1,1,1,1,1,1,1,1,1,1,-3,-3,-3,-3,-3,1,1,1,1,1,5,7,6,9,4,7,10,8,6,7,7,7,0,0,0,0,0,0,0,0,0,0,1,0,0,2,1,2,1,1,0,0,0,0,0,0,0,2,0,1,2,0,0,1,1,1,0,0,0,0,0,0,2,0,0,2,0,2,1,1,0,2,0,0,0,0,0,2,0,0,2,0,2,1,1,0,0,0,0,0,0,0,1,0,1,0,1,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,buffer,0,-1,-1,-1,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,-2,0,0,0,0,0,0,0,1,0,0,0,1,1,-1,-2,0,0,0,0,0,1,0,1,0,1,buffer,-5,-1,0,2,-3,0,buffer,-0.6,0,0,-0.4,0,0.2,-0.2,0,0.6,buffer,-2,-0.333333333,-0.2,-0.066666667,0.133333333,buffer,4,3,1,3,1,1,0,0,0.8,0.8,0,1,0.6,0,0.8,1.2,0,0.8,0.8,0,0.6,1,0,0,buffer,C_Ug +110,R_7haSl9uSPTwF7YN,53 - 59,Canadian,Female,Female,University - Graduate (Masters),56,02PsVPf,01PAST,5,02DGEN,0.25,0.666666667,0.333333333,1,2,2,-2,3,0,1,3,0,3,1,0,3,0,2,0,2,2,0,3,0,3,1,0,1,2,1,3,0,2,0,2,2,-1,2,0,3,1,3,1,2,2,3,1,3,0,2,2,0,2,0,0,0,0,0,3,0,3,-2,3,0,2,3,1,2,0,1,0,0,1,2,1,3,2,3,5,7,6,7,5,6,2,6,3,3,4,3,1,0,0,2,0,0,2,2,0,2,1,1,0,0,0,1,0,0,1,1,0,2,2,3,2,1,2,0,1,1,1,0,0,2,1,0,1,3,0,3,2,0,0,2,1,1,0,1,3,1,0,0,3,0,2,1,1,0,2,1,0,0,0,1,1,0,0,0,3,0,0,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,1,0,4,0,buffer,0,0,0,0,-1,0,1,-1,0,-1,-1,1,0,-2,-1,0,0,-1,-2,0,0,2,-1,3,0,0,1,0,-1,0,0,0,-1,0,1,0,-1,0,3,-1,-1,0,0,-3,1,buffer,3,1,3,4,1,3,buffer,-0.2,-0.2,-0.6,-0.6,0.8,0,0,0.2,-0.6,buffer,2.333333333,2.666666667,-0.333333333,0.066666667,-0.133333333,buffer,2,2,0,1,2,0,0.6,1.2,0.4,0.6,1.8,1,0.8,1.4,1,1.2,1,1,0.4,0.6,0.6,0.4,0.4,1.2,buffer,grad_prof +111,R_1k5CwncYiKZj3Y5,53 - 59,Canadian,Female,Female,High School (or equivalent),59,01PfPsV,02FUT,5,01ITEM,0.125,0,1,3,3,3,1,1,2,-1,3,-1,1,-2,1,3,-3,1,3,3,3,1,-1,3,-2,3,-2,1,-1,1,3,-3,1,3,3,1,-1,3,3,1,3,1,1,-1,1,3,-3,2,3,3,3,3,2,3,0,3,-2,2,-2,1,3,-3,2,3,3,3,3,1,3,-2,3,-1,1,-1,0,3,-3,2,4,2,2,5,6,4,0,1,3,2,0,2,0,0,0,0,2,1,1,0,1,0,1,0,0,0,0,0,0,2,2,2,1,2,0,2,0,1,0,0,0,1,0,0,0,2,1,1,1,0,1,1,0,0,0,0,1,0,0,0,2,0,1,1,0,0,0,1,1,0,0,1,0,0,2,2,4,0,3,0,3,0,0,0,0,0,1,0,0,0,0,1,0,2,0,1,1,1,1,0,0,0,buffer,0,0,0,-2,1,0,0,0,0,-1,1,0,0,0,-1,0,0,2,0,2,0,1,0,2,0,0,-1,0,0,0,0,0,2,2,3,0,1,0,2,-1,-1,-1,0,0,1,buffer,4,1,-1,3,6,2,buffer,-0.2,-0.2,0,0.8,0.6,-0.2,1.4,0.4,-0.2,buffer,1.333333333,3.666666667,-0.133333333,0.4,0.533333333,buffer,1,4,2,2,1,1,0.4,0.6,0.2,1.2,1,0.4,0.6,0.8,0.2,0.4,0.4,0.6,1.6,1.2,0.2,0.2,0.8,0.4,buffer,HS_TS +112,R_3zSHSrn1Edyc7dM,67 - 73,Canadian,Female,Female,High School (or equivalent),67,01PfPsV,02FUT,10,01ITEM,-0.25,0.666666667,0.333333333,-1,0,3,3,-3,-3,-2,0,3,-2,2,0,3,-3,3,-1,0,2,2,-3,-3,-2,2,2,-2,3,1,3,-1,3,1,0,3,1,-3,0,0,2,1,0,2,0,3,0,3,-1,0,3,3,-3,-3,0,0,0,-3,2,1,3,-2,3,-1,0,3,3,-3,-3,0,0,0,-2,2,-1,2,-2,3,1,1,1,2,2,2,1,1,1,2,2,3,0,0,1,1,0,0,0,2,1,0,1,1,0,2,0,2,0,0,2,0,3,2,2,2,2,0,0,0,3,0,0,0,0,0,0,0,2,0,3,1,0,1,0,1,0,0,0,0,0,0,0,2,0,3,0,0,1,1,1,0,2,0,1,1,0,3,2,0,1,2,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,2,1,0,0,buffer,0,0,1,1,0,0,-2,2,-2,-1,1,0,0,1,0,2,0,0,2,0,3,0,2,-1,2,0,-1,-1,2,0,2,0,1,1,0,3,2,0,1,1,1,-1,-1,1,0,buffer,0,0,0,0,0,-1,buffer,0.4,-0.6,0.4,0.8,1.2,0,0.8,1.4,0,buffer,0,-0.333333333,0.066666667,0.666666667,0.733333333,buffer,1,1,1,1,1,2,0.4,0.6,0.8,0.8,2.2,0.6,0,1.2,0.4,0,1,0.6,0.8,1.6,0.6,0,0.2,0.6,buffer,HS_TS +113,R_5cklMbb05Lvui0w,53 - 59,Canadian,Female,Female,College Diploma/Certificate,59,03VPfPs,01PAST,10,02DGEN,-0.125,1,0,3,2,2,3,2,0,0,3,-2,1,3,2,2,0,3,3,2,0,2,-2,-2,0,2,1,-2,3,2,2,1,3,3,2,-2,1,3,2,0,3,1,1,3,1,3,1,3,3,2,2,2,3,1,-1,2,-2,1,3,2,3,-3,3,3,0,2,3,1,1,0,2,0,0,3,2,3,-2,3,2,4,2,3,5,5,0,1,1,2,2,7,0,0,2,1,4,2,0,1,3,3,0,0,0,1,0,0,0,4,2,1,2,0,0,3,0,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,3,0,0,2,0,0,1,1,0,1,2,1,0,0,1,2,0,0,0,2,1,5,4,0,1,0,3,0,1,1,0,0,0,2,0,1,2,0,1,0,2,1,0,0,0,1,0,buffer,0,0,2,0,3,1,-1,0,3,3,0,0,-1,-2,0,0,-2,4,2,0,1,0,-1,1,-1,0,1,0,-1,0,0,-2,2,0,3,4,-1,1,-2,2,0,1,1,-1,0,buffer,2,3,1,1,3,-2,buffer,1,1.2,-0.6,0.8,0,0,0.6,0.8,0.2,buffer,2,0.666666667,0.533333333,0.266666667,0.533333333,buffer,1,1,3,2,1,6,1.4,1.8,0.2,1.4,1,0.6,0.4,0.6,0.8,0.6,1,0.6,1.6,1.6,0.4,1,0.8,0.2,buffer,C_Ug +114,R_5zbTKvOz9belf19,60 - 66,Canadian,Female,Female,College Diploma/Certificate,63,01PfPsV,02FUT,5,01ITEM,0.375,0,1,1,3,3,3,3,-3,-2,3,1,-1,3,-2,3,-3,3,2,3,3,3,3,-3,-2,3,1,-2,3,-2,3,-2,3,1,3,3,3,3,-2,-2,3,1,1,3,-2,3,-2,3,0,3,3,3,3,-3,-3,1,1,-2,3,-1,2,-2,3,2,3,3,3,3,-2,-2,2,1,-1,3,-1,2,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,1,2,0,1,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,3,0,0,0,0,0,2,0,0,0,0,1,1,1,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,-1,-2,0,0,0,-1,-1,0,0,-1,0,0,0,0,0,0,-1,0,2,0,-1,-1,0,0,-1,0,0,0,0,0,-1,-1,0,2,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-0.6,-0.4,-0.2,0.2,-0.4,-0.2,0,0,buffer,0,0,-0.333333333,-0.133333333,-0.066666667,buffer,0,0,0,0,0,0,0.2,0.2,0.2,0,0.6,0.2,0.2,0.8,0.6,0.2,0.4,0.6,0.2,0.8,0,0.4,0.8,0,buffer,C_Ug +115,R_3oLwEdYU6imjRZ5,67 - 73,Canadian,Female,Female,High School (or equivalent),67,03VPfPs,01PAST,5,01ITEM,0,0,1,0,3,3,3,-3,-3,-2,1,0,-3,1,1,0,-1,1,0,3,3,3,-3,-2,-1,0,0,-1,1,0,0,-1,1,0,3,3,3,-3,-3,0,0,0,-1,1,0,0,-3,1,0,3,3,3,-3,-3,0,0,0,0,2,1,1,-2,1,0,3,3,3,-3,-3,0,0,0,-3,1,0,0,-3,1,1,3,2,1,2,3,1,2,2,1,2,2,0,0,0,0,0,1,1,1,0,2,0,1,0,0,0,0,0,0,0,0,0,2,1,0,2,0,1,0,2,0,0,0,0,0,0,0,2,1,0,3,1,0,1,1,0,0,0,0,0,0,0,2,1,0,0,0,1,0,2,0,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,3,1,1,1,1,0,buffer,0,0,0,0,0,1,-1,0,0,-1,-1,1,-1,-1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1,1,0,0,-3,-1,-1,-1,1,0,buffer,0,1,0,0,0,1,buffer,0,-0.2,-0.4,0,0.4,0,0,-0.2,-0.4,buffer,0.333333333,0.333333333,-0.2,0.133333333,-0.2,buffer,0,1,1,0,0,0,0,1,0.2,0,1,0.6,0,1.2,0.6,0,0.6,0.6,0,0.4,0.4,0,0.6,0.8,buffer,HS_TS +116,R_3FIoaAeGU3Saft8,39 - 45,Canadian,Female,Female,College Diploma/Certificate,41,01PfPsV,01PAST,5,02DGEN,0.5,0.666666667,0.333333333,0,1,1,-2,1,1,1,1,0,0,0,1,1,0,0,0,1,1,-2,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,1,1,1,0,1,2,1,0,1,1,1,0,1,1,1,0,0,5,6,6,6,6,6,6,7,7,6,6,7,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,1,1,0,2,0,0,1,0,1,0,0,0,1,1,1,1,0,1,2,0,1,0,0,0,0,1,1,1,1,1,1,1,0,4,0,1,0,0,1,0,1,0,0,0,0,1,1,0,2,0,0,1,1,0,1,0,1,1,1,0,0,1,1,2,0,0,0,0,1,0,0,1,1,1,1,buffer,-1,0,-1,-2,0,-1,0,1,1,1,-1,0,-1,-1,0,0,0,0,-2,0,-1,1,0,0,0,-1,0,1,1,1,1,0,-1,0,0,0,1,1,-1,1,0,0,0,0,-1,buffer,-1,-1,-1,0,0,-1,buffer,-0.8,0.4,-0.6,-0.4,0,0.4,0,0.4,-0.2,buffer,-1,-0.333333333,-0.333333333,0,0.066666667,buffer,1,0,0,0,1,0,0,0.6,0.4,0.8,0.4,0.6,0.8,0.2,1,1.2,0.4,0.2,0.8,0.6,0.6,0.8,0.2,0.8,buffer,C_Ug +117,R_1dNnZpCWyypzFjc,39 - 45,Canadian,Female,Female,University - Undergraduate,42,03VPfPs,01PAST,5,01ITEM,0.375,1,0,2,3,3,-2,2,2,-2,1,3,2,-2,-1,3,1,3,2,3,2,-2,1,2,-2,1,1,2,-2,-2,3,-2,3,1,2,2,-2,1,2,-2,1,-2,2,-2,-2,3,2,3,2,3,3,1,3,-2,-2,2,1,3,-2,-1,3,2,3,3,3,3,-2,3,-2,-2,3,1,2,-2,1,3,1,3,8,3,3,2,2,4,3,3,3,2,3,3,0,0,1,0,1,0,0,0,2,0,0,1,0,3,0,1,1,1,0,1,0,0,0,5,0,0,1,0,1,0,0,0,0,3,1,4,0,1,2,1,0,0,0,1,0,1,0,0,0,1,4,0,2,2,0,0,2,0,0,0,1,1,0,0,0,0,0,0,3,0,0,0,0,4,0,1,0,0,3,0,0,0,1,0,1,0,2,0,1,0,buffer,0,0,1,-3,0,-4,0,-1,0,-1,0,1,0,2,0,0,1,1,0,0,-4,0,-2,3,0,0,-1,0,1,0,0,1,0,-3,0,0,0,-1,3,-1,0,-2,0,3,0,buffer,5,0,0,0,-1,1,buffer,-0.4,-1.2,0.6,0.4,-0.6,0,-0.4,0.2,0.2,buffer,1.666666667,0,-0.333333333,-0.066666667,0,buffer,6,1,1,1,0,0,0.4,0.4,0.8,0.8,1,0.4,0.8,1.6,0.2,0.4,1.6,0.4,0.4,0.6,0.8,0.8,0.4,0.6,buffer,C_Ug +118,R_3GuRBPRYbGeCmxb,53 - 59,Canadian,Male,Male,Trade School (non-military),56,01PfPsV,01PAST,5,02DGEN,0.625,0.666666667,0.333333333,2,2,3,0,2,0,-2,3,-2,2,2,0,2,0,3,2,2,3,0,2,0,-2,3,-2,2,3,0,2,0,3,2,2,3,0,2,2,-2,3,-2,1,2,0,0,0,2,2,2,3,0,2,0,-2,2,-2,2,2,0,0,-2,3,2,2,3,0,2,0,-3,2,-3,1,3,0,0,-1,3,1,1,3,2,3,3,3,2,4,4,5,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,2,2,0,0,0,0,0,0,0,1,1,1,1,1,0,2,1,0,0,0,0,0,0,2,0,0,0,1,1,0,2,0,1,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,buffer,0,0,0,0,0,0,0,-1,0,0,1,0,-2,-2,0,0,0,0,0,0,2,-1,-1,-1,0,-1,0,0,-1,1,0,0,0,0,0,2,-1,0,-1,0,0,0,2,-1,1,buffer,-2,-1,-1,-2,-2,-1,buffer,0,-0.2,-0.6,0,-0.2,-0.2,0,0,0.4,buffer,-1.333333333,-1.666666667,-0.266666667,-0.133333333,0.133333333,buffer,1,2,0,1,3,0,0,0,0.2,0,0.6,0.6,0,0.2,0.8,0,0.8,0.8,0,0.6,0.8,0,0.6,0.4,buffer,HS_TS +119,R_1v7mtrAcuSjwnvY,46 - 52,Canadian,Male,Male,University - Undergraduate,52,02PsVPf,01PAST,5,02DGEN,0.125,1,0,0,2,1,-3,2,-1,0,3,0,0,-1,-3,3,0,0,0,0,0,0,0,0,0,2,-3,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,-3,2,0,0,3,-3,0,0,0,0,0,0,0,2,0,-3,2,0,0,3,-3,0,0,0,3,0,0,2,5,2,3,2,2,2,2,2,2,2,2,0,2,1,3,2,1,0,1,3,0,1,3,3,0,0,0,1,1,3,0,1,0,3,0,0,1,3,3,0,0,0,0,1,0,0,1,0,0,3,0,1,3,3,0,0,0,0,1,0,0,1,0,0,3,0,1,3,0,0,0,0,3,0,0,2,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,buffer,0,2,0,3,2,0,0,1,0,0,0,0,0,0,0,0,1,0,3,0,0,0,3,-3,0,0,0,3,0,0,0,3,0,0,2,0,0,2,3,0,0,0,-3,0,0,buffer,0,3,0,1,0,0,buffer,1.4,0.2,0,0.8,0,0.6,1,1,-0.6,buffer,1,0.333333333,0.533333333,0.466666667,0.466666667,buffer,1,3,0,0,0,0,1.6,1,1.4,1,0.8,1.4,0.2,0.8,1.4,0.2,0.8,0.8,1,1,0,0,0,0.6,buffer,C_Ug +120,R_5t9WlW88wHr6PTD,39 - 45,Canadian,Male,Male,University - Graduate (Masters),43,03VPfPs,02FUT,10,01ITEM,-0.125,0.666666667,0.333333333,0,2,3,1,2,0,-2,1,0,1,3,-2,2,-1,3,0,1,3,1,2,-2,0,2,0,1,2,-2,2,-1,3,0,2,3,0,2,-2,0,2,0,0,3,-2,2,0,3,0,1,3,1,1,0,-2,2,-1,1,2,-2,2,-1,3,0,1,3,2,1,1,-1,2,0,2,3,-2,2,-1,3,2,2,2,3,4,3,1,1,1,3,1,0,0,1,0,0,0,2,2,1,0,0,1,0,0,0,0,0,0,0,1,0,2,2,1,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,0,buffer,0,0,0,0,-1,2,2,0,-1,0,0,0,0,0,0,0,-1,0,0,-1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,0,1,0,buffer,1,1,1,0,3,3,buffer,-0.2,0.6,0,-0.4,0.4,0.2,0.2,-0.6,0.2,buffer,1,2,0.133333333,0.066666667,-0.066666667,buffer,1,2,1,2,0,1,0.2,1,0.2,0.2,1.2,0.2,0.4,0.4,0.2,0.6,0.8,0,0.4,0.2,0.4,0.2,0.8,0.2,buffer,grad_prof +121,R_18SUwkYfG9qBhAh,32 - 38,Canadian,Male,Male,University - Undergraduate,35,01PfPsV,02FUT,5,01ITEM,-0.125,0,1,0,2,1,-1,3,-1,1,0,0,0,0,-1,0,1,0,-2,-1,-2,-1,-1,-1,-3,-1,-2,-2,-1,0,-3,-1,-2,-1,0,-2,-1,-1,-1,-2,-2,-1,-1,-1,-2,-2,-1,-1,0,0,0,1,0,0,0,-1,1,0,0,0,-1,-1,-1,-1,0,0,0,-1,-2,-1,-1,-2,-1,0,0,-1,-1,-2,2,2,2,2,2,2,2,2,1,2,2,2,2,3,3,0,4,0,4,1,2,2,1,1,3,2,2,1,2,3,0,4,0,3,2,1,1,1,1,2,2,1,0,2,1,2,3,1,1,1,1,0,0,1,1,2,1,1,2,1,1,4,1,2,1,2,1,0,1,1,2,2,1,1,0,0,0,0,1,1,1,1,0,2,1,0,1,1,0,0,1,1,2,1,0,3,1,0,0,0,0,1,buffer,2,1,2,-2,1,-1,3,0,1,2,1,0,2,0,1,0,0,2,-1,0,-1,1,1,-1,0,1,0,1,0,-1,0,1,0,-1,-1,-2,0,1,-2,0,0,2,1,0,0,buffer,0,0,1,0,0,0,buffer,0.8,1,0.8,0.2,0,0.2,-0.2,-0.6,0.6,buffer,0.333333333,0,0.866666667,0.133333333,-0.066666667,buffer,0,0,0,0,0,1,2.4,1.8,1.8,2,1.4,1.4,1.6,0.8,1,1.8,1.4,1.2,0.4,0.8,0.8,0.6,1.4,0.2,buffer,C_Ug +122,R_6vzQFHkLNsJbjHz,32 - 38,Canadian,Male,Male,University - Undergraduate,36,03VPfPs,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,2,2,2,0,2,0,-2,2,-1,0,2,2,2,1,2,2,2,2,0,2,2,-2,2,-2,2,2,2,2,2,2,2,2,2,0,2,1,-2,2,-2,1,2,2,2,2,2,2,2,2,0,2,2,-2,2,-2,1,2,2,2,2,2,2,2,2,0,2,1,-2,2,-2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,2,0,0,1,2,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,2,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0.2,0,0,0,0,0,0.2,0,buffer,0,0,0.066666667,0,0.066666667,buffer,0,0,0,0,0,0,0,1,0.2,0,0.6,0.2,0,0.8,0.2,0,0.6,0.2,0,0.4,0,0,0.2,0,buffer,C_Ug +123,R_7MMekJdpF6Vor4N,60 - 66,Canadian,Male,Male,College Diploma/Certificate,60,01PfPsV,01PAST,10,01ITEM,0.25,1,0,0,1,3,-2,-1,0,-3,2,-1,-1,2,1,1,-2,2,-1,1,3,-3,-1,-1,-3,1,-2,0,2,1,2,-3,2,-1,2,3,-3,-1,-2,-3,1,-2,0,2,1,3,-3,2,-1,2,3,-3,-2,-2,-3,2,-3,-1,2,1,2,-3,2,-2,1,3,-3,-2,-1,-3,1,-3,-2,2,2,2,-3,2,0,1,0,2,4,1,2,2,1,2,0,1,1,0,0,1,0,1,0,1,1,1,0,0,1,1,0,1,1,0,1,0,2,0,1,1,1,0,0,2,1,0,1,1,0,1,1,2,0,0,2,0,0,0,1,1,0,2,0,0,1,1,1,0,1,2,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,1,0,1,0,0,0,buffer,0,-1,0,0,-1,-1,0,1,-1,1,0,0,0,0,0,-1,1,0,0,-1,1,0,0,-1,0,0,-1,1,0,0,-1,0,0,0,0,0,0,-1,0,-1,0,-1,1,0,0,buffer,-2,-1,-1,0,4,0,buffer,-0.4,0,0,-0.2,0,0,-0.2,-0.4,0,buffer,-1.333333333,1.333333333,-0.133333333,-0.066666667,-0.2,buffer,2,3,1,0,2,0,0.4,0.8,0.4,0.6,1,0.6,0.8,0.8,0.4,0.8,1,0.6,0.2,0.2,0.2,0.4,0.6,0.2,buffer,C_Ug +124,R_5CHmpGft3VrvEBo,60 - 66,Canadian,Male,Male,Professional Degree (ex. JD/MD),66,02PsVPf,02FUT,5,02DGEN,-0.125,1,0,-3,3,3,-3,-3,1,1,1,-2,0,1,-1,2,1,2,-3,3,3,-3,-3,1,1,1,-1,1,1,-1,1,1,2,-3,3,3,-3,2,1,1,1,1,1,1,-2,1,1,2,-3,3,3,-3,-3,1,2,1,-1,0,1,-1,1,1,2,-3,3,3,-3,-3,1,1,1,-2,0,1,-1,1,1,2,1,1,1,2,2,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,5,0,0,0,3,1,0,1,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,5,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,0,5,0,0,0,3,1,0,1,0,0,0,0,0,0,0,5,0,-1,0,1,0,0,1,0,0,0,buffer,0,0,0,1,1,0,buffer,0,0,0,1,0.8,0.2,1,0,0.2,buffer,0,0.666666667,0,0.666666667,0.4,buffer,1,1,0,0,0,0,0,0.4,0.2,1,0.8,0.4,0,0.4,0.2,0,0,0.2,1,0.4,0.2,0,0.4,0,buffer,grad_prof +125,R_1PYxLxS3QW7j3oD,46 - 52,Canadian,Male,Male,High School (or equivalent),51,01PfPsV,02FUT,10,01ITEM,0.5,1,0,3,3,2,3,2,-2,0,2,-1,2,1,-2,3,0,2,3,3,2,-1,1,-3,-1,2,1,1,1,0,2,-2,2,3,3,3,-2,0,-3,2,2,2,1,1,-3,3,-1,1,2,3,2,3,3,-3,-1,2,0,2,1,-1,2,-2,1,3,2,1,3,2,-1,1,1,-2,-1,1,1,3,-3,1,2,2,3,4,6,4,0,1,1,2,1,3,0,0,0,4,1,1,1,0,2,1,0,2,1,2,0,0,0,1,5,2,1,2,0,3,1,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0,0,1,1,2,1,0,1,1,0,0,1,1,1,1,3,0,3,0,3,1,0,0,1,1,1,0,3,0,1,0,0,3,1,1,1,1,1,1,0,1,2,2,1,2,3,0,2,1,1,0,buffer,-1,0,0,4,0,0,0,0,1,1,0,1,0,0,-1,0,-1,0,5,2,0,1,-1,2,-2,0,-2,0,-2,0,-1,-1,0,1,0,-2,1,-1,-1,-3,0,1,0,0,1,buffer,2,1,2,2,5,1,buffer,0.6,0.4,0,1.2,0,-0.8,-0.2,-1.2,0.4,buffer,1.666666667,2.666666667,0.333333333,0.133333333,-0.333333333,buffer,2,4,1,2,0,2,1,1,1,1.6,1.4,0.6,0.4,0.6,1,0.4,1.4,1.4,0.6,0.8,1.2,0.8,2,0.8,buffer,HS_TS +126,R_56bUAbiNMFrT6EQ,39 - 45,American,Female,Female,High School (or equivalent),41,03VPfPs,01PAST,10,01ITEM,-1.375,0,1,-2,3,0,0,-3,-3,-1,0,1,-3,0,0,0,0,0,-1,3,3,0,-2,-3,-2,2,1,0,3,3,-3,-3,-1,0,3,2,0,-2,-3,-2,0,1,-3,3,3,-3,-1,-1,0,3,2,2,2,-3,-2,0,0,-2,3,3,2,-3,1,-1,3,3,2,1,-3,-1,2,0,-3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,3,0,1,0,1,2,0,3,3,3,3,3,1,2,0,2,0,1,0,1,0,0,0,3,3,3,1,1,2,0,2,2,5,0,1,0,1,1,3,3,2,3,1,1,0,3,2,4,0,0,2,1,0,3,3,0,0,0,1,0,1,0,0,0,0,2,0,3,0,0,0,2,0,1,0,1,0,1,0,1,2,0,1,0,0,2,3,1,buffer,-1,0,1,-2,-4,0,0,2,-1,2,0,0,1,0,0,1,0,-1,-2,-3,0,1,-2,-1,0,0,0,3,1,1,0,0,0,0,-1,0,-1,0,0,2,0,0,-2,-1,-1,buffer,0,0,0,0,0,0,buffer,-1.2,0.6,0.2,-1,-0.4,1,-0.2,0.2,-0.8,buffer,0,0,-0.133333333,-0.133333333,-0.266666667,buffer,0,0,0,0,0,0,1,1.2,2.6,1,0.2,2.2,2.2,0.6,2.4,2,0.6,1.2,0.4,1,0.4,0.6,0.8,1.2,buffer,HS_TS +127,R_3PjJOEs4lPrWC53,25 - 31,Canadian,Male,Male,University - Undergraduate,27,03VPfPs,01PAST,10,01ITEM,0.125,1,0,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-2,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,-2,1,-1,1,1,1,1,1,1,0,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,5,5,5,6,6,6,1,2,3,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,buffer,2,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,4,3,2,5,5,5,buffer,0.4,-0.2,0,0.2,0.2,0,-0.2,0,0,buffer,3,5,0.066666667,0.133333333,-0.066666667,buffer,1,1,1,0,1,2,0.4,0,0,0.4,0.2,0,0,0.2,0,0.2,0,0,0,0.2,0,0.2,0.2,0,buffer,C_Ug +128,R_5wobymd5tkFP9tj,67 - 73,American,Male,Male,College Diploma/Certificate,70,02PsVPf,02FUT,5,02DGEN,-0.125,0.333333333,0.666666667,2,2,2,2,2,-1,1,1,1,1,1,0,2,1,3,3,2,2,2,3,-1,1,0,1,2,1,1,2,1,3,3,2,2,2,3,0,1,0,1,2,1,1,2,2,3,3,2,2,2,2,-1,0,2,1,2,1,0,2,1,3,3,2,2,2,3,-1,1,1,1,2,1,1,2,1,3,4,5,2,3,3,3,3,4,5,4,3,4,1,0,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,buffer,0,0,0,0,1,0,-1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,-1,1,-1,-1,0,0,0,-1,0,1,0,buffer,1,1,-3,-1,0,-1,buffer,0.2,-0.2,0.2,0,0.4,0.2,-0.2,-0.2,0,buffer,-0.333333333,-0.666666667,0.066666667,0.2,-0.133333333,buffer,1,2,1,1,1,1,0.4,0.4,0.2,0.4,0.6,0.4,0.2,0.6,0,0.4,0.2,0.2,0,0.2,0.2,0.2,0.4,0.2,buffer,C_Ug +129,R_1pXlkaaYWFKpNzX,46 - 52,Canadian,Male,Male,College Diploma/Certificate,50,02PsVPf,02FUT,5,02DGEN,1,0,1,1,3,-2,1,2,-2,-1,2,1,2,1,1,0,2,1,1,2,2,3,2,2,2,2,1,1,0,1,2,2,1,1,1,1,0,2,1,2,1,2,1,1,2,1,1,0,2,1,1,0,2,1,1,2,1,0,1,1,2,2,1,2,3,-2,2,2,1,3,1,2,1,2,1,0,1,3,7,8,8,7,8,8,8,8,9,9,8,7,0,1,4,2,0,4,3,0,0,1,1,0,2,0,0,0,2,3,1,0,3,3,1,1,1,0,1,1,1,1,1,2,3,1,0,3,2,0,0,2,0,0,2,0,0,1,0,0,1,0,3,4,1,1,1,1,0,0,1,2,0,1,1,3,0,1,0,1,1,0,1,1,1,1,1,0,2,3,2,0,0,2,1,1,1,1,0,2,1,2,buffer,-1,-1,1,1,0,1,1,0,0,-1,1,0,0,0,0,-1,2,3,0,0,0,-1,0,0,0,-1,1,1,0,-1,0,-1,-2,1,0,1,-2,0,0,-1,0,1,-1,0,-1,buffer,-1,0,-1,-2,0,1,buffer,0,0.2,0.2,0.8,-0.2,0,-0.4,-0.4,-0.2,buffer,-0.666666667,-0.333333333,0.133333333,0.2,-0.333333333,buffer,0,0,0,1,0,2,1.4,1.6,0.6,1.2,1.8,0.8,1.4,1.4,0.4,0.4,2,0.8,1,0.6,1,1.4,1,1.2,buffer,C_Ug +130,R_6RflDkHds1J8B0z,60 - 66,American,Male,Male,College Diploma/Certificate,62,01PfPsV,02FUT,10,01ITEM,0.25,0,0.333333333,-2,2,2,-1,2,1,-3,3,-3,1,1,1,2,-2,2,-3,3,2,-2,2,1,-3,3,-3,2,2,1,2,-2,2,-3,3,3,-2,2,2,-3,3,-3,2,2,1,2,-1,3,-2,3,2,-1,2,1,-3,2,-2,1,2,2,2,-2,3,-2,3,3,1,1,1,-3,2,-3,1,0,1,2,-2,2,3,3,3,4,2,3,2,2,2,3,2,3,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,1,0,1,1,0,0,1,0,1,1,2,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,2,1,0,0,0,1,0,2,1,0,0,1,buffer,1,0,0,1,0,0,0,-1,-1,1,0,-1,0,0,-1,1,0,0,-1,-1,1,0,-1,0,1,0,0,0,1,1,0,0,0,-2,-1,1,0,0,-1,0,-2,-1,0,1,0,buffer,1,1,1,1,0,0,buffer,0.4,-0.2,-0.4,-0.2,0.2,0.4,-0.6,0,-0.4,buffer,1,0.333333333,-0.066666667,0.133333333,-0.333333333,buffer,1,1,0,1,0,1,0.6,0.2,0.2,0.8,0.4,0.6,0.2,0.4,0.6,1,0.2,0.2,0.2,0.2,0.4,0.8,0.2,0.8,buffer,C_Ug +131,R_6Wx6aJ9SVGL76Uu,53 - 59,Canadian,Male,Male,University - Graduate (Masters),54,02PsVPf,02FUT,5,02DGEN,-0.125,0.666666667,0.333333333,2,3,2,-2,1,1,-3,3,-3,1,3,1,2,2,3,0,3,3,-2,1,1,-1,0,1,2,3,3,1,3,3,1,3,3,-3,0,2,2,1,2,2,3,3,1,2,3,0,3,2,0,1,0,-3,2,-2,2,3,2,2,2,3,0,3,3,0,1,2,-3,2,-2,1,3,3,3,0,3,6,6,6,7,7,6,5,5,3,1,1,2,2,0,1,0,0,0,2,3,4,1,0,2,1,1,0,1,0,1,1,1,1,5,2,5,1,0,2,1,0,0,2,0,0,2,0,1,0,1,1,1,0,1,0,0,0,2,0,1,2,0,1,0,1,1,0,0,2,1,2,0,1,0,0,1,1,1,3,1,1,0,0,0,0,1,0,0,0,1,0,0,2,0,0,0,1,0,1,1,2,0,buffer,0,0,1,-2,0,-1,2,2,3,0,0,1,1,1,0,-1,0,0,-1,1,0,5,1,4,1,0,0,0,-2,0,1,0,-1,1,1,-1,3,1,1,-1,0,-1,-1,-1,0,buffer,1,1,3,6,6,4,buffer,-0.2,1.2,0.6,-0.2,2.2,-0.4,0.4,0.6,-0.6,buffer,1.666666667,5.333333333,0.533333333,0.533333333,0.133333333,buffer,1,1,0,4,4,1,0.6,2,0.8,0.8,2.8,0.6,0.8,0.8,0.2,1,0.6,1,0.6,1.2,0.2,0.2,0.6,0.8,buffer,grad_prof +132,R_32b75d1ulG0kEgq,60 - 66,American,Female,Female,High School (or equivalent),65,02PsVPf,02FUT,5,01ITEM,-0.25,0,1,1,3,3,2,2,1,-3,3,-3,0,3,3,3,0,3,3,3,3,1,3,1,-3,3,-3,0,3,3,2,-1,3,2,3,3,0,2,2,-3,3,-3,0,3,3,3,-1,3,2,3,3,3,2,1,-3,3,-3,0,3,3,2,-1,3,1,2,3,3,1,0,-3,3,0,0,3,3,1,0,3,4,5,3,7,2,3,5,3,5,7,7,6,2,0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,2,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,1,0,0,3,0,0,0,2,0,0,1,0,0,1,1,1,0,0,0,0,0,0,1,0,0,1,1,0,0,1,1,0,0,3,0,0,0,1,1,0,buffer,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,-1,0,1,-1,0,0,0,-3,0,0,0,-2,1,0,0,-1,0,1,0,0,0,0,-3,0,0,0,0,-1,0,buffer,-1,2,-2,0,-5,-3,buffer,0.4,0,0,0,-0.6,-0.2,0,-0.6,-0.2,buffer,-0.333333333,-2.666666667,0.133333333,-0.266666667,-0.266666667,buffer,3,3,0,2,4,1,0.8,0,0.4,0.6,0.2,0.2,0.4,0,0.4,0.6,0.8,0.4,0.6,0.2,0.2,0.6,0.8,0.4,buffer,HS_TS +133,R_5WJ7pZu4fXxlFdl,67 - 73,American,Male,Male,University - Graduate (Masters),67,01PfPsV,01PAST,5,02DGEN,0.125,0.666666667,0.333333333,2,1,2,2,-1,-2,-2,1,-2,1,1,1,1,0,1,1,2,2,0,0,-2,-2,1,-2,1,2,1,2,0,2,2,2,2,1,1,-2,-2,2,-2,2,2,1,2,0,2,2,2,2,2,1,-2,-2,2,-2,1,2,1,2,0,2,2,2,2,2,1,-2,-2,2,-2,1,2,1,1,0,1,2,2,1,2,2,2,2,2,2,2,2,2,1,1,0,2,1,0,0,0,0,0,1,0,1,0,1,0,1,0,1,2,0,0,1,0,1,1,0,1,0,1,0,1,0,0,2,0,0,1,0,0,1,0,1,0,1,0,1,0,0,2,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,buffer,1,0,0,2,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,0,0,-1,0,-1,buffer,0,0,-1,0,0,0,buffer,0.4,-0.2,0,0.2,0.2,0.4,0.6,0.4,-0.4,buffer,-0.333333333,0,0.066666667,0.266666667,0.2,buffer,0,0,1,0,0,0,1,0,0.6,0.8,0.4,0.6,0.6,0.2,0.6,0.6,0.2,0.2,0.6,0.4,0,0,0,0.4,buffer,grad_prof +134,R_5DnGIu10XHfxKY9,46 - 52,Canadian,Male,Male,University - Undergraduate,52,02PsVPf,01PAST,5,02DGEN,-0.25,0.333333333,0.666666667,3,3,2,1,3,-1,0,1,1,1,2,1,3,1,3,3,3,3,0,-1,0,-1,1,-1,2,2,1,3,0,2,3,3,3,0,-1,2,0,3,-2,2,0,0,2,-1,1,3,3,-1,-1,3,0,-2,3,-2,2,3,2,3,-3,3,3,3,-1,-1,2,0,-3,3,-1,1,0,1,0,-3,3,5,7,5,8,8,8,7,5,5,7,8,6,0,0,1,1,4,1,1,0,2,1,0,0,0,1,1,0,0,1,1,4,3,0,2,3,1,2,1,1,2,2,0,0,3,2,0,1,2,2,3,1,1,1,0,4,0,0,0,3,2,1,1,3,2,2,0,2,0,3,4,0,0,0,0,0,0,2,1,2,1,0,2,1,1,1,1,0,0,0,0,1,0,1,0,1,1,3,1,3,0,0,buffer,0,0,-2,-1,4,0,-1,-2,-1,0,-1,-1,0,-3,1,0,0,-2,-1,3,2,-3,0,1,1,0,1,-2,-2,2,0,0,0,0,-1,2,0,2,0,-1,-1,0,-2,1,1,buffer,-2,2,0,1,0,2,buffer,0.2,-0.8,-0.8,0,0.2,-0.2,-0.2,0.6,-0.2,buffer,0,1,-0.466666667,0,0.066666667,buffer,3,1,3,0,3,1,1.2,1,0.4,1.2,1.8,1.6,1,1.8,1.2,1.2,1.6,1.8,0,1.2,1.2,0.2,0.6,1.4,buffer,C_Ug +135,R_3ugs5bjxhuKcNu9,60 - 66,American,Female,Female,University - Graduate (Masters),60,01PfPsV,02FUT,5,01ITEM,0.5,0,1,3,3,3,2,3,-3,2,2,2,2,3,2,2,1,1,3,3,3,3,3,-3,2,2,2,2,3,3,3,3,3,2,2,2,2,2,-3,2,2,2,2,3,3,3,3,3,2,2,2,2,2,-2,2,2,-2,-2,3,3,3,3,3,3,3,3,3,3,-3,2,2,2,-3,3,3,3,3,3,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,1,0,0,0,0,0,0,1,1,2,2,1,1,1,0,1,1,0,0,4,4,0,1,1,2,2,0,0,0,1,0,0,0,0,0,5,0,1,1,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,4,1,0,0,0,0,0,buffer,-1,-1,-1,1,-1,-1,0,0,-4,-4,0,0,0,0,0,1,1,1,-1,1,0,0,0,0,-5,0,0,0,0,0,0,0,0,0,0,-1,0,0,-4,-1,0,0,0,0,0,buffer,1,0,0,0,0,0,buffer,-0.6,-1.8,0,0.6,-1,0,0,-1.2,0,buffer,0.333333333,0,-0.8,-0.133333333,-0.4,buffer,0,0,0,1,0,0,0.2,0,1.2,0.8,0,1.2,0.8,1.8,1.2,0.2,1,1.2,1,0,0,1,1.2,0,buffer,grad_prof +136,R_6KCToUhfj8M8IDG,67 - 73,American,Female,Female,College Diploma/Certificate,70,03VPfPs,02FUT,10,01ITEM,0,0,1,3,3,2,1,-1,1,-2,3,-1,3,2,-1,2,-2,3,3,3,2,1,-1,1,-2,2,-1,2,2,0,2,-1,3,3,3,2,0,-1,1,-2,3,1,2,2,1,2,0,2,3,3,1,1,-1,0,-2,1,-2,2,2,0,2,-2,3,3,3,1,1,-1,1,-3,2,-1,2,2,-1,2,-2,3,1,1,1,1,2,3,1,2,2,1,2,1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,2,1,0,2,0,2,1,0,0,1,0,0,1,0,2,1,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,2,0,0,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,buffer,0,0,-1,0,0,-1,0,-1,-1,0,0,0,0,1,0,0,0,-1,1,0,0,-1,-1,2,0,0,2,0,2,1,0,0,0,1,0,-1,-1,0,1,0,0,0,0,1,1,buffer,0,-1,-1,0,0,2,buffer,-0.2,-0.6,0.2,0,0,1,0.2,-0.2,0.4,buffer,-0.666666667,0.666666667,-0.2,0.333333333,0.133333333,buffer,0,1,2,0,0,1,0,0.4,0.4,0.2,0.6,1,0.2,1,0.2,0.2,0.6,0,0.2,0.6,0.6,0,0.8,0.2,buffer,C_Ug +137,R_5CNPGj3zE2XNYeR,67 - 73,American,Male,Male,College Diploma/Certificate,68,02PsVPf,01PAST,10,02DGEN,0.5,0.666666667,0.333333333,3,3,3,-3,3,3,-3,3,-3,-3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,3,3,-3,3,-3,3,3,-3,3,-3,3,0,0,10,0,0,10,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,10,0,0,0,buffer,0,0,0,-1.2,0,0,-1.2,0,0,buffer,3.333333333,0,0,-0.4,-0.4,buffer,0,0,0,0,0,10,0,1.2,0,0,1.2,0,0,1.2,0,1.2,1.2,0,0,0,0,1.2,0,0,buffer,C_Ug +138,R_6ZOAtFe1RrAZdXm,53 - 59,Canadian,Male,Male,Trade School (non-military),58,03VPfPs,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,2,2,1,0,2,1,-2,2,-3,0,0,1,2,0,0,2,2,1,0,2,0,-2,2,-2,1,0,0,2,0,0,2,2,1,0,2,1,-2,2,-2,0,0,0,2,0,0,2,2,1,0,2,0,-2,2,-2,0,0,0,2,0,0,2,2,1,0,2,0,-2,2,-2,0,0,0,2,0,0,2,1,2,2,2,1,1,2,1,2,2,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,1,-1,1,0,0,0,buffer,0,0.2,0,0,-0.2,0,0,0.4,0,buffer,0.333333333,0,0.066666667,-0.066666667,0.133333333,buffer,0,1,1,1,0,0,0,0.6,0.2,0,0.2,0.2,0,0.4,0.2,0,0.4,0.2,0,0.4,0,0,0,0,buffer,HS_TS +139,R_6R4r6h0g1mr3rGo,67 - 73,American,Male,Male,Trade School (non-military),71,03VPfPs,01PAST,10,02DGEN,-0.75,0.333333333,0.333333333,0,2,2,0,-1,2,1,2,0,1,2,2,2,2,1,0,2,1,1,-1,1,1,2,1,2,2,2,2,2,1,1,2,1,-1,-1,2,1,2,1,2,2,2,2,2,1,0,1,2,1,-1,1,0,2,1,0,2,2,1,1,1,0,2,2,2,-1,1,0,2,0,0,2,2,1,1,1,5,6,6,4,6,5,5,6,6,5,4,5,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,0,2,0,1,1,0,0,1,0,0,1,1,0,1,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,buffer,0,-1,1,0,0,0,-1,0,0,0,0,0,-1,-1,0,1,0,1,-1,0,-1,-1,0,1,0,0,0,-1,-1,0,1,-1,0,1,0,1,0,0,-1,0,0,0,0,0,0,buffer,0,0,0,-1,2,0,buffer,0,-0.2,-0.4,0.2,-0.2,-0.4,0.2,0,0,buffer,0,0.333333333,-0.2,-0.133333333,0.066666667,buffer,1,0,1,0,2,1,0.4,0.6,0,0.6,0.4,0,0.4,0.8,0.4,0.4,0.6,0.4,0.6,0.2,0,0.4,0.2,0,buffer,HS_TS +140,R_70SLWlEzFffvmLC,46 - 52,Canadian,Male,Male,College Diploma/Certificate,52,03VPfPs,01PAST,5,01ITEM,-0.25,0.333333333,0.666666667,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-2,1,2,-2,3,-2,0,3,0,3,1,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,buffer,0,0,0,-0.2,0,0,-0.2,0,0,buffer,0,-0.333333333,0,-0.066666667,-0.066666667,buffer,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,buffer,C_Ug +141,R_7PwK6yn7eA7k40N,46 - 52,Canadian,Male,Male,University - Undergraduate,51,03VPfPs,02FUT,5,02DGEN,0.375,0.666666667,0.333333333,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,2,3,3,3,3,-3,3,3,3,3,-3,3,-2,3,3,3,3,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,3,3,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,3,3,3,3,3,-1,3,3,0,3,-3,3,-3,3,3,3,3,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,buffer,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-2,0,0,3,0,0,0,-1,0,0,0,0,buffer,0,0,-1,-1,0,-1,buffer,0,0.6,0,-0.4,0,-0.2,-0.4,0.6,-0.2,buffer,-0.333333333,-0.666666667,0.2,-0.2,-1.85E-17,buffer,0,0,0,1,0,0,0,0.6,0.2,0,0,0.2,0,0,0.2,0.4,0,0.4,0,0.6,0,0.4,0,0.2,buffer,C_Ug +142,R_5dLgEDRdASxfuRX,32 - 38,Canadian,Female,Female,University - Undergraduate,35,01PfPsV,01PAST,10,01ITEM,-0.125,0.666666667,0.333333333,3,3,1,0,2,-2,0,2,-1,3,1,-2,2,-2,2,3,3,3,0,1,-2,-2,1,-2,1,2,-2,2,-2,2,3,3,2,-2,2,-2,-1,0,-2,-1,2,-2,1,-2,2,3,3,1,0,2,-2,-2,2,-2,2,2,-2,3,-2,2,3,3,0,2,2,-1,-1,2,-2,3,2,-3,3,-2,3,3,2,2,2,4,2,2,3,1,2,2,3,0,0,2,0,1,0,2,1,1,2,1,0,0,0,0,0,0,1,2,0,0,1,2,1,4,1,0,1,0,0,0,0,0,0,0,0,2,0,1,1,1,0,1,0,0,0,0,1,2,0,1,1,0,1,0,1,1,1,0,1,0,0,1,2,1,0,1,1,0,2,0,0,1,0,0,0,0,1,2,0,1,1,0,0,1,0,1,0,0,1,buffer,0,0,2,0,1,0,0,1,0,1,0,0,-1,0,0,0,0,0,0,0,-1,0,2,0,4,0,-1,0,0,-1,0,0,0,0,1,-1,0,1,0,1,0,-1,1,0,-1,buffer,1,-1,1,0,2,-1,buffer,0.6,0.4,-0.2,0,1,-0.4,0.2,0.2,-0.2,buffer,0.333333333,0.333333333,0.266666667,0.2,0.066666667,buffer,1,2,0,0,1,2,0.6,1.2,0.2,0.6,1.6,0.4,0,0.8,0.4,0.6,0.6,0.8,0.8,0.8,0.2,0.6,0.6,0.4,buffer,C_Ug +143,R_7YXvnff8uualDwM,53 - 59,Canadian,Male,Male,College Diploma/Certificate,53,02PsVPf,01PAST,10,01ITEM,0.25,1,0,0,1,3,2,3,0,-1,2,-1,1,1,-2,2,0,1,0,1,2,2,2,1,-1,2,-1,2,1,-2,2,-1,1,0,2,2,2,2,0,-1,2,-1,2,1,-2,2,-1,1,0,1,2,2,2,1,-1,2,0,2,1,-2,2,-1,1,0,1,2,2,2,1,0,2,0,2,1,-2,2,-1,1,4,3,4,8,6,2,2,1,2,3,2,2,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,0,1,0,0,0,1,-1,0,0,0,0,0,0,0,0,buffer,2,2,2,5,4,0,buffer,0,-0.2,0,0.2,-0.6,0,0.2,0,0,buffer,2,3,-0.066666667,-0.133333333,0.066666667,buffer,4,3,2,1,1,0,0.4,0.4,0.2,0.6,0.2,0.2,0.4,0.6,0.2,0.4,0.8,0.2,0.2,0.2,0,0,0.2,0,buffer,C_Ug +144,R_57x6VVRg8Pjng9b,32 - 38,Canadian,Female,Female,University - PhD,38,01PfPsV,02FUT,10,02DGEN,-0.375,0.333333333,0.666666667,3,3,3,2,3,1,-3,2,-3,2,3,0,3,2,3,3,3,3,2,3,1,-3,2,-3,2,3,0,3,2,3,3,3,3,3,3,1,-2,3,-2,2,3,0,3,2,3,3,3,3,2,3,1,-3,3,-3,2,3,0,3,2,3,3,3,3,2,3,1,-3,2,-3,1,3,-3,3,2,3,4,1,1,6,1,1,7,1,1,4,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,3,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,3,0,0,0,buffer,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,-1,0,-3,0,0,0,0,0,0,1,0,0,1,0,1,-1,0,-3,0,0,0,buffer,-3,0,0,2,0,0,buffer,0,-0.2,0,0.2,0.4,-0.6,0.2,0.2,-0.6,buffer,-1,0.666666667,-0.066666667,1.85E-17,-0.066666667,buffer,2,0,0,3,0,0,0,0,0,0.2,0.6,0,0,0.2,0,0,0.2,0.6,0.2,0.6,0,0,0.4,0.6,buffer,grad_prof +145,R_1XaffUG5PkYS6aZ,67 - 73,American,Female,Female,College Diploma/Certificate,70,03VPfPs,01PAST,5,02DGEN,-0.25,0,1,2,1,3,0,2,0,1,2,-1,1,3,2,2,1,2,1,2,3,0,1,0,1,2,-1,0,3,2,2,-2,2,0,1,3,-1,1,0,0,2,-1,1,3,2,2,0,2,2,2,2,1,1,-1,0,2,-1,0,3,2,2,0,3,2,2,2,0,1,-1,-1,2,-1,0,3,2,2,-1,3,2,3,3,2,2,4,1,2,2,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,3,0,2,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,1,1,2,0,0,1,0,0,0,2,1,1,1,0,1,0,0,1,0,0,1,0,0,0,2,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,buffer,1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,2,-1,2,-1,-1,1,0,-1,-1,0,0,-1,0,0,0,-1,-1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,buffer,1,1,1,1,1,3,buffer,-0.2,-0.4,0.2,0.2,-0.6,-0.4,0.4,0.2,0.2,buffer,1,1.666666667,-0.133333333,-0.266666667,0.266666667,buffer,0,1,1,0,1,1,0.6,0.2,0.6,0.8,0.2,0.2,0.8,0.6,0.4,0.6,0.8,0.6,0.6,0.4,0.4,0.2,0.2,0.2,buffer,C_Ug +146,R_3ZEJTUbbiHhiNNe,67 - 73,American,Male,Male,University - PhD,72,01PfPsV,02FUT,10,02DGEN,0,1,0,-1,3,1,1,0,-3,2,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0.2,0,0,0.2,0,0,0.2,0,0,0.2,0,0,0,0,0,0,0,buffer,grad_prof +147,R_1QGIaEA2AaGAPj9,39 - 45,Canadian,Female,Female,College Diploma/Certificate,44,03VPfPs,02FUT,10,01ITEM,0.125,0,1,2,0,2,0,0,1,1,0,1,1,-1,1,1,0,2,1,-1,0,0,1,2,0,0,0,1,0,1,1,0,0,2,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,2,1,1,2,1,2,2,1,0,0,0,0,1,0,0,0,0,0,7,7,6,8,6,6,4,6,5,6,6,5,1,1,2,0,1,1,1,0,1,0,1,0,0,0,2,0,1,1,1,1,0,0,1,1,1,2,0,0,1,1,1,1,1,1,1,0,1,1,0,0,2,0,1,1,1,0,1,0,2,1,1,1,0,1,0,1,1,1,0,2,1,2,1,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1,1,2,1,1,buffer,0,0,1,-1,0,1,0,-1,1,0,-1,0,-1,-1,1,0,0,1,-1,0,-1,-1,1,0,1,1,-1,-1,1,-1,0,2,0,0,0,0,1,0,-1,1,0,-1,-2,0,0,buffer,3,1,1,2,0,1,buffer,0,0.2,-0.4,0,0,-0.2,0.4,0.2,-0.6,buffer,1.666666667,1,-0.066666667,-0.066666667,1.85E-17,buffer,1,1,0,2,0,0,1,0.6,0.6,0.8,0.6,0.8,1,0.4,1,0.8,0.6,1,1,0.8,0.6,0.6,0.6,1.2,buffer,C_Ug +148,R_1NUrOnuIGFIdED6,67 - 73,American,Male,Male,Trade School (non-military),71,03VPfPs,01PAST,5,01ITEM,0.25,0,1,2,0,2,-1,3,2,-3,3,-3,2,3,2,2,-2,3,2,-1,2,-2,3,2,-3,3,-3,2,3,2,2,-2,3,2,-2,2,-2,3,2,-3,2,-3,2,3,2,2,-2,3,3,-2,3,-1,2,1,-2,2,-2,1,3,3,2,-2,3,3,-2,3,-1,1,1,-3,2,-2,1,3,3,2,-3,3,1,1,1,1,1,1,2,2,1,2,3,3,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,1,0,0,0,0,0,0,0,1,2,1,0,1,1,1,1,1,1,0,1,0,0,0,1,2,1,0,2,1,0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,buffer,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,0,-1,0,0,0,-1,0,-1,1,-2,-1,0,0,-1,-1,0,-1,0,-1,0,0,1,0,0,-1,0,-1,1,0,0,0,0,0,-1,0,buffer,-1,-1,0,-1,-2,-2,buffer,-0.6,-1,-0.2,-0.6,-0.6,-0.4,0,0,-0.2,buffer,-0.666666667,-1.666666667,-0.6,-0.533333333,-0.066666667,buffer,0,0,0,0,1,2,0.4,0,0,0.6,0.2,0,1,1,0.2,1.2,0.8,0.4,0.2,0.2,0,0.2,0.2,0.2,buffer,HS_TS +149,R_7BFMMimGwwLAWAx,60 - 66,Canadian,Male,Male,University - Undergraduate,62,01PfPsV,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,0,2,2,0,3,2,2,2,1,1,3,2,2,1,2,1,2,2,0,2,2,2,2,0,2,3,2,2,2,2,0,2,2,0,2,2,2,2,0,1,2,2,2,0,2,0,2,2,0,3,2,2,2,0,2,2,2,2,0,1,1,3,2,0,3,2,2,2,0,2,2,2,2,2,1,2,2,2,2,3,3,2,2,2,2,2,2,1,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,2,0,1,1,0,0,0,0,0,0,0,0,0,0,0,2,0,buffer,1,0,0,0,1,0,0,0,0,0,-1,0,0,0,-1,-1,-1,0,0,1,0,0,0,0,-1,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,1,1,0,0,0,0,buffer,0,0,0,0,1,1,buffer,0.4,0,-0.4,-0.2,-0.2,-0.2,-0.2,0.2,0.2,buffer,0,0.666666667,0,-0.2,0.066666667,buffer,0,1,1,0,0,0,0.4,0.4,0.2,0.2,0.2,0.4,0,0.4,0.6,0.4,0.4,0.6,0.2,0.2,0.6,0.4,0,0.4,buffer,C_Ug +150,R_7jxZv8IeVyOZaWG,60 - 66,American,Female,Female,Trade School (non-military),66,02PsVPf,02FUT,5,01ITEM,0,0.666666667,0.333333333,2,2,2,0,3,0,1,1,1,1,1,1,2,0,2,2,2,2,0,3,1,0,2,0,2,2,1,1,2,2,2,2,2,0,3,2,0,2,2,2,2,2,2,2,2,2,2,2,0,3,1,1,1,0,2,1,1,2,0,2,2,2,2,0,3,0,1,1,1,1,1,1,1,0,2,0,4,2,0,2,2,1,1,1,1,2,2,0,0,0,0,0,1,1,1,1,1,1,0,1,2,0,0,0,0,0,0,2,1,1,1,1,1,1,0,2,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,2,0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,buffer,0,0,0,0,0,0,1,1,0,0,1,0,1,2,0,0,0,0,0,0,2,1,1,1,1,1,1,-1,2,0,0,0,0,0,0,0,0,0,1,-1,0,1,0,0,0,buffer,-1,3,1,-1,0,0,buffer,0,0.4,0.8,0,1.2,0.6,0,0,0.2,buffer,1,-0.333333333,0.4,0.6,0.066666667,buffer,0,2,0,0,1,1,0,1,0.8,0,1.2,0.8,0,0.6,0,0,0,0.2,0,0.6,0.4,0,0.6,0.2,buffer,HS_TS +151,R_3JDv13TGH2wYNxL,67 - 73,American,Female,Female,High School (or equivalent),71,02PsVPf,01PAST,10,02DGEN,0.625,0,1,3,2,3,3,-1,-2,-3,2,-2,1,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,3,2,3,1,-1,-3,-3,3,-2,-2,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,1,2,1,1,1,1,1,1,1,2,1,1,0,0,0,0,0,1,0,1,1,4,0,0,0,0,0,0,0,0,2,0,1,0,1,0,3,0,0,0,0,0,0,0,0,0,0,1,0,1,1,4,0,0,0,0,0,0,0,0,0,0,1,0,1,1,4,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,-1,-1,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,0,0,0,0,0,buffer,0,1,0,-1,0,0,buffer,0,0,0,0.4,-0.4,0,0.4,0.4,0,buffer,0.333333333,-0.333333333,0,0,0.266666667,buffer,0,1,0,1,0,0,0,1.4,0,0.4,1,0,0,1.4,0,0,1.4,0,0.4,0.4,0,0,0,0,buffer,HS_TS +152,R_1vVlTIoXp4otw9b,46 - 52,Canadian,Female,Female,University - Undergraduate,46,01PfPsV,02FUT,10,01ITEM,0.125,0.666666667,0.333333333,3,2,3,2,2,-3,-1,-1,1,0,2,-2,3,-3,3,3,3,3,1,2,-3,1,3,-3,3,1,-3,3,-3,3,3,3,3,1,3,-3,1,3,-3,3,1,-3,3,-3,3,2,2,2,2,2,-3,-2,-2,2,-2,2,-2,-2,-3,3,3,3,3,3,1,-3,1,-1,1,-1,2,1,1,-3,3,3,3,3,3,3,3,8,5,5,5,5,5,0,1,0,1,0,0,2,4,4,3,1,1,0,0,0,0,1,0,1,1,0,2,4,4,3,1,1,0,0,0,1,0,1,0,0,0,1,1,1,2,0,0,5,0,0,0,1,0,1,1,0,2,0,0,1,0,3,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,3,1,1,1,0,3,3,0,0,buffer,-1,1,-1,1,0,0,1,3,3,1,1,1,-5,0,0,0,0,0,0,0,0,0,4,4,2,1,-2,-2,0,0,-1,-1,-1,-1,0,0,-3,-1,-1,-1,0,-3,-3,0,0,buffer,-5,-2,-2,-2,-2,-2,buffer,0,1.6,-0.6,0,2,-0.6,-0.8,-1.2,-1.2,buffer,-3,-2,0.333333333,0.466666667,-1.066666667,buffer,0,0,0,3,0,0,0.4,2.6,0.4,0.6,2.6,0.4,0.4,1,1,0.6,0.6,1,0.2,0,0,1,1.2,1.2,buffer,C_Ug +153,R_34qGWjMp36VziGX,46 - 52,Canadian,Male,Male,University - Undergraduate,48,01PfPsV,02FUT,10,02DGEN,0.875,0,1,3,3,3,3,3,0,0,3,0,3,3,3,3,3,3,3,3,3,3,3,0,0,3,-1,3,3,2,3,3,3,2,3,3,2,2,0,0,3,0,2,3,3,3,3,2,3,3,3,3,3,0,0,3,0,2,3,3,2,2,3,1,3,2,3,3,1,0,2,1,1,3,2,1,1,1,3,3,4,6,5,4,5,4,5,9,8,7,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,2,0,1,0,0,1,0,1,1,2,0,1,2,2,2,1,0,0,1,1,0,0,0,1,1,0,1,0,0,1,2,0,1,0,0,1,0,1,1,1,0,1,1,1,2,buffer,0,0,0,0,0,0,0,0,1,-1,0,1,-1,-1,0,-1,0,-1,1,1,-1,0,-1,-1,-1,0,-1,-2,-2,-1,-1,0,-1,1,1,-1,0,-1,0,0,0,0,-1,-1,-1,buffer,-2,-1,-1,-3,-3,-3,buffer,0,0,-0.2,0,-0.8,-1.2,0,-0.4,-0.6,buffer,-1.333333333,-3,-0.066666667,-0.666666667,-0.333333333,buffer,3,2,0,4,4,2,0,0.2,0.2,0.6,0.2,0.2,0,0.2,0.4,0.6,1,1.4,0.6,0.4,0.4,0.6,0.8,1,buffer,C_Ug +154,R_3q8hpZsyYuntLQM,60 - 66,American,Male,Male,University - Undergraduate,66,02PsVPf,01PAST,10,02DGEN,-0.125,0.666666667,0.333333333,3,2,3,-2,-1,-2,1,3,0,0,2,-3,2,2,3,0,1,2,0,-1,0,1,2,1,-1,3,-3,2,2,3,0,3,1,1,1,2,-1,2,0,2,3,3,3,3,2,3,2,3,1,1,0,1,3,0,1,3,-3,3,2,3,1,0,0,1,-2,0,3,2,3,1,3,-3,3,1,3,2,2,1,2,8,1,1,0,1,1,4,2,3,1,1,2,0,2,0,1,1,1,1,0,0,0,0,3,1,2,3,2,4,2,1,0,2,1,6,1,1,1,0,0,0,3,2,2,0,0,0,1,1,0,1,0,0,2,2,3,3,1,2,2,1,3,1,1,0,1,1,0,0,2,1,1,2,2,2,0,1,3,0,6,1,1,1,2,2,3,0,3,0,2,1,3,0,0,0,0,1,0,buffer,3,1,1,-1,-2,0,0,1,1,0,0,0,-1,0,0,1,-1,-1,0,1,2,0,0,-3,1,0,6,0,0,1,-2,0,-2,1,-1,2,0,-1,-2,3,0,6,1,0,1,buffer,1,2,0,1,4,-1,buffer,0.4,0.4,-0.2,0,0,1.4,-0.8,0.4,1.6,buffer,1,1.333333333,0.2,0.466666667,0.4,buffer,0,6,0,0,4,1,1.4,1,0.2,2.2,1.8,2,1,0.6,0.4,2.2,1.8,0.6,1.2,1.6,1.8,2,1.2,0.2,buffer,C_Ug +155,R_31cnn6pFgsAYVmU,60 - 66,Canadian,Male,Male,College Diploma/Certificate,65,03VPfPs,01PAST,5,02DGEN,-0.375,1,0,2,2,1,-2,2,1,0,2,-2,1,2,0,2,-2,2,2,2,1,-1,2,0,1,2,-2,0,0,-2,2,1,2,2,2,1,-2,2,0,-1,2,-1,0,-2,-2,2,-2,2,2,2,1,0,2,0,-2,2,-2,0,1,0,2,-2,2,2,2,1,1,2,0,-2,2,-2,0,-1,0,2,-2,2,1,1,2,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,1,2,2,0,3,0,0,0,0,0,0,1,1,0,1,1,4,2,0,0,0,0,0,0,2,0,1,2,0,0,1,1,0,0,0,0,0,0,0,3,0,1,2,0,0,1,3,0,0,0,0,0,0,0,1,0,0,2,0,1,0,2,0,0,3,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,buffer,0,0,0,-1,0,0,-1,0,0,0,1,2,0,3,0,0,0,0,-3,0,0,-1,0,1,0,1,2,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,3,0,buffer,0,0,1,0,0,0,buffer,-0.2,-0.2,1.2,-0.6,0,0.6,0,0.6,0.6,buffer,0.333333333,0,0.266666667,0,0.4,buffer,0,0,1,0,0,0,0.2,0.6,1.4,0,0.8,1.2,0.4,0.8,0.2,0.6,0.8,0.6,0.2,0.6,1,0.2,0,0.4,buffer,C_Ug +156,R_3q32cRTAfOFU8Sa,60 - 66,Canadian,Male,Male,University - Undergraduate,66,02PsVPf,01PAST,5,02DGEN,0.375,0.333333333,0.333333333,3,3,3,3,1,-2,-3,3,1,3,-2,1,3,-1,3,3,3,3,3,1,-3,-3,3,3,2,-2,3,2,-2,2,3,3,3,3,1,-3,-3,2,3,1,-2,2,3,-3,3,3,3,3,3,-1,-3,-3,3,-2,2,-2,1,3,-3,3,3,3,3,3,-1,-3,-3,3,-3,1,-1,1,3,-3,3,4,2,3,4,2,4,2,2,1,2,3,3,0,0,0,0,0,1,0,0,2,1,0,2,1,1,1,0,0,0,0,0,1,0,1,2,2,0,1,0,2,0,0,0,0,0,2,1,0,0,3,1,0,0,0,2,0,0,0,0,0,2,1,0,0,4,2,1,0,0,2,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,buffer,0,0,0,0,-2,0,0,0,-1,0,0,2,1,-1,1,0,0,0,0,-2,0,0,1,-2,0,-1,1,0,0,0,0,0,0,0,0,0,0,1,-1,0,-1,1,1,1,1,buffer,2,0,2,2,-1,1,buffer,-0.4,-0.2,0.6,-0.4,-0.2,0,0,0,0.6,buffer,1.333333333,0.666666667,-1.85E-17,-0.2,0.2,buffer,0,0,1,0,1,2,0,0.8,1,0,1.2,0.6,0.4,1,0.4,0.4,1.4,0.6,0,0.4,0.8,0,0.4,0.2,buffer,C_Ug +157,R_1CNrJPVWRR7J28f,67 - 73,American,Female,Female,University - Graduate (Masters),71,01PfPsV,01PAST,10,02DGEN,-0.5,0,1,-1,1,2,0,3,-2,-2,3,-2,1,1,-1,2,1,1,1,1,1,-2,2,-3,-2,3,-2,2,0,-1,2,1,1,2,1,0,-2,2,-2,-2,3,-2,2,1,-2,2,2,0,-1,0,1,0,2,-2,-2,2,-2,1,0,-2,1,-1,0,-1,0,2,1,2,-2,-2,2,-2,0,0,-2,2,-1,0,5,8,7,9,6,5,5,6,6,8,8,8,2,0,1,2,1,1,0,0,0,1,1,0,0,0,0,3,0,2,2,1,0,0,0,0,1,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,1,1,2,1,0,1,0,1,1,0,0,1,0,1,1,1,0,2,1,1,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,buffer,2,-1,0,2,0,1,0,-1,0,1,0,-1,-1,-2,-1,3,-1,2,1,0,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,-1,0,1,0,0,0,-1,1,1,-1,1,1,buffer,0,2,1,1,-2,-3,buffer,0.6,0.2,-1,1,-0.2,-0.4,0,0,0.6,buffer,1,-1.333333333,-0.066666667,0.133333333,0.2,buffer,4,2,2,3,2,2,1.2,0.4,0.2,1.6,0.2,0.6,0.6,0.2,1.2,0.6,0.4,1,0.4,0.2,0.8,0.4,0.2,0.2,buffer,grad_prof +158,R_1LZQSZFNRdnsJxL,67 - 73,American,Female,Female,University - PhD,71,01PfPsV,02FUT,5,02DGEN,-0.25,0,1,3,3,2,-3,2,1,-3,3,-3,2,3,-1,3,1,3,3,3,2,-3,2,2,-3,3,-3,2,3,-1,3,2,3,3,3,2,-3,2,2,-3,3,-3,2,3,-1,3,2,3,3,3,2,-3,2,1,-3,3,-3,2,3,-1,3,1,3,3,3,2,1,1,1,-3,3,-3,1,3,-1,3,1,3,0,0,0,0,0,0,0,1,0,2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,-4,-1,1,0,0,0,-1,0,0,0,1,0,0,0,0,-4,-1,0,0,0,0,-1,0,0,0,0,0,buffer,0,-1,0,-2,-2,0,buffer,0,0.2,0.2,-1,0,0.2,-1,-0.2,0,buffer,-0.333333333,-1.333333333,0.133333333,-0.266666667,-0.4,buffer,0,0,0,2,1,0,0,0.2,0.2,0,0.2,0.2,0,0,0,1,0.2,0,0,0,0,1,0.2,0,buffer,grad_prof +159,R_59LL8DXdTJLqSB3,53 - 59,American,Female,Female,High School (or equivalent),53,03VPfPs,02FUT,5,01ITEM,0,1,0,3,2,3,2,0,-3,0,0,1,2,-1,-3,3,-3,2,3,2,3,2,0,-3,1,0,1,2,-1,-3,3,-3,2,3,2,3,1,0,-3,1,0,2,2,-1,-3,3,-3,1,3,2,3,3,0,-3,0,0,0,2,-1,-3,3,-3,2,2,2,2,3,0,-3,0,0,0,1,-1,-3,3,-3,2,0,1,0,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,-1,0,0,1,0,-1,0,0,0,0,0,0,-1,0,-1,0,0,0,1,0,0,-1,0,0,0,0,1,-1,0,-1,1,0,0,0,0,1,-1,0,0,0,0,1,buffer,-1,0,0,0,0,1,buffer,-0.2,0,0,-0.4,0,0.2,-0.2,0,0.2,buffer,-0.333333333,0.333333333,-0.066666667,-0.066666667,0,buffer,1,0,1,0,0,0,0,0.2,0,0.2,0.4,0.2,0.2,0.2,0,0.6,0.4,0,0.2,0.2,0.2,0.4,0.2,0,buffer,HS_TS +160,R_6fxexjmSERfuEHs,46 - 52,Canadian,Female,Female,College Diploma/Certificate,46,02PsVPf,01PAST,5,01ITEM,0.5,0,1,0,3,3,3,2,-1,1,1,0,1,2,1,1,1,0,-1,3,3,3,2,0,0,1,0,1,3,0,1,1,0,1,3,3,3,2,1,1,1,0,1,2,0,1,1,-1,1,3,3,3,2,0,0,1,0,0,3,0,1,1,0,1,3,3,3,2,1,0,1,0,1,3,0,1,1,0,1,3,0,1,3,3,1,2,1,2,2,1,1,0,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,2,0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,0,0,2,1,0,0,0,1,1,0,0,0,2,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,1,2,0,0,0,0,0,1,0,0,-1,1,0,0,0,1,buffer,0,1,-1,-1,1,2,buffer,0,-0.2,0,0,-0.2,0,0.4,0,0.4,buffer,0,0.666666667,-0.066666667,-0.066666667,0.266666667,buffer,0,0,3,1,0,0,0.2,0.4,0.4,0.2,0.4,0.4,0.2,0.6,0.4,0.2,0.6,0.4,0.4,0.4,0.4,0,0.4,0,buffer,C_Ug +161,R_5J2RqQH7n9Fx52B,39 - 45,Canadian,Female,Female,High School (or equivalent),44,02PsVPf,02FUT,10,01ITEM,0.125,1,0,3,3,2,-1,2,1,NA,1,0,3,0,0,3,0,3,3,3,2,-1,2,2,0,2,0,3,0,0,3,0,3,2,3,2,-2,2,2,1,2,1,3,-1,0,3,1,3,3,3,2,0,2,1,-2,3,-2,3,0,0,3,0,3,3,3,2,0,2,1,-2,3,-2,3,0,0,3,0,3,1,1,1,2,2,2,1,1,1,1,1,1,0,0,0,0,0,1,NA,1,0,0,0,0,0,0,0,1,0,0,1,0,1,NA,1,1,0,1,0,0,1,0,0,0,0,1,0,0,NA,2,2,0,0,0,0,0,0,0,0,0,1,0,0,NA,2,2,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,1,NA,-1,-2,0,0,0,0,0,0,1,0,0,0,0,1,NA,-1,-1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,buffer,0,0,0,1,1,1,buffer,-0.2,-0.5,0,0.2,-0.25,0.4,0.4,0.4,0.4,buffer,0,1,-0.233333333,0.116666667,0.4,buffer,1,1,1,0,0,0,0,0.5,0,0.4,0.75,0.4,0.2,1,0,0.2,1,0,0.4,0.4,0.4,0,0,0,buffer,HS_TS +162,R_5fE8gqnU9RHKd7a,39 - 45,Canadian,Female,Female,University - PhD,41,02PsVPf,02FUT,10,01ITEM,-0.125,1,0,1,3,2,3,2,-1,-3,2,-3,-2,3,1,2,-2,3,1,3,2,3,2,-2,-2,2,-2,-1,3,1,2,-2,3,1,3,2,3,2,-1,-3,2,-2,-1,3,1,0,-2,3,1,3,2,3,3,-1,-2,2,-2,-1,3,1,2,-3,3,1,3,2,3,3,-1,-3,3,-3,-1,3,1,2,-3,3,1,2,1,1,1,2,1,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,buffer,0,0,0,0,-1,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,-1,1,0,0,0,2,-1,0,0,0,0,0,0,1,0,-1,-1,0,0,0,2,0,0,buffer,0,1,0,0,0,1,buffer,-0.2,0.2,-0.2,-0.2,0,0.2,0,-0.2,0.4,buffer,0.333333333,0.333333333,-0.066666667,0,0.066666667,buffer,0,1,1,0,0,0,0,0.8,0,0,0.4,0.4,0.2,0.6,0.2,0.2,0.4,0.2,0,0.4,0.4,0,0.6,0,buffer,grad_prof +163,R_17PA2lzu5PTR6Xx,46 - 52,Canadian,Female,Female,High School (or equivalent),52,02PsVPf,01PAST,5,01ITEM,0.5,0.666666667,0.333333333,3,0,0,-2,0,-2,-1,2,0,1,2,-1,3,-2,3,3,0,0,-2,0,-3,-2,3,-2,0,2,-1,3,-3,3,3,0,1,-2,0,-2,-2,3,-2,3,2,-2,3,-3,3,3,0,0,0,0,-3,-2,3,-2,3,2,0,3,-3,3,3,0,0,1,0,-3,-2,3,-2,2,2,-1,3,-3,3,1,1,1,2,1,1,3,1,1,2,2,1,0,0,0,0,0,1,1,1,2,1,0,0,0,1,0,0,0,1,0,0,0,1,1,2,2,0,1,0,1,0,0,0,0,2,0,1,1,1,2,2,0,1,0,1,0,0,0,0,3,0,1,1,1,2,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,3,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,buffer,0,0,0,-2,0,0,0,0,0,-1,0,-1,0,0,0,0,0,1,-3,0,-1,0,0,0,1,0,1,0,0,0,0,0,1,-1,0,1,0,0,0,2,0,0,0,0,0,buffer,-2,0,0,0,-1,0,buffer,-0.4,-0.2,-0.2,-0.4,0,0.2,0,0.6,0,buffer,-0.666666667,-0.333333333,-0.266666667,-0.066666667,0.2,buffer,1,0,0,1,1,0,0,1.2,0.2,0.2,1.2,0.4,0.4,1.4,0.4,0.6,1.2,0.2,0.2,0.8,0.2,0.2,0.2,0.2,buffer,HS_TS +164,R_6BCIVFV4NJK5M1X,67 - 73,American,Female,Female,University - PhD,71,01PfPsV,02FUT,5,02DGEN,-0.5,0,0.666666667,2,2,2,0,3,1,-2,2,-2,2,3,1,3,1,3,3,2,2,1,3,2,-3,2,-3,2,3,1,3,1,3,2,2,2,0,3,1,-3,2,-3,2,3,1,3,2,3,2,2,2,1,3,1,-3,2,-2,2,3,1,3,1,3,1,2,2,3,2,1,-3,0,-2,1,3,1,3,1,3,0,0,1,2,1,1,3,1,2,5,2,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,3,1,0,1,2,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,2,1,0,0,2,0,1,0,0,0,0,0,buffer,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,-1,0,0,-3,-1,0,0,-2,1,-1,0,0,0,1,0,0,0,0,-1,-1,1,0,-2,0,-1,0,0,0,1,0,buffer,-3,-1,-1,-3,-1,0,buffer,0.2,0.4,0,-1,-0.4,0.2,-0.4,-0.4,0.2,buffer,-1.666666667,-1.333333333,0.2,-0.4,-0.2,buffer,2,1,0,2,1,1,0.4,0.6,0,0,0.4,0.2,0.2,0.2,0,1,0.8,0,0.4,0.2,0.2,0.8,0.6,0,buffer,grad_prof +165,R_5Jmin0uMTvm4LhV,60 - 66,American,Male,Male,Trade School (non-military),66,03VPfPs,01PAST,10,01ITEM,0.375,0.333333333,0.666666667,3,3,2,3,2,-2,-3,2,-1,0,3,3,3,0,3,2,2,2,2,0,-2,-2,2,-2,-2,3,3,3,-2,3,3,2,3,2,2,-2,-2,2,-2,-2,3,3,3,1,3,2,2,2,2,-1,-3,-3,3,-3,-3,3,3,3,-3,3,2,2,2,3,-1,-3,-3,3,-3,-3,3,3,3,-2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,2,0,1,0,1,2,0,0,0,2,0,0,1,1,1,0,0,1,0,1,2,0,0,0,1,0,1,1,0,1,3,1,0,1,2,3,0,0,0,3,0,1,1,0,0,3,1,0,1,2,3,0,0,0,2,0,1,0,1,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,-1,-1,1,-1,-1,-1,0,0,0,-1,0,-1,0,1,1,-3,-1,1,-1,-1,-1,0,0,0,-1,0,1,0,1,-1,2,0,0,0,0,0,0,0,0,2,0,buffer,0,0,0,0,0,0,buffer,-0.2,-0.6,-0.2,-0.4,-0.6,-0.2,0.6,0,0.4,buffer,0,0,-0.333333333,-0.4,0.333333333,buffer,0,0,0,0,0,0,1,0.8,0.4,0.6,0.8,0.2,1.2,1.4,0.6,1,1.4,0.4,0.8,0,0.6,0.2,0,0.2,buffer,HS_TS +166,R_10ZpB2n0wIHaxg0,67 - 73,American,Female,Female,University - PhD,68,02PsVPf,02FUT,5,02DGEN,0,0,1,3,3,3,3,3,3,1,3,1,3,3,-2,3,-2,3,3,3,3,3,3,3,3,3,1,3,3,0,3,0,3,3,3,3,3,3,3,0,3,0,3,3,0,3,-2,3,3,3,3,3,3,3,0,3,0,3,3,0,3,-2,3,3,3,2,3,3,3,0,1,0,2,3,0,3,0,3,1,1,1,1,1,1,5,1,1,5,7,1,0,0,0,0,0,0,2,0,0,0,0,2,0,2,0,0,0,0,0,0,0,1,0,1,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,0,0,0,0,1,0,0,0,1,2,1,1,0,2,0,2,0,0,0,0,0,0,0,3,0,1,0,0,0,0,2,0,0,0,1,0,0,0,0,2,0,1,0,0,0,2,0,buffer,0,0,0,0,0,0,1,0,-1,0,0,0,0,2,0,0,0,-1,0,0,0,0,-2,0,-1,0,0,0,-2,0,0,0,-1,0,0,0,3,-2,1,-1,0,0,0,0,0,buffer,-4,0,0,-4,-6,0,buffer,0,0,0.4,-0.2,-0.6,-0.4,-0.2,0.2,0,buffer,-1.333333333,-3.333333333,0.133333333,-0.4,0,buffer,0,0,0,0,6,0,0,0.4,0.8,0,0.4,0.4,0,0.4,0.4,0.2,1,0.8,0,0.8,0.4,0.2,0.6,0.4,buffer,grad_prof +167,R_6jja8oeAQsmBzhL,60 - 66,American,Female,Female,College Diploma/Certificate,64,02PsVPf,01PAST,10,02DGEN,-0.25,0,0.666666667,3,2,2,0,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,-1,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,-1,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,0,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,0,2,1,-3,2,-3,0,2,3,2,-1,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,buffer,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,0,0,0.2,-0.2,0,0,-0.2,0,buffer,0,0,0.066666667,0,-0.066666667,buffer,0,0,0,0,0,0,0.2,0,0,0.2,0,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,buffer,C_Ug +168,R_78KWiw9duh3YG77,60 - 66,American,Female,Female,High School (or equivalent),61,03VPfPs,01PAST,10,01ITEM,0,0,1,3,3,3,-3,3,2,-3,2,-1,2,3,3,3,3,3,3,3,3,-3,3,3,-3,3,-2,3,3,3,3,3,3,3,3,3,-3,3,3,-3,3,3,3,3,3,3,-3,3,3,3,3,-2,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,2,3,3,-3,3,-3,3,3,3,3,3,3,1,2,2,1,2,2,1,1,1,0,1,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,4,1,0,0,0,6,0,0,0,0,1,0,1,0,1,2,1,0,0,0,0,0,0,0,0,5,0,1,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,6,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-5,0,0,0,0,2,0,0,0,0,6,0,0,0,0,-4,0,0,0,0,5,0,0,0,0,6,0,buffer,0,1,1,1,1,2,buffer,-0.2,-0.2,0,-1,0.4,1.2,-0.8,1,1.2,buffer,0.666666667,1.333333333,-0.133333333,0.2,0.466666667,buffer,0,0,0,1,0,1,0,0.8,0,0,1.4,1.2,0.2,1,0,1,1,0,0,1,1.2,0.8,0,0,buffer,HS_TS +169,R_1Ca2W3p8z3iavf6,53 - 59,Canadian,Male,Male,University - Undergraduate,54,03VPfPs,01PAST,10,02DGEN,0.625,0,1,2,2,2,2,2,1,-1,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,1,-1,-1,-1,-2,1,-1,3,1,3,1,3,3,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,1,2,2,2,2,2,5,5,5,6,7,7,7,6,7,3,6,3,0,0,0,0,0,1,3,0,0,0,1,1,1,1,1,3,1,3,3,3,3,2,3,1,1,2,0,2,2,1,0,0,0,0,0,1,3,0,0,0,1,1,1,1,1,0,0,0,0,0,0,3,0,0,1,1,1,1,1,1,3,1,3,3,3,4,1,3,1,1,1,1,1,1,2,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,3,3,3,3,-1,3,1,0,1,-1,1,1,0,3,1,3,3,3,3,1,3,1,0,1,1,1,1,2,buffer,-2,-1,-2,3,1,4,buffer,0,0,0,2.6,1.2,0.4,2.6,1.6,1.2,buffer,-1.666666667,2.666666667,0,1.4,1.8,buffer,1,2,2,4,0,4,0,0.8,1,2.6,2,1.4,0,0.8,1,0,0.8,1,2.6,2,1.2,0,0.4,0,buffer,C_Ug +170,R_7k0t0ZojGpZeKBR,32 - 38,Canadian,Female,Female,University - Undergraduate,36,01PfPsV,01PAST,10,02DGEN,-0.5,0,1,3,3,3,3,3,0,-1,3,0,3,2,2,1,1,3,3,3,3,2,2,2,0,2,0,2,2,2,3,2,3,3,3,3,3,3,1,0,1,0,3,3,2,1,2,3,3,3,3,3,3,1,-1,2,-1,2,3,2,3,1,3,3,3,3,3,3,1,0,3,0,2,3,2,1,3,2,1,1,1,2,4,1,1,0,1,1,1,0,0,0,0,1,1,2,1,1,0,1,0,0,2,1,0,0,0,0,0,0,1,1,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,1,1,1,0,2,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,2,1,0,0,0,1,1,1,0,1,0,1,1,0,2,0,0,0,0,0,0,0,0,1,1,1,0,0,0,2,2,1,buffer,0,0,0,1,1,1,1,0,-1,0,-1,0,0,1,0,0,0,0,0,0,0,0,2,0,-1,0,0,0,-1,-1,0,0,0,1,1,1,-1,0,-1,1,1,0,0,-2,-1,buffer,0,1,0,1,3,1,buffer,0.4,0.2,0,0,0.2,-0.4,0.4,0,-0.4,buffer,0.333333333,1.666666667,0.2,-0.066666667,0,buffer,1,3,0,0,1,1,0.4,1,0.6,0,0.8,0.4,0,0.8,0.6,0,0.6,0.8,0.4,0.6,0.6,0,0.6,1,buffer,C_Ug +171,R_5qDD8OVKXEU7FPS,67 - 73,American,Female,Female,High School (or equivalent),69,03VPfPs,02FUT,10,01ITEM,0.375,0,1,3,1,2,-3,1,1,-3,3,-2,3,3,2,3,-3,3,3,1,3,-3,1,0,-3,3,-3,3,3,3,3,-3,3,3,1,3,-3,1,-1,-3,3,-3,2,3,3,3,-2,3,3,2,3,-2,2,1,-3,3,-3,3,3,3,3,-2,3,3,3,2,-2,1,1,-3,3,-3,2,3,3,3,-3,3,10,10,10,10,10,10,10,10,10,10,10,10,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,2,0,0,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,1,0,1,0,0,2,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,buffer,0,-1,0,-1,-1,1,0,0,0,0,0,0,0,-1,0,0,-2,1,-1,0,2,0,0,0,0,0,0,0,1,0,0,-1,-1,0,-1,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.6,0.2,-0.2,-0.4,0.4,0.2,-0.6,0.2,0,buffer,0,0,-0.2,0.066666667,-0.133333333,buffer,0,0,0,0,0,0,0.2,0.4,0.2,0.2,0.8,0.4,0.8,0.2,0.4,0.6,0.4,0.2,0,0.4,0.2,0.6,0.2,0.2,buffer,HS_TS +172,R_6HLVo651b2Ns27V,46 - 52,Canadian,Female,Female,University - Graduate (Masters),48,02PsVPf,02FUT,5,01ITEM,-0.5,0.666666667,0.333333333,3,2,2,2,2,-3,-2,2,-1,2,2,-3,3,-2,3,2,2,2,2,2,-3,-2,2,-3,1,2,-3,3,-3,2,2,2,2,2,2,-3,-2,2,-2,2,3,-3,3,-3,3,3,2,2,3,2,-3,-1,2,-2,1,2,-3,3,-3,3,2,2,2,2,2,-3,0,2,-1,0,2,-3,3,-3,3,1,1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,2,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,0,0,2,0,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,buffer,1,0,0,-1,0,0,-1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,-2,0,1,-2,1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,0,1,buffer,0,0,1,0,0,0,buffer,0,0,0.2,0,-0.6,0.2,-0.4,-0.2,0.4,buffer,0.333333333,0,0.066666667,-0.133333333,-0.066666667,buffer,0,0,0,0,0,1,0.2,0.6,0.4,0.2,0.2,0.4,0.2,0.6,0.2,0.2,0.8,0.2,0,0.4,0.4,0.4,0.6,0,buffer,grad_prof +173,R_3prMmEhVagQa825,67 - 73,American,Female,Female,Trade School (non-military),70,03VPfPs,02FUT,10,02DGEN,0.375,0,1,3,2,3,2,2,2,-2,2,-2,2,2,0,2,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,-1,2,-1,3,3,3,3,3,3,3,3,3,-3,3,3,3,3,0,3,2,2,2,2,2,3,-3,3,3,3,3,0,3,0,3,3,3,3,2,2,3,-3,3,-3,3,3,-1,2,-2,3,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,1,1,1,5,1,1,1,1,3,1,2,0,1,0,1,0,0,1,1,1,5,1,1,0,1,2,0,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,6,0,0,0,0,4,1,1,0,1,1,1,0,0,0,0,0,6,0,0,1,1,2,0,buffer,-1,1,-1,1,1,0,0,0,-4,0,0,1,-1,-1,0,0,0,0,1,1,0,4,0,0,0,0,2,1,2,0,-1,-1,-1,0,0,0,6,0,-6,0,0,3,0,-1,0,buffer,1,0,1,0,1,-1,buffer,0.2,-0.8,-0.2,0.4,0.8,1,-0.6,0,0.4,buffer,0.666666667,0,-0.266666667,0.733333333,-0.066666667,buffer,1,1,1,0,0,1,0.6,1,0.6,0.6,1.8,1.4,0.4,1.8,0.8,0.2,1,0.4,0,1.2,1.2,0.6,1.2,0.8,buffer,HS_TS +174,R_3HkwQiFWpFnTJYE,46 - 52,Canadian,Female,Female,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0.625,0,1,2,2,2,1,3,-2,0,2,-1,2,1,1,2,1,1,2,2,2,-1,2,-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,-1,2,1,1,1,1,1,2,2,2,2,2,-2,-1,2,0,0,2,1,1,1,1,2,1,1,2,1,-2,1,1,1,1,2,1,1,1,1,6,4,6,7,6,6,7,5,6,6,6,4,0,0,0,2,1,0,1,1,2,1,0,0,1,0,0,1,1,1,0,2,4,2,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,2,1,0,1,0,0,0,1,1,1,2,0,1,1,2,1,1,0,1,0,0,1,1,1,2,1,4,1,1,2,1,0,0,0,0,0,0,1,1,0,1,0,2,1,1,1,0,0,0,0,0,buffer,0,0,0,1,0,0,0,1,1,-1,-1,0,0,0,0,1,0,0,-1,0,4,1,-1,-2,-1,-1,0,0,0,0,1,0,0,2,0,4,-1,0,1,0,0,0,0,0,0,buffer,-1,-1,0,1,0,2,buffer,0.2,0.2,-0.2,0,0.2,-0.2,0.6,0.8,0,buffer,-0.666666667,1,0.066666667,0,0.466666667,buffer,1,2,0,1,1,2,0.6,1,0.2,1,1.2,0.2,0.4,0.8,0.4,1,1,0.4,1.2,1.8,0,0.6,1,0,buffer,C_Ug +175,R_7r0cHKY4oCTAEJK,60 - 66,American,Female,Female,University - Graduate (Masters),60,02PsVPf,02FUT,5,01ITEM,0,1,0,2,3,3,1,-1,-3,-1,1,3,-2,2,-1,2,1,3,1,2,3,2,-2,-3,1,-1,3,-3,2,0,1,2,3,2,2,3,-2,1,-2,1,2,3,1,2,1,2,2,3,2,3,3,2,1,-3,-2,2,2,-1,2,-1,2,-1,3,2,2,3,3,-2,-3,-1,2,1,-1,2,-1,1,-3,3,1,4,1,2,3,2,3,1,1,5,4,4,1,1,0,1,1,0,2,2,0,1,0,1,1,1,0,0,1,0,3,2,1,2,1,0,3,0,2,0,1,0,0,0,0,1,2,0,1,1,1,1,0,0,0,2,0,0,1,0,2,1,0,0,1,2,1,0,0,1,4,0,1,0,0,4,3,1,0,3,0,4,0,1,1,0,0,0,1,0,1,3,0,1,0,1,0,0,0,1,2,0,buffer,1,1,0,0,-1,0,1,1,-1,0,0,1,1,-1,0,0,0,0,1,1,1,2,0,-2,2,0,2,-1,-3,0,1,-1,0,3,0,1,-1,3,-1,4,0,1,0,-2,0,buffer,-2,3,0,-3,-1,-2,buffer,0.2,0.2,0.2,0.4,0.6,-0.4,0.6,1.2,-0.2,buffer,0.333333333,-2,0.2,0.2,0.533333333,buffer,1,1,1,2,3,3,0.8,1,0.6,1.2,1.4,0.6,0.6,0.8,0.4,0.8,0.8,1,1.6,1.6,0.4,1,0.4,0.6,buffer,grad_prof +176,R_7BhsRfqwHLhuYAV,67 - 73,American,Male,Male,College Diploma/Certificate,71,01PfPsV,01PAST,10,02DGEN,0.5,0,1,3,3,1,1,3,-3,-1,3,0,3,3,3,2,3,3,2,3,3,0,3,-1,0,3,1,1,3,2,3,3,3,2,3,3,1,3,0,0,3,2,3,3,3,3,3,2,2,3,1,2,1,0,-1,2,0,2,3,2,3,2,3,2,2,1,3,2,0,-1,1,0,1,3,2,3,3,3,10,10,10,10,10,10,10,10,10,10,10,10,1,0,2,1,0,2,1,0,1,2,0,1,1,0,0,1,0,2,0,0,3,1,0,2,0,0,0,1,0,1,1,0,0,1,2,3,0,1,0,1,0,1,1,1,0,1,1,0,2,1,3,0,2,0,2,0,1,1,0,0,0,0,0,1,0,1,0,0,1,2,0,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,buffer,0,0,2,0,-2,-1,1,-1,1,1,0,0,0,-1,0,0,-1,2,-2,-1,0,1,-2,2,-2,0,-1,0,0,1,0,-1,0,0,-1,1,0,-1,1,1,0,1,0,-1,1,buffer,0,0,0,0,0,0,buffer,0,0.2,-0.2,-0.4,-0.2,0,-0.4,0.4,0.2,buffer,0,0,0,-0.2,0.066666667,buffer,0,0,0,0,0,0,0.8,1.2,0.4,0.6,1.2,0.4,0.8,1,0.6,1,1.4,0.4,0.2,0.8,0.4,0.6,0.4,0.2,buffer,C_Ug +177,R_1LiG5eQcc7wj9BK,53 - 59,Canadian,Male,Male,College Diploma/Certificate,59,01PfPsV,02FUT,5,02DGEN,0.625,0,1,-2,3,-1,1,3,-2,2,3,-1,1,0,1,0,1,2,3,2,1,1,3,2,1,1,2,0,0,2,1,0,1,-1,1,1,2,0,2,1,2,0,2,0,1,2,1,2,-1,2,-2,2,3,2,1,0,2,1,0,2,2,1,2,-3,2,-2,2,3,2,1,1,-1,2,0,2,1,2,1,2,3,1,2,2,2,8,8,7,6,1,2,5,1,2,0,0,4,1,2,3,1,0,1,1,1,1,1,2,2,1,3,4,1,1,1,1,0,0,2,0,0,1,1,1,1,0,4,1,3,3,0,0,1,2,0,0,1,1,1,1,0,4,1,2,0,1,0,1,1,1,1,4,1,0,1,3,0,0,1,2,2,0,1,1,1,1,2,0,0,0,0,0,0,1,3,1,0,0,1,1,1,buffer,4,0,1,-1,0,0,0,-1,0,1,0,0,-1,1,1,0,1,1,0,3,0,0,-1,1,0,0,-1,1,-1,-1,2,1,0,1,3,0,0,0,-1,1,0,1,0,0,0,buffer,-6,-5,-6,-4,1,0,buffer,0.8,0,0.2,1,0,-0.4,1.4,0,0.2,buffer,-5.666666667,-1,0.333333333,0.2,0.533333333,buffer,0,1,1,2,7,5,1.6,2.2,0.8,1.8,1.6,0.4,0.8,2.2,0.6,0.8,1.6,0.8,1.8,1,0.8,0.4,1,0.6,buffer,C_Ug +178,R_78s3uH2EFnwOwhz,67 - 73,American,Female,Female,University - PhD,70,03VPfPs,01PAST,10,02DGEN,0.25,0,1,3,-2,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,1,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0.2,0,0,0.2,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.2,0,0,0.2,0.2,0,0.2,0,0,0.2,0,0,0,0.2,0,0,0,0,buffer,grad_prof +179,R_6BKJ0IIae4mCVah,46 - 52,Canadian,Male,Male,University - Undergraduate,47,03VPfPs,01PAST,10,02DGEN,0.375,1,0,2,1,-1,-2,0,-1,-2,2,-1,1,1,0,2,-2,1,2,2,-2,-2,-1,-1,-2,2,-1,1,1,0,1,-2,1,2,2,1,-1,0,-1,-2,2,-1,1,0,0,1,-2,1,2,2,-2,-2,0,-1,-2,2,-2,1,1,0,2,-2,1,2,1,-2,-2,0,-1,-2,2,-1,1,1,0,2,-2,1,1,1,1,2,2,2,2,1,2,1,1,2,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,2,1,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,1,0,0,0,-1,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,-1,3,1,1,0,0,0,-1,0,1,0,0,0,0,buffer,-1,0,-1,1,1,0,buffer,0.2,-0.2,0.2,0.6,0,0.4,0.8,-0.2,0.2,buffer,-0.666666667,0.666666667,0.066666667,0.333333333,0.266666667,buffer,1,1,1,1,0,0,0.6,0,0.2,0.8,0,0.4,0.4,0.2,0,0.2,0,0,1,0,0.2,0.2,0.2,0,buffer,C_Ug +180,R_1PdLTy6wnfNmKpJ,67 - 73,American,Male,Male,College Diploma/Certificate,68,03VPfPs,02FUT,10,02DGEN,0,0,1,2,3,3,-3,2,-2,-3,3,-3,1,2,1,2,-3,3,3,3,3,-3,1,-3,-3,2,-3,2,1,2,2,-3,3,3,3,3,-3,1,-3,-3,2,-3,1,2,1,2,-3,1,3,3,3,-2,3,-2,-3,2,-3,1,1,1,2,-3,3,3,3,3,-1,3,-2,-3,3,-3,1,1,0,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,2,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,2,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,buffer,0,0,0,-1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,-2,0,1,0,1,0,0,-1,-1,-1,0,2,0,0,0,-1,0,0,0,-1,0,1,1,0,-1,0,2,buffer,0,0,0,0,0,0,buffer,-0.2,0.4,0.2,-0.4,0.4,-0.2,-0.2,0,0.4,buffer,0,0,0.133333333,-0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.4,0.6,0.4,0.4,0.4,0.4,0.6,0.2,0.2,0.8,0,0.6,0,0.2,0.8,0.2,0.2,0.4,buffer,C_Ug +181,R_6US8xvHn7QMnayB,60 - 66,American,Female,Female,College Diploma/Certificate,66,02PsVPf,01PAST,5,02DGEN,-0.5,0,1,3,3,3,2,1,-3,1,3,3,1,3,1,3,-3,3,3,3,3,1,-1,-3,2,2,2,2,3,1,2,-3,2,3,3,3,1,-1,-3,2,3,3,1,3,2,3,-3,3,3,3,3,2,1,-3,-2,3,-2,1,3,1,3,-3,3,3,3,3,3,1,-3,-3,3,-3,1,3,-2,3,-3,3,1,9,5,1,2,2,1,2,2,2,3,2,0,0,0,1,2,0,1,1,1,1,0,0,1,0,1,0,0,0,1,2,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,3,0,5,0,0,0,0,0,0,0,0,0,1,0,0,4,0,6,0,0,3,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,3,0,0,0,buffer,0,0,0,1,2,0,-2,1,-4,1,0,0,1,0,1,0,0,0,0,2,0,-3,0,-6,0,0,-2,0,0,0,0,0,0,-1,0,0,-1,1,0,1,0,-2,1,0,1,buffer,0,7,3,-1,-1,0,buffer,0.6,-0.8,0.4,0.4,-1.8,-0.4,-0.2,0.2,0,buffer,3.333333333,-0.666666667,0.066666667,-0.6,0,buffer,0,7,3,1,1,0,0.6,0.8,0.4,0.6,0.2,0.2,0,1.6,0,0.2,2,0.6,0,0.6,0.6,0.2,0.4,0.6,buffer,C_Ug +182,R_5Pw5qC2rawzbL82,39 - 45,Canadian,Female,Female,University - Undergraduate,44,02PsVPf,01PAST,10,01ITEM,0.625,0.333333333,0.333333333,1,2,2,1,1,-2,-3,2,-2,1,3,-1,1,1,1,2,2,2,1,3,-3,-3,1,-2,1,2,2,2,3,1,1,1,2,-1,2,-2,-3,1,0,1,2,-2,3,2,1,1,1,2,1,0,-3,-3,0,-2,0,2,-3,0,0,0,0,2,2,2,0,-3,-3,3,-2,2,2,-2,2,2,1,6,7,8,7,6,8,4,4,4,4,6,5,1,0,0,0,2,1,0,1,0,0,1,3,1,2,0,0,1,0,2,1,0,0,1,2,0,1,1,2,1,0,0,1,0,0,1,1,0,2,0,1,1,2,1,1,1,1,0,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,0,2,1,1,0,0,2,0,0,4,1,1,0,1,1,0,1,0,0,0,3,0,2,0,1,2,2,1,buffer,1,-1,0,0,1,0,0,-1,0,-1,0,1,0,1,-1,-1,1,0,1,0,-1,0,0,2,-1,0,0,1,0,0,0,0,0,1,1,1,0,-3,2,-2,0,3,-1,-1,-1,buffer,2,3,4,3,0,3,buffer,0.2,-0.4,0.2,0.2,0,0.2,0.4,-0.4,0,buffer,3,2,0,0.133333333,0,buffer,1,1,0,0,2,1,0.6,0.4,1.4,0.8,0.6,1,0.4,0.8,1.2,0.6,0.6,0.8,1,0.6,1.2,0.6,1,1.2,buffer,C_Ug +183,R_5Id5KM8MgZBfe9q,46 - 52,Canadian,Male,Male,University - Undergraduate,49,01PfPsV,02FUT,5,01ITEM,0.25,1,0,2,-2,1,2,3,1,-3,-2,0,1,2,-3,0,3,1,-2,3,0,-3,-3,3,-1,3,2,0,0,1,3,3,-3,-3,0,2,0,-3,2,1,2,-2,-2,2,2,-1,2,-3,0,2,-1,0,2,-1,2,-1,0,3,-3,-3,2,-3,-1,2,0,3,3,3,1,0,2,-2,3,-2,1,-3,-3,-2,9,2,2,9,5,3,2,8,10,3,5,6,4,5,1,5,6,2,2,5,2,1,2,4,3,0,4,5,2,1,2,6,1,4,4,2,3,0,5,1,1,4,2,4,2,2,1,2,5,1,0,2,5,0,2,6,2,0,2,2,1,0,0,3,4,2,2,4,4,3,6,3,1,3,2,3,0,1,2,1,4,2,2,1,4,1,0,2,2,4,3,1,2,2,3,2,0,1,4,5,0,1,buffer,2,1,-1,3,5,0,-3,4,2,-1,-3,4,1,-6,2,5,0,-1,1,6,1,1,0,0,1,-4,1,-2,-5,1,-1,1,-2,0,-1,-1,0,-2,2,2,1,-3,-1,1,-1,buffer,7,-6,-8,6,0,-3,buffer,2,0.4,-0.4,2.2,0.6,-1.8,-0.6,0.2,-0.6,buffer,-2.333333333,1,0.666666667,0.333333333,-0.333333333,buffer,0,3,1,1,3,4,4.2,2.4,2.6,3.2,2.8,2.2,2.2,2,3,1,2.2,4,1.8,2,1.6,2.4,1.8,2.2,buffer,C_Ug +184,R_1PuIvcwlGXOr30L,67 - 73,American,Female,Female,College Diploma/Certificate,70,02PsVPf,02FUT,5,01ITEM,-0.125,0.666666667,0.333333333,2,2,2,0,2,0,-3,3,-3,3,2,2,2,1,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,2,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,2,1,0,0,1,0,1,0,0,0,1,0,1,1,1,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,3,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,1,0,0,0,0,buffer,0,0,0,-0.2,0,0,0.2,0,0,buffer,0.333333333,0,0,-0.066666667,0.066666667,buffer,0,0,0,0,1,0,1.4,0.4,0.2,1.2,0.4,0.2,1.4,0.4,0.2,1.4,0.4,0.2,0.2,0,0,0,0,0,buffer,C_Ug +185,R_5PhPwmbBbDD0cg1,67 - 73,American,Female,Female,High School (or equivalent),71,03VPfPs,01PAST,10,01ITEM,0.125,0,1,3,2,3,3,1,3,-3,3,-3,1,3,3,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,2,3,2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,-0.2,0,0,-0.2,0,buffer,0,0,0,-0.066666667,-0.066666667,buffer,0,0,0,0,0,0,0.4,0,0.2,0.4,0,0.2,0.4,0,0.2,0.4,0.2,0.2,0,0,0,0,0.2,0,buffer,HS_TS +186,R_7E8J8aXWSvyuMcp,46 - 52,Canadian,Male,Male,College Diploma/Certificate,50,03VPfPs,01PAST,5,02DGEN,0.25,0,0.666666667,2,3,3,3,1,-1,1,3,-2,-1,2,3,2,1,2,2,3,3,3,2,-1,1,3,1,-1,3,3,2,2,2,2,3,3,3,2,-1,1,3,1,1,2,3,2,2,2,2,3,3,3,1,-1,1,3,1,1,3,3,3,2,2,2,3,3,3,1,-1,1,3,1,1,3,3,3,2,2,1,2,2,2,2,2,2,1,2,2,2,2,0,0,0,0,1,0,0,0,3,0,1,0,0,1,0,0,0,0,0,1,0,0,0,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,3,2,1,0,1,1,0,0,0,0,0,0,0,0,0,3,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,0,0,0,-2,0,0,-1,0,0,0,0,0,0,1,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,buffer,-1,1,0,0,0,0,buffer,0.2,-0.4,-0.2,0.2,0,-0.4,0,0.4,0.2,buffer,0,0,-0.133333333,-0.066666667,0.2,buffer,1,0,0,0,1,0,0.2,0.6,0.4,0.2,1,0.2,0,1,0.6,0,1,0.6,0,0.4,0.2,0,0,0,buffer,C_Ug +187,R_3B2U7tAAjoETGYF,53 - 59,Canadian,Male,Male,University - Undergraduate,55,01PfPsV,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,2,2,1,2,-1,1,2,-3,1,1,0,3,0,3,2,2,2,0,2,-2,1,2,-2,2,1,0,2,0,3,2,2,2,0,3,-2,1,2,-3,2,1,0,2,0,3,2,2,2,1,2,-2,0,1,-2,1,1,0,2,0,3,2,2,2,1,1,-1,1,1,-2,1,1,0,3,0,3,3,3,3,3,3,3,3,3,3,5,4,3,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,buffer,0,0,0,1,0,0,-1,-1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,-1,-1,1,0,0,1,0,0,0,0,0,0,0,-1,-1,0,1,0,0,0,-1,0,0,buffer,0,0,0,-2,-1,0,buffer,0.2,-0.2,0,0.2,0,0.2,0,-0.2,-0.2,buffer,0,-1,0,0.133333333,-0.133333333,buffer,0,0,0,2,1,0,0.2,0.6,0.2,0.4,0.4,0.2,0,0.8,0.2,0.2,0.4,0,0.2,0.2,0,0.2,0.4,0.2,buffer,C_Ug +188,R_7yKZHZ7lGhrwOOt,67 - 73,American,Female,Female,University - Graduate (Masters),69,01PfPsV,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,2,2,2,-1,3,3,-3,2,-3,3,2,2,2,3,2,2,3,2,-1,3,3,-3,2,-3,3,3,1,2,2,2,3,3,2,-3,3,3,-3,2,-3,2,1,3,3,1,3,2,2,2,3,3,3,-3,3,-3,3,3,3,2,1,3,3,2,2,2,3,2,-3,3,-3,3,3,2,2,0,3,3,3,3,2,2,2,3,3,3,4,4,4,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,0,2,0,0,0,0,0,1,1,1,1,2,1,0,0,0,4,0,0,0,1,0,0,1,1,0,2,1,1,0,0,3,0,1,0,1,0,0,1,0,0,3,1,1,0,0,2,0,0,0,0,0,1,2,2,1,1,1,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,buffer,0,1,0,-4,0,0,0,-1,0,0,0,0,0,-1,-1,0,1,0,-1,0,-1,0,-1,0,1,0,1,1,-1,0,0,0,0,1,0,-1,0,0,0,1,2,1,1,0,1,buffer,0,0,0,-2,-2,-2,buffer,-0.6,-0.2,-0.4,0,-0.2,0.2,0.2,0,1,buffer,0,-2,-0.4,0,0.4,buffer,1,1,1,1,1,1,0.2,0,0.6,0.8,0.2,1.2,0.8,0.2,1,0.8,0.4,1,0.6,0.2,1.4,0.4,0.2,0.4,buffer,grad_prof +189,R_7qqRHW9GNmsUdS0,46 - 52,Canadian,Female,Female,University - Undergraduate,52,02PsVPf,01PAST,10,02DGEN,-0.25,0,1,3,3,3,1,3,-2,-2,3,0,1,2,0,3,2,1,3,3,3,1,3,-2,-2,3,0,2,2,0,3,3,2,3,3,3,1,3,-3,-2,3,1,3,2,0,3,3,2,3,3,3,1,3,-2,-2,3,-2,2,2,0,3,2,2,3,3,3,1,3,-2,-2,3,0,2,2,0,3,2,2,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,1,2,0,0,0,1,1,0,0,0,0,0,0,0,0,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,-2,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,-1,1,0,0,0,0,0,buffer,0,1,0,0,0,0,buffer,0,-0.4,0.2,0,0.6,0.2,0,0.2,0,buffer,0.333333333,0,-0.066666667,0.266666667,0.066666667,buffer,0,0,0,0,1,0,0,0.2,0.4,0,0.8,0.4,0,0.6,0.2,0,0.2,0.2,0,0.6,0,0,0.4,0,buffer,C_Ug +190,R_7hmBFCmcORt4UfG,53 - 59,Canadian,Male,Male,College Diploma/Certificate,58,02PsVPf,02FUT,10,01ITEM,0,0,1,2,2,2,1,2,-2,-2,2,0,0,1,0,1,-2,3,2,3,3,-1,3,0,-2,2,-1,1,1,0,0,-1,2,1,2,3,-1,2,-2,-1,2,1,0,-1,1,1,1,2,3,3,0,0,3,0,-3,2,0,1,3,0,0,-3,3,3,3,-3,0,3,0,-3,3,-3,3,3,0,0,-3,3,5,8,7,6,8,9,6,5,6,10,10,10,0,1,1,2,1,2,0,0,1,1,0,0,1,1,1,1,0,1,2,0,0,1,0,1,0,2,1,0,3,1,1,1,2,1,1,2,1,0,0,1,2,0,1,1,0,1,1,5,1,1,2,1,1,3,3,2,0,1,1,0,1,1,0,0,1,2,1,0,2,1,2,1,1,2,0,0,0,3,0,0,0,0,1,3,2,0,0,0,0,0,buffer,-1,0,-1,1,0,0,-1,0,1,0,-2,0,0,0,1,0,-1,-4,1,-1,-2,0,-1,-2,-3,0,1,-1,2,1,1,1,-3,0,1,2,1,-1,-1,-1,2,1,1,2,0,buffer,-1,3,1,-4,-2,-1,buffer,-0.2,0,-0.2,-1,-1.6,0.6,0,0,1.2,buffer,1,-2.333333333,-0.133333333,-0.666666667,0.4,buffer,1,0,2,4,5,4,1,0.8,0.6,0.8,0.4,1.4,1.2,0.8,0.8,1.8,2,0.8,0.6,1.2,1.2,0.6,1.2,0,buffer,C_Ug +191,R_11iSXUsPSc4zuZk,60 - 66,American,Male,Male,College Diploma/Certificate,62,01PfPsV,01PAST,5,01ITEM,-0.5,0,0.666666667,2,3,3,1,3,3,-3,3,-2,1,2,3,3,-3,2,3,3,3,3,3,3,-3,3,-3,2,3,2,2,-3,2,1,2,2,1,2,3,-3,2,-3,2,2,2,2,-3,2,2,2,2,2,3,2,-2,2,-2,2,2,2,2,-3,2,2,2,2,2,2,2,-3,2,-3,1,2,2,2,-3,2,1,2,1,3,2,3,2,3,2,1,1,2,1,0,0,2,0,0,0,0,1,1,1,1,1,0,0,1,1,1,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,0,1,1,1,1,1,0,1,1,0,0,1,1,0,0,2,1,1,2,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,buffer,1,-1,-1,1,0,-1,-1,-1,1,0,1,0,0,0,0,1,0,0,-1,0,-1,0,0,0,1,0,0,0,0,0,2,1,1,2,0,0,-1,1,-1,-1,1,0,0,0,0,buffer,-1,-1,-1,2,1,1,buffer,0,-0.4,0.2,0,0,0,1.2,-0.4,0.2,buffer,-1,1.333333333,-0.066666667,0,0.333333333,buffer,2,0,2,1,2,0,0.6,0.4,0.6,0.8,0.6,0.4,0.6,0.8,0.4,0.8,0.6,0.4,1.4,0.2,0.2,0.2,0.6,0,buffer,C_Ug +192,R_1dawVCdr211mxwY,25 - 31,Canadian,Female,Female,High School (or equivalent),31,02PsVPf,01PAST,5,01ITEM,0.125,0,0,1,1,-1,-1,-1,-1,0,0,0,1,-2,-3,2,-1,3,0,2,1,1,-1,1,2,1,3,1,3,-2,3,1,3,1,2,2,1,-1,-3,1,-2,3,1,2,-1,1,1,3,0,0,0,0,0,0,0,0,0,1,0,-3,2,0,3,0,0,0,0,0,0,0,0,0,1,0,-3,2,0,3,5,6,6,6,9,8,5,5,5,5,5,5,1,1,2,2,0,2,2,1,3,0,5,1,1,2,0,0,1,3,2,0,2,1,2,3,0,4,2,1,2,0,1,1,1,1,1,1,0,0,0,0,2,0,0,1,0,1,1,1,1,1,1,0,0,0,0,2,0,0,1,0,1,0,1,0,0,4,1,3,0,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,1,1,-1,1,2,1,3,0,3,1,1,1,0,-1,0,2,1,-1,1,1,2,3,0,2,2,1,1,0,1,0,1,0,0,4,1,3,0,0,1,1,2,0,0,buffer,0,1,1,1,4,3,buffer,0.2,1.4,1.2,0.2,1.4,1.2,0.4,1.6,0.8,buffer,0.666666667,2.666666667,0.933333333,0.933333333,0.933333333,buffer,1,3,2,0,0,0,1.2,1.6,1.8,1.2,1.6,1.8,1,0.2,0.6,1,0.2,0.6,0.4,1.6,0.8,0,0,0,buffer,HS_TS +193,R_1frrUBBeAJk9Qhn,46 - 52,Canadian,Female,Female,High School (or equivalent),47,03VPfPs,02FUT,5,01ITEM,0.5,0.333333333,0.333333333,-3,3,-1,-2,3,-2,-1,1,1,0,0,0,0,0,3,-2,3,-3,-3,3,3,3,3,3,3,2,2,3,3,3,-1,3,1,-3,3,3,3,3,3,3,2,2,3,3,3,-2,3,0,0,3,0,0,0,1,1,1,1,1,0,3,1,3,1,1,3,0,0,1,1,1,3,1,2,3,3,5,4,7,6,6,6,4,5,2,2,2,2,1,0,2,1,0,5,4,2,2,3,2,2,3,3,0,2,0,2,1,0,5,4,2,2,3,2,2,3,3,0,1,0,1,2,0,2,1,1,0,1,1,1,1,0,0,4,0,2,3,0,2,1,0,0,1,3,1,2,3,0,1,0,4,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,1,0,0,2,0,1,3,0,buffer,0,0,1,-1,0,3,3,1,2,2,1,1,2,3,0,-2,0,0,-2,0,3,3,2,2,2,-1,1,1,0,0,-2,0,3,-1,0,0,0,-1,0,0,-2,0,-1,-3,0,buffer,1,-1,5,4,4,4,buffer,0,2.2,1.4,-0.8,2.4,0.2,0,-0.2,-1.2,buffer,1.666666667,4,1.2,0.6,-0.466666667,buffer,1,2,1,2,3,0,0.8,3.2,2,1,3.2,2,0.8,1,0.6,1.8,0.8,1.8,1,0,0,1,0.2,1.2,buffer,HS_TS +194,R_7fCEITMfc7d3LHj,53 - 59,American,Male,Male,University - Undergraduate,59,03VPfPs,02FUT,5,01ITEM,-0.375,0,1,0,2,2,1,0,-1,-2,3,-2,1,3,-2,3,-3,3,1,2,2,1,0,-3,-3,3,-3,2,3,-2,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-2,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-3,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,1,0,1,1,0,0,0,0,0,2,0,0,1,0,2,1,0,1,1,0,0,0,0,0,2,0,0,1,0,2,1,0,1,1,0,1,0,0,0,2,0,0,1,0,2,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,buffer,-1,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0,-0.2,0,0,0,0.4,0,-0.2,buffer,0,0,-0.2,0,0.066666667,buffer,0,0,0,0,0,0,0.2,1,0,0.6,1,0,0.6,1,0.2,0.6,1,0,0.4,0,0,0,0,0.2,buffer,C_Ug +195,R_6FrmnaHETS1ccrk,46 - 52,Canadian,Female,Female,College Diploma/Certificate,50,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,2,1,1,1,2,-2,-1,2,0,-1,1,0,1,-1,0,-1,0,1,0,0,-2,0,1,0,1,1,1,1,1,1,0,0,2,1,0,-1,0,1,0,-1,2,1,1,1,0,1,1,2,1,1,-3,-2,2,1,-2,1,1,0,-1,0,1,1,2,2,0,-2,-2,1,0,-1,2,1,1,-1,1,3,4,3,4,4,4,1,3,1,3,1,3,3,1,0,1,2,0,1,1,0,2,0,1,0,2,1,2,1,1,0,2,1,1,1,0,0,1,1,0,2,0,1,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,0,1,1,2,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,2,1,0,0,0,1,0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,buffer,2,1,-1,1,1,-1,0,1,-1,1,0,0,-1,2,1,1,1,0,-1,0,1,0,0,0,0,0,0,0,2,-1,1,0,1,0,-1,0,0,-1,-1,1,0,0,-1,0,0,buffer,2,1,2,1,3,1,buffer,0.8,0,0.4,0.2,0.2,0.2,0.2,-0.2,-0.2,buffer,1.666666667,1.666666667,0.4,0.2,-0.066666667,buffer,1,0,1,2,2,2,1.4,0.8,0.8,1.2,0.6,0.8,0.6,0.8,0.4,1,0.4,0.6,0.6,0.6,0.4,0.4,0.8,0.6,buffer,C_Ug +196,R_1dzLe6ylnvHseSi,25 - 31,American,Female,Female,University - Graduate (Masters),29,02PsVPf,01PAST,10,02DGEN,0.5,1,0,3,3,3,3,3,0,-1,2,-2,3,1,-1,1,-2,2,3,3,3,3,3,0,-3,2,-3,2,1,2,2,-3,2,0,0,3,3,3,0,-3,1,-3,2,1,3,3,2,2,3,3,3,3,3,0,-3,1,-3,2,2,1,1,-3,2,2,3,3,2,2,0,-3,2,-3,2,1,1,1,-3,1,1,2,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,2,0,1,1,0,3,1,1,0,3,3,0,0,0,0,2,1,1,1,0,4,2,4,0,0,0,0,0,0,0,2,1,1,1,1,2,0,1,0,1,0,0,1,1,0,2,0,1,1,0,2,0,1,1,3,3,0,0,0,0,0,1,0,0,0,1,1,5,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,1,buffer,0,0,0,0,0,0,0,-1,0,0,-1,1,1,0,0,2,3,0,-1,-1,0,0,1,0,0,0,2,2,3,-1,2,3,0,-1,-1,0,0,0,0,0,-1,1,1,5,-1,buffer,0,1,0,0,0,0,buffer,0,-0.2,0.2,0.6,0.2,1.2,0.6,0,1,buffer,0.333333333,0,0,0.666666667,0.533333333,buffer,0,1,0,0,0,0,0,0.8,1,1.2,1,2,0,1,0.8,0.6,0.8,0.8,1.2,0.2,1.4,0.6,0.2,0.4,buffer,grad_prof +197,R_5z7ZsDfonFF4A81,46 - 52,Canadian,Male,Male,College Diploma/Certificate,48,01PfPsV,01PAST,10,01ITEM,0.25,1,0,-1,1,1,0,2,0,-1,0,0,1,0,3,2,0,2,-3,1,2,-2,0,0,0,0,0,0,0,1,1,0,1,-3,1,1,-1,0,0,1,0,0,1,-1,1,0,0,0,-3,1,2,-1,2,0,0,0,1,1,2,0,1,0,0,-3,1,2,-1,2,0,0,0,0,0,2,3,2,1,0,5,5,5,5,5,5,5,5,5,5,5,5,2,0,1,2,2,0,1,0,0,1,0,2,1,0,1,2,0,0,1,2,0,2,0,0,0,1,2,2,0,2,2,0,1,1,0,0,1,0,1,0,2,3,1,0,2,2,0,1,1,0,0,1,0,0,1,2,0,0,1,2,0,0,1,1,0,0,1,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,3,1,1,0,buffer,0,0,0,1,2,0,0,0,-1,1,-2,-1,0,0,-1,0,0,-1,0,2,0,1,0,0,-1,-1,2,2,-1,0,0,0,1,1,0,0,1,0,-1,0,1,-3,0,-1,1,buffer,0,0,0,0,0,0,buffer,0.6,0,-0.8,0.2,0,0.4,0.4,0,-0.4,buffer,0,0,-0.066666667,0.2,0,buffer,0,0,0,0,0,0,1.4,0.4,0.8,1,0.4,1.4,0.8,0.4,1.6,0.8,0.4,1,0.4,0.4,0.6,0,0.4,1,buffer,C_Ug +198,R_3puR6zIktNYt6ru,32 - 38,Canadian,Male,Male,University - Undergraduate,33,03VPfPs,01PAST,5,01ITEM,-0.5,1,0,3,3,2,1,3,2,1,3,0,3,3,2,3,1,3,1,3,2,3,3,-3,3,1,3,-3,3,3,0,2,3,1,3,1,3,3,1,3,2,2,-2,1,0,-2,3,-3,3,3,1,3,3,3,-3,1,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,-2,3,10,8,10,8,8,8,8,8,8,0,8,8,2,0,0,2,0,5,2,2,3,6,0,1,3,1,0,2,0,1,2,0,1,2,1,2,5,2,2,5,2,6,0,0,1,2,0,1,4,2,3,0,0,1,0,1,0,0,0,1,2,0,1,4,0,3,0,0,1,0,3,0,0,0,1,0,0,4,0,1,1,1,2,3,2,1,6,0,0,2,0,0,0,0,2,0,0,0,0,0,2,0,buffer,2,0,-1,0,0,4,-2,0,0,6,0,0,3,0,0,2,0,0,0,0,0,-2,1,-1,5,2,1,5,-1,6,0,0,-1,0,0,4,0,-1,1,1,2,3,2,-1,6,buffer,2,0,2,8,0,0,buffer,0.2,1.6,0.6,0.4,0.6,2.6,-0.2,1,2.4,buffer,1.333333333,2.666666667,0.8,1.2,1.066666667,buffer,2,0,2,8,0,0,0.8,3.6,1,1,2.2,3.4,0.6,2,0.4,0.6,1.6,0.8,0.2,1.4,2.8,0.4,0.4,0.4,buffer,C_Ug +199,R_7oIpKmsCj6LC4Pq,67 - 73,American,Male,Male,University - Undergraduate,73,03VPfPs,02FUT,5,02DGEN,-0.375,1,0,3,2,3,2,2,-3,-3,3,-2,1,2,-3,1,-3,3,3,2,3,1,2,-3,-2,3,-2,1,2,-3,2,-3,3,3,1,3,0,1,-3,-2,3,-3,1,2,-1,1,-3,3,3,2,3,2,1,-3,-2,2,-1,0,1,-3,2,-3,3,3,2,3,3,0,-3,-1,1,-1,0,1,-3,1,-3,3,1,1,1,1,1,1,8,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,1,0,1,0,1,0,0,2,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,2,0,2,2,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,2,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,buffer,0,0,0,1,-1,0,0,-1,-1,-1,-1,0,0,0,0,0,1,0,1,-1,0,-1,-2,0,-1,-1,2,0,0,0,0,1,0,0,0,0,-1,-1,1,0,0,2,0,0,0,buffer,-7,0,0,0,0,0,buffer,0,-0.6,-0.2,0.2,-0.8,0.2,0.2,-0.2,0.4,buffer,-2.333333333,0,-0.266666667,-0.133333333,0.133333333,buffer,0,0,0,7,0,0,0.2,0.2,0.2,0.8,0.4,0.4,0.2,0.8,0.4,0.6,1.2,0.2,0.6,0.2,0.6,0.4,0.4,0.2,buffer,C_Ug +200,R_18M7dRJ21zAoFu4,53 - 59,American,Female,Female,College Diploma/Certificate,59,03VPfPs,02FUT,5,01ITEM,-0.75,0.333333333,0.666666667,1,2,0,-3,3,0,-3,3,-3,1,1,1,3,0,2,1,3,-2,-3,3,-1,0,1,1,-1,0,2,2,0,1,1,2,1,-3,2,1,-2,3,-2,1,0,3,3,2,0,0,2,1,-1,3,0,-2,2,-3,0,0,2,2,-2,2,1,1,1,1,1,0,-1,1,-2,0,0,2,2,-2,2,3,4,3,4,5,5,2,2,4,6,5,3,0,1,2,0,0,1,3,2,4,2,1,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,2,0,2,2,1,0,1,2,0,0,1,1,0,1,1,1,1,2,0,0,1,1,4,2,0,2,2,1,1,1,1,1,2,0,0,1,3,0,1,2,2,2,3,2,0,1,1,2,1,1,1,0,2,2,0,1,1,1,0,0,0,0,0,0,buffer,-1,1,1,-2,0,1,2,1,4,1,0,0,0,-2,1,0,-1,0,-4,-1,1,-1,-2,0,-1,0,1,-1,0,2,-1,0,3,-2,-1,2,1,1,2,2,0,1,1,2,1,buffer,1,2,-1,-2,0,2,buffer,-0.2,1.8,-0.2,-1.2,-0.6,0.4,-0.2,1.6,1,buffer,0.666666667,0,0.466666667,-0.466666667,0.8,buffer,1,1,2,4,3,1,0.6,2.4,0.8,0.4,0.6,1.4,0.8,0.6,1,1.6,1.2,1,1,2.2,1,1.2,0.6,0,buffer,C_Ug +201,R_5ODgAa2BmCZ00qO,46 - 52,Canadian,Female,Female,University - Graduate (Masters),49,02PsVPf,02FUT,10,02DGEN,0.625,1,0,3,1,1,0,2,0,-2,3,-3,0,3,0,2,-2,3,2,1,1,-3,2,1,-3,3,-3,1,3,0,1,-3,3,3,2,0,-2,2,3,-2,3,-2,2,3,-1,3,0,3,2,1,1,0,2,2,-3,3,-3,1,3,1,2,-3,3,2,1,1,1,1,1,-3,3,-3,0,3,0,3,-3,3,1,1,0,3,2,1,2,0,0,3,0,0,1,0,0,3,0,1,1,0,0,1,0,0,1,1,0,0,1,1,2,0,3,0,0,1,2,0,1,1,2,0,1,0,0,0,0,2,1,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,0,2,1,0,1,1,0,1,2,3,0,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,buffer,0,0,0,3,0,-1,0,0,0,0,0,-1,1,0,0,-1,1,1,1,-1,2,-1,0,1,2,0,1,0,1,0,1,1,1,0,-1,1,1,0,1,0,0,0,1,3,0,buffer,-1,1,0,0,2,1,buffer,0.6,-0.2,0,0.2,0.8,0.4,0.4,0.6,0.8,buffer,0,1,0.133333333,0.466666667,0.6,buffer,2,1,1,1,0,0,0.8,0.6,0.4,0.8,1.2,0.8,0.2,0.8,0.4,0.6,0.4,0.4,0.8,1,1.2,0.4,0.4,0.4,buffer,grad_prof +202,R_5n3WtCtZeWxVeq5,39 - 45,American,Male,Male,University - Undergraduate,40,01PfPsV,01PAST,10,01ITEM,0.5,0,1,3,2,3,2,3,1,1,-1,0,1,0,1,0,-1,-1,0,1,1,0,2,2,-1,0,0,0,0,-1,1,1,0,0,3,0,1,1,1,-1,1,0,0,-1,0,0,-1,2,2,0,3,1,0,0,1,-1,0,1,-1,0,-1,2,0,2,3,0,1,1,1,-1,1,0,2,0,-1,0,1,2,9,8,8,7,8,9,7,10,7,8,9,8,3,1,2,2,1,1,2,1,0,1,0,2,1,2,1,3,1,3,1,2,0,2,2,0,1,1,1,0,0,3,1,2,0,1,3,1,0,0,0,0,1,1,1,3,1,1,1,3,1,2,0,2,2,0,1,0,2,0,2,3,0,2,1,1,1,1,0,1,0,0,1,1,1,2,2,0,3,3,0,1,1,2,2,0,1,1,1,1,1,2,buffer,2,-1,2,1,-2,0,2,1,0,1,-1,1,0,-1,0,2,0,0,0,0,0,0,0,0,0,1,-1,0,-2,0,0,-1,-2,1,0,0,-2,-1,0,-1,0,0,0,1,0,buffer,2,-2,1,-1,-1,1,buffer,0.4,0.8,-0.2,0.4,0,-0.4,-0.4,-0.8,0.2,buffer,0.333333333,-0.333333333,0.333333333,0,-0.333333333,buffer,2,0,1,1,1,1,1.8,1,1.2,2,1,1,1.4,0.2,1.4,1.6,1,1.4,1,0.4,1.4,1.4,1.2,1.2,buffer,C_Ug +203,R_5FzigTMBbalmb1p,60 - 66,American,Male,Male,College Diploma/Certificate,66,02PsVPf,02FUT,5,01ITEM,-0.5,0.333333333,0.666666667,0,1,3,1,3,1,0,2,0,1,2,0,2,0,0,2,3,3,2,3,2,3,3,2,2,3,3,3,2,3,1,1,3,2,3,3,2,3,3,2,3,2,3,2,3,0,0,3,1,2,1,1,2,1,1,3,1,2,0,3,0,1,3,2,3,2,2,2,1,1,3,2,3,0,3,2,2,2,2,1,1,1,2,1,1,2,2,2,2,0,1,0,1,3,1,2,1,1,3,1,2,3,1,0,0,1,0,2,2,1,3,1,1,2,1,2,3,0,1,0,0,1,0,1,0,1,0,1,1,0,0,3,0,0,0,1,0,1,2,0,1,0,1,2,1,0,3,1,2,0,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,0,0,buffer,2,1,0,1,-1,1,2,1,1,1,0,2,1,2,0,1,0,0,0,0,1,0,1,2,1,0,0,0,2,0,1,1,0,-1,-1,0,0,0,1,0,0,0,-1,0,0,buffer,1,0,1,1,-1,-1,buffer,0.6,1.2,1,0.2,1,0.4,0,0.2,-0.2,buffer,0.666666667,-0.333333333,0.933333333,0.533333333,0,buffer,0,1,1,0,0,1,1,1.6,2,0.4,1.8,1.8,0.4,0.4,1,0.2,0.8,1.4,0.6,0.6,0.2,0.6,0.4,0.4,buffer,C_Ug +204,R_7eRyIUDyL1PsvVX,67 - 73,American,Male,Male,High School (or equivalent),73,03VPfPs,02FUT,10,02DGEN,0.25,0.666666667,0.333333333,-2,2,2,1,-1,3,1,3,1,1,2,3,3,-2,1,-2,2,2,-1,-2,2,1,3,1,-1,2,3,2,-3,1,-2,2,2,-1,0,2,1,3,1,0,2,3,3,-2,1,-2,3,3,3,-2,2,1,3,1,-1,2,3,3,-3,1,-2,2,2,3,-3,2,2,3,2,-1,2,3,3,-3,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,0,2,1,1,0,0,0,2,0,0,1,1,0,0,0,0,2,1,1,0,0,0,1,0,0,0,0,0,0,1,1,2,1,1,0,0,0,2,0,0,0,1,0,0,0,0,2,2,1,1,0,1,2,0,0,0,1,0,0,0,0,0,2,0,0,0,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,buffer,0,-1,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,-1,0,-1,0,-1,-1,0,0,0,-1,0,0,-1,-1,0,1,0,-1,0,-1,1,0,0,1,1,0,buffer,0,0,1,0,0,0,buffer,-0.4,0,0.2,-0.2,-0.6,-0.2,-0.2,-0.2,0.4,buffer,0.333333333,0,-0.066666667,-0.333333333,0,buffer,0,0,0,0,0,1,0.6,0.6,0.4,0.6,0.4,0,1,0.6,0.2,0.8,1,0.2,0.4,0.2,0.4,0.6,0.4,0,buffer,HS_TS +205,R_6D7AAGi8XfqcB7w,32 - 38,American,Female,Female,University - Graduate (Masters),38,01PfPsV,01PAST,10,02DGEN,-0.375,0,1,2,2,2,1,3,-3,-3,2,3,0,1,0,0,1,1,2,2,2,1,2,-3,-3,2,3,0,1,0,0,1,1,2,2,2,2,1,-3,-3,2,3,0,1,0,0,1,1,2,2,2,1,2,-3,-3,2,1,0,1,0,1,0,1,2,2,2,0,2,-3,-2,2,2,0,1,1,0,-1,1,0,0,1,2,0,7,1,1,0,2,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,2,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,1,0,buffer,0,0,0,0,0,0,0,0,-2,0,0,0,-1,-1,0,0,0,0,0,1,0,-1,0,-1,0,0,-1,0,-2,0,0,0,0,0,1,0,-1,0,-1,0,0,-1,-1,-1,0,buffer,-1,-1,1,0,-2,6,buffer,0,-0.4,-0.4,0.2,-0.4,-0.6,0.2,-0.4,-0.6,buffer,-0.333333333,1.333333333,-0.266666667,-0.266666667,-0.266666667,buffer,2,0,6,1,1,1,0.2,0,0,0.6,0,0,0.2,0.4,0.4,0.4,0.4,0.6,0.4,0,0,0.2,0.4,0.6,buffer,grad_prof +206,R_5CBBrH7qOkchQSU,53 - 59,American,Female,Female,University - Graduate (Masters),59,03VPfPs,01PAST,10,01ITEM,1,0.333333333,0.666666667,2,3,3,-2,-2,2,-3,3,-3,1,3,1,2,2,3,3,3,3,-2,-2,2,-3,2,-2,2,1,0,1,1,1,2,2,3,-2,-2,2,-3,3,-2,1,3,2,2,2,2,2,3,2,2,3,3,2,2,2,2,3,2,2,1,3,3,3,3,-2,-2,2,-2,2,-2,2,3,3,3,3,3,1,1,1,1,1,2,1,1,2,1,1,1,1,0,0,0,0,0,0,1,1,1,2,1,1,1,2,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,4,5,1,5,1,5,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,1,0,2,1,1,0,1,1,0,0,0,0,0,1,0,1,2,2,1,1,1,1,0,1,4,5,1,4,0,4,0,0,1,1,2,0,buffer,1,0,-1,-4,-5,-1,-5,0,-4,0,2,0,1,0,2,-1,1,0,0,0,0,-1,-1,0,-1,0,-1,-1,-1,1,0,1,-1,-4,-5,-1,-4,1,-4,1,2,1,0,-1,1,buffer,0,0,-1,0,0,1,buffer,-1.8,-2,1,0,-0.6,-0.4,-1.8,-1.4,0.6,buffer,-0.333333333,0.333333333,-0.933333333,-0.333333333,-0.866666667,buffer,0,0,1,0,0,1,0.2,0.6,1.4,0.2,0.2,0.4,2,2.6,0.4,0.2,0.8,0.8,0.4,0.4,1.4,2.2,1.8,0.8,buffer,grad_prof +207,R_3OvH2dSZs2LsOTD,67 - 73,American,Male,Male,Trade School (non-military),72,02PsVPf,01PAST,10,01ITEM,-1,0,1,1,3,3,-1,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,2,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,0,0,0.2,0,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.2,0,0,0.4,0,0,0.2,0,0,0.2,0,0,0.2,0,0,0,0,0,buffer,HS_TS +208,R_1q8TVZ4f8FHZQzc,53 - 59,American,Female,Female,University - Graduate (Masters),54,02PsVPf,02FUT,5,02DGEN,-0.25,0,1,2,3,3,1,3,-2,2,3,-3,3,3,-3,3,-3,3,2,3,2,2,3,1,1,3,-3,3,3,-3,3,1,3,3,3,1,1,3,2,-1,3,-3,3,3,-3,3,3,3,1,3,2,2,3,-2,3,3,-3,3,2,-3,3,-3,3,2,2,2,3,3,-3,3,2,-2,2,2,-3,2,-3,3,3,7,0,5,6,0,4,8,0,5,4,0,0,0,1,1,0,3,1,0,0,0,0,0,0,4,0,1,0,2,0,0,4,3,0,0,0,0,0,0,6,0,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,1,2,0,1,1,1,1,1,1,0,1,0,0,1,0,1,1,0,1,2,0,0,0,0,0,0,2,0,1,1,0,1,0,1,0,1,1,1,0,0,1,0,0,buffer,-1,0,0,0,0,3,0,0,0,0,-1,0,0,4,0,1,-1,1,-2,0,3,2,-1,-1,-1,-1,0,-1,6,0,0,-1,1,0,0,0,2,-1,-1,-1,0,0,-1,2,0,buffer,-1,-1,0,0,2,0,buffer,-0.2,0.6,0.6,-0.2,0.4,0.8,0,-0.2,0.2,buffer,-0.666666667,0.666666667,0.333333333,0.333333333,0,buffer,2,1,0,1,4,0,0.4,0.8,0.8,0.6,1.4,1.2,0.6,0.2,0.2,0.8,1,0.4,0.6,0.6,0.4,0.6,0.8,0.2,buffer,grad_prof +209,R_1iRvwVfXaAMLuPn,46 - 52,American,Male,Male,High School (or equivalent),50,02PsVPf,02FUT,5,02DGEN,0.375,0,1,2,2,3,2,-2,-2,0,2,0,2,0,1,2,0,3,2,2,2,2,-2,-1,1,1,0,1,0,1,2,0,2,1,1,1,1,-2,-1,2,1,1,1,0,1,2,0,2,3,3,1,0,0,-2,-1,1,-1,3,-2,1,2,0,3,3,3,1,1,0,0,-1,2,-1,3,0,1,2,0,3,6,4,4,6,7,7,8,8,6,6,10,9,0,0,1,0,0,1,1,1,0,1,0,0,0,0,1,1,1,2,1,0,1,2,1,1,1,0,0,0,0,1,1,1,2,2,2,0,1,1,1,1,2,0,0,0,0,1,1,2,1,2,2,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,2,0,1,0,0,2,0,0,0,0,buffer,-1,-1,-1,-2,-2,1,0,0,-1,0,-2,0,0,0,1,0,0,0,0,-2,-1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,-2,1,-1,1,0,-2,0,0,0,0,buffer,-2,-4,-2,0,-3,-2,buffer,-1.4,0,-0.2,-0.4,0.2,0.2,0.6,-0.2,-0.4,buffer,-2.666666667,-1.666666667,-0.533333333,0,-1.85E-17,buffer,0,3,3,2,2,3,0.2,0.8,0.2,1,1.2,0.2,1.6,0.8,0.4,1.4,1,0,0.8,0.4,0,0.2,0.6,0.4,buffer,HS_TS +210,R_1iP5RCoXNQ1O3r7,67 - 73,American,Male,Male,High School (or equivalent),73,03VPfPs,01PAST,5,02DGEN,0.125,0,1,2,2,2,2,2,0,0,2,1,1,3,3,3,3,3,2,2,2,2,2,0,-1,1,0,1,3,3,3,3,3,2,2,2,2,2,1,-1,2,0,1,3,3,3,3,3,1,1,2,1,1,0,-1,3,-1,0,3,3,3,3,3,1,2,2,2,1,0,-1,1,-1,-1,3,3,3,3,3,2,3,6,4,4,3,4,4,3,4,4,4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,0,1,1,0,1,1,2,1,0,0,0,0,0,1,0,0,0,1,0,1,1,2,2,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,2,0,1,0,0,0,0,0,buffer,-1,-1,0,-1,-1,0,0,0,-1,-1,0,0,0,0,0,-1,0,0,0,-1,1,0,-1,-1,-2,0,0,0,0,0,0,-1,0,-1,0,1,0,-1,0,-1,0,0,0,0,0,buffer,-2,-1,3,0,0,-1,buffer,-0.8,-0.4,0,-0.4,-0.6,0,-0.4,-0.2,0,buffer,0,-0.333333333,-0.4,-0.333333333,-0.2,buffer,2,1,3,0,0,1,0,0.6,0,0,0.6,0,0.8,1,0,0.4,1.2,0,0,0.4,0,0.4,0.6,0,buffer,HS_TS +211,R_1A7vesKafsefMtz,60 - 66,American,Female,Female,University - Graduate (Masters),65,03VPfPs,01PAST,5,01ITEM,0.125,0,0.666666667,3,3,2,-2,-3,-3,-3,2,-3,0,1,2,2,0,3,3,3,3,1,-2,-3,-3,3,0,1,2,2,2,0,3,3,3,3,2,1,-3,-3,3,-3,1,2,3,2,1,3,3,3,3,0,-3,-3,-3,0,-2,-1,0,2,2,0,3,3,3,2,0,-3,-3,-3,2,-3,0,2,2,3,1,3,6,7,3,2,1,6,0,2,1,1,2,1,0,0,1,3,1,0,0,1,3,1,1,0,0,0,0,0,0,1,4,4,0,0,1,0,1,1,1,0,1,0,0,0,1,2,0,0,0,2,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,3,0,0,0,3,0,0,1,0,1,0,0,0,1,0,0,0,0,2,1,1,2,0,1,1,0,buffer,0,0,0,1,1,0,0,-1,2,0,0,0,0,0,0,0,0,1,2,4,0,0,1,0,1,0,1,-1,0,0,0,0,-1,1,3,0,0,-2,2,-1,-2,1,-1,0,0,buffer,6,5,2,1,-1,5,buffer,0.4,0.2,0,1.4,0.4,0,0.6,-0.2,-0.4,buffer,4.333333333,1.666666667,0.2,0.6,-1.85E-17,buffer,4,6,3,1,0,0,1,1,0.2,1.8,0.4,0.6,0.6,0.8,0.2,0.4,0,0.6,0.8,0.6,0.4,0.2,0.8,0.8,buffer,grad_prof +212,R_7GCFonsZvAHmC8J,67 - 73,American,Male,Male,Trade School (non-military),71,01PfPsV,02FUT,10,02DGEN,0.25,0,1,3,2,0,3,2,1,2,3,-3,2,3,2,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,3,2,0,3,2,1,1,3,-3,2,3,3,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,1,1,1,1,1,1,1,1,1,2,1,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,-1,0,0,buffer,0,0,0,0,-0.4,0,0,0.4,0,buffer,0,-0.333333333,0,-0.133333333,0.133333333,buffer,0,0,0,1,0,0,0,0.6,0.2,0,0.2,0.2,0,0.6,0.2,0,0.6,0.2,0,0.4,0,0,0,0,buffer,HS_TS +213,R_7oA8EmXF8TtRoml,60 - 66,American,Male,Male,College Diploma/Certificate,65,03VPfPs,01PAST,5,01ITEM,-0.5,0.666666667,0.333333333,-3,2,3,-3,2,-3,1,3,-3,-2,3,-3,3,0,3,-3,2,3,-3,2,-3,1,3,-3,-3,3,-3,3,0,3,-3,2,3,-3,2,-3,2,3,-3,0,3,-3,3,0,3,-3,2,3,-3,2,-3,1,3,-3,-3,3,-3,-3,-3,3,-3,2,3,0,1,-3,1,3,-3,-3,3,-3,-3,-3,3,0,0,0,0,0,0,0,0,5,1,0,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,6,3,0,0,0,0,3,1,0,0,0,0,1,0,0,6,3,0,0,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,-6,-3,0,0,0,0,-3,-1,0,1,0,0,1,0,0,-6,-3,0,0,0,0,-3,-1,0,1,0,0,3,0,0,0,0,0,buffer,0,0,-5,-1,0,-3,buffer,0,0,-1.8,-0.8,0.4,-1.8,-0.8,0.8,0,buffer,-1.666666667,-1.333333333,-0.6,-0.733333333,0,buffer,0,0,0,1,0,2,0,0.2,0,0,0.6,0,0,0.2,1.8,0.8,0.2,1.8,0,0.8,0,0.8,0,0,buffer,C_Ug +214,R_1wME4EFMQlwms1U,67 - 73,American,Male,Male,College Diploma/Certificate,72,02PsVPf,02FUT,10,01ITEM,0.125,1,0,2,-2,1,-2,1,-2,-2,3,-2,0,2,1,2,-2,2,2,-2,0,-3,1,0,-1,2,-1,1,2,1,2,-1,2,2,-2,0,-3,2,0,-2,2,0,0,2,1,1,0,2,2,-2,1,-1,0,0,-2,2,-1,0,2,1,1,-2,2,2,-3,1,0,-1,-2,0,2,0,-1,2,1,1,-3,2,3,3,3,3,3,3,2,2,2,2,2,1,0,0,1,1,0,2,1,1,1,1,0,0,0,1,0,0,0,1,1,1,2,0,1,2,0,0,0,1,2,0,0,0,0,1,1,2,0,1,1,0,0,0,1,0,0,0,1,0,2,2,0,2,1,2,1,0,0,1,1,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,2,2,0,1,1,0,0,0,1,0,buffer,0,0,1,0,-1,0,1,0,0,1,0,0,-1,1,0,0,-1,1,-1,-1,2,-2,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,-2,-1,0,0,0,0,0,1,0,0,buffer,1,1,1,1,1,2,buffer,0,0.4,0,-0.4,-0.2,0.2,-0.4,-0.6,0.2,buffer,1,1.333333333,0.133333333,-0.133333333,-0.266666667,buffer,0,0,0,0,0,1,0.4,1.2,0.2,0.6,1,0.6,0.4,0.8,0.2,1,1.2,0.4,0.2,0.6,0.4,0.6,1.2,0.2,buffer,C_Ug +215,R_1eRG5DfSgi9GUaO,67 - 73,American,Male,Male,University - Graduate (Masters),67,03VPfPs,01PAST,10,02DGEN,-0.75,1,0,1,2,1,-3,3,3,-2,3,-3,1,3,1,3,0,2,-1,-1,2,-3,3,3,-3,3,-3,2,3,1,3,3,2,-1,-1,2,-3,3,3,-3,3,-3,2,2,0,3,2,2,0,2,2,0,3,2,-3,3,-3,-1,3,1,3,0,3,1,2,2,2,3,2,-2,2,-2,-1,3,1,3,-1,3,1,1,1,1,2,1,1,1,1,2,3,1,2,3,1,0,0,0,1,0,0,1,0,0,0,3,0,2,3,1,0,0,0,1,0,0,1,1,1,0,2,0,1,0,1,3,0,1,1,0,0,2,0,0,0,0,1,0,0,1,5,0,1,0,1,1,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,2,0,0,1,1,1,0,0,0,0,1,0,buffer,1,3,0,-3,0,-1,0,0,0,-1,0,0,0,3,-1,2,3,0,-5,0,-1,1,-1,-1,-1,1,1,0,1,-1,-1,0,0,-2,0,0,-1,-1,-1,0,1,1,0,0,0,buffer,0,0,0,-1,-1,0,buffer,0.2,-0.4,0.4,0,-0.6,0.4,-0.6,-0.6,0.4,buffer,0,-0.666666667,0.066666667,-0.066666667,-0.266666667,buffer,0,1,0,1,2,0,1.2,0.4,0.6,1.2,0.4,0.8,1,0.8,0.2,1.2,1,0.4,0,0,0.6,0.6,0.6,0.2,buffer,grad_prof +216,R_6H0gQH94g701rde,67 - 73,American,Male,Male,College Diploma/Certificate,72,01PfPsV,01PAST,5,02DGEN,-0.125,0.666666667,0.333333333,3,1,2,-2,0,1,-2,1,-2,0,2,1,1,1,1,3,1,2,-2,0,1,-2,2,-2,1,2,1,1,1,1,3,1,2,-2,0,1,-2,1,-2,1,2,1,1,1,1,2,1,2,-1,0,1,-2,1,-2,0,2,1,1,1,1,2,1,2,-2,0,0,-2,1,-2,0,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,buffer,-1,0,0,-1,0,0,0,1,0,1,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,-1,0,1,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0.4,0,-0.2,0,0,-0.2,0,0,buffer,0,0,0,-0.066666667,-0.066666667,buffer,0,0,0,0,0,0,0,0.4,0,0,0.2,0,0.4,0,0,0.2,0.2,0,0,0.2,0,0.2,0.2,0,buffer,C_Ug +217,R_1bOYJHrIvhA1qkI,60 - 66,American,Male,Male,College Diploma/Certificate,60,01PfPsV,01PAST,10,02DGEN,0,0,1,2,2,2,-1,0,1,-2,1,1,-1,3,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,2,2,2,1,0,1,2,1,1,1,3,2,0,0,3,1,0,0,0,1,1,2,1,1,1,3,2,0,0,3,2,2,2,1,0,1,2,1,1,1,3,2,0,0,3,2,2,2,1,0,1,2,1,1,1,3,2,0,0,3,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-2,-2,-1,1,0,0,0,0,0,0,0,0,0,0,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,1.4,0,0,buffer,0,0,0,-0.333333333,0.466666667,buffer,0,0,0,0,0,0,1.4,1.2,1.6,0.4,1.2,1.6,1.4,1.2,1.6,1.4,1.2,1.6,1.4,0,0,0,0,0,buffer,C_Ug +218,R_6YJaPA1qoviEfuh,53 - 59,Canadian,Male,Male,High School (or equivalent),55,03VPfPs,02FUT,5,01ITEM,0.25,0,1,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,2,2,-1,2,2,-1,2,2,-1,1,1,2,2,2,2,1,2,-1,2,2,1,2,1,-1,1,1,2,2,2,2,1,2,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,1,2,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,1,2,1,2,1,2,2,2,1,2,8,1,1,2,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,2,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,-7,1,1,0,buffer,0,0.4,0,0.4,0.2,0,0.4,0.2,0,buffer,-2.333333333,0.666666667,0.133333333,0.2,0.2,buffer,1,0,1,0,1,6,0,0.4,0.2,0.4,0.2,0.2,0,0,0.2,0,0,0.2,0.4,0.2,0,0,0,0,buffer,HS_TS +219,R_5cv0dxIpYqsp6ac,25 - 31,Canadian,Female,Female,College Diploma/Certificate,26,02PsVPf,02FUT,5,01ITEM,1,0.333333333,0.666666667,1,1,1,2,1,2,-3,2,-1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,8,8,8,8,8,8,8,7,7,8,8,8,1,1,1,2,1,2,3,2,1,1,1,0,0,0,1,1,1,1,1,1,1,3,2,1,1,1,0,0,0,1,1,1,1,2,1,2,3,2,1,0,1,0,0,0,0,0,1,0,2,1,1,3,2,1,1,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,buffer,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,-1,0,0,0,0,0,0,0,-1,0,0,0,-1,0,-1,1,0,0,0,0,0,-1,0,-1,0,0,-1,buffer,0,1,1,0,0,0,buffer,0,0.2,0.2,0.2,0,-0.2,-0.2,-0.2,-0.4,buffer,0.666666667,0,0.133333333,0,-0.266666667,buffer,0,0,0,0,1,1,1.2,1.8,0.4,1,1.6,0.4,1.2,1.6,0.2,0.8,1.6,0.6,0.2,0.2,0,0.4,0.4,0.4,buffer,C_Ug +220,R_79XB8gz2JC1iSnD,53 - 59,American,Female,Female,University - Undergraduate,55,02PsVPf,02FUT,10,02DGEN,-0.125,0,1,2,2,3,3,3,1,-1,0,-1,1,-1,-2,2,-2,3,1,1,2,2,3,0,-1,-1,0,1,-1,-2,2,-2,3,2,2,2,2,3,0,2,-2,3,1,-1,-2,2,-2,3,2,1,2,2,3,-1,1,-1,1,-1,-1,0,2,-2,3,1,1,2,2,2,-1,1,0,1,-1,-1,-1,2,-2,3,6,6,6,6,6,6,6,6,6,6,6,6,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,1,1,0,1,3,2,4,0,0,0,0,0,0,0,1,1,1,0,2,2,1,2,2,0,2,0,0,0,1,1,1,1,1,2,2,0,2,2,0,1,0,0,0,1,1,0,0,0,0,3,1,3,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,buffer,1,0,0,0,0,-1,-2,0,-1,-2,0,-2,0,0,0,-1,-1,0,0,-1,-1,1,2,2,-2,0,-1,0,0,0,0,1,0,0,-1,0,3,0,3,0,0,-1,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,-1.2,-0.4,-0.6,0.4,-0.2,0,1.2,-0.2,buffer,0,0,-0.466666667,-0.133333333,0.333333333,buffer,0,0,0,0,0,0,0.8,0.6,0,0.4,2,0,0.6,1.8,0.4,1,1.6,0.2,0.4,1.4,0,0.4,0.2,0.2,buffer,C_Ug +221,R_3JmVHqU1m9lfEVm,60 - 66,American,Male,Male,High School (or equivalent),61,02PsVPf,02FUT,10,02DGEN,-0.125,0,1,-3,2,2,1,1,-2,0,-1,1,-1,0,1,1,-1,0,1,2,2,1,2,-3,1,3,0,1,0,1,2,1,0,1,2,2,1,2,-3,-3,-3,-3,-3,1,1,1,1,0,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,0,0,0,0,0,-3,-3,-3,-3,-3,0,0,0,0,0,1,1,5,1,10,10,10,10,10,10,10,10,4,0,0,0,1,1,1,4,1,2,0,0,1,2,0,4,0,0,0,1,1,3,2,4,2,1,0,0,2,0,0,5,5,4,4,1,3,2,4,2,3,4,4,2,3,3,2,2,1,1,1,3,2,4,2,0,1,1,1,0,0,0,0,0,0,0,4,6,3,4,1,0,1,0,0,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,buffer,4,-5,-5,-4,-3,0,-2,2,-3,0,-3,-4,-3,0,-3,1,-2,-2,-1,0,0,0,0,0,0,1,-1,-1,1,0,-3,-3,-3,-3,-3,0,4,6,3,4,-2,-3,-2,-3,-3,buffer,-9,-9,-5,-9,0,0,buffer,-2.6,-0.6,-2.6,-0.8,0,0,-3,3.4,-2.6,buffer,-7.666666667,-3,-1.933333333,-0.266666667,-0.733333333,buffer,0,9,5,0,0,0,1,1.8,0.6,1,2.4,0.6,3.6,2.4,3.2,1.8,2.4,0.6,0,3.4,0.4,3,0,3,buffer,HS_TS +222,R_7ocpEFQBuIkFrQi,53 - 59,Canadian,Male,Male,University - Undergraduate,57,03VPfPs,01PAST,5,01ITEM,0.125,0,1,1,2,2,1,-1,-1,-1,2,-2,0,3,-1,2,-2,3,2,2,2,1,-1,-2,-2,2,-2,-1,3,-1,2,-2,3,1,2,2,1,-2,-1,-2,2,-2,-1,3,-1,2,-2,3,1,2,2,1,1,-1,-2,2,-2,1,3,-1,2,-2,3,2,2,2,1,2,-2,-2,2,-2,1,3,-1,1,-2,3,1,1,1,1,1,1,1,3,1,3,2,3,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,0,1,0,0,1,0,0,0,0,0,1,0,0,0,3,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,buffer,1,0,0,0,-2,1,0,0,0,0,0,0,0,0,0,-1,0,0,0,-2,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,buffer,0,-2,0,-2,-1,-2,buffer,-0.2,0.2,0,-0.6,-0.2,-0.2,0,0,-0.2,buffer,-0.666666667,-1.666666667,0,-0.333333333,-0.066666667,buffer,0,0,0,2,1,2,0.2,0.6,0,0.2,0.4,0,0.4,0.4,0,0.8,0.6,0.2,0.4,0.2,0,0.4,0.2,0.2,buffer,C_Ug +223,R_714uyMPUcPfFZlz,46 - 52,American,Female,Female,College Diploma/Certificate,50,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,1,1,2,-1,3,2,-2,2,-2,1,1,1,3,0,1,1,2,2,-2,3,3,-2,3,-2,1,1,1,3,-1,1,2,2,2,-2,3,3,-2,3,-2,1,1,1,3,-1,1,2,1,2,-1,3,2,-2,2,-2,1,1,1,3,-1,1,2,1,2,0,3,2,-2,2,-2,1,1,0,3,-2,1,2,2,2,2,2,2,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,buffer,-1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,-1,0,1,0,0,-1,0,0,0,0,0,0,0,-1,0,-1,0,buffer,1,1,1,1,1,1,buffer,0.2,0.4,0,0.2,0.4,-0.4,0,0,-0.4,buffer,1,1,0.2,0.066666667,-0.133333333,buffer,0,0,0,0,0,0,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0,0.2,0.4,0,0.6,0.2,0,0,0.2,0,0.4,buffer,C_Ug +224,R_6Axhyikn92aJ8E9,46 - 52,American,Female,Female,College Diploma/Certificate,50,01PfPsV,01PAST,10,01ITEM,0,0.666666667,0.333333333,-2,2,2,2,1,1,-3,3,-3,2,2,2,2,2,2,2,2,-2,2,2,1,-2,2,-2,1,2,2,2,2,2,0,2,2,2,2,2,-2,2,-1,1,2,2,2,2,2,-2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,9,6,0,0,0,0,0,0,0,4,0,4,0,1,0,1,1,1,1,0,0,0,0,0,2,0,0,0,1,1,1,1,2,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,2,0,0,0,1,1,5,1,5,0,0,0,0,0,0,2,0,4,0,0,1,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,4,0,4,0,0,0,0,0,0,buffer,4,0,4,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-4,0,-3,1,0,0,0,0,0,0,0,4,0,0,1,-4,0,-3,0,0,0,0,0,0,buffer,0,0,0,9,6,0,buffer,1.6,0,0,0,-1.2,0,0.8,-1.2,0,buffer,0,5,0.533333333,-0.4,-0.133333333,buffer,9,6,0,0,0,0,1.8,0.8,0,0.6,1.2,0,0.2,0.8,0,0.6,2.4,0,1.2,0.4,0,0.4,1.6,0,buffer,C_Ug +225,R_3QXCqXz1NiFkRBH,53 - 59,American,Male,Male,University - Undergraduate,59,01PfPsV,01PAST,10,02DGEN,0.25,0,1,2,2,2,1,3,1,0,3,0,0,2,3,2,1,3,2,2,2,0,3,1,1,3,0,0,3,3,3,2,2,2,2,2,-2,3,2,1,3,0,0,2,3,2,2,2,2,2,3,2,3,1,0,3,0,1,3,3,2,2,2,2,2,2,3,3,-1,0,2,0,-2,3,2,2,-2,2,1,1,1,1,2,1,1,1,1,1,2,7,0,0,0,1,0,0,1,0,0,0,1,0,1,1,1,0,0,0,3,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,2,0,2,0,1,0,2,1,1,0,3,1,0,0,0,2,0,1,0,0,0,0,1,0,1,0,0,0,0,1,1,0,2,0,1,0,3,0,1,0,4,0,buffer,0,0,-1,0,0,0,1,0,0,-1,0,0,1,0,0,0,0,0,1,0,-1,1,-1,0,-2,-1,-1,0,-2,0,0,0,-1,1,0,-1,0,-1,0,-3,1,-1,1,-4,0,buffer,0,0,0,0,0,-6,buffer,-0.2,0,0.2,0.2,-0.6,-0.8,0,-1,-0.6,buffer,0,-2,0,-0.4,-0.533333333,buffer,0,1,0,0,1,6,0.2,0.2,0.8,0.6,0.4,0.4,0.4,0.2,0.6,0.4,1,1.2,0.4,0.2,0.4,0.4,1.2,1,buffer,C_Ug +226,R_14h1U7357PGdWiR,60 - 66,American,Female,Female,University - Undergraduate,65,02PsVPf,02FUT,5,02DGEN,0.375,0,0.666666667,1,3,3,-3,3,0,-3,3,-3,0,3,3,3,2,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,1,3,3,-3,3,0,-3,3,-3,0,3,3,3,1,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0.4,0,0,0,0,0,-0.4,0,buffer,0,0,0.133333333,0,-0.133333333,buffer,0,0,0,0,0,0,0,0.4,0.2,0,0.4,0.2,0,0,0.2,0,0.4,0.2,0,0,0,0,0.4,0,buffer,C_Ug +227,R_1JFLLvnXQTDl93D,60 - 66,American,Female,Female,High School (or equivalent),66,01PfPsV,01PAST,10,01ITEM,-0.125,0,1,3,3,2,1,1,-2,-2,3,-2,-1,2,1,2,0,3,3,3,3,-1,2,-3,-2,3,-3,0,2,3,2,1,3,3,3,3,-2,3,-3,-3,3,-2,0,2,2,1,1,3,3,3,3,2,-1,-2,-3,2,-2,0,3,3,1,-3,3,3,3,3,2,-2,-2,-3,2,-3,-2,3,3,3,-2,3,0,2,2,2,2,2,2,3,2,2,2,2,0,0,1,2,1,1,0,0,1,1,0,2,0,1,0,0,0,1,3,2,1,1,0,0,1,0,1,1,1,0,0,0,1,1,2,0,1,1,0,1,1,2,1,3,0,0,0,1,1,3,0,1,1,1,1,1,2,1,2,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,2,0,0,2,1,0,buffer,0,0,0,1,-1,1,-1,-1,1,0,-1,0,-1,-2,0,0,0,0,2,-1,1,0,-1,-1,0,-1,-1,0,-1,0,0,0,0,1,0,0,1,0,0,-2,0,1,-1,-1,0,buffer,-2,-1,0,0,0,0,buffer,0,0,-0.8,0.2,-0.2,-0.6,0.2,-0.2,-0.2,buffer,-1,0,-0.266666667,-0.2,-0.066666667,buffer,2,0,0,0,1,0,0.8,0.6,0.6,1.2,0.6,0.6,0.8,0.6,1.4,1,0.8,1.2,0.4,0.4,0.4,0.2,0.6,0.6,buffer,HS_TS +228,R_1NPt7vKUcOhfvbj,60 - 66,American,Male,Male,University - Undergraduate,60,03VPfPs,02FUT,5,02DGEN,-0.125,0,1,1,2,3,2,2,-2,-2,2,0,1,2,-1,2,0,2,1,2,3,2,2,-2,-2,2,-2,1,2,-2,1,-1,2,1,2,3,2,2,-2,-2,2,-2,1,2,-2,2,-1,2,1,2,3,2,2,-1,-2,2,-1,1,2,-2,2,-1,2,1,2,3,2,2,-2,-2,2,-1,1,2,2,2,-1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,2,0,0,1,1,1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,4,0,0,0,buffer,0,0,0,0,0,-1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,-2,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,-4,1,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0.2,0,0.2,-0.4,0,-0.2,-0.6,buffer,0,0,0.066666667,-0.066666667,-0.266666667,buffer,0,0,0,0,0,0,0,0.4,0.6,0,0.4,0.4,0,0.4,0.4,0,0.2,0.8,0,0,0.2,0,0.2,0.8,buffer,C_Ug +229,R_1wFFhetYJMzKoxU,60 - 66,American,Female,Female,Trade School (non-military),65,03VPfPs,01PAST,10,02DGEN,0.375,0.333333333,0.666666667,1,3,3,-1,3,2,-3,2,0,0,3,3,3,-1,3,2,3,3,-2,3,3,-3,3,-2,3,3,3,3,-2,3,2,3,3,-3,3,3,-3,3,-1,2,3,3,2,-2,3,2,3,3,1,3,3,-2,3,-2,2,3,3,3,-2,3,2,3,3,1,3,3,-3,3,0,2,3,3,3,-2,3,0,0,0,5,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,2,3,0,0,0,1,0,1,0,0,2,0,1,0,1,1,2,0,0,1,1,0,1,0,0,2,0,1,1,1,2,2,0,0,0,1,0,1,0,0,2,0,1,0,1,0,2,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,-1,0,-1,1,0,0,1,0,0,buffer,0,0,0,5,0,0,buffer,-0.2,0,0,0,0.2,0.2,0.2,-0.2,0.2,buffer,0,1.666666667,-0.066666667,0.133333333,0.066666667,buffer,5,0,0,0,0,0,0.4,1.4,0.2,0.6,1,0.4,0.6,1.4,0.2,0.6,0.8,0.2,0.2,0.4,0.2,0,0.6,0,buffer,HS_TS +230,R_71SLT2EoKV0x4Aj,60 - 66,American,Female,Female,High School (or equivalent),64,02PsVPf,02FUT,5,02DGEN,-0.5,0.666666667,0.333333333,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,0,3,2,2,-3,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,buffer,0,0,0,0,-1,-1,buffer,0,0,0,0,-0.2,-0.2,0,-0.2,-0.2,buffer,0,-0.666666667,0,-0.133333333,-0.133333333,buffer,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,0,0,0,0.2,0.2,buffer,HS_TS +231,R_5kqfBd1P2L3IaYV,53 - 59,American,Male,Male,University - Undergraduate,55,01PfPsV,01PAST,10,01ITEM,-0.25,0.666666667,0.333333333,2,2,2,1,2,-1,0,1,0,2,1,-2,3,-1,2,2,3,3,1,2,0,0,-1,-1,1,-1,1,0,0,-1,3,3,3,2,2,-3,1,2,1,1,1,-3,3,-1,3,-1,0,-1,0,1,0,1,1,0,-1,-1,0,-1,1,0,0,0,-1,1,-1,1,-1,0,0,1,0,1,0,1,-1,2,2,2,2,3,2,2,2,2,2,2,2,0,1,1,0,0,1,0,2,1,1,2,3,3,1,3,1,1,1,1,0,2,1,1,1,1,0,1,0,0,1,3,2,3,1,1,1,1,0,0,3,2,2,4,2,2,2,2,3,0,3,2,1,1,0,1,1,3,3,2,3,1,0,0,1,0,3,1,3,2,0,2,4,3,1,4,1,0,0,1,2,1,2,1,0,2,1,1,1,0,1,buffer,-3,-1,-2,-1,-1,0,-1,2,1,-2,0,1,-1,-1,1,-1,-1,-2,1,-3,0,0,0,1,0,-1,-2,-3,-2,-2,0,0,0,0,-2,2,-1,2,2,-2,1,3,2,1,3,buffer,0,0,0,0,1,0,buffer,-1.6,0,0,-1.2,0.2,-2,-0.4,0.6,2,buffer,0,0.333333333,-0.533333333,-1,0.733333333,buffer,0,1,0,0,0,0,0.4,1,2.4,0.8,1.2,0.4,2,1,2.4,2,1,2.4,0.4,1.8,2.8,0.8,1.2,0.8,buffer,C_Ug +232,R_7loY0RLgfCyRn3W,60 - 66,American,Male,Male,High School (or equivalent),60,01PfPsV,02FUT,5,01ITEM,0.125,0.666666667,0.333333333,1,1,2,-1,1,-3,-3,3,-3,-1,2,2,3,-2,3,1,1,2,0,1,-3,-2,-2,-2,-3,2,2,2,-2,3,1,1,2,0,1,-2,-2,2,-2,-2,2,2,2,-2,3,1,1,2,0,1,-3,-3,3,-2,-2,2,3,3,2,3,1,1,2,0,1,-3,-3,3,-2,-3,2,2,3,-2,3,3,3,3,3,3,3,9,9,9,9,9,3,0,0,0,1,0,0,1,5,1,2,0,0,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,4,0,0,0,0,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,4,0,buffer,0,0,0,0,0,0,1,5,0,1,0,-1,1,-4,0,0,0,0,0,0,1,1,1,0,-1,0,0,1,0,0,0,0,0,0,0,1,0,4,0,0,0,-1,0,-4,0,buffer,-6,-6,-6,-6,-6,0,buffer,0,1.4,-0.8,0,0.4,0.2,0,1,-1,buffer,-6,-4,0.2,0.2,0,buffer,0,0,0,0,0,6,0.2,1.8,0.2,0.2,1,0.2,0.2,0.4,1,0.2,0.6,0,0,1.2,0,0,0.2,1,buffer,HS_TS +233,R_1jSNeu0aXROLpUk,60 - 66,American,Male,Male,High School (or equivalent),65,02PsVPf,02FUT,10,02DGEN,-0.75,0,1,-2,3,3,1,1,0,-3,3,-3,1,3,3,3,3,3,-2,3,3,2,1,2,-3,3,-3,2,3,3,3,3,3,-2,3,3,1,1,2,-3,3,-2,3,3,3,3,3,3,0,3,3,3,1,1,-3,3,-2,2,3,3,3,3,3,0,3,3,3,1,1,-3,3,-2,1,3,3,3,1,3,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,1,2,0,0,0,0,0,2,0,0,2,0,1,0,0,1,1,0,0,0,0,0,2,0,0,2,0,1,0,0,1,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,buffer,-2,0,0,-1,0,1,0,0,-1,0,0,0,0,0,0,-2,0,0,-2,0,1,0,0,0,2,0,0,0,-2,0,0,0,0,1,0,0,0,0,1,0,0,0,0,-2,0,buffer,0,0,0,-1,0,0,buffer,-0.6,0,0,-0.8,0.6,-0.4,0.2,0.2,-0.4,buffer,0,-0.333333333,-0.2,-0.2,0,buffer,0,1,0,1,1,0,0.2,0.6,0,0,1,0,0.8,0.6,0,0.8,0.4,0.4,0.2,0.4,0,0,0.2,0.4,buffer,HS_TS +234,R_6g6Hw0fkVo1MZsr,60 - 66,American,Male,Male,Trade School (non-military),61,03VPfPs,01PAST,5,01ITEM,0.25,0.666666667,0.333333333,2,2,2,1,1,-2,2,0,-2,0,-1,0,2,-2,-1,1,0,2,-1,-1,-2,2,2,1,-1,-1,1,3,0,-1,-1,1,2,-2,-2,1,3,3,2,1,-1,2,3,1,1,2,2,2,2,0,-2,2,-1,0,-2,-2,0,2,-2,-2,2,2,3,3,-2,-2,2,-2,1,0,-2,0,2,-2,-2,2,2,1,2,3,2,2,3,3,3,3,3,1,2,0,2,2,0,0,2,3,1,0,1,1,2,0,3,1,0,3,3,3,1,3,4,1,0,2,1,3,2,0,0,0,1,1,0,0,1,2,2,1,0,0,0,1,0,0,1,2,3,0,0,2,3,0,1,0,0,0,1,2,1,0,1,1,3,1,1,1,2,0,1,0,1,2,0,0,1,1,2,0,0,1,1,2,0,0,0,0,0,buffer,1,2,0,1,1,0,0,1,1,-1,-1,1,1,2,-1,3,1,-1,1,0,3,1,1,1,1,-1,2,1,3,1,2,1,-1,0,-1,3,1,0,0,0,0,1,0,1,2,buffer,0,-1,-2,-1,0,-1,buffer,1,0.2,0.4,0.8,1.4,1.2,0.2,0.8,0.8,buffer,-1,-0.666666667,0.533333333,1.133333333,0.6,buffer,0,1,1,1,0,0,1.4,1.2,0.8,2,2.4,1.6,0.4,1,0.4,1.2,1,0.4,1,1.6,0.8,0.8,0.8,0,buffer,HS_TS +235,R_7BC4Ahzlq9Jo8PD,60 - 66,American,Female,Female,High School (or equivalent),64,01PfPsV,02FUT,5,02DGEN,1.25,0,1,1,3,3,1,1,0,0,1,1,1,3,2,1,0,1,1,3,3,0,2,1,0,0,1,1,3,2,2,0,0,1,3,3,0,1,0,1,1,2,0,3,1,1,2,2,1,3,3,0,2,0,0,2,1,0,3,0,1,1,2,0,3,3,0,2,2,0,1,0,0,2,1,0,2,1,8,6,5,8,7,5,6,8,5,5,7,5,0,0,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,2,1,0,0,0,1,1,0,0,1,0,1,0,2,0,1,1,1,0,0,1,1,2,0,0,1,1,1,1,1,2,0,0,0,0,0,1,1,1,1,1,1,0,1,1,2,2,1,0,0,0,0,2,0,1,1,0,1,1,1,1,1,buffer,0,0,0,0,0,1,0,0,0,-1,0,-2,1,-1,0,-1,0,0,0,-1,-2,1,0,0,0,-1,0,-1,0,1,-1,0,0,0,1,-1,1,0,0,1,-1,0,0,1,1,buffer,2,-2,0,3,0,0,buffer,0,0,-0.4,-0.4,-0.2,-0.2,0,0.2,0.2,buffer,0,1,-0.133333333,-0.266666667,0.133333333,buffer,0,1,0,1,1,0,0.4,0.4,0.4,0.2,0.6,0.8,0.4,0.4,0.8,0.6,0.8,1,0.2,1,1.2,0.2,0.8,1,buffer,HS_TS +236,R_5gqHUOk2VmQVMKl,53 - 59,American,Female,Female,High School (or equivalent),56,02PsVPf,01PAST,10,01ITEM,0.25,0.333333333,0.666666667,1,2,2,1,1,-1,-2,1,-2,1,2,1,1,0,2,1,1,1,1,1,0,-1,1,0,0,2,1,1,0,2,1,2,2,1,1,0,0,2,0,-1,2,1,1,-1,2,1,2,2,2,1,0,-1,-1,0,-1,2,1,0,-1,2,1,2,2,2,2,1,-2,1,-1,1,2,1,1,0,1,3,4,3,3,3,4,3,3,3,3,3,3,0,1,1,0,0,1,1,0,2,1,0,0,0,0,0,0,0,0,0,0,1,2,1,2,2,0,0,0,1,0,0,0,0,1,0,1,1,2,2,2,0,0,1,1,0,0,0,0,1,1,2,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,1,1,1,2,1,2,0,0,1,1,1,buffer,0,1,1,-1,0,0,0,-2,0,-1,0,0,-1,-1,0,0,0,0,-1,-1,-1,2,1,1,2,0,0,0,1,-1,0,1,1,0,-1,-1,0,-1,-1,-1,0,0,-1,0,-1,buffer,0,1,0,0,0,1,buffer,0.2,-0.6,-0.4,-0.4,1,0,0.2,-0.8,-0.4,buffer,0.333333333,0.333333333,-0.266666667,0.2,-0.333333333,buffer,0,1,1,0,0,0,0.4,1,0,0,1.6,0.2,0.2,1.6,0.4,0.4,0.6,0.2,0.4,0.6,0.2,0.2,1.4,0.6,buffer,HS_TS +237,R_3rxAGcCnccST8MF,60 - 66,American,Male,Male,University - Undergraduate,64,03VPfPs,01PAST,5,02DGEN,-0.375,0,0.666666667,0,3,2,1,2,-2,-1,2,-1,0,2,-2,3,-2,3,0,3,2,0,2,0,1,2,1,1,2,-2,2,-2,3,0,3,3,0,3,0,1,2,0,1,2,-2,2,-2,3,1,3,3,2,1,-1,1,2,1,-2,3,-3,2,-3,3,1,3,3,2,0,-2,1,2,1,-1,3,-2,2,-3,3,0,0,0,0,0,0,0,4,0,4,6,4,0,0,0,1,0,2,2,0,2,1,0,0,1,0,0,0,0,1,1,1,2,2,0,1,1,0,0,1,0,0,1,0,1,1,1,1,2,0,2,2,1,1,1,1,0,1,0,1,1,2,0,2,0,2,1,1,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,buffer,-1,0,-1,0,-1,1,0,0,0,-1,-1,-1,0,-1,0,-1,0,0,0,-1,2,0,0,-1,0,-1,0,0,-1,0,0,0,1,0,0,-1,0,0,1,-1,0,-1,0,0,0,buffer,0,-4,0,-4,-6,-4,buffer,-0.6,0,-0.6,-0.4,0.2,-0.4,0.2,-0.2,-0.2,buffer,-1.333333333,-4.666666667,-0.4,-0.2,-0.066666667,buffer,0,0,0,4,2,4,0.2,1.4,0.2,0.6,1.2,0.2,0.8,1.4,0.8,1,1,0.6,0.4,0.2,0,0.2,0.4,0.2,buffer,C_Ug +238,R_5q2uxUie94ClQrM,32 - 38,Canadian,Female,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,01ITEM,-2,0.333333333,0.333333333,0,1,1,2,1,1,1,0,1,2,1,2,0,1,-1,0,1,1,-1,-1,1,3,1,1,0,1,1,0,1,-1,2,1,1,1,2,1,1,0,1,-1,1,1,1,0,1,0,1,2,1,1,0,2,2,2,3,1,1,1,0,-1,0,1,2,1,2,1,2,-1,0,1,1,-1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,0,2,1,0,2,0,1,0,0,0,2,0,0,1,1,0,0,0,0,3,0,1,1,1,2,0,0,1,1,0,1,1,2,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,0,3,1,1,2,2,0,0,2,3,0,2,1,0,1,0,0,1,1,2,0,0,0,0,1,1,0,3,2,2,0,2,2,0,2,buffer,0,0,-1,2,2,-1,1,-1,-1,1,0,0,-1,-1,0,2,0,-1,0,0,0,-1,-1,-1,2,0,-2,0,0,0,2,0,0,2,2,-1,2,-2,-2,-1,0,-2,-1,1,0,buffer,0,0,0,0,0,0,buffer,0.6,-0.2,-0.4,0.2,-0.2,-0.4,1.2,-0.8,-0.4,buffer,0,0,-1.85E-17,-0.133333333,-3.70E-17,buffer,0,0,0,0,0,0,1,1,0.2,0.8,0.6,1,0.4,1.2,0.6,0.6,0.8,1.4,1.4,0.8,0.8,0.2,1.6,1.2,buffer,C_Ug +239,R_5oDT6hoqG7XK1jj,18 - 24,Canadian,Male,Male,University - Graduate (Masters),20,03VPfPs,02FUT,10,01ITEM,0.375,0,1,2,2,2,2,3,1,1,3,1,3,3,2,3,1,3,2,2,2,2,2,2,1,2,1,2,2,2,3,3,3,2,2,2,2,2,1,1,2,1,1,3,2,3,3,3,2,2,2,2,2,1,1,3,1,3,2,2,3,3,3,2,1,2,2,2,1,1,1,1,3,2,1,3,2,3,5,5,5,5,5,5,5,5,5,6,5,6,0,0,0,0,1,1,0,1,0,1,1,0,0,2,0,0,0,0,0,1,0,0,1,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,1,0,0,2,0,0,1,0,0,1,0,0,2,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,1,0,1,0,buffer,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,-1,0,0,0,0,0,-1,0,2,-1,-1,0,1,0,0,-1,0,0,0,1,0,-2,0,1,1,-1,0,-1,0,buffer,0,0,0,-1,0,-1,buffer,0,0.6,0,-0.2,0.2,-0.2,-0.2,0,-0.2,buffer,0,-0.666666667,0.2,-0.066666667,-0.133333333,buffer,0,0,0,1,0,1,0.2,0.6,0.6,0.2,0.6,0.4,0.2,0,0.6,0.4,0.4,0.6,0,0.4,0.2,0.2,0.4,0.4,buffer,grad_prof +240,R_7flZCQkk99weKhx,60 - 66,American,Female,Female,College Diploma/Certificate,65,01PfPsV,02FUT,10,02DGEN,0.375,0.666666667,0.333333333,3,-2,2,1,-3,-3,-3,3,-3,-3,2,3,3,-3,2,1,0,2,2,-3,-3,-3,3,-3,-3,2,-3,3,-3,-3,-1,1,3,2,-3,-3,-3,2,-2,-2,2,2,2,-3,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,2,3,-3,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,2,3,-3,1,1,1,1,4,6,4,0,0,0,3,0,0,2,2,0,1,0,0,0,0,0,0,0,6,0,0,5,4,3,1,1,0,0,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,2,1,1,0,0,0,0,1,1,1,0,5,1,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,2,2,0,1,0,0,0,0,0,0,0,5,0,0,4,4,3,1,1,0,0,0,1,1,1,0,0,1,0,0,2,1,1,0,0,0,0,1,1,1,0,5,1,0,4,buffer,1,1,1,1,6,4,buffer,1,0,1.8,1.8,0.6,0.2,0.8,0.6,2,buffer,1,3.666666667,0.933333333,0.866666667,1.133333333,buffer,3,5,3,3,0,0,1,0,2.2,1.8,0.6,0.6,0,0,0.4,0,0,0.4,0.8,0.6,2,0,0,0,buffer,C_Ug +241,R_5Hiu7ZgCiKpda4Y,25 - 31,Canadian,Female,Female,University - Graduate (Masters),27,01PfPsV,02FUT,10,01ITEM,0.5,0,1,3,3,2,1,3,3,-2,3,0,3,3,3,3,-1,3,3,3,-1,-1,3,0,-2,3,-2,3,3,3,3,-1,3,3,3,1,2,3,1,-2,3,-2,3,1,1,2,-2,3,3,3,1,0,3,2,-3,3,-2,3,2,2,3,-1,3,3,3,2,3,3,1,-2,3,-2,3,1,2,3,-2,3,10,10,10,10,10,10,10,10,10,10,10,10,0,0,3,2,0,3,0,0,2,0,0,0,0,0,0,0,0,1,1,0,2,0,0,2,0,2,2,1,1,0,0,0,1,1,0,1,1,0,2,0,1,1,0,0,0,0,0,0,2,0,2,0,0,2,0,2,1,0,1,0,0,0,2,3,0,1,0,0,0,0,2,2,1,1,0,0,0,1,3,0,1,1,0,0,0,1,0,0,1,0,buffer,0,0,2,1,0,2,-1,0,0,0,-1,-1,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,-1,0,0,0,1,2,1,0,0,buffer,0,0,0,0,0,0,buffer,0.6,0.2,-0.4,0,0,0.4,0.2,-0.2,0.8,buffer,0,0,0.133333333,0.133333333,0.266666667,buffer,0,0,0,0,0,0,1,1,0,0.4,0.8,1.2,0.4,0.8,0.4,0.4,0.8,0.8,1,0.2,1.2,0.8,0.4,0.4,buffer,grad_prof +242,R_5ds4R46ygys9nWw,32 - 38,Canadian,Female,Female,University - Undergraduate,35,02PsVPf,01PAST,5,02DGEN,0.375,0,1,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,3,4,4,4,5,4,4,4,4,5,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,0,1,1,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,0,1,0,0,0,0,1,1,buffer,0,1,0,0,-1,1,1,0,0,0,1,1,1,1,0,-1,0,0,0,-1,-1,0,0,-1,0,0,0,1,0,-1,-1,-1,0,0,0,0,1,0,-1,0,1,1,0,-1,-1,buffer,-1,1,-1,0,0,-1,buffer,0,0.4,0.8,-0.4,-0.4,0,-0.4,0,0,buffer,-0.333333333,-0.333333333,0.4,-0.266666667,-0.133333333,buffer,0,1,1,1,0,1,0.2,0.6,0.8,0.6,0.2,0.4,0.2,0.2,0,1,0.6,0.4,0.4,0.4,0.4,0.8,0.4,0.4,buffer,C_Ug +243,R_1fp5WR6uFgdbdtN,60 - 66,American,Male,Male,High School (or equivalent),61,03VPfPs,01PAST,5,01ITEM,-0.25,0,0.666666667,0,2,2,0,0,0,0,1,0,0,2,0,0,-2,1,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,0,0,2,2,0,0,0,0,0,0,0,2,0,0,0,2,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,2,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0.4,0,0,0.8,buffer,0,0,0,0.133333333,0.266666667,buffer,0,0,0,0,0,0,0,0.2,0.2,0,0.2,0.6,0,0.2,0.2,0,0.2,0.2,0,0,0.8,0,0,0,buffer,HS_TS +244,R_6j9OmgbUVt9jIKB,32 - 38,Canadian,Female,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,02DGEN,0.875,0,1,3,2,-3,2,2,0,2,2,1,2,1,0,2,0,1,2,3,-3,2,2,0,2,2,2,2,1,1,2,1,1,2,2,-3,2,2,0,2,2,3,2,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,6,8,6,4,6,5,5,6,5,5,5,1,1,0,0,0,0,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,2,3,2,2,0,2,2,1,2,1,0,2,0,1,3,2,3,2,2,0,2,2,1,2,1,0,2,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,-2,-1,-3,-2,-2,0,-2,-2,0,-2,-1,1,-2,1,-1,-2,-2,-3,-2,-2,0,-2,-2,1,-2,-1,0,-2,0,-1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,buffer,2,1,2,1,-1,1,buffer,-2,-1.2,-0.4,-2.2,-1,-0.8,0.2,0.2,0.4,buffer,1.666666667,0.333333333,-1.2,-1.333333333,0.266666667,buffer,1,2,2,0,0,1,0.4,0.2,0.4,0.2,0.4,0,2.4,1.4,0.8,2.4,1.4,0.8,0.2,0.2,0.4,0,0,0,buffer,C_Ug +245,R_1ZKvQzRf0XJutJT,46 - 52,Canadian,Female,Female,College Diploma/Certificate,49,01PfPsV,02FUT,5,02DGEN,0.5,0,1,1,1,-1,2,1,-1,-1,2,-1,2,2,1,2,2,1,-2,-2,-2,2,1,2,3,-1,3,1,2,2,2,2,2,1,1,-2,2,1,1,1,-1,2,2,2,2,2,2,2,3,1,-3,2,2,1,-3,3,-2,3,2,2,2,3,2,3,3,-2,3,2,2,-3,3,-3,2,2,2,2,2,2,4,6,8,3,4,4,7,8,2,3,6,7,3,3,1,0,0,3,4,3,4,1,0,1,0,0,1,0,0,1,0,0,2,2,3,3,0,0,1,0,0,1,2,0,2,0,1,2,2,1,1,1,0,1,0,1,1,2,2,1,1,1,3,2,1,2,0,0,1,0,0,1,3,3,0,0,0,1,2,0,1,1,0,0,0,0,0,0,2,1,1,0,1,0,0,1,1,0,0,0,1,0,buffer,1,3,-1,0,-1,1,2,2,3,0,0,0,0,-1,0,-2,-2,0,-1,-1,-1,0,2,1,0,0,0,0,0,0,3,1,-1,-1,0,0,2,0,0,0,0,0,0,-1,0,buffer,-3,-2,6,0,-2,-3,buffer,0.4,1.6,-0.2,-1.2,0.4,0,0.4,0.4,-0.2,buffer,0.333333333,-1.666666667,0.6,-0.266666667,0.2,buffer,1,2,4,4,2,5,1.4,3,0.4,0.2,2,0.4,1,1.4,0.6,1.4,1.6,0.4,1.2,1,0,0.8,0.6,0.2,buffer,C_Ug +246,R_3YRCJCauQ36vA89,46 - 52,Canadian,Female,Female,University - Graduate (Masters),46,02PsVPf,01PAST,10,01ITEM,1,0,0.666666667,1,1,1,1,1,2,1,2,2,2,1,2,1,2,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,2,1,1,2,2,2,1,2,1,1,1,2,1,1,2,2,1,2,2,2,1,1,1,1,1,0,2,1,2,2,1,8,8,8,8,7,8,8,8,8,9,8,9,0,1,0,0,0,1,0,1,2,1,0,1,1,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,0,1,0,1,1,2,1,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,buffer,0,1,-1,-1,-1,0,-1,0,1,0,-1,0,1,1,-1,0,-1,-1,0,1,0,0,0,0,-1,-1,0,-1,1,1,0,0,0,1,0,0,-1,0,1,-1,0,0,0,0,0,buffer,0,0,0,-1,-1,-1,buffer,-0.4,0,0,-0.2,-0.2,0,0.2,-0.2,0,buffer,0,-1,-0.133333333,-0.133333333,0,buffer,0,1,0,1,0,1,0.2,1,0.6,0.4,0.8,0.6,0.6,1,0.6,0.6,1,0.6,0.6,0.2,0.4,0.4,0.4,0.4,buffer,grad_prof +247,R_5yf4rucuBltJCUA,46 - 52,American,Female,Female,High School (or equivalent),51,01PfPsV,01PAST,5,01ITEM,-0.375,0,1,3,3,3,3,3,2,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,-3,-3,-3,-3,-3,3,3,-2,-3,3,3,3,3,3,3,2,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,2,-3,3,-3,3,3,2,3,3,3,3,3,3,3,3,2,-3,3,-3,2,3,2,3,-3,2,6,6,8,9,7,8,7,8,6,7,7,7,0,0,0,0,0,5,0,6,0,6,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,5,0,6,0,6,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,6,1,buffer,0,0,0,0,0,5,0,6,0,6,0,-1,5,-6,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,-1,0,0,0,0,0,5,0,6,0,5,0,0,5,-6,-1,buffer,-1,-2,2,2,0,1,buffer,0,3.4,-0.4,0,-0.2,-0.4,0,3.2,-0.4,buffer,-0.333333333,1,1,-0.2,0.933333333,buffer,3,1,0,0,1,1,0,3.4,1,0,0,0,0,0,1.4,0,0.2,0.4,0,3.4,1,0,0.2,1.4,buffer,HS_TS +248,R_5ooo1l9CyoPkICT,60 - 66,American,Female,Female,College Diploma/Certificate,66,02PsVPf,02FUT,10,02DGEN,-0.125,0.333333333,0.666666667,2,2,-2,2,-3,0,0,1,-1,0,1,-1,2,0,1,2,2,0,2,-2,-1,0,1,1,-1,1,-1,2,1,1,2,3,1,2,1,1,0,2,-1,1,1,-1,2,1,1,2,2,-2,2,-3,0,0,1,-1,1,1,-1,2,0,1,2,2,0,2,-3,-1,0,1,-1,0,1,-1,1,0,1,2,2,2,1,1,1,3,3,3,3,3,3,0,0,2,0,1,1,0,0,2,1,0,0,0,1,0,0,1,3,0,4,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,3,2,0,1,2,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,1,0,0,1,0,0,buffer,0,0,2,0,1,1,0,0,2,0,0,0,0,1,0,0,1,1,0,4,0,0,1,0,1,0,0,-1,1,0,0,1,-1,0,3,1,0,1,2,1,0,0,-1,0,0,buffer,-1,-1,-1,-2,-2,-2,buffer,0.6,0.6,0.2,1.2,0.4,0,0.6,1,-0.2,buffer,-1,-2,0.466666667,0.533333333,0.466666667,buffer,1,1,1,0,0,0,0.6,0.8,0.2,1.6,0.6,0.2,0,0.2,0,0.4,0.2,0.2,1,1.4,0,0.4,0.4,0.2,buffer,C_Ug +249,R_5Cx1zvpu3EERY9X,46 - 52,American,Female,Female,College Diploma/Certificate,48,03VPfPs,02FUT,10,01ITEM,1.375,0,1,3,2,2,2,3,3,2,1,0,2,2,0,0,1,2,0,0,1,2,0,0,2,1,2,0,1,1,2,2,1,1,0,2,1,0,0,0,1,1,0,3,1,3,1,0,1,2,3,1,2,2,3,2,0,0,2,2,2,1,1,2,0,1,2,1,2,2,0,2,0,3,1,1,2,3,6,7,7,7,7,5,7,6,5,6,6,6,3,2,1,0,3,3,0,0,2,2,1,1,2,1,1,2,2,0,1,3,3,2,0,1,2,1,1,3,0,2,2,0,1,1,1,1,1,1,0,2,0,2,2,0,1,1,2,1,0,2,1,0,1,2,2,1,1,1,1,1,1,0,1,1,0,0,2,0,1,0,2,0,1,1,1,1,2,2,1,1,0,1,2,2,0,1,1,1,1,2,buffer,1,2,0,-1,2,2,-1,-1,2,0,1,-1,0,1,0,1,0,-1,1,1,2,2,-1,-1,0,0,0,2,-1,1,0,-2,-1,0,-1,0,1,-2,-1,0,1,-1,0,0,-1,buffer,-1,1,2,1,1,-1,buffer,0.8,0.4,0.2,0.4,0.4,0.4,-0.8,-0.4,-0.2,buffer,0.666666667,0.333333333,0.466666667,0.4,-0.466666667,buffer,1,0,2,1,0,1,1.8,1.4,1.2,1.6,1.6,1.4,1,1,1,1.2,1.2,1,0.6,0.6,1,1.4,1,1.2,buffer,C_Ug +250,R_5eli1kwL3Xl5Fpv,46 - 52,American,Male,Male,High School (or equivalent),49,02PsVPf,02FUT,5,02DGEN,1.125,0.333333333,0.333333333,2,2,2,2,1,2,3,2,2,2,2,1,1,2,1,2,2,3,3,2,2,3,3,3,2,2,3,2,3,2,2,3,2,3,2,2,3,2,3,2,2,2,2,3,1,2,3,2,2,3,2,2,1,1,2,1,2,2,1,2,2,2,2,2,3,2,1,2,1,2,1,2,1,2,1,10,8,8,8,6,8,9,8,9,8,9,9,0,0,1,1,1,0,0,1,1,0,0,2,1,1,1,0,1,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,0,0,2,0,1,1,1,0,1,1,1,1,1,0,0,0,0,2,0,2,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,buffer,0,-1,1,1,-1,0,-1,0,0,0,-1,1,0,0,0,0,1,0,1,-1,0,-2,0,0,0,-1,0,1,1,0,0,0,1,0,0,0,-1,0,0,0,0,1,-1,-1,0,buffer,1,0,-1,0,-3,-1,buffer,0,-0.2,0,0.2,-0.4,0.2,0.2,-0.2,-0.2,buffer,0,-1.333333333,-0.066666667,0,-0.066666667,buffer,2,2,0,1,1,0,0.6,0.4,1,0.6,0.2,0.6,0.6,0.6,1,0.4,0.6,0.4,0.4,0.2,0.4,0.2,0.4,0.6,buffer,HS_TS +251,R_6fBypmBmQZi1IZ3,32 - 38,Canadian,Female,Female,High School (or equivalent),35,02PsVPf,02FUT,5,01ITEM,0.625,0,1,2,3,3,3,3,2,1,3,2,1,2,2,3,1,3,2,3,3,3,3,2,2,3,1,2,2,3,3,1,3,2,3,3,3,3,2,1,3,-1,2,2,2,3,2,3,2,3,3,3,3,2,1,3,0,2,2,2,3,0,3,2,3,3,3,3,2,1,3,0,2,2,2,3,1,3,5,6,6,7,8,6,5,7,5,6,8,6,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,1,0,-1,0,0,1,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,1,0,0,0,buffer,0,-1,1,1,0,0,buffer,0,0,0,0,0.2,0.2,0,0.6,0.2,buffer,0,0.333333333,0,0.133333333,0.266666667,buffer,2,2,0,1,1,1,0,0.6,0.2,0,0.8,0.2,0,0.6,0.2,0,0.6,0,0,0.6,0.4,0,0,0.2,buffer,HS_TS +252,R_7MFsdtCdfMALc1N,18 - 24,Both,Female,Female,High School (or equivalent),19,02PsVPf,01PAST,10,02DGEN,0,0.333333333,0,1,2,1,2,0,0,1,1,1,1,2,-1,1,0,2,3,1,2,-1,0,-1,0,-2,1,-1,2,0,-1,0,2,3,1,2,0,0,0,-1,-2,1,-1,2,1,0,0,2,1,1,0,0,0,-1,0,1,0,1,0,1,0,0,2,0,1,1,2,2,1,-1,1,-1,1,2,0,2,0,2,8,7,6,6,9,7,6,7,7,6,8,7,2,1,1,3,0,1,1,3,0,2,0,1,2,0,0,2,1,1,2,0,0,2,3,0,2,0,2,1,0,0,0,1,1,2,0,1,1,0,1,0,2,2,1,0,0,1,1,0,0,2,1,2,0,2,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,2,2,2,1,0,1,0,2,1,2,0,0,buffer,2,0,0,1,0,0,0,3,-1,2,-2,-1,1,0,0,1,0,1,2,-2,-1,0,3,-2,2,0,1,0,0,0,-1,0,-1,-1,-2,-1,0,0,-1,0,-2,0,-1,0,0,buffer,2,0,-1,0,1,0,buffer,0.6,0.8,-0.4,0.4,0.4,0.2,-1,-0.4,-0.6,buffer,0.333333333,0.333333333,0.333333333,0.333333333,-0.666666667,buffer,2,2,1,0,1,0,1.4,1.4,0.6,1.2,1.4,0.6,0.8,0.6,1,0.8,1,0.4,0.2,0.4,0.4,1.2,0.8,1,buffer,HS_TS +253,R_1YfFHpITKqo139s,60 - 66,American,Female,Female,High School (or equivalent),62,01PfPsV,01PAST,5,02DGEN,-0.125,0.333333333,0.333333333,2,3,3,3,1,-2,0,0,3,1,0,-1,3,-2,3,2,3,3,3,1,-2,0,0,3,1,0,-2,3,-2,3,2,3,3,3,1,-2,-1,0,3,1,0,-1,3,-2,3,2,3,3,3,1,-2,-2,0,2,1,0,-2,3,-2,3,2,3,3,3,1,-2,-2,0,3,1,0,-2,3,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,1,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-0.6,0,0,-0.2,-0.2,0,0,0.2,buffer,0,0,-0.2,-0.133333333,0.066666667,buffer,0,0,0,0,0,0,0,0,0.2,0,0.2,0,0,0.6,0.2,0,0.4,0.2,0,0.2,0.2,0,0.2,0,buffer,HS_TS +254,R_7PcDL3PVMJv2PWn,32 - 38,Canadian,Female,Female,University - PhD,34,02PsVPf,01PAST,5,01ITEM,0.5,0,0.666666667,2,2,2,1,1,1,1,0,0,1,2,1,2,2,1,1,1,2,2,2,1,1,0,0,1,1,1,2,2,1,1,2,2,2,1,2,0,1,0,2,1,2,2,1,1,2,2,1,1,1,1,1,0,0,2,0,2,1,2,0,2,2,0,1,0,1,0,2,0,2,0,2,1,2,0,7,7,8,8,7,7,7,8,7,8,8,8,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,2,1,1,0,1,0,0,2,0,1,0,1,2,0,1,2,1,1,0,1,0,1,0,0,1,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,2,0,0,0,0,0,0,0,buffer,1,1,-1,1,1,0,0,0,0,-1,-1,-1,-1,0,-1,1,0,-2,1,-1,1,0,-1,0,0,-1,0,-1,1,-1,0,1,-1,0,0,1,0,-1,0,1,0,1,0,1,0,buffer,0,-1,1,0,-1,-1,buffer,0.6,-0.2,-0.8,-0.2,0,-0.4,0,0.2,0.4,buffer,0,-0.666666667,-0.133333333,-0.2,0.2,buffer,1,0,1,1,0,1,0.8,0,0.2,0.4,0.8,0.6,0.2,0.2,1,0.6,0.8,1,0.4,0.8,0.4,0.4,0.6,0,buffer,grad_prof +255,R_382ydnyfyAJi5rP,25 - 31,Canadian,Male,Male,University - Graduate (Masters),29,01PfPsV,02FUT,5,01ITEM,0.5,0,1,2,3,3,2,2,1,2,1,2,3,1,3,2,1,1,3,3,2,3,2,1,1,-1,1,2,2,3,3,2,1,0,1,1,2,2,2,3,3,3,2,2,2,1,3,1,2,3,3,1,3,2,-1,3,0,2,3,2,0,2,3,2,2,3,3,2,1,-3,1,0,2,2,2,1,0,2,6,8,5,9,8,8,8,10,8,5,10,2,1,0,1,1,0,0,1,2,1,1,1,0,1,1,0,2,2,2,0,0,1,1,2,1,1,1,1,1,2,0,0,0,0,1,1,1,3,2,2,1,2,1,2,1,2,0,1,0,1,0,0,5,0,2,1,1,1,1,1,1,3,2,1,1,0,1,2,4,2,0,0,1,2,1,0,0,1,0,2,1,1,2,2,0,0,1,0,1,2,1,buffer,1,0,1,0,-1,-1,-2,0,-1,0,-1,-1,-1,0,-2,2,1,2,-1,0,1,-4,2,-1,0,0,0,0,1,-1,3,1,1,-1,-1,0,0,2,2,0,-1,1,1,-1,-1,buffer,-2,-2,-3,4,-2,6,buffer,0.2,-0.8,-1,0.8,-0.4,0,0.6,0.8,-0.2,buffer,-2.333333333,2.666666667,-0.533333333,0.133333333,0.4,buffer,3,0,3,3,0,6,0.6,1,0.6,1.2,1.2,1,0.4,1.8,1.6,0.4,1.6,1,1.4,1.8,0.8,0.8,1,1,buffer,grad_prof +256,R_3IQwm0e7K3VHmdn,25 - 31,Canadian,Male,Male,High School (or equivalent),27,02PsVPf,01PAST,10,02DGEN,0,0.666666667,0.333333333,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-2,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,3,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0.2,0,0,0.2,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0,0,0.2,0,0.2,0.2,0,0,0.2,0,0,0.2,0,0.2,0,0,0,0,buffer,HS_TS +257,R_6egVfurNHqEkWPh,46 - 52,Canadian,Female,Female,University - Undergraduate,48,03VPfPs,02FUT,5,02DGEN,-0.25,0,1,3,3,2,1,3,0,-2,3,-2,2,2,-1,3,-1,3,3,3,2,2,3,0,-2,2,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,1,2,1,1,1,2,2,2,2,2,2,2,0,0,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,buffer,-1,0,-1,-1,-1,0,buffer,0,0.2,0,0,0,0,0,0.2,0,buffer,-0.666666667,-0.666666667,0.066666667,0,0.066666667,buffer,0,1,1,0,0,0,0.2,0.4,0.6,0.2,0.2,0.6,0.2,0.2,0.6,0.2,0.2,0.6,0,0.2,0,0,0,0,buffer,C_Ug +258,R_7hSxzqk7lCP8pJi,25 - 31,Canadian,Female,Female,High School (or equivalent),31,03VPfPs,01PAST,5,01ITEM,0.375,0,1,2,2,3,1,2,-1,-2,2,-2,1,2,1,2,-2,3,2,2,2,1,2,-2,-2,2,-2,-1,3,1,2,-3,3,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-3,2,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-2,2,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,1,0,0,0,1,0,0,1,0,0,0,3,0,0,0,1,1,0,0,1,0,0,1,0,0,0,3,0,0,0,0,1,0,0,1,0,0,1,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,-1,1,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,buffer,0,0,0,0,0,0,buffer,0,-0.2,0.2,0,0,0.2,0,0.2,0.4,buffer,0,0,0,0.066666667,0.2,buffer,0,0,0,0,0,0,0.2,0.6,0.4,0.2,0.8,0.4,0.2,0.8,0.2,0.2,0.8,0.2,0,0.2,0.4,0,0,0,buffer,HS_TS +259,R_3C8j15a60QpZX8v,32 - 38,Canadian,Male,Male,University - Graduate (Masters),36,01PfPsV,01PAST,5,01ITEM,0.125,1,0,0,1,1,-1,-1,-2,1,2,1,1,1,2,2,1,2,0,1,2,0,0,-3,2,2,2,-1,2,2,2,2,2,-1,1,2,-1,-2,-3,2,2,1,0,2,2,2,2,2,0,1,0,0,0,-2,2,2,1,1,2,2,2,2,2,0,0,0,0,0,-2,2,2,0,0,2,2,2,2,2,6,6,2,5,5,4,6,6,2,5,5,2,0,0,1,1,1,1,1,0,1,2,1,0,0,1,0,1,0,1,0,1,1,1,0,0,1,1,0,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,1,1,0,0,1,0,1,0,0,1,2,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,1,2,0,0,0,0,0,1,-1,0,-1,0,1,0,0,-1,0,0,0,0,0,0,1,-1,0,1,2,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,2,buffer,0,0.8,0,-0.2,0,0,0.6,0,0,buffer,0,0.666666667,0.266666667,-0.066666667,0.2,buffer,1,1,2,1,1,0,0.6,1,0.4,0.6,0.6,0.4,0.6,0.2,0.4,0.8,0.6,0.4,0.8,0.4,0,0.2,0.4,0,buffer,grad_prof +260,R_51Pg3oAe4Cdwlpv,60 - 66,American,Male,Male,College Diploma/Certificate,66,01PfPsV,02FUT,10,02DGEN,-0.625,0,1,2,2,3,-2,1,-1,-2,2,1,-1,2,3,1,-2,2,3,3,3,-2,1,1,-1,2,0,-2,3,3,2,-2,2,3,3,3,-2,2,-2,-2,3,-1,-1,3,3,2,-2,2,3,2,3,-1,-1,-1,0,2,1,-3,3,3,2,-3,2,3,2,3,0,-1,-3,1,0,2,-3,3,3,0,-3,2,1,0,1,1,1,1,3,1,1,2,2,1,1,1,0,0,0,2,1,0,1,1,1,0,1,0,0,1,1,0,0,1,1,0,1,2,0,1,0,1,0,0,1,0,0,1,2,0,2,0,0,2,1,0,1,1,0,1,0,0,2,2,2,3,2,1,2,1,0,1,1,0,0,0,0,0,1,3,1,1,1,1,0,0,0,0,0,0,0,0,1,0,2,1,2,1,0,0,0,2,0,0,buffer,0,1,0,-1,-2,2,-1,0,1,-1,0,0,0,-1,0,0,1,0,-2,-1,-1,-3,-1,1,-2,0,0,0,-1,0,0,0,0,-1,1,1,0,-1,0,1,0,0,-2,0,0,buffer,-2,-1,0,-1,-1,0,buffer,-0.4,0.2,-0.2,-0.4,-1.2,-0.2,0,0.2,-0.4,buffer,-1,-0.666666667,-0.133333333,-0.6,-0.066666667,buffer,0,1,0,1,1,0,0.4,1,0.4,0.6,0.8,0.4,0.8,0.8,0.6,1,2,0.6,0.2,1.4,0,0.2,1.2,0.4,buffer,C_Ug +261,R_5Zh7jBkXAieStb3,25 - 31,Canadian,Female,Female,University - Undergraduate,31,02PsVPf,01PAST,5,02DGEN,-0.25,0,0.666666667,-1,2,1,0,2,2,0,1,-1,1,-2,-1,1,0,0,-2,2,1,0,2,2,0,1,-2,1,-2,-1,1,0,0,-2,2,1,-1,2,1,1,1,0,1,-1,0,2,1,0,-1,2,2,0,2,1,0,1,-1,2,-1,0,2,0,0,-2,2,2,0,2,1,0,1,0,2,-1,0,2,0,0,5,5,5,5,8,8,5,5,5,5,5,5,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,0,2,0,1,1,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,1,0,-1,0,0,-1,0,0,1,-1,-1,-1,-1,0,0,0,0,-1,1,0,0,1,0,0,-1,0,0,0,1,0,-1,0,0,1,0,1,1,0,1,0,1,1,1,1,0,buffer,0,0,0,0,3,3,buffer,0,-0.2,-0.6,0,0,0.2,0,0.6,0.8,buffer,0,2,-0.266666667,0.066666667,0.466666667,buffer,0,3,3,0,0,0,0.2,0.2,0,0.4,0.6,0.8,0.2,0.4,0.6,0.4,0.6,0.6,0.2,0.8,0.8,0.2,0.2,0,buffer,C_Ug +262,R_3IozwufNDFj4pPc,46 - 52,Canadian,Female,Female,High School (or equivalent),52,02PsVPf,01PAST,5,01ITEM,0.375,0,1,2,1,1,0,1,0,1,1,1,0,1,1,3,-1,1,1,0,-2,-2,1,0,1,-1,1,-1,1,1,1,0,1,1,1,-2,-2,1,0,0,0,0,0,1,0,0,1,2,0,0,0,0,0,2,-1,2,-3,2,3,3,3,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,10,5,10,5,10,5,10,10,5,5,5,1,1,3,2,0,0,0,2,0,1,0,0,2,1,0,1,0,3,2,0,0,1,1,1,0,0,1,3,2,1,2,1,1,0,1,2,2,1,4,2,2,2,0,1,2,2,1,1,0,1,0,1,1,1,0,1,1,3,1,1,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,2,1,2,3,2,3,3,3,2,3,buffer,-1,0,2,2,-1,-2,-2,1,-4,-1,-2,-2,2,0,-2,-1,-1,2,2,-1,0,0,0,0,0,-1,0,0,1,0,0,1,0,0,0,-2,0,-1,-2,-1,-3,-2,-2,-1,-2,buffer,1,0,-5,5,0,5,buffer,0.4,-1.6,-0.8,0.2,0,0,0.2,-1.2,-2,buffer,-1.333333333,3.333333333,-0.666666667,0.066666667,-1,buffer,4,5,5,0,5,5,1.4,0.6,0.6,1.2,0.6,1.4,1,2.2,1.4,1,0.6,1.4,0.2,0.8,0.8,0,2,2.8,buffer,HS_TS +263,R_5NPB7Uy8fbMa4Yg,32 - 38,American,Male,Male,College Diploma/Certificate,34,01PfPsV,02FUT,10,02DGEN,0.5,1,0,2,2,3,1,1,2,1,2,-1,1,2,2,2,0,2,2,3,3,2,3,0,1,2,-2,1,0,2,2,0,1,3,1,1,1,2,1,2,1,-2,2,1,0,1,-1,1,2,2,2,2,2,2,2,2,-2,1,1,2,2,0,1,2,2,2,2,2,1,2,1,2,1,1,1,2,0,1,5,5,5,5,5,5,5,5,5,5,5,5,0,1,0,1,2,2,0,0,1,0,2,0,0,0,1,1,1,2,0,1,1,1,1,1,1,1,2,1,1,1,0,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,1,1,1,1,1,1,3,0,1,1,0,0,1,1,2,2,1,1,1,1,1,0,1,1,2,1,1,0,0,0,0,0,0,1,0,1,4,0,0,1,0,0,0,buffer,0,1,-1,0,1,2,-1,0,0,0,1,0,0,0,0,1,1,1,-1,0,0,0,0,-2,1,0,1,1,1,0,1,2,2,1,1,0,1,0,-4,1,1,1,1,1,0,buffer,0,0,0,0,0,0,buffer,0.2,0.2,0.2,0.4,-0.2,0.6,1.4,-0.4,0.8,buffer,0,0,0.2,0.266666667,0.6,buffer,0,0,0,0,0,0,0.8,0.6,0.6,1,1,1.2,0.6,0.4,0.4,0.6,1.2,0.6,1.4,0.8,1,0,1.2,0.2,buffer,C_Ug +264,R_60AzsfZBb4s9ja1,39 - 45,American,Male,Male,College Diploma/Certificate,42,03VPfPs,02FUT,5,02DGEN,0.375,0.333333333,0.666666667,3,3,1,0,2,0,-3,2,-2,3,-1,0,3,-1,2,3,3,1,-1,-2,-1,-3,3,0,-1,0,0,2,-2,3,3,3,2,-1,-3,-2,-3,1,3,3,0,0,1,-1,2,3,3,0,-1,3,0,-3,3,-3,3,0,0,3,0,2,3,3,1,0,3,0,-3,3,-3,3,0,0,3,-2,3,3,2,3,4,1,5,3,0,1,4,1,0,0,0,0,1,4,1,0,1,2,4,1,0,1,1,1,0,0,1,1,5,2,0,1,5,0,1,0,2,0,0,0,0,1,1,1,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,2,3,4,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,2,1,buffer,0,0,-1,0,3,1,0,0,1,4,0,0,1,0,1,0,0,1,1,4,2,0,0,4,0,0,0,2,-1,-1,0,0,0,-1,1,1,0,2,3,4,0,0,1,-1,0,buffer,0,2,2,0,0,5,buffer,0.4,1.2,0.4,1.2,1.2,0,0,2,0,buffer,1.333333333,1.666666667,0.666666667,0.8,0.666666667,buffer,1,1,2,1,1,1,1,1.6,0.8,1.4,1.6,0.6,0.6,0.4,0.4,0.2,0.4,0.6,0.4,2,0.6,0.4,0,0.6,buffer,C_Ug +265,R_1Ksdo9ubjVLBHwZ,39 - 45,American,Female,Female,University - Graduate (Masters),45,01PfPsV,01PAST,10,01ITEM,0.625,0,1,-3,-3,-3,3,1,-3,3,-1,3,1,3,3,3,3,3,-3,3,-1,3,1,-3,3,-1,3,-3,3,3,3,3,3,1,3,1,3,-1,-3,3,-3,3,-3,3,3,3,1,3,0,-3,0,3,1,-3,3,0,3,-1,3,3,3,1,3,0,-3,0,3,3,-3,3,0,3,-1,3,3,3,3,3,5,5,5,6,6,8,5,5,5,6,5,6,0,6,2,0,0,0,0,0,0,4,0,0,0,0,0,4,6,4,0,2,0,0,2,0,4,0,0,0,2,0,3,0,3,0,0,0,0,1,0,2,0,0,0,2,0,3,0,3,0,2,0,0,1,0,2,0,0,0,0,0,4,0,2,0,2,0,0,2,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,buffer,-3,6,-1,0,0,0,0,-1,0,2,0,0,0,-2,0,1,6,1,0,0,0,0,1,0,2,0,0,0,2,0,4,0,2,0,0,0,0,2,0,0,0,0,0,0,0,buffer,0,0,0,0,1,2,buffer,0.4,0.2,-0.4,1.6,0.6,0.4,1.2,0.4,0,buffer,0,1,0.066666667,0.866666667,0.533333333,buffer,1,1,3,1,0,1,1.6,0.8,0,3.2,1.2,0.4,1.2,0.6,0.4,1.6,0.6,0,1.6,0.4,0.4,0.4,0,0.4,buffer,grad_prof +266,R_6pRqjE4HtLlUvSa,53 - 59,American,Male,Male,College Diploma/Certificate,55,03VPfPs,02FUT,10,01ITEM,0,0,1,-3,3,0,0,-3,-3,-3,3,-3,-3,3,3,3,3,3,-3,3,0,-3,-3,3,3,3,3,3,3,3,3,3,3,-3,3,0,-3,-3,-3,-3,-3,-3,-3,3,3,3,3,3,-3,3,0,3,-3,-3,3,3,-3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,6,6,0,6,6,0,0,0,0,0,0,0,0,3,0,0,0,6,0,0,0,0,0,0,0,0,0,0,3,0,0,6,0,0,0,0,0,0,0,0,6,0,3,3,6,6,6,0,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,6,0,3,0,6,6,0,0,6,6,0,0,0,0,0,buffer,0,0,0,0,0,6,0,0,6,6,0,0,0,0,0,-6,0,-3,0,-6,-6,-6,6,-6,-6,0,0,0,0,0,-6,0,-3,0,-6,0,6,6,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,3.6,0,-3,-3.6,0,-3,2.4,0,buffer,0,0,1.2,-2.2,-0.2,buffer,0,0,0,0,0,0,0.6,4.8,0,0.6,1.2,0,0.6,1.2,0,3.6,4.8,0,0,6,0,3,3.6,0,buffer,C_Ug +267,R_6V4h0VRF4DZeqOd,46 - 52,American,Female,Female,College Diploma/Certificate,52,01PfPsV,01PAST,10,01ITEM,0.125,0,1,2,3,1,0,2,2,-3,3,-3,1,3,2,2,0,3,2,3,2,0,2,3,-3,3,-3,2,3,2,3,0,3,2,3,2,0,2,3,-3,3,-3,1,3,2,2,0,3,2,3,2,0,2,3,-3,3,-3,2,3,3,3,0,3,2,3,2,0,2,3,-3,3,-3,2,3,3,3,0,3,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,buffer,0,0,0,0,0,0,buffer,0,0,-0.2,0,-0.2,-0.4,0,0.2,0.2,buffer,0,0,-0.066666667,-0.2,0.133333333,buffer,0,0,0,0,0,0,0.2,0.4,0.2,0.2,0.2,0,0.2,0.4,0.4,0.2,0.4,0.4,0,0.2,0.2,0,0,0,buffer,C_Ug +268,R_7XidMGEjVG8gDF8,53 - 59,American,Female,Female,College Diploma/Certificate,53,03VPfPs,01PAST,5,01ITEM,1,0,0.666666667,3,3,3,3,-3,2,-3,3,1,2,3,3,3,1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,9,9,8,9,7,9,9,7,9,9,8,9,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,0,buffer,0,2,-1,0,-1,0,buffer,0,0,0,0,0,0,0,0,-0.8,buffer,0.333333333,-0.333333333,0,0,-0.266666667,buffer,0,2,1,0,1,0,0,0.4,0.4,0,0.4,0.4,0,0.4,0.4,0,0.4,0.4,0,0,0,0,0,0.8,buffer,C_Ug +269,R_7TpMc3WtS8Bf0ko,53 - 59,American,Female,Female,University - Graduate (Masters),58,03VPfPs,02FUT,10,02DGEN,0.25,0,1,1,3,3,3,0,-2,-2,0,-1,1,2,0,1,0,3,1,3,3,2,0,-3,1,-1,2,-1,2,-2,-2,-1,3,0,3,3,2,0,-3,-2,-2,0,-1,2,-2,-2,-2,2,2,3,3,1,1,-2,-3,1,-2,1,3,2,2,0,3,2,3,3,0,1,-1,-3,2,-3,2,2,2,3,0,3,7,7,7,8,7,9,8,7,8,7,7,7,0,0,0,1,0,1,3,1,3,2,0,2,3,1,0,1,0,0,1,0,1,0,2,1,2,0,2,3,2,1,1,0,0,2,1,0,1,1,1,0,1,2,1,0,0,1,0,0,3,1,1,1,2,2,1,0,2,2,0,0,1,0,0,0,0,0,3,1,2,0,0,0,0,1,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,buffer,-1,0,0,-1,-1,1,2,0,2,2,-1,0,2,1,0,0,0,0,-2,-1,0,-1,0,-1,1,0,0,1,2,1,1,0,0,-1,0,-1,3,0,1,-1,-1,0,-1,1,1,buffer,-1,0,-1,1,0,2,buffer,-0.6,1.4,0.4,-0.6,-0.2,0.8,0,0.4,0,buffer,-0.666666667,1,0.4,1.85E-17,0.133333333,buffer,1,0,2,1,0,1,0.2,2,1.2,0.4,1.2,1.6,0.8,0.6,0.8,1,1.4,0.8,0.2,1.2,0.4,0.2,0.8,0.4,buffer,grad_prof +270,R_7GvxJqW6FHe0Pg1,25 - 31,American,Female,Female,University - Graduate (Masters),26,01PfPsV,01PAST,5,02DGEN,0.25,0,1,2,3,0,3,3,3,-3,2,-3,2,2,-3,2,-2,2,-1,3,2,3,-1,1,-3,2,1,-1,3,2,3,3,3,-2,3,3,3,2,1,-3,3,3,2,3,3,3,3,3,2,3,0,3,3,1,-3,3,-3,3,3,-3,3,3,3,0,3,3,3,3,1,-3,3,-3,3,3,-3,3,3,3,6,5,10,9,10,10,5,10,2,2,0,0,3,0,2,0,4,2,0,0,4,3,1,5,1,5,1,4,0,3,0,1,2,0,1,6,0,1,6,1,5,1,0,0,0,0,0,2,0,1,0,1,1,0,1,5,1,2,0,3,0,0,2,0,1,0,1,1,0,1,5,1,1,0,1,0,3,0,0,1,2,3,0,1,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,buffer,3,0,2,0,4,0,0,-1,4,2,0,5,0,0,0,2,0,0,0,1,0,0,0,6,-1,0,6,0,0,0,-1,0,-2,0,3,0,0,1,2,3,0,1,0,0,0,buffer,1,-5,8,7,10,10,buffer,1.8,1,1,0.6,1,1.2,0,1.2,0.2,buffer,1.333333333,9,1.266666667,0.933333333,0.466666667,buffer,3,5,0,3,10,2,1.8,1.8,2.6,1.6,1.8,2.8,0,0.8,1.6,1,0.8,1.6,1,1.2,0.2,1,0,0,buffer,grad_prof +271,R_12Us6HW6onCPXYR,39 - 45,American,Female,Female,College Diploma/Certificate,41,01PfPsV,02FUT,10,02DGEN,0.125,0,1,0,2,2,2,0,-1,-1,3,0,0,2,2,1,-2,3,1,2,2,2,1,0,0,3,0,0,2,2,2,2,2,0,2,2,2,0,0,0,3,1,0,3,3,3,1,3,1,2,1,2,1,0,0,3,0,1,3,1,1,0,3,1,2,1,2,1,0,0,3,0,1,3,3,3,0,3,4,3,3,2,3,4,2,2,2,2,2,2,1,0,0,0,1,1,1,0,0,0,0,0,1,4,1,0,0,0,0,0,1,1,0,1,0,1,1,2,3,0,1,0,1,0,1,1,1,0,0,1,1,1,0,2,0,1,0,1,0,1,1,1,0,0,1,1,1,2,2,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,buffer,0,0,-1,0,0,0,0,0,0,-1,-1,-1,1,2,1,-1,0,-1,0,-1,0,0,0,1,-1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,-1,-1,1,1,buffer,2,1,1,0,1,2,buffer,-0.2,-0.2,0.4,-0.6,0,0.2,0.4,0.2,0.2,buffer,1.333333333,1,0,-0.133333333,0.266666667,buffer,2,0,1,0,0,0,0.4,0.4,1.2,0,0.6,1.4,0.6,0.6,0.8,0.6,0.6,1.2,0.4,0.2,1,0,0,0.8,buffer,C_Ug +272,R_1qUMieiwMtmCwyW,46 - 52,American,Female,Female,College Diploma/Certificate,46,03VPfPs,01PAST,5,01ITEM,0,0,1,1,2,3,0,-2,0,1,2,2,-2,3,1,3,-2,3,1,2,3,0,-3,0,2,2,3,-2,3,0,2,-2,3,1,2,3,0,-3,0,3,2,3,-2,3,1,2,-3,3,2,2,3,0,-3,0,3,2,3,-2,3,0,2,-2,3,2,2,3,0,-3,0,3,2,3,-2,3,0,1,-2,3,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,2,0,1,0,0,0,1,1,0,1,0,0,0,1,0,2,0,1,0,0,1,1,0,0,1,0,0,0,1,0,2,0,1,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,buffer,-1,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,-1,-1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,-1,1,0,buffer,0,0,0,0,0,0,buffer,-0.2,-0.2,0,-0.2,0,-0.2,0,0.2,0.2,buffer,0,0,-0.133333333,-0.133333333,0.133333333,buffer,0,0,0,0,0,0,0.2,0.4,0.4,0.2,0.6,0.4,0.4,0.6,0.4,0.4,0.6,0.6,0,0.2,0.4,0,0,0.2,buffer,C_Ug +273,R_3OtEK72619AMU3n,18 - 24,Canadian,Female,Female,High School (or equivalent),20,03VPfPs,02FUT,5,02DGEN,1,0,1,1,3,2,3,3,-1,2,0,2,2,1,1,2,2,1,0,3,3,0,0,2,2,2,3,0,2,1,2,2,1,1,1,3,-1,0,-3,1,-2,2,-1,2,1,1,1,0,1,3,3,3,3,0,1,2,0,1,1,1,3,3,1,1,3,2,2,3,0,2,2,2,2,2,2,2,2,1,3,3,2,4,5,4,2,1,2,4,5,2,1,0,1,3,3,3,0,2,1,2,1,0,0,0,0,0,2,1,4,3,2,1,2,0,3,1,0,1,1,1,0,0,1,0,0,1,1,2,2,1,0,0,1,1,0,0,0,0,1,0,1,0,2,0,0,1,1,0,0,0,1,2,0,1,0,5,1,4,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,2,1,1,1,1,1,0,buffer,1,0,0,3,3,2,-1,0,-1,1,1,0,-1,-1,0,0,2,1,3,3,1,1,0,0,3,0,-1,1,1,1,1,2,-1,0,0,5,0,4,-1,0,-1,-1,0,0,1,buffer,1,2,0,0,0,2,buffer,1.4,0.2,-0.2,1.8,1,0.4,0.4,1.6,-0.2,buffer,1,0.666666667,0.466666667,1.066666667,0.6,buffer,1,2,2,2,4,0,1.6,1.6,0.2,2,1.6,0.8,0.2,1.4,0.4,0.2,0.6,0.4,0.8,2.4,0.6,0.4,0.8,0.8,buffer,HS_TS +274,R_7gQ3q59o1SLXtiF,32 - 38,American,Female,Female,College Diploma/Certificate,38,02PsVPf,01PAST,10,01ITEM,0.375,0,1,2,2,1,1,3,2,-3,3,-2,3,1,0,3,1,3,2,3,1,1,1,1,0,2,0,1,1,1,1,1,1,2,3,2,2,0,0,0,1,1,1,1,1,1,1,1,3,3,1,2,3,3,-3,3,-3,3,2,2,2,3,3,3,3,1,1,3,2,-3,3,-3,3,1,1,3,2,3,4,5,4,5,5,6,4,8,4,5,6,4,0,1,0,0,2,1,3,1,2,2,0,1,2,0,2,0,1,1,1,3,2,3,2,3,2,0,1,2,0,2,1,1,0,1,0,1,0,0,1,0,1,2,1,2,0,1,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,1,0,buffer,-1,0,0,-1,2,0,3,1,1,2,-1,-1,1,-2,2,-1,0,1,1,3,2,3,2,2,2,0,0,2,-1,2,0,0,1,0,1,0,0,1,1,0,-1,-1,-1,-1,0,buffer,0,-3,0,0,-1,2,buffer,0,1.4,-0.2,0.8,2.2,0.6,0.4,0.4,-0.8,buffer,-1,0.333333333,0.4,1.2,0,buffer,1,0,2,1,2,0,0.6,1.8,1,1.2,2.4,1,0.6,0.4,1.2,0.4,0.2,0.4,0.6,0.6,0,0.2,0.2,0.8,buffer,C_Ug +275,R_1gUk1SxUcNEGdq1,53 - 59,American,Female,Female,College Diploma/Certificate,55,02PsVPf,01PAST,10,02DGEN,-0.5,0,1,3,2,3,-2,3,-1,1,1,2,1,2,2,2,-3,2,2,2,2,-3,2,2,2,2,2,2,2,2,2,0,2,3,3,3,-3,3,-1,1,1,1,1,0,1,0,-1,0,2,2,3,-3,3,2,0,2,0,2,2,2,2,0,2,3,3,3,-3,3,2,0,2,0,2,2,2,2,0,2,2,1,2,3,2,3,2,2,2,2,2,2,1,0,1,1,1,3,1,1,0,1,0,0,0,3,0,0,1,0,1,0,0,0,0,1,0,2,1,2,2,2,1,0,0,1,0,3,1,1,2,1,0,0,0,3,0,0,1,0,1,0,3,1,1,2,1,0,0,0,3,0,1,1,1,0,1,3,1,1,1,1,2,1,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,1,0,1,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,-3,-1,-1,-1,-1,2,1,2,-1,2,0,0,1,0,1,3,1,1,1,1,2,1,2,1,2,buffer,0,-1,0,1,0,1,buffer,0.4,-0.4,0,0,-1.4,1.2,0.4,1.4,1.6,buffer,-0.333333333,0.666666667,0,-0.066666667,1.133333333,buffer,1,1,1,0,0,0,0.8,1.2,0.6,0.4,0.2,1.8,0.4,1.6,0.6,0.4,1.6,0.6,0.8,1.4,1.6,0.4,0,0,buffer,C_Ug +276,R_2NV4QOALvC2Xyd8,18 - 24,Canadian,Male,Male,College Diploma/Certificate,23,02PsVPf,02FUT,10,01ITEM,0.625,0,0,2,3,-2,0,3,1,0,2,-2,3,1,-3,3,1,-2,0,1,0,-1,3,-2,3,-1,1,1,2,3,-1,-1,-3,3,2,0,1,-2,-3,-2,0,3,3,-1,0,-3,3,2,2,3,-2,-1,2,3,-3,-2,2,-1,3,-1,0,-1,1,2,3,-3,-1,-1,3,-2,-3,2,1,3,2,-2,2,-1,9,4,4,7,8,6,3,3,9,1,5,10,2,2,2,1,0,3,3,3,3,2,1,6,4,2,1,1,1,2,1,5,4,2,2,5,0,2,3,6,2,4,0,0,0,1,1,2,3,4,4,4,2,2,3,2,3,0,0,1,1,4,2,2,5,4,2,2,5,5,1,1,3,1,0,2,5,1,5,1,2,2,3,3,2,4,5,0,0,1,0,3,0,1,1,0,2,0,3,2,3,2,buffer,2,2,2,0,-1,1,0,-1,-1,-2,-1,4,1,0,-2,1,1,1,0,1,2,0,-3,1,-2,0,-2,1,1,3,3,1,-1,2,2,1,4,0,2,0,3,0,0,1,3,buffer,6,1,-5,6,3,-4,buffer,1,-0.6,0.4,0.8,-0.4,0.6,1.4,1.4,1.4,buffer,0.666666667,1.666666667,0.266666667,0.333333333,1.4,buffer,2,4,2,2,2,1,1.4,2.8,2.8,2,2.6,3.4,0.4,3.4,2.4,1.2,3,2.8,2.2,2.2,3.4,0.8,0.8,2,buffer,C_Ug +277,R_5RCGbq3fkqc6VZn,32 - 38,American,Male,Male,High School (or equivalent),37,03VPfPs,01PAST,5,01ITEM,0,0,1,2,3,3,1,1,1,-1,3,-1,2,3,0,3,0,2,2,3,3,1,0,0,-1,3,-1,3,2,0,3,0,2,1,3,3,1,0,1,-1,3,-1,2,3,0,3,0,2,1,2,3,1,0,1,-2,2,-1,2,3,0,3,0,3,1,3,3,1,0,1,-1,2,-1,1,3,0,3,0,2,1,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,buffer,-1,-1,0,0,0,1,-1,-1,0,1,1,0,0,0,-1,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,1,-1,0,0,0,1,-1,0,0,0,1,0,0,0,-1,buffer,1,1,1,1,1,1,buffer,-0.4,0,0,0,-0.4,0,0,0,0,buffer,1,1,-0.133333333,-0.133333333,0,buffer,0,1,0,0,1,0,0.2,0.4,0.2,0.4,0,0,0.6,0.4,0.2,0.4,0.4,0,0.2,0.4,0.2,0.2,0.4,0.2,buffer,HS_TS +278,R_59mXsNJdpdeH8Ah,60 - 66,American,Male,Male,University - Undergraduate,66,01PfPsV,01PAST,5,02DGEN,-0.125,1,0,2,2,1,1,-1,-3,-1,1,-1,1,2,1,2,1,1,2,2,1,0,-1,-3,-1,1,-1,2,2,2,2,1,0,2,2,1,0,0,-3,-1,1,-1,2,2,2,2,1,1,2,1,1,1,0,-3,0,0,0,1,2,1,2,0,0,1,1,0,0,0,-3,0,0,0,0,2,1,2,0,0,2,2,2,4,4,2,4,2,1,3,3,2,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,buffer,0,-1,0,1,-1,0,-1,-1,-1,1,0,1,0,-1,0,-1,-1,-1,0,0,0,-1,-1,-1,0,0,1,0,-1,-1,-1,0,-1,-1,1,0,0,0,0,-1,0,0,0,0,1,buffer,-2,0,1,1,1,0,buffer,-0.2,-0.4,0,-0.6,-0.6,-0.2,-0.4,-0.2,0.2,buffer,-0.333333333,0.666666667,-0.2,-0.466666667,-0.133333333,buffer,2,2,0,1,1,1,0.2,0.2,0.4,0.4,0.2,0.2,0.4,0.6,0.4,1,0.8,0.4,0.2,0,0.2,0.6,0.2,0,buffer,C_Ug +279,R_3zzN8Ps2vISvFsM,46 - 52,American,Female,Female,High School (or equivalent),48,03VPfPs,02FUT,5,01ITEM,-0.875,0,1,3,2,3,3,-3,-3,1,0,2,1,3,2,3,1,3,3,2,3,3,-3,-3,1,1,2,0,3,2,2,-1,3,3,2,3,3,-3,-3,1,1,2,1,3,2,0,0,3,3,2,3,3,-3,-3,0,1,0,1,3,2,2,0,3,3,2,3,3,-3,-3,0,2,0,1,3,2,2,-1,3,0,1,0,0,0,1,0,5,0,0,5,0,0,0,0,0,0,0,0,1,0,1,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,3,1,0,0,0,0,0,0,0,1,1,2,0,0,0,1,1,0,0,0,0,0,0,0,1,2,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,-1,0,-2,1,0,0,0,1,0,0,0,0,0,0,0,-1,-1,-2,0,0,0,2,-1,0,0,0,0,0,0,0,0,-1,0,1,0,0,2,0,0,buffer,0,-4,0,0,-5,1,buffer,0,-0.4,0.2,0,-0.8,0.2,0,0,0.4,buffer,-1.333333333,-1.333333333,-0.066666667,-0.2,0.133333333,buffer,0,1,1,0,0,0,0,0.4,0.6,0,0.2,0.8,0,0.8,0.4,0,1,0.6,0,0.2,0.6,0,0.2,0.2,buffer,HS_TS +280,R_7jdZy6AICnrVoeF,53 - 59,American,Female,Female,University - Undergraduate,56,01PfPsV,02FUT,10,01ITEM,0,0.666666667,0.333333333,-1,1,2,3,-1,1,-1,2,-1,-2,3,1,3,-3,3,-1,1,2,2,1,1,1,2,1,1,2,1,2,1,2,-2,1,2,1,2,1,2,1,2,1,1,1,1,-1,2,1,1,2,3,-1,-1,-1,2,-1,-2,3,2,2,-3,3,-2,1,2,3,-2,-1,-2,2,-1,-2,3,2,2,-3,3,2,4,5,4,7,7,0,2,1,2,3,1,0,0,0,1,2,0,2,0,2,3,1,0,1,4,1,1,0,0,2,3,0,3,1,3,3,2,0,2,2,1,2,0,0,0,0,2,0,0,0,0,0,1,1,0,0,1,0,0,0,1,2,1,0,0,0,0,1,1,0,0,1,0,0,1,1,0,1,1,1,0,1,0,1,2,0,3,0,0,0,1,0,1,0,0,0,0,0,0,0,0,buffer,-2,0,0,1,2,-2,2,0,2,3,1,-1,0,4,1,0,0,0,2,2,-2,2,1,3,3,2,-1,1,2,1,-2,0,0,1,0,0,0,1,1,0,1,0,1,2,0,buffer,2,2,4,2,4,6,buffer,0.2,1,1,0.8,1.4,1,-0.2,0.4,0.8,buffer,2.666666667,4,0.733333333,1.066666667,0.333333333,buffer,2,3,2,2,1,0,0.6,1.4,1.4,1.2,2,1.4,0.4,0.4,0.4,0.4,0.6,0.4,0.6,0.6,0.8,0.8,0.2,0,buffer,C_Ug +281,R_6Hisc5dHpCD03ip,53 - 59,American,Female,Female,High School (or equivalent),59,03VPfPs,01PAST,10,02DGEN,0,0.333333333,0.666666667,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,6,6,6,5,6,5,5,6,5,6,7,7,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,buffer,0,1,0,1,1,0,0,0,0,-1,0,-1,-1,0,0,0,1,0,1,1,0,0,1,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,buffer,1,0,1,-1,-1,-2,buffer,0.6,-0.2,-0.4,0.6,0,-0.2,0,-0.2,-0.2,buffer,0.666666667,-1.333333333,-1.85E-17,0.133333333,-0.133333333,buffer,1,0,1,1,1,2,0.6,0.2,0,0.6,0.2,0,0,0.4,0.4,0,0.2,0.2,0,0,0,0,0.2,0.2,buffer,HS_TS +282,R_66mQgvLpNsSvriu,18 - 24,American,Female,Female,High School (or equivalent),18,02PsVPf,02FUT,5,01ITEM,0,0,1,-2,3,1,-1,-2,-2,-2,1,3,-2,3,-2,2,1,2,-2,2,2,-2,-3,0,1,1,3,-2,2,-2,-2,3,2,-3,0,2,-2,-3,-3,1,-3,3,-3,2,-2,-2,0,2,0,3,1,0,0,0,-2,1,0,0,2,-2,2,0,2,0,3,1,1,0,0,-2,1,0,0,2,-2,2,0,2,4,5,4,4,6,7,3,6,3,3,4,4,0,1,1,1,1,2,3,0,0,0,1,0,4,2,0,1,3,1,1,1,1,3,4,0,1,1,0,4,1,0,2,0,0,1,2,2,0,0,3,2,1,0,0,1,0,2,0,0,2,2,2,0,0,3,2,1,0,0,1,0,1,2,0,0,0,3,0,4,0,1,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,-2,1,1,0,-1,0,3,0,-3,-2,0,0,4,1,0,-1,3,1,-1,-1,-1,3,4,-3,-1,0,0,4,0,0,1,2,0,-1,0,3,0,4,0,1,0,0,0,3,0,buffer,1,-1,1,1,2,3,buffer,-0.2,-0.4,1,0.2,0.4,0.8,0.4,1.6,0.6,buffer,0.333333333,2,0.133333333,0.466666667,0.866666667,buffer,0,1,3,0,2,1,0.8,1,1.4,1.4,1.8,1.2,1,1.4,0.4,1.2,1.4,0.4,0.6,1.6,0.6,0.2,0,0,buffer,HS_TS +283,R_5cY2ZT0ANnNZl73,32 - 38,American,Female,Female,College Diploma/Certificate,36,01PfPsV,02FUT,10,01ITEM,0.125,0,1,2,3,3,3,0,-3,1,-3,2,0,1,-1,3,-3,1,1,3,3,3,-2,-1,-1,-1,1,-1,3,2,1,0,3,2,3,3,3,-2,0,0,-2,3,0,3,2,2,0,3,2,3,3,3,0,0,0,1,1,0,3,3,3,0,3,2,3,0,3,0,0,0,1,0,0,3,3,2,0,3,3,5,2,1,3,2,4,2,1,3,2,5,1,0,0,0,2,2,2,2,1,1,2,3,2,3,2,0,0,0,0,2,3,1,1,1,0,2,3,1,3,2,0,0,0,0,0,3,1,4,1,0,2,4,0,3,2,0,0,3,0,0,3,1,4,2,0,2,4,1,3,2,1,0,0,0,0,1,1,1,2,1,0,0,1,0,0,0,0,3,0,0,0,0,0,1,0,0,0,1,0,0,buffer,1,0,0,0,2,-1,1,-2,0,1,0,-1,2,0,0,0,0,-3,0,2,0,0,-3,-1,0,0,-1,0,0,0,1,0,-3,0,0,1,1,1,1,1,0,0,0,0,0,buffer,-1,3,1,-2,1,-3,buffer,0.6,-0.2,0.2,-0.2,-0.8,-0.2,-0.4,1,0,buffer,1,-1.333333333,0.2,-0.4,0.2,buffer,2,2,0,1,0,4,0.6,1.6,2.4,0.4,1.2,2.2,0,1.8,2.2,0.6,2,2.4,0.2,1.2,0.2,0.6,0.2,0.2,buffer,C_Ug +284,R_7YXiACpJdxqUAoq,32 - 38,American,Female,Female,High School (or equivalent),33,03VPfPs,01PAST,5,02DGEN,-0.25,0,1,3,3,1,3,1,-3,-3,-3,3,-3,-3,3,3,-3,0,3,3,3,3,3,3,3,-3,3,-3,-3,3,3,-3,-3,1,3,3,3,-3,-3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,-3,-3,3,3,-3,-3,3,3,3,3,3,-3,-3,-3,3,-3,-3,3,3,-3,-3,5,7,3,10,1,5,5,4,4,1,1,1,0,0,2,0,2,6,6,0,0,0,0,0,0,0,3,2,0,2,0,4,0,6,0,0,0,6,0,6,6,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,3,2,0,0,0,6,6,0,0,0,0,6,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,2,0,0,0,2,0,6,0,0,0,6,0,6,6,0,2,0,0,0,6,6,0,0,0,0,6,0,6,6,0,buffer,0,3,-1,9,0,4,buffer,0,2.4,0,0.8,1.2,3.6,1.6,1.2,3.6,buffer,0.666666667,4.333333333,0.8,1.866666667,2.133333333,buffer,5,6,2,4,3,3,0.8,2.4,0.6,1.6,1.2,4.2,0.8,0,0.6,0.8,0,0.6,1.6,1.2,3.6,0,0,0,buffer,HS_TS +285,R_7eM3OcVZcERSnNb,25 - 31,American,Male,Male,College Diploma/Certificate,27,02PsVPf,02FUT,10,02DGEN,1,1,0,2,2,2,2,2,2,0,1,1,2,1,1,2,2,2,3,3,3,3,3,3,0,1,0,3,1,1,3,2,3,3,3,3,3,3,3,0,2,0,3,3,1,3,3,3,3,3,3,3,3,3,0,1,0,3,2,3,3,2,3,3,3,3,3,3,3,0,2,0,3,1,1,3,3,3,0,0,0,0,0,0,0,0,0,0,7,6,1,1,1,1,1,1,0,0,1,1,0,0,1,0,1,1,1,1,1,1,1,0,1,1,1,2,0,1,1,1,1,1,1,1,1,1,0,0,1,1,1,2,1,0,1,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,2,0,1,0,buffer,0,0,0,0,0,0,0,0,0,0,-1,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-2,0,0,0,buffer,0,0,0,0,-7,-6,buffer,0,0,-0.6,0,0,0.4,0,0,-0.2,buffer,0,-4.333333333,-0.2,0.133333333,-0.066666667,buffer,0,0,0,0,7,6,1,0.6,0.4,1,0.8,1,1,0.6,1,1,0.8,0.6,0,0.2,0.6,0,0.2,0.8,buffer,C_Ug +286,R_7dnoQWUMsadGrOp,60 - 66,American,Male,Male,College Diploma/Certificate,60,03VPfPs,01PAST,5,01ITEM,0.25,0.666666667,0.333333333,-3,-1,-1,-3,2,-3,0,2,-3,1,2,3,1,1,3,-3,-2,1,-3,2,-3,-2,-1,-2,-2,2,3,2,-1,1,-2,-1,-1,-1,-2,-2,-2,-1,-2,2,-1,-2,-2,-2,-2,-1,1,-1,-3,-1,-1,0,-1,-1,0,-2,-1,-2,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,2,2,2,1,5,3,10,10,10,0,1,2,0,0,0,2,3,1,3,0,0,1,2,2,1,0,0,2,4,1,2,3,1,1,3,5,3,3,5,2,2,0,0,3,2,0,3,2,1,4,4,3,3,4,3,1,1,3,2,3,0,2,3,1,2,3,1,1,3,1,1,2,2,4,1,0,0,0,4,3,5,4,1,3,1,1,1,3,1,1,0,1,1,0,2,1,2,2,1,buffer,-2,-1,2,0,-3,-2,2,0,-1,2,-4,-4,-2,-1,-2,-2,-1,-1,-1,2,-2,2,1,-2,0,1,2,2,2,2,0,0,1,-1,3,0,0,-1,-1,4,1,4,2,-1,2,buffer,1,-4,-3,-8,-8,-8,buffer,-0.8,0.2,-2.6,-0.6,-0.2,1.8,0.6,0.4,1.6,buffer,-2,-8,-1.066666667,0.333333333,0.866666667,buffer,0,1,2,9,5,7,0.6,1.8,1,1.4,1.6,3.8,1.4,1.6,3.6,2,1.8,2,2,1,3.2,1.4,0.6,1.6,buffer,C_Ug +287,R_3IWAKxaAqfStSLY,18 - 24,Canadian,Male,Male,University - Graduate (Masters),20,02PsVPf,01PAST,10,02DGEN,0.875,0.666666667,0.333333333,2,3,3,1,3,2,-1,2,3,3,3,2,3,2,2,0,3,3,3,1,1,1,0,1,1,0,1,0,2,-1,-2,1,3,3,-2,2,3,-2,1,-1,2,1,-2,1,1,2,2,0,-2,3,3,-2,2,-3,2,2,1,2,3,1,3,2,0,-1,3,2,-3,3,-3,3,2,3,3,1,3,3,4,4,9,8,3,7,6,7,7,4,7,2,0,0,2,2,1,2,2,2,2,3,1,3,0,3,4,2,0,2,5,0,4,4,2,4,1,1,5,1,1,0,1,3,3,0,1,1,0,6,1,1,1,1,1,1,1,1,3,2,0,0,2,1,6,0,1,1,0,1,1,2,2,0,0,3,1,2,2,0,2,2,0,2,1,2,1,0,0,1,0,1,1,1,0,1,0,2,1,2,2,buffer,2,-1,-3,-1,2,0,1,2,-4,1,2,0,2,-1,2,3,1,-3,0,5,0,2,3,-4,4,0,0,5,0,0,1,2,0,-1,3,0,1,1,0,1,2,-2,1,-1,0,buffer,-4,-2,-3,2,4,-4,buffer,-0.2,0,1,1.2,1,1,1,0.6,0,buffer,-3,0.666666667,0.266666667,1.066666667,0.533333333,buffer,6,4,1,0,2,0,1.2,1.8,2,2.6,2.8,1.8,1.4,1.8,1,1.4,1.8,0.8,1.4,1.4,1.4,0.4,0.8,1.4,buffer,grad_prof +288,R_3mGqhGhkFRf9EM9,53 - 59,American,Female,Female,College Diploma/Certificate,56,03VPfPs,01PAST,5,02DGEN,0.25,0.666666667,0.333333333,2,3,1,-1,2,0,-3,3,1,2,1,0,2,1,3,2,3,1,-3,2,0,-3,3,1,2,2,1,2,2,3,2,3,2,-3,2,-2,-2,3,1,-1,1,1,1,3,3,2,3,1,-1,3,0,-3,3,-1,2,1,1,3,0,3,2,3,2,0,3,-1,-3,3,-1,2,1,1,3,-1,3,3,1,3,4,3,4,2,2,2,2,2,2,0,0,0,2,0,0,0,0,0,0,1,1,0,1,0,0,0,1,2,0,2,1,0,0,3,0,1,1,2,0,0,0,0,0,1,0,0,0,2,0,0,1,1,1,0,0,0,1,1,1,1,0,0,2,0,0,1,1,2,0,0,0,1,0,0,2,1,0,0,3,1,0,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,2,-1,0,0,0,-2,0,1,0,-1,0,0,0,0,0,1,-1,1,1,0,-2,3,0,0,0,0,0,0,0,0,-1,0,1,1,0,0,3,1,0,1,0,0,buffer,1,-1,1,2,1,2,buffer,0.2,-0.4,0,0,0.6,0,-0.2,1,0.4,buffer,0.333333333,1.666666667,-0.066666667,0.2,0.4,buffer,1,2,1,0,0,0,0.4,0,0.6,0.6,1.2,0.8,0.2,0.4,0.6,0.6,0.6,0.8,0.2,1.2,0.6,0.4,0.2,0.2,buffer,C_Ug +289,R_1vdKXuobkkmrUjW,32 - 38,American,Female,Female,College Diploma/Certificate,37,02PsVPf,02FUT,5,01ITEM,-0.625,0,1,3,3,3,3,3,-3,1,1,3,0,1,2,1,0,2,3,3,3,3,3,-3,-1,1,0,0,1,1,1,1,1,3,3,3,3,3,-3,1,2,1,0,2,2,2,2,2,3,3,3,3,3,-3,0,3,0,1,2,2,2,0,2,2,2,2,2,2,-3,0,2,-1,0,1,3,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,0,0,1,0,1,1,0,0,0,0,0,0,0,1,2,0,1,0,1,2,0,0,0,0,0,0,0,1,2,3,1,1,0,1,0,0,1,1,1,1,1,0,1,1,4,0,0,1,0,1,0,0,0,0,0,0,0,2,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,buffer,0,0,0,0,0,0,1,-2,0,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,0,-1,0,-2,0,1,-1,1,1,0,-1,-1,-1,-1,-1,0,2,0,0,-1,0,0,0,0,1,buffer,0,0,0,0,0,0,buffer,0,-0.4,0.2,-1,-0.6,0.4,-1,0.2,0.2,buffer,0,0,-0.066666667,-0.4,-0.2,buffer,0,0,0,0,0,0,0,1,0.6,0,0.6,0.8,0,1.4,0.4,1,1.2,0.4,0,0.8,1,1,0.6,0.8,buffer,C_Ug +290,R_7WBbf2o6ODdSaGn,53 - 59,American,Female,Female,High School (or equivalent),55,03VPfPs,01PAST,5,02DGEN,-0.125,0,0.333333333,1,2,2,2,1,0,0,1,0,0,2,1,2,1,2,2,2,2,2,1,0,0,1,0,0,2,2,2,1,2,2,2,2,2,1,0,1,2,0,1,2,2,2,1,2,2,2,2,2,1,1,1,2,0,1,2,2,2,1,2,2,2,2,2,1,0,1,2,0,1,2,2,2,1,2,4,4,5,4,4,4,4,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-1,-1,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,1,0,1,0,0,0,0,0,buffer,0,0,1,0,0,0,buffer,0,-0.8,0,0,0,0,0,0.4,0,buffer,0.333333333,0,-0.266666667,0,0.133333333,buffer,0,0,1,0,0,0,0.2,0,0.2,0.2,0.6,0.2,0.2,0.8,0.2,0.2,0.6,0.2,0,0.6,0,0,0.2,0,buffer,HS_TS +291,R_3NzeTBICrvLndPX,39 - 45,American,Female,Female,University - Graduate (Masters),45,02PsVPf,02FUT,5,01ITEM,0.25,0,1,1,3,2,-1,3,2,-1,1,1,2,1,-1,3,1,3,-1,2,2,1,-1,1,1,0,1,1,1,-2,2,1,3,2,2,-1,0,3,2,1,2,1,3,2,0,2,1,3,1,3,3,0,3,1,-1,1,0,1,1,-1,3,0,3,2,3,3,0,3,2,0,1,1,1,1,-1,3,-1,3,6,5,2,7,7,6,6,5,5,2,4,2,2,1,0,2,4,1,2,1,0,1,0,1,1,0,0,1,1,3,1,0,0,2,1,0,1,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0,1,1,0,0,1,0,0,1,0,0,0,2,0,3,0,3,1,4,1,0,2,0,2,1,2,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,0,buffer,2,1,-1,1,4,0,2,1,-1,0,0,1,1,-1,0,0,1,2,0,0,0,1,1,0,0,1,1,1,-2,0,2,0,3,1,4,0,-1,2,-1,2,1,2,0,-1,0,buffer,0,0,-3,5,3,4,buffer,1.4,0.4,0.2,0.6,0.4,0.2,2,0.4,0.4,buffer,-1,4,0.666666667,0.4,0.933333333,buffer,1,2,4,4,1,3,1.8,1,0.4,1.2,0.8,0.6,0.4,0.6,0.2,0.6,0.4,0.4,2.2,1,0.6,0.2,0.6,0.2,buffer,grad_prof +292,R_1rxnoxX4FhPFEbz,53 - 59,American,Male,Male,Trade School (non-military),57,03VPfPs,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,2,1,2,1,-2,-2,-2,2,1,2,2,-1,3,-2,2,2,2,3,1,-2,-2,-2,2,2,1,2,2,2,-2,3,2,2,2,1,-2,-2,-2,2,2,1,2,2,2,-2,2,2,2,2,2,-1,2,-3,2,1,2,1,-1,2,-2,3,2,-1,2,2,-2,-2,-2,2,2,2,-1,-1,3,-2,2,1,1,6,2,2,7,1,2,1,1,1,1,0,1,1,0,0,0,0,0,1,1,0,3,1,0,1,0,1,0,0,0,0,0,0,1,1,0,3,1,0,0,0,1,0,1,1,4,1,0,0,0,1,0,1,0,1,0,2,0,1,0,0,0,0,1,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,3,0,0,1,4,1,0,1,0,2,0,1,0,1,buffer,0,0,1,-1,-1,-4,-1,0,1,1,-1,3,0,0,0,0,-1,0,-1,0,0,0,0,0,1,-3,3,1,0,0,0,-3,1,0,-1,-4,-1,0,-1,0,-2,0,-1,0,0,buffer,0,-1,5,1,1,6,buffer,-0.2,-0.6,0.4,-0.4,0.2,0.2,-0.6,-1.2,-0.6,buffer,1.333333333,2.666666667,-0.133333333,0,-0.8,buffer,1,1,1,0,1,0,0.4,0.4,1,0.2,0.4,0.8,0.6,1,0.6,0.6,0.2,0.6,0.2,0,0.2,0.8,1.2,0.8,buffer,HS_TS +293,R_3fqxXMhwmdAk8GS,46 - 52,American,Male,Male,High School (or equivalent),49,02PsVPf,02FUT,10,02DGEN,1,0,0.666666667,2,2,2,2,2,0,1,2,2,2,-2,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,1,1,1,2,-1,1,2,2,1,8,8,8,8,8,8,8,8,9,9,7,8,0,0,0,0,0,2,1,0,0,0,4,4,0,0,0,0,0,0,0,0,2,1,0,0,0,4,4,0,0,0,0,0,0,0,0,2,1,0,0,0,4,4,0,0,0,0,0,0,0,0,1,0,1,1,0,1,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,1,1,0,3,1,0,0,1,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,-1,-1,0,3,1,0,0,-1,0,0,0,0,0,-3,-1,-1,-1,0,-3,-1,0,0,-1,buffer,0,0,-1,-1,1,0,buffer,0,0,0,0,0,0.6,0,-1.2,-1,buffer,-0.333333333,0,0,0.2,-0.733333333,buffer,0,0,0,1,1,1,0,0.6,1.6,0,0.6,1.6,0,0.6,1.6,0,0.6,1,0,0,0,0,1.2,1,buffer,HS_TS +294,R_7TWNJXUYqK0M8Wq,32 - 38,American,Male,Male,High School (or equivalent),36,01PfPsV,01PAST,10,02DGEN,0,0,1,3,2,3,2,3,-2,1,2,1,-1,2,2,1,0,2,3,3,3,3,3,-1,0,-1,0,1,3,1,-2,-2,2,3,3,3,3,3,-1,3,1,1,-1,2,0,-1,2,0,-1,-3,-2,-3,-2,0,-1,0,-1,-2,2,-3,2,-1,3,3,3,3,3,3,1,-1,0,1,-1,0,3,1,-2,-2,3,2,3,3,1,3,3,3,3,3,3,3,0,1,0,1,0,1,1,3,1,2,1,1,3,2,0,0,1,0,1,0,1,2,1,0,0,0,2,2,2,2,4,5,5,5,5,2,2,2,2,1,0,5,1,1,1,0,1,0,1,0,3,2,2,0,0,2,1,0,2,4,0,0,0,0,0,0,3,2,1,2,1,1,1,4,2,4,6,5,6,5,1,0,0,2,1,2,6,1,1,5,buffer,-4,-4,-5,-4,-5,-1,-1,1,-1,1,1,-4,2,1,-1,0,0,0,0,0,-2,0,-1,0,0,-2,1,2,0,-2,-4,-6,-5,-6,-5,-1,3,2,-1,1,-1,-5,0,3,-3,buffer,0,-1,0,0,-2,0,buffer,-4.4,-0.2,-0.2,0,-0.6,-0.2,-5.2,0.8,-1.2,buffer,-0.333333333,-0.666666667,-1.6,-0.266666667,-1.866666667,buffer,0,1,0,0,0,0,0.4,1.6,1.4,0.4,0.8,1.6,4.8,1.8,1.6,0.4,1.4,1.8,0,1.6,1.8,5.2,0.8,3,buffer,HS_TS +295,R_6VZiNTcZWCVvp9D,53 - 59,American,Male,Male,College Diploma/Certificate,58,02PsVPf,01PAST,10,01ITEM,0.125,0,1,1,2,2,2,2,-1,-2,2,-2,2,2,2,2,-3,2,1,2,2,2,2,-1,-1,2,-1,2,2,2,2,-3,2,1,2,2,2,2,-2,-2,2,-2,2,2,2,2,-3,2,1,2,2,2,2,1,-3,2,-3,2,2,2,2,-3,2,1,2,2,2,2,1,-3,2,-3,2,2,2,2,-3,2,1,5,1,1,6,2,1,2,0,0,2,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,buffer,0,3,1,1,4,1,buffer,0,-0.4,0,0,-0.6,0,0,0.6,0,buffer,1.333333333,2,-0.133333333,-0.2,0.2,buffer,0,1,1,1,0,1,0,0.4,0,0,0.2,0,0,0.8,0,0,0.8,0,0,0.6,0,0,0,0,buffer,C_Ug +296,R_3gUVHPExnQqppYd,53 - 59,American,Female,Female,High School (or equivalent),57,03VPfPs,02FUT,5,02DGEN,-2,0.333333333,0.333333333,3,3,3,3,3,-3,-3,1,-3,1,3,3,3,-3,3,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,3,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2,0,4,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,0,0,0,0,1,0,0,0,0,0,0,0,2,0,4,0,0,0,0,1,0,0,0,0,0,0,0,2,0,4,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,buffer,0,0,-5,0,0,0,buffer,0,0,-0.2,0,0,0,0,0,0.2,buffer,-1.666666667,0,-0.066666667,0,0.066666667,buffer,0,0,0,0,0,5,0,1.2,0,0,1.2,0.2,0,1.2,0.2,0,1.2,0.2,0,0,0.2,0,0,0,buffer,HS_TS +297,R_53Q1871ckrSILOp,32 - 38,American,Male,Male,University - Graduate (Masters),36,02PsVPf,02FUT,10,02DGEN,1.125,0,1,3,3,3,0,3,-1,-3,-3,-2,3,2,3,1,3,2,3,2,3,3,2,-2,-3,-3,-3,-2,2,3,2,3,3,3,3,3,3,2,-2,-2,-2,-3,-3,3,2,2,3,3,3,2,3,3,3,-2,-2,-2,-3,-2,3,3,3,3,3,2,3,3,2,3,-2,-2,-2,-3,-2,2,3,3,2,3,5,5,5,5,5,5,5,5,5,5,5,5,0,1,0,3,1,1,0,0,1,5,0,0,1,0,1,0,0,0,3,1,1,1,1,1,6,1,1,1,0,1,0,1,0,3,0,1,1,1,1,5,1,0,2,0,1,1,0,0,2,0,1,1,1,1,5,0,0,2,1,1,0,1,0,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,buffer,0,0,0,0,1,0,-1,-1,0,0,-1,0,-1,0,0,-1,0,0,1,1,0,0,0,0,1,1,1,-1,-1,0,-1,0,0,-1,0,0,1,1,0,1,0,1,0,-1,0,buffer,0,0,0,0,0,0,buffer,0.2,-0.4,-0.4,0.2,0.2,0,-0.4,0.6,0,buffer,0,0,-0.2,0.133333333,0.066666667,buffer,0,0,0,0,0,0,1,1.4,0.4,0.8,2,0.8,0.8,1.8,0.8,0.6,1.8,0.8,0.2,0.6,0.4,0.6,0,0.4,buffer,grad_prof +298,R_7MSQwkC8SJ9HsU3,32 - 38,American,Female,Female,University - Graduate (Masters),34,01PfPsV,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,2,2,2,2,3,2,-1,2,3,2,1,2,1,-1,2,1,1,3,3,2,2,1,-1,2,1,3,2,-1,3,3,2,2,-1,-1,1,1,1,-1,2,-1,3,3,-1,2,3,2,3,1,2,3,2,-1,3,-1,3,1,2,3,2,2,3,3,1,1,3,3,-1,3,-2,3,2,2,3,3,2,9,8,7,6,8,8,6,8,9,9,9,9,1,1,1,1,1,0,2,3,1,1,2,0,2,4,1,0,0,3,3,2,1,2,3,1,3,2,1,2,3,1,0,1,1,0,0,0,0,1,4,1,0,0,2,3,0,1,1,1,1,0,1,0,1,5,1,1,0,2,4,0,1,1,4,4,1,1,0,0,0,2,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,buffer,1,0,0,1,1,0,2,2,-3,0,2,0,0,1,1,-1,-1,2,2,2,0,2,2,-4,2,1,1,0,-1,1,0,1,4,3,1,0,0,0,-1,2,-1,1,0,0,0,buffer,3,0,-2,-3,-1,-1,buffer,0.6,0.2,0.8,0.8,0.4,0.4,1.8,0.2,0,buffer,0.333333333,-1.666666667,0.533333333,0.533333333,0.666666667,buffer,3,0,1,3,1,0,1,1.4,1.8,1.6,2,1.8,0.4,1.2,1,0.8,1.6,1.4,2.2,0.6,0.4,0.4,0.4,0.4,buffer,grad_prof +299,R_5pojpy8GIBp7d1G,32 - 38,American,Male,Male,University - Undergraduate,35,01PfPsV,02FUT,5,02DGEN,0.875,0.666666667,0.333333333,1,3,3,0,1,0,0,1,0,-1,1,0,2,1,1,2,1,1,0,1,2,0,1,1,2,2,1,2,1,0,1,1,2,2,0,1,1,0,3,1,3,1,0,1,0,2,3,0,1,1,2,0,1,2,2,3,1,0,0,1,0,2,1,0,1,1,1,1,2,2,2,1,0,2,2,9,7,7,8,7,7,9,8,8,9,8,9,1,2,2,0,0,2,0,0,1,3,1,1,0,0,1,0,2,1,2,1,1,1,1,3,2,2,1,2,0,1,1,0,3,1,0,2,0,0,2,3,2,1,2,1,0,1,1,2,0,0,1,1,0,2,3,1,1,2,1,1,1,0,1,2,1,1,1,1,2,1,1,0,2,0,0,2,1,1,1,0,1,1,0,0,0,1,0,0,2,1,buffer,0,2,-1,-1,0,0,0,0,-1,0,-1,0,-2,-1,1,-1,1,-1,2,1,0,0,1,1,-1,1,0,0,-1,0,-1,-1,0,1,1,0,0,1,2,1,0,0,2,-2,-1,buffer,0,-1,-1,-1,-1,-2,buffer,0,-0.2,-0.6,0.4,0.2,0,0,0.8,-0.2,buffer,-0.666666667,-1.333333333,-0.266666667,0.2,0.2,buffer,1,0,0,0,0,1,1,1.2,0.6,1.2,1.6,1.2,1,1.4,1.2,0.8,1.4,1.2,1,1.2,0.6,1,0.4,0.8,buffer,C_Ug +300,R_1gAb8AYhhuTy3j4,32 - 38,American,Female,Female,University - Undergraduate,34,01PfPsV,01PAST,10,01ITEM,1.125,0.666666667,0.333333333,1,2,2,3,2,2,2,2,3,3,3,2,1,2,3,2,1,2,3,2,2,2,1,3,2,2,2,1,3,2,2,2,3,2,3,3,2,2,2,1,3,2,1,2,3,1,2,3,3,2,2,1,3,1,2,2,2,1,3,2,2,3,1,2,2,2,3,2,2,1,2,3,3,2,1,8,8,8,9,9,8,8,7,8,8,8,9,1,1,0,0,0,0,0,1,0,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1,2,0,0,0,0,0,0,0,1,0,0,0,1,1,2,1,1,0,0,1,1,1,1,1,1,0,0,1,0,1,2,1,1,2,0,2,0,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,2,1,0,0,2,1,1,1,0,1,2,1,1,buffer,1,1,-1,0,0,0,-1,0,-2,0,0,0,0,0,0,0,-1,0,0,1,1,-1,0,0,0,-1,-1,-2,0,-2,-1,0,-1,0,1,1,-2,0,0,0,1,-1,-2,0,0,buffer,0,1,0,1,1,-1,buffer,0.2,-0.6,0,0,0,-1.2,-0.2,-0.2,-0.4,buffer,0.333333333,0.333333333,-0.133333333,-0.4,-0.266666667,buffer,1,1,0,0,1,1,0.4,0.4,0.6,0.8,0.8,0,0.2,1,0.6,0.8,0.8,1.2,0.8,0.8,0.6,1,1,1,buffer,C_Ug +301,R_3ZKoWq577jbPQow,32 - 38,American,Male,Male,High School (or equivalent),38,01PfPsV,01PAST,5,02DGEN,0.25,0,1,3,3,3,2,3,3,0,2,3,3,3,3,2,3,2,3,3,-1,1,3,3,3,3,3,3,3,3,2,3,3,3,3,-1,3,3,3,0,1,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,6,5,5,5,5,5,7,9,5,7,10,0,0,4,1,0,0,3,1,0,0,0,0,0,0,1,0,0,4,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,1,0,0,3,1,0,0,1,1,1,1,0,0,0,0,1,0,0,3,1,0,0,0,0,1,0,1,0,0,0,2,0,0,3,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,1,buffer,0,0,4,0,0,0,0,0,0,0,-1,-1,-1,-1,1,0,0,4,0,0,0,-3,0,0,0,0,1,0,0,0,0,0,0,2,0,0,3,2,0,0,-1,0,-1,-1,-1,buffer,0,-1,-4,0,-2,-5,buffer,0.8,0,-0.6,0.8,-0.6,0.2,0.4,1,-0.8,buffer,-1.666666667,-2.333333333,0.066666667,0.133333333,0.2,buffer,0,1,0,0,0,1,1,0.8,0.2,1,0.2,0.6,0.2,0.8,0.8,0.2,0.8,0.4,0.4,1,0.4,0,0,1.2,buffer,HS_TS +302,R_7cdr4IBGZHAfx8M,32 - 38,American,Male,Male,University - Graduate (Masters),37,03VPfPs,02FUT,5,02DGEN,0,1,0,3,3,3,3,3,3,-2,NA,-2,3,3,3,3,1,2,2,3,2,3,3,2,-1,1,-3,1,3,2,1,2,0,2,2,2,3,2,3,-2,2,-2,2,1,3,2,2,2,3,3,3,3,3,1,2,2,1,2,1,1,1,3,1,2,2,2,1,1,2,-2,3,-2,2,1,2,1,2,2,6,6,7,6,6,6,6,6,10,6,7,6,1,0,1,0,0,1,1,NA,1,2,0,1,2,1,2,1,1,1,0,1,0,0,NA,0,1,2,0,1,1,0,0,0,0,0,0,2,4,NA,3,1,2,2,2,2,1,1,1,1,2,2,1,0,NA,0,1,2,1,2,1,0,0,1,0,0,1,1,1,1,1,1,2,1,1,0,2,1,1,1,2,2,1,4,1,3,0,0,1,0,1,1,buffer,1,0,1,0,0,-1,-3,NA,-2,1,-2,-1,0,-1,1,0,0,0,-2,-1,-1,0,NA,0,0,0,-1,-1,0,0,-1,0,-1,-2,-1,0,-3,0,-2,1,2,0,1,-1,1,buffer,0,0,-3,0,-1,0,buffer,0.4,-1.25,-0.6,-0.6,-0.25,-0.4,-1,-0.8,0.6,buffer,-1,-0.333333333,-0.483333333,-0.416666667,-0.4,buffer,0,0,1,0,1,4,0.4,1.25,1.2,0.8,0.25,0.8,0,2.5,1.8,1.4,0.5,1.2,0.4,1,1.2,1.4,1.8,0.6,buffer,grad_prof +303,R_5JAxGZ58mS8RU8F,39 - 45,American,Male,Male,Trade School (non-military),45,03VPfPs,02FUT,10,01ITEM,0.875,0,1,2,2,2,2,1,1,1,0,1,0,1,0,3,1,1,3,2,1,2,2,2,1,2,1,2,3,2,3,2,2,2,1,2,-1,2,1,1,1,-1,1,2,3,2,2,1,2,2,3,2,3,0,-2,2,-2,1,2,2,0,1,0,2,2,1,2,2,1,3,2,2,2,1,2,1,2,2,7,7,8,7,8,8,7,6,8,6,7,7,1,0,1,0,1,1,0,2,0,2,2,2,0,1,1,0,1,0,3,1,0,0,1,2,1,1,3,1,1,0,0,0,1,0,2,1,3,2,3,1,1,2,3,0,1,0,0,1,0,1,0,2,2,1,2,0,2,2,1,1,1,1,1,3,0,1,0,1,2,1,1,1,1,0,1,0,0,2,0,1,1,5,0,4,1,1,0,1,1,2,buffer,1,0,0,0,-1,0,-3,0,-3,1,1,0,-3,1,0,0,1,-1,3,0,0,-2,-1,1,-1,1,1,-1,0,-1,1,1,-1,3,-1,0,-5,1,-2,0,0,1,0,-1,-1,buffer,0,1,0,1,1,1,buffer,0,-1,-0.2,0.6,-0.6,0,0.6,-1.2,-0.2,buffer,0.333333333,1,-0.4,0,-0.266666667,buffer,0,1,0,1,1,1,0.6,1,1.2,1,0.8,1.2,0.6,2,1.4,0.4,1.4,1.2,1.2,1,0.8,0.6,2.2,1,buffer,HS_TS +304,R_7wi7GdqCMrWyYru,53 - 59,American,Male,Male,High School (or equivalent),56,02PsVPf,01PAST,10,02DGEN,0.125,0,1,2,3,3,-1,2,1,0,2,-2,1,3,-1,3,1,3,3,3,3,-1,2,2,-1,3,-2,2,3,-2,3,2,3,2,3,3,-1,2,1,-2,3,-2,1,3,-2,3,1,3,3,3,3,1,2,2,0,3,-2,2,3,-2,3,1,3,3,3,3,1,3,2,0,3,-1,2,3,-1,3,1,3,1,1,1,1,4,1,1,2,2,1,3,3,1,0,0,0,0,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,2,1,0,0,0,1,0,0,0,1,0,0,2,0,1,0,1,0,1,0,1,0,0,0,1,0,0,2,1,1,0,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,buffer,0,0,0,-2,0,0,1,0,0,0,0,0,0,1,0,-1,0,0,-2,-1,-1,2,0,-1,-1,0,1,0,0,0,1,0,0,0,-1,1,1,0,-1,1,0,-1,0,1,0,buffer,0,-1,-1,0,1,-2,buffer,-0.4,0.2,0.2,-0.8,-0.2,0.2,0,0.4,0,buffer,-0.666666667,-0.333333333,0,-0.266666667,0.133333333,buffer,0,3,0,0,1,1,0.2,0.8,0.4,0,0.6,0.2,0.6,0.6,0.2,0.8,0.8,0,0.2,0.6,0.2,0.2,0.2,0.2,buffer,HS_TS +305,R_5VJE2Al6ZZjj9rs,46 - 52,American,Female,Female,University - Undergraduate,51,03VPfPs,02FUT,5,01ITEM,0.25,0,1,3,3,2,0,2,1,-1,1,-1,1,0,1,3,0,2,3,3,3,3,3,2,0,-2,0,3,0,2,2,0,2,3,3,3,3,3,2,2,-2,2,2,2,2,2,2,0,3,3,3,3,3,2,-2,2,-2,2,0,2,2,-2,2,3,3,3,3,3,3,-2,3,-2,3,0,3,3,0,3,0,4,0,0,7,6,0,3,1,0,2,6,0,0,1,3,1,1,1,3,1,2,0,1,1,0,0,0,0,1,3,1,1,3,3,3,1,2,1,1,2,2,0,0,1,3,1,1,1,1,1,1,0,1,1,2,0,0,0,1,3,1,2,1,2,1,2,0,2,0,0,1,0,0,0,0,0,0,2,0,2,1,2,0,0,2,2,0,0,0,0,0,1,0,1,0,1,0,1,1,2,1,buffer,0,0,0,0,0,0,0,2,0,1,0,0,0,-2,0,0,0,0,0,0,-1,2,1,2,-1,2,-1,1,2,1,0,0,0,0,0,-1,2,-1,2,0,2,-1,-1,0,1,buffer,0,1,-1,0,5,0,buffer,0,0.6,-0.4,0,0.6,1,0,0.4,0.2,buffer,0,1.666666667,0.066666667,0.533333333,0.2,buffer,0,3,6,0,1,5,1,1.6,0.4,1,2.2,1.6,1,1,0.8,1,1.6,0.6,0,1,1.2,0,0.6,1,buffer,C_Ug +306,R_7OHu5BnNsLKHuNj,46 - 52,American,Male,Male,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,1,2,1,0,1,2,0,2,-1,1,2,2,2,1,3,2,3,2,0,2,1,-2,2,-2,1,2,2,1,1,3,2,3,1,0,2,1,-2,2,-2,1,2,2,1,1,3,2,3,2,0,2,2,-2,2,-1,2,2,2,2,0,3,2,3,2,0,2,2,-3,2,-2,2,2,2,2,1,3,3,3,3,2,2,2,2,3,3,2,2,2,1,1,1,0,1,1,2,0,1,0,0,0,1,0,0,1,1,0,0,1,1,2,0,1,0,0,0,1,0,0,1,1,1,0,1,0,2,0,0,1,0,0,0,1,0,1,1,1,0,1,0,3,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,buffer,0,0,0,0,0,1,0,0,1,-1,0,0,1,-1,0,0,0,-1,0,0,1,-1,0,0,-1,0,0,1,0,0,0,0,1,0,0,0,-1,0,-1,0,0,0,0,-1,0,buffer,1,0,0,0,0,0,buffer,0,0.2,0,-0.2,-0.2,0.2,0.2,-0.4,-0.2,buffer,0.333333333,0,0.066666667,-0.066666667,-0.133333333,buffer,1,1,1,0,1,1,0.8,0.8,0.2,0.6,0.8,0.2,0.8,0.6,0.2,0.8,1,0,0.2,0,0,0,0.4,0.2,buffer,C_Ug +307,R_5HRX2XpRV0bRhHr,46 - 52,American,Female,Female,University - Graduate (Masters),46,01PfPsV,01PAST,10,01ITEM,0.875,1,0,3,2,3,2,3,1,3,3,2,3,3,3,3,3,3,2,-1,1,2,-2,-1,1,-2,1,3,-2,1,1,-2,-1,2,3,2,2,3,3,-1,2,3,-1,1,2,1,2,-2,2,-3,2,2,2,2,-1,3,2,3,2,-2,1,-2,2,1,2,3,2,-1,2,-2,1,2,-1,2,2,2,-2,-2,5,5,7,5,7,6,6,7,7,6,6,6,1,3,2,0,5,2,2,5,1,0,5,2,2,5,4,1,1,1,0,0,2,4,1,1,4,2,1,2,1,5,1,5,1,0,1,1,4,0,0,0,1,5,2,5,1,2,0,0,0,4,1,5,2,0,4,1,1,1,5,5,0,4,1,0,5,4,2,4,2,4,3,1,0,4,1,1,5,1,0,3,0,1,2,0,4,0,4,1,0,4,buffer,0,-2,1,0,4,1,-2,5,1,0,4,-3,0,0,3,-1,1,1,0,-4,1,-1,-1,1,0,1,0,1,-4,0,-1,-1,0,0,2,4,1,2,2,0,3,-3,-1,4,-3,buffer,-1,-2,0,-1,1,0,buffer,0.6,1,0.8,-0.6,0,-0.4,0,1.8,0,buffer,-1,0,0.8,-0.333333333,0.6,buffer,0,2,1,0,1,1,2.2,2,3.6,0.6,2.4,2.2,1.6,1,2.8,1.2,2.4,2.6,2,3.2,1.8,2,1.4,1.8,buffer,grad_prof +308,R_1ZO1xvKwGSBo58Z,53 - 59,American,Male,Male,University - Undergraduate,59,01PfPsV,01PAST,10,01ITEM,0.125,0.666666667,0.333333333,3,2,3,1,0,-3,0,1,1,-1,1,-1,3,-3,3,3,2,2,0,-1,-3,1,2,1,-2,1,-1,2,-3,3,3,2,2,1,-1,-3,1,1,2,-3,2,-1,2,-3,2,3,2,3,3,-3,-3,0,0,0,-2,0,-2,3,-3,3,3,2,3,2,-2,-2,0,0,2,-2,0,-2,2,-3,3,2,2,1,2,2,2,1,1,1,1,2,2,0,0,1,1,1,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,1,2,1,0,1,0,1,0,0,0,2,3,0,0,1,1,1,1,1,0,0,0,0,0,0,1,2,1,0,1,1,1,1,1,1,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,buffer,0,0,1,-1,-2,0,1,0,-1,0,-1,-1,1,0,0,0,0,1,-1,-1,-1,1,-1,0,1,0,-1,0,0,1,0,0,0,0,-1,-1,0,1,-1,1,1,0,-1,0,1,buffer,1,1,0,1,0,0,buffer,-0.4,0,-0.2,-0.2,0,0,-0.2,0,0.2,buffer,0.666666667,0.333333333,-0.2,-0.066666667,0,buffer,0,0,1,0,1,1,0.6,0.6,0.2,0.4,0.8,0.6,1,0.6,0.4,0.6,0.8,0.6,0.2,0.6,0.4,0.4,0.6,0.2,buffer,C_Ug +309,R_5tyB2FOKuWGLorY,46 - 52,American,Male,Male,High School (or equivalent),48,02PsVPf,01PAST,5,01ITEM,0.5,0,1,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,HS_TS +310,R_1EbpiVsMOtHs4Lq,46 - 52,American,Female,Female,High School (or equivalent),52,03VPfPs,02FUT,10,02DGEN,-0.125,0.333333333,0.666666667,3,3,2,1,3,2,-2,1,1,3,0,-1,3,-1,3,2,2,2,1,2,-1,-1,-1,1,1,0,1,3,1,3,2,2,2,-1,2,-1,0,-1,0,2,0,1,3,1,3,2,2,1,2,3,3,-2,3,-1,3,0,-1,3,-1,3,3,2,1,1,3,3,-2,3,-2,3,0,0,3,-2,3,6,6,6,6,6,3,3,3,3,4,3,4,1,1,0,0,1,3,1,2,0,2,0,2,0,2,0,1,1,0,2,1,3,2,2,1,1,0,2,0,2,0,1,1,1,1,0,1,0,2,2,0,0,0,0,0,0,0,1,1,0,0,1,0,2,3,0,0,1,0,1,0,0,0,0,2,0,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,0,buffer,0,0,-1,-1,1,2,1,0,-2,2,0,2,0,2,0,1,0,-1,2,1,2,2,0,-2,1,0,1,0,1,0,-1,0,0,1,0,0,1,0,0,1,0,-1,0,-1,0,buffer,3,3,3,2,3,-1,buffer,-0.2,0.6,0.8,0.6,0.6,0.4,0,0.4,-0.4,buffer,3,1.333333333,0.4,0.533333333,0,buffer,0,0,3,1,0,1,0.6,1.6,0.8,1,1.8,0.8,0.8,1,0,0.4,1.2,0.4,0.4,0.6,0,0.4,0.2,0.4,buffer,HS_TS +311,R_3kMLtCcYqtnxMs9,25 - 31,American,Female,Female,College Diploma/Certificate,31,01PfPsV,02FUT,5,01ITEM,0.75,0,1,3,3,3,3,2,1,-3,2,-2,2,2,2,2,-2,2,3,3,3,3,2,1,-3,2,-3,1,3,3,3,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,1,-3,1,-3,3,3,3,2,-1,2,3,3,3,1,3,1,-3,-2,-3,1,3,3,3,-2,3,0,0,0,0,1,0,2,3,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,1,2,0,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,2,1,0,0,4,1,1,1,1,1,0,1,0,0,0,0,1,2,0,1,0,2,0,0,0,1,0,0,0,0,2,0,0,0,3,0,2,0,0,1,1,1,buffer,0,0,0,0,-1,0,0,-1,0,0,0,0,1,-1,1,0,0,0,-2,0,2,0,-3,0,0,0,0,0,1,0,0,0,0,-2,1,2,0,-2,0,0,0,0,-1,0,-1,buffer,-2,-3,-1,0,1,0,buffer,-0.2,-0.2,0.2,-0.4,-0.2,0.2,-0.2,0,-0.4,buffer,-2,0.333333333,-0.066666667,-0.133333333,-0.2,buffer,0,1,0,2,3,1,0,0.4,0.8,0.2,1,1,0.2,0.6,0.6,0.6,1.2,0.8,0.2,1,0.2,0.4,1,0.6,buffer,C_Ug +312,R_6VXErvAGvyR9YcN,39 - 45,American,Male,Male,High School (or equivalent),45,03VPfPs,01PAST,5,01ITEM,0.25,0,0.666666667,2,3,3,2,3,2,-2,3,0,3,3,3,3,3,3,2,3,3,3,3,2,-3,3,-1,2,3,3,3,3,3,2,1,3,2,2,3,3,3,2,2,3,3,2,2,2,3,2,3,2,3,2,2,3,3,3,3,3,3,2,2,3,2,3,2,2,3,-2,2,-2,3,3,2,3,2,3,4,8,6,5,9,8,8,9,9,9,6,8,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,2,0,0,1,1,5,0,2,1,0,0,1,1,1,1,1,0,0,0,0,4,0,3,0,0,0,0,1,1,1,1,0,0,1,1,0,1,2,0,0,1,0,1,0,0,2,0,1,1,1,6,0,3,0,0,0,1,1,1,0,0,0,0,1,1,4,1,5,0,0,1,0,0,1,buffer,-1,-1,0,1,0,0,-3,0,-2,1,0,0,0,-1,-1,-1,1,0,0,0,0,5,-1,0,1,0,-1,1,0,1,0,2,0,1,0,0,2,-1,-2,0,0,-1,1,1,0,buffer,-4,-1,-3,-4,3,0,buffer,-0.2,-0.8,-0.4,0,1,0.2,0.6,-0.2,0.2,buffer,-2.666666667,-0.333333333,-0.466666667,0.4,0.2,buffer,1,1,2,1,3,1,0.2,0.6,0,0.6,1.8,0.6,0.4,1.4,0.4,0.6,0.8,0.4,0.8,2,0.6,0.2,2.2,0.4,buffer,HS_TS +313,R_3clUNkVPjmHaZjz,25 - 31,American,Male,Male,University - Graduate (Masters),30,02PsVPf,02FUT,10,02DGEN,1.75,0,0.666666667,-2,-2,-3,-2,-2,0,-3,-3,-3,-3,-2,-3,-2,-2,-3,3,2,3,2,3,2,2,3,3,3,2,2,2,3,2,2,3,2,3,2,2,2,2,3,2,2,2,3,2,2,2,1,2,2,3,2,2,2,1,1,2,1,2,2,1,1,2,3,2,2,-2,-3,-3,-2,-2,2,2,2,3,2,7,6,9,10,8,9,8,6,9,8,7,2,5,4,6,4,5,2,5,6,6,6,4,5,4,5,5,4,5,5,5,4,2,5,5,6,5,4,5,5,4,5,4,3,5,4,5,2,5,5,4,4,4,4,4,4,4,3,4,6,4,4,2,0,0,1,1,4,5,4,5,5,1,1,1,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,4,5,5,3,3,0,1,0,1,1,buffer,1,1,1,0,0,0,0,1,2,2,0,1,0,1,1,1,1,-1,1,0,0,5,5,5,4,0,0,1,-1,0,0,0,0,1,0,-4,-5,-4,-3,-2,0,-1,1,0,-1,buffer,-1,0,0,2,1,7,buffer,0.6,1,0.6,0.4,3.8,0,0.2,-3.6,-0.2,buffer,-0.333333333,3.333333333,0.733333333,1.4,-1.2,buffer,3,2,0,0,1,7,4.8,5,4.6,4.6,4.6,4.6,4.2,4,4,4.2,0.8,4.6,1,0.4,0.4,0.8,4,0.6,buffer,grad_prof +314,R_7j70UobCuokAOxM,39 - 45,American,Male,Male,University - Undergraduate,42,01PfPsV,02FUT,5,01ITEM,-0.25,0,1,2,2,1,2,3,3,-3,3,-3,2,2,1,2,2,2,3,3,2,3,3,2,-3,3,-3,3,2,1,3,2,2,2,2,2,2,3,3,-3,2,-3,2,2,2,2,2,2,2,2,2,2,3,3,-3,3,-3,2,2,1,3,2,2,3,3,2,3,3,3,-3,3,-3,3,2,1,2,2,2,1,1,0,0,0,1,1,0,1,1,0,0,1,1,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,0,1,0,0,buffer,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,-1,-1,0,-1,0,0,0,1,0,-1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,buffer,0,1,-1,-1,0,1,buffer,0.6,0.4,0,-0.6,0,0.2,0,0.4,0.2,buffer,0,0,0.333333333,-0.133333333,0.2,buffer,1,1,1,0,0,1,0.8,0.4,0.2,0.2,0.2,0.2,0.2,0,0.2,0.8,0.2,0,0.6,0.6,0.4,0.6,0.2,0.2,buffer,C_Ug +315,R_5rJc2mbExmI4CgM,39 - 45,American,Female,Female,University - Graduate (Masters),44,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,3,3,3,0,3,2,2,2,3,3,3,3,3,2,3,1,1,1,0,2,1,1,1,2,0,0,1,1,1,0,1,1,2,2,0,2,2,1,1,2,1,2,0,1,2,1,2,2,1,1,0,1,2,1,1,2,1,1,2,1,1,1,2,0,1,1,1,1,1,2,0,1,1,1,1,5,5,5,5,7,5,8,7,7,5,7,5,2,2,2,0,1,1,1,1,1,3,3,2,2,1,3,2,2,1,2,3,0,0,1,2,1,2,1,3,1,1,2,1,1,1,2,2,1,0,2,2,1,2,2,0,2,2,2,1,0,2,1,1,1,2,1,3,2,2,1,2,0,0,1,2,2,1,1,0,1,2,1,1,1,0,2,0,1,0,1,0,1,0,1,0,1,2,0,0,1,0,buffer,0,1,1,-1,-1,-1,0,1,-1,1,2,0,0,1,1,0,0,0,2,1,-1,-1,0,0,0,-1,-1,1,0,-1,0,-1,1,1,2,0,1,-1,1,1,-1,1,1,-1,2,buffer,-3,-2,-2,0,0,0,buffer,0,0,0.8,0.6,-0.4,-0.4,0.6,0.4,0.4,buffer,-2.333333333,0,0.266666667,-0.066666667,0.466666667,buffer,0,2,0,3,0,2,1.4,1.4,2.2,2,0.8,1.6,1.4,1.4,1.4,1.4,1.2,2,1,1,1,0.4,0.6,0.6,buffer,grad_prof +316,R_3FEXLdp8m64IynT,18 - 24,American,Female,Female,University - Undergraduate,20,01PfPsV,01PAST,5,02DGEN,-0.75,1,0,1,3,3,2,3,3,1,2,-2,1,2,2,2,0,3,1,2,3,2,2,2,-1,1,1,2,3,2,2,1,1,1,2,1,3,3,2,0,2,1,3,1,3,1,3,2,2,1,1,3,2,3,2,1,1,2,2,1,2,2,0,3,2,1,1,2,2,1,3,0,1,1,3,0,1,2,3,3,4,4,4,5,4,5,3,5,4,5,0,1,0,0,1,1,2,1,3,1,1,0,0,1,2,0,1,2,1,0,1,1,0,3,2,1,1,1,3,1,1,2,2,1,1,0,1,1,3,1,0,1,0,2,3,2,1,2,1,1,1,0,1,2,0,1,1,2,1,1,0,0,2,1,1,0,1,1,0,1,2,1,1,2,1,1,1,0,2,0,1,1,2,1,1,1,2,2,1,2,buffer,-1,-1,-2,-1,0,1,1,0,0,0,1,-1,0,-1,-1,-2,0,0,0,-1,0,1,-1,1,2,0,0,-1,2,0,-1,-1,2,-1,1,-1,0,-1,-1,0,1,-1,-1,1,-1,buffer,-1,-2,1,-1,0,0,buffer,-1,0.4,-0.4,-0.6,0.6,0.2,0,-0.6,-0.2,buffer,-0.666666667,-0.333333333,-0.333333333,0.066666667,-0.266666667,buffer,1,1,1,1,1,2,0.4,1.6,0.8,0.8,1.4,1.4,1.4,1.2,1.2,1.4,0.8,1.2,0.8,0.6,1.4,0.8,1.2,1.6,buffer,C_Ug +317,R_5qw4FyRzRbtgw9U,46 - 52,American,Female,Female,College Diploma/Certificate,48,01PfPsV,01PAST,5,01ITEM,0.5,0.333333333,0.333333333,3,3,3,2,3,3,-3,3,-3,3,3,-2,3,0,3,3,3,3,1,3,2,-1,3,-1,1,3,-1,2,1,3,3,3,3,-1,3,2,1,3,-1,3,3,1,3,1,3,3,3,3,3,3,3,-3,3,-3,3,3,-2,3,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,-3,3,-3,3,5,3,3,3,6,6,6,3,7,6,2,7,0,0,0,1,0,1,2,0,2,2,0,1,1,1,0,0,0,0,3,0,1,4,0,2,0,0,3,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,1,0,3,0,0,0,0,2,0,0,2,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,buffer,0,0,0,0,0,1,2,0,2,2,0,1,1,-1,0,0,0,0,2,0,1,4,0,2,0,0,2,0,-2,0,0,0,0,2,0,0,2,0,0,2,0,1,1,-1,0,buffer,-1,0,-4,-3,4,-1,buffer,0,1.4,0.2,0.4,1.4,0,0.4,0.8,0.2,buffer,-1.666666667,0,0.533333333,0.6,0.466666667,buffer,2,3,3,0,1,0,0.2,1.4,0.6,0.6,1.4,0.8,0.2,0,0.4,0.2,0,0.8,0.4,0.8,0.6,0,0,0.4,buffer,C_Ug +318,R_5nO7JKL3G0dS2bn,39 - 45,American,Male,Male,High School (or equivalent),44,02PsVPf,02FUT,10,02DGEN,0.25,0.333333333,0.666666667,2,2,1,1,3,2,-2,3,-2,2,3,2,2,2,1,2,2,2,2,3,2,0,2,1,2,2,3,2,2,2,-1,0,-1,2,2,2,2,1,1,1,1,2,2,2,-1,2,2,2,2,3,3,-1,3,0,2,3,2,2,1,1,2,2,1,1,3,2,-3,3,-3,2,3,2,2,1,2,1,1,1,4,3,4,1,2,1,1,1,1,0,0,1,1,0,0,2,1,3,0,1,1,0,0,1,3,2,2,1,1,0,4,2,3,1,2,0,0,0,2,0,0,1,1,0,1,1,0,2,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,3,2,3,0,1,0,2,1,0,1,1,1,0,0,3,0,0,1,1,0,1,2,0,3,0,0,0,0,0,1,buffer,0,0,0,0,0,-1,1,1,1,0,1,1,0,-1,1,3,2,2,1,1,0,3,2,2,1,2,0,0,-1,1,3,2,2,-1,1,-1,0,1,-3,1,1,1,0,0,2,buffer,0,-1,0,3,2,3,buffer,0,0.4,0.4,1.8,1.6,0.4,1.4,-0.4,0.8,buffer,-0.333333333,2.666666667,0.266666667,1.266666667,0.6,buffer,3,2,3,0,1,0,0.4,1.2,0.6,1.8,2,0.8,0.4,0.8,0.2,0,0.4,0.4,1.8,0.8,1,0.4,1.2,0.2,buffer,HS_TS +319,R_1h3K0jsRcJsFD1X,53 - 59,American,Male,Male,Professional Degree (ex. JD/MD),53,02PsVPf,01PAST,5,02DGEN,0.375,1,0,3,3,3,3,3,1,1,1,1,3,-1,-1,1,-1,1,3,3,3,3,3,1,1,1,2,3,-1,-1,3,-1,3,3,3,3,3,3,3,1,1,1,3,-1,-1,3,-1,3,3,3,3,1,3,3,1,1,1,3,-2,-1,3,-1,3,3,3,3,0,3,3,1,1,1,3,-2,-1,3,-1,3,0,2,1,1,1,1,2,2,1,2,2,2,0,0,0,0,0,0,0,0,1,0,0,0,2,0,2,0,0,0,0,0,2,0,0,0,0,0,0,2,0,2,0,0,0,2,0,2,0,0,0,0,1,0,2,0,2,0,0,0,3,0,2,0,0,0,0,1,0,2,0,2,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-2,0,-2,0,0,1,0,-1,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,2,0,0,1,0,0,0,0,0,0,buffer,-2,0,0,-1,-1,-1,buffer,-0.4,-0.2,-0.2,-0.6,0,-0.2,-0.2,0.6,0,buffer,-0.666666667,-1,-0.266666667,-0.266666667,0.133333333,buffer,1,1,0,0,0,1,0,0.2,0.8,0,0.4,0.8,0.4,0.4,1,0.6,0.4,1,0,0.6,0,0.2,0,0,buffer,grad_prof +320,R_6QkSavkG5z1tjC9,46 - 52,American,Female,Female,University - Graduate (Masters),49,01PfPsV,02FUT,5,02DGEN,0.75,0,0.666666667,1,3,3,3,3,3,-3,2,3,-3,3,3,2,-3,3,-1,3,3,3,3,-3,3,2,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,-3,3,3,-3,3,3,1,-3,-3,2,3,3,3,3,1,1,3,3,-3,3,3,3,3,3,6,10,5,7,9,6,1,9,6,6,6,5,2,0,0,0,0,6,6,0,0,0,0,0,1,6,0,2,0,0,0,0,0,6,1,0,6,0,0,1,6,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,6,1,0,0,0,0,2,4,1,0,0,0,0,1,6,0,4,0,0,0,0,6,0,1,0,6,0,0,0,0,0,1,0,0,0,0,2,4,0,0,0,0,0,2,6,6,buffer,2,0,0,0,0,6,6,-1,0,0,0,0,0,6,-6,1,0,0,0,0,-2,2,0,0,6,0,0,0,0,0,3,0,0,0,0,4,-4,1,0,6,0,0,-2,-6,-6,buffer,5,1,-1,1,3,1,buffer,0.4,2.2,0,0.2,1.2,0,0.6,1.4,-2.8,buffer,1.666666667,1.666666667,0.866666667,0.466666667,-0.266666667,buffer,1,1,1,5,3,1,0.4,2.4,1.4,0.4,2.6,1.4,0,0.2,1.4,0.2,1.4,1.4,0.8,2.6,0,0.2,1.2,2.8,buffer,grad_prof +321,R_53wEiY3XjSxYDNq,39 - 45,American,Male,Male,University - PhD,39,02PsVPf,01PAST,10,01ITEM,0.625,1,0,1,3,3,3,3,3,0,3,3,3,2,2,2,2,2,0,3,3,3,3,3,3,3,-2,2,2,3,2,2,3,3,3,3,3,3,2,0,3,2,3,3,3,3,3,3,0,3,3,3,3,2,3,2,-1,2,2,3,3,3,2,0,3,3,3,3,2,3,2,-1,3,3,3,2,3,2,10,10,10,10,10,10,10,10,10,10,10,10,1,0,0,0,0,0,3,0,5,1,0,1,0,0,1,2,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1,0,0,0,0,1,3,1,4,1,0,1,1,1,0,1,0,0,0,0,1,3,1,4,0,1,1,0,1,0,3,0,0,0,0,1,3,0,4,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,buffer,0,0,0,0,0,-1,0,-1,1,0,0,0,-1,-1,1,1,0,0,0,0,0,-3,-1,-3,0,0,0,1,0,1,3,0,0,0,0,1,3,0,4,0,0,0,0,1,0,buffer,0,0,0,0,0,0,buffer,0,-0.2,-0.2,0.2,-1.4,0.4,0.6,1.6,0.2,buffer,0,0,-0.133333333,-0.266666667,0.8,buffer,0,0,0,0,0,0,0.2,1.8,0.4,0.4,0.4,1,0.2,2,0.6,0.2,1.8,0.6,0.6,1.8,0.6,0,0.2,0.4,buffer,grad_prof +322,R_7OkvKlTNtNPfycF,32 - 38,American,Female,Female,High School (or equivalent),33,03VPfPs,02FUT,5,01ITEM,0.875,0.333333333,0.333333333,3,3,3,3,2,-3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,-3,0,0,2,3,3,3,2,3,3,3,3,3,3,1,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,0,3,3,0,0,0,0,0,0,0,0,3,0,0,0,8,9,8,8,9,9,8,8,8,8,8,8,0,0,0,0,1,0,0,0,2,3,0,0,1,0,0,0,0,0,0,1,5,2,2,2,2,0,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,3,0,0,3,2,3,0,0,0,0,3,0,3,3,3,0,0,0,0,2,5,2,2,0,1,0,0,1,0,0,3,0,0,3,3,0,0,0,0,0,3,0,3,3,3,buffer,0,0,0,0,0,-3,0,0,2,3,0,0,1,0,0,-3,0,0,-3,-1,2,2,2,2,2,-3,0,-3,-3,-3,-3,0,0,-3,-1,5,2,2,0,1,-3,0,-2,-3,-3,buffer,0,1,0,0,1,1,buffer,0,0.4,0.2,-1.4,2,-2.4,-1.4,2,-2.2,buffer,0.333333333,0.666666667,0.2,-0.6,-0.533333333,buffer,0,0,1,0,0,0,0.2,1,0.2,0.2,2.6,0,0.2,0.6,0,1.6,0.6,2.4,0.4,2,0.2,1.8,0,2.4,buffer,HS_TS +323,R_5trOjbJAYu7DiCD,32 - 38,American,Female,Female,University - Undergraduate,35,02PsVPf,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,3,1,1,1,-3,-2,3,1,0,2,2,1,-1,2,2,3,2,2,2,-3,-3,3,1,0,2,2,1,-2,2,2,3,2,0,2,-3,-3,3,-1,-1,3,2,0,-3,3,2,3,1,2,1,-3,-2,3,1,0,2,3,2,-2,3,2,3,1,2,1,-3,-2,3,1,0,2,2,2,-3,3,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,2,1,1,0,1,2,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,2,1,0,0,0,2,0,0,0,0,2,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,buffer,0,0,1,0,1,0,1,0,0,0,0,-1,-1,0,-1,0,0,1,0,1,0,1,0,2,1,1,0,0,0,0,0,0,0,2,0,0,0,0,2,1,1,-1,1,0,1,buffer,0,0,0,0,0,0,buffer,0.4,0.2,-0.6,0.4,0.8,0.2,0.4,0.6,0.4,buffer,0,0,1.85E-17,0.466666667,0.466666667,buffer,0,0,0,0,0,0,0.6,0.2,0.2,0.6,0.8,1,0.2,0,0.8,0.2,0,0.8,0.4,0.6,0.8,0,0,0.4,buffer,C_Ug +324,R_6t4FWdg3Pl1nymt,46 - 52,American,Female,Female,Trade School (non-military),47,03VPfPs,01PAST,10,01ITEM,0.75,0,0.666666667,0,2,-1,-1,2,1,-2,2,-2,1,1,2,2,2,2,0,2,-1,0,2,2,-2,2,0,2,2,2,2,1,2,-1,2,2,1,2,1,-2,1,0,1,-1,-1,-1,-1,0,1,3,-1,-1,3,3,-2,3,-2,3,3,3,3,3,3,2,3,1,-1,3,2,-2,2,-2,2,3,3,3,3,3,2,1,1,2,2,7,1,1,1,1,1,1,0,0,0,1,0,1,0,0,2,1,1,0,0,1,0,1,0,3,2,0,0,0,1,2,0,2,3,3,3,2,1,1,0,0,1,2,0,1,0,2,2,1,1,1,1,2,1,2,0,1,1,0,0,0,1,2,1,1,1,1,1,0,3,1,0,1,0,1,0,1,3,3,3,2,2,1,0,2,0,0,1,0,1,0,1,0,0,0,0,0,buffer,-1,-1,0,1,-1,-1,0,-1,2,-1,-1,-1,-1,0,-1,-1,-1,1,2,-1,-1,0,1,2,-1,0,2,2,2,1,0,0,1,1,0,0,0,0,0,0,3,3,3,2,2,buffer,1,0,0,1,1,6,buffer,-0.4,-0.2,-0.8,0,0.2,1.4,0.4,0,2.6,buffer,0.333333333,2.666666667,-0.466666667,0.533333333,1,buffer,0,1,6,0,0,0,0.2,0.8,0.4,1.2,0.6,2.6,0.6,1,1.2,1.2,0.4,1.2,1,0.6,2.6,0.6,0.6,0,buffer,HS_TS +325,R_1uqexAcAlWO8ejm,32 - 38,American,Female,Female,Professional Degree (ex. JD/MD),38,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,1,0,1,-2,3,2,0,1,-2,2,0,-1,3,0,3,2,2,2,-2,2,3,1,-1,-1,3,1,-2,3,2,3,1,1,2,-2,2,3,1,-2,-1,2,1,-1,3,2,3,2,1,0,-3,3,0,0,2,-3,1,0,2,3,1,3,2,1,1,-2,3,1,0,3,-3,3,0,1,3,1,3,2,3,0,1,3,1,1,6,5,5,4,1,1,2,1,0,1,1,1,2,1,1,1,1,0,2,0,0,1,1,0,1,1,1,3,1,0,1,0,0,2,0,1,1,1,1,0,2,0,1,1,1,0,3,0,1,0,1,1,0,0,0,1,0,2,1,1,0,2,0,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,0,2,0,1,0,0,0,buffer,0,1,0,-1,1,-1,1,1,0,0,1,-2,0,1,0,-1,0,1,0,1,0,1,1,0,-1,1,-2,0,1,0,1,1,-1,-1,0,-1,0,0,0,-1,0,0,0,0,0,buffer,1,-3,-5,-4,-1,0,buffer,0.2,0.2,0,0.2,0.2,0,0,-0.4,0,buffer,-2.333333333,-1.666666667,0.133333333,0.133333333,-0.133333333,buffer,1,0,1,4,2,4,1,1.2,0.8,0.6,1.2,0.6,0.8,1,0.8,0.4,1,0.6,0.4,0.4,0.2,0.4,0.8,0.2,buffer,grad_prof +326,R_7Md5bk5uVfi4os9,53 - 59,American,Male,Male,High School (or equivalent),54,02PsVPf,01PAST,5,02DGEN,0,0,1,1,1,3,2,2,-2,0,2,1,1,1,0,3,-2,3,0,0,0,0,0,-2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,1,1,3,2,2,0,1,0,0,0,1,0,3,2,3,1,1,3,2,2,2,0,2,1,1,1,0,3,2,3,1,1,3,2,2,2,0,2,1,1,1,0,3,2,3,1,1,3,2,2,2,0,2,1,1,1,0,3,2,3,0,0,0,0,0,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-2,1,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,1,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-1,0,0,0,0,0,1.4,0,buffer,0,0,-0.333333333,0,0.466666667,buffer,0,0,0,0,0,0,1.8,0.2,1.8,1.8,1.2,1.8,1.8,1.2,1.8,1.8,1.2,1.8,0,1.4,0,0,0,0,buffer,HS_TS +327,R_7C7agB9Gdckcphq,25 - 31,Canadian,Female,Female,University - Undergraduate,27,03VPfPs,01PAST,10,02DGEN,0,0.666666667,0.333333333,-1,3,2,3,2,1,2,2,2,2,3,1,2,3,2,2,1,0,0,1,-1,1,1,0,1,1,0,1,1,-2,-3,3,-1,3,2,-1,-1,1,0,2,3,3,2,2,2,-1,0,0,-2,2,-1,-1,1,0,1,2,1,0,1,0,-1,2,-1,1,2,1,-1,3,0,-1,2,2,-1,1,0,7,8,7,10,10,9,9,7,7,9,9,8,3,2,2,3,1,2,1,1,2,1,2,1,1,2,4,2,0,3,0,0,2,3,1,2,0,0,2,0,1,0,0,3,2,5,0,2,3,1,2,1,1,0,2,2,2,0,1,3,2,0,0,3,1,2,3,1,1,3,2,2,5,2,1,3,1,0,2,0,0,1,2,3,1,1,4,0,2,1,3,0,2,0,2,0,2,0,1,1,0,0,buffer,3,-1,0,-2,1,0,-2,0,0,0,1,1,-1,0,2,2,-1,0,-2,0,2,0,0,0,-3,-1,1,-3,-1,-2,5,0,0,0,1,-2,2,-2,0,-1,2,2,0,1,4,buffer,-2,1,0,1,1,1,buffer,0.2,-0.4,0.6,-0.2,-0.2,-1.2,1.2,-0.6,1.8,buffer,-0.333333333,1,0.133333333,-0.533333333,0.8,buffer,3,2,2,0,2,1,2.2,1.4,2,1,1.6,0.6,2,1.8,1.4,1.2,1.8,1.8,2.4,0.6,2.2,1.2,1.2,0.4,buffer,C_Ug +328,R_6y15Wevd07pMNtn,46 - 52,American,Male,Male,High School (or equivalent),46,01PfPsV,01PAST,5,01ITEM,0,0.666666667,0.333333333,3,3,3,3,2,0,-2,0,-2,2,1,-3,2,-1,3,3,3,3,2,2,0,-2,2,-2,2,2,-3,2,-2,3,3,3,3,3,2,-2,-3,1,-2,2,2,-3,2,-2,3,3,3,3,2,2,-3,-2,1,-2,2,1,-3,2,-2,3,3,3,3,3,2,0,-2,2,-2,2,2,-3,2,-2,3,3,2,1,1,2,1,1,1,2,2,1,2,0,0,0,1,0,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,2,1,1,0,0,1,0,0,1,0,0,0,0,1,0,3,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,0,0,0,0,1,0,2,1,1,0,0,0,0,0,0,0,0,0,0,1,0,3,0,1,0,0,1,0,0,0,0,buffer,0,0,0,0,0,-3,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,0,-1,0,0,0,0,buffer,2,1,-1,-1,1,-1,buffer,0,-0.4,0.2,0,0.4,0,0,0,-0.2,buffer,0.666666667,-0.333333333,-0.066666667,0.133333333,-0.066666667,buffer,2,0,0,1,0,0,0.2,0.4,0.4,0,0.8,0.4,0.2,0.8,0.2,0,0.4,0.4,0.2,0.8,0,0.2,0.8,0.2,buffer,HS_TS +329,R_5qe2wyBRBnfCjtw,18 - 24,Canadian,Female,Female,High School (or equivalent),18,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,3,3,3,2,1,-1,2,-1,3,1,3,3,-3,2,3,3,3,3,3,1,-1,0,-1,1,1,-1,3,-1,3,3,3,3,3,3,1,0,1,-1,1,0,-1,3,-1,3,3,3,3,3,3,1,-1,0,-1,1,0,-1,3,-3,3,3,3,3,3,3,1,-1,1,-1,1,1,0,3,-1,3,5,5,5,5,6,5,7,5,6,5,5,5,1,0,0,0,1,0,0,2,0,2,0,4,0,2,1,1,0,0,0,1,0,1,1,0,2,1,4,0,2,1,1,0,0,0,1,0,0,2,0,2,1,4,0,0,1,1,0,0,0,1,0,0,1,0,2,0,3,0,2,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,2,0,buffer,0,0,0,0,0,0,0,0,0,0,-1,0,0,2,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,-2,0,buffer,-2,0,-1,0,1,0,buffer,0,0,0.2,0,0.2,0.4,0,0.2,-0.6,buffer,-1,0.333333333,0.066666667,0.2,-0.133333333,buffer,0,1,0,2,0,1,0.4,0.8,1.4,0.4,0.8,1.6,0.4,0.8,1.2,0.4,0.6,1.2,0,0.4,0.2,0,0.2,0.8,buffer,HS_TS +330,R_51b34xCv0Q4Pu5f,32 - 38,Canadian,Male,Male,High School (or equivalent),35,01PfPsV,01PAST,10,01ITEM,0,0,0.333333333,3,3,2,1,2,-3,3,1,3,3,2,0,3,1,3,-1,3,2,2,3,0,1,0,-1,1,0,0,1,0,0,3,3,3,3,2,3,-3,-3,1,1,-3,-1,3,3,0,0,2,0,1,1,1,0,0,1,1,2,0,1,2,2,0,1,0,2,0,1,1,2,0,1,2,2,2,1,0,7,4,5,9,8,8,9,8,7,8,7,8,4,0,0,1,1,3,2,1,4,2,2,0,2,1,3,0,0,1,2,0,6,6,4,2,2,5,1,0,2,3,3,1,2,0,1,4,3,1,2,2,0,0,2,1,1,3,2,2,1,2,4,2,1,3,2,0,2,1,0,3,4,0,1,1,1,3,4,3,2,0,3,1,2,3,0,0,1,0,1,1,0,1,2,1,0,0,2,1,1,2,buffer,1,-1,-2,1,0,-1,-1,0,2,0,2,0,0,0,2,-3,-2,-1,1,-2,2,4,3,-1,0,5,-1,-1,2,0,4,-1,1,0,0,3,3,1,1,0,3,-1,1,2,-2,buffer,-2,-4,-2,1,1,0,buffer,-0.2,0,0.8,-1.4,1.6,1,0.8,1.6,0.6,buffer,-2.666666667,0.666666667,0.2,0.4,1,buffer,2,4,3,1,1,1,1.2,2.4,1.6,0.6,4,2.2,1.4,2.4,0.8,2,2.4,1.2,1.4,2.4,1.8,0.6,0.8,1.2,buffer,HS_TS +331,R_3dzcAKteTP7nZ5i,18 - 24,Canadian,Female,Female,College Diploma/Certificate,24,02PsVPf,02FUT,5,01ITEM,0.25,0,1,-2,-2,3,0,-2,1,3,0,-2,1,2,-1,2,0,0,-1,-1,-2,1,-2,2,-3,-2,-2,2,2,-1,2,0,1,-2,1,2,2,2,0,1,1,3,2,3,-1,0,2,3,0,-1,-2,2,2,2,-2,3,-1,-1,1,0,-2,0,3,2,-1,-2,2,1,-2,2,0,2,0,-2,1,2,-2,1,6,8,3,5,7,3,3,4,7,9,8,8,1,1,5,1,0,1,6,2,0,1,0,0,0,0,1,0,3,1,2,4,1,2,1,5,1,1,0,2,2,3,2,1,5,2,4,1,5,3,1,2,1,1,4,0,3,4,1,5,2,3,3,1,0,4,1,4,2,0,2,1,1,2,4,1,4,2,4,3,5,0,1,0,2,2,2,2,0,0,0,1,4,4,3,3,1,3,1,4,2,2,buffer,-1,0,0,-1,-4,0,1,-1,-1,-1,-1,-1,-4,0,-2,-4,2,-4,0,1,-2,1,1,1,0,-3,-2,2,0,2,-1,2,4,1,3,-2,0,0,2,-1,-2,-1,-2,0,0,buffer,3,4,-4,-4,-1,-5,buffer,-1.2,-0.4,-1.6,-1,0.2,-0.2,1.8,-0.2,-1,buffer,1,-3.333333333,-1.066666667,-0.333333333,0.2,buffer,1,1,0,6,4,1,1.6,2,0.2,2,2,1.6,2.8,2.4,1.8,3,1.8,1.8,2.4,2.8,1.4,0.6,3,2.4,buffer,C_Ug +332,R_5eb8Hg6x43UvJf4,46 - 52,American,Male,Male,College Diploma/Certificate,52,02PsVPf,01PAST,10,02DGEN,0.25,0,1,2,3,3,2,3,1,-1,1,-1,1,-1,-1,2,-3,3,2,3,3,2,3,1,-1,1,-1,1,-1,-1,1,-3,3,1,3,3,2,3,1,-1,1,-1,1,-1,-1,1,-3,3,2,3,3,3,2,1,-1,1,-1,1,1,1,1,-3,3,2,3,3,3,2,1,-1,1,-1,1,1,1,1,-3,3,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,2,2,1,0,0,0,0,0,1,1,0,0,0,0,0,2,2,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,-1,0,0,0,0,0,-2,-2,0,0,0,1,0,0,-1,-1,0,0,0,0,0,-2,-2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0,-0.8,-0.2,0,-0.8,0.2,0,0,buffer,0,0,-0.4,-0.333333333,0.066666667,buffer,0,0,0,0,0,0,0,0,0.2,0.2,0,0.2,0.4,0,1,0.4,0,1,0.2,0,0,0,0,0,buffer,C_Ug +333,R_1tM7LJvIeqd77A3,39 - 45,American,Female,Female,University - Graduate (Masters),43,02PsVPf,02FUT,10,02DGEN,0.375,0,1,3,2,3,3,1,-1,-2,3,-1,0,2,3,2,1,0,3,3,3,3,2,1,1,3,1,0,2,3,2,2,0,3,2,2,1,2,1,2,3,1,1,2,2,1,3,0,3,3,3,3,2,-1,1,3,0,0,2,3,2,1,0,3,3,3,3,3,0,1,1,0,0,1,2,2,-2,0,3,3,4,3,3,4,1,6,4,6,7,6,0,1,0,0,1,2,3,0,2,0,0,0,0,1,0,0,0,1,2,1,2,4,0,2,1,0,1,1,2,0,0,1,0,0,1,0,3,0,1,0,0,0,0,0,0,0,1,0,0,2,1,3,2,1,0,1,1,0,3,0,0,1,1,2,0,0,1,0,0,1,0,1,1,1,0,0,0,0,0,1,1,0,2,0,0,1,1,0,3,0,buffer,0,0,0,0,0,2,0,0,1,0,0,0,0,1,0,0,-1,1,2,-1,1,1,-2,1,1,-1,0,1,-1,0,0,1,1,2,-1,-1,1,-2,0,1,-1,0,1,-2,0,buffer,2,-3,0,-3,-4,-2,buffer,0,0.6,0.2,0.2,0.4,-0.2,0.6,-0.2,-0.4,buffer,-0.333333333,-3,0.266666667,0.133333333,-1.85E-17,buffer,0,0,0,5,1,2,0.4,1.4,0.2,0.8,1.8,0.8,0.4,0.8,0,0.6,1.4,1,0.8,0.4,0.6,0.2,0.6,1,buffer,grad_prof +334,R_7q1F7ACDjIgiXCB,32 - 38,American,Female,Female,College Diploma/Certificate,32,01PfPsV,01PAST,5,01ITEM,-0.25,0,1,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,2,3,2,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,2,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,1,2,0,3,0,2,2,0,1,0,0,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,0,0,0,0,1,1,2,1,1,2,0,3,0,2,2,3,2,3,3,0,0,0,0,0,0,0,0,0,0,buffer,-2,0,-1,0,0,-1,-1,-2,-1,-1,-2,0,-3,0,-2,0,-3,-3,-3,-3,0,0,0,0,0,0,0,0,0,0,-2,-3,-2,-3,-3,1,1,2,1,1,2,0,3,0,2,buffer,-2,-5,-5,-5,0,0,buffer,-0.6,-1.2,-1.4,-2.4,0,0,-2.6,1.2,1.4,buffer,-4,-1.666666667,-1.066666667,-0.8,-7.40E-17,buffer,0,5,5,3,0,0,0,0,0,0,1.2,1.4,0.6,1.2,1.4,2.4,1.2,1.4,0,1.2,1.4,2.6,0,0,buffer,C_Ug +335,R_30O6o9S16Gy63p6,53 - 59,American,Male,Male,College Diploma/Certificate,55,03VPfPs,01PAST,10,01ITEM,0.25,0,1,0,1,2,2,1,0,0,1,-1,1,2,1,1,-1,2,1,2,2,2,2,2,-2,2,-1,2,2,2,2,-1,2,1,2,2,2,2,1,-1,2,-1,2,2,2,2,-1,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,-2,2,1,2,2,2,2,2,-2,2,-2,2,2,2,2,-1,2,0,1,1,1,1,1,0,0,0,0,1,0,1,1,0,0,1,2,2,1,0,1,0,1,1,0,0,1,1,0,0,1,1,1,1,0,1,0,1,1,0,0,2,1,0,0,1,2,2,1,1,1,0,1,1,1,0,1,1,0,0,1,2,2,1,1,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,-1,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,-1,0,0,0,0,1,1,0,0,0,0,0,0,-1,0,buffer,0,1,1,1,0,1,buffer,-0.2,-0.2,-0.2,0,-0.6,0,-0.2,0.4,-0.2,buffer,0.666666667,0.666666667,-0.2,-0.2,0,buffer,1,0,0,0,1,0,0.6,1.2,0.4,0.6,0.8,0.4,0.8,1.4,0.6,0.6,1.4,0.4,0,0.4,0,0.2,0,0.2,buffer,C_Ug +336,R_36lEraQCtCDPnjD,46 - 52,American,Female,Female,University - Graduate (Masters),46,03VPfPs,01PAST,10,01ITEM,0,1,0,3,1,2,-3,-1,-2,0,2,1,-1,3,2,2,0,2,3,1,2,-3,0,-2,-1,3,-1,1,3,1,1,0,2,2,2,3,-3,1,-1,-2,2,-1,1,3,1,1,1,2,3,1,1,-2,-1,-1,1,2,1,-1,3,3,0,-1,2,3,0,0,-1,-1,-1,1,1,1,-1,3,3,0,-2,2,3,2,1,4,5,2,4,4,3,4,5,2,0,0,0,0,1,0,1,1,2,2,0,1,1,0,0,1,1,1,0,2,1,2,0,2,2,0,1,1,1,0,0,0,1,1,0,1,1,0,0,0,0,1,2,1,0,0,1,2,2,0,1,1,1,0,0,0,1,2,2,0,1,1,1,0,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,0,0,0,1,0,0,0,0,0,1,0,buffer,0,0,-1,-1,1,-1,0,1,2,2,0,0,-1,-1,0,1,0,-1,-2,2,0,1,-1,2,2,0,0,-1,-1,0,1,0,0,-1,1,1,1,0,0,0,0,0,0,0,0,buffer,-1,-2,-2,0,0,0,buffer,-0.2,0.8,-0.4,0,0.8,-0.4,0.2,0.4,0,buffer,-1.666666667,0,0.066666667,0.133333333,0.2,buffer,1,3,1,0,1,1,0.2,1.2,0.4,1,1.4,0.6,0.4,0.4,0.8,1,0.6,1,0.8,0.6,0.2,0.6,0.2,0.2,buffer,grad_prof +337,R_3KqCkLry2isEZY8,53 - 59,American,Male,Male,College Diploma/Certificate,54,03VPfPs,01PAST,10,01ITEM,0.375,0,1,1,3,3,2,3,2,-2,3,-2,-2,1,-1,2,1,1,2,3,3,-1,2,2,-1,2,2,-1,3,3,2,3,3,2,3,3,-1,3,2,1,3,-2,-2,3,1,3,2,2,0,-1,1,1,2,1,1,1,1,-1,1,-1,1,-1,1,-2,-2,-2,-2,-2,-2,-3,-3,-3,-2,-2,-3,-2,-3,-3,3,4,4,8,5,3,7,7,7,10,10,9,1,0,0,3,1,0,1,1,4,1,2,4,0,2,2,1,0,0,3,0,0,3,0,0,0,2,2,1,1,1,1,4,2,1,1,1,3,2,3,1,0,0,1,2,0,3,5,5,4,5,4,1,6,1,0,3,2,4,4,4,0,0,0,0,1,0,2,1,4,1,0,2,1,1,1,2,1,3,3,4,3,4,4,4,1,3,2,3,2,4,buffer,0,-4,-2,2,0,-1,-2,-1,1,0,2,4,-1,0,2,-2,-5,-5,-1,-5,-4,2,-6,-1,0,-1,0,-3,-3,-3,-2,-1,-3,-3,-3,-3,-2,-3,0,0,-3,0,-2,-1,-3,buffer,-4,-3,-3,-2,-5,-6,buffer,-0.8,-0.6,1.4,-3.6,-1.8,-2,-2.4,-1.6,-1.8,buffer,-3.333333333,-4.333333333,-3.70E-17,-2.466666667,-1.933333333,buffer,5,1,1,3,3,2,1,1.4,2,0.8,0.6,1.4,1.8,2,0.6,4.4,2.4,3.4,0.2,1.6,1,2.6,3.2,2.8,buffer,C_Ug +338,R_1p3WhZfj18rGewY,53 - 59,American,Male,Male,High School (or equivalent),58,03VPfPs,01PAST,5,01ITEM,0.75,0,1,1,3,3,3,2,-3,-2,1,3,-2,3,2,2,-1,3,2,2,3,3,2,-2,-2,1,3,-2,3,2,2,-2,3,3,3,3,1,3,-2,-2,2,2,-1,3,2,2,-2,3,1,3,3,3,-1,-2,-2,-2,2,-1,3,3,2,-2,3,1,3,2,2,-1,-3,-2,-2,3,-2,3,2,3,-2,3,2,2,2,6,2,1,1,2,2,4,6,2,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,2,1,1,0,1,1,1,0,0,0,1,0,0,0,0,0,3,1,0,3,1,1,0,1,0,1,0,0,0,1,1,3,0,0,3,0,0,0,0,1,1,0,1,1,0,2,1,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,0,1,1,0,0,buffer,1,1,0,0,-3,0,0,-3,-1,-1,0,-1,0,0,0,2,0,-1,1,-2,1,0,-2,1,1,0,0,-1,0,0,1,1,-1,1,1,-1,0,1,0,0,0,-1,-1,0,0,buffer,1,0,0,2,-4,-1,buffer,-0.2,-1,-0.2,0,0.2,-0.2,0.6,0,-0.4,buffer,0.333333333,-1,-0.466666667,0,0.066666667,buffer,4,0,1,3,4,0,0.4,0.2,0.2,1,0.8,0.2,0.6,1.2,0.4,1,0.6,0.4,1,0.6,0,0.4,0.6,0.4,buffer,HS_TS +339,R_3S01BRqgYnMsK2i,39 - 45,American,Male,Male,University - Undergraduate,45,02PsVPf,02FUT,10,01ITEM,0.125,0,1,1,2,2,2,1,-1,-1,1,-1,0,1,-1,1,0,1,1,2,2,2,1,-2,-2,1,-2,0,1,-1,1,0,1,1,3,3,3,1,-2,-2,1,-1,0,1,-1,1,-1,1,2,3,3,2,1,-2,-2,1,-2,0,1,-1,1,-1,1,2,3,3,2,1,-1,-2,1,-2,0,1,-1,1,0,1,2,2,2,2,1,2,1,1,2,2,3,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,buffer,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,1,0,1,0,0,-1,0,0,0,0,1,0,0,1,1,1,0,-1,0,0,1,0,0,0,0,0,0,buffer,1,1,0,0,-2,1,buffer,-0.6,0,-0.2,0,0,0.2,0.6,0,0,buffer,0.666666667,-0.333333333,-0.266666667,0.066666667,0.2,buffer,0,1,0,1,2,1,0,0.6,0,0.6,0.4,0.2,0.6,0.6,0.2,0.6,0.4,0,0.6,0.2,0.2,0,0.2,0.2,buffer,C_Ug +340,R_5ounHrWUFcKb4U1,46 - 52,American,Female,Female,College Diploma/Certificate,52,01PfPsV,02FUT,10,02DGEN,0.25,1,0,3,3,2,2,2,-1,-2,0,-1,1,0,1,2,1,3,3,3,1,1,0,2,-1,1,-1,2,-1,1,2,1,3,3,3,-1,-1,3,1,0,-1,1,1,-1,-1,3,0,3,3,3,1,3,2,1,0,3,0,2,0,1,1,0,3,3,2,-1,3,1,0,-1,2,-1,0,-1,0,0,0,3,4,8,2,6,7,6,3,4,5,2,3,1,0,0,1,1,2,3,1,1,0,1,1,0,0,0,0,0,0,3,3,1,2,2,1,2,0,1,2,1,1,0,0,0,1,1,0,2,2,3,1,1,0,0,1,1,0,0,1,3,1,1,1,1,2,0,1,1,1,2,1,0,0,0,2,2,3,1,1,2,2,1,0,2,1,1,0,0,1,2,0,1,1,1,1,1,2,1,1,1,0,0,buffer,0,0,0,0,2,1,-1,-2,-1,0,1,0,-1,-1,0,0,-1,0,2,0,1,1,-1,2,-1,0,1,-1,0,0,0,-1,0,2,2,0,0,1,1,-1,-1,1,0,1,0,buffer,1,4,-3,4,4,5,buffer,0.4,-0.6,-0.2,0.2,0.4,0,0.6,0.2,0.2,buffer,0.666666667,4.333333333,-0.133333333,0.2,0.333333333,buffer,2,1,4,1,1,4,0.8,1.2,0.2,1.4,1.4,1,0.4,1.8,0.4,1.2,1,1,1.4,1.4,0.8,0.8,1.2,0.6,buffer,C_Ug +341,R_5M77VizNdfq6d0d,25 - 31,American,Female,Female,College Diploma/Certificate,30,02PsVPf,01PAST,5,02DGEN,-0.25,0,1,2,2,3,2,0,-2,2,1,3,1,0,-3,2,-1,2,2,2,2,2,1,-2,1,-1,2,1,-2,-2,2,-2,2,3,3,3,3,1,1,2,-1,3,2,-2,-2,2,1,1,3,3,3,3,1,1,-1,2,-1,2,3,-3,3,-1,3,3,3,3,3,1,2,-2,3,-1,2,1,-2,3,-2,3,3,3,2,4,4,4,3,3,6,3,3,3,0,0,1,0,1,0,1,2,1,0,2,1,0,1,0,1,1,0,1,1,3,0,2,0,1,2,1,0,2,1,1,1,0,1,1,3,3,1,4,1,3,0,1,0,1,1,1,0,1,1,4,4,2,4,1,1,1,1,1,1,1,1,1,1,0,3,1,0,1,1,0,0,0,3,1,0,0,0,0,0,1,1,1,0,0,2,1,0,1,0,buffer,-1,-1,1,-1,0,-3,-2,1,-3,-1,-1,1,-1,1,-1,0,0,0,0,0,-1,-4,0,-4,0,1,0,-1,1,0,1,1,1,1,0,2,0,-1,1,1,-2,-1,0,2,1,buffer,0,0,-4,1,1,1,buffer,-0.4,-1.6,-0.2,0,-1.8,0.2,0.8,0.6,0,buffer,-1.333333333,1,-0.733333333,-0.533333333,0.466666667,buffer,1,1,2,0,0,3,0.4,0.8,0.8,0.8,1.2,1.2,0.8,2.4,1,0.8,3,1,0.8,1.2,0.8,0,0.6,0.8,buffer,C_Ug +342,R_1dSHCOTVBH5dBTu,53 - 59,American,Male,Male,College Diploma/Certificate,59,03VPfPs,02FUT,10,01ITEM,0.125,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,-0.4,0,buffer,0,0,0,0,-0.133333333,buffer,0,0,0,0,0,0,0.2,0.2,0,0.2,0.2,0,0.2,0.2,0,0.2,0.2,0,0,0,0,0,0.4,0,buffer,C_Ug +343,R_30DwsF5EY3f5TvH,25 - 31,Canadian,Female,Female,University - Undergraduate,26,01PfPsV,01PAST,10,02DGEN,0,0,1,3,3,2,1,2,2,-3,3,-3,1,2,-1,3,-1,3,3,3,2,1,2,2,-3,3,-3,3,2,-1,3,-3,3,3,3,2,1,2,1,-3,3,0,2,2,-1,3,-2,3,3,3,2,1,2,2,-3,3,-3,3,2,-2,3,-3,3,3,3,1,1,3,2,-3,3,-3,2,2,-3,3,-2,3,5,5,5,6,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,1,0,0,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,1,0,2,0,0,0,1,0,1,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,1,0,0,3,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,buffer,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,-1,0,-1,1,0,0,3,0,0,-2,0,0,0,0,0,-1,0,-1,1,0,0,3,0,0,-1,0,0,0,buffer,0,0,0,1,0,0,buffer,0,0,-0.2,-0.4,0.8,-0.4,-0.4,0.8,-0.2,buffer,0,0.333333333,-0.066666667,0,0.066666667,buffer,1,0,0,0,0,0,0,0.4,0.4,0,1,0.2,0,0.4,0.6,0.4,0.2,0.6,0,1,0.2,0.4,0.2,0.4,buffer,C_Ug +344,R_3xXiv34n1qi7xUi,18 - 24,Canadian,Female,Female,University - Graduate (Masters),21,03VPfPs,01PAST,5,01ITEM,0.375,0,1,2,2,2,1,2,-1,1,0,3,0,3,-1,2,0,3,1,3,3,2,-1,-2,2,-2,3,-3,2,0,2,1,3,2,2,2,0,-3,-2,-2,-2,1,-2,-1,1,2,-1,1,2,3,3,2,2,0,1,2,1,0,2,-2,3,1,3,2,3,3,2,0,0,0,2,1,1,3,-2,3,1,3,6,4,6,8,7,8,3,3,2,4,4,4,1,1,1,1,3,1,1,2,0,3,1,1,0,1,0,0,0,0,1,5,1,3,2,2,2,4,2,0,1,2,0,1,1,1,0,1,0,2,2,0,1,1,1,1,0,0,1,1,1,2,1,1,2,2,1,0,1,1,1,0,1,1,1,2,2,0,4,0,2,1,3,1,0,2,2,0,0,0,0,2,0,1,0,0,1,1,0,0,0,0,buffer,1,0,0,0,3,0,1,0,-2,3,0,0,-1,0,0,0,-1,-1,0,3,0,2,0,0,1,4,1,-1,0,2,1,1,1,2,0,0,3,0,2,0,2,1,0,2,2,buffer,3,1,4,4,3,4,buffer,0.8,0.4,-0.2,0.2,0.6,1.2,1,1,1.4,buffer,2.666666667,3.666666667,0.333333333,0.666666667,1.133333333,buffer,2,3,2,1,1,2,1.4,1.4,0.6,1.2,2,1.8,0.6,1,0.8,1,1.4,0.6,1.4,1.4,1.6,0.4,0.4,0.2,buffer,grad_prof +345,R_7Vguppi4vDWHJQa,32 - 38,Canadian,Male,Male,High School (or equivalent),37,02PsVPf,01PAST,5,01ITEM,0,0,1,-2,2,2,2,1,-3,-2,3,-3,1,2,-3,3,-3,2,-2,3,2,-2,1,-3,0,3,-2,2,2,-3,3,-3,2,-2,3,2,-3,2,-3,1,3,-2,1,2,-3,3,-3,2,-2,3,2,1,2,-3,-3,3,-3,2,2,-3,3,-3,2,-2,3,3,2,1,-3,-2,3,-3,2,2,-3,3,-3,2,3,5,4,5,4,3,2,4,3,2,1,1,0,1,0,4,0,0,2,0,1,1,0,0,0,0,0,0,1,0,5,1,0,3,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,buffer,0,0,0,3,-1,0,1,0,1,0,0,0,0,0,0,0,0,-1,5,1,0,3,0,1,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,0,0,buffer,1,1,1,3,3,2,buffer,0.4,0.4,0,1,0.6,0,-0.2,0.2,0,buffer,1,2.666666667,0.266666667,0.533333333,0,buffer,2,1,1,0,3,2,1,0.8,0,1.4,0.8,0,0.6,0.4,0,0.4,0.2,0,0.4,0.4,0,0.6,0.2,0,buffer,HS_TS +346,R_5TPr9rXWAlXQRq1,18 - 24,Canadian,Male,Male,High School (or equivalent),23,01PfPsV,01PAST,10,01ITEM,0.375,1,0,3,3,3,2,2,3,3,2,-2,2,-1,0,3,1,2,-2,3,3,3,3,-1,2,-1,1,-1,-2,-1,1,3,1,-3,3,3,3,3,-1,1,-3,-1,-2,1,-2,-1,3,1,3,3,2,-1,2,3,1,3,-3,3,-1,-1,3,2,2,3,2,2,-2,2,3,1,3,-3,3,-1,0,3,2,3,8,7,8,9,7,8,9,9,9,9,9,9,5,0,0,1,1,4,1,3,3,3,1,1,2,2,1,6,0,0,1,1,4,2,5,1,4,2,2,4,2,1,0,0,1,3,0,0,2,1,1,1,0,1,0,1,0,0,1,1,4,0,0,2,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,2,2,1,3,1,2,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,buffer,5,0,-1,-2,1,4,-1,2,2,2,1,0,2,1,1,6,-1,-1,-3,1,4,0,4,0,3,2,2,4,1,0,1,-1,0,-1,0,0,1,2,2,1,3,0,2,0,-1,buffer,-1,-2,-1,0,-2,-1,buffer,0.6,1.8,1,0.4,2.2,1.8,-0.2,1.2,0.8,buffer,-1.333333333,-1,1.133333333,1.466666667,0.6,buffer,1,0,0,0,0,0,1.4,2.8,1.4,1.6,3.2,2.2,0.8,1,0.4,1.2,1,0.4,0.2,1.2,1.2,0.4,0,0.4,buffer,HS_TS +347,R_3370vjQWCja2Mfx,18 - 24,Canadian,Female,Female,High School (or equivalent),24,02PsVPf,01PAST,10,02DGEN,0.125,0,1,0,2,0,-2,-3,3,0,0,3,1,0,0,0,-1,3,-2,2,0,-2,-3,-3,2,-1,3,-3,0,-2,0,-2,3,1,2,0,-2,-3,-3,-2,0,3,-1,0,-2,0,-2,2,0,3,-2,-2,-3,-2,-2,0,1,0,0,-1,0,-1,3,0,3,0,-2,-2,-1,-2,0,-1,0,0,0,2,0,0,6,3,2,3,5,4,2,2,2,2,2,3,2,0,0,0,0,6,2,1,0,4,0,2,0,1,0,1,0,0,0,0,6,2,0,0,2,0,2,0,1,1,0,1,2,0,0,5,2,0,2,1,0,1,0,0,0,0,1,0,0,1,4,2,0,4,1,0,0,2,1,3,3,0,0,0,0,0,4,1,0,2,0,0,0,0,1,0,0,2,0,1,1,0,0,2,0,0,1,2,1,3,buffer,2,-1,-2,0,0,1,0,1,-2,3,0,1,0,1,0,1,-1,0,0,-1,2,0,0,-4,1,0,2,-2,0,-2,3,0,-2,0,-1,-1,4,1,-2,2,0,-1,-2,-1,-2,buffer,4,1,0,1,3,1,buffer,-0.2,0.6,0.4,-0.2,-0.2,-0.4,0,0.8,-1.2,buffer,1.666666667,1.666666667,0.266666667,-0.266666667,-0.133333333,buffer,3,2,2,0,0,1,0.4,2.6,0.6,0.2,2,0.8,0.6,2,0.2,0.4,2.2,1.2,0.6,1.4,0.2,0.6,0.6,1.4,buffer,HS_TS +348,R_1uUKWqT3KZOWwma,39 - 45,American,Male,Male,University - Graduate (Masters),42,03VPfPs,02FUT,5,01ITEM,1.75,0.666666667,0.333333333,2,3,2,3,2,2,3,1,2,2,3,2,3,2,2,2,3,2,2,3,1,3,2,3,2,2,3,2,3,2,3,2,2,3,2,2,2,3,2,3,1,2,2,2,3,3,2,2,3,2,2,3,2,2,1,3,2,3,2,2,2,3,3,3,2,2,3,2,3,3,2,2,3,2,3,8,8,8,8,6,7,10,9,9,10,10,10,0,0,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,2,0,1,2,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,2,1,0,0,0,1,buffer,-1,-1,0,1,1,1,0,0,1,-1,1,1,1,1,0,1,1,-1,0,0,0,1,1,-1,0,1,0,1,0,0,0,0,-1,1,1,1,1,1,0,-1,0,1,0,1,0,buffer,-2,-1,-1,-2,-4,-3,buffer,0,0.2,0.8,0.2,0.2,0.4,0.2,0.4,0.4,buffer,-1.333333333,-3,0.333333333,0.266666667,0.333333333,buffer,0,2,1,0,1,1,0.4,0.6,0.8,0.4,0.8,0.8,0.4,0.4,0,0.2,0.6,0.4,0.8,1,0.8,0.6,0.6,0.4,buffer,grad_prof +349,R_5f181Ig3WCVioBW,25 - 31,Canadian,Female,Female,Professional Degree (ex. JD/MD),29,01PfPsV,01PAST,10,02DGEN,0.375,0,1,2,3,3,0,1,3,0,2,2,2,-1,1,0,1,3,2,1,2,0,3,1,2,0,-1,0,0,2,1,0,1,1,0,2,1,1,0,2,1,0,0,0,1,2,0,1,3,1,3,1,2,0,2,1,2,1,0,1,1,0,2,0,2,3,2,1,0,3,2,1,2,2,3,1,0,2,8,7,8,6,6,7,9,8,7,7,7,8,0,2,1,0,2,2,2,2,3,2,1,1,1,1,2,1,3,1,1,0,3,2,1,2,2,1,0,2,1,2,1,2,0,1,1,3,2,1,0,1,1,0,1,1,1,2,1,0,2,0,3,3,0,1,0,3,2,1,1,1,1,1,0,1,2,1,0,1,1,0,0,1,1,0,0,3,1,0,1,1,0,1,1,1,1,2,2,0,0,0,buffer,-1,0,1,-1,1,-1,0,1,3,1,0,1,0,0,1,-1,2,1,-1,0,0,-1,1,1,2,-2,-2,1,0,1,-2,0,0,0,1,1,-1,0,0,-1,-2,-1,1,0,0,buffer,-1,-1,1,-1,-1,-1,buffer,0,0.8,0.4,0.2,0.6,-0.4,-0.2,-0.2,-0.4,buffer,-0.333333333,-1,0.4,0.133333333,-0.266666667,buffer,2,1,1,2,1,1,1,2.2,1.2,1.2,2,1.2,1,1.4,0.8,1,1.4,1.6,1,0.6,0.4,1.2,0.8,0.8,buffer,grad_prof +350,R_7PAVqMriqInQfXX,46 - 52,American,Male,Male,College Diploma/Certificate,49,02PsVPf,01PAST,5,01ITEM,-0.125,0,1,2,2,2,2,2,-3,1,2,1,2,-3,-3,2,-3,2,2,2,2,2,1,-3,2,-3,2,-3,-3,-3,2,-3,2,2,2,2,-3,2,-3,2,-3,2,-3,-3,-3,2,-3,2,2,2,2,2,2,-3,-3,2,-3,2,-3,-3,2,-3,2,2,2,2,2,2,-3,-3,2,-3,2,-3,-3,2,-3,2,0,9,10,0,10,0,0,10,0,10,10,7,0,0,0,0,1,0,1,5,1,5,0,0,0,0,0,0,0,0,5,0,0,1,5,1,5,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,0,0,0,0,0,0,0,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,-3,5,-3,5,0,0,0,0,0,0,0,0,5,0,0,-3,5,-3,5,0,0,0,0,0,0,0,0,5,1,0,0,0,0,0,0,0,0,0,0,buffer,0,-1,10,-10,0,-7,buffer,0.2,0.8,0,1,0.8,0,1.2,0,0,buffer,3,-5.666666667,0.333333333,0.6,0.4,buffer,0,1,10,10,0,7,0.2,2.4,0,1,2.4,0,0,1.6,0,0,1.6,0,1.2,0,0,0,0,0,buffer,C_Ug +351,R_18lvMg9J79PVPlD,25 - 31,Canadian,Female,Female,College Diploma/Certificate,25,03VPfPs,01PAST,10,01ITEM,0.5,0.333333333,0.666666667,2,2,1,1,0,1,2,1,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0,1,2,1,0,1,1,1,0,1,0,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,6,5,7,6,7,6,7,5,7,6,7,6,0,0,1,1,2,0,1,0,1,1,0,0,0,0,1,2,2,0,1,1,1,1,0,1,2,0,1,0,0,0,0,0,1,1,2,0,1,0,1,1,0,0,0,0,0,0,0,1,1,2,0,1,0,1,1,0,0,0,0,0,2,2,1,0,1,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,-1,0,-1,1,0,0,0,1,0,1,0,0,0,2,2,1,0,1,1,0,0,0,1,0,1,0,0,1,buffer,-1,0,0,0,0,0,buffer,0,0,0.2,0.4,0.4,0.2,1.2,0.4,0.4,buffer,-0.333333333,0,0.066666667,0.333333333,0.666666667,buffer,0,2,1,1,2,1,0.8,0.6,0.2,1.2,1,0.2,0.8,0.6,0,0.8,0.6,0,1.2,0.4,0.4,0,0,0,buffer,C_Ug +352,R_3zeAZ5ZzmZJ3eEi,39 - 45,American,Male,Male,College Diploma/Certificate,39,01PfPsV,02FUT,10,02DGEN,-0.125,0,1,2,3,3,2,3,1,-2,2,2,3,2,2,2,0,3,1,3,3,2,3,2,0,1,2,1,2,2,3,1,1,2,3,2,1,2,2,-1,1,-2,2,1,2,1,2,2,3,3,2,2,3,1,-1,3,-3,2,2,2,2,1,3,2,3,2,2,3,0,-2,2,-2,2,2,2,3,2,2,3,2,1,2,0,3,7,0,5,8,4,7,1,0,0,0,0,1,2,1,0,2,0,0,1,1,2,0,0,1,1,1,1,1,1,4,1,1,0,1,2,1,1,0,1,0,0,0,1,1,5,1,0,0,0,1,0,0,0,1,0,0,1,0,0,4,1,0,0,1,2,1,1,0,1,1,1,0,1,0,4,1,1,0,2,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,buffer,0,0,-1,0,0,1,1,0,-5,1,0,0,1,0,2,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,1,1,1,-1,0,-1,3,1,1,0,1,0,0,buffer,-4,2,-4,-6,-4,-4,buffer,-0.2,-0.4,0.6,0.4,0.4,0.2,0.6,0.4,0.4,buffer,-2,-4.666666667,-1.85E-17,0.333333333,0.466666667,buffer,1,2,2,1,4,2,0.2,1.2,0.8,0.6,1.6,1,0.4,1.6,0.2,0.2,1.2,0.8,0.8,1.2,1,0.2,0.8,0.6,buffer,C_Ug +353,R_55RVqMEaEBxgC1r,32 - 38,Canadian,Male,Male,Trade School (non-military),35,03VPfPs,02FUT,5,02DGEN,-0.125,0,1,-1,3,2,0,2,-2,2,-2,2,2,3,1,2,2,3,-1,3,2,0,2,-2,1,-2,2,1,3,2,0,2,3,-1,3,2,0,2,1,2,2,2,1,3,2,2,2,3,-1,3,2,0,3,-1,2,2,2,2,3,2,2,2,3,1,2,2,0,3,2,2,3,-1,2,3,2,2,2,3,3,2,9,1,1,1,1,1,1,8,9,5,0,0,0,0,0,0,1,0,0,1,0,1,2,0,0,0,0,0,0,0,3,0,4,0,1,0,1,0,0,0,0,0,0,0,1,1,0,4,0,0,0,1,0,0,0,2,1,0,0,1,4,0,5,3,0,0,1,0,0,0,0,0,0,0,0,3,1,4,0,0,0,0,2,0,0,2,1,0,0,0,3,0,1,3,0,0,0,0,0,0,buffer,0,0,0,0,-1,-1,1,-4,0,1,0,0,2,0,0,-2,-1,0,0,-1,-1,0,-1,-3,1,0,0,0,0,0,-2,-1,0,0,0,0,1,3,-3,0,0,0,2,0,0,buffer,2,1,8,-7,-8,-4,buffer,-0.2,-0.6,0.4,-0.8,-0.8,0,-0.6,0.2,0.4,buffer,3.666666667,-6.333333333,-0.133333333,-0.533333333,1.85E-17,buffer,2,1,8,7,8,4,0,0.4,0.6,0,1.6,0.2,0.2,1,0.2,0.8,2.4,0.2,0,1.6,0.4,0.6,1.4,0,buffer,HS_TS +354,R_5qWoDGBWCVqZjko,32 - 38,Canadian,Male,Male,University - Undergraduate,35,01PfPsV,01PAST,5,02DGEN,-0.25,0,1,-3,2,3,1,2,-3,-3,3,-3,-3,2,2,1,-1,2,-3,3,3,3,3,2,-3,2,-3,1,3,2,3,-3,3,-3,3,3,3,3,2,-3,3,-3,2,3,2,2,-3,2,-3,3,3,3,3,3,-3,2,-3,2,2,2,2,-3,2,-3,3,3,3,3,2,-3,3,-3,2,3,2,3,-3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,1,5,0,1,0,4,1,0,2,2,1,0,1,0,2,1,5,0,0,0,5,1,0,1,2,0,0,1,0,2,1,6,0,1,0,5,0,0,1,2,0,0,1,0,2,1,5,0,0,0,5,1,0,2,2,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,buffer,0,0,0,0,0,-1,0,0,0,-1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,1,-1,0,0,0,1,buffer,1,0,0,0,0,0,buffer,0,-0.4,0.6,0,0,-0.2,0,0,0,buffer,0.333333333,0,0.066666667,-0.066666667,0,buffer,1,0,0,0,0,0,0.8,2,1.2,0.8,2,0.8,0.8,2.4,0.6,0.8,2,1,0,0.4,0.4,0,0.4,0.4,buffer,C_Ug +355,R_7QE4sB8mWwkcHEJ,32 - 38,Canadian,Male,Male,University - Undergraduate,34,01PfPsV,02FUT,5,02DGEN,0.125,1,0,2,2,3,3,3,2,-2,2,-2,2,1,2,3,1,3,3,0,1,-1,1,-1,-1,-2,2,1,1,1,1,3,1,1,2,-1,-2,1,0,0,-2,3,2,2,3,-1,2,1,3,2,2,1,3,3,-3,3,-3,2,3,3,3,2,3,3,3,0,0,3,3,-3,3,-3,0,0,-1,3,3,3,4,6,7,6,6,5,8,7,2,2,1,2,1,2,2,4,2,3,1,4,4,1,0,1,2,2,2,1,0,4,5,2,2,2,4,5,0,1,1,4,1,2,1,0,1,2,0,1,1,1,1,0,2,1,0,1,0,1,1,3,3,0,1,1,1,1,2,1,3,0,2,0,2,2,2,1,0,1,1,0,1,1,1,2,2,1,0,0,1,2,1,0,0,0,0,0,2,3,4,0,1,0,buffer,0,2,1,2,2,2,0,3,3,1,-2,0,2,1,2,0,-1,1,2,2,1,1,3,4,-2,0,-2,4,-1,2,2,1,0,0,0,1,1,0,1,-1,-2,-2,2,0,0,buffer,-4,-1,5,4,5,3,buffer,1.4,1.8,0.6,0.8,1.4,0.6,0.6,0.4,-0.4,buffer,0,4,1.266666667,0.933333333,0.2,buffer,2,0,2,6,6,0,2.2,2.6,1.4,2.4,2.6,1.8,0.8,0.8,0.8,1.6,1.2,1.2,1.4,0.8,1.2,0.8,0.4,1.6,buffer,C_Ug +356,R_5EWo48oayclBSk9,39 - 45,American,Male,Male,University - Undergraduate,41,03VPfPs,01PAST,10,01ITEM,0,0.333333333,0.666666667,3,3,1,1,3,1,-3,2,-2,2,1,2,1,2,2,1,2,0,-1,0,1,-3,0,-2,-2,1,1,1,1,1,1,3,3,2,0,2,-3,-1,1,0,2,2,2,2,2,3,1,0,2,3,-3,-3,3,3,1,3,1,2,2,3,3,2,1,2,3,0,-3,2,2,1,1,2,1,1,1,6,6,5,8,6,1,3,2,4,8,1,2,2,1,1,2,3,0,0,2,0,4,0,1,0,1,1,2,0,2,1,3,1,0,3,3,2,1,0,1,0,0,0,2,1,1,0,4,0,1,5,1,2,1,1,0,1,0,1,0,1,0,1,0,0,4,1,0,0,0,1,1,0,1,3,3,0,1,0,1,3,2,1,1,1,1,1,0,1,1,0,0,3,0,1,1,0,2,1,1,1,2,buffer,2,-1,0,1,3,-4,0,1,-5,3,-2,0,-1,1,0,2,-1,2,0,3,0,0,3,-1,1,1,0,1,-1,-1,0,0,2,3,0,-2,0,0,2,2,-1,0,0,0,-1,buffer,3,4,1,0,5,-1,buffer,1,-1,-0.4,1.2,0.6,0,1,0.4,-0.4,buffer,2.666666667,1.333333333,-0.133333333,0.6,0.333333333,buffer,2,0,4,5,1,2,1.8,1.2,0.6,1.6,1.8,0.4,0.8,2.2,1,0.4,1.2,0.4,1.4,1.4,1,0.4,1,1.4,buffer,C_Ug +357,R_7GE6LxrC5CIjgh4,32 - 38,American,Female,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,01ITEM,0.5,0,1,-3,1,3,-3,3,-3,0,2,0,2,1,2,3,1,3,-3,3,3,-3,-1,-3,-3,3,-3,3,3,2,3,1,3,0,1,1,-2,0,-2,-1,0,-2,-2,-2,0,0,-1,0,0,3,3,-3,3,0,2,3,2,3,2,0,-1,-2,2,-3,1,2,-3,3,2,2,3,2,3,3,3,-1,0,0,0,0,0,3,4,4,0,5,5,4,7,6,0,2,0,0,4,0,3,1,3,1,2,0,0,0,0,3,0,2,1,3,1,1,2,2,4,3,2,3,2,3,3,2,0,0,0,3,2,1,2,1,1,2,4,3,1,0,0,1,0,0,5,2,1,2,1,2,1,4,1,3,3,2,2,1,1,1,2,3,1,5,5,2,3,2,3,3,2,1,0,0,2,0,0,0,0,1,3,0,2,2,buffer,-3,0,0,0,4,-3,1,0,1,0,1,-2,-4,-3,-1,3,0,1,1,3,-4,-1,1,0,3,1,1,-1,1,0,0,0,1,1,1,-1,2,3,1,5,4,-1,3,0,1,buffer,0,-5,-5,-1,-3,-2,buffer,0.2,-0.2,-1.8,1.6,-0.2,0.4,0.6,2,1.4,buffer,-3.333333333,-2,-0.6,0.6,1.333333333,buffer,3,4,4,4,2,1,1.2,1.6,0.4,1.8,2,2.6,1,1.8,2.2,0.2,2.2,2.2,1.8,2.4,3,1.2,0.4,1.6,buffer,C_Ug +358,R_79ywJx01HSExAxb,46 - 52,American,Male,Male,University - Graduate (Masters),48,01PfPsV,01PAST,10,02DGEN,0.5,0,1,2,3,2,0,3,1,2,3,-1,3,1,-2,3,1,1,2,1,1,1,3,3,3,2,2,3,2,-2,3,3,0,0,2,0,-2,3,3,1,1,1,-2,1,0,2,2,0,2,3,2,2,3,0,1,2,0,2,2,3,2,-1,1,3,3,2,2,3,0,-1,1,0,1,2,0,1,-1,1,7,5,7,7,5,6,5,5,6,6,6,5,0,2,1,1,0,2,1,1,3,0,1,0,0,2,1,2,1,2,2,0,2,1,2,2,5,0,2,1,1,1,0,0,0,2,0,1,1,1,1,1,1,5,1,2,0,1,0,0,2,0,1,3,2,1,2,1,2,2,2,0,2,1,1,3,0,0,2,1,1,5,1,2,1,1,0,1,0,0,0,0,0,2,1,0,1,0,3,1,0,0,buffer,0,2,1,-1,0,1,0,0,2,-1,0,-5,-1,0,1,1,1,2,0,0,1,-2,0,1,3,-1,0,-1,-1,1,1,1,1,3,0,0,0,0,1,4,1,-1,0,1,0,buffer,2,0,1,1,-1,1,buffer,0.4,0.4,-1,0.8,0.6,-0.4,1.2,1,0.2,buffer,1,0.333333333,-0.066666667,0.333333333,0.8,buffer,0,0,1,1,1,1,0.8,1.4,0.8,1.4,2.4,1,0.4,1,1.8,0.6,1.8,1.4,1.4,1.8,1,0.2,0.8,0.8,buffer,grad_prof +359,R_7LSevVCtjQKhCLx,32 - 38,American,Male,Male,College Diploma/Certificate,35,01PfPsV,02FUT,5,02DGEN,1.375,0,0.333333333,2,0,1,3,2,0,0,0,-2,-2,0,1,1,1,1,-1,2,3,2,1,1,1,0,1,0,0,0,1,1,1,3,2,2,-1,1,1,1,0,1,0,0,1,1,0,1,1,0,1,2,-3,1,1,1,1,0,1,1,1,0,1,3,-3,3,0,-1,1,-1,0,1,1,0,0,1,1,1,5,4,10,6,6,6,8,5,4,8,6,5,3,2,2,1,1,1,1,0,3,2,0,1,0,0,0,1,2,1,4,1,1,1,0,3,2,0,0,0,1,0,1,0,0,1,5,1,1,1,3,2,1,0,0,1,0,1,3,2,3,3,1,1,0,3,3,0,1,0,0,0,4,0,1,3,0,0,0,0,0,0,0,1,0,1,0,2,3,2,2,2,0,2,1,0,1,1,1,0,1,0,buffer,2,2,2,0,-4,0,0,-1,0,0,-1,1,0,-1,0,0,-1,-1,1,-2,0,0,0,0,-1,0,-1,0,1,0,2,-3,-1,1,-2,0,-2,-1,0,-1,-1,0,0,0,0,buffer,-3,-1,6,-2,0,1,buffer,0.4,-0.2,-0.2,-0.6,-0.2,0,-0.6,-0.8,-0.2,buffer,0.666666667,-0.333333333,0,-0.266666667,-0.533333333,buffer,1,2,4,0,1,1,1.8,1.4,0.2,1.8,1.4,0.2,1.4,1.6,0.4,2.4,1.6,0.2,1.6,0,0.4,2.2,0.8,0.6,buffer,C_Ug +360,R_7FbNtQGpMeytU77,39 - 45,American,Female,Female,University - Graduate (Masters),42,03VPfPs,02FUT,10,01ITEM,0.75,0,1,2,3,3,3,2,2,3,2,-2,1,2,3,2,3,3,3,3,2,3,2,2,2,3,-3,2,3,1,2,2,2,2,3,3,3,2,3,3,2,2,3,2,2,3,-1,2,3,3,2,2,2,2,2,3,2,1,2,3,2,3,3,2,2,3,3,1,3,2,3,-2,2,3,3,2,2,2,0,0,0,0,0,2,4,3,6,8,5,10,1,0,1,0,0,0,1,1,1,1,1,2,0,1,1,0,0,0,0,0,1,0,0,4,2,0,1,1,4,1,1,0,1,1,0,0,1,1,4,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,0,1,0,0,1,1,1,5,1,1,1,1,3,0,1,1,1,1,1,1,0,0,4,1,1,0,0,1,1,buffer,0,0,0,-1,0,0,0,0,-3,1,1,2,0,1,1,0,-1,0,0,-1,0,-1,-1,4,1,-1,1,1,3,0,0,-1,0,-1,-1,0,1,1,1,0,0,1,1,2,-1,buffer,-4,-3,-6,-8,-5,-8,buffer,-0.2,-0.4,1,-0.4,0.6,0.8,-0.6,0.6,0.6,buffer,-4.333333333,-7,0.133333333,0.333333333,0.2,buffer,0,0,2,4,2,4,0.4,0.8,1,0,1.4,1.4,0.6,1.2,0,0.4,0.8,0.6,0.4,1.8,1.2,1,1.2,0.6,buffer,grad_prof +361,R_1sR6SkLrTXmFvBZ,46 - 52,American,Female,Female,University - Undergraduate,46,02PsVPf,01PAST,10,01ITEM,0.25,0,1,2,2,1,1,1,-1,1,2,-1,1,1,-1,2,-1,2,2,2,1,1,1,-1,1,1,-1,1,1,1,2,-1,1,2,2,2,2,1,-1,1,2,-1,1,1,1,2,1,1,2,2,1,1,2,-1,-1,1,-1,1,0,1,1,-1,2,2,2,1,1,2,-1,-1,2,-2,1,0,1,2,-1,1,5,6,5,4,6,8,5,5,5,4,4,5,0,0,0,0,0,0,0,1,0,0,0,2,0,0,1,0,0,1,1,0,0,0,0,0,0,0,2,0,2,1,0,0,0,0,1,0,2,1,0,0,1,2,1,0,0,0,0,0,0,1,0,2,0,1,0,1,2,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,buffer,0,0,0,0,-1,0,-2,0,0,0,-1,0,-1,0,1,0,0,1,1,-1,0,-2,0,-1,0,-1,0,0,2,0,0,0,1,1,0,0,0,0,-1,0,0,0,-1,2,-1,buffer,0,1,0,0,2,3,buffer,-0.2,-0.4,-0.2,0.2,-0.6,0.2,0.4,-0.2,0,buffer,0.333333333,1.666666667,-0.266666667,-0.066666667,0.066666667,buffer,1,0,3,1,1,0,0,0.2,0.6,0.4,0,1,0.2,0.6,0.8,0.2,0.6,0.8,0.4,0.2,0.4,0,0.4,0.4,buffer,C_Ug +362,R_5ZUNfu9DaX8alhH,25 - 31,Canadian,Female,Female,College Diploma/Certificate,29,03VPfPs,01PAST,10,01ITEM,0,0,0.666666667,3,2,2,-1,3,-1,-1,-1,-1,-1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,2,2,1,2,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,5,6,7,6,6,5,7,6,6,6,6,4,2,1,1,2,2,2,2,2,2,2,0,0,0,1,1,3,2,2,1,3,2,2,2,2,2,0,1,0,0,1,1,0,1,3,2,3,3,3,3,3,0,0,0,1,1,3,2,2,1,3,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,2,2,1,2,1,2,2,2,2,2,0,0,0,0,0,buffer,1,1,0,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,-1,0,-1,-1,0,-1,0,-2,-2,-2,-2,-2,0,1,0,1,0,buffer,-2,0,1,0,0,1,buffer,0.2,-1,0,0,1,0,-0.6,-2,0.4,buffer,-0.333333333,0.333333333,-0.266666667,0.333333333,-0.733333333,buffer,1,0,2,1,0,2,1.6,2,0.4,2.2,2,0.4,1.4,3,0.4,2.2,1,0.4,1,0,0.4,1.6,2,0,buffer,C_Ug +363,R_3WowcOSNUaoH2BH,46 - 52,American,Male,Male,University - Undergraduate,47,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,3,3,3,1,-3,-3,-3,3,3,1,3,-3,3,-3,3,1,3,3,3,-3,-3,-1,3,3,1,3,-3,3,-3,3,3,3,3,3,-3,-1,-3,1,3,1,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,3,1,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,3,1,3,-3,3,-3,3,2,7,2,2,6,2,2,2,2,2,2,2,2,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,2,0,0,0,0,2,2,2,0,0,0,0,0,0,0,buffer,0,5,0,0,4,0,buffer,0.4,0.4,0,0,0.8,0,0.4,1.2,0,buffer,1.666666667,1.333333333,0.266666667,0.266666667,0.533333333,buffer,0,1,0,0,0,0,0.8,0.4,0,0.4,0.8,0,0.4,0,0,0.4,0,0,0.4,1.2,0,0,0,0,buffer,C_Ug +364,R_3OruJppc3NY5hRr,25 - 31,Canadian,Male,Male,University - PhD,25,02PsVPf,01PAST,10,02DGEN,0.75,1,0,0,-2,-1,-1,0,0,-3,-1,-1,-1,-3,-3,-1,-3,0,1,-2,-3,-1,0,-3,-1,-2,0,0,-2,-2,-1,-3,-1,0,-1,0,-3,0,-1,-2,-3,-2,0,-1,-3,-1,-2,-2,-2,-2,2,2,2,-1,0,0,0,-2,-2,0,1,0,0,1,-1,-1,-3,1,-1,-1,0,1,0,-1,1,1,0,-3,5,7,5,3,5,4,9,6,6,10,9,5,1,0,2,0,0,3,2,1,1,1,1,1,0,0,1,0,1,1,2,0,1,1,2,1,1,2,0,0,1,2,2,0,3,3,2,1,3,1,1,1,1,3,2,3,0,1,1,0,2,1,1,2,1,2,1,2,4,2,3,3,1,1,3,2,0,2,1,1,2,0,1,1,0,1,1,3,1,3,5,1,0,1,0,1,2,1,1,0,0,3,buffer,-1,0,-1,-3,-2,2,-1,0,0,0,0,-2,-2,-3,1,-1,0,1,0,-1,0,-1,1,-1,0,0,-4,-2,-2,-1,-2,0,0,-3,-1,2,0,1,1,-2,0,0,0,1,-2,buffer,-4,1,-1,-7,-4,-1,buffer,-1.4,0.2,-1.2,-0.2,-0.2,-1.8,-1.2,0.4,-0.2,buffer,-1.333333333,-4,-0.8,-0.733333333,-0.333333333,buffer,2,2,1,1,3,1,0.6,1.6,0.6,0.8,1.2,1,2,1.4,1.8,1,1.4,2.8,1.4,1.2,0.8,2.6,0.8,1,buffer,grad_prof +365,R_7pAaC1pJW61RQad,53 - 59,American,Male,Male,University - Graduate (Masters),58,03VPfPs,02FUT,5,01ITEM,-0.375,0,1,2,3,3,3,3,0,1,2,-1,3,1,0,3,2,3,2,3,3,2,3,-2,1,3,1,3,1,3,3,2,3,2,3,3,1,3,-2,2,3,2,3,1,-2,3,2,3,-1,3,3,2,3,-1,-1,3,-1,3,2,-1,3,2,3,-2,3,3,2,3,-2,-2,3,-2,3,2,-1,3,1,3,3,4,4,2,2,2,5,5,2,3,8,4,0,0,0,1,0,2,0,1,2,0,0,3,0,0,0,0,0,0,2,0,2,1,1,3,0,0,2,0,0,0,3,0,0,1,0,1,2,1,0,0,1,1,0,0,0,4,0,0,1,0,2,3,1,1,0,1,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,5,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,0,buffer,-3,0,0,0,0,1,-2,0,2,0,-1,2,0,0,0,-4,0,0,1,0,0,-2,0,2,0,-1,1,0,-1,0,-1,0,0,1,0,-1,0,0,0,0,0,5,0,-1,0,buffer,-2,-1,2,-1,-6,-2,buffer,-0.6,0.2,0.2,-0.6,0,-0.2,0,-0.2,0.8,buffer,-0.333333333,-3,-0.066666667,-0.266666667,0.2,buffer,1,2,2,2,3,2,0.2,1,0.6,0.4,1.4,0.4,0.8,0.8,0.4,1,1.4,0.6,0.2,0.4,1,0.2,0.6,0.2,buffer,grad_prof +366,R_7PMo5HLzFMci0s8,25 - 31,American,Male,Male,High School (or equivalent),25,01PfPsV,02FUT,5,02DGEN,-0.75,0,1,-3,3,3,3,0,0,-3,2,-3,1,3,3,3,2,3,-3,3,3,3,0,0,-3,3,-3,2,3,3,3,3,3,-3,3,3,3,0,0,-3,3,-3,2,3,3,3,2,3,-3,2,3,3,0,0,-3,3,-3,0,3,3,3,2,3,-3,3,3,3,0,0,-3,3,-3,0,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,-1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0.2,0,0,-0.2,-0.2,0,0,buffer,0,0,0,-0.066666667,-0.066666667,buffer,0,0,0,0,0,0,0,0.4,0.2,0,0.4,0,0.2,0.4,0,0,0.4,0.2,0,0,0.2,0.2,0,0.2,buffer,HS_TS +367,R_3HFFvxOBPNYGCrm,46 - 52,American,Male,Male,University - Graduate (Masters),48,02PsVPf,01PAST,10,01ITEM,0.875,0.333333333,0.666666667,1,2,2,3,2,0,2,1,2,2,1,2,1,2,1,2,3,2,2,2,2,1,3,3,2,2,3,3,2,3,2,1,2,2,3,3,2,2,1,2,3,1,2,2,2,2,2,3,2,3,3,2,2,2,2,3,2,1,2,2,2,3,2,2,2,3,2,1,2,2,3,2,3,2,2,9,9,9,9,10,10,9,9,8,9,9,9,1,1,0,1,0,2,1,2,1,0,1,1,2,0,2,1,1,0,1,1,3,0,1,1,0,2,1,1,0,1,1,0,1,1,1,3,0,1,0,0,2,0,0,0,1,1,1,0,1,0,3,0,0,0,0,2,0,2,0,1,0,2,0,0,1,1,1,1,2,0,1,2,1,0,1,0,1,1,0,1,0,0,1,0,0,0,0,2,0,0,buffer,0,1,-1,0,-1,-1,1,1,1,0,-1,1,2,0,1,0,0,0,0,1,0,0,1,1,0,0,1,-1,0,0,0,1,-1,0,0,1,1,0,2,0,1,2,-1,0,1,buffer,0,0,1,0,1,1,buffer,-0.2,0.4,0.6,0.2,0.4,0,0,0.8,0.6,buffer,0.333333333,0.666666667,0.266666667,0.2,0.466666667,buffer,0,1,1,0,0,1,0.6,1.2,1.2,0.8,1,1,0.8,0.8,0.6,0.6,0.6,1,0.6,1,1,0.6,0.2,0.4,buffer,grad_prof +368,R_594ZBusw8KrQgVf,39 - 45,American,Female,Female,College Diploma/Certificate,42,03VPfPs,02FUT,5,01ITEM,-0.25,0,1,3,3,2,1,0,1,-1,3,1,1,2,-2,3,0,3,3,3,3,1,1,3,-1,3,1,3,1,-3,3,0,3,3,3,3,1,1,3,-2,3,1,3,1,-3,3,1,3,3,3,2,1,1,3,-1,3,1,3,1,-3,3,1,3,3,3,2,1,1,3,-2,3,2,3,1,-3,3,1,3,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,1,2,0,0,0,2,1,1,0,0,0,0,0,1,0,1,2,1,0,0,2,1,1,0,1,0,0,0,0,0,1,2,0,0,0,2,1,1,0,1,0,0,0,0,0,1,2,1,0,1,2,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,buffer,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,buffer,-1,-1,0,0,0,0,buffer,0.2,0,-0.2,0.2,-0.2,0,0,-0.2,0.2,buffer,-0.666666667,0,0,0,0,buffer,0,0,0,1,1,0,0.4,0.8,0.4,0.4,1,0.6,0.2,0.8,0.6,0.2,1.2,0.6,0,0.2,0.2,0,0.4,0,buffer,C_Ug +369,R_1Vw2t2h7mFWUm6a,46 - 52,American,Male,Male,University - Graduate (Masters),50,03VPfPs,01PAST,5,01ITEM,1.375,1,0,3,3,3,1,3,3,3,2,3,2,3,3,3,3,2,2,3,1,2,3,2,1,3,2,1,2,3,3,3,3,1,2,2,3,3,3,2,2,3,2,3,1,3,2,3,2,2,1,3,2,3,2,2,2,3,2,2,2,3,1,3,3,3,2,2,2,3,3,2,2,2,2,3,2,3,8,6,10,4,5,5,6,6,4,3,1,5,1,0,2,1,0,1,2,1,1,1,1,0,0,0,1,2,1,1,2,0,0,1,0,0,0,0,2,0,1,1,1,1,2,2,1,0,1,0,1,1,1,1,1,0,1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,2,0,1,0,1,1,2,1,0,1,1,1,0,1,0,0,1,1,2,buffer,0,-1,0,-1,-1,1,1,1,0,0,0,-1,-1,0,0,2,1,1,1,-1,-1,1,-1,-1,0,-1,1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,2,-1,0,-2,buffer,2,0,6,1,4,0,buffer,-0.6,0.6,-0.4,0.8,-0.4,0,-0.2,0.2,0,buffer,2.666666667,1.666666667,-0.133333333,0.133333333,0,buffer,4,1,5,3,5,1,0.8,1.2,0.4,1.2,0.2,0.8,1.4,0.6,0.8,0.4,0.6,0.8,0.8,1,0.8,1,0.8,0.8,buffer,grad_prof +370,R_7KC4faGfHitNseM,25 - 31,American,Male,Male,University - Undergraduate,27,01PfPsV,01PAST,10,01ITEM,1.375,0,1,2,3,3,3,3,3,-1,3,1,3,3,3,3,3,3,2,1,3,3,-1,2,3,3,-1,2,3,3,3,3,-1,3,-2,3,2,1,-1,2,3,-2,2,3,3,2,3,2,1,3,2,3,2,3,-1,3,3,2,3,1,3,1,2,3,-1,3,2,3,2,2,3,3,3,2,2,2,3,3,9,7,10,7,3,9,5,9,10,7,8,8,0,2,0,0,4,1,4,0,2,1,0,0,0,0,4,1,5,0,1,2,4,3,0,3,1,0,0,1,0,1,1,0,1,0,1,0,0,0,2,1,0,2,0,2,1,1,4,0,1,0,1,3,0,2,0,1,1,1,0,0,1,3,0,1,2,3,1,0,1,0,0,0,1,0,3,2,4,1,1,1,1,3,0,0,1,1,1,1,2,1,buffer,-1,2,-1,0,3,1,4,0,0,0,0,-2,0,-2,3,0,1,0,0,2,3,0,0,1,1,-1,-1,0,0,1,-1,-1,-1,0,1,2,-2,0,1,-1,-1,-1,0,-2,2,buffer,4,-2,0,0,-5,1,buffer,0.6,1,-0.2,0.6,1,-0.2,-0.4,0,-0.4,buffer,0.666666667,-1.333333333,0.466666667,0.466666667,-0.266666667,buffer,2,4,1,2,1,2,1.2,1.6,0.8,1.8,2.2,0.4,0.6,0.6,1,1.2,1.2,0.6,1.4,1,0.8,1.8,1,1.2,buffer,C_Ug +371,R_1hhgqMOYXxS8hXD,25 - 31,American,Male,Male,University - Graduate (Masters),31,03VPfPs,02FUT,5,02DGEN,-0.25,1,0,0,1,2,-2,2,-2,2,3,-2,3,1,-2,3,-2,2,0,0,0,-2,1,-2,2,2,-2,2,1,-2,2,0,0,0,-1,0,-2,0,-2,2,2,-2,2,2,-2,2,0,0,2,0,2,-2,2,-1,1,2,-2,2,0,-3,3,-2,2,2,1,2,-2,3,-1,2,2,-2,3,0,-3,3,-2,2,2,2,2,2,2,2,2,2,1,2,2,2,0,1,2,0,1,0,0,1,0,1,0,0,1,2,2,0,2,2,0,2,0,0,1,0,1,1,0,1,2,2,2,1,0,0,0,1,1,1,0,1,1,1,0,0,0,2,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,buffer,-2,0,2,0,1,-1,-1,0,0,0,-1,-1,1,2,2,-2,2,2,0,1,-1,0,0,0,1,0,-1,1,2,2,0,0,0,0,0,0,-1,0,0,-1,1,0,0,0,0,buffer,0,0,1,0,0,0,buffer,0.2,-0.4,0.6,0.6,0,0.8,0,-0.4,0.2,buffer,0.333333333,0,0.133333333,0.466666667,-0.066666667,buffer,0,0,0,0,0,1,0.8,0.4,1,1.2,0.4,1.2,0.6,0.8,0.4,0.6,0.4,0.4,0.4,0,0.2,0.4,0.4,0,buffer,grad_prof +372,R_3iP3ScRISYbz83v,32 - 38,American,Male,Male,University - Graduate (Masters),35,01PfPsV,02FUT,10,02DGEN,1,0,1,3,3,2,3,3,3,2,3,1,2,2,2,2,3,2,3,3,2,2,2,2,2,3,3,3,2,3,2,3,2,3,2,2,3,2,2,3,3,3,2,2,3,2,3,2,2,3,2,2,3,3,2,2,2,3,2,2,2,3,2,3,3,3,2,2,2,3,2,2,2,2,2,2,3,2,8,9,9,8,9,8,8,8,8,7,10,7,0,0,0,1,1,1,0,0,2,1,0,1,0,0,0,0,1,0,0,1,1,1,0,2,0,0,1,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,buffer,-1,0,0,0,1,1,0,-1,1,0,0,1,0,0,0,0,1,-1,-1,0,0,0,-1,1,0,0,1,0,0,0,-1,1,-1,1,-1,-1,0,0,0,0,0,0,0,0,0,buffer,0,1,1,1,-1,1,buffer,0,0.2,0.2,-0.2,0,0.2,-0.2,-0.2,0,buffer,0.666666667,0.333333333,0.133333333,0,-0.133333333,buffer,0,0,1,1,2,1,0.4,0.8,0.2,0.4,0.8,0.2,0.4,0.6,0,0.6,0.8,0,0.4,0.4,0,0.6,0.6,0,buffer,grad_prof +373,R_7GdmjQHboGhWWSY,46 - 52,American,Male,Male,University - Undergraduate,47,03VPfPs,02FUT,10,01ITEM,0.25,0,1,2,3,1,0,-1,0,2,2,2,2,-1,1,2,-2,1,2,3,2,2,-1,0,2,2,2,2,-2,2,2,-2,2,2,3,1,2,-1,0,2,2,2,2,-2,1,2,-3,2,2,2,1,0,0,0,2,2,2,2,-2,2,2,-2,2,2,2,1,0,0,0,1,1,2,1,-2,1,2,-2,2,2,2,2,1,2,2,2,2,2,3,2,3,0,0,1,2,0,0,0,0,0,0,1,1,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0,buffer,0,-1,1,2,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,2,-1,0,-1,-1,0,-1,0,0,0,1,0,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,1,0,buffer,0,0,0,-2,0,-1,buffer,0.2,0,0,0,-0.6,0.2,0.2,-0.6,0.2,buffer,0,-1,0.066666667,-0.133333333,-0.066666667,buffer,1,0,0,1,0,1,0.6,0,0.6,0.4,0,0.6,0.4,0,0.6,0.4,0.6,0.4,0.2,0,0.4,0,0.6,0.2,buffer,C_Ug +374,R_6yjyJGo63gxtsRm,32 - 38,American,Male,Male,College Diploma/Certificate,35,02PsVPf,02FUT,10,01ITEM,1.75,0.666666667,0.333333333,2,3,3,2,1,-1,-2,3,0,0,1,-1,-1,1,1,1,2,1,3,3,3,2,3,3,3,1,3,2,2,3,2,3,2,1,3,1,3,3,3,3,3,3,3,2,3,3,1,1,3,3,3,3,1,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,1,3,1,3,3,3,10,10,10,10,9,9,8,5,9,10,9,8,1,1,2,1,2,4,4,0,3,3,0,4,3,1,2,0,0,1,1,2,2,5,0,3,3,2,4,4,1,2,1,2,2,1,2,4,5,2,3,3,2,4,4,2,1,1,1,0,1,2,4,5,0,3,1,2,2,4,2,2,1,1,1,2,0,2,1,0,0,0,2,0,1,0,0,0,1,2,0,0,0,0,2,0,2,0,2,0,0,1,buffer,0,-1,0,0,0,0,-1,-2,0,0,-2,0,-1,-1,1,-1,-1,1,0,0,-2,0,0,0,2,0,2,0,-1,0,1,0,-1,2,0,2,1,-2,0,-2,2,-2,1,0,-1,buffer,2,5,1,0,0,1,buffer,-0.2,-0.6,-0.6,-0.2,0,0.2,0.4,-0.2,0,buffer,2.666666667,0.333333333,-0.466666667,0,0.066666667,buffer,0,1,1,2,4,1,1.4,2.8,2,0.8,2.6,2.6,1.6,3.4,2.6,1,2.6,2.4,1,0.6,0.6,0.6,0.8,0.6,buffer,C_Ug +375,R_3FfUCdiMXQdU09F,32 - 38,American,Male,Male,University - Graduate (Masters),38,03VPfPs,01PAST,5,02DGEN,0.5,1,0,2,2,2,2,2,NA,-2,2,-2,2,3,3,3,0,3,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,0,-2,2,-2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,NA,4,0,4,0,1,1,1,0,1,0,0,0,0,0,NA,0,0,0,0,1,1,1,2,1,0,0,0,0,0,NA,0,0,0,0,1,1,1,2,1,0,0,0,0,0,NA,0,0,0,0,1,1,1,2,1,0,0,0,0,0,2,4,0,4,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,NA,4,0,4,0,0,0,0,-2,0,0,0,0,0,0,NA,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,0,4,0,0,0,0,2,0,buffer,0,0,0,0,0,0,buffer,0,2,-0.4,0,0,0,0,2,0.4,buffer,0,0,0.533333333,0,0.8,buffer,0,0,0,0,0,0,0,2,0.8,0,0,1.2,0,0,1.2,0,0,1.2,0,2,0.4,0,0,0,buffer,grad_prof +376,R_1xTXIFJAYsto83D,25 - 31,Canadian,Male,Male,University - Undergraduate,27,02PsVPf,01PAST,5,02DGEN,0,0.666666667,0.333333333,1,2,2,3,2,2,2,2,2,2,2,2,3,1,2,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,3,3,2,3,3,1,2,3,3,3,3,3,3,2,3,3,2,2,3,3,3,3,1,5,5,2,3,1,7,3,8,8,5,6,1,1,1,0,1,1,1,1,1,1,1,1,0,2,1,0,0,1,1,0,1,1,1,1,1,1,1,0,2,1,2,1,1,1,0,0,1,1,1,1,0,1,0,0,0,2,1,1,0,1,1,0,1,1,0,0,1,0,2,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,2,1,buffer,-1,0,0,-1,1,1,0,0,0,0,1,0,0,2,1,-2,-1,0,1,-1,0,1,0,0,1,1,0,0,0,0,1,1,2,0,0,-1,-1,0,0,-1,0,0,0,-2,-1,buffer,-6,2,-3,-6,-2,-5,buffer,-0.2,0.2,0.8,-0.6,0.4,0.2,0.8,-0.6,-0.6,buffer,-2.333333333,-4.333333333,0.266666667,1.85E-17,-0.133333333,buffer,1,2,4,1,2,2,0.8,1,1,0.4,1,1,1,0.8,0.2,1,0.6,0.8,1.2,0,0,0.4,0.6,0.6,buffer,C_Ug +377,R_39rm2f2Kp8eAy8p,25 - 31,Canadian,Male,Male,Professional Degree (ex. JD/MD),25,02PsVPf,01PAST,10,01ITEM,0.25,0.333333333,0.666666667,2,2,2,2,2,2,1,1,-1,2,1,-1,2,1,-1,1,0,1,0,-1,1,-1,1,0,1,1,1,1,0,1,2,1,1,1,2,2,-1,1,0,-1,1,1,1,1,-1,1,1,-1,-1,2,1,0,0,1,1,-1,1,-1,1,0,1,1,-1,-1,1,1,1,0,0,-1,-1,1,1,-1,0,9,8,8,8,7,8,8,6,7,8,8,8,1,2,1,2,3,1,2,0,1,1,0,2,1,1,2,0,1,1,1,0,0,2,0,1,3,0,2,1,0,0,1,1,3,3,0,1,1,1,2,1,2,2,3,0,1,1,1,3,3,1,1,0,1,1,3,2,2,1,2,1,1,1,0,1,3,1,0,0,0,2,0,0,0,1,2,0,0,0,0,1,0,1,0,1,2,0,0,2,2,0,buffer,0,1,-2,-1,3,0,1,-1,-1,0,-2,0,-2,1,1,-1,0,-2,-2,-1,-1,2,-1,0,0,-2,0,0,-2,-1,1,1,0,1,2,1,-1,0,-1,0,0,0,-2,-1,2,buffer,1,2,1,0,-1,0,buffer,0.2,-0.2,-0.4,-1.2,0,-1,1,-0.2,-0.2,buffer,1.333333333,-0.333333333,-0.133333333,-0.733333333,0.2,buffer,1,1,0,0,2,1,1.8,1,1.2,0.6,1.2,0.6,1.6,1.2,1.6,1.8,1.2,1.6,1.2,0.6,0.6,0.2,0.8,0.8,buffer,grad_prof +378,R_61hV6iQUShiPsbN,32 - 38,Canadian,Male,Male,College Diploma/Certificate,36,03VPfPs,01PAST,10,02DGEN,0.5,0,1,3,3,3,1,3,1,0,2,1,-1,0,1,3,2,3,2,1,-1,2,3,-1,0,1,2,1,1,0,-2,2,2,0,3,2,-1,1,2,0,1,-2,3,-3,-3,1,-2,-1,3,3,3,0,3,1,1,2,-1,3,2,3,3,3,3,3,3,3,-2,3,1,1,3,-2,3,1,2,3,2,3,5,5,4,7,7,6,2,3,6,6,6,8,1,2,4,1,0,2,0,1,1,2,1,1,5,0,1,3,0,1,2,2,1,0,1,3,4,3,4,2,4,4,0,0,0,1,0,0,1,0,2,4,2,2,0,1,0,0,0,0,3,0,0,1,1,3,4,1,1,0,0,0,2,2,3,3,2,3,0,0,4,2,4,3,3,4,3,0,0,0,2,0,0,0,1,1,0,1,1,0,1,0,buffer,1,2,4,0,0,2,-1,1,-1,-2,-1,-1,5,-1,1,3,0,1,-1,2,1,-1,0,0,0,2,3,2,4,4,2,2,3,1,2,3,0,-1,3,2,3,2,3,3,3,buffer,3,2,-2,1,1,-2,buffer,1.4,-0.2,0.6,1,0,3,2,1.4,2.8,buffer,1,0,0.6,1.333333333,2.066666667,buffer,2,2,2,4,3,2,1.6,1.2,1.6,1.6,1.8,3.4,0.2,1.4,1,0.6,1.8,0.4,2.4,1.8,3.4,0.4,0.4,0.6,buffer,C_Ug +379,R_3iIJRF71Jwue5Ql,25 - 31,American,Male,Male,College Diploma/Certificate,31,03VPfPs,02FUT,5,01ITEM,0,0.333333333,0.666666667,2,2,2,-2,2,0,1,-1,1,2,-2,-2,2,1,2,2,2,2,-3,2,-3,0,-1,1,2,-3,2,2,2,2,2,2,2,-3,2,-2,1,-2,1,2,-3,-3,2,2,2,2,2,2,-2,2,-1,1,-1,1,1,-2,-2,2,2,2,2,2,2,-3,2,-2,1,-2,1,2,-3,2,2,2,2,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,3,1,0,0,0,1,4,0,1,0,0,0,0,1,0,2,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,2,0,1,0,0,1,4,0,1,0,0,0,0,0,0,1,1,1,0,0,0,5,0,0,0,0,0,0,1,0,1,0,1,0,1,1,4,0,0,0,buffer,0,0,0,1,0,2,1,0,0,-1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,-1,0,0,1,0,0,-1,-1,1,0,0,0,buffer,0,0,0,0,-1,0,buffer,0.2,0.4,1,0,0,-0.6,-0.2,0,0,buffer,0,-0.333333333,0.533333333,-0.2,-0.066666667,buffer,0,1,0,0,0,0,0.2,0.8,1.2,0.2,0.6,0.6,0,0.4,0.2,0.2,0.6,1.2,0,0.6,1,0.2,0.6,1,buffer,C_Ug +380,R_3Ke5YBJbB40pFnq,32 - 38,American,Male,Male,University - Graduate (Masters),37,01PfPsV,01PAST,5,01ITEM,0.375,0,1,2,1,1,3,2,0,-1,1,-1,1,1,2,1,1,1,1,1,1,2,2,0,-1,1,-1,1,1,1,1,1,1,2,2,1,2,2,-1,-1,1,-1,1,1,1,1,1,1,2,2,1,3,2,-1,-1,1,-1,0,1,1,1,1,1,1,1,1,2,1,-1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,1,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,buffer,1,-1,0,1,0,-1,0,0,0,-1,0,0,0,0,0,-1,1,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,-1,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,-0.4,0,-0.2,-0.2,0,-0.4,0.2,0,buffer,0,0,-0.066666667,-0.133333333,-0.066666667,buffer,0,0,0,0,0,0,0.4,0,0.2,0.4,0.2,0.2,0.2,0.4,0.2,0.6,0.4,0.2,0.4,0.2,0,0.8,0,0,buffer,grad_prof +381,R_1WZphWu16CrMjG1,46 - 52,American,Male,Male,High School (or equivalent),51,02PsVPf,02FUT,5,02DGEN,0.75,0,1,2,2,-1,-1,-2,1,-1,1,-1,-1,1,1,1,1,2,1,-1,-1,-1,-1,1,-1,1,-2,-1,1,1,1,1,1,1,1,-2,2,-2,2,-1,2,-2,-1,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,1,1,1,1,1,2,2,-2,1,-1,2,-2,2,-1,-1,2,2,2,2,2,7,6,6,6,6,6,7,7,5,7,6,6,1,3,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,1,3,0,1,0,1,1,0,1,1,1,1,0,0,0,0,3,1,1,3,1,3,3,0,0,0,0,1,0,0,1,2,1,1,1,1,0,0,1,1,1,1,0,0,2,1,3,1,1,0,1,0,0,1,1,1,1,1,0,0,1,1,0,0,4,0,3,3,1,1,1,1,1,buffer,1,3,0,-3,0,-1,-3,-1,-2,-3,0,0,0,0,0,1,1,0,1,-1,0,-1,0,1,0,0,0,0,0,0,0,2,0,2,1,1,-4,1,-3,-3,0,0,0,0,0,buffer,0,-1,1,-1,0,0,buffer,0.2,-2,0,0.4,0,0,1,-1.6,0,buffer,0,-0.333333333,-0.6,0.133333333,-0.2,buffer,1,0,0,0,1,1,1,0.2,0.2,1.2,0.6,0.8,0.8,2.2,0.2,0.8,0.6,0.8,1.4,0.4,1,0.4,2,1,buffer,HS_TS +382,R_1P0pEfyrptM5noE,32 - 38,American,Male,Male,High School (or equivalent),35,03VPfPs,01PAST,5,01ITEM,0.125,0,1,0,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,0,2,2,2,2,-1,-1,-1,1,2,2,1,2,1,2,2,2,2,2,2,0,0,-1,-1,-2,2,1,2,1,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,5,7,5,2,2,6,1,4,6,1,1,1,0,0,0,0,0,3,0,3,2,0,0,1,0,1,0,2,0,0,0,0,2,1,3,0,4,0,1,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,0,2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,-2,0,0,0,0,3,0,3,2,0,0,1,0,1,0,0,0,0,0,0,2,1,3,0,4,0,1,0,1,0,2,0,0,0,0,1,1,0,2,4,0,0,0,0,0,buffer,4,3,-1,1,1,5,buffer,-0.4,1.6,0.4,0,2,0.4,0.4,1.6,0,buffer,2,2.333333333,0.533333333,0.8,0.666666667,buffer,3,5,1,0,3,5,0,1.6,0.4,0.4,2,0.4,0.4,0,0,0.4,0,0,0.4,1.6,0,0,0,0,buffer,HS_TS +383,R_3HbIKvfAM7AQSB0,25 - 31,American,Female,Female,High School (or equivalent),30,02PsVPf,02FUT,10,02DGEN,0.125,0.333333333,0.333333333,2,2,2,0,-3,-2,-1,2,0,1,2,-1,3,1,3,2,2,3,0,-3,0,-1,3,1,-2,2,-1,3,3,3,3,2,3,-1,-3,-3,0,2,3,-1,2,-1,3,3,3,2,2,3,1,-3,0,-1,3,0,1,2,-1,3,3,3,2,2,3,1,-2,0,-2,3,0,3,2,-1,3,3,3,1,3,1,1,4,4,2,1,0,0,3,1,0,0,1,0,0,2,0,1,1,3,0,0,0,2,0,1,0,1,1,0,1,1,0,3,2,0,0,0,2,0,0,0,1,1,0,2,0,1,0,0,0,0,0,2,0,0,0,1,1,1,2,1,1,0,2,0,0,0,2,0,1,0,0,1,0,3,1,1,2,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,1,3,0,0,0,0,0,1,0,0,0,-1,-1,0,-1,3,0,0,0,0,0,0,1,0,0,1,-1,3,0,1,2,-1,0,0,0,0,0,buffer,-1,2,1,1,1,3,buffer,-0.2,0.8,0,0,0.2,0,0.2,1,0,buffer,0.666666667,1.666666667,0.2,0.066666667,0.4,buffer,0,1,3,2,2,1,0.2,1.4,0.4,0.6,1.4,0.4,0.4,0.6,0.4,0.6,1.2,0.4,0.4,1.6,0,0.2,0.6,0,buffer,HS_TS +384,R_3lGLAqcojhv6lne,18 - 24,American,Female,Female,College Diploma/Certificate,24,03VPfPs,02FUT,5,02DGEN,1.5,0.666666667,0,2,2,3,3,3,2,3,3,2,3,3,1,2,2,1,3,2,3,2,3,3,2,2,3,3,3,2,3,2,3,3,3,3,2,3,3,3,3,3,2,3,2,3,2,3,3,3,2,3,2,3,3,2,2,2,3,3,2,3,2,3,3,3,2,1,2,3,2,3,3,3,2,3,3,3,7,7,7,6,7,6,8,8,8,8,5,8,1,0,0,1,0,1,1,1,1,0,0,1,1,0,2,1,1,0,1,0,1,0,0,1,1,0,1,1,0,2,1,1,1,0,1,1,0,1,0,1,0,2,0,1,1,1,1,0,1,2,0,0,1,1,0,0,1,1,1,2,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,0,1,buffer,0,-1,-1,1,-1,0,1,0,1,-1,0,-1,1,-1,1,0,0,0,0,-2,1,0,-1,0,1,0,0,0,-1,0,0,1,-1,-1,-1,-1,1,1,-1,0,0,-1,-1,0,-1,buffer,-1,-1,-1,-2,2,-2,buffer,-0.4,0.2,0,-0.4,0.2,-0.2,-0.4,0,-0.6,buffer,-1,-0.666666667,-0.066666667,-0.133333333,-0.333333333,buffer,1,0,1,0,3,0,0.4,0.8,0.8,0.6,0.6,0.8,0.8,0.6,0.8,1,0.4,1,0.2,0.6,0,0.6,0.6,0.6,buffer,C_Ug +385,R_3sc317tOOXpNf0O,25 - 31,Canadian,Male,Male,High School (or equivalent),25,01PfPsV,01PAST,10,01ITEM,0,1,0,0,3,2,-2,2,2,-2,-2,1,3,1,-1,3,1,3,-1,2,2,-2,2,1,1,-2,1,1,0,-1,2,-1,2,1,-2,2,-2,-2,-2,2,-3,2,-2,-3,-3,2,3,2,2,2,2,-2,2,3,-2,-2,-1,3,0,-1,3,-2,3,2,3,2,1,3,3,-3,1,-3,3,0,-1,3,-2,3,1,1,2,5,7,8,1,2,2,3,4,3,1,1,0,0,0,1,3,0,0,2,1,0,1,2,1,1,5,0,0,4,4,4,1,1,5,4,2,1,2,1,2,1,0,0,0,1,0,0,2,0,1,0,0,3,0,2,0,0,3,1,1,1,3,4,0,1,0,0,3,0,2,4,0,0,4,3,1,1,1,3,3,2,0,4,0,0,1,0,3,1,0,1,3,2,0,0,0,0,0,0,buffer,-1,0,0,0,0,0,3,0,-2,2,0,0,1,-1,1,-1,5,0,-3,3,3,3,-2,-3,5,3,2,1,-1,1,2,3,0,-3,3,3,0,-2,-1,3,3,2,0,4,0,buffer,0,-1,0,2,3,5,buffer,-0.2,0.6,0.2,0.8,1.2,1.2,1,0.6,1.8,buffer,-0.333333333,3.333333333,0.2,1.066666667,1.133333333,buffer,4,6,6,2,2,1,0.4,1.2,1,2,3,2,0.6,0.6,0.8,1.2,1.8,0.8,2,1.8,1.8,1,1.2,0,buffer,HS_TS +386,R_3bqx2mr4TMeLfhf,39 - 45,American,Female,Female,High School (or equivalent),41,01PfPsV,01PAST,5,01ITEM,1.375,1,0,2,3,3,3,2,2,0,2,1,2,3,2,2,3,2,3,3,2,3,2,2,2,2,1,2,1,1,3,1,2,3,3,3,3,3,2,2,2,1,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,6,7,8,9,9,9,9,9,9,10,10,10,1,0,1,0,0,0,2,0,0,0,2,1,1,2,0,1,0,0,0,1,0,2,0,0,0,1,0,0,2,0,0,1,1,1,0,0,2,0,1,0,1,0,0,1,0,1,0,0,0,1,1,3,1,2,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,buffer,1,-1,0,-1,0,0,0,0,-1,0,1,1,1,1,0,0,0,0,0,0,-1,-1,-1,-2,-1,0,0,0,1,0,-1,-1,0,-1,0,-1,-1,-1,-1,-1,1,1,1,0,0,buffer,-3,-2,-1,-1,-1,-1,buffer,-0.2,-0.2,0.8,0,-1.2,0.2,-0.6,-1,0.6,buffer,-2,-1,0.133333333,-0.333333333,-0.333333333,buffer,3,2,1,1,1,1,0.4,0.4,1.2,0.4,0.4,0.6,0.6,0.6,0.4,0.4,1.6,0.4,0.4,0,0.6,1,1,0,buffer,HS_TS +387,R_6tmcsCbTdClESI6,46 - 52,American,Male,Male,College Diploma/Certificate,47,02PsVPf,01PAST,10,02DGEN,0.25,0,1,2,2,0,3,2,-2,-1,2,-1,-1,2,0,2,1,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,0,2,2,2,0,2,2,-2,-2,2,-1,-1,2,-1,2,0,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,0,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,2,2,1,2,0,3,5,1,2,1,1,1,1,1,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,-2,0,buffer,-1,1,-1,2,4,0,buffer,0,0,0,0,-0.4,0.2,0,0.4,-0.2,buffer,-0.333333333,2,0,-0.066666667,0.066666667,buffer,2,3,1,1,0,0,0.2,0.6,0.2,0.2,0.2,0.4,0.2,0.6,0.2,0.2,0.6,0.2,0,0.4,0.2,0,0,0.4,buffer,C_Ug +388,R_1YAn8pY9la5023d,25 - 31,Canadian,Male,Male,University - Graduate (Masters),27,03VPfPs,02FUT,5,01ITEM,0.875,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,1,2,2,2,0,1,-1,0,1,0,1,1,0,-1,1,1,-1,0,0,0,1,0,1,1,2,0,1,-1,-1,2,1,1,0,1,-1,0,1,0,0,-1,1,0,1,0,6,6,6,10,6,8,6,7,7,7,5,7,0,0,1,1,0,1,1,0,0,1,1,1,0,1,1,1,1,2,1,1,1,1,2,0,1,0,0,0,0,2,0,1,1,1,1,1,1,1,1,1,2,1,0,1,2,1,1,1,1,0,2,0,0,0,0,1,0,1,1,1,1,1,1,2,1,0,0,2,0,0,1,1,0,1,1,1,0,2,0,1,1,1,1,1,1,3,1,1,2,1,buffer,0,-1,0,0,-1,0,0,-1,-1,0,-1,0,0,0,-1,0,0,1,0,1,-1,1,2,0,1,-1,0,-1,-1,1,0,1,-1,2,0,-1,-1,1,-1,-1,-2,0,-1,-1,0,buffer,0,-1,-1,3,1,1,buffer,-0.4,-0.4,-0.4,0.4,0.6,-0.4,0.4,-0.6,-0.8,buffer,-0.666666667,1.666666667,-0.4,0.2,-0.333333333,buffer,4,0,2,1,2,0,0.4,0.6,0.8,1.2,1,0.4,0.8,1,1.2,0.8,0.4,0.8,1.2,0.4,0.8,0.8,1,1.6,buffer,grad_prof +389,R_1fcIJv9FZSlIRn7,25 - 31,Canadian,Female,Female,University - Undergraduate,25,02PsVPf,02FUT,5,02DGEN,0.375,1,0,-1,3,3,3,3,-2,1,3,-2,1,3,3,2,3,3,2,2,2,2,2,0,-2,1,1,1,3,3,3,3,3,-2,-2,3,-2,3,-2,-2,-2,2,-2,-2,-2,1,-1,-1,1,1,3,3,3,1,-3,3,-2,1,3,3,3,2,3,3,2,3,1,2,1,-2,2,-2,2,3,2,3,3,2,5,5,5,7,7,9,5,8,4,5,5,5,3,1,1,1,1,2,3,2,3,0,0,0,1,0,0,1,5,0,5,0,0,3,5,4,3,5,5,1,4,4,2,2,0,0,0,3,4,0,0,0,0,0,1,1,0,4,1,0,2,1,3,3,1,0,1,0,1,1,0,1,4,4,1,4,1,2,0,3,1,3,5,5,2,4,4,2,1,0,2,1,0,1,1,0,1,0,1,0,1,1,buffer,1,-1,1,1,1,-1,-1,2,3,0,0,0,0,-1,0,-3,4,0,3,-1,-3,0,4,4,2,5,4,0,4,3,2,3,1,2,0,2,-1,2,1,2,5,4,2,3,3,buffer,0,-3,1,2,2,4,buffer,0.6,0.6,-0.2,0.6,1.4,3.2,1.6,1.2,3.4,buffer,-0.666666667,2.666666667,0.333333333,1.733333333,2.066666667,buffer,2,2,4,0,3,1,1.4,2,0.2,2.2,3,3.8,0.8,1.4,0.4,1.6,1.6,0.6,2.8,1.8,4,1.2,0.6,0.6,buffer,C_Ug +390,R_69QwckkLWbec5CF,18 - 24,Canadian,Female,Female,High School (or equivalent),20,02PsVPf,01PAST,5,01ITEM,-0.125,0,0.666666667,-3,1,0,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,6,7,7,7,5,5,6,6,6,6,6,6,4,0,1,2,1,0,1,0,0,0,0,0,0,0,0,3,0,1,2,0,0,1,0,0,1,0,0,0,0,0,5,1,2,1,1,0,0,0,0,0,0,0,0,0,0,5,1,2,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,-1,-1,-1,1,0,0,1,0,0,0,0,0,0,0,0,-2,-1,-1,1,-1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,0,0,buffer,0,1,1,1,-1,-1,buffer,-0.4,0.2,0,-0.8,0.4,0,0.4,0.6,0,buffer,0.666666667,-0.333333333,-0.066666667,-0.133333333,0.333333333,buffer,1,2,2,0,0,0,1.6,0.2,0,1.2,0.4,0,2,0,0,2,0,0,0.4,0.6,0,0,0,0,buffer,HS_TS +391,R_301bFnnJjUi6pNZ,18 - 24,Canadian,Female,Female,University - Undergraduate,24,01PfPsV,02FUT,10,02DGEN,0,0,1,3,3,2,3,3,3,1,2,2,3,0,-1,3,-1,3,3,3,2,2,3,3,1,-1,2,1,0,0,3,1,3,3,3,3,1,2,3,3,-1,3,-1,1,2,3,2,3,3,3,1,3,3,3,1,1,1,1,-1,-1,3,-1,3,3,3,1,3,3,3,1,2,-1,1,-1,-2,3,-3,3,4,4,4,5,4,3,2,2,2,5,2,2,0,0,0,1,0,0,0,3,0,2,0,1,0,2,0,0,0,1,2,1,0,2,3,1,4,1,3,0,3,0,0,0,1,0,0,0,0,1,1,2,1,0,0,0,0,0,0,1,0,0,0,0,0,3,2,1,1,0,2,0,0,0,1,1,1,0,2,0,1,2,1,2,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,2,0,buffer,0,0,-1,1,0,0,0,2,-1,0,-1,1,0,2,0,0,0,0,2,1,0,2,3,-2,2,0,2,0,1,0,0,0,1,1,1,0,2,-1,-1,2,1,1,0,-1,0,buffer,2,2,2,0,2,1,buffer,0,0.2,0.4,0.6,1,0.6,0.6,0.4,0.2,buffer,2,1,0.2,0.733333333,0.4,buffer,1,0,1,3,0,0,0.2,1,0.6,0.8,2,1.4,0.2,0.8,0.2,0.2,1,0.8,0.6,1,0.8,0,0.6,0.6,buffer,C_Ug +392,R_7k0tqkdudBxDiaE,25 - 31,American,Female,Female,College Diploma/Certificate,26,01PfPsV,02FUT,5,01ITEM,1.25,0,1,3,1,3,2,2,2,3,1,2,1,3,1,2,2,0,3,1,2,2,3,1,2,0,1,3,2,1,1,2,3,2,3,2,2,3,2,2,3,0,1,1,1,2,2,3,2,3,1,1,2,1,2,2,3,2,2,1,2,1,3,2,3,1,1,2,2,3,3,2,1,2,1,3,2,3,5,8,8,7,7,9,7,7,9,5,6,7,0,0,1,0,1,1,1,1,1,2,1,0,1,0,3,1,2,1,0,1,0,1,2,2,0,2,0,0,0,3,1,2,2,1,0,1,1,1,1,1,1,0,0,1,3,1,2,2,1,0,0,0,2,0,0,1,0,1,0,3,1,2,0,0,0,1,0,3,1,2,1,0,1,0,0,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,buffer,-1,-2,-1,-1,1,0,0,0,0,1,0,0,1,-1,0,0,0,-1,-1,1,0,1,0,2,0,1,0,-1,0,0,1,2,0,0,0,0,-1,2,0,1,1,0,0,-1,0,buffer,-2,1,-1,2,1,2,buffer,-0.8,0.2,0,-0.2,0.6,0,0.6,0.4,0,buffer,-0.666666667,1.666666667,-0.2,0.133333333,0.333333333,buffer,2,1,1,2,1,2,0.4,1.2,1,1,1,1,1.2,1,1,1.2,0.4,1,0.6,1.4,0.4,0,1,0.4,buffer,C_Ug +393,R_6ABmv1ELPyJI0Wl,18 - 24,American,Female,Female,High School (or equivalent),21,03VPfPs,01PAST,10,02DGEN,0.125,0,1,1,3,-2,1,1,1,1,1,1,1,2,0,3,1,3,1,3,0,-2,1,1,1,1,1,3,2,0,1,1,3,1,2,3,-3,2,-3,2,1,3,1,2,3,0,1,1,1,3,-2,3,2,2,0,3,0,3,3,0,3,1,3,2,3,-2,1,3,1,1,1,1,1,2,0,3,1,3,1,3,8,3,10,10,1,1,2,1,1,2,0,0,2,3,0,0,0,0,0,2,0,0,2,0,0,0,1,5,4,1,4,1,0,2,0,0,3,3,0,2,0,0,0,2,1,1,1,2,1,2,1,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,3,1,1,4,1,0,2,2,0,3,1,0,2,1,0,0,2,1,1,1,2,1,2,1,0,0,0,0,buffer,0,0,2,1,-1,-1,-1,-2,-1,0,-1,0,2,0,0,-1,1,5,4,-1,4,1,0,2,0,0,3,3,0,2,-1,1,3,-1,0,3,0,-2,1,0,-1,3,1,0,2,buffer,0,2,6,2,9,8,buffer,0.4,-1,0.2,1.6,1.4,1.6,0.4,0.4,1,buffer,2.666666667,6.333333333,-0.133333333,1.533333333,0.6,buffer,2,7,2,0,0,0,1,0.4,0.4,2.2,1.4,1.6,0.6,1.4,0.2,0.6,0,0,1.2,1.8,1.2,0.8,1.4,0.2,buffer,HS_TS +394,R_3DozEVS0ulEdTYR,18 - 24,Canadian,Female,Female,University - Undergraduate,24,03VPfPs,02FUT,5,02DGEN,0.5,0,1,1,1,0,1,0,1,2,1,-1,0,2,1,-1,1,2,-1,0,1,1,1,1,0,1,-2,2,1,2,0,2,1,1,0,0,2,1,2,1,0,1,0,2,0,-1,1,1,1,3,0,2,-1,-1,1,1,1,0,-1,-1,1,0,0,2,2,0,1,-2,2,0,1,2,1,1,2,1,2,0,4,6,5,6,4,5,5,7,4,4,5,5,2,1,1,0,1,0,2,0,1,2,1,1,1,1,1,0,1,0,1,1,1,1,1,2,0,0,1,0,0,1,0,2,0,1,1,2,1,0,2,0,3,2,2,1,2,1,1,0,0,2,1,2,0,3,1,1,1,2,1,2,2,0,1,1,0,1,1,1,3,2,1,2,1,1,0,1,1,0,1,1,3,1,0,1,1,2,3,0,2,0,buffer,2,-1,1,-1,0,-2,1,0,-1,2,-2,-1,-1,0,-1,-1,0,0,1,-1,0,-1,1,-1,-1,-1,0,-2,-1,-1,1,-1,1,0,-1,-2,0,1,2,1,-1,-1,1,-1,0,buffer,-1,-1,1,2,-1,0,buffer,0.2,0,-1,-0.2,-0.4,-1,0,0.4,-0.4,buffer,-0.333333333,0.333333333,-0.266666667,-0.533333333,0,buffer,2,2,0,1,2,1,1,1,1,0.6,1,0.4,0.8,1,2,0.8,1.4,1.4,0.8,1.6,1,0.8,1.2,1.4,buffer,C_Ug +395,R_7ePlnqRDs8i4Ecj,18 - 24,Canadian,Female,Female,University - Undergraduate,22,01PfPsV,01PAST,10,01ITEM,0.125,1,0,3,2,2,1,3,1,1,1,2,3,1,-2,3,2,3,3,1,3,0,3,2,1,1,0,1,0,-1,2,3,3,1,-1,3,3,2,-1,3,1,3,0,2,-1,1,3,3,3,3,2,3,3,1,0,3,1,3,-1,-1,3,1,3,3,3,1,3,3,1,0,3,-2,3,-2,-2,3,0,3,4,6,5,6,7,6,4,5,5,5,7,7,0,1,1,1,0,1,0,0,2,2,1,1,1,1,0,2,3,1,2,1,2,2,0,1,3,1,1,2,1,0,0,1,0,2,0,0,1,2,1,0,2,1,0,1,0,0,1,1,2,0,0,1,2,4,0,3,0,0,2,0,2,2,0,3,1,3,2,0,3,1,2,0,1,0,0,0,0,1,0,0,0,0,0,3,0,1,1,0,1,0,buffer,0,0,1,-1,0,1,-1,-2,1,2,-1,0,1,0,0,2,2,0,0,1,2,1,-2,-3,3,-2,1,2,-1,0,2,2,-1,3,1,3,2,0,0,1,1,-1,1,-1,0,buffer,0,1,0,1,0,-1,buffer,0,0.2,0,1,0.2,0,1.4,1.2,0,buffer,0.333333333,0,0.066666667,0.4,0.866666667,buffer,2,1,1,1,2,2,0.6,1,0.8,1.8,1.6,1,0.6,0.8,0.8,0.8,1.4,1,1.6,1.8,0.6,0.2,0.6,0.6,buffer,C_Ug +396,R_7Dp9alCiXsRbwsD,18 - 24,Canadian,Male,Male,Trade School (non-military),20,02PsVPf,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,1,3,1,1,2,-1,-3,-1,-1,3,-2,-3,3,-1,3,2,3,1,1,2,-2,-2,-2,1,2,-1,-2,1,1,2,1,1,3,2,-1,-2,-2,-3,1,3,2,-2,-1,2,2,2,3,1,2,2,-1,-3,1,-2,3,-1,-3,3,-2,3,2,3,1,3,2,0,-3,2,-2,3,-2,-3,3,-2,3,5,7,6,9,9,9,6,6,4,4,6,4,1,0,0,0,0,1,1,1,2,1,1,1,2,2,1,0,2,2,1,3,1,1,2,2,0,4,1,4,3,1,1,0,0,1,0,0,0,2,1,0,1,0,0,1,0,1,0,0,2,0,1,0,3,1,0,0,0,0,1,0,1,2,2,1,3,0,0,1,0,1,3,0,2,1,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,buffer,0,0,0,-1,0,1,1,-1,1,1,0,1,2,1,1,-1,2,2,-1,3,0,1,-1,1,0,4,1,4,2,1,1,2,2,0,3,-1,0,0,0,1,2,0,2,1,0,buffer,-1,1,2,5,3,5,buffer,-0.2,0.6,1,1,0.2,2.4,1.6,0,1,buffer,0.666666667,4.333333333,0.466666667,1.2,0.866666667,buffer,4,2,3,2,0,0,0.2,1.2,1.4,1.6,1.2,2.6,0.4,0.6,0.4,0.6,1,0.2,1.8,0.4,1.2,0.2,0.4,0.2,buffer,HS_TS +397,R_1TUekaIMwJVZ7tG,18 - 24,American,Female,Female,High School (or equivalent),19,02PsVPf,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,3,3,-1,0,3,0,0,3,1,3,2,0,3,-1,3,-3,-3,3,-3,0,1,0,-1,1,-1,1,1,-1,2,2,0,0,0,0,0,3,3,-3,3,-3,0,0,0,0,0,3,3,-2,1,3,-1,-2,3,1,3,0,0,0,0,0,3,3,3,3,3,3,-3,3,3,3,3,3,3,3,3,10,3,4,10,9,1,1,6,1,7,4,4,6,6,4,3,3,1,0,4,0,4,1,1,4,3,1,3,3,1,0,3,3,3,6,2,6,2,0,3,1,3,0,0,1,1,0,1,2,0,0,0,2,0,3,1,3,0,0,4,3,0,3,3,0,2,0,1,3,0,4,0,3,3,3,3,0,2,3,2,2,2,1,1,1,2,2,0,0,5,2,0,4,1,0,2,0,3,3,3,3,3,buffer,6,6,3,2,3,0,-2,4,0,4,-1,1,1,2,-2,3,3,-3,-3,3,0,0,6,0,6,1,-3,3,-3,3,3,3,-2,1,0,-2,2,2,0,2,-2,-2,-2,-1,-1,buffer,9,-3,3,3,5,-3,buffer,4,1.2,0.2,0.6,2.4,0.2,1,0.8,-1.6,buffer,3,1.666666667,1.8,1.066666667,0.066666667,buffer,0,6,3,6,2,3,4.4,1.8,2,2,4,1.8,0.4,0.6,1.8,1.4,1.6,1.6,2.4,2.2,1.4,1.4,1.4,3,buffer,HS_TS +398,R_3Cdm5kuClIX2Osq,18 - 24,American,Male,Male,High School (or equivalent),21,02PsVPf,02FUT,5,01ITEM,0.375,0,0.333333333,3,1,1,2,1,-1,2,2,3,1,1,3,3,1,2,1,2,2,3,3,-1,1,1,3,2,1,0,1,1,3,3,1,2,3,1,1,2,3,-1,3,1,3,0,2,2,2,2,1,3,1,1,2,3,-1,3,1,3,1,2,-1,1,2,3,3,1,2,2,-1,1,0,3,0,1,1,2,10,10,8,8,9,8,10,10,9,6,8,9,2,1,1,1,2,0,1,1,0,1,0,3,2,0,1,0,0,1,1,0,2,0,1,4,2,0,0,3,1,0,1,1,0,1,0,2,0,1,4,2,0,0,2,1,3,2,1,2,1,0,3,0,3,2,1,2,3,2,0,0,2,1,0,0,2,2,1,2,4,1,0,3,1,1,1,1,0,2,0,0,1,0,4,2,3,2,3,0,1,3,buffer,1,0,1,0,2,-2,1,0,-4,-1,0,3,0,-1,-2,-2,-1,-1,0,0,-1,0,-2,2,1,-2,-3,1,1,0,1,1,-2,0,2,1,1,-2,2,-2,-2,0,1,0,-2,buffer,0,0,-1,2,1,-1,buffer,0.8,-1.2,0,-0.8,0,-0.6,0.4,0,-0.6,buffer,-0.333333333,0.666666667,-0.133333333,-0.466666667,-0.066666667,buffer,2,1,0,4,2,0,1.4,0.6,1.2,0.4,1.8,0.8,0.6,1.8,1.2,1.2,1.8,1.4,1,2,1.2,0.6,2,1.8,buffer,HS_TS +399,R_1EE90vVU0660r2U,18 - 24,American,Male,Male,High School (or equivalent),24,03VPfPs,01PAST,5,02DGEN,0.5,0,1,0,2,0,1,2,1,2,2,1,0,0,1,1,1,0,1,0,0,2,1,0,1,0,1,2,0,2,1,0,1,1,2,1,2,0,2,1,1,0,0,1,2,2,0,0,2,1,2,0,0,0,2,1,0,1,2,1,0,0,1,2,0,1,2,1,3,0,2,1,0,2,0,0,1,1,4,5,5,5,5,5,4,5,3,3,4,4,1,2,0,1,1,1,1,2,0,2,0,1,0,1,1,1,0,1,1,2,1,1,1,1,0,1,1,1,1,0,2,1,2,1,2,1,0,1,1,1,2,0,1,1,1,2,2,1,1,1,2,2,0,0,0,2,1,1,0,1,0,2,1,0,1,2,0,1,1,2,1,0,1,0,1,0,1,1,2,1,3,2,1,1,1,0,1,0,1,0,buffer,-1,1,-2,0,-1,0,1,1,-1,1,-2,1,-1,0,0,-1,-2,0,0,1,-1,-1,1,1,0,-1,0,0,1,-1,0,1,0,-2,0,-1,-2,0,0,1,1,-1,1,-1,1,buffer,0,0,2,2,1,1,buffer,-0.6,0.4,-0.4,-0.4,0,-0.2,-0.2,-0.4,0.2,buffer,0.666666667,1.333333333,-0.2,-0.2,-0.133333333,buffer,1,0,0,1,1,1,1,1.2,0.6,1,0.8,0.8,1.6,0.8,1,1.4,0.8,1,0.8,1.2,0.6,1,1.6,0.4,buffer,HS_TS +400,R_5SBa48mHIRz5XN6,18 - 24,American,Female,Female,University - Undergraduate,21,01PfPsV,02FUT,5,01ITEM,0.25,0,1,3,2,0,0,0,-1,1,0,2,1,2,-1,1,1,1,3,1,0,-2,-1,-3,2,-3,3,-2,2,-2,-1,0,-2,3,1,1,-3,-3,-3,3,-3,2,-3,2,-3,-3,-3,1,2,2,0,2,2,1,1,0,0,2,1,0,1,2,2,3,1,1,3,1,1,1,1,1,1,0,1,1,2,2,10,10,6,5,8,8,7,3,4,5,6,4,0,1,0,2,1,2,1,3,1,3,0,1,2,1,3,0,1,1,3,3,2,2,3,0,4,0,2,4,4,0,1,0,0,2,2,2,0,0,2,1,1,1,0,1,1,0,1,1,3,1,2,0,1,1,0,2,2,0,1,1,0,0,1,1,2,0,1,0,1,1,0,1,2,3,3,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,buffer,-1,1,0,0,-1,0,1,3,-1,2,-1,0,2,0,2,0,0,0,0,2,0,2,2,-1,4,-2,0,4,3,-1,-1,-1,0,0,1,0,1,-1,0,0,-1,0,2,3,3,buffer,3,7,2,0,2,4,buffer,-0.2,1,0.6,0.4,1.4,0.8,-0.2,0,1.4,buffer,4,2,0.466666667,0.866666667,0.4,buffer,5,2,2,2,3,0,0.8,2,1.4,1.6,2.2,2,1,1,0.8,1.2,0.8,1.2,0.8,0.6,1.8,1,0.6,0.4,buffer,C_Ug +401,R_1NyQvCitGYJPI6S,25 - 31,American,Male,Male,Professional Degree (ex. JD/MD),30,02PsVPf,01PAST,5,02DGEN,0.875,0,1,1,2,2,2,2,1,0,2,1,2,2,1,2,2,2,1,1,1,1,1,1,0,0,1,1,2,1,2,2,1,2,2,2,2,2,0,1,1,1,0,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,2,1,1,1,2,1,1,1,1,8,7,8,7,7,6,7,7,7,7,7,7,0,1,1,1,1,0,0,2,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,2,1,0,2,1,1,0,0,1,1,1,0,1,1,0,1,1,1,1,1,1,0,1,0,1,1,0,2,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,2,1,0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,0,buffer,0,1,0,0,0,0,-1,1,0,0,-1,-1,-1,-1,0,1,-1,0,-1,-1,1,-1,0,0,1,1,0,1,0,0,1,0,0,1,1,1,0,1,0,1,0,-1,2,1,0,buffer,1,0,1,0,0,-1,buffer,0.2,0,-0.8,-0.4,0.2,0.4,0.6,0.6,0.4,buffer,0.666666667,-0.333333333,-0.2,0.066666667,0.533333333,buffer,1,0,2,0,0,0,0.8,0.6,0.2,0.2,1,1,0.6,0.6,1,0.6,0.8,0.6,1,0.8,0.8,0.4,0.2,0.4,buffer,grad_prof +402,R_3ZBIxk3ePWVcyCi,25 - 31,American,Female,Female,University - Graduate (Masters),27,02PsVPf,02FUT,10,02DGEN,0.375,0,1,1,1,1,-2,2,1,3,3,0,2,2,-2,3,3,2,-1,1,1,-3,3,3,1,1,3,3,2,-2,3,1,3,0,1,-1,-3,1,3,-1,3,3,3,-1,-3,3,-2,3,0,1,2,1,3,2,3,3,0,3,3,-3,3,3,3,0,1,3,2,3,0,2,3,-1,2,3,-2,3,3,3,2,5,5,7,10,5,0,2,2,0,7,1,2,0,0,1,1,2,2,2,3,1,0,0,0,2,1,1,0,2,1,1,2,4,0,3,1,3,1,0,5,1,1,0,1,3,1,1,0,0,0,1,1,1,0,0,1,1,0,2,4,1,1,1,0,1,0,1,0,0,0,1,1,0,2,0,2,0,2,2,0,0,3,1,0,3,0,0,0,1,1,0,2,1,0,1,1,0,1,0,0,0,buffer,1,0,-1,-2,0,1,2,2,3,0,-1,-1,0,2,0,0,0,0,-3,0,1,3,0,2,1,2,1,0,5,0,1,0,1,-1,2,-2,1,2,-1,-1,3,0,0,3,0,buffer,2,3,3,7,3,4,buffer,-0.4,1.6,0,-0.6,1.4,1.6,0.6,-0.2,1.2,buffer,2.666666667,4.666666667,0.4,0.8,0.533333333,buffer,5,5,0,0,5,1,0.8,2,0.6,1,2,2,1.2,0.4,0.6,1.6,0.6,0.4,1,0.8,1.4,0.4,1,0.2,buffer,grad_prof +403,R_6jZhZWuUygvzs2g,25 - 31,American,Male,Male,University - Undergraduate,27,01PfPsV,02FUT,5,01ITEM,0.5,0,1,2,3,3,1,2,2,1,3,1,3,2,1,3,3,2,-1,3,3,-1,2,0,-1,1,-1,1,0,2,1,2,1,-2,3,3,-2,2,-1,-1,-2,1,1,1,0,2,1,1,2,3,1,3,2,2,-1,3,-1,2,2,2,2,1,1,3,3,2,1,3,2,0,1,-1,2,2,1,1,2,2,3,4,4,7,7,5,6,7,8,4,5,5,3,0,0,2,0,2,2,2,2,2,2,1,2,1,1,4,0,0,3,0,3,2,5,0,2,1,1,1,2,1,0,0,2,2,0,0,2,0,2,1,0,1,1,2,1,1,0,1,0,1,0,1,2,2,1,0,0,2,1,0,1,0,0,1,0,1,0,3,2,0,1,2,1,1,0,1,0,1,2,1,0,1,2,0,0,0,1,1,1,1,buffer,3,0,-2,0,0,2,0,2,0,1,2,0,1,-1,0,3,0,-1,3,-1,3,1,3,-2,1,1,1,-1,1,1,0,0,-1,-1,-1,1,-1,1,2,0,1,1,0,0,-1,buffer,-3,-3,-4,3,2,0,buffer,0.2,1,0.4,0.8,1.2,0.6,-0.6,0.6,0.2,buffer,-3.333333333,1.666666667,0.533333333,0.866666667,0.066666667,buffer,4,3,1,2,2,3,1,2,1.4,1.4,2.4,1.2,0.8,1,1,0.6,1.2,0.6,0.4,1.2,1,1,0.6,0.8,buffer,C_Ug +404,R_3MLL21zMaguXu2a,25 - 31,American,Male,Male,University - Undergraduate,29,03VPfPs,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,2,3,3,-1,3,0,-3,1,0,3,2,1,3,2,3,-2,3,3,2,2,1,-2,0,-1,1,3,1,2,2,1,-1,3,3,1,2,3,-2,0,-3,0,-3,0,1,3,0,2,3,3,-2,3,0,-3,2,-3,2,3,3,3,3,3,3,3,3,-2,3,1,-3,3,-3,2,3,3,3,3,3,5,5,5,4,5,7,2,2,2,2,2,3,4,0,0,3,1,1,1,1,1,2,1,0,1,0,2,3,0,0,2,1,3,1,1,3,3,5,1,2,1,3,0,0,0,1,0,0,0,1,3,1,1,2,0,1,0,1,0,0,1,0,1,0,2,3,1,1,2,0,1,0,1,0,0,1,0,2,0,0,2,1,6,1,1,1,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,buffer,4,0,0,2,1,1,1,0,-2,1,0,-2,1,-1,2,2,0,0,1,1,2,1,-1,0,2,4,-1,2,0,3,0,0,0,1,0,1,0,-1,2,1,6,1,1,1,1,buffer,3,3,3,2,3,4,buffer,1.4,0.2,0,0.8,0.8,1.6,0.2,0.6,2,buffer,3,3,0.533333333,1.066666667,0.933333333,buffer,1,0,2,0,0,1,1.6,1.2,0.8,1.2,2.2,2.4,0.2,1,0.8,0.4,1.4,0.8,0.4,1,2,0.2,0.4,0,buffer,C_Ug +405,R_7uoGPbNGhNG6Ce5,18 - 24,American,Male,Male,College Diploma/Certificate,20,02PsVPf,01PAST,5,01ITEM,0,0,1,-2,3,-1,0,-2,-3,1,1,1,-2,-1,-3,3,-3,3,0,3,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,2,0,1,0,2,3,1,1,1,2,1,0,0,3,3,2,3,1,0,2,0,1,1,1,2,1,3,3,3,3,2,0,1,0,2,3,1,1,1,2,1,3,3,3,3,2,0,1,0,2,3,1,1,1,2,1,3,3,3,3,0,3,0,0,0,3,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,-3,-3,0,0,0,3,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,3,3,0,0,buffer,0,0,0,0,0,0,buffer,0,0,-1.2,0.6,-0.6,0,0.6,0.6,1.2,buffer,0,0,-0.4,0,0.8,buffer,0,0,0,0,0,0,1,1.6,1.4,1.6,1,2.6,1,1.6,2.6,1,1.6,2.6,0.6,0.6,1.2,0,0,0,buffer,C_Ug +406,R_1DJaqmosXBlRNrd,25 - 31,American,Female,Female,College Diploma/Certificate,30,02PsVPf,02FUT,5,02DGEN,0.25,0,1,1,1,1,-1,3,-1,0,1,0,1,0,1,0,1,0,0,0,0,-1,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,3,0,0,0,0,1,0,1,0,0,1,2,1,0,0,2,0,0,1,0,1,0,1,1,0,0,4,5,5,5,5,4,5,6,5,4,5,5,1,1,1,0,0,1,0,0,0,1,0,1,0,1,0,1,1,1,1,3,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,1,3,0,0,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0,0,0,0,1,0,1,buffer,1,0,1,-1,0,0,0,-1,0,1,0,1,0,0,-1,0,1,0,0,2,0,0,1,0,1,0,1,-1,0,0,-1,-1,-1,1,2,0,0,0,0,0,0,0,-1,0,-1,buffer,-1,-1,0,1,0,-1,buffer,0.2,0,0,0.6,0.4,0,0,0,-0.4,buffer,-0.666666667,0,0.066666667,0.333333333,-0.133333333,buffer,1,0,1,1,1,0,0.6,0.4,0.4,1.4,0.6,0.4,0.4,0.4,0.4,0.8,0.2,0.4,0.8,0.2,0,0.8,0.2,0.4,buffer,C_Ug +407,R_1DNW39lgIxT0Ku8,18 - 24,American,Female,Female,University - PhD,24,03VPfPs,01PAST,5,01ITEM,0,0.666666667,0.333333333,1,3,2,3,0,2,1,0,1,3,1,2,3,2,3,2,0,0,1,1,3,3,2,1,2,1,2,3,0,1,0,2,3,1,1,0,2,1,3,2,1,3,1,2,0,1,0,2,3,0,2,3,0,1,0,1,1,2,0,3,1,1,0,3,2,1,3,1,2,0,3,2,1,2,0,10,7,6,8,8,9,10,8,9,9,10,9,1,3,2,2,1,1,2,2,0,1,0,0,0,2,2,1,1,1,2,1,2,1,1,2,1,0,1,2,0,3,0,3,0,0,0,0,2,0,0,3,0,1,1,2,0,0,2,2,0,2,1,2,1,1,3,2,0,2,0,3,2,2,3,0,0,3,1,1,2,0,0,1,2,2,1,0,1,2,0,2,1,0,1,1,0,2,1,1,2,3,buffer,1,0,2,2,1,1,0,2,0,-2,0,-1,-1,0,2,1,-1,-1,2,-1,1,-1,0,1,-2,-2,1,0,0,0,2,1,1,0,-2,2,1,0,1,0,-2,0,1,0,-2,buffer,0,-1,-3,-1,-2,0,buffer,1.2,0.2,0,0,-0.2,-0.2,0.4,0.8,-0.6,buffer,-1.333333333,-1,0.466666667,-0.133333333,0.2,buffer,2,1,3,1,2,0,1.8,1.2,0.8,1.2,1.4,1.2,0.6,1,0.8,1.2,1.6,1.4,1.4,1.4,1.2,1,0.6,1.8,buffer,grad_prof +408,R_5tuUhPynQWwFDZT,18 - 24,American,Female,Female,High School (or equivalent),19,02PsVPf,02FUT,10,01ITEM,0.5,0,1,-1,3,1,3,3,1,-2,1,3,2,1,3,3,1,3,2,2,3,3,3,2,0,3,3,0,0,0,0,0,0,3,3,3,3,3,1,-1,2,3,1,3,-2,3,1,3,-1,3,1,3,3,1,-1,1,3,2,1,3,3,1,3,-1,3,1,3,3,1,-1,2,1,2,1,2,3,1,2,5,4,6,3,6,2,7,4,6,5,9,2,3,1,2,0,0,1,2,2,0,2,1,3,3,1,3,4,0,2,0,0,0,1,1,0,1,2,5,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,0,0,1,0,0,1,1,1,0,0,0,1,1,1,0,1,3,2,3,1,3,0,0,0,0,0,0,0,1,2,0,0,1,0,0,1,buffer,3,1,2,0,0,1,1,2,0,2,1,3,3,1,3,4,0,2,0,0,0,0,0,-2,1,2,4,0,0,-1,1,1,0,0,0,1,1,0,-2,1,3,1,3,1,2,buffer,-2,0,0,-2,-3,0,buffer,1.2,1.2,2.2,1.2,-0.2,1,0.4,0.2,2,buffer,-0.666666667,-1.666666667,1.533333333,0.666666667,0.866666667,buffer,2,2,4,2,5,4,1.2,1.4,2.2,1.2,0.6,1.4,0,0.2,0,0,0.8,0.4,0.4,0.8,2.4,0,0.6,0.4,buffer,HS_TS +409,R_5oKFZs5C9UhTZjC,25 - 31,American,Female,Female,College Diploma/Certificate,31,01PfPsV,01PAST,5,02DGEN,-1.5,0,1,1,3,3,2,3,-3,-1,-1,2,-1,3,3,3,3,3,1,3,3,3,-3,-3,-2,3,2,1,3,3,3,3,3,3,3,3,3,-2,-3,-1,-1,1,-1,3,3,3,3,3,3,3,3,3,-1,0,-3,3,-3,3,3,3,3,3,3,3,2,3,2,3,2,-3,3,3,3,3,3,3,3,2,10,1,1,1,1,1,1,1,10,1,10,1,0,0,0,1,6,0,1,4,0,2,0,0,0,0,0,2,0,0,1,5,0,0,0,1,0,0,0,0,0,0,2,0,0,1,4,3,2,4,5,4,0,0,0,0,0,2,1,0,0,0,5,2,4,1,4,0,0,0,0,1,2,0,0,0,1,0,1,4,1,2,0,0,0,0,0,0,1,0,1,4,2,0,0,6,0,0,0,0,0,1,buffer,-2,0,0,0,2,-3,-1,0,-5,-2,0,0,0,0,0,0,-1,0,1,5,-5,-2,-4,0,-4,0,0,0,0,-1,2,-1,0,-1,-3,-2,1,4,-5,2,0,0,0,0,-1,buffer,9,0,-9,0,-9,0,buffer,0,-2.2,0,1,-3,-0.2,-0.6,0,-0.2,buffer,0,-3,-0.733333333,-0.733333333,-0.266666667,buffer,9,0,0,0,9,9,1.4,1.4,0,1.6,0.2,0,1.4,3.6,0,0.6,3.2,0.2,0.6,1.6,0,1.2,1.6,0.2,buffer,C_Ug +410,R_36a9bhPXzT1Nr9f,18 - 24,American,Male,Male,High School (or equivalent),21,03VPfPs,01PAST,10,02DGEN,-0.125,0,1,1,3,2,-2,1,-1,-3,1,1,1,0,-1,2,-2,3,0,3,2,-2,1,-2,-2,1,2,-1,1,-1,2,-1,3,-2,3,1,-3,2,-3,-1,1,3,-3,1,-1,0,0,2,1,3,3,-3,1,2,-3,2,-1,3,0,-1,3,-3,3,1,3,3,-3,1,3,-3,1,-1,2,-1,-1,3,-3,3,1,6,1,2,7,6,2,5,0,0,7,4,1,0,0,0,0,1,1,0,1,2,1,0,0,1,0,3,0,1,1,1,2,2,0,2,4,1,0,2,2,1,0,0,1,1,0,3,0,1,2,2,0,0,1,1,0,0,0,1,1,0,4,0,0,2,1,1,0,1,1,0,2,0,1,1,1,1,1,0,1,2,0,0,2,1,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,buffer,1,0,-1,-1,0,-2,1,-1,-1,0,1,0,-1,0,0,3,0,0,0,1,-2,2,0,0,3,0,0,1,1,1,2,0,1,1,1,0,1,-1,1,1,-1,0,2,1,1,buffer,-1,1,1,2,0,2,buffer,-0.2,-0.6,0,0.8,0.6,0.6,1,0.4,0.6,buffer,0.333333333,1.333333333,-0.266666667,0.666666667,0.666666667,buffer,1,1,5,2,2,4,0.2,1,0.4,1.2,2,1.2,0.4,1.6,0.4,0.4,1.4,0.6,1,1,0.8,0,0.6,0.2,buffer,HS_TS +411,R_1diDaGJkKUxlKT8,18 - 24,American,Female,Female,High School (or equivalent),20,01PfPsV,02FUT,10,02DGEN,-0.25,0,0.666666667,3,3,3,-3,1,0,0,0,0,0,0,0,0,0,3,3,3,3,-2,2,0,0,0,2,0,0,0,0,0,3,3,3,3,1,-1,0,0,0,3,0,0,0,0,0,3,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,5,5,5,1,5,5,2,1,1,2,2,2,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,0,0,4,2,0,0,0,3,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,0,0,3,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,2,0,0,0,0,0,-3,0,0,0,2,1,0,0,0,3,0,0,0,0,0,-3,0,0,0,3,3,0,0,0,1,0,0,0,0,0,0,buffer,3,4,4,-1,3,3,buffer,-0.2,0.4,-0.6,0.6,0.6,-0.6,1.2,0.2,0,buffer,3.666666667,1.666666667,-0.133333333,0.2,0.466666667,buffer,4,0,0,0,1,1,0.4,0.4,0,1.2,0.6,0,0.6,0,0.6,0.6,0,0.6,1.2,0.2,0,0,0,0,buffer,HS_TS +412,R_6BCrzfueF6asaWt,18 - 24,American,Female,Female,College Diploma/Certificate,20,03VPfPs,01PAST,5,01ITEM,-0.375,0,1,3,3,3,3,2,-3,2,1,3,3,-3,-3,3,0,3,3,3,3,1,2,-2,3,2,2,3,-3,-3,3,1,3,3,3,3,-3,2,0,3,-3,1,2,-1,-3,3,2,3,3,3,3,3,3,0,3,2,1,3,-3,-3,3,0,3,3,3,3,3,3,-2,3,2,3,3,-3,-3,3,0,3,3,2,1,4,5,4,1,3,0,0,1,0,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,0,0,0,6,0,3,1,4,2,1,2,0,0,2,0,0,0,0,0,1,3,1,1,2,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,4,0,2,0,5,1,1,2,0,0,1,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,buffer,0,0,0,2,-1,-2,0,0,-1,0,0,0,0,1,0,0,0,0,6,-1,2,0,3,2,1,2,0,0,2,0,0,0,0,4,0,0,0,5,-1,1,2,0,0,1,0,buffer,2,-1,1,4,4,4,buffer,0.2,-0.6,0.2,1,1.6,0.8,0.8,1,0.6,buffer,0.666666667,4,-0.066666667,1.133333333,0.8,buffer,1,3,3,1,2,0,0.4,0.8,0.2,1.2,2.2,0.8,0.2,1.4,0,0.2,0.6,0,0.8,1.8,0.6,0,0.8,0,buffer,C_Ug +413,R_6AnjfeWnRFdPK49,18 - 24,American,Male,Male,University - Undergraduate,19,02PsVPf,01PAST,5,01ITEM,0,0,1,2,3,3,2,3,-1,0,2,-2,3,0,3,3,-2,3,3,3,3,3,3,-1,0,3,-3,2,-1,3,3,1,3,-2,2,3,-2,0,3,0,-2,-2,0,-3,-2,-2,-3,1,3,3,2,3,3,0,0,3,-3,3,0,3,3,-3,3,3,3,3,3,3,1,0,3,-3,3,0,3,3,-3,3,1,4,1,6,8,10,1,2,1,2,4,3,1,0,0,1,0,0,0,1,1,1,1,0,0,3,0,4,1,0,4,3,4,0,4,0,3,3,5,5,1,2,1,0,1,1,0,1,0,1,1,0,0,0,0,1,0,1,0,0,1,0,2,0,1,1,0,0,0,0,1,0,5,1,0,5,3,4,0,5,1,2,2,5,5,4,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,-1,0,0,-1,0,0,0,1,1,0,0,2,0,3,1,0,3,3,2,0,3,-1,3,3,5,5,0,2,5,1,-1,5,3,3,0,5,1,2,2,5,5,4,2,buffer,0,2,0,4,4,7,buffer,-0.2,0,0.6,2,1.4,3,2.6,2.2,3.6,buffer,0.666666667,5,0.133333333,2.133333333,2.8,buffer,5,4,9,1,2,2,0.4,0.6,0.8,2.4,2.2,3.2,0.6,0.6,0.2,0.4,0.8,0.2,2.8,2.4,3.6,0.2,0.2,0,buffer,C_Ug +414,R_7H7PX3Cx5sdW7Q6,25 - 31,American,Female,Female,High School (or equivalent),30,03VPfPs,01PAST,5,02DGEN,0.75,0,0.666666667,3,3,3,3,3,3,2,2,-2,3,3,3,3,2,3,-3,-3,3,3,-3,-2,0,-2,2,-2,-2,-1,-2,2,0,-2,3,3,3,3,1,-1,-1,-2,-2,-2,-3,-2,2,-2,3,3,3,3,3,3,2,3,-3,2,3,2,3,3,3,3,3,3,3,3,3,1,3,-3,2,3,3,3,3,3,10,10,8,9,7,10,10,10,8,10,0,9,6,6,0,0,6,5,2,4,4,5,5,4,5,0,3,5,0,0,0,0,2,3,3,0,5,5,6,5,0,5,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,1,6,0,0,6,3,1,1,4,0,0,2,0,0,2,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,buffer,6,6,0,0,6,5,2,3,3,4,5,3,5,-1,3,5,0,0,0,0,2,2,2,-1,4,5,6,5,-1,5,1,6,0,0,6,3,0,1,4,0,0,1,0,0,2,buffer,0,0,0,-1,7,1,buffer,3.6,3.4,3,1,1.8,4,2.6,1.6,0.6,buffer,0,2.333333333,3.333333333,2.266666667,1.6,buffer,1,3,2,0,10,1,3.6,4,3.4,1,2.6,4.2,0,0.6,0.4,0,0.8,0.2,2.6,1.8,0.8,0,0.2,0.2,buffer,HS_TS +415,R_70wTqF36yBKH2DV,25 - 31,American,Male,Male,University - Undergraduate,25,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,2,1,2,2,2,2,2,2,1,2,2,0,0,2,3,2,2,2,2,1,2,1,1,2,2,1,2,1,2,2,2,2,1,2,1,2,2,1,2,-1,2,2,2,2,1,2,1,-2,1,2,2,2,1,1,2,2,1,2,2,2,2,0,2,2,1,2,2,1,2,2,3,2,2,1,7,7,8,10,9,9,10,10,10,10,8,9,1,0,1,0,0,1,0,1,1,1,0,1,2,1,0,0,0,1,1,0,1,0,0,1,1,3,0,2,2,0,1,0,0,4,1,0,0,0,1,0,0,0,1,2,0,0,0,1,0,0,1,0,0,1,1,0,1,2,2,1,1,0,0,1,0,0,0,1,0,0,3,1,0,1,0,1,0,1,4,1,1,0,0,0,1,0,1,1,0,1,buffer,0,0,1,-4,-1,1,0,1,0,1,0,1,1,-1,0,0,0,0,1,0,0,0,0,0,0,3,-1,0,0,-1,0,0,-1,-3,-1,-1,0,1,0,-1,3,0,-1,1,-1,buffer,-3,-3,-2,0,1,0,buffer,-0.8,0.6,0.2,0.2,0,0.2,-1,-0.2,0.4,buffer,-2.666666667,0.333333333,-1.85E-17,0.133333333,-0.266666667,buffer,3,2,1,0,2,1,0.4,0.8,0.8,0.4,0.6,1.4,1.2,0.2,0.6,0.2,0.6,1.2,0.4,0.2,1,1.4,0.4,0.6,buffer,C_Ug +416,R_6WOPvyZulqJtokI,25 - 31,American,Male,Male,High School (or equivalent),31,02PsVPf,01PAST,10,01ITEM,-0.5,0.333333333,0.666666667,3,3,3,3,3,0,-2,3,-3,3,0,0,0,0,0,3,3,3,3,0,0,-3,3,-3,3,3,3,-1,0,-1,3,3,0,3,0,0,-3,3,-3,0,3,3,3,0,0,3,3,3,3,0,3,-3,-3,-3,3,3,3,0,0,0,3,3,3,3,0,3,-3,3,-3,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,3,3,1,0,1,0,0,3,0,3,0,1,0,0,3,3,3,3,0,0,0,0,0,0,3,3,1,6,0,0,3,3,0,0,0,0,0,0,0,3,3,1,0,0,0,3,3,1,0,0,0,0,3,0,0,0,0,0,0,3,0,0,4,0,1,0,0,0,0,0,0,0,6,0,0,0,0,1,0,0,buffer,0,0,0,0,0,-3,0,-6,0,0,0,0,1,0,1,0,0,3,0,0,-3,0,0,0,3,0,0,2,0,0,0,0,3,0,0,0,0,-6,0,3,0,0,3,0,1,buffer,0,0,0,0,0,0,buffer,0,-1.8,0.4,0.6,0,0.4,0.6,-0.6,0.8,buffer,0,0,-0.466666667,0.333333333,0.266666667,buffer,0,0,0,0,0,0,0.6,0.2,1.6,1.2,0.8,1.8,0.6,2,1.2,0.6,0.8,1.4,0.6,0.6,1,0,1.2,0.2,buffer,HS_TS +417,R_7QnDfcY78mwDRhJ,18 - 24,Canadian,Male,Male,College Diploma/Certificate,24,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,0,1,1,-1,1,-1,0,0,1,1,-1,-1,2,1,-1,0,2,0,-2,-1,-2,1,-2,2,-1,1,1,-2,0,1,3,-2,1,2,1,-1,1,-1,2,0,2,0,1,1,1,0,2,1,-2,1,0,-2,2,-1,1,-1,-1,1,2,-1,1,2,2,0,2,1,-2,3,-2,1,0,-1,2,3,-1,5,6,6,6,6,8,2,5,6,2,5,5,0,1,1,1,2,1,1,2,1,2,2,2,4,1,2,3,3,0,3,0,0,1,1,1,1,3,1,1,0,2,0,1,0,1,0,1,2,2,2,0,0,0,1,1,0,1,1,1,1,1,2,2,3,3,0,1,0,0,2,0,3,4,1,4,2,1,0,1,0,1,1,1,3,1,0,1,0,1,2,1,1,0,1,1,0,1,0,1,1,0,buffer,0,0,1,0,2,0,-1,0,-1,2,2,2,3,0,2,2,2,-1,2,-1,-2,-1,-2,-2,1,2,1,1,-2,2,2,4,0,2,1,0,0,0,-1,1,0,1,2,0,0,buffer,3,1,0,4,1,3,buffer,0.6,0,1.8,0.8,-1.2,0.8,1.8,0,0.6,buffer,1.333333333,2.666666667,0.8,0.133333333,0.8,buffer,1,0,2,0,0,1,1,1.4,2.2,1.8,0.8,1.4,0.4,1.4,0.4,1,2,0.6,2.8,0.6,1.2,1,0.6,0.6,buffer,C_Ug +418,R_7P6VjQVxwsDLEuS,18 - 24,Canadian,Male,Male,High School (or equivalent),20,03VPfPs,02FUT,5,01ITEM,0.375,1,0,1,3,3,2,2,1,1,-1,1,-1,-2,-3,3,-1,3,-1,1,3,-2,-3,-1,2,-2,3,-2,2,-2,-2,-2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,2,1,2,-1,2,-1,2,-2,-3,3,3,3,2,3,3,1,2,2,-2,3,-2,1,-2,-3,3,3,3,5,6,6,5,5,5,1,4,3,2,5,3,2,2,0,4,5,2,1,1,2,1,4,1,5,1,2,1,3,3,2,2,1,1,1,1,1,2,3,3,1,3,1,0,0,0,1,1,2,3,2,3,0,0,0,4,0,1,0,0,1,0,1,3,4,3,2,0,0,0,4,0,1,1,3,2,3,1,2,2,3,2,2,2,2,2,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,buffer,1,2,0,4,4,1,-1,-2,0,-2,4,1,5,-3,2,0,3,3,1,2,0,-2,-3,-2,-1,2,3,3,-3,3,1,1,3,1,2,1,1,1,2,1,2,2,2,2,1,buffer,4,2,3,3,0,2,buffer,2.2,-0.8,1.8,1.8,-1.6,1.6,1.6,1.2,1.8,buffer,3,1.666666667,1.066666667,0.6,1.533333333,buffer,0,1,1,1,1,0,2.6,1.4,2.6,2.2,1,2.4,0.4,2.2,0.8,0.4,2.6,0.8,2,2,1.8,0.4,0.8,0,buffer,HS_TS +419,R_3ADeuracdnFjlol,39 - 45,Canadian,Female,Female,High School (or equivalent),40,03VPfPs,02FUT,5,01ITEM,0.25,0.333333333,0.666666667,3,3,3,3,3,0,-3,3,-1,0,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-2,3,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-3,0,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-1,0,3,3,3,-3,3,3,3,3,3,3,0,-3,3,-1,0,3,0,3,-3,3,0,2,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,buffer,0,0,0,0,0,0,0,0,1,3,0,-3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,-3,0,0,0,buffer,0,2,-1,0,0,0,buffer,0,0.8,-0.6,0,0.4,0,0,0.8,-0.6,buffer,0.333333333,0,0.066666667,0.133333333,0.066666667,buffer,0,1,1,0,1,0,0,0.8,0,0,0.4,0,0,0,0.6,0,0,0,0,0.8,0,0,0,0.6,buffer,HS_TS +420,R_5QR1WLqqjfnTfrf,25 - 31,Canadian,Female,Female,University - Undergraduate,25,01PfPsV,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,2,2,1,3,2,1,2,2,3,2,3,1,2,3,2,0,3,0,-1,1,1,2,1,2,2,1,1,1,2,0,2,1,1,1,0,1,3,0,2,2,2,2,2,1,1,2,2,1,2,3,1,0,0,1,-1,2,1,2,1,1,1,2,0,0,1,1,1,0,2,2,1,0,2,2,1,1,2,3,3,1,2,3,7,3,4,1,3,2,1,1,4,1,0,0,1,1,0,2,0,1,1,2,0,1,0,2,2,0,1,2,1,0,1,1,0,2,1,0,0,0,1,1,0,2,2,2,3,1,0,0,2,1,1,0,1,3,1,0,1,2,1,0,2,1,0,1,1,2,2,1,2,1,0,1,1,0,0,1,1,1,1,1,1,0,1,2,2,0,1,0,1,3,1,1,0,1,0,buffer,2,1,1,3,0,0,-2,-1,-1,-3,1,0,1,-1,1,-1,1,-1,-1,1,0,0,0,0,0,-1,0,0,1,0,1,2,0,0,-1,0,0,1,-1,-3,0,0,1,0,1,buffer,-2,-5,0,-1,0,-1,buffer,1.4,-1.4,0.4,-0.2,0,0,0.4,-0.6,0.4,buffer,-2.333333333,-0.666666667,0.133333333,-0.066666667,0.066666667,buffer,2,1,1,1,6,0,1.8,0.4,1.2,1,0.8,1,0.4,1.8,0.8,1.2,0.8,1,1.6,0.4,1,1.2,1,0.6,buffer,C_Ug +421,R_6nNFF5o8UlRttgM,67 - 73,American,Male,Male,Trade School (non-military),71,02PsVPf,02FUT,10,02DGEN,0.5,0,1,-2,3,2,2,2,0,-2,2,-2,-2,3,3,2,-2,2,-2,2,2,2,2,1,-2,1,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,0,0,0,0,0,0,1,1,1,1,2,2,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,1,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,1,0,0,0,0,0,0,0,buffer,-1,-1,-1,-1,-2,-2,buffer,0.2,0,0,0,0,0,0.2,0.8,0,buffer,-1,-1.666666667,0.066666667,0,0.333333333,buffer,0,0,0,0,1,1,0.2,0.4,0,0,0.4,0,0,0.4,0,0,0.4,0,0.2,0.8,0,0,0,0,buffer,HS_TS +422,R_15UDzM7aUkST0Xv,60 - 66,Canadian,Male,Male,High School (or equivalent),63,01PfPsV,01PAST,10,02DGEN,0.375,1,0,2,2,3,-2,3,1,-1,2,-2,1,1,1,3,0,1,2,2,3,-3,3,0,-2,2,-2,0,1,2,3,1,1,2,2,3,-3,3,2,0,3,-1,1,0,2,3,1,1,2,2,3,-2,3,1,-2,2,-2,1,1,2,3,0,1,2,3,3,0,3,0,-2,1,-2,0,2,2,2,0,1,2,1,1,2,2,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,2,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,2,2,1,1,1,1,0,0,0,0,0,1,0,2,0,1,0,1,0,1,1,0,1,0,0,buffer,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,-1,0,-1,0,0,0,0,1,-1,0,0,-1,1,0,0,-1,0,-2,0,1,2,0,1,0,0,0,-1,0,0,buffer,1,0,0,1,1,0,buffer,0.2,0.4,0.2,-0.4,0,0,-0.6,0.8,-0.2,buffer,0.333333333,0.666666667,0.266666667,-0.133333333,1.85E-17,buffer,0,1,0,0,0,0,0.2,0.6,0.4,0.2,0.8,0.6,0,0.2,0.2,0.6,0.8,0.6,0,1.4,0.2,0.6,0.6,0.4,buffer,HS_TS +423,R_1Maa3MBUCWZQHLj,46 - 52,Canadian,Male,Male,High School (or equivalent),52,03VPfPs,01PAST,5,02DGEN,0,0,1,1,2,3,2,-2,2,-2,2,-1,0,3,3,3,0,2,0,2,0,-1,0,2,1,1,1,2,1,2,2,0,1,-2,3,-1,-3,1,2,1,1,1,-1,0,0,1,1,0,0,2,1,2,-1,0,-2,1,-1,1,3,2,3,-1,1,0,0,0,1,0,1,-1,1,-1,1,2,1,2,-1,1,7,7,7,7,7,9,7,7,5,7,7,7,1,0,3,3,2,0,3,1,2,2,2,1,1,0,1,3,1,4,5,3,0,3,1,2,1,3,3,2,1,2,1,0,2,0,1,2,0,1,0,1,0,1,0,1,1,1,2,3,1,2,1,1,1,0,1,1,2,1,1,1,2,1,1,2,1,0,0,0,0,3,1,2,1,1,1,0,2,1,1,1,1,1,0,0,0,1,1,1,0,0,buffer,0,0,1,3,1,-2,3,0,2,1,2,0,1,-1,0,2,-1,1,4,1,-1,2,0,2,0,2,1,1,0,1,2,-1,0,1,0,-1,-1,0,0,3,0,1,0,1,1,buffer,0,0,2,0,0,2,buffer,1,0.8,0.4,1.4,0.6,1,0.4,0.2,0.6,buffer,0.666666667,0.666666667,0.733333333,1,0.4,buffer,0,0,2,0,0,2,1.8,1.6,1,3.2,1.4,2.2,0.8,0.8,0.6,1.8,0.8,1.2,1.4,0.6,1.2,1,0.4,0.6,buffer,HS_TS +424,R_3Fx3y1AcHczW3R4,39 - 45,Canadian,Male,Male,University - Undergraduate,45,02PsVPf,02FUT,10,01ITEM,0.25,1,0,0,1,2,-1,-1,-3,-1,1,3,1,2,1,2,0,2,0,1,2,1,-1,-3,-1,1,2,-1,2,1,2,0,2,1,2,2,0,1,-3,-1,2,-1,1,2,1,2,1,2,0,1,2,0,-1,-3,-1,1,3,1,2,1,2,0,2,0,1,2,0,-1,-3,-1,1,2,1,2,1,2,0,2,1,1,1,2,2,2,1,1,1,8,8,9,0,0,0,2,0,0,0,0,1,2,0,0,0,0,0,1,1,0,1,2,0,0,1,4,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,2,0,0,1,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,1,0,0,0,0,1,2,0,0,0,0,0,1,1,0,0,2,0,0,1,3,0,0,0,0,1,0,1,1,0,1,2,0,0,1,2,2,0,0,0,1,0,buffer,0,0,0,-6,-6,-7,buffer,0.2,0.6,0,0.8,0.8,0.2,1,1,0.2,buffer,0,-6.333333333,0.266666667,0.6,0.733333333,buffer,1,1,1,7,7,8,0.4,0.6,0,1,1,0.2,0.2,0,0,0.2,0.2,0,1,1.2,0.2,0,0.2,0,buffer,C_Ug +425,R_5hMey31i8f8F2kZ,53 - 59,Canadian,Female,Female,College Diploma/Certificate,58,03VPfPs,01PAST,10,01ITEM,0.5,0,1,2,3,2,2,2,-1,2,2,2,1,1,-1,2,1,0,2,3,2,2,3,-2,1,2,1,1,2,-1,2,1,0,3,3,2,1,3,-3,3,2,3,2,0,1,3,2,-1,3,3,2,3,2,-2,0,1,1,1,0,-1,2,0,2,3,3,3,3,0,-1,0,0,0,0,2,-1,3,-3,2,6,6,5,8,5,6,4,4,4,7,5,7,0,0,0,0,1,1,1,0,1,0,1,0,0,0,0,1,0,0,1,1,2,1,0,1,1,1,2,1,1,1,1,0,0,1,0,1,2,1,1,0,1,0,0,1,2,1,0,1,1,2,0,2,2,2,1,1,0,1,4,2,1,0,0,1,0,1,2,0,2,1,2,2,1,1,1,0,0,1,0,2,1,0,1,1,1,2,0,1,3,0,buffer,-1,0,0,-1,1,0,-1,-1,0,0,0,0,0,-1,-2,0,0,-1,0,-1,2,-1,-2,-1,0,0,2,0,-3,-1,1,0,-1,1,-2,0,2,-1,1,0,0,2,0,-2,1,buffer,2,2,1,1,0,-1,buffer,-0.2,-0.4,-0.6,-0.4,-0.4,-0.4,-0.2,0.4,0.2,buffer,1.666666667,0,-0.4,-0.4,0.133333333,buffer,2,1,1,3,1,3,0.2,0.6,0.2,0.6,1,1.2,0.4,1,0.8,1,1.4,1.6,0.4,1.2,1.4,0.6,0.8,1.2,buffer,C_Ug +426,R_3ZaGNr7sQUxBidX,25 - 31,American,Female,Female,College Diploma/Certificate,25,01PfPsV,02FUT,10,01ITEM,1.375,0,0.666666667,3,1,2,2,3,2,3,1,1,2,3,3,1,1,2,3,1,2,3,1,3,2,3,2,1,2,1,1,0,3,2,1,3,3,2,1,3,2,2,3,2,2,2,3,1,3,1,2,3,2,3,2,1,3,2,3,2,3,2,1,1,2,0,3,1,0,1,2,2,3,2,3,2,1,0,8,8,7,6,6,6,9,8,5,9,8,8,0,0,0,1,2,1,1,2,1,1,1,2,0,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,2,1,0,0,0,1,1,1,1,0,2,0,0,1,2,1,1,2,1,2,1,2,2,2,1,1,1,1,0,1,0,2,1,0,1,0,1,2,1,1,0,2,0,1,1,3,2,2,1,2,0,1,3,1,1,1,1,1,1,1,1,1,buffer,0,0,0,0,1,0,0,2,-1,1,1,1,-2,0,0,-1,-1,-1,0,-1,-1,-2,0,0,0,0,1,0,2,-1,-1,-1,-1,0,0,-1,0,0,-1,1,-1,0,0,2,1,buffer,-1,0,2,-3,-2,-2,buffer,0.2,0.4,0,-0.8,-0.6,0.4,-0.6,-0.2,0.4,buffer,0.333333333,-2.333333333,0.2,-0.333333333,-0.133333333,buffer,2,2,1,0,0,3,0.6,1.2,1,0.8,0.8,1.2,0.4,0.8,1,1.6,1.4,0.8,0.6,1.2,1.4,1.2,1.4,1,buffer,C_Ug +427,R_6OcQXI2ElDfjvPW,25 - 31,American,Female,Female,High School (or equivalent),29,02PsVPf,01PAST,10,01ITEM,0.25,0,1,1,2,1,2,-1,-1,2,-1,2,-1,2,1,1,-1,1,1,2,2,2,-2,-2,1,-2,1,-2,1,-1,1,-2,1,-1,2,2,2,-2,-1,1,-1,1,-1,1,-1,-1,-2,1,2,2,2,2,-2,-2,-2,-1,1,-2,2,1,1,-2,2,2,2,2,2,-2,-1,1,-2,1,-2,1,-1,1,-1,1,4,3,4,4,6,8,3,3,3,3,3,6,0,0,1,0,1,1,1,1,1,1,1,2,0,1,0,2,0,1,0,1,0,1,0,1,0,1,2,2,1,0,1,0,1,0,1,1,4,0,1,1,0,0,0,1,1,1,0,1,0,1,0,1,1,1,1,1,2,0,0,0,2,0,0,0,0,1,0,1,0,1,0,0,2,0,0,0,0,0,0,0,1,3,1,0,0,1,2,0,1,1,buffer,-1,0,0,0,0,0,-3,1,0,0,1,2,0,0,-1,1,0,0,0,0,0,0,-1,0,-1,0,0,2,1,0,2,0,0,0,0,0,-3,0,0,1,-1,-2,2,-1,-1,buffer,1,0,1,1,3,2,buffer,-0.2,-0.4,0.4,0.2,-0.4,0.6,0.4,-0.4,-0.6,buffer,0.666666667,2,-0.066666667,0.133333333,-0.2,buffer,0,3,4,0,0,3,0.4,1,0.8,0.8,0.4,1.2,0.6,1.4,0.4,0.6,0.8,0.6,0.4,0.6,0.4,0,1,1,buffer,HS_TS +428,R_6V7mTJpfer87KvO,46 - 52,Canadian,Male,Male,High School (or equivalent),49,01PfPsV,02FUT,10,01ITEM,0.375,0,1,0,2,2,0,-3,-1,0,1,2,0,3,2,1,-1,3,0,3,2,-1,-2,-1,0,0,-1,-1,3,2,1,0,3,0,3,2,0,-3,1,1,2,2,1,3,2,1,0,3,0,3,2,0,-3,-1,-1,2,0,0,3,2,2,0,3,0,3,3,1,-3,-1,0,2,2,0,3,3,1,0,2,1,3,1,4,9,1,2,6,1,5,5,2,0,1,0,1,1,0,0,1,3,1,0,0,0,1,0,0,1,0,0,0,2,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,2,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,2,1,2,3,2,0,0,0,0,0,0,0,1,1,0,0,1,0,2,0,0,1,1,0,1,buffer,0,0,0,1,1,0,-1,0,1,1,0,0,-1,0,0,0,0,-1,-1,0,2,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,1,2,0,2,1,2,0,-1,-1,0,-1,buffer,-1,-3,0,-1,4,-1,buffer,0.4,0.2,-0.2,-0.4,0.8,-0.4,0,1.4,-0.6,buffer,-1.333333333,0.666666667,0.133333333,0,0.266666667,buffer,3,6,0,3,1,1,0.6,1,0.2,0.2,1,0.2,0.2,0.8,0.4,0.6,0.2,0.6,0.4,2,0,0.4,0.6,0.6,buffer,HS_TS +429,R_5ARz8uHpt8i8jlW,25 - 31,Canadian,Male,Male,High School (or equivalent),30,01PfPsV,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,-3,3,-1,1,0,-1,0,0,0,0,1,1,0,0,1,-3,2,-1,1,1,-1,0,0,0,-1,1,0,0,0,1,-3,2,0,1,1,-1,0,0,0,1,1,0,0,0,1,-2,3,-2,1,0,-1,0,0,0,-1,1,0,0,0,1,-2,3,-2,1,0,-1,0,0,0,0,1,0,0,0,1,3,3,3,3,3,3,3,3,3,3,3,3,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,-1,1,-1,0,1,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,0.2,0,0.2,0.2,0,buffer,0,0,0,0.133333333,0.133333333,buffer,0,0,0,0,0,0,0.4,0.2,0.2,0.6,0.2,0.2,0.4,0.2,0.2,0.4,0,0.2,0.2,0.4,0,0,0.2,0,buffer,HS_TS +430,R_7OlzeOEoXi6sKz1,32 - 38,American,Female,Female,Professional Degree (ex. JD/MD),35,03VPfPs,01PAST,5,02DGEN,1,0,1,3,3,2,2,2,2,-3,2,-3,2,2,3,3,2,3,2,3,1,2,2,2,2,2,3,2,1,2,2,2,1,3,3,2,2,2,2,2,2,3,2,3,2,2,2,2,3,3,2,2,2,2,3,2,3,2,3,2,2,3,2,2,2,3,3,2,2,2,2,3,2,3,2,2,3,2,5,7,7,6,7,7,7,6,7,5,7,7,1,0,1,0,0,0,5,0,6,0,1,1,1,0,2,0,0,0,0,0,0,5,0,6,0,1,1,1,0,1,0,0,0,0,0,0,6,0,6,0,1,1,1,1,1,1,1,1,1,0,0,5,0,6,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,2,0,0,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,buffer,1,0,1,0,0,0,-1,0,0,0,0,0,0,-1,1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,0,2,0,0,0,1,buffer,-2,1,0,1,0,0,buffer,0.4,-0.2,0,-0.8,0,-0.2,-0.4,-0.2,0.6,buffer,-0.333333333,0.333333333,0.066666667,-0.333333333,-1.85E-17,buffer,1,0,0,2,1,0,0.4,2.2,1,0,2.2,0.8,0,2.4,1,0.8,2.2,1,0.4,0,0.6,0.8,0.2,0,buffer,grad_prof +431,R_5E9ViorLhnK8rMQ,32 - 38,American,Male,Male,University - PhD,33,01PfPsV,02FUT,5,02DGEN,0.625,0.333333333,0,1,2,3,2,1,1,2,1,1,0,2,1,1,0,2,3,1,2,1,2,1,1,2,0,1,1,2,1,2,0,2,0,3,2,1,2,1,0,1,2,2,0,3,1,2,3,1,1,2,1,1,2,2,3,1,1,3,2,0,-1,2,0,-1,1,3,3,0,-1,1,2,1,1,2,3,2,6,6,7,7,7,7,6,7,6,6,6,6,2,1,1,1,1,0,1,1,1,1,1,1,0,2,2,1,2,0,0,0,1,1,1,0,2,0,1,2,1,0,2,1,2,0,0,0,0,1,2,1,1,2,1,0,3,1,2,4,1,2,2,2,2,0,2,1,0,1,3,0,1,1,1,1,1,1,0,2,1,1,1,2,2,1,2,1,1,2,1,2,2,2,3,2,1,0,2,0,3,3,buffer,0,0,-1,1,1,0,1,0,-1,0,0,-1,-1,2,-1,0,0,-4,-1,-2,-1,-1,-1,0,0,-1,1,1,-2,0,0,0,-1,0,-1,-1,-2,-1,-1,0,1,0,2,-2,-1,buffer,0,-1,1,1,1,1,buffer,0.2,0,-0.2,-1.4,-0.6,-0.2,-0.4,-1,0,buffer,0,1,0,-0.733333333,-0.466666667,buffer,1,1,0,0,1,0,1.2,0.8,1.2,0.6,1,0.8,1,0.8,1.4,2,1.6,1,1,1,1.6,1.4,2,1.6,buffer,grad_prof +432,R_7n6GkzBhH7a69AA,39 - 45,American,Female,Female,Trade School (non-military),42,02PsVPf,01PAST,10,01ITEM,-0.25,0,1,3,3,2,3,1,2,-1,2,-1,1,2,3,3,-2,3,3,3,2,-2,3,3,2,3,1,2,2,2,3,-2,3,3,3,2,-3,1,1,-1,-2,3,-2,-3,-2,2,3,-1,3,3,3,3,-2,-1,-1,1,1,-1,2,2,3,-3,3,-2,-1,2,3,-3,-1,-1,-3,2,-3,0,1,1,-3,0,2,3,1,3,6,8,2,5,2,8,10,4,0,0,0,5,2,1,3,1,2,1,0,1,0,0,0,0,0,0,6,0,1,0,4,4,3,5,5,1,5,4,0,0,1,0,3,3,0,1,2,2,0,1,0,1,0,5,4,0,0,4,3,0,5,3,4,2,2,2,1,3,0,0,0,1,2,2,3,5,2,4,5,4,1,5,4,5,4,1,0,1,0,0,4,1,2,2,1,2,0,3,buffer,0,0,-1,5,-1,-2,3,0,0,-1,0,0,0,-1,0,-5,-4,0,6,-4,-2,0,-1,1,-1,3,3,-1,4,1,-5,-4,-1,1,1,2,3,1,1,2,3,3,-1,5,1,buffer,0,-2,-1,-5,-4,4,buffer,0.6,0,-0.2,-1.4,-0.6,2,-1.6,1.8,2.2,buffer,-1,-1.666666667,0.133333333,3.70E-17,0.8,buffer,1,3,7,6,5,2,1.4,1.6,0.2,1.2,2.4,4,0.8,1.6,0.4,2.6,3,2,0.6,3.2,3.8,2.2,1.4,1.6,buffer,HS_TS +433,R_3Vhy7KwpEkDYcIF,39 - 45,American,Male,Male,College Diploma/Certificate,42,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,1,1,1,2,0,-2,-1,0,0,0,0,-2,1,-1,1,0,2,2,0,-1,-3,0,0,0,-2,0,-1,0,-1,1,-1,2,2,0,-1,-3,-1,0,0,-1,0,-1,1,-1,1,1,2,2,2,1,-3,-1,0,0,0,0,-2,1,-1,1,1,1,1,3,1,-3,-1,1,0,0,0,-2,1,-1,1,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,2,1,1,1,0,0,2,0,1,1,0,0,2,1,1,2,1,1,0,0,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,buffer,1,0,0,2,0,0,1,0,0,2,0,1,1,0,0,2,1,1,1,0,0,0,-1,0,1,0,1,0,0,0,1,-1,-1,-1,0,0,1,-1,0,1,0,0,1,0,0,buffer,0,0,0,0,0,0,buffer,0.6,0.6,0.4,1,0,0.2,-0.4,0.2,0.2,buffer,0,0,0.533333333,0.4,0,buffer,0,0,0,0,0,0,1.2,0.8,0.4,1.4,0.4,0.2,0.6,0.2,0,0.4,0.4,0,0.2,0.4,0.2,0.6,0.2,0,buffer,C_Ug +434,R_1dEujNnGaGAwREn,32 - 38,Canadian,Male,Male,College Diploma/Certificate,35,01PfPsV,02FUT,10,01ITEM,0.25,0.333333333,0.666666667,1,2,3,2,3,0,-2,2,-2,1,1,-1,2,-1,0,2,2,2,2,2,-1,-2,2,-1,1,1,-1,2,-1,0,2,2,2,2,2,-1,-2,2,-2,1,1,-1,2,-1,0,2,2,2,2,3,-1,-2,2,-2,1,1,-1,2,-1,0,2,3,3,2,3,-1,-2,3,-2,1,1,-1,2,-1,0,2,2,2,2,2,2,2,2,2,2,2,2,1,0,1,0,1,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,-1,1,0,1,0,0,-1,0,0,0,0,0,0,0,0,-1,-1,0,0,0,0,-1,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,0.2,0,0.2,-0.2,0,-0.4,0,0,buffer,0,0,0.133333333,0,-0.133333333,buffer,0,0,0,0,0,0,0.6,0.4,0,0.6,0.2,0,0.4,0.2,0,0.4,0.4,0,0,0.2,0,0.4,0.2,0,buffer,C_Ug +435,R_5QZNQVyCgg6mHxT,32 - 38,Canadian,Male,Male,College Diploma/Certificate,37,02PsVPf,01PAST,5,02DGEN,0.125,0.666666667,0.333333333,2,2,1,-1,1,-1,1,2,0,1,2,1,2,1,2,1,2,1,-1,1,0,-1,2,-1,3,2,1,1,1,2,1,2,-1,-1,0,1,-2,1,0,2,1,0,0,1,2,1,2,1,0,1,-1,0,2,0,1,2,2,2,2,2,1,2,1,0,1,1,0,2,-1,2,2,2,2,2,2,1,3,4,2,6,5,3,4,3,2,4,4,1,0,0,0,0,1,2,0,1,2,0,0,1,0,0,1,0,2,0,1,2,3,1,0,1,1,1,2,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,0,1,0,2,1,0,1,1,0,1,0,1,0,0,0,2,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,buffer,0,0,0,-1,0,1,1,0,1,2,0,-1,1,-1,0,0,0,2,-1,1,0,2,1,-1,0,1,0,2,-1,0,0,0,2,0,1,-1,1,1,0,0,1,1,1,0,0,buffer,-2,-1,1,0,2,1,buffer,-0.2,1,-0.2,0.4,0.4,0.4,0.6,0.2,0.6,buffer,-0.666666667,1,0.2,0.4,0.466666667,buffer,1,3,1,1,0,1,0.2,1.2,0.2,0.8,1.4,0.8,0.4,0.2,0.4,0.4,1,0.4,0.6,1,0.6,0,0.8,0,buffer,C_Ug +436,R_3ZBuQ2egixQQH23,39 - 45,American,Female,Female,University - PhD,41,01PfPsV,02FUT,5,01ITEM,0.375,0,1,3,-2,2,-2,3,-1,1,1,-2,0,1,-2,2,-1,1,3,-2,3,-2,2,-2,1,1,-1,0,2,-2,1,-2,-1,2,-2,2,-2,2,-1,0,1,0,2,1,-1,2,-1,0,2,-2,2,1,2,-2,1,2,-1,0,1,-1,2,-2,2,2,-2,2,1,2,-2,1,2,1,0,2,-2,2,-2,2,1,2,3,1,3,3,2,1,1,1,1,1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,2,1,0,0,0,1,0,1,0,2,2,0,1,0,0,1,1,0,0,3,1,1,0,1,1,0,0,1,0,1,1,1,0,0,3,1,1,0,1,3,0,1,0,0,1,1,1,0,1,0,0,1,1,0,1,2,1,1,1,1,1,0,0,0,0,0,0,0,0,2,0,1,1,0,0,0,buffer,-1,0,1,-3,0,0,0,-1,0,0,1,-1,1,0,1,0,0,0,-3,0,-1,1,-1,-1,2,-1,1,0,-1,0,1,0,1,0,0,1,1,0,-1,2,0,0,1,1,1,buffer,-1,1,2,0,2,2,buffer,-0.6,-0.2,0.4,-0.6,0,-0.2,0.4,0.6,0.6,buffer,0.666666667,1.333333333,-0.133333333,-0.266666667,0.533333333,buffer,0,1,0,1,0,0,0.4,0.4,1,0.4,1,0.4,1,0.6,0.6,1,1,0.6,0.4,1,1,0,0.4,0.4,buffer,grad_prof +437,R_7rwuOH1mNVm1TPa,32 - 38,Canadian,Male,Male,College Diploma/Certificate,32,03VPfPs,02FUT,5,01ITEM,0.25,0,1,2,2,2,1,3,0,3,0,3,0,0,1,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,2,2,2,1,3,0,3,0,3,0,0,1,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,10,0,0,10,10,10,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,buffer,5,-5,-5,5,5,5,buffer,0,0,0.2,0,0,0,0,0,-0.2,buffer,-1.666666667,5,0.066666667,0,-0.066666667,buffer,0,10,10,0,0,0,0,0,0.2,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,0.2,buffer,C_Ug +438,R_3O7M4ezgQ3BJwY1,25 - 31,Canadian,Female,Female,High School (or equivalent),26,02PsVPf,01PAST,10,01ITEM,1.375,0.333333333,0.666666667,3,3,2,2,0,2,1,2,3,1,3,1,1,2,2,3,3,3,3,0,1,1,1,1,1,3,3,3,3,3,3,3,3,3,0,2,2,2,3,-1,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,1,1,3,2,1,2,2,3,3,1,4,4,3,2,5,3,2,2,3,3,2,0,0,1,1,0,1,0,1,2,0,0,2,2,1,1,0,0,1,1,0,0,1,0,0,2,2,2,2,0,1,0,0,1,1,3,1,2,1,0,2,0,2,2,1,1,0,0,1,1,1,0,0,1,0,1,2,1,1,1,1,0,0,0,0,0,1,1,1,2,2,2,0,0,1,0,0,0,0,0,2,1,2,2,0,1,2,1,1,0,0,buffer,0,0,0,0,-3,0,-2,0,2,-2,0,0,0,0,0,0,0,0,0,-1,0,1,-1,0,1,0,1,1,-1,0,0,0,0,0,-2,0,-1,-1,2,1,0,-1,-1,1,0,buffer,-2,2,2,0,-1,3,buffer,-0.6,-0.4,0,-0.2,0.2,0.2,-0.4,0.2,-0.2,buffer,0.666666667,0.666666667,-0.333333333,0.066666667,-0.133333333,buffer,2,2,1,0,1,0,0.4,0.8,1.2,0.4,0.6,1.4,1,1.2,1.2,0.6,0.4,1.2,0,1.4,0.6,0.4,1.2,0.8,buffer,HS_TS +439,R_7Cgs4ihCU5s3Qb4,25 - 31,Canadian,Male,Male,University - Undergraduate,30,01PfPsV,02FUT,5,02DGEN,0.375,0,1,1,3,3,1,2,-3,1,-2,3,0,3,3,3,3,-1,3,3,3,3,3,-3,3,3,3,-2,3,-2,3,3,2,3,3,3,3,3,-3,3,-2,2,-2,3,2,3,3,-1,3,3,3,3,3,-3,-2,2,-2,2,3,3,3,-1,1,3,3,3,3,3,1,-3,3,-3,2,3,3,3,-3,3,0,0,0,0,0,5,0,0,0,3,1,1,2,0,0,2,1,0,2,5,0,2,0,5,0,0,3,2,0,0,2,1,0,2,0,1,2,0,1,0,0,0,2,0,0,2,1,0,3,4,5,2,0,0,0,4,2,2,0,0,2,1,4,4,5,6,2,0,0,0,6,4,0,0,0,0,0,0,0,5,1,0,0,4,0,0,3,0,0,0,0,0,4,1,1,1,0,0,0,0,2,2,buffer,0,0,0,0,0,0,-1,1,-5,0,0,5,0,-4,1,0,0,0,0,0,-4,-2,-5,-5,0,0,1,0,-6,-4,0,0,0,0,0,-4,-1,4,0,0,0,4,0,-2,1,buffer,0,0,0,-3,-1,4,buffer,0,-1,0.4,0,-3.2,-1.8,0,-0.2,0.6,buffer,0,0,-0.2,-1.666666667,0.133333333,buffer,0,0,5,3,1,1,1,1.8,1.6,1,1,0.2,1,2.8,1.2,1,4.2,2,0,1.2,1.4,0,1.4,0.8,buffer,C_Ug +440,R_393iU1j0QCD9GDf,39 - 45,American,Male,Male,College Diploma/Certificate,43,02PsVPf,02FUT,5,01ITEM,0.5,0,1,3,3,3,0,3,0,-1,3,-2,-2,3,0,2,0,3,3,3,3,3,3,2,0,0,0,2,3,2,3,3,2,3,3,3,0,3,1,0,1,0,1,3,1,3,3,2,2,2,3,0,3,2,-1,3,-2,2,1,1,-1,1,-1,3,3,3,3,3,2,2,1,0,2,2,1,2,2,2,5,5,7,6,5,5,5,9,8,5,5,5,0,0,0,3,0,2,1,3,2,4,0,2,1,3,1,0,0,0,0,0,1,1,2,2,3,0,1,1,3,1,1,1,0,0,0,2,0,0,0,4,2,1,3,1,4,0,0,0,3,0,2,3,2,2,4,1,1,0,2,1,0,0,0,3,0,1,0,1,0,1,0,1,0,0,0,1,1,0,3,0,0,3,2,2,0,1,0,3,1,3,buffer,-1,-1,0,3,0,0,1,3,2,0,-2,1,-2,2,-3,0,0,0,-3,0,-1,-2,0,0,-1,-1,0,1,1,0,-1,-1,0,0,0,1,-3,-1,-2,1,-1,1,-3,-1,-3,buffer,0,-4,-1,1,0,0,buffer,0.2,1.2,-0.8,-0.6,-0.8,0.2,-0.4,-0.8,-1.4,buffer,-1.666666667,0.333333333,0.2,-0.4,-0.866666667,buffer,1,0,2,0,4,3,0.6,2.4,1.4,0,1.8,1.2,0.4,1.2,2.2,0.6,2.6,1,0.6,0.6,0.2,1,1.4,1.6,buffer,C_Ug +441,R_6SDeNyxNCfYeKhn,25 - 31,American,Female,Female,University - Undergraduate,30,01PfPsV,01PAST,10,02DGEN,0.75,0,0.666666667,3,2,2,2,1,-2,2,2,0,3,0,0,1,1,1,2,2,1,1,1,-1,-1,1,-2,-1,1,1,0,0,0,2,3,2,1,2,-1,-1,0,0,0,0,1,1,1,1,1,1,2,0,1,0,1,0,0,1,-1,0,0,0,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,1,4,5,4,0,3,3,3,3,2,4,1,1,1,0,1,1,0,1,3,1,2,4,1,1,1,1,1,1,1,0,1,1,1,3,2,0,3,0,1,0,0,0,2,1,0,2,0,2,1,2,0,2,1,0,1,1,0,2,1,1,1,0,2,1,1,0,2,0,0,0,1,0,0,1,1,0,1,0,0,1,2,1,1,0,1,1,1,0,0,1,1,0,0,0,1,0,0,1,0,1,0,0,buffer,-1,-1,1,-1,0,-1,2,-1,2,2,0,1,0,0,1,-1,0,-1,0,1,-1,2,1,0,1,0,1,0,-1,0,0,1,0,-1,1,0,0,0,2,1,0,0,0,1,1,buffer,1,2,2,-4,2,2,buffer,-0.4,0.8,0.4,-0.2,0.6,0,0.2,0.6,0.4,buffer,1.666666667,0,0.266666667,0.133333333,0.4,buffer,4,2,1,1,2,1,0.6,2.2,1,0.8,1.8,0.2,1,1.4,0.6,1,1.2,0.2,0.6,0.8,0.8,0.4,0.2,0.4,buffer,C_Ug +442,R_3KZv5xSxkACcuo4,39 - 45,American,Male,Male,High School (or equivalent),43,03VPfPs,01PAST,10,01ITEM,0.125,0.333333333,0.666666667,0,2,2,1,3,0,1,2,-2,2,1,-1,3,0,3,0,2,3,1,3,0,1,3,-3,3,1,-2,3,0,3,0,2,3,1,3,0,0,2,-3,3,0,-3,3,0,3,0,2,3,2,3,0,1,3,-3,3,1,-2,3,0,3,1,2,3,2,3,0,1,3,-3,3,1,-2,3,0,3,0,0,0,2,1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,1,1,2,0,0,0,0,0,1,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,1,-1,0,0,1,1,0,0,0,-1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,buffer,0,0,0,1,0,1,buffer,-0.2,0,0,-0.4,0,0.4,-0.2,0.4,0.4,buffer,0,0.666666667,-0.066666667,0,0.2,buffer,2,1,1,1,1,0,0.2,0.6,0.2,0.2,0.6,0.6,0.4,0.6,0.2,0.6,0.6,0.2,0,0.4,0.4,0.2,0,0,buffer,HS_TS +443,R_1fDdcEyuCuBMSWX,18 - 24,Canadian,Female,Female,High School (or equivalent),22,01PfPsV,02FUT,5,02DGEN,0.125,0,1,1,3,2,3,3,2,1,3,1,2,2,1,3,1,2,3,3,3,2,2,-2,2,1,2,-1,2,1,1,2,2,3,2,2,-1,1,-3,2,-1,3,-3,2,1,2,-1,2,2,3,2,3,3,2,-1,3,-2,3,2,1,3,-2,2,3,3,2,2,3,2,-2,3,-3,3,2,1,3,-2,2,7,6,5,8,10,7,5,5,5,5,5,5,2,0,1,1,1,4,1,2,1,3,0,0,2,1,0,2,1,0,4,2,5,1,4,2,5,0,0,1,2,0,1,0,0,0,0,0,2,0,3,1,0,0,0,3,0,2,0,0,1,0,0,3,0,4,1,0,0,0,3,0,0,1,1,3,1,1,0,2,1,2,0,0,1,3,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,buffer,1,0,1,1,1,4,-1,2,-2,2,0,0,2,-2,0,0,1,0,3,2,5,-2,4,-2,4,0,0,1,-1,0,-1,1,1,2,1,1,-1,2,0,2,0,0,1,3,0,buffer,2,1,0,3,5,2,buffer,0.8,1,0,1.2,1.8,0,0.8,0.8,0.8,buffer,1,3.333333333,0.6,1,0.8,buffer,1,4,2,0,0,0,1,2.2,0.6,1.8,3.4,0.6,0.2,1.2,0.6,0.6,1.6,0.6,1.2,1.2,0.8,0.4,0.4,0,buffer,HS_TS +444,R_1HS3RkBX2radTK9,25 - 31,American,Female,Female,College Diploma/Certificate,26,03VPfPs,01PAST,5,01ITEM,1.5,0,0.666666667,3,2,2,3,3,3,2,3,2,3,3,2,3,2,3,3,2,3,2,3,3,2,3,3,2,3,3,2,3,3,2,2,3,3,3,3,2,3,3,2,1,1,3,1,2,3,2,3,3,3,3,2,3,2,3,2,3,3,2,3,2,3,3,3,3,3,3,3,2,2,3,2,3,2,3,7,8,6,8,8,8,9,9,9,9,8,8,0,0,1,1,0,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,0,1,1,2,1,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,2,2,1,2,1,1,1,0,0,0,0,1,0,0,1,1,1,0,0,0,buffer,0,0,0,1,0,0,0,0,1,1,-1,0,1,1,0,0,-1,0,0,0,0,-1,0,1,0,2,1,0,1,1,0,-1,0,1,0,0,-1,0,0,-1,1,1,1,2,1,buffer,-2,-1,-3,-1,0,0,buffer,0.2,0.4,0.2,-0.2,0,1,0,-0.4,1.2,buffer,-2,-0.333333333,0.266666667,0.266666667,0.266666667,buffer,1,0,2,0,1,1,0.4,0.4,0.6,0.4,0.4,1,0.2,0,0.4,0.6,0.4,0,0.4,0,1.6,0.4,0.4,0.4,buffer,C_Ug +445,R_3q4O7ntpabecbYC,39 - 45,American,Male,Male,University - Graduate (Masters),43,02PsVPf,02FUT,10,02DGEN,1.25,1,0,3,2,2,0,3,3,2,2,3,2,3,2,3,3,3,2,3,1,0,2,1,2,3,2,1,3,1,3,2,1,1,1,3,3,2,3,2,2,2,1,2,1,3,1,3,1,2,2,0,3,1,1,2,1,2,1,2,2,1,1,3,1,2,2,1,2,1,1,1,2,1,1,2,2,1,8,8,8,8,8,8,8,8,7,8,8,8,1,1,1,0,1,2,0,1,1,1,0,1,0,1,2,2,1,1,3,1,0,0,0,1,1,1,1,0,2,0,2,0,0,0,0,2,1,0,2,0,2,0,1,2,2,0,1,0,2,2,1,1,1,2,0,2,1,1,1,2,1,2,2,3,0,2,0,1,0,0,1,0,0,1,2,2,1,0,2,2,1,0,1,0,0,0,1,0,1,0,buffer,-1,1,1,0,1,0,-1,1,-1,1,-2,1,-1,-1,0,2,0,1,1,-1,-1,-1,-1,-1,1,-1,0,-1,1,-2,-1,1,2,1,-2,1,0,0,0,0,1,-1,0,0,2,buffer,0,0,1,0,0,0,buffer,0.4,0,-0.6,0.6,-0.6,-0.6,0.2,0.2,0.4,buffer,0.333333333,0,-0.066666667,-0.2,0.266666667,buffer,0,0,0,0,0,1,0.8,1,0.8,1.6,0.4,0.8,0.4,1,1.4,1,1,1.4,1.6,0.6,0.8,1.4,0.4,0.4,buffer,grad_prof +446,R_65Kt0rAQIbvU7zf,25 - 31,American,Female,Female,High School (or equivalent),31,02PsVPf,01PAST,10,01ITEM,-0.125,1,0,1,0,0,0,1,-2,0,-2,0,1,0,0,1,0,0,1,-1,0,0,0,-1,0,-1,0,1,0,0,1,0,0,1,-2,0,0,0,-2,1,-1,1,1,0,-1,1,0,0,1,0,0,0,1,-1,-1,1,-1,1,0,0,1,0,0,1,0,0,0,1,-1,-1,1,-1,1,0,0,1,0,0,2,2,1,4,3,4,3,2,3,4,3,3,0,1,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,1,0,0,1,0,-1,-2,-1,0,0,0,0,0,0,0,2,0,0,1,-1,0,-2,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0,0,buffer,-1,0,-2,0,0,1,buffer,0.4,-0.8,0,0.6,-0.6,0.2,0.2,0.6,0.2,buffer,-1,0.333333333,-0.133333333,0.066666667,0.333333333,buffer,2,1,3,1,1,0,0.4,0.4,0,0.6,0.6,0.2,0,1.2,0,0,1.2,0,0.2,0.6,0.2,0,0,0,buffer,HS_TS +447,R_5TKPR1LQb8tEprm,32 - 38,American,Female,Female,University - Undergraduate,37,01PfPsV,02FUT,5,01ITEM,0.25,0,1,3,3,2,3,1,1,-2,2,-2,2,1,2,3,0,3,2,2,1,2,0,1,-2,1,-1,0,2,2,2,1,2,2,2,0,2,0,2,-1,0,-1,0,0,0,2,2,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,0,2,2,2,1,2,2,1,0,2,0,2,2,2,2,0,2,2,2,1,1,2,3,0,0,0,1,3,0,1,1,1,1,1,0,0,1,1,2,1,0,1,1,1,1,1,2,1,1,1,1,2,1,2,1,2,1,2,1,1,1,0,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,0,2,0,2,0,1,0,1,0,1,0,0,1,0,0,1,1,1,0,0,2,2,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,buffer,0,0,1,0,0,-1,-1,1,0,2,0,0,0,1,0,0,0,1,0,0,1,-1,2,-1,2,0,2,0,2,0,0,0,0,0,0,0,0,1,-1,0,2,2,0,1,0,buffer,2,2,1,0,-1,3,buffer,0.2,0.2,0.2,0.2,0.6,0.8,0,0,1,buffer,1.666666667,0.666666667,0.2,0.533333333,0.333333333,buffer,1,0,2,1,3,0,1,0.8,0.8,1.2,1.4,1.4,0.8,0.6,0.6,1,0.8,0.6,0.2,0.6,1,0.2,0.6,0,buffer,C_Ug +448,R_6EIajlGyiZ4iK9r,32 - 38,American,Male,Male,College Diploma/Certificate,34,03VPfPs,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,1,2,2,1,2,-2,1,3,2,0,2,-1,0,1,0,0,2,2,3,-1,1,1,2,2,1,3,1,0,2,1,1,2,2,2,-2,1,1,2,2,1,2,1,-1,2,1,1,2,2,2,2,-2,1,3,2,-2,2,0,1,-1,0,1,2,2,2,2,-2,2,2,2,-2,2,0,0,1,0,2,1,2,3,2,2,2,2,2,2,2,2,1,0,0,2,3,3,0,1,0,1,1,2,0,1,1,0,0,0,1,4,3,0,1,0,1,0,2,1,1,1,0,0,0,1,0,0,0,0,0,2,0,1,1,2,0,0,0,0,1,0,0,1,1,0,2,0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,2,0,buffer,1,0,0,1,3,3,0,1,0,-1,1,1,-1,-1,1,0,0,0,0,4,3,-1,0,0,-1,0,1,1,1,1,1,0,0,1,1,0,-1,-1,0,0,1,0,0,-2,0,buffer,0,-1,0,1,0,0,buffer,1,0.6,0.2,0.8,0.2,0.8,0.6,-0.4,-0.2,buffer,-0.333333333,0.333333333,0.6,0.6,-1.85E-17,buffer,1,1,0,0,0,0,1.2,1,1,1,1,1,0.2,0.4,0.8,0.2,0.8,0.2,0.6,0,0.4,0,0.4,0.6,buffer,C_Ug +449,R_6MuhwCW9iWSWXXF,18 - 24,American,Male,Male,College Diploma/Certificate,18,02PsVPf,01PAST,5,01ITEM,-0.5,0.333333333,0.666666667,-1,3,1,1,2,-1,-2,2,2,1,-2,-3,2,-1,2,-2,1,2,-1,-1,1,-1,-1,3,-1,-1,-2,1,-1,3,-1,1,1,3,3,1,-1,-1,-2,1,1,-1,2,-1,2,1,3,2,2,3,-3,-2,-2,-2,-1,-1,-2,1,1,2,-1,3,2,1,1,2,-3,3,1,1,1,2,1,2,-1,4,8,4,5,9,7,5,7,3,3,6,6,1,2,1,2,3,2,1,3,1,2,1,1,1,0,1,0,2,0,2,1,2,1,3,4,0,3,2,0,0,0,2,0,1,1,1,2,0,4,4,2,1,1,1,2,0,0,0,1,0,1,3,1,1,1,0,3,5,1,3,3,1,0,1,4,4,0,0,0,5,2,2,1,1,0,1,2,0,0,1,2,5,1,5,3,2,2,4,0,1,3,buffer,-1,2,0,1,2,0,1,-1,-3,0,0,0,0,-2,1,0,2,-1,2,0,-1,0,2,3,0,0,-3,-1,-3,-3,-1,0,1,3,2,-5,-1,-5,2,0,0,-3,1,-1,-2,buffer,-1,1,1,2,3,1,buffer,0.8,-0.6,-0.2,0.6,0.8,-2,1,-1.8,-1,buffer,0.333333333,2,1.85E-17,-0.2,-0.6,buffer,1,1,3,2,1,3,1.8,1.8,0.8,1,2,1,1,2.4,1,0.4,1.2,3,2,1.4,1,1,3.2,2,buffer,C_Ug +450,R_5QSPfbfURz0smCQ,25 - 31,Canadian,Male,Male,High School (or equivalent),28,02PsVPf,02FUT,10,02DGEN,0,0.333333333,0.666666667,3,3,3,3,3,-2,1,1,0,3,1,-3,3,-2,3,-1,0,3,3,-1,-2,1,-1,1,-1,1,-2,3,-2,1,-3,-3,3,3,-3,-3,3,-3,3,-1,2,1,3,3,-2,3,3,3,3,3,0,-3,0,0,3,1,-3,3,-2,3,3,3,3,3,3,1,-3,0,0,0,1,-3,3,-3,3,4,3,2,4,10,10,3,4,2,5,8,1,4,3,0,0,4,0,0,2,1,4,0,1,0,0,2,6,6,0,0,6,1,2,4,3,4,1,4,0,5,5,0,0,0,0,0,2,4,1,0,0,0,0,0,0,0,0,0,0,0,0,3,4,1,0,3,0,0,0,1,0,2,3,0,0,2,1,2,2,2,0,1,3,0,5,3,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,buffer,4,3,0,0,4,-2,-4,1,1,4,0,1,0,0,2,6,6,0,0,6,-2,-2,3,3,1,1,4,0,4,5,2,3,0,0,2,0,2,2,2,-3,1,3,0,4,3,buffer,1,-1,0,-1,2,9,buffer,2.2,0,0.6,3.6,0.6,2.8,1.4,0.6,2.2,buffer,0,3.333333333,0.933333333,2.333333333,1.4,buffer,0,7,8,2,4,1,2.2,1.4,0.6,3.6,2.8,3,0,1.4,0,0,2.2,0.2,1.4,1.4,2.4,0,0.8,0.2,buffer,HS_TS +451,R_3Y68hrqHAAuTrqX,18 - 24,Canadian,Female,Female,University - Undergraduate,21,01PfPsV,01PAST,10,02DGEN,-0.25,1,0,1,2,2,2,2,0,0,1,1,1,2,3,2,2,3,1,-2,0,1,1,0,-1,1,1,0,1,2,0,1,0,-1,1,2,-1,-1,-2,1,-1,-2,-2,1,-1,0,-1,2,2,2,1,2,2,2,2,2,3,3,3,2,3,3,3,2,2,2,2,2,1,1,1,2,1,2,2,2,2,2,6,4,5,7,8,6,1,1,1,4,4,3,0,4,2,1,1,0,1,0,0,1,1,1,2,1,3,2,1,0,3,3,2,1,2,3,3,1,4,2,3,1,1,0,1,0,0,2,2,1,2,2,1,1,1,1,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,2,3,2,2,2,2,2,2,3,2,0,3,0,2,2,0,0,1,0,0,1,1,1,1,2,1,0,1,1,1,buffer,-1,4,1,1,1,-2,-1,-1,-2,-1,0,0,1,0,3,1,1,0,3,3,1,0,2,2,3,1,3,2,3,0,2,3,1,2,2,1,1,1,2,0,-1,3,-1,1,1,buffer,5,3,4,3,4,3,buffer,1.2,-1.4,0.8,1.6,1.6,1.8,2,1,0.6,buffer,4,3.333333333,0.2,1.666666667,1.2,buffer,1,4,1,3,3,2,1.6,0.4,1.6,1.8,2.2,2.2,0.4,1.8,0.8,0.2,0.6,0.4,2.2,2.2,1.4,0.2,1.2,0.8,buffer,C_Ug +452,R_3TCvDY1EpCYF1vj,25 - 31,American,Male,Male,Professional Degree (ex. JD/MD),25,01PfPsV,02FUT,5,01ITEM,1.5,0.333333333,0.666666667,3,3,1,2,2,1,3,1,0,2,3,2,2,3,1,2,2,3,3,3,2,1,2,1,3,2,3,2,1,3,3,3,3,2,2,2,3,3,1,2,2,3,3,3,2,3,3,2,3,2,3,0,2,-1,3,3,2,3,2,3,2,1,3,3,2,3,2,3,1,3,2,2,1,3,1,9,8,9,9,8,9,8,9,9,9,9,9,1,1,2,1,1,1,2,1,1,1,1,1,0,2,2,0,0,2,0,0,1,0,2,1,0,1,1,1,0,1,0,0,1,1,0,2,3,1,1,1,0,0,1,1,2,1,2,2,1,0,2,1,2,1,1,1,0,1,0,0,1,1,0,1,1,0,2,1,0,1,0,0,1,2,1,1,2,1,0,0,0,2,1,2,0,1,0,2,1,2,buffer,1,1,1,0,1,-1,-1,0,0,0,1,1,-1,1,0,-1,-2,0,-1,0,-1,-1,0,0,-1,0,1,0,0,1,0,-1,-1,1,1,0,0,0,-2,1,-1,0,-1,1,-1,buffer,1,-1,0,0,-1,0,buffer,0.8,-0.4,0.4,-0.8,-0.6,0.4,0,-0.2,-0.4,buffer,0,-0.333333333,0.266666667,-0.333333333,-0.2,buffer,0,0,0,1,0,0,1.2,1.2,1.2,0.4,0.8,0.8,0.4,1.6,0.8,1.2,1.4,0.4,0.8,0.8,0.8,0.8,1,1.2,buffer,grad_prof +453,R_6FCEd81BVKHY6dS,32 - 38,Canadian,Male,Male,Trade School (non-military),34,03VPfPs,02FUT,5,01ITEM,0.75,1,0,2,3,1,1,0,-3,1,-2,2,-2,-1,1,3,1,2,2,3,1,-2,0,-2,0,-3,1,0,-1,2,1,2,1,2,3,1,-2,1,0,-1,1,-1,1,1,2,1,2,2,2,3,1,2,0,-2,0,1,0,0,-1,1,3,2,2,2,3,1,2,0,0,-1,2,0,0,0,1,3,2,3,2,2,5,6,7,6,1,5,2,0,4,3,0,0,0,3,0,1,1,1,1,2,0,1,2,1,1,0,0,0,3,1,3,2,3,3,3,2,1,2,1,0,0,0,0,1,0,1,1,3,2,2,0,0,0,1,0,0,0,0,1,0,3,2,4,2,2,1,0,0,1,1,0,0,0,0,1,2,1,4,2,1,2,0,0,0,1,0,0,0,0,0,2,1,1,0,0,1,0,0,0,1,buffer,0,0,0,2,0,0,0,-2,-1,0,0,1,2,0,1,0,0,0,2,1,0,0,-1,1,1,1,1,2,0,-1,0,0,0,0,1,0,0,3,2,1,1,0,0,0,0,buffer,1,-3,3,6,3,3,buffer,0.4,-0.6,0.8,0.6,0.2,0.6,0.2,1.2,0.2,buffer,0.333333333,4,0.2,0.466666667,0.533333333,buffer,4,5,1,1,1,1,0.6,1.2,1,0.8,2.8,1.2,0.2,1.8,0.2,0.2,2.6,0.6,0.2,2,0.6,0,0.8,0.4,buffer,HS_TS +454,R_1iaMazG0aOQQ0zT,25 - 31,Canadian,Male,Male,University - Undergraduate,25,02PsVPf,02FUT,5,01ITEM,0.625,0.666666667,0.333333333,-1,1,2,1,1,1,1,0,-1,2,1,0,0,1,-1,1,0,3,1,1,0,1,1,0,3,3,0,0,1,1,-1,2,0,1,1,0,-1,2,-1,1,-1,2,0,0,1,2,1,0,0,1,1,-1,1,0,1,1,1,-1,1,0,1,0,3,1,0,-1,1,1,0,2,1,-1,0,1,2,7,6,6,7,6,7,6,8,6,5,6,6,2,1,1,0,0,1,0,1,1,1,2,0,0,0,2,0,1,2,0,0,1,2,2,0,1,2,2,0,1,2,3,0,2,1,0,0,2,1,1,1,0,1,1,0,1,2,1,1,0,1,2,0,1,1,0,0,1,0,0,3,2,2,3,0,0,0,2,1,1,2,4,2,0,1,0,1,1,3,1,1,2,2,0,0,1,0,2,1,0,2,buffer,-1,1,-1,-1,0,1,-2,0,0,0,2,-1,-1,0,1,-2,0,1,0,-1,-1,2,1,-1,1,2,1,0,1,-1,1,1,0,-1,-1,-2,0,1,1,1,4,0,-1,1,-2,buffer,1,-2,0,2,0,1,buffer,-0.4,-0.2,0.2,-0.4,0.4,0.6,0,0.2,0.4,buffer,-0.333333333,1,-0.133333333,0.2,0.2,buffer,0,0,1,1,2,0,0.8,0.8,0.8,0.6,1.2,1.4,1.2,1,0.6,1,0.8,0.8,1.4,1.2,1.4,1.4,1,1,buffer,C_Ug +455,R_7tsUaAquS2msejC,18 - 24,Canadian,Male,Male,High School (or equivalent),23,01PfPsV,01PAST,10,02DGEN,0.125,0,1,3,3,3,3,3,-1,2,1,0,2,-2,2,2,-1,1,2,2,2,2,2,-2,2,-1,1,2,3,1,3,1,-1,1,3,3,3,-1,-2,2,1,0,2,1,-2,3,2,-2,3,3,3,3,3,1,-1,3,-1,3,3,3,3,-1,2,3,3,3,3,3,0,2,2,-1,2,2,2,2,-1,2,1,1,9,9,1,6,0,1,0,0,0,0,1,1,1,1,1,1,0,2,1,0,5,1,1,2,2,2,0,0,0,4,1,0,0,0,0,3,4,1,3,3,0,0,0,0,0,2,3,2,1,1,5,1,1,0,1,0,0,0,0,0,1,0,1,1,0,4,0,0,0,1,1,1,1,1,3,0,0,2,1,0,2,3,0,1,1,0,0,0,0,0,1,3,1,0,1,1,1,1,0,0,buffer,1,1,1,1,1,-1,-3,0,0,-1,0,0,0,2,1,2,0,0,0,4,0,0,-1,-1,0,-1,4,1,3,2,1,1,1,1,3,-1,-3,1,1,-1,1,2,-1,1,1,buffer,1,0,9,9,1,6,buffer,1,-1,0.6,1.2,-0.4,1.8,1.4,-0.6,0.8,buffer,3.333333333,5.333333333,0.2,0.866666667,0.533333333,buffer,8,0,3,0,1,0,1,0.8,2.2,1.2,0.2,2.8,0,1.8,1.6,0,0.6,1,1.4,0.6,1.4,0,1.2,0.6,buffer,HS_TS +456,R_7q3JYGkRcevsasx,32 - 38,Canadian,Male,Male,University - Undergraduate,33,02PsVPf,01PAST,5,01ITEM,0.375,0.333333333,0.666666667,-2,3,3,3,3,3,-2,3,-3,3,1,1,3,1,2,-3,3,3,3,3,3,-1,3,-2,3,1,3,2,3,2,-3,3,3,3,3,3,1,3,0,3,1,2,1,3,2,0,3,3,3,3,3,-2,3,-3,3,3,0,3,0,3,0,3,3,3,3,3,-3,3,-3,3,3,0,3,0,3,0,0,2,0,4,5,3,2,4,2,2,3,1,0,0,0,0,0,1,0,1,0,0,2,1,2,0,1,0,0,0,0,0,3,0,3,0,0,1,2,2,0,2,0,0,0,0,0,0,0,0,0,2,1,0,1,1,2,0,0,0,0,0,1,0,0,0,2,1,0,1,1,0,0,0,0,0,0,2,0,2,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,buffer,-1,0,0,0,0,0,1,0,1,0,-2,1,1,1,-1,-1,0,0,0,0,0,2,0,3,0,-2,0,2,1,-1,0,0,0,0,0,0,1,0,2,0,0,1,1,0,0,buffer,-3,-2,-2,-2,2,2,buffer,-0.2,0.4,0,-0.2,1,0,0,0.6,0.4,buffer,-2.333333333,0.666666667,0.066666667,0.266666667,0.333333333,buffer,0,4,3,1,0,1,0.2,0.4,1,0.2,1.2,1,0.4,0,1,0.4,0.2,1,0,0.8,0.4,0,0.2,0,buffer,C_Ug +457,R_7En1jXCmIuFVRwZ,32 - 38,Canadian,Female,Female,University - Graduate (Masters),34,01PfPsV,02FUT,5,02DGEN,-0.25,0.666666667,0.333333333,2,2,3,3,2,0,1,0,1,0,-1,-2,2,0,2,-1,2,2,2,1,1,0,0,1,0,-2,-2,2,1,2,-2,2,2,2,2,2,1,-1,1,0,-1,-2,2,2,2,2,2,2,2,2,0,1,2,1,0,-1,-2,2,0,2,2,2,2,2,2,0,2,0,1,0,-1,-2,2,0,2,4,3,2,3,4,2,2,2,2,2,2,1,3,0,1,1,1,1,1,0,0,0,1,0,0,1,0,4,0,1,1,0,2,0,1,0,0,0,0,0,2,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,buffer,3,0,0,0,1,1,1,-2,0,0,1,0,0,1,0,4,0,0,0,0,2,-1,1,0,0,0,0,0,2,0,1,0,0,0,1,1,0,-1,0,0,1,0,0,1,0,buffer,2,1,0,1,2,1,buffer,0.8,0,0.4,0.8,0.4,0.4,0.4,0,0.4,buffer,1,1.333333333,0.4,0.533333333,0.266666667,buffer,1,1,0,0,0,1,1.2,0.4,0.4,1.2,0.6,0.4,0.4,0.4,0,0.4,0.2,0,0.4,0.6,0.4,0,0.6,0,buffer,grad_prof +458,R_3fiskxHGaD0cLA4,18 - 24,Canadian,Female,Female,University - Undergraduate,24,03VPfPs,01PAST,10,01ITEM,0.375,0,1,3,3,1,-1,3,2,2,3,1,3,2,1,3,0,2,-1,3,1,-2,2,3,-2,1,-2,1,-1,-2,2,1,3,1,3,3,2,2,-2,-2,-2,3,-2,3,-2,-2,-3,3,3,3,1,2,3,2,2,3,-1,2,2,1,3,-2,1,3,3,1,2,3,1,3,3,-2,2,2,1,3,-1,2,7,6,7,2,10,8,2,3,5,1,3,1,4,0,0,1,1,1,4,2,3,2,3,3,1,1,1,2,0,2,3,1,4,4,5,2,5,1,3,5,3,1,0,0,0,3,0,0,0,0,2,1,0,0,0,2,1,0,0,0,3,0,1,1,0,3,1,0,0,0,1,0,2,0,2,4,0,5,0,3,5,3,4,0,4,4,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,1,buffer,4,0,0,-2,1,1,4,2,1,1,3,3,1,-1,0,2,0,2,0,1,3,3,5,-1,4,1,3,5,2,1,2,0,2,4,0,4,-1,3,4,3,4,0,4,3,-1,buffer,5,3,2,1,7,7,buffer,0.6,1.8,1.2,1,2.8,2.4,1.6,2.6,2,buffer,3.333333333,5,1.2,2.066666667,2.066666667,buffer,5,4,1,1,0,4,1.2,2.4,1.8,1.6,4,2.6,0.6,0.6,0.6,0.6,1.2,0.2,1.6,3.2,2.4,0,0.6,0.4,buffer,C_Ug +459,R_1GdjKBldvnVvqVT,32 - 38,Canadian,Female,Female,University - Undergraduate,32,03VPfPs,01PAST,5,01ITEM,0.125,0,0.666666667,3,3,2,-1,3,-3,-1,2,0,1,2,-3,3,-2,2,3,3,2,-1,3,-3,-2,2,-2,1,2,-3,3,1,2,3,3,2,-1,3,-3,-2,2,0,1,2,-3,2,2,2,3,3,2,-1,3,-3,-2,2,0,1,2,-3,3,-3,2,3,3,2,-1,3,-3,-1,2,-1,2,2,-3,3,-3,2,0,4,7,2,4,3,0,1,1,1,2,1,0,0,0,0,0,0,1,0,2,0,0,0,0,3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,4,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,1,0,-1,-1,0,0,1,3,0,0,0,0,0,0,0,-1,0,1,-1,0,0,1,1,0,buffer,0,3,6,1,2,2,buffer,0,0.4,0.4,0,-0.2,0.8,0,-0.2,0.4,buffer,3,1.666666667,0.266666667,0.2,0.066666667,buffer,2,0,4,1,1,0,0,0.6,0.6,0,0.2,1,0,0.2,0.2,0,0.4,0.2,0,0.4,0.4,0,0.6,0,buffer,C_Ug +460,R_5dEb03CEck0NP30,18 - 24,Canadian,Female,Female,College Diploma/Certificate,23,01PfPsV,02FUT,10,01ITEM,0.5,0.666666667,0.333333333,2,3,-1,0,3,1,0,1,-2,3,-2,-2,3,-1,2,-2,2,2,2,1,1,2,-2,0,2,-1,-1,2,1,0,-2,3,3,2,2,-1,2,-1,-1,-1,2,2,1,0,2,3,2,-1,-1,3,2,-1,2,-2,3,-2,-1,3,-2,2,3,2,0,-2,3,2,-1,3,-2,3,-1,0,3,-2,2,7,7,3,8,9,7,2,3,6,4,3,7,4,1,3,2,2,0,2,3,2,1,1,1,1,2,2,4,0,4,2,1,2,2,2,1,4,4,4,2,1,0,1,1,0,1,0,1,1,1,0,0,0,1,0,1,0,1,1,1,2,0,1,1,2,0,0,1,2,0,1,0,0,1,1,0,1,2,0,1,1,3,3,3,1,1,2,0,0,1,1,0,0,0,1,0,0,1,1,0,0,0,buffer,3,0,3,1,2,-1,1,2,2,1,1,0,1,1,2,3,-1,3,0,1,1,1,0,1,4,3,2,2,0,0,0,1,0,-1,1,2,0,0,1,3,2,2,1,1,2,buffer,5,4,-3,4,6,0,buffer,1.8,1,1,1.2,1.4,1.4,0.2,1.2,1.6,buffer,2,3.333333333,1.266666667,1.333333333,1,buffer,1,2,4,2,0,1,2.4,1.6,1.4,2.2,2.2,2.2,0.6,0.6,0.4,1,0.8,0.8,0.6,1.4,2,0.4,0.2,0.4,buffer,C_Ug +461,R_51nsU96cLButl1m,32 - 38,Canadian,Female,Female,University - Graduate (Masters),34,02PsVPf,01PAST,10,01ITEM,1.5,0.333333333,0.333333333,1,1,2,3,1,3,2,3,2,0,1,2,1,1,2,1,0,0,0,1,0,0,1,1,0,0,0,1,1,0,1,2,2,2,1,1,2,0,1,1,2,0,1,1,0,2,1,2,1,3,1,1,0,0,0,1,2,0,0,0,1,2,0,1,0,0,0,2,0,1,0,1,0,0,0,9,9,8,6,7,9,8,9,8,6,7,8,0,1,2,3,0,3,2,2,1,0,1,2,0,0,2,0,1,0,1,0,2,0,3,1,1,1,2,0,0,2,1,0,0,2,2,2,1,3,2,0,0,0,1,1,2,0,1,2,2,1,3,2,1,2,1,1,1,1,1,2,0,2,2,2,0,1,2,1,0,1,2,0,0,0,0,1,1,2,0,3,1,1,2,0,1,1,1,0,0,0,buffer,-1,1,2,1,-2,1,1,-1,-1,0,1,2,-1,-1,0,0,0,-2,-1,-1,-1,-2,2,-1,0,0,1,-1,-1,0,-1,1,0,2,-3,0,1,-1,0,0,1,-1,0,0,0,buffer,1,0,0,0,0,1,buffer,0.2,0,0.2,-0.8,-0.4,-0.2,-0.2,0,0,buffer,0.333333333,0.333333333,0.133333333,-0.466666667,-0.066666667,buffer,3,2,1,2,2,0,1.2,1.6,1,0.4,1.4,1,1,1.6,0.8,1.2,1.8,1.2,1.2,1,0.4,1.4,1,0.4,buffer,grad_prof +462,R_6CKpghIA6EKH3Lw,32 - 38,Canadian,Female,Female,University - Undergraduate,34,01PfPsV,02FUT,5,02DGEN,0,0,1,2,3,-1,-3,3,-1,1,3,1,3,-1,-3,3,1,3,2,3,3,-3,2,-2,1,3,3,3,3,-3,3,0,3,-1,1,3,2,1,-3,-2,3,2,2,3,3,3,3,3,3,3,1,3,3,2,-3,3,-3,-1,1,-3,1,2,3,3,2,0,3,2,1,0,2,1,2,-3,-3,3,2,3,5,5,0,6,7,2,5,6,7,7,6,0,0,0,4,0,1,1,0,0,2,0,4,0,0,1,0,3,2,4,5,2,2,3,0,1,1,4,6,0,2,0,1,0,2,6,0,3,4,0,4,4,2,0,2,1,0,1,1,1,6,1,2,1,1,0,1,2,0,0,1,0,3,2,0,5,1,1,3,0,1,1,0,6,0,3,0,0,1,1,0,1,1,3,1,4,3,4,0,2,0,0,buffer,-1,0,2,-6,1,-2,-4,0,-2,-4,2,0,-2,0,0,2,1,3,-1,1,0,2,-1,1,0,2,6,0,1,0,3,1,-1,5,0,0,0,-1,-3,-2,-4,6,-2,3,0,buffer,0,-1,-7,-1,1,2,buffer,-0.8,-2.4,0,1.2,0.4,1.8,1.6,-1.2,0.6,buffer,-2.666666667,0.666666667,-1.066666667,1.133333333,0.333333333,buffer,1,2,2,2,0,7,1,0.6,1,3.2,1.4,2.4,1.8,3,1,2,1,0.6,2.2,1.2,1.8,0.6,2.4,1.2,buffer,C_Ug +463,R_5zIy4nKnA1GRUeI,18 - 24,Canadian,Male,Male,High School (or equivalent),18,03VPfPs,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,3,3,3,2,2,1,0,2,1,2,2,2,2,1,2,0,2,1,1,2,-2,-1,0,0,1,3,1,0,2,2,1,0,3,1,2,2,1,0,-2,3,3,1,0,2,1,3,2,2,2,3,3,-1,3,-1,3,1,2,3,0,2,2,2,2,2,1,3,-2,3,0,2,2,3,3,-2,2,8,9,8,8,8,8,8,9,9,7,9,9,3,1,2,1,0,3,1,2,1,1,1,1,2,1,0,2,3,0,1,0,1,1,2,3,1,1,1,2,1,1,0,1,1,0,1,2,1,1,2,1,1,0,1,1,0,1,1,1,0,1,2,2,1,1,0,0,1,1,3,0,1,2,2,0,0,4,2,0,2,2,0,0,0,0,1,1,0,0,0,2,0,1,0,1,1,1,1,0,2,0,buffer,3,0,1,1,-1,1,0,1,-1,0,0,1,1,0,0,1,2,-1,1,-1,-1,-1,1,2,1,1,0,1,-2,1,0,2,2,0,-2,4,1,0,1,1,-1,-1,0,-2,1,buffer,0,0,-1,1,-1,-1,buffer,0.8,0.2,0.4,0.4,0.4,0.2,0.4,1.4,-0.6,buffer,-0.333333333,-0.333333333,0.466666667,0.333333333,0.4,buffer,0,1,0,1,0,0,1.4,1.6,1,1.2,1.6,1.2,0.6,1.4,0.6,0.8,1.2,1,1,2,0.2,0.6,0.6,0.8,buffer,HS_TS +464,R_6do7H4cijRIGxQk,18 - 24,Canadian,Male,Male,High School (or equivalent),20,02PsVPf,02FUT,10,02DGEN,0,0.666666667,0.333333333,-1,3,0,-2,1,0,0,0,0,3,2,1,1,0,3,-3,-2,3,0,1,-2,-1,-2,-1,-1,2,0,0,0,0,1,-2,2,0,3,3,-2,0,-2,2,2,0,0,0,2,0,3,0,0,0,0,0,2,0,3,2,2,2,0,2,0,3,0,0,1,0,0,2,0,3,2,2,2,0,3,10,10,10,10,10,10,8,8,8,8,8,8,2,5,3,2,0,2,1,2,1,4,0,1,1,0,3,2,5,2,2,2,3,2,0,2,1,0,1,1,0,1,1,0,0,2,1,0,0,2,0,0,0,1,1,0,1,1,0,0,2,0,0,0,2,0,0,0,1,1,0,0,4,0,1,0,2,5,1,2,1,3,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,buffer,1,5,3,0,-1,2,1,0,1,4,0,0,0,0,2,1,5,2,0,2,3,2,-2,2,1,0,0,0,0,1,4,0,1,0,1,5,1,2,1,3,0,0,0,0,1,buffer,2,2,2,2,2,2,buffer,1.6,1.6,0.4,2,1.2,0.2,1.2,2.4,0.2,buffer,2,2,1.2,1.133333333,1.266666667,buffer,0,0,0,0,0,0,2.4,2,1,2.6,1.6,0.6,0.8,0.4,0.6,0.6,0.4,0.4,1.4,2.4,0.4,0.2,0,0.2,buffer,HS_TS +465,R_6QXHGLo0jxGg96h,18 - 24,Canadian,Male,Male,High School (or equivalent),20,01PfPsV,02FUT,10,02DGEN,0.125,0.333333333,0.666666667,2,3,1,-2,-2,-2,1,1,-1,0,-1,-1,2,0,1,2,2,2,-3,-2,-2,0,-2,1,-1,2,2,-1,1,-2,2,2,2,-3,-3,-2,-1,-1,1,-2,2,1,-1,1,0,2,2,1,-1,-1,-1,2,1,-2,1,-1,-1,2,0,1,2,2,1,0,0,0,2,1,-2,1,-1,0,2,-1,1,3,5,7,5,5,8,2,2,3,3,5,5,0,1,1,1,0,0,1,3,2,1,3,3,3,1,3,0,1,1,1,1,0,2,2,2,2,3,2,3,1,1,0,1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,1,0,2,2,2,1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,0,2,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,buffer,0,0,1,0,-1,-1,0,3,1,0,3,3,3,1,3,0,0,1,-1,-1,-2,1,2,1,1,3,1,3,0,1,0,0,0,-1,0,-1,1,1,0,1,0,0,0,-1,2,buffer,1,3,4,2,0,3,buffer,0,0.6,2.6,-0.2,0.6,1.6,-0.2,0.4,0.2,buffer,2.666666667,1.666666667,1.066666667,0.666666667,0.133333333,buffer,2,0,1,1,3,2,0.6,1.4,2.6,0.8,1.6,2,0.6,0.8,0,1,1,0.4,0.2,0.6,0.6,0.4,0.2,0.4,buffer,HS_TS +466,R_3EzrBY8Bybhs9NI,25 - 31,American,Prefer not to say,Prefer not to say,High School (or equivalent),25,02PsVPf,02FUT,5,01ITEM,-0.625,0.333333333,0.666666667,1,3,0,-2,2,3,-1,0,2,2,0,0,1,-2,3,3,-1,3,-3,-1,-2,3,-3,3,-3,-2,-3,0,2,-2,3,0,3,2,0,-2,1,-2,2,-2,-3,-3,-3,-3,-3,2,3,-1,-1,2,3,-2,2,-1,3,1,1,2,-1,3,0,3,-1,-1,2,1,-3,2,-3,1,2,3,3,-3,3,6,10,9,2,6,10,1,5,7,4,9,7,2,4,3,1,3,5,4,3,1,5,2,3,1,4,5,2,3,3,4,2,5,2,2,0,4,3,3,4,1,6,1,0,1,1,0,0,1,2,3,1,1,1,1,1,0,1,0,1,1,0,2,2,2,5,1,2,3,2,1,0,0,1,0,5,1,0,2,1,1,1,1,0,3,5,1,2,0,0,0,0,2,1,0,2,2,1,2,1,2,0,buffer,1,4,2,0,3,5,3,1,-2,4,1,2,0,3,5,1,3,2,3,2,3,0,0,-5,3,1,0,2,0,6,-2,1,0,5,1,-2,1,1,-1,-1,0,-2,2,3,1,buffer,5,5,2,-2,-3,3,buffer,2,2.2,2.2,2.2,0.2,1.8,1,-0.4,0.8,buffer,4,-0.666666667,2.133333333,1.4,0.466666667,buffer,4,4,1,3,4,0,2.6,3.6,3,2.8,2.6,3.4,0.6,1.4,0.8,0.6,2.4,1.6,1.4,1,2,0.4,1.4,1.2,buffer,HS_TS +467,R_1XNRUe0XEwh7Mit,25 - 31,American,Prefer not to say,Prefer not to say,High School (or equivalent),25,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,3,2,2,3,-1,-3,0,-2,2,-1,2,0,2,0,2,2,2,2,2,0,-1,0,-2,0,1,2,0,2,0,2,1,3,3,1,-1,-1,3,0,3,-1,-1,-3,1,1,0,3,2,2,3,-1,-3,0,-1,1,-1,2,0,2,0,2,3,2,2,3,0,-3,0,0,1,-1,2,0,2,-2,2,2,2,2,1,3,5,2,2,2,2,3,2,1,0,0,1,1,2,0,0,2,2,0,0,0,0,0,2,1,1,2,0,2,3,2,1,0,3,3,1,1,2,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,2,1,0,0,0,0,2,0,1,1,1,1,1,0,3,2,3,2,3,3,1,1,2,0,0,0,0,1,0,0,1,0,0,0,0,0,2,0,buffer,1,0,0,1,1,2,0,-1,1,2,0,0,0,0,0,2,1,1,2,-1,2,3,0,0,0,3,3,1,-1,2,1,1,1,1,0,0,3,1,3,2,3,3,1,-1,2,buffer,0,0,0,-1,0,3,buffer,0.6,0.8,0,1,1,1.6,0.8,1.8,1.6,buffer,0,0.666666667,0.466666667,1.2,1.4,buffer,1,1,3,0,1,0,0.6,1.2,0,1.2,1.6,2,0,0.4,0,0.2,0.6,0.4,1,2,2,0.2,0.2,0.4,buffer,HS_TS +468,R_1E5lno0n9WvZcAx,32 - 38,American,Prefer not to say,Prefer not to say,High School (or equivalent),36,03VPfPs,01PAST,5,01ITEM,-0.25,0,1,1,3,1,2,2,-1,1,2,0,1,2,2,3,0,3,0,3,1,2,2,-1,1,2,1,2,1,1,1,1,1,-1,3,2,3,3,-1,0,1,3,2,0,1,2,0,1,2,3,1,2,3,0,1,2,0,2,3,2,2,2,3,1,3,2,2,2,0,1,3,-1,2,3,3,3,2,3,5,5,5,7,6,7,5,5,5,5,5,5,1,0,0,0,0,0,0,0,1,1,1,1,2,1,2,2,0,1,1,1,0,1,1,3,1,2,1,1,0,2,1,0,0,0,1,1,0,0,0,1,1,0,1,2,0,0,0,1,0,0,1,0,1,1,1,1,1,0,2,0,1,0,1,1,1,0,1,1,2,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,buffer,0,0,0,0,-1,-1,0,0,1,0,0,1,1,-1,2,2,0,0,1,1,-1,1,0,2,0,1,0,1,-2,2,0,0,0,1,0,0,1,0,1,0,1,-1,0,1,0,buffer,0,0,0,2,1,2,buffer,-0.2,0,0.6,0.8,0.4,0.4,0.2,0.4,0.2,buffer,0,1.666666667,0.133333333,0.533333333,0.266666667,buffer,2,1,2,0,0,0,0.2,0.4,1.4,1,1.2,1.2,0.4,0.4,0.8,0.2,0.8,0.8,0.8,0.8,0.6,0.6,0.4,0.4,buffer,HS_TS +469,R_7G8751MoFwlehAZ,18 - 24,American,Female,Female,High School (or equivalent),23,03VPfPs,02FUT,5,02DGEN,0,0.333333333,0.666666667,2,3,3,1,1,3,-1,2,1,2,-1,-2,3,1,3,1,3,3,1,1,2,2,3,2,-2,3,2,1,3,-1,-1,1,3,3,1,1,3,3,3,-2,3,3,1,3,-1,1,2,1,3,3,2,1,3,-1,2,1,1,3,-1,3,1,3,3,3,1,3,1,3,-1,3,1,-1,3,2,3,6,10,7,7,9,10,7,5,8,8,4,4,1,0,0,0,0,1,3,1,1,4,4,4,2,2,4,3,2,0,2,0,2,4,1,2,4,4,5,2,2,4,1,1,2,2,2,1,2,1,2,0,2,3,0,2,0,1,0,0,2,0,0,2,1,2,1,2,1,0,1,0,2,2,0,2,0,1,1,0,1,0,0,1,0,0,0,0,1,2,0,2,1,0,0,0,1,0,2,0,3,0,buffer,0,-1,-2,-2,-2,0,1,0,-1,4,2,1,2,0,4,2,2,0,0,0,2,2,0,0,3,2,4,2,1,4,2,1,-2,2,-2,0,1,0,1,-1,0,-1,0,-3,0,buffer,-1,5,-1,-1,5,6,buffer,-1.4,0.8,1.8,0.8,1.4,2.6,0.2,0.2,-0.8,buffer,1,3.333333333,0.4,1.6,-0.133333333,buffer,1,1,3,1,1,4,0.2,2,3.2,1.4,2.6,3.4,1.6,1.2,1.4,0.6,1.2,0.8,1.2,0.6,0.2,1,0.4,1,buffer,HS_TS +470,R_7HBLHNwVSCrI6jD,25 - 31,American,Male,Male,College Diploma/Certificate,30,01PfPsV,01PAST,5,02DGEN,1.5,0,1,2,2,3,2,3,2,2,2,1,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,1,2,2,2,1,1,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,1,2,2,2,2,2,2,1,1,1,2,1,1,1,2,2,2,2,1,1,2,1,1,2,2,2,2,1,2,1,7,7,7,7,7,8,8,8,9,8,6,8,0,0,1,0,2,0,1,0,1,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,1,2,0,1,1,1,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,0,1,1,buffer,-1,0,0,0,1,0,1,-1,1,0,0,-1,-1,0,1,1,0,0,-1,-1,0,-1,-1,0,-1,0,0,-1,0,-1,0,0,0,-1,0,0,0,0,-1,-1,0,-1,0,0,0,buffer,-1,-1,-2,-1,1,0,buffer,0,0.2,-0.2,-0.2,-0.6,-0.4,-0.2,-0.4,-0.2,buffer,-1.333333333,0,0,-0.4,-0.266666667,buffer,0,0,1,0,2,1,0.6,0.4,0.4,0.6,0.2,0,0.6,0.2,0.6,0.8,0.8,0.4,0.4,0.2,0.4,0.6,0.6,0.6,buffer,C_Ug +471,R_1I5TwsSiQ8rZBLm,46 - 52,American,Male,Male,Trade School (non-military),50,01PfPsV,02FUT,10,01ITEM,0.375,0.333333333,0.666666667,2,3,2,-1,0,-2,-1,2,0,1,0,-1,3,1,2,2,3,2,-2,1,-2,-1,2,0,1,0,0,3,1,3,2,3,2,-3,1,-2,-1,2,1,1,1,1,1,2,2,2,3,2,0,0,-2,-1,2,0,1,0,0,3,0,3,3,3,2,0,0,-2,0,2,-1,0,-1,0,3,-1,2,2,2,1,3,2,4,1,2,2,1,3,4,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,0,1,0,1,2,2,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,0,1,1,1,1,0,2,0,0,0,0,1,0,0,0,0,1,0,1,1,2,1,1,1,0,0,0,0,0,1,0,1,1,1,0,0,1,1,buffer,0,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,-1,0,0,1,1,0,-1,0,0,-1,0,1,2,-1,0,-1,0,0,1,0,0,-1,0,0,-1,0,1,2,0,0,buffer,1,0,-1,2,-1,0,buffer,0.2,0,-0.2,0.2,-0.4,0.4,0,-0.4,0.6,buffer,0,0.333333333,0,0.066666667,0.066666667,buffer,1,0,3,0,1,2,0.4,0,0.4,0.6,0.2,1.2,0.2,0,0.6,0.4,0.6,0.8,0.2,0.2,1.2,0.2,0.6,0.6,buffer,HS_TS +472,R_1IhBxC4M6HUlLgE,53 - 59,Canadian,Male,Male,University - Undergraduate,59,02PsVPf,02FUT,10,02DGEN,-0.375,0.666666667,0,2,1,0,-1,1,-2,-2,2,0,1,1,-2,1,0,1,1,1,1,-2,1,-2,-2,2,-1,0,2,-1,2,1,1,1,1,1,-2,0,-2,-1,2,-1,-1,1,-2,0,1,1,3,1,0,-2,1,-2,-2,2,-1,1,2,-2,2,-1,2,2,1,0,0,1,0,-2,2,-2,1,2,-1,2,-2,2,4,6,5,7,4,6,3,7,2,6,6,7,1,0,1,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,2,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,1,0,2,0,0,2,0,1,1,1,2,1,0,0,0,0,1,0,1,0,0,1,1,1,2,0,0,1,0,0,2,0,2,0,0,1,0,0,1,0,1,0,buffer,0,0,1,0,0,0,0,0,0,1,0,1,0,0,-1,1,0,1,0,1,-2,1,0,-1,2,-1,-1,0,-1,-1,-1,0,0,-2,1,-2,1,0,-1,1,1,0,2,-1,0,buffer,1,-1,3,1,-2,-1,buffer,0.2,0.2,0,0.6,0,-0.8,-0.4,-0.2,0.4,buffer,1,-0.666666667,0.133333333,-0.066666667,-0.066666667,buffer,3,2,1,3,1,5,0.6,0.4,0.8,0.8,0.8,0.4,0.4,0.2,0.8,0.2,0.8,1.2,0.2,0.4,0.8,0.6,0.6,0.4,buffer,C_Ug +473,R_7s92ZR9oETlKVvH,53 - 59,Canadian,Male,Male,High School (or equivalent),58,03VPfPs,02FUT,10,02DGEN,0.5,0.666666667,0.333333333,-1,3,2,1,2,2,2,2,0,3,1,2,2,2,3,-1,3,3,1,3,1,3,3,3,3,2,3,3,3,3,3,3,3,0,3,2,3,3,2,3,3,3,3,3,3,0,3,2,1,2,1,2,2,2,2,2,2,2,2,2,0,3,2,2,2,2,1,2,1,2,1,2,3,2,3,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,1,3,0,1,1,1,1,0,4,0,1,1,1,0,1,1,2,0,2,1,1,1,0,1,0,0,0,0,1,0,0,2,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,4,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,buffer,-1,0,1,0,1,0,1,1,1,-1,0,1,1,1,-1,3,0,1,0,1,0,0,1,1,-1,2,1,0,1,0,4,0,0,0,0,0,-1,0,0,0,0,0,-1,0,-1,buffer,0,0,0,0,0,0,buffer,0.2,0.4,0.4,1,0.2,0.8,0.8,-0.2,-0.4,buffer,0,0,0.333333333,0.666666667,0.066666667,buffer,0,0,0,0,0,0,0.4,1.2,0.8,1.4,0.8,1,0.2,0.8,0.4,0.4,0.6,0.2,1,0.4,0.2,0.2,0.6,0.6,buffer,HS_TS +474,R_5luIfpUojL2tYmd,60 - 66,Canadian,Female,Female,Professional Degree (ex. JD/MD),61,02PsVPf,02FUT,5,02DGEN,0.375,0,1,-1,1,2,-2,3,3,-1,3,-2,1,2,0,3,0,2,1,0,2,-3,3,3,-2,3,-2,3,2,0,2,2,2,2,1,1,-3,3,3,-1,3,0,3,2,-1,3,3,2,1,0,0,1,1,3,-2,2,-2,2,2,-1,2,-1,2,1,2,2,2,-1,1,-1,0,0,-1,1,0,0,-1,1,2,2,2,8,8,3,6,2,1,7,6,6,2,1,0,1,0,0,1,0,0,2,0,0,1,2,0,3,0,1,1,0,0,0,0,2,2,0,1,0,3,0,2,1,2,3,2,0,1,1,0,1,0,1,1,1,0,2,1,0,4,4,2,0,3,2,2,1,0,3,1,1,1,1,1,0,0,0,1,0,2,0,0,1,1,1,0,0,2,2,1,2,2,1,2,2,3,1,1,2,0,1,buffer,0,0,-2,-2,-2,0,0,-1,0,1,0,-1,0,1,0,1,-1,1,-3,-4,-2,0,-3,0,0,-1,1,-3,2,-1,1,-1,-1,-1,-2,-2,0,-2,0,-3,-1,0,-1,1,-1,buffer,-4,0,1,1,2,-3,buffer,-1.2,0,0,-1.2,-1,-0.4,-0.8,-1.4,-0.4,buffer,-1,0,-0.4,-0.866666667,-0.866666667,buffer,6,6,1,1,4,5,0.8,0.6,0.6,1,0.8,0.8,2,0.6,0.6,2.2,1.8,1.2,0.6,0.6,0.6,1.4,2,1,buffer,grad_prof +475,R_6TM0vko6aIToDlL,39 - 45,Canadian,Male,Male,University - Undergraduate,42,03VPfPs,01PAST,10,02DGEN,-0.125,0.333333333,0.666666667,2,3,3,1,3,1,0,2,-1,2,2,3,3,1,2,2,3,3,2,3,2,-1,2,1,2,2,3,2,2,2,2,3,3,1,3,1,0,2,-1,2,2,3,3,1,2,2,3,3,3,3,1,0,3,-1,2,2,3,2,1,2,3,3,3,2,3,0,0,3,-1,2,2,3,2,2,2,2,2,2,1,2,1,2,2,2,2,2,1,0,0,0,1,0,1,1,0,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,1,0,2,0,0,0,1,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,-1,0,1,1,-1,2,0,0,0,0,1,0,-1,0,0,-1,0,-1,0,-1,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,1,0,2,0,0,0,1,0,0,buffer,0,0,0,-1,0,0,buffer,-0.2,0.6,0.2,-0.4,-0.4,-0.4,-0.2,0.6,0.2,buffer,0,-0.333333333,0.2,-0.4,0.2,buffer,1,0,1,0,0,1,0.2,0.8,0.4,0,0,0,0.4,0.2,0.2,0.4,0.4,0.4,0.2,0.8,0.4,0.4,0.2,0.2,buffer,C_Ug +476,R_5bOcm4e0HuNX01r,46 - 52,American,Male,Male,University - Graduate (Masters),48,01PfPsV,02FUT,5,01ITEM,0.375,0.666666667,0.333333333,2,3,2,1,3,0,0,-1,-2,-3,-1,2,1,1,1,1,1,2,1,3,-1,-2,0,-2,1,1,2,-1,-1,1,2,2,0,-1,1,0,2,-1,2,0,2,2,1,-1,0,1,1,0,-2,2,1,-1,1,-1,-1,1,-1,1,1,1,0,0,1,1,3,-1,1,-1,1,-1,-1,1,2,1,1,2,6,6,4,7,5,7,6,7,6,4,7,1,2,0,0,0,1,2,1,0,4,2,0,2,2,0,0,1,2,2,2,0,2,0,4,3,3,0,0,2,1,1,2,2,3,1,1,1,2,1,2,2,3,0,0,0,2,3,1,0,0,1,1,0,3,2,0,1,1,0,0,1,1,2,2,2,1,4,1,4,1,1,0,2,0,1,1,1,1,3,1,2,2,2,2,0,2,2,1,0,0,buffer,0,0,-2,-3,-1,0,1,-1,-1,2,0,-3,2,2,0,-2,-2,1,2,2,-1,1,0,1,1,3,-1,-1,2,1,0,0,1,-1,1,-1,2,-1,2,1,-1,-2,1,0,1,buffer,-5,0,-1,-2,3,-2,buffer,-1.2,0.2,0.2,0.2,0.4,0.8,0.2,0.6,-0.2,buffer,-2,-0.333333333,-0.266666667,0.466666667,0.2,buffer,2,1,1,1,2,0,0.6,1.6,1.2,1.4,1.8,1.2,1.8,1.4,1,1.2,1.4,0.4,1.6,2.2,0.8,1.4,1.6,1,buffer,grad_prof +477,R_1GUnt22PvETYEwV,39 - 45,Canadian,Female,Female,College Diploma/Certificate,42,01PfPsV,01PAST,5,02DGEN,-0.875,0,1,3,3,3,3,1,0,1,3,2,0,1,3,3,1,1,3,3,3,3,3,-1,3,3,3,-1,-2,1,3,3,3,1,3,3,-2,3,-2,-3,2,3,-3,-1,3,-1,3,-2,3,3,3,3,0,3,3,3,-1,3,3,3,3,-1,3,3,3,3,3,1,3,1,3,-1,3,3,3,3,0,3,8,8,5,10,7,10,3,1,1,1,1,1,0,0,0,0,2,1,2,0,1,1,3,2,0,2,2,2,0,0,5,2,2,4,1,1,3,2,0,4,2,3,0,0,0,0,1,3,2,0,3,3,2,0,0,2,2,0,0,0,0,0,3,0,0,3,3,2,0,0,1,2,2,0,0,5,0,1,6,1,0,2,1,2,4,0,5,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,buffer,0,0,0,0,1,-2,0,0,-2,-2,1,2,0,0,0,2,0,0,5,2,-1,4,1,-2,0,0,0,4,1,1,2,0,0,5,-1,1,4,1,0,2,1,2,4,-1,5,buffer,5,7,4,9,6,9,buffer,0.2,-1.2,0.6,1.8,0.4,1.2,1.2,1.6,2.2,buffer,5.333333333,8,-0.133333333,1.133333333,1.666666667,buffer,2,1,5,2,0,0,0.4,1,1.8,1.8,2.2,2.2,0.2,2.2,1.2,0,1.8,1,1.4,2,2.4,0.2,0.4,0.2,buffer,C_Ug +478,R_1hxSBuVv7q5n23w,53 - 59,American,Female,Female,College Diploma/Certificate,56,02PsVPf,02FUT,5,01ITEM,-0.125,0,0.666666667,3,2,3,3,3,-1,1,2,-1,1,3,0,2,-1,2,3,3,2,3,3,1,-2,3,1,2,3,1,-1,1,3,3,3,2,3,3,1,-2,2,0,1,3,1,2,2,3,3,2,3,3,3,-2,1,2,-1,1,-2,-1,1,-2,2,3,2,3,3,2,-2,0,1,-1,-1,3,-1,1,-2,3,0,7,6,1,6,7,1,6,3,2,6,2,0,1,1,0,0,2,3,1,2,1,0,1,3,2,1,0,1,1,0,0,2,3,0,1,0,0,1,0,3,1,0,0,0,0,0,1,0,0,0,0,5,1,1,1,0,0,0,0,0,1,1,1,1,0,2,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,3,1,0,0,0,0,0,1,0,1,1,0,2,5,0,0,0,1,buffer,0,1,1,0,0,1,3,1,2,1,-5,0,2,1,1,0,1,1,0,-1,1,2,-1,1,-2,0,0,-1,2,0,0,0,0,0,-1,0,-1,0,1,-1,-5,0,3,1,-1,buffer,-1,1,3,-1,0,5,buffer,0.4,1.6,-0.2,0.2,0.2,0.2,-0.2,-0.2,-0.4,buffer,1,1.333333333,0.6,0.2,-0.266666667,buffer,1,1,1,1,0,1,0.4,1.8,1.4,0.4,1.2,1,0,0.2,1.6,0.2,1,0.8,0,0.6,0.8,0.2,0.8,1.2,buffer,C_Ug +479,R_7dg0n97nQhPRImG,39 - 45,Canadian,Female,Female,University - Graduate (Masters),39,02PsVPf,01PAST,10,01ITEM,0.125,0,1,3,2,2,3,3,0,-1,3,0,1,2,3,2,0,2,3,3,3,3,3,2,2,2,2,2,3,3,3,0,3,3,3,3,3,3,0,-2,1,-2,2,2,2,2,2,2,3,3,3,3,3,0,-1,3,0,2,3,2,0,0,3,2,3,3,2,3,0,-1,3,0,1,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,0,1,1,0,0,2,3,1,2,1,1,0,1,0,1,0,1,1,0,0,0,1,2,2,1,0,1,0,2,0,0,1,1,0,0,0,0,0,0,1,1,1,2,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,2,4,1,4,0,1,1,1,2,1,1,0,0,1,0,0,0,0,0,1,0,1,3,0,0,buffer,0,0,0,0,0,2,3,1,2,0,0,-1,-1,0,0,-1,0,0,-1,0,0,1,2,2,1,-1,1,-1,2,-1,-1,0,0,-1,0,2,4,1,4,-1,1,0,-2,2,1,buffer,0,0,0,0,0,0,buffer,0,1.6,-0.4,-0.4,1.2,0,-0.4,2,0.4,buffer,0,0,0.4,0.266666667,0.666666667,buffer,0,0,0,0,0,0,0.4,1.8,0.6,0.4,1.2,0.6,0.4,0.2,1,0.8,0,0.6,0,2.2,1.2,0.4,0.2,0.8,buffer,grad_prof +480,R_1v9R7QJPOWllM9X,53 - 59,American,Female,Female,University - Undergraduate,56,03VPfPs,02FUT,10,01ITEM,-0.25,0,1,3,3,2,3,3,2,-2,3,-3,3,0,-2,3,-2,2,2,2,2,2,2,2,-1,2,1,2,1,2,2,1,2,2,3,2,2,3,2,-2,2,1,2,-1,2,2,2,2,3,3,2,3,3,2,-2,2,-2,2,-1,-1,2,-2,2,3,3,2,3,3,1,-2,2,-2,2,-1,-1,3,-2,2,1,1,1,1,1,2,0,0,0,0,2,1,1,1,0,1,1,0,1,1,4,1,1,4,1,3,0,1,0,0,1,0,0,0,1,4,1,1,4,1,4,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,2,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,buffer,1,1,0,1,1,0,1,0,3,0,0,3,0,3,0,1,0,0,1,0,-1,0,0,3,0,0,3,1,4,0,0,1,0,0,1,-1,1,0,0,0,2,0,-1,1,0,buffer,1,1,1,1,-1,1,buffer,0.8,0.8,1.2,0.4,0.4,1.6,0.4,0,0.4,buffer,1,0.333333333,0.933333333,0.8,0.266666667,buffer,0,0,1,0,2,1,0.8,1.4,1.8,0.4,1.2,2,0,0.6,0.6,0,0.8,0.4,0.4,0.2,0.6,0,0.2,0.2,buffer,C_Ug +481,R_62zhW2oPlpAnX9n,18 - 24,American,Female,Female,High School (or equivalent),19,03VPfPs,02FUT,10,02DGEN,0.25,0,1,1,3,2,3,2,1,2,2,2,3,2,1,3,-1,2,0,3,2,3,2,3,0,-1,-1,3,3,2,0,0,3,3,3,3,-1,2,3,2,1,-1,3,3,2,1,2,3,2,3,2,3,2,2,0,2,0,2,3,1,3,3,3,3,3,1,0,3,2,0,3,-1,3,2,2,3,1,3,1,3,4,3,4,3,2,3,7,5,5,5,1,0,0,0,0,2,2,3,3,0,1,1,3,1,1,2,0,1,4,0,2,0,1,3,0,1,1,2,3,1,1,0,0,0,0,1,2,0,2,1,1,0,0,4,1,2,0,1,3,1,1,2,1,3,0,0,1,0,2,1,3,0,1,4,0,0,2,2,0,0,0,0,1,2,0,1,0,1,3,1,0,0,1,1,1,1,1,0,2,0,buffer,0,0,0,0,0,1,0,3,1,-1,0,1,3,-3,0,0,0,0,1,-1,1,-2,0,0,0,1,0,2,1,0,2,0,0,1,-1,0,2,1,-1,-1,-1,-1,1,0,0,buffer,-1,0,-3,-2,-1,-2,buffer,0,0.8,0.2,0,-0.2,0.8,0.4,0.2,-0.2,buffer,-1.333333333,-1.666666667,0.333333333,0.2,0.133333333,buffer,2,1,1,3,2,2,0.2,2,1.4,1.4,1.2,1.6,0.2,1.2,1.2,1.4,1.4,0.8,1.6,0.8,0.6,1.2,0.6,0.8,buffer,HS_TS +482,R_72VylO2t15dDoLx,39 - 45,Canadian,Female,Female,University - Undergraduate,44,02PsVPf,02FUT,10,01ITEM,0.5,1,0,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,C_Ug +483,R_1Qpkh4ocVfMDtsJ,60 - 66,Canadian,Female,Female,University - Undergraduate,62,03VPfPs,01PAST,10,02DGEN,-0.75,0,1,2,2,2,2,3,-1,-3,2,-1,-1,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,2,2,2,1,2,-2,-2,2,-1,-2,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,-0.2,0,0.2,0.2,0,buffer,0,0,0,0,0.133333333,buffer,0,0,0,0,0,0,0.2,0.8,0,0.4,0.6,0,0.2,0.8,0,0.2,0.8,0,0.2,0.2,0,0,0,0,buffer,C_Ug +484,R_1MXNBF34DjpKRxM,60 - 66,Canadian,Male,Male,Trade School (non-military),64,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,-1,3,2,2,-2,2,-1,1,-2,1,2,2,0,0,1,0,3,3,3,0,2,-2,1,-2,1,2,2,0,0,2,0,3,3,3,0,2,-2,0,-2,0,2,2,0,0,2,0,3,3,3,0,2,-3,1,-3,2,2,2,0,-1,2,0,3,3,3,0,0,0,0,0,1,2,2,0,0,2,0,1,0,0,0,0,0,1,1,3,8,5,1,0,1,1,2,0,1,0,0,0,0,0,0,0,1,1,0,1,1,2,0,1,1,0,1,0,0,0,0,1,1,0,1,1,2,0,2,0,1,1,0,0,0,1,1,1,0,1,1,2,2,1,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,2,3,1,3,1,0,0,0,1,0,buffer,0,0,0,0,0,0,-1,0,-1,-1,0,0,0,-1,0,0,0,0,0,0,-2,0,0,-2,1,0,0,0,0,0,0,0,0,0,0,-2,-3,0,-3,0,0,0,0,-1,0,buffer,0,0,-1,-3,-8,-5,buffer,0,-0.6,-0.2,0,-0.6,0,0,-1.6,-0.2,buffer,-0.333333333,-5.333333333,-0.266666667,-0.2,-0.6,buffer,0,1,0,3,7,4,1,0.2,0.2,1,0.6,0.2,1,0.8,0.4,1,1.2,0.2,0,0.4,0,0,2,0.2,buffer,HS_TS +485,R_5CQuUx5HkIN0nII,39 - 45,American,Female,Female,High School (or equivalent),45,03VPfPs,01PAST,10,02DGEN,-0.125,0.333333333,0.666666667,-2,2,3,3,-1,0,-1,2,0,-1,2,1,3,-1,2,-2,2,3,2,-2,-1,-1,2,0,-1,2,1,2,-1,2,-2,2,3,2,-2,1,-1,2,-1,-1,2,1,2,-1,2,-2,3,3,3,-2,0,-1,2,0,-1,2,1,2,-1,2,-2,2,3,3,-2,0,-1,2,0,-1,2,1,2,-2,2,1,2,2,1,2,2,2,2,3,2,2,3,0,0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,-1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,-1,0,0,-1,0,0,0,2,0,0,1,0,0,0,0,-1,0,buffer,-1,0,-1,-1,0,-1,buffer,0,0.2,0,0.2,0.4,-0.2,-0.2,0.6,-0.2,buffer,-0.666666667,-0.666666667,0.066666667,0.133333333,0.066666667,buffer,0,0,0,0,0,0,0.4,0.2,0.2,0.4,0.4,0.2,0.4,0,0.2,0.2,0,0.4,0,0.6,0,0.2,0,0.2,buffer,HS_TS +486,R_3fJUFbQyKEBXLdQ,25 - 31,American,Male,Male,University - Graduate (Masters),30,01PfPsV,01PAST,5,02DGEN,1,0,1,3,2,3,1,3,1,1,2,0,3,3,3,3,2,2,2,2,3,3,3,2,1,2,1,3,1,2,2,3,1,3,2,2,3,2,3,3,3,2,2,2,2,2,2,1,3,3,2,2,3,2,2,2,2,2,3,3,2,2,2,3,2,2,3,2,3,3,3,2,2,2,2,2,1,1,10,9,10,9,8,9,9,10,10,9,10,9,1,0,0,2,0,1,0,0,1,0,2,1,1,1,1,0,0,1,2,1,2,2,1,2,1,1,1,1,0,1,0,1,1,1,0,1,1,0,2,1,0,0,1,0,0,0,0,1,2,1,2,2,1,2,1,1,1,1,1,1,1,0,1,0,1,1,2,1,1,1,1,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,buffer,1,-1,-1,1,0,0,-1,0,-1,-1,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,-1,1,-1,0,0,1,0,1,1,0,-1,0,0,-1,buffer,1,-1,0,0,-2,0,buffer,0,-0.6,1,0,0,-0.2,0,0.6,-0.4,buffer,0,-0.666666667,0.133333333,-0.066666667,0.066666667,buffer,1,1,1,0,0,1,0.6,0.4,1.2,0.8,1.6,0.8,0.6,1,0.2,0.8,1.6,1,0.6,1.2,0.4,0.6,0.6,0.8,buffer,grad_prof +487,R_7S97YfGsSwUADhy,39 - 45,American,Female,Female,University - Undergraduate,42,03VPfPs,02FUT,10,01ITEM,0,0.666666667,0.333333333,3,1,3,0,0,-3,1,0,3,-2,0,-2,3,-3,3,3,2,3,0,0,-3,1,0,3,0,0,0,3,-3,3,2,2,3,1,0,-3,2,-1,3,0,0,0,3,-3,3,3,1,1,0,0,-3,0,0,2,0,0,0,3,-3,3,3,1,3,1,0,-3,0,0,1,0,0,0,3,-3,3,1,2,0,2,3,2,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,2,0,2,0,0,0,1,1,0,1,0,0,1,1,0,2,0,2,0,0,0,0,0,2,0,0,0,1,0,1,2,0,2,0,0,0,0,0,0,1,0,0,1,0,2,2,0,2,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,1,0,0,0,0,0,0,buffer,0,1,-2,0,0,0,-1,0,-1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,-2,0,0,0,0,0,0,1,0,-2,0,0,0,1,1,-1,0,0,0,0,0,0,buffer,1,1,0,1,2,1,buffer,-0.2,-0.4,0,0.4,-0.2,0,-0.2,0.2,0,buffer,0.666666667,1.333333333,-0.2,0.066666667,0,buffer,1,1,2,1,0,1,0.2,0.4,0.4,0.6,0.8,0.4,0.4,0.8,0.4,0.2,1,0.4,0.4,0.4,0,0.6,0.2,0,buffer,C_Ug +488,R_71YqcuoCiHrSWy4,25 - 31,American,Male,Male,College Diploma/Certificate,30,01PfPsV,01PAST,5,01ITEM,1.5,0.666666667,0.333333333,3,2,3,3,3,2,3,1,1,1,1,2,2,2,1,2,2,3,2,1,2,2,2,2,2,2,1,2,2,2,2,2,2,3,3,2,2,2,2,2,2,2,2,2,2,1,2,3,1,3,1,2,2,2,2,2,2,2,2,2,3,2,2,3,3,1,2,2,2,2,2,2,2,2,2,8,8,9,9,7,8,8,9,8,8,8,8,1,0,0,1,2,0,1,1,1,1,1,1,0,0,1,1,0,1,0,0,0,1,1,1,1,1,0,0,0,1,2,0,0,2,0,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,1,1,1,1,1,1,0,0,0,1,0,0,1,1,2,0,0,0,0,0,0,1,0,0,0,2,0,1,2,0,0,0,0,0,0,0,0,0,0,0,buffer,-1,0,0,-1,2,-1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-2,0,0,-1,2,0,0,0,0,0,0,1,0,0,0,buffer,0,-1,1,1,-1,0,buffer,0,-0.2,0.2,0.2,-0.2,0,-0.2,0,0.2,buffer,0,0,0,0,0,buffer,1,1,1,0,1,0,0.8,0.8,0.6,0.4,0.8,0.4,0.8,1,0.4,0.2,1,0.4,0.8,0,0.2,1,0,0,buffer,C_Ug +489,R_6qX2BXpG1OrXIG8,18 - 24,American,Male,Male,High School (or equivalent),23,02PsVPf,01PAST,5,02DGEN,0.625,0,1,3,3,3,3,2,-1,2,1,2,1,-1,1,1,1,-1,3,1,2,0,0,1,3,3,2,2,2,1,0,3,-1,1,-3,2,-1,3,1,2,3,2,3,3,2,0,2,1,3,0,0,-2,1,0,2,0,1,3,1,-3,-1,3,-1,-1,0,3,2,-2,3,1,2,2,3,-1,3,0,0,2,5,5,5,6,10,10,10,10,8,9,5,5,0,2,1,3,2,2,1,2,0,1,3,0,1,2,0,2,6,1,4,1,2,0,2,0,2,4,1,1,1,2,0,3,3,5,1,1,0,1,1,2,2,4,2,2,0,4,3,0,1,4,4,1,1,0,2,0,2,1,1,3,2,4,0,1,3,0,1,0,0,1,1,1,0,1,2,4,0,3,4,3,3,1,2,1,0,2,6,1,3,3,buffer,0,-1,-2,-2,1,1,1,1,-1,-1,1,-4,-1,0,0,-2,3,1,3,-3,-2,-1,1,0,0,4,-1,0,0,-1,-2,4,-3,-3,0,-3,0,-2,-1,1,-1,-5,-1,-2,-1,buffer,-5,-5,-3,-3,5,5,buffer,-0.8,0.2,-0.8,0.4,-0.4,0.4,-0.8,-1,-2,buffer,-4.333333333,2.333333333,-0.466666667,0.133333333,-1.266666667,buffer,1,5,5,1,5,3,1.6,1.2,1.2,2.8,1.2,1.8,2.4,1,2,2.4,1.6,1.4,2,0.4,1,2.8,1.4,3,buffer,HS_TS +490,R_5IxO3MQCeJTVFPb,18 - 24,American,Female,Female,College Diploma/Certificate,24,01PfPsV,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,3,3,2,3,2,-1,-1,1,0,2,-2,-3,2,-1,2,3,3,3,-2,2,-2,-2,-1,1,1,-1,-3,1,1,3,3,3,1,-1,-1,-2,0,-1,1,1,-1,-2,2,1,2,3,3,2,2,3,0,-2,2,-1,1,-2,-3,3,-1,3,3,3,0,2,2,1,1,3,-2,1,-2,-3,2,-3,1,4,7,5,7,6,6,2,4,3,4,7,2,0,0,1,5,0,1,1,2,1,1,1,0,1,2,1,0,0,1,4,3,1,1,2,1,1,1,1,0,2,0,0,0,0,1,1,1,1,1,1,1,0,0,1,0,1,0,0,2,1,0,2,2,2,2,1,0,0,0,2,1,0,0,2,1,3,0,2,0,0,0,0,1,1,0,1,0,0,2,0,1,1,3,1,1,0,0,0,1,2,2,buffer,0,0,1,4,-1,0,0,1,0,0,1,0,0,2,0,0,0,-1,3,3,-1,-1,0,-1,0,1,1,0,0,-1,0,0,0,1,2,-1,-1,-1,-1,0,0,1,0,-2,-1,buffer,2,3,2,3,-1,4,buffer,0.8,0.2,0.6,1,-0.6,0.2,0.6,-0.8,-0.4,buffer,2.333333333,2,0.533333333,0.2,-0.2,buffer,3,1,1,2,3,1,1.2,1.2,1,1.6,1.2,0.8,0.4,1,0.4,0.6,1.8,0.6,1.2,0.4,0.6,0.6,1.2,1,buffer,C_Ug diff --git a/eohi2/eohi2.csv b/eohi2/eohi2.csv new file mode 100644 index 0000000..eb5a8b5 --- /dev/null +++ b/eohi2/eohi2.csv @@ -0,0 +1,490 @@ +pID,ResponseId,taq_age,Citizenship,taq_sex,demo_sex,demo_edu,demo_age_1,GROUP,TEMPORAL_DO,INTERVAL_DO,ITEM_DO,aot_total,crt_correct,crt_int,present_pref_read,present_pref_music,present_pref_tv,present_pref_nap,present_pref_travel,present_pers_extravert,present_pers_critical,present_pers_dependable,present_pers_anxious,present_pers_complex,present_val_obey,present_val_trad,present_val_opinion,present_val_performance,present_val_justice,past_5_pref_read,past_5_pref_music,past_5_pref_TV,past_5_pref_nap,past_5_pref_travel,past_5_pers_extravert,past_5_pers_critical,past_5_pers_dependable,past_5_pers_anxious,past_5_pers_complex,past_5_val_obey,past_5_val_trad,past_5_val_opinion,past_5_val_performance,past_5_val_justice,past_10_pref_read,past_10_pref_music,past_10_pref_TV,past_10_pref_nap,past_10_pref_travel,past_10_pers_extravert,past_10_pers_critical,past_10_pers_dependable,past_10_pers_anxious,past_10_pers_complex,past_10_val_obey,past_10_val_trad,past_10_val_opinion,past_10_val_performance,past_10_val_justice,fut_5_pref_read,fut_5_pref_music,fut_5_pref_TV,fut_5_pref_nap,fut_5_pref_travel,fut_5_pers_extravert,fut_5_pers_critical,fut_5_pers_dependable,fut_5_pers_anxious,fut_5_pers_complex,fut_5_val_obey,fut_5_val_trad,fut_5_val_opinion,fut_5_val_performance,fut_5_val_justice,fut_10_pref_read,fut_10_pref_music,fut_10_pref_TV,fut_10_pref_nap,fut_10_pref_travel,fut_10_pers_extravert,fut_10_pers_critical,fut_10_pers_dependable,fut_10_pers_anxious,fut_10_pers_complex,fut_10_val_obey,fut_10_val_trad,fut_10_val_opinion,fut_10_val_performance,fut_10_val_justice,DGEN_past_5_Pref,DGEN_past_5_Pers,DGEN_past_5_Val,DGEN_past_10_Pref,DGEN_past_10_Pers,DGEN_past_10_Val,DGEN_fut_5_Pref,DGEN_fut_5_Pers,DGEN_fut_5_Val,DGEN_fut_10_Pref,DGEN_fut_10_Pers,DGEN_fut_10_Val,NPast_5_pref_read,NPast_5_pref_music,NPast_5_pref_TV,NPast_5_pref_nap,NPast_5_pref_travel,NPast_5_pers_extravert,NPast_5_pers_critical,NPast_5_pers_dependable,NPast_5_pers_anxious,NPast_5_pers_complex,NPast_5_val_obey,NPast_5_val_trad,NPast_5_val_opinion,NPast_5_val_performance,NPast_5_val_justice,NPast_10_pref_read,NPast_10_pref_music,NPast_10_pref_TV,NPast_10_pref_nap,NPast_10_pref_travel,NPast_10_pers_extravert,NPast_10_pers_critical,NPast_10_pers_dependable,NPast_10_pers_anxious,NPast_10_pers_complex,NPast_10_val_obey,NPast_10_val_trad,NPast_10_val_opinion,NPast_10_val_performance,NPast_10_val_justice,NFut_5_pref_read,NFut_5_pref_music,NFut_5_pref_TV,NFut_5_pref_nap,NFut_5_pref_travel,NFut_5_pers_extravert,NFut_5_pers_critical,NFut_5_pers_dependable,NFut_5_pers_anxious,NFut_5_pers_complex,NFut_5_val_obey,NFut_5_val_trad,NFut_5_val_opinion,NFut_5_val_performance,NFut_5_val_justice,NFut_10_pref_read,NFut_10_pref_music,NFut_10_pref_TV,NFut_10_pref_nap,NFut_10_pref_travel,NFut_10_pers_extravert,NFut_10_pers_critical,NFut_10_pers_dependable,NFut_10_pers_anxious,NFut_10_pers_complex,NFut_10_val_obey,NFut_10_val_trad,NFut_10_val_opinion,NFut_10_val_performance,NFut_10_val_justice,X5.10past_pref_read,X5.10past_pref_music,X5.10past_pref_TV,X5.10past_pref_nap,X5.10past_pref_travel,X5.10past_pers_extravert,X5.10past_pers_critical,X5.10past_pers_dependable,X5.10past_pers_anxious,X5.10past_pers_complex,X5.10past_val_obey,X5.10past_val_trad,X5.10past_val_opinion,X5.10past_val_performance,X5.10past_val_justice,X5.10fut_pref_read,X5.10fut_pref_music,X5.10fut_pref_TV,X5.10fut_pref_nap,X5.10fut_pref_travel,X5.10fut_pers_extravert,X5.10fut_pers_critical,X5.10fut_pers_dependable,X5.10fut_pers_anxious,X5.10fut_pers_complex,X5.10fut_val_obey,X5.10fut_val_trad,X5.10fut_val_opinion,X5.10fut_val_performance,X5.10fut_val_justice,ehi_buffer,ehi5_pref_read,ehi5_pref_music,ehi5_pref_TV,ehi5_pref_nap,ehi5_pref_travel,ehi5_pers_extravert,ehi5_pers_critical,ehi5_pers_dependable,ehi5_pers_anxious,ehi5_pers_complex,ehi5_val_obey,ehi5_val_trad,ehi5_val_opinion,ehi5_val_performance,ehi5_val_justice,ehi10_pref_read,ehi10_pref_music,ehi10_pref_TV,ehi10_pref_nap,ehi10_pref_travel,ehi10_pers_extravert,ehi10_pers_critical,ehi10_pers_dependable,ehi10_pers_anxious,ehi10_pers_complex,ehi10_val_obey,ehi10_val_trad,ehi10_val_opinion,ehi10_val_performance,ehi10_val_justice,ehi5.10_pref_read,ehi5.10_pref_music,ehi5.10_pref_TV,ehi5.10_pref_nap,ehi5.10_pref_travel,ehi5.10_pers_extravert,ehi5.10_pers_critical,ehi5.10_pers_dependable,ehi5.10_pers_anxious,ehi5.10_pers_complex,ehi5.10_val_obey,ehi5.10_val_trad,ehi5.10_val_opinion,ehi5.10_val_performance,ehi5.10_val_justice,buffer_ehiDGEN,ehiDGEN_5_Pref,ehiDGEN_5_Pers,ehiDGEN_5_Val,ehiDGEN_10_Pref,ehiDGEN_10_Pers,ehiDGEN_10_Val,buffer_ehi_means,ehi5_pref_MEAN,ehi5_pers_MEAN,ehi5_val_MEAN,ehi10_pref_MEAN,ehi10_pers_MEAN,ehi10_val_MEAN,ehi5.10_pref_MEAN,ehi5.10_pers_MEAN,ehi5.10_val_MEAN,buffer_globalMEANS,ehiDGEN_5_mean,ehiDGEN_10_mean,ehi5_global_mean,ehi10_global_mean,ehi5.10_global_mean,buffer_missingVARS,X5_10DGEN_past_pref,X5_10DGEN_past_pers,X5_10DGEN_past_val,X5_10DGEN_fut_pref,X5_10DGEN_fut_pers,X5_10DGEN_fut_val,NPast_5_pref_MEAN,NPast_5_pers_MEAN,NPast_5_val_MEAN,NPast_10_pref_MEAN,NPast_10_pers_MEAN,NPast_10_val_MEAN,NFut_5_pref_MEAN,NFut_5_pers_MEAN,NFut_5_val_MEAN,NFut_10_pref_MEAN,NFut_10_pers_MEAN,NFut_10_val_MEAN,X5.10past_pref_MEAN,X5.10past_pers_MEAN,X5.10past_val_MEAN,X5.10fut_pref_MEAN,X5.10fut_pers_MEAN,X5.10fut_val_MEAN,buffer_transformed,edu3,stdDGEN_5,stdDGEN_10,stdDS_5,stdDS_10,stdEHI_mean +1,R_72xzGlUXksmRobU,67 - 73,Canadian,Male,Male,University - Undergraduate,71,02PsVPf,02FUT,5,02DGEN,0.25,0,1,3,3,3,2,3,0,-3,3,-1,1,3,3,3,3,3,3,3,3,2,3,1,-3,3,-3,2,3,3,3,3,3,3,3,3,3,3,1,-3,3,-3,2,3,3,3,3,3,3,3,3,2,3,1,-3,3,0,2,3,3,3,3,3,3,3,3,2,3,2,-3,3,-2,2,2,2,2,3,3,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,1,0,1,0,0,2,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,1,1,1,0,0,buffer,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,1,0,-1,-1,-1,0,0,0,0,0,1,0,-1,0,0,-2,0,-1,-1,-1,0,0,buffer,1,0,0,0,0,0,buffer,0,0.2,0,0.2,0,-0.6,0.2,-0.6,-0.6,buffer,0.333333333,0,0.066666667,-0.133333333,-0.333333333,buffer,0,0,0,1,0,0,0,0.8,0,0.2,0.8,0,0,0.6,0,0,0.8,0.6,0.2,0,0,0,0.6,0.6,buffer,C_Ug,0.186160841,-0.158849227,-0.001844284,-0.488122207,-0.115663719 +2,R_5OVzMaCE4iAqExQ,25 - 31,Canadian,Male,Male,Professional Degree (ex. JD/MD),25,03VPfPs,01PAST,10,02DGEN,0.125,0.666666667,0.333333333,1,1,0,0,1,0,1,0,1,0,1,1,0,0,1,0,0,0,0,1,0,-1,-1,1,0,0,0,-1,0,-1,-1,0,0,0,0,0,0,0,1,-1,0,-1,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,1,-1,1,1,0,1,0,6,6,3,6,7,7,7,7,7,7,7,6,1,1,0,0,0,0,2,1,0,0,1,1,1,0,2,2,1,0,0,1,0,1,0,0,1,1,2,0,1,1,2,1,0,0,1,0,1,0,1,0,1,1,0,0,1,1,1,0,0,1,0,2,1,0,1,0,0,0,1,1,1,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,buffer,-1,0,0,0,-1,0,1,1,-1,0,0,0,1,0,1,1,0,0,0,0,0,-1,-1,0,0,1,2,0,0,0,0,0,0,0,1,0,0,0,-1,0,-1,0,1,0,1,buffer,-1,-1,-4,-1,0,1,buffer,-0.4,0.2,0.4,0.2,-0.4,0.6,0.2,-0.2,0.2,buffer,-2,0,0.066666667,0.133333333,0.066666667,buffer,0,1,4,0,0,1,0.4,0.6,1,0.8,0.4,1,0.8,0.4,0.6,0.6,0.8,0.4,0.4,0.6,0.8,0.2,0.8,0.6,buffer,grad_prof,-1.414915939,-0.158849227,-0.001844284,0.019597567,-0.38900297 +3,R_3NwGJkmZsE685Vf,67 - 73,Canadian,Male,Male,High School (or equivalent),73,02PsVPf,01PAST,5,02DGEN,0.125,0.333333333,0.666666667,2,2,3,0,2,-1,-2,1,-1,0,0,2,2,-2,1,2,2,2,2,2,-2,-2,2,-2,0,1,2,2,-2,2,2,2,2,-1,2,0,1,1,1,1,1,2,1,-2,2,2,2,2,3,1,0,0,0,0,0,1,2,1,-2,2,2,1,2,2,0,0,0,0,0,0,2,2,2,-2,2,2,3,6,8,6,7,3,2,5,6,5,5,0,0,1,2,0,1,0,1,1,0,1,0,0,0,1,0,0,1,1,0,1,3,0,2,1,1,0,1,0,1,0,0,1,3,1,1,2,1,1,0,1,0,1,0,1,0,1,1,2,2,1,2,1,1,0,2,0,0,0,1,0,0,0,3,0,2,3,1,3,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,1,0,1,0,0,buffer,0,0,0,-1,-1,0,-2,0,0,0,0,0,-1,0,0,0,-1,0,-1,-2,0,1,-1,1,1,-1,0,1,0,0,0,-1,0,2,-1,2,3,1,3,1,-1,0,0,0,0,buffer,-1,1,1,2,1,2,buffer,-0.4,-0.4,-0.2,-0.8,0.4,0,0,2,-0.2,buffer,0.333333333,1.666666667,-0.333333333,-0.133333333,0.6,buffer,6,3,1,3,3,0,0.6,0.6,0.4,0.4,1.4,0.6,1,1,0.6,1.2,1,0.6,0.6,2,0.2,0.6,0,0.4,buffer,HS_TS,0.186160841,0.721845465,-0.867625175,-0.488122207,-0.111935269 +4,R_7PdeFviF2kbNled,46 - 52,Canadian,Female,Female,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0,0,1,3,3,0,-1,2,-2,1,3,3,1,3,0,3,0,3,3,3,-1,-1,1,2,-1,3,-2,1,3,0,1,-2,3,3,3,-1,-1,0,1,-1,3,-2,1,3,2,0,0,3,3,3,0,0,3,-1,0,3,0,1,3,2,3,-1,3,3,3,0,0,3,-3,0,3,0,1,3,2,3,-2,3,4,7,8,4,6,6,3,6,5,2,2,3,0,0,1,0,1,4,2,0,5,0,0,0,2,2,0,0,0,1,0,2,3,2,0,5,0,0,2,3,0,0,0,0,0,1,1,1,1,0,3,0,0,2,0,1,0,0,0,0,1,1,1,1,0,3,0,0,2,0,2,0,0,0,0,0,1,1,0,0,0,0,0,2,1,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,buffer,0,0,1,-1,0,3,1,0,2,0,0,-2,2,1,0,0,0,1,-1,1,2,1,0,2,0,0,0,3,-2,0,0,0,0,0,1,-1,0,0,0,0,0,2,1,1,0,buffer,1,1,3,2,4,3,buffer,0,1.2,0.2,0.2,1,0.2,0.2,-0.2,0.8,buffer,1.666666667,3,0.466666667,0.466666667,0.266666667,buffer,0,1,2,1,4,2,0.4,2.2,0.8,0.6,2,1,0.4,1,0.6,0.4,1,0.8,0.2,0.2,1,0,0.4,0.2,buffer,C_Ug,1.101061858,1.426401218,0.863936607,0.654247288,1.011411743 +5,R_1g74XahwnlCiayZ,39 - 45,Canadian,Male,Male,Professional Degree (ex. JD/MD),45,01PfPsV,02FUT,5,02DGEN,0.625,0,0.666666667,1,2,3,2,3,0,0,-1,1,1,2,1,2,2,2,1,2,3,3,3,0,1,0,1,1,1,2,2,1,1,2,2,3,3,2,3,0,3,3,3,1,2,1,2,1,2,3,3,3,3,3,2,1,3,3,1,1,2,2,2,3,3,3,3,3,1,0,0,2,1,2,2,3,2,2,5,4,5,3,9,8,6,6,5,6,5,5,0,0,0,1,0,0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,3,0,4,2,2,1,1,1,0,1,1,1,0,1,0,3,2,2,2,2,1,0,0,0,0,2,1,0,1,0,1,0,1,1,0,0,1,1,0,0,1,0,0,0,1,3,1,3,2,2,0,0,1,1,0,1,0,0,0,0,2,2,1,1,2,1,1,1,0,0,buffer,-1,-1,0,0,0,-3,-1,-1,-2,-2,0,1,0,1,1,-1,-1,0,0,1,2,0,3,1,2,1,0,0,0,1,0,0,0,0,1,1,-1,2,1,0,-1,-1,0,1,0,buffer,-1,-2,0,-3,4,3,buffer,-0.4,-1.8,0.6,-0.2,1.6,0.4,0.2,0.6,-0.2,buffer,-1,1.333333333,-0.533333333,0.6,0.2,buffer,2,5,3,0,1,0,0.2,0.4,0.8,0.6,2.2,0.8,0.6,2.2,0.2,0.8,0.6,0.4,0.4,2.2,0.4,0.2,1.6,0.6,buffer,grad_prof,-0.728740176,0.545706526,-1.30051562,0.908107175,-0.143860524 +6,R_6fe14R7rESSUJN8,39 - 45,Canadian,Male,Male,University - Graduate (Masters),40,03VPfPs,01PAST,10,02DGEN,0.75,0.666666667,0.333333333,3,2,2,1,2,1,0,-2,0,1,2,3,2,2,2,2,2,1,2,2,3,1,2,1,2,2,2,2,2,1,2,1,1,2,0,3,1,2,2,2,2,2,1,2,1,1,2,2,3,2,2,3,1,2,3,1,2,1,3,2,2,2,2,3,1,2,2,3,2,1,2,3,1,2,2,7,7,7,6,7,7,7,8,8,8,8,7,1,0,1,1,0,2,1,4,1,1,0,1,0,0,1,1,1,1,1,2,2,1,4,2,1,0,1,1,0,1,2,0,0,2,0,1,3,3,2,2,1,1,1,1,0,1,0,0,2,1,1,2,5,2,0,0,0,1,0,0,0,1,0,0,2,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,1,2,0,2,1,1,0,1,0,buffer,-1,0,1,-1,0,1,-2,1,-1,-1,-1,0,-1,-1,1,0,1,1,-1,1,1,-1,-1,0,1,0,1,0,0,1,-1,1,0,0,1,0,-1,-2,1,-2,-1,-1,1,-1,0,buffer,0,-1,-1,-2,-1,0,buffer,-0.2,-0.4,-0.4,0.4,0,0.4,0.2,-0.8,-0.4,buffer,-0.666666667,-1,-0.333333333,0.266666667,-0.333333333,buffer,1,0,0,1,0,1,0.6,1.8,0.4,1.2,2,0.6,0.8,2.2,0.8,0.8,2,0.2,0.6,0.2,0.2,0.4,1,0.6,buffer,grad_prof,-0.500014922,-0.687266041,-0.867625175,0.273457456,-0.44536217 +7,R_7Pui4pm8cmzgDXj,60 - 66,American,Female,Female,High School (or equivalent),63,02PsVPf,01PAST,5,02DGEN,1,0,0.666666667,1,3,2,1,-3,0,-1,0,0,0,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,1,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,0,0,2,3,2,2,2,0,0,0,0,0,0,2,0,0,0,2,3,2,2,2,0,0,0,0,0,0,1,0,0,0,2,3,2,2,2,0,0,0,0,0,0,1,0,0,0,2,3,2,2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,0,0,0.2,0,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.2,2.2,0,0.4,2.2,0,0.2,2.2,0,0.2,2.2,0,0.2,0,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.107332375,-0.113721779 +8,R_1Wu9n4mwQfPZt70,53 - 59,Canadian,Male,Male,College Diploma/Certificate,54,01PfPsV,02FUT,10,02DGEN,-0.25,0,1,0,2,2,1,-1,-1,-2,1,-3,1,1,1,2,-2,2,-2,2,2,2,-2,1,-2,2,-2,1,2,1,2,-2,2,-1,2,2,1,-1,1,-2,1,-2,1,2,1,1,-2,2,-1,2,2,2,-2,1,-2,1,-2,1,2,1,2,-2,1,-1,1,2,2,-2,0,-3,1,-2,1,2,1,1,-3,2,2,2,3,2,3,3,3,3,3,4,2,4,2,0,0,1,1,2,0,1,1,0,1,0,0,0,0,1,0,0,0,0,2,0,0,1,0,1,0,1,0,0,1,0,0,1,1,2,0,0,1,0,1,0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,1,1,buffer,1,0,0,0,0,0,0,1,0,0,0,0,0,0,-1,0,-1,0,-1,-1,1,-1,0,0,0,0,0,0,-1,0,1,-1,0,1,1,-1,-1,1,0,0,0,0,0,-1,-1,buffer,-1,-1,0,-2,1,-1,buffer,0.2,0.2,-0.2,-0.6,0,-0.2,0.4,-0.2,-0.4,buffer,-0.666666667,-0.666666667,0.066666667,-0.266666667,-0.066666667,buffer,0,1,0,1,1,1,0.8,0.8,0.2,0.2,0.6,0.4,0.6,0.6,0.4,0.8,0.6,0.6,0.6,0.2,0.2,0.2,0.4,0.6,buffer,C_Ug,-0.500014922,-0.511127103,-0.001844284,-0.741982096,-0.438742101 +9,R_6i2zpvwYiLG1DQB,67 - 73,Canadian,Female,Female,College Diploma/Certificate,70,03VPfPs,01PAST,5,02DGEN,0.125,0,1,3,3,2,-1,3,2,-3,2,-2,2,1,2,2,0,2,3,2,2,-2,3,2,-3,2,-3,2,2,2,2,0,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,-1,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,0,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,-1,2,3,2,2,2,2,2,2,1,2,2,1,2,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,1,-1,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,buffer,1,1,0,0,1,0,buffer,0,0,0,0,0,0,0.4,0.4,0,buffer,0.666666667,0.333333333,0,0,0.266666667,buffer,1,0,0,0,0,0,0.4,0.2,0.2,0.4,0.2,0.4,0.4,0.2,0.2,0.4,0.2,0.4,0.4,0.4,0.2,0,0,0.2,buffer,C_Ug,0.414886095,0.017289712,-0.1461411,-0.23426232,0.012943097 +10,R_3RUgu1bPops7kT4,53 - 59,Canadian,Female,Female,University - Undergraduate,53,02PsVPf,02FUT,10,02DGEN,0.25,0.333333333,0.666666667,2,3,-3,2,0,1,0,0,2,0,-3,2,2,0,2,2,2,2,2,0,1,2,0,3,0,-2,3,2,1,2,2,3,0,2,0,2,2,0,3,0,0,3,2,-2,2,0,3,-3,2,0,2,0,0,3,0,0,3,2,2,2,2,3,-3,2,0,0,0,0,3,0,0,2,-2,2,2,7,2,8,1,1,1,1,1,7,5,5,5,0,1,5,0,0,0,2,0,1,0,1,1,0,1,0,0,0,3,0,0,1,2,0,1,0,3,1,0,2,0,2,0,0,0,0,1,0,0,1,0,3,1,0,2,0,0,0,0,0,0,1,0,0,1,0,3,0,4,2,0,0,1,2,0,0,1,0,0,0,0,2,0,0,3,0,2,0,0,0,0,2,0,0,0,0,0,1,4,0,0,buffer,-2,1,5,0,0,-1,2,0,0,0,-2,0,0,-1,0,0,0,3,0,0,0,2,0,0,0,0,1,-4,0,0,-2,1,2,0,0,-1,0,0,0,0,2,-1,-4,3,0,buffer,6,1,1,-4,-4,-4,buffer,0.8,0.2,-0.6,0.6,0.4,-0.6,0.2,-0.2,0,buffer,2.666666667,-4,0.133333333,0.133333333,0,buffer,6,1,7,4,4,2,1.2,0.6,0.6,0.6,0.8,1.2,0.4,0.4,1.2,0,0.4,1.8,0.6,0.2,1,0.4,0.4,1,buffer,C_Ug,1.78723762,-2.272516485,0.14245253,0.019597567,-0.080807192 +11,R_6V7RxG1JjWlv3jk,60 - 66,Canadian,Female,Female,College Diploma/Certificate,65,03VPfPs,02FUT,5,02DGEN,0.5,0,1,3,3,3,3,3,2,-3,3,1,2,3,1,3,2,3,3,3,3,3,3,3,-3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,2,2,3,3,3,3,3,3,3,3,3,3,2,-3,3,2,2,3,3,3,2,3,1,1,1,1,1,1,2,2,2,1,1,1,0,0,0,0,0,1,0,0,0,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,1,0,2,0,1,0,0,0,0,0,0,1,0,0,1,0,0,2,0,1,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,-1,0,0,1,0,0,0,0,-1,0,buffer,-1,-1,-1,0,0,0,buffer,0,0,0,0,0.4,0.2,0,0,-0.2,buffer,-1,0,0,0.2,-0.066666667,buffer,0,0,0,1,1,1,0,0.4,0.6,0,0.6,0.6,0,0.4,0.6,0,0.2,0.4,0,0.2,0,0,0.2,0.2,buffer,C_Ug,-0.728740176,-0.158849227,-0.1461411,0.146527512,-0.221800748 +12,R_1ikIQD6LGveLkIh,67 - 73,American,Female,Female,College Diploma/Certificate,68,01PfPsV,01PAST,5,02DGEN,-0.125,0.333333333,0.333333333,3,2,3,1,-1,-1,-3,2,-2,0,2,3,3,-1,3,3,3,3,-1,-1,-2,-3,2,-2,-1,2,3,3,-1,3,3,3,3,-2,-1,-2,-3,2,-3,-1,2,3,3,-1,3,3,3,3,2,-1,-1,-3,2,-3,-1,2,3,3,0,3,3,3,3,2,0,-2,-3,2,-3,-1,2,3,3,0,3,1,2,1,1,1,1,1,1,1,1,1,1,0,1,0,2,0,1,0,0,0,1,0,0,0,0,0,0,1,0,3,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,1,1,1,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,1,0,0,-1,0,0,0,0,-1,0,0,0,0,2,-1,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,-1,-1,0,0,1,0,0,0,0,0,0,buffer,0,1,0,0,0,0,buffer,0.2,0,-0.2,0.2,0,-0.2,0,0,0,buffer,0.333333333,0,0,0,0,buffer,0,1,0,0,0,0,0.6,0.4,0,0.8,0.6,0,0.4,0.4,0.2,0.6,0.6,0.2,0.2,0.2,0,0.2,0.2,0,buffer,C_Ug,0.186160841,-0.158849227,-0.1461411,-0.23426232,-0.088272951 +13,R_5QuIeM0sAhThWni,67 - 73,American,Female,Female,High School (or equivalent),67,01PfPsV,02FUT,10,02DGEN,0.375,0,1,2,2,2,-2,-2,0,-2,2,-3,1,2,2,2,0,2,2,2,2,2,-3,0,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,-3,2,2,2,2,2,2,7,8,8,7,7,7,7,7,7,6,7,7,0,0,0,4,1,0,0,0,5,1,0,0,0,2,0,0,0,0,4,4,2,4,0,5,1,0,0,0,0,0,0,0,0,4,4,2,4,0,5,1,0,0,0,2,0,0,0,0,4,0,2,0,0,0,1,0,0,0,2,0,0,0,0,0,5,2,4,0,0,0,0,0,0,2,0,0,0,0,0,4,0,4,0,5,0,0,0,0,0,0,buffer,0,0,0,0,-3,-2,-4,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,5,0,0,0,0,-2,0,0,0,0,0,1,2,0,0,-5,0,0,0,0,2,0,buffer,0,1,1,1,0,0,buffer,-0.6,-1.2,0,0.8,1.8,-0.4,0.2,-0.6,0.4,buffer,0.666666667,0.333333333,-0.6,0.733333333,1.85E-17,buffer,0,1,1,1,0,0,1,1.2,0.4,1.6,2.4,0,1.6,2.4,0.4,0.8,0.6,0.4,1,1.2,0.4,0.8,1.8,0,buffer,HS_TS,0.414886095,0.017289712,-1.444812436,1.161967062,0.037332608 +14,R_5GjMpIE4fiRenKy,67 - 73,American,Female,Female,College Diploma/Certificate,68,01PfPsV,02FUT,10,02DGEN,-0.625,0,1,-2,2,2,-2,3,2,-2,3,-3,1,2,2,2,-2,0,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-2,2,-2,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,1,1,1,1,1,1,5,0,0,6,5,5,0,0,0,0,1,0,1,1,0,1,0,0,0,0,2,0,0,0,0,1,0,0,1,1,1,0,0,0,0,2,0,0,0,0,1,0,1,1,0,1,0,0,0,0,2,0,0,0,0,1,0,1,1,0,1,0,0,0,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,buffer,-4,1,1,-5,-4,-4,buffer,0,0,0,0,0,0,0,0.4,0,buffer,-0.666666667,-4.333333333,0,0,0.133333333,buffer,0,0,0,1,5,5,0.2,0.6,0.4,0.2,0.6,0.4,0.2,0.6,0.4,0.2,0.6,0.4,0,0.4,0,0,0,0,buffer,C_Ug,-0.500014922,-2.448655423,-0.1461411,-0.23426232,-0.832268441 +15,R_1Dtp6HBUUIvqJ34,60 - 66,Canadian,Female,Female,High School (or equivalent),64,03VPfPs,02FUT,5,01ITEM,-0.25,0.333333333,0.666666667,1,2,3,-1,-3,-3,0,2,1,1,1,-1,3,0,3,3,3,3,-1,-3,-2,2,3,3,-2,2,1,3,-3,3,3,3,3,0,-3,-2,1,2,2,0,2,2,2,-3,3,1,2,3,1,-3,-2,2,-1,2,-3,0,1,-1,-2,3,1,2,3,2,-3,-3,3,2,3,-2,1,3,3,-3,3,3,1,1,2,3,1,2,3,5,2,6,1,2,1,0,0,0,1,2,1,2,3,1,2,0,3,0,2,1,0,1,0,1,1,0,1,1,1,3,1,3,0,0,0,0,2,0,1,2,3,1,4,1,2,4,2,0,0,0,0,3,0,0,3,0,2,3,0,4,0,3,0,0,0,0,1,0,0,1,1,1,2,0,1,1,0,0,0,0,0,1,0,1,1,3,1,1,1,2,4,1,0,buffer,2,1,0,-2,0,0,0,-2,1,-1,0,0,-4,1,0,2,1,0,-2,0,1,-2,0,-1,-2,1,-1,1,0,0,0,0,0,0,0,-1,0,-2,0,1,-1,-1,-3,-1,0,buffer,1,-2,-4,0,-3,0,buffer,0.2,-0.4,-0.6,0.2,-0.8,0.2,0,-0.4,-1.2,buffer,-1.666666667,-1,-0.266666667,-0.133333333,-0.533333333,buffer,1,2,0,0,3,4,0.6,1.8,1.2,0.8,0.8,1.6,0.4,2.2,1.8,0.6,1.6,1.4,0.2,1,0.4,0.2,1.4,1.6,buffer,HS_TS,-1.186190685,-0.687266041,-0.723328361,-0.488122207,-0.771226823 +16,R_1ktjEcLLJRW45MZ,53 - 59,Canadian,Female,Female,University - Undergraduate,54,01PfPsV,01PAST,10,01ITEM,-0.5,0.333333333,0.666666667,3,2,2,2,1,3,-3,1,-1,2,3,-2,3,-3,3,3,3,2,1,2,3,-3,-3,-3,3,1,-2,3,-3,3,3,3,-2,-3,3,3,-3,-2,-3,3,-2,-2,3,-2,3,3,-1,3,2,-2,3,-3,-3,-3,3,3,-3,3,-3,3,3,-2,3,3,-2,2,-3,-2,-3,3,3,-2,3,-3,3,2,1,1,7,2,4,3,0,0,6,1,1,0,1,0,1,1,0,0,4,2,1,2,0,0,0,0,0,1,4,5,2,0,0,3,2,1,5,0,0,1,0,0,3,1,0,3,0,0,4,2,1,0,1,0,0,0,0,4,1,1,3,1,0,3,2,1,0,0,0,0,0,0,0,4,4,1,0,0,1,0,0,3,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,buffer,0,-2,-1,1,-2,0,0,0,0,0,2,-1,0,0,0,0,-3,3,4,-1,-1,0,0,0,0,5,0,0,1,0,0,-1,4,3,1,-1,0,0,0,0,3,-1,0,1,0,buffer,-1,1,1,1,1,3,buffer,-0.8,0,0.2,0.6,-0.2,1.2,1.4,-0.2,0.6,buffer,0.333333333,1.666666667,-0.2,0.533333333,0.6,buffer,5,1,3,3,1,1,0.6,1.4,0.4,2.4,1.2,1.2,1.4,1.4,0.2,1.8,1.4,0,1.8,0.2,0.8,0.4,0.4,0.2,buffer,C_Ug,0.186160841,0.721845465,-0.579031545,0.78117723,0.277537998 +17,R_1z96qjJwdFG3cnD,60 - 66,Canadian,Female,Female,University - Undergraduate,61,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,-2,-2,-2,-2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,4,4,5,5,8,7,8,5,6,5,3,3,3,3,3,5,1,5,1,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,0,0,0,2,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,3,0,3,0,3,3,3,1,3,buffer,0,0,0,0,0,2,1,2,1,2,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-1,2,-1,2,-3,-3,-3,-1,-3,buffer,-3,-2,-4,-1,-1,0,buffer,0,1.6,2.6,0,0,0,0,0.8,-2.6,buffer,-3,-0.666666667,1.4,0,-0.6,buffer,1,0,1,3,1,3,3,3.4,3,3,3,3,3,1.8,0.4,3,3,3,0,2,0,0,1.2,2.6,buffer,C_Ug,-2.101091701,-0.511127103,2.884092019,-0.23426232,0.009402724 +18,R_3rO0N9nfawPgMdW,60 - 66,Canadian,Female,Female,University - Undergraduate,60,02PsVPf,01PAST,5,01ITEM,0,0.666666667,0.333333333,-1,1,3,-1,1,1,-3,2,-3,1,1,1,1,1,1,0,0,0,0,0,1,-3,1,-3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,1,1,3,1,1,0,0,1,0,0,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,1,1,1,1,1,0,0,0,0,0,1,3,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-1,-3,-1,-3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,1,3,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-1.8,0,0,0,0,0,1.8,0,buffer,0,0,-0.6,0,0.6,buffer,0,0,0,0,0,0,1.4,0.2,1,1.4,2,1,1.4,2,1,1.4,2,1,0,1.8,0,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-1.444812436,-0.23426232,-0.470122099 +19,R_11oBW0skPXtpXIv,53 - 59,Canadian,Female,Female,University - Graduate (Masters),57,03VPfPs,02FUT,10,01ITEM,0,0.666666667,0.333333333,3,2,2,1,2,-3,-2,2,1,1,2,-2,3,0,3,2,2,3,0,1,-3,-2,2,1,0,2,-1,2,0,2,2,2,3,0,2,-3,-2,2,2,0,2,-1,2,1,2,3,2,2,1,2,-3,-3,2,0,1,2,-2,3,-2,3,3,2,2,1,1,-3,-2,1,-2,1,2,0,3,0,3,1,1,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,0,0,0,0,1,0,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,2,0,0,0,0,0,1,0,0,1,3,0,0,2,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,1,2,0,0,2,0,2,0,buffer,1,0,1,1,1,0,-1,0,-1,1,0,1,1,-2,1,1,0,1,1,-1,0,0,-1,-2,1,0,-1,1,1,1,0,0,0,0,0,0,-1,-1,-1,0,0,-2,0,-1,0,buffer,1,0,1,0,0,1,buffer,0.8,-0.2,0.2,0.4,-0.4,0.4,0,-0.6,-0.6,buffer,0.666666667,0.333333333,0.266666667,0.133333333,-0.4,buffer,0,0,0,1,0,0,0.8,0.2,0.6,0.6,0.4,0.8,0,0.4,0.4,0.2,0.8,0.4,0.2,0.2,0.2,0.2,0.8,0.8,buffer,grad_prof,0.414886095,0.017289712,0.431046162,0.019597567,0.220704884 +20,R_7Cqyd4rdpJbp2XA,39 - 45,Canadian,Male,Male,College Diploma/Certificate,40,02PsVPf,02FUT,5,01ITEM,0.375,0.666666667,0.333333333,2,3,2,-1,3,-3,-3,1,-3,2,2,0,3,1,2,3,3,3,0,3,2,-3,3,-3,3,3,2,2,3,2,3,3,3,0,3,2,-3,3,-3,3,2,2,3,2,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,3,3,3,0,2,1,-3,3,-3,2,3,3,3,3,3,0,2,2,1,1,1,0,0,1,2,2,0,1,0,1,1,0,5,0,2,0,1,1,2,1,2,0,1,0,1,1,0,5,0,2,0,1,0,2,0,1,1,1,0,1,1,0,3,3,1,3,2,2,0,3,1,2,1,0,1,1,1,4,0,2,0,0,1,3,0,2,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,3,3,3,2,3,3,3,3,3,buffer,0,0,0,0,0,2,-3,1,-3,-1,-1,2,-2,1,-2,0,0,0,0,-1,1,0,0,0,1,-1,-1,0,-1,0,0,0,0,0,-1,-1,-3,-3,-3,-2,-2,-3,-2,-2,-2,buffer,0,2,1,-1,-1,1,buffer,0,-0.8,-0.4,-0.2,0.4,-0.6,-0.2,-2.4,-2.2,buffer,1,-0.333333333,-0.4,-0.133333333,-1.6,buffer,1,1,1,2,2,1,0.6,1.6,1.2,0.6,1.6,0.8,0.6,2.4,1.6,0.8,1.2,1.4,0,0,0.8,0.2,2.4,3,buffer,C_Ug,0.643611349,-0.334988165,-1.011921991,-0.488122207,-0.297855253 +21,R_3GWBRFzkpJqGUh3,60 - 66,Canadian,Female,Female,University - Undergraduate,63,03VPfPs,01PAST,10,02DGEN,0.5,0.333333333,0.666666667,2,2,3,1,2,-1,-1,1,-1,-1,2,2,2,2,2,-1,2,3,3,-1,-1,-1,2,-1,-1,2,2,2,2,2,-1,-1,3,3,-1,-1,-1,2,-1,-1,2,2,2,2,2,2,2,2,3,-1,-1,-1,1,-1,-1,2,2,2,2,2,2,2,2,3,-1,-1,1,1,-1,-1,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5,5,5,3,0,0,2,3,0,0,1,0,0,0,0,0,0,0,3,3,0,2,3,0,0,1,0,0,0,0,0,0,0,0,0,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,buffer,3,0,-1,0,0,0,0,1,0,0,0,0,0,0,0,3,3,-1,0,0,0,-2,1,0,0,0,0,0,0,0,0,3,0,0,0,0,-2,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.4,0.2,0,1,-0.2,0,0.6,-0.4,0,buffer,0,0,0.2,0.266666667,0.066666667,buffer,0,0,0,0,0,0,1.6,0.2,0,2.2,0.2,0,1.2,0,0,1.2,0.4,0,0.6,0,0,0,0.4,0,buffer,C_Ug,-0.042564413,-0.158849227,0.286749346,0.273457456,0.089698291 +22,R_51YHqKEJJENxnsT,67 - 73,Canadian,Female,Female,College Diploma/Certificate,72,01PfPsV,01PAST,5,02DGEN,0.125,0,1,2,3,3,2,3,0,0,2,0,0,1,0,1,0,3,2,3,3,2,3,0,0,2,0,0,2,0,0,0,2,2,3,3,2,3,0,0,2,0,0,2,2,0,0,3,2,3,3,3,2,0,0,0,0,0,2,0,0,0,3,3,3,3,3,2,0,0,2,0,0,2,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,0,0,2,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,buffer,0,0,0,-1,-1,0,0,-2,0,0,0,0,0,0,1,-1,0,0,-1,-1,0,0,0,0,0,0,2,0,0,0,-1,0,0,0,0,0,0,-2,0,0,0,2,0,0,1,buffer,0,0,0,0,0,0,buffer,-0.4,-0.4,0.2,-0.6,0,0.4,-0.2,-0.4,0.6,buffer,0,0,-0.2,-0.066666667,-1.85E-17,buffer,0,0,0,0,0,0,0,0,0.6,0,0,0.8,0.4,0.4,0.4,0.6,0,0.4,0,0,0.6,0.2,0.4,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.579031545,-0.361192264,-0.285409362 +23,R_1knRqoe1tDTO7yI,60 - 66,Canadian,Male,Male,High School (or equivalent),65,01PfPsV,01PAST,10,02DGEN,0,0.333333333,0.666666667,1,1,1,1,1,0,1,1,-1,0,0,0,0,0,0,1,1,1,1,1,-1,0,1,-1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,-1,0,0,0,0,0,0,1,1,1,1,-1,0,0,-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,4,4,4,5,4,3,4,4,4,4,3,4,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,buffer,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,-1,0,0,1,0,1,0,0,0,0,0,buffer,0,0,0,1,1,-1,buffer,-0.2,-0.2,0,-0.4,0.2,0,-0.2,0.4,0,buffer,0,0.333333333,-0.133333333,-0.066666667,0.066666667,buffer,1,0,1,0,1,0,0,0.4,0,0,0.8,0,0.2,0.6,0,0.4,0.6,0,0,0.8,0,0.2,0.4,0,buffer,HS_TS,-0.042564413,0.017289712,-0.434734729,-0.361192264,-0.205300424 +25,R_16kmB5kTriqlNwl,60 - 66,Canadian,Male,Male,High School (or equivalent),64,01PfPsV,02FUT,10,02DGEN,0.5,0,1,-1,1,1,-1,1,1,-2,1,0,-2,1,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,-2,1,3,0,3,1,0,2,1,-2,1,1,1,1,1,-3,0,3,1,1,0,1,1,0,-2,1,1,2,1,1,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,2,0,0,3,0,1,3,0,1,2,1,0,2,0,1,2,0,0,3,0,1,3,0,1,2,1,0,1,0,2,1,2,0,2,1,1,0,0,1,2,1,0,2,1,2,2,0,1,3,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,2,1,1,1,1,0,0,0,1,0,0,buffer,1,0,-2,1,-2,0,1,-1,0,3,0,0,0,0,0,0,-1,-1,0,0,-1,0,0,1,3,0,0,1,0,0,-1,-1,1,-1,-2,-1,-1,-1,-1,0,0,0,-1,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0.6,0,-0.4,0.6,0.2,-0.8,-0.8,-0.2,buffer,0,0,0.066666667,0.133333333,-0.6,buffer,0,0,0,0,0,0,0.8,1.4,0.8,1,1.4,0.8,1.2,0.8,0.8,1.4,0.8,0.6,0.2,0,0,1,0.8,0.2,buffer,HS_TS,-0.042564413,-0.158849227,-0.001844284,0.019597567,-0.045915089 +26,R_178SNJMlkqAz6qK,60 - 66,Canadian,Female,Female,High School (or equivalent),63,03VPfPs,02FUT,10,01ITEM,0.5,0.666666667,0.333333333,0,1,2,2,2,1,1,2,2,1,2,2,2,2,2,0,1,1,2,2,1,1,1,1,1,1,1,1,1,1,0,1,1,2,2,1,1,1,2,1,2,2,2,2,2,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,1,2,3,1,1,1,1,1,2,2,2,2,2,7,7,7,7,7,7,7,7,7,7,7,7,0,0,1,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,buffer,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,0,0,0,0,-1,-1,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0,-0.2,-0.2,0,-0.4,0.2,0,buffer,0,0,-0.066666667,-0.133333333,-0.066666667,buffer,0,0,0,0,0,0,0.2,0.4,1,0.2,0.2,0,0.4,0.4,1,0.4,0.4,0,0,0.2,1,0.4,0,1,buffer,HS_TS,-0.042564413,-0.158849227,-0.290437916,-0.488122207,-0.244993441 +27,R_5TWWxJFZ6ORvZKs,67 - 73,Canadian,Female,Female,University - Graduate (Masters),67,03VPfPs,01PAST,5,02DGEN,-0.125,1,0,3,1,1,-3,1,0,-3,2,-3,1,2,-2,3,2,3,2,2,1,-3,1,1,-2,2,-2,1,2,-2,3,2,2,3,1,1,-3,2,2,-3,2,-3,2,2,-1,2,2,2,3,2,2,-2,2,1,-3,2,-2,2,2,-2,3,3,3,3,2,2,-2,1,1,-3,2,-3,2,2,-1,3,2,3,6,6,4,7,7,7,3,2,6,2,2,2,1,1,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,2,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,buffer,1,0,-1,-1,-1,0,1,0,0,-1,0,0,0,-1,1,0,-1,-1,-1,1,1,0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,-1,0,buffer,3,4,-2,5,5,5,buffer,-0.4,0,0,-0.4,0.2,0.4,0.4,0.6,0,buffer,1.666666667,5,-0.133333333,0.066666667,0.333333333,buffer,1,1,3,1,0,4,0.4,0.6,0.2,0.2,0.6,0.6,0.8,0.6,0.2,0.6,0.4,0.2,0.6,0.8,0.4,0.2,0.2,0.4,buffer,grad_prof,1.101061858,2.483234847,-0.434734729,-0.107332375,0.7605574 +28,R_3OsrskvBYHuEQZX,39 - 45,Canadian,Male,Male,University - Graduate (Masters),42,02PsVPf,01PAST,10,01ITEM,0.75,0.333333333,0.666666667,-2,2,2,-2,2,0,1,2,0,3,0,1,2,0,1,-2,2,1,-2,0,0,0,2,-1,0,0,0,2,0,1,-2,2,1,-2,0,0,-2,2,-1,2,0,0,2,0,1,-2,2,2,-2,2,0,0,2,-2,2,1,0,2,-1,2,-2,2,2,-2,2,0,0,2,-2,2,1,0,2,-1,2,3,4,3,3,4,4,3,3,3,3,3,3,0,0,1,0,2,0,1,0,1,3,0,1,0,0,0,0,0,1,0,2,0,3,0,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,2,1,1,1,0,1,1,0,0,0,0,0,0,1,0,2,1,1,1,0,1,1,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,1,0,2,0,0,0,-1,2,-1,0,0,-1,-1,0,0,1,0,2,0,2,0,-1,0,-1,0,0,-1,-1,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,buffer,0,1,0,0,1,1,buffer,0.6,0.2,-0.6,0.6,0.2,-0.6,0,0.8,0,buffer,0.333333333,0.666666667,0.066666667,0.066666667,0.266666667,buffer,0,0,1,0,0,0,0.6,1,0.2,0.6,1,0.2,0,0.8,0.8,0,0.8,0.8,0,0.8,0,0,0,0,buffer,grad_prof,0.186160841,0.19342865,-0.001844284,-0.107332375,0.067603208 +29,R_72UXwfr2cJYIU81,67 - 73,Canadian,Male,Male,College Diploma/Certificate,71,01PfPsV,01PAST,10,02DGEN,-0.25,1,0,-1,1,3,-1,1,-2,-3,3,-3,0,3,1,3,-3,3,-1,1,3,-1,1,-3,-3,3,-3,0,3,2,3,-3,3,-1,1,3,-1,3,-3,-3,3,-3,1,3,2,3,-3,3,0,0,2,1,0,-3,0,1,-3,0,3,1,2,-3,3,0,1,3,1,-1,0,0,-1,0,0,3,0,3,-3,3,0,0,0,1,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,1,0,1,0,0,0,1,1,1,2,1,1,3,2,0,0,0,0,1,0,0,1,0,0,2,2,2,3,4,3,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,3,0,2,3,0,0,1,1,0,0,buffer,-1,-1,-1,-2,-1,0,-3,-2,0,0,0,1,-1,0,0,-1,0,0,-2,0,-1,-3,-4,-3,1,0,0,0,0,0,0,-1,-1,0,1,-3,0,-2,-3,1,0,-1,-1,0,0,buffer,0,0,0,1,0,5,buffer,-1.2,-1,0,-0.6,-2,0,-0.2,-1.4,-0.4,buffer,0,2,-0.733333333,-0.866666667,-0.666666667,buffer,1,0,5,0,0,0,0,0.2,0.2,0.4,0.4,0.2,1.2,1.2,0.2,1,2.4,0.2,0.4,0.2,0,0.6,1.6,0.4,buffer,C_Ug,-0.042564413,0.897984403,-1.733406066,-1.88435159,-0.690584417 +30,R_1EbeN9UHK0dbvBg,67 - 73,Canadian,Male,Male,Trade School (non-military),71,01PfPsV,01PAST,5,01ITEM,0.5,0.333333333,0.666666667,1,3,3,2,1,1,1,1,0,1,2,2,2,2,2,2,2,2,2,0,1,1,1,0,1,2,2,1,0,1,2,3,3,2,0,1,1,0,1,2,2,2,2,2,2,3,3,3,3,1,1,1,1,1,1,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,1,1,1,1,1,8,8,7,6,9,6,8,9,5,9,8,8,1,1,1,0,1,0,0,0,0,0,0,0,1,2,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,0,2,0,0,1,0,0,0,0,1,0,2,2,2,2,2,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,0,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,buffer,-1,1,1,-1,1,0,0,0,-1,0,-2,-2,-1,0,-1,0,-1,-1,0,0,-1,-1,0,1,0,-1,-1,-1,-1,-1,-1,0,0,-1,-1,-1,-1,0,0,0,-1,-1,0,1,0,buffer,0,-1,2,-3,1,-2,buffer,0.2,-0.2,-1.2,-0.4,-0.2,-1,-0.6,-0.4,-0.2,buffer,0.333333333,-1.333333333,-0.4,-0.533333333,-0.4,buffer,2,1,1,1,1,3,0.8,0,0.8,0.4,0.6,0,0.6,0.2,2,0.8,0.8,1,0.4,0.6,0.8,1,1,1,buffer,HS_TS,0.186160841,-0.863404979,-1.011921991,-1.24970187,-0.734717 +31,R_6E0JAaiEmjZbWTn,67 - 73,Canadian,Female,Female,High School (or equivalent),67,03VPfPs,02FUT,5,02DGEN,0.25,0,0.333333333,3,3,3,-3,2,2,-2,0,-3,-1,3,3,3,-1,1,3,3,3,-3,1,3,-3,2,-3,0,3,3,3,-1,1,3,3,3,-3,2,3,-3,0,-3,0,3,3,3,1,1,3,3,3,-3,-1,3,-3,2,-3,0,3,3,3,-1,1,3,3,3,-3,-1,3,-3,3,-3,0,3,3,3,-1,0,2,2,2,3,2,2,1,2,8,2,2,2,0,0,0,0,1,1,1,2,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,2,0,0,0,0,0,3,1,1,2,0,1,0,0,0,0,0,0,0,0,0,3,1,1,3,0,1,0,0,0,0,1,0,0,0,0,1,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,buffer,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,-3,0,0,0,0,0,2,-1,0,0,0,0,1,0,0,1,0,0,0,0,0,2,-1,buffer,1,0,-6,1,0,0,buffer,-0.4,0,0,-0.6,-0.6,0.2,0.2,0.2,0.2,buffer,-1.666666667,0.333333333,-0.133333333,-0.333333333,0.2,buffer,1,0,0,1,0,6,0.2,1,0,0,0.6,0.4,0.6,1,0,0.6,1.2,0.2,0.2,0.4,0.4,0,0.2,0.2,buffer,HS_TS,-1.186190685,0.017289712,-0.434734729,-0.868912038,-0.618136935 +32,R_3GqfnDGO35wRWf0,67 - 73,Canadian,Male,Male,University - Undergraduate,71,02PsVPf,02FUT,10,02DGEN,-0.625,0.333333333,0.666666667,3,1,3,1,-3,1,-2,2,3,1,2,2,1,-2,0,2,2,2,2,0,-2,0,-1,3,-2,2,2,2,0,1,2,2,2,1,1,1,-2,3,1,2,3,3,3,3,2,2,2,3,2,-2,1,-2,2,3,-2,2,2,2,-2,1,3,3,3,3,-3,-2,-3,1,3,-2,2,2,2,-2,2,2,3,1,4,9,5,4,0,1,2,3,5,1,1,1,1,3,3,2,3,0,3,0,0,1,2,1,1,1,1,0,4,0,0,1,2,1,1,1,2,5,2,1,1,0,1,1,0,0,0,0,3,0,0,1,0,1,0,2,0,2,0,3,1,1,0,3,0,0,1,0,2,0,0,0,1,1,3,2,4,2,4,1,1,1,3,1,1,1,0,1,1,3,1,1,0,0,0,0,0,0,1,buffer,0,0,1,0,2,3,2,3,0,0,0,0,0,2,0,1,-1,1,-2,4,-3,-1,0,2,-2,1,1,1,5,0,-1,-1,0,0,0,0,1,3,2,4,1,1,1,3,0,buffer,-2,3,0,2,6,0,buffer,0.6,1.6,0.4,0.6,-0.8,1.6,-0.4,2,1.2,buffer,0.333333333,2.666666667,0.866666667,0.466666667,0.933333333,buffer,2,6,4,2,3,4,1.4,2.2,0.8,1.4,0.8,2.2,0.8,0.6,0.4,0.8,1.6,0.6,0.4,3,1.4,0.8,1,0.2,buffer,C_Ug,0.186160841,1.25026228,1.729717499,0.654247288,0.955096977 +33,R_1roQArTUr5xbbQs,53 - 59,Canadian,Male,Male,High School (or equivalent),56,01PfPsV,02FUT,5,01ITEM,0,0.333333333,0.333333333,1,3,1,1,3,1,1,2,0,2,1,1,2,0,3,1,3,-1,-1,3,2,2,2,-1,2,1,2,2,1,-1,1,3,1,-1,3,2,2,2,-1,2,1,2,2,1,-1,1,3,1,1,3,2,1,2,1,2,1,2,2,0,-1,1,3,2,2,3,1,1,2,0,2,1,2,2,0,-1,7,5,4,3,3,3,3,3,3,3,3,3,0,0,2,2,0,1,1,0,1,0,0,1,0,1,4,0,0,0,2,0,1,1,0,1,0,0,1,0,1,4,0,0,0,0,0,1,0,0,1,0,0,1,0,0,4,0,0,1,1,0,0,0,0,0,0,0,1,0,0,4,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,buffer,0,0,2,2,0,0,1,0,0,0,0,0,0,1,0,0,0,-1,1,0,1,1,0,1,0,0,0,0,1,0,0,0,1,-1,0,-1,0,0,-1,0,0,0,0,0,0,buffer,4,2,1,0,0,0,buffer,0.8,0.2,0.2,0,0.6,0.2,0,-0.4,0,buffer,2.333333333,0,0.4,0.266666667,-0.133333333,buffer,4,2,1,0,0,0,0.8,0.6,1.2,0.4,0.6,1.2,0,0.4,1,0.4,0,1,0.4,0,0,0.4,0.4,0,buffer,HS_TS,1.558512366,-0.158849227,0.719639792,0.273457456,0.598190097 +34,R_7VJf8j0xeT8tSlX,67 - 73,Canadian,Male,Male,University - Undergraduate,69,03VPfPs,02FUT,10,02DGEN,1.125,0.333333333,0.333333333,2,2,2,2,2,-2,-2,-2,-1,1,1,2,2,-2,2,2,2,2,2,2,0,-2,2,-2,1,0,2,2,0,2,2,2,2,2,2,0,-2,2,0,2,0,2,1,1,2,2,2,2,2,2,-2,-2,1,-2,1,0,2,2,0,2,2,2,2,2,2,0,-2,1,-2,1,-2,2,2,0,2,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,2,0,4,1,0,1,0,0,2,0,0,0,0,0,0,2,0,4,1,1,1,0,1,3,0,0,0,0,0,0,0,0,3,1,0,1,0,0,2,0,0,0,0,0,0,2,0,3,1,0,3,0,0,2,0,0,0,0,0,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,buffer,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,-2,0,1,1,0,0,0,0,0,0,-2,0,0,2,1,-2,0,1,1,0,buffer,0,0,0,0,0,0,buffer,0,0.6,0,0,0.4,0,0,0.2,0,buffer,0,0,0.2,0.133333333,0.066666667,buffer,0,0,0,0,0,0,0,1.4,0.6,0,1.6,1,0,0.8,0.6,0,1.2,1,0,0.6,0.4,0,0.4,0.4,buffer,C_Ug,-0.042564413,-0.158849227,0.286749346,0.019597567,0.026233318 +35,R_3R5dVDIQi5KNKvv,39 - 45,Canadian,Male,Male,University - Undergraduate,40,02PsVPf,01PAST,5,02DGEN,-0.125,0,0.333333333,0,0,0,-1,1,-1,0,1,1,0,1,0,-1,2,0,0,0,1,-1,-1,0,1,1,0,-1,1,-1,0,-1,1,0,0,1,-1,-1,0,1,0,-1,-1,-1,1,0,-1,0,0,-1,0,0,1,1,-1,1,0,0,-1,-1,0,0,1,1,0,0,0,-1,1,-1,1,0,-2,0,1,2,-2,-1,6,2,7,8,5,7,4,8,5,5,1,6,0,0,1,0,2,1,1,0,1,1,0,1,1,3,1,0,0,1,0,2,1,1,1,2,1,2,1,1,3,0,0,1,0,1,0,2,1,0,1,0,2,1,1,2,1,1,0,0,1,2,2,1,0,1,2,1,1,3,4,1,0,0,0,0,0,0,0,1,1,0,2,2,0,0,1,1,1,0,0,2,0,0,0,0,2,1,2,2,2,2,buffer,0,-1,1,-1,2,-1,0,0,0,1,-2,0,0,1,0,-1,0,1,-1,0,-1,0,1,1,-1,1,0,-2,-1,-1,-1,-1,0,0,-2,0,0,1,1,-2,1,0,-2,-2,-1,buffer,2,-6,2,3,4,1,buffer,0.2,0,-0.2,-0.2,0,-0.6,-0.8,0,-0.8,buffer,-0.666666667,2.666666667,0,-0.266666667,-0.533333333,buffer,2,3,0,1,7,1,0.6,0.8,1.2,0.6,1.2,1.4,0.4,0.8,1.4,0.8,1.2,2,0,0.4,1,0.8,0.4,1.8,buffer,C_Ug,-0.500014922,1.25026228,-0.1461411,-0.741982096,-0.034468959 +36,R_71YoY39t8fQWagj,67 - 73,Canadian,Male,Male,Trade School (non-military),67,01PfPsV,02FUT,5,02DGEN,0.25,0,1,1,1,2,1,-2,0,-1,1,-1,0,2,2,1,-1,1,2,2,2,-1,-3,-1,-1,1,-1,1,1,2,1,-1,1,2,2,2,-2,-3,-1,-1,1,-1,1,2,2,1,-1,0,1,1,2,1,-2,-1,-1,1,0,-1,1,1,1,-1,1,1,1,2,1,-2,1,-1,1,-1,1,2,1,1,-1,1,2,3,2,2,6,5,1,1,4,2,2,2,1,1,0,2,1,1,0,0,0,1,1,0,0,0,0,1,1,0,3,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,2,0,0,1,2,1,0,0,0,0,buffer,1,1,0,2,1,0,0,0,-1,0,0,-1,0,0,0,1,1,0,3,1,0,0,0,0,0,0,-1,0,0,1,0,0,0,1,0,-2,0,0,-1,-2,0,0,0,0,1,buffer,1,2,-2,0,4,3,buffer,1,-0.2,-0.2,1.2,0,0,0.2,-1,0.2,buffer,0.333333333,2.333333333,0.2,0.4,-0.2,buffer,0,3,3,1,1,2,1,0.4,0.2,1.2,0.4,0.2,0,0.6,0.4,0,0.4,0.2,0.2,0,0.4,0,1,0.2,buffer,HS_TS,0.186160841,1.074123341,0.286749346,0.527317343,0.518587718 +37,R_7cuR9hbpAq3nAnE,39 - 45,Canadian,Female,Female,University - Graduate (Masters),41,02PsVPf,01PAST,10,01ITEM,1,0,1,3,3,3,2,3,0,-3,1,-1,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,2,2,2,3,3,2,3,3,2,2,2,2,2,2,2,2,-1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,6,6,6,6,5,6,6,6,6,6,6,6,0,0,0,1,0,3,6,2,4,3,0,0,0,0,0,1,0,0,0,0,2,5,1,3,2,0,0,1,0,0,1,1,1,0,1,2,5,1,0,2,1,1,1,1,1,0,0,0,1,0,3,6,2,4,3,0,0,0,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,4,1,1,1,1,1,1,buffer,-1,-1,-1,1,-1,1,1,1,4,1,-1,-1,-1,-1,-1,1,0,0,-1,0,-1,-1,-1,-1,-1,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,-3,0,-1,-1,0,-1,-1,buffer,0,0,0,0,-1,0,buffer,-0.6,1.6,-1,0,-1,0.2,-0.6,-0.6,-0.8,buffer,0,-0.333333333,3.7E-17,-0.266666667,-0.666666667,buffer,0,1,0,0,0,0,0.2,3.6,0,0.2,2.6,0.2,0.8,2,1,0.2,3.6,0,0.4,1,0.2,1,1.6,1,buffer,grad_prof,-0.042564413,-0.334988165,-0.1461411,-0.741982096,-0.316418943 +38,R_1pmqJMM4oQ6npwW,67 - 73,Canadian,Female,Female,High School (or equivalent),68,03VPfPs,02FUT,10,02DGEN,0.125,0,1,1,0,1,0,1,-2,-1,1,0,0,3,2,0,-3,3,2,1,2,2,3,-2,-2,1,-2,0,3,3,1,-3,3,2,1,2,2,2,-2,-2,2,-1,0,3,3,1,-3,3,2,1,2,2,1,-2,-2,1,0,0,3,3,1,-3,3,2,1,2,1,0,-3,-1,-1,1,-3,3,3,1,-3,3,0,1,1,1,0,0,1,0,0,2,1,6,1,1,1,2,2,0,1,0,2,0,0,1,1,0,0,1,1,1,2,1,0,1,1,1,0,0,1,1,0,0,1,1,1,2,0,0,1,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0,2,1,3,0,1,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,2,1,3,0,0,0,0,0,buffer,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,-1,1,-1,0,-3,0,0,0,0,0,0,0,0,-1,0,-1,-1,-1,0,-3,0,0,0,0,0,buffer,-1,1,1,-1,-1,-6,buffer,0.4,0.4,0,0.2,-0.8,0,-0.2,-1.2,0,buffer,0.333333333,-2.666666667,0.266666667,-0.2,-0.466666667,buffer,1,1,1,1,1,6,1.4,0.6,0.4,1.2,0.6,0.4,1,0.2,0.4,1,1.4,0.4,0.2,0.4,0,0.4,1.6,0,buffer,HS_TS,0.186160841,-1.567960733,0.431046162,-0.615052151,-0.39145147 +39,R_7uZCyK6Aaj5UCUp,46 - 52,Canadian,Male,Male,University - Undergraduate,47,03VPfPs,02FUT,10,02DGEN,0.5,0,1,0,1,1,2,3,0,1,1,-1,0,1,1,2,0,0,-1,1,1,0,3,0,1,1,-1,0,0,0,1,0,1,-1,2,1,0,3,0,1,1,-1,1,0,0,1,1,1,-1,1,-1,0,3,0,1,1,-1,1,0,0,1,1,0,-1,1,-1,0,3,0,1,1,-1,0,-1,0,2,1,0,6,7,6,6,6,6,5,6,5,6,6,7,1,0,0,2,0,0,0,0,0,0,1,1,1,0,1,1,1,0,2,0,0,0,0,0,1,1,1,1,1,1,1,0,2,2,0,0,0,0,0,1,1,1,1,1,0,1,0,2,2,0,0,0,0,0,0,2,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,buffer,0,0,-2,0,0,0,0,0,0,-1,0,0,0,-1,1,0,1,-2,0,0,0,0,0,0,1,-1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,-1,0,-1,1,0,buffer,1,1,1,0,0,-1,buffer,-0.4,-0.2,0,-0.2,0.2,0.2,0.2,0,-0.2,buffer,1,-0.333333333,-0.2,0.066666667,0,buffer,0,1,0,1,0,2,0.6,0,0.8,0.8,0.2,1,1,0.2,0.8,1,0,0.8,0.2,0.2,0.2,0,0.2,0.4,buffer,C_Ug,0.643611349,-0.334988165,-0.579031545,-0.107332375,-0.094435184 +40,R_1LC0QxEHI6yw8Wv,60 - 66,Canadian,Male,Male,College Diploma/Certificate,64,02PsVPf,01PAST,10,02DGEN,0.125,0,1,-2,1,3,-1,3,-1,-3,2,-3,0,3,1,3,1,3,-2,2,3,-1,3,0,-3,2,-3,1,3,2,2,2,3,-2,2,3,-2,3,-1,-3,2,-1,1,3,1,1,3,3,-2,1,3,2,1,-1,1,1,1,-1,3,2,0,-1,3,-3,1,3,3,1,-2,1,2,1,-2,2,1,-1,-2,3,5,6,5,5,6,5,6,6,6,6,7,7,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,0,0,2,1,0,0,2,2,0,0,0,0,3,2,0,4,1,4,1,0,1,3,2,0,1,0,0,4,2,1,4,0,4,2,1,0,4,3,0,0,0,0,1,0,1,0,0,2,0,0,1,1,1,0,1,0,0,1,0,1,0,1,0,1,1,1,1,1,0,buffer,0,1,0,-3,-2,1,-4,-1,-4,0,0,0,-2,-1,0,-1,1,0,-3,-2,-1,-4,0,-2,-1,-1,0,-2,-1,0,-1,0,0,0,0,0,0,-1,2,-1,-1,0,0,0,0,buffer,-1,0,-1,-1,-1,-2,buffer,-0.8,-1.6,-0.6,-1,-1.6,-0.8,-0.2,0,-0.2,buffer,-0.666666667,-1.333333333,-1,-1.133333333,-0.133333333,buffer,0,0,0,0,1,1,0.2,0.4,0.6,0.4,0.6,0.8,1,2,1.2,1.4,2.2,1.6,0.2,0.6,0.6,0.4,0.6,0.8,buffer,C_Ug,-0.500014922,-0.863404979,-2.310593327,-2.392071364,-1.516521148 +41,R_6C9AQLLL5nQzlxj,67 - 73,Canadian,Female,Female,University - Undergraduate,68,01PfPsV,02FUT,10,01ITEM,0,0.333333333,0.666666667,3,3,2,1,3,3,-2,3,-1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,-2,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-2,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-2,3,3,0,3,-1,3,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,2,0,0,5,0,4,0,1,5,0,3,0,0,0,1,2,0,0,5,0,4,0,0,0,0,0,0,0,0,1,2,0,0,5,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,1,0,0,3,0,4,0,0,0,0,0,0,0,0,0,0,0,1,5,0,3,0,0,0,0,0,0,0,6,0,0,0,0,3,0,4,0,buffer,0,0,0,0,0,0,0,0,3,0,1,5,0,3,0,0,0,0,0,0,0,4,0,3,0,0,-3,0,-4,0,0,0,0,0,0,0,-6,0,0,0,1,2,0,-1,0,buffer,0,0,0,-1,-1,0,buffer,0,0.6,1.8,0,1.4,-1.4,0,-1.2,0.4,buffer,0,-0.666666667,0.8,0,-0.266666667,buffer,0,0,0,1,1,0,0.6,1.8,1.8,0.6,1.8,0,0.6,1.2,0,0.6,0.4,1.4,0,0,1.8,0,1.2,1.4,buffer,C_Ug,-0.042564413,-0.511127103,1.585420683,-0.23426232,0.199366712 +42,R_5jx1hmHr7WuUxA1,67 - 73,Canadian,Female,Female,High School (or equivalent),70,02PsVPf,01PAST,10,02DGEN,0.125,0,1,3,2,0,2,-3,0,0,2,0,0,1,1,0,0,2,3,0,0,0,-3,0,0,0,0,0,2,2,2,1,2,3,2,1,1,-2,-1,0,1,1,0,1,2,0,0,2,3,2,0,1,-3,0,0,0,0,0,2,2,2,2,2,3,1,1,1,-3,-1,0,1,0,1,1,1,1,0,1,7,5,4,6,5,5,6,5,3,5,6,7,0,2,0,2,0,0,0,2,0,0,1,1,2,1,0,0,0,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,1,1,2,2,0,0,1,1,1,0,1,0,1,0,1,0,0,1,0,1,0,2,1,1,1,1,0,1,1,0,1,0,2,1,0,0,1,1,0,0,1,0,1,0,1,1,1,1,2,1,buffer,0,2,0,1,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,1,0,0,0,1,-1,0,1,-1,0,-1,0,1,0,1,1,0,0,0,1,-1,0,-1,1,-1,-1,buffer,1,0,1,1,-1,-2,buffer,0.6,0,-0.2,0,0,-0.2,0.6,0,-0.4,buffer,0.666666667,-0.666666667,0.133333333,-0.066666667,0.066666667,buffer,1,0,1,1,1,4,0.8,0.4,1,0.6,0.6,0.2,0.2,0.4,1.2,0.6,0.6,0.4,1,0.6,0.8,0.4,0.6,1.2,buffer,HS_TS,0.414886095,-0.511127103,0.14245253,-0.361192264,-0.078745185 +43,R_5NCl33fWpDZKrBX,60 - 66,Canadian,Female,Female,College Diploma/Certificate,64,01PfPsV,02FUT,5,01ITEM,0.125,0.333333333,0.666666667,1,2,3,3,-3,-3,-1,2,1,-1,3,1,2,0,3,3,3,3,0,-3,-3,2,3,3,-3,3,3,2,1,3,3,3,3,0,-3,-3,-1,2,1,2,3,2,2,2,3,1,2,3,3,-3,-3,2,0,1,-1,3,2,2,-3,2,-1,-1,3,3,-3,-3,2,0,1,-2,2,1,2,-3,2,6,6,6,7,7,6,7,7,4,3,7,6,2,1,0,3,0,0,3,1,2,2,0,2,0,1,0,2,1,0,3,0,0,0,0,0,3,0,1,0,2,0,0,0,0,0,0,0,3,2,0,0,0,1,0,3,1,2,3,0,0,0,0,3,2,0,1,1,0,0,3,1,0,0,0,0,0,0,3,1,2,5,0,1,0,1,0,2,3,0,0,0,0,0,0,0,1,1,1,0,0,0,buffer,2,1,0,3,0,0,0,-1,2,2,0,1,0,-2,-1,0,-2,0,3,0,0,-3,-2,0,2,-1,1,0,-1,-1,-2,-3,0,0,0,0,3,1,2,4,-1,0,0,1,0,buffer,-1,-1,2,4,0,0,buffer,1.2,0.6,-0.4,0.2,-0.6,-0.4,-1,2,0,buffer,0,1.333333333,0.466666667,-0.266666667,0.333333333,buffer,1,1,0,4,0,2,1.2,1.6,0.6,1.2,0.6,0.6,0,1,1,1,1.2,1,0,2.2,0.4,1,0.2,0.4,buffer,C_Ug,-0.042564413,0.545706526,0.863936607,-0.741982096,0.156274156 +44,R_5bshrQuHqvVktBn,67 - 73,Canadian,Male,Male,High School (or equivalent),71,03VPfPs,01PAST,5,02DGEN,0.125,0,0.666666667,2,2,1,1,1,1,1,1,-1,1,0,-2,2,-2,2,2,3,2,1,1,2,0,1,-2,0,1,-1,2,-1,3,2,2,1,1,1,2,0,2,-2,2,1,-1,2,-1,3,2,3,2,2,2,2,0,1,-1,2,1,-1,2,-2,3,2,2,2,2,2,1,0,1,-1,1,1,-1,2,-1,3,5,5,5,5,5,5,5,5,5,5,6,5,0,1,1,0,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,buffer,0,0,0,-1,-1,0,0,0,1,0,0,0,0,1,0,0,0,-1,-1,-1,1,0,1,1,1,0,0,0,0,0,0,0,1,0,0,-1,0,1,0,1,0,0,0,-1,0,buffer,0,0,0,0,-1,0,buffer,-0.4,0.2,0.2,-0.6,0.8,0,0.2,0.2,-0.2,buffer,0,-0.333333333,0,0.066666667,0.066666667,buffer,0,0,0,0,1,0,0.4,0.8,0.8,0,1,0.8,0.8,0.6,0.6,0.6,0.2,0.8,0.4,0.6,0,0.2,0.4,0.2,buffer,HS_TS,-0.042564413,-0.334988165,-0.1461411,-0.107332375,-0.157756513 +45,R_539NZp5Iy0ntBF7,60 - 66,Canadian,Female,Female,College Diploma/Certificate,62,03VPfPs,02FUT,10,02DGEN,0.375,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,1,0,-2,1,-2,1,1,1,1,1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,7,8,7,8,8,8,7,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,3,0,3,0,0,0,0,0,0,0,0,0,0,0,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,3,0,3,0,0,0,0,0,0,0,0,0,0,0,2,2,0,2,0,0,0,0,0,0,buffer,0,0,0,0,0,-2,-2,0,-2,0,0,0,0,0,0,0,1,1,1,0,1,3,0,3,0,0,0,0,0,0,0,1,1,1,0,-1,1,0,1,0,0,0,0,0,0,buffer,0,0,0,0,-1,0,buffer,0,-1.2,0,0.6,1.4,0,0.6,0.2,0,buffer,0,-0.333333333,-0.4,0.666666667,0.266666667,buffer,0,1,1,0,0,1,0,0,0,0.6,1.4,0,0,1.2,0,0,0,0,0.6,1.4,0,0,1.2,0,buffer,C_Ug,-0.042564413,-0.334988165,-1.011921991,1.035037119,-0.088609362 +46,R_1OTmhMegKLREAOR,60 - 66,Canadian,Female,Female,High School (or equivalent),63,03VPfPs,02FUT,5,01ITEM,0,0,1,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +47,R_62sPBPIuEjdbMtZ,46 - 52,Canadian,Female,Female,College Diploma/Certificate,50,02PsVPf,01PAST,5,01ITEM,0.5,0.333333333,0.666666667,0,0,3,1,3,2,-3,2,-2,2,3,3,1,2,3,0,0,3,1,3,2,-3,3,-3,3,3,3,2,3,3,0,0,3,1,3,1,-3,3,-3,2,3,3,2,2,3,0,0,3,1,3,2,-3,2,-3,2,3,3,2,2,3,0,0,3,1,3,2,-3,2,-3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,buffer,0,0.4,0.2,0,0.2,0,0,0.2,0.2,buffer,0,0,0.2,0.066666667,0.133333333,buffer,0,0,0,0,0,0,0,0.6,0.4,0,0.6,0.2,0,0.2,0.2,0,0.4,0.2,0,0.4,0.2,0,0.2,0,buffer,C_Ug,-0.042564413,-0.158849227,0.286749346,-0.107332375,-0.005499167 +48,R_5EveSLgf170LhxT,67 - 73,Canadian,Female,Female,High School (or equivalent),67,01PfPsV,01PAST,10,02DGEN,0.25,0,1,3,3,3,3,2,1,1,3,2,1,3,-1,1,0,3,1,3,3,-1,3,2,1,3,1,1,3,-1,1,-1,3,1,3,3,-1,3,3,1,3,1,1,3,-1,2,2,3,3,2,3,3,-1,-1,1,1,1,-2,3,-2,1,-3,3,3,3,3,3,2,0,1,1,1,-1,3,-2,1,-3,3,1,5,2,7,2,1,6,4,4,1,4,4,2,0,0,4,1,1,0,0,1,0,0,0,0,1,0,2,0,0,4,1,2,0,0,1,0,0,0,1,2,0,0,1,0,0,3,2,0,2,1,3,0,1,0,3,0,0,0,0,0,0,1,0,2,1,2,0,1,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,1,3,0,0,1,0,0,3,1,0,0,0,1,0,0,0,0,0,buffer,2,-1,0,4,-2,-1,0,-2,0,-3,0,-1,0,-2,0,2,0,0,4,1,1,0,-2,0,-2,0,-1,1,-1,0,0,-1,0,0,-3,0,0,0,0,-1,0,0,1,3,0,buffer,-5,1,-2,6,-2,-3,buffer,0.6,-1.2,-0.6,1.4,-0.6,-0.2,-0.8,-0.2,0.8,buffer,-2,0.333333333,-0.4,0.2,-0.066666667,buffer,6,3,1,5,0,0,1.4,0.4,0.2,1.4,0.6,0.6,0.8,1.6,0.8,0,1.2,0.8,0,0.2,0.8,0.8,0.4,0,buffer,HS_TS,-1.414915939,0.017289712,-1.011921991,0.146527512,-0.565755176 +49,R_3Pu9IZ9Xbl6mTKK,46 - 52,Canadian,Male,Male,University - Graduate (Masters),51,01PfPsV,02FUT,5,02DGEN,0.375,0.666666667,0.333333333,0,3,3,-3,3,2,-2,2,-3,2,1,3,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,6,5,5,5,5,5,5,5,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,3,3,3,3,2,2,2,3,2,1,3,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0.333333333,0,0,0,buffer,0,1,0,0,0,0,2.4,2.2,1.2,2.4,2.2,1.2,2.4,2.2,1.2,2.4,2.2,1.2,0,0,0,0,0,0,buffer,grad_prof,-0.042564413,0.017289712,-0.1461411,-0.23426232,-0.10141953 +50,R_7CPbhi1vrmwrSEc,67 - 73,Canadian,Female,Female,Trade School (non-military),68,02PsVPf,01PAST,10,01ITEM,0,0.333333333,0.666666667,0,2,1,1,0,-1,-2,1,-2,-1,1,1,1,-1,2,1,2,2,1,1,-1,-2,1,-2,-1,1,1,1,-1,3,1,2,3,-2,3,-2,-2,3,-2,2,1,2,1,-1,1,1,3,3,3,-1,-2,-1,0,-1,-2,2,2,1,-1,3,1,3,3,3,-1,-2,-1,0,1,-2,2,2,1,0,3,1,2,2,4,3,2,4,4,4,5,4,4,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,2,3,3,1,0,2,0,3,0,1,0,0,1,1,1,2,2,1,1,1,1,1,1,1,1,0,0,1,1,1,2,2,1,1,1,1,3,1,1,1,0,1,1,0,0,1,3,2,1,0,2,0,3,0,1,0,0,2,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,buffer,0,-1,-1,-2,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,-1,0,1,2,0,-1,1,-3,2,-1,0,0,-1,0,0,0,1,3,2,1,0,2,-2,3,0,1,0,-1,2,buffer,-3,-2,-2,-1,-1,-2,buffer,-0.8,-1,-0.4,0.4,-0.2,-0.4,1.2,0.8,0.4,buffer,-2.333333333,-1.333333333,-0.733333333,-0.066666667,0.8,buffer,3,1,0,1,0,0,0.6,0,0.2,1.8,1.2,0.4,1.4,1,0.6,1.4,1.4,0.8,1.2,1.2,0.6,0,0.4,0.2,buffer,HS_TS,-1.643641192,-0.863404979,-1.733406066,-0.361192264,-1.150411125 +51,R_7rSftG0Xht8WNHc,60 - 66,Canadian,Male,Male,University - Undergraduate,61,03VPfPs,01PAST,5,02DGEN,-0.375,0.333333333,0.666666667,0,2,2,2,0,0,-1,0,1,0,2,0,1,0,2,2,2,2,2,0,0,0,2,3,0,2,0,1,0,2,2,2,2,2,1,0,0,2,1,0,2,0,1,0,2,0,2,2,3,0,-2,-2,2,0,0,2,0,2,-1,2,0,2,2,3,0,-1,2,2,0,-1,2,0,1,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,2,2,0,0,0,0,0,0,2,0,0,0,1,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,2,1,2,1,0,0,0,1,1,0,0,0,0,1,0,1,3,2,1,1,0,0,0,2,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,4,0,0,1,0,0,1,1,0,buffer,2,0,0,-1,0,-2,0,0,1,0,0,0,-1,-1,0,2,0,0,-1,1,-1,-2,0,-1,-1,0,0,0,-2,0,0,0,0,0,1,-1,-4,0,2,-1,0,0,-1,-1,0,buffer,0,0,0,0,0,0,buffer,0.2,-0.2,-0.4,0.4,-1,-0.4,0.2,-0.8,-0.4,buffer,0,0,-0.133333333,-0.333333333,-0.333333333,buffer,0,0,0,0,0,0,0.4,1,0,0.6,0.6,0,0.2,1.2,0.4,0.2,1.6,0.4,0.2,0.4,0,0,1.2,0.4,buffer,C_Ug,-0.042564413,-0.158849227,-0.434734729,-0.868912038,-0.376265102 +52,R_5QGhSZ8VB5JKDJ8,60 - 66,Canadian,Female,Female,University - Undergraduate,60,01PfPsV,02FUT,5,02DGEN,0,0,1,3,3,3,3,-3,0,0,2,-1,0,3,1,2,0,1,3,3,3,3,-3,0,-2,3,0,3,2,2,2,3,2,3,3,3,3,-3,3,-2,2,-1,0,3,2,2,2,3,3,3,3,3,-3,0,-3,3,-1,1,3,3,3,0,2,3,3,3,3,-3,0,-2,3,0,3,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,2,1,1,3,1,1,0,3,1,0,0,0,0,0,3,2,0,0,0,0,1,0,2,2,0,0,0,0,0,0,3,1,0,1,0,2,1,0,1,0,0,0,0,0,0,2,1,1,3,0,2,1,3,2,0,0,0,0,0,3,0,1,1,3,1,0,0,1,1,0,0,0,0,0,0,1,0,1,2,0,0,0,3,1,buffer,0,0,0,0,0,0,-1,0,1,2,1,-1,-1,3,0,0,0,0,0,0,3,0,-1,-1,-3,0,-1,-1,-1,0,0,0,0,0,0,3,-1,1,0,1,1,0,0,-2,0,buffer,0,0,0,0,0,0,buffer,0,0.4,0.4,0,-0.4,-0.6,0,0.8,-0.2,buffer,0,0,0.266666667,-0.333333333,0.2,buffer,0,0,0,0,0,0,0,1.4,1.2,0,1,1,0,1,0.8,0,1.4,1.6,0,1.6,0.6,0,0.8,0.8,buffer,C_Ug,-0.042564413,-0.158849227,0.431046162,-0.868912038,-0.159819879 +53,R_7179WZWFoIZAFKe,25 - 31,Canadian,Female,Female,High School (or equivalent),30,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,2,2,2,0,1,-2,2,-1,2,-1,1,2,0,2,2,2,2,2,0,2,-2,2,0,2,0,2,2,2,2,2,2,2,2,0,1,2,0,1,1,1,1,1,1,2,2,2,1,2,0,2,-2,2,-1,1,0,1,2,-1,2,2,2,2,1,0,2,-2,2,0,2,1,1,1,0,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,1,0,0,1,0,1,1,0,2,0,0,0,0,0,0,0,4,2,2,1,2,0,1,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1,0,0,1,0,2,0,1,0,0,0,0,0,0,0,1,4,2,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,0,buffer,0,0,-1,0,0,0,0,0,1,-1,0,1,0,1,0,0,0,0,-1,0,-1,4,2,1,1,0,0,0,1,0,0,0,-1,-1,0,1,4,2,0,0,0,1,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0.4,-0.2,1.4,0.2,-0.4,1.4,0.2,buffer,0,0,0.066666667,0.466666667,0.4,buffer,0,0,0,0,0,0,0,0.4,0.8,0,1.8,0.8,0.2,0.4,0.4,0.2,0.4,0.6,0,1.8,0.8,0.4,0.4,0.6,buffer,HS_TS,-0.042564413,-0.158849227,-0.001844284,0.654247288,0.112747341 +54,R_6Q5tReiI71WewEz,53 - 59,Canadian,Female,Female,High School (or equivalent),55,02PsVPf,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,3,3,3,2,-2,-1,-2,2,1,0,3,2,3,-2,3,3,2,2,2,-2,-2,2,1,3,-1,3,2,1,1,3,3,1,3,2,-1,-1,2,1,3,1,3,2,2,1,3,3,3,3,2,-2,-3,-2,2,-1,-1,3,1,1,-3,3,3,2,2,3,-3,-3,-2,2,-1,1,3,2,2,-3,3,5,5,2,4,10,2,0,0,3,1,3,1,0,1,1,0,0,1,4,1,2,1,0,0,2,3,0,0,2,0,0,1,0,4,1,2,1,0,0,1,3,0,0,0,0,0,0,2,0,0,2,1,0,1,2,1,0,0,1,1,1,1,2,0,0,2,1,0,0,1,1,0,0,1,1,0,1,1,0,0,0,2,0,0,1,0,0,0,1,1,1,1,0,0,0,0,2,0,1,1,0,0,buffer,0,1,1,0,0,-1,4,1,0,0,0,-1,0,2,0,0,1,-1,-1,0,-2,4,1,0,0,0,0,0,2,0,0,0,0,-1,0,1,0,0,0,0,0,-1,0,0,0,buffer,5,5,-1,3,7,1,buffer,0.4,0.8,0.2,-0.2,0.6,0.4,-0.2,0.2,-0.2,buffer,3,3.666666667,0.466666667,0.266666667,-0.066666667,buffer,1,5,0,1,3,2,0.4,1.8,1,0.6,1.6,0.8,0,1,0.8,0.8,1,0.4,0.6,0.6,0.2,0.8,0.4,0.4,buffer,HS_TS,2.015962874,1.778679094,0.863936607,0.273457456,1.233009008 +55,R_3LvNOREN9MEEAAl,53 - 59,Canadian,Female,Female,High School (or equivalent),59,01PfPsV,02FUT,5,02DGEN,0,0,1,3,2,0,3,-1,-3,-2,1,-2,0,1,1,2,-3,2,3,2,0,3,-1,-2,-2,1,-2,-1,2,2,2,-2,2,3,2,0,3,-1,-2,-2,1,-2,0,2,2,2,-2,2,3,2,0,3,-1,-2,-2,1,-2,-1,2,2,2,-2,2,3,2,0,3,-1,-2,-2,2,-2,-1,2,2,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,-0.4,0,0,0,0,buffer,0,0,0,-0.133333333,0,buffer,0,0,0,0,0,0,0,0.4,0.6,0,0.2,0.6,0,0.4,0.6,0,0.6,0.6,0,0.2,0,0,0.2,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.488122207,-0.208919237 +56,R_6StnFLZFYnlx0Qh,39 - 45,Canadian,Female,Female,University - Undergraduate,43,01PfPsV,02FUT,10,02DGEN,1,0,0.666666667,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,1,1,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,1,0,0,1,1,1,1,0,1,1,0,0,0,0,0,2,0,0,0,0,0,1,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-1,0,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,buffer,0,0,0,0,0,0,buffer,0,0.2,0.8,0,0,0.6,0,0.6,0.6,buffer,0,0,0.333333333,0.2,0.4,buffer,0,0,0,0,0,0,0,0.6,0.8,0,0.4,0.6,0,0.4,0,0,0.4,0,0,0.6,0.6,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,0.575342976,0.146527512,0.130114212 +57,R_3LXPr6n0smAwMBm,39 - 45,Canadian,Male,Male,University - Graduate (Masters),41,02PsVPf,02FUT,5,02DGEN,-0.125,0.666666667,0,1,2,1,1,0,1,-2,2,-1,0,1,1,2,1,2,2,2,2,2,2,0,-2,2,-2,2,2,2,2,2,2,2,2,2,1,1,0,-2,2,-2,1,2,2,2,2,2,2,1,1,1,1,0,-3,2,-2,2,2,2,2,2,1,3,3,2,2,2,-1,-2,2,-2,2,3,3,3,2,3,7,7,6,7,6,6,6,6,7,7,7,6,1,0,1,1,2,1,0,0,1,2,1,1,0,1,0,1,0,1,0,1,1,0,0,1,1,1,1,0,1,0,1,1,0,0,1,1,1,0,1,2,1,1,0,1,1,2,1,1,1,2,2,0,0,1,2,2,2,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,2,1,1,1,1,1,0,0,0,1,1,1,0,2,buffer,0,-1,1,1,1,0,-1,0,0,0,0,0,0,0,-1,-1,-1,0,-1,-1,-1,0,0,0,-1,-1,-1,-1,0,-1,-1,-2,-1,0,0,-1,-1,0,0,1,-1,-1,-1,0,-2,buffer,1,1,-1,0,-1,0,buffer,0.4,-0.2,-0.2,-0.8,-0.4,-0.8,-0.8,-0.2,-1,buffer,0.333333333,-0.333333333,0,-0.666666667,-0.666666667,buffer,0,1,0,1,1,1,1,0.8,0.6,0.6,0.6,0.6,0.6,1,0.8,1.4,1,1.4,0.4,0.2,0,1.2,0.4,1,buffer,grad_prof,0.186160841,-0.334988165,-0.1461411,-1.503561759,-0.449632546 +58,R_7E0xTaALb4X6BIP,25 - 31,Canadian,Male,Male,University - Undergraduate,29,01PfPsV,01PAST,10,01ITEM,0.875,0,0.333333333,3,1,0,3,2,2,2,1,3,0,3,2,1,3,0,3,0,3,2,2,0,1,3,3,1,0,-2,-3,-3,2,2,0,1,-1,-1,3,0,1,0,2,-1,1,1,2,0,3,0,3,2,1,3,1,-2,-2,-1,2,1,2,0,1,-1,2,1,0,3,2,1,3,0,1,0,1,0,2,2,8,4,7,7,6,8,8,8,8,7,8,8,0,1,3,1,0,2,1,2,0,1,3,4,4,6,2,1,1,1,4,3,1,2,0,3,2,4,1,0,1,0,0,1,3,1,1,1,1,3,5,1,1,1,1,3,1,4,1,1,3,1,0,1,2,3,1,3,1,1,1,2,1,0,2,3,3,3,1,2,3,1,1,3,4,5,2,4,2,2,2,2,1,0,5,2,2,2,0,2,2,1,buffer,0,0,0,0,-1,1,0,-1,-5,0,2,3,3,3,1,-3,0,0,1,2,1,1,-2,0,1,1,0,-1,0,-2,-3,-2,0,1,1,2,1,-3,1,-1,-1,3,2,3,1,buffer,0,-4,-1,0,-2,0,buffer,-0.2,-1,2.4,0,0.2,-0.4,-0.6,0,1.6,buffer,-1.666666667,-0.666666667,0.4,-0.066666667,0.333333333,buffer,1,2,1,1,0,0,1,1.2,3.8,2,1.6,1.2,1.2,2.2,1.4,2,1.4,1.6,1.8,2,3,2.4,2,1.4,buffer,C_Ug,-1.186190685,-0.511127103,0.719639792,-0.361192264,-0.334717565 +59,R_68jv8Bf5MKjNTCp,67 - 73,Canadian,Female,Female,High School (or equivalent),69,03VPfPs,02FUT,10,01ITEM,-0.75,0,0.666666667,3,3,3,-1,0,0,-3,3,-1,-2,3,0,3,-3,3,3,3,3,-3,0,3,-3,3,-1,0,3,2,2,-3,3,3,3,3,-3,2,2,-3,3,-1,0,3,2,2,-3,3,3,3,3,0,0,1,-3,3,-1,0,3,2,2,-3,3,3,3,3,2,-2,0,0,2,0,-2,3,1,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,0,0,0,2,0,2,1,0,0,0,0,0,2,2,2,0,0,0,2,0,2,1,0,0,0,0,0,1,0,1,0,0,0,2,0,2,1,0,0,0,0,0,3,2,0,3,1,1,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,3,1,1,2,0,1,1,0,0,buffer,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,2,-3,-1,-1,2,0,1,1,0,0,0,0,0,-2,0,0,-3,-1,-1,-2,0,-1,-1,0,0,buffer,0,0,0,0,0,0,buffer,0.2,0.4,0,-0.2,-0.2,0.4,-0.4,-1.4,-0.4,buffer,0,0,0.2,0,-0.733333333,buffer,0,0,0,0,0,0,0.4,1,0.6,0.8,0.8,0.6,0.2,0.6,0.6,1,1,0.2,0.4,0.2,0,0.8,1.6,0.4,buffer,HS_TS,-0.042564413,-0.158849227,0.286749346,-0.23426232,-0.037231653 +60,R_3r1TAD5xtoumLWg,67 - 73,Canadian,Male,Male,College Diploma/Certificate,67,01PfPsV,01PAST,5,02DGEN,0,0.333333333,0.666666667,3,3,2,2,2,0,-2,2,-1,1,1,-1,3,-2,3,3,3,2,1,0,-1,1,3,1,0,2,-1,3,3,3,3,3,1,-1,0,0,1,3,1,1,2,-1,3,2,3,3,2,2,3,1,0,-1,2,-1,1,1,-1,3,-1,3,3,3,2,3,0,1,-2,2,-2,1,1,-1,3,-2,3,2,3,3,3,5,4,3,1,4,2,4,4,0,0,0,1,2,1,3,1,2,1,1,0,0,5,0,0,0,1,3,2,0,3,1,2,0,1,0,0,4,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,2,1,0,0,1,0,0,0,0,0,0,0,0,1,2,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,1,0,0,0,0,1,0,buffer,0,-1,0,0,1,1,2,1,2,1,1,0,0,4,0,0,0,1,2,0,-1,3,1,1,0,1,0,0,4,0,0,-1,1,2,-1,0,-1,0,-1,1,0,0,0,0,0,buffer,-1,2,-1,1,1,0,buffer,0,1.4,1,0.6,0.8,1,0.2,-0.2,0,buffer,0,0.666666667,0.8,0.8,0,buffer,1,2,1,1,3,0,0.6,1.6,1.2,1.2,1.2,1,0.6,0.2,0.2,0.6,0.4,0,0.6,0.4,0.2,0.4,0.6,0.2,buffer,C_Ug,-0.042564413,0.19342865,1.585420683,1.288897006,0.756295481 +61,R_3SAHrS0GQBJ4N6c,60 - 66,Canadian,Male,Male,High School (or equivalent),60,03VPfPs,01PAST,5,02DGEN,0.5,0.333333333,0.666666667,2,2,2,1,3,1,-1,2,1,2,2,3,2,0,3,0,2,2,-2,3,1,1,2,-1,2,2,2,2,1,2,-1,2,2,-2,3,0,2,2,1,2,2,2,2,1,2,2,2,2,2,3,-1,-2,1,1,2,2,3,2,-2,3,1,2,2,2,2,-1,-3,2,1,1,2,2,2,-2,3,7,8,7,8,7,7,8,7,8,7,8,7,2,0,0,3,0,0,2,0,2,0,0,1,0,1,1,3,0,0,3,0,1,3,0,0,0,0,1,0,1,1,0,0,0,1,0,2,1,1,0,0,0,0,0,2,0,1,0,0,1,1,2,2,0,0,1,0,1,0,2,0,1,0,0,0,0,1,1,0,2,0,0,0,0,0,0,1,0,0,0,1,0,1,1,0,1,0,1,0,0,0,buffer,2,0,0,2,0,-2,1,-1,2,0,0,1,0,-1,1,2,0,0,2,-1,-1,1,0,0,-1,0,0,0,-1,1,0,0,0,0,-1,1,0,-1,2,-1,0,-1,0,0,0,buffer,-1,1,-1,1,-1,0,buffer,0.8,0,0.2,0.6,-0.2,0,-0.2,0.2,-0.2,buffer,-0.333333333,0,0.333333333,0.133333333,-0.066666667,buffer,1,1,0,1,1,1,1,0.8,0.6,1.2,0.8,0.6,0.2,0.8,0.4,0.6,1,0.6,0.2,0.8,0,0.4,0.6,0.2,buffer,HS_TS,-0.271289667,-0.158849227,0.575342976,0.019597567,0.041200412 +62,R_5t0gKO3C7BnFyCn,67 - 73,Canadian,Male,Male,University - Graduate (Masters),67,01PfPsV,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,3,3,2,-2,1,1,-3,3,-3,2,2,1,2,-1,2,3,3,2,-3,1,1,-3,3,-3,2,2,2,2,1,3,3,3,2,-3,2,1,-3,3,-3,2,2,2,2,1,2,3,3,2,-2,1,1,-3,2,-3,2,2,2,2,-1,3,3,3,2,0,1,1,-3,2,-3,2,2,2,2,0,3,0,0,0,0,0,0,1,1,1,3,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,2,1,0,0,0,1,1,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,2,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,1,0,0,0,-1,0,0,0,0,0,2,0,0,0,0,-1,1,0,0,-1,0,0,0,0,0,1,-1,0,0,0,-2,1,0,0,0,0,0,0,0,0,-1,1,buffer,-1,-1,-1,-3,-1,-1,buffer,0.2,-0.2,0.4,0,-0.2,0,-0.2,0,0,buffer,-1,-1.666666667,0.133333333,-0.066666667,-0.066666667,buffer,0,0,0,2,0,0,0.2,0,0.8,0.4,0,0.6,0,0.2,0.4,0.4,0.2,0.6,0.2,0,0.2,0.4,0,0.2,buffer,grad_prof,-0.728740176,-1.039543918,0.14245253,-0.361192264,-0.496755957 +63,R_3oL0DPh0524TOG2,46 - 52,Canadian,Female,Female,High School (or equivalent),47,03VPfPs,02FUT,10,02DGEN,0,0,1,3,3,3,2,1,-3,-3,1,1,2,2,-1,3,1,3,3,3,3,-1,3,-3,-3,1,1,2,2,-1,3,1,3,3,3,3,-1,3,-3,-3,1,1,2,2,-1,3,2,3,3,3,3,3,3,-3,-3,3,1,3,2,-1,3,2,3,3,3,3,3,3,-3,-3,3,1,3,2,-1,3,2,3,2,2,2,2,2,2,2,2,1,2,2,2,0,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,0,0,0,0,0,0,0,0,1,0,0,0,0,1,2,0,0,2,0,1,0,0,0,1,0,0,0,0,1,2,0,0,2,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,2,0,0,0,-2,0,-1,0,0,0,-1,0,0,0,0,2,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,1,0,0,0,buffer,0.4,-0.6,-0.2,0.4,-0.6,0,0,0,0.2,buffer,0.333333333,0,-0.133333333,-0.066666667,0.066666667,buffer,0,0,0,0,0,1,1,0,0,1,0,0.2,0.6,0.6,0.2,0.6,0.6,0.2,0,0,0.2,0,0,0,buffer,HS_TS,0.186160841,-0.158849227,-0.434734729,-0.361192264,-0.192153845 +64,R_3E2CRTzXTCzrQc1,67 - 73,Canadian,Male,Male,High School (or equivalent),71,03VPfPs,01PAST,5,01ITEM,0.5,0,1,-3,3,3,-3,-1,-3,1,2,0,2,-2,1,3,0,0,-3,3,3,-3,-3,-3,1,2,-1,-3,-2,0,3,-2,0,-3,3,3,-3,1,-3,0,2,-2,2,-2,1,3,-2,0,-3,3,3,-3,-3,-3,1,1,-1,2,-2,0,3,-3,0,-3,3,3,-3,-3,-3,1,1,1,2,-2,0,3,-3,0,3,3,2,3,3,3,3,3,3,2,3,3,0,0,0,0,2,0,0,0,1,5,0,1,0,2,0,0,0,0,0,2,0,1,0,2,0,0,0,0,2,0,0,0,0,0,2,0,0,1,1,0,0,1,0,3,0,0,0,0,0,2,0,0,1,1,0,0,1,0,3,0,0,0,0,0,4,0,1,0,1,5,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,-1,0,5,0,0,0,-1,0,0,0,0,0,0,0,1,-1,1,0,0,-1,0,-1,0,0,0,0,0,4,0,1,0,-1,5,0,1,0,0,0,buffer,0,0,-1,1,0,0,buffer,0,0.8,-0.2,0,0.2,-0.4,0.8,1,0.2,buffer,-0.333333333,0.333333333,0.2,-0.066666667,0.666666667,buffer,0,0,1,1,0,0,0.4,1.2,0.6,0.4,0.6,0.4,0.4,0.4,0.8,0.4,0.4,0.8,0.8,1.4,0.2,0,0.4,0,buffer,HS_TS,-0.271289667,0.017289712,0.286749346,-0.361192264,-0.082110718 +65,R_5j2R74rQQ9YqFt4,60 - 66,Canadian,Male,Male,College Diploma/Certificate,61,01PfPsV,02FUT,10,02DGEN,0,0,1,3,2,-1,1,1,-1,0,1,1,0,1,0,1,0,2,3,3,-1,0,1,1,0,1,2,0,2,0,1,1,1,3,3,0,0,2,-1,0,1,3,0,2,0,1,0,1,3,1,-1,1,1,-1,1,2,1,0,2,1,1,0,1,3,2,-1,1,1,-1,0,2,1,0,2,1,2,1,2,3,4,4,2,5,3,2,2,2,2,2,2,0,1,0,1,0,2,0,0,1,0,1,0,0,1,1,0,1,1,1,1,0,0,0,2,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,1,0,1,2,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,buffer,0,0,0,1,0,2,-1,-1,1,0,0,-1,0,1,0,0,1,1,1,1,0,0,-1,2,0,0,-1,-1,-1,1,0,-1,1,0,1,2,-1,0,1,0,0,0,-1,0,-1,buffer,1,2,2,0,3,1,buffer,0.2,0.2,0,0.8,0.2,-0.4,0.2,0.4,-0.4,buffer,1.666666667,1.333333333,0.133333333,0.2,0.066666667,buffer,1,1,1,0,0,0,0.4,0.6,0.6,0.8,0.4,0.4,0.2,0.4,0.6,0,0.2,0.8,0.4,0.6,0.2,0.2,0.2,0.6,buffer,C_Ug,1.101061858,0.545706526,0.14245253,0.146527512,0.483937106 +66,R_5nNIGXYxFlgHVtL,67 - 73,Canadian,Female,Female,University - Graduate (Masters),72,01PfPsV,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,3,2,-1,-3,3,-1,-3,2,-3,2,0,0,2,-1,1,3,2,0,-3,3,0,-3,2,-3,2,0,0,2,-1,1,3,2,-1,-3,3,-1,-3,2,-3,2,0,0,2,-1,1,3,2,-2,-3,2,0,-3,2,-3,2,0,0,3,-1,1,3,2,-1,-3,2,-1,-3,2,-3,2,0,0,2,-1,1,3,2,2,2,2,2,3,3,2,2,2,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,buffer,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,buffer,0,-1,0,0,0,0,buffer,-0.2,0,-0.2,-0.2,0,0,0,0,-0.2,buffer,-0.333333333,0,-0.133333333,-0.066666667,-0.066666667,buffer,1,0,0,1,1,0,0.2,0.2,0,0,0,0,0.4,0.2,0.2,0.2,0,0,0.2,0.2,0,0.2,0.2,0.2,buffer,grad_prof,-0.271289667,-0.158849227,-0.434734729,-0.361192264,-0.306516472 +67,R_66hGIGe1BIkkXFL,32 - 38,Canadian,Female,Female,University - Undergraduate,38,03VPfPs,02FUT,5,01ITEM,-0.125,0,1,2,2,2,-2,-1,-1,2,2,2,-1,1,1,1,1,1,2,2,2,-2,-2,-2,2,2,2,1,1,1,1,1,1,2,2,2,-2,-2,-1,2,2,2,1,1,1,1,1,1,2,2,2,-1,-1,-1,2,2,2,1,1,1,2,1,1,2,2,2,-2,-1,-1,1,1,2,1,1,1,2,1,1,2,2,2,3,3,2,2,2,2,2,2,2,0,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,1,1,0,2,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,buffer,0,0,0,-1,1,1,0,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,-1,-1,0,0,0,0,-1,0,0,0,0,0,-1,0,1,-1,-1,0,0,0,0,0,0,0,buffer,0,0,0,1,1,0,buffer,0,0.2,-0.2,0.2,-0.4,-0.2,-0.2,-0.2,0,buffer,0,0.666666667,0,-0.133333333,-0.133333333,buffer,1,1,0,0,0,0,0.2,0.6,0,0.2,0.4,0,0.2,0.4,0.2,0,0.8,0.2,0,0.2,0,0.2,0.4,0,buffer,C_Ug,-0.042564413,0.19342865,-0.1461411,-0.488122207,-0.120849767 +68,R_710tZm0P99iy1aj,39 - 45,Canadian,Male,Male,College Diploma/Certificate,45,03VPfPs,01PAST,10,02DGEN,1.125,0,0.333333333,3,2,1,2,1,3,3,1,3,1,2,3,2,2,3,0,0,3,0,1,3,2,2,1,0,0,0,0,2,1,3,3,2,3,2,2,2,1,3,3,3,3,0,2,2,2,2,3,3,1,1,1,2,2,0,2,2,2,2,3,2,2,1,3,2,0,1,2,0,1,2,3,1,1,2,8,8,8,9,7,8,7,6,7,7,8,7,3,2,2,2,0,0,1,1,2,1,2,3,2,0,2,0,1,1,1,1,1,1,0,0,2,1,0,2,0,1,1,0,2,1,0,2,2,1,1,1,0,1,0,0,0,1,0,0,1,1,3,2,1,3,0,0,0,1,1,1,3,3,1,3,1,1,0,1,2,3,3,3,0,0,1,0,0,2,0,1,1,0,0,2,1,0,1,1,1,1,buffer,2,2,0,1,0,-2,-1,0,1,0,2,2,2,0,2,-1,1,1,0,0,-2,-1,-1,-3,2,1,0,1,-1,0,3,3,-1,3,0,0,0,1,0,2,3,2,-1,-1,0,buffer,1,2,1,2,-1,1,buffer,1,-0.4,1.6,0.2,-1,0.2,1.6,0.6,0.6,buffer,1.333333333,0.666666667,0.733333333,-0.2,0.933333333,buffer,1,1,0,0,2,0,1.8,1,1.8,0.8,0.8,0.8,0.8,1.4,0.2,0.6,1.8,0.6,2.2,1.4,1.4,0.6,0.8,0.8,buffer,C_Ug,0.872336603,0.19342865,1.441123867,-0.615052151,0.472959242 +69,R_3MDTqWL1rduC3Z9,60 - 66,Canadian,Male,Male,Trade School (non-military),65,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,-3,3,3,-2,2,2,-3,3,-3,1,2,2,3,1,2,-3,2,2,-2,2,3,-3,3,-3,2,2,2,2,1,2,-2,2,2,-2,3,3,-3,2,-3,2,2,2,2,1,2,-3,2,2,-2,1,2,-3,3,-3,-2,2,2,3,-1,2,-3,2,2,-2,-1,2,-3,2,-3,1,2,2,2,-1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,1,1,0,1,0,0,0,0,3,0,0,0,2,0,0,1,1,0,3,0,0,1,0,0,0,0,1,2,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,3,0,0,1,0,0,buffer,0,0,0,0,-1,1,0,0,0,-2,0,0,1,-2,0,1,0,0,0,-2,1,0,0,0,1,0,0,0,-2,0,1,0,0,0,-1,0,0,0,0,-3,0,0,-1,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,-0.2,-0.2,-0.2,0.4,-0.4,0,-0.6,-0.2,buffer,0,0,-0.2,-0.066666667,-0.266666667,buffer,0,0,0,0,0,0,0.4,0.4,0.2,0.8,0.6,0.2,0.6,0.6,0.4,1,0.2,0.6,0.4,0.2,0,0.4,0.8,0.2,buffer,HS_TS,-0.042564413,-0.158849227,-0.579031545,-0.361192264,-0.285409362 +70,R_5ZQEKXDbhs4GA3k,67 - 73,Canadian,Male,Male,Trade School (non-military),72,02PsVPf,01PAST,10,02DGEN,0,0,1,1,1,3,-1,2,3,-3,2,-2,2,3,1,3,1,3,1,1,2,-2,2,3,-3,3,-3,1,3,1,1,1,3,2,1,2,-3,2,3,-3,3,-2,1,3,2,2,3,3,1,2,3,0,0,2,-2,2,-2,1,3,1,1,0,3,1,1,2,0,0,2,-1,0,-1,0,3,0,2,0,3,5,5,5,5,5,5,5,5,5,6,5,7,0,0,1,1,0,0,0,1,1,1,0,0,2,0,0,1,0,1,2,0,0,0,1,0,1,0,1,1,2,0,0,1,0,1,2,1,1,0,0,1,0,0,2,1,0,0,0,1,1,2,1,2,2,1,2,0,1,1,1,0,1,0,0,1,0,0,0,0,1,0,0,1,1,2,0,0,1,1,0,0,0,1,2,1,1,0,1,1,0,0,buffer,0,-1,1,0,-2,-1,-1,1,1,0,0,0,0,-1,0,1,0,0,1,-2,-1,-2,-1,-1,-1,0,0,0,1,0,1,-1,-1,1,0,0,-1,-2,0,-1,0,0,0,2,0,buffer,0,0,0,-1,0,-2,buffer,-0.4,0,-0.2,0,-1.2,0.2,0,-0.8,0.4,buffer,0,-1,-0.2,-0.333333333,-0.133333333,buffer,0,0,0,1,0,2,0.4,0.6,0.4,0.8,0.4,0.8,0.8,0.6,0.6,0.8,1.6,0.6,0.4,0.2,0.8,0.4,1,0.4,buffer,HS_TS,-0.042564413,-0.687266041,-0.579031545,-0.868912038,-0.544443509 +71,R_5HSsu68tAVKiXWN,53 - 59,Canadian,Male,Male,University - Undergraduate,55,03VPfPs,01PAST,5,02DGEN,0.375,0.666666667,0.333333333,-2,2,3,3,-2,-2,2,2,3,-1,2,-2,3,-1,2,-1,3,3,2,-2,-3,3,1,3,1,1,-3,2,1,2,0,1,2,1,-2,0,2,1,2,1,1,-2,2,1,2,0,2,2,3,0,1,1,2,1,2,3,-1,3,1,2,0,1,2,3,0,2,0,2,0,2,3,1,3,2,2,2,2,3,3,3,3,2,2,3,3,3,3,1,1,0,1,0,1,1,1,0,2,1,1,1,2,0,2,1,1,2,0,2,0,1,1,2,1,0,1,2,0,2,0,1,0,2,3,1,0,2,3,1,1,0,2,0,2,1,1,0,2,4,2,0,3,3,1,3,0,3,0,1,2,1,1,0,3,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,2,0,1,0,buffer,-1,1,-1,1,-2,-2,0,1,-2,-1,0,0,1,0,0,0,0,0,2,-2,-2,-2,1,-2,-1,0,-3,1,-1,0,1,1,1,1,0,2,0,0,0,0,0,-1,0,-1,0,buffer,0,0,0,0,0,0,buffer,-0.4,-0.8,0.2,0,-1.2,-0.6,0.8,0.4,-0.4,buffer,0,0,-0.333333333,-0.6,0.266666667,buffer,1,1,0,1,1,0,0.6,1,1,1.2,1.2,0.8,1,1.8,0.8,1.2,2.4,1.4,1,1,0.2,0.2,0.6,0.6,buffer,C_Ug,-0.042564413,-0.158849227,-0.867625175,-1.376631814,-0.611417657 +72,R_1HS2ohbQHYfy7o6,67 - 73,Canadian,Female,Female,College Diploma/Certificate,72,01PfPsV,02FUT,5,02DGEN,-0.25,0,1,3,2,2,1,2,0,-3,2,-2,0,0,1,2,0,0,3,3,3,1,3,0,-3,2,-3,0,0,1,0,-3,0,3,3,3,1,2,0,-3,2,-3,0,0,1,0,0,0,3,3,3,2,2,0,-3,0,-3,0,0,2,0,-3,0,2,2,3,3,0,0,-3,0,0,0,0,0,0,-3,0,5,1,1,2,2,2,1,1,5,5,5,5,0,1,1,0,1,0,0,0,1,0,0,0,2,3,0,0,1,1,0,0,0,0,0,1,0,0,0,2,0,0,0,1,1,1,0,0,0,2,1,0,0,1,2,3,0,1,0,1,2,2,0,0,2,2,0,0,1,2,3,0,0,0,0,0,1,0,0,0,0,0,0,0,0,3,0,1,1,0,1,2,0,0,0,3,0,0,2,0,0,0,buffer,0,0,0,-1,1,0,0,-2,0,0,0,-1,0,0,0,-1,1,0,-2,-2,0,0,-2,-1,0,0,-1,0,-3,0,-1,-1,0,-1,-1,0,0,0,-3,0,0,-2,0,3,0,buffer,4,0,-4,-3,-3,-3,buffer,0,-0.4,-0.2,-0.8,-0.6,-0.8,-0.8,-0.6,0.2,buffer,0,-3,-0.2,-0.733333333,-0.4,buffer,3,1,1,4,4,0,0.6,0.2,1,0.4,0.2,0.4,0.6,0.6,1.2,1.2,0.8,1.2,0.2,0,0.6,1,0.6,0.4,buffer,C_Ug,-0.042564413,-1.744099671,-0.579031545,-1.630491701,-0.999046833 +73,R_6bVkNb48YbCZPws,39 - 45,Canadian,Male,Male,University - Undergraduate,45,01PfPsV,02FUT,5,02DGEN,0.5,0,1,2,3,1,2,3,-2,-1,1,1,0,0,1,1,-1,1,0,0,2,0,3,0,0,0,1,-1,1,2,0,1,1,1,2,2,1,3,-1,0,2,1,-1,0,-1,-1,-1,0,2,3,1,0,3,-1,-3,1,1,1,0,1,2,-1,1,2,3,1,2,3,-1,-1,-2,2,0,0,1,0,-2,0,3,4,4,6,6,6,4,6,5,5,5,3,2,3,1,2,0,2,1,1,0,1,1,1,1,2,0,1,1,1,1,0,1,1,1,0,1,0,2,2,0,1,0,0,0,2,0,1,2,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,3,1,0,0,0,1,1,1,1,2,0,1,0,1,0,2,0,0,1,3,1,2,1,0,0,0,2,0,0,2,3,1,1,0,0,2,1,1,buffer,2,3,1,0,0,1,-1,1,0,0,1,1,0,2,0,1,1,1,1,0,0,1,-2,-1,1,0,2,1,-1,0,1,2,0,-1,0,1,-2,-1,-1,-1,1,3,-1,1,0,buffer,-1,-2,-1,1,1,3,buffer,1.2,0.2,0.8,0.8,-0.2,0.4,0.4,-0.8,0.8,buffer,-1.333333333,1.666666667,0.733333333,0.333333333,0.133333333,buffer,3,2,2,1,1,2,1.6,1,1,0.8,0.8,1,0.4,0.8,0.2,0,1,0.6,0.8,0.6,1.6,0.4,1.4,0.8,buffer,C_Ug,-0.95746543,0.721845465,1.441123867,0.400387399,0.401472825 +74,R_3uyZAa5KYYe7wna,46 - 52,Canadian,Male,Male,Trade School (non-military),48,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,-2,2,2,1,2,0,0,1,1,0,-2,3,2,0,2,0,1,1,1,2,0,0,-1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,5,6,5,5,5,7,5,7,8,6,6,6,2,1,1,0,0,0,0,2,1,0,2,3,2,0,2,2,2,2,1,2,0,0,1,1,0,2,3,2,0,2,2,2,2,1,2,0,0,1,1,0,3,2,1,1,1,2,2,2,1,0,0,0,1,1,0,2,3,2,0,2,0,1,1,1,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,1,1,1,1,buffer,0,-1,-1,-1,-2,0,0,1,0,0,-1,1,1,-1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,2,0,-1,-1,-1,-1,-1,buffer,0,-1,-3,-1,-1,1,buffer,-1,0.2,0.2,0.4,0,0,0.6,0.6,-1,buffer,-1.333333333,-0.333333333,-0.2,0.133333333,0.066666667,buffer,0,1,2,1,1,2,0.8,0.6,1.8,1.8,0.4,1.8,1.8,0.4,1.6,1.4,0.4,1.8,1,0.6,0,0.4,0,1,buffer,HS_TS,-0.95746543,-0.334988165,-0.579031545,0.019597567,-0.462971893 +75,R_1QAc22IlPnNyRse,39 - 45,Canadian,Female,Female,High School (or equivalent),41,03VPfPs,01PAST,10,01ITEM,0,0.333333333,0.666666667,1,1,0,3,-1,-2,0,1,2,1,3,2,3,-3,3,0,1,3,0,-2,-3,0,-2,3,-3,3,2,2,-3,3,3,3,3,1,2,1,0,1,2,1,2,1,2,-3,3,0,0,0,2,0,0,0,0,2,1,3,2,3,-3,3,0,0,0,0,0,0,-1,1,2,2,3,1,3,-3,3,1,8,0,5,1,0,5,4,5,5,5,1,1,0,3,3,1,1,0,3,1,4,0,0,1,0,0,2,2,3,2,3,3,0,0,0,0,1,1,1,0,0,1,1,0,1,1,2,0,1,0,0,0,0,0,0,0,1,1,0,3,1,2,1,0,0,1,0,1,0,0,0,3,2,0,1,4,4,0,3,1,4,1,1,0,0,0,0,0,0,2,0,0,1,1,0,1,0,1,0,0,0,buffer,0,-1,3,2,0,-1,0,2,1,4,0,0,1,0,0,1,1,3,-1,2,1,-1,0,0,-1,1,0,1,0,0,3,2,0,-1,4,4,-1,2,1,3,1,0,0,0,0,buffer,-4,4,-5,0,-4,-1,buffer,0.8,1.2,0.2,1.2,-0.2,0.4,1.6,1.8,0.2,buffer,-1.666666667,-1.666666667,0.733333333,0.466666667,1.2,buffer,4,7,0,0,1,4,1.6,1.8,0.2,2.4,0.6,0.6,0.8,0.6,0,1.2,0.8,0.2,2,2.4,0.4,0.4,0.6,0.2,buffer,HS_TS,-1.186190685,-1.039543918,1.441123867,0.654247288,-0.032590862 +76,R_11FTFBt6zepQQIF,53 - 59,Canadian,Female,Female,University - Undergraduate,58,01PfPsV,02FUT,5,01ITEM,0.75,0,1,0,2,3,1,2,2,-3,3,1,1,3,2,2,0,3,1,3,3,2,2,3,-1,3,2,3,3,3,3,1,3,1,3,2,1,2,3,-1,3,1,2,3,3,3,2,3,0,2,3,2,2,1,-2,1,1,0,3,2,2,0,2,0,2,3,2,2,1,-2,1,1,0,3,2,2,0,2,6,6,3,5,6,2,2,3,3,4,5,3,1,1,0,1,0,1,2,0,1,2,0,1,1,1,0,1,1,1,0,0,1,2,0,0,1,0,1,1,2,0,0,0,0,1,0,1,1,2,0,1,0,0,0,0,1,0,0,0,1,0,1,1,2,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,1,1,0,0,0,0,1,-2,1,1,0,1,1,1,-1,1,1,1,-1,0,0,1,-2,0,0,0,1,1,2,-1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,buffer,4,3,0,1,1,-1,buffer,0.4,0.2,0.4,0.4,-0.2,0.6,0.4,0.4,0.2,buffer,2.333333333,0.333333333,0.333333333,0.266666667,0.333333333,buffer,1,0,1,2,2,0,0.6,1.2,0.6,0.6,0.8,0.8,0.2,1,0.2,0.2,1,0.2,0.4,0.4,0.2,0,0,0,buffer,C_Ug,1.558512366,0.017289712,0.575342976,0.273457456,0.606150627 +77,R_3MFPx3kdqR4ypoB,67 - 73,Canadian,Male,Male,University - Undergraduate,68,02PsVPf,01PAST,10,02DGEN,-0.375,0.333333333,0.333333333,-3,0,2,-2,2,-2,-1,2,-2,-1,2,3,3,-1,-1,-3,0,2,-3,2,-3,0,2,-1,-2,2,3,3,0,-2,-3,0,2,-2,3,-2,1,1,1,-1,2,3,3,0,-1,-3,0,2,-2,2,-2,-2,2,-2,-2,2,3,3,0,-2,-3,0,2,-2,2,-2,-2,2,-2,-2,2,3,3,0,-2,3,5,4,3,8,2,1,2,1,1,1,2,0,0,0,1,0,1,1,0,1,1,0,0,0,1,1,0,0,0,0,1,0,2,1,3,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,3,-1,0,0,0,0,-1,0,0,0,1,1,1,1,1,2,1,0,0,0,0,1,buffer,2,3,3,2,7,0,buffer,0.2,0.4,0,0.2,0.8,-0.2,0.4,1.2,0.2,buffer,2.666666667,3,0.2,0.266666667,0.6,buffer,0,3,2,0,1,1,0.2,0.8,0.4,0.2,1.2,0.2,0,0.4,0.4,0,0.4,0.4,0.4,1.2,0.2,0,0,0,buffer,C_Ug,1.78723762,1.426401218,0.286749346,0.273457456,0.94346141 +78,R_5aOV0H9YEdzgt0d,53 - 59,Canadian,Female,Female,University - Undergraduate,54,03VPfPs,01PAST,10,01ITEM,0.25,0,1,2,2,2,0,3,1,-2,1,-1,2,1,-1,2,0,2,2,2,1,-1,2,2,-1,2,-2,1,2,-1,2,0,2,1,1,1,-1,2,2,-2,2,-1,2,2,-1,0,0,2,1,1,1,0,1,1,-2,0,-2,2,1,0,1,-1,2,2,2,1,1,2,0,-2,0,-1,0,1,0,2,2,2,1,1,1,1,1,1,2,2,2,4,4,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,1,0,0,1,0,2,0,0,1,1,1,0,2,0,0,1,1,0,0,1,1,1,0,0,0,1,1,1,1,0,1,0,2,0,1,0,2,0,1,1,0,0,0,0,1,0,1,1,0,0,2,0,0,1,1,0,1,1,1,0,0,1,2,0,0,1,3,0,buffer,-1,-1,0,1,-1,1,1,0,0,1,1,-1,-1,-1,0,1,1,0,0,0,0,0,0,0,-2,1,-1,2,-2,0,0,0,0,-1,-1,-1,1,0,0,-1,0,0,1,-3,0,buffer,-1,-1,-1,-3,-3,1,buffer,-0.4,0.6,-0.4,0.4,-0.4,0,-0.4,-0.2,-0.4,buffer,-1,-1.666666667,-0.066666667,0,-0.333333333,buffer,0,0,0,2,2,2,0.6,1,0.2,1,0.4,0.6,1,0.4,0.6,0.6,0.8,0.6,0.4,0.6,0.4,0.8,0.8,0.8,buffer,C_Ug,-0.728740176,-1.039543918,-0.290437916,-0.23426232,-0.573246082 +79,R_6Sb39w9yGO8b2tr,39 - 45,Canadian,Male,Male,High School (or equivalent),41,02PsVPf,02FUT,5,02DGEN,0.25,0,1,0,2,1,1,1,-2,1,0,-2,1,0,0,1,0,0,1,2,1,1,0,0,1,0,0,0,0,0,1,0,0,0,2,2,0,0,0,1,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0,0,0,0,0,0,1,0,0,0,2,1,1,1,-1,0,0,0,0,0,0,1,0,0,4,5,5,6,5,5,5,6,5,3,5,5,1,0,0,0,1,2,0,0,2,1,0,0,0,0,0,0,0,1,1,1,2,0,0,2,1,0,0,0,0,0,0,0,1,0,1,2,1,0,2,1,0,0,0,0,0,0,0,0,0,0,1,1,0,2,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,buffer,1,0,-1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,-1,0,0,0,0,0,0,0,0,1,0,0,1,-1,-1,0,0,0,0,0,0,0,0,0,buffer,-1,-1,0,3,0,0,buffer,0,-0.2,0,0.6,0,0,0.2,-0.2,0,buffer,-0.666666667,1,-0.066666667,0.2,0,buffer,2,0,0,2,1,0,0.4,1,0,0.6,1,0,0.4,1.2,0,0,1,0,0.6,0,0,0.4,0.2,0,buffer,HS_TS,-0.500014922,0.369567588,-0.290437916,0.146527512,-0.068589434 +80,R_5rvjBhurZlcbMCl,60 - 66,Canadian,Female,Female,College Diploma/Certificate,65,01PfPsV,02FUT,5,01ITEM,-0.125,0.333333333,0.666666667,-1,2,2,0,1,-2,-1,2,-2,1,1,-3,3,-2,2,1,2,2,1,0,-2,-2,2,-2,2,1,-2,2,-3,2,1,2,2,1,1,-2,-2,2,-2,2,1,-2,2,-3,3,1,2,2,0,2,-2,-2,2,-2,2,1,-2,2,-3,2,1,2,2,0,1,-2,-2,2,-2,1,1,-2,3,-3,3,2,1,1,2,1,1,4,1,1,1,1,1,2,0,0,1,1,0,1,0,0,1,0,1,1,1,0,2,0,0,1,0,0,1,0,0,1,0,1,1,1,1,2,0,0,0,1,0,1,0,0,1,0,1,1,1,0,2,0,0,0,0,0,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,buffer,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,buffer,-2,0,0,1,0,0,buffer,0.2,0,0,0.2,0.2,0.2,0,-0.2,-0.2,buffer,-0.666666667,0.333333333,0.066666667,0.2,-0.133333333,buffer,0,0,0,3,0,0,0.8,0.4,0.6,0.6,0.4,0.8,0.6,0.4,0.6,0.4,0.2,0.6,0.2,0,0.2,0.2,0.2,0.4,buffer,C_Ug,-0.500014922,0.017289712,-0.001844284,0.146527512,-0.084510496 +81,R_3D6LmFgArFfRzSD,67 - 73,Canadian,Male,Male,University - Graduate (Masters),67,03VPfPs,01PAST,10,02DGEN,0.5,0,1,3,3,2,-3,0,2,-2,3,-2,0,2,1,2,0,3,3,3,2,-3,0,2,-3,3,-3,2,3,2,2,0,3,3,3,2,-3,2,2,-3,3,-3,0,3,2,2,2,3,3,3,2,-3,1,1,-3,3,-3,1,3,2,2,0,3,3,3,2,-3,0,1,-3,3,-3,0,3,2,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,2,1,1,0,0,0,0,0,0,0,2,0,1,0,1,0,1,1,0,2,0,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,-1,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,-1,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,1,0,0,0,2,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0,0.4,-0.2,0.4,0.2,0.2,0.4,buffer,0,0,-0.066666667,0.2,0.266666667,buffer,0,0,0,0,0,0,0,0.8,0.4,0.4,0.4,0.8,0.2,0.8,0.4,0,0.6,0.4,0.4,0.4,0.4,0.2,0.2,0,buffer,grad_prof,-0.042564413,-0.158849227,-0.290437916,0.146527512,-0.086331011 +82,R_7lXoOL9NeElQKtz,39 - 45,Canadian,Male,Male,University - Graduate (Masters),43,03VPfPs,02FUT,10,02DGEN,0.375,1,0,2,3,3,3,3,1,-3,3,-2,2,3,3,3,3,3,0,3,3,3,3,3,-2,3,-1,3,3,3,3,3,2,0,3,3,3,3,3,-3,3,-1,3,3,2,3,3,3,2,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,2,2,0,0,0,0,2,1,0,1,1,0,0,0,0,1,2,0,0,0,0,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,1,0,0,0,0,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,buffer,0,0,0,0,0,-1,buffer,0.4,0.2,0.2,0.2,0,0.2,-0.2,0.2,0.4,buffer,0,-0.333333333,0.266666667,0.133333333,0.133333333,buffer,0,0,0,0,0,1,0.4,1,0.2,0.4,0.8,0.2,0,0.8,0,0.2,0.8,0,0,0.2,0.4,0.2,0,0,buffer,grad_prof,-0.042564413,-0.334988165,0.431046162,0.019597567,0.018272788 +83,R_5mMnxA0qm1YoyQh,60 - 66,Canadian,Male,Male,High School (or equivalent),65,01PfPsV,01PAST,5,01ITEM,0.375,0,1,-3,1,3,3,-3,1,-1,3,-1,-3,3,1,1,-1,2,-3,2,3,3,-3,2,-2,3,-3,0,3,1,1,-2,1,-3,2,2,2,-3,2,-2,2,-2,-2,2,2,2,-2,2,-3,2,3,2,-3,2,-2,2,-2,2,3,2,2,-2,2,-3,2,2,2,-3,2,-2,2,-2,2,3,2,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,2,3,0,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,0,1,0,1,0,1,1,1,1,5,0,1,1,1,0,0,1,1,1,0,1,1,1,1,5,0,1,1,1,0,0,0,1,1,0,0,0,1,1,2,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,-1,1,-2,0,-1,-1,0,1,0,0,0,0,0,0,0,0,0,-4,1,0,0,0,0,0,0,0,1,0,0,0,1,1,2,1,1,1,0,1,buffer,0,0,0,0,0,0,buffer,-0.2,-0.4,-0.2,0,-0.8,0.2,0.2,0.8,0.8,buffer,0,0,-0.266666667,-0.2,0.6,buffer,0,0,0,0,0,0,0.2,1.4,0.4,0.6,1,0.8,0.4,1.8,0.6,0.6,1.8,0.6,0.4,0.8,0.8,0.2,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.723328361,-0.615052151,-0.384948538 +84,R_5UcqKFTRjoYaLZq,39 - 45,Canadian,Female,Female,College Diploma/Certificate,40,02PsVPf,02FUT,5,01ITEM,0.5,0,0.666666667,2,2,2,2,2,-1,-1,0,-1,2,2,2,2,2,2,2,2,2,2,2,2,2,0,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,-1,2,0,2,2,2,2,2,2,2,2,2,2,2,2,-1,2,-1,2,0,2,2,2,0,9,8,9,8,9,9,8,9,8,9,9,9,0,0,0,0,0,3,3,0,1,0,0,0,0,0,0,0,0,0,0,0,3,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,0,2,4,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,2,0,0,0,2,buffer,0,0,0,0,0,3,3,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,3,0,-2,0,0,0,-2,0,0,0,0,0,-3,0,2,3,0,-2,0,0,0,-2,buffer,1,-1,1,-1,0,0,buffer,0,0.8,0,0,1.2,-0.8,0,0.4,-0.8,buffer,0.333333333,-0.333333333,0.266666667,0.133333333,-0.133333333,buffer,1,1,0,1,0,1,0,1.4,0,0,2.2,0,0,0.6,0,0,1,0.8,0,1.2,0,0,0.8,0.8,buffer,C_Ug,0.186160841,-0.334988165,0.431046162,0.019597567,0.075454101 +85,R_3X4mhvm0v0rxhKp,60 - 66,Canadian,Female,Female,Trade School (non-military),64,03VPfPs,01PAST,10,02DGEN,-0.375,0,1,2,2,3,1,2,-1,-2,1,2,1,1,2,2,-3,1,2,2,2,1,2,-2,-1,1,1,0,1,2,2,-2,1,2,2,2,1,2,-2,0,1,1,0,1,2,2,-2,1,2,2,2,2,1,1,0,1,1,0,1,2,2,-1,1,2,2,2,2,1,-2,0,1,2,0,1,2,2,-2,1,2,2,2,1,2,2,2,2,3,2,3,2,0,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,0,0,1,2,0,1,1,0,0,0,1,0,0,0,1,1,1,2,2,0,1,1,0,0,0,2,0,0,0,1,1,1,1,2,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,1,0,buffer,0,0,0,-1,-1,-1,-1,0,0,0,0,0,0,-1,0,0,0,0,-1,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-3,1,0,-1,0,0,0,0,-1,0,buffer,0,0,-1,-1,-1,0,buffer,-0.4,-0.4,-0.2,-0.4,0.2,0,0,-0.6,-0.2,buffer,-0.333333333,-0.666666667,-0.333333333,-0.066666667,-0.266666667,buffer,1,0,0,0,1,1,0.2,0.8,0.2,0.2,1,0.2,0.6,1.2,0.4,0.6,0.8,0.2,0,0.2,0,0,0.8,0.2,buffer,HS_TS,-0.271289667,-0.511127103,-0.867625175,-0.361192264,-0.502808552 +86,R_6IAzGCzsa3PoCCG,67 - 73,Canadian,Male,Male,University - Undergraduate,71,01PfPsV,01PAST,10,02DGEN,0.375,0,0.666666667,-1,3,3,-3,2,3,-3,3,-3,3,3,3,3,3,3,-1,3,3,-1,2,3,-3,3,-3,3,3,3,3,3,3,-1,3,3,-1,2,3,-3,3,-3,3,3,3,3,3,3,0,3,3,0,0,3,0,3,0,3,3,3,3,3,3,-1,3,3,-1,-1,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,3,2,0,3,0,3,0,0,0,0,0,0,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,3,0,3,0,0,0,0,0,0,buffer,-1,0,0,-1,-2,0,-3,0,-3,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,-1,0,-3,0,-3,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.8,-1.2,0,-0.6,0,0,-0.6,-1.2,0,buffer,0,0,-0.666666667,-0.2,-0.6,buffer,0,0,0,0,0,0,0.4,0,0,0.4,0,0,1.2,1.2,0,1,0,0,0,0,0,0.6,1.2,0,buffer,C_Ug,-0.042564413,-0.158849227,-1.589109252,-0.615052151,-0.601393761 +87,R_5cSs5A3Faexro8h,53 - 59,Canadian,Female,Female,University - Undergraduate,56,03VPfPs,02FUT,10,01ITEM,-0.75,0,1,-1,2,3,-2,0,1,-1,2,1,2,0,0,2,-2,2,-2,2,2,-2,0,1,0,2,2,0,0,0,2,-3,-1,-1,2,2,-2,0,0,1,2,2,0,1,0,2,-3,0,0,2,2,-2,2,0,-1,2,0,2,0,0,2,-3,0,0,2,2,0,2,0,-1,2,-1,2,0,2,2,-3,2,4,5,4,3,5,4,4,4,2,5,4,2,1,0,1,0,0,0,1,0,1,2,0,0,0,1,3,0,0,1,0,0,1,2,0,1,2,1,0,0,1,2,1,0,1,0,2,1,0,0,1,0,0,0,0,1,2,1,0,1,2,2,1,0,0,2,0,0,2,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,1,0,0,2,0,0,2,buffer,0,0,0,0,-2,-1,1,0,0,2,0,0,0,0,1,-1,0,0,-2,-2,0,2,0,-1,2,1,-2,0,0,2,1,0,0,-2,0,1,1,0,-1,0,1,-2,0,0,-1,buffer,0,1,2,-2,1,2,buffer,-0.4,0.4,0.2,-1,0.6,0.2,-0.2,0.2,-0.4,buffer,1,0.333333333,0.066666667,-0.066666667,-0.133333333,buffer,1,0,0,1,0,0,0.4,0.8,0.8,0.2,1.2,0.8,0.8,0.4,0.6,1.2,0.6,0.6,0.2,0.4,0.4,0.4,0.2,0.8,buffer,C_Ug,0.643611349,0.017289712,-0.001844284,-0.361192264,0.074466128 +88,R_60xql6imXyVUikx,67 - 73,Canadian,Female,Female,High School (or equivalent),69,01PfPsV,02FUT,5,02DGEN,0.375,0,0.666666667,2,2,3,3,2,-3,1,1,3,-1,3,3,3,0,3,3,3,3,3,1,-3,0,2,0,0,3,3,3,-1,3,2,3,2,0,3,1,-3,3,-3,3,3,3,3,0,3,2,3,2,3,1,0,0,1,0,-1,3,2,2,-3,3,2,3,3,3,0,-3,0,1,0,1,3,2,3,-3,3,6,7,9,3,4,9,5,7,8,9,5,8,1,1,0,0,1,0,1,1,3,1,0,0,0,1,0,0,1,1,3,1,4,4,2,6,4,0,0,0,0,0,0,1,1,0,1,3,1,0,3,0,0,1,1,3,0,0,1,0,0,2,0,1,0,3,2,0,1,0,3,0,1,0,1,3,2,4,3,1,3,3,0,0,0,1,0,0,0,1,0,1,3,0,0,0,2,0,0,1,0,0,buffer,1,0,-1,0,0,-3,0,1,0,1,0,-1,-1,-2,0,0,0,1,3,-1,4,3,2,3,2,0,-1,0,-3,0,1,0,0,3,1,1,3,1,3,1,0,0,-1,1,0,buffer,1,0,1,-6,-1,1,buffer,0,-0.2,-0.8,0.6,2.8,-0.8,1,1.8,0,buffer,0.666666667,-2,-0.333333333,0.866666667,0.933333333,buffer,3,3,0,4,2,0,0.6,1.2,0.2,1.2,4,0,0.6,1.4,1,0.6,1.2,0.8,1.4,2.8,0.2,0.4,1,0.2,buffer,HS_TS,0.414886095,-1.215682856,-0.867625175,1.415826951,-0.063148746 +89,R_6b2iZyTt1bVtPxv,60 - 66,Canadian,Female,Female,High School (or equivalent),61,02PsVPf,01PAST,10,01ITEM,0.375,0.333333333,0.666666667,3,3,2,2,2,2,-2,3,-1,2,3,0,2,-2,3,2,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,2,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,3,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,3,2,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,2,2,2,3,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,0,buffer,0.2,0,0,0,0,0,-0.2,0,0,buffer,0,0.333333333,0.066666667,0,-0.066666667,buffer,1,0,0,0,0,0,0.2,0.4,0.2,0.2,0.4,0.2,0,0.4,0.2,0.2,0.4,0.2,0,0,0,0.2,0,0,buffer,HS_TS,-0.042564413,0.017289712,-0.001844284,-0.23426232,-0.065345326 +90,R_1ou8VSpmQSa7eI9,53 - 59,Canadian,Male,Male,College Diploma/Certificate,58,02PsVPf,01PAST,5,02DGEN,0.25,0.333333333,0.666666667,3,3,3,3,-1,2,-2,1,-2,3,-1,-1,3,-3,3,3,3,3,3,-1,0,1,0,1,-1,-1,-1,3,-2,3,3,3,3,3,1,2,1,2,1,3,-1,-1,3,-2,3,3,3,3,3,0,0,-2,1,0,0,-2,-1,3,-3,3,3,3,3,3,0,1,-3,2,-1,1,-2,-1,3,-3,3,6,5,3,6,7,8,5,4,3,5,5,3,0,0,0,0,0,2,3,1,3,4,0,0,0,1,0,0,0,0,0,2,0,3,1,3,0,0,0,0,1,0,0,0,0,0,1,2,0,0,2,3,1,0,0,0,0,0,0,0,0,1,1,1,1,1,2,1,0,0,0,0,0,0,0,0,2,2,0,2,0,4,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,buffer,0,0,0,0,-1,0,3,1,1,1,-1,0,0,1,0,0,0,0,0,1,-1,2,0,2,-2,-1,0,0,1,0,0,0,0,0,2,1,-1,1,-1,3,0,0,0,0,0,buffer,1,1,0,1,2,5,buffer,-0.2,1.2,0,0.2,0.2,0,0.4,0.6,0,buffer,0.666666667,2.666666667,0.333333333,0.133333333,0.333333333,buffer,0,2,5,0,1,0,0,2.6,0.2,0.4,1.4,0.2,0.2,1.4,0.2,0.2,1.2,0.2,0.4,1.6,0,0,1,0,buffer,C_Ug,0.414886095,1.25026228,0.575342976,0.019597567,0.565022229 +91,R_7qwBlahEjkF7Cmd,18 - 24,Canadian,Female,Female,High School (or equivalent),24,01PfPsV,02FUT,5,02DGEN,0,0,1,-1,2,0,3,-3,-3,0,1,1,0,0,0,0,0,0,-1,3,3,3,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,2,3,3,-3,-3,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,1,3,0,0,3,0,1,1,0,0,0,0,0,0,1,2,0,3,3,3,0,1,1,0,0,0,0,0,0,1,1,3,0,2,3,0,1,1,0,0,0,0,0,0,1,0,3,0,0,0,0,1,1,0,0,0,0,0,0,1,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,3,0,0,0,0,0,0,0,0,0,buffer,-1,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,2,-3,3,3,3,0,0,0,0,0,0,0,0,0,1,2,3,3,1,-3,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.6,0,0,1,0.6,0,2,-0.6,0,buffer,0,0,-0.2,0.533333333,0.466666667,buffer,0,0,0,0,0,0,0.8,1,0,1.8,1,0,1.4,1,0,0.8,0.4,0,2.6,0,0,0.6,0.6,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.579031545,0.78117723,0.000183011 +92,R_7e1PRGSYfQHV8jE,39 - 45,Canadian,Male,Male,University - Graduate (Masters),43,03VPfPs,01PAST,10,01ITEM,0.125,0,0.666666667,0,1,0,1,0,0,0,1,-1,2,0,2,0,1,1,0,1,-1,0,2,3,1,3,2,2,-1,3,-2,0,-1,0,3,0,1,-2,0,0,-2,0,-1,-1,0,-1,-1,3,1,0,0,0,0,0,-1,3,0,-1,0,0,-2,1,0,0,-1,1,0,0,1,-1,-1,-1,0,2,0,-2,-1,-1,8,7,7,6,8,7,8,7,6,6,5,7,0,0,1,1,2,3,1,2,3,0,1,1,2,1,2,0,2,0,0,2,0,0,3,1,3,1,2,1,2,2,1,1,0,1,0,0,1,2,1,3,0,2,2,0,1,0,2,1,1,0,1,1,2,0,2,2,2,2,2,2,0,2,1,1,4,3,1,5,2,3,0,3,1,1,4,1,1,1,0,0,1,0,4,1,1,2,0,0,2,1,buffer,-1,-1,1,0,2,3,0,0,2,-3,1,-1,0,1,1,0,0,-1,-1,2,-1,-1,1,1,1,-1,0,-1,0,0,-1,1,0,1,4,2,1,1,1,2,-2,3,1,-1,3,buffer,0,0,1,0,3,0,buffer,0.2,0.4,0.4,0,0.2,-0.4,1,1.4,0.8,buffer,0.333333333,1,0.333333333,-0.066666667,1.066666667,buffer,2,1,0,2,2,1,0.8,1.8,1.4,0.8,1.4,1.6,0.6,1.4,1,0.8,1.2,2,1.6,2.8,1.8,0.6,1.4,1,buffer,grad_prof,0.186160841,0.369567588,0.575342976,-0.361192264,0.192469785 +93,R_1tnEBgFYQxHMmhO,53 - 59,Canadian,Female,Female,Trade School (non-military),59,02PsVPf,02FUT,10,01ITEM,0.25,0,1,1,0,3,1,3,-2,-1,3,0,-1,2,1,1,1,0,0,0,3,1,3,-1,-1,3,0,-1,2,0,0,2,0,0,0,3,1,3,-1,-1,3,-1,0,3,1,1,1,0,1,0,3,1,3,-1,-1,3,0,0,2,2,1,0,0,1,0,3,0,3,-1,-2,3,0,0,2,2,1,0,0,1,2,2,2,1,2,1,2,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,buffer,1,0,0,0,0,0,0,0,0,-1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,1,0,1,-1,0,-1,0,0,0,0,-1,0,0,-1,0,1,1,1,1,1,1,0,buffer,0,0,1,1,0,1,buffer,0.2,-0.2,0.2,0,0,-0.2,-0.2,0.2,0.8,buffer,0.333333333,0.666666667,0.066666667,-0.066666667,0.266666667,buffer,1,1,0,0,1,0,0.2,0.2,0.6,0.2,0.6,0.2,0,0.4,0.4,0.2,0.6,0.4,0,0.4,0.8,0.2,0.2,0,buffer,HS_TS,0.186160841,0.19342865,-0.001844284,-0.361192264,0.004138236 +94,R_3VCRksFU2bgDkbo,32 - 38,Canadian,Female,Female,College Diploma/Certificate,36,01PfPsV,01PAST,5,02DGEN,0.875,0.333333333,0.666666667,3,2,-3,1,0,0,1,2,2,2,0,0,1,0,1,3,2,-3,2,1,0,2,1,2,2,0,0,2,0,1,3,2,-3,1,1,0,3,0,3,1,0,0,0,0,0,3,3,-3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,4,3,9,9,5,5,5,5,5,5,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,2,2,1,1,0,0,1,0,1,0,1,0,0,1,0,1,2,2,2,0,0,1,0,1,3,2,3,1,0,0,1,2,2,2,0,0,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,2,0,1,3,3,3,1,1,0,0,0,0,0,0,0,0,0,0,buffer,0,-1,0,1,0,0,0,-1,-2,-2,0,0,0,0,-1,-3,-2,-3,-1,1,0,1,0,-1,-1,0,0,0,0,0,-3,-3,-3,0,-1,0,1,1,1,1,0,0,2,0,1,buffer,1,2,-1,-2,4,4,buffer,0,-1,-0.2,-1.6,-0.2,0,-2,0.8,0.6,buffer,0.666666667,2,-0.4,-0.6,-0.2,buffer,3,2,5,0,0,0,0.4,0.4,0.2,0.2,1.2,0.4,0.4,1.4,0.4,1.8,1.4,0.4,0.2,0.8,0.6,2.2,0,0,buffer,C_Ug,0.414886095,0.897984403,-1.011921991,-1.376631814,-0.268920827 +95,R_31Ut9uRDCwBurrX,39 - 45,Canadian,Female,Female,College Diploma/Certificate,42,03VPfPs,01PAST,5,01ITEM,-0.125,0,1,2,1,3,3,3,-3,-1,2,-1,-2,2,2,2,-2,1,2,2,3,3,2,-3,-2,1,2,-2,2,2,3,-3,-1,3,3,3,3,1,-1,-3,1,-2,2,2,2,2,-2,1,-2,-1,3,3,3,1,-2,3,-2,3,2,2,2,-2,-2,-2,-2,3,3,1,1,-3,2,-2,-1,2,2,2,-3,-2,2,3,2,4,5,3,7,8,6,7,7,8,0,1,0,0,1,0,1,1,3,0,0,0,1,1,2,1,2,0,0,2,2,2,1,1,4,0,0,0,0,0,4,2,0,0,0,4,1,1,1,5,0,0,0,0,3,4,3,0,0,2,4,2,0,1,1,0,0,0,1,3,1,1,0,0,1,2,1,0,4,4,0,0,1,1,2,0,1,0,0,2,0,1,1,0,4,0,0,0,1,0,buffer,-4,-1,0,0,1,-4,0,0,2,-5,0,0,1,1,-1,-3,-1,0,0,0,-2,0,1,0,3,0,0,0,-1,-3,1,0,0,0,-1,2,0,-1,4,0,0,0,1,0,2,buffer,-5,-5,-4,-3,-2,-5,buffer,-0.8,-1.4,0.2,-0.8,0.4,-0.8,0,1,0.6,buffer,-4.666666667,-3.333333333,-0.666666667,-0.4,0.533333333,buffer,2,2,1,0,1,2,0.4,1,0.8,1,2,0,1.2,2.4,0.6,1.8,1.6,0.8,0.6,2.2,0.8,0.6,1.2,0.2,buffer,C_Ug,-3.244717972,-1.920238609,-1.589109252,-0.995841983,-1.937476954 +96,R_50wkiWI4Nvojx78,67 - 73,Canadian,Female,Female,College Diploma/Certificate,67,03VPfPs,02FUT,10,02DGEN,0.375,0,1,3,3,3,1,3,-3,-3,0,0,-2,3,3,2,-2,3,3,3,3,1,3,-3,-3,2,1,0,3,3,3,-2,3,3,3,3,1,3,-3,-3,2,1,0,3,3,3,-2,3,3,3,3,1,3,-3,-3,3,1,0,3,3,3,0,3,3,3,3,2,3,-3,-3,1,1,0,3,3,3,0,3,1,1,1,1,1,1,1,1,1,1,1,5,0,0,0,0,0,0,0,2,1,2,0,0,1,0,0,0,0,0,0,0,0,0,2,1,2,0,0,1,0,0,0,0,0,0,0,0,0,3,1,2,0,0,1,2,0,0,0,0,1,0,0,0,1,1,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,-1,0,0,0,0,0,-2,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,-2,0,0,0,0,-1,0,0,0,-2,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-4,buffer,0,-0.2,-0.4,-0.2,0.2,-0.4,-0.2,-0.4,0,buffer,0,-1.333333333,-0.2,-0.133333333,-0.2,buffer,0,0,0,0,0,4,0,1,0.2,0,1,0.2,0,1.2,0.6,0.2,0.8,0.6,0,0,0,0.2,0.4,0,buffer,C_Ug,-0.042564413,-0.863404979,-0.579031545,-0.488122207,-0.493280786 +97,R_7AdBPV3ZL8M0zjH,53 - 59,Canadian,Female,Female,University - Graduate (Masters),57,01PfPsV,01PAST,10,01ITEM,1.125,0.333333333,0.666666667,2,2,3,2,2,-1,-3,3,1,1,3,3,3,-1,3,3,3,3,1,1,2,-3,3,-1,3,3,3,3,-2,3,3,3,2,2,2,2,-2,3,2,3,3,3,3,0,3,3,3,3,2,3,2,-3,3,-2,3,3,3,3,-2,3,3,3,3,2,3,2,-3,3,-2,3,3,3,3,-2,3,7,7,7,5,5,5,8,7,8,9,9,8,1,1,0,1,1,3,0,0,2,2,0,0,0,1,0,1,1,1,0,0,3,1,0,1,2,0,0,0,1,0,1,1,0,0,1,3,0,0,3,2,0,0,0,1,0,1,1,0,0,1,3,0,0,3,2,0,0,0,1,0,0,0,1,1,1,0,1,0,3,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,1,0,-1,0,1,0,-2,0,0,0,0,0,0,0,0,1,1,1,0,1,0,3,0,0,0,0,2,0,buffer,-1,0,-1,-4,-4,-3,buffer,0.2,-0.2,0,0,-0.2,0,0.6,0.8,0.4,buffer,-0.666666667,-3.666666667,0,-0.066666667,0.6,buffer,2,2,2,1,2,0,0.8,1.4,0.2,0.6,1.4,0.2,0.6,1.6,0.2,0.6,1.6,0.2,0.6,0.8,0.4,0,0,0,buffer,grad_prof,-0.500014922,-2.096377547,-0.1461411,-0.361192264,-0.775931458 +98,R_6MupnsimpiL9sv5,67 - 73,American,Female,Female,College Diploma/Certificate,71,02PsVPf,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,1,2,2,0,0,-1,0,0,0,1,1,0,2,0,2,2,2,2,0,0,0,0,0,0,0,1,0,1,0,3,2,2,2,0,0,1,0,0,0,0,1,0,1,0,3,2,2,2,0,0,-1,0,0,0,0,1,0,1,0,3,2,2,2,0,0,-2,0,0,0,0,1,0,1,0,3,2,1,3,2,1,4,1,0,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,2,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,1,1,2,1,0,3,buffer,0,0.2,0,0,0.2,0,0,0,0,buffer,1.333333333,1.333333333,0.066666667,0.066666667,0,buffer,0,0,1,0,1,0,0.2,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0.4,0.2,0.4,0.4,0,0.2,0,0,0.2,0,buffer,C_Ug,0.872336603,0.545706526,-0.001844284,-0.107332375,0.327216618 +99,R_38IEmEQGL9k2F8J,53 - 59,Canadian,Female,Female,College Diploma/Certificate,58,03VPfPs,02FUT,5,01ITEM,-0.25,0,1,1,1,1,0,3,0,-1,1,1,1,2,2,2,0,1,2,2,2,0,3,0,0,2,0,2,2,2,2,0,2,2,2,2,0,3,0,0,2,0,2,2,2,2,0,2,2,2,2,1,3,0,0,2,0,1,2,2,2,0,2,2,2,2,1,3,0,0,2,0,2,2,2,2,0,2,3,6,4,6,4,4,2,2,1,3,3,3,1,1,1,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,buffer,1,4,3,3,1,1,buffer,-0.2,0.2,0,-0.2,0,0,0,-0.2,0,buffer,2.666666667,1.666666667,0,-0.066666667,-0.066666667,buffer,3,2,0,1,1,2,0.6,0.8,0.2,0.6,0.8,0.2,0.8,0.6,0.2,0.8,0.8,0.2,0,0,0,0,0.2,0,buffer,C_Ug,1.78723762,0.721845465,-0.1461411,-0.361192264,0.50043743 +100,R_1kHpDuYWtSWKU9i,60 - 66,Canadian,Female,Female,High School (or equivalent),61,01PfPsV,01PAST,10,02DGEN,1.125,0,1,-3,1,-3,-2,-1,0,1,1,1,-1,3,3,2,0,2,-3,0,-3,-3,-3,1,0,1,1,0,3,2,2,1,3,-3,3,1,-1,0,1,0,1,0,-1,3,3,2,0,3,-3,1,-3,-3,-3,2,3,3,3,2,3,3,3,3,3,-3,2,-1,-3,-1,2,3,2,2,2,3,3,3,2,3,1,1,1,4,2,2,1,1,1,1,1,1,0,1,0,1,2,1,1,0,0,1,0,1,0,1,1,0,2,4,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,2,2,2,2,2,3,0,0,1,3,1,0,1,2,1,0,2,2,1,1,3,0,0,1,2,1,0,3,4,2,3,0,0,0,1,1,0,1,0,1,0,0,1,2,0,2,0,0,1,1,0,0,0,0,1,0,buffer,0,1,0,0,0,-1,-1,-2,-2,-2,0,1,-1,-2,0,0,1,2,0,1,-1,-1,-1,0,-3,0,0,-1,-2,0,0,2,2,2,1,0,0,-1,0,1,0,1,0,0,0,buffer,0,0,0,3,1,1,buffer,0.2,-1.6,-0.4,0.8,-1.2,-0.6,1.4,0,0.2,buffer,0,1.666666667,-0.6,-0.333333333,0.533333333,buffer,3,1,1,0,0,0,0.8,0.6,0.6,1.6,0.6,0.2,0.6,2.2,1,0.8,1.8,0.8,2.4,0.4,0.4,1,0.4,0.2,buffer,HS_TS,-0.042564413,0.721845465,-1.444812436,-0.868912038,-0.408610856 +101,R_3wS43W1JVNrzX1L,67 - 73,Canadian,Male,Male,College Diploma/Certificate,70,03VPfPs,02FUT,10,02DGEN,0.25,0,0.666666667,2,1,2,1,1,2,2,1,1,1,1,1,2,1,1,1,2,1,1,2,2,-1,2,-1,1,2,1,0,1,1,1,1,2,2,1,1,2,1,-1,1,2,1,1,2,1,1,1,2,2,1,1,1,2,1,2,1,1,2,1,2,1,0,1,1,2,1,1,2,1,2,1,1,0,1,0,6,6,4,5,5,5,5,5,5,5,5,5,1,1,1,0,1,0,3,1,2,0,1,0,2,0,0,1,0,0,1,0,1,0,0,2,0,1,0,1,1,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,0,2,0,1,0,1,1,1,1,1,3,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,2,0,2,buffer,0,1,1,-1,1,-1,2,0,2,-1,1,0,2,0,-1,0,-1,-1,1,-1,0,-1,-1,2,-1,1,0,-1,1,-1,0,0,0,0,0,1,3,1,0,0,0,0,-1,1,-2,buffer,1,1,-1,0,0,0,buffer,0.4,0.4,0.4,-0.4,-0.2,0,0,1,-0.4,buffer,0.333333333,0,0.4,-0.2,0.2,buffer,1,1,1,0,0,0,0.8,1.2,0.6,0.4,0.6,0.6,0.4,0.8,0.2,0.8,0.8,0.6,0.8,1,0.4,0.8,0,0.8,buffer,C_Ug,0.186160841,-0.158849227,0.719639792,-0.615052151,0.032974814 +102,R_714Noev150iyC8S,67 - 73,Canadian,Male,Male,College Diploma/Certificate,67,01PfPsV,01PAST,5,01ITEM,1.5,0,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,-2,3,-3,3,3,-3,3,-3,3,3,-3,3,3,3,3,3,-3,3,-3,3,3,3,-3,-3,3,3,3,-3,3,1,1,3,3,-3,0,3,3,3,0,3,3,3,-3,3,10,0,10,10,0,5,10,5,5,5,5,5,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,5,0,6,0,0,6,0,6,0,0,6,0,0,0,0,0,6,0,6,0,0,0,6,6,0,0,0,6,0,2,2,0,0,6,3,0,0,0,3,0,0,0,6,0,0,5,0,6,0,0,0,0,0,0,0,6,0,0,0,2,2,6,0,0,3,0,0,6,3,0,0,0,0,0,buffer,0,0,-6,0,-6,0,6,0,0,-6,0,0,0,-6,0,-2,3,0,6,-6,-3,6,0,6,-3,0,6,0,-6,0,-2,3,-6,6,0,-3,0,0,-6,-3,0,6,0,0,0,buffer,0,-5,5,5,-5,0,buffer,-2.4,0,-1.2,0.2,1.2,0,0.2,-2.4,1.2,buffer,0,0,-1.2,0.466666667,-0.333333333,buffer,0,0,5,5,0,0,0,2.4,0,2.2,2.4,1.2,2.4,2.4,1.2,2,1.2,1.2,2.2,0,1.2,2,2.4,0,buffer,C_Ug,-0.042564413,-0.158849227,-2.743483773,0.654247288,-0.572662531 +103,R_3ePLhpK1NKfkB2N,60 - 66,Canadian,Male,Male,University - Undergraduate,62,03VPfPs,01PAST,10,01ITEM,0.125,0.666666667,0.333333333,3,3,2,0,0,-3,-2,2,-2,0,0,0,2,0,0,3,3,2,-1,0,-3,-2,2,-3,0,0,0,2,0,1,3,3,2,-1,0,-3,-2,2,-3,0,0,0,2,0,0,3,3,2,-1,1,-3,-2,2,-2,0,1,0,2,-1,0,2,2,2,0,1,-3,-2,2,-2,0,1,0,2,0,0,8,8,8,7,8,7,8,8,8,7,8,8,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,-1,0,0,0,1,0,-1,0,0,-1,1,-1,-1,0,1,-1,0,0,0,1,0,-1,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,0,0,0,-1,1,buffer,0,0,0,0,0,-1,buffer,-0.2,0.2,-0.2,-0.4,0.2,-0.2,-0.6,0,0,buffer,0,-0.333333333,-0.066666667,-0.133333333,-0.2,buffer,1,0,1,1,0,0,0.2,0.2,0.2,0.2,0.2,0,0.4,0,0.4,0.6,0,0.2,0,0,0.2,0.6,0,0.2,buffer,C_Ug,-0.042564413,-0.334988165,-0.290437916,-0.488122207,-0.289028175 +104,R_5gUHoJeCdaBVT7l,46 - 52,Canadian,Female,Female,High School (or equivalent),51,01PfPsV,01PAST,5,01ITEM,0.25,0,1,-1,2,3,3,-1,-3,-2,-1,2,-3,3,-1,-1,-3,3,-1,3,3,3,-2,-3,-1,-1,3,-3,3,-1,-1,-3,3,1,1,2,1,-2,-3,1,-3,3,-3,3,-2,1,1,3,1,1,3,3,1,-2,-3,1,1,1,3,-2,2,1,3,2,2,3,2,2,1,-1,1,1,1,3,-2,2,1,3,2,3,1,3,5,6,7,6,6,6,6,7,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,2,1,1,2,1,0,3,2,1,0,0,1,2,4,0,2,1,0,0,2,1,1,2,1,4,0,1,3,4,0,3,0,0,1,3,4,1,2,1,4,0,1,3,4,0,2,2,1,2,0,0,2,2,0,0,0,1,2,4,0,1,1,0,1,1,3,2,0,0,0,0,0,0,0,0,buffer,-2,0,0,0,-1,-1,0,-2,0,-4,0,-1,-3,-4,0,-1,1,1,1,-2,-4,2,0,0,-4,0,0,-1,0,0,1,1,1,1,-1,-3,0,2,0,0,0,1,2,4,0,buffer,-5,-3,-5,-3,-1,-1,buffer,-0.6,-1.4,-1.6,0,-1.2,-0.2,0.6,-0.2,1.4,buffer,-4.333333333,-1.666666667,-1.2,-0.466666667,0.6,buffer,1,2,5,1,0,1,0.4,0.4,0,1.4,1.2,1.4,1,1.8,1.6,1.4,2.4,1.6,1.4,0.8,1.4,0.8,1,0,buffer,HS_TS,-3.015992718,-1.039543918,-2.743483773,-1.122771927,-1.980448084 +105,R_1EfA786ISA23pMn,25 - 31,Canadian,Male,Male,University - Undergraduate,29,02PsVPf,02FUT,5,02DGEN,-0.375,0,1,2,2,1,1,2,1,1,1,-1,2,1,1,2,0,1,-1,0,1,1,-1,3,-2,-1,-1,1,0,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,1,1,1,3,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,4,3,3,3,2,2,2,2,2,2,3,2,0,0,3,2,3,2,0,1,1,0,1,1,0,3,3,2,2,3,2,2,2,0,3,2,2,3,1,2,0,1,0,0,1,0,0,0,2,1,1,0,1,1,0,1,1,0,0,1,0,0,0,2,1,0,0,1,1,0,0,1,2,2,0,4,1,0,0,2,1,2,2,0,2,1,0,0,0,2,0,0,0,0,0,1,0,0,0,0,buffer,3,1,0,0,2,2,3,2,-2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,-2,2,2,2,2,0,2,-1,1,2,2,-2,4,1,0,0,2,0,2,2,0,2,buffer,3,3,2,1,1,1,buffer,1.2,1,0,2,1.2,1.6,0.4,1.4,1.2,buffer,2.666666667,1,0.733333333,1.6,1,buffer,2,2,1,0,0,0,1.6,1.6,0.6,2.6,1.8,2,0.4,0.6,0.6,0.6,0.6,0.4,1,1.4,1.4,0.6,0,0.2,buffer,C_Ug,1.78723762,0.369567588,1.441123867,2.812056333,1.602496352 +106,R_7m3R1BTrRSjTZpB,46 - 52,Canadian,Male,Male,High School (or equivalent),48,02PsVPf,02FUT,5,01ITEM,1.125,0,1,1,3,-1,3,-3,2,1,3,2,1,2,3,3,2,3,3,3,-3,-1,1,-1,3,0,3,-1,3,3,3,-1,3,3,3,3,3,2,0,3,0,3,-2,3,3,-1,-3,3,3,3,-3,3,-3,2,3,3,3,1,3,3,3,3,3,3,3,-1,3,3,1,3,3,3,1,3,3,3,3,3,10,8,7,7,8,8,2,2,4,5,3,0,2,0,2,4,4,3,2,3,1,2,1,0,0,3,0,2,0,4,0,5,2,2,3,1,3,1,0,4,5,0,2,0,2,0,0,0,2,0,1,0,1,0,0,1,0,2,0,0,0,6,1,2,0,1,0,1,0,0,1,0,0,0,6,4,1,1,0,0,0,1,0,0,4,2,0,0,0,2,0,6,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,4,4,3,0,3,0,2,0,0,0,2,0,0,0,4,0,-1,1,0,3,0,3,0,0,4,4,0,0,0,4,4,-5,0,0,0,0,1,0,0,4,2,0,buffer,8,6,3,2,5,8,buffer,1.6,1.6,0.4,0.6,1.4,1.6,0.6,0.2,1.2,buffer,5.666666667,5,1.2,1.2,0.666666667,buffer,3,0,1,3,1,4,2.4,2.2,0.8,2.2,2.2,2,0.8,0.6,0.4,1.6,0.8,0.4,2.2,0.4,1.2,1.6,0.2,0,buffer,HS_TS,3.845764908,2.483234847,2.451201574,2.05047667,2.7076695 +107,R_57zt0ILImxjmtGh,53 - 59,Canadian,Female,Female,University - Graduate (Masters),58,01PfPsV,01PAST,10,02DGEN,0,0.333333333,0.666666667,3,2,2,3,3,0,-2,2,-1,-2,2,2,3,2,2,2,1,2,2,2,0,1,2,3,-2,3,2,3,1,2,2,2,2,2,2,-1,2,2,3,-2,3,3,3,3,2,3,2,2,3,3,0,0,2,-2,0,3,2,3,-2,2,3,2,2,3,3,0,1,2,-2,-2,3,2,3,-1,2,0,1,1,3,1,1,1,1,0,0,1,1,1,1,0,1,1,0,3,0,4,0,1,0,0,1,0,1,0,0,1,1,1,4,0,4,0,1,1,0,1,0,0,0,0,0,0,0,2,0,1,2,1,0,0,4,0,0,0,0,0,0,0,3,0,1,0,1,0,0,3,0,0,1,0,0,0,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,1,0,0,2,0,0,0,1,0,buffer,1,1,0,1,1,0,1,0,3,-2,0,0,0,-3,0,1,0,0,1,1,1,1,0,3,0,0,1,0,-2,0,0,1,0,0,0,1,0,0,0,-2,0,1,0,1,0,buffer,-1,0,1,3,0,0,buffer,0.8,0.4,-0.6,0.6,1,-0.2,0.2,-0.2,0.4,buffer,0,1,0.2,0.466666667,0.133333333,buffer,3,0,0,1,0,1,0.8,1.4,0.4,0.6,1.8,0.6,0,1,1,0,0.8,0.8,0.2,0.4,0.6,0,0.6,0.2,buffer,grad_prof,-0.042564413,0.369567588,0.286749346,0.654247288,0.316999952 +108,R_7rBJSZZGplyzifl,53 - 59,Canadian,Female,Female,High School (or equivalent),58,03VPfPs,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +109,R_7Rym0Fc7Nb4IVHx,39 - 45,Canadian,Male,Male,College Diploma/Certificate,40,02PsVPf,01PAST,5,01ITEM,0.375,0,0.666666667,3,2,2,1,3,-3,-3,-3,-3,-3,3,1,1,3,1,3,2,2,1,3,-3,-3,-3,-3,-3,2,1,1,1,0,1,1,1,1,3,-3,-3,-3,-3,-3,1,1,2,1,1,3,1,1,0,3,-3,-3,-3,-3,-3,1,1,1,1,1,1,1,1,1,1,-3,-3,-3,-3,-3,1,1,1,1,1,5,7,6,9,4,7,10,8,6,7,7,7,0,0,0,0,0,0,0,0,0,0,1,0,0,2,1,2,1,1,0,0,0,0,0,0,0,2,0,1,2,0,0,1,1,1,0,0,0,0,0,0,2,0,0,2,0,2,1,1,0,2,0,0,0,0,0,2,0,0,2,0,2,1,1,0,0,0,0,0,0,0,1,0,1,0,1,2,0,0,1,2,0,0,0,0,0,0,0,0,0,0,buffer,0,-1,-1,-1,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,-2,0,0,0,0,0,0,0,1,0,0,0,1,1,-1,-2,0,0,0,0,0,1,0,1,0,1,buffer,-5,-1,0,2,-3,0,buffer,-0.6,0,0,-0.4,0,0.2,-0.2,0,0.6,buffer,-2,-0.333333333,-0.2,-0.066666667,0.133333333,buffer,4,3,1,3,1,1,0,0,0.8,0.8,0,1,0.6,0,0.8,1.2,0,0.8,0.8,0,0.6,1,0,0,buffer,C_Ug,-1.414915939,-0.334988165,-0.579031545,-0.361192264,-0.672531978 +110,R_7haSl9uSPTwF7YN,53 - 59,Canadian,Female,Female,University - Graduate (Masters),56,02PsVPf,01PAST,5,02DGEN,0.25,0.666666667,0.333333333,1,2,2,-2,3,0,1,3,0,3,1,0,3,0,2,0,2,2,0,3,0,3,1,0,1,2,1,3,0,2,0,2,2,-1,2,0,3,1,3,1,2,2,3,1,3,0,2,2,0,2,0,0,0,0,0,3,0,3,-2,3,0,2,3,1,2,0,1,0,0,1,2,1,3,2,3,5,7,6,7,5,6,2,6,3,3,4,3,1,0,0,2,0,0,2,2,0,2,1,1,0,0,0,1,0,0,1,1,0,2,2,3,2,1,2,0,1,1,1,0,0,2,1,0,1,3,0,3,2,0,0,2,1,1,0,1,3,1,0,0,3,0,2,1,1,0,2,1,0,0,0,1,1,0,0,0,3,0,0,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,1,0,4,0,buffer,0,0,0,0,-1,0,1,-1,0,-1,-1,1,0,-2,-1,0,0,-1,-2,0,0,2,-1,3,0,0,1,0,-1,0,0,0,-1,0,1,0,-1,0,3,-1,-1,0,0,-3,1,buffer,3,1,3,4,1,3,buffer,-0.2,-0.2,-0.6,-0.6,0.8,0,0,0.2,-0.6,buffer,2.333333333,2.666666667,-0.333333333,0.066666667,-0.133333333,buffer,2,2,0,1,2,0,0.6,1.2,0.4,0.6,1.8,1,0.8,1.4,1,1.2,1,1,0.4,0.6,0.6,0.4,0.4,1.2,buffer,grad_prof,1.558512366,1.25026228,-0.867625175,-0.107332375,0.458454274 +111,R_1k5CwncYiKZj3Y5,53 - 59,Canadian,Female,Female,High School (or equivalent),59,01PfPsV,02FUT,5,01ITEM,0.125,0,1,3,3,3,1,1,2,-1,3,-1,1,-2,1,3,-3,1,3,3,3,1,-1,3,-2,3,-2,1,-1,1,3,-3,1,3,3,1,-1,3,3,1,3,1,1,-1,1,3,-3,2,3,3,3,3,2,3,0,3,-2,2,-2,1,3,-3,2,3,3,3,3,1,3,-2,3,-1,1,-1,0,3,-3,2,4,2,2,5,6,4,0,1,3,2,0,2,0,0,0,0,2,1,1,0,1,0,1,0,0,0,0,0,0,2,2,2,1,2,0,2,0,1,0,0,0,1,0,0,0,2,1,1,1,0,1,1,0,0,0,0,1,0,0,0,2,0,1,1,0,0,0,1,1,0,0,1,0,0,2,2,4,0,3,0,3,0,0,0,0,0,1,0,0,0,0,1,0,2,0,1,1,1,1,0,0,0,buffer,0,0,0,-2,1,0,0,0,0,-1,1,0,0,0,-1,0,0,2,0,2,0,1,0,2,0,0,-1,0,0,0,0,0,2,2,3,0,1,0,2,-1,-1,-1,0,0,1,buffer,4,1,-1,3,6,2,buffer,-0.2,-0.2,0,0.8,0.6,-0.2,1.4,0.4,-0.2,buffer,1.333333333,3.666666667,-0.133333333,0.4,0.533333333,buffer,1,4,2,2,1,1,0.4,0.6,0.2,1.2,1,0.4,0.6,0.8,0.2,0.4,0.4,0.6,1.6,1.2,0.2,0.2,0.8,0.4,buffer,HS_TS,0.872336603,1.778679094,-0.434734729,0.527317343,0.685899578 +112,R_3zSHSrn1Edyc7dM,67 - 73,Canadian,Female,Female,High School (or equivalent),67,01PfPsV,02FUT,10,01ITEM,-0.25,0.666666667,0.333333333,-1,0,3,3,-3,-3,-2,0,3,-2,2,0,3,-3,3,-1,0,2,2,-3,-3,-2,2,2,-2,3,1,3,-1,3,1,0,3,1,-3,0,0,2,1,0,2,0,3,0,3,-1,0,3,3,-3,-3,0,0,0,-3,2,1,3,-2,3,-1,0,3,3,-3,-3,0,0,0,-2,2,-1,2,-2,3,1,1,1,2,2,2,1,1,1,2,2,3,0,0,1,1,0,0,0,2,1,0,1,1,0,2,0,2,0,0,2,0,3,2,2,2,2,0,0,0,3,0,0,0,0,0,0,0,2,0,3,1,0,1,0,1,0,0,0,0,0,0,0,2,0,3,0,0,1,1,1,0,2,0,1,1,0,3,2,0,1,2,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,2,1,0,0,buffer,0,0,1,1,0,0,-2,2,-2,-1,1,0,0,1,0,2,0,0,2,0,3,0,2,-1,2,0,-1,-1,2,0,2,0,1,1,0,3,2,0,1,1,1,-1,-1,1,0,buffer,0,0,0,0,0,-1,buffer,0.4,-0.6,0.4,0.8,1.2,0,0.8,1.4,0,buffer,0,-0.333333333,0.066666667,0.666666667,0.733333333,buffer,1,1,1,1,1,2,0.4,0.6,0.8,0.8,2.2,0.6,0,1.2,0.4,0,1,0.6,0.8,1.6,0.6,0,0.2,0.6,buffer,HS_TS,-0.042564413,-0.334988165,-0.001844284,1.035037119,0.163910064 +113,R_5cklMbb05Lvui0w,53 - 59,Canadian,Female,Female,College Diploma/Certificate,59,03VPfPs,01PAST,10,02DGEN,-0.125,1,0,3,2,2,3,2,0,0,3,-2,1,3,2,2,0,3,3,2,0,2,-2,-2,0,2,1,-2,3,2,2,1,3,3,2,-2,1,3,2,0,3,1,1,3,1,3,1,3,3,2,2,2,3,1,-1,2,-2,1,3,2,3,-3,3,3,0,2,3,1,1,0,2,0,0,3,2,3,-2,3,2,4,2,3,5,5,0,1,1,2,2,7,0,0,2,1,4,2,0,1,3,3,0,0,0,1,0,0,0,4,2,1,2,0,0,3,0,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,3,0,0,2,0,0,1,1,0,1,2,1,0,0,1,2,0,0,0,2,1,5,4,0,1,0,3,0,1,1,0,0,0,2,0,1,2,0,1,0,2,1,0,0,0,1,0,buffer,0,0,2,0,3,1,-1,0,3,3,0,0,-1,-2,0,0,-2,4,2,0,1,0,-1,1,-1,0,1,0,-1,0,0,-2,2,0,3,4,-1,1,-2,2,0,1,1,-1,0,buffer,2,3,1,1,3,-2,buffer,1,1.2,-0.6,0.8,0,0,0.6,0.8,0.2,buffer,2,0.666666667,0.533333333,0.266666667,0.533333333,buffer,1,1,3,2,1,6,1.4,1.8,0.2,1.4,1,0.6,0.4,0.6,0.8,0.6,1,0.6,1.6,1.6,0.4,1,0.8,0.2,buffer,C_Ug,1.329787112,0.19342865,1.008233421,0.273457456,0.70122666 +114,R_5zbTKvOz9belf19,60 - 66,Canadian,Female,Female,College Diploma/Certificate,63,01PfPsV,02FUT,5,01ITEM,0.375,0,1,1,3,3,3,3,-3,-2,3,1,-1,3,-2,3,-3,3,2,3,3,3,3,-3,-2,3,1,-2,3,-2,3,-2,3,1,3,3,3,3,-2,-2,3,1,1,3,-2,3,-2,3,0,3,3,3,3,-3,-3,1,1,-2,3,-1,2,-2,3,2,3,3,3,3,-2,-2,2,1,-1,3,-1,2,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,1,2,0,1,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,3,0,0,0,0,0,2,0,0,0,0,1,1,1,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,-1,-2,0,0,0,-1,-1,0,0,-1,0,0,0,0,0,0,-1,0,2,0,-1,-1,0,0,-1,0,0,0,0,0,-1,-1,0,2,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-0.6,-0.4,-0.2,0.2,-0.4,-0.2,0,0,buffer,0,0,-0.333333333,-0.133333333,-0.066666667,buffer,0,0,0,0,0,0,0.2,0.2,0.2,0,0.6,0.2,0.2,0.8,0.6,0.2,0.4,0.6,0.2,0.8,0,0.4,0.8,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.867625175,-0.488122207,-0.389290255 +115,R_3oLwEdYU6imjRZ5,67 - 73,Canadian,Female,Female,High School (or equivalent),67,03VPfPs,01PAST,5,01ITEM,0,0,1,0,3,3,3,-3,-3,-2,1,0,-3,1,1,0,-1,1,0,3,3,3,-3,-2,-1,0,0,-1,1,0,0,-1,1,0,3,3,3,-3,-3,0,0,0,-1,1,0,0,-3,1,0,3,3,3,-3,-3,0,0,0,0,2,1,1,-2,1,0,3,3,3,-3,-3,0,0,0,-3,1,0,0,-3,1,1,3,2,1,2,3,1,2,2,1,2,2,0,0,0,0,0,1,1,1,0,2,0,1,0,0,0,0,0,0,0,0,0,2,1,0,2,0,1,0,2,0,0,0,0,0,0,0,2,1,0,3,1,0,1,1,0,0,0,0,0,0,0,2,1,0,0,0,1,0,2,0,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,3,1,1,1,1,0,buffer,0,0,0,0,0,1,-1,0,0,-1,-1,1,-1,-1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1,1,0,0,-3,-1,-1,-1,1,0,buffer,0,1,0,0,0,1,buffer,0,-0.2,-0.4,0,0.4,0,0,-0.2,-0.4,buffer,0.333333333,0.333333333,-0.2,0.133333333,-0.2,buffer,0,1,1,0,0,0,0,1,0.2,0,1,0.6,0,1.2,0.6,0,0.6,0.6,0,0.4,0.4,0,0.6,0.8,buffer,HS_TS,0.186160841,0.017289712,-0.579031545,0.019597567,-0.088995856 +116,R_3FIoaAeGU3Saft8,39 - 45,Canadian,Female,Female,College Diploma/Certificate,41,01PfPsV,01PAST,5,02DGEN,0.5,0.666666667,0.333333333,0,1,1,-2,1,1,1,1,0,0,0,1,1,0,0,0,1,1,-2,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,1,1,1,0,1,2,1,0,1,1,1,0,1,1,1,0,0,5,6,6,6,6,6,6,7,7,6,6,7,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,1,1,0,2,0,0,1,0,1,0,0,0,1,1,1,1,0,1,2,0,1,0,0,0,0,1,1,1,1,1,1,1,0,4,0,1,0,0,1,0,1,0,0,0,0,1,1,0,2,0,0,1,1,0,1,0,1,1,1,0,0,1,1,2,0,0,0,0,1,0,0,1,1,1,1,buffer,-1,0,-1,-2,0,-1,0,1,1,1,-1,0,-1,-1,0,0,0,0,-2,0,-1,1,0,0,0,-1,0,1,1,1,1,0,-1,0,0,0,1,1,-1,1,0,0,0,0,-1,buffer,-1,-1,-1,0,0,-1,buffer,-0.8,0.4,-0.6,-0.4,0,0.4,0,0.4,-0.2,buffer,-1,-0.333333333,-0.333333333,0,0.066666667,buffer,1,0,0,0,1,0,0,0.6,0.4,0.8,0.4,0.6,0.8,0.2,1,1.2,0.4,0.2,0.8,0.6,0.6,0.8,0.2,0.8,buffer,C_Ug,-0.728740176,-0.334988165,-0.867625175,-0.23426232,-0.541403959 +117,R_1dNnZpCWyypzFjc,39 - 45,Canadian,Female,Female,University - Undergraduate,42,03VPfPs,01PAST,5,01ITEM,0.375,1,0,2,3,3,-2,2,2,-2,1,3,2,-2,-1,3,1,3,2,3,2,-2,1,2,-2,1,1,2,-2,-2,3,-2,3,1,2,2,-2,1,2,-2,1,-2,2,-2,-2,3,2,3,2,3,3,1,3,-2,-2,2,1,3,-2,-1,3,2,3,3,3,3,-2,3,-2,-2,3,1,2,-2,1,3,1,3,8,3,3,2,2,4,3,3,3,2,3,3,0,0,1,0,1,0,0,0,2,0,0,1,0,3,0,1,1,1,0,1,0,0,0,5,0,0,1,0,1,0,0,0,0,3,1,4,0,1,2,1,0,0,0,1,0,1,0,0,0,1,4,0,2,2,0,0,2,0,0,0,1,1,0,0,0,0,0,0,3,0,0,0,0,4,0,1,0,0,3,0,0,0,1,0,1,0,2,0,1,0,buffer,0,0,1,-3,0,-4,0,-1,0,-1,0,1,0,2,0,0,1,1,0,0,-4,0,-2,3,0,0,-1,0,1,0,0,1,0,-3,0,0,0,-1,3,-1,0,-2,0,3,0,buffer,5,0,0,0,-1,1,buffer,-0.4,-1.2,0.6,0.4,-0.6,0,-0.4,0.2,0.2,buffer,1.666666667,0,-0.333333333,-0.066666667,0,buffer,6,1,1,1,0,0,0.4,0.4,0.8,0.8,1,0.4,0.8,1.6,0.2,0.4,1.6,0.4,0.4,0.6,0.8,0.8,0.4,0.6,buffer,C_Ug,1.101061858,-0.158849227,-0.867625175,-0.361192264,-0.071651202 +118,R_3GuRBPRYbGeCmxb,53 - 59,Canadian,Male,Male,Trade School (non-military),56,01PfPsV,01PAST,5,02DGEN,0.625,0.666666667,0.333333333,2,2,3,0,2,0,-2,3,-2,2,2,0,2,0,3,2,2,3,0,2,0,-2,3,-2,2,3,0,2,0,3,2,2,3,0,2,2,-2,3,-2,1,2,0,0,0,2,2,2,3,0,2,0,-2,2,-2,2,2,0,0,-2,3,2,2,3,0,2,0,-3,2,-3,1,3,0,0,-1,3,1,1,3,2,3,3,3,2,4,4,5,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,2,0,1,0,0,0,0,0,0,0,1,0,0,0,0,2,2,0,0,0,0,0,0,0,1,1,1,1,1,0,2,1,0,0,0,0,0,0,2,0,0,0,1,1,0,2,0,1,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,buffer,0,0,0,0,0,0,0,-1,0,0,1,0,-2,-2,0,0,0,0,0,0,2,-1,-1,-1,0,-1,0,0,-1,1,0,0,0,0,0,2,-1,0,-1,0,0,0,2,-1,1,buffer,-2,-1,-1,-2,-2,-1,buffer,0,-0.2,-0.6,0,-0.2,-0.2,0,0,0.4,buffer,-1.333333333,-1.666666667,-0.266666667,-0.133333333,0.133333333,buffer,1,2,0,1,3,0,0,0,0.2,0,0.6,0.6,0,0.2,0.8,0,0.8,0.8,0,0.6,0.8,0,0.6,0.4,buffer,HS_TS,-0.95746543,-1.039543918,-0.723328361,-0.488122207,-0.802114979 +119,R_1v7mtrAcuSjwnvY,46 - 52,Canadian,Male,Male,University - Undergraduate,52,02PsVPf,01PAST,5,02DGEN,0.125,1,0,0,2,1,-3,2,-1,0,3,0,0,-1,-3,3,0,0,0,0,0,0,0,0,0,2,-3,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,-3,2,0,0,3,-3,0,0,0,0,0,0,0,2,0,-3,2,0,0,3,-3,0,0,0,3,0,0,2,5,2,3,2,2,2,2,2,2,2,2,0,2,1,3,2,1,0,1,3,0,1,3,3,0,0,0,1,1,3,0,1,0,3,0,0,1,3,3,0,0,0,0,1,0,0,1,0,0,3,0,1,3,3,0,0,0,0,1,0,0,1,0,0,3,0,1,3,0,0,0,0,3,0,0,2,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,buffer,0,2,0,3,2,0,0,1,0,0,0,0,0,0,0,0,1,0,3,0,0,0,3,-3,0,0,0,3,0,0,0,3,0,0,2,0,0,2,3,0,0,0,-3,0,0,buffer,0,3,0,1,0,0,buffer,1.4,0.2,0,0.8,0,0.6,1,1,-0.6,buffer,1,0.333333333,0.533333333,0.466666667,0.466666667,buffer,1,3,0,0,0,0,1.6,1,1.4,1,0.8,1.4,0.2,0.8,1.4,0.2,0.8,0.8,1,1,0,0,0,0.6,buffer,C_Ug,0.643611349,0.017289712,1.008233421,0.654247288,0.580845442 +120,R_5t9WlW88wHr6PTD,39 - 45,Canadian,Male,Male,University - Graduate (Masters),43,03VPfPs,02FUT,10,01ITEM,-0.125,0.666666667,0.333333333,0,2,3,1,2,0,-2,1,0,1,3,-2,2,-1,3,0,1,3,1,2,-2,0,2,0,1,2,-2,2,-1,3,0,2,3,0,2,-2,0,2,0,0,3,-2,2,0,3,0,1,3,1,1,0,-2,2,-1,1,2,-2,2,-1,3,0,1,3,2,1,1,-1,2,0,2,3,-2,2,-1,3,2,2,2,3,4,3,1,1,1,3,1,0,0,1,0,0,0,2,2,1,0,0,1,0,0,0,0,0,0,0,1,0,2,2,1,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,0,buffer,0,0,0,0,-1,2,2,0,-1,0,0,0,0,0,0,0,-1,0,0,-1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,0,1,0,buffer,1,1,1,0,3,3,buffer,-0.2,0.6,0,-0.4,0.4,0.2,0.2,-0.6,0.2,buffer,1,2,0.133333333,0.066666667,-0.066666667,buffer,1,2,1,2,0,1,0.2,1,0.2,0.2,1.2,0.2,0.4,0.4,0.2,0.6,0.8,0,0.4,0.2,0.4,0.2,0.8,0.2,buffer,grad_prof,0.643611349,0.897984403,0.14245253,-0.107332375,0.394178977 +121,R_18SUwkYfG9qBhAh,32 - 38,Canadian,Male,Male,University - Undergraduate,35,01PfPsV,02FUT,5,01ITEM,-0.125,0,1,0,2,1,-1,3,-1,1,0,0,0,0,-1,0,1,0,-2,-1,-2,-1,-1,-1,-3,-1,-2,-2,-1,0,-3,-1,-2,-1,0,-2,-1,-1,-1,-2,-2,-1,-1,-1,-2,-2,-1,-1,0,0,0,1,0,0,0,-1,1,0,0,0,-1,-1,-1,-1,0,0,0,-1,-2,-1,-1,-2,-1,0,0,-1,-1,-2,2,2,2,2,2,2,2,2,1,2,2,2,2,3,3,0,4,0,4,1,2,2,1,1,3,2,2,1,2,3,0,4,0,3,2,1,1,1,1,2,2,1,0,2,1,2,3,1,1,1,1,0,0,1,1,2,1,1,2,1,1,4,1,2,1,2,1,0,1,1,2,2,1,1,0,0,0,0,1,1,1,1,0,2,1,0,1,1,0,0,1,1,2,1,0,3,1,0,0,0,0,1,buffer,2,1,2,-2,1,-1,3,0,1,2,1,0,2,0,1,0,0,2,-1,0,-1,1,1,-1,0,1,0,1,0,-1,0,1,0,-1,-1,-2,0,1,-2,0,0,2,1,0,0,buffer,0,0,1,0,0,0,buffer,0.8,1,0.8,0.2,0,0.2,-0.2,-0.6,0.6,buffer,0.333333333,0,0.866666667,0.133333333,-0.066666667,buffer,0,0,0,0,0,1,2.4,1.8,1.8,2,1.4,1.4,1.6,0.8,1,1.8,1.4,1.2,0.4,0.8,0.8,0.6,1.4,0.2,buffer,C_Ug,0.186160841,-0.158849227,1.729717499,0.019597567,0.44415667 +122,R_6vzQFHkLNsJbjHz,32 - 38,Canadian,Male,Male,University - Undergraduate,36,03VPfPs,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,2,2,2,0,2,0,-2,2,-1,0,2,2,2,1,2,2,2,2,0,2,2,-2,2,-2,2,2,2,2,2,2,2,2,2,0,2,1,-2,2,-2,1,2,2,2,2,2,2,2,2,0,2,2,-2,2,-2,1,2,2,2,2,2,2,2,2,0,2,1,-2,2,-2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,2,0,0,1,2,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,2,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0.2,0,0,0,0,0,0.2,0,buffer,0,0,0.066666667,0,0.066666667,buffer,0,0,0,0,0,0,0,1,0.2,0,0.6,0.2,0,0.8,0.2,0,0.6,0.2,0,0.4,0,0,0.2,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.001844284,-0.23426232,-0.109380061 +123,R_7MMekJdpF6Vor4N,60 - 66,Canadian,Male,Male,College Diploma/Certificate,60,01PfPsV,01PAST,10,01ITEM,0.25,1,0,0,1,3,-2,-1,0,-3,2,-1,-1,2,1,1,-2,2,-1,1,3,-3,-1,-1,-3,1,-2,0,2,1,2,-3,2,-1,2,3,-3,-1,-2,-3,1,-2,0,2,1,3,-3,2,-1,2,3,-3,-2,-2,-3,2,-3,-1,2,1,2,-3,2,-2,1,3,-3,-2,-1,-3,1,-3,-2,2,2,2,-3,2,0,1,0,2,4,1,2,2,1,2,0,1,1,0,0,1,0,1,0,1,1,1,0,0,1,1,0,1,1,0,1,0,2,0,1,1,1,0,0,2,1,0,1,1,0,1,1,2,0,0,2,0,0,0,1,1,0,2,0,0,1,1,1,0,1,2,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,1,0,1,0,0,0,buffer,0,-1,0,0,-1,-1,0,1,-1,1,0,0,0,0,0,-1,1,0,0,-1,1,0,0,-1,0,0,-1,1,0,0,-1,0,0,0,0,0,0,-1,0,-1,0,-1,1,0,0,buffer,-2,-1,-1,0,4,0,buffer,-0.4,0,0,-0.2,0,0,-0.2,-0.4,0,buffer,-1.333333333,1.333333333,-0.133333333,-0.066666667,-0.2,buffer,2,3,1,0,2,0,0.4,0.8,0.4,0.6,1,0.6,0.8,0.8,0.4,0.8,1,0.6,0.2,0.2,0.2,0.4,0.6,0.2,buffer,C_Ug,-0.95746543,0.545706526,-0.434734729,-0.361192264,-0.301921474 +124,R_5CHmpGft3VrvEBo,60 - 66,Canadian,Male,Male,Professional Degree (ex. JD/MD),66,02PsVPf,02FUT,5,02DGEN,-0.125,1,0,-3,3,3,-3,-3,1,1,1,-2,0,1,-1,2,1,2,-3,3,3,-3,-3,1,1,1,-1,1,1,-1,1,1,2,-3,3,3,-3,2,1,1,1,1,1,1,-2,1,1,2,-3,3,3,-3,-3,1,2,1,-1,0,1,-1,1,1,2,-3,3,3,-3,-3,1,1,1,-2,0,1,-1,1,1,2,1,1,1,2,2,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,5,0,0,0,3,1,0,1,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,5,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,0,5,0,0,0,3,1,0,1,0,0,0,0,0,0,0,5,0,-1,0,1,0,0,1,0,0,0,buffer,0,0,0,1,1,0,buffer,0,0,0,1,0.8,0.2,1,0,0.2,buffer,0,0.666666667,0,0.666666667,0.4,buffer,1,1,0,0,0,0,0,0.4,0.2,1,0.8,0.4,0,0.4,0.2,0,0,0.2,1,0.4,0.2,0,0.4,0,buffer,grad_prof,-0.042564413,0.19342865,-0.1461411,1.035037119,0.259940064 +125,R_1PYxLxS3QW7j3oD,46 - 52,Canadian,Male,Male,High School (or equivalent),51,01PfPsV,02FUT,10,01ITEM,0.5,1,0,3,3,2,3,2,-2,0,2,-1,2,1,-2,3,0,2,3,3,2,-1,1,-3,-1,2,1,1,1,0,2,-2,2,3,3,3,-2,0,-3,2,2,2,1,1,-3,3,-1,1,2,3,2,3,3,-3,-1,2,0,2,1,-1,2,-2,1,3,2,1,3,2,-1,1,1,-2,-1,1,1,3,-3,1,2,2,3,4,6,4,0,1,1,2,1,3,0,0,0,4,1,1,1,0,2,1,0,2,1,2,0,0,0,1,5,2,1,2,0,3,1,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0,0,1,1,2,1,0,1,1,0,0,1,1,1,1,3,0,3,0,3,1,0,0,1,1,1,0,3,0,1,0,0,3,1,1,1,1,1,1,0,1,2,2,1,2,3,0,2,1,1,0,buffer,-1,0,0,4,0,0,0,0,1,1,0,1,0,0,-1,0,-1,0,5,2,0,1,-1,2,-2,0,-2,0,-2,0,-1,-1,0,1,0,-2,1,-1,-1,-3,0,1,0,0,1,buffer,2,1,2,2,5,1,buffer,0.6,0.4,0,1.2,0,-0.8,-0.2,-1.2,0.4,buffer,1.666666667,2.666666667,0.333333333,0.133333333,-0.333333333,buffer,2,4,1,2,0,2,1,1,1,1.6,1.4,0.6,0.4,0.6,1,0.4,1.4,1.4,0.6,0.8,1.2,0.8,2,0.8,buffer,HS_TS,1.101061858,1.25026228,0.575342976,0.019597567,0.73656617 +126,R_56bUAbiNMFrT6EQ,39 - 45,American,Female,Female,High School (or equivalent),41,03VPfPs,01PAST,10,01ITEM,-1.375,0,1,-2,3,0,0,-3,-3,-1,0,1,-3,0,0,0,0,0,-1,3,3,0,-2,-3,-2,2,1,0,3,3,-3,-3,-1,0,3,2,0,-2,-3,-2,0,1,-3,3,3,-3,-1,-1,0,3,2,2,2,-3,-2,0,0,-2,3,3,2,-3,1,-1,3,3,2,1,-3,-1,2,0,-3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,3,0,1,0,1,2,0,3,3,3,3,3,1,2,0,2,0,1,0,1,0,0,0,3,3,3,1,1,2,0,2,2,5,0,1,0,1,1,3,3,2,3,1,1,0,3,2,4,0,0,2,1,0,3,3,0,0,0,1,0,1,0,0,0,0,2,0,3,0,0,0,2,0,1,0,1,0,1,0,1,2,0,1,0,0,2,3,1,buffer,-1,0,1,-2,-4,0,0,2,-1,2,0,0,1,0,0,1,0,-1,-2,-3,0,1,-2,-1,0,0,0,3,1,1,0,0,0,0,-1,0,-1,0,0,2,0,0,-2,-1,-1,buffer,0,0,0,0,0,0,buffer,-1.2,0.6,0.2,-1,-0.4,1,-0.2,0.2,-0.8,buffer,0,0,-0.133333333,-0.133333333,-0.266666667,buffer,0,0,0,0,0,0,1,1.2,2.6,1,0.2,2.2,2.2,0.6,2.4,2,0.6,1.2,0.4,1,0.4,0.6,0.8,1.2,buffer,HS_TS,-0.042564413,-0.158849227,-0.434734729,-0.488122207,-0.281067644 +127,R_3PjJOEs4lPrWC53,25 - 31,Canadian,Male,Male,University - Undergraduate,27,03VPfPs,01PAST,10,01ITEM,0.125,1,0,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-2,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,-2,1,-1,1,1,1,1,1,1,0,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,5,5,5,6,6,6,1,2,3,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,buffer,2,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,4,3,2,5,5,5,buffer,0.4,-0.2,0,0.2,0.2,0,-0.2,0,0,buffer,3,5,0.066666667,0.133333333,-0.066666667,buffer,1,1,1,0,1,2,0.4,0,0,0.4,0.2,0,0,0.2,0,0.2,0,0,0,0.2,0,0.2,0.2,0,buffer,C_Ug,2.015962874,2.483234847,-0.001844284,0.019597567,1.129237751 +128,R_5wobymd5tkFP9tj,67 - 73,American,Male,Male,College Diploma/Certificate,70,02PsVPf,02FUT,5,02DGEN,-0.125,0.333333333,0.666666667,2,2,2,2,2,-1,1,1,1,1,1,0,2,1,3,3,2,2,2,3,-1,1,0,1,2,1,1,2,1,3,3,2,2,2,3,0,1,0,1,2,1,1,2,2,3,3,2,2,2,2,-1,0,2,1,2,1,0,2,1,3,3,2,2,2,3,-1,1,1,1,2,1,1,2,1,3,4,5,2,3,3,3,3,4,5,4,3,4,1,0,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,buffer,0,0,0,0,1,0,-1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,-1,1,-1,-1,0,0,0,-1,0,1,0,buffer,1,1,-3,-1,0,-1,buffer,0.2,-0.2,0.2,0,0.4,0.2,-0.2,-0.2,0,buffer,-0.333333333,-0.666666667,0.066666667,0.2,-0.133333333,buffer,1,2,1,1,1,1,0.4,0.4,0.2,0.4,0.6,0.4,0.2,0.6,0,0.4,0.2,0.2,0,0.2,0.2,0.2,0.4,0.2,buffer,C_Ug,-0.271289667,-0.511127103,-0.001844284,0.146527512,-0.159433386 +129,R_1pXlkaaYWFKpNzX,46 - 52,Canadian,Male,Male,College Diploma/Certificate,50,02PsVPf,02FUT,5,02DGEN,1,0,1,1,3,-2,1,2,-2,-1,2,1,2,1,1,0,2,1,1,2,2,3,2,2,2,2,1,1,0,1,2,2,1,1,1,1,0,2,1,2,1,2,1,1,2,1,1,0,2,1,1,0,2,1,1,2,1,0,1,1,2,2,1,2,3,-2,2,2,1,3,1,2,1,2,1,0,1,3,7,8,8,7,8,8,8,8,9,9,8,7,0,1,4,2,0,4,3,0,0,1,1,0,2,0,0,0,2,3,1,0,3,3,1,1,1,0,1,1,1,1,1,2,3,1,0,3,2,0,0,2,0,0,2,0,0,1,0,0,1,0,3,4,1,1,1,1,0,0,1,2,0,1,1,3,0,1,0,1,1,0,1,1,1,1,1,0,2,3,2,0,0,2,1,1,1,1,0,2,1,2,buffer,-1,-1,1,1,0,1,1,0,0,-1,1,0,0,0,0,-1,2,3,0,0,0,-1,0,0,0,-1,1,1,0,-1,0,-1,-2,1,0,1,-2,0,0,-1,0,1,-1,0,-1,buffer,-1,0,-1,-2,0,1,buffer,0,0.2,0.2,0.8,-0.2,0,-0.4,-0.4,-0.2,buffer,-0.666666667,-0.333333333,0.133333333,0.2,-0.333333333,buffer,0,0,0,1,0,2,1.4,1.6,0.6,1.2,1.8,0.8,1.4,1.4,0.4,0.4,2,0.8,1,0.6,1,1.4,1,1.2,buffer,C_Ug,-0.500014922,-0.334988165,0.14245253,0.146527512,-0.136505761 +130,R_6RflDkHds1J8B0z,60 - 66,American,Male,Male,College Diploma/Certificate,62,01PfPsV,02FUT,10,01ITEM,0.25,0,0.333333333,-2,2,2,-1,2,1,-3,3,-3,1,1,1,2,-2,2,-3,3,2,-2,2,1,-3,3,-3,2,2,1,2,-2,2,-3,3,3,-2,2,2,-3,3,-3,2,2,1,2,-1,3,-2,3,2,-1,2,1,-3,2,-2,1,2,2,2,-2,3,-2,3,3,1,1,1,-3,2,-3,1,0,1,2,-2,2,3,3,3,4,2,3,2,2,2,3,2,3,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,1,0,1,1,0,0,1,0,1,1,2,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,2,1,0,0,0,1,0,2,1,0,0,1,buffer,1,0,0,1,0,0,0,-1,-1,1,0,-1,0,0,-1,1,0,0,-1,-1,1,0,-1,0,1,0,0,0,1,1,0,0,0,-2,-1,1,0,0,-1,0,-2,-1,0,1,0,buffer,1,1,1,1,0,0,buffer,0.4,-0.2,-0.4,-0.2,0.2,0.4,-0.6,0,-0.4,buffer,1,0.333333333,-0.066666667,0.133333333,-0.333333333,buffer,1,1,0,1,0,1,0.6,0.2,0.2,0.8,0.4,0.6,0.2,0.4,0.6,1,0.2,0.2,0.2,0.2,0.4,0.8,0.2,0.8,buffer,C_Ug,0.643611349,0.017289712,-0.290437916,0.019597567,0.097515178 +131,R_6Wx6aJ9SVGL76Uu,53 - 59,Canadian,Male,Male,University - Graduate (Masters),54,02PsVPf,02FUT,5,02DGEN,-0.125,0.666666667,0.333333333,2,3,2,-2,1,1,-3,3,-3,1,3,1,2,2,3,0,3,3,-2,1,1,-1,0,1,2,3,3,1,3,3,1,3,3,-3,0,2,2,1,2,2,3,3,1,2,3,0,3,2,0,1,0,-3,2,-2,2,3,2,2,2,3,0,3,3,0,1,2,-3,2,-2,1,3,3,3,0,3,6,6,6,7,7,6,5,5,3,1,1,2,2,0,1,0,0,0,2,3,4,1,0,2,1,1,0,1,0,1,1,1,1,5,2,5,1,0,2,1,0,0,2,0,0,2,0,1,0,1,1,1,0,1,0,0,0,2,0,1,2,0,1,0,1,1,0,0,2,1,2,0,1,0,0,1,1,1,3,1,1,0,0,0,0,1,0,0,0,1,0,0,2,0,0,0,1,0,1,1,2,0,buffer,0,0,1,-2,0,-1,2,2,3,0,0,1,1,1,0,-1,0,0,-1,1,0,5,1,4,1,0,0,0,-2,0,1,0,-1,1,1,-1,3,1,1,-1,0,-1,-1,-1,0,buffer,1,1,3,6,6,4,buffer,-0.2,1.2,0.6,-0.2,2.2,-0.4,0.4,0.6,-0.6,buffer,1.666666667,5.333333333,0.533333333,0.533333333,0.133333333,buffer,1,1,0,4,4,1,0.6,2,0.8,0.8,2.8,0.6,0.8,0.8,0.2,1,0.6,1,0.6,1.2,0.2,0.2,0.6,0.8,buffer,grad_prof,1.101061858,2.659373785,1.008233421,0.78117723,1.387461574 +132,R_32b75d1ulG0kEgq,60 - 66,American,Female,Female,High School (or equivalent),65,02PsVPf,02FUT,5,01ITEM,-0.25,0,1,1,3,3,2,2,1,-3,3,-3,0,3,3,3,0,3,3,3,3,1,3,1,-3,3,-3,0,3,3,2,-1,3,2,3,3,0,2,2,-3,3,-3,0,3,3,3,-1,3,2,3,3,3,2,1,-3,3,-3,0,3,3,2,-1,3,1,2,3,3,1,0,-3,3,0,0,3,3,1,0,3,4,5,3,7,2,3,5,3,5,7,7,6,2,0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,2,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,1,0,0,3,0,0,0,2,0,0,1,0,0,1,1,1,0,0,0,0,0,0,1,0,0,1,1,0,0,1,1,0,0,3,0,0,0,1,1,0,buffer,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,-1,0,1,-1,0,0,0,-3,0,0,0,-2,1,0,0,-1,0,1,0,0,0,0,-3,0,0,0,0,-1,0,buffer,-1,2,-2,0,-5,-3,buffer,0.4,0,0,0,-0.6,-0.2,0,-0.6,-0.2,buffer,-0.333333333,-2.666666667,0.133333333,-0.266666667,-0.266666667,buffer,3,3,0,2,4,1,0.8,0,0.4,0.6,0.2,0.2,0.4,0,0.4,0.6,0.8,0.4,0.6,0.2,0.2,0.6,0.8,0.4,buffer,HS_TS,-0.271289667,-1.567960733,0.14245253,-0.741982096,-0.609694991 +133,R_5WJ7pZu4fXxlFdl,67 - 73,American,Male,Male,University - Graduate (Masters),67,01PfPsV,01PAST,5,02DGEN,0.125,0.666666667,0.333333333,2,1,2,2,-1,-2,-2,1,-2,1,1,1,1,0,1,1,2,2,0,0,-2,-2,1,-2,1,2,1,2,0,2,2,2,2,1,1,-2,-2,2,-2,2,2,1,2,0,2,2,2,2,2,1,-2,-2,2,-2,1,2,1,2,0,2,2,2,2,2,1,-2,-2,2,-2,1,2,1,1,0,1,2,2,1,2,2,2,2,2,2,2,2,2,1,1,0,2,1,0,0,0,0,0,1,0,1,0,1,0,1,0,1,2,0,0,1,0,1,1,0,1,0,1,0,1,0,0,2,0,0,1,0,0,1,0,1,0,1,0,1,0,0,2,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,buffer,1,0,0,2,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,0,0,-1,0,-1,buffer,0,0,-1,0,0,0,buffer,0.4,-0.2,0,0.2,0.2,0.4,0.6,0.4,-0.4,buffer,-0.333333333,0,0.066666667,0.266666667,0.2,buffer,0,0,1,0,0,0,1,0,0.6,0.8,0.4,0.6,0.6,0.2,0.6,0.6,0.2,0.2,0.6,0.4,0,0,0,0.4,buffer,grad_prof,-0.271289667,-0.158849227,-0.001844284,0.273457456,-0.03963143 +134,R_5DnGIu10XHfxKY9,46 - 52,Canadian,Male,Male,University - Undergraduate,52,02PsVPf,01PAST,5,02DGEN,-0.25,0.333333333,0.666666667,3,3,2,1,3,-1,0,1,1,1,2,1,3,1,3,3,3,3,0,-1,0,-1,1,-1,2,2,1,3,0,2,3,3,3,0,-1,2,0,3,-2,2,0,0,2,-1,1,3,3,-1,-1,3,0,-2,3,-2,2,3,2,3,-3,3,3,3,-1,-1,2,0,-3,3,-1,1,0,1,0,-3,3,5,7,5,8,8,8,7,5,5,7,8,6,0,0,1,1,4,1,1,0,2,1,0,0,0,1,1,0,0,1,1,4,3,0,2,3,1,2,1,1,2,2,0,0,3,2,0,1,2,2,3,1,1,1,0,4,0,0,0,3,2,1,1,3,2,2,0,2,0,3,4,0,0,0,0,0,0,2,1,2,1,0,2,1,1,1,1,0,0,0,0,1,0,1,0,1,1,3,1,3,0,0,buffer,0,0,-2,-1,4,0,-1,-2,-1,0,-1,-1,0,-3,1,0,0,-2,-1,3,2,-3,0,1,1,0,1,-2,-2,2,0,0,0,0,-1,2,0,2,0,-1,-1,0,-2,1,1,buffer,-2,2,0,1,0,2,buffer,0.2,-0.8,-0.8,0,0.2,-0.2,-0.2,0.6,-0.2,buffer,0,1,-0.466666667,0,0.066666667,buffer,3,1,3,0,3,1,1.2,1,0.4,1.2,1.8,1.6,1,1.8,1.2,1.2,1.6,1.8,0,1.2,1.2,0.2,0.6,1.4,buffer,C_Ug,-0.042564413,0.369567588,-1.156218807,-0.23426232,-0.265869488 +135,R_3ugs5bjxhuKcNu9,60 - 66,American,Female,Female,University - Graduate (Masters),60,01PfPsV,02FUT,5,01ITEM,0.5,0,1,3,3,3,2,3,-3,2,2,2,2,3,2,2,1,1,3,3,3,3,3,-3,2,2,2,2,3,3,3,3,3,2,2,2,2,2,-3,2,2,2,2,3,3,3,3,3,2,2,2,2,2,-2,2,2,-2,-2,3,3,3,3,3,3,3,3,3,3,-3,2,2,2,-3,3,3,3,3,3,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,1,0,0,0,0,0,0,1,1,2,2,1,1,1,0,1,1,0,0,4,4,0,1,1,2,2,0,0,0,1,0,0,0,0,0,5,0,1,1,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,4,1,0,0,0,0,0,buffer,-1,-1,-1,1,-1,-1,0,0,-4,-4,0,0,0,0,0,1,1,1,-1,1,0,0,0,0,-5,0,0,0,0,0,0,0,0,0,0,-1,0,0,-4,-1,0,0,0,0,0,buffer,1,0,0,0,0,0,buffer,-0.6,-1.8,0,0.6,-1,0,0,-1.2,0,buffer,0.333333333,0,-0.8,-0.133333333,-0.4,buffer,0,0,0,1,0,0,0.2,0,1.2,0.8,0,1.2,0.8,1.8,1.2,0.2,1,1.2,1,0,0,1,1.2,0,buffer,grad_prof,0.186160841,-0.158849227,-1.877702882,-0.488122207,-0.584628369 +136,R_6KCToUhfj8M8IDG,67 - 73,American,Female,Female,College Diploma/Certificate,70,03VPfPs,02FUT,10,01ITEM,0,0,1,3,3,2,1,-1,1,-2,3,-1,3,2,-1,2,-2,3,3,3,2,1,-1,1,-2,2,-1,2,2,0,2,-1,3,3,3,2,0,-1,1,-2,3,1,2,2,1,2,0,2,3,3,1,1,-1,0,-2,1,-2,2,2,0,2,-2,3,3,3,1,1,-1,1,-3,2,-1,2,2,-1,2,-2,3,1,1,1,1,2,3,1,2,2,1,2,1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,2,1,0,2,0,2,1,0,0,1,0,0,1,0,2,1,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,2,0,0,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,buffer,0,0,-1,0,0,-1,0,-1,-1,0,0,0,0,1,0,0,0,-1,1,0,0,-1,-1,2,0,0,2,0,2,1,0,0,0,1,0,-1,-1,0,1,0,0,0,0,1,1,buffer,0,-1,-1,0,0,2,buffer,-0.2,-0.6,0.2,0,0,1,0.2,-0.2,0.4,buffer,-0.666666667,0.666666667,-0.2,0.333333333,0.133333333,buffer,0,1,2,0,0,1,0,0.4,0.4,0.2,0.6,1,0.2,1,0.2,0.2,0.6,0,0.2,0.6,0.6,0,0.8,0.2,buffer,C_Ug,-0.500014922,0.19342865,-0.579031545,0.400387399,-0.121307605 +137,R_5CNPGj3zE2XNYeR,67 - 73,American,Male,Male,College Diploma/Certificate,68,02PsVPf,01PAST,10,02DGEN,0.5,0.666666667,0.333333333,3,3,3,-3,3,3,-3,3,-3,-3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,3,3,-3,3,-3,3,3,-3,3,-3,3,0,0,10,0,0,10,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,10,0,0,0,buffer,0,0,0,-1.2,0,0,-1.2,0,0,buffer,3.333333333,0,0,-0.4,-0.4,buffer,0,0,0,0,0,10,0,1.2,0,0,1.2,0,0,1.2,0,1.2,1.2,0,0,0,0,1.2,0,0,buffer,C_Ug,2.244688128,-0.158849227,-0.1461411,-0.995841983,0.235963955 +138,R_6ZOAtFe1RrAZdXm,53 - 59,Canadian,Male,Male,Trade School (non-military),58,03VPfPs,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,2,2,1,0,2,1,-2,2,-3,0,0,1,2,0,0,2,2,1,0,2,0,-2,2,-2,1,0,0,2,0,0,2,2,1,0,2,1,-2,2,-2,0,0,0,2,0,0,2,2,1,0,2,0,-2,2,-2,0,0,0,2,0,0,2,2,1,0,2,0,-2,2,-2,0,0,0,2,0,0,2,1,2,2,2,1,1,2,1,2,2,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,1,-1,1,0,0,0,buffer,0,0.2,0,0,-0.2,0,0,0.4,0,buffer,0.333333333,0,0.066666667,-0.066666667,0.133333333,buffer,0,1,1,1,0,0,0,0.6,0.2,0,0.2,0.2,0,0.4,0.2,0,0.4,0.2,0,0.4,0,0,0,0,buffer,HS_TS,0.186160841,-0.158849227,-0.001844284,-0.361192264,-0.083931233 +139,R_6R4r6h0g1mr3rGo,67 - 73,American,Male,Male,Trade School (non-military),71,03VPfPs,01PAST,10,02DGEN,-0.75,0.333333333,0.333333333,0,2,2,0,-1,2,1,2,0,1,2,2,2,2,1,0,2,1,1,-1,1,1,2,1,2,2,2,2,2,1,1,2,1,-1,-1,2,1,2,1,2,2,2,2,2,1,0,1,2,1,-1,1,0,2,1,0,2,2,1,1,1,0,2,2,2,-1,1,0,2,0,0,2,2,1,1,1,5,6,6,4,6,5,5,6,6,5,4,5,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,0,2,0,1,1,0,0,1,0,0,1,1,0,1,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,buffer,0,-1,1,0,0,0,-1,0,0,0,0,0,-1,-1,0,1,0,1,-1,0,-1,-1,0,1,0,0,0,-1,-1,0,1,-1,0,1,0,1,0,0,-1,0,0,0,0,0,0,buffer,0,0,0,-1,2,0,buffer,0,-0.2,-0.4,0.2,-0.2,-0.4,0.2,0,0,buffer,0,0.333333333,-0.2,-0.133333333,0.066666667,buffer,1,0,1,0,2,1,0.4,0.6,0,0.6,0.4,0,0.4,0.8,0.4,0.4,0.6,0.4,0.6,0.2,0,0.4,0.2,0,buffer,HS_TS,-0.042564413,0.017289712,-0.579031545,-0.488122207,-0.273107113 +140,R_70SLWlEzFffvmLC,46 - 52,Canadian,Male,Male,College Diploma/Certificate,52,03VPfPs,01PAST,5,01ITEM,-0.25,0.333333333,0.666666667,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-2,1,2,-2,3,-2,0,3,0,3,1,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,buffer,0,0,0,-0.2,0,0,-0.2,0,0,buffer,0,-0.333333333,0,-0.066666667,-0.066666667,buffer,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,0,buffer,C_Ug,-0.042564413,-0.334988165,-0.1461411,-0.361192264,-0.221221485 +141,R_7PwK6yn7eA7k40N,46 - 52,Canadian,Male,Male,University - Undergraduate,51,03VPfPs,02FUT,5,02DGEN,0.375,0.666666667,0.333333333,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,2,3,3,3,3,-3,3,3,3,3,-3,3,-2,3,3,3,3,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,3,3,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,3,3,3,3,3,-1,3,3,0,3,-3,3,-3,3,3,3,3,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,buffer,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-2,0,0,3,0,0,0,-1,0,0,0,0,buffer,0,0,-1,-1,0,-1,buffer,0,0.6,0,-0.4,0,-0.2,-0.4,0.6,-0.2,buffer,-0.333333333,-0.666666667,0.2,-0.2,-1.85E-17,buffer,0,0,0,1,0,0,0,0.6,0.2,0,0,0.2,0,0,0.2,0.4,0,0.4,0,0.6,0,0.4,0,0.2,buffer,C_Ug,-0.271289667,-0.511127103,0.286749346,-0.615052151,-0.277679894 +142,R_5dLgEDRdASxfuRX,32 - 38,Canadian,Female,Female,University - Undergraduate,35,01PfPsV,01PAST,10,01ITEM,-0.125,0.666666667,0.333333333,3,3,1,0,2,-2,0,2,-1,3,1,-2,2,-2,2,3,3,3,0,1,-2,-2,1,-2,1,2,-2,2,-2,2,3,3,2,-2,2,-2,-1,0,-2,-1,2,-2,1,-2,2,3,3,1,0,2,-2,-2,2,-2,2,2,-2,3,-2,2,3,3,0,2,2,-1,-1,2,-2,3,2,-3,3,-2,3,3,2,2,2,4,2,2,3,1,2,2,3,0,0,2,0,1,0,2,1,1,2,1,0,0,0,0,0,0,1,2,0,0,1,2,1,4,1,0,1,0,0,0,0,0,0,0,0,2,0,1,1,1,0,1,0,0,0,0,1,2,0,1,1,0,1,0,1,1,1,0,1,0,0,1,2,1,0,1,1,0,2,0,0,1,0,0,0,0,1,2,0,1,1,0,0,1,0,1,0,0,1,buffer,0,0,2,0,1,0,0,1,0,1,0,0,-1,0,0,0,0,0,0,0,-1,0,2,0,4,0,-1,0,0,-1,0,0,0,0,1,-1,0,1,0,1,0,-1,1,0,-1,buffer,1,-1,1,0,2,-1,buffer,0.6,0.4,-0.2,0,1,-0.4,0.2,0.2,-0.2,buffer,0.333333333,0.333333333,0.266666667,0.2,0.066666667,buffer,1,2,0,0,1,2,0.6,1.2,0.2,0.6,1.6,0.4,0,0.8,0.4,0.6,0.6,0.8,0.8,0.8,0.2,0.6,0.6,0.4,buffer,C_Ug,0.186160841,0.017289712,0.431046162,0.146527512,0.195256056 +143,R_7YXvnff8uualDwM,53 - 59,Canadian,Male,Male,College Diploma/Certificate,53,02PsVPf,01PAST,10,01ITEM,0.25,1,0,0,1,3,2,3,0,-1,2,-1,1,1,-2,2,0,1,0,1,2,2,2,1,-1,2,-1,2,1,-2,2,-1,1,0,2,2,2,2,0,-1,2,-1,2,1,-2,2,-1,1,0,1,2,2,2,1,-1,2,0,2,1,-2,2,-1,1,0,1,2,2,2,1,0,2,0,2,1,-2,2,-1,1,4,3,4,8,6,2,2,1,2,3,2,2,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,0,1,0,0,0,1,-1,0,0,0,0,0,0,0,0,buffer,2,2,2,5,4,0,buffer,0,-0.2,0,0.2,-0.6,0,0.2,0,0,buffer,2,3,-0.066666667,-0.133333333,0.066666667,buffer,4,3,2,1,1,0,0.4,0.4,0.2,0.6,0.2,0.2,0.4,0.6,0.2,0.4,0.8,0.2,0.2,0.2,0,0,0.2,0,buffer,C_Ug,1.329787112,1.426401218,-0.290437916,-0.488122207,0.494407052 +144,R_57x6VVRg8Pjng9b,32 - 38,Canadian,Female,Female,University - PhD,38,01PfPsV,02FUT,10,02DGEN,-0.375,0.333333333,0.666666667,3,3,3,2,3,1,-3,2,-3,2,3,0,3,2,3,3,3,3,2,3,1,-3,2,-3,2,3,0,3,2,3,3,3,3,3,3,1,-2,3,-2,2,3,0,3,2,3,3,3,3,2,3,1,-3,3,-3,2,3,0,3,2,3,3,3,3,2,3,1,-3,2,-3,1,3,-3,3,2,3,4,1,1,6,1,1,7,1,1,4,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,3,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,3,0,0,0,buffer,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,-1,0,-3,0,0,0,0,0,0,1,0,0,1,0,1,-1,0,-3,0,0,0,buffer,-3,0,0,2,0,0,buffer,0,-0.2,0,0.2,0.4,-0.6,0.2,0.2,-0.6,buffer,-1,0.666666667,-0.066666667,1.85E-17,-0.066666667,buffer,2,0,0,3,0,0,0,0,0,0.2,0.6,0,0,0.2,0,0,0.2,0.6,0.2,0.6,0,0,0.4,0.6,buffer,grad_prof,-0.728740176,0.19342865,-0.290437916,-0.23426232,-0.26500294 +145,R_1XaffUG5PkYS6aZ,67 - 73,American,Female,Female,College Diploma/Certificate,70,03VPfPs,01PAST,5,02DGEN,-0.25,0,1,2,1,3,0,2,0,1,2,-1,1,3,2,2,1,2,1,2,3,0,1,0,1,2,-1,0,3,2,2,-2,2,0,1,3,-1,1,0,0,2,-1,1,3,2,2,0,2,2,2,2,1,1,-1,0,2,-1,0,3,2,2,0,3,2,2,2,0,1,-1,-1,2,-1,0,3,2,2,-1,3,2,3,3,2,2,4,1,2,2,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,3,0,2,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,1,1,2,0,0,1,0,0,0,2,1,1,1,0,1,0,0,1,0,0,1,0,0,0,2,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,buffer,1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,2,-1,2,-1,-1,1,0,-1,-1,0,0,-1,0,0,0,-1,-1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,buffer,1,1,1,1,1,3,buffer,-0.2,-0.4,0.2,0.2,-0.6,-0.4,0.4,0.2,0.2,buffer,1,1.666666667,-0.133333333,-0.266666667,0.266666667,buffer,0,1,1,0,1,1,0.6,0.2,0.6,0.8,0.2,0.2,0.8,0.6,0.4,0.6,0.8,0.6,0.6,0.4,0.4,0.2,0.2,0.2,buffer,C_Ug,0.643611349,0.721845465,-0.434734729,-0.741982096,0.047184997 +146,R_3ZEJTUbbiHhiNNe,67 - 73,American,Male,Male,University - PhD,72,01PfPsV,02FUT,10,02DGEN,0,1,0,-1,3,1,1,0,-3,2,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0.2,0,0,0.2,0,0,0.2,0,0,0.2,0,0,0,0,0,0,0,buffer,grad_prof,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +147,R_1QGIaEA2AaGAPj9,39 - 45,Canadian,Female,Female,College Diploma/Certificate,44,03VPfPs,02FUT,10,01ITEM,0.125,0,1,2,0,2,0,0,1,1,0,1,1,-1,1,1,0,2,1,-1,0,0,1,2,0,0,0,1,0,1,1,0,0,2,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,2,1,1,2,1,2,2,1,0,0,0,0,1,0,0,0,0,0,7,7,6,8,6,6,4,6,5,6,6,5,1,1,2,0,1,1,1,0,1,0,1,0,0,0,2,0,1,1,1,1,0,0,1,1,1,2,0,0,1,1,1,1,1,1,1,0,1,1,0,0,2,0,1,1,1,0,1,0,2,1,1,1,0,1,0,1,1,1,0,2,1,2,1,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1,1,2,1,1,buffer,0,0,1,-1,0,1,0,-1,1,0,-1,0,-1,-1,1,0,0,1,-1,0,-1,-1,1,0,1,1,-1,-1,1,-1,0,2,0,0,0,0,1,0,-1,1,0,-1,-2,0,0,buffer,3,1,1,2,0,1,buffer,0,0.2,-0.4,0,0,-0.2,0.4,0.2,-0.6,buffer,1.666666667,1,-0.066666667,-0.066666667,1.85E-17,buffer,1,1,0,2,0,0,1,0.6,0.6,0.8,0.6,0.8,1,0.4,1,0.8,0.6,1,1,0.8,0.6,0.6,0.6,1.2,buffer,C_Ug,1.101061858,0.369567588,-0.290437916,-0.361192264,0.204749817 +148,R_1NUrOnuIGFIdED6,67 - 73,American,Male,Male,Trade School (non-military),71,03VPfPs,01PAST,5,01ITEM,0.25,0,1,2,0,2,-1,3,2,-3,3,-3,2,3,2,2,-2,3,2,-1,2,-2,3,2,-3,3,-3,2,3,2,2,-2,3,2,-2,2,-2,3,2,-3,2,-3,2,3,2,2,-2,3,3,-2,3,-1,2,1,-2,2,-2,1,3,3,2,-2,3,3,-2,3,-1,1,1,-3,2,-2,1,3,3,2,-3,3,1,1,1,1,1,1,2,2,1,2,3,3,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,1,0,0,0,0,0,0,0,1,2,1,0,1,1,1,1,1,1,0,1,0,0,0,1,2,1,0,2,1,0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,buffer,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,0,-1,0,0,0,-1,0,-1,1,-2,-1,0,0,-1,-1,0,-1,0,-1,0,0,1,0,0,-1,0,-1,1,0,0,0,0,0,-1,0,buffer,-1,-1,0,-1,-2,-2,buffer,-0.6,-1,-0.2,-0.6,-0.6,-0.4,0,0,-0.2,buffer,-0.666666667,-1.666666667,-0.6,-0.533333333,-0.066666667,buffer,0,0,0,0,1,2,0.4,0,0,0.6,0.2,0,1,1,0.2,1.2,0.8,0.4,0.2,0.2,0,0.2,0.2,0.2,buffer,HS_TS,-0.500014922,-1.039543918,-1.444812436,-1.24970187,-1.058518286 +149,R_7BFMMimGwwLAWAx,60 - 66,Canadian,Male,Male,University - Undergraduate,62,01PfPsV,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,0,2,2,0,3,2,2,2,1,1,3,2,2,1,2,1,2,2,0,2,2,2,2,0,2,3,2,2,2,2,0,2,2,0,2,2,2,2,0,1,2,2,2,0,2,0,2,2,0,3,2,2,2,0,2,2,2,2,0,1,1,3,2,0,3,2,2,2,0,2,2,2,2,2,1,2,2,2,2,3,3,2,2,2,2,2,2,1,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,2,0,1,1,0,0,0,0,0,0,0,0,0,0,0,2,0,buffer,1,0,0,0,1,0,0,0,0,0,-1,0,0,0,-1,-1,-1,0,0,1,0,0,0,0,-1,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,1,1,0,0,0,0,buffer,0,0,0,0,1,1,buffer,0.4,0,-0.4,-0.2,-0.2,-0.2,-0.2,0.2,0.2,buffer,0,0.666666667,0,-0.2,0.066666667,buffer,0,1,1,0,0,0,0.4,0.4,0.2,0.2,0.2,0.4,0,0.4,0.6,0.4,0.4,0.6,0.2,0.2,0.6,0.4,0,0.4,buffer,C_Ug,-0.042564413,0.19342865,-0.1461411,-0.615052151,-0.152582254 +150,R_7jxZv8IeVyOZaWG,60 - 66,American,Female,Female,Trade School (non-military),66,02PsVPf,02FUT,5,01ITEM,0,0.666666667,0.333333333,2,2,2,0,3,0,1,1,1,1,1,1,2,0,2,2,2,2,0,3,1,0,2,0,2,2,1,1,2,2,2,2,2,0,3,2,0,2,2,2,2,2,2,2,2,2,2,2,0,3,1,1,1,0,2,1,1,2,0,2,2,2,2,0,3,0,1,1,1,1,1,1,1,0,2,0,4,2,0,2,2,1,1,1,1,2,2,0,0,0,0,0,1,1,1,1,1,1,0,1,2,0,0,0,0,0,0,2,1,1,1,1,1,1,0,2,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,2,0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,buffer,0,0,0,0,0,0,1,1,0,0,1,0,1,2,0,0,0,0,0,0,2,1,1,1,1,1,1,-1,2,0,0,0,0,0,0,0,0,0,1,-1,0,1,0,0,0,buffer,-1,3,1,-1,0,0,buffer,0,0.4,0.8,0,1.2,0.6,0,0,0.2,buffer,1,-0.333333333,0.4,0.6,0.066666667,buffer,0,2,0,0,1,1,0,1,0.8,0,1.2,0.8,0,0.6,0,0,0,0.2,0,0.6,0.4,0,0.6,0.2,buffer,HS_TS,0.643611349,-0.334988165,0.719639792,0.908107175,0.484092538 +151,R_3JDv13TGH2wYNxL,67 - 73,American,Female,Female,High School (or equivalent),71,02PsVPf,01PAST,10,02DGEN,0.625,0,1,3,2,3,3,-1,-2,-3,2,-2,1,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,3,2,3,1,-1,-3,-3,3,-2,-2,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,1,2,1,1,1,1,1,1,1,2,1,1,0,0,0,0,0,1,0,1,1,4,0,0,0,0,0,0,0,0,2,0,1,0,1,0,3,0,0,0,0,0,0,0,0,0,0,1,0,1,1,4,0,0,0,0,0,0,0,0,0,0,1,0,1,1,4,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,-1,-1,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,0,0,0,0,0,buffer,0,1,0,-1,0,0,buffer,0,0,0,0.4,-0.4,0,0.4,0.4,0,buffer,0.333333333,-0.333333333,0,0,0.266666667,buffer,0,1,0,1,0,0,0,1.4,0,0.4,1,0,0,1.4,0,0,1.4,0,0.4,0.4,0,0,0,0,buffer,HS_TS,0.186160841,-0.334988165,-0.1461411,-0.23426232,-0.132307686 +152,R_1vVlTIoXp4otw9b,46 - 52,Canadian,Female,Female,University - Undergraduate,46,01PfPsV,02FUT,10,01ITEM,0.125,0.666666667,0.333333333,3,2,3,2,2,-3,-1,-1,1,0,2,-2,3,-3,3,3,3,3,1,2,-3,1,3,-3,3,1,-3,3,-3,3,3,3,3,1,3,-3,1,3,-3,3,1,-3,3,-3,3,2,2,2,2,2,-3,-2,-2,2,-2,2,-2,-2,-3,3,3,3,3,3,1,-3,1,-1,1,-1,2,1,1,-3,3,3,3,3,3,3,3,8,5,5,5,5,5,0,1,0,1,0,0,2,4,4,3,1,1,0,0,0,0,1,0,1,1,0,2,4,4,3,1,1,0,0,0,1,0,1,0,0,0,1,1,1,2,0,0,5,0,0,0,1,0,1,1,0,2,0,0,1,0,3,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,3,1,1,1,0,3,3,0,0,buffer,-1,1,-1,1,0,0,1,3,3,1,1,1,-5,0,0,0,0,0,0,0,0,0,4,4,2,1,-2,-2,0,0,-1,-1,-1,-1,0,0,-3,-1,-1,-1,0,-3,-3,0,0,buffer,-5,-2,-2,-2,-2,-2,buffer,0,1.6,-0.6,0,2,-0.6,-0.8,-1.2,-1.2,buffer,-3,-2,0.333333333,0.466666667,-1.066666667,buffer,0,0,0,3,0,0,0.4,2.6,0.4,0.6,2.6,0.4,0.4,1,1,0.6,0.6,1,0.2,0,0,1,1.2,1.2,buffer,C_Ug,-2.101091701,-1.215682856,0.575342976,0.654247288,-0.521796073 +153,R_34qGWjMp36VziGX,46 - 52,Canadian,Male,Male,University - Undergraduate,48,01PfPsV,02FUT,10,02DGEN,0.875,0,1,3,3,3,3,3,0,0,3,0,3,3,3,3,3,3,3,3,3,3,3,0,0,3,-1,3,3,2,3,3,3,2,3,3,2,2,0,0,3,0,2,3,3,3,3,2,3,3,3,3,3,0,0,3,0,2,3,3,2,2,3,1,3,2,3,3,1,0,2,1,1,3,2,1,1,1,3,3,4,6,5,4,5,4,5,9,8,7,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,2,0,1,0,0,1,0,1,1,2,0,1,2,2,2,1,0,0,1,1,0,0,0,1,1,0,1,0,0,1,2,0,1,0,0,1,0,1,1,1,0,1,1,1,2,buffer,0,0,0,0,0,0,0,0,1,-1,0,1,-1,-1,0,-1,0,-1,1,1,-1,0,-1,-1,-1,0,-1,-2,-2,-1,-1,0,-1,1,1,-1,0,-1,0,0,0,0,-1,-1,-1,buffer,-2,-1,-1,-3,-3,-3,buffer,0,0,-0.2,0,-0.8,-1.2,0,-0.4,-0.6,buffer,-1.333333333,-3,-0.066666667,-0.666666667,-0.333333333,buffer,3,2,0,4,4,2,0,0.2,0.2,0.6,0.2,0.2,0,0.2,0.4,0.6,1,1.4,0.6,0.4,0.4,0.6,0.8,1,buffer,C_Ug,-0.95746543,-1.744099671,-0.290437916,-1.503561759,-1.123891194 +154,R_3q8hpZsyYuntLQM,60 - 66,American,Male,Male,University - Undergraduate,66,02PsVPf,01PAST,10,02DGEN,-0.125,0.666666667,0.333333333,3,2,3,-2,-1,-2,1,3,0,0,2,-3,2,2,3,0,1,2,0,-1,0,1,2,1,-1,3,-3,2,2,3,0,3,1,1,1,2,-1,2,0,2,3,3,3,3,2,3,2,3,1,1,0,1,3,0,1,3,-3,3,2,3,1,0,0,1,-2,0,3,2,3,1,3,-3,3,1,3,2,2,1,2,8,1,1,0,1,1,4,2,3,1,1,2,0,2,0,1,1,1,1,0,0,0,0,3,1,2,3,2,4,2,1,0,2,1,6,1,1,1,0,0,0,3,2,2,0,0,0,1,1,0,1,0,0,2,2,3,3,1,2,2,1,3,1,1,0,1,1,0,0,2,1,1,2,2,2,0,1,3,0,6,1,1,1,2,2,3,0,3,0,2,1,3,0,0,0,0,1,0,buffer,3,1,1,-1,-2,0,0,1,1,0,0,0,-1,0,0,1,-1,-1,0,1,2,0,0,-3,1,0,6,0,0,1,-2,0,-2,1,-1,2,0,-1,-2,3,0,6,1,0,1,buffer,1,2,0,1,4,-1,buffer,0.4,0.4,-0.2,0,0,1.4,-0.8,0.4,1.6,buffer,1,1.333333333,0.2,0.466666667,0.4,buffer,0,6,0,0,4,1,1.4,1,0.2,2.2,1.8,2,1,0.6,0.4,2.2,1.8,0.6,1.2,1.6,1.8,2,1.2,0.2,buffer,C_Ug,0.643611349,0.545706526,0.286749346,0.654247288,0.532578627 +155,R_31cnn6pFgsAYVmU,60 - 66,Canadian,Male,Male,College Diploma/Certificate,65,03VPfPs,01PAST,5,02DGEN,-0.375,1,0,2,2,1,-2,2,1,0,2,-2,1,2,0,2,-2,2,2,2,1,-1,2,0,1,2,-2,0,0,-2,2,1,2,2,2,1,-2,2,0,-1,2,-1,0,-2,-2,2,-2,2,2,2,1,0,2,0,-2,2,-2,0,1,0,2,-2,2,2,2,1,1,2,0,-2,2,-2,0,-1,0,2,-2,2,1,1,2,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,1,2,2,0,3,0,0,0,0,0,0,1,1,0,1,1,4,2,0,0,0,0,0,0,2,0,1,2,0,0,1,1,0,0,0,0,0,0,0,3,0,1,2,0,0,1,3,0,0,0,0,0,0,0,1,0,0,2,0,1,0,2,0,0,3,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,buffer,0,0,0,-1,0,0,-1,0,0,0,1,2,0,3,0,0,0,0,-3,0,0,-1,0,1,0,1,2,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,3,0,buffer,0,0,1,0,0,0,buffer,-0.2,-0.2,1.2,-0.6,0,0.6,0,0.6,0.6,buffer,0.333333333,0,0.266666667,0,0.4,buffer,0,0,1,0,0,0,0.2,0.6,1.4,0,0.8,1.2,0.4,0.8,0.2,0.6,0.8,0.6,0.2,0.6,1,0.2,0,0.4,buffer,C_Ug,0.186160841,-0.158849227,0.431046162,-0.23426232,0.056023864 +156,R_3q32cRTAfOFU8Sa,60 - 66,Canadian,Male,Male,University - Undergraduate,66,02PsVPf,01PAST,5,02DGEN,0.375,0.333333333,0.333333333,3,3,3,3,1,-2,-3,3,1,3,-2,1,3,-1,3,3,3,3,3,1,-3,-3,3,3,2,-2,3,2,-2,2,3,3,3,3,1,-3,-3,2,3,1,-2,2,3,-3,3,3,3,3,3,-1,-3,-3,3,-2,2,-2,1,3,-3,3,3,3,3,3,-1,-3,-3,3,-3,1,-1,1,3,-3,3,4,2,3,4,2,4,2,2,1,2,3,3,0,0,0,0,0,1,0,0,2,1,0,2,1,1,1,0,0,0,0,0,1,0,1,2,2,0,1,0,2,0,0,0,0,0,2,1,0,0,3,1,0,0,0,2,0,0,0,0,0,2,1,0,0,4,2,1,0,0,2,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,buffer,0,0,0,0,-2,0,0,0,-1,0,0,2,1,-1,1,0,0,0,0,-2,0,0,1,-2,0,-1,1,0,0,0,0,0,0,0,0,0,0,1,-1,0,-1,1,1,1,1,buffer,2,0,2,2,-1,1,buffer,-0.4,-0.2,0.6,-0.4,-0.2,0,0,0,0.6,buffer,1.333333333,0.666666667,-1.85E-17,-0.2,0.2,buffer,0,0,1,0,1,2,0,0.8,1,0,1.2,0.6,0.4,1,0.4,0.4,1.4,0.6,0,0.4,0.8,0,0.4,0.2,buffer,C_Ug,0.872336603,0.19342865,-0.1461411,-0.615052151,0.076143001 +157,R_1CNrJPVWRR7J28f,67 - 73,American,Female,Female,University - Graduate (Masters),71,01PfPsV,01PAST,10,02DGEN,-0.5,0,1,-1,1,2,0,3,-2,-2,3,-2,1,1,-1,2,1,1,1,1,1,-2,2,-3,-2,3,-2,2,0,-1,2,1,1,2,1,0,-2,2,-2,-2,3,-2,2,1,-2,2,2,0,-1,0,1,0,2,-2,-2,2,-2,1,0,-2,1,-1,0,-1,0,2,1,2,-2,-2,2,-2,0,0,-2,2,-1,0,5,8,7,9,6,5,5,6,6,8,8,8,2,0,1,2,1,1,0,0,0,1,1,0,0,0,0,3,0,2,2,1,0,0,0,0,1,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,1,1,2,1,0,1,0,1,1,0,0,1,0,1,1,1,0,2,1,1,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,buffer,2,-1,0,2,0,1,0,-1,0,1,0,-1,-1,-2,-1,3,-1,2,1,0,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,-1,0,1,0,0,0,-1,1,1,-1,1,1,buffer,0,2,1,1,-2,-3,buffer,0.6,0.2,-1,1,-0.2,-0.4,0,0,0.6,buffer,1,-1.333333333,-0.066666667,0.133333333,0.2,buffer,4,2,2,3,2,2,1.2,0.4,0.2,1.6,0.2,0.6,0.6,0.2,1.2,0.6,0.4,1,0.4,0.2,0.8,0.4,0.2,0.2,buffer,grad_prof,0.643611349,-0.863404979,-0.290437916,0.019597567,-0.122658495 +158,R_1LZQSZFNRdnsJxL,67 - 73,American,Female,Female,University - PhD,71,01PfPsV,02FUT,5,02DGEN,-0.25,0,1,3,3,2,-3,2,1,-3,3,-3,2,3,-1,3,1,3,3,3,2,-3,2,2,-3,3,-3,2,3,-1,3,2,3,3,3,2,-3,2,2,-3,3,-3,2,3,-1,3,2,3,3,3,2,-3,2,1,-3,3,-3,2,3,-1,3,1,3,3,3,2,1,1,1,-3,3,-3,1,3,-1,3,1,3,0,0,0,0,0,0,0,1,0,2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,-4,-1,1,0,0,0,-1,0,0,0,1,0,0,0,0,-4,-1,0,0,0,0,-1,0,0,0,0,0,buffer,0,-1,0,-2,-2,0,buffer,0,0.2,0.2,-1,0,0.2,-1,-0.2,0,buffer,-0.333333333,-1.333333333,0.133333333,-0.266666667,-0.4,buffer,0,0,0,2,1,0,0,0.2,0.2,0,0.2,0.2,0,0,0,1,0.2,0,0,0,0,1,0.2,0,buffer,grad_prof,-0.271289667,-0.863404979,0.14245253,-0.741982096,-0.433556053 +159,R_59LL8DXdTJLqSB3,53 - 59,American,Female,Female,High School (or equivalent),53,03VPfPs,02FUT,5,01ITEM,0,1,0,3,2,3,2,0,-3,0,0,1,2,-1,-3,3,-3,2,3,2,3,2,0,-3,1,0,1,2,-1,-3,3,-3,2,3,2,3,1,0,-3,1,0,2,2,-1,-3,3,-3,1,3,2,3,3,0,-3,0,0,0,2,-1,-3,3,-3,2,2,2,2,3,0,-3,0,0,0,1,-1,-3,3,-3,2,0,1,0,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,-1,0,0,1,0,-1,0,0,0,0,0,0,-1,0,-1,0,0,0,1,0,0,-1,0,0,0,0,1,-1,0,-1,1,0,0,0,0,1,-1,0,0,0,0,1,buffer,-1,0,0,0,0,1,buffer,-0.2,0,0,-0.4,0,0.2,-0.2,0,0.2,buffer,-0.333333333,0.333333333,-0.066666667,-0.066666667,0,buffer,1,0,1,0,0,0,0,0.2,0,0.2,0.4,0.2,0.2,0.2,0,0.6,0.4,0,0.2,0.2,0.2,0.4,0.2,0,buffer,HS_TS,-0.271289667,0.017289712,-0.290437916,-0.361192264,-0.226407534 +160,R_6fxexjmSERfuEHs,46 - 52,Canadian,Female,Female,College Diploma/Certificate,46,02PsVPf,01PAST,5,01ITEM,0.5,0,1,0,3,3,3,2,-1,1,1,0,1,2,1,1,1,0,-1,3,3,3,2,0,0,1,0,1,3,0,1,1,0,1,3,3,3,2,1,1,1,0,1,2,0,1,1,-1,1,3,3,3,2,0,0,1,0,0,3,0,1,1,0,1,3,3,3,2,1,0,1,0,1,3,0,1,1,0,1,3,0,1,3,3,1,2,1,2,2,1,1,0,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,2,0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,0,0,2,1,0,0,0,1,1,0,0,0,2,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,1,2,0,0,0,0,0,1,0,0,-1,1,0,0,0,1,buffer,0,1,-1,-1,1,2,buffer,0,-0.2,0,0,-0.2,0,0.4,0,0.4,buffer,0,0.666666667,-0.066666667,-0.066666667,0.266666667,buffer,0,0,3,1,0,0,0.2,0.4,0.4,0.2,0.4,0.4,0.2,0.6,0.4,0.2,0.6,0.4,0.4,0.4,0.4,0,0.4,0,buffer,C_Ug,-0.042564413,0.19342865,-0.290437916,-0.361192264,-0.125191486 +161,R_5J2RqQH7n9Fx52B,39 - 45,Canadian,Female,Female,High School (or equivalent),44,02PsVPf,02FUT,10,01ITEM,0.125,1,0,3,3,2,-1,2,1,NA,1,0,3,0,0,3,0,3,3,3,2,-1,2,2,0,2,0,3,0,0,3,0,3,2,3,2,-2,2,2,1,2,1,3,-1,0,3,1,3,3,3,2,0,2,1,-2,3,-2,3,0,0,3,0,3,3,3,2,0,2,1,-2,3,-2,3,0,0,3,0,3,1,1,1,2,2,2,1,1,1,1,1,1,0,0,0,0,0,1,NA,1,0,0,0,0,0,0,0,1,0,0,1,0,1,NA,1,1,0,1,0,0,1,0,0,0,0,1,0,0,NA,2,2,0,0,0,0,0,0,0,0,0,1,0,0,NA,2,2,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,1,NA,-1,-2,0,0,0,0,0,0,1,0,0,0,0,1,NA,-1,-1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,buffer,0,0,0,1,1,1,buffer,-0.2,-0.5,0,0.2,-0.25,0.4,0.4,0.4,0.4,buffer,0,1,-0.233333333,0.116666667,0.4,buffer,1,1,1,0,0,0,0,0.5,0,0.4,0.75,0.4,0.2,1,0,0.2,1,0,0.4,0.4,0.4,0,0,0,buffer,HS_TS,-0.042564413,0.369567588,-0.651179952,-0.012134917,-0.084077924 +162,R_5fE8gqnU9RHKd7a,39 - 45,Canadian,Female,Female,University - PhD,41,02PsVPf,02FUT,10,01ITEM,-0.125,1,0,1,3,2,3,2,-1,-3,2,-3,-2,3,1,2,-2,3,1,3,2,3,2,-2,-2,2,-2,-1,3,1,2,-2,3,1,3,2,3,2,-1,-3,2,-2,-1,3,1,0,-2,3,1,3,2,3,3,-1,-2,2,-2,-1,3,1,2,-3,3,1,3,2,3,3,-1,-3,3,-3,-1,3,1,2,-3,3,1,2,1,1,1,2,1,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,2,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,buffer,0,0,0,0,-1,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,-1,1,0,0,0,2,-1,0,0,0,0,0,0,1,0,-1,-1,0,0,0,2,0,0,buffer,0,1,0,0,0,1,buffer,-0.2,0.2,-0.2,-0.2,0,0.2,0,-0.2,0.4,buffer,0.333333333,0.333333333,-0.066666667,0,0.066666667,buffer,0,1,1,0,0,0,0,0.8,0,0,0.4,0.4,0.2,0.6,0.2,0.2,0.4,0.2,0,0.4,0.4,0,0.6,0,buffer,grad_prof,0.186160841,0.017289712,-0.290437916,-0.23426232,-0.080312421 +163,R_17PA2lzu5PTR6Xx,46 - 52,Canadian,Female,Female,High School (or equivalent),52,02PsVPf,01PAST,5,01ITEM,0.5,0.666666667,0.333333333,3,0,0,-2,0,-2,-1,2,0,1,2,-1,3,-2,3,3,0,0,-2,0,-3,-2,3,-2,0,2,-1,3,-3,3,3,0,1,-2,0,-2,-2,3,-2,3,2,-2,3,-3,3,3,0,0,0,0,-3,-2,3,-2,3,2,0,3,-3,3,3,0,0,1,0,-3,-2,3,-2,2,2,-1,3,-3,3,1,1,1,2,1,1,3,1,1,2,2,1,0,0,0,0,0,1,1,1,2,1,0,0,0,1,0,0,0,1,0,0,0,1,1,2,2,0,1,0,1,0,0,0,0,2,0,1,1,1,2,2,0,1,0,1,0,0,0,0,3,0,1,1,1,2,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,3,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,buffer,0,0,0,-2,0,0,0,0,0,-1,0,-1,0,0,0,0,0,1,-3,0,-1,0,0,0,1,0,1,0,0,0,0,0,1,-1,0,1,0,0,0,2,0,0,0,0,0,buffer,-2,0,0,0,-1,0,buffer,-0.4,-0.2,-0.2,-0.4,0,0.2,0,0.6,0,buffer,-0.666666667,-0.333333333,-0.266666667,-0.066666667,0.2,buffer,1,0,0,1,1,0,0,1.2,0.2,0.2,1.2,0.4,0.4,1.4,0.4,0.6,1.2,0.2,0.2,0.8,0.2,0.2,0.2,0.2,buffer,HS_TS,-0.500014922,-0.334988165,-0.723328361,-0.361192264,-0.479880928 +164,R_6BCIVFV4NJK5M1X,67 - 73,American,Female,Female,University - PhD,71,01PfPsV,02FUT,5,02DGEN,-0.5,0,0.666666667,2,2,2,0,3,1,-2,2,-2,2,3,1,3,1,3,3,2,2,1,3,2,-3,2,-3,2,3,1,3,1,3,2,2,2,0,3,1,-3,2,-3,2,3,1,3,2,3,2,2,2,1,3,1,-3,2,-2,2,3,1,3,1,3,1,2,2,3,2,1,-3,0,-2,1,3,1,3,1,3,0,0,1,2,1,1,3,1,2,5,2,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,3,1,0,1,2,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,2,1,0,0,2,0,1,0,0,0,0,0,buffer,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,-1,0,0,-3,-1,0,0,-2,1,-1,0,0,0,1,0,0,0,0,-1,-1,1,0,-2,0,-1,0,0,0,1,0,buffer,-3,-1,-1,-3,-1,0,buffer,0.2,0.4,0,-1,-0.4,0.2,-0.4,-0.4,0.2,buffer,-1.666666667,-1.333333333,0.2,-0.4,-0.2,buffer,2,1,0,2,1,1,0.4,0.6,0,0,0.4,0.2,0.2,0.2,0,1,0.8,0,0.4,0.2,0.2,0.8,0.6,0,buffer,grad_prof,-1.186190685,-0.863404979,0.286749346,-0.995841983,-0.689672075 +165,R_5Jmin0uMTvm4LhV,60 - 66,American,Male,Male,Trade School (non-military),66,03VPfPs,01PAST,10,01ITEM,0.375,0.333333333,0.666666667,3,3,2,3,2,-2,-3,2,-1,0,3,3,3,0,3,2,2,2,2,0,-2,-2,2,-2,-2,3,3,3,-2,3,3,2,3,2,2,-2,-2,2,-2,-2,3,3,3,1,3,2,2,2,2,-1,-3,-3,3,-3,-3,3,3,3,-3,3,2,2,2,3,-1,-3,-3,3,-3,-3,3,3,3,-2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,2,0,1,0,1,2,0,0,0,2,0,0,1,1,1,0,0,1,0,1,2,0,0,0,1,0,1,1,0,1,3,1,0,1,2,3,0,0,0,3,0,1,1,0,0,3,1,0,1,2,3,0,0,0,2,0,1,0,1,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,-1,-1,1,-1,-1,-1,0,0,0,-1,0,-1,0,1,1,-3,-1,1,-1,-1,-1,0,0,0,-1,0,1,0,1,-1,2,0,0,0,0,0,0,0,0,2,0,buffer,0,0,0,0,0,0,buffer,-0.2,-0.6,-0.2,-0.4,-0.6,-0.2,0.6,0,0.4,buffer,0,0,-0.333333333,-0.4,0.333333333,buffer,0,0,0,0,0,0,1,0.8,0.4,0.6,0.8,0.2,1.2,1.4,0.6,1,1.4,0.4,0.8,0,0.6,0.2,0,0.2,buffer,HS_TS,-0.042564413,-0.158849227,-0.867625175,-0.995841983,-0.516220199 +166,R_10ZpB2n0wIHaxg0,67 - 73,American,Female,Female,University - PhD,68,02PsVPf,02FUT,5,02DGEN,0,0,1,3,3,3,3,3,3,1,3,1,3,3,-2,3,-2,3,3,3,3,3,3,3,3,3,1,3,3,0,3,0,3,3,3,3,3,3,3,0,3,0,3,3,0,3,-2,3,3,3,3,3,3,3,0,3,0,3,3,0,3,-2,3,3,3,2,3,3,3,0,1,0,2,3,0,3,0,3,1,1,1,1,1,1,5,1,1,5,7,1,0,0,0,0,0,0,2,0,0,0,0,2,0,2,0,0,0,0,0,0,0,1,0,1,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,0,0,0,0,1,0,0,0,1,2,1,1,0,2,0,2,0,0,0,0,0,0,0,3,0,1,0,0,0,0,2,0,0,0,1,0,0,0,0,2,0,1,0,0,0,2,0,buffer,0,0,0,0,0,0,1,0,-1,0,0,0,0,2,0,0,0,-1,0,0,0,0,-2,0,-1,0,0,0,-2,0,0,0,-1,0,0,0,3,-2,1,-1,0,0,0,0,0,buffer,-4,0,0,-4,-6,0,buffer,0,0,0.4,-0.2,-0.6,-0.4,-0.2,0.2,0,buffer,-1.333333333,-3.333333333,0.133333333,-0.4,0,buffer,0,0,0,0,6,0,0,0.4,0.8,0,0.4,0.4,0,0.4,0.4,0.2,1,0.8,0,0.8,0.4,0.2,0.6,0.4,buffer,grad_prof,-0.95746543,-1.920238609,0.14245253,-0.995841983,-0.932773373 +167,R_6jja8oeAQsmBzhL,60 - 66,American,Female,Female,College Diploma/Certificate,64,02PsVPf,01PAST,10,02DGEN,-0.25,0,0.666666667,3,2,2,0,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,-1,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,-1,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,0,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,0,2,1,-3,2,-3,0,2,3,2,-1,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,buffer,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,0,0,0.2,-0.2,0,0,-0.2,0,buffer,0,0,0.066666667,0,-0.066666667,buffer,0,0,0,0,0,0,0.2,0,0,0.2,0,0,0,0,0,0,0.2,0,0,0,0,0,0.2,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.001844284,-0.23426232,-0.109380061 +168,R_78KWiw9duh3YG77,60 - 66,American,Female,Female,High School (or equivalent),61,03VPfPs,01PAST,10,01ITEM,0,0,1,3,3,3,-3,3,2,-3,2,-1,2,3,3,3,3,3,3,3,3,-3,3,3,-3,3,-2,3,3,3,3,3,3,3,3,3,-3,3,3,-3,3,3,3,3,3,3,-3,3,3,3,3,-2,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,2,3,3,-3,3,-3,3,3,3,3,3,3,1,2,2,1,2,2,1,1,1,0,1,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,4,1,0,0,0,6,0,0,0,0,1,0,1,0,1,2,1,0,0,0,0,0,0,0,0,5,0,1,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,6,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-5,0,0,0,0,2,0,0,0,0,6,0,0,0,0,-4,0,0,0,0,5,0,0,0,0,6,0,buffer,0,1,1,1,1,2,buffer,-0.2,-0.2,0,-1,0.4,1.2,-0.8,1,1.2,buffer,0.666666667,1.333333333,-0.133333333,0.2,0.466666667,buffer,0,0,0,1,0,1,0,0.8,0,0,1.4,1.2,0.2,1,0,1,1,0,0,1,1.2,0.8,0,0,buffer,HS_TS,0.414886095,0.545706526,-0.434734729,0.146527512,0.168096351 +169,R_1Ca2W3p8z3iavf6,53 - 59,Canadian,Male,Male,University - Undergraduate,54,03VPfPs,01PAST,10,02DGEN,0.625,0,1,2,2,2,2,2,1,-1,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,1,-1,-1,-1,-2,1,-1,3,1,3,1,3,3,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,1,2,2,2,2,2,5,5,5,6,7,7,7,6,7,3,6,3,0,0,0,0,0,1,3,0,0,0,1,1,1,1,1,3,1,3,3,3,3,2,3,1,1,2,0,2,2,1,0,0,0,0,0,1,3,0,0,0,1,1,1,1,1,0,0,0,0,0,0,3,0,0,1,1,1,1,1,1,3,1,3,3,3,4,1,3,1,1,1,1,1,1,2,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,3,3,3,3,-1,3,1,0,1,-1,1,1,0,3,1,3,3,3,3,1,3,1,0,1,1,1,1,2,buffer,-2,-1,-2,3,1,4,buffer,0,0,0,2.6,1.2,0.4,2.6,1.6,1.2,buffer,-1.666666667,2.666666667,0,1.4,1.8,buffer,1,2,2,4,0,4,0,0.8,1,2.6,2,1.4,0,0.8,1,0,0.8,1,2.6,2,1.2,0,0.4,0,buffer,C_Ug,-1.186190685,1.25026228,-0.1461411,2.431266501,0.587299249 +170,R_7k0t0ZojGpZeKBR,32 - 38,Canadian,Female,Female,University - Undergraduate,36,01PfPsV,01PAST,10,02DGEN,-0.5,0,1,3,3,3,3,3,0,-1,3,0,3,2,2,1,1,3,3,3,3,2,2,2,0,2,0,2,2,2,3,2,3,3,3,3,3,3,1,0,1,0,3,3,2,1,2,3,3,3,3,3,3,1,-1,2,-1,2,3,2,3,1,3,3,3,3,3,3,1,0,3,0,2,3,2,1,3,2,1,1,1,2,4,1,1,0,1,1,1,0,0,0,0,1,1,2,1,1,0,1,0,0,2,1,0,0,0,0,0,0,1,1,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,1,1,1,0,2,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,2,1,0,0,0,1,1,1,0,1,0,1,1,0,2,0,0,0,0,0,0,0,0,1,1,1,0,0,0,2,2,1,buffer,0,0,0,1,1,1,1,0,-1,0,-1,0,0,1,0,0,0,0,0,0,0,0,2,0,-1,0,0,0,-1,-1,0,0,0,1,1,1,-1,0,-1,1,1,0,0,-2,-1,buffer,0,1,0,1,3,1,buffer,0.4,0.2,0,0,0.2,-0.4,0.4,0,-0.4,buffer,0.333333333,1.666666667,0.2,-0.066666667,0,buffer,1,3,0,0,1,1,0.4,1,0.6,0,0.8,0.4,0,0.8,0.6,0,0.6,0.8,0.4,0.6,0.6,0,0.6,1,buffer,C_Ug,0.186160841,0.721845465,0.286749346,-0.361192264,0.208390847 +171,R_5qDD8OVKXEU7FPS,67 - 73,American,Female,Female,High School (or equivalent),69,03VPfPs,02FUT,10,01ITEM,0.375,0,1,3,1,2,-3,1,1,-3,3,-2,3,3,2,3,-3,3,3,1,3,-3,1,0,-3,3,-3,3,3,3,3,-3,3,3,1,3,-3,1,-1,-3,3,-3,2,3,3,3,-2,3,3,2,3,-2,2,1,-3,3,-3,3,3,3,3,-2,3,3,3,2,-2,1,1,-3,3,-3,2,3,3,3,-3,3,10,10,10,10,10,10,10,10,10,10,10,10,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,2,0,0,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,1,0,1,0,0,2,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,buffer,0,-1,0,-1,-1,1,0,0,0,0,0,0,0,-1,0,0,-2,1,-1,0,2,0,0,0,0,0,0,0,1,0,0,-1,-1,0,-1,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.6,0.2,-0.2,-0.4,0.4,0.2,-0.6,0.2,0,buffer,0,0,-0.2,0.066666667,-0.133333333,buffer,0,0,0,0,0,0,0.2,0.4,0.2,0.2,0.8,0.4,0.8,0.2,0.4,0.6,0.4,0.2,0,0.4,0.2,0.6,0.2,0.2,buffer,HS_TS,-0.042564413,-0.158849227,-0.579031545,-0.107332375,-0.22194439 +172,R_6HLVo651b2Ns27V,46 - 52,Canadian,Female,Female,University - Graduate (Masters),48,02PsVPf,02FUT,5,01ITEM,-0.5,0.666666667,0.333333333,3,2,2,2,2,-3,-2,2,-1,2,2,-3,3,-2,3,2,2,2,2,2,-3,-2,2,-3,1,2,-3,3,-3,2,2,2,2,2,2,-3,-2,2,-2,2,3,-3,3,-3,3,3,2,2,3,2,-3,-1,2,-2,1,2,-3,3,-3,3,2,2,2,2,2,-3,0,2,-1,0,2,-3,3,-3,3,1,1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,2,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,0,0,2,0,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,buffer,1,0,0,-1,0,0,-1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,-2,0,1,-2,1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,0,1,buffer,0,0,1,0,0,0,buffer,0,0,0.2,0,-0.6,0.2,-0.4,-0.2,0.4,buffer,0.333333333,0,0.066666667,-0.133333333,-0.066666667,buffer,0,0,0,0,0,1,0.2,0.6,0.4,0.2,0.2,0.4,0.2,0.6,0.2,0.2,0.8,0.2,0,0.4,0.4,0.4,0.6,0,buffer,grad_prof,0.186160841,-0.158849227,-0.001844284,-0.488122207,-0.115663719 +173,R_3prMmEhVagQa825,67 - 73,American,Female,Female,Trade School (non-military),70,03VPfPs,02FUT,10,02DGEN,0.375,0,1,3,2,3,2,2,2,-2,2,-2,2,2,0,2,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,-1,2,-1,3,3,3,3,3,3,3,3,3,-3,3,3,3,3,0,3,2,2,2,2,2,3,-3,3,3,3,3,0,3,0,3,3,3,3,2,2,3,-3,3,-3,3,3,-1,2,-2,3,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,1,1,1,5,1,1,1,1,3,1,2,0,1,0,1,0,0,1,1,1,5,1,1,0,1,2,0,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,6,0,0,0,0,4,1,1,0,1,1,1,0,0,0,0,0,6,0,0,1,1,2,0,buffer,-1,1,-1,1,1,0,0,0,-4,0,0,1,-1,-1,0,0,0,0,1,1,0,4,0,0,0,0,2,1,2,0,-1,-1,-1,0,0,0,6,0,-6,0,0,3,0,-1,0,buffer,1,0,1,0,1,-1,buffer,0.2,-0.8,-0.2,0.4,0.8,1,-0.6,0,0.4,buffer,0.666666667,0,-0.266666667,0.733333333,-0.066666667,buffer,1,1,1,0,0,1,0.6,1,0.6,0.6,1.8,1.4,0.4,1.8,0.8,0.2,1,0.4,0,1.2,1.2,0.6,1.2,0.8,buffer,HS_TS,0.414886095,-0.158849227,-0.723328361,1.161967062,0.173668892 +174,R_3HkwQiFWpFnTJYE,46 - 52,Canadian,Female,Female,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0.625,0,1,2,2,2,1,3,-2,0,2,-1,2,1,1,2,1,1,2,2,2,-1,2,-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,-1,2,1,1,1,1,1,2,2,2,2,2,-2,-1,2,0,0,2,1,1,1,1,2,1,1,2,1,-2,1,1,1,1,2,1,1,1,1,6,4,6,7,6,6,7,5,6,6,6,4,0,0,0,2,1,0,1,1,2,1,0,0,1,0,0,1,1,1,0,2,4,2,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,2,1,0,1,0,0,0,1,1,1,2,0,1,1,2,1,1,0,1,0,0,1,1,1,2,1,4,1,1,2,1,0,0,0,0,0,0,1,1,0,1,0,2,1,1,1,0,0,0,0,0,buffer,0,0,0,1,0,0,0,1,1,-1,-1,0,0,0,0,1,0,0,-1,0,4,1,-1,-2,-1,-1,0,0,0,0,1,0,0,2,0,4,-1,0,1,0,0,0,0,0,0,buffer,-1,-1,0,1,0,2,buffer,0.2,0.2,-0.2,0,0.2,-0.2,0.6,0.8,0,buffer,-0.666666667,1,0.066666667,0,0.466666667,buffer,1,2,0,1,1,2,0.6,1,0.2,1,1.2,0.2,0.4,0.8,0.4,1,1,0.4,1.2,1.8,0,0.6,1,0,buffer,C_Ug,-0.500014922,0.369567588,-0.001844284,-0.23426232,-0.091638484 +175,R_7r0cHKY4oCTAEJK,60 - 66,American,Female,Female,University - Graduate (Masters),60,02PsVPf,02FUT,5,01ITEM,0,1,0,2,3,3,1,-1,-3,-1,1,3,-2,2,-1,2,1,3,1,2,3,2,-2,-3,1,-1,3,-3,2,0,1,2,3,2,2,3,-2,1,-2,1,2,3,1,2,1,2,2,3,2,3,3,2,1,-3,-2,2,2,-1,2,-1,2,-1,3,2,2,3,3,-2,-3,-1,2,1,-1,2,-1,1,-3,3,1,4,1,2,3,2,3,1,1,5,4,4,1,1,0,1,1,0,2,2,0,1,0,1,1,1,0,0,1,0,3,2,1,2,1,0,3,0,2,0,1,0,0,0,0,1,2,0,1,1,1,1,0,0,0,2,0,0,1,0,2,1,0,0,1,2,1,0,0,1,4,0,1,0,0,4,3,1,0,3,0,4,0,1,1,0,0,0,1,0,1,3,0,1,0,1,0,0,0,1,2,0,buffer,1,1,0,0,-1,0,1,1,-1,0,0,1,1,-1,0,0,0,0,1,1,1,2,0,-2,2,0,2,-1,-3,0,1,-1,0,3,0,1,-1,3,-1,4,0,1,0,-2,0,buffer,-2,3,0,-3,-1,-2,buffer,0.2,0.2,0.2,0.4,0.6,-0.4,0.6,1.2,-0.2,buffer,0.333333333,-2,0.2,0.2,0.533333333,buffer,1,1,1,2,3,3,0.8,1,0.6,1.2,1.4,0.6,0.6,0.8,0.4,0.8,0.8,1,1.6,1.6,0.4,1,0.4,0.6,buffer,grad_prof,0.186160841,-1.215682856,0.286749346,0.146527512,-0.149061289 +176,R_7BhsRfqwHLhuYAV,67 - 73,American,Male,Male,College Diploma/Certificate,71,01PfPsV,01PAST,10,02DGEN,0.5,0,1,3,3,1,1,3,-3,-1,3,0,3,3,3,2,3,3,2,3,3,0,3,-1,0,3,1,1,3,2,3,3,3,2,3,3,1,3,0,0,3,2,3,3,3,3,3,2,2,3,1,2,1,0,-1,2,0,2,3,2,3,2,3,2,2,1,3,2,0,-1,1,0,1,3,2,3,3,3,10,10,10,10,10,10,10,10,10,10,10,10,1,0,2,1,0,2,1,0,1,2,0,1,1,0,0,1,0,2,0,0,3,1,0,2,0,0,0,1,0,1,1,0,0,1,2,3,0,1,0,1,0,1,1,1,0,1,1,0,2,1,3,0,2,0,2,0,1,1,0,0,0,0,0,1,0,1,0,0,1,2,0,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,buffer,0,0,2,0,-2,-1,1,-1,1,1,0,0,0,-1,0,0,-1,2,-2,-1,0,1,-2,2,-2,0,-1,0,0,1,0,-1,0,0,-1,1,0,-1,1,1,0,1,0,-1,1,buffer,0,0,0,0,0,0,buffer,0,0.2,-0.2,-0.4,-0.2,0,-0.4,0.4,0.2,buffer,0,0,0,-0.2,0.066666667,buffer,0,0,0,0,0,0,0.8,1.2,0.4,0.6,1.2,0.4,0.8,1,0.6,1,1.4,0.4,0.2,0.8,0.4,0.6,0.4,0.2,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.615052151,-0.240651723 +177,R_1LiG5eQcc7wj9BK,53 - 59,Canadian,Male,Male,College Diploma/Certificate,59,01PfPsV,02FUT,5,02DGEN,0.625,0,1,-2,3,-1,1,3,-2,2,3,-1,1,0,1,0,1,2,3,2,1,1,3,2,1,1,2,0,0,2,1,0,1,-1,1,1,2,0,2,1,2,0,2,0,1,2,1,2,-1,2,-2,2,3,2,1,0,2,1,0,2,2,1,2,-3,2,-2,2,3,2,1,1,-1,2,0,2,1,2,1,2,3,1,2,2,2,8,8,7,6,1,2,5,1,2,0,0,4,1,2,3,1,0,1,1,1,1,1,2,2,1,3,4,1,1,1,1,0,0,2,0,0,1,1,1,1,0,4,1,3,3,0,0,1,2,0,0,1,1,1,1,0,4,1,2,0,1,0,1,1,1,1,4,1,0,1,3,0,0,1,2,2,0,1,1,1,1,2,0,0,0,0,0,0,1,3,1,0,0,1,1,1,buffer,4,0,1,-1,0,0,0,-1,0,1,0,0,-1,1,1,0,1,1,0,3,0,0,-1,1,0,0,-1,1,-1,-1,2,1,0,1,3,0,0,0,-1,1,0,1,0,0,0,buffer,-6,-5,-6,-4,1,0,buffer,0.8,0,0.2,1,0,-0.4,1.4,0,0.2,buffer,-5.666666667,-1,0.333333333,0.2,0.533333333,buffer,0,1,1,2,7,5,1.6,2.2,0.8,1.8,1.6,0.4,0.8,2.2,0.6,0.8,1.6,0.8,1.8,1,0.8,0.4,1,0.6,buffer,C_Ug,-3.930893735,-0.687266041,0.575342976,0.146527512,-0.974072322 +178,R_78s3uH2EFnwOwhz,67 - 73,American,Female,Female,University - PhD,70,03VPfPs,01PAST,10,02DGEN,0.25,0,1,3,-2,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,1,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0.2,0,0,0.2,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.2,0,0,0.2,0.2,0,0.2,0,0,0.2,0,0,0,0.2,0,0,0,0,buffer,grad_prof,-0.042564413,-0.158849227,-0.1461411,-0.107332375,-0.113721779 +179,R_6BKJ0IIae4mCVah,46 - 52,Canadian,Male,Male,University - Undergraduate,47,03VPfPs,01PAST,10,02DGEN,0.375,1,0,2,1,-1,-2,0,-1,-2,2,-1,1,1,0,2,-2,1,2,2,-2,-2,-1,-1,-2,2,-1,1,1,0,1,-2,1,2,2,1,-1,0,-1,-2,2,-1,1,0,0,1,-2,1,2,2,-2,-2,0,-1,-2,2,-2,1,1,0,2,-2,1,2,1,-2,-2,0,-1,-2,2,-1,1,1,0,2,-2,1,1,1,1,2,2,2,2,1,2,1,1,2,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,2,1,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,1,0,0,0,-1,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,-1,3,1,1,0,0,0,-1,0,1,0,0,0,0,buffer,-1,0,-1,1,1,0,buffer,0.2,-0.2,0.2,0.6,0,0.4,0.8,-0.2,0.2,buffer,-0.666666667,0.666666667,0.066666667,0.333333333,0.266666667,buffer,1,1,1,1,0,0,0.6,0,0.2,0.8,0,0.4,0.4,0.2,0,0.2,0,0,1,0,0.2,0.2,0.2,0,buffer,C_Ug,-0.500014922,0.19342865,-0.001844284,0.400387399,0.022989211 +180,R_1PdLTy6wnfNmKpJ,67 - 73,American,Male,Male,College Diploma/Certificate,68,03VPfPs,02FUT,10,02DGEN,0,0,1,2,3,3,-3,2,-2,-3,3,-3,1,2,1,2,-3,3,3,3,3,-3,1,-3,-3,2,-3,2,1,2,2,-3,3,3,3,3,-3,1,-3,-3,2,-3,1,2,1,2,-3,1,3,3,3,-2,3,-2,-3,2,-3,1,1,1,2,-3,3,3,3,3,-1,3,-2,-3,3,-3,1,1,0,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,2,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,2,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,buffer,0,0,0,-1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,-2,0,1,0,1,0,0,-1,-1,-1,0,2,0,0,0,-1,0,0,0,-1,0,1,1,0,-1,0,2,buffer,0,0,0,0,0,0,buffer,-0.2,0.4,0.2,-0.4,0.4,-0.2,-0.2,0,0.4,buffer,0,0,0.133333333,-0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.4,0.6,0.4,0.4,0.4,0.4,0.6,0.2,0.2,0.8,0,0.6,0,0.2,0.8,0.2,0.2,0.4,buffer,C_Ug,-0.042564413,-0.158849227,0.14245253,-0.361192264,-0.105038343 +181,R_6US8xvHn7QMnayB,60 - 66,American,Female,Female,College Diploma/Certificate,66,02PsVPf,01PAST,5,02DGEN,-0.5,0,1,3,3,3,2,1,-3,1,3,3,1,3,1,3,-3,3,3,3,3,1,-1,-3,2,2,2,2,3,1,2,-3,2,3,3,3,1,-1,-3,2,3,3,1,3,2,3,-3,3,3,3,3,2,1,-3,-2,3,-2,1,3,1,3,-3,3,3,3,3,3,1,-3,-3,3,-3,1,3,-2,3,-3,3,1,9,5,1,2,2,1,2,2,2,3,2,0,0,0,1,2,0,1,1,1,1,0,0,1,0,1,0,0,0,1,2,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,3,0,5,0,0,0,0,0,0,0,0,0,1,0,0,4,0,6,0,0,3,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,3,0,0,0,buffer,0,0,0,1,2,0,-2,1,-4,1,0,0,1,0,1,0,0,0,0,2,0,-3,0,-6,0,0,-2,0,0,0,0,0,0,-1,0,0,-1,1,0,1,0,-2,1,0,1,buffer,0,7,3,-1,-1,0,buffer,0.6,-0.8,0.4,0.4,-1.8,-0.4,-0.2,0.2,0,buffer,3.333333333,-0.666666667,0.066666667,-0.6,0,buffer,0,7,3,1,1,0,0.6,0.8,0.4,0.6,0.2,0.2,0,1.6,0,0.2,2,0.6,0,0.6,0.6,0.2,0.4,0.6,buffer,C_Ug,2.244688128,-0.511127103,-0.001844284,-1.376631814,0.088771232 +182,R_5Pw5qC2rawzbL82,39 - 45,Canadian,Female,Female,University - Undergraduate,44,02PsVPf,01PAST,10,01ITEM,0.625,0.333333333,0.333333333,1,2,2,1,1,-2,-3,2,-2,1,3,-1,1,1,1,2,2,2,1,3,-3,-3,1,-2,1,2,2,2,3,1,1,1,2,-1,2,-2,-3,1,0,1,2,-2,3,2,1,1,1,2,1,0,-3,-3,0,-2,0,2,-3,0,0,0,0,2,2,2,0,-3,-3,3,-2,2,2,-2,2,2,1,6,7,8,7,6,8,4,4,4,4,6,5,1,0,0,0,2,1,0,1,0,0,1,3,1,2,0,0,1,0,2,1,0,0,1,2,0,1,1,2,1,0,0,1,0,0,1,1,0,2,0,1,1,2,1,1,1,1,0,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,0,2,1,1,0,0,2,0,0,4,1,1,0,1,1,0,1,0,0,0,3,0,2,0,1,2,2,1,buffer,1,-1,0,0,1,0,0,-1,0,-1,0,1,0,1,-1,-1,1,0,1,0,-1,0,0,2,-1,0,0,1,0,0,0,0,0,1,1,1,0,-3,2,-2,0,3,-1,-1,-1,buffer,2,3,4,3,0,3,buffer,0.2,-0.4,0.2,0.2,0,0.2,0.4,-0.4,0,buffer,3,2,0,0.133333333,0,buffer,1,1,0,0,2,1,0.6,0.4,1.4,0.8,0.6,1,0.4,0.8,1.2,0.6,0.6,0.8,1,0.6,1.2,0.6,1,1.2,buffer,C_Ug,2.015962874,0.897984403,-0.1461411,0.019597567,0.696850936 +183,R_5Id5KM8MgZBfe9q,46 - 52,Canadian,Male,Male,University - Undergraduate,49,01PfPsV,02FUT,5,01ITEM,0.25,1,0,2,-2,1,2,3,1,-3,-2,0,1,2,-3,0,3,1,-2,3,0,-3,-3,3,-1,3,2,0,0,1,3,3,-3,-3,0,2,0,-3,2,1,2,-2,-2,2,2,-1,2,-3,0,2,-1,0,2,-1,2,-1,0,3,-3,-3,2,-3,-1,2,0,3,3,3,1,0,2,-2,3,-2,1,-3,-3,-2,9,2,2,9,5,3,2,8,10,3,5,6,4,5,1,5,6,2,2,5,2,1,2,4,3,0,4,5,2,1,2,6,1,4,4,2,3,0,5,1,1,4,2,4,2,2,1,2,5,1,0,2,5,0,2,6,2,0,2,2,1,0,0,3,4,2,2,4,4,3,6,3,1,3,2,3,0,1,2,1,4,2,2,1,4,1,0,2,2,4,3,1,2,2,3,2,0,1,4,5,0,1,buffer,2,1,-1,3,5,0,-3,4,2,-1,-3,4,1,-6,2,5,0,-1,1,6,1,1,0,0,1,-4,1,-2,-5,1,-1,1,-2,0,-1,-1,0,-2,2,2,1,-3,-1,1,-1,buffer,7,-6,-8,6,0,-3,buffer,2,0.4,-0.4,2.2,0.6,-1.8,-0.6,0.2,-0.6,buffer,-2.333333333,1,0.666666667,0.333333333,-0.333333333,buffer,0,3,1,1,3,4,4.2,2.4,2.6,3.2,2.8,2.2,2.2,2,3,1,2.2,4,1.8,2,1.6,2.4,1.8,2.2,buffer,C_Ug,-1.643641192,0.369567588,1.296827053,0.400387399,0.105785212 +184,R_1PuIvcwlGXOr30L,67 - 73,American,Female,Female,College Diploma/Certificate,70,02PsVPf,02FUT,5,01ITEM,-0.125,0.666666667,0.333333333,2,2,2,0,2,0,-3,3,-3,3,2,2,2,1,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,2,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,2,1,0,0,1,0,1,0,0,0,1,0,1,1,1,3,1,0,0,1,0,1,0,0,0,1,0,1,1,1,3,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,1,0,0,0,0,buffer,0,0,0,-0.2,0,0,0.2,0,0,buffer,0.333333333,0,0,-0.066666667,0.066666667,buffer,0,0,0,0,1,0,1.4,0.4,0.2,1.2,0.4,0.2,1.4,0.4,0.2,1.4,0.4,0.2,0.2,0,0,0,0,0,buffer,C_Ug,0.186160841,-0.158849227,-0.1461411,-0.361192264,-0.120005437 +185,R_5PhPwmbBbDD0cg1,67 - 73,American,Female,Female,High School (or equivalent),71,03VPfPs,01PAST,10,01ITEM,0.125,0,1,3,2,3,3,1,3,-3,3,-3,1,3,3,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,2,3,2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,-0.2,0,0,-0.2,0,buffer,0,0,0,-0.066666667,-0.066666667,buffer,0,0,0,0,0,0,0.4,0,0.2,0.4,0,0.2,0.4,0,0.2,0.4,0.2,0.2,0,0,0,0,0.2,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.361192264,-0.177186751 +186,R_7E8J8aXWSvyuMcp,46 - 52,Canadian,Male,Male,College Diploma/Certificate,50,03VPfPs,01PAST,5,02DGEN,0.25,0,0.666666667,2,3,3,3,1,-1,1,3,-2,-1,2,3,2,1,2,2,3,3,3,2,-1,1,3,1,-1,3,3,2,2,2,2,3,3,3,2,-1,1,3,1,1,2,3,2,2,2,2,3,3,3,1,-1,1,3,1,1,3,3,3,2,2,2,3,3,3,1,-1,1,3,1,1,3,3,3,2,2,1,2,2,2,2,2,2,1,2,2,2,2,0,0,0,0,1,0,0,0,3,0,1,0,0,1,0,0,0,0,0,1,0,0,0,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,3,2,1,0,1,1,0,0,0,0,0,0,0,0,0,3,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,0,0,0,-2,0,0,-1,0,0,0,0,0,0,1,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,buffer,-1,1,0,0,0,0,buffer,0.2,-0.4,-0.2,0.2,0,-0.4,0,0.4,0.2,buffer,0,0,-0.133333333,-0.066666667,0.2,buffer,1,0,0,0,1,0,0.2,0.6,0.4,0.2,1,0.2,0,1,0.6,0,1,0.6,0,0.4,0.2,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.434734729,-0.361192264,-0.249335158 +187,R_3B2U7tAAjoETGYF,53 - 59,Canadian,Male,Male,University - Undergraduate,55,01PfPsV,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,2,2,1,2,-1,1,2,-3,1,1,0,3,0,3,2,2,2,0,2,-2,1,2,-2,2,1,0,2,0,3,2,2,2,0,3,-2,1,2,-3,2,1,0,2,0,3,2,2,2,1,2,-2,0,1,-2,1,1,0,2,0,3,2,2,2,1,1,-1,1,1,-2,1,1,0,3,0,3,3,3,3,3,3,3,3,3,3,5,4,3,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,buffer,0,0,0,1,0,0,-1,-1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,-1,-1,1,0,0,1,0,0,0,0,0,0,0,-1,-1,0,1,0,0,0,-1,0,0,buffer,0,0,0,-2,-1,0,buffer,0.2,-0.2,0,0.2,0,0.2,0,-0.2,-0.2,buffer,0,-1,0,0.133333333,-0.133333333,buffer,0,0,0,2,1,0,0.2,0.6,0.2,0.4,0.4,0.2,0,0.8,0.2,0.2,0.4,0,0.2,0.2,0,0.2,0.4,0.2,buffer,C_Ug,-0.042564413,-0.687266041,-0.1461411,0.019597567,-0.214093497 +188,R_7yKZHZ7lGhrwOOt,67 - 73,American,Female,Female,University - Graduate (Masters),69,01PfPsV,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,2,2,2,-1,3,3,-3,2,-3,3,2,2,2,3,2,2,3,2,-1,3,3,-3,2,-3,3,3,1,2,2,2,3,3,2,-3,3,3,-3,2,-3,2,1,3,3,1,3,2,2,2,3,3,3,-3,3,-3,3,3,3,2,1,3,3,2,2,2,3,2,-3,3,-3,3,3,2,2,0,3,3,3,3,2,2,2,3,3,3,4,4,4,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,0,2,0,0,0,0,0,1,1,1,1,2,1,0,0,0,4,0,0,0,1,0,0,1,1,0,2,1,1,0,0,3,0,1,0,1,0,0,1,0,0,3,1,1,0,0,2,0,0,0,0,0,1,2,2,1,1,1,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,buffer,0,1,0,-4,0,0,0,-1,0,0,0,0,0,-1,-1,0,1,0,-1,0,-1,0,-1,0,1,0,1,1,-1,0,0,0,0,1,0,-1,0,0,0,1,2,1,1,0,1,buffer,0,0,0,-2,-2,-2,buffer,-0.6,-0.2,-0.4,0,-0.2,0.2,0.2,0,1,buffer,0,-2,-0.4,0,0.4,buffer,1,1,1,1,1,1,0.2,0,0.6,0.8,0.2,1.2,0.8,0.2,1,0.8,0.4,1,0.6,0.2,1.4,0.4,0.2,0.4,buffer,grad_prof,-0.042564413,-1.215682856,-1.011921991,-0.23426232,-0.626107895 +189,R_7qqRHW9GNmsUdS0,46 - 52,Canadian,Female,Female,University - Undergraduate,52,02PsVPf,01PAST,10,02DGEN,-0.25,0,1,3,3,3,1,3,-2,-2,3,0,1,2,0,3,2,1,3,3,3,1,3,-2,-2,3,0,2,2,0,3,3,2,3,3,3,1,3,-3,-2,3,1,3,2,0,3,3,2,3,3,3,1,3,-2,-2,3,-2,2,2,0,3,2,2,3,3,3,1,3,-2,-2,3,0,2,2,0,3,2,2,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,1,2,0,0,0,1,1,0,0,0,0,0,0,0,0,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,-2,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,-1,1,0,0,0,0,0,buffer,0,1,0,0,0,0,buffer,0,-0.4,0.2,0,0.6,0.2,0,0.2,0,buffer,0.333333333,0,-0.066666667,0.266666667,0.066666667,buffer,0,0,0,0,1,0,0,0.2,0.4,0,0.8,0.4,0,0.6,0.2,0,0.2,0.2,0,0.6,0,0,0.4,0,buffer,C_Ug,0.186160841,-0.158849227,-0.290437916,0.273457456,0.002582789 +190,R_7hmBFCmcORt4UfG,53 - 59,Canadian,Male,Male,College Diploma/Certificate,58,02PsVPf,02FUT,10,01ITEM,0,0,1,2,2,2,1,2,-2,-2,2,0,0,1,0,1,-2,3,2,3,3,-1,3,0,-2,2,-1,1,1,0,0,-1,2,1,2,3,-1,2,-2,-1,2,1,0,-1,1,1,1,2,3,3,0,0,3,0,-3,2,0,1,3,0,0,-3,3,3,3,-3,0,3,0,-3,3,-3,3,3,0,0,-3,3,5,8,7,6,8,9,6,5,6,10,10,10,0,1,1,2,1,2,0,0,1,1,0,0,1,1,1,1,0,1,2,0,0,1,0,1,0,2,1,0,3,1,1,1,2,1,1,2,1,0,0,1,2,0,1,1,0,1,1,5,1,1,2,1,1,3,3,2,0,1,1,0,1,1,0,0,1,2,1,0,2,1,2,1,1,2,0,0,0,3,0,0,0,0,1,3,2,0,0,0,0,0,buffer,-1,0,-1,1,0,0,-1,0,1,0,-2,0,0,0,1,0,-1,-4,1,-1,-2,0,-1,-2,-3,0,1,-1,2,1,1,1,-3,0,1,2,1,-1,-1,-1,2,1,1,2,0,buffer,-1,3,1,-4,-2,-1,buffer,-0.2,0,-0.2,-1,-1.6,0.6,0,0,1.2,buffer,1,-2.333333333,-0.133333333,-0.666666667,0.4,buffer,1,0,2,4,5,4,1,0.8,0.6,0.8,0.4,1.4,1.2,0.8,0.8,1.8,2,0.8,0.6,1.2,1.2,0.6,1.2,0,buffer,C_Ug,0.643611349,-1.391821794,-0.434734729,-1.503561759,-0.671626733 +191,R_11iSXUsPSc4zuZk,60 - 66,American,Male,Male,College Diploma/Certificate,62,01PfPsV,01PAST,5,01ITEM,-0.5,0,0.666666667,2,3,3,1,3,3,-3,3,-2,1,2,3,3,-3,2,3,3,3,3,3,3,-3,3,-3,2,3,2,2,-3,2,1,2,2,1,2,3,-3,2,-3,2,2,2,2,-3,2,2,2,2,2,3,2,-2,2,-2,2,2,2,2,-3,2,2,2,2,2,2,2,-3,2,-3,1,2,2,2,-3,2,1,2,1,3,2,3,2,3,2,1,1,2,1,0,0,2,0,0,0,0,1,1,1,1,1,0,0,1,1,1,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,0,1,1,1,1,1,0,1,1,0,0,1,1,0,0,2,1,1,2,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,buffer,1,-1,-1,1,0,-1,-1,-1,1,0,1,0,0,0,0,1,0,0,-1,0,-1,0,0,0,1,0,0,0,0,0,2,1,1,2,0,0,-1,1,-1,-1,1,0,0,0,0,buffer,-1,-1,-1,2,1,1,buffer,0,-0.4,0.2,0,0,0,1.2,-0.4,0.2,buffer,-1,1.333333333,-0.066666667,0,0.333333333,buffer,2,0,2,1,2,0,0.6,0.4,0.6,0.8,0.6,0.4,0.6,0.8,0.4,0.8,0.6,0.4,1.4,0.2,0.2,0.2,0.6,0,buffer,C_Ug,-0.728740176,0.545706526,-0.290437916,-0.23426232,-0.176933471 +192,R_1dawVCdr211mxwY,25 - 31,Canadian,Female,Female,High School (or equivalent),31,02PsVPf,01PAST,5,01ITEM,0.125,0,0,1,1,-1,-1,-1,-1,0,0,0,1,-2,-3,2,-1,3,0,2,1,1,-1,1,2,1,3,1,3,-2,3,1,3,1,2,2,1,-1,-3,1,-2,3,1,2,-1,1,1,3,0,0,0,0,0,0,0,0,0,1,0,-3,2,0,3,0,0,0,0,0,0,0,0,0,1,0,-3,2,0,3,5,6,6,6,9,8,5,5,5,5,5,5,1,1,2,2,0,2,2,1,3,0,5,1,1,2,0,0,1,3,2,0,2,1,2,3,0,4,2,1,2,0,1,1,1,1,1,1,0,0,0,0,2,0,0,1,0,1,1,1,1,1,1,0,0,0,0,2,0,0,1,0,1,0,1,0,0,4,1,3,0,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,1,1,-1,1,2,1,3,0,3,1,1,1,0,-1,0,2,1,-1,1,1,2,3,0,2,2,1,1,0,1,0,1,0,0,4,1,3,0,0,1,1,2,0,0,buffer,0,1,1,1,4,3,buffer,0.2,1.4,1.2,0.2,1.4,1.2,0.4,1.6,0.8,buffer,0.666666667,2.666666667,0.933333333,0.933333333,0.933333333,buffer,1,3,2,0,0,0,1.2,1.6,1.8,1.2,1.6,1.8,1,0.2,0.6,1,0.2,0.6,0.4,1.6,0.8,0,0,0,buffer,HS_TS,0.414886095,1.25026228,1.874014312,1.542756894,1.270479895 +193,R_1frrUBBeAJk9Qhn,46 - 52,Canadian,Female,Female,High School (or equivalent),47,03VPfPs,02FUT,5,01ITEM,0.5,0.333333333,0.333333333,-3,3,-1,-2,3,-2,-1,1,1,0,0,0,0,0,3,-2,3,-3,-3,3,3,3,3,3,3,2,2,3,3,3,-1,3,1,-3,3,3,3,3,3,3,2,2,3,3,3,-2,3,0,0,3,0,0,0,1,1,1,1,1,0,3,1,3,1,1,3,0,0,1,1,1,3,1,2,3,3,5,4,7,6,6,6,4,5,2,2,2,2,1,0,2,1,0,5,4,2,2,3,2,2,3,3,0,2,0,2,1,0,5,4,2,2,3,2,2,3,3,0,1,0,1,2,0,2,1,1,0,1,1,1,1,0,0,4,0,2,3,0,2,1,0,0,1,3,1,2,3,0,1,0,4,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,1,0,0,2,0,1,3,0,buffer,0,0,1,-1,0,3,3,1,2,2,1,1,2,3,0,-2,0,0,-2,0,3,3,2,2,2,-1,1,1,0,0,-2,0,3,-1,0,0,0,-1,0,0,-2,0,-1,-3,0,buffer,1,-1,5,4,4,4,buffer,0,2.2,1.4,-0.8,2.4,0.2,0,-0.2,-1.2,buffer,1.666666667,4,1.2,0.6,-0.466666667,buffer,1,2,1,2,3,0,0.8,3.2,2,1,3.2,2,0.8,1,0.6,1.8,0.8,1.8,1,0,0,1,0.2,1.2,buffer,HS_TS,1.101061858,1.954818032,2.451201574,0.908107175,1.60379716 +194,R_7fCEITMfc7d3LHj,53 - 59,American,Male,Male,University - Undergraduate,59,03VPfPs,02FUT,5,01ITEM,-0.375,0,1,0,2,2,1,0,-1,-2,3,-2,1,3,-2,3,-3,3,1,2,2,1,0,-3,-3,3,-3,2,3,-2,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-2,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-3,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,1,0,1,1,0,0,0,0,0,2,0,0,1,0,2,1,0,1,1,0,0,0,0,0,2,0,0,1,0,2,1,0,1,1,0,1,0,0,0,2,0,0,1,0,2,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,buffer,-1,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0,-0.2,0,0,0,0.4,0,-0.2,buffer,0,0,-0.2,0,0.066666667,buffer,0,0,0,0,0,0,0.2,1,0,0.6,1,0,0.6,1,0.2,0.6,1,0,0.4,0,0,0,0,0.2,buffer,C_Ug,-0.042564413,-0.158849227,-0.579031545,-0.23426232,-0.253676876 +195,R_6FrmnaHETS1ccrk,46 - 52,Canadian,Female,Female,College Diploma/Certificate,50,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,2,1,1,1,2,-2,-1,2,0,-1,1,0,1,-1,0,-1,0,1,0,0,-2,0,1,0,1,1,1,1,1,1,0,0,2,1,0,-1,0,1,0,-1,2,1,1,1,0,1,1,2,1,1,-3,-2,2,1,-2,1,1,0,-1,0,1,1,2,2,0,-2,-2,1,0,-1,2,1,1,-1,1,3,4,3,4,4,4,1,3,1,3,1,3,3,1,0,1,2,0,1,1,0,2,0,1,0,2,1,2,1,1,0,2,1,1,1,0,0,1,1,0,2,0,1,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,0,1,1,2,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,2,1,0,0,0,1,0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,buffer,2,1,-1,1,1,-1,0,1,-1,1,0,0,-1,2,1,1,1,0,-1,0,1,0,0,0,0,0,0,0,2,-1,1,0,1,0,-1,0,0,-1,-1,1,0,0,-1,0,0,buffer,2,1,2,1,3,1,buffer,0.8,0,0.4,0.2,0.2,0.2,0.2,-0.2,-0.2,buffer,1.666666667,1.666666667,0.4,0.2,-0.066666667,buffer,1,0,1,2,2,2,1.4,0.8,0.8,1.2,0.6,0.8,0.6,0.8,0.4,1,0.4,0.6,0.6,0.6,0.4,0.4,0.8,0.6,buffer,C_Ug,1.101061858,0.721845465,0.719639792,0.146527512,0.672268657 +196,R_1dzLe6ylnvHseSi,25 - 31,American,Female,Female,University - Graduate (Masters),29,02PsVPf,01PAST,10,02DGEN,0.5,1,0,3,3,3,3,3,0,-1,2,-2,3,1,-1,1,-2,2,3,3,3,3,3,0,-3,2,-3,2,1,2,2,-3,2,0,0,3,3,3,0,-3,1,-3,2,1,3,3,2,2,3,3,3,3,3,0,-3,1,-3,2,2,1,1,-3,2,2,3,3,2,2,0,-3,2,-3,2,1,1,1,-3,1,1,2,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,2,0,1,1,0,3,1,1,0,3,3,0,0,0,0,2,1,1,1,0,4,2,4,0,0,0,0,0,0,0,2,1,1,1,1,2,0,1,0,1,0,0,1,1,0,2,0,1,1,0,2,0,1,1,3,3,0,0,0,0,0,1,0,0,0,1,1,5,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,1,buffer,0,0,0,0,0,0,0,-1,0,0,-1,1,1,0,0,2,3,0,-1,-1,0,0,1,0,0,0,2,2,3,-1,2,3,0,-1,-1,0,0,0,0,0,-1,1,1,5,-1,buffer,0,1,0,0,0,0,buffer,0,-0.2,0.2,0.6,0.2,1.2,0.6,0,1,buffer,0.333333333,0,0,0.666666667,0.533333333,buffer,0,1,0,0,0,0,0,0.8,1,1.2,1,2,0,1,0.8,0.6,0.8,0.8,1.2,0.2,1.4,0.6,0.2,0.4,buffer,grad_prof,0.186160841,-0.158849227,-0.1461411,1.035037119,0.229051908 +197,R_5z7ZsDfonFF4A81,46 - 52,Canadian,Male,Male,College Diploma/Certificate,48,01PfPsV,01PAST,10,01ITEM,0.25,1,0,-1,1,1,0,2,0,-1,0,0,1,0,3,2,0,2,-3,1,2,-2,0,0,0,0,0,0,0,1,1,0,1,-3,1,1,-1,0,0,1,0,0,1,-1,1,0,0,0,-3,1,2,-1,2,0,0,0,1,1,2,0,1,0,0,-3,1,2,-1,2,0,0,0,0,0,2,3,2,1,0,5,5,5,5,5,5,5,5,5,5,5,5,2,0,1,2,2,0,1,0,0,1,0,2,1,0,1,2,0,0,1,2,0,2,0,0,0,1,2,2,0,2,2,0,1,1,0,0,1,0,1,0,2,3,1,0,2,2,0,1,1,0,0,1,0,0,1,2,0,0,1,2,0,0,1,1,0,0,1,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,3,1,1,0,buffer,0,0,0,1,2,0,0,0,-1,1,-2,-1,0,0,-1,0,0,-1,0,2,0,1,0,0,-1,-1,2,2,-1,0,0,0,1,1,0,0,1,0,-1,0,1,-3,0,-1,1,buffer,0,0,0,0,0,0,buffer,0.6,0,-0.8,0.2,0,0.4,0.4,0,-0.4,buffer,0,0,-0.066666667,0.2,0,buffer,0,0,0,0,0,0,1.4,0.4,0.8,1,0.4,1.4,0.8,0.4,1.6,0.8,0.4,1,0.4,0.4,0.6,0,0.4,1,buffer,C_Ug,-0.042564413,-0.158849227,-0.290437916,0.146527512,-0.086331011 +198,R_3puR6zIktNYt6ru,32 - 38,Canadian,Male,Male,University - Undergraduate,33,03VPfPs,01PAST,5,01ITEM,-0.5,1,0,3,3,2,1,3,2,1,3,0,3,3,2,3,1,3,1,3,2,3,3,-3,3,1,3,-3,3,3,0,2,3,1,3,1,3,3,1,3,2,2,-2,1,0,-2,3,-3,3,3,1,3,3,3,-3,1,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,-2,3,10,8,10,8,8,8,8,8,8,0,8,8,2,0,0,2,0,5,2,2,3,6,0,1,3,1,0,2,0,1,2,0,1,2,1,2,5,2,2,5,2,6,0,0,1,2,0,1,4,2,3,0,0,1,0,1,0,0,0,1,2,0,1,4,0,3,0,0,1,0,3,0,0,0,1,0,0,4,0,1,1,1,2,3,2,1,6,0,0,2,0,0,0,0,2,0,0,0,0,0,2,0,buffer,2,0,-1,0,0,4,-2,0,0,6,0,0,3,0,0,2,0,0,0,0,0,-2,1,-1,5,2,1,5,-1,6,0,0,-1,0,0,4,0,-1,1,1,2,3,2,-1,6,buffer,2,0,2,8,0,0,buffer,0.2,1.6,0.6,0.4,0.6,2.6,-0.2,1,2.4,buffer,1.333333333,2.666666667,0.8,1.2,1.066666667,buffer,2,0,2,8,0,0,0.8,3.6,1,1,2.2,3.4,0.6,2,0.4,0.6,1.6,0.8,0.2,1.4,2.8,0.4,0.4,0.4,buffer,C_Ug,0.872336603,1.25026228,1.585420683,2.05047667,1.439624059 +199,R_7oIpKmsCj6LC4Pq,67 - 73,American,Male,Male,University - Undergraduate,73,03VPfPs,02FUT,5,02DGEN,-0.375,1,0,3,2,3,2,2,-3,-3,3,-2,1,2,-3,1,-3,3,3,2,3,1,2,-3,-2,3,-2,1,2,-3,2,-3,3,3,1,3,0,1,-3,-2,3,-3,1,2,-1,1,-3,3,3,2,3,2,1,-3,-2,2,-1,0,1,-3,2,-3,3,3,2,3,3,0,-3,-1,1,-1,0,1,-3,1,-3,3,1,1,1,1,1,1,8,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,1,0,1,0,1,0,0,2,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,2,0,2,2,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,2,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,buffer,0,0,0,1,-1,0,0,-1,-1,-1,-1,0,0,0,0,0,1,0,1,-1,0,-1,-2,0,-1,-1,2,0,0,0,0,1,0,0,0,0,-1,-1,1,0,0,2,0,0,0,buffer,-7,0,0,0,0,0,buffer,0,-0.6,-0.2,0.2,-0.8,0.2,0.2,-0.2,0.4,buffer,-2.333333333,0,-0.266666667,-0.133333333,0.133333333,buffer,0,0,0,7,0,0,0.2,0.2,0.2,0.8,0.4,0.4,0.2,0.8,0.4,0.6,1.2,0.2,0.6,0.2,0.6,0.4,0.4,0.2,buffer,C_Ug,-1.643641192,-0.158849227,-0.723328361,-0.488122207,-0.753485247 +200,R_18M7dRJ21zAoFu4,53 - 59,American,Female,Female,College Diploma/Certificate,59,03VPfPs,02FUT,5,01ITEM,-0.75,0.333333333,0.666666667,1,2,0,-3,3,0,-3,3,-3,1,1,1,3,0,2,1,3,-2,-3,3,-1,0,1,1,-1,0,2,2,0,1,1,2,1,-3,2,1,-2,3,-2,1,0,3,3,2,0,0,2,1,-1,3,0,-2,2,-3,0,0,2,2,-2,2,1,1,1,1,1,0,-1,1,-2,0,0,2,2,-2,2,3,4,3,4,5,5,2,2,4,6,5,3,0,1,2,0,0,1,3,2,4,2,1,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,2,0,2,2,1,0,1,2,0,0,1,1,0,1,1,1,1,2,0,0,1,1,4,2,0,2,2,1,1,1,1,1,2,0,0,1,3,0,1,2,2,2,3,2,0,1,1,2,1,1,1,0,2,2,0,1,1,1,0,0,0,0,0,0,buffer,-1,1,1,-2,0,1,2,1,4,1,0,0,0,-2,1,0,-1,0,-4,-1,1,-1,-2,0,-1,0,1,-1,0,2,-1,0,3,-2,-1,2,1,1,2,2,0,1,1,2,1,buffer,1,2,-1,-2,0,2,buffer,-0.2,1.8,-0.2,-1.2,-0.6,0.4,-0.2,1.6,1,buffer,0.666666667,0,0.466666667,-0.466666667,0.8,buffer,1,1,2,4,3,1,0.6,2.4,0.8,0.4,0.6,1.4,0.8,0.6,1,1.6,1.2,1,1,2.2,1,1.2,0.6,0,buffer,C_Ug,0.414886095,-0.158849227,0.863936607,-1.122771927,-0.000699613 +201,R_5ODgAa2BmCZ00qO,46 - 52,Canadian,Female,Female,University - Graduate (Masters),49,02PsVPf,02FUT,10,02DGEN,0.625,1,0,3,1,1,0,2,0,-2,3,-3,0,3,0,2,-2,3,2,1,1,-3,2,1,-3,3,-3,1,3,0,1,-3,3,3,2,0,-2,2,3,-2,3,-2,2,3,-1,3,0,3,2,1,1,0,2,2,-3,3,-3,1,3,1,2,-3,3,2,1,1,1,1,1,-3,3,-3,0,3,0,3,-3,3,1,1,0,3,2,1,2,0,0,3,0,0,1,0,0,3,0,1,1,0,0,1,0,0,1,1,0,0,1,1,2,0,3,0,0,1,2,0,1,1,2,0,1,0,0,0,0,2,1,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,0,2,1,0,1,1,0,1,2,3,0,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,buffer,0,0,0,3,0,-1,0,0,0,0,0,-1,1,0,0,-1,1,1,1,-1,2,-1,0,1,2,0,1,0,1,0,1,1,1,0,-1,1,1,0,1,0,0,0,1,3,0,buffer,-1,1,0,0,2,1,buffer,0.6,-0.2,0,0.2,0.8,0.4,0.4,0.6,0.8,buffer,0,1,0.133333333,0.466666667,0.6,buffer,2,1,1,1,0,0,0.8,0.6,0.4,0.8,1.2,0.8,0.2,0.8,0.4,0.6,0.4,0.4,0.8,1,1.2,0.4,0.4,0.4,buffer,grad_prof,-0.042564413,0.369567588,0.14245253,0.654247288,0.280925748 +202,R_5n3WtCtZeWxVeq5,39 - 45,American,Male,Male,University - Undergraduate,40,01PfPsV,01PAST,10,01ITEM,0.5,0,1,3,2,3,2,3,1,1,-1,0,1,0,1,0,-1,-1,0,1,1,0,2,2,-1,0,0,0,0,-1,1,1,0,0,3,0,1,1,1,-1,1,0,0,-1,0,0,-1,2,2,0,3,1,0,0,1,-1,0,1,-1,0,-1,2,0,2,3,0,1,1,1,-1,1,0,2,0,-1,0,1,2,9,8,8,7,8,9,7,10,7,8,9,8,3,1,2,2,1,1,2,1,0,1,0,2,1,2,1,3,1,3,1,2,0,2,2,0,1,1,1,0,0,3,1,2,0,1,3,1,0,0,0,0,1,1,1,3,1,1,1,3,1,2,0,2,2,0,1,0,2,0,2,3,0,2,1,1,1,1,0,1,0,0,1,1,1,2,2,0,3,3,0,1,1,2,2,0,1,1,1,1,1,2,buffer,2,-1,2,1,-2,0,2,1,0,1,-1,1,0,-1,0,2,0,0,0,0,0,0,0,0,0,1,-1,0,-2,0,0,-1,-2,1,0,0,-2,-1,0,-1,0,0,0,1,0,buffer,2,-2,1,-1,-1,1,buffer,0.4,0.8,-0.2,0.4,0,-0.4,-0.4,-0.8,0.2,buffer,0.333333333,-0.333333333,0.333333333,0,-0.333333333,buffer,2,0,1,1,1,1,1.8,1,1.2,2,1,1,1.4,0.2,1.4,1.6,1,1.4,1,0.4,1.4,1.4,1.2,1.2,buffer,C_Ug,0.186160841,-0.334988165,0.575342976,-0.23426232,0.048063333 +203,R_5FzigTMBbalmb1p,60 - 66,American,Male,Male,College Diploma/Certificate,66,02PsVPf,02FUT,5,01ITEM,-0.5,0.333333333,0.666666667,0,1,3,1,3,1,0,2,0,1,2,0,2,0,0,2,3,3,2,3,2,3,3,2,2,3,3,3,2,3,1,1,3,2,3,3,2,3,3,2,3,2,3,2,3,0,0,3,1,2,1,1,2,1,1,3,1,2,0,3,0,1,3,2,3,2,2,2,1,1,3,2,3,0,3,2,2,2,2,1,1,1,2,1,1,2,2,2,2,0,1,0,1,3,1,2,1,1,3,1,2,3,1,0,0,1,0,2,2,1,3,1,1,2,1,2,3,0,1,0,0,1,0,1,0,1,0,1,1,0,0,3,0,0,0,1,0,1,2,0,1,0,1,2,1,0,3,1,2,0,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,0,0,buffer,2,1,0,1,-1,1,2,1,1,1,0,2,1,2,0,1,0,0,0,0,1,0,1,2,1,0,0,0,2,0,1,1,0,-1,-1,0,0,0,1,0,0,0,-1,0,0,buffer,1,0,1,1,-1,-1,buffer,0.6,1.2,1,0.2,1,0.4,0,0.2,-0.2,buffer,0.666666667,-0.333333333,0.933333333,0.533333333,0,buffer,0,1,1,0,0,1,1,1.6,2,0.4,1.8,1.8,0.4,0.4,1,0.2,0.8,1.4,0.6,0.6,0.2,0.6,0.4,0.4,buffer,C_Ug,0.414886095,-0.334988165,1.874014312,0.78117723,0.683772368 +204,R_7eRyIUDyL1PsvVX,67 - 73,American,Male,Male,High School (or equivalent),73,03VPfPs,02FUT,10,02DGEN,0.25,0.666666667,0.333333333,-2,2,2,1,-1,3,1,3,1,1,2,3,3,-2,1,-2,2,2,-1,-2,2,1,3,1,-1,2,3,2,-3,1,-2,2,2,-1,0,2,1,3,1,0,2,3,3,-2,1,-2,3,3,3,-2,2,1,3,1,-1,2,3,3,-3,1,-2,2,2,3,-3,2,2,3,2,-1,2,3,3,-3,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,0,2,1,1,0,0,0,2,0,0,1,1,0,0,0,0,2,1,1,0,0,0,1,0,0,0,0,0,0,1,1,2,1,1,0,0,0,2,0,0,0,1,0,0,0,0,2,2,1,1,0,1,2,0,0,0,1,0,0,0,0,0,2,0,0,0,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,buffer,0,-1,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,-1,0,-1,0,-1,-1,0,0,0,-1,0,0,-1,-1,0,1,0,-1,0,-1,1,0,0,1,1,0,buffer,0,0,1,0,0,0,buffer,-0.4,0,0.2,-0.2,-0.6,-0.2,-0.2,-0.2,0.4,buffer,0.333333333,0,-0.066666667,-0.333333333,0,buffer,0,0,0,0,0,1,0.6,0.6,0.4,0.6,0.4,0,1,0.6,0.2,0.8,1,0.2,0.4,0.2,0.4,0.6,0.4,0,buffer,HS_TS,0.186160841,-0.158849227,-0.290437916,-0.868912038,-0.283009585 +205,R_6D7AAGi8XfqcB7w,32 - 38,American,Female,Female,University - Graduate (Masters),38,01PfPsV,01PAST,10,02DGEN,-0.375,0,1,2,2,2,1,3,-3,-3,2,3,0,1,0,0,1,1,2,2,2,1,2,-3,-3,2,3,0,1,0,0,1,1,2,2,2,2,1,-3,-3,2,3,0,1,0,0,1,1,2,2,2,1,2,-3,-3,2,1,0,1,0,1,0,1,2,2,2,0,2,-3,-2,2,2,0,1,1,0,-1,1,0,0,1,2,0,7,1,1,0,2,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,2,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,1,0,buffer,0,0,0,0,0,0,0,0,-2,0,0,0,-1,-1,0,0,0,0,0,1,0,-1,0,-1,0,0,-1,0,-2,0,0,0,0,0,1,0,-1,0,-1,0,0,-1,-1,-1,0,buffer,-1,-1,1,0,-2,6,buffer,0,-0.4,-0.4,0.2,-0.4,-0.6,0.2,-0.4,-0.6,buffer,-0.333333333,1.333333333,-0.266666667,-0.266666667,-0.266666667,buffer,2,0,6,1,1,1,0.2,0,0,0.6,0,0,0.2,0.4,0.4,0.4,0.4,0.6,0.4,0,0,0.2,0.4,0.6,buffer,grad_prof,-0.271289667,0.545706526,-0.723328361,-0.741982096,-0.297723399 +206,R_5CBBrH7qOkchQSU,53 - 59,American,Female,Female,University - Graduate (Masters),59,03VPfPs,01PAST,10,01ITEM,1,0.333333333,0.666666667,2,3,3,-2,-2,2,-3,3,-3,1,3,1,2,2,3,3,3,3,-2,-2,2,-3,2,-2,2,1,0,1,1,1,2,2,3,-2,-2,2,-3,3,-2,1,3,2,2,2,2,2,3,2,2,3,3,2,2,2,2,3,2,2,1,3,3,3,3,-2,-2,2,-2,2,-2,2,3,3,3,3,3,1,1,1,1,1,2,1,1,2,1,1,1,1,0,0,0,0,0,0,1,1,1,2,1,1,1,2,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,4,5,1,5,1,5,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,1,0,2,1,1,0,1,1,0,0,0,0,0,1,0,1,2,2,1,1,1,1,0,1,4,5,1,4,0,4,0,0,1,1,2,0,buffer,1,0,-1,-4,-5,-1,-5,0,-4,0,2,0,1,0,2,-1,1,0,0,0,0,-1,-1,0,-1,0,-1,-1,-1,1,0,1,-1,-4,-5,-1,-4,1,-4,1,2,1,0,-1,1,buffer,0,0,-1,0,0,1,buffer,-1.8,-2,1,0,-0.6,-0.4,-1.8,-1.4,0.6,buffer,-0.333333333,0.333333333,-0.933333333,-0.333333333,-0.866666667,buffer,0,0,1,0,0,1,0.2,0.6,1.4,0.2,0.2,0.4,2,2.6,0.4,0.2,0.8,0.8,0.4,0.4,1.4,2.2,1.8,0.8,buffer,grad_prof,-0.271289667,0.017289712,-2.166296512,-0.868912038,-0.822302126 +207,R_3OvH2dSZs2LsOTD,67 - 73,American,Male,Male,Trade School (non-military),72,02PsVPf,01PAST,10,01ITEM,-1,0,1,1,3,3,-1,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,2,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,0,0,0.2,0,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0.2,0,0,0.4,0,0,0.2,0,0,0.2,0,0,0.2,0,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.107332375,-0.113721779 +208,R_1q8TVZ4f8FHZQzc,53 - 59,American,Female,Female,University - Graduate (Masters),54,02PsVPf,02FUT,5,02DGEN,-0.25,0,1,2,3,3,1,3,-2,2,3,-3,3,3,-3,3,-3,3,2,3,2,2,3,1,1,3,-3,3,3,-3,3,1,3,3,3,1,1,3,2,-1,3,-3,3,3,-3,3,3,3,1,3,2,2,3,-2,3,3,-3,3,2,-3,3,-3,3,2,2,2,3,3,-3,3,2,-2,2,2,-3,2,-3,3,3,7,0,5,6,0,4,8,0,5,4,0,0,0,1,1,0,3,1,0,0,0,0,0,0,4,0,1,0,2,0,0,4,3,0,0,0,0,0,0,6,0,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,1,2,0,1,1,1,1,1,1,0,1,0,0,1,0,1,1,0,1,2,0,0,0,0,0,0,2,0,1,1,0,1,0,1,0,1,1,1,0,0,1,0,0,buffer,-1,0,0,0,0,3,0,0,0,0,-1,0,0,4,0,1,-1,1,-2,0,3,2,-1,-1,-1,-1,0,-1,6,0,0,-1,1,0,0,0,2,-1,-1,-1,0,0,-1,2,0,buffer,-1,-1,0,0,2,0,buffer,-0.2,0.6,0.6,-0.2,0.4,0.8,0,-0.2,0.2,buffer,-0.666666667,0.666666667,0.333333333,0.333333333,0,buffer,2,1,0,1,4,0,0.4,0.8,0.8,0.6,1.4,1.2,0.6,0.2,0.2,0.8,1,0.4,0.6,0.6,0.4,0.6,0.8,0.2,buffer,grad_prof,-0.500014922,0.19342865,0.575342976,0.400387399,0.167286026 +209,R_1iRvwVfXaAMLuPn,46 - 52,American,Male,Male,High School (or equivalent),50,02PsVPf,02FUT,5,02DGEN,0.375,0,1,2,2,3,2,-2,-2,0,2,0,2,0,1,2,0,3,2,2,2,2,-2,-1,1,1,0,1,0,1,2,0,2,1,1,1,1,-2,-1,2,1,1,1,0,1,2,0,2,3,3,1,0,0,-2,-1,1,-1,3,-2,1,2,0,3,3,3,1,1,0,0,-1,2,-1,3,0,1,2,0,3,6,4,4,6,7,7,8,8,6,6,10,9,0,0,1,0,0,1,1,1,0,1,0,0,0,0,1,1,1,2,1,0,1,2,1,1,1,0,0,0,0,1,1,1,2,2,2,0,1,1,1,1,2,0,0,0,0,1,1,2,1,2,2,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,2,0,1,0,0,2,0,0,0,0,buffer,-1,-1,-1,-2,-2,1,0,0,-1,0,-2,0,0,0,1,0,0,0,0,-2,-1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,-2,1,-1,1,0,-2,0,0,0,0,buffer,-2,-4,-2,0,-3,-2,buffer,-1.4,0,-0.2,-0.4,0.2,0.2,0.6,-0.2,-0.4,buffer,-2.666666667,-1.666666667,-0.533333333,0,-1.85E-17,buffer,0,3,3,2,2,3,0.2,0.8,0.2,1,1.2,0.2,1.6,0.8,0.4,1.4,1,0,0.8,0.4,0,0.2,0.6,0.4,buffer,HS_TS,-1.872366447,-1.039543918,-1.30051562,-0.23426232,-1.111672076 +210,R_1iP5RCoXNQ1O3r7,67 - 73,American,Male,Male,High School (or equivalent),73,03VPfPs,01PAST,5,02DGEN,0.125,0,1,2,2,2,2,2,0,0,2,1,1,3,3,3,3,3,2,2,2,2,2,0,-1,1,0,1,3,3,3,3,3,2,2,2,2,2,1,-1,2,0,1,3,3,3,3,3,1,1,2,1,1,0,-1,3,-1,0,3,3,3,3,3,1,2,2,2,1,0,-1,1,-1,-1,3,3,3,3,3,2,3,6,4,4,3,4,4,3,4,4,4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,0,1,1,0,1,1,2,1,0,0,0,0,0,1,0,0,0,1,0,1,1,2,2,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,2,0,1,0,0,0,0,0,buffer,-1,-1,0,-1,-1,0,0,0,-1,-1,0,0,0,0,0,-1,0,0,0,-1,1,0,-1,-1,-2,0,0,0,0,0,0,-1,0,-1,0,1,0,-1,0,-1,0,0,0,0,0,buffer,-2,-1,3,0,0,-1,buffer,-0.8,-0.4,0,-0.4,-0.6,0,-0.4,-0.2,0,buffer,0,-0.333333333,-0.4,-0.333333333,-0.2,buffer,2,1,3,0,0,1,0,0.6,0,0,0.6,0,0.8,1,0,0.4,1.2,0,0,0.4,0,0.4,0.6,0,buffer,HS_TS,-0.042564413,-0.334988165,-1.011921991,-0.868912038,-0.564596652 +211,R_1A7vesKafsefMtz,60 - 66,American,Female,Female,University - Graduate (Masters),65,03VPfPs,01PAST,5,01ITEM,0.125,0,0.666666667,3,3,2,-2,-3,-3,-3,2,-3,0,1,2,2,0,3,3,3,3,1,-2,-3,-3,3,0,1,2,2,2,0,3,3,3,3,2,1,-3,-3,3,-3,1,2,3,2,1,3,3,3,3,0,-3,-3,-3,0,-2,-1,0,2,2,0,3,3,3,2,0,-3,-3,-3,2,-3,0,2,2,3,1,3,6,7,3,2,1,6,0,2,1,1,2,1,0,0,1,3,1,0,0,1,3,1,1,0,0,0,0,0,0,1,4,4,0,0,1,0,1,1,1,0,1,0,0,0,1,2,0,0,0,2,1,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,3,0,0,0,3,0,0,1,0,1,0,0,0,1,0,0,0,0,2,1,1,2,0,1,1,0,buffer,0,0,0,1,1,0,0,-1,2,0,0,0,0,0,0,0,0,1,2,4,0,0,1,0,1,0,1,-1,0,0,0,0,-1,1,3,0,0,-2,2,-1,-2,1,-1,0,0,buffer,6,5,2,1,-1,5,buffer,0.4,0.2,0,1.4,0.4,0,0.6,-0.2,-0.4,buffer,4.333333333,1.666666667,0.2,0.6,-1.85E-17,buffer,4,6,3,1,0,0,1,1,0.2,1.8,0.4,0.6,0.6,0.8,0.2,0.4,0,0.6,0.8,0.6,0.4,0.2,0.8,0.8,buffer,grad_prof,2.930863891,0.721845465,0.286749346,0.908107175,1.211891469 +212,R_7GCFonsZvAHmC8J,67 - 73,American,Male,Male,Trade School (non-military),71,01PfPsV,02FUT,10,02DGEN,0.25,0,1,3,2,0,3,2,1,2,3,-3,2,3,2,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,3,2,0,3,2,1,1,3,-3,2,3,3,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,1,1,1,1,1,1,1,1,1,2,1,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,-1,0,0,buffer,0,0,0,0,-0.4,0,0,0.4,0,buffer,0,-0.333333333,0,-0.133333333,0.133333333,buffer,0,0,0,1,0,0,0,0.6,0.2,0,0.2,0.2,0,0.6,0.2,0,0.6,0.2,0,0.4,0,0,0,0,buffer,HS_TS,-0.042564413,-0.334988165,-0.1461411,-0.488122207,-0.252953971 +213,R_7oA8EmXF8TtRoml,60 - 66,American,Male,Male,College Diploma/Certificate,65,03VPfPs,01PAST,5,01ITEM,-0.5,0.666666667,0.333333333,-3,2,3,-3,2,-3,1,3,-3,-2,3,-3,3,0,3,-3,2,3,-3,2,-3,1,3,-3,-3,3,-3,3,0,3,-3,2,3,-3,2,-3,2,3,-3,0,3,-3,3,0,3,-3,2,3,-3,2,-3,1,3,-3,-3,3,-3,-3,-3,3,-3,2,3,0,1,-3,1,3,-3,-3,3,-3,-3,-3,3,0,0,0,0,0,0,0,0,5,1,0,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,6,3,0,0,0,0,3,1,0,0,0,0,1,0,0,6,3,0,0,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,-6,-3,0,0,0,0,-3,-1,0,1,0,0,1,0,0,-6,-3,0,0,0,0,-3,-1,0,1,0,0,3,0,0,0,0,0,buffer,0,0,-5,-1,0,-3,buffer,0,0,-1.8,-0.8,0.4,-1.8,-0.8,0.8,0,buffer,-1.666666667,-1.333333333,-0.6,-0.733333333,0,buffer,0,0,0,1,0,2,0,0.2,0,0,0.6,0,0,0.2,1.8,0.8,0.2,1.8,0,0.8,0,0.8,0,0,buffer,C_Ug,-1.186190685,-0.863404979,-1.444812436,-1.630491701,-1.28122495 +214,R_1wME4EFMQlwms1U,67 - 73,American,Male,Male,College Diploma/Certificate,72,02PsVPf,02FUT,10,01ITEM,0.125,1,0,2,-2,1,-2,1,-2,-2,3,-2,0,2,1,2,-2,2,2,-2,0,-3,1,0,-1,2,-1,1,2,1,2,-1,2,2,-2,0,-3,2,0,-2,2,0,0,2,1,1,0,2,2,-2,1,-1,0,0,-2,2,-1,0,2,1,1,-2,2,2,-3,1,0,-1,-2,0,2,0,-1,2,1,1,-3,2,3,3,3,3,3,3,2,2,2,2,2,1,0,0,1,1,0,2,1,1,1,1,0,0,0,1,0,0,0,1,1,1,2,0,1,2,0,0,0,1,2,0,0,0,0,1,1,2,0,1,1,0,0,0,1,0,0,0,1,0,2,2,0,2,1,2,1,0,0,1,1,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,2,2,0,1,1,0,0,0,1,0,buffer,0,0,1,0,-1,0,1,0,0,1,0,0,-1,1,0,0,-1,1,-1,-1,2,-2,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,-2,-1,0,0,0,0,0,1,0,0,buffer,1,1,1,1,1,2,buffer,0,0.4,0,-0.4,-0.2,0.2,-0.4,-0.6,0.2,buffer,1,1.333333333,0.133333333,-0.133333333,-0.266666667,buffer,0,0,0,0,0,1,0.4,1.2,0.2,0.6,1,0.6,0.4,0.8,0.2,1,1.2,0.4,0.2,0.6,0.4,0.6,1.2,0.2,buffer,C_Ug,0.643611349,0.545706526,0.14245253,-0.488122207,0.21091205 +215,R_1eRG5DfSgi9GUaO,67 - 73,American,Male,Male,University - Graduate (Masters),67,03VPfPs,01PAST,10,02DGEN,-0.75,1,0,1,2,1,-3,3,3,-2,3,-3,1,3,1,3,0,2,-1,-1,2,-3,3,3,-3,3,-3,2,3,1,3,3,2,-1,-1,2,-3,3,3,-3,3,-3,2,2,0,3,2,2,0,2,2,0,3,2,-3,3,-3,-1,3,1,3,0,3,1,2,2,2,3,2,-2,2,-2,-1,3,1,3,-1,3,1,1,1,1,2,1,1,1,1,2,3,1,2,3,1,0,0,0,1,0,0,1,0,0,0,3,0,2,3,1,0,0,0,1,0,0,1,1,1,0,2,0,1,0,1,3,0,1,1,0,0,2,0,0,0,0,1,0,0,1,5,0,1,0,1,1,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,2,0,0,1,1,1,0,0,0,0,1,0,buffer,1,3,0,-3,0,-1,0,0,0,-1,0,0,0,3,-1,2,3,0,-5,0,-1,1,-1,-1,-1,1,1,0,1,-1,-1,0,0,-2,0,0,-1,-1,-1,0,1,1,0,0,0,buffer,0,0,0,-1,-1,0,buffer,0.2,-0.4,0.4,0,-0.6,0.4,-0.6,-0.6,0.4,buffer,0,-0.666666667,0.066666667,-0.066666667,-0.266666667,buffer,0,1,0,1,2,0,1.2,0.4,0.6,1.2,0.4,0.8,1,0.8,0.2,1.2,1,0.4,0,0,0.6,0.6,0.6,0.2,buffer,grad_prof,-0.042564413,-0.511127103,-0.001844284,-0.361192264,-0.229182016 +216,R_6H0gQH94g701rde,67 - 73,American,Male,Male,College Diploma/Certificate,72,01PfPsV,01PAST,5,02DGEN,-0.125,0.666666667,0.333333333,3,1,2,-2,0,1,-2,1,-2,0,2,1,1,1,1,3,1,2,-2,0,1,-2,2,-2,1,2,1,1,1,1,3,1,2,-2,0,1,-2,1,-2,1,2,1,1,1,1,2,1,2,-1,0,1,-2,1,-2,0,2,1,1,1,1,2,1,2,-2,0,0,-2,1,-2,0,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,buffer,-1,0,0,-1,0,0,0,1,0,1,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,-1,0,1,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0.4,0,-0.2,0,0,-0.2,0,0,buffer,0,0,0,-0.066666667,-0.066666667,buffer,0,0,0,0,0,0,0,0.4,0,0,0.2,0,0.4,0,0,0.2,0.2,0,0,0.2,0,0.2,0.2,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.361192264,-0.177186751 +217,R_1bOYJHrIvhA1qkI,60 - 66,American,Male,Male,College Diploma/Certificate,60,01PfPsV,01PAST,10,02DGEN,0,0,1,2,2,2,-1,0,1,-2,1,1,-1,3,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,2,2,2,1,0,1,2,1,1,1,3,2,0,0,3,1,0,0,0,1,1,2,1,1,1,3,2,0,0,3,2,2,2,1,0,1,2,1,1,1,3,2,0,0,3,2,2,2,1,0,1,2,1,1,1,3,2,0,0,3,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-2,-2,-1,1,0,0,0,0,0,0,0,0,0,0,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,1.4,0,0,buffer,0,0,0,-0.333333333,0.466666667,buffer,0,0,0,0,0,0,1.4,1.2,1.6,0.4,1.2,1.6,1.4,1.2,1.6,1.4,1.2,1.6,1.4,0,0,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.868912038,-0.304116694 +218,R_6YJaPA1qoviEfuh,53 - 59,Canadian,Male,Male,High School (or equivalent),55,03VPfPs,02FUT,5,01ITEM,0.25,0,1,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,2,2,-1,2,2,-1,2,2,-1,1,1,2,2,2,2,1,2,-1,2,2,1,2,1,-1,1,1,2,2,2,2,1,2,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,1,2,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,1,2,1,2,1,2,2,2,1,2,8,1,1,2,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,2,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,-7,1,1,0,buffer,0,0.4,0,0.4,0.2,0,0.4,0.2,0,buffer,-2.333333333,0.666666667,0.133333333,0.2,0.2,buffer,1,0,1,0,1,6,0,0.4,0.2,0.4,0.2,0.2,0,0,0.2,0,0,0.2,0.4,0.2,0,0,0,0,buffer,HS_TS,-1.643641192,0.19342865,0.14245253,0.146527512,-0.290308125 +219,R_5cv0dxIpYqsp6ac,25 - 31,Canadian,Female,Female,College Diploma/Certificate,26,02PsVPf,02FUT,5,01ITEM,1,0.333333333,0.666666667,1,1,1,2,1,2,-3,2,-1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,8,8,8,8,8,8,8,7,7,8,8,8,1,1,1,2,1,2,3,2,1,1,1,0,0,0,1,1,1,1,1,1,1,3,2,1,1,1,0,0,0,1,1,1,1,2,1,2,3,2,1,0,1,0,0,0,0,0,1,0,2,1,1,3,2,1,1,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,buffer,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,-1,0,0,0,0,0,0,0,-1,0,0,0,-1,0,-1,1,0,0,0,0,0,-1,0,-1,0,0,-1,buffer,0,1,1,0,0,0,buffer,0,0.2,0.2,0.2,0,-0.2,-0.2,-0.2,-0.4,buffer,0.666666667,0,0.133333333,0,-0.266666667,buffer,0,0,0,0,1,1,1.2,1.8,0.4,1,1.6,0.4,1.2,1.6,0.2,0.8,1.6,0.6,0.2,0.2,0,0.4,0.4,0.4,buffer,C_Ug,0.414886095,-0.158849227,0.14245253,-0.23426232,0.04105677 +220,R_79XB8gz2JC1iSnD,53 - 59,American,Female,Female,University - Undergraduate,55,02PsVPf,02FUT,10,02DGEN,-0.125,0,1,2,2,3,3,3,1,-1,0,-1,1,-1,-2,2,-2,3,1,1,2,2,3,0,-1,-1,0,1,-1,-2,2,-2,3,2,2,2,2,3,0,2,-2,3,1,-1,-2,2,-2,3,2,1,2,2,3,-1,1,-1,1,-1,-1,0,2,-2,3,1,1,2,2,2,-1,1,0,1,-1,-1,-1,2,-2,3,6,6,6,6,6,6,6,6,6,6,6,6,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,1,1,0,1,3,2,4,0,0,0,0,0,0,0,1,1,1,0,2,2,1,2,2,0,2,0,0,0,1,1,1,1,1,2,2,0,2,2,0,1,0,0,0,1,1,0,0,0,0,3,1,3,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,buffer,1,0,0,0,0,-1,-2,0,-1,-2,0,-2,0,0,0,-1,-1,0,0,-1,-1,1,2,2,-2,0,-1,0,0,0,0,1,0,0,-1,0,3,0,3,0,0,-1,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,-1.2,-0.4,-0.6,0.4,-0.2,0,1.2,-0.2,buffer,0,0,-0.466666667,-0.133333333,0.333333333,buffer,0,0,0,0,0,0,0.8,0.6,0,0.4,2,0,0.6,1.8,0.4,1,1.6,0.2,0.4,1.4,0,0.4,0.2,0.2,buffer,C_Ug,-0.042564413,-0.158849227,-1.156218807,-0.488122207,-0.461438663 +221,R_3JmVHqU1m9lfEVm,60 - 66,American,Male,Male,High School (or equivalent),61,02PsVPf,02FUT,10,02DGEN,-0.125,0,1,-3,2,2,1,1,-2,0,-1,1,-1,0,1,1,-1,0,1,2,2,1,2,-3,1,3,0,1,0,1,2,1,0,1,2,2,1,2,-3,-3,-3,-3,-3,1,1,1,1,0,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,0,0,0,0,0,-3,-3,-3,-3,-3,0,0,0,0,0,1,1,5,1,10,10,10,10,10,10,10,10,4,0,0,0,1,1,1,4,1,2,0,0,1,2,0,4,0,0,0,1,1,3,2,4,2,1,0,0,2,0,0,5,5,4,4,1,3,2,4,2,3,4,4,2,3,3,2,2,1,1,1,3,2,4,2,0,1,1,1,0,0,0,0,0,0,0,4,6,3,4,1,0,1,0,0,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,buffer,4,-5,-5,-4,-3,0,-2,2,-3,0,-3,-4,-3,0,-3,1,-2,-2,-1,0,0,0,0,0,0,1,-1,-1,1,0,-3,-3,-3,-3,-3,0,4,6,3,4,-2,-3,-2,-3,-3,buffer,-9,-9,-5,-9,0,0,buffer,-2.6,-0.6,-2.6,-0.8,0,0,-3,3.4,-2.6,buffer,-7.666666667,-3,-1.933333333,-0.266666667,-0.733333333,buffer,0,9,5,0,0,0,1,1.8,0.6,1,2.4,0.6,3.6,2.4,3.2,1.8,2.4,0.6,0,3.4,0.4,3,0,3,buffer,HS_TS,-5.30324526,-1.744099671,-4.330748739,-0.741982096,-3.030018941 +222,R_7ocpEFQBuIkFrQi,53 - 59,Canadian,Male,Male,University - Undergraduate,57,03VPfPs,01PAST,5,01ITEM,0.125,0,1,1,2,2,1,-1,-1,-1,2,-2,0,3,-1,2,-2,3,2,2,2,1,-1,-2,-2,2,-2,-1,3,-1,2,-2,3,1,2,2,1,-2,-1,-2,2,-2,-1,3,-1,2,-2,3,1,2,2,1,1,-1,-2,2,-2,1,3,-1,2,-2,3,2,2,2,1,2,-2,-2,2,-2,1,3,-1,1,-2,3,1,1,1,1,1,1,1,3,1,3,2,3,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,0,1,0,0,1,0,0,0,0,0,1,0,0,0,3,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,buffer,1,0,0,0,-2,1,0,0,0,0,0,0,0,0,0,-1,0,0,0,-2,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,buffer,0,-2,0,-2,-1,-2,buffer,-0.2,0.2,0,-0.6,-0.2,-0.2,0,0,-0.2,buffer,-0.666666667,-1.666666667,0,-0.333333333,-0.066666667,buffer,0,0,0,2,1,2,0.2,0.6,0,0.2,0.4,0,0.4,0.4,0,0.8,0.6,0.2,0.4,0.2,0,0.4,0.2,0.2,buffer,C_Ug,-0.500014922,-1.039543918,-0.1461411,-0.868912038,-0.638652994 +223,R_714uyMPUcPfFZlz,46 - 52,American,Female,Female,College Diploma/Certificate,50,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,1,1,2,-1,3,2,-2,2,-2,1,1,1,3,0,1,1,2,2,-2,3,3,-2,3,-2,1,1,1,3,-1,1,2,2,2,-2,3,3,-2,3,-2,1,1,1,3,-1,1,2,1,2,-1,3,2,-2,2,-2,1,1,1,3,-1,1,2,1,2,0,3,2,-2,2,-2,1,1,0,3,-2,1,2,2,2,2,2,2,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,buffer,-1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,-1,0,1,0,0,-1,0,0,0,0,0,0,0,-1,0,-1,0,buffer,1,1,1,1,1,1,buffer,0.2,0.4,0,0.2,0.4,-0.4,0,0,-0.4,buffer,1,1,0.2,0.066666667,-0.133333333,buffer,0,0,0,0,0,0,0.4,0.4,0.2,0.6,0.4,0.2,0.2,0,0.2,0.4,0,0.6,0.2,0,0,0.2,0,0.4,buffer,C_Ug,0.643611349,0.369567588,0.286749346,-0.107332375,0.298148977 +224,R_6Axhyikn92aJ8E9,46 - 52,American,Female,Female,College Diploma/Certificate,50,01PfPsV,01PAST,10,01ITEM,0,0.666666667,0.333333333,-2,2,2,2,1,1,-3,3,-3,2,2,2,2,2,2,2,2,-2,2,2,1,-2,2,-2,1,2,2,2,2,2,0,2,2,2,2,2,-2,2,-1,1,2,2,2,2,2,-2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,9,6,0,0,0,0,0,0,0,4,0,4,0,1,0,1,1,1,1,0,0,0,0,0,2,0,0,0,1,1,1,1,2,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,2,0,0,0,1,1,5,1,5,0,0,0,0,0,0,2,0,4,0,0,1,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,4,0,4,0,0,0,0,0,0,buffer,4,0,4,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,-4,0,-3,1,0,0,0,0,0,0,0,4,0,0,1,-4,0,-3,0,0,0,0,0,0,buffer,0,0,0,9,6,0,buffer,1.6,0,0,0,-1.2,0,0.8,-1.2,0,buffer,0,5,0.533333333,-0.4,-0.133333333,buffer,9,6,0,0,0,0,1.8,0.8,0,0.6,1.2,0,0.2,0.8,0,0.6,2.4,0,1.2,0.4,0,0.4,1.6,0,buffer,C_Ug,-0.042564413,2.483234847,1.008233421,-0.995841983,0.613265468 +225,R_3QXCqXz1NiFkRBH,53 - 59,American,Male,Male,University - Undergraduate,59,01PfPsV,01PAST,10,02DGEN,0.25,0,1,2,2,2,1,3,1,0,3,0,0,2,3,2,1,3,2,2,2,0,3,1,1,3,0,0,3,3,3,2,2,2,2,2,-2,3,2,1,3,0,0,2,3,2,2,2,2,2,3,2,3,1,0,3,0,1,3,3,2,2,2,2,2,2,3,3,-1,0,2,0,-2,3,2,2,-2,2,1,1,1,1,2,1,1,1,1,1,2,7,0,0,0,1,0,0,1,0,0,0,1,0,1,1,1,0,0,0,3,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,2,0,2,0,1,0,2,1,1,0,3,1,0,0,0,2,0,1,0,0,0,0,1,0,1,0,0,0,0,1,1,0,2,0,1,0,3,0,1,0,4,0,buffer,0,0,-1,0,0,0,1,0,0,-1,0,0,1,0,0,0,0,0,1,0,-1,1,-1,0,-2,-1,-1,0,-2,0,0,0,-1,1,0,-1,0,-1,0,-3,1,-1,1,-4,0,buffer,0,0,0,0,0,-6,buffer,-0.2,0,0.2,0.2,-0.6,-0.8,0,-1,-0.6,buffer,0,-2,0,-0.4,-0.533333333,buffer,0,1,0,0,1,6,0.2,0.2,0.8,0.6,0.4,0.4,0.4,0.2,0.6,0.4,1,1.2,0.4,0.2,0.4,0.4,1.2,1,buffer,C_Ug,-0.042564413,-1.215682856,-0.1461411,-0.995841983,-0.600057588 +226,R_14h1U7357PGdWiR,60 - 66,American,Female,Female,University - Undergraduate,65,02PsVPf,02FUT,5,02DGEN,0.375,0,0.666666667,1,3,3,-3,3,0,-3,3,-3,0,3,3,3,2,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,1,3,3,-3,3,0,-3,3,-3,0,3,3,3,1,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0.4,0,0,0,0,0,-0.4,0,buffer,0,0,0.133333333,0,-0.133333333,buffer,0,0,0,0,0,0,0,0.4,0.2,0,0.4,0.2,0,0,0.2,0,0.4,0.2,0,0,0,0,0.4,0,buffer,C_Ug,-0.042564413,-0.158849227,0.14245253,-0.23426232,-0.073305857 +227,R_1JFLLvnXQTDl93D,60 - 66,American,Female,Female,High School (or equivalent),66,01PfPsV,01PAST,10,01ITEM,-0.125,0,1,3,3,2,1,1,-2,-2,3,-2,-1,2,1,2,0,3,3,3,3,-1,2,-3,-2,3,-3,0,2,3,2,1,3,3,3,3,-2,3,-3,-3,3,-2,0,2,2,1,1,3,3,3,3,2,-1,-2,-3,2,-2,0,3,3,1,-3,3,3,3,3,2,-2,-2,-3,2,-3,-2,3,3,3,-2,3,0,2,2,2,2,2,2,3,2,2,2,2,0,0,1,2,1,1,0,0,1,1,0,2,0,1,0,0,0,1,3,2,1,1,0,0,1,0,1,1,1,0,0,0,1,1,2,0,1,1,0,1,1,2,1,3,0,0,0,1,1,3,0,1,1,1,1,1,2,1,2,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,2,0,0,2,1,0,buffer,0,0,0,1,-1,1,-1,-1,1,0,-1,0,-1,-2,0,0,0,0,2,-1,1,0,-1,-1,0,-1,-1,0,-1,0,0,0,0,1,0,0,1,0,0,-2,0,1,-1,-1,0,buffer,-2,-1,0,0,0,0,buffer,0,0,-0.8,0.2,-0.2,-0.6,0.2,-0.2,-0.2,buffer,-1,0,-0.266666667,-0.2,-0.066666667,buffer,2,0,0,0,1,0,0.8,0.6,0.6,1.2,0.6,0.6,0.8,0.6,1.4,1,0.8,1.2,0.4,0.4,0.4,0.2,0.6,0.6,buffer,HS_TS,-0.728740176,-0.158849227,-0.723328361,-0.615052151,-0.556492479 +228,R_1NPt7vKUcOhfvbj,60 - 66,American,Male,Male,University - Undergraduate,60,03VPfPs,02FUT,5,02DGEN,-0.125,0,1,1,2,3,2,2,-2,-2,2,0,1,2,-1,2,0,2,1,2,3,2,2,-2,-2,2,-2,1,2,-2,1,-1,2,1,2,3,2,2,-2,-2,2,-2,1,2,-2,2,-1,2,1,2,3,2,2,-1,-2,2,-1,1,2,-2,2,-1,2,1,2,3,2,2,-2,-2,2,-1,1,2,2,2,-1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,2,0,0,1,1,1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,4,0,0,0,buffer,0,0,0,0,0,-1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,-2,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,-4,1,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0.2,0,0.2,-0.4,0,-0.2,-0.6,buffer,0,0,0.066666667,-0.066666667,-0.266666667,buffer,0,0,0,0,0,0,0,0.4,0.6,0,0.4,0.4,0,0.4,0.4,0,0.2,0.8,0,0,0.2,0,0.2,0.8,buffer,C_Ug,-0.042564413,-0.158849227,-0.001844284,-0.361192264,-0.141112547 +229,R_1wFFhetYJMzKoxU,60 - 66,American,Female,Female,Trade School (non-military),65,03VPfPs,01PAST,10,02DGEN,0.375,0.333333333,0.666666667,1,3,3,-1,3,2,-3,2,0,0,3,3,3,-1,3,2,3,3,-2,3,3,-3,3,-2,3,3,3,3,-2,3,2,3,3,-3,3,3,-3,3,-1,2,3,3,2,-2,3,2,3,3,1,3,3,-2,3,-2,2,3,3,3,-2,3,2,3,3,1,3,3,-3,3,0,2,3,3,3,-2,3,0,0,0,5,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,2,3,0,0,0,1,0,1,0,0,2,0,1,0,1,1,2,0,0,1,1,0,1,0,0,2,0,1,1,1,2,2,0,0,0,1,0,1,0,0,2,0,1,0,1,0,2,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,-1,0,-1,1,0,0,1,0,0,buffer,0,0,0,5,0,0,buffer,-0.2,0,0,0,0.2,0.2,0.2,-0.2,0.2,buffer,0,1.666666667,-0.066666667,0.133333333,0.066666667,buffer,5,0,0,0,0,0,0.4,1.4,0.2,0.6,1,0.4,0.6,1.4,0.2,0.6,0.8,0.2,0.2,0.4,0.2,0,0.6,0,buffer,HS_TS,-0.042564413,0.721845465,-0.290437916,0.019597567,0.102110176 +230,R_71SLT2EoKV0x4Aj,60 - 66,American,Female,Female,High School (or equivalent),64,02PsVPf,02FUT,5,02DGEN,-0.5,0.666666667,0.333333333,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,0,3,2,2,-3,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,0,buffer,0,0,0,0,-1,-1,buffer,0,0,0,0,-0.2,-0.2,0,-0.2,-0.2,buffer,0,-0.666666667,0,-0.133333333,-0.133333333,buffer,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0.2,0.2,0,0,0,0,0.2,0.2,buffer,HS_TS,-0.042564413,-0.511127103,-0.1461411,-0.488122207,-0.296988706 +231,R_5kqfBd1P2L3IaYV,53 - 59,American,Male,Male,University - Undergraduate,55,01PfPsV,01PAST,10,01ITEM,-0.25,0.666666667,0.333333333,2,2,2,1,2,-1,0,1,0,2,1,-2,3,-1,2,2,3,3,1,2,0,0,-1,-1,1,-1,1,0,0,-1,3,3,3,2,2,-3,1,2,1,1,1,-3,3,-1,3,-1,0,-1,0,1,0,1,1,0,-1,-1,0,-1,1,0,0,0,-1,1,-1,1,-1,0,0,1,0,1,0,1,-1,2,2,2,2,3,2,2,2,2,2,2,2,0,1,1,0,0,1,0,2,1,1,2,3,3,1,3,1,1,1,1,0,2,1,1,1,1,0,1,0,0,1,3,2,3,1,1,1,1,0,0,3,2,2,4,2,2,2,2,3,0,3,2,1,1,0,1,1,3,3,2,3,1,0,0,1,0,3,1,3,2,0,2,4,3,1,4,1,0,0,1,2,1,2,1,0,2,1,1,1,0,1,buffer,-3,-1,-2,-1,-1,0,-1,2,1,-2,0,1,-1,-1,1,-1,-1,-2,1,-3,0,0,0,1,0,-1,-2,-3,-2,-2,0,0,0,0,-2,2,-1,2,2,-2,1,3,2,1,3,buffer,0,0,0,0,1,0,buffer,-1.6,0,0,-1.2,0.2,-2,-0.4,0.6,2,buffer,0,0.333333333,-0.533333333,-1,0.733333333,buffer,0,1,0,0,0,0,0.4,1,2.4,0.8,1.2,0.4,2,1,2.4,2,1,2.4,0.4,1.8,2.8,0.8,1.2,0.8,buffer,C_Ug,-0.042564413,0.017289712,-1.30051562,-2.138211477,-0.86600045 +232,R_7loY0RLgfCyRn3W,60 - 66,American,Male,Male,High School (or equivalent),60,01PfPsV,02FUT,5,01ITEM,0.125,0.666666667,0.333333333,1,1,2,-1,1,-3,-3,3,-3,-1,2,2,3,-2,3,1,1,2,0,1,-3,-2,-2,-2,-3,2,2,2,-2,3,1,1,2,0,1,-2,-2,2,-2,-2,2,2,2,-2,3,1,1,2,0,1,-3,-3,3,-2,-2,2,3,3,2,3,1,1,2,0,1,-3,-3,3,-2,-3,2,2,3,-2,3,3,3,3,3,3,3,9,9,9,9,9,3,0,0,0,1,0,0,1,5,1,2,0,0,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,4,0,0,0,0,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,4,0,buffer,0,0,0,0,0,0,1,5,0,1,0,-1,1,-4,0,0,0,0,0,0,1,1,1,0,-1,0,0,1,0,0,0,0,0,0,0,1,0,4,0,0,0,-1,0,-4,0,buffer,-6,-6,-6,-6,-6,0,buffer,0,1.4,-0.8,0,0.4,0.2,0,1,-1,buffer,-6,-4,0.2,0.2,0,buffer,0,0,0,0,0,6,0.2,1.8,0.2,0.2,1,0.2,0.2,0.4,1,0.2,0.6,0,0,1.2,0,0,0.2,1,buffer,HS_TS,-4.159618989,-2.272516485,0.286749346,0.146527512,-1.499714654 +233,R_1jSNeu0aXROLpUk,60 - 66,American,Male,Male,High School (or equivalent),65,02PsVPf,02FUT,10,02DGEN,-0.75,0,1,-2,3,3,1,1,0,-3,3,-3,1,3,3,3,3,3,-2,3,3,2,1,2,-3,3,-3,2,3,3,3,3,3,-2,3,3,1,1,2,-3,3,-2,3,3,3,3,3,3,0,3,3,3,1,1,-3,3,-2,2,3,3,3,3,3,0,3,3,3,1,1,-3,3,-2,1,3,3,3,1,3,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,1,2,0,0,0,0,0,2,0,0,2,0,1,0,0,1,1,0,0,0,0,0,2,0,0,2,0,1,0,0,1,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,buffer,-2,0,0,-1,0,1,0,0,-1,0,0,0,0,0,0,-2,0,0,-2,0,1,0,0,0,2,0,0,0,-2,0,0,0,0,1,0,0,0,0,1,0,0,0,0,-2,0,buffer,0,0,0,-1,0,0,buffer,-0.6,0,0,-0.8,0.6,-0.4,0.2,0.2,-0.4,buffer,0,-0.333333333,-0.2,-0.2,0,buffer,0,1,0,1,1,0,0.2,0.6,0,0,1,0,0.8,0.6,0,0.8,0.4,0.4,0.2,0.4,0,0,0.2,0.4,buffer,HS_TS,-0.042564413,-0.334988165,-0.579031545,-0.615052151,-0.392909069 +234,R_6g6Hw0fkVo1MZsr,60 - 66,American,Male,Male,Trade School (non-military),61,03VPfPs,01PAST,5,01ITEM,0.25,0.666666667,0.333333333,2,2,2,1,1,-2,2,0,-2,0,-1,0,2,-2,-1,1,0,2,-1,-1,-2,2,2,1,-1,-1,1,3,0,-1,-1,1,2,-2,-2,1,3,3,2,1,-1,2,3,1,1,2,2,2,2,0,-2,2,-1,0,-2,-2,0,2,-2,-2,2,2,3,3,-2,-2,2,-2,1,0,-2,0,2,-2,-2,2,2,1,2,3,2,2,3,3,3,3,3,1,2,0,2,2,0,0,2,3,1,0,1,1,2,0,3,1,0,3,3,3,1,3,4,1,0,2,1,3,2,0,0,0,1,1,0,0,1,2,2,1,0,0,0,1,0,0,1,2,3,0,0,2,3,0,1,0,0,0,1,2,1,0,1,1,3,1,1,1,2,0,1,0,1,2,0,0,1,1,2,0,0,1,1,2,0,0,0,0,0,buffer,1,2,0,1,1,0,0,1,1,-1,-1,1,1,2,-1,3,1,-1,1,0,3,1,1,1,1,-1,2,1,3,1,2,1,-1,0,-1,3,1,0,0,0,0,1,0,1,2,buffer,0,-1,-2,-1,0,-1,buffer,1,0.2,0.4,0.8,1.4,1.2,0.2,0.8,0.8,buffer,-1,-0.666666667,0.533333333,1.133333333,0.6,buffer,0,1,1,1,0,0,1.4,1.2,0.8,2,2.4,1.6,0.4,1,0.4,1.2,1,0.4,1,1.6,0.8,0.8,0.8,0,buffer,HS_TS,-0.728740176,-0.511127103,1.008233421,1.923546725,0.422978217 +235,R_7BC4Ahzlq9Jo8PD,60 - 66,American,Female,Female,High School (or equivalent),64,01PfPsV,02FUT,5,02DGEN,1.25,0,1,1,3,3,1,1,0,0,1,1,1,3,2,1,0,1,1,3,3,0,2,1,0,0,1,1,3,2,2,0,0,1,3,3,0,1,0,1,1,2,0,3,1,1,2,2,1,3,3,0,2,0,0,2,1,0,3,0,1,1,2,0,3,3,0,2,2,0,1,0,0,2,1,0,2,1,8,6,5,8,7,5,6,8,5,5,7,5,0,0,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,2,1,0,0,0,1,1,0,0,1,0,1,0,2,0,1,1,1,0,0,1,1,2,0,0,1,1,1,1,1,2,0,0,0,0,0,1,1,1,1,1,1,0,1,1,2,2,1,0,0,0,0,2,0,1,1,0,1,1,1,1,1,buffer,0,0,0,0,0,1,0,0,0,-1,0,-2,1,-1,0,-1,0,0,0,-1,-2,1,0,0,0,-1,0,-1,0,1,-1,0,0,0,1,-1,1,0,0,1,-1,0,0,1,1,buffer,2,-2,0,3,0,0,buffer,0,0,-0.4,-0.4,-0.2,-0.2,0,0.2,0.2,buffer,0,1,-0.133333333,-0.266666667,0.133333333,buffer,0,1,0,1,1,0,0.4,0.4,0.4,0.2,0.6,0.8,0.4,0.4,0.8,0.6,0.8,1,0.2,1,1.2,0.2,0.8,1,buffer,HS_TS,-0.042564413,0.369567588,-0.434734729,-0.741982096,-0.212428413 +236,R_5gqHUOk2VmQVMKl,53 - 59,American,Female,Female,High School (or equivalent),56,02PsVPf,01PAST,10,01ITEM,0.25,0.333333333,0.666666667,1,2,2,1,1,-1,-2,1,-2,1,2,1,1,0,2,1,1,1,1,1,0,-1,1,0,0,2,1,1,0,2,1,2,2,1,1,0,0,2,0,-1,2,1,1,-1,2,1,2,2,2,1,0,-1,-1,0,-1,2,1,0,-1,2,1,2,2,2,2,1,-2,1,-1,1,2,1,1,0,1,3,4,3,3,3,4,3,3,3,3,3,3,0,1,1,0,0,1,1,0,2,1,0,0,0,0,0,0,0,0,0,0,1,2,1,2,2,0,0,0,1,0,0,0,0,1,0,1,1,2,2,2,0,0,1,1,0,0,0,0,1,1,2,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,1,1,1,2,1,2,0,0,1,1,1,buffer,0,1,1,-1,0,0,0,-2,0,-1,0,0,-1,-1,0,0,0,0,-1,-1,-1,2,1,1,2,0,0,0,1,-1,0,1,1,0,-1,-1,0,-1,-1,-1,0,0,-1,0,-1,buffer,0,1,0,0,0,1,buffer,0.2,-0.6,-0.4,-0.4,1,0,0.2,-0.8,-0.4,buffer,0.333333333,0.333333333,-0.266666667,0.2,-0.333333333,buffer,0,1,1,0,0,0,0.4,1,0,0,1.6,0.2,0.2,1.6,0.4,0.4,0.6,0.2,0.4,0.6,0.2,0.2,1.4,0.6,buffer,HS_TS,0.186160841,0.017289712,-0.723328361,0.146527512,-0.093337574 +237,R_3rxAGcCnccST8MF,60 - 66,American,Male,Male,University - Undergraduate,64,03VPfPs,01PAST,5,02DGEN,-0.375,0,0.666666667,0,3,2,1,2,-2,-1,2,-1,0,2,-2,3,-2,3,0,3,2,0,2,0,1,2,1,1,2,-2,2,-2,3,0,3,3,0,3,0,1,2,0,1,2,-2,2,-2,3,1,3,3,2,1,-1,1,2,1,-2,3,-3,2,-3,3,1,3,3,2,0,-2,1,2,1,-1,3,-2,2,-3,3,0,0,0,0,0,0,0,4,0,4,6,4,0,0,0,1,0,2,2,0,2,1,0,0,1,0,0,0,0,1,1,1,2,2,0,1,1,0,0,1,0,0,1,0,1,1,1,1,2,0,2,2,1,1,1,1,0,1,0,1,1,2,0,2,0,2,1,1,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,buffer,-1,0,-1,0,-1,1,0,0,0,-1,-1,-1,0,-1,0,-1,0,0,0,-1,2,0,0,-1,0,-1,0,0,-1,0,0,0,1,0,0,-1,0,0,1,-1,0,-1,0,0,0,buffer,0,-4,0,-4,-6,-4,buffer,-0.6,0,-0.6,-0.4,0.2,-0.4,0.2,-0.2,-0.2,buffer,-1.333333333,-4.666666667,-0.4,-0.2,-0.066666667,buffer,0,0,0,4,2,4,0.2,1.4,0.2,0.6,1.2,0.2,0.8,1.4,0.8,1,1,0.6,0.4,0.2,0,0.2,0.4,0.2,buffer,C_Ug,-0.95746543,-2.624794362,-1.011921991,-0.615052151,-1.302308483 +238,R_5q2uxUie94ClQrM,32 - 38,Canadian,Female,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,01ITEM,-2,0.333333333,0.333333333,0,1,1,2,1,1,1,0,1,2,1,2,0,1,-1,0,1,1,-1,-1,1,3,1,1,0,1,1,0,1,-1,2,1,1,1,2,1,1,0,1,-1,1,1,1,0,1,0,1,2,1,1,0,2,2,2,3,1,1,1,0,-1,0,1,2,1,2,1,2,-1,0,1,1,-1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,2,0,2,1,0,2,0,1,0,0,0,2,0,0,1,1,0,0,0,0,3,0,1,1,1,2,0,0,1,1,0,1,1,2,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,0,3,1,1,2,2,0,0,2,3,0,2,1,0,1,0,0,1,1,2,0,0,0,0,1,1,0,3,2,2,0,2,2,0,2,buffer,0,0,-1,2,2,-1,1,-1,-1,1,0,0,-1,-1,0,2,0,-1,0,0,0,-1,-1,-1,2,0,-2,0,0,0,2,0,0,2,2,-1,2,-2,-2,-1,0,-2,-1,1,0,buffer,0,0,0,0,0,0,buffer,0.6,-0.2,-0.4,0.2,-0.2,-0.4,1.2,-0.8,-0.4,buffer,0,0,-1.85E-17,-0.133333333,-3.7E-17,buffer,0,0,0,0,0,0,1,1,0.2,0.8,0.6,1,0.4,1.2,0.6,0.6,0.8,1.4,1.4,0.8,0.8,0.2,1.6,1.2,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.488122207,-0.208919237 +239,R_5oDT6hoqG7XK1jj,18 - 24,Canadian,Male,Male,University - Graduate (Masters),20,03VPfPs,02FUT,10,01ITEM,0.375,0,1,2,2,2,2,3,1,1,3,1,3,3,2,3,1,3,2,2,2,2,2,2,1,2,1,2,2,2,3,3,3,2,2,2,2,2,1,1,2,1,1,3,2,3,3,3,2,2,2,2,2,1,1,3,1,3,2,2,3,3,3,2,1,2,2,2,1,1,1,1,3,2,1,3,2,3,5,5,5,5,5,5,5,5,5,6,5,6,0,0,0,0,1,1,0,1,0,1,1,0,0,2,0,0,0,0,0,1,0,0,1,0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,1,0,0,2,0,0,1,0,0,1,0,0,2,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,1,0,1,0,buffer,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,-1,0,0,0,0,0,-1,0,2,-1,-1,0,1,0,0,-1,0,0,0,1,0,-2,0,1,1,-1,0,-1,0,buffer,0,0,0,-1,0,-1,buffer,0,0.6,0,-0.2,0.2,-0.2,-0.2,0,-0.2,buffer,0,-0.666666667,0.2,-0.066666667,-0.133333333,buffer,0,0,0,1,0,1,0.2,0.6,0.6,0.2,0.6,0.4,0.2,0,0.6,0.4,0.4,0.6,0,0.4,0.2,0.2,0.4,0.4,buffer,grad_prof,-0.042564413,-0.511127103,0.286749346,-0.361192264,-0.157033609 +240,R_7flZCQkk99weKhx,60 - 66,American,Female,Female,College Diploma/Certificate,65,01PfPsV,02FUT,10,02DGEN,0.375,0.666666667,0.333333333,3,-2,2,1,-3,-3,-3,3,-3,-3,2,3,3,-3,2,1,0,2,2,-3,-3,-3,3,-3,-3,2,-3,3,-3,-3,-1,1,3,2,-3,-3,-3,2,-2,-2,2,2,2,-3,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,2,3,-3,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,2,3,-3,1,1,1,1,4,6,4,0,0,0,3,0,0,2,2,0,1,0,0,0,0,0,0,0,6,0,0,5,4,3,1,1,0,0,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,2,1,1,0,0,0,0,1,1,1,0,5,1,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,2,2,0,1,0,0,0,0,0,0,0,5,0,0,4,4,3,1,1,0,0,0,1,1,1,0,0,1,0,0,2,1,1,0,0,0,0,1,1,1,0,5,1,0,4,buffer,1,1,1,1,6,4,buffer,1,0,1.8,1.8,0.6,0.2,0.8,0.6,2,buffer,1,3.666666667,0.933333333,0.866666667,1.133333333,buffer,3,5,3,3,0,0,1,0,2.2,1.8,0.6,0.6,0,0,0.4,0,0,0.4,0.8,0.6,2,0,0,0,buffer,C_Ug,0.643611349,1.778679094,1.874014312,1.415826951,1.428032927 +241,R_5Hiu7ZgCiKpda4Y,25 - 31,Canadian,Female,Female,University - Graduate (Masters),27,01PfPsV,02FUT,10,01ITEM,0.5,0,1,3,3,2,1,3,3,-2,3,0,3,3,3,3,-1,3,3,3,-1,-1,3,0,-2,3,-2,3,3,3,3,-1,3,3,3,1,2,3,1,-2,3,-2,3,1,1,2,-2,3,3,3,1,0,3,2,-3,3,-2,3,2,2,3,-1,3,3,3,2,3,3,1,-2,3,-2,3,1,2,3,-2,3,10,10,10,10,10,10,10,10,10,10,10,10,0,0,3,2,0,3,0,0,2,0,0,0,0,0,0,0,0,1,1,0,2,0,0,2,0,2,2,1,1,0,0,0,1,1,0,1,1,0,2,0,1,1,0,0,0,0,0,0,2,0,2,0,0,2,0,2,1,0,1,0,0,0,2,3,0,1,0,0,0,0,2,2,1,1,0,0,0,1,3,0,1,1,0,0,0,1,0,0,1,0,buffer,0,0,2,1,0,2,-1,0,0,0,-1,-1,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,-1,0,0,0,1,2,1,0,0,buffer,0,0,0,0,0,0,buffer,0.6,0.2,-0.4,0,0,0.4,0.2,-0.2,0.8,buffer,0,0,0.133333333,0.133333333,0.266666667,buffer,0,0,0,0,0,0,1,1,0,0.4,0.8,1.2,0.4,0.8,0.4,0.4,0.8,0.8,1,0.2,1.2,0.8,0.4,0.4,buffer,grad_prof,-0.042564413,-0.158849227,0.14245253,0.019597567,-0.009840886 +242,R_5ds4R46ygys9nWw,32 - 38,Canadian,Female,Female,University - Undergraduate,35,02PsVPf,01PAST,5,02DGEN,0.375,0,1,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,3,4,4,4,5,4,4,4,4,5,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,0,1,1,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,0,1,0,0,0,0,1,1,buffer,0,1,0,0,-1,1,1,0,0,0,1,1,1,1,0,-1,0,0,0,-1,-1,0,0,-1,0,0,0,1,0,-1,-1,-1,0,0,0,0,1,0,-1,0,1,1,0,-1,-1,buffer,-1,1,-1,0,0,-1,buffer,0,0.4,0.8,-0.4,-0.4,0,-0.4,0,0,buffer,-0.333333333,-0.333333333,0.4,-0.266666667,-0.133333333,buffer,0,1,1,1,0,1,0.2,0.6,0.8,0.6,0.2,0.4,0.2,0.2,0,1,0.6,0.4,0.4,0.4,0.4,0.8,0.4,0.4,buffer,C_Ug,-0.271289667,-0.334988165,0.719639792,-0.741982096,-0.157155034 +243,R_1fp5WR6uFgdbdtN,60 - 66,American,Male,Male,High School (or equivalent),61,03VPfPs,01PAST,5,01ITEM,-0.25,0,0.666666667,0,2,2,0,0,0,0,1,0,0,2,0,0,-2,1,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,0,0,2,2,0,0,0,0,0,0,0,2,0,0,0,2,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,2,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0.4,0,0,0.8,buffer,0,0,0,0.133333333,0.266666667,buffer,0,0,0,0,0,0,0,0.2,0.2,0,0.2,0.6,0,0.2,0.2,0,0.2,0.2,0,0,0.8,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,0.019597567,-0.081989293 +244,R_6j9OmgbUVt9jIKB,32 - 38,Canadian,Female,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,02DGEN,0.875,0,1,3,2,-3,2,2,0,2,2,1,2,1,0,2,0,1,2,3,-3,2,2,0,2,2,2,2,1,1,2,1,1,2,2,-3,2,2,0,2,2,3,2,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,6,8,6,4,6,5,5,6,5,5,5,1,1,0,0,0,0,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,2,3,2,2,0,2,2,1,2,1,0,2,0,1,3,2,3,2,2,0,2,2,1,2,1,0,2,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,-2,-1,-3,-2,-2,0,-2,-2,0,-2,-1,1,-2,1,-1,-2,-2,-3,-2,-2,0,-2,-2,1,-2,-1,0,-2,0,-1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,buffer,2,1,2,1,-1,1,buffer,-2,-1.2,-0.4,-2.2,-1,-0.8,0.2,0.2,0.4,buffer,1.666666667,0.333333333,-1.2,-1.333333333,0.266666667,buffer,1,2,2,0,0,1,0.4,0.2,0.4,0.2,0.4,0,2.4,1.4,0.8,2.4,1.4,0.8,0.2,0.2,0.4,0,0,0,buffer,C_Ug,1.101061858,0.017289712,-2.743483773,-2.772861196,-1.09949835 +245,R_1ZKvQzRf0XJutJT,46 - 52,Canadian,Female,Female,College Diploma/Certificate,49,01PfPsV,02FUT,5,02DGEN,0.5,0,1,1,1,-1,2,1,-1,-1,2,-1,2,2,1,2,2,1,-2,-2,-2,2,1,2,3,-1,3,1,2,2,2,2,2,1,1,-2,2,1,1,1,-1,2,2,2,2,2,2,2,3,1,-3,2,2,1,-3,3,-2,3,2,2,2,3,2,3,3,-2,3,2,2,-3,3,-3,2,2,2,2,2,2,4,6,8,3,4,4,7,8,2,3,6,7,3,3,1,0,0,3,4,3,4,1,0,1,0,0,1,0,0,1,0,0,2,2,3,3,0,0,1,0,0,1,2,0,2,0,1,2,2,1,1,1,0,1,0,1,1,2,2,1,1,1,3,2,1,2,0,0,1,0,0,1,3,3,0,0,0,1,2,0,1,1,0,0,0,0,0,0,2,1,1,0,1,0,0,1,1,0,0,0,1,0,buffer,1,3,-1,0,-1,1,2,2,3,0,0,0,0,-1,0,-2,-2,0,-1,-1,-1,0,2,1,0,0,0,0,0,0,3,1,-1,-1,0,0,2,0,0,0,0,0,0,-1,0,buffer,-3,-2,6,0,-2,-3,buffer,0.4,1.6,-0.2,-1.2,0.4,0,0.4,0.4,-0.2,buffer,0.333333333,-1.666666667,0.6,-0.266666667,0.2,buffer,1,2,4,4,2,5,1.4,3,0.4,0.2,2,0.4,1,1.4,0.6,1.4,1.6,0.4,1.2,1,0,0.8,0.6,0.2,buffer,C_Ug,0.186160841,-1.039543918,1.152530237,-0.741982096,-0.110708734 +246,R_3YRCJCauQ36vA89,46 - 52,Canadian,Female,Female,University - Graduate (Masters),46,02PsVPf,01PAST,10,01ITEM,1,0,0.666666667,1,1,1,1,1,2,1,2,2,2,1,2,1,2,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,2,1,1,2,2,2,1,2,1,1,1,2,1,1,2,2,1,2,2,2,1,1,1,1,1,0,2,1,2,2,1,8,8,8,8,7,8,8,8,8,9,8,9,0,1,0,0,0,1,0,1,2,1,0,1,1,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,0,1,0,1,1,2,1,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,buffer,0,1,-1,-1,-1,0,-1,0,1,0,-1,0,1,1,-1,0,-1,-1,0,1,0,0,0,0,-1,-1,0,-1,1,1,0,0,0,1,0,0,-1,0,1,-1,0,0,0,0,0,buffer,0,0,0,-1,-1,-1,buffer,-0.4,0,0,-0.2,-0.2,0,0.2,-0.2,0,buffer,0,-1,-0.133333333,-0.133333333,0,buffer,0,1,0,1,0,1,0.2,1,0.6,0.4,0.8,0.6,0.6,1,0.6,0.6,1,0.6,0.6,0.2,0.4,0.4,0.4,0.4,buffer,grad_prof,-0.042564413,-0.687266041,-0.434734729,-0.488122207,-0.413171848 +247,R_5yf4rucuBltJCUA,46 - 52,American,Female,Female,High School (or equivalent),51,01PfPsV,01PAST,5,01ITEM,-0.375,0,1,3,3,3,3,3,2,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,-3,-3,-3,-3,-3,3,3,-2,-3,3,3,3,3,3,3,2,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,2,-3,3,-3,3,3,2,3,3,3,3,3,3,3,3,2,-3,3,-3,2,3,2,3,-3,2,6,6,8,9,7,8,7,8,6,7,7,7,0,0,0,0,0,5,0,6,0,6,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,6,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,5,0,6,0,6,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,6,1,buffer,0,0,0,0,0,5,0,6,0,6,0,-1,5,-6,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,-1,0,0,0,0,0,5,0,6,0,5,0,0,5,-6,-1,buffer,-1,-2,2,2,0,1,buffer,0,3.4,-0.4,0,-0.2,-0.4,0,3.2,-0.4,buffer,-0.333333333,1,1,-0.2,0.933333333,buffer,3,1,0,0,1,1,0,3.4,1,0,0,0,0,0,1.4,0,0.2,0.4,0,3.4,1,0,0.2,1.4,buffer,HS_TS,-0.271289667,0.369567588,2.018311128,-0.615052151,0.375384224 +248,R_5ooo1l9CyoPkICT,60 - 66,American,Female,Female,College Diploma/Certificate,66,02PsVPf,02FUT,10,02DGEN,-0.125,0.333333333,0.666666667,2,2,-2,2,-3,0,0,1,-1,0,1,-1,2,0,1,2,2,0,2,-2,-1,0,1,1,-1,1,-1,2,1,1,2,3,1,2,1,1,0,2,-1,1,1,-1,2,1,1,2,2,-2,2,-3,0,0,1,-1,1,1,-1,2,0,1,2,2,0,2,-3,-1,0,1,-1,0,1,-1,1,0,1,2,2,2,1,1,1,3,3,3,3,3,3,0,0,2,0,1,1,0,0,2,1,0,0,0,1,0,0,1,3,0,4,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,3,2,0,1,2,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,1,0,0,1,0,0,buffer,0,0,2,0,1,1,0,0,2,0,0,0,0,1,0,0,1,1,0,4,0,0,1,0,1,0,0,-1,1,0,0,1,-1,0,3,1,0,1,2,1,0,0,-1,0,0,buffer,-1,-1,-1,-2,-2,-2,buffer,0.6,0.6,0.2,1.2,0.4,0,0.6,1,-0.2,buffer,-1,-2,0.466666667,0.533333333,0.466666667,buffer,1,1,1,0,0,0,0.6,0.8,0.2,1.6,0.6,0.2,0,0.2,0,0.4,0.2,0.2,1,1.4,0,0.4,0.4,0.2,buffer,C_Ug,-0.728740176,-1.215682856,0.863936607,0.78117723,-0.074827298 +249,R_5Cx1zvpu3EERY9X,46 - 52,American,Female,Female,College Diploma/Certificate,48,03VPfPs,02FUT,10,01ITEM,1.375,0,1,3,2,2,2,3,3,2,1,0,2,2,0,0,1,2,0,0,1,2,0,0,2,1,2,0,1,1,2,2,1,1,0,2,1,0,0,0,1,1,0,3,1,3,1,0,1,2,3,1,2,2,3,2,0,0,2,2,2,1,1,2,0,1,2,1,2,2,0,2,0,3,1,1,2,3,6,7,7,7,7,5,7,6,5,6,6,6,3,2,1,0,3,3,0,0,2,2,1,1,2,1,1,2,2,0,1,3,3,2,0,1,2,1,1,3,0,2,2,0,1,1,1,1,1,1,0,2,0,2,2,0,1,1,2,1,0,2,1,0,1,2,2,1,1,1,1,1,1,0,1,1,0,0,2,0,1,0,2,0,1,1,1,1,2,2,1,1,0,1,2,2,0,1,1,1,1,2,buffer,1,2,0,-1,2,2,-1,-1,2,0,1,-1,0,1,0,1,0,-1,1,1,2,2,-1,-1,0,0,0,2,-1,1,0,-2,-1,0,-1,0,1,-2,-1,0,1,-1,0,0,-1,buffer,-1,1,2,1,1,-1,buffer,0.8,0.4,0.2,0.4,0.4,0.4,-0.8,-0.4,-0.2,buffer,0.666666667,0.333333333,0.466666667,0.4,-0.466666667,buffer,1,0,2,1,0,1,1.8,1.4,1.2,1.6,1.6,1.4,1,1,1,1.2,1.2,1,0.6,0.6,1,1.4,1,1.2,buffer,C_Ug,0.414886095,0.017289712,0.863936607,0.527317343,0.455857439 +250,R_5eli1kwL3Xl5Fpv,46 - 52,American,Male,Male,High School (or equivalent),49,02PsVPf,02FUT,5,02DGEN,1.125,0.333333333,0.333333333,2,2,2,2,1,2,3,2,2,2,2,1,1,2,1,2,2,3,3,2,2,3,3,3,2,2,3,2,3,2,2,3,2,3,2,2,3,2,3,2,2,2,2,3,1,2,3,2,2,3,2,2,1,1,2,1,2,2,1,2,2,2,2,2,3,2,1,2,1,2,1,2,1,2,1,10,8,8,8,6,8,9,8,9,8,9,9,0,0,1,1,1,0,0,1,1,0,0,2,1,1,1,0,1,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,0,0,2,0,1,1,1,0,1,1,1,1,1,0,0,0,0,2,0,2,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,buffer,0,-1,1,1,-1,0,-1,0,0,0,-1,1,0,0,0,0,1,0,1,-1,0,-2,0,0,0,-1,0,1,1,0,0,0,1,0,0,0,-1,0,0,0,0,1,-1,-1,0,buffer,1,0,-1,0,-3,-1,buffer,0,-0.2,0,0.2,-0.4,0.2,0.2,-0.2,-0.2,buffer,0,-1.333333333,-0.066666667,0,-0.066666667,buffer,2,2,0,1,1,0,0.6,0.4,1,0.6,0.2,0.6,0.6,0.6,1,0.4,0.6,0.4,0.4,0.2,0.4,0.2,0.4,0.6,buffer,HS_TS,-0.042564413,-0.863404979,-0.290437916,-0.23426232,-0.357667407 +251,R_6fBypmBmQZi1IZ3,32 - 38,Canadian,Female,Female,High School (or equivalent),35,02PsVPf,02FUT,5,01ITEM,0.625,0,1,2,3,3,3,3,2,1,3,2,1,2,2,3,1,3,2,3,3,3,3,2,2,3,1,2,2,3,3,1,3,2,3,3,3,3,2,1,3,-1,2,2,2,3,2,3,2,3,3,3,3,2,1,3,0,2,2,2,3,0,3,2,3,3,3,3,2,1,3,0,2,2,2,3,1,3,5,6,6,7,8,6,5,7,5,6,8,6,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,1,0,-1,0,0,1,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,1,0,0,0,buffer,0,-1,1,1,0,0,buffer,0,0,0,0,0.2,0.2,0,0.6,0.2,buffer,0,0.333333333,0,0.133333333,0.266666667,buffer,2,2,0,1,1,1,0,0.6,0.2,0,0.8,0.2,0,0.6,0.2,0,0.6,0,0,0.6,0.4,0,0,0.2,buffer,HS_TS,-0.042564413,0.017289712,-0.1461411,0.019597567,-0.037954559 +252,R_7MFsdtCdfMALc1N,18 - 24,Both,Female,Female,High School (or equivalent),19,02PsVPf,01PAST,10,02DGEN,0,0.333333333,0,1,2,1,2,0,0,1,1,1,1,2,-1,1,0,2,3,1,2,-1,0,-1,0,-2,1,-1,2,0,-1,0,2,3,1,2,0,0,0,-1,-2,1,-1,2,1,0,0,2,1,1,0,0,0,-1,0,1,0,1,0,1,0,0,2,0,1,1,2,2,1,-1,1,-1,1,2,0,2,0,2,8,7,6,6,9,7,6,7,7,6,8,7,2,1,1,3,0,1,1,3,0,2,0,1,2,0,0,2,1,1,2,0,0,2,3,0,2,0,2,1,0,0,0,1,1,2,0,1,1,0,1,0,2,2,1,0,0,1,1,0,0,2,1,2,0,2,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,2,2,2,1,0,1,0,2,1,2,0,0,buffer,2,0,0,1,0,0,0,3,-1,2,-2,-1,1,0,0,1,0,1,2,-2,-1,0,3,-2,2,0,1,0,0,0,-1,0,-1,-1,-2,-1,0,0,-1,0,-2,0,-1,0,0,buffer,2,0,-1,0,1,0,buffer,0.6,0.8,-0.4,0.4,0.4,0.2,-1,-0.4,-0.6,buffer,0.333333333,0.333333333,0.333333333,0.333333333,-0.666666667,buffer,2,2,1,0,1,0,1.4,1.4,0.6,1.2,1.4,0.6,0.8,0.6,1,0.8,1,0.4,0.2,0.4,0.4,1.2,0.8,1,buffer,HS_TS,0.186160841,0.017289712,0.575342976,0.400387399,0.294795232 +253,R_1YfFHpITKqo139s,60 - 66,American,Female,Female,High School (or equivalent),62,01PfPsV,01PAST,5,02DGEN,-0.125,0.333333333,0.333333333,2,3,3,3,1,-2,0,0,3,1,0,-1,3,-2,3,2,3,3,3,1,-2,0,0,3,1,0,-2,3,-2,3,2,3,3,3,1,-2,-1,0,3,1,0,-1,3,-2,3,2,3,3,3,1,-2,-2,0,2,1,0,-2,3,-2,3,2,3,3,3,1,-2,-2,0,3,1,0,-2,3,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,1,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-0.6,0,0,-0.2,-0.2,0,0,0.2,buffer,0,0,-0.2,-0.133333333,0.066666667,buffer,0,0,0,0,0,0,0,0,0.2,0,0.2,0,0,0.6,0.2,0,0.4,0.2,0,0.2,0.2,0,0.2,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.579031545,-0.488122207,-0.317141848 +254,R_7PcDL3PVMJv2PWn,32 - 38,Canadian,Female,Female,University - PhD,34,02PsVPf,01PAST,5,01ITEM,0.5,0,0.666666667,2,2,2,1,1,1,1,0,0,1,2,1,2,2,1,1,1,2,2,2,1,1,0,0,1,1,1,2,2,1,1,2,2,2,1,2,0,1,0,2,1,2,2,1,1,2,2,1,1,1,1,1,0,0,2,0,2,1,2,0,2,2,0,1,0,1,0,2,0,2,0,2,1,2,0,7,7,8,8,7,7,7,8,7,8,8,8,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,2,1,1,0,1,0,0,2,0,1,0,1,2,0,1,2,1,1,0,1,0,1,0,0,1,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,2,0,0,0,0,0,0,0,buffer,1,1,-1,1,1,0,0,0,0,-1,-1,-1,-1,0,-1,1,0,-2,1,-1,1,0,-1,0,0,-1,0,-1,1,-1,0,1,-1,0,0,1,0,-1,0,1,0,1,0,1,0,buffer,0,-1,1,0,-1,-1,buffer,0.6,-0.2,-0.8,-0.2,0,-0.4,0,0.2,0.4,buffer,0,-0.666666667,-0.133333333,-0.2,0.2,buffer,1,0,1,1,0,1,0.8,0,0.2,0.4,0.8,0.6,0.2,0.2,1,0.6,0.8,1,0.4,0.8,0.4,0.4,0.6,0,buffer,grad_prof,-0.042564413,-0.511127103,-0.434734729,-0.615052151,-0.400869599 +255,R_382ydnyfyAJi5rP,25 - 31,Canadian,Male,Male,University - Graduate (Masters),29,01PfPsV,02FUT,5,01ITEM,0.5,0,1,2,3,3,2,2,1,2,1,2,3,1,3,2,1,1,3,3,2,3,2,1,1,-1,1,2,2,3,3,2,1,0,1,1,2,2,2,3,3,3,2,2,2,1,3,1,2,3,3,1,3,2,-1,3,0,2,3,2,0,2,3,2,2,3,3,2,1,-3,1,0,2,2,2,1,0,2,6,8,5,9,8,8,8,10,8,5,10,2,1,0,1,1,0,0,1,2,1,1,1,0,1,1,0,2,2,2,0,0,1,1,2,1,1,1,1,1,2,0,0,0,0,1,1,1,3,2,2,1,2,1,2,1,2,0,1,0,1,0,0,5,0,2,1,1,1,1,1,1,3,2,1,1,0,1,2,4,2,0,0,1,2,1,0,0,1,0,2,1,1,2,2,0,0,1,0,1,2,1,buffer,1,0,1,0,-1,-1,-2,0,-1,0,-1,-1,-1,0,-2,2,1,2,-1,0,1,-4,2,-1,0,0,0,0,1,-1,3,1,1,-1,-1,0,0,2,2,0,-1,1,1,-1,-1,buffer,-2,-2,-3,4,-2,6,buffer,0.2,-0.8,-1,0.8,-0.4,0,0.6,0.8,-0.2,buffer,-2.333333333,2.666666667,-0.533333333,0.133333333,0.4,buffer,3,0,3,3,0,6,0.6,1,0.6,1.2,1.2,1,0.4,1.8,1.6,0.4,1.6,1,1.4,1.8,0.8,0.8,1,1,buffer,grad_prof,-1.643641192,1.25026228,-1.30051562,0.019597567,-0.418574241 +256,R_3IQwm0e7K3VHmdn,25 - 31,Canadian,Male,Male,High School (or equivalent),27,02PsVPf,01PAST,10,02DGEN,0,0.666666667,0.333333333,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-2,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,3,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0.2,0,0,0.2,0,buffer,0,0,0,0.066666667,0.066666667,buffer,0,0,0,0,0,0,0,0,0.2,0,0.2,0.2,0,0,0.2,0,0,0.2,0,0.2,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.107332375,-0.113721779 +257,R_6egVfurNHqEkWPh,46 - 52,Canadian,Female,Female,University - Undergraduate,48,03VPfPs,02FUT,5,02DGEN,-0.25,0,1,3,3,2,1,3,0,-2,3,-2,2,2,-1,3,-1,3,3,3,2,2,3,0,-2,2,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,1,2,1,1,1,2,2,2,2,2,2,2,0,0,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,buffer,-1,0,-1,-1,-1,0,buffer,0,0.2,0,0,0,0,0,0.2,0,buffer,-0.666666667,-0.666666667,0.066666667,0,0.066666667,buffer,0,1,1,0,0,0,0.2,0.4,0.6,0.2,0.2,0.6,0.2,0.2,0.6,0.2,0.2,0.6,0,0.2,0,0,0,0,buffer,C_Ug,-0.500014922,-0.511127103,-0.001844284,-0.23426232,-0.311812157 +258,R_7hSxzqk7lCP8pJi,25 - 31,Canadian,Female,Female,High School (or equivalent),31,03VPfPs,01PAST,5,01ITEM,0.375,0,1,2,2,3,1,2,-1,-2,2,-2,1,2,1,2,-2,3,2,2,2,1,2,-2,-2,2,-2,-1,3,1,2,-3,3,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-3,2,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-2,2,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,1,0,0,0,1,0,0,1,0,0,0,3,0,0,0,1,1,0,0,1,0,0,1,0,0,0,3,0,0,0,0,1,0,0,1,0,0,1,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,-1,1,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,buffer,0,0,0,0,0,0,buffer,0,-0.2,0.2,0,0,0.2,0,0.2,0.4,buffer,0,0,0,0.066666667,0.2,buffer,0,0,0,0,0,0,0.2,0.6,0.4,0.2,0.8,0.4,0.2,0.8,0.2,0.2,0.8,0.2,0,0.2,0.4,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.107332375,-0.113721779 +259,R_3C8j15a60QpZX8v,32 - 38,Canadian,Male,Male,University - Graduate (Masters),36,01PfPsV,01PAST,5,01ITEM,0.125,1,0,0,1,1,-1,-1,-2,1,2,1,1,1,2,2,1,2,0,1,2,0,0,-3,2,2,2,-1,2,2,2,2,2,-1,1,2,-1,-2,-3,2,2,1,0,2,2,2,2,2,0,1,0,0,0,-2,2,2,1,1,2,2,2,2,2,0,0,0,0,0,-2,2,2,0,0,2,2,2,2,2,6,6,2,5,5,4,6,6,2,5,5,2,0,0,1,1,1,1,1,0,1,2,1,0,0,1,0,1,0,1,0,1,1,1,0,0,1,1,0,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,1,1,0,0,1,0,1,0,0,1,2,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,buffer,0,0,0,0,0,1,0,0,1,2,0,0,0,0,0,1,-1,0,-1,0,1,0,0,-1,0,0,0,0,0,0,1,-1,0,1,2,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,2,buffer,0,0.8,0,-0.2,0,0,0.6,0,0,buffer,0,0.666666667,0.266666667,-0.066666667,0.2,buffer,1,1,2,1,1,0,0.6,1,0.4,0.6,0.6,0.4,0.6,0.2,0.4,0.8,0.6,0.4,0.8,0.4,0,0.2,0.4,0,buffer,grad_prof,-0.042564413,0.19342865,0.431046162,-0.361192264,0.055179534 +260,R_51Pg3oAe4Cdwlpv,60 - 66,American,Male,Male,College Diploma/Certificate,66,01PfPsV,02FUT,10,02DGEN,-0.625,0,1,2,2,3,-2,1,-1,-2,2,1,-1,2,3,1,-2,2,3,3,3,-2,1,1,-1,2,0,-2,3,3,2,-2,2,3,3,3,-2,2,-2,-2,3,-1,-1,3,3,2,-2,2,3,2,3,-1,-1,-1,0,2,1,-3,3,3,2,-3,2,3,2,3,0,-1,-3,1,0,2,-3,3,3,0,-3,2,1,0,1,1,1,1,3,1,1,2,2,1,1,1,0,0,0,2,1,0,1,1,1,0,1,0,0,1,1,0,0,1,1,0,1,2,0,1,0,1,0,0,1,0,0,1,2,0,2,0,0,2,1,0,1,1,0,1,0,0,2,2,2,3,2,1,2,1,0,1,1,0,0,0,0,0,1,3,1,1,1,1,0,0,0,0,0,0,0,0,1,0,2,1,2,1,0,0,0,2,0,0,buffer,0,1,0,-1,-2,2,-1,0,1,-1,0,0,0,-1,0,0,1,0,-2,-1,-1,-3,-1,1,-2,0,0,0,-1,0,0,0,0,-1,1,1,0,-1,0,1,0,0,-2,0,0,buffer,-2,-1,0,-1,-1,0,buffer,-0.4,0.2,-0.2,-0.4,-1.2,-0.2,0,0.2,-0.4,buffer,-1,-0.666666667,-0.133333333,-0.6,-0.066666667,buffer,0,1,0,1,1,0,0.4,1,0.4,0.6,0.8,0.4,0.8,0.8,0.6,1,2,0.6,0.2,1.4,0,0.2,1.2,0.4,buffer,C_Ug,-0.728740176,-0.511127103,-0.434734729,-1.376631814,-0.762808456 +261,R_5Zh7jBkXAieStb3,25 - 31,Canadian,Female,Female,University - Undergraduate,31,02PsVPf,01PAST,5,02DGEN,-0.25,0,0.666666667,-1,2,1,0,2,2,0,1,-1,1,-2,-1,1,0,0,-2,2,1,0,2,2,0,1,-2,1,-2,-1,1,0,0,-2,2,1,-1,2,1,1,1,0,1,-1,0,2,1,0,-1,2,2,0,2,1,0,1,-1,2,-1,0,2,0,0,-2,2,2,0,2,1,0,1,0,2,-1,0,2,0,0,5,5,5,5,8,8,5,5,5,5,5,5,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,0,2,0,1,1,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,1,0,-1,0,0,-1,0,0,1,-1,-1,-1,-1,0,0,0,0,-1,1,0,0,1,0,0,-1,0,0,0,1,0,-1,0,0,1,0,1,1,0,1,0,1,1,1,1,0,buffer,0,0,0,0,3,3,buffer,0,-0.2,-0.6,0,0,0.2,0,0.6,0.8,buffer,0,2,-0.266666667,0.066666667,0.466666667,buffer,0,3,3,0,0,0,0.2,0.2,0,0.4,0.6,0.8,0.2,0.4,0.6,0.4,0.6,0.6,0.2,0.8,0.8,0.2,0.2,0,buffer,C_Ug,-0.042564413,0.897984403,-0.723328361,-0.107332375,0.006189813 +262,R_3IozwufNDFj4pPc,46 - 52,Canadian,Female,Female,High School (or equivalent),52,02PsVPf,01PAST,5,01ITEM,0.375,0,1,2,1,1,0,1,0,1,1,1,0,1,1,3,-1,1,1,0,-2,-2,1,0,1,-1,1,-1,1,1,1,0,1,1,1,-2,-2,1,0,0,0,0,0,1,0,0,1,2,0,0,0,0,0,2,-1,2,-3,2,3,3,3,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,10,5,10,5,10,5,10,10,5,5,5,1,1,3,2,0,0,0,2,0,1,0,0,2,1,0,1,0,3,2,0,0,1,1,1,0,0,1,3,2,1,2,1,1,0,1,2,2,1,4,2,2,2,0,1,2,2,1,1,0,1,0,1,1,1,0,1,1,3,1,1,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,2,1,2,3,2,3,3,3,2,3,buffer,-1,0,2,2,-1,-2,-2,1,-4,-1,-2,-2,2,0,-2,-1,-1,2,2,-1,0,0,0,0,0,-1,0,0,1,0,0,1,0,0,0,-2,0,-1,-2,-1,-3,-2,-2,-1,-2,buffer,1,0,-5,5,0,5,buffer,0.4,-1.6,-0.8,0.2,0,0,0.2,-1.2,-2,buffer,-1.333333333,3.333333333,-0.666666667,0.066666667,-1,buffer,4,5,5,0,5,5,1.4,0.6,0.6,1.2,0.6,1.4,1,2.2,1.4,1,0.6,1.4,0.2,0.8,0.8,0,2,2.8,buffer,HS_TS,-0.95746543,1.602540156,-1.589109252,-0.107332375,-0.262841725 +263,R_5NPB7Uy8fbMa4Yg,32 - 38,American,Male,Male,College Diploma/Certificate,34,01PfPsV,02FUT,10,02DGEN,0.5,1,0,2,2,3,1,1,2,1,2,-1,1,2,2,2,0,2,2,3,3,2,3,0,1,2,-2,1,0,2,2,0,1,3,1,1,1,2,1,2,1,-2,2,1,0,1,-1,1,2,2,2,2,2,2,2,2,-2,1,1,2,2,0,1,2,2,2,2,2,1,2,1,2,1,1,1,2,0,1,5,5,5,5,5,5,5,5,5,5,5,5,0,1,0,1,2,2,0,0,1,0,2,0,0,0,1,1,1,2,0,1,1,1,1,1,1,1,2,1,1,1,0,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,1,1,1,1,1,1,3,0,1,1,0,0,1,1,2,2,1,1,1,1,1,0,1,1,2,1,1,0,0,0,0,0,0,1,0,1,4,0,0,1,0,0,0,buffer,0,1,-1,0,1,2,-1,0,0,0,1,0,0,0,0,1,1,1,-1,0,0,0,0,-2,1,0,1,1,1,0,1,2,2,1,1,0,1,0,-4,1,1,1,1,1,0,buffer,0,0,0,0,0,0,buffer,0.2,0.2,0.2,0.4,-0.2,0.6,1.4,-0.4,0.8,buffer,0,0,0.2,0.266666667,0.6,buffer,0,0,0,0,0,0,0.8,0.6,0.6,1,1,1.2,0.6,0.4,0.4,0.6,1.2,0.6,1.4,0.8,1,0,1.2,0.2,buffer,C_Ug,-0.042564413,-0.158849227,0.286749346,0.273457456,0.089698291 +264,R_60AzsfZBb4s9ja1,39 - 45,American,Male,Male,College Diploma/Certificate,42,03VPfPs,02FUT,5,02DGEN,0.375,0.333333333,0.666666667,3,3,1,0,2,0,-3,2,-2,3,-1,0,3,-1,2,3,3,1,-1,-2,-1,-3,3,0,-1,0,0,2,-2,3,3,3,2,-1,-3,-2,-3,1,3,3,0,0,1,-1,2,3,3,0,-1,3,0,-3,3,-3,3,0,0,3,0,2,3,3,1,0,3,0,-3,3,-3,3,0,0,3,-2,3,3,2,3,4,1,5,3,0,1,4,1,0,0,0,0,1,4,1,0,1,2,4,1,0,1,1,1,0,0,1,1,5,2,0,1,5,0,1,0,2,0,0,0,0,1,1,1,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,2,3,4,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,2,1,buffer,0,0,-1,0,3,1,0,0,1,4,0,0,1,0,1,0,0,1,1,4,2,0,0,4,0,0,0,2,-1,-1,0,0,0,-1,1,1,0,2,3,4,0,0,1,-1,0,buffer,0,2,2,0,0,5,buffer,0.4,1.2,0.4,1.2,1.2,0,0,2,0,buffer,1.333333333,1.666666667,0.666666667,0.8,0.666666667,buffer,1,1,2,1,1,1,1,1.6,0.8,1.4,1.6,0.6,0.6,0.4,0.4,0.2,0.4,0.6,0.4,2,0.6,0.4,0,0.6,buffer,C_Ug,0.872336603,0.721845465,1.296827053,1.288897006,1.044976532 +265,R_1Ksdo9ubjVLBHwZ,39 - 45,American,Female,Female,University - Graduate (Masters),45,01PfPsV,01PAST,10,01ITEM,0.625,0,1,-3,-3,-3,3,1,-3,3,-1,3,1,3,3,3,3,3,-3,3,-1,3,1,-3,3,-1,3,-3,3,3,3,3,3,1,3,1,3,-1,-3,3,-3,3,-3,3,3,3,1,3,0,-3,0,3,1,-3,3,0,3,-1,3,3,3,1,3,0,-3,0,3,3,-3,3,0,3,-1,3,3,3,3,3,5,5,5,6,6,8,5,5,5,6,5,6,0,6,2,0,0,0,0,0,0,4,0,0,0,0,0,4,6,4,0,2,0,0,2,0,4,0,0,0,2,0,3,0,3,0,0,0,0,1,0,2,0,0,0,2,0,3,0,3,0,2,0,0,1,0,2,0,0,0,0,0,4,0,2,0,2,0,0,2,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,buffer,-3,6,-1,0,0,0,0,-1,0,2,0,0,0,-2,0,1,6,1,0,0,0,0,1,0,2,0,0,0,2,0,4,0,2,0,0,0,0,2,0,0,0,0,0,0,0,buffer,0,0,0,0,1,2,buffer,0.4,0.2,-0.4,1.6,0.6,0.4,1.2,0.4,0,buffer,0,1,0.066666667,0.866666667,0.533333333,buffer,1,1,3,1,0,1,1.6,0.8,0,3.2,1.2,0.4,1.2,0.6,0.4,1.6,0.6,0,1.6,0.4,0.4,0.4,0,0.4,buffer,grad_prof,-0.042564413,0.369567588,-0.001844284,1.415826951,0.435246461 +266,R_6pRqjE4HtLlUvSa,53 - 59,American,Male,Male,College Diploma/Certificate,55,03VPfPs,02FUT,10,01ITEM,0,0,1,-3,3,0,0,-3,-3,-3,3,-3,-3,3,3,3,3,3,-3,3,0,-3,-3,3,3,3,3,3,3,3,3,3,3,-3,3,0,-3,-3,-3,-3,-3,-3,-3,3,3,3,3,3,-3,3,0,3,-3,-3,3,3,-3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,6,6,0,6,6,0,0,0,0,0,0,0,0,3,0,0,0,6,0,0,0,0,0,0,0,0,0,0,3,0,0,6,0,0,0,0,0,0,0,0,6,0,3,3,6,6,6,0,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,6,0,3,0,6,6,0,0,6,6,0,0,0,0,0,buffer,0,0,0,0,0,6,0,0,6,6,0,0,0,0,0,-6,0,-3,0,-6,-6,-6,6,-6,-6,0,0,0,0,0,-6,0,-3,0,-6,0,6,6,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,3.6,0,-3,-3.6,0,-3,2.4,0,buffer,0,0,1.2,-2.2,-0.2,buffer,0,0,0,0,0,0,0.6,4.8,0,0.6,1.2,0,0.6,1.2,0,3.6,4.8,0,0,6,0,3,3.6,0,buffer,C_Ug,-0.042564413,-0.158849227,2.451201574,-4.422950466,-0.543290633 +267,R_6V4h0VRF4DZeqOd,46 - 52,American,Female,Female,College Diploma/Certificate,52,01PfPsV,01PAST,10,01ITEM,0.125,0,1,2,3,1,0,2,2,-3,3,-3,1,3,2,2,0,3,2,3,2,0,2,3,-3,3,-3,2,3,2,3,0,3,2,3,2,0,2,3,-3,3,-3,1,3,2,2,0,3,2,3,2,0,2,3,-3,3,-3,2,3,3,3,0,3,2,3,2,0,2,3,-3,3,-3,2,3,3,3,0,3,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,buffer,0,0,0,0,0,0,buffer,0,0,-0.2,0,-0.2,-0.4,0,0.2,0.2,buffer,0,0,-0.066666667,-0.2,0.133333333,buffer,0,0,0,0,0,0,0.2,0.4,0.2,0.2,0.2,0,0.2,0.4,0.4,0.2,0.4,0.4,0,0.2,0.2,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.290437916,-0.615052151,-0.276725927 +268,R_7XidMGEjVG8gDF8,53 - 59,American,Female,Female,College Diploma/Certificate,53,03VPfPs,01PAST,5,01ITEM,1,0,0.666666667,3,3,3,3,-3,2,-3,3,1,2,3,3,3,1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,9,9,8,9,7,9,9,7,9,9,8,9,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,0,buffer,0,2,-1,0,-1,0,buffer,0,0,0,0,0,0,0,0,-0.8,buffer,0.333333333,-0.333333333,0,0,-0.266666667,buffer,0,2,1,0,1,0,0,0.4,0.4,0,0.4,0.4,0,0.4,0.4,0,0.4,0.4,0,0,0,0,0,0.8,buffer,C_Ug,0.186160841,-0.334988165,-0.1461411,-0.23426232,-0.132307686 +269,R_7TpMc3WtS8Bf0ko,53 - 59,American,Female,Female,University - Graduate (Masters),58,03VPfPs,02FUT,10,02DGEN,0.25,0,1,1,3,3,3,0,-2,-2,0,-1,1,2,0,1,0,3,1,3,3,2,0,-3,1,-1,2,-1,2,-2,-2,-1,3,0,3,3,2,0,-3,-2,-2,0,-1,2,-2,-2,-2,2,2,3,3,1,1,-2,-3,1,-2,1,3,2,2,0,3,2,3,3,0,1,-1,-3,2,-3,2,2,2,3,0,3,7,7,7,8,7,9,8,7,8,7,7,7,0,0,0,1,0,1,3,1,3,2,0,2,3,1,0,1,0,0,1,0,1,0,2,1,2,0,2,3,2,1,1,0,0,2,1,0,1,1,1,0,1,2,1,0,0,1,0,0,3,1,1,1,2,2,1,0,2,2,0,0,1,0,0,0,0,0,3,1,2,0,0,0,0,1,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,buffer,-1,0,0,-1,-1,1,2,0,2,2,-1,0,2,1,0,0,0,0,-2,-1,0,-1,0,-1,1,0,0,1,2,1,1,0,0,-1,0,-1,3,0,1,-1,-1,0,-1,1,1,buffer,-1,0,-1,1,0,2,buffer,-0.6,1.4,0.4,-0.6,-0.2,0.8,0,0.4,0,buffer,-0.666666667,1,0.4,1.85E-17,0.133333333,buffer,1,0,2,1,0,1,0.2,2,1.2,0.4,1.2,1.6,0.8,0.6,0.8,1,1.4,0.8,0.2,1.2,0.4,0.2,0.8,0.4,buffer,grad_prof,-0.500014922,0.369567588,0.719639792,-0.23426232,0.088732535 +270,R_7GvxJqW6FHe0Pg1,25 - 31,American,Female,Female,University - Graduate (Masters),26,01PfPsV,01PAST,5,02DGEN,0.25,0,1,2,3,0,3,3,3,-3,2,-3,2,2,-3,2,-2,2,-1,3,2,3,-1,1,-3,2,1,-1,3,2,3,3,3,-2,3,3,3,2,1,-3,3,3,2,3,3,3,3,3,2,3,0,3,3,1,-3,3,-3,3,3,-3,3,3,3,0,3,3,3,3,1,-3,3,-3,3,3,-3,3,3,3,6,5,10,9,10,10,5,10,2,2,0,0,3,0,2,0,4,2,0,0,4,3,1,5,1,5,1,4,0,3,0,1,2,0,1,6,0,1,6,1,5,1,0,0,0,0,0,2,0,1,0,1,1,0,1,5,1,2,0,3,0,0,2,0,1,0,1,1,0,1,5,1,1,0,1,0,3,0,0,1,2,3,0,1,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,buffer,3,0,2,0,4,0,0,-1,4,2,0,5,0,0,0,2,0,0,0,1,0,0,0,6,-1,0,6,0,0,0,-1,0,-2,0,3,0,0,1,2,3,0,1,0,0,0,buffer,1,-5,8,7,10,10,buffer,1.8,1,1,0.6,1,1.2,0,1.2,0.2,buffer,1.333333333,9,1.266666667,0.933333333,0.466666667,buffer,3,5,0,3,10,2,1.8,1.8,2.6,1.6,1.8,2.8,0,0.8,1.6,1,0.8,1.6,1,1.2,0.2,1,0,0,buffer,grad_prof,0.872336603,4.596902106,2.59549839,1.542756894,2.401873498 +271,R_12Us6HW6onCPXYR,39 - 45,American,Female,Female,College Diploma/Certificate,41,01PfPsV,02FUT,10,02DGEN,0.125,0,1,0,2,2,2,0,-1,-1,3,0,0,2,2,1,-2,3,1,2,2,2,1,0,0,3,0,0,2,2,2,2,2,0,2,2,2,0,0,0,3,1,0,3,3,3,1,3,1,2,1,2,1,0,0,3,0,1,3,1,1,0,3,1,2,1,2,1,0,0,3,0,1,3,3,3,0,3,4,3,3,2,3,4,2,2,2,2,2,2,1,0,0,0,1,1,1,0,0,0,0,0,1,4,1,0,0,0,0,0,1,1,0,1,0,1,1,2,3,0,1,0,1,0,1,1,1,0,0,1,1,1,0,2,0,1,0,1,0,1,1,1,0,0,1,1,1,2,2,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,buffer,0,0,-1,0,0,0,0,0,0,-1,-1,-1,1,2,1,-1,0,-1,0,-1,0,0,0,1,-1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,-1,-1,1,1,buffer,2,1,1,0,1,2,buffer,-0.2,-0.2,0.4,-0.6,0,0.2,0.4,0.2,0.2,buffer,1.333333333,1,0,-0.133333333,0.266666667,buffer,2,0,1,0,0,0,0.4,0.4,1.2,0,0.6,1.4,0.6,0.6,0.8,0.6,0.6,1.2,0.4,0.2,1,0,0,0.8,buffer,C_Ug,0.872336603,0.369567588,-0.1461411,-0.488122207,0.151910221 +272,R_1qUMieiwMtmCwyW,46 - 52,American,Female,Female,College Diploma/Certificate,46,03VPfPs,01PAST,5,01ITEM,0,0,1,1,2,3,0,-2,0,1,2,2,-2,3,1,3,-2,3,1,2,3,0,-3,0,2,2,3,-2,3,0,2,-2,3,1,2,3,0,-3,0,3,2,3,-2,3,1,2,-3,3,2,2,3,0,-3,0,3,2,3,-2,3,0,2,-2,3,2,2,3,0,-3,0,3,2,3,-2,3,0,1,-2,3,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,2,0,1,0,0,0,1,1,0,1,0,0,0,1,0,2,0,1,0,0,1,1,0,0,1,0,0,0,1,0,2,0,1,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,buffer,-1,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,-1,-1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,-1,1,0,buffer,0,0,0,0,0,0,buffer,-0.2,-0.2,0,-0.2,0,-0.2,0,0.2,0.2,buffer,0,0,-0.133333333,-0.133333333,0.133333333,buffer,0,0,0,0,0,0,0.2,0.4,0.4,0.2,0.6,0.4,0.4,0.6,0.4,0.4,0.6,0.6,0,0.2,0.4,0,0,0.2,buffer,C_Ug,-0.042564413,-0.158849227,-0.434734729,-0.488122207,-0.281067644 +273,R_3OtEK72619AMU3n,18 - 24,Canadian,Female,Female,High School (or equivalent),20,03VPfPs,02FUT,5,02DGEN,1,0,1,1,3,2,3,3,-1,2,0,2,2,1,1,2,2,1,0,3,3,0,0,2,2,2,3,0,2,1,2,2,1,1,1,3,-1,0,-3,1,-2,2,-1,2,1,1,1,0,1,3,3,3,3,0,1,2,0,1,1,1,3,3,1,1,3,2,2,3,0,2,2,2,2,2,2,2,2,1,3,3,2,4,5,4,2,1,2,4,5,2,1,0,1,3,3,3,0,2,1,2,1,0,0,0,0,0,2,1,4,3,2,1,2,0,3,1,0,1,1,1,0,0,1,0,0,1,1,2,2,1,0,0,1,1,0,0,0,0,1,0,1,0,2,0,0,1,1,0,0,0,1,2,0,1,0,5,1,4,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,2,1,1,1,1,1,0,buffer,1,0,0,3,3,2,-1,0,-1,1,1,0,-1,-1,0,0,2,1,3,3,1,1,0,0,3,0,-1,1,1,1,1,2,-1,0,0,5,0,4,-1,0,-1,-1,0,0,1,buffer,1,2,0,0,0,2,buffer,1.4,0.2,-0.2,1.8,1,0.4,0.4,1.6,-0.2,buffer,1,0.666666667,0.466666667,1.066666667,0.6,buffer,1,2,2,2,4,0,1.6,1.6,0.2,2,1.6,0.8,0.2,1.4,0.4,0.2,0.6,0.4,0.8,2.4,0.6,0.4,0.8,0.8,buffer,HS_TS,0.643611349,0.19342865,0.863936607,1.796616782,0.874398347 +274,R_7gQ3q59o1SLXtiF,32 - 38,American,Female,Female,College Diploma/Certificate,38,02PsVPf,01PAST,10,01ITEM,0.375,0,1,2,2,1,1,3,2,-3,3,-2,3,1,0,3,1,3,2,3,1,1,1,1,0,2,0,1,1,1,1,1,1,2,3,2,2,0,0,0,1,1,1,1,1,1,1,1,3,3,1,2,3,3,-3,3,-3,3,2,2,2,3,3,3,3,1,1,3,2,-3,3,-3,3,1,1,3,2,3,4,5,4,5,5,6,4,8,4,5,6,4,0,1,0,0,2,1,3,1,2,2,0,1,2,0,2,0,1,1,1,3,2,3,2,3,2,0,1,2,0,2,1,1,0,1,0,1,0,0,1,0,1,2,1,2,0,1,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,1,0,buffer,-1,0,0,-1,2,0,3,1,1,2,-1,-1,1,-2,2,-1,0,1,1,3,2,3,2,2,2,0,0,2,-1,2,0,0,1,0,1,0,0,1,1,0,-1,-1,-1,-1,0,buffer,0,-3,0,0,-1,2,buffer,0,1.4,-0.2,0.8,2.2,0.6,0.4,0.4,-0.8,buffer,-1,0.333333333,0.4,1.2,0,buffer,1,0,2,1,2,0,0.6,1.8,1,1.2,2.4,1,0.6,0.4,1.2,0.4,0.2,0.4,0.6,0.6,0,0.2,0.2,0.8,buffer,C_Ug,-0.728740176,0.017289712,0.719639792,2.05047667,0.514666499 +275,R_1gUk1SxUcNEGdq1,53 - 59,American,Female,Female,College Diploma/Certificate,55,02PsVPf,01PAST,10,02DGEN,-0.5,0,1,3,2,3,-2,3,-1,1,1,2,1,2,2,2,-3,2,2,2,2,-3,2,2,2,2,2,2,2,2,2,0,2,3,3,3,-3,3,-1,1,1,1,1,0,1,0,-1,0,2,2,3,-3,3,2,0,2,0,2,2,2,2,0,2,3,3,3,-3,3,2,0,2,0,2,2,2,2,0,2,2,1,2,3,2,3,2,2,2,2,2,2,1,0,1,1,1,3,1,1,0,1,0,0,0,3,0,0,1,0,1,0,0,0,0,1,0,2,1,2,2,2,1,0,0,1,0,3,1,1,2,1,0,0,0,3,0,0,1,0,1,0,3,1,1,2,1,0,0,0,3,0,1,1,1,0,1,3,1,1,1,1,2,1,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,1,0,1,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,-3,-1,-1,-1,-1,2,1,2,-1,2,0,0,1,0,1,3,1,1,1,1,2,1,2,1,2,buffer,0,-1,0,1,0,1,buffer,0.4,-0.4,0,0,-1.4,1.2,0.4,1.4,1.6,buffer,-0.333333333,0.666666667,0,-0.066666667,1.133333333,buffer,1,1,1,0,0,0,0.8,1.2,0.6,0.4,0.2,1.8,0.4,1.6,0.6,0.4,1.6,0.6,0.8,1.4,1.6,0.4,0,0,buffer,C_Ug,-0.271289667,0.19342865,-0.1461411,-0.361192264,-0.146298595 +276,R_2NV4QOALvC2Xyd8,18 - 24,Canadian,Male,Male,College Diploma/Certificate,23,02PsVPf,02FUT,10,01ITEM,0.625,0,0,2,3,-2,0,3,1,0,2,-2,3,1,-3,3,1,-2,0,1,0,-1,3,-2,3,-1,1,1,2,3,-1,-1,-3,3,2,0,1,-2,-3,-2,0,3,3,-1,0,-3,3,2,2,3,-2,-1,2,3,-3,-2,2,-1,3,-1,0,-1,1,2,3,-3,-1,-1,3,-2,-3,2,1,3,2,-2,2,-1,9,4,4,7,8,6,3,3,9,1,5,10,2,2,2,1,0,3,3,3,3,2,1,6,4,2,1,1,1,2,1,5,4,2,2,5,0,2,3,6,2,4,0,0,0,1,1,2,3,4,4,4,2,2,3,2,3,0,0,1,1,4,2,2,5,4,2,2,5,5,1,1,3,1,0,2,5,1,5,1,2,2,3,3,2,4,5,0,0,1,0,3,0,1,1,0,2,0,3,2,3,2,buffer,2,2,2,0,-1,1,0,-1,-1,-2,-1,4,1,0,-2,1,1,1,0,1,2,0,-3,1,-2,0,-2,1,1,3,3,1,-1,2,2,1,4,0,2,0,3,0,0,1,3,buffer,6,1,-5,6,3,-4,buffer,1,-0.6,0.4,0.8,-0.4,0.6,1.4,1.4,1.4,buffer,0.666666667,1.666666667,0.266666667,0.333333333,1.4,buffer,2,4,2,2,2,1,1.4,2.8,2.8,2,2.6,3.4,0.4,3.4,2.4,1.2,3,2.8,2.2,2.2,3.4,0.8,0.8,2,buffer,C_Ug,0.414886095,0.721845465,0.431046162,0.400387399,0.49204128 +277,R_5RCGbq3fkqc6VZn,32 - 38,American,Male,Male,High School (or equivalent),37,03VPfPs,01PAST,5,01ITEM,0,0,1,2,3,3,1,1,1,-1,3,-1,2,3,0,3,0,2,2,3,3,1,0,0,-1,3,-1,3,2,0,3,0,2,1,3,3,1,0,1,-1,3,-1,2,3,0,3,0,2,1,2,3,1,0,1,-2,2,-1,2,3,0,3,0,3,1,3,3,1,0,1,-1,2,-1,1,3,0,3,0,2,1,1,1,1,2,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,buffer,-1,-1,0,0,0,1,-1,-1,0,1,1,0,0,0,-1,0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,1,-1,0,0,0,1,-1,0,0,0,1,0,0,0,-1,buffer,1,1,1,1,1,1,buffer,-0.4,0,0,0,-0.4,0,0,0,0,buffer,1,1,-0.133333333,-0.133333333,0,buffer,0,1,0,0,1,0,0.2,0.4,0.2,0.4,0,0,0.6,0.4,0.2,0.4,0.4,0,0.2,0.4,0.2,0.2,0.4,0.2,buffer,HS_TS,0.643611349,0.369567588,-0.434734729,-0.488122207,0.0225805 +278,R_59mXsNJdpdeH8Ah,60 - 66,American,Male,Male,University - Undergraduate,66,01PfPsV,01PAST,5,02DGEN,-0.125,1,0,2,2,1,1,-1,-3,-1,1,-1,1,2,1,2,1,1,2,2,1,0,-1,-3,-1,1,-1,2,2,2,2,1,0,2,2,1,0,0,-3,-1,1,-1,2,2,2,2,1,1,2,1,1,1,0,-3,0,0,0,1,2,1,2,0,0,1,1,0,0,0,-3,0,0,0,0,2,1,2,0,0,2,2,2,4,4,2,4,2,1,3,3,2,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,buffer,0,-1,0,1,-1,0,-1,-1,-1,1,0,1,0,-1,0,-1,-1,-1,0,0,0,-1,-1,-1,0,0,1,0,-1,-1,-1,0,-1,-1,1,0,0,0,0,-1,0,0,0,0,1,buffer,-2,0,1,1,1,0,buffer,-0.2,-0.4,0,-0.6,-0.6,-0.2,-0.4,-0.2,0.2,buffer,-0.333333333,0.666666667,-0.2,-0.466666667,-0.133333333,buffer,2,2,0,1,1,1,0.2,0.2,0.4,0.4,0.2,0.2,0.4,0.6,0.4,1,0.8,0.4,0.2,0,0.2,0.6,0.2,0,buffer,C_Ug,-0.271289667,0.19342865,-0.579031545,-1.122771927,-0.444916122 +279,R_3zzN8Ps2vISvFsM,46 - 52,American,Female,Female,High School (or equivalent),48,03VPfPs,02FUT,5,01ITEM,-0.875,0,1,3,2,3,3,-3,-3,1,0,2,1,3,2,3,1,3,3,2,3,3,-3,-3,1,1,2,0,3,2,2,-1,3,3,2,3,3,-3,-3,1,1,2,1,3,2,0,0,3,3,2,3,3,-3,-3,0,1,0,1,3,2,2,0,3,3,2,3,3,-3,-3,0,2,0,1,3,2,2,-1,3,0,1,0,0,0,1,0,5,0,0,5,0,0,0,0,0,0,0,0,1,0,1,0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,3,1,0,0,0,0,0,0,0,1,1,2,0,0,0,1,1,0,0,0,0,0,0,0,1,2,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,buffer,0,0,0,0,0,0,-1,0,-2,1,0,0,0,1,0,0,0,0,0,0,0,-1,-1,-2,0,0,0,2,-1,0,0,0,0,0,0,0,0,-1,0,1,0,0,2,0,0,buffer,0,-4,0,0,-5,1,buffer,0,-0.4,0.2,0,-0.8,0.2,0,0,0.4,buffer,-1.333333333,-1.333333333,-0.066666667,-0.2,0.133333333,buffer,0,1,1,0,0,0,0,0.4,0.6,0,0.2,0.8,0,0.8,0.4,0,1,0.6,0,0.2,0.6,0,0.2,0.2,buffer,HS_TS,-0.95746543,-0.863404979,-0.290437916,-0.615052151,-0.681590119 +280,R_7jdZy6AICnrVoeF,53 - 59,American,Female,Female,University - Undergraduate,56,01PfPsV,02FUT,10,01ITEM,0,0.666666667,0.333333333,-1,1,2,3,-1,1,-1,2,-1,-2,3,1,3,-3,3,-1,1,2,2,1,1,1,2,1,1,2,1,2,1,2,-2,1,2,1,2,1,2,1,2,1,1,1,1,-1,2,1,1,2,3,-1,-1,-1,2,-1,-2,3,2,2,-3,3,-2,1,2,3,-2,-1,-2,2,-1,-2,3,2,2,-3,3,2,4,5,4,7,7,0,2,1,2,3,1,0,0,0,1,2,0,2,0,2,3,1,0,1,4,1,1,0,0,2,3,0,3,1,3,3,2,0,2,2,1,2,0,0,0,0,2,0,0,0,0,0,1,1,0,0,1,0,0,0,1,2,1,0,0,0,0,1,1,0,0,1,0,0,1,1,0,1,1,1,0,1,0,1,2,0,3,0,0,0,1,0,1,0,0,0,0,0,0,0,0,buffer,-2,0,0,1,2,-2,2,0,2,3,1,-1,0,4,1,0,0,0,2,2,-2,2,1,3,3,2,-1,1,2,1,-2,0,0,1,0,0,0,1,1,0,1,0,1,2,0,buffer,2,2,4,2,4,6,buffer,0.2,1,1,0.8,1.4,1,-0.2,0.4,0.8,buffer,2.666666667,4,0.733333333,1.066666667,0.333333333,buffer,2,3,2,2,1,0,0.6,1.4,1.4,1.2,2,1.4,0.4,0.4,0.4,0.4,0.6,0.4,0.6,0.6,0.8,0.8,0.2,0,buffer,C_Ug,1.78723762,1.954818032,1.441123867,1.796616782,1.744949075 +281,R_6Hisc5dHpCD03ip,53 - 59,American,Female,Female,High School (or equivalent),59,03VPfPs,01PAST,10,02DGEN,0,0.333333333,0.666666667,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,6,6,6,5,6,5,5,6,5,6,7,7,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,buffer,0,1,0,1,1,0,0,0,0,-1,0,-1,-1,0,0,0,1,0,1,1,0,0,1,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,buffer,1,0,1,-1,-1,-2,buffer,0.6,-0.2,-0.4,0.6,0,-0.2,0,-0.2,-0.2,buffer,0.666666667,-1.333333333,-1.85E-17,0.133333333,-0.133333333,buffer,1,0,1,1,1,2,0.6,0.2,0,0.6,0.2,0,0,0.4,0.4,0,0.2,0.2,0,0,0,0,0.2,0.2,buffer,HS_TS,0.414886095,-0.863404979,-0.1461411,0.019597567,-0.143765604 +282,R_66mQgvLpNsSvriu,18 - 24,American,Female,Female,High School (or equivalent),18,02PsVPf,02FUT,5,01ITEM,0,0,1,-2,3,1,-1,-2,-2,-2,1,3,-2,3,-2,2,1,2,-2,2,2,-2,-3,0,1,1,3,-2,2,-2,-2,3,2,-3,0,2,-2,-3,-3,1,-3,3,-3,2,-2,-2,0,2,0,3,1,0,0,0,-2,1,0,0,2,-2,2,0,2,0,3,1,1,0,0,-2,1,0,0,2,-2,2,0,2,4,5,4,4,6,7,3,6,3,3,4,4,0,1,1,1,1,2,3,0,0,0,1,0,4,2,0,1,3,1,1,1,1,3,4,0,1,1,0,4,1,0,2,0,0,1,2,2,0,0,3,2,1,0,0,1,0,2,0,0,2,2,2,0,0,3,2,1,0,0,1,0,1,2,0,0,0,3,0,4,0,1,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,-2,1,1,0,-1,0,3,0,-3,-2,0,0,4,1,0,-1,3,1,-1,-1,-1,3,4,-3,-1,0,0,4,0,0,1,2,0,-1,0,3,0,4,0,1,0,0,0,3,0,buffer,1,-1,1,1,2,3,buffer,-0.2,-0.4,1,0.2,0.4,0.8,0.4,1.6,0.6,buffer,0.333333333,2,0.133333333,0.466666667,0.866666667,buffer,0,1,3,0,2,1,0.8,1,1.4,1.4,1.8,1.2,1,1.4,0.4,1.2,1.4,0.4,0.6,1.6,0.6,0.2,0,0,buffer,HS_TS,0.186160841,0.897984403,0.14245253,0.654247288,0.470211265 +283,R_5cY2ZT0ANnNZl73,32 - 38,American,Female,Female,College Diploma/Certificate,36,01PfPsV,02FUT,10,01ITEM,0.125,0,1,2,3,3,3,0,-3,1,-3,2,0,1,-1,3,-3,1,1,3,3,3,-2,-1,-1,-1,1,-1,3,2,1,0,3,2,3,3,3,-2,0,0,-2,3,0,3,2,2,0,3,2,3,3,3,0,0,0,1,1,0,3,3,3,0,3,2,3,0,3,0,0,0,1,0,0,3,3,2,0,3,3,5,2,1,3,2,4,2,1,3,2,5,1,0,0,0,2,2,2,2,1,1,2,3,2,3,2,0,0,0,0,2,3,1,1,1,0,2,3,1,3,2,0,0,0,0,0,3,1,4,1,0,2,4,0,3,2,0,0,3,0,0,3,1,4,2,0,2,4,1,3,2,1,0,0,0,0,1,1,1,2,1,0,0,1,0,0,0,0,3,0,0,0,0,0,1,0,0,0,1,0,0,buffer,1,0,0,0,2,-1,1,-2,0,1,0,-1,2,0,0,0,0,-3,0,2,0,0,-3,-1,0,0,-1,0,0,0,1,0,-3,0,0,1,1,1,1,1,0,0,0,0,0,buffer,-1,3,1,-2,1,-3,buffer,0.6,-0.2,0.2,-0.2,-0.8,-0.2,-0.4,1,0,buffer,1,-1.333333333,0.2,-0.4,0.2,buffer,2,2,0,1,0,4,0.6,1.6,2.4,0.4,1.2,2.2,0,1.8,2.2,0.6,2,2.4,0.2,1.2,0.2,0.6,0.2,0.2,buffer,C_Ug,0.643611349,-0.863404979,0.286749346,-0.995841983,-0.232221567 +284,R_7YXiACpJdxqUAoq,32 - 38,American,Female,Female,High School (or equivalent),33,03VPfPs,01PAST,5,02DGEN,-0.25,0,1,3,3,1,3,1,-3,-3,-3,3,-3,-3,3,3,-3,0,3,3,3,3,3,3,3,-3,3,-3,-3,3,3,-3,-3,1,3,3,3,-3,-3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,-3,-3,3,3,-3,-3,3,3,3,3,3,-3,-3,-3,3,-3,-3,3,3,-3,-3,5,7,3,10,1,5,5,4,4,1,1,1,0,0,2,0,2,6,6,0,0,0,0,0,0,0,3,2,0,2,0,4,0,6,0,0,0,6,0,6,6,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,3,2,0,0,0,6,6,0,0,0,0,6,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,2,0,0,0,2,0,6,0,0,0,6,0,6,6,0,2,0,0,0,6,6,0,0,0,0,6,0,6,6,0,buffer,0,3,-1,9,0,4,buffer,0,2.4,0,0.8,1.2,3.6,1.6,1.2,3.6,buffer,0.666666667,4.333333333,0.8,1.866666667,2.133333333,buffer,5,6,2,4,3,3,0.8,2.4,0.6,1.6,1.2,4.2,0.8,0,0.6,0.8,0,0.6,1.6,1.2,3.6,0,0,0,buffer,HS_TS,0.414886095,2.13095697,1.585420683,3.319776109,1.862759964 +285,R_7eM3OcVZcERSnNb,25 - 31,American,Male,Male,College Diploma/Certificate,27,02PsVPf,02FUT,10,02DGEN,1,1,0,2,2,2,2,2,2,0,1,1,2,1,1,2,2,2,3,3,3,3,3,3,0,1,0,3,1,1,3,2,3,3,3,3,3,3,3,0,2,0,3,3,1,3,3,3,3,3,3,3,3,3,0,1,0,3,2,3,3,2,3,3,3,3,3,3,3,0,2,0,3,1,1,3,3,3,0,0,0,0,0,0,0,0,0,0,7,6,1,1,1,1,1,1,0,0,1,1,0,0,1,0,1,1,1,1,1,1,1,0,1,1,1,2,0,1,1,1,1,1,1,1,1,1,0,0,1,1,1,2,1,0,1,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,2,0,1,0,buffer,0,0,0,0,0,0,0,0,0,0,-1,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-2,0,0,0,buffer,0,0,0,0,-7,-6,buffer,0,0,-0.6,0,0,0.4,0,0,-0.2,buffer,0,-4.333333333,-0.2,0.133333333,-0.066666667,buffer,0,0,0,0,7,6,1,0.6,0.4,1,0.8,1,1,0.6,1,1,0.8,0.6,0,0.2,0.6,0,0.2,0.8,buffer,C_Ug,-0.042564413,-2.448655423,-0.579031545,0.019597567,-0.762663454 +286,R_7dnoQWUMsadGrOp,60 - 66,American,Male,Male,College Diploma/Certificate,60,03VPfPs,01PAST,5,01ITEM,0.25,0.666666667,0.333333333,-3,-1,-1,-3,2,-3,0,2,-3,1,2,3,1,1,3,-3,-2,1,-3,2,-3,-2,-1,-2,-2,2,3,2,-1,1,-2,-1,-1,-1,-2,-2,-2,-1,-2,2,-1,-2,-2,-2,-2,-1,1,-1,-3,-1,-1,0,-1,-1,0,-2,-1,-2,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,2,2,2,1,5,3,10,10,10,0,1,2,0,0,0,2,3,1,3,0,0,1,2,2,1,0,0,2,4,1,2,3,1,1,3,5,3,3,5,2,2,0,0,3,2,0,3,2,1,4,4,3,3,4,3,1,1,3,2,3,0,2,3,1,2,3,1,1,3,1,1,2,2,4,1,0,0,0,4,3,5,4,1,3,1,1,1,3,1,1,0,1,1,0,2,1,2,2,1,buffer,-2,-1,2,0,-3,-2,2,0,-1,2,-4,-4,-2,-1,-2,-2,-1,-1,-1,2,-2,2,1,-2,0,1,2,2,2,2,0,0,1,-1,3,0,0,-1,-1,4,1,4,2,-1,2,buffer,1,-4,-3,-8,-8,-8,buffer,-0.8,0.2,-2.6,-0.6,-0.2,1.8,0.6,0.4,1.6,buffer,-2,-8,-1.066666667,0.333333333,0.866666667,buffer,0,1,2,9,5,7,0.6,1.8,1,1.4,1.6,3.8,1.4,1.6,3.6,2,1.8,2,2,1,3.2,1.4,0.6,1.6,buffer,C_Ug,-1.414915939,-4.386183744,-2.454890143,0.400387399,-1.963900607 +287,R_3IWAKxaAqfStSLY,18 - 24,Canadian,Male,Male,University - Graduate (Masters),20,02PsVPf,01PAST,10,02DGEN,0.875,0.666666667,0.333333333,2,3,3,1,3,2,-1,2,3,3,3,2,3,2,2,0,3,3,3,1,1,1,0,1,1,0,1,0,2,-1,-2,1,3,3,-2,2,3,-2,1,-1,2,1,-2,1,1,2,2,0,-2,3,3,-2,2,-3,2,2,1,2,3,1,3,2,0,-1,3,2,-3,3,-3,3,2,3,3,1,3,3,4,4,9,8,3,7,6,7,7,4,7,2,0,0,2,2,1,2,2,2,2,3,1,3,0,3,4,2,0,2,5,0,4,4,2,4,1,1,5,1,1,0,1,3,3,0,1,1,0,6,1,1,1,1,1,1,1,1,3,2,0,0,2,1,6,0,1,1,0,1,1,2,2,0,0,3,1,2,2,0,2,2,0,2,1,2,1,0,0,1,0,1,1,1,0,1,0,2,1,2,2,buffer,2,-1,-3,-1,2,0,1,2,-4,1,2,0,2,-1,2,3,1,-3,0,5,0,2,3,-4,4,0,0,5,0,0,1,2,0,-1,3,0,1,1,0,1,2,-2,1,-1,0,buffer,-4,-2,-3,2,4,-4,buffer,-0.2,0,1,1.2,1,1,1,0.6,0,buffer,-3,0.666666667,0.266666667,1.066666667,0.533333333,buffer,6,4,1,0,2,0,1.2,1.8,2,2.6,2.8,1.8,1.4,1.8,1,1.4,1.8,0.8,1.4,1.4,1.4,0.4,0.8,1.4,buffer,grad_prof,-2.101091701,0.19342865,0.431046162,1.796616782,0.079999973 +288,R_3mGqhGhkFRf9EM9,53 - 59,American,Female,Female,College Diploma/Certificate,56,03VPfPs,01PAST,5,02DGEN,0.25,0.666666667,0.333333333,2,3,1,-1,2,0,-3,3,1,2,1,0,2,1,3,2,3,1,-3,2,0,-3,3,1,2,2,1,2,2,3,2,3,2,-3,2,-2,-2,3,1,-1,1,1,1,3,3,2,3,1,-1,3,0,-3,3,-1,2,1,1,3,0,3,2,3,2,0,3,-1,-3,3,-1,2,1,1,3,-1,3,3,1,3,4,3,4,2,2,2,2,2,2,0,0,0,2,0,0,0,0,0,0,1,1,0,1,0,0,0,1,2,0,2,1,0,0,3,0,1,1,2,0,0,0,0,0,1,0,0,0,2,0,0,1,1,1,0,0,0,1,1,1,1,0,0,2,0,0,1,1,2,0,0,0,1,0,0,2,1,0,0,3,1,0,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,2,-1,0,0,0,-2,0,1,0,-1,0,0,0,0,0,1,-1,1,1,0,-2,3,0,0,0,0,0,0,0,0,-1,0,1,1,0,0,3,1,0,1,0,0,buffer,1,-1,1,2,1,2,buffer,0.2,-0.4,0,0,0.6,0,-0.2,1,0.4,buffer,0.333333333,1.666666667,-0.066666667,0.2,0.4,buffer,1,2,1,0,0,0,0.4,0,0.6,0.6,1.2,0.8,0.2,0.4,0.6,0.6,0.6,0.8,0.2,1.2,0.6,0.4,0.2,0.2,buffer,C_Ug,0.186160841,0.721845465,-0.290437916,0.146527512,0.191023975 +289,R_1vdKXuobkkmrUjW,32 - 38,American,Female,Female,College Diploma/Certificate,37,02PsVPf,02FUT,5,01ITEM,-0.625,0,1,3,3,3,3,3,-3,1,1,3,0,1,2,1,0,2,3,3,3,3,3,-3,-1,1,0,0,1,1,1,1,1,3,3,3,3,3,-3,1,2,1,0,2,2,2,2,2,3,3,3,3,3,-3,0,3,0,1,2,2,2,0,2,2,2,2,2,2,-3,0,2,-1,0,1,3,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,0,0,1,0,1,1,0,0,0,0,0,0,0,1,2,0,1,0,1,2,0,0,0,0,0,0,0,1,2,3,1,1,0,1,0,0,1,1,1,1,1,0,1,1,4,0,0,1,0,1,0,0,0,0,0,0,0,2,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,buffer,0,0,0,0,0,0,1,-2,0,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,0,-1,0,-2,0,1,-1,1,1,0,-1,-1,-1,-1,-1,0,2,0,0,-1,0,0,0,0,1,buffer,0,0,0,0,0,0,buffer,0,-0.4,0.2,-1,-0.6,0.4,-1,0.2,0.2,buffer,0,0,-0.066666667,-0.4,-0.2,buffer,0,0,0,0,0,0,0,1,0.6,0,0.6,0.8,0,1.4,0.4,1,1.2,0.4,0,0.8,1,1,0.6,0.8,buffer,C_Ug,-0.042564413,-0.158849227,-0.290437916,-0.995841983,-0.371923385 +290,R_7WBbf2o6ODdSaGn,53 - 59,American,Female,Female,High School (or equivalent),55,03VPfPs,01PAST,5,02DGEN,-0.125,0,0.333333333,1,2,2,2,1,0,0,1,0,0,2,1,2,1,2,2,2,2,2,1,0,0,1,0,0,2,2,2,1,2,2,2,2,2,1,0,1,2,0,1,2,2,2,1,2,2,2,2,2,1,1,1,2,0,1,2,2,2,1,2,2,2,2,2,1,0,1,2,0,1,2,2,2,1,2,4,4,5,4,4,4,4,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-1,-1,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,1,0,1,0,0,0,0,0,buffer,0,0,1,0,0,0,buffer,0,-0.8,0,0,0,0,0,0.4,0,buffer,0.333333333,0,-0.266666667,0,0.133333333,buffer,0,0,1,0,0,0,0.2,0,0.2,0.2,0.6,0.2,0.2,0.8,0.2,0.2,0.6,0.2,0,0.6,0,0,0.2,0,buffer,HS_TS,0.186160841,-0.158849227,-0.723328361,-0.23426232,-0.232569767 +291,R_3NzeTBICrvLndPX,39 - 45,American,Female,Female,University - Graduate (Masters),45,02PsVPf,02FUT,5,01ITEM,0.25,0,1,1,3,2,-1,3,2,-1,1,1,2,1,-1,3,1,3,-1,2,2,1,-1,1,1,0,1,1,1,-2,2,1,3,2,2,-1,0,3,2,1,2,1,3,2,0,2,1,3,1,3,3,0,3,1,-1,1,0,1,1,-1,3,0,3,2,3,3,0,3,2,0,1,1,1,1,-1,3,-1,3,6,5,2,7,7,6,6,5,5,2,4,2,2,1,0,2,4,1,2,1,0,1,0,1,1,0,0,1,1,3,1,0,0,2,1,0,1,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0,1,1,0,0,1,0,0,1,0,0,0,2,0,3,0,3,1,4,1,0,2,0,2,1,2,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,0,buffer,2,1,-1,1,4,0,2,1,-1,0,0,1,1,-1,0,0,1,2,0,0,0,1,1,0,0,1,1,1,-2,0,2,0,3,1,4,0,-1,2,-1,2,1,2,0,-1,0,buffer,0,0,-3,5,3,4,buffer,1.4,0.4,0.2,0.6,0.4,0.2,2,0.4,0.4,buffer,-1,4,0.666666667,0.4,0.933333333,buffer,1,2,4,4,1,3,1.8,1,0.4,1.2,0.8,0.6,0.4,0.6,0.2,0.6,0.4,0.4,2.2,1,0.6,0.2,0.6,0.2,buffer,grad_prof,-0.728740176,1.954818032,1.296827053,0.527317343,0.762555563 +292,R_1rxnoxX4FhPFEbz,53 - 59,American,Male,Male,Trade School (non-military),57,03VPfPs,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,2,1,2,1,-2,-2,-2,2,1,2,2,-1,3,-2,2,2,2,3,1,-2,-2,-2,2,2,1,2,2,2,-2,3,2,2,2,1,-2,-2,-2,2,2,1,2,2,2,-2,2,2,2,2,2,-1,2,-3,2,1,2,1,-1,2,-2,3,2,-1,2,2,-2,-2,-2,2,2,2,-1,-1,3,-2,2,1,1,6,2,2,7,1,2,1,1,1,1,0,1,1,0,0,0,0,0,1,1,0,3,1,0,1,0,1,0,0,0,0,0,0,1,1,0,3,1,0,0,0,1,0,1,1,4,1,0,0,0,1,0,1,0,1,0,2,0,1,0,0,0,0,1,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,3,0,0,1,4,1,0,1,0,2,0,1,0,1,buffer,0,0,1,-1,-1,-4,-1,0,1,1,-1,3,0,0,0,0,-1,0,-1,0,0,0,0,0,1,-3,3,1,0,0,0,-3,1,0,-1,-4,-1,0,-1,0,-2,0,-1,0,0,buffer,0,-1,5,1,1,6,buffer,-0.2,-0.6,0.4,-0.4,0.2,0.2,-0.6,-1.2,-0.6,buffer,1.333333333,2.666666667,-0.133333333,0,-0.8,buffer,1,1,1,0,1,0,0.4,0.4,1,0.2,0.4,0.8,0.6,1,0.6,0.6,0.2,0.6,0.2,0,0.2,0.8,1.2,0.8,buffer,HS_TS,0.872336603,1.25026228,-0.434734729,-0.23426232,0.363400458 +293,R_3fqxXMhwmdAk8GS,46 - 52,American,Male,Male,High School (or equivalent),49,02PsVPf,02FUT,10,02DGEN,1,0,0.666666667,2,2,2,2,2,0,1,2,2,2,-2,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,1,1,1,2,-1,1,2,2,1,8,8,8,8,8,8,8,8,9,9,7,8,0,0,0,0,0,2,1,0,0,0,4,4,0,0,0,0,0,0,0,0,2,1,0,0,0,4,4,0,0,0,0,0,0,0,0,2,1,0,0,0,4,4,0,0,0,0,0,0,0,0,1,0,1,1,0,1,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,1,1,0,3,1,0,0,1,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,-1,-1,0,3,1,0,0,-1,0,0,0,0,0,-3,-1,-1,-1,0,-3,-1,0,0,-1,buffer,0,0,-1,-1,1,0,buffer,0,0,0,0,0,0.6,0,-1.2,-1,buffer,-0.333333333,0,0,0.2,-0.733333333,buffer,0,0,0,1,1,1,0,0.6,1.6,0,0.6,1.6,0,0.6,1.6,0,0.6,1,0,0,0,0,1.2,1,buffer,HS_TS,-0.271289667,-0.158849227,-0.1461411,0.146527512,-0.10743812 +294,R_7TWNJXUYqK0M8Wq,32 - 38,American,Male,Male,High School (or equivalent),36,01PfPsV,01PAST,10,02DGEN,0,0,1,3,2,3,2,3,-2,1,2,1,-1,2,2,1,0,2,3,3,3,3,3,-1,0,-1,0,1,3,1,-2,-2,2,3,3,3,3,3,-1,3,1,1,-1,2,0,-1,2,0,-1,-3,-2,-3,-2,0,-1,0,-1,-2,2,-3,2,-1,3,3,3,3,3,3,1,-1,0,1,-1,0,3,1,-2,-2,3,2,3,3,1,3,3,3,3,3,3,3,0,1,0,1,0,1,1,3,1,2,1,1,3,2,0,0,1,0,1,0,1,2,1,0,0,0,2,2,2,2,4,5,5,5,5,2,2,2,2,1,0,5,1,1,1,0,1,0,1,0,3,2,2,0,0,2,1,0,2,4,0,0,0,0,0,0,3,2,1,2,1,1,1,4,2,4,6,5,6,5,1,0,0,2,1,2,6,1,1,5,buffer,-4,-4,-5,-4,-5,-1,-1,1,-1,1,1,-4,2,1,-1,0,0,0,0,0,-2,0,-1,0,0,-2,1,2,0,-2,-4,-6,-5,-6,-5,-1,3,2,-1,1,-1,-5,0,3,-3,buffer,0,-1,0,0,-2,0,buffer,-4.4,-0.2,-0.2,0,-0.6,-0.2,-5.2,0.8,-1.2,buffer,-0.333333333,-0.666666667,-1.6,-0.266666667,-1.866666667,buffer,0,1,0,0,0,0,0.4,1.6,1.4,0.4,0.8,1.6,4.8,1.8,1.6,0.4,1.4,1.8,0,1.6,1.8,5.2,0.8,3,buffer,HS_TS,-0.271289667,-0.511127103,-3.609264664,-0.741982096,-1.283415883 +295,R_6VZiNTcZWCVvp9D,53 - 59,American,Male,Male,College Diploma/Certificate,58,02PsVPf,01PAST,10,01ITEM,0.125,0,1,1,2,2,2,2,-1,-2,2,-2,2,2,2,2,-3,2,1,2,2,2,2,-1,-1,2,-1,2,2,2,2,-3,2,1,2,2,2,2,-2,-2,2,-2,2,2,2,2,-3,2,1,2,2,2,2,1,-3,2,-3,2,2,2,2,-3,2,1,2,2,2,2,1,-3,2,-3,2,2,2,2,-3,2,1,5,1,1,6,2,1,2,0,0,2,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,buffer,0,3,1,1,4,1,buffer,0,-0.4,0,0,-0.6,0,0,0.6,0,buffer,1.333333333,2,-0.133333333,-0.2,0.2,buffer,0,1,1,1,0,1,0,0.4,0,0,0.2,0,0,0.8,0,0,0.8,0,0,0.6,0,0,0,0,buffer,C_Ug,0.872336603,0.897984403,-0.434734729,-0.615052151,0.180133531 +296,R_3gUVHPExnQqppYd,53 - 59,American,Female,Female,High School (or equivalent),57,03VPfPs,02FUT,5,02DGEN,-2,0.333333333,0.333333333,3,3,3,3,3,-3,-3,1,-3,1,3,3,3,-3,3,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,3,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2,0,4,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,0,0,0,0,1,0,0,0,0,0,0,0,2,0,4,0,0,0,0,1,0,0,0,0,0,0,0,2,0,4,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,buffer,0,0,-5,0,0,0,buffer,0,0,-0.2,0,0,0,0,0,0.2,buffer,-1.666666667,0,-0.066666667,0,0.066666667,buffer,0,0,0,0,0,5,0,1.2,0,0,1.2,0.2,0,1.2,0.2,0,1.2,0.2,0,0,0.2,0,0,0,buffer,HS_TS,-1.186190685,-0.158849227,-0.290437916,-0.23426232,-0.467435037 +297,R_53Q1871ckrSILOp,32 - 38,American,Male,Male,University - Graduate (Masters),36,02PsVPf,02FUT,10,02DGEN,1.125,0,1,3,3,3,0,3,-1,-3,-3,-2,3,2,3,1,3,2,3,2,3,3,2,-2,-3,-3,-3,-2,2,3,2,3,3,3,3,3,3,2,-2,-2,-2,-3,-3,3,2,2,3,3,3,2,3,3,3,-2,-2,-2,-3,-2,3,3,3,3,3,2,3,3,2,3,-2,-2,-2,-3,-2,2,3,3,2,3,5,5,5,5,5,5,5,5,5,5,5,5,0,1,0,3,1,1,0,0,1,5,0,0,1,0,1,0,0,0,3,1,1,1,1,1,6,1,1,1,0,1,0,1,0,3,0,1,1,1,1,5,1,0,2,0,1,1,0,0,2,0,1,1,1,1,5,0,0,2,1,1,0,1,0,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,buffer,0,0,0,0,1,0,-1,-1,0,0,-1,0,-1,0,0,-1,0,0,1,1,0,0,0,0,1,1,1,-1,-1,0,-1,0,0,-1,0,0,1,1,0,1,0,1,0,-1,0,buffer,0,0,0,0,0,0,buffer,0.2,-0.4,-0.4,0.2,0.2,0,-0.4,0.6,0,buffer,0,0,-0.2,0.133333333,0.066666667,buffer,0,0,0,0,0,0,1,1.4,0.4,0.8,2,0.8,0.8,1.8,0.8,0.6,1.8,0.8,0.2,0.6,0.4,0.6,0,0.4,buffer,grad_prof,-0.042564413,-0.158849227,-0.579031545,0.019597567,-0.190211904 +298,R_7MSQwkC8SJ9HsU3,32 - 38,American,Female,Female,University - Graduate (Masters),34,01PfPsV,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,2,2,2,2,3,2,-1,2,3,2,1,2,1,-1,2,1,1,3,3,2,2,1,-1,2,1,3,2,-1,3,3,2,2,-1,-1,1,1,1,-1,2,-1,3,3,-1,2,3,2,3,1,2,3,2,-1,3,-1,3,1,2,3,2,2,3,3,1,1,3,3,-1,3,-2,3,2,2,3,3,2,9,8,7,6,8,8,6,8,9,9,9,9,1,1,1,1,1,0,2,3,1,1,2,0,2,4,1,0,0,3,3,2,1,2,3,1,3,2,1,2,3,1,0,1,1,0,0,0,0,1,4,1,0,0,2,3,0,1,1,1,1,0,1,0,1,5,1,1,0,2,4,0,1,1,4,4,1,1,0,0,0,2,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,buffer,1,0,0,1,1,0,2,2,-3,0,2,0,0,1,1,-1,-1,2,2,2,0,2,2,-4,2,1,1,0,-1,1,0,1,4,3,1,0,0,0,-1,2,-1,1,0,0,0,buffer,3,0,-2,-3,-1,-1,buffer,0.6,0.2,0.8,0.8,0.4,0.4,1.8,0.2,0,buffer,0.333333333,-1.666666667,0.533333333,0.533333333,0.666666667,buffer,3,0,1,3,1,0,1,1.4,1.8,1.6,2,1.8,0.4,1.2,1,0.8,1.6,1.4,2.2,0.6,0.4,0.4,0.4,0.4,buffer,grad_prof,0.186160841,-1.039543918,1.008233421,0.78117723,0.234006894 +299,R_5pojpy8GIBp7d1G,32 - 38,American,Male,Male,University - Undergraduate,35,01PfPsV,02FUT,5,02DGEN,0.875,0.666666667,0.333333333,1,3,3,0,1,0,0,1,0,-1,1,0,2,1,1,2,1,1,0,1,2,0,1,1,2,2,1,2,1,0,1,1,2,2,0,1,1,0,3,1,3,1,0,1,0,2,3,0,1,1,2,0,1,2,2,3,1,0,0,1,0,2,1,0,1,1,1,1,2,2,2,1,0,2,2,9,7,7,8,7,7,9,8,8,9,8,9,1,2,2,0,0,2,0,0,1,3,1,1,0,0,1,0,2,1,2,1,1,1,1,3,2,2,1,2,0,1,1,0,3,1,0,2,0,0,2,3,2,1,2,1,0,1,1,2,0,0,1,1,0,2,3,1,1,2,1,1,1,0,1,2,1,1,1,1,2,1,1,0,2,0,0,2,1,1,1,0,1,1,0,0,0,1,0,0,2,1,buffer,0,2,-1,-1,0,0,0,0,-1,0,-1,0,-2,-1,1,-1,1,-1,2,1,0,0,1,1,-1,1,0,0,-1,0,-1,-1,0,1,1,0,0,1,2,1,0,0,2,-2,-1,buffer,0,-1,-1,-1,-1,-2,buffer,0,-0.2,-0.6,0.4,0.2,0,0,0.8,-0.2,buffer,-0.666666667,-1.333333333,-0.266666667,0.2,0.2,buffer,1,0,0,0,0,1,1,1.2,0.6,1.2,1.6,1.2,1,1.4,1.2,0.8,1.4,1.2,1,1.2,0.6,1,0.4,0.8,buffer,C_Ug,-0.500014922,-0.863404979,-0.723328361,0.146527512,-0.485055188 +300,R_1gAb8AYhhuTy3j4,32 - 38,American,Female,Female,University - Undergraduate,34,01PfPsV,01PAST,10,01ITEM,1.125,0.666666667,0.333333333,1,2,2,3,2,2,2,2,3,3,3,2,1,2,3,2,1,2,3,2,2,2,1,3,2,2,2,1,3,2,2,2,3,2,3,3,2,2,2,1,3,2,1,2,3,1,2,3,3,2,2,1,3,1,2,2,2,1,3,2,2,3,1,2,2,2,3,2,2,1,2,3,3,2,1,8,8,8,9,9,8,8,7,8,8,8,9,1,1,0,0,0,0,0,1,0,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1,2,0,0,0,0,0,0,0,1,0,0,0,1,1,2,1,1,0,0,1,1,1,1,1,1,0,0,1,0,1,2,1,1,2,0,2,0,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,2,1,0,0,2,1,1,1,0,1,2,1,1,buffer,1,1,-1,0,0,0,-1,0,-2,0,0,0,0,0,0,0,-1,0,0,1,1,-1,0,0,0,-1,-1,-2,0,-2,-1,0,-1,0,1,1,-2,0,0,0,1,-1,-2,0,0,buffer,0,1,0,1,1,-1,buffer,0.2,-0.6,0,0,0,-1.2,-0.2,-0.2,-0.4,buffer,0.333333333,0.333333333,-0.133333333,-0.4,-0.266666667,buffer,1,1,0,0,1,1,0.4,0.4,0.6,0.8,0.8,0,0.2,1,0.6,0.8,0.8,1.2,0.8,0.8,0.6,1,1,1,buffer,C_Ug,0.186160841,0.017289712,-0.434734729,-0.995841983,-0.30678154 +301,R_3ZKoWq577jbPQow,32 - 38,American,Male,Male,High School (or equivalent),38,01PfPsV,01PAST,5,02DGEN,0.25,0,1,3,3,3,2,3,3,0,2,3,3,3,3,2,3,2,3,3,-1,1,3,3,3,3,3,3,3,3,2,3,3,3,3,-1,3,3,3,0,1,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,6,5,5,5,5,5,7,9,5,7,10,0,0,4,1,0,0,3,1,0,0,0,0,0,0,1,0,0,4,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,1,0,0,3,1,0,0,1,1,1,1,0,0,0,0,1,0,0,3,1,0,0,0,0,1,0,1,0,0,0,2,0,0,3,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,1,buffer,0,0,4,0,0,0,0,0,0,0,-1,-1,-1,-1,1,0,0,4,0,0,0,-3,0,0,0,0,1,0,0,0,0,0,0,2,0,0,3,2,0,0,-1,0,-1,-1,-1,buffer,0,-1,-4,0,-2,-5,buffer,0.8,0,-0.6,0.8,-0.6,0.2,0.4,1,-0.8,buffer,-1.666666667,-2.333333333,0.066666667,0.133333333,0.2,buffer,0,1,0,0,0,1,1,0.8,0.2,1,0.2,0.6,0.2,0.8,0.8,0.2,0.8,0.4,0.4,1,0.4,0,0,1.2,buffer,HS_TS,-1.186190685,-1.391821794,-0.001844284,0.019597567,-0.640064799 +302,R_7cdr4IBGZHAfx8M,32 - 38,American,Male,Male,University - Graduate (Masters),37,03VPfPs,02FUT,5,02DGEN,0,1,0,3,3,3,3,3,3,-2,NA,-2,3,3,3,3,1,2,2,3,2,3,3,2,-1,1,-3,1,3,2,1,2,0,2,2,2,3,2,3,-2,2,-2,2,1,3,2,2,2,3,3,3,3,3,1,2,2,1,2,1,1,1,3,1,2,2,2,1,1,2,-2,3,-2,2,1,2,1,2,2,6,6,7,6,6,6,6,6,10,6,7,6,1,0,1,0,0,1,1,NA,1,2,0,1,2,1,2,1,1,1,0,1,0,0,NA,0,1,2,0,1,1,0,0,0,0,0,0,2,4,NA,3,1,2,2,2,2,1,1,1,1,2,2,1,0,NA,0,1,2,1,2,1,0,0,1,0,0,1,1,1,1,1,1,2,1,1,0,2,1,1,1,2,2,1,4,1,3,0,0,1,0,1,1,buffer,1,0,1,0,0,-1,-3,NA,-2,1,-2,-1,0,-1,1,0,0,0,-2,-1,-1,0,NA,0,0,0,-1,-1,0,0,-1,0,-1,-2,-1,0,-3,0,-2,1,2,0,1,-1,1,buffer,0,0,-3,0,-1,0,buffer,0.4,-1.25,-0.6,-0.6,-0.25,-0.4,-1,-0.8,0.6,buffer,-1,-0.333333333,-0.483333333,-0.416666667,-0.4,buffer,0,0,1,0,1,4,0.4,1.25,1.2,0.8,0.25,0.8,0,2.5,1.8,1.4,0.5,1.2,0.4,1,1.2,1.4,1.8,0.6,buffer,grad_prof,-0.728740176,-0.334988165,-1.192293009,-1.027574469,-0.820898955 +303,R_5JAxGZ58mS8RU8F,39 - 45,American,Male,Male,Trade School (non-military),45,03VPfPs,02FUT,10,01ITEM,0.875,0,1,2,2,2,2,1,1,1,0,1,0,1,0,3,1,1,3,2,1,2,2,2,1,2,1,2,3,2,3,2,2,2,1,2,-1,2,1,1,1,-1,1,2,3,2,2,1,2,2,3,2,3,0,-2,2,-2,1,2,2,0,1,0,2,2,1,2,2,1,3,2,2,2,1,2,1,2,2,7,7,8,7,8,8,7,6,8,6,7,7,1,0,1,0,1,1,0,2,0,2,2,2,0,1,1,0,1,0,3,1,0,0,1,2,1,1,3,1,1,0,0,0,1,0,2,1,3,2,3,1,1,2,3,0,1,0,0,1,0,1,0,2,2,1,2,0,2,2,1,1,1,1,1,3,0,1,0,1,2,1,1,1,1,0,1,0,0,2,0,1,1,5,0,4,1,1,0,1,1,2,buffer,1,0,0,0,-1,0,-3,0,-3,1,1,0,-3,1,0,0,1,-1,3,0,0,-2,-1,1,-1,1,1,-1,0,-1,1,1,-1,3,-1,0,-5,1,-2,0,0,1,0,-1,-1,buffer,0,1,0,1,1,1,buffer,0,-1,-0.2,0.6,-0.6,0,0.6,-1.2,-0.2,buffer,0.333333333,1,-0.4,0,-0.266666667,buffer,0,1,0,1,1,1,0.6,1,1.2,1,0.8,1.2,0.6,2,1.4,0.4,1.4,1.2,1.2,1,0.8,0.6,2.2,1,buffer,HS_TS,0.186160841,0.369567588,-1.011921991,-0.23426232,-0.17261397 +304,R_7wi7GdqCMrWyYru,53 - 59,American,Male,Male,High School (or equivalent),56,02PsVPf,01PAST,10,02DGEN,0.125,0,1,2,3,3,-1,2,1,0,2,-2,1,3,-1,3,1,3,3,3,3,-1,2,2,-1,3,-2,2,3,-2,3,2,3,2,3,3,-1,2,1,-2,3,-2,1,3,-2,3,1,3,3,3,3,1,2,2,0,3,-2,2,3,-2,3,1,3,3,3,3,1,3,2,0,3,-1,2,3,-1,3,1,3,1,1,1,1,4,1,1,2,2,1,3,3,1,0,0,0,0,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,2,1,0,0,0,1,0,0,0,1,0,0,2,0,1,0,1,0,1,0,1,0,0,0,1,0,0,2,1,1,0,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,buffer,0,0,0,-2,0,0,1,0,0,0,0,0,0,1,0,-1,0,0,-2,-1,-1,2,0,-1,-1,0,1,0,0,0,1,0,0,0,-1,1,1,0,-1,1,0,-1,0,1,0,buffer,0,-1,-1,0,1,-2,buffer,-0.4,0.2,0.2,-0.8,-0.2,0.2,0,0.4,0,buffer,-0.666666667,-0.333333333,0,-0.266666667,0.133333333,buffer,0,3,0,0,1,1,0.2,0.8,0.4,0,0.6,0.2,0.6,0.6,0.2,0.8,0.8,0,0.2,0.6,0.2,0.2,0.2,0.2,buffer,HS_TS,-0.500014922,-0.334988165,-0.1461411,-0.741982096,-0.43078157 +305,R_5VJE2Al6ZZjj9rs,46 - 52,American,Female,Female,University - Undergraduate,51,03VPfPs,02FUT,5,01ITEM,0.25,0,1,3,3,2,0,2,1,-1,1,-1,1,0,1,3,0,2,3,3,3,3,3,2,0,-2,0,3,0,2,2,0,2,3,3,3,3,3,2,2,-2,2,2,2,2,2,2,0,3,3,3,3,3,2,-2,2,-2,2,0,2,2,-2,2,3,3,3,3,3,3,-2,3,-2,3,0,3,3,0,3,0,4,0,0,7,6,0,3,1,0,2,6,0,0,1,3,1,1,1,3,1,2,0,1,1,0,0,0,0,1,3,1,1,3,3,3,1,2,1,1,2,2,0,0,1,3,1,1,1,1,1,1,0,1,1,2,0,0,0,1,3,1,2,1,2,1,2,0,2,0,0,1,0,0,0,0,0,0,2,0,2,1,2,0,0,2,2,0,0,0,0,0,1,0,1,0,1,0,1,1,2,1,buffer,0,0,0,0,0,0,0,2,0,1,0,0,0,-2,0,0,0,0,0,0,-1,2,1,2,-1,2,-1,1,2,1,0,0,0,0,0,-1,2,-1,2,0,2,-1,-1,0,1,buffer,0,1,-1,0,5,0,buffer,0,0.6,-0.4,0,0.6,1,0,0.4,0.2,buffer,0,1.666666667,0.066666667,0.533333333,0.2,buffer,0,3,6,0,1,5,1,1.6,0.4,1,2.2,1.6,1,1,0.8,1,1.6,0.6,0,1,1.2,0,0.6,1,buffer,C_Ug,-0.042564413,0.721845465,-0.001844284,0.78117723,0.3646535 +306,R_7OHu5BnNsLKHuNj,46 - 52,American,Male,Male,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,1,2,1,0,1,2,0,2,-1,1,2,2,2,1,3,2,3,2,0,2,1,-2,2,-2,1,2,2,1,1,3,2,3,1,0,2,1,-2,2,-2,1,2,2,1,1,3,2,3,2,0,2,2,-2,2,-1,2,2,2,2,0,3,2,3,2,0,2,2,-3,2,-2,2,2,2,2,1,3,3,3,3,2,2,2,2,3,3,2,2,2,1,1,1,0,1,1,2,0,1,0,0,0,1,0,0,1,1,0,0,1,1,2,0,1,0,0,0,1,0,0,1,1,1,0,1,0,2,0,0,1,0,0,0,1,0,1,1,1,0,1,0,3,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,buffer,0,0,0,0,0,1,0,0,1,-1,0,0,1,-1,0,0,0,-1,0,0,1,-1,0,0,-1,0,0,1,0,0,0,0,1,0,0,0,-1,0,-1,0,0,0,0,-1,0,buffer,1,0,0,0,0,0,buffer,0,0.2,0,-0.2,-0.2,0.2,0.2,-0.4,-0.2,buffer,0.333333333,0,0.066666667,-0.066666667,-0.133333333,buffer,1,1,1,0,1,1,0.8,0.8,0.2,0.6,0.8,0.2,0.8,0.6,0.2,0.8,1,0,0.2,0,0,0,0.4,0.2,buffer,C_Ug,0.186160841,-0.158849227,-0.001844284,-0.361192264,-0.083931233 +307,R_5HRX2XpRV0bRhHr,46 - 52,American,Female,Female,University - Graduate (Masters),46,01PfPsV,01PAST,10,01ITEM,0.875,1,0,3,2,3,2,3,1,3,3,2,3,3,3,3,3,3,2,-1,1,2,-2,-1,1,-2,1,3,-2,1,1,-2,-1,2,3,2,2,3,3,-1,2,3,-1,1,2,1,2,-2,2,-3,2,2,2,2,-1,3,2,3,2,-2,1,-2,2,1,2,3,2,-1,2,-2,1,2,-1,2,2,2,-2,-2,5,5,7,5,7,6,6,7,7,6,6,6,1,3,2,0,5,2,2,5,1,0,5,2,2,5,4,1,1,1,0,0,2,4,1,1,4,2,1,2,1,5,1,5,1,0,1,1,4,0,0,0,1,5,2,5,1,2,0,0,0,4,1,5,2,0,4,1,1,1,5,5,0,4,1,0,5,4,2,4,2,4,3,1,0,4,1,1,5,1,0,3,0,1,2,0,4,0,4,1,0,4,buffer,0,-2,1,0,4,1,-2,5,1,0,4,-3,0,0,3,-1,1,1,0,-4,1,-1,-1,1,0,1,0,1,-4,0,-1,-1,0,0,2,4,1,2,2,0,3,-3,-1,4,-3,buffer,-1,-2,0,-1,1,0,buffer,0.6,1,0.8,-0.6,0,-0.4,0,1.8,0,buffer,-1,0,0.8,-0.333333333,0.6,buffer,0,2,1,0,1,1,2.2,2,3.6,0.6,2.4,2.2,1.6,1,2.8,1.2,2.4,2.6,2,3.2,1.8,2,1.4,1.8,buffer,grad_prof,-0.728740176,-0.158849227,1.585420683,-0.868912038,-0.04277019 +308,R_1ZO1xvKwGSBo58Z,53 - 59,American,Male,Male,University - Undergraduate,59,01PfPsV,01PAST,10,01ITEM,0.125,0.666666667,0.333333333,3,2,3,1,0,-3,0,1,1,-1,1,-1,3,-3,3,3,2,2,0,-1,-3,1,2,1,-2,1,-1,2,-3,3,3,2,2,1,-1,-3,1,1,2,-3,2,-1,2,-3,2,3,2,3,3,-3,-3,0,0,0,-2,0,-2,3,-3,3,3,2,3,2,-2,-2,0,0,2,-2,0,-2,2,-3,3,2,2,1,2,2,2,1,1,1,1,2,2,0,0,1,1,1,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,1,2,1,0,1,0,1,0,0,0,2,3,0,0,1,1,1,1,1,0,0,0,0,0,0,1,2,1,0,1,1,1,1,1,1,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,2,0,0,0,1,0,0,buffer,0,0,1,-1,-2,0,1,0,-1,0,-1,-1,1,0,0,0,0,1,-1,-1,-1,1,-1,0,1,0,-1,0,0,1,0,0,0,0,-1,-1,0,1,-1,1,1,0,-1,0,1,buffer,1,1,0,1,0,0,buffer,-0.4,0,-0.2,-0.2,0,0,-0.2,0,0.2,buffer,0.666666667,0.333333333,-0.2,-0.066666667,0,buffer,0,0,1,0,1,1,0.6,0.6,0.2,0.4,0.8,0.6,1,0.6,0.4,0.6,0.8,0.6,0.2,0.6,0.4,0.4,0.6,0.2,buffer,C_Ug,0.414886095,0.017289712,-0.579031545,-0.361192264,-0.127012001 +309,R_5tyB2FOKuWGLorY,46 - 52,American,Male,Male,High School (or equivalent),48,02PsVPf,01PAST,5,01ITEM,0.5,0,1,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +310,R_1EbpiVsMOtHs4Lq,46 - 52,American,Female,Female,High School (or equivalent),52,03VPfPs,02FUT,10,02DGEN,-0.125,0.333333333,0.666666667,3,3,2,1,3,2,-2,1,1,3,0,-1,3,-1,3,2,2,2,1,2,-1,-1,-1,1,1,0,1,3,1,3,2,2,2,-1,2,-1,0,-1,0,2,0,1,3,1,3,2,2,1,2,3,3,-2,3,-1,3,0,-1,3,-1,3,3,2,1,1,3,3,-2,3,-2,3,0,0,3,-2,3,6,6,6,6,6,3,3,3,3,4,3,4,1,1,0,0,1,3,1,2,0,2,0,2,0,2,0,1,1,0,2,1,3,2,2,1,1,0,2,0,2,0,1,1,1,1,0,1,0,2,2,0,0,0,0,0,0,0,1,1,0,0,1,0,2,3,0,0,1,0,1,0,0,0,0,2,0,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,0,buffer,0,0,-1,-1,1,2,1,0,-2,2,0,2,0,2,0,1,0,-1,2,1,2,2,0,-2,1,0,1,0,1,0,-1,0,0,1,0,0,1,0,0,1,0,-1,0,-1,0,buffer,3,3,3,2,3,-1,buffer,-0.2,0.6,0.8,0.6,0.6,0.4,0,0.4,-0.4,buffer,3,1.333333333,0.4,0.533333333,0,buffer,0,0,3,1,0,1,0.6,1.6,0.8,1,1.8,0.8,0.8,1,0,0.4,1.2,0.4,0.4,0.6,0,0.4,0.2,0.4,buffer,HS_TS,2.015962874,0.545706526,0.719639792,0.78117723,1.015621606 +311,R_3kMLtCcYqtnxMs9,25 - 31,American,Female,Female,College Diploma/Certificate,31,01PfPsV,02FUT,5,01ITEM,0.75,0,1,3,3,3,3,2,1,-3,2,-2,2,2,2,2,-2,2,3,3,3,3,2,1,-3,2,-3,1,3,3,3,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,1,-3,1,-3,3,3,3,2,-1,2,3,3,3,1,3,1,-3,-2,-3,1,3,3,3,-2,3,0,0,0,0,1,0,2,3,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,1,2,0,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,2,1,0,0,4,1,1,1,1,1,0,1,0,0,0,0,1,2,0,1,0,2,0,0,0,1,0,0,0,0,2,0,0,0,3,0,2,0,0,1,1,1,buffer,0,0,0,0,-1,0,0,-1,0,0,0,0,1,-1,1,0,0,0,-2,0,2,0,-3,0,0,0,0,0,1,0,0,0,0,-2,1,2,0,-2,0,0,0,0,-1,0,-1,buffer,-2,-3,-1,0,1,0,buffer,-0.2,-0.2,0.2,-0.4,-0.2,0.2,-0.2,0,-0.4,buffer,-2,0.333333333,-0.066666667,-0.133333333,-0.2,buffer,0,1,0,2,3,1,0,0.4,0.8,0.2,1,1,0.2,0.6,0.6,0.6,1.2,0.8,0.2,1,0.2,0.4,1,0.6,buffer,C_Ug,-1.414915939,0.017289712,-0.290437916,-0.488122207,-0.544046587 +312,R_6VXErvAGvyR9YcN,39 - 45,American,Male,Male,High School (or equivalent),45,03VPfPs,01PAST,5,01ITEM,0.25,0,0.666666667,2,3,3,2,3,2,-2,3,0,3,3,3,3,3,3,2,3,3,3,3,2,-3,3,-1,2,3,3,3,3,3,2,1,3,2,2,3,3,3,2,2,3,3,2,2,2,3,2,3,2,3,2,2,3,3,3,3,3,3,2,2,3,2,3,2,2,3,-2,2,-2,3,3,2,3,2,3,4,8,6,5,9,8,8,9,9,9,6,8,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,2,0,0,1,1,5,0,2,1,0,0,1,1,1,1,1,0,0,0,0,4,0,3,0,0,0,0,1,1,1,1,0,0,1,1,0,1,2,0,0,1,0,1,0,0,2,0,1,1,1,6,0,3,0,0,0,1,1,1,0,0,0,0,1,1,4,1,5,0,0,1,0,0,1,buffer,-1,-1,0,1,0,0,-3,0,-2,1,0,0,0,-1,-1,-1,1,0,0,0,0,5,-1,0,1,0,-1,1,0,1,0,2,0,1,0,0,2,-1,-2,0,0,-1,1,1,0,buffer,-4,-1,-3,-4,3,0,buffer,-0.2,-0.8,-0.4,0,1,0.2,0.6,-0.2,0.2,buffer,-2.666666667,-0.333333333,-0.466666667,0.4,0.2,buffer,1,1,2,1,3,1,0.2,0.6,0,0.6,1.8,0.6,0.4,1.4,0.4,0.6,0.8,0.4,0.8,2,0.6,0.2,2.2,0.4,buffer,HS_TS,-1.872366447,-0.334988165,-1.156218807,0.527317343,-0.709064019 +313,R_3clUNkVPjmHaZjz,25 - 31,American,Male,Male,University - Graduate (Masters),30,02PsVPf,02FUT,10,02DGEN,1.75,0,0.666666667,-2,-2,-3,-2,-2,0,-3,-3,-3,-3,-2,-3,-2,-2,-3,3,2,3,2,3,2,2,3,3,3,2,2,2,3,2,2,3,2,3,2,2,2,2,3,2,2,2,3,2,2,2,1,2,2,3,2,2,2,1,1,2,1,2,2,1,1,2,3,2,2,-2,-3,-3,-2,-2,2,2,2,3,2,7,6,9,10,8,9,8,6,9,8,7,2,5,4,6,4,5,2,5,6,6,6,4,5,4,5,5,4,5,5,5,4,2,5,5,6,5,4,5,5,4,5,4,3,5,4,5,2,5,5,4,4,4,4,4,4,4,3,4,6,4,4,2,0,0,1,1,4,5,4,5,5,1,1,1,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,4,5,5,3,3,0,1,0,1,1,buffer,1,1,1,0,0,0,0,1,2,2,0,1,0,1,1,1,1,-1,1,0,0,5,5,5,4,0,0,1,-1,0,0,0,0,1,0,-4,-5,-4,-3,-2,0,-1,1,0,-1,buffer,-1,0,0,2,1,7,buffer,0.6,1,0.6,0.4,3.8,0,0.2,-3.6,-0.2,buffer,-0.333333333,3.333333333,0.733333333,1.4,-1.2,buffer,3,2,0,0,1,7,4.8,5,4.6,4.6,4.6,4.6,4.2,4,4,4.2,0.8,4.6,1,0.4,0.4,0.8,4,0.6,buffer,grad_prof,-0.271289667,1.602540156,1.441123867,2.431266501,1.300910214 +314,R_7j70UobCuokAOxM,39 - 45,American,Male,Male,University - Undergraduate,42,01PfPsV,02FUT,5,01ITEM,-0.25,0,1,2,2,1,2,3,3,-3,3,-3,2,2,1,2,2,2,3,3,2,3,3,2,-3,3,-3,3,2,1,3,2,2,2,2,2,2,3,3,-3,2,-3,2,2,2,2,2,2,2,2,2,2,3,3,-3,3,-3,2,2,1,3,2,2,3,3,2,3,3,3,-3,3,-3,3,2,1,2,2,2,1,1,0,0,0,1,1,0,1,1,0,0,1,1,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,0,1,0,0,buffer,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,-1,-1,0,-1,0,0,0,1,0,-1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,buffer,0,1,-1,-1,0,1,buffer,0.6,0.4,0,-0.6,0,0.2,0,0.4,0.2,buffer,0,0,0.333333333,-0.133333333,0.2,buffer,1,1,1,0,0,1,0.8,0.4,0.2,0.2,0.2,0.2,0.2,0,0.2,0.8,0.2,0,0.6,0.6,0.4,0.6,0.2,0.2,buffer,C_Ug,-0.042564413,-0.158849227,0.575342976,-0.488122207,-0.028548218 +315,R_5rJc2mbExmI4CgM,39 - 45,American,Female,Female,University - Graduate (Masters),44,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,3,3,3,0,3,2,2,2,3,3,3,3,3,2,3,1,1,1,0,2,1,1,1,2,0,0,1,1,1,0,1,1,2,2,0,2,2,1,1,2,1,2,0,1,2,1,2,2,1,1,0,1,2,1,1,2,1,1,2,1,1,1,2,0,1,1,1,1,1,2,0,1,1,1,1,5,5,5,5,7,5,8,7,7,5,7,5,2,2,2,0,1,1,1,1,1,3,3,2,2,1,3,2,2,1,2,3,0,0,1,2,1,2,1,3,1,1,2,1,1,1,2,2,1,0,2,2,1,2,2,0,2,2,2,1,0,2,1,1,1,2,1,3,2,2,1,2,0,0,1,2,2,1,1,0,1,2,1,1,1,0,2,0,1,0,1,0,1,0,1,0,1,2,0,0,1,0,buffer,0,1,1,-1,-1,-1,0,1,-1,1,2,0,0,1,1,0,0,0,2,1,-1,-1,0,0,0,-1,-1,1,0,-1,0,-1,1,1,2,0,1,-1,1,1,-1,1,1,-1,2,buffer,-3,-2,-2,0,0,0,buffer,0,0,0.8,0.6,-0.4,-0.4,0.6,0.4,0.4,buffer,-2.333333333,0,0.266666667,-0.066666667,0.466666667,buffer,0,2,0,3,0,2,1.4,1.4,2.2,2,0.8,1.6,1.4,1.4,1.4,1.4,1.2,2,1,1,1,0.4,0.6,0.6,buffer,grad_prof,-1.643641192,-0.158849227,0.431046162,-0.361192264,-0.43315913 +316,R_3FEXLdp8m64IynT,18 - 24,American,Female,Female,University - Undergraduate,20,01PfPsV,01PAST,5,02DGEN,-0.75,1,0,1,3,3,2,3,3,1,2,-2,1,2,2,2,0,3,1,2,3,2,2,2,-1,1,1,2,3,2,2,1,1,1,2,1,3,3,2,0,2,1,3,1,3,1,3,2,2,1,1,3,2,3,2,1,1,2,2,1,2,2,0,3,2,1,1,2,2,1,3,0,1,1,3,0,1,2,3,3,4,4,4,5,4,5,3,5,4,5,0,1,0,0,1,1,2,1,3,1,1,0,0,1,2,0,1,2,1,0,1,1,0,3,2,1,1,1,3,1,1,2,2,1,1,0,1,1,3,1,0,1,0,2,3,2,1,2,1,1,1,0,1,2,0,1,1,2,1,1,0,0,2,1,1,0,1,1,0,1,2,1,1,2,1,1,1,0,2,0,1,1,2,1,1,1,2,2,1,2,buffer,-1,-1,-2,-1,0,1,1,0,0,0,1,-1,0,-1,-1,-2,0,0,0,-1,0,1,-1,1,2,0,0,-1,2,0,-1,-1,2,-1,1,-1,0,-1,-1,0,1,-1,-1,1,-1,buffer,-1,-2,1,-1,0,0,buffer,-1,0.4,-0.4,-0.6,0.6,0.2,0,-0.6,-0.2,buffer,-0.666666667,-0.333333333,-0.333333333,0.066666667,-0.266666667,buffer,1,1,1,1,1,2,0.4,1.6,0.8,0.8,1.4,1.4,1.4,1.2,1.2,1.4,0.8,1.2,0.8,0.6,1.4,0.8,1.2,1.6,buffer,C_Ug,-0.500014922,-0.334988165,-0.867625175,-0.107332375,-0.452490159 +317,R_5qw4FyRzRbtgw9U,46 - 52,American,Female,Female,College Diploma/Certificate,48,01PfPsV,01PAST,5,01ITEM,0.5,0.333333333,0.333333333,3,3,3,2,3,3,-3,3,-3,3,3,-2,3,0,3,3,3,3,1,3,2,-1,3,-1,1,3,-1,2,1,3,3,3,3,-1,3,2,1,3,-1,3,3,1,3,1,3,3,3,3,3,3,3,-3,3,-3,3,3,-2,3,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,-3,3,-3,3,5,3,3,3,6,6,6,3,7,6,2,7,0,0,0,1,0,1,2,0,2,2,0,1,1,1,0,0,0,0,3,0,1,4,0,2,0,0,3,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,1,0,3,0,0,0,0,2,0,0,2,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,buffer,0,0,0,0,0,1,2,0,2,2,0,1,1,-1,0,0,0,0,2,0,1,4,0,2,0,0,2,0,-2,0,0,0,0,2,0,0,2,0,0,2,0,1,1,-1,0,buffer,-1,0,-4,-3,4,-1,buffer,0,1.4,0.2,0.4,1.4,0,0.4,0.8,0.2,buffer,-1.666666667,0,0.533333333,0.6,0.466666667,buffer,2,3,3,0,1,0,0.2,1.4,0.6,0.6,1.4,0.8,0.2,0,0.4,0.2,0,0.8,0.4,0.8,0.6,0,0,0.4,buffer,C_Ug,-1.186190685,-0.158849227,1.008233421,0.908107175,0.142825171 +318,R_5nO7JKL3G0dS2bn,39 - 45,American,Male,Male,High School (or equivalent),44,02PsVPf,02FUT,10,02DGEN,0.25,0.333333333,0.666666667,2,2,1,1,3,2,-2,3,-2,2,3,2,2,2,1,2,2,2,2,3,2,0,2,1,2,2,3,2,2,2,-1,0,-1,2,2,2,2,1,1,1,1,2,2,2,-1,2,2,2,2,3,3,-1,3,0,2,3,2,2,1,1,2,2,1,1,3,2,-3,3,-3,2,3,2,2,1,2,1,1,1,4,3,4,1,2,1,1,1,1,0,0,1,1,0,0,2,1,3,0,1,1,0,0,1,3,2,2,1,1,0,4,2,3,1,2,0,0,0,2,0,0,1,1,0,1,1,0,2,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,3,2,3,0,1,0,2,1,0,1,1,1,0,0,3,0,0,1,1,0,1,2,0,3,0,0,0,0,0,1,buffer,0,0,0,0,0,-1,1,1,1,0,1,1,0,-1,1,3,2,2,1,1,0,3,2,2,1,2,0,0,-1,1,3,2,2,-1,1,-1,0,1,-3,1,1,1,0,0,2,buffer,0,-1,0,3,2,3,buffer,0,0.4,0.4,1.8,1.6,0.4,1.4,-0.4,0.8,buffer,-0.333333333,2.666666667,0.266666667,1.266666667,0.6,buffer,3,2,3,0,1,0,0.4,1.2,0.6,1.8,2,0.8,0.4,0.8,0.2,0,0.4,0.4,1.8,0.8,1,0.4,1.2,0.2,buffer,HS_TS,-0.271289667,1.25026228,0.431046162,2.177406614,0.896856347 +319,R_1h3K0jsRcJsFD1X,53 - 59,American,Male,Male,Professional Degree (ex. JD/MD),53,02PsVPf,01PAST,5,02DGEN,0.375,1,0,3,3,3,3,3,1,1,1,1,3,-1,-1,1,-1,1,3,3,3,3,3,1,1,1,2,3,-1,-1,3,-1,3,3,3,3,3,3,3,1,1,1,3,-1,-1,3,-1,3,3,3,3,1,3,3,1,1,1,3,-2,-1,3,-1,3,3,3,3,0,3,3,1,1,1,3,-2,-1,3,-1,3,0,2,1,1,1,1,2,2,1,2,2,2,0,0,0,0,0,0,0,0,1,0,0,0,2,0,2,0,0,0,0,0,2,0,0,0,0,0,0,2,0,2,0,0,0,2,0,2,0,0,0,0,1,0,2,0,2,0,0,0,3,0,2,0,0,0,0,1,0,2,0,2,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-2,0,-2,0,0,1,0,-1,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,2,0,0,1,0,0,0,0,0,0,buffer,-2,0,0,-1,-1,-1,buffer,-0.4,-0.2,-0.2,-0.6,0,-0.2,-0.2,0.6,0,buffer,-0.666666667,-1,-0.266666667,-0.266666667,0.133333333,buffer,1,1,0,0,0,1,0,0.2,0.8,0,0.4,0.8,0.4,0.4,1,0.6,0.4,1,0,0.6,0,0.2,0,0,buffer,grad_prof,-0.500014922,-0.687266041,-0.723328361,-0.741982096,-0.663147855 +320,R_6QkSavkG5z1tjC9,46 - 52,American,Female,Female,University - Graduate (Masters),49,01PfPsV,02FUT,5,02DGEN,0.75,0,0.666666667,1,3,3,3,3,3,-3,2,3,-3,3,3,2,-3,3,-1,3,3,3,3,-3,3,2,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,-3,3,3,-3,3,3,1,-3,-3,2,3,3,3,3,1,1,3,3,-3,3,3,3,3,3,6,10,5,7,9,6,1,9,6,6,6,5,2,0,0,0,0,6,6,0,0,0,0,0,1,6,0,2,0,0,0,0,0,6,1,0,6,0,0,1,6,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,6,1,0,0,0,0,2,4,1,0,0,0,0,1,6,0,4,0,0,0,0,6,0,1,0,6,0,0,0,0,0,1,0,0,0,0,2,4,0,0,0,0,0,2,6,6,buffer,2,0,0,0,0,6,6,-1,0,0,0,0,0,6,-6,1,0,0,0,0,-2,2,0,0,6,0,0,0,0,0,3,0,0,0,0,4,-4,1,0,6,0,0,-2,-6,-6,buffer,5,1,-1,1,3,1,buffer,0.4,2.2,0,0.2,1.2,0,0.6,1.4,-2.8,buffer,1.666666667,1.666666667,0.866666667,0.466666667,-0.266666667,buffer,1,1,1,5,3,1,0.4,2.4,1.4,0.4,2.6,1.4,0,0.2,1.4,0.2,1.4,1.4,0.8,2.6,0,0.2,1.2,2.8,buffer,grad_prof,1.101061858,0.721845465,1.729717499,0.654247288,1.051718027 +321,R_53wEiY3XjSxYDNq,39 - 45,American,Male,Male,University - PhD,39,02PsVPf,01PAST,10,01ITEM,0.625,1,0,1,3,3,3,3,3,0,3,3,3,2,2,2,2,2,0,3,3,3,3,3,3,3,-2,2,2,3,2,2,3,3,3,3,3,3,2,0,3,2,3,3,3,3,3,3,0,3,3,3,3,2,3,2,-1,2,2,3,3,3,2,0,3,3,3,3,2,3,2,-1,3,3,3,2,3,2,10,10,10,10,10,10,10,10,10,10,10,10,1,0,0,0,0,0,3,0,5,1,0,1,0,0,1,2,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1,0,0,0,0,1,3,1,4,1,0,1,1,1,0,1,0,0,0,0,1,3,1,4,0,1,1,0,1,0,3,0,0,0,0,1,3,0,4,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,buffer,0,0,0,0,0,-1,0,-1,1,0,0,0,-1,-1,1,1,0,0,0,0,0,-3,-1,-3,0,0,0,1,0,1,3,0,0,0,0,1,3,0,4,0,0,0,0,1,0,buffer,0,0,0,0,0,0,buffer,0,-0.2,-0.2,0.2,-1.4,0.4,0.6,1.6,0.2,buffer,0,0,-0.133333333,-0.266666667,0.8,buffer,0,0,0,0,0,0,0.2,1.8,0.4,0.4,0.4,1,0.2,2,0.6,0.2,1.8,0.6,0.6,1.8,0.6,0,0.2,0.4,buffer,grad_prof,-0.042564413,-0.158849227,-0.434734729,-0.741982096,-0.344532616 +322,R_7OkvKlTNtNPfycF,32 - 38,American,Female,Female,High School (or equivalent),33,03VPfPs,02FUT,5,01ITEM,0.875,0.333333333,0.333333333,3,3,3,3,2,-3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,-3,0,0,2,3,3,3,2,3,3,3,3,3,3,1,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,0,3,3,0,0,0,0,0,0,0,0,3,0,0,0,8,9,8,8,9,9,8,8,8,8,8,8,0,0,0,0,1,0,0,0,2,3,0,0,1,0,0,0,0,0,0,1,5,2,2,2,2,0,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,3,0,0,3,2,3,0,0,0,0,3,0,3,3,3,0,0,0,0,2,5,2,2,0,1,0,0,1,0,0,3,0,0,3,3,0,0,0,0,0,3,0,3,3,3,buffer,0,0,0,0,0,-3,0,0,2,3,0,0,1,0,0,-3,0,0,-3,-1,2,2,2,2,2,-3,0,-3,-3,-3,-3,0,0,-3,-1,5,2,2,0,1,-3,0,-2,-3,-3,buffer,0,1,0,0,1,1,buffer,0,0.4,0.2,-1.4,2,-2.4,-1.4,2,-2.2,buffer,0.333333333,0.666666667,0.2,-0.6,-0.533333333,buffer,0,0,1,0,0,0,0.2,1,0.2,0.2,2.6,0,0.2,0.6,0,1.6,0.6,2.4,0.4,2,0.2,1.8,0,2.4,buffer,HS_TS,0.186160841,0.19342865,0.286749346,-1.376631814,-0.177573244 +323,R_5trOjbJAYu7DiCD,32 - 38,American,Female,Female,University - Undergraduate,35,02PsVPf,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,3,1,1,1,-3,-2,3,1,0,2,2,1,-1,2,2,3,2,2,2,-3,-3,3,1,0,2,2,1,-2,2,2,3,2,0,2,-3,-3,3,-1,-1,3,2,0,-3,3,2,3,1,2,1,-3,-2,3,1,0,2,3,2,-2,3,2,3,1,2,1,-3,-2,3,1,0,2,2,2,-3,3,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,2,1,1,0,1,2,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,2,1,0,0,0,2,0,0,0,0,2,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,buffer,0,0,1,0,1,0,1,0,0,0,0,-1,-1,0,-1,0,0,1,0,1,0,1,0,2,1,1,0,0,0,0,0,0,0,2,0,0,0,0,2,1,1,-1,1,0,1,buffer,0,0,0,0,0,0,buffer,0.4,0.2,-0.6,0.4,0.8,0.2,0.4,0.6,0.4,buffer,0,0,1.85E-17,0.466666667,0.466666667,buffer,0,0,0,0,0,0,0.6,0.2,0.2,0.6,0.8,1,0.2,0,0.8,0.2,0,0.8,0.4,0.6,0.8,0,0,0.4,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,0.654247288,0.076673137 +324,R_6t4FWdg3Pl1nymt,46 - 52,American,Female,Female,Trade School (non-military),47,03VPfPs,01PAST,10,01ITEM,0.75,0,0.666666667,0,2,-1,-1,2,1,-2,2,-2,1,1,2,2,2,2,0,2,-1,0,2,2,-2,2,0,2,2,2,2,1,2,-1,2,2,1,2,1,-2,1,0,1,-1,-1,-1,-1,0,1,3,-1,-1,3,3,-2,3,-2,3,3,3,3,3,3,2,3,1,-1,3,2,-2,2,-2,2,3,3,3,3,3,2,1,1,2,2,7,1,1,1,1,1,1,0,0,0,1,0,1,0,0,2,1,1,0,0,1,0,1,0,3,2,0,0,0,1,2,0,2,3,3,3,2,1,1,0,0,1,2,0,1,0,2,2,1,1,1,1,2,1,2,0,1,1,0,0,0,1,2,1,1,1,1,1,0,3,1,0,1,0,1,0,1,3,3,3,2,2,1,0,2,0,0,1,0,1,0,1,0,0,0,0,0,buffer,-1,-1,0,1,-1,-1,0,-1,2,-1,-1,-1,-1,0,-1,-1,-1,1,2,-1,-1,0,1,2,-1,0,2,2,2,1,0,0,1,1,0,0,0,0,0,0,3,3,3,2,2,buffer,1,0,0,1,1,6,buffer,-0.4,-0.2,-0.8,0,0.2,1.4,0.4,0,2.6,buffer,0.333333333,2.666666667,-0.466666667,0.533333333,1,buffer,0,1,6,0,0,0,0.2,0.8,0.4,1.2,0.6,2.6,0.6,1,1.2,1.2,0.4,1.2,1,0.6,2.6,0.6,0.6,0,buffer,HS_TS,0.186160841,1.25026228,-1.156218807,0.78117723,0.265345386 +325,R_1uqexAcAlWO8ejm,32 - 38,American,Female,Female,Professional Degree (ex. JD/MD),38,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,1,0,1,-2,3,2,0,1,-2,2,0,-1,3,0,3,2,2,2,-2,2,3,1,-1,-1,3,1,-2,3,2,3,1,1,2,-2,2,3,1,-2,-1,2,1,-1,3,2,3,2,1,0,-3,3,0,0,2,-3,1,0,2,3,1,3,2,1,1,-2,3,1,0,3,-3,3,0,1,3,1,3,2,3,0,1,3,1,1,6,5,5,4,1,1,2,1,0,1,1,1,2,1,1,1,1,0,2,0,0,1,1,0,1,1,1,3,1,0,1,0,0,2,0,1,1,1,1,0,2,0,1,1,1,0,3,0,1,0,1,1,0,0,0,1,0,2,1,1,0,2,0,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,0,2,0,1,0,0,0,buffer,0,1,0,-1,1,-1,1,1,0,0,1,-2,0,1,0,-1,0,1,0,1,0,1,1,0,-1,1,-2,0,1,0,1,1,-1,-1,0,-1,0,0,0,-1,0,0,0,0,0,buffer,1,-3,-5,-4,-1,0,buffer,0.2,0.2,0,0.2,0.2,0,0,-0.4,0,buffer,-2.333333333,-1.666666667,0.133333333,0.133333333,-0.133333333,buffer,1,0,1,4,2,4,1,1.2,0.8,0.6,1.2,0.6,0.8,1,0.8,0.4,1,0.6,0.4,0.4,0.2,0.4,0.8,0.2,buffer,grad_prof,-1.643641192,-1.039543918,0.14245253,0.019597567,-0.630283753 +326,R_7Md5bk5uVfi4os9,53 - 59,American,Male,Male,High School (or equivalent),54,02PsVPf,01PAST,5,02DGEN,0,0,1,1,1,3,2,2,-2,0,2,1,1,1,0,3,-2,3,0,0,0,0,0,-2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,1,1,3,2,2,0,1,0,0,0,1,0,3,2,3,1,1,3,2,2,2,0,2,1,1,1,0,3,2,3,1,1,3,2,2,2,0,2,1,1,1,0,3,2,3,1,1,3,2,2,2,0,2,1,1,1,0,3,2,3,0,0,0,0,0,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,-2,1,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,1,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,-1,0,0,0,0,0,1.4,0,buffer,0,0,-0.333333333,0,0.466666667,buffer,0,0,0,0,0,0,1.8,0.2,1.8,1.8,1.2,1.8,1.8,1.2,1.8,1.8,1.2,1.8,0,1.4,0,0,0,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.867625175,-0.23426232,-0.325825284 +327,R_7C7agB9Gdckcphq,25 - 31,Canadian,Female,Female,University - Undergraduate,27,03VPfPs,01PAST,10,02DGEN,0,0.666666667,0.333333333,-1,3,2,3,2,1,2,2,2,2,3,1,2,3,2,2,1,0,0,1,-1,1,1,0,1,1,0,1,1,-2,-3,3,-1,3,2,-1,-1,1,0,2,3,3,2,2,2,-1,0,0,-2,2,-1,-1,1,0,1,2,1,0,1,0,-1,2,-1,1,2,1,-1,3,0,-1,2,2,-1,1,0,7,8,7,10,10,9,9,7,7,9,9,8,3,2,2,3,1,2,1,1,2,1,2,1,1,2,4,2,0,3,0,0,2,3,1,2,0,0,2,0,1,0,0,3,2,5,0,2,3,1,2,1,1,0,2,2,2,0,1,3,2,0,0,3,1,2,3,1,1,3,2,2,5,2,1,3,1,0,2,0,0,1,2,3,1,1,4,0,2,1,3,0,2,0,2,0,2,0,1,1,0,0,buffer,3,-1,0,-2,1,0,-2,0,0,0,1,1,-1,0,2,2,-1,0,-2,0,2,0,0,0,-3,-1,1,-3,-1,-2,5,0,0,0,1,-2,2,-2,0,-1,2,2,0,1,4,buffer,-2,1,0,1,1,1,buffer,0.2,-0.4,0.6,-0.2,-0.2,-1.2,1.2,-0.6,1.8,buffer,-0.333333333,1,0.133333333,-0.533333333,0.8,buffer,3,2,2,0,2,1,2.2,1.4,2,1,1.6,0.6,2,1.8,1.4,1.2,1.8,1.8,2.4,0.6,2.2,1.2,1.2,0.4,buffer,C_Ug,-0.271289667,0.369567588,0.14245253,-1.24970187,-0.252242855 +328,R_6y15Wevd07pMNtn,46 - 52,American,Male,Male,High School (or equivalent),46,01PfPsV,01PAST,5,01ITEM,0,0.666666667,0.333333333,3,3,3,3,2,0,-2,0,-2,2,1,-3,2,-1,3,3,3,3,2,2,0,-2,2,-2,2,2,-3,2,-2,3,3,3,3,3,2,-2,-3,1,-2,2,2,-3,2,-2,3,3,3,3,2,2,-3,-2,1,-2,2,1,-3,2,-2,3,3,3,3,3,2,0,-2,2,-2,2,2,-3,2,-2,3,3,2,1,1,2,1,1,1,2,2,1,2,0,0,0,1,0,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,2,1,1,0,0,1,0,0,1,0,0,0,0,1,0,3,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,0,0,0,0,1,0,2,1,1,0,0,0,0,0,0,0,0,0,0,1,0,3,0,1,0,0,1,0,0,0,0,buffer,0,0,0,0,0,-3,0,1,0,0,1,0,0,0,0,0,0,0,0,0,2,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,0,-1,0,0,0,0,buffer,2,1,-1,-1,1,-1,buffer,0,-0.4,0.2,0,0.4,0,0,0,-0.2,buffer,0.666666667,-0.333333333,-0.066666667,0.133333333,-0.066666667,buffer,2,0,0,1,0,0,0.2,0.4,0.4,0,0.8,0.4,0.2,0.8,0.2,0,0.4,0.4,0.2,0.8,0,0.2,0.8,0.2,buffer,HS_TS,0.414886095,-0.334988165,-0.290437916,0.019597567,-0.047735604 +329,R_5qe2wyBRBnfCjtw,18 - 24,Canadian,Female,Female,High School (or equivalent),18,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,3,3,3,2,1,-1,2,-1,3,1,3,3,-3,2,3,3,3,3,3,1,-1,0,-1,1,1,-1,3,-1,3,3,3,3,3,3,1,0,1,-1,1,0,-1,3,-1,3,3,3,3,3,3,1,-1,0,-1,1,0,-1,3,-3,3,3,3,3,3,3,1,-1,1,-1,1,1,0,3,-1,3,5,5,5,5,6,5,7,5,6,5,5,5,1,0,0,0,1,0,0,2,0,2,0,4,0,2,1,1,0,0,0,1,0,1,1,0,2,1,4,0,2,1,1,0,0,0,1,0,0,2,0,2,1,4,0,0,1,1,0,0,0,1,0,0,1,0,2,0,3,0,2,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,2,0,buffer,0,0,0,0,0,0,0,0,0,0,-1,0,0,2,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,-2,0,buffer,-2,0,-1,0,1,0,buffer,0,0,0.2,0,0.2,0.4,0,0.2,-0.6,buffer,-1,0.333333333,0.066666667,0.2,-0.133333333,buffer,0,1,0,2,0,1,0.4,0.8,1.4,0.4,0.8,1.6,0.4,0.8,1.2,0.4,0.6,1.2,0,0.4,0.2,0,0.2,0.8,buffer,HS_TS,-0.728740176,0.017289712,-0.001844284,0.146527512,-0.141691809 +330,R_51b34xCv0Q4Pu5f,32 - 38,Canadian,Male,Male,High School (or equivalent),35,01PfPsV,01PAST,10,01ITEM,0,0,0.333333333,3,3,2,1,2,-3,3,1,3,3,2,0,3,1,3,-1,3,2,2,3,0,1,0,-1,1,0,0,1,0,0,3,3,3,3,2,3,-3,-3,1,1,-3,-1,3,3,0,0,2,0,1,1,1,0,0,1,1,2,0,1,2,2,0,1,0,2,0,1,1,2,0,1,2,2,2,1,0,7,4,5,9,8,8,9,8,7,8,7,8,4,0,0,1,1,3,2,1,4,2,2,0,2,1,3,0,0,1,2,0,6,6,4,2,2,5,1,0,2,3,3,1,2,0,1,4,3,1,2,2,0,0,2,1,1,3,2,2,1,2,4,2,1,3,2,0,2,1,0,3,4,0,1,1,1,3,4,3,2,0,3,1,2,3,0,0,1,0,1,1,0,1,2,1,0,0,2,1,1,2,buffer,1,-1,-2,1,0,-1,-1,0,2,0,2,0,0,0,2,-3,-2,-1,1,-2,2,4,3,-1,0,5,-1,-1,2,0,4,-1,1,0,0,3,3,1,1,0,3,-1,1,2,-2,buffer,-2,-4,-2,1,1,0,buffer,-0.2,0,0.8,-1.4,1.6,1,0.8,1.6,0.6,buffer,-2.666666667,0.666666667,0.2,0.4,1,buffer,2,4,3,1,1,1,1.2,2.4,1.6,0.6,4,2.2,1.4,2.4,0.8,2,2.4,1.2,1.4,2.4,1.8,0.6,0.8,1.2,buffer,HS_TS,-1.872366447,0.19342865,0.286749346,0.527317343,-0.216217777 +331,R_3dzcAKteTP7nZ5i,18 - 24,Canadian,Female,Female,College Diploma/Certificate,24,02PsVPf,02FUT,5,01ITEM,0.25,0,1,-2,-2,3,0,-2,1,3,0,-2,1,2,-1,2,0,0,-1,-1,-2,1,-2,2,-3,-2,-2,2,2,-1,2,0,1,-2,1,2,2,2,0,1,1,3,2,3,-1,0,2,3,0,-1,-2,2,2,2,-2,3,-1,-1,1,0,-2,0,3,2,-1,-2,2,1,-2,2,0,2,0,-2,1,2,-2,1,6,8,3,5,7,3,3,4,7,9,8,8,1,1,5,1,0,1,6,2,0,1,0,0,0,0,1,0,3,1,2,4,1,2,1,5,1,1,0,2,2,3,2,1,5,2,4,1,5,3,1,2,1,1,4,0,3,4,1,5,2,3,3,1,0,4,1,4,2,0,2,1,1,2,4,1,4,2,4,3,5,0,1,0,2,2,2,2,0,0,0,1,4,4,3,3,1,3,1,4,2,2,buffer,-1,0,0,-1,-4,0,1,-1,-1,-1,-1,-1,-4,0,-2,-4,2,-4,0,1,-2,1,1,1,0,-3,-2,2,0,2,-1,2,4,1,3,-2,0,0,2,-1,-2,-1,-2,0,0,buffer,3,4,-4,-4,-1,-5,buffer,-1.2,-0.4,-1.6,-1,0.2,-0.2,1.8,-0.2,-1,buffer,1,-3.333333333,-1.066666667,-0.333333333,0.2,buffer,1,1,0,6,4,1,1.6,2,0.2,2,2,1.6,2.8,2.4,1.8,3,1.8,1.8,2.4,2.8,1.4,0.6,3,2.4,buffer,C_Ug,0.643611349,-1.920238609,-2.454890143,-0.868912038,-1.15010736 +332,R_5eb8Hg6x43UvJf4,46 - 52,American,Male,Male,College Diploma/Certificate,52,02PsVPf,01PAST,10,02DGEN,0.25,0,1,2,3,3,2,3,1,-1,1,-1,1,-1,-1,2,-3,3,2,3,3,2,3,1,-1,1,-1,1,-1,-1,1,-3,3,1,3,3,2,3,1,-1,1,-1,1,-1,-1,1,-3,3,2,3,3,3,2,1,-1,1,-1,1,1,1,1,-3,3,2,3,3,3,2,1,-1,1,-1,1,1,1,1,-3,3,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,2,2,1,0,0,0,0,0,1,1,0,0,0,0,0,2,2,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,-1,0,0,0,0,0,-2,-2,0,0,0,1,0,0,-1,-1,0,0,0,0,0,-2,-2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.4,0,-0.8,-0.2,0,-0.8,0.2,0,0,buffer,0,0,-0.4,-0.333333333,0.066666667,buffer,0,0,0,0,0,0,0,0,0.2,0.2,0,0.2,0.4,0,1,0.4,0,1,0.2,0,0,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-1.011921991,-0.868912038,-0.520561917 +333,R_1tM7LJvIeqd77A3,39 - 45,American,Female,Female,University - Graduate (Masters),43,02PsVPf,02FUT,10,02DGEN,0.375,0,1,3,2,3,3,1,-1,-2,3,-1,0,2,3,2,1,0,3,3,3,3,2,1,1,3,1,0,2,3,2,2,0,3,2,2,1,2,1,2,3,1,1,2,2,1,3,0,3,3,3,3,2,-1,1,3,0,0,2,3,2,1,0,3,3,3,3,3,0,1,1,0,0,1,2,2,-2,0,3,3,4,3,3,4,1,6,4,6,7,6,0,1,0,0,1,2,3,0,2,0,0,0,0,1,0,0,0,1,2,1,2,4,0,2,1,0,1,1,2,0,0,1,0,0,1,0,3,0,1,0,0,0,0,0,0,0,1,0,0,2,1,3,2,1,0,1,1,0,3,0,0,1,1,2,0,0,1,0,0,1,0,1,1,1,0,0,0,0,0,1,1,0,2,0,0,1,1,0,3,0,buffer,0,0,0,0,0,2,0,0,1,0,0,0,0,1,0,0,-1,1,2,-1,1,1,-2,1,1,-1,0,1,-1,0,0,1,1,2,-1,-1,1,-2,0,1,-1,0,1,-2,0,buffer,2,-3,0,-3,-4,-2,buffer,0,0.6,0.2,0.2,0.4,-0.2,0.6,-0.2,-0.4,buffer,-0.333333333,-3,0.266666667,0.133333333,-1.85E-17,buffer,0,0,0,5,1,2,0.4,1.4,0.2,0.8,1.8,0.8,0.4,0.8,0,0.6,1.4,1,0.8,0.4,0.6,0.2,0.6,1,buffer,grad_prof,-0.271289667,-1.744099671,0.431046162,0.019597567,-0.391186402 +334,R_7q1F7ACDjIgiXCB,32 - 38,American,Female,Female,College Diploma/Certificate,32,01PfPsV,01PAST,5,01ITEM,-0.25,0,1,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,2,3,2,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,2,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,1,2,0,3,0,2,2,0,1,0,0,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,0,0,0,0,1,1,2,1,1,2,0,3,0,2,2,3,2,3,3,0,0,0,0,0,0,0,0,0,0,buffer,-2,0,-1,0,0,-1,-1,-2,-1,-1,-2,0,-3,0,-2,0,-3,-3,-3,-3,0,0,0,0,0,0,0,0,0,0,-2,-3,-2,-3,-3,1,1,2,1,1,2,0,3,0,2,buffer,-2,-5,-5,-5,0,0,buffer,-0.6,-1.2,-1.4,-2.4,0,0,-2.6,1.2,1.4,buffer,-4,-1.666666667,-1.066666667,-0.8,-7.4E-17,buffer,0,5,5,3,0,0,0,0,0,0,1.2,1.4,0.6,1.2,1.4,2.4,1.2,1.4,0,1.2,1.4,2.6,0,0,buffer,C_Ug,-2.787267464,-1.039543918,-2.454890143,-1.757421646,-2.009780793 +335,R_30O6o9S16Gy63p6,53 - 59,American,Male,Male,College Diploma/Certificate,55,03VPfPs,01PAST,10,01ITEM,0.25,0,1,0,1,2,2,1,0,0,1,-1,1,2,1,1,-1,2,1,2,2,2,2,2,-2,2,-1,2,2,2,2,-1,2,1,2,2,2,2,1,-1,2,-1,2,2,2,2,-1,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,-2,2,1,2,2,2,2,2,-2,2,-2,2,2,2,2,-1,2,0,1,1,1,1,1,0,0,0,0,1,0,1,1,0,0,1,2,2,1,0,1,0,1,1,0,0,1,1,0,0,1,1,1,1,0,1,0,1,1,0,0,2,1,0,0,1,2,2,1,1,1,0,1,1,1,0,1,1,0,0,1,2,2,1,1,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,-1,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,0,-1,0,0,0,0,1,1,0,0,0,0,0,0,-1,0,buffer,0,1,1,1,0,1,buffer,-0.2,-0.2,-0.2,0,-0.6,0,-0.2,0.4,-0.2,buffer,0.666666667,0.666666667,-0.2,-0.2,0,buffer,1,0,0,0,1,0,0.6,1.2,0.4,0.6,0.8,0.4,0.8,1.4,0.6,0.6,1.4,0.4,0,0.4,0,0.2,0,0.2,buffer,C_Ug,0.414886095,0.19342865,-0.579031545,-0.615052151,-0.146442238 +336,R_36lEraQCtCDPnjD,46 - 52,American,Female,Female,University - Graduate (Masters),46,03VPfPs,01PAST,10,01ITEM,0,1,0,3,1,2,-3,-1,-2,0,2,1,-1,3,2,2,0,2,3,1,2,-3,0,-2,-1,3,-1,1,3,1,1,0,2,2,2,3,-3,1,-1,-2,2,-1,1,3,1,1,1,2,3,1,1,-2,-1,-1,1,2,1,-1,3,3,0,-1,2,3,0,0,-1,-1,-1,1,1,1,-1,3,3,0,-2,2,3,2,1,4,5,2,4,4,3,4,5,2,0,0,0,0,1,0,1,1,2,2,0,1,1,0,0,1,1,1,0,2,1,2,0,2,2,0,1,1,1,0,0,0,1,1,0,1,1,0,0,0,0,1,2,1,0,0,1,2,2,0,1,1,1,0,0,0,1,2,2,0,1,1,1,0,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,0,0,0,1,0,0,0,0,0,1,0,buffer,0,0,-1,-1,1,-1,0,1,2,2,0,0,-1,-1,0,1,0,-1,-2,2,0,1,-1,2,2,0,0,-1,-1,0,1,0,0,-1,1,1,1,0,0,0,0,0,0,0,0,buffer,-1,-2,-2,0,0,0,buffer,-0.2,0.8,-0.4,0,0.8,-0.4,0.2,0.4,0,buffer,-1.666666667,0,0.066666667,0.133333333,0.2,buffer,1,3,1,0,1,1,0.2,1.2,0.4,1,1.4,0.6,0.4,0.4,0.8,1,0.6,1,0.8,0.6,0.2,0.6,0.2,0.2,buffer,grad_prof,-1.186190685,-0.158849227,-0.001844284,0.019597567,-0.331821657 +337,R_3KqCkLry2isEZY8,53 - 59,American,Male,Male,College Diploma/Certificate,54,03VPfPs,01PAST,10,01ITEM,0.375,0,1,1,3,3,2,3,2,-2,3,-2,-2,1,-1,2,1,1,2,3,3,-1,2,2,-1,2,2,-1,3,3,2,3,3,2,3,3,-1,3,2,1,3,-2,-2,3,1,3,2,2,0,-1,1,1,2,1,1,1,1,-1,1,-1,1,-1,1,-2,-2,-2,-2,-2,-2,-3,-3,-3,-2,-2,-3,-2,-3,-3,3,4,4,8,5,3,7,7,7,10,10,9,1,0,0,3,1,0,1,1,4,1,2,4,0,2,2,1,0,0,3,0,0,3,0,0,0,2,2,1,1,1,1,4,2,1,1,1,3,2,3,1,0,0,1,2,0,3,5,5,4,5,4,1,6,1,0,3,2,4,4,4,0,0,0,0,1,0,2,1,4,1,0,2,1,1,1,2,1,3,3,4,3,4,4,4,1,3,2,3,2,4,buffer,0,-4,-2,2,0,-1,-2,-1,1,0,2,4,-1,0,2,-2,-5,-5,-1,-5,-4,2,-6,-1,0,-1,0,-3,-3,-3,-2,-1,-3,-3,-3,-3,-2,-3,0,0,-3,0,-2,-1,-3,buffer,-4,-3,-3,-2,-5,-6,buffer,-0.8,-0.6,1.4,-3.6,-1.8,-2,-2.4,-1.6,-1.8,buffer,-3.333333333,-4.333333333,-3.7E-17,-2.466666667,-1.933333333,buffer,5,1,1,3,3,2,1,1.4,2,0.8,0.6,1.4,1.8,2,0.6,4.4,2.4,3.4,0.2,1.6,1,2.6,3.2,2.8,buffer,C_Ug,-2.329816955,-2.448655423,-0.1461411,-4.930670242,-2.46382093 +338,R_1p3WhZfj18rGewY,53 - 59,American,Male,Male,High School (or equivalent),58,03VPfPs,01PAST,5,01ITEM,0.75,0,1,1,3,3,3,2,-3,-2,1,3,-2,3,2,2,-1,3,2,2,3,3,2,-2,-2,1,3,-2,3,2,2,-2,3,3,3,3,1,3,-2,-2,2,2,-1,3,2,2,-2,3,1,3,3,3,-1,-2,-2,-2,2,-1,3,3,2,-2,3,1,3,2,2,-1,-3,-2,-2,3,-2,3,2,3,-2,3,2,2,2,6,2,1,1,2,2,4,6,2,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,0,2,1,1,0,1,1,1,0,0,0,1,0,0,0,0,0,3,1,0,3,1,1,0,1,0,1,0,0,0,1,1,3,0,0,3,0,0,0,0,1,1,0,1,1,0,2,1,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,0,1,1,0,0,buffer,1,1,0,0,-3,0,0,-3,-1,-1,0,-1,0,0,0,2,0,-1,1,-2,1,0,-2,1,1,0,0,-1,0,0,1,1,-1,1,1,-1,0,1,0,0,0,-1,-1,0,0,buffer,1,0,0,2,-4,-1,buffer,-0.2,-1,-0.2,0,0.2,-0.2,0.6,0,-0.4,buffer,0.333333333,-1,-0.466666667,0,0.066666667,buffer,4,0,1,3,4,0,0.4,0.2,0.2,1,0.8,0.2,0.6,1.2,0.4,1,0.6,0.4,1,0.6,0,0.4,0.6,0.4,buffer,HS_TS,0.186160841,-0.687266041,-1.156218807,-0.23426232,-0.472896582 +339,R_3S01BRqgYnMsK2i,39 - 45,American,Male,Male,University - Undergraduate,45,02PsVPf,02FUT,10,01ITEM,0.125,0,1,1,2,2,2,1,-1,-1,1,-1,0,1,-1,1,0,1,1,2,2,2,1,-2,-2,1,-2,0,1,-1,1,0,1,1,3,3,3,1,-2,-2,1,-1,0,1,-1,1,-1,1,2,3,3,2,1,-2,-2,1,-2,0,1,-1,1,-1,1,2,3,3,2,1,-1,-2,1,-2,0,1,-1,1,0,1,2,2,2,2,1,2,1,1,2,2,3,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,buffer,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,0,1,0,1,0,0,-1,0,0,0,0,1,0,0,1,1,1,0,-1,0,0,1,0,0,0,0,0,0,buffer,1,1,0,0,-2,1,buffer,-0.6,0,-0.2,0,0,0.2,0.6,0,0,buffer,0.666666667,-0.333333333,-0.266666667,0.066666667,0.2,buffer,0,1,0,1,2,1,0,0.6,0,0.6,0.4,0.2,0.6,0.6,0.2,0.6,0.4,0,0.6,0.2,0.2,0,0.2,0.2,buffer,C_Ug,0.414886095,-0.334988165,-0.723328361,-0.107332375,-0.187690701 +340,R_5ounHrWUFcKb4U1,46 - 52,American,Female,Female,College Diploma/Certificate,52,01PfPsV,02FUT,10,02DGEN,0.25,1,0,3,3,2,2,2,-1,-2,0,-1,1,0,1,2,1,3,3,3,1,1,0,2,-1,1,-1,2,-1,1,2,1,3,3,3,-1,-1,3,1,0,-1,1,1,-1,-1,3,0,3,3,3,1,3,2,1,0,3,0,2,0,1,1,0,3,3,2,-1,3,1,0,-1,2,-1,0,-1,0,0,0,3,4,8,2,6,7,6,3,4,5,2,3,1,0,0,1,1,2,3,1,1,0,1,1,0,0,0,0,0,0,3,3,1,2,2,1,2,0,1,2,1,1,0,0,0,1,1,0,2,2,3,1,1,0,0,1,1,0,0,1,3,1,1,1,1,2,0,1,1,1,2,1,0,0,0,2,2,3,1,1,2,2,1,0,2,1,1,0,0,1,2,0,1,1,1,1,1,2,1,1,1,0,0,buffer,0,0,0,0,2,1,-1,-2,-1,0,1,0,-1,-1,0,0,-1,0,2,0,1,1,-1,2,-1,0,1,-1,0,0,0,-1,0,2,2,0,0,1,1,-1,-1,1,0,1,0,buffer,1,4,-3,4,4,5,buffer,0.4,-0.6,-0.2,0.2,0.4,0,0.6,0.2,0.2,buffer,0.666666667,4.333333333,-0.133333333,0.2,0.333333333,buffer,2,1,4,1,1,4,0.8,1.2,0.2,1.4,1.4,1,0.4,1.8,0.4,1.2,1,1,1.4,1.4,0.8,0.8,1.2,0.6,buffer,C_Ug,0.414886095,2.13095697,-0.434734729,0.146527512,0.564408962 +341,R_5M77VizNdfq6d0d,25 - 31,American,Female,Female,College Diploma/Certificate,30,02PsVPf,01PAST,5,02DGEN,-0.25,0,1,2,2,3,2,0,-2,2,1,3,1,0,-3,2,-1,2,2,2,2,2,1,-2,1,-1,2,1,-2,-2,2,-2,2,3,3,3,3,1,1,2,-1,3,2,-2,-2,2,1,1,3,3,3,3,1,1,-1,2,-1,2,3,-3,3,-1,3,3,3,3,3,1,2,-2,3,-1,2,1,-2,3,-2,3,3,3,2,4,4,4,3,3,6,3,3,3,0,0,1,0,1,0,1,2,1,0,2,1,0,1,0,1,1,0,1,1,3,0,2,0,1,2,1,0,2,1,1,1,0,1,1,3,3,1,4,1,3,0,1,0,1,1,1,0,1,1,4,4,2,4,1,1,1,1,1,1,1,1,1,1,0,3,1,0,1,1,0,0,0,3,1,0,0,0,0,0,1,1,1,0,0,2,1,0,1,0,buffer,-1,-1,1,-1,0,-3,-2,1,-3,-1,-1,1,-1,1,-1,0,0,0,0,0,-1,-4,0,-4,0,1,0,-1,1,0,1,1,1,1,0,2,0,-1,1,1,-2,-1,0,2,1,buffer,0,0,-4,1,1,1,buffer,-0.4,-1.6,-0.2,0,-1.8,0.2,0.8,0.6,0,buffer,-1.333333333,1,-0.733333333,-0.533333333,0.466666667,buffer,1,1,2,0,0,3,0.4,0.8,0.8,0.8,1.2,1.2,0.8,2.4,1,0.8,3,1,0.8,1.2,0.8,0,0.6,0.8,buffer,C_Ug,-0.95746543,0.369567588,-1.733406066,-1.24970187,-0.892751444 +342,R_1dSHCOTVBH5dBTu,53 - 59,American,Male,Male,College Diploma/Certificate,59,03VPfPs,02FUT,10,01ITEM,0.125,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,-0.4,0,buffer,0,0,0,0,-0.133333333,buffer,0,0,0,0,0,0,0.2,0.2,0,0.2,0.2,0,0.2,0.2,0,0.2,0.2,0,0,0,0,0,0.4,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +343,R_30DwsF5EY3f5TvH,25 - 31,Canadian,Female,Female,University - Undergraduate,26,01PfPsV,01PAST,10,02DGEN,0,0,1,3,3,2,1,2,2,-3,3,-3,1,2,-1,3,-1,3,3,3,2,1,2,2,-3,3,-3,3,2,-1,3,-3,3,3,3,2,1,2,1,-3,3,0,2,2,-1,3,-2,3,3,3,2,1,2,2,-3,3,-3,3,2,-2,3,-3,3,3,3,1,1,3,2,-3,3,-3,2,2,-3,3,-2,3,5,5,5,6,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,1,0,0,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,2,0,1,0,2,0,0,0,1,0,1,0,0,0,0,1,0,2,0,1,0,0,0,0,0,0,1,0,0,3,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,buffer,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,-1,0,-1,1,0,0,3,0,0,-2,0,0,0,0,0,-1,0,-1,1,0,0,3,0,0,-1,0,0,0,buffer,0,0,0,1,0,0,buffer,0,0,-0.2,-0.4,0.8,-0.4,-0.4,0.8,-0.2,buffer,0,0.333333333,-0.066666667,0,0.066666667,buffer,1,0,0,0,0,0,0,0.4,0.4,0,1,0.2,0,0.4,0.6,0.4,0.2,0.6,0,1,0.2,0.4,0.2,0.4,buffer,C_Ug,-0.042564413,0.017289712,-0.290437916,-0.23426232,-0.137493734 +344,R_3xXiv34n1qi7xUi,18 - 24,Canadian,Female,Female,University - Graduate (Masters),21,03VPfPs,01PAST,5,01ITEM,0.375,0,1,2,2,2,1,2,-1,1,0,3,0,3,-1,2,0,3,1,3,3,2,-1,-2,2,-2,3,-3,2,0,2,1,3,2,2,2,0,-3,-2,-2,-2,1,-2,-1,1,2,-1,1,2,3,3,2,2,0,1,2,1,0,2,-2,3,1,3,2,3,3,2,0,0,0,2,1,1,3,-2,3,1,3,6,4,6,8,7,8,3,3,2,4,4,4,1,1,1,1,3,1,1,2,0,3,1,1,0,1,0,0,0,0,1,5,1,3,2,2,2,4,2,0,1,2,0,1,1,1,0,1,0,2,2,0,1,1,1,1,0,0,1,1,1,2,1,1,2,2,1,0,1,1,1,0,1,1,1,2,2,0,4,0,2,1,3,1,0,2,2,0,0,0,0,2,0,1,0,0,1,1,0,0,0,0,buffer,1,0,0,0,3,0,1,0,-2,3,0,0,-1,0,0,0,-1,-1,0,3,0,2,0,0,1,4,1,-1,0,2,1,1,1,2,0,0,3,0,2,0,2,1,0,2,2,buffer,3,1,4,4,3,4,buffer,0.8,0.4,-0.2,0.2,0.6,1.2,1,1,1.4,buffer,2.666666667,3.666666667,0.333333333,0.666666667,1.133333333,buffer,2,3,2,1,1,2,1.4,1.4,0.6,1.2,2,1.8,0.6,1,0.8,1,1.4,0.6,1.4,1.4,1.6,0.4,0.4,0.2,buffer,grad_prof,1.78723762,1.778679094,0.575342976,1.035037119,1.294074202 +345,R_7Vguppi4vDWHJQa,32 - 38,Canadian,Male,Male,High School (or equivalent),37,02PsVPf,01PAST,5,01ITEM,0,0,1,-2,2,2,2,1,-3,-2,3,-3,1,2,-3,3,-3,2,-2,3,2,-2,1,-3,0,3,-2,2,2,-3,3,-3,2,-2,3,2,-3,2,-3,1,3,-2,1,2,-3,3,-3,2,-2,3,2,1,2,-3,-3,3,-3,2,2,-3,3,-3,2,-2,3,3,2,1,-3,-2,3,-3,2,2,-3,3,-3,2,3,5,4,5,4,3,2,4,3,2,1,1,0,1,0,4,0,0,2,0,1,1,0,0,0,0,0,0,1,0,5,1,0,3,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,buffer,0,0,0,3,-1,0,1,0,1,0,0,0,0,0,0,0,0,-1,5,1,0,3,0,1,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,0,0,buffer,1,1,1,3,3,2,buffer,0.4,0.4,0,1,0.6,0,-0.2,0.2,0,buffer,1,2.666666667,0.266666667,0.533333333,0,buffer,2,1,1,0,3,2,1,0.8,0,1.4,0.8,0,0.6,0.4,0,0.4,0.2,0,0.4,0.4,0,0.6,0.2,0,buffer,HS_TS,0.643611349,1.25026228,0.431046162,0.78117723,0.776524255 +346,R_5TPr9rXWAlXQRq1,18 - 24,Canadian,Male,Male,High School (or equivalent),23,01PfPsV,01PAST,10,01ITEM,0.375,1,0,3,3,3,2,2,3,3,2,-2,2,-1,0,3,1,2,-2,3,3,3,3,-1,2,-1,1,-1,-2,-1,1,3,1,-3,3,3,3,3,-1,1,-3,-1,-2,1,-2,-1,3,1,3,3,2,-1,2,3,1,3,-3,3,-1,-1,3,2,2,3,2,2,-2,2,3,1,3,-3,3,-1,0,3,2,3,8,7,8,9,7,8,9,9,9,9,9,9,5,0,0,1,1,4,1,3,3,3,1,1,2,2,1,6,0,0,1,1,4,2,5,1,4,2,2,4,2,1,0,0,1,3,0,0,2,1,1,1,0,1,0,1,0,0,1,1,4,0,0,2,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,2,2,1,3,1,2,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,buffer,5,0,-1,-2,1,4,-1,2,2,2,1,0,2,1,1,6,-1,-1,-3,1,4,0,4,0,3,2,2,4,1,0,1,-1,0,-1,0,0,1,2,2,1,3,0,2,0,-1,buffer,-1,-2,-1,0,-2,-1,buffer,0.6,1.8,1,0.4,2.2,1.8,-0.2,1.2,0.8,buffer,-1.333333333,-1,1.133333333,1.466666667,0.6,buffer,1,0,0,0,0,0,1.4,2.8,1.4,1.6,3.2,2.2,0.8,1,0.4,1.2,1,0.4,0.2,1.2,1.2,0.4,0,0.4,buffer,HS_TS,-0.95746543,-0.687266041,2.306904758,2.558196446,0.805092433 +347,R_3370vjQWCja2Mfx,18 - 24,Canadian,Female,Female,High School (or equivalent),24,02PsVPf,01PAST,10,02DGEN,0.125,0,1,0,2,0,-2,-3,3,0,0,3,1,0,0,0,-1,3,-2,2,0,-2,-3,-3,2,-1,3,-3,0,-2,0,-2,3,1,2,0,-2,-3,-3,-2,0,3,-1,0,-2,0,-2,2,0,3,-2,-2,-3,-2,-2,0,1,0,0,-1,0,-1,3,0,3,0,-2,-2,-1,-2,0,-1,0,0,0,2,0,0,6,3,2,3,5,4,2,2,2,2,2,3,2,0,0,0,0,6,2,1,0,4,0,2,0,1,0,1,0,0,0,0,6,2,0,0,2,0,2,0,1,1,0,1,2,0,0,5,2,0,2,1,0,1,0,0,0,0,1,0,0,1,4,2,0,4,1,0,0,2,1,3,3,0,0,0,0,0,4,1,0,2,0,0,0,0,1,0,0,2,0,1,1,0,0,2,0,0,1,2,1,3,buffer,2,-1,-2,0,0,1,0,1,-2,3,0,1,0,1,0,1,-1,0,0,-1,2,0,0,-4,1,0,2,-2,0,-2,3,0,-2,0,-1,-1,4,1,-2,2,0,-1,-2,-1,-2,buffer,4,1,0,1,3,1,buffer,-0.2,0.6,0.4,-0.2,-0.2,-0.4,0,0.8,-1.2,buffer,1.666666667,1.666666667,0.266666667,-0.266666667,-0.133333333,buffer,3,2,2,0,0,1,0.4,2.6,0.6,0.2,2,0.8,0.6,2,0.2,0.4,2.2,1.2,0.6,1.4,0.2,0.6,0.6,1.4,buffer,HS_TS,1.101061858,0.721845465,0.431046162,-0.741982096,0.377992847 +348,R_1uUKWqT3KZOWwma,39 - 45,American,Male,Male,University - Graduate (Masters),42,03VPfPs,02FUT,5,01ITEM,1.75,0.666666667,0.333333333,2,3,2,3,2,2,3,1,2,2,3,2,3,2,2,2,3,2,2,3,1,3,2,3,2,2,3,2,3,2,3,2,2,3,2,2,2,3,2,3,1,2,2,2,3,3,2,2,3,2,2,3,2,2,1,3,2,3,2,2,2,3,3,3,2,2,3,2,3,3,2,2,3,2,3,8,8,8,8,6,7,10,9,9,10,10,10,0,0,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,2,0,1,2,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,2,1,0,0,0,1,buffer,-1,-1,0,1,1,1,0,0,1,-1,1,1,1,1,0,1,1,-1,0,0,0,1,1,-1,0,1,0,1,0,0,0,0,-1,1,1,1,1,1,0,-1,0,1,0,1,0,buffer,-2,-1,-1,-2,-4,-3,buffer,0,0.2,0.8,0.2,0.2,0.4,0.2,0.4,0.4,buffer,-1.333333333,-3,0.333333333,0.266666667,0.333333333,buffer,0,2,1,0,1,1,0.4,0.6,0.8,0.4,0.8,0.8,0.4,0.4,0,0.2,0.6,0.4,0.8,1,0.8,0.6,0.6,0.4,buffer,grad_prof,-0.95746543,-1.744099671,0.575342976,0.273457456,-0.463191167 +349,R_5f181Ig3WCVioBW,25 - 31,Canadian,Female,Female,Professional Degree (ex. JD/MD),29,01PfPsV,01PAST,10,02DGEN,0.375,0,1,2,3,3,0,1,3,0,2,2,2,-1,1,0,1,3,2,1,2,0,3,1,2,0,-1,0,0,2,1,0,1,1,0,2,1,1,0,2,1,0,0,0,1,2,0,1,3,1,3,1,2,0,2,1,2,1,0,1,1,0,2,0,2,3,2,1,0,3,2,1,2,2,3,1,0,2,8,7,8,6,6,7,9,8,7,7,7,8,0,2,1,0,2,2,2,2,3,2,1,1,1,1,2,1,3,1,1,0,3,2,1,2,2,1,0,2,1,2,1,2,0,1,1,3,2,1,0,1,1,0,1,1,1,2,1,0,2,0,3,3,0,1,0,3,2,1,1,1,1,1,0,1,2,1,0,1,1,0,0,1,1,0,0,3,1,0,1,1,0,1,1,1,1,2,2,0,0,0,buffer,-1,0,1,-1,1,-1,0,1,3,1,0,1,0,0,1,-1,2,1,-1,0,0,-1,1,1,2,-2,-2,1,0,1,-2,0,0,0,1,1,-1,0,0,-1,-2,-1,1,0,0,buffer,-1,-1,1,-1,-1,-1,buffer,0,0.8,0.4,0.2,0.6,-0.4,-0.2,-0.2,-0.4,buffer,-0.333333333,-1,0.4,0.133333333,-0.266666667,buffer,2,1,1,2,1,1,1,2.2,1.2,1.2,2,1.2,1,1.4,0.8,1,1.4,1.6,1,0.6,0.4,1.2,0.8,0.8,buffer,grad_prof,-0.271289667,-0.687266041,0.719639792,0.019597567,-0.054829587 +350,R_7PAVqMriqInQfXX,46 - 52,American,Male,Male,College Diploma/Certificate,49,02PsVPf,01PAST,5,01ITEM,-0.125,0,1,2,2,2,2,2,-3,1,2,1,2,-3,-3,2,-3,2,2,2,2,2,1,-3,2,-3,2,-3,-3,-3,2,-3,2,2,2,2,-3,2,-3,2,-3,2,-3,-3,-3,2,-3,2,2,2,2,2,2,-3,-3,2,-3,2,-3,-3,2,-3,2,2,2,2,2,2,-3,-3,2,-3,2,-3,-3,2,-3,2,0,9,10,0,10,0,0,10,0,10,10,7,0,0,0,0,1,0,1,5,1,5,0,0,0,0,0,0,0,0,5,0,0,1,5,1,5,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,0,0,0,0,0,0,0,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,-3,5,-3,5,0,0,0,0,0,0,0,0,5,0,0,-3,5,-3,5,0,0,0,0,0,0,0,0,5,1,0,0,0,0,0,0,0,0,0,0,buffer,0,-1,10,-10,0,-7,buffer,0.2,0.8,0,1,0.8,0,1.2,0,0,buffer,3,-5.666666667,0.333333333,0.6,0.4,buffer,0,1,10,10,0,7,0.2,2.4,0,1,2.4,0,0,1.6,0,0,1.6,0,1.2,0,0,0,0,0,buffer,C_Ug,2.015962874,-3.153211177,0.575342976,0.908107175,0.086550462 +351,R_18lvMg9J79PVPlD,25 - 31,Canadian,Female,Female,College Diploma/Certificate,25,03VPfPs,01PAST,10,01ITEM,0.5,0.333333333,0.666666667,2,2,1,1,0,1,2,1,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0,1,2,1,0,1,1,1,0,1,0,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,6,5,7,6,7,6,7,5,7,6,7,6,0,0,1,1,2,0,1,0,1,1,0,0,0,0,1,2,2,0,1,1,1,1,0,1,2,0,1,0,0,0,0,0,1,1,2,0,1,0,1,1,0,0,0,0,0,0,0,1,1,2,0,1,0,1,1,0,0,0,0,0,2,2,1,0,1,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,-1,0,-1,1,0,0,0,1,0,1,0,0,0,2,2,1,0,1,1,0,0,0,1,0,1,0,0,1,buffer,-1,0,0,0,0,0,buffer,0,0,0.2,0.4,0.4,0.2,1.2,0.4,0.4,buffer,-0.333333333,0,0.066666667,0.333333333,0.666666667,buffer,0,2,1,1,2,1,0.8,0.6,0.2,1.2,1,0.2,0.8,0.6,0,0.8,0.6,0,1.2,0.4,0.4,0,0,0,buffer,C_Ug,-0.271289667,-0.158849227,-0.001844284,0.400387399,-0.007898945 +352,R_3zeAZ5ZzmZJ3eEi,39 - 45,American,Male,Male,College Diploma/Certificate,39,01PfPsV,02FUT,10,02DGEN,-0.125,0,1,2,3,3,2,3,1,-2,2,2,3,2,2,2,0,3,1,3,3,2,3,2,0,1,2,1,2,2,3,1,1,2,3,2,1,2,2,-1,1,-2,2,1,2,1,2,2,3,3,2,2,3,1,-1,3,-3,2,2,2,2,1,3,2,3,2,2,3,0,-2,2,-2,2,2,2,3,2,2,3,2,1,2,0,3,7,0,5,8,4,7,1,0,0,0,0,1,2,1,0,2,0,0,1,1,2,0,0,1,1,1,1,1,1,4,1,1,0,1,2,1,1,0,1,0,0,0,1,1,5,1,0,0,0,1,0,0,0,1,0,0,1,0,0,4,1,0,0,1,2,1,1,0,1,1,1,0,1,0,4,1,1,0,2,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,buffer,0,0,-1,0,0,1,1,0,-5,1,0,0,1,0,2,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,1,1,1,-1,0,-1,3,1,1,0,1,0,0,buffer,-4,2,-4,-6,-4,-4,buffer,-0.2,-0.4,0.6,0.4,0.4,0.2,0.6,0.4,0.4,buffer,-2,-4.666666667,-1.85E-17,0.333333333,0.466666667,buffer,1,2,2,1,4,2,0.2,1.2,0.8,0.6,1.6,1,0.4,1.6,0.2,0.2,1.2,0.8,0.8,1.2,1,0.2,0.8,0.6,buffer,C_Ug,-1.414915939,-2.624794362,-0.1461411,0.400387399,-0.946366 +353,R_55RVqMEaEBxgC1r,32 - 38,Canadian,Male,Male,Trade School (non-military),35,03VPfPs,02FUT,5,02DGEN,-0.125,0,1,-1,3,2,0,2,-2,2,-2,2,2,3,1,2,2,3,-1,3,2,0,2,-2,1,-2,2,1,3,2,0,2,3,-1,3,2,0,2,1,2,2,2,1,3,2,2,2,3,-1,3,2,0,3,-1,2,2,2,2,3,2,2,2,3,1,2,2,0,3,2,2,3,-1,2,3,2,2,2,3,3,2,9,1,1,1,1,1,1,8,9,5,0,0,0,0,0,0,1,0,0,1,0,1,2,0,0,0,0,0,0,0,3,0,4,0,1,0,1,0,0,0,0,0,0,0,1,1,0,4,0,0,0,1,0,0,0,2,1,0,0,1,4,0,5,3,0,0,1,0,0,0,0,0,0,0,0,3,1,4,0,0,0,0,2,0,0,2,1,0,0,0,3,0,1,3,0,0,0,0,0,0,buffer,0,0,0,0,-1,-1,1,-4,0,1,0,0,2,0,0,-2,-1,0,0,-1,-1,0,-1,-3,1,0,0,0,0,0,-2,-1,0,0,0,0,1,3,-3,0,0,0,2,0,0,buffer,2,1,8,-7,-8,-4,buffer,-0.2,-0.6,0.4,-0.8,-0.8,0,-0.6,0.2,0.4,buffer,3.666666667,-6.333333333,-0.133333333,-0.533333333,1.85E-17,buffer,2,1,8,7,8,4,0,0.4,0.6,0,1.6,0.2,0.2,1,0.2,0.8,2.4,0.2,0,1.6,0.4,0.6,1.4,0,buffer,HS_TS,2.473413383,-3.505489053,-0.434734729,-1.24970187,-0.679128067 +354,R_5qWoDGBWCVqZjko,32 - 38,Canadian,Male,Male,University - Undergraduate,35,01PfPsV,01PAST,5,02DGEN,-0.25,0,1,-3,2,3,1,2,-3,-3,3,-3,-3,2,2,1,-1,2,-3,3,3,3,3,2,-3,2,-3,1,3,2,3,-3,3,-3,3,3,3,3,2,-3,3,-3,2,3,2,2,-3,2,-3,3,3,3,3,3,-3,2,-3,2,2,2,2,-3,2,-3,3,3,3,3,2,-3,3,-3,2,3,2,3,-3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,1,5,0,1,0,4,1,0,2,2,1,0,1,0,2,1,5,0,0,0,5,1,0,1,2,0,0,1,0,2,1,6,0,1,0,5,0,0,1,2,0,0,1,0,2,1,5,0,0,0,5,1,0,2,2,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,buffer,0,0,0,0,0,-1,0,0,0,-1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,1,-1,0,0,0,1,buffer,1,0,0,0,0,0,buffer,0,-0.4,0.6,0,0,-0.2,0,0,0,buffer,0.333333333,0,0.066666667,-0.066666667,0,buffer,1,0,0,0,0,0,0.8,2,1.2,0.8,2,0.8,0.8,2.4,0.6,0.8,2,1,0,0.4,0.4,0,0.4,0.4,buffer,C_Ug,0.186160841,-0.158849227,-0.001844284,-0.361192264,-0.083931233 +355,R_7QE4sB8mWwkcHEJ,32 - 38,Canadian,Male,Male,University - Undergraduate,34,01PfPsV,02FUT,5,02DGEN,0.125,1,0,2,2,3,3,3,2,-2,2,-2,2,1,2,3,1,3,3,0,1,-1,1,-1,-1,-2,2,1,1,1,1,3,1,1,2,-1,-2,1,0,0,-2,3,2,2,3,-1,2,1,3,2,2,1,3,3,-3,3,-3,2,3,3,3,2,3,3,3,0,0,3,3,-3,3,-3,0,0,-1,3,3,3,4,6,7,6,6,5,8,7,2,2,1,2,1,2,2,4,2,3,1,4,4,1,0,1,2,2,2,1,0,4,5,2,2,2,4,5,0,1,1,4,1,2,1,0,1,2,0,1,1,1,1,0,2,1,0,1,0,1,1,3,3,0,1,1,1,1,2,1,3,0,2,0,2,2,2,1,0,1,1,0,1,1,1,2,2,1,0,0,1,2,1,0,0,0,0,0,2,3,4,0,1,0,buffer,0,2,1,2,2,2,0,3,3,1,-2,0,2,1,2,0,-1,1,2,2,1,1,3,4,-2,0,-2,4,-1,2,2,1,0,0,0,1,1,0,1,-1,-2,-2,2,0,0,buffer,-4,-1,5,4,5,3,buffer,1.4,1.8,0.6,0.8,1.4,0.6,0.6,0.4,-0.4,buffer,0,4,1.266666667,0.933333333,0.2,buffer,2,0,2,6,6,0,2.2,2.6,1.4,2.4,2.6,1.8,0.8,0.8,0.8,1.6,1.2,1.2,1.4,0.8,1.2,0.8,0.4,1.6,buffer,C_Ug,-0.042564413,1.954818032,2.59549839,1.542756894,1.512627226 +356,R_5EWo48oayclBSk9,39 - 45,American,Male,Male,University - Undergraduate,41,03VPfPs,01PAST,10,01ITEM,0,0.333333333,0.666666667,3,3,1,1,3,1,-3,2,-2,2,1,2,1,2,2,1,2,0,-1,0,1,-3,0,-2,-2,1,1,1,1,1,1,3,3,2,0,2,-3,-1,1,0,2,2,2,2,2,3,1,0,2,3,-3,-3,3,3,1,3,1,2,2,3,3,2,1,2,3,0,-3,2,2,1,1,2,1,1,1,6,6,5,8,6,1,3,2,4,8,1,2,2,1,1,2,3,0,0,2,0,4,0,1,0,1,1,2,0,2,1,3,1,0,3,3,2,1,0,1,0,0,0,2,1,1,0,4,0,1,5,1,2,1,1,0,1,0,1,0,1,0,1,0,0,4,1,0,0,0,1,1,0,1,3,3,0,1,0,1,3,2,1,1,1,1,1,0,1,1,0,0,3,0,1,1,0,2,1,1,1,2,buffer,2,-1,0,1,3,-4,0,1,-5,3,-2,0,-1,1,0,2,-1,2,0,3,0,0,3,-1,1,1,0,1,-1,-1,0,0,2,3,0,-2,0,0,2,2,-1,0,0,0,-1,buffer,3,4,1,0,5,-1,buffer,1,-1,-0.4,1.2,0.6,0,1,0.4,-0.4,buffer,2.666666667,1.333333333,-0.133333333,0.6,0.333333333,buffer,2,0,4,5,1,2,1.8,1.2,0.6,1.6,1.8,0.4,0.8,2.2,1,0.4,1.2,0.4,1.4,1.4,1,0.4,1,1.4,buffer,C_Ug,1.78723762,0.545706526,-0.434734729,0.908107175,0.701579148 +357,R_7GE6LxrC5CIjgh4,32 - 38,American,Female,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,01ITEM,0.5,0,1,-3,1,3,-3,3,-3,0,2,0,2,1,2,3,1,3,-3,3,3,-3,-1,-3,-3,3,-3,3,3,2,3,1,3,0,1,1,-2,0,-2,-1,0,-2,-2,-2,0,0,-1,0,0,3,3,-3,3,0,2,3,2,3,2,0,-1,-2,2,-3,1,2,-3,3,2,2,3,2,3,3,3,-1,0,0,0,0,0,3,4,4,0,5,5,4,7,6,0,2,0,0,4,0,3,1,3,1,2,0,0,0,0,3,0,2,1,3,1,1,2,2,4,3,2,3,2,3,3,2,0,0,0,3,2,1,2,1,1,2,4,3,1,0,0,1,0,0,5,2,1,2,1,2,1,4,1,3,3,2,2,1,1,1,2,3,1,5,5,2,3,2,3,3,2,1,0,0,2,0,0,0,0,1,3,0,2,2,buffer,-3,0,0,0,4,-3,1,0,1,0,1,-2,-4,-3,-1,3,0,1,1,3,-4,-1,1,0,3,1,1,-1,1,0,0,0,1,1,1,-1,2,3,1,5,4,-1,3,0,1,buffer,0,-5,-5,-1,-3,-2,buffer,0.2,-0.2,-1.8,1.6,-0.2,0.4,0.6,2,1.4,buffer,-3.333333333,-2,-0.6,0.6,1.333333333,buffer,3,4,4,4,2,1,1.2,1.6,0.4,1.8,2,2.6,1,1.8,2.2,0.2,2.2,2.2,1.8,2.4,3,1.2,0.4,1.6,buffer,C_Ug,-2.329816955,-1.215682856,-1.444812436,0.908107175,-1.020551268 +358,R_79ywJx01HSExAxb,46 - 52,American,Male,Male,University - Graduate (Masters),48,01PfPsV,01PAST,10,02DGEN,0.5,0,1,2,3,2,0,3,1,2,3,-1,3,1,-2,3,1,1,2,1,1,1,3,3,3,2,2,3,2,-2,3,3,0,0,2,0,-2,3,3,1,1,1,-2,1,0,2,2,0,2,3,2,2,3,0,1,2,0,2,2,3,2,-1,1,3,3,2,2,3,0,-1,1,0,1,2,0,1,-1,1,7,5,7,7,5,6,5,5,6,6,6,5,0,2,1,1,0,2,1,1,3,0,1,0,0,2,1,2,1,2,2,0,2,1,2,2,5,0,2,1,1,1,0,0,0,2,0,1,1,1,1,1,1,5,1,2,0,1,0,0,2,0,1,3,2,1,2,1,2,2,2,0,2,1,1,3,0,0,2,1,1,5,1,2,1,1,0,1,0,0,0,0,0,2,1,0,1,0,3,1,0,0,buffer,0,2,1,-1,0,1,0,0,2,-1,0,-5,-1,0,1,1,1,2,0,0,1,-2,0,1,3,-1,0,-1,-1,1,1,1,1,3,0,0,0,0,1,4,1,-1,0,1,0,buffer,2,0,1,1,-1,1,buffer,0.4,0.4,-1,0.8,0.6,-0.4,1.2,1,0.2,buffer,1,0.333333333,-0.066666667,0.333333333,0.8,buffer,0,0,1,1,1,1,0.8,1.4,0.8,1.4,2.4,1,0.4,1,1.8,0.6,1.8,1.4,1.4,1.8,1,0.2,0.8,0.8,buffer,grad_prof,0.643611349,0.017289712,-0.290437916,0.400387399,0.192712636 +359,R_7LSevVCtjQKhCLx,32 - 38,American,Male,Male,College Diploma/Certificate,35,01PfPsV,02FUT,5,02DGEN,1.375,0,0.333333333,2,0,1,3,2,0,0,0,-2,-2,0,1,1,1,1,-1,2,3,2,1,1,1,0,1,0,0,0,1,1,1,3,2,2,-1,1,1,1,0,1,0,0,1,1,0,1,1,0,1,2,-3,1,1,1,1,0,1,1,1,0,1,3,-3,3,0,-1,1,-1,0,1,1,0,0,1,1,1,5,4,10,6,6,6,8,5,4,8,6,5,3,2,2,1,1,1,1,0,3,2,0,1,0,0,0,1,2,1,4,1,1,1,0,3,2,0,0,0,1,0,1,0,0,1,5,1,1,1,3,2,1,0,0,1,0,1,3,2,3,3,1,1,0,3,3,0,1,0,0,0,4,0,1,3,0,0,0,0,0,0,0,1,0,1,0,2,3,2,2,2,0,2,1,0,1,1,1,0,1,0,buffer,2,2,2,0,-4,0,0,-1,0,0,-1,1,0,-1,0,0,-1,-1,1,-2,0,0,0,0,-1,0,-1,0,1,0,2,-3,-1,1,-2,0,-2,-1,0,-1,-1,0,0,0,0,buffer,-3,-1,6,-2,0,1,buffer,0.4,-0.2,-0.2,-0.6,-0.2,0,-0.6,-0.8,-0.2,buffer,0.666666667,-0.333333333,0,-0.266666667,-0.533333333,buffer,1,2,4,0,1,1,1.8,1.4,0.2,1.8,1.4,0.2,1.4,1.6,0.4,2.4,1.6,0.2,1.6,0,0.4,2.2,0.8,0.6,buffer,C_Ug,0.414886095,-0.334988165,-0.1461411,-0.741982096,-0.202056316 +360,R_7FbNtQGpMeytU77,39 - 45,American,Female,Female,University - Graduate (Masters),42,03VPfPs,02FUT,10,01ITEM,0.75,0,1,2,3,3,3,2,2,3,2,-2,1,2,3,2,3,3,3,3,2,3,2,2,2,3,-3,2,3,1,2,2,2,2,3,3,3,2,3,3,2,2,3,2,2,3,-1,2,3,3,2,2,2,2,2,3,2,1,2,3,2,3,3,2,2,3,3,1,3,2,3,-2,2,3,3,2,2,2,0,0,0,0,0,2,4,3,6,8,5,10,1,0,1,0,0,0,1,1,1,1,1,2,0,1,1,0,0,0,0,0,1,0,0,4,2,0,1,1,4,1,1,0,1,1,0,0,1,1,4,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,0,1,0,0,1,1,1,5,1,1,1,1,3,0,1,1,1,1,1,1,0,0,4,1,1,0,0,1,1,buffer,0,0,0,-1,0,0,0,0,-3,1,1,2,0,1,1,0,-1,0,0,-1,0,-1,-1,4,1,-1,1,1,3,0,0,-1,0,-1,-1,0,1,1,1,0,0,1,1,2,-1,buffer,-4,-3,-6,-8,-5,-8,buffer,-0.2,-0.4,1,-0.4,0.6,0.8,-0.6,0.6,0.6,buffer,-4.333333333,-7,0.133333333,0.333333333,0.2,buffer,0,0,2,4,2,4,0.4,0.8,1,0,1.4,1.4,0.6,1.2,0,0.4,0.8,0.6,0.4,1.8,1.2,1,1.2,0.6,buffer,grad_prof,-3.015992718,-3.857766929,0.14245253,0.400387399,-1.58272993 +361,R_1sR6SkLrTXmFvBZ,46 - 52,American,Female,Female,University - Undergraduate,46,02PsVPf,01PAST,10,01ITEM,0.25,0,1,2,2,1,1,1,-1,1,2,-1,1,1,-1,2,-1,2,2,2,1,1,1,-1,1,1,-1,1,1,1,2,-1,1,2,2,2,2,1,-1,1,2,-1,1,1,1,2,1,1,2,2,1,1,2,-1,-1,1,-1,1,0,1,1,-1,2,2,2,1,1,2,-1,-1,2,-2,1,0,1,2,-1,1,5,6,5,4,6,8,5,5,5,4,4,5,0,0,0,0,0,0,0,1,0,0,0,2,0,0,1,0,0,1,1,0,0,0,0,0,0,0,2,0,2,1,0,0,0,0,1,0,2,1,0,0,1,2,1,0,0,0,0,0,0,1,0,2,0,1,0,1,2,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,buffer,0,0,0,0,-1,0,-2,0,0,0,-1,0,-1,0,1,0,0,1,1,-1,0,-2,0,-1,0,-1,0,0,2,0,0,0,1,1,0,0,0,0,-1,0,0,0,-1,2,-1,buffer,0,1,0,0,2,3,buffer,-0.2,-0.4,-0.2,0.2,-0.6,0.2,0.4,-0.2,0,buffer,0.333333333,1.666666667,-0.266666667,-0.066666667,0.066666667,buffer,1,0,3,1,1,0,0,0.2,0.6,0.4,0,1,0.2,0.6,0.8,0.2,0.6,0.8,0.4,0.2,0.4,0,0.4,0.4,buffer,C_Ug,0.186160841,0.721845465,-0.723328361,-0.361192264,-0.04412858 +362,R_5ZUNfu9DaX8alhH,25 - 31,Canadian,Female,Female,College Diploma/Certificate,29,03VPfPs,01PAST,10,01ITEM,0,0,0.666666667,3,2,2,-1,3,-1,-1,-1,-1,-1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,2,2,1,2,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,5,6,7,6,6,5,7,6,6,6,6,4,2,1,1,2,2,2,2,2,2,2,0,0,0,1,1,3,2,2,1,3,2,2,2,2,2,0,1,0,0,1,1,0,1,3,2,3,3,3,3,3,0,0,0,1,1,3,2,2,1,3,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,2,2,1,2,1,2,2,2,2,2,0,0,0,0,0,buffer,1,1,0,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,-1,0,-1,-1,0,-1,0,-2,-2,-2,-2,-2,0,1,0,1,0,buffer,-2,0,1,0,0,1,buffer,0.2,-1,0,0,1,0,-0.6,-2,0.4,buffer,-0.333333333,0.333333333,-0.266666667,0.333333333,-0.733333333,buffer,1,0,2,1,0,2,1.6,2,0.4,2.2,2,0.4,1.4,3,0.4,2.2,1,0.4,1,0,0.4,1.6,2,0,buffer,C_Ug,-0.271289667,0.017289712,-0.723328361,0.400387399,-0.144235229 +363,R_3WowcOSNUaoH2BH,46 - 52,American,Male,Male,University - Undergraduate,47,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,3,3,3,1,-3,-3,-3,3,3,1,3,-3,3,-3,3,1,3,3,3,-3,-3,-1,3,3,1,3,-3,3,-3,3,3,3,3,3,-3,-1,-3,1,3,1,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,3,1,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,3,1,3,-3,3,-3,3,2,7,2,2,6,2,2,2,2,2,2,2,2,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,2,0,0,0,0,2,2,2,0,0,0,0,0,0,0,buffer,0,5,0,0,4,0,buffer,0.4,0.4,0,0,0.8,0,0.4,1.2,0,buffer,1.666666667,1.333333333,0.266666667,0.266666667,0.533333333,buffer,0,1,0,0,0,0,0.8,0.4,0,0.4,0.8,0,0.4,0,0,0.4,0,0,0.4,1.2,0,0,0,0,buffer,C_Ug,1.101061858,0.545706526,0.431046162,0.273457456,0.587818001 +364,R_3OruJppc3NY5hRr,25 - 31,Canadian,Male,Male,University - PhD,25,02PsVPf,01PAST,10,02DGEN,0.75,1,0,0,-2,-1,-1,0,0,-3,-1,-1,-1,-3,-3,-1,-3,0,1,-2,-3,-1,0,-3,-1,-2,0,0,-2,-2,-1,-3,-1,0,-1,0,-3,0,-1,-2,-3,-2,0,-1,-3,-1,-2,-2,-2,-2,2,2,2,-1,0,0,0,-2,-2,0,1,0,0,1,-1,-1,-3,1,-1,-1,0,1,0,-1,1,1,0,-3,5,7,5,3,5,4,9,6,6,10,9,5,1,0,2,0,0,3,2,1,1,1,1,1,0,0,1,0,1,1,2,0,1,1,2,1,1,2,0,0,1,2,2,0,3,3,2,1,3,1,1,1,1,3,2,3,0,1,1,0,2,1,1,2,1,2,1,2,4,2,3,3,1,1,3,2,0,2,1,1,2,0,1,1,0,1,1,3,1,3,5,1,0,1,0,1,2,1,1,0,0,3,buffer,-1,0,-1,-3,-2,2,-1,0,0,0,0,-2,-2,-3,1,-1,0,1,0,-1,0,-1,1,-1,0,0,-4,-2,-2,-1,-2,0,0,-3,-1,2,0,1,1,-2,0,0,0,1,-2,buffer,-4,1,-1,-7,-4,-1,buffer,-1.4,0.2,-1.2,-0.2,-0.2,-1.8,-1.2,0.4,-0.2,buffer,-1.333333333,-4,-0.8,-0.733333333,-0.333333333,buffer,2,2,1,1,3,1,0.6,1.6,0.6,0.8,1.2,1,2,1.4,1.8,1,1.4,2.8,1.4,1.2,0.8,2.6,0.8,1,buffer,grad_prof,-0.95746543,-2.272516485,-1.877702882,-1.630491701,-1.684544125 +365,R_7pAaC1pJW61RQad,53 - 59,American,Male,Male,University - Graduate (Masters),58,03VPfPs,02FUT,5,01ITEM,-0.375,0,1,2,3,3,3,3,0,1,2,-1,3,1,0,3,2,3,2,3,3,2,3,-2,1,3,1,3,1,3,3,2,3,2,3,3,1,3,-2,2,3,2,3,1,-2,3,2,3,-1,3,3,2,3,-1,-1,3,-1,3,2,-1,3,2,3,-2,3,3,2,3,-2,-2,3,-2,3,2,-1,3,1,3,3,4,4,2,2,2,5,5,2,3,8,4,0,0,0,1,0,2,0,1,2,0,0,3,0,0,0,0,0,0,2,0,2,1,1,3,0,0,2,0,0,0,3,0,0,1,0,1,2,1,0,0,1,1,0,0,0,4,0,0,1,0,2,3,1,1,0,1,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,5,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,0,buffer,-3,0,0,0,0,1,-2,0,2,0,-1,2,0,0,0,-4,0,0,1,0,0,-2,0,2,0,-1,1,0,-1,0,-1,0,0,1,0,-1,0,0,0,0,0,5,0,-1,0,buffer,-2,-1,2,-1,-6,-2,buffer,-0.6,0.2,0.2,-0.6,0,-0.2,0,-0.2,0.8,buffer,-0.333333333,-3,-0.066666667,-0.266666667,0.2,buffer,1,2,2,2,3,2,0.2,1,0.6,0.4,1.4,0.4,0.8,0.8,0.4,1,1.4,0.6,0.2,0.4,1,0.2,0.6,0.2,buffer,grad_prof,-0.271289667,-1.744099671,-0.290437916,-0.741982096,-0.761952337 +366,R_7PMo5HLzFMci0s8,25 - 31,American,Male,Male,High School (or equivalent),25,01PfPsV,02FUT,5,02DGEN,-0.75,0,1,-3,3,3,3,0,0,-3,2,-3,1,3,3,3,2,3,-3,3,3,3,0,0,-3,3,-3,2,3,3,3,3,3,-3,3,3,3,0,0,-3,3,-3,2,3,3,3,2,3,-3,2,3,3,0,0,-3,3,-3,0,3,3,3,2,3,-3,3,3,3,0,0,-3,3,-3,0,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,-1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,-0.2,0,0.2,0,0,-0.2,-0.2,0,0,buffer,0,0,0,-0.066666667,-0.066666667,buffer,0,0,0,0,0,0,0,0.4,0.2,0,0.4,0,0.2,0.4,0,0,0.4,0.2,0,0,0.2,0.2,0,0.2,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,-0.361192264,-0.177186751 +367,R_3HFFvxOBPNYGCrm,46 - 52,American,Male,Male,University - Graduate (Masters),48,02PsVPf,01PAST,10,01ITEM,0.875,0.333333333,0.666666667,1,2,2,3,2,0,2,1,2,2,1,2,1,2,1,2,3,2,2,2,2,1,3,3,2,2,3,3,2,3,2,1,2,2,3,3,2,2,1,2,3,1,2,2,2,2,2,3,2,3,3,2,2,2,2,3,2,1,2,2,2,3,2,2,2,3,2,1,2,2,3,2,3,2,2,9,9,9,9,10,10,9,9,8,9,9,9,1,1,0,1,0,2,1,2,1,0,1,1,2,0,2,1,1,0,1,1,3,0,1,1,0,2,1,1,0,1,1,0,1,1,1,3,0,1,0,0,2,0,0,0,1,1,1,0,1,0,3,0,0,0,0,2,0,2,0,1,0,2,0,0,1,1,1,1,2,0,1,2,1,0,1,0,1,1,0,1,0,0,1,0,0,0,0,2,0,0,buffer,0,1,-1,0,-1,-1,1,1,1,0,-1,1,2,0,1,0,0,0,0,1,0,0,1,1,0,0,1,-1,0,0,0,1,-1,0,0,1,1,0,2,0,1,2,-1,0,1,buffer,0,0,1,0,1,1,buffer,-0.2,0.4,0.6,0.2,0.4,0,0,0.8,0.6,buffer,0.333333333,0.666666667,0.266666667,0.2,0.466666667,buffer,0,1,1,0,0,1,0.6,1.2,1.2,0.8,1,1,0.8,0.8,0.6,0.6,0.6,1,0.6,1,1,0.6,0.2,0.4,buffer,grad_prof,0.186160841,0.19342865,0.431046162,0.146527512,0.239290791 +368,R_594ZBusw8KrQgVf,39 - 45,American,Female,Female,College Diploma/Certificate,42,03VPfPs,02FUT,5,01ITEM,-0.25,0,1,3,3,2,1,0,1,-1,3,1,1,2,-2,3,0,3,3,3,3,1,1,3,-1,3,1,3,1,-3,3,0,3,3,3,3,1,1,3,-2,3,1,3,1,-3,3,1,3,3,3,2,1,1,3,-1,3,1,3,1,-3,3,1,3,3,3,2,1,1,3,-2,3,2,3,1,-3,3,1,3,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,1,2,0,0,0,2,1,1,0,0,0,0,0,1,0,1,2,1,0,0,2,1,1,0,1,0,0,0,0,0,1,2,0,0,0,2,1,1,0,1,0,0,0,0,0,1,2,1,0,1,2,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,buffer,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,1,0,buffer,-1,-1,0,0,0,0,buffer,0.2,0,-0.2,0.2,-0.2,0,0,-0.2,0.2,buffer,-0.666666667,0,0,0,0,buffer,0,0,0,1,1,0,0.4,0.8,0.4,0.4,1,0.6,0.2,0.8,0.6,0.2,1.2,0.6,0,0.2,0.2,0,0.4,0,buffer,C_Ug,-0.500014922,-0.158849227,-0.1461411,-0.23426232,-0.259816892 +369,R_1Vw2t2h7mFWUm6a,46 - 52,American,Male,Male,University - Graduate (Masters),50,03VPfPs,01PAST,5,01ITEM,1.375,1,0,3,3,3,1,3,3,3,2,3,2,3,3,3,3,2,2,3,1,2,3,2,1,3,2,1,2,3,3,3,3,1,2,2,3,3,3,2,2,3,2,3,1,3,2,3,2,2,1,3,2,3,2,2,2,3,2,2,2,3,1,3,3,3,2,2,2,3,3,2,2,2,2,3,2,3,8,6,10,4,5,5,6,6,4,3,1,5,1,0,2,1,0,1,2,1,1,1,1,0,0,0,1,2,1,1,2,0,0,1,0,0,0,0,2,0,1,1,1,1,2,2,1,0,1,0,1,1,1,1,1,0,1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,2,0,1,0,1,1,2,1,0,1,1,1,0,1,0,0,1,1,2,buffer,0,-1,0,-1,-1,1,1,1,0,0,0,-1,-1,0,0,2,1,1,1,-1,-1,1,-1,-1,0,-1,1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,2,-1,0,-2,buffer,2,0,6,1,4,0,buffer,-0.6,0.6,-0.4,0.8,-0.4,0,-0.2,0.2,0,buffer,2.666666667,1.666666667,-0.133333333,0.133333333,0,buffer,4,1,5,3,5,1,0.8,1.2,0.4,1.2,0.2,0.8,1.4,0.6,0.8,0.4,0.6,0.8,0.8,1,0.8,1,0.8,0.8,buffer,grad_prof,1.78723762,0.721845465,-0.434734729,0.019597567,0.523486481 +370,R_7KC4faGfHitNseM,25 - 31,American,Male,Male,University - Undergraduate,27,01PfPsV,01PAST,10,01ITEM,1.375,0,1,2,3,3,3,3,3,-1,3,1,3,3,3,3,3,3,2,1,3,3,-1,2,3,3,-1,2,3,3,3,3,-1,3,-2,3,2,1,-1,2,3,-2,2,3,3,2,3,2,1,3,2,3,2,3,-1,3,3,2,3,1,3,1,2,3,-1,3,2,3,2,2,3,3,3,2,2,2,3,3,9,7,10,7,3,9,5,9,10,7,8,8,0,2,0,0,4,1,4,0,2,1,0,0,0,0,4,1,5,0,1,2,4,3,0,3,1,0,0,1,0,1,1,0,1,0,1,0,0,0,2,1,0,2,0,2,1,1,4,0,1,0,1,3,0,2,0,1,1,1,0,0,1,3,0,1,2,3,1,0,1,0,0,0,1,0,3,2,4,1,1,1,1,3,0,0,1,1,1,1,2,1,buffer,-1,2,-1,0,3,1,4,0,0,0,0,-2,0,-2,3,0,1,0,0,2,3,0,0,1,1,-1,-1,0,0,1,-1,-1,-1,0,1,2,-2,0,1,-1,-1,-1,0,-2,2,buffer,4,-2,0,0,-5,1,buffer,0.6,1,-0.2,0.6,1,-0.2,-0.4,0,-0.4,buffer,0.666666667,-1.333333333,0.466666667,0.466666667,-0.266666667,buffer,2,4,1,2,1,2,1.2,1.6,0.8,1.8,2.2,0.4,0.6,0.6,1,1.2,1.2,0.6,1.4,1,0.8,1.8,1,1.2,buffer,C_Ug,0.414886095,-0.863404979,0.863936607,0.654247288,0.267416253 +371,R_1hhgqMOYXxS8hXD,25 - 31,American,Male,Male,University - Graduate (Masters),31,03VPfPs,02FUT,5,02DGEN,-0.25,1,0,0,1,2,-2,2,-2,2,3,-2,3,1,-2,3,-2,2,0,0,0,-2,1,-2,2,2,-2,2,1,-2,2,0,0,0,-1,0,-2,0,-2,2,2,-2,2,2,-2,2,0,0,2,0,2,-2,2,-1,1,2,-2,2,0,-3,3,-2,2,2,1,2,-2,3,-1,2,2,-2,3,0,-3,3,-2,2,2,2,2,2,2,2,2,2,1,2,2,2,0,1,2,0,1,0,0,1,0,1,0,0,1,2,2,0,2,2,0,2,0,0,1,0,1,1,0,1,2,2,2,1,0,0,0,1,1,1,0,1,1,1,0,0,0,2,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,buffer,-2,0,2,0,1,-1,-1,0,0,0,-1,-1,1,2,2,-2,2,2,0,1,-1,0,0,0,1,0,-1,1,2,2,0,0,0,0,0,0,-1,0,0,-1,1,0,0,0,0,buffer,0,0,1,0,0,0,buffer,0.2,-0.4,0.6,0.6,0,0.8,0,-0.4,0.2,buffer,0.333333333,0,0.133333333,0.466666667,-0.066666667,buffer,0,0,0,0,0,1,0.8,0.4,1,1.2,0.4,1.2,0.6,0.8,0.4,0.6,0.4,0.4,0.4,0,0.2,0.4,0.4,0,buffer,grad_prof,0.186160841,-0.158849227,0.14245253,0.654247288,0.206002858 +372,R_3iP3ScRISYbz83v,32 - 38,American,Male,Male,University - Graduate (Masters),35,01PfPsV,02FUT,10,02DGEN,1,0,1,3,3,2,3,3,3,2,3,1,2,2,2,2,3,2,3,3,2,2,2,2,2,3,3,3,2,3,2,3,2,3,2,2,3,2,2,3,3,3,2,2,3,2,3,2,2,3,2,2,3,3,2,2,2,3,2,2,2,3,2,3,3,3,2,2,2,3,2,2,2,2,2,2,3,2,8,9,9,8,9,8,8,8,8,7,10,7,0,0,0,1,1,1,0,0,2,1,0,1,0,0,0,0,1,0,0,1,1,1,0,2,0,0,1,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,buffer,-1,0,0,0,1,1,0,-1,1,0,0,1,0,0,0,0,1,-1,-1,0,0,0,-1,1,0,0,1,0,0,0,-1,1,-1,1,-1,-1,0,0,0,0,0,0,0,0,0,buffer,0,1,1,1,-1,1,buffer,0,0.2,0.2,-0.2,0,0.2,-0.2,-0.2,0,buffer,0.666666667,0.333333333,0.133333333,0,-0.133333333,buffer,0,0,1,1,2,1,0.4,0.8,0.2,0.4,0.8,0.2,0.4,0.6,0,0.6,0.8,0,0.4,0.4,0,0.6,0.6,0,buffer,grad_prof,0.414886095,0.017289712,0.14245253,-0.23426232,0.085091504 +373,R_7GdmjQHboGhWWSY,46 - 52,American,Male,Male,University - Undergraduate,47,03VPfPs,02FUT,10,01ITEM,0.25,0,1,2,3,1,0,-1,0,2,2,2,2,-1,1,2,-2,1,2,3,2,2,-1,0,2,2,2,2,-2,2,2,-2,2,2,3,1,2,-1,0,2,2,2,2,-2,1,2,-3,2,2,2,1,0,0,0,2,2,2,2,-2,2,2,-2,2,2,2,1,0,0,0,1,1,2,1,-2,1,2,-2,2,2,2,2,1,2,2,2,2,2,3,2,3,0,0,1,2,0,0,0,0,0,0,1,1,0,0,1,0,0,0,2,0,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0,buffer,0,-1,1,2,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,2,-1,0,-1,-1,0,-1,0,0,0,1,0,0,0,1,0,0,0,-1,-1,0,-1,0,0,0,1,0,buffer,0,0,0,-2,0,-1,buffer,0.2,0,0,0,-0.6,0.2,0.2,-0.6,0.2,buffer,0,-1,0.066666667,-0.133333333,-0.066666667,buffer,1,0,0,1,0,1,0.6,0,0.6,0.4,0,0.6,0.4,0,0.6,0.4,0.6,0.4,0.2,0,0.4,0,0.6,0.2,buffer,C_Ug,-0.042564413,-0.687266041,-0.001844284,-0.488122207,-0.304949236 +374,R_6yjyJGo63gxtsRm,32 - 38,American,Male,Male,College Diploma/Certificate,35,02PsVPf,02FUT,10,01ITEM,1.75,0.666666667,0.333333333,2,3,3,2,1,-1,-2,3,0,0,1,-1,-1,1,1,1,2,1,3,3,3,2,3,3,3,1,3,2,2,3,2,3,2,1,3,1,3,3,3,3,3,3,3,2,3,3,1,1,3,3,3,3,1,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,1,3,1,3,3,3,10,10,10,10,9,9,8,5,9,10,9,8,1,1,2,1,2,4,4,0,3,3,0,4,3,1,2,0,0,1,1,2,2,5,0,3,3,2,4,4,1,2,1,2,2,1,2,4,5,2,3,3,2,4,4,2,1,1,1,0,1,2,4,5,0,3,1,2,2,4,2,2,1,1,1,2,0,2,1,0,0,0,2,0,1,0,0,0,1,2,0,0,0,0,2,0,2,0,2,0,0,1,buffer,0,-1,0,0,0,0,-1,-2,0,0,-2,0,-1,-1,1,-1,-1,1,0,0,-2,0,0,0,2,0,2,0,-1,0,1,0,-1,2,0,2,1,-2,0,-2,2,-2,1,0,-1,buffer,2,5,1,0,0,1,buffer,-0.2,-0.6,-0.6,-0.2,0,0.2,0.4,-0.2,0,buffer,2.666666667,0.333333333,-0.466666667,0,0.066666667,buffer,0,1,1,2,4,1,1.4,2.8,2,0.8,2.6,2.6,1.6,3.4,2.6,1,2.6,2.4,1,0.6,0.6,0.6,0.8,0.6,buffer,C_Ug,1.78723762,0.017289712,-1.156218807,-0.23426232,0.103511551 +375,R_3FfUCdiMXQdU09F,32 - 38,American,Male,Male,University - Graduate (Masters),38,03VPfPs,01PAST,5,02DGEN,0.5,1,0,2,2,2,2,2,NA,-2,2,-2,2,3,3,3,0,3,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,0,-2,2,-2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,NA,4,0,4,0,1,1,1,0,1,0,0,0,0,0,NA,0,0,0,0,1,1,1,2,1,0,0,0,0,0,NA,0,0,0,0,1,1,1,2,1,0,0,0,0,0,NA,0,0,0,0,1,1,1,2,1,0,0,0,0,0,2,4,0,4,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,NA,4,0,4,0,0,0,0,-2,0,0,0,0,0,0,NA,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,0,4,0,0,0,0,2,0,buffer,0,0,0,0,0,0,buffer,0,2,-0.4,0,0,0,0,2,0.4,buffer,0,0,0.533333333,0,0.8,buffer,0,0,0,0,0,0,0,2,0.8,0,0,1.2,0,0,1.2,0,0,1.2,0,2,0.4,0,0,0,buffer,grad_prof,-0.042564413,-0.158849227,1.008233421,-0.23426232,0.143139365 +376,R_1xTXIFJAYsto83D,25 - 31,Canadian,Male,Male,University - Undergraduate,27,02PsVPf,01PAST,5,02DGEN,0,0.666666667,0.333333333,1,2,2,3,2,2,2,2,2,2,2,2,3,1,2,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,3,3,2,3,3,1,2,3,3,3,3,3,3,2,3,3,2,2,3,3,3,3,1,5,5,2,3,1,7,3,8,8,5,6,1,1,1,0,1,1,1,1,1,1,1,1,0,2,1,0,0,1,1,0,1,1,1,1,1,1,1,0,2,1,2,1,1,1,0,0,1,1,1,1,0,1,0,0,0,2,1,1,0,1,1,0,1,1,0,0,1,0,2,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,2,1,buffer,-1,0,0,-1,1,1,0,0,0,0,1,0,0,2,1,-2,-1,0,1,-1,0,1,0,0,1,1,0,0,0,0,1,1,2,0,0,-1,-1,0,0,-1,0,0,0,-2,-1,buffer,-6,2,-3,-6,-2,-5,buffer,-0.2,0.2,0.8,-0.6,0.4,0.2,0.8,-0.6,-0.6,buffer,-2.333333333,-4.333333333,0.266666667,1.85E-17,-0.133333333,buffer,1,2,4,1,2,2,0.8,1,1,0.4,1,1,1,0.8,0.2,1,0.6,0.8,1.2,0,0,0.4,0.6,0.6,buffer,C_Ug,-1.643641192,-2.448655423,0.431046162,-0.23426232,-0.973878193 +377,R_39rm2f2Kp8eAy8p,25 - 31,Canadian,Male,Male,Professional Degree (ex. JD/MD),25,02PsVPf,01PAST,10,01ITEM,0.25,0.333333333,0.666666667,2,2,2,2,2,2,1,1,-1,2,1,-1,2,1,-1,1,0,1,0,-1,1,-1,1,0,1,1,1,1,0,1,2,1,1,1,2,2,-1,1,0,-1,1,1,1,1,-1,1,1,-1,-1,2,1,0,0,1,1,-1,1,-1,1,0,1,1,-1,-1,1,1,1,0,0,-1,-1,1,1,-1,0,9,8,8,8,7,8,8,6,7,8,8,8,1,2,1,2,3,1,2,0,1,1,0,2,1,1,2,0,1,1,1,0,0,2,0,1,3,0,2,1,0,0,1,1,3,3,0,1,1,1,2,1,2,2,3,0,1,1,1,3,3,1,1,0,1,1,3,2,2,1,2,1,1,1,0,1,3,1,0,0,0,2,0,0,0,1,2,0,0,0,0,1,0,1,0,1,2,0,0,2,2,0,buffer,0,1,-2,-1,3,0,1,-1,-1,0,-2,0,-2,1,1,-1,0,-2,-2,-1,-1,2,-1,0,0,-2,0,0,-2,-1,1,1,0,1,2,1,-1,0,-1,0,0,0,-2,-1,2,buffer,1,2,1,0,-1,0,buffer,0.2,-0.2,-0.4,-1.2,0,-1,1,-0.2,-0.2,buffer,1.333333333,-0.333333333,-0.133333333,-0.733333333,0.2,buffer,1,1,0,0,2,1,1.8,1,1.2,0.6,1.2,0.6,1.6,1.2,1.6,1.8,1.2,1.6,1.2,0.6,0.6,0.2,0.8,0.8,buffer,grad_prof,0.872336603,-0.334988165,-0.434734729,-1.630491701,-0.381969498 +378,R_61hV6iQUShiPsbN,32 - 38,Canadian,Male,Male,College Diploma/Certificate,36,03VPfPs,01PAST,10,02DGEN,0.5,0,1,3,3,3,1,3,1,0,2,1,-1,0,1,3,2,3,2,1,-1,2,3,-1,0,1,2,1,1,0,-2,2,2,0,3,2,-1,1,2,0,1,-2,3,-3,-3,1,-2,-1,3,3,3,0,3,1,1,2,-1,3,2,3,3,3,3,3,3,3,-2,3,1,1,3,-2,3,1,2,3,2,3,5,5,4,7,7,6,2,3,6,6,6,8,1,2,4,1,0,2,0,1,1,2,1,1,5,0,1,3,0,1,2,2,1,0,1,3,4,3,4,2,4,4,0,0,0,1,0,0,1,0,2,4,2,2,0,1,0,0,0,0,3,0,0,1,1,3,4,1,1,0,0,0,2,2,3,3,2,3,0,0,4,2,4,3,3,4,3,0,0,0,2,0,0,0,1,1,0,1,1,0,1,0,buffer,1,2,4,0,0,2,-1,1,-1,-2,-1,-1,5,-1,1,3,0,1,-1,2,1,-1,0,0,0,2,3,2,4,4,2,2,3,1,2,3,0,-1,3,2,3,2,3,3,3,buffer,3,2,-2,1,1,-2,buffer,1.4,-0.2,0.6,1,0,3,2,1.4,2.8,buffer,1,0,0.6,1.333333333,2.066666667,buffer,2,2,2,4,3,2,1.6,1.2,1.6,1.6,1.8,3.4,0.2,1.4,1,0.6,1.8,0.4,2.4,1.8,3.4,0.4,0.4,0.6,buffer,C_Ug,0.643611349,-0.158849227,1.152530237,2.304336557,0.985407229 +379,R_3iIJRF71Jwue5Ql,25 - 31,American,Male,Male,College Diploma/Certificate,31,03VPfPs,02FUT,5,01ITEM,0,0.333333333,0.666666667,2,2,2,-2,2,0,1,-1,1,2,-2,-2,2,1,2,2,2,2,-3,2,-3,0,-1,1,2,-3,2,2,2,2,2,2,2,-3,2,-2,1,-2,1,2,-3,-3,2,2,2,2,2,2,-2,2,-1,1,-1,1,1,-2,-2,2,2,2,2,2,2,-3,2,-2,1,-2,1,2,-3,2,2,2,2,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,3,1,0,0,0,1,4,0,1,0,0,0,0,1,0,2,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,2,0,1,0,0,1,4,0,1,0,0,0,0,0,0,1,1,1,0,0,0,5,0,0,0,0,0,0,1,0,1,0,1,0,1,1,4,0,0,0,buffer,0,0,0,1,0,2,1,0,0,-1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,-1,0,0,1,0,0,-1,-1,1,0,0,0,buffer,0,0,0,0,-1,0,buffer,0.2,0.4,1,0,0,-0.6,-0.2,0,0,buffer,0,-0.333333333,0.533333333,-0.2,-0.066666667,buffer,0,1,0,0,0,0,0.2,0.8,1.2,0.2,0.6,0.6,0,0.4,0.2,0.2,0.6,1.2,0,0.6,1,0.2,0.6,1,buffer,C_Ug,-0.042564413,-0.334988165,1.008233421,-0.615052151,0.003907173 +380,R_3Ke5YBJbB40pFnq,32 - 38,American,Male,Male,University - Graduate (Masters),37,01PfPsV,01PAST,5,01ITEM,0.375,0,1,2,1,1,3,2,0,-1,1,-1,1,1,2,1,1,1,1,1,1,2,2,0,-1,1,-1,1,1,1,1,1,1,2,2,1,2,2,-1,-1,1,-1,1,1,1,1,1,1,2,2,1,3,2,-1,-1,1,-1,0,1,1,1,1,1,1,1,1,2,1,-1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,1,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,buffer,1,-1,0,1,0,-1,0,0,0,-1,0,0,0,0,0,-1,1,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,-1,1,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,-0.4,0,-0.2,-0.2,0,-0.4,0.2,0,buffer,0,0,-0.066666667,-0.133333333,-0.066666667,buffer,0,0,0,0,0,0,0.4,0,0.2,0.4,0.2,0.2,0.2,0.4,0.2,0.6,0.4,0.2,0.4,0.2,0,0.8,0,0,buffer,grad_prof,-0.042564413,-0.158849227,-0.290437916,-0.488122207,-0.244993441 +381,R_1WZphWu16CrMjG1,46 - 52,American,Male,Male,High School (or equivalent),51,02PsVPf,02FUT,5,02DGEN,0.75,0,1,2,2,-1,-1,-2,1,-1,1,-1,-1,1,1,1,1,2,1,-1,-1,-1,-1,1,-1,1,-2,-1,1,1,1,1,1,1,1,-2,2,-2,2,-1,2,-2,-1,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,1,1,1,1,1,2,2,-2,1,-1,2,-2,2,-1,-1,2,2,2,2,2,7,6,6,6,6,6,7,7,5,7,6,6,1,3,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,1,3,0,1,0,1,1,0,1,1,1,1,0,0,0,0,3,1,1,3,1,3,3,0,0,0,0,1,0,0,1,2,1,1,1,1,0,0,1,1,1,1,0,0,2,1,3,1,1,0,1,0,0,1,1,1,1,1,0,0,1,1,0,0,4,0,3,3,1,1,1,1,1,buffer,1,3,0,-3,0,-1,-3,-1,-2,-3,0,0,0,0,0,1,1,0,1,-1,0,-1,0,1,0,0,0,0,0,0,0,2,0,2,1,1,-4,1,-3,-3,0,0,0,0,0,buffer,0,-1,1,-1,0,0,buffer,0.2,-2,0,0.4,0,0,1,-1.6,0,buffer,0,-0.333333333,-0.6,0.133333333,-0.2,buffer,1,0,0,0,1,1,1,0.2,0.2,1.2,0.6,0.8,0.8,2.2,0.2,0.8,0.6,0.8,1.4,0.4,1,0.4,2,1,buffer,HS_TS,-0.042564413,-0.334988165,-1.444812436,0.019597567,-0.450691862 +382,R_1P0pEfyrptM5noE,32 - 38,American,Male,Male,High School (or equivalent),35,03VPfPs,01PAST,5,01ITEM,0.125,0,1,0,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,0,2,2,2,2,-1,-1,-1,1,2,2,1,2,1,2,2,2,2,2,2,0,0,-1,-1,-2,2,1,2,1,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,5,7,5,2,2,6,1,4,6,1,1,1,0,0,0,0,0,3,0,3,2,0,0,1,0,1,0,2,0,0,0,0,2,1,3,0,4,0,1,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,1,0,2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,-2,0,0,0,0,3,0,3,2,0,0,1,0,1,0,0,0,0,0,0,2,1,3,0,4,0,1,0,1,0,2,0,0,0,0,1,1,0,2,4,0,0,0,0,0,buffer,4,3,-1,1,1,5,buffer,-0.4,1.6,0.4,0,2,0.4,0.4,1.6,0,buffer,2,2.333333333,0.533333333,0.8,0.666666667,buffer,3,5,1,0,3,5,0,1.6,0.4,0.4,2,0.4,0.4,0,0,0.4,0,0,0.4,1.6,0,0,0,0,buffer,HS_TS,1.329787112,1.074123341,1.008233421,1.288897006,1.17526022 +383,R_3HbIKvfAM7AQSB0,25 - 31,American,Female,Female,High School (or equivalent),30,02PsVPf,02FUT,10,02DGEN,0.125,0.333333333,0.333333333,2,2,2,0,-3,-2,-1,2,0,1,2,-1,3,1,3,2,2,3,0,-3,0,-1,3,1,-2,2,-1,3,3,3,3,2,3,-1,-3,-3,0,2,3,-1,2,-1,3,3,3,2,2,3,1,-3,0,-1,3,0,1,2,-1,3,3,3,2,2,3,1,-2,0,-2,3,0,3,2,-1,3,3,3,1,3,1,1,4,4,2,1,0,0,3,1,0,0,1,0,0,2,0,1,1,3,0,0,0,2,0,1,0,1,1,0,1,1,0,3,2,0,0,0,2,0,0,0,1,1,0,2,0,1,0,0,0,0,0,2,0,0,0,1,1,1,2,1,1,0,2,0,0,0,2,0,1,0,0,1,0,3,1,1,2,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,2,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,1,3,0,0,0,0,0,1,0,0,0,-1,-1,0,-1,3,0,0,0,0,0,0,1,0,0,1,-1,3,0,1,2,-1,0,0,0,0,0,buffer,-1,2,1,1,1,3,buffer,-0.2,0.8,0,0,0.2,0,0.2,1,0,buffer,0.666666667,1.666666667,0.2,0.066666667,0.4,buffer,0,1,3,2,2,1,0.2,1.4,0.4,0.6,1.4,0.4,0.4,0.6,0.4,0.6,1.2,0.4,0.4,1.6,0,0.2,0.6,0,buffer,HS_TS,0.414886095,0.721845465,0.286749346,-0.107332375,0.329037133 +384,R_3lGLAqcojhv6lne,18 - 24,American,Female,Female,College Diploma/Certificate,24,03VPfPs,02FUT,5,02DGEN,1.5,0.666666667,0,2,2,3,3,3,2,3,3,2,3,3,1,2,2,1,3,2,3,2,3,3,2,2,3,3,3,2,3,2,3,3,3,3,2,3,3,3,3,3,2,3,2,3,2,3,3,3,2,3,2,3,3,2,2,2,3,3,2,3,2,3,3,3,2,1,2,3,2,3,3,3,2,3,3,3,7,7,7,6,7,6,8,8,8,8,5,8,1,0,0,1,0,1,1,1,1,0,0,1,1,0,2,1,1,0,1,0,1,0,0,1,1,0,1,1,0,2,1,1,1,0,1,1,0,1,0,1,0,2,0,1,1,1,1,0,1,2,0,0,1,1,0,0,1,1,1,2,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,0,1,buffer,0,-1,-1,1,-1,0,1,0,1,-1,0,-1,1,-1,1,0,0,0,0,-2,1,0,-1,0,1,0,0,0,-1,0,0,1,-1,-1,-1,-1,1,1,-1,0,0,-1,-1,0,-1,buffer,-1,-1,-1,-2,2,-2,buffer,-0.4,0.2,0,-0.4,0.2,-0.2,-0.4,0,-0.6,buffer,-1,-0.666666667,-0.066666667,-0.133333333,-0.333333333,buffer,1,0,1,0,3,0,0.4,0.8,0.8,0.6,0.6,0.8,0.8,0.6,0.8,1,0.4,1,0.2,0.6,0,0.6,0.6,0.6,buffer,C_Ug,-0.728740176,-0.511127103,-0.290437916,-0.488122207,-0.50460685 +385,R_3sc317tOOXpNf0O,25 - 31,Canadian,Male,Male,High School (or equivalent),25,01PfPsV,01PAST,10,01ITEM,0,1,0,0,3,2,-2,2,2,-2,-2,1,3,1,-1,3,1,3,-1,2,2,-2,2,1,1,-2,1,1,0,-1,2,-1,2,1,-2,2,-2,-2,-2,2,-3,2,-2,-3,-3,2,3,2,2,2,2,-2,2,3,-2,-2,-1,3,0,-1,3,-2,3,2,3,2,1,3,3,-3,1,-3,3,0,-1,3,-2,3,1,1,2,5,7,8,1,2,2,3,4,3,1,1,0,0,0,1,3,0,0,2,1,0,1,2,1,1,5,0,0,4,4,4,1,1,5,4,2,1,2,1,2,1,0,0,0,1,0,0,2,0,1,0,0,3,0,2,0,0,3,1,1,1,3,4,0,1,0,0,3,0,2,4,0,0,4,3,1,1,1,3,3,2,0,4,0,0,1,0,3,1,0,1,3,2,0,0,0,0,0,0,buffer,-1,0,0,0,0,0,3,0,-2,2,0,0,1,-1,1,-1,5,0,-3,3,3,3,-2,-3,5,3,2,1,-1,1,2,3,0,-3,3,3,0,-2,-1,3,3,2,0,4,0,buffer,0,-1,0,2,3,5,buffer,-0.2,0.6,0.2,0.8,1.2,1.2,1,0.6,1.8,buffer,-0.333333333,3.333333333,0.2,1.066666667,1.133333333,buffer,4,6,6,2,2,1,0.4,1.2,1,2,3,2,0.6,0.6,0.8,1.2,1.8,0.8,2,1.8,1.8,1,1.2,0,buffer,HS_TS,-0.271289667,1.602540156,0.286749346,1.796616782,0.853654154 +386,R_3bqx2mr4TMeLfhf,39 - 45,American,Female,Female,High School (or equivalent),41,01PfPsV,01PAST,5,01ITEM,1.375,1,0,2,3,3,3,2,2,0,2,1,2,3,2,2,3,2,3,3,2,3,2,2,2,2,1,2,1,1,3,1,2,3,3,3,3,3,2,2,2,1,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,6,7,8,9,9,9,9,9,9,10,10,10,1,0,1,0,0,0,2,0,0,0,2,1,1,2,0,1,0,0,0,1,0,2,0,0,0,1,0,0,2,0,0,1,1,1,0,0,2,0,1,0,1,0,0,1,0,1,0,0,0,1,1,3,1,2,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,buffer,1,-1,0,-1,0,0,0,0,-1,0,1,1,1,1,0,0,0,0,0,0,-1,-1,-1,-2,-1,0,0,0,1,0,-1,-1,0,-1,0,-1,-1,-1,-1,-1,1,1,1,0,0,buffer,-3,-2,-1,-1,-1,-1,buffer,-0.2,-0.2,0.8,0,-1.2,0.2,-0.6,-1,0.6,buffer,-2,-1,0.133333333,-0.333333333,-0.333333333,buffer,3,2,1,1,1,1,0.4,0.4,1.2,0.4,0.4,0.6,0.6,0.6,0.4,0.4,1.6,0.4,0.4,0,0.6,1,1,0,buffer,HS_TS,-1.414915939,-0.687266041,0.14245253,-0.868912038,-0.707160372 +387,R_6tmcsCbTdClESI6,46 - 52,American,Male,Male,College Diploma/Certificate,47,02PsVPf,01PAST,10,02DGEN,0.25,0,1,2,2,0,3,2,-2,-1,2,-1,-1,2,0,2,1,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,0,2,2,2,0,2,2,-2,-2,2,-1,-1,2,-1,2,0,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,0,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,2,2,1,2,0,3,5,1,2,1,1,1,1,1,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,-2,0,buffer,-1,1,-1,2,4,0,buffer,0,0,0,0,-0.4,0.2,0,0.4,-0.2,buffer,-0.333333333,2,0,-0.066666667,0.066666667,buffer,2,3,1,1,0,0,0.2,0.6,0.2,0.2,0.2,0.4,0.2,0.6,0.2,0.2,0.6,0.2,0,0.4,0.2,0,0,0.4,buffer,C_Ug,-0.271289667,0.897984403,-0.1461411,-0.361192264,0.029840343 +388,R_1YAn8pY9la5023d,25 - 31,Canadian,Male,Male,University - Graduate (Masters),27,03VPfPs,02FUT,5,01ITEM,0.875,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,1,2,2,2,0,1,-1,0,1,0,1,1,0,-1,1,1,-1,0,0,0,1,0,1,1,2,0,1,-1,-1,2,1,1,0,1,-1,0,1,0,0,-1,1,0,1,0,6,6,6,10,6,8,6,7,7,7,5,7,0,0,1,1,0,1,1,0,0,1,1,1,0,1,1,1,1,2,1,1,1,1,2,0,1,0,0,0,0,2,0,1,1,1,1,1,1,1,1,1,2,1,0,1,2,1,1,1,1,0,2,0,0,0,0,1,0,1,1,1,1,1,1,2,1,0,0,2,0,0,1,1,0,1,1,1,0,2,0,1,1,1,1,1,1,3,1,1,2,1,buffer,0,-1,0,0,-1,0,0,-1,-1,0,-1,0,0,0,-1,0,0,1,0,1,-1,1,2,0,1,-1,0,-1,-1,1,0,1,-1,2,0,-1,-1,1,-1,-1,-2,0,-1,-1,0,buffer,0,-1,-1,3,1,1,buffer,-0.4,-0.4,-0.4,0.4,0.6,-0.4,0.4,-0.6,-0.8,buffer,-0.666666667,1.666666667,-0.4,0.2,-0.333333333,buffer,4,0,2,1,2,0,0.4,0.6,0.8,1.2,1,0.4,0.8,1,1.2,0.8,0.4,0.8,1.2,0.4,0.8,0.8,1,1.6,buffer,grad_prof,-0.500014922,0.721845465,-1.011921991,0.146527512,-0.160890984 +389,R_1fcIJv9FZSlIRn7,25 - 31,Canadian,Female,Female,University - Undergraduate,25,02PsVPf,02FUT,5,02DGEN,0.375,1,0,-1,3,3,3,3,-2,1,3,-2,1,3,3,2,3,3,2,2,2,2,2,0,-2,1,1,1,3,3,3,3,3,-2,-2,3,-2,3,-2,-2,-2,2,-2,-2,-2,1,-1,-1,1,1,3,3,3,1,-3,3,-2,1,3,3,3,2,3,3,2,3,1,2,1,-2,2,-2,2,3,2,3,3,2,5,5,5,7,7,9,5,8,4,5,5,5,3,1,1,1,1,2,3,2,3,0,0,0,1,0,0,1,5,0,5,0,0,3,5,4,3,5,5,1,4,4,2,2,0,0,0,3,4,0,0,0,0,0,1,1,0,4,1,0,2,1,3,3,1,0,1,0,1,1,0,1,4,4,1,4,1,2,0,3,1,3,5,5,2,4,4,2,1,0,2,1,0,1,1,0,1,0,1,0,1,1,buffer,1,-1,1,1,1,-1,-1,2,3,0,0,0,0,-1,0,-3,4,0,3,-1,-3,0,4,4,2,5,4,0,4,3,2,3,1,2,0,2,-1,2,1,2,5,4,2,3,3,buffer,0,-3,1,2,2,4,buffer,0.6,0.6,-0.2,0.6,1.4,3.2,1.6,1.2,3.4,buffer,-0.666666667,2.666666667,0.333333333,1.733333333,2.066666667,buffer,2,2,4,0,3,1,1.4,2,0.2,2.2,3,3.8,0.8,1.4,0.4,1.6,1.6,0.6,2.8,1.8,4,1.2,0.6,0.6,buffer,C_Ug,-0.500014922,1.25026228,0.575342976,3.06591622,1.097876638 +390,R_69QwckkLWbec5CF,18 - 24,Canadian,Female,Female,High School (or equivalent),20,02PsVPf,01PAST,5,01ITEM,-0.125,0,0.666666667,-3,1,0,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,6,7,7,7,5,5,6,6,6,6,6,6,4,0,1,2,1,0,1,0,0,0,0,0,0,0,0,3,0,1,2,0,0,1,0,0,1,0,0,0,0,0,5,1,2,1,1,0,0,0,0,0,0,0,0,0,0,5,1,2,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,-1,-1,-1,1,0,0,1,0,0,0,0,0,0,0,0,-2,-1,-1,1,-1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,2,0,0,1,0,0,0,0,0,buffer,0,1,1,1,-1,-1,buffer,-0.4,0.2,0,-0.8,0.4,0,0.4,0.6,0,buffer,0.666666667,-0.333333333,-0.066666667,-0.133333333,0.333333333,buffer,1,2,2,0,0,0,1.6,0.2,0,1.2,0.4,0,2,0,0,2,0,0,0.4,0.6,0,0,0,0,buffer,HS_TS,0.414886095,-0.334988165,-0.290437916,-0.488122207,-0.174665548 +391,R_301bFnnJjUi6pNZ,18 - 24,Canadian,Female,Female,University - Undergraduate,24,01PfPsV,02FUT,10,02DGEN,0,0,1,3,3,2,3,3,3,1,2,2,3,0,-1,3,-1,3,3,3,2,2,3,3,1,-1,2,1,0,0,3,1,3,3,3,3,1,2,3,3,-1,3,-1,1,2,3,2,3,3,3,1,3,3,3,1,1,1,1,-1,-1,3,-1,3,3,3,1,3,3,3,1,2,-1,1,-1,-2,3,-3,3,4,4,4,5,4,3,2,2,2,5,2,2,0,0,0,1,0,0,0,3,0,2,0,1,0,2,0,0,0,1,2,1,0,2,3,1,4,1,3,0,3,0,0,0,1,0,0,0,0,1,1,2,1,0,0,0,0,0,0,1,0,0,0,0,0,3,2,1,1,0,2,0,0,0,1,1,1,0,2,0,1,2,1,2,0,1,0,0,0,0,0,0,0,0,1,2,0,0,1,0,2,0,buffer,0,0,-1,1,0,0,0,2,-1,0,-1,1,0,2,0,0,0,0,2,1,0,2,3,-2,2,0,2,0,1,0,0,0,1,1,1,0,2,-1,-1,2,1,1,0,-1,0,buffer,2,2,2,0,2,1,buffer,0,0.2,0.4,0.6,1,0.6,0.6,0.4,0.2,buffer,2,1,0.2,0.733333333,0.4,buffer,1,0,1,3,0,0,0.2,1,0.6,0.8,2,1.4,0.2,0.8,0.2,0.2,1,0.8,0.6,1,0.8,0,0.6,0.6,buffer,C_Ug,1.329787112,0.369567588,0.286749346,1.161967062,0.787017777 +392,R_7k0tqkdudBxDiaE,25 - 31,American,Female,Female,College Diploma/Certificate,26,01PfPsV,02FUT,5,01ITEM,1.25,0,1,3,1,3,2,2,2,3,1,2,1,3,1,2,2,0,3,1,2,2,3,1,2,0,1,3,2,1,1,2,3,2,3,2,2,3,2,2,3,0,1,1,1,2,2,3,2,3,1,1,2,1,2,2,3,2,2,1,2,1,3,2,3,1,1,2,2,3,3,2,1,2,1,3,2,3,5,8,8,7,7,9,7,7,9,5,6,7,0,0,1,0,1,1,1,1,1,2,1,0,1,0,3,1,2,1,0,1,0,1,2,2,0,2,0,0,0,3,1,2,2,1,0,1,1,1,1,1,1,0,0,1,3,1,2,2,1,0,0,0,2,0,0,1,0,1,0,3,1,2,0,0,0,1,0,3,1,2,1,0,1,0,0,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,buffer,-1,-2,-1,-1,1,0,0,0,0,1,0,0,1,-1,0,0,0,-1,-1,1,0,1,0,2,0,1,0,-1,0,0,1,2,0,0,0,0,-1,2,0,1,1,0,0,-1,0,buffer,-2,1,-1,2,1,2,buffer,-0.8,0.2,0,-0.2,0.6,0,0.6,0.4,0,buffer,-0.666666667,1.666666667,-0.2,0.133333333,0.333333333,buffer,2,1,1,2,1,2,0.4,1.2,1,1,1,1,1.2,1,1,1.2,0.4,1,0.6,1.4,0.4,0,1,0.4,buffer,C_Ug,-0.500014922,0.721845465,-0.579031545,0.019597567,-0.084400859 +393,R_6ABmv1ELPyJI0Wl,18 - 24,American,Female,Female,High School (or equivalent),21,03VPfPs,01PAST,10,02DGEN,0.125,0,1,1,3,-2,1,1,1,1,1,1,1,2,0,3,1,3,1,3,0,-2,1,1,1,1,1,3,2,0,1,1,3,1,2,3,-3,2,-3,2,1,3,1,2,3,0,1,1,1,3,-2,3,2,2,0,3,0,3,3,0,3,1,3,2,3,-2,1,3,1,1,1,1,1,2,0,3,1,3,1,3,8,3,10,10,1,1,2,1,1,2,0,0,2,3,0,0,0,0,0,2,0,0,2,0,0,0,1,5,4,1,4,1,0,2,0,0,3,3,0,2,0,0,0,2,1,1,1,2,1,2,1,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,3,1,1,4,1,0,2,2,0,3,1,0,2,1,0,0,2,1,1,1,2,1,2,1,0,0,0,0,buffer,0,0,2,1,-1,-1,-1,-2,-1,0,-1,0,2,0,0,-1,1,5,4,-1,4,1,0,2,0,0,3,3,0,2,-1,1,3,-1,0,3,0,-2,1,0,-1,3,1,0,2,buffer,0,2,6,2,9,8,buffer,0.4,-1,0.2,1.6,1.4,1.6,0.4,0.4,1,buffer,2.666666667,6.333333333,-0.133333333,1.533333333,0.6,buffer,2,7,2,0,0,0,1,0.4,0.4,2.2,1.4,1.6,0.6,1.4,0.2,0.6,0,0,1.2,1.8,1.2,0.8,1.4,0.2,buffer,HS_TS,1.78723762,3.1877906,-0.434734729,2.685126388,1.80635497 +394,R_3DozEVS0ulEdTYR,18 - 24,Canadian,Female,Female,University - Undergraduate,24,03VPfPs,02FUT,5,02DGEN,0.5,0,1,1,1,0,1,0,1,2,1,-1,0,2,1,-1,1,2,-1,0,1,1,1,1,0,1,-2,2,1,2,0,2,1,1,0,0,2,1,2,1,0,1,0,2,0,-1,1,1,1,3,0,2,-1,-1,1,1,1,0,-1,-1,1,0,0,2,2,0,1,-2,2,0,1,2,1,1,2,1,2,0,4,6,5,6,4,5,5,7,4,4,5,5,2,1,1,0,1,0,2,0,1,2,1,1,1,1,1,0,1,0,1,1,1,1,1,2,0,0,1,0,0,1,0,2,0,1,1,2,1,0,2,0,3,2,2,1,2,1,1,0,0,2,1,2,0,3,1,1,1,2,1,2,2,0,1,1,0,1,1,1,3,2,1,2,1,1,0,1,1,0,1,1,3,1,0,1,1,2,3,0,2,0,buffer,2,-1,1,-1,0,-2,1,0,-1,2,-2,-1,-1,0,-1,-1,0,0,1,-1,0,-1,1,-1,-1,-1,0,-2,-1,-1,1,-1,1,0,-1,-2,0,1,2,1,-1,-1,1,-1,0,buffer,-1,-1,1,2,-1,0,buffer,0.2,0,-1,-0.2,-0.4,-1,0,0.4,-0.4,buffer,-0.333333333,0.333333333,-0.266666667,-0.533333333,0,buffer,2,2,0,1,2,1,1,1,1,0.6,1,0.4,0.8,1,2,0.8,1.4,1.4,0.8,1.6,1,0.8,1.2,1.4,buffer,C_Ug,-0.271289667,0.017289712,-0.723328361,-1.24970187,-0.556757547 +395,R_7ePlnqRDs8i4Ecj,18 - 24,Canadian,Female,Female,University - Undergraduate,22,01PfPsV,01PAST,10,01ITEM,0.125,1,0,3,2,2,1,3,1,1,1,2,3,1,-2,3,2,3,3,1,3,0,3,2,1,1,0,1,0,-1,2,3,3,1,-1,3,3,2,-1,3,1,3,0,2,-1,1,3,3,3,3,2,3,3,1,0,3,1,3,-1,-1,3,1,3,3,3,1,3,3,1,0,3,-2,3,-2,-2,3,0,3,4,6,5,6,7,6,4,5,5,5,7,7,0,1,1,1,0,1,0,0,2,2,1,1,1,1,0,2,3,1,2,1,2,2,0,1,3,1,1,2,1,0,0,1,0,2,0,0,1,2,1,0,2,1,0,1,0,0,1,1,2,0,0,1,2,4,0,3,0,0,2,0,2,2,0,3,1,3,2,0,3,1,2,0,1,0,0,0,0,1,0,0,0,0,0,3,0,1,1,0,1,0,buffer,0,0,1,-1,0,1,-1,-2,1,2,-1,0,1,0,0,2,2,0,0,1,2,1,-2,-3,3,-2,1,2,-1,0,2,2,-1,3,1,3,2,0,0,1,1,-1,1,-1,0,buffer,0,1,0,1,0,-1,buffer,0,0.2,0,1,0.2,0,1.4,1.2,0,buffer,0.333333333,0,0.066666667,0.4,0.866666667,buffer,2,1,1,1,2,2,0.6,1,0.8,1.8,1.6,1,0.6,0.8,0.8,0.8,1.4,1,1.6,1.8,0.6,0.2,0.6,0.6,buffer,C_Ug,0.186160841,-0.158849227,-0.001844284,0.527317343,0.138196168 +396,R_7Dp9alCiXsRbwsD,18 - 24,Canadian,Male,Male,Trade School (non-military),20,02PsVPf,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,1,3,1,1,2,-1,-3,-1,-1,3,-2,-3,3,-1,3,2,3,1,1,2,-2,-2,-2,1,2,-1,-2,1,1,2,1,1,3,2,-1,-2,-2,-3,1,3,2,-2,-1,2,2,2,3,1,2,2,-1,-3,1,-2,3,-1,-3,3,-2,3,2,3,1,3,2,0,-3,2,-2,3,-2,-3,3,-2,3,5,7,6,9,9,9,6,6,4,4,6,4,1,0,0,0,0,1,1,1,2,1,1,1,2,2,1,0,2,2,1,3,1,1,2,2,0,4,1,4,3,1,1,0,0,1,0,0,0,2,1,0,1,0,0,1,0,1,0,0,2,0,1,0,3,1,0,0,0,0,1,0,1,2,2,1,3,0,0,1,0,1,3,0,2,1,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,buffer,0,0,0,-1,0,1,1,-1,1,1,0,1,2,1,1,-1,2,2,-1,3,0,1,-1,1,0,4,1,4,2,1,1,2,2,0,3,-1,0,0,0,1,2,0,2,1,0,buffer,-1,1,2,5,3,5,buffer,-0.2,0.6,1,1,0.2,2.4,1.6,0,1,buffer,0.666666667,4.333333333,0.466666667,1.2,0.866666667,buffer,4,2,3,2,0,0,0.2,1.2,1.4,1.6,1.2,2.6,0.4,0.6,0.4,0.6,1,0.2,1.8,0.4,1.2,0.2,0.4,0.2,buffer,HS_TS,0.414886095,2.13095697,0.863936607,2.05047667,1.365064086 +397,R_1TUekaIMwJVZ7tG,18 - 24,American,Female,Female,High School (or equivalent),19,02PsVPf,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,3,3,-1,0,3,0,0,3,1,3,2,0,3,-1,3,-3,-3,3,-3,0,1,0,-1,1,-1,1,1,-1,2,2,0,0,0,0,0,3,3,-3,3,-3,0,0,0,0,0,3,3,-2,1,3,-1,-2,3,1,3,0,0,0,0,0,3,3,3,3,3,3,-3,3,3,3,3,3,3,3,3,10,3,4,10,9,1,1,6,1,7,4,4,6,6,4,3,3,1,0,4,0,4,1,1,4,3,1,3,3,1,0,3,3,3,6,2,6,2,0,3,1,3,0,0,1,1,0,1,2,0,0,0,2,0,3,1,3,0,0,4,3,0,3,3,0,2,0,1,3,0,4,0,3,3,3,3,0,2,3,2,2,2,1,1,1,2,2,0,0,5,2,0,4,1,0,2,0,3,3,3,3,3,buffer,6,6,3,2,3,0,-2,4,0,4,-1,1,1,2,-2,3,3,-3,-3,3,0,0,6,0,6,1,-3,3,-3,3,3,3,-2,1,0,-2,2,2,0,2,-2,-2,-2,-1,-1,buffer,9,-3,3,3,5,-3,buffer,4,1.2,0.2,0.6,2.4,0.2,1,0.8,-1.6,buffer,3,1.666666667,1.8,1.066666667,0.066666667,buffer,0,6,3,6,2,3,4.4,1.8,2,2,4,1.8,0.4,0.6,1.8,1.4,1.6,1.6,2.4,2.2,1.4,1.4,1.4,3,buffer,HS_TS,2.015962874,0.721845465,3.74987291,1.796616782,2.071074508 +398,R_3Cdm5kuClIX2Osq,18 - 24,American,Male,Male,High School (or equivalent),21,02PsVPf,02FUT,5,01ITEM,0.375,0,0.333333333,3,1,1,2,1,-1,2,2,3,1,1,3,3,1,2,1,2,2,3,3,-1,1,1,3,2,1,0,1,1,3,3,1,2,3,1,1,2,3,-1,3,1,3,0,2,2,2,2,1,3,1,1,2,3,-1,3,1,3,1,2,-1,1,2,3,3,1,2,2,-1,1,0,3,0,1,1,2,10,10,8,8,9,8,10,10,9,6,8,9,2,1,1,1,2,0,1,1,0,1,0,3,2,0,1,0,0,1,1,0,2,0,1,4,2,0,0,3,1,0,1,1,0,1,0,2,0,1,4,2,0,0,2,1,3,2,1,2,1,0,3,0,3,2,1,2,3,2,0,0,2,1,0,0,2,2,1,2,4,1,0,3,1,1,1,1,0,2,0,0,1,0,4,2,3,2,3,0,1,3,buffer,1,0,1,0,2,-2,1,0,-4,-1,0,3,0,-1,-2,-2,-1,-1,0,0,-1,0,-2,2,1,-2,-3,1,1,0,1,1,-2,0,2,1,1,-2,2,-2,-2,0,1,0,-2,buffer,0,0,-1,2,1,-1,buffer,0.8,-1.2,0,-0.8,0,-0.6,0.4,0,-0.6,buffer,-0.333333333,0.666666667,-0.133333333,-0.466666667,-0.066666667,buffer,2,1,0,4,2,0,1.4,0.6,1.2,0.4,1.8,0.8,0.6,1.8,1.2,1.2,1.8,1.4,1,2,1.2,0.6,2,1.8,buffer,HS_TS,-0.271289667,0.19342865,-0.434734729,-1.122771927,-0.408841918 +399,R_1EE90vVU0660r2U,18 - 24,American,Male,Male,High School (or equivalent),24,03VPfPs,01PAST,5,02DGEN,0.5,0,1,0,2,0,1,2,1,2,2,1,0,0,1,1,1,0,1,0,0,2,1,0,1,0,1,2,0,2,1,0,1,1,2,1,2,0,2,1,1,0,0,1,2,2,0,0,2,1,2,0,0,0,2,1,0,1,2,1,0,0,1,2,0,1,2,1,3,0,2,1,0,2,0,0,1,1,4,5,5,5,5,5,4,5,3,3,4,4,1,2,0,1,1,1,1,2,0,2,0,1,0,1,1,1,0,1,1,2,1,1,1,1,0,1,1,1,1,0,2,1,2,1,2,1,0,1,1,1,2,0,1,1,1,2,2,1,1,1,2,2,0,0,0,2,1,1,0,1,0,2,1,0,1,2,0,1,1,2,1,0,1,0,1,0,1,1,2,1,3,2,1,1,1,0,1,0,1,0,buffer,-1,1,-2,0,-1,0,1,1,-1,1,-2,1,-1,0,0,-1,-2,0,0,1,-1,-1,1,1,0,-1,0,0,1,-1,0,1,0,-2,0,-1,-2,0,0,1,1,-1,1,-1,1,buffer,0,0,2,2,1,1,buffer,-0.6,0.4,-0.4,-0.4,0,-0.2,-0.2,-0.4,0.2,buffer,0.666666667,1.333333333,-0.2,-0.2,-0.133333333,buffer,1,0,0,1,1,1,1,1.2,0.6,1,0.8,0.8,1.6,0.8,1,1.4,0.8,1,0.8,1.2,0.6,1,1.6,0.4,buffer,HS_TS,0.414886095,0.545706526,-0.579031545,-0.615052151,-0.058372769 +400,R_5SBa48mHIRz5XN6,18 - 24,American,Female,Female,University - Undergraduate,21,01PfPsV,02FUT,5,01ITEM,0.25,0,1,3,2,0,0,0,-1,1,0,2,1,2,-1,1,1,1,3,1,0,-2,-1,-3,2,-3,3,-2,2,-2,-1,0,-2,3,1,1,-3,-3,-3,3,-3,2,-3,2,-3,-3,-3,1,2,2,0,2,2,1,1,0,0,2,1,0,1,2,2,3,1,1,3,1,1,1,1,1,1,0,1,1,2,2,10,10,6,5,8,8,7,3,4,5,6,4,0,1,0,2,1,2,1,3,1,3,0,1,2,1,3,0,1,1,3,3,2,2,3,0,4,0,2,4,4,0,1,0,0,2,2,2,0,0,2,1,1,1,0,1,1,0,1,1,3,1,2,0,1,1,0,2,2,0,1,1,0,0,1,1,2,0,1,0,1,1,0,1,2,3,3,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,buffer,-1,1,0,0,-1,0,1,3,-1,2,-1,0,2,0,2,0,0,0,0,2,0,2,2,-1,4,-2,0,4,3,-1,-1,-1,0,0,1,0,1,-1,0,0,-1,0,2,3,3,buffer,3,7,2,0,2,4,buffer,-0.2,1,0.6,0.4,1.4,0.8,-0.2,0,1.4,buffer,4,2,0.466666667,0.866666667,0.4,buffer,5,2,2,2,3,0,0.8,2,1.4,1.6,2.2,2,1,1,0.8,1.2,0.8,1.2,0.8,0.6,1.8,1,0.6,0.4,buffer,C_Ug,2.702138637,0.897984403,0.863936607,1.415826951,1.46997165 +401,R_1NyQvCitGYJPI6S,25 - 31,American,Male,Male,Professional Degree (ex. JD/MD),30,02PsVPf,01PAST,5,02DGEN,0.875,0,1,1,2,2,2,2,1,0,2,1,2,2,1,2,2,2,1,1,1,1,1,1,0,0,1,1,2,1,2,2,1,2,2,2,2,2,0,1,1,1,0,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,2,1,1,1,2,1,1,1,1,8,7,8,7,7,6,7,7,7,7,7,7,0,1,1,1,1,0,0,2,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,2,1,0,2,1,1,0,0,1,1,1,0,1,1,0,1,1,1,1,1,1,0,1,0,1,1,0,2,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,2,1,0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,0,buffer,0,1,0,0,0,0,-1,1,0,0,-1,-1,-1,-1,0,1,-1,0,-1,-1,1,-1,0,0,1,1,0,1,0,0,1,0,0,1,1,1,0,1,0,1,0,-1,2,1,0,buffer,1,0,1,0,0,-1,buffer,0.2,0,-0.8,-0.4,0.2,0.4,0.6,0.6,0.4,buffer,0.666666667,-0.333333333,-0.2,0.066666667,0.533333333,buffer,1,0,2,0,0,0,0.8,0.6,0.2,0.2,1,1,0.6,0.6,1,0.6,0.8,0.6,1,0.8,0.8,0.4,0.2,0.4,buffer,grad_prof,0.414886095,-0.334988165,-0.579031545,-0.107332375,-0.151616497 +402,R_3ZBIxk3ePWVcyCi,25 - 31,American,Female,Female,University - Graduate (Masters),27,02PsVPf,02FUT,10,02DGEN,0.375,0,1,1,1,1,-2,2,1,3,3,0,2,2,-2,3,3,2,-1,1,1,-3,3,3,1,1,3,3,2,-2,3,1,3,0,1,-1,-3,1,3,-1,3,3,3,-1,-3,3,-2,3,0,1,2,1,3,2,3,3,0,3,3,-3,3,3,3,0,1,3,2,3,0,2,3,-1,2,3,-2,3,3,3,2,5,5,7,10,5,0,2,2,0,7,1,2,0,0,1,1,2,2,2,3,1,0,0,0,2,1,1,0,2,1,1,2,4,0,3,1,3,1,0,5,1,1,0,1,3,1,1,0,0,0,1,1,1,0,0,1,1,0,2,4,1,1,1,0,1,0,1,0,0,0,1,1,0,2,0,2,0,2,2,0,0,3,1,0,3,0,0,0,1,1,0,2,1,0,1,1,0,1,0,0,0,buffer,1,0,-1,-2,0,1,2,2,3,0,-1,-1,0,2,0,0,0,0,-3,0,1,3,0,2,1,2,1,0,5,0,1,0,1,-1,2,-2,1,2,-1,-1,3,0,0,3,0,buffer,2,3,3,7,3,4,buffer,-0.4,1.6,0,-0.6,1.4,1.6,0.6,-0.2,1.2,buffer,2.666666667,4.666666667,0.4,0.8,0.533333333,buffer,5,5,0,0,5,1,0.8,2,0.6,1,2,2,1.2,0.4,0.6,1.6,0.6,0.4,1,0.8,1.4,0.4,1,0.2,buffer,grad_prof,1.78723762,2.307095909,0.719639792,1.288897006,1.525717582 +403,R_6jZhZWuUygvzs2g,25 - 31,American,Male,Male,University - Undergraduate,27,01PfPsV,02FUT,5,01ITEM,0.5,0,1,2,3,3,1,2,2,1,3,1,3,2,1,3,3,2,-1,3,3,-1,2,0,-1,1,-1,1,0,2,1,2,1,-2,3,3,-2,2,-1,-1,-2,1,1,1,0,2,1,1,2,3,1,3,2,2,-1,3,-1,2,2,2,2,1,1,3,3,2,1,3,2,0,1,-1,2,2,1,1,2,2,3,4,4,7,7,5,6,7,8,4,5,5,3,0,0,2,0,2,2,2,2,2,2,1,2,1,1,4,0,0,3,0,3,2,5,0,2,1,1,1,2,1,0,0,2,2,0,0,2,0,2,1,0,1,1,2,1,1,0,1,0,1,0,1,2,2,1,0,0,2,1,0,1,0,0,1,0,1,0,3,2,0,1,2,1,1,0,1,0,1,2,1,0,1,2,0,0,0,1,1,1,1,buffer,3,0,-2,0,0,2,0,2,0,1,2,0,1,-1,0,3,0,-1,3,-1,3,1,3,-2,1,1,1,-1,1,1,0,0,-1,-1,-1,1,-1,1,2,0,1,1,0,0,-1,buffer,-3,-3,-4,3,2,0,buffer,0.2,1,0.4,0.8,1.2,0.6,-0.6,0.6,0.2,buffer,-3.333333333,1.666666667,0.533333333,0.866666667,0.066666667,buffer,4,3,1,2,2,3,1,2,1.4,1.4,2.4,1.2,0.8,1,1,0.6,1.2,0.6,0.4,1.2,1,1,0.6,0.8,buffer,C_Ug,-2.329816955,0.721845465,1.008233421,1.415826951,0.20402222 +404,R_3MLL21zMaguXu2a,25 - 31,American,Male,Male,University - Undergraduate,29,03VPfPs,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,2,3,3,-1,3,0,-3,1,0,3,2,1,3,2,3,-2,3,3,2,2,1,-2,0,-1,1,3,1,2,2,1,-1,3,3,1,2,3,-2,0,-3,0,-3,0,1,3,0,2,3,3,-2,3,0,-3,2,-3,2,3,3,3,3,3,3,3,3,-2,3,1,-3,3,-3,2,3,3,3,3,3,5,5,5,4,5,7,2,2,2,2,2,3,4,0,0,3,1,1,1,1,1,2,1,0,1,0,2,3,0,0,2,1,3,1,1,3,3,5,1,2,1,3,0,0,0,1,0,0,0,1,3,1,1,2,0,1,0,1,0,0,1,0,1,0,2,3,1,1,2,0,1,0,1,0,0,1,0,2,0,0,2,1,6,1,1,1,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,buffer,4,0,0,2,1,1,1,0,-2,1,0,-2,1,-1,2,2,0,0,1,1,2,1,-1,0,2,4,-1,2,0,3,0,0,0,1,0,1,0,-1,2,1,6,1,1,1,1,buffer,3,3,3,2,3,4,buffer,1.4,0.2,0,0.8,0.8,1.6,0.2,0.6,2,buffer,3,3,0.533333333,1.066666667,0.933333333,buffer,1,0,2,0,0,1,1.6,1.2,0.8,1.2,2.2,2.4,0.2,1,0.8,0.4,1.4,0.8,0.4,1,2,0.2,0.4,0,buffer,C_Ug,2.015962874,1.426401218,1.008233421,1.796616782,1.561803574 +405,R_7uoGPbNGhNG6Ce5,18 - 24,American,Male,Male,College Diploma/Certificate,20,02PsVPf,01PAST,5,01ITEM,0,0,1,-2,3,-1,0,-2,-3,1,1,1,-2,-1,-3,3,-3,3,0,3,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,2,0,1,0,2,3,1,1,1,2,1,0,0,3,3,2,3,1,0,2,0,1,1,1,2,1,3,3,3,3,2,0,1,0,2,3,1,1,1,2,1,3,3,3,3,2,0,1,0,2,3,1,1,1,2,1,3,3,3,3,0,3,0,0,0,3,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,-3,-3,0,0,0,3,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,3,3,0,0,buffer,0,0,0,0,0,0,buffer,0,0,-1.2,0.6,-0.6,0,0.6,0.6,1.2,buffer,0,0,-0.4,0,0.8,buffer,0,0,0,0,0,0,1,1.6,1.4,1.6,1,2.6,1,1.6,2.6,1,1.6,2.6,0.6,0.6,1.2,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-1.011921991,-0.23426232,-0.361899488 +406,R_1DJaqmosXBlRNrd,25 - 31,American,Female,Female,College Diploma/Certificate,30,02PsVPf,02FUT,5,02DGEN,0.25,0,1,1,1,1,-1,3,-1,0,1,0,1,0,1,0,1,0,0,0,0,-1,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,3,0,0,0,0,1,0,1,0,0,1,2,1,0,0,2,0,0,1,0,1,0,1,1,0,0,4,5,5,5,5,4,5,6,5,4,5,5,1,1,1,0,0,1,0,0,0,1,0,1,0,1,0,1,1,1,1,3,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,1,3,0,0,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0,0,0,0,1,0,1,buffer,1,0,1,-1,0,0,0,-1,0,1,0,1,0,0,-1,0,1,0,0,2,0,0,1,0,1,0,1,-1,0,0,-1,-1,-1,1,2,0,0,0,0,0,0,0,-1,0,-1,buffer,-1,-1,0,1,0,-1,buffer,0.2,0,0,0.6,0.4,0,0,0,-0.4,buffer,-0.666666667,0,0.066666667,0.333333333,-0.133333333,buffer,1,0,1,1,1,0,0.6,0.4,0.4,1.4,0.6,0.4,0.4,0.4,0.4,0.8,0.2,0.4,0.8,0.2,0,0.8,0.2,0.4,buffer,C_Ug,-0.500014922,-0.158849227,-0.001844284,0.400387399,-0.065080258 +407,R_1DNW39lgIxT0Ku8,18 - 24,American,Female,Female,University - PhD,24,03VPfPs,01PAST,5,01ITEM,0,0.666666667,0.333333333,1,3,2,3,0,2,1,0,1,3,1,2,3,2,3,2,0,0,1,1,3,3,2,1,2,1,2,3,0,1,0,2,3,1,1,0,2,1,3,2,1,3,1,2,0,1,0,2,3,0,2,3,0,1,0,1,1,2,0,3,1,1,0,3,2,1,3,1,2,0,3,2,1,2,0,10,7,6,8,8,9,10,8,9,9,10,9,1,3,2,2,1,1,2,2,0,1,0,0,0,2,2,1,1,1,2,1,2,1,1,2,1,0,1,2,0,3,0,3,0,0,0,0,2,0,0,3,0,1,1,2,0,0,2,2,0,2,1,2,1,1,3,2,0,2,0,3,2,2,3,0,0,3,1,1,2,0,0,1,2,2,1,0,1,2,0,2,1,0,1,1,0,2,1,1,2,3,buffer,1,0,2,2,1,1,0,2,0,-2,0,-1,-1,0,2,1,-1,-1,2,-1,1,-1,0,1,-2,-2,1,0,0,0,2,1,1,0,-2,2,1,0,1,0,-2,0,1,0,-2,buffer,0,-1,-3,-1,-2,0,buffer,1.2,0.2,0,0,-0.2,-0.2,0.4,0.8,-0.6,buffer,-1.333333333,-1,0.466666667,-0.133333333,0.2,buffer,2,1,3,1,2,0,1.8,1.2,0.8,1.2,1.4,1.2,0.6,1,0.8,1.2,1.6,1.4,1.4,1.4,1.2,1,0.6,1.8,buffer,grad_prof,-0.95746543,-0.687266041,0.863936607,-0.488122207,-0.317229268 +408,R_5tuUhPynQWwFDZT,18 - 24,American,Female,Female,High School (or equivalent),19,02PsVPf,02FUT,10,01ITEM,0.5,0,1,-1,3,1,3,3,1,-2,1,3,2,1,3,3,1,3,2,2,3,3,3,2,0,3,3,0,0,0,0,0,0,3,3,3,3,3,1,-1,2,3,1,3,-2,3,1,3,-1,3,1,3,3,1,-1,1,3,2,1,3,3,1,3,-1,3,1,3,3,1,-1,2,1,2,1,2,3,1,2,5,4,6,3,6,2,7,4,6,5,9,2,3,1,2,0,0,1,2,2,0,2,1,3,3,1,3,4,0,2,0,0,0,1,1,0,1,2,5,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,0,0,1,0,0,1,1,1,0,0,0,1,1,1,0,1,3,2,3,1,3,0,0,0,0,0,0,0,1,2,0,0,1,0,0,1,buffer,3,1,2,0,0,1,1,2,0,2,1,3,3,1,3,4,0,2,0,0,0,0,0,-2,1,2,4,0,0,-1,1,1,0,0,0,1,1,0,-2,1,3,1,3,1,2,buffer,-2,0,0,-2,-3,0,buffer,1.2,1.2,2.2,1.2,-0.2,1,0.4,0.2,2,buffer,-0.666666667,-1.666666667,1.533333333,0.666666667,0.866666667,buffer,2,2,4,2,5,4,1.2,1.4,2.2,1.2,0.6,1.4,0,0.2,0,0,0.8,0.4,0.4,0.8,2.4,0,0.6,0.4,buffer,HS_TS,-0.500014922,-1.039543918,3.172685649,1.035037119,0.667040982 +409,R_5oKFZs5C9UhTZjC,25 - 31,American,Female,Female,College Diploma/Certificate,31,01PfPsV,01PAST,5,02DGEN,-1.5,0,1,1,3,3,2,3,-3,-1,-1,2,-1,3,3,3,3,3,1,3,3,3,-3,-3,-2,3,2,1,3,3,3,3,3,3,3,3,3,-2,-3,-1,-1,1,-1,3,3,3,3,3,3,3,3,3,-1,0,-3,3,-3,3,3,3,3,3,3,3,2,3,2,3,2,-3,3,3,3,3,3,3,3,2,10,1,1,1,1,1,1,1,10,1,10,1,0,0,0,1,6,0,1,4,0,2,0,0,0,0,0,2,0,0,1,5,0,0,0,1,0,0,0,0,0,0,2,0,0,1,4,3,2,4,5,4,0,0,0,0,0,2,1,0,0,0,5,2,4,1,4,0,0,0,0,1,2,0,0,0,1,0,1,4,1,2,0,0,0,0,0,0,1,0,1,4,2,0,0,6,0,0,0,0,0,1,buffer,-2,0,0,0,2,-3,-1,0,-5,-2,0,0,0,0,0,0,-1,0,1,5,-5,-2,-4,0,-4,0,0,0,0,-1,2,-1,0,-1,-3,-2,1,4,-5,2,0,0,0,0,-1,buffer,9,0,-9,0,-9,0,buffer,0,-2.2,0,1,-3,-0.2,-0.6,0,-0.2,buffer,0,-3,-0.733333333,-0.733333333,-0.266666667,buffer,9,0,0,0,9,9,1.4,1.4,0,1.6,0.2,0,1.4,3.6,0,0.6,3.2,0.2,0.6,1.6,0,1.2,1.6,0.2,buffer,C_Ug,-0.042564413,-1.744099671,-1.733406066,-1.630491701,-1.287640463 +410,R_36a9bhPXzT1Nr9f,18 - 24,American,Male,Male,High School (or equivalent),21,03VPfPs,01PAST,10,02DGEN,-0.125,0,1,1,3,2,-2,1,-1,-3,1,1,1,0,-1,2,-2,3,0,3,2,-2,1,-2,-2,1,2,-1,1,-1,2,-1,3,-2,3,1,-3,2,-3,-1,1,3,-3,1,-1,0,0,2,1,3,3,-3,1,2,-3,2,-1,3,0,-1,3,-3,3,1,3,3,-3,1,3,-3,1,-1,2,-1,-1,3,-3,3,1,6,1,2,7,6,2,5,0,0,7,4,1,0,0,0,0,1,1,0,1,2,1,0,0,1,0,3,0,1,1,1,2,2,0,2,4,1,0,2,2,1,0,0,1,1,0,3,0,1,2,2,0,0,1,1,0,0,0,1,1,0,4,0,0,2,1,1,0,1,1,0,2,0,1,1,1,1,1,0,1,2,0,0,2,1,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,buffer,1,0,-1,-1,0,-2,1,-1,-1,0,1,0,-1,0,0,3,0,0,0,1,-2,2,0,0,3,0,0,1,1,1,2,0,1,1,1,0,1,-1,1,1,-1,0,2,1,1,buffer,-1,1,1,2,0,2,buffer,-0.2,-0.6,0,0.8,0.6,0.6,1,0.4,0.6,buffer,0.333333333,1.333333333,-0.266666667,0.666666667,0.666666667,buffer,1,1,5,2,2,4,0.2,1,0.4,1.2,2,1.2,0.4,1.6,0.4,0.4,1.4,0.6,1,1,0.8,0,0.6,0.2,buffer,HS_TS,0.186160841,0.545706526,-0.723328361,1.035037119,0.260894031 +411,R_1diDaGJkKUxlKT8,18 - 24,American,Female,Female,High School (or equivalent),20,01PfPsV,02FUT,10,02DGEN,-0.25,0,0.666666667,3,3,3,-3,1,0,0,0,0,0,0,0,0,0,3,3,3,3,-2,2,0,0,0,2,0,0,0,0,0,3,3,3,3,1,-1,0,0,0,3,0,0,0,0,0,3,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,5,5,5,1,5,5,2,1,1,2,2,2,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,0,0,4,2,0,0,0,3,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,0,0,2,1,0,0,0,0,0,0,0,0,0,3,0,0,0,3,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,2,0,0,0,0,0,-3,0,0,0,2,1,0,0,0,3,0,0,0,0,0,-3,0,0,0,3,3,0,0,0,1,0,0,0,0,0,0,buffer,3,4,4,-1,3,3,buffer,-0.2,0.4,-0.6,0.6,0.6,-0.6,1.2,0.2,0,buffer,3.666666667,1.666666667,-0.133333333,0.2,0.466666667,buffer,4,0,0,0,1,1,0.4,0.4,0,1.2,0.6,0,0.6,0,0.6,0.6,0,0.6,1.2,0.2,0,0,0,0,buffer,HS_TS,2.473413383,0.721845465,-0.434734729,0.146527512,0.726762908 +412,R_6BCrzfueF6asaWt,18 - 24,American,Female,Female,College Diploma/Certificate,20,03VPfPs,01PAST,5,01ITEM,-0.375,0,1,3,3,3,3,2,-3,2,1,3,3,-3,-3,3,0,3,3,3,3,1,2,-2,3,2,2,3,-3,-3,3,1,3,3,3,3,-3,2,0,3,-3,1,2,-1,-3,3,2,3,3,3,3,3,3,0,3,2,1,3,-3,-3,3,0,3,3,3,3,3,3,-2,3,2,3,3,-3,-3,3,0,3,3,2,1,4,5,4,1,3,0,0,1,0,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,0,0,0,6,0,3,1,4,2,1,2,0,0,2,0,0,0,0,0,1,3,1,1,2,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,4,0,2,0,5,1,1,2,0,0,1,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,buffer,0,0,0,2,-1,-2,0,0,-1,0,0,0,0,1,0,0,0,0,6,-1,2,0,3,2,1,2,0,0,2,0,0,0,0,4,0,0,0,5,-1,1,2,0,0,1,0,buffer,2,-1,1,4,4,4,buffer,0.2,-0.6,0.2,1,1.6,0.8,0.8,1,0.6,buffer,0.666666667,4,-0.066666667,1.133333333,0.8,buffer,1,3,3,1,2,0,0.4,0.8,0.2,1.2,2.2,0.8,0.2,1.4,0,0.2,0.6,0,0.8,1.8,0.6,0,0.8,0,buffer,C_Ug,0.414886095,1.954818032,-0.290437916,1.923546725,1.000703234 +413,R_6AnjfeWnRFdPK49,18 - 24,American,Male,Male,University - Undergraduate,19,02PsVPf,01PAST,5,01ITEM,0,0,1,2,3,3,2,3,-1,0,2,-2,3,0,3,3,-2,3,3,3,3,3,3,-1,0,3,-3,2,-1,3,3,1,3,-2,2,3,-2,0,3,0,-2,-2,0,-3,-2,-2,-3,1,3,3,2,3,3,0,0,3,-3,3,0,3,3,-3,3,3,3,3,3,3,1,0,3,-3,3,0,3,3,-3,3,1,4,1,6,8,10,1,2,1,2,4,3,1,0,0,1,0,0,0,1,1,1,1,0,0,3,0,4,1,0,4,3,4,0,4,0,3,3,5,5,1,2,1,0,1,1,0,1,0,1,1,0,0,0,0,1,0,1,0,0,1,0,2,0,1,1,0,0,0,0,1,0,5,1,0,5,3,4,0,5,1,2,2,5,5,4,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,buffer,0,0,-1,0,0,-1,0,0,0,1,1,0,0,2,0,3,1,0,3,3,2,0,3,-1,3,3,5,5,0,2,5,1,-1,5,3,3,0,5,1,2,2,5,5,4,2,buffer,0,2,0,4,4,7,buffer,-0.2,0,0.6,2,1.4,3,2.6,2.2,3.6,buffer,0.666666667,5,0.133333333,2.133333333,2.8,buffer,5,4,9,1,2,2,0.4,0.6,0.8,2.4,2.2,3.2,0.6,0.6,0.2,0.4,0.8,0.2,2.8,2.4,3.6,0.2,0.2,0,buffer,C_Ug,0.414886095,2.483234847,0.14245253,3.827495883,1.717017339 +414,R_7H7PX3Cx5sdW7Q6,25 - 31,American,Female,Female,High School (or equivalent),30,03VPfPs,01PAST,5,02DGEN,0.75,0,0.666666667,3,3,3,3,3,3,2,2,-2,3,3,3,3,2,3,-3,-3,3,3,-3,-2,0,-2,2,-2,-2,-1,-2,2,0,-2,3,3,3,3,1,-1,-1,-2,-2,-2,-3,-2,2,-2,3,3,3,3,3,3,2,3,-3,2,3,2,3,3,3,3,3,3,3,3,3,1,3,-3,2,3,3,3,3,3,10,10,8,9,7,10,10,10,8,10,0,9,6,6,0,0,6,5,2,4,4,5,5,4,5,0,3,5,0,0,0,0,2,3,3,0,5,5,6,5,0,5,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,1,6,0,0,6,3,1,1,4,0,0,2,0,0,2,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,buffer,6,6,0,0,6,5,2,3,3,4,5,3,5,-1,3,5,0,0,0,0,2,2,2,-1,4,5,6,5,-1,5,1,6,0,0,6,3,0,1,4,0,0,1,0,0,2,buffer,0,0,0,-1,7,1,buffer,3.6,3.4,3,1,1.8,4,2.6,1.6,0.6,buffer,0,2.333333333,3.333333333,2.266666667,1.6,buffer,1,3,2,0,10,1,3.6,4,3.4,1,2.6,4.2,0,0.6,0.4,0,0.8,0.2,2.6,1.8,0.8,0,0.2,0.2,buffer,HS_TS,-0.042564413,1.074123341,7.068699659,4.081355772,3.04540359 +415,R_70wTqF36yBKH2DV,25 - 31,American,Male,Male,University - Undergraduate,25,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,2,1,2,2,2,2,2,2,1,2,2,0,0,2,3,2,2,2,2,1,2,1,1,2,2,1,2,1,2,2,2,2,1,2,1,2,2,1,2,-1,2,2,2,2,1,2,1,-2,1,2,2,2,1,1,2,2,1,2,2,2,2,0,2,2,1,2,2,1,2,2,3,2,2,1,7,7,8,10,9,9,10,10,10,10,8,9,1,0,1,0,0,1,0,1,1,1,0,1,2,1,0,0,0,1,1,0,1,0,0,1,1,3,0,2,2,0,1,0,0,4,1,0,0,0,1,0,0,0,1,2,0,0,0,1,0,0,1,0,0,1,1,0,1,2,2,1,1,0,0,1,0,0,0,1,0,0,3,1,0,1,0,1,0,1,4,1,1,0,0,0,1,0,1,1,0,1,buffer,0,0,1,-4,-1,1,0,1,0,1,0,1,1,-1,0,0,0,0,1,0,0,0,0,0,0,3,-1,0,0,-1,0,0,-1,-3,-1,-1,0,1,0,-1,3,0,-1,1,-1,buffer,-3,-3,-2,0,1,0,buffer,-0.8,0.6,0.2,0.2,0,0.2,-1,-0.2,0.4,buffer,-2.666666667,0.333333333,-1.85E-17,0.133333333,-0.266666667,buffer,3,2,1,0,2,1,0.4,0.8,0.8,0.4,0.6,1.4,1.2,0.2,0.6,0.2,0.6,1.2,0.4,0.2,1,1.4,0.4,0.6,buffer,C_Ug,-1.872366447,0.017289712,-0.1461411,0.019597567,-0.495405067 +416,R_6WOPvyZulqJtokI,25 - 31,American,Male,Male,High School (or equivalent),31,02PsVPf,01PAST,10,01ITEM,-0.5,0.333333333,0.666666667,3,3,3,3,3,0,-2,3,-3,3,0,0,0,0,0,3,3,3,3,0,0,-3,3,-3,3,3,3,-1,0,-1,3,3,0,3,0,0,-3,3,-3,0,3,3,3,0,0,3,3,3,3,0,3,-3,-3,-3,3,3,3,0,0,0,3,3,3,3,0,3,-3,3,-3,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,3,3,1,0,1,0,0,3,0,3,0,1,0,0,3,3,3,3,0,0,0,0,0,0,3,3,1,6,0,0,3,3,0,0,0,0,0,0,0,3,3,1,0,0,0,3,3,1,0,0,0,0,3,0,0,0,0,0,0,3,0,0,4,0,1,0,0,0,0,0,0,0,6,0,0,0,0,1,0,0,buffer,0,0,0,0,0,-3,0,-6,0,0,0,0,1,0,1,0,0,3,0,0,-3,0,0,0,3,0,0,2,0,0,0,0,3,0,0,0,0,-6,0,3,0,0,3,0,1,buffer,0,0,0,0,0,0,buffer,0,-1.8,0.4,0.6,0,0.4,0.6,-0.6,0.8,buffer,0,0,-0.466666667,0.333333333,0.266666667,buffer,0,0,0,0,0,0,0.6,0.2,1.6,1.2,0.8,1.8,0.6,2,1.2,0.6,0.8,1.4,0.6,0.6,1,0,1.2,0.2,buffer,HS_TS,-0.042564413,-0.158849227,-1.156218807,0.400387399,-0.239311262 +417,R_7QnDfcY78mwDRhJ,18 - 24,Canadian,Male,Male,College Diploma/Certificate,24,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,0,1,1,-1,1,-1,0,0,1,1,-1,-1,2,1,-1,0,2,0,-2,-1,-2,1,-2,2,-1,1,1,-2,0,1,3,-2,1,2,1,-1,1,-1,2,0,2,0,1,1,1,0,2,1,-2,1,0,-2,2,-1,1,-1,-1,1,2,-1,1,2,2,0,2,1,-2,3,-2,1,0,-1,2,3,-1,5,6,6,6,6,8,2,5,6,2,5,5,0,1,1,1,2,1,1,2,1,2,2,2,4,1,2,3,3,0,3,0,0,1,1,1,1,3,1,1,0,2,0,1,0,1,0,1,2,2,2,0,0,0,1,1,0,1,1,1,1,1,2,2,3,3,0,1,0,0,2,0,3,4,1,4,2,1,0,1,0,1,1,1,3,1,0,1,0,1,2,1,1,0,1,1,0,1,0,1,1,0,buffer,0,0,1,0,2,0,-1,0,-1,2,2,2,3,0,2,2,2,-1,2,-1,-2,-1,-2,-2,1,2,1,1,-2,2,2,4,0,2,1,0,0,0,-1,1,0,1,2,0,0,buffer,3,1,0,4,1,3,buffer,0.6,0,1.8,0.8,-1.2,0.8,1.8,0,0.6,buffer,1.333333333,2.666666667,0.8,0.133333333,0.8,buffer,1,0,2,0,0,1,1,1.4,2.2,1.8,0.8,1.4,0.4,1.4,0.4,1,2,0.6,2.8,0.6,1.2,1,0.6,0.6,buffer,C_Ug,0.872336603,1.25026228,1.585420683,0.019597567,0.931904283 +418,R_7P6VjQVxwsDLEuS,18 - 24,Canadian,Male,Male,High School (or equivalent),20,03VPfPs,02FUT,5,01ITEM,0.375,1,0,1,3,3,2,2,1,1,-1,1,-1,-2,-3,3,-1,3,-1,1,3,-2,-3,-1,2,-2,3,-2,2,-2,-2,-2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,2,1,2,-1,2,-1,2,-2,-3,3,3,3,2,3,3,1,2,2,-2,3,-2,1,-2,-3,3,3,3,5,6,6,5,5,5,1,4,3,2,5,3,2,2,0,4,5,2,1,1,2,1,4,1,5,1,2,1,3,3,2,2,1,1,1,1,1,2,3,3,1,3,1,0,0,0,1,1,2,3,2,3,0,0,0,4,0,1,0,0,1,0,1,3,4,3,2,0,0,0,4,0,1,1,3,2,3,1,2,2,3,2,2,2,2,2,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,buffer,1,2,0,4,4,1,-1,-2,0,-2,4,1,5,-3,2,0,3,3,1,2,0,-2,-3,-2,-1,2,3,3,-3,3,1,1,3,1,2,1,1,1,2,1,2,2,2,2,1,buffer,4,2,3,3,0,2,buffer,2.2,-0.8,1.8,1.8,-1.6,1.6,1.6,1.2,1.8,buffer,3,1.666666667,1.066666667,0.6,1.533333333,buffer,0,1,1,1,1,0,2.6,1.4,2.6,2.2,1,2.4,0.4,2.2,0.8,0.4,2.6,0.8,2,2,1.8,0.4,0.8,0,buffer,HS_TS,2.015962874,0.721845465,2.162607944,0.908107175,1.452130865 +419,R_3ADeuracdnFjlol,39 - 45,Canadian,Female,Female,High School (or equivalent),40,03VPfPs,02FUT,5,01ITEM,0.25,0.333333333,0.666666667,3,3,3,3,3,0,-3,3,-1,0,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-2,3,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-3,0,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-1,0,3,3,3,-3,3,3,3,3,3,3,0,-3,3,-1,0,3,0,3,-3,3,0,2,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,buffer,0,0,0,0,0,0,0,0,1,3,0,-3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,-3,0,0,0,buffer,0,2,-1,0,0,0,buffer,0,0.8,-0.6,0,0.4,0,0,0.8,-0.6,buffer,0.333333333,0,0.066666667,0.133333333,0.066666667,buffer,0,1,1,0,1,0,0,0.8,0,0,0.4,0,0,0,0.6,0,0,0,0,0.8,0,0,0,0.6,buffer,HS_TS,0.186160841,-0.158849227,-0.001844284,0.019597567,0.011266224 +420,R_5QR1WLqqjfnTfrf,25 - 31,Canadian,Female,Female,University - Undergraduate,25,01PfPsV,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,2,2,1,3,2,1,2,2,3,2,3,1,2,3,2,0,3,0,-1,1,1,2,1,2,2,1,1,1,2,0,2,1,1,1,0,1,3,0,2,2,2,2,2,1,1,2,2,1,2,3,1,0,0,1,-1,2,1,2,1,1,1,2,0,0,1,1,1,0,2,2,1,0,2,2,1,1,2,3,3,1,2,3,7,3,4,1,3,2,1,1,4,1,0,0,1,1,0,2,0,1,1,2,0,1,0,2,2,0,1,2,1,0,1,1,0,2,1,0,0,0,1,1,0,2,2,2,3,1,0,0,2,1,1,0,1,3,1,0,1,2,1,0,2,1,0,1,1,2,2,1,2,1,0,1,1,0,0,1,1,1,1,1,1,0,1,2,2,0,1,0,1,3,1,1,0,1,0,buffer,2,1,1,3,0,0,-2,-1,-1,-3,1,0,1,-1,1,-1,1,-1,-1,1,0,0,0,0,0,-1,0,0,1,0,1,2,0,0,-1,0,0,1,-1,-3,0,0,1,0,1,buffer,-2,-5,0,-1,0,-1,buffer,1.4,-1.4,0.4,-0.2,0,0,0.4,-0.6,0.4,buffer,-2.333333333,-0.666666667,0.133333333,-0.066666667,0.066666667,buffer,2,1,1,1,6,0,1.8,0.4,1.2,1,0.8,1,0.4,1.8,0.8,1.2,0.8,1,1.6,0.4,1,1.2,1,0.6,buffer,C_Ug,-1.643641192,-0.511127103,0.14245253,-0.361192264,-0.593377007 +421,R_6nNFF5o8UlRttgM,67 - 73,American,Male,Male,Trade School (non-military),71,02PsVPf,02FUT,10,02DGEN,0.5,0,1,-2,3,2,2,2,0,-2,2,-2,-2,3,3,2,-2,2,-2,2,2,2,2,1,-2,1,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,0,0,0,0,0,0,1,1,1,1,2,2,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,1,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,1,0,0,0,0,0,0,0,buffer,-1,-1,-1,-1,-2,-2,buffer,0.2,0,0,0,0,0,0.2,0.8,0,buffer,-1,-1.666666667,0.066666667,0,0.333333333,buffer,0,0,0,0,1,1,0.2,0.4,0,0,0.4,0,0,0.4,0,0,0.4,0,0.2,0.8,0,0,0,0,buffer,HS_TS,-0.728740176,-1.039543918,-0.001844284,-0.23426232,-0.501097674 +422,R_15UDzM7aUkST0Xv,60 - 66,Canadian,Male,Male,High School (or equivalent),63,01PfPsV,01PAST,10,02DGEN,0.375,1,0,2,2,3,-2,3,1,-1,2,-2,1,1,1,3,0,1,2,2,3,-3,3,0,-2,2,-2,0,1,2,3,1,1,2,2,3,-3,3,2,0,3,-1,1,0,2,3,1,1,2,2,3,-2,3,1,-2,2,-2,1,1,2,3,0,1,2,3,3,0,3,0,-2,1,-2,0,2,2,2,0,1,2,1,1,2,2,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,2,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,2,2,1,1,1,1,0,0,0,0,0,1,0,2,0,1,0,1,0,1,1,0,1,0,0,buffer,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,-1,0,-1,0,0,0,0,1,-1,0,0,-1,1,0,0,-1,0,-2,0,1,2,0,1,0,0,0,-1,0,0,buffer,1,0,0,1,1,0,buffer,0.2,0.4,0.2,-0.4,0,0,-0.6,0.8,-0.2,buffer,0.333333333,0.666666667,0.266666667,-0.133333333,1.85E-17,buffer,0,1,0,0,0,0,0.2,0.6,0.4,0.2,0.8,0.6,0,0.2,0.2,0.6,0.8,0.6,0,1.4,0.2,0.6,0.6,0.4,buffer,HS_TS,0.186160841,0.19342865,0.431046162,-0.488122207,0.080628361 +423,R_1Maa3MBUCWZQHLj,46 - 52,Canadian,Male,Male,High School (or equivalent),52,03VPfPs,01PAST,5,02DGEN,0,0,1,1,2,3,2,-2,2,-2,2,-1,0,3,3,3,0,2,0,2,0,-1,0,2,1,1,1,2,1,2,2,0,1,-2,3,-1,-3,1,2,1,1,1,-1,0,0,1,1,0,0,2,1,2,-1,0,-2,1,-1,1,3,2,3,-1,1,0,0,0,1,0,1,-1,1,-1,1,2,1,2,-1,1,7,7,7,7,7,9,7,7,5,7,7,7,1,0,3,3,2,0,3,1,2,2,2,1,1,0,1,3,1,4,5,3,0,3,1,2,1,3,3,2,1,2,1,0,2,0,1,2,0,1,0,1,0,1,0,1,1,1,2,3,1,2,1,1,1,0,1,1,2,1,1,1,2,1,1,2,1,0,0,0,0,3,1,2,1,1,1,0,2,1,1,1,1,1,0,0,0,1,1,1,0,0,buffer,0,0,1,3,1,-2,3,0,2,1,2,0,1,-1,0,2,-1,1,4,1,-1,2,0,2,0,2,1,1,0,1,2,-1,0,1,0,-1,-1,0,0,3,0,1,0,1,1,buffer,0,0,2,0,0,2,buffer,1,0.8,0.4,1.4,0.6,1,0.4,0.2,0.6,buffer,0.666666667,0.666666667,0.733333333,1,0.4,buffer,0,0,2,0,0,2,1.8,1.6,1,3.2,1.4,2.2,0.8,0.8,0.6,1.8,0.8,1.2,1.4,0.6,1.2,1,0.4,0.6,buffer,HS_TS,0.414886095,0.19342865,1.441123867,1.669686838,0.929781363 +424,R_3Fx3y1AcHczW3R4,39 - 45,Canadian,Male,Male,University - Undergraduate,45,02PsVPf,02FUT,10,01ITEM,0.25,1,0,0,1,2,-1,-1,-3,-1,1,3,1,2,1,2,0,2,0,1,2,1,-1,-3,-1,1,2,-1,2,1,2,0,2,1,2,2,0,1,-3,-1,2,-1,1,2,1,2,1,2,0,1,2,0,-1,-3,-1,1,3,1,2,1,2,0,2,0,1,2,0,-1,-3,-1,1,2,1,2,1,2,0,2,1,1,1,2,2,2,1,1,1,8,8,9,0,0,0,2,0,0,0,0,1,2,0,0,0,0,0,1,1,0,1,2,0,0,1,4,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,2,0,0,1,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,1,0,0,0,0,1,2,0,0,0,0,0,1,1,0,0,2,0,0,1,3,0,0,0,0,1,0,1,1,0,1,2,0,0,1,2,2,0,0,0,1,0,buffer,0,0,0,-6,-6,-7,buffer,0.2,0.6,0,0.8,0.8,0.2,1,1,0.2,buffer,0,-6.333333333,0.266666667,0.6,0.733333333,buffer,1,1,1,7,7,8,0.4,0.6,0,1,1,0.2,0.2,0,0,0.2,0.2,0,1,1.2,0.2,0,0.2,0,buffer,C_Ug,-0.042564413,-3.505489053,0.431046162,0.908107175,-0.552225032 +425,R_5hMey31i8f8F2kZ,53 - 59,Canadian,Female,Female,College Diploma/Certificate,58,03VPfPs,01PAST,10,01ITEM,0.5,0,1,2,3,2,2,2,-1,2,2,2,1,1,-1,2,1,0,2,3,2,2,3,-2,1,2,1,1,2,-1,2,1,0,3,3,2,1,3,-3,3,2,3,2,0,1,3,2,-1,3,3,2,3,2,-2,0,1,1,1,0,-1,2,0,2,3,3,3,3,0,-1,0,0,0,0,2,-1,3,-3,2,6,6,5,8,5,6,4,4,4,7,5,7,0,0,0,0,1,1,1,0,1,0,1,0,0,0,0,1,0,0,1,1,2,1,0,1,1,1,2,1,1,1,1,0,0,1,0,1,2,1,1,0,1,0,0,1,2,1,0,1,1,2,0,2,2,2,1,1,0,1,4,2,1,0,0,1,0,1,2,0,2,1,2,2,1,1,1,0,0,1,0,2,1,0,1,1,1,2,0,1,3,0,buffer,-1,0,0,-1,1,0,-1,-1,0,0,0,0,0,-1,-2,0,0,-1,0,-1,2,-1,-2,-1,0,0,2,0,-3,-1,1,0,-1,1,-2,0,2,-1,1,0,0,2,0,-2,1,buffer,2,2,1,1,0,-1,buffer,-0.2,-0.4,-0.6,-0.4,-0.4,-0.4,-0.2,0.4,0.2,buffer,1.666666667,0,-0.4,-0.4,0.133333333,buffer,2,1,1,3,1,3,0.2,0.6,0.2,0.6,1,1.2,0.4,1,0.8,1,1.4,1.6,0.4,1.2,1.4,0.6,0.8,1.2,buffer,C_Ug,1.101061858,-0.158849227,-1.011921991,-0.995841983,-0.266387836 +426,R_3ZaGNr7sQUxBidX,25 - 31,American,Female,Female,College Diploma/Certificate,25,01PfPsV,02FUT,10,01ITEM,1.375,0,0.666666667,3,1,2,2,3,2,3,1,1,2,3,3,1,1,2,3,1,2,3,1,3,2,3,2,1,2,1,1,0,3,2,1,3,3,2,1,3,2,2,3,2,2,2,3,1,3,1,2,3,2,3,2,1,3,2,3,2,3,2,1,1,2,0,3,1,0,1,2,2,3,2,3,2,1,0,8,8,7,6,6,6,9,8,5,9,8,8,0,0,0,1,2,1,1,2,1,1,1,2,0,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,2,1,0,0,0,1,1,1,1,0,2,0,0,1,2,1,1,2,1,2,1,2,2,2,1,1,1,1,0,1,0,2,1,0,1,0,1,2,1,1,0,2,0,1,1,3,2,2,1,2,0,1,3,1,1,1,1,1,1,1,1,1,buffer,0,0,0,0,1,0,0,2,-1,1,1,1,-2,0,0,-1,-1,-1,0,-1,-1,-2,0,0,0,0,1,0,2,-1,-1,-1,-1,0,0,-1,0,0,-1,1,-1,0,0,2,1,buffer,-1,0,2,-3,-2,-2,buffer,0.2,0.4,0,-0.8,-0.6,0.4,-0.6,-0.2,0.4,buffer,0.333333333,-2.333333333,0.2,-0.333333333,-0.133333333,buffer,2,2,1,0,0,3,0.6,1.2,1,0.8,0.8,1.2,0.4,0.8,1,1.6,1.4,0.8,0.6,1.2,1.4,1.2,1.4,1,buffer,C_Ug,0.186160841,-1.391821794,0.286749346,-0.868912038,-0.446955911 +427,R_6OcQXI2ElDfjvPW,25 - 31,American,Female,Female,High School (or equivalent),29,02PsVPf,01PAST,10,01ITEM,0.25,0,1,1,2,1,2,-1,-1,2,-1,2,-1,2,1,1,-1,1,1,2,2,2,-2,-2,1,-2,1,-2,1,-1,1,-2,1,-1,2,2,2,-2,-1,1,-1,1,-1,1,-1,-1,-2,1,2,2,2,2,-2,-2,-2,-1,1,-2,2,1,1,-2,2,2,2,2,2,-2,-1,1,-2,1,-2,1,-1,1,-1,1,4,3,4,4,6,8,3,3,3,3,3,6,0,0,1,0,1,1,1,1,1,1,1,2,0,1,0,2,0,1,0,1,0,1,0,1,0,1,2,2,1,0,1,0,1,0,1,1,4,0,1,1,0,0,0,1,1,1,0,1,0,1,0,1,1,1,1,1,2,0,0,0,2,0,0,0,0,1,0,1,0,1,0,0,2,0,0,0,0,0,0,0,1,3,1,0,0,1,2,0,1,1,buffer,-1,0,0,0,0,0,-3,1,0,0,1,2,0,0,-1,1,0,0,0,0,0,0,-1,0,-1,0,0,2,1,0,2,0,0,0,0,0,-3,0,0,1,-1,-2,2,-1,-1,buffer,1,0,1,1,3,2,buffer,-0.2,-0.4,0.4,0.2,-0.4,0.6,0.4,-0.4,-0.6,buffer,0.666666667,2,-0.066666667,0.133333333,-0.2,buffer,0,3,4,0,0,3,0.4,1,0.8,0.8,0.4,1.2,0.6,1.4,0.4,0.6,0.8,0.6,0.4,0.6,0.4,0,1,1,buffer,HS_TS,0.414886095,0.897984403,-0.290437916,0.019597567,0.260507538 +428,R_6V7mTJpfer87KvO,46 - 52,Canadian,Male,Male,High School (or equivalent),49,01PfPsV,02FUT,10,01ITEM,0.375,0,1,0,2,2,0,-3,-1,0,1,2,0,3,2,1,-1,3,0,3,2,-1,-2,-1,0,0,-1,-1,3,2,1,0,3,0,3,2,0,-3,1,1,2,2,1,3,2,1,0,3,0,3,2,0,-3,-1,-1,2,0,0,3,2,2,0,3,0,3,3,1,-3,-1,0,2,2,0,3,3,1,0,2,1,3,1,4,9,1,2,6,1,5,5,2,0,1,0,1,1,0,0,1,3,1,0,0,0,1,0,0,1,0,0,0,2,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,2,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,2,1,2,3,2,0,0,0,0,0,0,0,1,1,0,0,1,0,2,0,0,1,1,0,1,buffer,0,0,0,1,1,0,-1,0,1,1,0,0,-1,0,0,0,0,-1,-1,0,2,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,1,2,0,2,1,2,0,-1,-1,0,-1,buffer,-1,-3,0,-1,4,-1,buffer,0.4,0.2,-0.2,-0.4,0.8,-0.4,0,1.4,-0.6,buffer,-1.333333333,0.666666667,0.133333333,0,0.266666667,buffer,3,6,0,3,1,1,0.6,1,0.2,0.2,1,0.2,0.2,0.8,0.4,0.6,0.2,0.6,0.4,2,0,0.4,0.6,0.6,buffer,HS_TS,-0.95746543,0.19342865,0.14245253,-0.23426232,-0.213961642 +429,R_5ARz8uHpt8i8jlW,25 - 31,Canadian,Male,Male,High School (or equivalent),30,01PfPsV,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,-3,3,-1,1,0,-1,0,0,0,0,1,1,0,0,1,-3,2,-1,1,1,-1,0,0,0,-1,1,0,0,0,1,-3,2,0,1,1,-1,0,0,0,1,1,0,0,0,1,-2,3,-2,1,0,-1,0,0,0,-1,1,0,0,0,1,-2,3,-2,1,0,-1,0,0,0,0,1,0,0,0,1,3,3,3,3,3,3,3,3,3,3,3,3,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,buffer,-1,1,-1,0,1,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,0.2,0,0.2,0.2,0,buffer,0,0,0,0.133333333,0.133333333,buffer,0,0,0,0,0,0,0.4,0.2,0.2,0.6,0.2,0.2,0.4,0.2,0.2,0.4,0,0.2,0.2,0.4,0,0,0.2,0,buffer,HS_TS,-0.042564413,-0.158849227,-0.1461411,0.019597567,-0.081989293 +430,R_7OlzeOEoXi6sKz1,32 - 38,American,Female,Female,Professional Degree (ex. JD/MD),35,03VPfPs,01PAST,5,02DGEN,1,0,1,3,3,2,2,2,2,-3,2,-3,2,2,3,3,2,3,2,3,1,2,2,2,2,2,3,2,1,2,2,2,1,3,3,2,2,2,2,2,2,3,2,3,2,2,2,2,3,3,2,2,2,2,3,2,3,2,3,2,2,3,2,2,2,3,3,2,2,2,2,3,2,3,2,2,3,2,5,7,7,6,7,7,7,6,7,5,7,7,1,0,1,0,0,0,5,0,6,0,1,1,1,0,2,0,0,0,0,0,0,5,0,6,0,1,1,1,0,1,0,0,0,0,0,0,6,0,6,0,1,1,1,1,1,1,1,1,1,0,0,5,0,6,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,2,0,0,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,buffer,1,0,1,0,0,0,-1,0,0,0,0,0,0,-1,1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,0,2,0,0,0,1,buffer,-2,1,0,1,0,0,buffer,0.4,-0.2,0,-0.8,0,-0.2,-0.4,-0.2,0.6,buffer,-0.333333333,0.333333333,0.066666667,-0.333333333,-1.85E-17,buffer,1,0,0,2,1,0,0.4,2.2,1,0,2.2,0.8,0,2.4,1,0.8,2.2,1,0.4,0,0.6,0.8,0.2,0,buffer,grad_prof,-0.271289667,0.017289712,-0.001844284,-0.868912038,-0.281189069 +431,R_5E9ViorLhnK8rMQ,32 - 38,American,Male,Male,University - PhD,33,01PfPsV,02FUT,5,02DGEN,0.625,0.333333333,0,1,2,3,2,1,1,2,1,1,0,2,1,1,0,2,3,1,2,1,2,1,1,2,0,1,1,2,1,2,0,2,0,3,2,1,2,1,0,1,2,2,0,3,1,2,3,1,1,2,1,1,2,2,3,1,1,3,2,0,-1,2,0,-1,1,3,3,0,-1,1,2,1,1,2,3,2,6,6,7,7,7,7,6,7,6,6,6,6,2,1,1,1,1,0,1,1,1,1,1,1,0,2,2,1,2,0,0,0,1,1,1,0,2,0,1,2,1,0,2,1,2,0,0,0,0,1,2,1,1,2,1,0,3,1,2,4,1,2,2,2,2,0,2,1,0,1,3,0,1,1,1,1,1,1,0,2,1,1,1,2,2,1,2,1,1,2,1,2,2,2,3,2,1,0,2,0,3,3,buffer,0,0,-1,1,1,0,1,0,-1,0,0,-1,-1,2,-1,0,0,-4,-1,-2,-1,-1,-1,0,0,-1,1,1,-2,0,0,0,-1,0,-1,-1,-2,-1,-1,0,1,0,2,-2,-1,buffer,0,-1,1,1,1,1,buffer,0.2,0,-0.2,-1.4,-0.6,-0.2,-0.4,-1,0,buffer,0,1,0,-0.733333333,-0.466666667,buffer,1,1,0,0,1,0,1.2,0.8,1.2,0.6,1,0.8,1,0.8,1.4,2,1.6,1,1,1,1.6,1.4,2,1.6,buffer,grad_prof,-0.042564413,0.369567588,-0.1461411,-1.630491701,-0.362407407 +432,R_7n6GkzBhH7a69AA,39 - 45,American,Female,Female,Trade School (non-military),42,02PsVPf,01PAST,10,01ITEM,-0.25,0,1,3,3,2,3,1,2,-1,2,-1,1,2,3,3,-2,3,3,3,2,-2,3,3,2,3,1,2,2,2,3,-2,3,3,3,2,-3,1,1,-1,-2,3,-2,-3,-2,2,3,-1,3,3,3,3,-2,-1,-1,1,1,-1,2,2,3,-3,3,-2,-1,2,3,-3,-1,-1,-3,2,-3,0,1,1,-3,0,2,3,1,3,6,8,2,5,2,8,10,4,0,0,0,5,2,1,3,1,2,1,0,1,0,0,0,0,0,0,6,0,1,0,4,4,3,5,5,1,5,4,0,0,1,0,3,3,0,1,2,2,0,1,0,1,0,5,4,0,0,4,3,0,5,3,4,2,2,2,1,3,0,0,0,1,2,2,3,5,2,4,5,4,1,5,4,5,4,1,0,1,0,0,4,1,2,2,1,2,0,3,buffer,0,0,-1,5,-1,-2,3,0,0,-1,0,0,0,-1,0,-5,-4,0,6,-4,-2,0,-1,1,-1,3,3,-1,4,1,-5,-4,-1,1,1,2,3,1,1,2,3,3,-1,5,1,buffer,0,-2,-1,-5,-4,4,buffer,0.6,0,-0.2,-1.4,-0.6,2,-1.6,1.8,2.2,buffer,-1,-1.666666667,0.133333333,3.7E-17,0.8,buffer,1,3,7,6,5,2,1.4,1.6,0.2,1.2,2.4,4,0.8,1.6,0.4,2.6,3,2,0.6,3.2,3.8,2.2,1.4,1.6,buffer,HS_TS,-0.728740176,-1.039543918,0.14245253,-0.23426232,-0.465023471 +433,R_3Vhy7KwpEkDYcIF,39 - 45,American,Male,Male,College Diploma/Certificate,42,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,1,1,1,2,0,-2,-1,0,0,0,0,-2,1,-1,1,0,2,2,0,-1,-3,0,0,0,-2,0,-1,0,-1,1,-1,2,2,0,-1,-3,-1,0,0,-1,0,-1,1,-1,1,1,2,2,2,1,-3,-1,0,0,0,0,-2,1,-1,1,1,1,1,3,1,-3,-1,1,0,0,0,-2,1,-1,1,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,2,1,1,1,0,0,2,0,1,1,0,0,2,1,1,2,1,1,0,0,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,buffer,1,0,0,2,0,0,1,0,0,2,0,1,1,0,0,2,1,1,1,0,0,0,-1,0,1,0,1,0,0,0,1,-1,-1,-1,0,0,1,-1,0,1,0,0,1,0,0,buffer,0,0,0,0,0,0,buffer,0.6,0.6,0.4,1,0,0.2,-0.4,0.2,0.2,buffer,0,0,0.533333333,0.4,0,buffer,0,0,0,0,0,0,1.2,0.8,0.4,1.4,0.4,0.2,0.6,0.2,0,0.4,0.4,0,0.2,0.4,0.2,0.6,0.2,0,buffer,C_Ug,-0.042564413,-0.158849227,1.008233421,0.527317343,0.333534281 +434,R_1dEujNnGaGAwREn,32 - 38,Canadian,Male,Male,College Diploma/Certificate,35,01PfPsV,02FUT,10,01ITEM,0.25,0.333333333,0.666666667,1,2,3,2,3,0,-2,2,-2,1,1,-1,2,-1,0,2,2,2,2,2,-1,-2,2,-1,1,1,-1,2,-1,0,2,2,2,2,2,-1,-2,2,-2,1,1,-1,2,-1,0,2,2,2,2,3,-1,-2,2,-2,1,1,-1,2,-1,0,2,3,3,2,3,-1,-2,3,-2,1,1,-1,2,-1,0,2,2,2,2,2,2,2,2,2,2,2,2,1,0,1,0,1,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,buffer,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,-1,1,0,1,0,0,-1,0,0,0,0,0,0,0,0,-1,-1,0,0,0,0,-1,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0.2,0.2,0,0.2,-0.2,0,-0.4,0,0,buffer,0,0,0.133333333,0,-0.133333333,buffer,0,0,0,0,0,0,0.6,0.4,0,0.6,0.2,0,0.4,0.2,0,0.4,0.4,0,0,0.2,0,0.4,0.2,0,buffer,C_Ug,-0.042564413,-0.158849227,0.14245253,-0.23426232,-0.073305857 +435,R_5QZNQVyCgg6mHxT,32 - 38,Canadian,Male,Male,College Diploma/Certificate,37,02PsVPf,01PAST,5,02DGEN,0.125,0.666666667,0.333333333,2,2,1,-1,1,-1,1,2,0,1,2,1,2,1,2,1,2,1,-1,1,0,-1,2,-1,3,2,1,1,1,2,1,2,-1,-1,0,1,-2,1,0,2,1,0,0,1,2,1,2,1,0,1,-1,0,2,0,1,2,2,2,2,2,1,2,1,0,1,1,0,2,-1,2,2,2,2,2,2,1,3,4,2,6,5,3,4,3,2,4,4,1,0,0,0,0,1,2,0,1,2,0,0,1,0,0,1,0,2,0,1,2,3,1,0,1,1,1,2,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,0,1,0,2,1,0,1,1,0,1,0,1,0,0,0,2,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,buffer,0,0,0,-1,0,1,1,0,1,2,0,-1,1,-1,0,0,0,2,-1,1,0,2,1,-1,0,1,0,2,-1,0,0,0,2,0,1,-1,1,1,0,0,1,1,1,0,0,buffer,-2,-1,1,0,2,1,buffer,-0.2,1,-0.2,0.4,0.4,0.4,0.6,0.2,0.6,buffer,-0.666666667,1,0.2,0.4,0.466666667,buffer,1,3,1,1,0,1,0.2,1.2,0.2,0.8,1.4,0.8,0.4,0.2,0.4,0.4,1,0.4,0.6,1,0.6,0,0.8,0,buffer,C_Ug,-0.500014922,0.369567588,0.286749346,0.527317343,0.170904839 +436,R_3ZBuQ2egixQQH23,39 - 45,American,Female,Female,University - PhD,41,01PfPsV,02FUT,5,01ITEM,0.375,0,1,3,-2,2,-2,3,-1,1,1,-2,0,1,-2,2,-1,1,3,-2,3,-2,2,-2,1,1,-1,0,2,-2,1,-2,-1,2,-2,2,-2,2,-1,0,1,0,2,1,-1,2,-1,0,2,-2,2,1,2,-2,1,2,-1,0,1,-1,2,-2,2,2,-2,2,1,2,-2,1,2,1,0,2,-2,2,-2,2,1,2,3,1,3,3,2,1,1,1,1,1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,2,1,0,0,0,1,0,1,0,2,2,0,1,0,0,1,1,0,0,3,1,1,0,1,1,0,0,1,0,1,1,1,0,0,3,1,1,0,1,3,0,1,0,0,1,1,1,0,1,0,0,1,1,0,1,2,1,1,1,1,1,0,0,0,0,0,0,0,0,2,0,1,1,0,0,0,buffer,-1,0,1,-3,0,0,0,-1,0,0,1,-1,1,0,1,0,0,0,-3,0,-1,1,-1,-1,2,-1,1,0,-1,0,1,0,1,0,0,1,1,0,-1,2,0,0,1,1,1,buffer,-1,1,2,0,2,2,buffer,-0.6,-0.2,0.4,-0.6,0,-0.2,0.4,0.6,0.6,buffer,0.666666667,1.333333333,-0.133333333,-0.266666667,0.533333333,buffer,0,1,0,1,0,0,0.4,0.4,1,0.4,1,0.4,1,0.6,0.6,1,1,0.6,0.4,1,1,0,0.4,0.4,buffer,grad_prof,0.414886095,0.545706526,-0.434734729,-0.741982096,-0.054031051 +437,R_7rwuOH1mNVm1TPa,32 - 38,Canadian,Male,Male,College Diploma/Certificate,32,03VPfPs,02FUT,5,01ITEM,0.25,0,1,2,2,2,1,3,0,3,0,3,0,0,1,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,2,2,2,1,3,0,3,0,3,0,0,1,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,10,0,0,10,10,10,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,buffer,5,-5,-5,5,5,5,buffer,0,0,0.2,0,0,0,0,0,-0.2,buffer,-1.666666667,5,0.066666667,0,-0.066666667,buffer,0,10,10,0,0,0,0,0,0.2,0,0,0.2,0,0,0,0,0,0.2,0,0,0,0,0,0.2,buffer,C_Ug,-1.186190685,2.483234847,-0.001844284,-0.23426232,0.26523439 +438,R_3O7M4ezgQ3BJwY1,25 - 31,Canadian,Female,Female,High School (or equivalent),26,02PsVPf,01PAST,10,01ITEM,1.375,0.333333333,0.666666667,3,3,2,2,0,2,1,2,3,1,3,1,1,2,2,3,3,3,3,0,1,1,1,1,1,3,3,3,3,3,3,3,3,3,0,2,2,2,3,-1,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,1,1,3,2,1,2,2,3,3,1,4,4,3,2,5,3,2,2,3,3,2,0,0,1,1,0,1,0,1,2,0,0,2,2,1,1,0,0,1,1,0,0,1,0,0,2,2,2,2,0,1,0,0,1,1,3,1,2,1,0,2,0,2,2,1,1,0,0,1,1,1,0,0,1,0,1,2,1,1,1,1,0,0,0,0,0,1,1,1,2,2,2,0,0,1,0,0,0,0,0,2,1,2,2,0,1,2,1,1,0,0,buffer,0,0,0,0,-3,0,-2,0,2,-2,0,0,0,0,0,0,0,0,0,-1,0,1,-1,0,1,0,1,1,-1,0,0,0,0,0,-2,0,-1,-1,2,1,0,-1,-1,1,0,buffer,-2,2,2,0,-1,3,buffer,-0.6,-0.4,0,-0.2,0.2,0.2,-0.4,0.2,-0.2,buffer,0.666666667,0.666666667,-0.333333333,0.066666667,-0.133333333,buffer,2,2,1,0,1,0,0.4,0.8,1.2,0.4,0.6,1.4,1,1.2,1.2,0.6,0.4,1.2,0,1.4,0.6,0.4,1.2,0.8,buffer,HS_TS,0.414886095,0.19342865,-0.867625175,-0.107332375,-0.091660701 +439,R_7Cgs4ihCU5s3Qb4,25 - 31,Canadian,Male,Male,University - Undergraduate,30,01PfPsV,02FUT,5,02DGEN,0.375,0,1,1,3,3,1,2,-3,1,-2,3,0,3,3,3,3,-1,3,3,3,3,3,-3,3,3,3,-2,3,-2,3,3,2,3,3,3,3,3,-3,3,-2,2,-2,3,2,3,3,-1,3,3,3,3,3,-3,-2,2,-2,2,3,3,3,-1,1,3,3,3,3,3,1,-3,3,-3,2,3,3,3,-3,3,0,0,0,0,0,5,0,0,0,3,1,1,2,0,0,2,1,0,2,5,0,2,0,5,0,0,3,2,0,0,2,1,0,2,0,1,2,0,1,0,0,0,2,0,0,2,1,0,3,4,5,2,0,0,0,4,2,2,0,0,2,1,4,4,5,6,2,0,0,0,6,4,0,0,0,0,0,0,0,5,1,0,0,4,0,0,3,0,0,0,0,0,4,1,1,1,0,0,0,0,2,2,buffer,0,0,0,0,0,0,-1,1,-5,0,0,5,0,-4,1,0,0,0,0,0,-4,-2,-5,-5,0,0,1,0,-6,-4,0,0,0,0,0,-4,-1,4,0,0,0,4,0,-2,1,buffer,0,0,0,-3,-1,4,buffer,0,-1,0.4,0,-3.2,-1.8,0,-0.2,0.6,buffer,0,0,-0.2,-1.666666667,0.133333333,buffer,0,0,5,3,1,1,1,1.8,1.6,1,1,0.2,1,2.8,1.2,1,4.2,2,0,1.2,1.4,0,1.4,0.8,buffer,C_Ug,-0.042564413,-0.158849227,-0.579031545,-3.407510916,-1.046989025 +440,R_393iU1j0QCD9GDf,39 - 45,American,Male,Male,College Diploma/Certificate,43,02PsVPf,02FUT,5,01ITEM,0.5,0,1,3,3,3,0,3,0,-1,3,-2,-2,3,0,2,0,3,3,3,3,3,3,2,0,0,0,2,3,2,3,3,2,3,3,3,0,3,1,0,1,0,1,3,1,3,3,2,2,2,3,0,3,2,-1,3,-2,2,1,1,-1,1,-1,3,3,3,3,3,2,2,1,0,2,2,1,2,2,2,5,5,7,6,5,5,5,9,8,5,5,5,0,0,0,3,0,2,1,3,2,4,0,2,1,3,1,0,0,0,0,0,1,1,2,2,3,0,1,1,3,1,1,1,0,0,0,2,0,0,0,4,2,1,3,1,4,0,0,0,3,0,2,3,2,2,4,1,1,0,2,1,0,0,0,3,0,1,0,1,0,1,0,1,0,0,0,1,1,0,3,0,0,3,2,2,0,1,0,3,1,3,buffer,-1,-1,0,3,0,0,1,3,2,0,-2,1,-2,2,-3,0,0,0,-3,0,-1,-2,0,0,-1,-1,0,1,1,0,-1,-1,0,0,0,1,-3,-1,-2,1,-1,1,-3,-1,-3,buffer,0,-4,-1,1,0,0,buffer,0.2,1.2,-0.8,-0.6,-0.8,0.2,-0.4,-0.8,-1.4,buffer,-1.666666667,0.333333333,0.2,-0.4,-0.866666667,buffer,1,0,2,0,4,3,0.6,2.4,1.4,0,1.8,1.2,0.4,1.2,2.2,0.6,2.6,1,0.6,0.6,0.2,1,1.4,1.6,buffer,C_Ug,-1.186190685,0.017289712,0.286749346,-0.995841983,-0.469498402 +441,R_6SDeNyxNCfYeKhn,25 - 31,American,Female,Female,University - Undergraduate,30,01PfPsV,01PAST,10,02DGEN,0.75,0,0.666666667,3,2,2,2,1,-2,2,2,0,3,0,0,1,1,1,2,2,1,1,1,-1,-1,1,-2,-1,1,1,0,0,0,2,3,2,1,2,-1,-1,0,0,0,0,1,1,1,1,1,1,2,0,1,0,1,0,0,1,-1,0,0,0,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,1,4,5,4,0,3,3,3,3,2,4,1,1,1,0,1,1,0,1,3,1,2,4,1,1,1,1,1,1,1,0,1,1,1,3,2,0,3,0,1,0,0,0,2,1,0,2,0,2,1,2,0,2,1,0,1,1,0,2,1,1,1,0,2,1,1,0,2,0,0,0,1,0,0,1,1,0,1,0,0,1,2,1,1,0,1,1,1,0,0,1,1,0,0,0,1,0,0,1,0,1,0,0,buffer,-1,-1,1,-1,0,-1,2,-1,2,2,0,1,0,0,1,-1,0,-1,0,1,-1,2,1,0,1,0,1,0,-1,0,0,1,0,-1,1,0,0,0,2,1,0,0,0,1,1,buffer,1,2,2,-4,2,2,buffer,-0.4,0.8,0.4,-0.2,0.6,0,0.2,0.6,0.4,buffer,1.666666667,0,0.266666667,0.133333333,0.4,buffer,4,2,1,1,2,1,0.6,2.2,1,0.8,1.8,0.2,1,1.4,0.6,1,1.2,0.2,0.6,0.8,0.8,0.4,0.2,0.4,buffer,C_Ug,1.101061858,-0.158849227,0.431046162,0.019597567,0.34821409 +442,R_3KZv5xSxkACcuo4,39 - 45,American,Male,Male,High School (or equivalent),43,03VPfPs,01PAST,10,01ITEM,0.125,0.333333333,0.666666667,0,2,2,1,3,0,1,2,-2,2,1,-1,3,0,3,0,2,3,1,3,0,1,3,-3,3,1,-2,3,0,3,0,2,3,1,3,0,0,2,-3,3,0,-3,3,0,3,0,2,3,2,3,0,1,3,-3,3,1,-2,3,0,3,1,2,3,2,3,0,1,3,-3,3,1,-2,3,0,3,0,0,0,2,1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,1,1,2,0,0,0,0,0,1,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1,1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,1,-1,0,0,1,1,0,0,0,-1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,buffer,0,0,0,1,0,1,buffer,-0.2,0,0,-0.4,0,0.4,-0.2,0.4,0.4,buffer,0,0.666666667,-0.066666667,0,0.2,buffer,2,1,1,1,1,0,0.2,0.6,0.2,0.2,0.6,0.6,0.4,0.6,0.2,0.6,0.6,0.2,0,0.4,0.4,0.2,0,0,buffer,HS_TS,-0.042564413,0.19342865,-0.290437916,-0.23426232,-0.093459 +443,R_1fDdcEyuCuBMSWX,18 - 24,Canadian,Female,Female,High School (or equivalent),22,01PfPsV,02FUT,5,02DGEN,0.125,0,1,1,3,2,3,3,2,1,3,1,2,2,1,3,1,2,3,3,3,2,2,-2,2,1,2,-1,2,1,1,2,2,3,2,2,-1,1,-3,2,-1,3,-3,2,1,2,-1,2,2,3,2,3,3,2,-1,3,-2,3,2,1,3,-2,2,3,3,2,2,3,2,-2,3,-3,3,2,1,3,-2,2,7,6,5,8,10,7,5,5,5,5,5,5,2,0,1,1,1,4,1,2,1,3,0,0,2,1,0,2,1,0,4,2,5,1,4,2,5,0,0,1,2,0,1,0,0,0,0,0,2,0,3,1,0,0,0,3,0,2,0,0,1,0,0,3,0,4,1,0,0,0,3,0,0,1,1,3,1,1,0,2,1,2,0,0,1,3,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,buffer,1,0,1,1,1,4,-1,2,-2,2,0,0,2,-2,0,0,1,0,3,2,5,-2,4,-2,4,0,0,1,-1,0,-1,1,1,2,1,1,-1,2,0,2,0,0,1,3,0,buffer,2,1,0,3,5,2,buffer,0.8,1,0,1.2,1.8,0,0.8,0.8,0.8,buffer,1,3.333333333,0.6,1,0.8,buffer,1,4,2,0,0,0,1,2.2,0.6,1.8,3.4,0.6,0.2,1.2,0.6,0.6,1.6,0.6,1.2,1.2,0.8,0.4,0.4,0,buffer,HS_TS,0.643611349,1.602540156,1.152530237,1.669686838,1.267092145 +444,R_1HS3RkBX2radTK9,25 - 31,American,Female,Female,College Diploma/Certificate,26,03VPfPs,01PAST,5,01ITEM,1.5,0,0.666666667,3,2,2,3,3,3,2,3,2,3,3,2,3,2,3,3,2,3,2,3,3,2,3,3,2,3,3,2,3,3,2,2,3,3,3,3,2,3,3,2,1,1,3,1,2,3,2,3,3,3,3,2,3,2,3,2,3,3,2,3,2,3,3,3,3,3,3,3,2,2,3,2,3,2,3,7,8,6,8,8,8,9,9,9,9,8,8,0,0,1,1,0,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,0,1,1,2,1,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,2,2,1,2,1,1,1,0,0,0,0,1,0,0,1,1,1,0,0,0,buffer,0,0,0,1,0,0,0,0,1,1,-1,0,1,1,0,0,-1,0,0,0,0,-1,0,1,0,2,1,0,1,1,0,-1,0,1,0,0,-1,0,0,-1,1,1,1,2,1,buffer,-2,-1,-3,-1,0,0,buffer,0.2,0.4,0.2,-0.2,0,1,0,-0.4,1.2,buffer,-2,-0.333333333,0.266666667,0.266666667,0.266666667,buffer,1,0,2,0,1,1,0.4,0.4,0.6,0.4,0.4,1,0.2,0,0.4,0.6,0.4,0,0.4,0,1.6,0.4,0.4,0.4,buffer,C_Ug,-1.414915939,-0.334988165,0.431046162,0.273457456,-0.261350121 +445,R_3q4O7ntpabecbYC,39 - 45,American,Male,Male,University - Graduate (Masters),43,02PsVPf,02FUT,10,02DGEN,1.25,1,0,3,2,2,0,3,3,2,2,3,2,3,2,3,3,3,2,3,1,0,2,1,2,3,2,1,3,1,3,2,1,1,1,3,3,2,3,2,2,2,1,2,1,3,1,3,1,2,2,0,3,1,1,2,1,2,1,2,2,1,1,3,1,2,2,1,2,1,1,1,2,1,1,2,2,1,8,8,8,8,8,8,8,8,7,8,8,8,1,1,1,0,1,2,0,1,1,1,0,1,0,1,2,2,1,1,3,1,0,0,0,1,1,1,1,0,2,0,2,0,0,0,0,2,1,0,2,0,2,0,1,2,2,0,1,0,2,2,1,1,1,2,0,2,1,1,1,2,1,2,2,3,0,2,0,1,0,0,1,0,0,1,2,2,1,0,2,2,1,0,1,0,0,0,1,0,1,0,buffer,-1,1,1,0,1,0,-1,1,-1,1,-2,1,-1,-1,0,2,0,1,1,-1,-1,-1,-1,-1,1,-1,0,-1,1,-2,-1,1,2,1,-2,1,0,0,0,0,1,-1,0,0,2,buffer,0,0,1,0,0,0,buffer,0.4,0,-0.6,0.6,-0.6,-0.6,0.2,0.2,0.4,buffer,0.333333333,0,-0.066666667,-0.2,0.266666667,buffer,0,0,0,0,0,1,0.8,1,0.8,1.6,0.4,0.8,0.4,1,1.4,1,1,1.4,1.6,0.6,0.8,1.4,0.4,0.4,buffer,grad_prof,0.186160841,-0.158849227,-0.290437916,-0.615052151,-0.219544613 +446,R_65Kt0rAQIbvU7zf,25 - 31,American,Female,Female,High School (or equivalent),31,02PsVPf,01PAST,10,01ITEM,-0.125,1,0,1,0,0,0,1,-2,0,-2,0,1,0,0,1,0,0,1,-1,0,0,0,-1,0,-1,0,1,0,0,1,0,0,1,-2,0,0,0,-2,1,-1,1,1,0,-1,1,0,0,1,0,0,0,1,-1,-1,1,-1,1,0,0,1,0,0,1,0,0,0,1,-1,-1,1,-1,1,0,0,1,0,0,2,2,1,4,3,4,3,2,3,4,3,3,0,1,0,0,1,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,1,0,0,1,0,-1,-2,-1,0,0,0,0,0,0,0,2,0,0,1,-1,0,-2,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0,0,buffer,-1,0,-2,0,0,1,buffer,0.4,-0.8,0,0.6,-0.6,0.2,0.2,0.6,0.2,buffer,-1,0.333333333,-0.133333333,0.066666667,0.333333333,buffer,2,1,3,1,1,0,0.4,0.4,0,0.6,0.6,0.2,0,1.2,0,0,1.2,0,0.2,0.6,0.2,0,0,0,buffer,HS_TS,-0.728740176,0.017289712,-0.434734729,-0.107332375,-0.313379392 +447,R_5TKPR1LQb8tEprm,32 - 38,American,Female,Female,University - Undergraduate,37,01PfPsV,02FUT,5,01ITEM,0.25,0,1,3,3,2,3,1,1,-2,2,-2,2,1,2,3,0,3,2,2,1,2,0,1,-2,1,-1,0,2,2,2,1,2,2,2,0,2,0,2,-1,0,-1,0,0,0,2,2,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,0,2,2,2,1,2,2,1,0,2,0,2,2,2,2,0,2,2,2,1,1,2,3,0,0,0,1,3,0,1,1,1,1,1,0,0,1,1,2,1,0,1,1,1,1,1,2,1,1,1,1,2,1,2,1,2,1,2,1,1,1,0,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,0,2,0,2,0,1,0,1,0,1,0,0,1,0,0,1,1,1,0,0,2,2,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,buffer,0,0,1,0,0,-1,-1,1,0,2,0,0,0,1,0,0,0,1,0,0,1,-1,2,-1,2,0,2,0,2,0,0,0,0,0,0,0,0,1,-1,0,2,2,0,1,0,buffer,2,2,1,0,-1,3,buffer,0.2,0.2,0.2,0.2,0.6,0.8,0,0,1,buffer,1.666666667,0.666666667,0.2,0.533333333,0.333333333,buffer,1,0,2,1,3,0,1,0.8,0.8,1.2,1.4,1.4,0.8,0.6,0.6,1,0.8,0.6,0.2,0.6,1,0.2,0.6,0,buffer,C_Ug,1.101061858,0.19342865,0.286749346,0.78117723,0.590604271 +448,R_6EIajlGyiZ4iK9r,32 - 38,American,Male,Male,College Diploma/Certificate,34,03VPfPs,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,1,2,2,1,2,-2,1,3,2,0,2,-1,0,1,0,0,2,2,3,-1,1,1,2,2,1,3,1,0,2,1,1,2,2,2,-2,1,1,2,2,1,2,1,-1,2,1,1,2,2,2,2,-2,1,3,2,-2,2,0,1,-1,0,1,2,2,2,2,-2,2,2,2,-2,2,0,0,1,0,2,1,2,3,2,2,2,2,2,2,2,2,1,0,0,2,3,3,0,1,0,1,1,2,0,1,1,0,0,0,1,4,3,0,1,0,1,0,2,1,1,1,0,0,0,1,0,0,0,0,0,2,0,1,1,2,0,0,0,0,1,0,0,1,1,0,2,0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,2,0,buffer,1,0,0,1,3,3,0,1,0,-1,1,1,-1,-1,1,0,0,0,0,4,3,-1,0,0,-1,0,1,1,1,1,1,0,0,1,1,0,-1,-1,0,0,1,0,0,-2,0,buffer,0,-1,0,1,0,0,buffer,1,0.6,0.2,0.8,0.2,0.8,0.6,-0.4,-0.2,buffer,-0.333333333,0.333333333,0.6,0.6,-1.85E-17,buffer,1,1,0,0,0,0,1.2,1,1,1,1,1,0.2,0.4,0.8,0.2,0.8,0.2,0.6,0,0.4,0,0.4,0.6,buffer,C_Ug,-0.271289667,0.017289712,1.152530237,0.908107175,0.451659364 +449,R_6MuhwCW9iWSWXXF,18 - 24,American,Male,Male,College Diploma/Certificate,18,02PsVPf,01PAST,5,01ITEM,-0.5,0.333333333,0.666666667,-1,3,1,1,2,-1,-2,2,2,1,-2,-3,2,-1,2,-2,1,2,-1,-1,1,-1,-1,3,-1,-1,-2,1,-1,3,-1,1,1,3,3,1,-1,-1,-2,1,1,-1,2,-1,2,1,3,2,2,3,-3,-2,-2,-2,-1,-1,-2,1,1,2,-1,3,2,1,1,2,-3,3,1,1,1,2,1,2,-1,4,8,4,5,9,7,5,7,3,3,6,6,1,2,1,2,3,2,1,3,1,2,1,1,1,0,1,0,2,0,2,1,2,1,3,4,0,3,2,0,0,0,2,0,1,1,1,2,0,4,4,2,1,1,1,2,0,0,0,1,0,1,3,1,1,1,0,3,5,1,3,3,1,0,1,4,4,0,0,0,5,2,2,1,1,0,1,2,0,0,1,2,5,1,5,3,2,2,4,0,1,3,buffer,-1,2,0,1,2,0,1,-1,-3,0,0,0,0,-2,1,0,2,-1,2,0,-1,0,2,3,0,0,-3,-1,-3,-3,-1,0,1,3,2,-5,-1,-5,2,0,0,-3,1,-1,-2,buffer,-1,1,1,2,3,1,buffer,0.8,-0.6,-0.2,0.6,0.8,-2,1,-1.8,-1,buffer,0.333333333,2,1.85E-17,-0.2,-0.6,buffer,1,1,3,2,1,3,1.8,1.8,0.8,1,2,1,1,2.4,1,0.4,1.2,3,2,1.4,1,1,3.2,2,buffer,C_Ug,0.186160841,0.897984403,-0.1461411,-0.615052151,0.080737998 +450,R_5QSPfbfURz0smCQ,25 - 31,Canadian,Male,Male,High School (or equivalent),28,02PsVPf,02FUT,10,02DGEN,0,0.333333333,0.666666667,3,3,3,3,3,-2,1,1,0,3,1,-3,3,-2,3,-1,0,3,3,-1,-2,1,-1,1,-1,1,-2,3,-2,1,-3,-3,3,3,-3,-3,3,-3,3,-1,2,1,3,3,-2,3,3,3,3,3,0,-3,0,0,3,1,-3,3,-2,3,3,3,3,3,3,1,-3,0,0,0,1,-3,3,-3,3,4,3,2,4,10,10,3,4,2,5,8,1,4,3,0,0,4,0,0,2,1,4,0,1,0,0,2,6,6,0,0,6,1,2,4,3,4,1,4,0,5,5,0,0,0,0,0,2,4,1,0,0,0,0,0,0,0,0,0,0,0,0,3,4,1,0,3,0,0,0,1,0,2,3,0,0,2,1,2,2,2,0,1,3,0,5,3,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,buffer,4,3,0,0,4,-2,-4,1,1,4,0,1,0,0,2,6,6,0,0,6,-2,-2,3,3,1,1,4,0,4,5,2,3,0,0,2,0,2,2,2,-3,1,3,0,4,3,buffer,1,-1,0,-1,2,9,buffer,2.2,0,0.6,3.6,0.6,2.8,1.4,0.6,2.2,buffer,0,3.333333333,0.933333333,2.333333333,1.4,buffer,0,7,8,2,4,1,2.2,1.4,0.6,3.6,2.8,3,0,1.4,0,0,2.2,0.2,1.4,1.4,2.4,0,0.8,0.2,buffer,HS_TS,-0.042564413,1.602540156,1.874014312,4.208285714,1.910568942 +451,R_3Y68hrqHAAuTrqX,18 - 24,Canadian,Female,Female,University - Undergraduate,21,01PfPsV,01PAST,10,02DGEN,-0.25,1,0,1,2,2,2,2,0,0,1,1,1,2,3,2,2,3,1,-2,0,1,1,0,-1,1,1,0,1,2,0,1,0,-1,1,2,-1,-1,-2,1,-1,-2,-2,1,-1,0,-1,2,2,2,1,2,2,2,2,2,3,3,3,2,3,3,3,2,2,2,2,2,1,1,1,2,1,2,2,2,2,2,6,4,5,7,8,6,1,1,1,4,4,3,0,4,2,1,1,0,1,0,0,1,1,1,2,1,3,2,1,0,3,3,2,1,2,3,3,1,4,2,3,1,1,0,1,0,0,2,2,1,2,2,1,1,1,1,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,2,3,2,2,2,2,2,2,3,2,0,3,0,2,2,0,0,1,0,0,1,1,1,1,2,1,0,1,1,1,buffer,-1,4,1,1,1,-2,-1,-1,-2,-1,0,0,1,0,3,1,1,0,3,3,1,0,2,2,3,1,3,2,3,0,2,3,1,2,2,1,1,1,2,0,-1,3,-1,1,1,buffer,5,3,4,3,4,3,buffer,1.2,-1.4,0.8,1.6,1.6,1.8,2,1,0.6,buffer,4,3.333333333,0.2,1.666666667,1.2,buffer,1,4,1,3,3,2,1.6,0.4,1.6,1.8,2.2,2.2,0.4,1.8,0.8,0.2,0.6,0.4,2.2,2.2,1.4,0.2,1.2,0.8,buffer,C_Ug,2.702138637,1.602540156,0.286749346,2.938986277,1.882603604 +452,R_3TCvDY1EpCYF1vj,25 - 31,American,Male,Male,Professional Degree (ex. JD/MD),25,01PfPsV,02FUT,5,01ITEM,1.5,0.333333333,0.666666667,3,3,1,2,2,1,3,1,0,2,3,2,2,3,1,2,2,3,3,3,2,1,2,1,3,2,3,2,1,3,3,3,3,2,2,2,3,3,1,2,2,3,3,3,2,3,3,2,3,2,3,0,2,-1,3,3,2,3,2,3,2,1,3,3,2,3,2,3,1,3,2,2,1,3,1,9,8,9,9,8,9,8,9,9,9,9,9,1,1,2,1,1,1,2,1,1,1,1,1,0,2,2,0,0,2,0,0,1,0,2,1,0,1,1,1,0,1,0,0,1,1,0,2,3,1,1,1,0,0,1,1,2,1,2,2,1,0,2,1,2,1,1,1,0,1,0,0,1,1,0,1,1,0,2,1,0,1,0,0,1,2,1,1,2,1,0,0,0,2,1,2,0,1,0,2,1,2,buffer,1,1,1,0,1,-1,-1,0,0,0,1,1,-1,1,0,-1,-2,0,-1,0,-1,-1,0,0,-1,0,1,0,0,1,0,-1,-1,1,1,0,0,0,-2,1,-1,0,-1,1,-1,buffer,1,-1,0,0,-1,0,buffer,0.8,-0.4,0.4,-0.8,-0.6,0.4,0,-0.2,-0.4,buffer,0,-0.333333333,0.266666667,-0.333333333,-0.2,buffer,0,0,0,1,0,0,1.2,1.2,1.2,0.4,0.8,0.8,0.4,1.6,0.8,1.2,1.4,0.4,0.8,0.8,0.8,0.8,1,1.2,buffer,grad_prof,-0.042564413,-0.334988165,0.431046162,-0.868912038,-0.203854614 +453,R_6FCEd81BVKHY6dS,32 - 38,Canadian,Male,Male,Trade School (non-military),34,03VPfPs,02FUT,5,01ITEM,0.75,1,0,2,3,1,1,0,-3,1,-2,2,-2,-1,1,3,1,2,2,3,1,-2,0,-2,0,-3,1,0,-1,2,1,2,1,2,3,1,-2,1,0,-1,1,-1,1,1,2,1,2,2,2,3,1,2,0,-2,0,1,0,0,-1,1,3,2,2,2,3,1,2,0,0,-1,2,0,0,0,1,3,2,3,2,2,5,6,7,6,1,5,2,0,4,3,0,0,0,3,0,1,1,1,1,2,0,1,2,1,1,0,0,0,3,1,3,2,3,3,3,2,1,2,1,0,0,0,0,1,0,1,1,3,2,2,0,0,0,1,0,0,0,0,1,0,3,2,4,2,2,1,0,0,1,1,0,0,0,0,1,2,1,4,2,1,2,0,0,0,1,0,0,0,0,0,2,1,1,0,0,1,0,0,0,1,buffer,0,0,0,2,0,0,0,-2,-1,0,0,1,2,0,1,0,0,0,2,1,0,0,-1,1,1,1,1,2,0,-1,0,0,0,0,1,0,0,3,2,1,1,0,0,0,0,buffer,1,-3,3,6,3,3,buffer,0.4,-0.6,0.8,0.6,0.2,0.6,0.2,1.2,0.2,buffer,0.333333333,4,0.2,0.466666667,0.533333333,buffer,4,5,1,1,1,1,0.6,1.2,1,0.8,2.8,1.2,0.2,1.8,0.2,0.2,2.6,0.6,0.2,2,0.6,0,0.8,0.4,buffer,HS_TS,0.186160841,1.954818032,0.286749346,0.654247288,0.770493877 +454,R_1iaMazG0aOQQ0zT,25 - 31,Canadian,Male,Male,University - Undergraduate,25,02PsVPf,02FUT,5,01ITEM,0.625,0.666666667,0.333333333,-1,1,2,1,1,1,1,0,-1,2,1,0,0,1,-1,1,0,3,1,1,0,1,1,0,3,3,0,0,1,1,-1,2,0,1,1,0,-1,2,-1,1,-1,2,0,0,1,2,1,0,0,1,1,-1,1,0,1,1,1,-1,1,0,1,0,3,1,0,-1,1,1,0,2,1,-1,0,1,2,7,6,6,7,6,7,6,8,6,5,6,6,2,1,1,0,0,1,0,1,1,1,2,0,0,0,2,0,1,2,0,0,1,2,2,0,1,2,2,0,1,2,3,0,2,1,0,0,2,1,1,1,0,1,1,0,1,2,1,1,0,1,2,0,1,1,0,0,1,0,0,3,2,2,3,0,0,0,2,1,1,2,4,2,0,1,0,1,1,3,1,1,2,2,0,0,1,0,2,1,0,2,buffer,-1,1,-1,-1,0,1,-2,0,0,0,2,-1,-1,0,1,-2,0,1,0,-1,-1,2,1,-1,1,2,1,0,1,-1,1,1,0,-1,-1,-2,0,1,1,1,4,0,-1,1,-2,buffer,1,-2,0,2,0,1,buffer,-0.4,-0.2,0.2,-0.4,0.4,0.6,0,0.2,0.4,buffer,-0.333333333,1,-0.133333333,0.2,0.2,buffer,0,0,1,1,2,0,0.8,0.8,0.8,0.6,1.2,1.4,1.2,1,0.6,1,0.8,0.8,1.4,1.2,1.4,1.4,1,1,buffer,C_Ug,-0.271289667,0.369567588,-0.434734729,0.146527512,-0.047482324 +455,R_7tsUaAquS2msejC,18 - 24,Canadian,Male,Male,High School (or equivalent),23,01PfPsV,01PAST,10,02DGEN,0.125,0,1,3,3,3,3,3,-1,2,1,0,2,-2,2,2,-1,1,2,2,2,2,2,-2,2,-1,1,2,3,1,3,1,-1,1,3,3,3,-1,-2,2,1,0,2,1,-2,3,2,-2,3,3,3,3,3,1,-1,3,-1,3,3,3,3,-1,2,3,3,3,3,3,0,2,2,-1,2,2,2,2,-1,2,1,1,9,9,1,6,0,1,0,0,0,0,1,1,1,1,1,1,0,2,1,0,5,1,1,2,2,2,0,0,0,4,1,0,0,0,0,3,4,1,3,3,0,0,0,0,0,2,3,2,1,1,5,1,1,0,1,0,0,0,0,0,1,0,1,1,0,4,0,0,0,1,1,1,1,1,3,0,0,2,1,0,2,3,0,1,1,0,0,0,0,0,1,3,1,0,1,1,1,1,0,0,buffer,1,1,1,1,1,-1,-3,0,0,-1,0,0,0,2,1,2,0,0,0,4,0,0,-1,-1,0,-1,4,1,3,2,1,1,1,1,3,-1,-3,1,1,-1,1,2,-1,1,1,buffer,1,0,9,9,1,6,buffer,1,-1,0.6,1.2,-0.4,1.8,1.4,-0.6,0.8,buffer,3.333333333,5.333333333,0.2,0.866666667,0.533333333,buffer,8,0,3,0,1,0,1,0.8,2.2,1.2,0.2,2.8,0,1.8,1.6,0,0.6,1,1.4,0.6,1.4,0,1.2,0.6,buffer,HS_TS,2.244688128,2.659373785,0.286749346,1.415826951,1.651659553 +456,R_7q3JYGkRcevsasx,32 - 38,Canadian,Male,Male,University - Undergraduate,33,02PsVPf,01PAST,5,01ITEM,0.375,0.333333333,0.666666667,-2,3,3,3,3,3,-2,3,-3,3,1,1,3,1,2,-3,3,3,3,3,3,-1,3,-2,3,1,3,2,3,2,-3,3,3,3,3,3,1,3,0,3,1,2,1,3,2,0,3,3,3,3,3,-2,3,-3,3,3,0,3,0,3,0,3,3,3,3,3,-3,3,-3,3,3,0,3,0,3,0,0,2,0,4,5,3,2,4,2,2,3,1,0,0,0,0,0,1,0,1,0,0,2,1,2,0,1,0,0,0,0,0,3,0,3,0,0,1,2,2,0,2,0,0,0,0,0,0,0,0,0,2,1,0,1,1,2,0,0,0,0,0,1,0,0,0,2,1,0,1,1,0,0,0,0,0,0,2,0,2,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,buffer,-1,0,0,0,0,0,1,0,1,0,-2,1,1,1,-1,-1,0,0,0,0,0,2,0,3,0,-2,0,2,1,-1,0,0,0,0,0,0,1,0,2,0,0,1,1,0,0,buffer,-3,-2,-2,-2,2,2,buffer,-0.2,0.4,0,-0.2,1,0,0,0.6,0.4,buffer,-2.333333333,0.666666667,0.066666667,0.266666667,0.333333333,buffer,0,4,3,1,0,1,0.2,0.4,1,0.2,1.2,1,0.4,0,1,0.4,0.2,1,0,0.8,0.4,0,0.2,0,buffer,C_Ug,-1.643641192,0.19342865,-0.001844284,0.273457456,-0.294649842 +457,R_7En1jXCmIuFVRwZ,32 - 38,Canadian,Female,Female,University - Graduate (Masters),34,01PfPsV,02FUT,5,02DGEN,-0.25,0.666666667,0.333333333,2,2,3,3,2,0,1,0,1,0,-1,-2,2,0,2,-1,2,2,2,1,1,0,0,1,0,-2,-2,2,1,2,-2,2,2,2,2,2,1,-1,1,0,-1,-2,2,2,2,2,2,2,2,2,0,1,2,1,0,-1,-2,2,0,2,2,2,2,2,2,0,2,0,1,0,-1,-2,2,0,2,4,3,2,3,4,2,2,2,2,2,2,1,3,0,1,1,1,1,1,0,0,0,1,0,0,1,0,4,0,1,1,0,2,0,1,0,0,0,0,0,2,0,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,buffer,3,0,0,0,1,1,1,-2,0,0,1,0,0,1,0,4,0,0,0,0,2,-1,1,0,0,0,0,0,2,0,1,0,0,0,1,1,0,-1,0,0,1,0,0,1,0,buffer,2,1,0,1,2,1,buffer,0.8,0,0.4,0.8,0.4,0.4,0.4,0,0.4,buffer,1,1.333333333,0.4,0.533333333,0.266666667,buffer,1,1,0,0,0,1,1.2,0.4,0.4,1.2,0.6,0.4,0.4,0.4,0,0.4,0.2,0,0.4,0.6,0.4,0,0.6,0,buffer,grad_prof,0.643611349,0.545706526,0.719639792,0.78117723,0.672533724 +458,R_3fiskxHGaD0cLA4,18 - 24,Canadian,Female,Female,University - Undergraduate,24,03VPfPs,01PAST,10,01ITEM,0.375,0,1,3,3,1,-1,3,2,2,3,1,3,2,1,3,0,2,-1,3,1,-2,2,3,-2,1,-2,1,-1,-2,2,1,3,1,3,3,2,2,-2,-2,-2,3,-2,3,-2,-2,-3,3,3,3,1,2,3,2,2,3,-1,2,2,1,3,-2,1,3,3,1,2,3,1,3,3,-2,2,2,1,3,-1,2,7,6,7,2,10,8,2,3,5,1,3,1,4,0,0,1,1,1,4,2,3,2,3,3,1,1,1,2,0,2,3,1,4,4,5,2,5,1,3,5,3,1,0,0,0,3,0,0,0,0,2,1,0,0,0,2,1,0,0,0,3,0,1,1,0,3,1,0,0,0,1,0,2,0,2,4,0,5,0,3,5,3,4,0,4,4,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,1,buffer,4,0,0,-2,1,1,4,2,1,1,3,3,1,-1,0,2,0,2,0,1,3,3,5,-1,4,1,3,5,2,1,2,0,2,4,0,4,-1,3,4,3,4,0,4,3,-1,buffer,5,3,2,1,7,7,buffer,0.6,1.8,1.2,1,2.8,2.4,1.6,2.6,2,buffer,3.333333333,5,1.2,2.066666667,2.066666667,buffer,5,4,1,1,0,4,1.2,2.4,1.8,1.6,4,2.6,0.6,0.6,0.6,0.6,1.2,0.2,1.6,3.2,2.4,0,0.6,0.4,buffer,C_Ug,2.244688128,2.483234847,2.451201574,3.70056594,2.719922622 +459,R_1GdjKBldvnVvqVT,32 - 38,Canadian,Female,Female,University - Undergraduate,32,03VPfPs,01PAST,5,01ITEM,0.125,0,0.666666667,3,3,2,-1,3,-3,-1,2,0,1,2,-3,3,-2,2,3,3,2,-1,3,-3,-2,2,-2,1,2,-3,3,1,2,3,3,2,-1,3,-3,-2,2,0,1,2,-3,2,2,2,3,3,2,-1,3,-3,-2,2,0,1,2,-3,3,-3,2,3,3,2,-1,3,-3,-1,2,-1,2,2,-3,3,-3,2,0,4,7,2,4,3,0,1,1,1,2,1,0,0,0,0,0,0,1,0,2,0,0,0,0,3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,4,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,1,0,-1,-1,0,0,1,3,0,0,0,0,0,0,0,-1,0,1,-1,0,0,1,1,0,buffer,0,3,6,1,2,2,buffer,0,0.4,0.4,0,-0.2,0.8,0,-0.2,0.4,buffer,3,1.666666667,0.266666667,0.2,0.066666667,buffer,2,0,4,1,1,0,0,0.6,0.6,0,0.2,1,0,0.2,0.2,0,0.4,0.2,0,0.4,0.4,0,0.6,0,buffer,C_Ug,2.015962874,0.721845465,0.431046162,0.146527512,0.828845503 +460,R_5dEb03CEck0NP30,18 - 24,Canadian,Female,Female,College Diploma/Certificate,23,01PfPsV,02FUT,10,01ITEM,0.5,0.666666667,0.333333333,2,3,-1,0,3,1,0,1,-2,3,-2,-2,3,-1,2,-2,2,2,2,1,1,2,-2,0,2,-1,-1,2,1,0,-2,3,3,2,2,-1,2,-1,-1,-1,2,2,1,0,2,3,2,-1,-1,3,2,-1,2,-2,3,-2,-1,3,-2,2,3,2,0,-2,3,2,-1,3,-2,3,-1,0,3,-2,2,7,7,3,8,9,7,2,3,6,4,3,7,4,1,3,2,2,0,2,3,2,1,1,1,1,2,2,4,0,4,2,1,2,2,2,1,4,4,4,2,1,0,1,1,0,1,0,1,1,1,0,0,0,1,0,1,0,1,1,1,2,0,1,1,2,0,0,1,2,0,1,0,0,1,1,0,1,2,0,1,1,3,3,3,1,1,2,0,0,1,1,0,0,0,1,0,0,1,1,0,0,0,buffer,3,0,3,1,2,-1,1,2,2,1,1,0,1,1,2,3,-1,3,0,1,1,1,0,1,4,3,2,2,0,0,0,1,0,-1,1,2,0,0,1,3,2,2,1,1,2,buffer,5,4,-3,4,6,0,buffer,1.8,1,1,1.2,1.4,1.4,0.2,1.2,1.6,buffer,2,3.333333333,1.266666667,1.333333333,1,buffer,1,2,4,2,0,1,2.4,1.6,1.4,2.2,2.2,2.2,0.6,0.6,0.4,1,0.8,0.8,0.6,1.4,2,0.4,0.2,0.4,buffer,C_Ug,1.329787112,1.602540156,2.59549839,2.304336557,1.958040553 +461,R_51nsU96cLButl1m,32 - 38,Canadian,Female,Female,University - Graduate (Masters),34,02PsVPf,01PAST,10,01ITEM,1.5,0.333333333,0.333333333,1,1,2,3,1,3,2,3,2,0,1,2,1,1,2,1,0,0,0,1,0,0,1,1,0,0,0,1,1,0,1,2,2,2,1,1,2,0,1,1,2,0,1,1,0,2,1,2,1,3,1,1,0,0,0,1,2,0,0,0,1,2,0,1,0,0,0,2,0,1,0,1,0,0,0,9,9,8,6,7,9,8,9,8,6,7,8,0,1,2,3,0,3,2,2,1,0,1,2,0,0,2,0,1,0,1,0,2,0,3,1,1,1,2,0,0,2,1,0,0,2,2,2,1,3,2,0,0,0,1,1,2,0,1,2,2,1,3,2,1,2,1,1,1,1,1,2,0,2,2,2,0,1,2,1,0,1,2,0,0,0,0,1,1,2,0,3,1,1,2,0,1,1,1,0,0,0,buffer,-1,1,2,1,-2,1,1,-1,-1,0,1,2,-1,-1,0,0,0,-2,-1,-1,-1,-2,2,-1,0,0,1,-1,-1,0,-1,1,0,2,-3,0,1,-1,0,0,1,-1,0,0,0,buffer,1,0,0,0,0,1,buffer,0.2,0,0.2,-0.8,-0.4,-0.2,-0.2,0,0,buffer,0.333333333,0.333333333,0.133333333,-0.466666667,-0.066666667,buffer,3,2,1,2,2,0,1.2,1.6,1,0.4,1.4,1,1,1.6,0.8,1.2,1.8,1.2,1.2,1,0.4,1.4,1,0.4,buffer,grad_prof,0.186160841,0.017289712,0.14245253,-1.122771927,-0.194217211 +462,R_6CKpghIA6EKH3Lw,32 - 38,Canadian,Female,Female,University - Undergraduate,34,01PfPsV,02FUT,5,02DGEN,0,0,1,2,3,-1,-3,3,-1,1,3,1,3,-1,-3,3,1,3,2,3,3,-3,2,-2,1,3,3,3,3,-3,3,0,3,-1,1,3,2,1,-3,-2,3,2,2,3,3,3,3,3,3,3,1,3,3,2,-3,3,-3,-1,1,-3,1,2,3,3,2,0,3,2,1,0,2,1,2,-3,-3,3,2,3,5,5,0,6,7,2,5,6,7,7,6,0,0,0,4,0,1,1,0,0,2,0,4,0,0,1,0,3,2,4,5,2,2,3,0,1,1,4,6,0,2,0,1,0,2,6,0,3,4,0,4,4,2,0,2,1,0,1,1,1,6,1,2,1,1,0,1,2,0,0,1,0,3,2,0,5,1,1,3,0,1,1,0,6,0,3,0,0,1,1,0,1,1,3,1,4,3,4,0,2,0,0,buffer,-1,0,2,-6,1,-2,-4,0,-2,-4,2,0,-2,0,0,2,1,3,-1,1,0,2,-1,1,0,2,6,0,1,0,3,1,-1,5,0,0,0,-1,-3,-2,-4,6,-2,3,0,buffer,0,-1,-7,-1,1,2,buffer,-0.8,-2.4,0,1.2,0.4,1.8,1.6,-1.2,0.6,buffer,-2.666666667,0.666666667,-1.066666667,1.133333333,0.333333333,buffer,1,2,2,2,0,7,1,0.6,1,3.2,1.4,2.4,1.8,3,1,2,1,0.6,2.2,1.2,1.8,0.6,2.4,1.2,buffer,C_Ug,-1.872366447,0.19342865,-2.454890143,1.923546725,-0.552570304 +463,R_5zIy4nKnA1GRUeI,18 - 24,Canadian,Male,Male,High School (or equivalent),18,03VPfPs,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,3,3,3,2,2,1,0,2,1,2,2,2,2,1,2,0,2,1,1,2,-2,-1,0,0,1,3,1,0,2,2,1,0,3,1,2,2,1,0,-2,3,3,1,0,2,1,3,2,2,2,3,3,-1,3,-1,3,1,2,3,0,2,2,2,2,2,1,3,-2,3,0,2,2,3,3,-2,2,8,9,8,8,8,8,8,9,9,7,9,9,3,1,2,1,0,3,1,2,1,1,1,1,2,1,0,2,3,0,1,0,1,1,2,3,1,1,1,2,1,1,0,1,1,0,1,2,1,1,2,1,1,0,1,1,0,1,1,1,0,1,2,2,1,1,0,0,1,1,3,0,1,2,2,0,0,4,2,0,2,2,0,0,0,0,1,1,0,0,0,2,0,1,0,1,1,1,1,0,2,0,buffer,3,0,1,1,-1,1,0,1,-1,0,0,1,1,0,0,1,2,-1,1,-1,-1,-1,1,2,1,1,0,1,-2,1,0,2,2,0,-2,4,1,0,1,1,-1,-1,0,-2,1,buffer,0,0,-1,1,-1,-1,buffer,0.8,0.2,0.4,0.4,0.4,0.2,0.4,1.4,-0.6,buffer,-0.333333333,-0.333333333,0.466666667,0.333333333,0.4,buffer,0,1,0,1,0,0,1.4,1.6,1,1.2,1.6,1.2,0.6,1.4,0.6,0.8,1.2,1,1,2,0.2,0.6,0.6,0.8,buffer,HS_TS,-0.271289667,-0.334988165,0.863936607,0.400387399,0.164511544 +464,R_6do7H4cijRIGxQk,18 - 24,Canadian,Male,Male,High School (or equivalent),20,02PsVPf,02FUT,10,02DGEN,0,0.666666667,0.333333333,-1,3,0,-2,1,0,0,0,0,3,2,1,1,0,3,-3,-2,3,0,1,-2,-1,-2,-1,-1,2,0,0,0,0,1,-2,2,0,3,3,-2,0,-2,2,2,0,0,0,2,0,3,0,0,0,0,0,2,0,3,2,2,2,0,2,0,3,0,0,1,0,0,2,0,3,2,2,2,0,3,10,10,10,10,10,10,8,8,8,8,8,8,2,5,3,2,0,2,1,2,1,4,0,1,1,0,3,2,5,2,2,2,3,2,0,2,1,0,1,1,0,1,1,0,0,2,1,0,0,2,0,0,0,1,1,0,1,1,0,0,2,0,0,0,2,0,0,0,1,1,0,0,4,0,1,0,2,5,1,2,1,3,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,buffer,1,5,3,0,-1,2,1,0,1,4,0,0,0,0,2,1,5,2,0,2,3,2,-2,2,1,0,0,0,0,1,4,0,1,0,1,5,1,2,1,3,0,0,0,0,1,buffer,2,2,2,2,2,2,buffer,1.6,1.6,0.4,2,1.2,0.2,1.2,2.4,0.2,buffer,2,2,1.2,1.133333333,1.266666667,buffer,0,0,0,0,0,0,2.4,2,1,2.6,1.6,0.6,0.8,0.4,0.6,0.6,0.4,0.4,1.4,2.4,0.4,0.2,0,0.2,buffer,HS_TS,1.329787112,0.897984403,2.451201574,1.923546725,1.650629953 +465,R_6QXHGLo0jxGg96h,18 - 24,Canadian,Male,Male,High School (or equivalent),20,01PfPsV,02FUT,10,02DGEN,0.125,0.333333333,0.666666667,2,3,1,-2,-2,-2,1,1,-1,0,-1,-1,2,0,1,2,2,2,-3,-2,-2,0,-2,1,-1,2,2,-1,1,-2,2,2,2,-3,-3,-2,-1,-1,1,-2,2,1,-1,1,0,2,2,1,-1,-1,-1,2,1,-2,1,-1,-1,2,0,1,2,2,1,0,0,0,2,1,-2,1,-1,0,2,-1,1,3,5,7,5,5,8,2,2,3,3,5,5,0,1,1,1,0,0,1,3,2,1,3,3,3,1,3,0,1,1,1,1,0,2,2,2,2,3,2,3,1,1,0,1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,1,0,2,2,2,1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,0,2,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,buffer,0,0,1,0,-1,-1,0,3,1,0,3,3,3,1,3,0,0,1,-1,-1,-2,1,2,1,1,3,1,3,0,1,0,0,0,-1,0,-1,1,1,0,1,0,0,0,-1,2,buffer,1,3,4,2,0,3,buffer,0,0.6,2.6,-0.2,0.6,1.6,-0.2,0.4,0.2,buffer,2.666666667,1.666666667,1.066666667,0.666666667,0.133333333,buffer,2,0,1,1,3,2,0.6,1.4,2.6,0.8,1.6,2,0.6,0.8,0,1,1,0.4,0.2,0.6,0.6,0.4,0.2,0.4,buffer,HS_TS,1.78723762,0.721845465,2.162607944,1.035037119,1.426682037 +466,R_3EzrBY8Bybhs9NI,25 - 31,American,Prefer not to say,Prefer not to say,High School (or equivalent),25,02PsVPf,02FUT,5,01ITEM,-0.625,0.333333333,0.666666667,1,3,0,-2,2,3,-1,0,2,2,0,0,1,-2,3,3,-1,3,-3,-1,-2,3,-3,3,-3,-2,-3,0,2,-2,3,0,3,2,0,-2,1,-2,2,-2,-3,-3,-3,-3,-3,2,3,-1,-1,2,3,-2,2,-1,3,1,1,2,-1,3,0,3,-1,-1,2,1,-3,2,-3,1,2,3,3,-3,3,6,10,9,2,6,10,1,5,7,4,9,7,2,4,3,1,3,5,4,3,1,5,2,3,1,4,5,2,3,3,4,2,5,2,2,0,4,3,3,4,1,6,1,0,1,1,0,0,1,2,3,1,1,1,1,1,0,1,0,1,1,0,2,2,2,5,1,2,3,2,1,0,0,1,0,5,1,0,2,1,1,1,1,0,3,5,1,2,0,0,0,0,2,1,0,2,2,1,2,1,2,0,buffer,1,4,2,0,3,5,3,1,-2,4,1,2,0,3,5,1,3,2,3,2,3,0,0,-5,3,1,0,2,0,6,-2,1,0,5,1,-2,1,1,-1,-1,0,-2,2,3,1,buffer,5,5,2,-2,-3,3,buffer,2,2.2,2.2,2.2,0.2,1.8,1,-0.4,0.8,buffer,4,-0.666666667,2.133333333,1.4,0.466666667,buffer,4,4,1,3,4,0,2.6,3.6,3,2.8,2.6,3.4,0.6,1.4,0.8,0.6,2.4,1.6,1.4,1,2,0.4,1.4,1.2,buffer,HS_TS,2.702138637,-0.511127103,4.471356986,2.431266501,2.273408755 +467,R_1XNRUe0XEwh7Mit,25 - 31,American,Prefer not to say,Prefer not to say,High School (or equivalent),25,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,3,2,2,3,-1,-3,0,-2,2,-1,2,0,2,0,2,2,2,2,2,0,-1,0,-2,0,1,2,0,2,0,2,1,3,3,1,-1,-1,3,0,3,-1,-1,-3,1,1,0,3,2,2,3,-1,-3,0,-1,1,-1,2,0,2,0,2,3,2,2,3,0,-3,0,0,1,-1,2,0,2,-2,2,2,2,2,1,3,5,2,2,2,2,3,2,1,0,0,1,1,2,0,0,2,2,0,0,0,0,0,2,1,1,2,0,2,3,2,1,0,3,3,1,1,2,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,2,1,0,0,0,0,2,0,1,1,1,1,1,0,3,2,3,2,3,3,1,1,2,0,0,0,0,1,0,0,1,0,0,0,0,0,2,0,buffer,1,0,0,1,1,2,0,-1,1,2,0,0,0,0,0,2,1,1,2,-1,2,3,0,0,0,3,3,1,-1,2,1,1,1,1,0,0,3,1,3,2,3,3,1,-1,2,buffer,0,0,0,-1,0,3,buffer,0.6,0.8,0,1,1,1.6,0.8,1.8,1.6,buffer,0,0.666666667,0.466666667,1.2,1.4,buffer,1,1,3,0,1,0,0.6,1.2,0,1.2,1.6,2,0,0.4,0,0.2,0.6,0.4,1,2,2,0.2,0.2,0.4,buffer,HS_TS,-0.042564413,0.19342865,0.863936607,2.05047667,0.766319378 +468,R_1E5lno0n9WvZcAx,32 - 38,American,Prefer not to say,Prefer not to say,High School (or equivalent),36,03VPfPs,01PAST,5,01ITEM,-0.25,0,1,1,3,1,2,2,-1,1,2,0,1,2,2,3,0,3,0,3,1,2,2,-1,1,2,1,2,1,1,1,1,1,-1,3,2,3,3,-1,0,1,3,2,0,1,2,0,1,2,3,1,2,3,0,1,2,0,2,3,2,2,2,3,1,3,2,2,2,0,1,3,-1,2,3,3,3,2,3,5,5,5,7,6,7,5,5,5,5,5,5,1,0,0,0,0,0,0,0,1,1,1,1,2,1,2,2,0,1,1,1,0,1,1,3,1,2,1,1,0,2,1,0,0,0,1,1,0,0,0,1,1,0,1,2,0,0,0,1,0,0,1,0,1,1,1,1,1,0,2,0,1,0,1,1,1,0,1,1,2,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,buffer,0,0,0,0,-1,-1,0,0,1,0,0,1,1,-1,2,2,0,0,1,1,-1,1,0,2,0,1,0,1,-2,2,0,0,0,1,0,0,1,0,1,0,1,-1,0,1,0,buffer,0,0,0,2,1,2,buffer,-0.2,0,0.6,0.8,0.4,0.4,0.2,0.4,0.2,buffer,0,1.666666667,0.133333333,0.533333333,0.266666667,buffer,2,1,2,0,0,0,0.2,0.4,1.4,1,1.2,1.2,0.4,0.4,0.8,0.2,0.8,0.8,0.8,0.8,0.6,0.6,0.4,0.4,buffer,HS_TS,-0.042564413,0.721845465,0.14245253,0.78117723,0.400727703 +469,R_7G8751MoFwlehAZ,18 - 24,American,Female,Female,High School (or equivalent),23,03VPfPs,02FUT,5,02DGEN,0,0.333333333,0.666666667,2,3,3,1,1,3,-1,2,1,2,-1,-2,3,1,3,1,3,3,1,1,2,2,3,2,-2,3,2,1,3,-1,-1,1,3,3,1,1,3,3,3,-2,3,3,1,3,-1,1,2,1,3,3,2,1,3,-1,2,1,1,3,-1,3,1,3,3,3,1,3,1,3,-1,3,1,-1,3,2,3,6,10,7,7,9,10,7,5,8,8,4,4,1,0,0,0,0,1,3,1,1,4,4,4,2,2,4,3,2,0,2,0,2,4,1,2,4,4,5,2,2,4,1,1,2,2,2,1,2,1,2,0,2,3,0,2,0,1,0,0,2,0,0,2,1,2,1,2,1,0,1,0,2,2,0,2,0,1,1,0,1,0,0,1,0,0,0,0,1,2,0,2,1,0,0,0,1,0,2,0,3,0,buffer,0,-1,-2,-2,-2,0,1,0,-1,4,2,1,2,0,4,2,2,0,0,0,2,2,0,0,3,2,4,2,1,4,2,1,-2,2,-2,0,1,0,1,-1,0,-1,0,-3,0,buffer,-1,5,-1,-1,5,6,buffer,-1.4,0.8,1.8,0.8,1.4,2.6,0.2,0.2,-0.8,buffer,1,3.333333333,0.4,1.6,-0.133333333,buffer,1,1,3,1,1,4,0.2,2,3.2,1.4,2.6,3.4,1.6,1.2,1.4,0.6,1.2,0.8,1.2,0.6,0.2,1,0.4,1,buffer,HS_TS,0.643611349,1.602540156,0.719639792,2.812056333,1.444461907 +470,R_7HBLHNwVSCrI6jD,25 - 31,American,Male,Male,College Diploma/Certificate,30,01PfPsV,01PAST,5,02DGEN,1.5,0,1,2,2,3,2,3,2,2,2,1,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,1,2,2,2,1,1,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,1,2,2,2,2,2,2,1,1,1,2,1,1,1,2,2,2,2,1,1,2,1,1,2,2,2,2,1,2,1,7,7,7,7,7,8,8,8,9,8,6,8,0,0,1,0,2,0,1,0,1,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,1,2,0,1,1,1,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,0,1,1,buffer,-1,0,0,0,1,0,1,-1,1,0,0,-1,-1,0,1,1,0,0,-1,-1,0,-1,-1,0,-1,0,0,-1,0,-1,0,0,0,-1,0,0,0,0,-1,-1,0,-1,0,0,0,buffer,-1,-1,-2,-1,1,0,buffer,0,0.2,-0.2,-0.2,-0.6,-0.4,-0.2,-0.4,-0.2,buffer,-1.333333333,0,0,-0.4,-0.266666667,buffer,0,0,1,0,2,1,0.6,0.4,0.4,0.6,0.2,0,0.6,0.2,0.6,0.8,0.8,0.4,0.4,0.2,0.4,0.6,0.6,0.6,buffer,C_Ug,-0.95746543,-0.158849227,-0.1461411,-0.995841983,-0.564574435 +471,R_1I5TwsSiQ8rZBLm,46 - 52,American,Male,Male,Trade School (non-military),50,01PfPsV,02FUT,10,01ITEM,0.375,0.333333333,0.666666667,2,3,2,-1,0,-2,-1,2,0,1,0,-1,3,1,2,2,3,2,-2,1,-2,-1,2,0,1,0,0,3,1,3,2,3,2,-3,1,-2,-1,2,1,1,1,1,1,2,2,2,3,2,0,0,-2,-1,2,0,1,0,0,3,0,3,3,3,2,0,0,-2,0,2,-1,0,-1,0,3,-1,2,2,2,1,3,2,4,1,2,2,1,3,4,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,0,0,1,0,1,2,2,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,0,1,1,1,1,0,2,0,0,0,0,1,0,0,0,0,1,0,1,1,2,1,1,1,0,0,0,0,0,1,0,1,1,1,0,0,1,1,buffer,0,0,0,0,1,0,0,0,0,0,0,0,0,-1,0,-1,0,0,1,1,0,-1,0,0,-1,0,1,2,-1,0,-1,0,0,1,0,0,-1,0,0,-1,0,1,2,0,0,buffer,1,0,-1,2,-1,0,buffer,0.2,0,-0.2,0.2,-0.4,0.4,0,-0.4,0.6,buffer,0,0.333333333,0,0.066666667,0.066666667,buffer,1,0,3,0,1,2,0.4,0,0.4,0.6,0.2,1.2,0.2,0,0.6,0.4,0.6,0.8,0.2,0.2,1.2,0.2,0.6,0.6,buffer,HS_TS,-0.042564413,0.017289712,-0.1461411,-0.107332375,-0.069687044 +472,R_1IhBxC4M6HUlLgE,53 - 59,Canadian,Male,Male,University - Undergraduate,59,02PsVPf,02FUT,10,02DGEN,-0.375,0.666666667,0,2,1,0,-1,1,-2,-2,2,0,1,1,-2,1,0,1,1,1,1,-2,1,-2,-2,2,-1,0,2,-1,2,1,1,1,1,1,-2,0,-2,-1,2,-1,-1,1,-2,0,1,1,3,1,0,-2,1,-2,-2,2,-1,1,2,-2,2,-1,2,2,1,0,0,1,0,-2,2,-2,1,2,-1,2,-2,2,4,6,5,7,4,6,3,7,2,6,6,7,1,0,1,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,2,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,1,0,2,0,0,2,0,1,1,1,2,1,0,0,0,0,1,0,1,0,0,1,1,1,2,0,0,1,0,0,2,0,2,0,0,1,0,0,1,0,1,0,buffer,0,0,1,0,0,0,0,0,0,1,0,1,0,0,-1,1,0,1,0,1,-2,1,0,-1,2,-1,-1,0,-1,-1,-1,0,0,-2,1,-2,1,0,-1,1,1,0,2,-1,0,buffer,1,-1,3,1,-2,-1,buffer,0.2,0.2,0,0.6,0,-0.8,-0.4,-0.2,0.4,buffer,1,-0.666666667,0.133333333,-0.066666667,-0.066666667,buffer,3,2,1,3,1,5,0.6,0.4,0.8,0.8,0.8,0.4,0.4,0.2,0.8,0.2,0.8,1.2,0.2,0.4,0.8,0.6,0.6,0.4,buffer,C_Ug,0.643611349,-0.511127103,0.14245253,-0.361192264,-0.021563872 +473,R_7s92ZR9oETlKVvH,53 - 59,Canadian,Male,Male,High School (or equivalent),58,03VPfPs,02FUT,10,02DGEN,0.5,0.666666667,0.333333333,-1,3,2,1,2,2,2,2,0,3,1,2,2,2,3,-1,3,3,1,3,1,3,3,3,3,2,3,3,3,3,3,3,3,0,3,2,3,3,2,3,3,3,3,3,3,0,3,2,1,2,1,2,2,2,2,2,2,2,2,2,0,3,2,2,2,2,1,2,1,2,1,2,3,2,3,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,1,3,0,1,1,1,1,0,4,0,1,1,1,0,1,1,2,0,2,1,1,1,0,1,0,0,0,0,1,0,0,2,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,4,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,buffer,-1,0,1,0,1,0,1,1,1,-1,0,1,1,1,-1,3,0,1,0,1,0,0,1,1,-1,2,1,0,1,0,4,0,0,0,0,0,-1,0,0,0,0,0,-1,0,-1,buffer,0,0,0,0,0,0,buffer,0.2,0.4,0.4,1,0.2,0.8,0.8,-0.2,-0.4,buffer,0,0,0.333333333,0.666666667,0.066666667,buffer,0,0,0,0,0,0,0.4,1.2,0.8,1.4,0.8,1,0.2,0.8,0.4,0.4,0.6,0.2,1,0.4,0.2,0.2,0.6,0.6,buffer,HS_TS,-0.042564413,-0.158849227,0.575342976,1.035037119,0.352241614 +474,R_5luIfpUojL2tYmd,60 - 66,Canadian,Female,Female,Professional Degree (ex. JD/MD),61,02PsVPf,02FUT,5,02DGEN,0.375,0,1,-1,1,2,-2,3,3,-1,3,-2,1,2,0,3,0,2,1,0,2,-3,3,3,-2,3,-2,3,2,0,2,2,2,2,1,1,-3,3,3,-1,3,0,3,2,-1,3,3,2,1,0,0,1,1,3,-2,2,-2,2,2,-1,2,-1,2,1,2,2,2,-1,1,-1,0,0,-1,1,0,0,-1,1,2,2,2,8,8,3,6,2,1,7,6,6,2,1,0,1,0,0,1,0,0,2,0,0,1,2,0,3,0,1,1,0,0,0,0,2,2,0,1,0,3,0,2,1,2,3,2,0,1,1,0,1,0,1,1,1,0,2,1,0,4,4,2,0,3,2,2,1,0,3,1,1,1,1,1,0,0,0,1,0,2,0,0,1,1,1,0,0,2,2,1,2,2,1,2,2,3,1,1,2,0,1,buffer,0,0,-2,-2,-2,0,0,-1,0,1,0,-1,0,1,0,1,-1,1,-3,-4,-2,0,-3,0,0,-1,1,-3,2,-1,1,-1,-1,-1,-2,-2,0,-2,0,-3,-1,0,-1,1,-1,buffer,-4,0,1,1,2,-3,buffer,-1.2,0,0,-1.2,-1,-0.4,-0.8,-1.4,-0.4,buffer,-1,0,-0.4,-0.866666667,-0.866666667,buffer,6,6,1,1,4,5,0.8,0.6,0.6,1,0.8,0.8,2,0.6,0.6,2.2,1.8,1.2,0.6,0.6,0.6,1.4,2,1,buffer,grad_prof,-0.728740176,-0.158849227,-1.011921991,-1.88435159,-0.945965746 +475,R_6TM0vko6aIToDlL,39 - 45,Canadian,Male,Male,University - Undergraduate,42,03VPfPs,01PAST,10,02DGEN,-0.125,0.333333333,0.666666667,2,3,3,1,3,1,0,2,-1,2,2,3,3,1,2,2,3,3,2,3,2,-1,2,1,2,2,3,2,2,2,2,3,3,1,3,1,0,2,-1,2,2,3,3,1,2,2,3,3,3,3,1,0,3,-1,2,2,3,2,1,2,3,3,3,2,3,0,0,3,-1,2,2,3,2,2,2,2,2,2,1,2,1,2,2,2,2,2,1,0,0,0,1,0,1,1,0,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,1,0,2,0,0,0,1,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,buffer,0,0,0,-1,0,1,1,-1,2,0,0,0,0,1,0,-1,0,0,-1,0,-1,0,-1,0,0,0,0,-1,-1,0,-1,0,0,0,0,0,1,0,2,0,0,0,1,0,0,buffer,0,0,0,-1,0,0,buffer,-0.2,0.6,0.2,-0.4,-0.4,-0.4,-0.2,0.6,0.2,buffer,0,-0.333333333,0.2,-0.4,0.2,buffer,1,0,1,0,0,1,0.2,0.8,0.4,0,0,0,0.4,0.2,0.2,0.4,0.4,0.4,0.2,0.8,0.4,0.4,0.2,0.2,buffer,C_Ug,-0.042564413,-0.334988165,0.286749346,-0.995841983,-0.271661304 +476,R_5bOcm4e0HuNX01r,46 - 52,American,Male,Male,University - Graduate (Masters),48,01PfPsV,02FUT,5,01ITEM,0.375,0.666666667,0.333333333,2,3,2,1,3,0,0,-1,-2,-3,-1,2,1,1,1,1,1,2,1,3,-1,-2,0,-2,1,1,2,-1,-1,1,2,2,0,-1,1,0,2,-1,2,0,2,2,1,-1,0,1,1,0,-2,2,1,-1,1,-1,-1,1,-1,1,1,1,0,0,1,1,3,-1,1,-1,1,-1,-1,1,2,1,1,2,6,6,4,7,5,7,6,7,6,4,7,1,2,0,0,0,1,2,1,0,4,2,0,2,2,0,0,1,2,2,2,0,2,0,4,3,3,0,0,2,1,1,2,2,3,1,1,1,2,1,2,2,3,0,0,0,2,3,1,0,0,1,1,0,3,2,0,1,1,0,0,1,1,2,2,2,1,4,1,4,1,1,0,2,0,1,1,1,1,3,1,2,2,2,2,0,2,2,1,0,0,buffer,0,0,-2,-3,-1,0,1,-1,-1,2,0,-3,2,2,0,-2,-2,1,2,2,-1,1,0,1,1,3,-1,-1,2,1,0,0,1,-1,1,-1,2,-1,2,1,-1,-2,1,0,1,buffer,-5,0,-1,-2,3,-2,buffer,-1.2,0.2,0.2,0.2,0.4,0.8,0.2,0.6,-0.2,buffer,-2,-0.333333333,-0.266666667,0.466666667,0.2,buffer,2,1,1,1,2,0,0.6,1.6,1.2,1.4,1.8,1.2,1.8,1.4,1,1.2,1.4,0.4,1.6,2.2,0.8,1.4,1.6,1,buffer,grad_prof,-1.414915939,-0.334988165,-0.723328361,0.654247288,-0.454746294 +477,R_1GUnt22PvETYEwV,39 - 45,Canadian,Female,Female,College Diploma/Certificate,42,01PfPsV,01PAST,5,02DGEN,-0.875,0,1,3,3,3,3,1,0,1,3,2,0,1,3,3,1,1,3,3,3,3,3,-1,3,3,3,-1,-2,1,3,3,3,1,3,3,-2,3,-2,-3,2,3,-3,-1,3,-1,3,-2,3,3,3,3,0,3,3,3,-1,3,3,3,3,-1,3,3,3,3,3,1,3,1,3,-1,3,3,3,3,0,3,8,8,5,10,7,10,3,1,1,1,1,1,0,0,0,0,2,1,2,0,1,1,3,2,0,2,2,2,0,0,5,2,2,4,1,1,3,2,0,4,2,3,0,0,0,0,1,3,2,0,3,3,2,0,0,2,2,0,0,0,0,0,3,0,0,3,3,2,0,0,1,2,2,0,0,5,0,1,6,1,0,2,1,2,4,0,5,0,0,0,0,1,0,2,0,0,0,0,0,0,1,0,buffer,0,0,0,0,1,-2,0,0,-2,-2,1,2,0,0,0,2,0,0,5,2,-1,4,1,-2,0,0,0,4,1,1,2,0,0,5,-1,1,4,1,0,2,1,2,4,-1,5,buffer,5,7,4,9,6,9,buffer,0.2,-1.2,0.6,1.8,0.4,1.2,1.2,1.6,2.2,buffer,5.333333333,8,-0.133333333,1.133333333,1.666666667,buffer,2,1,5,2,0,0,0.4,1,1.8,1.8,2.2,2.2,0.2,2.2,1.2,0,1.8,1,1.4,2,2.4,0.2,0.4,0.2,buffer,C_Ug,3.617039654,4.068485291,-0.434734729,1.923546725,2.293584235 +478,R_1hxSBuVv7q5n23w,53 - 59,American,Female,Female,College Diploma/Certificate,56,02PsVPf,02FUT,5,01ITEM,-0.125,0,0.666666667,3,2,3,3,3,-1,1,2,-1,1,3,0,2,-1,2,3,3,2,3,3,1,-2,3,1,2,3,1,-1,1,3,3,3,2,3,3,1,-2,2,0,1,3,1,2,2,3,3,2,3,3,3,-2,1,2,-1,1,-2,-1,1,-2,2,3,2,3,3,2,-2,0,1,-1,-1,3,-1,1,-2,3,0,7,6,1,6,7,1,6,3,2,6,2,0,1,1,0,0,2,3,1,2,1,0,1,3,2,1,0,1,1,0,0,2,3,0,1,0,0,1,0,3,1,0,0,0,0,0,1,0,0,0,0,5,1,1,1,0,0,0,0,0,1,1,1,1,0,2,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,3,1,0,0,0,0,0,1,0,1,1,0,2,5,0,0,0,1,buffer,0,1,1,0,0,1,3,1,2,1,-5,0,2,1,1,0,1,1,0,-1,1,2,-1,1,-2,0,0,-1,2,0,0,0,0,0,-1,0,-1,0,1,-1,-5,0,3,1,-1,buffer,-1,1,3,-1,0,5,buffer,0.4,1.6,-0.2,0.2,0.2,0.2,-0.2,-0.2,-0.4,buffer,1,1.333333333,0.6,0.2,-0.266666667,buffer,1,1,1,1,0,1,0.4,1.8,1.4,0.4,1.2,1,0,0.2,1.6,0.2,1,0.8,0,0.6,0.8,0.2,0.8,1.2,buffer,C_Ug,0.643611349,0.545706526,1.152530237,0.146527512,0.622093906 +479,R_7dg0n97nQhPRImG,39 - 45,Canadian,Female,Female,University - Graduate (Masters),39,02PsVPf,01PAST,10,01ITEM,0.125,0,1,3,2,2,3,3,0,-1,3,0,1,2,3,2,0,2,3,3,3,3,3,2,2,2,2,2,3,3,3,0,3,3,3,3,3,3,0,-2,1,-2,2,2,2,2,2,2,3,3,3,3,3,0,-1,3,0,2,3,2,0,0,3,2,3,3,2,3,0,-1,3,0,1,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,0,1,1,0,0,2,3,1,2,1,1,0,1,0,1,0,1,1,0,0,0,1,2,2,1,0,1,0,2,0,0,1,1,0,0,0,0,0,0,1,1,1,2,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,2,4,1,4,0,1,1,1,2,1,1,0,0,1,0,0,0,0,0,1,0,1,3,0,0,buffer,0,0,0,0,0,2,3,1,2,0,0,-1,-1,0,0,-1,0,0,-1,0,0,1,2,2,1,-1,1,-1,2,-1,-1,0,0,-1,0,2,4,1,4,-1,1,0,-2,2,1,buffer,0,0,0,0,0,0,buffer,0,1.6,-0.4,-0.4,1.2,0,-0.4,2,0.4,buffer,0,0,0.4,0.266666667,0.666666667,buffer,0,0,0,0,0,0,0.4,1.8,0.6,0.4,1.2,0.6,0.4,0.2,1,0.8,0,0.6,0,2.2,1.2,0.4,0.2,0.8,buffer,grad_prof,-0.042564413,-0.158849227,0.719639792,0.273457456,0.197920902 +480,R_1v9R7QJPOWllM9X,53 - 59,American,Female,Female,University - Undergraduate,56,03VPfPs,02FUT,10,01ITEM,-0.25,0,1,3,3,2,3,3,2,-2,3,-3,3,0,-2,3,-2,2,2,2,2,2,2,2,-1,2,1,2,1,2,2,1,2,2,3,2,2,3,2,-2,2,1,2,-1,2,2,2,2,3,3,2,3,3,2,-2,2,-2,2,-1,-1,2,-2,2,3,3,2,3,3,1,-2,2,-2,2,-1,-1,3,-2,2,1,1,1,1,1,2,0,0,0,0,2,1,1,1,0,1,1,0,1,1,4,1,1,4,1,3,0,1,0,0,1,0,0,0,1,4,1,1,4,1,4,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,2,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,buffer,1,1,0,1,1,0,1,0,3,0,0,3,0,3,0,1,0,0,1,0,-1,0,0,3,0,0,3,1,4,0,0,1,0,0,1,-1,1,0,0,0,2,0,-1,1,0,buffer,1,1,1,1,-1,1,buffer,0.8,0.8,1.2,0.4,0.4,1.6,0.4,0,0.4,buffer,1,0.333333333,0.933333333,0.8,0.266666667,buffer,0,0,1,0,2,1,0.8,1.4,1.8,0.4,1.2,2,0,0.6,0.6,0,0.8,0.4,0.4,0.2,0.6,0,0.2,0.2,buffer,C_Ug,0.643611349,0.017289712,1.874014312,1.288897006,0.955953095 +481,R_62zhW2oPlpAnX9n,18 - 24,American,Female,Female,High School (or equivalent),19,03VPfPs,02FUT,10,02DGEN,0.25,0,1,1,3,2,3,2,1,2,2,2,3,2,1,3,-1,2,0,3,2,3,2,3,0,-1,-1,3,3,2,0,0,3,3,3,3,-1,2,3,2,1,-1,3,3,2,1,2,3,2,3,2,3,2,2,0,2,0,2,3,1,3,3,3,3,3,1,0,3,2,0,3,-1,3,2,2,3,1,3,1,3,4,3,4,3,2,3,7,5,5,5,1,0,0,0,0,2,2,3,3,0,1,1,3,1,1,2,0,1,4,0,2,0,1,3,0,1,1,2,3,1,1,0,0,0,0,1,2,0,2,1,1,0,0,4,1,2,0,1,3,1,1,2,1,3,0,0,1,0,2,1,3,0,1,4,0,0,2,2,0,0,0,0,1,2,0,1,0,1,3,1,0,0,1,1,1,1,1,0,2,0,buffer,0,0,0,0,0,1,0,3,1,-1,0,1,3,-3,0,0,0,0,1,-1,1,-2,0,0,0,1,0,2,1,0,2,0,0,1,-1,0,2,1,-1,-1,-1,-1,1,0,0,buffer,-1,0,-3,-2,-1,-2,buffer,0,0.8,0.2,0,-0.2,0.8,0.4,0.2,-0.2,buffer,-1.333333333,-1.666666667,0.333333333,0.2,0.133333333,buffer,2,1,1,3,2,2,0.2,2,1.4,1.4,1.2,1.6,0.2,1.2,1.2,1.4,1.4,0.8,1.6,0.8,0.6,1.2,0.6,0.8,buffer,HS_TS,-0.95746543,-1.039543918,0.575342976,0.146527512,-0.318784715 +482,R_72VylO2t15dDoLx,39 - 45,Canadian,Female,Female,University - Undergraduate,44,02PsVPf,02FUT,10,01ITEM,0.5,1,0,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +483,R_1Qpkh4ocVfMDtsJ,60 - 66,Canadian,Female,Female,University - Undergraduate,62,03VPfPs,01PAST,10,02DGEN,-0.75,0,1,2,2,2,2,3,-1,-3,2,-1,-1,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,2,2,2,1,2,-2,-2,2,-1,-2,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,buffer,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,buffer,0,0,0,0,0,0,buffer,0,0,0,0.2,-0.2,0,0.2,0.2,0,buffer,0,0,0,0,0.133333333,buffer,0,0,0,0,0,0,0.2,0.8,0,0.4,0.6,0,0.2,0.8,0,0.2,0.8,0,0.2,0.2,0,0,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +484,R_1MXNBF34DjpKRxM,60 - 66,Canadian,Male,Male,Trade School (non-military),64,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,-1,3,2,2,-2,2,-1,1,-2,1,2,2,0,0,1,0,3,3,3,0,2,-2,1,-2,1,2,2,0,0,2,0,3,3,3,0,2,-2,0,-2,0,2,2,0,0,2,0,3,3,3,0,2,-3,1,-3,2,2,2,0,-1,2,0,3,3,3,0,0,0,0,0,1,2,2,0,0,2,0,1,0,0,0,0,0,1,1,3,8,5,1,0,1,1,2,0,1,0,0,0,0,0,0,0,1,1,0,1,1,2,0,1,1,0,1,0,0,0,0,1,1,0,1,1,2,0,2,0,1,1,0,0,0,1,1,1,0,1,1,2,2,1,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,2,3,1,3,1,0,0,0,1,0,buffer,0,0,0,0,0,0,-1,0,-1,-1,0,0,0,-1,0,0,0,0,0,0,-2,0,0,-2,1,0,0,0,0,0,0,0,0,0,0,-2,-3,0,-3,0,0,0,0,-1,0,buffer,0,0,-1,-3,-8,-5,buffer,0,-0.6,-0.2,0,-0.6,0,0,-1.6,-0.2,buffer,-0.333333333,-5.333333333,-0.266666667,-0.2,-0.6,buffer,0,1,0,3,7,4,1,0.2,0.2,1,0.6,0.2,1,0.8,0.4,1,1.2,0.2,0,0.4,0,0,2,0.2,buffer,HS_TS,-0.271289667,-2.977072238,-0.723328361,-0.615052151,-1.146685604 +485,R_5CQuUx5HkIN0nII,39 - 45,American,Female,Female,High School (or equivalent),45,03VPfPs,01PAST,10,02DGEN,-0.125,0.333333333,0.666666667,-2,2,3,3,-1,0,-1,2,0,-1,2,1,3,-1,2,-2,2,3,2,-2,-1,-1,2,0,-1,2,1,2,-1,2,-2,2,3,2,-2,1,-1,2,-1,-1,2,1,2,-1,2,-2,3,3,3,-2,0,-1,2,0,-1,2,1,2,-1,2,-2,2,3,3,-2,0,-1,2,0,-1,2,1,2,-2,2,1,2,2,1,2,2,2,2,3,2,2,3,0,0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,buffer,0,-1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,-1,0,0,-1,0,0,0,2,0,0,1,0,0,0,0,-1,0,buffer,-1,0,-1,-1,0,-1,buffer,0,0.2,0,0.2,0.4,-0.2,-0.2,0.6,-0.2,buffer,-0.666666667,-0.666666667,0.066666667,0.133333333,0.066666667,buffer,0,0,0,0,0,0,0.4,0.2,0.2,0.4,0.4,0.2,0.4,0,0.2,0.2,0,0.4,0,0.6,0,0.2,0,0.2,buffer,HS_TS,-0.500014922,-0.511127103,-0.001844284,0.019597567,-0.248347185 +486,R_3fJUFbQyKEBXLdQ,25 - 31,American,Male,Male,University - Graduate (Masters),30,01PfPsV,01PAST,5,02DGEN,1,0,1,3,2,3,1,3,1,1,2,0,3,3,3,3,2,2,2,2,3,3,3,2,1,2,1,3,1,2,2,3,1,3,2,2,3,2,3,3,3,2,2,2,2,2,2,1,3,3,2,2,3,2,2,2,2,2,3,3,2,2,2,3,2,2,3,2,3,3,3,2,2,2,2,2,1,1,10,9,10,9,8,9,9,10,10,9,10,9,1,0,0,2,0,1,0,0,1,0,2,1,1,1,1,0,0,1,2,1,2,2,1,2,1,1,1,1,0,1,0,1,1,1,0,1,1,0,2,1,0,0,1,0,0,0,0,1,2,1,2,2,1,2,1,1,1,1,1,1,1,0,1,0,1,1,2,1,1,1,1,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,buffer,1,-1,-1,1,0,0,-1,0,-1,-1,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,-1,1,-1,0,0,1,0,1,1,0,-1,0,0,-1,buffer,1,-1,0,0,-2,0,buffer,0,-0.6,1,0,0,-0.2,0,0.6,-0.4,buffer,0,-0.666666667,0.133333333,-0.066666667,0.066666667,buffer,1,1,1,0,0,1,0.6,0.4,1.2,0.8,1.6,0.8,0.6,1,0.2,0.8,1.6,1,0.6,1.2,0.4,0.6,0.6,0.8,buffer,grad_prof,-0.042564413,-0.511127103,0.14245253,-0.361192264,-0.193107813 +487,R_7S97YfGsSwUADhy,39 - 45,American,Female,Female,University - Undergraduate,42,03VPfPs,02FUT,10,01ITEM,0,0.666666667,0.333333333,3,1,3,0,0,-3,1,0,3,-2,0,-2,3,-3,3,3,2,3,0,0,-3,1,0,3,0,0,0,3,-3,3,2,2,3,1,0,-3,2,-1,3,0,0,0,3,-3,3,3,1,1,0,0,-3,0,0,2,0,0,0,3,-3,3,3,1,3,1,0,-3,0,0,1,0,0,0,3,-3,3,1,2,0,2,3,2,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,2,0,2,0,0,0,1,1,0,1,0,0,1,1,0,2,0,2,0,0,0,0,0,2,0,0,0,1,0,1,2,0,2,0,0,0,0,0,0,1,0,0,1,0,2,2,0,2,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,1,0,0,0,0,0,0,buffer,0,1,-2,0,0,0,-1,0,-1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,-2,0,0,0,0,0,0,1,0,-2,0,0,0,1,1,-1,0,0,0,0,0,0,buffer,1,1,0,1,2,1,buffer,-0.2,-0.4,0,0.4,-0.2,0,-0.2,0.2,0,buffer,0.666666667,1.333333333,-0.2,0.066666667,0,buffer,1,1,2,1,0,1,0.2,0.4,0.4,0.6,0.8,0.4,0.4,0.8,0.4,0.2,1,0.4,0.4,0.4,0,0.6,0.2,0,buffer,C_Ug,0.414886095,0.545706526,-0.579031545,-0.107332375,0.068557175 +488,R_71YqcuoCiHrSWy4,25 - 31,American,Male,Male,College Diploma/Certificate,30,01PfPsV,01PAST,5,01ITEM,1.5,0.666666667,0.333333333,3,2,3,3,3,2,3,1,1,1,1,2,2,2,1,2,2,3,2,1,2,2,2,2,2,2,1,2,2,2,2,2,2,3,3,2,2,2,2,2,2,2,2,2,2,1,2,3,1,3,1,2,2,2,2,2,2,2,2,2,3,2,2,3,3,1,2,2,2,2,2,2,2,2,2,8,8,9,9,7,8,8,9,8,8,8,8,1,0,0,1,2,0,1,1,1,1,1,1,0,0,1,1,0,1,0,0,0,1,1,1,1,1,0,0,0,1,2,0,0,2,0,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,1,1,1,1,1,1,0,0,0,1,0,0,1,1,2,0,0,0,0,0,0,1,0,0,0,2,0,1,2,0,0,0,0,0,0,0,0,0,0,0,buffer,-1,0,0,-1,2,-1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,-2,0,0,-1,2,0,0,0,0,0,0,1,0,0,0,buffer,0,-1,1,1,-1,0,buffer,0,-0.2,0.2,0.2,-0.2,0,-0.2,0,0.2,buffer,0,0,0,0,0,buffer,1,1,1,0,1,0,0.8,0.8,0.6,0.4,0.8,0.4,0.8,1,0.4,0.2,1,0.4,0.8,0,0.2,1,0,0,buffer,C_Ug,-0.042564413,-0.158849227,-0.1461411,-0.23426232,-0.145454265 +489,R_6qX2BXpG1OrXIG8,18 - 24,American,Male,Male,High School (or equivalent),23,02PsVPf,01PAST,5,02DGEN,0.625,0,1,3,3,3,3,2,-1,2,1,2,1,-1,1,1,1,-1,3,1,2,0,0,1,3,3,2,2,2,1,0,3,-1,1,-3,2,-1,3,1,2,3,2,3,3,2,0,2,1,3,0,0,-2,1,0,2,0,1,3,1,-3,-1,3,-1,-1,0,3,2,-2,3,1,2,2,3,-1,3,0,0,2,5,5,5,6,10,10,10,10,8,9,5,5,0,2,1,3,2,2,1,2,0,1,3,0,1,2,0,2,6,1,4,1,2,0,2,0,2,4,1,1,1,2,0,3,3,5,1,1,0,1,1,2,2,4,2,2,0,4,3,0,1,4,4,1,1,0,2,0,2,1,1,3,2,4,0,1,3,0,1,0,0,1,1,1,0,1,2,4,0,3,4,3,3,1,2,1,0,2,6,1,3,3,buffer,0,-1,-2,-2,1,1,1,1,-1,-1,1,-4,-1,0,0,-2,3,1,3,-3,-2,-1,1,0,0,4,-1,0,0,-1,-2,4,-3,-3,0,-3,0,-2,-1,1,-1,-5,-1,-2,-1,buffer,-5,-5,-3,-3,5,5,buffer,-0.8,0.2,-0.8,0.4,-0.4,0.4,-0.8,-1,-2,buffer,-4.333333333,2.333333333,-0.466666667,0.133333333,-1.266666667,buffer,1,5,5,1,5,3,1.6,1.2,1.2,2.8,1.2,1.8,2.4,1,2,2.4,1.6,1.4,2,0.4,1,2.8,1.4,3,buffer,HS_TS,-3.015992718,1.074123341,-1.156218807,0.019597567,-0.769622654 +490,R_5IxO3MQCeJTVFPb,18 - 24,American,Female,Female,College Diploma/Certificate,24,01PfPsV,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,3,3,2,3,2,-1,-1,1,0,2,-2,-3,2,-1,2,3,3,3,-2,2,-2,-2,-1,1,1,-1,-3,1,1,3,3,3,1,-1,-1,-2,0,-1,1,1,-1,-2,2,1,2,3,3,2,2,3,0,-2,2,-1,1,-2,-3,3,-1,3,3,3,0,2,2,1,1,3,-2,1,-2,-3,2,-3,1,4,7,5,7,6,6,2,4,3,4,7,2,0,0,1,5,0,1,1,2,1,1,1,0,1,2,1,0,0,1,4,3,1,1,2,1,1,1,1,0,2,0,0,0,0,1,1,1,1,1,1,1,0,0,1,0,1,0,0,2,1,0,2,2,2,2,1,0,0,0,2,1,0,0,2,1,3,0,2,0,0,0,0,1,1,0,1,0,0,2,0,1,1,3,1,1,0,0,0,1,2,2,buffer,0,0,1,4,-1,0,0,1,0,0,1,0,0,2,0,0,0,-1,3,3,-1,-1,0,-1,0,1,1,0,0,-1,0,0,0,1,2,-1,-1,-1,-1,0,0,1,0,-2,-1,buffer,2,3,2,3,-1,4,buffer,0.8,0.2,0.6,1,-0.6,0.2,0.6,-0.8,-0.4,buffer,2.333333333,2,0.533333333,0.2,-0.2,buffer,3,1,1,2,3,1,1.2,1.2,1,1.6,1.2,0.8,0.4,1,0.4,0.6,1.8,0.6,1.2,0.4,0.6,0.6,1.2,1,buffer,C_Ug,1.558512366,0.897984403,1.008233421,0.146527512,0.902814425 diff --git a/eohi2/eohi2_basic process.csv b/eohi2/eohi2_basic process.csv new file mode 100644 index 0000000..fb7b7f8 --- /dev/null +++ b/eohi2/eohi2_basic process.csv @@ -0,0 +1,491 @@ +ResponseId,taq_age,Citizenship,taq_sex,prePrefItem_1,prePrefItem_2,prePrefItem_3,prePrefItem_4,prePrefItem_5,prePrefItem_DO_1,prePrefItem_DO_2,prePrefItem_DO_3,prePrefItem_DO_4,prePrefItem_DO_5,prePersItem_1,prePersItem_2,prePersItem_3,prePersItem_4,prePersItem_5,prePersItem_DO_1,prePersItem_DO_2,prePersItem_DO_3,prePersItem_DO_4,prePersItem_DO_5,preValItem_1,preValItem_2,preValItem_3,preValItem_4,preValItem_5,preValItem_DO_1,preValItem_DO_2,preValItem_DO_3,preValItem_DO_4,preValItem_DO_5,01past5PrefItem_1,01past5PrefItem_2,01past5PrefItem_3,01past5PrefItem_4,01past5PrefItem_5,01past5PrefItem_DO_1,01past5PrefItem_DO_2,01past5PrefItem_DO_3,01past5PrefItem_DO_4,01past5PrefItem_DO_5,01past5PrefDGEN_1,01past5PersItem_1,01past5PersItem_2,01past5PersItem_3,01past5PersItem_4,01past5PersItem_5,01past5PersItem_DO_1,01past5PersItem_DO_2,01past5PersItem_DO_3,01past5PersItem_DO_4,01past5PersItem_DO_5,01past5PersDGEN_1,01past5ValItem_1,01past5ValItem_2,01past5ValItem_3,01past5ValItem_4,01past5ValItem_5,01past5ValItem_DO_1,01past5ValItem_DO_2,01past5ValItem_DO_3,01past5ValItem_DO_4,01past5ValItem_DO_5,01past5ValDGEN_1,01past10PrefItem_1,01past10PrefItem_2,01past10PrefItem_3,01past10PrefItem_4,01past10PrefItem_5,01past10PrefItem_DO_1,01past10PrefItem_DO_2,01past10PrefItem_DO_3,01past10PrefItem_DO_4,01past10PrefItem_DO_5,01past10PrefDGEN_1,01past10PersItem_1,01past10PersItem_2,01past10PersItem_3,01past10PersItem_4,01past10PersItem_5,01past10PersItem_DO_1,01past10PersItem_DO_2,01past10PersItem_DO_3,01past10PersItem_DO_4,01past10PersItem_DO_5,01past10PersDGEN_1,01past10ValItem_1,01past10ValItem_2,01past10ValItem_3,01past10ValItem_4,01past10ValItem_5,01past10ValItem_DO_1,01past10ValItem_DO_2,01past10ValItem_DO_3,01past10ValItem_DO_4,01past10ValItem_DO_5,01past10ValDGEN_1,01fut5PrefItem_1,01fut5PrefItem_2,01fut5PrefItem_3,01fut5PrefItem_4,01fut5PrefItem_5,01fut5PrefItem_DO_1,01fut5PrefItem_DO_2,01fut5PrefItem_DO_3,01fut5PrefItem_DO_4,01fut5PrefItem_DO_5,01fut5PrefDGEN_8,01fut5PersItem_1,01fut5PersItem_2,01fut5PersItem_3,01fut5PersItem_4,01fut5PersItem_5,01fut5PersItem_DO_1,01fut5PersItem_DO_2,01fut5PersItem_DO_3,01fut5PersItem_DO_4,01fut5PersItem_DO_5,01fut5PersDGEN_8,01fut5ValItem_1,01fut5ValItem_2,01fut5ValItem_3,01fut5ValItem_4,01fut5ValItem_5,01fut5ValItem_DO_1,01fut5ValItem_DO_2,01fut5ValItem_DO_3,01fut5ValItem_DO_4,01fut5ValItem_DO_5,01fut5ValuesDGEN_1,01fut10PrefItem_1,01fut10PrefItem_2,01fut10PrefItem_3,01fut10PrefItem_4,01fut10PrefItem_5,01fut10PrefItem_DO_1,01fut10PrefItem_DO_2,01fut10PrefItem_DO_3,01fut10PrefItem_DO_4,01fut10PrefItem_DO_5,01fut10PrefDGEN_8,01fut10PersItem_1,01fut10PersItem_2,01fut10PersItem_3,01fut10PersItem_4,01fut10PersItem_5,01fut10PersItem_DO_1,01fut10PersItem_DO_2,01fut10PersItem_DO_3,01fut10PersItem_DO_4,01fut10PersItem_DO_5,01fut10PersDGEN_8,01fut10ValItem_1,01fut10ValItem_2,01fut10ValItem_3,01fut10ValItem_4,01fut10ValItem_5,01fut10ValItem_DO_1,01fut10ValItem_DO_2,01fut10ValItem_DO_3,01fut10ValItem_DO_4,01fut10ValItem_DO_5,01fut10ValuesDGEN_1,02past5PrefDGEN_1,02past5PrefItem_1,02past5PrefItem_2,02past5PrefItem_3,02past5PrefItem_4,02past5PrefItem_5,02past5PrefItem_DO_1,02past5PrefItem_DO_2,02past5PrefItem_DO_3,02past5PrefItem_DO_4,02past5PrefItem_DO_5,02past5PersDGEN_1,02past5PersItem_1,02past5PersItem_2,02past5PersItem_3,02past5PersItem_4,02past5PersItem_5,02past5PersItem_DO_1,02past5PersItem_DO_2,02past5PersItem_DO_3,02past5PersItem_DO_4,02past5PersItem_DO_5,02past5ValDGEN_1,02past5ValItem_1,02past5ValItem_2,02past5ValItem_3,02past5ValItem_4,02past5ValItem_5,02past5ValItem_DO_1,02past5ValItem_DO_2,02past5ValItem_DO_3,02past5ValItem_DO_4,02past5ValItem_DO_5,02past10PrefDGEN_1,02past10PrefItem_1,02past10PrefItem_2,02past10PrefItem_3,02past10PrefItem_4,02past10PrefItem_5,02past10PrefItem_DO_1,02past10PrefItem_DO_2,02past10PrefItem_DO_3,02past10PrefItem_DO_4,02past10PrefItem_DO_5,02past10PersDGEN_1,02past10PersItem_1,02past10PersItem_2,02past10PersItem_3,02past10PersItem_4,02past10PersItem_5,02past10PersItem_DO_1,02past10PersItem_DO_2,02past10PersItem_DO_3,02past10PersItem_DO_4,02past10PersItem_DO_5,02past10ValDGEN_1,02past10ValItem_1,02past10ValItem_2,02past10ValItem_3,02past10ValItem_4,02past10ValItem_5,02past10ValItem_DO_1,02past10ValItem_DO_2,02past10ValItem_DO_3,02past10ValItem_DO_4,02past10ValItem_DO_5,02fut5PrefDGEN_8,02fut5PrefItem_1,02fut5PrefItem_2,02fut5PrefItem_3,02fut5PrefItem_4,02fut5PrefItem_5,02fut5PrefItem_DO_1,02fut5PrefItem_DO_2,02fut5PrefItem_DO_3,02fut5PrefItem_DO_4,02fut5PrefItem_DO_5,02fut5PersDGEN_8,02fut5PersItem_1,02fut5PersItem_2,02fut5PersItem_3,02fut5PersItem_4,02fut5PersItem_5,02fut5PersItem_DO_1,02fut5PersItem_DO_2,02fut5PersItem_DO_3,02fut5PersItem_DO_4,02fut5PersItem_DO_5,02fut5ValDGEN_1,02fut5ValItem_1,02fut5ValItem_2,02fut5ValItem_3,02fut5ValItem_4,02fut5ValItem_5,02fut5ValItem_DO_1,02fut5ValItem_DO_2,02fut5ValItem_DO_3,02fut5ValItem_DO_4,02fut5ValItem_DO_5,02fut10PrefDGEN_8,02fut10PrefItem_1,02fut10PrefItem_2,02fut10PrefItem_3,02fut10PrefItem_4,02fut10PrefItem_5,02fut10PrefItem_DO_1,02fut10PrefItem_DO_2,02fut10PrefItem_DO_3,02fut10PrefItem_DO_4,02fut10PrefItem_DO_5,02fut10PersDGEN_8,02fut10PersItem_1,02fut10PersItem_2,02fut10PersItem_3,02fut10PersItem_4,02fut10PersItem_5,02fut10PersItem_DO_1,02fut10PersItem_DO_2,02fut10PersItem_DO_3,02fut10PersItem_DO_4,02fut10PersItem_DO_5,02fut10ValDGEN_1,02fut10ValItem_1,02fut10ValItem_2,02fut10ValItem_3,02fut10ValItem_4,02fut10ValItem_5,02fut10ValItem_DO_1,02fut10ValItem_DO_2,02fut10ValItem_DO_3,02fut10ValItem_DO_4,02fut10ValItem_DO_5,aot_1,aot_2,aot_3,aot_4,aot_5,aot_6,aot_7,aot_8,crt_1,crt_2,crt_3,demo_sex,demo_edu,demo_age_1,GROUP,TEMPORAL_DO,INTERVAL_DO,ITEM_DO,aot_total,crt_correct,crt_int,ActivelyOpen-MindedThinking_DO_Q7,ActivelyOpen-MindedThinking_DO_Q8,ActivelyOpen-MindedThinking_DO_Q1,ActivelyOpen-MindedThinking_DO_Q2,ActivelyOpen-MindedThinking_DO_Q3,ActivelyOpen-MindedThinking_DO_Q4,ActivelyOpen-MindedThinking_DO_Q5,ActivelyOpen-MindedThinking_DO_Q494,ActivelyOpen-MindedThinking_DO_Q6,CognitiveReflectionTest_DO_Q1,CognitiveReflectionTest_DO_Q2,CognitiveReflectionTest_DO_Q3,CognitiveReflectionTest_DO_Q495,present_pref_read,present_pref_music,present_pref_tv,present_pref_nap,present_pref_travel,present_pers_extravert,present_pers_critical,present_pers_dependable,present_pers_anxious,present_pers_complex,present_val_obey,present_val_trad,present_val_opinion,present_val_performance,present_val_justice,past_5_pref_read,past_5_pref_music,past_5_pref_TV,past_5_pref_nap,past_5_pref_travel,past_5_pers_extravert,past_5_pers_critical,past_5_pers_dependable,past_5_pers_anxious,past_5_pers_complex,past_5_val_obey,past_5_val_trad,past_5_val_opinion,past_5_val_performance,past_5_val_justice,past_10_pref_read,past_10_pref_music,past_10_pref_TV,past_10_pref_nap,past_10_pref_travel,past_10_pers_extravert,past_10_pers_critical,past_10_pers_dependable,past_10_pers_anxious,past_10_pers_complex,past_10_val_obey,past_10_val_trad,past_10_val_opinion,past_10_val_performance,past_10_val_justice,fut_5_pref_read,fut_5_pref_music,fut_5_pref_TV,fut_5_pref_nap,fut_5_pref_travel,fut_5_pers_extravert,fut_5_pers_critical,fut_5_pers_dependable,fut_5_pers_anxious,fut_5_pers_complex,fut_5_val_obey,fut_5_val_trad,fut_5_val_opinion,fut_5_val_performance,fut_5_val_justice,fut_10_pref_read,fut_10_pref_music,fut_10_pref_TV,fut_10_pref_nap,fut_10_pref_travel,fut_10_pers_extravert,fut_10_pers_critical,fut_10_pers_dependable,fut_10_pers_anxious,fut_10_pers_complex,fut_10_val_obey,fut_10_val_trad,fut_10_val_opinion,fut_10_val_performance,fut_10_val_justice,DGEN_past_5_Pref,DGEN_past_5_Pers,DGEN_past_5_Val,DGEN_past_10_Pref,DGEN_past_10_Pers,DGEN_past_10_Val,DGEN_fut_5_Pref,DGEN_fut_5_Pers,DGEN_fut_5_Val,DGEN_fut_10_Pref,DGEN_fut_10_Pers,DGEN_fut_10_Val +R_72xzGlUXksmRobU,67 - 73,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,1,4,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,3,1,2,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,5,2,4,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,1,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,5,2,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,1,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,5,4,0,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,5,3,2,1,1,Somewhat agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Agree,1,5,4,2,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,5,1,3,1,Agree,Strongly disagree,Strongly agree,Disagree,Agree,3,2,5,4,1,1,Agree,Agree,Agree,Strongly agree,Strongly agree,2,3,1,4,5,2,2,1,2,-1,1,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,71,02PsVPf,02FUT,5,02DGEN,0.25,0,1,7,6,5,3,8,9,4,1,2,4,3,2,1,3,3,3,2,3,0,-3,3,-1,1,3,3,3,3,3,3,3,3,2,3,1,-3,3,-3,2,3,3,3,3,3,3,3,3,3,3,1,-3,3,-3,2,3,3,3,3,3,3,3,3,2,3,1,-3,3,0,2,3,3,3,3,3,3,3,3,2,3,2,-3,3,-2,2,2,2,2,3,3,1,1,1,1,1,1,0,1,1,1,1,1 +R_5OVzMaCE4iAqExQ,25 - 31,Canadian,Male,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,5,1,3,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,2,3,1,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,3,4,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,5,1,2,4,6,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,5,2,4,3,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,1,2,5,3,4,6,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,1,2,5,3,7,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,4,1,3,5,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,2,4,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,7,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,4,3,5,2,1,6,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,4,5,2,3,1,0,-1,0,-1,0,-1,1,1,5 cents,5 minutes,24 days,Male,Professional Degree (ex. JD/MD),25,03VPfPs,01PAST,10,02DGEN,0.125,0.666666667,0.333333333,9,2,3,5,7,6,4,1,8,3,2,4,1,1,1,0,0,1,0,1,0,1,0,1,1,0,0,1,0,0,0,0,1,0,-1,-1,1,0,0,0,-1,0,-1,-1,0,0,0,0,0,0,0,1,-1,0,-1,0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,1,-1,1,1,0,1,0,6,6,3,6,7,7,7,7,7,7,7,6 +R_3NwGJkmZsE685Vf,67 - 73,Canadian,Male,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,3,5,1,2,4,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,4,2,5,3,Neither Agree nor Disagree,Agree,Agree,Disagree,Somewhat Agree,5,3,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Agree,Agree,3,1,2,4,5,3,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,5,3,2,4,6,Somewhat Agree,Agree,Agree,Disagree,Agree,5,1,2,3,4,8,Agree,Agree,Agree,Somewhat disagree,Agree,4,2,5,1,3,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,2,5,7,Somewhat Agree,Agree,Somewhat Agree,Disagree,Agree,5,1,4,3,2,3,Agree,Agree,Agree,Strongly agree,Somewhat agree,2,3,1,5,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,2,3,5,Somewhat Agree,Agree,Somewhat Agree,Disagree,Agree,1,5,2,3,4,6,Agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,4,1,5,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,5,1,5,Agree,Agree,Agree,Disagree,Agree,2,5,4,3,1,0,1,1,2,1,0,-1,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),73,02PsVPf,01PAST,5,02DGEN,0.125,0.333333333,0.666666667,6,5,7,9,3,8,4,1,2,2,3,4,1,2,2,3,0,2,-1,-2,1,-1,0,0,2,2,-2,1,2,2,2,2,2,-2,-2,2,-2,0,1,2,2,-2,2,2,2,2,-1,2,0,1,1,1,1,1,2,1,-2,2,2,2,2,3,1,0,0,0,0,0,1,2,1,-2,2,2,1,2,2,0,0,0,0,0,0,2,2,2,-2,2,2,3,6,8,6,7,3,2,5,6,5,5 +R_7PdeFviF2kbNled,46 - 52,Canadian,Female,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,Agree,3,5,4,2,1,Disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,1,4,2,5,3,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,1,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Somewhat agree,5,2,4,3,1,7,Agree,Somewhat disagree,Strongly agree,Disagree,Somewhat agree,2,3,4,1,5,8,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Strongly agree,2,4,3,1,5,4,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,1,2,5,3,4,6,Somewhat agree,Somewhat disagree,Strongly agree,Disagree,Somewhat agree,5,3,2,4,1,6,Strongly agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,1,3,5,2,4,3,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,2,5,4,3,1,6,Somewhat disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,2,3,5,4,5,Strongly agree,Agree,Strongly agree,Somewhat Disagree,Strongly agree,3,2,4,5,1,2,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,2,3,4,5,1,2,Strongly disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,4,1,5,3,3,Strongly agree,Agree,Strongly agree,Disagree,Strongly agree,3,2,5,1,4,1,1,2,2,0,0,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0,0,1,7,3,4,9,5,2,8,1,6,4,2,3,1,3,3,0,-1,2,-2,1,3,3,1,3,0,3,0,3,3,3,-1,-1,1,2,-1,3,-2,1,3,0,1,-2,3,3,3,-1,-1,0,1,-1,3,-2,1,3,2,0,0,3,3,3,0,0,3,-1,0,3,0,1,3,2,3,-1,3,3,3,0,0,3,-3,0,3,0,1,3,2,3,-2,3,4,7,8,4,6,6,3,6,5,2,2,3 +R_1g74XahwnlCiayZ,39 - 45,Canadian,Male,Somewhat agree,Agree,Strongly agree,Agree,Strongly agree,4,1,3,5,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,4,1,3,2,5,Agree,Somewhat Agree,Agree,Agree,Agree,5,2,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,1,3,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,2,3,1,5,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,3,5,1,4,2,3,Agree,Agree,Strongly agree,Strongly agree,Agree,3,5,1,2,4,9,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,2,1,4,5,3,8,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,4,1,2,5,3,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,3,5,6,Strongly agree,Agree,Somewhat agree,Strongly agree,Strongly agree,5,2,1,3,4,5,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,1,4,2,3,5,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,5,1,3,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,1,2,3,5,4,5,Agree,Agree,Strongly agree,Agree,Agree,4,3,5,2,1,0,0,1,-1,-1,0,-1,1,10 cents,25 minutes,24 days,Male,Professional Degree (ex. JD/MD),45,01PfPsV,02FUT,5,02DGEN,0.625,0,0.666666667,3,5,7,9,2,4,6,1,8,4,3,2,1,1,2,3,2,3,0,0,-1,1,1,2,1,2,2,2,1,2,3,3,3,0,1,0,1,1,1,2,2,1,1,2,2,3,3,2,3,0,3,3,3,1,2,1,2,1,2,3,3,3,3,3,2,1,3,3,1,1,2,2,2,3,3,3,3,3,1,0,0,2,1,2,2,3,2,2,5,4,5,3,9,8,6,6,5,6,5,5 +R_6fe14R7rESSUJN8,39 - 45,Canadian,Male,Strongly agree,Agree,Agree,Somewhat agree,Agree,2,5,3,4,1,Somewhat agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,Agree,Strongly Agree,Agree,Agree,Agree,4,3,5,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Agree,Somewhat agree,Agree,Agree,4,5,2,3,1,7,Strongly agree,Somewhat agree,Agree,Somewhat agree,Agree,4,2,3,5,1,7,Agree,Agree,Agree,Agree,Somewhat Agree,1,4,5,2,3,6,Agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,5,3,2,1,4,7,Strongly agree,Somewhat agree,Agree,Agree,Agree,4,3,1,2,5,7,Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,3,5,1,2,4,7,Somewhat agree,Agree,Agree,Strongly agree,Agree,2,5,3,4,1,8,Agree,Strongly agree,Somewhat agree,Agree,Strongly agree,1,5,3,4,2,8,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,Agree,5,1,2,4,3,8,Agree,Agree,Agree,Strongly agree,Somewhat agree,4,5,2,1,3,8,Agree,Agree,Strongly agree,Agree,Somewhat agree,5,3,4,1,2,7,Agree,Strongly agree,Somewhat Agree,Agree,Agree,4,5,3,2,1,0,0,1,-1,-1,-2,-1,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),40,03VPfPs,01PAST,10,02DGEN,0.75,0.666666667,0.333333333,5,6,4,8,9,2,7,1,3,2,3,4,1,3,2,2,1,2,1,0,-2,0,1,2,3,2,2,2,2,2,1,2,2,3,1,2,1,2,2,2,2,2,1,2,1,1,2,0,3,1,2,2,2,2,2,1,2,1,1,2,2,3,2,2,3,1,2,3,1,2,1,3,2,2,2,2,3,1,2,2,3,2,1,2,3,1,2,2,7,7,7,6,7,7,7,8,8,8,8,7 +R_7Pui4pm8cmzgDXj,60 - 66,American,Female,Somewhat agree,Strongly agree,Agree,Somewhat agree,Strongly disagree,1,4,2,5,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat agree,Agree,Agree,Somewhat agree,Strongly disagree,5,4,3,1,2,2,Agree,Agree,Agree,Agree,Agree,5,2,1,3,4,2,Agree,Agree,Agree,Agree,Agree,5,4,1,3,2,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly disagree,5,4,1,3,2,2,Agree,Agree,Agree,Agree,Agree,4,2,3,5,1,2,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,2,Somewhat agree,Agree,Agree,Somewhat agree,Strongly disagree,5,4,3,2,1,2,Agree,Agree,Agree,Agree,Agree,1,2,3,5,4,2,Agree,Agree,Agree,Agree,Agree,3,2,4,1,5,2,Somewhat agree,Agree,Agree,Somewhat agree,Strongly disagree,3,1,5,4,2,2,Agree,Agree,Agree,Agree,Agree,3,4,2,1,5,2,Agree,Agree,Agree,Agree,Agree,5,3,1,4,2,1,1,1,-1,-1,-1,-1,1,10 cents,25 minutes,24 days,Female,High School (or equivalent),63,02PsVPf,01PAST,5,02DGEN,1,0,0.666666667,9,2,6,4,5,8,3,1,7,3,4,2,1,1,3,2,1,-3,0,-1,0,0,0,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,1,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,-3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 +R_1Wu9n4mwQfPZt70,53 - 59,Canadian,Male,Neither agree nor disagree,Agree,Agree,Somewhat agree,Somewhat disagree,1,3,5,2,4,Somewhat disagree,Disagree,Somewhat agree,Strongly disagree,Somewhat agree,1,4,2,3,5,Somewhat Agree,Somewhat Agree,Agree,Disagree,Agree,3,2,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Disagree,Agree,Agree,Agree,Disagree,1,2,5,4,3,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,2,3,5,1,4,3,Agree,Somewhat Agree,Agree,Disagree,Agree,5,1,4,2,3,2,Somewhat disagree,Agree,Agree,Somewhat agree,Somewhat disagree,3,1,2,4,5,3,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,2,3,5,4,3,Agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,2,1,5,4,3,3,Somewhat disagree,Agree,Agree,Agree,Disagree,5,4,1,2,3,3,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,2,1,5,4,3,Agree,Somewhat Agree,Agree,Disagree,Somewhat Agree,4,3,2,5,1,4,Somewhat disagree,Somewhat agree,Agree,Agree,Disagree,5,3,1,4,2,2,Neither agree nor disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,4,1,2,5,3,4,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Agree,2,4,1,5,3,1,0,0,2,1,-1,0,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,01PfPsV,02FUT,10,02DGEN,-0.25,0,1,9,5,8,3,4,7,6,1,2,4,3,2,1,0,2,2,1,-1,-1,-2,1,-3,1,1,1,2,-2,2,-2,2,2,2,-2,1,-2,2,-2,1,2,1,2,-2,2,-1,2,2,1,-1,1,-2,1,-2,1,2,1,1,-2,2,-1,2,2,2,-2,1,-2,1,-2,1,2,1,2,-2,1,-1,1,2,2,-2,0,-3,1,-2,1,2,1,1,-3,2,2,2,3,2,3,3,3,3,3,4,2,4 +R_6i2zpvwYiLG1DQB,67 - 73,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,4,3,2,1,5,Agree,Strongly disagree,Agree,Disagree,Agree,4,3,5,2,1,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,4,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Agree,Agree,Disagree,Strongly agree,4,3,1,2,5,2,Agree,Strongly disagree,Agree,Strongly disagree,Agree,2,5,3,1,4,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,1,4,3,2,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,1,5,2,4,2,Agree,Disagree,Agree,Disagree,Agree,1,4,3,2,5,2,Agree,Agree,Agree,Somewhat Disagree,Agree,5,3,4,1,2,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,2,5,4,3,1,Agree,Disagree,Agree,Disagree,Agree,3,4,5,2,1,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,4,1,2,5,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,3,1,5,2,1,Agree,Disagree,Agree,Disagree,Agree,4,2,3,1,5,2,Agree,Agree,Agree,Somewhat Disagree,Agree,3,4,5,1,2,1,2,2,2,1,1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,70,03VPfPs,01PAST,5,02DGEN,0.125,0,1,9,6,3,8,5,4,2,1,7,4,3,2,1,3,3,2,-1,3,2,-3,2,-2,2,1,2,2,0,2,3,2,2,-2,3,2,-3,2,-3,2,2,2,2,0,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,-1,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,0,2,3,3,3,-2,3,2,-2,2,-2,2,2,2,2,-1,2,3,2,2,2,2,2,2,1,2,2,1,2 +R_3RUgu1bPops7kT4,53 - 59,Canadian,Female,Agree,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,3,1,2,5,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,4,5,2,1,3,Strongly Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,2,3,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,4,3,2,1,2,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,3,4,2,1,5,8,Disagree,Strongly agree,Agree,Somewhat Agree,Agree,1,4,5,2,3,1,Agree,Strongly agree,Neither agree nor disagree,Agree,Neither agree nor disagree,4,2,3,5,1,1,Agree,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,2,5,3,4,1,1,Neither Agree nor Disagree,Strongly agree,Agree,Disagree,Agree,5,1,4,2,3,1,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,5,2,4,1,3,1,Agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,4,5,1,3,2,7,Neither Agree nor Disagree,Strongly agree,Agree,Agree,Agree,3,2,1,5,4,5,Agree,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,4,5,2,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,1,5,4,2,3,5,Neither Agree nor Disagree,Agree,Disagree,Agree,Agree,4,2,1,5,3,0,0,0,-1,-1,0,0,0,10 cents,5 minutes,24 days,Female,University - Undergraduate,53,02PsVPf,02FUT,10,02DGEN,0.25,0.333333333,0.666666667,2,3,7,5,8,6,4,1,9,2,4,3,1,2,3,-3,2,0,1,0,0,2,0,-3,2,2,0,2,2,2,2,2,0,1,2,0,3,0,-2,3,2,1,2,2,3,0,2,0,2,2,0,3,0,0,3,2,-2,2,0,3,-3,2,0,2,0,0,3,0,0,3,2,2,2,2,3,-3,2,0,0,0,0,3,0,0,2,-2,2,2,7,2,8,1,1,1,1,1,7,5,5,5 +R_6V7RxG1JjWlv3jk,60 - 66,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,5,3,Agree,Strongly disagree,Strongly agree,Somewhat agree,Agree,3,1,4,5,2,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,4,1,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,5,3,1,Strongly agree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,2,5,1,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,3,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,4,3,1,Strongly agree,Strongly disagree,Strongly agree,Agree,Strongly agree,4,1,3,2,5,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,5,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,5,3,1,2,Strongly agree,Strongly disagree,Strongly agree,Agree,Agree,4,1,3,2,5,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,5,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,4,3,1,1,Agree,Strongly disagree,Strongly agree,Agree,Agree,3,2,5,4,1,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,2,5,4,0,2,0,2,-2,-2,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,65,03VPfPs,02FUT,5,02DGEN,0.5,0,1,6,2,5,7,9,4,3,1,8,2,4,3,1,3,3,3,3,3,2,-3,3,1,2,3,1,3,2,3,3,3,3,3,3,3,-3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,2,2,3,3,3,3,3,3,3,3,3,3,2,-3,3,2,2,3,3,3,2,3,1,1,1,1,1,1,2,2,2,1,1,1 +R_1ikIQD6LGveLkIh,67 - 73,American,Female,Strongly agree,Agree,Strongly agree,Somewhat agree,Somewhat disagree,3,2,5,1,4,Somewhat disagree,Strongly disagree,Agree,Disagree,Neither agree nor disagree,5,3,2,1,4,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,5,3,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,3,4,5,2,1,2,Disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,2,3,5,1,4,1,Agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,4,2,3,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Somewhat disagree,5,2,4,1,3,1,Disagree,Strongly disagree,Agree,Strongly disagree,Somewhat disagree,2,5,1,4,3,1,Agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,4,1,5,2,3,1,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat disagree,3,5,2,1,4,1,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Somewhat disagree,1,3,5,4,2,1,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,4,5,2,1,1,Strongly agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,3,5,2,1,4,1,Disagree,Strongly disagree,Agree,Strongly disagree,Somewhat disagree,3,2,5,4,1,1,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,1,4,3,2,1,1,1,1,-1,0,2,-2,10 cents,5 minutes,15 days,Female,College Diploma/Certificate,68,01PfPsV,01PAST,5,02DGEN,-0.125,0.333333333,0.333333333,9,2,4,3,7,8,6,1,5,2,4,3,1,3,2,3,1,-1,-1,-3,2,-2,0,2,3,3,-1,3,3,3,3,-1,-1,-2,-3,2,-2,-1,2,3,3,-1,3,3,3,3,-2,-1,-2,-3,2,-3,-1,2,3,3,-1,3,3,3,3,2,-1,-1,-3,2,-3,-1,2,3,3,0,3,3,3,3,2,0,-2,-3,2,-3,-1,2,3,3,0,3,1,2,1,1,1,1,1,1,1,1,1,1 +R_5QuIeM0sAhThWni,67 - 73,American,Female,Agree,Agree,Agree,Disagree,Disagree,1,2,3,4,5,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Somewhat agree,1,5,4,3,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,1,2,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Agree,Agree,Agree,Strongly disagree,3,1,2,4,5,8,Neither agree nor disagree,Disagree,Agree,Agree,Agree,1,5,3,4,2,8,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,7,Agree,Agree,Agree,Agree,Agree,4,5,1,3,2,7,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,7,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,2,5,4,3,1,7,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,7,Agree,Agree,Agree,Agree,Agree,3,1,4,2,5,7,Agree,Agree,Agree,Agree,Agree,4,5,2,3,1,6,Agree,Agree,Agree,Agree,Disagree,4,2,3,5,1,7,Agree,Disagree,Agree,Strongly disagree,Agree,4,1,2,5,3,7,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,1,1,1,2,-1,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,01PfPsV,02FUT,10,02DGEN,0.375,0,1,5,9,8,2,3,7,6,1,4,3,4,2,1,2,2,2,-2,-2,0,-2,2,-3,1,2,2,2,0,2,2,2,2,2,-3,0,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,-3,2,2,2,2,2,2,7,8,8,7,7,7,7,7,7,6,7,7 +R_5GjMpIE4fiRenKy,67 - 73,American,Female,Disagree,Agree,Agree,Disagree,Strongly agree,3,4,1,2,5,Agree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,1,2,5,Agree,Agree,Agree,Disagree,Neither Agree nor Disagree,4,2,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Disagree,Agree,Agree,Disagree,Agree,1,5,3,2,4,1,Agree,Strongly disagree,Agree,Strongly disagree,Agree,1,5,2,4,3,1,Agree,Agree,Agree,Disagree,Disagree,1,2,4,5,3,1,Disagree,Agree,Agree,Disagree,Agree,4,5,3,1,2,1,Agree,Disagree,Agree,Disagree,Agree,4,2,5,1,3,1,Agree,Agree,Agree,Disagree,Disagree,4,5,1,3,2,5,Disagree,Agree,Agree,Disagree,Agree,2,5,4,1,3,0,Agree,Strongly disagree,Agree,Strongly disagree,Agree,5,4,3,1,2,0,Agree,Agree,Agree,Disagree,Disagree,5,1,3,4,2,6,Disagree,Agree,Agree,Disagree,Agree,1,3,5,2,4,5,Agree,Strongly disagree,Agree,Strongly disagree,Agree,4,3,5,2,1,5,Agree,Agree,Agree,Disagree,Disagree,2,3,4,5,1,-1,-1,-1,2,0,-1,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,68,01PfPsV,02FUT,10,02DGEN,-0.625,0,1,2,4,5,9,6,8,7,1,3,3,2,4,1,-2,2,2,-2,3,2,-2,3,-3,1,2,2,2,-2,0,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-2,2,-2,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,-2,2,2,-2,2,2,-3,2,-3,2,2,2,2,-2,-2,1,1,1,1,1,1,5,0,0,6,5,5 +R_1Dtp6HBUUIvqJ34,60 - 66,Canadian,Female,Somewhat agree,Agree,Strongly agree,Somewhat disagree,Strongly disagree,4,1,5,3,2,Strongly disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,1,5,3,2,4,Somewhat Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,3,5,2,4,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly disagree,2,5,3,1,4,3,Disagree,Agree,Strongly agree,Strongly agree,Disagree,2,5,1,4,3,1,Agree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,3,4,1,5,2,1,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly disagree,4,1,5,2,3,2,Disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,1,2,3,4,5,3,Agree,Agree,Agree,Strongly Disagree,Strongly agree,3,2,4,1,5,1,Somewhat agree,Agree,Strongly agree,Somewhat agree,Strongly disagree,4,2,1,3,5,2,Disagree,Agree,Somewhat disagree,Agree,Strongly disagree,2,5,1,3,4,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Disagree,Strongly agree,4,3,1,5,2,5,Somewhat agree,Agree,Strongly agree,Agree,Strongly disagree,4,5,1,2,3,2,Strongly disagree,Strongly agree,Agree,Strongly agree,Disagree,3,1,4,2,5,6,Somewhat Agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,1,4,2,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,1,2,2,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),64,03VPfPs,02FUT,5,01ITEM,-0.25,0.333333333,0.666666667,3,6,7,8,4,9,2,1,5,2,4,3,1,1,2,3,-1,-3,-3,0,2,1,1,1,-1,3,0,3,3,3,3,-1,-3,-2,2,3,3,-2,2,1,3,-3,3,3,3,3,0,-3,-2,1,2,2,0,2,2,2,-3,3,1,2,3,1,-3,-2,2,-1,2,-3,0,1,-1,-2,3,1,2,3,2,-3,-3,3,2,3,-2,1,3,3,-3,3,3,1,1,2,3,1,2,3,5,2,6,1 +R_1ktjEcLLJRW45MZ,53 - 59,Canadian,Female,Strongly agree,Agree,Agree,Agree,Somewhat agree,2,3,1,4,5,Strongly agree,Strongly disagree,Somewhat agree,Somewhat disagree,Agree,4,2,5,3,1,Strongly Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,1,2,5,4,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,2,5,1,3,4,2,Strongly agree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,1,4,2,3,5,1,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,5,3,4,1,Strongly agree,Strongly agree,Disagree,Strongly disagree,Strongly agree,5,3,1,4,2,7,Strongly agree,Strongly disagree,Disagree,Strongly disagree,Strongly agree,3,1,4,5,2,2,Disagree,Disagree,Strongly agree,Disagree,Strongly agree,5,1,4,2,3,4,Strongly agree,Somewhat disagree,Strongly agree,Agree,Disagree,4,2,3,1,5,3,Strongly agree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,3,5,2,4,1,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,1,3,4,5,0,Strongly agree,Disagree,Strongly agree,Strongly agree,Disagree,2,4,3,1,5,6,Agree,Strongly disagree,Disagree,Strongly disagree,Strongly agree,1,2,3,5,4,1,Strongly agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,4,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,2,2,2,2,2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,54,01PfPsV,01PAST,10,01ITEM,-0.5,0.333333333,0.666666667,9,6,4,3,7,8,5,1,2,2,3,4,1,3,2,2,2,1,3,-3,1,-1,2,3,-2,3,-3,3,3,3,2,1,2,3,-3,-3,-3,3,1,-2,3,-3,3,3,3,-2,-3,3,3,-3,-2,-3,3,-2,-2,3,-2,3,3,-1,3,2,-2,3,-3,-3,-3,3,3,-3,3,-3,3,3,-2,3,3,-2,2,-3,-2,-3,3,3,-2,3,-3,3,2,1,1,7,2,4,3,0,0,6,1,1 +R_1z96qjJwdFG3cnD,60 - 66,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,5,3,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,5,Disagree,Disagree,Disagree,Disagree,Disagree,1,4,3,2,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,5,1,4,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,3,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,2,5,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,7,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,1,4,2,5,3,8,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,5,2,4,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,2,4,3,1,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Female,University - Undergraduate,61,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,4,5,9,2,6,8,7,1,3,2,3,4,1,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,-2,-2,-2,-2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,4,4,5,5,8,7,8,5,6,5 +R_3rO0N9nfawPgMdW,60 - 66,Canadian,Female,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,4,1,5,3,2,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,3,1,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,2,3,5,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,5,4,3,2,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,5,4,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,5,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,3,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,5,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,4,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,4,1,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,0,1,1,1,5 cents,5 minutes,24 days,Female,University - Undergraduate,60,02PsVPf,01PAST,5,01ITEM,0,0.666666667,0.333333333,9,6,4,5,7,2,3,1,8,2,4,3,1,-1,1,3,-1,1,1,-3,2,-3,1,1,1,1,1,1,0,0,0,0,0,1,-3,1,-3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5 +R_11oBW0skPXtpXIv,53 - 59,Canadian,Female,Strongly agree,Agree,Agree,Somewhat agree,Agree,1,4,5,2,3,Strongly disagree,Disagree,Agree,Somewhat agree,Somewhat agree,3,4,5,1,2,Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,5,3,1,2,Agree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,3,5,1,2,4,1,Strongly disagree,Disagree,Agree,Somewhat agree,Neither agree nor disagree,2,3,1,4,5,1,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,2,4,5,1,3,1,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,2,1,5,3,4,1,Strongly disagree,Disagree,Agree,Agree,Neither agree nor disagree,3,2,5,1,4,1,Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,3,5,2,4,1,1,Strongly agree,Agree,Agree,Somewhat agree,Agree,5,1,2,4,3,0,Strongly disagree,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,3,1,4,5,2,1,Agree,Disagree,Strongly agree,Disagree,Strongly agree,4,5,3,1,2,0,Strongly agree,Agree,Agree,Somewhat agree,Somewhat agree,5,3,2,4,1,1,Strongly disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,3,2,1,4,1,Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,3,2,4,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,1,2,2,1,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),57,03VPfPs,02FUT,10,01ITEM,0,0.666666667,0.333333333,3,8,6,2,7,4,9,1,5,4,3,2,1,3,2,2,1,2,-3,-2,2,1,1,2,-2,3,0,3,2,2,3,0,1,-3,-2,2,1,0,2,-1,2,0,2,2,2,3,0,2,-3,-2,2,2,0,2,-1,2,1,2,3,2,2,1,2,-3,-3,2,0,1,2,-2,3,-2,3,3,2,2,1,1,-3,-2,1,-2,1,2,0,3,0,3,1,1,1,1,1,1,0,1,0,1,1,0 +R_7Cqyd4rdpJbp2XA,39 - 45,Canadian,Male,Agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,1,5,4,3,2,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,1,3,5,2,4,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Agree,4,5,3,2,1,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,1,2,4,3,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,3,1,2,5,2,Strongly agree,Agree,Agree,Strongly agree,Agree,1,4,5,3,2,2,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,5,3,2,1,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,4,2,5,1,Agree,Agree,Strongly agree,Agree,Strongly agree,4,2,3,1,5,1,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,1,5,3,2,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,2,4,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,3,4,5,1,1,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,2,5,1,3,4,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,2,4,5,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,1,3,4,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,0,1,0,2,2,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,40,02PsVPf,02FUT,5,01ITEM,0.375,0.666666667,0.333333333,9,6,4,5,8,2,7,1,3,4,3,2,1,2,3,2,-1,3,-3,-3,1,-3,2,2,0,3,1,2,3,3,3,0,3,2,-3,3,-3,3,3,2,2,3,2,3,3,3,0,3,2,-3,3,-3,3,2,2,3,2,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,3,3,3,0,2,1,-3,3,-3,2,3,3,3,3,3,0,2,2,1,1,1,0,0,1,2,2,0 +R_3GWBRFzkpJqGUh3,60 - 66,Canadian,Female,Agree,Agree,Strongly agree,Somewhat agree,Agree,2,3,1,4,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,2,4,5,3,Agree,Agree,Agree,Agree,Agree,1,5,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat disagree,Agree,Strongly agree,Strongly agree,Somewhat disagree,2,5,3,4,1,5,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,2,5,4,1,3,5,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,5,Somewhat disagree,Somewhat disagree,Strongly agree,Strongly agree,Somewhat disagree,4,2,5,3,1,5,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,3,5,2,4,1,5,Agree,Agree,Agree,Agree,Agree,3,1,5,4,2,5,Agree,Agree,Agree,Strongly agree,Somewhat disagree,4,1,5,2,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,2,4,3,1,5,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,5,Agree,Agree,Agree,Strongly agree,Somewhat disagree,5,1,2,4,3,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,2,5,3,1,5,Agree,Agree,Agree,Agree,Agree,4,3,2,5,1,1,2,2,1,-1,0,1,0,10 cents,100 minutes,47 days,Female,University - Undergraduate,63,03VPfPs,01PAST,10,02DGEN,0.5,0.333333333,0.666666667,2,4,5,3,8,6,9,1,7,3,2,4,1,2,2,3,1,2,-1,-1,1,-1,-1,2,2,2,2,2,-1,2,3,3,-1,-1,-1,2,-1,-1,2,2,2,2,2,-1,-1,3,3,-1,-1,-1,2,-1,-1,2,2,2,2,2,2,2,2,3,-1,-1,-1,1,-1,-1,2,2,2,2,2,2,2,2,3,-1,-1,1,1,-1,-1,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5,5,5 +R_51YHqKEJJENxnsT,67 - 73,Canadian,Female,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,1,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,2,5,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,1,5,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,1,3,5,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,4,5,1,2,3,5,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,1,2,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,3,4,1,5,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,3,1,2,4,5,5,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,3,5,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,5,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,3,4,1,5,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,2,1,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,5,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,3,4,2,5,1,0,1,1,1,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,72,01PfPsV,01PAST,5,02DGEN,0.125,0,1,4,2,9,6,3,5,8,1,7,4,3,2,1,2,3,3,2,3,0,0,2,0,0,1,0,1,0,3,2,3,3,2,3,0,0,2,0,0,2,0,0,0,2,2,3,3,2,3,0,0,2,0,0,2,2,0,0,3,2,3,3,3,2,0,0,0,0,0,2,0,0,0,3,3,3,3,3,2,0,0,2,0,0,2,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5 +R_1knRqoe1tDTO7yI,60 - 66,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,5,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,1,2,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,2,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,4,2,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,1,5,4,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,2,4,5,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,3,4,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,3,2,4,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,5,4,2,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,3,4,1,4,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,2,5,4,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,5,3,1,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,1,4,0,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Male,High School (or equivalent),65,01PfPsV,01PAST,10,02DGEN,0,0.333333333,0.666666667,4,6,2,7,9,8,3,1,5,2,3,4,1,1,1,1,1,1,0,1,1,-1,0,0,0,0,0,0,1,1,1,1,1,-1,0,1,-1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,-1,0,0,0,0,0,0,1,1,1,1,-1,0,0,-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,4,4,4,5,4,3,4,4,4,4,3,4 +R_5Qb8IPQ9YrJekjD,32 - 38,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,2,4,1,,Neither agree nor disagree,Strongly agree,Agree,Agree,4,2,1,5,3,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,2,4,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,1,2,5,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,3,2,7,Agree,Somewhat agree,Agree,Agree,Strongly agree,5,1,2,4,3,6,Somewhat Agree,Agree,Agree,Agree,Agree,1,3,5,4,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,3,4,7,Agree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,1,2,4,3,5,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,4,2,3,1,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,5,4,6,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,5,4,2,3,6,Somewhat Agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,3,1,2,4,1,2,2,2,-2,-2,-1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),35,03VPfPs,02FUT,10,02DGEN,1.125,0,1,9,6,8,2,3,5,7,1,4,4,2,3,1,2,3,3,3,3,,0,3,2,2,1,2,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,2,3,1,2,2,2,2,3,3,3,3,3,2,2,3,1,3,3,3,3,2,3,3,3,3,3,3,0,1,3,0,3,1,3,3,2,3,7,7,7,7,7,6,5,7,5,7,6,6 +R_16kmB5kTriqlNwl,60 - 66,Canadian,Male,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,1,3,4,2,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,1,2,5,3,4,Somewhat Agree,Agree,Strongly Agree,Agree,Somewhat Agree,4,2,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,2,3,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,3,1,5,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,1,2,4,7,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,2,1,3,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,4,5,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,3,4,2,7,Disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,1,4,5,3,7,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Disagree,1,2,5,3,4,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,2,3,4,7,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,4,3,5,2,1,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,3,5,4,2,1,7,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,1,2,4,5,3,0,0,0,-1,0,-1,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),64,01PfPsV,02FUT,10,02DGEN,0.5,0,1,4,3,8,7,9,5,6,1,2,3,2,4,1,-1,1,1,-1,1,1,-2,1,0,-2,1,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,-2,1,3,0,3,1,0,2,1,-2,1,1,1,1,1,-3,0,3,1,1,0,1,1,0,-2,1,1,2,1,1,7,7,7,7,7,7,7,7,7,7,7,7 +R_178SNJMlkqAz6qK,60 - 66,Canadian,Female,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,2,5,4,3,1,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,3,5,1,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,3,5,1,4,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,4,2,1,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,5,3,1,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,1,3,4,2,5,7,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,4,5,2,3,7,Agree,Agree,Agree,Agree,Agree,2,1,4,5,3,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,5,3,2,4,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,4,5,3,1,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Strongly agree,3,2,4,5,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,2,5,7,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,-1,-1,-1,0,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),63,03VPfPs,02FUT,10,01ITEM,0.5,0.666666667,0.333333333,7,5,8,4,6,9,2,1,3,2,3,4,1,0,1,2,2,2,1,1,2,2,1,2,2,2,2,2,0,1,1,2,2,1,1,1,1,1,1,1,1,1,1,0,1,1,2,2,1,1,1,2,1,2,2,2,2,2,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,1,2,3,1,1,1,1,1,2,2,2,2,2,7,7,7,7,7,7,7,7,7,7,7,7 +R_5TWWxJFZ6ORvZKs,67 - 73,Canadian,Female,Strongly agree,Somewhat agree,Somewhat agree,Strongly disagree,Somewhat agree,4,3,2,1,5,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,2,3,5,1,4,Agree,Disagree,Strongly Agree,Agree,Strongly Agree,2,3,4,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Agree,Somewhat agree,Strongly disagree,Somewhat agree,5,1,4,3,2,6,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,3,2,4,1,5,4,Agree,Disagree,Strongly agree,Agree,Agree,4,3,2,5,1,7,Strongly agree,Somewhat agree,Somewhat agree,Strongly disagree,Agree,1,4,2,5,3,7,Agree,Strongly disagree,Agree,Strongly disagree,Agree,3,4,2,5,1,7,Agree,Somewhat Disagree,Agree,Agree,Agree,3,1,2,5,4,3,Strongly agree,Agree,Agree,Disagree,Agree,4,3,5,1,2,2,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,5,4,3,2,1,6,Agree,Disagree,Strongly agree,Strongly agree,Strongly agree,3,5,1,2,4,2,Strongly agree,Agree,Agree,Disagree,Somewhat agree,3,4,1,2,5,2,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,4,3,5,1,2,2,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,1,5,4,2,3,0,1,1,1,1,-1,1,-1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),67,03VPfPs,01PAST,5,02DGEN,-0.125,1,0,2,8,3,5,6,7,9,1,4,2,3,4,1,3,1,1,-3,1,0,-3,2,-3,1,2,-2,3,2,3,2,2,1,-3,1,1,-2,2,-2,1,2,-2,3,2,2,3,1,1,-3,2,2,-3,2,-3,2,2,-1,2,2,2,3,2,2,-2,2,1,-3,2,-2,2,2,-2,3,3,3,3,2,2,-2,1,1,-3,2,-3,2,2,-1,3,2,3,6,6,4,7,7,7,3,2,6,2,2,2 +R_3OsrskvBYHuEQZX,39 - 45,Canadian,Male,Disagree,Agree,Agree,Disagree,Agree,5,4,2,3,1,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,2,4,1,5,3,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,2,4,Disagree,Agree,Somewhat agree,Disagree,Neither agree nor disagree,3,2,4,5,1,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,3,2,4,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,4,2,5,3,Disagree,Agree,Somewhat agree,Disagree,Neither agree nor disagree,3,5,1,4,2,3,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Agree,2,1,3,4,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,5,3,4,4,Disagree,Agree,Agree,Disagree,Agree,3,1,2,4,5,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Agree,1,4,5,2,3,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,3,4,1,5,2,3,Disagree,Agree,Agree,Disagree,Agree,2,1,4,3,5,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Agree,1,5,2,4,3,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,4,2,5,1,3,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-1,1,0,2,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),42,02PsVPf,01PAST,10,01ITEM,0.75,0.333333333,0.666666667,5,9,8,7,2,6,3,1,4,3,2,4,1,-2,2,2,-2,2,0,1,2,0,3,0,1,2,0,1,-2,2,1,-2,0,0,0,2,-1,0,0,0,2,0,1,-2,2,1,-2,0,0,-2,2,-1,2,0,0,2,0,1,-2,2,2,-2,2,0,0,2,-2,2,1,0,2,-1,2,-2,2,2,-2,2,0,0,2,-2,2,1,0,2,-1,2,3,4,3,3,4,4,3,3,3,3,3,3 +R_72UXwfr2cJYIU81,67 - 73,Canadian,Male,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,4,2,1,3,5,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,3,1,5,4,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,2,1,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,1,3,5,4,2,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,3,5,2,4,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,5,1,2,3,4,1,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,5,4,2,3,1,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,2,4,3,5,5,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,4,3,2,1,5,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,3,1,4,2,5,0,Strongly disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,Neither agree nor disagree,3,1,2,4,5,0,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,1,2,3,5,4,0,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,4,2,5,1,3,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,2,3,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,1,4,2,5,2,2,2,2,2,2,2,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,71,01PfPsV,01PAST,10,02DGEN,-0.25,1,0,5,4,2,3,8,7,9,1,6,2,3,4,1,-1,1,3,-1,1,-2,-3,3,-3,0,3,1,3,-3,3,-1,1,3,-1,1,-3,-3,3,-3,0,3,2,3,-3,3,-1,1,3,-1,3,-3,-3,3,-3,1,3,2,3,-3,3,0,0,2,1,0,-3,0,1,-3,0,3,1,2,-3,3,0,1,3,1,-1,0,0,-1,0,0,3,0,3,-3,3,0,0,0,1,0,5,0,0,0,0,0,0 +R_1EbeN9UHK0dbvBg,67 - 73,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Somewhat agree,5,1,4,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,1,4,2,Agree,Agree,Agree,Agree,Agree,5,1,2,4,3,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,3,1,2,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,1,5,3,8,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,5,1,2,7,Agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,3,1,5,4,2,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,4,2,3,1,5,9,Agree,Agree,Agree,Agree,Agree,5,3,1,4,2,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,2,3,5,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,2,4,1,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,5,3,4,5,Agree,Agree,Agree,Agree,Agree,1,3,4,5,2,9,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,4,1,5,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,1,-1,0,-1,0,0,10 cents,5 minutes,24 days,Male,Trade School (non-military),71,01PfPsV,01PAST,5,01ITEM,0.5,0.333333333,0.666666667,8,5,4,9,7,2,3,1,6,3,4,2,1,1,3,3,2,1,1,1,1,0,1,2,2,2,2,2,2,2,2,2,0,1,1,1,0,1,2,2,1,0,1,2,3,3,2,0,1,1,0,1,2,2,2,2,2,2,3,3,3,3,1,1,1,1,1,1,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,1,1,1,1,1,8,8,7,6,9,6,8,9,5,9,8,8 +R_6E0JAaiEmjZbWTn,67 - 73,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Agree,1,3,5,2,4,Agree,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat disagree,5,4,1,2,3,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Somewhat Agree,2,1,5,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,2,3,4,5,1,2,Strongly agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,3,1,5,2,4,2,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Somewhat Agree,3,2,1,5,4,3,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Agree,5,4,3,1,2,2,Strongly agree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,1,3,4,5,2,2,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Somewhat Agree,2,5,4,3,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat disagree,5,3,4,2,1,2,Strongly agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,5,2,4,1,3,8,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Somewhat Agree,1,4,3,2,5,2,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat disagree,4,5,2,1,3,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,5,2,1,4,2,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,5,4,2,3,1,0,2,0,1,-2,1,2,2,10 cents,25 minutes,36 days,Female,High School (or equivalent),67,03VPfPs,02FUT,5,02DGEN,0.25,0,0.333333333,4,5,7,8,6,9,3,1,2,2,3,4,1,3,3,3,-3,2,2,-2,0,-3,-1,3,3,3,-1,1,3,3,3,-3,1,3,-3,2,-3,0,3,3,3,-1,1,3,3,3,-3,2,3,-3,0,-3,0,3,3,3,1,1,3,3,3,-3,-1,3,-3,2,-3,0,3,3,3,-1,1,3,3,3,-3,-1,3,-3,3,-3,0,3,3,3,-1,0,2,2,2,3,2,2,1,2,8,2,2,2 +R_3GqfnDGO35wRWf0,67 - 73,Canadian,Male,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly disagree,2,4,5,3,1,Somewhat agree,Disagree,Agree,Strongly agree,Somewhat agree,1,4,2,5,3,Agree,Agree,Somewhat Agree,Disagree,Neither Agree nor Disagree,2,5,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,2,5,1,4,3,Disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,Disagree,3,5,1,4,2,1,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,4,1,3,4,Agree,Agree,Agree,Somewhat agree,Somewhat agree,2,4,3,1,5,9,Somewhat agree,Disagree,Strongly agree,Somewhat agree,Agree,2,5,1,4,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,2,4,1,3,4,Agree,Agree,Strongly agree,Agree,Disagree,4,3,5,2,1,0,Somewhat agree,Disagree,Agree,Strongly agree,Disagree,2,1,3,4,5,1,Agree,Agree,Agree,Disagree,Somewhat Agree,4,1,3,2,5,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,2,4,1,3,5,3,Disagree,Strongly disagree,Somewhat agree,Strongly agree,Disagree,4,1,3,5,2,5,Agree,Agree,Agree,Disagree,Agree,5,4,3,2,1,-1,1,0,2,2,0,1,0,10 cents,5 minutes,24 days,Male,University - Undergraduate,71,02PsVPf,02FUT,10,02DGEN,-0.625,0.333333333,0.666666667,4,9,7,2,3,6,5,1,8,4,3,2,1,3,1,3,1,-3,1,-2,2,3,1,2,2,1,-2,0,2,2,2,2,0,-2,0,-1,3,-2,2,2,2,0,1,2,2,2,1,1,1,-2,3,1,2,3,3,3,3,2,2,2,3,2,-2,1,-2,2,3,-2,2,2,2,-2,1,3,3,3,3,-3,-2,-3,1,3,-2,2,2,2,-2,2,2,3,1,4,9,5,4,0,1,2,3,5 +R_1roQArTUr5xbbQs,53 - 59,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,3,1,4,5,2,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,1,2,5,4,3,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,1,4,3,5,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat disagree,Strongly agree,4,3,2,5,1,7,Agree,Agree,Agree,Somewhat disagree,Agree,1,4,5,3,2,5,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Disagree,2,5,1,4,3,4,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,Strongly agree,3,2,5,4,1,3,Agree,Agree,Agree,Somewhat disagree,Agree,4,3,2,5,1,3,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Disagree,4,5,3,1,2,3,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,3,1,2,4,5,3,Agree,Somewhat agree,Agree,Somewhat agree,Agree,2,5,4,1,3,3,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,4,3,2,5,1,3,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,3,5,4,2,1,3,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,1,2,5,4,3,3,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,2,4,3,5,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,-1,1,1,0,10 cents,5 minutes,15 days,Male,High School (or equivalent),56,01PfPsV,02FUT,5,01ITEM,0,0.333333333,0.333333333,3,7,6,2,8,4,9,1,5,2,4,3,1,1,3,1,1,3,1,1,2,0,2,1,1,2,0,3,1,3,-1,-1,3,2,2,2,-1,2,1,2,2,1,-1,1,3,1,-1,3,2,2,2,-1,2,1,2,2,1,-1,1,3,1,1,3,2,1,2,1,2,1,2,2,0,-1,1,3,2,2,3,1,1,2,0,2,1,2,2,0,-1,7,5,4,3,3,3,3,3,3,3,3,3 +R_7VJf8j0xeT8tSlX,67 - 73,Canadian,Male,Agree,Agree,Agree,Agree,Agree,3,2,1,4,5,Disagree,Disagree,Disagree,Somewhat disagree,Somewhat agree,1,2,4,5,3,Somewhat Agree,Agree,Agree,Disagree,Agree,4,1,5,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,7,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,3,2,4,5,1,7,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,2,3,1,4,5,7,Agree,Agree,Agree,Agree,Agree,4,3,2,5,1,7,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Agree,5,1,3,4,2,7,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,Agree,2,1,4,3,5,7,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,7,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,3,2,4,1,5,7,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,5,4,1,2,3,7,Agree,Agree,Agree,Agree,Agree,4,5,3,1,2,7,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,4,3,5,2,7,Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,2,5,4,1,3,2,2,2,2,-2,-2,1,2,5 cents,25 minutes,24 days,Male,University - Undergraduate,69,03VPfPs,02FUT,10,02DGEN,1.125,0.333333333,0.333333333,9,6,7,5,8,4,3,1,2,4,2,3,1,2,2,2,2,2,-2,-2,-2,-1,1,1,2,2,-2,2,2,2,2,2,2,0,-2,2,-2,1,0,2,2,0,2,2,2,2,2,2,0,-2,2,0,2,0,2,1,1,2,2,2,2,2,2,-2,-2,1,-2,1,0,2,2,0,2,2,2,2,2,2,0,-2,1,-2,1,-2,2,2,0,2,7,7,7,7,7,7,7,7,7,7,7,7 +R_3R5dVDIQi5KNKvv,39 - 45,Canadian,Male,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,1,3,2,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,2,3,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,3,1,4,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,5,4,3,2,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,3,2,5,4,7,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,5,2,4,3,1,8,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,4,1,3,2,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,1,4,5,3,2,7,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,2,4,1,3,5,4,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,5,3,1,2,8,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,5,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,1,5,3,2,5,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,1,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Disagree,5,3,1,2,4,6,Neither Agree nor Disagree,Somewhat Agree,Agree,Disagree,Somewhat Disagree,4,5,1,3,2,1,-1,0,1,1,-1,0,0,15 cents,25 minutes,24 days,Male,University - Undergraduate,40,02PsVPf,01PAST,5,02DGEN,-0.125,0,0.333333333,9,7,8,4,2,6,5,1,3,3,2,4,1,0,0,0,-1,1,-1,0,1,1,0,1,0,-1,2,0,0,0,1,-1,-1,0,1,1,0,-1,1,-1,0,-1,1,0,0,1,-1,-1,0,1,0,-1,-1,-1,1,0,-1,0,0,-1,0,0,1,1,-1,1,0,0,-1,-1,0,0,1,1,0,0,0,-1,1,-1,1,0,-2,0,1,2,-2,-1,6,2,7,8,5,7,4,8,5,5,1,6 +R_71YoY39t8fQWagj,67 - 73,Canadian,Male,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Disagree,2,3,5,1,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,3,1,4,5,Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,4,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Somewhat disagree,Strongly disagree,5,1,3,4,2,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,4,5,3,2,2,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,1,4,3,2,2,Agree,Agree,Agree,Disagree,Strongly disagree,5,4,2,1,3,6,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,4,1,2,5,Agree,Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,1,2,4,5,3,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Disagree,3,2,5,1,4,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,5,2,1,4,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,3,4,5,2,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Disagree,2,3,5,1,4,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,1,4,2,3,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,2,4,3,1,1,1,0,2,-1,-1,1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),67,01PfPsV,02FUT,5,02DGEN,0.25,0,1,8,5,7,6,3,4,9,1,2,4,3,2,1,1,1,2,1,-2,0,-1,1,-1,0,2,2,1,-1,1,2,2,2,-1,-3,-1,-1,1,-1,1,1,2,1,-1,1,2,2,2,-2,-3,-1,-1,1,-1,1,2,2,1,-1,0,1,1,2,1,-2,-1,-1,1,0,-1,1,1,1,-1,1,1,1,2,1,-2,1,-1,1,-1,1,2,1,1,-1,1,2,3,2,2,6,5,1,1,4,2,2,2 +R_7cuR9hbpAq3nAnE,39 - 45,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,5,1,3,Neither agree nor disagree,Strongly disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,4,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,1,5,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,3,4,1,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,6,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,5,2,4,6,Agree,Agree,Agree,Agree,Agree,1,2,4,5,3,5,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,2,1,4,5,6,Agree,Agree,Agree,Agree,Agree,1,3,4,5,2,6,Agree,Agree,Agree,Somewhat disagree,Agree,4,5,3,1,2,6,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,3,2,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,2,3,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,5,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-1,-1,-1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),41,02PsVPf,01PAST,10,01ITEM,1,0,1,9,5,7,2,3,8,4,1,6,2,4,3,1,3,3,3,2,3,0,-3,1,-1,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,2,2,2,3,3,2,3,3,2,2,2,2,2,2,2,2,-1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,6,6,6,6,5,6,6,6,6,6,6,6 +R_1pmqJMM4oQ6npwW,67 - 73,Canadian,Female,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,1,5,4,2,Disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Disagree,Strongly Agree,2,5,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Somewhat agree,Agree,Agree,Strongly agree,5,2,1,4,3,1,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,4,1,5,3,1,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Strongly agree,4,5,1,3,2,1,Agree,Somewhat agree,Agree,Agree,Agree,2,3,5,4,1,0,Disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,4,5,3,2,0,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Strongly agree,5,4,2,1,3,1,Agree,Somewhat agree,Agree,Agree,Somewhat agree,1,4,5,3,2,0,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,0,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Strongly agree,3,4,2,1,5,2,Agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,3,4,2,5,1,1,Strongly disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Strongly disagree,4,3,2,1,5,6,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Strongly agree,4,1,5,2,3,1,0,1,2,-1,2,0,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),68,03VPfPs,02FUT,10,02DGEN,0.125,0,1,2,6,8,9,5,3,4,1,7,3,2,4,1,1,0,1,0,1,-2,-1,1,0,0,3,2,0,-3,3,2,1,2,2,3,-2,-2,1,-2,0,3,3,1,-3,3,2,1,2,2,2,-2,-2,2,-1,0,3,3,1,-3,3,2,1,2,2,1,-2,-2,1,0,0,3,3,1,-3,3,2,1,2,1,0,-3,-1,-1,1,-3,3,3,1,-3,3,0,1,1,1,0,0,1,0,0,2,1,6 +R_7uZCyK6Aaj5UCUp,46 - 52,Canadian,Male,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Strongly agree,2,3,1,5,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,5,4,2,3,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,3,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,2,4,1,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,4,3,1,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,4,3,1,6,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Strongly agree,4,2,3,5,1,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,2,3,5,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,2,5,4,5,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,4,3,2,1,5,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,1,3,2,5,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,3,4,2,1,5,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,1,3,2,5,7,Somewhat Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,1,2,4,5,3,1,0,2,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,47,03VPfPs,02FUT,10,02DGEN,0.5,0,1,9,4,2,7,6,8,3,1,5,4,3,2,1,0,1,1,2,3,0,1,1,-1,0,1,1,2,0,0,-1,1,1,0,3,0,1,1,-1,0,0,0,1,0,1,-1,2,1,0,3,0,1,1,-1,1,0,0,1,1,1,-1,1,-1,0,3,0,1,1,-1,1,0,0,1,1,0,-1,1,-1,0,3,0,1,1,-1,0,-1,0,2,1,0,6,7,6,6,6,6,5,6,5,6,6,7 +R_1LC0QxEHI6yw8Wv,60 - 66,Canadian,Male,Disagree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,1,3,5,2,4,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,3,1,5,4,2,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Disagree,Agree,Strongly agree,Somewhat disagree,Strongly agree,5,3,2,4,1,6,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,4,1,2,5,5,Strongly agree,Agree,Agree,Agree,Strongly agree,1,3,4,2,5,5,Disagree,Agree,Strongly agree,Disagree,Strongly agree,1,4,3,2,5,6,Somewhat disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat agree,5,1,4,3,2,5,Strongly agree,Somewhat Agree,Somewhat Agree,Strongly agree,Strongly agree,4,1,2,5,3,6,Disagree,Somewhat agree,Strongly agree,Agree,Somewhat agree,5,1,2,3,4,6,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,5,1,4,3,6,Strongly agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,1,2,4,5,3,6,Strongly disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,2,3,1,4,5,7,Disagree,Somewhat agree,Agree,Somewhat agree,Disagree,3,2,1,5,4,7,Agree,Somewhat Agree,Somewhat Disagree,Disagree,Strongly agree,5,4,1,2,3,2,2,2,2,1,2,2,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,64,02PsVPf,01PAST,10,02DGEN,0.125,0,1,9,3,4,6,5,8,7,1,2,2,3,4,1,-2,1,3,-1,3,-1,-3,2,-3,0,3,1,3,1,3,-2,2,3,-1,3,0,-3,2,-3,1,3,2,2,2,3,-2,2,3,-2,3,-1,-3,2,-1,1,3,1,1,3,3,-2,1,3,2,1,-1,1,1,1,-1,3,2,0,-1,3,-3,1,3,3,1,-2,1,2,1,-2,2,1,-1,-2,3,5,6,5,5,6,5,6,6,6,6,7,7 +R_6C9AQLLL5nQzlxj,67 - 73,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,5,2,1,3,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,2,5,1,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,2,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,2,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,0,Agree,Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,5,3,4,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,4,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,4,5,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,5,2,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,1,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,3,1,2,4,5,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,4,3,1,2,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,2,2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,68,01PfPsV,02FUT,10,01ITEM,0,0.333333333,0.666666667,7,2,3,8,5,6,9,1,4,4,2,3,1,3,3,2,1,3,3,-2,3,-1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,-2,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-2,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-2,3,3,0,3,-1,3,0,0,0,0,0,0,0,0,0,1,1,0 +R_5jx1hmHr7WuUxA1,67 - 73,Canadian,Female,Strongly agree,Agree,Neither agree nor disagree,Agree,Strongly disagree,1,4,5,2,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,3,1,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,2,1,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,4,Agree,Agree,Agree,Somewhat Agree,Agree,3,2,5,1,4,6,Strongly agree,Agree,Somewhat agree,Somewhat agree,Disagree,4,5,3,1,2,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,2,3,4,5,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,3,4,2,1,5,6,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,Strongly disagree,5,1,3,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,3,Agree,Agree,Agree,Agree,Agree,5,3,4,2,1,5,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly disagree,4,1,3,2,5,6,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,4,2,1,5,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,3,1,4,0,0,1,1,-1,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),70,02PsVPf,01PAST,10,02DGEN,0.125,0,1,9,2,5,3,7,8,4,1,6,2,4,3,1,3,2,0,2,-3,0,0,2,0,0,1,1,0,0,2,3,0,0,0,-3,0,0,0,0,0,2,2,2,1,2,3,2,1,1,-2,-1,0,1,1,0,1,2,0,0,2,3,2,0,1,-3,0,0,0,0,0,2,2,2,2,2,3,1,1,1,-3,-1,0,1,0,1,1,1,1,0,1,7,5,4,6,5,5,6,5,3,5,6,7 +R_5NCl33fWpDZKrBX,60 - 66,Canadian,Female,Somewhat agree,Agree,Strongly agree,Strongly agree,Strongly disagree,2,3,5,4,1,Strongly disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,3,2,5,1,4,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,3,4,2,1,5,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly disagree,2,5,4,3,1,6,Strongly disagree,Agree,Strongly agree,Strongly agree,Strongly disagree,5,2,4,1,3,6,Strongly agree,Strongly agree,Agree,Somewhat Agree,Strongly agree,4,5,1,3,2,6,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly disagree,4,3,2,5,1,7,Strongly disagree,Somewhat disagree,Agree,Somewhat agree,Agree,5,1,3,4,2,7,Strongly agree,Agree,Agree,Agree,Strongly agree,1,4,5,3,2,6,Somewhat agree,Agree,Strongly agree,Strongly agree,Strongly disagree,3,1,5,4,2,7,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,4,3,2,1,5,7,Strongly agree,Agree,Agree,Strongly Disagree,Agree,2,5,3,4,1,4,Somewhat disagree,Somewhat disagree,Strongly agree,Strongly agree,Strongly disagree,3,4,1,2,5,3,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,Disagree,2,5,1,4,3,7,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,5,4,1,3,2,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,2,0,1,1,0,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,64,01PfPsV,02FUT,5,01ITEM,0.125,0.333333333,0.666666667,2,6,5,4,9,8,3,1,7,4,2,3,1,1,2,3,3,-3,-3,-1,2,1,-1,3,1,2,0,3,3,3,3,0,-3,-3,2,3,3,-3,3,3,2,1,3,3,3,3,0,-3,-3,-1,2,1,2,3,2,2,2,3,1,2,3,3,-3,-3,2,0,1,-1,3,2,2,-3,2,-1,-1,3,3,-3,-3,2,0,1,-2,2,1,2,-3,2,6,6,6,7,7,6,7,7,4,3,7,6 +R_5bshrQuHqvVktBn,67 - 73,Canadian,Male,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,1,2,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,4,1,2,5,Neither Agree nor Disagree,Disagree,Agree,Disagree,Agree,5,2,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Strongly agree,Agree,Somewhat agree,Somewhat agree,5,1,2,3,4,5,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,4,1,3,5,2,5,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,2,5,3,4,1,5,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,5,2,5,Agree,Neither agree nor disagree,Agree,Disagree,Agree,1,4,2,5,3,5,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,1,3,4,5,2,5,Agree,Strongly agree,Agree,Agree,Agree,1,4,2,5,3,5,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,4,3,5,1,2,5,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Strongly agree,1,5,2,3,4,5,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,4,2,1,5,5,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,1,5,4,2,3,1,2,1,2,0,1,2,2,10 cents,25 minutes,24 days,Male,High School (or equivalent),71,03VPfPs,01PAST,5,02DGEN,0.125,0,0.666666667,5,8,3,2,4,9,6,1,7,2,3,4,1,2,2,1,1,1,1,1,1,-1,1,0,-2,2,-2,2,2,3,2,1,1,2,0,1,-2,0,1,-1,2,-1,3,2,2,1,1,1,2,0,2,-2,2,1,-1,2,-1,3,2,3,2,2,2,2,0,1,-1,2,1,-1,2,-2,3,2,2,2,2,2,1,0,1,-1,1,1,-1,2,-1,3,5,5,5,5,5,5,5,5,5,5,6,5 +R_539NZp5Iy0ntBF7,60 - 66,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,4,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,4,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,2,5,3,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,1,2,4,8,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,4,5,3,2,7,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,1,2,3,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,3,4,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,8,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,2,4,1,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,4,5,3,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,2,1,3,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,5,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,3,4,5,0,1,0,1,-1,-1,0,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,62,03VPfPs,02FUT,10,02DGEN,0.375,0,1,7,2,6,4,9,5,3,1,8,2,3,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,1,0,-2,1,-2,1,1,1,1,1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,7,8,7,8,8,8,7,8,8,8 +R_1OTmhMegKLREAOR,60 - 66,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,1,5,2,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,1,2,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,4,1,2,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,5,1,4,2,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,3,1,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,3,2,4,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,1,4,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,1,4,2,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,2,3,4,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,3,2,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,4,3,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,5,2,4,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,3,1,5,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,3,2,1,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,2,-1,1,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),63,03VPfPs,02FUT,5,01ITEM,0,0,1,8,6,2,7,9,5,3,1,4,2,4,3,1,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,1,3,-3,3,-3,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_62sPBPIuEjdbMtZ,46 - 52,Canadian,Female,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,3,1,4,2,5,Agree,Strongly disagree,Agree,Disagree,Agree,2,5,4,1,3,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,4,2,5,3,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,3,1,4,2,5,2,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,1,4,5,2,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,5,1,3,2,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,4,2,5,1,3,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,4,3,2,5,2,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,2,3,1,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,4,3,5,1,2,2,Agree,Strongly disagree,Agree,Strongly disagree,Agree,4,2,1,5,3,2,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,1,4,2,3,5,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,5,3,2,1,4,2,Agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,1,4,3,2,5,2,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,1,2,3,4,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,1,-1,0,-1,0,1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,50,02PsVPf,01PAST,5,01ITEM,0.5,0.333333333,0.666666667,9,4,7,8,6,2,3,1,5,2,3,4,1,0,0,3,1,3,2,-3,2,-2,2,3,3,1,2,3,0,0,3,1,3,2,-3,3,-3,3,3,3,2,3,3,0,0,3,1,3,1,-3,3,-3,2,3,3,2,2,3,0,0,3,1,3,2,-3,2,-3,2,3,3,2,2,3,0,0,3,1,3,2,-3,2,-3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,2,2,2 +R_5EveSLgf170LhxT,67 - 73,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,5,4,3,1,Somewhat agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,1,2,5,4,3,Strongly Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,4,2,1,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,5,4,2,3,1,5,Agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,3,1,2,4,5,2,Strongly agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Strongly agree,3,1,5,4,2,7,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,4,5,3,2,2,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,2,3,5,1,4,1,Strongly agree,Somewhat Disagree,Agree,Agree,Strongly agree,1,3,2,4,5,6,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,1,3,4,5,2,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,4,1,5,3,2,4,Strongly agree,Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,5,2,1,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,3,2,1,4,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,1,5,4,4,Strongly agree,Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,4,1,2,5,3,1,1,1,2,-1,-1,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,01PfPsV,01PAST,10,02DGEN,0.25,0,1,6,9,3,8,2,4,7,1,5,2,4,3,1,3,3,3,3,2,1,1,3,2,1,3,-1,1,0,3,1,3,3,-1,3,2,1,3,1,1,3,-1,1,-1,3,1,3,3,-1,3,3,1,3,1,1,3,-1,2,2,3,3,2,3,3,-1,-1,1,1,1,-2,3,-2,1,-3,3,3,3,3,3,2,0,1,1,1,-1,3,-2,1,-3,3,1,5,2,7,2,1,6,4,4,1,4,4 +R_3Pu9IZ9Xbl6mTKK,46 - 52,Canadian,Male,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,3,1,4,2,5,Agree,Disagree,Agree,Strongly disagree,Agree,3,5,2,1,4,Somewhat Agree,Strongly Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,5,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,1,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,2,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,2,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,4,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,3,5,2,1,1,1,1,-1,1,0,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),51,01PfPsV,02FUT,5,02DGEN,0.375,0.666666667,0.333333333,4,2,5,9,8,6,3,1,7,4,2,3,1,0,3,3,-3,3,2,-2,2,-3,2,1,3,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,6,5,5,5,5,5,5,5 +R_7CPbhi1vrmwrSEc,67 - 73,Canadian,Female,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,4,2,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,1,3,4,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,2,3,1,5,4,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,2,3,1,1,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,3,1,4,2,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Strongly agree,2,5,4,3,1,2,Somewhat agree,Agree,Strongly agree,Disagree,Strongly agree,2,3,1,5,4,4,Disagree,Disagree,Strongly agree,Disagree,Agree,5,3,1,4,2,3,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,3,1,4,5,2,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,2,5,4,1,3,4,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,4,1,5,3,2,4,Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly agree,2,5,4,3,1,4,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,1,5,4,3,2,5,Disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Disagree,2,5,4,3,1,4,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,3,1,5,4,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,1,2,0,1,1,0,10 cents,5 minutes,24 days,Female,Trade School (non-military),68,02PsVPf,01PAST,10,01ITEM,0,0.333333333,0.666666667,5,9,8,6,4,2,3,1,7,4,3,2,1,0,2,1,1,0,-1,-2,1,-2,-1,1,1,1,-1,2,1,2,2,1,1,-1,-2,1,-2,-1,1,1,1,-1,3,1,2,3,-2,3,-2,-2,3,-2,2,1,2,1,-1,1,1,3,3,3,-1,-2,-1,0,-1,-2,2,2,1,-1,3,1,3,3,3,-1,-2,-1,0,1,-2,2,2,1,0,3,1,2,2,4,3,2,4,4,4,5,4,4 +R_7rSftG0Xht8WNHc,60 - 66,Canadian,Male,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,3,5,1,4,2,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,3,1,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,3,2,5,1,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly agree,Neither agree nor disagree,3,4,1,5,2,0,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,3,4,1,5,0,Agree,Agree,Agree,Agree,Somewhat agree,3,5,4,1,2,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,1,2,3,5,4,0,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,2,3,4,1,0,Neither agree nor disagree,Agree,Agree,Strongly agree,Neither agree nor disagree,5,1,4,2,3,0,Disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,0,Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,1,3,2,5,4,0,Neither agree nor disagree,Agree,Agree,Strongly agree,Neither agree nor disagree,4,1,5,3,2,0,Somewhat disagree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,3,4,5,2,1,0,Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Agree,3,2,5,1,4,2,2,1,2,2,2,2,0,10 cents,100 minutes,47 days,Male,University - Undergraduate,61,03VPfPs,01PAST,5,02DGEN,-0.375,0.333333333,0.666666667,4,8,5,6,3,9,2,1,7,2,4,3,1,0,2,2,2,0,0,-1,0,1,0,2,0,1,0,2,2,2,2,2,0,0,0,2,3,0,2,0,1,0,2,2,2,2,2,1,0,0,2,1,0,2,0,1,0,2,0,2,2,3,0,-2,-2,2,0,0,2,0,2,-1,2,0,2,2,3,0,-1,2,2,0,-1,2,0,1,-2,2,0,0,0,0,0,0,0,0,0,0,0,0 +R_5QGhSZ8VB5JKDJ8,60 - 66,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,5,1,3,2,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,1,4,3,2,Strongly Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,2,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,3,1,5,2,4,5,Neither agree nor disagree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,1,4,2,5,5,Agree,Agree,Agree,Strongly agree,Agree,5,2,1,3,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,2,5,3,1,4,5,Strongly agree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,2,1,4,5,5,Strongly agree,Agree,Agree,Agree,Strongly agree,4,2,1,3,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,2,5,4,3,1,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,1,5,2,3,5,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Agree,5,4,1,3,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,1,3,4,2,5,5,Neither agree nor disagree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,2,4,3,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,0,1,1,2,-1,1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,60,01PfPsV,02FUT,5,02DGEN,0,0,1,4,6,9,2,3,7,8,1,5,4,3,2,1,3,3,3,3,-3,0,0,2,-1,0,3,1,2,0,1,3,3,3,3,-3,0,-2,3,0,3,2,2,2,3,2,3,3,3,3,-3,3,-2,2,-1,0,3,2,2,2,3,3,3,3,3,-3,0,-3,3,-1,1,3,3,3,0,2,3,3,3,3,-3,0,-2,3,0,3,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5 +R_7179WZWFoIZAFKe,25 - 31,Canadian,Female,Agree,Agree,Agree,Agree,Neither agree nor disagree,1,2,3,5,4,Somewhat agree,Disagree,Agree,Somewhat disagree,Agree,5,1,4,3,2,Somewhat Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,2,4,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Agree,Agree,Agree,Neither agree nor disagree,2,1,3,5,4,5,Agree,Disagree,Agree,Neither agree nor disagree,Agree,5,4,2,3,1,5,Neither Agree nor Disagree,Agree,Agree,Agree,Agree,3,5,4,2,1,5,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,2,3,1,5,5,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,5,4,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,4,3,2,1,5,5,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,3,4,2,5,1,5,Agree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,4,3,5,1,5,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,5,4,1,3,5,Agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,1,2,5,3,4,5,Agree,Disagree,Agree,Neither agree nor disagree,Agree,1,2,5,3,4,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,3,1,2,4,0,0,1,-1,-1,-1,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),30,03VPfPs,02FUT,5,02DGEN,0.5,0,1,3,2,4,6,5,9,7,1,8,2,4,3,1,2,2,2,2,0,1,-2,2,-1,2,-1,1,2,0,2,2,2,2,2,0,2,-2,2,0,2,0,2,2,2,2,2,2,2,2,0,1,2,0,1,1,1,1,1,1,2,2,2,1,2,0,2,-2,2,-1,1,0,1,2,-1,2,2,2,2,1,0,2,-2,2,0,2,1,1,1,0,2,5,5,5,5,5,5,5,5,5,5,5,5 +R_6Q5tReiI71WewEz,53 - 59,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Disagree,5,4,3,1,2,Somewhat disagree,Disagree,Agree,Somewhat agree,Neither agree nor disagree,3,4,1,2,5,Strongly Agree,Agree,Strongly Agree,Disagree,Strongly Agree,2,5,1,4,3,Strongly agree,Agree,Agree,Agree,Disagree,4,1,3,5,2,5,Disagree,Agree,Somewhat agree,Strongly agree,Somewhat disagree,2,1,3,5,4,5,Strongly agree,Agree,Somewhat Agree,Somewhat Agree,Strongly agree,4,5,1,3,2,2,Strongly agree,Somewhat agree,Strongly agree,Agree,Somewhat disagree,1,3,4,2,5,4,Somewhat disagree,Agree,Somewhat agree,Strongly agree,Somewhat agree,2,1,3,5,4,10,Strongly agree,Agree,Agree,Somewhat Agree,Strongly agree,4,2,1,3,5,2,Strongly agree,Strongly agree,Strongly agree,Agree,Disagree,5,1,3,2,4,0,Strongly disagree,Disagree,Agree,Somewhat disagree,Somewhat disagree,4,5,3,1,2,0,Strongly agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly agree,3,5,4,2,1,3,Strongly agree,Agree,Agree,Strongly agree,Strongly disagree,2,4,3,5,1,1,Strongly disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,4,1,2,5,3,3,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,5,2,4,3,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,2,-1,1,2,-2,5 cents,100 minutes,24 days,Female,High School (or equivalent),55,02PsVPf,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,2,9,8,3,6,7,4,1,5,3,4,2,1,3,3,3,2,-2,-1,-2,2,1,0,3,2,3,-2,3,3,2,2,2,-2,-2,2,1,3,-1,3,2,1,1,3,3,1,3,2,-1,-1,2,1,3,1,3,2,2,1,3,3,3,3,2,-2,-3,-2,2,-1,-1,3,1,1,-3,3,3,2,2,3,-3,-3,-2,2,-1,1,3,2,2,-3,3,5,5,2,4,10,2,0,0,3,1,3,1 +R_3LvNOREN9MEEAAl,53 - 59,Canadian,Female,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,3,5,4,1,2,Strongly disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,2,3,4,5,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,2,1,5,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,2,1,4,5,3,0,Disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,5,1,3,2,4,0,Agree,Agree,Agree,Disagree,Agree,3,2,1,4,5,0,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,1,5,2,3,4,0,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,4,1,5,2,3,0,Agree,Agree,Agree,Disagree,Agree,4,1,3,5,2,0,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,3,1,5,2,4,0,Disagree,Disagree,Somewhat agree,Disagree,Somewhat disagree,5,2,1,4,3,0,Agree,Agree,Agree,Disagree,Agree,2,3,5,4,1,0,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,3,2,5,4,1,0,Disagree,Disagree,Agree,Disagree,Somewhat disagree,3,5,2,1,4,0,Agree,Agree,Agree,Disagree,Agree,4,1,3,5,2,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,01PfPsV,02FUT,5,02DGEN,0,0,1,8,2,5,3,9,7,4,1,6,3,2,4,1,3,2,0,3,-1,-3,-2,1,-2,0,1,1,2,-3,2,3,2,0,3,-1,-2,-2,1,-2,-1,2,2,2,-2,2,3,2,0,3,-1,-2,-2,1,-2,0,2,2,2,-2,2,3,2,0,3,-1,-2,-2,1,-2,-1,2,2,2,-2,2,3,2,0,3,-1,-2,-2,2,-2,-1,2,2,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0 +R_6StnFLZFYnlx0Qh,39 - 45,Canadian,Female,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,Neither agree nor disagree,Agree,Agree,Agree,Agree,4,5,2,3,1,Agree,Agree,Agree,Agree,Agree,4,2,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Agree,Agree,Agree,Agree,3,4,2,5,1,5,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,5,2,1,4,3,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,3,5,2,1,4,5,Agree,Agree,Agree,Agree,Agree,5,4,3,1,2,5,Agree,Agree,Agree,Agree,Agree,4,3,2,5,1,5,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,3,2,4,5,5,Agree,Agree,Agree,Agree,Agree,1,2,5,4,3,5,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,5,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,5,Agree,Agree,Agree,Agree,Agree,5,4,2,3,1,5,Agree,Agree,Agree,Agree,Agree,3,1,2,4,5,5,Agree,Agree,Agree,Agree,Agree,2,4,5,1,3,1,1,1,-1,-1,-1,-1,1,10 cents,25 minutes,24 days,Female,University - Undergraduate,43,01PfPsV,02FUT,10,02DGEN,1,0,0.666666667,2,3,5,9,4,7,6,1,8,4,3,2,1,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,1,1,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5,5,5,5,5 +R_3LXPr6n0smAwMBm,39 - 45,Canadian,Male,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,3,4,5,Somewhat agree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,5,3,4,1,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,4,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Agree,Agree,Agree,Agree,3,1,4,5,2,7,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,1,4,3,5,2,6,Agree,Agree,Agree,Agree,Agree,4,2,5,3,1,7,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,2,4,1,3,6,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,2,3,1,5,4,6,Agree,Agree,Agree,Agree,Agree,5,1,2,4,3,6,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,3,1,2,6,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Agree,1,2,3,5,4,7,Agree,Agree,Agree,Agree,Somewhat Agree,3,2,4,5,1,7,Strongly agree,Strongly agree,Agree,Agree,Agree,3,4,1,5,2,7,Somewhat disagree,Disagree,Agree,Disagree,Agree,3,2,4,1,5,6,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,2,5,4,3,0,-1,0,0,-1,1,0,0,5 cents,5 minutes,15 days,Male,University - Graduate (Masters),41,02PsVPf,02FUT,5,02DGEN,-0.125,0.666666667,0,4,5,3,6,7,9,2,1,8,3,4,2,1,1,2,1,1,0,1,-2,2,-1,0,1,1,2,1,2,2,2,2,2,2,0,-2,2,-2,2,2,2,2,2,2,2,2,2,1,1,0,-2,2,-2,1,2,2,2,2,2,2,1,1,1,1,0,-3,2,-2,2,2,2,2,2,1,3,3,2,2,2,-1,-2,2,-2,2,3,3,3,2,3,7,7,6,7,6,6,6,6,7,7,7,6 +R_7E0xTaALb4X6BIP,25 - 31,Canadian,Male,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly agree,Agree,2,5,3,1,4,Agree,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,4,5,2,1,3,Strongly Agree,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,1,5,4,2,3,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,Agree,1,3,2,5,4,8,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,4,1,2,3,5,4,Neither Agree nor Disagree,Disagree,Strongly Disagree,Strongly Disagree,Agree,1,2,3,4,5,7,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,2,3,4,1,7,Strongly agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,5,1,4,3,2,6,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,5,4,1,2,3,8,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,3,4,2,5,1,8,Strongly agree,Somewhat agree,Disagree,Disagree,Somewhat disagree,2,1,4,5,3,8,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,5,4,1,8,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Strongly agree,5,2,1,4,3,7,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,1,2,5,3,8,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,4,1,3,2,5,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,-1,0,-2,1,1,10 cents,25 minutes,15 days,Male,University - Undergraduate,29,01PfPsV,01PAST,10,01ITEM,0.875,0,0.333333333,9,2,4,8,7,3,6,1,5,4,2,3,1,3,1,0,3,2,2,2,1,3,0,3,2,1,3,0,3,0,3,2,2,0,1,3,3,1,0,-2,-3,-3,2,2,0,1,-1,-1,3,0,1,0,2,-1,1,1,2,0,3,0,3,2,1,3,1,-2,-2,-1,2,1,2,0,1,-1,2,1,0,3,2,1,3,0,1,0,1,0,2,2,8,4,7,7,6,8,8,8,8,7,8,8 +R_68jv8Bf5MKjNTCp,67 - 73,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,1,2,4,3,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Disagree,2,1,5,3,4,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,3,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,4,3,2,5,0,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,4,5,3,2,1,0,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,3,1,5,2,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Agree,3,5,2,4,1,0,Agree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,2,1,4,3,0,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,1,2,4,3,5,0,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,0,Somewhat agree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,2,3,5,4,1,0,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,2,3,1,5,4,0,Strongly agree,Strongly agree,Strongly agree,Agree,Disagree,5,4,2,1,3,0,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,2,5,4,1,3,0,Strongly agree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,4,2,1,5,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,-1,2,2,-1,2,0,10 cents,75 minutes,24 days,Female,High School (or equivalent),69,03VPfPs,02FUT,10,01ITEM,-0.75,0,0.666666667,6,8,4,2,3,7,9,1,5,4,3,2,1,3,3,3,-1,0,0,-3,3,-1,-2,3,0,3,-3,3,3,3,3,-3,0,3,-3,3,-1,0,3,2,2,-3,3,3,3,3,-3,2,2,-3,3,-1,0,3,2,2,-3,3,3,3,3,0,0,1,-3,3,-1,0,3,2,2,-3,3,3,3,3,2,-2,0,0,2,0,-2,3,1,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_3r1TAD5xtoumLWg,67 - 73,Canadian,Male,Strongly agree,Strongly agree,Agree,Agree,Agree,2,1,5,3,4,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,4,1,2,5,Somewhat Agree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,1,2,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Strongly agree,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,1,3,4,2,5,3,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,3,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,3,4,5,1,2,3,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,1,5,4,2,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,3,4,2,5,1,4,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,3,5,2,1,4,3,Strongly agree,Agree,Agree,Strongly agree,Somewhat agree,2,1,5,3,4,1,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,4,3,2,5,1,4,Somewhat Agree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,3,1,5,4,2,2,Strongly agree,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,2,3,4,5,1,4,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,2,3,1,5,4,4,Somewhat Agree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,3,1,5,4,2,0,1,1,2,0,0,1,1,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,67,01PfPsV,01PAST,5,02DGEN,0,0.333333333,0.666666667,4,3,6,9,2,8,5,1,7,3,2,4,1,3,3,2,2,2,0,-2,2,-1,1,1,-1,3,-2,3,3,3,2,1,0,-1,1,3,1,0,2,-1,3,3,3,3,3,1,-1,0,0,1,3,1,1,2,-1,3,2,3,3,2,2,3,1,0,-1,2,-1,1,1,-1,3,-1,3,3,3,2,3,0,1,-2,2,-2,1,1,-1,3,-2,3,2,3,3,3,5,4,3,1,4,2,4,4 +R_3SAHrS0GQBJ4N6c,60 - 66,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Strongly agree,1,3,2,4,5,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,4,5,3,2,1,Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,4,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Neither agree nor disagree,Agree,Agree,Disagree,Strongly agree,5,3,2,1,4,8,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Agree,1,2,5,3,4,7,Agree,Agree,Agree,Somewhat Agree,Agree,5,1,2,4,3,8,Somewhat disagree,Agree,Agree,Disagree,Strongly agree,3,1,5,2,4,7,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,4,3,1,5,2,7,Agree,Agree,Agree,Somewhat Agree,Agree,3,1,5,4,2,8,Agree,Agree,Agree,Agree,Strongly agree,4,1,5,3,2,7,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,Agree,2,3,5,4,1,8,Agree,Strongly agree,Agree,Disagree,Strongly agree,5,3,2,4,1,7,Somewhat agree,Agree,Agree,Agree,Agree,5,1,3,2,4,8,Somewhat disagree,Strongly disagree,Agree,Somewhat agree,Somewhat agree,1,3,2,5,4,7,Agree,Agree,Agree,Disagree,Strongly agree,2,4,1,5,3,1,1,2,2,-1,-1,1,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),60,03VPfPs,01PAST,5,02DGEN,0.5,0.333333333,0.666666667,8,3,4,2,9,6,7,1,5,4,2,3,1,2,2,2,1,3,1,-1,2,1,2,2,3,2,0,3,0,2,2,-2,3,1,1,2,-1,2,2,2,2,1,2,-1,2,2,-2,3,0,2,2,1,2,2,2,2,1,2,2,2,2,2,3,-1,-2,1,1,2,2,3,2,-2,3,1,2,2,2,2,-1,-3,2,1,1,2,2,2,-2,3,7,8,7,8,7,7,8,7,8,7,8,7 +R_5t0gKO3C7BnFyCn,67 - 73,Canadian,Male,Strongly agree,Strongly agree,Agree,Disagree,Somewhat agree,2,4,3,5,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,4,5,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,1,4,5,3,2,Strongly agree,Strongly agree,Agree,Strongly disagree,Somewhat agree,1,3,5,2,4,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,5,2,4,0,Agree,Agree,Agree,Somewhat Agree,Strongly agree,4,1,3,2,5,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,2,5,4,3,1,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,4,3,1,0,Agree,Agree,Agree,Somewhat Agree,Agree,1,2,5,3,4,0,Strongly agree,Strongly agree,Agree,Disagree,Somewhat agree,5,1,2,3,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,4,2,1,5,3,1,Agree,Agree,Agree,Somewhat Disagree,Strongly agree,2,4,3,5,1,1,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,4,3,2,1,5,3,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,3,5,4,1,2,1,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,5,2,4,1,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,2,1,2,2,2,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),67,01PfPsV,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,8,2,3,9,4,6,5,1,7,2,3,4,1,3,3,2,-2,1,1,-3,3,-3,2,2,1,2,-1,2,3,3,2,-3,1,1,-3,3,-3,2,2,2,2,1,3,3,3,2,-3,2,1,-3,3,-3,2,2,2,2,1,2,3,3,2,-2,1,1,-3,2,-3,2,2,2,2,-1,3,3,3,2,0,1,1,-3,2,-3,2,2,2,2,0,3,0,0,0,0,0,0,1,1,1,3,1,1 +R_3oL0DPh0524TOG2,46 - 52,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat agree,5,3,2,4,1,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,Agree,4,5,2,1,3,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,3,2,5,4,2,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,Agree,5,4,2,3,1,2,Agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Strongly agree,4,1,5,2,3,2,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,5,4,3,2,2,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,Agree,4,1,2,5,3,2,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,4,1,5,2,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,2,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,1,5,4,3,2,1,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,1,3,5,4,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,3,1,2,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,4,1,5,2,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,3,2,5,1,4,1,1,1,1,-1,-1,2,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),47,03VPfPs,02FUT,10,02DGEN,0,0,1,7,6,9,5,4,2,8,1,3,3,4,2,1,3,3,3,2,1,-3,-3,1,1,2,2,-1,3,1,3,3,3,3,-1,3,-3,-3,1,1,2,2,-1,3,1,3,3,3,3,-1,3,-3,-3,1,1,2,2,-1,3,2,3,3,3,3,3,3,-3,-3,3,1,3,2,-1,3,2,3,3,3,3,3,3,-3,-3,3,1,3,2,-1,3,2,3,2,2,2,2,2,2,2,2,1,2,2,2 +R_3E2CRTzXTCzrQc1,67 - 73,Canadian,Male,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Somewhat disagree,2,5,3,1,4,Strongly disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,3,1,4,2,5,Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,3,2,5,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,4,3,5,1,2,3,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,Strongly disagree,3,2,5,4,1,3,Disagree,Neither Agree nor Disagree,Strongly agree,Disagree,Neither Agree nor Disagree,5,1,4,3,2,2,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,4,2,5,3,1,3,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Agree,2,3,4,1,5,3,Disagree,Somewhat Agree,Strongly agree,Disagree,Neither Agree nor Disagree,1,4,5,2,3,3,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,5,3,4,1,2,3,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,1,3,5,4,2,3,Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Neither Agree nor Disagree,4,5,2,1,3,3,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,2,5,3,1,4,2,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,4,2,5,1,3,Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Neither Agree nor Disagree,4,3,2,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,-1,2,-1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),71,03VPfPs,01PAST,5,01ITEM,0.5,0,1,6,5,7,9,4,3,8,1,2,3,4,2,1,-3,3,3,-3,-1,-3,1,2,0,2,-2,1,3,0,0,-3,3,3,-3,-3,-3,1,2,-1,-3,-2,0,3,-2,0,-3,3,3,-3,1,-3,0,2,-2,2,-2,1,3,-2,0,-3,3,3,-3,-3,-3,1,1,-1,2,-2,0,3,-3,0,-3,3,3,-3,-3,-3,1,1,1,2,-2,0,3,-3,0,3,3,2,3,3,3,3,3,3,2,3,3 +R_5j2R74rQQ9YqFt4,60 - 66,Canadian,Male,Strongly agree,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,2,3,4,5,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,3,5,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,1,2,4,3,5,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,4,5,3,2,1,4,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,4,2,3,2,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,2,3,5,4,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,1,5,2,3,4,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,3,5,2,2,Strongly agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,2,5,4,1,3,2,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,3,1,2,4,5,2,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,5,1,2,2,Strongly agree,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,1,4,5,3,2,2,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,2,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,4,2,5,1,0,0,0,0,-1,0,0,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,61,01PfPsV,02FUT,10,02DGEN,0,0,1,5,7,9,4,3,8,2,1,6,2,4,3,1,3,2,-1,1,1,-1,0,1,1,0,1,0,1,0,2,3,3,-1,0,1,1,0,1,2,0,2,0,1,1,1,3,3,0,0,2,-1,0,1,3,0,2,0,1,0,1,3,1,-1,1,1,-1,1,2,1,0,2,1,1,0,1,3,2,-1,1,1,-1,0,2,1,0,2,1,2,1,2,3,4,4,2,5,3,2,2,2,2,2,2 +R_5nNIGXYxFlgHVtL,67 - 73,Canadian,Female,Strongly agree,Agree,Somewhat disagree,Strongly disagree,Strongly agree,4,3,2,1,5,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Agree,2,4,1,5,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,1,5,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Agree,Neither agree nor disagree,Strongly disagree,Strongly agree,1,5,2,3,4,2,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,3,2,1,5,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,5,1,2,4,3,2,Strongly agree,Agree,Somewhat disagree,Strongly disagree,Strongly agree,1,2,3,5,4,2,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Agree,3,5,4,1,2,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,4,3,1,5,2,3,Strongly agree,Agree,Disagree,Strongly disagree,Agree,5,2,1,4,3,3,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,1,4,2,3,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Somewhat Disagree,Somewhat Agree,2,1,3,5,4,2,Strongly agree,Agree,Somewhat disagree,Strongly disagree,Agree,5,1,3,4,2,2,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Agree,3,4,5,1,2,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,3,1,2,4,5,0,2,2,2,-2,-1,1,0,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),72,01PfPsV,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,7,4,8,3,6,2,9,1,5,3,4,2,1,3,2,-1,-3,3,-1,-3,2,-3,2,0,0,2,-1,1,3,2,0,-3,3,0,-3,2,-3,2,0,0,2,-1,1,3,2,-1,-3,3,-1,-3,2,-3,2,0,0,2,-1,1,3,2,-2,-3,2,0,-3,2,-3,2,0,0,3,-1,1,3,2,-1,-3,2,-1,-3,2,-3,2,0,0,2,-1,1,3,2,2,2,2,2,3,3,2,2,2,2 +R_66hGIGe1BIkkXFL,32 - 38,Canadian,Female,Agree,Agree,Agree,Disagree,Somewhat disagree,1,4,2,3,5,Somewhat disagree,Agree,Agree,Agree,Somewhat disagree,5,3,1,2,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,4,3,2,Agree,Agree,Agree,Disagree,Disagree,3,1,2,4,5,2,Disagree,Agree,Agree,Agree,Somewhat agree,1,3,4,2,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,4,1,2,Agree,Agree,Agree,Disagree,Disagree,4,3,5,1,2,3,Somewhat disagree,Agree,Agree,Agree,Somewhat agree,5,1,3,2,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,5,2,1,3,2,Agree,Agree,Agree,Somewhat disagree,Somewhat disagree,5,4,3,2,1,2,Somewhat disagree,Agree,Agree,Agree,Somewhat agree,2,4,5,3,1,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,2,3,1,2,Agree,Agree,Agree,Disagree,Somewhat disagree,1,4,5,2,3,2,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,3,2,4,5,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,1,4,3,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,0,1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,38,03VPfPs,02FUT,5,01ITEM,-0.125,0,1,9,8,4,6,7,2,5,1,3,3,4,2,1,2,2,2,-2,-1,-1,2,2,2,-1,1,1,1,1,1,2,2,2,-2,-2,-2,2,2,2,1,1,1,1,1,1,2,2,2,-2,-2,-1,2,2,2,1,1,1,1,1,1,2,2,2,-1,-1,-1,2,2,2,1,1,1,2,1,1,2,2,2,-2,-1,-1,1,1,2,1,1,1,2,1,1,2,2,2,3,3,2,2,2,2,2,2,2 +R_710tZm0P99iy1aj,39 - 45,Canadian,Male,Strongly agree,Agree,Somewhat agree,Agree,Somewhat agree,4,5,3,1,2,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,3,4,2,5,1,Agree,Strongly Agree,Agree,Agree,Strongly Agree,2,5,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,1,5,3,4,8,Strongly agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,3,2,5,4,1,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,4,5,3,1,2,9,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,4,2,5,3,1,7,Agree,Agree,Somewhat agree,Strongly agree,Strongly agree,4,1,5,2,3,8,Strongly agree,Strongly agree,Neither Agree nor Disagree,Agree,Agree,4,2,5,3,1,7,Agree,Agree,Strongly agree,Strongly agree,Somewhat agree,4,2,5,3,1,6,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,2,5,3,4,1,7,Agree,Agree,Agree,Agree,Strongly agree,4,5,1,2,3,7,Agree,Agree,Somewhat agree,Strongly agree,Agree,5,4,1,3,2,8,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,1,4,5,2,3,7,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,Agree,4,3,1,2,5,0,1,1,-2,-1,-1,-2,1,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,45,03VPfPs,01PAST,10,02DGEN,1.125,0,0.333333333,4,5,2,8,6,9,3,1,7,4,2,3,1,3,2,1,2,1,3,3,1,3,1,2,3,2,2,3,0,0,3,0,1,3,2,2,1,0,0,0,0,2,1,3,3,2,3,2,2,2,1,3,3,3,3,0,2,2,2,2,3,3,1,1,1,2,2,0,2,2,2,2,3,2,2,1,3,2,0,1,2,0,1,2,3,1,1,2,8,8,8,9,7,8,7,6,7,7,8,7 +R_3MDTqWL1rduC3Z9,60 - 66,Canadian,Male,Strongly disagree,Strongly agree,Strongly agree,Disagree,Agree,3,1,2,5,4,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,5,2,1,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,1,3,2,5,4,Strongly disagree,Agree,Agree,Disagree,Agree,5,3,1,4,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,3,1,4,2,1,Agree,Agree,Agree,Somewhat Agree,Agree,1,2,5,3,4,1,Disagree,Agree,Agree,Disagree,Strongly agree,3,5,2,4,1,1,Strongly agree,Strongly disagree,Agree,Strongly disagree,Agree,2,5,4,3,1,1,Agree,Agree,Agree,Somewhat Agree,Agree,3,2,5,1,4,1,Strongly disagree,Agree,Agree,Disagree,Somewhat agree,1,4,3,5,2,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Disagree,5,3,1,2,4,1,Agree,Agree,Strongly agree,Somewhat Disagree,Agree,5,3,1,2,4,1,Strongly disagree,Agree,Agree,Disagree,Somewhat disagree,4,3,2,5,1,1,Agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,3,5,2,1,4,1,Agree,Agree,Agree,Somewhat Disagree,Agree,1,5,2,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,2,2,2,2,10 cents,5 minutes,24 days,Male,Trade School (non-military),65,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,4,3,8,6,9,5,2,1,7,3,4,2,1,-3,3,3,-2,2,2,-3,3,-3,1,2,2,3,1,2,-3,2,2,-2,2,3,-3,3,-3,2,2,2,2,1,2,-2,2,2,-2,3,3,-3,2,-3,2,2,2,2,1,2,-3,2,2,-2,1,2,-3,3,-3,-2,2,2,3,-1,2,-3,2,2,-2,-1,2,-3,2,-3,1,2,2,2,-1,2,1,1,1,1,1,1,1,1,1,1,1,1 +R_5ZQEKXDbhs4GA3k,67 - 73,Canadian,Male,Somewhat agree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,4,2,5,3,1,Strongly agree,Strongly disagree,Agree,Disagree,Agree,2,1,5,3,4,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,2,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat agree,Somewhat agree,Agree,Disagree,Agree,1,2,4,3,5,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,1,2,5,4,5,Strongly agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly agree,1,5,4,3,2,5,Agree,Somewhat agree,Agree,Strongly disagree,Agree,5,1,4,3,2,5,Strongly agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,2,5,1,4,3,5,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,1,4,5,2,3,5,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,3,2,5,Agree,Disagree,Agree,Disagree,Somewhat agree,4,1,3,5,2,5,Strongly agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,3,5,2,1,4,6,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,5,Agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,3,2,5,1,4,7,Strongly agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly agree,2,1,3,5,4,0,1,0,2,-1,-1,1,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),72,02PsVPf,01PAST,10,02DGEN,0,0,1,4,6,2,9,5,3,8,1,7,4,3,2,1,1,1,3,-1,2,3,-3,2,-2,2,3,1,3,1,3,1,1,2,-2,2,3,-3,3,-3,1,3,1,1,1,3,2,1,2,-3,2,3,-3,3,-2,1,3,2,2,3,3,1,2,3,0,0,2,-2,2,-2,1,3,1,1,0,3,1,1,2,0,0,2,-1,0,-1,0,3,0,2,0,3,5,5,5,5,5,5,5,5,5,6,5,7 +R_5HSsu68tAVKiXWN,53 - 59,Canadian,Male,Disagree,Agree,Strongly agree,Strongly agree,Disagree,5,4,2,1,3,Disagree,Agree,Agree,Strongly agree,Somewhat disagree,3,1,5,4,2,Agree,Disagree,Strongly Agree,Somewhat Disagree,Agree,5,3,4,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat disagree,Strongly agree,Strongly agree,Agree,Disagree,4,1,3,2,5,2,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,5,4,1,2,3,3,Somewhat Agree,Strongly Disagree,Agree,Somewhat Agree,Agree,5,4,2,1,3,3,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Disagree,1,5,2,3,4,3,Neither agree nor disagree,Agree,Somewhat agree,Agree,Somewhat agree,2,1,3,5,4,3,Somewhat Agree,Disagree,Agree,Somewhat Agree,Agree,5,1,2,4,3,2,Neither agree nor disagree,Agree,Agree,Strongly agree,Neither agree nor disagree,5,3,1,4,2,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,2,5,3,1,4,3,Strongly agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Agree,1,5,4,2,3,3,Neither agree nor disagree,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,5,3,4,1,2,3,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,1,3,4,5,2,3,Strongly agree,Somewhat Agree,Strongly agree,Agree,Agree,3,4,1,2,5,2,2,1,2,-1,1,1,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,55,03VPfPs,01PAST,5,02DGEN,0.375,0.666666667,0.333333333,7,4,6,9,2,5,8,1,3,4,3,2,1,-2,2,3,3,-2,-2,2,2,3,-1,2,-2,3,-1,2,-1,3,3,2,-2,-3,3,1,3,1,1,-3,2,1,2,0,1,2,1,-2,0,2,1,2,1,1,-2,2,1,2,0,2,2,3,0,1,1,2,1,2,3,-1,3,1,2,0,1,2,3,0,2,0,2,0,2,3,1,3,2,2,2,2,3,3,3,3,2,2,3,3,3,3 +R_1HS2ohbQHYfy7o6,67 - 73,Canadian,Female,Strongly agree,Agree,Agree,Somewhat agree,Agree,1,4,5,2,3,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Neither agree nor disagree,4,5,2,3,1,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,1,5,2,3,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,4,5,1,2,3,1,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,3,4,1,2,5,2,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,3,1,2,4,5,2,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,5,4,1,2,3,2,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,5,1,2,1,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,2,1,5,4,3,1,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,4,1,2,3,5,5,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,5,4,2,3,1,5,Agree,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,1,3,2,4,5,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Neither Agree nor Disagree,4,3,5,2,1,0,0,0,2,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,72,01PfPsV,02FUT,5,02DGEN,-0.25,0,1,7,3,2,8,9,5,6,1,4,2,3,4,1,3,2,2,1,2,0,-3,2,-2,0,0,1,2,0,0,3,3,3,1,3,0,-3,2,-3,0,0,1,0,-3,0,3,3,3,1,2,0,-3,2,-3,0,0,1,0,0,0,3,3,3,2,2,0,-3,0,-3,0,0,2,0,-3,0,2,2,3,3,0,0,-3,0,0,0,0,0,0,-3,0,5,1,1,2,2,2,1,1,5,5,5,5 +R_6bVkNb48YbCZPws,39 - 45,Canadian,Male,Agree,Strongly agree,Somewhat agree,Agree,Strongly agree,5,3,4,1,2,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,3,4,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,5,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,5,4,1,3,2,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,5,4,1,3,4,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,2,5,1,4,3,6,Somewhat agree,Agree,Agree,Somewhat agree,Strongly agree,4,1,3,5,2,6,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,1,3,5,2,4,6,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,3,1,4,5,2,4,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly agree,5,1,2,3,4,6,Somewhat disagree,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,5,1,4,5,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,4,5,1,2,3,5,Agree,Strongly agree,Somewhat agree,Agree,Strongly agree,5,4,3,1,2,5,Somewhat disagree,Somewhat disagree,Disagree,Agree,Neither agree nor disagree,1,5,2,3,4,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,3,1,2,4,5,0,2,1,1,-1,0,0,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,45,01PfPsV,02FUT,5,02DGEN,0.5,0,1,9,7,3,8,4,2,6,1,5,4,3,2,1,2,3,1,2,3,-2,-1,1,1,0,0,1,1,-1,1,0,0,2,0,3,0,0,0,1,-1,1,2,0,1,1,1,2,2,1,3,-1,0,2,1,-1,0,-1,-1,-1,0,2,3,1,0,3,-1,-3,1,1,1,0,1,2,-1,1,2,3,1,2,3,-1,-1,-2,2,0,0,1,0,-2,0,3,4,4,6,6,6,4,6,5,5,5,3 +R_3uyZAa5KYYe7wna,46 - 52,Canadian,Male,Disagree,Agree,Agree,Somewhat agree,Agree,1,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,4,1,2,3,Disagree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,3,4,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,4,2,3,5,6,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,3,1,4,2,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,2,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,4,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,5,3,4,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,5,1,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,2,3,0,0,0,2,-1,0,0,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),48,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,8,3,2,9,4,7,5,1,6,4,3,2,1,-2,2,2,1,2,0,0,1,1,0,-2,3,2,0,2,0,1,1,1,2,0,0,-1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,5,6,5,5,5,7,5,7,8,6,6,6 +R_1QAc22IlPnNyRse,39 - 45,Canadian,Female,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,4,5,2,3,1,Disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,2,5,4,3,1,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,2,3,4,1,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Disagree,4,5,2,3,1,1,Strongly disagree,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,4,1,2,3,5,8,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,4,5,1,3,2,0,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,4,1,3,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,3,5,4,1,2,1,Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,2,1,4,3,5,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,5,4,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,1,2,5,3,4,4,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,5,2,1,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,5,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Agree,Agree,5,4,1,2,3,5,Strongly agree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,2,4,3,5,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,0,-1,2,1,0,5 cents,100 minutes,24 days,Female,High School (or equivalent),41,03VPfPs,01PAST,10,01ITEM,0,0.333333333,0.666666667,8,6,7,9,4,2,3,1,5,4,3,2,1,1,1,0,3,-1,-2,0,1,2,1,3,2,3,-3,3,0,1,3,0,-2,-3,0,-2,3,-3,3,2,2,-3,3,3,3,3,1,2,1,0,1,2,1,2,1,2,-3,3,0,0,0,2,0,0,0,0,2,1,3,2,3,-3,3,0,0,0,0,0,0,-1,1,2,2,3,1,3,-3,3,1,8,0,5,1,0,5,4,5,5,5,1 +R_11FTFBt6zepQQIF,53 - 59,Canadian,Female,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Agree,2,4,3,1,5,Agree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat agree,4,1,5,2,3,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,1,3,5,2,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,4,1,2,3,5,6,Strongly agree,Somewhat disagree,Strongly agree,Agree,Strongly agree,2,5,3,4,1,6,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,1,4,5,2,3,3,Somewhat agree,Strongly agree,Agree,Somewhat agree,Agree,2,1,5,4,3,5,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,Agree,1,4,2,5,3,6,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,1,2,4,5,2,Neither agree nor disagree,Agree,Strongly agree,Agree,Agree,1,5,4,3,2,2,Somewhat agree,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,2,1,4,5,3,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,1,4,2,3,Neither agree nor disagree,Agree,Strongly agree,Agree,Agree,3,4,2,5,1,4,Somewhat agree,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,3,4,5,5,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,3,4,2,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,-1,-1,-1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,58,01PfPsV,02FUT,5,01ITEM,0.75,0,1,3,7,4,8,9,6,5,1,2,2,4,3,1,0,2,3,1,2,2,-3,3,1,1,3,2,2,0,3,1,3,3,2,2,3,-1,3,2,3,3,3,3,1,3,1,3,2,1,2,3,-1,3,1,2,3,3,3,2,3,0,2,3,2,2,1,-2,1,1,0,3,2,2,0,2,0,2,3,2,2,1,-2,1,1,0,3,2,2,0,2,6,6,3,5,6,2,2,3,3,4,5,3 +R_3MFPx3kdqR4ypoB,67 - 73,Canadian,Male,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Agree,2,3,5,1,4,Disagree,Somewhat disagree,Agree,Disagree,Somewhat disagree,5,3,2,4,1,Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Somewhat Disagree,1,4,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly disagree,Neither agree nor disagree,Agree,Strongly disagree,Agree,3,4,1,2,5,5,Strongly disagree,Neither agree nor disagree,Agree,Somewhat disagree,Disagree,1,4,5,2,3,4,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Disagree,3,1,4,5,2,3,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Strongly agree,4,1,2,3,5,8,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,4,1,2,5,2,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Somewhat Disagree,3,4,2,5,1,1,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Agree,3,2,4,5,1,2,Disagree,Disagree,Agree,Disagree,Disagree,3,1,4,2,5,1,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Disagree,4,5,3,1,2,1,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Agree,5,1,4,3,2,1,Disagree,Disagree,Agree,Disagree,Disagree,1,5,2,3,4,2,Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Disagree,5,1,3,4,2,-2,-1,-1,0,0,-2,-1,-2,10 cents,5 minutes,36 days,Male,University - Undergraduate,68,02PsVPf,01PAST,10,02DGEN,-0.375,0.333333333,0.333333333,3,6,4,8,5,9,7,1,2,4,2,3,1,-3,0,2,-2,2,-2,-1,2,-2,-1,2,3,3,-1,-1,-3,0,2,-3,2,-3,0,2,-1,-2,2,3,3,0,-2,-3,0,2,-2,3,-2,1,1,1,-1,2,3,3,0,-1,-3,0,2,-2,2,-2,-2,2,-2,-2,2,3,3,0,-2,-3,0,2,-2,2,-2,-2,2,-2,-2,2,3,3,0,-2,3,5,4,3,8,2,1,2,1,1,1,2 +R_5aOV0H9YEdzgt0d,53 - 59,Canadian,Female,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,1,5,2,4,3,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Agree,3,1,4,2,5,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,1,5,3,4,2,Agree,Agree,Somewhat agree,Somewhat disagree,Agree,3,2,1,5,4,1,Agree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,3,2,5,4,1,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,1,4,2,5,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,4,1,3,2,5,1,Agree,Disagree,Agree,Somewhat disagree,Agree,1,5,3,4,2,1,Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,1,3,2,4,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,2,4,1,2,Somewhat agree,Disagree,Neither agree nor disagree,Disagree,Agree,3,2,1,4,5,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Agree,3,5,1,4,2,2,Agree,Agree,Somewhat agree,Somewhat agree,Agree,2,3,5,4,1,4,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,3,4,5,2,4,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Agree,1,3,4,2,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,2,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,54,03VPfPs,01PAST,10,01ITEM,0.25,0,1,9,4,5,6,3,8,7,1,2,3,2,4,1,2,2,2,0,3,1,-2,1,-1,2,1,-1,2,0,2,2,2,1,-1,2,2,-1,2,-2,1,2,-1,2,0,2,1,1,1,-1,2,2,-2,2,-1,2,2,-1,0,0,2,1,1,1,0,1,1,-2,0,-2,2,1,0,1,-1,2,2,2,1,1,2,0,-2,0,-1,0,1,0,2,2,2,1,1,1,1,1,1,2,2,2,4,4,0 +R_6Sb39w9yGO8b2tr,39 - 45,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,2,1,4,Disagree,Somewhat agree,Neither agree nor disagree,Disagree,Somewhat agree,5,3,2,4,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,4,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,3,1,5,6,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,3,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,2,5,3,5,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,5,2,3,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,2,1,3,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,4,5,5,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,3,4,5,0,1,0,0,0,-1,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),41,02PsVPf,02FUT,5,02DGEN,0.25,0,1,9,7,4,3,8,5,6,1,2,2,3,4,1,0,2,1,1,1,-2,1,0,-2,1,0,0,1,0,0,1,2,1,1,0,0,1,0,0,0,0,0,1,0,0,0,2,2,0,0,0,1,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0,0,0,0,0,0,1,0,0,0,2,1,1,1,-1,0,0,0,0,0,0,1,0,0,4,5,5,6,5,5,5,6,5,3,5,5 +R_5rvjBhurZlcbMCl,60 - 66,Canadian,Female,Somewhat disagree,Agree,Agree,Neither agree nor disagree,Somewhat agree,2,4,1,5,3,Disagree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,3,2,5,4,Somewhat Agree,Strongly Disagree,Strongly Agree,Disagree,Agree,2,5,3,4,1,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,4,1,2,3,5,2,Disagree,Disagree,Agree,Disagree,Agree,5,4,1,2,3,1,Somewhat Agree,Disagree,Agree,Strongly Disagree,Agree,3,2,1,5,4,1,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,3,2,1,5,4,2,Disagree,Disagree,Agree,Disagree,Agree,2,5,1,3,4,1,Somewhat Agree,Disagree,Agree,Strongly Disagree,Strongly agree,4,2,3,5,1,1,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,4,2,5,3,1,4,Disagree,Disagree,Agree,Disagree,Agree,5,4,1,3,2,1,Somewhat Agree,Disagree,Agree,Strongly Disagree,Agree,4,1,2,5,3,1,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,3,2,1,5,1,Disagree,Disagree,Agree,Disagree,Somewhat agree,3,2,1,4,5,1,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,4,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,-1,1,1,-1,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,65,01PfPsV,02FUT,5,01ITEM,-0.125,0.333333333,0.666666667,9,3,5,4,2,7,8,1,6,3,2,4,1,-1,2,2,0,1,-2,-1,2,-2,1,1,-3,3,-2,2,1,2,2,1,0,-2,-2,2,-2,2,1,-2,2,-3,2,1,2,2,1,1,-2,-2,2,-2,2,1,-2,2,-3,3,1,2,2,0,2,-2,-2,2,-2,2,1,-2,2,-3,2,1,2,2,0,1,-2,-2,2,-2,1,1,-2,3,-3,3,2,1,1,2,1,1,4,1,1,1,1,1 +R_3D6LmFgArFfRzSD,67 - 73,Canadian,Male,Strongly agree,Strongly agree,Agree,Strongly disagree,Neither agree nor disagree,4,3,5,2,1,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,2,5,3,4,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,3,2,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Neither agree nor disagree,3,4,2,1,5,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,2,1,4,5,0,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,5,3,1,4,2,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,5,3,1,4,2,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,4,5,3,1,0,Strongly agree,Agree,Agree,Agree,Strongly agree,4,3,1,5,2,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Somewhat agree,2,1,4,3,5,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,2,4,1,5,0,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,3,4,2,1,5,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Neither agree nor disagree,3,2,1,4,5,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,2,5,4,1,0,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,2,5,4,3,1,0,2,2,2,0,-2,2,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),67,03VPfPs,01PAST,10,02DGEN,0.5,0,1,3,4,9,6,5,2,8,1,7,2,4,3,1,3,3,2,-3,0,2,-2,3,-2,0,2,1,2,0,3,3,3,2,-3,0,2,-3,3,-3,2,3,2,2,0,3,3,3,2,-3,2,2,-3,3,-3,0,3,2,2,2,3,3,3,2,-3,1,1,-3,3,-3,1,3,2,2,0,3,3,3,2,-3,0,1,-3,3,-3,0,3,2,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_7lXoOL9NeElQKtz,39 - 45,Canadian,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,5,4,2,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,4,5,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,1,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,4,3,5,2,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,2,5,4,3,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,4,1,1,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,1,2,4,5,3,1,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,1,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,2,3,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,4,5,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,3,2,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,3,1,2,2,2,1,1,1,2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),43,03VPfPs,02FUT,10,02DGEN,0.375,1,0,8,9,2,6,3,7,4,1,5,3,4,2,1,2,3,3,3,3,1,-3,3,-2,2,3,3,3,3,3,0,3,3,3,3,3,-2,3,-1,3,3,3,3,3,2,0,3,3,3,3,3,-3,3,-1,3,3,2,3,3,3,2,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,2 +R_5mMnxA0qm1YoyQh,60 - 66,Canadian,Male,Strongly disagree,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,3,5,1,2,4,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly disagree,3,5,2,4,1,Strongly Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,3,4,5,2,1,Strongly disagree,Agree,Strongly agree,Strongly agree,Strongly disagree,4,3,1,2,5,0,Agree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,5,3,1,2,0,Strongly agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,4,3,1,5,2,0,Strongly disagree,Agree,Agree,Agree,Strongly disagree,1,3,5,2,4,0,Agree,Disagree,Agree,Disagree,Disagree,1,3,5,4,2,0,Agree,Agree,Agree,Disagree,Agree,3,5,4,2,1,0,Strongly disagree,Agree,Strongly agree,Agree,Strongly disagree,2,4,3,5,1,0,Agree,Disagree,Agree,Disagree,Agree,3,2,5,1,4,0,Strongly agree,Agree,Agree,Disagree,Agree,4,5,2,3,1,0,Strongly disagree,Agree,Agree,Agree,Strongly disagree,1,2,3,4,5,0,Agree,Disagree,Agree,Disagree,Agree,4,3,2,5,1,0,Strongly agree,Agree,Agree,Disagree,Agree,5,4,1,3,2,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,0,-1,-1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),65,01PfPsV,01PAST,5,01ITEM,0.375,0,1,2,5,3,9,7,6,4,1,8,4,3,2,1,-3,1,3,3,-3,1,-1,3,-1,-3,3,1,1,-1,2,-3,2,3,3,-3,2,-2,3,-3,0,3,1,1,-2,1,-3,2,2,2,-3,2,-2,2,-2,-2,2,2,2,-2,2,-3,2,3,2,-3,2,-2,2,-2,2,3,2,2,-2,2,-3,2,2,2,-3,2,-2,2,-2,2,3,2,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0 +R_5UcqKFTRjoYaLZq,39 - 45,Canadian,Female,Agree,Agree,Agree,Agree,Agree,4,3,5,1,2,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Agree,4,2,5,3,1,Agree,Agree,Agree,Agree,Agree,3,4,2,1,5,Agree,Agree,Agree,Agree,Agree,2,1,4,5,3,9,Agree,Agree,Neither agree nor disagree,Disagree,Agree,3,1,5,4,2,8,Agree,Agree,Agree,Agree,Agree,4,3,2,5,1,9,Agree,Agree,Agree,Agree,Agree,2,1,3,5,4,8,Agree,Agree,Agree,Agree,Agree,1,5,3,4,2,9,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,9,Agree,Agree,Agree,Agree,Agree,1,2,3,4,5,8,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,3,5,2,4,1,9,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,8,Agree,Agree,Agree,Agree,Agree,5,3,1,4,2,9,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,1,5,3,4,2,9,Neither Agree nor Disagree,Agree,Agree,Agree,Neither Agree nor Disagree,2,3,4,1,5,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-1,-1,0,1,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,40,02PsVPf,02FUT,5,01ITEM,0.5,0,0.666666667,3,5,2,7,6,4,9,1,8,4,3,2,1,2,2,2,2,2,-1,-1,0,-1,2,2,2,2,2,2,2,2,2,2,2,2,2,0,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,-1,2,0,2,2,2,2,2,2,2,2,2,2,2,2,-1,2,-1,2,0,2,2,2,0,9,8,9,8,9,9,8,9,8,9,9,9 +R_3X4mhvm0v0rxhKp,60 - 66,Canadian,Female,Agree,Agree,Strongly agree,Somewhat agree,Agree,3,4,2,1,5,Somewhat disagree,Disagree,Somewhat agree,Agree,Somewhat agree,1,5,4,3,2,Somewhat Agree,Agree,Agree,Strongly Disagree,Somewhat Agree,1,5,4,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Somewhat agree,Agree,2,4,5,1,3,2,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,4,5,2,2,Somewhat Agree,Agree,Agree,Disagree,Somewhat Agree,3,4,1,2,5,1,Agree,Agree,Agree,Somewhat agree,Agree,1,3,4,5,2,2,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,4,5,2,1,2,Somewhat Agree,Agree,Agree,Disagree,Somewhat Agree,4,1,3,2,5,2,Agree,Agree,Agree,Agree,Somewhat agree,2,1,3,5,4,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,4,2,5,3,Somewhat Agree,Agree,Agree,Somewhat Disagree,Somewhat Agree,3,4,1,2,5,2,Agree,Agree,Agree,Agree,Somewhat agree,2,3,5,4,1,3,Disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,1,4,2,3,5,2,Somewhat Agree,Agree,Agree,Disagree,Somewhat Agree,3,4,5,2,1,1,0,0,2,0,0,1,-1,10 cents,100 minutes,24 days,Female,Trade School (non-military),64,03VPfPs,01PAST,10,02DGEN,-0.375,0,1,2,8,3,5,9,6,4,1,7,2,3,4,1,2,2,3,1,2,-1,-2,1,2,1,1,2,2,-3,1,2,2,2,1,2,-2,-1,1,1,0,1,2,2,-2,1,2,2,2,1,2,-2,0,1,1,0,1,2,2,-2,1,2,2,2,2,1,1,0,1,1,0,1,2,2,-1,1,2,2,2,2,1,-2,0,1,2,0,1,2,2,-2,1,2,2,2,1,2,2,2,2,3,2,3,2 +R_6IAzGCzsa3PoCCG,67 - 73,Canadian,Male,Somewhat disagree,Strongly agree,Strongly agree,Strongly disagree,Agree,3,1,2,5,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,3,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Somewhat disagree,Strongly agree,Strongly agree,Somewhat disagree,Agree,5,3,4,1,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,2,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,1,4,0,Somewhat disagree,Strongly agree,Strongly agree,Somewhat disagree,Agree,3,2,4,1,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,1,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,3,4,0,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,0,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,5,4,2,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,0,Somewhat disagree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,3,2,1,5,4,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,3,2,1,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,1,1,1,2,-1,-1,0,0,10 cents,25 minutes,24 days,Male,University - Undergraduate,71,01PfPsV,01PAST,10,02DGEN,0.375,0,0.666666667,4,6,5,7,2,3,8,1,9,3,4,2,1,-1,3,3,-3,2,3,-3,3,-3,3,3,3,3,3,3,-1,3,3,-1,2,3,-3,3,-3,3,3,3,3,3,3,-1,3,3,-1,2,3,-3,3,-3,3,3,3,3,3,3,0,3,3,0,0,3,0,3,0,3,3,3,3,3,3,-1,3,3,-1,-1,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_5cSs5A3Faexro8h,53 - 59,Canadian,Female,Somewhat disagree,Agree,Strongly agree,Disagree,Neither agree nor disagree,2,1,4,3,5,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,3,4,2,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Agree,3,1,2,4,5,Disagree,Agree,Agree,Disagree,Neither agree nor disagree,1,2,4,3,5,4,Somewhat agree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,5,3,2,1,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Somewhat Disagree,3,4,1,5,2,4,Somewhat disagree,Agree,Agree,Disagree,Neither agree nor disagree,1,4,2,5,3,3,Neither agree nor disagree,Somewhat agree,Agree,Agree,Neither agree nor disagree,3,2,5,4,1,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Strongly Disagree,Neither Agree nor Disagree,2,3,1,4,5,4,Neither agree nor disagree,Agree,Agree,Disagree,Agree,5,1,3,2,4,4,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,1,5,4,2,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Strongly Disagree,Neither Agree nor Disagree,5,3,2,4,1,2,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,5,1,2,3,4,5,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,3,4,2,5,1,4,Neither Agree nor Disagree,Agree,Agree,Strongly Disagree,Agree,3,4,1,5,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,1,0,2,0,2,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,56,03VPfPs,02FUT,10,01ITEM,-0.75,0,1,3,7,8,9,2,5,6,1,4,2,3,4,1,-1,2,3,-2,0,1,-1,2,1,2,0,0,2,-2,2,-2,2,2,-2,0,1,0,2,2,0,0,0,2,-3,-1,-1,2,2,-2,0,0,1,2,2,0,1,0,2,-3,0,0,2,2,-2,2,0,-1,2,0,2,0,0,2,-3,0,0,2,2,0,2,0,-1,2,-1,2,0,2,2,-3,2,4,5,4,3,5,4,4,4,2,5,4,2 +R_60xql6imXyVUikx,67 - 73,Canadian,Female,Agree,Agree,Strongly agree,Strongly agree,Agree,2,3,5,4,1,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat disagree,1,2,4,3,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,2,4,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,1,4,3,2,7,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,9,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,4,2,1,3,3,Agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,5,3,1,2,4,4,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,4,2,1,9,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,5,1,2,4,5,Agree,Strongly agree,Agree,Strongly agree,Somewhat agree,3,4,2,5,1,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,2,5,4,1,8,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,5,3,2,1,4,9,Agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,3,2,5,4,5,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,2,4,5,8,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,2,1,5,3,4,-2,2,1,2,-2,-1,1,2,10 cents,75 minutes,24 days,Female,High School (or equivalent),69,01PfPsV,02FUT,5,02DGEN,0.375,0,0.666666667,6,9,3,2,7,5,4,1,8,3,4,2,1,2,2,3,3,2,-3,1,1,3,-1,3,3,3,0,3,3,3,3,3,1,-3,0,2,0,0,3,3,3,-1,3,2,3,2,0,3,1,-3,3,-3,3,3,3,3,0,3,2,3,2,3,1,0,0,1,0,-1,3,2,2,-3,3,2,3,3,3,0,-3,0,1,0,1,3,2,3,-3,3,6,7,9,3,4,9,5,7,8,9,5,8 +R_6b2iZyTt1bVtPxv,60 - 66,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Agree,1,3,2,4,5,Agree,Disagree,Strongly agree,Somewhat disagree,Agree,1,4,2,3,5,Strongly Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,3,5,2,1,4,Agree,Strongly agree,Agree,Agree,Agree,5,1,3,2,4,2,Agree,Disagree,Agree,Disagree,Agree,2,5,1,3,4,2,Strongly agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly agree,1,4,2,5,3,2,Agree,Strongly agree,Agree,Agree,Agree,4,5,3,2,1,3,Agree,Disagree,Agree,Disagree,Agree,5,4,2,1,3,2,Strongly agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly agree,2,4,1,3,5,2,Strongly agree,Strongly agree,Agree,Agree,Agree,2,3,4,5,1,2,Agree,Disagree,Agree,Disagree,Agree,3,2,5,1,4,2,Strongly agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly agree,4,3,1,5,2,2,Strongly agree,Agree,Agree,Agree,Agree,4,2,1,5,3,2,Agree,Disagree,Agree,Disagree,Agree,4,5,1,3,2,2,Strongly agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly agree,5,2,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,0,2,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),61,02PsVPf,01PAST,10,01ITEM,0.375,0.333333333,0.666666667,6,9,8,4,7,2,3,1,5,2,4,3,1,3,3,2,2,2,2,-2,3,-1,2,3,0,2,-2,3,2,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,2,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,3,3,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,3,2,2,2,2,2,-2,2,-2,2,3,0,2,-1,3,2,2,2,3,2,2,2,2,2,2,2,2 +R_1ou8VSpmQSa7eI9,53 - 59,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,2,5,4,1,3,Agree,Disagree,Somewhat agree,Disagree,Strongly agree,1,5,3,2,4,Somewhat Disagree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,4,3,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,1,2,3,4,5,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,2,4,1,3,3,Somewhat Disagree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,5,3,2,4,1,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,1,5,4,3,7,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,1,4,3,2,5,8,Somewhat Disagree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,5,3,4,2,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,2,5,3,1,4,4,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,3,Disagree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,2,3,5,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,2,3,4,5,5,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Somewhat agree,5,3,1,4,2,3,Disagree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,4,5,3,1,2,2,2,2,0,2,2,2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,58,02PsVPf,01PAST,5,02DGEN,0.25,0.333333333,0.666666667,2,3,5,7,4,9,6,1,8,3,4,2,1,3,3,3,3,-1,2,-2,1,-2,3,-1,-1,3,-3,3,3,3,3,3,-1,0,1,0,1,-1,-1,-1,3,-2,3,3,3,3,3,1,2,1,2,1,3,-1,-1,3,-2,3,3,3,3,3,0,0,-2,1,0,0,-2,-1,3,-3,3,3,3,3,3,0,1,-3,2,-1,1,-2,-1,3,-3,3,6,5,3,6,7,8,5,4,3,5,5,3 +R_7qwBlahEjkF7Cmd,18 - 24,Canadian,Female,Somewhat disagree,Agree,Neither agree nor disagree,Strongly agree,Strongly disagree,4,3,2,5,1,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,4,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,1,2,3,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,3,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,2,1,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,4,5,3,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,2,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,2,1,5,5,Neither agree nor disagree,Agree,Strongly agree,Strongly agree,Strongly disagree,2,3,5,4,1,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,5,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,2,4,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,01PfPsV,02FUT,5,02DGEN,0,0,1,8,3,2,7,4,9,5,1,6,2,3,4,1,-1,2,0,3,-3,-3,0,1,1,0,0,0,0,0,0,-1,3,3,3,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,2,3,3,-3,-3,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5 +R_7e1PRGSYfQHV8jE,39 - 45,Canadian,Male,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,3,1,2,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,2,1,4,3,5,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,1,5,3,2,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Agree,3,2,4,1,5,8,Strongly agree,Somewhat agree,Strongly agree,Agree,Agree,1,4,2,3,5,7,Somewhat Disagree,Strongly agree,Disagree,Neither Agree nor Disagree,Somewhat Disagree,4,2,5,3,1,7,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,Disagree,3,4,1,2,5,6,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat disagree,1,5,3,2,4,8,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,Strongly agree,1,3,4,5,2,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,8,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,4,3,1,2,5,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Somewhat Agree,Neither Agree nor Disagree,5,2,1,3,4,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,6,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,2,1,3,5,4,5,Agree,Neither Agree nor Disagree,Disagree,Somewhat Disagree,Somewhat Disagree,3,5,2,4,1,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,0,1,0,-1,-1,10 cents,100 minutes,36 days,Male,University - Graduate (Masters),43,03VPfPs,01PAST,10,01ITEM,0.125,0,0.666666667,3,6,7,9,2,5,4,1,8,2,3,4,1,0,1,0,1,0,0,0,1,-1,2,0,2,0,1,1,0,1,-1,0,2,3,1,3,2,2,-1,3,-2,0,-1,0,3,0,1,-2,0,0,-2,0,-1,-1,0,-1,-1,3,1,0,0,0,0,0,-1,3,0,-1,0,0,-2,1,0,0,-1,1,0,0,1,-1,-1,-1,0,2,0,-2,-1,-1,8,7,7,6,8,7,8,7,6,6,5,7 +R_1tnEBgFYQxHMmhO,53 - 59,Canadian,Female,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,5,2,1,4,3,Disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,4,3,5,1,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,2,4,3,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,4,3,5,1,2,1,Somewhat disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,4,2,5,3,1,2,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,3,2,1,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,1,5,3,4,2,2,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,1,2,5,4,3,1,Strongly agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,2,1,5,3,2,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,2,5,1,3,4,1,Somewhat disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,2,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,4,1,2,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,5,3,1,2,1,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,3,1,2,5,4,1,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,1,3,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,2,0,0,0,0,10 cents,100 minutes,24 days,Female,Trade School (non-military),59,02PsVPf,02FUT,10,01ITEM,0.25,0,1,3,2,4,5,9,6,7,1,8,3,2,4,1,1,0,3,1,3,-2,-1,3,0,-1,2,1,1,1,0,0,0,3,1,3,-1,-1,3,0,-1,2,0,0,2,0,0,0,3,1,3,-1,-1,3,-1,0,3,1,1,1,0,1,0,3,1,3,-1,-1,3,0,0,2,2,1,0,0,1,0,3,0,3,-1,-2,3,0,0,2,2,1,0,0,1,2,2,2,1,2,1,2,1,1,1,1 +R_3VCRksFU2bgDkbo,32 - 38,Canadian,Female,Strongly agree,Agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,5,1,4,3,2,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,5,2,4,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,1,4,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Strongly agree,Agree,Strongly disagree,Agree,Somewhat agree,1,4,2,5,3,7,Neither agree nor disagree,Agree,Somewhat agree,Agree,Agree,3,5,2,4,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,1,5,3,3,Strongly agree,Agree,Strongly disagree,Somewhat agree,Somewhat agree,3,5,1,2,4,9,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,2,5,1,3,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,3,2,5,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,Somewhat agree,1,4,5,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,3,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,2,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,4,2,1,1,1,1,-2,0,-1,2,5 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,01PfPsV,01PAST,5,02DGEN,0.875,0.333333333,0.666666667,2,3,5,9,8,6,4,1,7,4,3,2,1,3,2,-3,1,0,0,1,2,2,2,0,0,1,0,1,3,2,-3,2,1,0,2,1,2,2,0,0,2,0,1,3,2,-3,1,1,0,3,0,3,1,0,0,0,0,0,3,3,-3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,4,3,9,9,5,5,5,5,5,5 +R_31Ut9uRDCwBurrX,39 - 45,Canadian,Female,Agree,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,3,4,5,1,2,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Disagree,1,4,5,2,3,Agree,Agree,Agree,Disagree,Somewhat Agree,4,5,1,3,2,Agree,Agree,Strongly agree,Strongly agree,Agree,5,1,4,2,3,2,Strongly disagree,Disagree,Somewhat agree,Agree,Disagree,3,5,2,1,4,3,Agree,Agree,Strongly agree,Strongly Disagree,Somewhat Disagree,5,3,4,1,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,3,5,1,2,4,Somewhat disagree,Strongly disagree,Somewhat agree,Disagree,Agree,2,4,5,3,1,5,Agree,Agree,Agree,Disagree,Somewhat Agree,5,2,3,4,1,3,Disagree,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,4,2,5,1,3,7,Somewhat agree,Disagree,Strongly agree,Disagree,Strongly agree,2,5,3,4,1,8,Agree,Agree,Agree,Disagree,Disagree,2,3,5,1,4,6,Disagree,Disagree,Strongly agree,Strongly agree,Somewhat agree,2,3,4,1,5,7,Somewhat agree,Strongly disagree,Agree,Disagree,Somewhat disagree,1,2,4,5,3,7,Agree,Agree,Agree,Strongly Disagree,Disagree,5,4,2,3,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,1,-1,0,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,42,03VPfPs,01PAST,5,01ITEM,-0.125,0,1,4,6,9,3,5,7,2,1,8,3,2,4,1,2,1,3,3,3,-3,-1,2,-1,-2,2,2,2,-2,1,2,2,3,3,2,-3,-2,1,2,-2,2,2,3,-3,-1,3,3,3,3,1,-1,-3,1,-2,2,2,2,2,-2,1,-2,-1,3,3,3,1,-2,3,-2,3,2,2,2,-2,-2,-2,-2,3,3,1,1,-3,2,-2,-1,2,2,2,-3,-2,2,3,2,4,5,3,7,8,6,7,7,8 +R_50wkiWI4Nvojx78,67 - 73,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,3,1,2,5,Strongly disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,2,1,3,5,Strongly Agree,Strongly Agree,Agree,Disagree,Strongly Agree,5,3,2,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,1,2,3,5,1,Strongly disagree,Strongly disagree,Agree,Somewhat agree,Neither agree nor disagree,2,5,4,1,3,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,5,2,4,1,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,1,4,3,5,1,Strongly disagree,Strongly disagree,Agree,Somewhat agree,Neither agree nor disagree,3,5,4,1,2,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,3,4,1,2,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,1,3,4,2,1,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,1,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,1,2,4,3,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,1,5,4,1,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,4,2,3,5,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,4,5,2,3,-2,1,0,0,-2,-1,0,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,67,03VPfPs,02FUT,10,02DGEN,0.375,0,1,2,9,3,5,4,8,6,1,7,4,2,3,1,3,3,3,1,3,-3,-3,0,0,-2,3,3,2,-2,3,3,3,3,1,3,-3,-3,2,1,0,3,3,3,-2,3,3,3,3,1,3,-3,-3,2,1,0,3,3,3,-2,3,3,3,3,1,3,-3,-3,3,1,0,3,3,3,0,3,3,3,3,2,3,-3,-3,1,1,0,3,3,3,0,3,1,1,1,1,1,1,1,1,1,1,1,5 +R_7AdBPV3ZL8M0zjH,53 - 59,Canadian,Female,Agree,Agree,Strongly agree,Agree,Agree,3,4,1,2,5,Somewhat disagree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat agree,1,3,2,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,4,2,1,3,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,3,4,5,2,1,7,Agree,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,3,5,2,1,4,7,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,2,1,4,5,7,Strongly agree,Strongly agree,Agree,Agree,Agree,1,3,2,5,4,5,Agree,Disagree,Strongly agree,Agree,Strongly agree,1,5,4,2,3,5,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,5,4,1,2,5,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,3,5,1,8,Agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,2,1,4,3,5,7,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,2,5,4,3,8,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,4,2,1,5,9,Agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,4,1,2,3,5,9,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,2,1,3,4,5,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,-2,-1,2,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),57,01PfPsV,01PAST,10,01ITEM,1.125,0.333333333,0.666666667,5,9,2,8,4,3,6,1,7,3,2,4,1,2,2,3,2,2,-1,-3,3,1,1,3,3,3,-1,3,3,3,3,1,1,2,-3,3,-1,3,3,3,3,-2,3,3,3,2,2,2,2,-2,3,2,3,3,3,3,0,3,3,3,3,2,3,2,-3,3,-2,3,3,3,3,-2,3,3,3,3,2,3,2,-3,3,-2,3,3,3,3,-2,3,7,7,7,5,5,5,8,7,8,9,9,8 +R_6MupnsimpiL9sv5,67 - 73,American,Female,Somewhat agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,4,5,2,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,1,2,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,1,2,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,4,2,3,5,1,2,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,2,5,1,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,3,2,1,4,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,4,3,5,1,2,1,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,5,1,0,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,3,1,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,2,5,4,3,1,1,Agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,5,4,1,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,3,1,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,4,3,2,5,1,0,1,1,2,0,0,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,71,02PsVPf,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,7,4,5,9,8,6,3,1,2,4,2,3,1,1,2,2,0,0,-1,0,0,0,1,1,0,2,0,2,2,2,2,0,0,0,0,0,0,0,1,0,1,0,3,2,2,2,0,0,1,0,0,0,0,1,0,1,0,3,2,2,2,0,0,-1,0,0,0,0,1,0,1,0,3,2,2,2,0,0,-2,0,0,0,0,1,0,1,0,3,2,1,3,2,1,4,1,0,1,1,1,1 +R_38IEmEQGL9k2F8J,53 - 59,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,5,2,4,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,4,2,3,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,3,4,5,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,1,4,3,2,5,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,1,4,2,5,3,6,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,2,3,4,1,4,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,3,4,5,1,2,6,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,4,1,2,5,4,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,4,2,1,4,Agree,Agree,Agree,Somewhat agree,Strongly agree,4,3,1,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,3,1,5,4,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,3,5,2,1,Agree,Agree,Agree,Somewhat agree,Strongly agree,1,2,3,4,5,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,2,4,5,3,1,3,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,3,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,0,0,1,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,03VPfPs,02FUT,5,01ITEM,-0.25,0,1,2,5,9,6,3,7,8,1,4,4,3,2,1,1,1,1,0,3,0,-1,1,1,1,2,2,2,0,1,2,2,2,0,3,0,0,2,0,2,2,2,2,0,2,2,2,2,0,3,0,0,2,0,2,2,2,2,0,2,2,2,2,1,3,0,0,2,0,1,2,2,2,0,2,2,2,2,1,3,0,0,2,0,2,2,2,2,0,2,3,6,4,6,4,4,2,2,1,3,3,3 +R_1kHpDuYWtSWKU9i,60 - 66,Canadian,Female,Strongly disagree,Somewhat agree,Strongly disagree,Disagree,Somewhat disagree,3,2,4,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,3,2,4,Strongly Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,2,3,5,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly disagree,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,5,2,3,1,1,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,2,1,4,1,Strongly agree,Agree,Agree,Somewhat Agree,Strongly agree,4,1,2,5,3,4,Strongly disagree,Strongly agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,1,2,4,3,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,2,5,4,3,2,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,1,5,3,1,Strongly disagree,Somewhat agree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,1,5,2,1,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,2,3,4,5,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,1,Strongly disagree,Agree,Somewhat disagree,Strongly disagree,Somewhat disagree,4,1,5,2,3,1,Agree,Strongly agree,Agree,Agree,Agree,1,2,4,3,5,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,2,5,4,3,1,1,1,1,-2,-2,-1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),61,01PfPsV,01PAST,10,02DGEN,1.125,0,1,6,5,2,7,8,9,4,1,3,2,3,4,1,-3,1,-3,-2,-1,0,1,1,1,-1,3,3,2,0,2,-3,0,-3,-3,-3,1,0,1,1,0,3,2,2,1,3,-3,3,1,-1,0,1,0,1,0,-1,3,3,2,0,3,-3,1,-3,-3,-3,2,3,3,3,2,3,3,3,3,3,-3,2,-1,-3,-1,2,3,2,2,2,3,3,3,2,3,1,1,1,4,2,2,1,1,1,1,1,1 +R_3wS43W1JVNrzX1L,67 - 73,Canadian,Male,Agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,3,2,5,1,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,5,3,1,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,3,4,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,5,4,3,1,2,6,Agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,5,2,4,3,1,4,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,5,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,4,1,5,2,3,5,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,1,5,4,5,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,3,2,1,4,5,5,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,3,5,4,2,1,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,1,2,5,4,3,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,4,5,2,3,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,1,2,3,4,5,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,4,1,5,2,3,5,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,5,3,4,1,2,1,0,1,2,-1,-1,0,0,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,70,03VPfPs,02FUT,10,02DGEN,0.25,0,0.666666667,9,6,3,4,2,8,7,1,5,4,3,2,1,2,1,2,1,1,2,2,1,1,1,1,1,2,1,1,1,2,1,1,2,2,-1,2,-1,1,2,1,0,1,1,1,1,2,2,1,1,2,1,-1,1,2,1,1,2,1,1,1,2,2,1,1,1,2,1,2,1,1,2,1,2,1,0,1,1,2,1,1,2,1,2,1,1,0,1,0,6,6,4,5,5,5,5,5,5,5,5,5 +R_714Noev150iyC8S,67 - 73,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,1,2,10,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,2,5,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,4,3,10,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,4,5,2,3,1,10,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,4,1,5,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,3,1,4,2,5,5,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,4,5,2,3,1,10,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,3,1,4,2,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,5,1,2,4,5,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,1,4,3,2,5,5,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,1,2,5,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,2,1,3,5,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-2,-2,-2,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,67,01PfPsV,01PAST,5,01ITEM,1.5,0,1,9,8,2,3,5,7,6,1,4,4,3,2,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,-2,3,-3,3,3,-3,3,-3,3,3,-3,3,3,3,3,3,-3,3,-3,3,3,3,-3,-3,3,3,3,-3,3,1,1,3,3,-3,0,3,3,3,0,3,3,3,-3,3,10,0,10,10,0,5,10,5,5,5,5,5 +R_3ePLhpK1NKfkB2N,60 - 66,Canadian,Male,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,Strongly disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,1,2,4,Strongly agree,Strongly agree,Agree,Somewhat disagree,Neither agree nor disagree,1,2,5,3,4,8,Strongly disagree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,1,2,5,4,3,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,4,5,3,2,8,Strongly agree,Strongly agree,Agree,Somewhat disagree,Neither agree nor disagree,3,5,2,4,1,7,Strongly disagree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,2,1,4,5,3,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,4,2,1,7,Strongly agree,Strongly agree,Agree,Somewhat disagree,Somewhat agree,2,1,5,4,3,8,Strongly disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,3,4,5,2,8,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,1,4,2,5,3,8,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,2,1,5,3,7,Strongly disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,2,4,3,5,8,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,4,2,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,0,-1,1,0,0,5 cents,5 minutes,24 days,Male,University - Undergraduate,62,03VPfPs,01PAST,10,01ITEM,0.125,0.666666667,0.333333333,8,4,5,6,2,9,3,1,7,2,4,3,1,3,3,2,0,0,-3,-2,2,-2,0,0,0,2,0,0,3,3,2,-1,0,-3,-2,2,-3,0,0,0,2,0,1,3,3,2,-1,0,-3,-2,2,-3,0,0,0,2,0,0,3,3,2,-1,1,-3,-2,2,-2,0,1,0,2,-1,0,2,2,2,0,1,-3,-2,2,-2,0,1,0,2,0,0,8,8,8,7,8,7,8,8,8,7,8,8 +R_5gUHoJeCdaBVT7l,46 - 52,Canadian,Female,Somewhat disagree,Agree,Strongly agree,Strongly agree,Somewhat disagree,4,2,5,3,1,Strongly disagree,Disagree,Somewhat disagree,Agree,Strongly disagree,3,1,5,2,4,Strongly Agree,Somewhat Disagree,Somewhat Disagree,Strongly Disagree,Strongly Agree,1,3,5,4,2,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,Disagree,4,5,1,3,2,2,Strongly disagree,Somewhat disagree,Somewhat disagree,Strongly agree,Strongly disagree,4,2,3,1,5,3,Strongly agree,Somewhat Disagree,Somewhat Disagree,Strongly Disagree,Strongly agree,1,4,5,3,2,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Disagree,2,1,5,3,4,3,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,5,1,3,2,4,5,Strongly agree,Disagree,Somewhat Agree,Somewhat Agree,Strongly agree,3,4,2,5,1,6,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,4,2,1,3,5,7,Disagree,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,2,4,1,6,Strongly agree,Disagree,Agree,Somewhat Agree,Strongly agree,4,5,3,1,2,6,Agree,Agree,Strongly agree,Agree,Agree,3,4,2,5,1,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,2,5,4,6,Strongly agree,Disagree,Agree,Somewhat Agree,Strongly agree,5,4,2,1,3,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-1,-1,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),51,01PfPsV,01PAST,5,01ITEM,0.25,0,1,4,8,6,7,5,2,3,1,9,4,3,2,1,-1,2,3,3,-1,-3,-2,-1,2,-3,3,-1,-1,-3,3,-1,3,3,3,-2,-3,-1,-1,3,-3,3,-1,-1,-3,3,1,1,2,1,-2,-3,1,-3,3,-3,3,-2,1,1,3,1,1,3,3,1,-2,-3,1,1,1,3,-2,2,1,3,2,2,3,2,2,1,-1,1,1,1,3,-2,2,1,3,2,3,1,3,5,6,7,6,6,6,6,7 +R_1EfA786ISA23pMn,25 - 31,Canadian,Male,Agree,Agree,Somewhat agree,Somewhat agree,Agree,4,5,2,1,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,1,5,2,3,4,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,5,1,3,2,5,Strongly agree,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,3,4,1,5,2,4,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,5,1,4,2,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,3,5,1,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,3,2,1,4,5,3,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,1,2,3,5,4,2,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,3,2,1,5,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,3,5,1,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,5,1,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,3,1,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,4,2,1,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,4,5,1,1,0,1,2,0,1,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,29,02PsVPf,02FUT,5,02DGEN,-0.375,0,1,9,6,7,5,3,2,4,1,8,3,2,4,1,2,2,1,1,2,1,1,1,-1,2,1,1,2,0,1,-1,0,1,1,-1,3,-2,-1,-1,1,0,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,1,1,1,3,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,4,3,3,3,2,2,2,2,2,2 +R_7m3R1BTrRSjTZpB,46 - 52,Canadian,Male,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,2,5,1,4,3,Agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,2,1,3,5,4,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,5,3,1,4,Strongly agree,Strongly agree,Strongly disagree,Somewhat disagree,Somewhat agree,1,2,5,4,3,10,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,2,5,3,1,4,8,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,1,2,5,3,4,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,3,4,2,5,7,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Disagree,3,2,1,5,4,8,Strongly agree,Strongly agree,Somewhat Disagree,Strongly Disagree,Strongly agree,1,4,2,3,5,8,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,5,1,3,4,2,2,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,4,3,5,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,2,1,4,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,Strongly agree,1,3,2,4,5,5,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,3,2,5,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,1,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,-1,-1,-2,1,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),48,02PsVPf,02FUT,5,01ITEM,1.125,0,1,4,6,3,5,7,9,8,1,2,2,4,3,1,1,3,-1,3,-3,2,1,3,2,1,2,3,3,2,3,3,3,-3,-1,1,-1,3,0,3,-1,3,3,3,-1,3,3,3,3,3,2,0,3,0,3,-2,3,3,-1,-3,3,3,3,-3,3,-3,2,3,3,3,1,3,3,3,3,3,3,3,-1,3,3,1,3,3,3,1,3,3,3,3,3,10,8,7,7,8,8,2,2,4,5,3,0 +R_57zt0ILImxjmtGh,53 - 59,Canadian,Female,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,5,1,3,4,2,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Disagree,5,4,3,1,2,Agree,Agree,Strongly Agree,Agree,Agree,4,3,5,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Somewhat agree,Agree,Agree,Agree,3,4,5,1,2,1,Neither agree nor disagree,Somewhat agree,Agree,Strongly agree,Disagree,3,4,2,5,1,1,Strongly agree,Agree,Strongly agree,Somewhat Agree,Agree,4,2,5,1,3,3,Agree,Agree,Agree,Agree,Agree,5,4,3,1,2,1,Somewhat disagree,Agree,Agree,Strongly agree,Disagree,4,2,5,1,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,3,1,5,4,1,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,5,1,4,3,2,1,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,Neither agree nor disagree,4,1,3,5,2,0,Strongly agree,Agree,Strongly agree,Disagree,Agree,2,4,5,1,3,0,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,2,3,1,5,4,1,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Disagree,4,1,3,5,2,1,Strongly agree,Agree,Strongly agree,Somewhat Disagree,Agree,5,2,1,4,3,2,2,2,2,1,2,2,1,10 cents,100 minutes,47 days,Female,University - Graduate (Masters),58,01PfPsV,01PAST,10,02DGEN,0,0.333333333,0.666666667,8,5,6,2,9,3,7,1,4,4,3,2,1,3,2,2,3,3,0,-2,2,-1,-2,2,2,3,2,2,2,1,2,2,2,0,1,2,3,-2,3,2,3,1,2,2,2,2,2,2,-1,2,2,3,-2,3,3,3,3,2,3,2,2,3,3,0,0,2,-2,0,3,2,3,-2,2,3,2,2,3,3,0,1,2,-2,-2,3,2,3,-1,2,0,1,1,3,1,1,1,1,0,0,1,1 +R_7rBJSZZGplyzifl,53 - 59,Canadian,Female,Agree,Agree,Agree,Agree,Agree,4,5,1,3,2,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,2,4,3,5,1,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Agree,Agree,Agree,Agree,1,5,3,4,2,0,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,1,3,2,4,0,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,1,5,2,3,0,Agree,Agree,Agree,Agree,Agree,5,4,1,2,3,0,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,3,2,4,1,0,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,4,2,3,0,Agree,Agree,Agree,Agree,Agree,2,3,1,4,5,0,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,5,4,1,2,0,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,1,3,2,0,Agree,Agree,Agree,Agree,Agree,3,4,1,2,5,0,Somewhat disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,2,1,5,3,0,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,5,4,1,0,1,1,1,1,1,1,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),58,03VPfPs,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,6,7,5,4,9,3,8,1,2,4,3,2,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,2,2,2,2,2,-1,-2,2,-2,0,2,2,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0 +R_7Rym0Fc7Nb4IVHx,39 - 45,Canadian,Male,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,1,4,3,2,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,4,1,3,Strongly Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,2,1,3,4,5,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,3,2,5,4,1,5,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,4,1,5,7,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,2,3,4,1,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,1,2,5,3,4,9,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,2,1,3,4,4,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,4,5,1,3,2,7,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,5,3,1,2,4,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,1,5,4,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,4,3,1,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,5,2,7,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,1,5,2,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,2,3,5,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,1,2,-1,-1,0,1,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,40,02PsVPf,01PAST,5,01ITEM,0.375,0,0.666666667,5,2,6,3,7,9,4,1,8,2,4,3,1,3,2,2,1,3,-3,-3,-3,-3,-3,3,1,1,3,1,3,2,2,1,3,-3,-3,-3,-3,-3,2,1,1,1,0,1,1,1,1,3,-3,-3,-3,-3,-3,1,1,2,1,1,3,1,1,0,3,-3,-3,-3,-3,-3,1,1,1,1,1,1,1,1,1,1,-3,-3,-3,-3,-3,1,1,1,1,1,5,7,6,9,4,7,10,8,6,7,7,7 +R_7haSl9uSPTwF7YN,53 - 59,Canadian,Female,Somewhat agree,Agree,Agree,Disagree,Strongly agree,1,5,3,2,4,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,4,3,2,1,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,2,5,4,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,2,1,4,5,3,7,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,4,1,2,6,Agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Agree,3,2,5,1,4,7,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Agree,1,2,3,4,5,5,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,5,3,1,2,4,6,Agree,Agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,1,4,2,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,4,1,2,3,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,3,Strongly agree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,4,2,3,1,5,3,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Agree,3,5,2,4,1,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,3,Agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,2,4,1,5,3,2,2,2,2,-1,1,2,0,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),56,02PsVPf,01PAST,5,02DGEN,0.25,0.666666667,0.333333333,5,8,6,3,7,2,4,1,9,3,4,2,1,1,2,2,-2,3,0,1,3,0,3,1,0,3,0,2,0,2,2,0,3,0,3,1,0,1,2,1,3,0,2,0,2,2,-1,2,0,3,1,3,1,2,2,3,1,3,0,2,2,0,2,0,0,0,0,0,3,0,3,-2,3,0,2,3,1,2,0,1,0,0,1,2,1,3,2,3,5,7,6,7,5,6,2,6,3,3,4,3 +R_1k5CwncYiKZj3Y5,53 - 59,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,3,1,2,5,4,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,1,3,4,5,2,Disagree,Somewhat Agree,Strongly Agree,Strongly Disagree,Somewhat Agree,2,1,5,3,4,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,1,2,5,4,3,4,Strongly agree,Disagree,Strongly agree,Disagree,Somewhat agree,2,5,4,3,1,2,Somewhat Disagree,Somewhat Agree,Strongly agree,Strongly Disagree,Somewhat Agree,2,3,4,5,1,2,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Strongly agree,1,2,3,4,5,5,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,2,5,3,1,4,6,Somewhat Disagree,Somewhat Agree,Strongly agree,Strongly Disagree,Agree,5,2,1,4,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,2,3,5,4,0,Strongly agree,Neither agree nor disagree,Strongly agree,Disagree,Agree,4,1,5,2,3,1,Disagree,Somewhat Agree,Strongly agree,Strongly Disagree,Agree,4,2,5,3,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,5,3,4,1,2,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,2,5,1,3,4,0,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Agree,4,5,3,1,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,1,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),59,01PfPsV,02FUT,5,01ITEM,0.125,0,1,8,7,2,5,4,6,9,1,3,3,4,2,1,3,3,3,1,1,2,-1,3,-1,1,-2,1,3,-3,1,3,3,3,1,-1,3,-2,3,-2,1,-1,1,3,-3,1,3,3,1,-1,3,3,1,3,1,1,-1,1,3,-3,2,3,3,3,3,2,3,0,3,-2,2,-2,1,3,-3,2,3,3,3,3,1,3,-2,3,-1,1,-1,0,3,-3,2,4,2,2,5,6,4,0,1,3,2,0,2 +R_3zSHSrn1Edyc7dM,67 - 73,Canadian,Female,Somewhat disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,4,3,2,1,5,Strongly disagree,Disagree,Neither agree nor disagree,Strongly agree,Disagree,3,2,4,1,5,Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,5,4,2,1,Somewhat disagree,Neither agree nor disagree,Agree,Agree,Strongly disagree,2,3,1,5,4,1,Strongly disagree,Disagree,Agree,Agree,Disagree,3,1,4,5,2,1,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Strongly agree,2,4,3,1,5,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly disagree,5,4,2,1,3,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,5,3,4,1,2,2,Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,3,1,5,4,2,Somewhat disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,4,1,5,2,3,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,5,2,3,1,1,Agree,Somewhat Agree,Strongly agree,Disagree,Strongly agree,5,1,4,3,2,1,Somewhat disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,4,3,5,1,2,2,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,5,1,4,3,2,2,Agree,Somewhat Disagree,Agree,Disagree,Strongly agree,3,1,5,4,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,2,0,2,2,0,5 cents,5 minutes,24 days,Female,High School (or equivalent),67,01PfPsV,02FUT,10,01ITEM,-0.25,0.666666667,0.333333333,7,8,5,9,4,3,6,1,2,2,4,3,1,-1,0,3,3,-3,-3,-2,0,3,-2,2,0,3,-3,3,-1,0,2,2,-3,-3,-2,2,2,-2,3,1,3,-1,3,1,0,3,1,-3,0,0,2,1,0,2,0,3,0,3,-1,0,3,3,-3,-3,0,0,0,-3,2,1,3,-2,3,-1,0,3,3,-3,-3,0,0,0,-2,2,-1,2,-2,3,1,1,1,2,2,2,1,1,1,2,2,3 +R_5cklMbb05Lvui0w,53 - 59,Canadian,Female,Strongly agree,Agree,Agree,Strongly agree,Agree,4,5,3,2,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Disagree,Somewhat agree,3,5,1,4,2,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,3,2,1,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Strongly agree,Agree,Neither agree nor disagree,Agree,Disagree,2,5,3,1,4,4,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Disagree,4,1,5,2,3,2,Strongly agree,Agree,Agree,Somewhat Agree,Strongly agree,1,2,4,3,5,3,Strongly agree,Agree,Disagree,Somewhat agree,Strongly agree,2,4,5,1,3,5,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,1,4,2,3,5,5,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,1,2,4,3,5,0,Strongly agree,Agree,Agree,Agree,Strongly agree,1,3,4,5,2,1,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,2,1,5,3,4,1,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,5,2,4,3,1,2,Strongly agree,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,2,3,4,1,5,2,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,7,Strongly agree,Agree,Strongly agree,Disagree,Strongly agree,2,4,1,3,5,1,2,0,1,0,0,1,-2,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,59,03VPfPs,01PAST,10,02DGEN,-0.125,1,0,6,8,2,9,3,5,7,1,4,4,3,2,1,3,2,2,3,2,0,0,3,-2,1,3,2,2,0,3,3,2,0,2,-2,-2,0,2,1,-2,3,2,2,1,3,3,2,-2,1,3,2,0,3,1,1,3,1,3,1,3,3,2,2,2,3,1,-1,2,-2,1,3,2,3,-3,3,3,0,2,3,1,1,0,2,0,0,3,2,3,-2,3,2,4,2,3,5,5,0,1,1,2,2,7 +R_5zbTKvOz9belf19,60 - 66,Canadian,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Somewhat disagree,1,3,4,5,2,Strongly Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,4,1,2,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,0,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Disagree,3,1,5,2,4,0,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,5,1,3,2,4,0,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,0,Disagree,Disagree,Strongly agree,Somewhat agree,Somewhat agree,3,1,5,2,4,0,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,5,1,3,4,2,0,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,0,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,Disagree,4,1,3,2,5,0,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,3,1,2,5,4,0,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,0,Disagree,Disagree,Agree,Somewhat agree,Somewhat disagree,3,1,4,2,5,0,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,4,3,2,1,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,1,-1,1,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,63,01PfPsV,02FUT,5,01ITEM,0.375,0,1,7,8,4,6,9,2,5,1,3,4,2,3,1,1,3,3,3,3,-3,-2,3,1,-1,3,-2,3,-3,3,2,3,3,3,3,-3,-2,3,1,-2,3,-2,3,-2,3,1,3,3,3,3,-2,-2,3,1,1,3,-2,3,-2,3,0,3,3,3,3,-3,-3,1,1,-2,3,-1,2,-2,3,2,3,3,3,3,-2,-2,2,1,-1,3,-1,2,-2,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_3oLwEdYU6imjRZ5,67 - 73,Canadian,Female,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,5,3,1,2,Strongly disagree,Disagree,Somewhat agree,Neither agree nor disagree,Strongly disagree,1,3,5,4,2,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,2,5,1,4,3,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,1,2,4,5,3,1,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,3,1,2,4,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,5,1,4,2,3,2,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,5,3,1,4,2,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,2,3,4,1,2,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,3,1,5,2,4,3,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,2,3,5,1,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,5,1,3,2,Agree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Agree,1,4,2,5,3,2,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,5,4,1,2,3,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,3,2,5,4,1,2,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Somewhat Agree,4,1,5,2,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),67,03VPfPs,01PAST,5,01ITEM,0,0,1,5,2,6,9,7,8,4,1,3,2,3,4,1,0,3,3,3,-3,-3,-2,1,0,-3,1,1,0,-1,1,0,3,3,3,-3,-2,-1,0,0,-1,1,0,0,-1,1,0,3,3,3,-3,-3,0,0,0,-1,1,0,0,-3,1,0,3,3,3,-3,-3,0,0,0,0,2,1,1,-2,1,0,3,3,3,-3,-3,0,0,0,-3,1,0,0,-3,1,1,3,2,1,2,3,1,2,2,1,2,2 +R_3FIoaAeGU3Saft8,39 - 45,Canadian,Female,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,5,1,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,3,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,2,5,1,4,3,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,2,3,5,4,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,1,2,4,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,1,4,2,6,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,4,3,2,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,7,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,2,1,4,3,5,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,1,2,5,4,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,1,3,5,1,1,0,0,-1,0,0,1,5 cents,100 minutes,47 days,Female,College Diploma/Certificate,41,01PfPsV,01PAST,5,02DGEN,0.5,0.666666667,0.333333333,5,7,3,9,6,4,8,1,2,4,3,2,1,0,1,1,-2,1,1,1,1,0,0,0,1,1,0,0,0,1,1,-2,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,1,1,1,0,1,2,1,0,1,1,1,0,1,1,1,0,0,5,6,6,6,6,6,6,7,7,6,6,7 +R_1dNnZpCWyypzFjc,39 - 45,Canadian,Female,Agree,Strongly agree,Strongly agree,Disagree,Agree,4,3,2,1,5,Agree,Disagree,Somewhat agree,Strongly agree,Agree,4,2,3,5,1,Disagree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,1,5,2,3,4,Agree,Strongly agree,Agree,Disagree,Somewhat agree,2,5,4,1,3,8,Agree,Disagree,Somewhat agree,Somewhat agree,Agree,3,5,4,1,2,3,Disagree,Disagree,Strongly agree,Disagree,Strongly agree,3,5,4,1,2,3,Somewhat agree,Agree,Agree,Disagree,Somewhat agree,2,5,4,3,1,2,Agree,Disagree,Somewhat agree,Disagree,Agree,3,1,4,2,5,2,Disagree,Disagree,Strongly agree,Agree,Strongly agree,4,2,3,5,1,4,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,1,5,3,2,3,Disagree,Disagree,Agree,Somewhat agree,Strongly agree,2,5,1,3,4,3,Disagree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,2,5,4,3,1,3,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,5,2,1,3,2,Disagree,Disagree,Strongly agree,Somewhat agree,Agree,2,5,3,4,1,3,Disagree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,2,5,1,3,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-2,2,2,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,42,03VPfPs,01PAST,5,01ITEM,0.375,1,0,8,7,3,6,2,5,4,1,9,3,2,4,1,2,3,3,-2,2,2,-2,1,3,2,-2,-1,3,1,3,2,3,2,-2,1,2,-2,1,1,2,-2,-2,3,-2,3,1,2,2,-2,1,2,-2,1,-2,2,-2,-2,3,2,3,2,3,3,1,3,-2,-2,2,1,3,-2,-1,3,2,3,3,3,3,-2,3,-2,-2,3,1,2,-2,1,3,1,3,8,3,3,2,2,4,3,3,3,2,3,3 +R_3GuRBPRYbGeCmxb,53 - 59,Canadian,Male,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,3,1,5,4,2,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,4,3,2,5,1,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,5,4,3,1,2,1,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,4,5,2,3,1,3,Strongly agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly agree,2,1,4,5,3,2,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,5,4,2,1,3,3,Agree,Disagree,Strongly agree,Disagree,Somewhat agree,1,4,3,5,2,3,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,5,4,1,2,3,3,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,5,2,4,3,1,2,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,5,4,3,2,1,4,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Strongly agree,5,2,4,3,1,4,Agree,Agree,Strongly agree,Neither agree nor disagree,Agree,5,3,4,2,1,5,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,4,3,1,2,4,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,2,3,1,5,4,2,2,1,1,0,0,0,1,5 cents,5 minutes,24 days,Male,Trade School (non-military),56,01PfPsV,01PAST,5,02DGEN,0.625,0.666666667,0.333333333,9,4,6,8,5,3,7,1,2,3,4,2,1,2,2,3,0,2,0,-2,3,-2,2,2,0,2,0,3,2,2,3,0,2,0,-2,3,-2,2,3,0,2,0,3,2,2,3,0,2,2,-2,3,-2,1,2,0,0,0,2,2,2,3,0,2,0,-2,2,-2,2,2,0,0,-2,3,2,2,3,0,2,0,-3,2,-3,1,3,0,0,-1,3,1,1,3,2,3,3,3,2,4,4,5,4 +R_1v7mtrAcuSjwnvY,46 - 52,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Strongly disagree,Agree,4,3,5,2,1,Somewhat disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,Somewhat Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,Neither agree nor disagree,2,3,1,4,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,5,3,4,3,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Agree,4,1,2,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,4,2,2,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly disagree,Agree,4,5,3,1,2,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,1,5,2,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,2,3,2,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly disagree,Agree,4,3,5,1,2,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,2,1,4,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,1,3,5,2,2,2,2,0,2,2,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,52,02PsVPf,01PAST,5,02DGEN,0.125,1,0,3,8,5,9,6,4,7,1,2,3,4,2,1,0,2,1,-3,2,-1,0,3,0,0,-1,-3,3,0,0,0,0,0,0,0,0,0,2,-3,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,-3,2,0,0,3,-3,0,0,0,0,0,0,0,2,0,-3,2,0,0,3,-3,0,0,0,3,0,0,2,5,2,3,2,2,2,2,2,2,2,2 +R_5t9WlW88wHr6PTD,39 - 45,Canadian,Male,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Agree,5,1,4,3,2,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,2,3,4,Strongly Agree,Disagree,Agree,Somewhat Disagree,Strongly Agree,3,5,2,4,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Agree,3,4,1,5,2,2,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,3,1,4,2,5,2,Agree,Disagree,Agree,Somewhat Disagree,Strongly agree,5,2,4,1,3,2,Neither agree nor disagree,Agree,Strongly agree,Neither agree nor disagree,Agree,3,1,2,5,4,3,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,4,Strongly agree,Disagree,Agree,Neither Agree nor Disagree,Strongly agree,1,4,3,2,5,3,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,4,3,2,1,5,1,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,1,4,5,3,1,Agree,Disagree,Agree,Somewhat Disagree,Strongly agree,3,5,1,4,2,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Somewhat agree,5,3,2,1,4,3,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,5,4,2,3,1,1,Strongly agree,Disagree,Agree,Somewhat Disagree,Strongly agree,2,4,3,5,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,1,2,2,1,5 cents,100 minutes,47 days,Male,University - Graduate (Masters),43,03VPfPs,02FUT,10,01ITEM,-0.125,0.666666667,0.333333333,4,7,5,6,8,9,2,1,3,2,3,4,1,0,2,3,1,2,0,-2,1,0,1,3,-2,2,-1,3,0,1,3,1,2,-2,0,2,0,1,2,-2,2,-1,3,0,2,3,0,2,-2,0,2,0,0,3,-2,2,0,3,0,1,3,1,1,0,-2,2,-1,1,2,-2,2,-1,3,0,1,3,2,1,1,-1,2,0,2,3,-2,2,-1,3,2,2,2,3,4,3,1,1,1,3,1,0 +R_18SUwkYfG9qBhAh,32 - 38,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,Strongly agree,1,4,3,5,2,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,5,3,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,4,1,3,5,2,Disagree,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,2,Somewhat disagree,Strongly disagree,Somewhat disagree,Disagree,Disagree,2,1,5,3,4,2,Somewhat Disagree,Neither Agree nor Disagree,Strongly Disagree,Somewhat Disagree,Disagree,3,4,2,5,1,2,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat disagree,Somewhat disagree,3,2,1,4,5,2,Somewhat disagree,Disagree,Disagree,Somewhat disagree,Somewhat disagree,5,1,3,2,4,2,Somewhat Disagree,Disagree,Disagree,Somewhat Disagree,Somewhat Disagree,3,4,1,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,1,4,2,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,4,2,5,3,1,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,2,4,5,1,2,Disagree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat disagree,1,2,5,3,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,Disagree,2,4,5,3,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,1,-1,0,1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,01PfPsV,02FUT,5,01ITEM,-0.125,0,1,5,7,4,6,2,3,8,1,9,2,4,3,1,0,2,1,-1,3,-1,1,0,0,0,0,-1,0,1,0,-2,-1,-2,-1,-1,-1,-3,-1,-2,-2,-1,0,-3,-1,-2,-1,0,-2,-1,-1,-1,-2,-2,-1,-1,-1,-2,-2,-1,-1,0,0,0,1,0,0,0,-1,1,0,0,0,-1,-1,-1,-1,0,0,0,-1,-2,-1,-1,-2,-1,0,0,-1,-1,-2,2,2,2,2,2,2,2,2,1,2,2,2 +R_6vzQFHkLNsJbjHz,32 - 38,Canadian,Male,Agree,Agree,Agree,Neither agree nor disagree,Agree,2,3,1,4,5,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,5,2,1,4,Agree,Agree,Agree,Somewhat Agree,Agree,5,1,3,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,4,2,5,3,2,Agree,Disagree,Agree,Disagree,Agree,5,4,1,2,3,2,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,5,2,4,3,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,4,3,1,5,2,2,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,5,2,1,4,3,2,Agree,Disagree,Agree,Disagree,Somewhat agree,3,5,2,1,4,2,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,3,4,2,5,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,3,2,5,4,1,2,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,0,2,2,2,0,0,2,1,10 cents,100 minutes,47 days,Male,University - Undergraduate,36,03VPfPs,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,6,5,4,2,3,8,9,1,7,2,3,4,1,2,2,2,0,2,0,-2,2,-1,0,2,2,2,1,2,2,2,2,0,2,2,-2,2,-2,2,2,2,2,2,2,2,2,2,0,2,1,-2,2,-2,1,2,2,2,2,2,2,2,2,0,2,2,-2,2,-2,1,2,2,2,2,2,2,2,2,0,2,1,-2,2,-2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 +R_7MMekJdpF6Vor4N,60 - 66,Canadian,Male,Neither agree nor disagree,Somewhat agree,Strongly agree,Disagree,Somewhat disagree,4,5,1,3,2,Neither agree nor disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,5,2,4,1,3,Agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,5,2,4,3,1,Somewhat disagree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat disagree,2,5,1,3,4,0,Somewhat disagree,Strongly disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,3,4,2,1,1,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,2,4,1,3,5,0,Somewhat disagree,Agree,Strongly agree,Strongly disagree,Somewhat disagree,1,3,2,5,4,2,Disagree,Strongly disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,4,3,2,5,4,Agree,Somewhat Agree,Strongly agree,Strongly Disagree,Agree,3,1,4,5,2,1,Somewhat disagree,Agree,Strongly agree,Strongly disagree,Disagree,2,3,5,4,1,2,Disagree,Strongly disagree,Agree,Strongly disagree,Somewhat disagree,4,5,1,2,3,2,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,3,5,1,4,2,1,Disagree,Somewhat agree,Strongly agree,Strongly disagree,Disagree,1,2,3,5,4,2,Somewhat disagree,Strongly disagree,Somewhat agree,Strongly disagree,Disagree,2,5,3,1,4,0,Agree,Agree,Agree,Strongly Disagree,Agree,5,1,4,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,1,1,1,2,2,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,60,01PfPsV,01PAST,10,01ITEM,0.25,1,0,3,7,4,6,9,8,5,1,2,2,4,3,1,0,1,3,-2,-1,0,-3,2,-1,-1,2,1,1,-2,2,-1,1,3,-3,-1,-1,-3,1,-2,0,2,1,2,-3,2,-1,2,3,-3,-1,-2,-3,1,-2,0,2,1,3,-3,2,-1,2,3,-3,-2,-2,-3,2,-3,-1,2,1,2,-3,2,-2,1,3,-3,-2,-1,-3,1,-3,-2,2,2,2,-3,2,0,1,0,2,4,1,2,2,1,2,0,1 +R_5CHmpGft3VrvEBo,60 - 66,Canadian,Male,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,3,5,2,1,4,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,5,3,4,1,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Agree,2,3,1,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,1,2,5,3,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,1,5,4,2,3,1,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,4,2,3,5,1,2,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Agree,1,2,5,4,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,1,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Agree,Agree,3,5,2,1,4,1,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,1,2,3,4,5,1,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,1,4,2,5,1,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,3,4,5,1,2,1,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,1,3,5,4,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,2,3,4,5,1,1,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Agree,1,2,5,4,3,0,1,1,1,0,1,1,0,5 cents,5 minutes,47 days,Male,Professional Degree (ex. JD/MD),66,02PsVPf,02FUT,5,02DGEN,-0.125,1,0,3,2,5,6,8,9,7,1,4,4,2,3,1,-3,3,3,-3,-3,1,1,1,-2,0,1,-1,2,1,2,-3,3,3,-3,-3,1,1,1,-1,1,1,-1,1,1,2,-3,3,3,-3,2,1,1,1,1,1,1,-2,1,1,2,-3,3,3,-3,-3,1,2,1,-1,0,1,-1,1,1,2,-3,3,3,-3,-3,1,1,1,-2,0,1,-1,1,1,2,1,1,1,2,2,1,1,1,1,1,1,1 +R_1PYxLxS3QW7j3oD,46 - 52,Canadian,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,3,1,2,5,4,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,4,3,5,2,1,Somewhat Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,2,4,3,1,5,Strongly agree,Strongly agree,Agree,Somewhat disagree,Somewhat agree,4,5,1,3,2,2,Strongly disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,1,3,4,5,2,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,4,2,1,5,3,3,Strongly agree,Strongly agree,Strongly agree,Disagree,Neither agree nor disagree,2,4,1,5,3,4,Strongly disagree,Agree,Agree,Agree,Somewhat agree,1,2,5,4,3,6,Somewhat Agree,Strongly Disagree,Strongly agree,Somewhat Disagree,Somewhat Agree,2,1,3,4,5,4,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,5,1,2,4,0,Strongly disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,3,5,1,2,1,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Somewhat Agree,1,4,2,3,5,1,Strongly agree,Agree,Somewhat agree,Strongly agree,Agree,4,1,5,2,3,2,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat disagree,2,1,5,3,4,1,Somewhat Agree,Somewhat Agree,Strongly agree,Strongly Disagree,Somewhat Agree,3,1,2,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,2,-1,-2,2,1,5 cents,5 minutes,47 days,Male,High School (or equivalent),51,01PfPsV,02FUT,10,01ITEM,0.5,1,0,7,3,5,8,6,2,4,1,9,4,3,2,1,3,3,2,3,2,-2,0,2,-1,2,1,-2,3,0,2,3,3,2,-1,1,-3,-1,2,1,1,1,0,2,-2,2,3,3,3,-2,0,-3,2,2,2,1,1,-3,3,-1,1,2,3,2,3,3,-3,-1,2,0,2,1,-1,2,-2,1,3,2,1,3,2,-1,1,1,-2,-1,1,1,3,-3,1,2,2,3,4,6,4,0,1,1,2,1,3 +R_56bUAbiNMFrT6EQ,39 - 45,American,Female,Disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,4,5,2,3,1,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,1,5,4,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,1,4,Somewhat disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Disagree,3,4,1,5,2,0,Strongly disagree,Disagree,Agree,Somewhat agree,Neither agree nor disagree,5,3,1,2,4,0,Strongly agree,Strongly agree,Strongly Disagree,Strongly Disagree,Somewhat Disagree,4,5,1,2,3,0,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Disagree,4,2,5,3,1,0,Strongly disagree,Disagree,Neither agree nor disagree,Somewhat agree,Strongly disagree,5,3,2,4,1,0,Strongly agree,Strongly agree,Strongly Disagree,Somewhat Disagree,Somewhat Disagree,4,3,2,5,1,0,Neither agree nor disagree,Strongly agree,Agree,Agree,Agree,5,2,3,1,4,0,Strongly disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,3,2,1,5,0,Strongly agree,Strongly agree,Agree,Strongly Disagree,Somewhat Agree,5,1,2,4,3,0,Somewhat disagree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,2,4,5,3,0,Strongly disagree,Somewhat disagree,Agree,Neither agree nor disagree,Strongly disagree,4,1,2,3,5,0,Strongly agree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,2,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,-2,-2,1,0,0,2,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),41,03VPfPs,01PAST,10,01ITEM,-1.375,0,1,5,9,2,6,4,3,8,1,7,2,4,3,1,-2,3,0,0,-3,-3,-1,0,1,-3,0,0,0,0,0,-1,3,3,0,-2,-3,-2,2,1,0,3,3,-3,-3,-1,0,3,2,0,-2,-3,-2,0,1,-3,3,3,-3,-1,-1,0,3,2,2,2,-3,-2,0,0,-2,3,3,2,-3,1,-1,3,3,2,1,-3,-1,2,0,-3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R_3PjJOEs4lPrWC53,25 - 31,Canadian,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,1,2,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,3,2,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,5,1,4,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,3,2,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,1,4,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,5,4,6,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,3,1,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,4,5,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,1,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,1,4,3,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,1,3,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,5,4,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,3,5,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,4,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,1,1,1,-1,-1,1,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,27,03VPfPs,01PAST,10,01ITEM,0.125,1,0,9,4,2,7,6,5,8,1,3,4,3,2,1,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,-1,1,1,1,1,1,-2,1,-1,1,1,1,1,1,1,1,1,1,1,1,1,-2,1,-1,1,1,1,1,1,1,0,1,1,1,1,1,-1,1,-1,1,1,1,1,1,1,5,5,5,6,6,6,1,2,3,1,1,1 +R_5wobymd5tkFP9tj,67 - 73,American,Male,Agree,Agree,Agree,Agree,Agree,4,5,1,2,3,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,5,4,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,1,5,2,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Agree,Agree,Agree,Strongly agree,4,3,2,1,5,5,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,2,3,1,4,5,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,5,4,2,1,3,3,Strongly agree,Agree,Agree,Agree,Strongly agree,1,3,2,4,5,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,5,2,4,1,3,3,Somewhat Agree,Somewhat Agree,Agree,Agree,Strongly agree,3,4,5,2,1,3,Strongly agree,Agree,Agree,Agree,Agree,1,3,2,5,4,4,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Agree,1,2,4,5,3,5,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly agree,4,2,5,3,1,4,Strongly agree,Agree,Agree,Agree,Strongly agree,5,2,1,3,4,3,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,5,4,3,2,4,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,4,1,5,3,2,0,2,2,2,0,2,2,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,70,02PsVPf,02FUT,5,02DGEN,-0.125,0.333333333,0.666666667,3,4,2,6,8,7,5,1,9,3,2,4,1,2,2,2,2,2,-1,1,1,1,1,1,0,2,1,3,3,2,2,2,3,-1,1,0,1,2,1,1,2,1,3,3,2,2,2,3,0,1,0,1,2,1,1,2,2,3,3,2,2,2,2,-1,0,2,1,2,1,0,2,1,3,3,2,2,2,3,-1,1,1,1,2,1,1,2,1,3,4,5,2,3,3,3,3,4,5,4,3,4 +R_1pXlkaaYWFKpNzX,46 - 52,Canadian,Male,Somewhat agree,Strongly agree,Disagree,Somewhat agree,Agree,2,4,5,1,3,Disagree,Somewhat disagree,Agree,Somewhat agree,Agree,2,4,5,1,3,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,4,5,3,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Somewhat agree,Agree,Agree,Strongly agree,Agree,2,3,1,4,5,8,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,3,5,4,2,8,Neither Agree nor Disagree,Somewhat Agree,Agree,Agree,Somewhat Agree,4,3,1,5,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,1,2,5,3,4,8,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,5,3,2,1,4,8,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,3,4,5,2,8,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,3,1,5,4,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,5,2,3,1,4,9,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,4,5,2,3,9,Agree,Strongly agree,Disagree,Agree,Agree,5,2,4,3,1,8,Somewhat agree,Strongly agree,Somewhat agree,Agree,Somewhat agree,1,3,5,2,4,7,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,1,5,4,2,3,0,1,1,-1,-2,-1,-1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,50,02PsVPf,02FUT,5,02DGEN,1,0,1,9,8,5,2,3,6,7,1,4,3,2,4,1,1,3,-2,1,2,-2,-1,2,1,2,1,1,0,2,1,1,2,2,3,2,2,2,2,1,1,0,1,2,2,1,1,1,1,0,2,1,2,1,2,1,1,2,1,1,0,2,1,1,0,2,1,1,2,1,0,1,1,2,2,1,2,3,-2,2,2,1,3,1,2,1,2,1,0,1,3,7,8,8,7,8,8,8,8,9,9,8,7 +R_6RflDkHds1J8B0z,60 - 66,American,Male,Disagree,Agree,Agree,Somewhat disagree,Agree,1,3,5,2,4,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,1,4,2,3,Somewhat Agree,Somewhat Agree,Agree,Disagree,Agree,2,3,1,5,4,Strongly disagree,Strongly agree,Agree,Disagree,Agree,2,1,3,5,4,3,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,4,1,2,3,3,Agree,Somewhat Agree,Agree,Disagree,Agree,1,2,5,3,4,3,Strongly disagree,Strongly agree,Strongly agree,Disagree,Agree,1,5,2,3,4,4,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,4,1,5,3,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly agree,2,5,1,4,3,3,Disagree,Strongly agree,Agree,Somewhat disagree,Agree,2,1,5,3,4,2,Somewhat agree,Strongly disagree,Agree,Disagree,Somewhat agree,2,1,4,5,3,2,Agree,Agree,Agree,Disagree,Strongly agree,1,3,4,2,5,2,Disagree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,5,1,2,3,4,3,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,2,4,5,3,2,Neither Agree nor Disagree,Somewhat Agree,Agree,Disagree,Agree,1,4,2,3,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,-1,0,1,0,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,62,01PfPsV,02FUT,10,01ITEM,0.25,0,0.333333333,5,9,3,7,2,6,8,1,4,4,3,2,1,-2,2,2,-1,2,1,-3,3,-3,1,1,1,2,-2,2,-3,3,2,-2,2,1,-3,3,-3,2,2,1,2,-2,2,-3,3,3,-2,2,2,-3,3,-3,2,2,1,2,-1,3,-2,3,2,-1,2,1,-3,2,-2,1,2,2,2,-2,3,-2,3,3,1,1,1,-3,2,-3,1,0,1,2,-2,2,3,3,3,4,2,3,2,2,2,3,2,3 +R_6Wx6aJ9SVGL76Uu,53 - 59,Canadian,Male,Agree,Strongly agree,Agree,Disagree,Somewhat agree,1,5,3,4,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,1,2,4,3,Strongly Agree,Somewhat Agree,Agree,Agree,Strongly Agree,2,5,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Neither agree nor disagree,Strongly agree,Strongly agree,Disagree,Somewhat agree,2,3,4,5,1,6,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,2,3,5,4,1,6,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,4,3,5,1,2,7,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,1,3,5,4,7,Agree,Agree,Somewhat agree,Agree,Agree,1,5,2,3,4,6,Strongly agree,Strongly agree,Somewhat Agree,Agree,Strongly agree,3,2,4,5,1,5,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,5,4,2,3,1,5,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Agree,3,2,4,5,1,3,Strongly agree,Agree,Agree,Agree,Strongly agree,5,2,3,1,4,1,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,1,3,2,4,1,Agree,Strongly disagree,Agree,Disagree,Somewhat agree,2,4,1,3,5,2,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,5,2,4,3,2,2,2,2,1,2,2,0,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),54,02PsVPf,02FUT,5,02DGEN,-0.125,0.666666667,0.333333333,4,7,5,8,2,6,9,1,3,4,3,2,1,2,3,2,-2,1,1,-3,3,-3,1,3,1,2,2,3,0,3,3,-2,1,1,-1,0,1,2,3,3,1,3,3,1,3,3,-3,0,2,2,1,2,2,3,3,1,2,3,0,3,2,0,1,0,-3,2,-2,2,3,2,2,2,3,0,3,3,0,1,2,-3,2,-2,1,3,3,3,0,3,6,6,6,7,7,6,5,5,3,1,1,2 +R_32b75d1ulG0kEgq,60 - 66,American,Female,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,5,1,4,2,3,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,1,2,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,4,1,3,5,2,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,2,5,4,1,4,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,2,5,3,4,5,Strongly agree,Strongly agree,Agree,Somewhat Disagree,Strongly agree,1,2,4,3,5,3,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,2,4,1,5,3,7,Agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,2,5,3,4,2,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,3,2,5,1,4,3,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,1,2,3,5,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,5,4,1,3,3,Strongly agree,Strongly agree,Agree,Somewhat Disagree,Strongly agree,3,2,4,1,5,5,Somewhat agree,Agree,Strongly agree,Strongly agree,Somewhat agree,3,4,1,5,2,7,Neither agree nor disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,7,Strongly agree,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,2,4,5,1,3,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,0,2,2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),65,02PsVPf,02FUT,5,01ITEM,-0.25,0,1,5,9,4,6,8,3,2,1,7,2,3,4,1,1,3,3,2,2,1,-3,3,-3,0,3,3,3,0,3,3,3,3,1,3,1,-3,3,-3,0,3,3,2,-1,3,2,3,3,0,2,2,-3,3,-3,0,3,3,3,-1,3,2,3,3,3,2,1,-3,3,-3,0,3,3,2,-1,3,1,2,3,3,1,0,-3,3,0,0,3,3,1,0,3,4,5,3,7,2,3,5,3,5,7,7,6 +R_5WJ7pZu4fXxlFdl,67 - 73,American,Male,Agree,Somewhat agree,Agree,Agree,Somewhat disagree,4,3,2,5,1,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,2,4,3,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat agree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,3,2,2,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,2,5,4,1,3,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,3,4,2,1,5,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,4,3,2,5,2,Disagree,Disagree,Agree,Disagree,Agree,2,1,4,5,3,2,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,4,2,3,1,2,Agree,Agree,Agree,Agree,Somewhat agree,1,4,3,2,5,2,Disagree,Disagree,Agree,Disagree,Somewhat agree,1,3,2,4,5,2,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,4,3,2,1,2,Agree,Agree,Agree,Agree,Somewhat agree,4,2,3,5,1,2,Disagree,Disagree,Agree,Disagree,Somewhat agree,3,1,4,5,2,2,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,2,4,3,1,2,2,2,0,2,2,2,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),67,01PfPsV,01PAST,5,02DGEN,0.125,0.666666667,0.333333333,4,3,9,5,8,7,6,1,2,3,4,2,1,2,1,2,2,-1,-2,-2,1,-2,1,1,1,1,0,1,1,2,2,0,0,-2,-2,1,-2,1,2,1,2,0,2,2,2,2,1,1,-2,-2,2,-2,2,2,1,2,0,2,2,2,2,2,1,-2,-2,2,-2,1,2,1,2,0,2,2,2,2,2,1,-2,-2,2,-2,1,2,1,1,0,1,2,2,1,2,2,2,2,2,2,2,2,2 +R_5DnGIu10XHfxKY9,46 - 52,Canadian,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,1,5,3,2,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,5,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,3,4,5,1,2,7,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,3,2,5,4,1,5,Agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Agree,5,4,1,3,2,8,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,4,5,3,2,1,8,Agree,Neither agree nor disagree,Strongly agree,Disagree,Agree,5,2,1,3,4,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,3,4,5,2,1,7,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Strongly agree,4,1,3,5,2,5,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,5,1,3,2,4,5,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,2,1,4,3,5,7,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Agree,1,2,5,4,3,8,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,1,3,5,2,6,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,2,4,1,5,3,1,2,1,2,2,1,2,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,52,02PsVPf,01PAST,5,02DGEN,-0.25,0.333333333,0.666666667,9,3,7,6,2,4,8,1,5,4,3,2,1,3,3,2,1,3,-1,0,1,1,1,2,1,3,1,3,3,3,3,0,-1,0,-1,1,-1,2,2,1,3,0,2,3,3,3,0,-1,2,0,3,-2,2,0,0,2,-1,1,3,3,-1,-1,3,0,-2,3,-2,2,3,2,3,-3,3,3,3,-1,-1,2,0,-3,3,-1,1,0,1,0,-3,3,5,7,5,8,8,8,7,5,5,7,8,6 +R_3ugs5bjxhuKcNu9,60 - 66,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,4,1,5,2,Strongly disagree,Agree,Agree,Agree,Agree,5,2,1,4,3,Strongly Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,4,2,1,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,4,1,1,Strongly disagree,Agree,Agree,Agree,Agree,2,1,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,1,Agree,Agree,Agree,Agree,Agree,1,2,3,5,4,1,Strongly disagree,Agree,Agree,Agree,Agree,1,5,4,3,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,5,4,1,Agree,Agree,Agree,Agree,Agree,3,2,4,5,1,0,Disagree,Agree,Agree,Disagree,Disagree,3,5,4,1,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,1,3,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,1,Strongly disagree,Agree,Agree,Agree,Strongly disagree,2,1,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,1,1,-1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),60,01PfPsV,02FUT,5,01ITEM,0.5,0,1,7,6,5,2,9,3,8,1,4,2,3,4,1,3,3,3,2,3,-3,2,2,2,2,3,2,2,1,1,3,3,3,3,3,-3,2,2,2,2,3,3,3,3,3,2,2,2,2,2,-3,2,2,2,2,3,3,3,3,3,2,2,2,2,2,-2,2,2,-2,-2,3,3,3,3,3,3,3,3,3,3,-3,2,2,2,-3,3,3,3,3,3,1,1,1,1,1,1,0,1,1,1,1,1 +R_6KCToUhfj8M8IDG,67 - 73,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat disagree,5,4,2,1,3,Somewhat agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,1,4,2,5,3,Agree,Somewhat Disagree,Agree,Disagree,Strongly Agree,3,2,1,5,4,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat disagree,1,5,4,3,2,1,Somewhat agree,Disagree,Agree,Somewhat disagree,Agree,4,5,3,2,1,1,Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Strongly agree,4,1,2,3,5,1,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Somewhat disagree,3,5,4,2,1,1,Somewhat agree,Disagree,Strongly agree,Somewhat agree,Agree,5,4,3,1,2,2,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,2,3,5,1,4,3,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat disagree,3,5,2,1,4,1,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Agree,4,2,5,3,1,2,Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly agree,2,5,4,1,3,2,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat disagree,4,2,3,1,5,1,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Agree,2,3,1,5,4,2,Agree,Somewhat Disagree,Agree,Disagree,Strongly agree,4,5,2,1,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-1,1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,70,03VPfPs,02FUT,10,01ITEM,0,0,1,3,8,6,2,7,9,4,1,5,4,2,3,1,3,3,2,1,-1,1,-2,3,-1,3,2,-1,2,-2,3,3,3,2,1,-1,1,-2,2,-1,2,2,0,2,-1,3,3,3,2,0,-1,1,-2,3,1,2,2,1,2,0,2,3,3,1,1,-1,0,-2,1,-2,2,2,0,2,-2,3,3,3,1,1,-1,1,-3,2,-1,2,2,-1,2,-2,3,1,1,1,1,2,3,1,2,2,1,2,1 +R_5CNPGj3zE2XNYeR,67 - 73,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,2,3,1,4,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,5,2,4,1,3,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,4,2,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,2,3,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,3,5,2,10,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,5,2,4,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,4,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,5,1,4,10,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,4,2,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,2,1,4,3,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,1,3,5,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,5,2,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,1,4,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,10,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,3,5,4,2,2,2,2,2,-2,2,2,2,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,68,02PsVPf,01PAST,10,02DGEN,0.5,0.666666667,0.333333333,9,6,8,3,2,7,4,1,5,3,2,4,1,3,3,3,-3,3,3,-3,3,-3,-3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,-3,3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,3,3,-3,3,-3,3,3,-3,3,-3,3,0,0,10,0,0,10,0,0,0,0,0,10 +R_6ZOAtFe1RrAZdXm,53 - 59,Canadian,Male,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,1,5,4,3,Somewhat agree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,1,5,3,2,4,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,5,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,3,5,4,2,1,1,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,1,2,5,4,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,4,3,5,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,4,1,5,2,3,2,Somewhat agree,Disagree,Agree,Disagree,Neither agree nor disagree,5,1,3,4,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,4,5,1,1,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,5,2,3,1,4,2,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,3,4,1,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,4,3,2,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,5,1,3,4,2,2,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,5,1,3,4,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,1,4,5,0,2,2,2,2,2,2,2,10 cents,5 minutes,24 days,Male,Trade School (non-military),58,03VPfPs,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,3,2,8,5,7,6,4,1,9,4,2,3,1,2,2,1,0,2,1,-2,2,-3,0,0,1,2,0,0,2,2,1,0,2,0,-2,2,-2,1,0,0,2,0,0,2,2,1,0,2,1,-2,2,-2,0,0,0,2,0,0,2,2,1,0,2,0,-2,2,-2,0,0,0,2,0,0,2,2,1,0,2,0,-2,2,-2,0,0,0,2,0,0,2,1,2,2,2,1,1,2,1,2,2,1 +R_6R4r6h0g1mr3rGo,67 - 73,American,Male,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,Agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,Agree,Agree,Agree,Agree,Somewhat Agree,3,4,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,3,4,2,6,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,5,2,1,4,3,6,Agree,Agree,Agree,Agree,Somewhat Agree,5,3,1,2,4,4,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,4,2,1,3,6,Agree,Somewhat agree,Agree,Somewhat agree,Agree,4,5,3,2,1,5,Agree,Agree,Agree,Agree,Somewhat Agree,3,5,1,2,4,5,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,3,5,4,1,6,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,5,1,4,3,2,6,Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,1,4,5,5,Neither agree nor disagree,Agree,Agree,Agree,Somewhat disagree,1,4,3,2,5,4,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,3,2,5,Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,1,2,5,-2,-1,-1,2,-1,0,1,0,5 cents,100 minutes,15 days,Male,Trade School (non-military),71,03VPfPs,01PAST,10,02DGEN,-0.75,0.333333333,0.333333333,4,3,8,5,7,9,2,1,6,3,2,4,1,0,2,2,0,-1,2,1,2,0,1,2,2,2,2,1,0,2,1,1,-1,1,1,2,1,2,2,2,2,2,1,1,2,1,-1,-1,2,1,2,1,2,2,2,2,2,1,0,1,2,1,-1,1,0,2,1,0,2,2,1,1,1,0,2,2,2,-1,1,0,2,0,0,2,2,1,1,1,5,6,6,4,6,5,5,6,6,5,4,5 +R_70SLWlEzFffvmLC,46 - 52,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,3,5,1,2,4,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,2,4,5,1,3,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,1,5,2,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,1,5,3,2,4,0,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,5,1,3,2,4,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,4,1,2,3,5,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,3,4,5,2,1,0,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,5,4,2,3,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,2,1,4,3,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,3,1,5,4,2,0,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,1,4,5,3,2,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,4,3,2,1,0,Somewhat agree,Strongly agree,Strongly agree,Disagree,Somewhat agree,4,1,2,5,3,1,Agree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,2,5,3,4,1,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,1,5,2,4,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,2,2,2,1,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,52,03VPfPs,01PAST,5,01ITEM,-0.25,0.333333333,0.666666667,4,8,2,9,5,7,6,1,3,3,4,2,1,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-3,1,2,-2,3,-2,0,3,0,3,1,3,1,3,3,-2,1,2,-2,3,-2,0,3,0,3,1,3,0,0,0,0,0,0,0,0,0,1,0,0 +R_7PwK6yn7eA7k40N,46 - 52,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,2,1,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,1,4,3,Disagree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,3,5,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,2,3,1,4,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,5,3,4,2,0,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,3,4,5,2,0,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,2,3,4,0,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,3,4,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,1,4,0,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,3,5,2,1,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,5,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,3,2,5,1,4,0,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,2,4,5,1,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,3,2,1,2,2,2,0,0,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,51,03VPfPs,02FUT,5,02DGEN,0.375,0.666666667,0.333333333,5,3,2,6,7,4,9,1,8,4,2,3,1,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,2,3,3,3,3,-3,3,3,3,3,-3,3,-2,3,3,3,3,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,3,3,3,3,3,-3,3,3,0,3,-3,3,-2,3,3,3,3,3,3,3,-1,3,3,0,3,-3,3,-3,3,3,3,3,0,0,0,0,0,0,0,0,1,1,0,1 +R_5dLgEDRdASxfuRX,32 - 38,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,4,5,1,3,2,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Strongly agree,5,1,2,4,3,Somewhat Agree,Disagree,Agree,Disagree,Agree,5,4,3,1,2,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,5,4,3,1,3,Disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,5,2,4,3,2,Agree,Disagree,Agree,Disagree,Agree,1,4,3,2,5,2,Strongly agree,Strongly agree,Agree,Disagree,Agree,1,5,2,4,3,2,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat disagree,2,5,3,1,4,4,Agree,Disagree,Somewhat Agree,Disagree,Agree,2,4,1,3,5,2,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,4,1,3,2,5,2,Disagree,Disagree,Agree,Disagree,Agree,3,4,1,2,5,3,Agree,Disagree,Strongly agree,Disagree,Agree,1,4,2,3,5,1,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,Agree,4,1,5,2,3,2,Somewhat disagree,Somewhat disagree,Agree,Disagree,Strongly agree,4,1,3,2,5,2,Agree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,5,4,1,3,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,0,2,2,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,35,01PfPsV,01PAST,10,01ITEM,-0.125,0.666666667,0.333333333,6,8,9,5,7,2,4,1,3,2,4,3,1,3,3,1,0,2,-2,0,2,-1,3,1,-2,2,-2,2,3,3,3,0,1,-2,-2,1,-2,1,2,-2,2,-2,2,3,3,2,-2,2,-2,-1,0,-2,-1,2,-2,1,-2,2,3,3,1,0,2,-2,-2,2,-2,2,2,-2,3,-2,2,3,3,0,2,2,-1,-1,2,-2,3,2,-3,3,-2,3,3,2,2,2,4,2,2,3,1,2,2,3 +R_7YXvnff8uualDwM,53 - 59,Canadian,Male,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Strongly agree,2,4,1,5,3,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,3,1,5,4,2,Somewhat Agree,Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,5,1,2,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,5,2,3,1,4,4,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Agree,1,4,3,2,5,3,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,3,2,1,5,4,4,Neither agree nor disagree,Agree,Agree,Agree,Agree,2,3,4,5,1,8,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,5,4,1,3,2,6,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,4,1,5,3,2,2,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,5,4,3,2,1,2,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,1,3,5,4,2,1,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,2,1,5,4,3,2,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,1,5,2,4,3,3,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,4,3,1,2,2,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,3,5,2,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,1,0,1,1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,53,02PsVPf,01PAST,10,01ITEM,0.25,1,0,7,2,6,3,8,5,4,1,9,4,3,2,1,0,1,3,2,3,0,-1,2,-1,1,1,-2,2,0,1,0,1,2,2,2,1,-1,2,-1,2,1,-2,2,-1,1,0,2,2,2,2,0,-1,2,-1,2,1,-2,2,-1,1,0,1,2,2,2,1,-1,2,0,2,1,-2,2,-1,1,0,1,2,2,2,1,0,2,0,2,1,-2,2,-1,1,4,3,4,8,6,2,2,1,2,3,2,2 +R_57x6VVRg8Pjng9b,32 - 38,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,3,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,1,2,4,3,5,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Strongly Agree,1,5,3,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,2,3,1,5,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,2,4,3,1,5,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Agree,Strongly agree,3,4,5,2,1,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,1,Somewhat agree,Disagree,Strongly agree,Disagree,Agree,2,1,3,5,4,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Agree,Strongly agree,1,3,2,4,5,7,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,2,5,4,3,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,3,1,4,5,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Agree,Strongly agree,2,1,5,3,4,4,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,5,1,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,3,2,4,5,1,Strongly agree,Strongly Disagree,Strongly agree,Agree,Strongly agree,2,1,4,3,5,0,2,2,2,1,1,2,-1,10 cents,100 minutes,47 days,Female,University - PhD,38,01PfPsV,02FUT,10,02DGEN,-0.375,0.333333333,0.666666667,9,7,6,2,4,5,3,1,8,4,2,3,1,3,3,3,2,3,1,-3,2,-3,2,3,0,3,2,3,3,3,3,2,3,1,-3,2,-3,2,3,0,3,2,3,3,3,3,3,3,1,-2,3,-2,2,3,0,3,2,3,3,3,3,2,3,1,-3,3,-3,2,3,0,3,2,3,3,3,3,2,3,1,-3,2,-3,1,3,-3,3,2,3,4,1,1,6,1,1,7,1,1,4,1,1 +R_1XaffUG5PkYS6aZ,67 - 73,American,Female,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,2,4,1,3,5,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,1,4,2,3,5,Strongly Agree,Agree,Agree,Somewhat Agree,Agree,1,4,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,3,2,1,5,4,3,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,3,2,1,5,4,3,Strongly agree,Agree,Agree,Disagree,Agree,1,5,4,3,2,2,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat agree,2,4,1,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,4,5,1,2,3,4,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,5,2,3,1,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,3,4,2,5,2,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,5,3,2,4,2,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,5,4,3,2,1,1,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,1,2,3,5,4,1,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,1,5,4,2,1,Strongly agree,Agree,Agree,Somewhat Disagree,Strongly agree,4,2,3,1,5,-1,1,0,1,0,0,0,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,70,03VPfPs,01PAST,5,02DGEN,-0.25,0,1,2,7,4,6,8,3,5,1,9,3,2,4,1,2,1,3,0,2,0,1,2,-1,1,3,2,2,1,2,1,2,3,0,1,0,1,2,-1,0,3,2,2,-2,2,0,1,3,-1,1,0,0,2,-1,1,3,2,2,0,2,2,2,2,1,1,-1,0,2,-1,0,3,2,2,0,3,2,2,2,0,1,-1,-1,2,-1,0,3,2,2,-1,3,2,3,3,2,2,4,1,2,2,1,1,1 +R_3ZEJTUbbiHhiNNe,67 - 73,American,Male,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,2,3,1,Strongly disagree,Agree,Strongly agree,Somewhat disagree,Disagree,1,5,4,2,3,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,5,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,1,3,2,0,Strongly disagree,Somewhat agree,Strongly agree,Somewhat disagree,Disagree,5,3,2,4,1,0,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,4,2,5,1,0,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,4,5,1,3,0,Strongly disagree,Somewhat agree,Strongly agree,Somewhat disagree,Disagree,2,5,1,3,4,0,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,2,5,1,3,4,0,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,0,Strongly disagree,Somewhat agree,Strongly agree,Somewhat disagree,Disagree,1,5,2,4,3,0,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,1,3,2,4,5,0,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,4,1,2,0,Strongly disagree,Somewhat agree,Strongly agree,Somewhat disagree,Disagree,4,3,1,5,2,0,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,4,5,3,1,2,2,2,2,2,2,1,2,1,5 cents,5 minutes,47 days,Male,University - PhD,72,01PfPsV,02FUT,10,02DGEN,0,1,0,2,6,8,4,3,7,5,1,9,4,3,2,1,-1,3,1,1,0,-3,2,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,-1,3,1,1,0,-3,1,3,-1,-2,2,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_1QGIaEA2AaGAPj9,39 - 45,Canadian,Female,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,4,3,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,2,3,1,5,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,2,5,4,1,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,5,3,2,1,7,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,1,4,5,3,7,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,5,3,6,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,5,3,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,5,4,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,1,2,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,3,4,2,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,3,5,1,6,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,2,4,1,5,3,5,Agree,Somewhat agree,Agree,Agree,Somewhat agree,1,4,2,3,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,4,5,3,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,1,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,-1,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,44,03VPfPs,02FUT,10,01ITEM,0.125,0,1,4,3,5,2,8,9,7,1,6,2,4,3,1,2,0,2,0,0,1,1,0,1,1,-1,1,1,0,2,1,-1,0,0,1,2,0,0,0,1,0,1,1,0,0,2,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,2,1,1,2,1,2,2,1,0,0,0,0,1,0,0,0,0,0,7,7,6,8,6,6,4,6,5,6,6,5 +R_1NUrOnuIGFIdED6,67 - 73,American,Male,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Strongly agree,1,3,5,4,2,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,4,1,3,Strongly Agree,Agree,Agree,Disagree,Strongly Agree,5,2,3,1,4,Agree,Somewhat disagree,Agree,Disagree,Strongly agree,3,4,1,2,5,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,4,1,3,1,Strongly agree,Agree,Agree,Disagree,Strongly agree,3,1,2,5,4,1,Agree,Disagree,Agree,Disagree,Strongly agree,5,2,4,3,1,1,Agree,Strongly disagree,Agree,Strongly disagree,Agree,3,5,1,4,2,1,Strongly agree,Agree,Agree,Disagree,Strongly agree,3,1,2,5,4,1,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Agree,5,2,3,1,4,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,3,1,4,2,5,2,Strongly agree,Strongly agree,Agree,Disagree,Strongly agree,1,2,3,4,5,1,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,5,1,2,4,3,2,Somewhat agree,Strongly disagree,Agree,Disagree,Somewhat agree,3,1,4,5,2,3,Strongly agree,Strongly agree,Agree,Strongly Disagree,Strongly agree,5,4,1,2,3,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,-2,0,1,-1,10 cents,100 minutes,24 days,Male,Trade School (non-military),71,03VPfPs,01PAST,5,01ITEM,0.25,0,1,3,9,2,6,8,5,4,1,7,3,4,2,1,2,0,2,-1,3,2,-3,3,-3,2,3,2,2,-2,3,2,-1,2,-2,3,2,-3,3,-3,2,3,2,2,-2,3,2,-2,2,-2,3,2,-3,2,-3,2,3,2,2,-2,3,3,-2,3,-1,2,1,-2,2,-2,1,3,3,2,-2,3,3,-2,3,-1,1,1,-3,2,-2,1,3,3,2,-3,3,1,1,1,1,1,1,2,2,1,2,3,3 +R_7BFMMimGwwLAWAx,60 - 66,Canadian,Male,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,4,5,1,3,2,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,4,5,1,2,Strongly Agree,Agree,Agree,Somewhat Agree,Agree,5,3,4,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,3,5,4,2,1,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,4,3,2,5,2,Strongly agree,Agree,Agree,Agree,Agree,2,3,4,5,1,2,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Agree,5,3,1,4,2,3,Agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,3,5,2,1,3,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,2,4,1,3,5,2,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,4,2,1,5,3,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,2,1,5,3,2,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,5,1,2,2,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,1,2,4,3,5,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,2,4,1,3,5,2,Agree,Agree,Agree,Agree,Somewhat Agree,1,3,5,4,2,0,2,1,1,0,-1,1,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,62,01PfPsV,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,3,9,5,2,7,8,4,1,6,3,2,4,1,0,2,2,0,3,2,2,2,1,1,3,2,2,1,2,1,2,2,0,2,2,2,2,0,2,3,2,2,2,2,0,2,2,0,2,2,2,2,0,1,2,2,2,0,2,0,2,2,0,3,2,2,2,0,2,2,2,2,0,1,1,3,2,0,3,2,2,2,0,2,2,2,2,2,1,2,2,2,2,3,3,2,2,2,2,2,2 +R_7jxZv8IeVyOZaWG,60 - 66,American,Female,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,2,5,1,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,3,1,2,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,2,4,5,3,1,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,1,2,3,5,4,0,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,5,4,2,1,4,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,5,3,2,1,4,2,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,2,1,5,3,4,0,Agree,Neither agree nor disagree,Agree,Agree,Agree,2,5,3,4,1,2,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,2,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,4,5,1,2,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,4,3,5,2,1,1,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,5,2,3,4,1,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,5,4,1,2,3,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,5,2,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,3,1,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,-1,1,1,1,10 cents,5 minutes,47 days,Female,Trade School (non-military),66,02PsVPf,02FUT,5,01ITEM,0,0.666666667,0.333333333,8,2,6,3,7,9,5,1,4,3,2,4,1,2,2,2,0,3,0,1,1,1,1,1,1,2,0,2,2,2,2,0,3,1,0,2,0,2,2,1,1,2,2,2,2,2,0,3,2,0,2,2,2,2,2,2,2,2,2,2,2,0,3,1,1,1,0,2,1,1,2,0,2,2,2,2,0,3,0,1,1,1,1,1,1,1,0,2,0,4,2,0,2,2,1,1,1,1,2,2 +R_3JDv13TGH2wYNxL,67 - 73,American,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,1,4,2,3,5,Disagree,Strongly disagree,Agree,Disagree,Somewhat agree,2,5,3,4,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,1,2,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,3,1,5,4,2,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,2,3,1,5,4,1,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,5,2,4,1,1,Strongly agree,Agree,Strongly agree,Somewhat agree,Somewhat disagree,4,1,3,5,2,1,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Disagree,5,4,3,2,1,1,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,2,4,3,1,1,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,2,5,4,1,3,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,2,3,1,4,5,1,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,4,2,1,3,2,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat disagree,3,1,2,5,4,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,1,5,2,4,3,1,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,1,3,4,0,1,1,2,-2,1,-2,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),71,02PsVPf,01PAST,10,02DGEN,0.625,0,1,3,9,7,6,8,4,2,1,5,2,4,3,1,3,2,3,3,-1,-2,-3,2,-2,1,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,3,2,3,1,-1,-3,-3,3,-2,-2,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,3,2,3,3,-1,-3,-3,3,-3,-3,3,3,3,0,3,1,2,1,1,1,1,1,1,1,2,1,1 +R_1vVlTIoXp4otw9b,46 - 52,Canadian,Female,Strongly agree,Agree,Strongly agree,Agree,Agree,3,2,4,1,5,Strongly disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,2,3,1,4,5,Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,2,5,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,2,3,1,5,4,3,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,2,4,3,5,1,3,Somewhat Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,5,2,4,3,3,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,3,4,2,1,3,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,4,2,1,5,3,3,Somewhat Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,3,4,5,1,3,Agree,Agree,Agree,Agree,Agree,4,1,2,3,5,8,Strongly disagree,Disagree,Disagree,Agree,Disagree,3,2,5,1,4,5,Agree,Disagree,Disagree,Strongly Disagree,Strongly agree,3,4,1,2,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,3,2,1,5,5,Strongly disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,2,4,1,3,5,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly agree,3,2,5,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,1,1,2,1,5 cents,5 minutes,24 days,Female,University - Undergraduate,46,01PfPsV,02FUT,10,01ITEM,0.125,0.666666667,0.333333333,2,5,4,7,6,3,8,1,9,3,2,4,1,3,2,3,2,2,-3,-1,-1,1,0,2,-2,3,-3,3,3,3,3,1,2,-3,1,3,-3,3,1,-3,3,-3,3,3,3,3,1,3,-3,1,3,-3,3,1,-3,3,-3,3,2,2,2,2,2,-3,-2,-2,2,-2,2,-2,-2,-3,3,3,3,3,3,1,-3,1,-1,1,-1,2,1,1,-3,3,3,3,3,3,3,3,8,5,5,5,5,5 +R_34qGWjMp36VziGX,46 - 52,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,5,4,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,5,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,3,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,5,2,4,1,3,4,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,1,4,6,Agree,Strongly agree,Strongly agree,Agree,Agree,2,3,4,5,1,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,5,3,1,2,4,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,5,1,2,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,4,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,1,2,5,4,3,5,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,3,4,1,5,2,9,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly agree,1,3,5,4,2,8,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,1,4,5,2,7,Strongly agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,2,5,1,2,2,2,2,-1,-2,2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,48,01PfPsV,02FUT,10,02DGEN,0.875,0,1,7,3,5,6,2,9,8,1,4,4,3,2,1,3,3,3,3,3,0,0,3,0,3,3,3,3,3,3,3,3,3,3,3,0,0,3,-1,3,3,2,3,3,3,2,3,3,2,2,0,0,3,0,2,3,3,3,3,2,3,3,3,3,3,0,0,3,0,2,3,3,2,2,3,1,3,2,3,3,1,0,2,1,1,3,2,1,1,1,3,3,4,6,5,4,5,4,5,9,8,7 +R_3q8hpZsyYuntLQM,60 - 66,American,Male,Strongly agree,Agree,Strongly agree,Disagree,Somewhat disagree,3,4,2,5,1,Disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,1,4,Agree,Strongly Disagree,Agree,Agree,Strongly Agree,3,4,2,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,2,3,4,5,1,2,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,3,4,5,1,2,1,Strongly agree,Strongly Disagree,Agree,Agree,Strongly agree,4,3,2,1,5,2,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,3,5,2,8,Agree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,3,5,2,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,1,2,4,3,1,Strongly agree,Agree,Strongly agree,Somewhat agree,Somewhat agree,1,2,5,4,3,0,Neither agree nor disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,4,3,2,1,Strongly agree,Strongly Disagree,Strongly agree,Agree,Strongly agree,1,4,5,3,2,1,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Disagree,5,2,3,4,1,4,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,Somewhat agree,1,3,2,5,4,2,Strongly agree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,1,2,3,4,5,2,2,2,2,1,2,2,0,10 cents,5 minutes,47 days,Male,University - Undergraduate,66,02PsVPf,01PAST,10,02DGEN,-0.125,0.666666667,0.333333333,3,6,9,7,2,5,8,1,4,4,2,3,1,3,2,3,-2,-1,-2,1,3,0,0,2,-3,2,2,3,0,1,2,0,-1,0,1,2,1,-1,3,-3,2,2,3,0,3,1,1,1,2,-1,2,0,2,3,3,3,3,2,3,2,3,1,1,0,1,3,0,1,3,-3,3,2,3,1,0,0,1,-2,0,3,2,3,1,3,-3,3,1,3,2,2,1,2,8,1,1,0,1,1,4,2 +R_31cnn6pFgsAYVmU,60 - 66,Canadian,Male,Agree,Agree,Somewhat agree,Disagree,Agree,5,1,4,3,2,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,2,5,3,4,1,Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,1,4,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Somewhat agree,Somewhat disagree,Agree,1,3,2,4,5,1,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,3,2,1,5,4,2,Neither Agree nor Disagree,Disagree,Agree,Somewhat Agree,Agree,5,1,2,3,4,1,Agree,Agree,Somewhat agree,Disagree,Agree,5,4,1,2,3,1,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,4,1,2,3,5,1,Disagree,Disagree,Agree,Disagree,Agree,2,3,5,1,4,1,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,4,5,1,3,1,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,1,5,4,2,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,3,4,1,5,2,1,Agree,Agree,Somewhat agree,Somewhat agree,Agree,3,4,5,2,1,1,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,2,3,5,1,1,Somewhat Disagree,Neither Agree nor Disagree,Agree,Disagree,Agree,2,1,5,3,4,0,1,1,1,1,1,1,-1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,65,03VPfPs,01PAST,5,02DGEN,-0.375,1,0,6,2,5,9,8,4,7,1,3,4,3,2,1,2,2,1,-2,2,1,0,2,-2,1,2,0,2,-2,2,2,2,1,-1,2,0,1,2,-2,0,0,-2,2,1,2,2,2,1,-2,2,0,-1,2,-1,0,-2,-2,2,-2,2,2,2,1,0,2,0,-2,2,-2,0,1,0,2,-2,2,2,2,1,1,2,0,-2,2,-2,0,-1,0,2,-2,2,1,1,2,1,1,1,1,1,1,1,1,1 +R_3q32cRTAfOFU8Sa,60 - 66,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,4,1,3,2,Disagree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,3,1,2,4,5,Disagree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,4,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,4,2,3,1,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Agree,4,5,3,1,2,3,Disagree,Strongly agree,Agree,Disagree,Agree,5,1,4,2,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,5,1,4,3,2,Strongly disagree,Strongly disagree,Agree,Strongly agree,Somewhat agree,5,3,1,2,4,4,Disagree,Agree,Strongly agree,Strongly Disagree,Strongly agree,4,3,1,2,5,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,4,5,3,1,2,2,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Agree,4,1,3,5,2,1,Disagree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,5,4,3,2,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,3,5,1,2,4,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,2,3,1,5,3,Somewhat Disagree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,5,2,4,1,3,1,2,2,2,-1,1,2,2,10 cents,5 minutes,15 days,Male,University - Undergraduate,66,02PsVPf,01PAST,5,02DGEN,0.375,0.333333333,0.333333333,6,3,4,5,9,2,8,1,7,4,3,2,1,3,3,3,3,1,-2,-3,3,1,3,-2,1,3,-1,3,3,3,3,3,1,-3,-3,3,3,2,-2,3,2,-2,2,3,3,3,3,1,-3,-3,2,3,1,-2,2,3,-3,3,3,3,3,3,-1,-3,-3,3,-2,2,-2,1,3,-3,3,3,3,3,3,-1,-3,-3,3,-3,1,-1,1,3,-3,3,4,2,3,4,2,4,2,2,1,2,3,3 +R_1CNrJPVWRR7J28f,67 - 73,American,Female,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,5,3,4,2,1,Disagree,Disagree,Strongly agree,Disagree,Somewhat agree,2,5,4,3,1,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,3,2,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Agree,5,3,2,1,4,8,Strongly disagree,Disagree,Strongly agree,Disagree,Agree,5,2,1,3,4,7,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,5,3,2,4,1,9,Agree,Somewhat agree,Neither agree nor disagree,Disagree,Agree,1,4,3,2,5,6,Disagree,Disagree,Strongly agree,Disagree,Agree,2,4,3,1,5,5,Somewhat Agree,Disagree,Agree,Agree,Neither Agree nor Disagree,3,5,4,2,1,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,5,1,2,4,3,6,Disagree,Disagree,Agree,Disagree,Somewhat agree,5,2,3,4,1,6,Neither Agree nor Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,1,4,5,2,3,8,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Agree,4,2,5,3,1,8,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,2,5,3,1,8,Neither Agree nor Disagree,Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,4,2,1,3,5,-2,1,1,1,2,0,1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),71,01PfPsV,01PAST,10,02DGEN,-0.5,0,1,2,4,3,9,5,7,8,1,6,3,2,4,1,-1,1,2,0,3,-2,-2,3,-2,1,1,-1,2,1,1,1,1,1,-2,2,-3,-2,3,-2,2,0,-1,2,1,1,2,1,0,-2,2,-2,-2,3,-2,2,1,-2,2,2,0,-1,0,1,0,2,-2,-2,2,-2,1,0,-2,1,-1,0,-1,0,2,1,2,-2,-2,2,-2,0,0,-2,2,-1,0,5,8,7,9,6,5,5,6,6,8,8,8 +R_1LZQSZFNRdnsJxL,67 - 73,American,Female,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,3,1,5,2,4,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,1,2,5,3,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,4,3,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,5,4,1,2,3,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,3,4,1,0,Strongly agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,3,2,1,5,4,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,4,1,3,2,5,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,1,3,4,5,0,Strongly agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,1,2,4,5,3,0,Strongly agree,Strongly agree,Agree,Strongly disagree,Agree,3,1,4,2,5,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,4,3,1,5,0,Strongly agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,3,4,5,1,2,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat agree,5,2,4,3,1,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,1,3,5,4,2,0,Strongly agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,4,1,2,2,2,2,1,2,2,-1,10 cents,100 minutes,24 days,Female,University - PhD,71,01PfPsV,02FUT,5,02DGEN,-0.25,0,1,8,2,6,7,9,4,5,1,3,2,3,4,1,3,3,2,-3,2,1,-3,3,-3,2,3,-1,3,1,3,3,3,2,-3,2,2,-3,3,-3,2,3,-1,3,2,3,3,3,2,-3,2,2,-3,3,-3,2,3,-1,3,2,3,3,3,2,-3,2,1,-3,3,-3,2,3,-1,3,1,3,3,3,2,1,1,1,-3,3,-3,1,3,-1,3,1,3,0,0,0,0,0,0,0,1,0,2,2,0 +R_59LL8DXdTJLqSB3,53 - 59,American,Female,Strongly agree,Agree,Strongly agree,Agree,Neither agree nor disagree,2,3,5,1,4,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,3,5,4,2,1,Somewhat Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Agree,2,3,4,5,1,Strongly agree,Agree,Strongly agree,Agree,Neither agree nor disagree,3,4,1,2,5,0,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,5,2,3,4,1,1,Somewhat Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,2,3,4,1,5,0,Strongly agree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Agree,Agree,3,4,2,1,5,1,Somewhat Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Somewhat Agree,5,4,1,2,3,1,Strongly agree,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,2,1,5,3,4,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,4,5,3,2,1,Somewhat Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,2,3,4,5,1,0,Agree,Agree,Agree,Strongly agree,Neither agree nor disagree,4,3,2,1,5,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,3,4,1,1,Somewhat Disagree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,5,3,4,2,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,1,2,0,1,2,2,5 cents,5 minutes,47 days,Female,High School (or equivalent),53,03VPfPs,02FUT,5,01ITEM,0,1,0,6,3,9,2,7,5,8,1,4,3,2,4,1,3,2,3,2,0,-3,0,0,1,2,-1,-3,3,-3,2,3,2,3,2,0,-3,1,0,1,2,-1,-3,3,-3,2,3,2,3,1,0,-3,1,0,2,2,-1,-3,3,-3,1,3,2,3,3,0,-3,0,0,0,2,-1,-3,3,-3,2,2,2,2,3,0,-3,0,0,0,1,-1,-3,3,-3,2,0,1,0,1,1,1,1,1,0,1,1,0 +R_6fxexjmSERfuEHs,46 - 52,Canadian,Female,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Agree,2,4,3,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,5,4,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,3,2,1,5,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,Agree,5,1,3,4,2,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,3,2,4,3,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,4,5,2,3,0,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,2,1,3,5,1,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,1,3,5,4,3,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,3,2,5,1,4,3,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,4,5,2,1,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,4,1,2,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,3,1,5,2,4,1,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,3,4,1,2,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,5,2,1,3,2,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,2,1,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-1,1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,02PsVPf,01PAST,5,01ITEM,0.5,0,1,6,7,4,9,5,3,2,1,8,4,3,2,1,0,3,3,3,2,-1,1,1,0,1,2,1,1,1,0,-1,3,3,3,2,0,0,1,0,1,3,0,1,1,0,1,3,3,3,2,1,1,1,0,1,2,0,1,1,-1,1,3,3,3,2,0,0,1,0,0,3,0,1,1,0,1,3,3,3,2,1,0,1,0,1,3,0,1,1,0,1,3,0,1,3,3,1,2,1,2,2,1 +R_5J2RqQH7n9Fx52B,39 - 45,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Agree,5,4,2,3,1,Somewhat agree,,Somewhat agree,Neither agree nor disagree,Strongly agree,4,2,5,3,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,2,1,3,4,Strongly agree,Strongly agree,Agree,Somewhat disagree,Agree,4,2,5,3,1,1,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,1,3,4,2,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,4,1,2,3,1,Agree,Strongly agree,Agree,Disagree,Agree,5,4,2,3,1,2,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,4,3,1,2,5,2,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,3,1,2,4,5,2,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Agree,5,3,2,4,1,1,Somewhat agree,Disagree,Strongly agree,Disagree,Strongly agree,5,3,1,4,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,3,2,1,5,1,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,2,5,3,1,1,Somewhat agree,Disagree,Strongly agree,Disagree,Strongly agree,5,4,1,2,3,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,1,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,1,2,2,2,5 cents,5 minutes,47 days,Female,High School (or equivalent),44,02PsVPf,02FUT,10,01ITEM,0.125,1,0,3,6,7,2,4,5,9,1,8,4,3,2,1,3,3,2,-1,2,1,,1,0,3,0,0,3,0,3,3,3,2,-1,2,2,0,2,0,3,0,0,3,0,3,2,3,2,-2,2,2,1,2,1,3,-1,0,3,1,3,3,3,2,0,2,1,-2,3,-2,3,0,0,3,0,3,3,3,2,0,2,1,-2,3,-2,3,0,0,3,0,3,1,1,1,2,2,2,1,1,1,1,1,1 +R_5fE8gqnU9RHKd7a,39 - 45,Canadian,Female,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,5,3,4,1,2,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Disagree,3,1,2,4,5,Strongly Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,2,5,3,4,1,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,4,5,1,3,2,1,Disagree,Disagree,Agree,Disagree,Somewhat disagree,2,1,3,5,4,2,Strongly agree,Somewhat Agree,Agree,Disagree,Strongly agree,2,3,1,5,4,1,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,2,5,1,3,4,1,Somewhat disagree,Strongly disagree,Agree,Disagree,Somewhat disagree,1,2,5,4,3,1,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Disagree,Strongly agree,1,4,2,5,3,2,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,4,3,1,5,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat disagree,2,3,5,4,1,1,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,4,3,5,2,1,1,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,1,5,4,3,1,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,5,4,2,3,1,1,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,5,4,1,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,1,0,1,1,5 cents,5 minutes,47 days,Female,University - PhD,41,02PsVPf,02FUT,10,01ITEM,-0.125,1,0,9,6,5,4,8,2,7,1,3,3,2,4,1,1,3,2,3,2,-1,-3,2,-3,-2,3,1,2,-2,3,1,3,2,3,2,-2,-2,2,-2,-1,3,1,2,-2,3,1,3,2,3,2,-1,-3,2,-2,-1,3,1,0,-2,3,1,3,2,3,3,-1,-2,2,-2,-1,3,1,2,-3,3,1,3,2,3,3,-1,-3,3,-3,-1,3,1,2,-3,3,1,2,1,1,1,2,1,1,1,1,1,1 +R_17PA2lzu5PTR6Xx,46 - 52,Canadian,Female,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,2,3,5,1,4,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,3,4,5,2,1,Agree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,2,5,4,1,3,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,4,1,5,3,2,1,Strongly disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,5,3,2,1,4,1,Agree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,4,1,2,5,1,Strongly agree,Neither agree nor disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,3,2,4,1,2,Disagree,Disagree,Strongly agree,Disagree,Strongly agree,3,2,1,4,5,1,Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,5,1,2,3,1,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,3,Strongly disagree,Disagree,Strongly agree,Disagree,Strongly agree,1,4,5,2,3,1,Agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,1,4,2,3,1,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,4,5,3,2,Strongly disagree,Disagree,Strongly agree,Disagree,Agree,2,1,3,4,5,2,Agree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,5,2,1,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,1,1,2,5 cents,100 minutes,47 days,Female,High School (or equivalent),52,02PsVPf,01PAST,5,01ITEM,0.5,0.666666667,0.333333333,3,6,5,2,9,7,8,1,4,2,4,3,1,3,0,0,-2,0,-2,-1,2,0,1,2,-1,3,-2,3,3,0,0,-2,0,-3,-2,3,-2,0,2,-1,3,-3,3,3,0,1,-2,0,-2,-2,3,-2,3,2,-2,3,-3,3,3,0,0,0,0,-3,-2,3,-2,3,2,0,3,-3,3,3,0,0,1,0,-3,-2,3,-2,2,2,-1,3,-3,3,1,1,1,2,1,1,3,1,1,2,2,1 +R_6BCIVFV4NJK5M1X,67 - 73,American,Female,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,3,2,1,4,5,Somewhat agree,Disagree,Agree,Disagree,Agree,4,1,3,2,5,Strongly Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,1,5,4,3,2,0,Agree,Strongly disagree,Agree,Strongly disagree,Agree,5,1,2,3,4,1,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,4,3,1,2,5,2,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,4,1,2,5,3,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,2,3,1,5,4,1,Strongly agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,2,1,3,4,5,3,Agree,Agree,Agree,Somewhat agree,Strongly agree,4,5,1,2,3,1,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,2,5,4,3,1,2,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,4,1,2,5,Somewhat agree,Agree,Agree,Strongly agree,Agree,2,4,1,5,3,2,Somewhat agree,Strongly disagree,Neither agree nor disagree,Disagree,Somewhat agree,5,2,3,1,4,1,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,1,4,5,2,3,1,-2,2,2,0,2,2,1,10 cents,100 minutes,15 days,Female,University - PhD,71,01PfPsV,02FUT,5,02DGEN,-0.5,0,0.666666667,2,6,9,8,5,4,7,1,3,3,2,4,1,2,2,2,0,3,1,-2,2,-2,2,3,1,3,1,3,3,2,2,1,3,2,-3,2,-3,2,3,1,3,1,3,2,2,2,0,3,1,-3,2,-3,2,3,1,3,2,3,2,2,2,1,3,1,-3,2,-2,2,3,1,3,1,3,1,2,2,3,2,1,-3,0,-2,1,3,1,3,1,3,0,0,1,2,1,1,3,1,2,5,2,1 +R_5Jmin0uMTvm4LhV,60 - 66,American,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,4,5,2,3,1,Disagree,Strongly disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,5,4,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,5,3,4,2,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,2,4,1,5,1,Disagree,Disagree,Agree,Disagree,Disagree,2,3,5,1,4,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,1,3,2,5,1,Strongly agree,Agree,Strongly agree,Agree,Agree,4,1,5,3,2,1,Disagree,Disagree,Agree,Disagree,Disagree,2,1,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,4,2,5,1,1,Agree,Agree,Agree,Agree,Somewhat disagree,3,5,2,1,4,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,3,2,5,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,2,4,5,3,1,1,Agree,Agree,Agree,Strongly agree,Somewhat disagree,3,5,1,4,2,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,3,1,5,2,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,3,4,1,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,1,1,-2,1,1,1,10 cents,5 minutes,24 days,Male,Trade School (non-military),66,03VPfPs,01PAST,10,01ITEM,0.375,0.333333333,0.666666667,2,7,9,8,3,5,6,1,4,2,3,4,1,3,3,2,3,2,-2,-3,2,-1,0,3,3,3,0,3,2,2,2,2,0,-2,-2,2,-2,-2,3,3,3,-2,3,3,2,3,2,2,-2,-2,2,-2,-2,3,3,3,1,3,2,2,2,2,-1,-3,-3,3,-3,-3,3,3,3,-3,3,2,2,2,3,-1,-3,-3,3,-3,-3,3,3,3,-2,3,1,1,1,1,1,1,1,1,1,1,1,1 +R_10ZpB2n0wIHaxg0,67 - 73,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,4,5,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,3,1,4,5,2,Strongly Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,4,5,1,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,4,1,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,3,2,5,4,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,2,4,1,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,5,3,1,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,2,4,5,1,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,3,1,2,4,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,1,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,2,4,5,1,3,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,4,5,2,3,1,5,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,5,1,2,4,7,Strongly agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,4,5,3,1,2,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,2,1,5,3,2,2,2,2,2,2,2,2,10 cents,100 minutes,24 days,Female,University - PhD,68,02PsVPf,02FUT,5,02DGEN,0,0,1,5,2,3,6,4,7,9,1,8,3,4,2,1,3,3,3,3,3,3,1,3,1,3,3,-2,3,-2,3,3,3,3,3,3,3,3,3,1,3,3,0,3,0,3,3,3,3,3,3,3,0,3,0,3,3,0,3,-2,3,3,3,3,3,3,3,0,3,0,3,3,0,3,-2,3,3,3,2,3,3,3,0,1,0,2,3,0,3,0,3,1,1,1,1,1,1,5,1,1,5,7,1 +R_6jja8oeAQsmBzhL,60 - 66,American,Female,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,3,2,4,5,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,4,1,2,3,Agree,Strongly Agree,Agree,Somewhat Disagree,Agree,1,5,4,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Agree,Agree,Somewhat disagree,Agree,5,3,4,2,1,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,2,3,1,5,5,Agree,Strongly agree,Agree,Somewhat Disagree,Agree,2,4,5,1,3,5,Strongly agree,Agree,Agree,Somewhat disagree,Agree,3,2,5,1,4,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,1,4,3,2,5,Agree,Strongly agree,Agree,Somewhat Disagree,Agree,1,4,2,5,3,5,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,5,2,4,3,1,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,3,1,5,4,2,5,Agree,Strongly agree,Agree,Somewhat Disagree,Agree,4,3,5,2,1,5,Strongly agree,Agree,Agree,Neither agree nor disagree,Agree,4,2,1,3,5,5,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,1,2,3,4,5,5,Agree,Strongly agree,Agree,Somewhat Disagree,Agree,5,3,4,2,1,0,1,0,2,-1,0,2,0,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,64,02PsVPf,01PAST,10,02DGEN,-0.25,0,0.666666667,3,4,5,7,8,9,6,1,2,3,2,4,1,3,2,2,0,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,-1,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,-1,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,0,2,1,-3,3,-3,0,2,3,2,-1,2,3,2,2,0,2,1,-3,2,-3,0,2,3,2,-1,2,5,5,5,5,5,5,5,5,5,5,5,5 +R_78KWiw9duh3YG77,60 - 66,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,4,2,3,1,5,Agree,Strongly disagree,Agree,Somewhat disagree,Agree,3,1,5,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,5,4,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,1,4,3,2,1,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,1,5,3,4,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,3,4,2,1,1,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,1,5,3,4,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,2,5,3,1,4,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,5,1,4,2,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,2,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,3,4,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,1,3,4,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,5,1,2,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,-2,2,-2,-1,0,-2,10 cents,100 minutes,24 days,Female,High School (or equivalent),61,03VPfPs,01PAST,10,01ITEM,0,0,1,6,8,2,5,7,4,3,1,9,2,4,3,1,3,3,3,-3,3,2,-3,2,-1,2,3,3,3,3,3,3,3,3,-3,3,3,-3,3,-2,3,3,3,3,3,3,3,3,3,-3,3,3,-3,3,3,3,3,3,3,-3,3,3,3,3,-2,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,2,3,3,-3,3,-3,3,3,3,3,3,3,1,2,2,1,2,2,1,1,1,0,1,0 +R_1Ca2W3p8z3iavf6,53 - 59,Canadian,Male,Agree,Agree,Agree,Agree,Agree,4,5,2,1,3,Somewhat agree,Somewhat disagree,Agree,Agree,Agree,3,2,5,4,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Agree,Agree,Agree,Agree,1,2,5,4,3,5,Agree,Agree,Agree,Agree,Agree,3,5,2,4,1,5,Agree,Agree,Agree,Agree,Agree,5,4,1,3,2,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,1,2,3,4,5,7,Disagree,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat agree,3,4,5,2,1,7,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,5,1,4,2,3,7,Agree,Agree,Agree,Agree,Agree,1,2,4,5,3,6,Agree,Agree,Agree,Agree,Agree,4,1,3,5,2,7,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,3,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,6,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,4,5,3,1,3,Agree,Agree,Agree,Agree,Agree,1,5,4,2,3,2,1,2,1,-1,-1,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,54,03VPfPs,01PAST,10,02DGEN,0.625,0,1,7,2,4,5,9,6,8,1,3,2,3,4,1,2,2,2,2,2,1,-1,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,1,-1,-1,-1,-2,1,-1,3,1,3,1,3,3,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,1,2,2,2,2,2,5,5,5,6,7,7,7,6,7,3,6,3 +R_7k0t0ZojGpZeKBR,32 - 38,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,4,5,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,3,2,5,1,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,4,2,3,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,2,4,1,5,3,1,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,3,2,1,5,1,Agree,Agree,Strongly agree,Agree,Strongly agree,2,4,3,5,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,3,2,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,1,3,5,4,2,1,Strongly agree,Agree,Somewhat Agree,Agree,Strongly agree,3,4,2,5,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,3,5,0,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Agree,2,1,4,5,3,1,Strongly agree,Agree,Strongly agree,Somewhat Agree,Strongly agree,2,5,4,3,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,3,4,1,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,3,4,5,1,2,0,Strongly agree,Agree,Somewhat Agree,Strongly agree,Agree,1,4,2,3,5,0,0,1,1,2,0,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,36,01PfPsV,01PAST,10,02DGEN,-0.5,0,1,9,6,7,5,8,4,3,1,2,2,3,4,1,3,3,3,3,3,0,-1,3,0,3,2,2,1,1,3,3,3,3,2,2,2,0,2,0,2,2,2,3,2,3,3,3,3,3,3,1,0,1,0,3,3,2,1,2,3,3,3,3,3,3,1,-1,2,-1,2,3,2,3,1,3,3,3,3,3,3,1,0,3,0,2,3,2,1,3,2,1,1,1,2,4,1,1,0,1,1,1,0 +R_5qDD8OVKXEU7FPS,67 - 73,American,Female,Strongly agree,Somewhat agree,Agree,Strongly disagree,Somewhat agree,5,2,3,1,4,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,2,5,3,4,1,Strongly Agree,Agree,Strongly Agree,Strongly Disagree,Strongly Agree,1,5,2,3,4,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,4,3,5,1,2,10,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,5,3,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,4,1,5,3,2,10,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,3,1,2,4,5,10,Somewhat disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,3,4,5,1,10,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,3,2,1,5,10,Strongly agree,Agree,Strongly agree,Disagree,Agree,5,4,2,1,3,10,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,3,4,5,10,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,1,5,3,2,10,Strongly agree,Strongly agree,Agree,Disagree,Somewhat agree,3,1,4,2,5,10,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,5,1,2,3,10,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,4,2,5,3,1,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,2,-1,-1,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),69,03VPfPs,02FUT,10,01ITEM,0.375,0,1,5,8,7,3,9,6,2,1,4,2,3,4,1,3,1,2,-3,1,1,-3,3,-2,3,3,2,3,-3,3,3,1,3,-3,1,0,-3,3,-3,3,3,3,3,-3,3,3,1,3,-3,1,-1,-3,3,-3,2,3,3,3,-2,3,3,2,3,-2,2,1,-3,3,-3,3,3,3,3,-2,3,3,3,2,-2,1,1,-3,3,-3,2,3,3,3,-3,3,10,10,10,10,10,10,10,10,10,10,10,10 +R_6HLVo651b2Ns27V,46 - 52,Canadian,Female,Strongly agree,Agree,Agree,Agree,Agree,4,1,5,2,3,Strongly disagree,Disagree,Agree,Somewhat disagree,Agree,5,4,1,3,2,Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,5,4,2,3,1,Agree,Agree,Agree,Agree,Agree,4,1,5,3,2,1,Strongly disagree,Disagree,Agree,Strongly disagree,Somewhat agree,3,2,5,1,4,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,3,5,2,4,1,1,Agree,Agree,Agree,Agree,Agree,5,2,3,4,1,1,Strongly disagree,Disagree,Agree,Disagree,Agree,3,4,2,1,5,1,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,3,2,1,4,1,Strongly agree,Agree,Agree,Strongly agree,Agree,1,3,5,2,4,1,Strongly disagree,Somewhat disagree,Agree,Disagree,Somewhat agree,3,4,1,2,5,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,4,1,2,5,0,Agree,Agree,Agree,Agree,Agree,3,1,4,5,2,1,Strongly disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,4,3,1,2,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,1,4,3,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,2,2,2,2,0,5 cents,100 minutes,47 days,Female,University - Graduate (Masters),48,02PsVPf,02FUT,5,01ITEM,-0.5,0.666666667,0.333333333,3,4,2,8,9,6,7,1,5,3,4,2,1,3,2,2,2,2,-3,-2,2,-1,2,2,-3,3,-2,3,2,2,2,2,2,-3,-2,2,-3,1,2,-3,3,-3,2,2,2,2,2,2,-3,-2,2,-2,2,3,-3,3,-3,3,3,2,2,3,2,-3,-1,2,-2,1,2,-3,3,-3,3,2,2,2,2,2,-3,0,2,-1,0,2,-3,3,-3,3,1,1,1,1,1,1,1,1,0,1,1,1 +R_3prMmEhVagQa825,67 - 73,American,Female,Strongly agree,Agree,Strongly agree,Agree,Agree,5,2,4,3,1,Agree,Disagree,Agree,Disagree,Agree,5,1,3,2,4,Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,1,4,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,2,1,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,1,2,5,1,Strongly agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,5,4,2,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,4,5,1,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,3,5,1,2,4,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,2,4,5,3,0,Agree,Agree,Agree,Agree,Agree,3,4,5,1,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,5,4,1,3,2,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,3,5,4,2,0,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,4,3,5,2,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,1,4,3,1,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,5,3,2,4,1,2,2,2,2,0,2,1,2,10 cents,100 minutes,24 days,Female,Trade School (non-military),70,03VPfPs,02FUT,10,02DGEN,0.375,0,1,2,7,4,8,5,9,6,1,3,2,3,4,1,3,2,3,2,2,2,-2,2,-2,2,2,0,2,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,-1,2,-1,3,3,3,3,3,3,3,3,3,-3,3,3,3,3,0,3,2,2,2,2,2,3,-3,3,3,3,3,0,3,0,3,3,3,3,2,2,3,-3,3,-3,3,3,-1,2,-2,3,1,0,1,0,1,0,0,0,0,0,0,1 +R_3HkwQiFWpFnTJYE,46 - 52,Canadian,Female,Agree,Agree,Agree,Somewhat agree,Strongly agree,1,2,3,4,5,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,4,5,1,3,2,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,2,1,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Agree,Agree,Somewhat disagree,Agree,4,5,2,1,3,4,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,4,3,2,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,2,3,4,6,Agree,Agree,Agree,Somewhat disagree,Agree,1,3,4,2,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,2,5,3,1,7,Agree,Agree,Agree,Agree,Agree,1,5,4,2,3,5,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,6,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,4,2,3,6,Agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,5,2,4,3,6,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,3,4,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,1,4,3,0,1,1,-1,0,-1,-1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0.625,0,1,2,7,5,9,3,4,8,1,6,3,2,4,1,2,2,2,1,3,-2,0,2,-1,2,1,1,2,1,1,2,2,2,-1,2,-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,-1,2,1,1,1,1,1,2,2,2,2,2,-2,-1,2,0,0,2,1,1,1,1,2,1,1,2,1,-2,1,1,1,1,2,1,1,1,1,6,4,6,7,6,6,7,5,6,6,6,4 +R_7r0cHKY4oCTAEJK,60 - 66,American,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,2,4,1,5,3,Strongly disagree,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,3,4,1,5,2,Agree,Somewhat Disagree,Agree,Somewhat Agree,Strongly Agree,1,4,5,3,2,Somewhat agree,Agree,Strongly agree,Agree,Disagree,1,3,2,4,5,1,Strongly disagree,Somewhat agree,Somewhat disagree,Strongly agree,Strongly disagree,4,5,3,1,2,4,Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Strongly agree,1,5,4,3,2,1,Agree,Agree,Strongly agree,Disagree,Somewhat agree,3,5,2,1,4,2,Disagree,Somewhat agree,Agree,Strongly agree,Somewhat agree,3,1,5,4,2,3,Agree,Somewhat Agree,Agree,Agree,Strongly agree,3,5,4,2,1,2,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,5,3,2,4,1,3,Strongly disagree,Disagree,Agree,Agree,Somewhat disagree,2,4,1,5,3,1,Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,1,4,5,3,2,1,Agree,Agree,Strongly agree,Strongly agree,Disagree,5,2,4,3,1,5,Strongly disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat disagree,1,2,5,4,3,4,Agree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,2,5,4,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,0,2,2,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),60,02PsVPf,02FUT,5,01ITEM,0,1,0,9,7,3,4,6,5,8,1,2,3,4,2,1,2,3,3,1,-1,-3,-1,1,3,-2,2,-1,2,1,3,1,2,3,2,-2,-3,1,-1,3,-3,2,0,1,2,3,2,2,3,-2,1,-2,1,2,3,1,2,1,2,2,3,2,3,3,2,1,-3,-2,2,2,-1,2,-1,2,-1,3,2,2,3,3,-2,-3,-1,2,1,-1,2,-1,1,-3,3,1,4,1,2,3,2,3,1,1,5,4,4 +R_7BhsRfqwHLhuYAV,67 - 73,American,Male,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,3,1,5,4,2,Strongly disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,4,3,2,5,1,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,4,3,1,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,3,4,2,1,5,10,Somewhat disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,2,3,1,4,5,10,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,2,5,10,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,3,2,4,5,10,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,1,3,2,5,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,3,1,2,4,10,Agree,Strongly agree,Somewhat agree,Agree,Somewhat agree,5,2,4,3,1,10,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Agree,4,5,3,2,1,10,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,3,5,2,4,1,10,Agree,Agree,Somewhat agree,Strongly agree,Agree,3,2,1,4,5,10,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,2,1,3,10,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,5,4,1,1,2,2,-1,0,0,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,71,01PfPsV,01PAST,10,02DGEN,0.5,0,1,6,2,4,7,3,5,9,1,8,4,3,2,1,3,3,1,1,3,-3,-1,3,0,3,3,3,2,3,3,2,3,3,0,3,-1,0,3,1,1,3,2,3,3,3,2,3,3,1,3,0,0,3,2,3,3,3,3,3,2,2,3,1,2,1,0,-1,2,0,2,3,2,3,2,3,2,2,1,3,2,0,-1,1,0,1,3,2,3,3,3,10,10,10,10,10,10,10,10,10,10,10,10 +R_1LiG5eQcc7wj9BK,53 - 59,Canadian,Male,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,Strongly agree,5,3,1,2,4,Disagree,Agree,Strongly agree,Somewhat disagree,Somewhat agree,4,1,5,2,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,3,5,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Strongly agree,Agree,Somewhat agree,Somewhat agree,Strongly agree,2,5,3,4,1,3,Agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,2,1,4,3,5,1,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,4,5,1,2,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,1,3,2,5,4,2,Agree,Somewhat agree,Agree,Neither agree nor disagree,Agree,2,1,4,3,5,2,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,3,5,1,4,8,Somewhat disagree,Agree,Disagree,Agree,Strongly agree,1,5,4,3,2,8,Agree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,1,2,4,3,5,7,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,Agree,1,2,5,3,4,6,Strongly disagree,Agree,Disagree,Agree,Strongly agree,4,1,5,2,3,1,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,1,2,4,3,5,2,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,Somewhat Agree,2,1,3,5,4,1,1,2,1,0,-2,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,01PfPsV,02FUT,5,02DGEN,0.625,0,1,8,5,2,7,6,3,9,1,4,4,2,3,1,-2,3,-1,1,3,-2,2,3,-1,1,0,1,0,1,2,3,2,1,1,3,2,1,1,2,0,0,2,1,0,1,-1,1,1,2,0,2,1,2,0,2,0,1,2,1,2,-1,2,-2,2,3,2,1,0,2,1,0,2,2,1,2,-3,2,-2,2,3,2,1,1,-1,2,0,2,1,2,1,2,3,1,2,2,2,8,8,7,6,1,2 +R_78s3uH2EFnwOwhz,67 - 73,American,Female,Strongly agree,Disagree,Agree,Neither agree nor disagree,Strongly disagree,3,2,4,5,1,Strongly disagree,Disagree,Agree,Disagree,Agree,3,2,4,1,5,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly Agree,1,2,4,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,Strongly disagree,4,3,1,5,2,1,Strongly disagree,Disagree,Agree,Disagree,Agree,4,5,3,2,1,1,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,4,1,5,2,3,1,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,Strongly disagree,2,1,5,4,3,1,Strongly disagree,Disagree,Agree,Disagree,Somewhat agree,3,2,5,4,1,1,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,2,4,1,5,3,1,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,Strongly disagree,4,2,1,3,5,1,Strongly disagree,Disagree,Agree,Disagree,Agree,4,3,2,1,5,1,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,3,1,5,2,4,1,Strongly agree,Strongly disagree,Agree,Neither agree nor disagree,Strongly disagree,2,4,3,1,5,1,Strongly disagree,Disagree,Agree,Disagree,Agree,1,3,4,2,5,1,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,3,5,4,2,1,2,2,2,2,0,2,2,2,10 cents,100 minutes,24 days,Female,University - PhD,70,03VPfPs,01PAST,10,02DGEN,0.25,0,1,6,3,8,5,2,9,4,1,7,2,3,4,1,3,-2,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,1,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,3,-3,2,0,-3,-3,-2,2,-2,2,1,-3,2,-3,3,1,1,1,1,1,1,1,1,1,1,1,1 +R_6BKJ0IIae4mCVah,46 - 52,Canadian,Male,Agree,Somewhat agree,Somewhat disagree,Disagree,Neither agree nor disagree,4,1,5,2,3,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,1,5,2,4,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,1,4,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Disagree,Disagree,Somewhat disagree,4,1,5,3,2,1,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,2,3,1,4,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Somewhat Agree,1,4,3,2,5,2,Agree,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,3,1,4,2,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,3,5,4,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Somewhat Agree,1,3,4,2,5,2,Agree,Agree,Disagree,Disagree,Neither agree nor disagree,3,1,4,2,5,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,4,3,2,1,5,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,1,2,3,4,5,1,Agree,Somewhat agree,Disagree,Disagree,Neither agree nor disagree,1,5,2,4,3,1,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,3,4,1,5,2,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Agree,1,3,5,2,4,1,1,1,1,0,-1,1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,47,03VPfPs,01PAST,10,02DGEN,0.375,1,0,7,3,6,5,9,2,8,1,4,4,2,3,1,2,1,-1,-2,0,-1,-2,2,-1,1,1,0,2,-2,1,2,2,-2,-2,-1,-1,-2,2,-1,1,1,0,1,-2,1,2,2,1,-1,0,-1,-2,2,-1,1,0,0,1,-2,1,2,2,-2,-2,0,-1,-2,2,-2,1,1,0,2,-2,1,2,1,-2,-2,0,-1,-2,2,-1,1,1,0,2,-2,1,1,1,1,2,2,2,2,1,2,1,1,2 +R_1PdLTy6wnfNmKpJ,67 - 73,American,Male,Agree,Strongly agree,Strongly agree,Strongly disagree,Agree,4,5,3,1,2,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,3,1,4,5,Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,2,1,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,5,2,4,1,3,0,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Agree,5,3,2,4,1,0,Somewhat Agree,Agree,Agree,Strongly Disagree,Strongly agree,3,2,4,5,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,4,5,2,1,3,0,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,4,5,2,3,0,Agree,Somewhat Agree,Agree,Strongly Disagree,Somewhat Agree,4,5,3,1,2,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,4,2,1,3,0,Disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,2,1,4,5,3,0,Somewhat Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,5,3,2,1,4,0,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,3,2,5,4,1,0,Disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,4,3,1,5,0,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,3,4,1,2,1,2,2,2,-1,2,2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,68,03VPfPs,02FUT,10,02DGEN,0,0,1,5,7,2,3,9,6,4,1,8,2,4,3,1,2,3,3,-3,2,-2,-3,3,-3,1,2,1,2,-3,3,3,3,3,-3,1,-3,-3,2,-3,2,1,2,2,-3,3,3,3,3,-3,1,-3,-3,2,-3,1,2,1,2,-3,1,3,3,3,-2,3,-2,-3,2,-3,1,1,1,2,-3,3,3,3,3,-1,3,-2,-3,3,-3,1,1,0,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_6US8xvHn7QMnayB,60 - 66,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat agree,4,3,1,2,5,Strongly disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,5,3,2,1,4,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,2,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,1,2,3,4,5,9,Strongly disagree,Agree,Agree,Agree,Agree,5,2,3,4,1,5,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Agree,2,3,5,1,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,5,4,3,2,1,2,Strongly disagree,Agree,Strongly agree,Strongly agree,Somewhat agree,3,1,5,4,2,2,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,2,1,4,5,3,1,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat agree,2,5,4,3,1,2,Strongly disagree,Disagree,Strongly agree,Disagree,Somewhat agree,4,3,1,2,5,2,Strongly agree,Somewhat Agree,Strongly agree,Strongly Disagree,Strongly agree,2,5,3,1,4,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,4,2,3,5,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,2,1,4,5,2,Strongly agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,1,4,3,5,-1,1,-1,2,-1,-1,1,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,66,02PsVPf,01PAST,5,02DGEN,-0.5,0,1,5,2,4,7,6,9,3,1,8,2,4,3,1,3,3,3,2,1,-3,1,3,3,1,3,1,3,-3,3,3,3,3,1,-1,-3,2,2,2,2,3,1,2,-3,2,3,3,3,1,-1,-3,2,3,3,1,3,2,3,-3,3,3,3,3,2,1,-3,-2,3,-2,1,3,1,3,-3,3,3,3,3,3,1,-3,-3,3,-3,1,3,-2,3,-3,3,1,9,5,1,2,2,1,2,2,2,3,2 +R_5Pw5qC2rawzbL82,39 - 45,Canadian,Female,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,1,3,4,2,5,Disagree,Strongly disagree,Agree,Disagree,Somewhat agree,3,2,5,1,4,Strongly Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,5,1,4,Agree,Agree,Agree,Somewhat agree,Strongly agree,3,2,5,4,1,6,Strongly disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,3,1,2,5,4,7,Agree,Agree,Agree,Strongly agree,Somewhat Agree,3,4,1,2,5,8,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Agree,4,5,2,3,1,7,Disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,1,4,5,6,Agree,Disagree,Strongly agree,Agree,Somewhat Agree,2,5,3,1,4,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,3,5,1,2,4,Strongly disagree,Strongly disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,2,3,5,1,4,4,Agree,Strongly Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,3,4,5,4,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,5,2,3,4,1,4,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Agree,1,4,5,3,2,6,Agree,Disagree,Agree,Agree,Somewhat Agree,4,5,2,3,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,0,0,-1,2,10 cents,5 minutes,36 days,Female,University - Undergraduate,44,02PsVPf,01PAST,10,01ITEM,0.625,0.333333333,0.333333333,6,8,5,4,9,7,2,1,3,3,4,2,1,1,2,2,1,1,-2,-3,2,-2,1,3,-1,1,1,1,2,2,2,1,3,-3,-3,1,-2,1,2,2,2,3,1,1,1,2,-1,2,-2,-3,1,0,1,2,-2,3,2,1,1,1,2,1,0,-3,-3,0,-2,0,2,-3,0,0,0,0,2,2,2,0,-3,-3,3,-2,2,2,-2,2,2,1,6,7,8,7,6,8,4,4,4,4,6,5 +R_5Id5KM8MgZBfe9q,46 - 52,Canadian,Male,Agree,Disagree,Somewhat agree,Agree,Strongly agree,3,5,4,1,2,Somewhat agree,Strongly disagree,Disagree,Neither agree nor disagree,Somewhat agree,4,2,1,5,3,Agree,Strongly Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,4,1,2,3,5,Disagree,Strongly agree,Neither agree nor disagree,Strongly disagree,Strongly disagree,2,4,1,3,5,9,Strongly agree,Somewhat disagree,Strongly agree,Agree,Neither agree nor disagree,4,3,2,5,1,2,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Strongly agree,Strongly Disagree,3,2,5,4,1,2,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly disagree,1,2,4,5,3,9,Agree,Somewhat agree,Agree,Disagree,Disagree,5,1,2,4,3,5,Agree,Agree,Somewhat Disagree,Agree,Strongly Disagree,2,3,5,4,1,3,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,2,4,5,3,1,2,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,5,4,1,3,2,8,Strongly Disagree,Strongly Disagree,Agree,Strongly Disagree,Somewhat Disagree,1,4,2,3,5,10,Agree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,3,2,1,4,5,3,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Strongly agree,5,3,2,4,1,5,Disagree,Somewhat Agree,Strongly Disagree,Strongly Disagree,Disagree,1,5,2,3,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,0,0,0,0,-2,5 cents,5 minutes,47 days,Male,University - Undergraduate,49,01PfPsV,02FUT,5,01ITEM,0.25,1,0,9,4,7,8,2,6,5,1,3,3,2,4,1,2,-2,1,2,3,1,-3,-2,0,1,2,-3,0,3,1,-2,3,0,-3,-3,3,-1,3,2,0,0,1,3,3,-3,-3,0,2,0,-3,2,1,2,-2,-2,2,2,-1,2,-3,0,2,-1,0,2,-1,2,-1,0,3,-3,-3,2,-3,-1,2,0,3,3,3,1,0,2,-2,3,-2,1,-3,-3,-2,9,2,2,9,5,3,2,8,10,3,5,6 +R_1PuIvcwlGXOr30L,67 - 73,American,Female,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,3,2,1,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,1,4,5,Agree,Agree,Agree,Somewhat Agree,Agree,1,5,3,4,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,3,1,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,5,4,3,2,1,1,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,5,3,2,1,1,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,5,2,4,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,4,2,3,1,5,1,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,3,5,1,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,2,5,1,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,4,5,1,3,2,0,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,1,5,4,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,3,2,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,3,4,2,5,1,1,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,4,2,5,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,2,-1,0,0,0,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,70,02PsVPf,02FUT,5,01ITEM,-0.125,0.666666667,0.333333333,3,5,8,4,7,9,6,1,2,4,2,3,1,2,2,2,0,2,0,-3,3,-3,3,2,2,2,1,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,2,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,3,3,3,3,3,0,-3,2,-3,2,2,2,2,0,2,1,1,1,1,1,1,1,0,1,1,1,1 +R_5PhPwmbBbDD0cg1,67 - 73,American,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat agree,1,5,4,3,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,1,5,2,4,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,4,3,2,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,4,2,3,1,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,4,2,1,3,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,1,4,3,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,4,1,2,5,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,1,3,5,2,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,4,5,1,3,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,5,2,3,1,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,1,3,5,4,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,4,3,1,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,5,4,2,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,4,3,2,1,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,0,-1,2,-2,-2,2,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),71,03VPfPs,01PAST,10,01ITEM,0.125,0,1,3,7,2,6,5,9,4,1,8,3,4,2,1,3,2,3,3,1,3,-3,3,-3,1,3,3,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,1,3,2,3,-3,3,3,3,3,3,2,3,-3,3,-3,2,3,2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_7E8J8aXWSvyuMcp,46 - 52,Canadian,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,2,1,3,4,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Somewhat disagree,2,5,4,3,1,Agree,Strongly Agree,Agree,Somewhat Agree,Agree,3,5,2,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,4,1,5,2,2,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,4,3,5,1,2,2,Strongly agree,Strongly agree,Agree,Agree,Agree,4,2,3,1,5,2,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,2,3,1,5,2,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,1,4,2,3,5,2,Agree,Strongly agree,Agree,Agree,Agree,3,2,1,5,4,2,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,5,2,1,4,1,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,4,2,1,3,5,2,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,5,4,2,1,2,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,1,2,3,5,2,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,2,1,5,3,4,2,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,4,3,2,1,5,1,1,2,1,1,0,1,1,10 cents,100 minutes,15 days,Male,College Diploma/Certificate,50,03VPfPs,01PAST,5,02DGEN,0.25,0,0.666666667,6,7,8,4,9,2,5,1,3,2,3,4,1,2,3,3,3,1,-1,1,3,-2,-1,2,3,2,1,2,2,3,3,3,2,-1,1,3,1,-1,3,3,2,2,2,2,3,3,3,2,-1,1,3,1,1,2,3,2,2,2,2,3,3,3,1,-1,1,3,1,1,3,3,3,2,2,2,3,3,3,1,-1,1,3,1,1,3,3,3,2,2,1,2,2,2,2,2,2,1,2,2,2,2 +R_3B2U7tAAjoETGYF,53 - 59,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Agree,4,2,5,3,1,Somewhat disagree,Somewhat agree,Agree,Strongly disagree,Somewhat agree,3,2,4,1,5,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Agree,Agree,Neither agree nor disagree,Agree,1,5,2,3,4,3,Disagree,Somewhat agree,Agree,Disagree,Agree,2,1,4,3,5,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly agree,4,5,3,1,2,3,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,5,4,1,3,2,3,Disagree,Somewhat agree,Agree,Strongly disagree,Agree,5,1,2,3,4,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly agree,5,2,3,1,4,3,Agree,Agree,Agree,Somewhat agree,Agree,3,5,1,4,2,3,Disagree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat agree,2,4,3,1,5,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,5,3,1,5,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,3,1,5,2,4,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,3,2,1,5,4,3,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,4,1,3,0,2,0,2,1,1,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,55,01PfPsV,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,2,9,7,3,4,8,5,1,6,3,2,4,1,2,2,2,1,2,-1,1,2,-3,1,1,0,3,0,3,2,2,2,0,2,-2,1,2,-2,2,1,0,2,0,3,2,2,2,0,3,-2,1,2,-3,2,1,0,2,0,3,2,2,2,1,2,-2,0,1,-2,1,1,0,2,0,3,2,2,2,1,1,-1,1,1,-2,1,1,0,3,0,3,3,3,3,3,3,3,3,3,3,5,4,3 +R_7yKZHZ7lGhrwOOt,67 - 73,American,Female,Agree,Agree,Agree,Somewhat disagree,Strongly agree,3,4,1,5,2,Strongly agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,1,5,3,2,4,Agree,Agree,Agree,Strongly Agree,Agree,3,2,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,4,3,1,2,5,3,Strongly agree,Strongly disagree,Agree,Strongly disagree,Strongly agree,4,1,5,2,3,3,Strongly agree,Somewhat Agree,Agree,Agree,Agree,5,3,1,2,4,2,Strongly agree,Strongly agree,Agree,Strongly disagree,Strongly agree,3,4,1,2,5,2,Strongly agree,Strongly disagree,Agree,Strongly disagree,Agree,2,1,4,5,3,2,Somewhat Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,4,1,3,5,2,3,Agree,Agree,Agree,Strongly agree,Strongly agree,2,5,4,1,3,3,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,2,5,3,3,Strongly agree,Strongly agree,Agree,Somewhat Agree,Strongly agree,3,2,4,5,1,4,Strongly agree,Agree,Agree,Agree,Strongly agree,4,2,1,5,3,4,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,1,4,4,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,5,3,1,2,4,1,1,1,2,0,-1,2,1,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),69,01PfPsV,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,9,4,2,7,5,3,6,1,8,3,4,2,1,2,2,2,-1,3,3,-3,2,-3,3,2,2,2,3,2,2,3,2,-1,3,3,-3,2,-3,3,3,1,2,2,2,3,3,2,-3,3,3,-3,2,-3,2,1,3,3,1,3,2,2,2,3,3,3,-3,3,-3,3,3,3,2,1,3,3,2,2,2,3,2,-3,3,-3,3,3,2,2,0,3,3,3,3,2,2,2,3,3,3,4,4,4 +R_7qqRHW9GNmsUdS0,46 - 52,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,2,3,5,4,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,1,5,3,4,Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Somewhat Agree,5,2,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,3,4,1,2,1,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Agree,4,5,2,3,1,0,Agree,Neither Agree nor Disagree,Strongly agree,Strongly agree,Agree,1,3,4,2,5,0,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,4,5,1,3,1,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Strongly agree,2,5,3,4,1,0,Agree,Neither Agree nor Disagree,Strongly agree,Strongly agree,Agree,3,2,4,5,1,0,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,2,5,4,3,0,Disagree,Disagree,Strongly agree,Disagree,Agree,4,5,2,3,1,0,Agree,Neither Agree nor Disagree,Strongly agree,Agree,Agree,4,1,2,5,3,0,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,1,5,3,4,1,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Agree,5,3,4,2,1,0,Agree,Neither Agree nor Disagree,Strongly agree,Agree,Agree,2,5,1,3,4,0,2,1,1,0,0,2,-2,10 cents,100 minutes,24 days,Female,University - Undergraduate,52,02PsVPf,01PAST,10,02DGEN,-0.25,0,1,4,9,2,7,3,6,5,1,8,3,4,2,1,3,3,3,1,3,-2,-2,3,0,1,2,0,3,2,1,3,3,3,1,3,-2,-2,3,0,2,2,0,3,3,2,3,3,3,1,3,-3,-2,3,1,3,2,0,3,3,2,3,3,3,1,3,-2,-2,3,-2,2,2,0,3,2,2,3,3,3,1,3,-2,-2,3,0,2,2,0,3,2,2,0,1,0,0,1,0,0,0,0,0,1,0 +R_7hmBFCmcORt4UfG,53 - 59,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Agree,5,4,1,3,2,Disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Strongly Agree,4,3,2,5,1,Agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,5,1,4,2,3,5,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,4,5,1,3,8,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Agree,1,5,4,2,3,7,Somewhat agree,Agree,Strongly agree,Somewhat disagree,Agree,3,5,1,2,4,6,Disagree,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,1,3,2,4,5,8,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,5,4,3,2,1,9,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,1,4,5,3,2,6,Neither agree nor disagree,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,2,3,1,4,5,5,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,4,5,1,3,2,6,Strongly agree,Strongly agree,Strongly disagree,Neither agree nor disagree,Strongly agree,2,3,1,5,4,10,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,3,2,5,1,10,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,2,4,3,1,5,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,2,2,2,0,0,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,58,02PsVPf,02FUT,10,01ITEM,0,0,1,6,5,4,7,3,9,8,1,2,4,3,2,1,2,2,2,1,2,-2,-2,2,0,0,1,0,1,-2,3,2,3,3,-1,3,0,-2,2,-1,1,1,0,0,-1,2,1,2,3,-1,2,-2,-1,2,1,0,-1,1,1,1,2,3,3,0,0,3,0,-3,2,0,1,3,0,0,-3,3,3,3,-3,0,3,0,-3,3,-3,3,3,0,0,-3,3,5,8,7,6,8,9,6,5,6,10,10,10 +R_11iSXUsPSc4zuZk,60 - 66,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,4,5,3,2,Strongly agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,3,4,1,2,5,Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,3,4,2,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,3,4,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,5,2,4,3,2,Strongly agree,Agree,Agree,Strongly Disagree,Agree,4,5,1,2,3,1,Somewhat agree,Agree,Agree,Somewhat agree,Agree,4,2,3,1,5,3,Strongly agree,Strongly disagree,Agree,Strongly disagree,Agree,1,3,2,4,5,2,Agree,Agree,Agree,Strongly Disagree,Agree,2,4,3,1,5,3,Agree,Agree,Agree,Agree,Strongly agree,1,5,2,4,3,2,Agree,Disagree,Agree,Disagree,Agree,2,4,3,1,5,3,Agree,Agree,Agree,Strongly Disagree,Agree,2,5,3,1,4,2,Agree,Agree,Agree,Agree,Agree,1,3,4,2,5,1,Agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,3,4,1,2,1,Agree,Agree,Agree,Strongly Disagree,Agree,2,1,3,4,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,2,2,1,1,1,10 cents,25 minutes,24 days,Male,College Diploma/Certificate,62,01PfPsV,01PAST,5,01ITEM,-0.5,0,0.666666667,9,5,2,6,8,4,7,1,3,3,4,2,1,2,3,3,1,3,3,-3,3,-2,1,2,3,3,-3,2,3,3,3,3,3,3,-3,3,-3,2,3,2,2,-3,2,1,2,2,1,2,3,-3,2,-3,2,2,2,2,-3,2,2,2,2,2,3,2,-2,2,-2,2,2,2,2,-3,2,2,2,2,2,2,2,-3,2,-3,1,2,2,2,-3,2,1,2,1,3,2,3,2,3,2,1,1,2 +R_1dawVCdr211mxwY,25 - 31,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,1,2,4,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,3,4,5,2,Disagree,Strongly Disagree,Agree,Somewhat Disagree,Strongly Agree,5,4,1,3,2,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,3,2,4,5,Somewhat agree,Agree,Somewhat agree,Strongly agree,Somewhat agree,4,2,5,1,3,6,Strongly agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,1,5,3,4,2,6,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat disagree,3,5,1,4,2,6,Strongly disagree,Somewhat agree,Disagree,Strongly agree,Somewhat agree,4,3,1,5,2,9,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Strongly agree,4,5,3,2,1,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,3,1,4,2,5,Neither Agree nor Disagree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,1,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,5,Neither Agree nor Disagree,Strongly Disagree,Agree,Neither Agree nor Disagree,Strongly agree,1,3,4,5,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,0,1,1,1,15 cents,75 minutes,36 days,Female,High School (or equivalent),31,02PsVPf,01PAST,5,01ITEM,0.125,0,0,9,4,8,5,3,2,7,1,6,3,4,2,1,1,1,-1,-1,-1,-1,0,0,0,1,-2,-3,2,-1,3,0,2,1,1,-1,1,2,1,3,1,3,-2,3,1,3,1,2,2,1,-1,-3,1,-2,3,1,2,-1,1,1,3,0,0,0,0,0,0,0,0,0,1,0,-3,2,0,3,0,0,0,0,0,0,0,0,0,1,0,-3,2,0,3,5,6,6,6,9,8,5,5,5,5,5,5 +R_1frrUBBeAJk9Qhn,46 - 52,Canadian,Female,Strongly disagree,Strongly agree,Somewhat disagree,Disagree,Strongly agree,3,4,1,5,2,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,2,4,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,5,3,4,1,2,Disagree,Strongly agree,Strongly disagree,Strongly disagree,Strongly agree,5,4,2,1,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,4,2,4,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,5,2,7,Somewhat disagree,Strongly agree,Somewhat agree,Strongly disagree,Strongly agree,1,5,4,2,3,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,6,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,4,1,6,Disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,1,4,2,5,3,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,4,1,2,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,2,1,5,3,4,2,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,4,1,5,2,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,1,4,2,Strongly agree,Somewhat Agree,Agree,Strongly agree,Strongly agree,4,5,1,3,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,1,1,-1,0,0,0,10 cents,5 minutes,15 days,Female,High School (or equivalent),47,03VPfPs,02FUT,5,01ITEM,0.5,0.333333333,0.333333333,5,9,8,6,7,4,2,1,3,3,4,2,1,-3,3,-1,-2,3,-2,-1,1,1,0,0,0,0,0,3,-2,3,-3,-3,3,3,3,3,3,3,2,2,3,3,3,-1,3,1,-3,3,3,3,3,3,3,2,2,3,3,3,-2,3,0,0,3,0,0,0,1,1,1,1,1,0,3,1,3,1,1,3,0,0,1,1,1,3,1,2,3,3,5,4,7,6,6,6,4,5,2,2,2,2 +R_7fCEITMfc7d3LHj,53 - 59,American,Male,Neither agree nor disagree,Agree,Agree,Somewhat agree,Neither agree nor disagree,5,3,2,1,4,Somewhat disagree,Disagree,Strongly agree,Disagree,Somewhat agree,5,1,3,2,4,Strongly Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,2,4,3,1,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,3,4,5,1,2,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,2,5,3,4,0,Strongly agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,3,5,4,2,0,Agree,Agree,Agree,Agree,Neither agree nor disagree,2,3,5,1,4,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,1,5,2,0,Strongly agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,1,5,4,2,0,Agree,Agree,Agree,Agree,Neither agree nor disagree,5,2,3,4,1,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,5,1,3,2,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,4,2,3,5,0,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,1,3,5,2,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,5,2,4,3,0,Strongly agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,4,1,5,2,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,1,1,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,59,03VPfPs,02FUT,5,01ITEM,-0.375,0,1,4,5,7,6,8,9,2,1,3,3,4,2,1,0,2,2,1,0,-1,-2,3,-2,1,3,-2,3,-3,3,1,2,2,1,0,-3,-3,3,-3,2,3,-2,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-2,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-3,3,-3,3,2,2,2,2,0,-3,-3,3,-3,2,3,-2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_6FrmnaHETS1ccrk,46 - 52,Canadian,Female,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,2,3,1,4,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,3,1,5,4,2,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,1,3,2,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,4,1,4,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,1,3,5,4,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,4,2,1,3,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,1,3,5,4,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,2,5,4,1,3,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,5,4,2,1,3,Strongly disagree,Disagree,Agree,Somewhat agree,Disagree,4,3,1,2,5,1,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,1,3,4,2,5,3,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,4,1,3,5,2,1,Disagree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,2,5,1,3,3,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,4,1,5,2,0,1,0,1,-1,1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,50,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,4,5,6,8,2,3,7,1,9,4,3,2,1,2,1,1,1,2,-2,-1,2,0,-1,1,0,1,-1,0,-1,0,1,0,0,-2,0,1,0,1,1,1,1,1,1,0,0,2,1,0,-1,0,1,0,-1,2,1,1,1,0,1,1,2,1,1,-3,-2,2,1,-2,1,1,0,-1,0,1,1,2,2,0,-2,-2,1,0,-1,2,1,1,-1,1,3,4,3,4,4,4,1,3,1,3,1,3 +R_1dzLe6ylnvHseSi,25 - 31,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,Neither agree nor disagree,Somewhat disagree,Agree,Disagree,Strongly agree,3,4,5,1,2,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Disagree,Agree,4,5,2,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,2,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,4,1,2,3,5,1,Somewhat Agree,Agree,Agree,Strongly Disagree,Agree,5,1,4,3,2,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,4,3,2,1,5,1,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,3,1,4,5,2,1,Somewhat Agree,Strongly agree,Strongly agree,Agree,Agree,1,5,4,3,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,4,5,1,Neither agree nor disagree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,5,1,3,4,2,1,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Agree,5,4,2,3,1,1,Agree,Strongly agree,Strongly agree,Agree,Agree,3,2,5,1,4,1,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,4,1,2,3,5,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Somewhat Agree,5,3,2,1,4,2,1,2,2,-1,1,1,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),29,02PsVPf,01PAST,10,02DGEN,0.5,1,0,4,5,7,6,3,8,9,1,2,2,4,3,1,3,3,3,3,3,0,-1,2,-2,3,1,-1,1,-2,2,3,3,3,3,3,0,-3,2,-3,2,1,2,2,-3,2,0,0,3,3,3,0,-3,1,-3,2,1,3,3,2,2,3,3,3,3,3,0,-3,1,-3,2,2,1,1,-3,2,2,3,3,2,2,0,-3,2,-3,2,1,1,1,-3,1,1,2,1,1,1,1,1,1,1,1,1,1 +R_5z7ZsDfonFF4A81,46 - 52,Canadian,Male,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,4,1,3,5,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,5,2,1,3,Neither Agree nor Disagree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,1,2,5,3,4,Strongly disagree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,2,4,5,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,2,3,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,3,5,1,5,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,5,1,2,3,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,5,1,3,4,5,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,3,2,1,5,5,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,Agree,5,2,3,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,4,3,1,2,5,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,5,4,5,Strongly disagree,Somewhat agree,Agree,Somewhat disagree,Agree,2,1,3,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,5,Agree,Strongly agree,Agree,Somewhat Agree,Neither Agree nor Disagree,1,2,4,5,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,1,2,0,-1,-1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,48,01PfPsV,01PAST,10,01ITEM,0.25,1,0,4,3,5,7,8,9,2,1,6,2,3,4,1,-1,1,1,0,2,0,-1,0,0,1,0,3,2,0,2,-3,1,2,-2,0,0,0,0,0,0,0,1,1,0,1,-3,1,1,-1,0,0,1,0,0,1,-1,1,0,0,0,-3,1,2,-1,2,0,0,0,1,1,2,0,1,0,0,-3,1,2,-1,2,0,0,0,0,0,2,3,2,1,0,5,5,5,5,5,5,5,5,5,5,5,5 +R_3puR6zIktNYt6ru,32 - 38,Canadian,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,2,3,4,1,5,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,5,3,2,4,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,1,2,5,3,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly agree,1,5,4,2,3,10,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,2,5,3,1,4,8,Strongly agree,Strongly agree,Neither Agree nor Disagree,Agree,Strongly agree,5,4,1,3,2,10,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,3,2,4,1,5,8,Somewhat agree,Strongly agree,Agree,Agree,Disagree,5,1,3,4,2,8,Somewhat Agree,Neither Agree nor Disagree,Disagree,Strongly agree,Strongly Disagree,2,5,1,4,3,8,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,3,2,5,4,1,8,Strongly agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,1,2,4,5,3,8,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,1,5,3,4,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,5,2,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,3,2,5,8,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,4,5,1,2,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,-1,-1,2,1,1,2,2,5 cents,5 minutes,47 days,Male,University - Undergraduate,33,03VPfPs,01PAST,5,01ITEM,-0.5,1,0,9,7,8,3,2,4,6,1,5,3,2,4,1,3,3,2,1,3,2,1,3,0,3,3,2,3,1,3,1,3,2,3,3,-3,3,1,3,-3,3,3,0,2,3,1,3,1,3,3,1,3,2,2,-2,1,0,-2,3,-3,3,3,1,3,3,3,-3,1,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,-2,3,10,8,10,8,8,8,8,8,8,0,8,8 +R_7oIpKmsCj6LC4Pq,67 - 73,American,Male,Strongly agree,Agree,Strongly agree,Agree,Agree,3,5,1,2,4,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,3,2,1,4,5,Agree,Strongly Disagree,Somewhat Agree,Strongly Disagree,Strongly Agree,1,3,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Agree,Strongly agree,Somewhat agree,Agree,2,5,1,3,4,1,Strongly disagree,Disagree,Strongly agree,Disagree,Somewhat agree,2,4,1,3,5,1,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,1,4,3,5,2,1,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,1,2,3,4,1,Strongly disagree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,1,4,3,2,5,1,Agree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,5,3,4,2,1,8,Strongly agree,Agree,Strongly agree,Agree,Somewhat agree,5,1,4,3,2,1,Strongly disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,2,1,4,5,3,1,Somewhat Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,5,3,2,4,1,1,Strongly agree,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,3,1,5,2,4,1,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,1,4,3,5,2,1,Somewhat Agree,Strongly Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,5,3,1,2,4,1,2,2,2,2,2,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,73,03VPfPs,02FUT,5,02DGEN,-0.375,1,0,6,7,5,2,3,8,9,1,4,2,4,3,1,3,2,3,2,2,-3,-3,3,-2,1,2,-3,1,-3,3,3,2,3,1,2,-3,-2,3,-2,1,2,-3,2,-3,3,3,1,3,0,1,-3,-2,3,-3,1,2,-1,1,-3,3,3,2,3,2,1,-3,-2,2,-1,0,1,-3,2,-3,3,3,2,3,3,0,-3,-1,1,-1,0,1,-3,1,-3,3,1,1,1,1,1,1,8,1,1,1,1,1 +R_18M7dRJ21zAoFu4,53 - 59,American,Female,Somewhat agree,Agree,Neither agree nor disagree,Strongly disagree,Strongly agree,1,5,4,2,3,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,1,5,3,2,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,2,3,5,4,1,Somewhat agree,Strongly agree,Disagree,Strongly disagree,Strongly agree,4,2,3,1,5,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,2,4,3,1,5,4,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,5,3,4,3,Somewhat agree,Agree,Somewhat agree,Strongly disagree,Agree,1,4,3,5,2,4,Somewhat agree,Disagree,Strongly agree,Disagree,Somewhat agree,4,5,1,2,3,5,Neither Agree nor Disagree,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,3,1,4,5,2,5,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,Strongly agree,3,4,1,2,5,2,Neither agree nor disagree,Disagree,Agree,Strongly disagree,Neither agree nor disagree,5,3,4,1,2,2,Neither Agree nor Disagree,Agree,Agree,Disagree,Agree,4,1,3,5,2,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,4,1,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,3,5,1,4,5,Neither Agree nor Disagree,Agree,Agree,Disagree,Agree,4,5,3,2,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,1,0,2,0,1,1,-2,10 cents,5 minutes,24 days,Female,College Diploma/Certificate,59,03VPfPs,02FUT,5,01ITEM,-0.75,0.333333333,0.666666667,2,3,7,9,8,4,6,1,5,4,2,3,1,1,2,0,-3,3,0,-3,3,-3,1,1,1,3,0,2,1,3,-2,-3,3,-1,0,1,1,-1,0,2,2,0,1,1,2,1,-3,2,1,-2,3,-2,1,0,3,3,2,0,0,2,1,-1,3,0,-2,2,-3,0,0,2,2,-2,2,1,1,1,1,1,0,-1,1,-2,0,0,2,2,-2,2,3,4,3,4,5,5,2,2,4,6,5,3 +R_5ODgAa2BmCZ00qO,46 - 52,Canadian,Female,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,2,5,3,1,4,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,1,2,4,3,Strongly Agree,Neither Agree nor Disagree,Agree,Disagree,Strongly Agree,4,2,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Somewhat agree,Somewhat agree,Strongly disagree,Agree,2,5,1,3,4,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,3,5,1,4,0,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,1,4,5,3,2,3,Strongly agree,Agree,Neither agree nor disagree,Disagree,Agree,1,2,3,5,4,2,Strongly agree,Disagree,Strongly agree,Disagree,Agree,3,4,2,5,1,1,Strongly agree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,3,2,1,4,2,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,4,3,2,1,5,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,1,2,4,3,0,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,3,2,1,4,5,3,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,4,1,3,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,1,2,4,3,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,5,2,4,1,0,2,1,1,-1,0,0,2,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),49,02PsVPf,02FUT,10,02DGEN,0.625,1,0,8,7,3,5,4,2,6,1,9,2,4,3,1,3,1,1,0,2,0,-2,3,-3,0,3,0,2,-2,3,2,1,1,-3,2,1,-3,3,-3,1,3,0,1,-3,3,3,2,0,-2,2,3,-2,3,-2,2,3,-1,3,0,3,2,1,1,0,2,2,-3,3,-3,1,3,1,2,-3,3,2,1,1,1,1,1,-3,3,-3,0,3,0,3,-3,3,1,1,0,3,2,1,2,0,0,3,0,0 +R_5n3WtCtZeWxVeq5,39 - 45,American,Male,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,5,4,1,3,2,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,2,1,5,3,4,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Disagree,2,1,5,3,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,3,4,1,2,5,9,Agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,3,4,8,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,4,2,1,3,8,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,2,4,3,1,7,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,8,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Agree,4,5,2,3,1,9,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,4,5,2,3,7,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,5,2,4,3,1,10,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,4,5,3,1,2,7,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,2,4,5,3,8,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,1,5,3,4,2,9,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,4,5,3,2,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,-1,0,-2,-1,-1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,40,01PfPsV,01PAST,10,01ITEM,0.5,0,1,9,8,3,6,7,2,5,1,4,4,2,3,1,3,2,3,2,3,1,1,-1,0,1,0,1,0,-1,-1,0,1,1,0,2,2,-1,0,0,0,0,-1,1,1,0,0,3,0,1,1,1,-1,1,0,0,-1,0,0,-1,2,2,0,3,1,0,0,1,-1,0,1,-1,0,-1,2,0,2,3,0,1,1,1,-1,1,0,2,0,-1,0,1,2,9,8,8,7,8,9,7,10,7,8,9,8 +R_5FzigTMBbalmb1p,60 - 66,American,Male,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,3,5,1,4,2,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,3,1,4,5,2,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,4,5,3,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,1,3,5,4,2,Agree,Strongly agree,Strongly agree,Agree,Agree,1,4,2,3,5,2,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,1,5,2,3,2,Somewhat agree,Somewhat agree,Strongly agree,Agree,Strongly agree,4,2,1,3,5,2,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,4,2,5,3,1,1,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,5,2,4,1,3,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Agree,5,1,3,4,2,1,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,4,3,2,5,2,Strongly agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly agree,2,5,3,1,4,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Strongly agree,5,2,4,3,1,1,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,3,2,1,2,Strongly agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,3,2,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,0,2,2,-2,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,66,02PsVPf,02FUT,5,01ITEM,-0.5,0.333333333,0.666666667,9,7,8,4,2,3,6,1,5,4,3,2,1,0,1,3,1,3,1,0,2,0,1,2,0,2,0,0,2,3,3,2,3,2,3,3,2,2,3,3,3,2,3,1,1,3,2,3,3,2,3,3,2,3,2,3,2,3,0,0,3,1,2,1,1,2,1,1,3,1,2,0,3,0,1,3,2,3,2,2,2,1,1,3,2,3,0,3,2,2,2,2,1,1,1,2,1,1,2,2 +R_7eRyIUDyL1PsvVX,67 - 73,American,Male,Disagree,Agree,Agree,Somewhat agree,Somewhat disagree,2,5,3,1,4,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,3,5,2,4,1,Agree,Strongly Agree,Strongly Agree,Disagree,Somewhat Agree,1,5,2,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Disagree,Agree,Agree,Somewhat disagree,Disagree,4,5,3,1,2,1,Agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,2,4,5,3,1,1,Agree,Strongly agree,Agree,Strongly Disagree,Somewhat Agree,2,4,3,1,5,1,Disagree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,2,1,3,5,4,1,Agree,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,2,1,3,4,1,Agree,Strongly agree,Strongly agree,Disagree,Somewhat Agree,1,5,3,4,2,1,Disagree,Strongly agree,Strongly agree,Strongly agree,Disagree,2,3,4,5,1,1,Agree,Somewhat agree,Strongly agree,Somewhat agree,Somewhat disagree,4,1,2,5,3,0,Agree,Strongly agree,Strongly agree,Strongly Disagree,Somewhat Agree,5,4,3,1,2,1,Disagree,Agree,Agree,Strongly agree,Strongly disagree,1,3,2,5,4,1,Agree,Agree,Strongly agree,Agree,Somewhat disagree,5,4,3,1,2,1,Agree,Strongly agree,Strongly agree,Strongly Disagree,Somewhat Agree,5,3,4,2,1,1,1,1,2,-1,0,1,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),73,03VPfPs,02FUT,10,02DGEN,0.25,0.666666667,0.333333333,6,7,5,8,9,4,3,1,2,4,3,2,1,-2,2,2,1,-1,3,1,3,1,1,2,3,3,-2,1,-2,2,2,-1,-2,2,1,3,1,-1,2,3,2,-3,1,-2,2,2,-1,0,2,1,3,1,0,2,3,3,-2,1,-2,3,3,3,-2,2,1,3,1,-1,2,3,3,-3,1,-2,2,2,3,-3,2,2,3,2,-1,2,3,3,-3,1,1,1,1,1,1,1,1,1,0,1,1,1 +R_6D7AAGi8XfqcB7w,32 - 38,American,Female,Agree,Agree,Agree,Somewhat agree,Strongly agree,2,1,4,3,5,Strongly disagree,Strongly disagree,Agree,Strongly agree,Neither agree nor disagree,4,1,2,3,5,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,5,1,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Agree,Agree,Somewhat agree,Agree,4,2,1,3,5,0,Strongly disagree,Strongly disagree,Agree,Strongly agree,Neither agree nor disagree,4,5,3,1,2,1,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,3,1,4,2,5,2,Agree,Agree,Agree,Agree,Somewhat agree,1,3,2,5,4,0,Strongly disagree,Strongly disagree,Agree,Strongly agree,Neither agree nor disagree,1,4,5,2,3,7,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,5,1,3,2,1,Agree,Agree,Agree,Somewhat agree,Agree,3,5,2,4,1,1,Strongly disagree,Strongly disagree,Agree,Somewhat agree,Neither agree nor disagree,4,2,3,1,5,0,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,5,1,2,4,2,Agree,Agree,Agree,Neither agree nor disagree,Agree,4,2,1,3,5,2,Strongly disagree,Disagree,Agree,Agree,Neither agree nor disagree,5,1,4,3,2,1,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,4,2,5,1,3,1,2,1,2,0,1,2,-2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),38,01PfPsV,01PAST,10,02DGEN,-0.375,0,1,6,4,5,7,3,9,8,1,2,3,2,4,1,2,2,2,1,3,-3,-3,2,3,0,1,0,0,1,1,2,2,2,1,2,-3,-3,2,3,0,1,0,0,1,1,2,2,2,2,1,-3,-3,2,3,0,1,0,0,1,1,2,2,2,1,2,-3,-3,2,1,0,1,0,1,0,1,2,2,2,0,2,-3,-2,2,2,0,1,1,0,-1,1,0,0,1,2,0,7,1,1,0,2,2,1 +R_5CBBrH7qOkchQSU,53 - 59,American,Female,Agree,Strongly agree,Strongly agree,Disagree,Disagree,2,3,4,1,5,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,2,1,4,3,Strongly Agree,Somewhat Agree,Agree,Agree,Strongly Agree,2,1,5,3,4,Strongly agree,Strongly agree,Strongly agree,Disagree,Disagree,5,2,4,1,3,1,Agree,Strongly disagree,Agree,Disagree,Agree,2,5,3,1,4,1,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,3,1,4,1,Agree,Agree,Strongly agree,Disagree,Disagree,3,1,4,2,5,1,Agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,5,4,3,1,2,1,Strongly agree,Agree,Agree,Agree,Agree,3,1,5,4,2,2,Agree,Strongly agree,Agree,Agree,Strongly agree,1,2,3,4,5,1,Strongly agree,Agree,Agree,Agree,Agree,2,4,3,1,5,1,Strongly agree,Agree,Agree,Somewhat Agree,Strongly agree,4,3,5,1,2,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Disagree,2,3,1,4,5,1,Agree,Disagree,Agree,Disagree,Agree,1,2,5,3,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,4,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-1,-1,-1,1,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),59,03VPfPs,01PAST,10,01ITEM,1,0.333333333,0.666666667,7,8,3,2,9,6,5,1,4,4,2,3,1,2,3,3,-2,-2,2,-3,3,-3,1,3,1,2,2,3,3,3,3,-2,-2,2,-3,2,-2,2,1,0,1,1,1,2,2,3,-2,-2,2,-3,3,-2,1,3,2,2,2,2,2,3,2,2,3,3,2,2,2,2,3,2,2,1,3,3,3,3,-2,-2,2,-2,2,-2,2,3,3,3,3,3,1,1,1,1,1,2,1,1,2,1,1,1 +R_3OvH2dSZs2LsOTD,67 - 73,American,Male,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,1,2,3,4,5,Agree,Disagree,Agree,Disagree,Agree,5,2,3,4,1,Agree,Agree,Agree,Disagree,Agree,2,5,4,3,1,Somewhat agree,Strongly agree,Strongly agree,Disagree,Somewhat agree,3,4,2,5,1,5,Agree,Disagree,Agree,Disagree,Agree,1,3,4,5,2,5,Agree,Agree,Agree,Disagree,Agree,3,1,4,2,5,5,Somewhat agree,Strongly agree,Agree,Disagree,Somewhat agree,2,4,1,3,5,5,Agree,Disagree,Agree,Disagree,Agree,4,5,3,2,1,5,Agree,Agree,Agree,Disagree,Agree,3,2,1,5,4,5,Somewhat agree,Strongly agree,Strongly agree,Disagree,Somewhat agree,1,5,3,2,4,5,Agree,Disagree,Agree,Disagree,Agree,5,2,4,3,1,5,Agree,Agree,Agree,Disagree,Agree,3,5,4,2,1,5,Somewhat agree,Strongly agree,Strongly agree,Disagree,Somewhat agree,2,5,1,4,3,5,Agree,Disagree,Agree,Disagree,Agree,5,3,1,4,2,5,Agree,Agree,Agree,Disagree,Agree,1,5,4,3,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,-2,1,2,-1,2,2,0,10 cents,100 minutes,24 days,Male,Trade School (non-military),72,02PsVPf,01PAST,10,01ITEM,-1,0,1,3,9,8,5,7,4,2,1,6,2,4,3,1,1,3,3,-1,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,2,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,1,3,3,-2,1,2,-2,2,-2,2,2,2,2,-2,2,5,5,5,5,5,5,5,5,5,5,5,5 +R_1q8TVZ4f8FHZQzc,53 - 59,American,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,2,5,3,1,Disagree,Agree,Strongly agree,Strongly disagree,Strongly agree,4,3,1,5,2,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Strongly agree,Agree,Agree,Strongly agree,2,3,5,1,4,7,Somewhat agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,5,2,4,3,1,0,Strongly agree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,1,4,5,2,3,5,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,2,1,5,3,4,6,Agree,Somewhat disagree,Strongly agree,Strongly disagree,Strongly agree,1,3,5,2,4,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,4,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,5,2,1,4,3,8,Disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,4,3,5,2,1,0,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,3,1,2,5,5,Agree,Agree,Agree,Strongly agree,Strongly agree,5,3,1,2,4,4,Strongly disagree,Strongly agree,Agree,Disagree,Agree,4,5,1,3,2,0,Agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,4,5,1,2,3,1,2,2,2,2,2,2,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),54,02PsVPf,02FUT,5,02DGEN,-0.25,0,1,4,3,2,6,8,7,9,1,5,4,3,2,1,2,3,3,1,3,-2,2,3,-3,3,3,-3,3,-3,3,2,3,2,2,3,1,1,3,-3,3,3,-3,3,1,3,3,3,1,1,3,2,-1,3,-3,3,3,-3,3,3,3,1,3,2,2,3,-2,3,3,-3,3,2,-3,3,-3,3,2,2,2,3,3,-3,3,2,-2,2,2,-3,2,-3,3,3,7,0,5,6,0,4,8,0,5,4,0 +R_1iRvwVfXaAMLuPn,46 - 52,American,Male,Agree,Agree,Strongly agree,Agree,Disagree,5,4,2,1,3,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,4,1,3,2,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,5,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Agree,Agree,Agree,Disagree,2,5,3,4,1,4,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,3,2,4,4,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,3,5,4,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,1,2,3,5,4,7,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,2,4,3,7,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,3,5,1,2,8,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,8,Disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly agree,2,4,3,5,1,6,Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,1,5,3,6,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,4,2,5,3,10,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,1,4,2,3,5,9,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly agree,1,3,2,5,4,1,1,2,1,0,0,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),50,02PsVPf,02FUT,5,02DGEN,0.375,0,1,9,8,7,6,3,5,4,1,2,3,4,2,1,2,2,3,2,-2,-2,0,2,0,2,0,1,2,0,3,2,2,2,2,-2,-1,1,1,0,1,0,1,2,0,2,1,1,1,1,-2,-1,2,1,1,1,0,1,2,0,2,3,3,1,0,0,-2,-1,1,-1,3,-2,1,2,0,3,3,3,1,1,0,0,-1,2,-1,3,0,1,2,0,3,6,4,4,6,7,7,8,8,6,6,10,9 +R_1iP5RCoXNQ1O3r7,67 - 73,American,Male,Agree,Agree,Agree,Agree,Agree,5,1,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,3,2,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,3,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Agree,Agree,4,3,2,1,5,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,4,3,4,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,4,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,4,5,1,3,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,3,5,4,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,2,3,1,5,4,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,2,1,4,3,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,2,5,4,Somewhat agree,Agree,Agree,Agree,Somewhat agree,3,2,5,1,4,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,5,1,2,3,4,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,5,4,0,1,1,1,-1,1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),73,03VPfPs,01PAST,5,02DGEN,0.125,0,1,9,3,5,7,8,4,2,1,6,3,2,4,1,2,2,2,2,2,0,0,2,1,1,3,3,3,3,3,2,2,2,2,2,0,-1,1,0,1,3,3,3,3,3,2,2,2,2,2,1,-1,2,0,1,3,3,3,3,3,1,1,2,1,1,0,-1,3,-1,0,3,3,3,3,3,1,2,2,2,1,0,-1,1,-1,-1,3,3,3,3,3,2,3,6,4,4,3,4,4,3,4,4,4 +R_1A7vesKafsefMtz,60 - 66,American,Female,Strongly agree,Strongly agree,Agree,Disagree,Strongly disagree,2,4,3,5,1,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,2,3,5,4,1,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,2,5,3,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Disagree,3,2,1,5,4,6,Strongly disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,4,2,3,5,7,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,5,2,1,4,3,3,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat agree,4,5,3,1,2,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,3,5,4,2,1,1,Agree,Strongly agree,Agree,Somewhat Agree,Strongly agree,3,4,2,5,1,6,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly disagree,2,5,4,1,3,0,Strongly disagree,Strongly disagree,Neither agree nor disagree,Disagree,Somewhat disagree,1,2,4,3,5,2,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,2,4,5,3,1,1,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Strongly disagree,3,4,2,5,1,1,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,3,4,2,5,1,2,Agree,Agree,Strongly agree,Somewhat Agree,Strongly agree,3,4,1,2,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,0,2,0,0,0,2,10 cents,75 minutes,24 days,Female,University - Graduate (Masters),65,03VPfPs,01PAST,5,01ITEM,0.125,0,0.666666667,5,4,3,7,8,2,6,1,9,3,2,4,1,3,3,2,-2,-3,-3,-3,2,-3,0,1,2,2,0,3,3,3,3,1,-2,-3,-3,3,0,1,2,2,2,0,3,3,3,3,2,1,-3,-3,3,-3,1,2,3,2,1,3,3,3,3,0,-3,-3,-3,0,-2,-1,0,2,2,0,3,3,3,2,0,-3,-3,-3,2,-3,0,2,2,3,1,3,6,7,3,2,1,6,0,2,1,1,2,1 +R_7GCFonsZvAHmC8J,67 - 73,American,Male,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Agree,3,5,4,2,1,Somewhat agree,Agree,Strongly agree,Strongly disagree,Agree,5,3,1,4,2,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Agree,1,2,3,4,5,1,Agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,2,4,1,5,3,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,2,4,5,1,3,1,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Agree,4,2,3,5,1,1,Somewhat agree,Somewhat agree,Strongly agree,Strongly disagree,Agree,5,4,2,1,3,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,4,1,1,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Agree,1,4,3,2,5,1,Agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,3,5,2,4,1,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,4,5,2,3,1,2,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Agree,2,4,1,3,5,1,Agree,Somewhat agree,Strongly agree,Strongly disagree,Somewhat agree,1,5,2,3,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,1,5,3,4,2,1,1,0,1,-1,0,1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),71,01PfPsV,02FUT,10,02DGEN,0.25,0,1,7,6,2,5,3,9,8,1,4,2,3,4,1,3,2,0,3,2,1,2,3,-3,2,3,2,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,3,2,0,3,2,1,1,3,-3,2,3,3,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,3,2,0,3,2,2,1,3,-3,1,3,3,3,1,3,1,1,1,1,1,1,1,1,1,2,1,1 +R_7oA8EmXF8TtRoml,60 - 66,American,Male,Strongly disagree,Agree,Strongly agree,Strongly disagree,Agree,2,3,5,1,4,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Disagree,3,4,5,2,1,Strongly Agree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,4,5,1,Strongly disagree,Agree,Strongly agree,Strongly disagree,Agree,4,5,3,1,2,0,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly disagree,5,4,1,3,2,0,Strongly agree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,2,3,4,5,0,Strongly disagree,Agree,Strongly agree,Strongly disagree,Agree,3,2,5,4,1,0,Strongly disagree,Agree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,3,1,5,4,0,Strongly agree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,4,3,2,1,0,Strongly disagree,Agree,Strongly agree,Strongly disagree,Agree,3,4,1,5,2,0,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly disagree,4,5,2,3,1,0,Strongly agree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly agree,1,4,5,3,2,5,Strongly disagree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,1,4,3,5,1,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly disagree,4,3,1,5,2,0,Strongly agree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly agree,3,2,1,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,1,1,2,0,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,65,03VPfPs,01PAST,5,01ITEM,-0.5,0.666666667,0.333333333,3,9,4,8,7,2,5,1,6,3,2,4,1,-3,2,3,-3,2,-3,1,3,-3,-2,3,-3,3,0,3,-3,2,3,-3,2,-3,1,3,-3,-3,3,-3,3,0,3,-3,2,3,-3,2,-3,2,3,-3,0,3,-3,3,0,3,-3,2,3,-3,2,-3,1,3,-3,-3,3,-3,-3,-3,3,-3,2,3,0,1,-3,1,3,-3,-3,3,-3,-3,-3,3,0,0,0,0,0,0,0,0,5,1,0,3 +R_1wME4EFMQlwms1U,67 - 73,American,Male,Agree,Disagree,Somewhat agree,Disagree,Somewhat agree,5,1,2,4,3,Disagree,Disagree,Strongly agree,Disagree,Neither agree nor disagree,3,5,1,4,2,Agree,Somewhat Agree,Agree,Disagree,Agree,4,5,3,2,1,Agree,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,4,1,5,3,2,3,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,3,1,4,2,5,3,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,5,3,1,2,4,3,Agree,Disagree,Neither agree nor disagree,Strongly disagree,Agree,5,1,3,2,4,3,Neither agree nor disagree,Disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,2,4,3,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,2,4,3,5,3,Agree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,4,1,2,5,2,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,5,3,2,4,2,Agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,1,2,4,5,3,2,Agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,3,4,5,2,1,2,Disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,3,4,5,1,2,2,Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Agree,1,2,4,3,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,1,2,0,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,02PsVPf,02FUT,10,01ITEM,0.125,1,0,6,7,3,8,5,2,4,1,9,4,3,2,1,2,-2,1,-2,1,-2,-2,3,-2,0,2,1,2,-2,2,2,-2,0,-3,1,0,-1,2,-1,1,2,1,2,-1,2,2,-2,0,-3,2,0,-2,2,0,0,2,1,1,0,2,2,-2,1,-1,0,0,-2,2,-1,0,2,1,1,-2,2,2,-3,1,0,-1,-2,0,2,0,-1,2,1,1,-3,2,3,3,3,3,3,3,2,2,2,2,2,1 +R_1eRG5DfSgi9GUaO,67 - 73,American,Male,Somewhat agree,Agree,Somewhat agree,Strongly disagree,Strongly agree,2,5,3,4,1,Strongly agree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,1,2,5,4,3,Strongly Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,5,2,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat disagree,Somewhat disagree,Agree,Strongly disagree,Strongly agree,5,4,3,2,1,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,5,1,3,2,1,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,Agree,1,3,4,2,5,1,Somewhat disagree,Somewhat disagree,Agree,Strongly disagree,Strongly agree,3,4,1,5,2,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,2,3,4,1,1,Agree,Neither Agree nor Disagree,Strongly agree,Agree,Agree,4,5,1,2,3,1,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,3,2,4,5,1,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,4,3,5,2,1,1,Strongly agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,3,1,4,2,Somewhat agree,Agree,Agree,Agree,Strongly agree,2,4,3,1,5,3,Agree,Disagree,Agree,Disagree,Somewhat disagree,5,4,1,3,2,1,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Strongly agree,4,3,2,1,5,0,1,-2,2,2,-1,1,-1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),67,03VPfPs,01PAST,10,02DGEN,-0.75,1,0,2,3,4,8,9,7,5,1,6,4,2,3,1,1,2,1,-3,3,3,-2,3,-3,1,3,1,3,0,2,-1,-1,2,-3,3,3,-3,3,-3,2,3,1,3,3,2,-1,-1,2,-3,3,3,-3,3,-3,2,2,0,3,2,2,0,2,2,0,3,2,-3,3,-3,-1,3,1,3,0,3,1,2,2,2,3,2,-2,2,-2,-1,3,1,3,-1,3,1,1,1,1,2,1,1,1,1,2,3,1 +R_6H0gQH94g701rde,67 - 73,American,Male,Strongly agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,1,4,5,3,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,5,3,4,2,1,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,5,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Strongly agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,1,4,3,5,2,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,2,5,3,4,1,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,4,3,1,2,Strongly agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,1,3,4,5,2,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,3,2,5,4,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,4,3,5,2,Agree,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,4,3,2,1,5,2,Somewhat agree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,2,5,1,4,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,3,5,4,2,2,Agree,Somewhat agree,Agree,Disagree,Neither agree nor disagree,1,2,5,3,4,2,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,2,4,3,5,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,2,5,4,0,1,0,1,-1,0,1,-1,10 cents,5 minutes,47 days,Male,College Diploma/Certificate,72,01PfPsV,01PAST,5,02DGEN,-0.125,0.666666667,0.333333333,9,4,6,8,5,3,7,1,2,4,3,2,1,3,1,2,-2,0,1,-2,1,-2,0,2,1,1,1,1,3,1,2,-2,0,1,-2,2,-2,1,2,1,1,1,1,3,1,2,-2,0,1,-2,1,-2,1,2,1,1,1,1,2,1,2,-1,0,1,-2,1,-2,0,2,1,1,1,1,2,1,2,-2,0,0,-2,1,-2,0,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2 +R_1bOYJHrIvhA1qkI,60 - 66,American,Male,Agree,Agree,Agree,Somewhat disagree,Neither agree nor disagree,2,1,3,5,4,Somewhat agree,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,5,4,2,3,Strongly Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,3,5,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,3,2,5,Somewhat agree,Agree,Agree,Somewhat disagree,Somewhat disagree,2,1,3,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,2,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,4,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,3,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,1,5,3,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,60,01PfPsV,01PAST,10,02DGEN,0,0,1,4,6,5,2,8,3,7,1,9,3,4,2,1,2,2,2,-1,0,1,-2,1,1,-1,3,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5 +R_6YJaPA1qoviEfuh,53 - 59,Canadian,Male,Somewhat disagree,Agree,Agree,Somewhat disagree,Agree,2,4,5,3,1,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,2,4,3,5,1,Agree,Agree,Agree,Agree,Agree,1,5,2,4,3,Somewhat disagree,Agree,Agree,Somewhat disagree,Agree,5,3,1,2,4,1,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,4,1,2,5,3,2,Agree,Agree,Agree,Somewhat Agree,Agree,5,1,4,2,3,1,Somewhat disagree,Agree,Agree,Somewhat agree,Agree,1,4,5,2,3,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,4,5,2,1,3,2,Agree,Agree,Agree,Somewhat Agree,Agree,1,4,2,5,3,2,Somewhat disagree,Agree,Agree,Somewhat disagree,Agree,5,1,2,4,3,1,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,5,1,3,2,4,2,Agree,Agree,Agree,Somewhat Agree,Agree,5,1,3,4,2,8,Somewhat disagree,Agree,Agree,Somewhat disagree,Agree,4,2,1,5,3,1,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,1,2,5,3,4,1,Agree,Agree,Agree,Somewhat Agree,Agree,3,1,2,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,1,1,0,1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),55,03VPfPs,02FUT,5,01ITEM,0.25,0,1,9,7,6,3,4,5,8,1,2,3,4,2,1,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,2,2,-1,2,2,-1,2,2,-1,1,1,2,2,2,2,1,2,-1,2,2,1,2,1,-1,1,1,2,2,2,2,1,2,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,1,2,-1,2,2,-1,2,1,-1,2,1,2,2,2,2,1,2,1,2,1,2,2,2,1,2,8,1,1,2 +R_5cv0dxIpYqsp6ac,25 - 31,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,3,4,2,5,1,Agree,Strongly disagree,Agree,Somewhat disagree,Somewhat agree,4,5,3,2,1,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,5,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,2,1,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,3,1,4,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,5,1,4,8,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,8,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,1,2,5,8,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,4,2,5,1,7,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,2,3,5,1,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,4,3,8,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,8,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,4,2,5,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,-1,-1,-1,-2,1,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,26,02PsVPf,02FUT,5,01ITEM,1,0.333333333,0.666666667,5,7,9,4,6,8,3,1,2,2,4,3,1,1,1,1,2,1,2,-3,2,-1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,8,8,8,8,8,8,8,7,7,8,8,8 +R_79XB8gz2JC1iSnD,53 - 59,American,Female,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,2,3,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,2,5,3,4,Somewhat Disagree,Disagree,Agree,Disagree,Strongly Agree,2,1,3,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat agree,Somewhat agree,Agree,Agree,Strongly agree,4,2,3,5,1,6,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,3,4,1,5,2,6,Somewhat Disagree,Disagree,Agree,Disagree,Strongly agree,3,1,4,2,5,6,Agree,Agree,Agree,Agree,Strongly agree,2,3,4,1,5,6,Neither agree nor disagree,Agree,Disagree,Strongly agree,Somewhat agree,4,5,3,1,2,6,Somewhat Disagree,Disagree,Agree,Disagree,Strongly agree,4,2,5,3,1,6,Agree,Somewhat agree,Agree,Agree,Strongly agree,5,1,4,2,3,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,1,4,2,5,6,Somewhat Disagree,Neither Agree nor Disagree,Agree,Disagree,Strongly agree,3,2,1,5,4,6,Somewhat agree,Somewhat agree,Agree,Agree,Agree,1,2,4,5,3,6,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,2,4,1,5,6,Somewhat Disagree,Somewhat Disagree,Agree,Disagree,Strongly agree,3,1,4,2,5,1,2,2,2,1,2,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,55,02PsVPf,02FUT,10,02DGEN,-0.125,0,1,2,9,4,5,7,8,3,1,6,4,3,2,1,2,2,3,3,3,1,-1,0,-1,1,-1,-2,2,-2,3,1,1,2,2,3,0,-1,-1,0,1,-1,-2,2,-2,3,2,2,2,2,3,0,2,-2,3,1,-1,-2,2,-2,3,2,1,2,2,3,-1,1,-1,1,-1,-1,0,2,-2,3,1,1,2,2,2,-1,1,0,1,-1,-1,-1,2,-2,3,6,6,6,6,6,6,6,6,6,6,6,6 +R_3JmVHqU1m9lfEVm,60 - 66,American,Male,Strongly disagree,Agree,Agree,Somewhat agree,Somewhat agree,1,5,4,2,3,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,1,2,4,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,5,2,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat agree,Agree,Agree,Somewhat agree,Agree,3,4,2,1,5,1,Strongly disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,4,2,3,5,5,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,1,3,5,4,2,1,Somewhat agree,Agree,Agree,Somewhat agree,Agree,2,4,1,3,5,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,2,3,5,1,4,10,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,5,3,4,2,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,3,5,2,1,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,1,2,5,4,3,10,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,5,1,4,2,3,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,1,3,4,10,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,5,3,2,1,4,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,5,4,2,0,1,1,1,1,1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),61,02PsVPf,02FUT,10,02DGEN,-0.125,0,1,4,7,2,5,8,3,6,1,9,3,2,4,1,-3,2,2,1,1,-2,0,-1,1,-1,0,1,1,-1,0,1,2,2,1,2,-3,1,3,0,1,0,1,2,1,0,1,2,2,1,2,-3,-3,-3,-3,-3,1,1,1,1,0,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,0,0,0,0,0,-3,-3,-3,-3,-3,0,0,0,0,0,1,1,5,1,10,10,10,10,10,10,10,10 +R_7ocpEFQBuIkFrQi,53 - 59,Canadian,Male,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat disagree,5,3,1,2,4,Somewhat disagree,Somewhat disagree,Agree,Disagree,Neither agree nor disagree,5,3,1,4,2,Strongly Agree,Somewhat Disagree,Agree,Disagree,Strongly Agree,3,2,1,5,4,Agree,Agree,Agree,Somewhat agree,Somewhat disagree,1,4,2,3,5,1,Disagree,Disagree,Agree,Disagree,Somewhat disagree,4,1,2,5,3,1,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,2,5,1,3,4,1,Somewhat agree,Agree,Agree,Somewhat agree,Disagree,2,5,3,4,1,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat disagree,1,4,2,3,5,1,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,4,5,1,2,3,1,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,4,5,2,3,1,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,3,4,2,1,5,3,Strongly agree,Somewhat Disagree,Agree,Disagree,Strongly agree,4,1,5,3,2,1,Agree,Agree,Agree,Somewhat agree,Agree,3,4,1,2,5,3,Disagree,Disagree,Agree,Disagree,Somewhat agree,3,4,1,2,5,2,Strongly agree,Somewhat Disagree,Somewhat Agree,Disagree,Strongly agree,4,2,5,3,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,2,-1,1,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,57,03VPfPs,01PAST,5,01ITEM,0.125,0,1,2,3,4,9,7,6,8,1,5,4,3,2,1,1,2,2,1,-1,-1,-1,2,-2,0,3,-1,2,-2,3,2,2,2,1,-1,-2,-2,2,-2,-1,3,-1,2,-2,3,1,2,2,1,-2,-1,-2,2,-2,-1,3,-1,2,-2,3,1,2,2,1,1,-1,-2,2,-2,1,3,-1,2,-2,3,2,2,2,1,2,-2,-2,2,-2,1,3,-1,1,-2,3,1,1,1,1,1,1,1,3,1,3,2,3 +R_714uyMPUcPfFZlz,46 - 52,American,Female,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,4,5,3,2,1,Agree,Disagree,Agree,Disagree,Somewhat agree,1,2,3,5,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,1,5,3,Somewhat agree,Agree,Agree,Disagree,Strongly agree,5,1,3,4,2,2,Strongly agree,Disagree,Strongly agree,Disagree,Somewhat agree,2,5,3,1,4,2,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Somewhat Agree,2,5,3,4,1,2,Agree,Agree,Agree,Disagree,Strongly agree,5,4,2,3,1,2,Strongly agree,Disagree,Strongly agree,Disagree,Somewhat agree,2,3,1,5,4,2,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Somewhat Agree,3,1,4,5,2,2,Agree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,5,2,3,1,4,1,Agree,Disagree,Agree,Disagree,Somewhat agree,1,3,2,4,5,1,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Somewhat Agree,4,3,5,2,1,1,Agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,2,1,4,3,5,1,Agree,Disagree,Agree,Disagree,Somewhat agree,3,5,1,2,4,1,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Disagree,Somewhat Agree,3,5,2,1,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,1,-1,1,0,-1,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,50,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,8,9,7,4,3,6,2,1,5,3,4,2,1,1,1,2,-1,3,2,-2,2,-2,1,1,1,3,0,1,1,2,2,-2,3,3,-2,3,-2,1,1,1,3,-1,1,2,2,2,-2,3,3,-2,3,-2,1,1,1,3,-1,1,2,1,2,-1,3,2,-2,2,-2,1,1,1,3,-1,1,2,1,2,0,3,2,-2,2,-2,1,1,0,3,-2,1,2,2,2,2,2,2,1,1,1,1,1,1 +R_6Axhyikn92aJ8E9,46 - 52,American,Female,Disagree,Agree,Agree,Agree,Somewhat agree,1,2,4,3,5,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,2,5,3,4,Agree,Agree,Agree,Agree,Agree,1,4,3,2,5,Agree,Agree,Disagree,Agree,Agree,2,1,3,4,5,0,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,3,5,2,1,4,0,Agree,Agree,Agree,Agree,Agree,2,1,3,4,5,0,Neither agree nor disagree,Agree,Agree,Agree,Agree,1,5,2,4,3,9,Agree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,2,4,1,3,6,Agree,Agree,Agree,Agree,Agree,1,5,2,3,4,0,Disagree,Agree,Agree,Agree,Agree,2,5,3,4,1,0,Agree,Disagree,Agree,Disagree,Agree,4,5,3,2,1,0,Agree,Agree,Agree,Agree,Agree,1,2,3,5,4,0,Neither agree nor disagree,Agree,Agree,Agree,Agree,2,3,5,1,4,0,Agree,Agree,Agree,Agree,Agree,2,4,1,3,5,0,Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,1,1,-1,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,50,01PfPsV,01PAST,10,01ITEM,0,0.666666667,0.333333333,8,5,3,4,9,7,2,1,6,3,4,2,1,-2,2,2,2,1,1,-3,3,-3,2,2,2,2,2,2,2,2,-2,2,2,1,-2,2,-2,1,2,2,2,2,2,0,2,2,2,2,2,-2,2,-1,1,2,2,2,2,2,-2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,9,6,0,0,0,0,0,0,0 +R_3QXCqXz1NiFkRBH,53 - 59,American,Male,Agree,Agree,Agree,Somewhat agree,Strongly agree,4,5,2,3,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,Agree,Strongly Agree,Agree,Somewhat Agree,Strongly Agree,5,3,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,2,4,3,5,1,1,Somewhat agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,1,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,4,2,3,1,1,Agree,Agree,Agree,Disagree,Strongly agree,3,4,5,1,2,2,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,1,Agree,Strongly agree,Agree,Agree,Agree,3,4,5,1,2,1,Agree,Agree,Strongly agree,Agree,Strongly agree,2,4,5,3,1,1,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,2,4,3,1,Strongly agree,Strongly agree,Agree,Agree,Agree,1,5,3,4,2,1,Agree,Agree,Agree,Strongly agree,Strongly agree,4,3,5,1,2,2,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,5,3,1,4,2,7,Strongly agree,Agree,Agree,Disagree,Agree,3,2,5,4,1,1,1,1,0,-1,0,1,-1,10 cents,100 minutes,24 days,Male,University - Undergraduate,59,01PfPsV,01PAST,10,02DGEN,0.25,0,1,3,7,4,8,5,6,9,1,2,2,3,4,1,2,2,2,1,3,1,0,3,0,0,2,3,2,1,3,2,2,2,0,3,1,1,3,0,0,3,3,3,2,2,2,2,2,-2,3,2,1,3,0,0,2,3,2,2,2,2,2,3,2,3,1,0,3,0,1,3,3,2,2,2,2,2,2,3,3,-1,0,2,0,-2,3,2,2,-2,2,1,1,1,1,2,1,1,1,1,1,2,7 +R_14h1U7357PGdWiR,60 - 66,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,4,5,3,2,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,1,5,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,3,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,2,4,1,3,5,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,1,5,3,2,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,4,2,3,5,1,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,5,2,4,3,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,4,1,3,5,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,1,4,2,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,1,3,4,2,5,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,1,4,3,5,2,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,2,4,5,3,1,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,4,5,3,2,1,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,3,4,2,1,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,2,1,5,3,4,1,1,0,2,0,-2,1,2,10 cents,25 minutes,24 days,Female,University - Undergraduate,65,02PsVPf,02FUT,5,02DGEN,0.375,0,0.666666667,7,3,5,8,9,4,6,1,2,4,3,2,1,1,3,3,-3,3,0,-3,3,-3,0,3,3,3,2,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,1,3,3,-3,3,0,-3,3,-3,0,3,3,3,1,3,1,3,3,-3,3,1,-3,3,-3,1,3,3,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_1JFLLvnXQTDl93D,60 - 66,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat agree,1,4,3,5,2,Disagree,Disagree,Strongly agree,Disagree,Somewhat disagree,4,2,1,5,3,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,4,2,3,1,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,1,5,4,3,2,0,Strongly disagree,Disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,3,4,1,2,2,Agree,Strongly agree,Agree,Somewhat Agree,Strongly agree,2,5,1,3,4,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,2,4,1,5,2,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Neither agree nor disagree,5,4,3,2,1,2,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly agree,3,2,1,4,5,2,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat disagree,5,4,1,2,3,2,Disagree,Strongly disagree,Agree,Disagree,Neither agree nor disagree,4,5,1,2,3,3,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Strongly agree,4,5,1,3,2,2,Strongly agree,Strongly agree,Strongly agree,Agree,Disagree,4,1,5,3,2,2,Disagree,Strongly disagree,Agree,Strongly disagree,Disagree,2,3,1,5,4,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,5,3,4,1,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,2,2,1,0,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),66,01PfPsV,01PAST,10,01ITEM,-0.125,0,1,3,8,5,4,7,6,9,1,2,3,2,4,1,3,3,2,1,1,-2,-2,3,-2,-1,2,1,2,0,3,3,3,3,-1,2,-3,-2,3,-3,0,2,3,2,1,3,3,3,3,-2,3,-3,-3,3,-2,0,2,2,1,1,3,3,3,3,2,-1,-2,-3,2,-2,0,3,3,1,-3,3,3,3,3,2,-2,-2,-3,2,-3,-2,3,3,3,-2,3,0,2,2,2,2,2,2,3,2,2,2,2 +R_1NPt7vKUcOhfvbj,60 - 66,American,Male,Somewhat agree,Agree,Strongly agree,Agree,Agree,5,2,4,3,1,Disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,2,4,5,1,3,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,5,2,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat agree,Agree,Strongly agree,Agree,Agree,5,2,4,1,3,1,Disagree,Disagree,Agree,Disagree,Somewhat agree,5,4,2,1,3,1,Agree,Disagree,Somewhat Agree,Somewhat Disagree,Agree,5,2,4,3,1,1,Somewhat agree,Agree,Strongly agree,Agree,Agree,4,3,2,1,5,1,Disagree,Disagree,Agree,Disagree,Somewhat agree,3,5,2,4,1,1,Agree,Disagree,Agree,Somewhat Disagree,Agree,5,2,1,3,4,1,Somewhat agree,Agree,Strongly agree,Agree,Agree,1,4,3,5,2,1,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,1,3,2,4,1,Agree,Disagree,Agree,Somewhat Disagree,Agree,3,4,1,5,2,1,Somewhat agree,Agree,Strongly agree,Agree,Agree,3,2,5,1,4,1,Disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,5,1,4,3,1,Agree,Agree,Agree,Somewhat Disagree,Agree,1,3,2,5,4,1,1,2,1,1,1,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,60,03VPfPs,02FUT,5,02DGEN,-0.125,0,1,7,9,3,4,2,8,6,1,5,4,3,2,1,1,2,3,2,2,-2,-2,2,0,1,2,-1,2,0,2,1,2,3,2,2,-2,-2,2,-2,1,2,-2,1,-1,2,1,2,3,2,2,-2,-2,2,-2,1,2,-2,2,-1,2,1,2,3,2,2,-1,-2,2,-1,1,2,-2,2,-1,2,1,2,3,2,2,-2,-2,2,-1,1,2,2,2,-1,2,1,1,1,1,1,1,1,1,1,1,1,1 +R_1wFFhetYJMzKoxU,60 - 66,American,Female,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,2,3,5,4,Agree,Strongly disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,3,4,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,2,1,5,4,0,Strongly agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,1,4,5,2,3,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,1,5,2,4,5,Agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,3,4,2,1,0,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,5,2,4,1,3,0,Strongly agree,Strongly agree,Agree,Disagree,Strongly agree,1,2,5,4,3,0,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,2,1,5,3,0,Strongly agree,Disagree,Strongly agree,Disagree,Agree,3,2,1,4,5,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,2,1,4,5,3,0,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,5,4,1,3,0,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Agree,4,2,5,3,1,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,3,5,1,2,4,1,1,-1,1,-1,-1,-1,0,5 cents,100 minutes,24 days,Female,Trade School (non-military),65,03VPfPs,01PAST,10,02DGEN,0.375,0.333333333,0.666666667,3,8,6,7,2,4,5,1,9,4,2,3,1,1,3,3,-1,3,2,-3,2,0,0,3,3,3,-1,3,2,3,3,-2,3,3,-3,3,-2,3,3,3,3,-2,3,2,3,3,-3,3,3,-3,3,-1,2,3,3,2,-2,3,2,3,3,1,3,3,-2,3,-2,2,3,3,3,-2,3,2,3,3,1,3,3,-3,3,0,2,3,3,3,-2,3,0,0,0,5,0,0,0,0,0,0,0,0 +R_71SLT2EoKV0x4Aj,60 - 66,American,Female,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,2,5,3,1,Strongly Agree,Somewhat Agree,Agree,Strongly Disagree,Strongly Agree,4,1,5,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,5,3,4,1,2,0,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,4,5,2,3,0,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,5,2,3,4,1,0,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,1,4,2,5,3,0,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,2,4,3,5,1,0,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,4,2,5,1,3,0,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,4,3,1,2,5,0,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,3,2,5,1,0,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,1,3,5,2,4,0,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,1,2,5,3,4,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Neither agree nor disagree,4,3,2,5,1,1,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,4,1,3,2,5,0,1,0,2,0,0,1,-2,10 cents,5 minutes,47 days,Female,High School (or equivalent),64,02PsVPf,02FUT,5,02DGEN,-0.5,0.666666667,0.333333333,3,5,4,8,2,6,7,1,9,3,4,2,1,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,1,3,1,2,-3,3,3,1,3,-3,3,1,-3,2,-3,0,3,2,2,-3,3,0,0,0,0,0,0,0,0,0,0,1,1 +R_5kqfBd1P2L3IaYV,53 - 59,American,Male,Agree,Agree,Agree,Somewhat agree,Agree,5,3,1,4,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,5,1,2,3,4,Somewhat Agree,Disagree,Strongly Agree,Somewhat Disagree,Agree,2,4,1,5,3,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,2,4,1,3,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,2,5,3,1,4,2,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,1,4,2,5,3,2,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,2,1,3,4,2,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,1,5,4,3,3,Somewhat Agree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,3,1,5,4,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,1,2,3,5,4,2,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,3,1,5,4,2,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,3,5,1,4,2,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,5,2,3,4,1,2,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,4,5,2,3,2,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,2,1,5,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,2,2,2,2,2,2,10 cents,5 minutes,47 days,Male,University - Undergraduate,55,01PfPsV,01PAST,10,01ITEM,-0.25,0.666666667,0.333333333,6,3,5,7,8,9,4,1,2,2,4,3,1,2,2,2,1,2,-1,0,1,0,2,1,-2,3,-1,2,2,3,3,1,2,0,0,-1,-1,1,-1,1,0,0,-1,3,3,3,2,2,-3,1,2,1,1,1,-3,3,-1,3,-1,0,-1,0,1,0,1,1,0,-1,-1,0,-1,1,0,0,0,-1,1,-1,1,-1,0,0,1,0,1,0,1,-1,2,2,2,2,3,2,2,2,2,2,2,2 +R_7loY0RLgfCyRn3W,60 - 66,American,Male,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,3,2,5,4,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,1,3,4,2,5,Agree,Agree,Strongly Agree,Disagree,Strongly Agree,4,3,5,2,1,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,2,3,1,4,3,Strongly disagree,Disagree,Disagree,Disagree,Strongly disagree,2,1,4,3,5,3,Agree,Agree,Agree,Disagree,Strongly agree,4,5,1,3,2,3,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,4,5,3,1,2,3,Disagree,Disagree,Agree,Disagree,Disagree,3,5,2,1,4,3,Agree,Agree,Agree,Disagree,Strongly agree,1,5,2,4,3,3,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,2,4,3,1,9,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Disagree,2,5,4,3,1,9,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,3,5,1,9,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,4,5,3,1,9,Strongly disagree,Strongly disagree,Strongly agree,Disagree,Strongly disagree,2,4,1,3,5,9,Agree,Agree,Strongly agree,Disagree,Strongly agree,1,4,3,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,1,1,-1,1,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),60,01PfPsV,02FUT,5,01ITEM,0.125,0.666666667,0.333333333,8,5,9,6,2,4,7,1,3,2,3,4,1,1,1,2,-1,1,-3,-3,3,-3,-1,2,2,3,-2,3,1,1,2,0,1,-3,-2,-2,-2,-3,2,2,2,-2,3,1,1,2,0,1,-2,-2,2,-2,-2,2,2,2,-2,3,1,1,2,0,1,-3,-3,3,-2,-2,2,3,3,2,3,1,1,2,0,1,-3,-3,3,-2,-3,2,2,3,-2,3,3,3,3,3,3,3,9,9,9,9,9,3 +R_1jSNeu0aXROLpUk,60 - 66,American,Male,Disagree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,1,5,3,2,4,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,5,1,2,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Disagree,Strongly agree,Strongly agree,Agree,Somewhat agree,5,4,2,1,3,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,4,2,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,5,3,0,Disagree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,4,1,3,5,2,1,Agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,2,1,4,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,3,5,0,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,3,1,5,4,0,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Agree,5,2,3,1,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,3,4,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,5,2,1,3,1,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,4,3,2,1,5,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,2,5,1,4,3,0,-1,-1,2,0,1,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),65,02PsVPf,02FUT,10,02DGEN,-0.75,0,1,7,4,5,6,2,8,3,1,9,3,4,2,1,-2,3,3,1,1,0,-3,3,-3,1,3,3,3,3,3,-2,3,3,2,1,2,-3,3,-3,2,3,3,3,3,3,-2,3,3,1,1,2,-3,3,-2,3,3,3,3,3,3,0,3,3,3,1,1,-3,3,-2,2,3,3,3,3,3,0,3,3,3,1,1,-3,3,-2,1,3,3,3,1,3,0,0,0,0,1,0,0,0,0,1,1,0 +R_6g6Hw0fkVo1MZsr,60 - 66,American,Male,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,5,2,4,3,Disagree,Agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,5,4,1,2,3,Somewhat Disagree,Neither Agree nor Disagree,Agree,Disagree,Somewhat Disagree,1,5,2,3,4,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat disagree,1,4,5,2,3,2,Disagree,Agree,Agree,Somewhat agree,Somewhat disagree,4,3,1,2,5,2,Somewhat Disagree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Somewhat Disagree,3,4,5,2,1,1,Somewhat disagree,Somewhat agree,Agree,Disagree,Disagree,1,5,3,2,4,2,Somewhat agree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,4,5,3,2,3,Somewhat Disagree,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,2,4,3,5,1,2,Agree,Agree,Agree,Agree,Neither agree nor disagree,4,5,3,1,2,2,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,Disagree,3,4,1,2,5,3,Disagree,Neither Agree nor Disagree,Agree,Disagree,Disagree,4,5,3,2,1,3,Agree,Agree,Strongly agree,Strongly agree,Disagree,4,3,2,5,1,3,Disagree,Agree,Disagree,Somewhat agree,Neither agree nor disagree,1,4,2,3,5,3,Disagree,Neither Agree nor Disagree,Agree,Disagree,Disagree,3,5,2,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,0,1,1,2,0,10 cents,5 minutes,47 days,Male,Trade School (non-military),61,03VPfPs,01PAST,5,01ITEM,0.25,0.666666667,0.333333333,9,8,4,3,7,2,6,1,5,3,4,2,1,2,2,2,1,1,-2,2,0,-2,0,-1,0,2,-2,-1,1,0,2,-1,-1,-2,2,2,1,-1,-1,1,3,0,-1,-1,1,2,-2,-2,1,3,3,2,1,-1,2,3,1,1,2,2,2,2,0,-2,2,-1,0,-2,-2,0,2,-2,-2,2,2,3,3,-2,-2,2,-2,1,0,-2,0,2,-2,-2,2,2,1,2,3,2,2,3,3,3,3,3 +R_7BC4Ahzlq9Jo8PD,60 - 66,American,Female,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,2,3,5,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,5,2,Strongly Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,4,5,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,5,4,1,2,3,6,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,2,4,5,1,5,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,3,1,2,8,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,3,2,4,5,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,4,2,1,5,5,Strongly agree,Somewhat Agree,Somewhat Agree,Agree,Agree,1,2,4,5,3,6,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,4,1,3,5,2,8,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,1,3,5,4,2,5,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,1,5,4,3,2,5,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,3,5,4,1,2,7,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,5,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,5,1,4,2,3,2,1,1,-1,-1,-1,-1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),64,01PfPsV,02FUT,5,02DGEN,1.25,0,1,7,8,6,5,4,9,2,1,3,2,3,4,1,1,3,3,1,1,0,0,1,1,1,3,2,1,0,1,1,3,3,0,2,1,0,0,1,1,3,2,2,0,0,1,3,3,0,1,0,1,1,2,0,3,1,1,2,2,1,3,3,0,2,0,0,2,1,0,3,0,1,1,2,0,3,3,0,2,2,0,1,0,0,2,1,0,2,1,8,6,5,8,7,5,6,8,5,5,7,5 +R_5gqHUOk2VmQVMKl,53 - 59,American,Female,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,4,3,5,2,1,Somewhat disagree,Disagree,Somewhat agree,Disagree,Somewhat agree,1,4,3,5,2,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,2,3,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,4,2,1,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,4,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,1,5,3,2,3,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,2,1,4,5,3,3,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,5,3,4,2,1,3,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,1,3,4,2,5,4,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,2,1,4,3,3,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,1,3,5,2,4,3,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,1,4,5,3,2,3,Somewhat agree,Agree,Agree,Agree,Agree,2,4,3,1,5,3,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,5,3,4,1,3,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,5,4,3,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,1,-1,-1,1,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),56,02PsVPf,01PAST,10,01ITEM,0.25,0.333333333,0.666666667,7,4,8,2,3,6,5,1,9,2,3,4,1,1,2,2,1,1,-1,-2,1,-2,1,2,1,1,0,2,1,1,1,1,1,0,-1,1,0,0,2,1,1,0,2,1,2,2,1,1,0,0,2,0,-1,2,1,1,-1,2,1,2,2,2,1,0,-1,-1,0,-1,2,1,0,-1,2,1,2,2,2,2,1,-2,1,-1,1,2,1,1,0,1,3,4,3,3,3,4,3,3,3,3,3,3 +R_3rxAGcCnccST8MF,60 - 66,American,Male,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,Agree,1,4,2,5,3,Disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,3,4,5,2,Agree,Disagree,Strongly Agree,Disagree,Strongly Agree,5,2,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,3,1,2,5,0,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,1,4,5,3,0,Agree,Disagree,Agree,Disagree,Strongly agree,4,3,2,5,1,0,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,2,5,1,3,0,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,4,5,1,3,2,0,Agree,Disagree,Agree,Disagree,Strongly agree,1,2,5,3,4,0,Somewhat agree,Strongly agree,Strongly agree,Agree,Somewhat agree,3,1,4,5,2,4,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Disagree,4,1,2,3,5,0,Strongly agree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,2,1,4,3,5,4,Somewhat agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,3,1,5,4,2,6,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,4,Strongly agree,Disagree,Agree,Strongly Disagree,Strongly agree,3,4,1,5,2,-1,0,1,2,-1,1,2,1,10 cents,100 minutes,15 days,Male,University - Undergraduate,64,03VPfPs,01PAST,5,02DGEN,-0.375,0,0.666666667,7,4,3,2,6,8,9,1,5,2,4,3,1,0,3,2,1,2,-2,-1,2,-1,0,2,-2,3,-2,3,0,3,2,0,2,0,1,2,1,1,2,-2,2,-2,3,0,3,3,0,3,0,1,2,0,1,2,-2,2,-2,3,1,3,3,2,1,-1,1,2,1,-2,3,-3,2,-3,3,1,3,3,2,0,-2,1,2,1,-1,3,-2,2,-3,3,0,0,0,0,0,0,0,4,0,4,6,4 +R_5q2uxUie94ClQrM,32 - 38,Canadian,Female,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,5,2,4,3,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,2,1,5,4,3,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,2,3,4,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,3,5,2,1,0,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,4,3,2,0,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,5,4,3,2,1,0,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,4,2,5,1,3,0,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,5,1,2,4,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,2,5,3,1,0,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,5,4,3,2,0,Neither agree nor disagree,Agree,Agree,Agree,Strongly agree,4,5,2,3,1,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,4,3,5,2,1,0,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Agree,1,3,4,2,5,0,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,3,5,1,2,4,0,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,5,1,2,4,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,-2,-2,2,2,2,2,-2,10 cents,5 minutes,36 days,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,01ITEM,-2,0.333333333,0.333333333,9,6,4,5,2,3,7,1,8,4,2,3,1,0,1,1,2,1,1,1,0,1,2,1,2,0,1,-1,0,1,1,-1,-1,1,3,1,1,0,1,1,0,1,-1,2,1,1,1,2,1,1,0,1,-1,1,1,1,0,1,0,1,2,1,1,0,2,2,2,3,1,1,1,0,-1,0,1,2,1,2,1,2,-1,0,1,1,-1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0 +R_5oDT6hoqG7XK1jj,18 - 24,Canadian,Male,Agree,Agree,Agree,Agree,Strongly agree,3,5,1,4,2,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,4,2,5,1,3,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,1,2,4,Agree,Agree,Agree,Agree,Agree,5,4,1,3,2,5,Agree,Somewhat agree,Agree,Somewhat agree,Agree,5,3,4,1,2,5,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,2,3,5,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,5,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,3,2,5,1,5,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,5,Agree,Agree,Agree,Agree,Agree,4,3,5,2,1,5,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,2,1,3,4,5,5,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,5,4,5,Agree,Somewhat agree,Agree,Agree,Agree,3,2,4,1,5,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,4,5,3,1,2,5,Agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,2,3,4,5,1,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,1,2,1,-1,-1,1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),20,03VPfPs,02FUT,10,01ITEM,0.375,0,1,5,7,3,8,6,4,9,1,2,4,2,3,1,2,2,2,2,3,1,1,3,1,3,3,2,3,1,3,2,2,2,2,2,2,1,2,1,2,2,2,3,3,3,2,2,2,2,2,1,1,2,1,1,3,2,3,3,3,2,2,2,2,2,1,1,3,1,3,2,2,3,3,3,2,1,2,2,2,1,1,1,1,3,2,1,3,2,3,5,5,5,5,5,5,5,5,5,6,5,6 +R_7flZCQkk99weKhx,60 - 66,American,Female,Strongly agree,Disagree,Agree,Somewhat agree,Strongly disagree,1,2,3,4,5,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,1,5,3,2,4,Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,2,5,3,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat agree,Neither agree nor disagree,Agree,Agree,Strongly disagree,3,2,1,4,5,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,1,3,2,5,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly Disagree,1,4,2,3,5,4,Somewhat disagree,Somewhat agree,Strongly agree,Agree,Strongly disagree,1,4,3,2,5,6,Strongly disagree,Strongly disagree,Agree,Disagree,Disagree,3,5,2,4,1,4,Agree,Agree,Agree,Strongly Disagree,Somewhat Agree,2,5,4,1,3,0,Strongly agree,Disagree,Agree,Somewhat agree,Strongly disagree,5,2,4,3,1,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,2,4,1,5,3,0,Agree,Agree,Strongly agree,Strongly Disagree,Somewhat Agree,5,1,3,2,4,3,Strongly agree,Disagree,Agree,Somewhat agree,Strongly disagree,3,5,1,2,4,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,3,4,1,2,5,0,Agree,Agree,Strongly agree,Strongly Disagree,Somewhat Agree,5,4,1,2,3,-1,1,0,1,-2,-2,1,1,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,65,01PfPsV,02FUT,10,02DGEN,0.375,0.666666667,0.333333333,9,5,4,6,7,3,2,1,8,2,3,4,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,3,3,-3,2,1,0,2,2,-3,-3,-3,3,-3,-3,2,-3,3,-3,-3,-1,1,3,2,-3,-3,-3,2,-2,-2,2,2,2,-3,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,2,3,-3,1,3,-2,2,1,-3,-3,-3,3,-3,-3,2,2,3,-3,1,1,1,1,4,6,4,0,0,0,3,0,0 +R_5Hiu7ZgCiKpda4Y,25 - 31,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,3,2,1,4,5,Strongly agree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,5,3,4,1,2,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,4,2,3,1,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Strongly agree,1,3,5,4,2,10,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Strongly agree,5,3,1,2,4,10,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,4,3,1,2,10,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,4,5,2,1,3,10,Somewhat agree,Disagree,Strongly agree,Disagree,Strongly agree,4,5,2,1,3,10,Somewhat Agree,Somewhat Agree,Agree,Disagree,Strongly agree,4,3,1,2,5,10,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly agree,2,1,3,4,5,10,Agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,5,3,1,2,4,10,Agree,Agree,Strongly agree,Somewhat Disagree,Strongly agree,1,5,4,3,2,10,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,1,3,2,5,4,10,Somewhat agree,Disagree,Strongly agree,Disagree,Strongly agree,2,1,5,3,4,10,Somewhat Agree,Agree,Strongly agree,Disagree,Strongly agree,3,1,5,2,4,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,1,-1,0,1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,01PfPsV,02FUT,10,01ITEM,0.5,0,1,5,6,8,3,7,2,9,1,4,2,3,4,1,3,3,2,1,3,3,-2,3,0,3,3,3,3,-1,3,3,3,-1,-1,3,0,-2,3,-2,3,3,3,3,-1,3,3,3,1,2,3,1,-2,3,-2,3,1,1,2,-2,3,3,3,1,0,3,2,-3,3,-2,3,2,2,3,-1,3,3,3,2,3,3,1,-2,3,-2,3,1,2,3,-2,3,10,10,10,10,10,10,10,10,10,10,10,10 +R_5ds4R46ygys9nWw,32 - 38,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,5,2,4,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,5,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,2,4,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,4,3,5,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,3,1,4,2,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,3,4,1,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,1,4,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,2,4,5,3,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,2,4,5,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,1,3,2,4,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,2,5,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,4,2,3,1,0,0,0,0,0,-1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,35,02PsVPf,01PAST,5,02DGEN,0.375,0,1,3,9,6,8,2,7,4,1,5,3,2,4,1,1,1,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,3,4,4,4,5,4,4,4,4,5 +R_1fp5WR6uFgdbdtN,60 - 66,American,Male,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,3,1,5,2,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Somewhat Agree,5,1,4,3,2,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,4,3,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,0,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,5,2,3,1,4,0,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,0,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,3,5,4,1,0,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,3,1,2,0,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Agree,4,3,1,5,2,0,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,5,4,3,1,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,3,5,0,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Disagree,Agree,5,4,3,2,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,2,0,0,0,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),61,03VPfPs,01PAST,5,01ITEM,-0.25,0,0.666666667,2,9,7,6,4,5,8,1,3,3,4,2,1,0,2,2,0,0,0,0,1,0,0,2,0,0,-2,1,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,0,0,2,2,0,0,0,0,0,0,0,2,0,0,0,2,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,2,0,2,2,0,0,0,0,0,0,0,2,0,0,-2,2,0,0,0,0,0,0,0,0,0,0,0,0 +R_6j9OmgbUVt9jIKB,32 - 38,Canadian,Female,Strongly agree,Agree,Strongly disagree,Agree,Agree,5,1,2,3,4,Neither agree nor disagree,Agree,Agree,Somewhat agree,Agree,5,2,4,1,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Strongly agree,Strongly disagree,Agree,Agree,1,5,2,3,4,6,Neither agree nor disagree,Agree,Agree,Agree,Agree,3,4,1,2,5,8,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,2,1,4,3,5,6,Agree,Agree,Strongly disagree,Agree,Agree,2,3,5,1,4,4,Neither agree nor disagree,Agree,Agree,Strongly agree,Agree,3,2,1,4,5,6,Somewhat Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,2,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,4,1,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,2,4,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,2,3,1,1,1,1,-2,-1,-1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,02DGEN,0.875,0,1,9,2,5,3,7,8,4,1,6,3,4,2,1,3,2,-3,2,2,0,2,2,1,2,1,0,2,0,1,2,3,-3,2,2,0,2,2,2,2,1,1,2,1,1,2,2,-3,2,2,0,2,2,3,2,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,6,8,6,4,6,5,5,6,5,5,5 +R_1ZKvQzRf0XJutJT,46 - 52,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,1,5,2,4,3,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,4,2,1,5,3,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,5,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Disagree,Disagree,Disagree,Agree,Somewhat agree,2,1,3,5,4,6,Agree,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,3,2,4,1,5,8,Agree,Agree,Agree,Agree,Agree,5,1,2,3,4,3,Somewhat agree,Somewhat agree,Disagree,Agree,Somewhat agree,5,3,4,2,1,4,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,Agree,2,1,5,4,3,4,Agree,Agree,Agree,Agree,Agree,4,1,2,5,3,7,Strongly agree,Somewhat agree,Strongly disagree,Agree,Agree,1,2,3,4,5,8,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,1,5,4,2,3,2,Agree,Agree,Agree,Strongly agree,Agree,5,4,3,2,1,3,Strongly agree,Strongly agree,Disagree,Strongly agree,Agree,3,5,2,4,1,6,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,2,4,5,3,7,Agree,Agree,Agree,Agree,Agree,2,3,4,5,1,0,1,2,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,49,01PfPsV,02FUT,5,02DGEN,0.5,0,1,2,9,6,5,4,3,7,1,8,4,3,2,1,1,1,-1,2,1,-1,-1,2,-1,2,2,1,2,2,1,-2,-2,-2,2,1,2,3,-1,3,1,2,2,2,2,2,1,1,-2,2,1,1,1,-1,2,2,2,2,2,2,2,3,1,-3,2,2,1,-3,3,-2,3,2,2,2,3,2,3,3,-2,3,2,2,-3,3,-3,2,2,2,2,2,2,4,6,8,3,4,4,7,8,2,3,6,7 +R_3YRCJCauQ36vA89,46 - 52,Canadian,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,1,5,2,Agree,Somewhat agree,Agree,Agree,Agree,1,4,3,2,5,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,1,4,3,2,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,3,1,2,5,8,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,4,3,5,8,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,4,3,1,2,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,5,3,2,4,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,5,3,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,4,2,5,3,1,8,Somewhat agree,Somewhat agree,Agree,Agree,Agree,4,1,2,5,3,8,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,1,4,3,8,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,3,1,4,2,5,8,Somewhat agree,Agree,Agree,Agree,Somewhat agree,4,5,1,3,2,9,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,4,5,2,8,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,4,5,3,2,1,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-1,-1,-1,1,10 cents,25 minutes,24 days,Female,University - Graduate (Masters),46,02PsVPf,01PAST,10,01ITEM,1,0,0.666666667,6,3,4,2,8,5,7,1,9,4,2,3,1,1,1,1,1,1,2,1,2,2,2,1,2,1,2,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,2,1,1,2,2,2,1,2,1,1,1,2,1,1,2,2,1,2,2,2,1,1,1,1,1,0,2,1,2,2,1,8,8,8,8,7,8,8,8,8,9,8,9 +R_5yf4rucuBltJCUA,46 - 52,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,5,1,4,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,3,2,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,5,3,6,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,4,1,3,2,5,6,Strongly agree,Strongly agree,Disagree,Strongly Disagree,Strongly agree,4,1,2,3,5,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,3,1,9,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,1,3,4,7,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,5,4,1,3,2,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,7,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,2,3,4,8,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,2,5,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,7,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,2,1,5,7,Strongly agree,Agree,Strongly agree,Strongly Disagree,Agree,4,5,1,2,3,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,-1,-1,2,-2,1,-1,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),51,01PfPsV,01PAST,5,01ITEM,-0.375,0,1,3,5,2,8,7,4,9,1,6,4,2,3,1,3,3,3,3,3,2,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,-3,-3,-3,-3,-3,3,3,-2,-3,3,3,3,3,3,3,2,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,2,-3,3,-3,3,3,2,3,3,3,3,3,3,3,3,2,-3,3,-3,2,3,2,3,-3,2,6,6,8,9,7,8,7,8,6,7,7,7 +R_5ooo1l9CyoPkICT,60 - 66,American,Female,Agree,Agree,Disagree,Agree,Strongly disagree,3,4,5,2,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,1,5,3,4,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Neither agree nor disagree,Agree,Disagree,2,5,4,1,3,2,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,3,1,5,2,4,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,2,3,1,5,4,1,Agree,Strongly agree,Somewhat agree,Agree,Somewhat agree,5,2,3,4,1,1,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,1,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,3,2,1,5,4,3,Agree,Agree,Disagree,Agree,Strongly disagree,4,5,2,1,3,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,4,1,2,3,3,Somewhat Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,3,5,2,1,3,Agree,Agree,Neither agree nor disagree,Agree,Strongly disagree,2,5,1,3,4,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,5,3,1,4,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,2,5,4,1,1,2,2,0,1,2,0,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,66,02PsVPf,02FUT,10,02DGEN,-0.125,0.333333333,0.666666667,5,3,7,8,6,4,9,1,2,4,3,2,1,2,2,-2,2,-3,0,0,1,-1,0,1,-1,2,0,1,2,2,0,2,-2,-1,0,1,1,-1,1,-1,2,1,1,2,3,1,2,1,1,0,2,-1,1,1,-1,2,1,1,2,2,-2,2,-3,0,0,1,-1,1,1,-1,2,0,1,2,2,0,2,-3,-1,0,1,-1,0,1,-1,1,0,1,2,2,2,1,1,1,3,3,3,3,3,3 +R_5Cx1zvpu3EERY9X,46 - 52,American,Female,Strongly agree,Agree,Agree,Agree,Strongly agree,2,5,1,3,4,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,5,4,1,3,2,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,1,2,5,3,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,5,2,3,1,4,6,Neither agree nor disagree,Agree,Somewhat agree,Agree,Neither agree nor disagree,2,1,5,3,4,7,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,5,2,3,1,4,7,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,5,4,1,3,2,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,4,2,5,1,7,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,5,4,2,1,3,5,Somewhat agree,Agree,Strongly agree,Somewhat agree,Agree,3,4,2,5,1,7,Agree,Strongly agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,3,2,5,6,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,5,Agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,4,2,5,1,3,6,Agree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,5,1,4,3,2,6,Strongly agree,Somewhat Agree,Somewhat Agree,Agree,Strongly agree,2,1,3,5,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,-1,-1,-1,-1,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,48,03VPfPs,02FUT,10,01ITEM,1.375,0,1,7,4,8,6,3,9,5,1,2,2,4,3,1,3,2,2,2,3,3,2,1,0,2,2,0,0,1,2,0,0,1,2,0,0,2,1,2,0,1,1,2,2,1,1,0,2,1,0,0,0,1,1,0,3,1,3,1,0,1,2,3,1,2,2,3,2,0,0,2,2,2,1,1,2,0,1,2,1,2,2,0,2,0,3,1,1,2,3,6,7,7,7,7,5,7,6,5,6,6,6 +R_5eli1kwL3Xl5Fpv,46 - 52,American,Male,Agree,Agree,Agree,Agree,Somewhat agree,4,3,2,5,1,Agree,Strongly agree,Agree,Agree,Agree,1,4,3,5,2,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,5,2,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,Agree,Agree,Strongly agree,Strongly agree,Agree,4,2,5,3,1,8,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,3,5,1,4,8,Agree,Strongly agree,Agree,Strongly agree,Agree,1,4,2,3,5,8,Agree,Strongly agree,Agree,Strongly agree,Agree,5,3,1,4,2,6,Agree,Strongly agree,Agree,Strongly agree,Agree,2,1,4,3,5,8,Agree,Agree,Agree,Strongly agree,Somewhat Agree,5,3,1,2,4,9,Agree,Strongly agree,Agree,Agree,Strongly agree,3,1,4,2,5,8,Agree,Agree,Somewhat agree,Somewhat agree,Agree,4,2,5,3,1,9,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,4,2,1,3,5,8,Agree,Agree,Agree,Agree,Strongly agree,5,2,1,3,4,9,Agree,Somewhat agree,Agree,Somewhat agree,Agree,1,4,3,5,2,9,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,5,2,3,1,4,2,1,1,-1,-1,-1,-1,1,10 cents,5 minutes,15 days,Male,High School (or equivalent),49,02PsVPf,02FUT,5,02DGEN,1.125,0.333333333,0.333333333,5,4,8,2,3,6,9,1,7,4,3,2,1,2,2,2,2,1,2,3,2,2,2,2,1,1,2,1,2,2,3,3,2,2,3,3,3,2,2,3,2,3,2,2,3,2,3,2,2,3,2,3,2,2,2,2,3,1,2,3,2,2,3,2,2,1,1,2,1,2,2,1,2,2,2,2,2,3,2,1,2,1,2,1,2,1,2,1,10,8,8,8,6,8,9,8,9,8,9,9 +R_6fBypmBmQZi1IZ3,32 - 38,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,3,4,Agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,3,2,5,1,4,Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,1,4,5,2,3,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,5,Agree,Agree,Strongly agree,Somewhat agree,Agree,4,1,5,3,2,6,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,4,5,1,2,3,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,1,4,7,Agree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,4,3,2,1,5,8,Agree,Agree,Strongly agree,Agree,Strongly agree,5,4,2,1,3,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,2,5,5,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,3,4,1,5,2,7,Agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,4,2,5,1,5,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,6,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,3,5,1,2,4,8,Agree,Agree,Strongly agree,Somewhat Agree,Strongly agree,1,4,2,3,5,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,2,-2,0,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),35,02PsVPf,02FUT,5,01ITEM,0.625,0,1,5,4,7,6,3,8,2,1,9,4,3,2,1,2,3,3,3,3,2,1,3,2,1,2,2,3,1,3,2,3,3,3,3,2,2,3,1,2,2,3,3,1,3,2,3,3,3,3,2,1,3,-1,2,2,2,3,2,3,2,3,3,3,3,2,1,3,0,2,2,2,3,0,3,2,3,3,3,3,2,1,3,0,2,2,2,3,1,3,5,6,6,7,8,6,5,7,5,6,8,6 +R_7MFsdtCdfMALc1N,18 - 24,Both,Female,Somewhat agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,5,4,3,2,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,1,2,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Strongly agree,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,2,5,1,4,3,7,Somewhat disagree,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,1,3,5,2,4,6,Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Agree,1,4,5,3,2,6,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,2,3,9,Neither agree nor disagree,Somewhat disagree,Disagree,Somewhat agree,Somewhat disagree,2,5,1,3,4,7,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,1,3,4,5,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,2,5,7,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,5,2,4,3,7,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,4,2,5,3,1,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,1,5,2,4,3,8,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,5,1,3,7,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,4,3,2,5,1,1,1,0,2,1,-1,0,0,5 cents,25 minutes,15 days,Female,High School (or equivalent),19,02PsVPf,01PAST,10,02DGEN,0,0.333333333,0,8,3,2,7,4,9,6,1,5,4,2,3,1,1,2,1,2,0,0,1,1,1,1,2,-1,1,0,2,3,1,2,-1,0,-1,0,-2,1,-1,2,0,-1,0,2,3,1,2,0,0,0,-1,-2,1,-1,2,1,0,0,2,1,1,0,0,0,-1,0,1,0,1,0,1,0,0,2,0,1,1,2,2,1,-1,1,-1,1,2,0,2,0,2,8,7,6,6,9,7,6,7,7,6,8,7 +R_1YfFHpITKqo139s,60 - 66,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,2,3,1,5,Disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,2,1,4,5,3,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Disagree,Strongly Agree,1,5,4,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,3,1,5,4,0,Disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,3,5,1,2,0,Neither Agree nor Disagree,Disagree,Strongly agree,Disagree,Strongly agree,1,4,2,3,5,0,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,3,1,5,4,0,Disagree,Somewhat disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,2,1,3,5,0,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,4,2,1,3,5,0,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,3,4,2,5,0,Disagree,Disagree,Neither agree nor disagree,Agree,Somewhat agree,4,5,3,1,2,0,Neither Agree nor Disagree,Disagree,Strongly agree,Disagree,Strongly agree,3,2,5,1,4,0,Agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,4,5,3,2,0,Disagree,Disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,2,1,3,4,5,0,Neither Agree nor Disagree,Disagree,Strongly agree,Disagree,Strongly agree,3,2,4,1,5,1,1,1,2,0,1,1,0,10 cents,5 minutes,15 days,Female,High School (or equivalent),62,01PfPsV,01PAST,5,02DGEN,-0.125,0.333333333,0.333333333,9,5,7,6,2,3,4,1,8,3,2,4,1,2,3,3,3,1,-2,0,0,3,1,0,-1,3,-2,3,2,3,3,3,1,-2,0,0,3,1,0,-2,3,-2,3,2,3,3,3,1,-2,-1,0,3,1,0,-1,3,-2,3,2,3,3,3,1,-2,-2,0,2,1,0,-2,3,-2,3,2,3,3,3,1,-2,-2,0,3,1,0,-2,3,-2,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_7PcDL3PVMJv2PWn,32 - 38,Canadian,Female,Agree,Agree,Agree,Somewhat agree,Somewhat agree,4,1,5,2,3,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,1,3,2,5,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,4,2,5,1,3,Somewhat agree,Somewhat agree,Agree,Agree,Agree,3,2,5,4,1,7,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,1,2,3,5,7,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,5,2,3,4,1,8,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,5,1,4,3,8,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,4,1,3,5,2,7,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,7,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,5,1,4,7,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,1,5,4,3,2,8,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,4,1,3,5,2,7,Agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,8,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,1,4,5,2,8,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,5,2,3,4,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,0,0,-1,0,0,10 cents,25 minutes,24 days,Female,University - PhD,34,02PsVPf,01PAST,5,01ITEM,0.5,0,0.666666667,4,8,6,2,9,7,3,1,5,2,3,4,1,2,2,2,1,1,1,1,0,0,1,2,1,2,2,1,1,1,2,2,2,1,1,0,0,1,1,1,2,2,1,1,2,2,2,1,2,0,1,0,2,1,2,2,1,1,2,2,1,1,1,1,1,0,0,2,0,2,1,2,0,2,2,0,1,0,1,0,2,0,2,0,2,1,2,0,7,7,8,8,7,7,7,8,7,8,8,8 +R_382ydnyfyAJi5rP,25 - 31,Canadian,Male,Agree,Strongly agree,Strongly agree,Agree,Agree,4,5,1,2,3,Somewhat agree,Agree,Somewhat agree,Agree,Strongly agree,3,1,2,4,5,Somewhat Agree,Strongly Agree,Agree,Somewhat Agree,Somewhat Agree,4,2,5,1,3,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,5,2,1,3,4,6,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,1,4,3,5,2,8,Agree,Strongly agree,Strongly agree,Agree,Somewhat Agree,4,2,5,1,3,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Agree,4,1,3,2,5,9,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,1,4,2,3,8,Agree,Agree,Somewhat Agree,Strongly agree,Somewhat Agree,2,5,3,4,1,8,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,3,2,4,1,8,Agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Agree,4,5,2,3,1,10,Strongly agree,Agree,Neither Agree nor Disagree,Agree,Strongly agree,2,4,5,1,3,8,Agree,Agree,Strongly agree,Strongly agree,Agree,1,2,3,5,4,5,Somewhat agree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Agree,2,1,5,4,3,10,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,4,2,1,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,0,0,1,-2,0,1,2,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),29,01PfPsV,02FUT,5,01ITEM,0.5,0,1,5,2,3,7,4,9,6,1,8,3,4,2,1,2,3,3,2,2,1,2,1,2,3,1,3,2,1,1,3,3,2,3,2,1,1,-1,1,2,2,3,3,2,1,0,1,1,2,2,2,3,3,3,2,2,2,1,3,1,2,3,3,1,3,2,-1,3,0,2,3,2,0,2,3,2,2,3,3,2,1,-3,1,0,2,2,2,1,0,2,6,8,5,9,8,8,8,10,8,5,10,2 +R_3IQwm0e7K3VHmdn,25 - 31,Canadian,Male,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Strongly disagree,4,3,5,1,2,Strongly disagree,Disagree,Disagree,Agree,Somewhat agree,1,3,4,5,2,Somewhat Disagree,Strongly Disagree,Agree,Disagree,Strongly Agree,2,3,1,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Strongly disagree,2,1,3,4,5,0,Strongly disagree,Disagree,Disagree,Agree,Somewhat agree,2,4,1,5,3,0,Somewhat Disagree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,5,2,1,4,3,0,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Strongly disagree,4,1,3,2,5,0,Strongly disagree,Disagree,Disagree,Strongly agree,Somewhat agree,3,2,5,4,1,0,Somewhat Disagree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,3,4,1,5,2,0,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Strongly disagree,3,4,1,2,5,0,Strongly disagree,Disagree,Disagree,Agree,Somewhat agree,3,5,2,4,1,0,Somewhat Disagree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,2,4,1,3,5,0,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Strongly disagree,4,1,3,2,5,0,Strongly disagree,Disagree,Disagree,Agree,Somewhat agree,2,1,4,3,5,0,Somewhat Disagree,Strongly Disagree,Agree,Strongly Disagree,Strongly agree,4,1,5,3,2,1,2,1,2,0,1,2,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),27,02PsVPf,01PAST,10,02DGEN,0,0.666666667,0.333333333,4,2,6,9,7,8,3,1,5,2,3,4,1,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-2,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,3,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,2,1,-2,-3,-3,-2,-2,2,1,-1,-3,2,-3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_6egVfurNHqEkWPh,46 - 52,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,2,5,3,4,1,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Agree,3,2,1,4,5,Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,5,2,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,3,2,1,5,4,2,Neither agree nor disagree,Disagree,Agree,Disagree,Strongly agree,4,1,3,5,2,1,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,1,3,2,5,4,1,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,4,2,3,1,5,1,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Strongly agree,4,5,1,3,2,2,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,3,2,1,5,4,2,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,5,4,2,3,1,2,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Strongly agree,2,3,1,4,5,2,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,2,3,4,5,1,2,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,3,1,2,5,4,2,Neither agree nor disagree,Disagree,Strongly agree,Disagree,Strongly agree,1,2,5,4,3,2,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,5,1,4,2,3,1,1,1,2,1,1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,48,03VPfPs,02FUT,5,02DGEN,-0.25,0,1,4,8,5,6,2,7,9,1,3,4,2,3,1,3,3,2,1,3,0,-2,3,-2,2,2,-1,3,-1,3,3,3,2,2,3,0,-2,2,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,3,3,2,2,3,0,-2,3,-2,3,1,-2,3,-2,3,1,2,1,1,1,2,2,2,2,2,2,2 +R_7hSxzqk7lCP8pJi,25 - 31,Canadian,Female,Agree,Agree,Strongly agree,Somewhat agree,Agree,3,5,2,4,1,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,5,3,4,2,1,Agree,Somewhat Agree,Agree,Disagree,Strongly Agree,4,2,5,3,1,Agree,Agree,Agree,Somewhat agree,Agree,2,1,3,4,5,0,Disagree,Disagree,Agree,Disagree,Somewhat disagree,4,5,3,1,2,0,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,4,1,5,3,2,0,Agree,Agree,Agree,Somewhat agree,Agree,3,5,4,2,1,0,Disagree,Disagree,Agree,Disagree,Disagree,1,2,3,4,5,0,Agree,Somewhat Agree,Agree,Strongly Disagree,Agree,3,1,2,5,4,0,Agree,Agree,Agree,Somewhat agree,Agree,5,4,1,2,3,0,Disagree,Disagree,Agree,Disagree,Disagree,2,1,5,4,3,0,Agree,Somewhat Agree,Agree,Disagree,Agree,2,3,1,5,4,0,Agree,Agree,Agree,Somewhat agree,Agree,2,4,1,5,3,0,Disagree,Disagree,Agree,Disagree,Disagree,3,4,5,1,2,0,Agree,Somewhat Agree,Agree,Disagree,Agree,3,2,5,4,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-2,-1,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),31,03VPfPs,01PAST,5,01ITEM,0.375,0,1,9,8,3,2,6,4,5,1,7,3,2,4,1,2,2,3,1,2,-1,-2,2,-2,1,2,1,2,-2,3,2,2,2,1,2,-2,-2,2,-2,-1,3,1,2,-3,3,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-3,2,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-2,2,2,2,2,1,2,-2,-2,2,-2,-2,2,1,2,-2,2,0,0,0,0,0,0,0,0,0,0,0,0 +R_3C8j15a60QpZX8v,32 - 38,Canadian,Male,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,5,2,3,1,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,3,4,5,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,5,4,1,3,2,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,3,5,6,Strongly disagree,Agree,Agree,Agree,Somewhat disagree,1,4,3,5,2,6,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,2,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Disagree,5,1,4,3,2,5,Strongly disagree,Agree,Agree,Somewhat agree,Neither agree nor disagree,2,5,4,1,3,5,Agree,Agree,Agree,Agree,Agree,2,3,1,5,4,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,5,2,6,Disagree,Agree,Agree,Somewhat agree,Somewhat agree,4,2,1,3,5,6,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,3,5,1,5,Disagree,Agree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,4,1,5,Agree,Agree,Agree,Agree,Agree,1,3,2,4,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,2,0,1,2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),36,01PfPsV,01PAST,5,01ITEM,0.125,1,0,4,8,5,3,7,9,2,1,6,2,3,4,1,0,1,1,-1,-1,-2,1,2,1,1,1,2,2,1,2,0,1,2,0,0,-3,2,2,2,-1,2,2,2,2,2,-1,1,2,-1,-2,-3,2,2,1,0,2,2,2,2,2,0,1,0,0,0,-2,2,2,1,1,2,2,2,2,2,0,0,0,0,0,-2,2,2,0,0,2,2,2,2,2,6,6,2,5,5,4,6,6,2,5,5,2 +R_51Pg3oAe4Cdwlpv,60 - 66,American,Male,Agree,Agree,Strongly agree,Disagree,Somewhat agree,1,2,3,5,4,Somewhat disagree,Disagree,Agree,Somewhat agree,Somewhat disagree,5,3,4,1,2,Agree,Strongly Agree,Somewhat Agree,Disagree,Agree,2,1,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Somewhat agree,5,1,4,3,2,0,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,Disagree,4,3,2,5,1,1,Strongly agree,Strongly agree,Agree,Disagree,Agree,3,1,4,5,2,1,Strongly agree,Strongly agree,Strongly agree,Disagree,Agree,1,4,5,3,2,1,Disagree,Disagree,Strongly agree,Somewhat disagree,Somewhat disagree,3,4,5,2,1,1,Strongly agree,Strongly agree,Agree,Disagree,Agree,5,1,3,2,4,3,Strongly agree,Agree,Strongly agree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,1,Somewhat disagree,Neither agree nor disagree,Agree,Somewhat agree,Strongly disagree,5,4,3,1,2,1,Strongly agree,Strongly agree,Agree,Strongly Disagree,Agree,3,5,2,4,1,2,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,2,5,4,1,3,2,Strongly disagree,Somewhat agree,Neither agree nor disagree,Agree,Strongly disagree,4,3,2,1,5,1,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly Disagree,Agree,5,2,1,3,4,1,2,1,2,2,2,2,-1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,66,01PfPsV,02FUT,10,02DGEN,-0.625,0,1,7,4,5,9,2,3,6,1,8,3,4,2,1,2,2,3,-2,1,-1,-2,2,1,-1,2,3,1,-2,2,3,3,3,-2,1,1,-1,2,0,-2,3,3,2,-2,2,3,3,3,-2,2,-2,-2,3,-1,-1,3,3,2,-2,2,3,2,3,-1,-1,-1,0,2,1,-3,3,3,2,-3,2,3,2,3,0,-1,-3,1,0,2,-3,3,3,0,-3,2,1,0,1,1,1,1,3,1,1,2,2,1 +R_5Zh7jBkXAieStb3,25 - 31,Canadian,Female,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,1,4,2,3,5,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,4,3,5,2,Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,2,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,5,1,3,4,5,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Somewhat agree,4,3,2,5,1,5,Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,2,5,5,Disagree,Agree,Somewhat agree,Somewhat disagree,Agree,2,5,3,4,1,8,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,4,5,1,8,Somewhat Disagree,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,2,3,1,5,Somewhat disagree,Agree,Agree,Neither agree nor disagree,Agree,5,1,2,4,3,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,3,1,4,2,5,5,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,2,3,5,Disagree,Agree,Agree,Neither agree nor disagree,Agree,1,5,4,2,3,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,3,5,1,4,2,5,Somewhat Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,2,3,0,1,0,1,0,0,1,-1,10 cents,25 minutes,24 days,Female,University - Undergraduate,31,02PsVPf,01PAST,5,02DGEN,-0.25,0,0.666666667,4,7,8,6,3,2,9,1,5,4,3,2,1,-1,2,1,0,2,2,0,1,-1,1,-2,-1,1,0,0,-2,2,1,0,2,2,0,1,-2,1,-2,-1,1,0,0,-2,2,1,-1,2,1,1,1,0,1,-1,0,2,1,0,-1,2,2,0,2,1,0,1,-1,2,-1,0,2,0,0,-2,2,2,0,2,1,0,1,0,2,-1,0,2,0,0,5,5,5,5,8,8,5,5,5,5,5,5 +R_3IozwufNDFj4pPc,46 - 52,Canadian,Female,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,2,3,5,4,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Somewhat Agree,2,4,5,1,3,Somewhat agree,Neither agree nor disagree,Disagree,Disagree,Somewhat agree,4,3,1,5,2,6,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,1,4,3,5,10,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,1,2,3,5,Somewhat agree,Somewhat agree,Disagree,Disagree,Somewhat agree,5,2,1,3,4,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,5,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,5,2,1,4,3,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,5,Agree,Somewhat disagree,Agree,Strongly disagree,Agree,5,4,2,3,1,10,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,3,4,2,5,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,4,2,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,0,1,-1,0,1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),52,02PsVPf,01PAST,5,01ITEM,0.375,0,1,3,2,6,7,9,5,8,1,4,4,2,3,1,2,1,1,0,1,0,1,1,1,0,1,1,3,-1,1,1,0,-2,-2,1,0,1,-1,1,-1,1,1,1,0,1,1,1,-2,-2,1,0,0,0,0,0,1,0,0,1,2,0,0,0,0,0,2,-1,2,-3,2,3,3,3,-2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,10,5,10,5,10,5,10,10,5,5,5 +R_5NPB7Uy8fbMa4Yg,32 - 38,American,Male,Agree,Agree,Strongly agree,Somewhat agree,Somewhat agree,2,1,5,4,3,Agree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,2,3,1,4,5,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,3,4,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,3,1,2,5,5,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Somewhat agree,3,5,1,4,2,5,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,5,4,3,5,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,5,4,2,3,1,5,Somewhat agree,Agree,Somewhat agree,Disagree,Agree,4,3,2,1,5,5,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,2,3,4,1,5,Agree,Agree,Agree,Agree,Agree,5,3,2,1,4,5,Agree,Agree,Agree,Disagree,Somewhat agree,3,1,5,2,4,5,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,5,2,4,5,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,5,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,1,2,4,5,5,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,4,1,3,1,1,1,1,0,0,-1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,34,01PfPsV,02FUT,10,02DGEN,0.5,1,0,4,8,2,7,9,5,3,1,6,3,2,4,1,2,2,3,1,1,2,1,2,-1,1,2,2,2,0,2,2,3,3,2,3,0,1,2,-2,1,0,2,2,0,1,3,1,1,1,2,1,2,1,-2,2,1,0,1,-1,1,2,2,2,2,2,2,2,2,-2,1,1,2,2,0,1,2,2,2,2,2,1,2,1,2,1,1,1,2,0,1,5,5,5,5,5,5,5,5,5,5,5,5 +R_60AzsfZBb4s9ja1,39 - 45,American,Male,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,3,2,5,4,1,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Strongly agree,2,1,3,5,4,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Agree,4,3,2,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Disagree,1,3,4,5,2,2,Somewhat disagree,Strongly disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,1,5,3,4,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Disagree,Strongly agree,4,5,3,2,1,4,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly disagree,5,3,4,1,2,1,Disagree,Strongly disagree,Somewhat agree,Strongly agree,Strongly agree,5,1,4,3,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Agree,2,1,3,4,5,3,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat disagree,Strongly agree,5,4,2,3,1,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,4,3,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Agree,4,2,5,1,3,4,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly agree,4,3,2,5,1,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,3,2,4,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,2,3,4,5,1,1,2,1,2,0,-1,0,0,5 cents,100 minutes,24 days,Male,College Diploma/Certificate,42,03VPfPs,02FUT,5,02DGEN,0.375,0.333333333,0.666666667,4,3,5,2,9,6,8,1,7,3,4,2,1,3,3,1,0,2,0,-3,2,-2,3,-1,0,3,-1,2,3,3,1,-1,-2,-1,-3,3,0,-1,0,0,2,-2,3,3,3,2,-1,-3,-2,-3,1,3,3,0,0,1,-1,2,3,3,0,-1,3,0,-3,3,-3,3,0,0,3,0,2,3,3,1,0,3,0,-3,3,-3,3,0,0,3,-2,3,3,2,3,4,1,5,3,0,1,4,1,0 +R_1Ksdo9ubjVLBHwZ,39 - 45,American,Female,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,3,1,4,2,5,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,5,1,3,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,1,3,4,5,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,4,1,5,3,2,5,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,2,1,4,3,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,5,2,5,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,1,2,4,3,5,6,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,2,4,3,5,1,6,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,1,4,8,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,1,5,3,2,5,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,4,2,1,5,3,5,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,5,3,1,2,4,5,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Strongly agree,Strongly agree,4,1,5,3,2,6,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,2,3,5,1,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,5,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,-1,2,-2,0,0,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),45,01PfPsV,01PAST,10,01ITEM,0.625,0,1,2,7,8,5,3,9,4,1,6,4,3,2,1,-3,-3,-3,3,1,-3,3,-1,3,1,3,3,3,3,3,-3,3,-1,3,1,-3,3,-1,3,-3,3,3,3,3,3,1,3,1,3,-1,-3,3,-3,3,-3,3,3,3,1,3,0,-3,0,3,1,-3,3,0,3,-1,3,3,3,1,3,0,-3,0,3,3,-3,3,0,3,-1,3,3,3,3,3,5,5,5,6,6,8,5,5,5,6,5,6 +R_6pRqjE4HtLlUvSa,53 - 59,American,Male,Strongly disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly disagree,5,2,4,1,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,2,4,5,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly disagree,Strongly disagree,5,1,2,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,4,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,3,2,0,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly disagree,Strongly disagree,5,1,2,3,4,0,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,4,5,1,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,3,2,0,Strongly disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly disagree,4,3,5,1,2,0,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly disagree,3,2,1,4,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,2,1,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,1,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,2,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,3,4,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,-2,2,2,-2,-2,-2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,55,03VPfPs,02FUT,10,01ITEM,0,0,1,9,3,4,2,6,8,5,1,7,2,3,4,1,-3,3,0,0,-3,-3,-3,3,-3,-3,3,3,3,3,3,-3,3,0,-3,-3,3,3,3,3,3,3,3,3,3,3,-3,3,0,-3,-3,-3,-3,-3,-3,-3,3,3,3,3,3,-3,3,0,3,-3,-3,3,3,-3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_6V4h0VRF4DZeqOd,46 - 52,American,Female,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,2,1,4,5,3,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,4,1,5,2,3,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,5,2,3,1,4,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,1,3,5,4,2,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,5,2,3,4,2,Strongly agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,3,1,5,2,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,1,4,3,5,2,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,3,5,1,4,2,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,3,1,5,4,2,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,2,3,1,5,4,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,1,4,2,2,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,2,3,4,5,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,5,1,3,2,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,3,4,5,1,2,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,2,3,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,1,2,-1,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,52,01PfPsV,01PAST,10,01ITEM,0.125,0,1,2,8,4,6,9,5,7,1,3,4,3,2,1,2,3,1,0,2,2,-3,3,-3,1,3,2,2,0,3,2,3,2,0,2,3,-3,3,-3,2,3,2,3,0,3,2,3,2,0,2,3,-3,3,-3,1,3,2,2,0,3,2,3,2,0,2,3,-3,3,-3,2,3,3,3,0,3,2,3,2,0,2,3,-3,3,-3,2,3,3,3,0,3,2,2,2,2,2,2,2,2,2,2,2,2 +R_7XidMGEjVG8gDF8,53 - 59,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,1,5,4,3,2,Agree,Strongly disagree,Strongly agree,Somewhat agree,Agree,5,3,1,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,1,5,4,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,3,2,1,5,4,9,Strongly agree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,4,3,2,1,5,9,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,2,3,5,4,1,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,1,3,2,5,9,Strongly agree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,3,4,2,5,1,7,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,2,3,4,1,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,3,1,2,5,9,Strongly agree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,4,5,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,5,1,3,4,2,9,Strongly agree,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,4,5,2,1,3,8,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,5,4,3,1,2,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-2,-2,-2,-2,10 cents,75 minutes,24 days,Female,College Diploma/Certificate,53,03VPfPs,01PAST,5,01ITEM,1,0,0.666666667,2,7,3,9,5,4,6,1,8,2,4,3,1,3,3,3,3,-3,2,-3,3,1,2,3,3,3,1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,1,3,3,3,3,-1,3,9,9,8,9,7,9,9,7,9,9,8,9 +R_7TpMc3WtS8Bf0ko,53 - 59,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,2,4,3,1,5,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,4,1,2,5,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,5,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Somewhat agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,5,1,3,4,2,7,Strongly disagree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,4,3,2,1,5,7,Agree,Disagree,Disagree,Somewhat Disagree,Strongly agree,4,2,1,5,3,8,Neither agree nor disagree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,4,1,5,3,2,7,Strongly disagree,Disagree,Disagree,Neither agree nor disagree,Somewhat disagree,5,1,2,4,3,9,Agree,Disagree,Disagree,Disagree,Agree,4,3,1,2,5,8,Agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,3,1,5,2,4,7,Disagree,Strongly disagree,Somewhat agree,Disagree,Somewhat agree,2,5,3,1,4,8,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,1,4,5,2,3,7,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,1,4,2,3,7,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,Agree,4,5,1,2,3,7,Agree,Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,4,2,5,3,-1,0,1,2,-1,-2,0,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),58,03VPfPs,02FUT,10,02DGEN,0.25,0,1,4,9,7,6,3,5,8,1,2,4,2,3,1,1,3,3,3,0,-2,-2,0,-1,1,2,0,1,0,3,1,3,3,2,0,-3,1,-1,2,-1,2,-2,-2,-1,3,0,3,3,2,0,-3,-2,-2,0,-1,2,-2,-2,-2,2,2,3,3,1,1,-2,-3,1,-2,1,3,2,2,0,3,2,3,3,0,1,-1,-3,2,-3,2,2,2,3,0,3,7,7,7,8,7,9,8,7,8,7,7,7 +R_7GvxJqW6FHe0Pg1,25 - 31,American,Female,Agree,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly agree,3,2,5,1,4,Strongly agree,Strongly disagree,Agree,Strongly disagree,Agree,1,4,5,2,3,Agree,Strongly Disagree,Agree,Disagree,Agree,4,3,2,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat disagree,Strongly agree,Agree,Strongly agree,Somewhat disagree,5,3,1,2,4,5,Somewhat agree,Strongly disagree,Agree,Somewhat agree,Somewhat disagree,5,4,1,2,3,10,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,9,Disagree,Strongly agree,Strongly agree,Strongly agree,Agree,3,2,5,4,1,10,Somewhat agree,Strongly disagree,Strongly agree,Strongly agree,Agree,2,1,4,5,3,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,3,1,5,5,Agree,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly agree,3,5,1,4,2,10,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,3,4,2,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,2,5,3,1,4,2,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,3,2,0,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,2,3,5,0,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,-2,1,0,2,-2,-2,-2,-1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),26,01PfPsV,01PAST,5,02DGEN,0.25,0,1,4,6,2,3,8,9,5,1,7,4,3,2,1,2,3,0,3,3,3,-3,2,-3,2,2,-3,2,-2,2,-1,3,2,3,-1,1,-3,2,1,-1,3,2,3,3,3,-2,3,3,3,2,1,-3,3,3,2,3,3,3,3,3,2,3,0,3,3,1,-3,3,-3,3,3,-3,3,3,3,0,3,3,3,3,1,-3,3,-3,3,3,-3,3,3,3,6,5,10,9,10,10,5,10,2,2,0,0 +R_12Us6HW6onCPXYR,39 - 45,American,Female,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,3,4,5,2,1,Somewhat disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,Agree,Agree,Somewhat Agree,Disagree,Strongly Agree,1,3,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,2,1,3,4,3,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,3,1,3,Agree,Agree,Agree,Agree,Agree,5,2,1,3,4,2,Neither agree nor disagree,Agree,Agree,Agree,Neither agree nor disagree,5,3,1,2,4,3,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,2,4,5,3,4,Strongly agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,5,4,2,3,1,2,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,4,3,1,5,2,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,3,5,2,1,2,Strongly agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,5,1,4,2,3,2,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,5,3,4,2,1,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,5,2,3,1,2,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,1,3,2,4,1,-1,0,1,-1,0,-1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,41,01PfPsV,02FUT,10,02DGEN,0.125,0,1,9,5,8,2,3,7,6,1,4,2,3,4,1,0,2,2,2,0,-1,-1,3,0,0,2,2,1,-2,3,1,2,2,2,1,0,0,3,0,0,2,2,2,2,2,0,2,2,2,0,0,0,3,1,0,3,3,3,1,3,1,2,1,2,1,0,0,3,0,1,3,1,1,0,3,1,2,1,2,1,0,0,3,0,1,3,3,3,0,3,4,3,3,2,3,4,2,2,2,2,2,2 +R_1qUMieiwMtmCwyW,46 - 52,American,Female,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,Disagree,5,3,1,2,4,Neither agree nor disagree,Somewhat agree,Agree,Agree,Disagree,3,4,1,5,2,Strongly Agree,Somewhat Agree,Strongly Agree,Disagree,Strongly Agree,3,2,1,5,4,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,Strongly disagree,2,1,4,3,5,1,Neither agree nor disagree,Agree,Agree,Strongly agree,Disagree,3,4,2,1,5,1,Strongly agree,Neither Agree nor Disagree,Agree,Disagree,Strongly agree,2,5,4,3,1,1,Somewhat agree,Agree,Strongly agree,Neither agree nor disagree,Strongly disagree,2,4,1,3,5,1,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,Disagree,2,5,3,1,4,1,Strongly agree,Somewhat Agree,Agree,Strongly Disagree,Strongly agree,2,1,4,5,3,1,Agree,Agree,Strongly agree,Neither agree nor disagree,Strongly disagree,3,1,2,5,4,1,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,Disagree,4,1,3,2,5,1,Strongly agree,Neither Agree nor Disagree,Agree,Disagree,Strongly agree,2,1,4,5,3,1,Agree,Agree,Strongly agree,Neither agree nor disagree,Strongly disagree,1,2,4,3,5,1,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,Disagree,3,4,2,5,1,1,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Strongly agree,2,4,1,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,-1,0,2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,46,03VPfPs,01PAST,5,01ITEM,0,0,1,9,6,7,3,5,4,8,1,2,4,2,3,1,1,2,3,0,-2,0,1,2,2,-2,3,1,3,-2,3,1,2,3,0,-3,0,2,2,3,-2,3,0,2,-2,3,1,2,3,0,-3,0,3,2,3,-2,3,1,2,-3,3,2,2,3,0,-3,0,3,2,3,-2,3,0,2,-2,3,2,2,3,0,-3,0,3,2,3,-2,3,0,1,-2,3,1,1,1,1,1,1,1,1,1,1,1,1 +R_3OtEK72619AMU3n,18 - 24,Canadian,Female,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,3,5,1,4,Somewhat disagree,Agree,Neither agree nor disagree,Agree,Agree,1,3,2,5,4,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,3,2,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,1,5,3,Agree,Agree,Agree,Strongly agree,Neither agree nor disagree,5,1,4,3,2,2,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,1,2,5,4,4,Somewhat agree,Somewhat agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,1,4,2,3,5,5,Strongly disagree,Somewhat agree,Disagree,Agree,Somewhat disagree,3,2,5,1,4,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,5,3,4,2,2,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,1,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,1,2,4,3,5,2,Somewhat Agree,Somewhat Agree,Strongly agree,Strongly agree,Somewhat Agree,3,2,4,5,1,4,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,1,4,2,5,3,5,Neither agree nor disagree,Agree,Agree,Agree,Agree,5,3,1,2,4,2,Agree,Agree,Agree,Agree,Somewhat Agree,5,4,1,2,3,1,2,1,2,-2,-1,-1,2,10 cents,100 minutes,24 days,Female,High School (or equivalent),20,03VPfPs,02FUT,5,02DGEN,1,0,1,4,7,9,2,6,3,8,1,5,2,3,4,1,1,3,2,3,3,-1,2,0,2,2,1,1,2,2,1,0,3,3,0,0,2,2,2,3,0,2,1,2,2,1,1,1,3,-1,0,-3,1,-2,2,-1,2,1,1,1,0,1,3,3,3,3,0,1,2,0,1,1,1,3,3,1,1,3,2,2,3,0,2,2,2,2,2,2,2,2,1,3,3,2,4,5,4,2,1,2,4,5,2 +R_7gQ3q59o1SLXtiF,32 - 38,American,Female,Agree,Agree,Somewhat agree,Somewhat agree,Strongly agree,4,3,2,1,5,Agree,Strongly disagree,Strongly agree,Disagree,Strongly agree,5,4,1,2,3,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,5,4,2,Agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,5,4,4,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,5,3,2,4,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,4,1,3,4,Agree,Strongly agree,Agree,Agree,Neither agree nor disagree,1,4,2,3,5,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,4,2,5,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,4,5,1,6,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,2,3,5,1,4,4,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,1,2,3,8,Agree,Agree,Agree,Strongly agree,Strongly agree,3,2,4,1,5,4,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,3,5,4,2,1,5,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,4,3,2,6,Somewhat Agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,2,4,1,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,2,-1,-1,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,38,02PsVPf,01PAST,10,01ITEM,0.375,0,1,7,2,9,8,6,3,4,1,5,2,4,3,1,2,2,1,1,3,2,-3,3,-2,3,1,0,3,1,3,2,3,1,1,1,1,0,2,0,1,1,1,1,1,1,2,3,2,2,0,0,0,1,1,1,1,1,1,1,1,3,3,1,2,3,3,-3,3,-3,3,2,2,2,3,3,3,3,1,1,3,2,-3,3,-3,3,1,1,3,2,3,4,5,4,5,5,6,4,8,4,5,6,4 +R_1gUk1SxUcNEGdq1,53 - 59,American,Female,Strongly agree,Agree,Strongly agree,Disagree,Strongly agree,2,3,5,4,1,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,5,2,3,4,Agree,Agree,Agree,Strongly Disagree,Agree,1,5,4,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Strongly disagree,Agree,3,5,4,2,1,1,Agree,Agree,Agree,Agree,Agree,2,3,5,4,1,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,4,1,5,3,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,2,3,1,4,2,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,5,1,4,3,3,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,4,5,2,1,3,2,Agree,Agree,Strongly agree,Strongly disagree,Strongly agree,3,2,5,1,4,2,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,2,4,3,1,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,2,5,4,3,2,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,5,3,4,1,2,2,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,5,2,4,3,1,2,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,1,4,2,-1,0,0,2,0,-1,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,55,02PsVPf,01PAST,10,02DGEN,-0.5,0,1,4,5,7,2,9,3,8,1,6,2,3,4,1,3,2,3,-2,3,-1,1,1,2,1,2,2,2,-3,2,2,2,2,-3,2,2,2,2,2,2,2,2,2,0,2,3,3,3,-3,3,-1,1,1,1,1,0,1,0,-1,0,2,2,3,-3,3,2,0,2,0,2,2,2,2,0,2,3,3,3,-3,3,2,0,2,0,2,2,2,2,0,2,2,1,2,3,2,3,2,2,2,2,2,2 +R_2NV4QOALvC2Xyd8,18 - 24,Canadian,Male,Agree,Strongly agree,Disagree,Neither agree nor disagree,Strongly agree,1,2,3,4,5,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Strongly agree,1,5,3,2,4,Somewhat Agree,Strongly Disagree,Strongly Agree,Somewhat Agree,Disagree,2,5,4,1,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Strongly agree,4,1,5,3,2,9,Disagree,Strongly agree,Somewhat disagree,Somewhat agree,Somewhat agree,2,3,5,1,4,4,Agree,Strongly agree,Somewhat Disagree,Somewhat Disagree,Strongly Disagree,2,5,4,1,3,4,Strongly agree,Agree,Neither agree nor disagree,Somewhat agree,Disagree,2,3,5,1,4,7,Strongly disagree,Disagree,Neither agree nor disagree,Strongly agree,Strongly agree,4,3,1,2,5,8,Somewhat Disagree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Agree,1,5,3,4,2,6,Agree,Strongly agree,Disagree,Somewhat disagree,Agree,2,4,3,1,5,3,Strongly agree,Strongly disagree,Disagree,Agree,Somewhat disagree,4,5,3,2,1,3,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,3,1,5,4,2,9,Agree,Strongly agree,Strongly disagree,Somewhat disagree,Somewhat disagree,2,3,5,1,4,1,Strongly agree,Disagree,Strongly disagree,Agree,Somewhat agree,2,3,5,1,4,5,Strongly agree,Agree,Disagree,Agree,Somewhat Disagree,4,5,3,2,1,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,-1,2,-1,0,1,-1,2,15 cents,25 minutes,15 days,Male,College Diploma/Certificate,23,02PsVPf,02FUT,10,01ITEM,0.625,0,0,6,4,2,7,9,8,5,1,3,3,4,2,1,2,3,-2,0,3,1,0,2,-2,3,1,-3,3,1,-2,0,1,0,-1,3,-2,3,-1,1,1,2,3,-1,-1,-3,3,2,0,1,-2,-3,-2,0,3,3,-1,0,-3,3,2,2,3,-2,-1,2,3,-3,-2,2,-1,3,-1,0,-1,1,2,3,-3,-1,-1,3,-2,-3,2,1,3,2,-2,2,-1,9,4,4,7,8,6,3,3,9,1,5,10 +R_5RCGbq3fkqc6VZn,32 - 38,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,1,3,5,2,4,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,1,3,2,5,4,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,Agree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,2,5,4,3,1,1,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,4,5,1,3,2,1,Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Agree,2,5,4,3,1,1,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,2,5,4,1,3,1,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,1,3,2,4,5,2,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Agree,2,4,5,3,1,1,Somewhat agree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,2,4,1,5,3,0,Somewhat agree,Disagree,Agree,Somewhat disagree,Agree,3,5,4,2,1,0,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,4,2,3,1,0,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,1,2,4,3,0,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,1,5,2,3,4,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Agree,1,3,5,2,4,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,1,1,0,0,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),37,03VPfPs,01PAST,5,01ITEM,0,0,1,7,2,5,8,4,9,6,1,3,2,4,3,1,2,3,3,1,1,1,-1,3,-1,2,3,0,3,0,2,2,3,3,1,0,0,-1,3,-1,3,2,0,3,0,2,1,3,3,1,0,1,-1,3,-1,2,3,0,3,0,2,1,2,3,1,0,1,-2,2,-1,2,3,0,3,0,3,1,3,3,1,0,1,-1,2,-1,1,3,0,3,0,2,1,1,1,1,2,1,0,0,0,0,1,0 +R_59mXsNJdpdeH8Ah,60 - 66,American,Male,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,1,2,4,3,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,1,3,5,Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,1,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,4,2,5,3,1,2,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,3,1,2,4,5,2,Agree,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,5,1,3,4,2,4,Agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,2,3,4,Strongly disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,5,1,4,3,2,2,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,2,1,5,3,4,4,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,2,3,5,2,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,5,4,1,2,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,1,5,2,3,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,1,5,3,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,2,5,2,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,5,2,1,4,0,1,1,0,1,1,1,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,66,01PfPsV,01PAST,5,02DGEN,-0.125,1,0,8,3,6,7,5,9,2,1,4,3,2,4,1,2,2,1,1,-1,-3,-1,1,-1,1,2,1,2,1,1,2,2,1,0,-1,-3,-1,1,-1,2,2,2,2,1,0,2,2,1,0,0,-3,-1,1,-1,2,2,2,2,1,1,2,1,1,1,0,-3,0,0,0,1,2,1,2,0,0,1,1,0,0,0,-3,0,0,0,0,2,1,2,0,0,2,2,2,4,4,2,4,2,1,3,3,2 +R_3zzN8Ps2vISvFsM,46 - 52,American,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly disagree,4,5,3,1,2,Strongly disagree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,3,5,4,2,1,Strongly Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,2,1,4,5,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly disagree,2,4,3,1,5,0,Strongly disagree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,2,1,4,5,1,Strongly agree,Agree,Agree,Somewhat Disagree,Strongly agree,3,2,4,5,1,0,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly disagree,4,2,5,3,1,0,Strongly disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,1,2,5,3,4,0,Strongly agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,2,5,1,3,4,1,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly disagree,1,2,3,5,4,0,Strongly disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,2,1,4,5,5,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,4,2,5,3,1,0,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly disagree,3,1,2,5,4,0,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,5,1,3,4,5,Strongly agree,Agree,Agree,Somewhat Disagree,Strongly agree,4,5,2,3,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,0,-2,2,0,1,-1,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),48,03VPfPs,02FUT,5,01ITEM,-0.875,0,1,8,4,9,3,6,5,2,1,7,2,4,3,1,3,2,3,3,-3,-3,1,0,2,1,3,2,3,1,3,3,2,3,3,-3,-3,1,1,2,0,3,2,2,-1,3,3,2,3,3,-3,-3,1,1,2,1,3,2,0,0,3,3,2,3,3,-3,-3,0,1,0,1,3,2,2,0,3,3,2,3,3,-3,-3,0,2,0,1,3,2,2,-1,3,0,1,0,0,0,1,0,5,0,0,5,0 +R_7jdZy6AICnrVoeF,53 - 59,American,Female,Somewhat disagree,Somewhat agree,Agree,Strongly agree,Somewhat disagree,5,1,4,2,3,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Disagree,4,1,2,5,3,Strongly Agree,Somewhat Agree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,2,3,5,Somewhat disagree,Somewhat agree,Agree,Agree,Somewhat agree,2,1,3,4,5,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,1,3,5,4,4,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,2,4,5,3,1,5,Disagree,Somewhat agree,Agree,Somewhat agree,Agree,1,4,2,5,3,4,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat agree,3,1,5,2,4,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,3,2,5,4,1,7,Somewhat agree,Somewhat agree,Agree,Strongly agree,Somewhat disagree,2,3,5,1,4,0,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Disagree,5,2,1,3,4,2,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,1,5,2,3,4,1,Disagree,Somewhat agree,Agree,Strongly agree,Disagree,3,2,5,1,4,2,Somewhat disagree,Disagree,Agree,Somewhat disagree,Disagree,5,2,1,3,4,3,Strongly agree,Agree,Agree,Strongly Disagree,Strongly agree,4,5,3,2,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,2,1,2,-1,1,1,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,56,01PfPsV,02FUT,10,01ITEM,0,0.666666667,0.333333333,8,3,9,2,6,4,7,1,5,3,4,2,1,-1,1,2,3,-1,1,-1,2,-1,-2,3,1,3,-3,3,-1,1,2,2,1,1,1,2,1,1,2,1,2,1,2,-2,1,2,1,2,1,2,1,2,1,1,1,1,-1,2,1,1,2,3,-1,-1,-1,2,-1,-2,3,2,2,-3,3,-2,1,2,3,-2,-1,-2,2,-1,-2,3,2,2,-3,3,2,4,5,4,7,7,0,2,1,2,3,1 +R_6Hisc5dHpCD03ip,53 - 59,American,Female,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,2,1,3,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,3,2,4,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,4,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,3,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,4,3,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,2,4,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,4,2,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,3,5,1,4,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,1,4,5,3,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,3,5,2,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,3,2,1,5,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,2,4,5,7,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,4,3,5,0,0,0,0,0,0,0,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),59,03VPfPs,01PAST,10,02DGEN,0,0.333333333,0.666666667,5,7,9,2,4,3,6,1,8,4,3,2,1,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,6,6,6,5,6,5,5,6,5,6,7,7 +R_66mQgvLpNsSvriu,18 - 24,American,Female,Disagree,Strongly agree,Somewhat agree,Somewhat disagree,Disagree,4,3,2,1,5,Disagree,Disagree,Somewhat agree,Strongly agree,Disagree,1,4,5,2,3,Strongly Agree,Disagree,Agree,Somewhat Agree,Agree,3,5,4,1,2,Disagree,Agree,Agree,Disagree,Strongly disagree,5,2,3,1,4,4,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly agree,Disagree,2,1,5,3,4,5,Agree,Disagree,Disagree,Strongly agree,Agree,4,2,1,3,5,4,Strongly disagree,Neither agree nor disagree,Agree,Disagree,Strongly disagree,1,3,4,5,2,4,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,2,4,3,5,1,6,Agree,Disagree,Disagree,Neither Agree nor Disagree,Agree,2,5,3,1,4,7,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,5,1,3,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,5,4,2,6,Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,3,4,1,5,2,3,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,4,2,1,3,3,Neither agree nor disagree,Disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,1,5,4,2,4,Agree,Disagree,Agree,Neither Agree nor Disagree,Agree,4,3,5,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,2,-1,0,2,-1,10 cents,100 minutes,24 days,Female,High School (or equivalent),18,02PsVPf,02FUT,5,01ITEM,0,0,1,5,4,6,8,7,2,3,1,9,4,2,3,1,-2,3,1,-1,-2,-2,-2,1,3,-2,3,-2,2,1,2,-2,2,2,-2,-3,0,1,1,3,-2,2,-2,-2,3,2,-3,0,2,-2,-3,-3,1,-3,3,-3,2,-2,-2,0,2,0,3,1,0,0,0,-2,1,0,0,2,-2,2,0,2,0,3,1,1,0,0,-2,1,0,0,2,-2,2,0,2,4,5,4,4,6,7,3,6,3,3,4,4 +R_5cY2ZT0ANnNZl73,32 - 38,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,3,4,2,1,5,Strongly disagree,Somewhat agree,Strongly disagree,Agree,Neither agree nor disagree,4,3,1,5,2,Somewhat Agree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Somewhat Agree,1,2,5,3,4,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Disagree,5,1,4,2,3,3,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,4,2,3,5,1,5,Strongly agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,5,4,2,1,3,2,Agree,Strongly agree,Strongly agree,Strongly agree,Disagree,3,2,4,5,1,1,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly agree,Neither agree nor disagree,3,2,4,1,5,3,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,1,5,2,4,3,2,Agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,3,5,2,1,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,2,3,5,1,2,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,5,4,2,3,1,Agree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,3,2,1,5,4,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,1,2,2,Strongly agree,Strongly agree,Agree,Neither Agree nor Disagree,Strongly agree,3,2,1,5,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,-1,0,1,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,01PfPsV,02FUT,10,01ITEM,0.125,0,1,5,2,6,9,8,7,3,1,4,2,3,4,1,2,3,3,3,0,-3,1,-3,2,0,1,-1,3,-3,1,1,3,3,3,-2,-1,-1,-1,1,-1,3,2,1,0,3,2,3,3,3,-2,0,0,-2,3,0,3,2,2,0,3,2,3,3,3,0,0,0,1,1,0,3,3,3,0,3,2,3,0,3,0,0,0,1,0,0,3,3,2,0,3,3,5,2,1,3,2,4,2,1,3,2,5 +R_7YXiACpJdxqUAoq,32 - 38,American,Female,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,2,5,3,1,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,3,1,2,5,4,Strongly Disagree,Strongly Agree,Strongly Agree,Strongly Disagree,Neither Agree nor Disagree,2,1,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,3,4,7,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,3,2,1,4,5,3,Strongly Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly Disagree,3,5,4,1,2,10,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,2,5,1,3,1,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,2,3,1,5,4,5,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,3,5,2,4,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,3,1,2,4,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,4,2,1,5,3,4,Strongly Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly Disagree,4,2,5,3,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,1,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,1,2,3,5,4,1,Strongly Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly Disagree,2,4,3,1,5,1,2,-2,2,0,0,2,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),33,03VPfPs,01PAST,5,02DGEN,-0.25,0,1,7,8,3,4,5,9,6,1,2,2,3,4,1,3,3,1,3,1,-3,-3,-3,3,-3,-3,3,3,-3,0,3,3,3,3,3,3,3,-3,3,-3,-3,3,3,-3,-3,1,3,3,3,-3,-3,3,-3,3,-3,3,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,-3,-3,3,3,-3,-3,3,3,3,3,3,-3,-3,-3,3,-3,-3,3,3,-3,-3,5,7,3,10,1,5,5,4,4,1,1,1 +R_7eM3OcVZcERSnNb,25 - 31,American,Male,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,5,3,4,2,1,Somewhat Agree,Somewhat Agree,Agree,Agree,Agree,3,5,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,0,Strongly agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,5,2,3,1,4,0,Somewhat Agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,5,4,3,1,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,0,Strongly agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,1,3,2,4,5,0,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,4,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,2,5,1,0,Strongly agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,4,2,1,5,0,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,4,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,7,Strongly agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,4,2,5,1,3,6,Somewhat Agree,Somewhat Agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,1,1,1,-1,-1,-1,-1,1,5 cents,5 minutes,47 days,Male,College Diploma/Certificate,27,02PsVPf,02FUT,10,02DGEN,1,1,0,4,7,2,9,3,6,5,1,8,2,3,4,1,2,2,2,2,2,2,0,1,1,2,1,1,2,2,2,3,3,3,3,3,3,0,1,0,3,1,1,3,2,3,3,3,3,3,3,3,0,2,0,3,3,1,3,3,3,3,3,3,3,3,3,0,1,0,3,2,3,3,2,3,3,3,3,3,3,3,0,2,0,3,1,1,3,3,3,0,0,0,0,0,0,0,0,0,0,7,6 +R_7dnoQWUMsadGrOp,60 - 66,American,Male,Strongly disagree,Somewhat disagree,Somewhat disagree,Strongly disagree,Agree,3,4,2,1,5,Strongly disagree,Neither agree nor disagree,Agree,Strongly disagree,Somewhat agree,3,4,2,1,5,Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Strongly Agree,5,4,2,1,3,Strongly disagree,Disagree,Somewhat agree,Strongly disagree,Agree,2,3,5,1,4,2,Strongly disagree,Disagree,Somewhat disagree,Disagree,Disagree,1,3,4,5,2,1,Agree,Strongly agree,Agree,Somewhat Disagree,Somewhat Agree,4,3,5,1,2,0,Disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Disagree,1,2,5,3,4,2,Disagree,Disagree,Somewhat disagree,Disagree,Agree,5,2,3,4,1,2,Somewhat Disagree,Disagree,Disagree,Disagree,Disagree,2,1,3,4,5,2,Somewhat disagree,Somewhat agree,Somewhat disagree,Strongly disagree,Somewhat disagree,5,3,2,4,1,1,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,2,4,3,1,5,5,Disagree,Somewhat Disagree,Disagree,Disagree,Somewhat Disagree,4,2,1,3,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,5,1,3,4,10,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,4,5,3,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,5,4,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,-2,0,0,5 cents,5 minutes,24 days,Male,College Diploma/Certificate,60,03VPfPs,01PAST,5,01ITEM,0.25,0.666666667,0.333333333,3,9,4,8,5,7,6,1,2,4,3,2,1,-3,-1,-1,-3,2,-3,0,2,-3,1,2,3,1,1,3,-3,-2,1,-3,2,-3,-2,-1,-2,-2,2,3,2,-1,1,-2,-1,-1,-1,-2,-2,-2,-1,-2,2,-1,-2,-2,-2,-2,-1,1,-1,-3,-1,-1,0,-1,-1,0,-2,-1,-2,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,2,2,2,1,5,3,10,10,10 +R_3IWAKxaAqfStSLY,18 - 24,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,5,3,4,1,Agree,Somewhat disagree,Agree,Strongly agree,Strongly agree,4,1,2,5,3,Strongly Agree,Agree,Strongly Agree,Agree,Agree,1,2,3,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,2,3,5,1,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,1,3,4,5,4,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,3,4,5,1,2,9,Disagree,Somewhat agree,Strongly agree,Strongly agree,Disagree,2,5,1,4,3,8,Agree,Strongly agree,Disagree,Somewhat agree,Somewhat disagree,5,3,2,1,4,3,Agree,Somewhat Agree,Disagree,Somewhat Agree,Somewhat Agree,2,1,3,4,5,7,Agree,Agree,Neither agree nor disagree,Disagree,Strongly agree,2,4,3,5,1,6,Strongly agree,Disagree,Agree,Strongly disagree,Agree,2,4,5,1,3,7,Agree,Somewhat Agree,Agree,Strongly agree,Somewhat Agree,2,3,4,5,1,7,Strongly agree,Agree,Neither agree nor disagree,Somewhat disagree,Strongly agree,5,3,1,2,4,4,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,3,1,2,4,7,Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,4,2,1,5,-1,1,2,0,-2,-1,0,2,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),20,02PsVPf,01PAST,10,02DGEN,0.875,0.666666667,0.333333333,3,9,4,6,7,8,5,1,2,2,3,4,1,2,3,3,1,3,2,-1,2,3,3,3,2,3,2,2,0,3,3,3,1,1,1,0,1,1,0,1,0,2,-1,-2,1,3,3,-2,2,3,-2,1,-1,2,1,-2,1,1,2,2,0,-2,3,3,-2,2,-3,2,2,1,2,3,1,3,2,0,-1,3,2,-3,3,-3,3,2,3,3,1,3,3,4,4,9,8,3,7,6,7,7,4,7 +R_3mGqhGhkFRf9EM9,53 - 59,American,Female,Agree,Strongly agree,Somewhat agree,Somewhat disagree,Agree,4,3,5,2,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat agree,Agree,4,1,3,5,2,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly Agree,1,5,2,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Strongly agree,Somewhat agree,Strongly disagree,Agree,5,4,2,1,3,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat agree,Agree,3,5,1,2,4,3,Agree,Somewhat Agree,Agree,Agree,Strongly agree,2,3,4,5,1,4,Agree,Strongly agree,Agree,Strongly disagree,Agree,3,2,5,1,4,3,Disagree,Disagree,Strongly agree,Somewhat agree,Somewhat disagree,3,5,4,2,1,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly agree,Strongly agree,1,4,2,3,5,2,Agree,Strongly agree,Somewhat agree,Somewhat disagree,Strongly agree,5,2,1,4,3,2,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,5,4,1,2,3,2,Somewhat Agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,4,3,2,5,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,4,1,2,3,5,2,Somewhat disagree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,1,5,2,3,4,2,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Strongly agree,5,2,1,3,4,1,2,2,2,-1,2,1,1,5 cents,5 minutes,24 days,Female,College Diploma/Certificate,56,03VPfPs,01PAST,5,02DGEN,0.25,0.666666667,0.333333333,6,5,3,8,7,9,4,1,2,4,2,3,1,2,3,1,-1,2,0,-3,3,1,2,1,0,2,1,3,2,3,1,-3,2,0,-3,3,1,2,2,1,2,2,3,2,3,2,-3,2,-2,-2,3,1,-1,1,1,1,3,3,2,3,1,-1,3,0,-3,3,-1,2,1,1,3,0,3,2,3,2,0,3,-1,-3,3,-1,2,1,1,3,-1,3,3,1,3,4,3,4,2,2,2,2,2,2 +R_1vdKXuobkkmrUjW,32 - 38,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,1,2,Strongly disagree,Somewhat agree,Somewhat agree,Strongly agree,Neither agree nor disagree,4,5,3,1,2,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,3,4,2,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,3,5,0,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,4,2,1,3,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,1,4,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,4,5,3,0,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,4,1,5,2,3,0,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,0,Strongly disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,1,5,3,2,4,0,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,3,5,2,1,4,0,Agree,Agree,Agree,Agree,Agree,2,4,1,5,3,0,Strongly disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,1,2,5,4,3,0,Somewhat Agree,Strongly agree,Somewhat Agree,Somewhat Agree,Agree,5,1,4,3,2,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,-1,-1,1,-1,0,1,-1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,37,02PsVPf,02FUT,5,01ITEM,-0.625,0,1,6,4,8,2,7,3,5,1,9,3,4,2,1,3,3,3,3,3,-3,1,1,3,0,1,2,1,0,2,3,3,3,3,3,-3,-1,1,0,0,1,1,1,1,1,3,3,3,3,3,-3,1,2,1,0,2,2,2,2,2,3,3,3,3,3,-3,0,3,0,1,2,2,2,0,2,2,2,2,2,2,-3,0,2,-1,0,1,3,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0 +R_7WBbf2o6ODdSaGn,53 - 59,American,Female,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,5,2,3,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,3,2,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,3,4,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Agree,Agree,Agree,Agree,Somewhat agree,1,3,2,4,5,4,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,5,3,4,1,5,Agree,Agree,Agree,Somewhat Agree,Agree,5,1,2,3,4,4,Agree,Agree,Agree,Agree,Somewhat agree,3,1,2,4,5,4,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,5,1,4,3,4,Agree,Agree,Agree,Somewhat Agree,Agree,2,4,3,5,1,4,Agree,Agree,Agree,Agree,Somewhat agree,4,3,1,5,2,4,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,4,1,3,5,4,Agree,Agree,Agree,Somewhat Agree,Agree,1,5,4,3,2,4,Agree,Agree,Agree,Agree,Somewhat agree,3,4,5,1,2,4,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,3,5,4,2,1,4,Agree,Agree,Agree,Somewhat Agree,Agree,1,2,4,5,3,0,0,0,1,0,0,0,0,10 cents,25 minutes,15 days,Female,High School (or equivalent),55,03VPfPs,01PAST,5,02DGEN,-0.125,0,0.333333333,5,3,4,7,6,8,9,1,2,4,2,3,1,1,2,2,2,1,0,0,1,0,0,2,1,2,1,2,2,2,2,2,1,0,0,1,0,0,2,2,2,1,2,2,2,2,2,1,0,1,2,0,1,2,2,2,1,2,2,2,2,2,1,1,1,2,0,1,2,2,2,1,2,2,2,2,2,1,0,1,2,0,1,2,2,2,1,2,4,4,5,4,4,4,4,4,4,4,4,4 +R_3NzeTBICrvLndPX,39 - 45,American,Female,Somewhat agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,2,3,4,1,5,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,2,5,4,1,3,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,3,1,2,4,Somewhat disagree,Agree,Agree,Somewhat agree,Somewhat disagree,2,3,5,1,4,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,1,5,3,2,5,Somewhat Agree,Disagree,Agree,Somewhat Agree,Strongly agree,3,4,5,1,2,2,Agree,Agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,1,5,3,2,4,7,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,3,4,2,5,1,7,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly agree,3,4,5,1,2,6,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,2,1,3,5,6,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,4,1,5,5,Somewhat Agree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,4,5,3,1,5,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,3,2,4,5,2,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,2,5,3,4,Somewhat Agree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,5,1,4,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,0,1,1,2,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),45,02PsVPf,02FUT,5,01ITEM,0.25,0,1,9,6,8,7,5,2,3,1,4,2,3,4,1,1,3,2,-1,3,2,-1,1,1,2,1,-1,3,1,3,-1,2,2,1,-1,1,1,0,1,1,1,-2,2,1,3,2,2,-1,0,3,2,1,2,1,3,2,0,2,1,3,1,3,3,0,3,1,-1,1,0,1,1,-1,3,0,3,2,3,3,0,3,2,0,1,1,1,1,-1,3,-1,3,6,5,2,7,7,6,6,5,5,2,4,2 +R_1rxnoxX4FhPFEbz,53 - 59,American,Male,Agree,Somewhat agree,Agree,Somewhat agree,Disagree,4,2,5,1,3,Disagree,Disagree,Agree,Somewhat agree,Agree,4,2,5,1,3,Agree,Somewhat Disagree,Strongly Agree,Disagree,Agree,1,2,5,4,3,Agree,Agree,Strongly agree,Somewhat agree,Disagree,2,1,5,3,4,1,Disagree,Disagree,Agree,Agree,Somewhat agree,2,4,5,3,1,1,Agree,Agree,Agree,Disagree,Strongly agree,2,5,1,4,3,6,Agree,Agree,Agree,Somewhat agree,Disagree,5,1,4,2,3,2,Disagree,Disagree,Agree,Agree,Somewhat agree,2,4,3,1,5,2,Agree,Agree,Agree,Disagree,Agree,3,1,5,2,4,7,Agree,Agree,Agree,Agree,Somewhat disagree,2,1,5,3,4,1,Agree,Strongly disagree,Agree,Somewhat agree,Agree,5,2,3,4,1,2,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Strongly agree,1,2,3,5,4,1,Agree,Somewhat disagree,Agree,Agree,Disagree,1,5,4,3,2,1,Disagree,Disagree,Agree,Agree,Agree,3,2,4,1,5,1,Somewhat Disagree,Somewhat Disagree,Strongly agree,Disagree,Agree,2,5,4,1,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,-1,1,2,1,5 cents,5 minutes,24 days,Male,Trade School (non-military),57,03VPfPs,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,7,4,2,8,3,5,6,1,9,3,4,2,1,2,1,2,1,-2,-2,-2,2,1,2,2,-1,3,-2,2,2,2,3,1,-2,-2,-2,2,2,1,2,2,2,-2,3,2,2,2,1,-2,-2,-2,2,2,1,2,2,2,-2,2,2,2,2,2,-1,2,-3,2,1,2,1,-1,2,-2,3,2,-1,2,2,-2,-2,-2,2,2,2,-1,-1,3,-2,2,1,1,6,2,2,7,1,2,1,1,1,1 +R_3fqxXMhwmdAk8GS,46 - 52,American,Male,Agree,Agree,Agree,Agree,Agree,4,3,1,2,5,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,4,5,1,3,2,Disagree,Disagree,Agree,Agree,Agree,4,2,3,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Agree,Agree,Agree,Agree,Agree,5,4,1,2,3,8,Agree,Agree,Agree,Agree,Agree,5,4,1,3,2,8,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,8,Agree,Agree,Agree,Agree,Agree,4,3,1,2,5,8,Agree,Agree,Agree,Agree,Agree,4,5,2,1,3,8,Agree,Agree,Agree,Agree,Agree,3,4,5,1,2,8,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,8,Agree,Agree,Agree,Agree,Agree,3,4,1,5,2,9,Agree,Agree,Agree,Agree,Agree,1,4,5,3,2,9,Agree,Agree,Agree,Agree,Agree,5,1,2,4,3,7,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,5,2,4,3,8,Somewhat Disagree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,2,4,5,3,1,2,0,-1,-1,-1,-1,1,20 cents,100 minutes,24 days,Male,High School (or equivalent),49,02PsVPf,02FUT,10,02DGEN,1,0,0.666666667,3,9,8,6,5,4,2,1,7,4,2,3,1,2,2,2,2,2,0,1,2,2,2,-2,-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-1,1,1,1,2,-1,1,2,2,1,8,8,8,8,8,8,8,8,9,9,7,8 +R_7TWNJXUYqK0M8Wq,32 - 38,American,Male,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,1,4,3,2,5,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,2,4,1,3,5,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,1,3,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,5,4,1,3,2,3,Strongly agree,Somewhat Agree,Disagree,Disagree,Agree,4,3,1,2,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,1,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,1,4,3,2,3,Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,2,5,4,3,1,3,Somewhat disagree,Strongly disagree,Disagree,Strongly disagree,Disagree,1,5,3,2,4,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Disagree,3,4,2,5,1,3,Agree,Strongly Disagree,Agree,Somewhat Disagree,Strongly agree,4,1,3,5,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,3,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,2,4,1,3,5,3,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Disagree,Disagree,1,5,4,2,3,2,0,-1,1,0,-1,0,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),36,01PfPsV,01PAST,10,02DGEN,0,0,1,9,2,7,5,8,6,4,1,3,3,4,2,1,3,2,3,2,3,-2,1,2,1,-1,2,2,1,0,2,3,3,3,3,3,-1,0,-1,0,1,3,1,-2,-2,2,3,3,3,3,3,-1,3,1,1,-1,2,0,-1,2,0,-1,-3,-2,-3,-2,0,-1,0,-1,-2,2,-3,2,-1,3,3,3,3,3,3,1,-1,0,1,-1,0,3,1,-2,-2,3,2,3,3,1,3,3,3,3,3,3,3 +R_6VZiNTcZWCVvp9D,53 - 59,American,Male,Somewhat agree,Agree,Agree,Agree,Agree,4,5,3,1,2,Somewhat disagree,Disagree,Agree,Disagree,Agree,4,1,2,5,3,Agree,Agree,Agree,Strongly Disagree,Agree,4,3,5,1,2,Somewhat agree,Agree,Agree,Agree,Agree,4,3,5,2,1,1,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,1,4,2,5,3,5,Agree,Agree,Agree,Strongly Disagree,Agree,5,3,2,1,4,1,Somewhat agree,Agree,Agree,Agree,Agree,3,5,1,2,4,1,Disagree,Disagree,Agree,Disagree,Agree,2,5,4,1,3,6,Agree,Agree,Agree,Strongly Disagree,Agree,5,3,1,2,4,2,Somewhat agree,Agree,Agree,Agree,Agree,1,2,5,4,3,1,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,4,5,2,3,1,2,Agree,Agree,Agree,Strongly Disagree,Agree,5,1,2,4,3,0,Somewhat agree,Agree,Agree,Agree,Agree,3,1,4,5,2,0,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Agree,3,1,2,5,4,2,Agree,Agree,Agree,Strongly Disagree,Agree,2,5,3,1,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,0,2,-1,-1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,58,02PsVPf,01PAST,10,01ITEM,0.125,0,1,5,3,2,6,4,8,7,1,9,4,3,2,1,1,2,2,2,2,-1,-2,2,-2,2,2,2,2,-3,2,1,2,2,2,2,-1,-1,2,-1,2,2,2,2,-3,2,1,2,2,2,2,-2,-2,2,-2,2,2,2,2,-3,2,1,2,2,2,2,1,-3,2,-3,2,2,2,2,-3,2,1,2,2,2,2,1,-3,2,-3,2,2,2,2,-3,2,1,5,1,1,6,2,1,2,0,0,2,1 +R_3gUVHPExnQqppYd,53 - 59,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,5,1,Strongly disagree,Strongly disagree,Somewhat agree,Strongly disagree,Somewhat agree,4,3,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Strongly Agree,5,1,4,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,4,1,2,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,4,2,5,3,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,1,2,3,5,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Agree,4,2,3,1,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,1,5,3,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,3,4,2,5,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Agree,4,2,5,3,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,3,5,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,1,3,4,5,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Agree,4,1,2,5,3,-2,-2,-2,2,2,2,2,-2,10 cents,25 minutes,47 days,Female,High School (or equivalent),57,03VPfPs,02FUT,5,02DGEN,-2,0.333333333,0.333333333,5,3,8,2,6,9,4,1,7,4,3,2,1,3,3,3,3,3,-3,-3,1,-3,1,3,3,3,-3,3,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,3,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,3,3,3,3,3,-3,-3,3,-3,-3,3,3,3,-3,2,0,0,0,0,0,0,0,0,5,0,0,0 +R_53Q1871ckrSILOp,32 - 38,American,Male,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,3,2,5,1,4,Somewhat disagree,Strongly disagree,Strongly disagree,Disagree,Strongly agree,3,4,2,5,1,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,Agree,5,2,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,1,5,4,3,2,5,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,2,4,1,5,3,5,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,5,1,4,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,1,5,4,2,5,Disagree,Disagree,Disagree,Strongly disagree,Strongly disagree,2,5,3,4,1,5,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,5,4,2,3,1,5,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,5,2,1,3,4,5,Disagree,Disagree,Disagree,Strongly disagree,Disagree,4,2,5,1,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,5,3,5,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,3,5,2,1,5,Disagree,Disagree,Disagree,Strongly disagree,Disagree,1,3,5,2,4,5,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,1,5,4,1,2,1,1,-2,-2,-1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),36,02PsVPf,02FUT,10,02DGEN,1.125,0,1,9,5,3,6,4,2,8,1,7,3,4,2,1,3,3,3,0,3,-1,-3,-3,-2,3,2,3,1,3,2,3,2,3,3,2,-2,-3,-3,-3,-2,2,3,2,3,3,3,3,3,3,2,-2,-2,-2,-3,-3,3,2,2,3,3,3,2,3,3,3,-2,-2,-2,-3,-2,3,3,3,3,3,2,3,3,2,3,-2,-2,-2,-3,-2,2,3,3,2,3,5,5,5,5,5,5,5,5,5,5,5,5 +R_7MSQwkC8SJ9HsU3,32 - 38,American,Female,Agree,Agree,Agree,Agree,Strongly agree,4,3,5,1,2,Agree,Somewhat disagree,Agree,Strongly agree,Agree,1,2,4,5,3,Somewhat Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,5,2,1,3,4,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Agree,4,3,2,1,5,9,Agree,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,3,4,2,1,5,8,Strongly agree,Agree,Somewhat Disagree,Strongly agree,Strongly agree,1,4,2,3,5,7,Agree,Agree,Somewhat disagree,Somewhat disagree,Somewhat agree,1,2,4,5,3,6,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,2,3,4,5,1,8,Strongly agree,Strongly agree,Somewhat Disagree,Agree,Strongly agree,4,2,1,3,5,8,Agree,Strongly agree,Somewhat agree,Agree,Strongly agree,3,2,1,5,4,6,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,2,4,1,5,3,8,Somewhat Agree,Agree,Strongly agree,Agree,Agree,5,2,1,3,4,9,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,1,4,2,3,5,9,Strongly agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,5,2,1,3,4,9,Agree,Agree,Strongly agree,Strongly agree,Agree,1,4,3,2,5,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,1,-1,-1,-2,1,-1,2,10 cents,5 minutes,24 days,Female,University - Graduate (Masters),34,01PfPsV,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,5,8,4,2,6,7,3,1,9,2,4,3,1,2,2,2,2,3,2,-1,2,3,2,1,2,1,-1,2,1,1,3,3,2,2,1,-1,2,1,3,2,-1,3,3,2,2,-1,-1,1,1,1,-1,2,-1,3,3,-1,2,3,2,3,1,2,3,2,-1,3,-1,3,1,2,3,2,2,3,3,1,1,3,3,-1,3,-2,3,2,2,3,3,2,9,8,7,6,8,8,6,8,9,9,9,9 +R_5pojpy8GIBp7d1G,32 - 38,American,Male,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,2,1,4,3,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,5,2,1,4,3,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,2,5,3,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,5,1,2,3,7,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,1,3,2,4,5,7,Agree,Somewhat Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,1,3,2,8,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,5,3,4,1,2,7,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,3,1,4,2,5,7,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,2,3,4,5,9,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,2,4,5,3,8,Agree,Neither agree nor disagree,Somewhat agree,Agree,Agree,1,2,3,4,5,8,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,5,4,1,3,9,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,8,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,5,3,1,2,4,9,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,5,3,2,1,4,1,1,1,-2,-1,0,0,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,35,01PfPsV,02FUT,5,02DGEN,0.875,0.666666667,0.333333333,4,5,8,3,2,9,7,1,6,2,3,4,1,1,3,3,0,1,0,0,1,0,-1,1,0,2,1,1,2,1,1,0,1,2,0,1,1,2,2,1,2,1,0,1,1,2,2,0,1,1,0,3,1,3,1,0,1,0,2,3,0,1,1,2,0,1,2,2,3,1,0,0,1,0,2,1,0,1,1,1,1,2,2,2,1,0,2,2,9,7,7,8,7,7,9,8,8,9,8,9 +R_1gAb8AYhhuTy3j4,32 - 38,American,Female,Somewhat agree,Agree,Agree,Strongly agree,Agree,5,3,4,2,1,Agree,Agree,Agree,Strongly agree,Strongly agree,1,3,5,4,2,Strongly Agree,Agree,Somewhat Agree,Agree,Strongly Agree,5,1,4,3,2,Agree,Somewhat agree,Agree,Strongly agree,Agree,3,4,1,2,5,8,Agree,Agree,Somewhat agree,Strongly agree,Agree,1,4,3,2,5,8,Agree,Agree,Somewhat Agree,Strongly agree,Agree,4,3,5,2,1,8,Agree,Agree,Strongly agree,Agree,Strongly agree,3,5,2,1,4,9,Strongly agree,Agree,Agree,Agree,Somewhat agree,2,1,5,3,4,9,Strongly agree,Agree,Somewhat Agree,Agree,Strongly agree,4,1,5,3,2,8,Somewhat agree,Agree,Strongly agree,Strongly agree,Agree,3,1,2,5,4,8,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,2,5,4,3,1,7,Agree,Agree,Somewhat Agree,Strongly agree,Agree,2,5,4,3,1,8,Agree,Strongly agree,Somewhat agree,Agree,Agree,5,2,4,1,3,8,Agree,Strongly agree,Agree,Agree,Somewhat agree,1,2,5,3,4,8,Agree,Strongly agree,Strongly agree,Agree,Somewhat Agree,3,5,2,1,4,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,1,-1,0,-1,-1,2,5 cents,5 minutes,24 days,Female,University - Undergraduate,34,01PfPsV,01PAST,10,01ITEM,1.125,0.666666667,0.333333333,4,5,3,7,8,9,6,1,2,3,4,2,1,1,2,2,3,2,2,2,2,3,3,3,2,1,2,3,2,1,2,3,2,2,2,1,3,2,2,2,1,3,2,2,2,3,2,3,3,2,2,2,1,3,2,1,2,3,1,2,3,3,2,2,1,3,1,2,2,2,1,3,2,2,3,1,2,2,2,3,2,2,1,2,3,3,2,1,8,8,8,9,9,8,8,7,8,8,8,9 +R_3ZKoWq577jbPQow,32 - 38,American,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,3,2,4,1,Strongly agree,Neither agree nor disagree,Agree,Strongly agree,Strongly agree,2,3,1,5,4,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Agree,2,5,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Somewhat disagree,Somewhat agree,Strongly agree,3,5,2,1,4,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,2,1,5,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,5,1,3,4,5,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,Strongly agree,2,3,5,1,4,5,Strongly agree,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly agree,4,3,5,2,1,5,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,3,1,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,9,Agree,Agree,Somewhat Agree,Agree,Agree,2,3,1,4,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,5,4,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,2,3,0,0,0,-1,0,-1,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),38,01PfPsV,01PAST,5,02DGEN,0.25,0,1,8,3,7,5,9,4,6,1,2,2,4,3,1,3,3,3,2,3,3,0,2,3,3,3,3,2,3,2,3,3,-1,1,3,3,3,3,3,3,3,3,2,3,3,3,3,-1,3,3,3,0,1,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,6,5,5,5,5,5,7,9,5,7,10 +R_7cdr4IBGZHAfx8M,32 - 38,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,3,4,1,Strongly agree,Disagree,,Disagree,Strongly agree,5,4,2,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,1,5,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,2,3,1,5,6,Agree,Somewhat disagree,Somewhat agree,Strongly disagree,Somewhat agree,3,1,5,2,4,7,Strongly agree,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,5,4,2,1,3,6,Agree,Agree,Agree,Strongly agree,Agree,2,5,4,1,3,6,Strongly agree,Disagree,Agree,Disagree,Agree,1,3,4,5,2,6,Somewhat Agree,Strongly agree,Agree,Agree,Agree,5,1,4,2,3,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,3,1,6,Somewhat agree,Agree,Agree,Somewhat agree,Agree,3,2,5,4,1,10,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Agree,5,2,4,1,3,6,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,1,3,4,2,7,Agree,Disagree,Strongly agree,Disagree,Agree,5,1,4,2,3,6,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,3,1,2,5,4,1,1,0,1,0,0,1,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),37,03VPfPs,02FUT,5,02DGEN,0,1,0,7,9,5,2,4,6,3,1,8,2,4,3,1,3,3,3,3,3,3,-2,,-2,3,3,3,3,1,2,2,3,2,3,3,2,-1,1,-3,1,3,2,1,2,0,2,2,2,3,2,3,-2,2,-2,2,1,3,2,2,2,3,3,3,3,3,1,2,2,1,2,1,1,1,3,1,2,2,2,1,1,2,-2,3,-2,2,1,2,1,2,2,6,6,7,6,6,6,6,6,10,6,7,6 +R_5JAxGZ58mS8RU8F,39 - 45,American,Male,Agree,Agree,Agree,Agree,Somewhat agree,2,5,1,3,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,5,4,3,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Somewhat Agree,2,5,3,4,1,Strongly agree,Agree,Somewhat agree,Agree,Agree,2,3,4,5,1,7,Agree,Somewhat agree,Agree,Somewhat agree,Agree,2,3,4,1,5,7,Strongly agree,Agree,Strongly agree,Agree,Agree,2,5,4,1,3,8,Agree,Somewhat agree,Agree,Somewhat disagree,Agree,5,2,4,1,3,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,4,3,5,8,Agree,Strongly agree,Agree,Agree,Somewhat Agree,3,4,5,1,2,8,Agree,Agree,Strongly agree,Agree,Strongly agree,3,1,2,4,5,7,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,5,4,1,3,2,6,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,5,2,4,1,3,8,Agree,Agree,Somewhat agree,Agree,Agree,3,1,2,4,5,6,Somewhat agree,Strongly agree,Agree,Agree,Agree,2,4,3,5,1,7,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,2,4,5,1,3,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-1,-1,0,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),45,03VPfPs,02FUT,10,01ITEM,0.875,0,1,7,6,8,9,4,3,5,1,2,3,2,4,1,2,2,2,2,1,1,1,0,1,0,1,0,3,1,1,3,2,1,2,2,2,1,2,1,2,3,2,3,2,2,2,1,2,-1,2,1,1,1,-1,1,2,3,2,2,1,2,2,3,2,3,0,-2,2,-2,1,2,2,0,1,0,2,2,1,2,2,1,3,2,2,2,1,2,1,2,2,7,7,8,7,8,8,7,6,8,6,7,7 +R_7wi7GdqCMrWyYru,53 - 59,American,Male,Agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,3,5,4,1,2,Somewhat agree,Neither agree nor disagree,Agree,Disagree,Somewhat agree,1,2,3,5,4,Strongly Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,1,4,3,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,1,4,3,2,5,1,Agree,Somewhat disagree,Strongly agree,Disagree,Agree,2,3,5,4,1,1,Strongly agree,Disagree,Strongly agree,Agree,Strongly agree,3,4,1,2,5,1,Agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,4,2,1,5,3,4,Somewhat agree,Disagree,Strongly agree,Disagree,Somewhat agree,1,5,3,4,2,1,Strongly agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,5,3,1,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,3,1,5,2,4,2,Agree,Neither agree nor disagree,Strongly agree,Disagree,Agree,3,1,4,5,2,2,Strongly agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,5,1,3,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,2,3,1,4,3,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,4,5,2,1,3,3,Strongly agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Strongly agree,4,1,2,3,5,1,2,0,2,0,-1,2,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),56,02PsVPf,01PAST,10,02DGEN,0.125,0,1,6,7,3,5,8,9,4,1,2,4,2,3,1,2,3,3,-1,2,1,0,2,-2,1,3,-1,3,1,3,3,3,3,-1,2,2,-1,3,-2,2,3,-2,3,2,3,2,3,3,-1,2,1,-2,3,-2,1,3,-2,3,1,3,3,3,3,1,2,2,0,3,-2,2,3,-2,3,1,3,3,3,3,1,3,2,0,3,-1,2,3,-1,3,1,3,1,1,1,1,4,1,1,2,2,1,3,3 +R_5VJE2Al6ZZjj9rs,46 - 52,American,Female,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Agree,5,2,4,3,1,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,1,3,4,5,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,2,5,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,5,2,4,0,Agree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Strongly agree,5,2,4,3,1,4,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,5,1,3,0,Agree,Agree,Disagree,Agree,Agree,2,1,5,4,3,7,Agree,Agree,Agree,Agree,Neither Agree nor Disagree,4,1,5,3,2,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,0,Agree,Disagree,Agree,Disagree,Agree,2,5,4,1,3,3,Neither Agree nor Disagree,Agree,Agree,Disagree,Agree,5,4,2,1,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,3,2,0,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,3,4,2,1,5,2,Neither Agree nor Disagree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,4,5,3,1,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,-2,1,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,51,03VPfPs,02FUT,5,01ITEM,0.25,0,1,9,2,3,8,7,5,6,1,4,2,4,3,1,3,3,2,0,2,1,-1,1,-1,1,0,1,3,0,2,3,3,3,3,3,2,0,-2,0,3,0,2,2,0,2,3,3,3,3,3,2,2,-2,2,2,2,2,2,2,0,3,3,3,3,3,2,-2,2,-2,2,0,2,2,-2,2,3,3,3,3,3,3,-2,3,-2,3,0,3,3,0,3,0,4,0,0,7,6,0,3,1,0,2,6 +R_7OHu5BnNsLKHuNj,46 - 52,American,Male,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,5,4,1,3,Agree,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat agree,2,4,1,5,3,Agree,Agree,Agree,Somewhat Agree,Strongly Agree,1,5,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,5,3,1,2,3,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,5,4,2,1,3,3,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly agree,4,1,3,2,5,2,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,4,3,2,1,5,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,4,2,3,5,1,2,Agree,Agree,Somewhat Agree,Somewhat Agree,Strongly agree,3,2,1,4,5,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,3,5,2,1,3,Agree,Disagree,Agree,Somewhat disagree,Agree,2,5,4,3,1,3,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,4,1,3,2,5,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,1,2,4,3,5,2,Agree,Strongly disagree,Agree,Disagree,Agree,2,5,3,1,4,2,Agree,Agree,Agree,Somewhat Agree,Strongly agree,3,1,4,5,2,1,2,1,2,-1,-1,1,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,46,02PsVPf,02FUT,5,02DGEN,0.5,0.333333333,0.666666667,5,8,3,2,6,9,4,1,7,3,2,4,1,1,2,1,0,1,2,0,2,-1,1,2,2,2,1,3,2,3,2,0,2,1,-2,2,-2,1,2,2,1,1,3,2,3,1,0,2,1,-2,2,-2,1,2,2,1,1,3,2,3,2,0,2,2,-2,2,-1,2,2,2,2,0,3,2,3,2,0,2,2,-3,2,-2,2,2,2,2,1,3,3,3,3,2,2,2,2,3,3,2,2,2 +R_5HRX2XpRV0bRhHr,46 - 52,American,Female,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,2,1,3,5,4,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,3,5,2,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,1,4,5,3,2,Agree,Somewhat disagree,Somewhat agree,Agree,Disagree,5,3,4,2,1,5,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,Strongly agree,4,2,1,5,3,5,Disagree,Somewhat Agree,Somewhat Agree,Disagree,Somewhat Disagree,5,3,4,1,2,7,Agree,Strongly agree,Agree,Agree,Strongly agree,1,2,3,4,5,5,Strongly agree,Somewhat disagree,Agree,Strongly agree,Somewhat disagree,5,1,4,2,3,7,Somewhat Agree,Agree,Somewhat Agree,Agree,Disagree,4,5,1,2,3,6,Agree,Strongly disagree,Agree,Agree,Agree,5,2,4,1,3,6,Agree,Somewhat disagree,Strongly agree,Agree,Strongly agree,3,2,5,1,4,7,Agree,Disagree,Somewhat Agree,Disagree,Agree,2,1,4,3,5,7,Somewhat agree,Agree,Strongly agree,Agree,Somewhat disagree,1,2,5,4,3,6,Agree,Disagree,Somewhat agree,Agree,Somewhat disagree,4,1,2,5,3,6,Agree,Agree,Agree,Disagree,Disagree,5,1,3,4,2,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,-1,-1,-1,-1,-1,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),46,01PfPsV,01PAST,10,01ITEM,0.875,1,0,7,6,4,9,2,5,3,1,8,4,3,2,1,3,2,3,2,3,1,3,3,2,3,3,3,3,3,3,2,-1,1,2,-2,-1,1,-2,1,3,-2,1,1,-2,-1,2,3,2,2,3,3,-1,2,3,-1,1,2,1,2,-2,2,-3,2,2,2,2,-1,3,2,3,2,-2,1,-2,2,1,2,3,2,-1,2,-2,1,2,-1,2,2,2,-2,-2,5,5,7,5,7,6,6,7,7,6,6,6 +R_1ZO1xvKwGSBo58Z,53 - 59,American,Male,Strongly agree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,5,4,2,3,Strongly disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,1,4,2,3,5,Somewhat Agree,Somewhat Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,3,2,4,5,Strongly agree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,2,1,3,4,5,2,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Disagree,1,4,2,5,3,2,Somewhat Agree,Somewhat Disagree,Agree,Strongly Disagree,Strongly agree,3,2,5,1,4,1,Strongly agree,Agree,Agree,Somewhat agree,Somewhat disagree,3,5,1,2,4,2,Strongly disagree,Somewhat agree,Somewhat agree,Agree,Strongly disagree,3,2,4,5,1,2,Agree,Somewhat Disagree,Agree,Strongly Disagree,Agree,4,5,1,3,2,2,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly disagree,5,2,3,4,1,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,5,2,1,3,1,Neither Agree nor Disagree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,5,3,2,1,1,Strongly agree,Agree,Strongly agree,Agree,Disagree,5,4,2,1,3,1,Disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Disagree,3,2,5,4,1,2,Neither Agree nor Disagree,Disagree,Agree,Strongly Disagree,Strongly agree,1,4,2,5,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,2,2,1,10 cents,5 minutes,47 days,Male,University - Undergraduate,59,01PfPsV,01PAST,10,01ITEM,0.125,0.666666667,0.333333333,7,6,8,4,2,3,5,1,9,3,2,4,1,3,2,3,1,0,-3,0,1,1,-1,1,-1,3,-3,3,3,2,2,0,-1,-3,1,2,1,-2,1,-1,2,-3,3,3,2,2,1,-1,-3,1,1,2,-3,2,-1,2,-3,2,3,2,3,3,-3,-3,0,0,0,-2,0,-2,3,-3,3,3,2,3,2,-2,-2,0,0,2,-2,0,-2,2,-3,3,2,2,1,2,2,2,1,1,1,1,2,2 +R_5tyB2FOKuWGLorY,46 - 52,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,5,1,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,1,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,5,3,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,4,1,5,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,4,5,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,1,2,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,5,4,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,2,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,4,5,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,3,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,5,4,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,2,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,-2,2,2,2,-2,-2,2,10 cents,100 minutes,24 days,Male,High School (or equivalent),48,02PsVPf,01PAST,5,01ITEM,0.5,0,1,6,3,4,9,5,7,8,1,2,4,3,2,1,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_1EbpiVsMOtHs4Lq,46 - 52,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,3,4,5,1,2,Agree,Disagree,Somewhat agree,Somewhat agree,Strongly agree,3,5,2,4,1,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,2,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Agree,Agree,Somewhat agree,Agree,3,1,5,4,2,6,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,5,1,4,3,2,6,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,5,3,4,1,2,6,Agree,Agree,Agree,Somewhat disagree,Agree,3,1,5,4,2,6,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Agree,5,3,2,4,1,3,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,5,2,4,1,3,3,Agree,Agree,Somewhat agree,Agree,Strongly agree,1,5,3,2,4,3,Strongly agree,Disagree,Strongly agree,Somewhat disagree,Strongly agree,4,5,1,2,3,3,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,1,5,4,2,3,4,Strongly agree,Agree,Somewhat agree,Somewhat agree,Strongly agree,5,1,4,3,2,3,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,2,4,3,5,1,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Disagree,Strongly agree,5,3,4,1,2,0,2,1,2,0,1,2,1,10 cents,5 minutes,24 days,Female,High School (or equivalent),52,03VPfPs,02FUT,10,02DGEN,-0.125,0.333333333,0.666666667,5,4,9,2,8,3,6,1,7,3,4,2,1,3,3,2,1,3,2,-2,1,1,3,0,-1,3,-1,3,2,2,2,1,2,-1,-1,-1,1,1,0,1,3,1,3,2,2,2,-1,2,-1,0,-1,0,2,0,1,3,1,3,2,2,1,2,3,3,-2,3,-1,3,0,-1,3,-1,3,3,2,1,1,3,3,-2,3,-2,3,0,0,3,-2,3,6,6,6,6,6,3,3,3,3,4,3,4 +R_3kMLtCcYqtnxMs9,25 - 31,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,2,3,5,1,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,2,1,3,5,4,Agree,Agree,Agree,Disagree,Agree,2,5,4,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,3,2,4,1,0,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,3,4,1,2,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,2,1,5,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,5,1,2,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,3,1,4,2,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,2,5,2,Somewhat agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,3,2,5,4,1,3,Strongly agree,Strongly agree,Agree,Somewhat Disagree,Agree,4,5,2,3,1,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,4,2,3,1,0,Somewhat agree,Strongly disagree,Disagree,Strongly disagree,Somewhat agree,3,2,1,4,5,0,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,3,4,5,2,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,0,-2,-1,0,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,01PfPsV,02FUT,5,01ITEM,0.75,0,1,9,7,4,2,6,8,5,1,3,2,3,4,1,3,3,3,3,2,1,-3,2,-2,2,2,2,2,-2,2,3,3,3,3,2,1,-3,2,-3,1,3,3,3,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,-3,3,3,3,3,3,3,1,-3,1,-3,3,3,3,2,-1,2,3,3,3,1,3,1,-3,-2,-3,1,3,3,3,-2,3,0,0,0,0,1,0,2,3,1,0,0,0 +R_6VXErvAGvyR9YcN,39 - 45,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,1,3,5,4,Agree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,4,1,5,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,2,4,5,1,3,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,4,3,4,Agree,Strongly disagree,Strongly agree,Somewhat disagree,Agree,5,1,4,2,3,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,4,5,1,6,Agree,Somewhat agree,Strongly agree,Agree,Agree,3,1,4,5,2,5,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,2,5,4,3,1,9,Strongly agree,Strongly agree,Agree,Agree,Agree,2,3,1,5,4,8,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,5,1,4,3,2,8,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,4,2,9,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,1,4,5,2,9,Strongly agree,Agree,Strongly agree,Agree,Agree,2,3,5,4,1,9,Strongly agree,Disagree,Agree,Disagree,Strongly agree,4,2,1,5,3,6,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,4,5,3,2,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,1,-1,0,-1,0,10 cents,25 minutes,24 days,Male,High School (or equivalent),45,03VPfPs,01PAST,5,01ITEM,0.25,0,0.666666667,7,5,3,2,9,4,8,1,6,4,3,2,1,2,3,3,2,3,2,-2,3,0,3,3,3,3,3,3,2,3,3,3,3,2,-3,3,-1,2,3,3,3,3,3,2,1,3,2,2,3,3,3,2,2,3,3,2,2,2,3,2,3,2,3,2,2,3,3,3,3,3,3,2,2,3,2,3,2,2,3,-2,2,-2,3,3,2,3,2,3,4,8,6,5,9,8,8,9,9,9,6,8 +R_3clUNkVPjmHaZjz,25 - 31,American,Male,Disagree,Disagree,Strongly disagree,Disagree,Disagree,3,5,4,1,2,Neither agree nor disagree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly disagree,3,2,5,1,4,Disagree,Strongly Disagree,Disagree,Disagree,Strongly Disagree,4,5,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,5,4,1,2,3,6,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,5,2,9,Agree,Agree,Agree,Strongly agree,Agree,2,1,4,3,5,10,Agree,Strongly agree,Agree,Strongly agree,Agree,1,5,4,3,2,8,Agree,Agree,Agree,Strongly agree,Agree,3,5,4,2,1,9,Agree,Agree,Strongly agree,Agree,Agree,2,5,4,3,1,8,Agree,Somewhat agree,Agree,Agree,Strongly agree,5,1,2,3,4,6,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,3,4,2,5,9,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,5,1,4,2,8,Somewhat agree,Agree,Strongly agree,Agree,Agree,2,4,5,3,1,7,Disagree,Strongly disagree,Strongly disagree,Disagree,Disagree,5,1,3,4,2,2,Agree,Agree,Agree,Strongly agree,Agree,3,1,5,4,2,2,1,1,-2,-2,-2,-2,2,10 cents,25 minutes,24 days,Male,University - Graduate (Masters),30,02PsVPf,02FUT,10,02DGEN,1.75,0,0.666666667,3,2,7,6,9,8,4,1,5,4,2,3,1,-2,-2,-3,-2,-2,0,-3,-3,-3,-3,-2,-3,-2,-2,-3,3,2,3,2,3,2,2,3,3,3,2,2,2,3,2,2,3,2,3,2,2,2,2,3,2,2,2,3,2,2,2,1,2,2,3,2,2,2,1,1,2,1,2,2,1,1,2,3,2,2,-2,-3,-3,-2,-2,2,2,2,3,2,7,6,9,10,8,9,8,6,9,8,7,2 +R_7j70UobCuokAOxM,39 - 45,American,Male,Agree,Agree,Somewhat agree,Agree,Strongly agree,3,4,2,1,5,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,3,5,2,4,Agree,Somewhat Agree,Agree,Agree,Agree,4,5,3,1,2,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,4,5,3,1,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,4,1,1,Agree,Somewhat Agree,Strongly agree,Agree,Agree,5,2,3,4,1,0,Agree,Agree,Agree,Agree,Strongly agree,3,5,1,2,4,0,Strongly agree,Strongly disagree,Agree,Strongly disagree,Agree,3,2,1,4,5,0,Agree,Agree,Agree,Agree,Agree,5,2,1,3,4,1,Agree,Agree,Agree,Agree,Strongly agree,4,3,2,5,1,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,5,1,4,3,0,Agree,Somewhat Agree,Strongly agree,Agree,Agree,1,4,2,5,3,1,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,1,4,5,2,3,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,5,4,2,1,0,Agree,Somewhat Agree,Agree,Agree,Agree,1,3,5,2,4,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,-1,2,0,0,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,42,01PfPsV,02FUT,5,01ITEM,-0.25,0,1,3,6,2,8,7,5,9,1,4,4,3,2,1,2,2,1,2,3,3,-3,3,-3,2,2,1,2,2,2,3,3,2,3,3,2,-3,3,-3,3,2,1,3,2,2,2,2,2,2,3,3,-3,2,-3,2,2,2,2,2,2,2,2,2,2,3,3,-3,3,-3,2,2,1,3,2,2,3,3,2,3,3,3,-3,3,-3,3,2,1,2,2,2,1,1,0,0,0,1,1,0,1,1,0,0 +R_5rJc2mbExmI4CgM,39 - 45,American,Female,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,1,5,3,2,Agree,Agree,Agree,Strongly agree,Strongly agree,2,3,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,3,4,5,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,4,2,1,5,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,3,5,2,4,1,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,3,5,4,2,1,5,Somewhat agree,Somewhat agree,Agree,Agree,Neither agree nor disagree,1,3,4,5,2,7,Agree,Agree,Somewhat agree,Somewhat agree,Agree,3,4,1,5,2,5,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,1,4,2,3,5,8,Somewhat agree,Agree,Agree,Somewhat agree,Somewhat agree,1,2,3,5,4,7,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,5,3,1,2,7,Agree,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,2,1,4,3,5,5,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,5,3,4,2,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,4,1,3,1,0,0,1,0,0,-1,0,10 cents,25 minutes,24 days,Female,University - Graduate (Masters),44,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,8,3,4,2,5,7,9,1,6,3,4,2,1,3,3,3,0,3,2,2,2,3,3,3,3,3,2,3,1,1,1,0,2,1,1,1,2,0,0,1,1,1,0,1,1,2,2,0,2,2,1,1,2,1,2,0,1,2,1,2,2,1,1,0,1,2,1,1,2,1,1,2,1,1,1,2,0,1,1,1,1,1,2,0,1,1,1,1,5,5,5,5,7,5,8,7,7,5,7,5 +R_3FEXLdp8m64IynT,18 - 24,American,Female,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,5,2,1,3,Strongly agree,Somewhat agree,Agree,Disagree,Somewhat agree,5,3,2,1,4,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,3,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Somewhat agree,Agree,Strongly agree,Agree,Agree,2,1,3,4,5,3,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,1,2,5,3,4,4,Strongly agree,Agree,Agree,Somewhat Agree,Somewhat Agree,4,2,5,3,1,4,Somewhat agree,Agree,Somewhat agree,Strongly agree,Strongly agree,1,5,4,2,3,4,Agree,Neither agree nor disagree,Agree,Somewhat agree,Strongly agree,4,3,5,1,2,5,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,Agree,1,4,5,2,3,4,Agree,Somewhat agree,Somewhat agree,Strongly agree,Agree,4,2,1,3,5,5,Strongly agree,Agree,Somewhat agree,Somewhat agree,Agree,1,3,2,4,5,3,Agree,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,5,4,2,1,3,5,Strongly agree,Agree,Somewhat agree,Somewhat agree,Agree,2,4,1,3,5,4,Agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,3,2,1,5,5,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Agree,5,2,3,1,4,1,-2,-1,1,0,0,2,-1,5 cents,5 minutes,47 days,Female,University - Undergraduate,20,01PfPsV,01PAST,5,02DGEN,-0.75,1,0,7,6,2,5,9,4,3,1,8,4,2,3,1,1,3,3,2,3,3,1,2,-2,1,2,2,2,0,3,1,2,3,2,2,2,-1,1,1,2,3,2,2,1,1,1,2,1,3,3,2,0,2,1,3,1,3,1,3,2,2,1,1,3,2,3,2,1,1,2,2,1,2,2,0,3,2,1,1,2,2,1,3,0,1,1,3,0,1,2,3,3,4,4,4,5,4,5,3,5,4,5 +R_5qw4FyRzRbtgw9U,46 - 52,American,Female,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,5,2,4,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,3,5,4,Strongly Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,1,4,2,5,3,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,4,5,5,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,5,2,1,3,4,3,Strongly agree,Somewhat Disagree,Agree,Somewhat Agree,Strongly agree,4,2,3,5,1,3,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,3,5,1,4,2,3,Agree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,4,2,5,3,1,6,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,4,1,2,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,2,1,6,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,3,2,5,3,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,2,5,3,4,1,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,3,1,4,6,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,2,3,5,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,4,3,1,5,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,2,2,-2,2,10 cents,5 minutes,36 days,Female,College Diploma/Certificate,48,01PfPsV,01PAST,5,01ITEM,0.5,0.333333333,0.333333333,5,3,9,4,6,7,2,1,8,4,2,3,1,3,3,3,2,3,3,-3,3,-3,3,3,-2,3,0,3,3,3,3,1,3,2,-1,3,-1,1,3,-1,2,1,3,3,3,3,-1,3,2,1,3,-1,3,3,1,3,1,3,3,3,3,3,3,3,-3,3,-3,3,3,-2,3,-2,3,3,3,3,3,3,3,-3,3,-3,3,3,-3,3,-3,3,5,3,3,3,6,6,6,3,7,6,2,7 +R_5nO7JKL3G0dS2bn,39 - 45,American,Male,Agree,Agree,Somewhat agree,Somewhat agree,Strongly agree,2,3,5,4,1,Agree,Disagree,Strongly agree,Disagree,Agree,5,2,4,3,1,Strongly Agree,Agree,Agree,Agree,Somewhat Agree,4,5,3,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Agree,Agree,Strongly agree,4,3,1,5,2,1,Agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,1,5,3,2,4,1,Agree,Strongly agree,Agree,Agree,Agree,1,4,2,3,5,4,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Agree,Agree,3,2,5,1,4,3,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,4,1,4,Somewhat Agree,Agree,Agree,Agree,Somewhat Disagree,4,1,2,5,3,1,Agree,Agree,Agree,Agree,Strongly agree,4,5,2,3,1,2,Strongly agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Agree,3,4,5,2,1,1,Strongly agree,Agree,Agree,Somewhat Agree,Somewhat Agree,1,2,3,5,4,1,Agree,Agree,Somewhat agree,Somewhat agree,Strongly agree,5,4,2,1,3,1,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,2,4,5,1,1,Strongly agree,Agree,Agree,Somewhat Agree,Agree,3,4,1,5,2,2,1,1,0,1,1,1,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),44,02PsVPf,02FUT,10,02DGEN,0.25,0.333333333,0.666666667,9,4,7,2,6,3,8,1,5,4,2,3,1,2,2,1,1,3,2,-2,3,-2,2,3,2,2,2,1,2,2,2,2,3,2,0,2,1,2,2,3,2,2,2,-1,0,-1,2,2,2,2,1,1,1,1,2,2,2,-1,2,2,2,2,3,3,-1,3,0,2,3,2,2,1,1,2,2,1,1,3,2,-3,3,-3,2,3,2,2,1,2,1,1,1,4,3,4,1,2,1,1,1,1 +R_1h3K0jsRcJsFD1X,53 - 59,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,2,5,1,4,3,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,4,2,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,2,5,2,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Strongly agree,4,3,1,5,2,1,Somewhat Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,5,3,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,5,4,1,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,2,4,1,3,5,1,Somewhat Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,4,3,1,5,2,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,2,1,4,3,5,2,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,5,2,3,4,1,1,Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,2,3,4,1,2,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,1,4,3,2,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,4,3,2,1,5,2,Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,3,2,4,2,2,2,2,-1,2,2,2,5 cents,5 minutes,47 days,Male,Professional Degree (ex. JD/MD),53,02PsVPf,01PAST,5,02DGEN,0.375,1,0,9,2,4,6,3,5,7,1,8,2,4,3,1,3,3,3,3,3,1,1,1,1,3,-1,-1,1,-1,1,3,3,3,3,3,1,1,1,2,3,-1,-1,3,-1,3,3,3,3,3,3,3,1,1,1,3,-1,-1,3,-1,3,3,3,3,1,3,3,1,1,1,3,-2,-1,3,-1,3,3,3,3,0,3,3,1,1,1,3,-2,-1,3,-1,3,0,2,1,1,1,1,2,2,1,2,2,2 +R_6QkSavkG5z1tjC9,46 - 52,American,Female,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,2,4,Strongly agree,Strongly disagree,Agree,Strongly agree,Strongly disagree,1,5,4,3,2,Strongly Agree,Strongly Agree,Agree,Strongly Disagree,Strongly Agree,2,5,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,3,4,10,Strongly disagree,Strongly agree,Agree,Strongly agree,Strongly disagree,3,2,1,5,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,3,1,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,5,2,1,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,2,5,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,1,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,5,2,9,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,5,2,1,4,3,6,Strongly agree,Strongly agree,Somewhat Agree,Strongly Disagree,Strongly Disagree,2,3,5,4,1,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,4,3,5,6,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,1,5,3,4,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,3,1,1,1,2,2,0,-2,0,2,10 cents,75 minutes,24 days,Female,University - Graduate (Masters),49,01PfPsV,02FUT,5,02DGEN,0.75,0,0.666666667,7,6,8,9,2,3,4,1,5,2,4,3,1,1,3,3,3,3,3,-3,2,3,-3,3,3,2,-3,3,-1,3,3,3,3,-3,3,2,3,-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,-3,3,3,-3,3,3,1,-3,-3,2,3,3,3,3,1,1,3,3,-3,3,3,3,3,3,6,10,5,7,9,6,1,9,6,6,6,5 +R_53wEiY3XjSxYDNq,39 - 45,American,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,4,1,Strongly agree,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,Agree,Agree,Agree,Agree,Agree,2,5,1,4,3,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,1,3,10,Strongly agree,Strongly agree,Strongly agree,Disagree,Agree,4,5,3,1,2,10,Agree,Strongly agree,Agree,Agree,Strongly agree,2,5,3,1,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,2,3,10,Agree,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,1,3,4,2,5,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,5,2,10,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,5,4,10,Agree,Strongly agree,Agree,Somewhat disagree,Agree,2,4,1,5,3,10,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,5,1,4,3,10,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,2,1,5,10,Agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,1,3,2,5,4,10,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,4,1,2,5,3,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,-1,2,-2,-2,1,1,5 cents,5 minutes,47 days,Male,University - PhD,39,02PsVPf,01PAST,10,01ITEM,0.625,1,0,8,5,2,6,4,3,7,1,9,2,3,4,1,1,3,3,3,3,3,0,3,3,3,2,2,2,2,2,0,3,3,3,3,3,3,3,-2,2,2,3,2,2,3,3,3,3,3,3,2,0,3,2,3,3,3,3,3,3,0,3,3,3,3,2,3,2,-1,2,2,3,3,3,2,0,3,3,3,3,2,3,2,-1,3,3,3,2,3,2,10,10,10,10,10,10,10,10,10,10,10,10 +R_7OkvKlTNtNPfycF,32 - 38,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,5,4,1,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,4,5,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,3,4,8,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly agree,3,4,5,1,2,9,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,3,1,4,5,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,5,4,3,2,8,Agree,Agree,Agree,Agree,Agree,2,4,1,5,3,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,5,2,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,5,2,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,4,1,3,8,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,1,4,5,2,3,8,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,2,3,1,4,8,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,1,5,2,3,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,-1,-1,-1,-1,1,15 cents,100 minutes,47 days,Female,High School (or equivalent),33,03VPfPs,02FUT,5,01ITEM,0.875,0.333333333,0.333333333,6,4,5,9,3,7,2,1,8,2,4,3,1,3,3,3,3,2,-3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,-3,0,0,2,3,3,3,2,3,3,3,3,3,3,1,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,0,3,3,0,0,0,0,0,0,0,0,3,0,0,0,8,9,8,8,9,9,8,8,8,8,8,8 +R_5trOjbJAYu7DiCD,32 - 38,American,Female,Agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,4,3,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,1,5,2,4,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,4,3,1,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Strongly agree,Agree,Agree,Agree,4,3,5,2,1,2,Strongly disagree,Strongly disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,1,4,5,2,2,Agree,Agree,Somewhat Agree,Disagree,Agree,4,2,3,5,1,2,Agree,Strongly agree,Agree,Neither agree nor disagree,Agree,3,5,1,2,4,2,Strongly disagree,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat disagree,4,1,2,3,5,2,Strongly agree,Agree,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,4,1,2,5,3,2,Agree,Strongly agree,Somewhat agree,Agree,Somewhat agree,4,1,5,3,2,2,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,2,Agree,Strongly agree,Agree,Disagree,Strongly agree,4,5,1,2,3,2,Agree,Strongly agree,Somewhat agree,Agree,Somewhat agree,1,2,5,3,4,2,Strongly disagree,Disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,4,3,2,1,2,Agree,Agree,Agree,Strongly Disagree,Strongly agree,5,4,2,3,1,1,0,1,2,1,-1,2,0,5 cents,100 minutes,47 days,Female,University - Undergraduate,35,02PsVPf,02FUT,10,02DGEN,-0.25,0.666666667,0.333333333,7,9,8,5,2,4,6,1,3,2,3,4,1,2,3,1,1,1,-3,-2,3,1,0,2,2,1,-1,2,2,3,2,2,2,-3,-3,3,1,0,2,2,1,-2,2,2,3,2,0,2,-3,-3,3,-1,-1,3,2,0,-3,3,2,3,1,2,1,-3,-2,3,1,0,2,3,2,-2,3,2,3,1,2,1,-3,-2,3,1,0,2,2,2,-3,3,2,2,2,2,2,2,2,2,2,2,2,2 +R_6t4FWdg3Pl1nymt,46 - 52,American,Female,Neither agree nor disagree,Agree,Somewhat disagree,Somewhat disagree,Agree,3,1,5,4,2,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,3,4,2,1,5,Somewhat Agree,Agree,Agree,Agree,Agree,3,1,2,4,5,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,Agree,4,3,1,2,5,2,Agree,Disagree,Agree,Neither agree nor disagree,Agree,5,4,2,1,3,1,Agree,Agree,Agree,Somewhat Agree,Agree,2,5,1,4,3,1,Somewhat disagree,Agree,Agree,Somewhat agree,Agree,4,1,2,5,3,2,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,5,2,4,2,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Somewhat Disagree,Neither Agree nor Disagree,3,5,4,2,1,7,Somewhat agree,Strongly agree,Somewhat disagree,Somewhat disagree,Strongly agree,4,5,1,2,3,1,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,3,2,5,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,4,3,1,Agree,Strongly agree,Somewhat agree,Somewhat disagree,Strongly agree,2,5,1,3,4,1,Agree,Disagree,Agree,Disagree,Agree,4,3,5,1,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,5,3,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-2,-1,2,1,10 cents,100 minutes,15 days,Female,Trade School (non-military),47,03VPfPs,01PAST,10,01ITEM,0.75,0,0.666666667,6,8,5,3,2,7,9,1,4,4,2,3,1,0,2,-1,-1,2,1,-2,2,-2,1,1,2,2,2,2,0,2,-1,0,2,2,-2,2,0,2,2,2,2,1,2,-1,2,2,1,2,1,-2,1,0,1,-1,-1,-1,-1,0,1,3,-1,-1,3,3,-2,3,-2,3,3,3,3,3,3,2,3,1,-1,3,2,-2,2,-2,2,3,3,3,3,3,2,1,1,2,2,7,1,1,1,1,1,1 +R_1uqexAcAlWO8ejm,32 - 38,American,Female,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Strongly agree,5,4,1,3,2,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,5,2,1,4,3,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,4,1,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Disagree,Agree,5,3,2,1,4,3,Strongly agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly agree,3,1,2,5,4,0,Somewhat Agree,Disagree,Strongly agree,Agree,Strongly agree,5,1,3,4,2,1,Somewhat agree,Somewhat agree,Agree,Disagree,Agree,3,1,4,2,5,3,Strongly agree,Somewhat agree,Disagree,Somewhat disagree,Agree,3,1,4,2,5,1,Somewhat Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,2,1,4,3,5,1,Agree,Somewhat agree,Neither agree nor disagree,Strongly disagree,Strongly agree,1,5,4,2,3,6,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,Somewhat agree,5,3,1,4,2,5,Neither Agree nor Disagree,Agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,4,1,5,Agree,Somewhat agree,Somewhat agree,Disagree,Strongly agree,5,3,4,2,1,4,Somewhat agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,3,1,2,1,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,1,2,4,3,5,0,2,2,2,-1,2,2,2,10 cents,25 minutes,24 days,Female,Professional Degree (ex. JD/MD),38,02PsVPf,02FUT,5,02DGEN,0.125,0,0.666666667,2,7,6,4,5,9,3,1,8,3,2,4,1,1,0,1,-2,3,2,0,1,-2,2,0,-1,3,0,3,2,2,2,-2,2,3,1,-1,-1,3,1,-2,3,2,3,1,1,2,-2,2,3,1,-2,-1,2,1,-1,3,2,3,2,1,0,-3,3,0,0,2,-3,1,0,2,3,1,3,2,1,1,-2,3,1,0,3,-3,3,0,1,3,1,3,2,3,0,1,3,1,1,6,5,5,4,1 +R_7Md5bk5uVfi4os9,53 - 59,American,Male,Somewhat agree,Somewhat agree,Strongly agree,Agree,Agree,5,3,1,2,4,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,2,3,5,1,4,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Disagree,Strongly Agree,1,5,2,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,1,4,5,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,4,3,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,2,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,5,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,3,5,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,4,2,0,0,0,0,0,0,0,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),54,02PsVPf,01PAST,5,02DGEN,0,0,1,2,4,5,3,6,7,9,1,8,2,3,4,1,1,1,3,2,2,-2,0,2,1,1,1,0,3,-2,3,0,0,0,0,0,-2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5 +R_7C7agB9Gdckcphq,25 - 31,Canadian,Female,Somewhat disagree,Strongly agree,Agree,Strongly agree,Agree,4,3,1,5,2,Somewhat agree,Agree,Agree,Agree,Agree,3,4,5,1,2,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,Agree,2,5,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,4,2,5,1,8,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,1,4,5,2,7,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Disagree,5,2,1,4,3,10,Strongly disagree,Strongly agree,Somewhat disagree,Strongly agree,Agree,1,5,4,2,3,10,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,3,5,1,2,4,9,Strongly agree,Strongly agree,Agree,Agree,Agree,3,1,5,4,2,9,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Agree,5,1,4,2,3,7,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,2,1,4,3,7,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,4,5,2,3,9,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,Agree,5,1,3,2,4,9,Somewhat agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,3,2,1,5,4,8,Agree,Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,3,5,4,1,2,0,1,0,0,2,-1,0,0,5 cents,100 minutes,47 days,Female,University - Undergraduate,27,03VPfPs,01PAST,10,02DGEN,0,0.666666667,0.333333333,6,9,7,4,5,8,3,1,2,3,2,4,1,-1,3,2,3,2,1,2,2,2,2,3,1,2,3,2,2,1,0,0,1,-1,1,1,0,1,1,0,1,1,-2,-3,3,-1,3,2,-1,-1,1,0,2,3,3,2,2,2,-1,0,0,-2,2,-1,-1,1,0,1,2,1,0,1,0,-1,2,-1,1,2,1,-1,3,0,-1,2,2,-1,1,0,7,8,7,10,10,9,9,7,7,9,9,8 +R_6y15Wevd07pMNtn,46 - 52,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,3,1,5,2,Neither agree nor disagree,Disagree,Neither agree nor disagree,Disagree,Agree,1,3,4,5,2,Somewhat Agree,Strongly Disagree,Agree,Somewhat Disagree,Strongly Agree,4,1,5,3,2,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,4,2,3,1,5,3,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,2,4,5,3,1,2,Agree,Strongly Disagree,Agree,Disagree,Strongly agree,4,3,5,2,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,1,2,3,5,1,Disagree,Strongly disagree,Somewhat agree,Disagree,Agree,5,4,2,3,1,2,Agree,Strongly Disagree,Agree,Disagree,Strongly agree,2,4,1,5,3,1,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,2,3,5,4,1,1,Strongly disagree,Disagree,Somewhat agree,Disagree,Agree,5,2,4,1,3,1,Somewhat Agree,Strongly Disagree,Agree,Disagree,Strongly agree,4,5,2,3,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,1,3,2,5,2,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,5,3,1,4,2,1,Agree,Strongly Disagree,Agree,Disagree,Strongly agree,3,4,1,5,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,0,1,2,1,10 cents,5 minutes,47 days,Male,High School (or equivalent),46,01PfPsV,01PAST,5,01ITEM,0,0.666666667,0.333333333,9,7,4,8,6,2,5,1,3,4,3,2,1,3,3,3,3,2,0,-2,0,-2,2,1,-3,2,-1,3,3,3,3,2,2,0,-2,2,-2,2,2,-3,2,-2,3,3,3,3,3,2,-2,-3,1,-2,2,2,-3,2,-2,3,3,3,3,2,2,-3,-2,1,-2,2,1,-3,2,-2,3,3,3,3,3,2,0,-2,2,-2,2,2,-3,2,-2,3,3,2,1,1,2,1,1,1,2,2,1,2 +R_5qe2wyBRBnfCjtw,18 - 24,Canadian,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,2,3,1,4,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,4,5,1,3,2,Somewhat Agree,Strongly Agree,Strongly Agree,Strongly Disagree,Agree,4,2,1,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,3,1,4,5,2,5,Somewhat Agree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,5,3,4,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,2,1,5,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,4,1,3,5,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,4,3,1,2,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,3,1,5,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,5,1,4,3,2,6,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,4,2,3,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,3,1,5,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,4,1,3,5,5,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Somewhat Disagree,Strongly agree,1,4,3,2,5,0,1,1,0,-1,0,0,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),18,03VPfPs,02FUT,5,02DGEN,0.5,0,1,2,6,9,7,5,4,3,1,8,4,3,2,1,2,3,3,3,2,1,-1,2,-1,3,1,3,3,-3,2,3,3,3,3,3,1,-1,0,-1,1,1,-1,3,-1,3,3,3,3,3,3,1,0,1,-1,1,0,-1,3,-1,3,3,3,3,3,3,1,-1,0,-1,1,0,-1,3,-3,3,3,3,3,3,3,1,-1,1,-1,1,1,0,3,-1,3,5,5,5,5,6,5,7,5,6,5,5,5 +R_51b34xCv0Q4Pu5f,32 - 38,Canadian,Male,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,2,4,3,5,1,Strongly disagree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,3,2,5,1,4,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,1,3,2,4,Somewhat disagree,Strongly agree,Agree,Agree,Strongly agree,5,4,3,2,1,7,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,2,5,1,3,4,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,2,5,3,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,1,3,4,5,9,Strongly agree,Strongly disagree,Strongly disagree,Somewhat agree,Somewhat agree,5,2,1,4,3,8,Strongly Disagree,Somewhat Disagree,Strongly agree,Strongly agree,Neither Agree nor Disagree,2,5,1,4,3,8,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,5,2,1,4,9,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,4,3,2,1,8,Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Agree,4,1,2,3,5,7,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,4,1,5,3,8,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,5,4,1,3,7,Agree,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,5,3,4,2,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,2,2,2,2,10 cents,25 minutes,15 days,Male,High School (or equivalent),35,01PfPsV,01PAST,10,01ITEM,0,0,0.333333333,6,3,7,9,5,2,4,1,8,3,2,4,1,3,3,2,1,2,-3,3,1,3,3,2,0,3,1,3,-1,3,2,2,3,0,1,0,-1,1,0,0,1,0,0,3,3,3,3,2,3,-3,-3,1,1,-3,-1,3,3,0,0,2,0,1,1,1,0,0,1,1,2,0,1,2,2,0,1,0,2,0,1,1,2,0,1,2,2,2,1,0,7,4,5,9,8,8,9,8,7,8,7,8 +R_3dzcAKteTP7nZ5i,18 - 24,Canadian,Female,Disagree,Disagree,Strongly agree,Neither agree nor disagree,Disagree,3,4,5,2,1,Somewhat agree,Strongly agree,Neither agree nor disagree,Disagree,Somewhat agree,3,5,2,4,1,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,1,4,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Disagree,2,4,1,3,5,6,Agree,Strongly disagree,Disagree,Disagree,Agree,1,4,2,3,5,8,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,3,2,1,3,Disagree,Somewhat agree,Agree,Agree,Agree,3,2,4,5,1,5,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly agree,Agree,2,1,4,5,3,7,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Agree,Strongly agree,3,5,2,1,4,3,Neither agree nor disagree,Somewhat disagree,Disagree,Agree,Agree,1,3,2,4,5,3,Agree,Disagree,Strongly agree,Somewhat disagree,Somewhat disagree,3,1,5,4,2,4,Somewhat Agree,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,Strongly agree,2,3,1,4,5,7,Agree,Somewhat disagree,Disagree,Agree,Somewhat agree,5,2,4,3,1,9,Disagree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,2,1,4,5,3,8,Disagree,Somewhat Agree,Agree,Disagree,Somewhat Agree,2,1,4,5,3,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,-1,1,2,-1,1,-1,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,24,02PsVPf,02FUT,5,01ITEM,0.25,0,1,4,6,3,5,8,7,9,1,2,3,4,2,1,-2,-2,3,0,-2,1,3,0,-2,1,2,-1,2,0,0,-1,-1,-2,1,-2,2,-3,-2,-2,2,2,-1,2,0,1,-2,1,2,2,2,0,1,1,3,2,3,-1,0,2,3,0,-1,-2,2,2,2,-2,3,-1,-1,1,0,-2,0,3,2,-1,-2,2,1,-2,2,0,2,0,-2,1,2,-2,1,6,8,3,5,7,3,3,4,7,9,8,8 +R_5eb8Hg6x43UvJf4,46 - 52,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,1,3,5,2,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,5,3,1,Somewhat Disagree,Somewhat Disagree,Agree,Strongly Disagree,Strongly Agree,4,1,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,3,5,1,4,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,4,5,1,6,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,4,3,5,1,2,6,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,1,4,2,5,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,5,2,3,6,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Strongly Disagree,Strongly agree,5,1,3,2,4,6,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,5,1,4,2,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,2,3,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly agree,4,5,1,3,2,6,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,2,3,1,4,6,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,2,5,4,1,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Strongly agree,3,2,5,1,4,1,1,1,1,-1,1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,52,02PsVPf,01PAST,10,02DGEN,0.25,0,1,4,5,2,9,8,3,7,1,6,2,4,3,1,2,3,3,2,3,1,-1,1,-1,1,-1,-1,2,-3,3,2,3,3,2,3,1,-1,1,-1,1,-1,-1,1,-3,3,1,3,3,2,3,1,-1,1,-1,1,-1,-1,1,-3,3,2,3,3,3,2,1,-1,1,-1,1,1,1,1,-3,3,2,3,3,3,2,1,-1,1,-1,1,1,1,1,-3,3,6,6,6,6,6,6,6,6,6,6,6,6 +R_1tM7LJvIeqd77A3,39 - 45,American,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat agree,5,2,4,3,1,Somewhat disagree,Disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,2,1,3,5,4,Agree,Strongly Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,3,2,5,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,2,3,4,5,3,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,3,2,1,5,4,4,Agree,Strongly agree,Agree,Agree,Neither Agree nor Disagree,4,1,3,2,5,3,Strongly agree,Agree,Agree,Somewhat agree,Agree,5,4,2,3,1,3,Somewhat agree,Agree,Strongly agree,Somewhat agree,Somewhat agree,3,1,5,4,2,4,Agree,Agree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,2,3,5,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,1,3,5,4,6,Somewhat disagree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,5,2,4,Agree,Strongly agree,Agree,Somewhat Agree,Neither Agree nor Disagree,1,2,5,3,4,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,5,2,3,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,4,5,1,2,6,Somewhat Agree,Agree,Agree,Disagree,Neither Agree nor Disagree,5,1,3,2,4,2,1,0,0,-2,0,2,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),43,02PsVPf,02FUT,10,02DGEN,0.375,0,1,5,6,7,8,9,4,2,1,3,4,2,3,1,3,2,3,3,1,-1,-2,3,-1,0,2,3,2,1,0,3,3,3,3,2,1,1,3,1,0,2,3,2,2,0,3,2,2,1,2,1,2,3,1,1,2,2,1,3,0,3,3,3,3,2,-1,1,3,0,0,2,3,2,1,0,3,3,3,3,3,0,1,1,0,0,1,2,2,-2,0,3,3,4,3,3,4,1,6,4,6,7,6 +R_7q1F7ACDjIgiXCB,32 - 38,American,Female,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,3,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,2,1,4,5,3,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,1,5,2,4,3,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,2,1,3,0,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,4,3,5,2,1,0,Agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Agree,1,4,3,2,5,0,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,4,2,0,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,4,2,5,5,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,3,1,4,5,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,3,4,2,1,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,1,4,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,5,3,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,5,1,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,2,0,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,32,01PfPsV,01PAST,5,01ITEM,-0.25,0,1,7,3,4,9,6,5,8,1,2,2,3,4,1,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,1,1,2,1,1,2,0,3,0,2,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,2,3,2,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,2,5,5,5,5,5 +R_30O6o9S16Gy63p6,53 - 59,American,Male,Neither agree nor disagree,Somewhat agree,Agree,Agree,Somewhat agree,4,2,3,5,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,3,5,2,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,3,5,1,4,2,Somewhat agree,Agree,Agree,Agree,Agree,3,4,1,5,2,0,Agree,Disagree,Agree,Somewhat disagree,Agree,4,5,3,2,1,1,Agree,Agree,Agree,Somewhat Disagree,Agree,3,2,5,1,4,1,Somewhat agree,Agree,Agree,Agree,Agree,1,5,2,3,4,1,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Agree,5,3,4,2,1,1,Agree,Agree,Agree,Somewhat Disagree,Agree,4,3,5,2,1,1,Agree,Agree,Agree,Agree,Agree,4,3,1,5,2,0,Agree,Disagree,Agree,Disagree,Agree,2,3,4,1,5,0,Agree,Agree,Agree,Disagree,Agree,3,1,5,2,4,0,Somewhat agree,Agree,Agree,Agree,Agree,1,3,5,2,4,0,Agree,Disagree,Agree,Disagree,Agree,3,4,2,1,5,1,Agree,Agree,Agree,Somewhat Disagree,Agree,3,1,4,2,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,-1,1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,55,03VPfPs,01PAST,10,01ITEM,0.25,0,1,5,4,7,9,6,8,3,1,2,3,2,4,1,0,1,2,2,1,0,0,1,-1,1,2,1,1,-1,2,1,2,2,2,2,2,-2,2,-1,2,2,2,2,-1,2,1,2,2,2,2,1,-1,2,-1,2,2,2,2,-1,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,-2,2,1,2,2,2,2,2,-2,2,-2,2,2,2,2,-1,2,0,1,1,1,1,1,0,0,0,0,1,0 +R_36lEraQCtCDPnjD,46 - 52,American,Female,Strongly agree,Somewhat agree,Agree,Strongly disagree,Somewhat disagree,2,5,3,4,1,Disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,5,3,4,1,2,Strongly Agree,Agree,Agree,Neither Agree nor Disagree,Agree,2,4,3,5,1,Strongly agree,Somewhat agree,Agree,Strongly disagree,Neither agree nor disagree,1,3,5,4,2,3,Disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,5,2,3,1,2,Strongly agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,5,4,1,3,1,Agree,Agree,Strongly agree,Strongly disagree,Somewhat agree,5,3,2,1,4,4,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,4,3,1,5,5,Strongly agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,4,5,3,2,2,Strongly agree,Somewhat agree,Somewhat agree,Disagree,Somewhat disagree,1,4,3,2,5,4,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,3,4,2,1,5,4,Strongly agree,Strongly agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,3,2,5,1,4,3,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,4,3,1,5,4,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,3,1,5,4,5,Strongly agree,Strongly agree,Neither Agree nor Disagree,Disagree,Agree,1,4,2,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,0,1,2,1,5 cents,5 minutes,47 days,Female,University - Graduate (Masters),46,03VPfPs,01PAST,10,01ITEM,0,1,0,9,8,2,3,6,7,4,1,5,3,4,2,1,3,1,2,-3,-1,-2,0,2,1,-1,3,2,2,0,2,3,1,2,-3,0,-2,-1,3,-1,1,3,1,1,0,2,2,2,3,-3,1,-1,-2,2,-1,1,3,1,1,1,2,3,1,1,-2,-1,-1,1,2,1,-1,3,3,0,-1,2,3,0,0,-1,-1,-1,1,1,1,-1,3,3,0,-2,2,3,2,1,4,5,2,4,4,3,4,5,2 +R_3KqCkLry2isEZY8,53 - 59,American,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,1,2,4,3,Agree,Disagree,Strongly agree,Disagree,Disagree,4,5,1,2,3,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,5,2,1,3,4,Agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,1,2,3,4,5,3,Agree,Somewhat disagree,Agree,Agree,Somewhat disagree,3,5,1,2,4,4,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,4,5,2,1,4,Agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,5,4,3,2,1,8,Agree,Somewhat agree,Strongly agree,Disagree,Disagree,5,4,3,2,1,5,Strongly agree,Somewhat Agree,Strongly agree,Agree,Agree,5,1,2,3,4,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Agree,4,3,2,5,1,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,2,1,5,4,3,7,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,3,5,1,2,7,Disagree,Disagree,Disagree,Disagree,Disagree,4,5,3,1,2,10,Disagree,Strongly disagree,Strongly disagree,Strongly disagree,Disagree,4,2,1,5,3,10,Disagree,Strongly Disagree,Disagree,Strongly Disagree,Strongly Disagree,5,1,3,2,4,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,1,1,1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,54,03VPfPs,01PAST,10,01ITEM,0.375,0,1,8,3,9,5,4,2,7,1,6,2,3,4,1,1,3,3,2,3,2,-2,3,-2,-2,1,-1,2,1,1,2,3,3,-1,2,2,-1,2,2,-1,3,3,2,3,3,2,3,3,-1,3,2,1,3,-2,-2,3,1,3,2,2,0,-1,1,1,2,1,1,1,1,-1,1,-1,1,-1,1,-2,-2,-2,-2,-2,-2,-3,-3,-3,-2,-2,-3,-2,-3,-3,3,4,4,8,5,3,7,7,7,10,10,9 +R_1p3WhZfj18rGewY,53 - 59,American,Male,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,2,4,1,5,Strongly disagree,Disagree,Somewhat agree,Strongly agree,Disagree,3,2,4,5,1,Strongly Agree,Agree,Agree,Somewhat Disagree,Strongly Agree,1,2,4,3,5,Agree,Agree,Strongly agree,Strongly agree,Agree,2,5,3,4,1,2,Disagree,Disagree,Somewhat agree,Strongly agree,Disagree,3,2,5,4,1,2,Strongly agree,Agree,Agree,Disagree,Strongly agree,1,4,3,2,5,2,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,4,2,5,3,6,Disagree,Disagree,Agree,Agree,Somewhat disagree,1,3,5,2,4,2,Strongly agree,Agree,Agree,Disagree,Strongly agree,5,1,4,3,2,1,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,2,3,4,5,1,1,Disagree,Disagree,Disagree,Agree,Somewhat disagree,4,5,2,3,1,2,Strongly agree,Strongly agree,Agree,Disagree,Strongly agree,4,3,1,5,2,2,Somewhat agree,Strongly agree,Agree,Agree,Somewhat disagree,2,3,5,1,4,4,Strongly disagree,Disagree,Disagree,Strongly agree,Disagree,2,3,1,4,5,6,Strongly agree,Agree,Strongly agree,Disagree,Strongly agree,3,5,2,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,2,-1,-1,0,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),58,03VPfPs,01PAST,5,01ITEM,0.75,0,1,2,9,8,3,7,5,6,1,4,4,2,3,1,1,3,3,3,2,-3,-2,1,3,-2,3,2,2,-1,3,2,2,3,3,2,-2,-2,1,3,-2,3,2,2,-2,3,3,3,3,1,3,-2,-2,2,2,-1,3,2,2,-2,3,1,3,3,3,-1,-2,-2,-2,2,-1,3,3,2,-2,3,1,3,2,2,-1,-3,-2,-2,3,-2,3,2,3,-2,3,2,2,2,6,2,1,1,2,2,4,6,2 +R_3S01BRqgYnMsK2i,39 - 45,American,Male,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,3,2,5,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,1,4,2,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,2,3,4,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,2,4,3,5,1,2,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,3,2,4,5,2,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,4,1,2,3,2,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,1,4,5,2,2,Disagree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,2,1,5,3,1,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,1,2,3,5,2,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,2,4,5,1,3,1,Disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,3,1,2,4,5,1,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,3,1,2,5,4,2,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,3,4,5,2,1,2,Somewhat disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,2,3,4,1,5,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,3,4,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,-1,1,1,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,45,02PsVPf,02FUT,10,01ITEM,0.125,0,1,3,8,5,2,4,7,6,1,9,3,4,2,1,1,2,2,2,1,-1,-1,1,-1,0,1,-1,1,0,1,1,2,2,2,1,-2,-2,1,-2,0,1,-1,1,0,1,1,3,3,3,1,-2,-2,1,-1,0,1,-1,1,-1,1,2,3,3,2,1,-2,-2,1,-2,0,1,-1,1,-1,1,2,3,3,2,1,-1,-2,1,-2,0,1,-1,1,0,1,2,2,2,2,1,2,1,1,2,2,3,1 +R_5ounHrWUFcKb4U1,46 - 52,American,Female,Strongly agree,Strongly agree,Agree,Agree,Agree,2,1,3,5,4,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,2,5,3,4,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Agree,Strongly Agree,3,5,2,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,2,5,3,8,Agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,1,3,2,4,5,2,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,4,3,5,2,1,6,Strongly agree,Strongly agree,Somewhat disagree,Somewhat disagree,Strongly agree,3,5,1,2,4,7,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,1,4,2,3,5,6,Somewhat Disagree,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,2,1,4,3,3,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Agree,4,2,1,5,3,4,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Agree,4,5,2,1,3,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,4,2,1,3,5,2,Strongly agree,Agree,Somewhat disagree,Strongly agree,Somewhat agree,4,2,1,3,5,3,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,4,2,3,1,1,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,5,1,4,3,2,1,2,2,2,0,1,1,1,5 cents,5 minutes,47 days,Female,College Diploma/Certificate,52,01PfPsV,02FUT,10,02DGEN,0.25,1,0,8,3,4,2,7,9,5,1,6,4,3,2,1,3,3,2,2,2,-1,-2,0,-1,1,0,1,2,1,3,3,3,1,1,0,2,-1,1,-1,2,-1,1,2,1,3,3,3,-1,-1,3,1,0,-1,1,1,-1,-1,3,0,3,3,3,1,3,2,1,0,3,0,2,0,1,1,0,3,3,2,-1,3,1,0,-1,2,-1,0,-1,0,0,0,3,4,8,2,6,7,6,3,4,5,2,3,1 +R_5M77VizNdfq6d0d,25 - 31,American,Female,Agree,Agree,Strongly agree,Agree,Neither agree nor disagree,5,4,1,3,2,Disagree,Agree,Somewhat agree,Strongly agree,Somewhat agree,3,5,2,4,1,Neither Agree nor Disagree,Strongly Disagree,Agree,Somewhat Disagree,Agree,2,5,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Agree,Agree,Agree,Somewhat agree,5,2,3,1,4,3,Disagree,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,3,4,1,5,2,2,Disagree,Disagree,Agree,Disagree,Agree,5,3,2,1,4,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,5,4,3,2,4,Somewhat agree,Agree,Somewhat disagree,Strongly agree,Agree,3,1,4,2,5,4,Disagree,Disagree,Agree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,1,4,5,3,2,3,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Agree,3,4,1,2,5,6,Strongly agree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,3,2,4,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,1,5,2,3,3,Agree,Disagree,Strongly agree,Somewhat disagree,Agree,5,2,3,4,1,3,Somewhat Agree,Disagree,Strongly agree,Disagree,Strongly agree,1,3,2,4,5,-1,1,1,2,-1,1,2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,30,02PsVPf,01PAST,5,02DGEN,-0.25,0,1,6,4,3,2,5,8,9,1,7,3,2,4,1,2,2,3,2,0,-2,2,1,3,1,0,-3,2,-1,2,2,2,2,2,1,-2,1,-1,2,1,-2,-2,2,-2,2,3,3,3,3,1,1,2,-1,3,2,-2,-2,2,1,1,3,3,3,3,1,1,-1,2,-1,2,3,-3,3,-1,3,3,3,3,3,1,2,-2,3,-1,2,1,-2,3,-2,3,3,3,2,4,4,4,3,3,6,3,3,3 +R_1dSHCOTVBH5dBTu,53 - 59,American,Male,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,3,2,4,1,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,5,3,2,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,1,4,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,5,4,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,1,4,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,2,1,5,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,5,4,1,2,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,4,3,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,1,5,3,2,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,5,4,3,0,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,3,2,1,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,4,3,2,1,0,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,4,2,1,5,0,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,4,2,3,0,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,2,-1,-1,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,59,03VPfPs,02FUT,10,01ITEM,0.125,0,1,3,6,4,5,7,2,8,1,9,4,2,3,1,1,1,1,1,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 +R_30DwsF5EY3f5TvH,25 - 31,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,4,3,1,5,2,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat agree,2,5,1,4,3,Agree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,3,5,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,1,5,2,3,4,5,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,2,1,4,5,3,5,Agree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,4,3,1,5,6,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,2,1,3,4,5,5,Somewhat agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Agree,1,2,3,4,5,5,Agree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,5,2,1,4,3,5,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,1,3,2,4,5,5,Agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,5,4,2,5,Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,4,1,2,3,5,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,4,3,2,5,1,5,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,4,2,5,3,5,Agree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,3,4,2,5,1,1,1,1,2,-1,1,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,26,01PfPsV,01PAST,10,02DGEN,0,0,1,7,9,4,8,5,3,6,1,2,3,2,4,1,3,3,2,1,2,2,-3,3,-3,1,2,-1,3,-1,3,3,3,2,1,2,2,-3,3,-3,3,2,-1,3,-3,3,3,3,2,1,2,1,-3,3,0,2,2,-1,3,-2,3,3,3,2,1,2,2,-3,3,-3,3,2,-2,3,-3,3,3,3,1,1,3,2,-3,3,-3,2,2,-3,3,-2,3,5,5,5,6,5,5,5,5,5,5,5,5 +R_3xXiv34n1qi7xUi,18 - 24,Canadian,Female,Agree,Agree,Agree,Somewhat agree,Agree,1,4,3,5,2,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,5,1,4,2,3,Strongly Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,1,2,3,4,5,Somewhat agree,Strongly agree,Strongly agree,Agree,Somewhat disagree,5,4,1,2,3,6,Disagree,Agree,Disagree,Strongly agree,Strongly disagree,3,1,5,2,4,4,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Strongly agree,1,2,3,4,5,6,Agree,Agree,Agree,Neither agree nor disagree,Strongly disagree,2,1,3,5,4,8,Disagree,Disagree,Disagree,Somewhat agree,Disagree,2,5,4,3,1,7,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,5,4,1,3,2,8,Agree,Strongly agree,Strongly agree,Agree,Agree,5,1,2,3,4,3,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,3,5,2,1,4,3,Agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,4,2,5,1,3,2,Agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,1,4,2,5,3,4,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,4,5,3,1,2,4,Strongly agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,4,3,5,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-2,0,1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),21,03VPfPs,01PAST,5,01ITEM,0.375,0,1,4,5,9,7,6,3,8,1,2,4,3,2,1,2,2,2,1,2,-1,1,0,3,0,3,-1,2,0,3,1,3,3,2,-1,-2,2,-2,3,-3,2,0,2,1,3,2,2,2,0,-3,-2,-2,-2,1,-2,-1,1,2,-1,1,2,3,3,2,2,0,1,2,1,0,2,-2,3,1,3,2,3,3,2,0,0,0,2,1,1,3,-2,3,1,3,6,4,6,8,7,8,3,3,2,4,4,4 +R_7Vguppi4vDWHJQa,32 - 38,Canadian,Male,Disagree,Agree,Agree,Agree,Somewhat agree,4,1,2,5,3,Strongly disagree,Disagree,Strongly agree,Strongly disagree,Somewhat agree,3,5,2,1,4,Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Agree,4,3,1,2,5,Disagree,Strongly agree,Agree,Disagree,Somewhat agree,2,3,1,4,5,3,Strongly disagree,Neither agree nor disagree,Strongly agree,Disagree,Agree,5,2,4,1,3,5,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,1,2,3,4,5,4,Disagree,Strongly agree,Agree,Strongly disagree,Agree,5,2,1,3,4,5,Strongly disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,2,3,4,5,1,4,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,3,5,2,1,4,3,Disagree,Strongly agree,Agree,Somewhat agree,Agree,3,2,5,4,1,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,5,1,2,4,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,1,5,3,4,2,3,Disagree,Strongly agree,Strongly agree,Agree,Somewhat agree,2,1,4,3,5,2,Strongly disagree,Disagree,Strongly agree,Strongly disagree,Agree,5,4,3,1,2,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,1,4,3,5,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,2,1,1,-2,2,2,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),37,02PsVPf,01PAST,5,01ITEM,0,0,1,2,8,5,9,3,7,6,1,4,4,2,3,1,-2,2,2,2,1,-3,-2,3,-3,1,2,-3,3,-3,2,-2,3,2,-2,1,-3,0,3,-2,2,2,-3,3,-3,2,-2,3,2,-3,2,-3,1,3,-2,1,2,-3,3,-3,2,-2,3,2,1,2,-3,-3,3,-3,2,2,-3,3,-3,2,-2,3,3,2,1,-3,-2,3,-3,2,2,-3,3,-3,2,3,5,4,5,4,3,2,4,3,2,1,1 +R_5TPr9rXWAlXQRq1,18 - 24,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,4,5,2,1,Strongly agree,Strongly agree,Agree,Disagree,Agree,4,1,3,2,5,Somewhat Disagree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Agree,2,5,4,3,1,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,4,2,8,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,4,1,3,5,7,Disagree,Somewhat Disagree,Somewhat Agree,Strongly agree,Somewhat Agree,4,5,1,3,2,8,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,9,Somewhat disagree,Somewhat agree,Strongly disagree,Somewhat disagree,Disagree,5,4,3,1,2,7,Somewhat Agree,Disagree,Somewhat Disagree,Strongly agree,Somewhat Agree,5,1,2,4,3,8,Strongly agree,Strongly agree,Agree,Somewhat disagree,Agree,3,2,4,1,5,9,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,3,5,4,1,2,9,Somewhat Disagree,Somewhat Disagree,Strongly agree,Agree,Agree,5,2,1,4,3,9,Strongly agree,Agree,Agree,Disagree,Agree,2,5,4,1,3,9,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,2,5,3,4,1,9,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,Agree,Strongly agree,5,4,2,1,3,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-1,2,2,2,5 cents,5 minutes,47 days,Male,High School (or equivalent),23,01PfPsV,01PAST,10,01ITEM,0.375,1,0,4,7,2,6,5,8,3,1,9,3,2,4,1,3,3,3,2,2,3,3,2,-2,2,-1,0,3,1,2,-2,3,3,3,3,-1,2,-1,1,-1,-2,-1,1,3,1,-3,3,3,3,3,-1,1,-3,-1,-2,1,-2,-1,3,1,3,3,2,-1,2,3,1,3,-3,3,-1,-1,3,2,2,3,2,2,-2,2,3,1,3,-3,3,-1,0,3,2,3,8,7,8,9,7,8,9,9,9,9,9,9 +R_3370vjQWCja2Mfx,18 - 24,Canadian,Female,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,Strongly disagree,2,3,5,4,1,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,1,4,3,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,1,2,5,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Disagree,Agree,Neither agree nor disagree,Disagree,Strongly disagree,5,1,2,4,3,3,Strongly disagree,Agree,Somewhat disagree,Strongly agree,Strongly disagree,1,2,3,4,5,2,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,Disagree,Strongly agree,4,2,5,1,3,3,Somewhat agree,Agree,Neither agree nor disagree,Disagree,Strongly disagree,4,2,1,3,5,5,Strongly disagree,Disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,5,1,2,4,3,4,Neither Agree nor Disagree,Disagree,Neither Agree nor Disagree,Disagree,Agree,1,5,4,3,2,2,Neither agree nor disagree,Strongly agree,Disagree,Disagree,Strongly disagree,1,4,5,2,3,2,Disagree,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,2,4,3,5,2,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,4,3,1,2,5,2,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Disagree,Disagree,1,2,5,3,4,2,Somewhat disagree,Disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,5,4,3,2,1,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,4,2,5,0,1,0,1,0,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),24,02PsVPf,01PAST,10,02DGEN,0.125,0,1,5,4,8,9,7,6,3,1,2,4,3,2,1,0,2,0,-2,-3,3,0,0,3,1,0,0,0,-1,3,-2,2,0,-2,-3,-3,2,-1,3,-3,0,-2,0,-2,3,1,2,0,-2,-3,-3,-2,0,3,-1,0,-2,0,-2,2,0,3,-2,-2,-3,-2,-2,0,1,0,0,-1,0,-1,3,0,3,0,-2,-2,-1,-2,0,-1,0,0,0,2,0,0,6,3,2,3,5,4,2,2,2,2,2,3 +R_1uUKWqT3KZOWwma,39 - 45,American,Male,Agree,Strongly agree,Agree,Strongly agree,Agree,4,5,2,1,3,Agree,Strongly agree,Somewhat agree,Agree,Agree,1,5,3,4,2,Strongly Agree,Agree,Strongly Agree,Agree,Agree,1,4,3,2,5,Agree,Strongly agree,Agree,Agree,Strongly agree,3,4,2,5,1,8,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,3,5,2,1,4,8,Agree,Strongly agree,Agree,Strongly agree,Agree,1,4,3,2,5,8,Strongly agree,Agree,Agree,Strongly agree,Agree,1,2,5,3,4,8,Agree,Agree,Strongly agree,Agree,Strongly agree,1,3,5,4,2,6,Somewhat Agree,Agree,Agree,Agree,Strongly agree,4,3,5,1,2,7,Strongly agree,Agree,Agree,Strongly agree,Agree,1,2,3,4,5,10,Agree,Strongly agree,Agree,Agree,Somewhat agree,2,5,4,1,3,9,Strongly agree,Agree,Strongly agree,Agree,Agree,3,4,1,2,5,9,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,4,3,1,2,10,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,3,2,1,5,10,Agree,Agree,Strongly agree,Agree,Strongly agree,2,1,4,3,5,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,-2,-2,-1,-2,1,5 cents,5 minutes,24 days,Male,University - Graduate (Masters),42,03VPfPs,02FUT,5,01ITEM,1.75,0.666666667,0.333333333,8,3,6,7,9,5,4,1,2,4,3,2,1,2,3,2,3,2,2,3,1,2,2,3,2,3,2,2,2,3,2,2,3,1,3,2,3,2,2,3,2,3,2,3,2,2,3,2,2,2,3,2,3,1,2,2,2,3,3,2,2,3,2,2,3,2,2,1,3,2,3,2,2,2,3,3,3,2,2,3,2,3,3,2,2,3,2,3,8,8,8,8,6,7,10,9,9,10,10,10 +R_5f181Ig3WCVioBW,25 - 31,Canadian,Female,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,3,4,1,2,Strongly agree,Neither agree nor disagree,Agree,Agree,Agree,1,5,3,2,4,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,2,3,4,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,3,2,5,1,4,7,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,2,5,1,4,3,8,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,4,2,1,5,6,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,5,1,3,4,2,6,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,5,4,7,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,4,3,5,2,9,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,5,1,4,3,2,8,Neither agree nor disagree,Agree,Somewhat agree,Agree,Somewhat agree,1,5,4,2,3,7,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,5,1,4,3,7,Neither agree nor disagree,Agree,Strongly agree,Agree,Somewhat agree,1,2,5,4,3,7,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,Agree,1,4,3,2,5,8,Agree,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,4,3,1,5,1,-1,0,-2,-1,0,0,0,10 cents,100 minutes,24 days,Female,Professional Degree (ex. JD/MD),29,01PfPsV,01PAST,10,02DGEN,0.375,0,1,3,6,9,7,8,4,2,1,5,4,3,2,1,2,3,3,0,1,3,0,2,2,2,-1,1,0,1,3,2,1,2,0,3,1,2,0,-1,0,0,2,1,0,1,1,0,2,1,1,0,2,1,0,0,0,1,2,0,1,3,1,3,1,2,0,2,1,2,1,0,1,1,0,2,0,2,3,2,1,0,3,2,1,2,2,3,1,0,2,8,7,8,6,6,7,9,8,7,7,7,8 +R_7PAVqMriqInQfXX,46 - 52,American,Male,Agree,Agree,Agree,Agree,Agree,1,2,3,5,4,Strongly disagree,Somewhat agree,Agree,Somewhat agree,Agree,5,3,1,2,4,Strongly Disagree,Strongly Disagree,Agree,Strongly Disagree,Agree,5,1,4,2,3,Agree,Agree,Agree,Agree,Somewhat agree,1,5,4,3,2,0,Strongly disagree,Agree,Strongly disagree,Agree,Strongly disagree,3,4,1,5,2,9,Strongly Disagree,Strongly Disagree,Agree,Strongly Disagree,Agree,1,2,4,5,3,10,Agree,Agree,Agree,Strongly disagree,Agree,4,2,5,1,3,0,Strongly disagree,Agree,Strongly disagree,Agree,Strongly disagree,3,5,2,1,4,10,Strongly Disagree,Strongly Disagree,Agree,Strongly Disagree,Agree,5,4,1,2,3,0,Agree,Agree,Agree,Agree,Agree,5,1,3,2,4,0,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Agree,5,3,4,1,2,10,Strongly Disagree,Strongly Disagree,Agree,Strongly Disagree,Agree,3,1,5,2,4,0,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,10,Strongly disagree,Strongly disagree,Agree,Strongly disagree,Agree,3,2,1,4,5,10,Strongly Disagree,Strongly Disagree,Agree,Strongly Disagree,Agree,4,1,3,2,5,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,0,2,-2,0,2,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,49,02PsVPf,01PAST,5,01ITEM,-0.125,0,1,4,5,9,6,2,3,8,1,7,3,4,2,1,2,2,2,2,2,-3,1,2,1,2,-3,-3,2,-3,2,2,2,2,2,1,-3,2,-3,2,-3,-3,-3,2,-3,2,2,2,2,-3,2,-3,2,-3,2,-3,-3,-3,2,-3,2,2,2,2,2,2,-3,-3,2,-3,2,-3,-3,2,-3,2,2,2,2,2,2,-3,-3,2,-3,2,-3,-3,2,-3,2,0,9,10,0,10,0,0,10,0,10,10,7 +R_18lvMg9J79PVPlD,25 - 31,Canadian,Female,Agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,5,4,3,Somewhat agree,Agree,Somewhat agree,Agree,Agree,5,2,1,3,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,5,3,1,2,Agree,Agree,Agree,Agree,Agree,2,4,5,3,1,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,5,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,5,2,4,3,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,5,3,4,2,1,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,4,1,2,3,5,7,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,6,Agree,Agree,Agree,Agree,Agree,1,3,4,5,2,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,4,5,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,1,3,4,2,7,Agree,Agree,Agree,Agree,Agree,4,2,5,1,3,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,3,2,4,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,5,1,2,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,0,1,-1,-1,-1,0,1,5 cents,100 minutes,24 days,Female,College Diploma/Certificate,25,03VPfPs,01PAST,10,01ITEM,0.5,0.333333333,0.666666667,6,2,5,3,4,9,8,1,7,4,2,3,1,2,2,1,1,0,1,2,1,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0,1,2,1,0,1,1,1,0,1,0,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,6,5,7,6,7,6,7,5,7,6,7,6 +R_3zeAZ5ZzmZJ3eEi,39 - 45,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,1,2,5,4,Somewhat agree,Disagree,Agree,Agree,Strongly agree,4,1,3,5,2,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly Agree,4,5,1,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,3,1,4,2,Agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,2,5,3,4,1,1,Agree,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,3,4,5,1,2,2,Agree,Strongly agree,Agree,Somewhat agree,Agree,4,3,5,2,1,0,Agree,Somewhat disagree,Somewhat agree,Disagree,Agree,5,3,4,2,1,3,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,4,2,1,5,3,7,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,2,5,1,4,3,0,Somewhat agree,Somewhat disagree,Strongly agree,Strongly disagree,Agree,3,2,5,4,1,5,Agree,Agree,Agree,Somewhat Agree,Strongly agree,4,2,5,1,3,8,Agree,Strongly agree,Agree,Agree,Strongly agree,1,3,2,4,5,4,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,3,2,5,1,4,7,Agree,Agree,Strongly agree,Agree,Agree,2,1,3,4,5,1,1,-2,2,-2,0,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,39,01PfPsV,02FUT,10,02DGEN,-0.125,0,1,8,7,5,2,4,9,3,1,6,3,4,2,1,2,3,3,2,3,1,-2,2,2,3,2,2,2,0,3,1,3,3,2,3,2,0,1,2,1,2,2,3,1,1,2,3,2,1,2,2,-1,1,-2,2,1,2,1,2,2,3,3,2,2,3,1,-1,3,-3,2,2,2,2,1,3,2,3,2,2,3,0,-2,2,-2,2,2,2,3,2,2,3,2,1,2,0,3,7,0,5,8,4,7 +R_55RVqMEaEBxgC1r,32 - 38,Canadian,Male,Somewhat disagree,Strongly agree,Agree,Neither agree nor disagree,Agree,2,5,3,1,4,Disagree,Agree,Disagree,Agree,Agree,1,5,4,2,3,Strongly Agree,Somewhat Agree,Agree,Agree,Strongly Agree,3,5,2,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Somewhat disagree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,2,5,1,3,2,Disagree,Somewhat agree,Disagree,Agree,Somewhat agree,3,4,1,5,2,9,Strongly agree,Agree,Neither Agree nor Disagree,Agree,Strongly agree,3,5,1,4,2,1,Somewhat disagree,Strongly agree,Agree,Neither agree nor disagree,Agree,4,1,5,2,3,1,Somewhat agree,Agree,Agree,Agree,Somewhat agree,5,3,1,4,2,1,Strongly agree,Agree,Agree,Agree,Strongly agree,5,1,4,2,3,1,Somewhat disagree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,4,3,5,1,2,1,Somewhat disagree,Agree,Agree,Agree,Agree,5,3,2,1,4,1,Strongly agree,Agree,Agree,Agree,Strongly agree,4,3,2,1,5,8,Somewhat agree,Agree,Agree,Neither agree nor disagree,Strongly agree,5,2,3,1,4,9,Agree,Agree,Strongly agree,Somewhat disagree,Agree,3,2,1,4,5,5,Strongly agree,Agree,Agree,Agree,Strongly agree,1,3,2,5,4,2,2,2,2,2,2,2,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),35,03VPfPs,02FUT,5,02DGEN,-0.125,0,1,7,5,3,9,8,4,6,1,2,2,4,3,1,-1,3,2,0,2,-2,2,-2,2,2,3,1,2,2,3,-1,3,2,0,2,-2,1,-2,2,1,3,2,0,2,3,-1,3,2,0,2,1,2,2,2,1,3,2,2,2,3,-1,3,2,0,3,-1,2,2,2,2,3,2,2,2,3,1,2,2,0,3,2,2,3,-1,2,3,2,2,2,3,3,2,9,1,1,1,1,1,1,8,9,5 +R_5qWoDGBWCVqZjko,32 - 38,Canadian,Male,Strongly disagree,Agree,Strongly agree,Somewhat agree,Agree,5,4,2,3,1,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly disagree,1,3,2,5,4,Agree,Agree,Somewhat Agree,Somewhat Disagree,Agree,3,2,1,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,0,Agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,4,1,3,5,2,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,1,4,3,5,2,0,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,1,4,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,3,1,2,4,0,Strongly agree,Agree,Agree,Strongly Disagree,Agree,3,2,4,1,5,0,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,3,2,1,0,Strongly agree,Strongly disagree,Agree,Strongly disagree,Agree,5,2,4,1,3,0,Agree,Agree,Agree,Strongly Disagree,Agree,2,5,3,1,4,0,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,0,Agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,1,5,2,4,0,Strongly agree,Agree,Strongly agree,Strongly Disagree,Agree,5,2,4,1,3,1,1,2,2,1,2,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,35,01PfPsV,01PAST,5,02DGEN,-0.25,0,1,8,6,2,7,9,4,3,1,5,2,3,4,1,-3,2,3,1,2,-3,-3,3,-3,-3,2,2,1,-1,2,-3,3,3,3,3,2,-3,2,-3,1,3,2,3,-3,3,-3,3,3,3,3,2,-3,3,-3,2,3,2,2,-3,2,-3,3,3,3,3,3,-3,2,-3,2,2,2,2,-3,2,-3,3,3,3,3,2,-3,3,-3,2,3,2,3,-3,2,1,0,0,0,0,0,0,0,0,0,0,0 +R_7QE4sB8mWwkcHEJ,32 - 38,Canadian,Male,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,3,5,Agree,Disagree,Agree,Disagree,Agree,5,3,1,4,2,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,4,2,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,5,4,3,2,6,Somewhat disagree,Somewhat disagree,Disagree,Agree,Somewhat agree,1,2,5,3,4,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Agree,1,3,5,4,2,6,Somewhat agree,Agree,Somewhat disagree,Disagree,Somewhat agree,1,2,4,5,3,6,Neither agree nor disagree,Neither agree nor disagree,Disagree,Strongly agree,Agree,5,4,3,1,2,5,Agree,Strongly agree,Somewhat Disagree,Agree,Somewhat Agree,1,4,3,2,5,8,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,5,4,2,3,1,7,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,1,3,2,5,4,2,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,4,3,2,1,2,Strongly agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,2,3,4,1,5,1,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,5,1,2,3,2,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,4,5,3,2,1,1,2,2,2,0,2,1,1,5 cents,5 minutes,47 days,Male,University - Undergraduate,34,01PfPsV,02FUT,5,02DGEN,0.125,1,0,8,3,7,4,5,2,6,1,9,3,4,2,1,2,2,3,3,3,2,-2,2,-2,2,1,2,3,1,3,3,0,1,-1,1,-1,-1,-2,2,1,1,1,1,3,1,1,2,-1,-2,1,0,0,-2,3,2,2,3,-1,2,1,3,2,2,1,3,3,-3,3,-3,2,3,3,3,2,3,3,3,0,0,3,3,-3,3,-3,0,0,-1,3,3,3,4,6,7,6,6,5,8,7,2,2,1,2 +R_5EWo48oayclBSk9,39 - 45,American,Male,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,2,4,5,1,3,Somewhat agree,Strongly disagree,Agree,Disagree,Agree,4,1,5,2,3,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,1,5,2,4,3,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,4,3,5,2,1,6,Somewhat agree,Strongly disagree,Neither agree nor disagree,Disagree,Disagree,4,3,5,1,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,1,4,5,5,Somewhat agree,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,1,4,5,3,2,8,Agree,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,5,2,4,3,1,6,Agree,Agree,Agree,Agree,Agree,1,4,3,5,2,1,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,Strongly agree,2,1,5,3,4,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Somewhat agree,2,1,3,4,5,2,Strongly agree,Somewhat Agree,Agree,Agree,Strongly agree,2,5,3,1,4,4,Strongly agree,Agree,Somewhat agree,Agree,Strongly agree,1,4,2,3,5,8,Neither agree nor disagree,Strongly disagree,Agree,Agree,Somewhat agree,5,1,4,3,2,1,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,4,1,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,-2,2,-1,1,0,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,41,03VPfPs,01PAST,10,01ITEM,0,0.333333333,0.666666667,5,7,9,8,3,2,4,1,6,4,2,3,1,3,3,1,1,3,1,-3,2,-2,2,1,2,1,2,2,1,2,0,-1,0,1,-3,0,-2,-2,1,1,1,1,1,1,3,3,2,0,2,-3,-1,1,0,2,2,2,2,2,3,1,0,2,3,-3,-3,3,3,1,3,1,2,2,3,3,2,1,2,3,0,-3,2,2,1,1,2,1,1,1,6,6,5,8,6,1,3,2,4,8,1,2 +R_7GE6LxrC5CIjgh4,32 - 38,American,Female,Strongly disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,3,4,1,5,2,Strongly disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,3,5,2,1,Somewhat Agree,Agree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,1,2,4,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,Somewhat disagree,1,4,5,3,2,0,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,3,4,1,0,Strongly agree,Agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,1,4,2,0,Neither agree nor disagree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,3,5,1,2,4,3,Disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Disagree,4,3,1,2,5,4,Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,5,1,4,3,2,4,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,3,5,4,1,2,0,Neither agree nor disagree,Agree,Strongly agree,Agree,Strongly agree,2,1,4,5,3,5,Agree,Neither Agree nor Disagree,Somewhat Disagree,Disagree,Agree,4,3,2,1,5,5,Strongly disagree,Somewhat agree,Agree,Strongly disagree,Strongly agree,5,4,3,2,1,4,Agree,Agree,Strongly agree,Agree,Strongly agree,2,3,5,1,4,7,Strongly agree,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,2,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,2,2,-2,0,1,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,36,02PsVPf,01PAST,5,01ITEM,0.5,0,1,6,9,8,3,7,2,4,1,5,3,2,4,1,-3,1,3,-3,3,-3,0,2,0,2,1,2,3,1,3,-3,3,3,-3,-1,-3,-3,3,-3,3,3,2,3,1,3,0,1,1,-2,0,-2,-1,0,-2,-2,-2,0,0,-1,0,0,3,3,-3,3,0,2,3,2,3,2,0,-1,-2,2,-3,1,2,-3,3,2,2,3,2,3,3,3,-1,0,0,0,0,0,3,4,4,0,5,5,4,7,6 +R_79ywJx01HSExAxb,46 - 52,American,Male,Agree,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,2,1,5,3,4,Somewhat agree,Agree,Strongly agree,Somewhat disagree,Strongly agree,4,2,3,5,1,Somewhat Agree,Disagree,Strongly Agree,Somewhat Agree,Somewhat Agree,5,4,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,3,5,2,4,1,5,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,5,4,1,3,2,7,Agree,Disagree,Strongly agree,Strongly agree,Neither Agree nor Disagree,5,2,4,1,3,7,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,Strongly agree,1,3,5,4,2,5,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,3,5,2,1,4,6,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Neither Agree nor Disagree,1,3,4,5,2,5,Agree,Strongly agree,Agree,Agree,Strongly agree,2,1,3,4,5,5,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,5,3,1,4,2,6,Agree,Strongly agree,Agree,Somewhat Disagree,Somewhat Agree,3,4,5,1,2,6,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,1,5,4,2,3,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,4,1,2,3,5,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,5,4,3,2,1,2,1,1,-1,0,1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),48,01PfPsV,01PAST,10,02DGEN,0.5,0,1,8,6,2,5,4,9,3,1,7,3,2,4,1,2,3,2,0,3,1,2,3,-1,3,1,-2,3,1,1,2,1,1,1,3,3,3,2,2,3,2,-2,3,3,0,0,2,0,-2,3,3,1,1,1,-2,1,0,2,2,0,2,3,2,2,3,0,1,2,0,2,2,3,2,-1,1,3,3,2,2,3,0,-1,1,0,1,2,0,1,-1,1,7,5,7,7,5,6,5,5,6,6,6,5 +R_7LSevVCtjQKhCLx,32 - 38,American,Male,Agree,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,5,2,3,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Disagree,2,5,3,1,4,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat disagree,Agree,Strongly agree,Agree,Somewhat agree,4,1,3,2,5,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,1,3,4,5,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,3,4,1,5,6,Strongly agree,Agree,Agree,Somewhat disagree,Somewhat agree,3,2,5,1,4,6,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,1,3,4,5,2,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,3,1,5,4,8,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,Strongly disagree,1,4,5,2,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,1,5,4,3,4,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,1,3,2,8,Strongly agree,Strongly disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,1,2,5,4,3,6,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,5,4,1,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,3,1,4,2,2,1,-2,-1,-1,-1,1,10 cents,25 minutes,15 days,Male,College Diploma/Certificate,35,01PfPsV,02FUT,5,02DGEN,1.375,0,0.333333333,9,6,2,3,4,8,7,1,5,3,2,4,1,2,0,1,3,2,0,0,0,-2,-2,0,1,1,1,1,-1,2,3,2,1,1,1,0,1,0,0,0,1,1,1,3,2,2,-1,1,1,1,0,1,0,0,1,1,0,1,1,0,1,2,-3,1,1,1,1,0,1,1,1,0,1,3,-3,3,0,-1,1,-1,0,1,1,0,0,1,1,1,5,4,10,6,6,6,8,5,4,8,6,5 +R_7FbNtQGpMeytU77,39 - 45,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,5,1,3,4,Agree,Strongly agree,Agree,Disagree,Somewhat agree,1,2,3,4,5,Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,3,5,1,2,4,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,2,3,5,4,1,0,Agree,Agree,Strongly agree,Strongly disagree,Agree,3,5,4,2,1,0,Strongly agree,Somewhat Agree,Agree,Agree,Agree,2,4,3,1,5,0,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,1,3,5,2,0,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,3,1,2,4,5,0,Agree,Agree,Strongly agree,Somewhat Disagree,Agree,3,2,4,1,5,2,Strongly agree,Strongly agree,Agree,Agree,Agree,2,4,3,1,5,4,Agree,Agree,Strongly agree,Agree,Somewhat agree,1,3,2,5,4,3,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,1,4,3,5,6,Agree,Agree,Strongly agree,Strongly agree,Somewhat agree,3,5,4,2,1,8,Strongly agree,Agree,Strongly agree,Disagree,Agree,3,4,1,5,2,5,Strongly agree,Strongly agree,Agree,Agree,Agree,1,4,3,2,5,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,1,2,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),42,03VPfPs,02FUT,10,01ITEM,0.75,0,1,8,7,6,5,4,3,2,1,9,4,2,3,1,2,3,3,3,2,2,3,2,-2,1,2,3,2,3,3,3,3,2,3,2,2,2,3,-3,2,3,1,2,2,2,2,3,3,3,2,3,3,2,2,3,2,2,3,-1,2,3,3,2,2,2,2,2,3,2,1,2,3,2,3,3,2,2,3,3,1,3,2,3,-2,2,3,3,2,2,2,0,0,0,0,0,2,4,3,6,8,5,10 +R_1sR6SkLrTXmFvBZ,46 - 52,American,Female,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,1,5,3,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,2,4,1,3,5,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,3,2,4,1,5,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,3,1,4,5,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,1,5,4,2,3,6,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,2,3,4,5,1,5,Agree,Agree,Agree,Agree,Somewhat agree,4,1,5,2,3,4,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,2,3,1,5,4,6,Somewhat Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,5,2,1,4,3,8,Agree,Agree,Somewhat agree,Somewhat agree,Agree,5,4,2,1,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,1,4,2,5,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,5,3,1,4,2,5,Agree,Agree,Somewhat agree,Somewhat agree,Agree,3,5,4,2,1,4,Somewhat disagree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,5,4,3,2,4,Neither Agree nor Disagree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,4,3,1,5,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,-1,1,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,46,02PsVPf,01PAST,10,01ITEM,0.25,0,1,2,5,7,8,4,3,6,1,9,4,2,3,1,2,2,1,1,1,-1,1,2,-1,1,1,-1,2,-1,2,2,2,1,1,1,-1,1,1,-1,1,1,1,2,-1,1,2,2,2,2,1,-1,1,2,-1,1,1,1,2,1,1,2,2,1,1,2,-1,-1,1,-1,1,0,1,1,-1,2,2,2,1,1,2,-1,-1,2,-2,1,0,1,2,-1,1,5,6,5,4,6,8,5,5,5,4,4,5 +R_5ZUNfu9DaX8alhH,25 - 31,Canadian,Female,Strongly agree,Agree,Agree,Somewhat disagree,Strongly agree,1,4,3,5,2,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,2,5,1,3,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,5,4,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,4,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,4,1,5,3,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,1,5,3,2,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,4,3,5,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,2,3,1,4,5,Agree,Agree,Somewhat agree,Agree,Somewhat agree,5,3,2,4,1,7,Agree,Agree,Agree,Agree,Agree,1,3,5,2,4,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,3,4,2,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,1,3,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,1,2,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,29,03VPfPs,01PAST,10,01ITEM,0,0,0.666666667,9,4,2,7,3,5,6,1,8,4,3,2,1,3,2,2,-1,3,-1,-1,-1,-1,-1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,2,2,1,2,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,5,6,7,6,6,5,7,6,6,6,6,4 +R_3WowcOSNUaoH2BH,46 - 52,American,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly disagree,5,4,2,1,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Somewhat agree,3,1,5,4,2,Strongly Agree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,5,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,1,2,3,4,5,7,Strongly disagree,Somewhat disagree,Strongly agree,Strongly agree,Somewhat agree,5,2,3,4,1,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,3,2,4,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,5,4,2,1,3,6,Somewhat disagree,Strongly disagree,Somewhat agree,Strongly agree,Somewhat agree,3,2,1,5,4,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,3,5,4,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,1,4,5,2,3,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Somewhat agree,4,2,1,3,5,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,3,2,5,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,2,1,3,5,2,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Somewhat agree,3,5,2,1,4,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,3,5,4,1,2,2,2,2,1,2,2,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,47,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,4,3,5,9,2,7,8,1,6,3,2,4,1,3,3,3,1,-3,-3,-3,3,3,1,3,-3,3,-3,3,1,3,3,3,-3,-3,-1,3,3,1,3,-3,3,-3,3,3,3,3,3,-3,-1,-3,1,3,1,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,3,1,3,-3,3,-3,3,3,3,3,3,-3,-3,-3,3,3,1,3,-3,3,-3,3,2,7,2,2,6,2,2,2,2,2,2,2 +R_3OruJppc3NY5hRr,25 - 31,Canadian,Male,Neither agree nor disagree,Disagree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,5,3,2,4,1,Neither agree nor disagree,Strongly disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,4,1,5,3,2,Strongly Disagree,Strongly Disagree,Somewhat Disagree,Strongly Disagree,Neither Agree nor Disagree,4,1,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Somewhat agree,Disagree,Strongly disagree,Somewhat disagree,Neither agree nor disagree,5,2,1,3,4,7,Strongly disagree,Somewhat disagree,Disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,5,Disagree,Disagree,Somewhat Disagree,Strongly Disagree,Somewhat Disagree,5,2,4,1,3,3,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,3,4,2,1,5,5,Somewhat disagree,Disagree,Strongly disagree,Disagree,Neither agree nor disagree,2,5,4,1,3,4,Somewhat Disagree,Strongly Disagree,Somewhat Disagree,Disagree,Disagree,4,1,3,5,2,9,Disagree,Disagree,Agree,Agree,Agree,2,1,3,4,5,6,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,4,2,3,5,1,6,Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,2,4,3,10,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly disagree,Somewhat agree,3,5,4,1,2,9,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,5,2,3,1,5,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Disagree,5,2,3,4,1,1,1,1,-2,-1,-1,0,-1,5 cents,5 minutes,47 days,Male,University - PhD,25,02PsVPf,01PAST,10,02DGEN,0.75,1,0,5,2,7,9,8,6,4,1,3,2,3,4,1,0,-2,-1,-1,0,0,-3,-1,-1,-1,-3,-3,-1,-3,0,1,-2,-3,-1,0,-3,-1,-2,0,0,-2,-2,-1,-3,-1,0,-1,0,-3,0,-1,-2,-3,-2,0,-1,-3,-1,-2,-2,-2,-2,2,2,2,-1,0,0,0,-2,-2,0,1,0,0,1,-1,-1,-3,1,-1,-1,0,1,0,-1,1,1,0,-3,5,7,5,3,5,4,9,6,6,10,9,5 +R_7pAaC1pJW61RQad,53 - 59,American,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,3,4,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,5,3,2,4,1,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,Agree,Strongly Agree,1,5,2,3,4,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,3,1,2,4,3,Disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,2,1,4,3,5,4,Somewhat Agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,4,2,1,3,4,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,5,3,2,1,2,Disagree,Agree,Strongly agree,Agree,Strongly agree,5,4,2,1,3,2,Somewhat Agree,Disagree,Strongly agree,Agree,Strongly agree,4,2,1,3,5,2,Somewhat disagree,Strongly agree,Strongly agree,Agree,Strongly agree,3,5,4,2,1,5,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,5,3,1,2,4,5,Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,1,4,3,2,5,2,Disagree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,3,5,2,3,Disagree,Disagree,Strongly agree,Disagree,Strongly agree,2,4,1,5,3,8,Agree,Somewhat Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,1,4,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,2,2,2,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),58,03VPfPs,02FUT,5,01ITEM,-0.375,0,1,9,6,8,3,2,4,7,1,5,2,3,4,1,2,3,3,3,3,0,1,2,-1,3,1,0,3,2,3,2,3,3,2,3,-2,1,3,1,3,1,3,3,2,3,2,3,3,1,3,-2,2,3,2,3,1,-2,3,2,3,-1,3,3,2,3,-1,-1,3,-1,3,2,-1,3,2,3,-2,3,3,2,3,-2,-2,3,-2,3,2,-1,3,1,3,3,4,4,2,2,2,5,5,2,3,8,4 +R_7PMo5HLzFMci0s8,25 - 31,American,Male,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,5,3,2,4,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,5,4,3,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,5,1,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,5,1,3,2,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,4,3,5,2,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,5,2,5,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,3,2,4,1,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Agree,2,3,4,1,5,5,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,5,3,2,5,Strongly disagree,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,3,1,4,2,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,1,4,3,5,5,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,5,2,3,5,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,5,1,3,2,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,1,2,3,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,3,4,2,-2,-1,-2,2,-1,-2,0,-2,10 cents,100 minutes,24 days,Male,High School (or equivalent),25,01PfPsV,02FUT,5,02DGEN,-0.75,0,1,2,7,6,9,4,8,5,1,3,2,4,3,1,-3,3,3,3,0,0,-3,2,-3,1,3,3,3,2,3,-3,3,3,3,0,0,-3,3,-3,2,3,3,3,3,3,-3,3,3,3,0,0,-3,3,-3,2,3,3,3,2,3,-3,2,3,3,0,0,-3,3,-3,0,3,3,3,2,3,-3,3,3,3,0,0,-3,3,-3,0,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5 +R_3HFFvxOBPNYGCrm,46 - 52,American,Male,Somewhat agree,Agree,Agree,Strongly agree,Agree,2,1,5,4,3,Neither agree nor disagree,Agree,Somewhat agree,Agree,Agree,1,3,5,4,2,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,4,5,3,1,2,Agree,Strongly agree,Agree,Agree,Agree,1,2,4,3,5,9,Agree,Somewhat agree,Strongly agree,Strongly agree,Agree,1,2,3,5,4,9,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,3,5,4,1,9,Agree,Somewhat agree,Agree,Agree,Strongly agree,4,1,2,5,3,9,Strongly agree,Agree,Agree,Somewhat agree,Agree,5,1,3,4,2,10,Strongly agree,Somewhat Agree,Agree,Agree,Agree,4,3,2,1,5,10,Agree,Agree,Strongly agree,Agree,Strongly agree,5,4,2,1,3,9,Strongly agree,Agree,Agree,Agree,Agree,2,4,5,3,1,9,Strongly agree,Agree,Somewhat Agree,Agree,Agree,2,3,4,5,1,8,Agree,Strongly agree,Agree,Agree,Agree,5,2,4,3,1,9,Strongly agree,Agree,Somewhat agree,Agree,Agree,3,4,1,2,5,9,Strongly agree,Agree,Strongly agree,Agree,Agree,5,1,2,4,3,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,-2,-1,-1,1,10 cents,5 minutes,24 days,Male,University - Graduate (Masters),48,02PsVPf,01PAST,10,01ITEM,0.875,0.333333333,0.666666667,2,7,8,3,5,6,4,1,9,2,4,3,1,1,2,2,3,2,0,2,1,2,2,1,2,1,2,1,2,3,2,2,2,2,1,3,3,2,2,3,3,2,3,2,1,2,2,3,3,2,2,1,2,3,1,2,2,2,2,2,3,2,3,3,2,2,2,2,3,2,1,2,2,2,3,2,2,2,3,2,1,2,2,3,2,3,2,2,9,9,9,9,10,10,9,9,8,9,9,9 +R_594ZBusw8KrQgVf,39 - 45,American,Female,Strongly agree,Strongly agree,Agree,Somewhat agree,Neither agree nor disagree,5,3,1,2,4,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,1,4,2,3,5,Agree,Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,4,3,1,5,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,5,3,2,4,1,0,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,4,3,2,1,5,0,Somewhat Agree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,3,1,2,4,0,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,2,5,4,3,1,0,Strongly agree,Disagree,Strongly agree,Somewhat agree,Strongly agree,5,1,3,4,2,0,Somewhat Agree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,1,2,4,3,0,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat agree,4,5,3,1,2,1,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,2,3,1,4,5,1,Somewhat Agree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,4,2,1,3,0,Strongly agree,Strongly agree,Agree,Somewhat agree,Somewhat agree,3,1,2,5,4,0,Strongly agree,Disagree,Strongly agree,Agree,Strongly agree,3,2,5,4,1,0,Somewhat Agree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,4,1,3,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,-2,0,2,-1,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,42,03VPfPs,02FUT,5,01ITEM,-0.25,0,1,3,9,5,2,7,8,4,1,6,3,4,2,1,3,3,2,1,0,1,-1,3,1,1,2,-2,3,0,3,3,3,3,1,1,3,-1,3,1,3,1,-3,3,0,3,3,3,3,1,1,3,-2,3,1,3,1,-3,3,1,3,3,3,2,1,1,3,-1,3,1,3,1,-3,3,1,3,3,3,2,1,1,3,-2,3,2,3,1,-3,3,1,3,0,0,0,0,0,0,1,1,0,0,0,0 +R_1Vw2t2h7mFWUm6a,46 - 52,American,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,5,4,3,2,1,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,5,3,4,2,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Agree,1,3,5,4,2,Agree,Strongly agree,Somewhat agree,Agree,Strongly agree,2,3,5,4,1,8,Agree,Somewhat agree,Strongly agree,Agree,Somewhat agree,1,2,3,5,4,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,10,Somewhat agree,Agree,Agree,Strongly agree,Strongly agree,5,2,4,3,1,4,Strongly agree,Agree,Agree,Strongly agree,Agree,4,5,2,1,3,5,Strongly agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,1,2,4,3,5,5,Agree,Agree,Somewhat agree,Strongly agree,Agree,1,4,2,5,3,6,Strongly agree,Agree,Agree,Agree,Strongly agree,4,5,2,3,1,6,Agree,Agree,Agree,Strongly agree,Somewhat Agree,4,2,5,3,1,4,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,1,3,4,2,3,Agree,Strongly agree,Strongly agree,Agree,Agree,3,1,4,2,5,1,Agree,Agree,Strongly agree,Agree,Strongly agree,3,1,2,5,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,-2,-1,-2,-2,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),50,03VPfPs,01PAST,5,01ITEM,1.375,1,0,9,7,5,8,6,3,4,1,2,3,2,4,1,3,3,3,1,3,3,3,2,3,2,3,3,3,3,2,2,3,1,2,3,2,1,3,2,1,2,3,3,3,3,1,2,2,3,3,3,2,2,3,2,3,1,3,2,3,2,2,1,3,2,3,2,2,2,3,2,2,2,3,1,3,3,3,2,2,2,3,3,2,2,2,2,3,2,3,8,6,10,4,5,5,6,6,4,3,1,5 +R_7KC4faGfHitNseM,25 - 31,American,Male,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,4,1,5,Strongly agree,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,5,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,4,2,3,5,1,Agree,Somewhat agree,Strongly agree,Strongly agree,Somewhat disagree,2,3,4,1,5,9,Agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,5,1,3,4,2,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,3,2,5,1,4,10,Strongly agree,Disagree,Strongly agree,Agree,Somewhat agree,1,4,2,5,3,7,Somewhat disagree,Agree,Strongly agree,Disagree,Agree,3,2,1,4,5,3,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,3,1,4,5,2,9,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,5,3,4,1,2,5,Strongly agree,Somewhat disagree,Strongly agree,Strongly agree,Agree,4,5,1,3,2,9,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Agree,1,4,2,3,5,10,Strongly agree,Somewhat disagree,Strongly agree,Agree,Strongly agree,1,5,2,3,4,7,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,8,Agree,Agree,Agree,Strongly agree,Strongly agree,2,5,3,1,4,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-1,-2,-2,2,10 cents,100 minutes,24 days,Male,University - Undergraduate,27,01PfPsV,01PAST,10,01ITEM,1.375,0,1,2,3,9,6,5,7,4,1,8,3,4,2,1,2,3,3,3,3,3,-1,3,1,3,3,3,3,3,3,2,1,3,3,-1,2,3,3,-1,2,3,3,3,3,-1,3,-2,3,2,1,-1,2,3,-2,2,3,3,2,3,2,1,3,2,3,2,3,-1,3,3,2,3,1,3,1,2,3,-1,3,2,3,2,2,3,3,3,2,2,2,3,3,9,7,10,7,3,9,5,9,10,7,8,8 +R_1hhgqMOYXxS8hXD,25 - 31,American,Male,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Agree,5,4,3,2,1,Disagree,Agree,Strongly agree,Disagree,Strongly agree,4,2,5,3,1,Somewhat Agree,Disagree,Strongly Agree,Disagree,Agree,2,4,1,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Somewhat agree,5,3,2,1,4,2,Disagree,Agree,Agree,Disagree,Agree,3,4,5,1,2,2,Somewhat Agree,Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,1,4,5,2,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,4,3,5,1,2,2,Disagree,Agree,Agree,Disagree,Agree,5,3,2,4,1,2,Agree,Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,4,3,2,2,Agree,Neither agree nor disagree,Agree,Disagree,Agree,5,1,3,4,2,2,Somewhat disagree,Somewhat agree,Agree,Disagree,Agree,5,2,3,1,4,1,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Disagree,Agree,2,4,1,5,3,2,Agree,Somewhat agree,Agree,Disagree,Strongly agree,2,5,1,3,4,2,Somewhat disagree,Agree,Agree,Disagree,Strongly agree,3,4,2,5,1,2,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Disagree,Agree,1,2,5,3,4,0,2,1,2,0,1,2,0,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),31,03VPfPs,02FUT,5,02DGEN,-0.25,1,0,9,8,5,2,4,7,3,1,6,3,2,4,1,0,1,2,-2,2,-2,2,3,-2,3,1,-2,3,-2,2,0,0,0,-2,1,-2,2,2,-2,2,1,-2,2,0,0,0,-1,0,-2,0,-2,2,2,-2,2,2,-2,2,0,0,2,0,2,-2,2,-1,1,2,-2,2,0,-3,3,-2,2,2,1,2,-2,3,-1,2,2,-2,3,0,-3,3,-2,2,2,2,2,2,2,2,2,2,1,2,2,2 +R_3iP3ScRISYbz83v,32 - 38,American,Male,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,5,4,2,3,1,Strongly agree,Agree,Strongly agree,Somewhat agree,Agree,2,1,3,5,4,Agree,Agree,Agree,Strongly Agree,Agree,2,5,3,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Strongly agree,Strongly agree,Agree,Agree,Agree,4,2,1,5,3,9,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,3,2,9,Agree,Strongly agree,Agree,Strongly agree,Agree,1,2,3,4,5,8,Strongly agree,Agree,Agree,Strongly agree,Agree,4,1,3,2,5,9,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,4,5,1,3,2,8,Agree,Strongly agree,Agree,Strongly agree,Agree,1,4,3,2,5,8,Agree,Strongly agree,Agree,Agree,Strongly agree,5,4,1,3,2,8,Strongly agree,Agree,Agree,Agree,Strongly agree,4,1,5,3,2,8,Agree,Agree,Agree,Strongly agree,Agree,2,3,4,5,1,7,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,3,1,4,2,10,Agree,Strongly agree,Agree,Agree,Agree,1,2,5,4,3,7,Agree,Agree,Agree,Strongly agree,Agree,4,5,2,1,3,1,1,1,-1,-1,-1,-1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),35,01PfPsV,02FUT,10,02DGEN,1,0,1,6,9,4,2,7,8,5,1,3,2,4,3,1,3,3,2,3,3,3,2,3,1,2,2,2,2,3,2,3,3,2,2,2,2,2,3,3,3,2,3,2,3,2,3,2,2,3,2,2,3,3,3,2,2,3,2,3,2,2,3,2,2,3,3,2,2,2,3,2,2,2,3,2,3,3,3,2,2,2,3,2,2,2,2,2,2,3,2,8,9,9,8,9,8,8,8,8,7,10,7 +R_7GdmjQHboGhWWSY,46 - 52,American,Male,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,2,3,5,4,Neither agree nor disagree,Agree,Agree,Agree,Agree,4,1,3,5,2,Somewhat Disagree,Somewhat Agree,Agree,Disagree,Somewhat Agree,2,1,3,4,5,Agree,Strongly agree,Agree,Agree,Somewhat disagree,2,4,1,5,3,2,Neither agree nor disagree,Agree,Agree,Agree,Agree,5,3,1,2,4,2,Disagree,Agree,Agree,Disagree,Agree,4,5,3,2,1,2,Agree,Strongly agree,Somewhat agree,Agree,Somewhat disagree,4,2,5,1,3,1,Neither agree nor disagree,Agree,Agree,Agree,Agree,2,3,4,5,1,2,Disagree,Somewhat Agree,Agree,Strongly Disagree,Agree,2,4,1,5,3,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,2,Neither agree nor disagree,Agree,Agree,Agree,Agree,4,5,3,1,2,2,Disagree,Agree,Agree,Disagree,Agree,3,2,1,4,5,2,Agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,3,1,4,5,3,Neither agree nor disagree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,4,3,1,2,2,Disagree,Somewhat Agree,Agree,Disagree,Agree,1,2,5,3,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,1,-2,1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,47,03VPfPs,02FUT,10,01ITEM,0.25,0,1,5,4,9,3,8,2,7,1,6,3,4,2,1,2,3,1,0,-1,0,2,2,2,2,-1,1,2,-2,1,2,3,2,2,-1,0,2,2,2,2,-2,2,2,-2,2,2,3,1,2,-1,0,2,2,2,2,-2,1,2,-3,2,2,2,1,0,0,0,2,2,2,2,-2,2,2,-2,2,2,2,1,0,0,0,1,1,2,1,-2,1,2,-2,2,2,2,2,1,2,2,2,2,2,3,2,3 +R_6yjyJGo63gxtsRm,32 - 38,American,Male,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,3,5,2,4,Somewhat disagree,Disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,3,4,1,2,5,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,1,4,3,5,2,Somewhat agree,Agree,Somewhat agree,Strongly agree,Strongly agree,1,2,3,5,4,10,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,2,4,1,3,5,10,Somewhat Agree,Strongly agree,Agree,Agree,Strongly agree,2,4,3,5,1,10,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,5,1,3,2,4,10,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,4,5,9,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,5,3,1,2,9,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,1,3,2,5,4,8,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,2,4,3,5,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,5,4,1,3,9,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,1,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,2,4,5,1,3,9,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,1,4,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,-2,-1,-2,-2,2,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,35,02PsVPf,02FUT,10,01ITEM,1.75,0.666666667,0.333333333,9,2,5,8,7,6,4,1,3,4,3,2,1,2,3,3,2,1,-1,-2,3,0,0,1,-1,-1,1,1,1,2,1,3,3,3,2,3,3,3,1,3,2,2,3,2,3,2,1,3,1,3,3,3,3,3,3,3,2,3,3,1,1,3,3,3,3,1,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,1,3,1,3,3,3,10,10,10,10,9,9,8,5,9,10,9,8 +R_3FfUCdiMXQdU09F,32 - 38,American,Male,Agree,Agree,Agree,Agree,Agree,1,2,5,3,4,,Disagree,Agree,Disagree,Agree,3,2,4,1,5,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,2,3,4,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Agree,Agree,Agree,Agree,Agree,3,4,2,1,5,6,Agree,Agree,Agree,Agree,Agree,5,2,4,3,1,6,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,4,3,2,5,6,Agree,Agree,Agree,Agree,Agree,2,4,3,5,1,6,Neither agree nor disagree,Disagree,Agree,Disagree,Agree,1,4,3,5,2,6,Agree,Agree,Agree,Agree,Agree,4,5,3,2,1,6,Agree,Agree,Agree,Agree,Agree,4,1,2,3,5,6,Agree,Disagree,Agree,Disagree,Agree,2,5,1,3,4,6,Agree,Agree,Agree,Agree,Agree,2,4,3,5,1,6,Agree,Agree,Agree,Agree,Agree,3,1,2,5,4,6,Agree,Disagree,Agree,Disagree,Agree,3,4,2,1,5,6,Agree,Agree,Agree,Agree,Agree,5,1,4,2,3,2,2,2,0,1,2,1,2,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),38,03VPfPs,01PAST,5,02DGEN,0.5,1,0,3,7,4,8,2,5,6,1,9,2,4,3,1,2,2,2,2,2,,-2,2,-2,2,3,3,3,0,3,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,0,-2,2,-2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,2,2,2,2,2,2,-2,2,-2,2,2,2,2,2,2,6,6,6,6,6,6,6,6,6,6,6,6 +R_1xTXIFJAYsto83D,25 - 31,Canadian,Male,Somewhat agree,Agree,Agree,Strongly agree,Agree,3,5,4,1,2,Agree,Agree,Agree,Agree,Agree,3,5,1,4,2,Agree,Agree,Strongly Agree,Somewhat Agree,Agree,4,5,1,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,1,2,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,4,2,2,Somewhat agree,Agree,Somewhat agree,Agree,Agree,3,4,1,5,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,2,1,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,7,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,5,1,2,4,3,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,4,5,1,8,Agree,Strongly agree,Strongly agree,Somewhat Agree,Agree,4,2,1,3,5,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,3,4,1,5,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,5,2,3,1,4,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,4,1,5,1,2,2,2,-2,2,2,-1,10 cents,5 minutes,47 days,Male,University - Undergraduate,27,02PsVPf,01PAST,5,02DGEN,0,0.666666667,0.333333333,5,8,3,4,2,9,6,1,7,2,4,3,1,1,2,2,3,2,2,2,2,2,2,2,2,3,1,2,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,3,3,2,3,3,1,2,3,3,3,3,3,3,2,3,3,2,2,3,3,3,3,1,5,5,2,3,1,7,3,8,8,5,6 +R_39rm2f2Kp8eAy8p,25 - 31,Canadian,Male,Agree,Agree,Agree,Agree,Agree,4,2,3,1,5,Agree,Somewhat agree,Somewhat agree,Somewhat disagree,Agree,4,1,2,5,3,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Disagree,1,3,2,5,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,2,4,5,3,1,9,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,5,1,3,8,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,5,2,4,8,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,4,3,2,5,8,Agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,1,4,2,5,3,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,3,4,5,1,2,8,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Agree,4,3,1,2,5,8,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,1,3,2,5,6,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,1,4,2,3,5,7,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat agree,1,2,4,3,5,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,4,1,3,5,2,8,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,2,5,1,3,4,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,-1,1,-1,0,-1,0,0,10 cents,100 minutes,47 days,Male,Professional Degree (ex. JD/MD),25,02PsVPf,01PAST,10,01ITEM,0.25,0.333333333,0.666666667,4,7,2,5,9,6,8,1,3,4,3,2,1,2,2,2,2,2,2,1,1,-1,2,1,-1,2,1,-1,1,0,1,0,-1,1,-1,1,0,1,1,1,1,0,1,2,1,1,1,2,2,-1,1,0,-1,1,1,1,1,-1,1,1,-1,-1,2,1,0,0,1,1,-1,1,-1,1,0,1,1,-1,-1,1,1,1,0,0,-1,-1,1,1,-1,0,9,8,8,8,7,8,8,6,7,8,8,8 +R_61hV6iQUShiPsbN,32 - 38,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,4,5,3,1,2,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Somewhat disagree,1,2,3,5,4,Neither Agree nor Disagree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,3,1,2,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Somewhat agree,Somewhat disagree,Agree,Strongly agree,5,3,2,1,4,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,5,1,3,4,2,4,Somewhat Agree,Neither Agree nor Disagree,Disagree,Agree,Agree,4,2,3,5,1,7,Neither agree nor disagree,Strongly agree,Agree,Somewhat disagree,Somewhat agree,1,2,3,5,4,7,Agree,Neither agree nor disagree,Somewhat agree,Disagree,Strongly agree,2,5,1,4,3,6,Strongly Disagree,Strongly Disagree,Somewhat Agree,Disagree,Somewhat Disagree,3,5,4,2,1,2,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,3,2,1,4,3,Somewhat agree,Somewhat agree,Agree,Somewhat disagree,Strongly agree,3,2,4,5,1,6,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,2,4,6,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,4,2,3,1,5,6,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Strongly agree,3,5,1,4,2,8,Somewhat Agree,Agree,Strongly agree,Agree,Strongly agree,5,2,3,4,1,1,1,1,2,0,-1,0,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,36,03VPfPs,01PAST,10,02DGEN,0.5,0,1,9,2,5,7,8,6,4,1,3,4,2,3,1,3,3,3,1,3,1,0,2,1,-1,0,1,3,2,3,2,1,-1,2,3,-1,0,1,2,1,1,0,-2,2,2,0,3,2,-1,1,2,0,1,-2,3,-3,-3,1,-2,-1,3,3,3,0,3,1,1,2,-1,3,2,3,3,3,3,3,3,3,-2,3,1,1,3,-2,3,1,2,3,2,3,5,5,4,7,7,6,2,3,6,6,6,8 +R_3iIJRF71Jwue5Ql,25 - 31,American,Male,Agree,Agree,Agree,Disagree,Agree,2,3,4,1,5,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Agree,2,5,4,3,1,Disagree,Disagree,Agree,Somewhat Agree,Agree,5,1,4,2,3,Agree,Agree,Agree,Strongly disagree,Agree,3,1,2,4,5,1,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Agree,4,2,3,5,1,1,Strongly Disagree,Agree,Agree,Agree,Agree,1,2,5,3,4,1,Agree,Agree,Agree,Strongly disagree,Agree,1,2,5,4,3,1,Disagree,Somewhat agree,Disagree,Somewhat agree,Agree,4,1,5,2,3,0,Strongly Disagree,Strongly Disagree,Agree,Agree,Agree,4,3,1,2,5,1,Agree,Agree,Agree,Disagree,Agree,1,2,4,5,3,1,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,3,5,2,4,1,1,Disagree,Disagree,Agree,Agree,Agree,4,1,3,5,2,1,Agree,Agree,Agree,Strongly disagree,Agree,5,1,4,3,2,1,Disagree,Somewhat agree,Disagree,Somewhat agree,Agree,1,4,5,3,2,1,Strongly Disagree,Agree,Agree,Agree,Agree,1,3,5,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-1,1,2,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,31,03VPfPs,02FUT,5,01ITEM,0,0.333333333,0.666666667,9,4,5,8,7,3,6,1,2,2,3,4,1,2,2,2,-2,2,0,1,-1,1,2,-2,-2,2,1,2,2,2,2,-3,2,-3,0,-1,1,2,-3,2,2,2,2,2,2,2,-3,2,-2,1,-2,1,2,-3,-3,2,2,2,2,2,2,-2,2,-1,1,-1,1,1,-2,-2,2,2,2,2,2,2,-3,2,-2,1,-2,1,2,-3,2,2,2,2,1,1,1,1,0,1,1,1,1,1,1,1 +R_3Ke5YBJbB40pFnq,32 - 38,American,Male,Agree,Somewhat agree,Somewhat agree,Strongly agree,Agree,2,5,4,3,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,5,1,4,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Agree,5,1,2,3,4,1,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,3,4,2,1,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,5,4,2,1,1,Agree,Agree,Somewhat agree,Agree,Agree,1,4,5,2,3,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,4,2,5,3,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,5,3,2,1,Agree,Agree,Somewhat agree,Strongly agree,Agree,5,1,4,3,2,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,2,1,5,4,3,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,4,1,3,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,2,1,3,4,5,1,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,3,2,5,4,1,1,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,3,5,2,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,-1,0,-1,0,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),37,01PfPsV,01PAST,5,01ITEM,0.375,0,1,4,8,7,2,3,5,6,1,9,3,4,2,1,2,1,1,3,2,0,-1,1,-1,1,1,2,1,1,1,1,1,1,2,2,0,-1,1,-1,1,1,1,1,1,1,2,2,1,2,2,-1,-1,1,-1,1,1,1,1,1,1,2,2,1,3,2,-1,-1,1,-1,0,1,1,1,1,1,1,1,1,2,1,-1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +R_1WZphWu16CrMjG1,46 - 52,American,Male,Agree,Agree,Somewhat disagree,Somewhat disagree,Disagree,1,2,4,5,3,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,2,4,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,3,2,1,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Somewhat agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat disagree,5,3,1,4,2,6,Somewhat agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat disagree,3,1,5,4,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,4,5,1,6,Somewhat agree,Somewhat agree,Disagree,Agree,Disagree,1,3,5,4,2,6,Agree,Somewhat disagree,Agree,Disagree,Somewhat disagree,4,3,2,5,1,6,Agree,Agree,Agree,Agree,Agree,1,5,2,3,4,7,Agree,Agree,Somewhat disagree,Agree,Somewhat disagree,5,4,2,1,3,7,Agree,Agree,Agree,Agree,Agree,5,3,2,4,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,2,1,4,7,Agree,Agree,Disagree,Somewhat agree,Somewhat disagree,2,1,3,4,5,6,Agree,Disagree,Agree,Somewhat disagree,Somewhat disagree,5,2,4,3,1,6,Agree,Agree,Agree,Agree,Agree,2,4,3,5,1,1,1,1,-1,1,-1,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),51,02PsVPf,02FUT,5,02DGEN,0.75,0,1,7,9,4,3,8,5,2,1,6,2,3,4,1,2,2,-1,-1,-2,1,-1,1,-1,-1,1,1,1,1,2,1,-1,-1,-1,-1,1,-1,1,-2,-1,1,1,1,1,1,1,1,-2,2,-2,2,-1,2,-2,-1,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,1,1,1,1,1,2,2,-2,1,-1,2,-2,2,-1,-1,2,2,2,2,2,7,6,6,6,6,6,7,7,5,7,6,6 +R_1P0pEfyrptM5noE,32 - 38,American,Male,Neither agree nor disagree,Agree,Agree,Agree,Agree,5,3,2,4,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,2,4,5,3,1,Agree,Agree,Agree,Agree,Agree,1,4,5,2,3,Neither agree nor disagree,Agree,Agree,Agree,Agree,5,3,1,4,2,5,Somewhat disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Agree,3,5,4,2,1,7,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,5,1,4,2,3,5,Agree,Agree,Agree,Agree,Agree,2,5,1,3,4,2,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Disagree,1,2,4,3,5,2,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,4,1,2,5,3,6,Agree,Agree,Agree,Agree,Agree,3,2,5,1,4,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,4,3,2,5,1,4,Agree,Agree,Agree,Agree,Agree,3,4,2,5,1,6,Agree,Agree,Agree,Agree,Agree,4,3,1,5,2,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,2,1,3,4,5,1,Agree,Agree,Agree,Agree,Agree,5,4,3,2,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,1,1,-1,1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),35,03VPfPs,01PAST,5,01ITEM,0.125,0,1,3,8,4,2,6,9,5,1,7,3,4,2,1,0,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,0,2,2,2,2,-1,-1,-1,1,2,2,1,2,1,2,2,2,2,2,2,0,0,-1,-1,-2,2,1,2,1,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,2,2,5,7,5,2,2,6,1,4,6,1,1,1 +R_3HbIKvfAM7AQSB0,25 - 31,American,Female,Agree,Agree,Agree,Neither agree nor disagree,Strongly disagree,3,2,5,4,1,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,5,1,4,2,3,Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,2,4,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Strongly agree,Neither agree nor disagree,Strongly disagree,5,4,2,3,1,3,Neither agree nor disagree,Somewhat disagree,Strongly agree,Somewhat agree,Disagree,3,1,5,4,2,1,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,1,Strongly agree,Agree,Strongly agree,Somewhat disagree,Strongly disagree,2,4,1,5,3,4,Strongly disagree,Neither agree nor disagree,Agree,Strongly agree,Somewhat disagree,4,3,2,1,5,4,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,2,4,5,1,3,2,Agree,Agree,Strongly agree,Somewhat agree,Strongly disagree,5,2,3,4,1,1,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,3,1,4,2,0,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,4,5,3,2,1,0,Agree,Agree,Strongly agree,Somewhat agree,Disagree,4,2,1,3,5,3,Neither agree nor disagree,Disagree,Strongly agree,Neither agree nor disagree,Strongly agree,3,5,2,4,1,1,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Strongly agree,3,2,5,1,4,0,1,2,2,0,-1,2,1,5 cents,100 minutes,15 days,Female,High School (or equivalent),30,02PsVPf,02FUT,10,02DGEN,0.125,0.333333333,0.333333333,3,4,2,7,6,9,5,1,8,3,4,2,1,2,2,2,0,-3,-2,-1,2,0,1,2,-1,3,1,3,2,2,3,0,-3,0,-1,3,1,-2,2,-1,3,3,3,3,2,3,-1,-3,-3,0,2,3,-1,2,-1,3,3,3,2,2,3,1,-3,0,-1,3,0,1,2,-1,3,3,3,2,2,3,1,-2,0,-2,3,0,3,2,-1,3,3,3,1,3,1,1,4,4,2,1,0,0,3,1 +R_3lGLAqcojhv6lne,18 - 24,American,Female,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,2,4,3,1,5,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,3,4,1,Strongly Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,2,4,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,1,2,5,4,3,7,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,1,4,2,3,5,7,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,1,4,3,2,5,6,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,4,1,2,5,7,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,5,3,4,1,2,6,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,1,2,4,5,3,8,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,3,1,2,5,4,8,Strongly agree,Strongly agree,Agree,Agree,Agree,4,2,3,5,1,8,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,5,3,2,1,4,8,Strongly agree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,3,5,4,2,5,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,3,4,1,5,8,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,4,5,3,1,2,2,-1,-1,-2,-1,2,5 cents,5 minutes,15 days,Female,College Diploma/Certificate,24,03VPfPs,02FUT,5,02DGEN,1.5,0.666666667,0,6,5,3,4,9,8,7,1,2,3,2,4,1,2,2,3,3,3,2,3,3,2,3,3,1,2,2,1,3,2,3,2,3,3,2,2,3,3,3,2,3,2,3,3,3,3,2,3,3,3,3,3,2,3,2,3,2,3,3,3,2,3,2,3,3,2,2,2,3,3,2,3,2,3,3,3,2,1,2,3,2,3,3,3,2,3,3,3,7,7,7,6,7,6,8,8,8,8,5,8 +R_3sc317tOOXpNf0O,25 - 31,Canadian,Male,Neither agree nor disagree,Strongly agree,Agree,Disagree,Agree,2,4,1,5,3,Agree,Disagree,Disagree,Somewhat agree,Strongly agree,1,3,4,2,5,Somewhat Agree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,4,3,2,5,1,Somewhat disagree,Agree,Agree,Disagree,Agree,2,1,4,3,5,1,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,Somewhat agree,5,1,2,3,4,1,Neither Agree nor Disagree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,2,3,5,1,4,2,Somewhat agree,Disagree,Agree,Disagree,Disagree,1,2,5,4,3,5,Disagree,Agree,Strongly disagree,Agree,Disagree,5,1,2,3,4,7,Strongly Disagree,Strongly Disagree,Agree,Strongly agree,Agree,5,4,1,3,2,8,Agree,Agree,Agree,Disagree,Agree,1,5,3,4,2,1,Strongly agree,Disagree,Disagree,Somewhat disagree,Strongly agree,1,3,2,4,5,2,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,2,1,4,5,3,2,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,2,3,5,1,3,Strongly agree,Strongly disagree,Somewhat agree,Strongly disagree,Strongly agree,4,1,3,2,5,4,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Disagree,Strongly agree,1,3,2,4,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,2,2,1,-2,1,-1,5 cents,5 minutes,47 days,Male,High School (or equivalent),25,01PfPsV,01PAST,10,01ITEM,0,1,0,3,8,6,5,7,2,4,1,9,2,3,4,1,0,3,2,-2,2,2,-2,-2,1,3,1,-1,3,1,3,-1,2,2,-2,2,1,1,-2,1,1,0,-1,2,-1,2,1,-2,2,-2,-2,-2,2,-3,2,-2,-3,-3,2,3,2,2,2,2,-2,2,3,-2,-2,-1,3,0,-1,3,-2,3,2,3,2,1,3,3,-3,1,-3,3,0,-1,3,-2,3,1,1,2,5,7,8,1,2,2,3,4,3 +R_3bqx2mr4TMeLfhf,39 - 45,American,Female,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,1,3,5,2,4,Agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,4,3,1,5,2,Strongly Agree,Agree,Agree,Strongly Agree,Agree,5,2,1,4,3,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,5,2,1,3,4,6,Agree,Agree,Agree,Somewhat agree,Agree,5,4,2,1,3,7,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Agree,Agree,1,4,5,3,2,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,2,5,9,Agree,Agree,Agree,Somewhat agree,Agree,4,5,1,2,3,9,Agree,Agree,Agree,Somewhat Agree,Agree,1,4,2,3,5,9,Agree,Agree,Agree,Agree,Agree,4,2,1,3,5,9,Agree,Agree,Agree,Agree,Agree,3,4,5,2,1,9,Agree,Agree,Agree,Agree,Agree,1,5,3,2,4,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,4,3,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,3,2,10,Agree,Agree,Agree,Agree,Agree,3,2,4,1,5,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,-1,-2,-1,-2,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),41,01PfPsV,01PAST,5,01ITEM,1.375,1,0,4,7,3,5,8,9,6,1,2,2,3,4,1,2,3,3,3,2,2,0,2,1,2,3,2,2,3,2,3,3,2,3,2,2,2,2,1,2,1,1,3,1,2,3,3,3,3,3,2,2,2,1,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,6,7,8,9,9,9,9,9,9,10,10,10 +R_6tmcsCbTdClESI6,46 - 52,American,Male,Agree,Agree,Neither agree nor disagree,Strongly agree,Agree,3,4,1,5,2,Disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,5,3,4,1,2,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,5,4,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Neither agree nor disagree,Agree,Agree,2,3,4,1,5,2,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,3,1,2,4,5,0,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,4,3,2,1,5,3,Agree,Agree,Neither agree nor disagree,Agree,Agree,5,2,3,4,1,5,Disagree,Disagree,Agree,Somewhat disagree,Somewhat disagree,4,5,3,2,1,1,Agree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,2,Agree,Agree,Neither agree nor disagree,Agree,Agree,1,3,2,4,5,1,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,2,4,3,1,5,1,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,4,2,1,5,1,Agree,Agree,Neither agree nor disagree,Agree,Agree,4,1,3,2,5,1,Disagree,Disagree,Agree,Disagree,Neither agree nor disagree,1,5,3,2,4,1,Agree,Neither Agree nor Disagree,Agree,Agree,Agree,3,4,1,5,2,2,2,1,2,-1,2,2,2,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,47,02PsVPf,01PAST,10,02DGEN,0.25,0,1,9,2,8,7,3,5,4,1,6,4,2,3,1,2,2,0,3,2,-2,-1,2,-1,-1,2,0,2,1,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,0,2,2,2,0,2,2,-2,-2,2,-1,-1,2,-1,2,0,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,0,2,2,2,0,2,2,-2,-2,2,-2,0,2,0,2,2,2,1,2,0,3,5,1,2,1,1,1,1,1 +R_1YAn8pY9la5023d,25 - 31,Canadian,Male,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,1,4,5,2,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,4,5,2,1,3,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,2,3,4,6,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,2,3,4,1,5,6,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,1,3,2,5,6,Neither agree nor disagree,Somewhat agree,Agree,Agree,Agree,1,2,5,3,4,10,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,3,1,4,5,2,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Disagree,2,3,5,4,1,8,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,5,4,1,6,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,3,4,1,5,7,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,3,1,2,4,5,7,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,5,4,2,7,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,5,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,1,3,5,4,2,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,1,-1,0,-2,-1,1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),27,03VPfPs,02FUT,5,01ITEM,0.875,0,1,6,2,3,9,7,8,5,1,4,3,2,4,1,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,1,2,2,2,0,1,-1,0,1,0,1,1,0,-1,1,1,-1,0,0,0,1,0,1,1,2,0,1,-1,-1,2,1,1,0,1,-1,0,1,0,0,-1,1,0,1,0,6,6,6,10,6,8,6,7,7,7,5,7 +R_1fcIJv9FZSlIRn7,25 - 31,Canadian,Female,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,3,5,2,1,Disagree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,3,5,1,2,4,Strongly Agree,Strongly Agree,Agree,Strongly Agree,Strongly Agree,2,1,4,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,5,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,5,1,4,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,1,5,4,7,Disagree,Disagree,Strongly agree,Disagree,Strongly agree,5,1,3,2,4,7,Disagree,Disagree,Disagree,Agree,Disagree,3,4,5,1,2,9,Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,3,2,1,4,5,5,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,4,1,3,5,2,8,Somewhat agree,Strongly disagree,Strongly agree,Disagree,Somewhat agree,4,3,5,1,2,4,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,1,4,5,5,Strongly agree,Agree,Strongly agree,Somewhat agree,Agree,3,1,2,4,5,5,Somewhat agree,Disagree,Agree,Disagree,Agree,5,3,2,4,1,5,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,3,1,2,4,5,-2,2,1,1,-1,-2,2,2,5 cents,5 minutes,47 days,Female,University - Undergraduate,25,02PsVPf,02FUT,5,02DGEN,0.375,1,0,5,8,9,3,2,4,6,1,7,4,2,3,1,-1,3,3,3,3,-2,1,3,-2,1,3,3,2,3,3,2,2,2,2,2,0,-2,1,1,1,3,3,3,3,3,-2,-2,3,-2,3,-2,-2,-2,2,-2,-2,-2,1,-1,-1,1,1,3,3,3,1,-3,3,-2,1,3,3,3,2,3,3,2,3,1,2,1,-2,2,-2,2,3,2,3,3,2,5,5,5,7,7,9,5,8,4,5,5,5 +R_69QwckkLWbec5CF,18 - 24,Canadian,Female,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,1,5,3,2,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,4,1,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,5,3,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,3,1,5,4,2,6,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,1,3,4,2,7,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,5,3,2,4,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,5,4,7,Somewhat agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,1,3,4,2,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,3,1,4,2,5,Agree,Agree,Agree,Agree,Agree,5,1,4,3,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,4,3,5,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,4,1,2,5,6,Agree,Agree,Agree,Agree,Agree,5,1,4,3,2,6,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,5,4,1,3,2,6,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,3,1,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,1,0,10 cents,25 minutes,24 days,Female,High School (or equivalent),20,02PsVPf,01PAST,5,01ITEM,-0.125,0,0.666666667,7,4,2,3,8,5,6,1,9,3,4,2,1,-3,1,0,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,6,7,7,7,5,5,6,6,6,6,6,6 +R_301bFnnJjUi6pNZ,18 - 24,Canadian,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,5,1,2,4,3,Strongly agree,Somewhat agree,Agree,Agree,Strongly agree,5,4,3,2,1,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,4,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,2,3,1,5,4,4,Strongly agree,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,1,4,5,2,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,1,5,3,4,5,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,2,3,5,4,1,4,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,Somewhat disagree,4,3,5,1,2,3,Somewhat Agree,Agree,Strongly agree,Agree,Strongly agree,5,4,3,1,2,2,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,3,5,1,2,4,2,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,1,2,3,2,Somewhat Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,5,1,3,2,4,5,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,2,1,4,3,5,2,Strongly agree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,2,5,3,1,4,2,Somewhat Disagree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,4,1,2,3,1,2,1,2,0,1,2,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,24,01PfPsV,02FUT,10,02DGEN,0,0,1,2,9,5,4,3,7,6,1,8,2,4,3,1,3,3,2,3,3,3,1,2,2,3,0,-1,3,-1,3,3,3,2,2,3,3,1,-1,2,1,0,0,3,1,3,3,3,3,1,2,3,3,-1,3,-1,1,2,3,2,3,3,3,1,3,3,3,1,1,1,1,-1,-1,3,-1,3,3,3,1,3,3,3,1,2,-1,1,-1,-2,3,-3,3,4,4,4,5,4,3,2,2,2,5,2,2 +R_7k0tqkdudBxDiaE,25 - 31,American,Female,Strongly agree,Somewhat agree,Strongly agree,Agree,Agree,5,2,3,1,4,Agree,Strongly agree,Somewhat agree,Agree,Somewhat agree,4,3,1,2,5,Strongly Agree,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,2,4,5,3,1,Strongly agree,Somewhat agree,Agree,Agree,Strongly agree,5,1,4,2,3,5,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Strongly agree,5,4,1,2,3,8,Agree,Somewhat Agree,Somewhat Agree,Agree,Strongly agree,1,2,5,3,4,8,Agree,Strongly agree,Agree,Agree,Strongly agree,3,4,1,5,2,7,Agree,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,5,2,4,1,3,7,Somewhat Agree,Somewhat Agree,Agree,Agree,Strongly agree,3,2,4,1,5,9,Agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,2,3,5,1,4,7,Somewhat agree,Agree,Agree,Strongly agree,Agree,2,3,1,4,5,7,Agree,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,2,1,4,5,3,9,Agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,1,3,2,5,4,5,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,5,4,2,3,1,6,Agree,Somewhat Agree,Strongly agree,Agree,Strongly agree,4,2,3,1,5,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,1,-2,-2,-1,-2,1,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,26,01PfPsV,02FUT,5,01ITEM,1.25,0,1,9,2,8,6,3,4,7,1,5,4,2,3,1,3,1,3,2,2,2,3,1,2,1,3,1,2,2,0,3,1,2,2,3,1,2,0,1,3,2,1,1,2,3,2,3,2,2,3,2,2,3,0,1,1,1,2,2,3,2,3,1,1,2,1,2,2,3,2,2,1,2,1,3,2,3,1,1,2,2,3,3,2,1,2,1,3,2,3,5,8,8,7,7,9,7,7,9,5,6,7 +R_6ABmv1ELPyJI0Wl,18 - 24,American,Female,Somewhat agree,Strongly agree,Disagree,Somewhat agree,Somewhat agree,1,4,2,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,1,3,5,4,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,5,4,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat agree,Strongly agree,Neither agree nor disagree,Disagree,Somewhat agree,4,2,3,1,5,3,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,5,4,3,2,1,8,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly agree,1,3,5,4,2,3,Somewhat agree,Agree,Strongly agree,Strongly disagree,Agree,2,3,1,5,4,10,Strongly disagree,Agree,Somewhat agree,Strongly agree,Somewhat agree,1,4,3,2,5,10,Agree,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,3,5,1,4,2,1,Somewhat agree,Strongly agree,Disagree,Strongly agree,Agree,1,2,4,3,5,1,Agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,5,4,2,3,1,2,Strongly agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,5,1,3,4,1,Agree,Strongly agree,Disagree,Somewhat agree,Strongly agree,4,5,3,1,2,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,3,4,5,2,Agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,3,2,1,4,1,1,0,2,-2,0,1,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),21,03VPfPs,01PAST,10,02DGEN,0.125,0,1,3,9,7,8,5,6,2,1,4,2,4,3,1,1,3,-2,1,1,1,1,1,1,1,2,0,3,1,3,1,3,0,-2,1,1,1,1,1,3,2,0,1,1,3,1,2,3,-3,2,-3,2,1,3,1,2,3,0,1,1,1,3,-2,3,2,2,0,3,0,3,3,0,3,1,3,2,3,-2,1,3,1,1,1,1,1,2,0,3,1,3,1,3,8,3,10,10,1,1,2,1,1,2 +R_3DozEVS0ulEdTYR,18 - 24,Canadian,Female,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,3,1,5,4,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,3,4,1,2,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Agree,4,2,1,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,2,5,3,4,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Agree,5,2,3,1,4,5,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,4,2,1,5,3,6,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,4,5,1,2,3,4,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,2,3,5,1,5,Agree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,3,5,1,4,2,5,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,Somewhat disagree,3,4,1,5,2,7,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,4,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,3,2,4,4,Agree,Agree,Neither agree nor disagree,Somewhat agree,Disagree,4,3,2,5,1,5,Agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,2,1,3,4,5,5,Somewhat Agree,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,5,2,3,4,1,0,0,0,-2,0,-1,-1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,24,03VPfPs,02FUT,5,02DGEN,0.5,0,1,5,2,9,7,4,3,6,1,8,3,2,4,1,1,1,0,1,0,1,2,1,-1,0,2,1,-1,1,2,-1,0,1,1,1,1,0,1,-2,2,1,2,0,2,1,1,0,0,2,1,2,1,0,1,0,2,0,-1,1,1,1,3,0,2,-1,-1,1,1,1,0,-1,-1,1,0,0,2,2,0,1,-2,2,0,1,2,1,1,2,1,2,0,4,6,5,6,4,5,5,7,4,4,5,5 +R_7ePlnqRDs8i4Ecj,18 - 24,Canadian,Female,Strongly agree,Agree,Agree,Somewhat agree,Strongly agree,2,5,3,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Strongly agree,1,3,4,5,2,Somewhat Agree,Disagree,Strongly Agree,Agree,Strongly Agree,2,3,5,1,4,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,3,5,1,4,2,4,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,4,5,2,1,6,Neither Agree nor Disagree,Somewhat Disagree,Agree,Strongly agree,Strongly agree,5,4,2,3,1,5,Somewhat agree,Somewhat disagree,Strongly agree,Strongly agree,Agree,3,5,4,2,1,6,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,2,5,3,1,4,7,Agree,Somewhat Disagree,Somewhat Agree,Strongly agree,Strongly agree,2,3,5,4,1,6,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,5,3,4,2,1,4,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,3,2,1,5,4,5,Somewhat Disagree,Somewhat Disagree,Strongly agree,Somewhat Agree,Strongly agree,2,4,1,3,5,5,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,3,1,2,5,4,5,Somewhat agree,Neither agree nor disagree,Strongly agree,Disagree,Strongly agree,3,2,4,5,1,7,Disagree,Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,3,2,4,1,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,0,1,2,1,5 cents,5 minutes,47 days,Female,University - Undergraduate,22,01PfPsV,01PAST,10,01ITEM,0.125,1,0,6,7,5,9,8,2,4,1,3,4,3,2,1,3,2,2,1,3,1,1,1,2,3,1,-2,3,2,3,3,1,3,0,3,2,1,1,0,1,0,-1,2,3,3,1,-1,3,3,2,-1,3,1,3,0,2,-1,1,3,3,3,3,2,3,3,1,0,3,1,3,-1,-1,3,1,3,3,3,1,3,3,1,0,3,-2,3,-2,-2,3,0,3,4,6,5,6,7,6,4,5,5,5,7,7 +R_7Dp9alCiXsRbwsD,18 - 24,Canadian,Male,Somewhat agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,3,5,4,2,1,Somewhat disagree,Strongly disagree,Somewhat disagree,Somewhat disagree,Strongly agree,4,3,2,5,1,Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,2,3,4,5,1,Agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,4,2,5,1,3,5,Disagree,Disagree,Disagree,Somewhat agree,Agree,4,5,1,3,2,7,Somewhat Disagree,Disagree,Somewhat Agree,Somewhat Agree,Agree,2,1,5,3,4,6,Somewhat agree,Somewhat agree,Strongly agree,Agree,Somewhat disagree,3,1,2,5,4,9,Disagree,Disagree,Strongly disagree,Somewhat agree,Strongly agree,5,4,3,1,2,9,Agree,Disagree,Somewhat Disagree,Agree,Agree,1,3,5,4,2,9,Agree,Strongly agree,Somewhat agree,Agree,Agree,3,5,2,4,1,6,Somewhat disagree,Strongly disagree,Somewhat agree,Disagree,Strongly agree,5,2,4,3,1,6,Somewhat Disagree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,2,5,4,1,3,4,Agree,Strongly agree,Somewhat agree,Strongly agree,Agree,2,3,5,1,4,4,Neither agree nor disagree,Strongly disagree,Agree,Disagree,Strongly agree,5,4,1,3,2,6,Disagree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,3,4,5,2,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,1,2,2,2,10 cents,5 minutes,47 days,Male,Trade School (non-military),20,02PsVPf,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,8,2,7,6,3,9,4,1,5,3,2,4,1,1,3,1,1,2,-1,-3,-1,-1,3,-2,-3,3,-1,3,2,3,1,1,2,-2,-2,-2,1,2,-1,-2,1,1,2,1,1,3,2,-1,-2,-2,-3,1,3,2,-2,-1,2,2,2,3,1,2,2,-1,-3,1,-2,3,-1,-3,3,-2,3,2,3,1,3,2,0,-3,2,-2,3,-2,-3,3,-2,3,5,7,6,9,9,9,6,6,4,4,6,4 +R_1TUekaIMwJVZ7tG,18 - 24,American,Female,Strongly agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat agree,Strongly agree,2,3,1,4,5,Agree,Neither Agree nor Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,5,4,2,1,3,Strongly disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,2,5,1,3,4,10,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,4,5,1,2,3,3,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Agree,Agree,3,2,4,5,1,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,2,4,1,10,Strongly agree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,1,2,5,3,4,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,1,4,5,2,1,Strongly agree,Strongly agree,Disagree,Somewhat agree,Strongly agree,1,3,2,4,5,1,Somewhat disagree,Disagree,Strongly agree,Somewhat agree,Strongly agree,2,5,1,4,3,6,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,2,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,7,Strongly agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,5,4,3,1,2,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,2,5,4,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,-1,1,1,-2,1,-1,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),19,02PsVPf,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,8,7,3,6,2,4,9,1,5,4,3,2,1,3,3,-1,0,3,0,0,3,1,3,2,0,3,-1,3,-3,-3,3,-3,0,1,0,-1,1,-1,1,1,-1,2,2,0,0,0,0,0,3,3,-3,3,-3,0,0,0,0,0,3,3,-2,1,3,-1,-2,3,1,3,0,0,0,0,0,3,3,3,3,3,3,-3,3,3,3,3,3,3,3,3,10,3,4,10,9,1,1,6,1,7,4,4 +R_3Cdm5kuClIX2Osq,18 - 24,American,Male,Strongly agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,1,2,5,3,Somewhat disagree,Agree,Agree,Strongly agree,Somewhat agree,2,3,5,4,1,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,3,5,2,1,4,Somewhat agree,Agree,Agree,Strongly agree,Strongly agree,1,4,2,3,5,10,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly agree,Agree,4,1,3,2,5,10,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly agree,5,2,3,1,4,8,Strongly agree,Somewhat agree,Agree,Strongly agree,Somewhat agree,2,1,3,5,4,8,Somewhat agree,Agree,Strongly agree,Somewhat disagree,Strongly agree,3,5,4,1,2,9,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,Agree,Agree,3,5,1,2,4,8,Agree,Agree,Somewhat agree,Strongly agree,Somewhat agree,5,3,4,2,1,10,Somewhat agree,Agree,Strongly agree,Somewhat disagree,Strongly agree,1,4,5,2,3,10,Somewhat Agree,Strongly agree,Somewhat Agree,Agree,Somewhat Disagree,5,4,1,3,2,9,Somewhat agree,Agree,Strongly agree,Strongly agree,Somewhat agree,1,3,2,4,5,6,Agree,Agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,2,4,3,5,1,8,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,2,3,1,4,5,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,-1,-1,0,0,-2,0,10 cents,25 minutes,15 days,Male,High School (or equivalent),21,02PsVPf,02FUT,5,01ITEM,0.375,0,0.333333333,2,4,8,6,7,9,3,1,5,4,2,3,1,3,1,1,2,1,-1,2,2,3,1,1,3,3,1,2,1,2,2,3,3,-1,1,1,3,2,1,0,1,1,3,3,1,2,3,1,1,2,3,-1,3,1,3,0,2,2,2,2,1,3,1,1,2,3,-1,3,1,3,1,2,-1,1,2,3,3,1,2,2,-1,1,0,3,0,1,1,2,10,10,8,8,9,8,10,10,9,6,8,9 +R_1EE90vVU0660r2U,18 - 24,American,Male,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Agree,2,4,5,3,1,Somewhat agree,Agree,Agree,Somewhat agree,Neither agree nor disagree,5,1,4,3,2,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,2,5,3,1,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,Somewhat agree,1,2,5,3,4,5,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,4,3,1,5,2,5,Neither Agree nor Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,4,2,1,5,Somewhat agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,3,5,1,2,4,5,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,3,4,2,5,1,5,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,2,5,1,4,4,Agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,1,4,5,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,5,1,3,3,Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,3,1,4,5,3,Agree,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,2,1,3,4,5,4,Strongly agree,Neither agree nor disagree,Agree,Somewhat agree,Neither agree nor disagree,5,1,2,3,4,4,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,2,4,1,5,3,0,0,1,0,-1,0,-1,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),24,03VPfPs,01PAST,5,02DGEN,0.5,0,1,3,5,7,2,6,8,9,1,4,2,3,4,1,0,2,0,1,2,1,2,2,1,0,0,1,1,1,0,1,0,0,2,1,0,1,0,1,2,0,2,1,0,1,1,2,1,2,0,2,1,1,0,0,1,2,2,0,0,2,1,2,0,0,0,2,1,0,1,2,1,0,0,1,2,0,1,2,1,3,0,2,1,0,2,0,0,1,1,4,5,5,5,5,5,4,5,3,3,4,4 +R_5SBa48mHIRz5XN6,18 - 24,American,Female,Strongly agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,5,2,4,1,3,Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,2,4,1,5,Strongly agree,Somewhat agree,Neither agree nor disagree,Disagree,Somewhat disagree,2,3,5,4,1,10,Strongly disagree,Agree,Strongly disagree,Strongly agree,Disagree,4,3,5,1,2,10,Agree,Disagree,Somewhat Disagree,Neither Agree nor Disagree,Disagree,2,1,5,4,3,6,Strongly agree,Somewhat agree,Somewhat agree,Strongly disagree,Strongly disagree,2,5,4,1,3,5,Strongly disagree,Strongly agree,Strongly disagree,Agree,Strongly disagree,2,1,4,3,5,8,Agree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Somewhat Agree,4,1,3,2,5,8,Agree,Agree,Neither agree nor disagree,Agree,Agree,1,4,5,3,2,7,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,2,1,3,4,3,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Agree,Agree,1,4,5,3,2,4,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,3,4,5,2,1,5,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,4,1,5,6,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Agree,Agree,1,2,3,4,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,-1,0,1,1,10 cents,100 minutes,24 days,Female,University - Undergraduate,21,01PfPsV,02FUT,5,01ITEM,0.25,0,1,2,6,9,4,8,5,3,1,7,4,3,2,1,3,2,0,0,0,-1,1,0,2,1,2,-1,1,1,1,3,1,0,-2,-1,-3,2,-3,3,-2,2,-2,-1,0,-2,3,1,1,-3,-3,-3,3,-3,2,-3,2,-3,-3,-3,1,2,2,0,2,2,1,1,0,0,2,1,0,1,2,2,3,1,1,3,1,1,1,1,1,1,0,1,1,2,2,10,10,6,5,8,8,7,3,4,5,6,4 +R_1NyQvCitGYJPI6S,25 - 31,American,Male,Somewhat agree,Agree,Agree,Agree,Agree,3,1,4,2,5,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,3,2,1,5,4,Agree,Somewhat Agree,Agree,Agree,Agree,1,3,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,2,3,1,4,5,7,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,5,2,4,3,8,Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,5,2,4,3,1,7,Agree,Agree,Agree,Agree,Agree,4,5,2,3,1,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,2,5,4,1,3,6,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,4,3,5,1,2,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,4,5,2,1,3,7,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,5,2,4,7,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,1,4,3,7,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,3,2,4,1,5,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,1,2,4,7,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,4,1,2,3,5,1,1,1,-1,0,-1,-1,1,10 cents,100 minutes,24 days,Male,Professional Degree (ex. JD/MD),30,02PsVPf,01PAST,5,02DGEN,0.875,0,1,6,4,3,9,7,8,5,1,2,4,3,2,1,1,2,2,2,2,1,0,2,1,2,2,1,2,2,2,1,1,1,1,1,1,0,0,1,1,2,1,2,2,1,2,2,2,2,2,0,1,1,1,0,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,2,1,1,1,2,1,1,1,1,8,7,8,7,7,6,7,7,7,7,7,7 +R_3ZBIxk3ePWVcyCi,25 - 31,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Agree,2,5,4,3,1,Somewhat agree,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,5,4,3,2,1,Agree,Disagree,Strongly Agree,Strongly Agree,Agree,4,3,5,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly disagree,Strongly agree,4,2,5,3,1,5,Strongly agree,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,3,5,2,4,1,5,Agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,1,3,5,2,4,7,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Strongly disagree,Somewhat agree,4,2,3,1,5,10,Strongly agree,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,5,Somewhat Disagree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,3,2,5,1,4,0,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Strongly agree,3,2,1,4,5,2,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,4,3,2,1,5,2,Strongly agree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,1,4,2,3,5,0,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Strongly agree,4,1,5,2,3,7,Neither agree nor disagree,Agree,Strongly agree,Somewhat disagree,Agree,3,4,5,2,1,1,Strongly agree,Disagree,Strongly agree,Strongly agree,Strongly agree,3,4,2,1,5,0,1,1,1,-2,0,0,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),27,02PsVPf,02FUT,10,02DGEN,0.375,0,1,2,6,9,4,5,8,3,1,7,2,3,4,1,1,1,1,-2,2,1,3,3,0,2,2,-2,3,3,2,-1,1,1,-3,3,3,1,1,3,3,2,-2,3,1,3,0,1,-1,-3,1,3,-1,3,3,3,-1,-3,3,-2,3,0,1,2,1,3,2,3,3,0,3,3,-3,3,3,3,0,1,3,2,3,0,2,3,-1,2,3,-2,3,3,3,2,5,5,7,10,5,0,2,2,0,7,1 +R_6jZhZWuUygvzs2g,25 - 31,American,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,1,3,4,2,5,Agree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,2,1,5,4,3,Agree,Somewhat Agree,Strongly Agree,Strongly Agree,Agree,5,2,3,4,1,Somewhat disagree,Strongly agree,Strongly agree,Somewhat disagree,Agree,2,5,1,3,4,3,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,5,2,4,1,3,4,Neither Agree nor Disagree,Agree,Somewhat Agree,Agree,Somewhat Agree,4,3,5,2,1,4,Disagree,Strongly agree,Strongly agree,Disagree,Agree,5,2,1,4,3,7,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,Somewhat agree,1,4,5,2,3,7,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,Somewhat Agree,5,2,3,4,1,5,Agree,Strongly agree,Somewhat agree,Strongly agree,Agree,5,2,4,3,1,6,Agree,Somewhat disagree,Strongly agree,Somewhat disagree,Agree,5,4,1,2,3,7,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,3,5,2,1,4,8,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,3,5,2,1,4,Agree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Agree,1,5,3,2,4,5,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,2,1,4,5,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,0,0,-1,1,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,27,01PfPsV,02FUT,5,01ITEM,0.5,0,1,4,8,3,7,2,6,5,1,9,3,2,4,1,2,3,3,1,2,2,1,3,1,3,2,1,3,3,2,-1,3,3,-1,2,0,-1,1,-1,1,0,2,1,2,1,-2,3,3,-2,2,-1,-1,-2,1,1,1,0,2,1,1,2,3,1,3,2,2,-1,3,-1,2,2,2,2,1,1,3,3,2,1,3,2,0,1,-1,2,2,1,1,2,2,3,4,4,7,7,5,6,7,8,4,5,5 +R_3MLL21zMaguXu2a,25 - 31,American,Male,Agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,4,1,5,2,3,Neither agree nor disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,1,5,2,3,4,Agree,Somewhat Agree,Strongly Agree,Agree,Strongly Agree,2,5,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Disagree,Strongly agree,Strongly agree,Agree,Agree,3,4,5,1,2,5,Somewhat agree,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,2,3,5,4,5,Strongly agree,Somewhat Agree,Agree,Agree,Somewhat Agree,1,2,5,4,3,4,Somewhat disagree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,3,1,4,2,5,Strongly agree,Disagree,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,1,2,5,3,4,7,Strongly Disagree,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Neither Agree nor Disagree,4,3,1,2,5,2,Agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,3,5,2,4,2,Neither agree nor disagree,Strongly disagree,Agree,Strongly disagree,Agree,1,4,3,5,2,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,2,Strongly agree,Strongly agree,Strongly agree,Disagree,Strongly agree,2,3,4,5,1,2,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,5,4,3,1,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,4,5,1,2,1,2,2,0,0,2,0,5 cents,100 minutes,24 days,Male,University - Undergraduate,29,03VPfPs,01PAST,10,02DGEN,0.125,0.333333333,0.666666667,3,4,6,7,9,8,2,1,5,3,2,4,1,2,3,3,-1,3,0,-3,1,0,3,2,1,3,2,3,-2,3,3,2,2,1,-2,0,-1,1,3,1,2,2,1,-1,3,3,1,2,3,-2,0,-3,0,-3,0,1,3,0,2,3,3,-2,3,0,-3,2,-3,2,3,3,3,3,3,3,3,3,-2,3,1,-3,3,-3,2,3,3,3,3,3,5,5,5,4,5,7,2,2,2,2,2,3 +R_7uoGPbNGhNG6Ce5,18 - 24,American,Male,Disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Disagree,4,5,2,1,3,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,5,1,3,2,4,Somewhat Disagree,Strongly Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,4,1,2,5,3,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,5,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,2,3,5,5,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,4,2,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,4,1,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,3,4,1,5,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,3,2,5,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,2,4,1,3,5,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,3,4,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,2,3,5,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,5,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,0,0,2,-1,0,1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,20,02PsVPf,01PAST,5,01ITEM,0,0,1,3,2,8,9,5,4,7,1,6,3,2,4,1,-2,3,-1,0,-2,-3,1,1,1,-2,-1,-3,3,-3,3,0,3,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5 +R_1DJaqmosXBlRNrd,25 - 31,American,Female,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,Strongly agree,4,2,3,1,5,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,4,5,1,2,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,2,1,5,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Strongly agree,5,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,3,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,4,5,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,3,4,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,4,5,3,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,4,5,2,3,5,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,4,1,3,2,5,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,1,5,4,3,5,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,1,5,3,2,4,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Agree,5,3,2,1,4,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,3,5,1,4,2,5,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,1,2,5,0,1,0,1,-2,0,0,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,30,02PsVPf,02FUT,5,02DGEN,0.25,0,1,9,8,2,7,5,4,3,1,6,2,4,3,1,1,1,1,-1,3,-1,0,1,0,1,0,1,0,1,0,0,0,0,-1,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,3,0,0,0,0,1,0,1,0,0,1,2,1,0,0,2,0,0,1,0,1,0,1,1,0,0,4,5,5,5,5,4,5,6,5,4,5,5 +R_1DNW39lgIxT0Ku8,18 - 24,American,Female,Somewhat agree,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,2,4,3,5,1,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Strongly agree,2,5,4,3,1,Somewhat Agree,Agree,Strongly Agree,Agree,Strongly Agree,5,4,1,3,2,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,5,1,2,4,3,10,Strongly agree,Strongly agree,Agree,Somewhat agree,Agree,2,1,4,5,3,7,Somewhat Agree,Agree,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,1,2,3,5,4,6,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Somewhat agree,4,2,3,1,5,8,Neither agree nor disagree,Agree,Somewhat agree,Strongly agree,Agree,1,5,2,4,3,8,Somewhat Agree,Strongly agree,Somewhat Agree,Agree,Neither Agree nor Disagree,2,5,3,4,1,9,Somewhat agree,Neither agree nor disagree,Agree,Strongly agree,Neither agree nor disagree,3,1,4,5,2,10,Agree,Strongly agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,5,2,3,1,8,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Strongly agree,3,5,2,4,1,9,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,Agree,5,3,4,1,2,9,Somewhat agree,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,1,5,3,4,2,10,Strongly agree,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,4,3,2,1,5,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,-2,0,-1,-1,1,1,0,10 cents,5 minutes,47 days,Female,University - PhD,24,03VPfPs,01PAST,5,01ITEM,0,0.666666667,0.333333333,5,8,3,6,4,9,2,1,7,2,4,3,1,1,3,2,3,0,2,1,0,1,3,1,2,3,2,3,2,0,0,1,1,3,3,2,1,2,1,2,3,0,1,0,2,3,1,1,0,2,1,3,2,1,3,1,2,0,1,0,2,3,0,2,3,0,1,0,1,1,2,0,3,1,1,0,3,2,1,3,1,2,0,3,2,1,2,0,10,7,6,8,8,9,10,8,9,9,10,9 +R_5tuUhPynQWwFDZT,18 - 24,American,Female,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,2,5,1,4,3,Somewhat agree,Disagree,Somewhat agree,Strongly agree,Agree,3,2,1,5,4,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Strongly Agree,2,3,5,4,1,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,2,5,3,4,5,Agree,Neither agree nor disagree,Strongly agree,Strongly agree,Neither agree nor disagree,4,3,1,5,2,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,1,3,5,6,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,3,4,3,Somewhat agree,Somewhat disagree,Agree,Strongly agree,Somewhat agree,5,1,4,3,2,6,Strongly agree,Disagree,Strongly agree,Somewhat Agree,Strongly agree,5,1,2,3,4,2,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,1,5,4,2,3,7,Somewhat agree,Somewhat disagree,Somewhat agree,Strongly agree,Agree,2,4,1,5,3,4,Somewhat Agree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,4,1,6,Somewhat disagree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,3,5,2,4,1,5,Somewhat agree,Somewhat disagree,Agree,Somewhat agree,Agree,1,4,3,5,2,9,Somewhat Agree,Agree,Strongly agree,Somewhat Agree,Agree,4,3,1,2,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,-2,0,0,0,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,02PsVPf,02FUT,10,01ITEM,0.5,0,1,2,8,7,5,4,3,9,1,6,3,2,4,1,-1,3,1,3,3,1,-2,1,3,2,1,3,3,1,3,2,2,3,3,3,2,0,3,3,0,0,0,0,0,0,3,3,3,3,3,1,-1,2,3,1,3,-2,3,1,3,-1,3,1,3,3,1,-1,1,3,2,1,3,3,1,3,-1,3,1,3,3,1,-1,2,1,2,1,2,3,1,2,5,4,6,3,6,2,7,4,6,5,9,2 +R_5oKFZs5C9UhTZjC,25 - 31,American,Female,Somewhat agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,4,5,1,Strongly disagree,Somewhat disagree,Somewhat disagree,Agree,Somewhat disagree,4,5,2,1,3,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,3,1,5,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,4,1,3,2,5,1,Strongly disagree,Disagree,Strongly agree,Agree,Somewhat agree,5,4,2,3,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,4,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Disagree,1,3,5,2,4,1,Strongly disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,4,3,5,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,5,2,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,1,3,2,5,4,1,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,3,1,4,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,3,4,1,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,2,5,1,4,3,10,Agree,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,1,4,5,2,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,4,1,3,5,-2,-2,-2,2,-2,2,2,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,31,01PfPsV,01PAST,5,02DGEN,-1.5,0,1,8,4,6,9,5,3,2,1,7,3,2,4,1,1,3,3,2,3,-3,-1,-1,2,-1,3,3,3,3,3,1,3,3,3,-3,-3,-2,3,2,1,3,3,3,3,3,3,3,3,3,-2,-3,-1,-1,1,-1,3,3,3,3,3,3,3,3,3,-1,0,-3,3,-3,3,3,3,3,3,3,3,2,3,2,3,2,-3,3,3,3,3,3,3,3,2,10,1,1,1,1,1,1,1,10,1,10,1 +R_36a9bhPXzT1Nr9f,18 - 24,American,Male,Somewhat agree,Strongly agree,Agree,Disagree,Somewhat agree,2,4,3,1,5,Somewhat disagree,Strongly disagree,Somewhat agree,Somewhat agree,Somewhat agree,4,1,2,3,5,Neither Agree nor Disagree,Somewhat Disagree,Agree,Disagree,Strongly Agree,2,3,5,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Neither agree nor disagree,Strongly agree,Agree,Disagree,Somewhat agree,3,2,4,5,1,6,Disagree,Disagree,Somewhat agree,Agree,Somewhat disagree,1,2,3,4,5,1,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Strongly agree,5,1,4,3,2,2,Disagree,Strongly agree,Somewhat agree,Strongly disagree,Agree,4,2,5,3,1,7,Strongly disagree,Somewhat disagree,Somewhat agree,Strongly agree,Strongly disagree,5,3,2,1,4,6,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,3,1,4,5,2,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,3,5,1,4,2,5,Agree,Strongly disagree,Agree,Somewhat disagree,Strongly agree,3,2,5,4,1,0,Neither Agree nor Disagree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,5,1,3,2,0,Somewhat agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,3,1,4,2,5,7,Strongly agree,Strongly disagree,Somewhat agree,Somewhat disagree,Agree,3,1,2,4,5,4,Somewhat Disagree,Somewhat Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,3,5,4,2,0,1,2,2,1,0,2,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),21,03VPfPs,01PAST,10,02DGEN,-0.125,0,1,7,4,5,8,6,3,9,1,2,2,4,3,1,1,3,2,-2,1,-1,-3,1,1,1,0,-1,2,-2,3,0,3,2,-2,1,-2,-2,1,2,-1,1,-1,2,-1,3,-2,3,1,-3,2,-3,-1,1,3,-3,1,-1,0,0,2,1,3,3,-3,1,2,-3,2,-1,3,0,-1,3,-3,3,1,3,3,-3,1,3,-3,1,-1,2,-1,-1,3,-3,3,1,6,1,2,7,6,2,5,0,0,7,4 +R_1diDaGJkKUxlKT8,18 - 24,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Somewhat agree,1,2,4,5,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,2,5,4,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Strongly agree,Strongly agree,Disagree,Agree,2,1,4,5,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,3,2,4,5,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,4,5,2,3,1,1,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,5,3,4,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,2,4,3,5,1,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,1,3,2,4,5,2,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,2,3,1,4,5,1,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,5,3,4,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,5,2,4,3,2,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,2,4,3,1,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,5,1,4,2,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,3,4,1,5,2,1,1,-1,0,2,-2,1,-2,10 cents,25 minutes,24 days,Female,High School (or equivalent),20,01PfPsV,02FUT,10,02DGEN,-0.25,0,0.666666667,9,5,3,6,4,2,8,1,7,3,2,4,1,3,3,3,-3,1,0,0,0,0,0,0,0,0,0,3,3,3,3,-2,2,0,0,0,2,0,0,0,0,0,3,3,3,3,1,-1,0,0,0,3,0,0,0,0,0,3,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,5,5,5,1,5,5,2,1,1,2,2,2 +R_6BCrzfueF6asaWt,18 - 24,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,4,1,2,5,Strongly disagree,Agree,Somewhat agree,Strongly agree,Strongly agree,5,4,3,2,1,Strongly Disagree,Strongly Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,1,2,4,3,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,3,4,2,1,3,Disagree,Strongly agree,Agree,Agree,Strongly agree,3,2,1,4,5,2,Strongly Disagree,Strongly Disagree,Strongly agree,Somewhat Agree,Strongly agree,3,5,2,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly disagree,Agree,4,3,5,1,2,4,Neither agree nor disagree,Strongly agree,Strongly disagree,Somewhat agree,Agree,5,3,2,1,4,5,Somewhat Disagree,Strongly Disagree,Strongly agree,Agree,Strongly agree,3,4,5,2,1,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,3,4,1,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,Strongly agree,5,4,2,3,1,3,Strongly Disagree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,5,3,1,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,5,4,0,Disagree,Strongly agree,Agree,Strongly agree,Strongly agree,1,2,3,5,4,1,Strongly Disagree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,4,1,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,2,2,2,0,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,20,03VPfPs,01PAST,5,01ITEM,-0.375,0,1,4,9,6,7,5,2,8,1,3,3,4,2,1,3,3,3,3,2,-3,2,1,3,3,-3,-3,3,0,3,3,3,3,1,2,-2,3,2,2,3,-3,-3,3,1,3,3,3,3,-3,2,0,3,-3,1,2,-1,-3,3,2,3,3,3,3,3,3,0,3,2,1,3,-3,-3,3,0,3,3,3,3,3,3,-2,3,2,3,3,-3,-3,3,0,3,3,2,1,4,5,4,1,3,0,0,1,0 +R_6AnjfeWnRFdPK49,18 - 24,American,Male,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,2,3,5,1,Somewhat disagree,Neither agree nor disagree,Agree,Disagree,Strongly agree,5,3,2,1,4,Neither Agree nor Disagree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,1,5,2,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,1,2,5,3,1,Somewhat disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Agree,1,3,4,2,5,4,Somewhat Disagree,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,3,2,1,4,5,1,Disagree,Agree,Strongly agree,Disagree,Neither agree nor disagree,4,2,3,5,1,6,Strongly agree,Neither agree nor disagree,Disagree,Disagree,Neither agree nor disagree,5,2,1,4,3,8,Strongly Disagree,Disagree,Disagree,Strongly Disagree,Somewhat Agree,3,1,2,5,4,10,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,5,3,4,1,1,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,2,3,4,5,1,2,Neither Agree nor Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,5,2,3,4,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,4,2,1,2,Somewhat agree,Neither agree nor disagree,Strongly agree,Strongly disagree,Strongly agree,5,2,4,3,1,4,Neither Agree nor Disagree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,4,3,1,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,1,0,2,1,10 cents,100 minutes,24 days,Male,University - Undergraduate,19,02PsVPf,01PAST,5,01ITEM,0,0,1,5,4,2,9,7,3,8,1,6,4,2,3,1,2,3,3,2,3,-1,0,2,-2,3,0,3,3,-2,3,3,3,3,3,3,-1,0,3,-3,2,-1,3,3,1,3,-2,2,3,-2,0,3,0,-2,-2,0,-3,-2,-2,-3,1,3,3,2,3,3,0,0,3,-3,3,0,3,3,-3,3,3,3,3,3,3,1,0,3,-3,3,0,3,3,-3,3,1,4,1,6,8,10,1,2,1,2,4,3 +R_7H7PX3Cx5sdW7Q6,25 - 31,American,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,Strongly agree,Agree,Agree,Disagree,Strongly agree,3,1,2,4,5,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,4,5,1,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,5,4,2,1,3,10,Disagree,Neither agree nor disagree,Disagree,Agree,Disagree,4,1,3,2,5,8,Disagree,Somewhat Disagree,Disagree,Agree,Neither Agree nor Disagree,3,1,5,4,2,9,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,2,4,7,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,Disagree,2,4,3,1,5,10,Disagree,Strongly Disagree,Disagree,Agree,Disagree,5,4,1,3,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,5,4,10,Strongly agree,Agree,Strongly agree,Strongly disagree,Agree,3,1,2,4,5,8,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,3,2,10,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,2,4,0,Strongly agree,Somewhat agree,Strongly agree,Strongly disagree,Agree,4,3,5,1,2,9,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,4,3,2,2,2,2,-2,2,0,2,10 cents,100 minutes,36 days,Female,High School (or equivalent),30,03VPfPs,01PAST,5,02DGEN,0.75,0,0.666666667,9,8,6,7,3,4,2,1,5,3,2,4,1,3,3,3,3,3,3,2,2,-2,3,3,3,3,2,3,-3,-3,3,3,-3,-2,0,-2,2,-2,-2,-1,-2,2,0,-2,3,3,3,3,1,-1,-1,-2,-2,-2,-3,-2,2,-2,3,3,3,3,3,3,2,3,-3,2,3,2,3,3,3,3,3,3,3,3,3,1,3,-3,2,3,3,3,3,3,10,10,8,9,7,10,10,10,8,10,0,9 +R_70wTqF36yBKH2DV,25 - 31,American,Male,Agree,Agree,Somewhat agree,Agree,Agree,5,2,1,4,3,Agree,Agree,Agree,Agree,Somewhat agree,5,4,1,2,3,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,5,4,2,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Strongly agree,Agree,Agree,Agree,Agree,5,2,1,3,4,7,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Agree,3,4,5,1,2,8,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,3,1,2,5,4,10,Agree,Agree,Agree,Somewhat agree,Agree,3,5,2,4,1,9,Somewhat agree,Agree,Agree,Somewhat agree,Agree,1,4,2,5,3,9,Somewhat Disagree,Agree,Agree,Agree,Agree,1,5,2,4,3,10,Somewhat agree,Agree,Somewhat agree,Disagree,Somewhat agree,3,4,5,1,2,10,Agree,Agree,Agree,Somewhat agree,Somewhat agree,5,4,1,3,2,10,Agree,Agree,Somewhat Agree,Agree,Agree,4,5,1,3,2,10,Agree,Agree,Neither agree nor disagree,Agree,Agree,2,3,1,4,5,8,Somewhat agree,Agree,Agree,Somewhat agree,Agree,1,3,2,5,4,9,Agree,Strongly agree,Agree,Agree,Somewhat Agree,5,2,3,4,1,1,0,0,-1,-1,-1,0,0,10 cents,100 minutes,24 days,Male,University - Undergraduate,25,03VPfPs,02FUT,5,02DGEN,0.5,0,1,8,3,4,6,9,5,2,1,7,4,3,2,1,2,2,1,2,2,2,2,2,2,1,2,2,0,0,2,3,2,2,2,2,1,2,1,1,2,2,1,2,1,2,2,2,2,1,2,1,2,2,1,2,-1,2,2,2,2,1,2,1,-2,1,2,2,2,1,1,2,2,1,2,2,2,2,0,2,2,1,2,2,1,2,2,3,2,2,1,7,7,8,10,9,9,10,10,10,10,8,9 +R_6WOPvyZulqJtokI,25 - 31,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,1,2,Neither agree nor disagree,Disagree,Strongly agree,Strongly disagree,Strongly agree,5,4,1,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,3,2,4,1,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,2,4,1,5,0,Strongly agree,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,4,5,2,1,3,0,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,2,1,5,3,4,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,4,3,5,2,1,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,2,5,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,3,4,5,2,1,0,Strongly agree,Strongly disagree,Strongly disagree,Strongly disagree,Strongly agree,2,4,1,5,3,0,Strongly agree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,1,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,5,1,3,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,2,1,5,0,Strongly agree,Strongly agree,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,4,1,3,5,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,2,2,0,2,-2,10 cents,100 minutes,47 days,Male,High School (or equivalent),31,02PsVPf,01PAST,10,01ITEM,-0.5,0.333333333,0.666666667,4,5,3,7,9,2,8,1,6,4,3,2,1,3,3,3,3,3,0,-2,3,-3,3,0,0,0,0,0,3,3,3,3,0,0,-3,3,-3,3,3,3,-1,0,-1,3,3,0,3,0,0,-3,3,-3,0,3,3,3,0,0,3,3,3,3,0,3,-3,-3,-3,3,3,3,0,0,0,3,3,3,3,0,3,-3,3,-3,3,3,3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R_7QnDfcY78mwDRhJ,18 - 24,Canadian,Male,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,3,2,5,4,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,3,4,1,5,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Disagree,5,1,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Agree,Neither agree nor disagree,Disagree,Somewhat disagree,2,1,5,4,3,6,Disagree,Somewhat agree,Disagree,Agree,Somewhat disagree,3,2,5,4,1,6,Somewhat Agree,Somewhat Agree,Disagree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,4,1,6,Strongly agree,Disagree,Somewhat agree,Agree,Somewhat agree,4,2,3,1,5,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Agree,Neither agree nor disagree,3,2,1,5,4,8,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,2,5,4,3,2,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Somewhat agree,4,3,1,2,5,5,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,4,2,1,3,6,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Disagree,3,4,5,2,1,2,Somewhat agree,Agree,Agree,Neither agree nor disagree,Agree,5,2,3,4,1,5,Somewhat agree,Disagree,Strongly agree,Disagree,Somewhat agree,1,5,3,4,2,5,Neither Agree nor Disagree,Somewhat Disagree,Agree,Strongly agree,Somewhat Disagree,5,4,3,2,1,1,1,1,2,1,1,1,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,24,02PsVPf,02FUT,5,02DGEN,-0.125,0,1,6,2,9,5,7,8,4,1,3,4,2,3,1,0,1,1,-1,1,-1,0,0,1,1,-1,-1,2,1,-1,0,2,0,-2,-1,-2,1,-2,2,-1,1,1,-2,0,1,3,-2,1,2,1,-1,1,-1,2,0,2,0,1,1,1,0,2,1,-2,1,0,-2,2,-1,1,-1,-1,1,2,-1,1,2,2,0,2,1,-2,3,-2,1,0,-1,2,3,-1,5,6,6,6,6,8,2,5,6,2,5,5 +R_7P6VjQVxwsDLEuS,18 - 24,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,4,2,1,5,3,Somewhat agree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,1,3,4,5,2,Disagree,Strongly Disagree,Strongly Agree,Somewhat Disagree,Strongly Agree,1,2,4,5,3,Somewhat disagree,Somewhat agree,Strongly agree,Disagree,Strongly disagree,3,2,1,5,4,5,Somewhat disagree,Agree,Disagree,Strongly agree,Disagree,5,3,4,2,1,6,Agree,Disagree,Disagree,Disagree,Somewhat Agree,1,2,3,5,4,6,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,5,1,3,5,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,1,5,2,3,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,5,4,2,5,Agree,Strongly agree,Strongly agree,Agree,Somewhat agree,1,3,5,4,2,1,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,2,4,5,1,3,4,Disagree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,3,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,5,1,3,2,4,2,Agree,Disagree,Strongly agree,Disagree,Somewhat agree,4,5,3,2,1,5,Disagree,Strongly Disagree,Strongly agree,Strongly agree,Strongly agree,2,3,5,4,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-1,1,2,1,5 cents,5 minutes,47 days,Male,High School (or equivalent),20,03VPfPs,02FUT,5,01ITEM,0.375,1,0,8,7,4,6,2,5,9,1,3,3,2,4,1,1,3,3,2,2,1,1,-1,1,-1,-2,-3,3,-1,3,-1,1,3,-2,-3,-1,2,-2,3,-2,2,-2,-2,-2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,2,1,2,-1,2,-1,2,-2,-3,3,3,3,2,3,3,1,2,2,-2,3,-2,1,-2,-3,3,3,3,5,6,6,5,5,5,1,4,3,2,5,3 +R_3ADeuracdnFjlol,39 - 45,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,1,2,5,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,2,3,1,4,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,2,5,1,3,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,2,1,4,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Disagree,Strongly agree,4,5,1,3,2,2,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,2,4,3,5,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,5,4,2,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Strongly disagree,Neither agree nor disagree,5,1,4,3,2,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,5,1,3,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,1,2,3,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,5,4,2,1,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,5,2,4,3,1,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,5,2,4,3,0,Neither agree nor disagree,Strongly disagree,Strongly agree,Somewhat disagree,Neither agree nor disagree,1,4,2,3,5,1,Strongly agree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,4,1,3,2,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,2,-1,0,1,-1,5 cents,100 minutes,24 days,Female,High School (or equivalent),40,03VPfPs,02FUT,5,01ITEM,0.25,0.333333333,0.666666667,5,9,7,4,3,8,6,1,2,3,4,2,1,3,3,3,3,3,0,-3,3,-1,0,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-2,3,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-3,0,3,0,3,-3,3,3,3,3,3,3,0,-3,3,-1,0,3,3,3,-3,3,3,3,3,3,3,0,-3,3,-1,0,3,0,3,-3,3,0,2,0,0,1,1,0,0,1,0,1,1 +R_5QR1WLqqjfnTfrf,25 - 31,Canadian,Female,Agree,Agree,Somewhat agree,Strongly agree,Agree,5,4,1,3,2,Somewhat agree,Agree,Agree,Strongly agree,Agree,3,5,4,2,1,Strongly Agree,Somewhat Agree,Agree,Strongly Agree,Agree,5,3,4,2,1,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,4,5,2,3,1,1,Somewhat agree,Agree,Somewhat agree,Agree,Agree,4,5,1,3,2,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,5,4,1,2,3,3,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,2,4,1,3,Somewhat agree,Strongly agree,Neither agree nor disagree,Agree,Agree,3,4,1,5,2,1,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,2,1,3,2,Agree,Agree,Somewhat agree,Agree,Strongly agree,5,3,2,1,4,3,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,5,2,3,1,4,7,Agree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,1,3,4,5,2,3,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,2,3,1,5,4,4,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,Agree,4,1,3,2,5,1,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,Somewhat Agree,5,1,3,4,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-1,2,2,2,10 cents,5 minutes,24 days,Female,University - Undergraduate,25,01PfPsV,02FUT,5,01ITEM,0.375,0.333333333,0.666666667,7,9,5,3,4,6,2,1,8,4,2,3,1,2,2,1,3,2,1,2,2,3,2,3,1,2,3,2,0,3,0,-1,1,1,2,1,2,2,1,1,1,2,0,2,1,1,1,0,1,3,0,2,2,2,2,2,1,1,2,2,1,2,3,1,0,0,1,-1,2,1,2,1,1,1,2,0,0,1,1,1,0,2,2,1,0,2,2,1,1,2,3,3,1,2,3,7,3,4,1,3 +R_6nNFF5o8UlRttgM,67 - 73,American,Male,Disagree,Strongly agree,Agree,Agree,Agree,5,4,2,3,1,Neither agree nor disagree,Disagree,Agree,Disagree,Disagree,3,2,1,5,4,Strongly Agree,Strongly Agree,Agree,Disagree,Agree,5,3,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Disagree,Agree,Agree,Agree,Agree,2,1,3,4,5,0,Somewhat agree,Disagree,Somewhat agree,Disagree,Disagree,1,5,2,3,4,0,Strongly agree,Strongly agree,Agree,Disagree,Agree,2,1,5,3,4,0,Disagree,Strongly agree,Agree,Agree,Agree,1,3,2,4,5,0,Disagree,Disagree,Agree,Disagree,Disagree,5,2,4,1,3,0,Strongly agree,Strongly agree,Agree,Disagree,Agree,2,5,3,1,4,1,Disagree,Strongly agree,Agree,Agree,Agree,2,1,4,5,3,1,Disagree,Disagree,Agree,Disagree,Disagree,4,2,1,5,3,1,Strongly agree,Strongly agree,Agree,Disagree,Agree,4,5,3,2,1,1,Disagree,Strongly agree,Agree,Agree,Agree,1,5,4,3,2,2,Disagree,Disagree,Agree,Disagree,Disagree,4,2,5,1,3,2,Strongly agree,Strongly agree,Agree,Disagree,Agree,4,5,3,2,1,0,2,2,1,0,1,-1,1,10 cents,100 minutes,24 days,Male,Trade School (non-military),71,02PsVPf,02FUT,10,02DGEN,0.5,0,1,6,2,8,7,5,3,4,1,9,3,2,4,1,-2,3,2,2,2,0,-2,2,-2,-2,3,3,2,-2,2,-2,2,2,2,2,1,-2,1,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,-2,3,2,2,2,-2,-2,2,-2,-2,3,3,2,-2,2,0,0,0,0,0,0,1,1,1,1,2,2 +R_15UDzM7aUkST0Xv,60 - 66,Canadian,Male,Agree,Agree,Strongly agree,Disagree,Strongly agree,3,1,5,4,2,Somewhat agree,Somewhat disagree,Agree,Disagree,Somewhat agree,1,5,2,4,3,Somewhat Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Strongly agree,Strongly disagree,Strongly agree,3,4,5,1,2,1,Neither agree nor disagree,Disagree,Agree,Disagree,Neither agree nor disagree,4,5,3,1,2,1,Somewhat Agree,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,2,1,3,4,5,2,Agree,Agree,Strongly agree,Strongly disagree,Strongly agree,5,3,1,2,4,2,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Somewhat agree,4,3,2,5,1,1,Neither Agree nor Disagree,Agree,Strongly agree,Somewhat Agree,Somewhat Agree,3,1,4,2,5,1,Agree,Agree,Strongly agree,Disagree,Strongly agree,3,5,1,4,2,1,Somewhat agree,Disagree,Agree,Disagree,Somewhat agree,2,3,4,5,1,1,Somewhat Agree,Agree,Strongly agree,Neither Agree nor Disagree,Somewhat Agree,5,3,1,2,4,1,Agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,2,1,4,3,1,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Neither agree nor disagree,1,3,5,4,2,1,Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,5,2,4,3,0,2,2,1,-1,0,1,0,5 cents,5 minutes,47 days,Male,High School (or equivalent),63,01PfPsV,01PAST,10,02DGEN,0.375,1,0,6,5,4,2,9,8,7,1,3,4,3,2,1,2,2,3,-2,3,1,-1,2,-2,1,1,1,3,0,1,2,2,3,-3,3,0,-2,2,-2,0,1,2,3,1,1,2,2,3,-3,3,2,0,3,-1,1,0,2,3,1,1,2,2,3,-2,3,1,-2,2,-2,1,1,2,3,0,1,2,3,3,0,3,0,-2,1,-2,0,2,2,2,0,1,2,1,1,2,2,1,1,1,1,1,1,1 +R_1Maa3MBUCWZQHLj,46 - 52,Canadian,Male,Somewhat agree,Agree,Strongly agree,Agree,Disagree,1,4,3,5,2,Agree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,3,4,2,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Agree,3,5,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,5,3,4,2,7,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,1,5,3,2,4,7,Somewhat Agree,Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,5,3,2,1,4,7,Disagree,Strongly agree,Somewhat disagree,Strongly disagree,Somewhat agree,4,1,5,3,2,7,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat disagree,5,2,1,4,3,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,5,1,2,4,3,7,Neither agree nor disagree,Agree,Somewhat agree,Agree,Somewhat disagree,3,4,1,5,2,7,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,4,3,2,5,5,Strongly agree,Agree,Strongly agree,Somewhat Disagree,Somewhat Agree,1,5,4,2,3,7,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,5,2,1,4,3,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,4,1,2,7,Agree,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Agree,5,2,4,1,3,0,0,0,0,-1,0,1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),52,03VPfPs,01PAST,5,02DGEN,0,0,1,4,2,3,9,5,6,8,1,7,4,2,3,1,1,2,3,2,-2,2,-2,2,-1,0,3,3,3,0,2,0,2,0,-1,0,2,1,1,1,2,1,2,2,0,1,-2,3,-1,-3,1,2,1,1,1,-1,0,0,1,1,0,0,2,1,2,-1,0,-2,1,-1,1,3,2,3,-1,1,0,0,0,1,0,1,-1,1,-1,1,2,1,2,-1,1,7,7,7,7,7,9,7,7,5,7,7,7 +R_3Fx3y1AcHczW3R4,39 - 45,Canadian,Male,Neither agree nor disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,1,5,4,3,2,Strongly disagree,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,4,5,3,2,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,4,3,2,5,1,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,3,2,4,5,1,1,Strongly disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,3,5,2,4,1,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,1,5,3,2,4,1,Somewhat agree,Agree,Agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,2,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,3,2,1,4,5,2,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,1,3,5,4,2,2,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,5,1,4,2,3,1,Strongly disagree,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,2,1,3,4,5,1,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,5,2,1,3,4,1,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat disagree,3,4,1,2,5,8,Strongly disagree,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,2,1,3,5,4,8,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,Agree,2,4,5,1,3,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,1,1,0,2,0,5 cents,5 minutes,47 days,Male,University - Undergraduate,45,02PsVPf,02FUT,10,01ITEM,0.25,1,0,5,3,6,4,8,2,7,1,9,3,4,2,1,0,1,2,-1,-1,-3,-1,1,3,1,2,1,2,0,2,0,1,2,1,-1,-3,-1,1,2,-1,2,1,2,0,2,1,2,2,0,1,-3,-1,2,-1,1,2,1,2,1,2,0,1,2,0,-1,-3,-1,1,3,1,2,1,2,0,2,0,1,2,0,-1,-3,-1,1,2,1,2,1,2,0,2,1,1,1,2,2,2,1,1,1,8,8,9 +R_5hMey31i8f8F2kZ,53 - 59,Canadian,Female,Agree,Strongly agree,Agree,Agree,Agree,2,5,4,1,3,Somewhat disagree,Agree,Agree,Agree,Somewhat agree,5,2,3,4,1,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,1,5,2,3,4,Agree,Strongly agree,Agree,Agree,Strongly agree,2,5,1,4,3,6,Disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,5,4,2,1,3,6,Agree,Somewhat Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,3,1,2,5,4,5,Strongly agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,1,5,3,2,8,Strongly disagree,Strongly agree,Agree,Strongly agree,Agree,4,3,2,5,1,5,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Agree,Somewhat Disagree,3,1,5,4,2,6,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,3,2,5,1,4,4,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,4,3,5,2,4,Neither Agree nor Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,3,2,1,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,4,3,2,1,5,7,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,5,3,5,Agree,Somewhat Disagree,Strongly agree,Strongly Disagree,Agree,4,1,2,3,5,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-1,1,2,2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,58,03VPfPs,01PAST,10,01ITEM,0.5,0,1,2,5,4,6,7,9,8,1,3,2,4,3,1,2,3,2,2,2,-1,2,2,2,1,1,-1,2,1,0,2,3,2,2,3,-2,1,2,1,1,2,-1,2,1,0,3,3,2,1,3,-3,3,2,3,2,0,1,3,2,-1,3,3,2,3,2,-2,0,1,1,1,0,-1,2,0,2,3,3,3,3,0,-1,0,0,0,0,2,-1,3,-3,2,6,6,5,8,5,6,4,4,4,7,5,7 +R_3ZaGNr7sQUxBidX,25 - 31,American,Female,Strongly agree,Somewhat agree,Agree,Agree,Strongly agree,5,3,2,4,1,Agree,Strongly agree,Somewhat agree,Somewhat agree,Agree,4,3,5,2,1,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,4,1,3,2,5,Strongly agree,Somewhat agree,Agree,Strongly agree,Somewhat agree,2,4,5,3,1,8,Strongly agree,Agree,Strongly agree,Agree,Somewhat agree,1,5,4,3,2,8,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,3,2,5,1,4,7,Agree,Somewhat agree,Strongly agree,Strongly agree,Agree,5,2,4,3,1,6,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,3,5,4,2,1,6,Agree,Agree,Agree,Strongly agree,Somewhat Agree,3,2,1,4,5,6,Strongly agree,Somewhat agree,Agree,Strongly agree,Agree,5,3,2,1,4,9,Strongly agree,Agree,Somewhat agree,Strongly agree,Agree,1,2,3,5,4,8,Strongly agree,Agree,Strongly agree,Agree,Somewhat Agree,5,1,2,4,3,5,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,Somewhat agree,4,3,2,5,1,9,Neither agree nor disagree,Somewhat agree,Agree,Agree,Strongly agree,3,4,5,2,1,8,Agree,Strongly agree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,1,3,2,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,0,-2,-1,-1,-2,1,10 cents,100 minutes,36 days,Female,College Diploma/Certificate,25,01PfPsV,02FUT,10,01ITEM,1.375,0,0.666666667,2,5,9,4,7,6,3,1,8,4,2,3,1,3,1,2,2,3,2,3,1,1,2,3,3,1,1,2,3,1,2,3,1,3,2,3,2,1,2,1,1,0,3,2,1,3,3,2,1,3,2,2,3,2,2,2,3,1,3,1,2,3,2,3,2,1,3,2,3,2,3,2,1,1,2,0,3,1,0,1,2,2,3,2,3,2,1,0,8,8,7,6,6,6,9,8,5,9,8,8 +R_6OcQXI2ElDfjvPW,25 - 31,American,Female,Somewhat agree,Agree,Somewhat agree,Agree,Somewhat disagree,2,1,4,3,5,Somewhat disagree,Agree,Somewhat disagree,Agree,Somewhat disagree,3,1,5,2,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,5,4,3,2,1,Somewhat agree,Agree,Agree,Agree,Disagree,5,4,3,1,2,4,Disagree,Somewhat agree,Disagree,Somewhat agree,Disagree,4,2,1,3,5,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Disagree,Somewhat Agree,2,1,4,5,3,4,Somewhat disagree,Agree,Agree,Agree,Disagree,2,3,5,1,4,4,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,4,5,2,1,6,Somewhat Agree,Somewhat Disagree,Somewhat Disagree,Disagree,Somewhat Agree,1,3,4,5,2,8,Agree,Agree,Agree,Agree,Disagree,2,4,3,1,5,3,Disagree,Disagree,Somewhat disagree,Somewhat agree,Disagree,5,3,2,4,1,3,Agree,Somewhat Agree,Somewhat Agree,Disagree,Agree,1,4,5,3,2,3,Agree,Agree,Agree,Agree,Disagree,5,4,3,1,2,3,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,Disagree,3,1,5,2,4,3,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,1,5,4,2,3,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,-1,1,-1,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),29,02PsVPf,01PAST,10,01ITEM,0.25,0,1,3,5,7,4,9,6,8,1,2,3,4,2,1,1,2,1,2,-1,-1,2,-1,2,-1,2,1,1,-1,1,1,2,2,2,-2,-2,1,-2,1,-2,1,-1,1,-2,1,-1,2,2,2,-2,-1,1,-1,1,-1,1,-1,-1,-2,1,2,2,2,2,-2,-2,-2,-1,1,-2,2,1,1,-2,2,2,2,2,2,-2,-1,1,-2,1,-2,1,-1,1,-1,1,4,3,4,4,6,8,3,3,3,3,3,6 +R_6V7mTJpfer87KvO,46 - 52,Canadian,Male,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Strongly disagree,1,4,2,5,3,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,2,3,1,4,5,Strongly Agree,Agree,Somewhat Agree,Somewhat Disagree,Strongly Agree,1,2,3,4,5,Neither agree nor disagree,Strongly agree,Agree,Somewhat disagree,Disagree,2,1,4,3,5,1,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,2,3,4,5,1,3,Strongly agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,5,1,2,3,4,1,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Strongly disagree,5,3,1,4,2,4,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,3,1,2,4,9,Strongly agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,3,5,1,2,4,1,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,Strongly disagree,4,5,1,3,2,2,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,2,3,5,4,1,6,Strongly agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,3,4,2,1,5,1,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat agree,Strongly disagree,1,5,2,4,3,5,Somewhat disagree,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,1,5,3,2,4,5,Strongly agree,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,4,1,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,0,-2,0,1,-1,10 cents,100 minutes,24 days,Male,High School (or equivalent),49,01PfPsV,02FUT,10,01ITEM,0.375,0,1,6,9,8,5,7,2,3,1,4,4,3,2,1,0,2,2,0,-3,-1,0,1,2,0,3,2,1,-1,3,0,3,2,-1,-2,-1,0,0,-1,-1,3,2,1,0,3,0,3,2,0,-3,1,1,2,2,1,3,2,1,0,3,0,3,2,0,-3,-1,-1,2,0,0,3,2,2,0,3,0,3,3,1,-3,-1,0,2,2,0,3,3,1,0,2,1,3,1,4,9,1,2,6,1,5,5,2 +R_5ARz8uHpt8i8jlW,25 - 31,Canadian,Male,Strongly disagree,Strongly agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,4,5,3,1,2,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,3,4,1,2,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,3,1,5,4,Strongly disagree,Agree,Somewhat disagree,Somewhat agree,Somewhat agree,2,4,5,1,3,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,1,3,4,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,2,4,1,5,3,3,Strongly disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,5,2,1,3,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,5,4,3,1,2,3,Disagree,Strongly agree,Disagree,Somewhat agree,Neither agree nor disagree,3,4,1,2,5,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,5,4,3,1,2,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,4,5,1,2,3,3,Disagree,Strongly agree,Disagree,Somewhat agree,Neither agree nor disagree,3,4,2,1,5,3,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,3,2,4,1,5,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,3,1,4,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,0,0,1,1,1,5 cents,100 minutes,47 days,Male,High School (or equivalent),30,01PfPsV,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,7,4,3,2,8,9,5,1,6,2,3,4,1,-3,3,-1,1,0,-1,0,0,0,0,1,1,0,0,1,-3,2,-1,1,1,-1,0,0,0,-1,1,0,0,0,1,-3,2,0,1,1,-1,0,0,0,1,1,0,0,0,1,-2,3,-2,1,0,-1,0,0,0,-1,1,0,0,0,1,-2,3,-2,1,0,-1,0,0,0,0,1,0,0,0,1,3,3,3,3,3,3,3,3,3,3,3,3 +R_7OlzeOEoXi6sKz1,32 - 38,American,Female,Strongly agree,Strongly agree,Agree,Agree,Agree,2,4,3,1,5,Agree,Strongly disagree,Agree,Strongly disagree,Agree,5,3,4,1,2,Agree,Strongly Agree,Strongly Agree,Agree,Strongly Agree,2,1,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Strongly agree,Somewhat agree,Agree,Agree,4,3,1,5,2,7,Agree,Agree,Agree,Strongly agree,Agree,4,1,5,3,2,7,Somewhat Agree,Agree,Agree,Agree,Somewhat Agree,1,4,3,2,5,6,Strongly agree,Strongly agree,Agree,Agree,Agree,4,2,1,5,3,7,Agree,Agree,Agree,Strongly agree,Agree,5,1,3,2,4,7,Strongly agree,Agree,Agree,Agree,Agree,2,1,5,3,4,7,Strongly agree,Strongly agree,Agree,Agree,Agree,4,2,1,5,3,6,Agree,Strongly agree,Agree,Strongly agree,Agree,3,5,4,2,1,7,Strongly agree,Agree,Agree,Strongly agree,Agree,5,3,4,2,1,5,Agree,Agree,Strongly agree,Strongly agree,Agree,1,3,2,4,5,7,Agree,Agree,Agree,Strongly agree,Agree,4,5,1,3,2,7,Strongly agree,Agree,Agree,Strongly agree,Agree,2,3,1,4,5,1,1,1,-1,-1,-1,-1,1,10 cents,100 minutes,24 days,Female,Professional Degree (ex. JD/MD),35,03VPfPs,01PAST,5,02DGEN,1,0,1,8,5,6,9,4,7,3,1,2,3,4,2,1,3,3,2,2,2,2,-3,2,-3,2,2,3,3,2,3,2,3,1,2,2,2,2,2,3,2,1,2,2,2,1,3,3,2,2,2,2,2,2,3,2,3,2,2,2,2,3,3,2,2,2,2,3,2,3,2,3,2,2,3,2,2,2,3,3,2,2,2,2,3,2,3,2,2,3,2,5,7,7,6,7,7,7,6,7,5,7,7 +R_5E9ViorLhnK8rMQ,32 - 38,American,Male,Somewhat agree,Agree,Strongly agree,Agree,Somewhat agree,1,2,3,4,5,Somewhat agree,Agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,1,3,4,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,5,4,2,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Strongly agree,Somewhat agree,Agree,Somewhat agree,Agree,3,1,2,5,4,6,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,4,2,1,7,Somewhat Agree,Agree,Somewhat Agree,Agree,Neither Agree nor Disagree,4,3,2,5,1,7,Agree,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,3,1,5,4,2,7,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Agree,4,3,2,1,5,7,Agree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Agree,3,1,4,2,5,6,Strongly agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,5,1,2,4,3,7,Somewhat agree,Agree,Agree,Strongly agree,Somewhat agree,1,4,2,3,5,6,Somewhat Agree,Strongly agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,3,5,4,2,1,6,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Strongly agree,4,2,1,3,5,6,Strongly agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Agree,5,2,1,3,4,6,Somewhat Agree,Somewhat Agree,Agree,Strongly agree,Agree,2,5,1,3,4,0,1,0,-2,0,-1,0,1,5 cents,25 minutes,36 days,Male,University - PhD,33,01PfPsV,02FUT,5,02DGEN,0.625,0.333333333,0,5,2,3,9,8,6,7,1,4,4,2,3,1,1,2,3,2,1,1,2,1,1,0,2,1,1,0,2,3,1,2,1,2,1,1,2,0,1,1,2,1,2,0,2,0,3,2,1,2,1,0,1,2,2,0,3,1,2,3,1,1,2,1,1,2,2,3,1,1,3,2,0,-1,2,0,-1,1,3,3,0,-1,1,2,1,1,2,3,2,6,6,7,7,7,7,6,7,6,6,6,6 +R_7n6GkzBhH7a69AA,39 - 45,American,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Somewhat agree,4,2,3,1,5,Agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,5,2,4,1,3,Agree,Strongly Agree,Strongly Agree,Disagree,Strongly Agree,2,1,4,3,5,Strongly agree,Strongly agree,Agree,Disagree,Strongly agree,3,4,5,2,1,2,Strongly agree,Agree,Strongly agree,Somewhat agree,Agree,3,4,2,5,1,3,Agree,Agree,Strongly agree,Disagree,Strongly agree,2,1,3,5,4,1,Strongly agree,Strongly agree,Agree,Strongly disagree,Somewhat agree,4,2,3,1,5,3,Somewhat agree,Somewhat disagree,Disagree,Strongly agree,Disagree,3,5,4,2,1,6,Strongly Disagree,Disagree,Agree,Strongly agree,Somewhat Disagree,3,4,1,2,5,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Disagree,2,1,4,3,5,2,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Somewhat disagree,4,1,2,5,3,5,Agree,Agree,Strongly agree,Strongly Disagree,Strongly agree,2,5,1,3,4,2,Disagree,Somewhat disagree,Agree,Strongly agree,Strongly disagree,1,5,4,3,2,8,Somewhat disagree,Somewhat disagree,Strongly disagree,Agree,Strongly disagree,1,4,5,2,3,10,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Strongly Disagree,Neither Agree nor Disagree,4,3,5,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-2,0,1,2,-2,-2,2,-1,10 cents,100 minutes,24 days,Female,Trade School (non-military),42,02PsVPf,01PAST,10,01ITEM,-0.25,0,1,2,5,3,9,6,7,8,1,4,4,3,2,1,3,3,2,3,1,2,-1,2,-1,1,2,3,3,-2,3,3,3,2,-2,3,3,2,3,1,2,2,2,3,-2,3,3,3,2,-3,1,1,-1,-2,3,-2,-3,-2,2,3,-1,3,3,3,3,-2,-1,-1,1,1,-1,2,2,3,-3,3,-2,-1,2,3,-3,-1,-1,-3,2,-3,0,1,1,-3,0,2,3,1,3,6,8,2,5,2,8,10,4 +R_3Vhy7KwpEkDYcIF,39 - 45,American,Male,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,1,5,4,3,2,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,4,3,2,Neither Agree nor Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,1,3,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Neither agree nor disagree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,2,5,1,3,4,5,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Disagree,3,4,2,5,1,5,Neither Agree nor Disagree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,4,1,3,2,5,5,Somewhat disagree,Agree,Agree,Neither agree nor disagree,Somewhat disagree,1,4,5,3,2,5,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,2,5,3,4,1,5,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,4,1,2,5,3,5,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,2,4,5,3,5,Strongly disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,1,3,4,5,5,Neither Agree nor Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,5,1,4,3,5,Somewhat agree,Somewhat agree,Somewhat agree,Strongly agree,Somewhat agree,1,4,2,5,3,5,Strongly disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,1,5,4,2,3,5,Neither Agree nor Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,2,3,5,1,4,0,1,1,1,0,1,2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,42,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,2,6,8,3,5,7,4,1,9,2,4,3,1,1,1,1,2,0,-2,-1,0,0,0,0,-2,1,-1,1,0,2,2,0,-1,-3,0,0,0,-2,0,-1,0,-1,1,-1,2,2,0,-1,-3,-1,0,0,-1,0,-1,1,-1,1,1,2,2,2,1,-3,-1,0,0,0,0,-2,1,-1,1,1,1,1,3,1,-3,-1,1,0,0,0,-2,1,-1,1,5,5,5,5,5,5,5,5,5,5,5,5 +R_1dEujNnGaGAwREn,32 - 38,Canadian,Male,Somewhat agree,Agree,Strongly agree,Agree,Strongly agree,1,5,4,3,2,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,1,3,5,2,4,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,5,4,1,2,3,Agree,Agree,Agree,Agree,Agree,2,4,5,1,3,2,Somewhat disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,2,4,1,3,5,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,5,2,1,3,4,2,Agree,Agree,Agree,Agree,Agree,1,3,5,2,4,2,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,3,5,4,1,2,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,2,4,1,5,3,2,Agree,Agree,Agree,Agree,Strongly agree,5,4,2,3,1,2,Somewhat disagree,Disagree,Agree,Disagree,Somewhat agree,4,2,1,5,3,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,3,4,1,5,2,2,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,2,5,4,3,2,Somewhat disagree,Disagree,Strongly agree,Disagree,Somewhat agree,5,4,1,2,3,2,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,2,4,3,5,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,1,-2,0,1,0,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,35,01PfPsV,02FUT,10,01ITEM,0.25,0.333333333,0.666666667,2,9,5,4,7,8,3,1,6,3,2,4,1,1,2,3,2,3,0,-2,2,-2,1,1,-1,2,-1,0,2,2,2,2,2,-1,-2,2,-1,1,1,-1,2,-1,0,2,2,2,2,2,-1,-2,2,-2,1,1,-1,2,-1,0,2,2,2,2,3,-1,-2,2,-2,1,1,-1,2,-1,0,2,3,3,2,3,-1,-2,3,-2,1,1,-1,2,-1,0,2,2,2,2,2,2,2,2,2,2,2,2 +R_5QZNQVyCgg6mHxT,32 - 38,Canadian,Male,Agree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,1,5,3,2,4,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,5,3,1,2,4,Agree,Somewhat Agree,Agree,Somewhat Agree,Agree,5,2,1,4,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat agree,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,4,1,3,5,2,3,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Strongly agree,4,5,3,2,1,4,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,4,3,2,5,1,2,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,1,2,4,3,5,6,Somewhat agree,Disagree,Somewhat agree,Neither agree nor disagree,Agree,4,3,1,2,5,5,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,4,5,3,1,2,3,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,3,4,2,5,4,Somewhat disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,4,1,3,5,3,Agree,Agree,Agree,Agree,Agree,1,2,4,3,5,2,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,1,5,2,3,4,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,5,4,3,1,2,4,Agree,Agree,Agree,Agree,Agree,3,5,4,2,1,1,1,0,1,-1,0,1,0,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,37,02PsVPf,01PAST,5,02DGEN,0.125,0.666666667,0.333333333,4,6,9,8,5,7,3,1,2,4,2,3,1,2,2,1,-1,1,-1,1,2,0,1,2,1,2,1,2,1,2,1,-1,1,0,-1,2,-1,3,2,1,1,1,2,1,2,-1,-1,0,1,-2,1,0,2,1,0,0,1,2,1,2,1,0,1,-1,0,2,0,1,2,2,2,2,2,1,2,1,0,1,1,0,2,-1,2,2,2,2,2,2,1,3,4,2,6,5,3,4,3,2,4,4 +R_3ZBuQ2egixQQH23,39 - 45,American,Female,Strongly agree,Disagree,Agree,Disagree,Strongly agree,4,3,2,1,5,Somewhat disagree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,4,3,5,1,2,Somewhat Agree,Disagree,Agree,Somewhat Disagree,Somewhat Agree,2,4,5,3,1,Strongly agree,Disagree,Strongly agree,Disagree,Agree,2,1,4,5,3,1,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,3,1,2,5,2,Agree,Disagree,Somewhat Agree,Disagree,Somewhat Disagree,5,4,3,1,2,3,Agree,Disagree,Agree,Disagree,Agree,4,3,5,1,2,1,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Agree,4,1,2,5,3,3,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Neither Agree nor Disagree,5,4,1,2,3,3,Agree,Disagree,Agree,Somewhat agree,Agree,5,2,4,3,1,2,Disagree,Somewhat agree,Agree,Somewhat disagree,Neither agree nor disagree,1,2,3,5,4,1,Somewhat Agree,Somewhat Disagree,Agree,Disagree,Agree,2,5,4,1,3,1,Agree,Disagree,Agree,Somewhat agree,Agree,2,1,4,3,5,1,Disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,1,4,3,2,5,1,Agree,Disagree,Agree,Disagree,Agree,4,1,2,5,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-1,1,2,1,10 cents,100 minutes,24 days,Female,University - PhD,41,01PfPsV,02FUT,5,01ITEM,0.375,0,1,2,7,4,3,8,5,9,1,6,3,4,2,1,3,-2,2,-2,3,-1,1,1,-2,0,1,-2,2,-1,1,3,-2,3,-2,2,-2,1,1,-1,0,2,-2,1,-2,-1,2,-2,2,-2,2,-1,0,1,0,2,1,-1,2,-1,0,2,-2,2,1,2,-2,1,2,-1,0,1,-1,2,-2,2,2,-2,2,1,2,-2,1,2,1,0,2,-2,2,-2,2,1,2,3,1,3,3,2,1,1,1,1,1 +R_7rwuOH1mNVm1TPa,32 - 38,Canadian,Male,Agree,Agree,Agree,Somewhat agree,Strongly agree,2,1,3,5,4,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,5,1,2,3,4,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly Agree,4,5,2,3,1,Agree,Agree,Agree,Somewhat agree,Strongly agree,3,4,1,2,5,10,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,2,3,4,5,1,0,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,5,4,1,2,3,0,Agree,Agree,Agree,Somewhat agree,Strongly agree,3,4,5,2,1,10,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,1,4,2,3,5,10,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,3,1,5,4,2,10,Agree,Agree,Agree,Somewhat agree,Strongly agree,4,1,5,3,2,5,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,1,3,5,4,2,5,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,1,4,5,3,2,5,Agree,Agree,Agree,Somewhat agree,Strongly agree,3,2,4,5,1,5,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,3,2,5,1,4,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,3,1,4,2,5,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,-2,0,0,0,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,32,03VPfPs,02FUT,5,01ITEM,0.25,0,1,7,4,8,6,2,5,9,1,3,4,2,3,1,2,2,2,1,3,0,3,0,3,0,0,1,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,2,2,2,1,3,0,3,0,3,0,0,1,0,0,3,2,2,2,1,3,0,3,0,3,0,0,0,0,0,3,10,0,0,10,10,10,5,5,5,5,5,5 +R_3O7M4ezgQ3BJwY1,25 - 31,Canadian,Female,Strongly agree,Strongly agree,Agree,Agree,Neither agree nor disagree,5,3,4,2,1,Agree,Somewhat agree,Agree,Strongly agree,Somewhat agree,4,5,3,2,1,Strongly Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,5,2,3,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,5,3,2,1,4,1,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,3,2,1,4,5,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,1,3,2,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,2,1,4,3,5,3,Agree,Agree,Agree,Strongly agree,Somewhat disagree,4,5,2,1,3,2,Somewhat Agree,Strongly agree,Strongly agree,Agree,Strongly agree,4,2,3,5,1,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,4,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,4,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,5,4,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,5,2,4,1,3,Agree,Somewhat agree,Somewhat agree,Strongly agree,Agree,4,2,1,3,5,3,Somewhat Agree,Agree,Agree,Strongly agree,Strongly agree,5,2,1,4,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,0,-1,-2,-1,2,10 cents,5 minutes,24 days,Female,High School (or equivalent),26,02PsVPf,01PAST,10,01ITEM,1.375,0.333333333,0.666666667,3,5,7,6,4,9,2,1,8,3,4,2,1,3,3,2,2,0,2,1,2,3,1,3,1,1,2,2,3,3,3,3,0,1,1,1,1,1,3,3,3,3,3,3,3,3,3,0,2,2,2,3,-1,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,1,1,3,2,1,2,2,3,3,1,4,4,3,2,5,3,2,2,3,3,2 +R_7Cgs4ihCU5s3Qb4,25 - 31,Canadian,Male,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Agree,1,3,5,2,4,Strongly disagree,Somewhat agree,Disagree,Strongly agree,Neither agree nor disagree,2,5,1,3,4,Strongly Agree,Strongly Agree,Strongly Agree,Strongly Agree,Somewhat Disagree,2,1,3,4,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,3,4,2,0,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Disagree,4,3,2,1,5,0,Strongly agree,Disagree,Strongly agree,Strongly agree,Agree,5,2,4,3,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,5,2,0,Strongly disagree,Strongly agree,Disagree,Agree,Disagree,1,5,4,3,2,5,Strongly agree,Agree,Strongly agree,Strongly agree,Somewhat Disagree,5,2,3,4,1,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,2,1,4,5,0,Strongly disagree,Disagree,Agree,Disagree,Agree,1,3,2,5,4,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Somewhat Agree,2,4,3,1,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,5,3,1,Somewhat agree,Strongly disagree,Strongly agree,Strongly disagree,Agree,3,5,1,2,4,1,Strongly agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,2,5,1,3,4,-2,2,1,-2,-2,-2,2,-2,10 cents,100 minutes,24 days,Male,University - Undergraduate,30,01PfPsV,02FUT,5,02DGEN,0.375,0,1,2,3,9,5,8,4,6,1,7,4,3,2,1,1,3,3,1,2,-3,1,-2,3,0,3,3,3,3,-1,3,3,3,3,3,-3,3,3,3,-2,3,-2,3,3,2,3,3,3,3,3,-3,3,-2,2,-2,3,2,3,3,-1,3,3,3,3,3,-3,-2,2,-2,2,3,3,3,-1,1,3,3,3,3,3,1,-3,3,-3,2,3,3,3,-3,3,0,0,0,0,0,5,0,0,0,3,1,1 +R_393iU1j0QCD9GDf,39 - 45,American,Male,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,2,5,3,4,1,Neither agree nor disagree,Somewhat disagree,Strongly agree,Disagree,Disagree,3,2,1,4,5,Strongly Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Strongly Agree,5,3,1,2,4,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,5,Agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,2,5,4,3,1,5,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,3,1,4,5,2,7,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,5,4,2,3,6,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,1,2,4,5,3,5,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,Agree,4,3,1,2,5,5,Agree,Agree,Strongly agree,Neither agree nor disagree,Strongly agree,3,2,4,1,5,5,Agree,Somewhat disagree,Strongly agree,Disagree,Agree,2,1,4,3,5,9,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Disagree,3,5,2,1,4,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,5,2,5,Agree,Agree,Somewhat agree,Neither agree nor disagree,Agree,1,4,2,5,3,5,Agree,Somewhat Agree,Agree,Agree,Agree,2,5,4,3,1,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,0,0,-1,-1,0,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,43,02PsVPf,02FUT,5,01ITEM,0.5,0,1,4,3,2,8,7,9,5,1,6,3,2,4,1,3,3,3,0,3,0,-1,3,-2,-2,3,0,2,0,3,3,3,3,3,3,2,0,0,0,2,3,2,3,3,2,3,3,3,0,3,1,0,1,0,1,3,1,3,3,2,2,2,3,0,3,2,-1,3,-2,2,1,1,-1,1,-1,3,3,3,3,3,2,2,1,0,2,2,1,2,2,2,5,5,7,6,5,5,5,9,8,5,5,5 +R_6SDeNyxNCfYeKhn,25 - 31,American,Female,Strongly agree,Agree,Agree,Agree,Somewhat agree,4,5,3,1,2,Disagree,Agree,Agree,Neither agree nor disagree,Strongly agree,4,3,2,5,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,4,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,2,1,4,3,5,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,Somewhat disagree,2,3,5,1,4,4,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,5,3,4,1,0,Agree,Strongly agree,Agree,Somewhat agree,Agree,3,2,4,1,5,3,Somewhat disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,3,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,5,2,4,1,3,3,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,3,5,2,1,4,3,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,4,2,3,1,5,2,Somewhat Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,3,5,2,4,4,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,Somewhat agree,4,2,3,1,5,1,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat agree,4,2,5,1,3,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,4,1,0,1,1,-1,-1,-1,0,1,10 cents,25 minutes,24 days,Female,University - Undergraduate,30,01PfPsV,01PAST,10,02DGEN,0.75,0,0.666666667,6,2,3,5,7,8,9,1,4,3,2,4,1,3,2,2,2,1,-2,2,2,0,3,0,0,1,1,1,2,2,1,1,1,-1,-1,1,-2,-1,1,1,0,0,0,2,3,2,1,2,-1,-1,0,0,0,0,1,1,1,1,1,1,2,0,1,0,1,0,0,1,-1,0,0,0,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,1,4,5,4,0,3,3,3,3,2,4,1,1 +R_3KZv5xSxkACcuo4,39 - 45,American,Male,Neither agree nor disagree,Agree,Agree,Somewhat agree,Strongly agree,4,1,5,2,3,Neither agree nor disagree,Somewhat agree,Agree,Disagree,Agree,2,4,3,1,5,Somewhat Agree,Somewhat Disagree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,4,1,5,2,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Strongly agree,2,4,1,5,3,0,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,5,3,1,4,2,0,Somewhat Agree,Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,4,1,3,5,0,Neither agree nor disagree,Agree,Strongly agree,Somewhat agree,Strongly agree,1,4,2,3,5,2,Neither agree nor disagree,Neither agree nor disagree,Agree,Strongly disagree,Strongly agree,4,1,3,2,5,1,Neither Agree nor Disagree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,3,4,1,5,1,Neither agree nor disagree,Agree,Strongly agree,Agree,Strongly agree,4,3,2,1,5,0,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,2,3,5,1,4,0,Somewhat Agree,Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,4,5,2,1,0,Somewhat agree,Agree,Strongly agree,Agree,Strongly agree,3,2,5,1,4,1,Neither agree nor disagree,Somewhat agree,Strongly agree,Strongly disagree,Strongly agree,4,3,2,1,5,1,Somewhat Agree,Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,4,5,1,3,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,0,2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),43,03VPfPs,01PAST,10,01ITEM,0.125,0.333333333,0.666666667,8,2,3,6,7,9,4,1,5,4,3,2,1,0,2,2,1,3,0,1,2,-2,2,1,-1,3,0,3,0,2,3,1,3,0,1,3,-3,3,1,-2,3,0,3,0,2,3,1,3,0,0,2,-3,3,0,-3,3,0,3,0,2,3,2,3,0,1,3,-3,3,1,-2,3,0,3,1,2,3,2,3,0,1,3,-3,3,1,-2,3,0,3,0,0,0,2,1,1,0,0,0,1,1,0 +R_1fDdcEyuCuBMSWX,18 - 24,Canadian,Female,Somewhat agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,5,1,4,2,Agree,Somewhat agree,Strongly agree,Somewhat agree,Agree,3,5,2,1,4,Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,5,4,2,3,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,3,1,4,2,6,Disagree,Agree,Somewhat agree,Agree,Somewhat disagree,1,2,4,3,5,5,Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,2,3,5,1,4,8,Strongly agree,Agree,Agree,Somewhat disagree,Somewhat agree,1,5,3,4,2,10,Strongly disagree,Agree,Somewhat disagree,Strongly agree,Strongly disagree,3,4,1,5,2,7,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,5,1,4,3,5,Agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,1,4,3,5,5,Agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,1,5,3,2,4,5,Agree,Somewhat Agree,Strongly agree,Disagree,Agree,4,2,3,1,5,5,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,5,3,2,1,4,5,Agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,5,2,3,5,Agree,Somewhat Agree,Strongly agree,Disagree,Agree,1,5,2,4,3,1,2,1,2,0,1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),22,01PfPsV,02FUT,5,02DGEN,0.125,0,1,5,3,2,9,8,4,7,1,6,4,3,2,1,1,3,2,3,3,2,1,3,1,2,2,1,3,1,2,3,3,3,2,2,-2,2,1,2,-1,2,1,1,2,2,3,2,2,-1,1,-3,2,-1,3,-3,2,1,2,-1,2,2,3,2,3,3,2,-1,3,-2,3,2,1,3,-2,2,3,3,2,2,3,2,-2,3,-3,3,2,1,3,-2,2,7,6,5,8,10,7,5,5,5,5,5,5 +R_1HS3RkBX2radTK9,25 - 31,American,Female,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,5,1,4,2,3,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,3,1,5,4,2,Strongly Agree,Agree,Strongly Agree,Agree,Strongly Agree,1,4,5,2,3,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,2,4,5,1,3,7,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,1,3,5,2,4,8,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,5,3,1,2,6,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,4,3,2,5,8,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,5,4,1,2,3,8,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Agree,Agree,3,2,1,4,5,8,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,2,3,5,1,4,9,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,3,5,4,2,1,9,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,4,1,5,3,9,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,4,1,9,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,1,5,4,2,8,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,2,4,5,3,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-1,-2,-2,-2,2,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,26,03VPfPs,01PAST,5,01ITEM,1.5,0,0.666666667,9,2,5,4,3,7,8,1,6,3,2,4,1,3,2,2,3,3,3,2,3,2,3,3,2,3,2,3,3,2,3,2,3,3,2,3,3,2,3,3,2,3,3,2,2,3,3,3,3,2,3,3,2,1,1,3,1,2,3,2,3,3,3,3,2,3,2,3,2,3,3,2,3,2,3,3,3,3,3,3,3,2,2,3,2,3,2,3,7,8,6,8,8,8,9,9,9,9,8,8 +R_3q4O7ntpabecbYC,39 - 45,American,Male,Strongly agree,Agree,Agree,Neither agree nor disagree,Strongly agree,2,1,5,3,4,Strongly agree,Agree,Agree,Strongly agree,Agree,2,3,1,4,5,Strongly Agree,Agree,Strongly Agree,Strongly Agree,Strongly Agree,5,3,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,4,5,2,3,1,8,Somewhat agree,Agree,Strongly agree,Agree,Somewhat agree,1,3,2,5,4,8,Strongly agree,Somewhat Agree,Strongly agree,Agree,Somewhat Agree,2,1,5,3,4,8,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,Agree,4,1,2,5,3,8,Strongly agree,Agree,Agree,Agree,Somewhat agree,2,5,1,3,4,8,Agree,Somewhat Agree,Strongly agree,Somewhat Agree,Strongly agree,3,1,2,4,5,8,Somewhat agree,Agree,Agree,Neither agree nor disagree,Strongly agree,1,2,4,3,5,8,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Agree,5,3,2,1,4,7,Somewhat Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,2,3,1,8,Strongly agree,Somewhat agree,Agree,Agree,Somewhat agree,4,1,5,2,3,8,Agree,Somewhat agree,Somewhat agree,Somewhat agree,Agree,2,5,3,1,4,8,Somewhat Agree,Somewhat Agree,Agree,Agree,Somewhat Agree,3,1,4,2,5,2,1,1,-1,-2,-1,-1,1,5 cents,5 minutes,47 days,Male,University - Graduate (Masters),43,02PsVPf,02FUT,10,02DGEN,1.25,1,0,2,7,3,6,9,5,4,1,8,4,2,3,1,3,2,2,0,3,3,2,2,3,2,3,2,3,3,3,2,3,1,0,2,1,2,3,2,1,3,1,3,2,1,1,1,3,3,2,3,2,2,2,1,2,1,3,1,3,1,2,2,0,3,1,1,2,1,2,1,2,2,1,1,3,1,2,2,1,2,1,1,1,2,1,1,2,2,1,8,8,8,8,8,8,8,8,7,8,8,8 +R_65Kt0rAQIbvU7zf,25 - 31,American,Female,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,4,2,3,1,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat agree,1,3,2,5,4,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,3,5,1,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,2,1,2,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,4,3,5,2,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,1,3,2,5,4,1,Somewhat agree,Disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,1,2,3,4,5,4,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat agree,2,3,4,1,5,3,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,3,2,1,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,5,2,4,3,1,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,3,5,1,2,4,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,2,1,3,5,3,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,4,Somewhat disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,1,4,5,2,3,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,2,1,5,4,3,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,2,1,1,1,1,5 cents,5 minutes,47 days,Female,High School (or equivalent),31,02PsVPf,01PAST,10,01ITEM,-0.125,1,0,4,9,3,8,5,2,6,1,7,2,4,3,1,1,0,0,0,1,-2,0,-2,0,1,0,0,1,0,0,1,-1,0,0,0,-1,0,-1,0,1,0,0,1,0,0,1,-2,0,0,0,-2,1,-1,1,1,0,-1,1,0,0,1,0,0,0,1,-1,-1,1,-1,1,0,0,1,0,0,1,0,0,0,1,-1,-1,1,-1,1,0,0,1,0,0,2,2,1,4,3,4,3,2,3,4,3,3 +R_5TKPR1LQb8tEprm,32 - 38,American,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Somewhat agree,4,3,1,5,2,Somewhat agree,Disagree,Agree,Disagree,Agree,5,4,3,2,1,Somewhat Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,5,4,2,1,Agree,Agree,Somewhat agree,Agree,Neither agree nor disagree,3,5,4,1,2,2,Somewhat agree,Disagree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,4,2,1,5,3,2,Agree,Agree,Agree,Somewhat Agree,Agree,1,2,3,5,4,1,Agree,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,2,4,3,5,1,Agree,Somewhat disagree,Neither agree nor disagree,Somewhat disagree,Neither agree nor disagree,1,4,2,5,3,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,Agree,Agree,4,5,2,1,3,3,Agree,Agree,Agree,Agree,Agree,4,5,3,2,1,0,Agree,Somewhat disagree,Agree,Somewhat disagree,Agree,3,1,4,2,5,0,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,3,5,2,4,0,Agree,Agree,Somewhat agree,Agree,Agree,5,4,2,3,1,1,Somewhat agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,3,2,1,5,4,3,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,5,4,2,3,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,2,1,-1,1,1,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,37,01PfPsV,02FUT,5,01ITEM,0.25,0,1,5,3,6,2,9,4,7,1,8,4,2,3,1,3,3,2,3,1,1,-2,2,-2,2,1,2,3,0,3,2,2,1,2,0,1,-2,1,-1,0,2,2,2,1,2,2,2,0,2,0,2,-1,0,-1,0,0,0,2,2,2,2,2,2,2,2,2,-1,2,-1,2,2,2,2,0,2,2,2,1,2,2,1,0,2,0,2,2,2,2,0,2,2,2,1,1,2,3,0,0,0,1,3,0 +R_6EIajlGyiZ4iK9r,32 - 38,American,Male,Somewhat agree,Agree,Agree,Somewhat agree,Agree,5,4,3,1,2,Disagree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,4,2,5,1,3,Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,3,1,5,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Neither agree nor disagree,Agree,Agree,Strongly agree,Somewhat disagree,3,2,1,4,5,1,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,5,4,3,2,1,2,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,2,3,1,4,5,3,Somewhat agree,Agree,Agree,Agree,Disagree,4,5,2,1,3,2,Somewhat agree,Somewhat agree,Agree,Agree,Somewhat agree,1,4,5,2,3,2,Agree,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Agree,4,5,2,1,3,2,Somewhat agree,Agree,Agree,Agree,Agree,3,4,2,1,5,2,Disagree,Somewhat agree,Strongly agree,Agree,Disagree,2,4,1,3,5,2,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,4,3,2,1,5,2,Somewhat agree,Agree,Agree,Agree,Agree,2,1,4,3,5,2,Disagree,Agree,Agree,Agree,Disagree,1,2,5,4,3,2,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,5,3,1,2,4,1,1,1,2,1,1,2,1,10 cents,5 minutes,24 days,Male,College Diploma/Certificate,34,03VPfPs,02FUT,5,02DGEN,-0.25,0.333333333,0.666666667,3,8,7,2,5,9,4,1,6,3,2,4,1,1,2,2,1,2,-2,1,3,2,0,2,-1,0,1,0,0,2,2,3,-1,1,1,2,2,1,3,1,0,2,1,1,2,2,2,-2,1,1,2,2,1,2,1,-1,2,1,1,2,2,2,2,-2,1,3,2,-2,2,0,1,-1,0,1,2,2,2,2,-2,2,2,2,-2,2,0,0,1,0,2,1,2,3,2,2,2,2,2,2,2,2 +R_6MuhwCW9iWSWXXF,18 - 24,American,Male,Somewhat disagree,Strongly agree,Somewhat agree,Somewhat agree,Agree,3,1,4,5,2,Somewhat disagree,Disagree,Agree,Agree,Somewhat agree,5,1,2,3,4,Disagree,Strongly Disagree,Agree,Somewhat Disagree,Agree,2,5,1,3,4,Disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,5,3,2,4,1,4,Somewhat agree,Somewhat disagree,Somewhat disagree,Strongly agree,Somewhat disagree,1,4,2,3,5,8,Somewhat Disagree,Disagree,Somewhat Agree,Somewhat Disagree,Strongly agree,5,2,3,4,1,4,Somewhat disagree,Somewhat agree,Somewhat agree,Strongly agree,Strongly agree,5,1,3,4,2,5,Somewhat agree,Somewhat disagree,Somewhat disagree,Disagree,Somewhat agree,5,2,4,3,1,9,Somewhat Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,5,4,2,1,3,7,Somewhat agree,Strongly agree,Agree,Agree,Strongly agree,1,4,2,5,3,5,Strongly disagree,Disagree,Disagree,Disagree,Somewhat disagree,4,1,3,5,2,7,Somewhat Disagree,Disagree,Somewhat Agree,Somewhat Agree,Agree,4,5,1,3,2,3,Somewhat disagree,Strongly agree,Agree,Somewhat agree,Somewhat agree,4,3,1,2,5,3,Agree,Strongly disagree,Strongly agree,Somewhat agree,Somewhat agree,2,1,5,3,4,6,Somewhat Agree,Agree,Somewhat Agree,Agree,Somewhat Disagree,1,5,3,2,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,-1,2,1,1,2,1,10 cents,100 minutes,47 days,Male,College Diploma/Certificate,18,02PsVPf,01PAST,5,01ITEM,-0.5,0.333333333,0.666666667,5,7,8,4,6,2,9,1,3,3,4,2,1,-1,3,1,1,2,-1,-2,2,2,1,-2,-3,2,-1,2,-2,1,2,-1,-1,1,-1,-1,3,-1,-1,-2,1,-1,3,-1,1,1,3,3,1,-1,-1,-2,1,1,-1,2,-1,2,1,3,2,2,3,-3,-2,-2,-2,-1,-1,-2,1,1,2,-1,3,2,1,1,2,-3,3,1,1,1,2,1,2,-1,4,8,4,5,9,7,5,7,3,3,6,6 +R_5QSPfbfURz0smCQ,25 - 31,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,1,4,Disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,3,1,2,5,4,Somewhat Agree,Strongly Disagree,Strongly Agree,Disagree,Strongly Agree,3,1,2,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat disagree,Neither agree nor disagree,Strongly agree,Strongly agree,Somewhat disagree,3,5,1,2,4,3,Disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,4,1,5,3,2,Somewhat Agree,Disagree,Strongly agree,Disagree,Somewhat Agree,1,3,2,4,5,4,Strongly disagree,Strongly disagree,Strongly agree,Strongly agree,Strongly disagree,5,4,2,1,3,10,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,Somewhat disagree,4,2,1,3,5,10,Agree,Somewhat Agree,Strongly agree,Strongly agree,Disagree,5,3,4,1,2,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,4,Neither agree nor disagree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,1,3,4,2,5,2,Somewhat Agree,Strongly Disagree,Strongly agree,Disagree,Strongly agree,4,3,1,2,5,5,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,5,4,1,3,8,Somewhat agree,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,5,1,2,4,3,1,Somewhat Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,5,4,2,1,2,2,2,2,2,2,2,2,10 cents,5 minutes,24 days,Male,High School (or equivalent),28,02PsVPf,02FUT,10,02DGEN,0,0.333333333,0.666666667,2,8,7,9,4,3,6,1,5,3,2,4,1,3,3,3,3,3,-2,1,1,0,3,1,-3,3,-2,3,-1,0,3,3,-1,-2,1,-1,1,-1,1,-2,3,-2,1,-3,-3,3,3,-3,-3,3,-3,3,-1,2,1,3,3,-2,3,3,3,3,3,0,-3,0,0,3,1,-3,3,-2,3,3,3,3,3,3,1,-3,0,0,0,1,-3,3,-3,3,4,3,2,4,10,10,3,4,2,5,8,1 +R_3Y68hrqHAAuTrqX,18 - 24,Canadian,Female,Somewhat agree,Agree,Agree,Agree,Agree,2,4,1,5,3,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Somewhat agree,1,3,5,2,4,Agree,Strongly Agree,Agree,Agree,Strongly Agree,1,5,3,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat agree,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,3,4,5,2,1,4,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,5,2,1,3,4,5,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,4,5,3,1,2,7,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat disagree,3,2,1,5,4,8,Disagree,Somewhat agree,Somewhat disagree,Disagree,Disagree,4,1,2,3,5,6,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Disagree,Agree,2,3,5,4,1,1,Agree,Agree,Somewhat agree,Agree,Agree,5,4,3,2,1,1,Agree,Agree,Agree,Strongly agree,Strongly agree,1,2,4,5,3,1,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,3,2,4,5,4,Agree,Agree,Agree,Agree,Agree,4,3,2,1,5,4,Somewhat agree,Somewhat agree,Somewhat agree,Agree,Somewhat agree,4,5,2,3,1,3,Agree,Agree,Agree,Agree,Agree,5,4,2,3,1,-1,1,1,2,0,0,0,-1,5 cents,5 minutes,47 days,Female,University - Undergraduate,21,01PfPsV,01PAST,10,02DGEN,-0.25,1,0,9,5,8,6,2,7,3,1,4,3,2,4,1,1,2,2,2,2,0,0,1,1,1,2,3,2,2,3,1,-2,0,1,1,0,-1,1,1,0,1,2,0,1,0,-1,1,2,-1,-1,-2,1,-1,-2,-2,1,-1,0,-1,2,2,2,1,2,2,2,2,2,3,3,3,2,3,3,3,2,2,2,2,2,1,1,1,2,1,2,2,2,2,2,6,4,5,7,8,6,1,1,1,4,4,3 +R_3TCvDY1EpCYF1vj,25 - 31,American,Male,Strongly agree,Strongly agree,Somewhat agree,Agree,Agree,1,5,3,4,2,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Agree,1,5,3,2,4,Strongly Agree,Agree,Agree,Strongly Agree,Somewhat Agree,1,4,2,5,3,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,9,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,4,5,2,1,3,8,Agree,Strongly agree,Agree,Somewhat Agree,Strongly agree,4,3,2,1,5,9,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,1,3,2,4,9,Agree,Strongly agree,Strongly agree,Somewhat agree,Agree,4,5,3,1,2,8,Agree,Strongly agree,Strongly agree,Strongly agree,Agree,2,3,1,5,4,9,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,3,1,2,5,4,8,Strongly agree,Neither agree nor disagree,Agree,Somewhat disagree,Strongly agree,3,5,2,4,1,9,Strongly agree,Agree,Strongly agree,Agree,Strongly agree,1,4,3,2,5,9,Agree,Somewhat agree,Strongly agree,Strongly agree,Agree,4,3,1,5,2,9,Strongly agree,Agree,Strongly agree,Somewhat agree,Strongly agree,1,2,5,4,3,9,Agree,Agree,Somewhat Agree,Strongly agree,Somewhat Agree,4,2,1,3,5,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,1,-2,-1,-1,-2,1,10 cents,100 minutes,47 days,Male,Professional Degree (ex. JD/MD),25,01PfPsV,02FUT,5,01ITEM,1.5,0.333333333,0.666666667,2,5,8,6,9,4,3,1,7,3,2,4,1,3,3,1,2,2,1,3,1,0,2,3,2,2,3,1,2,2,3,3,3,2,1,2,1,3,2,3,2,1,3,3,3,3,2,2,2,3,3,1,2,2,3,3,3,2,3,3,2,3,2,3,0,2,-1,3,3,2,3,2,3,2,1,3,3,2,3,2,3,1,3,2,2,1,3,1,9,8,9,9,8,9,8,9,9,9,9,9 +R_6FCEd81BVKHY6dS,32 - 38,Canadian,Male,Agree,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,1,3,5,4,2,Strongly disagree,Somewhat agree,Disagree,Agree,Disagree,5,2,3,4,1,Somewhat Disagree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,5,4,3,2,1,Agree,Strongly agree,Somewhat agree,Disagree,Neither agree nor disagree,2,5,4,1,3,2,Disagree,Neither agree nor disagree,Strongly disagree,Somewhat agree,Neither agree nor disagree,2,1,4,5,3,2,Somewhat Disagree,Agree,Somewhat Agree,Agree,Somewhat Agree,2,5,1,3,4,5,Agree,Strongly agree,Somewhat agree,Disagree,Somewhat agree,1,2,5,3,4,6,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,4,2,1,5,3,7,Somewhat Agree,Agree,Somewhat Agree,Agree,Agree,2,5,1,4,3,6,Agree,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,4,3,2,1,5,1,Disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,4,3,5,1,2,5,Somewhat Disagree,Somewhat Agree,Strongly agree,Agree,Agree,4,2,1,5,3,2,Agree,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,4,1,5,3,2,0,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Neither agree nor disagree,5,4,1,3,2,4,Neither Agree nor Disagree,Somewhat Agree,Strongly agree,Agree,Strongly agree,2,3,5,4,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,0,-2,0,2,1,5 cents,5 minutes,47 days,Male,Trade School (non-military),34,03VPfPs,02FUT,5,01ITEM,0.75,1,0,3,9,5,6,4,7,2,1,8,4,3,2,1,2,3,1,1,0,-3,1,-2,2,-2,-1,1,3,1,2,2,3,1,-2,0,-2,0,-3,1,0,-1,2,1,2,1,2,3,1,-2,1,0,-1,1,-1,1,1,2,1,2,2,2,3,1,2,0,-2,0,1,0,0,-1,1,3,2,2,2,3,1,2,0,0,-1,2,0,0,0,1,3,2,3,2,2,5,6,7,6,1,5,2,0,4,3 +R_1iaMazG0aOQQ0zT,25 - 31,Canadian,Male,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Somewhat agree,1,4,3,2,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Agree,5,2,4,1,3,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Disagree,5,3,4,1,2,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Somewhat agree,3,1,2,5,4,7,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Strongly agree,2,4,1,5,3,6,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,3,5,2,1,4,6,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,2,5,4,1,3,7,Neither agree nor disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat agree,3,1,4,5,2,6,Somewhat Disagree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,1,4,5,3,2,7,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,1,4,2,5,6,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,5,1,3,4,2,8,Somewhat Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,5,4,1,2,3,6,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Neither agree nor disagree,1,5,2,4,3,5,Somewhat disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Agree,1,5,2,3,4,6,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,Somewhat Agree,Agree,5,3,2,1,4,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,0,-1,-1,0,-1,-1,10 cents,5 minutes,47 days,Male,University - Undergraduate,25,02PsVPf,02FUT,5,01ITEM,0.625,0.666666667,0.333333333,9,3,6,5,2,8,4,1,7,3,2,4,1,-1,1,2,1,1,1,1,0,-1,2,1,0,0,1,-1,1,0,3,1,1,0,1,1,0,3,3,0,0,1,1,-1,2,0,1,1,0,-1,2,-1,1,-1,2,0,0,1,2,1,0,0,1,1,-1,1,0,1,1,1,-1,1,0,1,0,3,1,0,-1,1,1,0,2,1,-1,0,1,2,7,6,6,7,6,7,6,8,6,5,6,6 +R_7tsUaAquS2msejC,18 - 24,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,4,3,Somewhat disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,2,5,1,4,3,Disagree,Agree,Agree,Somewhat Disagree,Somewhat Agree,1,3,4,5,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Agree,Agree,Agree,Agree,Agree,1,4,5,3,2,1,Disagree,Agree,Somewhat disagree,Somewhat agree,Agree,2,3,5,4,1,9,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Agree,Somewhat Disagree,2,5,1,3,4,9,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,3,4,2,1,5,1,Disagree,Agree,Somewhat agree,Neither agree nor disagree,Agree,3,2,4,5,1,6,Somewhat Agree,Disagree,Strongly agree,Agree,Disagree,1,5,3,2,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,2,5,1,1,Somewhat agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,1,4,3,5,2,0,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Agree,1,2,5,4,3,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,2,4,1,0,Neither agree nor disagree,Agree,Agree,Somewhat disagree,Agree,2,4,1,5,3,0,Agree,Agree,Agree,Somewhat Disagree,Agree,1,4,3,5,2,2,2,1,2,0,1,2,1,10 cents,100 minutes,24 days,Male,High School (or equivalent),23,01PfPsV,01PAST,10,02DGEN,0.125,0,1,9,2,5,8,3,4,6,1,7,2,3,4,1,3,3,3,3,3,-1,2,1,0,2,-2,2,2,-1,1,2,2,2,2,2,-2,2,-1,1,2,3,1,3,1,-1,1,3,3,3,-1,-2,2,1,0,2,1,-2,3,2,-2,3,3,3,3,3,1,-1,3,-1,3,3,3,3,-1,2,3,3,3,3,3,0,2,2,-1,2,2,2,2,-1,2,1,1,9,9,1,6,0,1,0,0,0,0 +R_7q3JYGkRcevsasx,32 - 38,Canadian,Male,Disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,4,2,1,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,5,1,3,4,2,Somewhat Agree,Somewhat Agree,Strongly Agree,Somewhat Agree,Agree,3,4,2,1,5,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,3,1,2,4,0,Strongly agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,1,4,3,5,2,0,Somewhat Agree,Strongly agree,Agree,Strongly agree,Agree,5,3,2,4,1,2,Strongly disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,3,4,0,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Strongly agree,1,4,3,5,2,4,Somewhat Agree,Agree,Somewhat Agree,Strongly agree,Agree,1,3,4,5,2,5,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,5,2,3,Strongly agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,3,5,2,2,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,2,5,4,1,4,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,3,5,4,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,1,4,5,2,2,Strongly agree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,1,2,4,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,-2,2,2,2,10 cents,5 minutes,24 days,Male,University - Undergraduate,33,02PsVPf,01PAST,5,01ITEM,0.375,0.333333333,0.666666667,9,2,6,7,8,5,3,1,4,2,3,4,1,-2,3,3,3,3,3,-2,3,-3,3,1,1,3,1,2,-3,3,3,3,3,3,-1,3,-2,3,1,3,2,3,2,-3,3,3,3,3,3,1,3,0,3,1,2,1,3,2,0,3,3,3,3,3,-2,3,-3,3,3,0,3,0,3,0,3,3,3,3,3,-3,3,-3,3,3,0,3,0,3,0,0,2,0,4,5,3,2,4,2,2,3 +R_7En1jXCmIuFVRwZ,32 - 38,Canadian,Female,Agree,Agree,Strongly agree,Strongly agree,Agree,1,2,5,3,4,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,2,3,5,1,Somewhat Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,3,1,5,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat disagree,Agree,Agree,Agree,Somewhat agree,2,3,5,4,1,3,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,2,4,1,3,5,2,Disagree,Disagree,Agree,Somewhat Agree,Agree,1,4,2,5,3,3,Disagree,Agree,Agree,Agree,Agree,4,5,1,2,3,4,Agree,Somewhat agree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,3,2,4,1,5,2,Somewhat Disagree,Disagree,Agree,Agree,Agree,5,3,1,4,2,2,Agree,Agree,Agree,Agree,Agree,1,4,5,2,3,2,Neither agree nor disagree,Somewhat agree,Agree,Somewhat agree,Neither agree nor disagree,2,4,1,5,3,2,Somewhat Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,5,3,2,4,1,2,Agree,Agree,Agree,Agree,Agree,2,4,5,3,1,2,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,1,2,4,5,1,Somewhat Disagree,Disagree,Agree,Neither Agree nor Disagree,Agree,5,4,2,3,1,0,2,2,2,0,2,2,0,10 cents,5 minutes,47 days,Female,University - Graduate (Masters),34,01PfPsV,02FUT,5,02DGEN,-0.25,0.666666667,0.333333333,2,3,8,7,6,4,9,1,5,3,4,2,1,2,2,3,3,2,0,1,0,1,0,-1,-2,2,0,2,-1,2,2,2,1,1,0,0,1,0,-2,-2,2,1,2,-2,2,2,2,2,2,1,-1,1,0,-1,-2,2,2,2,2,2,2,2,2,0,1,2,1,0,-1,-2,2,0,2,2,2,2,2,2,0,2,0,1,0,-1,-2,2,0,2,4,3,2,3,4,2,2,2,2,2,2,1 +R_3fiskxHGaD0cLA4,18 - 24,Canadian,Female,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Strongly agree,5,4,1,3,2,Agree,Agree,Strongly agree,Somewhat agree,Strongly agree,4,1,5,2,3,Agree,Somewhat Agree,Strongly Agree,Neither Agree nor Disagree,Agree,1,3,4,5,2,Somewhat disagree,Strongly agree,Somewhat agree,Disagree,Agree,4,1,2,5,3,7,Strongly agree,Disagree,Somewhat agree,Disagree,Somewhat agree,4,2,3,5,1,6,Somewhat Disagree,Disagree,Agree,Somewhat Agree,Strongly agree,1,5,2,4,3,7,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,1,4,5,2,3,2,Disagree,Disagree,Disagree,Strongly agree,Disagree,5,3,2,1,4,10,Strongly agree,Disagree,Disagree,Strongly Disagree,Strongly agree,5,3,2,1,4,8,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,5,3,4,1,2,2,Agree,Agree,Strongly agree,Somewhat disagree,Agree,5,1,2,4,3,3,Agree,Somewhat Agree,Strongly agree,Disagree,Somewhat Agree,4,1,5,2,3,5,Strongly agree,Strongly agree,Somewhat agree,Agree,Strongly agree,3,2,5,1,4,1,Somewhat agree,Strongly agree,Strongly agree,Disagree,Agree,4,1,2,3,5,3,Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Agree,2,4,5,3,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,2,-1,1,2,2,10 cents,100 minutes,24 days,Female,University - Undergraduate,24,03VPfPs,01PAST,10,01ITEM,0.375,0,1,7,4,3,5,9,2,6,1,8,4,2,3,1,3,3,1,-1,3,2,2,3,1,3,2,1,3,0,2,-1,3,1,-2,2,3,-2,1,-2,1,-1,-2,2,1,3,1,3,3,2,2,-2,-2,-2,3,-2,3,-2,-2,-3,3,3,3,1,2,3,2,2,3,-1,2,2,1,3,-2,1,3,3,1,2,3,1,3,3,-2,2,2,1,3,-1,2,7,6,7,2,10,8,2,3,5,1,3,1 +R_1GdjKBldvnVvqVT,32 - 38,Canadian,Female,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,5,2,1,3,4,Strongly disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,5,4,3,1,2,Agree,Strongly Disagree,Strongly Agree,Disagree,Agree,4,1,3,2,5,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,1,5,2,4,3,0,Strongly disagree,Disagree,Agree,Disagree,Somewhat agree,3,1,5,4,2,4,Agree,Strongly Disagree,Strongly agree,Somewhat Agree,Agree,3,4,5,1,2,7,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,2,1,5,4,3,2,Strongly disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,1,2,3,4,5,4,Agree,Strongly Disagree,Agree,Agree,Agree,5,3,4,1,2,3,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,4,5,2,3,1,0,Strongly disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,4,3,1,2,5,1,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,4,5,1,2,3,1,Strongly agree,Strongly agree,Agree,Somewhat disagree,Strongly agree,5,3,4,2,1,1,Strongly disagree,Somewhat disagree,Agree,Somewhat disagree,Agree,4,3,5,2,1,2,Agree,Strongly Disagree,Strongly agree,Strongly Disagree,Agree,5,3,1,2,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,2,1,0,2,2,1,10 cents,25 minutes,24 days,Female,University - Undergraduate,32,03VPfPs,01PAST,5,01ITEM,0.125,0,0.666666667,3,7,8,2,6,9,4,1,5,2,4,3,1,3,3,2,-1,3,-3,-1,2,0,1,2,-3,3,-2,2,3,3,2,-1,3,-3,-2,2,-2,1,2,-3,3,1,2,3,3,2,-1,3,-3,-2,2,0,1,2,-3,2,2,2,3,3,2,-1,3,-3,-2,2,0,1,2,-3,3,-3,2,3,3,2,-1,3,-3,-1,2,-1,2,2,-3,3,-3,2,0,4,7,2,4,3,0,1,1,1,2,1 +R_5dEb03CEck0NP30,18 - 24,Canadian,Female,Agree,Strongly agree,Somewhat disagree,Neither agree nor disagree,Strongly agree,3,5,2,1,4,Somewhat agree,Neither agree nor disagree,Somewhat agree,Disagree,Strongly agree,5,1,3,2,4,Disagree,Disagree,Strongly Agree,Somewhat Disagree,Agree,2,3,4,1,5,Disagree,Agree,Agree,Agree,Somewhat agree,1,4,3,2,5,7,Somewhat agree,Agree,Disagree,Neither agree nor disagree,Agree,4,3,1,5,2,7,Somewhat Disagree,Somewhat Disagree,Agree,Somewhat Agree,Neither Agree nor Disagree,4,5,3,1,2,3,Disagree,Strongly agree,Strongly agree,Agree,Agree,3,2,4,1,5,8,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,Somewhat disagree,2,4,5,1,3,9,Agree,Agree,Somewhat Agree,Neither Agree nor Disagree,Agree,2,1,4,5,3,7,Strongly agree,Agree,Somewhat disagree,Somewhat disagree,Strongly agree,5,1,3,4,2,2,Agree,Somewhat disagree,Agree,Disagree,Strongly agree,1,2,3,4,5,3,Disagree,Somewhat Disagree,Strongly agree,Disagree,Agree,1,3,4,5,2,6,Strongly agree,Agree,Neither agree nor disagree,Disagree,Strongly agree,2,5,3,1,4,4,Agree,Somewhat disagree,Strongly agree,Disagree,Strongly agree,3,2,5,4,1,3,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,Disagree,Agree,2,5,3,4,1,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,1,1,-1,1,2,10 cents,5 minutes,47 days,Female,College Diploma/Certificate,23,01PfPsV,02FUT,10,01ITEM,0.5,0.666666667,0.333333333,5,4,2,7,8,3,6,1,9,4,3,2,1,2,3,-1,0,3,1,0,1,-2,3,-2,-2,3,-1,2,-2,2,2,2,1,1,2,-2,0,2,-1,-1,2,1,0,-2,3,3,2,2,-1,2,-1,-1,-1,2,2,1,0,2,3,2,-1,-1,3,2,-1,2,-2,3,-2,-1,3,-2,2,3,2,0,-2,3,2,-1,3,-2,3,-1,0,3,-2,2,7,7,3,8,9,7,2,3,6,4,3,7 +R_51nsU96cLButl1m,32 - 38,Canadian,Female,Somewhat agree,Somewhat agree,Agree,Strongly agree,Somewhat agree,4,1,3,5,2,Strongly agree,Agree,Strongly agree,Agree,Neither agree nor disagree,5,3,2,1,4,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,Agree,5,2,3,1,4,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,2,1,4,5,9,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Neither agree nor disagree,3,5,4,2,1,9,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,2,1,5,3,4,8,Somewhat agree,Agree,Agree,Agree,Somewhat agree,1,2,3,4,5,6,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Somewhat agree,1,5,4,3,2,7,Agree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,1,3,5,2,4,9,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,1,5,3,4,2,8,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,3,5,9,Somewhat Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,1,3,2,4,8,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,4,1,5,2,3,6,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,2,1,5,3,4,7,Neither Agree nor Disagree,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,5,4,1,2,3,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-2,-2,-1,-2,2,10 cents,5 minutes,15 days,Female,University - Graduate (Masters),34,02PsVPf,01PAST,10,01ITEM,1.5,0.333333333,0.333333333,7,5,4,2,6,3,9,1,8,3,2,4,1,1,1,2,3,1,3,2,3,2,0,1,2,1,1,2,1,0,0,0,1,0,0,1,1,0,0,0,1,1,0,1,2,2,2,1,1,2,0,1,1,2,0,1,1,0,2,1,2,1,3,1,1,0,0,0,1,2,0,0,0,1,2,0,1,0,0,0,2,0,1,0,1,0,0,0,9,9,8,6,7,9,8,9,8,6,7,8 +R_6CKpghIA6EKH3Lw,32 - 38,Canadian,Female,Agree,Strongly agree,Somewhat disagree,Strongly disagree,Strongly agree,1,5,2,3,4,Somewhat disagree,Somewhat agree,Strongly agree,Somewhat agree,Strongly agree,4,1,2,3,5,Somewhat Disagree,Strongly Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,5,3,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Agree,Strongly agree,Strongly agree,Strongly disagree,Agree,2,4,5,3,1,5,Disagree,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,3,2,5,4,1,0,Strongly agree,Strongly Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,5,4,1,3,6,Somewhat disagree,Somewhat agree,Strongly agree,Agree,Somewhat agree,2,4,1,5,3,7,Strongly disagree,Disagree,Strongly agree,Agree,Agree,3,4,5,2,1,2,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,2,4,5,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,Strongly agree,1,4,3,5,2,6,Agree,Strongly disagree,Strongly agree,Strongly disagree,Somewhat disagree,2,5,1,3,4,7,Somewhat Agree,Strongly Disagree,Somewhat Agree,Agree,Strongly agree,4,5,1,3,2,7,Strongly agree,Agree,Neither agree nor disagree,Strongly agree,Agree,1,5,4,2,3,6,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,3,2,4,1,5,0,Strongly Disagree,Strongly Disagree,Strongly agree,Agree,Strongly agree,5,2,3,4,1,-1,2,0,2,-1,-2,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,34,01PfPsV,02FUT,5,02DGEN,0,0,1,7,6,3,4,2,9,5,1,8,3,4,2,1,2,3,-1,-3,3,-1,1,3,1,3,-1,-3,3,1,3,2,3,3,-3,2,-2,1,3,3,3,3,-3,3,0,3,-1,1,3,2,1,-3,-2,3,2,2,3,3,3,3,3,3,3,1,3,3,2,-3,3,-3,-1,1,-3,1,2,3,3,2,0,3,2,1,0,2,1,2,-3,-3,3,2,3,5,5,0,6,7,2,5,6,7,7,6,0 +R_5zIy4nKnA1GRUeI,18 - 24,Canadian,Male,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,4,1,2,5,3,Somewhat agree,Neither agree nor disagree,Agree,Somewhat agree,Agree,5,3,4,2,1,Agree,Agree,Agree,Somewhat Agree,Agree,3,1,5,4,2,Neither agree nor disagree,Agree,Somewhat agree,Somewhat agree,Agree,5,1,3,4,2,8,Disagree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,2,5,3,4,9,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Agree,5,4,1,3,2,8,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat agree,Agree,3,4,5,2,1,8,Agree,Somewhat agree,Neither agree nor disagree,Disagree,Strongly agree,5,3,4,1,2,8,Strongly agree,Somewhat Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,2,5,4,1,3,8,Strongly agree,Agree,Agree,Agree,Strongly agree,5,1,2,3,4,8,Strongly agree,Somewhat disagree,Strongly agree,Somewhat disagree,Strongly agree,1,4,5,2,3,9,Somewhat Agree,Agree,Strongly agree,Neither Agree nor Disagree,Agree,3,1,5,4,2,9,Agree,Agree,Agree,Agree,Somewhat agree,2,5,3,4,1,7,Strongly agree,Disagree,Strongly agree,Neither agree nor disagree,Agree,2,1,5,3,4,9,Agree,Strongly agree,Strongly agree,Disagree,Agree,2,1,5,4,3,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2,1,2,1,-1,2,1,5 cents,100 minutes,47 days,Male,High School (or equivalent),18,03VPfPs,01PAST,5,01ITEM,0.125,0.666666667,0.333333333,3,8,7,4,9,6,5,1,2,2,3,4,1,3,3,3,2,2,1,0,2,1,2,2,2,2,1,2,0,2,1,1,2,-2,-1,0,0,1,3,1,0,2,2,1,0,3,1,2,2,1,0,-2,3,3,1,0,2,1,3,2,2,2,3,3,-1,3,-1,3,1,2,3,0,2,2,2,2,2,1,3,-2,3,0,2,2,3,3,-2,2,8,9,8,8,8,8,8,9,9,7,9,9 +R_6do7H4cijRIGxQk,18 - 24,Canadian,Male,Somewhat disagree,Strongly agree,Neither agree nor disagree,Disagree,Somewhat agree,1,4,5,3,2,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,4,5,1,3,2,Agree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly Agree,1,3,5,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,Strongly disagree,Disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,3,4,5,2,1,10,Disagree,Somewhat disagree,Disagree,Somewhat disagree,Somewhat disagree,4,3,5,1,2,10,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,4,5,1,2,3,10,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Strongly agree,5,2,3,4,1,10,Strongly agree,Disagree,Neither agree nor disagree,Disagree,Agree,5,1,4,3,2,10,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,4,2,5,1,3,8,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,4,5,2,3,1,8,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,2,3,4,1,5,8,Agree,Agree,Agree,Neither Agree nor Disagree,Agree,1,4,3,5,2,8,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,4,2,1,5,8,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,Strongly agree,1,4,5,2,3,8,Agree,Agree,Agree,Neither Agree nor Disagree,Strongly agree,4,1,2,5,3,2,2,2,2,0,2,2,0,10 cents,5 minutes,47 days,Male,High School (or equivalent),20,02PsVPf,02FUT,10,02DGEN,0,0.666666667,0.333333333,6,4,5,3,2,8,7,1,9,2,3,4,1,-1,3,0,-2,1,0,0,0,0,3,2,1,1,0,3,-3,-2,3,0,1,-2,-1,-2,-1,-1,2,0,0,0,0,1,-2,2,0,3,3,-2,0,-2,2,2,0,0,0,2,0,3,0,0,0,0,0,2,0,3,2,2,2,0,2,0,3,0,0,1,0,0,2,0,3,2,2,2,0,3,10,10,10,10,10,10,8,8,8,8,8,8 +R_6QXHGLo0jxGg96h,18 - 24,Canadian,Male,Agree,Strongly agree,Somewhat agree,Disagree,Disagree,1,2,4,5,3,Disagree,Somewhat agree,Somewhat agree,Somewhat disagree,Neither agree nor disagree,5,2,3,4,1,Somewhat Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,5,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,Agree,Agree,Agree,Strongly disagree,Disagree,2,5,3,1,4,5,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,Somewhat disagree,4,5,1,3,2,7,Agree,Agree,Somewhat Disagree,Somewhat Agree,Disagree,3,2,4,5,1,5,Agree,Agree,Agree,Strongly disagree,Strongly disagree,2,4,3,1,5,5,Disagree,Somewhat disagree,Somewhat disagree,Somewhat agree,Disagree,5,4,3,1,2,8,Agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Neither Agree nor Disagree,1,4,5,3,2,2,Agree,Agree,Somewhat agree,Somewhat disagree,Somewhat disagree,1,4,3,2,5,2,Somewhat disagree,Agree,Somewhat agree,Disagree,Somewhat agree,4,2,5,1,3,3,Somewhat Disagree,Somewhat Disagree,Agree,Neither Agree nor Disagree,Somewhat Agree,3,2,5,4,1,3,Agree,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,1,5,5,Neither agree nor disagree,Agree,Somewhat agree,Disagree,Somewhat agree,1,4,3,5,2,5,Somewhat Disagree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Somewhat Agree,2,1,4,3,5,1,1,1,1,-1,1,2,1,10 cents,5 minutes,24 days,Male,High School (or equivalent),20,01PfPsV,02FUT,10,02DGEN,0.125,0.333333333,0.666666667,4,7,2,6,8,5,3,1,9,2,4,3,1,2,3,1,-2,-2,-2,1,1,-1,0,-1,-1,2,0,1,2,2,2,-3,-2,-2,0,-2,1,-1,2,2,-1,1,-2,2,2,2,-3,-3,-2,-1,-1,1,-2,2,1,-1,1,0,2,2,1,-1,-1,-1,2,1,-2,1,-1,-1,2,0,1,2,2,1,0,0,0,2,1,-2,1,-1,0,2,-1,1,3,5,7,5,5,8,2,2,3,3,5,5 +R_3EzrBY8Bybhs9NI,25 - 31,American,Prefer not to say,Somewhat agree,Strongly agree,Neither agree nor disagree,Disagree,Agree,4,2,1,5,3,Strongly agree,Somewhat disagree,Neither agree nor disagree,Agree,Agree,3,4,1,2,5,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,Disagree,Strongly Agree,1,5,3,2,4,Strongly agree,Somewhat disagree,Strongly agree,Strongly disagree,Somewhat disagree,3,2,1,4,5,6,Disagree,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,4,1,2,5,3,10,Disagree,Strongly Disagree,Neither Agree nor Disagree,Agree,Disagree,4,5,3,2,1,9,Strongly agree,Neither agree nor disagree,Strongly agree,Agree,Neither agree nor disagree,5,4,3,2,1,2,Disagree,Somewhat agree,Disagree,Agree,Disagree,5,1,3,2,4,6,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,Strongly Disagree,4,1,5,3,2,10,Agree,Strongly agree,Somewhat disagree,Somewhat disagree,Agree,4,3,1,5,2,1,Strongly agree,Disagree,Agree,Somewhat disagree,Strongly agree,3,4,5,1,2,5,Somewhat Agree,Somewhat Agree,Agree,Somewhat Disagree,Strongly agree,5,1,4,3,2,7,Neither agree nor disagree,Strongly agree,Somewhat disagree,Somewhat disagree,Agree,5,2,3,4,1,4,Somewhat agree,Strongly disagree,Agree,Strongly disagree,Somewhat agree,1,4,5,3,2,9,Agree,Strongly agree,Strongly agree,Strongly Disagree,Strongly agree,2,1,4,5,3,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,-1,1,2,0,-1,2,-2,10 cents,5 minutes,24 days,Prefer not to say,High School (or equivalent),25,02PsVPf,02FUT,5,01ITEM,-0.625,0.333333333,0.666666667,3,5,9,2,4,6,8,1,7,3,2,4,1,1,3,0,-2,2,3,-1,0,2,2,0,0,1,-2,3,3,-1,3,-3,-1,-2,3,-3,3,-3,-2,-3,0,2,-2,3,0,3,2,0,-2,1,-2,2,-2,-3,-3,-3,-3,-3,2,3,-1,-1,2,3,-2,2,-1,3,1,1,2,-1,3,0,3,-1,-1,2,1,-3,2,-3,1,2,3,3,-3,3,6,10,9,2,6,10,1,5,7,4,9,7 +R_1XNRUe0XEwh7Mit,25 - 31,American,Prefer not to say,Strongly agree,Agree,Agree,Strongly agree,Somewhat disagree,2,4,1,3,5,Strongly disagree,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,4,3,2,1,5,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,3,5,1,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Agree,Agree,Agree,Neither agree nor disagree,3,5,2,4,1,2,Somewhat disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,Somewhat agree,4,5,2,3,1,2,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,5,3,1,2,4,1,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,1,2,3,5,4,3,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,1,2,5,3,4,5,Somewhat Disagree,Strongly Disagree,Somewhat Agree,Somewhat Agree,Neither Agree nor Disagree,4,2,5,3,1,2,Strongly agree,Agree,Agree,Strongly agree,Somewhat disagree,3,2,5,1,4,2,Strongly disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat disagree,3,5,1,2,4,2,Agree,Neither Agree nor Disagree,Agree,Neither Agree nor Disagree,Agree,2,4,1,5,3,2,Strongly agree,Agree,Agree,Strongly agree,Neither agree nor disagree,3,1,4,5,2,3,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,3,2,1,4,5,2,Agree,Neither Agree nor Disagree,Agree,Disagree,Agree,5,3,4,2,1,0,2,0,2,0,-1,2,0,10 cents,100 minutes,24 days,Prefer not to say,High School (or equivalent),25,03VPfPs,02FUT,10,02DGEN,-0.125,0,1,7,6,8,2,9,3,4,1,5,3,2,4,1,3,2,2,3,-1,-3,0,-2,2,-1,2,0,2,0,2,2,2,2,2,0,-1,0,-2,0,1,2,0,2,0,2,1,3,3,1,-1,-1,3,0,3,-1,-1,-3,1,1,0,3,2,2,3,-1,-3,0,-1,1,-1,2,0,2,0,2,3,2,2,3,0,-3,0,0,1,-1,2,0,2,-2,2,2,2,2,1,3,5,2,2,2,2,3,2 +R_1E5lno0n9WvZcAx,32 - 38,American,Prefer not to say,Somewhat agree,Strongly agree,Somewhat agree,Agree,Agree,2,5,1,4,3,Somewhat disagree,Somewhat agree,Agree,Neither agree nor disagree,Somewhat agree,2,5,4,3,1,Agree,Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,3,4,5,2,1,Neither agree nor disagree,Strongly agree,Somewhat agree,Agree,Agree,1,4,5,3,2,5,Somewhat disagree,Somewhat agree,Agree,Somewhat agree,Agree,4,1,5,2,3,5,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,2,5,3,4,1,5,Somewhat disagree,Strongly agree,Agree,Strongly agree,Strongly agree,3,5,4,1,2,7,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,4,5,2,1,3,6,Neither Agree nor Disagree,Somewhat Agree,Agree,Neither Agree nor Disagree,Somewhat Agree,1,3,5,4,2,7,Agree,Strongly agree,Somewhat agree,Agree,Strongly agree,1,2,3,4,5,5,Neither agree nor disagree,Somewhat agree,Agree,Neither agree nor disagree,Agree,4,1,3,2,5,5,Strongly agree,Agree,Agree,Agree,Strongly agree,5,2,1,3,4,5,Somewhat agree,Strongly agree,Agree,Agree,Agree,3,2,4,1,5,5,Neither agree nor disagree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,2,1,5,3,4,5,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,5,1,4,2,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,1,0,1,1,0,1,0,10 cents,100 minutes,24 days,Prefer not to say,High School (or equivalent),36,03VPfPs,01PAST,5,01ITEM,-0.25,0,1,6,9,7,4,3,2,8,1,5,4,2,3,1,1,3,1,2,2,-1,1,2,0,1,2,2,3,0,3,0,3,1,2,2,-1,1,2,1,2,1,1,1,1,1,-1,3,2,3,3,-1,0,1,3,2,0,1,2,0,1,2,3,1,2,3,0,1,2,0,2,3,2,2,2,3,1,3,2,2,2,0,1,3,-1,2,3,3,3,2,3,5,5,5,7,6,7,5,5,5,5,5,5 +R_7G8751MoFwlehAZ,18 - 24,American,Female,Agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,5,4,2,1,3,Strongly agree,Somewhat disagree,Agree,Somewhat agree,Agree,1,3,5,2,4,Somewhat Disagree,Disagree,Strongly Agree,Somewhat Agree,Strongly Agree,3,1,4,2,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,Somewhat agree,1,5,2,3,4,10,Agree,Agree,Strongly agree,Agree,Disagree,5,2,3,1,4,7,Strongly agree,Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,2,1,3,5,4,7,Somewhat disagree,Somewhat agree,Strongly agree,Strongly agree,Somewhat agree,1,2,5,3,4,9,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Disagree,1,3,4,2,5,10,Strongly agree,Strongly agree,Somewhat Agree,Strongly agree,Somewhat Disagree,1,5,3,4,2,7,Somewhat agree,Agree,Somewhat agree,Strongly agree,Strongly agree,1,2,3,5,4,5,Agree,Somewhat agree,Strongly agree,Somewhat disagree,Agree,2,3,1,4,5,8,Somewhat Agree,Somewhat Agree,Strongly agree,Somewhat Disagree,Strongly agree,4,2,3,5,1,8,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,4,5,1,3,2,4,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,2,4,5,1,3,4,Somewhat Agree,Somewhat Disagree,Strongly agree,Agree,Strongly agree,4,3,5,1,2,0,1,-1,2,-2,-1,1,0,10 cents,100 minutes,47 days,Female,High School (or equivalent),23,03VPfPs,02FUT,5,02DGEN,0,0.333333333,0.666666667,5,3,7,2,4,9,8,1,6,4,2,3,1,2,3,3,1,1,3,-1,2,1,2,-1,-2,3,1,3,1,3,3,1,1,2,2,3,2,-2,3,2,1,3,-1,-1,1,3,3,1,1,3,3,3,-2,3,3,1,3,-1,1,2,1,3,3,2,1,3,-1,2,1,1,3,-1,3,1,3,3,3,1,3,1,3,-1,3,1,-1,3,2,3,6,10,7,7,9,10,7,5,8,8,4,4 +R_7HBLHNwVSCrI6jD,25 - 31,American,Male,Agree,Agree,Strongly agree,Agree,Strongly agree,5,1,3,2,4,Agree,Agree,Agree,Somewhat agree,Somewhat agree,3,5,1,2,4,Agree,Agree,Agree,Agree,Agree,2,5,4,1,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,Agree,Agree,Agree,Agree,Somewhat agree,5,3,4,1,2,7,Agree,Somewhat agree,Agree,Agree,Somewhat agree,5,2,4,1,3,7,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,5,4,1,3,2,7,Somewhat agree,Agree,Agree,Agree,Agree,2,5,1,4,3,7,Agree,Agree,Agree,Agree,Somewhat agree,4,1,3,5,2,8,Agree,Agree,Agree,Agree,Agree,2,3,4,1,5,8,Somewhat agree,Agree,Agree,Agree,Agree,2,1,5,4,3,8,Agree,Agree,Somewhat agree,Somewhat agree,Somewhat agree,5,3,2,4,1,9,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,1,4,3,5,2,8,Agree,Agree,Agree,Somewhat agree,Somewhat agree,1,2,3,5,4,6,Agree,Somewhat agree,Somewhat agree,Agree,Agree,1,3,2,4,5,8,Agree,Agree,Somewhat Agree,Agree,Somewhat Agree,5,3,2,1,4,1,1,2,-2,-2,-1,-2,1,10 cents,100 minutes,24 days,Male,College Diploma/Certificate,30,01PfPsV,01PAST,5,02DGEN,1.5,0,1,2,8,7,6,9,4,3,1,5,4,2,3,1,2,2,3,2,3,2,2,2,1,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,1,2,2,2,1,1,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,1,2,2,2,2,2,2,1,1,1,2,1,1,1,2,2,2,2,1,1,2,1,1,2,2,2,2,1,2,1,7,7,7,7,7,8,8,8,9,8,6,8 +R_1I5TwsSiQ8rZBLm,46 - 52,American,Male,Agree,Strongly agree,Agree,Somewhat disagree,Neither agree nor disagree,2,4,5,3,1,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,4,3,1,2,5,Neither Agree nor Disagree,Somewhat Disagree,Strongly Agree,Somewhat Agree,Agree,2,5,4,3,1,Agree,Strongly agree,Agree,Disagree,Somewhat agree,4,5,2,1,3,2,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,2,3,4,1,5,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Somewhat Agree,Strongly agree,4,2,3,1,5,1,Agree,Strongly agree,Agree,Strongly disagree,Somewhat agree,2,1,5,3,4,3,Disagree,Somewhat disagree,Agree,Somewhat agree,Somewhat agree,1,2,4,3,5,2,Somewhat Agree,Somewhat Agree,Somewhat Agree,Agree,Agree,4,3,2,5,1,4,Agree,Strongly agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,4,2,3,5,1,Disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat agree,4,3,2,5,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Neither Agree nor Disagree,Strongly agree,5,2,1,3,4,2,Strongly agree,Strongly agree,Agree,Neither agree nor disagree,Neither agree nor disagree,3,1,4,5,2,1,Disagree,Neither agree nor disagree,Agree,Somewhat disagree,Neither agree nor disagree,3,5,1,2,4,3,Somewhat Disagree,Neither Agree nor Disagree,Strongly agree,Somewhat Disagree,Agree,4,2,3,1,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,0,1,2,2,10 cents,5 minutes,24 days,Male,Trade School (non-military),50,01PfPsV,02FUT,10,01ITEM,0.375,0.333333333,0.666666667,2,7,8,9,6,4,5,1,3,2,3,4,1,2,3,2,-1,0,-2,-1,2,0,1,0,-1,3,1,2,2,3,2,-2,1,-2,-1,2,0,1,0,0,3,1,3,2,3,2,-3,1,-2,-1,2,1,1,1,1,1,2,2,2,3,2,0,0,-2,-1,2,0,1,0,0,3,0,3,3,3,2,0,0,-2,0,2,-1,0,-1,0,3,-1,2,2,2,1,3,2,4,1,2,2,1,3,4 +R_1IhBxC4M6HUlLgE,53 - 59,Canadian,Male,Agree,Somewhat agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,5,4,2,1,3,Disagree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,3,5,1,2,4,Somewhat Agree,Disagree,Somewhat Agree,Neither Agree nor Disagree,Somewhat Agree,2,1,3,5,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Somewhat agree,4,2,1,5,3,6,Disagree,Disagree,Agree,Somewhat disagree,Neither agree nor disagree,5,3,2,4,1,5,Agree,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,1,5,2,4,3,7,Somewhat agree,Somewhat agree,Somewhat agree,Disagree,Neither agree nor disagree,3,2,4,1,5,4,Disagree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,5,2,4,3,1,6,Somewhat Agree,Disagree,Neither Agree nor Disagree,Somewhat Agree,Somewhat Agree,5,2,1,4,3,3,Strongly agree,Somewhat agree,Neither agree nor disagree,Disagree,Somewhat agree,3,2,4,1,5,7,Disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,4,3,5,2,1,2,Agree,Disagree,Agree,Somewhat Disagree,Agree,2,5,1,3,4,6,Agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,3,5,1,4,2,6,Neither agree nor disagree,Disagree,Agree,Disagree,Somewhat agree,5,1,3,4,2,7,Agree,Somewhat Disagree,Agree,Disagree,Agree,1,5,2,4,3,1,1,1,2,0,2,2,0,5 cents,5 minutes,15 days,Male,University - Undergraduate,59,02PsVPf,02FUT,10,02DGEN,-0.375,0.666666667,0,7,6,3,2,9,5,4,1,8,2,4,3,1,2,1,0,-1,1,-2,-2,2,0,1,1,-2,1,0,1,1,1,1,-2,1,-2,-2,2,-1,0,2,-1,2,1,1,1,1,1,-2,0,-2,-1,2,-1,-1,1,-2,0,1,1,3,1,0,-2,1,-2,-2,2,-1,1,2,-2,2,-1,2,2,1,0,0,1,0,-2,2,-2,1,2,-1,2,-2,2,4,6,5,7,4,6,3,7,2,6,6,7 +R_7s92ZR9oETlKVvH,53 - 59,Canadian,Male,Somewhat disagree,Strongly agree,Agree,Somewhat agree,Agree,4,5,2,3,1,Agree,Agree,Agree,Neither agree nor disagree,Strongly agree,5,1,4,3,2,Somewhat Agree,Agree,Agree,Agree,Strongly Agree,1,4,2,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Somewhat disagree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,2,5,4,3,1,Somewhat agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,4,2,5,3,1,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,2,3,4,5,1,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,Strongly agree,5,3,4,2,1,1,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,1,4,3,2,5,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,4,3,2,1,1,Neither agree nor disagree,Strongly agree,Agree,Somewhat agree,Agree,1,5,3,2,4,1,Somewhat agree,Agree,Agree,Agree,Agree,1,3,2,5,4,1,Agree,Agree,Agree,Agree,Agree,1,2,3,4,5,1,Neither agree nor disagree,Strongly agree,Agree,Agree,Agree,4,5,1,3,2,1,Agree,Somewhat agree,Agree,Somewhat agree,Agree,1,5,2,3,4,1,Somewhat Agree,Agree,Strongly agree,Agree,Strongly agree,5,2,4,1,3,0,1,2,1,-1,0,1,2,5 cents,100 minutes,47 days,Male,High School (or equivalent),58,03VPfPs,02FUT,10,02DGEN,0.5,0.666666667,0.333333333,9,5,6,7,4,3,2,1,8,3,4,2,1,-1,3,2,1,2,2,2,2,0,3,1,2,2,2,3,-1,3,3,1,3,1,3,3,3,3,2,3,3,3,3,3,3,3,0,3,2,3,3,2,3,3,3,3,3,3,0,3,2,1,2,1,2,2,2,2,2,2,2,2,2,0,3,2,2,2,2,1,2,1,2,1,2,3,2,3,1,1,1,1,1,1,1,1,1,1,1,1 +R_5luIfpUojL2tYmd,60 - 66,Canadian,Female,Somewhat disagree,Somewhat agree,Agree,Disagree,Strongly agree,1,4,3,2,5,Strongly agree,Somewhat disagree,Strongly agree,Disagree,Somewhat agree,3,1,4,5,2,Agree,Neither Agree nor Disagree,Strongly Agree,Neither Agree nor Disagree,Agree,5,2,3,4,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Somewhat agree,Neither agree nor disagree,Agree,Strongly disagree,Strongly agree,3,4,2,5,1,2,Strongly agree,Disagree,Strongly agree,Disagree,Strongly agree,2,4,5,3,1,2,Agree,Neither Agree nor Disagree,Agree,Agree,Agree,3,4,5,1,2,8,Agree,Somewhat agree,Somewhat agree,Strongly disagree,Strongly agree,2,3,4,1,5,8,Strongly agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Strongly agree,1,5,3,2,4,3,Agree,Somewhat Disagree,Strongly agree,Strongly agree,Agree,5,2,3,1,4,6,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,4,2,1,5,3,2,Strongly agree,Disagree,Agree,Disagree,Agree,3,4,1,5,2,1,Agree,Somewhat Disagree,Agree,Somewhat Disagree,Agree,4,1,3,5,2,7,Somewhat agree,Agree,Agree,Agree,Somewhat disagree,1,3,5,2,4,6,Somewhat agree,Somewhat disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,3,1,2,5,4,6,Somewhat Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Disagree,Somewhat Agree,3,5,2,4,1,2,2,2,2,0,1,1,1,10 cents,100 minutes,24 days,Female,Professional Degree (ex. JD/MD),61,02PsVPf,02FUT,5,02DGEN,0.375,0,1,9,7,3,2,4,5,6,1,8,2,4,3,1,-1,1,2,-2,3,3,-1,3,-2,1,2,0,3,0,2,1,0,2,-3,3,3,-2,3,-2,3,2,0,2,2,2,2,1,1,-3,3,3,-1,3,0,3,2,-1,3,3,2,1,0,0,1,1,3,-2,2,-2,2,2,-1,2,-1,2,1,2,2,2,-1,1,-1,0,0,-1,1,0,0,-1,1,2,2,2,8,8,3,6,2,1,7,6,6 +R_6TM0vko6aIToDlL,39 - 45,Canadian,Male,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,1,4,5,2,3,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,5,4,1,2,3,Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Agree,3,5,4,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,2,4,5,1,2,Agree,Somewhat disagree,Agree,Somewhat agree,Agree,3,2,1,5,4,2,Agree,Strongly agree,Agree,Agree,Agree,4,3,2,1,5,1,Agree,Strongly agree,Strongly agree,Somewhat agree,Strongly agree,3,4,2,1,5,2,Somewhat agree,Neither agree nor disagree,Agree,Somewhat disagree,Agree,3,5,1,4,2,1,Agree,Strongly agree,Strongly agree,Somewhat Agree,Agree,1,5,3,2,4,2,Agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,2,4,2,Somewhat agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,4,1,5,3,2,2,Agree,Strongly agree,Agree,Somewhat Agree,Agree,1,2,3,5,4,2,Strongly agree,Strongly agree,Strongly agree,Agree,Strongly agree,3,4,5,2,1,2,Neither agree nor disagree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Agree,2,1,5,3,4,1,Agree,Strongly agree,Agree,Agree,Agree,1,3,5,2,4,0,2,2,2,1,1,2,1,10 cents,5 minutes,24 days,Male,University - Undergraduate,42,03VPfPs,01PAST,10,02DGEN,-0.125,0.333333333,0.666666667,8,3,2,7,5,4,9,1,6,2,4,3,1,2,3,3,1,3,1,0,2,-1,2,2,3,3,1,2,2,3,3,2,3,2,-1,2,1,2,2,3,2,2,2,2,3,3,1,3,1,0,2,-1,2,2,3,3,1,2,2,3,3,3,3,1,0,3,-1,2,2,3,2,1,2,3,3,3,2,3,0,0,3,-1,2,2,3,2,2,2,2,2,2,1,2,1,2,2,2,2,2,1 +R_5bOcm4e0HuNX01r,46 - 52,American,Male,Agree,Strongly agree,Agree,Somewhat agree,Strongly agree,4,3,1,2,5,Neither agree nor disagree,Neither agree nor disagree,Somewhat disagree,Disagree,Strongly disagree,3,1,2,4,5,Somewhat Disagree,Agree,Somewhat Agree,Somewhat Agree,Somewhat Agree,3,1,5,4,2,Somewhat agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,5,1,3,2,4,2,Somewhat disagree,Disagree,Neither agree nor disagree,Disagree,Somewhat agree,4,1,3,2,5,6,Somewhat Agree,Agree,Somewhat Disagree,Somewhat Disagree,Somewhat Agree,2,4,3,5,1,6,Agree,Agree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,1,5,3,2,4,4,Neither agree nor disagree,Agree,Somewhat disagree,Agree,Neither agree nor disagree,4,5,2,1,3,7,Agree,Agree,Somewhat Agree,Somewhat Disagree,Neither Agree nor Disagree,5,1,3,4,2,5,Somewhat agree,Somewhat agree,Neither agree nor disagree,Disagree,Agree,4,2,3,1,5,7,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,2,1,4,5,3,6,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,1,3,2,4,5,7,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Somewhat agree,Strongly agree,4,3,1,5,2,6,Somewhat disagree,Somewhat agree,Somewhat disagree,Somewhat agree,Somewhat disagree,2,4,3,1,5,4,Somewhat Disagree,Somewhat Agree,Agree,Somewhat Agree,Somewhat Agree,3,4,1,2,5,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,0,0,1,-1,-2,-1,1,10 cents,5 minutes,47 days,Male,University - Graduate (Masters),48,01PfPsV,02FUT,5,01ITEM,0.375,0.666666667,0.333333333,3,7,4,5,9,2,6,1,8,2,3,4,1,2,3,2,1,3,0,0,-1,-2,-3,-1,2,1,1,1,1,1,2,1,3,-1,-2,0,-2,1,1,2,-1,-1,1,2,2,0,-1,1,0,2,-1,2,0,2,2,1,-1,0,1,1,0,-2,2,1,-1,1,-1,-1,1,-1,1,1,1,0,0,1,1,3,-1,1,-1,1,-1,-1,1,2,1,1,2,6,6,4,7,5,7,6,7,6,4,7 +R_1GUnt22PvETYEwV,39 - 45,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,5,4,1,2,3,Neither agree nor disagree,Somewhat agree,Strongly agree,Agree,Neither agree nor disagree,4,2,3,1,5,Somewhat Agree,Strongly Agree,Strongly Agree,Somewhat Agree,Somewhat Agree,1,5,3,4,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,3,4,8,Somewhat disagree,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,3,5,4,1,2,5,Disagree,Somewhat Agree,Strongly agree,Strongly agree,Strongly agree,1,3,4,2,5,10,Somewhat agree,Strongly agree,Strongly agree,Disagree,Strongly agree,1,4,5,2,3,7,Disagree,Strongly disagree,Agree,Strongly agree,Strongly disagree,3,2,4,5,1,10,Somewhat Disagree,Strongly agree,Somewhat Disagree,Strongly agree,Disagree,4,1,3,2,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,3,4,2,5,1,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Strongly agree,1,2,5,3,4,1,Strongly agree,Strongly agree,Strongly agree,Somewhat Disagree,Strongly agree,3,4,2,1,5,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Somewhat agree,3,4,5,1,2,1,Strongly agree,Somewhat agree,Strongly agree,Somewhat disagree,Strongly agree,5,1,3,4,2,1,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,4,5,3,1,-1,-2,2,2,0,0,2,-2,10 cents,100 minutes,24 days,Female,College Diploma/Certificate,42,01PfPsV,01PAST,5,02DGEN,-0.875,0,1,4,6,3,5,9,7,8,1,2,2,3,4,1,3,3,3,3,1,0,1,3,2,0,1,3,3,1,1,3,3,3,3,3,-1,3,3,3,-1,-2,1,3,3,3,1,3,3,-2,3,-2,-3,2,3,-3,-1,3,-1,3,-2,3,3,3,3,0,3,3,3,-1,3,3,3,3,-1,3,3,3,3,3,1,3,1,3,-1,3,3,3,3,0,3,8,8,5,10,7,10,3,1,1,1,1,1 +R_1hxSBuVv7q5n23w,53 - 59,American,Female,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,1,3,5,2,4,Somewhat disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,3,5,4,1,2,Strongly Agree,Neither Agree nor Disagree,Agree,Somewhat Disagree,Agree,2,4,3,5,1,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,5,2,1,3,0,Somewhat agree,Disagree,Strongly agree,Somewhat agree,Agree,4,5,1,3,2,7,Strongly agree,Somewhat Agree,Somewhat Disagree,Somewhat Agree,Strongly agree,5,3,1,4,2,6,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,4,5,2,1,3,1,Somewhat agree,Disagree,Agree,Neither agree nor disagree,Somewhat agree,1,5,3,4,2,6,Strongly agree,Somewhat Agree,Agree,Agree,Strongly agree,3,2,5,1,4,7,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,5,3,1,Disagree,Somewhat agree,Agree,Somewhat disagree,Somewhat agree,4,1,5,3,2,6,Disagree,Somewhat Disagree,Somewhat Agree,Disagree,Agree,2,1,5,4,3,3,Strongly agree,Agree,Strongly agree,Strongly agree,Agree,1,2,3,5,4,2,Disagree,Neither agree nor disagree,Somewhat agree,Somewhat disagree,Somewhat disagree,3,5,1,2,4,6,Strongly agree,Somewhat Disagree,Somewhat Agree,Disagree,Strongly agree,5,4,1,3,2,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,0,1,-1,0,1,-2,10 cents,25 minutes,24 days,Female,College Diploma/Certificate,56,02PsVPf,02FUT,5,01ITEM,-0.125,0,0.666666667,7,5,4,8,6,3,2,1,9,2,3,4,1,3,2,3,3,3,-1,1,2,-1,1,3,0,2,-1,2,3,3,2,3,3,1,-2,3,1,2,3,1,-1,1,3,3,3,2,3,3,1,-2,2,0,1,3,1,2,2,3,3,2,3,3,3,-2,1,2,-1,1,-2,-1,1,-2,2,3,2,3,3,2,-2,0,1,-1,-1,3,-1,1,-2,3,0,7,6,1,6,7,1,6,3,2,6,2 +R_7dg0n97nQhPRImG,39 - 45,Canadian,Female,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,2,5,3,1,4,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,3,1,2,5,Agree,Strongly Agree,Agree,Neither Agree nor Disagree,Agree,2,4,5,1,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,5,3,1,2,3,Agree,Agree,Agree,Agree,Agree,2,4,5,3,1,3,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,2,3,4,1,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,4,2,1,3,5,3,Neither agree nor disagree,Disagree,Somewhat agree,Disagree,Agree,4,3,5,2,1,3,Agree,Agree,Agree,Agree,Agree,1,3,2,4,5,3,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,1,5,4,3,3,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Agree,4,5,2,1,3,3,Strongly agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,4,5,1,2,3,3,Agree,Strongly agree,Strongly agree,Agree,Strongly agree,2,5,4,1,3,3,Neither agree nor disagree,Somewhat disagree,Strongly agree,Neither agree nor disagree,Somewhat agree,4,1,2,3,5,3,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,4,2,3,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0,1,1,-1,0,1,0,10 cents,100 minutes,24 days,Female,University - Graduate (Masters),39,02PsVPf,01PAST,10,01ITEM,0.125,0,1,8,4,3,2,5,9,6,1,7,4,2,3,1,3,2,2,3,3,0,-1,3,0,1,2,3,2,0,2,3,3,3,3,3,2,2,2,2,2,3,3,3,0,3,3,3,3,3,3,0,-2,1,-2,2,2,2,2,2,2,3,3,3,3,3,0,-1,3,0,2,3,2,0,0,3,2,3,3,2,3,0,-1,3,0,1,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3 +R_1v9R7QJPOWllM9X,53 - 59,American,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,3,1,4,2,5,Agree,Disagree,Strongly agree,Strongly disagree,Strongly agree,4,2,1,3,5,Neither Agree nor Disagree,Disagree,Strongly Agree,Disagree,Agree,2,4,1,3,5,Agree,Agree,Agree,Agree,Agree,3,5,1,2,4,1,Agree,Somewhat disagree,Agree,Somewhat agree,Agree,2,4,5,3,1,1,Somewhat Agree,Agree,Agree,Somewhat Agree,Agree,1,3,2,5,4,1,Agree,Strongly agree,Agree,Agree,Strongly agree,5,1,3,4,2,1,Agree,Disagree,Agree,Somewhat agree,Agree,1,2,3,4,5,1,Somewhat Disagree,Agree,Agree,Agree,Agree,1,5,4,2,3,2,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,5,2,4,3,1,0,Agree,Disagree,Agree,Disagree,Agree,3,4,1,2,5,0,Somewhat Disagree,Somewhat Disagree,Agree,Disagree,Agree,2,1,5,3,4,0,Strongly agree,Strongly agree,Agree,Strongly agree,Strongly agree,2,1,3,4,5,0,Somewhat agree,Disagree,Agree,Disagree,Agree,4,5,1,2,3,2,Somewhat Disagree,Somewhat Disagree,Strongly agree,Disagree,Agree,2,1,3,4,5,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,1,1,1,-1,1,1,-1,10 cents,100 minutes,24 days,Female,University - Undergraduate,56,03VPfPs,02FUT,10,01ITEM,-0.25,0,1,2,4,3,6,8,7,9,1,5,2,4,3,1,3,3,2,3,3,2,-2,3,-3,3,0,-2,3,-2,2,2,2,2,2,2,2,-1,2,1,2,1,2,2,1,2,2,3,2,2,3,2,-2,2,1,2,-1,2,2,2,2,3,3,2,3,3,2,-2,2,-2,2,-1,-1,2,-2,2,3,3,2,3,3,1,-2,2,-2,2,-1,-1,3,-2,2,1,1,1,1,1,2,0,0,0,0,2,1 +R_62zhW2oPlpAnX9n,18 - 24,American,Female,Somewhat agree,Strongly agree,Agree,Strongly agree,Agree,1,2,5,3,4,Somewhat agree,Agree,Agree,Agree,Strongly agree,5,4,3,2,1,Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Agree,5,2,1,3,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Neither agree nor disagree,Strongly agree,Agree,Strongly agree,Agree,1,3,2,5,4,3,Strongly agree,Neither agree nor disagree,Somewhat disagree,Somewhat disagree,Strongly agree,4,2,3,5,1,4,Strongly agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,4,3,1,2,5,3,Strongly agree,Strongly agree,Strongly agree,Somewhat disagree,Agree,4,5,1,2,3,4,Strongly agree,Agree,Somewhat agree,Somewhat disagree,Strongly agree,1,5,3,2,4,3,Strongly agree,Agree,Somewhat Agree,Agree,Strongly agree,1,3,2,5,4,2,Agree,Strongly agree,Agree,Strongly agree,Agree,1,3,5,4,2,3,Agree,Neither agree nor disagree,Agree,Neither agree nor disagree,Agree,4,1,2,3,5,7,Strongly agree,Somewhat Agree,Strongly agree,Strongly agree,Strongly agree,5,1,4,2,3,5,Strongly agree,Strongly agree,Somewhat agree,Neither agree nor disagree,Strongly agree,5,2,3,1,4,5,Agree,Neither agree nor disagree,Strongly agree,Somewhat disagree,Strongly agree,2,3,4,1,5,5,Agree,Agree,Strongly agree,Somewhat Agree,Strongly agree,3,2,4,1,5,0,0,-1,0,-2,-1,1,1,10 cents,100 minutes,24 days,Female,High School (or equivalent),19,03VPfPs,02FUT,10,02DGEN,0.25,0,1,9,5,6,2,8,3,4,1,7,3,2,4,1,1,3,2,3,2,1,2,2,2,3,2,1,3,-1,2,0,3,2,3,2,3,0,-1,-1,3,3,2,0,0,3,3,3,3,-1,2,3,2,1,-1,3,3,2,1,2,3,2,3,2,3,2,2,0,2,0,2,3,1,3,3,3,3,3,1,0,3,2,0,3,-1,3,2,2,3,1,3,1,3,4,3,4,3,2,3,7,5,5,5 +R_72VylO2t15dDoLx,39 - 45,Canadian,Female,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,5,1,4,2,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,3,4,2,5,1,Strongly Agree,Strongly Agree,Strongly Agree,Neither Agree nor Disagree,Strongly Agree,5,4,2,3,1,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,2,1,3,4,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,4,3,2,5,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,4,3,5,1,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,2,3,4,5,1,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,2,3,5,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,1,4,5,2,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,3,4,1,5,2,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,1,5,4,2,3,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,1,2,5,3,4,0,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Strongly agree,5,1,2,4,3,0,Strongly agree,Strongly disagree,Strongly agree,Strongly disagree,Strongly agree,4,1,5,3,2,0,Strongly agree,Strongly agree,Strongly agree,Neither Agree nor Disagree,Strongly agree,3,1,5,2,4,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,-2,2,2,2,5 cents,5 minutes,47 days,Female,University - Undergraduate,44,02PsVPf,02FUT,10,01ITEM,0.5,1,0,9,7,3,8,4,2,6,1,5,4,3,2,1,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,3,3,3,3,3,3,-3,3,-3,3,3,3,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_1Qpkh4ocVfMDtsJ,60 - 66,Canadian,Female,Agree,Agree,Agree,Agree,Strongly agree,3,5,2,1,4,Somewhat disagree,Strongly disagree,Agree,Somewhat disagree,Somewhat disagree,2,1,5,4,3,Somewhat Agree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,1,4,5,2,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,Agree,Agree,Agree,Agree,Agree,4,5,3,2,1,0,Disagree,Disagree,Agree,Disagree,Disagree,1,3,4,5,2,0,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,5,3,2,4,0,Agree,Agree,Agree,Somewhat agree,Agree,3,4,1,2,5,0,Disagree,Disagree,Agree,Somewhat disagree,Disagree,4,2,1,5,3,0,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,3,5,2,4,0,Agree,Agree,Agree,Agree,Agree,4,2,3,1,5,0,Disagree,Disagree,Agree,Disagree,Disagree,1,3,2,5,4,0,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,4,5,2,3,0,Agree,Agree,Agree,Agree,Agree,3,4,5,2,1,0,Disagree,Disagree,Agree,Disagree,Disagree,1,3,2,5,4,0,Somewhat Agree,Disagree,Strongly agree,Strongly Disagree,Strongly agree,1,3,2,5,4,1,1,-2,2,1,1,2,0,10 cents,100 minutes,24 days,Female,University - Undergraduate,62,03VPfPs,01PAST,10,02DGEN,-0.75,0,1,4,5,3,9,6,2,8,1,7,4,2,3,1,2,2,2,2,3,-1,-3,2,-1,-1,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,2,2,2,1,2,-2,-2,2,-1,-2,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,2,2,2,2,2,-2,-2,2,-2,-2,1,-2,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0 +R_1MXNBF34DjpKRxM,60 - 66,Canadian,Male,Somewhat disagree,Strongly agree,Agree,Agree,Disagree,2,5,3,4,1,Agree,Somewhat disagree,Somewhat agree,Disagree,Somewhat agree,5,2,4,3,1,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Somewhat Agree,5,4,3,2,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,5,4,2,3,0,Agree,Disagree,Somewhat agree,Disagree,Somewhat agree,2,4,1,3,5,1,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,3,1,4,5,2,0,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,3,5,1,2,4,0,Agree,Disagree,Neither agree nor disagree,Disagree,Neither agree nor disagree,4,5,3,2,1,0,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,2,5,3,4,1,0,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,1,5,4,3,2,0,Agree,Strongly disagree,Somewhat agree,Strongly disagree,Agree,2,5,4,3,1,1,Agree,Agree,Neither Agree nor Disagree,Somewhat Disagree,Agree,5,4,1,3,2,1,Neither agree nor disagree,Strongly agree,Strongly agree,Strongly agree,Neither agree nor disagree,2,4,5,1,3,3,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,1,5,4,2,3,8,Agree,Agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,4,5,1,2,3,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,10 cents,100 minutes,47 days,Male,Trade School (non-military),64,02PsVPf,02FUT,5,01ITEM,0,0.333333333,0.666666667,6,7,2,9,4,5,3,1,8,3,4,2,1,-1,3,2,2,-2,2,-1,1,-2,1,2,2,0,0,1,0,3,3,3,0,2,-2,1,-2,1,2,2,0,0,2,0,3,3,3,0,2,-2,0,-2,0,2,2,0,0,2,0,3,3,3,0,2,-3,1,-3,2,2,2,0,-1,2,0,3,3,3,0,0,0,0,0,1,2,2,0,0,2,0,1,0,0,0,0,0,1,1,3,8,5 +R_5CQuUx5HkIN0nII,39 - 45,American,Female,Disagree,Agree,Strongly agree,Strongly agree,Somewhat disagree,1,5,2,3,4,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,5,1,4,2,3,Agree,Somewhat Agree,Strongly Agree,Somewhat Disagree,Agree,3,5,4,2,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,Disagree,Agree,Strongly agree,Agree,Disagree,3,5,4,2,1,2,Somewhat disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,3,5,4,2,1,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,3,5,1,4,1,Disagree,Agree,Strongly agree,Agree,Disagree,4,1,3,5,2,2,Somewhat agree,Somewhat disagree,Agree,Somewhat disagree,Somewhat disagree,5,2,3,4,1,2,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,1,4,3,5,2,Disagree,Strongly agree,Strongly agree,Strongly agree,Disagree,1,4,5,2,3,2,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,1,5,2,3,4,3,Agree,Somewhat Agree,Agree,Somewhat Disagree,Agree,2,3,1,5,4,2,Disagree,Agree,Strongly agree,Strongly agree,Disagree,3,1,2,5,4,2,Neither agree nor disagree,Somewhat disagree,Agree,Neither agree nor disagree,Somewhat disagree,1,5,2,3,4,3,Agree,Somewhat Agree,Agree,Disagree,Agree,4,1,2,3,5,1,1,1,2,0,0,2,0,10 cents,5 minutes,24 days,Female,High School (or equivalent),45,03VPfPs,01PAST,10,02DGEN,-0.125,0.333333333,0.666666667,9,8,4,2,6,7,5,1,3,3,2,4,1,-2,2,3,3,-1,0,-1,2,0,-1,2,1,3,-1,2,-2,2,3,2,-2,-1,-1,2,0,-1,2,1,2,-1,2,-2,2,3,2,-2,1,-1,2,-1,-1,2,1,2,-1,2,-2,3,3,3,-2,0,-1,2,0,-1,2,1,2,-1,2,-2,2,3,3,-2,0,-1,2,0,-1,2,1,2,-2,2,1,2,2,1,2,2,2,2,3,2,2,3 +R_3fJUFbQyKEBXLdQ,25 - 31,American,Male,Strongly agree,Agree,Strongly agree,Somewhat agree,Strongly agree,5,3,4,1,2,Somewhat agree,Somewhat agree,Agree,Neither agree nor disagree,Strongly agree,5,2,4,3,1,Strongly Agree,Strongly Agree,Strongly Agree,Agree,Agree,5,3,1,2,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,Agree,Agree,Strongly agree,Strongly agree,Strongly agree,4,2,3,1,5,9,Agree,Somewhat agree,Agree,Somewhat agree,Strongly agree,4,1,2,3,5,10,Somewhat Agree,Agree,Agree,Strongly agree,Somewhat Agree,2,1,3,5,4,9,Strongly agree,Agree,Agree,Strongly agree,Agree,4,3,5,1,2,8,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,3,5,1,2,4,9,Agree,Agree,Agree,Agree,Somewhat Agree,5,1,4,3,2,9,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,3,5,2,4,1,10,Agree,Agree,Agree,Agree,Agree,1,3,4,5,2,10,Strongly agree,Strongly agree,Agree,Agree,Agree,4,1,3,2,5,9,Strongly agree,Agree,Agree,Strongly agree,Agree,4,3,5,2,1,10,Strongly agree,Strongly agree,Strongly agree,Agree,Agree,5,1,3,2,4,9,Agree,Agree,Agree,Somewhat Agree,Somewhat Agree,1,4,3,2,5,2,1,1,-2,-2,-1,0,-1,10 cents,100 minutes,24 days,Male,University - Graduate (Masters),30,01PfPsV,01PAST,5,02DGEN,1,0,1,6,2,5,8,4,7,3,1,9,3,4,2,1,3,2,3,1,3,1,1,2,0,3,3,3,3,2,2,2,2,3,3,3,2,1,2,1,3,1,2,2,3,1,3,2,2,3,2,3,3,3,2,2,2,2,2,2,1,3,3,2,2,3,2,2,2,2,2,3,3,2,2,2,3,2,2,3,2,3,3,3,2,2,2,2,2,1,1,10,9,10,9,8,9,9,10,10,9,10,9 +R_7S97YfGsSwUADhy,39 - 45,American,Female,Strongly agree,Somewhat agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,2,3,4,5,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Disagree,4,2,3,1,5,Neither Agree nor Disagree,Disagree,Strongly Agree,Strongly Disagree,Strongly Agree,3,4,5,1,2,Strongly agree,Agree,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,5,3,1,4,2,1,Strongly disagree,Somewhat agree,Neither agree nor disagree,Strongly agree,Neither agree nor disagree,2,3,5,4,1,2,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,3,4,1,5,0,Agree,Agree,Strongly agree,Somewhat agree,Neither agree nor disagree,2,1,5,3,4,2,Strongly disagree,Agree,Somewhat disagree,Strongly agree,Neither agree nor disagree,3,5,4,1,2,3,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,5,3,2,1,4,2,Strongly agree,Somewhat agree,Somewhat agree,Neither agree nor disagree,Neither agree nor disagree,2,4,1,5,3,0,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Agree,Neither agree nor disagree,1,4,3,5,2,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,2,1,3,4,5,0,Strongly agree,Somewhat agree,Strongly agree,Somewhat agree,Neither agree nor disagree,5,4,3,1,2,1,Strongly disagree,Neither agree nor disagree,Neither agree nor disagree,Somewhat agree,Neither agree nor disagree,3,5,2,1,4,1,Neither Agree nor Disagree,Neither Agree nor Disagree,Strongly agree,Strongly Disagree,Strongly agree,3,2,5,4,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,1,1,2,0,10 cents,5 minutes,47 days,Female,University - Undergraduate,42,03VPfPs,02FUT,10,01ITEM,0,0.666666667,0.333333333,4,5,8,2,3,9,6,1,7,3,4,2,1,3,1,3,0,0,-3,1,0,3,-2,0,-2,3,-3,3,3,2,3,0,0,-3,1,0,3,0,0,0,3,-3,3,2,2,3,1,0,-3,2,-1,3,0,0,0,3,-3,3,3,1,1,0,0,-3,0,0,2,0,0,0,3,-3,3,3,1,3,1,0,-3,0,0,1,0,0,0,3,-3,3,1,2,0,2,3,2,0,1,0,1,1,1 +R_71YqcuoCiHrSWy4,25 - 31,American,Male,Strongly agree,Agree,Strongly agree,Strongly agree,Strongly agree,3,1,4,2,5,Agree,Strongly agree,Somewhat agree,Somewhat agree,Somewhat agree,3,1,2,4,5,Somewhat Agree,Agree,Agree,Agree,Somewhat Agree,4,2,3,5,1,Agree,Agree,Strongly agree,Agree,Somewhat agree,2,5,4,1,3,8,Agree,Agree,Agree,Agree,Agree,2,3,5,1,4,8,Agree,Somewhat Agree,Agree,Agree,Agree,2,1,4,5,3,9,Agree,Agree,Agree,Strongly agree,Strongly agree,4,3,1,5,2,9,Agree,Agree,Agree,Agree,Agree,3,2,5,4,1,7,Agree,Agree,Agree,Agree,Agree,1,2,4,3,5,8,Somewhat agree,Agree,Strongly agree,Somewhat agree,Strongly agree,4,3,1,2,5,8,Somewhat agree,Agree,Agree,Agree,Agree,3,5,1,2,4,9,Agree,Agree,Agree,Agree,Agree,5,3,4,1,2,8,Strongly agree,Agree,Agree,Strongly agree,Strongly agree,3,2,4,5,1,8,Somewhat agree,Agree,Agree,Agree,Agree,5,4,3,2,1,8,Agree,Agree,Agree,Agree,Agree,2,5,3,4,1,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1,-2,-2,-2,-1,2,5 cents,100 minutes,47 days,Male,College Diploma/Certificate,30,01PfPsV,01PAST,5,01ITEM,1.5,0.666666667,0.333333333,8,4,2,5,6,3,9,1,7,3,4,2,1,3,2,3,3,3,2,3,1,1,1,1,2,2,2,1,2,2,3,2,1,2,2,2,2,2,2,1,2,2,2,2,2,2,3,3,2,2,2,2,2,2,2,2,2,2,1,2,3,1,3,1,2,2,2,2,2,2,2,2,2,3,2,2,3,3,1,2,2,2,2,2,2,2,2,2,8,8,9,9,7,8,8,9,8,8,8,8 +R_6qX2BXpG1OrXIG8,18 - 24,American,Male,Strongly agree,Strongly agree,Strongly agree,Strongly agree,Agree,3,2,1,5,4,Somewhat disagree,Agree,Somewhat agree,Agree,Somewhat agree,1,2,3,5,4,Somewhat Disagree,Somewhat Agree,Somewhat Agree,Somewhat Agree,Somewhat Disagree,1,2,4,5,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,Strongly agree,Somewhat agree,Agree,Neither agree nor disagree,Neither agree nor disagree,1,3,2,5,4,5,Somewhat agree,Strongly agree,Strongly agree,Agree,Agree,3,5,1,2,4,5,Agree,Somewhat Agree,Neither Agree nor Disagree,Strongly agree,Somewhat Disagree,2,3,4,1,5,6,Somewhat agree,Strongly disagree,Agree,Somewhat disagree,Strongly agree,2,4,5,3,1,10,Somewhat agree,Agree,Strongly agree,Agree,Strongly agree,3,4,1,2,5,10,Strongly agree,Agree,Neither Agree nor Disagree,Agree,Somewhat Agree,1,2,4,5,3,10,Strongly agree,Neither agree nor disagree,Neither agree nor disagree,Disagree,Somewhat agree,1,3,5,4,2,10,Neither agree nor disagree,Agree,Neither agree nor disagree,Somewhat agree,Strongly agree,5,2,4,3,1,8,Somewhat Agree,Strongly Disagree,Somewhat Disagree,Strongly agree,Somewhat Disagree,2,4,5,1,3,9,Somewhat disagree,Neither agree nor disagree,Strongly agree,Agree,Disagree,4,3,1,2,5,5,Strongly agree,Somewhat agree,Agree,Agree,Strongly agree,5,3,2,4,1,5,Somewhat Disagree,Strongly agree,Neither Agree nor Disagree,Neither Agree nor Disagree,Agree,4,1,3,5,2,0,1,2,0,0,-1,-1,0,10 cents,100 minutes,24 days,Male,High School (or equivalent),23,02PsVPf,01PAST,5,02DGEN,0.625,0,1,9,7,5,8,2,3,6,1,4,4,3,2,1,3,3,3,3,2,-1,2,1,2,1,-1,1,1,1,-1,3,1,2,0,0,1,3,3,2,2,2,1,0,3,-1,1,-3,2,-1,3,1,2,3,2,3,3,2,0,2,1,3,0,0,-2,1,0,2,0,1,3,1,-3,-1,3,-1,-1,0,3,2,-2,3,1,2,2,3,-1,3,0,0,2,5,5,5,6,10,10,10,10,8,9,5,5 +R_5IxO3MQCeJTVFPb,18 - 24,American,Female,Strongly agree,Strongly agree,Agree,Strongly agree,Agree,1,4,2,5,3,Somewhat disagree,Somewhat disagree,Somewhat agree,Neither agree nor disagree,Agree,3,1,2,4,5,Disagree,Strongly Disagree,Agree,Somewhat Disagree,Agree,5,1,2,3,4,Strongly agree,Strongly agree,Strongly agree,Disagree,Agree,1,2,5,3,4,4,Disagree,Disagree,Somewhat disagree,Somewhat agree,Somewhat agree,3,2,5,1,4,7,Somewhat Disagree,Strongly Disagree,Somewhat Agree,Somewhat Agree,Strongly agree,4,1,2,5,3,5,Strongly agree,Strongly agree,Somewhat agree,Somewhat disagree,Somewhat disagree,4,3,1,2,5,7,Disagree,Neither agree nor disagree,Somewhat disagree,Somewhat agree,Somewhat agree,4,5,1,3,2,6,Somewhat Disagree,Disagree,Agree,Somewhat Agree,Agree,5,4,1,2,3,6,Strongly agree,Strongly agree,Agree,Agree,Strongly agree,3,2,1,4,5,2,Neither agree nor disagree,Disagree,Agree,Somewhat disagree,Somewhat agree,5,3,2,4,1,4,Disagree,Strongly Disagree,Strongly agree,Somewhat Disagree,Strongly agree,2,5,3,4,1,3,Strongly agree,Strongly agree,Neither agree nor disagree,Agree,Agree,2,5,3,4,1,4,Somewhat agree,Somewhat agree,Strongly agree,Disagree,Somewhat agree,3,4,5,2,1,7,Disagree,Strongly Disagree,Agree,Strongly Disagree,Somewhat Agree,5,1,4,2,3,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,2,2,2,2,2,2,1,10 cents,100 minutes,47 days,Female,College Diploma/Certificate,24,01PfPsV,02FUT,10,01ITEM,-0.125,0.333333333,0.666666667,9,2,7,4,6,5,3,1,8,3,4,2,1,3,3,2,3,2,-1,-1,1,0,2,-2,-3,2,-1,2,3,3,3,-2,2,-2,-2,-1,1,1,-1,-3,1,1,3,3,3,1,-1,-1,-2,0,-1,1,1,-1,-2,2,1,2,3,3,2,2,3,0,-2,2,-1,1,-2,-3,3,-1,3,3,3,0,2,2,1,1,3,-2,1,-2,-3,2,-3,1,4,7,5,7,6,6,2,4,3,4,7,2 diff --git a/eohi2/linearity_plots.pdf b/eohi2/linearity_plots.pdf new file mode 100644 index 0000000..333406e Binary files /dev/null and b/eohi2/linearity_plots.pdf differ diff --git a/eohi2/linearity_plots_domain_general_vars.pdf b/eohi2/linearity_plots_domain_general_vars.pdf new file mode 100644 index 0000000..cd750d4 Binary files /dev/null and b/eohi2/linearity_plots_domain_general_vars.pdf differ diff --git a/eohi2/linearity_plots_domain_vars.pdf b/eohi2/linearity_plots_domain_vars.pdf new file mode 100644 index 0000000..7213a8e Binary files /dev/null and b/eohi2/linearity_plots_domain_vars.pdf differ diff --git a/eohi2/mixed anova - DGEN.r b/eohi2/mixed anova - DGEN.r new file mode 100644 index 0000000..4b40414 --- /dev/null +++ b/eohi2/mixed anova - DGEN.r @@ -0,0 +1,896 @@ +# Mixed ANOVA Analysis for DGEN Variables +# EOHI Experiment 2 Data Analysis - DGEN Level Analysis with TIME, DOMAIN, and INTERVAL factors +# Variables: DGEN_past_5_Pref, DGEN_past_5_Pers, DGEN_past_5_Val, +# DGEN_past_10_Pref, DGEN_past_10_Pers, DGEN_past_10_Val, +# DGEN_fut_5_Pref, DGEN_fut_5_Pers, DGEN_fut_5_Val, +# DGEN_fut_10_Pref, DGEN_fut_10_Pers, DGEN_fut_10_Val, +# X5_10DGEN_past_pref, X5_10DGEN_past_pers, X5_10DGEN_past_val, +# X5_10DGEN_fut_pref, X5_10DGEN_fut_pers, X5_10DGEN_fut_val + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") +cat("anova - dgen", getwd(), "\n") + +# Read the data +data <- read.csv("eohi2.csv") + +# Verify the specific variables we need +required_vars <- c("DGEN_past_5_Pref", "DGEN_past_5_Pers", "DGEN_past_5_Val", + "DGEN_past_10_Pref", "DGEN_past_10_Pers", "DGEN_past_10_Val", + "DGEN_fut_5_Pref", "DGEN_fut_5_Pers", "DGEN_fut_5_Val", + "DGEN_fut_10_Pref", "DGEN_fut_10_Pers", "DGEN_fut_10_Val", + "X5_10DGEN_past_pref", "X5_10DGEN_past_pers", "X5_10DGEN_past_val", + "X5_10DGEN_fut_pref", "X5_10DGEN_fut_pers", "X5_10DGEN_fut_val") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} + +# Define variable mapping for the three within-subjects factors +variable_mapping <- data.frame( + variable = required_vars, + TIME = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + DOMAIN = rep(c("Preferences", "Personality", "Values"), 6), + INTERVAL = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + +print("Variable mapping:") +print(variable_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "DGEN_SCORE" + ) %>% + left_join(variable_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(TIME, levels = c("Past", "Future")), + DOMAIN = factor(DOMAIN, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + pID = as.factor(ResponseId), # Use ResponseId as participant ID + temporal_DO = as.factor(TEMPORAL_DO), + interval_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(pID, ResponseId, temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL, DGEN_SCORE) %>% + filter(!is.na(DGEN_SCORE)) + + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + median = round(median(DGEN_SCORE, na.rm = TRUE), 5), + q1 = round(quantile(DGEN_SCORE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(DGEN_SCORE, 0.75, na.rm = TRUE), 5), + min = round(min(DGEN_SCORE, na.rm = TRUE), 5), + max = round(max(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by TIME, DOMAIN, and INTERVAL:") +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(temporal_DO, interval_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(DGEN_SCORE, na.rm = TRUE), 5), + variance = round(var(DGEN_SCORE, na.rm = TRUE), 5), + sd = round(sd(DGEN_SCORE, na.rm = TRUE), 5), + .groups = 'drop' + ) + +print("Descriptive statistics by between-subjects factors:") +print(desc_stats_by_between) + +# Calculate mean differences for key comparisons +print("\n=== KEY MEAN DIFFERENCES ===") + +# Past vs Future differences for each DOMAIN × INTERVAL combination +past_future_diffs <- long_data %>% + group_by(DOMAIN, INTERVAL, pID) %>% + summarise( + past_score = DGEN_SCORE[TIME == "Past"], + future_score = DGEN_SCORE[TIME == "Future"], + difference = past_score - future_score, + .groups = 'drop' + ) %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("Past vs Future differences by DOMAIN × INTERVAL:") +print(past_future_diffs) + +# 5 vs 10 interval differences for each TIME × DOMAIN combination +interval_diffs <- long_data %>% + group_by(TIME, DOMAIN, pID) %>% + summarise( + interval_5_score = DGEN_SCORE[INTERVAL == "5"], + interval_10_score = DGEN_SCORE[INTERVAL == "10"], + difference = interval_5_score - interval_10_score, + .groups = 'drop' + ) %>% + group_by(TIME, DOMAIN) %>% + summarise( + n = n(), + mean_diff = round(mean(difference, na.rm = TRUE), 5), + sd_diff = round(sd(difference, na.rm = TRUE), 5), + se_diff = round(sd(difference, na.rm = TRUE) / sqrt(n()), 5), + .groups = 'drop' + ) + +print("\n5 vs 10 interval differences by TIME × DOMAIN:") +print(interval_diffs) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$DGEN_SCORE), ] + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(DGEN_SCORE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + +print("Missing values by TIME, DOMAIN, and INTERVAL:") +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(DGEN_SCORE), + sd = sd(DGEN_SCORE), + q1 = quantile(DGEN_SCORE, 0.25), + q3 = quantile(DGEN_SCORE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(DGEN_SCORE < lower_bound | DGEN_SCORE > upper_bound), + .groups = 'drop' + ) + +print("Outlier summary (IQR method):") +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$DGEN_SCORE)$statistic, + ad_p_value = ad.test(.data$DGEN_SCORE)$p.value, + .groups = 'drop' + ) + +print("Anderson-Darling normality test results:") +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance tests +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ TIME)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across TIME within each DOMAIN × INTERVAL:") +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across DOMAIN within each TIME × INTERVAL:") +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(DGEN_SCORE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(DGEN_SCORE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + +print("Homogeneity of variance across INTERVAL within each TIME × DOMAIN:") +print(homogeneity_interval) + +# ============================================================================= +# HARTLEY'S F-MAX TEST WITH BOOTSTRAP CRITICAL VALUES +# ============================================================================= + +# More efficient bootstrap function for Hartley's F-max test +bootstrap_hartley_critical <- function(data, group_var, response_var, n_iter = 1000) { + # Get unique groups and their sample sizes + groups <- unique(data[[group_var]]) + + # Calculate observed variances for each group + observed_vars <- data %>% + dplyr::group_by(!!rlang::sym(group_var)) %>% + dplyr::summarise(var = var(!!rlang::sym(response_var), na.rm = TRUE), .groups = 'drop') %>% + dplyr::pull(var) + + # Handle invalid variances + if(any(observed_vars <= 0 | is.na(observed_vars))) { + observed_vars[observed_vars <= 0 | is.na(observed_vars)] <- 1e-10 + } + + # Calculate observed F-max ratio + observed_ratio <- max(observed_vars) / min(observed_vars) + + # Pre-allocate storage for bootstrap ratios + bootstrap_ratios <- numeric(n_iter) + + # Get group data once + group_data_list <- map(groups, ~ { + group_data <- data[data[[group_var]] == .x, response_var] + group_data[!is.na(group_data)] + }) + + # Bootstrap with pre-allocated storage + for(i in 1:n_iter) { + # Bootstrap sample from each group independently + sample_vars <- map_dbl(group_data_list, ~ { + bootstrap_sample <- sample(.x, size = length(.x), replace = TRUE) + var(bootstrap_sample, na.rm = TRUE) + }) + bootstrap_ratios[i] <- max(sample_vars) / min(sample_vars) + } + + # Remove invalid ratios + valid_ratios <- bootstrap_ratios[is.finite(bootstrap_ratios) & !is.na(bootstrap_ratios)] + + if(length(valid_ratios) == 0) { + stop("No valid bootstrap ratios generated") + } + + # Calculate critical value (95th percentile) + critical_95 <- quantile(valid_ratios, 0.95, na.rm = TRUE) + + # Return only essential information + return(list( + observed_ratio = observed_ratio, + critical_95 = critical_95, + n_valid_iterations = length(valid_ratios) + )) +} + +# Hartley's F-max test across between-subjects factors within each within-subjects combination +print("\n=== HARTLEY'S F-MAX TEST RESULTS ===") +set.seed(123) # For reproducibility + +# Test across temporal_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across temporal_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_temporal_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(temporal_DO, DGEN_SCORE), "temporal_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_temporal_results) + +# Test across interval_DO within each TIME × DOMAIN × INTERVAL combination +print("F-max test across interval_DO within each TIME × DOMAIN × INTERVAL combination:") +hartley_interval_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + hartley_result = list(bootstrap_hartley_critical(pick(interval_DO, DGEN_SCORE), "interval_DO", "DGEN_SCORE")), + .groups = 'drop' + ) %>% + mutate( + observed_ratio = map_dbl(hartley_result, ~ .x$observed_ratio), + critical_95 = map_dbl(hartley_result, ~ .x$critical_95), + significant = observed_ratio > critical_95 + ) %>% + select(TIME, DOMAIN, INTERVAL, observed_ratio, critical_95, significant) + +print(hartley_interval_results) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check if design is balanced +design_balance <- table(long_data_clean$pID, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + +print("=== MIXED ANOVA RESULTS (with sphericity corrections) ===") + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: temporal_DO (2 levels) × interval_DO (2 levels) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = DGEN_SCORE, + wid = pID, + between = .(temporal_DO, interval_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +print("Mauchly's Test of Sphericity:") +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("Greenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + print("=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("=== CORRECTED F-TESTS ===") + corrected_results <- data.frame( + Effect = corrected_df$Effect, + Original_F = anova_table$F[match(corrected_df$Effect, anova_table$Effect)], + Original_DFn = corrected_df$Original_DFn, + Original_DFd = corrected_df$Original_DFd, + GG_DFn = corrected_df$GG_DFn, + GG_DFd = corrected_df$GG_DFd, + HF_DFn = corrected_df$HF_DFn, + HF_DFd = corrected_df$HF_DFd, + GG_p = sphericity_corr$`p[GG]`, + HF_p = sphericity_corr$`p[HF]` + ) + print(corrected_results) +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + +print("=== EFFECT SIZES (GENERALIZED ETA SQUARED) ===") + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +print("=== POST-HOC COMPARISONS ===") + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(DGEN_SCORE ~ temporal_DO * interval_DO * TIME * DOMAIN * INTERVAL + Error(pID/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effects +print("Main Effect of TIME:") +time_emmeans <- emmeans(aov_model, ~ TIME) +print(time_emmeans) +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +print("Main Effect of DOMAIN:") +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) +print(domain_emmeans) +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +print("Main Effect of INTERVAL:") +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) +print(interval_emmeans) +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +print("Main Effect of temporal_DO:") +temporal_emmeans <- emmeans(aov_model, ~ temporal_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +print("Main Effect of interval_DO:") +interval_do_emmeans <- emmeans(aov_model, ~ interval_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# TWO-WAY INTERACTION EXPLORATIONS +# ============================================================================= + +# TIME × DOMAIN Interaction +print("=== TIME × DOMAIN INTERACTION ===") +time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) +print(time_domain_emmeans) +time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") +print(time_domain_simple) +time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(time_domain_simple2) + +# TIME × INTERVAL Interaction +print("=== TIME × INTERVAL INTERACTION ===") +time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) +print(time_interval_emmeans) +time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") +print(time_interval_simple) +time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(time_interval_simple2) + +# DOMAIN × INTERVAL Interaction +print("=== DOMAIN × INTERVAL INTERACTION ===") +domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) +print(domain_interval_emmeans) +domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") +print(domain_interval_simple) +domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") +print(domain_interval_simple2) + +# Between-subjects interactions +print("=== temporal_DO × interval_DO INTERACTION ===") +temporal_interval_do_emmeans <- emmeans(aov_model, ~ temporal_DO * interval_DO) +print(temporal_interval_do_emmeans) +temporal_interval_do_simple <- pairs(temporal_interval_do_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_interval_do_simple) +temporal_interval_do_simple2 <- pairs(temporal_interval_do_emmeans, by = "interval_DO", adjust = "bonferroni") +print(temporal_interval_do_simple2) + +# ============================================================================= +# THREE-WAY INTERACTION ANALYSES +# ============================================================================= + +# TIME × DOMAIN × INTERVAL Interaction +print("=== TIME × DOMAIN × INTERVAL INTERACTION ===") +three_way_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN * INTERVAL) +print(three_way_emmeans) +three_way_contrasts <- pairs(three_way_emmeans, by = c("DOMAIN", "INTERVAL"), adjust = "bonferroni") +print(three_way_contrasts) + +# Between-subjects × within-subjects interactions +print("=== temporal_DO × TIME INTERACTION ===") +temporal_time_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME) +print(temporal_time_emmeans) +temporal_time_simple <- pairs(temporal_time_emmeans, by = "temporal_DO", adjust = "bonferroni") +print(temporal_time_simple) +temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") +print(temporal_time_simple2) + +# temporal_DO × TIME × INTERVAL three-way interaction +print("=== temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_emmeans <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) +print(temporal_time_interval_emmeans) + +# Simple effects of TIME within each temporal_DO × INTERVAL combination +temporal_time_interval_simple1 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of TIME within each temporal_DO × INTERVAL:") +print(temporal_time_interval_simple1) + +# Simple effects of temporal_DO within each TIME × INTERVAL combination +temporal_time_interval_simple2 <- pairs(temporal_time_interval_emmeans, by = c("TIME", "INTERVAL"), adjust = "bonferroni") +print("Simple effects of temporal_DO within each TIME × INTERVAL:") +print(temporal_time_interval_simple2) + +# Simple effects of INTERVAL within each temporal_DO × TIME combination +temporal_time_interval_simple3 <- pairs(temporal_time_interval_emmeans, by = c("temporal_DO", "TIME"), adjust = "bonferroni") +print("Simple effects of INTERVAL within each temporal_DO × TIME:") +print(temporal_time_interval_simple3) + +# ============================================================================= +# COHEN'S D CALCULATIONS FOR SIGNIFICANT EFFECTS +# ============================================================================= + +print("=== COHEN'S D FOR SIGNIFICANT EFFECTS ===") + +# Function to calculate Cohen's d for pairwise comparisons +calculate_cohens_d_for_pairs <- function(pairs_df, data, group1_var, group2_var, response_var) { + significant_pairs <- pairs_df[pairs_df$p.value < 0.05, ] + + if(nrow(significant_pairs) > 0) { + print(significant_pairs) + + # Calculate Cohen's d for all significant pairs + cohens_d_results <- data.frame() + + for(i in seq_len(nrow(significant_pairs))) { + comparison <- significant_pairs[i, ] + contrast_name <- as.character(comparison$contrast) + + # Parse the contrast + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + # Get raw data for both conditions + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + group2_level <- as.character(comparison[[group2_var]]) + data1 <- data[[response_var]][ + data[[group1_var]] == level1 & + data[[group2_var]] == group2_level] + + data2 <- data[[response_var]][ + data[[group1_var]] == level2 & + data[[group2_var]] == group2_level] + } else { + data1 <- data[[response_var]][data[[group1_var]] == level1] + data2 <- data[[response_var]][data[[group1_var]] == level2] + } + + if(length(data1) > 0 && length(data2) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(data1, data2) + + result_row <- data.frame( + Comparison = contrast_name, + n1 = length(data1), + n2 = length(data2), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5) + ) + + if(!is.null(group2_var) && group2_var %in% colnames(comparison)) { + result_row$Group_level <- group2_level + } + + cohens_d_results <- rbind(cohens_d_results, result_row) + } + } + } + + if(nrow(cohens_d_results) > 0) { + print(cohens_d_results) + } + } else { + cat("No significant pairwise comparisons found.\n") + } +} + +# Calculate Cohen's d for main effects +time_contrasts_df <- as.data.frame(time_contrasts) +calculate_cohens_d_for_pairs(time_contrasts_df, long_data_clean, "TIME", NULL, "DGEN_SCORE") + +domain_contrasts_df <- as.data.frame(domain_contrasts) +calculate_cohens_d_for_pairs(domain_contrasts_df, long_data_clean, "DOMAIN", NULL, "DGEN_SCORE") + +interval_contrasts_df <- as.data.frame(interval_contrasts) +calculate_cohens_d_for_pairs(interval_contrasts_df, long_data_clean, "INTERVAL", NULL, "DGEN_SCORE") + +# Calculate Cohen's d for two-way interactions +time_domain_simple_df <- as.data.frame(time_domain_simple) +calculate_cohens_d_for_pairs(time_domain_simple_df, long_data_clean, "DOMAIN", "TIME", "DGEN_SCORE") + +time_domain_simple2_df <- as.data.frame(time_domain_simple2) +calculate_cohens_d_for_pairs(time_domain_simple2_df, long_data_clean, "TIME", "DOMAIN", "DGEN_SCORE") + +# Calculate Cohen's d for temporal_DO × TIME × INTERVAL interaction +print("=== COHEN'S D FOR temporal_DO × TIME × INTERVAL INTERACTION ===") +temporal_time_interval_simple1_df <- as.data.frame(temporal_time_interval_simple1) +significant_temporal_time_interval <- temporal_time_interval_simple1_df[temporal_time_interval_simple1_df$p.value < 0.05, ] + +if(nrow(significant_temporal_time_interval) > 0) { + temporal_time_interval_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_temporal_time_interval))) { + comparison <- significant_temporal_time_interval[i, ] + + # Extract the grouping variables + temporal_level <- as.character(comparison$temporal_DO) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this temporal_DO × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$temporal_DO == temporal_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + temporal_DO = temporal_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + temporal_time_interval_cohens_d <- rbind(temporal_time_interval_cohens_d, result_row) + } + } + + if(nrow(temporal_time_interval_cohens_d) > 0) { + print(temporal_time_interval_cohens_d) + } +} else { + cat("No significant TIME effects found within any temporal_DO × INTERVAL combination.\n") +} + +# Calculate Cohen's d for three-way interaction +three_way_contrasts_df <- as.data.frame(three_way_contrasts) +significant_three_way <- three_way_contrasts_df[three_way_contrasts_df$p.value < 0.05, ] + +if(nrow(significant_three_way) > 0) { + three_way_cohens_d <- data.frame() + + for(i in seq_len(nrow(significant_three_way))) { + comparison <- significant_three_way[i, ] + + # Extract the grouping variables + domain_level <- as.character(comparison$DOMAIN) + interval_level <- as.character(comparison$INTERVAL) + + # Get data for Past and Future within this DOMAIN × INTERVAL combination + past_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$DGEN_SCORE[ + long_data_clean$DOMAIN == domain_level & + long_data_clean$INTERVAL == interval_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + result_row <- data.frame( + DOMAIN = domain_level, + INTERVAL = interval_level, + Comparison = "Past vs Future", + n_Past = length(past_data), + n_Future = length(future_data), + Cohens_d = round(cohens_d_result$estimate, 5), + Effect_size = cohens_d_result$magnitude, + p_value = round(comparison$p.value, 5), + Estimated_difference = round(comparison$estimate, 5) + ) + + three_way_cohens_d <- rbind(three_way_cohens_d, result_row) + } + } + + if(nrow(three_way_cohens_d) > 0) { + print(three_way_cohens_d) + } +} else { + cat("No significant TIME effects found within any DOMAIN × INTERVAL combination.\n") +} + +# ============================================================================= +# COLOR PALETTE FOR PLOTS +# ============================================================================= + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# ============================================================================= +# INTERACTION PLOT: temporal_DO × TIME × INTERVAL (temporal_DO on x-axis, TIME in legend, INTERVAL as facets) +# ============================================================================= + +# Create emmeans for temporal_DO × TIME × INTERVAL +emm_temporal_time_interval_plot <- emmeans(aov_model, ~ temporal_DO * TIME * INTERVAL) + +# Prepare emmeans data frame for the plot +emmeans_temporal_time_interval_plot <- emm_temporal_time_interval_plot %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + temporal_DO = factor(temporal_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL, levels = c("5", "10", "5_10")), + x_pos = as.numeric(temporal_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create temporal_DO × TIME × INTERVAL interaction plot with facets +interaction_plot_temporal_time_interval <- ggplot(emmeans_temporal_time_interval_plot) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "temporal_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_temporal_time_interval) + +# (Two-way interaction plots removed as requested) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Estimated Marginal Means only) +# ============================================================================= + +# Create emmeans for TIME main effect +emm_time_main <- emmeans(aov_model, ~ TIME) + +# Prepare emmeans data frame +emmeans_time_main <- emm_time_main %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Plot TIME main effect (only emmeans + error bars) +plot_time_main_effect <- ggplot(emmeans_time_main) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.9 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Temporal Direction", + y = "Absolute difference from the present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(plot_time_main_effect) \ No newline at end of file diff --git a/eohi2/mixed anova - domain means.r b/eohi2/mixed anova - domain means.r new file mode 100644 index 0000000..91f7c4a --- /dev/null +++ b/eohi2/mixed anova - domain means.r @@ -0,0 +1,927 @@ +# Mixed ANOVA Analysis for Domain Means - EOHI2 +# EOHI Experiment Data Analysis - Domain Level Analysis with INTERVAL factor +# Variables: NPast_5_pref_MEAN, NPast_5_pers_MEAN, NPast_5_val_MEAN, etc. +# NFut_5_pref_MEAN, NFut_5_pers_MEAN, NFut_5_val_MEAN, etc. +# NPast_10_pref_MEAN, NPast_10_pers_MEAN, NPast_10_val_MEAN, etc. +# NFut_10_pref_MEAN, NFut_10_pers_MEAN, NFut_10_val_MEAN, etc. +# 5.10past_pref_MEAN, 5.10past_pers_MEAN, 5.10past_val_MEAN +# 5.10fut_pref_MEAN, 5.10fut_pers_MEAN, 5.10fut_val_MEAN + +# Load required libraries +library(tidyverse) +library(ez) +library(car) +library(afex) # For aov_ez (cleaner ANOVA output) +library(nortest) # For normality tests +library(emmeans) # For post-hoc comparisons +library(purrr) # For map functions +library(effsize) # For Cohen's d calculations +library(effectsize) # For effect size calculations + +# Global options to remove scientific notation +options(scipen = 999) + +# Set contrasts to sum for mixed ANOVA (necessary for proper interpretation) +options(contrasts = c("contr.sum", "contr.poly")) + +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +# Read the data +data <- read.csv("eohi2.csv") + +# Display basic information about the dataset +print(paste("Dataset dimensions:", paste(dim(data), collapse = " x"))) +print(paste("Number of participants:", length(unique(data$ResponseId)))) + +# Verify the specific variables we need +required_vars <- c("NPast_5_pref_MEAN", "NPast_5_pers_MEAN", "NPast_5_val_MEAN", + "NPast_10_pref_MEAN", "NPast_10_pers_MEAN", "NPast_10_val_MEAN", + "NFut_5_pref_MEAN", "NFut_5_pers_MEAN", "NFut_5_val_MEAN", + "NFut_10_pref_MEAN", "NFut_10_pers_MEAN", "NFut_10_val_MEAN", + "X5.10past_pref_MEAN", "X5.10past_pers_MEAN", "X5.10past_val_MEAN", + "X5.10fut_pref_MEAN", "X5.10fut_pers_MEAN", "X5.10fut_val_MEAN") + +missing_vars <- required_vars[!required_vars %in% colnames(data)] +if (length(missing_vars) > 0) { + print(paste("Warning: Missing variables:", paste(missing_vars, collapse = ", "))) +} else { + print("All required domain mean variables found!") +} + +# Define domain mapping with TIME, DOMAIN, and INTERVAL factors +domain_mapping <- data.frame( + variable = required_vars, + time = c(rep("Past", 3), rep("Past", 3), rep("Future", 3), rep("Future", 3), + rep("Past", 3), rep("Future", 3)), + domain = rep(c("Preferences", "Personality", "Values"), 6), + interval = c(rep("5", 3), rep("10", 3), rep("5", 3), rep("10", 3), + rep("5_10", 3), rep("5_10", 3)), + stringsAsFactors = FALSE +) + + +print(domain_mapping) + +# Efficient data pivoting using pivot_longer +long_data <- data %>% + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, all_of(required_vars)) %>% + pivot_longer( + cols = all_of(required_vars), + names_to = "variable", + values_to = "MEAN_DIFFERENCE" + ) %>% + left_join(domain_mapping, by = "variable") %>% + # Convert to factors with proper levels + mutate( + TIME = factor(time, levels = c("Past", "Future")), + DOMAIN = factor(domain, levels = c("Preferences", "Personality", "Values")), + INTERVAL = factor(interval, levels = c("5", "10", "5_10")), + ResponseId = as.factor(ResponseId), + TEMPORAL_DO = as.factor(TEMPORAL_DO), + INTERVAL_DO = as.factor(INTERVAL_DO) + ) %>% + # Select final columns and remove any rows with missing values + select(ResponseId, TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL, MEAN_DIFFERENCE) %>% + filter(!is.na(MEAN_DIFFERENCE)) + +print(paste("Long data dimensions:", paste(dim(long_data), collapse = " x"))) +print(paste("Number of participants:", length(unique(long_data$ResponseId)))) + +# ============================================================================= +# DESCRIPTIVE STATISTICS +# ============================================================================= + +# Overall descriptive statistics by TIME, DOMAIN, and INTERVAL +desc_stats <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + median = round(median(MEAN_DIFFERENCE, na.rm = TRUE), 5), + q1 = round(quantile(MEAN_DIFFERENCE, 0.25, na.rm = TRUE), 5), + q3 = round(quantile(MEAN_DIFFERENCE, 0.75, na.rm = TRUE), 5), + min = round(min(MEAN_DIFFERENCE, na.rm = TRUE), 5), + max = round(max(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats) + +# Descriptive statistics by between-subjects factors +desc_stats_by_between <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO, TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_by_between) + +# Summary by between-subjects factors only +desc_stats_between_only <- long_data %>% + group_by(TEMPORAL_DO, INTERVAL_DO) %>% + summarise( + n = n(), + mean = round(mean(MEAN_DIFFERENCE, na.rm = TRUE), 5), + variance = round(var(MEAN_DIFFERENCE, na.rm = TRUE), 5), + sd = round(sd(MEAN_DIFFERENCE, na.rm = TRUE), 5), + .groups = 'drop' + ) + + +print(desc_stats_between_only) + +# ============================================================================= +# ASSUMPTION TESTING +# ============================================================================= + +# Remove missing values for assumption testing +long_data_clean <- long_data[!is.na(long_data$MEAN_DIFFERENCE), ] +print(paste("Data after removing missing values:", paste(dim(long_data_clean), collapse = " x"))) + +# 1. Missing values check +missing_summary <- long_data %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n_total = n(), + n_missing = sum(is.na(MEAN_DIFFERENCE)), + pct_missing = round(100 * n_missing / n_total, 2), + .groups = 'drop' + ) + + +print(missing_summary) + +# 2. Outlier detection +outlier_summary <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + mean = mean(MEAN_DIFFERENCE), + sd = sd(MEAN_DIFFERENCE), + q1 = quantile(MEAN_DIFFERENCE, 0.25), + q3 = quantile(MEAN_DIFFERENCE, 0.75), + iqr = q3 - q1, + lower_bound = q1 - 1.5 * iqr, + upper_bound = q3 + 1.5 * iqr, + n_outliers = sum(MEAN_DIFFERENCE < lower_bound | MEAN_DIFFERENCE > upper_bound), + .groups = 'drop' + ) + + +print(outlier_summary) + +# 3. Anderson-Darling normality test +normality_results <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + n = n(), + ad_statistic = ad.test(.data$MEAN_DIFFERENCE)$statistic, + ad_p_value = ad.test(.data$MEAN_DIFFERENCE)$p.value, + .groups = 'drop' + ) + + +# Round only the numeric columns +normality_results_rounded <- normality_results %>% + mutate(across(where(is.numeric), ~ round(.x, 5))) +print(normality_results_rounded) + +# 4. Homogeneity of variance (Levene's test) +# Test homogeneity across TIME within each DOMAIN × INTERVAL combination +homogeneity_time <- long_data_clean %>% + group_by(DOMAIN, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ TIME)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ TIME)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_time) + +# Test homogeneity across DOMAIN within each TIME × INTERVAL combination +homogeneity_domain <- long_data_clean %>% + group_by(TIME, INTERVAL) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ DOMAIN)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_domain) + +# Test homogeneity across INTERVAL within each TIME × DOMAIN combination +homogeneity_interval <- long_data_clean %>% + group_by(TIME, DOMAIN) %>% + summarise( + levene_F = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`F value`[1], + levene_p = leveneTest(MEAN_DIFFERENCE ~ INTERVAL)$`Pr(>F)`[1], + .groups = 'drop' + ) + + +print(homogeneity_interval) + +# 5. Hartley's F-max test for between-subjects factors + + +# Check what values the between-subjects factors actually have + +print(unique(long_data_clean$TEMPORAL_DO)) + +print(unique(long_data_clean$INTERVAL_DO)) + +# Function to calculate Hartley's F-max ratio +calculate_hartley_ratio <- function(variances) { + max(variances, na.rm = TRUE) / min(variances, na.rm = TRUE) +} + +# Hartley's F-max test across TEMPORAL_DO within each TIME × DOMAIN × INTERVAL combination + + +observed_temporal_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, INTERVAL) %>% + summarise( + # Calculate variances for each TEMPORAL_DO level within this combination + past_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "01PAST"], na.rm = TRUE), + fut_var = var(MEAN_DIFFERENCE[TEMPORAL_DO == "02FUT"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(past_var, fut_var) / min(past_var, fut_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, INTERVAL, past_var, fut_var, f_max_ratio) + +print(observed_temporal_ratios) + +# Hartley's F-max test across INTERVAL_DO within each TIME × DOMAIN × TEMPORAL_DO combination + + +observed_interval_ratios <- long_data_clean %>% + group_by(TIME, DOMAIN, TEMPORAL_DO) %>% + summarise( + # Calculate variances for each INTERVAL_DO level within this combination + int5_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "5"], na.rm = TRUE), + int10_var = var(MEAN_DIFFERENCE[INTERVAL_DO == "10"], na.rm = TRUE), + # Calculate F-max ratio + f_max_ratio = max(int5_var, int10_var) / min(int5_var, int10_var), + .groups = 'drop' + ) %>% + select(TIME, DOMAIN, TEMPORAL_DO, int5_var, int10_var, f_max_ratio) + +print(observed_interval_ratios) + +# ============================================================================= +# MIXED ANOVA ANALYSIS +# ============================================================================= + +# Check data dimensions and structure +print(paste("Data size for ANOVA:", nrow(long_data_clean), "rows")) +print(paste("Number of participants:", length(unique(long_data_clean$ResponseId)))) +print(paste("Design factors: TIME (", length(levels(long_data_clean$TIME)), "), DOMAIN (", + length(levels(long_data_clean$DOMAIN)), "), INTERVAL (", + length(levels(long_data_clean$INTERVAL)), "), TEMPORAL_DO (", + length(levels(long_data_clean$TEMPORAL_DO)), "), INTERVAL_DO (", + length(levels(long_data_clean$INTERVAL_DO)), ")", sep = "")) + +# Check for complete cases +complete_cases <- sum(complete.cases(long_data_clean)) +print(paste("Complete cases:", complete_cases, "out of", nrow(long_data_clean))) + +# Check if design is balanced +design_balance <- table(long_data_clean$ResponseId, long_data_clean$TIME, long_data_clean$DOMAIN, long_data_clean$INTERVAL) +if(all(design_balance %in% c(0, 1))) { + print("Design is balanced: each participant has data for all TIME × DOMAIN × INTERVAL combinations") +} else { + print("Warning: Design is unbalanced") + print(summary(as.vector(design_balance))) +} + +# ============================================================================= +# MIXED ANOVA WITH SPHERICITY CORRECTIONS +# ============================================================================= + + + +# Mixed ANOVA using ezANOVA with automatic sphericity corrections +# Between-subjects: TEMPORAL_DO (2 levels: 01PAST, 02FUT) × INTERVAL_DO (2 levels: 5, 10) +# Within-subjects: TIME (2 levels: Past, Future) × DOMAIN (3 levels: Preferences, Personality, Values) × INTERVAL (3 levels: 5, 10, 5_10) + +mixed_anova_model <- ezANOVA(data = long_data_clean, + dv = MEAN_DIFFERENCE, + wid = ResponseId, + between = .(TEMPORAL_DO, INTERVAL_DO), + within = .(TIME, DOMAIN, INTERVAL), + type = 3, + detailed = TRUE) + + +anova_output <- mixed_anova_model$ANOVA +rownames(anova_output) <- NULL # Reset row numbers to be sequential +print(anova_output) + +# Show Mauchly's test for sphericity + +print(mixed_anova_model$Mauchly) + +# Show sphericity-corrected results (Greenhouse-Geisser and Huynh-Feldt) +if(!is.null(mixed_anova_model$`Sphericity Corrections`)) { + print("\nGreenhouse-Geisser and Huynh-Feldt Corrections:") + print(mixed_anova_model$`Sphericity Corrections`) + + # Extract and display corrected degrees of freedom + print("\n=== CORRECTED DEGREES OF FREEDOM ===") + + sphericity_corr <- mixed_anova_model$`Sphericity Corrections` + anova_table <- mixed_anova_model$ANOVA + + corrected_df <- data.frame( + Effect = sphericity_corr$Effect, + Original_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)], + Original_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)], + GG_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + GG_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$GGe, + HF_DFn = anova_table$DFn[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + HF_DFd = anova_table$DFd[match(sphericity_corr$Effect, anova_table$Effect)] * sphericity_corr$HFe, + GG_epsilon = sphericity_corr$GGe, + HF_epsilon = sphericity_corr$HFe + ) + + print(corrected_df) + + print("\n=== CORRECTED F-TESTS ===") + + # Between-subjects effects (no sphericity corrections needed) + print("\nBETWEEN-SUBJECTS EFFECTS:") + between_effects <- c("TEMPORAL_DO", "INTERVAL_DO", "TEMPORAL_DO:INTERVAL_DO") + for(effect in between_effects) { + if(effect %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == effect] + dfn <- anova_table$DFn[anova_table$Effect == effect] + dfd <- anova_table$DFd[anova_table$Effect == effect] + p_value <- anova_table$p[anova_table$Effect == effect] + + print(sprintf("%s: F(%d, %d) = %.3f, p = %.6f", effect, dfn, dfd, f_value, p_value)) + } + } + + # Within-subjects effects (sphericity corrections where applicable) + print("\nWITHIN-SUBJECTS EFFECTS:") + + # TIME main effect (2 levels, sphericity automatically satisfied) + if("TIME" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "TIME"] + dfn <- anova_table$DFn[anova_table$Effect == "TIME"] + dfd <- anova_table$DFd[anova_table$Effect == "TIME"] + p_value <- anova_table$p[anova_table$Effect == "TIME"] + print(sprintf("TIME: F(%d, %d) = %.3f, p = %.6f (2 levels, sphericity satisfied)", dfn, dfd, f_value, p_value)) + } + + # DOMAIN main effect (3 levels, needs sphericity correction) + if("DOMAIN" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "DOMAIN"] + dfn <- anova_table$DFn[anova_table$Effect == "DOMAIN"] + dfd <- anova_table$DFd[anova_table$Effect == "DOMAIN"] + p_value <- anova_table$p[anova_table$Effect == "DOMAIN"] + print(sprintf("DOMAIN: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # INTERVAL main effect (3 levels, needs sphericity correction) + if("INTERVAL" %in% anova_table$Effect) { + f_value <- anova_table$F[anova_table$Effect == "INTERVAL"] + dfn <- anova_table$DFn[anova_table$Effect == "INTERVAL"] + dfd <- anova_table$DFd[anova_table$Effect == "INTERVAL"] + p_value <- anova_table$p[anova_table$Effect == "INTERVAL"] + print(sprintf("INTERVAL: F(%d, %d) = %.3f, p = %.6f", dfn, dfd, f_value, p_value)) + } + + # Interactions with sphericity corrections + print("\nINTERACTIONS WITH SPHERICITY CORRECTIONS:") + for(i in seq_len(nrow(corrected_df))) { + effect <- corrected_df$Effect[i] + f_value <- anova_table$F[match(effect, anova_table$Effect)] + + print(sprintf("\n%s:", effect)) + print(sprintf(" Original: F(%d, %d) = %.3f", + corrected_df$Original_DFn[i], corrected_df$Original_DFd[i], f_value)) + print(sprintf(" GG-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$GG_DFn[i], corrected_df$GG_DFd[i], f_value, sphericity_corr$`p[GG]`[i])) + print(sprintf(" HF-corrected: F(%.2f, %.2f) = %.3f, p = %.6f", + corrected_df$HF_DFn[i], corrected_df$HF_DFd[i], f_value, sphericity_corr$`p[HF]`[i])) + } +} else { + print("\nNote: Sphericity corrections not needed (sphericity assumption met)") +} + +# ============================================================================= +# EFFECT SIZES (GENERALIZED ETA SQUARED) +# ============================================================================= + + + +# Extract generalized eta squared from ezANOVA (already calculated) +effect_sizes <- mixed_anova_model$ANOVA[, c("Effect", "ges")] +effect_sizes$ges <- round(effect_sizes$ges, 5) + +print(effect_sizes) + +# ============================================================================= +# POST-HOC COMPARISONS +# ============================================================================= + +# Post-hoc comparisons using emmeans + + +# Create aov model for emmeans (emmeans requires aov object, not ezANOVA output) +aov_model <- aov(MEAN_DIFFERENCE ~ TEMPORAL_DO * INTERVAL_DO * TIME * DOMAIN * INTERVAL + Error(ResponseId/(TIME * DOMAIN * INTERVAL)), + data = long_data_clean) + +# Main effect of TIME + +time_emmeans <- emmeans(aov_model, ~ TIME) + +print(time_emmeans) + +time_contrasts <- pairs(time_emmeans, adjust = "bonferroni") +print(time_contrasts) + +# Main effect of DOMAIN + +domain_emmeans <- emmeans(aov_model, ~ DOMAIN) + +print(domain_emmeans) + +domain_contrasts <- pairs(domain_emmeans, adjust = "bonferroni") +print(domain_contrasts) + +# Main effect of INTERVAL + +interval_emmeans <- emmeans(aov_model, ~ INTERVAL) + +print(interval_emmeans) + +interval_contrasts <- pairs(interval_emmeans, adjust = "bonferroni") +print(interval_contrasts) + +# Main effect of TEMPORAL_DO + +temporal_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO) +temporal_contrasts <- pairs(temporal_emmeans, adjust = "bonferroni") +print(temporal_contrasts) + +# Main effect of INTERVAL_DO + +interval_do_emmeans <- emmeans(aov_model, ~ INTERVAL_DO) +interval_do_contrasts <- pairs(interval_do_emmeans, adjust = "bonferroni") +print(interval_do_contrasts) + +# ============================================================================= +# COHEN'S D FOR MAIN EFFECTS +# ============================================================================= + + + +# Main Effect of TIME (if significant) + +time_main_contrast <- pairs(time_emmeans, adjust = "none") +time_main_df <- as.data.frame(time_main_contrast) + +print(time_main_df) + +# Calculate Cohen's d for TIME main effect +if(nrow(time_main_df) > 0) { + print("\nCohen's d for TIME main effect:") + time_past_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Past"] + time_future_data <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$TIME == "Future"] + + time_cohens_d <- cohen.d(time_past_data, time_future_data) + print(sprintf("Past vs Future: n1 = %d, n2 = %d", length(time_past_data), length(time_future_data))) + print(sprintf("Cohen's d: %.5f", time_cohens_d$estimate)) + print(sprintf("Effect size interpretation: %s", time_cohens_d$magnitude)) + print(sprintf("p-value: %.5f", time_main_df$p.value[1])) +} + +# Main Effect of DOMAIN (if significant) + +domain_main_contrast <- pairs(domain_emmeans, adjust = "bonferroni") +domain_main_df <- as.data.frame(domain_main_contrast) + +print(domain_main_df) + +# Calculate Cohen's d for significant DOMAIN contrasts +significant_domain <- domain_main_df[domain_main_df$p.value < 0.05, ] +if(nrow(significant_domain) > 0) { + print("\nCohen's d for significant DOMAIN contrasts:") + for(i in seq_len(nrow(significant_domain))) { + contrast_name <- as.character(significant_domain$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$DOMAIN == level2] + + if(length(data1) > 0 && length(data2) > 0) { + domain_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", domain_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", domain_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_domain$p.value[i])) + print("") + } + } + } +} + +# Main Effect of INTERVAL (if significant) + +interval_main_contrast <- pairs(interval_emmeans, adjust = "bonferroni") +interval_main_df <- as.data.frame(interval_main_contrast) + +print(interval_main_df) + +# Calculate Cohen's d for significant INTERVAL contrasts +significant_interval <- interval_main_df[interval_main_df$p.value < 0.05, ] +if(nrow(significant_interval) > 0) { + print("\nCohen's d for significant INTERVAL contrasts:") + for(i in seq_len(nrow(significant_interval))) { + contrast_name <- as.character(significant_interval$contrast[i]) + contrast_parts <- strsplit(contrast_name, " - ")[[1]] + if(length(contrast_parts) == 2) { + level1 <- trimws(contrast_parts[1]) + level2 <- trimws(contrast_parts[2]) + + data1 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level1] + data2 <- long_data_clean$MEAN_DIFFERENCE[long_data_clean$INTERVAL == level2] + + if(length(data1) > 0 && length(data2) > 0) { + interval_cohens_d <- cohen.d(data1, data2) + print(sprintf("Comparison: %s", contrast_name)) + print(sprintf(" n1 = %d, n2 = %d", length(data1), length(data2))) + print(sprintf(" Cohen's d: %.5f", interval_cohens_d$estimate)) + print(sprintf(" Effect size interpretation: %s", interval_cohens_d$magnitude)) + print(sprintf(" p-value: %.5f", significant_interval$p.value[i])) + print("") + } + } + } +} + +# ============================================================================= +# INTERACTION EXPLORATIONS (if significant) +# ============================================================================= + + + +# First, identify which interactions are significant +significant_interactions <- anova_output[anova_output$p < 0.05 & grepl(":", anova_output$Effect), ] + +if(nrow(significant_interactions) > 0) { + print("Significant interactions found:") + print(significant_interactions[, c("Effect", "p")]) + + # TIME × DOMAIN interaction (if significant) + if("TIME:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:DOMAIN"] < 0.05) { + print("\n=== TIME × DOMAIN INTERACTION (SIGNIFICANT) ===") + time_domain_emmeans <- emmeans(aov_model, ~ TIME * DOMAIN) + print("Estimated Marginal Means:") + print(time_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TIME:") + time_domain_simple <- pairs(time_domain_emmeans, by = "TIME", adjust = "bonferroni") + print(time_domain_simple) + + print("\nSimple Effects of TIME within each DOMAIN:") + time_domain_simple2 <- pairs(time_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(time_domain_simple2) + } + + # TIME × INTERVAL interaction (if significant) + if("TIME:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TIME:INTERVAL"] < 0.05) { + print("\n=== TIME × INTERVAL INTERACTION (SIGNIFICANT) ===") + time_interval_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL) + print("Estimated Marginal Means:") + print(time_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TIME:") + time_interval_simple <- pairs(time_interval_emmeans, by = "TIME", adjust = "bonferroni") + print(time_interval_simple) + + print("\nSimple Effects of TIME within each INTERVAL:") + time_interval_simple2 <- pairs(time_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(time_interval_simple2) + } + + # DOMAIN × INTERVAL interaction (if significant) + if("DOMAIN:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "DOMAIN:INTERVAL"] < 0.05) { + print("\n=== DOMAIN × INTERVAL INTERACTION (SIGNIFICANT) ===") + domain_interval_emmeans <- emmeans(aov_model, ~ DOMAIN * INTERVAL) + print("Estimated Marginal Means:") + print(domain_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each DOMAIN:") + domain_interval_simple <- pairs(domain_interval_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(domain_interval_simple) + + print("\nSimple Effects of DOMAIN within each INTERVAL:") + domain_interval_simple2 <- pairs(domain_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(domain_interval_simple2) + } + + # TEMPORAL_DO × TIME interaction (if significant) + if("TEMPORAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:TIME"] < 0.05) { + print("\n=== TEMPORAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + temporal_time_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * TIME) + print("Estimated Marginal Means:") + print(temporal_time_emmeans) + + print("\nSimple Effects of TIME within each TEMPORAL_DO:") + temporal_time_simple <- pairs(temporal_time_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_time_simple) + + print("\nSimple Effects of TEMPORAL_DO within each TIME:") + temporal_time_simple2 <- pairs(temporal_time_emmeans, by = "TIME", adjust = "bonferroni") + print(temporal_time_simple2) + } + + # TEMPORAL_DO × DOMAIN interaction (if significant) + if("TEMPORAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:DOMAIN"] < 0.05) { + print("\n=== TEMPORAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + temporal_domain_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(temporal_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each TEMPORAL_DO:") + temporal_domain_simple <- pairs(temporal_domain_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_domain_simple) + + print("\nSimple Effects of TEMPORAL_DO within each DOMAIN:") + temporal_domain_simple2 <- pairs(temporal_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(temporal_domain_simple2) + } + + # TEMPORAL_DO × INTERVAL interaction (if significant) + if("TEMPORAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "TEMPORAL_DO:INTERVAL"] < 0.05) { + print("\n=== TEMPORAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + temporal_interval_emmeans <- emmeans(aov_model, ~ TEMPORAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(temporal_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each TEMPORAL_DO:") + temporal_interval_simple <- pairs(temporal_interval_emmeans, by = "TEMPORAL_DO", adjust = "bonferroni") + print(temporal_interval_simple) + + print("\nSimple Effects of TEMPORAL_DO within each INTERVAL:") + temporal_interval_simple2 <- pairs(temporal_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(temporal_interval_simple2) + } + + # INTERVAL_DO × TIME interaction (if significant) + if("INTERVAL_DO:TIME" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:TIME"] < 0.05) { + print("\n=== INTERVAL_DO × TIME INTERACTION (SIGNIFICANT) ===") + interval_do_time_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * TIME) + print("Estimated Marginal Means:") + print(interval_do_time_emmeans) + + print("\nSimple Effects of TIME within each INTERVAL_DO:") + interval_do_time_simple <- pairs(interval_do_time_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_time_simple) + + print("\nSimple Effects of INTERVAL_DO within each TIME:") + interval_do_time_simple2 <- pairs(interval_do_time_emmeans, by = "TIME", adjust = "bonferroni") + print(interval_do_time_simple2) + } + + # INTERVAL_DO × DOMAIN interaction (if significant) + if("INTERVAL_DO:DOMAIN" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:DOMAIN"] < 0.05) { + print("\n=== INTERVAL_DO × DOMAIN INTERACTION (SIGNIFICANT) ===") + interval_do_domain_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * DOMAIN) + print("Estimated Marginal Means:") + print(interval_do_domain_emmeans) + + print("\nSimple Effects of DOMAIN within each INTERVAL_DO:") + interval_do_domain_simple <- pairs(interval_do_domain_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_domain_simple) + + print("\nSimple Effects of INTERVAL_DO within each DOMAIN:") + interval_do_domain_simple2 <- pairs(interval_do_domain_emmeans, by = "DOMAIN", adjust = "bonferroni") + print(interval_do_domain_simple2) + } + + # INTERVAL_DO × INTERVAL interaction (if significant) + if("INTERVAL_DO:INTERVAL" %in% anova_output$Effect && anova_output$p[anova_output$Effect == "INTERVAL_DO:INTERVAL"] < 0.05) { + print("\n=== INTERVAL_DO × INTERVAL INTERACTION (SIGNIFICANT) ===") + interval_do_interval_emmeans <- emmeans(aov_model, ~ INTERVAL_DO * INTERVAL) + print("Estimated Marginal Means:") + print(interval_do_interval_emmeans) + + print("\nSimple Effects of INTERVAL within each INTERVAL_DO:") + interval_do_interval_simple <- pairs(interval_do_interval_emmeans, by = "INTERVAL_DO", adjust = "bonferroni") + print(interval_do_interval_simple) + + print("\nSimple Effects of INTERVAL_DO within each INTERVAL:") + interval_do_interval_simple2 <- pairs(interval_do_interval_emmeans, by = "INTERVAL", adjust = "bonferroni") + print(interval_do_interval_simple2) + } + + # THREE-WAY INTERACTION: TIME × INTERVAL × TEMPORAL_DO + print("\n=== TIME × INTERVAL × TEMPORAL_DO THREE-WAY INTERACTION ===") + three_way_emmeans <- emmeans(aov_model, ~ TIME * INTERVAL * TEMPORAL_DO) + print("Estimated Marginal Means:") + print(three_way_emmeans) + + print("\nPast vs Future contrasts within each INTERVAL × TEMPORAL_DO combination:") + three_way_contrasts <- pairs(three_way_emmeans, by = c("INTERVAL", "TEMPORAL_DO"), adjust = "bonferroni") + print(three_way_contrasts) + + # Calculate Cohen's d for Past vs Future contrasts + three_way_contrasts_df <- as.data.frame(three_way_contrasts) + + print("\n=== COHEN'S D FOR TIME CONTRASTS IN THREE-WAY INTERACTION ===") + print("Past vs Future contrasts for all INTERVAL × TEMPORAL_DO combinations:") + + for(i in seq_len(nrow(three_way_contrasts_df))) { + comparison <- three_way_contrasts_df[i, ] + + # Extract the grouping variables + interval_level <- as.character(comparison$INTERVAL) + temporal_do_level <- as.character(comparison$TEMPORAL_DO) + + # Get data for Past and Future within this INTERVAL × TEMPORAL_DO combination + past_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Past" + ] + + future_data <- long_data_clean$MEAN_DIFFERENCE[ + long_data_clean$INTERVAL == interval_level & + long_data_clean$TEMPORAL_DO == temporal_do_level & + long_data_clean$TIME == "Future" + ] + + if(length(past_data) > 0 && length(future_data) > 0) { + # Calculate Cohen's d using effsize package + cohens_d_result <- cohen.d(past_data, future_data) + + cat(sprintf("INTERVAL = %s, TEMPORAL_DO = %s:\n", interval_level, temporal_do_level)) + cat(sprintf(" Past vs Future comparison\n")) + cat(sprintf(" n_Past = %d, n_Future = %d\n", length(past_data), length(future_data))) + cat(sprintf(" Cohen's d: %.5f\n", cohens_d_result$estimate)) + cat(sprintf(" Effect size interpretation: %s\n", cohens_d_result$magnitude)) + cat(sprintf(" p-value: %.5f\n", comparison$p.value)) + cat(sprintf(" Estimated difference: %.5f\n", comparison$estimate)) + cat("\n") + } + } + +} else { + print("No significant interactions found.") + print("All interaction p-values:") + interaction_effects <- anova_output[grepl(":", anova_output$Effect), ] + print(interaction_effects[, c("Effect", "p")]) +} + + + +# ============================================================================= +# INTERACTION PLOT: TEMPORAL_DO × TIME × INTERVAL (Emmeans only) +# ============================================================================= + + + +# Define color palette for TIME +time_colors <- c("Past" = "#648FFF", "Future" = "#DC267F") + +# Create emmeans for TEMPORAL_DO × TIME × INTERVAL +emm_3way <- emmeans(aov_model, ~ TEMPORAL_DO * TIME * INTERVAL) + +# Prepare emmeans data frame +emmeans_3way <- emm_3way %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TEMPORAL_DO = factor(TEMPORAL_DO, levels = c("01PAST", "02FUT")), + TIME = factor(TIME, levels = c("Past", "Future")), + INTERVAL = factor(INTERVAL), + x_pos = as.numeric(TEMPORAL_DO), + time_offset = (as.numeric(TIME) - 1.5) * 0.2, + x_dodged = x_pos + time_offset + ) + +# Create 3-way interaction plot with facets +interaction_plot_3way <- ggplot(emmeans_3way) + + geom_errorbar( + aes(x = x_dodged, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.1, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = x_dodged, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + facet_wrap(~INTERVAL, nrow = 1, labeller = labeller(INTERVAL = c( + "5" = "Present v. 5 Years", + "10" = "Present v. 10 Years", + "5_10" = "5 Years v. 10 Years" + ))) + + labs( + x = "Order", + y = "Mean absolute deviation", + title = "TEMPORAL_DO × TIME × INTERVAL Interaction (Estimated Marginal Means)" + ) + + scale_x_continuous( + breaks = c(1, 2), + labels = c("Past First", "Future First"), + limits = c(0.5, 2.5) + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5), + strip.text = element_text(size = 11, face = "bold") + ) + +print(interaction_plot_3way) + +# ============================================================================= +# MAIN EFFECT PLOT: TIME (Emmeans + Error Bars) +# ============================================================================= + +# Prepare emmeans data frame for TIME main effect +time_emm_df <- time_emmeans %>% + as.data.frame() %>% + filter(!is.na(lower.CL) & !is.na(upper.CL) & !is.na(emmean)) %>% + rename( + ci_lower = lower.CL, + ci_upper = upper.CL, + plot_mean = emmean + ) %>% + mutate( + TIME = factor(TIME, levels = c("Past", "Future")) + ) + +# Create TIME main-effect plot (style aligned with the 3-way interaction plot) +time_main_plot <- ggplot(time_emm_df) + + geom_errorbar( + aes(x = TIME, ymin = ci_lower, ymax = ci_upper, color = TIME), + width = 0.15, + linewidth = 1, + alpha = 0.8 + ) + + geom_point( + aes(x = TIME, y = plot_mean, fill = TIME, shape = TIME), + size = 5, + stroke = 1.2, + color = "black" + ) + + labs( + x = "Time", + y = "Mean absolute difference from present", + title = "Main Effect of TIME (Estimated Marginal Means)" + ) + + scale_color_manual(name = "Temporal Direction", values = time_colors) + + scale_fill_manual(name = "Temporal Direction", values = time_colors) + + scale_shape_manual(name = "Temporal Direction", values = c(21, 22)) + + theme_minimal(base_size = 13) + + theme( + axis.text = element_text(size = 11), + axis.title = element_text(size = 12), + plot.title = element_text(size = 14, hjust = 0.5), + legend.position = "right", + legend.title = element_text(size = 11), + legend.text = element_text(size = 10), + panel.grid.major.x = element_blank(), + panel.grid.minor = element_blank(), + panel.border = element_rect(color = "gray80", fill = NA, linewidth = 0.5) + ) + +print(time_main_plot) \ No newline at end of file diff --git a/eohi2/normality_plots.pdf b/eohi2/normality_plots.pdf new file mode 100644 index 0000000..d6d0392 Binary files /dev/null and b/eohi2/normality_plots.pdf differ diff --git a/eohi2/normality_plots_domain_general_vars.pdf b/eohi2/normality_plots_domain_general_vars.pdf new file mode 100644 index 0000000..40ca768 Binary files /dev/null and b/eohi2/normality_plots_domain_general_vars.pdf differ diff --git a/eohi2/normality_plots_domain_vars.pdf b/eohi2/normality_plots_domain_vars.pdf new file mode 100644 index 0000000..93219ac Binary files /dev/null and b/eohi2/normality_plots_domain_vars.pdf differ diff --git a/eohi2/pearson_correlations_domain_vars.csv b/eohi2/pearson_correlations_domain_vars.csv new file mode 100644 index 0000000..411abb8 --- /dev/null +++ b/eohi2/pearson_correlations_domain_vars.csv @@ -0,0 +1,15 @@ +"","NPast_5_mean","NPast_10_mean","NFut_5_mean","NFut_10_mean","X5.10past_mean","X5.10fut_mean","NPast_global_mean","NFut_global_mean","X5.10_global_mean","N5_global_mean","N10_global_mean","aot_total","crt_correct","crt_int" +"NPast_5_mean",1,0.79269,0.61187,0.64159,0.56391,0.48216,0.93998,0.66241,0.61097,0.91249,0.81405,0.16119,0.01772,-0.07234 +"NPast_10_mean",0.79269,1,0.57126,0.58423,0.72169,0.40604,0.95313,0.61051,0.66896,0.76793,0.91504,0.12811,0.03142,-0.05807 +"NFut_5_mean",0.61187,0.57126,1,0.79171,0.44037,0.64027,0.62342,0.94464,0.6183,0.88191,0.75033,0.18518,-0.04603,0.01651 +"NFut_10_mean",0.64159,0.58423,0.79171,1,0.49901,0.67577,0.64543,0.94832,0.674,0.79189,0.86195,0.1453,-0.03158,-0.01421 +"X5.10past_mean",0.56391,0.72169,0.44037,0.49901,1,0.48048,0.68381,0.49675,0.88296,0.56387,0.69884,0.10743,0.02735,-0.05262 +"X5.10fut_mean",0.48216,0.40604,0.64027,0.67577,0.48048,1,0.46656,0.69552,0.83595,0.61854,0.5895,0.19706,-0.01802,-0.02604 +"NPast_global_mean",0.93998,0.95313,0.62342,0.64543,0.68381,0.46656,1,0.67047,0.67765,0.88269,0.91618,0.15171,0.02638,-0.0684 +"NFut_global_mean",0.66241,0.61051,0.94464,0.94832,0.49675,0.69552,0.67047,1,0.68315,0.8834,0.85268,0.17423,-0.04087,0.00094 +"X5.10_global_mean",0.61097,0.66896,0.6183,0.674,0.88296,0.83595,0.67765,0.68315,1,0.68394,0.75286,0.17271,0.00747,-0.04687 +"N5_global_mean",0.91249,0.76793,0.88191,0.79189,0.56387,0.61854,0.88269,0.8834,0.68394,1,0.87328,0.19185,-0.01325,-0.03457 +"N10_global_mean",0.81405,0.91504,0.75033,0.86195,0.69884,0.5895,0.91618,0.85268,0.75286,0.87328,1,0.15224,0.00393,-0.04334 +"aot_total",0.16119,0.12811,0.18518,0.1453,0.10743,0.19706,0.15171,0.17423,0.17271,0.19185,0.15224,1,-0.00309,-0.03535 +"crt_correct",0.01772,0.03142,-0.04603,-0.03158,0.02735,-0.01802,0.02638,-0.04087,0.00747,-0.01325,0.00393,-0.00309,1,-0.90405 +"crt_int",-0.07234,-0.05807,0.01651,-0.01421,-0.05262,-0.02604,-0.0684,0.00094,-0.04687,-0.03457,-0.04334,-0.03535,-0.90405,1 diff --git a/eohi2/reliability - ehi.r b/eohi2/reliability - ehi.r new file mode 100644 index 0000000..d059220 --- /dev/null +++ b/eohi2/reliability - ehi.r @@ -0,0 +1,56 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(knitr) + +# Select the 4 variables for reliability analysis +reliability_data <- df[complete.cases(df[, c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")]), + c("ehiDGEN_5_mean", "ehiDGEN_10_mean", "ehi5_global_mean", "ehi10_global_mean")] + +# Cronbach's Alpha +alpha_result <- alpha(reliability_data) + +# Split-half reliability +split_half <- splitHalf(reliability_data) + +# Alpha if item dropped +alpha_dropped <- alpha(reliability_data, check.keys = TRUE) + +# Inter-item correlations +cor_matrix <- cor(reliability_data, use = "complete.obs") + +# Create a summary table +summary_table <- data.frame( + Variable = names(reliability_data), + n = nrow(reliability_data), + Mean = round(colMeans(reliability_data, na.rm = TRUE), 5), + SD = round(apply(reliability_data, 2, sd, na.rm = TRUE), 5), + Min = round(apply(reliability_data, 2, min, na.rm = TRUE), 5), + Max = round(apply(reliability_data, 2, max, na.rm = TRUE), 5), + Median = round(apply(reliability_data, 2, median, na.rm = TRUE), 5) +) + +html_output <- paste0( + "EHI Reliability Analysis", + "

EHI Reliability Analysis

", + + "

Cronbach's Alpha

", + kable(alpha_result$total, format = "html"), + + "

Split-Half Reliability

", + "

Maximum split half reliability: ", round(split_half$maxrb, 5), "

", + + "

Item-Level Statistics

", + kable(alpha_result$item.stats, format = "html"), + + "

Alpha if Item Dropped

", + kable(alpha_dropped$alpha.drop, format = "html"), + + + "" +) + +writeLines(html_output, "EHI reliability.html") \ No newline at end of file diff --git a/eohi2/reliability analysis.r b/eohi2/reliability analysis.r new file mode 100644 index 0000000..f62ee62 --- /dev/null +++ b/eohi2/reliability analysis.r @@ -0,0 +1,289 @@ +setwd("C:/Users/irina/Documents/DND/EOHI/eohi2") + +options(scipen = 999) + +df <- read.csv("eohi2.csv") +library(psych) +library(dplyr) +library(knitr) +library(irr) + +# Your named variable sets (replace df with your actual dataframe name) +present_pref_vars <- c("present_pref_read", "present_pref_music", "present_pref_tv", "present_pref_nap", "present_pref_travel") +past_5_pref_vars <- c("past_5_pref_read", "past_5_pref_music", "past_5_pref_TV", "past_5_pref_nap", "past_5_pref_travel") +past_10_pref_vars <- c("past_10_pref_read", "past_10_pref_music", "past_10_pref_TV", "past_10_pref_nap", "past_10_pref_travel") +fut_5_pref_vars <- c("fut_5_pref_read", "fut_5_pref_music", "fut_5_pref_TV", "fut_5_pref_nap", "fut_5_pref_travel") +fut_10_pref_vars <- c("fut_10_pref_read", "fut_10_pref_music", "fut_10_pref_TV", "fut_10_pref_nap", "fut_10_pref_travel") + +present_pers_vars <- c("present_pers_extravert", "present_pers_critical", "present_pers_dependable", "present_pers_anxious", "present_pers_complex") +past_5_pers_vars <- c("past_5_pers_extravert", "past_5_pers_critical", "past_5_pers_dependable", "past_5_pers_anxious", "past_5_pers_complex") +past_10_pers_vars <- c("past_10_pers_extravert", "past_10_pers_critical", "past_10_pers_dependable", "past_10_pers_anxious", "past_10_pers_complex") +fut_5_pers_vars <- c("fut_5_pers_extravert", "fut_5_pers_critical", "fut_5_pers_dependable", "fut_5_pers_anxious", "fut_5_pers_complex") +fut_10_pers_vars <- c("fut_10_pers_extravert", "fut_10_pers_critical", "fut_10_pers_dependable", "fut_10_pers_anxious", "fut_10_pers_complex") + +present_val_vars <- c("present_val_obey", "present_val_trad", "present_val_opinion", "present_val_performance", "present_val_justice") +past_5_val_vars <- c("past_5_val_obey", "past_5_val_trad", "past_5_val_opinion", "past_5_val_performance", "past_5_val_justice") +past_10_val_vars <- c("past_10_val_obey", "past_10_val_trad", "past_10_val_opinion", "past_10_val_performance", "past_10_val_justice") +fut_5_val_vars <- c("fut_5_val_obey", "fut_5_val_trad", "fut_5_val_opinion", "fut_5_val_performance", "fut_5_val_justice") +fut_10_val_vars <- c("fut_10_val_obey", "fut_10_val_trad", "fut_10_val_opinion", "fut_10_val_performance", "fut_10_val_justice") + +all_scales <- list( + "Present_Preferences" = present_pref_vars, + "Past5_Preferences" = past_5_pref_vars, + "Past10_Preferences" = past_10_pref_vars, + "Fut5_Preferences" = fut_5_pref_vars, + "Fut10_Preferences" = fut_10_pref_vars, + "Present_Personality" = present_pers_vars, + "Past5_Personality" = past_5_pers_vars, + "Past10_Personality" = past_10_pers_vars, + "Fut5_Personality" = fut_5_pers_vars, + "Fut10_Personality" = fut_10_pers_vars, + "Present_Values" = present_val_vars, + "Past5_Values" = past_5_val_vars, + "Past10_Values" = past_10_val_vars, + "Fut5_Values" = fut_5_val_vars, + "Fut10_Values" = fut_10_val_vars +) + +# Reliability analysis loop +alpha_results <- list() +summary_data <- data.frame() +item_data <- data.frame() + +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + # Only run if there is more than one column present + if(ncol(scale_data) > 1) { + alpha_out <- psych::alpha(scale_data, check.keys = TRUE) + alpha_results[[scale_name]] <- alpha_out + + # Print full output for diagnostics + cat("\n----------", scale_name, "----------\n") + print(alpha_out$total) + print(alpha_out$item.stats) + print(alpha_out$alpha.drop) + + # Collect summary data for HTML - fix the data collection + total_row <- as.data.frame(alpha_out$total) + total_row$Scale <- scale_name + + # Debug: print what we're collecting + cat("Collecting data for", scale_name, "- columns:", paste(colnames(total_row), collapse = ", "), "\n") + + if(nrow(summary_data) == 0) { + summary_data <- total_row + } else { + summary_data <- rbind(summary_data, total_row) + } + + # Collect item data for HTML + item_row <- alpha_out$item.stats + alpha_drop_row <- alpha_out$alpha.drop + item_row$Scale <- scale_name + item_row$AlphaIfDropped <- alpha_drop_row$raw_alpha + item_data <- rbind(item_data, item_row) + } +} + +# Calculate ICC(2,1) across time points for each construct +icc_data <- data.frame() + +# Define construct groups +constructs <- list( + "Preferences" = c("Present_Preferences", "Past5_Preferences", "Past10_Preferences", "Fut5_Preferences", "Fut10_Preferences"), + "Personality" = c("Present_Personality", "Past5_Personality", "Past10_Personality", "Fut5_Personality", "Fut10_Personality"), + "Values" = c("Present_Values", "Past5_Values", "Past10_Values", "Fut5_Values", "Fut10_Values") +) + +for(construct_name in names(constructs)) { + construct_scales <- constructs[[construct_name]] + + # Get data for all time points of this construct + construct_data <- data.frame() + for(scale_name in construct_scales) { + if(scale_name %in% names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + # Calculate mean score for this time point + scale_mean <- rowMeans(scale_data, na.rm = TRUE) + if(ncol(construct_data) == 0) { + construct_data <- data.frame(scale_mean) + colnames(construct_data)[1] <- scale_name + } else { + construct_data <- cbind(construct_data, scale_mean) + colnames(construct_data)[ncol(construct_data)] <- scale_name + } + } + } + } + + # Calculate ICC(2,1) across time points + if(ncol(construct_data) > 1) { + tryCatch({ + icc_result <- icc(construct_data, model = "twoway", type = "consistency", unit = "single") + cat("ICC(2,1) for", construct_name, "across time points:", round(icc_result$value, 4), "\n") + + # Collect ICC data for HTML + icc_row <- data.frame( + Construct = construct_name, + ICC_2_1 = icc_result$value, + ICC_CI_Lower = icc_result$lbound, + ICC_CI_Upper = icc_result$ubound, + F_Value = icc_result$Fvalue, + p_Value = icc_result$p.value, + stringsAsFactors = FALSE + ) + + # Debug: print actual p-value and all ICC results + cat("ICC results for", construct_name, ":\n") + cat(" ICC value:", icc_result$value, "\n") + cat(" F value:", icc_result$Fvalue, "\n") + cat(" p-value:", icc_result$p.value, "\n") + cat(" p-value class:", class(icc_result$p.value), "\n") + cat(" p-value length:", length(icc_result$p.value), "\n") + cat(" p-value is.na:", is.na(icc_result$p.value), "\n") + cat(" p-value is.null:", is.null(icc_result$p.value), "\n") + cat(" p-value == 0:", icc_result$p.value == 0, "\n") + cat("\n") + if(nrow(icc_data) == 0) { + icc_data <- icc_row + } else { + icc_data <- rbind(icc_data, icc_row) + } + }, error = function(e) { + cat("ICC calculation failed for", construct_name, ":", e$message, "\n") + }) + } +} + +# Debug: check summary_data +cat("Final summary_data has", nrow(summary_data), "rows\n") +if(nrow(summary_data) > 0) { + cat("Column names:", paste(colnames(summary_data), collapse = ", "), "\n") + cat("First few rows:\n") + print(head(summary_data)) +} else { + cat("ERROR: summary_data is empty!\n") +} + +# Create simple HTML report +html_content <- paste0(" + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: ", Sys.time(), "

+

Overall Scale Statistics

+
+ + ") + +if(nrow(summary_data) > 0) { + for(i in 1:nrow(summary_data)) { + row <- summary_data[i,] + + # Debug: print what we're trying to access + cat("Row", i, "- trying to access columns:", paste(colnames(row), collapse = ", "), "\n") + cat("Raw alpha value:", row$raw_alpha, "\n") + + html_content <- paste0(html_content, sprintf("", + row[["Scale"]], row[["raw_alpha"]], row[["std.alpha"]], row[["G6(smc)"]], row[["average_r"]], row[["S/N"]], row[["ase"]], row[["mean"]], row[["sd"]], row[["median_r"]])) + } +} else { + cat("ERROR: No summary data to display!\n") + html_content <- paste0(html_content, "") +} + +html_content <- paste0(html_content, "
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
%s%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
No data available
") + +# Add item statistics with alpha if dropped +html_content <- paste0(html_content, "

Item Statistics

+ + ") + +for(i in 1:nrow(item_data)) { + row <- item_data[i,] + html_content <- paste0(html_content, sprintf("", + row$Scale, rownames(row), row$n, row$raw.r, row$std.r, row$r.cor, row$r.drop, row$mean, row$sd, row$AlphaIfDropped)) +} + +html_content <- paste0(html_content, "
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
%s%s%.0f%.4f%.4f%.4f%.4f%.4f%.4f%.4f
") + +# Add ICC(2,1) results across time points +if(nrow(icc_data) > 0) { + html_content <- paste0(html_content, "

ICC(2,1) Results (Temporal Stability)

+ + ") + + for(i in 1:nrow(icc_data)) { + row <- icc_data[i,] + + # Format p-value appropriately + p_val <- row$p_Value + + # Debug: print the actual p-value + cat("Debug - p-value for", row$Construct, ":", p_val, "\n") + + if(p_val < 1e-10) { + p_display <- "< 1e-10" # For extremely small values + } else if(p_val < 0.001) { + p_display <- sprintf("%.2e", p_val) # Scientific notation + } else { + p_display <- sprintf("%.4f", p_val) # 4 decimal places + } + + html_content <- paste0(html_content, sprintf("", + row$Construct, row$ICC_2_1, row$ICC_CI_Lower, row$ICC_CI_Upper, row$F_Value, p_display)) + } + + html_content <- paste0(html_content, "
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
%s%.4f%.4f%.4f%.4f%s
") +} + +html_content <- paste0(html_content, " + +") + +# Write HTML file +writeLines(html_content, "reliability_analysis_report.html") + + +# Check for reversed items +cat("\n=== REVERSED ITEMS CHECK ===\n") +for(scale_name in names(all_scales)) { + vars <- all_scales[[scale_name]] + scale_data <- df %>% select(all_of(vars)) + + if(ncol(scale_data) > 1) { + alpha_out <- alpha_results[[scale_name]] + + # Check if any items were reversed by looking at the keys + if(!is.null(alpha_out$keys)) { + keys_df <- as.data.frame(alpha_out$keys) + reversed_items <- rownames(keys_df)[keys_df[,1] < 0] + if(length(reversed_items) > 0) { + cat(scale_name, "reversed items:", paste(reversed_items, collapse = ", "), "\n") + } else { + cat(scale_name, ": No items reversed\n") + } + } else { + cat(scale_name, ": No keys available\n") + } + } +} + diff --git a/eohi2/reliability_alpha_drop.csv b/eohi2/reliability_alpha_drop.csv new file mode 100644 index 0000000..c56f96b --- /dev/null +++ b/eohi2/reliability_alpha_drop.csv @@ -0,0 +1,76 @@ +"","raw_alpha","std.alpha","G6(smc)","average_r","S/N","alpha se","var.r","med.r","Scale" +"present_pref_read",0.435139069053199,0.48107513743895,0.417343507367347,0.188157039637539,0.927061260978517,0.0413363761204545,0.00446629262299118,0.191315642198415,"Present_Preferences" +"present_pref_music",0.454572762371807,0.466698556316001,0.401585135063952,0.179506049796517,0.875112118752367,0.0400462944221944,0.00255577625530098,0.196181981648548,"Present_Preferences" +"present_pref_tv",0.453478317134021,0.480680729513314,0.415293783271362,0.187915816030971,0.925597713835727,0.0397197278244867,0.00312458761106114,0.200076930545492,"Present_Preferences" +"present_pref_nap",0.506530764879463,0.530377630991489,0.461864201683123,0.220177206722872,1.12937046016621,0.0355884983353413,0.00164378995389491,0.209003787755801,"Present_Preferences" +"present_pref_travel",0.499483233856916,0.528177070705267,0.459427657909443,0.218664415518247,1.11943917497772,0.0360009279863294,0.00156504010550639,0.2004750541082,"Present_Preferences" +"past_5_pref_read",0.49315206527245,0.530253175809417,0.472223402714843,0.220091427919355,1.12880630267824,0.0370986365047395,0.00798218243052523,0.210448229100241,"Past5_Preferences" +"past_5_pref_music",0.479966949014762,0.487989093893389,0.423705704356,0.192422239022488,0.953083397391109,0.0378471515825443,0.00309288922090967,0.185457201480416,"Past5_Preferences" +"past_5_pref_TV",0.505625816904972,0.524768063134951,0.456787588365864,0.216337127204008,1.10423568457262,0.0361467945185586,0.00232694565690965,0.210448229100241,"Past5_Preferences" +"past_5_pref_nap",0.532903653091565,0.554035083161857,0.49718259309499,0.236980335851281,1.24232885198666,0.0340752256408313,0.00762852700299363,0.232399809646677,"Past5_Preferences" +"past_5_pref_travel",0.540129052990475,0.570601126326154,0.509158329124602,0.24936717460557,1.32883703546824,0.0335597514271604,0.00521447071848445,0.235160963901298,"Past5_Preferences" +"past_10_pref_read",0.42146973504476,0.467910660650074,0.407954351408089,0.180224328689128,0.879383641141426,0.0425317858696471,0.00609048859403508,0.169714810291037,"Past10_Preferences" +"past_10_pref_music",0.383724376551897,0.404399180936323,0.341678338615776,0.145112252177336,0.678976871744511,0.0450826609707978,0.0019592606820515,0.152402927172365,"Past10_Preferences" +"past_10_pref_TV",0.417319783055131,0.447534732100472,0.385618877659629,0.168411017838438,0.810068538429572,0.0430377941036908,0.00475982727126876,0.167093486197917,"Past10_Preferences" +"past_10_pref_nap",0.497733804487429,0.518309456839574,0.453143987020925,0.211981297639748,1.07602165788618,0.0366395796142005,0.00357035098794283,0.204392721452327,"Past10_Preferences" +"past_10_pref_travel",0.455455646437174,0.493242953071209,0.430818967448103,0.195710273029317,0.973332203391181,0.039758032132043,0.00475208627749074,0.170859479391049,"Past10_Preferences" +"fut_5_pref_read",0.485677036640361,0.513743063443284,0.451443957078761,0.208943046429043,1.05652593273261,0.0380622033902203,0.00576089712913843,0.222794773320224,"Fut5_Preferences" +"fut_5_pref_music",0.486616049706682,0.495721091257953,0.434082800506167,0.1972754879313,0.983029594663313,0.0379258260017313,0.00460659702069512,0.207864843307916,"Fut5_Preferences" +"fut_5_pref_TV",0.505203014790389,0.526834765968424,0.463028297297763,0.217745692010243,1.11342661733526,0.0365317330439021,0.00487409649421615,0.225034470668277,"Fut5_Preferences" +"fut_5_pref_nap",0.528813153254715,0.545113078001331,0.478650899605069,0.230524854067905,1.19834853815148,0.0345963202028831,0.00302707198671256,0.223786470520074,"Fut5_Preferences" +"fut_5_pref_travel",0.56578146101759,0.576862364402178,0.509813796852878,0.254190131145966,1.36329722499671,0.0316520081211965,0.00169475862185168,0.2616392728595,"Fut5_Preferences" +"fut_10_pref_read",0.48566308468049,0.511726239791551,0.46151542160533,0.207611904284485,1.04803141494454,0.0382360074396568,0.0103257511663068,0.231884864393169,"Fut10_Preferences" +"fut_10_pref_music",0.469004537233679,0.473876357870277,0.418995549539174,0.183789055725162,0.900693905242593,0.0390566177298916,0.00755367160264333,0.188223271956033,"Fut10_Preferences" +"fut_10_pref_TV",0.532730246607956,0.547737999436364,0.48576403839494,0.232408881860034,1.21110771799033,0.034427135765886,0.00635561313263386,0.248962058088766,"Fut10_Preferences" +"fut_10_pref_nap",0.53628801495449,0.550091319408203,0.494910236148344,0.234108704431164,1.22267327379554,0.0338566656325087,0.00947060767553417,0.283801590910436,"Fut10_Preferences" +"fut_10_pref_travel",0.549327131636092,0.559074530376034,0.498281804877929,0.240692357749388,1.2679569879527,0.0331401459614918,0.00416316694991134,0.25357378885717,"Fut10_Preferences" +"present_pers_extravert",0.479092126525215,0.471288474483638,0.491037351677613,0.182236639483982,0.891390582082275,0.0372898849702218,0.0527144924690426,0.204105686777363,"Present_Personality" +"present_pers_critical-",0.498208995722865,0.522305630364556,0.485793977728418,0.214668224218338,1.09338870952814,0.0371715003515347,0.0193105082244649,0.248446216371151,"Present_Personality" +"present_pers_dependable",0.416226819469843,0.407055972074903,0.470656854859284,0.146484551712056,0.686499826129159,0.0438096329821544,0.0690351566093005,0.0559708036357215,"Present_Personality" +"present_pers_anxious-",0.377108095079005,0.413513821653376,0.409874211618613,0.149853247078199,0.705070020267352,0.0464559579678959,0.0393584620336262,0.204105686777363,"Present_Personality" +"present_pers_complex",0.511227068709536,0.525376370118964,0.519639537913091,0.216750971499278,1.10693260310417,0.0361739891253925,0.0366687695267616,0.21140738935626,"Present_Personality" +"past_5_pers_extravert",0.612055956083576,0.602296580230792,0.622886921913866,0.274631235559009,1.51443651296816,0.0284611645540717,0.0491781553471782,0.203322368209586,"Past5_Personality" +"past_5_pers_critical-",0.579350370920505,0.598180281960615,0.565306416472674,0.271227096109969,1.48867826815304,0.0315505779544631,0.0241418430346359,0.250363861272821,"Past5_Personality" +"past_5_pers_dependable",0.552024976816104,0.555367416899267,0.636666052214874,0.23795704720368,1.24904795106625,0.0347071289813224,0.0846498418306196,0.120555192826371,"Past5_Personality" +"past_5_pers_anxious-",0.504197756151772,0.52689680840247,0.519190520939591,0.217788088755711,1.11370377067907,0.0372575430416952,0.0443746940782245,0.215002145593136,"Past5_Personality" +"past_5_pers_complex",0.537862166184567,0.542261209967077,0.578086171369087,0.228492107504091,1.1846520805634,0.0347055558103404,0.060851090815353,0.203322368209586,"Past5_Personality" +"past_10_pers_extravert",0.60610735733143,0.600706325347345,0.628295909712786,0.273311575467168,1.50442234245233,0.0292417787937716,0.0536085119211435,0.221824316759824,"Past10_Personality" +"past_10_pers_critical-",0.565757367242208,0.591181844250811,0.565192683559541,0.265526132668526,1.44607531719678,0.0327950180975292,0.0307916680156413,0.269319994231487,"Past10_Personality" +"past_10_pers_dependable",0.481724645337379,0.483850258867143,0.561386768420651,0.189860662878693,0.937422263944524,0.0396694800157226,0.0792575722186634,0.0681754409148789,"Past10_Personality" +"past_10_pers_anxious-",0.498398610410713,0.531336617472117,0.53077240042076,0.220839066197234,1.13372761192945,0.0380223248624829,0.0516162535431615,0.239679577185141,"Past10_Personality" +"past_10_pers_complex",0.522972558966706,0.529057341027409,0.561029859249154,0.219268570361673,1.12340076004497,0.0359360926711053,0.0593360314276151,0.221824316759824,"Past10_Personality" +"fut_5_pers_extravert",0.518178030829052,0.516697168096864,0.539050737514151,0.210904680318375,1.06909609046202,0.0354258120892716,0.050236976626768,0.155917272941721,"Fut5_Personality" +"fut_5_pers_critical-",0.517121290726089,0.543412823330931,0.527829843039797,0.229311184458834,1.19016225399776,0.0361433525820403,0.0375772534965781,0.236179964225416,"Fut5_Personality" +"fut_5_pers_dependable",0.416861375330373,0.425554484208011,0.531676172182833,0.156262172083744,0.74080913247499,0.0453851844254097,0.0956510750878345,0.0185056505285981,"Fut5_Personality" +"fut_5_pers_anxious-",0.407057844905402,0.454913213378045,0.473667036338041,0.172625528887476,0.834570245588342,0.0448331333555,0.0624279679782129,0.179152174541331,"Fut5_Personality" +"fut_5_pers_complex",0.413734276020735,0.437076388987589,0.484708488737855,0.162556207326107,0.77643996527613,0.0442545316180831,0.0645700332715915,0.155917272941721,"Fut5_Personality" +"fut_10_pers_extravert",0.600742597568624,0.600541279655001,0.629846016930102,0.273174941713463,1.50338758191669,0.0295155885347512,0.0537653479300709,0.208459229757198,"Fut10_Personality" +"fut_10_pers_critical-",0.598845889129534,0.624403416309595,0.610536252527708,0.293589630096298,1.66243103218499,0.030364890464343,0.0381038043221486,0.290119490116544,"Fut10_Personality" +"fut_10_pers_dependable",0.530905044273477,0.53512937843298,0.625681759242791,0.223472282218808,1.15113615188055,0.0365782545736384,0.0906160200126979,0.0836209946511999,"Fut10_Personality" +"fut_10_pers_anxious-",0.514907017686671,0.552795818122987,0.559003216062612,0.236074844728001,1.23611504660529,0.0368241947242587,0.0599800985214985,0.218685989575988,"Fut10_Personality" +"fut_10_pers_complex",0.525958964899606,0.536727831771034,0.570065934406901,0.224589557699683,1.15855833477517,0.0355260637412827,0.0593673086473126,0.208459229757198,"Fut10_Personality" +"present_val_obey",0.371636985612235,0.39117958810508,0.417180742515891,0.138399063523795,0.642520487917866,0.0442197056248005,0.0467536463955191,0.0483873491397154,"Present_Values" +"present_val_trad",0.417900261850541,0.478732147138847,0.475176033952621,0.186727312057931,0.918399522455042,0.0434973688045598,0.0410670253223881,0.200373890519972,"Present_Values" +"present_val_opinion",0.525909790122171,0.516689980214423,0.503654488654215,0.210899890076898,1.06906531845472,0.0332310045607671,0.032975082462023,0.263346143914019,"Present_Values" +"present_val_performance",0.537373141830764,0.571127836030548,0.558931119134214,0.24976984030842,1.33169714430622,0.0335482318793572,0.031518769195357,0.271629122608804,"Present_Values" +"present_val_justice",0.512162459228214,0.4889541852735,0.462242114530837,0.193023156480116,0.956771724146056,0.033290346121155,0.026716041315895,0.200373890519972,"Present_Values" +"past_5_val_obey",0.414623947283337,0.433798461960745,0.421984030164935,0.160749173736429,0.766155569734021,0.0429298608973904,0.0281065559444171,0.0885482904921262,"Past5_Values" +"past_5_val_trad",0.456087766112647,0.504417654349968,0.477034963115266,0.2028423666963,1.01782813447147,0.0412708577386655,0.0290341531304012,0.178112263945994,"Past5_Values" +"past_5_val_opinion",0.489467945792198,0.499549965406389,0.479354404618759,0.199712133320046,0.998201480417615,0.0373594914108721,0.0253494559272422,0.215458505011119,"Past5_Values" +"past_5_val_performance",0.558852435482624,0.579552242908515,0.552209244231319,0.256286716957346,1.37841677862111,0.0330457049671869,0.0222460636150491,0.286785075984031,"Past5_Values" +"past_5_val_justice",0.494515433058837,0.495176339177484,0.448817102605896,0.196930623829092,0.980889719730423,0.0361925329262612,0.0127582816569381,0.178112263945994,"Past5_Values" +"past_10_val_obey",0.458166457804902,0.481233266962428,0.477398314392108,0.188253815858349,0.927648664255373,0.0400954779340435,0.0342941703106021,0.149498697850906,"Past10_Values" +"past_10_val_trad",0.503247118134847,0.547446991401228,0.537674882768709,0.232199391604697,1.2096858953524,0.037947393791925,0.0409259744692915,0.221130545388513,"Past10_Values" +"past_10_val_opinion",0.541567917220755,0.550921585655866,0.543619687375542,0.234710852817687,1.22678260201055,0.0335135784668097,0.0359872729194667,0.230235405427414,"Past10_Values" +"past_10_val_performance",0.641851348215779,0.65612942131637,0.638142427563225,0.322960046781269,1.908070832428,0.0268075065670376,0.0235000033527742,0.347829439119942,"Past10_Values" +"past_10_val_justice",0.557729084145158,0.561866615633344,0.519137353499773,0.242769866257036,1.28240995934503,0.0320296267346126,0.0166201607466171,0.22823997774938,"Past10_Values" +"fut_5_val_obey",0.417997629639865,0.45318744388101,0.458917579097497,0.171633456571239,0.82878024436292,0.0423676429183868,0.0378682776361928,0.0985883789932699,"Fut5_Values" +"fut_5_val_trad",0.471496601865856,0.536086001753481,0.51892956334751,0.224140397640112,1.15557194604981,0.0402396362763961,0.038607273717591,0.20346498927351,"Fut5_Values" +"fut_5_val_opinion",0.50919752220471,0.517774859972913,0.51289218643912,0.211623845044275,1.07372017133704,0.0355200511951371,0.0320467100235606,0.217011382626919,"Fut5_Values" +"fut_5_val_performance",0.596958557248088,0.622966215906804,0.6186594818004,0.292321252220329,1.65228221498798,0.0300736340956473,0.0315055674746758,0.325946353609289,"Fut5_Values" +"fut_5_val_justice",0.524789935563774,0.529159704052028,0.488920613699065,0.219338910895375,1.12386239794246,0.0337834202531821,0.0175898829572714,0.208663864861605,"Fut5_Values" +"fut_10_val_obey",0.385425322647308,0.419391973343572,0.4560409996902,0.152960934440503,0.72233237242472,0.0450402313137469,0.0537905719480439,0.0367210600713511,"Fut10_Values" +"fut_10_val_trad",0.454245878284695,0.525562306327568,0.524878389571301,0.216877592270058,1.10775832809446,0.0417078528083637,0.0458927878315257,0.171628576085157,"Fut10_Values" +"fut_10_val_opinion",0.480625123301312,0.489289744888339,0.49164418404918,0.193232415792559,0.958057411205424,0.0377454443710423,0.033315801259672,0.223652173477016,"Fut10_Values" +"fut_10_val_performance",0.547920336972762,0.57673301675933,0.597121289912303,0.254089688714759,1.36257501670382,0.0342884952781278,0.0476266194158017,0.285364562730414,"Fut10_Values" +"fut_10_val_justice",0.474868717989713,0.470746330192692,0.436588159337226,0.181912598759594,0.889453124366775,0.037101207291614,0.0191004455633053,0.171628576085157,"Fut10_Values" diff --git a/eohi2/reliability_analysis_report.html b/eohi2/reliability_analysis_report.html new file mode 100644 index 0000000..c2341bc --- /dev/null +++ b/eohi2/reliability_analysis_report.html @@ -0,0 +1,28 @@ + + + + Reliability Analysis Results + + + +

Reliability Analysis Results

+

Generated on: 2025-10-28 17:09:42.108981

+

Overall Scale Statistics

+
+ +
ScaleRaw AlphaStd AlphaG6(SMC)Average rS/NASEMeanSDMedian r
Present_Preferences0.52480.55380.50420.19891.24130.03361.58200.87130.1966
Past5_Preferences0.56490.58940.54670.22301.43530.03091.41060.95590.2104
Past10_Preferences0.48890.52370.47730.18031.09970.03651.39750.90050.1690
Fut5_Preferences0.56920.58760.54150.22171.42460.03081.58730.90370.2250
Fut10_Preferences0.56990.58470.54800.21971.40800.03081.58770.89320.2490
Present_Personality0.51500.52660.55890.18201.11250.03520.68620.96160.2041
Past5_Personality0.61250.62000.67200.24601.63150.02870.53091.11490.2033
Past10_Personality0.59120.60400.65570.23381.52540.03030.50841.11600.2218
Fut5_Personality0.51100.53380.59880.18631.14500.03650.81600.96460.1559
Fut10_Personality0.60900.62520.68550.25021.66830.02930.78731.04570.2085
Present_Values0.53560.54900.56720.19581.21710.03211.28100.83310.2004
Past5_Values0.53930.56060.55850.20331.27590.03311.24870.88890.1781
Past10_Values0.59800.61760.62770.24421.61530.02901.22860.95760.2282
Fut5_Values0.56170.59050.60710.22381.44170.03131.23440.90680.2087
Fut10_Values0.52480.55530.59220.19981.24860.03421.23440.89390.1716

Item Statistics

+ +
ScaleItemnRaw rStd rr.corr.dropMeanSDAlpha if Dropped
Present_Preferencespresent_pref_read4890.64470.62070.46080.34191.48671.59670.4351
Present_Preferencespresent_pref_music4890.54970.63810.49510.35852.15340.99740.4546
Present_Preferencespresent_pref_tv4890.56890.62120.46450.32951.92431.22830.4535
Present_Preferencespresent_pref_nap4890.61120.55660.35060.24950.93251.77460.5065
Present_Preferencespresent_pref_travel4890.59400.55960.35650.25181.41311.67590.4995
Past5_Preferencespast_5_pref_read4890.63920.62090.45990.35141.30671.67550.4932
Past5_Preferencespast_5_pref_music4890.60760.67490.56380.41091.98981.19330.4800
Past5_Preferencespast_5_pref_TV4890.56560.62820.48700.34541.90591.25260.5056
Past5_Preferencespast_5_pref_nap4890.63950.58800.40030.30000.69941.90060.5329
Past5_Preferencespast_5_pref_travel4890.60120.56380.36330.27911.15131.76300.5401
Past10_Preferencespast_10_pref_read4890.60170.58680.40230.28141.31491.65430.4215
Past10_Preferencespast_10_pref_music4890.59310.65870.54030.37351.96731.21080.3837
Past10_Preferencespast_10_pref_TV4890.53940.61100.45040.31141.92841.18610.4173
Past10_Preferencespast_10_pref_nap4890.59410.52190.28720.19710.57261.94690.4977
Past10_Preferencespast_10_pref_travel4890.57860.55520.34650.23551.20451.71510.4555
Fut5_Preferencesfut_5_pref_read4890.64080.63930.49330.37671.57261.48470.4857
Fut5_Preferencesfut_5_pref_music4890.60770.66210.53370.40452.03271.15900.4866
Fut5_Preferencesfut_5_pref_TV4890.59360.62210.46520.34801.77101.33240.5052
Fut5_Preferencesfut_5_pref_nap4890.63000.59720.42480.30981.19841.70330.5288
Fut5_Preferencesfut_5_pref_travel4890.58700.55090.34330.25151.36201.70160.5658
Fut10_Preferencesfut_10_pref_read4890.65100.63670.48810.37671.56031.52870.4857
Fut10_Preferencesfut_10_pref_music4890.64040.68330.57510.43691.98771.19420.4690
Fut10_Preferencesfut_10_pref_TV4890.54530.58820.41630.29551.83231.27740.5327
Fut10_Preferencesfut_10_pref_nap4890.60100.58480.40090.29411.34561.58540.5363
Fut10_Preferencesfut_10_pref_travel4890.61590.57200.38850.28231.21271.71530.5493
Present_Personalitypresent_pers_extravert4880.59780.58740.41930.25870.01021.83670.4791
Present_Personalitypresent_pers_critical-4880.56340.52120.38160.22770.59221.77820.4982
Present_Personalitypresent_pers_dependable4880.59900.66040.50080.38891.62091.24830.4162
Present_Personalitypresent_pers_anxious-4890.69270.65350.56700.39640.22901.83230.3771
Present_Personalitypresent_pers_complex4890.47420.51690.32880.19030.97141.45390.5112
Past5_Personalitypast_5_pers_extravert4890.57950.57540.42720.27170.10841.94770.6121
Past5_Personalitypast_5_pers_critical-4890.60870.58190.50370.32770.32111.85910.5794
Past5_Personalitypast_5_pers_dependable4890.60670.64530.46780.38741.38451.52020.5520
Past5_Personalitypast_5_pers_anxious-4890.71310.68370.63280.46030.02661.94840.5042
Past5_Personalitypast_5_pers_complex4890.63520.66330.55040.41470.81391.57860.5379
Past10_Personalitypast_10_pers_extravert4890.54530.54580.37040.22590.21881.95840.6061
Past10_Personalitypast_10_pers_critical-4890.59390.56080.45960.29640.26381.92110.5658
Past10_Personalitypast_10_pers_dependable4890.67280.70680.58570.46271.30881.59940.4817
Past10_Personalitypast_10_pers_anxious-4890.68400.64700.56680.4112-0.08381.98020.4984
Past10_Personalitypast_10_pers_complex4890.60670.65010.53630.38220.83441.55080.5230
Fut5_Personalityfut_5_pers_extravert4890.54840.54090.39010.19350.27401.84950.5182
Fut5_Personalityfut_5_pers_critical-4890.54340.50350.36920.19300.65641.82440.5171
Fut5_Personalityfut_5_pers_dependable4890.58860.65190.48100.37461.65031.26360.4169
Fut5_Personalityfut_5_pers_anxious-4890.64810.61870.51920.35050.49081.75100.4071
Fut5_Personalityfut_5_pers_complex4890.61370.63910.52630.35161.00821.52970.4137
Fut10_Personalityfut_10_pers_extravert4890.58560.58890.45670.28220.27401.81480.6007
Fut10_Personalityfut_10_pers_critical-4890.59540.55020.44100.28830.65441.84800.5988
Fut10_Personalityfut_10_pers_dependable4890.62850.68320.54000.43831.62171.30340.5309
Fut10_Personalityfut_10_pers_anxious-4890.69280.65930.58470.43330.47651.80960.5149
Fut10_Personalityfut_10_pers_complex4890.64960.68110.59630.42520.91001.52840.5260
Present_Valuespresent_val_obey4890.70870.71240.61740.47151.49491.38070.3716
Present_Valuespresent_val_trad4890.71530.61530.47580.38930.73621.74910.4179
Present_Valuespresent_val_opinion4890.43050.56680.40620.21252.05730.97550.5259
Present_Valuespresent_val_performance4890.59520.48860.26540.22950.10021.69020.5374
Present_Valuespresent_val_justice4890.47700.60270.48380.24322.01641.06920.5122
Past5_Valuespast_5_val_obey4890.66080.68700.58320.42691.54601.36200.4146
Past5_Valuespast_5_val_trad4890.66080.60310.44880.34580.85891.70780.4561
Past5_Valuespast_5_val_opinion4890.53750.60940.45740.30061.74231.20750.4895
Past5_Valuespast_5_val_performance4890.58180.49660.26280.20830.31081.81570.5589
Past5_Valuespast_5_val_justice4890.54420.61490.49800.28591.78531.30610.4945
Past10_Valuespast_10_val_obey4890.72110.73550.66440.51711.48671.44870.4582
Past10_Valuespast_10_val_trad4890.69930.65160.52670.42140.82001.75800.5032
Past10_Valuespast_10_val_opinion4890.58880.64680.51970.36461.64831.30380.5416
Past10_Valuespast_10_val_performance4890.55350.47840.24490.20040.44381.83470.6419
Past10_Valuespast_10_val_justice4890.56010.63150.53500.32791.74441.30500.5577
Fut5_Valuesfut_5_val_obey4890.70020.71740.63420.47831.56241.41160.4180
Fut5_Valuesfut_5_val_trad4890.68500.61500.48010.37740.84871.75950.4715
Fut5_Valuesfut_5_val_opinion4890.54500.63940.51720.33281.89371.12940.5092
Fut5_Valuesfut_5_val_performance4890.58170.48210.23830.2049-0.07981.86530.5970
Fut5_Valuesfut_5_val_justice4890.52650.62440.52880.29081.94681.21520.5248
Fut10_Valuesfut_10_val_obey4890.67150.69360.58990.43181.51741.41570.3854
Fut10_Valuesfut_10_val_trad4890.63670.56570.40400.31510.91821.70150.4542
Fut10_Valuesfut_10_val_opinion4890.51010.61300.49750.28211.91821.14940.4806
Fut10_Valuesfut_10_val_performance4890.60330.49130.24910.2072-0.09411.94160.5479
Fut10_Valuesfut_10_val_justice4890.53600.63570.56760.28711.91211.26530.4749

ICC(2,1) Results (Temporal Stability)

+ +
ConstructICC(2,1)95% CI Lower95% CI UpperF Valuep Value
Preferences0.69990.66740.731412.6602< 1e-10
Personality0.65530.62000.690010.5069< 1e-10
Values0.67000.63560.703611.1515< 1e-10
+ + diff --git a/eohi2/reliability_item_stats.csv b/eohi2/reliability_item_stats.csv new file mode 100644 index 0000000..9bd159e --- /dev/null +++ b/eohi2/reliability_item_stats.csv @@ -0,0 +1,76 @@ +"","n","raw.r","std.r","r.cor","r.drop","mean","sd","Scale" +"present_pref_read",489,0.644670231548251,0.620736390585195,0.460751285687126,0.341932895810269,1.48670756646217,1.59672025480178,"Present_Preferences" +"present_pref_music",489,0.54974116743382,0.63805986267344,0.495089089249271,0.358500880250471,2.15337423312883,0.99743208458075,"Present_Preferences" +"present_pref_tv",489,0.568946199263525,0.621219437091109,0.464529101463293,0.329514513188064,1.92433537832311,1.22825379929704,"Present_Preferences" +"present_pref_nap",489,0.611233109264059,0.55661650592952,0.350614218600941,0.249479921937643,0.932515337423313,1.77457741802708,"Present_Preferences" +"present_pref_travel",489,0.593950128160383,0.559645846697486,0.356531838152508,0.251750644523185,1.41308793456033,1.67586302529376,"Present_Preferences" +"past_5_pref_read",489,0.639186880352347,0.620919127455879,0.459906731186503,0.351384185277977,1.30674846625767,1.6755154149883,"Past5_Preferences" +"past_5_pref_music",489,0.607610040467373,0.674893040308313,0.563783342191577,0.41087466326408,1.98977505112474,1.19334637220231,"Past5_Preferences" +"past_5_pref_TV",489,0.56558138371312,0.628242591124702,0.487021157640501,0.345385771401191,1.90593047034765,1.25259795732578,"Past5_Preferences" +"past_5_pref_nap",489,0.639457415869459,0.587974162994208,0.400342075657366,0.30003464965608,0.699386503067485,1.90060916461558,"Past5_Preferences" +"past_5_pref_travel",489,0.601153056329369,0.563811324035208,0.363277853142161,0.279134837612778,1.15132924335378,1.76300881272719,"Past5_Preferences" +"past_10_pref_read",489,0.60167823712006,0.586841287245608,0.402307033423481,0.281413408066796,1.31492842535787,1.65429212146624,"Past10_Preferences" +"past_10_pref_music",489,0.593082139444466,0.65865596785571,0.540291294818598,0.373459867313454,1.96728016359918,1.21084281937531,"Past10_Preferences" +"past_10_pref_TV",489,0.539378409546573,0.611003035281365,0.450386384377106,0.311402039450971,1.92842535787321,1.18606568903241,"Past10_Preferences" +"past_10_pref_nap",489,0.594143312478342,0.521888803402398,0.287179115368713,0.197112469396227,0.572597137014315,1.94687265071615,"Past10_Preferences" +"past_10_pref_travel",489,0.578564919774135,0.555167907109204,0.346498232398008,0.23546973425416,1.20449897750511,1.71513877840826,"Past10_Preferences" +"fut_5_pref_read",489,0.640793236125734,0.639308879891161,0.49332359976093,0.376715941790464,1.57259713701432,1.48467085387168,"Fut5_Preferences" +"fut_5_pref_music",489,0.60771657102287,0.662100059414538,0.533698787397869,0.404466415620088,2.03271983640082,1.1589605314939,"Fut5_Preferences" +"fut_5_pref_TV",489,0.593580470177502,0.622113964968677,0.465150791246038,0.347962130709443,1.77096114519427,1.33240480257069,"Fut5_Preferences" +"fut_5_pref_nap",489,0.630016176148836,0.597151400892322,0.42476140457859,0.309821229666273,1.19836400817996,1.70327474560912,"Fut5_Preferences" +"fut_5_pref_travel",489,0.58695436843367,0.550924113627305,0.343290321995814,0.251484409862747,1.36196319018405,1.7015738347294,"Fut5_Preferences" +"fut_10_pref_read",489,0.650990816394657,0.63671376025904,0.488102250589394,0.376678966240966,1.56032719836401,1.52873457503864,"Fut10_Preferences" +"fut_10_pref_music",489,0.640403109033056,0.683348483983726,0.575079544979899,0.436852771701418,1.98773006134969,1.1941853492215,"Fut10_Preferences" +"fut_10_pref_TV",489,0.54529787224958,0.588172117744572,0.416290786496191,0.295482348627467,1.83231083844581,1.27736399997314,"Fut10_Preferences" +"fut_10_pref_nap",489,0.600965428438888,0.584844608198926,0.400894711761921,0.294108267384146,1.34560327198364,1.58540541890217,"Fut10_Preferences" +"fut_10_pref_travel",489,0.615904221480768,0.571956692934303,0.388491972684416,0.28225932557187,1.21267893660532,1.71533667213065,"Fut10_Preferences" +"present_pers_extravert",488,0.597826000129605,0.587391034011798,0.419270385774063,0.258691133253836,0.0102459016393443,1.8367393496034,"Present_Personality" +"present_pers_critical-",488,0.563370849611663,0.521190241333204,0.381612889403105,0.227665011904259,0.592213114754098,1.77817617025888,"Present_Personality" +"present_pers_dependable",488,0.598977416852334,0.660369785121327,0.500804847507268,0.38890589019426,1.62090163934426,1.24829806377072,"Present_Personality" +"present_pers_anxious-",489,0.692672696686629,0.653493454366662,0.566983846680774,0.396389011240843,0.229038854805726,1.83228539562706,"Present_Personality" +"present_pers_complex",489,0.474180433525325,0.516938844983727,0.328827513717892,0.190321443228248,0.971370143149284,1.45393698281885,"Present_Personality" +"past_5_pers_extravert",489,0.579474911705403,0.575427673995688,0.427171865581469,0.271689870321176,0.10838445807771,1.94770547208439,"Past5_Personality" +"past_5_pers_critical-",489,0.608673964655139,0.581912441176064,0.503662500751651,0.327677367412971,0.321063394683027,1.85906785597084,"Past5_Personality" +"past_5_pers_dependable",489,0.606707936212081,0.645290726486264,0.467835125722472,0.387369715502146,1.38445807770961,1.5201662720416,"Past5_Personality" +"past_5_pers_anxious-",489,0.713051571574926,0.683711890414381,0.632838562549818,0.460301545305576,0.0265848670756646,1.94844115746788,"Past5_Personality" +"past_5_pers_complex",489,0.63515377513381,0.663321107217415,0.550433936337394,0.414670798037632,0.813905930470348,1.57858714563964,"Past5_Personality" +"past_10_pers_extravert",489,0.545300136364686,0.545809790486111,0.370398197056088,0.225859993711417,0.21881390593047,1.95837153831986,"Past10_Personality" +"past_10_pers_critical-",489,0.593943350176947,0.560827512243299,0.459585099026302,0.296399600284796,0.263803680981595,1.9210702517606,"Past10_Personality" +"past_10_pers_dependable",489,0.67276718776257,0.706782341187492,0.585749899144309,0.462688375475141,1.30879345603272,1.59941855991268,"Past10_Personality" +"past_10_pers_anxious-",489,0.683973748790288,0.647026582452622,0.566771284219775,0.411225871981855,-0.0838445807770961,1.98021068809306,"Past10_Personality" +"past_10_pers_complex",489,0.606664580280641,0.650055988754777,0.53626446532975,0.382161767959402,0.834355828220859,1.55076846503378,"Past10_Personality" +"fut_5_pers_extravert",489,0.548416669016474,0.540908453996994,0.390102966219679,0.193527920138118,0.274028629856851,1.84950157419483,"Fut5_Personality" +"fut_5_pers_critical-",489,0.543405641242297,0.503523310183684,0.369227443169695,0.193020184826841,0.656441717791411,1.82440323085327,"Fut5_Personality" +"fut_5_pers_dependable",489,0.588622861520595,0.651891941849064,0.481022252917979,0.374617520161518,1.65030674846626,1.26361637380132,"Fut5_Personality" +"fut_5_pers_anxious-",489,0.648068322625186,0.618656600542108,0.519245195599857,0.350507440050026,0.49079754601227,1.75100005907459,"Fut5_Personality" +"fut_5_pers_complex",489,0.613717728029762,0.639108231759075,0.526321832542126,0.351617355738497,1.0081799591002,1.52973752179292,"Fut5_Personality" +"fut_10_pers_extravert",489,0.585555735927976,0.58894802731499,0.456722819027854,0.28220703551594,0.274028629856851,1.814829714497,"Fut10_Personality" +"fut_10_pers_critical-",489,0.595356590103776,0.550220859500573,0.440978601096647,0.28830398927856,0.65439672801636,1.8480123610373,"Fut10_Personality" +"fut_10_pers_dependable",489,0.628533019787159,0.683235199324474,0.53995760937664,0.4382817497044,1.62167689161554,1.30337693878915,"Fut10_Personality" +"fut_10_pers_anxious-",489,0.692791863148962,0.65932782714065,0.584717704562715,0.433294090662987,0.476482617586912,1.80957129133015,"Fut10_Personality" +"fut_10_pers_complex",489,0.64955559564182,0.681115700156453,0.596312056528996,0.42524735782742,0.910020449897751,1.52844672292718,"Fut10_Personality" +"present_val_obey",489,0.708687196675794,0.71244265731063,0.617439049918475,0.471525909438707,1.49488752556237,1.38066064224519,"Present_Values" +"present_val_trad",489,0.715277740823424,0.615327977051767,0.475841713068179,0.389327816707148,0.736196319018405,1.74910359076183,"Present_Values" +"present_val_opinion",489,0.43048264529541,0.566753649271478,0.40621767776226,0.212513152553349,2.05725971370143,0.975516601282514,"Present_Values" +"present_val_performance",489,0.595245010032461,0.488645236429953,0.265362587149441,0.229527055980019,0.100204498977505,1.69018985956406,"Present_Values" +"present_val_justice",489,0.477008766183188,0.602676599512436,0.483777838528329,0.243170393218723,2.01635991820041,1.06919335368795,"Present_Values" +"past_5_val_obey",489,0.660799993649178,0.686998074075263,0.583159723812387,0.42694161451313,1.54601226993865,1.36196483242673,"Past5_Values" +"past_5_val_trad",489,0.660833827527829,0.603119072974675,0.448811486823049,0.345794890887969,0.858895705521472,1.70778341363033,"Past5_Values" +"past_5_val_opinion",489,0.537478846711775,0.609356681251675,0.457411021212401,0.300617486532696,1.74233128834356,1.20750194509168,"Past5_Values" +"past_5_val_performance",489,0.581758803833149,0.496620648903112,0.262831258824387,0.208327195194515,0.310838445807771,1.81566078622909,"Past5_Values" +"past_5_val_justice",489,0.544175096866213,0.614899388308264,0.498001510881891,0.285905116471129,1.78527607361963,1.30608128977963,"Past5_Values" +"past_10_val_obey",489,0.721099025715259,0.735496422116775,0.664425716417133,0.517074805831286,1.48670756646217,1.44868764748069,"Past10_Values" +"past_10_val_trad",489,0.699317931173517,0.651625897735929,0.526729012061148,0.42141123651556,0.820040899795501,1.75798156379743,"Past10_Values" +"past_10_val_opinion",489,0.588771187844844,0.646832751547301,0.519702144219583,0.364588550760495,1.64826175869121,1.30376269974395,"Past10_Values" +"past_10_val_performance",489,0.55351668398393,0.478408375527429,0.244929855959266,0.200376616835509,0.443762781186094,1.83471950132165,"Past10_Values" +"past_10_val_justice",489,0.560108537428374,0.631452052314873,0.535014418130335,0.327929005818444,1.74437627811861,1.30497710139827,"Past10_Values" +"fut_5_val_obey",489,0.700174060635079,0.717369965324528,0.634160062128523,0.478284049269446,1.56237218813906,1.41156497288206,"Fut5_Values" +"fut_5_val_trad",489,0.684995739181661,0.615028851640065,0.480050391808705,0.377408140507607,0.848670756646217,1.75951839768344,"Fut5_Values" +"fut_5_val_opinion",489,0.545019183280397,0.639424824935632,0.517162575343332,0.332824444749761,1.89366053169734,1.12940426379685,"Fut5_Values" +"fut_5_val_performance",489,0.581699372370146,0.482137762430639,0.238348148486326,0.204916644546241,-0.0797546012269939,1.86528333152611,"Fut5_Values" +"fut_5_val_justice",489,0.526456662872082,0.624387414351861,0.528804174667136,0.290831061422937,1.94683026584867,1.2151853286707,"Fut5_Values" +"fut_10_val_obey",489,0.67147140060502,0.693603145950621,0.589868593848388,0.431780483876993,1.51738241308793,1.41573581161763,"Fut10_Values" +"fut_10_val_trad",489,0.636675327615661,0.565743495025689,0.403989463763509,0.315088808797798,0.918200408997955,1.70145069271899,"Fut10_Values" +"fut_10_val_opinion",489,0.510088791990318,0.613043590386331,0.49754205921816,0.282121644345064,1.91820040899795,1.14941896971933,"Fut10_Values" +"fut_10_val_performance",489,0.603269240628886,0.49130396981941,0.249094328967579,0.207160103665057,-0.0940695296523517,1.94160276957668,"Fut10_Values" +"fut_10_val_justice",489,0.536046620201248,0.635687888500738,0.567633226456552,0.287056659966936,1.9120654396728,1.26525026189172,"Fut10_Values" diff --git a/eohi2/reliability_summary_ehi.csv b/eohi2/reliability_summary_ehi.csv new file mode 100644 index 0000000..a9c3d50 --- /dev/null +++ b/eohi2/reliability_summary_ehi.csv @@ -0,0 +1,5 @@ +"Variable","n","Mean","SD","Min","Max","Median" +"ehiDGEN_5_mean",489,0.06203,1.45735,-7.66667,5.66667,0 +"ehiDGEN_10_mean",489,0.30061,1.89245,-8,9,0 +"ehi5_global_mean",489,0.06752,0.46201,-1.93333,3.33333,0 +"ehi10_global_mean",489,0.12304,0.52522,-2.46667,2.33333,0 diff --git a/eohi2/reliability_summary_table.csv b/eohi2/reliability_summary_table.csv new file mode 100644 index 0000000..7aaaece --- /dev/null +++ b/eohi2/reliability_summary_table.csv @@ -0,0 +1,16 @@ +Scale,Time_Frame,Domain,Raw_Alpha,Std_Alpha,G6_SMC,Average_r,S_N,ASE,Mean,SD,Median_r +Present_Preferences,Present,Preferences,0.5248372,0.5538292,0.5041749,0.1988841,1.241294,0.0336335,1.582004,0.8713115,0.1965662 +Past5_Preferences,Past5,Preferences,0.5649127,0.5893789,0.5467387,0.2230397,1.435335,0.03089417,1.410634,0.9559399,0.2104482 +Past10_Preferences,Past10,Preferences,0.488938,0.523742,0.4772804,0.1802878,1.099702,0.03649826,1.397546,0.9004519,0.1690398 +Fut5_Preferences,Fut5,Preferences,0.5692099,0.587553,0.5414701,0.2217358,1.424554,0.03082567,1.587321,0.9036826,0.2250345 +Fut10_Preferences,Fut10,Preferences,0.5698939,0.5847131,0.5479539,0.2197222,1.407974,0.03076925,1.58773,0.8931506,0.2489621 +Present_Personality,Present,Personality,0.5150363,0.5266182,0.5589141,0.1819987,1.11246,0.0351599,0.6861963,0.9615554,0.2041057 +Past5_Personality,Past5,Personality,0.6124713,0.619984,0.6719927,0.2460191,1.631468,0.0287073,0.5308793,1.114899,0.2033224 +Past10_Personality,Past10,Personality,0.5912415,0.6040201,0.6557158,0.2337612,1.525381,0.03034508,0.5083845,1.11603,0.2218243 +Fut5_Personality,Fut5,Personality,0.5110326,0.5338022,0.5987905,0.186332,1.145012,0.03652723,0.8159509,0.9646153,0.1559173 +Fut10_Personality,Fut10,Personality,0.6090355,0.6252252,0.685506,0.2501803,1.668269,0.02925517,0.7873211,1.045719,0.2084592 +Present_Values,Present,Values,0.5355957,0.5489562,0.5671587,0.1957639,1.217079,0.03206684,1.280982,0.8331172,0.2003739 +Past5_Values,Past5,Values,0.5392641,0.5606175,0.5585066,0.2033042,1.275921,0.03308046,1.248671,0.8889135,0.1781123 +Past10_Values,Past10,Values,0.598008,0.6176378,0.6277172,0.2441788,1.615321,0.028953,1.22863,0.957626,0.22824 +Fut5_Values,Fut5,Values,0.5616573,0.5904551,0.6070898,0.2238116,1.441735,0.03130214,1.234356,0.9067855,0.2086639 +Fut10_Values,Fut10,Values,0.5247822,0.5552694,0.5921832,0.1998146,1.248552,0.03421231,1.234356,0.8939492,0.1716286 diff --git a/eohi2/reliability_total_stats.csv b/eohi2/reliability_total_stats.csv new file mode 100644 index 0000000..e9b2ed7 --- /dev/null +++ b/eohi2/reliability_total_stats.csv @@ -0,0 +1,16 @@ +"","raw_alpha","std.alpha","G6(smc)","average_r","S/N","ase","mean","sd","median_r","Scale" +"",0.524837176522332,0.553829215286623,0.504174940472708,0.198884105541229,1.24129421795828,0.0336334969426407,1.58200408997955,0.871311471467641,0.196566167518602,"Present_Preferences" +"1",0.564912722220734,0.589378860132211,0.546738746435519,0.22303966092054,1.43533491802681,0.0308941742691604,1.41063394683027,0.955939911124814,0.210448229100241,"Past5_Preferences" +"2",0.488938015592646,0.523741957363981,0.477280413673376,0.180287833874793,1.0997020742477,0.0364982616369277,1.39754601226994,0.900451907508163,0.169039817687607,"Past10_Preferences" +"3",0.569209926099011,0.587552986295927,0.541470051967843,0.221735842316891,1.42455386212953,0.0308256733900787,1.58732106339468,0.903682573605473,0.225034470668277,"Fut5_Preferences" +"4",0.569893923672617,0.584713128809275,0.547953937618955,0.219722180810047,1.40797402800807,0.030769250713945,1.58773006134969,0.893150599035559,0.248962058088766,"Fut10_Preferences" +"5",0.515036307894255,0.52661823840084,0.558914144717418,0.181998726798371,1.1124599237238,0.0351599033205381,0.686196319018405,0.961555396767132,0.204105686777363,"Present_Personality" +"6",0.612471320153527,0.619983957204332,0.671992695708677,0.246019115026492,1.63146785236562,0.0287072990929594,0.530879345603272,1.11489884298299,0.203322368209586,"Past5_Personality" +"7",0.591241545372305,0.604020126001091,0.655715772296891,0.233761201514659,1.52538087327831,0.0303450801186001,0.50838445807771,1.1160303844888,0.221824316759824,"Past10_Personality" +"8",0.511032639809882,0.533802167833885,0.598790528165166,0.186331954614907,1.14501211932638,0.0365272328332164,0.815950920245399,0.96461533871518,0.155917272941721,"Fut5_Personality" +"9",0.609035486557918,0.625225232917015,0.685505971524611,0.25018025129125,1.66826928553216,0.0292551671898657,0.787321063394683,1.04571862359807,0.208459229757198,"Fut10_Personality" +"10",0.535595691427291,0.54895616646617,0.567158678677804,0.195763852489432,1.21707941812488,0.0320668400557243,1.28098159509202,0.833117206879242,0.200373890519972,"Present_Values" +"11",0.539264061366404,0.560617466162052,0.558506574695116,0.203304202907843,1.27592114612552,0.0330804649574291,1.24867075664622,0.888913542966066,0.178112263945994,"Past5_Values" +"12",0.598007977448774,0.617637779333297,0.627717176437975,0.244178794663808,1.61532114301554,0.0289529973387747,1.22862985685072,0.957625972970001,0.22823997774938,"Past10_Values" +"13",0.561657287279953,0.59045511305663,0.607089843355526,0.223811572474266,1.44173479362294,0.0313021399223332,1.23435582822086,0.906785465986053,0.208663864861605,"Fut5_Values" +"14",0.524782172776736,0.555269397557299,0.5921831802114,0.199814645995494,1.24855225727094,0.034212310256695,1.23435582822086,0.893949174855698,0.171628576085157,"Fut10_Values" diff --git a/eohi2/residual_plots.pdf b/eohi2/residual_plots.pdf new file mode 100644 index 0000000..ac52a1f Binary files /dev/null and b/eohi2/residual_plots.pdf differ diff --git a/eohi2/residual_plots_domain_general_vars.pdf b/eohi2/residual_plots_domain_general_vars.pdf new file mode 100644 index 0000000..b089f8d Binary files /dev/null and b/eohi2/residual_plots_domain_general_vars.pdf differ diff --git a/eohi2/residual_plots_domain_vars.pdf b/eohi2/residual_plots_domain_vars.pdf new file mode 100644 index 0000000..177aac0 Binary files /dev/null and b/eohi2/residual_plots_domain_vars.pdf differ diff --git a/eohi2/results exp2 - mixed anova - DGEN.txt b/eohi2/results exp2 - mixed anova - DGEN.txt new file mode 100644 index 0000000..a92c88f Binary files /dev/null and b/eohi2/results exp2 - mixed anova - DGEN.txt differ diff --git a/eohi2/results exp2 - mixed anova - domain means.txt b/eohi2/results exp2 - mixed anova - domain means.txt new file mode 100644 index 0000000..f2f02bf Binary files /dev/null and b/eohi2/results exp2 - mixed anova - domain means.txt differ diff --git a/eohi2/spearman_correlations.csv b/eohi2/spearman_correlations.csv new file mode 100644 index 0000000..c8a142e --- /dev/null +++ b/eohi2/spearman_correlations.csv @@ -0,0 +1,24 @@ +"","ehiDGEN_5_Pref","ehiDGEN_5_Pers","ehiDGEN_5_Val","ehiDGEN_10_Pref","ehiDGEN_10_Pers","ehiDGEN_10_Val","ehi5_pref_MEAN","ehi5_pers_MEAN","ehi5_val_MEAN","ehi10_pref_MEAN","ehi10_pers_MEAN","ehi10_val_MEAN","ehi5.10_pref_MEAN","ehi5.10_pers_MEAN","ehi5.10_val_MEAN","ehiDGEN_5_mean","ehiDGEN_10_mean","ehi5_global_mean","ehi10_global_mean","ehi5.10_global_mean","aot_total","crt_correct","crt_int" +"ehiDGEN_5_Pref",1,0.37619,0.3249,0.33447,0.21805,0.26734,0.21538,0.03436,0.05287,0.17037,0.12579,0.09526,0.13561,0.05636,0.05179,0.69574,0.31998,0.14289,0.18242,0.08631,-0.03869,0.0334,-0.04218 +"ehiDGEN_5_Pers",0.37619,1,0.30306,0.24757,0.26161,0.24534,0.13521,0.04797,0.11723,0.13172,0.09545,0.10946,0.13891,0.09251,0.09742,0.70662,0.32649,0.13461,0.14544,0.1541,-0.13625,0.06143,-0.03875 +"ehiDGEN_5_Val",0.3249,0.30306,1,0.31017,0.199,0.2905,0.13349,0.09272,0.10051,0.06236,0.13658,0.01499,0.00501,-0.03013,0.11185,0.70518,0.31757,0.13132,0.08635,0.05544,-0.08083,0.02187,-0.02412 +"ehiDGEN_10_Pref",0.33447,0.24757,0.31017,1,0.46452,0.43452,0.18321,0.03057,0.11187,0.24955,0.15371,0.16753,0.18604,0.10467,0.11631,0.35727,0.76384,0.15156,0.2607,0.18113,0.01223,0.05692,-0.05415 +"ehiDGEN_10_Pers",0.21805,0.26161,0.199,0.46452,1,0.46457,0.09387,0.13608,0.18347,0.17656,0.30535,0.2146,0.18152,0.16833,0.12806,0.32281,0.78465,0.19727,0.30721,0.20508,-0.00521,0.06281,-0.08322 +"ehiDGEN_10_Val",0.26734,0.24534,0.2905,0.43452,0.46457,1,0.04169,0.05874,0.16366,0.19194,0.19761,0.26513,0.18139,0.07342,0.1798,0.34966,0.75262,0.13085,0.28381,0.18359,-0.04172,-0.04688,0.02993 +"ehi5_pref_MEAN",0.21538,0.13521,0.13349,0.18321,0.09387,0.04169,1,0.1693,0.10448,0.46052,0.11393,0.11074,0.17817,0.10369,0.07376,0.20803,0.14654,0.56385,0.31291,0.15848,-0.00916,0.09204,-0.11127 +"ehi5_pers_MEAN",0.03436,0.04797,0.09272,0.03057,0.13608,0.05874,0.1693,1,0.16382,0.11573,0.34264,0.17997,0.00013,0.18128,-0.03767,0.1002,0.10407,0.72227,0.32424,0.08868,-0.00232,0.04188,-0.03898 +"ehi5_val_MEAN",0.05287,0.11723,0.10051,0.11187,0.18347,0.16366,0.10448,0.16382,1,0.17367,0.16463,0.36518,0.10557,0.08891,0.22456,0.14057,0.173,0.55366,0.29722,0.18591,-0.04364,0.03835,-0.06069 +"ehi10_pref_MEAN",0.17037,0.13172,0.06236,0.24955,0.17656,0.19194,0.46052,0.11573,0.17367,1,0.23557,0.26387,0.48179,0.10317,0.17413,0.16263,0.27313,0.31536,0.68222,0.32843,-0.00663,0.07661,-0.02095 +"ehi10_pers_MEAN",0.12579,0.09545,0.13658,0.15371,0.30535,0.19761,0.11393,0.34264,0.16463,0.23557,1,0.20852,0.24951,0.26535,0.03143,0.17774,0.2748,0.31502,0.69695,0.2552,0.00863,0.06209,-0.07836 +"ehi10_val_MEAN",0.09526,0.10946,0.01499,0.16753,0.2146,0.26513,0.11074,0.17997,0.36518,0.26387,0.20852,1,0.23933,0.15103,0.37789,0.11271,0.27275,0.30689,0.61473,0.34727,-0.00384,0.05989,-0.05798 +"ehi5.10_pref_MEAN",0.13561,0.13891,0.00501,0.18604,0.18152,0.18139,0.17817,0.00013,0.10557,0.48179,0.24951,0.23933,1,0.1855,0.16348,0.10793,0.23412,0.12725,0.43766,0.60749,-0.0126,-0.0116,0.00927 +"ehi5.10_pers_MEAN",0.05636,0.09251,-0.03013,0.10467,0.16833,0.07342,0.10369,0.18128,0.08891,0.10317,0.26535,0.15103,0.1855,1,0.19419,0.07884,0.15135,0.2099,0.22668,0.67771,-0.00639,0.03097,-0.02351 +"ehi5.10_val_MEAN",0.05179,0.09742,0.11185,0.11631,0.12806,0.1798,0.07376,-0.03767,0.22456,0.17413,0.03143,0.37789,0.16348,0.19419,1,0.09698,0.17612,0.10609,0.24157,0.61582,-0.01869,0.01688,-0.02344 +"ehiDGEN_5_mean",0.69574,0.70662,0.70518,0.35727,0.32281,0.34966,0.20803,0.1002,0.14057,0.16263,0.17774,0.11271,0.10793,0.07884,0.09698,1,0.41371,0.21106,0.19761,0.13217,-0.06843,0.04764,-0.04247 +"ehiDGEN_10_mean",0.31998,0.32649,0.31757,0.76384,0.78465,0.75262,0.14654,0.10407,0.173,0.27313,0.2748,0.27275,0.23412,0.15135,0.17612,0.41371,1,0.20775,0.37137,0.24397,-0.007,0.04869,-0.06069 +"ehi5_global_mean",0.14289,0.13461,0.13132,0.15156,0.19727,0.13085,0.56385,0.72227,0.55366,0.31536,0.31502,0.30689,0.12725,0.2099,0.10609,0.21106,0.20775,1,0.43876,0.21598,-0.01214,0.09177,-0.11142 +"ehi10_global_mean",0.18242,0.14544,0.08635,0.2607,0.30721,0.28381,0.31291,0.32424,0.29722,0.68222,0.69695,0.61473,0.43766,0.22668,0.24157,0.19761,0.37137,0.43876,1,0.42161,0.03835,0.08613,-0.07775 +"ehi5.10_global_mean",0.08631,0.1541,0.05544,0.18113,0.20508,0.18359,0.15848,0.08868,0.18591,0.32843,0.2552,0.34727,0.60749,0.67771,0.61582,0.13217,0.24397,0.21598,0.42161,1,-0.03144,0.03357,-0.02333 +"aot_total",-0.03869,-0.13625,-0.08083,0.01223,-0.00521,-0.04172,-0.00916,-0.00232,-0.04364,-0.00663,0.00863,-0.00384,-0.0126,-0.00639,-0.01869,-0.06843,-0.007,-0.01214,0.03835,-0.03144,1,-0.03485,-0.01469 +"crt_correct",0.0334,0.06143,0.02187,0.05692,0.06281,-0.04688,0.09204,0.04188,0.03835,0.07661,0.06209,0.05989,-0.0116,0.03097,0.01688,0.04764,0.04869,0.09177,0.08613,0.03357,-0.03485,1,-0.8815 +"crt_int",-0.04218,-0.03875,-0.02412,-0.05415,-0.08322,0.02993,-0.11127,-0.03898,-0.06069,-0.02095,-0.07836,-0.05798,0.00927,-0.02351,-0.02344,-0.04247,-0.06069,-0.11142,-0.07775,-0.02333,-0.01469,-0.8815,1 diff --git a/eohi2/spearman_correlations_domain_general_vars.csv b/eohi2/spearman_correlations_domain_general_vars.csv new file mode 100644 index 0000000..5e5bffd --- /dev/null +++ b/eohi2/spearman_correlations_domain_general_vars.csv @@ -0,0 +1,15 @@ +"","DGEN_past_5_mean","DGEN_past_10_mean","DGEN_fut_5_mean","DGEN_fut_10_mean","DGEN_past_5.10_mean","DGEN_fut_5.10_mean","DGENpast_global_mean","DGENfut_global_mean","DGEN_5_global_mean","DGEN_10_global_mean","DGEN_5.10_global_mean","aot_total","crt_correct","crt_int" +"DGEN_past_5_mean",1,0.88535,0.85584,0.78974,0.26449,0.21398,0.93151,0.81876,0.96121,0.89049,0.23816,0.37682,-0.05708,-0.03174 +"DGEN_past_10_mean",0.88535,1,0.81006,0.75748,0.42358,0.24628,0.97423,0.78469,0.88138,0.93732,0.36831,0.36885,-0.03556,-0.04278 +"DGEN_fut_5_mean",0.85584,0.81006,1,0.88073,0.21027,0.23957,0.8213,0.9346,0.96197,0.89627,0.23304,0.4002,-0.08823,-0.00053 +"DGEN_fut_10_mean",0.78974,0.75748,0.88073,1,0.22351,0.32449,0.77226,0.96393,0.86767,0.93292,0.3045,0.37271,-0.07379,0.00237 +"DGEN_past_5.10_mean",0.26449,0.42358,0.21027,0.22351,1,0.4854,0.49632,0.28071,0.25416,0.35702,0.85739,0.05034,-0.01365,-0.01583 +"DGEN_fut_5.10_mean",0.21398,0.24628,0.23957,0.32449,0.4854,1,0.29164,0.44549,0.23889,0.31313,0.83133,0.06506,-0.05264,0.04942 +"DGENpast_global_mean",0.93151,0.97423,0.8213,0.77226,0.49632,0.29164,1,0.80914,0.91123,0.93349,0.43487,0.36926,-0.04808,-0.0357 +"DGENfut_global_mean",0.81876,0.78469,0.9346,0.96393,0.28071,0.44549,0.80914,1,0.91126,0.93233,0.40462,0.38248,-0.08661,0.00976 +"DGEN_5_global_mean",0.96121,0.88138,0.96197,0.86767,0.25416,0.23889,0.91123,0.91126,1,0.92924,0.25351,0.40173,-0.07909,-0.01488 +"DGEN_10_global_mean",0.89049,0.93732,0.89627,0.93292,0.35702,0.31313,0.93349,0.93233,0.92924,1,0.37336,0.39304,-0.06077,-0.01921 +"DGEN_5.10_global_mean",0.23816,0.36831,0.23304,0.3045,0.85739,0.83133,0.43487,0.40462,0.25351,0.37336,1,0.0581,-0.03691,0.01187 +"aot_total",0.37682,0.36885,0.4002,0.37271,0.05034,0.06506,0.36926,0.38248,0.40173,0.39304,0.0581,1,-0.03485,-0.01469 +"crt_correct",-0.05708,-0.03556,-0.08823,-0.07379,-0.01365,-0.05264,-0.04808,-0.08661,-0.07909,-0.06077,-0.03691,-0.03485,1,-0.8815 +"crt_int",-0.03174,-0.04278,-0.00053,0.00237,-0.01583,0.04942,-0.0357,0.00976,-0.01488,-0.01921,0.01187,-0.01469,-0.8815,1 diff --git a/eohi2/spearman_correlations_domain_vars.csv b/eohi2/spearman_correlations_domain_vars.csv new file mode 100644 index 0000000..ef574df --- /dev/null +++ b/eohi2/spearman_correlations_domain_vars.csv @@ -0,0 +1,15 @@ +"","NPast_5_mean","NPast_10_mean","NFut_5_mean","NFut_10_mean","X5.10past_mean","X5.10fut_mean","NPast_global_mean","NFut_global_mean","X5.10_global_mean","N5_global_mean","N10_global_mean","aot_total","crt_correct","crt_int" +"NPast_5_mean",1,0.80751,0.65783,0.6483,0.64576,0.51959,0.93764,0.68215,0.68103,0.92358,0.81385,0.15045,0.02888,-0.05366 +"NPast_10_mean",0.80751,1,0.63926,0.63208,0.74853,0.4813,0.95773,0.66378,0.73226,0.80306,0.92163,0.14323,0.02102,-0.04334 +"NFut_5_mean",0.65783,0.63926,1,0.82125,0.52238,0.60001,0.6773,0.94642,0.62883,0.88185,0.78251,0.19954,-0.05531,0.02709 +"NFut_10_mean",0.6483,0.63208,0.82125,1,0.55024,0.6486,0.66945,0.95709,0.66552,0.78925,0.86297,0.15514,-0.02049,-0.0094 +"X5.10past_mean",0.64576,0.74853,0.52238,0.55024,1,0.53937,0.74825,0.56558,0.90431,0.65507,0.7434,0.1689,0.00302,-0.01865 +"X5.10fut_mean",0.51959,0.4813,0.60001,0.6486,0.53937,1,0.52161,0.66469,0.82454,0.60043,0.59839,0.20813,-0.00517,-0.03013 +"NPast_global_mean",0.93764,0.95773,0.6773,0.66945,0.74825,0.52161,1,0.70399,0.75297,0.8995,0.91974,0.14834,0.02082,-0.04398 +"NFut_global_mean",0.68215,0.66378,0.94642,0.95709,0.56558,0.66469,0.70399,1,0.68593,0.87213,0.86386,0.18534,-0.03698,0.00842 +"X5.10_global_mean",0.68103,0.73226,0.62883,0.66552,0.90431,0.82454,0.75297,0.68593,1,0.72499,0.78526,0.20655,-0.00454,-0.02545 +"N5_global_mean",0.92358,0.80306,0.88185,0.78925,0.65507,0.60043,0.8995,0.87213,0.72499,1,0.88104,0.18591,-0.01808,-0.00733 +"N10_global_mean",0.81385,0.92163,0.78251,0.86297,0.7434,0.59839,0.91974,0.86386,0.78526,0.88104,1,0.15044,-0.00813,-0.01654 +"aot_total",0.15045,0.14323,0.19954,0.15514,0.1689,0.20813,0.14834,0.18534,0.20655,0.18591,0.15044,1,-0.03485,-0.01469 +"crt_correct",0.02888,0.02102,-0.05531,-0.02049,0.00302,-0.00517,0.02082,-0.03698,-0.00454,-0.01808,-0.00813,-0.03485,1,-0.8815 +"crt_int",-0.05366,-0.04334,0.02709,-0.0094,-0.01865,-0.03013,-0.04398,0.00842,-0.02545,-0.00733,-0.01654,-0.01469,-0.8815,1 diff --git a/eohi3/protocol/2025-xxx - Mandel Levit - clean.docx b/eohi3/protocol/2025-xxx - Mandel Levit - clean.docx new file mode 100644 index 0000000..6c63436 Binary files /dev/null and b/eohi3/protocol/2025-xxx - Mandel Levit - clean.docx differ diff --git a/eohi3/protocol/2025-xxx - Mandel & Levit.docx b/eohi3/protocol/2025-xxx - Mandel & Levit.docx new file mode 100644 index 0000000..44070f5 Binary files /dev/null and b/eohi3/protocol/2025-xxx - Mandel & Levit.docx differ diff --git a/eohi3/protocol/survey questions.docx b/eohi3/protocol/survey questions.docx new file mode 100644 index 0000000..e3f5436 Binary files /dev/null and b/eohi3/protocol/survey questions.docx differ diff --git a/eohi3/protocol/~$25-xxx - Mandel & Levit.docx b/eohi3/protocol/~$25-xxx - Mandel & Levit.docx new file mode 100644 index 0000000..6cd00d1 Binary files /dev/null and b/eohi3/protocol/~$25-xxx - Mandel & Levit.docx differ diff --git a/eohi3/protocol/~WRL1081.tmp b/eohi3/protocol/~WRL1081.tmp new file mode 100644 index 0000000..420112d Binary files /dev/null and b/eohi3/protocol/~WRL1081.tmp differ diff --git a/eohi_draft 2025-10-07.pptx b/eohi_draft 2025-10-07.pptx new file mode 100644 index 0000000..51f8d4d Binary files /dev/null and b/eohi_draft 2025-10-07.pptx differ diff --git a/eohi_draft 2025-10-08b.pptx b/eohi_draft 2025-10-08b.pptx new file mode 100644 index 0000000..998413e Binary files /dev/null and b/eohi_draft 2025-10-08b.pptx differ diff --git a/eohi_draft.pptx b/eohi_draft.pptx new file mode 100644 index 0000000..dec1423 Binary files /dev/null and b/eohi_draft.pptx differ diff --git a/lit review/cultural symmetry in past and future change.pdf b/lit review/cultural symmetry in past and future change.pdf new file mode 100644 index 0000000..becbc08 Binary files /dev/null and b/lit review/cultural symmetry in past and future change.pdf differ diff --git a/lit review/evidence of ehi in work motivations.pdf b/lit review/evidence of ehi in work motivations.pdf new file mode 100644 index 0000000..53fbd10 Binary files /dev/null and b/lit review/evidence of ehi in work motivations.pdf differ diff --git a/lit review/gutral et al 2022 - normative based beliefs as a basis for perceived changes in personality traits across the lifespan.pdf b/lit review/gutral et al 2022 - normative based beliefs as a basis for perceived changes in personality traits across the lifespan.pdf new file mode 100644 index 0000000..4d0ea7f Binary files /dev/null and b/lit review/gutral et al 2022 - normative based beliefs as a basis for perceived changes in personality traits across the lifespan.pdf differ diff --git a/lit review/haas omura - cultural differences in susceptibility to the ehi.pdf b/lit review/haas omura - cultural differences in susceptibility to the ehi.pdf new file mode 100644 index 0000000..0e806a0 Binary files /dev/null and b/lit review/haas omura - cultural differences in susceptibility to the ehi.pdf differ diff --git a/lit review/harris busseri - ehi for life satisfaction.pdf b/lit review/harris busseri - ehi for life satisfaction.pdf new file mode 100644 index 0000000..d77019b Binary files /dev/null and b/lit review/harris busseri - ehi for life satisfaction.pdf differ diff --git a/lit review/sachi et al - Forever young_ The end of history illusion in children.pdf b/lit review/sachi et al - Forever young_ The end of history illusion in children.pdf new file mode 100644 index 0000000..a6b6ce4 Binary files /dev/null and b/lit review/sachi et al - Forever young_ The end of history illusion in children.pdf differ diff --git a/readme_domain_mixed_anova.txt b/readme_domain_mixed_anova.txt new file mode 100644 index 0000000..e69de29